From f83385dbe818e0c652cc946ccfc7b5cd15ec6893 Mon Sep 17 00:00:00 2001 From: Flaviu Tamas Date: Wed, 16 Jul 2014 17:27:23 -0400 Subject: [PATCH] Reorganize, fix bug in code --- content/block.md | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/content/block.md b/content/block.md index b014a4f..b55bfc2 100644 --- a/content/block.md +++ b/content/block.md @@ -21,19 +21,7 @@ block: let b = "3" # Probably a dumb idea ``` -Parentheses can be used as an expression, but they do not provide end of statement inference, so it is necessary to place semicolons yourself. - -``` nimrod -# This doesn't work and I don't know what it should do -square(( - var result = newSeq[float](); - for i in 0..1000: - result[i] = i; - result -)) -``` - -An interesting and unexpected side effect of this syntax is that Nimrod is suitable even for brace purists! +Parentheses can be used as an expression, but they do not provide end of statement inference, so it is necessary to place semicolons yourself. An interesting and unexpected side effect of this syntax is that Nimrod is suitable even for brace purists! ``` nimrod proc square(inSeq: seq[float]): seq[float] = ( @@ -42,4 +30,11 @@ proc square(inSeq: seq[float]): seq[float] = ( result[i] = v*v; ) ) + +square(( # A 1001 long sequence to be squared + var result = newSeq[float](); + for i in 0..1000: + result.add(i); + result +)) ```