#clojure logs

2014-12-18

00:24bbloomamalloy: kebab-o
00:24abhjiraHi! I am trying to read a file line by line in the clojure REPL, but seem to be having a little trouble. Would anyone have any guidance? Here is a gist with what's going on https://gist.github.com/anonymous/4e1feb0d1005c88c4598
00:27abhjiraOh, looks like I am using the quote macro as opposed to quotes, I think I see the solution
00:27abhjira(line-by-line "/tmp/hi") instead of (line-by-line '/tmp/hi) or (line-by-line '/tmp/hi')
00:38ddimaabeaumont: you are right, there's only double-quotes for strings and backslashes for characters (unlike python, which just supportes single-ticks and quotes)
00:38ddima-e
00:38ddimaanyways, gn8
00:46FriedBobKinda bummed, just saw that the clojerks meetup was last week, not this week
01:08FriedBobAww, gonna miss the Jan one too, as I'll be here the week after. Again. I'm going to have to have a talk with my manager I think
01:11rhg135Hmm work vs clojure
01:11FriedBobclojure ftw win
01:12FriedBobI'm debating more beer + clojure, or sleep
01:12rhg135Sleep is over hyped
01:13FriedBobIndeed
01:14FriedBobI'm finally adjusted to Pacific time, it doesn't feel like midnight right now.
01:57cloudsajaHi all, noob question ... I see variable marked with '*' character before and after the variable name. What is the meaning of those ?
02:02ffwacomIt's a convention for vars that can be rebound
02:05ffwacomGlobal or config values like database connection string or stdout
02:05ffwacomLookup binding function
02:50rhg135ffwacom: don't even joke about global mutable state
03:00justin_smith,(def ^:dynamic foo "some thread local value")
03:00clojurebot#'sandbox/foo
03:02justin_smith,(def *foo* "should be thread-local")
03:02clojurebot#<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)>
03:03justin_smithmail cloudsaja see the warning you get with (def *foo* "should be thread-local") in a repl, the compiler warns if a var name with earmuffs is not a thread-local var http://clojure.org/vars
03:03justin_smith$mail cloudsaja see the warning you get with (def *foo* "should be thread-local") in a repl, the compiler warns if a var name with earmuffs is not a thread-local var http://clojure.org/vars
03:03lazybotMessage saved.
03:05justin_smithrhg135: it's not just global mutable state (all vars are global mutable state) but the expectation of using thread-local mutation. It's baked in pretty deep (see *out* for example)
03:06rhg135Lol
03:06rhg135Expect nothing
03:08justin_smithThe language has thread local mutation of global values as a fundamental mechanism. It sometimes sucks, but the language is designed around it.
03:09justin_smithpr, print, prn, println, clojure.pprint/pprint, with-out-str
03:09rhg135Have you read the ghc source, it could be worse
03:10justin_smithBut this isn't just clojure source, it's the clojure api.
03:12rhg135I don't really use them
05:02tangrammerHi folks, I’m working in customization sturtsierra component systems utility and just wanting to know if anyone is using this stuartsierra feature too
05:04clgvtangrammer: there are definitely some users of it, according to what one can read here and on the ML
05:05clgvthough there are also alternative approaches that were inspired by the component library
05:06tangrammerclgv: Hi and thanks for answering, I’m interested in which types of customization were being used
05:07tangrammerclgv: due that I implemented co-dependency https://github.com/tangrammer/co-dependency and aop https://github.com/milesian/aop
05:08tangrammerclgv: and was trying to develop a customization pattern that decomplects component/start from others system updates https://github.com/milesian/BigBang
05:08clgvtangrammer: ah, you are that guy ;)
05:09tangrammerclgv: I suppose :) and who are you then?
05:10clgvtangrammer: on github you mean? since I only remembered reading the announcement of "aop" on the ML ;)
05:11tangrammerclgv: ok, I got it
05:11tangrammerclgv: btw, what do you mean with “ML”?
05:11clgvmailing list
05:14tangrammerclgv: btw again, what do you think about this milesian/aop stuff? I’m really interested on feedback
05:15clgvtangrammer: I didn't use the component approach, yet. just read about it several times.
05:15TEttinger2Raynes, justin_smith: this is new.
05:15TEttinger2$google anything
05:15TEttinger2$ping
05:15lazybotTEttinger2: Ping completed in 0 seconds.
05:16clgv$google something
05:16clgv$google clojure
05:16TEttinger2the results string refers you to https://developers.google.com/custom-search/
05:16TEttinger2because the search API is no longer supported
05:16clgvah damn. plugin upgrade^^
05:16TEttinger2100 searches a day for free, how generous of you
05:17TEttinger2DDG has an API!
05:17TEttinger2https://ddg.gg
05:17TEttinger2short for https://duckduckgo.com/
05:19tangrammerclgv: thanks, are you working with cljs maybe?
05:20clgvtangrammer: no. plain old clojure ;)
05:21tangrammerclgv: can i see your github work? just curiosity ;)
05:25m1dnight_At the moment I'm using a linkedlist in java for my actor queue (it is a java class) and I pass in a clojure function to compare elements (messages) to get the right one
05:26m1dnight_now I would like to use LinkedHashSet in java, but that requires the instances (object) to implement equal and hash. Would it be possible to implement an object in clojure that overrides hash and equals?
05:26m1dnight_So I could just use the java LinkedHashSet
05:26m1dnight_https://gist.github.com/shinmuro/9338262 I'm looking at something like this
05:28dysfuntangrammer: totally offtopic, but does your nick come from anywhere in particular? there's a perl module named Tangram that does an interesting attempt to introduce relational database semantics to in-process data.
05:31justin_smithTEttinger: yeah, it would be nice to add a $ddg plugin
05:31tangrammerdysfun: sounds really pretty but tangrammer mean that I like to imagine my code is like a https://www.google.co.uk/search?q=tangram&amp;biw=1918&amp;bih=1102&amp;tbm=isch&amp;tbo=u&amp;source=univ&amp;sa=X&amp;ei=KKySVJOsFsPxaOnlgrgJ&amp;ved=0CD0QsAQ
05:32dysfuntangrammer: i think my code looks like that rather too often :)
05:32rhg135TEttinger: challange accepted
05:33noncom|2m1dnight: what about using a proxy?
05:36TEttinger2one of the better free APIs these days is http://www.faroo.com/hp/api/api.html
05:39noncom|2m1dnight: as a side note: the "method" names like (set-name!) and (get-name) are somewhat redundant. more clojuric style would be (name!) and (name) respectively
05:44dysfuni suspect that's open to opinion
05:44dysfunthough i much prefer short names
05:47justin_smithnoncom|2: well, setters are not idiomatic period, and the usual idiom is to have a separate function that takes a place and a function for transformation, or a place and a new unconditional value as arguments
05:49noncom|2justin_smith: yes, you are right.. what you say is just even more into clojuriness of things and is actually even the better way to do things
05:56ffwacomhttps://pbs.twimg.com/media/B5HA7_CCQAAz28Y.jpg:large
06:14TEttinger2hm, looks like yacy returns almost entirely spam...
06:15Empperiis it possible to execute arbitrary code with leiningen via :injections ?
06:15TEttinger2I wonder if yandex has a free API
06:15Empperiit seems like my code isn't executed
06:15Empperiit's like it wouldn't care about :uberjar profile at all
06:31clgvEmpperi: you want injections to work in the compiled uberjar?
06:32EmpperiI want to execute some code which generates stuff into target/classes
06:32Empperibefore the actual uberjar is created
06:32clgvEmpperi: write a hook for the "uberjar" task
06:32clgvEmpperi: :injections is the wrong thing for that
06:32Empperihmm
06:33Empperiso like :hooks [my-thing/do-the-stuff]
06:33hyPiRionEmpperi: :injections are only used for forms evaluated in the project. Jar and uberjar does neither
06:33hyPiRiondoes not do that*
06:34clgvEmpperi: yes
06:35EmpperiI wonder if it would work if I just wrote :hooks [(fn activate[] #_mycode)]
06:35Empperi:P
06:35clgvEmpperi: the namespace you provide there, should contain a (defn avtivate [] ...) where you use robert.hooke on the needed functions (probably "uberjar")
06:35clgvEmpperi: you can check the leiningen source ;)
06:36clgvEmpperi: but probably not
06:40noncom|2once i get a ProcessIml class instance by doing (.exec (Runtime/getRuntime) my-command) - then how do i read its output ?
06:40noncom|2*ProcessImpl
06:41noncom|2i can access the stdin and stdout streams by the corresponding getters, however, i do not fully understand how to communicate with it by means of clojure..
06:42noncom|2basically i just want to get what the command returned
06:42noncom|2and if it opened a prompt of some kind, write into it
06:42noncom|2(like an ssh connection)
06:44TEttinger2rhg135, in case you haven't noticed, DDG's API only returns instant answers, of which it frequently returns nothing
06:54ffwacomcan I ask you guys something personal?
06:55llasram*snork*
06:55llasramdysfun: Thanks, that coffee goes down the lungs great
06:56ffwacomdo you ever wonder if we are propelling humanity faster into a machine war with the greater expressiveness of lisp based languages and functional paradigms?
06:56ffwacomif we could stave off an AI escalation session by even 1 month
06:56clgvO_o
06:56llasramffwacom: no
06:56clgvo_O
06:56ffwacomisn't it worth it to abandon clojure and go back to less expressive languages?
06:56dysfunllasram: you're welcome :)
06:57clgv:P
06:57Emppericlgv: had to grab a quick lunch
06:57ffwacomand finally, won't someone think of the children? what will be our legacy?
06:57Empperiso, can I write a hook without writing a separate leiningen plugin?
06:57clgvEmpperi: uhm good question.
06:57dysfunme also wonders what defines 'personal' in ffwacom's world
06:58dysfun(with added / )
06:58Emppericlgv: because that's exactly what I don't want to do
06:58clgvffwacom: the promises of AI from the sixties are still unfulfilled. so no worries on that terminator scenario ;)
06:58Empperisince it'll make our build more complex for no reason
06:58ffwacomdysfun: we are all in this together
06:58Empperithis stuff is relevant for only this project
06:58ffwacomclgv: they were nieve
06:59dysfunclgv: i hear grey goo is what we're supposed to fear now
06:59Empperiif I don't get this to work pretty soon then I'll change the behavior in such a way that when ran from uberjar the code is executed on startup and the end result is spit into temporary directory
06:59ffwacomclgv: http://40.media.tumblr.com/dff4132c50ad8b75ba333c11c783cd78/tumblr_nf41ewhm9p1tl21beo2_1280.jpg
06:59clgvEmpperi: so the code of the plugin must get on the classpath of leiningen.
06:59Empperiand write custom handling for reading from there
06:59dysfunffwacom: perhaps you'd be more interested in studying the ethical implications of giving away software for free when people could abuse it, e.g. to send spam. it's a comparable issue and more real-world
07:00clgvEmpperi: when you use :plugins that is take care of.
07:00Empperialso it seems like :hooks are ran before any compilation is done
07:00ffwacomdysfun: It helps humanities communication immune system
07:00Empperithus it doesn't know anything about code written as hooks in the same project
07:00ffwacomdysfun: might as well have an arms race until the real threat appears
07:01clgvEmpperi: yeah. you got to use robert.hooke or similar to hook your code to the tasks where you need it
07:01ffwacomwhich is CYBERWAR
07:01Empperithis is a stupid limitation I have to say
07:01Empperiall I want to do is execute 3 lines of code before uberjar is created
07:01dysfunffwacom: i have no idea what a 'communication immune system' is. but i don't think it's that i'm short on coffee this morning
07:01ffwacomdysfun: yeah fair enough
07:01Empperibut guess I'll go with the tempdir solution
07:01ffwacomdysfun: didn't really make sense did it
07:01Empperiand forget about doing this at compile time
07:02TEttingercan I ask you guys something personal?
07:02ffwacomdysfun: tried to recover by capitalising cyberwar
07:02TEttingerdo you think that lispers make better coffee than java programmers, making the name "java" unintended irony?
07:02dysfunffwacom: best get a blog and explain it properly
07:02ffwacomTEttinger: this isn't your blog
07:02Emppericlgv: thanks for your help
07:02dysfunTEttinger: only if i can ask you something impersonal
07:02clgvTEttinger: lispers have to make their coffee themselves? O_o we got a machine for that ;)
07:03clgvEmpperi: glad to help
07:03kungi1g
07:03dysfunclgv: my bean to cup machine broke. we use a french press now.
07:03TEttingerI like my aeropress but I just take a half of a no-doz when I need caffeine these days
07:03noncom|2did anyone ever use https://github.com/Raynes/conch ?
07:04clgvnoncom|2: yeah. though it was quite a while ago
07:04TEttingeror 1.5 no-doz (300mg caffeine, or 2-3 cups strong coffee) right before a half-hour nap
07:04dysfunif aeropress satisfies you, you don't really have a coffee habit. not enough quantity
07:04noncom|2clgv: so i do => (sh/let-programs [lein "c:\\Users\\user\\.lein\\bin\\lein.bat"] (lein {:in "uberjar"}))
07:04TEttingerdysfun, do french presses make more?
07:04dysfuni'm on my third litre of coffee already
07:05dysfunTEttinger: my french press makes a litre in one go
07:05TEttingeryou can send coffee through an aeropress instead of water
07:05TEttingermaking supercoffee
07:05clgvnoncom|2: not sure about the map syntax, I used strings for the arguments back then
07:05ffwacomTEttinger: just buy modafinil
07:05ffwacomTEttinger: it's coffee without the side effects
07:05dysfunffwacom: it is not without side effects here. i used to take it daily
07:06ffwacomdysfun: what happened?
07:06ffwacomwhat mg, your weight etc?
07:06noncom|2clgv: and it prints out just the standard lein output, like i did not pass uberjar to it
07:06noncom|2why? :)
07:07dysfun200mg/day, weight ~100kg. positive effects: became able to tolerate anything and everything that came my way (had the most demanding job i've ever had, handled it like a breeze). but at the expense of quality of life
07:07noncom|2i just want to automate my project re-compilation and deployment through ssh... so now trying with conch.. maybe someone could suggest some other options for this process ?
07:07ffwacomdysfun: what quality of life issues?
07:07dysfunbecame difficult to go to sleep for one, and i felt permanently stimmed up
07:07dysfunand i felt like i was going to have a heart attack quite frequently after about 3 months
07:07clgvnoncom|2: what about (lein "uberjar") ?
07:08ffwacomdysfun: ah that sucks
07:08noncom|2like, i develop my project and then just type (deploy) in the repl, and it does all
07:08clgvnoncom|2: isn't :in for standard input the program gets? but "uberjar" needs to be a cli arg
07:08dysfunffwacom: these days i tend to pop one every few weeks if i want to have a clean flat
07:08ffwacomarmodafinil or modafinil at 200mg?
07:08ffwacomheh
07:08TEttingerI take vyvanse now, which is similar to modafinil in concept (long acting adderall substitute instead of long acting caffeine/amphetamine substitute)
07:08dysfunmodafinil. armodafinil was weird
07:09ffwacomfair enough
07:09noncom|2clgv: heeeey, that worked! :)
07:09clgvnoncom|2: you could use leiningen as library though, to avoid the indirection
07:09TEttingerI definitely feel more clear-headed when vyvanse is in my system, which to some extent is all the time
07:10TEttingerit helps me focus for hours, it just sometimes makes me robotic in my work ethic
07:10ffwacom120mg armodafinil @ 70kg fucks my sleep, but been on 60mg and it's ok
07:10noncom|2clgv: true, i guess i will go into it after some time. now just need the basic pipeline to work
07:10ffwacomdon't take it every day though
07:11ffwacomI don't take it every day*
07:12noncom|2the best combo i can suggest would be piracetam or piracetam + green tea. as it is not a stimulant, it does not wear off the body and mind. good food and sleep are essential though.
07:13ffwacomyeah being healthy and getting a good rest makes the most difference
07:13ffwacomproblem is it's not a silver bullet crushed into a pill
07:15noncom|2i find the restructurizations of CNS caused by long-term use of stimulants to be non-profitable in the long run..
07:15noncom|2however... who knows :)
07:17TEttingervyvanse apparently doesn't act like stimulants, it isn't categorized as one
07:21noncom|2ummm http://en.wikipedia.org/wiki/Lisdexamfetamine
07:24TEttingervyvanse was developed for the intention of creating a longer-lasting and less-easily abused version of dextroamphetamine, as the requirement of conversion into dextroamphetamine via enzymes in the red blood cells increases its duration of action, regardless of the route of ingestion
07:24TEttingerit's categorized as a prodrug, which is a confusing term
07:25ffwacomdextroamphetamine was everywhere in uni
07:27clgv,(deref nil)
07:27clojurebot#<NullPointerException java.lang.NullPointerException>
07:27noncom|2yeah, well, i know.. i have been taking similar stuff before.. it would be actually rather cool if they develop a stimulant (effectively) without the fainting side-effects
07:27clgvyou need some for "deref" it is not nil friendly...
07:27noncom|2in my country however, vyvanse is not available
07:28clgv*"some->"
07:28TEttingerI take a tiny dose and it works pretty well. I might go up to 30mg at some point since I can handle 20 well and I might benefit from more concentration
07:28ffwacomsmall doses of modafinil is the best I've found
07:28ffwacomnon addictive, non euphoric
07:29TEttingervyvanse isn't euphoric for me
07:29TEttingerand I may be developing a tolerance, but more likely the dose was too low to begin with
07:29dysfunhalf the reason to take modafinil is the euphoria. if you're working as hard as i was, you deserve to feel good instead of really crap
07:30ffwacomdysfun: nah fuck that
07:30ffwacomshould just get you wired without the crap from coffee
07:30ffwacomneed a goods night rest
07:31noncom|2well.. still they haven't invented anything that beats meht..
07:31noncom|2but its crap, yes
07:31ffwacomdysfun: as a functional drug :P
07:32noncom|2functional drugs for functional programmers :) let the oop-oriented crowd take the rest!
07:32ffwacomlel
07:33dysfunffwacom: part of the whole modafinil experience is gaining energy through crushing through everything you're doing. how do you pick up energy from what you're doing without the euphoria?
07:33ffwacomdysfun: doesn't make me euphoric
07:34ffwacomjust have a baseline of energy to do shit
07:34ffwacomthat I can't drop below
07:34dysfuni can go for a week at a time with no energy to do anything, and then one day i can write a month's worth of useful code
07:34noncom|2btw, i find that a series of 1-2 min meditations along the day make some wonderful change too
07:34ffwacom ¯\_(ツ)_/¯
07:35dysfunso i'm probably not the best person to talk to about typical experiences
07:35ffwacomdoesn't help with any fundamental issues anyway
07:35ffwacomnot lifechanging by a long shot
07:36ffwacomnah jks
07:37dysfunffwacom: clue's in the name. it's going to be silver bullet-shaped
07:37noncom|2they say opiates are really life-changing if you go for that
07:37noncom|2btw, a good example of when euphoria != productivity
07:37ffwacomhealthy diet, sleep and exercise!
07:38ffwacomeverything in moderation
07:38noncom|2actually, too much euphoria will hinder any productivity. a mild euphoria from satisfaction of what youre doing is the best for work i guess
07:38hellofunklol "opiates are really life-changing"... i mean, is the moon's dark side a cold place?
07:39dysfunwe should really get a ##clojure-offtopic or something
07:39ffwacomheh
07:39noncom|2agreed with ffwacom: balance proves to be the best (balance also implies balanced unbalancing in required times, so don't consider it too boring )
07:40noncom|2heck, everyone just does what he feels right at the moment :D
07:40noncom|2anyway :)
07:40ffwacombest advice i've heard is to live like your grandparents did, they are too frail to fuck around so their diet and sleeping pattern is fairly spot on
07:41clgvthere is an offtopic channel
07:41clgv#clojure-offtopic
07:41dysfunooh
07:41ffwacom^
08:02hellofunkif you have multiple bindings in a when-let, i suppose it only does the when test on the first binding, ignoring the others, right? and the others would not occur should the first binding be logically false.
08:03hellofunkah, i see now that only 2 forms are allowed in the bindings, thus you cannot have multiple bindings
08:03Bronsahellofunk: wehn-let and if-let can only have one binding
08:25dnolen_reiddraper: cljs-port-patch-2 for test.check is ready to test. mvn test works now for me.
08:37crispinhey peeps.
08:37crispinhow do I do the equivalent of lein run -m using java and a jar?
08:38crispinlike 'lein run -m myproj.server' as 'java -jar jarname.jar ...?'
08:38crispinjava -jar uberjar.jar runs whats defined in :main in project.clj, but what about another entry point?
08:48stuartsierracrispin: `java -cp uberjar.jar <name-of-main-class>` or `java -cp uberjar.jar clojure.main -m <clojure-namespace-with-main>`
08:53crispinstuartsierra: I get Error: Could not find or load main class pyproj.server
08:53crispinfor the first
08:53crispinand
08:53crispinError: Could not find or load main class clojure.main
08:53crispinfor the second
08:54stuartsierrafor `java -cp jarfile <main-class>` you have to have an AOT-compiled Clojure namespace with :gen-class and -main.
08:54clgvcrispin: you need to AOT compile the namespace you want to run as such
08:54crispingot -main
08:55crispinno :genclass
08:55clgvcrispin: try something else. through the regular -main you specified in project.clj, read the first command line argument, convert it to a symbol, require the namespace belonging to the symbol. resolve the -main method in that namespace and invoke it with the remaing command line arguments
08:56mnngfltgIf I have a form as a list and print it, I get this: (#<core$_EQ_ clojure.core$_EQ_@21d71fbe> 1 1) -- can I pretty print it like this: (= 1 1) ?
08:56clgvthen you can just use "java -jar my.jar my.awesome.ns arg1 arg2 ..."
08:56crispin:profiles {:uberjar {:aot :all}} in my lein
08:57clgvcrispin: I have been doing something similar for a jar that contains more than one tool
08:57stuartsierraclgv: java -cp, not java -jar
08:57crispinclgv Im hoping to make it self executable and the client aswell
08:57clgvstuartsierra: nope! java -jar when using the previous suggestion
08:57crispinso java -jar uberjar.jar is essestially the client
08:57crispinand lein server -m proj.server
08:57crispinis the server
08:57stuartsierraclgv: Oh, I see, when you're loading the namespace, sorry.
08:58clgvcrispin: yeah, that'll call the -main in the namespace you provided leiningen
08:58crispinok added gencalss, uberjared... now I get more: Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/IFn
08:58clgvstuartsierra: no problem ;)
08:58clgvcrispin: did you run the uberjar?
08:58crispinyep
09:00crispinhow do I make sure aot is on for both classes?
09:00crispinis :profile {:uberjar {:aot :all}}
09:00crispinenough
09:00crispinand genclasses of cource
09:01clgvcrispin: with my suggestion you'd only need AOT for the one namespace containing the -main
09:01crispinyeah but then I cant run it as a mainline
09:01crispinIm using lein bin to make a self executable
09:01crispinI dont want to go
09:01crispin/bin/mytool proj.client -h
09:02clgvcrispin: ok. is it sufficient for "lein bin" to have one AOT compile namespace?
09:02crispinunless I modify lein-bin and make it pass it in when evoked from commandline
09:02clgvcrispin: so you only have one namespace that you want to use?
09:03atankanowhi crispin, your client and server code are in the same lein project?
09:03crispinatankanow: yes
09:03crispinthey share much code
09:03atankanowi would extract all reusable code into a dependency and separate your client/server lein projects
09:03crispini dont want to do that
09:03crispincause a server is a client also
09:04crispinok I looked in target/classes and its empty
09:04atankanowok, but are they two separate applications?
09:04crispinatankanow: one app
09:04atankanowi see
09:05crispinif my target/classes is empty, does that mean no AOT happened?
09:08crispinfound em in target/uberjar/classes
09:12holohi
09:12holo,(if-let [foo true] foo foo)
09:12clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context, compiling:(NO_SOURCE_PATH:0:0)>
09:13holois there some rationale for not extending foo to the else form?
09:14crack_userwhat ->> and -> does mean in clojure?
09:14clgvholo: yeah, it is the definition of if-let, when you get no truthy value, do not bind anything
09:15holocrack_user: they are trush operators. i think it means thread first and thread last, respectively. think of it as pipelines
09:15stuartsierraholo: `if-let` is typically used to check if something is nil or empty, as in (if-let [s (seq foo)] …) so the value doesn't matter for the "else" case.
09:16chouserholo: Even if it was bound, it would only ever be nil or false—are you trying to distinguish between those two in the else clause?
09:16clgvcrack_user: it allows pipelining syntax, e.g. (->> (range 100) (filter odd?) (reduce +)) instead of (reduce + (filter odd? (range 100)))
09:16crack_userthx
09:18holostuartsierra: I understand most of the times it's not necessary, but now I 'needed' to feed the nil value to an fn, so I was curious as to understand why there is the limitation
09:19clgvholo: you need to feed a "nil" to a function? O_o that sounds very strange
09:19clgvholo: just insert a literal "nil" if the setup makes sense
09:19holoclgv: come on, how strange is that? :D you never feed nils?
09:20clgvholo: usually only in multi arity definitions as default values for "not specified"
09:21clgvbut on the call site there is no need to pass a "nil" explicitely then
09:24holoclgv, now that you mention it, I could [& [may-be-nil]] on the input args. maybe i'm doing code smell with nil
09:25clgvholo: depends on the task whether that is a solution ;)
09:26holoclgv in this case it is, and it the broader context what you said is sound. I'll think about it more carefully when thinking about fn interfaces
09:27crispinI think whats happening is my uberjar is missing clojure.main
09:27crispinit has clojure/tools
09:27crispinit has my app generated classes
09:29holo(inc clgv)
09:29lazybot⇒ 40
09:29clgvthanks ;)
09:40gfredericks$mail andyf turns out that use of subseq was indeed buggy
09:40lazybotMessage saved.
09:43m1dnight_is it possible to override equals and hashcode for a deftype?
09:44m1dnight_or should I use a defrecord? (/me is still reading up)
09:45chouserm1dnight_: defrecord defines equals and hashcode for you. deftype allows you to define your own.
09:46m1dnight_yes, but i really need my won implementeation
09:46m1dnight_wow, much typos :<
09:47m1dnight_okay, i'll experiment a bit
09:47chouserso use deftype
09:47m1dnight_okay, I found an example. I only found a SO question that said "use defrecord"
09:47m1dnight_but I think i'm good to go now, thanks guys
09:55crispinclgv, atankanow: turned out to be a broken leiningen. updated to latest leiningen. 'java -cp uberjar.jar entry.point' works!
09:55crispin,stuartsierra
09:55clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: stuartsierra in this context, compiling:(NO_SOURCE_PATH:0:0)>
09:55opqdonut:D
09:56clgvcrispin: good
09:57clgvm1dnight_: yeah just override both methods in your deftype
09:59m1dnight_yeah I figured it out already
09:59martinklepschanyone advice how to debug issues with cljx middleware?
09:59m1dnight_i was just a little bit confused that you have to put "Object" as protocol/interface
09:59m1dnight_since it is not an interface, but an actual class
09:59martinklepschgetting some wierd behaviour: https://gist.github.com/martinklepsch/7bd3cbdf810d8025c090
09:59m1dnight_but as I said, i'm still reading up so excuse if I sound stupid :p
10:00clgvm1dnight_: you dont even have to put it there - it is just documentation. the impl filters it out
10:01clgv,(deftype Foo [] (toString [_] "awesome"))
10:01clojurebot#<CompilerException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_FILE:0:0)>
10:01clgvok damn you need at least one symbol there
10:01clgv,(deftype Foo [] Object (toString [_] "awesome"))
10:01clojurebotsandbox.Foo
10:02clgvok in that case it is needed
10:02clgv,(deftype Foo [] Comparable (toString [_] "awesome"))
10:02clojurebotsandbox.Foo
10:02clgv,(Foo.)
10:02clojurebot#<Foo awesome>
10:03clgvso you could skip it in the cases where you have another interface - but it serves as documentation
10:15jonasenDoes Cursive work with Idea 14? It says on the website that "Cursive will work with IntelliJ versions 12.1 as well as the 13 and 13.1 versions." ?
10:15dnolen_jonasen: it does
10:15jonasendnolen_: good.. I will give it a try then
10:18jonasendnolen_ are you using it for cljs dev?
10:18dnolen_jonasen: no not at the moment though I've played around with it
10:19dnolen_jonasen: it's great for regular dev, but some things in Emacs are still better (macroexpand is critical for me)
10:21jonasendnolen_ Yes, I will give it a try and see if I like it. The demos from clojure/conj were really nice
10:21jonasenand I don't need macroexpand 9 days out of 10 :)
10:21dnolen_jonasen: it's pretty awesome, stepping debugger is worth price of admission
10:21clgvdnolen_: you mean something like "inline macroexpand"?
10:21dnolen_clgv: no macroexpand period
10:22clgvdnolen_: what is that?
10:22dnolen_in a code formatted view
10:22dnolen_clgv: Emacs Clojure integration has long support macroexpand form under cursor and opening a new buffer with pretty printed expanded source
10:23clgvdnolen_: ah nice
10:24clgvI always do that in repl via pprint which is not optimal ;)
10:24dnolen_clgv: that fine for simple stuff, not fine for debugging core.match expansions
10:24dnolen_or core.async
10:25clgvyeah, guess so.
10:25clgvhad my own complicated macros where that approach was hard work...
10:26tcrayford___dnolen_: I feel bad, but I never write complicated macros :( Prolly how it is as an application developer though
10:27tcrayford___(I'm willing to bet datomic's codebase doesn't use many macros)
10:27dnolen_tcrayford___: definitely don't recommend writing complicated macros - I hate macros, except the ones I like.
10:27tcrayford___haha
10:28tcrayford___I've found there's real issues with them exploding the JVM's inliner budget as well :/
10:28jonasenso IntelliJ requires Java 1.6?
10:28tcrayford___folk think "oh I can do this computation at compile time so it's fast" but then they blow past the JVM bytecode limit for inlining and it's all slow and terrible and confusing
10:31dnolen_tcrayford___: oh yeah, was definitely a problem for core.match (I hear less about it now that the core.match is smarter than the earlier days). Gotta put a compiler in your macro for the compiler.
10:31puredangerif anyone feels like figuring out this craptastic compiler weirdness, please help :) https://groups.google.com/forum/#!msg/clojure/HK3x7cj3I1o/gy_a7G98VpQJ
10:31tcrayford___haha yeah :(
10:32puredangersource: https://github.com/laurentpetit/ccw/blob/master/ccw.core/src/clj/ccw/eclipse.clj#L503 bytecode: https://www.google.com/url?q=https%3A%2F%2Fgist.github.com%2Fpuredanger%2F40dd3ec22fdb5836d1eb&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNH5DE1T02xS8UA_1qFtiyqUsZanIQ
10:32puredangergrr. bytecode: https://gist.github.com/puredanger/40dd3ec22fdb5836d1eb
10:34tickingdnolen_: btw is there a reason why core.match can't match on '() quoted lists and sets :)?
10:35dnolen_ticking: because no one's filed a bug or submitted a patch?
10:36tickingdnolen_: ah :D, I thought maybe it was a conscious design decision so that people use ((foo :seq) :guard list?) or something
10:36dnolen_ticking: :seq is slated for removal
10:37dnolen_in 0.3.0
10:37tickingdnolen_: After reading the nanopass compiler papers I realized that akhudek/zip-visit + core.match + prismatic/schema gives you all of the functionality described plus some flexibility and power
10:38tickingdnolen_: alright maybe I'll manage to write a patch for lists and sets :)
10:38dnolen_ticking: at least open tickets :)
10:38tickingdnolen_: on my way :D
10:45tickingdnolen_: should lists and sets be two issues or one? "Support all edn datatypes in matches."
10:45dnolen_ticking: separate tickets please
10:45tickingk
11:11EvanRis it possible to use "super" in the definition of a method of a genclass
11:15machtyi'm new to clojure and still trying to grok "special form". Can you tell from syntax alone that something is a "special form" rather than just a "macro"?
11:15tcrayford___machty: nope. There's a very limited number of special forms, and they're all special cased by the compiler
11:18clgvmachty: for a beginner there is probably no difference between built-in macros or special forms
11:18andyfmachty: Well, you can tell by the name of the first symbol whether it is a special form. Not sure if you are leaving that out of ?from syntax alone?, or including it.
11:19machtytcrayford___: so when the compiler sees `set!`, it's hooking into internal compiler logic, which is why it's smart enough not to eagerly evaluate, say (.-x point-object), and rather treat it as a java instance field set instead, a la (set! (.-x point-object) 123)
11:19machtyandyf: how can you tell?
11:19machty"def", "set!", etc, both special forms
11:19tcrayford___machty: you can tell special forms because they say so in the docstring ;)
11:20andyf,(sort (keys clojure.lang.Compiler/specials))
11:20clojurebot(& . case* catch def ...)
11:20andyf,(str (sort (keys clojure.lang.Compiler/specials)))
11:20clojurebot"(& . case* catch def ...)"
11:21andyfAh, do that in a local REPL and you will get a longer list and not the ...
11:21andyfIf the first symbol is one of those, it is a special form.
11:22Bronsa,(doc special-symbol?)
11:22clojurebot"([s]); Returns true if s names a special form"
11:22andyfYou will see several names ending with * in that list. case is a macro implemented in Clojure itself, which expands to a special form beginning with case*
11:23andyfBronsa! I?m almost ready to update t.a(.j) in Eastwood and find out what I need to change. You done with final exams yet? :)
11:25andyfAnyone know why & is on that list of specials? All the others I've seen at beginning of a parenthesized form, but not that one.
11:26Bronsaandyf: yeah no exams right now but I'm still busy with a swe project -- I can find time for taj/eastwood anyway :)
11:26Bronsaandyf: it's a hack for syntax-quote
11:27TimMc&:you-there?
11:27lazybot⇒ :you-there?
11:27TimMcyay
11:27andyfTimMc: That wasn't confusing timing at all :)
11:28TimMchah!
11:28TimMcandyf: I'd be tempted to remove it, recompile Clojure, and see if it breaks any projects.
11:32tickingdnolen_: I submitted the issue for lists, but while thinking about it I got a bit unsure about sets. Currently they are supported as literals so the situation is a bit better than for lists, additionally matching variables on them seems a bit less useful because of the undefined order. It might make sense in a compiler context to just match on a random element from a set like `[(#{x} :as s)] (foo x (dissoc s x))` but still a `[(s :guard set?
11:32ticking)] (foo (first s) (dissoc (first s)))`might be cleaner :/
11:43silasdaviswhy is there no into! for transients?
11:58clgvsilasdavis: good question. (reduce conj! coll1 coll2) will help you though
11:59clgv`into!` would do the same
12:05reiddraperdnolen_: merged :)
12:11dnolen_reiddraper: sweet!
12:21bbloomBronsa: andyf: in theory there could be a type for improper lists and & would be the reader form for it, like . in CL/scheme
12:21bbloomTimMc: i promise you that it will
12:21bbloomTimMc: in fact, i have projects that would break: macros that search for '&
12:22Bronsait would also break any `(fn [x & foo]) code
12:22Bronsathere's no clojure.core/& var
12:24brainacidhello
12:36brainacidmmm...still installing
12:36brainacidlooks full but behaves empty
12:36brainacidfunny channel
12:40justin_smithbrainacid: installing?
12:53brainacidjustin_smith: yes java
12:53brainacidjustin_smith: gonna learn clojure
12:54justin_smithstart with lein (if you weren't planning to already) it makes a lot of things a lot easier
12:54borkdudeis there something in clojure world that comes close to the easy of ruby on rails in terms of generating things for resources so you can quickly create, delete etc. them
12:54justin_smithwhat sort of resources?
12:55tcrayford___borkdude: not exactly no. Clojure folk tend to shy away from frameworks, and "ease of getting started" in favor of long term wins :/
12:56justin_smithtcrayford___: well, it isn't super popular, and has its limitations, but caribou do streamline a lot of stuff in a frameworky way
12:57justin_smithI'm one of the core caribou devs (I first learned clojure because I got hired to work on caribou) and I wouldn't do it all the same next time, but it does have some advantages
12:57brainacidjustin_smith: tcrayford___ I am brand new baby into programming
12:58borkdudetcrayford___ yes I thought so, exactly what I was thinking, but just checking :)
12:58brainacidI dont know LISP but Im here to have fun
12:58borkdudetcrayford___ I used clojure since 2009, and only started in ruby for one month now
12:58borkdudetcrayford___ I like the things in a framework you get for free, but when you have problems it's harder to find out what's wrong
12:58justin_smithborkdude: caribou was developed to replace a ruby based system
12:59borkdudejustin_smith is it still under development?
13:00justin_smithborkdude: it's no longer funded (it was an Instrument project previously) but I still use it often, and I fix bugs as they come up, and use it pretty constantly
13:01tickingticking
13:02tickinglol, wanted to authorize my nick, sounded like a pokemon
13:02EvanR... my method does not seem to be making into my gen class
13:03EvanRits just missing (according to reflect0
13:07brainacidany tips? suggestions?
13:07brainacidseems like im going to have some fun
13:08justin_smithuse lein, the clojure koans are a nice place to start
13:08{blake}OK, I've got a weird one: I've just gotten a new machine at work and they've put Windows on it. I'll get a dualboot into Linux going in a couple of days, but in the meantime, I've been developing under Win7 (which I do sometimes at home as well, so it's not a new thing).
13:09{blake}I have this web app that runs on port 3000, and it worked right up until a few hours ago. When lein tries to open port 3000 it says "Access is denied". I thought maybe the network guys had messed with something.
13:10llasram{blake}: boot2docker has a Windows build. Problem solved!
13:10{blake}But I can open port 3000 with node.js, Smalltalk, anything else. Just not lein. And lein can't open any port. "Access is denied."
13:11justin_smith{blake}: maybe they have some weird rules for java
13:11{blake}llasram:That looks pretty cool actually. But...I'm puzzling over the whole "Access is denied" thing.
13:12{blake}justin_smith:Yeah, maybe. I didn't know that was a thing but now that you mention it.
13:12justin_smith{blake}: check out jre/lib/security/java.policy
13:12justin_smith(also)
13:12brainacidjustin_smith: thanks will check lein
13:13justin_smith{blake}: http://stackoverflow.com/questions/21154400/unable-to-start-derby-database-from-netbeans-7-4
13:13justin_smithbrainacid: yeah, lein is the easiest way to start clojure and manage libraries, I think everyone here uses it
13:14brainacidleiningen ?? justin_smith
13:14justin_smithyes
13:14{blake}justin_smith:Thanks. Lemme check it out...
13:17brainacidto start as in executing the compiler or start as in beginning my learning path?? sorry
13:17brainacidjustin_smith:
13:17justin_smithbrainacid: as the way to execute the compiler
13:18justin_smithbut really, especially in the beginning, you should just use the repl. It compiles things as you execute them, interactively
13:18noonianbrainacid: both; leiningen handles dependency management, can start a repl for you, build a standalone jar, its like rake + bundlers if your familiar with ruby tooling
13:25brainacidim not noonian sorry Im coming from C and assembly right now
13:26brainacidshit i use midnight commander and gdb
13:26brainacidlol
13:26noonianah, ok. well it handles a lot of things for you, like resolving dependencies and adding them to the classpath automatically
13:26brainacidok
13:26brainacidim excited to learn tho
13:26brainacidcode is data
13:26brainacidhomoicipcity
13:27brainacidsum shit
13:27brainacidlol
13:27TimMcYou were only off by a Levenshtein distance of 3. Not bad.
13:28TimMcbbloom: So basically having '& as a special means it doesn't get namespaced?
13:28noonianhttp://www.braveclojure.com/ is a free online book that might be helpful for learning both tooling and the language
13:30{blake}justin_smith: So, how do I find out what JAVA_HOME is from lein? I mean, I can find out from NetBeans but it isn't a given that they're the same, is it?
13:30justin_smithit's an environment variable, and it will point to where java is installed
13:31justin_smithprobably something in Program Files
13:31{blake}Huh. I don't have a JAVA_HOME environment variable.
13:31{blake}Or a Java anything...
13:32justin_smithOK, clearly java is installed, the file will be in that relative path under jre/ whereever it is installed
13:32{blake}Son of a bitch. It's working now.
13:32justin_smithhaha
13:32pmonksAlso, from a repl: (System/getProperty "java.home")
13:32pmonks,(System/getProperty "java.home")
13:32clojurebot#<SecurityException java.lang.SecurityException: denied>
13:32pmonks(dec clojurebot)
13:32lazybot⇒ 46
13:33brainacidhow do i run jar files
13:33brainacidlol
13:33justin_smith&(System/getProperty "java.home")
13:33lazybotjava.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.home" "read")
13:33pmonksA JAR file is usually (though not always) a library ie. like a dynamic shared library.
13:33justin_smithbrainacid: lein will take care of that for you during dev, but if you just want to run one without lein's help "java -jar some.jar"
13:33noonianbrainacid: java -jar the_jar.jar
13:34noonianwhich only will work for executable jars, not library jars like pmonks mentioned
13:34justin_smithbrainacid: for example to run clojure, just run "lein repl"
13:34pmonks(inc noonian)
13:34lazybot⇒ 10
13:35justin_smithyou can also use "java -cp clojure.jar:a.jar:b.jar:c.jar:src/ clojure.main"
13:35justin_smiththat will make all those jars available, and run the clojure repl
13:35{blake}How freakin' weird. I was toying with staying in Windows but this is...strong incentive to get to Linux.
13:35justin_smith{blake}: Windows has lots of issues as a development platform
13:35nooniani'd just run a virtualbox linux install if you don't want to mess with dual booting right now
13:35pmonksbrainacid: I also like the "lein-try" plugin for experimenting with different JARs: https://github.com/rkneufeld/lein-try
13:36{blake}justin_smith:Well, it's unthinkable for Ruby. I haven't had any trouble with Windows at home. Clojure + lein makes it so easy not to care. (Almost as good as Smalltalk. =P)
13:36brainacidok
13:36brainacidmmm totally lost
13:36brainacidbut im sure i have time to find myself
13:36brainacidgot some clojure books already
13:37brainacidlets see if I can do anything
13:37brainacidnightcode?
13:37pmonksI just use a text editor + REPL.
13:37pmonks(fwiw)
13:37pmonksMS-DOS 2.11 edlin + REPL
13:37{blake}brainacid: Being where you were a scant...eight months ago...Don't put too much hope in learning Clojure from books.
13:37brainacidok pmonks
13:37Jaoodedit.exe
13:38brainacidso I can probably continue using the console
13:38justin_smithyeah, a repl is all you really need, and a repl is just "lein repl", worry about the rest later
13:38brainacidok
13:38brainacidyeah so in other words i dont need to know java to get this one right?
13:38brainacidits a language on its own correct?
13:38{blake}brainacid:No need for Java.
13:38brainacidjust using the extensive library and stuff from java?
13:38justin_smithnot at all, but you'll likely learn a few things about the standard java libs eventually
13:38brainacidok thanks blake
13:38justin_smithexactly
13:39brainacidi see
13:39pmonksYes, but it relies heavily on the JVM, and being able to understand how typical Java libs work will help in leveraging them.
13:39pmonksBut lein hides most of the "weird JVM shite"
13:39pmonks(classpaths etc._
13:39{blake}brainacid:Actually, Clojure gives a great way to approach Java, which is far more complicated.
13:39brainacidwell i just dealt with numbers so not really knowing about graphics and stuff. im just a simple dad, stay home farther...just hobby
13:39pmonks(inc {blake})
13:39lazybot⇒ 1
13:40brainacidi just like to make utilities
13:40brainacidlike I have this idea of a search engine for this book I have
13:40Jaoodbrainacid: later on you will feel like you are missing out if you don't get familiar with Java
13:40pmonksJust to set expectations... ...the JVM has a pretty crappy startup time, at least compared to C/ASM.
13:40{blake}whoa...I...exist, thanks, pmonks!
13:41pmonksIt's awesome for long-running processes however.
13:41brainacidOh yeah pmonks i saw that already, was looking at top resources while I was launching Nightcode using the debugger
13:41brainacidl0l
13:41pmonksYah - sorry. :-(
13:41pmonksBut it's worth it for the long running stuff, ime
13:41brainacidhey its ok
13:42pmonksNice to watch code get optimised at runtime. ;-)
13:42pmonksHard to do that in C/ASM! ;-)
13:42brainacidi dunno if i be making anything that runs more that a few minutes
13:42pmonks(though I think Intel had a compiler back in the day that sort of did this)
13:42brainacidits all nice and nifty I just excited to see a self-modifying language
13:42tuftwhat do folks like for scraping these days? enlive?
13:43pmonksFew minutes should be ok, as the second or two it takes the JVM to startup will be pretty well amortised.
13:43{blake}brainacid:The big thing Clojure will give you over C/Asm is changing your brain.
13:43pmonksbrainacid: I still consider myself a n00b too, and all I can say is "stand by for the rush". ;-)
13:44brainacidok lein repl worked
13:44brainacidwish there was highlighting for mc :(
13:44brainacidlol
13:45brainacidwell it says Lisp program in my menu!! YAY
13:46brainacidpmonks: {blake} thanks for your time, i enjoy the help. i like being brain changed lol
13:47justin_smithtuft: yeah, I usually use enlive
13:47chousertuft: I still like clojure.data.zip, but the docs are still no good.
13:47tuftcool thanks
13:47brainacidwell
13:47brainacid...
13:47brainacidoff to the books
13:47{blake}brainacid:Good luck!
13:47pmonksbrainacid: welcome! I hope you get the rush I'm still getting!
13:52brainacidthanks pmonks {blake}
13:55dysfunare there any useful libraries for turning maven repositories into metadata maps?
14:03stuartsierradysfun: Maybe https://github.com/cemerick/pomegranate
14:17dysfunstuartsierra: yeah, looks like the aether stuff in pomegranate is what i need
14:17dysfunthanks
14:20brainacidlater
14:49llasramHave I done something funky with my configuration or has the most recent version of clojure-mode done some odd things to indentation?
14:50stuartsierrallasram: it changed
14:50stuartsierrahttps://github.com/clojure-emacs/clojure-mode/issues/265 and https://github.com/clojure-emacs/clojure-mode/issues/266
14:50llasramcooooo
14:51llasramwat
14:57llasramWhelp, easily fixed in my own config
14:57dysfuni'm building a leiningen plugin, but i can't seem to get hold of leiningen.core at the repl. am i being thick or is there something obvious?
14:58dysfuni've even tried 'lein try leiningen-core'
14:58dysfunpresumably it explicitly strips them out
14:59noonianand you have it listed as a dependency?
15:00llasramdysfun: you need to have `:eval-in-leiningen true` in your project file, and cannot use the `trampoline` task
15:00llasramOne of those missing?
15:01dysfunnope
15:01llasrams,:eval-in-leiningen true,:eval-in :leiningen,
15:01llasram(I looked at an old example)
15:01dysfunoh, that might be it
15:03bbloomTimMc: yes
15:04llasramdysfun: Oh, wait -- hah. There's no `leiningen.core` namespace. It's an empty point in the hierarchy
15:04llasramdysfun: Try (require 'leiningen.core.main)
15:04dysfunno dice :/
15:05mikeflynnTry leiningen.core.user
15:05dysfunno, wait, sorry, i typed that in the wrong repl
15:05dysfunleiningen.core.main worked, thanks
15:05llasramnp
15:16dysfunwhere's the best place to read what all the keywords in leiningen dependency specs mean?
15:16dysfunlike :scope, :exclude etc.
15:17Bronsadysfun: https://github.com/technomancy/leiningen/blob/master/sample.project.clj
15:18amalloydysfun: see also `lein help sample`, which prints the contents of Bronsa's link to stdout
15:18dysfun"in addition to keywords supported by pomegranate,"...
15:19dysfunthis is why what i'm building with all of this is needed so badly
15:23dysfunhttps://github.com/cemerick/pomegranate/blob/master/src/main/clojure/cemerick/pomegranate/aether.clj#L619
15:30amalloyllasram: i just commented on https://github.com/clojure-emacs/clojure-mode/issues/265#issuecomment-67551290, by the way. i think the change to -> is awful
15:34mmitchellanyone using log4j2? Was using malcolmsparks/clj-logging-config but it's no longer compatible. My primary need is to be able to change log levels at runtime.
15:38llasramamalloy: Ah, cool. I didn't comment because I wasn't sure if discussion was taking place elsewhere
15:38amalloyi dunno if it is, but i'm obstreperous
15:38machtyi'm learning about namespaces and requires, wondering why i'd use :require if i can just use fully qualified names?
15:38machty(clojure.string/capitalize "asd")
15:39Bronsamachty: how can you be sure clojure.string is loaded?
15:39amalloymachty: you have to require; only a few namespaces are automatically loaded
15:39amalloyclojure.core, clojure.string, clojure.set...one other i always forget, i think
15:39Bronsaand they are not guaranteed to be loaded either
15:40machtyi see
15:40machtyseems a little strange that clojure would leave that door for error open for you...
15:40Bronsamachty: also you rarely want to write the fully qualified form every time. most of the time you just alias the namespace to a shorter name or :refer the var you need
15:41Bronsamachty: which is convenient to do inside a :require form
15:41machtyit doesn't require that you use :require if you wanna take the risky to use a possibly-not-loaded but fully-qualified symbol
15:41machtyBronsa: confirm, refer makes sense, just wanted to make sure i understood the base behavior
15:42Bronsamachty: that's a side-effect of how namespaces work in clojure. once you load a namespace it's loaded "globally", it's not a per-namespace thing
15:42machtyyeah but it doesn't seem like it'd be a stretch to enforce a "strict" mode of only referencing what you require
15:42Bronsamachty: this is incredibly useful if you take into account macros
15:43amalloy(inc Bronsa)
15:43lazybot⇒ 79
15:43Bronsai.e. I might have a (ns a (:require b)) (defmacro x [] `(b/y))
15:43machtyBronsa: what about that example is "global"?
15:43Bronsamachty: if clojure enforced every namespace to require the namespaces refered, you'd have to require b from each namespace where you want to use a/x
15:45amalloymachty: the missing (or implied) part of that example is (ns c (:require a)) (a/x)
15:45Bronsaright
15:45amalloy(a/x) will expand to (b/y), inside the namespace c, which hasn't explicitly loaded b at all
15:45amalloybut it needs to still work or else the macro is stupid
15:46machtythat doesn't sound like an argument for globals... a consumer of a/x doesn't need to know that it internally depends on b/y
15:46Bronsayou'd have to know the implementation of each macro you were to use to make sure you load all the necessary namespaces. Unthinkable
15:46machtyit is entirely possible that i'm not ready to have this conversation until i fully grok macros... i'm super super n00b atm
15:46mikerodWhen in the REPL I notice that every form I evaluate results in a new level of the class loader hierarchy
15:46joshuafcole1macros don't have isolated internals from the code in which they're evauluated, machty
15:46mikerodis this normal and doesn't that have a limitation at some point?
15:47joshuafcole1macros are evaluated at compile time, not during runtime, so you're call to a/x literally becomes a call to b/y in c.
15:47mikerodI realize it is likely done to hold newly generated class
15:48mikerodactually it seems to change how deep the parent class loader stack gets sometimes - so I haven't really figured out how to follow it :P
15:49machtythanks errbody, i'm gonna marinate on that. loving clojure so far
15:50Bronsamikerod: each compilation unit in clojure should have it's own dynamicclassloader, it might have as parent another dcl or the threaad local one but I don't think it can nest much more than that
15:50Bronsamikerod: i.e. it definitely doesn't nest lineraly with each evaluated form
15:50Bronsalinearly*
15:52mikerodBronsa: I see that they seem to clear out every so often
15:52mikerodbut there is a period where I see nesting building up. I was just observing in the REPL though, I didnt' go through the real compiler flow for it yet.
15:52mikerodI just kept eval'ing a loop that walks the parent chain
15:53mikerode.g. (loop [all [] c (.getContextClassLoader (Thread/currentThread)) p (.getParent c)] (if p (recur (conj all p) (.getParent p)) all))
15:54mikerodwoops
15:54mikerode.g. (loop [all [] c (.getContextClassLoader (Thread/currentThread)) p (.getParent c)] (if p (recur (conj all p) p (.getParent p)) all)) ; fixed
15:54machtyamalloy: so the compiler translates (a/x) to (b/y), and will eventually evaluate (b/y) within context of the "a" namespace, hence if b weren't globally loaded, things would break?
15:54amalloymachty: no, within the context of the c namespace
15:55amalloybut the rest of that is true
15:55machtyamalloy: yes sorry that's what i meant
15:55Bronsamikerod: the nested dcls you see are probably an artifact of nrepl. in a bare java -jar clojure.main repl I only see the AppClassLOader and an ExtClassLoader
15:55machtyit is possible for that to troll you in unexpected ways if you have a `b` defn'd in your same namespace?
15:56amalloymachty: only if you try very hard to be trolled
15:56amalloydefining a function named b certainly wouldn't do it
15:56machtywhy wouldn't it?
15:56amalloybecause b/y and b are totally unrelated thnigs
15:56machty(and what would?)
15:56amalloythe compiler won't confuse them, even if you do
15:57Bronsamikerod: weird, I see what you mean now. it definitely doesn't happen in a bare clojure repl. probably a bug in nrepl/reply or some other piece of the infrastructure involved in `lein repl`
15:57machtybut if your macro doesn't qualify w namespace?
15:57amalloymachty: you would have to write the macro to intentionally cause problems like this, and use some less-clever construct than syntax-quote
15:58amalloyno, ` makes sure the right namespace gets added in
15:59mikerodBronsa: ah ok, that makes sense then. I was curious since I didn't think that was the case in the typical clj repl as you say. I just wasn't thinking about the REPL that I actually was working with was "fancier"
16:00machtyamalloy: a HAH and if i used normal quote then it'd be the behavior i described. MAKES PERFECT SENSE. thank you
16:00amalloymachty: well you'd still have to do some dumb stuff for a normal quote to cause problems
16:00amalloyeg, (defmacro x [] '(b/y)) would be fine; it evaluates to the same thing
16:01amalloy(defmacro x [] '(y)) would be a problem, if c defined a different function named y
16:01amalloy(or didn't :refer to the y in b)
16:01machtyexactly, unqualified normal quote in a macro seems pretty dumb
16:01amalloymachty: it's generally a bad idea, but of course there are exceptions
16:02amalloyand the problems it causes will tend to be immediate and obvious (stuff refuses to compile) rather than sinister and delayed
16:05machtycool
16:09amalloymachty: if you are interested in some more in-depth material, http://amalloy.hubpages.com/hub/Unhygenic-anaphoric-Clojure-macros-for-fun-and-profit is an old blog post of mine that talks about macro hygeine (the perils of using a normal quote) and ends with a lovely macro that uses a normal quote to great effect
16:09machtyamalloy: very interested, will check it out
16:35dysfuni seem to recall a library on top of tools.analyzer that summarised the interesting things about a namespace. anyone remember what it was called?
16:35numberteni have an InputStream serving binary data and would like to write it to disk, is there a core function for this?
16:35numbertenlike a binary-spit or such
16:36stuartsierranumberten: I think clojure.java.io/copy will do that
16:36Bronsadysfun: maybe https://github.com/gfredericks/clj-usage-graph ? I don't know if gfredericks fully ported it from the old j.t.a to t.a.j though
16:37dysfunBronsa: sorry, i should have been more clear. i wanted a list of functions and types etc.
16:37dysfunprogrammatically
16:37dysfuni'm sure i've seen it before, but i can't remember what it was called
16:38dysfunif i were to write my own, i'm sure that'd be useful though
16:40RasterBu_derp.... wifi dropped me as soon as I left my question, so I'll ask again in case it didn't get posted...
16:40RasterBu_can somebody help me understand core.async.{tap,multi}? I think I fundamentally misunderstand something: https://www.refheap.com/95127
16:47numbertenstuartsierra: thanks :)
16:47llasramI just recalled that it's a bad idea to attach metadata to functions, but don't immediately remember why
16:47llasramAny hints?
16:48justin_smithRasterBu_: what if you either define a buffer for the channel or read from both taps? I am guessing you are seeing a backpressure issue
16:48RasterBu_i'll try that.
16:48RasterBu_thanks
16:48stuartsierraRasterBu_: mult blocks until *all* taps are ready to receive input. You probably want buffered channels for your taps.
16:48amalloyllasram: i can't think of a specific reason why it's bad, aside from "there are not many reasons it would be good"
16:48llasramamalloy: Heh. Fair enough.
16:49llasramI'm trying to better-adapt Clojure functions to the the abstract classes Mahout uses for its function classes
16:50llasramOne of the features of their classes is that they have methods for all sorts of fun properties like `isLikeRightPlus`
16:50stuartsierrallasram: metadata on function objects has a mixed history. Older versions of Clojure didn't support it, and the compiler doesn't use it. Metadata on Vars is more common.
16:51llasramstuartsierra: Yes
16:51amalloystuartsierra: really? functions haven't always been IObj?
16:51justin_smithllasram: how about a record that implements callable / runnable?
16:51llasramjustin_smith: Well, abstract base classes, and I'm trying to keep everything in primitive-land
16:52justin_smithdeftype?
16:52clojurebotdeftype is see datatype
16:52llasramMetadata initially struck me as a good fit, but in practice it's probably no more awkward than splatting in a separate (optional) map of parameters
16:52llasramjustin_smith: Nah. Tiny Java classes
16:53llasramstuartsierra: I didn't recall that older versions didn't support it. That's probably the reason I was half-remembering
16:53BronsaI recall metadata on functions messing with primInvoke or something
16:54liflashhi everybody, i'm trying to write tests for my reagent application. I always get the message ReferenceError: Can't find variable: React. If i additionally require more then cemericke.cljs.test, zero tests are ran. anybody any idea?
16:54stuartsierraThere was one version where some, but not all, Var metadata got copied to their corresponding function objects, which caused much confusion.
16:55amalloyBronsa: oh sure. i imagine it still does
16:55Bronsayeah
16:55amalloyllasram: that's a reason
16:55llasramThere we go!
16:55llasramYes, that was totally it
17:00OscarZim trying the example here (under Hot code reload) http://www.http-kit.org/migration.html
17:00OscarZgetting Unable to resolve symbol: defroutes
17:00OscarZi believe its in compojure
17:01OscarZi have included that as dependency in project.clj.. any ideas ?
17:02noonianyou would need (:require [compojure.core :refer [defroutes]]) in your ns declaration
17:03nooniani think their example ns declaration is wrong, :only is meant to be used with :use, you need to use :refer with :require
17:03EvanRblurg, #_( ... ) is not working so well as a multiline comment
17:03EvanRsome of the words inside are "invalid tokens"
17:04liflashOscarZ: +1 for noonian
17:06EvanRand " " doesnt work since i am using " in the comment
17:06justin_smithEvanR: oh, that sucks
17:06OscarZthank you.. it works.. now it doesnt find handler but ill find out where it is :)
17:06EvanR(the invalid token is OBX-1)
17:06OscarZis that some old syntax or just wrong?
17:06justin_smithcombo of #_( ... ) with ;; mixed in? still ugly
17:06justin_smith
17:06llasramEvanR: Yeaaaaah #_ isn't really meant for comments
17:06EvanRwell that would be every line of the comment
17:06llasramWhat's wrong with just `;` ?
17:07liflashOscarZ: just wrong i think
17:07EvanRwhich would work, i just have to put ; on many lines
17:07llasramEvanR: Your editor probably will do that for you :-)
17:07EvanRprobably
17:08EvanRwe also dont need functional programming because editors can copy and paste large blocks of code while substituting the variables ;)
17:09justin_smithEvanR: literate programming?
17:09llasramI think there's a pretty big difference between an simplifying editing in a syntax-correct fashion vs being all-but-necessary to edit in a semantics-correct fashion
17:09liflashany idea why no clojurescript.test tests are ran, when i require anything else then cemerick.cljs.test in the test file?
17:10cflemingamalloy: Thanks for the comments on that indentation issue, I agree
17:11amalloycfleming: well, bbatsov apparently doesn't. i'm not going to continue pushing, since clojure-mode circa 2012 still works great for me
17:11amalloyif everyone else starts indenting their code badly i guess that's just life
17:12cflemingamalloy: Yeah, I'd like to have the defaults aligned but as long as people are able to configure Cursive's indentation to match whatever Emacs is using that's enough - that default looks very strange to me
17:13cflemingamalloy: The reasoning too
17:14amalloycfleming: i mean, he's right in theory that -> and doto should be treated the same
17:14hiredmanugh
17:15hiredmanwe have a golden clojure-mode sha at work from 2012 aswell
17:15hiredmanstupid formatting changes
17:15cflemingamalloy: They pretty much are in Cursive - Cursive is aware of threading forms, so it'll indent your nesting cases correctly.
17:15amalloyhiredman: what sha, out of curiosity? mine is 66452816ebe11da025d9438bb9422dbf0f37d6c2 plus a few commits i've added on
17:17amalloyjustin_smith: https://github.com/amalloy/clojure-mode/commits/master
17:17amalloyyou don't have to save the sha by hand :P
17:17OscarZsome day i will learn how to use paredit :(
17:17hiredmanoh no, it is actually from march 2013 d4d3f5e672fdf2a5e5b2cbc1287d2b923b40f346
17:17TimMcHow does one use this hash?
17:18justin_smithamalloy: I use irc in my emacs, grabbing the sha string is easy
17:18justin_smithTimMc: clone the repo, check out that hash
17:18amalloyTimMc: i run clojure-mode from a git checkout, not melpa or whatever
17:18TimMcOh, the git hash, I see.
17:18hiredmanI think, I am not 100% sure that isn't something extra (the last 10 or more commits are all from people who were working here at the time)
17:19TimMcI'm on 2.1.0 from elpa or whatever.
17:19BronsaI froze it at 201ed7dc9b615cf8803acbc48711caa19156e6c0 from May 2014
17:20Bronsaafter that font-lock started changing
17:20amalloycfleming: https://github.com/clojure-emacs/clojure-mode/commit/ed533c94183319c9c332f240f2cf7c50045c0293 is funny, because i think that's actually the same "always 2 spaces" mode as cursive supports
17:20Bronsaand I couldn't read clojure code anymore
17:20amalloyemacs supports it but apparently discourages it
17:21justin_smithBronsa: when I was young and foolish I worked on an elisp varient with syntactically significant highlighting (the elisp that colored things also preprocessed the code before a scheme compiler hit it)
17:21justin_smithit was a "cool" idea, but a bad one
17:21TimMcD:
17:21justin_smithI mean python did significant whitespace, so why not significant hightlighting, right?
17:22hiredmanthe continual churn fest emacs clojure tooling has been since things changed fills me rage
17:22llasramjustin_smith: inspired by Color Forth?
17:22justin_smithllasram: partially, yeah
17:22turbofailhm. what other things can we make significant?
17:22justin_smiththat plus a youthful love of novelty
17:23justin_smith(inc TimMc)
17:23lazybot⇒ 84
17:23amalloyhiredman: "since things changed"?
17:23justin_smithTimMc: turbofail: a language where the semantics change based on the sha sig of your file
17:23amalloyturbofail: significant glances. emotion-sensitive indentation
17:23llasram*shrug*
17:24dysfunjustin_smith: you haven't discovered malbolge then?
17:24llasramI'm on the melpa-stable versions and they're pretty good
17:24justin_smith(inc amalloy)
17:24lazybot⇒ 207
17:24turbofailhow about compilation dependent on current gps-coordinates?
17:24TimMcoooh
17:24TimMc(inc justin_smith)
17:24lazybot⇒ 161
17:24turbofailit's location aware!
17:24TimMcSounds a little malbolge-like. :-)
17:24justin_smithdysfun: similar concept yes. I love that malbolge was cracked by an evo-algo coded in lisp)
17:24llasramThe switch to push all the hairy code into nREPL middleware was painful, but most of those bugs are gone
17:24TimMcturbofail: You can already do that in Clojure.
17:24dysfun"Weaknesses in the design have been found that make it possible (though still very difficult) to write useful Malbolge programs.
17:24turbofailTimMc: well you could do all of things things in clojure
17:25turbofailwell maybe not the significant glances part
17:25dysfunjustin_smith: a beam search :)
17:25justin_smithsignificant keypress timing - things you type faster are interpreted differently compared to things typed slower
17:25TimMcIt would not be hard to have a macro call out to the maxmind website or whatever and rearrange some stuff based on the response.
17:26hiredmanamalloy: since the revolution? I dunno, I don't feel entirely comfortable vilifying a person, and laying everything on a particular door (but I don't have other narratives to explain why everything is terrible now)
17:26justin_smithand things edited via search/replace or copy/paste would have yet another rule, of course
17:26amalloyfair enough
17:26dysfuni think we should just get over the idea that programming should ever be deterministic
17:27dysfunalthough i hear php's trying quite hard for that one
17:28turbofailsignificant key impact force. angrier typing causes more aggressive optimizations
17:28TimMcgoto rand()
17:28turbofaileven better if the aggressive optimizations aren't always correct, thus causing a feedback loop
17:29TimMcrage overflow error
17:30dysfuni presume we've all seen colorforth?
17:30dysfunhttps://en.wikipedia.org/wiki/ColorForth
17:31justin_smithdysfun: yupyup
17:31dysfun"the colors simplify forth's semantics" <-- lies
17:31dysfunnot that forth really has any semantics as such
17:31justin_smithdysfun: a friend of mine even got a chance to work with those crazy CPU matrix things Chuck makes these days
17:31dysfunguy's a nut
17:31justin_smithstill no C compiler, but it runs forth like a charm
17:32justin_smithguy is a nut that made a fun toy :)
17:32dysfunguess that's what reverse polish thinking does to you
17:33dysfunforth has some really interesting qualities though
17:34dysfunit's a complete nightmare to 'statically analyze' <-- haha, on forth!
17:34dysfunnothing so formalised as a function definition
17:51cflemingamalloy: Yeah, that looks like it
17:54tickingdysfun: Is forth really that hard to analyze, I would think that composition over pure functions that are of type Stack -> Stack as in joy would be quite formalizable
17:56mikerodI'm guessing leiningen cannot handle importing poms that manage dependencies?
18:04justin_smithmikerod: wait, so a pom can manage dependencies, as something separate from declaring them?
18:14mikerodjustin_smith: yes, a pom that's sole purpose is to have a dependencyManagement section that other poms can import in
18:14mikerodbut not directly inherit from
18:14mikerod- they have their own parent pom's etc
18:15mikerodit is for a specific set of dependencies that you want to have the same management for across modules - such as hadoop deps
18:24arrdemLast call for Grimoire complaints/requests sitting down on 0.4 now.
18:31romanandregquestion: is there any set datastructure that keeps items ordered by insertion?
18:32amalloy$google amalloy ordered set
18:32amalloyoh right, is google broken now?
18:32amalloythat stinks
18:33romanandregamalloy: I googled insertion order set clojure
18:33romanandregbut didn’t find anything useful (one library 2 years old, depending on clojure 1.4) :-/
18:33amalloyhttps://github.com/amalloy/ordered
18:33amalloyshould work fine on newer versions of clojure
18:35romanandregok… was hessitant to try it, but going to because you are here hehe
19:00brainacidhey all
19:00brainacidim totally lost
19:01brainacidvery
19:01brainacidr u telling me that I cant use lein or cojure without an internet connection? please clarify this doubt for me
19:02amalloybrainacid: lein has an offline mode
19:02mikeflynnWell lein will try to download any dependencies you need and it will need the internet for that.
19:02amalloybut you won't be able to download dependencies while offline
19:04brainacidI see
19:04brainacidso there is no base pkg for my hard drive?
19:04brainacidamalloy: oh thanks where can i find more info
19:04brainacidits been a little hard for me to find clear info, the raving about it is over the top
19:05brainacidI understand its an infant language but I aint no true l33t programmer so i need basic language lol
19:05amalloyhttps://github.com/technomancy/leiningen/issues/961
19:06brainacidany thoughts about Nightcode?
19:07amalloysounds like two words mashed together. pretty sure it's something to do with programming
19:07amalloyother than that, question is too vague to do anything with
19:07noonianbrainacid: the sample project.clj in the leiningen git repo has examples of most of leinigens options; as for nightcode i haven't really used it but its supposed to be an ide for beginners so definitely worth a shot
19:09brainacidhelp
19:09brainacidoops
19:11{blake}brainacid:Nightcode's okay but it lacks a lot of things you're gonna want. Its code completion isn't great.
19:12{blake}Aaand he's gone.
19:12brainproxyhe'll be back
19:12brainproxyneeds to become l33t
19:12{blake}Anyway, LightTable is probably a better bet.
19:26brainacidim still confused tho
19:26brainacidu mean i cant use a basic editor like nano and compile it to run?
19:26brainacidis this a language for gui applications
19:27brainacidi just cant seem to comprehend forgive me
19:27mikeflynnYou can use anything. I use Sublime Text for example and just compile with lein.
19:27brainacidbut if i do something i need a dependency for i need the net
19:27brainacidsee i dont have internet at home
19:28brainacidim at McDonalds right now on a shitty connection
19:28mikeflynnIf you declare a dependency in your project.clj file and you don't have locally, lein will go and get it for you.
19:28brainacidi see
19:28brainacidi have just heard that Clojure is great for women
19:28brainacidso im eager to see what its all about
19:29brainacidi have nightcode and lein
19:29brainproxybrainacid: might be a good idea to start w/ a solid book like Clojure Programming: http://www.clojurebook.com/
19:29mikeflynnThe best way to play with it is to simply play with the repl: lein repl
19:29brainacidi see
19:30brainacidwell lets see
19:30brainacidi have several books already
19:30brainacidit just doesnt seem quick in executing the program
19:31brainacidlol im so use to scripting python, perl and compiling C or running assembly
19:31brainacidthis is so bizarre to me
19:32brainacidi have the slightest clue about jvm
19:32brainproxybrainacid: so, it will be fast (probably) once it's up and running, but invoking lein and firing up a Clojure REPL does take a few seconds
19:33brainproxythe dev workflow for Clojure typically involves having an editor and REPL work hand-in-hand
19:33brainacidwell i mean my standalone jar file that Nightcode IDE just made for Hello World
19:33brainacidbrainproxy, so say im the editor in one terminal and lein repl in another?
19:34brainproxybrainacid: well you probably want an editor that can hook to the repl
19:34justin_smithyeah, clojure is not good for short lived programs. Just leave the repl running, reload you code, then run your main from the repl.
19:34brainproxyvim and emacs can do that, IntelliJ and others as well
19:34justin_smithyou can do that without editor integration
19:35brainacidjustin_smith, oh yes im just making some calculators and im not sure if a search utility can be done using this language
19:35brainproxytrue, editor integration isn't required, but it's a probably a good hurdle to go ahead and jump if one is serious about learning Clojure
19:35brainacidi was just attracted by self-modification and code as data
19:35brainacidstill dont know what that means
19:36brainproxycode as data -- your clojure programs are a bunch of s-expressions, which are basically lists of symbols
19:36brainacidmmm interesting
19:36brainacidbrainproxy, whats a good editor integrated with repl?
19:36brainproxybut data in your programs is also typically represented with s-expressions
19:36brainacidi run console linux
19:37justin_smithbrainacid: self modification is the fact that the compiler is part of your program - that's why you can reload everything in the repl and execute again without restarting
19:37brainproxyhence, code is data is code
19:37brainacidreally try to stay away for X windows
19:37crispinemacs runs in terminal
19:37brainacidjustin_smith, so interesting
19:37crispinbit of a learning curve, but worth it in the end
19:37brainacidcrispin, can clojure be intergrated into emacs?
19:37{blake}heh
19:37justin_smithbrainacid: so we typically just leave things running and redefine parts of the code instead of restarting
19:38justin_smithwhich is part of why startup takes so long too - you are loading up the whole compiler, and even compiling parts of it, on each startup
19:38brainacidmmm...this is beyond me
19:38brainacidand I though assembly was hard lol
19:38crispinbrainacid: yep. emacs internally uses elisp, but you dont need to expose yourself to that
19:38brainacidso after all this im still lost, so please forgive me
19:38{blake}Assembler is easy, just slow. Clojure is hard--but fast.
19:38brainacidok crispin
19:39crispinjust install clojure-mode and cider
19:39brainacid{blake}, hi again
19:39brainacidok
19:39justin_smithbrainacid: the concepts may seem esoteric, but in practice the workflow is pretty simple- you reload some definitions, run a function, redefine things, run it again, interactively like in the shell
19:39crispincider is the interactive debugger thing
19:39brainacidonce i get good bandwidth i will get clojure-mode cider and emacs
19:39brainacidjustin_smith, ahh
19:39brainacidso all i need is a basic editor to type some code then paste into repl?
19:40brainacidor type into repl as well
19:40crispinthere is a series of posts online that take you through emacs and clojure
19:40crispin"clojure for the brave and true"
19:40brainacidcrispin, sweet, thats for tomorrow since i cant get it now
19:40{blake}brainacid: Yep. Generally you'll go back and forth between editor and REPL.
19:40justin_smithright, or you can skip the editor integration and just use paste - sometimes that is actually simpler
19:40brainacidso can I run the clojure jar file directly
19:40crispinexcept you will launch emacs as "emacs -nw" (nw = no window. ie. terminal mode)
19:41crispinbrainacid: yep
19:41brainacidjar -jar clojure1.6.jar
19:41brainacidcrispin, good deal
19:41justin_smithcrispin: I am hesitant to recommend cider to newcomers, it breaks a lot
19:41crispintheres also a cool lein plugin lein-bin that will make a self executing binary
19:41crispinjustin_smith: what does it break?
19:41justin_smithcider itself breaks frequently
19:41brainacidmy apps are probably 30 lines in C and maybe 75-100 in assembly so im sure Clojure it would be one function
19:42brainacidlol
19:42crispin"binary". actually a self running jar. so you can go ./my_prog
19:42crispincider only was a problem for me when Id also installed the old nrepl
19:42crispinonce I only installed cider, there was no problem
19:42justin_smithcrispin: do you ever update cider?
19:42crispinI mean you can always not use cider if its a problem, and just use a compile loop
19:43crispinhavent updated in a while
19:43crispinthe hard thing about emacs is not cider so much, its the non standard key bindings
19:44crispinbut once youve got over the hump... its ok
19:44brainacidwell
19:44brainacidim running repl straight in terminal
19:44crispinideas like the kill-ring are awesome, but if you're only used to cut and paste, a bit out there
19:45crispinyeah and you can jack-in to a terminal repl too
19:45crispinthen, once you got the hang of emacs, learn "paredit" and install "rainbow-delimiters"
19:46justin_smithafter a recent cider lockup, I am just using inferior lisp and skipping cider entirely
19:46crispinand code editing becomes super powerful
19:46amalloyjustin_smith: i run SLIME from a git checkout too :P
19:46crispini mean you can foobar cider sure, like, evaluate an infinte lazy sequence
19:47kenrestivoi have a question about propagating state. i have some state ref, i need to update it from multiple sources, and propagate the changes to all the *other* sources, but not in a loop back to the originating source
19:47crispinthen press Ctrl-G to break out
19:47justin_smithcrispin: this was a datomic query with more results than I expected, froze my emacs solid for about 10 minutes, finally I had to kill it
19:47justin_smithit wasn't lazy or infinite
19:47crispinhaha yeah. try ctrl-g
19:48crispinas with emacs, its always 'what frikking keypress was that thingie;
19:48justin_smithI know about C-g, and C-c C-c and C-c C-b and these are things I only need because of cider
19:48crispinwell... ctrl-g is more than just cider
19:48kenrestivoadd-watch doesn't have any way to do this. i thought about maybe hacking something together with core.async channels perhaps, but not sure. any examples of how someone has done a similar thing using clojure ref types, channels, etc?
19:48amalloyjustin_smith: oh, i didn't know about C-c C-b
19:48crispinsay youre emacs buffer is taking ages to render
19:48crispinc-g
19:48crispingeneral emacs stop-what-your-doing
19:49crispinkenrestivo: are these multiple threads?
19:49kenrestivoyes
19:49justin_smithc-g my point was, my machine is beefy enough that I don't have to interrupt anything else like that, except cider
19:50kenrestivomultiple threads, multiple future loop/recurs and async/go-loop's, all updating a single ref backing a map, with the state. everyone sending updates also needs to know what updated.
19:51crispinyeah, i would say its not a cider thing, but an emacs thing. For instance, a single line file thats hundreds of thousands of chars wide, with line wrapping, and then do some formatting
19:51crispinhang
19:51crispinelisp is not the fastest
19:51justin_smithcrispin: the same query inside inferior lisp took a while but did not hang emacs the way cider did
19:51crispinkenrestivo: what about watchers?
19:52kenrestivoadd-watch doesn't have any way i can tell to identify *where* the update came from
19:52crispinyeah watchers should be avoided
19:52brainacidok got syntax highlighting on gedit and have repl running
19:52crispincan you push down the async channel the value, and where it came from?
19:53crispinor what if each source was a different chan, and then use alts! to switch
19:53crispinthen you can tell where it came from by which chan it came over
19:53crispinalts! returns a chan, val pait
19:53crispinpair
19:54kenrestivothat's kind of where i was headed. but it feels like i'll run into trouble.
19:59crispinkenrestivo, if the consumer spwans the agents that communicate back to it, the consumer could create the (chan) and then pass it to the agent to communicate back to it with
20:01brainacidthanks for all the help
20:01brainacidi will start somehow
20:01NoCreativityhello people! I have some data here and I want to organize some data I have here but I dunno if there is a good and easy way to do it.
20:01brainacidnil is nil
20:01brainacid:)
20:01brainacidlater
20:02NoCreativityI want to turn this [ {:g [{:id 15}], :id 216} {:g [{:id 2}], :id 216} ] in {:g [{:id 2, :id 15}], :id 216}
20:02amalloy{:id 2, :id 15} is not a valid object
20:02NoCreativityopps
20:02NoCreativitySorry
20:03NoCreativity{:id 216 :g [{:id 2} {:id 15}]}
20:04NoCreativityI would appreciate any help or tip
20:04kenrestivoyeah, it's kind of like, instead of using add-watch, i write my own source-aware watcher, loops checking incoming channels, processes the input and swap!'s the atom, then doseq's sending the change to everyone else.
20:08amalloywhat do you plan to do if there are more top-level ids than just 216, NoCreativity?
20:09NoCreativityI wanted to take the duplications and merge their :g
20:09amalloyso you can't produce {:id 216 :g [{:id 2} {:id 15}]}, is what i'm getting at: you need a list of maps, or a map of maps, as your output
20:10amalloybecause {:id 215 :g [...] :id 216 :g [...]} is just as illegal as the other thing
20:10kristofgross
20:10NoCreativityYou mean
20:11NoCreativityThe top :id can conflict with the one inside :g {} ?
20:12NoCreativity{:id 5 :g [ {:id 1} {:id 2} ] }
20:12amalloyno, of course not. look at the example output i gave. you see why that's impossible, right?
20:13amalloyit's a map with the :id key twice, and the :g key twice
20:13NoCreativityAh
20:13NoCreativitysorry
20:13NoCreativityI got it
20:13NoCreativityYeah, you are right
20:13NoCreativityAnd you are right. I want a list of maps.
20:13NoCreativityEven a set
20:13NoCreativityset of maps
20:13amalloyokay. then it's not super hard
20:14crispinNoCreativity: does this help: http://stackoverflow.com/questions/9089200/clojure-group-by-by-multiple-keys
20:15NoCreativitycrispin: Let me check
20:16crispinmaking the output {:id [1 2]} instead of [{:id 1} {:id 2}] may be easier
20:16amalloyNoCreativity: so you just want something like https://www.refheap.com/fa03b31d7b7fe214bf0ca3df9
20:18NoCreativityamalloy: Cool! I will try it!
20:18arrdem$mail andyf is there an eastwood config for adding all the linters?
20:18lazybotMessage saved.
20:20crispinamalloy: TIL fnil. thanks
20:25NoCreativityamalloy: Cool! thanks for the help! I will study this stuff! Thinking in functional is still too different for me.
20:25NoCreativitycrispin: Thank you too!
20:28rritochNoCreativity: Looking at the solution you've been given, that doesn't verify that the primary key (:id) is the same, it is just merging all :g's
20:28rritochNoCreativity: Take a look at this code. https://github.com/rritoch/clj-grid-kernel/blob/master/src/com/vnetpublishing/clj/grid/lib/grid/util.clj#L39-L60 It was made for a different problem but is very similar
20:29rritochNoCreativity: In that case they wanted to turn non-array keys into arrays if the keys matched
20:30rritochNoCreativity: I believe you would need to apply this as your reduce function though, since this was designed to merge in one item at a time.
20:31NoCreativityrritoch: Thank you for the link too. You said primary key, =]. Im trying to play a bit with Relational databases. The functional way of thinking is still a bit different for me so the functional amalloy gave me was a good point for me to think. I will check you link too.
20:31NoCreativityI will need to leave here. Thank you for the help.
20:48hydois there a way to get a static enum from a string? I'd like to go from "Thing" to Class/Thing. Is it some combination of (symbol?
20:52hydoah ha! found it. Nothing like asking a question to help you find it immediately. Kinda like lighting a smoke while waiting for a bus.
20:52tufthydo: whichever way java does it should work fine
20:52tufthehe, indeed
21:06ddimahm, if I have a Namespace object in a var, is there a better way to switch to it than (in-ns (symbol (str my-ns)))? pretty sure there is, but couldnt figure it out yet.
21:06justin_smithddima: why do you call both symbol and str on it?
21:06justin_smith,(.sym *ns*)
21:07clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: sym for class clojure.lang.Namespace>
21:07justin_smitherr
21:07ddimawell, thats the only way I got it to work, as it does not cast to symbol directly
21:07chouser(set! *ns* my-ns)
21:07justin_smith,(.name *ns*)
21:07clojurebotsandbox
21:08justin_smithchouser: oh cool, I had no idea that worked
21:08chouserI don't know if I'd recommend it or not. *shrug*
21:08ddimaah, thanks. looks slighly evil ;)
21:08ddimaI basically want to eval some code in a dynamically built namespace with specific bindings
21:09ddimaso maybe I could just bind [*ns*] instead of set!
21:10ddimaactually seems to work too
21:10chouserThat sounds slightly less scary.
21:10ddimabasically just wondered why in-ns doesnt, it has the nice advantage of creating if its not there
21:10ddimabut who expects comfort when doing shit like that anyways ;(
21:10ddimaerr, ;)
21:10chouserthat's all in-ns does. Creates the ns if it doesn't exist, then sets *ns* to it.
21:11justin_smithddima: (in-ns (.name my-ns)) will work too
21:12ddimaah, nice to know too. thanks!
21:12chouserDefinition of in-ns: https://github.com/clojure/clojure/blob/05af4b52a474bc60d2eb931e388b302c14edc884/src/jvm/clojure/lang/RT.java#L235
21:13ddimaI only looked at namespace.java before, didnt get to RT yet ;)
21:29rritochddima: Storing namespaces in var's could get ugly, if remove-ns is called than you would be holding a namespace object that is no longer connected to the runtime. The second solution by justin_smith is better (in-ns (.name my-ns)) but the best solution would be to just store the name of the namespace in your var (.name some-ns-obj)
21:31rritochddima: Holding a namespace in a var will keep it from getting garbage collected, effectively creating a potential memory leak.
21:35ddimaits just within a closure on not on some global scope, so I guess that should be fine. but good pointer!
21:35ddimas/on/and
21:37ddimavar was wrong in the case
21:42ddimaso basically s/Var/local, terminology slipup ;)
22:08ddimabut its toying around anyways, so nothing too critical - basically I'm sketching out the design for a small tool with scripting support and due to lazyness am using clojure for that atm (but with some comfort/standard functions, thats why I want dynamically built namespaces), before pluggin in rhino or somesuch.
22:08rritochIs it possible to delete all thread-local data in java? I'm still trying to figure out how the ns macro breaks out of the isolation, and the only possiblity I can think of would be if the thread-local memory was wiped out. That would cause the InheritableThreadLocal data to re-initialize to the root namespace.
22:09kenrestivoclojure.tools.namespace/refresh ?
22:09kenrestivosorry, clojure.tools.namespace.repl/refresh
22:14rritochkenrestivo: Interesting, so it may be the REPL wiping out the isolation? I haven't considered that option. I've just been digging throught the macro-expansions and coming up empty.
22:15kenrestivoit's kind of a shot in the dark, but i figured why not mention it.
22:15rritochkenrestivo: It is a good idea, I didn't even consider the possiblity that the REPL was involved.
22:28ddimamaybe http://dev.clojure.org/jira/browse/CLJ-1125 gives some pointers
22:29ddima(at least sounds vaguely related)
22:29andyf /whois arrdem
22:30TimMcA question for the ages.
22:31andyfOops. arrdem: there is no short Eastwood command to enable all linters. There is the long one of specifying all of their names, and you should be able to type that once and put it in your project.clj
22:32andyfI will create an issue to remind myself to make an all linters option that is short to type, but the ones disabled by default you might soon learn why they are
22:32rritochWell, it hasn't been a complete loss. I always assumed transactions were run in a separate thread (such as dosync). Digging through the code it seems that isn't the case.
22:33rritochI'll need to run some tests outside of REPL to see if the REPL is the culprit.
22:35rritochI certainly haven't found any code that attempts to delete threadlocal memory, but dosync utilizes threadlocal memory. Another possiblity is that I've run into a java bug, possibly a conflict between using ThreadLocal and IneritableThreadLocal at the same time.
22:37rritochI find it odd that Clojure doesn't use ineritablethreadlocal anywhere, which makes me think there is an issue with it that I'm not aware of.
22:41ddimarritoch: there seems to be something on Var for that: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Var.java#L328
22:41ddima(just decided to poke around a little too, to get a better sense for the runtime)
22:42rritochddima: Yes, I've seen that, I was originaly thinking of using vars for the implementation until I saw the InheritableThreadLocal which seems much simpler.
22:43rritochddima: It seems that clojure deliberatly avoided using InheritableThreadLocal, and I don't know why. It is possibly why the namespace isolation feature I made is getting broken since it realies on the inheritablethreadlocal.
22:43ddimayeah, looks as if it was considered but left unused.
22:46rritochddima: Everything I see regarding this issue is regarding memory leaks, but memory leaks and thread-pools aren't the current issue since as far as I can tell the ns macro never triggers another thread.
22:48ddimayeah, I just meant might be a pointer to start checking how threadlocal might be handled in some places to look further - that's what I did, not knowing the codebase well at all ;)
22:48rritochddima: Though, maybe oracle/openjdk have been toying with solutions for the memory leaks that are causing my inheritablethreadlocal to get wiped out.
22:48ddimamaybe, try some older versions, quicker to test than wading through the code
22:51rritochddima: I think I may have found the problem.
22:51rritochhttp://stackoverflow.com/questions/7296623/inheritablethreadlocal-and-thread-pools
22:52rritochIf clojure is doing something similar to that, maybe that is why my data is getting wiped out.
22:53rritochI can't find any refrences to ThreadPoolExecutor in clojure though :(
22:55rritochI guess attempting to re-implement this without an inherritablethreadlocal may be the way to go. I looked at the REPL code and that may present some challenges to namespace isolation, but I don't see how that could completely break the isolation.
23:00ddimagood luck, I need some sleep ;)
23:07babu`macos: lein install from brew. When you run lein you get java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword. googled and didn't find any solution. java -version ==> java version "1.7.0_71"
23:07justin_smithbabu`: lein is a single shell script, you don't need brew to get lein
23:08justin_smithand it's easier if you don't use brew, inf fact
23:08justin_smith*in
23:16rritochDoes anyone know how var's are inheriting values from parent threads? I've yet to find any code which seems to create this behavior.
23:17rritochThe following code prints foo=1 which shows vars are being inherited, I just haven't found how. (do (def ^:dynamic foo) (binding [foo 1] (future (Thread/sleep 3000) (println (str "foo=" foo)))))
23:19justin_smithrritoch: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Var.java#L312 this method, and the one right after it, are probably what you want
23:20justin_smithlooks like it is related to static final ThreadLocal<Frame> dvals
23:20rritochjustin_smith: I've looked at that code, but I still don't see it. That code pushes the new value onto the "linked list" of frames.
23:21babu`justin_smith: Before I tried brew I had downloaded lein.sh. I get the same error.
23:21rritochjustin_smith: But the ThreadLocal initializes to TOP which is an empty frame.
23:21justin_smithand then getThreadBindings uses the same linked list of frames
23:21justin_smithbabu`: what lein version?
23:23rritochjustin_smith: As far as I can tell, this code here would execute for any new thread created. https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Var.java#L69-L71 So every thread would have it's own (separate) bindings.
23:23rritochjustin_smith: What I'm not seeing is how bindings are making it into child threads.
23:23babu`justin_smith: The lein.sh has: export LEIN_VERSION="2.5.0"
23:26justin_smithbabu`: and just running "lein help" or "lein repl" gets that error?
23:26justin_smithtry deleting ~/.lein/
23:26justin_smithor temporarily moving it asid
23:27justin_smith*aside (sorry, vino)
23:27babu`justin_smith: yes. In ~/.lein/self-installs there was leiningen-2.5.0-standalone.jar. I renamed it and ran lein.sh. It downloaded leiningen-2.5.0-standalone.jar but I get the same error.
23:29rritochjustin_smith: I think I just found it. Var bindings aren't transported by var, they're transported by the future function
23:29rritochhttps://github.com/clojure/clojure/blob/clojure-1.6.0/src/clj/clojure/core.clj#L6416
23:29babu`justin_smith: renaming ~/.lein and running lein worked.
23:30justin_smithbabu`: awesome, likely the config got into a corrupt state
23:30justin_smithit may be worth archiving the contents of the dir and sharing that with the lein team - did anything happen that could have led to a partially configured / partially installed setup?
23:32rritochjustin_smith: It looks like I really will need to piggyback on the var's instead of using InheritableThreadLocal. I had originally considered using vars but they have a lot of extra functionality that isn't needed for isoalting namespaces.
23:32babu`justin_smith: In ~/.lein there was a profiles.clj with :plugins [[cider/cider-nrepl "x.y.z"]] {:user {:plugins [[cider/cider-nrepl "0.8.1"]]}} [mies-om/lein-template "0.4.1"]
23:32justin_smithyeah, that is totally invalid
23:33justin_smithprobably hand edited and you made a mistake? or did some tool mangle it?
23:33babu`justin_smith: It will be good to have a better error message than "java.lang.IllegalArgumentException: Don't know how to create ISeq from ..."
23:34babu`justin_smith: No I didn't hand edit it. Installed cider package in emacs.
23:35justin_smithbabu`: extremely nonhelpful error messages are so common in the clojure world...
23:35justin_smithbabu`: sounds like an error report for whatever cider packager you tried to use I guess
23:37babu`justin_smith: thanks for your help.
23:37justin_smithnp