Fork me on GitHub

Anyone have any tips on making clojure cooperate with linux jobs? I keep getting an IO error whenever I suspend a job to the background and do anything else. Here's what I'm doing:

~ clj -e '(prn "hi")'
~ clj -e '(prn "hi")' &
[1] 1104
clojure: error: Unexpected error: Input/output error

[1]  + 1104 suspended (tty output)  clj -e '(prn "hi")'
➜  ~ jobs
[1]  - suspended (tty output)  clj -e '(prn "hi")'
➜  ~ fg
[1]  - 1104 continued  clj -e '(prn "hi")'
➜  ~ jobs
➜  ~


I'm hitting enter just after [1] 1104 gets printed. If I don't hit anything, my command successfully runs as in the first two lines.


@jstaab That's rlwrap -- use clojure instead of clj if you don't want an interactive REPL.


clojure -e '(prn "hi")' & should work just fine.


ah thanks @seancorfield that explains a lot actually

Tessy Thomas10:12:15

Do anyone know why assoc is not working inside a doall? Is there any alternative to do the association? (defn assoc-test [art-list] (doall (map-indexed (fn [index art] (assoc art :sl-no (+ index 1) (println art) (assoc-in art-list [index :sl-no] (+ index 1)) (println art)) art-list))) (assoc-test [{:id 1, :name "art1"}, {:id 2, :name "art2"}, {:id 3, :name "art3"}]) Niether assoc nor assoc-in are working.


I think the problem is you're returning the result of (println), which is nil. The following should work better:


(defn assoc-test [art-list]
   (map-indexed (fn [index art]
                  (assoc art :sl-no (inc index))) art-list))

👍 4

So you'd have been getting an sequence of nil back from the map-indexed call because (println art) was the last form, the one that gets returned.


absolute beginner questions - I'm following "Brave Clojure" book atm, I created a new app and currently printing I'm a teapot - now when trying to run lein repl I'm getting:

➜  clojure-noob lein repl                                                                       
Exception in thread "main" java.lang.AssertionError: Assert failed: transport-fn, compiling:(/tmp/form-init3783791164885581771.clj:1:73)
	at clojure.lang.Compiler.load(


@kamil.skowron there was a bug in the latest version of leiningen - I think for now you can downgrade to 2.8.1 via lein upgrade 2.8.1


@kamil.skowron Just saw some discussion about that last night, there was a problem with the latest* release of lein. Actually the next-to-latest, because they pushed a fix last night. If you upgrade lein, I think that’ll fix it.


ah, they already fixed it?


I think they did, it’s worth a try, but if not there’s always lein upgrade 2.8.1


Ah, no, I’m mistaken, the lein maintainer published a workaround, he hasn’t pushed a fix yet.


Adding `[nrepl "0.5.3"]` to `profiles.clj` will address the issue.


@manutter51 @danieleneal Thanks guys - it works after downgrading


shame on google and duck duck go - not indexed just yet


thanks once again 👍


how one would test things like org.httpkit.server starting and stopping. or even -main function ? :thinking_face:

Alex Miller (Clojure team)14:12:05

-main is just a function - you can invoke it


but how to test it?


You can call the function in a repl linked to your project

Alex Miller (Clojure team)14:12:00

how do you test any function? invoke it and verify outputs and/or change in external state


is overriding clojure core functions ok? for example we have a cache client and want to name the fetching function get for example.


it won't always work due to inlining and direct linking


for get it will only work when used in higher order contexts for example


Yes, it's fine to do that if you want to. You can exclude the core function from your namespace using (:refer-clojure :exclude [get]) in your ns declaration.


ah -- sorry I thought you meant overriding as in redefining rather than shadowing

👍 4

guys, can someone help me with JSX integration in Reagent?


i’m actually trying to understand how to compile my JSX into JS and reference it in Clojurescript


@mateus.pimentel.w Maybe try #reagent and/or #clojurescript channels? (nice avatar, BTW)

Joe Lane19:12:07

Hey friends, I’m trying to think of a function or ways to compose a function that when given a string, produces all prefixes of that string. example. “foobar” => (“f” “fo” “foo” “foob” “fooba” “foobar”).


(reductions str "" "foobar")

Joe Lane19:12:55

Anybody have any ideas? I think today is a slow day for my brain…


does what you want. happy to step through it with you if its unclear. its pretty terse but spot on

Joe Lane19:12:41

I had looked at reductions but it didn’t click this afternoon.

👍 4
Joe Lane19:12:43


👍 4

Like reduce but gives you a seq. of state at each point.

Ahmed Hassan23:12:55

Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: amount in this context, compiling:(/home/maverick/Desktop/clj applied/ch1/money.clj:100:1)

Ahmed Hassan23:12:07

Kindly test it and tell me reason for this.


it worked for me. are you sure you don't have a typo?


however, my editor is telling me that snippet is 62 lines long and i'm guessing you have an error at line 100 not 💯


can you tell me what is at line 100 in your editor?