This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-03
Channels
- # admin-announcements (8)
- # beginners (99)
- # boot (60)
- # cider (44)
- # cljs-dev (47)
- # cljsrn (68)
- # clojure (223)
- # clojure-art (1)
- # clojure-russia (190)
- # clojure-sg (9)
- # clojure-uk (2)
- # clojurecup (1)
- # clojurescript (59)
- # clojurex (3)
- # core-async (43)
- # core-typed (2)
- # cursive (18)
- # datavis (7)
- # datomic (16)
- # events (2)
- # funcool (3)
- # hoplon (3)
- # jobs (1)
- # lein-figwheel (10)
- # leiningen (6)
- # off-topic (1)
- # om (123)
- # onyx (57)
- # parinfer (16)
- # portland-or (2)
- # random (1)
- # re-frame (4)
- # reagent (7)
- # remote-jobs (1)
- # spacemacs (12)
hmmm. when I tried running just the loop in the repl (with lst def'd to '(1 2 3 4) in the initial state) it does not resolve. just hangs forever. so I must have something silly somewhere in there...
your recur
should take 2 parameters: final
and lst
, now it's something odd you probably meant (recur (conj final even) rest)
oh, yes. how silly. let me see if it works when I fix that
yes! That was it. Now the only issue is that into
is making a list that's backwards. but I can figure that out.
thanks @andrut
Anyone still around?
Im trying to find out where this error message is coming from : CompilerException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long,
of this code : https://www.refheap.com/112295
contains?
is a misleading thing for what i want to ask about
Nah, I'm not doing exercises, I'm working on an app
since I am trying to look up something in a vector of maps
contains?
actually accepts the index -_-
otherwise, for maps, yes, it searches for the key. -.-;
I know now. but the fact you named is searches a index except for maps bites a lot of people
eh, it's for work, so I can't really talk specifics, but I can make analogies
anyway for the meantime I am just trying to check a vector of data like this: [{:id 1 :data stuff} {:id 2 :data more-stuff} {:id 3 :data even-more-stuff}]
I am thinking of using some
but I am not sure how I should write the predicate if I want to check if the map containing :id value
exist
@trancehime: try this one:
(some #(= (:id %) 1) [{:id 1 :data "stuff"} {:id 2 :data "more-stuff"} {:id 3 :data "even-more-stuff"}])
and if in your snippet it had #(= (:id %) 4)
then that would return... nil
correct?
"/ " wishes clojure says where the actual error is and not in the calling function. This way I makes a lot difficult to find the culprit
What is the best way to find out where this error : CompilerException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long,
That nearly always means that you have an integer and you're trying to invoke a sequence function on it.
found it args is a integer and apply thought it needed to be a function,. So I deleted the apply and everything works well
I keep getting some thing with Reactive deref not supported in seq
even though I am wrapping with doall
@trancehime: I think someone can help you if we can see the code
it's fine, I'm going to try a different approach
hmm, that didn't work...
The problem is I'm using 2 reagent atoms to compare -_-
@trancehime: have you already look at this stackoverflow question : https://github.com/reagent-project/reagent/issues/18
thats where i checked if my doall
was supposed to behave properly or not
but it doesn't
(if (doall (some #(= (:schedule_id %) (schedule "id")) @user-schedules)) "X" "Y")
I'm trying to do this
i'm baffled because I can display content of everything just fine
I just want to hide some aspect of the page dependent on whether a certain (schedule "id")
is present in @user-schedules
OK, I figured out the problem.
Turns out the information from the atoms was never actually being passed into the function.
I've actually instantiated the information now and contains?
on the info behaves as intended, now to implement the checking properly
Alright so now my next problem
How do I grab an element in the form of a map {:key1 val1 :key2 val2}
when I know val1
assuming that element is in a vector []
trancehime: „grab“ an element?
OK, for example
I have this vector: [{:key1 val1 :key2 val2} {:key1 val3 :key2 val4}]
How do I get {:key1 val1 :key2 val2}
knowing :key1 val1
(some (fn [x] (some #{val1} (vals x))) [{:key1 val1 :key2 val2} {:key1 val3 :key2 val4}]
repeated some
calls?
Interesting
One of these days I should look more in-depth into some
and contains?
because really the latter's behavior confuses me as a beginner
@trancehime (filter #(= (get % :key1) val1) myVec)
>Returns a lazy sequence of the items in coll for which (pred item) returns true. welp
now i feel dumb
I’ve been doing clojure for a while now and I still manage to feel dumb at least once a day
I started learning it recently, my supervisor at work said "you should use clojure to do this assignment since it will get the job done fast"
'lo and behold, I did actually get a metric ton of stuff done with Clojure
for which (pred item) returns false ?
handy
@trancehime: good that your problems are solved
pvinis: in normal code it would just be part of the name. But, if a symbol like that appears inside a syntax quote then it is an “automatic gensym”, meaning the symbols will be replaced with gensyms like columns__G1023
or something.
If I have two seperate things in a function. How can I take care that both are executed
ok so im trying go model a card game, and wanna generate the deck. i have this (map (fn [n] (suit-card :hearts n)) (range 1 14))
i tried to do this (map (fn [s] (map (fn [n] (suit-card s n)) (range 1 14))))
but i get a fn back
@noonian: so I can make to make 2 seperate functions . one for updating the atom and another one for the transactions