Advertisement
mark-naylor-1701

atomic and compound data test

Jun 8th, 2024
982
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.29 KB | None | 0 0
  1. (requires 'dash)
  2.  
  3. (defun atomicp (x)
  4.   "Determine if X is a data type that contains a single value."
  5.   (not (compoundp x)))
  6.  
  7. (defun compoundp (x)
  8.   "Determine if X is a data type that contains multiple values."
  9.   (funcall
  10.    (-orfn #'consp #'arrayp #'hash-table-p #'recordp)
  11.    x))
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement