#clojure log - Dec 18 2014

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:24 bbloom: amalloy: kebab-o

0:24 abhjira: Hi! 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

0:27 Oh, looks like I am using the quote macro as opposed to quotes, I think I see the solution

0:27 (line-by-line "/tmp/hi") instead of (line-by-line '/tmp/hi) or (line-by-line '/tmp/hi')

0:38 ddima: abeaumont: you are right, there's only double-quotes for strings and backslashes for characters (unlike python, which just supportes single-ticks and quotes)

0:38 -e

0:38 anyways, gn8

0:46 FriedBob: Kinda bummed, just saw that the clojerks meetup was last week, not this week

1:08 Aww, 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

1:11 rhg135: Hmm work vs clojure

1:11 FriedBob: clojure ftw win

1:12 I'm debating more beer + clojure, or sleep

1:12 rhg135: Sleep is over hyped

1:13 FriedBob: Indeed

1:14 I'm finally adjusted to Pacific time, it doesn't feel like midnight right now.

1:57 cloudsaja: Hi all, noob question ... I see variable marked with '*' character before and after the variable name. What is the meaning of those ?

2:02 ffwacom: It's a convention for vars that can be rebound

2:05 Global or config values like database connection string or stdout

2:05 Lookup binding function

2:50 rhg135: ffwacom: don't even joke about global mutable state

3:00 justin_smith: ,(def ^:dynamic foo "some thread local value")

3:00 clojurebot: #'sandbox/foo

3:02 justin_smith: ,(def *foo* "should be thread-local")

3:02 clojurebot: #<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)>

3:03 justin_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

3:03 $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

3:03 lazybot: Message saved.

3:05 justin_smith: rhg135: 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)

3:06 rhg135: Lol

3:06 Expect nothing

3:08 justin_smith: The language has thread local mutation of global values as a fundamental mechanism. It sometimes sucks, but the language is designed around it.

3:09 pr, print, prn, println, clojure.pprint/pprint, with-out-str

3:09 rhg135: Have you read the ghc source, it could be worse

3:10 justin_smith: But this isn't just clojure source, it's the clojure api.

3:12 rhg135: I don't really use them

5:02 tangrammer: Hi folks, I’m working in customization sturtsierra component systems utility and just wanting to know if anyone is using this stuartsierra feature too

5:04 clgv: tangrammer: there are definitely some users of it, according to what one can read here and on the ML

5:05 though there are also alternative approaches that were inspired by the component library

5:06 tangrammer: clgv: Hi and thanks for answering, I’m interested in which types of customization were being used

5:07 clgv: due that I implemented co-dependency https://github.com/tangrammer/co-dependency and aop https://github.com/milesian/aop

5:08 clgv: and was trying to develop a customization pattern that decomplects component/start from others system updates https://github.com/milesian/BigBang

5:08 clgv: tangrammer: ah, you are that guy ;)

5:09 tangrammer: clgv: I suppose :) and who are you then?

5:10 clgv: tangrammer: on github you mean? since I only remembered reading the announcement of "aop" on the ML ;)

5:11 tangrammer: clgv: ok, I got it

5:11 clgv: btw, what do you mean with “ML”?

5:11 clgv: mailing list

5:14 tangrammer: clgv: btw again, what do you think about this milesian/aop stuff? I’m really interested on feedback

5:15 clgv: tangrammer: I didn't use the component approach, yet. just read about it several times.

5:15 TEttinger2: Raynes, justin_smith: this is new.

5:15 $google anything

5:15 $ping

5:15 lazybot: TEttinger2: Ping completed in 0 seconds.

5:16 clgv: $google something

5:16 $google clojure

5:16 TEttinger2: the results string refers you to https://developers.google.com/custom-search/

5:16 because the search API is no longer supported

5:16 clgv: ah damn. plugin upgrade^^

5:16 TEttinger2: 100 searches a day for free, how generous of you

5:17 DDG has an API!

5:17 https://ddg.gg

5:17 short for https://duckduckgo.com/

5:19 tangrammer: clgv: thanks, are you working with cljs maybe?

5:20 clgv: tangrammer: no. plain old clojure ;)

5:21 tangrammer: clgv: can i see your github work? just curiosity ;)

5:25 m1dnight_: 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

5:26 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?

5:26 So I could just use the java LinkedHashSet

5:26 https://gist.github.com/shinmuro/9338262 I'm looking at something like this

5:28 dysfun: tangrammer: 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.

5:31 justin_smith: TEttinger: yeah, it would be nice to add a $ddg plugin

5:31 tangrammer: dysfun: sounds really pretty but tangrammer mean that I like to imagine my code is like a https://www.google.co.uk/search?q=tangram&biw=1918&bih=1102&tbm=isch&tbo=u&source=univ&sa=X&ei=KKySVJOsFsPxaOnlgrgJ&ved=0CD0QsAQ

5:32 dysfun: tangrammer: i think my code looks like that rather too often :)

5:32 rhg135: TEttinger: challange accepted

5:33 noncom|2: m1dnight: what about using a proxy?

5:36 TEttinger2: one of the better free APIs these days is http://www.faroo.com/hp/api/api.html

5:39 noncom|2: m1dnight: 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

5:44 dysfun: i suspect that's open to opinion

5:44 though i much prefer short names

5:47 justin_smith: noncom|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

5:49 noncom|2: justin_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

5:56 ffwacom: https://pbs.twimg.com/media/B5HA7_CCQAAz28Y.jpg:large

6:14 TEttinger2: hm, looks like yacy returns almost entirely spam...

6:15 Empperi: is it possible to execute arbitrary code with leiningen via :injections ?

6:15 TEttinger2: I wonder if yandex has a free API

6:15 Empperi: it seems like my code isn't executed

6:15 it's like it wouldn't care about :uberjar profile at all

6:31 clgv: Empperi: you want injections to work in the compiled uberjar?

6:32 Empperi: I want to execute some code which generates stuff into target/classes

6:32 before the actual uberjar is created

6:32 clgv: Empperi: write a hook for the "uberjar" task

6:32 Empperi: :injections is the wrong thing for that

6:32 Empperi: hmm

6:33 so like :hooks [my-thing/do-the-stuff]

6:33 hyPiRion: Empperi: :injections are only used for forms evaluated in the project. Jar and uberjar does neither

6:33 does not do that*

6:34 clgv: Empperi: yes

6:35 Empperi: I wonder if it would work if I just wrote :hooks [(fn activate[] #_mycode)]

6:35 :P

6:35 clgv: Empperi: the namespace you provide there, should contain a (defn avtivate [] ...) where you use robert.hooke on the needed functions (probably "uberjar")

6:35 Empperi: you can check the leiningen source ;)

6:36 Empperi: but probably not

6:40 noncom|2: once i get a ProcessIml class instance by doing (.exec (Runtime/getRuntime) my-command) - then how do i read its output ?

6:40 *ProcessImpl

6:41 i 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..

6:42 basically i just want to get what the command returned

6:42 and if it opened a prompt of some kind, write into it

6:42 (like an ssh connection)

6:44 TEttinger2: rhg135, in case you haven't noticed, DDG's API only returns instant answers, of which it frequently returns nothing

6:54 ffwacom: can I ask you guys something personal?

6:54 * dysfun gets popcorn

6:55 llasram: *snork*

6:55 dysfun: Thanks, that coffee goes down the lungs great

6:56 ffwacom: do you ever wonder if we are propelling humanity faster into a machine war with the greater expressiveness of lisp based languages and functional paradigms?

6:56 if we could stave off an AI escalation session by even 1 month

6:56 clgv: O_o

6:56 llasram: ffwacom: no

6:56 clgv: o_O

6:56 ffwacom: isn't it worth it to abandon clojure and go back to less expressive languages?

6:56 dysfun: llasram: you're welcome :)

6:57 clgv: :P

6:57 Empperi: clgv: had to grab a quick lunch

6:57 ffwacom: and finally, won't someone think of the children? what will be our legacy?

6:57 Empperi: so, can I write a hook without writing a separate leiningen plugin?

6:57 clgv: Empperi: uhm good question.

6:57 dysfun: me also wonders what defines 'personal' in ffwacom's world

6:58 (with added / )

6:58 Empperi: clgv: because that's exactly what I don't want to do

6:58 clgv: ffwacom: the promises of AI from the sixties are still unfulfilled. so no worries on that terminator scenario ;)

6:58 Empperi: since it'll make our build more complex for no reason

6:58 ffwacom: dysfun: we are all in this together

6:58 Empperi: this stuff is relevant for only this project

6:58 ffwacom: clgv: they were nieve

6:59 dysfun: clgv: i hear grey goo is what we're supposed to fear now

6:59 Empperi: if 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

6:59 ffwacom: clgv: http://40.media.tumblr.com/dff4132c50ad8b75ba333c11c783cd78/tumblr_nf41ewhm9p1tl21beo2_1280.jpg

6:59 clgv: Empperi: so the code of the plugin must get on the classpath of leiningen.

6:59 Empperi: and write custom handling for reading from there

6:59 dysfun: ffwacom: 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

7:00 clgv: Empperi: when you use :plugins that is take care of.

7:00 Empperi: also it seems like :hooks are ran before any compilation is done

7:00 ffwacom: dysfun: It helps humanities communication immune system

7:00 Empperi: thus it doesn't know anything about code written as hooks in the same project

7:00 ffwacom: dysfun: might as well have an arms race until the real threat appears

7:01 clgv: Empperi: yeah. you got to use robert.hooke or similar to hook your code to the tasks where you need it

7:01 ffwacom: which is CYBERWAR

7:01 Empperi: this is a stupid limitation I have to say

7:01 all I want to do is execute 3 lines of code before uberjar is created

7:01 dysfun: ffwacom: 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

7:01 ffwacom: dysfun: yeah fair enough

7:01 Empperi: but guess I'll go with the tempdir solution

7:01 ffwacom: dysfun: didn't really make sense did it

7:01 Empperi: and forget about doing this at compile time

7:02 TEttinger: can I ask you guys something personal?

7:02 ffwacom: dysfun: tried to recover by capitalising cyberwar

7:02 TEttinger: do you think that lispers make better coffee than java programmers, making the name "java" unintended irony?

7:02 dysfun: ffwacom: best get a blog and explain it properly

7:02 ffwacom: TEttinger: this isn't your blog

7:02 Empperi: clgv: thanks for your help

7:02 dysfun: TEttinger: only if i can ask you something impersonal

7:02 clgv: TEttinger: lispers have to make their coffee themselves? O_o we got a machine for that ;)

7:03 Empperi: glad to help

7:03 kungi1: g

7:03 dysfun: clgv: my bean to cup machine broke. we use a french press now.

7:03 TEttinger: I like my aeropress but I just take a half of a no-doz when I need caffeine these days

7:03 noncom|2: did anyone ever use https://github.com/Raynes/conch ?

7:04 clgv: noncom|2: yeah. though it was quite a while ago

7:04 TEttinger: or 1.5 no-doz (300mg caffeine, or 2-3 cups strong coffee) right before a half-hour nap

7:04 dysfun: if aeropress satisfies you, you don't really have a coffee habit. not enough quantity

7:04 noncom|2: clgv: so i do => (sh/let-programs [lein "c:\\Users\\user\\.lein\\bin\\lein.bat"] (lein {:in "uberjar"}))

7:04 TEttinger: dysfun, do french presses make more?

7:04 dysfun: i'm on my third litre of coffee already

7:05 TEttinger: my french press makes a litre in one go

7:05 TEttinger: you can send coffee through an aeropress instead of water

7:05 making supercoffee

7:05 clgv: noncom|2: not sure about the map syntax, I used strings for the arguments back then

7:05 ffwacom: TEttinger: just buy modafinil

7:05 TEttinger: it's coffee without the side effects

7:05 dysfun: ffwacom: it is not without side effects here. i used to take it daily

7:06 ffwacom: dysfun: what happened?

7:06 what mg, your weight etc?

7:06 noncom|2: clgv: and it prints out just the standard lein output, like i did not pass uberjar to it

7:06 why? :)

7:07 dysfun: 200mg/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

7:07 noncom|2: i 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 ?

7:07 ffwacom: dysfun: what quality of life issues?

7:07 dysfun: became difficult to go to sleep for one, and i felt permanently stimmed up

7:07 and i felt like i was going to have a heart attack quite frequently after about 3 months

7:07 clgv: noncom|2: what about (lein "uberjar") ?

7:08 ffwacom: dysfun: ah that sucks

7:08 noncom|2: like, i develop my project and then just type (deploy) in the repl, and it does all

7:08 clgv: noncom|2: isn't :in for standard input the program gets? but "uberjar" needs to be a cli arg

7:08 dysfun: ffwacom: these days i tend to pop one every few weeks if i want to have a clean flat

7:08 ffwacom: armodafinil or modafinil at 200mg?

7:08 heh

7:08 TEttinger: I take vyvanse now, which is similar to modafinil in concept (long acting adderall substitute instead of long acting caffeine/amphetamine substitute)

7:08 dysfun: modafinil. armodafinil was weird

7:09 ffwacom: fair enough

7:09 noncom|2: clgv: heeeey, that worked! :)

7:09 clgv: noncom|2: you could use leiningen as library though, to avoid the indirection

7:09 TEttinger: I definitely feel more clear-headed when vyvanse is in my system, which to some extent is all the time

7:10 it helps me focus for hours, it just sometimes makes me robotic in my work ethic

7:10 ffwacom: 120mg armodafinil @ 70kg fucks my sleep, but been on 60mg and it's ok

7:10 noncom|2: clgv: true, i guess i will go into it after some time. now just need the basic pipeline to work

7:10 ffwacom: don't take it every day though

7:11 I don't take it every day*

7:12 noncom|2: the 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.

7:13 ffwacom: yeah being healthy and getting a good rest makes the most difference

7:13 problem is it's not a silver bullet crushed into a pill

7:15 noncom|2: i find the restructurizations of CNS caused by long-term use of stimulants to be non-profitable in the long run..

7:15 however... who knows :)

7:17 TEttinger: vyvanse apparently doesn't act like stimulants, it isn't categorized as one

7:21 noncom|2: ummm http://en.wikipedia.org/wiki/Lisdexamfetamine

7:24 TEttinger: vyvanse 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

7:24 it's categorized as a prodrug, which is a confusing term

7:25 ffwacom: dextroamphetamine was everywhere in uni

7:27 clgv: ,(deref nil)

7:27 clojurebot: #<NullPointerException java.lang.NullPointerException>

7:27 noncom|2: yeah, 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

7:27 clgv: you need some for "deref" it is not nil friendly...

7:27 noncom|2: in my country however, vyvanse is not available

7:28 clgv: *"some->"

7:28 TEttinger: I 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

7:28 ffwacom: small doses of modafinil is the best I've found

7:28 non addictive, non euphoric

7:29 TEttinger: vyvanse isn't euphoric for me

7:29 and I may be developing a tolerance, but more likely the dose was too low to begin with

7:29 dysfun: half 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

7:30 ffwacom: dysfun: nah fuck that

7:30 should just get you wired without the crap from coffee

7:30 need a goods night rest

7:31 noncom|2: well.. still they haven't invented anything that beats meht..

7:31 * dysfun is confused that euphoria is considered "not a good thing"

7:31 noncom|2: but its crap, yes

7:31 ffwacom: dysfun: as a functional drug :P

7:32 noncom|2: functional drugs for functional programmers :) let the oop-oriented crowd take the rest!

7:32 ffwacom: lel

7:33 dysfun: ffwacom: 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?

7:33 ffwacom: dysfun: doesn't make me euphoric

7:34 just have a baseline of energy to do shit

7:34 that I can't drop below

7:34 * dysfun shrugs

7:34 dysfun: i 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

7:34 noncom|2: btw, i find that a series of 1-2 min meditations along the day make some wonderful change too

7:34 ffwacom: ¯\_(ツ)_/¯

7:35 dysfun: so i'm probably not the best person to talk to about typical experiences

7:35 ffwacom: doesn't help with any fundamental issues anyway

7:35 * dysfun goes to find the modafinil

7:35 ffwacom: not lifechanging by a long shot

7:36 * ffwacom googles for silver bullet

7:36 ffwacom: nah jks

7:37 dysfun: ffwacom: clue's in the name. it's going to be silver bullet-shaped

7:37 noncom|2: they say opiates are really life-changing if you go for that

7:37 btw, a good example of when euphoria != productivity

7:37 ffwacom: healthy diet, sleep and exercise!

7:38 everything in moderation

7:38 noncom|2: actually, too much euphoria will hinder any productivity. a mild euphoria from satisfaction of what youre doing is the best for work i guess

7:38 hellofunk: lol "opiates are really life-changing"... i mean, is the moon's dark side a cold place?

7:39 dysfun: we should really get a ##clojure-offtopic or something

7:39 ffwacom: heh

7:39 noncom|2: agreed with ffwacom: balance proves to be the best (balance also implies balanced unbalancing in required times, so don't consider it too boring )

7:40 heck, everyone just does what he feels right at the moment :D

7:40 anyway :)

7:40 ffwacom: best 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

7:41 clgv: there is an offtopic channel

7:41 #clojure-offtopic

7:41 dysfun: ooh

7:41 ffwacom: ^

8:02 hellofunk: if 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.

8:03 ah, i see now that only 2 forms are allowed in the bindings, thus you cannot have multiple bindings

8:03 Bronsa: hellofunk: wehn-let and if-let can only have one binding

8:25 dnolen_: reiddraper: cljs-port-patch-2 for test.check is ready to test. mvn test works now for me.

8:37 crispin: hey peeps.

8:37 how do I do the equivalent of lein run -m using java and a jar?

8:38 like 'lein run -m myproj.server' as 'java -jar jarname.jar ...?'

8:38 java -jar uberjar.jar runs whats defined in :main in project.clj, but what about another entry point?

8:48 stuartsierra: crispin: `java -cp uberjar.jar <name-of-main-class>` or `java -cp uberjar.jar clojure.main -m <clojure-namespace-with-main>`

8:53 crispin: stuartsierra: I get Error: Could not find or load main class pyproj.server

8:53 for the first

8:53 and

8:53 Error: Could not find or load main class clojure.main

8:53 for the second

8:54 stuartsierra: for `java -cp jarfile <main-class>` you have to have an AOT-compiled Clojure namespace with :gen-class and -main.

8:54 clgv: crispin: you need to AOT compile the namespace you want to run as such

8:54 crispin: got -main

8:55 no :genclass

8:55 clgv: crispin: 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

8:56 mnngfltg: If 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) ?

8:56 clgv: then you can just use "java -jar my.jar my.awesome.ns arg1 arg2 ..."

8:56 crispin: :profiles {:uberjar {:aot :all}} in my lein

8:57 clgv: crispin: I have been doing something similar for a jar that contains more than one tool

8:57 stuartsierra: clgv: java -cp, not java -jar

8:57 crispin: clgv Im hoping to make it self executable and the client aswell

8:57 clgv: stuartsierra: nope! java -jar when using the previous suggestion

8:57 crispin: so java -jar uberjar.jar is essestially the client

8:57 and lein server -m proj.server

8:57 is the server

8:57 stuartsierra: clgv: Oh, I see, when you're loading the namespace, sorry.

8:58 * stuartsierra isn't awake yet

8:58 clgv: crispin: yeah, that'll call the -main in the namespace you provided leiningen

8:58 crispin: ok added gencalss, uberjared... now I get more: Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/IFn

8:58 clgv: stuartsierra: no problem ;)

8:58 crispin: did you run the uberjar?

8:58 crispin: yep

9:00 how do I make sure aot is on for both classes?

9:00 is :profile {:uberjar {:aot :all}}

9:00 enough

9:00 and genclasses of cource

9:01 clgv: crispin: with my suggestion you'd only need AOT for the one namespace containing the -main

9:01 crispin: yeah but then I cant run it as a mainline

9:01 Im using lein bin to make a self executable

9:01 I dont want to go

9:01 /bin/mytool proj.client -h

9:02 clgv: crispin: ok. is it sufficient for "lein bin" to have one AOT compile namespace?

9:02 crispin: unless I modify lein-bin and make it pass it in when evoked from commandline

9:02 clgv: crispin: so you only have one namespace that you want to use?

9:03 atankanow: hi crispin, your client and server code are in the same lein project?

9:03 crispin: atankanow: yes

9:03 they share much code

9:03 atankanow: i would extract all reusable code into a dependency and separate your client/server lein projects

9:03 crispin: i dont want to do that

9:03 cause a server is a client also

9:04 ok I looked in target/classes and its empty

9:04 atankanow: ok, but are they two separate applications?

9:04 crispin: atankanow: one app

9:04 atankanow: i see

9:05 crispin: if my target/classes is empty, does that mean no AOT happened?

9:08 found em in target/uberjar/classes

9:12 holo: hi

9:12 ,(if-let [foo true] foo foo)

9:12 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context, compiling:(NO_SOURCE_PATH:0:0)>

9:13 holo: is there some rationale for not extending foo to the else form?

9:14 crack_user: what ->> and -> does mean in clojure?

9:14 clgv: holo: yeah, it is the definition of if-let, when you get no truthy value, do not bind anything

9:15 holo: crack_user: they are trush operators. i think it means thread first and thread last, respectively. think of it as pipelines

9:15 stuartsierra: holo: `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.

9:16 chouser: holo: 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?

9:16 clgv: crack_user: it allows pipelining syntax, e.g. (->> (range 100) (filter odd?) (reduce +)) instead of (reduce + (filter odd? (range 100)))

9:16 crack_user: thx

9:18 holo: stuartsierra: 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

9:19 clgv: holo: you need to feed a "nil" to a function? O_o that sounds very strange

9:19 holo: just insert a literal "nil" if the setup makes sense

9:19 holo: clgv: come on, how strange is that? :D you never feed nils?

9:20 clgv: holo: usually only in multi arity definitions as default values for "not specified"

9:21 but on the call site there is no need to pass a "nil" explicitely then

9:24 holo: clgv, now that you mention it, I could [& [may-be-nil]] on the input args. maybe i'm doing code smell with nil

9:25 clgv: holo: depends on the task whether that is a solution ;)

9:26 holo: clgv 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

9:27 crispin: I think whats happening is my uberjar is missing clojure.main

9:27 it has clojure/tools

9:27 it has my app generated classes

9:29 holo: (inc clgv)

9:29 lazybot: ⇒ 40

9:29 clgv: thanks ;)

9:40 gfredericks: $mail andyf turns out that use of subseq was indeed buggy

9:40 lazybot: Message saved.

9:43 m1dnight_: is it possible to override equals and hashcode for a deftype?

9:44 or should I use a defrecord? (/me is still reading up)

9:45 chouser: m1dnight_: defrecord defines equals and hashcode for you. deftype allows you to define your own.

9:46 m1dnight_: yes, but i really need my won implementeation

9:46 wow, much typos :<

9:47 okay, i'll experiment a bit

9:47 chouser: so use deftype

9:47 m1dnight_: okay, I found an example. I only found a SO question that said "use defrecord"

9:47 but I think i'm good to go now, thanks guys

9:55 crispin: clgv, atankanow: turned out to be a broken leiningen. updated to latest leiningen. 'java -cp uberjar.jar entry.point' works!

9:55 ,stuartsierra

9:55 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: stuartsierra in this context, compiling:(NO_SOURCE_PATH:0:0)>

9:55 opqdonut: :D

9:56 clgv: crispin: good

9:57 m1dnight_: yeah just override both methods in your deftype

9:59 m1dnight_: yeah I figured it out already

9:59 martinklepsch: anyone advice how to debug issues with cljx middleware?

9:59 m1dnight_: i was just a little bit confused that you have to put "Object" as protocol/interface

9:59 since it is not an interface, but an actual class

9:59 martinklepsch: getting some wierd behaviour: https://gist.github.com/martinklepsch/7bd3cbdf810d8025c090

9:59 m1dnight_: but as I said, i'm still reading up so excuse if I sound stupid :p

10:00 clgv: m1dnight_: you dont even have to put it there - it is just documentation. the impl filters it out

10:01 ,(deftype Foo [] (toString [_] "awesome"))

10:01 clojurebot: #<CompilerException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_FILE:0:0)>

10:01 clgv: ok damn you need at least one symbol there

10:01 ,(deftype Foo [] Object (toString [_] "awesome"))

10:01 clojurebot: sandbox.Foo

10:02 clgv: ok in that case it is needed

10:02 ,(deftype Foo [] Comparable (toString [_] "awesome"))

10:02 clojurebot: sandbox.Foo

10:02 clgv: ,(Foo.)

10:02 clojurebot: #<Foo awesome>

10:03 clgv: so you could skip it in the cases where you have another interface - but it serves as documentation

10:15 jonasen: Does 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:15 dnolen_: jonasen: it does

10:15 jonasen: dnolen_: good.. I will give it a try then

10:18 dnolen_ are you using it for cljs dev?

10:18 dnolen_: jonasen: no not at the moment though I've played around with it

10:19 jonasen: it's great for regular dev, but some things in Emacs are still better (macroexpand is critical for me)

10:21 jonasen: dnolen_ Yes, I will give it a try and see if I like it. The demos from clojure/conj were really nice

10:21 and I don't need macroexpand 9 days out of 10 :)

10:21 dnolen_: jonasen: it's pretty awesome, stepping debugger is worth price of admission

10:21 clgv: dnolen_: you mean something like "inline macroexpand"?

10:21 dnolen_: clgv: no macroexpand period

10:22 clgv: dnolen_: what is that?

10:22 dnolen_: in a code formatted view

10:22 clgv: Emacs Clojure integration has long support macroexpand form under cursor and opening a new buffer with pretty printed expanded source

10:23 clgv: dnolen_: ah nice

10:24 I always do that in repl via pprint which is not optimal ;)

10:24 dnolen_: clgv: that fine for simple stuff, not fine for debugging core.match expansions

10:24 or core.async

10:25 clgv: yeah, guess so.

10:25 had my own complicated macros where that approach was hard work...

10:26 tcrayford___: dnolen_: I feel bad, but I never write complicated macros :( Prolly how it is as an application developer though

10:27 (I'm willing to bet datomic's codebase doesn't use many macros)

10:27 dnolen_: tcrayford___: definitely don't recommend writing complicated macros - I hate macros, except the ones I like.

10:27 tcrayford___: haha

10:28 I've found there's real issues with them exploding the JVM's inliner budget as well :/

10:28 jonasen: so IntelliJ requires Java 1.6?

10:28 tcrayford___: 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:31 dnolen_: 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:31 puredanger: if anyone feels like figuring out this craptastic compiler weirdness, please help :) https://groups.google.com/forum/#!msg/clojure/HK3x7cj3I1o/gy_a7G98VpQJ

10:31 tcrayford___: haha yeah :(

10:32 puredanger: source: 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&sa=D&sntz=1&usg=AFQjCNH5DE1T02xS8UA_1qFtiyqUsZanIQ

10:32 grr. bytecode: https://gist.github.com/puredanger/40dd3ec22fdb5836d1eb

10:34 ticking: dnolen_: btw is there a reason why core.match can't match on '() quoted lists and sets :)?

10:35 dnolen_: ticking: because no one's filed a bug or submitted a patch?

10:36 ticking: dnolen_: ah :D, I thought maybe it was a conscious design decision so that people use ((foo :seq) :guard list?) or something

10:36 dnolen_: ticking: :seq is slated for removal

10:37 in 0.3.0

10:37 ticking: dnolen_: 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:38 dnolen_: alright maybe I'll manage to write a patch for lists and sets :)

10:38 dnolen_: ticking: at least open tickets :)

10:38 ticking: dnolen_: on my way :D

10:45 dnolen_: should lists and sets be two issues or one? "Support all edn datatypes in matches."

10:45 dnolen_: ticking: separate tickets please

10:45 ticking: k

11:11 EvanR: is it possible to use "super" in the definition of a method of a genclass

11:15 machty: i'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:15 tcrayford___: machty: nope. There's a very limited number of special forms, and they're all special cased by the compiler

11:18 clgv: machty: for a beginner there is probably no difference between built-in macros or special forms

11:18 andyf: machty: 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:19 machty: tcrayford___: 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:19 andyf: how can you tell?

11:19 "def", "set!", etc, both special forms

11:19 tcrayford___: machty: you can tell special forms because they say so in the docstring ;)

11:20 andyf: ,(sort (keys clojure.lang.Compiler/specials))

11:20 clojurebot: (& . case* catch def ...)

11:20 * tcrayford___ is learning

11:20 andyf: ,(str (sort (keys clojure.lang.Compiler/specials)))

11:20 clojurebot: "(& . case* catch def ...)"

11:21 andyf: Ah, do that in a local REPL and you will get a longer list and not the ...

11:21 If the first symbol is one of those, it is a special form.

11:22 Bronsa: ,(doc special-symbol?)

11:22 clojurebot: "([s]); Returns true if s names a special form"

11:22 andyf: You 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:23 Bronsa! 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:25 Anyone 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:26 Bronsa: andyf: yeah no exams right now but I'm still busy with a swe project -- I can find time for taj/eastwood anyway :)

11:26 andyf: it's a hack for syntax-quote

11:27 TimMc: &:you-there?

11:27 lazybot: ⇒ :you-there?

11:27 TimMc: yay

11:27 andyf: TimMc: That wasn't confusing timing at all :)

11:28 TimMc: hah!

11:28 andyf: I'd be tempted to remove it, recompile Clojure, and see if it breaks any projects.

11:32 ticking: dnolen_: 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:32 )] (foo (first s) (dissoc (first s)))`might be cleaner :/

11:43 silasdavis: why is there no into! for transients?

11:58 clgv: silasdavis: good question. (reduce conj! coll1 coll2) will help you though

11:59 `into!` would do the same

12:05 reiddraper: dnolen_: merged :)

12:11 dnolen_: reiddraper: sweet!

12:21 bbloom: Bronsa: andyf: in theory there could be a type for improper lists and & would be the reader form for it, like . in CL/scheme

12:21 TimMc: i promise you that it will

12:21 TimMc: in fact, i have projects that would break: macros that search for '&

12:22 Bronsa: it would also break any `(fn [x & foo]) code

12:22 there's no clojure.core/& var

12:24 brainacid: hello

12:36 mmm...still installing

12:36 looks full but behaves empty

12:36 funny channel

12:40 justin_smith: brainacid: installing?

12:53 brainacid: justin_smith: yes java

12:53 justin_smith: gonna learn clojure

12:54 justin_smith: start with lein (if you weren't planning to already) it makes a lot of things a lot easier

12:54 borkdude: is 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:54 justin_smith: what sort of resources?

12:55 tcrayford___: borkdude: not exactly no. Clojure folk tend to shy away from frameworks, and "ease of getting started" in favor of long term wins :/

12:56 justin_smith: tcrayford___: well, it isn't super popular, and has its limitations, but caribou do streamline a lot of stuff in a frameworky way

12:57 I'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:57 brainacid: justin_smith: tcrayford___ I am brand new baby into programming

12:58 borkdude: tcrayford___ yes I thought so, exactly what I was thinking, but just checking :)

12:58 brainacid: I dont know LISP but Im here to have fun

12:58 borkdude: tcrayford___ I used clojure since 2009, and only started in ruby for one month now

12:58 tcrayford___ 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:58 justin_smith: borkdude: caribou was developed to replace a ruby based system

12:59 borkdude: justin_smith is it still under development?

13:00 justin_smith: borkdude: 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:01 ticking: ticking

13:02 lol, wanted to authorize my nick, sounded like a pokemon

13:02 EvanR: ... my method does not seem to be making into my gen class

13:03 its just missing (according to reflect0

13:07 brainacid: any tips? suggestions?

13:07 seems like im going to have some fun

13:08 justin_smith: use 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 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:10 llasram: {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:11 justin_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 justin_smith:Yeah, maybe. I didn't know that was a thing but now that you mention it.

13:12 justin_smith: {blake}: check out jre/lib/security/java.policy

13:12 (also)

13:12 brainacid: justin_smith: thanks will check lein

13:13 justin_smith: {blake}: http://stackoverflow.com/questions/21154400/unable-to-start-derby-database-from-netbeans-7-4

13:13 brainacid: yeah, lein is the easiest way to start clojure and manage libraries, I think everyone here uses it

13:14 brainacid: leiningen ?? justin_smith

13:14 justin_smith: yes

13:14 {blake}: justin_smith:Thanks. Lemme check it out...

13:17 brainacid: to start as in executing the compiler or start as in beginning my learning path?? sorry

13:17 justin_smith:

13:17 justin_smith: brainacid: as the way to execute the compiler

13:18 but really, especially in the beginning, you should just use the repl. It compiles things as you execute them, interactively

13:18 noonian: brainacid: 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:25 brainacid: im not noonian sorry Im coming from C and assembly right now

13:26 shit i use midnight commander and gdb

13:26 lol

13:26 noonian: ah, ok. well it handles a lot of things for you, like resolving dependencies and adding them to the classpath automatically

13:26 brainacid: ok

13:26 im excited to learn tho

13:26 code is data

13:26 homoicipcity

13:27 sum shit

13:27 lol

13:27 TimMc: You were only off by a Levenshtein distance of 3. Not bad.

13:28 bbloom: So basically having '& as a special means it doesn't get namespaced?

13:28 noonian: http://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:30 justin_smith: it's an environment variable, and it will point to where java is installed

13:31 probably something in Program Files

13:31 {blake}: Huh. I don't have a JAVA_HOME environment variable.

13:31 Or a Java anything...

13:32 justin_smith: OK, 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:32 justin_smith: haha

13:32 pmonks: Also, from a repl: (System/getProperty "java.home")

13:32 ,(System/getProperty "java.home")

13:32 clojurebot: #<SecurityException java.lang.SecurityException: denied>

13:32 pmonks: (dec clojurebot)

13:32 lazybot: ⇒ 46

13:33 brainacid: how do i run jar files

13:33 lol

13:33 justin_smith: &(System/getProperty "java.home")

13:33 lazybot: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.home" "read")

13:33 pmonks: A JAR file is usually (though not always) a library ie. like a dynamic shared library.

13:33 justin_smith: brainacid: 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:33 noonian: brainacid: java -jar the_jar.jar

13:34 which only will work for executable jars, not library jars like pmonks mentioned

13:34 justin_smith: brainacid: for example to run clojure, just run "lein repl"

13:34 pmonks: (inc noonian)

13:34 lazybot: ⇒ 10

13:35 justin_smith: you can also use "java -cp clojure.jar:a.jar:b.jar:c.jar:src/ clojure.main"

13:35 that 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:35 justin_smith: {blake}: Windows has lots of issues as a development platform

13:35 noonian: i'd just run a virtualbox linux install if you don't want to mess with dual booting right now

13:35 pmonks: brainacid: 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:36 brainacid: ok

13:36 mmm totally lost

13:36 but im sure i have time to find myself

13:36 got some clojure books already

13:37 lets see if I can do anything

13:37 nightcode?

13:37 pmonks: I just use a text editor + REPL.

13:37 (fwiw)

13:37 MS-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:37 brainacid: ok pmonks

13:37 Jaood: edit.exe

13:38 brainacid: so I can probably continue using the console

13:38 justin_smith: yeah, a repl is all you really need, and a repl is just "lein repl", worry about the rest later

13:38 brainacid: ok

13:38 yeah so in other words i dont need to know java to get this one right?

13:38 its a language on its own correct?

13:38 {blake}: brainacid:No need for Java.

13:38 brainacid: just using the extensive library and stuff from java?

13:38 justin_smith: not at all, but you'll likely learn a few things about the standard java libs eventually

13:38 brainacid: ok thanks blake

13:38 justin_smith: exactly

13:39 brainacid: i see

13:39 pmonks: Yes, but it relies heavily on the JVM, and being able to understand how typical Java libs work will help in leveraging them.

13:39 But lein hides most of the "weird JVM shite"

13:39 (classpaths etc._

13:39 {blake}: brainacid:Actually, Clojure gives a great way to approach Java, which is far more complicated.

13:39 brainacid: well i just dealt with numbers so not really knowing about graphics and stuff. im just a simple dad, stay home farther...just hobby

13:39 pmonks: (inc {blake})

13:39 lazybot: ⇒ 1

13:40 brainacid: i just like to make utilities

13:40 like I have this idea of a search engine for this book I have

13:40 Jaood: brainacid: later on you will feel like you are missing out if you don't get familiar with Java

13:40 pmonks: Just 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:41 pmonks: It's awesome for long-running processes however.

13:41 brainacid: Oh yeah pmonks i saw that already, was looking at top resources while I was launching Nightcode using the debugger

13:41 l0l

13:41 pmonks: Yah - sorry. :-(

13:41 But it's worth it for the long running stuff, ime

13:41 brainacid: hey its ok

13:42 pmonks: Nice to watch code get optimised at runtime. ;-)

13:42 Hard to do that in C/ASM! ;-)

13:42 brainacid: i dunno if i be making anything that runs more that a few minutes

13:42 pmonks: (though I think Intel had a compiler back in the day that sort of did this)

13:42 brainacid: its all nice and nifty I just excited to see a self-modifying language

13:42 tuft: what do folks like for scraping these days? enlive?

13:43 pmonks: Few 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:43 pmonks: brainacid: I still consider myself a n00b too, and all I can say is "stand by for the rush". ;-)

13:44 brainacid: ok lein repl worked

13:44 wish there was highlighting for mc :(

13:44 lol

13:45 well it says Lisp program in my menu!! YAY

13:46 pmonks: {blake} thanks for your time, i enjoy the help. i like being brain changed lol

13:47 justin_smith: tuft: yeah, I usually use enlive

13:47 chouser: tuft: I still like clojure.data.zip, but the docs are still no good.

13:47 tuft: cool thanks

13:47 brainacid: well

13:47 ...

13:47 off to the books

13:47 {blake}: brainacid:Good luck!

13:47 pmonks: brainacid: welcome! I hope you get the rush I'm still getting!

13:52 brainacid: thanks pmonks {blake}

13:55 dysfun: are there any useful libraries for turning maven repositories into metadata maps?

14:03 stuartsierra: dysfun: Maybe https://github.com/cemerick/pomegranate

14:17 dysfun: stuartsierra: yeah, looks like the aether stuff in pomegranate is what i need

14:17 thanks

14:20 brainacid: later

14:49 llasram: Have I done something funky with my configuration or has the most recent version of clojure-mode done some odd things to indentation?

14:50 stuartsierra: llasram: it changed

14:50 https://github.com/clojure-emacs/clojure-mode/issues/265 and https://github.com/clojure-emacs/clojure-mode/issues/266

14:50 llasram: cooooo

14:51 wat

14:57 Whelp, easily fixed in my own config

14:57 dysfun: i'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:58 i've even tried 'lein try leiningen-core'

14:58 presumably it explicitly strips them out

14:59 noonian: and you have it listed as a dependency?

15:00 llasram: dysfun: you need to have `:eval-in-leiningen true` in your project file, and cannot use the `trampoline` task

15:00 One of those missing?

15:01 dysfun: nope

15:01 llasram: s,:eval-in-leiningen true,:eval-in :leiningen,

15:01 (I looked at an old example)

15:01 dysfun: oh, that might be it

15:03 bbloom: TimMc: yes

15:04 llasram: dysfun: Oh, wait -- hah. There's no `leiningen.core` namespace. It's an empty point in the hierarchy

15:04 dysfun: Try (require 'leiningen.core.main)

15:04 dysfun: no dice :/

15:05 mikeflynn: Try leiningen.core.user

15:05 dysfun: no, wait, sorry, i typed that in the wrong repl

15:05 leiningen.core.main worked, thanks

15:05 llasram: np

15:16 dysfun: where's the best place to read what all the keywords in leiningen dependency specs mean?

15:16 like :scope, :exclude etc.

15:17 Bronsa: dysfun: https://github.com/technomancy/leiningen/blob/master/sample.project.clj

15:18 amalloy: dysfun: see also `lein help sample`, which prints the contents of Bronsa's link to stdout

15:18 dysfun: "in addition to keywords supported by pomegranate,"...

15:18 * dysfun goes to check the pomegranate docs

15:19 dysfun: this is why what i'm building with all of this is needed so badly

15:23 https://github.com/cemerick/pomegranate/blob/master/src/main/clojure/cemerick/pomegranate/aether.clj#L619

15:30 amalloy: llasram: 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:34 mmitchell: anyone 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:38 llasram: amalloy: Ah, cool. I didn't comment because I wasn't sure if discussion was taking place elsewhere

15:38 amalloy: i dunno if it is, but i'm obstreperous

15:38 machty: i'm learning about namespaces and requires, wondering why i'd use :require if i can just use fully qualified names?

15:38 (clojure.string/capitalize "asd")

15:39 Bronsa: machty: how can you be sure clojure.string is loaded?

15:39 amalloy: machty: you have to require; only a few namespaces are automatically loaded

15:39 clojure.core, clojure.string, clojure.set...one other i always forget, i think

15:39 Bronsa: and they are not guaranteed to be loaded either

15:40 machty: i see

15:40 seems a little strange that clojure would leave that door for error open for you...

15:40 Bronsa: machty: 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:41 machty: which is convenient to do inside a :require form

15:41 machty: it doesn't require that you use :require if you wanna take the risky to use a possibly-not-loaded but fully-qualified symbol

15:41 Bronsa: confirm, refer makes sense, just wanted to make sure i understood the base behavior

15:42 Bronsa: machty: 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:42 machty: yeah but it doesn't seem like it'd be a stretch to enforce a "strict" mode of only referencing what you require

15:42 Bronsa: machty: this is incredibly useful if you take into account macros

15:43 amalloy: (inc Bronsa)

15:43 lazybot: ⇒ 79

15:43 Bronsa: i.e. I might have a (ns a (:require b)) (defmacro x [] `(b/y))

15:43 machty: Bronsa: what about that example is "global"?

15:43 Bronsa: machty: 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:45 amalloy: machty: the missing (or implied) part of that example is (ns c (:require a)) (a/x)

15:45 Bronsa: right

15:45 amalloy: (a/x) will expand to (b/y), inside the namespace c, which hasn't explicitly loaded b at all

15:45 but it needs to still work or else the macro is stupid

15:46 machty: that 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:46 Bronsa: you'd have to know the implementation of each macro you were to use to make sure you load all the necessary namespaces. Unthinkable

15:46 machty: it is entirely possible that i'm not ready to have this conversation until i fully grok macros... i'm super super n00b atm

15:46 mikerod: When in the REPL I notice that every form I evaluate results in a new level of the class loader hierarchy

15:46 joshuafcole1: macros don't have isolated internals from the code in which they're evauluated, machty

15:46 mikerod: is this normal and doesn't that have a limitation at some point?

15:47 joshuafcole1: macros 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:47 mikerod: I realize it is likely done to hold newly generated class

15:48 actually 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:49 machty: thanks errbody, i'm gonna marinate on that. loving clojure so far

15:50 Bronsa: mikerod: 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:50 mikerod: i.e. it definitely doesn't nest lineraly with each evaluated form

15:50 linearly*

15:52 mikerod: Bronsa: I see that they seem to clear out every so often

15:52 but 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:52 I just kept eval'ing a loop that walks the parent chain

15:53 e.g. (loop [all [] c (.getContextClassLoader (Thread/currentThread)) p (.getParent c)] (if p (recur (conj all p) (.getParent p)) all))

15:54 woops

15:54 e.g. (loop [all [] c (.getContextClassLoader (Thread/currentThread)) p (.getParent c)] (if p (recur (conj all p) p (.getParent p)) all)) ; fixed

15:54 machty: amalloy: 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:54 amalloy: machty: no, within the context of the c namespace

15:55 but the rest of that is true

15:55 machty: amalloy: yes sorry that's what i meant

15:55 Bronsa: mikerod: 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:55 machty: it is possible for that to troll you in unexpected ways if you have a `b` defn'd in your same namespace?

15:56 amalloy: machty: only if you try very hard to be trolled

15:56 defining a function named b certainly wouldn't do it

15:56 machty: why wouldn't it?

15:56 amalloy: because b/y and b are totally unrelated thnigs

15:56 machty: (and what would?)

15:56 amalloy: the compiler won't confuse them, even if you do

15:57 Bronsa: mikerod: 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:57 machty: but if your macro doesn't qualify w namespace?

15:57 amalloy: machty: you would have to write the macro to intentionally cause problems like this, and use some less-clever construct than syntax-quote

15:58 no, ` makes sure the right namespace gets added in

15:58 * machty tries an example

15:59 mikerod: Bronsa: 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:00 machty: amalloy: a HAH and if i used normal quote then it'd be the behavior i described. MAKES PERFECT SENSE. thank you

16:00 amalloy: machty: well you'd still have to do some dumb stuff for a normal quote to cause problems

16:00 eg, (defmacro x [] '(b/y)) would be fine; it evaluates to the same thing

16:01 (defmacro x [] '(y)) would be a problem, if c defined a different function named y

16:01 (or didn't :refer to the y in b)

16:01 machty: exactly, unqualified normal quote in a macro seems pretty dumb

16:01 amalloy: machty: it's generally a bad idea, but of course there are exceptions

16:02 and the problems it causes will tend to be immediate and obvious (stuff refuses to compile) rather than sinister and delayed

16:05 machty: cool

16:09 amalloy: machty: 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:09 machty: amalloy: very interested, will check it out

16:35 dysfun: i 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:35 numberten: i have an InputStream serving binary data and would like to write it to disk, is there a core function for this?

16:35 like a binary-spit or such

16:36 stuartsierra: numberten: I think clojure.java.io/copy will do that

16:36 Bronsa: dysfun: 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:37 dysfun: Bronsa: sorry, i should have been more clear. i wanted a list of functions and types etc.

16:37 programmatically

16:37 i'm sure i've seen it before, but i can't remember what it was called

16:38 if i were to write my own, i'm sure that'd be useful though

16:40 RasterBu_: derp.... wifi dropped me as soon as I left my question, so I'll ask again in case it didn't get posted...

16:40 can somebody help me understand core.async.{tap,multi}? I think I fundamentally misunderstand something: https://www.refheap.com/95127

16:47 numberten: stuartsierra: thanks :)

16:47 llasram: I just recalled that it's a bad idea to attach metadata to functions, but don't immediately remember why

16:47 Any hints?

16:48 justin_smith: RasterBu_: 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:48 RasterBu_: i'll try that.

16:48 thanks

16:48 stuartsierra: RasterBu_: mult blocks until *all* taps are ready to receive input. You probably want buffered channels for your taps.

16:48 amalloy: llasram: i can't think of a specific reason why it's bad, aside from "there are not many reasons it would be good"

16:48 llasram: amalloy: Heh. Fair enough.

16:49 I'm trying to better-adapt Clojure functions to the the abstract classes Mahout uses for its function classes

16:50 One of the features of their classes is that they have methods for all sorts of fun properties like `isLikeRightPlus`

16:50 stuartsierra: llasram: 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:51 llasram: stuartsierra: Yes

16:51 amalloy: stuartsierra: really? functions haven't always been IObj?

16:51 justin_smith: llasram: how about a record that implements callable / runnable?

16:51 llasram: justin_smith: Well, abstract base classes, and I'm trying to keep everything in primitive-land

16:52 justin_smith: deftype?

16:52 clojurebot: deftype is see datatype

16:52 llasram: Metadata 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:52 justin_smith: Nah. Tiny Java classes

16:53 stuartsierra: I didn't recall that older versions didn't support it. That's probably the reason I was half-remembering

16:53 Bronsa: I recall metadata on functions messing with primInvoke or something

16:54 liflash: hi 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:54 stuartsierra: There was one version where some, but not all, Var metadata got copied to their corresponding function objects, which caused much confusion.

16:55 amalloy: Bronsa: oh sure. i imagine it still does

16:55 Bronsa: yeah

16:55 amalloy: llasram: that's a reason

16:55 llasram: There we go!

16:55 Yes, that was totally it

17:00 OscarZ: im trying the example here (under Hot code reload) http://www.http-kit.org/migration.html

17:00 getting Unable to resolve symbol: defroutes

17:00 i believe its in compojure

17:01 i have included that as dependency in project.clj.. any ideas ?

17:02 noonian: you would need (:require [compojure.core :refer [defroutes]]) in your ns declaration

17:03 i think their example ns declaration is wrong, :only is meant to be used with :use, you need to use :refer with :require

17:03 EvanR: blurg, #_( ... ) is not working so well as a multiline comment

17:03 some of the words inside are "invalid tokens"

17:04 liflash: OscarZ: +1 for noonian

17:06 EvanR: and " " doesnt work since i am using " in the comment

17:06 justin_smith: EvanR: oh, that sucks

17:06 OscarZ: thank you.. it works.. now it doesnt find handler but ill find out where it is :)

17:06 EvanR: (the invalid token is OBX-1)

17:06 OscarZ: is that some old syntax or just wrong?

17:06 justin_smith: combo of #_( ... ) with ;; mixed in? still ugly


17:06 llasram: EvanR: Yeaaaaah #_ isn't really meant for comments

17:06 EvanR: well that would be every line of the comment

17:06 llasram: What's wrong with just `;` ?

17:07 liflash: OscarZ: just wrong i think

17:07 EvanR: which would work, i just have to put ; on many lines

17:07 llasram: EvanR: Your editor probably will do that for you :-)

17:07 EvanR: probably

17:08 we also dont need functional programming because editors can copy and paste large blocks of code while substituting the variables ;)

17:09 justin_smith: EvanR: literate programming?

17:09 llasram: I 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:09 liflash: any idea why no clojurescript.test tests are ran, when i require anything else then cemerick.cljs.test in the test file?

17:10 cfleming: amalloy: Thanks for the comments on that indentation issue, I agree

17:11 amalloy: cfleming: well, bbatsov apparently doesn't. i'm not going to continue pushing, since clojure-mode circa 2012 still works great for me

17:11 if everyone else starts indenting their code badly i guess that's just life

17:12 cfleming: amalloy: 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:13 amalloy: The reasoning too

17:14 amalloy: cfleming: i mean, he's right in theory that -> and doto should be treated the same

17:14 hiredman: ugh

17:15 we have a golden clojure-mode sha at work from 2012 aswell

17:15 stupid formatting changes

17:15 cfleming: amalloy: They pretty much are in Cursive - Cursive is aware of threading forms, so it'll indent your nesting cases correctly.

17:15 amalloy: hiredman: what sha, out of curiosity? mine is 66452816ebe11da025d9438bb9422dbf0f37d6c2 plus a few commits i've added on

17:16 * justin_smith files that sha away

17:17 amalloy: justin_smith: https://github.com/amalloy/clojure-mode/commits/master

17:17 you don't have to save the sha by hand :P

17:17 OscarZ: some day i will learn how to use paredit :(

17:17 hiredman: oh no, it is actually from march 2013 d4d3f5e672fdf2a5e5b2cbc1287d2b923b40f346

17:17 TimMc: How does one use this hash?

17:18 justin_smith: amalloy: I use irc in my emacs, grabbing the sha string is easy

17:18 TimMc: clone the repo, check out that hash

17:18 amalloy: TimMc: i run clojure-mode from a git checkout, not melpa or whatever

17:18 TimMc: Oh, the git hash, I see.

17:18 hiredman: I 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:19 TimMc: I'm on 2.1.0 from elpa or whatever.

17:19 Bronsa: I froze it at 201ed7dc9b615cf8803acbc48711caa19156e6c0 from May 2014

17:20 after that font-lock started changing

17:20 amalloy: cfleming: 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:20 Bronsa: and I couldn't read clojure code anymore

17:20 amalloy: emacs supports it but apparently discourages it

17:21 justin_smith: Bronsa: 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:21 it was a "cool" idea, but a bad one

17:21 TimMc: D:

17:21 justin_smith: I mean python did significant whitespace, so why not significant hightlighting, right?

17:22 hiredman: the continual churn fest emacs clojure tooling has been since things changed fills me rage

17:22 llasram: justin_smith: inspired by Color Forth?

17:22 justin_smith: llasram: partially, yeah

17:22 * TimMc works up a version of Javascript with significant file modification times

17:22 turbofail: hm. what other things can we make significant?

17:22 justin_smith: that plus a youthful love of novelty

17:23 (inc TimMc)

17:23 lazybot: ⇒ 84

17:23 amalloy: hiredman: "since things changed"?

17:23 justin_smith: TimMc: turbofail: a language where the semantics change based on the sha sig of your file

17:23 amalloy: turbofail: significant glances. emotion-sensitive indentation

17:23 llasram: *shrug*

17:24 dysfun: justin_smith: you haven't discovered malbolge then?

17:24 llasram: I'm on the melpa-stable versions and they're pretty good

17:24 justin_smith: (inc amalloy)

17:24 lazybot: ⇒ 207

17:24 turbofail: how about compilation dependent on current gps-coordinates?

17:24 TimMc: oooh

17:24 (inc justin_smith)

17:24 lazybot: ⇒ 161

17:24 turbofail: it's location aware!

17:24 TimMc: Sounds a little malbolge-like. :-)

17:24 justin_smith: dysfun: similar concept yes. I love that malbolge was cracked by an evo-algo coded in lisp)

17:24 llasram: The switch to push all the hairy code into nREPL middleware was painful, but most of those bugs are gone

17:24 TimMc: turbofail: You can already do that in Clojure.

17:24 dysfun: "Weaknesses in the design have been found that make it possible (though still very difficult) to write useful Malbolge programs.

17:24 turbofail: TimMc: well you could do all of things things in clojure

17:25 well maybe not the significant glances part

17:25 dysfun: justin_smith: a beam search :)

17:25 justin_smith: significant keypress timing - things you type faster are interpreted differently compared to things typed slower

17:25 TimMc: It 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:26 hiredman: amalloy: 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:26 justin_smith: and things edited via search/replace or copy/paste would have yet another rule, of course

17:26 amalloy: fair enough

17:26 dysfun: i think we should just get over the idea that programming should ever be deterministic

17:27 although i hear php's trying quite hard for that one

17:28 turbofail: significant key impact force. angrier typing causes more aggressive optimizations

17:28 TimMc: goto rand()

17:28 turbofail: even better if the aggressive optimizations aren't always correct, thus causing a feedback loop

17:29 TimMc: rage overflow error

17:30 dysfun: i presume we've all seen colorforth?

17:30 https://en.wikipedia.org/wiki/ColorForth

17:31 justin_smith: dysfun: yupyup

17:31 dysfun: "the colors simplify forth's semantics" <-- lies

17:31 not that forth really has any semantics as such

17:31 justin_smith: dysfun: a friend of mine even got a chance to work with those crazy CPU matrix things Chuck makes these days

17:31 dysfun: guy's a nut

17:31 justin_smith: still no C compiler, but it runs forth like a charm

17:32 guy is a nut that made a fun toy :)

17:32 dysfun: guess that's what reverse polish thinking does to you

17:33 forth has some really interesting qualities though

17:34 it's a complete nightmare to 'statically analyze' <-- haha, on forth!

17:34 nothing so formalised as a function definition

17:51 cfleming: amalloy: Yeah, that looks like it

17:54 ticking: dysfun: 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:56 mikerod: I'm guessing leiningen cannot handle importing poms that manage dependencies?

18:04 justin_smith: mikerod: wait, so a pom can manage dependencies, as something separate from declaring them?

18:14 mikerod: justin_smith: yes, a pom that's sole purpose is to have a dependencyManagement section that other poms can import in

18:14 but not directly inherit from

18:14 - they have their own parent pom's etc

18:15 it is for a specific set of dependencies that you want to have the same management for across modules - such as hadoop deps

18:24 arrdem: Last call for Grimoire complaints/requests sitting down on 0.4 now.

18:31 romanandreg: question: is there any set datastructure that keeps items ordered by insertion?

18:32 amalloy: $google amalloy ordered set

18:32 oh right, is google broken now?

18:32 that stinks

18:33 romanandreg: amalloy: I googled insertion order set clojure

18:33 but didn’t find anything useful (one library 2 years old, depending on clojure 1.4) :-/

18:33 amalloy: https://github.com/amalloy/ordered

18:33 should work fine on newer versions of clojure

18:35 romanandreg: ok… was hessitant to try it, but going to because you are here hehe

19:00 brainacid: hey all

19:00 im totally lost

19:01 very

19:01 r u telling me that I cant use lein or cojure without an internet connection? please clarify this doubt for me

19:02 amalloy: brainacid: lein has an offline mode

19:02 mikeflynn: Well lein will try to download any dependencies you need and it will need the internet for that.

19:02 amalloy: but you won't be able to download dependencies while offline

19:04 brainacid: I see

19:04 so there is no base pkg for my hard drive?

19:04 amalloy: oh thanks where can i find more info

19:04 its been a little hard for me to find clear info, the raving about it is over the top

19:05 I understand its an infant language but I aint no true l33t programmer so i need basic language lol

19:05 amalloy: https://github.com/technomancy/leiningen/issues/961

19:06 brainacid: any thoughts about Nightcode?

19:07 amalloy: sounds like two words mashed together. pretty sure it's something to do with programming

19:07 other than that, question is too vague to do anything with

19:07 noonian: brainacid: 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:09 brainacid: help

19:09 oops

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 Aaand he's gone.

19:12 brainproxy: he'll be back

19:12 needs to become l33t

19:12 {blake}: Anyway, LightTable is probably a better bet.

19:26 brainacid: im still confused tho

19:26 u mean i cant use a basic editor like nano and compile it to run?

19:26 is this a language for gui applications

19:27 i just cant seem to comprehend forgive me

19:27 mikeflynn: You can use anything. I use Sublime Text for example and just compile with lein.

19:27 brainacid: but if i do something i need a dependency for i need the net

19:27 see i dont have internet at home

19:28 im at McDonalds right now on a shitty connection

19:28 mikeflynn: If you declare a dependency in your project.clj file and you don't have locally, lein will go and get it for you.

19:28 brainacid: i see

19:28 i have just heard that Clojure is great for women

19:28 so im eager to see what its all about

19:29 i have nightcode and lein

19:29 brainproxy: brainacid: might be a good idea to start w/ a solid book like Clojure Programming: http://www.clojurebook.com/

19:29 mikeflynn: The best way to play with it is to simply play with the repl: lein repl

19:29 brainacid: i see

19:30 well lets see

19:30 i have several books already

19:30 it just doesnt seem quick in executing the program

19:31 lol im so use to scripting python, perl and compiling C or running assembly

19:31 this is so bizarre to me

19:32 i have the slightest clue about jvm

19:32 * brainacid sighs

19:32 brainproxy: brainacid: 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:33 the dev workflow for Clojure typically involves having an editor and REPL work hand-in-hand

19:33 brainacid: well i mean my standalone jar file that Nightcode IDE just made for Hello World

19:33 brainproxy, so say im the editor in one terminal and lein repl in another?

19:34 brainproxy: brainacid: well you probably want an editor that can hook to the repl

19:34 justin_smith: yeah, clojure is not good for short lived programs. Just leave the repl running, reload you code, then run your main from the repl.

19:34 brainproxy: vim and emacs can do that, IntelliJ and others as well

19:34 justin_smith: you can do that without editor integration

19:35 brainacid: justin_smith, oh yes im just making some calculators and im not sure if a search utility can be done using this language

19:35 brainproxy: true, 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:35 brainacid: i was just attracted by self-modification and code as data

19:35 still dont know what that means

19:36 brainproxy: code as data -- your clojure programs are a bunch of s-expressions, which are basically lists of symbols

19:36 brainacid: mmm interesting

19:36 brainproxy, whats a good editor integrated with repl?

19:36 brainproxy: but data in your programs is also typically represented with s-expressions

19:36 brainacid: i run console linux

19:37 justin_smith: brainacid: 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:37 brainproxy: hence, code is data is code

19:37 brainacid: really try to stay away for X windows

19:37 crispin: emacs runs in terminal

19:37 brainacid: justin_smith, so interesting

19:37 crispin: bit of a learning curve, but worth it in the end

19:37 brainacid: crispin, can clojure be intergrated into emacs?

19:37 {blake}: heh

19:37 justin_smith: brainacid: so we typically just leave things running and redefine parts of the code instead of restarting

19:38 which 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:38 brainacid: mmm...this is beyond me

19:38 and I though assembly was hard lol

19:38 crispin: brainacid: yep. emacs internally uses elisp, but you dont need to expose yourself to that

19:38 brainacid: so after all this im still lost, so please forgive me

19:38 {blake}: Assembler is easy, just slow. Clojure is hard--but fast.

19:38 brainacid: ok crispin

19:39 crispin: just install clojure-mode and cider

19:39 brainacid: {blake}, hi again

19:39 ok

19:39 justin_smith: brainacid: 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:39 crispin: cider is the interactive debugger thing

19:39 brainacid: once i get good bandwidth i will get clojure-mode cider and emacs

19:39 justin_smith, ahh

19:39 so all i need is a basic editor to type some code then paste into repl?

19:40 or type into repl as well

19:40 crispin: there is a series of posts online that take you through emacs and clojure

19:40 "clojure for the brave and true"

19:40 brainacid: crispin, 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:40 justin_smith: right, or you can skip the editor integration and just use paste - sometimes that is actually simpler

19:40 brainacid: so can I run the clojure jar file directly

19:40 crispin: except you will launch emacs as "emacs -nw" (nw = no window. ie. terminal mode)

19:41 brainacid: yep

19:41 brainacid: jar -jar clojure1.6.jar

19:41 crispin, good deal

19:41 justin_smith: crispin: I am hesitant to recommend cider to newcomers, it breaks a lot

19:41 crispin: theres also a cool lein plugin lein-bin that will make a self executing binary

19:41 justin_smith: what does it break?

19:41 justin_smith: cider itself breaks frequently

19:41 brainacid: my apps are probably 30 lines in C and maybe 75-100 in assembly so im sure Clojure it would be one function

19:42 lol

19:42 crispin: "binary". actually a self running jar. so you can go ./my_prog

19:42 cider only was a problem for me when Id also installed the old nrepl

19:42 once I only installed cider, there was no problem

19:42 justin_smith: crispin: do you ever update cider?

19:42 crispin: I mean you can always not use cider if its a problem, and just use a compile loop

19:43 havent updated in a while

19:43 the hard thing about emacs is not cider so much, its the non standard key bindings

19:44 but once youve got over the hump... its ok

19:44 brainacid: well

19:44 im running repl straight in terminal

19:44 crispin: ideas like the kill-ring are awesome, but if you're only used to cut and paste, a bit out there

19:45 yeah and you can jack-in to a terminal repl too

19:45 then, once you got the hang of emacs, learn "paredit" and install "rainbow-delimiters"

19:46 justin_smith: after a recent cider lockup, I am just using inferior lisp and skipping cider entirely

19:46 crispin: and code editing becomes super powerful

19:46 amalloy: justin_smith: i run SLIME from a git checkout too :P

19:46 crispin: i mean you can foobar cider sure, like, evaluate an infinte lazy sequence

19:47 kenrestivo: i 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:47 crispin: then press Ctrl-G to break out

19:47 justin_smith: crispin: 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:47 it wasn't lazy or infinite

19:47 crispin: haha yeah. try ctrl-g

19:48 as with emacs, its always 'what frikking keypress was that thingie;

19:48 justin_smith: I 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:48 crispin: well... ctrl-g is more than just cider

19:48 kenrestivo: add-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:48 amalloy: justin_smith: oh, i didn't know about C-c C-b

19:48 crispin: say youre emacs buffer is taking ages to render

19:48 c-g

19:48 general emacs stop-what-your-doing

19:49 kenrestivo: are these multiple threads?

19:49 kenrestivo: yes

19:49 justin_smith: c-g my point was, my machine is beefy enough that I don't have to interrupt anything else like that, except cider

19:50 kenrestivo: multiple 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:51 crispin: yeah, 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:51 hang

19:51 elisp is not the fastest

19:51 justin_smith: crispin: the same query inside inferior lisp took a while but did not hang emacs the way cider did

19:51 crispin: kenrestivo: what about watchers?

19:52 kenrestivo: add-watch doesn't have any way i can tell to identify *where* the update came from

19:52 crispin: yeah watchers should be avoided

19:52 brainacid: ok got syntax highlighting on gedit and have repl running

19:52 crispin: can you push down the async channel the value, and where it came from?

19:53 or what if each source was a different chan, and then use alts! to switch

19:53 then you can tell where it came from by which chan it came over

19:53 alts! returns a chan, val pait

19:53 pair

19:54 kenrestivo: that's kind of where i was headed. but it feels like i'll run into trouble.

19:59 crispin: kenrestivo, 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:01 brainacid: thanks for all the help

20:01 i will start somehow

20:01 NoCreativity: hello 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:01 brainacid: nil is nil

20:01 :)

20:01 later

20:02 NoCreativity: I want to turn this [ {:g [{:id 15}], :id 216} {:g [{:id 2}], :id 216} ] in {:g [{:id 2, :id 15}], :id 216}

20:02 amalloy: {:id 2, :id 15} is not a valid object

20:02 NoCreativity: opps

20:02 Sorry

20:03 {:id 216 :g [{:id 2} {:id 15}]}

20:04 I would appreciate any help or tip

20:04 kenrestivo: yeah, 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:08 amalloy: what do you plan to do if there are more top-level ids than just 216, NoCreativity?

20:09 NoCreativity: I wanted to take the duplications and merge their :g

20:09 amalloy: so 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:10 because {:id 215 :g [...] :id 216 :g [...]} is just as illegal as the other thing

20:10 kristof: gross

20:10 NoCreativity: You mean

20:11 The top :id can conflict with the one inside :g {} ?

20:12 {:id 5 :g [ {:id 1} {:id 2} ] }

20:12 amalloy: no, of course not. look at the example output i gave. you see why that's impossible, right?

20:13 it's a map with the :id key twice, and the :g key twice

20:13 NoCreativity: Ah

20:13 sorry

20:13 I got it

20:13 Yeah, you are right

20:13 And you are right. I want a list of maps.

20:13 Even a set

20:13 set of maps

20:13 amalloy: okay. then it's not super hard

20:14 crispin: NoCreativity: does this help: http://stackoverflow.com/questions/9089200/clojure-group-by-by-multiple-keys

20:15 NoCreativity: crispin: Let me check

20:16 crispin: making the output {:id [1 2]} instead of [{:id 1} {:id 2}] may be easier

20:16 amalloy: NoCreativity: so you just want something like https://www.refheap.com/fa03b31d7b7fe214bf0ca3df9

20:18 NoCreativity: amalloy: Cool! I will try it!

20:18 arrdem: $mail andyf is there an eastwood config for adding all the linters?

20:18 lazybot: Message saved.

20:20 crispin: amalloy: TIL fnil. thanks

20:25 NoCreativity: amalloy: Cool! thanks for the help! I will study this stuff! Thinking in functional is still too different for me.

20:25 crispin: Thank you too!

20:28 rritoch: NoCreativity: 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:28 NoCreativity: 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:29 NoCreativity: In that case they wanted to turn non-array keys into arrays if the keys matched

20:30 NoCreativity: 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:31 NoCreativity: rritoch: 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:31 I will need to leave here. Thank you for the help.

20:48 hydo: is 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:52 ah 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:52 tuft: hydo: whichever way java does it should work fine

20:52 hehe, indeed

21:06 ddima: hm, 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:06 justin_smith: ddima: why do you call both symbol and str on it?

21:06 ,(.sym *ns*)

21:07 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: sym for class clojure.lang.Namespace>

21:07 justin_smith: err

21:07 ddima: well, thats the only way I got it to work, as it does not cast to symbol directly

21:07 chouser: (set! *ns* my-ns)

21:07 justin_smith: ,(.name *ns*)

21:07 clojurebot: sandbox

21:08 justin_smith: chouser: oh cool, I had no idea that worked

21:08 chouser: I don't know if I'd recommend it or not. *shrug*

21:08 ddima: ah, thanks. looks slighly evil ;)

21:08 I basically want to eval some code in a dynamically built namespace with specific bindings

21:09 so maybe I could just bind [*ns*] instead of set!

21:10 actually seems to work too

21:10 chouser: That sounds slightly less scary.

21:10 ddima: basically just wondered why in-ns doesnt, it has the nice advantage of creating if its not there

21:10 but who expects comfort when doing shit like that anyways ;(

21:10 err, ;)

21:10 chouser: that's all in-ns does. Creates the ns if it doesn't exist, then sets *ns* to it.

21:11 justin_smith: ddima: (in-ns (.name my-ns)) will work too

21:12 ddima: ah, nice to know too. thanks!

21:12 chouser: Definition of in-ns: https://github.com/clojure/clojure/blob/05af4b52a474bc60d2eb931e388b302c14edc884/src/jvm/clojure/lang/RT.java#L235

21:13 ddima: I only looked at namespace.java before, didnt get to RT yet ;)

21:29 rritoch: ddima: 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:31 ddima: Holding a namespace in a var will keep it from getting garbage collected, effectively creating a potential memory leak.

21:35 ddima: its just within a closure on not on some global scope, so I guess that should be fine. but good pointer!

21:35 s/on/and

21:37 var was wrong in the case

21:42 so basically s/Var/local, terminology slipup ;)

22:08 but 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:08 rritoch: Is 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:09 kenrestivo: clojure.tools.namespace/refresh ?

22:09 sorry, clojure.tools.namespace.repl/refresh

22:14 rritoch: kenrestivo: 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:15 kenrestivo: it's kind of a shot in the dark, but i figured why not mention it.

22:15 rritoch: kenrestivo: It is a good idea, I didn't even consider the possiblity that the REPL was involved.

22:28 ddima: maybe http://dev.clojure.org/jira/browse/CLJ-1125 gives some pointers

22:29 (at least sounds vaguely related)

22:29 andyf: /whois arrdem

22:30 TimMc: A question for the ages.

22:31 andyf: Oops. 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:32 I 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:32 rritoch: Well, 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:33 I'll need to run some tests outside of REPL to see if the REPL is the culprit.

22:35 I 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:37 I 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:41 ddima: rritoch: there seems to be something on Var for that: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Var.java#L328

22:41 (just decided to poke around a little too, to get a better sense for the runtime)

22:42 rritoch: ddima: 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:43 ddima: 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:43 ddima: yeah, looks as if it was considered but left unused.

22:46 rritoch: ddima: 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:48 ddima: yeah, 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:48 rritoch: ddima: Though, maybe oracle/openjdk have been toying with solutions for the memory leaks that are causing my inheritablethreadlocal to get wiped out.

22:48 ddima: maybe, try some older versions, quicker to test than wading through the code

22:51 rritoch: ddima: I think I may have found the problem.

22:51 http://stackoverflow.com/questions/7296623/inheritablethreadlocal-and-thread-pools

22:52 If clojure is doing something similar to that, maybe that is why my data is getting wiped out.

22:53 I can't find any refrences to ThreadPoolExecutor in clojure though :(

22:55 I 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:00 ddima: good luck, I need some sleep ;)

23:07 babu`: 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:07 justin_smith: babu`: lein is a single shell script, you don't need brew to get lein

23:08 and it's easier if you don't use brew, inf fact

23:08 *in

23:16 rritoch: Does 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:17 The 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:19 justin_smith: rritoch: 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:20 looks like it is related to static final ThreadLocal<Frame> dvals

23:20 rritoch: justin_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:21 babu`: justin_smith: Before I tried brew I had downloaded lein.sh. I get the same error.

23:21 rritoch: justin_smith: But the ThreadLocal initializes to TOP which is an empty frame.

23:21 justin_smith: and then getThreadBindings uses the same linked list of frames

23:21 babu`: what lein version?

23:23 rritoch: justin_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:23 justin_smith: What I'm not seeing is how bindings are making it into child threads.

23:23 babu`: justin_smith: The lein.sh has: export LEIN_VERSION="2.5.0"

23:26 justin_smith: babu`: and just running "lein help" or "lein repl" gets that error?

23:26 try deleting ~/.lein/

23:26 or temporarily moving it asid

23:27 *aside (sorry, vino)

23:27 babu`: 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:29 rritoch: justin_smith: I think I just found it. Var bindings aren't transported by var, they're transported by the future function

23:29 https://github.com/clojure/clojure/blob/clojure-1.6.0/src/clj/clojure/core.clj#L6416

23:29 babu`: justin_smith: renaming ~/.lein and running lein worked.

23:30 justin_smith: babu`: awesome, likely the config got into a corrupt state

23:30 it 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:32 rritoch: justin_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:32 babu`: 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:32 justin_smith: yeah, that is totally invalid

23:33 probably hand edited and you made a mistake? or did some tool mangle it?

23:33 babu`: 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:34 justin_smith: No I didn't hand edit it. Installed cider package in emacs.

23:35 justin_smith: babu`: extremely nonhelpful error messages are so common in the clojure world...

23:35 babu`: sounds like an error report for whatever cider packager you tried to use I guess

23:37 babu`: justin_smith: thanks for your help.

23:37 justin_smith: np

Logging service provided by n01se.net