Fork me on GitHub
Jim Newton08:11:44

I very often get the following genre of error

actual: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol
 at clojure.lang.RT.seqFrom (
    clojure.lang.RT.seq (
    clojure.core$seq__5387.invokeStatic (core.clj:137)
    clojure.core$empty_QMARK_.invokeStatic (core.clj:6206)
    clojure.core$empty_QMARK_.invoke (core.clj:6206)  clojure_rte.genus_spec$eval17078$_spec_to_rte__17079$strip_keys__17105.invoke (form-init10191085421504055651.clj:122) clojure_rte.genus_spec$eval17078$_spec_to_rte__17079$specify__17080$iter__17081__17085$fn__17086.invoke (form-init10191085421504055651.clj:103)
    clojure.lang.LazySeq.sval (
    clojure.lang.LazySeq.seq ( ( (
It seems it would be helpful if the error message would tell me which symbol is problematic. I think this means a destructuring somewhere has failed. If it told me the symbol, then it would be easier to pinpoint in my code. In this case I see the following in the stacktrace. clojure_rte.genus_spec$eval17078$_spec_to_rte__17079$strip_keys__17105.invoke Indeed I have a function spec-to-rte which has a local function named strip-keys defined by letfn. However, I don't see any destructuring in that local function.


That error can occur with no destructuring occurring, too.


For example:

user=> (seq 'a)
Execution error (IllegalArgumentException) at user/eval184 (REPL:1).
Don't know how to create ISeq from: clojure.lang.Symbol


user=> (filter even? 'a)
Error printing return value (IllegalArgumentException) at clojure.lang.RT/seqFrom (
Don't know how to create ISeq from: clojure.lang.Symbol


user=> (map identity 'a)
Error printing return value (IllegalArgumentException) at clojure.lang.RT/seqFrom (
Don't know how to create ISeq from: clojure.lang.Symbol


Note that the symbol in question might not occur in your source code anywhere, e.g. it could be read from input.

Adrian Smith22:11:28

In the meantime is good at showing you what happened up until the error occurred

Jim Newton10:11:58

The`letfn` says I cannot put :pre and :post conditions on local functions. Is that intentional? I often use :pre conditions while debugging.


I do not see any mention of pre or post conditions at all in that documentation. It does not say you cannot. It does not say anything about them.


But agree they are absent from that documentation, from which one might guess they cannot be supplied.


It really only takes a minute or two to experiment and see whether they work or not, in a REPL.


In my several-minute experiment, they are supported inside of functions defined within leftfn

✔️ 3
Jim Newton15:11:04

@U0CMVHBL2 good point about experimentation.


Hello, i am new to Programming overall i only know a bit JS and mediocre elisp since I am using alot of Emacs for Work. I plan to create a small to medium personal webproject - I dont know if Clojure is suited well for that but where would be a good starting point?


Clojure works well for web-development. What kind of a project are you planning?


Depends on how much you want to make from scratch and how much you want to use an existing template for... z


Luminus, Fulcro, are both options for applications You could also simply start with an http-server like clj/ring or http-kit and then build a website from a basic server with HTTP requests/responses


@U6N4HSMFW The Project itself is a Colordatabase for painters with features like create your own palette and download a pdf of it and if possible current prices in the most known shops. Maybe Clojure is overkill for such a small need?


@U3ES97LAC Since i basically would start from almost 0 prior programming (besides elisp) i would prefer some leads and templates, luminus looking promising, Got both "frameworks" saved for later when i know a little more clojure


Sounds like a nice project. In my opinion there’s no size-limit when “clojure starts to make sense”. Once you grasp the repl-driven workflow and the immediate feedback that comes with it, there’s no going back. 🙂 …or in your case if you once try another kind of approaches, they will probably feel less productive and less satisfying. I’d suggest starting with the frontend (using ClojureScript) because there you actually see the changes as you write the code. Then adding a Clojure backend component for storing the data, creating PDF’s etc. Luminus will probably help you get started fast with the whole stack (clojure backend + clojurescript frontend).


Would you recommend any books? free and non-free?


@U01EENTKD0C I have a few free books here that I am continually adding too


@U05254DQM thx for the link and work! I will take a look


There is a #practicalli channel here if you have any questions about the books


Hi, I am newbie in Clojure so my question might be very stupid. Suppose thread A wants to set an atom x to 5 and thread B wants to set it to 6. We expect the value to be 5 first and 6 after. Thread A though is blocked and retried after thread B, the value of x would then be 6 first and then 5. How is consistency assured with atom when a retry happens?


Compare and set is a common idiom to the point where most processors actually implement an equivalent instruction


The retry is not around the setting, but the entire operation


why do you expect the value to be 5 first then 6? the atom will ensure that the operations are applied atomically, but I don't see anything in your description that would imply or impose ordering


1. Read value 2. Apply function to get new value 3. Set new value if nothing has changed or go-to 1


I am thinking of a use case in which the state can only be increased, for example. If it changes to 6 and then to 5, the first “thread” might run logic thinking the state is 6.


Is it implied the functions that change the state are always commutative?


oh, ok! here's the equivalent code

(def x (atom 4))

;; on thread A
(swap! x inc) 

;; on thread B
(swap! x inc)
it's guaranteed that the value in the atom x, will be 5 and then 6, but it's not guaranteed which thread will have its operation completed first. as @U0NCTKEV8 said, atoms use CAS to ensure consistency. the wikipedia page has a decent explanation,


you can find clojure's implementation

public Object swap(IFn f) {
	for(; ;)
		Object v = deref();
		Object newv = f.invoke(v);
		if(state.compareAndSet(v, newv))
			notifyWatches(v, newv);
			return newv;

👍 3

@francesco.losciale what do you mean by threads? i never use forking in clojureland


Hello, I'm starting the book Programming Clojure by Alex Miller. I'm trying to run (require '') . I've started a repl using the lein repl command. I know little about Java and the error I'm getting hasn't been useful so far. Here's the error:

Could not locate clojure/java/io'__init.class, clojure/java/io'.clj or clojure/java/io'.cljc on classpath.
I'd also like to run the example from the code samples that can be found here: (require 'examples.introduction') gets me a similar error. How can I fix this error?e


It is not a string, but a symbol. A leading single quote in Clojure means that the following expression should not be evaluated.


Thank you so much!