Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 now (yes, university :) ) is do a mapping between two lists (a,b) and (c,d), so that the result is a list of (a,d) from pairs where b = c.

What I would ordinarily do is:

result = []
for each x in list1 do
  for each y in list2 do
    if x.b == y.c result.add (x.a, y.d)
  end
end

But, I can't even get started with implementing something like that in SML. For example, I know I could iterate over lists with nested map f list's. However, the runtime (SML/NJ) will only accept this for functions that take only list element as parameter. But how do I know what elements to return if I can only operate with one of the two lists at time?

I am in desperate need of a resource that would go over this kind of thing, preferably with big friendly letters and lots of code examples :/

like image 636
Toms Mikoss Avatar asked Nov 08 '09 20:11

Toms Mikoss


1 Answers

Programming in Standard ML by Prof. Robert Harper of CMU

like image 114
Max Avatar answered Sep 28 '22 05:09

Max