This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-19
Channels
- # arachne (1)
- # beginners (108)
- # boot (50)
- # cljs-dev (7)
- # clojure (76)
- # clojure-ireland (1)
- # clojure-romania (1)
- # clojure-russia (7)
- # clojure-spec (33)
- # clojure-taiwan (1)
- # clojure-uk (36)
- # clojurescript (46)
- # core-async (13)
- # datomic (146)
- # defnpodcast (1)
- # editors (1)
- # garden (2)
- # hoplon (1)
- # jobs (1)
- # lumo (7)
- # off-topic (21)
- # om (9)
- # pedestal (1)
- # re-frame (25)
- # reagent (5)
- # specter (2)
- # testing (3)
- # unrepl (3)
- # untangled (9)
- # vim (1)
I’m following along with the example here: http://aleph.io/aleph/literate.html#aleph.examples.tcp
When I send stuff to the server with the slow-echo-handler
with netcat, I get a response the first time and then nothing
@xiongtx Clojure maps don't implement any of the Java map interfaces. http://static.javadoc.io/org.clojure/clojure/1.8.0/clojure/lang/APersistentMap.html I don't know the reasons for that, though.
user=> (assoc (java.util.HashMap.) :a 1)
ClassCastException java.util.HashMap cannot be cast to clojure.lang.Associative clojure.lang.RT.assoc (RT.java:807)
user=> (assoc (into {} (java.util.HashMap.)) :a 1)
{:a 1}
user=> (class (into {} (java.util.HashMap.)))
clojure.lang.PersistentArrayMap
user=> (class (into (sorted-map) (java.util.HashMap.)))
clojure.lang.PersistentTreeMap
Anyone using: https://github.com/nberger/ring-logger and configuring the log level at runtime?
I found this http://stackoverflow.com/questions/18779296/clojure-core-async-any-way-to-control-number-of-threads-in-that-go-thread
I use clojure.core.async.pool-size
system property as mentioned in the second answer to that question. https://github.com/clojure/core.async/blob/43139e44b04dd09bb5faa555ea8ebd2ca09e25ce/src/main/clojure/clojure/core/async/impl/exec/threadpool.clj#L20
https://github.com/clojure/clojure/blob/clojure-1.8.0/src/jvm/clojure/lang/APersistentMap.java#L16
@hamid The newer unaccepted answer seems to be what you're looking for. Also check out manifold if you're interested in a more flexible alternative: https://github.com/ztellman/manifold/blob/master/docs/execution.md
@hamid It's also described in the ns-docs string: https://clojure.github.io/core.async/
@johnnyillinois I'm using ring-logger-timbre and configure per-namespace levels at runtime
clojure regex is just java regex
(on the jvm at least)
@bcbradley - looks like java doesn't think it's whitespace
+user=> (Character/isWhitespace 160)
false
https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#isWhitespace(int)i had to convert everything into a vector of characters and map over the integer codes myself, what a pain
it explicitly doesn't consider nonbreaking spaces whitespace, if you look at that javadoc link
for instance, in any standard javadoc-- the space between the type of a parameter and the name of the parameter is a 160
@bcbradley here's a unicode regex that matches whitespace
+user=> (re-matches #"\p{Zs}" (str (char 160)))
" "
see also http://docs.oracle.com/javase/6/docs/api/java/lang/Character.html#isSpaceChar(int)
So… I’m trying to remove the first string from a vector. And when i remove the first sting the function returns [#function[clojure.core/filter/fn—####] “other string"]
@juanmp when you give filter only one argument, it returns a transducing function
it looks like, instead of filtering the vector, you are replacing the first element of the vector with a filter transducer
Oh.. is there any easy way to get rid of the transducer? I’m googling right now what those are 😅
juanmp you shouldn't be creating one
I don't even know why you are using filter
it might be useful to share some of your code at this point
OK - that's not how remove works
remove happens to use filter internally
you can't use map to return a different number of items than the seq you provide
you can't use remove to remove an item by index
if you want the item without the first entry, just use rest
if you are literally looking for the first string in the vector, and replacing that, this is a trickier problem, but it won't involve map or filter
so basically I have a sequence of vectors with 2 strings in it each. and I want to remove the first sting on each vector
juanmp (map rest coll)
if they need to remain vectors (map (comp vec rest) coll)
remove takes a collection and removes every item that has a truthy result for its function arg
Oh alright, I’ll check what rest and coll do right away 🙂 Thank you @noisesmith !
oh - coll was just a placeholder
your code would be (map rest (load-csv csv-file))
it's OK - coll
is a common name for collection arguments in clojure
Oh, that’s good to know! And that worked perfectly @noisesmith ! Thank you very much
@juanmp check out https://clojure.org/api/cheatsheet - it's helpful
Thank you, Clojure is the first programming language I’m trying to learn. So please excuse my stupid questions and thank you for your patience ! 🙂
Thanks @U0HJ8KMH7
When running my tests (in an admittedly funky environment), I’m suddenly getting a NoClassDefFoundError.
If I break on that Error, it’s trying to use a DynamicClassLoader to resolve the class. The 5 ancestor classloaders above that are also DCLs, and then there’s the AppClassloader.
Class.forName("cursive.repl.Printing", false, ClassLoader.getClassLoader(caller).getParent().getParent().getParent().getParent().getParent().getParent())
works fine from within Class.forName()