Make function-declaration example compile and work

This commit is contained in:
Konstantin Nazarov 2024-08-23 22:21:00 +01:00
parent 7a36787bd8
commit 8f6ebf2d0e
Signed by: knazarov
GPG key ID: 4CFE0A42FA409C22
2 changed files with 8 additions and 5 deletions

View file

@ -1,9 +1,12 @@
;; Check that lambdas can be passed as arguments
((lambda (f y) (f y))
(lambda (x) (* x x))
((fn (f y) (f y))
(fn (x) (* x x))
2)
(((lambda (x)
(lambda () (* x x 2)))
(((fn (x)
(fn () (* x x 2)))
2))
(fn foo (x y) (* x y))

View file

@ -554,7 +554,7 @@ class Symbol : public Object {
uint64_t i = 0;
uint64_t j = 0;
while (1) {
if (i == lsize && j == lsize) return 0;
if (i == lsize && j == rsize) return 0;
short cmp = short(i == lsize) - short(j == rsize);
if (cmp != 0) return cmp;