This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-04
Channels
- # boot (41)
- # cljs-dev (1)
- # cljsrn (64)
- # clojure (63)
- # clojure-argentina (2)
- # clojure-austin (1)
- # clojure-russia (1)
- # clojure-spec (1)
- # clojure-uk (59)
- # clojurebridge (1)
- # clojurescript (45)
- # cursive (3)
- # datascript (7)
- # dirac (34)
- # emacs (15)
- # hoplon (1)
- # jobs-discuss (1)
- # jobs-rus (5)
- # klipse (180)
- # lumo (3)
- # om-next (1)
- # re-frame (7)
- # reagent (6)
- # ring (20)
- # specter (10)
- # testing (2)
- # uncomplicate (15)
- # untangled (39)
what’s the proper way of validating ISO datetime string e.g. "1999-12-31T08:00:00-08:00"? Besides regexp.
upd: ended up doing this: (not (nil? (clj-time.coerce/to-date “1999-12-31T08:00:00-08:00”)))
woot! I finally found a use for juxt on my own:
I have objects of the form {:tag :vec2 ...}
I want to add them with o+
(defmulti o+ (juxt :tag :tag))
doh, just figured out what I really need is (fn [lhs rhs] [(:tag lhs) (:tag rhs)]) -- which, unfortunately, is not (juxt :tag :tag)
if i have a vector of items [[1] [2] [3]]
that i want to add into another like so [:thing [1] [2] [3]]
how would i do that?
@ezmiller77 (into [:thing] [[1] [2] [3]])
thanks!
the first law of clojure: the answer is reduce (or into)
Hi, I don’t know if this is the right channel, but transit channel doesn’t exist, so I’ll ask here. Is there a way to have transit write handlers based on the protocol? If I have a bunch of records that all implement the same protocol, I’d like to serialize them in the same way
How can we build better "first contact" experiences for new programmers and Clojurians? Our open source learning group is hosting the free online webinar Essential Klipse TODAY at 7 pm UTC (2 pm Eastern) to address that question. Everyone is welcome! http://discuss.thevalueoflearning.org/t/webinar-discussion-2-essential-klipse/39?u=jay
I have this problem where my *.cljc
files won’t reload on the server side. In other words, I have to restart my server to see the changes. The correct directories are in my build path, so I don’t know what’s up. Anyone have any idea?
I’m using the wrap-reload middleware for ring, and the luminus template. If that helps at all
I ask because I'm trying to implement some of them in Python, along with an Atom implementation to do asynchronous stuff
But even at the basic linked list I run into comparisons of O(n) and I am at a lost with vectors and maps
comparisons are going to be O(n)
I think
unless there is pointer equality
but all of these come mostly from the book https://www.amazon.com/Purely-Functional-Structures-Chris-Okasaki/dp/0521663504
Yeah the point is that you should do pointer equality
Several operations on Clojure's persistent data structures are described as "essentially constant time". In all cases these are O(log32 n)
But two equal objects should be then allocated only once on the heap
Some explanation here: http://hypirion.com/musings/understanding-persistent-vector-pt-1
(= (map identity xs) (map identity xs))
is going to be O(n) by necessity
there's no way around checkin each element 🙂
@emccue You seem to be confusing data structure O() complexities with how clojure data is stored
Unless you have an object pool yes @pesterhazy no?
@istvan, that blog post is talking about the nth operation, not =
@richiardiandrea, true, with String interning you might actually get identical?
, not just =
Of course it adds some overhead
So trade-offs 😀
not by default though...
user=> (= (str "a" "b") (str "a" "b"))
true
user=> (identical? (str "a" "b") (str "a" "b"))
false
@emccue this is a great series on how clojure's persistent data structures are implemented: (sorry, was linked above already i see) ... but, then once those structures are composed, then the algorithmic complexity of those data structures still applies...
but,
user=> (identical? "a" "a")
true
@pesterhazy iirc Java does not intern all strings
I actually always need to check these caching things on the JVM, there is a funny interview question on Integer too on this
Yeah exactly the above thanks 😀😀 ^
haha what? Explain this please @rauh!
I guess these are boxed integers and they're only interned up to 2^7
that could generate funny bugs
That Amazon book doesn't actually seem to cover how to implement any of those in an imperative way (for the purpose of being used in a functional way)
@pesterhazy it could, but no one should be doing ==
or identical?
comparisons anyway without thinking of 'instances' instead of actual equality anyway, right?
@joshjones ==
is not about instances
unless you meant java's ==
clojure.core/==
is not about instances
okay nevermind then 🙂
i suppose i was unclear, sorry 😉 i'm not sure i've ever used ==
in clojure, actually -- thanks for introducing it to me 🙂
neither have I! 😄
but I'm allergic to using the wrong numeric type for something