31 results found for ocaml >>=
State monad in OCaml State monad in OCaml I was trying to implement the state monad in OCaml (as an exercise). My implementation looks like this:
CPS in curried languages CPS in curried languages How does CPS in curried languages like lambda calculus or Ocaml even make sense? Technically, all
otherwise = fib (n-1) + fib (n-2) main = getArgs >>= print . fib . read . head Result: > ghc -O3 -fllvm -optlo-O3 Main.hs -o fib > time ./fib 40 165580141
use GHCi. I know all about compiling to get things fast. Parsing costs should be completely irrelevant: if ML and OCaml can start 300x faster than GHCi,
putStrLn . maximum . filter palindrome $ tails xs >>= zipWith (*) xs where xs = [100..999] Well i got my problem solved 15m after posting my question, but
OCaml and found that they were ~5× slower than the parser generators on offer at the time. I recently revisited this subject and benchmarked Haskell's
mapM (\(x, e') -> eval env' e' >>= \v -> return (x, v)) bs return $ nub (env'' ++ env) This is my test function I want to evaluate: test3 :: Expr test3 =
while writing in another? The assumption that a functional language will be implemented using an imperative one is suspect. OCaml is written in OCaml, and
let rec f g x = ignore(g x) ; fun y -> f g y but ocamlc -rectypes does. OCaml's -rectypes option amounts more or less to disabling the occur-check in
Here is a summary of what I got (shortest first, grouped by similar score). Python, Ruby, JavaScript, Perl, Lua, PHP, Mozart/OZ OCaml, Erlang, Racket,