I'm using http://rextester.com/runcode to do some scheme testing.
When I run
(define x (cons 3 null))
(write x)
it has an ERROR: Unbound variable: null
.
How do I refer to an empty list in the above context?
(define x (cons 3 '()))
(write x)
Alternatively, you can define null
first:
(define null '())
(define x (cons 3 null))
(write x)
In scheme, the empty list is ()
, not null
.
In other lisps it is also called nil
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With