Re: beginning with ML



On Nov 5, 11:26 am, Vesa Karvonen <vesa.karvo...@xxxxxxxxxxxxxx>
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, ...).
<snip>

That's interesting, thanks. It looks like loops are implemented
exactly as in Scheme.
Is there a "format" utility instead of performing string concatenation
by hand? Also,
you are mixing the formatting of the output with the generation of the
result (i.e. the
print statements are in the core routine). Suppose I want to
accumulate the result
before formatting. What's the preferred data structure? An association
list? A hash table?
What if I want to return the result lazily? Is there a "yield" concept
so that I could
return the averages one at the time?

Michele Simionato

.



Relevant Pages

  • Re: C89, size_t, and long
    ... libraries which have useful stuff). ... So because others here can't think of a good reason to use long instead of size_t and you can't prove there is never such a reason, we must all assume there could be a good reason to not use the mechanisms provided by the standard to deal with a problem? ... If you are claiming there is a reason to avoid the mechanisms the standard provides to allow portability then it is up to *you* to prove your point, not up to others to disprove it. ... but you can hardly blame the consequences on the Standard headers. ...
    (comp.lang.c)
  • Re: C89, size_t, and long
    ... libraries which have useful stuff). ... So because others here can't think of a good reason to use long instead of size_t and you can't prove there is never such a reason, we must all assume there could be a good reason to not use the mechanisms provided by the standard to deal with a problem? ... want to have standard headers included in their own headers which ...
    (comp.lang.c)
  • Re: Verbose functional languages?
    ... convenience of printf for that. ... would suggests thinking about designing and implementing libraries for ... You might even be able to mostly eliminate explicit formatting from your ... SML version, something like ...
    (comp.lang.functional)
  • Re: comparing doubles for equality
    ... AFAIK there is no ANSI/ISO standard for it. ... Fortran 95 seem to have some built-in operators but it's not clear ... LIA,GIA,ICE libraries for interval methods in C++ from Delisoft ... Actually I've been for quite some months proposing getting together ...
    (comp.programming)
  • Re: "Criticism of the C programming language ??????"
    ... "that's not in the standard, ... rewrites of the compiler. ... PH> They got all the compiler vendors to agree to a common ... or graphics libraries or threading libraries, ...
    (comp.lang.c)