#clojure logs

2014-11-05

00:00sm0kei am not sure if that macro can be written at all
00:01sm0keas macros are compile time things, and i am trying to tie it up with runtime artifact
00:01sm0keprove me wrong please
00:01justin_smithno, that's perfectly correct. all it gets at compile time is a, so it has to fail at compile time
00:02sm0keugh so sad, i wanted it so badly
00:05sm0kei think may be a macro which writes a macro can do this?
00:08justin_smithwould the macro writing macro know the number of args at compile time?
00:09sm0keno but after its expansion it would right?
00:09justin_smiththe expansion happens at compile time
00:11sm0kesee my pathetic attempt here https://www.refheap.com/92736
00:12sm0kenow `bar` knows params# after its expanded right?
00:13justin_smithsm0ke: the part you removed wasn't the place where the error happened
00:13sm0kebut bar* still is seeing p as symbol :/
00:14sm0keno but now `bar` can act upon `n` at least it more than jsut a symbol
00:14justin_smith~n evaluates to the symbol
00:14clojurebotTitim gan éirí ort.
00:14justin_smith~n
00:14clojurebotI don't understand.
00:15sm0keno it does not its unquote inside `
00:15sm0ketry macroexpand-1
00:15justin_smithright, and when it unquotes, it gets the argument
00:15justin_smithwhich is a
00:16justin_smith,(clojure.core/let [params__5208__auto__ (clojure.core/repeatedly a clojure.core/gensym)] (user/bar* params__5208__auto__))
00:16clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)>
00:16justin_smithlike I said, bar is a
00:16sm0keugh yes
00:16justin_smithoops, sorry about that clojurebot
00:16justin_smitherr I mean n is a
00:17sm0keyea for macro expand but while eval its a value
00:17justin_smithso why does it get the same error then?
00:17sm0keso instead of (bar* params#) if you put params# you can see a list of two symc
00:18sm0keon evaluating (bar 2)
00:19sm0kei mean (bar a) err
00:36andyfarrdem: Figure out why clojure.parallel is missing?
00:36arrdemandyf: I pinged puredanger and he didn't have a good answer. I haven't chased it.
00:37andyfI?d recommend sending an email to clojure-dev and/or Tom Faulhaber, who may be able to figure it out.
00:37andyfif he has time
00:38andyfI don?t know, but it reminds me of this bug, which may not be related at all: http://dev.clojure.org/jira/browse/CLJ-130
00:47arrdemjustin_smith: https://github.com/clojure-grimoire/lein-grim
00:48arrdemjustin_smith: 0.2.0 is the latest, the svg is old
00:48justin_smithI see an svg that says 0.2.0
00:49arrdemcaching is bullshit man
00:49justin_smith"eventually consistent"
00:50justin_smitharrdem: woah, ,, to force indent in cond, I like it
00:50arrdemjustin_smith: dude I love that trick
00:50justin_smithsomehow this is the first I have seen it
00:51justin_smithI think I'm going to try to hack on pink tomorrow
00:52justin_smithafter I get some day-job crap out of the way
01:00arrdemandyf: posted
01:00andyfthx
01:01TEttingerarrdem: are you one of them thar grad students who shows up to class if it fits his schedule?
01:01arrdemTEttinger: dude I'm an undergrad :P
01:01TEttingernice
01:01TEttingerso you need to work!
01:01arrdemI am working. On clojure stuff!
01:01arrdemfuck this homework shit
01:02TEttingerI mean in general, there's no "grades don't matter" stuff like PhD-level classes
01:18kenrestivomy dumb core.async question of the day: is there a way to pull things out of a channel *only* if there's something in there? and return nil if nothing is available?
01:19kenrestivorather than blocking/parking? take! does not do what i want: if there's nothing available right now the callback queues and executes later when something is stuffed in.
01:19arrdemwell.. shit. I just broke 1.4.0 compat due to needing clojure.edn
01:19arrdemoh well
01:20kenrestivowho.... uses clojure 1.4.0 in 2014? :-)
01:21arrdemhttps://cognitect.wufoo.com/reports/state-of-clojure-2014-results/
01:21arrdem~4% of Clojure users :P
01:21arrdempoor sods
01:21kenrestivoit's like those android charts showing 10% of users are on 2.3
01:22arrdemyes, yes it is
01:23arrdemkenrestivo: I suspect that's a core.async abstraction fault... the entire idea is that take! is blocking, right?
01:23kenrestivotake! is async
01:23arrdemyes that thing
01:23kenrestivoit's got a callback... and the callback queues
01:23arrdem"magic"
01:24kenrestivowhat i want is "as of this moment, give me EVERYTHING in the queue, and if nothing is there, just nil"
01:24dbaschI know a large company that uses 1.2 in production
01:25arrdemkenrestivo: doesn't look like there's a way to do that actually.
01:25justin_smithI'm reading the code for pink - excited to start playing with it tomorrow
01:25kenrestivono, no there isn't.
01:25arrdemkenrestivo: but this is me scanning the docs for the first time so... IANTBALDRIDGE
01:26kenrestivoi should ask questions during the day east coast usa time when the cognitecters are about
01:26arrdemask on the ML
01:26kenrestivomeh, who uses email anymore? :-)
01:26kenrestivo4% of users?
01:26justin_smithpeople use the mailing list via email?
01:26justin_smithI thought it was just a google group thing
01:26arrdemI do... T_T
01:32TEttingerarrdem: I use clojure 1.4 by necessity in lazybot, since clojail is limited to 1.4 last I checked
01:32TEttingerin my lazybot plugins i mean
01:32justin_smithTEttinger: dude, my lazybot update uses 1.7-alpha
01:32justin_smithI had no issues with clojail
01:32TEttinger:D
01:33TEttingerI'll spend some time tweaking to update to your version when you release
01:33justin_smithfingers crossed, lazybot will have my updates and the new clojure version soon
01:34justin_smithTEttinger: if you have any trouble just ask, the translation should be straightforward (basically all the hooks have new keywords thanks to the new irclj)
01:34TEttingerok
01:35TEttingerthanks, justin_smith
01:35TEttinger(inc justin_smith) ; for good measure
01:35lazybot⇒ 117
01:36arrdem&::T/foo
01:36lazybotjava.lang.RuntimeException: Invalid token: ::T/foo
01:36arrdemthe hell...
01:36arrdemambrosebs: ping
01:36TEttinger,::T/foo
01:36clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: ::T/foo>
01:36justin_smith,::a/foo
01:36clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: ::a/foo>
01:36TEttinger,:T/foo
01:36clojurebot:T/foo
01:36justin_smith:a/foo
01:37TEttinger,::T
01:37clojurebot:sandbox/T
01:37justin_smithyeah, double colon means use this ns
01:37arrdemright
01:37arrdemhttps://github.com/clojure/core.typed/search?utf8=%E2%9C%93&amp;q=%3A%3AT%2Fspecial-collect
01:37justin_smithdouble you tee eff
01:37arrdemikr
01:37arrdemtried to do a `lein grim core.typed` and that totally killed it
01:38justin_smithhow did that even compile?
01:38arrdemhell if I know
01:38arrdemit's late, I'm turning in.
01:38TEttingerit requires [clojure.core.typed :as T]
01:38justin_smith(require '[clojure.string :as s])
01:38justin_smith,(require '[clojure.string :as s])
01:38clojurebotnil
01:38justin_smith,:s/foo
01:39clojurebot:s/foo
01:39justin_smith,::s/foo
01:39clojurebot:clojure.string/foo
01:39justin_smithAHA
01:39justin_smithI had forgotten about that corner
01:39justin_smithso yeah, that's totally legit
01:40arrdemokay... so why is that killing lein-grim with an "invalid token exception"
01:40arrdemjava.lang.RuntimeException: Invalid token: ::T/special-collect
01:40justin_smithif T is a local alias, that should work (as shown above)
01:40arrdemhttps://github.com/clojure/core.typed/blob/be6ffe4bd029afffec9256514cdf644bfdee2e71/module-check/src/main/clojure/clojure/core/typed/analyze_clj.clj#L16
01:41arrdemhttps://github.com/clojure/core.typed/blob/be6ffe4bd029afffec9256514cdf644bfdee2e71/module-check/src/main/clojure/clojure/core/typed/analyze_clj.clj#L47
01:41arrdemlooks legit to me
01:41TEttingeris it not importing the right lib?
01:42TEttinger,::s2/foo
01:42clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: ::s2/foo>
01:42TEttinger,(require '[clojure.string :as s2])
01:42clojurebotnil
01:42TEttinger,::s2/foo
01:42clojurebot:clojure.string/foo
01:42TEttingerorder could matter here
01:43arrdemdamnit I know what's happening here
01:43arrdemfuck
01:44arrdemstupid friggin evaling reader
01:44justin_smith,(read-string "::s2/foo")
01:44clojurebot:clojure.string/foo
01:44arrdemokay so here's what's happening
01:44arrdemthat code loads just fine
01:44justin_smithbut if you only read and did not eval the require
01:44arrdemthen when I go to grab the source
01:44arrdemthe source reader reads from a different context
01:44arrdemthan the loader reads
01:45arrdembang
01:45justin_smithoh, right
01:45justin_smithso you need in-ns
01:45arrdemyep
01:45arrdem&(bean *ns*)
01:45lazybot⇒ {:name sandbox12103, :mappings {sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, keyword? #'clojure.core/keyword?, unchecked-inc-int #'clojure.core/unchecked-inc-int, val #'clojure.core/val, ProcessBuilde... https://www.refheap.com/92739
01:45arrdem&(.name *ns*)
01:45lazybotjava.lang.SecurityException: You tripped the alarm! class clojure.lang.Namespace is bad!
01:45justin_smithwtf
01:46justin_smith,(.name *ns*)
01:46clojurebotsandbox
01:50justin_smithOK, this is some seriously low-level code. Clearly it's only in Clojure so that the more abstract composition logic and the synth can be in the same language.
01:52justin_smithhttps://github.com/kunstmusik/pink/blob/master/src/pink/filters.clj#L281 I mean look at that shit
01:55yedii'm using clojurescript in my webapp, but I want to be able to build individual js files for each page of the site. currently lein cljsbuild just builds the entire client side app into one js file.
01:56yediis there a way to be able to like build separate js files for specific namespaces without having to create multiple cljs projects/
01:58fairuzyedi: isn't one file is better than multiple? :)
01:58fairuzfaster loading
01:58yedimaybe i guess with caching
01:58yedibut the initial page load will still suffer
01:58TEttingerbarf, justin_smith
02:00yedifairuz: actually i think om server side rendering would solve my problem
02:00yedii just don't want to #breaktheweb
02:02alandipertyedi: you may consider loading the script up front on your splash or login page, but with the ‘defer’ attribute
02:02yediwhat is the defer attr
02:02yedigooglin real quick
02:02alandipertyedi: http://stackoverflow.com/a/3982619 is the best descr i could find
02:04alandipertthere are still reasons to have separate js tho, the big one for me is not leaking stuff to people who aren’t logged in
02:04yediah tho im fucked if i use client side rendering *cough* all these react frameworks
02:04yedibut i guess that was already a problem and server side rendering needs to be solved
02:05arrdemokay got it, I just needed to bind *ns*
02:05arrdemthat's enough for now
02:09sm0keso i found a way to do it, but now i am stuck in another problem
02:26razum2umhow can I access project-structure (which is passed to lein plugins) in runtime repl?
02:26sm0kewhy does `eval` loses context?
02:28sm0kei mean ##(let [a 1] (eval (list 'print 1 'a)))
02:28lazybotjava.lang.SecurityException: You tripped the alarm! eval is bad!
02:34razum2umsm0ke: see chapter 8 from joy of clojure - http://take.ms/aHmVu
02:38sm0kei dont see anything regarding eval
02:38sm0kerazum2um: subpart?
02:39sm0keoh got something
02:39sm0kethanks razum2um
02:39arrdem&::T/foo
02:39lazybotjava.lang.RuntimeException: Invalid token: ::T/foo
02:42razum2umsm0ke: but it's valid only if you know keys and values at compile time, if this is unpredictable you can use a hack - stash bindings into a dynamic and generate let-bindings to get functions which resolve vars using this dynamic - the graeat example is https://github.com/GeorgeJahad/debug-repl/blob/master/src/alex_and_georges/debug_repl.clj#L68
02:43sm0kewow
02:43arrdemif anyone feels motivated to write a patch on core... http://dev.clojure.org/jira/browse/CLJ-1579
02:43sm0kesome ugly hack
02:44razum2umsm0ke: is the only way if bindings keys are known in runtime only
02:44sm0kethat *locals* thing has a problem of concurrency though?
02:44sm0kewhat if multiple thread calls evals-with-locals
02:45razum2umsm0ke: don't feel so until you share mutable things there
02:48razum2umsm0ke: you can also try (ThreadLocal.) as a value for dynamic
02:50sm0keweird how that contextual-eval is working!
02:51sm0kei think its a con, for simple values sure it will work, but i think you put a fancy class there and you will get cant embedd object into code
02:54razum2umsm0ke: exactly, java obkects will complain about being inserted into code textually like in a macro
02:55razum2umsm0ke: but you can save a qualified symbol and then use find-var
02:55sm0kethen whats the whole point of the fancy macro i can always use `mylocal` instead of `'mylocal`
02:58sm0kei mean he could have written it simply as (eval (list '+ a b))
02:58sm0kepointless example imo
02:58razum2umsm0ke: with macro you can pass bindings from same let block, these have no qualified name
02:59razum2um(let [x 1 y [1 2] z (contextual-eval {:x x} (some)))
02:59sm0keyep ok agreed it shows eval is contextless
03:00sm0kebut not really helpful as a generic `contextual-eval`
03:00razum2umyes, joy of clojure seem to explain this, but i forgot
03:00sm0keit will not work in most cases
03:01sm0kewhich brings me back to 0
03:01razum2umsm0ke: perhaps real implementation of eval with context will face same concurency problems as debug-repl hack
03:01razum2umsm0ke: what is the problem you're solving?
03:03sm0keits actually like this, given a number you have to give back a function with same arity
03:03sm0kehttps://www.refheap.com/92743
03:03sm0kethe `bar` function works here, but its a toy case
03:03sm0keso lets say i am passing a object along with `n`
03:04sm0kewhich cannot be embedded in the eval list, it will fail
03:06sm0keoh you have to change 'n to n for this to work, i was editing it
03:07razum2umwhy do you even need this arity, not just & args?
03:08sm0keyes i know about & args, its just a requirement for another macro i am writing
03:08razum2umdoh :) macro in macro in macro :)
03:09sm0kehurm weird problem i know
03:15sm0kerazum2um: i think i have a neat solution, hold on
03:18sm0kerazum2um: https://www.refheap.com/92744
03:36hyPiRionbbloom: I do, in a way. http://hypirion.com/musings/ – but noted, I'll get on it this evening
05:43kungiHow can I create an internal maven repository for my company and use it together with leiningen? Are there any tutorials you would recommend?
05:58razum2umkungi: look at :repositories in profiles.clj and add like this ["clojars" {:url "https://clojars.org/repo/&quot;}]
06:24kungirazum2um: thank you
06:27clgvkungi: there are several options for the server part
06:28clgvkungi: I use Apache Archiva. There is also Artifactory and at least another prominent one I dont recall right now
06:31kungiclgv: I found Nexus as well
06:32clgvkungi: ah right
06:32clgvkungi: archiva was easy to setup
06:33kungiclgv: Archiva looks nice! standalone distribution with jetty included => great
06:33clgvkungi: yes. the only thing that took time was that I was not familiar with redirection through apache to reuse its SSL setup
06:34clgvkungi: but that's probably not an issue if the repository is in your LAN
06:34kungiclgv: I solved that problem by delegating all our SSL stuff to nginx.
06:35clgvkungi: I already had an apache running and didn't use nginx so far...
06:35kungiclgv: nginx was the first web server where I was able to understand the config ... so I started using it and never stopped :-)
06:36kungiActually I don't like doing "sysadmin stuff"
06:36clgvkungi: yeah apache config sometimes feels like voodoo
06:36kungiclgv: More like indian rain dancing than voodoo :-D
06:36clgvkungi: you are always better of when you have an existing working config snippet that you can adjust there ;)
06:47the-kennyThe clojurescript repl situation is sooo complicated :/ It's really a pity.
06:48CookedGryphonthe-kenny: I thought that, until I found weasel, much simpler imo
06:48the-kennyCookedGryphon: I use weasel exclusively, I'm talking about the stack under it
06:48CookedGryphonah
06:49the-kennythere's weasel on top of austin on top of piggieback on top of nrepl
06:49CookedGryphondidn't realise weasel used austin under the hood
06:50the-kennyhm you may be right now that I think of it
06:50the-kennyStill, I'm searching for one (actually two) bugs in that stack
06:50the-kennyOne that prevents stuff from being printed in the REPL before I send *any* nrepl message from Emacs
06:50CookedGryphonyeah, I'm looking at the deps and it doesn't seem to use austin or piggieback
06:50the-kennyit provides another transport for piggieback
06:51the-kennywhile piggieback itself uses clojure.browser.repl
06:51Glenjaminif you try and run weasel without piggieback, it errors
06:51CookedGryphonah, ok
06:52the-kennyGlenjamin, CookedGryphon: Do you have the issue of stuff not being printed in the REPL with print-fn set to :repl?
06:52CookedGryphonI've never made use of that feature, I've always just had the js console open and printed to that
06:52the-kennyhm :/
06:52Glenjamini had austin steal my console.log at onepoint
06:54the-kennyRight now I'm pretty lost where to report this issue. It's not weasel, as it seems to (print) the stuff it receives over the websocket just fine. So it's either piggieback or tools.nrepl that fails to deliver (or capture) the print-event before any other message arrives over the nrepl connection
06:55the-kennyI wish I could just throw away everything and start right at the bottom, implementing a 'lein ws-repl' that doesn't use piggieback under the hood. But that's a mammoth project after looking at the code of all those things
06:56the-kennywith a second nrepl-server *just* for cljs you could just have to nrepl connections from cider: one for cljs, one for clj. Although that would mean rewriting stuff there too
07:01engblomPlease anyone take a look at this: http://pastebin.com/TfV0Xat5
07:02engblomThis works for some time until too many files are open. How do I get a continuous buffer instead of rereading the file each time?
07:03engblomThis code is for reading mouse actions
07:05raspasovhey guys, do you know if it's possible to get information about a Clojure's data structure in terms of memory consumption, i.e. get how many Kb/Mb is a map (get-size-in-kb my-map)
07:08clgvraspasov: that's difficult similar to determining allocated memory of any Java object. there are (not that easy) ways to accomplish this
07:10raspasovyup, makes sense, ballpark estimates are OK, I'm trying to design a buffer pool allocator, so that if my cached objects start exceeding X megabytes, I would start removing them from memory
07:11raspasovthe key would be doing this without a significant hit on performance
07:19clgvraspasov: oh just a limit on the number would not suffice?
07:19engblomI just solved my own problem so nm my question
07:19raspasovyou mean a limit on the number of cached objects stored?
07:20clgvraspasov: determine allocated memory usually requires debug capabilities of the JVM, so performance is likely not that good
07:20clgvraspasov: yeah, if they consume similar amounts of memory that would work
07:21raspasovclgv: thanks for the input, I see, I'll search around some more, worst case a rough estimate of how big the objects are just setting a limit on the total count might be better/easier
07:21raspasovclgv: and simpler, which is always good :)
07:21clgv:)
08:41csd_Is it possible to write some macro m such that {(m)} could be considered a valid hashmap? E.g. m expands into two forms prior to reader looking for them?
08:43hyPiRioncsd_: you can do `{~@(m) ~@()}
08:43csd_oh that's clever, i like it
08:43hyPiRionBut it's probably better to do just (apply hashmap (m))
08:49engblomWhat is the most simple way to send a message to 127.0.0.1 port 9000. I do not need to read the response. What library would you use?
08:49Kneivaengblom: what kind of message? curl
08:49engblomKneiva: telnet
08:50engblomI want to make a program sending messages in the same way as I could do with telnet.
08:53Kneivaengblom: maybe http://stackoverflow.com/a/10447539/1790621
08:57engblomThanks
09:25the_dankomorning!
09:26fairuzthe_danko: night
09:30daniel__the_danko: good afternoon
09:31the_dankofairuz daniel_ how are things going today?
09:32the_dankofariuz daniel_ i am doing a little core async learning from lispcast
09:37samfloreswhat's the simplest way to verify whether a vec is "contained" or not in another vec?
09:37samflores(subvec? [1 2 3] [1 2]) ;; => true
09:37samflores(subvec? [1 2 3] [1 3]) ;; => false
09:44clgvsamflores: there is nothing simple built-in
09:45clgvsamflores: you can partition the bigger vector with respect to the size of the smaller one
09:47clgv,(defn subvec? [a b] (some #(= % b) (partition (count b) 1 a)))
09:47clojurebot#'sandbox/subvec?
09:47Bronsasamflores: (defn subvec? [v1 v2] (some #{v2} (partition-all (count v2) 1 v1))) not terribly efficient but it's the shortest solution I could think of
09:47Bronsaclgv: ha!
09:47clgv,(subvec? (range 5) [2 3])
09:47clojurebottrue
09:47clgvBronsa: :P
09:47clgv3secs :D
09:48clgvBronsa: yeah, efficient solutions are more sophisticated
09:48Bronsaoh yeah, no reason to use partition-all in thi case
09:49clgvsamflores: you have a pattern matching problem in case you want to look up efficient algortihms in the standard literature (Cormen...)
09:53samfloresclgv :(
09:57samflores,(every? identity (map = [1 2 3] [1 2])) ;; that's why I'm in love with FP
09:57clojurebottrue
09:57samflores,(every? identity (map = [1 2 3] [1 3]))
09:57clojurebotfalse
09:58samfloressuddenly it just clicks :)
09:58EvanR:t identity
09:59EvanR,(identity nil)
09:59clojurebotnil
10:00clgvsamflores: that only works for special cases like the one you provided
10:00clgvsamflores: the version Bronsa and I provided above work for all cases
10:00hyPiRionalways a bit suprised that every? isn't vararg
10:00clgv,(every? identity (map = [1 2 3] [2 3]))
10:00clojurebotfalse
10:00clgvsamflores: ^^
10:01hyPiRionwished I could do (every? = [1 2 3] [4 5 6])
10:01BronsahyPiRion: yeah me too
10:01clgvhyPiRion: so why not just write a jira+patch for it?
10:02EvanR.oO( all? (zip-with =) or something
10:02samfloresclgv I got disconnected and lost your replies, but I really need to verify the subset is at the beginning
10:02clgvsamflores: that only works for special cases like the one you provided while the version Bronsa and I provided above work for all cases
10:02clgv,(every? identity (map = [1 2 3] [2 3]))
10:02clojurebotfalse
10:02clgvsamflores: see above a counterexample for your implementation ^^
10:06samfloresyeah, I know its false. but it fills my requirement of the subvec being at the beginning of the supervec (wich I didn't mention earlier)
10:06Bronsasamflores: so you don't need to find the subset, you just have to find if your vector starts with some elements
10:06clojurebotGabh mo leithscéal?
10:08EvanR,(every? true? '())
10:08clojurebottrue
10:08EvanR,(every? false? '())
10:08clojurebottrue
10:09samfloresBronsa right. I asked for a subset because I thought there was something already in the clojure.core for it
10:10EvanRwhats the opposite of every?
10:10samfloresI expected to exists something like .indexOf
10:10hyPiRionnot-any?
10:10samflores*exist
10:11EvanRdo not see some, exist, any, etc
10:11EvanRat least some? doesnt do what im talking about
10:11hyPiRionsome then.
10:11EvanRah ok
10:11EvanR,(some? true '())
10:11clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/some?>
10:11EvanR,(some? true? '())
10:11clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/some?>
10:11hyPiRion,(some true? ())
10:11clojurebotnil
10:11EvanR,(some true? '())
10:11clojurebotnil
10:11EvanR,(some false? '())
10:11clojurebotnil
10:12EvanRk
10:12clgvthat's why "some?" is such a good naming choice for that function :P
10:13EvanRit almost serves as the opposite of every?
10:13EvanR,(some false? '(true true false))
10:13clojurebottrue
10:13EvanRconfused
10:14robhollandtrue
10:14robholland;)
10:14hyPiRionWhat do you mean by opposite in the first place?
10:14clgvnot really you have to distinguish on two levels. shall the predicate be true or false for success and how many elements of the list must fulfill that: at least one or all
10:15EvanR,(or '(false false true true))
10:15clojurebot(false false true true)
10:15EvanRis there a simpler function that is just the and or or of all the bools
10:16EvanR,(false? false)
10:16clojurebottrue
10:16EvanRok i was thinking some returned the found value
10:16Bronsa,(some identity [1 2 3])
10:16clojurebot1
10:16Bronsait does
10:17EvanRonly if you us identity or a collection
10:17EvanR,(some false? '(true false))
10:17clojurebottrue
10:17Bronsa,(some inc [1 2 3])
10:17clojurebot2
10:17hyPiRionEvanR: (every? true? x) == "(apply and x)" and (some true? x) == "(apply or x)"
10:17EvanRhyPiRion: ok
10:17hyPiRionwell, if you assume every element is either true or false.
10:17EvanR,(apply and '(true true true false))
10:17clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/and, compiling:(NO_SOURCE_PATH:0:0)>
10:17Bronsayeah usually some identity is more useful
10:18clgvhaha only if `and` where a function ;)
10:18hyPiRionEvanR: That's why I wrote (apply and x) in quotes :)
10:18clgvhyPiRion: you tricked him! confess! :P
10:18EvanR,(= (some true? x) "(apply or x)")
10:19clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>
10:19hyPiRionI think you need to take me a bit more figuratively.
10:22SagiCZ11.
10:26EvanR,(= [1 2 3] [1 2 3])
10:26clojurebottrue
10:26EvanR,(= [1 2 3] [1 2])
10:26clojurebotfalse
10:27EvanRanother way to do it ;)
10:29EvanR,(map vector [1 2 3 4] [\a \b \c \d])
10:29clojurebot([1 \a] [2 \b] [3 \c] [4 \d])
10:29EvanR,(map vector [1 2 3 4] [\a \b \c])
10:29clojurebot([1 \a] [2 \b] [3 \c])
10:29EvanR,(map vector [1 2 3] [\a \b \c \d])
10:29clojurebot([1 \a] [2 \b] [3 \c])
10:35EvanRis there a recursive let construct
10:35justin_smithEvanR: what does that mean?
10:35vermaI expect this call to return me a channel which always outputs 1 no matter what the source had, doesn't seem to be working, I get the original value, what am I missing?
10:35vermahttps://www.refheap.com/92761
10:35justin_smith,(let [a 0 b (inc a) c (inc b)] c)
10:35clojurebot2
10:36EvanRthats the non recursive let
10:36vermathe source chan values are what I get, I was hoping the transducer will be applied
10:36justin_smithOK what do you mean by recursive
10:36EvanR,(let [a (inc b) b 3] a)
10:36clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: b in this context, compiling:(NO_SOURCE_PATH:0:0)>
10:36EvanRthe lhs variables can be referenced in any rhs
10:36justin_smithEvanR: flet is the closest we have but it can only define functions
10:36justin_smithit just doesn't exist
10:37EvanRonly being able to define functions makes sense in a schemy-like context
10:37EvanRwhats the word, eager
10:37tbaldridgeverma: I'd need to see more of the source code, nothing seems to be putting data into the channel you're creating?
10:38justin_smithEvanR: there is nothing in clojure that can use things in definitions that are not yet defined - you need something like declare or resolve for vars, and there is simply no option in a let block
10:38EvanRi know about declare, but does that work locally
10:38justin_smithlike I said
10:38justin_smithit's for vars, let bindings are not vars
10:39tbaldridgeverma: yeah, that code won't work, You're creating a channel via chan, but then nothing is putting data into it. Async/pipe returns the 2nd argument (the 'to' chan)
10:39EvanRlooks like flet is a no no in clojure this recommends letfn http://clojure.org/lisps
10:39justin_smithEvanR: you can sometimes pull something off with a promise / deliver
10:39justin_smithEvanR: sorry, I keep doing that
10:39EvanRjustin_smith: are vars local?
10:39justin_smithno
10:39justin_smiththey are globals
10:39EvanRok
10:39justin_smithI keep calling letfn flet, my bad
10:40justin_smithsame with calling promise delay (I caught myself this time0
10:40EvanRletfn, all is right with the world
10:40EvanRwell, except that tail calls might bust the stack?
10:40justin_smith,(flet [(a [] (inc (c))) (c [] 3)] (a))
10:40clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: flet in this context, compiling:(NO_SOURCE_PATH:0:0)>
10:41justin_smith,(letfn [(a [] (inc (c))) (c [] 3)] (a))
10:41clojurebot4
10:42justin_smithEvanR: tail calls could bust the stack, and it's a bit silly to have to turn everything into a function
10:42EvanRit is
10:43clgv$source letfn
10:43lazybotletfn is http://is.gd/6UUJnn
10:44clgvok that one dives pretty straightforward into the compiler ;)
10:44EvanRtheres a recursive let strategy for eager language, i read about once
10:44justin_smithclgv: yeah, I think letfn* is a special form, and basically part of the compiler
10:45EvanRwhich crashes if what you wrote is nonsense, otherwise works
10:45clgvno question ;)
10:45justin_smithEvanR: in common lisp let is recursive and parallel, let* is sequential like ours
10:46EvanRright i think the paper i read was an improvement over some lisp where it was recursive but might lockup if you what you wrote makes no sense
10:46EvanRbut i dont know
10:46justin_smithwait, not recursive - but they have letrec
10:46justin_smithit's been a while
10:46justin_smithlet - parallel (no cross ref) let* - linear (only back ref) letrec (full cross ref)
10:47EvanRwhats parallel let
10:47EvanRruns everything in parallel?
10:47justin_smiththat means all values are effectively calculated in parallel
10:47EvanRfunky
10:47justin_smithno reference to any other value in the binding form is allowed
10:47vermatbaldridge, thanks! yeah I messed up the argument order
10:53EvanRletfn gives you almost what you can do with local function defs in javascript
10:53EvanRif you move vars to an enclosing normal let in either case, then its the same
10:53EvanR(js vars)
10:53EvanRnon functions
10:55EvanRvars that use the functions have to go below, so a little more tricky than full letrec
11:24sdegutisDo you find that your Compojure apps have an top-level routing namespace that has a ton of :requires in the (ns) form for all sorts of other routes?
11:26sdegutisMine's like 30 lines long, and I'm wondering if that's a sign of bad design.
11:26weavejesterI expect it depends on how complex your application is
11:27weavejesterIf you have 30 types of routes, your app is doing 30 different things, presumably.
11:27nonubywhat abboout doing something like (:require [acme.web sales deals user-admin pwd-change]) etc..
11:28nonubynot sure if it works, but was exploring same problem yesterday https://clojuredocs.org/clojure.core/require
11:28sdegutisMy concern is more for the fact that I have to require them all. Perhaps I should be dynamically finding them instead?
11:28justin_smithyuck
11:29kungisdegutis: Yes my compojure app has a routing namespace containing "tons" of routes.
11:29sdegutisjustin_smith: What's bad about this idea?
11:30justin_smithsdegutis: I should be able to look at the namespace that creates the server and see exactly where the code defining routes can be found.
11:30sdegutisWhy?
11:30clojurebotwhy not?
11:30EvanRits way easier to understand code that has references to what its using
11:31justin_smithsdegutis: because I read code, and fix other people's code
11:31sdegutisclojurebot: useless retort.
11:31clojurebotExcuse me?
11:31EvanRrather than just names
11:31EvanRsimple scripts is different from a huge codebase
11:32EvanRin ruby (rails) the norm is to not have any requires anywhere for anything
11:32sdegutisjustin_smith: But "follow the namespaces linked directly above in the (ns) declaration" is only one convention. Another could be "embed routes in any sub-namespace ending with '-routes'" instead.
11:32EvanRthe assumption is that "everything" has been imported everything, this is somehow supposed to make things easier
11:32EvanReverywhere*
11:32justin_smithsdegutis: I don't want to waste my time learning a new set of conventions for each project I work on, and remembering which convention each one used
11:33justin_smithsdegutis: if I come to a new codebase, or a codebase I wrote a decent time ago in the past, I want to be able to figure out what happens where without reverse engineering some kind of magic
11:33sdegutisjustin_smith: That's an unfounded exaggeration. These could be the two major conventions that all apps use, which would invalidate your concern.
11:33sdegutisjustin_smith: If library "foobar" became very popular and uses the second convention, you'd know to look for either one or the other.
11:33justin_smithsdegutis: I'll agree when all apps use the convention, until then no
11:34sdegutisSo far I've only seen apps that use the (ns)-based convention.
11:34sdegutisThe only argument I understand so far is EvanR's.
11:34justin_smithsdegutis: a big part of why I use clojure is we have a very small number of conventions, I don't want to learn a new dsl every day
11:35sdegutisjustin_smith: That doesn't mean we have no conventions. The convention of (defroutes) has already become standardized even though it's effectively a DSL.
11:35EvanRauto import of thing named foo works, until it doesnt
11:35justin_smithsdegutis: I don't use defroutes
11:35EvanRthough i dont think were talking about that
11:35nonubysdgeutis, how about routes.cljs builds a list of other routes from admin-routes.clj contact-routes.clj deal-routes.clj etc.. not sure if correct but something like (apply routes (concat (adminroutes/routes) (dealroutes/routes))
11:35sdegutisjustin_smith: Clojure community is very conservative about adopting new conventions, and that's probably good. But I don't think that has to mean we stop adopting new ones altogether.
11:36EvanRwhats wrong with modules just importing what it uses
11:38technomancyEvanR: it's a bit tedious if you don't use slamhound
11:38EvanRdang
11:39sed-utilsnonuby: You mean dynamically instead of in the (ns) declaration?
11:39EvanRtechnomancy: installing
11:40justin_smithsed-utils: one of the primary bonuses to clojure is that in a given namespace I can figure out where each value came from. Auto loading magic subverts this.
11:41sed-utilsEvanR: I imagine Ruby's "auto require the entire universe" is probably difficult, especially with Ruby being more prone to conflicting module/submodule names. But in this very simple hypothetical route-finder example, I can't really see much that can go wrong it.
11:41justin_smithsed-utils: I don't think it's about conservatism - this is something that has evolved in clojure - we were once ok with :use, and we decided it was not explicit enough. Most languages have some kind of implicit / global / eager namespace alteration and I like that clojure at least avoids it.
11:42sed-utilsjustin_smith: I suppose we'll have to disagree about how valuable Clojure's explicit symbol tracing is. I find it very useful for simple functions like yaml/read-string or json/read-string, but for very redundant and highly-patternized names like route vars, it's not hard to find those in a project without the explicit require.
11:43EvanRsed-utils: i dont think there are many conflicting module names, in fact no body uses modules qualified because everything is dynamically infused into existing classes, which themselves are never named. this issue is not being able to understand what source code you have to go find on github to understand a given word in the app code
11:43sed-utilsBtw I'm sdegutis; just changed nicks to make it easier to read, type, and autocomplete.
11:43EvanRinvisible stuff is hard to reason about
11:44sed-utilsThe one argument I have against an implicit route-finder is that the precise ordering of your routes would be hard to control.
11:44clgvEvanR: you mean like dark matter?
11:45EvanRdark code is another thing entirely
11:47sed-utilsI have seen some very confusing Rails apps in the past, and I agree that it can quickly become very difficult to find something, especially if you're not using something like Sublime Text's "find symbol in project" feature.
11:47EvanRrails and code of many libraries in ruby
11:47EvanRfinding a symbol may not help because the symbol may be dynamically installed
11:47sed-utilsBut the Clojure code I've seen is a little too far on the explicit side, apparently simply for the sake of trying to avoid the problems an implicit infrastructure causes.
11:48sed-utilsEvanR: Yes, I'm very much against the idea of dynamically generating methods and classes, and especially of using method_missing.
11:49EvanRbefore deciding that some code is not worth typing, and therefore should be omitted, consider if its important, if so, find a way to auto type it like that slamhound
11:49EvanRanother case this reminds me of is the automatic local variable assignments in php
11:49EvanRi dont like assigning local variables, so i use an unpack command to assign a bunch of locals from a map, easy
11:50EvanRnow you cant read the code, but at least i didnt have to type anything
11:51technomancyEvanR: I guess there's two types of boilerplate: one is bad because it's annoying to type and one is bad because it's annoying that it even exists
11:57justin_smithto quote a random thing I saw on twitter: "In my experience, hardest part of reading others' code isn't understanding code you're looking at, it's *finding* the right code to look at."
11:58justin_smiththat's why I don't like :use, don't like implicit namespace alteration of any kind
11:58technomancyalso think of reading via the web or from a diff vs reading inside your editor with cider or whatever
11:58justin_smithright
11:59sed-utilsjustin_smith: Right on. Especially in Ruby, where people like to literally just hide code and call it "refactoring" or "abstraction".
11:59technomancyit's not so bad with the latter because you can just M-., but that's not the only context in which code is read
12:00justin_smithtechnomancy: m-. also interrupts my reading flow - often I want to know "what namespace is this coming from" as a contextualizer, without visiting the namespace
12:00justin_smithalso, my cider is borked and m-. doesn't even work right now :(
12:01sed-utilsI liked Sublime Text's version of that feature, but Emacs's paredit.el is just much better than ST's.
12:01sed-utilsBut it looks to be improving, so maybe some day soon I can switch.
12:04TimMcjustin_smith: Emacs needs tooltips. :-)
12:04justin_smithTimMc: it has them, they are tricky to use
12:05TimMcclojurebot: emacs is "it has them, they are tricky to use"
12:05clojurebot'Sea, mhuise.
12:05justin_smithTimMc: emacs needs well designed elisp programs, and a better elisp that would facilitate them, so my swank / nrepl / cider isn't always broken
12:05justin_smith(inc TimMc)
12:05lazybot⇒ 77
12:06technomancyTimMc: eldoc isn't enough?
12:06TimMcI don't even know what that is.
12:06justin_smithtechnomancy: I think he meant tooltips over a symbol showing its provenance
12:06TimMcbut it sounds like Spanish
12:07csd_`justin_smith: what about use :only?
12:07technomancyjustin_smith: I mean using the minibuffer to display them specifically
12:07justin_smithTimMc: it would be nice if we did not fall into the java/ide tarpit, where things are readable and usable but only if you use some tool that fixes all the warts
12:07justin_smithcsd_`: require :refer :) and judiciously, sure
12:08justin_smithTimMc: I'd like for a printout of code, or code viewed on github, to make sense
12:08TimMcyeah
12:09TimMcProvenance... "This symbol was typed into a buffer, saved to disk, copied into a git commit, pushed to a server, downloaded to your browser, and copied to a buffer."
12:09justin_smithI meant as in "where was it defined"
12:09TimMc:-)
12:10technomancya printout!
12:10technomancyI like the idea.
12:10justin_smithtechnomancy: I love reading things on paper
12:10technomancyjustin_smith: do you use page breaks in your code too???
12:10lazybottechnomancy: How could that be wrong?
12:10EvanRcan i get a hardcopy of that? thanks
12:10justin_smithsometimes pencil marks on paper can do things that are very inconvenient to do with a computer
12:10justin_smithtechnomancy: sometimes :)
12:10technomancylet's be ctrl-l buddies
12:11justin_smith ok
12:11technomancy o
12:11justin_smith(inc )
12:11Glenjaminpaper is great for random access, but terrible for modification
12:11lazybot⇒ 1
12:11justin_smithGlenjamin: but very nice for annotation, which can inform design or future modification
12:12amalloyguys that is super-wasteful of paper. i am trying to irc, and now a bunch of near-blank pages are pouring out of my printer
12:12justin_smith(inc amalloy)
12:12lazybot⇒ 186
12:13justin_smithrelated http://www.twittertape.co.uk/
12:15EvanRyour printer works?
12:15amalloyjustin_smith: i thought it was claiming to need no paper as well. i was quite confused
12:15justin_smithhah
12:15justin_smithprobably a thermal printer?
12:16technomancyI almost bought one of those
12:16technomancywanted to build a GPS system for my car that printed out directions as you went
12:17technomancysadly while it's super easy to get coordinates, navigation is several orders of magnitude more difficult
12:17amalloytechnomancy: like, after you drive to your mom's place, it prints out directions saying how you went, so that you can give them to the next person?
12:17amalloythat sounds amusing and i will be sad if you just meant it prints out directions for you
12:18technomancyI won't spoil your amusement then
12:21EvanR,(set? #{})
12:21clojurebottrue
12:21EvanR,(unset? #{})
12:21clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: unset? in this context, compiling:(NO_SOURCE_PATH:0:0)>
12:22technomancy,(def unset? (complement set?))
12:22clojurebot#'sandbox/unset?
12:22technomancy,(unset? #{})
12:22clojurebotfalse
12:22technomancymy work here is done
12:23EvanR,((complement (constantly true)) 0)
12:23clojurebotfalse
12:23EvanRnoice
12:27EvanRstupid ctrl W in xchat not backspacing
12:27amalloy,((((constantly complement) true) set?) #{0})
12:27clojurebotfalse
12:28justin_smithseems relevant to the state of my emacs "5) Complex systems run in degraded mode." "14) Change introduces new forms of failure." http://www.ctlab.org/documents/How%20Complex%20Systems%20Fail.pdf
12:29EvanRnumber 5 is hitting a lot of nails on the head it hurts
12:30justin_smith,(((((constantly (constantly (constantly (constantly true))))))))
12:30clojurebottrue
12:30gfredericksreiddraper: the new shuffle generator seems to require a vector but doesn't say so in the docstring
12:35EvanRis into lazy
12:35TimMcjustin_smith: https://mitpress.mit.edu/books/engineering-safer-world
12:35justin_smithno
12:35TimMcinto is the opposite of lazy
12:35nathan7into is a reduction operation, it cannot be lazy
12:35TimMcit is laziness's archenemy
12:36EvanRit is frustrating to me the map output of my into prints halfway before crashing on cannot create ISeq from Character
12:36justin_smithTimMc: in fact, let's rename lazy-seq to out-of
12:36EvanRpprint
12:36EvanRnot sure what its complaining about, since the print does not complete
12:41amalloyEvanR: your situation is thus far somewhat vague, but my guess is that you have a non-lazy collection (produced by into) containing within it unrealized lazy seqs; when you try to print the whole thing, those inner ones blow up
12:42EvanRblah
12:43arrdemtechnomancy: ping
12:43nestastubbsgnus
12:43nestastubbsdoh
12:43nestastubbsemacs fail
12:44technomancyarrdem: sup
12:45arrdemtechnomancy: leinigen plugin deps injection halp
12:45arrdemtechnomancy: https://github.com/clojure-grimoire/lein-grim/blob/master/src/leiningen/grim.clj#L8
12:45technomancyrule 1: don't
12:45technomancyrule 2: (for experts only) do with great reluctance
12:46sed-utilsrule 3: do only with great regret?
12:46sed-utilsrule 4: don't?
12:46technomancyworks for me
12:46technomancyarrdem: why is this a plugin?
12:47Glenjaminaustin does that, it's really really really confusing
12:47arrdemtechnomancy: because I need to do source paths introspection in he src mode
12:47arrdemtechnomancy: other than that it could just be a script
12:47technomancyarrdem: why can't you just scan the classpath for entries that are directories?
12:47arrdemtechnomancy: checkouts for one
12:47Glenjamini'd rather just be told to add a dep to deps, and add a plugin to plugin - than have the plugin add magic deps
12:47technomancyarrdem: lein with-profile production run -m grimoire.main
12:48technomancyarrdem: checkouts and tests are only in the default profile
12:48technomancystrip them out and you're good
12:49arrdemdon't love that answer but it'd work...
12:49technomancyarrdem: if you have to alter the project map, doing it through profiles that ship with the plugin is the way to go
12:49technomancybecause it means that the user can override them
12:50technomancymerging in a map that's hard-coded inside the plugin means you get zero transparency and you have to reinvent your own override mechanism, if you even bother with overriding
12:50EvanRthus
12:50EvanR,(into {} "booya")
12:50clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Character>
12:50EvanRmentally noting that this error means "tried to convert a string into a map"
12:51arrdemtechnomancy: okay so I guess you'd do :aliases {"grim" ["run" "-m" "grimoire.doc"
12:51EvanRat least possibly
12:51technomancyarrdem: right, exactly; typing that whole thing out would get tedious
12:51arrdemtechnomancy: okay so I guess you'd do :aliases {"grim" ["run" "-m" "grimoire.doc" :project/group :project/name :/project/version]}
12:51arrdemthen args get appended
12:51arrdemand away you go
12:51technomancydeclarativity ftw <3
12:52technomancyyou could make a plugin that just assocs that alias into the project map =)
12:52EvanR,(map? {})
12:52clojurebottrue
12:52mgaareEvanR: technically it means "tried to convert a string into a seq"
12:52Glenjamin(doc into)
12:52clojurebot"([to from] [to xform from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined. A transducer may be supplied."
12:52arrdemwhelp that sure solves my inability to keep the artifact version in sync between two places in the source tree
12:52amalloymgaare: no it doesn't
12:52amalloytried to convert a *character* to a seq
12:52Glenjamin,(seq "a")
12:52clojurebot(\a)
12:52Glenjamin,(seq (seq "a"))
12:52clojurebot(\a)
12:52EvanRtechnically it means exactly what it says which is monumentally unhelpful by itself
12:52mgaareamalloy: ah yes, right you are.
12:52Glenjaminerm
12:52Glenjaminoh right
12:52Glenjamin,(map seq (seq "a"))
12:52clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Character>
12:53EvanRespecially since it tried to do this later when i printed out the nested map
12:53Glenjaminor i guess technically
12:53justin_smithEvanR: how is "a character is not a seq" unhelpful?
12:53Glenjamin,(conj {} (first (seq "abc")))
12:53clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Character>
12:53technomancyarrdem: I really need to get this better documented
12:53Glenjaminthats what's happening in into ^^
12:53technomancyhaving this approach get better-documented would alleviate a lot of frustration
12:54arrdemtechnomancy: I mean... that I or whoever the hell can drop in IRC and ask is pretty good docs IMO
12:54arrdemtechnomancy: 10/10 support
12:54technomancyhehe
12:54EvanRjustin_smith: because the character in question, which was in a string, since i wasnt dealing with characters at any point, was invisibly nested somewhere in my data which is itself mostly invisible, since i have not a good understanding of its form, and that the error wasnt triggered at the place where i actually tried the conversion
12:54mgaarejustin_smith: one just has to remember that anything that seqs a string creates a seq of characters, otherwise it's confusing. "where did this character come from?"
12:55EvanRi have to do this in ruby, a lot of conversion error messages have a more likely explanation "tried to convert a string into a map"
12:55Glenjamin,(into [] "abc") ; works
12:55clojurebot[\a \b \c]
12:55Glenjamin,(into {} "abc") ; expects the argument to be a seq of pairs, so fails
12:55clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Character>
12:55EvanRyeah so wtf
12:56EvanRoh it tries to do seq twice
12:56Glenjamin,(into {} [1 2 3]) ; it's like trying to do
12:56clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
12:56Glenjamin,(into {} [[:a 1] [:b 2] [:c 3]]) ; instead of
12:56clojurebot{:a 1, :b 2, :c 3}
12:56Glenjaminand yes, the error message sucks
12:56justin_smith,(into {} '((a 0) (b 1))) ; another fun variation
12:56clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.util.Map$Entry>
12:57Glenjamindoes the stack trace show that it's conj that's complaining?
12:57Glenjaminnot sure if that'd help
12:57EvanRGlenjamin: at the very end of this trace its clojure.lang.RT.seqFrom
12:57Glenjamin(source into)
12:57Glenjamin$source into
12:57lazybotinto is http://is.gd/jIBW7I
12:57EvanRi didnt see any of my actual code in the trace which is frustrating
12:58mgaareEvanR: yeah, it calls seq twice - once to turn the argument into seq, and then again on each element to try to turn it into something that can be a MapEntry
12:58EvanRso i need to dynamically determine if the thing can be converted into a map with into {}
12:59EvanR"if the first element can be converted into a map entry" -_-
12:59mgaareEvanR: you need to know the "shape" of your data regardless
13:00justin_smithEvanR: in practice, I only use into {} when the thing came out of a hash-map
13:00mgaare,(apply hash-map "abcd")
13:00clojurebot{\a \b, \c \d}
13:00justin_smithEvanR: like if you map on a hash map, and return each entry, into {} is great there
13:00sed-utilsBut I heard it's inefficient.
13:00mgaarethat works for "flat" things. (into {}) is for seqs of 2-tuples
13:00EvanRthis is a datomic entity map, and it needs to be a normal map to work with other maps in a diff
13:01justin_smith,(into {} (map (fn [[k v]] [k (inc v)]) {:a 0 :b 1 :c 2}))
13:01clojurebot{:c 3, :b 2, :a 1}
13:01amalloyjustin_smith: really? i use into/{} all the time on stuff that didn't come from a map
13:01amalloyit's like the best way to make maps
13:01mgaareEvanR: have you looked at the new datomic pull api? it's helpful for that
13:01justin_smithamalloy: after generating each entry in some other way? OK
13:02EvanRmgaare: yeah this looks about right
13:05EvanRmgaare: looks rather new
13:05mgaareEvanR: just released 10-28
13:06EvanRi have an older version of datomic installed because the latest one was crashing or something...
13:06EvanRblah
13:07sed-utilsEvanR: I've used (into {} datomic-map) many times.
13:07sed-utilsEvanR: And I cringe each time.
13:08sed-utilsEvanR: What version of Datomic are you using, and what for?
13:08mdrogalissed-utils: The new pull API should help that, at least some.
13:08amalloyjustin_smith: i just did a little searching, and it turns out i don't actually do it *that* often in real code, but i see some stuff like (into {} (for [x xs] [x (f x)]))
13:08EvanRsed-utils: 0.9.4894
13:08sed-utilsmdrogalis: I'm sorry, which library is this API part of?
13:08sed-utilsEvanR: Oh, okay. I'm using 0.8.4218
13:09EvanRheh
13:09justin_smithamalloy: like a more flexible zip-map
13:09sed-utilsHonestly I just want to use Postgres.
13:09mdrogalissed-utils: Latest release of Datomic.
13:09amalloyjustin_smith: i don't like that comparison: i hate building maps like that with zipmap
13:09amalloy(zipmap xs (map f xs)) is gross to me
13:09sed-utilsBut the Board of Directors really wants us using Datomic, so we'll probably never use Postgres :(
13:10mdrogalisThings I don't usually hear, heh. ^
13:10EvanRah yes board of directors making decisions about database implementations
13:10justin_smithamalloy: s/more flexible/less gross/ maybe?
13:10amalloyi found another one: (into {} (for [[k v] m :when (f k v)] [k something-else]))
13:10justin_smithagreed that zipmap coming from two maps on the same data is gross btw
13:11sed-utilsmdrogalis: Neat. I wonder about the Pull API's efficiency.
13:11amalloyjustin_smith: i just don't see the point of comparing it to zipmap. it's a way of accomplishing a task that zipmap isn't good for
13:11justin_smithOK
13:11amalloywhy not call it a more specialized reduce?
13:11sed-utilsEvanR: Our Board of Directors is two very-senior and still-active coders.
13:11justin_smithamalloy: that's the *typical* use of zipmap that I have seen
13:11EvanRthat explains a bit more
13:11sed-utilsAnd very respected in the programming community.
13:11justin_smithand yes, it is gross
13:12amalloyi choose to remove such uses of zipmap from my memory, and so the only ones i have seen are in like csv parsers: (map #(zipmap headers %) data-rows)
13:12EvanRsed-utils: im new to datomic, some of the blurbs make sense, some of these tools surrounding it dont make sense, and in the end who knows if its really web scale
13:12justin_smithamalloy: also, that other one is exactly the case I was talking about (into {} is natural if you just iterated across a map and made new entries)
13:12sed-utilsEvanR: The only difficulty I have had with Datomic Free is that it kills the GC super badly.
13:13sed-utilsI had to do some ugly hacks to make the site stop completely dying day after day.
13:13amalloyjustin_smith: i guess so. "came from a map" was unclear to me, because the data i'm putting into the map actually is not map entries from some other map
13:13EvanRsed-utils: thats absurd
13:13sed-utilsThat said, I'm not a devops person, and while I can write some slick Clojure, I have no idea how to configure a JVM.
13:13amalloybut now that you say it, the way i intrerpreted your statement doesn't make any sense
13:13technomancyarrdem: let me know if the alias approach works well for grimoire. I have tried to think through the use cases but haven't put it through the paces with some of the latest changes yet myself.
13:14arrdemtechnomancy: lol kk I'll do a test 0.3.0 of lein-grim later today and let you know how it shakes out
13:16EvanRwell after lein depsing the latest version of datomic, vim hangs when trying to reload
13:17mdrogalis"depsing". Mmmmm.
13:18EvanRrequiring my namespace from the lein repl hangs
13:18EvanRgoing back to the old version and using into
13:18csd_Is it possible to expand a macro within the binding section of let
13:19Glenjamini'd like to turn {:a true :b false :c true} into [:a :c] - currently conj-ing a vector in reduce-kv - anyone got a better idea?
13:19csd_(defmacro foo [] '`a) (let [(foo) :bar] a)
13:19TimMccsd_: Yes... if you wrap the let in another macro. :-P
13:19csd_how do you mean
13:20TimMcSomethign that preprocesses the let form.
13:20EvanRGlenjamin: off the top of my head id do a filter keys followed by keys
13:20TimMcI bet amalloy_ could do some magic with symbol-macrolet.
13:20csd_TimMc: sounds like a headache
13:20TimMcyep
13:21csd_it seems to me that if there were a way to give macros execution priority that you could solve it too
13:21GlenjaminEvanR: you mean like (->> {} (filter second) (map first)) ?
13:22EvanRim not sure exactly what ->> {} does
13:22technomancywhen in doubt, macroexpand
13:23Glenjaminis that an answer to ->> or the let question?
13:23mi6x3mhey clojure, is it customary to define dummy vars in test namespaces in order to test something made to run on vars?
13:23mi6x3mlike a dummy function
13:23sed-utilsUmm..
13:23perplexasomehow i always read Ganjaman ;p
13:24GlenjaminIt's like Benjamin, but with Glen :p
13:24TimMcIt's the answer to "What is Glen short for?"
13:24perplexaglen's jammin!
13:24sed-utilsJust like Annie is short for Annielia.
13:25perplexa;p
13:25schmeeGlenjamin: (for [[k v] m :when v] k)
13:25Glenjaminoh right, for
13:25Glenjamini always forget about for
13:25TimMcM-x for
13:25TimMcs/for/butterfly/
13:27Glenjamin(inc schmee)
13:27lazybot⇒ 1
13:27schmeewoohoo!
13:27schmeeI lost my virginity
13:27Glenjamin,(defn class-set [m] (string/join " " (for [[k v] m :when v] k)))
13:27schmeeor something
13:27clojurebot#<CompilerException java.lang.RuntimeException: No such namespace: string, compiling:(NO_SOURCE_PATH:0:0)>
13:27Glenjaminmeh, whatever
13:27Glenjaminit works \o/
13:29EvanRi am so not used to vim hanging
13:30Glenjamin,(str :thingy)
13:30clojurebot":thingy"
13:30Glenjaminalways catches me out :(
13:32schmee,(name :thingy)
13:32clojurebot"thingy"
13:32schmeeGlenjamin: ^
13:32Glenjaminyeah, i just always forget :)
13:33sed-utils$karma sdegutis
13:33lazybotsdegutis has karma 6.
13:33sed-utils$karma sed-utils
13:33lazybotsed-utils has karma 0.
13:34sed-utilsOh nice.
13:36EvanRhallelujah lord jesus it works now
13:36EvanRpull api and all
13:40EvanRmgaare: gah it returns collections as a vector rather than a set...
13:52sdegutisEvanR: Why is that bad?
13:52EvanRbecause im trying to do a diff
13:52sdegutisEvanR: You get ordering that way.
13:52EvanRyou get some ordering but not necessarily a desired or consistent ordering
13:52EvanRthe data for a many attribute is naturally in a set state
13:53justin_smithEvanR: you can make a set reliable from a vector, the reverse is not the case
13:53EvanRyes, i am doing that
13:53EvanRbut this vector is itself from a set
13:53EvanRthe default api gives you a set
13:54justin_smithOK
13:57EvanR,(clojure.data/diff [1 2 3] [1 3 2])
13:57clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.data>
13:57EvanR[[nil 2 3] [nil 3 2] [1]]
13:58martinklepschis there a function to get a file path for a namespace? i.e. (x 'project.server.api) => "project/server/api.clj" ?
14:01hyPiRion#(str (munge %) ".clj") ?
14:02hyPiRionwell, that ignores the . to / conversion, so nevermind that.
14:06martinklepschso there's nothing built-in I guess
14:07amalloyTimMc: there's not much you can do with symbol-macrolet, when the thing you want to "expand" isn't in an evaluation position
14:11amalloycsd_: "execution priority" for macros is...i mean, i don't think it's strictly impossible, but it isn't really in line with how macros work
14:11CookedGryphonIs it possible to add an annotation to a reified thing?
14:13amalloyto implement it you'd need to impose a total ordering on all macros in existence, and change the compiler dramatically
14:13amalloyand it leads to weird questions like, what if the order is A first, then B, then C, and in code like (C (B x)) C expands to A?
14:17maarekI'm trying to convert this java class to clojure http://pastebin.com/kBUUkV3y. Can someone check my clojure. I seem to have a lot of issues with it from IllegalArgumentException Parameter declaration Fields. should be a vector to and CompilerException java.lang.RuntimeException: Unable to resolve symbol: deserializeString in this context.
14:19justin_smithmaarek: you need to put the definitions in a different order
14:19justin_smithmaarek: the clojure compiler does no lookahead for definitions
14:19justin_smithat the time that -deserialize is defined, deserializeString does not exist yet
14:19dbaschthe defn in line 19 is wrong
14:20justin_smithoh yeah, the defns are wrong, you need an args list on each
14:20justin_smith*that defn
14:21justin_smithalso, for any function that acts as a method, the first argument is always "this"
14:21justin_smithso you want another arg I think
14:21maarekHmm
14:21justin_smithmaarek: that is, when deserializeString is called with no args, "string" will be "this", when it is called with one arg, you will get an exception for the wrong argument count
14:22justin_smithbecause the object is always the first argument to the method
14:24maarekjustin_smith: I've reordered so that deserializeString is first and added [] to getOutputFields. I'll see what happens.
14:24justin_smithmaarek: add a "this" arg, unless they are static methods
14:25maarekdeserializeString is static and the other two are not.
14:25justin_smithOK - in your declaration deserializeJson (which does not exist) is the static one
14:27maarekjustin_smith: Opp I changed that to deserializeString after the pastebin :)
14:28justin_smithOk, just remember that a regular method always gets its object as the first arg
14:28maarekjustin_smith: Will do, thanks.
14:29hiredmanamalloy: change macros to expand on the way down and on the way up
14:30justin_smithhiredman: hah, macro middleware
14:31sir_pineconehey all, is it possible to use an if statement in thread-last? I want to leave the value as is if the if evals to true. something like (->> items (if foo identity reverse) (partition-all 3) ...)
14:32maarekjustin_smith: Do I have the class definition correct? Would I import this as (:import [storm.kafka StringScheme])
14:33justin_smithmaarek: it looks right at a first glance at least
14:33dbaschsir_pinecone: no, you have to make it a function that takes one argument
14:33justin_smithmaarek: one more thing: #^{:static true} could just be ^:static
14:34sir_pineconedbasch: OK, thanks
14:34maarekjustin_smith: okay thanks.
14:35justin_smithmaarek: I remember someone saying (maybe it was amalloy?) that (:import (some.package Class)) was better, but I forget why
14:36amalloyjustin_smith: technomancy probably says it too
14:37technomancyclojurebot: import indent?
14:37clojurebotimport indent is brackets imply all entries are peers, while parens imply that the first entry is different from the rest: http://p.hagelb.org/import-indent.html
14:37technomancy~botsnack
14:37clojurebotThanks! Can I have chocolate next time
14:37justin_smithaha! now I know the reason, thanks
14:38samfloresis there a way to use something like a "subtopic" with core.async?
14:38samflores^ using pub/sub
14:38amalloytechnomancy: i can never remember how you square that (har har) with the use of square brackets for require
14:39technomancyamalloy: how so?
14:39dbaschit’s really splitting hairs, I wouldn’t say it’s “better”
14:40amalloytechnomancy: (:require [foo.bar.core :as bar \n :refer [whatever]])
14:40amalloy:refer is clearly a peer of :as, not of foo.bar.core
14:40amalloyand yet we have to use square brackets anyway, because in *this* case the clojure compiler treats them differently
14:41technomancyamalloy: hmm... I guess I never put newlines in requires
14:41amalloyi lied earlier: i remember that being your answer, in fact
14:41technomancybecause class names are redonkulously long, but usually clojure peeps have the good sense not to go nuts about it
14:41amalloywhich is totally a cop-out, philosophically
14:41technomancyyep
14:42amalloyi've needed newlines in requires once or twice, for like long :refer lists followed by a :rename or something
14:42technomancyI don't think I've ever used :rename
14:43amalloyamazingly, i actually used it once a few months ago, although i'd forgotten about it
14:43amalloy(:require [hiccup.util :refer [escape-html] :rename {escape-html escape}])
14:43technomancyhm
14:43amalloybecause what kind of lame name is escape-html
14:44technomancyI do have a pet peeve when you have stuff like (for instance) hiccup.html/escape-html
14:44amalloyexactly
14:44technomancywhen the var name includes the last segment of the ns name
14:44technomancyit just looks silly
14:44amalloy(or the first segment)
14:44justin_smithI like the name for that: smurf naming
14:44technomancyhehe
14:45technomancyI think that was more common when :use was prevalent
14:45amalloyi am unsurprised to hear you've never used :rename, though, since you were one of the earliest detractors of prefix lists in require, making it hard to grep for stuff
14:45justin_smithrequire hiccup.smurf/smurf-html
14:45amalloyand rename presents similar problems
14:45technomancyamalloy: hm; actually the grep thing is more about namespaces than individual vars
14:46technomancygrepping a var name is never going to work well due to false positives
14:47TimMcjustin_smith: :-D
14:47amalloyi had forgotten about the term "smurf naming"
14:48amalloy(inc justin_smith) ; for the reminder
14:48lazybot⇒ 118
14:49TimMc(inc justin_smith-human)
14:49lazybot⇒ 1
14:49justin_smiththanks for keeping track of that stuff for us, lazybot-bot
14:50samfloresthat's what I'm trying to accomplish: https://gist.github.com/samflores/62cacdf10b6f1a4d1ca9
14:52justin_smithsamflores: could this be done be a broadcast channel that repeats another broadcast channel?
14:53jonathanjis there a pattern (or recommendation) for pluggable code in clojure?
14:54justin_smithjonathanj: pluggable in what sense?
14:54technomancyhow is "pluggable code" distinct from "first-class functions"?
14:54samfloresjustin_smith, I'm not sure I got what your idea
14:54jonathanjwell, i mean supplied by someone other than the software author
14:55samfloress/what//
14:55justin_smithjonathanj: multimethods and protocols are both useful for that
14:55justin_smithjonathanj: as are pure functions that take functions as arguments
14:55amalloyjonathanj: a library that accepts functions as arguments to its functions? or are you hoping end-users can write code at runtime?
14:56jonathanjamalloy: runtime would be nice but even if you could drop some code into some "plugins" directory and discover it at runtime would be sufficient
14:56justin_smithsamflores: https://clojure.github.io/core.async/#clojure.core.async.lab/broadcast so you could use this, or multiplex, which is right next to it - depending which side you want to do the merging on
14:57technomancyjonathanj: leiningen looks for tasks under the leiningen.$TASK/$TASK var and that has worked out very well
14:57technomancyyou can put metadata on the var to signal options, like docstrings or requirements
14:58jonathanjcan leiningen discover tasks or do you have to invoke the specific task?
14:58technomancyjonathanj: I don't understand how those two are distinct
14:59amalloytechnomancy: he's asking if `lein help` can enumerate all extant tasks
14:59amalloy(yes, it can)
14:59jonathanjhow does that work?
14:59justin_smithtechnomancy: I think he wants a system where putting an artifact in a magic plays makes it get run, magically
14:59samfloresjustin_smith: I'll need some time to understand/try it :) thanks
14:59justin_smiths/plays/place
14:59technomancyjonathanj: it scans the classpath using the bultitude lib
15:00amalloyoutside of lein, that sort of magical discovery of stuff isn't very popular in clojure; it's more popular to be explicit, by providing an interface that takes in some functions, and wiring them together to the structure your program wants to have
15:00technomancyhttps://github.com/Raynes/bultitude
15:00justin_smith(inc amalloy)
15:00lazybot⇒ 187
15:00samflores(inc justin_smith)
15:00lazybot⇒ 119
15:00technomancyright, the whole point of leiningen is to bridge the CLI->clojure functions
15:01technomancyso the convention of CLI args -> tasks is always at the forefront
15:01wsmoakany hints on grammars for TextMate? It doesn’t know .clj yet…
15:01technomancyif this isn't true in your situation, some configuration might help make things clearer
15:01jonathanjhrm, so something like a config file mapping command names to functions
15:02justin_smithwsmoak: I don't know texmate, but I know that dnolen_ knows his shit, so this is probably legit https://github.com/swannodette/textmate-clojure
15:02justin_smithit's old though
15:02wsmoakjustin_smith: thanks. had found https://github.com/mmcgrana/textmate-clojure (of which that’s a fork) but it’s years old so I wasn’t sure
15:03justin_smithyeah, both their projects tend to be pretty good, but I can't speak to that particular thing at all
15:03jonathanjcan one have cyclic dependencies in clojure?
15:03justin_smithno
15:04jonathanj(i think i mean requirements, not dependencies)
15:04justin_smithjonathanj: cyclical require is detected as a compiler error when loading a namespace
15:05justin_smithjonathanj: you can fake it with resolve, but it's better to refactor to eliminate the cycle
15:05jonathanjokay
15:07justin_smithjonathanj: two things to consider regarding cycles is that it is common in clojure to address a broader range of functionality in one namespace than would in a single java class - so merging may be in order
15:08justin_smiththe other thing is that I forget what the other thing I was thinking
15:09jonathanjjustin_smith: i come from a Python background, so the broader range thing is already a part of my daily life; the cycles thing was just something that suddenly occurred to me, i haven't actually run into it yet
15:10m1dnight1guys, sorry to ask for help about namespaces *again*, but i cant seem to get my code to run, once more..
15:10justin_smithjonathanj: cool. I think the other thing was "why not put a multimethod or protocol in a third namespace that the other two namespaces use"
15:11m1dnight1the project worked fine last week, now it can't find classes anymore
15:13m1dnight1"could not locate meta_clojure/actors/actors__init.class or meta_clojure/actors/actors.clj on classpath
15:13m1dnight1however, they are in my classpath. My project.clj has the entry ":source-paths["src"]" (which has been like that since the begining
15:14justin_smithso, is there some error in meta_clojure/actors/actors.clj that would prevent the ns being loaded?
15:14m1dnight1let me try and compile that one
15:14m1dnight1brb
15:14m1dnight1also a clasnotfound exception for a java file
15:14jonathanjis there some kind of static analysis tool for clojure that i can use in my editor (emacs)?
15:14m1dnight1but, to fix that, previously I added this to my core.clj:
15:14m1dnight1:java-source-paths ["interop"]
15:14jonathanjException in thread "main" java.lang.RuntimeException: EOF while reading, starting at line 79, compiling:(clj_acheron/core.clj:214:1)
15:14justin_smithjonathanj: I use lein check in the repl
15:15jonathanjis particularly annoying to debug
15:15jonathanjjustin_smith: what do you mean in the repl?
15:15justin_smithsorry, I mean in the terminal
15:15justin_smithd'oh
15:15m1dnight1and to verify, there is indeed a file in interop/actors/BlockingStore.java
15:15m1dnight1I also tried "lein compile" in the terminal first
15:16justin_smithjonathanj: that error means that in the file clj_acheron/core.clj, starting on line 79, there is a paren, bracket, or string literal that is never closed
15:16m1dnight1oh, it seems that restarting emacs did the trick, odd
15:16m1dnight1so probably the lein compile?
15:17justin_smithm1dnight1: it could have been there was a stale class file that was loaded and out of sync with everything else
15:17justin_smithand the lein compile would overwrite it
15:17m1dnight1Yeah that probably was it
15:17m1dnight1i'll have to keep it in mind then :)
15:17m1dnight1I wa sure of it that everything worked :p
15:17m1dnight1thanks for listening though guys
15:18justin_smithm1dnight1: "lein do clean, x" is an option
15:19jonathanjjustin_smith: yes, it's the "starting on" part that's annoying
15:19justin_smithwhy? doesn't it help to know where the unclosed context opened? it's not like the compiler can know where it should have closed
15:20EvanRbut it could give you some good alternatives to pick from ;)
15:20jonathanjwell if you have something like (defn foo [] ((let [a 1]) a)
15:20jonathanjthen "starting from" points at the defn line
15:21justin_smithyes, that's the first of the two non-closed parens
15:21EvanR"perhaps you meant to close the defn right before line foo, the start of the next defn
15:21EvanR"
15:22justin_smithEvanR: yeah, clojure's compiler does not attempt to be smart or helpful like that at all
15:23justin_smithI mean, defn inside another defn is allowed after all. It's just not usually what you want
15:23justin_smithah, right!
15:23justin_smithjonathanj: perhaps you want a linter type tool, there are a few
15:23jonathanjunfortunately i don't have a real example, i just tried to recreate one that i spent about 5 minutes trying to debug only to find out i was barking up the wrong tree
15:23justin_smithand they catch things that are not errors per se, but are often errors
15:23EvanRits allowed, i wouldnt be surprised, but i would appreciate it if a tool assumed i didnt want to do that
15:23justin_smithjonathanj: eastwood is a popular one
15:23justin_smithkibit is decent
15:24EvanRwhats the effect of a defn in side a defn, to replace the top level function?
15:24justin_smithEvanR: replace? you can create a top level function inside a function. It just isn't a good idea, usually
15:25justin_smithand yes, on a second run it would replace it
15:25EvanRor a first, if it was already defned somewhere else
15:25justin_smithjonathanj: https://github.com/jonase/eastwood
15:25EvanRim going to say its not a good idea at all
15:25justin_smithEvanR: sure, but that's true for a normal defn too
15:25justin_smithEvanR: it is a TERRIBLE idea
15:25justin_smithbut it is allowed
15:26EvanRmy life is a struggle to treat dynamic-as-fuck systems as if they were static ;)
15:26justin_smithheh
15:27justin_smithEvanR: but consider that we allow arbitrary redefinition, because repl based development would be a pain in the ass otherwise
15:27justin_smithwhere in a static system a double definition should be an error
15:27EvanRruby for example if you ignore instance_eval, normal eval, method missing etc, could be sanely type inferred
15:28EvanRarbitrary redefinition makes sense in the context of an implicit nested let
15:28EvanRlet [a 1 a 2 a 3 etc
15:29justin_smithEvanR: that's not redefinition
15:29EvanRshadowing
15:29justin_smiththat's shadowing
15:29wsmoakdnolen_: around? I can’t get the bundle to work under ~/Library/… at all. works under /Applications though. :::shrug::: just wondered if you’re using TextMate 2 and where you put yours.
15:29justin_smithEvanR: (def a 2) (def a 4) is not shadowing, it is redefinition
15:29EvanRit has the same effect if you are always evaluating some let
15:29justin_smithEvanR: in that it effects any definitions in between that relied on a
15:29EvanRyes i get it
15:30dnolen_wsmoak: I haven't touched the textmate support in years - it's abandonware at this point
15:30EvanRit would work if you reloaded the other definitions after
15:30EvanRif they is what you want, though
15:30EvanRthat*
15:30EvanRjust talking about possible repl methodology
15:30justin_smith,(let [a 0 f (fn [] a) a 1] (f))
15:30clojurebot0
15:30justin_smith,(def a 0)
15:30clojurebot#'sandbox/a
15:30justin_smith,(defn f [] a)
15:30clojurebot#'sandbox/f
15:31justin_smith,(def a 1)
15:31clojurebot#'sandbox/a
15:31justin_smith,(f)
15:31clojurebot1
15:31justin_smithEvanR: that's how it's different
15:31EvanRyes, depends on what youd rather happen
15:31justin_smithwell, one mutates other things you defined, the other does not
15:32wsmoakdnolen_: yeah I saw the dates. wasn’t sure if the syntax was just that stable, or… ;) thanks.
15:32EvanRit doesnt mutate the things but the context that they are going to execute in
15:32EvanRand context doesnt have to be mutable to work like that
15:36visofi guys
15:36visofhi
15:36visofwhat is the fastest way to remove all words in a list from a string ?
15:36justin_smith,(remove (set [
15:36clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
15:37justin_smith,(remove (set ["a" "b" "c"]) ["a" "b" "d" "c" "a" "f" "b" "g"])
15:37clojurebot("d" "f" "g")
15:37justin_smithyou can use set to turn a list / vector / lazy-seq into a predicate
15:37visofgreat
15:38justin_smiththat tests if the argument is in it
15:38visofjustin_smith: thanks man
15:38justin_smithnp
15:38justin_smithnot strictly a predicate - but good enough for one :)
15:38visofso it's working fast if you have 10^6 word?
15:38justin_smithvisof: caveat - if nil or false are in your list of things to remove this would fail
15:38dbaschjustin_smith: he said a string, not a list of strings
15:38justin_smithdbasch: oh, oops
15:39justin_smithI misread
15:39dbaschvisof: do you have a string or a list?
15:39visofdbasch: it's okay
15:39visofdbasch: i should split the string by spaces to words
15:39dbaschyeah, it’s an extra step of split / str
15:39visofbut if there is a faster way this would be fine wihout converting
15:39dbaschor join
15:39justin_smithvisof: if you reuse the same set of matched strings, a set should be pretty fast
15:39justin_smithvisof: there may be something faster but harder to implement though
15:40visofjustin_smith: so what is the method?
15:40dbaschstrings are immutable, so you’d need a stringbuilder and a linear scan
15:40justin_smithvisof: harder to implement, as in I haven't implemented it
15:41sdegutisClojure and Ruby have one thing in common: x = x
15:41sdegutiskirloo: go away bot
15:41sdegutis(def x x)
15:41sdegutisBoth work even when x is not yet defined.
15:41sdegutis,x
15:41clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>
15:41sdegutis,(def x x)
15:41clojurebot#'sandbox/x
15:41sdegutis,x
15:41clojurebot#<Unbound Unbound: #'sandbox/x>
15:42EvanRif false; x = x; end, also works, causing x to be defined ;)
15:43justin_smithsdegutis: the first arg in a def form is added as a var in the namespace before the value is evaluated. It just isn't bound to any value yet. So (def x x) binds x to a var that has not yet been assigned a value.
15:43justin_smithsdegutis: that's why, but not neccissarily an excuse or argument that it should make sense
15:44sdegutisEvanR: x = x unless x
15:44EvanRi never reassign to the same variable in ruby
15:44justin_smithsdegutis: so is this because the language writers were huge fans of Aristotle, or of Ayn Rand?
15:45amalloylittle-known fact: aristotle was a huge fan of ayn rand
15:45EvanRya lyin
15:49dbaschjustin_smith: you’re saying it’s an objectivism-oriented language?
15:50justin_smith,(def a a)
15:50clojurebot#'sandbox/a
15:51sdegutis,x
15:51clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>
15:52sdegutisSuch a short memory.
15:52dbaschclojurebot has this condition
15:53EvanR,(let [a a] a)
15:53clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)>
15:53EvanR,(letfn [a (fn [] (a)] (a))
15:53clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>
15:53EvanR,(letfn [a (fn [] (a))] (a))
15:53clojurebot#<CompilerException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol, compiling:(NO_SOURCE_FILE:0:0)>
15:54amalloyare you looking for (letfn [(a [] (a))] (a))?
15:54EvanR,(letfn [(a [] (a))] (a))
15:54clojurebot#<StackOverflowError java.lang.StackOverflowError>
15:55amalloyequivalently, ((fn a [] (a)))
15:55EvanRjenga!
15:57m1dnight1is there a way to make a hard copy of a value in clojure?
15:57m1dnight1to pass it to another thread
15:58amalloym1dnight1: if it's immutable, all copies are "hard", in that they never change. just send a reference
15:58amalloyif it's not immutable, Here There Be Dragons
15:58bbloom... and normal java rules about defensive deep clones apply
15:58bbloom*cringe*
15:58EvanRdefensive deep clones
15:58m1dnight1well you actually have a valid point amalloy
15:58EvanRdeploy
15:58dbaschlock ; clone ; unlock ; sigh
15:58m1dnight1it would be enough for my usecase
15:59bbloomm1dnight1: it's enough for all but the highest performance use cases, and even then it's often enough
15:59EvanRwhats an example of a mutable "value" ?
15:59dbaschwell, in hickeyspeak “values” don’t mutate
16:00dbasch the vessels containing said values mutate
16:00bbloomEvanR: laziness? like the hash field in clojure's structures. but i'd argue that lazy "values" are not "values", sshhh don't tell the haskellers (unless they've moved on to idris and learned to prefer strictness)
16:00EvanRstill, that does not compute
16:01EvanRi mean dbasch makes sense, i dont see how laziness has anything to do with it
16:01EvanRso if two threads are attempting to use the same lazy seq, they might mess each other up?
16:03bbloomEvanR: not if the lazy thunk is deterministic, no. the advancing of seqs are synchorinized in clojure
16:05EvanRuh huh
16:05EvanRa lazy sequences head, then, does not count as a mutable object, from the programmers perspective
16:06EvanRim just trying to understand a case where m1dnight_ needs to worry about what he is passing to another thread
16:13sdegutisI'm reducing a small Ruby file that uses Sprockets, and I'm appreciating Clojure a lot right now.
16:20EvanRwhat is the trick to put a print in the middle of the thread first macro
16:21dbaschEvanR: you want a function that prints the argument and evaluates to the argument
16:21EvanRyeah
16:23EvanR,(-> {:a 1 :b 2} (dissoc :a))
16:23clojurebot{:b 2}
16:23EvanR,(-> {:a 1 :b 2} (dissoc :a) (update-in [:b] inc)
16:23clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
16:23EvanR,(-> {:a 1 :b 2} (dissoc :a) (update-in [:b] inc))
16:23clojurebot{:b 3}
16:32martinklepschin ns-tracker, if a namespace A changes does this flag namespace B that requires A ?
16:34vermaafter I add a dep to project.clj, do I have to sort of restart my repl, and cljsbuilds?
16:38AeroNotixis there a better client for cassandra than the clojurewerkz one?
16:40ystael_AeroNotix: i can name at least one _not_ better one, but i don't know of a better one :)
16:40AeroNotixblegh
16:52sveriHi, how can I use fixtures with test.check?
16:58{blake}I just realized that I've been doing block commenting with double quotes. That seems potentially problematic.
16:58{blake}sveri, Did you see this: https://clojuredocs.org/clojure.test/use-fixtures ?
16:59sveri{blake}: yea, but its not working with test.checks defspec
17:01{blake}sveri, Huh.
17:02{blake}sveri, I'm just now doing a serious test suite for Clojure so I'm not too familiar with either.
17:02sveri{blake}: yea, np
17:22justin_smithEvanR: were you thinking of (doto println) ?
17:22EvanRi dont know
17:22justin_smith,,(-> {:a 1 :b 2} (dissoc :a) (doto println) (update-in [:b] inc))
17:22clojurebot{:b 2}\n{:b 3}
17:22EvanRgood
17:23EvanRthough i figured out my problem just by staring at the code
17:24technomancyfenyman method woo
17:24technomancy*feynman
17:25ag0rexcan private instance fields be accessed with java interop?
17:25justin_smithag0rex: with reflection, same as you would do it in java
17:26EvanRi thought feynmans method was to have your buddies hold you upside down while you pee on the problem
17:26EvanRbecause that would have been more satisfying
17:26dbaschEvanR: that works really well if the problem is you
17:26EvanRlol
17:26ag0rexjustin_smith: is there a clojure wrapper around java reflection api?
17:27justin_smithag0rex: clojure.reflect
17:27mdrogalisEvanR: I *really* enjoyed his book.
17:28justin_smithEvanR: is there some in joke about Feynman in that that I am missing?
17:28TimMcIt's a reference to one of his stories.
17:29TimMcSome buddies of his apparently thought that peeing worked by gravity. (Or they only said so to see what he's do?)
17:29EvanRis there something like whatever || fallback
17:29EvanRwhere if whatever if nil, you get fallback
17:29ag0rexjustin_smith: thank you!
17:29technomancyjustin_smith: feynman problem-solving method: 0) write down the problem, 1) think very hard, 2) write down the solution
17:30EvanRstep 0 is often skipped
17:30EvanRoften a disaster
17:30mdrogalisEvanR: (or x y)
17:30mdrogalis,(doc fnil) ; Also very useful.
17:30clojurebot"([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched."
17:31justin_smithtechnomancy: I know that one :) not the one about having buddies hold you upside down while you pee on the problem.
17:31technomancyright right
17:31technomancy(inc fnil)
17:31lazybot⇒ 2
17:32mdrogalis*Facepalm*
17:32justin_smith0) write down the problem (skipped) 1) think very hard 2) go make a pizza because I was thinking about pizza and I
17:32justin_smith'm hungry now.
17:32guest59In Om, how can I pass a key when using a for loop?
17:32justin_smithwait what?
17:36dbaschguest59: what do you mean by a for loop? do you have some code you can paste somewhere?
17:37EvanRwhat is the operation for append two vectors
17:37EvanR,(+ [1] [2])
17:37clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number>
17:37EvanRgood
17:37eric_normandEvanR: into
17:37eric_normand,(into [1 2 3] [4 5 6])
17:37EvanRsup eric
17:37clojurebot[1 2 3 4 5 ...]
17:38EvanRim working on the third floor
17:38eric_normandEvanR: I'm on the second floor
17:38eric_normandEvanR: same building?
17:38EvanRactually i dont know
17:39eric_normandEvanR: you're in IP Building?
17:39guest59 dbasch: In Om, how can I use a loop with a key without using om/build? I keep getting a react warning "Each child in array should have a unique 'key' prop ..."
17:39m1dnight_quick question about clojure and emacs. Sometimes I have threads that keep on running. How do I kill all of them? atm I'm using cider-restart but it annoys me a bit that when I do that all my windows are rearranged :p
17:39EvanRyeah, the intellectual property building
17:39eric_normandEvanR: I'm in Beta
17:39m1dnight_ctrl+c in the repl doesn't kill them. They still spew messages in the messagebuffer (println that is)
17:39eric_normandEvanR: Tyler told me you were using Clojure now
17:39eric_normandEvanR: how do you like it?
17:41j0nim1dnight_: you can interrupt a running repl invocation with C-c C-b i think
17:41justin_smithm1dnight_: the Thread API has ways to list threads, and you can set their interrupted property, but unless they are checking that property, via ##(.isInterrupted (Thread/currentThread)) there is no reliable way to shut down another thread in the jvm
17:41lazybot⇒ false
17:41j0niyeah "Interrupt any pending evaluations" from the cider README
17:41justin_smithyou can write threads that check that .isInterrupted flag and shut down if it is set, of course
17:42EvanReric_normand: real fun
17:42justin_smithj0ni: that's for the top level repl thread, not for any threads it spawned
17:42justin_smithj0ni: bound to C-c C-c
17:42eric_normandEvanR: rocking the dynlang?
17:42j0niah, sorry I guess I didn't read back far enough
17:42dbaschguest59: what does your array look like? it it an array of #js objects each one of which contains a key property?
17:43EvanReric_normand: probably going to go insane at some point but hey
17:43guest59Array of clojure maps, each one has title key.
17:44dbaschguest59: each one should have a “key” key
17:46EvanReric_normand: i get the best of both worlds, null pointer exceptions and uncaught type mismatch
17:46technomancy,((apply juxt (map #(fn [c] (c %)) (range 5))) [:a :b :c :d :e])
17:46clojurebot[:a :b :c :d :e]
17:49EvanR,(nil)
17:49clojurebot#<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)>
17:49eric_normandEvanR: well, it looks like you're exploring the contours of the language
17:49EvanR(nil) gives null pointer exception for me
17:50EvanRcant call nil makes more sense
17:50justin_smith,(let [a nil] (a))
17:50clojurebot#<NullPointerException java.lang.NullPointerException>
17:50justin_smithit's a special case that doesn't always work
17:50EvanRjaaa
17:51technomancyamazing https://github.com/garybernhardt/base
17:51dbaschEvanR: whats’’s your clojure version?
17:51dbaschwhat’s
17:51EvanR0.old
17:51EvanR1.5.1
17:52guest59dbasch: I added a :key and "key", but it didn't kill the warning. I deal with it for right now ... thanks for your help
17:56EvanR,(not-empty [])
17:56clojurebotnil
17:56EvanR,(not-empty [1])
17:56clojurebot[1]
18:10EvanRthe channel closes at 5pm or is it just me ;)
18:10justin_smithit's 15:00 here!
18:10EvanRsocal people get off at 3 i thought
18:11dbaschit’s always 5 o’clock somewhere, so it that were the case it would always be closed
18:11TimMctechnomancy: Next seajure project: A namespace that automatically exports the contents of every other namespace.
18:12justin_smithEvanR: in socal you can get off whenever, and wherever, you want
18:12technomancyTimMc: potemkin-plus
18:13EvanRhawt
18:13technomancypotemkin-professional-edition, rather
18:16TimMcpotemkin-enterprise-edition exposes an XML configuration system where you can encode how to handle name conflicts
18:16TimMcIt is Turing-complete.
18:17technomancyI'm on a chaise-lounge in the back yard FWIW
18:18visofhi
18:18visofhow can i convert arraylist to clojure native ds ?
18:18visof#<ArrayList [Hello-1, ,-2, world-3]>
18:18justin_smithvisof: into works nicely for that
18:18visofthanks
18:19justin_smith,(into [] (java.util.ArrayList. [1 2 3 4]))
18:19clojurebot[1 2 3 4]
18:19justin_smithas you see, it is asly to make an ArrayList out of a vector
18:19justin_smithalsy = also easy, btw
18:20EvanRbut what is a clojure native ds
18:20justin_smithEvanR: one which has a readable printed form
18:20EvanRok data structure
18:20justin_smithEvanR: or numbers
18:21justin_smithor booleans
18:21justin_smithor nil
18:21EvanRdata type
18:21justin_smithI think by ds he meant data structure, yes
18:21EvanRcan you convert an array list into a map
18:21justin_smithEvanR: or my answer is way off base because he was talking about a portable nintendo gaming unit
18:22justin_smithEvanR: one is key/value the other is sequential
18:22EvanRok
18:22EvanR,(into {} [[1 2] [3 4]])
18:22clojurebot{1 2, 3 4}
18:23EvanRi guess it would work if it was an array list of pairs
18:23justin_smithyeah
19:03wombleHow do I install a third-party clojure library in my riemann installation? I'm using the Debian packages from riemann.io if that makes any difference.
19:03justin_smithwomble: most of us use lein for dep management
19:04sritchiewomble: you have to create a new lein project that includes both riemann and something else
19:04sritchiealternatively, when you run riemann, you have include your project’s jar on the classpath
19:05sritchie(creating a new lein project and making an uberjar is just an easy way to do that)
19:05sritchiewomble: so, to “install” just modify the launcher script
19:05sritchiethen you can access more stuff from your riemann config
19:06wombleOK. Assume I'm *not* already a smug clojure weenie, and therefore have no idea whatsoever what any of that actually meant.
19:06justin_smithwomble: lein is leiningen, a dependency management tool
19:06technomancywomble: I don't think anyone here knows how debian packages riemann
19:07wombletechnomancy: Good thing I'm not using Debian's packages, then.
19:08TimMcAh, just .debs then.
19:10justin_smithwomble: I don't see anything smug or weenie like about what's been said here. lein is used to manage deps. Clojure "builds" everything each time you run it.
19:10TimMcwomble: Where is riemann's doc for third-party libs?
19:10TimMc(I am not yet a smug riemann weenie.)
19:10wombleTimMc: I have no idea. I can't find any.
19:10technomancyyou probably don't have to, but having no idea what the debian packaging is like, that's the only way anyone is going to be able to help you.
19:11TimMcwomble: Ah, it sounded like you had identified a certain integration path and were unsure how to proceed on it.
19:12TimMcIt sounds like Riemann does everything via clients, not libraries.
19:12wombleTimMc: I'm trying to write a client, but in order to avoid having to write my own $EVERYTHING, I'm using an external library to do the heavy lifting.
19:12wombleI've actually got code that might work, if I could work out how to download the bloody package off clojars and put it $SOMEWHERE
19:13justin_smithwomble: that's what lein used
19:13justin_smith*what lein does
19:13justin_smith99% of use use lein. It builds a dependency tree, downloads the things you need, and launches the app.
19:14TimMcwomble: So it sounds like you should make a leiningen project that pulls in riemann-clojure-client as a dependency.
19:14wombleGreat. How do I do that?
19:14justin_smith$google leiningen
19:14lazybot[Leiningen] http://leiningen.org/
19:14justin_smithit's one shell script, you can put it in ~/bin
19:14TimMclein has good docs
19:18wombleSigh, I've just realised I'm in #clojure, not #riemann. Don't know how my fingers ended up here.
19:19justin_smithwomble: hah, maybe they will be more helpful :)
19:19wombleThat's what I'm hoping.
19:20justin_smithnow if you were writing your client lib in clojure, I am sure we could help with that
19:24womblejustin_smith: Thankfully, I don't need to write a lib, just a thin wrapper.
19:24justin_smithcool
19:45bitfl1pperhello all, has anyone here tried implementing the CSRF protection as described in the luminus documentation? http://www.luminusweb.net/docs/routes.md, I'm having a rough time getting it to compile, I feel like it may be predicated on a deprecated function, or maybe I'm missing something really obvious. I'm relatively noob at clojure btw
19:46justin_smithbitfl1pper: what is the error message you are getting?
19:46justin_smithno, I haven't used the CSRF stuff, but can probably help you figure out your compilation errors anyway
19:48bitfl1pper~ Caused by: java.lang.RuntimeException: Unable to resolve symbol: add-tag! in this context, i've been digging around the predicate library ring-anti-forgery middleware and I can't find the function anywhere, I'm thinking that I may not understand middleware enough? because I tried wrapping the handler as described in the newer ring-af repo
19:48clojurebotTitim gan éirí ort.
19:50bitfl1pperthanks by the way, if this doesn't work out, I'm going to try to start a little smaller and learn Ring from the ground up, because i've been struggling getting luminus to stick together, I don't think i understand the lower level stuff well enough
19:51justin_smithadd-tag! seems to be in luminus
19:52erikcwDoes anyone know how to generate a react component using Reagent that will cause React.isValidClass(component) to return true?
19:53justin_smithbitfl1pper: it's defined in selmer.parser https://github.com/yogthos/Selmer/blob/7adffc8afe23731d8629ea1bf4a003cbfdc75f90/src/selmer/parser.clj#L79
19:53justin_smithbitfl1pper: I think the rest of luminus should be pulling in the dep, you just need to use a require to make sure it is available in your namespace
19:53taliosseancorfield - how are you finding Frege?
19:54justin_smithbitfl1pper: also, I would call putting a funciton in your docs that is from another lib, and not describing where it came from, a documentation error
19:54bitfl1pperyep, thanks, it looks like the NS declaration :requires selmer.parser :as parser, but the documentation doesn't parser/add-tag! ? is that correct?
19:54justin_smithyeah, sounds about right
19:54justin_smithanyway, try parser/add-tag!
19:55justin_smithI like how excited that name makes me sound
19:55justin_smith(inc !)
19:55lazybot⇒ 1
19:55nestastubbswoot
19:55bitfl1pperjustin_smith: thanks a lot, trying now
19:56nestastubbsA clojure lib providing a distributed rate limiting service on top of redis: https://github.com/craigbro/turnstile
19:56nestastubbsonly took two beers!
19:57justin_smithcool
19:57justin_smithclojure can be way cool like that
19:57nestastubbsrate limiting was the last bit of state stopping us from running N instanced of our API service
19:58nestastubbsthe carmine dep is out of date, but...
19:59seancorfieldtalios: early days yet - but I like Haskell so I'm liking Frege
19:59seancorfieldonce I have the lein plugin built for compiling Frege I'll be able to experiment a bit more with using it for stuff inside Clojure projects
19:59taliosseancorfield - nice. I'm liking it as well, tho I need to find time to revisit it. And find something "real" to try and do with it.
20:00seancorfieldcurrently I'm working through "Real World Haskell" again but using Frege for all the examples and exercises
20:00bitfl1pperjustin_smith: well the add-tag error seems to be gone, but now I have a new one which I suspect is also caused by not declaring in ns, thanks for your help
20:00seancorfieldthere's a repo with all of the examples converted to Frege (but not the exercises!)
20:00justin_smithbitfl1pper: np, good luck sorting out the rest
20:00taliosseancorfield - yep, must revisit that repo/book as well.
20:01taliosseancorfield - will be interested to hear how you go with mixing clojure/frege - and how/why it worked better for your usecase
20:02seancorfieldYeah, I've no idea how that will pan out... but being able to mix languages will make it more likely I'll actually use Frege for something real :)
20:09bitfl1pperjustin_smith: I've got it compiling now-- probably newbie mistakes on my part -- needed to change add-tag! -> parser/add-tag! ; also, needed to add [ring.util.anti-forgery :refer [anti-forgery-field] to ns dec.
20:09justin_smithbitfl1pper: cool
20:18nestastubbshiccup users: is there a hiccup replacement that escapes content by default?
20:21amalloyyou can't really do that, nestastubbs, because then (html x) becomes different from (html (html x))
20:22amalloyand how can it even tell what pieces you want unescaped? [(keyword user-input) "s"] is just as unsafe as [:tr user-input]
20:24nestastubbsamalloy: sure you can, other languages do it all the time, and there is nothing inc lojure that stops it
20:24nestastubbsit means you have to mark strings as safe
20:25nestastubbsbe default, assume a string is not safe, you escape it and make it safe. Once marked safe, it won't be double escaped
20:26nestastubbsthere are some edges, like, how to treat concat of safe and unsafe string...
20:30justin_smithnestastubbs: sounds like something you could do with a deftype and a protocol actually
20:30justin_smithor a defmethod
20:32nestastubbsmight be more complicated than that, but tractable
20:32nestastubbswould want concatenation to make the end result unsafe, or escape the unsafe elements..
20:33nestastubbsbut that is not essential
20:39nathan7bbloom: I think MonadPlus might be a semigroup
20:42nathan7bbloom: hmm, no, nevermind
20:50amalloywow, are we back on MonadPlus again?
20:50nathan7I was trying to figure out what mathematical structure it describes
20:50nathan7and these things stick around in one's subconscious
20:52amalloyi mean, the haskell Monad typeclass is, as i understand it, pretty far from the mathematical idea of monads, even though that's what it was originally inspired by. it's not always the case that you can find a useful correspondence
20:57bbloom,(clojure.lang.Compiler/demunge 'WOW_CONFUSING)
20:57clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.String>
20:57bbloom,(clojure.lang.Compiler/demunge "WOW_CONFUSING")
20:57clojurebot"WOW-CONFUSING"
20:58TEttinger,(clojure.lang.Compiler/demunge "_-_-_-_")
20:58clojurebot"-------"
20:58bbloomi often name something LIKE_THIS as a temporary name while i tried to come up with something better
20:59bbloomcouldn't find it w/ grep when i got an ArityException b/c it was LIKE-THIS
21:01TEttinger,(clojure.lang.Compiler/demunge "_-_-_-_")
21:01clojurebot"-------"
21:02nonubyusing tools.cli how do I specify a required option, removing :default seems to just omit that key from :options rather than populating :errors
21:02TEttinger,(= (clojure.lang.Compiler/demunge "_-_-_-_") "-------")
21:02clojurebotfalse
21:02nonubythen again I guess options should be just that.. hmm
21:02nonubyi.e. optional
21:10nonubyis something better than tools.cli that also merge environment variables (ala 12 factor) before apply cli options, and produces a similar map
21:22arrdem&(demunge "_-_")
21:22lazybotjava.lang.RuntimeException: Unable to resolve symbol: demunge in this context
21:22arrdeminteresting
21:26justin_smithamalloy: redid that pr, sorry that was such a mess, it was the last thing I did that night and I did not even think to check if it applied cleanly
21:27justin_smiththe funniest was one of the plugins where head had nothing and master had like 8 newlines, and that was the entirety of the merge conflict
21:29vermadoes anyone know how :foreign-libs works when building cljs projects? it seems I can supply a URL, but that always fails for me with a Not a file error.
21:32TEttinger,(= "_-_-_-_" "_-_-_-_")
21:32clojurebotfalse
21:32TEttingerthis is a fun trick
21:33TEttinger,(map count ["_-_-_-_" "_-_-_-_"])
21:33clojurebot(8 7)
21:34justin_smith,(map #(map int %) ["_-_-_-_" "_-_-_-_"])
21:34clojurebot((95 45 95 45 65279 ...) (95 45 95 45 95 ...))
21:34justin_smith🎵one of these things is not like the others🎵🎵
21:35TEttinger,"(clojure.lang.Compiler/demunge \"_-_-\ufeff_-_\")"
21:35clojurebot"(clojure.lang.Compiler/demunge \"_-_-_-_\")"
22:03jeffterrellTEttinger: What is that? A nonprinting character?
22:03TEttingeryes
22:03TEttingerit's also a legitimate character in clojure identifiers
22:06jeffterrellCrazy. TIL…
22:12justin_smith,(def  22)
22:12clojurebot#'sandbox/
22:12justin_smith,
22:12clojurebot22
22:12justin_smiththat is pretty evil
22:41ghadishaybantransducers on Java Iterators https://gist.github.com/ghadishayban/ed64040c9c7de4b4663c
22:42ghadishaybanwhy not right?
22:43TEttingerawesome ghadishayban
22:46ghadishaybanthe horrors!
22:47nonubygiven a fn: (defn x [& {:keys [a b c] }] {:a2 a :b2 b :c2 c}) and given (def v1 {:a 1 :b 2 :c 3}) how can I call x with v1 without extracting each parameter?
22:47justin_smith,(+   )
22:47clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol:  in this context, compiling:(NO_SOURCE_PATH:0:0)>
22:47justin_smith,(def  22)
22:47clojurebot#'sandbox/
22:47justin_smith,(+   )
22:47clojurebot44
22:48justin_smith,(apply (fn x [& {:keys [a b c] }] {:a2 a :b2 b :c2 c}) (apply concat {:a 1 :b 2 :c 3})); nonuby
22:48clojurebot{:a2 1, :b2 2, :c2 3}
22:48justin_smithand yeah, that is clumsy and & {} is bad
22:50nonubythanks justin_smith, that makes sense, I can see how it works now, yeah I agree it smells but a lot of libraries use it
22:50justin_smithright
22:59bbloomis it just me, or does anyone else find infix notation less and less familiar as time goes on?
23:00ghadishaybannot just you
23:00justin_smithI get messed up when people use parens / braces weird - like on the line closes in an algol, or on their own line in a lisp
23:01justin_smithotherwise I can mostly handle the switch
23:01bbloomdo you guys also experience constant operator precedence anxiety?
23:01jeffterrellbbloom: In general yes, but I still have to stop and think about how prefix - and / work, e.g. (/ 8 4 2).
23:01bbloomi start to twitch and feel like i need a lot more parens
23:01justin_smithlike somehow the gestalt of trailing } tells my reptile brain "infix"
23:02bbloom,(-)
23:02clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core/->
23:02bbloom,(- 1)
23:02clojurebot-1
23:02bbloom,(- 1 2)
23:02clojurebot-1
23:02bbloom,(- 1 5)
23:02clojurebot-4
23:02justin_smith,(-)
23:02clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: - in this context, compiling:(NO_SOURCE_PATH:0:0)>
23:02justin_smith,(- )
23:02clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: - in this context, compiling:(NO_SOURCE_PATH:0:0)>
23:03justin_smith,(- )
23:03clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: - in this context, compiling:(NO_SOURCE_PATH:0:0)>
23:03ghadishaybanis it unicode day in here?
23:03justin_smith,(-  )
23:03clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol:  in this context, compiling:(NO_SOURCE_PATH:0:0)>
23:03justin_smithfinally
23:03justin_smithghadishayban: TEttinger was showing that off, and I found it amusing
23:03justin_smith,(def  22)
23:03clojurebot#'sandbox/
23:03justin_smith,(-  )
23:03clojurebot-22
23:03bbloom,(- 3 7 9)
23:03clojurebot-13
23:04bbloomdoes feel a tad strange
23:04bbloom,(/)
23:04clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core//>
23:04bbloom,(/ 5)
23:04clojurebot1/5
23:04bbloom,(/ 5 10)
23:04clojurebot1/2
23:04bbloom,(/ 5 10 15)
23:04clojurebot1/30
23:04jeffterrellWhoa, didn't know about single-arity /
23:04bbloomyeah, reciprocal
23:05jeffterrellExcept now I no longer trust what I see, thanks a lot justin_smith and TEttinger.
23:05ghadishaybanall i want for christmas is a bunch of reducible collection sources...
23:05ghadishayban... that all respect reduced properly
23:06bbloomreally - and / are very strange symbols for prefix
23:06bbloomb/c `x - y` is really `x + -y`
23:06bbloomsimilarly `x / y` is really `x * y^-1`
23:07jeffterrellbbloom: Yeah, haven't thought deeply about why, but there's definitely some impedance mismatch going on there, at least in my brain.
23:08bbloomjeffterrell: yeah, it's b/c subtraction and division are derived concepts built on top of negation, addition, multiplication, and exponentiation
23:09jeffterrellI never thought about subtraction and division as derived that way, but I think that would explain why they feel weird with infix. Neat.
23:11bbloomit's weird, b/c some times i feel the need for infix, but it's never for like + or *
23:11maarekThis is pretty basic I think but what is the "-" before a function? Sometimes it's there and sometimes not and it's not easy to search for.
23:11bbloomit's when i actually care about spatial relationships
23:11bbloommaarek: - is a valid symbol, so you can type:
23:11bbloom(doc -)
23:11clojurebot"([x] [x y] [x y & more]); If no ys are supplied, returns the negation of x, else subtracts the ys from x and returns the result. Does not auto-promote longs, will throw on overflow. See also: -'"
23:12maarekbbloom: Okay I'll check it. Thanks.
23:15maarekbbloom: Hmm but on a function definition (defn -someMethod [] somethingElse)… how does negation work there?
23:16bbloommaarek: lisp's tokenization rules are much simpler than most languages. that's one symbol: "-someMethod", not two symbols "-" and "someMethod"
23:16bbloomwatch:
23:16bbloom,(count '[ -someMethod ])
23:16clojurebot1
23:16bbloom,(count '[ - someMethod ])
23:16clojurebot2
23:17bbloom,(map class '[ - someMethod ])
23:17clojurebot(clojure.lang.Symbol clojure.lang.Symbol)
23:17justin_smitheven more commonly seen as ##(count '[some-method])
23:17lazybot⇒ 1
23:18amalloymaarek: -foo is sometimes used to mean "an implementation detail of how foo is built" or "a protocol function underlying the public function foo". as justin_smith and bbloom say, there's nothing inherently special about - in a name, but -foo is a convention
23:19maarekamalloy: I have been seeing it on an implementation of java interfaces.
23:20TEttinger,(def1)
23:20clojurebot#'sandbox/
23:20TEttingerjustin_smith: ^
23:20maarekThanks guys
23:20justin_smithmaarek: yeah, that is a default translation when you use :gen-class
23:21TEttinger,(-  )
23:21justin_smithso -main because the method main, etc.
23:21clojurebot-1
23:21justin_smith*becomes
23:22justin_smithI keep doing semi-phonetic typos today
23:22maarek:prefix "-" is default in gen-class then?
23:23maarekIt all makes sense then. Whew, nothing magical.
23:23justin_smith maarek: yeah, if you look at (doc gen-class) it is in there
23:23justin_smithmaarek: we work pretty hard to avoid magic
23:24maarekjustin_smith: Yeah I just pulled it up. Thanks
23:24TEttingeryay, now we can imitate APL
23:24TEttinger,(#(`[~@%](`[~@%&](+)))[:?:|:>:<](+(*)(*)))
23:24clojurebot:>
23:25TEttingerjustin_smith: speak for yourself, swearjure is magic