After running around in circles doing stupid Haskell tricks, I modified the plot-generating script to produce nice output in a completely automated fashion. No need to tweak axes or anything like because the ranges are calculated automatically from the data points. I also modified the Makefile of Derangement so that when you do
make count-paraphrases SUITE=verbs
you get a suite/geni-paraphrases/verbs-num-paraphrases.pdf with an autogenerated plot.
That's about it. Today took a pretty strong productivity hit.
Next step is to fix that SemConst loop so we can do parse-gen. Then I see if there is anything I should contribute to the article. Then we have a chapter to write.
learning things
That being said, on #haskell today, I learned a new trick for doing flags a switches. Just use a record and some anonymous functions for GetOpt. I'm keeping the old code though, because setFlag is still somewhat convenient to have (I suspect that the list of flags way makes more sense when you have a looooooooooot of flags), but you have to admit that being able to the flags stuff without any crazy existential types or Typeable or yucky stuff like that is very nice. So, thanks, kosmikus for the simple solution.Another thing I learned today was talking with S: I was wondering about typing and function pointers in C. It turns out you can have some pretty good typing on your function pointers (hey, this is vague for me nowadays). You can type the arguments your pointed-to function expects and the kind of things it returns. The two places where functional programming makes life easier wrt higher order functions is (1) partial application (2) anonymous functions. Anonymous functions are a pretty big deal too. For example, what if you want to return a function as a result? With anonymous functions, it can be one that you make up on the spot. Good to get a clearer picture for this. Higher order functions make life so much easier. Having good support for them is nice... and now I have a better sense for what kind of support, say Haskell, gives me as opposed to, say C.

No comments:
Post a Comment