(Arne Babenhauserheide)
2013-03-21: implement ENLIST: : in a line starts a function which ends at the implement ENLIST: : in a line starts a function which ends at the end of the line.
diff --git a/tests/readable-tests.w b/tests/readable-tests.w --- a/tests/readable-tests.w +++ b/tests/readable-tests.w @@ -1,11 +1,9 @@ -define - fibfast n +define : fibfast n if (< n 2) . n fibup n 2 1 0 -define - fibup maxnum count n-1 n-2 +define : fibup maxnum count n-1 n-2 if (= maxnum count) + n-1 n-2 fibup maxnum @@ -13,7 +11,7 @@ define + n-1 n-2 . n-1 -define (factorial n) +define : factorial n if (<= n 1) . 1 * n @@ -25,19 +23,16 @@ define (gcd x y) gcd y rem x y -define (add-if-all-numbers lst) +define : add-if-all-numbers lst call/cc lambda (exit) let loop : lst lst sum 0 - if (null? lst) + if : null? lst . sum - if - not - number? - car lst + if : not : number? : car lst exit #f + (car lst) loop (cdr lst) \ No newline at end of file diff --git a/wisp.py b/wisp.py --- a/wisp.py +++ b/wisp.py @@ -64,6 +64,11 @@ class Line: self.comment = self.content[n+1:] self.content = self.content[:n] break + + # treat inline " : " as opening a bracket which gets closed at the end of the line + toclose = self.content.count(" : ") + self.content = self.content.replace(" : ", " (") + self.content += ")" * toclose #: Is the line effectively empty? self.empty = False