#clojure log - Dec 24 2013

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

1:50 sm0ke: OK this is weird, are comments not allowed inside body of a function?

1:51 ddellacosta: sm0ke: that is most definitely not the case.

1:53 sm0ke: ddellacosta: right i found a bug in my ide

1:53 ddellacosta: sm0ke: :-)

1:53 pcn: ddellacosta: I fixed my performance problem from last night by replacing my socket code with aleph.

1:54 ddellacosta: oh, I think you were talking to someone else about that--I only remember the file linking weirdness

1:54 pcn: nonetheless, happy to hear it. :-)

1:59 pcn: ddellacosta: I finished asking how to do performance troubleshooting. I figured I did something wrong, so I figured I'd try a competant library instead.

1:59 ddellacosta: pcn: gotcha...what were you using for socket stuff anyways? Default Java libs?

2:04 pcn: I was using a slightly changed version of technomancy/server-socket.

2:04 I wanted it to pass back client info, so I did some copypasta, and probably broke it.

2:05 ddellacosta: gotcha.

2:11 jonasen: I'm thinking of finally switching to cider. It says in the readme that I should remove the old nrepl.el package. Is it enough to simply remove ~/.emacs.d/elpa/nrepl-0.1.8/ and remove all references to nrepl in init.el?

2:32 pcn: Is there an atoi function for clojure? I have crud coming from the network, so I'd like to avoid read-string

2:33 TEttinger: yes, there are a few

2:33 atoi converts a string like "11" to 11, right?

2:33 ,(Integer/parseInt "11")

2:33 clojurebot: 11

2:34 TEttinger: ,(read-string "11")

2:34 clojurebot: 11

2:34 TEttinger: oh you said read-string

2:34 the java parseInt or parseLong is your best bet then

2:35 ,(Integer/parseInt "whee 11")

2:35 clojurebot: #<NumberFormatException java.lang.NumberFormatException: For input string: "whee 11">

2:35 pcn: Thanks

2:36 logic_prog: what is the most idiomatic way in pure clojure (no java involved) for implementing matrix operations

2:37 nones: ,(Integer. (re-find #"\d+" "whee 11"))

2:37 clojurebot: 11

2:39 sm0ke: when i do a `lein test` my :dependencies are not in the classpath

2:39 how do i fix this?

2:39 nones: logic_prog: you can use https://github.com/clojure-numerics/core.matrix

2:44 dsrx: ,(read-string "\"foo\"")

2:44 clojurebot: "foo"

2:44 dsrx: ,(doc read-string)

2:44 clojurebot: "([s]); Reads one object from the string s. Note that read-string can execute code (controlled by *read-eval*), and as such should be used only with trusted sources. For data structure interop use clojure.edn/read-string"

2:51 TEttinger: here the read-string is probably sandboxed with read-eval, I'd be surprised if clojurebot didn't, and I know lazybot does

2:52 nones: ,*read-eval*

2:52 clojurebot: false

2:53 TEttinger: yep

3:07 akurilin: Has anybody here found a solid end-to-end logging solution yet by any chance?

3:08 Something that can aggregate error logs throughout the entire stack

3:08 Totally a new startup idea somewhere in there :P

3:14 bitemyapp: akurilin: could you provide an example of what parts of your stack would have their logs get aggregated?

3:14 akurilin: generally speaking, by the time a company needs something like that - they have the resources to slap together log centralization themselves.

3:16 sm0ke: akurilin: why isnt log4j good enought?

3:17 if you want fancy logging solutions, there is splunk

3:17 bitemyapp: sm0ke: he might mean pulling everything, including db logs and the like. I'm not sure how much that sort of thing matters for most people.

3:17 sm0ke: but its paid

3:17 bitemyapp: sm0ke: there are better, free-r options than Splunk. Come now.

3:17 http://logstash.net/ and Kibana come to mind.

3:17 sm0ke: bitemyapp: like?

3:17 Kibana is just a UI

3:18 it can sit on top of splunk

3:18 bitemyapp: ick.

3:18 Splunk is terrible.

3:18 Just use elasticsearch if you're going to bother.

3:18 sm0ke: bitemyapp: exactly my point

3:18 bitemyapp: sm0ke: ...that's what logstash is.

3:18 sm0ke: you can have a log4j appender to elasticsearch and you are done

3:18 bitemyapp: but most people don't know how to query ES, therefore...Kibana.

3:19 timbre appender, more like.

3:19 fuck log4j.

3:19 sm0ke: nah

3:19 bitemyapp: XML configuration garbage.

3:19 sm0ke: timbre sucks too

3:19 bitemyapp: timbre sucks less than log4j.

3:19 sm0ke: well i prefer simple properties file

3:19 logging is not rocket science afterall

3:21 my setup is tools.logging + log4j appenders.

3:26 akurilin: I was thinking something that'd allow me to get what's essentially an error trace for a user across the stack

3:26 so a user made a call to the backend

3:26 there was error there

3:26 the error is logged

3:26 the client errors out

3:26 the client's error is logged

3:27 eventually I'd have non-error-only logs too so I can see what the activity was that led to the error

3:27 bitemyapp: the second statement sounds reasonable

3:27 I'm suspecting that you can get away without it for a very long time.

3:28 At the very least you want something that will tell you that somewhere in the stack there are people experiencing errors, so perhaps aggregating them into one place is one way of addressing both clients and servers at once.

3:28 iOS has Crashlytics

3:28 Backends have PaperTrail

3:28 JS has JSLogger/Errorception

3:31 sm0ke: akurilin: there is two ways to think about this with same end results

3:32 akurilin: either you aggregate logs from many machines to one place

3:32 akurilin: or you log locally to a place which is already aggregated

3:33 akurilin: sm0ke: I don't see how the latter would be applicable to a javascript situation, but I'm also pretty uncreative at times :)

3:34 sm0ke: js in a browser, to be precise.

3:34 Not node.

3:35 sm0ke: akurilin: doesnt matters where it is, just have 10 es clusters running with browsers sending write request to any of them

3:35 i mean 10 node cluster

3:36 akurilin: Not sure I'm following.

3:37 sm0ke: although it not common to have logging for browsers

3:37 akurilin: what are you logging in the browser?

3:38 akurilin: Well, I have a pretty large MVC app and I need to know when it craps out for some reason.

3:38 It's a clone of our iOS app, which for a year has been using Crashlytics pretty successfully to track client errors.

3:39 Crashlytics is pretty nice. It gives you the stack trace, when / how often it occurred, some stats etc, gives you warning. Easy to spot when there's a sudden surge in errors.

3:39 sm0ke: akurilin: i see, ok well i dont know how craslytics works, but ultimatley it would be sending cash reports to servers right?

3:39 crash*

3:39 akurilin: Yes it does.

3:41 sm0ke: well, why cant you? ulness you do not want to take pain of provisioning servers for handling crash reports too

3:41 what is you application?

3:41 is it pure client side, with no server interaction?

3:41 akurilin: sm0ke: nothing preventing me from writing this myself, but I was looking for something off the shelf / SaaSsy

3:42 sm0ke: akurilin: ah i see

3:42 akurilin: well on crashlytics homepage i see it supports android too

3:42 akurilin: Carving out time for infrasturcture work is always rough.

3:43 sm0ke: ah ok

3:43 you have a generic brwoser app

3:45 akurilin: I beg to differ, it's very special to me! ;)

3:46 sm0ke: heh i meant cross platform webapp

3:46 well i think splunk would be one

3:47 bitemyapp: Splunk is terrible.

3:48 akurilin: Oh yeah, I always wondered what splunk was, heard the company was very successful very fast.

3:48 sm0ke: no its not terrible if its the leading player in log analysis

3:49 it may be terrible like oracle is terrible in db space

3:49 bitemyapp: I've used Splunk. It's terrible.

3:49 sm0ke: but you get the work done right?

3:49 bitemyapp: It's popular because it's accessible, not because it's good.

3:49 Engineers should know better and just use something like ES + logstash.

3:49 and then use a nice dashboard like Kibana, if they need such.

3:49 akurilin: "accessible" as in easy to install?

3:49 sm0ke: bitemyapp: well his point is also valid there is some operational cost to it

3:49 hyPiRion: akurilin: as in "easy", not "simple".

3:50 akurilin: hyPiRion: got it.

3:50 bitemyapp: sm0ke: derrr herrr derrr

3:50 akurilin: bitemyapp: lol.

3:50 bitemyapp: sky is blue, news at 11

3:51 akurilin: It seems like ES is the household name for a lot of problem solving these days, really need to spend some time on that.

3:51 sm0ke: well if you have a webapp , obsviously you are interacting with a server, how much does it take you to add one more rest endpoint for error reporting?

3:52 bitemyapp: Нет терпения для дураков. ((((((

3:52 как будто я глупый.

3:52 sm0ke: рптглудтет упыйра

3:52 akurilin: bitemyapp: ;)

3:52 bitemyapp: мусора

3:53 akurilin: It's sad that you're probably better at typing cyrillic than I am

3:53 bitemyapp: akurilin: certain things make me grumpy. I'm cheating - phonetic keyboard.

3:53 I don't use the native RU keyboard.

3:54 I am not pro rusnetnik.

3:54 akurilin: bitemyapp: were you hiding your fluency in Russian from me this entire time?

3:54 bitemyapp: akurilin: I'm envious of the russians in the bay area. They have quite the community here. I know very little Russian.

3:55 akurilin: That's true, I've run into quite a few so far.

3:55 bitemyapp: I watch old Russian movies and read children's books from time to time. I can barely understand it, let alone say anything.

3:55 akurilin: Not a single Italian though :(

3:55 bitemyapp: akurilin: I work with a young woman who has Italian parents. One is Milanese.

3:56 I guessed she had a milanese parent correctly :)

3:56 I could tell by her appearance, haha.

3:56 akurilin: bitemyapp: that's still pretty impressive.

3:56 bitemyapp: akurilin: she speaks Italian just fine, so far as I know - but I'm not one to judge.

3:56 akurilin: bitemyapp: oh yeah, how so?

3:57 bitemyapp: akurilin: very fair skinned, angular facial features. If both her parents were italian as she said, definitely milanese or somewhere nearby.

3:57 akurilin: bitemyapp: still, you'd think there'd be more of them. I wonder if they don't end up in tech as often.

3:57 bitemyapp: I've been made to understand that the Italian culture, such as it exists in Italy, is very risk averse.

3:58 they respect tenure and pensions more than entrepeneurial success.

3:58 hyPiRion: bitemyapp: I guess that's due to their economy these times

3:58 akurilin: To some extent yes. These days those options are shrinking though due to lack of jobs, and they and Spaniards move to the UK/Germany a lot

3:58 apparently not the US though.

3:58 bitemyapp: hyPiRion: I doubt it would change much even if their economy improved.

3:59 hyPiRion: a poor economy should encourage a wider ranging search for options, not a narrow internal focusedness.

3:59 hyPiRion: the Irish are reacting in a more healthy way - seeking their careers abroad.

3:59 akurilin: Either you move or you live with mom until your 40s.

3:59 Not that it matters since Italians seem to all live past 100 these days :P

4:00 sm0ke: hmm is living with your mom till 40 so dreadful?

4:00 bitemyapp: I'm not sure how you manage sexual or romantic relationships when you live with your parents.

4:00 sm0ke: ungrateful bastards are some of us!

4:00 akurilin: Stuck is a small apartment somewhere not being able to start your own family?

4:00 bitemyapp: It's a disgrace to live with one's parents past college-age where I'm from. I was out of the house at 17 - proudly.

4:01 akurilin: I don't judge, I'm just saying it makes it hard for some to reach some goals in life.

4:01 sm0ke: bitemyapp: derrr herrr derrr

4:01 akurilin: bitemyapp: and yeah this is hugely cultural

4:01 bitemyapp: I don't either, just describing the norms of my culture.

4:01 hyPiRion: bitemyapp: hm, it's opposite here. After the war, people was very risk averse due to the economy. Consequently, the new working generation is more entrepreneurial while the old ones claims we should be happy with a steady income and secure job

4:01 bitemyapp: hyPiRion: I'm less risk averse than my parents and I am dealing with a rougher economy in my young adulthood.

4:02 I expect to retire because of my side business efforts, not at the age of 65 after a long time spent being salaried.

4:02 akurilin: I think people with skillsets like yours simply don't have to worry much about holding onto that one job for the rest of their lives.

4:02 bitemyapp: that's a part of it, but I don't assume programmers are impervious.

4:03 hyPiRion: There's always money in the banana stand.

4:03 bitemyapp: But a lot of the reason I made it is because of my appetite for risk. I could've easily gotten into a rut.

4:03 akurilin: *shhh*

4:03 bitemyapp: if I hadn't moved to NYC I might've been stuck for a long time.

4:04 akurilin: I'm curious how aversion to boredom compares to appetite for risk.

4:04 bitemyapp: akurilin: I have both. I'm simply an unsettled creature.

4:04 akurilin: a study recently released showed that the best employees in a company were also the least satisfied.

4:04 strivers are by definition, not content.

4:04 akurilin: and consequently the most likely to peace out, right?

4:05 bitemyapp: akurilin: hum. it made no comments there. I think the practical take-away is, "keep your best people empowered and stimulated"

4:05 akurilin: Well those two aren't exclusive. The strivers are always ready to bail, so you have to work extra hard to keep them stimulated.

4:06 bitemyapp: I don't know if I'd use the qualifier "always"

4:06 akurilin: Fair enough.

4:06 bitemyapp: I'd put it more in terms that the best people have the most options.

4:06 you really don't want to create a company where only people who have no options stick around.

4:06 but that's the default mode, so it's something you have to work actively against.

4:07 akurilin: That'd be a pretty bad situation to be in .

4:08 bitemyapp: akurilin: that's how it goes for most companies. They get 1-4 years apiece of the good people, the mediocre or bad people become lifers.

4:09 Google's incredibly poor management is in essence subsidized by the quality labor they've locked up.

4:09 but even at Google, that's a minority of the workforce.

4:09 akurilin: It's got to be hard to hire for these teams if you want to try to lift the average.

4:09 bitemyapp: well part of the problem might be that they hire directly for teams.

4:09 Lack of internal mobility and self-direction of labor is a good way to make talent leave.

4:10 akurilin: that's the problem my company solved, remember?

4:10 akurilin: bitemyapp: yes indeed.

4:11 Is it actually solved? Is there data to support that this is sustainable over the long run?

4:11 * bitemyapp shrug

4:11 bitemyapp: 100 people so far, working fine.

4:11 Valve seems to be rather successful as well.

4:11 akurilin: Valve is what, 400?

4:12 bitemyapp: Valve is even more aggressive version of what we do and they're even bigger.

4:12 so I'd tend to believe you can get away with it at any scale a startup would care about.

4:12 The problems of success can be dealt with when they arise.

4:12 clojurebot: I don't understand.

4:12 bitemyapp: ~success is a problem you can deal with when you have it.

4:12 clojurebot: c'est bon!

4:12 bitemyapp: Good bot.

4:13 akurilin: Heh that's fair, I'm all about deferring issues until much later.

4:13 As in, the ones that are completely irrelevant.

4:15 bitemyapp: startups are often bad at determining what really matters at a given point in time.

4:15 akurilin: Very much so.

4:16 Seems like laziness is the way to go for the type of work startups do, as opposed to long-term planning.

4:16 Even though, again, you never know if you're hitting local maxima all the time.

4:17 bitemyapp: not "laziness", just be strategic about where effort is allocated.

4:17 Every single imaginable resource is limited when you're a startup. You have to prioritize aggressively and intelligently.

4:17 and constantly rebalance.

4:18 akurilin: For sure.

4:27 bitemyapp: thanks for the link to logstash, I'll have to check it out, seems interesting

4:27 More tools need mascots, seriously.

4:28 bitemyapp: akurilin: I agree!

4:28 akurilin: logstash + kibana is a nice shake-n-bake setup.

5:21 deg: I'm trying the leiningen 2.3.4 and ":pedantic? :abort", but not sure what it's trying to tell me: "Possibly confusing dependencies found: [lein-marginalia "0.7.1"] overrides [lein-marginalia "0.7.1"]", followed by a NPE.

5:55 peterdon: ,(list "hello bot")

5:55 clojurebot: ("hello bot")

6:03 dsrx: ,'("hello bot")

6:03 clojurebot: ("hello bot")

6:05 hyPiRion: deg: could you post that as an issue to the leiningen issue list?

6:05 sounds like a bug

6:07 deg: hyPiRion. Ok. But, first I'm still trying to pin down exactly what's wrong. I've got a bunch of interlinked projects and everything seems to have broken. And, it's been a few weeks since I last touched this. So, in short, not really clear what's going wrong and which parts are my fault.

6:08 When I touch almost anything I get an obscure error compiling my ns forms: "Exception in thread "main" java.lang.ExceptionInInitializerError" with an irrelevant stack trace.

6:09 hyPiRion: deg: first off, perform a `lein clean` and delete your ~/.m2 directory

6:09 that could resolve issues

6:09 deg: I've already tried the lein clean. Have not tried flushing ~/.m2; will do so now. What typically goes wrong there?

6:10 hyPiRion: deg: Invalid cache entries. If you have some jar which is broken, that could break stuff hard.

6:11 I guess that's not the issue here, but better to be safe than sorry

6:11 deg: ok. Deleted .m2 and watching everything reload now.

6:14 Nope, same problem.

6:15 hyPiRion: ahh, dangit

6:16 if you could try to make a minimal reproduction case and post it to the issue list, that would be aweseom

6:16 deg: ns seems to lose if it includes any dependency outside the project itself.

6:17 I need to untangle some of my spaghetti, before I'm comfortable posting a bug. Right now, the odds are still that it is some typo on my part. I can't yet blame any of the tools for anything worse than poor error messages.

6:17 I'll report back when/if I have anything useful. Meanwhile, my wife is calling me for lunch. :-)

6:24 allenj12: hey i was going throught the joy of clojure book doing the excersices and was wondering what the "f" in this code was doing. i commented the line i was confused https://www.refheap.com/22186

6:27 nones: allenj12: there are stay apostrophe, it mean, that forms in vector not evaluated. So, f is symbol

6:28 ,(into '[f] [])

6:28 clojurebot: [f]

6:28 nones: (type (first (into '[f] [])))

6:28 ,(type (first (into '[f] [])))

6:28 clojurebot: clojure.lang.Symbol

6:31 allenj12: hmm ok i get that, i guess im just confused why you would want a symbol f

6:50 nones: Is there ways to expand vector to function args (apply not suitable, it doesnt work in macros)

7:00 sm0ke: what is default size for 1 in clojure

7:00 i mean like ##(sizeof 1) ; in bytes

7:00 lazybot: java.lang.RuntimeException: Unable to resolve symbol: sizeof in this context

7:01 nones: ,(type 1)

7:01 clojurebot: java.lang.Long

7:01 sm0ke: thanks

7:01 hmm well

7:01 what if dont know the size of Long

7:02 if i*

7:02 nones: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

7:02 long is 64-bit

7:04 sm0ke: nones: isnt that what unqote splice is for

7:04 nones: ~@

7:06 logic_prog: does clojure run on dalvik (the android jvm) ?

7:06 if so, is dalvik much lightweight compared to oracle jvm?

7:07 sm0ke: logic_prog: yes clojure runs on android jvm

7:11 dotemacs: i think theres even a chat room just for clojure on android here on freenode

7:11 silasdavis: I've got a handler module set up with a lein ring init and handler function

7:12 but also with gen-class and -main for a http-kit server

7:12 when I 'lein uberjar' I get a jar that runs the -main class and therefore http-kit

7:12 when I 'lein ring server' I run the ring version

7:13 I was hoping 'lein ring uberjar' would give me a jetty adapter with ring

7:13 but it seems to run the same code path as 'lein uberjar'

7:13 is that to be expected?

7:18 sm0ke: silasdavis: does it makes sense to have seperate profile with :main definition for httpkit?

7:20 silasdavis: sm0ke, yeah perhaps so

7:20 perhaps the uberjar profile (where I have my main and aot options defined) gets applied after lein-ring sets up it's own main....

7:21 I probably shouldn't have http-kit stuff in same module really, since it's not a handler

7:24 corecode: hi

7:24 where can i read about how to implement IFn/AFn for an object?

7:26 logic_prog: is there any project on faking erlang with core.async ?

7:27 sm0ke: logic_prog: lol

7:27 logic_prog: sm0ke?

7:27 core.async threads should be as cheap as erlang threads right?

7:27 sm0ke: they are

7:28 logic_prog: so why hasn't someone smarter than me done it? :-)

7:28 sm0ke: wht do you want to imitate from erlang/

7:28 logic_prog: lots of little threads

7:28 and error handling

7:29 like when a thread goes into an error, instead of fixing it, it just dies and tells another thread what happened

7:30 sm0ke: hmm ok

7:30 yuck

7:31 corecode: is there a way to collect & rest function arguments as map?

7:49 deg: hyPiRion: I've isolated the :pedantic error in a working project of mine, and reported it as a leiningen issue. It was actually a duplicate of https://github.com/technomancy/leiningen/issues/1376, so I just added a comment there. (Now, on to the issues breaking the compile of my other projects).

7:54 hyPiRion: deg: ah, awesome. Thanks

8:12 cYmen: Why is it that when I "use" a namespace I don't get the dependencies?

8:12 So basically if I use a module and then try to run a function therein line by line it doesn't work.

8:21 deadghost: cYmen, what?

8:22 just in case there's confusion "use" doesn't download the dependency for you

8:23 is there a main clojure book to learn from?

8:24 I've been piggybacking off what I know from CL

8:24 hyPiRion: cYmen: Consider (use 'clojure.core.logic), which version of clojure.core.logic should it download, and from where?

8:24 deadghost: http://www.clojurebook.com/

8:25 deadghost: first line is a hoot

8:25 "We've worked with Clojure for many years now"

8:25 that's like saying we've been here since the beginning

8:26 cYmen: I don't want it do download deps, I want it to recursively use stuff.

8:27 When I load a module in the repl I want the code as written in that module to work in the repl.

8:28 deadghost: oh I see

8:28 cYmen: Manual debugging, run it line by line...

8:28 deadghost: you want the dependencies of that namespace

8:29 if that's what you're asking idk and I would like to know

8:37 cYmen: looks like switching to the namespace using (ns ..) does what I wanted

8:42 deadghost: oh geez

8:42 looking at clojurebook's table of contents

8:42 it looks very thorough and get shit done oriented

8:45 cYmen: clojurebook?

8:45 clojurebot: clojurebook is http://clojurebook.com

8:46 cYmen: Ah, don't have that yet.

8:46 deadghost: if it was my intro to lisp

8:46 I think I'd cry

8:46 cYmen: Clojure the language is pretty pleasant, the tools I still don't really like.

8:47 deadghost: I've enjoyed tooling so far

8:47 took me a while to figure out CL's asdf and quicklisp

8:47 cYmen: And quicklisp already made everything so

8:47 much easier.

8:48 deadghost: experience with lein has been superior

8:48 cYmen: Now I am getting a nullpointer exception in some third party library, I can't call it from the repl because something in that function requires ring state or whatever...it drives me crazy

8:49 deadghost: I need to brush up on my lisp though

8:49 since I never understood macros enough to practically use them

8:49 and right now I have something that only a macro can do

8:50 cYmen: Macros are hard to read and write but simple conceptually...it's just code generation

8:52 deadghost: but otherwise, getting into clojure has been surprisingly easy

8:52 cYmen: I thought the same but then I wanted to do something specific and since then I feel like I am drowning in frameworks and dsls.

8:53 deadghost: the first thing I wrote was a scraper

8:53 now I'm writing a site for it using compojure + enlive

8:54 korma was kind of ehhh but I don't think I like ORMs in general

8:55 cYmen, what are you working on

8:55 cYmen: I'm just trying to make a simple webapp.

8:55 deadghost: what are you using?

8:55 cYmen: Right now trying to figure out how to get something from a database.

8:56 Currently I'm not even working on it I just bought web development with clojure and I'm trying to work through the examples.

8:56 And apparently sql/with-query-results is not in the current jdbc anymore...

8:56 deadghost: cYmen, what does it suggest using for db stuff?

8:57 not sure if I want to use jdbc or korma

8:57 right now I'm kind of just throwing my arms in the air and using raw queries in korma

8:58 cYmen: Totally valid....

8:58 I think that is something I miss about clojure. An easy but wrong way to do things until you want to do them right.

8:59 Uatec__: cYmen, the thing is, people do it the easy but wrong way, and then leave it

8:59 5 years down the line, the code is being reviewed and it's just totally uterlly awfully wrong

8:59 deadghost: I'm finding it very hard to shove out working spaghetti code in clojure

8:59 cYmen: Uatec__: With clojure it's more like "people try to do it the easy way then leave clojure"? :)

8:59 deadghost: I still end up having to write very small functions

8:59 Uatec__: good

8:59 deadghost: and mapping over/composing

8:59 cYmen: hehe

9:00 Uatec__: let me get this... you WANT to write spaghetti code?

9:01 cYmen, that's a valid concern, but if you give people a half way house, people will inhabit that and never do things properly

9:01 you should give people all or nothing options... but make the All option useful enough to them

9:02 cYmen: You're never going to change people. If you give them all or nothing they will just go find somebody who gives them whatever they want. :)

9:03 But that's philosophy, let's stick to programming. Nobody forces me to use clojure after all and if I didn't like it I wouldn.

9:03 deadghost: hmm well if I'm the only one working on something

9:03 and it's a personal project

9:03 sometimes I just want to shove out something working

9:03 and fix it later

9:03 and that does not seem to fly in clojure

9:04 cYmen: deadghost: I'm glad I already knew functional programming.

9:04 deadghost: I'm amazed how little I miss iteration

9:05 400 lines of code and I didn't even consider it

9:07 cYmen: Well, it's not like there is no iteration, it's just slightly different. :)

9:37 grandy_: hello just typed one of the examples from clojuredocs into my repl and the output is not what the doc appears to say it will be... (def foo (map println [1 2 3]))

9:37 (foo) raises an exception

9:37 would anyone mind explaining this to me

9:39 is this b/c i'm using the repl? still not sure why it would raise "lazyseq can't be cast to clojure.lang.IFn")

9:40 cYmen: grandy_: (map println [1 2 3]) is immediately evaluated

9:41 so what you want is not (foo) which would call a function but instead foo which will display the value of that thingy

9:41 grandy_: cYmen: ahhhh

9:41 cYmen: ok, makes sense

9:41 cYmen: grandy_: Maybe you wanted defn instead of def?

9:42 In that case you will also need an empty parameter list

9:42 grandy_: cYmen: i was just following the example in this: http://clojuredocs.org/clojure_core/clojure.core/doall

9:42 cYmen: (defn foo [] (map println [1 2 3]))

9:42 now (foo) should work

9:43 grandy_: cYmen: i appear to have misunderstood the point of the example... thanks for making it click

9:43 cYmen: grandy_: Well, they never call (foo) in that example. ;)

9:43 grandy_: cYmen: yeah... doh

9:43 cYmen: The point of the example is that when you map println over a list nothing actually happens

9:43 only when you try to access the result or in this case use "doall" will it actually run and print something

9:43 deadghost: map's lazy eval caught me a while back

9:44 grandy_: i'm doing some very basic stuff w/ csv files and taking the opportunity to use clojure but obviously haven't done much w/ clojure yet so i'm still a bit clueless

9:45 cYmen: grandy_: Well, lazy evaluation with side effects is a bit tricky. They don't play well together.

9:46 deadghost: in my case I ended up wrapping maps with side effects in dorun

9:46 grandy_: cYmen: ahh

9:46 cYmen: If you (def foo (map println [1 2 3])) nothing will be printed. If you try to print foo now using "foo" it will actually call the println AND show the result. In my case that gives a garbage output mixing both.

9:46 hyPiRion: deadghost: another option may be to use `doseq`.

9:47 cYmen: grandy_: https://www.refheap.com/ea456899f5afced5b10a7ae7e

9:48 grandy_: cYmen: same output here

9:48 cYmen: The first ( is from the contents of foo (which is a list of three nils) then 1 2 3 is the result of the println calls and then comes the rest of that list of nils which should actually be (nil nil nil)

9:49 grandy_: Do you know the principle of lazy evaluation?

9:49 grandy_: cYmen: i think so

9:49 cYmen: kk

9:51 grandy_: cYmen: i think my understanding isn't all that real yet, bc i don't fully understand why foo returns that

9:51 cYmen: foo doesn't return anything foo is just a variable :)

9:51 (def foo 3) <- variable!

9:52 (def foo (....)) <- still a variable! :)

9:52 (defn foo [] (...)) <- now it's a function

9:52 grandy_: cYmen: ahh right...

9:52 cYmen: why does foo print [1,2,3] at all?

9:52 hyPiRion: foo is a variable regardless

9:53 cYmen: hyPiRion: Well, it is a variable storing a function but let's keep it simple. :)

9:54 grandy_: Well, lazy evaluation in the most simple words means "When you call a function, I don't actually run it (because I'm lazy) I only run it when you try to access the return value of that function.

9:55 deadghost: grandy_, try this

9:55 do def foo

9:55 and foo

9:55 then foo again

9:56 cYmen: grandy_: So when you (def foo (map println [1 2 3])) you get a magic thingy back (usually called a thunk) which is sort of a promise that you can actually get it if you want to

9:56 grandy_: ahhh

9:56 cYmen: Now if you type "foo" in the repl and the result needs to be printed you're cashing in that promise and the code has to execute now...

9:57 deadghost: cYmen, where did you learn lazy eval from?

9:57 grandy_: cYmen: ahh ok makes sense

9:58 cYmen: deadghost: haskell in my first cs course at the university...

9:58 deadghost: I was thinking of picking up some haskell when I encountered laziness

9:58 but now it seems unnecessary

9:58 grandy_: thanks guys for the help

9:58 deadghost: uhhh

9:58 cYmen: you're welcome :)

9:59 deadghost: is haskell actually a good choice for a first cs course?

9:59 wei__: is there a more succinct way of saying (map #(vector %1 %2) [:a :b :c] [1 2 3]) ?

10:00 ,(map #(vector %1 %2) [:a :b :c] [1 2 3])

10:00 clojurebot: ([:a 1] [:b 2] [:c 3])

10:00 hyPiRion: (map vector ...)

10:00 cYmen: deadghost: It wasn't particularly hard and it didn't give any advantages because almost nobody knows haskell. It also introduces all kinds of things that are useful to know and shape your thinking so I'm going to go with: yes. :)

10:00 deadghost: ,(map vector [:a :b :c] [1 2 3])

10:00 clojurebot: ([:a 1] [:b 2] [:c 3])

10:01 wei__: cool. i was thinking of something like zip, or interleave? but with a result as a vector instead of a map

10:01 deadghost: cYmen, well that's surprisingly

10:02 then again SICP looks overly difficult for a first book to me

10:02 cYmen: I don't know it may be a personal thing. :)

10:03 I think functional programming is a lot simpler conceptually and easier to explain than normal computing. It's just the knowledge about other programming languages that confuses some people.

10:04 When I first tried to explain python to my girlfriend she stared at a=3 a=5 and asked me "how can a be two different things?" she only knew variables from maths classes where things don't usually change value

10:04 tada functional programming :)

10:05 lllambda: hi, i have a map of maps over which i would like to pass a function (returning a new map of maps), e.g. {:foo {:bar 1 :baz 4 :qux 2}}. in this case i actually want to do two things: sum the ints and then divide the ints by that total, assigning the result as the new value of those submaps

10:05 brackets: cYmen: haha

10:05 lllambda: i have a nested reduce solution that's pretty nasty, but seems to work. is there a more idiomatic way?

10:06 nones: lllambda: can you give input and output example?

10:07 deadghost: not sure where I'd be if my intro to programming was functional

10:07 I pretty much just fumbled around until things made sense

10:07 php -> c -> lisp basically

10:07 I think the k&r really helped

10:08 brackets: The Elements of Computing thrown in for good measure helps.

10:08 deadghost: I have never heard of that book before

10:08 lllambda: nones: say we use that map of maps, the output would be something like: {:foo {:bar 1/7 :baz 4/7 :qux 2/7}}

10:08 deadghost: is that babby's first prog book?

10:09 because there's a babby on the cover

10:09 lllambda: assume there's more top-level keys besides :foo too

10:09 deadghost: >building a modern computer

10:09 brackets: well if by baby you mean go from chip to cpu to asm compiler to stack math to language design :)

10:09 deadghost: "the best way to understand how computers work is to build one from scratch"

10:10 oh geez what is this

10:10 brackets: its a survey of how it all works close to the metal

10:10 hyPiRion: lllambda: https://www.refheap.com/22189

10:10 deadghost: I'll put it on my reading lisp but low level stuff has never appealed to me

10:11 *list

10:11 lllambda: hyPiRion: that doesn't seem to be loading for me

10:11 brackets: its quite short. 200 pages maybe? and you won't be disappointed.

10:12 deadghost: see

10:12 k&r was also "quite short"

10:12 cYmen: brackets: oh thats nand2tetris...

10:12 hyPiRion: lllambda: arg, sec

10:12 deadghost: now I don't associate number of pages with shortness

10:13 lllambda: hyPiRion: oop, it just loaded up. guess i wasn't patient enough :)

10:13 hyPiRion: this looks cleaner, thank you!

10:13 brackets: deadghost: its well written, readable, and interesting.. nothing like K & R :)

10:13 lllambda: i didn't know about map-vals

10:13 (or had forgotten)

10:14 corecode: what is well written?

10:14 brackets: corecode: http://www.nand2tetris.org/

10:14 lllambda: er i see, you defined it. need some coffee to wake up

10:14 hyPiRion: lllambda: Yeah, it's not in Clojure core, although it's frequently used

10:14 https://github.com/flatland/useful/blob/master/src/flatland/useful/map.clj has loads of others

10:17 deg: Are there known issues of project compilations failing because of conflicts between different recursive dependencies on recent version of clojurescript?

10:17 lllambda: hyPiRion: here's what i was doing previously --> https://gist.github.com/maxcountryman/8ee60dbd251730cd1076

10:18 great link, starred. thank you

10:19 hyPiRion: lllambda: yeah, that works as well. It really boils down to which one you consider more readable

10:19 cYmen: deg: I think so: https://groups.google.com/d/msg/light-table-discussion/Jy03Ka73-Qk/lSS5uSjJeB0J

10:19 lllambda: i don't think what i wrote is easily readable, even by me :)

10:22 deg: cYmen: Thanks. I didn't I hit exactly the same issue, but close enough. I can fix it by rolling my project back to a slightly earlier CLJS. Testing now to see if I can, instead, exclude the earlier one from the library deps.

10:23 I WISH clojure could do a better job of error reporting. There was nothing in the error or stack trace to suggest that this was the problem; I had to do many minutes of annoying debugging.

10:23 silasdavis: I am trying to run lein ring uberjar

10:23 when it creates the jar

10:24 and I try and run it with java -jar *-standalone.jar, it complains that it cannot find myproject.handler.main

10:24 my ring profile is: :ring {:init redditch.handler/ring-init

10:24 :handler redditch.handler/app}

10:24 (redditch is project name)

10:25 I used to have a main in redditch.handler, but I've since remove this

10:25 deleted target and lein clean'd

10:25 *ring settings I should say not profile

10:29 jcromartie: silasdavis: it says "myproject.handler.main"?

10:30 where is "myproject" coming frmo?

10:30 silasdavis: sorry, I should have used redditch from the start

10:32 jcromartie: do you have a :main key in your project?

10:33 jarodzz: hello, guys

10:35 silasdavis: jcromartie, only in a profile 'httpkit'

10:35 and that points at redditch.server

10:38 jcromartie: hm, that's strange

10:39 gdev: hey jarodzz

10:39 jcromartie: and it's complaining about a missing redditch.handler.main, not redditch.handler/main

10:39 jarodzz: hi, gdev

10:39 i want to generate a java object from a java hashmap

10:39 with clojure

10:40 like i have a map {"name":"john", “age":18}

10:40 i want to generate an object with name and age fields, with value john and 18

10:41 any one got a clue?

10:41 silasdavis: jcromartie, Error: Could not find or load main class redditch.handler.main

10:42 gdev: jarodzz, yeah you'd just need to destructure your map when you're calling the constructor of the java object

10:43 jarodzz: gdev, thanks, man

10:43 i'll give a try

10:43 now. catch u later

10:44 gdev: (let [my-map {:name "john" :age 18}] (Person. (:name my-map) (:age my-map)))

10:45 jarodzz, ^ that's not pretty but should get you pointed in the right direction

10:46 silasdavis: jcromartie, on a different box I get Exception in thread "main" java.lang.NoClassDefFoundError: redditch/handler/main

10:46 jarodzz: gdev, many thanks man .

10:46 as long as it works

10:46 :)

10:46 silasdavis: I have no main specified anywhere in project.clj

10:48 this is really odd

10:49 removing all my aot stuff yields

10:49 Warning: specified :main without including it in :aot.

10:49 Implicit AOT of :main will be removed in Leiningen 3.0.0.

10:49 If you only need AOT for your uberjar, consider adding :aot :all into your

10:49 :uberjar profile instead.

10:49 but I don't think I'm specifying main anywhere

10:49 is there any file where this could be happening?

10:49 other than project.clj

10:49 ior3k: possibly stupid question: how do you guys endure through papers that, superficially at least, seem extremely boring, like "out of the tar pit"? I feel this tendency of mine for tl;dr is seriously hampering my ability to grow as a programmer

10:50 jcromartie: silasdavis: honestly I've avoided lein-ring and just used my own hand-rolled :main for a while now

10:51 gdev: ior3k, everyone learns differently, maybe reading dry papers isn't your learning style

10:52 ior3k, lucky for you there are some good talks on YouTube that kind of summarize what "out of the tar pit" was getting at

10:53 jcromartie: summary: only store inputs, keep everything in sets

10:53 done!

10:53 ior3k: gdev: I find many youtube talks help. But I wonder how far I can go with that

10:55 gdev: ior3k, the only constraints is that you're limited to the papers that have been summarized in a talk that has been posted online

10:56 ior3k: gdev: I feel that will keep me away from a lot of juicy stuff though

10:58 gdev: ior3k, as far as your specific problem I tend to skim long papers a few times for something that catches my eye and eventually I'll be familiar with it enough to labor over the parts I know contain the meat

10:59 ior3k: gdev: I'll try that, thanks

11:02 gdev: ior3k, sorry that I'm the only one commenting on this, I'm sure there are better ways, but that's how I defeat my ADHD long enough to grok the classics

11:02 ior3k: gdev: I appreciate your help :)

11:02 ddima: gdev: I think thats a good approach

11:03 skimming a couple of times certainly helps getting acquainted with the subject

11:04 ior3k: but in the end you'll have to find out what works best for you. for example, sleeping things over can not be underestimated ;)

11:05 jcromartie: how can I run a Clojure app forever that doesn't block the main thread?

11:05 ior3k: ddima: true that, I still wish papers were written in the head first style, though :)

11:05 gdev: ior3k, yes hammock driven development also works here as well

11:06 jcromartie: i.e. how to run Jetty with {:join? false} from my -main

11:10 gdev: jcromartie, are you looking to do something like (defn -main [port] (run-jetty app {:port port :join? false}))

11:13 jcromartie: gdev: sure I know how to do that, but I guess what I'm asking is how to join it after creating the server

11:14 I've got a main namespace that has an atom containing the state of the "moving parts" of the system: the server, DB, etc

11:14 but I want to be able to start it in either an interactive REPL or as a -main

11:14 maybe I'm wrong?

11:14 I'm just assuming… hah

11:17 I guess Jetty marks its thread as a daemon thread

11:17 well look at that

11:17 no need to join

11:18 Java doesn't exit

11:28 gdev: jcromartie, when you figure it out, post a link to it if its open source because I'm interested to see what you are trying to do

11:30 dotemacs: Hi, I needed to do some PDF related work, form filling and document concatenation, so I put this together: https://github.com/dotemacs/pdfboxing

11:36 jcromartie: gdev: I did figure it out :) I was just wrong in my assumption

11:37 I thought I *had* to join the thread to keep the JVM from exiting. But if you start Jetty from -main with {:join? false} it will not exit, even though the -main function exits

11:37 I don't know why I was mixed up

11:38 justin_smith: jcromartie: what I do is start an nrepl from inside the function that generates my ring handler

11:38 jcromartie: then I get the server running, plus the ability to connect to the repl and fuck around

11:39 gdev: dotemacs, that looks interesting, always good to see a java library wrapped in parens

11:39 dotemacs: gdev: thanks :) not sure if those are words of praise or jest :)

11:40 gdev: dotemacs, words of praise =D

11:40 dotemacs: ;)

11:45 jcromartie: justin_smith: I like that idea. I'm using Cider.

11:45 So I don't really need to start another NREPL

11:45 nREPL whatever

11:46 justin_smith: jcromartie: cidre can connect to an external repl

11:46 and a repl is more useful if it is inside your servewr

11:46 *server

11:46 jcromartie: yes it is

11:47 I'm interested in the prospect, however I feel like the client/sysadmins would hate it

11:47 they take security seriously

11:47 even if it's exposed over SSH

11:47 justin_smith: I use the environment to decide whether it launches

11:47 very simple

11:47 jcromartie: yeah

11:47 justin_smith: (if (not= environment "production) (nrepl/server-start port))

11:48 dotemacs: story no.1 on HN right now is 'Why use Clojure?' https://news.ycombinator.com/item?id=6959405

11:49 Raynes: Ho ho ho.

11:50 dotemacs: Only good response to that question is "Because other lisps have too many parens :("

11:50 Clearly.

11:50 dotemacs: haha

11:52 jcromartie: congrats dotemacs

11:53 we've actually gone pretty whole-hog on Clojure for every new project at work now

11:53 like, 8 people using it?

11:53 yeah

11:53 dotemacs: jcromartie: on what ? :) the pdf library or ...?

11:54 jcromartie: pdf library?

11:54 dotemacs: jcromartie: I posted this earlier: https://github.com/dotemacs/pdfboxing

11:54 justin_smith: jcromartie: did you think that article on hn was by dotemacs ?

11:54 gdev: wow, there's already a video from the 2013 conj posted on clojure's youtube channel.

11:54 technomancy: bbloom: my five-year-old runs in, "Daddy, I'm so excited today" / "Oh, because of Christmas?" / "No, because I almost finished code.org!"

11:54 dotemacs: justin_smith: it looks like he did

11:55 jcromartie: i just shared the HN link here, thats all :)

11:55 deadghost: makes me think of those HN articles

11:55 jcromartie: dotemacs: shouldn't you compare a plain Java fib method to a Clojure fib fn, rather than a whole Java program to a Clojure fn/

11:55 deadghost: "How I taught my 5 year old to code."

11:55 and right below it

11:55 jcromartie: oh yeah what

11:55 gdev: technomancy, that's awesome

11:55 jcromartie: sorry dotemacs

11:55 I see

11:55 deadghost: "Why 5 year olds should be playing and having a life instead of coding"

11:58 justin_smith: whoever wrote that fucking "why use clojure" article is a false flag clojure hater trying to scare people away from the language

11:59 jcromartie: I doubt it. He might just suck at thinking/writing.

11:59 justin_smith: the examples aren't even valid code, the project.clj is needlessly complex

11:59 jcromartie: an idiot that agrees with you is worse than a smart enemy

12:00 deadghost: you'd be amazed how crazy/dumb people can be

12:00 justin_smith: fair enough

12:00 still a bad article, regardless

12:01 deadghost: I saw an article on "jquery doesn't have a for loop... but js does!"

12:01 and people thanking the author in the comments

12:01 for teaching them jquery is written in js

12:01 and why jquery doesn't have a jquery specific for loop

12:02 jcromartie: I've heard it way too many times… "I know jQuery, but not JavaScript"

12:03 dotemacs: justin_smith: nice quote re: 'idiot...'

12:03 justin_smith: hey, I know clojure but not java, same diff right?

12:03 dotemacs: bad paraphrase of the best teacher I ever had

12:04 at least you can learn something from a smart enemy.

12:05 jcromartie: justin_smith: I wouldn't say so… Clojure : Java :: jQuery : JavaScript is not true

12:05 justin_smith: it was a tenuous reach, clojure is a java library after all

12:05 jcromartie: ok

12:05 yeah

12:05 but jQuery doesn't add new syntax to JavaScript :)

12:05 justin_smith: I was being glib though

12:05 yeah

12:06 and I actually know enough java to know how to use the jvm, I just haven't directly written java is all

12:07 jcromartie: jQuery is a domain specific language for making an intractable mess

12:08 the other day a Puppet Labs guy told me "the Puppet language is a DSL on top of Ruby" at which point I had to say "hold on a sec..."

12:08 it's not

12:08 at all

12:11 justin_smith: Every program is a DSL. Some of them are even useful for using programattically.

12:13 dotemacs: jcromartie: sorry, what point are you making regarding puppet ?

12:14 justin_smith: he is saying it is not a DSL

12:15 dotemacs: justin_smith: i get that part, but i don't understand what he backs it up with, hence the question

12:15 justin_smith: i fully agree with you about every program being a DSL

12:16 gdev: link in HN post was blocked as a security risk by websense. comments section was TL;DR, doubt I missed anything more than flaming troll bait or trolling flame bait

12:17 justin_smith: the latter, or geniune stupidity, one of those

12:18 "here is some code that isn't even valid, see how good the language is?" "here is a rediculously overcomplex build configuration file, isn't that cool?"

12:18 jcromartie: dotemacs: no, I'm saying that .pp files are not "a DSL on top of Ruby" which is what the Puppet Labs guy said… it was in-person, we had a bit of back and forth over what that phrase means

12:19 dotemacs: if Ruby expressions are not valid, it is not "a DSL on top of Ruby"

12:19 dotemacs: in new versions they *do* allow you to use .rb for modules

12:20 "DSL on top of X" means a superset of X, i.e. just new functions or syntax added

12:20 gdev: justin_smith, oh yeah that does sound like an enlightening PLT discussion

12:20 jcromartie: within the constraints and capabilities of X

12:23 dotemacs: jcromartie: well, we're nitpicking here but a DSL is a language designed for a specific domain, rather than a 'superset' as you call it

12:24 jcromartie: im going by wikipedia definition here

12:26 justin_smith: dotemacs: the operative thing here is the word "on"

12:26 "on" implies superset

12:26 jcromartie: yes

12:26 examples: Rake

12:26 justin_smith: "in" impliest subset

12:27 dotemacs: justin_smith: right, when you put it like that, then I have to agree

12:48 deadghost: hmmm ehhhh

12:48 I basically have the same question as this guy: http://stackoverflow.com/questions/11911010/binding-a-local-var-in-deftemplate-for-enlive

12:48 bbloom: technomancy: awesome!

12:48 deadghost: I'm querying from a db and want it in a local var

12:49 so I can slowly suck out it's delicious data

12:49 mucking with the lib seems kind of crappy

12:50 zerokarmaleft: bbloom: I've contributed 3 girls to code.org's demographic data, I plan to add a 4th this weekend

12:52 bbloom: zerokarmaleft: killer. glad you're liking

12:53 justin_smith: deadghost: classic problem to compose a macro with new functionality, you must also make a macro

12:53 the macro rule of contagion

12:53 bbloom: zerokarmaleft: add the word "it" to that sentence :-P

12:54 zerokarmaleft: bbloom: it's certainly more effective when I sit with them, but they're having a blast

12:56 deadghost: well, I guess I can't put off learning macros then

12:56 bbloom: zerokarmaleft: yeah, it's not quite *zero* teacher yet, but the videos are quite useful and the the game-like nature of it doubles as a baby sitter. in my experience, you can watch/help quite a few kids at once, which isn't remotely the case with scratch

12:57 zerokarmaleft: and it's fascinating to watch each of them build up different solutions, their thinking patterns are wildly different even at the same age

12:57 justin_smith: deadghost: also enlive can return edn, and it is viable to instead alter the edn it returns before rendering

12:57 deadghost: edn?

12:58 justin_smith: vanilla clojure datastructures

12:58 arrdem: deadghost: Extensible Data Notation.

12:58 justin_smith: maps, vectors, lists

12:58 strings, numbers, characters

12:58 arrdem: deadghost: a JSON equivalent subset of Clojure syntax.

12:58 deadghost: I see

12:58 gdev: deadghost, it could be worse, you could try to use a monad

12:58 arrdem: gdev: sssh the haskellers will hear you

13:00 technomancy: bbloom: have you looked at etoys at all?

13:00 looks like a somewhat more sophisticated Scratch

13:00 gdev: arrdem, i doubt they can hear me over the sound of their own smugness, lol just kidding, I love them all, especially bitemyapp

13:15 varnie: hello. I have found a typo on the official Clojure website.

13:16 here: http://clojure.org/getting_started ("Himera provides a browser-baed ClojureScript REPL"). "baed" <-- this one

13:16 arrdem: is it me or did everyone miss the point of the article over here.. https://news.ycombinator.com/item?id=6958983

13:16 varnie: awesome. lemme figure out where the issue needs to go.

13:19 hum...

13:20 technomancy: is it appropriate to ping dev.clj.org with the above? I'm not seeing a seperate channel for website typos.

13:48 popinman322: I'm getting "Unable to resolve var" when I attempt to resolve a let variable

13:48 How would I get around that?

13:50 jcromartie: popinman322: code?

13:50 that should not happen

13:50 I assume you are trying to use it outside of the let scope

13:50 gdev: popinman322, yeah it sounds like you're out of the let block then

13:52 popinman322: (let [beginning (fn [x] ...)] ((#'beginning) (fn [reader buffer] ...)))

13:53 The second function in the list also references beginning

13:55 gdev: popinman322, paste the whole thing at https://www.refheap.com/ and include the stacktrace

13:58 please?

13:59 popinman322: gdev: On it

13:59 gdev: popinman322, thanks

14:01 popinman322: gdev: https://www.refheap.com/e8bc2884ef718c0fe41b06f5d

14:02 justin_smith: popinman322: why are you asking for the var behind a let bound value?

14:02 popinman322: #' means "give me the raw var, not the thing it points to"

14:03 in that context, beginning is not a var, it is a let binding

14:03 popinman322: justin_smith: Just started using Clojure, please inform me @_@

14:03 justin_smith: beginning is not a var

14:03 in that context it is a value bound by let

14:03 so there is no var to dereference

14:04 popinman322: And it can't escape the let binding?

14:04 justin_smith: escape it to what?

14:04 it is a name for a value

14:04 'beginning gives you the raw symbol

14:04 beginning gives you the value

14:04 what else could you access?

14:04 popinman322: I want the function that is beginning to be in the list returned by let

14:05 justin_smith: functions are values

14:05 you don't need a special quotation syntax for them

14:05 ,=

14:05 clojurebot: #<core$_EQ_ clojure.core$_EQ_@1715346>

14:05 popinman322: '(beginning)

14:05 ?

14:05 justin_smith: oh, you want beginning inside a list?

14:06 popinman322: Indeed

14:06 justin_smith: then yeah, '(beginning) or [beginning]

14:06 if a vector is acceptable that is more readable

14:06 popinman322: Would the value persist outside of the let binding, though?

14:06 justin_smith: similar issue with every other usage of #' in your paste

14:06 when you don't quote the symbol, you are accessing the value not the symbol

14:06 popinman322: Alright

14:06 justin_smith: the value persists outside the let binding, if you pass it out

14:07 this is what closures are, btw

14:07 kinda the thing clojure is named after :)

14:08 so, do you understand that error message now?

14:08 ,(doc var)

14:08 clojurebot: Gabh mo leithscéal?

14:09 justin_smith: ,(use clojure.repl)

14:09 clojurebot: #<CompilerException java.lang.ClassNotFoundException: clojure.repl, compiling:(NO_SOURCE_PATH:0:0)>

14:09 justin_smith: weird

14:10 anyway, it may help to look into what vars are, and how they are different from let bindings

14:10 gdev: ,(use 'clojure.repl)

14:10 clojurebot: nil

14:10 justin_smith: wait, how is that different from what I did?

14:10 ,(doc var)

14:10 clojurebot: Excuse me?

14:11 justin_smith: oh, ok, I forgot to quote the ns

14:15 gdev: lazybot, ,(doc var)

14:15 I forgot how to switch bots =/

14:16 justin_smith: #(doc var)

14:16 &(doc var)

14:16 lazybot: ⇒ "Special: var; The symbol must resolve to a var, and the Var object\nitself (not its value) is returned. The reader macro #'x expands to (var x)."

14:16 justin_smith: FINALLY

14:16 a var is one of the mutible container types, like ref or atom, it is used to store values in namespaces

14:17 a let binding is just a symbol to value translation

14:18 popinman322: justin_smith: I see

14:18 Thanks

14:22 jcromartie: grrr, trying to figure out how to get output from log4j to show up in nrepl

14:22 works fine with "lein run"

14:24 but on an nREPL connection (via cider) nothing is output

14:25 with the same log4j config

14:25 console appender...

14:26 gdev: jcromartie, so you are in emacs? if so, what does your *nrepl-server* buffer show

14:26 jcromartie: hm, there it is

14:27 I didn't know that was there

14:27 cemerick: I keep meaning to go figure out how to get that output to stream to the REPL interaction window.

14:27 jcromartie: in the past, I used bound-fn on my handlers

14:27 justin_smith: it is because *out* is a dynamic var, I am sure

14:27 jcromartie: but for some reason that doesn't work with clojure.tools.logging

14:29 i.e. the handler fn I passed to run-jetty was (bound-fn [req] (my-handler req))

14:29 that only works for println

14:29 cemerick: jcromartie: none of the logging stuffs touch *out* at all

14:29 jcromartie: I didn't think so

14:30 so, the *nrepl-server* buffer captures System/out System/err?

14:30 or what

14:30 cemerick: yeah, that's just a window to the tty of the process AFAIK

14:30 jcromartie: ok that's easy enough

14:32 I could rewire System/out ?

14:33 well anyway I have my log output, that's good enough

14:35 BAMbanda: why am I getting errors when I try to call my (pig-latin) function?

14:35 http://paste.lisp.org/display/140661

14:35 justin_smith: what is the reasoning for not putting the output of the process in the nrepl buffer anyway?

14:36 BAMbanda: java.lang.IllegalStateException: Attempting to call unbound fn: #'brainfood.core/pig-latin

14:36 Var.java:43 clojure.lang.Var$Unbound.throwArity

14:36 AFn.java:39 clojure.lang.AFn.invoke

14:36 /home/shai/clojure/brainfood/src/brainfood/core.clj:20 brainfood.core/eval4737

14:38 justin_smith: BAMbanda: I don't think this is the source of your problem, but in general it is better not to put side-effecting code (like the printlns) at the top level. Instead, move -main to the bottom of the file, and put the printlns in there

14:39 then lein run will run -main, or from a repl you can call it manually

14:41 BAMbanda: justin_smith, hmm ok

14:41 thanks

14:42 justin_smith: BAMbanda: all that code works if I paste it into a repl

14:42 BAMbanda: justin_smith, yeah i see

14:42 justin_smith: so maybe the problem is just that the printlns are at the top level, and maybe putting them inside -main would be enough to fix your issue

14:43 though I thought definitions would be guaranteed to be carried out in top to bottom order in an ns

14:45 andyf: If anyone feels the urge over the holiday season to experiment with copying Scala's hash function implementations to Clojure for some comparative experiments versus Clojure's current hash functions, let me know.

14:45 Such work could end up in Clojure's implementation, if it compares favorably versus some other alternatives.

14:45 But no guarantees on that.

14:52 arrdem: andyf: did you see the hashing thread on the main clojure mail list?

14:53 andyf: I think that the scala hashfn got some treatment there already.

14:54 andyf: arrdem: I was a participant in that thread, if it is the one I am thinking of. The reason I am asking is that I have heard second-hand that Rich would like to see a comparison of a proposed change to the hash function (from Mark Engelberg) against Scala's implementation, before deciding.

14:54 To my knowledge, no one has yet experimented with the Scala hash in Clojure yet.

14:54 arrdem: andyf: ok. I just remember seeing the thread and thought I'd bring it up.

14:55 andyf: I may elect myself the victim for this just so that I learn how to build the core...

14:55 andyf: arrdem: And thanks. It was relevant :-)

14:55 arrdem: If you want help, I can give you tips. It is not hard.

14:57 sprocket: does anyone have any recommendations as to the best clojure book out there?

14:58 gfredericks: ~book

14:58 clojurebot: book is books

14:58 andyf: arrdem: There is no need to follow the parts of the following wiki page that describe how to create patches until you are ready to do that, but the pulling a Clojure tree and building it steps are here, too: http://dev.clojure.org/display/community/Developing+Patches

14:58 arrdem: sprocket: how much clojure have you written? what are you looking for?

14:59 sprocket: arrdem: just starting out with clojure, though i've been doing dev in other languages for 15+ years so i can handle more advanced topics

14:59 andyf: sprocket: I'd recommend Clojure Programming published by O'Reilly

15:00 sprocket: andyf: thank you - i'll check it out

15:00 arrdem: sprocket: so if you're looking to learn good clojure design and thinking, The Joy of Clojure is awesome.

15:00 sprocket: arrdem: great, thanks!

15:00 arrdem: sprocket: Clojure Programming is more basic stuff, but still a good tour of the language

15:01 justin_smith: I would say joy of clojure if you already have lisp fu

15:01 elfenlaid_: The Joy of Clojure is kind of advanced book, but a bit boring

15:02 justin_smith: so it depends what kind of languages those 15 years represent

15:03 sprocket: justin_smith: i've done a reasonable amount of common lisp over than time, so it should be alright

15:03 arrdem: sprocket: er no. that means yoi'

15:03 *you'll have to unlearn mutable state lisp

15:03 that had me on my head for a solid month :/

15:03 sprocket: hah, alright :)

15:04 arrdem: sprocket: that said, I think you'll be pleased with the relative sanity of our data literals and macros.

15:04 sprocket: total step up from clisp and relatives.

15:06 justin_smith: well idiomatic common lisp uses conses as if they were immutible - mostly

15:07 or mine did at least

15:07 arrdem: in that case I have a bone to pick with some people....

15:07 justin_smith: arrdem: maybe I am overly generous

15:08 rplaca, rplacd etc. of course are there - but I rarely found myself needing them, personally

15:08 arrdem: justin_smith: the only largeish clisp codebase I've worked with made extensive use of in-place list mutation.

15:08 justin_smith: OK

15:08 arrdem: justin_smith: it was C in s expressions.

15:09 justin_smith: sorry to hear that, it must have sucked

15:09 arrdem: no it didn't, I threw it out and wrote clojure :D

15:12 gfredericks: combining the low-level performance of lisp with the ease-of-reasoning of C

15:12 arrdem: gfredericks: idk man... clisp can be pretty fast if you never hit the garbage collector...

15:13 edw_: http://doc.poseur.com/xmas-eve-macros

15:13 Bronsa: arrdem: wasn't SBCL the fast one out there?

15:14 arrdem: Bronsa: yes. SBCL is the most active and fastest clisp compiler.

15:14 Bronsa: oh, you were talking about clisp the language, not the implementation

15:15 arrdem: Bronsa: yeah I have the bad habit of using clisp to refer to all ANSI CL implementations.

15:16 justin_smith: I think the common lisp concept of cons-free-programming can be done in clojure

15:16 if you opt into mutible data structures but use them in a sane feed-forward way

15:16 I mean feed forward as in "don't touch it after you pass it to the next function in the DSP pipeline"

15:17 andyf: justin_smith: I think that kind of sanity can be achieved in just about any programming language. The trick is, whether you actually do so or not :-)

15:17 arrdem: justin_smith: sure, but then you've just reinvented transients for efficiency, it's still essentially functional code.

15:18 justin_smith: andyf: difference being immutibility is a sane default, and you opt into consless mutible things in tight loops

15:18 arrdem: correct

15:18 arrdem: not quite transients, I am thinking of DSP where your buffer size is fixed, so you don't even need resizable vectors, numeric arrays of primitives will be ideal

15:21 arrdem: edw_: cool.. but you don't need that atom...

15:23 just feed forwards a [val, trace] pair...

15:24 gfredericks: edw_: oh man not the fn/fn* special case...

15:25 sometimes I wish ->/->> didn't even normalize non-lists

15:25 basically every time I try to explain what the threading macros do

15:26 arrdem: gfredericks: (-> big-map :foo :bar :baz) is a nice alternative to get-in thanks to that.

15:26 gfredericks: yeah those are the times when I don't mind

15:31 I feel like this -=> can be a two-liner and I'm thinking too hard about how to make it one

15:32 arrdem: gfredericks: mine is basically a wrapper around -> with a let to destructure a log out...

15:32 gfredericks: but I'm stuck on the initial case :P

15:33 I'd use meta, but then it wouldn't be legal to (-=> 3 inc inc)

15:33 gfredericks: oh it'd be nice if we could avoid packing and unpacking at each step

15:34 I didn't check if edw_'s code does that or not

15:34 arrdem: it does, by using a globaly scoped atom :/

15:34 gfredericks: oh right

15:34 arrdem: hence why we're rewriting it :P

15:41 gfredericks: okay let's call it a 10-liner

15:41 arrdem: haha I have 16 with two macros.. I think you're winning

15:42 * gfredericks hasn't finished yet

15:43 gfredericks: 12 lines

15:44 now let's see if it works

15:44 arrdem: I

15:44 'm off by one layer of [] per form..

15:46 https://refheap.com/22199

15:47 * gfredericks gets an error and macroexpands

15:48 arrdem: crap I fail the test case.

15:48 gfredericks: oh forgot to quote the code is all

15:49 w00h I think I got it

15:49 I opted not to wrap fn/fn* of course

15:50 https://www.refheap.com/22200

15:50 arrdem: I think the order of your cases in --=> makes the second one unreachable

15:51 ,((fn ([a b c & more] :first) ([a b c] :second)) :a :b :c)

15:51 clojurebot: :second

15:51 gfredericks: just kidding

15:51 ,((fn ([a b c & more] :first) ([a b c] :second)) :a :b :c :d)

15:51 clojurebot: :first

15:51 arrdem: the anon inline fn kills mine... trying to figure out why.

15:52 gfredericks: arrdem: well it doesn't work for normal -> so either you special-case it like edw_ or you decide not to support that like me

15:52 arrdem: gfredericks: I think I can cheat with an extra let gensym.

15:53 gfredericks: O_O

15:54 arrdem: nope just kidding. that makes no sense in the general case.

15:54 unsupport that crud..

15:54 gfredericks: arrdem: I think you're not really doing what edw_ is doing; especially in the first clause of -=>

15:55 e.g. (-=> 12 inc) should return [13 [[12 12] [inc 13]]] I think

15:55 whereas you would return [[12] 13]

15:55 arrdem: gfredericks: yeah you're right. I'm just logging intermediate values not the expressions too.

15:55 gfredericks: on top of evaling the first arg twice

15:56 arrdem: well that I can fix easily.

15:57 gfredericks: fo sho

15:58 macros are fun

15:58 stay safe kids, use a function

15:58 arrdem: pfft

15:58 compile time hackery ftw

16:00 gfredericks: you do produce the terminal expression/value pair in the log?

16:01 gfredericks: arrdem: yep

16:05 arrdem: gfredericks: herm... the tail expression is proving sticky.

16:06 gfredericks: the tail expression?

16:06 arrdem: I have (-=> (inc 61) (#(- % 1))) eval to [[[(inc 61) 62]] 61]

16:07 edw_: arrdem: It's a dynamically-scoped atom, so it'll work when nested.

16:08 arrdem: Unless Rich introduces CALL/CC, in which case I'm fucked, possibly.

16:09 arrdem: edw_: that's not something I'd worry about.

16:09 edw_: arrdem: Dare to dream. (I'm a Scheme refugee.)

16:10 arrdem: edw: is call/cc suddenly a good thing? the last several thunks of literature I read were not exaclty flattering...

16:11 edw: arrdem: Suddenly?

16:12 I don't think anyone advocates deploying CALL/CC casually.

16:13 arrdem: gfredericks: paste updated, now does logging but will totally break if nested.

16:15 gfredericks: arrdem: nesting is problematic anyways since you have to pull out the ... oh I dunno

16:16 arrdem: bah I break on the empty tail case...

17:23 AimHere: Hmmm, is read-string safe to do on a string where you know the first-character is ':'?

17:24 Is there any danger of that being not-a-keyword?

17:28 justin_smith: if you are using at least clojure 1.5 and you use clojure.edn/read-string that should be fine

17:28 but you could also call keyword on a string

17:29 ,(keyword (subs ":hello" 1))

17:29 clojurebot: :hello

17:29 AimHere: Yeah, I did think of that, just wanted the code slightly neater

17:33 technomancy: use c.c/name instead of subs

18:08 alew: it's not possible to kill one cider/nrepl session at a time is it? you have to kill all of them?

18:26 gdev: alew, how are you trying to kill the sessions?

18:27 alew: the only command I know of is cider-quit

18:27 or cider-restart

18:35 bitemyapp: edw: call/cc is not a good idea.

18:37 arrdem: call/cc is still a bad idea.

18:39 arrdem: holy shit bitemyapp just agreed with me. christmass came early :P

18:40 bitemyapp: so I realized that all my data modeling in Clojure is typeclass based. :P

18:40 * bitemyapp taps chin and nods

18:40 andyf: Bronsa: ping

18:41 Bronsa: andyf: pong

18:43 andyf: Bronsa: Perhaps new type of exception from tools.analyzer(.jvm): If you have a few mins, try out latest Eastwood + libs on Raynes/fs: https://github.com/Raynes/fs He has a perhaps unusual macro that causes exception that I haven't gotten to the bottom of yet.

18:43 I can file a ticket to track it if you like.

18:43 Raynes: lol

18:44 Interesting.

18:44 andyf: Raynes: This is very likely nothing bad about your code, but about tools.analyzer(.jvm)'s newness.

18:44 Bronsa: andyf: taking a look now

18:44 Raynes: I didn't write any of those macros anyways :p

18:45 I'm interested in what the issue is when someone finds out, though.

18:45 andyf: I've been throwing lots of open source projects at pre-release Eastwood lint tool, in hopes of shaking out the kinds of problems that people would file after the release announcement :-)

18:46 bitemyapp: andyf: a script that automatically downloads a list of projects and runs eastwood against them sounds useful.

18:46 andyf: bitemyapp: Got one :-)

18:46 Bronsa: mmh

18:46 https://github.com/Raynes/fs/blob/master/src/me/raynes/fs.clj#L156 might be the issue

18:47 andyf: bitemyapp: I have been gradually adding projects to the list as things get more stable.

18:47 bitemyapp: andyf: very cool. Automation is sanity :)

18:47 Bronsa: Raynes: andyf: yep, that's it

18:48 anagrius: You think it would it be worth it to make a port of swank-cdt for cider? Or is swank-cdt working fine for everyone?

18:48 Bronsa: Raynes: s/./../

18:48 andyf: Bronsa: I don't understand the issue yet. It needs type hint on this?

18:48 Oh, syntax error?

18:48 Bronsa: andyf: no, it needs to be (.. this (toFile) (toUrl))

18:49 andyf: Any guesses why Clojure doesn't mind that expression?

18:50 Bronsa: I'd guess because clojure simply ignores (toUrl)

18:50 andyf: Bronsa: I'll experiment

18:51 Bronsa: andyf: lints fine now but.. it seems like it hangs when linting the tests

18:51 andyf: I think that is a different namespace. I can look into that more. Most common cause I've seen so far is tests open a connection to a host that cannot be reached.

18:52 Bronsa: btw yeah https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L950

18:52 if the third argument to a . form is a list, Compiler.java will ignore everything else

18:52 andyf: Cool. Thanks for tracking it down so quickly.

18:53 Sounds like a good thing to check for in a linter some time

18:54 Well, I guess since tools.analyzer throws an exception on it, perhaps better said is: another opportunity for Eastwood to print a message a developer can understand when this happens.

18:55 Bronsa: andyf: I'll make tools.analyzer throw a nicer error for that

18:56 andyf: Bronsa: Great. If it can have ex-data with the ast of the whole . expression containing the problem, that would be useful.

19:01 cYmen: After adding a dependency to my projec.clj what do I have to do to make my repl aware of it?

19:02 rovar: did something change in clojuremode recently to convert lambda and fn to the lambda character and pretty f?

19:02 Bronsa: andyf: https://github.com/clojure/tools.analyzer/commit/5c31e2058369c230b493e671caa48be741919b71#diff-ca9fdc7850490879310292f81bfbb68fR608

19:02 rovar: I've seen discussion on the mailing list about it, but it was never enabled, it seems, until today..

19:03 cYmen: rovar: hm..my emacs has been doing that for a while

19:03 Bronsa: andyf: I cannot give you the AST in the ex-data because there's not one yet at that point :)

19:04 rovar: cYmen: it only seems to do it when I load files.. I'd prefer it didn't

19:08 Bronsa: Raynes: https://github.com/Raynes/fs/pull/66 \cc andyf

19:09 Raynes: Ugh.

19:09 Bronsa: I swear, either someone isn't adding tests, someone isn't running tests, or I don't understand tests.

19:09 Bronsa: Raynes: it's ok, I suck at tests too.

19:21 arrdem: that makes three of us...

19:22 edw: arrdem: https://github.com/edw/tinsel/blob/master/src/tinsel/core.clj

19:23 No atom.

19:23 Mucho beautiful.

19:23 arrdem: very immutable

19:23 so linted

19:23 wow

19:23 Bronsa: lol

19:24 * arrdem goes back to mining dogecoins

19:24 arrdem: edw: nice! do like!

19:24 (inc edw) ;; have some internet points

19:24 lazybot: ⇒ 1

19:25 arrdem: we need a library with bits like this that's actively maintained...

19:29 edw: note, you have a typo in the readme.md

19:29 edw: the require specifier is missing a ]

19:31 sherbondy: hiya folks, could someone explain to me why the syntax for field access of data-types is inconsistent across clj and cljs?

19:31 edw: D'oh. Fixed.

19:31 Thanks.

19:31 sherbondy: in clj, both (.field type-inst) and (.-field type-inst) are supported, but in cljs, only (.-field type-inst) is

19:32 edw: arrdem: I didn't see your second message; I figured you were torturing me, knowing what a stickler for typos I am.

19:32 arrdem: edw: haha. no problem. cool project idea btw! much less evil than my old pr-let macro :P

19:33 edw: pr-let?! Sadly, I have dont things like that: pr-identity,specifically.

19:34 arrdem: I got to thinking about this in the context of Lighttable, and wanting to use Clojure to manage my checking account.

19:34 arrdem: pr-identity should be clojure.core/...

19:34 pr-let was just a bad idea hack.

19:35 edw: I had like a forty-line long set of let bindings and I was *NOT* going to break that fucker up just to print one of those intermediate values!

19:35 * arrdem digs for pr-let

19:36 edw: What _was_ the horrible, horrible piece of code I wrote for? No matter...

19:39 arrdem: What you _really_ need is NAMED-PR-LET, because--obviously!--you're going to sprinkle it all over your code, and how will you tell what's what?

19:42 arrdem: edw: that can be done too...

19:44 edw: To go to BK or not to go to BK... I mean, I took a shower and everything!

19:44 arrdem: edw: https://refheap.com/22205

19:45 edw: one more for the macroheap

19:45 sadly we don't have a *fn* variable...

19:48 edw: High on my list of lein plugins I'd like to write is something to implement paste-dependencies e.g. refheap, gists. Many of my projects are just dinky little < 100 line collections of code I use all the time.

19:50 arrdem: eeh... for all that it'd be nice to have paste dependencies, or to have a fast evolving macro dumping ground it kinda makes using such things difficult.

19:51 but I agree, for a lot of things the full blown maven versioning is kina overkill.

19:51 edw: There is the guy who did the GitHub deps plugin. I forget what the big project he is/was involved with. It's been a while.

19:52 arrdem: if you find it, please link it here. I'm intrigued.

19:52 but I doubt that it's the right "light weight" solution.

19:53 edw: Oh, he was Mr Clojurescript One.

19:54 https://github.com/tobyhede/lein-git-deps

19:54 https://github.com/brentonashworth/one

19:56 arrdem: idk...

19:56 technomancy: I assume we'll never see a "git dependency" structure in main :deps

19:58 edw: cool. I may have to use that. not sure that it's a general replacement for Maven/clojars but for some really small things it may be appropriate.

20:00 edw: Yeah. I was looking into it when I was trying to solve our internal Clojure code reuse (and deployment to Heroku) problem. Deploying from private repos (of any kind) to Heroku is kinda a PITA.

20:00 dsrx: arrdem: there is a lein plugin for that

20:01 edw: OK, I'm off to go to Otto's Shrunken Head to get some Xmas Eve fun in.

20:01 dsrx: lein-git-deps I think?

20:01 edw: dsrx: Yes, we we're actually just discussing it.

20:01 arrdem: I mean my thing with targeting git as a dependency is that religious use of lein ancient would be better

20:01 dsrx: oh...

20:01 * dsrx should read scrollback

20:01 edw: Tootles!

20:01 arrdem: edw: merry christmass!

20:03 edw: Thank you. I'll have a tiki punch for you.

20:22 bitemyapp: edw: you know there was already a Clojure library with the name tinsel right?

20:23 edw: also: I like your library.

20:28 arrdem: bitemyapp: do you have a solution to the "rappidly evolving snippets bucket" problem?

20:28 bitemyapp: arrdem: code snippets?

20:28 * logic_prog shakes fists at Amazon Prime not doing 2-day delivery

20:30 bitemyapp: logic_prog: it's Christmas :P

20:30 arrdem: bitemyapp: basically if edw were to throw a bunch of other stuff in tinsle depending on or using it direclty becomes a source of overhead

20:30 bitemyapp: but at the same time, packaging a bunch of snippets into one place is a good thing

20:30 because otherwise you'll just end up `cp`ing a bunch of snippet files around between projects

20:31 which is not managable or repeatable at all.

20:31 bitemyapp: arrdem: flatland/useful set a precedent.

20:31 I'd advise breaking off pieces more often than they did though.

20:56 shep-home: Hmm, I'm getting a stacktrace from clojure.test: https://gist.github.com/shepmaster/8119538

20:56 And seemingly, it only touches my file in the ns declaration

20:57 at Java.lang.ArrayIndexOutOfBoundsException: null

20:57 I am running my tests from within emacs / cider

21:00 Hmm, it seems like it might occur the second time i run my tests...

21:00 closing the repl and starting a new one works once

21:00 ivan: can you paste the code?

21:10 Bronsa: andyf: I looked into using the ::source info to rewrite e.g defonce-or-defmulti-macro-expansion?

21:11 andyf: problem is, suppose you have (defmacro x [] (defonce foo 1)), the macroexpanded form of (x) will have '(x) as ::source, so it will not know about the defonce

21:12 andyf: Bronsa: Thanks for looking into it.

21:13 Bronsa: andyf: looks like trying to match the expanded code is the only way to cover all the cases sadly

21:13 andyf: Bronsa: I would be more disappointed with that news if I hadn't already implemented it :-)

21:14 As it is, you are giving me more reasons to leave it as it is.

21:15 shep-home: ivan: I'll have to try to reduce it first, which might help anyway. I guess it isn't a known/obvious issue then

21:23 sherbondy: I have a question about deftype and extend type

21:24 say I make a datatype with deftype, like, (deftype point [x y z])

21:24 and then I call (extend-type point ...)

21:24 will I have access to x y and z?

21:36 bitemyapp: Raynes: Vault is fucking terrifying.

21:36 Raynes: ?

21:37 bitemyapp: Raynes: http://hackage.haskell.org/package/vault-0.1.0.0/docs/Data-Vault.html#t:Vault from http://hackage.haskell.org/package/wai-1.2.0.1/docs/Network-Wai.html#t:Request - The authors of WAI were apparently concerned about performance *_*

21:38 Raynes: bitemyapp: What.

21:39 how what is this does even

21:39 bitemyapp: Raynes: you know how in Ring we just kick request maps around?

21:39 gdev: alew, okay I figured it out, if you do C-k and select the buffer you want to kill, it should let you do what I think it is you were trying to do

21:39 bitemyapp: and if you want to chain state, you just assoc?

21:40 Raynes: they made request a record, then stashed "extra" key value pairs in a vault field.

21:40 for speeeeeeed

21:40 Raynes: lolol

21:40 justin_smith: gdev: I think it is cleaner to just run (System/exit 0) in the repl you want to shut down

21:41 gdev: alew, scratch that, I've just been informed that you can do (System/exit 0) in the repl you want to shut down

21:42 bitemyapp: Raynes: Vault is basically ST for keys of * -> *. fucking nuts.

21:53 alew: ah ok

22:15 andyf: Bronsa: 'hanging' while linting other namespaces of 'fs' project was due to a future call, and Eastwood not doing (shutdown-agents). It does now.

22:15 Bronsa: andyf: oh, ok

22:16 andyf: Bronsa: I am just glad I already knew about the 1-minute hang at the end and its cause, or it would have driven me nuts.

22:16 Bronsa: andyf: btw I'm toying a bit with using datomic to query the ast, here's what I got for checking if an ast represents a defonce: http://sprunge.us/FfUb?clj

22:18 andyf: Bronsa: I do not grok datomic queries yet, which I guess are just datalog, but is line 6 unnecessary?

22:18 Bronsa: andyf: no, just a junk leftover

22:20 andyf: Bronsa: Is the main motivation for having the ast in datomic so that one can write queries in this form? Or is there another reason?

22:23 Bronsa: andyf: it seemed something nice to experiment after seeing jonase's work so I did https://github.com/Bronsa/tools.analyzer.jvm.index

22:23 andyf: yeah, querying the AST is my main & only motivation ATM

22:24 andyf: Bronsa: I can see why that would be an attraction, and cool that you guys are implementing it. I may not get into it for a bit longer myself, just from trying to get a few more things tidied up elsewhere in Eastwood first.

22:25 Yesterday was my "flurry of filing patches motivated by things Eastwood found" day. Sounds like we already have a fan or two.

22:26 Bronsa: andyf: it's definitely not a priority for me either, but it looks fun enough to give it a try sometime in the future

22:26 andyf: yeah -- https://twitter.com/michaelklishin/status/415407087393730560

22:34 TEttinger: so my quick search turned up nothing, but is there a library out there for seeded random number generation in clojure? I use rand-nth a fair bit now, but I would like to be able to make that have reproducible results given a certain seed

22:35 ... going to check ztellman's github...

22:38 andyf: TEttinger: Don't the underlying Java methods have ways of initializing the seed?

22:39 TEttinger: andyf, maybe, but I don't know what java.util.Random object they are using

22:39 I found https://github.com/kephale/clj-random/blob/master/src/clj_random/core.clj

22:40 kephale: yeah!

22:43 TEttinger: heh hi kephale

22:43 kephale: if there is a lot of complaint about the naming i'd be happy to add some aliases to the standard randX function names

22:43 howdy

22:43 TEttinger: no, that makes total sense

22:43 think I found an error

22:43 kephale: aiee

22:44 TEttinger: https://github.com/kephale/clj-random/blob/master/src/clj_random/core.clj#L105

22:44 not a logic error

22:44 kephale: ah in the comment, gotcha, thanks

22:44 TEttinger: just... the rand-nth function would only behave correctly if the range is [0,n)

22:44 if n is inclusive, lrand-nth wouldn't work

22:45 I'd also check lrand , see if it's correct

22:47 egosum: merry almost christmas :) i was wondering if there were a std lib fn equiv to #(%1 %2)?

22:47 andyf: egosum: apply?

22:47 kephale: lrand seems to be ok…

22:48 andyf: egosum: That is not quite what you are asking for, though, since apply treats its last arg as a sequence of args, not a single arg.

22:48 TEttinger: kephale, just wasn't sure if it was supposed to have 1 inclusive

22:48 egosum: andyf: exactly

22:48 kephale: ahhh yes gotcha

22:48 TEttinger: i'll double check the inclusivity

22:49 TEttinger: kephale, this looks very useful, surprised this didn't exist before you made it

22:49 egosum: i just prefer to avoid the whole #(%1 %2) for totally aesthetic reasons…i don't like reading J/APL hah

22:49 kephale: i know! i was shocked too

22:50 egosum: i just made it instead… (defn call [f & args] (apply f args))

22:53 TEttinger: egosum, there's the literal translation of (fn [f x] (f x))

22:54 egosum: TEttinger: right, that's essentially what I'm doing with `call`, just making sure i hadn't missed a std lib fn/lazy-webbing. Thanks :)

22:55 TEttinger: wondering if there's a way to do it with partial

22:56 egosum: partial generally doesn't play nice with multiple arity

22:59 logic_prog: Is there a way to use crossovers where a given piece of code (1) uses clojure.core.async in clj land and (2) cljs.core.async in cljs land?

23:04 ddellacosta: logic_prog: probably cljx is going to be your friend here--as far as I know that's the one thing crossovers *doesn't* do well. Although, I suppose you could do it with a macro, somehow...

23:04 logic_prog: or more accurately, that is exactly cljx's use-case

23:04 logic_prog: damn

23:04 I just got comfortable with crossovers

23:05 ddellacosta: logic_prog: well, I'm sure that's not wasted time. :-)

23:05 edw: Speakers or automobiless?

23:05 s/automobiless/automobiles/

23:06 andyf: Bronsa: Here is another one that might be new to you, and perhaps not reasonable to try to make tools.analyzer(.jvm) handle. simple-check has a namespace simple-check.clojure-test defining a macro defspec, and inside that macro's expansion it does a (require 'simple-check.core), with a comment about shame in introducing a cyclical dependency.

23:06 logic_prog: haha

23:06 this is rsorta badass

23:07 it's basically jsut #+clj and #+cljs

23:07 reminds me of C macros, _if_def_ hell

23:07 ddellacosta: logic_prog: yeah, I mean, *maybe* there is a way to do it w/crossovers, but I gotta say, cljx makes it really easy.

23:07 logic_prog: so you're probably best off just using that.

23:08 edw: logic_prog: I thought you were making your own speakers or something.

23:08 Bronsa: andyf: I'll look into that maybe tomorrow, it's 5am here now and I'm going to sleep :)

23:08 logic_prog: well, they say an expert if someone who has made all the newb mistakes

23:08 andyf: no rush

23:08 ddellacosta: edw: https://github.com/emezeske/lein-cljsbuild/blob/master/doc/CROSSOVERS.md

23:08 logic_prog: I'm soon to be a cljs/clj code sharing expert

23:08 ddellacosta: logic_prog: :-)

23:08 logic_prog: edw: lol, I was wondering if you were posting in the wrong channel

23:08 sherbondy: speaking of cljx, has anyone tried writing custom rules?

23:09 the readme is a little cryptic on that, but I'm guessing it's just kibit rules?

23:09 logic_prog: cljx should just use clojure macros

23:09 for specifying clj / cljs code

23:09 Bronsa: andyf: mind to open a JIRA ticket so I don't forget?

23:09 logic_prog: basically, if you should be able to define e macro, and depending on :clj or :cljs, it does different things

23:09 ddellacosta: sherbondy: I haven't, but definitely curious about it.

23:09 sherbondy: oh, nit's no longer based on kibit, never mind

23:10 https://github.com/lynaghk/cljx/blob/master/src/cljx/rules.clj

23:10 so the bottom of that file sheds some light on the expected format of the transformations

23:11 ddellacosta: logic_prog: not sure what you're arguing for--doesn't cljx already basically work that way? I think I'm not understanding your point.

23:11 logic_prog: ddellacosta: in you opinion, is htere ever a reason to use crossover + cljx together? as I go through the cljx setup, it seems to be a strict superset of what crossover does. in particular, cljx without #+cljs #+cljx = what crossover does

23:11 sherbondy: yep, you shouldn't need both

23:11 ddellacosta: logic_prog: yeah, I would imagine so. The one project I used cljx in I didn't use crossovers.

23:12 logic_prog: hmm, learning about cljx makes my christmas eve sorta happy :-)

23:12 edw: ddellacosta: Ah!

23:12 sherbondy: hey, you folks want to see a neato project that uses cljx?

23:12 It's still very much a wip, but it finally runs in the browser and the jvm!

23:13 https://github.com/sherbondy/rt

23:13 a ray tracer!

23:13 lein cljsbuild once, then open index.html and wait a few seconds, and a tiny raytraced scene will appear

23:13 likewise, lein run, and a .ppm file of the same scene will appear in the directory!

23:14 edw: I'd forgotten about that. Clojure-in-Scheme got me thinking about writing an EDN reader for a Scheme so I could then create a Scheme dialect using sets, hashes, and vectors as part of the syntax.

23:14 sherbondy: the algorithm is very naive, and I'm using clojure seqs all over the place instead of native arrays, but it's a raytracer, dammit!

23:14 logic_prog: sherbondy: does it run on asm.js yet :-)

23:14 sherbondy: oh, and it uses core typed!

23:14 ha, no

23:15 logic_prog: fuck ... with cljx, why do I have separate clj and cljs src directories ?

23:15 edw: bitemyapp: Thank you. Thank arrdem for shaming me into making a beautiful version.

23:15 logic_prog: why not one gigantic code base?

23:15 sherbondy: for platform-specific libraries

23:16 andyf: Bronsa: will do

23:16 sherbondy: no point wrapping a ton of functions in #+clj, might as well be a separate library

23:16 *namespace

23:19 ddellacosta: sherbondy: that's really cool. :-)

23:19 logic_prog: yeah, I think it depends on what the volume of your platform specific code ends up being

23:20 logic_prog: if it's minimal, you can get away with including it all in the same cljx files. Otherwise separate dirs/libs makes sense I think.

23:22 sherbondy: I look forward to reading through your ray tracer when I've got some time...nice little project. I haven't done much core.typed either. Neato.

23:30 TEttinger: sherbondy, haha neat. ppm is one of those internally-it's-text image formats, right?

23:31 sherbondy: yep, that's right

23:32 just a string of 0-255 r g b values

23:32 delimited by spaces

23:32 TEttinger: oh I was thinking of xpm I think

23:33 https://dl.dropboxusercontent.com/u/11914692/dungeontiles.xpm I think this is valid C source?

23:57 logic_prog: I am having a dumbass cljx problem:

23:58 "lein cljsbuild auto" does not seem to pick up on "touch shared/data.cljx"

23:58 basically, when I edit my *.cljx files, lein cljsbuild auto does not fire off

23:58 yet, shared/data.cljx is being used

23:58 I know this becuase "lein cljsbuid auto" compiles it the first time around (giving a warning)

Logging service provided by n01se.net