UPDATE: due to the changes suggested here the program is now...slower! Execution time has gone from 640 seconds to 880.
UPDATE 2: Actually, if I remove the -threaded option the performance has improved from 640 to 620 seconds.
UPDATE 3: It looks like there is a chunk of code missing in the haskell version, and this is causing the problem. I will fix and upload.
FINAL UPDATE: new code checked in, GHC version now runs in about 0.7 seconds vs. Ocaml's 2.5.
This repo contains part of John Harrison's automatic theorem prover code from his book "Handbook of Practical Logic and Automated Reasoning", along with a literal translation of some of that code (specifically, the MESON prover) into 500 lines of Haskell (thanks to Ruben Zilibowitz for this code.) Unfortunately, the Haskell version runs about 400 times more slowly than the ocaml version, and I'm trying to find out why.% cd ocaml % apt-get install camlp5 % ocaml # #use "init.ml";; # meson wishnu;; Searching with depth limit 0 Searching with depth limit 1 Searching with depth limit 2 Searching with depth limit 3 [counts to 16 twice.] Searching with depth limit 14 Searching with depth limit 15 Searching with depth limit 16 - : int list = [16; 16] #
To run the Haskell version:% cd haskell % ghc -O2 Main.hs -o test % ./test Searching with depth limit 0 Searching with depth limit 1 Searching with depth limit 2 Searching with depth limit 3 [... fifteen minutes later ...] Searching with depth limit 16 [16,16]
My question is, what the heck?submitted by dsfox
[link] [65 comments]
So this just killed 30 minutes of my life.
ApparentlyminimumBy compare  *** Exception: Prelude.foldr1: empty list
I'm fine with FTP but this is really a bummer. There wasn't a single foldr1 in my code, yet this was the exception. Is there any kind of magic that could be done to keep the generality but provide a decent error message?
Edit: It's not because of FTP.submitted by Darwin226
[link] [43 comments]
Earlier this year, at YOW! Lambda Jam (in Brisbane), I gave a talk about developing a Mac app in Swift. More precisely, I described my take on how to best apply functional programming principles when writing Cocoa (Touch) apps in Swift. The video for the talk “Functional Programming in a Stateful World” is now online (and the slides are on Speaker Deck).
Could someone elaborate more on the comment at 34th minute of this lecture: https://vimeo.com/68669612submitted by varosi
[link] [2 comments]