News for hackers. Stuff that matters.
Re:The Evolution of Lisp (1993) [pdf] by behnamoh on Monday May 27, 2024 @11:31AM (#40491702)
I just tried your first example on tryclojure.org and it returned "true":

    user=> (list? (cons 1 '(2 3)))
    true
Re:The Evolution of Lisp (1993) [pdf] by lispm on Monday May 27, 2024 @11:37AM (#40491774)
Your example looks like Clojurescript? It is also inconsistent between variants?

  Clojure 1.11.3
  user=> (list? (cons 1 '(2 3)))
  false
Re:The Evolution of Lisp (1993) [pdf] by behnamoh on Monday May 27, 2024 @05:27PM (#40494906)
Interesting! The tryclojure.org website says it's Clojure, not ClojureScript.

If it's inconsistent between variants then I'm absolutely not going to code in it...

Re:The Evolution of Lisp (1993) [pdf] by iLemming on Monday May 27, 2024 @08:49PM (#40496287)
It's not "inconsistent" between the variants. Clojure is a hosted language, it depends on the underlying platform.

In Clojurescript, the implementation details and type checks differ slightly from Clojure due to the different runtime environments (Javascript vs. JVM). As a result, certain predicates like `list?` might behave differently.

In Clojure, it's generally better to use (seq?) instead of (list?) when you need to check if a value is a sequence, as (seq?) is more encompassing and works for all sequence types, not just lists.

You almost never use (list?) in Clojure unless you explicitly need to check for a list created via (list ...), and most of the time we use (seq?) instead.

Maybe Clojure doesn't work for you because you haven't even bothered checking the documentation? At least you could've asked Google or ChatGPT, before crying how "broken it is". The language after all wasn't created last weekend, it's been around for 17 years