This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-11
Channels
- # announcements (1)
- # aws (3)
- # beginners (48)
- # calva (2)
- # cider (47)
- # clj-kondo (1)
- # cljs-dev (23)
- # cljsrn (10)
- # clojure (81)
- # clojure-chicago (4)
- # clojure-europe (3)
- # clojure-greece (4)
- # clojure-italy (8)
- # clojure-losangeles (1)
- # clojure-nl (6)
- # clojure-sanfrancisco (1)
- # clojure-seattle (1)
- # clojure-uk (21)
- # clojurescript (40)
- # core-async (82)
- # cursive (18)
- # datomic (6)
- # duct (11)
- # figwheel-main (4)
- # fulcro (26)
- # jobs-discuss (22)
- # leiningen (18)
- # off-topic (10)
- # pathom (3)
- # re-frame (5)
- # reagent (16)
- # reitit (4)
- # shadow-cljs (8)
- # specter (7)
- # sql (16)
- # tools-deps (58)
- # xtdb (30)
Hi, I'm trying to do something like (merge (into {} (for [ch "abc"] [ch 1])) (into {} (for [ch "def"] [ch 2])))
but want it to be more scalable and work with any number of lists
@shin Maybe look at map-indexed
?
(with multiple collection mapped to vectors perhaps?)
(apply merge (map-indexed (fn [i x] (into {} (for [ch x] [ch i]))) (map vector coll1 coll2 coll3 ...)))
user=> (apply merge (map-indexed (fn [i x] (into {} (for [ch x] [ch i]))) (map vector [1 2 3] [:a :b :c] ["f" "o" "o"])))
{1 0, :a 0, "f" 0, 2 1, :b 1, "o" 2, 3 2, :c 2}
user=>
Is that what you're after @shin?
thanks @seancorfield! I'm actually looking for a solution that maps [1 2 3] to 1 [:a π :c] to 2 etc.
Is this it @shin
(->> [[1 2 3] [:a :b :c] ["f" "o" "o"]]
(map-indexed #(vector %2 (inc %)))
(into {}))
@jaihindhreddy I'd like to have it for each character individually, like {\a 1, \b 1, \c 1, \d 2, \e 2} [...]
Can you explain the meaning behind it, so that we can understand it better.
What happens when things repeat? What if the args are "abcd" "xdcd"
?
this is what I asked yesterday: jakuzure [12:17] I'm trying to take a list of random kanji and sort them into the different grades as seen here: https://de.wikipedia.org/wiki/J%C5%8Dy%C5%8D-Kanji
Still am not sure what you're looking for but I have a hunch group-by
can help. Checkout (doc group-by)
so I have imported a jar via leinigen with reource-paths ["resources/my-custom-secret.jar"]
in project.clj
now, since I dunno which class there are inside and there is not much documentation in the open, I was thinking if there was maybe a way to print the classes/inspect that Jar via REPL
or maybe it can even do it with Java, for moment I don't have experience with it π
the java
way: https://stackoverflow.com/questions/1171549/how-do-i-print-the-class-structures-in-a-jar-file-using-the-javap-tool
if you use cider you can just cider-open-classpath-entry
and then select and hit enter. Not sure about pure-clojure way to do it
@U06BE1L6T many thx. I'm trying it now
You can then even "open" the .class file by pressing Enter (not sure if it requires some setup or not - it uses javap
)
currently, beeing a Java nob, I have my foo.jar jars, is there a way if you know, to import the full jar in clojure?
e.g I have managed currently to build a local jar. but I dunno currently the full namespaces of my jar
for doing like the example above.. π I'm seraching maybe if i can know it via java..
I'm not sure I'm following what you mean by "import the full jar"?
If you built a local version of jukebox2 then you should do lein install
and reference it in the project.clj with appropriate version as found in https://github.com/thehammer/jukebox2/blob/369c8b3050eb3c5209452532206a743a1986c695/project.clj#L1
I fixed for moment. I'm learning how to import java classes and namespace if they have
actually I was trying to find out if there is kind of namespace in Java or is everything a class..
but it worked for moment, it was kind adventourous to setup a local jar π but it worked ! kind cool
is it possible to get emacs+cider autocomplete working in a codebase with a Maven POM rather than a lein project.clj?
Thanks @UHHHJ7FFX!
I got cider connected to an nrepl instance that I started from the CLI, and I get autocomplete in the cider repl. But don't get autocomplete when I'm editing a file
Any idea why swap!
doesnβt throw when the form passed to f
includes the io!
macro? I would have assumed that swap!
would behave similarly to alter
in this respect.
I can surmise that perhaps the expectation is that dosync
transactions would often be 'much bigger' things than changes to single atoms via swap!
, but that is only a guess on my part.
Also, because atom swaps are spin waits, the function is expected to be as fast as possible. Adding checks for io! would have some cost
I believe this is an example of doing such a thing https://github.com/seancorfield/dot-clojure/blob/master/deps.edn#L2
If you need authentication for a private repo, you can put the credentials in ~/.m2/settings.xml
hi all, do jdbc.next has support for ucanaccess driver? for .mdb files (microsoft access)
@vachichng If you have a JDBC driver, you should be able to use it with next.jdbc
(or clojure.java.jdbc
).