I m learning ML, with the SML/NJ dialect. What I m trying to figure out is if there is a line comment operator. I found the block comment operator, (* ... *), but I really miss line comments.
Suggestions? Or am I just stuck with block comments?
I m learning ML, with the SML/NJ dialect. What I m trying to figure out is if there is a line comment operator. I found the block comment operator, (* ... *), but I really miss line comments.
Suggestions? Or am I just stuck with block comments?
You re stuck with block comments.
On the other hand, block comments can be nested: (* (* *) still comment here *)
There is a RFC for line comments, which proposes a hashmark followed by a whitespace.
Single-line comments now ship in both MLton and SML/NJ, as long as you enable sML ("Successor ML") extensions (sml -Cparser.succ-ml=true
for SML/NJ).
Here s a concrete example. In the definition below, the value 1
is ignored, and the definition of a
is taken from the next line (2
) instead. (Below =
denotes a continuation line, and please ignore the broken syntax highlighting.)
$ sml -Cparser.succ-ml=true
- val a = (*) 1
= 2;;
val a = 2 : int
See https://github.com/SMLFamily/Successor-ML/wiki/Summary-of-proposed-changes for more about sML.
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 ...
Possible Duplicate: Open file in ML(SMLNJ) I have a string value which has value like this: "[(1,2,3),(2,3),(6,8)]" -> string but I want to have these values in int type like this: [(1,2,3),...
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 ),( ...
Basically, I want to have a function to return a polymorphic function, some thing like this: fun foo () = fn x => x So the foo function takes in a value of type unit and returns a polymorphic ...
I m learning ML, with the SML/NJ dialect. What I m trying to figure out is if there is a line comment operator. I found the block comment operator, (* ... *), but I really miss line comments. ...
Currently, my code looks like this: fun gradImage () = let val iImg = Gdimage.image(640,480) (0,0,0); val void = mapi gradient iImg; in Gdimage.toPng iImg "gradient.png" ...
I m having some trouble using SML/NJ interactive system, namely, that when I try to use my arrow keys (either left or right to make a correction in the expression I ve typed, up to repeat the last ...
I was trying to make a tail-recursive version of this very simple SML function: fun suffixes [] = [[]] | suffixes (x::xs) = (x::xs) :: suffixes xs; During the course of this, I was using type ...