#clojure logs

2014-04-06

00:00arrdemI suppose I can approximate a circle really well with an inscribed 64-gon but still.
00:00arrdem$seen sjofra
00:00lazybotI have never seen sjofra.
00:06mercwithamouthstarting to really like lisp =P i think i'll stick with it for a while
00:08arrdemreally... this guy didn't deploy his F/OSS Clojure project to Clojars..
00:08arrdemfine...
00:08jph-yeh, i get annoyed by that
00:08jph-and feel a bit awkward deploying my own
00:09arrdemI mean the guy's been inactive for four months... I could open a "deploy to clojars you fool" issue and see what happens...
00:09nightflydo that
00:10kenrestivono harm in asking.
00:11arrdemeh I mean I could pull it down and package it myself then PR it in the same time...
00:18arrdemwoah what the shit...
00:23miseria"un buscador, no es el que sabe lo que busca, un buscador es quien descubre que la vida, es una continua busqueda" bienvenidos: http://castroruben.com *temo_a_un_ser_sin_rival*
00:24arrdemsecond spambot in two days.. we must be popular :P
00:26myguidingstarsomebody please help implement this Java thing in Clojure. I tried but can't get Java
00:26myguidingstarhttps://gist.github.com/myguidingstar/27c6a1511fab4c5b2575
00:26myguidingstar(it's very short)
00:33ambrosebsmyguidingstar: see deftype
00:34myguidingstarambrosebs, do I have to import something to use an interface?
00:35ambrosebsmyguidingstar: you don't need to load anything, but you can use import/:import to abbreviate the interface name
00:35ambrosebsvia the ns macro
00:37myguidingstar(in my pure Clojure brain they look like undefined symbols)
00:37myguidingstarbtw, in `public TemplateModel exec` so what do I do with `TemplateModel`?
00:39ambrosebsmyguidingstar: I can't remember. It might work without type annotations, otherwise you might need something like gen-class.
00:39ambrosebstry something like: TemplateModel (exec [this args] ...)
00:40myguidingstarthanks, let me see
00:41gtrakin core.async, do taps close their passed-in channel?
00:42gtrakdocs say they close if the channel closes, but I want the reverse.
00:44gtrakhrm..
00:44gtraklooks like no
00:45gtrakexcept in my case, maybe it'll get GC'd
00:47amalloyambrosebs: the return types for interfaces are inferred by name
01:06gfredericksamalloy: yeah, I started with the loop and then pulled it out because emitting was just as easy and less nested
01:06gfredericksand ~@ is easier than concat
02:03dissipatewhat is the best unit testing framework for clojure? is it midje?
02:26Raynesdissipate: It's whatever your favorite is.
02:32arrdemRaynes: dat cop out tho
02:32RaynesHis question is fundamentally unanswerable.
02:33RaynesThere are a variety of libraries throughout the Clojure ecosystem providing solutions for more or less any sort of testing methodology or combinations thereof that one could ever ask for.
02:33dissipateRaynes, i'm asking for opinions. :P
02:33RaynesAimed at different people, these libraries do not deserve to be compared.
02:37trap_exitin cljs, what is the inverse of clojure.edn/parse-string ?
02:37trap_exiti.e. I have a data structure, and I want to string-encode it via edn
02:51maxthoursietrap_exit: can't you use pr-str?
03:14trap_exitmaxthoursie: yes, pr-str works
03:14maxthoursiegreat
03:45vimuser2For recur, im a bit confused why you can do something like (loop [] (let [] recur)) but not (loop [] #(recur)) . I thought let just expands to a anonymous function anyway?
03:45vimuser2(above isn't valid lsip, was just focusing on order of function calls)
03:53mercwithamouthvimuser2: i'm fairly new to clojure and most likely wrong but wouldn't #(recur) screw up the scope?
03:54mercwithamouthyou're putting it inside of a function thats not actually called or hit...
04:04vimuser2mercwithamouth: yeah, meant to say something like (#(recur .. ))
04:05dissipatewhat is going on with this error? Exception in thread "main" java.lang.RuntimeException: No such var: leiningen.util.injected/add-hook, compiling:(NO_SOURCE_PATH:1)
04:05dissipateall i did was 'lein new my-project' and then 'cd my-project' and 'lein test'
04:23dissipatenevermind, i found out my version of leiningen was out of date
05:14ggherdov_hi, for my program I need an HTTP client library. What would be the go-to choice?
05:36scottjggherdov_: clj-http
05:57ptcekany way to get namespace part of keyword/symbol (as `name` gets the, ehm, name)?
05:59ptcek,(namespace :ns/name)
05:59clojurebot"ns"
05:59ptcekso obvious... :)
08:47mercwithamouth(->> (range 10)(map inc)(interpose 5)(reduce +))
08:47mercwithamouth,(->> (range 10)(map inc)(interpose 5)(reduce +))
08:47clojurebot100
08:47mercwithamouthok why does that work here but i get an illegalstateexception error in my repl?! =(
08:50mercwithamouth,(->> (range 10)(map inc)(interpose 5))
08:50clojurebot(1 5 2 5 3 ...)
09:00ivanmercwithamouth: can you paste your error?
09:02ToxicFrogmercwithamouth: works for me.
09:11mercwithamouthivan: IllegalStateException Attempting to call unbound fn: #'user/inc clojure.lang.Var$Unbound.throwArity (Var.java:43)
09:19mercwithamouthok weird i restarted my repl, now it works
09:28staindid you accitdentally def 'inc' perhaps?
09:43gfredericks,(def inc dec)
09:43clojurebot#<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)>
12:52hitekihi
13:21vimuser2Is there a built in function for applying a function to each element in a seq?
13:22vimuser2as in, given f, and a [1 2 3], then (f 1) (f 2) (f 3) will be called. I don't care about the output (doing side effect stuff)
13:22ambrosebsvimuser2: (doall (map f coll))
13:22vimuser2i could technically use reduce and just keep returning ni
13:23ambrosebsor dorun, doseq
13:23ambrosebssee the docs for the differences
13:23vimuser2ah thanks
13:23bbloomwould be nice to have clojure.core/each, *shrug* oh well
13:29zakwilsonI'm trying to use sensors on Android, and the Java documentation for that involves casting a SystemSensorManager to a SensorManager, but when I call (cast SensorManager the-SystemSensorManager), the object returned is still a SystemSensorManager, which does not define the registerListener method and therefore crashes at runtime.
13:29bbloomtbaldridge: spotted effect_lisp -- glad to see you're experimenting too :-)
13:49yotsovzakwilson: SystemSensorManager extends SensorManager, so it looks like you are trying to upcast, which cannot have the benefit of exposing more methods
13:51AmandaCzakwilson: where are you getting a SystemSensorManager from?
13:52AmandaCzakwilson: because there’s no such class that I can find.
14:29dissipatehow the hell do you do a simple 'find and replace' in light table
14:33`szxdissipate: cmd+f?
14:34`szxcmd+shift+f for for multiple files
14:36dissipate`szx, that's find what about replace?
14:36`szxdissipate: it's both - left field is find, right field is replace
14:36dissipate0
14:37dissipate`szx, i see, thanks
14:37`szxUI could be better, i agree
14:43zakwilsonAmandaC: (.getSystemService ^Activity a "sensor") returns a SystemSensorManager. The class is not documented in the Android docs.
14:43AmandaCzakwilson: ah, I see.
14:44AmandaCzakwilson: and it doesn’t function the same?
14:44zakwilsonyotsov: what you say sounds right to me, but I get "No matching method found: registerListener for class android.hardware.SystemSensorManager" at runtime. Wait... it could do that if I supplied incorrect arguments too.
14:45zakwilsonAmandaC: I'm not sure. The Java example code includes the cast. I'm exploring the possibility that I'm calling it wrong.
14:46zakwilsonIt really doesn't look like I am though.
14:46AmandaCzakwilson: the Java Exampple Code includes the cast because getSystemService returns an Object, IIRC
14:50miseria"el deseo de vivir un millon de años, me obligan a buscar y matar la muerte, antes que ella me convierta en calavera" bienvenidos: http://castroruben.com *temo_a_un_ser_sin_rival*
14:52zakwilsonAmandaC: that makes sense, now that I think about it.
15:05yediis there a function that does (first (filter fn coll)) more tersely?
15:06yedisome
15:06hyPiRionyedi: some does something else in the general case
15:06bbloomif you're binding a name to the result, you can leverage destructuring:
15:07bbloom,(let [[x] (filter pos? [0 -1 2 1 0])] x)
15:07clojurebot2
15:07yedihyPiRion: how so? is it not always the first element?
15:08bbloom(doc some)
15:08clojurebot"([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
15:08hyPiRionyedi: ##((juxt (comp first filter) some) pos? [0 -1 2 1 0])
15:08lazybot⇒ [2 true]
15:08yedioh, i see
15:08bbloom(inc juxt)
15:09lazybot⇒ 7
15:37Averellas long as it's not one of the 4clojure juxt exercises :)
15:39DomKMIs there a way to write to a java.io.BufferedWriter without reflection?
15:39DomKM(with-open [^java.io.BufferedWriter wrtr (clojure.java.io/writer path)] (.write wrtr "string"))) uses reflection
15:42cliftonhi, i have a proprietary jar file launches a swing interface. is there a good way to use leiningen to have that jar file included in the classpath when i launch the repl?
15:43cliftonim trying to programatically manipulate the interface (seesaw looks nice) and do not have access to the source code
15:43hiredmanDomKM: what makes you think it uses reflection?
15:43DomKMhiredman: I get a reflection warning
15:44hiredmanDomKM: with that actual code, or is that a simplified example?
15:45DomKMhiredman: it's a simplified example
15:45hiredmanDomKM: do you actually get a reflection warning with it?
15:45hiredman(I don't think you will, so I don't think it is a good simplified example)
15:47DomKMhiredman: you're right, I didn't
15:48DomKMhiredman: I needed to replace "string" with (cheshire.core/encode {}) to get a warning
15:48hiredman^String (cheshire.core/encode {})
15:49hiredmanor I believe cheshire has functions for encoding directly to streams
15:49DomKMhiredman: perfect, thanks :)
15:49hiredmanhttps://github.com/dakrone/cheshire/blob/master/src/cheshire/core.clj#L36
15:49noprompt$seen Raynes
15:49lazybotRaynes was last seen talking on #clojure 13 hours and 16 minutes ago.
15:50Raynessup
15:50noprompthey cool, you're here.
15:51nopromptcould lein-pdo be tweaked to tag output from tasks? ex. lein pdo a, b would do something like
15:51noprompt[a] STDOUT from a
15:52noprompt[b] STDOUT from b
15:52Raynesnoprompt: ship it
15:52nopromptRaynes: so it's possible?
15:53RaynesI highly doubt it.
15:53RaynesBut I also haven't looked at that plugin since the 5 minutes it took me to write it.
15:53nopromptthat's what i thought.
15:53Raynesnoprompt: I mean, it might be possible.
15:54Raynesnoprompt: You could perhaps rebind *out* to intercept prints.
15:54RaynesEach task execution is just a function call, so presumably (binding ..) would apply.
15:54nopromptRaynes: i'll give it a shot. i ended up handrolling something at work before i knew about lein-pdo.
15:55pandeiroanyone know a strategy for swapping out URLs in a cljs app meant for a service-oriented architecture where development and production URLs are different?
15:55nopromptpandeiro: you can use enlive to do that.
15:55hyPiRionnoprompt: just ensure you perform a locking on the original *out* value, otherwise you end up with possibly interleaved prints
15:55pandeironoprompt: i will use enlive for the html part, yeah
15:55pandeirobut i am talking about within the cljs app
15:55nopromptpandeiro: at work we have a build process that compiles new html files for production apps after we push new builds to s3.
15:56pandeironoprompt: cool yeah html problem is resolved for me
15:56pandeiroenlive is perfect for that
15:56michaniskindoes doing (def thing (future ...)) not make sense for some reason? i'm having trouble compiling a namespace that assigns a var like that (compiling seems to take forever)
15:56pandeirobut within my cljs app i have a lot of xhr to do
15:57nopromptpandeiro: ah ok. well, you could write a macro that reads something from the environment etc. and handle it there.
15:57pandeironoprompt: ah ok so at macro-expansion time, interesting
15:57nopromptpandeiro: since cljs macros are expanded in clojure you could pretty much do whatever you want.
15:57pandeirosure, that's the path then
15:57pandeirothanks
15:58nopromptpandeiro: the idea is similar to this https://gist.github.com/noprompt/9086232
15:58pandeiroah but how do i determine in the macro if it's a dev or prod build?
15:58nopromptpandeiro: probably do something like ENV=production lein cljsbuild ...
15:58pandeiroyep, ok
16:00andyf_Bronsa: ping
16:00noprompthyPiRion: how do i do that?
16:02Raynesnoprompt: If you need assistance let me know and I'll be as useless as ever.
16:02Raynes:D
16:02nopromptlol
16:03noprompti don't mind the output being interleaved, i just want it tagged so i know where it's coming from.
16:03hyPiRionnoprompt: interleaved as in `lein pdo shell echo 111, shell echo 222` may print out '11222\n1'
16:04nopromptyeah that's fine. i'd like to see
16:05noprompt[shell echo 111] 111
16:05noprompt[shell echo 222] 222
16:05hyPiRionexactly, which means you probably don't want to see `[shell echo 111] 11[shell echo 222] 2221`
16:05nopromptoh wait but i see what you mean.
16:06hyPiRionI think it should be sufficient to reify some interface, then do `(locking original-out (. call original-out with-args))` on every fn.
16:07hyPiRionWriter, probably.
16:08hyPiRionOnly thing is that you'd likely want to gobble data until you hit a newline or EOF, then print a line. That may be a bit more complicated.
16:08Bronsaandyf_: pong
16:09nopromptgotcha
16:09andyf_Still as busy as ever fixing tools.analyzer(.jvm) bugs, I see (and thank you)
16:09nopromptalright i'm gonna dig in to this and see what i come up with.
16:09andyf_I was curious whether there was a relatively short set of rules I could use in Eastwood to warn about badly placed :tag metadata
16:10Bronsaandyf_: eh, I have a list of bugs to solve that I discovered a couple of days ago but I'm too tired to fix them now
16:10andyf_I don't have such a set of rules in my head yet, and was hoping you could help me bypass a big chunk of guessing, experimentation, and reading code, if you had such knowledge ready at hand.
16:11Bronsaandyf_: the only place where I saw people put metadata where it actually isn't doing what they think it's doing is in def symbols
16:11andyf_Do you know of any good reasons to put tag metadata on symbols being def'd?
16:12andyf_i.e. does the compiler itself ever pay attention to it there?
16:12Bronsaandyf_: maybe, I don't remember, let me check
16:13andyf_So the short rule might look something like (def ^nothere myfn ^ret-tag-here [^arg1tag arg1 ^arg2tag arg2 ...] fn-body)
16:14andyf_Oops, that should be defn, not def
16:14ztellmananyone on here who knows core.async well?
16:14ztellmanhave a question about 'alt'
16:15andyf_and more generally (defn ^nothere myfn (^rettype1 [^arg1tag arg1] body-for-1arg) (^rettype2 [^arg1tag arg1 ^arg2tag arg2] body-for-2-args))
16:15Bronsaandyf_: actually the compiler uses tag attached on Vars too
16:15Bronsaandyf_: the only issue really is if you're tagging primitives
16:16Bronsait works fine for objects
16:16andyf_So those code snippets I showed are what should be used for primitive type tags, and the only ones supported are ^long and ^double ?
16:16Bronsayeah
16:16S3thc0nHello everyone, I spent the last few weeks pondering the very basics of programming languages and wondered: How (except for forward reference) would a global let differ from using defs? Since (IMHO) everything should be an expression and not a statement I think this would be cleaner. But the problem of other libraries / namespaces with their own let arises, as well as accessing declared
16:16S3thc0nvalues/functions from outside (a REPL for example). What do you think?
16:16Bronsaif you tag with a primitive tag the Var rather than the arglist there are going to be two problems
16:17andyf_And if they are non-primitive tags, they will work in the same places as for primitive ones, but a non-primitive tag on a Var "works the same way" as if it is on the arg vector?
16:17Bronsa- the Var meta is going to be evaluated so you'll get :tag #<the-primitive-function> instead of the tag
16:18andyf_Yeah, I've seen that case plenty of times now
16:18Bronsa- even if you quote the tag, the compiler will not optimize the function with a prim interface for the return type
16:19Bronsae.g. (defn ^{:tag 'long} x [^long a] a) will make x a IFn$LO rather than IFn$LL
16:19Bronsaso you get boxing on the return type
16:20Bronsaif you do (defn x ^long [^long a] a) however you get what you'd expect
16:21andyf_And non-primitive type tags are only used for avoiding reflection in Java interop calls, either in the function body for type tags on args, or wherever the function return value is used for the return type tag?
16:21Bronsaandyf_: yes
16:22Bronsawell, and to hint at the correct method too
16:22andyf_OK, I think I'm down to 1 question, and then I go off to experiment with these variations for my own confirmation: A non-primitive tag on the Var, or on the arg vector, work the same way, or nearly so?
16:23Bronsasay you have a class A which implements B and C, and you have a method foo that takes a B or a C, a type hint to B in a function that returns an A makes a call to foo resolve to the call to foo(B)
16:24Bronsaandyf_: that should be correct, I can't think of a case where that would be false
16:25andyf_So it sounds like the main cases where it would help if Eastwood gave warnings are for attempted primitive tags that are neither long nor double, anywhere they appear, or for ^long or ^double on Vars.
16:25Bronsaandyf_: well
16:26andyf_Oh, I guess ^int and such are still useful in a Java interop call?
16:26Bronsaright
16:26BronsaI was just going to say that
16:26andyf_Are primitive hints ever used in a let or loop binding?
16:27Bronsaandyf_: you can do that
16:28andyf_By which I mean a code snippet like (let [^double x 0.0] let-body)
16:28amalloycan you? i think you have to write (let [x (double 0.0)] body)
16:28amalloyor, well, 0.0 is a double literal, so you don't have to. but like (long 0)
16:28Bronsayou can't do that specifically, but I believe you can do (let [^double x (something)] ..)
16:32Bronsaamalloy: looks like you can indeed
16:32yedianyone know what this might mean? compiling cljs: Caused by: java.lang.IllegalStateException: Nested #()s are not allowed
16:33Bronsaamalloy: (fn [] (let [^int a (Integer. 1)] (clojure.lang.RT/box a))) compiles to http://sprunge.us/OBjJ
16:33Bronsawhile (fn [] (let [a (Integer. 1)] (clojure.lang.RT/box a))) compiles to http://sprunge.us/LQag
16:33yedii'm not getting a line number in the stack trace or anything so debugging that is proving to be a lil difficult
16:34amalloyyedi: #(foo #(bar))
16:35yediah found it
16:35yedithanks amalloy
17:06yediin om/react, does rerendering not detect changes in styles?
17:07S3thc0nHello everyone, I spent the last few weeks pondering the very basics of programming languages and wondered: How (except for forward reference) would a global let differ from using defs? Since (IMHO) everything should be an expression and not a statement I think this would be cleaner. But the problem of other libraries / namespaces with their own let arises, as well as accessing declared
17:07S3thc0nvalues/functions from outside (a REPL for example). What do you think?
17:07yedii have it so that i change the color of some spans, however when i rerender the new colors don't show and the old color still remains
17:08yedii'm assuming it's because the diffing algo doesn't detect differences within the style attribute?
17:08yediatleast that's what it looks like..
17:09gfrederi`S3thc0n: clojure's defs are very much not like a let
17:10gfredericksone of the things clojure's design accomplishes is that entering code at the repl is almost exactly the same as having it in a file that's loaded
17:11gfredericksI think your ideas would make that relationship a lot more complex; would also have to figure out what code-reloading means, if it even makes sense
17:15hiredmanlisp is small pieces has a good section on different strategies for top-level environments
17:15hiredmanlisp in small pieces
17:31yediin om: are you allowed to om/transact! cursors in (will-mount) ?
17:31yedimy cursor is showing up as nil
17:32cliftonanyone here familiar with seesaw?
17:32yedihowever it seems to works after some specific state changes
17:35yediheh, used (om/get-props owner) instead of the cursor passed to the component and it seemed to work
17:37gtrakyedi: has it clicked for you yet? I'm still figuring it out as I go along.
17:37yedigtrak: i'm slowly figuring things out
17:37gtrakmaybe I'll make another pass at react docs once I've built the thing I'm trying to build.
17:38gtraktime-pressure sucks :-)
17:38yedii've spent quite sometime grappling with some silly gotchas but i figure after this initial foray into om things'll go a lot more smoothly
17:39`szxyedi: gtrak: do you guys use sablono/kioo or just straight up om?
17:39`szxjust wondering
17:39gtraksablono's nice but it adds yet another layer. been using it. yea.
17:39yedii'm using straight up om
17:39yedii may switch to sablono once im more familiar with om
17:39`szxyedi: yeah, i think i might do that as well
17:39`szxno time pressure here :)
17:40yedi`szx: likewise, we're lucky
17:40gtrakI made a single component that worked, but it got way too tedious to use om dom once I started worrying about styling.
17:40gtrakthey compose though
17:41`szxgtrak: how does sablono help the styling issue?
17:41yediwhats weird is i know that much of the stuff ive done in om so far id be able to do way faster in an imperative jquery style
17:41gtrakjust easier to see stuff at a glance, it's more terse and regular.
17:42yedibut one thing i noticed is that as the app's complexity increases, the spaghetti-ness of my code doesn't
17:42yediit's relatively simple to add new functionality with core.async and om
17:42`szxyeah, with jquery you invariably end up with spaghetti in my experience
17:43whodidthishow do i set value = something; in clojurescript
17:43yedi(let [value something] value)
17:43whodidthisto a javascript variable
17:43michaniskinwhodidthis: (set! (.-value js/window) something)
17:44gtrak`szx: it was getting unwieldy: https://gist.github.com/gtrak/10011760
17:44whodidthissweet, thanks
17:44michaniskinwhodidthis: (aset js/window "value" something)
17:44michaniskinthat's like window["value"] = something;
17:46gtrak`szx: the data parts and the code parts just feel different and are easy to pick out visually, I feel like om/dom stuff just has more mental overhead, and I'm not super familiar with hiccup.
17:46`szxgtrak: yeah, this look nice and clean
17:46`szx*looks
17:49noprompthyPiRion: i don't think i understand what's happening here: https://gist.github.com/noprompt/b2893da6dd4fb6551874
17:49noprompthyPiRion: i'd expect to see [foo] bar
17:52hyPiRionnoprompt: so apparently writer is probably not what you'd like to use
17:52noprompthyPiRion: well it works fine for plain old print but not println
17:53noprompthyPiRion: what would your recommend instead? i haven't ventured in to these parts of clojure before.
17:54michaniskinnoprompt: maybe java.io.PrintWriter?
17:55hyPiRionnoprompt: Well, I guess a writer could work, but you just need to know where a line starts and another ends
17:57pandeiromichaniskin: how is hoplon/boot coming along?
17:57hyPiRionnoprompt: so essentially, you'll have to buffer the write calls, and whenever you see a newline or somebody closes the writer, you print the current buffer with the prefix
17:58michaniskinpandeiro: we're plugging away, planningthe future of boot next week.
17:59pandeiromichaniskin: i need to take a look, it's been a while... been teaching and writing too much to program over the last several months (eternity in open source time ;)
18:00cddrIs it possible to deploy to clojars after a successfull travis build? I
18:00cddr see that travis has "secure environment variables". Is there a way to
18:00cddr get lein deploy to get the input it needs from these?
18:00michaniskinpandeiro: you're welcome to join us, check out the topic in #hoplon for the schedule
18:01bob2_cddr, if you can write them to ~/.lein/credentials.clj sure
18:05nopromptsorry
18:05pandeiromichaniskin: awesome, filled out the poll and hope i can be there
18:05nopromptsorry, had to step a way for a second.
18:06nopromptmichaniskin: i'm proxying java.io.PrintWriter. did you see the gist?
18:06haolehow do I map over a set of hashmaps? I want my function to be applied to each hash, and not have clojure apply it to the set of first items, then seconds and etc
18:07bob2haole, isn't that already how it works?
18:07haolebob2: not quite... for example: I'd like (def hs {:a 1 :b 2 :c 3}) (map #(print %) hs) to be equivalent to (print hs)
18:08haolebut I get ([:b 2][:c 3][:a 1])
18:09arrdemhaole: what are you trying to do with this behavior?
18:09arrdemhaole: the example you give is an artifact of clojure core semantics.. you aren't going to change that.
18:10michaniskinnoprompt: sorry, ignore my comment; it was nonsense
18:10haolearrdem: my data structure right now is a hash-map in a given format and I'd like to iterate over hashmaps
18:10haoleand not their key-value pairs
18:11arrdemunclear. give me an IO case.
18:11cddrBut hs seems like a single hashmap to me
18:11cddrWouldn't (map #(print %) [hs]) do what you want?
18:11haolecddr: yes, it is, but I'd like to use a set of hashmaps
18:11michaniskin,(map #(pr-str %) #{ {:a 1 :b 2} {:c 3 :d 4} })
18:11clojurebot("{:c 3, :d 4}" "{:b 2, :a 1}")
18:12arrdemhaole: you could do (map my-fn (juxt :key1 :key2 :key3))
18:12haolecddr: hmmm maybe
18:12michaniskinhaole: that's a set of hash-maps
18:12arrdemhaole: or you could map over (vals)..
18:12haoleha! that's what I want: (map fn [hs])
18:12haole:D
18:12arrdemwat.
18:12arrdemthat's exactly (fn hs).
18:13haoleI'm using Clojure with the basic concepts first... I'll evolve into proper data structures as I get familiar with the language
18:13haolearrdem: (map fn [hs]) makes fn be called in each hs and not the k-v pairs
18:14haoleI hope I'm making sense :D
18:14nopromptmichaniskin: cool. i just have no idea why i'm getting the extra "[foo]" at the end of the string. regular print works just fine.
18:14haoleand I hope that I'm not using Clojure in an awkward way
18:14nopromptoh i think i see now
18:14bjorkintoshas long as you don't write fortran in it!
18:15haolewow, wait... juxt replaces most of the logic I've written for my function
18:15haoledamn! gonna use that instead :D
18:15cddrhoole: lol :D
18:16haoleI have a set of functions that I have to apply in a set of hashes
18:16haoleI was doing something like: (map #(% hs) set-of-funcs)
18:16haolelooks like juxt to me now
18:16nopromptit's (newline)
18:16noprompti didn't implement append
18:17michaniskincomp, juxt, partial, apply, the solution to all of life's problems
18:18dpathakjDoes anyone know a good way to get access to a list containing vars bound via destructuring with :keys?
18:18michaniskindpathakj: are you writing a macro?
18:18dpathakjNaively, something like ((fn [{:keys [a b] :as k}] k) {:a 1 :b 2}) but with ':as k' inside the vector [:a :b]
18:18haolemichaniskin: I'm already using partial without even thinking about it... the others will come with time and practice :)
18:19dpathakjNope, just runtime shenanigans. It's not really important because the application I'm thinking of has only two keys.
18:19dpathakjI'm aware that as written, (vals k) works.
18:22dpathakjI think what I was thinking of probably doesn't exist since the docs on destructuring would mention it.
18:22dpathakjWondered if anyone here would see something I missed.
18:23michaniskindpathakj: your anon fn is basically the identity function with the exception that it'll throw an exception if you call it with something that isn't associative?
18:25nopromptmichaniskin, hyPiRion: this seems to work just fine https://gist.github.com/noprompt/b2893da6dd4fb6551874
18:25dpathakjDon't think so.
18:25dpathakj,((fn [{:keys [a b] :as k}] k) 1)
18:25clojurebot1
18:26nopromptRaynes: i guess we can tag the output then.
18:27arrdem$seen tbaldridge
18:27lazybottbaldridge was last seen joining on clojure-social 19 hours and 50 minutes ago.
18:28arrdemdamnit lazybot y u ping
18:34haoleif I want to apply a function in a value or in a set of values, how do I do it in a simple way? currently, I'm ussing (flatten (list my-value)) before applying map to it
18:34arrdem~flatten
18:34arrdemclojurebot: are you still sleeping in the job...
18:36haoleI want to filter, for example, 1 to (1) and (1 2 3) to (1 2 3)
18:36hyPiRionnoprompt: might work for your case, but may also mangle output
18:36haole(flatten (list ...)) seems to work but it smells bad :D
18:37michaniskin,(flatten (list {:a [1 2 3]}))
18:37clojurebot({:a [1 2 3]})
18:38michaniskin,(flatten (list [:a [1 2 3]]))
18:38clojurebot(:a 1 2 3)
18:38bob2haole, can you change the api to not require that?
18:38haole,(flatten 1)
18:38clojurebot()
18:38haoleheh
18:38bob2consistent types will make things easier to implement and understand, imho
18:38haoleyeah, probably... I'm asking to get to know all the alternatives :)
18:38haolemy program is way too lispy right now
18:39haolemaybe I'll have to step back and use some more advanced data structures
18:39noprompthyPiRion: well how could i stress test it to find the edge cases?
18:39michaniskinhaole: flatten does recursion, which you probably don't want there
18:39haolehmm good point
18:39bob2I don't think you need more advanced data structures
18:39arrdemmy advice: fix your types, don't use flatten. flatten is one of those functions which rarely exhibits the desired behavior.
18:39bob2just to use the oens you're already using, better
18:40michaniskini don't think i've ever wanted to use flatten in 3 years now
18:40michaniskinwenever i think i want it, i always end up wanting prewalk or postwalk or something
18:40nopromptmichaniskin: funny, i just realized a similar thing not to long ago.
18:41noprompthaven't used flatten in a while.
18:41arrdem(watching TB's tools analyzer talk) is there a spec _anywhere_ for the intersection of Clojure and clojurescript?
18:41michaniskinnoprompt: tree-seq ftw
18:41holohi
18:41hyPiRionnoprompt: (let [timeout (+ (System/currentTimeMillis) 50)] (with-out-tag "foo" (loop [] (println "hello from foo") (if (< (System/currentTimeMillis) timeout) (recur))))) or something
18:42nopromptok let me try that.
18:45hyPiRionIt may also work just as you want it to, depending on the JVM you use, cores, etc. Its thread-unsafeness makes it hard to know what exactly will happen.
18:45nopromptah, interesting.
18:45holoI want to use this kind of stuff in my clj/cljs code: かな? but ? is not a valid character for identifiers in cljs, it seems. it is valid in clj though. would it be possible to extend identifiers allowed characters to ?in cljs?
18:45noprompthyPiRion: why does this happen with the loop example?
18:46arrdemholo: most likely that's an issue with JS, so I doubt it.
18:46arrdemholo: you'd need to implement UTF8 munging in the cljs compiler
18:46arrdemholo: not worth it.
18:48holoI see. I asked this because "?" is also not a valid js character. check it here: http://mothereff.in/js-variables so if the exception was made for "?", why not make it for "?" too?
18:49hyPiRionnoprompt: because you call it so often that it's almost guaranteed that a .write call starts while another .write call is currently running
18:49holoarrdem, sorry, the answer above was for you :)
18:49hyPiRionthat's not the case when you wait over a millisecond
18:50noprompthyPiRion: so that's why you were saying i should implement a locking mechanism. gotcha.
18:50arrdemholo: you could implement arbitrary UTF8 munging for cljs, just like ? is munged, but clearly it wasn't a developer priority.
18:52nopromptok, gotta step out for an early dinner. i'll work on this a bit more later.
18:52hyPiRionnoprompt: it's not that hard to do it here, luckily. just wrap all proxy methods in a (locking old-out ...), then you should in theory be set
18:54holoarrdem, OK I'm going to try doing that
18:54holo(inc arrdem) ; :D
18:54lazybot⇒ 23
18:55arrdemtbaldridge: ping
18:55arrdemtbaldridge: this time for real :P
19:01haolemichaelneale: fixing my API to work only with lists has reduced my code by 1/3
19:02haolethanks for the tip
19:02haoleops... it's michaniskin ^
19:02haole:D
19:02michaelnealehaole: I think that would be for someone else - I don't recall providing a tip!
19:02michaelnealeI am sure it was a good tip!
19:03michaniskinhaha, just the tip, though. it's a pretty good tip.
19:03haole:)
19:08rberdeenin a clojurescript repl, should the variables in a namespace be available after evaluating (ns whatever)?
19:08rberdeenthey appear to be in the vanilla clojurescript repl, but not when I use austin
19:14rberdeenit looks like i need to (load-namespace 'whatever) before (ns whatever) even if the namespace has been loaded in the browser...
19:21michaniskinwhatever happened to pods? was the concept abandoned?
19:23bob2haole, it's a useful thing to do in most languages
19:26hyPiRionmichaniskin: yeah, it's abandonded
19:27michaniskinhyPiRion: thanks. "pod" is a choice name, but don't want to confuse with core Clojure things
19:28hyPiRionI think you can safely use the term pod in your project without being scared of it suddenly popping into existence
19:29michaniskinoh thank god
19:41antonvwhy when I evaluate (require 'myprj.core), I get "syntax-ppss: Lisp nesting exceeds `max-lisp-eval-depth'" error in CIDER?
19:41antonvis it some circularity in the returnined value, preventing object printing?
19:42antonvI mean printing of the returned namespace object?
19:42cliftonanyone know why it says method not in interface when it is? (reify AWTEventListener (eventDispatched [event] (println event)))
19:43antonvbut in *cider-repl* (require 'myprj.core) works
19:53holoI found a trick to not pull out my hair when developing clj/cljs compatible macros to use in .cljx. just create two .clj files. one for clj macros, other for cljs macros, and name the macros the same way in both files, only change impl. then in the ns form use #+clj/#+cljs. sanity back!!
19:54cliftonnevermind, it didnt work because interface methods need to be reified with [this & args] and not just [& args]
20:09creeseI need to create a local library that I can link to. Anyone know how to do the equivalent of 'python setup.py develop'?
20:13eredcreese: what does `python setup.py develop` do?
20:15creeseit installs a local version of the library into your environment so you can use it elsewhere, changes in the source lib are automatically reflected in other projects, useful for development
20:15eredcreese: you might want lein checkouts
20:16eredhttps://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies
20:19yedianyone have experience deploying datomic clojure apps to ec2?
20:19creeseered: That's exactly what I need. Thanks!
20:19yediif so wanna send some pointers my way?
20:23michaniskinyedi: http://docs.datomic.com/aws.html <-- worked for me
21:05nopromptwell it didn't work.
21:05nopromptRaynes: can't figure out what i need to do to make this happen.
21:05nopromptif it's even possible.
21:06noprompthyPiRion: thanks for the tip by the way. it works great now.
21:09arrdemmichaniskin: pods?
21:10michaniskinarrdem: these things: https://kotka.de/blog/2010/12/What_are_Pods.html
21:10arrdemmichaniskin: already reading it..
21:14oinksoftis it normal to isolate exported classes in an aot namespace?
21:15oinksofta project i am working on has :aot [this-project.aot]
21:15oinksoftand other source files will say ;; gen-class statement in this-project.aot
21:20nopromptwell i'm fresh out of ideas.
21:21noprompthyPiRion: if you're still around and you have any thoughts ping me.
21:38chare someone buy me terraria
22:07TravisDDoes anyone know if Gorilla REPL can display incanter data? (Charts, matrices, etc). Also, is it mature enough to use as a tool?
22:09arrdemTravisD: well it features plugable rendering so if it doesn't you can add it..
22:10TravisDarrdem: Yeah, that's true :)
22:10arrdemTravisD: as to maturity it seems to still be really young so I wouldn't expect so.
22:10TravisDah, shucks. Are there other graphical notebook-style repls?
22:10arrdemI mean.. it works. It's just also being actively developed.
22:11arrdemnope looks like Gorilla is the first and only Clojure notebook
22:11arrdemunless you count Light Table
22:12TravisDcool, thanks!
22:15ivanTravisD: Session is another
22:15arrdem$google clojure Session repl notebook
22:15lazybot[Session — Medium] https://medium.com/p/1a12997a5f70
22:15arrdemalso ultra new and actively developed...
22:16TravisDhehe, cool :D Thanks for checking. I feel like I didn't do my own legwork
22:17arrdemeh... I'd love to have a good notebook style tool, so this is personal research for me too :P
22:19TravisDhehe :D
22:20arrdemhum... anyone care to comment on using core.logic with a relatively large external dataset?
22:21arrdemI suppose that I could dynamically construct DBs... but that feels a little gross.
22:25gtrakanyone have any tips how to debug core.async? I'd like to be able to see which channels are blocked/full. Maybe fantasy :-).
22:26gtrakI might resort to sliding buffers, but that seems dirty.
22:40arrdemdo we have a standard way of writing edn files, all I see is pr-str :c
22:42ivanarrdem: http://dev.clojure.org/jira/browse/CLJ-1201
22:42ivannothing else yet afaik
22:42arrdemthanks ivan, voted the ticket up.
22:57Raynesnoprompt: Well.
22:57Raynesnoprompt: I can't think of a way to make it work very well.
22:58Raynesnoprompt: I guess you can buffer lines and output them with tags.
22:58RaynesMy idea was just replace *out* with something you control, and then handle outputting yourself with tags.
22:59oinksoftaw clojure doesn't have guards :(
22:59nopromptRaynes: so yeah: https://gist.github.com/noprompt/a29cf0da3684990e6373#file-dup-clj-L23
23:00RaynesYou expect me to work with you when you link to gist?
23:00RaynesI'm not a savage bro
23:00nopromptlol
23:00nopromptRaynes: well video call you and share my screen.
23:00nopromptRaynes: haha
23:01nopromptRaynes: solving a problem over IRC is savagery.
23:01RaynesVideo calls give me hives.
23:01nopromptso where did we get with all this?
23:01nopromptno where.
23:01noprompthaha
23:02RaynesSo what isn't working about this?
23:03nopromptit's either a) tagging one line and then not tagging the rest or b) not tagging anything at all and showing no output.
23:04Raynesnoprompt: You're right, we definitely needed a video call for that sentence. :P
23:04clojurebotHuh?
23:05Raynesclojurebot: shhhh
23:05clojurebotCool story bro.
23:05RaynesMoving to PM
23:06amalloy~guards
23:06clojurebotSEIZE HIM!
23:06amalloy;; for oinksoft
23:06bob2oinksoft, as in for pattern matching?
23:30oinksoftamalloy, haha
23:30oinksoftbob2, yea
23:30amalloyoinksoft: i mean, clojure doesn't have pattern matching at all, so the fact that guards are missing isn't what would get me down
23:31oinksoftamalloy, i found this https://github.com/clojure/core.match
23:31Raynes$google core.match
23:31lazybot[clojure/core.match · GitHub] https://github.com/clojure/core.match
23:31RaynesDAMN IT
23:31oinksoft:p
23:32amalloysure, but if you're willing to use core.match, that has guards
23:32amalloyhttps://github.com/clojure/core.match/blob/master/src/main/clojure/clojure/core/match.clj#L1443-L1448