This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-18
Channels
- # admin-announcements (90)
- # alda (1)
- # aws (23)
- # beginners (60)
- # boot (217)
- # cljs-dev (20)
- # cljsjs (23)
- # cljsrn (85)
- # clojars (28)
- # clojure (101)
- # clojure-art (1)
- # clojure-berlin (10)
- # clojure-dev (16)
- # clojure-my (2)
- # clojure-russia (194)
- # clojure-sg (7)
- # clojure-ukraine (1)
- # clojured (1)
- # clojurescript (99)
- # clojurex (1)
- # community-development (6)
- # core-matrix (11)
- # cursive (26)
- # datomic (51)
- # euroclojure (30)
- # hoplon (560)
- # jobs (44)
- # ldnclj (34)
- # mount (23)
- # music (3)
- # off-topic (10)
- # om (145)
- # onyx (3)
- # perun (38)
- # portland-or (2)
- # proton (55)
- # re-frame (64)
- # reagent (26)
- # ring-swagger (3)
- # spacemacs (21)
- # sydney (3)
- # yada (1)
By the way, @kopasetik, consider run!
instead of map
since you want side effects to occur.
@kopasetik: sounds like a good idea - where will you be presenting it?
Why is it pertinent to a JS meetup? Well, it’ll be a comparison of destructuring in Clojure to destructuring in ES6 JS
Heh, I’m feeling like that’s a bit ambitious as I’m pretty green as a Clojure dev. A lightning talk is one thing, but a talk at conference?
Question- how might I get the JSON from this address using Clojure: http://www.omdbapi.com/?s=highlander
you never know who might be interested in the subject: https://github.com/clojurewest/clojurewest2016/wiki/Suggested-Topics
@kopasetik: you can use slurp
to just get it as a string
Then there is clojure.data.json which can parse it for you
@martinklepsch: Thanks! You can use slurp with URLs?
Has anyone used ring-cors
(https://github.com/r0man/ring-cors) or knows a way to set 'Access-Control-Allow-Origin' for a (simple) Clojure app
Error message: Exception in thread "main" java.io.FileNotFoundException: Could not locate data/json__init.class or data/json.clj on classpath., compiling:(clojure_noob/core.clj:1:1)
@kopasetik: left computer earlier, glad you got it working http://clojuredocs.org is great to look up things like
slurp
and what exactly they're doing
I’m having trouble mapping across the JSON data that I’m getting back from an API call
@kopasetik: printing in general is a side effectful function
@kopasetik: map
is lazy which causes nothing to be printed because the result isn't used
or are you experiencing another issue?
see the first example here: http://clojuredocs.org/clojure.core/doall
@martinklepsch: Yes, that must be it. How do I iterate across the data set to print it if I can’t use map? Or can I make my mapping work by adding a default return value to the function?
@kopasetik: see the example in the link above it explains the problem + solution
simple answer is wrap the map
call in doall
another alternative would be using doseq
but for now doall should be sufficient
clojuredocs is full of these examples, if you ever have a function not behaving as you expect chances are there's an example covering it
I don’t think that I would have been able to figure out that specific problem just by looking at Clojuredocs
Well for that case there are channels like this one
can someone explain why
(map vals ({:name "drew" :glitter-index 0 } {:name "alex" :glitter-index 1 }))
is
=> ()
I would expect
(("drew" 0) ("alex" 1))
The parentheses around the third form don’t stand for “list of maps”, they stand for “execute the fn found in the first position with the rest of the args"
You just got “lucky” in that clojure maps can be evaluated as fns
You probably want to use a vector of maps: [{:name “drew” :glitter-index 0} …]
@donaldball, gotcha. I was just thinking it was because it was expecting a function/that wasn't a list of maps
@drewverlee: You can also prevent evaluation by quoting: (map vals '({:name "drew" :glitter-index 0 } {:name "alex" :glitter-index 1 }))
@mfikes, thanks. I recall you quote things to use them as their DS rather then have them eval.
How compatible is Clojure with the R5RS standard for Scheme? Is it close enough that only minor edits and perhaps helper functions are needed?
it is not close
yea i'm signed up for http://clojureremote.com/! I'm sure this conference has gotten lots of love in this channel already, but if your on the fence there is a coupon through Clojure Gazette (lispcast). Also sense its remote their isn't the normal overhead/cost associated with conferences. I feel this makes it very 'beginner' friendly .
Question - I know that I can use slurp
to access data from http websites and apis. Is there any way that I can use it to access apis that require authentication for access?
@alexmiller: thank you
@kopasetik: Clj-http has all kinds of features, including a few different auth schemes