fix: case composite constants, associative?/reversible?, update non-fn args, nth nil

- case: quote list literals (read as arrays) in constant position so a wrapped
  list ((a b c)) matches by value instead of being evaluated as a call; symbol
  constants already quoted. Vector/map/set constants already worked. case errors
  in the suite drop to 0 (60 pass).
- associative?: true only for vectors (pvec) and maps (phm/struct/sorted-map),
  not lists/tuples-from-seq-fns/lazy-seqs/sets.
- reversible?: true for vectors and sorted-map/sorted-set only.
- update: coerce f via as-fn so (update m k :kw)/(update m k a-set) work; extra
  args already handled.
- nth: (nth nil i)/(nth nil i default) returns nil/default instead of throwing.

clojure-test-suite pass 3649->3678, errors 122->105, clean files 44->46.
associative?/reversible? files now fully clean. spec: predicates + control/case.
jpm test green.
This commit is contained in:
Yogthos 2026-06-05 10:19:43 -04:00
parent 2ccfa675f7
commit bcdace7543
4 changed files with 28 additions and 7 deletions

View file

@ -15,7 +15,12 @@
["condp" "\"two\"" "(condp = 2 1 \"one\" 2 \"two\" \"other\")"]
["case" ":b" "(case 2 1 :a 2 :b :default)"]
["case default" ":d" "(case 9 1 :a 2 :b :d)"]
["case multi" ":ab" "(case 2 (1 2) :ab 3 :c)"])
["case multi" ":ab" "(case 2 (1 2) :ab 3 :c)"]
["case symbol const" ":s" "(case 'foo foo :s :default)"]
["case vector const" ":v" "(case [1 2] [1 2] :v :default)"]
["case map const" ":m" "(case {:a 1} {:a 1} :m :default)"]
["case list const" ":l" "(case '(a b) (quote (a b)) :l :default)"]
["case keyword" ":k" "(case :x :x :k :default)"])
(defspec "control / logic"
["and all true" "3" "(and 1 2 3)"]