As for using lem instead of emacs, the problem is that we could not find an
emacs mode that works flawlessly for nim. The students tried nimrod-mode and
nim-mode:
1 -- nimrod-mode does not highlight multiline comments.
2 -- nim-mode often fail in performing indentation. For instance, in the
listing below, if I place the cursor in front of the colon and press <Enter>,
the part of the text that is after the colon goes to the begining of the line:
proc fib(n: int): int =
var (r1, r2) = (1, 1)
for i in 2..n: (r1,r2) = (r1+r2, r1)
result= r1
Run
The result of pressing <Enter> after the colon is the following:
proc fib(n: int): int =
var (r1, r2) = (1, 1)
for i in 2..n:
(r1,r2) = (r1+r2, r1)
result= r1
Run
Interesting enough, indentation works in the absence of parenthesis. In the
following list, if I press <Enter> after the colon, nim-mode indents correctly.
proc fb(n: int): int =
if n<2: result=1
elif n<3:
result=n
else:
result= fb(n-3)+fb(n-2)+fb(n-2)
Run
proc fb(n: int): int =
if n<2:
result=1
elif n<3:
result=n
else:
result= fb(n-3)+fb(n-2)+fb(n-2)
Run