This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-05-13
Channels
- # admin-announcements (17)
- # aleph (1)
- # arachne (2)
- # boot (152)
- # braveandtrue (8)
- # cljs-dev (12)
- # cljsjs (3)
- # cljsrn (1)
- # clojure (105)
- # clojure-austin (1)
- # clojure-belgium (5)
- # clojure-berlin (1)
- # clojure-brasil (5)
- # clojure-canada (2)
- # clojure-dev (6)
- # clojure-gamedev (1)
- # clojure-greece (9)
- # clojure-russia (39)
- # clojure-uk (9)
- # clojurescript (106)
- # component (4)
- # cursive (1)
- # data-science (3)
- # datascript (1)
- # datomic (9)
- # emacs (6)
- # hoplon (92)
- # jobs (1)
- # ldnproclodo (2)
- # lein-figwheel (1)
- # off-topic (19)
- # om (47)
- # om-next (1)
- # onyx (10)
- # other-languages (1)
- # proton (1)
- # re-frame (5)
- # reagent (36)
- # rethinkdb (1)
- # ring (2)
- # rum (1)
- # yada (14)
anyone else having troubles retrieving deps from clojars? im unable to start up a repl until i comment out cider-nrepl snapshot version, and changing the version makes lein repl
hang at “Retrieving cider/cider-nrepl/0.12.0/cider-nrepl-0.12.0.pom from clojars” ...
@juhoteperi: For when you wake up… java.jdbc 0.6.1 should be out and fixes the PostgreSQL
insert!
transaction issue. Also all the tests are fixed for PostgreSQL now and I’ll continue testing against it in future (via Docker). Thank you for catching those issues! /cc @hiredman
Random noob question here, and I appreciate what Im doing is a bit odd, but trying to get a better understanding of collections and conj, and I cant for the life of me understand this one.
(conj #{10 1} :sss 6676) => #{1 :sss 6676 10} (conj #{10 2} :sss 6676) => #{:sss 2 6676 10}
@bikeshedr: ah, so in terms of the behavior of conj, thats mean unlike vector's or lists, i can never be sure where my value ends up
@bikeshedr: Its just interesting that :sss is consistently first if, in #{10 x} , x is 2 or 3, and consistently second if x is 0 or 1
stunami: if order is important, and you have values of different types, you can use sorted-set-by
@bikeshedr: Yeah, I'm actually trying to work on problem https://www.4clojure.com/problem/65 and so far, I'm generally able to identify what the collection is by a conj, (map being the exception I catch), but Im a bit stuck on this set behaviour.
the print order is ultimately based on how the objects hash
@alexmiller: would you be able to expand on that, why would these hash differently?
hello, how to create a function to accept seq or value
eg: (defn a [x] (...) [xs] (...))
@mbrum, noob, but sounds like you'd want to just create your function for a value, and then map a sequence to it.
saying that, a function will "accept a seq or val" regardless, its what you're doing with it that may/may not work.
@stunami: try (map hash (range 12)) to get an idea
@danipov that's understandable. All I can say is wait and see, maybe start with monthly and switch to yearly when you feel I have earned your trust
I do plan to post quite regularly, I just don't want to stick a number on it yet. People have burned out before on this kind of stuff, I want to find a rhythm that I can sustain over the long term
@stunami: function overload like this
(defn a [x] .......
[x & rest :as all] ...
it is a correct dialect for function overload with single argument ou seq ????
@mbrun close, you want each arity+body wrapped in parens (defn a ([x] ,,,,) ([x & more] ,,,,))
. Also I don’t think the :as all
syntax works for argument destructuring in a function definition
@mbrum: I actually recommend you to buy "Clojure for the Brave and True", really good read! In the meantime: http://www.braveclojure.com/do-things/
(fn [coll]
(let [empty-coll (empty coll)]
(cond
(= empty-coll {}) :map
(and (= (empty coll) ()) (= (last (conj coll 0 10)) 10)) :vector
(and (= (empty coll) ()) (= (first (conj coll 0 10)) 10)) :list
(= empty-coll #{}) :set)
))
;;I'm sure there are better solutions@mpenet: It actually seems to work in my repl
you're right! dunno why i had that impression, maybe it once was like I mentioned, not sure
I’m pretty sure I’ve seen that before in an earlier version of clojure, I’d guess someone just added a special case for “prefer single arity version when 1 arg present"
@alexmiller: Can you expand on that - the print order is ultimately based on how the object hash
the printer works by walking through the internal data structure, which is a tree organized according to hash (because it's a hash array mapped trie)
you should never rely on that order being anything in particular because hash functions in both Java and Clojure can and have changed over versions
sorted-set is one option if you need that and external data structures like https://github.com/amalloy/ordered can give you sets that maintain insertion order if desired
@alexmiller: I didn't get the link with @stunami question. I might have missed something I guess
well maybe I misunderstood the question :)
I took it as asking - why does hashing imply a different print (/ sequence) order than insertion order
if you interpreted it differently, happy to answer something else if you can elaborate
@alexmiller: I see. thanks,
@alexmiller: By the way, how does my solution look like?
@lewix why don't you just use list?
vector?
map?
etc?
@alejandro: as per @stunami link we cannot use list? vector? or map? etc https://www.4clojure.com/problem/65.
@alexmiller: after looking at other solutions I prefer mine https://gist.github.com/6ewis/1b4cdedbcc648c3da1d6ab2bb2e0c022 😛
Anyone use lein deploy? Anyone know how to deploy an uberjar with it? It's just compiling my java classes in the project and raw .clj files. lein uberjar builds the jar properly
(def spy #(do (clojure.pprint/pprint %) %))
base698: it isn't for deploying uberjars, it is for deploying jars that can be depended on via maven, which come with their dependency information so maven can fetch other deps
deploy in this case is using the same verb as maven for an action that is more like "publish this library" than "deploy this app"
@hiredman The app I have serves two functions, one as a library for another java app and two as a separate app that can be run with java -jar. I guess just make a separate process for that? I had one but when I got lein deploy to work I thought it could do both
I should say, technically, there is nothing stopping you from deploying an uberjar to a mven repo, or actually any file containing anything, but I would not recommend it
although, I think there are some deployment pipelines, maybe something netflix open sourced, that do that
someone please help me. I’m trying to parse transit message on the server side, it says the type of (:body req)
is org.httpkit.BytesInputStream
I need to parse it and can’t find a way
btw, is there anywehre some todo list for future versions of Clojure? And Rich being chief inventor, I somehow never hear any plans of his that he maybe has in mind for the language?
http://dev.clojure.org/display/design/Release.zFuture is where we noodle on future stuff
plenty of other pages in that wiki describing various things but those are things we've talked about recently, some of which will be in the next release
@alexmiller: BTW, not that I consider it important at all, but has Rich mentioned to oyu guys that are close to him about having any plans about making CinC in any forseeable future?
a) it's a lot more work, even beyond all that great stuff people have built like tools.analyzer, tools.reader, etc b) likely to be slower than Clojure in Java c) of questionable importance
ClojureScript is probably a cleaner implementation and self-hosting if someone wants to port to something, but both impls unabashedly embrace their host
the core team is not seeking more platforms :)
Rich has has interesting ideas about alternate implementations for the Compiler, but not for the purposes of CinC
I wonder if Clojure instants will ever be java.time.Instant
s rather than java.util.Date
s.
they can be now if you do the work to make them so
the data readers are an open system
or they can be JodaTime instances
or ZaneDates :)
well, not till java 8 is the min jdk :)
@hiredman also, the jar lein deploy made didn't have compiled clojure, just the .clj files themselves is that normal?
if an api requires a sessions key, what would be the best way to hold onto it (and potentially update it) in clojure?
is this where I should use atom
?
@thug.nasty you mean on the server side? Definitely not in an atom (process scoped global state!)
val_waeselynck: yes, server side
Use a session store, Ring-session has several implementations for those
including e.g Redis
ah ok
i’ll look into that. thanks 🙂