Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are considered atoms in Scheme?

Tags:

scheme

Can someone please explain or link me to any helpful resources ( I couldn't find any threads on google) that could help me understand what atoms are.

like image 487
ms. sakura Avatar asked Sep 26 '12 20:09

ms. sakura


1 Answers

Nowadays we consider an atom an element that's not a cons-pair and that is not null. That includes:

  • Numbers
  • Strings
  • Symbols
  • Booleans
  • Characters

This is best expressed with the following procedure, taken from the book The Little Schemer:

(define atom?
  (lambda (x)
    (and (not (pair? x)) (not (null? x)))))
like image 174
Óscar López Avatar answered Sep 21 '22 10:09

Óscar López