ml

What languages implement features from functional programming?

Lisp developed a set of interesting language features quite early on in the academic world, but most of them never caught on in production environments. Some languages, like JavaScript, adapted basic features like garbage collection and lexical closures, but all the stuff that might actually change how you write programs on a large scal...

How do I use the Queue library in SML/NJ

I see that the SML/NJ includes a queue structure. I can't figure out how to use it. How do I use the additional libraries provided by SML/NJ? ...

Understanding the type error: "expected signature Int*Int->Int but got Int*Int->Int"

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 can get things like: expected signature Int*Int->Int but got Int*Int->Int Can you give an example of a function definition (or two?) ...

What background is needed for reading "Purely Functional Data Structures" ?

I have just finished reading Little Schemer.. Now I am planning on reading Purely Functional Data Structures.. but the notations in the book looks very complicated.. are there easier alternative to this book that talk about data structure in functional languages.. if not then what do I need to read before I can start on this book... Th...

What are the differences between SML and Ocaml?

What sets the two ML dialects apart? ...

Prime divisors of a number in ML

In ML i want to get the prime divisors of a number. How can I do this, I am beginner. ...

Doing a N-dimensional walk in pure functional ML ?

The idea is to walk over multiple dimensions, each one defined as a range (* lower_bound, upper_bound, number_of_steps *) type range = real * real * int so functions like fun foo y x or fun foo z y x could be applied to the whole square X*Y or cube X*Y*Z. SML/NJ doesn't like my implementation below : test2.sml:7.5-22.6 Error: right-...

Resources for Learning about Non-C Compilers?

When it comes to learning about C compilers LCC seems like the compiler of choice for many. Also, there is another StackOverflow article here on learning compilers in general. However, I've previously studied C compilers and am looking for something a bit deeper in terms of programming paradigms. To be clear, what I am looking for are...

Editor for programming ML on windows?

I know I can use Emacs but I haven't used it earlier... are there any other alternatives?? Thanks ...

Which ML implementation for working throughthe book " purely functional datastructures"?

Hi, I was using Moscow ML to work through the exercises in PFD till I hit chapter on Lazy Evaluation. Mosml implementation does not have any thing like $ notation described in the book. Mosml comes with suspension datatype but I cannot use pattern matching as described in the book. Which implementation of ML did you use to work though...

GUI for Standard ML?

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 would be perfect if I could do some GUI programming with Standard ML, too. Is there anything like Gtk, Qt, or WxWidgets binding for Standa...

Getting started with Standard ML

I'm looking for some kind of "ML for beginners" guide - google has led me to some obscure mailing lists or way-over-my-head texts so far. The problem is, I have zero functional programming experience so far, and wrapping my head around the concepts has turned out far more difficult than expected. For example, the task I'm trying to do n...

What exactly does this Standard ML code do?

I'm reading Chris Okasaki's purely functional data structures, and there's one example I am having trouble with. It is located here. In particular, I don't understand how the rotate and exec functions work: fun rotate($Nil, y::_, a) = $Cons (y, a) | rotate ($Cons (x, xs), y :: ys, a) = $Cons(x, rotate (xs, ys, $Cons (y, a...

Inferred type appears to detect an infinite loop, but what's really happening?

In Andrew Koenig's An anecdote about ML type inference, the author uses merge sort as a learning exercise for ML and is pleased to find an "incorrect" type inference: Much to my surprise, the compiler reported a type of 'a list -> int list In other words, this sort function accepts a list of any type at all and returns a list ...

How Functional language are different from the language implementation point of view.

There is the whole new paradigm of "functional programming", which needs a total change of thought patterns compared to procedural programming. It uses higher order functions, purity, monads, etc., which we don't usually see in imperative and object oriented languages. My question is how the implementation of these languages differs fr...

ML IDE and Compiler for Windows or Linux

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 (and stackOverFlowing ! ) but all I found was plain compilers for Linux (at most with an interactive console), but no IDE nor Eclipse/NetBeans plugin. An...

Open file in ML(SMLNJ)

I need to read file in ML (SLMNJ) and save it in some structures. I need to read some data that points to graph declaration: [( 1 , 2 , 13 ),( 2 , 3 , 3 ),( 2 , 4 , 8 ),( 2 , 5 , 4 ),( 3 , 1 , 5 ),( 3 , 4 , 1 ),( 4 , 6 , 5 ),( 5 , 5 , 5 ),( 6 , 4 , 6 )] (first number: name of the node , secend number: name of connected node , third n...

Ml file reading limits

I want to read from file but, when I use inputAll or inputLine, it read only 70 character from each line. how can I read from file without limitation ? ...

Standard ml function in datatype problem

I have to create a function about peano numbers defined as the following datatype: datatype 'a peano = P of ('a -> 'a) * 'a -> 'a val zero = P(fn (f, x) => x) The function that I have to implement finds the succesive peano number of the peano parameter P(p). This is what I have written: fun suc (P(p)) = case P(p) of P(fn(f,x)=>x) =>...

Insert element into a tree from a list in Standard ML

I have just started to learn SML on my own and get stuck with a question from the tutorial. Let say I have: tree data type datatype node of (tree*int*tree) | null insert function fun insert (newItem, null) = node (null, newItem, null) | insert (newItem, node (left, oldItem, right)) = if (newItem ...