Skip to main content
Filter by
Sorted by
Tagged with
107 votes
2 answers
21k views

What sets the two ML dialects apart?
Nathan's user avatar
  • 1,081
44 votes
3 answers
5k views

My question is if there is any difference between Standard ML's module system and OCaml module system? Has OCaml all the support of functors , ascriptions etc... that SML has?
Dragno's user avatar
  • 3,134
38 votes
1 answer
4k views

This question started out from My translating of "ML for the Working Programmer" (WorldCat) by L. C. PAULSON to F# which uses functors for the examples. Eventual desire to translate "Purely ...
Guy Coder's user avatar
  • 25.2k
29 votes
6 answers
25k views

I have to write some code in ML and it is my first time I`m going to use the language. Is there any Development Environment for Standard ML? (preferably under Windows). I tried googling but all I ...
Sajad Bahmani's user avatar
28 votes
1 answer
4k views

Someone once showed me a little 'trick' in SML where they wrote out about 3 or 4 functions in their REPL and the resulting type for the last value was extremely long (like many page scrolls long). ...
jkcorrea's user avatar
  • 283
25 votes
2 answers
2k views

In Andrew Koenig’s An anecdote about ML type inference, the author uses implementation of merge sort as a learning exercise for ML and is pleased to find an “incorrect” type ...
Greg Bacon's user avatar
  • 141k
18 votes
1 answer
4k views

I know that semicolons are used as terminators in REPL. But I'm confused about when to use them in a source file. For example it is not necessary after val x = 1. But if I omit it after use "foo.sml",...
Ben's user avatar
  • 3,952
16 votes
3 answers
6k views

Is the o composition operator (eg. val x = foo o bar, where foo and bar are both functions), only usable on single-argument functions and/or functions with equal numbers of arguments? If not, what is ...
GregT's user avatar
  • 1,320
14 votes
1 answer
1k views

I have seen multiple references to the Church Rosser theorem, and in particular the diamond property diagram, while learning functional programming but I have not come across a great code example. If ...
user1411349's user avatar
12 votes
3 answers
9k views

Functors in Standard ML are related to the module system and can generate structures based on other structures. An example of a functor generating list combinators for various types of lists is given ...
sshine's user avatar
  • 16.2k
11 votes
2 answers
3k views

is there a cleaner way of doing this? I'm trying to do pattern matching of a (a' option * (char * nodeType) list ref the only way I found was doing this : match a with | _, l -> match !l with ...
Pacane's user avatar
  • 21.7k
11 votes
1 answer
2k views

I am not sure I understand the difference between the delimited continuation operator pairs prompt/control and reset/shift. I understand some basic examples of use, but in those examples their ...
johjs's user avatar
  • 111
10 votes
3 answers
4k views

I started learning Standard ML recently out of curiosity. So what I know is that is has an efficient compiler (MLton) which allows us to freely use abstractions without worrying about performance. It ...
Phil's user avatar
  • 5,615
9 votes
4 answers
9k views

Can everyone explain to me this piece of code ? let safe_division n = function | 0 -> failwith "divide by 0" | m -> n / m When I excute safeDiv 3 0 , what is the m and n in this case ? In ...
Hoan Dang's user avatar
  • 2,320
9 votes
3 answers
2k views

The comments on Steve Yegge's post about server-side Javascript started discussing the merits of type systems in languages and this comment describes: ... examples from H-M style systems where you ...
devstopfix's user avatar
  • 6,828
9 votes
1 answer
1k views

I am trying to infer the type of the following expression: let rec fix f = f (fix f) which should be given the type (a -> a) -> a After using the bottom up algorithm (described in generalizing ...
user avatar
9 votes
0 answers
822 views

In section 23.8 of his book Types and Programming Languages, Benjamin C. Pierce writes the following: Another well-studied restriction of System F is rank-2 polymorphism, introduced by Leivant (1983)...
authchir's user avatar
  • 1,635
8 votes
2 answers
584 views

I (believe) the following function definition is tail-recursive: fun is_sorted [] = true | is_sorted [x] = true | is_sorted (x::(y::xs)) = if x > y then false else is_sorted (...
Zach Halle's user avatar
8 votes
2 answers
2k views

I'm in a big dilemma, take the following code written in ML: val x = 1 fun f(y) = x + y val x = 2 val y = 3 val z = f (x + y) The value of z is 6. Now if I write the same code in python the value of ...
Mihai Vinaga's user avatar
  • 1,159
8 votes
1 answer
845 views

In chapter 6.3.1 of the thesis Purely Functional Data Structures, says: Then, whenever we create a new tree from a new element and a segment of trees of ranks 0... r-1, we simply compare the new ...
wenlong's user avatar
  • 1,444
7 votes
4 answers
6k views

I am new to OCaml, and I am now trying to implement a function that returns a list of elements of a given list x at indexes in list y. For example, that function should perform the following ...
Allan Jiang's user avatar
  • 11.4k
7 votes
2 answers
2k views

In OCaml, you can nest signatures: module type FOO = sig module type BAR (* … *) end I was just wondering if anyone had any examples of this in use, since I can’t think of any places where it ...
Andy Morris's user avatar
7 votes
1 answer
394 views

runST is a Haskell function that statically constrains the usable lifetime of a resource through types. To do this it uses rank-2 polymorphism. Standard ML's simpler type system only offers rank-1 ...
Alex Celeste's user avatar
  • 13.5k
6 votes
3 answers
3k views

I am learning standard ML using its interpreter. Sometimes I make typo and just want to repeat the previous command like in Linux shell. However, up arrow will end up with printing special characters ...
Alfred Zhong's user avatar
  • 7,191
6 votes
4 answers
484 views

I'm thinking of a function like this: > let applyN (initial : 't) (n:int) (f : 't -> 't) = seq {1..n} |> Seq.fold (fun s _ -> f s) initial;; val applyN : initial:'t -> n:int -> f:('...
vidi's user avatar
  • 2,146

1
2 3 4 5
14