This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-04
Channels
- # admin-announcements (36)
- # beginners (54)
- # boot (74)
- # cider (14)
- # cljs-dev (91)
- # clojure (197)
- # clojure-austin (1)
- # clojure-conj (3)
- # clojure-india (5)
- # clojure-japan (3)
- # clojurescript (111)
- # core-logic (12)
- # cursive (6)
- # datascript (3)
- # datomic (16)
- # devcards (26)
- # events (1)
- # funcool (11)
- # hoplon (63)
- # jobs (2)
- # ldnclj (10)
- # lein-figwheel (6)
- # luminus (5)
- # nginx (7)
- # nyc (3)
- # off-topic (1)
- # om (148)
- # onyx (122)
- # portland-or (5)
- # re-frame (3)
- # reagent (25)
- # yada (15)
I’m having some problems with working out why I have a lazy seq
(defn map-rewrites [rewrite-rules] (doall (map (fn [[k v]] (doall (str ".addRewriteRule(\"" k "\", \"" v "\")"))) (doall (seq rewrite-rules)))))
(defn map-matches [match-rules] (doall (map (fn [[k v]] (doall (str ".addMatchRule(\"" k "\", \"" v "\")"))) (doall (seq match-rules)))))
(defn map-remapping [{:keys [match rewrite]}] (doall (str "remapping(remappingBuilder.reset()\n" (doall (map-matches match)) (doall (map-rewrites rewrite)) ");")))
(doall (map println (map map-remapping remappings)))
Where remappings looks like:
[{:match {:api_key "doubleclick", :google_error nil}, :rewrite {:partner_user_id nil, :id_space "d”}}]
I dont think there is anywhere left for me to put doall but still its a lazy-seq:
remapping(remappingBuilder.reset()
[email protected]@4da99836);
@dexter: I don't think doall actually converts things from a lazy-seq
user=> (type (doall (lazy-seq [1 2 3])))
clojure.lang.LazySeq
However, it should be printing out all of the relevant lines
I'd get rid of all doalls but the last one (map println)
if I switch map to mapcat it gets fractionally further, materialising all the strings as a huge list of single chars
Can you post the code with the doalls removed?
Also, instead of mapcat, try
(flatten (map f col))
(defn map-rewrites [rewrite-rules] (map (fn [[k v]] (str ".addRewriteRule(\"" k "\", \"" v "\")")) (seq rewrite-rules)))
(defn map-matches [match-rules] (map (fn [[k v]] (str ".addMatchRule(\"" k "\", \"" v "\")")) (seq match-rules)))
(defn map-remapping [{:keys [match rewrite]}] (str "remapping(remappingBuilder.reset()\n" (map-matches match) (map-rewrites rewrite) ");"))
(map println (map map-remapping remappings))
Do you have example remappings?
[{:match {:api_key "doubleclick", :google_error nil}, :rewrite {:partner_user_id nil, :id_space "d"}}]
Oh, right, missed those. Thanks
so I think doing (apply str (map-matches match))
instead of just (map-matches match) solves it
Nice, glad to hear it
Hmm, @roberto If true, someone should update the docs
Ah, got it
Oh, nevermind, I don't get it
If you look at the documentation, it suggests that println
is the most common use of doall
All of the examples are (doall (map println col))
Does anyone know more about OAuth in Clojure? I am generally an oauth failure as I still can't handle it. Even Clojure doesn't make it better. After trying around with clj-oauth and oauth-clj I am feeling even more stupid... How do I get this http://apidev.bricklink.com/redmine/projects/bricklink-api/wiki/Authorization to work with Clojure? I probably need the explanation in a format fitting for a ten-year-old 😥
Oh. It's OAuth v1.0 and I don't have any signing URIs ...
if you are using Google, this is a very convenient library https://github.com/Mayvenn/friend-google-openid
I'll look into it, thanks
I’d like to use immuconf which defines some reader tags here
when I experiment from the repl, I’m getting a java.lang.RuntimeException: No reader function for tag immuconf/override
Hm.. It seems that doesn't solve my problem. It's 'just' about the Auth header. What I am doing is programming against bricklink's API. I don't think I have a provider there
do I have to move that data_readers.clj file out of immuconf and put it inside my project’s src dir?
figured out I can do this so that it works in the repl
I wonder why the repl doesn’t seem to recognize the data-readers.clj that’s inside the immuconf jar? Oh well, moving on!