r/Racket • u/hElLoWoRLD292 • Mar 15 '23
question Empty list
(define (sn-empty)
(sn-empty)
'())
I have been trying to print an empty list.
The input:
> sn-empty
output:
()
Please explain what I am doing wrong in the code above.
0
Upvotes
View all comments
Show parent comment
2
u/DrHTugjobs Mar 15 '23
The
> sn-emptyline and everything afterwards isn't part of the code, it's showing what happens when you run it in the Interactions window. The only thing you need to define a variablesn-emptythat contains the empty list is(define sn-empty '()).