|
|
Up |
|
|
  |
Author: michele.simionatomichele.simionato Date: Nov 4, 2007 21:36
Yesterday, while performing an Internet search for lightweight
concurrency,
I run into the Alice system, which is an implementation of the ML
language.
I knew nothing about ML, except that a functional language called ML
existed,
however skimming the tutorial I pretty much liked what I saw, so I
want to do
some experiment with ML programming, at least for educational
purposes.
If you have good pointers to resources, references, libraries, etc,
please let me know. I am especially interested in code snippets and
example of idiomatic ML (an ML cookbook or something like that). I
have already discovered that there is a "SICP in ML" resource, which I
am looking at. My first impression if that ML has been heavily
influenced
by Scheme (it looks like it has been designed as a *reaction* to
Scheme)
which I am familiar with, so a reference like "ML for Scheme
programmers" ...
|
| Show full article (3.43Kb) |
|
| | 223 Comments |
|
  |
Author: Vesa KarvonenVesa Karvonen Date: Nov 5, 2007 02:26
michele.simionato@ gmail.com gmail.com> wrote:
[...]
> If you have good pointers to [ML] resources, references, libraries,
> etc, please let me know.
[...]
The MLton wiki has several pages on SML programming techniques and
links to some resources (tutorials, books, ...):
http://mlton.org/StandardML
If you really want to learn how to program in ML, I would strongly
recommend reading a book length treatment on programming in ML. After
finishing it, you should read articles on programming techniques in ML
and other functional languages.
> I have already discovered that there is a "SICP in ML" resource,
> which I am looking at. My first impression if that ML has been
> heavily influenced by Scheme (it looks like it has been designed as
> a *reaction* to Scheme) which I am familiar with, so a reference
> like "ML for Scheme programmers" would be fine for me.
|
| Show full article (4.21Kb) |
|
| | no comments |
|
  |
Author: michele.simionatomichele.simionato Date: Nov 5, 2007 02:57
On Nov 5, 11:26 am, Vesa Karvonen
wrote:
>
> What follows below is a similar program written in Standard ML using
> no libraries beyond the Standard ML Basis library. It is by no means
> the only way or the most elegant way to write such a program in ML.
> It compiles with Alice ML as well as almost any SML compiler
> (e.g. MLton, SML/NJ, Poly ML, MLKit, ...).
>
|
| Show full article (0.99Kb) |
| no comments |
|
  |
|
|
  |
Author: michele.simionatomichele.simionato Date: Nov 5, 2007 06:56
On Nov 5, 12:49 pm, Vesa Karvonen
wrote:
I have yet another question. Which implementation would you recommend
for a beginner?
My only constraints are that it should work both on Linux and on Intel
Mac. I would like something
reliable and with good error messages.
Michele Simionato
|
| |
| no comments |
|
  |
Author: Vesa KarvonenVesa Karvonen Date: Nov 5, 2007 08:04
michele.simionato@ gmail.com gmail.com> wrote:
[...]
> I have yet another question. Which implementation would you
> recommend for a beginner? My only constraints are that it should
> work both on Linux and on Intel Mac. I would like something reliable
> and with good error messages.
Note that Alice ML is an extension of Standard ML. It provides quite a
few features (e.g. futures, higher-order functors, pickling, packages,
... see http://www.ps.uni-sb.de/alice/) that are not included in the
definition of Standard ML (only higher-order functors are provided by a
couple of other SML implementations). So, if you want to play with those
features, then you should go with Alice ML. I can't comment on the
reliability of the implementation or the quality of the error messages,
because I don't use Alice ML on a daily basis.
|
| Show full article (2.22Kb) |
| no comments |
|
  |
Author: Chris RathmanChris Rathman Date: Nov 5, 2007 13:17
> I have already discovered that there is a "SICP in ML" resource, which
> I am looking at. My first impression if that ML has been heavily
> influenced by Scheme (it looks like it has been designed as a
> *reaction* to Scheme) which I am familiar with, so a reference like
> "ML for Scheme programmers" would be fine for me.
The languages have many similarities and have influenced each other
(There's actually a fair amount of ML influence on Scheme). But, if
all you're looking at is my SICP translation in isolation, then the
parallels between the two is being overemphasized on purpose.
Hopefully the resource provides a quick glance (whets the appetite)
for those that are familiar with SICP or Scheme. Other resources,
such as those pointed to by Vesa, will help you get a more methodical
introduction to ML.
Chris
|
| |
| no comments |
|
  |
Author: Jon HarropJon Harrop Date: Nov 5, 2007 15:34
> I have yet another question. Which implementation would you recommend
> for a beginner?
OCaml if you're running Linux or Mac OS X and F# if you're running Windows.
While SML is a very nice language and well worth learning, its user base is
about 10x smaller than OCaml's and is split across various incompatible
compilers. So SML has fewer libraries and is less practical.
|
| |
| no comments |
|
  |
Author: David B. BensonDavid B. Benson Date: Nov 5, 2007 16:21
On Nov 5, 6:56 am, "michele.simion...@ gmail.com"
gmail.com> wrote:
...
> Which implementation would you recommend
> for a beginner?
O'Caml is somewhat different and less clean language that Standard
ML. I prefer SML and use SML/NJ exclusively because of the support
for Concurrent ML. (Book by Reppy.)
Moscow ML was designed as an implementation for beginners and does not
(or anyway, did not do so correctly) support the module features.
Nonetheless, given the intent of the design, you might wish to start
there.
MLton is a good choice as well, especially given Vesa's plug for the
quality of the error messsages.
I don't know enough about MLKit or Alice to offer you any advice
regarding those compilers's error messages.
|
| Show full article (1.40Kb) |
| no comments |
|
  |
|
|
  |
Author: David B. BensonDavid B. Benson Date: Nov 5, 2007 16:50
On Nov 5, 2:57 am, "michele.simion...@ gmail.com"
gmail.com> wrote:
> ...
> What's the preferred data structure? An association
> list? A hash table?
> What if I want to return the result lazily? ...
>
> Michele Simionato
Lists are commonly used, being functional, but hash tables are also
used. I use the RedBlackTree implemenation in the utility library
extensively for the larger lookup data structures required.
SML/NJ implements more than just SML. It includes a very fast
implementation of callcc and also supports lazy computation:
http://www.smlnj.org/
Some of these features may also be in Alice ML, I'm not sure.
Also, there ia an on-line book by Robert Harper (Carenige-Mellon) at
his web site. It is more advanced and theoretical than Paulson's
undergraduate textbook.
|
| |
| no comments |
|
|
|
|