loop
loop copied to clipboard
stack overflow in the code generator
filter(criteria, ls) => *, [] : [] *, [x:xs] | criteria.@call(x) : [x] + filter(criteria,xs) | else : filter(criteria, xs)
main -> print(filter(divBy2, [1..20])) where divBy2: @(n) -> {(n % 2) == 0}
This causes an infinite loop and eventually a stack overflow in the code generator:
Exception in thread "main" java.lang.StackOverflowError
at java.util.regex.Pattern.append(Unknown Source)
at java.util.regex.Pattern.atom(Unknown Source)
at java.util.regex.Pattern.sequence(Unknown Source)
at java.util.regex.Pattern.expr(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.util.regex.Pattern.
Where as:
main -> print(filter( @(n) -> {(n % 2) == 0} , [1..20])) works great. So does:
main -> print(filter(divBy2, [1..20])) where divBy2(n) -> (n % 2) == 0
Looking at this, sorry about the delay.