Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

ocaml vs haskell

Name: Anonymous 2011-11-03 20:13

Haskell:
[(a,b,c)|a<-[1..n],b<-[a..n],c<-[b..n],a+b+c==n]

Ocaml:
?

Name: Anonymous 2011-11-03 20:22

The set of all tuples (a,b,c), a,b,c integer, such that a is between 1 and n, b is between a and n, and c is between b and n, and a+b+c is equal to n.  Nope, not a single real-life use.

Name: Anonymous 2011-11-04 10:05

how to write it in ocaml then

Name: Max Mouratov 2011-11-16 12:24

Using a syntax extension from Batteries:

[? List: (a, b, c) | a <- 1--n; b <- a--n ; c <- b--n; a + b + c = n ?]

Don't change these.
Name: Email:
Entire Thread Thread List