#clojure logs

2011-06-14

00:21[mattb]what's the function to use a vector as arguments to a function instead of as a vector?
00:22jediapply?
00:23[mattb]hmm thanks
00:26[mattb]ahh perfect thanks
02:08VinzentWhen I'm adding ring's middleware wrap-file, e.g. (wrap-file "public"), it throws exception unless directory public is in the project root, but I have to place this folder in the 'war' for gae
02:11VinzentI've look in the source and it looks like there is no way to specify other root directory. Is this a bug or am I missing something?
02:57VinzentI've got following exception when tried to run `lein appengine-prepare`: Exception in thread "main" java.lang.IllegalArgumentException: Wrong number of args passed to keyword: :name (actions.clj:117). The code works when I'm compiling it in emacs\slime, but throws the same exception when compiling with lein.
02:57VinzentHere is the code: http://paste.lisp.org/display/122617
02:59VinzentSo, it looks like the macro doesn't expands when it compiled with lein. Leiningen 1.5.2 on Java 1.6.0_24; appengine-magic 0.4.1; swank-clojure 1.3.1. Any ideas?
03:04hoeckVinzent: no ideas, I'd try to isolate the problem further, e.g. trying wether other macros are expanding or not expanding, or putting a println trace into the macroexpansion code
03:05hoeckVinzent: or cleaning old classes first? (but I assume lein does that already before each compile)
03:08Vinzenthoeck, cleaning does not help, let me try it with the new project...
03:09Vinzentby the way, lein compile takes more time than it should usually take, and CPU load is near 0 all the time, that's strange
03:14hoeckVinzent: compared to (what means 'usually')?
03:15Vinzenthoeck, compared to other projects approximately the same size
03:16hoeckother appaengine-magic projects?
03:18hoeckmacroexpansion/compilation happens in a full clojure environment, so macros may do blocking io, start other processes ...
03:18Vinzentmaybe... I'm not sure. Maybe it's just subjective impression
03:19VinzentYes, I've checked it, other project also compiles long
03:55Null-AI just wrote a LLVM frontend in clojure :)
04:14VinzentWell, now i've got java.io.InvalidClassException: com.google.appengine.api.datastore.dev.LocalDatastoreService$Profile; local class incompatible
04:40tsdhWhat's the proper way to set *print-length* for my tests?
04:43Vinzenttsdh, fixtures?
04:43tsdhVinzent: I don't even know what that is. Any pointer?
04:44raektsdh: do you mean in a test framework or when tring stuff at the repl?
04:45Vinzenttsdh, if you are using clojure.test - http://richhickey.github.com/clojure/clojure.test-api.html
04:45tsdhraek: Yes, clojure.test tests.
04:45tsdhVinzent: Thanks.
04:46raektsdh: why do you need to print in your test code?
04:46raektsdh: you can change the value of the var with 'set!' and 'binding'
04:47VinzentMy appengine app works with dev_appserver.sh, but after deploying on the google servers throws java.lang.NoClassDefFoundError: Could not initialize class aquatour.app_servlet
04:47tsdhraek: I don't. But I have a failing test that asserts the equality of two large maps. Since they are not equal, that'll print both on the console which is really not helpful.
04:50raektsdh: a (set! *print-length* 5) at the top of the test file might be a workaround
04:50tsdhraek: I'm just checking fixtures, which might be better here, cause I don't want to change anything just because of the test files get loaded.
04:56tsdh(use-fixtures :once (fn [f] (binding [*print-length* 5] (f)))) does the trick. Thanks, Vinzent.
04:57Vinzenttsdh, np
04:59tsdhWhen I have a seq of the form ([k v] [k v] ...), what's the best way to transform it into a map? (apply hash-map (flatten myseq))?
05:00Vinzent(into {} ([k v] [k v] ...))
05:01tsdhVinzent: Thanks
05:04VinzentI've ran `lein appengine-prepare`, then launched dev_appserver.sh and all works good, but I've got following exception after deploying it to the google servers: java.lang.NoClassDefFoundError: Could not initialize class aquatour.app_servlet. Full stacktrace can be found here: http://pastebin.com/R5bcaDPG. What the promlem might be?
05:05VinzentI've googled that such exception can be thrown when some restricted classes are in use, but I've remove all things that possibly might use IO or threads
05:11gkoHey, I have problems with log4j... I have many loggers, and sometimes, stuff that should go in file A goes in file B and vice-versa... (I use directly Java interop, not clojure wrapper)
05:31hoeckVinzent: and the war contains an aquatour/app_servlet.class ?
05:56clgvI have a recursion of a function f via an indirection of function g, like: 1 x call(f) -> 1 x call(g) -> k x call(f)
05:56clgvhow can I implement that one easily without blowing the stack?
05:56bendlasclgv: have a look at trampoline
05:56clgvI can't eliminate function g since the code would get really awkward then
05:57bendlas,(doc trampoline)
05:57clojurebot"([f] [f & args]); trampoline can be used to convert algorithms requiring mutual recursion without stack consumption. Calls f with supplied args, if any. If f returns a fn, calls that fn with no arguments, and continues to repeat, until the return value is not a fn, then returns that non-fn value. Note that if you want to return a fn as a final value, you must wrap it in some data structure and un...
05:58clgvbendlas: I thought about that but it doesnt quite work here. it seems more fitting for direct mutual tail recursion
05:59clgvohz there is an error in it. g only calls f on a finite sequence as long as f failed to do its job
06:00bendlasi don't quite understand
06:00bendlascan you explain by example?
06:00clgvI could try to do it the lazy-way to avoid the stackoverflow.
06:01clgvI have a tree I do walk and change the elements in there. clojure.walk can't be used unfortunately.
06:01bendlashave you looked at zippers?
06:02bendlasclojure.zip
06:02clgvI did, but didn't find any example that might work on my case. you know good examples for the use of zippers?
06:03Vinzenthoeck, war contains lib/aquatour.jar, which contains aquatour/app_servlet.class. Sorry for the delay, I was afk
06:03bendlasI've only seen a presentation about it, but you seem to be able to move in any direction in the tree and replace elements
06:03bendlaswhile getting the modified tree lazily afterwards
06:04clgvI am not quite sure that the code will get easier/shorter with the navigation approach in this case
06:05bendlasok, so you're doing the tree recursion yourself and try to not consume stack .. alright
06:06clgvyes. since I do not know whether the tree depth remains small enough
06:06bendlasi figure the easiest way in that case, is to build a tree of lazy seqs
06:07clgv&(doc for)
06:07sexpbot⟹ "Macro ([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost ... http://gist.github.com/1024621
06:11bsteuberI noticed http.agent has gone from the contrib standalone alpha - do you know where it went?
06:11hoeckVinzent: if lein did that, its probably ok, though I remember that putting jars inside jars was not really possible (thats why uberjar exists), but google appengine might do things differently
06:49Vinzenthoeck, there is no jars inside jars; I have only dirs/class-files in aquatour.jar (and war is just a dir too). Appengine-magic generate all this files
07:28clgv&(doc cons)
07:28sexpbot⟹ "([x seq]); Returns a new seq where x is the first element and seq is the rest."
07:29clgvis there an actual english verb for "cons"
07:29clgv?
07:29manutteriirc it's just an abbreviation for "construct"
07:30manutteras in "construct a list out of these two nodes"
07:30manutterthe closest English verb would be "prepend" I guess
07:31clgvah right. prepend sounds fine :)
07:31clgvprepend to s.th.?
07:32manutterright
07:32manutter"prepend x to seq to produce a list"
07:32manutteror whatever, haven't had my coffee yet, dimly mixing Clojure vocab with LISP vocab
07:32clgvjust found a use case for when-let with more than one binding
07:33SomelauwI decided to give setting up swank + clojure + cake + slime another go.
07:33SomelauwIs this the right place to ask questions about setting that up?
07:33manuttersure
07:33manutterbut i'm not the one who can answer them :)
07:34SomelauwOkay, well I installed cake and followed the instructions here: https://github.com/ninjudd/cake/wiki/Swank
07:34SomelauwSo I entered cake swank -r 4007 in a terminal.
07:35SomelauwAnd in emacs I entered slime-connect, I choose 127.0.0.1 and as a port I entered 4007.
07:35clgvSomelauw: I heard about a starterkit and a tutorial how to use it here several times. maybe you can search the logs of this channel for the link
07:35SomelauwEmacs said versions differ and asked me whether I wanted to contrinue.
07:36SomelauwI confirmed.
07:36SomelauwI tried entering 5 and pressing enter, but nothing happened.
07:36SomelauwI already have emacs starterkit installed.
07:36bsteuberSomelauw: so you have a repl?
07:36manutterDid you get a slime buffer with a user=> prompt?
07:37manutter(aka a repl, like bsteuber said)
07:37Somelauwyes
07:37SomelauwWell when I restart it entering 5 and pressing enter works.
07:38SomelauwAnd entering println will echo #<core$println clojure.core$println@1ea3f672>.
07:38SomelauwSo those work.
07:38SomelauwBut entering (println "hello") will make it hang.
07:39the-kennyI think I had a problem like this some months ago
07:39the-kennyCan't say what fixed it, sorry. Probably a re-installation of slime
07:39SomelauwMaybe it will hang as soon as I use parentheses?
07:39SomelauwDoes emacs have an update-slime-version-command or something?
07:40bsteuberSomelauw: are there any error messages in the *Messages* or *slime-events* buffer?
07:40manutterMight be a version mismatch -- are you using [swank-clojure "1.2.1"] or [swank-clojure "1.3.1"] in your dev-dependencies?
07:40the-kennySomelauw: Oh, I have a possible fix for this in my .emacs: (setq slime-redirect-inferior-output nil)
07:41the-kennySomelauw: Try M-S-: and enter the stuff I wrote above, then restart the slime connection
07:41SomelauwYes, messages say: Versions differ: 2010-12-02 (slime) vs. 20100404 (swank)
07:43manutterSorry, I meant the swank-clojure version -- you can safely ignore the Emacs warning about slime version vs swank version
07:43manutter(There's a trick for turning off the warning, but I forget what it is.)
07:44manutterI'm talking about the :dev-dependencies line in .cake/project.clj (step 2 of the Cake How-To at https://github.com/ninjudd/cake/wiki/Swank)
07:45Somelauwthe-kenny: It didn't work. I did it by slime-disconnect, slime-connect. I didn't restart my swank.
07:45manutterYou should be using swank-clojure "1.3.1" instead of version "1.2.1" -- the wiki is slightly out of date
07:45Somelauwmanutter: I was using 1.2.1
07:45SomelauwI was doing what the wiki said.
07:45manuttertry changing your project.clj, then pick up with step 3 of the wiki
07:45the-kennySomelauw: hm :( I'm pretty sure this line fixed this bug for me a few months ago
07:45SomelauwI will try 1.3
07:47manutterAnd just by the way, you might also be interested in jark -- http://icylisper.in/jark/start.html
07:49clgvmanutter_ what do you use jark for?
07:50manutterright now just quick one-offs
07:50SomelauwIt works for a single command and then it closes the connection Lisp connection closed unexpectedly: connection broken by remote peer
07:50manutterI actually only use leiningen/emacs for serious development
07:51manutterSomelauw: hmm, sounds like something is amiss in your setup
07:51Somelauwwhy is this program so painful?
07:51manutterwhat version of emacs are you using?
07:51Somelauwemacs 23.1.1
07:51clgvmanutter: jark sounds interesting - just read its "why?" page
07:51manutterSomelauw: you said you have some kind of starter kit installed in emacs?
07:51SomelauwExactly: GNU Emacs 23.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.22.0) of 2011-03-04 on yellow, modified by Debian [2 times]
07:53manutterclgv: I do like the basic premise of jark, and I'd like to write some local scripts that take advantage of it
07:54manutterin all honesty, though, it's just a big shiny hammer looking for a nail right now
07:54manutterfor me anyway
07:55Somelauwmanutter: yes, starterkit
07:56manutterSomelauw: I'm not sure I've heard of that one, but it makes me suspicious
07:57raekSomelauw: how did you install slime?
07:57Somelauwhttp://eschulte.github.com/emacs-starter-kit/
07:58manutterIt might be perfectly good code, but even perfectly good code can be incompatible with other perfectly good code, if you know what I mean
07:58clgvmanutter_ after reading through the page, I'd say the scripting is the most interesting part of this project :=
07:58raekSomelauw: I recommend this version: https://github.com/technomancy/emacs-starter-kit
07:59raekSlime does not do releases, so it breaks for swank-clojure quite often
07:59Somelauwraek, I don't remember exactly. I installed it a long time ago to make it work with CL.
07:59raekto me it sounds like you have a "too new" version of slime
08:00manutterclgv: Yeah, it's got some interesting possibilities.
08:00Somelauwraek: that was the version I got. I installed it by doing a checkout from git and following the instructions.
08:00raekwith the new clojure-jack-in approach, swank-clojure comes bundled with a version of Slime that works
08:01raekSomelauw: slime or emacs-starter-kit?
08:01manutterSomelauw: it looks like the starter kit is tuned more towards CL than Clojure, and that may be where the incompatibilities are coming from
08:01Somelauwraek: how to get the new clojure-jack. Is there a single script or something that fixed everythin.
08:01manuttermore towards CL/elisp, I should say
08:02raekSomelauw: it is a part of the newest clojure-mode.el which uses leiningen to start the swank server
08:02Somelauwraek: emacs-starter-kit. I don't remember how I installed slime. I think you can just do package-install slime or something.
08:02raekinstalling it from package-list-packages soudns right
08:02raekthe OS packet manager version of slime is what I know causes problems
08:02manutterSomelauw: I'm guessing all your starter-kit stuff is going to be either in your .emacs file or your .emacs.d directory
08:03manutterIf you want to experiment, you should be able to back those up somewhere safe, then nuke them and install clean/empty versions.
08:03SomelauwI don't know how I installed it. It might be the case that I installed it by aptitude. Actually I will check what aptitude says when I search for slime.
08:04raekSomelauw: re "clojure-jack-in": http://technomancy.us/149
08:04SomelauwOkay. It seems like I installed slime by aptitude.
08:04raekbut since you use cake, it might not be what you were looking for
08:06manutterjudging from the cake install wiki, I'd guess that the slime/swank stuff should be compatible with clojure-jack-in
08:06raekSomelauw: that is probably it. here's another tutorial (non clojure-jack-in and cake/lein neutral): http://dev.clojure.org/display/doc/Getting+Started+with+Emacs
08:06SomelauwI hardly know the difference. I heard cake doesn't start a new process every time. So that was the reason I choose cake over leiningen.
08:07manutterleiningen only pays the start-up penalty when you first launch swank, so in practice I haven't found it that big of a handicap
08:08SomelauwOkay, there is a lot of information. (Maybe too much). And it's hard to judge which information is out of date or not and information from different websites isn't compatible with each other.
08:08manutterThat's definitely true
08:08SomelauwMaybe I should delete anything emacs / clojure / swank related and follow one website that definitely works and is completely up to date and everything.
08:08manutter#clojure is the best answer I've found for that problem :)
08:09manutterYeah, back up your ~/.emacs and ~/.emacs.d
08:09manutterthen you can create new, empty ones and start from a clean slate
08:09manutteryou can always go back just by restoring your backups
08:09raekSomelauw: phil's recent post and the dev.clojure.org wiki are the most up to date, imho
08:12SomelauwAre they compatible with each other?
08:15manutterI'd go with Phil (technomancy) as far as swank-clojure is concerned, since he's da man, but the dev.clojure wiki should be compatible with what he says
08:15SomelauwI will first try to remove slime by aptitude and then install with package-install from within emacs first? If it doesn't work, I will folow Phil's post step by step I think.
08:16manutterI've gone back and ripped out a bunch of emacs stuff so I could follow Phil's post from scratch, and it has worked pretty well for me
08:16manutterI think I did have to hand-edit my .emacs to get the changes to stick, though
08:17manutterthat was just (add-to-list 'load-path "~/.emacs.d") (require 'clojure-mode) though
08:19raekSomelauw: the only difference from the old and new (clojure-jack-in) approach is that you don't have to install Slime anymore and that you can start the swank server and connect to it in one step
08:20raekbut how to install clojure-mode should be compatible
08:20raekthe jack-in approach doesn't really care _how_ clojure-mode is installed
08:20SomelauwI don't need slime anymore?
08:20manutterYou don't need to manually install it any more
08:21SomelauwWhat if it is already installed?
08:21raekclojure-jack-in loads it from the swank-clojure jar, which includes a fitting version
08:21raekSomelauw: that I don't know :)
08:21manutterYeah, I'd be suspicious that you might have issues if there was an incompatible version already installed
08:21manutterI think I'd do the apt-get remove slime just to be safe
08:22raekSomelauw: having the slime debian package would probably cause problems
08:23raekcurrently, this new feature seems to be bound to leiningen: https://github.com/technomancy/clojure-mode/blob/master/clojure-mode.el#L833
08:25manutterheh, saw that
08:25manutterSomelauw: I'd recommend trying leiningen instead of cake, I think it may make life easier for you
08:26manutterI think cake is for people who already know and love rake (Ruby)
08:26manutterthen again, you could be one of them, so ymmv
08:27SomelauwI am not a ruby programmer.
08:28SomelauwAnyway, when removing slime from aptitude it still isn't completely removed for some reason.
08:28SomelauwMaybe I should rename my emacs.d
08:28manutterSounds like a good idea
08:29manutteralso rename your .emacs, if there's any code in there at all
08:30raekfor me, emacs-started-kit does not load if I have a .emacs file present
08:30raekso I put personal customizations in ~/.emacs.d/<username>.el instead
08:33void_do you people use Sandbar? (https://github.com/brentonashworth/sandbar)
08:33manutterI've used it, but I'm considering a switch to Swing Security
08:34void_I would like to implement simple auth for admin interface
08:34manutterlisten do me, doh... SPRING Security
08:35void_isn't that Java lib?
08:35void_because google "spring security clojure" gives me nothing
08:35manutterhttp://static.springsource.org/spring-security/site/
08:35manutteryeah, it's a java lib
08:35manuttershouldn't be too hard to put a wrapper around it
08:35void_meh I dunno :P
08:35void_looks to java-ish
08:36manutterSomebody on this channel was saying it was dead simple
08:36void_oh
08:36manutterI think it was fogus
08:36clgvvoid_: write your own clojure wrapper ;)
08:36manutteror maybe cemerick
08:36manutterbut it was somebody whose name I recognized
08:37manutterSandbar is interesting though, and I've got it working without too much trouble
08:37void_clgv: actually I find that to be the easiest, just add header asking for http-basic-auth ... but then again, I don't feel like hacking right now, just want to see it working ;)
08:37manutterThe problem I had with it was if something goes wrong, good luck trying to trace back through all the macro-generated code to figure out where you went wrong
08:38clgvmanutter: sounds like they need more debug info on errors. maybe a task for :pre :post?
08:39clgvdo bigger projects use *assert* and :pre, :post really?
08:40manutterI couldn't say
08:40SomelauwMaybe I would appreciate a good commandline debugger for clojure like gdb or something.
08:40SomelauwAnyway that jack-in mode thing is working.
08:40manutter:D
08:41manutterI haven't dared try the command line debuggers yet
08:41SomelauwUnfortunately, I renamed my emacs.d so my starterkit is gone.
08:41manutterGeorge Jahad has some good stuff going on but I found it all a bit intimidating
08:41SomelauwMaybe I will rename my emacs.d again one day and try to merge them.
08:41SomelauwFor now I am done.
08:41manuttergoogle for cdt (clojure debugger toolkit) -- I think that's what it's called
08:42manutterbut I'm using that good old-fashioned debugger: println
08:42manutter:)
08:42SomelauwDoes clojure have some sort of (eval (user-input)) command for debugging or something, so I can print random variables?
08:42SomelauwLike a breakpoint?
08:43manutterIt's not built into the repl, but I think cdt supports that
08:43void_Somelauw: you can just say '(clojure.main/repl)'
08:44void_&#"string"
08:44sexpbot⟹ #"string"
08:44void_&"string"
08:44sexpbot⟹ "string"
08:44void_what's the # at the beginning?
08:44SomelauwIt prints user=>nil
08:45void_Somelauw: well, for me it starts repl
08:45void_wherever I call it
08:45void_very useful for debugging
08:45manuttervoid: #"foo" is a regular expression
08:45void_oh yeah
08:45void_right
08:45void_next time I'll just do this:
08:45void_&(type #"foo")
08:45sexpbot⟹ java.util.regex.Pattern
08:46void_I saw # at many places and I'm quite confused
08:46manutterThe (clojure.main/repl) command launches a new repl -- it's useful if you're running, say, a remote web server or something, but it doesn't really do much if you run it from within the repl
08:46manutterit just returns nil
08:46Somelauwvoid_, okay that works as well
08:46the-kennyFor remote stuff, starting a swank-server is very useful
08:47SomelauwBut I was already inside a repl.
08:47manutterright, I think you and void_ were talking slightly at cross-purposes
08:47void_the-kenny: swank-server is emacs integration thingie, right?
08:47the-kennyvoid_: Yes
08:48void_the-kenny: is there any way to use it from command line? (I'm not using emacs)
08:48void_but I would very much like that: Start a clojure app, and just connect to it and control it.
08:48the-kennyvoid_: Yeah, that's what swank does :) However, I'm not aware of any command line swank client.
08:49void_ha! https://github.com/astine/swank-client
08:49the-kennyheh, nice catch.
08:50void_I feel so lame for not using emacs right now :)
08:50the-kennyYou are ;-P
08:50manutterlol
08:51SomelauwI use it right now (but I don't feel comfortable using it)
08:55clgvwhat does cemerick use?
08:55cemerickEclipse + ccw
08:56clgvlol right. obviously. I feel so lame for not considering context information ;)
08:56SomelauwAlso when I want to launch the clojure repl another time. Can I just do switch to a project and do clojure-jack-in?
08:56SomelauwWell, thanks for helping me getting it to work.
08:56manutterSomelauw: you should, but on my system, I had to add a couple lines to .emacs
08:57manutterThey were real simple, though: (add-to-list 'load-path "~/.emacs.d") (require 'clojure-mode)
08:58SomelauwBut when creating a .emacs, will it ignore my .emacs.d which contains clojure-mode?
08:58clgvcemerick: I talked to you about nrepl and ccw lately but forgot that for the moment of the question... ;)
08:59cemerickI can't expect people to retain a catalog of what I use for tools.
08:59cemerickThough some might say I make it hard for them to forget… ;-)
09:01manuttercemerick: do you by any chance use Spring Security for web apps?
09:01cemerickmanutter: I do, yes.
09:01clgvcemerick: but if you do development for it, it's not too far-fetched ;)
09:02manutterwe were just talking about Sandbar, and I mentioned I thought I heard someone say they used Spring Sec for auth
09:02manutterthere's no clojure lib for it, right?
09:03cemerickNo, but I'm not sure what a clojure wrapper would bring to the party.
09:04manutterI haven't actually tried to do anything in it yet, but from my initial reading it seems like most of the config is done in XML files, right?
09:05manutterso maybe a lein plugin to map a more clojure-y syntax to the proper XML?
09:05cemerickYeah, probably 80% of the work.
09:05cemericktransliterating XML to sexprs silly IMO
09:06manutterheh, ok fair enough
09:07cemerickI mean, having that would probably make spring-security the first choice for clojure web apps (being able to choose from N authentication mechanisms out of the box is very handy), but it's cringe-worthy nonetheless.
09:07manutterSo basically you just import the jar and set up the xml file and spring security does the rest
09:07manutteras it is now, I mean
09:08manutteris that all there is to it, or am I missing something?
09:09cemerickIf you have your user information in a form it has an implementation for (e.g. a "standard" user table in a sql database), then yes.
09:09cemerickOtherwise, you need to implement one interface and refer to it in the XML.
09:09manutteryeah, that does sound pretty painless.
09:09cemerickhttp://static.springsource.org/spring-security/site/docs/3.0.x/apidocs/org/springframework/security/core/userdetails/UserDetailsService.html
09:10the-kenny<clojure>(ns foobar) (defn bla [] 42)</clojure>
09:10manutterI think I'm going to switch my app from Sandbar to spring-sec
09:10cemerickI'll probably blog about spring-security at some point. It's been pretty nice to work with, and is *very* deep feature-wise.
09:11cemerickOne of those domains where I'm happy to have some clear "templates" to follow for various options — I'm no security expert, and being able to google "openid spring-security" (or whatever) and get a step-by-step is a win for me.
09:12manutterYeah, it's nicer (and safer) to be able to use an industrial grade auth system instead of having to roll your own.
09:12raekSomelauw: if you installed clojure-mode using package-list-packages, it gets loaded automatically
09:13manutterYeah, I installed clojure-mode manually, that's why I had to manually edit my .emacs
09:14raekSomelauw: and yes, having a .emacs will cause emacs-starter-kit to not load, so put that stuff in .emacs.d/<your user id>.el instead
09:17clgvfor a tree consisting of maps is there any "diff-tool", e.g. (diff map1 map2) ;=> {[:foo :bar] {10 20}, [:alpha] {0.5 0.1}} or something similar
09:19manutternot that I know of, but I just got a great idea for a question for 4clojure.org...
09:19hoeckclgv: that is an active research topic :)
09:20hoeckI found some promising papers, but had no time implementing them so far
09:21hoeckone of them http://portal.acm.org/citation.cfm?id=1600197&amp;dl=ACM&amp;coll=DL&amp;CFID=27504367&amp;CFTOKEN=97907319
09:21clgvhoeck: ah well. "research" almost sounds too much in this case. I would just need a literal comparison ;)
09:22manutterYou mean something analogous to the way "intersection" works on sets?
09:22hoeckclgv: a naive approach then would be to 'diff' a flattened tree or 'diff' the same notes
09:22raekwasn't there a clojure test framework that shows the diff if an assertion fails?
09:23chouseryeah, lazy-test does that
09:23clgvhoeck: yeah a naive approach is desired. I don't care about possbile reordering in collections that have no order constraints or anything more advanced ;)
09:23clojurebotYou don't have to tell me twice.
09:23clgvclojurebot: I did not talk to you! :P
09:23clojurebotTitim gan éirí ort.
09:24manutterwe need a botsmack to go along with botsnack
09:30clgvhmm trying to find the diff-code in lazytest... but it's not that easy.
09:30raekclgv: https://github.com/clojure/clojure/blob/master/src/clj/clojure/data.clj#L104
09:30raekreport.clj uses that one
09:30clgv:added "1.3" is a little problem ;)
09:32clgvbut I can copy the whole thing for noew.
09:32raekhrm. does lazy-test work with clojure 1.2?
09:32clgvI don't know.
09:34Somelauwraek: I installed clojure-mode this time by cloning the git like the website said.
09:38SomelauwI will try to get it work with starterkit another time.
09:38clgvclojure.data/diff seems promising :)
09:40SomelauwI think I have been logged in for 2 hours now.
09:42clgvI like it :)
09:42manutter,(doc clojure.data/diff)
09:42clojurebotGabh mo leithscéal?
09:43clgvmanutter: it is clojure 1.3
09:43manutterAh, that explains why the docs are in Gaelic :)
09:46clgvmanutter: I simply copy&pasted it for now ;)
09:49clgvexcept one could specialize it for the only-map case to have a shorter output. it's quite verbose atm ;)
09:49void_in compojure, is there any way of getting request URI other than this: (GET "/" [request] (println request))
09:49void_I need request URI in my layout, and I don't want to pass it to layout from each function that handles request
09:59manuttervoid_: I think there's something useful in the compojure wiki on destructuring
09:59manutterI remember seeing an example for how to get the uri, but I don't remember the code off the top of my head
10:02edoloughlinvoid_: (GET "/" {uri :uri} (println uri)) ; should do it - you're destructuring on the request map itself
10:03void_I know, the thing is I don't want to do that all the time
10:03void_I'm looking for something like global request object?
10:03void_I think I'll have to create a middle ware
10:04edoloughlinvoid_: probably.
10:04gfrlogvoid_: you're trying to get the ring request object in a compojure route?
10:06gfrlogvoid_: nevermind I might not have much to add
10:10void_do you usually write a middleware for layout?
10:17gfrlogvoid_: One time I handled it with a view macro. So all my views started with (defview ...)
10:18ilyak,(flatten #{1 3 7 9})
10:18clojurebot()
10:18ilyakWhy?
10:18clojurebotwhy not?
10:18ilyakBecause
10:18gfrlog,(doc flatten)
10:18clojurebot"([x]); Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat sequence. (flatten nil) returns nil."
10:18gfrlog,(sequential? #{1 3 7 9})
10:18clojurebotfalse
10:19gfrlogundefined behavior I guess
10:19ilyak,(doc sequential?)
10:19clojurebot"([coll]); Returns true if coll implements Sequential"
10:19gfrlogapparently flatten is only meant for sequential things
10:19ilyakDoesn't make sense, to be fair
10:19gfrlog,(flatten (seq #{1 3 7 9}))
10:19clojurebot(1 3 7 9)
10:19ilyakAs Orwell said
10:19ilyak\
10:20ilyak"I understand how but I don't understand why"
10:20ilyakor whatever
10:20ilyakOkay, I'll map seq it for sure
10:20gfrlog:) I don't understand it either, but I suspect there's a reasonable reason
10:20gfrlog,(flatten "what about strings?")
10:20clojurebot()
10:21ilyakflatten should be (fn [arg] (flatten (map seq arg)))
10:22ilyak(dump-to #{} '(1 2 3) [4 5 [6 [7 8]]] #{1 3 7 9}) -> #{1 2 3 4 5 6 7 8 9}
10:22ilyakmy victory weapon
10:23ilyakIt's kind of map plus flatten plus into merged into a glob of happiness
10:24gfrlogoh dear
10:24ilyakKind of "I love perl"
10:25gfrlog:)
10:25ilyak"I can write perl in clojure"
10:25gfrlogwhat do you get for (dump-to "" (range 20))?
10:25ilyakJK
10:25ilyak#<CompilerException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IPersistentCollection (NO_SOURCE_FILE:0)>
10:25ilyakBut it's a cool idea
10:26ilyakdefinitely need to evaluate
10:26gfrlogwhat the heck do you got going on? nested sets?
10:29ilyakHave a function returning a list of of x-es each containing a set of y-s
10:30gfrlogif I were writing flatten I would say it's unclear what you want in that case
10:30ilyakBut now I see that dump-to can replace a lot of code
10:30gfrlogsince (reduce merge ...) would give you something different from (flatten (map seq ...))
10:31ilyak,(merge #{1 2 #{3 4}})
10:31clojurebot#{1 2 #{3 4}}
10:31ilyak,(flatten #{1 2 #{3 4}})
10:31clojurebot()
10:31ilyaksigh
10:31ilyakI really want this to work
10:32ilyakMy dump-to fails too :(
10:33ilyakI like blanket operations like dump-to because they are declarative in the essense
10:33ilyakYou start to think in the terms "I want `foo'" instead of "I need to do krible, krable, bumble to produce `foo'"
10:39manutter,(doc clojure.walk/walk)
10:39clojurebot"([inner outer form]); Traverses form, an arbitrary data structure. inner and outer are functions. Applies inner to each element of form, building up a data structure of the same type, then applies outer to the result. Recognizes all Clojure data structures except sorted-map-by. Consumes seqs as with doall."
10:41manutter,(clojure.walk/walk seq flatten '(1 2 3) [4 5 [6 [7 8]]] #{1 3 7 9}) )
10:41clojurebotjava.lang.IllegalArgumentException: Wrong number of args (5) passed to: walk$walk
10:41manutterah, cut-n-paste
10:42manutter,(clojure.walk/walk seq flatten '((1 2 3) [4 5 [6 [7 8]]] #{1 3 7 9}))
10:42clojurebot(1 2 3 4 5 6 7 8 1 3 ...)
10:42manutterilyak: ^^^
10:43clgvmanutter: not bad ;)
10:44clgvfinally another example of clojure.walk except from prewalk/postwalk
10:45clgv,(clojure.walk/walk seq flatten #{1 2 3} [4 5 [6 [7 8]]] #{1 3 7 9}) )
10:45clojurebotjava.lang.IllegalArgumentException: Wrong number of args (5) passed to: walk$walk
10:45clgvah k lol
10:45manutterclgv: that's three separate forms, wrap it in a list
10:45manutterI did the same thing :)
10:45clgv,(clojure.walk/walk seq flatten '(#{1 2 3} [4 5 [6 [7 8]]] #{1 3 7 9})) )
10:45clojurebot(1 2 3 4 5 6 7 8 1 3 ...)
10:46joly,(clojure.walk/walk seq flatten '((1 2 3) #{1 3 5 #{7 9}}))
10:46clojurebot(1 2 3 1 3 5 #{7 9})
10:47manutterdoh, walk does not consider a set of sets to be a nested data structure
10:47joly:(
10:48offby1:( indeed
10:49offby1Maybe it's afraid that it'll encounter the set of all sets that do not contain themselves.
10:49manutter,(seq #{1 2 3 #{4 5}})
10:49clojurebot(1 2 3 #{4 5})
10:50manutter,(seq (seq #{1 2 3 #{4 5}}))
10:50clojurebot(1 2 3 #{4 5})
10:58clgvoffby1: roflmao!
10:59clgvoffby1: write that ones definition down in clojure ;)
11:00stuartsierra,(into #{} (flatten '((1 2 3) irc://irc.freenode.net/#%7B1 3 5 irc://irc.freenode.net/#%7B7 9}}))
11:00clojurebotUnmatched delimiter: }
11:01chouserwhoa, what?
11:01manutterI think that was an irc client cut-n-paste glitch?
11:02offby1I blame stuartsierra's cat.
11:02stuartsierra,(flatten #{1 3 5 #{7 9}})
11:02clojurebot()
11:02stuartsierraflatten doesn't understand seqs.
11:02stuartsierraI mean sets.
11:03manutter,(sequence? #{1 2 3})
11:03clojurebotjava.lang.Exception: Unable to resolve symbol: sequence? in this context
11:03manutterdoh
11:03stuartsierra,(sequential? #{ 1 2 3})
11:03clojurebotfalse
11:03manutterI knew that...
11:04offby1that makes sense; sets are unordered, but flatten returns an ordered sequence, right?
11:04stuartsierraTry this: (defn flattener [x] (filter (complement coll?) (rest (tree-seq coll? seq x))))
11:04ilyakWhat's the cleanest way to figure out whether something is a collection in clojure?
11:05stuartsierra(flattener '(((1 2 3) #{1 3 5 #{7 9}})))
11:05stuartsierra;;=> (1 2 3 1 3 5 7 9)
11:05ilyakstuartsierra: It should accept [&x] not [x]
11:05stuartsierraI just copied `flatten` and replaced `sequential?` with `coll?`.
11:06stuartsierraanyway, have fun, see y'all later
11:08clgv'-> is a macro pipe. is there something similar as a function?
11:08jolyinteresting, works with maps too
11:10the-kennyclgv: comp?
11:10manutterclgv: I think it has to be a macro, because -> re-writes the form
11:11the-kenny,((comp :foo :bar) {:bar {:foo 42}})
11:11clojurebot42
11:11clgvI hate it that I cant put an anonymous fn in ->
11:12clgvmaybe I have to patch it^^
11:12clgvor use additional paranthesis
11:14clgvI wanted to thread the initial value param into a reduce
11:14clgvI guess I write a wrapper function for it, since I'll use it two times
11:15ilyak=> (dump-to #{} 1 '(2 3) [4 5 [6 [7 8]]] #{1 3 #{7 9}})
11:15ilyak#{1 2 3 4 5 6 7 8 9}
11:15ilyakThat's my weapon of victory
11:16ilyakNo need to flatten, no need to concat
11:16ilyakI'm thinking of adding identity filter
11:16ilyakso no need to (filter identity) ever too
11:16clgvilyak: swiss army knife? ;)
11:18ilyak(dump-to #{} 1 '(2 3) [4 5 [6 nil [7 8]]] #{1 3 #{7 9}}) => #{1 2 3 4 5 6 7 8 9}
11:18ilyakclgv: "I like perl"
11:21clgvilyak: but when exactly do you need to throw away all structure?
11:22ilyakclgv: For example, when I have a function x -> y and a sequence of x's
11:22clgvI had only the other problem that flatten was throwing away too much structure since I only wanted "to flatten one level"
11:22ilyak(dump-to #{} (map x->y xs))
11:23clgvilyak: I don't get it
11:23dnolen,(apply concat [[1] [2] [3] [4 [5]])
11:23clojurebotUnmatched delimiter: )
11:23clgvis you function building structure you don't want?
11:23dnolen,(apply concat [[1] [2] [3] [4 [5]]])
11:23clojurebot(1 2 3 4 [5])
11:24clgvdnolen: did that as solution to it but with reduce as far as I remember. ;)
11:28ilyakclgv: No, but every operation adds one layer of collections
11:28ilyaksince I don't have monads
11:28ilyakTherefore I have to flatten it earlier or later
11:29clgvyou know mapcat?
11:32ilyakYeah, perhaps mapcat will do
11:32ilyakPerhaps not when I have two such collections
11:33ilyakI'll have to do concat mapcat
11:33clgvI think your functions are somehow implemented strangely when you don't get the structure you need in every step
11:34ilyak=> (dump-to #{} 1 '(2 3) [4 5 [6 nil [7 8]]] #{1 3 #{7 9}} (Collections/singleton 10))
11:34ilyak#{1 2 3 4 5 6 7 8 9 10}
11:34ilyakeven
11:35ilyakclgv: They're just a -> b
11:36ilyakand I need [a] -> [b] most often, or [[a]] -> [b]
11:37raek,(for [x (range 10), :when (odd? x), :let [y (* x x)]] (+ x y)) ; for can also be an alternative to mapcat if you only use it to skip some elements
11:37clojurebot(2 12 30 56 90)
11:37ilyakI know
11:37ilyakPerhaps it is
11:38ilyakI'm just trying to create a wide abstraction to forget about some narrow tools
11:38CozeyHelp! Jesus. I've spend hours trying to run a compojure app under ring with jetty, and now jetty whines about not SessionManager. anybody here know something about it ?
11:41raekCozey: are you using the latest versions of both?
11:42CozeyCompojure 0.6.3 - is still using jetty6 - so not the newset
11:43Cozeyalso, Compojure does not use HttpRequest.getSession(), since it normally uses it's own session mechanism (ring sessions)
11:43raekCozey: if you look in the lib/ directory, do you have mixed versions of ring artifacts?
11:43Cozeybut I have a scenario where I use 3rd party code in java (implementing servlet Filter) and it wants to do a plain old getSession
11:43clgvilyak: but just as an remark: for me it sounds a bit unhealthy to build unspecified datablobs and then flatten them completely and hope that the right values fall out
11:44Cozeynope; ring 0.3.8 all the way jetty 6.1.26, compojure 0.6.3
11:44CozeyI googled and it seems session configuration needs some kind of jetty 'WebContext', but I think ring jetty adapter completely bypasses this mechanism
11:47Cozeybasically jetty adapter uses first scenario http://docs.codehaus.org/display/JETTY/Embedding+Jetty
11:48Cozeybut then there is http://docs.codehaus.org/display/JETTY/SessionIds
11:48Cozeysome xml session configuration for jetty - but how to use it in ring-adapter scenario is beyond me
11:49ilyakclgv: In fact, I'm kind of imitating jquery's $()
11:49ilyakwhich sounded dangerous but in fact turned out to be awesome
11:50clgvilyak: maybe it's totally alright - I based my remark only on what I understood from your explanations ;)
12:14rmarianskiCozey: i wrote a ring jetty adapter that adds in a servlet to the request map
12:14rmarianskiCozey: https://github.com/rmarianski/ring-jetty-servlet-adapter
12:18Fossibeen there, done that... :)
12:18Fossiit's a bit hackish though that it isnt supported by ring in the first place
12:21ilyakWhat's the difference between :while and :when in (for?
12:23chouseras soon as :while is false, that loop ends
12:23chouserif :when is false, that iteration is skipped but the loop continues to the next one anyway
12:25ilyakThanks
12:26ilyakI miss :except
12:26ilyak:when (not (something val)) is not cool
12:26ilyakalso wrote my own reject as filter not
12:28chouser'remove'?
12:32ilyakchouser: Cool, thanks
12:32ilyakno need to reject
12:33ilyakflatten
12:33ilyakhas (filter (complement sequential?)
12:34ilyakI guess it should instead have (remove sequential?
12:34ilyak(defn flatten [x] (filter (complement sequential?) (rest (tree-seq sequential? seq x))))
12:35ilyakI would say one can rewrite it as (defn flatten [x] (remove sequential? (tree-seq sequential? seq x)))
13:05Cozeyok. figured it out. one needs to add a SessionHandler as well as ServletHandler (containing clojure routes) to Server
13:25redingerEarly registration has opened for Clojure Conj 2011: http://clojure-conj.org
13:26manutterdrooooooool....
13:27manutterI missed it last year
13:34amalloyredinger: sweet. sad i missed last year's
13:34redingeramalloy: Hopefully we'll see you this year!
13:35amalloyredinger: for sure. now that i'm doing clojure for work i don't have much excuse
13:37halfprogrammerIs it allowed to send functions as optional keyword parameters?
13:37halfprogrammers/allowed/ok
13:37sexpbot<halfprogrammer> Is it ok to send functions as optional keyword parameters?
13:38amalloyhalfprogrammer: i don't understand the question, but the answer is yes
13:38halfprogrammerhttps://gist.github.com/1025409
13:38halfprogrammeramalloy: Can you please look at the gist?
13:39amalloyhalfprogrammer: your recur is wrong in the first version
13:39amalloy(recur (next lst) obj :testfn testfn), i think should work
13:39amalloymyexists1 expects keyword args, and you're recurring without them
13:40halfprogrammerMismatched argument count to recur, expected: 3 args, got: 4
13:40amalloybut i've never tried recurring with varargs so let me know if it fails
13:41halfprogrammerthe code does not get compiled if I include :testfn
13:41amalloyyeah, i guess recur doesn't support varargs
13:42halfprogrammer:(
13:43amalloyhalfprogrammer: https://gist.github.com/1025420
13:43gfrlog(apply recur my-args)
13:44halfprogrammergfrlog: how do i capture capture all the variables into my-args?
13:45halfprogrammerShould I go ahead and build such a list myself?
13:45gfrloghalfprogrammer: I apologize, it was a joke :)
13:45gfrlogyou can't do that
13:45halfprogrammer:P
13:46gfrloghalfprogrammer: I think if you really want varargs w/ recur you have to change your function to take a single argument (list of args) instead
13:46gfrloghalfprogrammer: which is not too hard syntactically, thanks to destructuring
13:47amalloyhalfprogrammer: does my gist make it clear that you can pass functions?
13:47halfprogrammergfrlog: Of course that is doable and even amalloy's solution will work
13:48halfprogrammeramalloy: Your gist works thanks!
13:49halfprogrammerI really don't understand what was wrong with my my-exists1?
13:50amalloyhalfprogrammer: recur is fairly primitive, and & {...} is a new-ish language feature. they don't seem to play nice together
13:50halfprogrammeramalloy: hmm
13:53amalloyif you replaced recur with my-exists1? it would probably also work
13:53amalloybut blow the stack for large lists, of course
13:54halfprogrammerlet me check if things work ok with my-exists1? instead of recur...
13:55halfprogrammeramalloy: yup, it works fine
13:56amalloywhew. it's always a relief when my untested assertions turn out to be true
13:56halfprogrammerlol
13:57halfprogrammerIs someone looking into this 'bug'?
13:57halfprogrammerWith no support for default arguments in the language this would be irritating for recursive function.
13:58dnolenhalfprogrammer: recur is like a goto, it not a real function call (otherwise would consume the stack). the whole vararg rest thing only applies to function calls.
13:58dnolenhalfprogrammer: did you try (recur (next lst) obj [:testfn testfn]) ?
13:59halfprogrammer(recur (next lst) obj [:testfn testfn]) doesn't compile
14:01jweissisn't there a function in core, that given [1 2 3] will return [[1] [1 2] [1 2 3]]?
14:01halfprogrammerInformation about number of possible keyword parameters will be available in the compile time itself right.
14:02gfrlog$findfn [1 2 3] [[1] [1 2] [1 2 3]]
14:02sexpbot[]
14:02amalloy&(rest (reductions conj [] [1 2 3]))
14:02sexpbot⟹ ([1] [1 2] [1 2 3])
14:02jweissah reductions
14:02jweissthat is what i was trying to think of, thanks amalloy
14:03gfrlogAre there any clojure libraries for doing BDD-style testing of an html-ring-app?
14:03gfrlogbecause if not I'm about to try to make one
14:03chousergfrlog: you've looked at midje?
14:04gfrlogchouser: no sir, but if google delivers then that is about to change
14:04dnolenhalfprogrammer: (recur (next lst) obj {:testfn testfn}) works
14:04chousergoogle shall
14:04amalloydnolen: that's bizarre
14:04gfrlogchouser: thanks for the tip
14:05dnolenamalloy: why?
14:05halfprogrammerdnolen: awesome. I don't know how you came up with that!
14:06dnolenhalfprogrammer: well I looked a lot at IFn and the various tricks the compiler does to uphold to rest arg *fiction*
14:06amalloyit implies that loop is being replaced with (let ... (loop* )) rather than (loop* ... (let)), doesn't it? his loop binding-vec has an & in it
14:06halfprogrammer:P
14:06halfprogrammerlol
14:07amalloyoh, but he's not using loop, he's using the function as his recursion point directly
14:07amalloythat makes it less bizarre
14:08amalloy&(macroexpand '(loop [x 1] (recur (dec x))))
14:08sexpbot⟹ (loop* [x 1] (recur (dec x)))
14:08amalloy&(macroexpand '(loop [[x] [1]] (recur (dec x))))
14:08sexpbot⟹ (let* [G__9884 [1] vec__9885 G__9884 x (clojure.core/nth vec__9885 0 nil)] (loop* [G__9884 G__9884] (clojure.core/let [[x] G__9884] (recur (dec x)))))
14:12gfrloglooked at midje...think I'm going to try making my own thing
14:13trptcolinspeclj is another solution that's more familiar to folks coming from Ruby
14:14gfrloghmmm :-/ I'm not so much interested in the style of the tests as I am in a bunch of html assertions and manipulations
14:15gfrlogit's something I made before that felt terribly intuitive and simple
14:16jweissanyone know of a clojure test harness for functional testing? all the frameworks i've seen are unit tests only.
14:17jweissi'd like something like testng for java, but not dependent on precompiled classes with java annotations
14:18halfprogrammerAlmost midnight here @India. going to bed. see you guys l8r!
14:18gfrlogbye
14:21amalloy@india? i'm not sure that makes sense even on twitter
14:21gfrloghe could have had a friend named India that he was speaking to
14:23gfrlogor maybe he's advocating for a simpler set of english preposition usage rules
14:25dbgsterHi all, is there a particular book that stands out amonst the closure books that you would reocmmend?
14:26thearthurjoy of clojure
14:26technomancyinc
14:26thearthurand xlojure in axtion
14:26manutterdbgster: for introductory clojure I like clojure in action
14:27manutterjoy of clojure for more intermediate/advanced understanding
14:27amalloysame. unless you're new to all of: lisp, functional programming, and the jvm; then JoC may not be right
14:27thearthurhalaways book is very well written but perhaps out of date
14:27manutterLand of Lisp is kind of fun in a general what-the-heck-are-all-those-parens sort of way
14:28thearthurare there rumors of a 2nd edition
14:28gfrlogamalloy: so JOC will introduce any two of those topics but not all three? :)
14:28amalloy*halloway
14:28dbgstermanutter: i'm looking at JOC, is it a poor choice for a beginner book? it doesn't say its an interm. level?
14:28manutterClojure In Action = "clojure how", JOC = "clojure why"
14:29amalloyit was my first (and so far only) clojure book, so you can definitely do it
14:29amalloybut it aims to be deeper and spends less time on complete basics
14:29manutterI wouldn't say JOC is a poor choice for a beginner
14:29dbgsterhow's the market for clojure? does this language go hand in hand with java or you can do clojure w/o being profecient in java
14:29thearthuri say screw the 'how' and go strit for the why
14:29manutterbut personally I think Clojure in Action is a bit more beginner-oriented
14:30technomancyI was really not impressed by the sample chapters of Clojure in Action that I read
14:30dbgsteramalloy: cool, I see ok. I think i need a (((begingger))0))) book :)
14:30thearthurclojure made java accessable to me
14:30technomancyI actually ended up more confused about multimethods than when I started
14:30gfrlogthe effect of java knowledge an the ability to learn clojure sounds like a fascinating question
14:30gfrlogs/an/on
14:30sexpbot<gfrlog> the effect of java knowledge on the ability to learn clojure sounds like a fascinating question
14:30technomancymaybe it's better now; this was right around when the first drafts were appearing
14:30manutterThere's also the new Programming Clojure title on O'Reilly "Rough Cuts"
14:31technomancybut it was in dire need of editing and simple fact-checking at the time
14:31chousertechnomancy: heh, ouch.
14:31manutterum, "Clojure Programming" on O'Reilly
14:31hiredmanI think http://clojure.org/rationale and rich's videos on blip.tv are the best places to start
14:31amalloytechnomancy: that's amit's book, right?
14:31technomancyI think so
14:32hiredman~blip.tv
14:32clojurebotblip.tv is http://clojure.blip.tv/
14:32manutterdbgster: whatever book you choose, keep the #clojure channel handy and you should be ok :)
14:33chouserSo it's now: PC, PC, CP, CiA, and JoC, by Halloway, technomancy, cemerick, rathor, and fogus, respectively, right?
14:33redingerdbgster: If you want web resources, we are maintaining a list of current links here: http://clojure.com/reading.html
14:33redingerI think you mean stuartsierra, not technomancy
14:33dbgsterredinger: cool thanks.
14:33dbgsterwhat's the market like? are you guys doing clojure all day every day?
14:33amalloyi was gonna say, i didn't know technomancy had written a book
14:34technomancywell if videos qualify, there's FPwC
14:34redingerAnd don't forget Raynes book
14:34technomancywhich was technically the first commercial documentation published for Clojure
14:34cemerickchouser: s/technomancy/stuartsierra
14:34chouserah, sorry
14:34technomancyI beat halloway by like two weeks =)
14:34cemerickAnd Luke, though I don't think he's ever been in here…
14:35redingerdbgster: We do have teams doing clojure all day, every day
14:35chouserdbgster: I do Clojure all day at work, most days, and then most evenings and weekends too. :-P
14:35dbgsterchouser: no comment :)
14:35hiredmanditto
14:36chousertechnomancy: ah, perhaps that's what I was thinking of. That was very well received.
14:36dbgsteris it in demand? is there a specific industry that uses it? I remember some email company used it for spam checking etc. which I thought was intersting.
14:36hiredmanalthough, I have to admit, I have gotten fairly busy outside of work so non-work related clojure output has suffered
14:36jhickneranyone using jark? getting a weird error on OSX
14:36redingerdbgster: http://dev.clojure.org/display/community/Clojure+Success+Stories
14:37technomancychouser: it's gotten a bit dated, but not as much as you'd expect.
14:37technomancyproblem is videos are a lot harder to update than PDFs
14:37cemerickdbgster: a very partial list: http://dev.clojure.org/display/community/Clojure+Success+Stories
14:38dbgsterredinger: yeah that is how I first learnt of closure, some company was looking for clojure devs (remote telecommute work) so I looked into it first at that point :)
14:38redingerFPwC & labrepl were the main resources I used to dive in
14:38manutterjhickner: I've used jark, but not on os x. What's your error?
14:39thearthurruna and weatherbill are both looking for clojure devs right now
14:40jhicknerthe repl works fine, but when running a script I get an error
14:40jhicknerjark ➔ ./factorial.clj 10
14:40jhickner#<CompilerException java.io.FileNotFoundException: Could not locate #<CompilerException__init.class or #<CompilerException.clj on classpath: (NO_SOURCE_FILE:0)>
14:40technomancyis jark really using ocaml?
14:40cemerickThat's the plan for the launcher, last I knew.
14:40cemerickDidn't think they'd gotten that far yet…
14:40technomancyoh, it's still roadmap territory
14:40technomancystill, mad respect.
14:41manutterjhickner: that is an odd one, sounds like a bug in jark
14:42manutterhmm, though on second thought, how are you invoking the script?
14:42jhickner#!/usr/bin/env jark at the top of the script
14:43jhicknerthen ./factorial.clj 10
14:43manutternailgun server started via jark vm start?
14:43jhickneryes
14:44dbgstermanutter: wait, the CIA book isn't even released yet
14:44cemerickdbgster: wha? It's been in print almost a year IIRC?
14:44manutterdbgster: you can get it electronically thru the early access program
14:44manutterNo, it's been available in MEAP for about that long but it's not officially released yet
14:45cemerickoh, sorry, sorry, was thinking of Practical Clojure.
14:45redingerI wonder what cemerick's been reading all this time
14:45dbgsteryeah I'm on amazon at it says june 28th
14:46manutterGo to Manning Publications you can get in on the Early Access Program (MEAP) if you want it right away
14:46manutterthough at this point that, what, 2 more weeks?
14:46cemerickredinger: at the moment, Automata Theory by Hopcraft and Ullman.
14:46redingerwoah
14:47cemerickand The Futurological Congress on the fiction side, tho I just started that last night
14:47manutterI forget what I'm reading now. I got as far as "Footnote 1: see Footnote 1" and haven't been able to get any farther.
14:48technomancydid you know if you click on "did you mean: recursion" at http://www.google.com/search?q=recursion enough times, it gives you a stack overflow?
14:48manutterjhickner: everything looks right to me, I'm not sure what's going on with your jark setup
14:48cemerickI fantasize about book blogging more often, but other things get in my way…
14:49jhicknerok, thanks. I'll post it on the mailing list and see what happens
14:49dbgstercemerick: is fantasize the best word to describe it? :)
14:49chousertechnomancy: if that statement was a prank, I'm totally falling for it.
14:49redingertechnomancy, chouser yeah, I'm thinking he's going to get me with the definition of gullible next
14:49cemerickdbgster: I'm guess I'm weird? :-P
14:50dbgsteri dream of writing a book, and selling it via pdf :)
14:50technomancychouser: totally not true! sorry.
14:50technomancyerr--that is to say, if you don't get a stack overflow, it means you're running a browser compiled with --enable-tco! congratulations.
14:52hiredmantechnomancy codes upsidedown wearing moonboots to keep blood flowing to his face, which he needs due to skin graft he got to go into hiding after writing a build system
14:52stuartsierrawow
14:53hiredmannow you see why the keyboard pants are a must have
14:53stuartsierratotally
14:53technomancyhey--that was ... I mean ... the grafts are healing.
14:55amalloytechnomancy: yeah, surprisingly credible prank. i was sorely tempted to try it
14:59gfrlogare there any libraries for writing clojure code while holding a baby?
14:59TimMcThere's an email thread going on here at work about whether to use Clojure for some DSL-ish stuff in our Java codebase...
14:59TimMcCross your fingers!
14:59stuartsierragfrlog: I expect you want GOO.
15:01redingerM-x newborn-clojure-mode in emacs
15:02gfrlogsomebody make me a vim plugin
15:02stuartsierragfrlog: I always read your nickname as "girl frog." Don't know why.
15:03Raynesredinger: Aw, you remembered me. <3
15:03gfrlogstuartsierra: that's the nicest thing anyone's ever said to me
15:03stuartsierraI'm sorry to hear that.
15:04gfrlog:}
15:04gfrlogI always assumed the most common misreading would be grr-flog
15:05TimMcgiffer-log
15:05raekgopher-log
15:05gfrlogI prefer to mash as many consonants together as I can manage
15:06stuartsierraNo wonder you like vim.
15:06RaynesOooh, burn.
15:06gfrlogwhat emacs does it too you just gotta hold down command-alt-meta to make it work
15:07stuartsierraTrue. That's why Emacsers are usually frustrated amateur musicians.
15:07gfrlogif I had an extra finger that hovered over my command-alt-meta key, maybe I'd consider that a feasible solution
15:09trptcolinsomeone should hook up electronic piano pedals as command/alt/meta
15:09stuartsierra'been done
15:09amalloytrptcolin: it's been done
15:09stuartsierraI've even considered buying the foot pedals for it.
15:10trptcolinlol @emacs
15:11TimMcamalloy: Shouldn't be hard to make an auxiliary "keyboard" for USB with M^ and C^ foot pedals.
15:11gfrlogI only use photoshop for coding
15:11manutter"Just hold down Control-Shift-Sustain while typing the 9 key..."
15:11stuartsierrahttp://www.kinesis-ergo.com/fs-savant-elite.htm
15:12TimMcBeautiful.
15:13TimMcHaha, they support macros.
15:13gfrlogoh he's lying down with the pacifier. Now I have a split moment to type out all the code I've been imagining for the last half hour
15:13TimMcgfrlog: Pair program with the kiddo.
15:13stuartsierraTimMc: of COURSE they support macros!
15:14technomancygfrlog: it's amazing how that kind of situation lets you focus
15:14gfrlogtechnomancy: focus during or between holdings?
15:14technomancygfrlog: the "hey, I've actually got a moment" feeling
15:15gfrlogah yes
15:15gfrlogoh I think it might be over now
15:15technomancywell I hope you got some awesome code out
15:15gfrlogno I chatted on #clojure instead
15:15TimMcToo busy chatting, no code.
15:17gfrlogTimMc: he suggested pair programming as well, but I said "No pairing until you can hold your head up on your own."
15:18TimMcHave him work the modifier keys.
15:19gfrlogthat's a good compromise
15:19technomancygfrlog: http://www.flickr.com/photos/technomancy/2231407627/
15:20gfrlogtechnomancy: very nice
15:21justinkotechnomancy: by the time he's 10, instead of mowing your lawn he can write all your code :)
15:26gfrlogplan B: pace around room while watching math lectures on youtube
15:28bdeshamis there a function like dotimes which will iterate through a set instead of a list of integers?
15:29technomancybdesham: doseq
15:29bdeshamtechnomancy: thanks
15:34jweissdoes the pprint lib know when you pass it source code? or do you have to tell it somehow
15:34jweissfor me it prints too much on one line
15:34stuartsierraI don't think it knows how to format Clojure source code.
15:35hiredmanit has a code formatter, dunno if it is any better
15:36hiredmanwhat always bugs me is it derefs vars, otherwise I would replace prn in the repl with pprint in a second
15:36jweissstuartsierra: from http://richhickey.github.com/clojure/clojure.pprint-api.html "Out of the box, pprint supports a simple structured format for basic data
15:36jweissand a specialized format for Clojure source code."
15:36stuartsierraoh
15:36jweissjust doesn't say how to use it
15:37hiredmanyou bind some dingus to something
15:37stuartsierrahiredman: Can I quote you on that?
15:37hiredmanplease do
15:38jweisshiredman: any idea how to get it to format code? i don't know how it could tell otherwise whether it's a regular list or actual code
15:39hiredmanI believe you bind http://clojure.github.com/clojure/clojure.pprint-api.html#clojure.pprint/*print-pprint-dispatch* to http://clojure.github.com/clojure/clojure.pprint-api.html#clojure.pprint/code-dispatch
15:41jweisshiredman: will try, thx
15:42jweissmeh, looks the same
15:42hiredmanright, I don't believe it comes out much different
15:47jweissyou'd think that it could at least put each expression within a (fn [] ...) or (defn [] ...) on a newline
15:48dnolenjweiss: it comes out well enough for macroexpansion, but certainly not something I would rely on for producing well formatted code.
15:49dnolenprior to pprint it was impossible to debug large macros.
15:49jweissdnolen: is there another lib that formats it a bit better? (besides emacs) :)
15:50dnolenjweiss: not that I'm aware of, pprint works well enough for it's intended use. there may be more knobs in there I haven't looked at pprint too closely. it does support most of cl-format so you can probably bend it to your will with some effort.
15:51jweissdnolen: ok thanks
15:53cemerickholy crud, people actually attempt to install Clojure via apt/rpm? 0_0
15:54jweisscemerick: linux people don't like jars :)
15:54jweissor maven
15:55jweissand i don't blame them
15:58cemerickjweiss: in any case, trying to stuff a peg into a square hole isn't doing anyone any good
15:59jweisscemerick: well, i'm not sure about that. if I wanted to see what clojure is all about on my fedora system, i would first do "sudo yum install clojure" and play around w the repl.
15:59jweissunfortunately the rest of the clojure infrastructure would happily ignore my installation and download it again from maven
16:00jweissbut at least people can check out clojure somewhat with their native package manager
16:00cemerickAt that level, any of the web-based REPLs would be a better sandbox.
16:01jweisscemerick: in some cases, i guess. you can't read files or do anything with local resources that way
16:01jweisssome would argue that that it's maven and java trying to stuff a round peg in a square hole but i guess that is all semantics
16:02cemerickWhich is correct depends on whether you care more about the package manager or whatever else you're doing.
16:02cemerickrpm/apt maintainers have made hashes of ruby and python languages and libraries as well, so this isn't without precedent.
16:03gfrlogThere's not a shortcut for (:require [a.b [foo :as foo] [bar :as bar] [baz :az baz]]) is there?
16:07jweisscemerick: i am not exactly sure what it is about python and ruby that rpms work for them, but not java or clojure.
16:08cemerickjweiss: They don't, AFAIK; thus easy_install & pip & rvm & …
16:09jweisscemerick: they do, i'm working on a ROR project now that uses rpms for its deps
16:10dnolenjweiss: is that a common approach in the ROR world ?
16:10jweissno ^
16:11dnolenjweiss: my impression so far is that accepted python and ruby dependency management is the PITS
16:11jweissdnolen: you mean the built in ones? pip, rubygems?
16:11dnolenjweiss: yes
16:12jweissyeah i've seen rubygems do some annoying stuff
16:12gfrlogbundler pretty good
16:12dnolengfrlog: we use that and I think it's pretty lame for the most part.
16:12gfrlogbundler pretty lame
16:13cemerickgfrlog: sycophant ;-)
16:14dnolenbut perhaps it's the interaction between gems + ROR + bundler that troubles me.
16:14gfrlogruby is 95% black magic
16:17dnolenoh add rvm to that list.
16:18gfrlogrvm: because as a rails dev you don't otherwise do enough bash-hacking
16:20pjstadigpeople like to bash gems, but dependency management is hard...let's go shopping
16:21gfrlogit is hard. But I always thought rubygems were weird in contrast with java, by installing things at the system level
16:21gfrloghalf the point of RVM is to make it stop doing that :)
16:21pjstadigi'm just saying people like to complain about <INSERT DEPENDENCY MANAGER HERE>
16:22gfrlogpjstadig: what kind of shopping?
16:22pjstadigguns?
16:22pjstadigno too violent
16:22pjstadigpillows
16:23gfrlogthen we'll create a dependency management system based on a violent metaphor?
16:23pjstadighttps://github.com/technomancy/roast-beef
16:24gfrlogI learn something new most of the times
16:28pjstadigi like to dig deep into the technomancy archives
16:28bdeshampjstadig: I assumed that was for clojure for a second and got confused
16:28pjstadigthere's also http://rubyforge.org/users/technomancy/
16:28gfrlognaw then it would have been called roast-beefjure
16:29pjstadiggfrlog: more likely a character from literature
16:29gfrlogis that a clojure-specific trend?
16:30pjstadigjust a more recent technomancy trend i think
16:30amalloypjstadig: roast beef is a character in achewood
16:30pjstadigamalloy: true
16:30redingerWhich is a far cry from literature
16:31pjstadighehe
16:31amalloyhe even mentions that in the readme
16:31amalloyso i speculate that this is not a new or clojure-only trend
16:31gfrlogI'm going to elect that project president
16:31technomancyif you don't think achewood is literature you haven't read the supplementary material in "A Home for Scared People"
16:32technomancynor the Great Outdoor Fight
16:34technomancyjweiss: I gave up on pretty-printing code from clojure; it's much, much easier to do from elisp
16:34technomancybecause you can treat it as a string and as a data structure at the same time
16:35jweisstechnomancy: that's kind of ironic that clojure isn't as good at printing itself out as elisp
16:35jweissunfortunately i won't have emacs available where i want to print this stuff out
16:35jweissi'll be running my code via command line
16:35technomancyreplaca may have further comment
16:35amalloywhy is that ironic? clojure is a compiled language, and elisp is a language for writing a text editor in
16:36technomancyalso: you can totally run elisp in a batch context
16:36technomancywe do it at work for a pre-commit hook
16:36jweisstechnomancy: actually that may be something i might want to try
16:36hiredman"we"
16:37jweissi could also use htmlize to make pretty html logs
16:37technomancyhtmlize is the cats
16:37jweiss"the cats"? is that good? :)
16:37technomancyI ... I'm not sure. I think so.
16:38amalloyheh. so ironic, because it's old slang
16:38jweissah, then i'm not up on all the lingo the old farts used either
16:38amalloyhttp://en.wiktionary.org/wiki/cat%27s_pyjamas
16:39technomancyhttp://facepwn.com/posters/cats-allyourbase.jpg
16:45jweisshm, trying to get emacs to render my clojure snippet in clojure-mode and the htmlifying it and sending it to stdout might be beyond my elisp abilities, but worth a shot
16:46technomancyit'd be a lot easier to write to a file than stdout
16:46jweissok that too
16:48cemerickIs this all to get Clojure syntax highlighting in html?
16:49jweisscemerick: well sorta, i have automated tests in clojure, and i'd like to use technomancy's serializable-fn to save the source of what it's executing. my aim here is to have automated tests BE the written procedure - not have code and separate english steps to execute the tests
16:50cemerickGotcha; thought maybe you were just looking to post something pretty on a blog or something.
16:50cemerickBut I can see you wanting to have more control over presentation than e.g. syntaxhighlighter would provide.
16:50jweisscemerick: no, i've used htmlify to do that already
16:51gfrlogwhy is the compiler unable to resolve pprint in this context? :(
16:52hiredmancause you did you experimenting at the repl
16:52hiredmanwhich auto 'uses pprint these days
16:52gfrlogoh ah ha
16:53gfrlogthx
16:54dbgsteris peepcode's clojure screencast worthy?
16:59cemericktechnomancy: I just noticed that incanter switched to lein, big win. :-) Is that the largest OSS project you know of using lein?
17:00manutterdbgster: it was when I watched it, haven't looked at it lately
17:01dbgstermanutter: cool, I think I need some visual help to get up and running. thanks
17:01technomancycemerick: I think it's the largest, yeah.
17:02technomancyI wonder how the multi-module stuff is working out for them
17:08redingerdbgster: He also released a blog post with some updates since the peepcode: http://technomancy.us/136
17:10dbgsterredinger: yes saw that thanks.
17:10gfrloggiven a black-box ring-app-function, is calling it and mocking a multipart-browser-file-upload hard?
17:22thearthuranyone here using nailgun?
17:24Raynescemerick: I'm guessing you haven't got around to that survey yet.
17:27cemerickRaynes: :-( Tomorrow, I promise.
17:28Raynescemerick: I'll hold you to it this time. ;)
17:28cemerickRaynes is a slavedriver. :-P
17:36amalloyclojurebot: Raynes?
17:36clojurebotif it's not one thing it's another
17:41lonsteinthis might be obscure, anyone using cdt w/slime+emacs on osx and worked around the lack of tools.jar? it's not present under the Apple 1.6.0 or the OpenJDK 1.7.0.
17:42lonsteingoogle is not helpful other than to show that others hit this
17:45amalloylonstein: install a jdk instead of a jre?
17:46lonsteinthat's the first thing I checked :)
17:49brehautlonstein: if it exists in the default install, its not easy to find
17:52sdeobaldDoes anyone know of a way to get an interesting list of callers / stacktrace in clojure?
17:52brehaut(use 'clojure.stacktrace)
17:52sdeobald(.getStackTrace (Thread/currentThread)) returns a lot of ...ah.
17:52hugodlonstein: you shouldn't need tools.jar on osx
17:52sdeobaldbrehaut, Cheers.
17:52RaynesI just look very, very closely.
17:52brehautsdeobald: the function 'e' is useful
17:54lonsteinin this regard osx is a bit odd. it's not needed according to apple and not present even as a stub jar
17:54sdeobaldbrehaut: That is useful. Though I'm looking for exception-less debugging.
17:55sdeobald(map #(.getMethodName %) (-> (Thread/currentThread) .getStackTrace)) ;; I was expecting this to give me a useful call stack but no dice.
17:57amalloysdeobald: i think you need to .fillInStackTrace or something
17:57amalloybecause that's an expensive operation
17:58amalloybut i'm probably very wrong about several parts of that suggestion
17:59sdeobaldamalloy: Heh. :) I'll check it out. Thanks.
18:25sdeobaldbrehaut / amalloy: I wound up with this, if you're interested. https://gist.github.com/1026083
18:25sdeobaldI'm sure there's something smarter out there but it does the job.
18:26amalloysdeobald: the doall is a noop there
19:10TimMcHey, Clojure Conj registration is open!
20:02justinkoin the clojure repl, how do you access "history"? normally, this achieved by using the arrow keys
20:03technomancythe built-in clojure repl is not what you would call usable
20:03justinkoI'm finding that out
20:03justinkowhat do u recommend?
20:03technomancyyou can use it with rlwrap, but it's more common to use a tool like leiningen
20:05justinkooh perfect, "lein repl" is what I needed, thanks
20:05justinkodidn't realize you can use it standalone
20:11technomancyit's new-ish I guess
20:15dbgsterwhen in console, is it possible to fix a line?
20:15dbgsteri.e. if I miss a bracket, can I fix it or I have to start all over?
20:15amalloyif you use the raw, lowest-level repl, like java -jar clojure.jar, then no
20:15amalloybut if you're doing that you should stop
20:16dbgsteramalloy: I did homebrew install clojure, then I run: clj
20:17dbgsterwhat should I be doing then?
20:17dbgsterother than saving to a file
20:17hiredmanuse lein
20:17hiredmanclojurebot: lein
20:17clojurebotlein is http://github.com/technomancy/leiningen
20:17amalloythrow away the homebrew install
20:17hiredman^-
20:19amalloythough i'm surprised that clj doesn't at least include jline or rlwrap
20:19dbgsteramalloy: y? lein can't work side by side?
20:20amalloyprobably. so? lein works side by side with pascal, but you should use lein to run your clojure
20:23dbgsteramalloy: ok i'll read up on it, i'm basically just reading a clojure book and hacking along in repl
20:23raekdbgster: Clojure is a bit unconventional if you compare it to Python or Ruby. The clj launcher script variants are not very useful for more that a Hello world program.
20:24raekAs of now, Clojure does not have any official launcher script.
20:24brehauti use cljr for my messing about repl
20:25dnolenbrehaut: cljr is cool, but yucky on OS X
20:25dbgsteramalloy: lien seems to be a generator, setup up project files etc. and then it helps loading into rehl also right?
20:25technomancyjark is another standalone repl tool
20:27dbgsteris there a strong similiarity between clojure and erlang? i.e. knowing one compliments the other
20:27raekboth are functional, I guess
20:27hiredmannot particularly
20:28dbgsterthis stuff is very cool so far, its opening up parts of my brain I've never used in programming :)
20:28raekdbgster: erlang has more focus on inter-process concurrency and clojure on in-process concurrency
20:28justinkoshouldn't this work?
20:28justinko(re-groups (re-matcher #"[a-z]+" "foo"))
20:28justinkojava.lang.IllegalStateException: No match found (NO_SOURCE_FILE:0)
20:29raek,(re-find #"[a-z]+" "foo")
20:29clojurebot"foo"
20:30raekjustinko: I think you need to send the matcher to re-find (or simply send the regex directly to re-find)
20:30raekjustinko: also, re-find sends its internal result though re-groups before it returns it
20:31dbgsteri'd hate to see clojure interview questions!
20:31justinkoraek: the docs say re-groups takes a "matcher" single argument
20:31raekre-find and re-seq are the only re- functions I use
20:33justinkoraek: I'm just trying to make re-groups work - playing around
20:33raek,(re-groups (re-find (re-matcher #"([a-z])([a-z]+)" "foo")))
20:33clojurebotjava.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.regex.Matcher
20:34raek,(re-groups (.find (re-matcher #"([a-z])([a-z]+)" "foo")))
20:34clojurebotjava.lang.ClassCastException: java.lang.Boolean cannot be cast to java.util.regex.Matcher
20:34amalloydbgster: why would you hate to see clojure interview questions?
20:35justinko,(re-groups (.find (re-matcher #"([a-z])([a-z]+)" "foo")))
20:35clojurebotjava.lang.ClassCastException: java.lang.Boolean cannot be cast to java.util.regex.Matcher
20:36justinkohaha I thought clojurebot was a real person pasting the output
20:36justinkothat is awesome
20:37raek,(re-groups (doto (re-matcher #"([a-z])([a-z]+)" "foo") .find))
20:37clojurebot["foo" "f" "oo"]
20:37raekyay!
20:37dbgsteramalloy: must be some nasty questions, mind twisting, just saying from someone who is on page#43 of their first clojure book
20:38amalloydbgster: asking arcana as interview questions is just as bad in clojure as in some other language
20:38raek.find changes the Matcher in-place and returns true if it matched
20:39justinkoraek: that doesn't quite match the documentation, does it?
20:39raekjustinko: which sentence are you thinking about?
20:41justinkoraek: "Returns the groups from the most recent match/find"
20:41raekfirst you step the Matcher to the next match, then you call re-groups on the Matcher to fetch the groups of its current match
20:41justinkoraek: okay, so you need to "find" matches first
20:41raekexactly
20:41justinkoraek: you can't just pass a matcher
20:42justinkowithout finding first
20:42raekthese stateful APIs are not very ideomatic in clojure
20:42raekjustinko: yes, so then you can call .find again on the Matcher to go to the next match and call re-groups on the Matcher to get the groups of that match
20:43justinkoraek: thanks
20:44raekre-seq could probably be implemented like (defn re-seq [m] (letfn [(step [] (lazy-seq (when (.find m) (cons (re-groups m) (step)))))] (step)))
20:45raek...if it took a matcher instead of a regex and a string
20:45raek(defn re-seq [re s] (letfn [(step [] (lazy-seq (when (.find m) (cons (re-groups m) (step)))))] (step
20:46raekeh.
20:46justinkoraek: I'm just starting to learn clojure, not that far yet
20:46justinkoraek: re-seq is the next function in the book
20:47justinkoraek: that one is straight forward
20:47raeka very useful one
20:48raekalso, the combo of if-let and re-find is very nice: (if-let [[_ as bs] (re-find #"(a+)(b+))] ...)
21:28justinkowow, so I can't find the differences between "conj" and "merge" on maps
21:28amalloy&(conj {} {1 2 3 4})
21:28sexpbot⟹ {3 4, 1 2}
21:29amalloyhm. i thought that might fail. but there are no big differences i guess
21:29amalloyconj is just more general-purpose; merge is specific to maps
21:31symboleAccording to the docs, merge can take multiple maps and it itself uses conj.
21:31justinkoamalloy: hmmm, so internally, merge uses conj....
21:32justinko,(conj {:a 1 :b 2} {1 2} {3 4})
21:32clojurebot{3 4, 1 2, :a 1, :b 2}
21:34justinkoconj can take multiple maps, and both can take multiple vectors, not sure what the differences are...
21:35amalloyjustinko: does it matter? use merge if you're conceptually merging maps, and conj if you're doing something else
21:36amalloyeg ##(let [m {1 2 3 4}] {:assoc (assoc m 10 20), :merge (merge m {5 4 1 10})})
21:36sexpbot⟹ {:assoc {10 20, 1 2, 3 4}, :merge {5 4, 1 10, 3 4}}
21:36justinkoamalloy: well, it just bothers me that the differences are not clear
21:36symbolehttps://github.com/clojure/clojure/blob/f86db9cc68773dd3e4a166c1ff7b81e4a98aa602/src/clj/clojure/core.clj#L2268
21:37amalloyjustinko: what is the difference between map and juxt? they do similar things, but different, and that's okay
21:39justinkoamalloy: as long as they have differences, I'm fine with that. I'm coming from Ruby, where there are aliases for so many function names. It's kind of annoying: "collect" is an alias to "map" <-- why?? where is the value add?
21:40symboleWhen writing an API, is it better to store data such as hostname and port inside special vars, or is it better to pass a data structure that contains that data to all the functions?
21:40amalloyjustinko: i wouldn't be surprised if merge were written before conj learned some new tricks for working with maps
21:41justinkoamalloy: yeah, that kind of stuff is to be expected I guess...
21:41amalloyand merge has a nice pair in ##(doc merge-with), which has no real conj-equivalent
21:41sexpbot⟹ "([f & maps]); Returns a map that consists of the rest of the maps conj-ed onto the first. If a key occurs in more than one map, the mapping(s) from the latter (left-to-right) will be combined with the mapping in the result by calling (f val-in-result val-in-latter)."
21:41amalloyso having merge[-with] has nicer symmetry than conj/merge-with
21:42justinkoamalloy: good point
21:56justinkoso basically, clojure's sequence is ruby's Enumerable
21:59gfrlogif you don't think about it too hard, then yes.
22:00justinkogfrlog: yeah, just read some more. Sequences are a much higher abstraction than Enumerable
22:01gfrlogI have a hard time drawing any connections between clojure and ruby at all anymore
22:02justinkogfrlog: I consider that a good thing :)
22:02gfrlogyeah me too
22:03justinkoas I learn more, clojure IS starting to appear as a "next generation" language, as they say
22:04justinkogfrlog: you use clojure in your day job?
22:05Scriptoris the state of clojure survey up?
22:06dnolenjustinko: Enumerable is stateful tho right?
22:06gfrlogjustinko: yep. lately almost exclusively. the rest is ruby and java(coffee)script
22:09justinkodnolen: yes. Enumerable is a class that provides methods to array (vectors), hash (map), etc.
22:09dnolenjustinko: that's a huge difference between Clojure sequences and Iterator/Enumerable - statefulness.
22:10dnolen(next seq) don't blow away anything.
22:11justinkodnolen: yeah, I was referring to the fact that they operate on multiple data types
22:11dnolenjustinko: yes, that's part of the problem, in Ruby and other langs statefulness is part of the protocol.
22:11gfrlogI don't think anything about enumerable is inherently stateful
22:11justinkostate-fulness aside
22:11gfrlogI think it depends on the underlying data structure
22:12gfrlogwhich, in ruby, is usually stateful
22:12dnolengfrlog: as far I understand in Ruby and Python and Objective-C and Java, they are stateful by design.
22:12gfrlogbut you could easily create immutable data structures that mix in enumerable
22:13gfrlogdnolen: certainly the language trends that way, but I'm saying that ruby's enumerable specifically is not inherently stateful
22:13gfrlogit's state-neutral
22:13justinkothat's right, i thought Enumerable might have contained bang (!) methods
22:14gfrlogI don't think enumerable has anything that's not derived from #each
22:14gfrlogbecause that's how you use it if you want to include it in a custom class -- you just have to implement #each
22:14dnolengfrlog: ah you're right, Enumerable interface is not stateful.
22:15gfrlogbut all that aside, ruby programmers use stateful data structures almost exclusively :)
22:15gfrlogat least in my experience
22:18justinkogfrlog: your company uses clojure for back-end, rails for front-end?
22:20dbgsterless than and larger than seemed revered.
22:20gfrlogjustinko: no, most of the clojure I've done has been web-apps
22:20dbgster(> 5 10) to me reads: 10 > 5
22:20gfrlogso the clojure and ruby are kind of disjoint
22:21justinkoutilizing compojure?
22:21gfrlogdbgster: maybe it makes more sense when you think of the multiargs case?
22:21gfrlogi.e., > says "these numbers are in descending order"
22:21gfrlogjustinko: yep
22:22dbgstergfrlog: but then if it is (< 5 10) it means the are in desc order?
22:22gfrlogno, ascending
22:23gfrlogthe height of the symbol gets larger as you move from left to right, and so do the numbers
22:23dbgsterok so at least its consistant...hmmm... this is a basic operation, this has to stick in my head somehow :)
22:23dbgsterand it reads right to left correct?
22:23gfrlogdbgster: it's okay, I have to do a double take every time I use it too :)
22:24brehautdbgster: read it as 'increasing rightward'
22:24dbgsteractually if you read it right to left, it makes sense.
22:24gfrlogdbgster: I'm not sure what you mean. If you think of < meaning "less than", then it means "first arg is less than second"
22:24dbgster(< 5 10) means: 5 < 10
22:25dbgster< is greater than
22:25brehautdbgster: does thinking about (< 1 2 3) and (< 1) both = true help you?
22:25dbgsterbrehaut: this is how it helps reading it now: 1 < 2 < 3
22:26Scriptoryep, if (+ 1 2) is (1 + 2) then (< 1 2) would be 1 < 2
22:27brehauti personally prefer to discard the greater than / less than terms because they have an inherent binary nature that isnt cleanly mapped onto the actual operator
22:30dbgsterthere isnt' a single clojure job in my area hehe
22:34gfrlog,(-> "" vector list hash-set)
22:34clojurebot#{([""])}
22:51duck1123What is the right way to wrap my lazytest tests. I used to use robert-hooke, but lately it's been giving me a NPE
22:52duck1123basically, I want to make sure they're all executed in my :test environment
22:54miwillhitehey…has anyone here gotten cucumber working with clojure?
22:54miwillhiteI'm having issues getting it to see jruby currently…
22:55duck1123what are you using to run it? (lein, mvn?) I had something kinda working with maven
22:55miwillhitelein
22:55duck1123but I turned it off because I didn't have any features yet
22:55miwillhite(btw I'm brand new to clojure, no java experience…coming from ruby/js)
22:56duck1123I try to stick to maven for all my projects, so I can't help, sorry. I guess we're both on a testing kick tonight
22:56miwillhiteheh…thanks anyway
22:56miwillhitewhats the advantage to maven over lein?
22:57duck1123maven has a lot more structure. lein is great for simple projects, but if you're building a big massive project, you appreciate all the other stuff maven gives you
22:58miwillhitecool okay
22:58duck1123it's a matter of taste for me, personally
22:59gfrlogmiwillhite: I tried to get cucumber working and failed
22:59gfrlogmaybe a month ago
23:00miwillhiteits blowing up in cuke4duke when trying to hit org.jruby.Main
23:00duck1123I couldn't figure out how to get it to launch my server so I could send requests to it
23:01miwillhiteI got the environment setup and everything installed…after wrestling with it for a while…
23:02miwillhiteI think its something to do with the classpath
23:02miwillhiteand could be the fact that I'm rvm's jruby
23:02miwillhitebut this stuff is still beyond me at this point
23:03gfrlogmiwillhite: I don't think cucumber+clojure is done very often. Since you're new to clojure, is it possible for you to use something more popular at first, like clojure.test?
23:04miwillhiteoh sure, I just thought I'd try my luck. I like to dive into the deep end sometimes…even if I need a little help getting out.
23:04miwillhitePlus, starting from ground zero with this app idea it would be nice to be able to write it up in features
23:04gfrlogI'm speculating here, but I think cucumber might be mildly philosophically incompatible with clojure
23:05miwillhiteheh…that thought had occurred to me
23:05gfrlogwith the possible exception of testing web apps
23:05gfrlogwhich is probably what you're trying to do with it
23:05miwillhiteyep
23:05duck1123same here
23:05miwillhiteI still think cucumber is a nice too for fleshing out ideas
23:05miwillhite*tool
23:05gfrlogthe reason I say incompatible is that cucumber seems inherently stateful to me
23:06gfrlogit would be more clojure-like to treat your web app as a function rather than something you're using in a browser
23:07gfrlogit fits in nicely with how ring works -- are you familiar with ring?
23:07miwillhitenot too any great extent…got my app running on the web, thats about it
23:07duck1123gfrlog: there's still a benefit to having an even higher level of testing than ring interactions
23:08gfrlogduck1123: I agree, I've actually been messing with this myself lately
23:08gfrlogI think it can be done more functionally than cucumber
23:09duck1123so is anyone still using lazytest? I wanted something like rspec, but I'm thinking my problem right now is more easily solved in clojure.test
23:09gfrlogin one of my apps I had some test helpers that allowed me to write something like:
23:09gfrlog(->
23:09gfrlog (GET "/foos/new")
23:09gfrlog (submit-form-with {:name "Charlie"})
23:09gfrlog (should-be-successful)
23:09gfrlog (should-see "Charlie"))
23:09seancorfieldmiwillhite: did you try this tutorial? https://github.com/mjul/cucumber-tutorial
23:09seancorfieldit has installation steps with lein (but i haven't tried it - just found it via google)
23:10miwillhiteseancorfield: yes, that is the particular version I am using (there are several). Its blowing up in one of the dependencies
23:12miwillhiteI hate relying on jruby for this though…
23:12miwillhiteI'll probably pull back…write the features as an exercise to describe the basic app, then just use clojure-test to work it out
23:16duck1123gfrlog: If you're ever willing to extract some of that, I'd love to look at it
23:17duck1123I'm curious of what people think of my framework: https://github.com/duck1123/ciste
23:17duck1123That's what I'm using for my site, just extracted
23:27miwillhitevery cool duck1123, I'll have to try this one out
23:30duck1123I haven't written all the documentation up, so do look at the code
23:31miwillhitewill do, thanks for sharing :)
23:32duck1123I'm writing an app that passes both http requests and xmmp packets through the same framework
23:32duck1123I just discovered lamina recently, so there'll be some neat new stuff soon
23:39seancorfieldmiwillhite: hmm, i tried to follow the install instructions here https://github.com/cucumber/cuke4duke and ran into a rubygems incompatibility
23:40seancorfieldbundler requires RubyGems version >= 1.3.6
23:40seancorfieldsince i don't use ruby, i don't know what to do at that point (apart from google of course)
23:42seancorfieldhmm, working thru upgrading rubygems :)
23:44seancorfieldok, got this error, giving up on rubgem stuff /Library/Ruby/Site/1.8/rubygems/dependency.rb:247:in `to_specs': Could not find bundler (>= 0) amongst [] (Gem::LoadError)
23:45duck1123see if this helps: GEM_HOME=~/.m2/repository/.jruby GEM_PATH=~/.m2/repository/.jruby gem install bundler
23:45duck1123wait, you're not using rvm
23:46duck1123I don't know if you need that, but I doubt it'd hurt
23:48seancorfieldi'd already run that command duck1123
23:48seancorfieldtrying to follow this https://github.com/cucumber/cuke4duke
23:48seancorfieldmaybe i should try the non-rvm path
23:49seancorfieldah, i think there's a ~ missing
23:51duck1123oh yes, there are several
23:51duck1123go to the raw version of the readme
23:52seancorfieldnow i get Could not locate Gemfile
23:54seancorfield*sigh* following the chain of dependencies further
23:57seancorfieldok, i sympathize with miwillhite - this is a crazy chain of dependencies :)
23:57seancorfieldtime to watch TV and forget about computers for a while methinks!