Lisp in Dart 2.0
github.com
Lisp in Dart 2.0
1–10 of 22 posts
Re: Lisp in Dart 2.0
#2Re: Lisp in Dart 2.0
#3Couldn't we please base such things on scheme or clojure (for Lisp-1) or common lisp (for Lisp-2).
Re: Lisp in Dart 2.0
#4I thought those were exactly same thing.
Re: Lisp in Dart 2.0
#5"Tail call optimization, which also implies tail recursion optimization" I thought those were exactly same thing.
Re: Lisp in Dart 2.0
#6"Tail call optimization, which also implies tail recursion optimization" I thought those were exactly same thing.
def f(a):
return g(2*a)
def g(a):
return a + 1Re: Lisp in Dart 2.0
#7I have only one question: what is the purpose of this stuff? Was it made to extend the possibilies of Dart?
Re: Lisp in Dart 2.0
#8"Tail call optimization, which also implies tail recursion optimization" I thought those were exactly same thing.
Tail call optimization is returning the result of any function, with tail recursion being the specific case where it's the same function. I think I've seen some languages where they special-case recursion by doing a code transformation, but would stack overflow if you called anything else instead.
def even(x):
return x == 0 or odd(abs(x)-1)
def odd(x):
return x == 1 or even(abs(x)-1)Re: Lisp in Dart 2.0
#9"Tail call optimization, which also implies tail recursion optimization" I thought those were exactly same thing.
def add10(y: int) -> int:
return y+10
def def add11(x: int) -> int:
# won't get optimized
return add10(x)+1
def add11_tail(x: int) -> int:
# should get optimized
return add10(x+1)
in `add11_tail` the call to `add10` is in the tail position, i.e. you can "forget" about `add11_tail`'s stack frame since it's not needed anymore. It's still needed in `add10`, because you start in `add11`, call `add10` and go back to to `add11` to add 1 to the result.Re: Lisp in Dart 2.0
#10"Tail call optimization, which also implies tail recursion optimization" I thought those were exactly same thing.
In a language with guranteed tail call optimization, the below consumes no stack, although there's no recursion. def f(a): return g(2*a) def g(a): return a + 1