This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-03
Channels
- # adventofcode (1)
- # beginners (76)
- # boot (88)
- # cider (63)
- # clojure (357)
- # clojure-austin (2)
- # clojure-berlin (8)
- # clojure-brasil (8)
- # clojure-nl (1)
- # clojure-russia (22)
- # clojure-spec (17)
- # clojure-uk (47)
- # clojurescript (67)
- # cursive (45)
- # datascript (3)
- # datomic (45)
- # dirac (7)
- # emacs (3)
- # funcool (2)
- # hoplon (26)
- # jobs (2)
- # jobs-discuss (11)
- # luminus (6)
- # off-topic (243)
- # om (40)
- # om-next (7)
- # onyx (23)
- # overtone (1)
- # portland-or (2)
- # protorepl (11)
- # re-frame (55)
- # reagent (58)
- # rum (12)
- # sql (4)
- # test-check (12)
- # untangled (25)
You can't ->
into an anonymous function like that. But you could use as->
instead.
(-> {:base-url “”}
(as-> hash-map (assoc hash-map :abs-url (str (:base-url hash-map) “test2”))))
figured out how to make a recursive function that emits a result, it's like a whole new world
most of the examples are like "print the fibonacci sequence". Thanks, I'll just use google.
@notanon interestingly, I just saw this in #clojure - import-vars is exactly what I mean.
@pwalsh if your project is the size of an entire programming language + batteries included standard library, i'd agree, splitting up your ns might be acceptable 😛 😛
honestly though... looking at how clojure.core does it... it's not as if it's very complicated/hacky. up to you 🙂
http://stackoverflow.com/questions/4690758/splitting-a-clojure-namespace-over-multiple-files
you're looking at the unbelievable power of lisp's never ending eval < - > apply loop.
it's up to you how you organize your code. how you feed strings into eval is up to you.
slightly off topic, but i remember watching a presentation from a guy that writes clojure for oil-mining machinery. he just (load ...)'s code from a http url to update the programs in place. just so awesome. and nasa debugging some c++ code on an orbiting satellite via a freakin lisp space repl lol.
I got this ({"admin" {:username "admin", :password "pass", :roles #{:slckfu.handler/admin}}} {"admin2" {:username "admin2", :password "pass", :roles #{:slckfu.handler/admin}}} {"admin" {:username "admin", :password "$2a$10$byP7iTHiHGfrQSf0A/j9ruzFwsEfImweCSaZU45/Zudc2wbauhY/i", :roles #{:slckfu.handler/admin}}})
what I need to get: {"admin" {:username "admin" :password (creds/hash-bcrypt "pass") :roles #{::admin}} "dave" {:username "dave" :password (creds/hash-bcrypt "pass") :roles #{::user}}}
@sb why not (wcar* (apply car/mget test))
and then transform the datastructure from there
Yes, that is really cool: (wcar* (apply car/mget test))
but unfortunately friend use the datastructure what I shared with you. You query result: [{:username "admin", :password "pass", :roles #{:slckfu.handler/admin}} {:username "admin2", :password "pass", :roles #{:slckfu.handler/admin}} {:username "admin", :password "$2a$10$byP7iTHiHGfrQSf0A/j9ruzFwsEfImweCSaZU45/Zudc2wbauhY/i", :roles #{:slckfu.handler/admin}}]
if I add to the dependencies No value supplied for key: [com.taoensso/carmine “2.15.0”]
I got this error messages. I tried add value for keys with :env {:redis-host "127.0.0.1" :redis-port 6381}
If I comment this lines ` (def testuser (-> (wcar* (car/keys "admin")))) ;(def users (into {} (for [x testuser] {((wcar* (car/get x)) :username) (wcar* (car/get x))})))` of course everything works fine.. at uberjar flow.. so that is something connection problem.
How do I telll that name
is a string with spec . I tried this : (s/def ::frontpage-name(string?))
@roelof why is string?
being called with no arguments there?
I don't know spec, but that looks super weird
the lack of space before the ( makes it look like you are trying to write java
but you are giving two arguments to def
one is a namespaced keyword, the other is (string?)
which is the function string?
called with no args
which is an error
what I am saying is that condition is an invalid arity error
(string?) is an error
why are you putting parens around it?
that's what causes the error
@noisesmith thanks, that seems to solve it
@roelof do you understand why I could see it was an error even though I don't know spec? in clojure we don't use parens for grouping (except for a few very rare cases that you can count on one hand) - they are for calling functions
if I were to redo the clojure syntax (or make my own clojure-like) one of the only changes I would make is not using parens on the left side of case clauses (just to reduce that ambiguity - to never have parens as grouping constructs)
hello all, I´m trying to understand specter, so how to select the keys with false values?
(select [ALL <???>] #{{:RES false} {:TAM true} {:ITA true}})
fabrao: did you try false?
?
oh, you need the nested structure, so it would be more like (comp false? val)
wouldn't it...
I did like this
(->> #{{:RES false} {:TAM true} {:ITA true}}
(filter #(= true (second (first %))))
(map #(key (first %))))
It seems to be more easy in specter, but I don´t know how to migrate from this to that
fabrao: maybe (comp false? val first)
- that would get the first (only) entry in the map, check if the value is false in the entry