#clojure logs

2012-08-08

00:34jamiihttps://gist.github.com/57121318932f61a10b2b <- trying to explain these causal ordering clearly, would be very much obliged if anyone could try reading it
00:42amalloywell, 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
00:44amalloyand 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
00:45amalloyjamii: ^
00:47jamiiamalloy: yes, I suppose rather than machines it would be more correct to talk about synchronous threads of execution
00:47jamiiI didn't want to complicate it too much though
00:48jamiiThe code blocks are a translation artefact. In the original formatting they're nice little bold boxes
00:50akhudekclojurescript optimizations past whitespace don't work with goog.base :-(
00:50jamiiamalloy: I think I'll mention your point as an aside near the bit about memory barriers
00:50akhudekseems the closure compiler literally looks for 'this' as the first argument
00:51amalloyi don't see anything about memory barriers?
00:52jamii'Even your hardware cannot escape this law' links to the wikipedia article on memory barriers
00:57akhudekI guess js* is the only way to insert a literal "this", right?
00:57akhudekAnd that is supposed to be a compiler detail?
00:57jamiiamalloy: thanks. later :)
01:20muhooheh, this made me think of feynman diagrams for some reason: https://gist.github.com/57121318932f61a10b2
02:42antifuchsso, 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?)
02:42antifuchsI apparently can't not use quicklisp slime; alllll my emacsing depends on slime-selector.
02:46antifuchsor should I just admit defeat and use eclipse + counterclockwise?
02:47antifuchsfeels just wrong to me not writing lisp in emacs ):
02:50hoeck1antifuchs: have you tried nrepl.el (https://github.com/kingtim/nrepl.el)?
02:50antifuchsah, that was it.
02:51antifuchsooh, it does go-to-definition. nice nice
02:51hoeck1I 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
02:51antifuchsyeah, I feel like I'm flying blind without M-. / M-,
02:52hoeck1antifuchs: does that work when you edit files without reloading them?
02:53antifuchsI don't know! let's find out (:
02:53hoeck1I'm using this alot in indexed python and C code (by using etags)
02:54antifuchsah, heh. M-. seems to consult the running clojure image for definition locations
02:54antifuchswhich is the way it should be[™] (-:
02:55antifuchsoh my, this is working mostly. nice.
02:55hoeck1right, 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
02:55antifuchsI 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
02:56antifuchsoh, is that so? ):
02:56antifuchswhy is that?
02:57hoeck1when 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
02:58hoeck1but if you have changed after you loaded it ... :/
02:58antifuchsughhh
02:58antifuchswell, that's not a thing ):
02:58hoeck1though, it works when you do (require ... :reload)
02:58antifuchsso backtraces will be wrong if I make substantial changes to any file?
02:58antifuchsah, hm.
02:59antifuchsso, C-c C-k on the file will fix this?
02:59hoeck1yes
02:59antifuchsah, that's ok then. thanks (:
03:00hoeck1or a more sophisticated find-definition
03:01antifuchsthat would probably work, too ((:
03:02antifuchswell, 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
03:02antifuchsor maintaining a fork of either, which will be despised by both projects. not what I'd like to spend time on (:
03:08amalloyantifuchs: nobody will mind if you take over swank-clojure
03:08antifuchshah
03:08antifuchsI wish I had the time ):
03:08amalloynrepl.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
03:09antifuchsthis work related project is already happening in my spare time; if I have to take over another project to get actual work done… /-:
03:09antifuchsah well, ok then
03:09xeqihis next blog post will stamp it
03:09antifuchsI'm just very very sad that this is the state of things
03:09amalloyblame slime
03:09antifuchsoh, I am
03:09amalloyhaha k
03:09antifuchsI've been blaming it for the last 5 years (;
03:10antifuchswell, maybe not that long
03:11amalloyi read something recently arguing that ;) is a decent winky face, but (; looks more like you've had a stroke
03:11antifuchshaha
03:12amalloydown with backwards smilies!
03:12antifuchsI shall subscript future parens & colons
03:13amalloyhah, i had to squint at that for a while before i got it
04:16muhoothere has to be a cleaner way to do this https://www.refheap.com/paste/4168
04:19mduerksenmuhoo: have a look at select-keys
04:47muhoonice, (set! clojure.core/*print-level* 15) works perfectly in nrepl
05:30TEttingerwhat 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...
05:32TEttingerit isn't exactly an error log, but this takes between 30 seconds and a minute to output, I think http://pastebin.com/pzVAAtYG
05:37TEttingerok, that time it only took 15 seconds, but occasionally it hangs and I need to Ctrl-D to stop it
05:55kralhola
06:04antares_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.
06:04otfrommorning
06:04antares_TEttinger: there is an issue for that in the leiningen tracker but chances are, there is no solution in sight even for leiningen 2
06:04ejacksonmorning
06:10TEttingerantares_, can I tell it to avoid auto-refreshing that repo?
06:10antares_TEttinger: you can probably set :update to :never, not sure if :never is supported
06:12antares_TEttinger: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L143-154
06:18TEttinger :update :daily doesn't seem to do anything
06:18TEttingereven globally in my project.clj
06:21antares_TEttinger: it may be applicable only to snapshot repositories, I'd need to check maven documentation for that
06:22antares_TEttinger: bug the person who maintains the slow repository, ask him to make releases to clojars
06:22TEttingernot sure which repo it is
06:22TEttingerthe one it can't find is clojure
06:22antares_TEttinger: clojure is an artifact, not the repo
06:23TEttingerCould not find artifact org.clojure:clojure:pom:1.+ in ...
06:23antares_TEttinger: can you gist the output?
06:23TEttingerhttp://pastebin.com/pzVAAtYG
06:23antares_TEttinger: it will iterate over all repositories until the artifact is found
06:23antares_but if one repo is being slow, it should not be hard to notice
06:24antares_TEttinger: what does your project.clj look like?
06:24TEttingerhttp://pastebin.com/vywaSSda
06:24antares_org.clojure:clojure:pom:1.+ is a little unusual
06:24TEttingerit could be lein-eclipse
06:25TEttingerhttps://github.com/abrenk/lein-eclipse/blob/master/project.clj
06:26antares_TEttinger: no, what is in *your* project.clj?
06:27TEttingerhttp://pastebin.com/vywaSSda is my project.clj
06:27antares_lein-eclipse depends on a specific version until it is explicitly given, that's not a version range
06:27clgvTEttinger: you dont need lein-eclipse anyway. just use CCW with it's leiningen integration
06:27TEttingerCCW has lein integration now?
06:27clgvyes
06:28clgvit is shipped since 0.9.0
06:28antares_TEttinger: ok, you don't use version ranges either, that's good
06:31TEttingerit appears I am up-to-date
06:32TEttingerwhat do I need to do to change a clojure project to a leiningen project?
06:32TEttingerin CCW clgv
06:35clgvTEttinger: just right-click the project and choose "convert to leiningen project"
06:35TEttingerI will try that
06:36clgvTEttinger: to be precise: "configure" -> "convert to leiningen project"
07:10leafwis it just me, or clojure's stack traces when using monads are not useful at all?
07:11leafwthe last line referenced is the domonad so-and-so line
07:11leafwthat with clj 1.4.0
08:27TEttingerugh, 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
08:28TEttingerit 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
08:32edoloughlinIs contrib/server-socket dead?
08:34ohpauleezedoloughlin: I don't think it's part of the new contrib: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
08:35cmiles74That's right, it's not in the new contrib libs.
08:35ckirkendallro_st: you there
08:37cmiles74edoloughlin: technomancy has a fork with just that code in it; https://clojars.org/server-socket
08:37ro_stckirkendall: i am, i pm'd you
08:38edoloughlincmiles74: Thanks.
08:39TEttingerok, I can't stay up any longer (5:37 AM here). I guess I will ask again tomorrow
08:39edoloughlinIs 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?
08:40ro_stisn't that what aleph is about?
08:40ro_sthttps://github.com/ztellman/aleph/
08:41edoloughlinro_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?
08:42ro_sti've no idea. i'm merely parroting :-)
08:42ohpauleezedlothiol: aleph, java interop with socket server, or another Java lib that fits the bill for your app would work.
08:42ohpauleezit really depends on the design constraints
08:43edoloughlinOk. I'll give it another look. Just don't want to commit to something that won't work out...
08:43ohpauleezedoloughlin: Then I'd look to see if there's a well supported and documented Java library that fits your use case
08:44ohpauleezand spend the effort wrapping interop (where needed) than building from the ground up
08:45edoloughlinSeems sensible. The answer to http://stackoverflow.com/questions/9575483 seems nice and Cloure-y though...
08:45ohpauleezI'd also build a prototype with aleph - the latest changes have made it very very fast
08:45edoloughlinohpauleez: I'm sold. I'll give it a look.
08:45edoloughlinThanks.
08:47jsabeaudryohpauleez, 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
08:47ohpauleezedoloughlin: 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
08:49edoloughlinI see. My experience of agents is limited to reading the docs!
08:49ohpauleezgotcha, yeah - look through some Java libs/packages and take a look at aleph
09:09alcyfolks, 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
09:10alcy^ describes the logging api
09:10alcythis is how i've described them in its config
09:10alcy(logging/init :file "riemann.log")
09:10alcy(logging/set-level "riemann.client" Level/DEBUG)
09:11alcybut I get this java.lang.RuntimeException: No such namespace: Level, compiling:(null:4)
09:12alcyany suggestions what could be wrong ?
09:17hoeck1alcy: you need to import the Level class
09:18hoeck1alcy: which is probably one from log4j: http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html
09:18alcyhoeck1: that particular tool does import the class https://github.com/aphyr/riemann/blob/master/src/riemann/logging.clj
09:20hoeck1alcy: maybe importing the class in the config file works, using: (import '(org.apache.log4j Level))
09:22hoeck1alcy: 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)
09:25alcyhoeck1: thanks, that kinda seems to work, no errors - although I dont actually get any debug msgs :(
09:26alcyhoeck1: do you know if its possible to set the root logger to debug ?
09:32drostie';'L;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;..............................................................;......................////L;;;;;;;;;;;;;..................;;;;;;;;;;;.....................;;;;;;;;;;;;;;;.........................
09:32drostiePPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPIIILLL
09:33AWizzArdExcellent, very good.
09:35drostieer, sorry.
09:35ro_sti see your cat found the keyboard
09:41michaelr525hello
09:41drewroh herro michaelr525
09:42michaelr525anyone knows what's the part after the + is called in this timestamp: "2012-08-05T13:41:08+0000"
09:42htrmichaelr525: tz offset ?
09:43michaelr525htr: probably you are right..
09:43michaelr525why 4 digits?
09:43hoeck1alcy: no, never used log4j for myself, from looking at the api, you can get the root logger with (org.apache.log4j/getRootLogger)
09:43michaelr525do you know which format should I use to parse it with clj-time?
09:43htrmichaelr525: HHMM iirc
09:44htrmichaelr525: I've no idea
09:44hoeck1alcy: maybe that works, there is also Level/ALL
09:44michaelr525hhh
09:45alcytarting to (again) play with riemann !
09:46alcyoops. bad paste
09:46alcyhoeck1: thanks, will give that a try
09:47bhenrysqlkorma 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
09:54bhenryping ibdknox
09:54ro_stwhat about multiple (order) clauses?
09:55bhenryyeah. i just tried a sql-only on it and it only puts in one.
09:55bhenryi'll try the multiple and see what happens.
09:56wmealingwould someone be kind enough to tell me exactly what kind of an error this is ? http://hastebin.com/
09:56bhenryro_st: looks like that should do it. thanks.
09:56wmealingi dont know java, but.. i'm not using that class and nor is it referenced anywhere i can see in my files
09:57ro_stwmealing: i think you pasted the wrong url
09:57ludstonwmealing: Could you give us a real link?
09:57wmealingah damnit, sorry
09:57wmealinghttp://hastebin.com/sijisagovo.coffee
09:59ludstonIt looks like the library you're using has some java dependency that you haven't got anywhere
09:59wmealingzug ok
10:00wmealingthis is fedora, and openjdk-1.7.0.3
10:00wmealingprobably some internal, unimplemented class
10:01ludstonhttp://www.jarfinder.com/index.php/java/info/com.sun.tools.xjc.Options
10:02wmealingi'm not sure if its "legal" to just download those jars and chuck them in my runtime, is it ?
10:02ludstonLooks like it's from an oracle XML library. If you google "jaxb" you ought to find a more legit looking/licenced download
10:03wmealingok
10:18rplevytrying 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:29llasramrplevy: `proxy` the appropriate class, use an atom to hold the seq evaluation state ?
10:39xeqiwmealing: 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:39xeqiso you've got to track them down yourself
10:40xeqihttp://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:41rplevyllasram: interesting idea, thanks
11:35jst23are there any particularly obvious things to refactor in this: https://gist.github.com/3295977
11:36jst23in 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:40djcoinjst23: i'm a complete noob at clojure (for now ! :)). Just for curiosity, what are you coding ? A drag&drop in clojure script ?
11:40jst23djcoin: yup exactly. just a small layer on top of the google closure DragDrop stuff
11:41mdeboardjst23: I'd just refactor that into three separate, smaller functions
11:45jst23mdeboard: 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:49clgvI 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:52mdeboardjst23: That was about it
11:58arkhwhen 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:58arkhmaybe it was always there and I didn't notice ...
11:58achengdoc was moved
11:59arkhok - thank you
11:59acheng(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:01arkhI thought I remember it being in clojure.core *shrug*
12:02achengI think you're right, fwiw
12:08tos9Is Criterium still the thing people use for timing small snippets?
12:08nDufftos9: How seriously? I mean, there _is_ the time macro
12:09tos9nDuff: Not seriously, they're dumb microbenchmarks for curiosity's sake.
12:09tos9I'll check out time.
12:10nDufftos9: It's built into clojure.core; just (time (+ 2 2))
12:11hugodclgv: what are you trying to do with lift?
12:11tos9nDuff: Yeah, just saw it, I misread the docs as time-to-array so I didn't notice it :P
12:12clgvhugod: just the simple ls example with a node-list
12:14hugodclgv: if you gist what you are using, I can have a look...
12:14clgvhugod: on localhost with username and password it works but not on a remote machine (with username and password)
12:14clgvhugod: ok I'll do
12:16clgvhugod: that's it https://www.refheap.com/paste/4176
12:17hugodclgv: and a stacktrace if you could...
12:19hugodalso, which version of pallet?
12:20clgvhugod: pallet version 0.7.1 - stacktrace: https://www.refheap.com/paste/4178
12:23hugodjust to be clear, you are trying to ssh with password rather than using a key?
12:24clgvhugod: I did that as fallback since I got the same error with keys
12:25hugodclgv: using keys is the default, so may be simpler to debug - you can ssh to the box using your ~/.ssh/id_rsa key?
12:25clgvhugod: yes, I can.
12:26hugodif you're on osx you could try adding your key to the ssh agent with 'ssh-add -k your-key-file'
12:27clgvhugod: same error and stacktrace (leaf cause) with the keys
12:28clgvhugod: I am on Ubuntu (Linux MINT) and connecting to ubuntu
12:29hugodclgv: is there an ssh-agent running?
12:29clgvhugod: ok, after adding the key via "ssh-add" on console it now works
12:30clgvhugod: so what do I need to change to do this from clojure with pallet?
12:31hugodnot 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:32hugodthe 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:33hugodI have an issue open for that
12:33clgv:(
12:33lotia-awaygreetings all. anyone have a link or reference to a base .gitignore for lein2 projects?
12:33clgvhugod: so why are there options to specify key-paths at all?
12:35lotiashould the target directory be excluded?
12:35hugodclgv: 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:35hugodclgv: they are still used by the automated-admin-user crate, to authorise your key on remote nodes
12:36clgvhugod: uhh then I used 0.7.0 a couple of weeks ago. there keys were working
12:37technomancylotia: just do `lein new sample; cat sample/.gitignore`
12:38hugodclgv: I didn't realise people didn't use system ssh-agents in general - keys without passphrases aren't very secure
12:41clgvhugod: 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:41TEttingerugh, 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:41TEttingerit 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:41lotiatechnomancy: thanks
12:43hugodclgv: one way would be to use ssh port forwarding, and specify the gateway IP and forwarded ports in the node-list
12:44clgvhugod: I have no idea how to do that via pallet. can you give an example?
12:49hugodclgv: on your gateway box, ssh -L 8022:A:22, then port 8022 on your gateway IP can be used to access machine A
12:59emezesket
12:59clgvhugod: is 'with-ssh-tunnel doing the job?
13:08rbxbxraph_amiard re: clojurescript-lua article
13:08rbxbxI'm guessing the line
13:08rbxbx 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:08rbxbxshould say "is used to _traverse_ the table".
13:08rbxbxIt does make for an amusing typo though :)
13:08hugodclgv: 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:15clgvhugod: what would you add as info to the ticket? I can only come up with one sentence now
13:16tos9How 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:17tos9Or perhaps it's just not in the default namespace, perhaps I need to find out where it's generally found.
13:19tos9mdeboard: I don't, and can never imagine needing, java interop.
13:19mdeboardtos9: So, just a syntax choice then?
13:19tos9mdeboard: Well, I haven't used python interop either, although IIUC the syntax for accessing the host language is more or less the same?
13:20clgvhugod: https://github.com/pallet/pallet/issues/155
13:20mdeboardtos9: I wonder about performance losses though
13:20tos9mdeboard: Also, besides ^, I probably wouldn't ever contribute to the JVM implementation, but could imagine contributing if the interpreter were written in Python.
13:20nDuff...I mean, I really, _really_ love Python-the-language
13:21nDuffbut the GIL strikes me as making it a bad choice of targets
13:21uvtcDid clojars just recently begin listing dependencies?
13:21technomancyuvtc: yeah, new feature
13:21hugodclgv: thanks - btw we have a #pallet too...
13:21tos9mdeboard: 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:22SegFaultAX|work2nDuff: I'd like to coin a new argument strategy with regards to Python: Reductio ad GILium.
13:22mdeboardtos9: Oh I mean between a clj-py implementation and a python implementation
13:22SegFaultAX|work2nDuff: Every argument about Python will eventually lead to "the GIL man, the GIL"
13:22tos9Not that I've written anything performance critical yet.
13:23mdeboardSegFaultAX|work2: Agreed :P
13:23technomancynDuff: 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:23nDuffSegFaultAX: 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:24hiredmantos9: I doubt it
13:24tos9Anyways -- didn't the landscape survey of clojure just recently come out and mention clojure-py as being quite popular :)?
13:24SegFaultAX|work2nDuff: There are lots of interesting features that Python lacks. Threading support is hardly at the top of /my/ list.
13:24mdeboardnDuff: I think with clojure-py -- and believe me, I am definitely more inclined to your opinion -- the draw is higher levels of abstraction
13:25SegFaultAX|work2mdeboard: Or the fact that there are loads of "trivial" language features that Python simply cannot or will not provide.
13:26mdeboardSegFaultAX|work2: Besides real anonymous functions, which are those?
13:26tos9hiredman: 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:26tos9(Er, find or cook up a comparison benchmark)
13:26SegFaultAX|work2mdeboard: I've said this several times in #python, but I find blocks a la Ruby to be absolutely fantastic.
13:27SegFaultAX|work2mdeboard: Note that those aren't exactly the same as anonymous functions.
13:27technomancyshame they're not first-class
13:27SegFaultAX|work2technomancy: First class in what way?
13:28SegFaultAX|work2technomancy: IIRC all of Ruby's callables are first class. Blocks, procs, lambdas, etc.
13:28technomancySegFaultAX|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:29SegFaultAX|work2technomancy: 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:29technomancybut 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:29technomancySegFaultAX|work2: that's the distinction between procs and lambdas, not blocks. but I strongly disagree that it's useful.
13:30technomancyanyway, 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:31SegFaultAX|work2technomancy: 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:32SegFaultAX|work2technomancy: Maybe you could cook up some pseudocode?
13:33SegFaultAX|work2But anyway, having a syntactic construct for anonymous code blocks is really handy I find.
13:33uvtctechnomancy: thanks. Just submitted a small pull-request.
13:34uvtctechnomancy: It's more of a feature-request though. :)
13:35technomancySegFaultAX|work2: right; blocks are just unboxed procs. they mostly behave the same way, but it's a unnecessary distinction
13:36technomancyI guess my complaint revolves more around how methods aren't flexible enough
13:36technomancythere's such a huge gap between methods and procs
13:36tos9If I may bring things back to my original question, does anyone happen to know of a solution :)?
13:36technomancyyou can't partially apply them and pass them around cleanly
13:38mdeboard13: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:38mdeboardSince I started this cosmic derail figured I might as well repose the original question.
13:39clgvhugod: ssh tunnels set up. thx for that hint :)
13:39mdeboardrepost*
13:39tos9I suppose I can do something like (resolve '+') or whatever and then define it to be + -- I guess that'd work?
13:40hiredmanyou'll kill performance that way
13:41tos9Hm, why's that?
13:41tos9mdeboard: Thanks :)
13:42hiredmanbreaks inlining (which breaks intrinsics, not that I think +' has an intrinsic)
13:45clgv$findfn {:a 10 :b 20} [:a 10 :b 20]
13:45lazybot[]
13:45clgvthat will do ##(->> {:a 10 :b 20} seq flatten)
13:45lazybot⇒ (:a 10 :b 20)
13:45clgvbut is there a better built-in way?
13:48devth_if i have some unary fn, how do i apply it separately to each item in a collection?
13:48achengmap
13:48acheng(map fn collection)
13:49devth_ah, right. will that force evaluation over a lazy collection?
13:49achengdevth_: ^
13:49achengoh
13:49acheng(doall ...
13:49acheng(doall (map fn coll))
13:49jsabeaudryAnyone knows of a lein plugin that will indicate if new versions of dependencies of the project are available?
13:50devth_acheng: thanks
13:51achengdevth_: :)
13:51clgvjsabeaudry: lein-outdated but that doesnt work currently due to changes of the maven repo :/
13:51jsabeaudryclgv, oh nice, does it still work with the clojars dependencies?
13:51tos9hiredman: Well. I guess being a bit slower in clojure-py is worth it if it means supporting clj then.
13:55hugodclgv: (apply concat {:a 10 :b 20})
13:55clgv jsabeaudry: nope. since it searches maven first
13:56clgvhugod: thats better
13:56hyPiRion,(reduce into {:a 10 :b 20})
13:56clojurebot[:a 10 :b 20]
14:06SegFaultAX|work2Is the netsplit over?
14:09alcytransient :)
14:21mattmossIn (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:22ohpauleezmattmoss: eval'd first
14:22estebann_mattmoss: unless foo is a macro
14:23hyPiRionIf foo is a function, foo will be evaluated first, then a, bar, x, then (bar x), and finally the whole thing
14:23ohpauleezthat is true
14:24mattmossWell, send is a fun, so there. :)
14:24mattmossThanks guys...
14:24hyPiRionYou should try it out sometime
14:24hyPiRionLike, hmm
14:24mattmossI was just deliberating between send and send-off, for (send a (fn ...) (long-io-operation))
14:25hyPiRion,(let [prn #(do (prn %) %)] ((prn +) (prn 4) (prn ((prn -) (prn 1)))))
14:25clojurebot#<core$_PLUS_ clojure.core$_PLUS_@367de0d>
14:25clojurebot4
14:25clojurebot#<core$_ clojure.core$_@2c67ab37>
14:25clojurebot1
14:25clojurebot-1
14:25clojurebot3
14:25mattmossAs opposed to (send a (fn [x (long-io-operation)] ...))
14:25gfredericks,(doc send)
14:25clojurebot"([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:26mattmossWhere the latter would seem to warrant send-off
14:26gfredericksmattmoss: that second syntax isn't valid
14:26gfredericksbut I guess you just mean to do the io op in the function
14:26gfredericksrather than passing it the result
14:27mattmoss,(send (agent nil) (fn [_] (+ 1 2)))
14:27clojurebot#<Agent@23170428: nil>
14:27mattmosswhere (+ 1 2) is a long io operation
14:27mattmosslol
14:27gfredericksright; send-off sounds like the right thing to do there
14:27gfrederickssince that's what it's for
14:28mattmossYeah, I'm just trying to be careful where I do the ops, and know whether I should use send or send-off.
14:29mattmoss,@(send (agent nil) (fn [_] (+ 1 2)))
14:29clojurebotnil
14:31mattmossHmm... I could do....
14:31jsabeaudryAnyone has a cljs externs file for jqueryui ?
14:31mattmoss(send a (let [x (long-io-op)] (fn [_] x)))
14:32mattmosseh, no. now i'm just getting bizzare, nevermind
14:41mattmoss,@(send (agent 0) (fn [a] (let [x 5] (+ a x))))
14:41clojurebot0
14:41mattmoss,@(send (agent 0) (let [x 5] (fn [a] (+ a x))))
14:41clojurebot0
14:44TimMcYou're not giving it time to do anything.
14:45mattmossyeah, i know...
14:45mattmossbut in my repl, the one finished faster
14:45mattmossfaster -> immediately
14:45TimMcDoesn't mean much. Put it through criterium.
14:46mattmossUnderstand the former. What's the latter?
14:46TimMcA benchmarking lib for Clojure. Does all the warmup, gc, statistics, etc.
14:46mattmossAh, ok. I wasn't actually concerned about the speed.
14:47mattmossIt was curious to me that my repl reported 0 for one and 5 for the other.
14:47TimMcJust a race condition, yeah?
14:47mattmossWas looking for confirmation that that was just coincidence, unpredictability.
14:47mattmossclojurebot confirmed that for me.
14:47hyPiRion,(let [agt (agent 0)] (send agt (fn [a] (let [x 5] (+ a x)))) (await agt) @agt)
14:47clojurebotExecution Timed Out
14:49hyPiRionOh, while I'm at it: ##(let [a {:a (promise)}] (deliver (:a a) a) a)
14:49lazybotjava.lang.StackOverflowError
14:49hyPiRionmeh.
14:49mattmosslol
15:06meliponehi! 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:07mdeboardmelipone: What do you mean include them with leiningen? Are you simply trying to import them for use in a Clojure module?
15:07technomancymelipone: :aot is unrelated to Java; you probably want :java-source-paths
15:07mdeboardYeah listen to technomancy
15:08meliponetechnomancy: thanks! and it will compile the java sources?
15:08technomancymelipone: that's what they tell me.
15:08technomancynever used it myself =)
15:08jsabeaudryheh
15:08mdeboardwut
15:08meliponetechnomancy: I know you did leiningen. What's :aoc?
15:09technomancynever heard of it
15:09technomancysounds like a typo
15:09meliponewhat's :aot then?
15:09gfredericksAhead-Of-Time compilation
15:10gfredericksfor if you need .class files in your jar for one reason or another
15:10achengso, like time-travel
15:10gfredericksit compiles before you write the code
15:10meliponegeez who needs that?
15:10achengpeople behind on deadlines
15:10gfredericksif you want executable jars you need it
15:11gfredericksI think if you want to generate java classes to be consumed elsewhere you'll need it
15:11gfredericksdoes it give you a startup boost? I dunno.
15:11meliponegfredericks: don't really understand - "to be consumed elsewhere" means
15:12gfredericksby a java program e.g.
15:12gfredericksI've done that before; there was a framework that wanted me to provide it some classes
15:12gfredericksso using AOT meant those classes were really in the jar rather than generated at runtime
15:13meliponegfredericks: but which jar?
15:13gfredericksthe jar generated by `lein jar` or `lein uberjar`
15:13technomancyif you don't know you need it, you don't need it =)
15:14gfredericksclojure has a lot of those features
15:14meliponetechnomancy: not true. we didn't know we needed electricity
15:14gfredericksmelipone: I don't think he meant it to apply to all the things
15:16meliponegfredericks: okay, I think I understand that the java code is not automatically compiled with doing "lein jar" is that it?
15:16achengzipper 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:16gfredericksif by "java code" you mean "java bytecode" then yes. it just copies the .clj files into the jar
15:17meliponegfredericks: thanks, I see how that could speed up things
15:18gfredericksonly initially; it'll slow down jarring
15:18gfredericksI don't think people use it unless they need it for something concrete
15:19gfredericksI think it tends to end up compiling a bunch of deps as well
15:19meliponegfredericks: yikes!
15:20gfredericksyeah just don't use it if you don't need it
15:21achenghm. even (-> zipper zip/next zip/root) returns something of another type
15:22TimMcacheng: A different concrete type, sure.
15:22TimMcIt still is accepted by all the zipper fns though, right?
15:23hiredmanzip/root returns the thing, not the zipper, if I recall
15:23achengTimMc: my zipper is a PersistentVector and the result is PersistentStructMap ... ah. i want to feed it to xml->
15:23amalloy(inc hiredman)
15:23lazybot⇒ 13
15:24achengthanks all. i just need to follow zip/root with zip/xml-zip
15:25TimMcInteresting.
15:25amalloyor define a "top" function that stays in zipper-land
15:26mattmoss,(send (agent "three") inc)
15:26clojurebot#<Agent@6d80f813: "three">
15:26amalloy(defn top [zipper] (last (take-while identity (iterate zip/up zipper)))), right?
15:27mattmoss,(inc "three")
15:27clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number>
15:27mattmossnevermind
15:28TimMcmattmoss: Try this in your REPL vs /msg clojurebot: (let [a (agent 0)] (send a inc) (Thread/sleep 2000) @a)
15:29TimMcI guess clojurebot is doing something to the threadpools.
15:29achengamalloy: thanks. (I think in my case I want to go to xml zipper land.)
15:32mattmossTimMC: got it fine...
15:33estebann_is there any way to programmatically get what symbols a binding form will bind too?
15:33clojure-newcomerhey guys, how do I ensure a let and doseq don't lose a later return value from a function ?
15:34emezeskeclojure-newcomer: Can you elaborate on what you mean by "lose a later return value"?
15:34nDuffclojure-newcomer: It's not clear what you mean by that.
15:34nDuffclojure-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:34clojure-newcomersorry guys… I'll try to explain a bit better
15:34clojure-newcomernduff: I love Clojure, but feel like I'll always be a newcomer at the moment :-)
15:34amalloyestebann_: ##(destructure '[[a b] (range)])
15:34lazybot⇒ [vec__68872 (range) a (clojure.core/nth vec__68872 0 nil) b (clojure.core/nth vec__68872 1 nil)]
15:35estebann_amalloy: thanks!
15:35mattmossTimMC: thanks for the note, btw. I keep forgetting to await with clojurebot and agents.
15:37nDuffclojure-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:37nDuffclojure-newcomer: ...but those are just two guesses as to what you _might_ be trying to do. :)
15:38TimMcamalloy: whoa whoa whoa
15:38TimMcSince when is this destructure thing available?
15:38amalloyTimMc: 0.x i think
15:39hiredman"forever"
15:39TimMcdammit, still haven't read through core.clj
15:39clojurebotunderscores in namespaces is a bad idea
15:39ohpauleezsaid as: "forrrr evvvvv errrrr"
15:39clojure-newcomerok guys… hopefully this paste bin will explain… show what I get to work, and when I fail :-( http://pastebin.com/Pb9LmiYH
15:39clojure-newcomerapologies for the formatting...
15:41emezeskeclojure-newcomer: When you say {:status 204} is not returned... what *is* returned?
15:41nDuffclojure-newcomer: In the future, would you mind not using pastebin.com? It's full of ads, and some of us avoid it.
15:41clojure-newcomernDuff: oh sorry… is there one you guys use ?
15:42amalloy~paste
15:42clojurebotpaste is https://refheap.com/
15:42nDuffclojure-newcomer: refheap or gist.github.com are both good.
15:42clojure-newcomeremezeske: from my println in the next function in the chain it looks like no return value
15:42amalloyi think some scoundrel also remapped ~gist to refheap
15:42amalloy~gist
15:42clojurebotgist is forget paste
15:42nDuffclojure-newcomer: (refheap is written in Clojure, maintained by Raynes, so it has some amount of local favoritism)
15:43TimMcclojurebot is Hotel California for factoids
15:43clojure-newcomerthink I am suffering from eval/laziness or just plain fail
15:43emezeskeclojure-newcomer: By "no return value" do you mean nil?
15:43amalloyTimMc: seriously. i'm doing brain surgery on this factoid now
15:44amalloyhe has at least half a dozen accidental meanings for gist
15:44mattmossTimMc: What do you think of this? https://gist.github.com/3297977
15:45amalloyhiredman: am i getting the forget syntax wrong? i'm PMing "forget gist |is| forget ~paste", but he still remembers it
15:45amalloy(ie, he remembers that gist is "forget ~paste", which some wacko taught him)
15:48clojure-newcomeremezeske: 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:51TimMcmattmoss: I don't know anything about agent restarting.
15:52mattmossAnyone know about using restart-agent within an agent's error handler? https://gist.github.com/3297977
15:52hiredmanamalloy: that may be an infered fact
15:52amalloyoh jeez
15:53TimMchiredman: Any API for getting clojurebot's list of values for a given key?
15:55hiredmanno
15:56gfredericksrepeat calls until the probability is < 0.01% that you haven't seen soemthing
15:56hiredmanat one point I had plans to expose it as a wiki sort of thing, maybe I'll revisit that sometime
15:57XPheriorCan you use Midje to say something like (fact (+ a b) => 3 (provided a => 1 b => 2)) ?
16:26emezeskeXPherior: That should be easy to test. I would test it but I'm not at my clojure dev box atm
16:27emezeskeXPherior: If it doesn't work, you could do (fact (+ (a) (b)) => 3 (provided (a) => 1 (b) => 2))
16:33estebanngiven a function is there a way to get its signature(s) programatically ?
16:35hyPiRionestebann: ##(:arlists (meta #'interpose))
16:35lazybot⇒ nil
16:35hyPiRion##(:arglists (meta #'interpose))
16:35lazybot⇒ ([sep coll])
16:35estebannhyPiRion: thanks!
16:38hyPiRionYou're welcome. If you cannot sharp-quote it (#'), then use ##(let [foo map] (-> foo var meta :arglists)) instead :)
16:38lazybotjava.lang.RuntimeException: Unable to resolve var: foo in this context
16:38hyPiRionWell, eh, screw that.
16:40hyPiRionHm, you cannot really work on metadata from a function you e.g. pass in, or are there hacks to get around that?
16:40estebannI sure hope so
16:42raekno, your program needs to get hold of the var, not the function
16:44raekmultiple vars can contain the same value (function in this case)
16:44raekso "what is the var for this function?" is not well-defined
16:45estebannso 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:46raekI don't know what your use case is.
16:47raekin some cases you can use a macro (for instance, clojure.repl/doc does this)
16:47estebannI want to get the arglists for an anonymous function
16:47hiredmanwhy?
16:47clojurebotwhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
16:48raekI'm not sure that's possible, unfortunately
16:48estebanni'm trying to be fancy... I'm messing around with symbol resolution for a user-supplied function
16:48hiredmanthat doesn't mean anything
16:48technomancynot having reader-provided meta on anonymous fns really sucks
16:49estebannuser gives me a function, i read it but don't evaluate it
16:49estebanni manipulate symbols
16:49estebannthen evaluate
16:49hiredmantechnomancy: the metadata isn't reader provided
16:50hiredman~def defn
16:50technomancyyeah, I guess fn* would need to provide it
16:50technomancyanyway, it sucks
16:51technomancythe :line and :file stuff must come from the reader though
16:57technomancywow, it hurts to look at that def
17:00estebannanyway, for what its worth it looks like the private function sigs is where the magic happens
17:31atoiso...
17:31atoiI've installed Leiningen
17:31atoiit ran it's little self install stuff, I think, the first time I ran it.
17:31atoibut now I actually want to just run clojure myfile.clj
17:31atoiand I still don't have a clojure executable anywhere.
17:32scriptordid you set up a project with lein?
17:32atoisecondarily...
17:32atoino. 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:32hiredmanatoi: just grab the clojure jar from the clojure.org website and run java -jar clojure.jar youfile.clj
17:32scriptoratoi: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md
17:32scriptorlein new <project-name> to start
17:32atoicool.
17:32atoiI have another question though.
17:33atoiI 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:33atoibut `pop` and `conj` seem to both remove and add to the same area.
17:33atoivectors, last. lists, first.
17:33atoiso if it's a list.
17:33atoi[1 2 3]
17:34holohi
17:34atoiand 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:34hiredmanthere is a persitentqueue impl, but before going to that I would suggest thinking through what you are doing
17:34scriptoratoi: conj works differently for different types of collections
17:34atoiscriptor, I noticed that.
17:34atoihiredman, I have. This is how you do what I want to do.
17:34hiredman"filled with nils"
17:34atoibut I want to store, say, the last X items.
17:35atoihiredman, that actually doesn't matter, sorry.
17:35atoiI just want to store the last X events in a rotating fashion.
17:35atoiand pop/conj don't seem to give me what I want in that regards.
17:35hyPiRionCircular buffer then.
17:35atoiit's actually inside a (dosync (alter myref)) kind of thing.
17:35atoibut... I don't know that it matters.
17:35atoihyPiRion, where is that documented?
17:35holothis 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:35hyPiRionOh, there's none in Clojure core, but you want that.
17:36atoithere's really no way to pop from the end and push to the top??
17:36lazybotatoi: What are you, crazy? Of course not!
17:36hiredmanhe wants a queue (fifo) that there is one
17:36hyPiRionBut you could use clojure.lang.PersistentQueue in some fashion, I believe
17:36hyPiRionDo it like...
17:36metellushe wants a stack (lifo)
17:36atoino
17:36atoiI don't want a stack.
17:36atoiI want a fifo queue
17:36hiredmanmetellus: he said fifo
17:37metelluswow yeah sorry I don't know what I was thinking
17:37nDuffatoi: 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:37atoiI need to look back and say "are the last X events I've seen all failures?"
17:37atoicool. I guess I'll google PersistentQueue.
17:37nDuff...oh, so actually more like a circular buffer?
17:38hyPiRion,(let [queue clojure.lang.PersistentQueue/EMPTY] (-> queue (conj 1) (conj 2) (conj 3) (pop)))
17:38atoinDuff, I'm not familiar with that term, but I want old events to fall out.
17:38clojurebot#<PersistentQueue clojure.lang.PersistentQueue@8d94bf51>
17:38hyPiRion,(let [queue clojure.lang.PersistentQueue/EMPTY] (-> queue (conj 1) (conj 2) (conj 3) (peek)))
17:38clojurebot1
17:38nDuffatoi: Yup. Sounds like what you _really_ want here is a circular buffer (aka "ring buffer") more than a PersistentQueue.
17:38atoiOK. 1. thanks hyPiRion for the help, 2. thanks nDuff and others for pointing that out.
17:39TimMcYou could build something on top of pqueue that pops every time there's a conj.
17:39atoiIs 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:39hyPiRionYou 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:39nDuffatoi: https://github.com/amalloy/ring-buffer for one
17:40hyPiRionOr, actually, follow nDuff's link. Should be way better.
17:40atoihyPiRion, I'll really be doing like (dosync (pop (conj ...
17:40atoiso I'd want to just have a set size pq.
17:40hyPiRionYeah - there's none in core, so you have to get some 3rd party.
17:42atoiI guess it's just that I'm not a Lisp/Clojure programmer that that seems insane. :D
17:42nDuffWhat seems insane? Not having a ring buffer in core?
17:42nDuffWhat language _does_ have a ring buffer in core?
17:42atoiNo, something you can use as a fifo queue.
17:42atoiWhich is all I need, really.
17:42nDuffatoi: There's stuff you could use, but that would be unnecessarily slow/crappy
17:43nDuffatoi: ...whereas a ring buffer is exactly perfect.
17:43hiredmanclojure has clojure.lang.PersistentQueue and also access to all the queues in the jre
17:43atoiActually it would work out of the box, which would be perfect. :)
17:43nDuffatoi: ...just like, say, a Python list -- you could use it, but it'd be slower/crappier than a ring buffer for your purpose.
17:43hiredmanso there are like at least 10 to choose from
17:43atoiI think PersistentQueue will be just fine.
17:43hiredmanmaybe 10 exactly
17:44atoiIt'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:44hiredman(which would make "at least 10" a pretty good guess on my part, since I only ever use lbq)
17:49atoiThat is such the least of my worries today. :)
17:49nDuff...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:51hyPiRionYou're saying it doesn't make sense?
17:51nDuffhyPiRion: No, I'm not saying it doesn't make sense
17:52atoiBecause 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:52nDuffhyPiRion: 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:53nDuffhyPiRion: ...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:53hiredmanatoi: nil is the result of the expression
17:53hyPiRionatoi: You're not changing it. Do you know Java?
17:53hiredmanthe expression is not printing it
17:53atoihiredman, that's not what I'm worried about, but that makes sense.
17:53atoithe 0 is what's weird.
17:53hiredmanPersistent in clojure.lang.PersistentQueue should tell you the rest
17:54nDuffatoi: (conj queue 1) creates a new queue with 1 added, it doesn't change the original one
17:54hiredmanhttp://en.wikipedia.org/wiki/Persistent_data_structure
17:54hyPiRionnDuff: I see, heh.
17:54ToxicFrogatoi: the queue is immutable. (conj queue 1) returns a new queue with 1 added, it doesn't alter the original in place.
17:54nDuffatoi: ...same as how other structures in Clojure work.
17:54hiredmanhttp://clojure.org/data_structures
17:54atoiah. yeah. right....
17:54scriptoratoi: (prn (count (conj queue 1))) should print 1
17:56atoiright...
17:56atoiwell, fortunately, (dosync (alter window pop) (ref-set window (into [(:state event)] @window))) seems to do what we want... which is great...
17:56atoiwhen we (let window be a list.
17:57TEttinger,(let [queue clojure.lang.PersistentQueue/EMPTY] (prn (count (conj queue 1))))
17:57clojurebot1
17:57TEttinger,(let [queue clojure.lang.PersistentQueue/EMPTY] (prn (conj queue 1)))
17:57clojurebot#<PersistentQueue clojure.lang.PersistentQueue@9e3779ba>
17:57TEttinger,(let [queue clojure.lang.PersistentQueue/EMPTY] (print (apply str (conj queue 1))))
17:57clojurebot1
18:00kennethhey -- concurrency question
18:03kennethi'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:05hiredmanwhy don't you just create a thread?
18:05kennethie. something like this (defn make-queue [] (let [thread (.start (Thread. something))] (fn [f] (do-in-thread f thread))))
18:05hiredmanor better yet use an executor
18:06kennethexcept i can't quite figure out what to make the thread do to act like a queue
18:06amalloyyeah, that's just a pretty rubbish agent, thread-pool, and/or executor
18:06hiredmanhttp://docs.oracle.com/javase/tutorial/essential/concurrency/executors.html
18:06hiredmanwell, agents are not tired to a single thread
18:06kennethwishing i had libdispatch right now :)
18:07amalloyno, but it's not clear he actually wants that anyway
18:07hiredmansure
18:08kennethin c / lib dispatch i'd just create a serial queue and dispatch_async into this queue
18:08hiredmansometimes I feel like I could replace myself with a bot that just says "whoa, stop and think about it, read up about it"
18:08emezeskekenneth: Have you looked at http://clojure.org/agents and decided that isn't appropriate for your problem?
18:08hiredmankenneth: look, I linked you to the docs, go read them
18:09kennethhiredman: that's what i'm doing at the moment
18:09kennethexecutor docs
18:17wmealingis this channel logged ?
18:18nDuffwmealing: Yes.
18:18nDuffwmealing: ...and those logs are easily found by Google.
18:18Rayneswmealing: Yes. In two places.
18:19wmealingi'm finding some older ones
18:19wmealingwill keep looking
18:19atoiHello, I'm back with stupid questions.
18:19atoi(defn [x y & children] (prn y)) -> java.lang.IllegalArgumentException: Parameter declaration prn should be a vector (NO_SOURCE_FILE:0)
18:19kennethhiredman: does this make sense? https://gist.github.com/26b6bddf451b5b1fc7dc
18:19atoiThis is obvious. BUT WHY?
18:19Rayneswmealing: http://raynes.me/logs/irc.freenode.net/clojure
18:19scriptoratoi: you don't have a function name :)
18:20wmealingthanks
18:20atoioh, haha!
18:20kennethalso, in this case, does .execute block?
18:20atoiI'm rushing too much.
18:20hiredmankenneth: it's not a persistent queue
18:20wmealingRaynes, 1 year of logging :)
18:21kennethhiredman: gonna add persistence later'
18:21kennethtrying to figure out the queue before i figure out the persistence
18:23hiredmankenneth: if you want a persistent queue I would recommend looking at something like hornetq (jvm message bus) which has an in vm transport
18:24hiredmanan executor is not really a queue (but generally will have a queue inside the implementation somewhere)
18:24hiredmanif the values you are trying to persist are functions you are going to have trouble there
18:34AWizzArdIn 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:35AWizzArdObviously I forgot the name of the type, but my question is about meta data anyway (:
19:22amalloyAWizzArd: those are both fine afaik
19:22TimMc"^" stacks just fine
19:23atoiI 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:24atoiis there some sort of test to see if there's nils in a collection? I think I'm missing something.
19:25TimMcatoi: (every? #(or (nil? %) (zero? %)) my-list) <-- like that?
19:25mattmoss,(filter nil? [:a :b nil :c])
19:25clojurebot(nil)
19:26TimMcWait, you want nil to be treated no differently than any non-zero value?
19:26mattmoss,(some nil? [:A :b nil :c])
19:26clojurebottrue
19:26atoiI think I have it. yeah.
19:26atoisome is what I'm after.
19:26TimMcatoi: (every? zero? my-list)
19:26atoiTimMc, that blows up with nils involved
19:26TimMc&(zero? nil)
19:26lazybotjava.lang.NullPointerException
19:26TimMcHuh, who knew.
19:26atoiI do, now. :)
19:26TimMcI'd consider that a bug.
19:27TimMc&(doc zero?) unless it says it expects a number...
19:27lazybot⇒ "([x]); Returns true if num is zero, else false"
19:27technomancymuhoo: I can't repro the bug where `lein repl :headless &` breaks without stdin
19:27technomancyany details about how you were able to trigger it?
19:28atoiTimMc, mattmoss: I think this maybe: (and (not (some nil? @mylist)) (every? zero? @mylist))
19:28Raynes&(some #(or (nil? %) (zero? %)) [0 0 0 nil 0])
19:28lazybot⇒ true
19:28Raynes&(some #(or (nil? %) (zero? %)) [0 0 0 0])
19:28lazybot⇒ true
19:28atoiRaynes, yeah, that's not what I want.
19:28Raynes&(some #(and (not (nil? %)) (zero? %)) [0 0 0 nil 0])
19:28lazybot⇒ true
19:28Raynes&(some #(and (not (nil? %)) (zero? %)) [0 0 0 0])
19:28lazybot⇒ true
19:29RaynesI can't code.
19:29RaynesLeave me alone.
19:29atoi,(and (not (some nil? (0 0.0 nil))) (every? zero? (0 0.0 nil))
19:29clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
19:29atoiwhoops
19:29mattmoss,(every? (fnil nil? false) [0 0 0 nil 0])
19:29clojurebotfalse
19:29atoifnil? hmm!
19:29mattmoss,(every? (fnil nil? true) [0 0 0 nil 0])
19:29clojurebotfalse
19:29mattmossI'm not doing it right. I don't know the actualy problem. :)
19:30Raynes&(every? (fnil zero? 1) [0 0 0 1])
19:30lazybot⇒ false
19:30Raynes&(every? (fnil zero? 1) [0 0 0])
19:30lazybot⇒ true
19:30Raynesmattmoss, atoi: ^
19:30technomancyheh; fnil on nil?
19:31atoi&(every? (fnil zero? 1) [0 0 0 1 nil])
19:31lazybot⇒ false
19:31mattmoss&(every? (fnil zero? 1) [0 nil 0 1])
19:31lazybot⇒ false
19:31atoinice.
19:31Raynesatoi: 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:32atoiRight. I just read up on that. Nice.
19:32atoi:)
19:32atoiwhat is the & for?
19:32mattmosseval to lazybot
19:32atoio i c
19:32RaynesIt's what makes lazybot evaluate the code.
19:32atoiI thought that was ,
19:32Rayneslazybot isn't clojurebot
19:32amalloyit's like salt. you just sprinkle it on to make your code awesome
19:32mattmossthats' clojurebot
19:32atoiah
19:32mattmossMmm, salt. And thyme.
19:36shajith_yeah i've seen that too
19:36shajith_um, misfire:/
19:37AWizzArdamalloy: yes, looks fine, I tested both ways.
19:39Frozenlo`Playing with Noir and lein-cljsbuild: is there a way to make the browser autorefresh when saving a file?
19:44rbxbxFrozenlo` if you're on a mac LiveReload would fit the bill nicely
19:44rbxbxhttp://livereload.com/
19:45Frozenlo`On a PC :-(
19:48wmealingalthough if your using chrome, https://chrome.google.com/webstore/detail/jnihajbhpnppcggbcgedagnkighmdlei
19:48Frozenlo`wmealing: let's say 'not Mac'
19:48technomancyit is really bizarre how Apple invented the personal computer and then tried their hardest to distance themselves from it
19:48gfredericksah so linux then
19:49technomancyFSVO invented
19:49gfredericksFrozenlo`: get thyself a virtual box
19:49Frozenlo`wmealing: Seems really promising!
19:49wmealingFrozenlo`, there are others.. ive seen them
19:49wmealingi just dont remember
19:49technomancyFrozenlo`: you can use mozrepl to set up after-save-hooks from emacs to cause reloads in gecko-based browsers
19:50Frozenlo`technomancy: I do prefer Chrome... but to have this in Emacs I might make the jump :)
19:51technomancymozrepl is amazing
19:51technomancyit's like slime for gecko
19:52technomancyyou can basically rewrite the internals of firefox on the fly
19:52n00b6502can clojure have an absolute separation between pure & side-effect functions like haskell
19:53Frozenlo`technomancy: Would be nicer in elisp ;-)
19:53technomancyFrozenlo`: how about scheme? http://sourceforge.net/projects/minno/
19:54technomancyhrm; I guess that project was abandoned
19:54technomancytoo bad
19:54n00b6502are there any text editors with color coded bracket depth
19:54nDuffn00b6502: With checking for that by the compiler rather than by convention? No; if you want that kind of formality, use Haskell.
19:54nDuffn00b6502: Yes, emacs does that well.
19:54Frozenlo`I've yet to try it. I have elisp, clojure and CL under my belt.
19:54wmealinghttp://www.youtube.com/watch?v=5RSnHN6S52c <-mozrepl example
19:54ivann00b6502: La Clojure has that too
19:54wmealingn00b6502, vim does it
19:54wmealingn00b6502, google "rainbow braces"
19:54n00b6502is there a gedit plugin
19:54technomancyFrozenlo`: you could resurrect http://common-lisp.net/project/closure/ =D
19:54nDuff*hurl*
19:54rbxbxlook for rainbow parentheses in your editor
19:54n00b6502rainbox braces ah ok
19:54nDuffgedit?!
19:54n00b6502rainbox
19:54n00b6502rainbow shit
19:55Frozenlo`technomancy: and leave the poor w3m alone?
19:55n00b6502sorry i've used windows editors for too long. emacs and vi are alien to me
19:55casion_rainbow-delimiters in emacs
19:55gfredericksrainbow shit is the worst kind of natural disaster
19:55wmealingcasion_, THANKYOU!
19:55technomancygfredericks: I think they have treatment for that problem now
19:55technomancysome kind of pill
19:55wmealingive been looking for the emacs one for a while
19:55casion_I love rainbow-delimiters-mode so much.
19:56wmealingcasion_, does your theme mess with it ?
19:56technomancyIMO rainbow parens are unhelpful because they make it easy to match up delimiters in your brain
19:56antifuchshaha, yay closure (:
19:56casion_wmealing: nope
19:56n00b6502ivan, 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:56casion_it's fast and well-behaved
19:56technomancyantifuchs: have you used it?
19:56wmealingtechnomancy, how is that unhelpful ?
19:56antifuchstechnomancy: I have! I also tried hacking on it a while ago
19:56casion_technomancy: unhelpful because they make it easy?
19:56antifuchsbut that was before I had much of a clue about CLIM
19:56ivann00b6502: er I meant the rainbow braces; I don't know about that
19:56technomancywmealing: it slows you way down
19:56casion_that doesnt make sense to me at all :|
19:57technomancythat kind of stuff shouldn't be handled by your brain at all
19:57technomancyneeds to be pushed way down the stack
19:57antifuchsparedit++ (:
19:57gfrederickstechnomancy: I was imagining some meteorological event that sometimes occurs after rainbows. The sort of thing that might ruin your farm.
19:57casion_technomancy: it makes it much easier to read someone else's heavily nested code
19:57technomancycounting parens is like sounding out each individual letter when you're reading
19:57wmealingi have problems with paredit mode sometimes,
19:57casion_when writing your own, not so much writing
19:57casion_not so much*
19:57wmealingit doesn't always work how i'd want..
19:57casion_I'
19:58antifuchswmealing: yeah; it should be relatively easy to recover though
19:58technomancyit'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:58casion_I'm new to clojure and cl, and I've had no issue with paredit yet
19:58gfredericks"...that was the year the rainbow shat and took out all the farms west of Highway F..."
19:58antifuchsyou can still insert/delete delimiters
19:58nDuffn00b6502: ...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:58technomancygfredericks: eep
19:59Frozenlo`isn't (show-paren-mode) enough?
19:59Frozenlo`No need to count them, and it's quite low profile.
19:59wmealingtechnomancy, what about matching brace highlight ?
19:59wmealingand is there a key to jump to the matching ()
19:59casion_yes, )
20:00technomancyjumping to the matching delimiter is definitely the way to go
20:00casion_or (
20:00wmealingok
20:00casion_inside the sexp
20:00casion_same for []
20:00gfrederickshow do you jump to matching delimiters in paredit?
20:00technomancymatching 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:00casion_gfredericks: just hit a close parens
20:00antifuchsI love love love C-M-u (jump "up" out of current subexpression). Makes things so much easier
20:01wmealingcasion_, doesn't do it on mine.
20:01casion_and that jumps to the closing of the current sexp
20:01antifuchsalso, C-M-t (transpose expressions) (-:
20:01gfrederickscasion_: how about jumping the other way?
20:01casion_oh
20:01casion_righ
20:01technomancyantifuchs: I think I tried compiling closure in 06 or so, but I couldn't ever get it to run
20:01antifuchstechnomancy: yeah, way too late at that point (;
20:01antifuchswmealing: usually, C-M (control+meta) is the prefix for expression-based commands
20:02antifuchswmealing: so, C-M-f and b will take you forward and backwards an expression
20:02technomancyantifuchs: by that time conkeror came along and saved me
20:02casion_gfredericks: pretty sure it's c-m-f
20:02antifuchssame for u and so on
20:02casion_let me chceck
20:02antifuchstechnomancy: it's a really nice browser. implemented more of css than mozilla at the time (:
20:02antifuchsbut, hah. that was ages ago
20:02casion_nope
20:02casion_hmm
20:02technomancyI can see the appeal
20:02antifuchsI am really super impressed that one single person wrote it
20:02wmealingantifuchs, yep that works.. hawt.
20:03technomancythough mozilla is so much more dynamic than other browsers that it eases a lot of the same pain points
20:03antifuchswmealing: yay (:
20:03wmealingi'm pretty new to emacs , about a month after work hours.. hacking and playing
20:03antifuchsGilbert also made most of the underlying gui toolkit (McCLIM)
20:03casion_antifuchs: c-m-f is what I tohught it was, but it's not working correctly in this buffer
20:03casion_very odd
20:03antifuchsand he once said he made the browser to browse the CLIM spec nicely (-:
20:03wmealingcasion_, c-m-t does some kind of text movement
20:03antifuchslike, I can't even comprehend how that makes sense. but it's amazing.
20:04technomancyhah
20:04antifuchswmealing: yeah, it switches the expression to the left of the cursor with the one on the right
20:04casion_wmealing: c-m-t should transpose words
20:04wmealingtranspose, good mnemonic.. ok i can remember that
20:05antifuchswmealing: C-t works on chars, M-t works on words, C-M-t works on expressions (:
20:05casion_ah, m-t is transpose words, c-m-t is transpose sexp
20:05antifuchs(and C-t works on bash, too)
20:05casion_antifuchs: is constantly 1 second ahead of me :P
20:05antifuchscasion_: hah!
20:06antifuchstoo few people know that readline and most shells understand C-t and do the painful backspace-backspace-type-type dance
20:06antifuchs(hard to watch) (:
20:06Frozenlo`eshell
20:07casion_antifuchs: cocoa text-boxes understand them as well in os x
20:07antifuchsyessssss
20:07casion_along with most basic emacs commands
20:07casion_by default
20:07n00b6502is Haskell the *only* language with rigouroous seperation of sideeffects/pure functions
20:07antifuchsindeed. <3.
20:07antifuchs(that was to casion_, not to n00b6502; I don't know the authoritative answer to that, sorry)
20:08casion_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:09casion_in linux/unix I can just open emacs and do whatever heh
20:09Frozenlo`solution: install emacs on windows
20:09technomancyn00b6502: I think Coq and Agda have it too
20:09casion_Frozenlo`: that is rarely an option for me
20:10Frozenlo`use the portable Emacs on a thumb drive?
20:10Frozenlo`IIRC, that's how I started learning emacs.
20:10casion_Frozenlo`: that is what I try to do usually, but even then, when you step out of emacs you're screwed
20:11casion_in os x it works everywhere, and linux there's not much you can't do with emacs
20:11technomancythere are other languages that separate out side-effects from pure functions, but none nearly as popular as haskell
20:11n00b6502everything has at least one thing broken i guess
20:11n00b6502haskell: the record system
20:11casion_from what I've read, it's intentional in clojure?
20:12technomancyn00b6502: 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:12n00b6502scala has haskell style monads, right?
20:12xeqin00b6502: as in do notation?
20:12xeqior.. what does haskell style mean
20:13dnolenn00b6502: even Haskell solution for controlling effects is wanting as evidenced by monad transformer hassles.
20:13technomancyas far as optimizations clojure's compiler is intentionally a bit dumb because hotspot picks up the slack
20:13n00b6502hehe 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:13xeqiI'd expect coq, omega, and a lot of other languages at the high end type theory to seperate side effects as well
20:13n00b6502>>= and do etc
20:14n00b6502haskell surprised me - for a long time i refused to touch it (alien syntax) - now i find everything else ugly
20:14xeqin00b6502: monad is an abstraction, that any functional language can do
20:15dnolenxeqi: 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:15xeqiwell, any language with a hof equivalent
20:15xeqidnolen: true
20:15n00b6502IO .. or seperation into seperate io systems like file, network, graphics ...
20:16casion_my understanding of haskell is limited, but isn't a monad essentially a function that generates a state?
20:16brainproxywhat's an idiomatic dir to specify for an embedded database that's writing to the local filesystem? resources/ ?
20:16n00b6502when i say "its a wrapper for a return value that indicates state" haskellers tell me it isn't
20:17gfredericks~monad
20:17clojurebotmonad is #<RuntimeException java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "=" at line 1, column 38.>
20:17technomancybrainproxy: resources/ gets put on the classpath
20:17technomancyso I'd avoid using it for things accessed explicitly by path
20:17n00b6502its not always state. it can be IO, state, "maybe", many things cpontrolled by the same syntax
20:17hiredmanclojurebot: monad?
20:17clojurebotmonad is the new gotos
20:17casion_lol
20:18n00b6502i always liked the method in C of indicating effect with pointers to systems but the standard libraries dont work like that :)
20:18casion_the C method is =
20:18casion_pretty simple
20:18n00b6502isn't it "mutable state is the new goto
20:18gfredericksn00b6502: I like "mutable data structures"
20:19technomancy~gourds
20:19clojurebotSQUEEZE HIM!
20:19n00b6502i 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:19casion_n00b6502: I think you mean c++
20:19brainproxytechnomancy: thanks!
20:19n00b6502you can do it in C too just fine
20:19brainproxythink I'll just use ./databases/ relative to the project's root
20:19casion_it's not idiomatic to do as such in C
20:20n00b6502whatever ... you certainly can do it :)
20:21n00b6502i've not used clojure yet, the lisp macros seem intruiging
20:22n00b6502do many peopl do haskell style currying in clojure
20:22n00b6502(partial foo ... ) ... ?
20:23n00b6502but its possible to make macros to declare curryable functions ?
20:23gfredericks$google currj
20:23lazybot[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:23gfrederickscrap
20:23gfredericks$google github currj
20:23lazybot[Guide to I.S. Ravdin Papers, University of Pennsylvania University ...] http://www.archives.upenn.edu/faids/upt/upt50/ravdin_guide.pdf
20:23gfredericksO_O
20:23gfrederickshttps://github.com/fredericksgary/currj
20:23gfredericksI am unnotable
20:24technomancygfredericks: why not just call it curried/fn?
20:24technomancyrequire/as dude
20:25xeqioh, and since no one else has referenced it: https://github.com/clojure/algo.monads/
20:25technomancygfredericks: also, what's let* in this context?
20:25gfrederickstechnomancy: because I don't have the best ideas first all the time
20:25gfrederickstechnomancy: a work in progress :)
20:25technomancyheh
20:25antifuchsbrainproxy: I've seen tmp/ used
20:26gfrederickslet* and fn* are the two major special forms left I think
20:26gfredericksthey're both harder because they create locals
20:26antifuchs(oh my, was scrolled way up, disregard)
20:26technomancygfredericks: I don't follow
20:26technomancywhy do you have to cover special forms?
20:26amalloytechnomancy: he wants to do smarter currying
20:26Gnosis-what's the best way to interface Clojure with Ruby on Rails?
20:27gfrederickstechnomancy: 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:27amalloy((curried/fn [x y] (if (even? x) y (inc y))) 0) => (fn [y] y)
20:27technomancygfredericks: oh, to avoid runtime overhead?
20:27n00b6502in clojure is #(somefunction arg1 %) another way of doing curry
20:27n00b6502or rather alternative
20:27gfrederickstechnomancy: well the current implementation is almost all runtime overhead, but it doesn't have to be
20:28gfrederickstechnomancy: either way I don't know how to not deal with special forms
20:28technomancyGnosis-: https://github.com/dakrone/clj-http =)
20:28TimMcn00b6502: That's more like partial application.
20:28wmealinganother emacs question, is there a "nice" way to auto-tidy clojure code ?
20:28n00b6502currying is just "partial application by default"?
20:28Gnosis-technomancy: huh, what? HTTP?
20:28gfredericksamalloy: 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:28amalloy<3
20:29amalloywmealing: M-q if you have paredit on, i think C-M-q otherwise
20:29wmealingok
20:29technomancygfredericks: if you disallow varargs isn't auto-currying just a matter of inspecting & args and calling partial appropriately?
20:30gfrederickstechnomancy: that's a naive currying yes; I want precomputation as well
20:30amalloytechnomancy: did you parse what i said? he's trying to be smarter
20:30Frozenlo`Eh guys... what's the command to list directory recursively in ubuntu?
20:30wmealingfind
20:30gfrederickstechnomancy: 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:30amalloyFrozenlo`: i think /join #unix?
20:30wmealingor #ubuntu
20:30TimMcOh god, not #ubuntu.
20:31n00b6502is clojure usable on android
20:31TimMcJust go to the man pages, they won't listen either, but at least they'll proide information.
20:31Frozenlo`Next time I won't ask here, I promise :P
20:31wmealingn00b6502, there is a repl
20:31Peregrinefor certain definitions of usable
20:31technomancyok, I see
20:31casion_Frozenlo`: ls- R?
20:32casion_no ?
20:32casion_wtf is wrong with me
20:32Frozenlo`casion_: Yes!
20:32casion_also, I just did that in /
20:32casion_fuck me :(
20:32amalloyfind, guys. the answer is find, because find is always the answer
20:32technomancyno tree
20:32TimMcunless it is ed
20:32amalloysuch a good program
20:32technomancyasciiart <3
20:32amalloyTimMc: find | ed ## god knows what this will do
20:32gfredericksI don't think you're doing it right if you don't use xargs at some point
20:32Gnosis-technomancy: so HTTP is a good way to interface with RoR? or should I try a JNI bridge with Ruby?
20:33Gnosis-or even JRuby?
20:33n00b6502is the syntax for records/structs in clojure/lisps a pain
20:33casion_n00b6502: I'm pretty new to clojure, but I quite like the record syntax
20:33technomancyGnosis-: HTTP is an excellent way to interact with web applications in general =)
20:33amalloyn00b6502: "is the syntax for x a pain" => "if so, write your own syntax"
20:33TimMcn00b6502: 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:33technomancyn00b6502: you generally don't need records in clojure
20:34casion_most of the time it seems you can just use maps anyway
20:34Gnosis-technomancy: haha. but what if there's a large Ruby on Rails app that I want to add functionality to with Clojure?
20:34amalloytechnomancy: perhaps rich would say more like: you generally don't need records, and clojure makes that explicit
20:34amalloybut i dunno. who am i to pretend i'm rich
20:35technomancyGnosis-: 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:35Gnosis-ah, thanks
20:36technomancyGnosis-: I think there was a talk at clojurewest on some of the pitfalls of doing it in-process
20:36technomancyby arohner maybe?
20:36arohnerGnosis-: technomancy: yes, that was me
20:36n00b6502is it true lisp object systems are just macros
20:37arohnerGnosis-: https://github.com/strangeloop/clojurewest2012-slides/raw/master/Rohner-JRuby.pdf
20:37Gnosis-many thanks
20:38hiredmanyou can use torquebox(jruby) + immutant(clojure) which are both built on jboss so you get interop via jboss queues etc
20:38arohnerthe video gets released next week. No idea if it's any good
20:39arohnerthe 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:40gfredericksman I couldn't even use a java.whatsit.AtomicReference in jruby
20:40Gnosis-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:41arohnerGnosis-: I was pleasantly surprised, a standard rails3 app w/ mongo just worked out of the box
20:42Gnosis-arohner: for your point #3, what if a Ruby wrapper object was equivalent to a Clojure ref? just brainstorming :)
20:43arohneractiverecord rows aren't refs, and clojure refs assume they are a pointer to an immutable object, with equality identity
20:43Gnosis-hiredman: thanks, I'll check out immutant...
20:43arohneryou could probably write a ref-like thing that could work, but it would be very messy, and not a standard clojure ref
20:44hiredmanGnosis-: they have a channel on freenode #immutant
20:44technomancypersonally sending json messages across rabbit would be my first choice
20:44technomancybut it depends on where you want to add clojure; every project's different
20:45Gnosis-technomancy: https://we.riseup.net/crabgrass/about <--- this is the RoR app, for what it's worth
20:45hiredmantechnomancy: I think immutant <-> torquebox uses json over hornetq
20:45hiredman(or at least that is the idea of how it would work)
20:46hiredmanhttp://immutant.org/tutorials/overlay/index.html
20:47technomancyhiredman: yeah, but he said jruby would be a difficult jump
20:48hiredmanah, well
20:52n00b6502clojure is eager eval?
20:53gfredericksexcept for all the lazy seq stuff
20:53muhooafter playing around with protocols/types, i wouldn't want to have to go back to doing stuff with inheritance and helpers
20:53muhoocore.cljs is just a thing of beauty
20:53technomancymuhoo: heyyyy
20:53technomancymuhoo: I can't repro the bug where `lein repl :headless &` breaks without stdin
20:54technomancyany details as to how you're triggering it?
20:54muhootechnomancy: hi there. really? hmm. i'm on linux, jvm 1.6
20:54antifuchsarohner: oh, hey, fancy seeing you here. love circleci (-:
20:54arohnerantifuchs: great!
20:54muhooi've also reproed it on busybox/arm/beagleboard too
20:54technomancyheh; cool
20:55technomancymuhoo: does it happen on master?
20:55muhoooh, good point.i'm using preview7
20:55muhoowhat's the trick to run lein from git master?
20:55muhoothanks for looking into that, btw
20:56technomancymuhoo: run `lein install` from the leiningen-core dir and you should be good
20:56muhoowill that wipe out my preview7?
20:56technomancynope, just run bin/lein from the checkout to test it
20:56muhooperfect, will try now
20:58muhootechnomancy: [2]+ Stopped ./bin/lein repl :headless
20:58technomancymuhoo: do you have easy access to openjdk 7?
20:58muhoocould find a machine to install it on, sure
20:59muhooi'll try that and see how it goes
20:59technomancyif it's not too much hassle
20:59antifuchstechnomancy: 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:00antifuchs(I'm going to be hackationing next week, so should have a bit of spare time for an interesting side project)
21:00technomancyantifuchs: I actually took it over from its original author; I'm not very familiar with the internals
21:00muhoook, will do
21:00technomancythe only parts I've worked on are the launching
21:00antifuchstechnomancy: I don't mind that, I'm mostly interested in how you launch & test it (:
21:00technomancymuhoo: oddly enough I can't even get lein repl working on 1.6
21:01muhoo!
21:01muhooworks great here. thanks for pushing nrepl.el along too. it's fantastic to have a slime-like env going, without slime :-)
21:01technomancymuhoo: oh, because I'm currently using a custom reply build that I compiled with 1.7
21:01technomancyreverting back to the stable build fixed it
21:01technomancywhew
21:02technomancyantifuchs: 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:02technomancyso it's running in the same process as leiningen rather than starting a subprocess
21:02antifuchsahh, nice
21:03technomancyantifuchs: so you should be able to just run `lein swank` from the project root and you're off to the races
21:03antifuchsdo you have any neat tricks for patching it in a running image? (:
21:03antifuchsah, excellent
21:03technomancyantifuchs: curious though, have you seen ritz?
21:03technomancyit's probably closer to what you want
21:03antifuchsI have not!
21:03antifuchsthat sounds neat.
21:03technomancyhttps://github.com/pallet/ritz
21:03antifuchs* Allows stepping from breakpoints
21:03antifuchscrazy
21:04technomancyit doesn't work with the absolute latest slime, but it's a newer rev than swank-clojure uses
21:04antifuchsthat sounds way nice. thanks for the pointer!
21:04technomancysure
21:04technomancyplus its maintainer actually understands how it works =)
21:04antifuchshahaha, that's an excellent thing
21:04technomancyI'm actually planning on officially deprecating swank-clojure very soon
21:04antifuchsso I heard
21:05antifuchshope one of the alternatives can take over google juice soon (:
21:05muhoonrepl.el ftw
21:05antifuchsright now, searching for emacs and clojure finds tons of swank-clojure tutorials
21:05technomancythat's always been swank's achilles' heel
21:06antifuchsheh, popularity? (;
21:09technomancymuhoo: yeah, just confirmed it's fine here on 1.6
21:09muhooit's fine, meaning, non-reproducable there?
21:09technomancyyeah
21:09technomancyare you in bash?
21:09muhooi am
21:10technomancysame here
21:12muhoobtw, 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:13technomancyyeah, that's a bit of a drag
21:13muhoolein requires ssl, so it fails to install
21:14technomancyoh yeah, I haven't been using nix's jdk since preview7
21:14muhooi just copy /usr/lib/jvm/java-6-sun/jre/lib/security/cacerts to wherever/jre/lib/security :-)
21:15muhooactually, that might be a good doc item for leiningen
21:16technomancywait, it fails to install completely?
21:16technomancylein ships with the clojars cert now, so it shouldn't depend upon it existing in the JDK
21:20muhooyes, i think the problem is in the shell script
21:20tacomanI'm using lein2 with lein-tarsier, and vimclojure apparently can't find any code in the project on the classpath
21:20tacomanis there something I'm missing in the docs about how to configure it?
21:20technomancymuhoo: oh, so it's not the JDK's cert store then
21:20technomancybut curl's?
21:21muhoono, jdk's. lein requires lein new-new and bultitude
21:21tacomanuh, nevermind. bit of user error on my testing when I switched to lein2
21:21muhooso, 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:21technomancyyeah, but it primes the cert store internally before trying to resolve newnew and bultitude
21:21technomancyor at least it should
21:21technomancymaybe something's happening out of order
21:22tacomannot sure if I'm happier that I got that working or that I actually asked the question right before realizing what was up
21:22technomancyno, load-certificates comes before load-plugins
21:22muhootechnomancy: https://www.refheap.com/paste/4191
21:23muhooOpenJDK Runtime Environment (build 1.7.0-release-b127)
21:23muhooexport LEIN_VERSION="2.0.0-preview7"
21:23technomancymuhoo: eep
21:24technomancymuhoo: thanks for the heads up
21:24muhooit's very easy to fix though, just make sure the cacerts is populated.
21:24technomancyit's already populated at runtime
21:24muhooain't your fault people ship jvms with empty ssl certs
21:25muhoodebian apparently fixes this by linking to /etc/java-6-sun/security/cacerts. nix apparently not so much.
21:25technomancyI wouldn't sweat it except we already have code in it to address literally this exact situation
21:26muhooin preview7? or later?
21:26technomancypreview7
21:27technomancyyour stack trace comes from literally the exact line after load-certificates
21:27technomancyoooooh wait though
21:27muhooregression?
21:27technomancyI think the cert was renewed since preview7
21:27technomancycan you try it with master?
21:27muhooprobably, hang on.
21:28technomancydefinitely need to handle the expiry case though
21:28technomancyrotation is hard
21:31muhoook, i'm in an urubus loop here. how can i run lein from git on a machine that doesn't have lein?
21:32gfredericksfrom git?
21:32gfredericks`git lein pull repl`
21:32gfredericks| xargs -0
21:33amalloy*cough* ouroboros. urubus is...difficult to recognize
21:33muhoosorry, spelling
21:33amalloymuhoo: see the readme, under the Building tag
21:33gfredericksclojure-jack-in doesn't include the dev deps?
21:34muhooamalloy: thanks, lein1 to the rescue
21:35amalloygfredericks: i feel like you and i are on different planets, and one planet is totally misunderstanding muhoo
21:35gfredericksamalloy: my last statement wasn't re: muhoo
21:35_ViShould "clojure-contrib" be used?
21:36gfredericksamalloy: and everything before that was a joke
21:36muhootechnomancy: ok, it works from bin/lein, using git.
21:36xeqi~contrib
21:36clojurebotMonolithic 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:36muhoobut, it could be an artifact of what lein1 does!
21:38muhoook, it is hard to do a clean experiment on lein2 from git
21:38_ViWhat library should be used to make str-utils/re-partition available?
21:38gfredericksman the core.match README has a one line error and I have to submit a patch through jira to get it fixed?
21:38muhoobecause it pulls its stuff from leiningen-core/lib/*
21:39muhoobut when installed, lein2 seems to pull stuff from the net. and that's when it runs into certificate problems.
21:39amalloy_Vi: i don't know what that function is, but it sounds like ##(doc re-seq)
21:39lazybot⇒ "([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_Viamalloy, 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:42lazybotNooooo, 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:42amalloysigh, i need to get that autocorrect fixed
21:42gfredericksdnolen: 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:44dnolengfredericks: thx, fixed
21:44gfredericks(inc dnolen)
21:44lazybot⇒ 7
21:44gfredericksdnolen: thanks!
21:46_ViOh, I see "Deprecated since clojure-contrib version 1.2"... Where is description of what I should use instead?
21:46gfredericksin 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:47cgagi'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:47gfrederickscgag: pr-str
21:47gfredericks(str some-lazy-seq) is never helpful realized or not
21:48eggsbyin 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:48gfrederickseggsby: I don't understand the question
21:49eggsbyi.e. (let [a 1 b 2] (match [a b] [1 x] (println "You found" x "!")))
21:49eggsbyif you already can match off of the values of a and b, they are bound in scope already right?
21:49amalloy(match [1 2] [1 x] ...)
21:50amalloy(match someone-elses-value [1 x] ...)
21:50cgaggfredericks, that works, thank
21:51amalloy(match [[1 2] [3 4]] [_ [3 x]] ...)
21:52eggsbyah okay, I can see it's usefulness w/ destructuring
21:52eggsbythanks amalloy
21:53gfredericksI'm using core.match in tests for macro expansions and so seq vs vector is significant
21:53amalloy(match foo [x x] (dude foo has two of the same item!))
21:53amalloyanyway, destructuring isn't the half of it
21:54eggsbyhmm, I probably just don't properly understand all the stuff you can do w/ pattern matching
21:57muhootechnomancy: 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:58gfredericksthe guard examples in the core.match wiki seem to be wrong. Not sure where to get better docs :/
21:59muhootechnomancy: and, it is something in my bashrc or profile :-(
22:00muhoonot reproable using a clean shell with stock .bashrc and .profile
22:01technomancymuhoo: the plot thickens!
22:01muhoothe plot shows i'm an asshole :-(
22:10gfredericksamalloy: (match [2 3] [x x] false [x y] true) won't compile o_O
22:11gfredericksit complains that x is repeated
22:16dnolengfredericks: yeah that's not allowed.
22:16gfredericksdnolen: how do I assert that two things should match?
22:17dnolengfredericks: it's simply not possibly ... work has not been done to support that.
22:17dnolenpossible
22:17gfredericksoh, okay
22:17gfredericksthanks
22:18dnolengfredericks: 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:18gfredericks:)
22:19dnolengfredericks: so things like that will probably addressed, as well as outstanding bugs, ugliness and AOT issues.
22:20gfredericksdnolen: I hope no one ever accuses you of not working hard
23:34mefisto`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:36amalloymefisto`: conjure? you really don't want to use conjure
23:36mefisto`amalloy: no?
23:36amalloyunless someone's written a new project named conjure in the last three years
23:37amalloywhich is about how long ago the conjure i know was used at all
23:38mefisto`what's the matter with it
23:39Peregrinemefisto, I believe the command you're using would work if you were using lein 1 and had the lein_conjure plugin installed.
23:40PeregrineHowever it will not work with lein2 until they have an updated template for lein 2.
23:40PeregrineBut I am pretty inexperienced with clojure so take my comments with a grain of salt.
23:44mefisto`Peregrine: I see, ok
23:48Raynesmefisto`: Nobody uses conjure.
23:48RaynesWhich is what amalloy was saying.
23:49PeregrineSince it was updated 10 hours ago I wouldn't say nobody but probably pretty few
23:50RaynesOkay, I guess the author uses it.
23:50RaynesAnd if you really, really like rails.
23:51metajackIf 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:52mefisto`what are people using mostly?
23:53RaynesCompojure is the popular choice. As is Noir.
23:54RaynesBut, 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:55RaynesI 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:55RaynesNot 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:56mefisto`prepare for rails rage!!!!!
23:56xeqirjs was the bestest
23:57mefisto`anyway, ok I was hoping that conjure would be a way to cater to my laziness but it was too good to be true