This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-05
Channels
- # beginners (3)
- # boot (205)
- # cider (41)
- # clojars (1)
- # clojure (76)
- # clojure-colombia (1)
- # clojure-dusseldorf (3)
- # clojure-russia (314)
- # clojure-sg (1)
- # clojurebridge (1)
- # clojurescript (115)
- # css (2)
- # cursive (5)
- # editors (2)
- # funcool (2)
- # hoplon (18)
- # jobs (62)
- # jobs-discuss (28)
- # ldnclj (1)
- # leiningen (10)
- # mount (9)
- # off-topic (4)
- # om (93)
- # parinfer (10)
- # proton (1)
- # re-frame (19)
- # ring-swagger (18)
newbie question, when i do (sort {:b 2 :a 1})
it returned ([:a 1] [:b 2])
in REPL, what is the data structure? why it didnt return {:a 1 :b 2}
, if sort
doesnt work in this way, why it sort the map but return a diff data structure?
@lumengxi: i am not sure but a map and a list are different things, map is not guaranteed to be in order
i guess you can not sort a map, that is IMHO sort converts the map to a list and gives you an ordered representation
@dbacar: thanks! it does look like that sort converts the map to a list
, interesting
@lumengxi: check out clojure.core/sorted-map
@bostonaholic: thanks! yea i found that func, was just curious why (sort {:a 1 :b 2})
would return something like that
@lumengxi: maps are seqs on their kv pairs, sort converts the input to a seq and then sorts.
@arrdem: sorry, another newbie q: if map is already a seq
, what do you mean by sort
converts it into a seq
again?
@lumengxi: sorry I was being imprecise. map is not a seq
, but it can be converted to one. In this instance it is.
a seq is sort of similar to an iterator. so in order to sort the map '{:a 1 đ 2}' you need to traverse the elements
can you actually use đ in Clojure to mean :b
? đ
hello all. i'm interested in hugsql. http://www.hugsql.org . Is there any example how to do JOIN using hugsql?
@yogthos: Hello, Dmitry! I've read your article about hugsql? Can you tell where i can find example how to make JOIN using HugSQL?
@curtis.summers would probably have the answer for this one
@yogthos: thanx! (brief search by word JOIN did not return any useful results from docs) well, now i have a search direction
@mike1452 A JOIN in HugSQL is just a JOIN in SQL. I guess I'm not exactly clear on the question, but I'm happy to help work through it.
How would I approach debugging c.t.namespace.repl/refresh
? refresh
wants to reload a CLJS namespace (in my CLJ code) even though the ns is never references, not on classpath. I also tried to set ctnr/set-refresh-dirs
manually but the cljs macro file still gets picked up (and then "not found exception").
EDIT: Got it, inspected the #'refresh-tracker
var and found out that it got picked up in resources
(where cljs also compiles to). So I filtered resources|target
directories from the classpath and did set-refresh-dirs
and it works .
@stuartsierra: hey, in http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded youâve mentioned that âring-devel is incompatible with tools.namespaceâ. As I understand - it currently is, and if I add wrap-reload to my ring stack - it would still work fine until: 1. dev.clj file (where the system is located) is changed. I guess the system will still work, as it would reference the objects, but I wonât be able to stop the currently running system. 2. components structure is changed and so the old components could miss some data? Am I right? And are those the only problems? Thanks in advance!
How can one take a string like "file.extension" and return ".extension"?
I.E.: How does one get the extension of a filename in clojure
See the extension
function from this lib: https://github.com/Raynes/fs
bleh -- unfortunately I'm working in clojurescript
So can't use that
Perhaps I should ask in #C03S1L9DN
May need to write a regex for it.
Even works for names like "double.dot.jpg"
Is there any good way of working around having a protocol that does a conversion split across multiple namespaces when extended? I saw something like this argued in the past here: http://programming-puzzler.blogspot.com/2013/12/frustrations-with-namespaces-in-clojure.html While I disagree with a lot of what is written here and certainly don't support circular dependencies, in the case of protocols it makes sense to have a "merged" version. For example if I define in a "core" namespace conversions to/from various collection types, then in a more specific namespace I extend the same protocol to add in more specific conversions. As far as I know/have seen when the protocol is called and hits the "core" extend-protocol, it won't see the specific definitions. Thus it's not really possible to nest your conversions like that unless you put it all in 1 namespace.
@george.w.singer (let [[_ x] (re-find #"(\.[^\.]+)$" "file.extension")] x)
Is there a way to do a conditional assoc
, which only associates the key
, if the given value
is truthy?
not in core, but you can take a look here: https://github.com/weavejester/medley/blob/master/src/medley/core.cljc#L25
@swizzard: http://stackoverflow.com/a/7686324/3662110 or maybe approach it with :has
anyone using environ know if there is a way to âreloadâ configuration in a running repl session?
ive tried setting system properties (System/setProperty ⌠âŚ)
but it doesnt seem pick it up
i had some luck with ns-unmap
and redefining the env
var, but that seems like a roundabout way
hey @jstokes environ tests remove and reloads the ns: https://github.com/weavejester/environ/blob/master/environ/test/environ/core_test.clj
hey great thanks @jonahbenton
hi, whats the correct way to use the logger? Like what kind of information do i log? do i log the result of my application?the arguments entered? my application is a text summariser
or if anybody could point me to a decent source regarding the conventions for what or when to log something, thank you
jstokes: Environ provides access to the process environment. You shouldnât use it directly as a configuration.