This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-13
Channels
- # adventofcode (84)
- # aleph (1)
- # announcements (2)
- # aws (27)
- # beginners (52)
- # braveandtrue (2)
- # calva (440)
- # cider (7)
- # clara (2)
- # cljdoc (26)
- # cljs-dev (70)
- # clojure (131)
- # clojure-berlin (4)
- # clojure-brasil (1)
- # clojure-europe (2)
- # clojure-greece (4)
- # clojure-hamburg (1)
- # clojure-italy (4)
- # clojure-losangeles (6)
- # clojure-nl (14)
- # clojure-spec (7)
- # clojure-uk (25)
- # clojurescript (26)
- # component (2)
- # cursive (13)
- # datomic (60)
- # dirac (59)
- # docker (1)
- # figwheel (1)
- # figwheel-main (2)
- # fulcro (12)
- # graphql (5)
- # juxt (33)
- # leiningen (19)
- # nrepl (1)
- # off-topic (37)
- # protorepl (2)
- # re-frame (18)
- # reagent (46)
- # remote-jobs (1)
- # ring-swagger (1)
- # shadow-cljs (88)
- # sql (10)
- # tools-deps (64)
- # vim (24)
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")'
"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
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))
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(Compiler.java:7526)
...
any idea?
@kamil.skowron there was a bug in the latest version of leiningen https://github.com/technomancy/leiningen/issues/2497 - 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?
Heh, jinx
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
:thumbsup:
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:
-main is just a function - you can invoke it
You can call the function in a repl linked to your project
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.
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.
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)
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”).
does what you want. happy to step through it with you if its unclear. its pretty terse but spot on
Like reduce
but gives you a seq. of state at each point.
This code from the book Clojure Applied is giving error. https://media.pragprog.com/titles/vmclojeco/code/cljapplied/src/ch1/money.clj
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)
Kindly test it and tell me reason for this.