On Sat, Jan 8, 2011 at 9:15 PM, Andreas Kostler
<andreas.koestler.le...@gmail.com> wrote:
> Basically, I want the clojure equivalent of a clisp atom.
> In clisp, atom is true for everything that is not a cons cell.
> The closest match I found is creating a macro that returns true for 
> everything that is not a list:
> clisp:
>
> (atom 1) => true
> (atom '(1 2 3)) => false
>
> I hope that makes things clearer :)
> Andreas

Sounds like you really just want

(defn atom? [x]
  (not
    (or
      (instance? java.util.Collection x)
      (instance? java.util.Map x))))

which returns true for integers, strings, and pretty much any other
objects except lists, seqs, vectors, maps, sets, and the like (and
their mutable java.util counterparts).

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to