For Standard ML (SMLNJ), for the foldr and foldl functions, what is the correct way to use the multiplication operator?
Using foldr (op *) 1 [1,2,3];
gives an error
Standard ML of New Jersey v110.78 [built: Thu Aug 31 03:45:42 2017]
- stdIn:1.12 Error: unmatched close comment
- stdIn:1.9-1.18 Error: syntax error: deleting OP INT LBRACKET
It appears that the * has other overloads.
Whitespace normally doesn't matter for SMLNJ. But for the multiplication (asterisk) operation it does.
Make sure you have a space between the asterisk and the closing parenthesis * )
or it will be interpreted as an unopened comment *)
.
foldr (op * ) 1 [1,2,3];