As far as I can see, Odersky also doesn't follow the "hint", and hence does not pass the test cases provided with the original problem. The hint is not really a hint but rather a change to the problem. The original problem is elegant and essentially consists of inverting a clearly defined function that maps word+number sequences to phone numbers. That's why logic programming (and for comprehensions which is a poor man's logic programming) is so good at it. Unfortunately, implementing the problem plus hint pretty much forces you to use the exact same imperative algorithm as he did to generate his test cases. The people in the study also had to do the same, so if you want your code to be comparable with the results in the study that's what you have to do...
Jules On Saturday, September 22, 2012 6:23:25 PM UTC+2, David Nolen wrote: > > On Sat, Sep 22, 2012 at 11:27 AM, Dennis Haupt <d.ha...@gmail.com<javascript:> > > wrote: > >> here's my solution: >> https://gist.github.com/3766508 >> >> the original (done in 2 hours) solution is commented out. i made some >> improvements and solved the whole thing in 39 lines (counting only the >> content of "main"). doing it in the minimal amount of lines was not my >> goal. i was trying to minimize the logic. shorter code was just a side >> effect. >> >> try to beat it :). let's see how that looks in clojure. > > > Looks pretty convoluted ;) > > Here's Odersky's Scala version and mine that uses core.logic > http://gist.github.com/1107653. > > I'm headed to StrangeLoop so I don't have time to verify that the Scala or > my version fully satisfies the original problem description. But my guess > is that Odersky did really solve the original problem. > > David > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en