Hello,
I'm new to extempore, and scheme in general, so forgive me if there is an obvious mistake here, however I have the following situation:
I have defined sum in plain scheme as the following, and it works fine in Extempore:
(define ssum
(lambda (lst)
( cond
((eqv? (cdr lst) ()) (car lst))
(#t
(ssum (cons
(+ (car lst) (car (cdr lst)))
(cdr (cdr lst))
)
)
)
)
))
for example
(print (ssum (list 1 2 3 4)))
results in 10
however when i define the following as the -i64 version:
<compiles fine>
(bind-type i64list <i64,i64list*>)
(bind-func cons-i64
(lambda (a:i64 b:i64list*)
(let ((pair:i64list* (zone-alloc)))
(tset! pair 0 a)
(tset! pair 1 b)
pair)))
(bind-func car-i64
(lambda (a:i64list*)
(tref a 0)))
(bind-func cdr-i64
(lambda (a:i64list*)
(tref a 1)))
</compiles fine>
(bind-func sum-i64:[i64,i64list*]*
(lambda (lst:i64list)
( cond
((eqv? (cdr-i64 lst) ()) (car-i64 lst))
(#t
(sum-i64 (cons-i64
(+ (car-i64 lst) (car-i64 (cdr-i64 lst)))
(cdr-i64 (cdr-i64 lst))
)
)
)
)
))
^^ compiling sum-i64 results in:
Type Error got NIL, was expecting NIL
What is the proper way to approach finding out which symbol the compiler is complaining about when it outputs NIL?