This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-02
Channels
- # adventofcode (2)
- # bangalore-clj (1)
- # beginners (26)
- # boot (7)
- # cider (21)
- # clara (45)
- # cljs-dev (1)
- # cljsrn (2)
- # clojure (168)
- # clojure-berlin (1)
- # clojure-india (4)
- # clojure-italy (7)
- # clojure-nl (1)
- # clojure-russia (1)
- # clojure-spec (10)
- # clojure-uk (12)
- # clojurescript (31)
- # datascript (2)
- # datomic (28)
- # defnpodcast (9)
- # emacs (2)
- # events (4)
- # fulcro (193)
- # hoplon (127)
- # hypercrud (1)
- # jobs (1)
- # jobs-discuss (38)
- # keechma (1)
- # luminus (5)
- # off-topic (16)
- # onyx (4)
- # parinfer (9)
- # portkey (2)
- # portland-or (1)
- # precept (5)
- # re-frame (9)
- # reagent (8)
- # remote-jobs (7)
- # rum (3)
- # shadow-cljs (2)
- # spacemacs (19)
- # specter (2)
- # testing (1)
- # unrepl (34)
Hi, and happy new year! I have a very unfunctional problem: How do I destroy a var from the namespace? Instead of (doc butlast) my fingers typed (def butlast) at the repl. So user/butlast now shadows clojure.core/butlast. How do I destroy user/butlast?
What is a efficient insertion into a sorted collection? ie:
(insert-sort 5 [1 2 3 6 7 8]) => [1 2 3 4 5 6 7 8]
My naive approach is to insert at the end (with conj) and sort again but this isnt very efficient at all in a best-case-scenarioThe idiomatic clojure type for a sorted collection is probably a sorted-set
.
assuming he wants a set
(no duplicate items)
Expected:
#{{:simulator2.core.entity.event/created-at 1}
{:simulator2.core.entity.event/created-at 4}}
Actual:
#{{:simulator2.core.entity.event/created-at 1}
{:simulator2.core.entity.event/created-at 4}}
that’s super weird
is it because one of those is a set, and one a sorted-set?
no that wouldn’t be it
=> (= (hash-set 1 2 3) (sorted-set 1 2 3))
true
(= (hash-set {:id 1} {:id 2} {:id 3})
(sorted-set {:id 1} {:id 2} {:id 3}))
=> clojure.lang.PersistentArrayMap cannot be cast to java.lang.Comparable
very badly written example for map - (sorted-set-by (fn [m1 m2] (> (val (first m1)) (val (first m2)))) {:id 1} {:id 2} {:id 3})