This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-25
Channels
- # announcements (1)
- # beginners (70)
- # boot (2)
- # cider (12)
- # cljdoc (19)
- # clojure (25)
- # clojure-austin (1)
- # clojure-nl (2)
- # clojure-uk (9)
- # clojurescript (24)
- # cursive (7)
- # datomic (8)
- # figwheel-main (22)
- # flambo (1)
- # fulcro (16)
- # funcool (3)
- # jobs (1)
- # juxt (3)
- # off-topic (39)
- # reagent (4)
- # reitit (4)
- # ring (2)
- # shadow-cljs (90)
- # specter (11)
- # sql (2)
- # testing (2)
@ryan.russell011 What are "regular Clojure queries"? You mean embedding SQL strings directly into your Clojure source code?
A lot of people don't like doing that -- editors don't give SQL syntax highlighting when it's embedded in a string, so HugSQL's approach works better for them. I personally value seeing the actual query inline with the code rather than needing to look at multiple files (so that's my "con" for HugSQL).
@jm.moreau what do you mean?
I’m using project Euler to try to understand FP. I’m trying to solve a+b+c= 1000, where a < b < c and a^2+b^2=c^2
@jm.moreau Do you understand map?
I thought of it like a mapping in math, where everything is mapped (so a nice mapping—surely there is as word for that)
(map (fn[x](Math/pow x 2)) [1 2 3]) = [1 4 9] (map (fn[x](Math/pow x 2)) [[1,2] [3,4]] will try to take a list to the second power and it will fail so we have to get one level deeper and map the map: partial makes its first argument close over the rest of the arguments, so that we could lift it by the outer map (map (partial map (fn[x] (Math/pow x 2))) [[1,2] [3,4]])
or rather would I destructure it like this? (map (partial map (fn [[a b]] (math on a and b here) (my partition here)
trying to get a sense of it (map (partial map (fn [[a b]] (+ a b))) (partition 2 1 (range 1 32)))
doesn’t work
great everything works. thanks @veix.q5 and @neural.works.com!
List a = (1, …, n), list b similarly has n elements and so does list c. Can I make new-list of [a1, b1, c1] for all permutations?
I see there is https://clojure.github.io/math.combinatorics/
for is lazy (but if you are at the repl, the repl will print the result and force eval)
(for [x [1 2 3] y [4 5 6] z [7 8 9]] [x y z])
(mapcat (fn [x]
(mapcat (fn [y]
(map (fn [z]
[x y z])
[7 8 9]))
[4 5 6]))
[1 2 3])
https://github.com/clojure/clojurescript/wiki/Using-cljc did you look into this?