clojurescript

Lambda-on-the-floor 2026-04-17T15:39:53.695749Z

Ppl here seem to be more active than at Zulip. I'll just post the link with what I asked there, if you don't mind: https://clojurians.zulipchat.com/#narrow/channel/151762-clojurescript/topic/cljs.2Espec.2Ealpha.2Fexercise.20doesn.27t.20work/with/586152497 Sorry in advance if that's not ok by some rules.

✅ 1
seancorfield 2026-04-17T15:43:55.034289Z

You need to explicitly add the test.generators dependency I think?

seancorfield 2026-04-17T15:45:23.239829Z

(I assume that exists for cljs as well -- but I don't do ClojureScript)

seancorfield 2026-04-17T15:49:34.774479Z

test.check, my bad:

(!2025)-> clj
Clojure 1.12.5-alpha1
user=> (require '[clojure.spec.alpha :as s])
nil
user=> (s/exercise int?)
Execution error (FileNotFoundException) at user/eval3 (REPL:1).
Could not locate clojure/test/check/generators__init.class, clojure/test/check/generators.clj or clojure/test/check/generators.cljc on classpath.
user=>

(2026-04-17.11:49:08)-(~/clojure)
(!2026)-> clj -Sdeps '{:deps {org.clojure/test.check {:mvn/version "RELEASE"}}}'
Clojure 1.12.5-alpha1
user=> (require '[clojure.spec.alpha :as s])
nil
user=> (s/exercise int?)
([-1 -1] [0 0] [-1 -1] [3 3] [0 0] [2 2] [-5 -5] [-1 -1] [17 17] [-3 -3])
user=>

seancorfield 2026-04-17T15:54:14.591679Z

Yup, it's the same with ClojureScript -- except you also have to explicitly require test.check it seems:

(!2028)-> clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.12.134"}}}' -M -m cljs.main -r
ClojureScript 1.12.134
cljs.user=> (require '[clojure.spec.alpha :as s])
nil
cljs.user=> (s/exercise int?)
Execution error (Error) at (<cljs repl>:1).
Var clojure.test.check.generators/simple-type-printable does not exist, clojure.test.check.generators never required

cljs.user=>

(2026-04-17.11:51:58)-(~/clojure)
(!2029)-> clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.12.134"} org.clojure/test.check {:mvn/version "RELEASE"}}}'
 -M -m cljs.main -r
ClojureScript 1.12.134
cljs.user=> (require '[clojure.spec.alpha :as s])
nil
cljs.user=> (s/exercise int?)
Execution error (Error) at (<cljs repl>:1).
Var clojure.test.check.generators/simple-type-printable does not exist, clojure.test.check.generators never required

cljs.user=> (require '[clojure.spec.alpha :as s] '[clojure.test.check])
WARNING: Use of undeclared Var goog.math.Long/fromBits at line 64 /home/sean/.cljs/.aot_cache/1.12.134/4796499/clojure/test/check/random/longs.cljs
WARNING: Use of undeclared Var goog.math.Long/fromString at line 77 /home/sean/.cljs/.aot_cache/1.12.134/4796499/clojure/test/check/random/longs.cljs
WARNING: Use of undeclared Var goog.math.Long/fromNumber at line 81 /home/sean/.cljs/.aot_cache/1.12.134/4796499/clojure/test/check/random/longs.cljs
WARNING: Use of undeclared Var goog.math.Long/fromNumber at line 87 /home/sean/.cljs/.aot_cache/1.12.134/4796499/clojure/test/check/random/longs.cljs
WARNING: Use of undeclared Var goog.math.Long/getOne at line 92 /home/sean/.cljs/.aot_cache/1.12.134/4796499/clojure/test/check/random/longs.cljs
nil
cljs.user=> (s/exercise int?)
([0 0] [-1 -1] [0 0] [0 0] [-1 -1] [7 7] [-1 -1] [0 0] [0 0] [23 23])
cljs.user=>

🙏 1
Lambda-on-the-floor 2026-04-17T17:25:33.668709Z

Thanks for taking your time, Sean! Sorry for bothering w\ newbie questions.

(require '[clojure.spec.alpha :as s] '[clojure.test.check])
I only changed that line to cljs.spec.alpha instead of clojure.spec.alpha and it seems to work at my CLJS REPL nontheless. For shadow-cljs workflow it worked at REPL with declaring org.clojure/test.check dependency at shadow-cljs.edn config file (if anyone else will stumble upon the same situation and gonna read it in the future) What puzzled me is the ability of interplay between clj code and cljs code at clojure. and cljs. namespaces respectively. At non-final stages of compilation to target JS code it seems to be possible for some libraries to have this interplay - the ones that don't use primitive platform-specific calls and leave their implementation to platform-specific clojure.core or cljs.core or whatever else. And such interplay is definetely possible for interactive use that can leverage both JVM and JS active real-time runtimes, as with exercise here. My mistake was to consider immediately that something is wrong if calls under cljs namespace lib required clojure namespaces dependency.

seancorfield 2026-04-17T17:57:18.165389Z

I use clojure.* for requires because it works unchanged on both Clojure and ClojureScript.

seancorfield 2026-04-17T17:58:04.435019Z

Under the hood, what matters is whether the source (of a library) is .cljc or whether it has separate .clj and .cljs implementations.

seancorfield 2026-04-17T17:59:55.587639Z

https://github.com/clojure/test.check/tree/master/src/main/clojure/clojure/test -- org.clojure/test.check is all .cljc except for some implementation details in test/check/random/ so it's designed for Clojure and ClojureScript.

seancorfield 2026-04-17T18:01:00.798869Z

For all(?) of the core nses, ClojureScript treats clojure.* as cljs.* so you don't need any conditional code for :require clauses (at least, not for core nses!). That makes writing portable (multi-dialect) code easier.

👀 1
seancorfield 2026-04-17T18:03:17.220829Z

FWIW clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.12.134"} org.clojure/test.check {:mvn/version "RELEASE"}}}' -M -m cljs.main -r runs a ClojureScript REPL, not a Clojure one. I just wanted to show the behavior in ClojureScript without dealing with Shadow-cljs.

👍 1
2026-04-17T20:16:29.608769Z

Is ClojureScript the only dialect with queue literals? And if so why?

#queue literal - tagged literal

A queue is defined by placing #queue before a vector.

    #queue [...]

2026-04-17T20:20:20.552049Z

i don't know if it's the only dialect with it, but here's a thread about #queue from last year: https://clojurians.slack.com/archives/C06E3HYPR/p1747939445770039

1
2026-04-17T22:57:49.697939Z

A splendid candidate for http://ask.clojure.org

2026-04-18T00:13:03.860829Z

as seen in that thread, there's multiple asks for features related to PersistentQueues