#clojure log - Aug 08 2012

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

0:34 jamii: https://gist.github.com/57121318932f61a10b2b <- trying to explain these causal ordering clearly, would be very much obliged if anyone could try reading it

0:42 amalloy: well, i want to set the emoticons on fire and i don't care for the use of code blocks to delimit things which are not code. but the article is thought-provoking. is it really true that on a single machine causal ordering is exactly the same as time ordering? it seems like all kinds of asynchrony/concurrency problems still exist

0:44 and we hand-wave them away by making the cpu and/or memory synchronize (ie, wait) every so often. which would have the same CAP problems if, say, one cpu caught fire and the others were fine

0:45 jamii: ^

0:47 jamii: amalloy: yes, I suppose rather than machines it would be more correct to talk about synchronous threads of execution

0:47 I didn't want to complicate it too much though

0:48 The code blocks are a translation artefact. In the original formatting they're nice little bold boxes

0:50 akhudek: clojurescript optimizations past whitespace don't work with goog.base :-(

0:50 jamii: amalloy: I think I'll mention your point as an aside near the bit about memory barriers

0:50 akhudek: seems the closure compiler literally looks for 'this' as the first argument

0:51 amalloy: i don't see anything about memory barriers?

0:52 jamii: 'Even your hardware cannot escape this law' links to the wikipedia article on memory barriers

0:57 akhudek: I guess js* is the only way to insert a literal "this", right?

0:57 And that is supposed to be a compiler detail?

0:57 jamii: amalloy: thanks. later :)

1:20 muhoo: heh, this made me think of feynman diagrams for some reason: https://gist.github.com/57121318932f61a10b2

2:42 antifuchs: so, which non-slime way of using clojure comfortably with emacs is there? (Or is there a swank-clojure that can cope with the quicklisp slime release cycle?)

2:42 I apparently can't not use quicklisp slime; alllll my emacsing depends on slime-selector.

2:46 or should I just admit defeat and use eclipse + counterclockwise?

2:47 feels just wrong to me not writing lisp in emacs ):

2:50 hoeck1: antifuchs: have you tried nrepl.el (https://github.com/kingtim/nrepl.el)?

2:50 antifuchs: ah, that was it.

2:51 ooh, it does go-to-definition. nice nice

2:51 hoeck1: I tried it when it was a couple of weeks old and it somehow worked for me, I'm mostly using C-xC-e and C-M-x

2:51 antifuchs: yeah, I feel like I'm flying blind without M-. / M-,

2:52 hoeck1: antifuchs: does that work when you edit files without reloading them?

2:53 antifuchs: I don't know! let's find out (:

2:53 hoeck1: I'm using this alot in indexed python and C code (by using etags)

2:54 antifuchs: ah, heh. M-. seems to consult the running clojure image for definition locations

2:54 which is the way it should be[™] (-:

2:55 oh my, this is working mostly. nice.

2:55 hoeck1: right, but if you C-x C-e a clojure expression in a file, and then change its definition or remove it or change its position in the file, the clojure metadata still contains the its old position

2:55 antifuchs: I know I'm going to miss the slime debugger, but hey, at least I don't have to switch to the terminal and back all the time

2:56 oh, is that so? ):

2:56 why is that?

2:57 hoeck1: when you load a file, clojure adds file and line debug information to the bytecode, and stores :line and :file in the metadata, find-definition then uses that data to open said file and jump to line

2:58 but if you have changed after you loaded it ... :/

2:58 antifuchs: ughhh

2:58 well, that's not a thing ):

2:58 hoeck1: though, it works when you do (require ... :reload)

2:58 antifuchs: so backtraces will be wrong if I make substantial changes to any file?

2:58 ah, hm.

2:59 so, C-c C-k on the file will fix this?

2:59 hoeck1: yes

2:59 antifuchs: ah, that's ok then. thanks (:

3:00 hoeck1: or a more sophisticated find-definition

3:01 antifuchs: that would probably work, too ((:

3:02 well, the thing I'd really like is a swank-clojure that can cope with a recent slime. but it seems I'm not going to get that, except by taking over either slime development, swank-clojure development, or both

3:02 or maintaining a fork of either, which will be despised by both projects. not what I'd like to spend time on (:

3:08 amalloy: antifuchs: nobody will mind if you take over swank-clojure

3:08 antifuchs: hah

3:08 I wish I had the time ):

3:08 amalloy: nrepl.el is the future, but if you're dedicated to slime technomancy will let you take it off his hands with a sigh of relief; he recently gave it the official Deprecated rubber-stamp, i think

3:09 antifuchs: this work related project is already happening in my spare time; if I have to take over another project to get actual work done… /-:

3:09 ah well, ok then

3:09 xeqi: his next blog post will stamp it

3:09 antifuchs: I'm just very very sad that this is the state of things

3:09 amalloy: blame slime

3:09 antifuchs: oh, I am

3:09 amalloy: haha k

3:09 antifuchs: I've been blaming it for the last 5 years (;

3:10 well, maybe not that long

3:11 amalloy: i read something recently arguing that ;) is a decent winky face, but (; looks more like you've had a stroke

3:11 antifuchs: haha

3:12 amalloy: down with backwards smilies!

3:12 antifuchs: I shall subscript future parens & colons

3:13 amalloy: hah, i had to squint at that for a while before i got it

4:16 muhoo: there has to be a cleaner way to do this https://www.refheap.com/paste/4168

4:19 mduerksen: muhoo: have a look at select-keys

4:47 muhoo: nice, (set! clojure.core/*print-level* 15) works perfectly in nrepl

5:30 TEttinger: what can I do about the long startup time I sometimes get with lein repl? I am using seesaw, which depends on stuartsierra's repo and one of his libs as a dev-dependency, and it just takes a long time to figure out, no, clojure is not supplied by that repo...

5:32 it isn't exactly an error log, but this takes between 30 seconds and a minute to output, I think http://pastebin.com/pzVAAtYG

5:37 ok, that time it only took 15 seconds, but occasionally it hangs and I need to Ctrl-D to stop it

5:55 kral: hola

6:04 antares_: TEttinger: long story short, tools/libraries leiningen uses under the hood iterate over repositories in a very simplistic manner. Why that repository takes so long to respond, I don't know.

6:04 otfrom: morning

6:04 antares_: TEttinger: there is an issue for that in the leiningen tracker but chances are, there is no solution in sight even for leiningen 2

6:04 ejackson: morning

6:10 TEttinger: antares_, can I tell it to avoid auto-refreshing that repo?

6:10 antares_: TEttinger: you can probably set :update to :never, not sure if :never is supported

6:12 TEttinger: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L143-154

6:18 TEttinger: :update :daily doesn't seem to do anything

6:18 even globally in my project.clj

6:21 antares_: TEttinger: it may be applicable only to snapshot repositories, I'd need to check maven documentation for that

6:22 TEttinger: bug the person who maintains the slow repository, ask him to make releases to clojars

6:22 TEttinger: not sure which repo it is

6:22 the one it can't find is clojure

6:22 antares_: TEttinger: clojure is an artifact, not the repo

6:23 TEttinger: Could not find artifact org.clojure:clojure:pom:1.+ in ...

6:23 antares_: TEttinger: can you gist the output?

6:23 TEttinger: http://pastebin.com/pzVAAtYG

6:23 antares_: TEttinger: it will iterate over all repositories until the artifact is found

6:23 but if one repo is being slow, it should not be hard to notice

6:24 TEttinger: what does your project.clj look like?

6:24 TEttinger: http://pastebin.com/vywaSSda

6:24 antares_: org.clojure:clojure:pom:1.+ is a little unusual

6:24 TEttinger: it could be lein-eclipse

6:25 https://github.com/abrenk/lein-eclipse/blob/master/project.clj

6:26 antares_: TEttinger: no, what is in *your* project.clj?

6:27 TEttinger: http://pastebin.com/vywaSSda is my project.clj

6:27 antares_: lein-eclipse depends on a specific version until it is explicitly given, that's not a version range

6:27 clgv: TEttinger: you dont need lein-eclipse anyway. just use CCW with it's leiningen integration

6:27 TEttinger: CCW has lein integration now?

6:27 clgv: yes

6:28 it is shipped since 0.9.0

6:28 antares_: TEttinger: ok, you don't use version ranges either, that's good

6:31 TEttinger: it appears I am up-to-date

6:32 what do I need to do to change a clojure project to a leiningen project?

6:32 in CCW clgv

6:35 clgv: TEttinger: just right-click the project and choose "convert to leiningen project"

6:35 TEttinger: I will try that

6:36 clgv: TEttinger: to be precise: "configure" -> "convert to leiningen project"

7:10 leafw: is it just me, or clojure's stack traces when using monads are not useful at all?

7:11 the last line referenced is the domonad so-and-so line

7:11 that with clj 1.4.0

8:27 TEttinger: ugh, this is a weird error... http://pastebin.com/smYDasn9 is the relevant portion of my code, http://pastebin.com/dzfiYXBx is the error log I get

8:28 it seems like a seesaw GUI function is getting called before the needed components exist -- but the function should only be called when there is user input

8:32 edoloughlin: Is contrib/server-socket dead?

8:34 ohpauleez: edoloughlin: I don't think it's part of the new contrib: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

8:35 cmiles74: That's right, it's not in the new contrib libs.

8:35 ckirkendall: ro_st: you there

8:37 cmiles74: edoloughlin: technomancy has a fork with just that code in it; https://clojars.org/server-socket

8:37 ro_st: ckirkendall: i am, i pm'd you

8:38 edoloughlin: cmiles74: Thanks.

8:39 TEttinger: ok, I can't stay up any longer (5:37 AM here). I guess I will ask again tomorrow

8:39 edoloughlin: Is there a canonical way to implement a multithreaded server (for an audio chat app, multiple rooms, each with multiple clients connected)? The answer to this seems promising: http://stackoverflow.com/questions/9575483 - any thoughts?

8:40 ro_st: isn't that what aleph is about?

8:40 https://github.com/ztellman/aleph/

8:41 edoloughlin: ro_st: On an initial look, it seemed too asynchronous (i.e., message-passing) and more suited to HTTP. Is is performant enough to shlep audio frames around?

8:42 ro_st: i've no idea. i'm merely parroting :-)

8:42 ohpauleez: edlothiol: aleph, java interop with socket server, or another Java lib that fits the bill for your app would work.

8:42 it really depends on the design constraints

8:43 edoloughlin: Ok. I'll give it another look. Just don't want to commit to something that won't work out...

8:43 ohpauleez: edoloughlin: Then I'd look to see if there's a well supported and documented Java library that fits your use case

8:44 and spend the effort wrapping interop (where needed) than building from the ground up

8:45 edoloughlin: Seems sensible. The answer to http://stackoverflow.com/questions/9575483 seems nice and Cloure-y though...

8:45 ohpauleez: I'd also build a prototype with aleph - the latest changes have made it very very fast

8:45 edoloughlin: ohpauleez: I'm sold. I'll give it a look.

8:45 Thanks.

8:47 jsabeaudry: ohpauleez, Oh that is very good news, last time I tried it (approx 5 months ago) it was awfully slow because of a bug in Netty, I'll give it a spin again when I get a chance

8:47 ohpauleez: edoloughlin: That's a bad answer in my opinion - it's showing a misunderstanding of the guarantees of agents. An atom would be better with processing done with futures on tuned thread pool

8:49 edoloughlin: I see. My experience of agents is limited to reading the docs!

8:49 ohpauleez: gotcha, yeah - look through some Java libs/packages and take a look at aleph

9:09 alcy: folks, am trying to use riemann, a monitoring tool written in clojure. am trying to debug it, but not sure whats the correct way. http://aphyr.github.com/riemann/api/riemann.logging.html

9:10 ^ describes the logging api

9:10 this is how i've described them in its config

9:10 (logging/init :file "riemann.log")

9:10 (logging/set-level "riemann.client" Level/DEBUG)

9:11 but I get this java.lang.RuntimeException: No such namespace: Level, compiling:(null:4)

9:12 any suggestions what could be wrong ?

9:17 hoeck1: alcy: you need to import the Level class

9:18 alcy: which is probably one from log4j: http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html

9:18 alcy: hoeck1: that particular tool does import the class https://github.com/aphyr/riemann/blob/master/src/riemann/logging.clj

9:20 hoeck1: alcy: maybe importing the class in the config file works, using: (import '(org.apache.log4j Level))

9:22 alcy: or using its full name, in case the config is evaluated with the class loaded already: (logging/set-level "riemann.client" org.apache.log4j.Level/DEBUG)

9:25 alcy: hoeck1: thanks, that kinda seems to work, no errors - although I dont actually get any debug msgs :(

9:26 hoeck1: do you know if its possible to set the root logger to debug ?

9:32 drostie: ';'L;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............................................................;......................////L;;;;;;;;;;;;;..................;;;;;;;;;;;.....................;;;;;;;;;;;;;;;.........................

9:32 PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPIIILLL

9:33 AWizzArd: Excellent, very good.

9:35 drostie: er, sorry.

9:35 ro_st: i see your cat found the keyboard

9:41 michaelr525: hello

9:41 drewr: oh herro michaelr525

9:42 michaelr525: anyone knows what's the part after the + is called in this timestamp: "2012-08-05T13:41:08+0000"

9:42 htr: michaelr525: tz offset ?

9:43 michaelr525: htr: probably you are right..

9:43 why 4 digits?

9:43 hoeck1: alcy: no, never used log4j for myself, from looking at the api, you can get the root logger with (org.apache.log4j/getRootLogger)

9:43 michaelr525: do you know which format should I use to parse it with clj-time?

9:43 htr: michaelr525: HHMM iirc

9:44 michaelr525: I've no idea

9:44 hoeck1: alcy: maybe that works, there is also Level/ALL

9:44 michaelr525: hhh

9:45 alcy: tarting to (again) play with riemann !

9:46 oops. bad paste

9:46 hoeck1: thanks, will give that a try

9:47 bhenry: sqlkorma users… am i using the order function correctly for multiple order by's? this doesn't make sense to me. https://gist.github.com/44e29ca0118cc3910b08

9:54 ping ibdknox

9:54 ro_st: what about multiple (order) clauses?

9:55 bhenry: yeah. i just tried a sql-only on it and it only puts in one.

9:55 i'll try the multiple and see what happens.

9:56 wmealing: would someone be kind enough to tell me exactly what kind of an error this is ? http://hastebin.com/

9:56 bhenry: ro_st: looks like that should do it. thanks.

9:56 wmealing: i dont know java, but.. i'm not using that class and nor is it referenced anywhere i can see in my files

9:57 ro_st: wmealing: i think you pasted the wrong url

9:57 ludston: wmealing: Could you give us a real link?

9:57 wmealing: ah damnit, sorry

9:57 http://hastebin.com/sijisagovo.coffee

9:59 ludston: It looks like the library you're using has some java dependency that you haven't got anywhere

9:59 wmealing: zug ok

10:00 this is fedora, and openjdk-1.7.0.3

10:00 probably some internal, unimplemented class

10:01 ludston: http://www.jarfinder.com/index.php/java/info/com.sun.tools.xjc.Options

10:02 wmealing: i'm not sure if its "legal" to just download those jars and chuck them in my runtime, is it ?

10:02 ludston: Looks like it's from an oracle XML library. If you google "jaxb" you ought to find a more legit looking/licenced download

10:03 wmealing: ok

10:18 rplevy: trying to figure out a good way to accomplish the inverse of a line-seq, i.e. a Java stream interface surrounding a lazily evaluating seq.

10:29 llasram: rplevy: `proxy` the appropriate class, use an atom to hold the seq evaluation state ?

10:39 xeqi: wmealing: it looks like the knowledge api has a bunch of dependencies listed as "provided" - http://search.maven.org/remotecontent?filepath=org/drools/knowledge-api/5.4.0.Final/knowledge-api-5.4.0.Final.pom

10:39 so you've got to track them down yourself

10:40 http://search.maven.org/#search|gav|1|g%3A%22com.sun.xml.bind%22%20AND%20a%3A%22jaxb-xjc%22 might be the one currently giving problems

10:41 rplevy: llasram: interesting idea, thanks

11:35 jst23: are there any particularly obvious things to refactor in this: https://gist.github.com/3295977

11:36 in particular, is there a better name for what i'm doing with make-coll (that has to be somewhat common, right?)? Also, I guess I could come up with some ways to remove the repetive doseqs, but not any ways that really add any clarity

11:40 djcoin: jst23: i'm a complete noob at clojure (for now ! :)). Just for curiosity, what are you coding ? A drag&drop in clojure script ?

11:40 jst23: djcoin: yup exactly. just a small layer on top of the google closure DragDrop stuff

11:41 mdeboard: jst23: I'd just refactor that into three separate, smaller functions

11:45 jst23: mdeboard: hmmm.. I'm having trouble figure out what three things I should break out. one for the addDragDropItem doseqs, maybe one for the add listener doseqs, what else?

11:49 clgv: I get an ArrayOutOfBoundException when using pallet's lift. it seems that something in the ssh session might be wrong specified. any ideas on that?

11:52 mdeboard: jst23: That was about it

11:58 arkh: when changing namespaces at a repl via (in-ns …) is it normal in 1.4 for (doc …) to not work? Is it because (doc) was moved to clojure.repl/ ?

11:58 maybe it was always there and I didn't notice ...

11:58 acheng: doc was moved

11:59 arkh: ok - thank you

11:59 acheng: (or, i remember being told doc was moved. my earlier statement makes it sound like i know more about the move than i do :-P)

12:01 arkh: I thought I remember it being in clojure.core *shrug*

12:02 acheng: I think you're right, fwiw

12:08 tos9: Is Criterium still the thing people use for timing small snippets?

12:08 nDuff: tos9: How seriously? I mean, there _is_ the time macro

12:09 * nDuff hasn't heard of anything supplanting Criterium for more serious benchmarking.

12:09 tos9: nDuff: Not seriously, they're dumb microbenchmarks for curiosity's sake.

12:09 I'll check out time.

12:10 nDuff: tos9: It's built into clojure.core; just (time (+ 2 2))

12:11 hugod: clgv: what are you trying to do with lift?

12:11 tos9: nDuff: Yeah, just saw it, I misread the docs as time-to-array so I didn't notice it :P

12:12 clgv: hugod: just the simple ls example with a node-list

12:14 hugod: clgv: if you gist what you are using, I can have a look...

12:14 clgv: hugod: on localhost with username and password it works but not on a remote machine (with username and password)

12:14 hugod: ok I'll do

12:16 hugod: that's it https://www.refheap.com/paste/4176

12:17 hugod: clgv: and a stacktrace if you could...

12:19 also, which version of pallet?

12:20 clgv: hugod: pallet version 0.7.1 - stacktrace: https://www.refheap.com/paste/4178

12:23 hugod: just to be clear, you are trying to ssh with password rather than using a key?

12:24 clgv: hugod: I did that as fallback since I got the same error with keys

12:25 hugod: clgv: using keys is the default, so may be simpler to debug - you can ssh to the box using your ~/.ssh/id_rsa key?

12:25 clgv: hugod: yes, I can.

12:26 hugod: if you're on osx you could try adding your key to the ssh agent with 'ssh-add -k your-key-file'

12:27 clgv: hugod: same error and stacktrace (leaf cause) with the keys

12:28 hugod: I am on Ubuntu (Linux MINT) and connecting to ubuntu

12:29 hugod: clgv: is there an ssh-agent running?

12:29 clgv: hugod: ok, after adding the key via "ssh-add" on console it now works

12:30 hugod: so what do I need to change to do this from clojure with pallet?

12:31 hugod: not sure the options are the same on ubuntu, but you may be able to permanently add your key to the agent with ssh-add -K your-key-file

12:32 the cause of this is a switch to using the ssh-agent in 0.7.1 - unfortunately there is no support in jsch (the underlying ssh lib) for adding keys to an agent programmatically yet

12:33 I have an issue open for that

12:33 clgv: :(

12:33 lotia-away: greetings all. anyone have a link or reference to a base .gitignore for lein2 projects?

12:33 clgv: hugod: so why are there options to specify key-paths at all?

12:35 lotia: should the target directory be excluded?

12:35 hugod: clgv: prior to 0.7.1 we weren't using the system ssh-agent, so we could just specify the keys - which works well except for passphrases

12:35 clgv: they are still used by the automated-admin-user crate, to authorise your key on remote nodes

12:36 clgv: hugod: uhh then I used 0.7.0 a couple of weeks ago. there keys were working

12:37 technomancy: lotia: just do `lein new sample; cat sample/.gitignore`

12:38 hugod: clgv: I didn't realise people didn't use system ssh-agents in general - keys without passphrases aren't very secure

12:41 clgv: hugod: the problem is that I have some private nodes A-D that are only accessible through a node X. hence I would need something to be able to deploy to those nodes through X

12:41 TEttinger: ugh, this is a weird error... http://pastebin.com/smYDasn9 is the relevant portion of my code, http://pastebin.com/dzfiYXBx is the error log I get

12:41 it seems like a seesaw GUI function is getting called before the needed components exist -- but the function should only be called when there is user input

12:41 lotia: technomancy: thanks

12:43 hugod: clgv: one way would be to use ssh port forwarding, and specify the gateway IP and forwarded ports in the node-list

12:44 clgv: hugod: I have no idea how to do that via pallet. can you give an example?

12:49 hugod: clgv: on your gateway box, ssh -L 8022:A:22, then port 8022 on your gateway IP can be used to access machine A

12:59 emezeske: t

12:59 clgv: hugod: is 'with-ssh-tunnel doing the job?

13:08 rbxbx: raph_amiard re: clojurescript-lua article

13:08 I'm guessing the line

13:08 a table is used to store the function, and the __call metamethod is used to _travesty_ the table as a regular function, so that the call mechanism is unified.

13:08 should say "is used to _traverse_ the table".

13:08 It does make for an amusing typo though :)

13:08 hugod: clgv: you can use with-ssh-tunnel from with a pallet crate function, and then run another lift/converge over that port, but that's probably a little trickier to get right. Sounds like we should provide first class support for this for pallet - an issue would be welcome https://github.com/pallet/pallet/issues

13:15 clgv: hugod: what would you add as info to the ticket? I can only come up with one sentence now

13:16 tos9: How do I do arithmetic with BigInts in a cross-interpreter compatible way? Python ints are all BigInts, so clojure-py is happy with just taking (+ big stuff), but clj wants (+' big stuff), but clojure-py doesn't seem to support the latter

13:17 Or perhaps it's just not in the default namespace, perhaps I need to find out where it's generally found.

13:19 mdeboard: I don't, and can never imagine needing, java interop.

13:19 mdeboard: tos9: So, just a syntax choice then?

13:19 tos9: mdeboard: Well, I haven't used python interop either, although IIUC the syntax for accessing the host language is more or less the same?

13:20 clgv: hugod: https://github.com/pallet/pallet/issues/155

13:20 mdeboard: tos9: I wonder about performance losses though

13:20 tos9: mdeboard: Also, besides ^, I probably wouldn't ever contribute to the JVM implementation, but could imagine contributing if the interpreter were written in Python.

13:20 * nDuff boggles at clojure-py being considered a Good Thing

13:20 nDuff: ...I mean, I really, _really_ love Python-the-language

13:21 but the GIL strikes me as making it a bad choice of targets

13:21 uvtc: Did clojars just recently begin listing dependencies?

13:21 technomancy: uvtc: yeah, new feature

13:21 hugod: clgv: thanks - btw we have a #pallet too...

13:21 tos9: mdeboard: mmm. I'm sure benchmarks are out there somewhere, but a PyPy-generated JIT would beat the JVM's without stuff like type hinting or whatever I'd bet

13:22 SegFaultAX|work2: nDuff: I'd like to coin a new argument strategy with regards to Python: Reductio ad GILium.

13:22 mdeboard: tos9: Oh I mean between a clj-py implementation and a python implementation

13:22 SegFaultAX|work2: nDuff: Every argument about Python will eventually lead to "the GIL man, the GIL"

13:22 tos9: Not that I've written anything performance critical yet.

13:23 mdeboard: SegFaultAX|work2: Agreed :P

13:23 technomancy: nDuff: I don't imagine it'll ever beat the JVM at what the JVM is good at, but there are plenty of things the JVM sucks at

13:23 nDuff: SegFaultAX: For a language where having good constructs for supporting in-process parallelism is one of the draws, it strikes me as more pertinent than usual.

13:24 hiredman: tos9: I doubt it

13:24 tos9: Anyways -- didn't the landscape survey of clojure just recently come out and mention clojure-py as being quite popular :)?

13:24 SegFaultAX|work2: nDuff: There are lots of interesting features that Python lacks. Threading support is hardly at the top of /my/ list.

13:24 mdeboard: nDuff: I think with clojure-py -- and believe me, I am definitely more inclined to your opinion -- the draw is higher levels of abstraction

13:25 * mdeboard imagines a namedtuple implementation that doesn't require the need for ``eval``

13:25 SegFaultAX|work2: mdeboard: Or the fact that there are loads of "trivial" language features that Python simply cannot or will not provide.

13:26 mdeboard: SegFaultAX|work2: Besides real anonymous functions, which are those?

13:26 tos9: hiredman: Well. No sense arguing about it :) I'm sure I can either find one or cook one up. But my first point was more relevant to me.

13:26 (Er, find or cook up a comparison benchmark)

13:26 SegFaultAX|work2: mdeboard: I've said this several times in #python, but I find blocks a la Ruby to be absolutely fantastic.

13:27 mdeboard: Note that those aren't exactly the same as anonymous functions.

13:27 technomancy: shame they're not first-class

13:27 SegFaultAX|work2: technomancy: First class in what way?

13:28 technomancy: IIRC all of Ruby's callables are first class. Blocks, procs, lambdas, etc.

13:28 technomancy: SegFaultAX|work2: well, in the conventional way they're not first-class in that there's a distinction between blocks, procs, and lambdas. blocks get converted into procs when you try to use them in a first-class manner, but there's still a distinction, which is stupid

13:29 SegFaultAX|work2: technomancy: The distinction is actually pretty useful. Blocks don't create their own scope (eg they're a child of the scope from which they are evaluated)

13:29 technomancy: but in a more general sense they're not first-class because the primary mechanism for calls in ruby is the method, and you can't carry a method around the same way you can a proc

13:29 SegFaultAX|work2: that's the distinction between procs and lambdas, not blocks. but I strongly disagree that it's useful.

13:30 anyway, if you end up trying to use blocks in a real first-class way it's sort of possible, but it's extremely un-idiomatic

13:31 SegFaultAX|work2: technomancy: I'm still not entirely clear on what you mean by "real first-class". Is it the fact that they are converted to procs when passed that makes them not first class?

13:32 technomancy: Maybe you could cook up some pseudocode?

13:33 But anyway, having a syntactic construct for anonymous code blocks is really handy I find.

13:33 uvtc: technomancy: thanks. Just submitted a small pull-request.

13:34 technomancy: It's more of a feature-request though. :)

13:35 technomancy: SegFaultAX|work2: right; blocks are just unboxed procs. they mostly behave the same way, but it's a unnecessary distinction

13:36 I guess my complaint revolves more around how methods aren't flexible enough

13:36 there's such a huge gap between methods and procs

13:36 tos9: If I may bring things back to my original question, does anyone happen to know of a solution :)?

13:36 technomancy: you can't partially apply them and pass them around cleanly

13:38 mdeboard: 13:14 <tos9> How do I do arithmetic with BigInts in a cross-interpreter compatible way? Python ints are all BigInts, so clojure-py is happy with just taking (+ big stuff), but clj wants (+' big stuff), but clojure-py doesn't seem to support the latter

13:38 Since I started this cosmic derail figured I might as well repose the original question.

13:39 clgv: hugod: ssh tunnels set up. thx for that hint :)

13:39 mdeboard: repost*

13:39 tos9: I suppose I can do something like (resolve '+') or whatever and then define it to be + -- I guess that'd work?

13:40 hiredman: you'll kill performance that way

13:41 tos9: Hm, why's that?

13:41 mdeboard: Thanks :)

13:42 hiredman: breaks inlining (which breaks intrinsics, not that I think +' has an intrinsic)

13:45 clgv: $findfn {:a 10 :b 20} [:a 10 :b 20]

13:45 lazybot: []

13:45 clgv: that will do ##(->> {:a 10 :b 20} seq flatten)

13:45 lazybot: ⇒ (:a 10 :b 20)

13:45 clgv: but is there a better built-in way?

13:48 devth_: if i have some unary fn, how do i apply it separately to each item in a collection?

13:48 acheng: map

13:48 (map fn collection)

13:49 devth_: ah, right. will that force evaluation over a lazy collection?

13:49 acheng: devth_: ^

13:49 oh

13:49 (doall ...

13:49 (doall (map fn coll))

13:49 jsabeaudry: Anyone knows of a lein plugin that will indicate if new versions of dependencies of the project are available?

13:50 devth_: acheng: thanks

13:51 acheng: devth_: :)

13:51 clgv: jsabeaudry: lein-outdated but that doesnt work currently due to changes of the maven repo :/

13:51 jsabeaudry: clgv, oh nice, does it still work with the clojars dependencies?

13:51 tos9: hiredman: Well. I guess being a bit slower in clojure-py is worth it if it means supporting clj then.

13:55 hugod: clgv: (apply concat {:a 10 :b 20})

13:55 clgv: jsabeaudry: nope. since it searches maven first

13:56 hugod: thats better

13:56 hyPiRion: ,(reduce into {:a 10 :b 20})

13:56 clojurebot: [:a 10 :b 20]

14:06 SegFaultAX|work2: Is the netsplit over?

14:09 alcy: transient :)

14:21 mattmoss: In (foo a (bar x)), (bar x) will be evaluated before (foo a ...), correct? Or does (bar x) get passed into (foo ...) somehow and evaluated as needed?

14:22 ohpauleez: mattmoss: eval'd first

14:22 estebann_: mattmoss: unless foo is a macro

14:23 hyPiRion: If foo is a function, foo will be evaluated first, then a, bar, x, then (bar x), and finally the whole thing

14:23 ohpauleez: that is true

14:24 mattmoss: Well, send is a fun, so there. :)

14:24 Thanks guys...

14:24 hyPiRion: You should try it out sometime

14:24 Like, hmm

14:24 mattmoss: I was just deliberating between send and send-off, for (send a (fn ...) (long-io-operation))

14:25 hyPiRion: ,(let [prn #(do (prn %) %)] ((prn +) (prn 4) (prn ((prn -) (prn 1)))))

14:25 clojurebot: #<core$_PLUS_ clojure.core$_PLUS_@367de0d>

14:25 4

14:25 #<core$_ clojure.core$_@2c67ab37>

14:25 1

14:25 -1

14:25 3

14:25 mattmoss: As opposed to (send a (fn [x (long-io-operation)] ...))

14:25 gfredericks: ,(doc send)

14:25 clojurebot: "([a f & args]); Dispatch an action to an agent. Returns the agent immediately. Subsequently, in a thread from a thread pool, the state of the agent will be set to the value of: (apply action-fn state-of-agent args)"

14:26 mattmoss: Where the latter would seem to warrant send-off

14:26 gfredericks: mattmoss: that second syntax isn't valid

14:26 but I guess you just mean to do the io op in the function

14:26 rather than passing it the result

14:27 mattmoss: ,(send (agent nil) (fn [_] (+ 1 2)))

14:27 clojurebot: #<Agent@23170428: nil>

14:27 mattmoss: where (+ 1 2) is a long io operation

14:27 lol

14:27 gfredericks: right; send-off sounds like the right thing to do there

14:27 since that's what it's for

14:28 mattmoss: Yeah, I'm just trying to be careful where I do the ops, and know whether I should use send or send-off.

14:29 ,@(send (agent nil) (fn [_] (+ 1 2)))

14:29 clojurebot: nil

14:31 mattmoss: Hmm... I could do....

14:31 jsabeaudry: Anyone has a cljs externs file for jqueryui ?

14:31 mattmoss: (send a (let [x (long-io-op)] (fn [_] x)))

14:32 eh, no. now i'm just getting bizzare, nevermind

14:41 ,@(send (agent 0) (fn [a] (let [x 5] (+ a x))))

14:41 clojurebot: 0

14:41 mattmoss: ,@(send (agent 0) (let [x 5] (fn [a] (+ a x))))

14:41 clojurebot: 0

14:44 TimMc: You're not giving it time to do anything.

14:45 mattmoss: yeah, i know...

14:45 but in my repl, the one finished faster

14:45 faster -> immediately

14:45 TimMc: Doesn't mean much. Put it through criterium.

14:46 mattmoss: Understand the former. What's the latter?

14:46 TimMc: A benchmarking lib for Clojure. Does all the warmup, gc, statistics, etc.

14:46 mattmoss: Ah, ok. I wasn't actually concerned about the speed.

14:47 It was curious to me that my repl reported 0 for one and 5 for the other.

14:47 TimMc: Just a race condition, yeah?

14:47 mattmoss: Was looking for confirmation that that was just coincidence, unpredictability.

14:47 clojurebot confirmed that for me.

14:47 hyPiRion: ,(let [agt (agent 0)] (send agt (fn [a] (let [x 5] (+ a x)))) (await agt) @agt)

14:47 clojurebot: Execution Timed Out

14:49 hyPiRion: Oh, while I'm at it: ##(let [a {:a (promise)}] (deliver (:a a) a) a)

14:49 lazybot: java.lang.StackOverflowError

14:49 hyPiRion: meh.

14:49 mattmoss: lol

15:06 melipone: hi! I'm confused on how to include my java classes with leininghen. I see :aoc and :aot and other things and the website does not have info on that

15:07 mdeboard: melipone: What do you mean include them with leiningen? Are you simply trying to import them for use in a Clojure module?

15:07 technomancy: melipone: :aot is unrelated to Java; you probably want :java-source-paths

15:07 mdeboard: Yeah listen to technomancy

15:08 melipone: technomancy: thanks! and it will compile the java sources?

15:08 technomancy: melipone: that's what they tell me.

15:08 never used it myself =)

15:08 jsabeaudry: heh

15:08 mdeboard: wut

15:08 melipone: technomancy: I know you did leiningen. What's :aoc?

15:09 technomancy: never heard of it

15:09 sounds like a typo

15:09 melipone: what's :aot then?

15:09 gfredericks: Ahead-Of-Time compilation

15:10 for if you need .class files in your jar for one reason or another

15:10 acheng: so, like time-travel

15:10 gfredericks: it compiles before you write the code

15:10 melipone: geez who needs that?

15:10 acheng: people behind on deadlines

15:10 gfredericks: if you want executable jars you need it

15:11 I think if you want to generate java classes to be consumed elsewhere you'll need it

15:11 does it give you a startup boost? I dunno.

15:11 melipone: gfredericks: don't really understand - "to be consumed elsewhere" means

15:12 gfredericks: by a java program e.g.

15:12 I've done that before; there was a framework that wanted me to provide it some classes

15:12 so using AOT meant those classes were really in the jar rather than generated at runtime

15:13 melipone: gfredericks: but which jar?

15:13 gfredericks: the jar generated by `lein jar` or `lein uberjar`

15:13 technomancy: if you don't know you need it, you don't need it =)

15:14 gfredericks: clojure has a lot of those features

15:14 melipone: technomancy: not true. we didn't know we needed electricity

15:14 gfredericks: melipone: I don't think he meant it to apply to all the things

15:16 melipone: gfredericks: okay, I think I understand that the java code is not automatically compiled with doing "lein jar" is that it?

15:16 acheng: zipper question: (-> zipper zip/next (zip/edit assoc :content "foo") zip/root) .... returns something that is not the same type as zipper.... how do i get something of the same type?

15:16 gfredericks: if by "java code" you mean "java bytecode" then yes. it just copies the .clj files into the jar

15:17 melipone: gfredericks: thanks, I see how that could speed up things

15:18 gfredericks: only initially; it'll slow down jarring

15:18 I don't think people use it unless they need it for something concrete

15:19 I think it tends to end up compiling a bunch of deps as well

15:19 melipone: gfredericks: yikes!

15:20 gfredericks: yeah just don't use it if you don't need it

15:21 acheng: hm. even (-> zipper zip/next zip/root) returns something of another type

15:22 TimMc: acheng: A different concrete type, sure.

15:22 It still is accepted by all the zipper fns though, right?

15:23 hiredman: zip/root returns the thing, not the zipper, if I recall

15:23 acheng: TimMc: my zipper is a PersistentVector and the result is PersistentStructMap ... ah. i want to feed it to xml->

15:23 amalloy: (inc hiredman)

15:23 lazybot: ⇒ 13

15:24 acheng: thanks all. i just need to follow zip/root with zip/xml-zip

15:25 TimMc: Interesting.

15:25 amalloy: or define a "top" function that stays in zipper-land

15:26 mattmoss: ,(send (agent "three") inc)

15:26 clojurebot: #<Agent@6d80f813: "three">

15:26 amalloy: (defn top [zipper] (last (take-while identity (iterate zip/up zipper)))), right?

15:27 mattmoss: ,(inc "three")

15:27 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number>

15:27 mattmoss: nevermind

15:28 TimMc: mattmoss: Try this in your REPL vs /msg clojurebot: (let [a (agent 0)] (send a inc) (Thread/sleep 2000) @a)

15:29 I guess clojurebot is doing something to the threadpools.

15:29 acheng: amalloy: thanks. (I think in my case I want to go to xml zipper land.)

15:32 mattmoss: TimMC: got it fine...

15:33 estebann_: is there any way to programmatically get what symbols a binding form will bind too?

15:33 clojure-newcomer: hey guys, how do I ensure a let and doseq don't lose a later return value from a function ?

15:34 emezeske: clojure-newcomer: Can you elaborate on what you mean by "lose a later return value"?

15:34 nDuff: clojure-newcomer: It's not clear what you mean by that.

15:34 clojure-newcomer: ...by the way, you might consider choosing a nick you can keep even in the future when you're no longer a newcomer. :)

15:34 clojure-newcomer: sorry guys… I'll try to explain a bit better

15:34 nduff: I love Clojure, but feel like I'll always be a newcomer at the moment :-)

15:34 amalloy: estebann_: ##(destructure '[[a b] (range)])

15:34 lazybot: ⇒ [vec__68872 (range) a (clojure.core/nth vec__68872 0 nil) b (clojure.core/nth vec__68872 1 nil)]

15:35 estebann_: amalloy: thanks!

15:35 mattmoss: TimMC: thanks for the note, btw. I keep forgetting to await with clojurebot and agents.

15:37 nDuff: clojure-newcomer: ...if you actually want to keep all the results from your doseq (ie. if it's not just for side effects), perhaps what you want instead is (vec (for ...)); by contrast, if you just want to collect one item from within the doseq, that might be a case for set!'ing a dynamic var with a thread-local binding.

15:37 clojure-newcomer: ...but those are just two guesses as to what you _might_ be trying to do. :)

15:37 * nDuff wanders for coffee

15:38 TimMc: amalloy: whoa whoa whoa

15:38 Since when is this destructure thing available?

15:38 amalloy: TimMc: 0.x i think

15:39 hiredman: "forever"

15:39 TimMc: dammit, still haven't read through core.clj

15:39 clojurebot: underscores in namespaces is a bad idea

15:39 ohpauleez: said as: "forrrr evvvvv errrrr"

15:39 clojure-newcomer: ok guys… hopefully this paste bin will explain… show what I get to work, and when I fail :-( http://pastebin.com/Pb9LmiYH

15:39 apologies for the formatting...

15:41 emezeske: clojure-newcomer: When you say {:status 204} is not returned... what *is* returned?

15:41 nDuff: clojure-newcomer: In the future, would you mind not using pastebin.com? It's full of ads, and some of us avoid it.

15:41 clojure-newcomer: nDuff: oh sorry… is there one you guys use ?

15:42 amalloy: ~paste

15:42 clojurebot: paste is https://refheap.com/

15:42 nDuff: clojure-newcomer: refheap or gist.github.com are both good.

15:42 clojure-newcomer: emezeske: from my println in the next function in the chain it looks like no return value

15:42 amalloy: i think some scoundrel also remapped ~gist to refheap

15:42 ~gist

15:42 clojurebot: gist is forget paste

15:42 nDuff: clojure-newcomer: (refheap is written in Clojure, maintained by Raynes, so it has some amount of local favoritism)

15:43 TimMc: clojurebot is Hotel California for factoids

15:43 clojure-newcomer: think I am suffering from eval/laziness or just plain fail

15:43 emezeske: clojure-newcomer: By "no return value" do you mean nil?

15:43 amalloy: TimMc: seriously. i'm doing brain surgery on this factoid now

15:44 he has at least half a dozen accidental meanings for gist

15:44 mattmoss: TimMc: What do you think of this? https://gist.github.com/3297977

15:45 amalloy: hiredman: am i getting the forget syntax wrong? i'm PMing "forget gist |is| forget ~paste", but he still remembers it

15:45 (ie, he remembers that gist is "forget ~paste", which some wacko taught him)

15:48 clojure-newcomer: emezeske: sorry, think I am having a bad day… seems to be working now, guess I am tired… I am definitely still suffering a little from a lack of understanding of eval, laziness and other aspects of the language

15:51 TimMc: mattmoss: I don't know anything about agent restarting.

15:52 mattmoss: Anyone know about using restart-agent within an agent's error handler? https://gist.github.com/3297977

15:52 hiredman: amalloy: that may be an infered fact

15:52 amalloy: oh jeez

15:53 TimMc: hiredman: Any API for getting clojurebot's list of values for a given key?

15:55 hiredman: no

15:56 gfredericks: repeat calls until the probability is < 0.01% that you haven't seen soemthing

15:56 hiredman: at one point I had plans to expose it as a wiki sort of thing, maybe I'll revisit that sometime

15:57 XPherior: Can you use Midje to say something like (fact (+ a b) => 3 (provided a => 1 b => 2)) ?

16:26 emezeske: XPherior: That should be easy to test. I would test it but I'm not at my clojure dev box atm

16:27 XPherior: If it doesn't work, you could do (fact (+ (a) (b)) => 3 (provided (a) => 1 (b) => 2))

16:33 estebann: given a function is there a way to get its signature(s) programatically ?

16:35 hyPiRion: estebann: ##(:arlists (meta #'interpose))

16:35 lazybot: ⇒ nil

16:35 hyPiRion: ##(:arglists (meta #'interpose))

16:35 lazybot: ⇒ ([sep coll])

16:35 estebann: hyPiRion: thanks!

16:38 hyPiRion: You're welcome. If you cannot sharp-quote it (#'), then use ##(let [foo map] (-> foo var meta :arglists)) instead :)

16:38 lazybot: java.lang.RuntimeException: Unable to resolve var: foo in this context

16:38 hyPiRion: Well, eh, screw that.

16:40 Hm, you cannot really work on metadata from a function you e.g. pass in, or are there hacks to get around that?

16:40 estebann: I sure hope so

16:42 raek: no, your program needs to get hold of the var, not the function

16:44 multiple vars can contain the same value (function in this case)

16:44 so "what is the var for this function?" is not well-defined

16:45 estebann: so for my use case I should probably check out the def or defn source to see how that metadata gets set in the firstplace?

16:46 raek: I don't know what your use case is.

16:47 in some cases you can use a macro (for instance, clojure.repl/doc does this)

16:47 estebann: I want to get the arglists for an anonymous function

16:47 hiredman: why?

16:47 clojurebot: why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone

16:48 raek: I'm not sure that's possible, unfortunately

16:48 estebann: i'm trying to be fancy... I'm messing around with symbol resolution for a user-supplied function

16:48 hiredman: that doesn't mean anything

16:48 technomancy: not having reader-provided meta on anonymous fns really sucks

16:49 estebann: user gives me a function, i read it but don't evaluate it

16:49 i manipulate symbols

16:49 then evaluate

16:49 hiredman: technomancy: the metadata isn't reader provided

16:50 ~def defn

16:50 technomancy: yeah, I guess fn* would need to provide it

16:50 anyway, it sucks

16:51 the :line and :file stuff must come from the reader though

16:57 wow, it hurts to look at that def

17:00 estebann: anyway, for what its worth it looks like the private function sigs is where the magic happens

17:31 atoi: so...

17:31 I've installed Leiningen

17:31 it ran it's little self install stuff, I think, the first time I ran it.

17:31 but now I actually want to just run clojure myfile.clj

17:31 and I still don't have a clojure executable anywhere.

17:32 scriptor: did you set up a project with lein?

17:32 atoi: secondarily...

17:32 no. oh, lein works kind of like virtualenv for Python then? No I've not set up a project I just want to screw around with like one file.

17:32 hiredman: atoi: just grab the clojure jar from the clojure.org website and run java -jar clojure.jar youfile.clj

17:32 scriptor: atoi: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md

17:32 lein new <project-name> to start

17:32 atoi: cool.

17:32 I have another question though.

17:33 I want to make a data structure that is like ... filled with nils. then I receive incoming events and store them in this structure in a FIFO manner.

17:33 but `pop` and `conj` seem to both remove and add to the same area.

17:33 vectors, last. lists, first.

17:33 so if it's a list.

17:33 [1 2 3]

17:34 holo: hi

17:34 atoi: and then I pop it's [2 3] ... then I conj and it's [x 2 3] where x is what I conj'ed in.

17:34 hiredman: there is a persitentqueue impl, but before going to that I would suggest thinking through what you are doing

17:34 scriptor: atoi: conj works differently for different types of collections

17:34 atoi: scriptor, I noticed that.

17:34 hiredman, I have. This is how you do what I want to do.

17:34 hiredman: "filled with nils"

17:34 atoi: but I want to store, say, the last X items.

17:35 hiredman, that actually doesn't matter, sorry.

17:35 I just want to store the last X events in a rotating fashion.

17:35 and pop/conj don't seem to give me what I want in that regards.

17:35 hyPiRion: Circular buffer then.

17:35 atoi: it's actually inside a (dosync (alter myref)) kind of thing.

17:35 but... I don't know that it matters.

17:35 hyPiRion, where is that documented?

17:35 holo: this is a little offtopic, but the other channels are really non-responsive. in pgadmin, do you also have the problem browsing through the 700 postgres databases on heroku? it would be nice to hide the disconnected ones, which are mostly all of them

17:35 hyPiRion: Oh, there's none in Clojure core, but you want that.

17:36 atoi: there's really no way to pop from the end and push to the top??

17:36 lazybot: atoi: What are you, crazy? Of course not!

17:36 hiredman: he wants a queue (fifo) that there is one

17:36 hyPiRion: But you could use clojure.lang.PersistentQueue in some fashion, I believe

17:36 Do it like...

17:36 metellus: he wants a stack (lifo)

17:36 atoi: no

17:36 I don't want a stack.

17:36 I want a fifo queue

17:36 hiredman: metellus: he said fifo

17:37 metellus: wow yeah sorry I don't know what I was thinking

17:37 nDuff: atoi: Joy of Clojure talks about why neither lists nor vectors are appropriate for use as FIFOs, and how PersistentQueue (which is what you want) gets the desired behaviors of both.

17:37 atoi: I need to look back and say "are the last X events I've seen all failures?"

17:37 cool. I guess I'll google PersistentQueue.

17:37 nDuff: ...oh, so actually more like a circular buffer?

17:38 hyPiRion: ,(let [queue clojure.lang.PersistentQueue/EMPTY] (-> queue (conj 1) (conj 2) (conj 3) (pop)))

17:38 atoi: nDuff, I'm not familiar with that term, but I want old events to fall out.

17:38 clojurebot: #<PersistentQueue clojure.lang.PersistentQueue@8d94bf51>

17:38 hyPiRion: ,(let [queue clojure.lang.PersistentQueue/EMPTY] (-> queue (conj 1) (conj 2) (conj 3) (peek)))

17:38 clojurebot: 1

17:38 nDuff: atoi: Yup. Sounds like what you _really_ want here is a circular buffer (aka "ring buffer") more than a PersistentQueue.

17:38 atoi: OK. 1. thanks hyPiRion for the help, 2. thanks nDuff and others for pointing that out.

17:39 TimMc: You could build something on top of pqueue that pops every time there's a conj.

17:39 atoi: Is there a 3rd party ring buffer that's easy to get access to? Because it seems like clojure.lang.PersistentQueue is at least at hand...

17:39 hyPiRion: You can simulate one with persistentQueue, though. check if the size is larger than your desired size, then if that's true, pop it off.

17:39 nDuff: atoi: https://github.com/amalloy/ring-buffer for one

17:40 hyPiRion: Or, actually, follow nDuff's link. Should be way better.

17:40 atoi: hyPiRion, I'll really be doing like (dosync (pop (conj ...

17:40 so I'd want to just have a set size pq.

17:40 hyPiRion: Yeah - there's none in core, so you have to get some 3rd party.

17:42 atoi: I guess it's just that I'm not a Lisp/Clojure programmer that that seems insane. :D

17:42 nDuff: What seems insane? Not having a ring buffer in core?

17:42 What language _does_ have a ring buffer in core?

17:42 * nDuff doesn't know of any offhand

17:42 atoi: No, something you can use as a fifo queue.

17:42 Which is all I need, really.

17:42 nDuff: atoi: There's stuff you could use, but that would be unnecessarily slow/crappy

17:43 atoi: ...whereas a ring buffer is exactly perfect.

17:43 hiredman: clojure has clojure.lang.PersistentQueue and also access to all the queues in the jre

17:43 atoi: Actually it would work out of the box, which would be perfect. :)

17:43 nDuff: atoi: ...just like, say, a Python list -- you could use it, but it'd be slower/crappier than a ring buffer for your purpose.

17:43 hiredman: so there are like at least 10 to choose from

17:43 atoi: I think PersistentQueue will be just fine.

17:43 hiredman: maybe 10 exactly

17:44 atoi: It's just that, as a complete Clojure noob, looking at the "Clojure cheat sheet" I wasn't able to find anything which works as FIFO. Which... isn't the end of the world, really. Thanks for the help. :)

17:44 hiredman: (which would make "at least 10" a pretty good guess on my part, since I only ever use lbq)

17:48 * nDuff grumbles a bit about atoi going for the easy thing rather than the best thing. (A ring buffer is going to have more consistent insert time than a PersistentQueue -- exactly equivalent to that of a Clojure vector, which is how it's implemented; the latter will sometimes need to rebalance between the distinct structures representing its head and its tail).

17:49 atoi: That is such the least of my worries today. :)

17:49 nDuff: ...actually, it's funny -- being accustomed to using ring buffers in direct memory access situations, ie. network drivers, having them actually be persistent structures that involve allocation/deallocation to manipulate

17:50 * nDuff looks at his last sentence and wonders if it parses cleanly. Intended content to convey: Ring buffers on top of persistent structures are weird.

17:51 hyPiRion: You're saying it doesn't make sense?

17:51 nDuff: hyPiRion: No, I'm not saying it doesn't make sense

17:52 atoi: Because I'm a total dumb dumb... why would (let [queue clojure.lang.PersistentQueue/EMPTY] (conj queue 1) (conj queue 2) (prn (count queue))) print 0 and then nil?

17:52 nDuff: hyPiRion: I'm just saying that my sensibilities as a system-level developer accustomed to using ring buffers for ultra-efficient zero-allocation type operations are... amused.

17:53 hyPiRion: ...there's still value to the structure, but it doesn't have the characteristics that make it so incredibly attractive for the use cases where I more typically see ring buffers used.

17:53 hiredman: atoi: nil is the result of the expression

17:53 hyPiRion: atoi: You're not changing it. Do you know Java?

17:53 hiredman: the expression is not printing it

17:53 atoi: hiredman, that's not what I'm worried about, but that makes sense.

17:53 the 0 is what's weird.

17:53 hiredman: Persistent in clojure.lang.PersistentQueue should tell you the rest

17:54 nDuff: atoi: (conj queue 1) creates a new queue with 1 added, it doesn't change the original one

17:54 hiredman: http://en.wikipedia.org/wiki/Persistent_data_structure

17:54 hyPiRion: nDuff: I see, heh.

17:54 ToxicFrog: atoi: the queue is immutable. (conj queue 1) returns a new queue with 1 added, it doesn't alter the original in place.

17:54 nDuff: atoi: ...same as how other structures in Clojure work.

17:54 hiredman: http://clojure.org/data_structures

17:54 atoi: ah. yeah. right....

17:54 scriptor: atoi: (prn (count (conj queue 1))) should print 1

17:56 atoi: right...

17:56 well, fortunately, (dosync (alter window pop) (ref-set window (into [(:state event)] @window))) seems to do what we want... which is great...

17:56 when we (let window be a list.

17:57 TEttinger: ,(let [queue clojure.lang.PersistentQueue/EMPTY] (prn (count (conj queue 1))))

17:57 clojurebot: 1

17:57 TEttinger: ,(let [queue clojure.lang.PersistentQueue/EMPTY] (prn (conj queue 1)))

17:57 clojurebot: #<PersistentQueue clojure.lang.PersistentQueue@9e3779ba>

17:57 TEttinger: ,(let [queue clojure.lang.PersistentQueue/EMPTY] (print (apply str (conj queue 1))))

17:57 clojurebot: 1

18:00 kenneth: hey -- concurrency question

18:03 i'm trying to write a function which creates a serial queue, ie. a thread, and returns a function which asynchronously executes its argument (itself a function) in the thread

18:05 hiredman: why don't you just create a thread?

18:05 kenneth: ie. something like this (defn make-queue [] (let [thread (.start (Thread. something))] (fn [f] (do-in-thread f thread))))

18:05 hiredman: or better yet use an executor

18:06 kenneth: except i can't quite figure out what to make the thread do to act like a queue

18:06 amalloy: yeah, that's just a pretty rubbish agent, thread-pool, and/or executor

18:06 hiredman: http://docs.oracle.com/javase/tutorial/essential/concurrency/executors.html

18:06 well, agents are not tired to a single thread

18:06 kenneth: wishing i had libdispatch right now :)

18:07 amalloy: no, but it's not clear he actually wants that anyway

18:07 hiredman: sure

18:08 kenneth: in c / lib dispatch i'd just create a serial queue and dispatch_async into this queue

18:08 hiredman: sometimes I feel like I could replace myself with a bot that just says "whoa, stop and think about it, read up about it"

18:08 emezeske: kenneth: Have you looked at http://clojure.org/agents and decided that isn't appropriate for your problem?

18:08 hiredman: kenneth: look, I linked you to the docs, go read them

18:09 kenneth: hiredman: that's what i'm doing at the moment

18:09 executor docs

18:17 wmealing: is this channel logged ?

18:18 nDuff: wmealing: Yes.

18:18 wmealing: ...and those logs are easily found by Google.

18:18 Raynes: wmealing: Yes. In two places.

18:19 wmealing: i'm finding some older ones

18:19 will keep looking

18:19 atoi: Hello, I'm back with stupid questions.

18:19 (defn [x y & children] (prn y)) -> java.lang.IllegalArgumentException: Parameter declaration prn should be a vector (NO_SOURCE_FILE:0)

18:19 kenneth: hiredman: does this make sense? https://gist.github.com/26b6bddf451b5b1fc7dc

18:19 atoi: This is obvious. BUT WHY?

18:19 Raynes: wmealing: http://raynes.me/logs/irc.freenode.net/clojure

18:19 scriptor: atoi: you don't have a function name :)

18:20 wmealing: thanks

18:20 atoi: oh, haha!

18:20 kenneth: also, in this case, does .execute block?

18:20 atoi: I'm rushing too much.

18:20 hiredman: kenneth: it's not a persistent queue

18:20 wmealing: Raynes, 1 year of logging :)

18:21 kenneth: hiredman: gonna add persistence later'

18:21 trying to figure out the queue before i figure out the persistence

18:23 hiredman: kenneth: if you want a persistent queue I would recommend looking at something like hornetq (jvm message bus) which has an in vm transport

18:24 an executor is not really a queue (but generally will have a queue inside the implementation somewhere)

18:24 if the values you are trying to persist are functions you are going to have trouble there

18:34 AWizzArd: In my deftype I want to hint a var as ^:unsynchronized-mutable and as ^double. Is (deftype [^double ^:unsynchronized-mutable foo]) the way to do it, or should I say (deftype [^{:tag 'double :unsynchronized-mutable true} foo]) instead?

18:35 Obviously I forgot the name of the type, but my question is about meta data anyway (:

19:22 amalloy: AWizzArd: those are both fine afaik

19:22 TimMc: "^" stacks just fine

19:23 atoi: I want to do zero? on a list, but it may have nils in it and I only want "true" if they're all zero of some sort and no exception if there's nils.

19:24 is there some sort of test to see if there's nils in a collection? I think I'm missing something.

19:25 TimMc: atoi: (every? #(or (nil? %) (zero? %)) my-list) <-- like that?

19:25 mattmoss: ,(filter nil? [:a :b nil :c])

19:25 clojurebot: (nil)

19:26 TimMc: Wait, you want nil to be treated no differently than any non-zero value?

19:26 mattmoss: ,(some nil? [:A :b nil :c])

19:26 clojurebot: true

19:26 atoi: I think I have it. yeah.

19:26 some is what I'm after.

19:26 TimMc: atoi: (every? zero? my-list)

19:26 atoi: TimMc, that blows up with nils involved

19:26 TimMc: &(zero? nil)

19:26 lazybot: java.lang.NullPointerException

19:26 TimMc: Huh, who knew.

19:26 atoi: I do, now. :)

19:26 TimMc: I'd consider that a bug.

19:27 &(doc zero?) unless it says it expects a number...

19:27 lazybot: ⇒ "([x]); Returns true if num is zero, else false"

19:27 technomancy: muhoo: I can't repro the bug where `lein repl :headless &` breaks without stdin

19:27 any details about how you were able to trigger it?

19:28 atoi: TimMc, mattmoss: I think this maybe: (and (not (some nil? @mylist)) (every? zero? @mylist))

19:28 Raynes: &(some #(or (nil? %) (zero? %)) [0 0 0 nil 0])

19:28 lazybot: ⇒ true

19:28 Raynes: &(some #(or (nil? %) (zero? %)) [0 0 0 0])

19:28 lazybot: ⇒ true

19:28 atoi: Raynes, yeah, that's not what I want.

19:28 Raynes: &(some #(and (not (nil? %)) (zero? %)) [0 0 0 nil 0])

19:28 lazybot: ⇒ true

19:28 Raynes: &(some #(and (not (nil? %)) (zero? %)) [0 0 0 0])

19:28 lazybot: ⇒ true

19:29 Raynes: I can't code.

19:29 Leave me alone.

19:29 atoi: ,(and (not (some nil? (0 0.0 nil))) (every? zero? (0 0.0 nil))

19:29 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

19:29 atoi: whoops

19:29 mattmoss: ,(every? (fnil nil? false) [0 0 0 nil 0])

19:29 clojurebot: false

19:29 atoi: fnil? hmm!

19:29 mattmoss: ,(every? (fnil nil? true) [0 0 0 nil 0])

19:29 clojurebot: false

19:29 mattmoss: I'm not doing it right. I don't know the actualy problem. :)

19:30 Raynes: &(every? (fnil zero? 1) [0 0 0 1])

19:30 lazybot: ⇒ false

19:30 Raynes: &(every? (fnil zero? 1) [0 0 0])

19:30 lazybot: ⇒ true

19:30 Raynes: mattmoss, atoi: ^

19:30 technomancy: heh; fnil on nil?

19:31 atoi: &(every? (fnil zero? 1) [0 0 0 1 nil])

19:31 lazybot: ⇒ false

19:31 mattmoss: &(every? (fnil zero? 1) [0 nil 0 1])

19:31 lazybot: ⇒ false

19:31 atoi: nice.

19:31 Raynes: atoi: What this does is replace a nil first arg to zero? with 1, so that it still returns false for a nil but doesn't actually get called with it.

19:32 atoi: Right. I just read up on that. Nice.

19:32 :)

19:32 what is the & for?

19:32 * atoi looks that up.

19:32 mattmoss: eval to lazybot

19:32 atoi: o i c

19:32 Raynes: It's what makes lazybot evaluate the code.

19:32 atoi: I thought that was ,

19:32 Raynes: lazybot isn't clojurebot

19:32 amalloy: it's like salt. you just sprinkle it on to make your code awesome

19:32 mattmoss: thats' clojurebot

19:32 atoi: ah

19:32 mattmoss: Mmm, salt. And thyme.

19:36 shajith_: yeah i've seen that too

19:36 um, misfire:/

19:37 AWizzArd: amalloy: yes, looks fine, I tested both ways.

19:39 Frozenlo`: Playing with Noir and lein-cljsbuild: is there a way to make the browser autorefresh when saving a file?

19:44 rbxbx: Frozenlo` if you're on a mac LiveReload would fit the bill nicely

19:44 http://livereload.com/

19:45 Frozenlo`: On a PC :-(

19:47 * wmealing isnt even sure what 'PC' means anymore

19:48 wmealing: although if your using chrome, https://chrome.google.com/webstore/detail/jnihajbhpnppcggbcgedagnkighmdlei

19:48 Frozenlo`: wmealing: let's say 'not Mac'

19:48 technomancy: it is really bizarre how Apple invented the personal computer and then tried their hardest to distance themselves from it

19:48 gfredericks: ah so linux then

19:49 technomancy: FSVO invented

19:49 gfredericks: Frozenlo`: get thyself a virtual box

19:49 Frozenlo`: wmealing: Seems really promising!

19:49 wmealing: Frozenlo`, there are others.. ive seen them

19:49 i just dont remember

19:49 technomancy: Frozenlo`: you can use mozrepl to set up after-save-hooks from emacs to cause reloads in gecko-based browsers

19:50 Frozenlo`: technomancy: I do prefer Chrome... but to have this in Emacs I might make the jump :)

19:51 technomancy: mozrepl is amazing

19:51 it's like slime for gecko

19:52 you can basically rewrite the internals of firefox on the fly

19:52 n00b6502: can clojure have an absolute separation between pure & side-effect functions like haskell

19:52 * wmealing googles mozrepl

19:53 Frozenlo`: technomancy: Would be nicer in elisp ;-)

19:53 technomancy: Frozenlo`: how about scheme? http://sourceforge.net/projects/minno/

19:54 hrm; I guess that project was abandoned

19:54 too bad

19:54 n00b6502: are there any text editors with color coded bracket depth

19:54 nDuff: n00b6502: With checking for that by the compiler rather than by convention? No; if you want that kind of formality, use Haskell.

19:54 n00b6502: Yes, emacs does that well.

19:54 Frozenlo`: I've yet to try it. I have elisp, clojure and CL under my belt.

19:54 wmealing: http://www.youtube.com/watch?v=5RSnHN6S52c <-mozrepl example

19:54 ivan: n00b6502: La Clojure has that too

19:54 wmealing: n00b6502, vim does it

19:54 n00b6502, google "rainbow braces"

19:54 n00b6502: is there a gedit plugin

19:54 technomancy: Frozenlo`: you could resurrect http://common-lisp.net/project/closure/ =D

19:54 nDuff: *hurl*

19:54 rbxbx: look for rainbow parentheses in your editor

19:54 n00b6502: rainbox braces ah ok

19:54 nDuff: gedit?!

19:54 n00b6502: rainbox

19:54 rainbow shit

19:55 Frozenlo`: technomancy: and leave the poor w3m alone?

19:55 n00b6502: sorry i've used windows editors for too long. emacs and vi are alien to me

19:55 casion_: rainbow-delimiters in emacs

19:55 gfredericks: rainbow shit is the worst kind of natural disaster

19:55 wmealing: casion_, THANKYOU!

19:55 technomancy: gfredericks: I think they have treatment for that problem now

19:55 some kind of pill

19:55 wmealing: ive been looking for the emacs one for a while

19:55 casion_: I love rainbow-delimiters-mode so much.

19:56 wmealing: casion_, does your theme mess with it ?

19:56 technomancy: IMO rainbow parens are unhelpful because they make it easy to match up delimiters in your brain

19:56 antifuchs: haha, yay closure (:

19:56 casion_: wmealing: nope

19:56 n00b6502: ivan, you say there is a clojure variant that can separate effects & pure ? i'd always thought seperate 'procedures' and 'functions' would be a simpleway to do it

19:56 casion_: it's fast and well-behaved

19:56 technomancy: antifuchs: have you used it?

19:56 wmealing: technomancy, how is that unhelpful ?

19:56 antifuchs: technomancy: I have! I also tried hacking on it a while ago

19:56 casion_: technomancy: unhelpful because they make it easy?

19:56 antifuchs: but that was before I had much of a clue about CLIM

19:56 ivan: n00b6502: er I meant the rainbow braces; I don't know about that

19:56 technomancy: wmealing: it slows you way down

19:56 casion_: that doesnt make sense to me at all :|

19:57 technomancy: that kind of stuff shouldn't be handled by your brain at all

19:57 needs to be pushed way down the stack

19:57 antifuchs: paredit++ (:

19:57 gfredericks: technomancy: I was imagining some meteorological event that sometimes occurs after rainbows. The sort of thing that might ruin your farm.

19:57 casion_: technomancy: it makes it much easier to read someone else's heavily nested code

19:57 technomancy: counting parens is like sounding out each individual letter when you're reading

19:57 wmealing: i have problems with paredit mode sometimes,

19:57 casion_: when writing your own, not so much writing

19:57 not so much*

19:57 wmealing: it doesn't always work how i'd want..

19:57 casion_: I'

19:58 antifuchs: wmealing: yeah; it should be relatively easy to recover though

19:58 technomancy: it's probably necessary when you're learning, but once you know how it works it slows you way down; you need to learn to do it instinctively below the conscious level of your brain

19:58 casion_: I'm new to clojure and cl, and I've had no issue with paredit yet

19:58 gfredericks: "...that was the year the rainbow shat and took out all the farms west of Highway F..."

19:58 antifuchs: you can still insert/delete delimiters

19:58 nDuff: n00b6502: ...Clojure _can't_ have statically validated pure functions without preventing other JVM code from participating. I suppose someone could built a checker that used a whitelist...

19:58 technomancy: gfredericks: eep

19:59 Frozenlo`: isn't (show-paren-mode) enough?

19:59 No need to count them, and it's quite low profile.

19:59 * wmealing tries

19:59 wmealing: technomancy, what about matching brace highlight ?

19:59 and is there a key to jump to the matching ()

19:59 casion_: yes, )

20:00 technomancy: jumping to the matching delimiter is definitely the way to go

20:00 casion_: or (

20:00 wmealing: ok

20:00 casion_: inside the sexp

20:00 same for []

20:00 gfredericks: how do you jump to matching delimiters in paredit?

20:00 technomancy: matching highlight isn't as bad since it's not as distracting. I'm on the fence as to whether it's a net positive or not.

20:00 casion_: gfredericks: just hit a close parens

20:00 antifuchs: I love love love C-M-u (jump "up" out of current subexpression). Makes things so much easier

20:01 wmealing: casion_, doesn't do it on mine.

20:01 casion_: and that jumps to the closing of the current sexp

20:01 antifuchs: also, C-M-t (transpose expressions) (-:

20:01 gfredericks: casion_: how about jumping the other way?

20:01 casion_: oh

20:01 righ

20:01 technomancy: antifuchs: I think I tried compiling closure in 06 or so, but I couldn't ever get it to run

20:01 antifuchs: technomancy: yeah, way too late at that point (;

20:01 wmealing: usually, C-M (control+meta) is the prefix for expression-based commands

20:02 wmealing: so, C-M-f and b will take you forward and backwards an expression

20:02 technomancy: antifuchs: by that time conkeror came along and saved me

20:02 casion_: gfredericks: pretty sure it's c-m-f

20:02 antifuchs: same for u and so on

20:02 casion_: let me chceck

20:02 antifuchs: technomancy: it's a really nice browser. implemented more of css than mozilla at the time (:

20:02 * wmealing tries

20:02 antifuchs: but, hah. that was ages ago

20:02 casion_: nope

20:02 hmm

20:02 technomancy: I can see the appeal

20:02 antifuchs: I am really super impressed that one single person wrote it

20:02 wmealing: antifuchs, yep that works.. hawt.

20:03 technomancy: though mozilla is so much more dynamic than other browsers that it eases a lot of the same pain points

20:03 antifuchs: wmealing: yay (:

20:03 wmealing: i'm pretty new to emacs , about a month after work hours.. hacking and playing

20:03 antifuchs: Gilbert also made most of the underlying gui toolkit (McCLIM)

20:03 casion_: antifuchs: c-m-f is what I tohught it was, but it's not working correctly in this buffer

20:03 very odd

20:03 antifuchs: and he once said he made the browser to browse the CLIM spec nicely (-:

20:03 wmealing: casion_, c-m-t does some kind of text movement

20:03 antifuchs: like, I can't even comprehend how that makes sense. but it's amazing.

20:04 technomancy: hah

20:04 antifuchs: wmealing: yeah, it switches the expression to the left of the cursor with the one on the right

20:04 casion_: wmealing: c-m-t should transpose words

20:04 wmealing: transpose, good mnemonic.. ok i can remember that

20:05 antifuchs: wmealing: C-t works on chars, M-t works on words, C-M-t works on expressions (:

20:05 casion_: ah, m-t is transpose words, c-m-t is transpose sexp

20:05 antifuchs: (and C-t works on bash, too)

20:05 casion_: antifuchs: is constantly 1 second ahead of me :P

20:05 antifuchs: casion_: hah!

20:06 too few people know that readline and most shells understand C-t and do the painful backspace-backspace-type-type dance

20:06 (hard to watch) (:

20:06 Frozenlo`: eshell

20:07 casion_: antifuchs: cocoa text-boxes understand them as well in os x

20:07 antifuchs: yessssss

20:07 casion_: along with most basic emacs commands

20:07 by default

20:07 n00b6502: is Haskell the *only* language with rigouroous seperation of sideeffects/pure functions

20:07 antifuchs: indeed. <3.

20:07 (that was to casion_, not to n00b6502; I don't know the authoritative answer to that, sorry)

20:08 casion_: it blows my brain into many pieces when I sit down at windows and c-a/e c-t/m-t m/c-b-f-n-p etc.. don't work in everything

20:09 in linux/unix I can just open emacs and do whatever heh

20:09 Frozenlo`: solution: install emacs on windows

20:09 technomancy: n00b6502: I think Coq and Agda have it too

20:09 casion_: Frozenlo`: that is rarely an option for me

20:10 Frozenlo`: use the portable Emacs on a thumb drive?

20:10 IIRC, that's how I started learning emacs.

20:10 casion_: Frozenlo`: that is what I try to do usually, but even then, when you step out of emacs you're screwed

20:11 in os x it works everywhere, and linux there's not much you can't do with emacs

20:11 technomancy: there are other languages that separate out side-effects from pure functions, but none nearly as popular as haskell

20:11 n00b6502: everything has at least one thing broken i guess

20:11 haskell: the record system

20:11 casion_: from what I've read, it's intentional in clojure?

20:12 technomancy: n00b6502: suck is a unit vector; various software doesn't suck less, it just sucks in a direction a given hacker finds more or less disagreeable.

20:12 n00b6502: scala has haskell style monads, right?

20:12 xeqi: n00b6502: as in do notation?

20:12 or.. what does haskell style mean

20:13 dnolen: n00b6502: even Haskell solution for controlling effects is wanting as evidenced by monad transformer hassles.

20:13 technomancy: as far as optimizations clojure's compiler is intentionally a bit dumb because hotspot picks up the slack

20:13 n00b6502: hehe i'm still not sure i can explain what a monad is, but i understand how blahblah -> IO () etc controls side effects and more

20:13 xeqi: I'd expect coq, omega, and a lot of other languages at the high end type theory to seperate side effects as well

20:13 n00b6502: >>= and do etc

20:14 haskell surprised me - for a long time i refused to touch it (alien syntax) - now i find everything else ugly

20:14 xeqi: n00b6502: monad is an abstraction, that any functional language can do

20:15 dnolen: xeqi: specifying code with multiple kinds of effects & not making it a PITA is an still a wide open research problem as far as I can tell.

20:15 xeqi: well, any language with a hof equivalent

20:15 dnolen: true

20:15 n00b6502: IO .. or seperation into seperate io systems like file, network, graphics ...

20:16 casion_: my understanding of haskell is limited, but isn't a monad essentially a function that generates a state?

20:16 brainproxy: what's an idiomatic dir to specify for an embedded database that's writing to the local filesystem? resources/ ?

20:16 n00b6502: when i say "its a wrapper for a return value that indicates state" haskellers tell me it isn't

20:17 gfredericks: ~monad

20:17 clojurebot: monad is #<RuntimeException java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "=" at line 1, column 38.>

20:17 technomancy: brainproxy: resources/ gets put on the classpath

20:17 so I'd avoid using it for things accessed explicitly by path

20:17 n00b6502: its not always state. it can be IO, state, "maybe", many things cpontrolled by the same syntax

20:17 hiredman: clojurebot: monad?

20:17 clojurebot: monad is the new gotos

20:17 casion_: lol

20:18 n00b6502: i always liked the method in C of indicating effect with pointers to systems but the standard libraries dont work like that :)

20:18 casion_: the C method is =

20:18 pretty simple

20:18 n00b6502: isn't it "mutable state is the new goto

20:18 gfredericks: n00b6502: I like "mutable data structures"

20:19 technomancy: ~gourds

20:19 clojurebot: SQUEEZE HIM!

20:19 n00b6502: i mean i like the practice in C of banning globals and passing system pointers around so you can tell from a prototype what a function can and can't do

20:19 casion_: n00b6502: I think you mean c++

20:19 brainproxy: technomancy: thanks!

20:19 n00b6502: you can do it in C too just fine

20:19 brainproxy: think I'll just use ./databases/ relative to the project's root

20:19 casion_: it's not idiomatic to do as such in C

20:20 n00b6502: whatever ... you certainly can do it :)

20:21 i've not used clojure yet, the lisp macros seem intruiging

20:22 do many peopl do haskell style currying in clojure

20:22 * gfredericks is working on that right dang now

20:22 n00b6502: (partial foo ... ) ... ?

20:23 but its possible to make macros to declare curryable functions ?

20:23 gfredericks: $google currj

20:23 lazybot: [Fiction Review: “Billy Lynn's Long Halftime Walk” by Ben Fountain ...] http://lit.newcity.com/2012/06/05/fiction-review-billy-lynns-long-halftime-walk-by-ben-fountain/

20:23 gfredericks: crap

20:23 $google github currj

20:23 lazybot: [Guide to I.S. Ravdin Papers, University of Pennsylvania University ...] http://www.archives.upenn.edu/faids/upt/upt50/ravdin_guide.pdf

20:23 gfredericks: O_O

20:23 https://github.com/fredericksgary/currj

20:23 I am unnotable

20:24 technomancy: gfredericks: why not just call it curried/fn?

20:24 require/as dude

20:25 xeqi: oh, and since no one else has referenced it: https://github.com/clojure/algo.monads/

20:25 technomancy: gfredericks: also, what's let* in this context?

20:25 gfredericks: technomancy: because I don't have the best ideas first all the time

20:25 technomancy: a work in progress :)

20:25 technomancy: heh

20:25 antifuchs: brainproxy: I've seen tmp/ used

20:26 gfredericks: let* and fn* are the two major special forms left I think

20:26 they're both harder because they create locals

20:26 antifuchs: (oh my, was scrolled way up, disregard)

20:26 technomancy: gfredericks: I don't follow

20:26 why do you have to cover special forms?

20:26 amalloy: technomancy: he wants to do smarter currying

20:26 Gnosis-: what's the best way to interface Clojure with Ruby on Rails?

20:27 gfredericks: technomancy: I'm taking the expression inside the macro and sussing out which bits can be computed when. I macroexpand the whole thing first so I only have to deal with special forms and locals/vars

20:27 amalloy: ((curried/fn [x y] (if (even? x) y (inc y))) 0) => (fn [y] y)

20:27 technomancy: gfredericks: oh, to avoid runtime overhead?

20:27 n00b6502: in clojure is #(somefunction arg1 %) another way of doing curry

20:27 or rather alternative

20:27 gfredericks: technomancy: well the current implementation is almost all runtime overhead, but it doesn't have to be

20:28 technomancy: either way I don't know how to not deal with special forms

20:28 technomancy: Gnosis-: https://github.com/dakrone/clj-http =)

20:28 TimMc: n00b6502: That's more like partial application.

20:28 wmealing: another emacs question, is there a "nice" way to auto-tidy clojure code ?

20:28 n00b6502: currying is just "partial application by default"?

20:28 Gnosis-: technomancy: huh, what? HTTP?

20:28 gfredericks: amalloy: I'm working on a refactoring now that would involve an independent piece that does the exact let-lifting that you said you wanted earlier

20:28 amalloy: <3

20:29 wmealing: M-q if you have paredit on, i think C-M-q otherwise

20:29 wmealing: ok

20:29 technomancy: gfredericks: if you disallow varargs isn't auto-currying just a matter of inspecting & args and calling partial appropriately?

20:30 gfredericks: technomancy: that's a naive currying yes; I want precomputation as well

20:30 amalloy: technomancy: did you parse what i said? he's trying to be smarter

20:30 Frozenlo`: Eh guys... what's the command to list directory recursively in ubuntu?

20:30 wmealing: find

20:30 gfredericks: technomancy: I have an actual project that I want to use this in. I've hand-curried several functions and it's stupid and messy and hard to follow

20:30 amalloy: Frozenlo`: i think /join #unix?

20:30 wmealing: or #ubuntu

20:30 TimMc: Oh god, not #ubuntu.

20:31 n00b6502: is clojure usable on android

20:31 TimMc: Just go to the man pages, they won't listen either, but at least they'll proide information.

20:31 Frozenlo`: Next time I won't ask here, I promise :P

20:31 wmealing: n00b6502, there is a repl

20:31 Peregrine: for certain definitions of usable

20:31 technomancy: ok, I see

20:31 casion_: Frozenlo`: ls- R?

20:32 no ?

20:32 wtf is wrong with me

20:32 Frozenlo`: casion_: Yes!

20:32 casion_: also, I just did that in /

20:32 fuck me :(

20:32 amalloy: find, guys. the answer is find, because find is always the answer

20:32 technomancy: no tree

20:32 TimMc: unless it is ed

20:32 amalloy: such a good program

20:32 technomancy: asciiart <3

20:32 amalloy: TimMc: find | ed ## god knows what this will do

20:32 gfredericks: I don't think you're doing it right if you don't use xargs at some point

20:32 Gnosis-: technomancy: so HTTP is a good way to interface with RoR? or should I try a JNI bridge with Ruby?

20:33 or even JRuby?

20:33 n00b6502: is the syntax for records/structs in clojure/lisps a pain

20:33 casion_: n00b6502: I'm pretty new to clojure, but I quite like the record syntax

20:33 technomancy: Gnosis-: HTTP is an excellent way to interact with web applications in general =)

20:33 amalloy: n00b6502: "is the syntax for x a pain" => "if so, write your own syntax"

20:33 TimMc: n00b6502: Can't speak for other lisps, because syntax varies widely, y'know? Anyway, records aren't used much in Clojure. The syntax is fine, if that mattered.

20:33 technomancy: n00b6502: you generally don't need records in clojure

20:34 casion_: most of the time it seems you can just use maps anyway

20:34 Gnosis-: technomancy: haha. but what if there's a large Ruby on Rails app that I want to add functionality to with Clojure?

20:34 amalloy: technomancy: perhaps rich would say more like: you generally don't need records, and clojure makes that explicit

20:34 but i dunno. who am i to pretend i'm rich

20:35 technomancy: Gnosis-: if it absolutely has to be in the same process, you can use jruby. but it's simpler to communicate over queues or rest APIs; lots of people use rabbitmq, for instance.

20:35 Gnosis-: ah, thanks

20:36 technomancy: Gnosis-: I think there was a talk at clojurewest on some of the pitfalls of doing it in-process

20:36 by arohner maybe?

20:36 arohner: Gnosis-: technomancy: yes, that was me

20:36 n00b6502: is it true lisp object systems are just macros

20:37 arohner: Gnosis-: https://github.com/strangeloop/clojurewest2012-slides/raw/master/Rohner-JRuby.pdf

20:37 Gnosis-: many thanks

20:38 hiredman: you can use torquebox(jruby) + immutant(clojure) which are both built on jboss so you get interop via jboss queues etc

20:38 arohner: the video gets released next week. No idea if it's any good

20:39 the biggest problems are 1) jruby is immature 2) there is lots of extra complexity, due to managing multiple JRuby runtimes in the same process and 3) ruby and clojure don't mix well, if you want to share Models, because Clojure assumes immutability, while Ruby assumes mutability

20:40 gfredericks: man I couldn't even use a java.whatsit.AtomicReference in jruby

20:40 Gnosis-: arohner: I don't think I'll use JRuby, just because I doubt this RoR app is even compatible (it's not a trivial app)

20:41 arohner: Gnosis-: I was pleasantly surprised, a standard rails3 app w/ mongo just worked out of the box

20:42 Gnosis-: arohner: for your point #3, what if a Ruby wrapper object was equivalent to a Clojure ref? just brainstorming :)

20:43 arohner: activerecord rows aren't refs, and clojure refs assume they are a pointer to an immutable object, with equality identity

20:43 Gnosis-: hiredman: thanks, I'll check out immutant...

20:43 arohner: you could probably write a ref-like thing that could work, but it would be very messy, and not a standard clojure ref

20:44 hiredman: Gnosis-: they have a channel on freenode #immutant

20:44 technomancy: personally sending json messages across rabbit would be my first choice

20:44 but it depends on where you want to add clojure; every project's different

20:45 Gnosis-: technomancy: https://we.riseup.net/crabgrass/about <--- this is the RoR app, for what it's worth

20:45 hiredman: technomancy: I think immutant <-> torquebox uses json over hornetq

20:45 (or at least that is the idea of how it would work)

20:46 http://immutant.org/tutorials/overlay/index.html

20:47 technomancy: hiredman: yeah, but he said jruby would be a difficult jump

20:48 hiredman: ah, well

20:52 n00b6502: clojure is eager eval?

20:53 gfredericks: except for all the lazy seq stuff

20:53 muhoo: after playing around with protocols/types, i wouldn't want to have to go back to doing stuff with inheritance and helpers

20:53 core.cljs is just a thing of beauty

20:53 technomancy: muhoo: heyyyy

20:53 muhoo: I can't repro the bug where `lein repl :headless &` breaks without stdin

20:54 any details as to how you're triggering it?

20:54 muhoo: technomancy: hi there. really? hmm. i'm on linux, jvm 1.6

20:54 antifuchs: arohner: oh, hey, fancy seeing you here. love circleci (-:

20:54 arohner: antifuchs: great!

20:54 muhoo: i've also reproed it on busybox/arm/beagleboard too

20:54 technomancy: heh; cool

20:55 muhoo: does it happen on master?

20:55 muhoo: oh, good point.i'm using preview7

20:55 what's the trick to run lein from git master?

20:55 thanks for looking into that, btw

20:56 technomancy: muhoo: run `lein install` from the leiningen-core dir and you should be good

20:56 muhoo: will that wipe out my preview7?

20:56 technomancy: nope, just run bin/lein from the checkout to test it

20:56 muhoo: perfect, will try now

20:58 technomancy: [2]+ Stopped ./bin/lein repl :headless

20:58 technomancy: muhoo: do you have easy access to openjdk 7?

20:58 muhoo: could find a machine to install it on, sure

20:59 i'll try that and see how it goes

20:59 technomancy: if it's not too much hassle

20:59 antifuchs: technomancy: btw, I was looking into porting swank-clojure over to a more recent slime (maybe tracking quicklisp releases); would you mind walking me through how you do development on it one of these days?

21:00 * gfredericks has been doing core.logic so long that every time he tries to type "every?" it comes out "everyo?"

21:00 antifuchs: (I'm going to be hackationing next week, so should have a bit of spare time for an interesting side project)

21:00 technomancy: antifuchs: I actually took it over from its original author; I'm not very familiar with the internals

21:00 muhoo: ok, will do

21:00 technomancy: the only parts I've worked on are the launching

21:00 antifuchs: technomancy: I don't mind that, I'm mostly interested in how you launch & test it (:

21:00 technomancy: muhoo: oddly enough I can't even get lein repl working on 1.6

21:01 muhoo: !

21:01 works great here. thanks for pushing nrepl.el along too. it's fantastic to have a slime-like env going, without slime :-)

21:01 technomancy: muhoo: oh, because I'm currently using a custom reply build that I compiled with 1.7

21:01 reverting back to the stable build fixed it

21:01 whew

21:02 antifuchs: it's pretty much like any other leiningen project; I guess the only thing that makes it different is that I use :eval-in-leiningen to make it boot faster

21:02 so it's running in the same process as leiningen rather than starting a subprocess

21:02 antifuchs: ahh, nice

21:03 technomancy: antifuchs: so you should be able to just run `lein swank` from the project root and you're off to the races

21:03 antifuchs: do you have any neat tricks for patching it in a running image? (:

21:03 ah, excellent

21:03 technomancy: antifuchs: curious though, have you seen ritz?

21:03 it's probably closer to what you want

21:03 antifuchs: I have not!

21:03 that sounds neat.

21:03 technomancy: https://github.com/pallet/ritz

21:03 antifuchs: * Allows stepping from breakpoints

21:03 crazy

21:04 technomancy: it doesn't work with the absolute latest slime, but it's a newer rev than swank-clojure uses

21:04 antifuchs: that sounds way nice. thanks for the pointer!

21:04 technomancy: sure

21:04 plus its maintainer actually understands how it works =)

21:04 antifuchs: hahaha, that's an excellent thing

21:04 technomancy: I'm actually planning on officially deprecating swank-clojure very soon

21:04 antifuchs: so I heard

21:05 hope one of the alternatives can take over google juice soon (:

21:05 muhoo: nrepl.el ftw

21:05 antifuchs: right now, searching for emacs and clojure finds tons of swank-clojure tutorials

21:05 technomancy: that's always been swank's achilles' heel

21:06 antifuchs: heh, popularity? (;

21:09 technomancy: muhoo: yeah, just confirmed it's fine here on 1.6

21:09 muhoo: it's fine, meaning, non-reproducable there?

21:09 technomancy: yeah

21:09 are you in bash?

21:09 muhoo: i am

21:10 technomancy: same here

21:12 muhoo: btw, one of the fun things about running java from nix is the ssl certs keystore is empty. easy to fix, but took me a few hours to figure out the first time.

21:13 technomancy: yeah, that's a bit of a drag

21:13 muhoo: lein requires ssl, so it fails to install

21:14 technomancy: oh yeah, I haven't been using nix's jdk since preview7

21:14 muhoo: i just copy /usr/lib/jvm/java-6-sun/jre/lib/security/cacerts to wherever/jre/lib/security :-)

21:15 actually, that might be a good doc item for leiningen

21:16 technomancy: wait, it fails to install completely?

21:16 lein ships with the clojars cert now, so it shouldn't depend upon it existing in the JDK

21:20 muhoo: yes, i think the problem is in the shell script

21:20 tacoman: I'm using lein2 with lein-tarsier, and vimclojure apparently can't find any code in the project on the classpath

21:20 is there something I'm missing in the docs about how to configure it?

21:20 technomancy: muhoo: oh, so it's not the JDK's cert store then

21:20 but curl's?

21:21 muhoo: no, jdk's. lein requires lein new-new and bultitude

21:21 tacoman: uh, nevermind. bit of user error on my testing when I switched to lein2

21:21 muhoo: so, the lein jar installs, but then won't run, because it tries to install newnew and bultitude, and can't becuase the certs donn't exist

21:21 technomancy: yeah, but it primes the cert store internally before trying to resolve newnew and bultitude

21:21 or at least it should

21:21 maybe something's happening out of order

21:22 tacoman: not sure if I'm happier that I got that working or that I actually asked the question right before realizing what was up

21:22 technomancy: no, load-certificates comes before load-plugins

21:22 muhoo: technomancy: https://www.refheap.com/paste/4191

21:23 OpenJDK Runtime Environment (build 1.7.0-release-b127)

21:23 export LEIN_VERSION="2.0.0-preview7"

21:23 technomancy: muhoo: eep

21:24 muhoo: thanks for the heads up

21:24 muhoo: it's very easy to fix though, just make sure the cacerts is populated.

21:24 technomancy: it's already populated at runtime

21:24 muhoo: ain't your fault people ship jvms with empty ssl certs

21:25 debian apparently fixes this by linking to /etc/java-6-sun/security/cacerts. nix apparently not so much.

21:25 technomancy: I wouldn't sweat it except we already have code in it to address literally this exact situation

21:26 muhoo: in preview7? or later?

21:26 technomancy: preview7

21:27 your stack trace comes from literally the exact line after load-certificates

21:27 oooooh wait though

21:27 muhoo: regression?

21:27 technomancy: I think the cert was renewed since preview7

21:27 can you try it with master?

21:27 muhoo: probably, hang on.

21:28 technomancy: definitely need to handle the expiry case though

21:28 rotation is hard

21:31 muhoo: ok, i'm in an urubus loop here. how can i run lein from git on a machine that doesn't have lein?

21:32 gfredericks: from git?

21:32 `git lein pull repl`

21:32 | xargs -0

21:33 amalloy: *cough* ouroboros. urubus is...difficult to recognize

21:33 muhoo: sorry, spelling

21:33 amalloy: muhoo: see the readme, under the Building tag

21:33 gfredericks: clojure-jack-in doesn't include the dev deps?

21:34 muhoo: amalloy: thanks, lein1 to the rescue

21:35 amalloy: gfredericks: i feel like you and i are on different planets, and one planet is totally misunderstanding muhoo

21:35 gfredericks: amalloy: my last statement wasn't re: muhoo

21:35 _Vi: Should "clojure-contrib" be used?

21:36 gfredericks: amalloy: and everything before that was a joke

21:36 muhoo: technomancy: ok, it works from bin/lein, using git.

21:36 xeqi: ~contrib

21:36 clojurebot: Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

21:36 muhoo: but, it could be an artifact of what lein1 does!

21:37 * muhoo wipes out ~/.m2 and tries to replicate

21:38 muhoo: ok, it is hard to do a clean experiment on lein2 from git

21:38 _Vi: What library should be used to make str-utils/re-partition available?

21:38 gfredericks: man the core.match README has a one line error and I have to submit a patch through jira to get it fixed?

21:38 muhoo: because it pulls its stuff from leiningen-core/lib/*

21:39 but when installed, lein2 seems to pull stuff from the net. and that's when it runs into certificate problems.

21:39 amalloy: _Vi: i don't know what that function is, but it sounds like ##(doc re-seq)

21:39 lazybot: ⇒ "([re s]); Returns a lazy sequence of successive matches of pattern in string, using java.util.regex.Matcher.find(), each such match processed with re-groups."

21:42 _Vi: amalloy, Not that. In general, should I supposed to use functions mentioned on http://richhickey.github.com/clojure-contrib/str-utils-api.html in the new code?

21:42 lazybot: Nooooo, that's so out of date! Please see instead http://clojure.github.com/clojure-contrib/str-utils-api.html and try to stop linking to rich's repo.

21:42 amalloy: sigh, i need to get that autocorrect fixed

21:42 gfredericks: dnolen: the namespace in the clojure example in the core.match readme is out of date; is there anything I can do or easiest for you to fix it yourself?

21:44 dnolen: gfredericks: thx, fixed

21:44 gfredericks: (inc dnolen)

21:44 lazybot: ⇒ 7

21:44 gfredericks: dnolen: thanks!

21:46 _Vi: Oh, I see "Deprecated since clojure-contrib version 1.2"... Where is description of what I should use instead?

21:46 gfredericks: in core.match if I want to match ('foo _) where the thing has to be a seq, (match [x] [(['foo _] :when seq?)] true) doesn't work? is there any way to do that?

21:47 cgag: i'm trying to print a lazy seq, I'm doing (println (str "my seq: " (doall myseq))), but still getting "my seq: LazySeq029834"... What am I doing wrong? I guess it's still a lazy seq, just fully realized?

21:47 gfredericks: cgag: pr-str

21:47 (str some-lazy-seq) is never helpful realized or not

21:48 eggsby: in core.match, I don't understand the point of the variable binding inside the match vectors, wouldn't you already have a symbol bound to the value if you can match off of it?

21:48 gfredericks: eggsby: I don't understand the question

21:49 eggsby: i.e. (let [a 1 b 2] (match [a b] [1 x] (println "You found" x "!")))

21:49 if you already can match off of the values of a and b, they are bound in scope already right?

21:49 amalloy: (match [1 2] [1 x] ...)

21:50 (match someone-elses-value [1 x] ...)

21:50 cgag: gfredericks, that works, thank

21:51 amalloy: (match [[1 2] [3 4]] [_ [3 x]] ...)

21:52 eggsby: ah okay, I can see it's usefulness w/ destructuring

21:52 thanks amalloy

21:53 gfredericks: I'm using core.match in tests for macro expansions and so seq vs vector is significant

21:53 amalloy: (match foo [x x] (dude foo has two of the same item!))

21:53 anyway, destructuring isn't the half of it

21:54 eggsby: hmm, I probably just don't properly understand all the stuff you can do w/ pattern matching

21:57 muhoo: technomancy: ok, the problem definitely is in the shell script, not the jvm or clojure. the process stops when backgrounded, before the jvm even launches.

21:58 gfredericks: the guard examples in the core.match wiki seem to be wrong. Not sure where to get better docs :/

21:58 * gfredericks starts digging into the code

21:59 muhoo: technomancy: and, it is something in my bashrc or profile :-(

22:00 not reproable using a clean shell with stock .bashrc and .profile

22:01 technomancy: muhoo: the plot thickens!

22:01 muhoo: the plot shows i'm an asshole :-(

22:10 gfredericks: amalloy: (match [2 3] [x x] false [x y] true) won't compile o_O

22:11 it complains that x is repeated

22:16 dnolen: gfredericks: yeah that's not allowed.

22:16 gfredericks: dnolen: how do I assert that two things should match?

22:17 dnolen: gfredericks: it's simply not possibly ... work has not been done to support that.

22:17 possible

22:17 gfredericks: oh, okay

22:17 thanks

22:18 dnolen: gfredericks: on the bright side I'm getting the hunkering to really fix core.match now that I'm wrapping up core.logic 0.8

22:18 gfredericks: :)

22:19 dnolen: gfredericks: so things like that will probably addressed, as well as outstanding bugs, ugliness and AOT issues.

22:20 gfredericks: dnolen: I hope no one ever accuses you of not working hard

23:34 mefisto`: I'm trying to start a new conjure project, and following the getting started guide on the conjure wiki, I do "lein conjure new" and get the error: Unknown command: new ... not sure what to do

23:36 amalloy: mefisto`: conjure? you really don't want to use conjure

23:36 mefisto`: amalloy: no?

23:36 amalloy: unless someone's written a new project named conjure in the last three years

23:37 which is about how long ago the conjure i know was used at all

23:38 mefisto`: what's the matter with it

23:39 Peregrine: mefisto, I believe the command you're using would work if you were using lein 1 and had the lein_conjure plugin installed.

23:40 However it will not work with lein2 until they have an updated template for lein 2.

23:40 But I am pretty inexperienced with clojure so take my comments with a grain of salt.

23:44 mefisto`: Peregrine: I see, ok

23:48 Raynes: mefisto`: Nobody uses conjure.

23:48 Which is what amalloy was saying.

23:49 Peregrine: Since it was updated 10 hours ago I wouldn't say nobody but probably pretty few

23:50 Raynes: Okay, I guess the author uses it.

23:50 And if you really, really like rails.

23:51 metajack: If I'm using datomic-free in ring, should I be pooling the connections somehow, or just calling d/connect and not worrying about it?

23:52 mefisto`: what are people using mostly?

23:53 Raynes: Compojure is the popular choice. As is Noir.

23:54 But, of course, we're not telling you to not use conjure. Just be aware that you probably wont get any help with it except from the author himself.

23:55 I think the reason conjure never caught on was because Compojure is much simpler and a lot of people come to Clojure to get away from the giant Rails-like frameworks.

23:55 Not that I'm saying there is anything wrong with Rails. Heaven knows I don't want to get in one of those arguments. :p

23:56 mefisto`: prepare for rails rage!!!!!

23:56 xeqi: rjs was the bestest

23:57 mefisto`: anyway, ok I was hoping that conjure would be a way to cater to my laziness but it was too good to be true

Logging service provided by n01se.net