this post was submitted on 27 Nov 2023
1 points (100.0% liked)
Lisp
55 readers
3 users here now
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Yeah "atom?" doesn't appear in r7rs. You could probably get away with (not (pair? x)) [[ unless '() isn't an atom - its been a while! ]]
Hopefully there wouldn't be too many of those. ๐คทโโ๏ธ
(define (atom? x) (not (pair? x)))
is the same as Common Lispatom
, but I've seen some Scheme texts that use versions that treat'()
as not an atom. Can be confusing if you have one definition in mind and look at something that uses the other.If (not (eq? '() #f)) then it may make sense to treat '() as non-atomic. "atomic?" would then be a cheap version of "list?".