#clojure log - Dec 18 2014

The Joy of Clojure
Main Clojure site
Google Group
IRC
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

Logging service provided by n01se.net