#clojure logs

2011-01-31

00:36clizzinis there anything that does concat for transients? or am i limited to just conj for a single item when dealing with transients?
01:32TakeVAre all the basic functions, such as inc, cached?
01:32replacaTakeV: I don't know what you mean by cached
01:32TakeVMemorized, I should say.
01:32replacaTakeV: they are compiled, yes, but not inlined by default
01:33TakeVThe results of the function. Sorry for the lack of clarity.
01:33replacaTakeV: no, but you can use memoize
01:33raekno. afaik, they are not.
01:34replacacaching the result of inc is a negative though, the costs of doing the cache lookup would be larger than the cost of doing the computation
01:34raek(def memoized-inc (memoize inc))
01:34raekheh, true
01:35TakeVHmm, then that is odd. I am running inc through dotimes and time to get a baseline time to compare my function with, but after the first couple of times inc is called, the run time is cut in half.
01:36replacaTakeV: yeah, the java hotspot is inlining
01:36TakeVHmm, but it isn't doing the same with my function.
01:36TakeVDoes it only inline the predefined functions in the core?
01:37replacayour function may require introspection. Type hints are probably the way to happiness
01:37replacasorry, introspection -> reflection
01:37TakeVAhh, yes, that could be it.
01:39TakeVYes, that is certainly it. Thank you.
01:40replacacool, np
02:18LauJensenMorning
03:33CedricPineaufps : You need maven2 to build contrib
03:47AWizzArdtechnomancy: I think it was because I put it between two '*' chars. (def *foo* 10) ==> warning. When I did a (def +foo+ 10) it did not warn anymore.
04:00raekAWizzArd: *earmuffs* should be used for variables that are intended to be dynamically rebound. for constants, plain names without earmuffs are used
04:01raekthis is what this says, anyway: http://www.assembla.com/wiki/show/clojure/Clojure_Library_Coding_Standards
04:09AWizzArdraek: then, at least in my opinion, this document is "wrong".
04:10AWizzArdraek: historically global vars (not introduced by let or fn params) were put into * or +.
04:11AWizzArdAs local vars will not have such symbols an accidental shadowing is not likely.
04:11raekyes, there are multiple conventions around
04:13raekah, is this related to the fact that in some lisps variables are dynamically scoped?
04:13AWizzArdThe main lisps are.
04:15raekfor a language with dynamically scoped variables, these conventions for global vars indeed make sense (due to shadowing issues)
04:16replacaAWizzArd: I thing that the general consensus was that this was too noisy for clojure and not necessary, since accidental shadowing is unlikely
04:17replacaAWizzArd: given the fact that locals are declared locally
04:17AWizzArdWhen we have (def x 10) and (defn foo [] (let [x 20] (println x))) I think we would see a 20.
04:18replacaAWizzArd: yes, but that's not accidental
04:18replacathe let is right there
04:18AWizzArdThis is accidental. Because may not know by heart all globals.
04:19AWizzArdOf course, my IDE could warn me, but this does not happen anywhere yet.
04:19replacaAWizzArd: (which is not to say that *you* may prefer that to be more explicit, that just wasn't the consensus)
04:19replacaAWizzArd: true, you may shadow without knowing it, but you probably don't care, cause it doesn't "break" you global in any way
04:20AWizzArdAs I said: it is about my opinion.
04:20replacaAWizzArd: if you wantd to use it, you'd probably know about it
04:20replacaAWizzArd: and functions you call will still see the global
04:21replacaOne point htat was made is tht since Clojure is a lisp-1, most globals are actually functions. There was much appetite for earmuffs or +s there
04:22replaca*that
04:22AWizzArdIt's okay. Anyway, then there should still be one default. For example: all globals are static by default.
04:22AWizzArdSo when I say (def *foo* 10) it would still be a static var, even though it is stared.
04:23replacaAWizzArd: agreed. And I thought that that was exactly where clojure was going. If not, I haven't heard about it.
04:23AWizzArdIn Alpha I also tried (def ^:static *foo* 10) but this also didn't help to make the warning go away.
04:23replacayup
04:23replacaAWizzArd: I think that's just transition help
04:24replacaAWizzArd: but I'm not the expert
04:24AWizzArdWith this hint I told the compiler explicitly: "I thought through this and I am aware of the issues. Static please."
04:25replacaAWizzArd: I though that :static didn't mean that anymore in the latest 1.3
04:25replaca*thought
04:25replaca(it's late and I can't type anymore)
04:27replacaAWizzArd: I think that :dynamic is the only thing that means something and that Rich had discarded the idea of a :static property (and reused the keyword for a different meaning)
04:27AWizzArdProbably everything is implicitly :static by default.
04:27replacaAWizzArd: yes, exactly
04:27AWizzArdreplaca: I even suggested him to add a compiler option that would make everything static. Probably that got him the idea to think about it :)
04:28replacaAWizzArd: could be. Were you at the conj?
04:28AWizzArdUnfortunately not.
04:29replacaAWizzArd: he talked about it there, and requiring :dynamic when you wanted was the opinion
04:29replacano options :)
04:29AWizzArdI would have to look it up in the chatlogs to find out when I proposed this compiler flag.
04:30replacain any case, I gotta crash. G'night all!
04:32AWizzArdn8 n8
04:49AWizzArd$seen rhickey
04:49sexpbotrhickey was last seen quitting 2 weeks and 6 days ago.
05:58AWizzArdMany of you probably already saw this recent interview of rhickey: http://www.infoq.com/interviews/hickey-clojure-protocols
06:34Dranikdoes anyone know whether symbol macros are planed in clojure?
06:41cemerickDranik: There's been some thought of it, but that's about it. http://dev.clojure.org/display/design/letmacro appears to be the relevant page to watch.
06:42Dranikcemerick, thanks
06:43Dranikcemerick, actually, I didn't get it. Is the page a kind of roadmap, and symbol macros will be implemented some day?
06:44cemerickDranik: roughly, yes. When a more thorough (/formal) design has been churned through, it'll appear there.
06:44Dranikyeah, great!!
06:44Dranikthanks!
06:44cemericknp :-)
06:59fliebelcemerick, Dranik: Care to explain what symbol macroes are, and what the "new compiler" is? CinC?
07:01Chousukefliebel: AFAIK a symbol macro is a symbol that gets replaced with a piece of code during macroexpansion
07:02Dranikcan anybody explain what's wrong with the macro? (defmacro reffn [& body] `(let [my-fn# (ref (fn ~@body))] ))
07:02fliebelChousuke: You mean that foo could become (+ foo 4)?
07:02Draniki use macroexpand-1 and run the expanded code -- everything is ok
07:03Chousukefliebel: something like that. except I think it would cause infinite recursion :P
07:03Dranikbut when run the macro -- exception is thrown
07:03fliebelDranik: what exception? stacktrace?
07:03ChousukeDranik: I don't see anything immediately wrong with it. show me your macro call :P
07:03Dranikmoment
07:04Dranikoh no....
07:04Dranikthank you guys
07:04Dranikthat was my error
07:04edoloughlinhttps://gist.github.com/803947 -- why is the last map 'promoted' out of its nesting?
07:05Chousukeedoloughlin: flatten is recursive, but does not descend into maps.
07:06Chousukethe last map is not inside a map but a vector, which gets flattened
07:15edoloughlinBroadband went down immediately after last posting. Missed any responses :(
07:18Chousuke14:02 < Chousuke> edoloughlin: flatten is recursive, but does not descend into maps
07:19Chousuke,(flatten [[[1 {:a [2]}]]])
07:19clojurebot(1 {:a [2]})
07:21Chousukedamn, building git manpages takes longer than building git itself :P
07:23edoloughlinChousuke: Thanks
08:00YuizinhaThere's some lein/clojure script for generting script for starting clojure applications ?
08:15pppauli'm having trouble with lein + slime and classpaths
08:16pppauli'm running lein, i did slime-connect to the server, and tried to import via (ns solve360-name-fixer
08:16pppaul (:require [solve360-interface :as solve360])), but it fails to find my file
08:18mrBliss`pppaul: replace the dash in solve360-interface with an underscore, but only for the filename, leave the dashes in the namespace.
08:18pppaullein creates /src/solve360... but that's not on the classpath
08:18YuizinhaAnybody knows a wrapper to clojure like appassembler ?
08:19pppaul ./src is on the classpath, but my files are in /src/solve360... how do i get that on the classpath?
08:19pppaulor did i use lein wrong?
08:20mrBliss`pppaul: read the "Creating a Project" section of https://github.com/technomancy/leiningen/blob/master/TUTORIAL.md pay attention to the last paragraph.
08:20pppaulthank you
08:20Yuizinhacould anybody help me?
08:50Kototamahello, can someone explain me why exceptions thrown from lambda functions are wrapped into runtime exceptions?
08:57pppauli have a lein swank project running, with /src/solve360/<some cljs + curl.clj> when i do (require 'solve360.curl) i get an error: 'namespace 'solve360.curl' not found'
08:58pppaulcan someone help me understand this?
08:59pdkare you sure that those clj files are in your classpath
09:00pppaul src/ is in my classpath
09:00pppaulthis is the first time i've split a project into multiple files... having problems :(
09:01pppaul'name.file' translates into /name/file.clj no?
09:01mattmitchellwhat's the best way to map keys of one hash to another, while giving the ability to change the names as needed?
09:03ejacksonpppaul: yes it should
09:04jkruegermattmitchel: i think that depends on how your keys are changing
09:04pppaulok, i found out that (require 'solve360.curl) works, but when it's nested in another ns require it doesn't work
09:06tonylpppaul: when it is nested in ns it doesn't need to be quoted and it needs to be a keyword. like here http://clojuredocs.org/clojure_core/clojure.core/ns#example_527
09:06raekKototama: that is probably due to that you use it in a lazy sequence. fn does not do that, but lazy-seq does.
09:07pppauli know, i'll show example code... (ns solve360-interface
09:07pppaul (:require [clojure.contrib.json :as json])
09:07pppaul (:require [solve360.curl :as curl]))
09:08tonylwhat does it tell you?
09:08mattmitchelljkrueger: for direct mapping, i'm using select-keys. but the changes are simple, something like :parent_code becomes :parent_id etc.
09:08jkruegerin the most general form (into {} (map (fn [key val] [otherkey val]) source))
09:08pppaul"namespace 'solve360.curl' not found"
09:08mattmitchelljkrueger: ahh ok i'll try that. thanks.
09:08jkruegerthere is a [] missing around [key val]
09:08tonylpppaul: that namespace might not be in your path then
09:09ejacksonpppaul: that file needs to saved as solve360_interface.clj
09:09pppaulthe file /src/solve360/curl.clj exists
09:09ejacksonand the file that contains the code snippet you posted ?
09:10tonyldoes the curl.clj file also has the form (ns slove360.curl) in it?
09:10pppaulno
09:10pppaul(ns curl)
09:10pppaulshould it be (ns solve360.curl)?
09:10ejacksonyes
09:11pppauloh
09:11Kototamaraek: hummm this sample http://pastie.org/1514707 throws a runtime exception in the SLIME repl but not in the REPL ...
09:11YuizinhaAnyone here knows lein-daemon or lein-init-script ?
09:13ejacksonpppaul: all sorted ?
09:14tonylare your files in the same level: /src/solve360/curl.clj /src/solve360/solve360-interface.clj
09:15tonylpppaul: ^^
09:15pppaulstill having problems after editing my ns's
09:15tonylpppaul: what does it says now?
09:15pppaulsame problem (ns solve360.curl) in curl.clj, but it still gives me the can't find ns solve360.curl error
09:16ejacksonthe filename /src/solve360/solve360-interface.clj must have _ in the name, not -.
09:17pppauli have it as /src/solve360/interface.clj
09:17tonylpppaul: you have to name it the same
09:17pppauldo i need to name my curl file /src/solve360/solve360_curl.clj ???
09:18tonylno
09:18tonylunless it makes sense to change it for your naming conventions
09:18tonylthe namespace just have to reflect the same name as the files
09:18pppauli don't want to repeat 'solve360' so much
09:18tonylexcept for the underscore and dash
09:18pppaulthe file is interface.clj, curl.clj
09:19tonylright
09:19pppaulns = solve360.interface
09:19tonylso in the interface.clj you can put it as (ns solve360.interface
09:19tonylyeah
09:19pppaulthat's what i have
09:19tonyland curl.clj as (ns solve360.curl)
09:19pppaul(ns solve360.interface
09:19pppaul (:require [clojure.contrib.json :as json])
09:19pppaul (:require [solve360.curl :as curl]))
09:20pppaul(ns solve360.curl
09:20pppaul (:require [clojure.contrib.json :as json])
09:20pppaul (:use clojure.contrib.shell-out))
09:20tonylthat didn't work?
09:20pppaul"namespace 'solve360.curl' not found"
09:22pppaulmaybe my env is broken?
09:22pppauli've just started it, and only done ns stuff, though
09:23tonyli think in (:require [solve360.curl ...] you only need (:require curl) since they are in the same level
09:23tonylbut I am not so sure
09:24pppauli'll try
09:26raekKototama: what happens when you use doseq instead of map?
09:31pppauli'm still having problems with my classpath
09:31pppaul(ns solve360.interface
09:31pppaul (:require [clojure.contrib.json :as json])
09:31pppaul (:require curl))
09:31pppaulCould not locate curl__init.class or curl.clj on classpath:
09:33mattmitchelljkrueger: ok so I got this far, would you mind giving me a hint as to how i can "find" the alias key in the mapping? https://gist.github.com/804092
09:33tonylpppaul: are you adding the src folder to your classpath?
09:34tonylor how you are you running these files?
09:34raekpppaul: is the file in solve360/curl.clj? in that case you still have to write solve360.curl, even though the interface file is in "the same level"
09:34pppaulsrc is in classpath, checked
09:35pppauli was doing that, someone suggested that i try without solve360.curl
09:35pppaulnamespace 'solve360.curl' not found
09:36tonylare you only running the interface.clj file?
09:37pppaulyes
09:38ejacksonmattmitchell: no, do like jkrueger suggested... Ive put it onto your gist
09:40ejacksonalthough it unhelpfully parsed it in some cockeyed manner
09:40jkruegerejackson : that looks like what i had in mind. but you beat me to it
09:40ejacksonwell, it was your idea :)
09:42mattmitchellejackson jkrueger: ok thanks! but to make it work with a list of keys, and optional aliases for the sake of learning, how would i get the aliases working for what I have?
09:43jkruegermattmitchel: create a map out of the list first
09:43tonylpppaul: are you using lein or something similar?
09:43jkruegerif you have to pass a vector
09:44pppaulso i'm really curious as to why my '(:require [solve360.curl :as curl]))' isn't making a solve360.curl namespace
09:44pppauli'm using lein
09:44pppaullein swank
09:44tonyloh mm, never used it
09:45mattmitchelljkrueger: oh ok, so the mapping becomes {:id :id :new-name :name} , then i create the new hash by using that map?
09:45raekpppaul: do you have (ns solve360.curl ...) in your curl.clj file?
09:45pppaulyes
09:45Kototamaraek: then it's not wrapped anymore
09:46raekok. lazy sequences wrap them, cause they can end up anywhere
09:46raekso the basic advice is to avoid throwing exceptions through lazy sequences (e.g. map)
09:47pppaulmaybe i'm interacting with swank wrong
09:47raekas they don't really fit the model
09:47jkruegermattmitchel: correct. i'm not entirely sure if that is the most elegant way. but off the top of my head it seems ok
09:47raekpppaul: how did you start the swank server?
09:47pppauli'm using C--M-x
09:47pppauli did lein swank
09:47pppaulconnected with slime-connect
09:47pppauland started doing C-M-x on parts of my code
09:47mattmitchelljkrueger: excellent. thanks again.
09:48pppaulstarting with (ns)
09:49Kototamai'm parsing an xml file and resolving some imports for the file, not sure how to avoid that
09:50Kototamai did a macro that unwraps the exception and rethrow it :s
09:51raekone way could be to catch the exception inside the fn, and return some error value instead
10:01mattmitchellcan any improvements be made with this? https://gist.github.com/804128
10:04jkruegermattmitchel: looks fine. since you don't need the bindind form in normalize-mapping, you could shorten the fn to a #() form
10:08jkruegermattmitchel: on the other hand... the parameter is referenced more than once, so it probably should have a name
10:10mattmitchell_jkrueger: i see. ok that makes sense. thanks again for your feedback :)
10:11jkruegermattmitchel: your're welcome
10:23edwI've found myself using sequence operations that work on single elements of sub-sequences. (https://gist.github.com/804165) Are these operations, perhaps more generally, defined anywhere, and if so, do they have established names?
10:29hvis (:use [foo.bar :only (baz)]) wrong? should be [baz] instead of (bar), right?
10:30Chousukehv: it doesn't matter
10:30Chousukeboth are sequential
10:33hvhmm, () seem to cause some problems.
10:34hvfor instance, clojure.contrib.prxml seems broken, but if I make that change it seems to work again.
10:41raekhv: as long as you write that in an ns form (i.e. not directly at the repl), both should be equivalent
10:43hvraek, Chousuke: You're right, I'll have to see what was broken then...
11:27YuizinhaSomebody here have sucess using lein-init-script ?
11:28YuizinhaI'm having some troubles, the script returns a null pointer exception
12:14zippy314_Hi folks. I'm running into the situation where I have name-spaces that want to mutually refer to some parts of eachother in :use clauses, but this seems to fail because of the circularity. Is there a known way to handle this, or do all namespaces have to be strictly hierarchical in their inclusion pattern?
12:15ohpauleezzippy314_: I don't know the answer for sure, but have you tried using :only to specify key functions you want? and also, does require suffer from this?
12:16zippy314_yah I've tried it, but it doesn't seem to matter. It looks like because of the circularity it's trying to define things that don't exist yet.
12:17ohpauleezright
12:26fliebelzippy314_: You're right. A common way to solve it is to convert a <-> b to a -> c <- b
12:27zippy314_I guess this it's a one-pass loading scheme, huh. Ok. That's a good idea.
12:27fliebelA more hackish way, is to move the use statements down into the code, right before you need them, and then rearange the code so that it loads in the right order.
12:30raekanother way is to convert "abcd <-> xy" into "ab <- cdxy"
12:31zippy314_fleibel: does that mean that you re-do the ns call multiple times?
12:33fliebelzippy314_: No, it means you just move it down, so that all the code above it is loaded before it loads the other file, so the other file can at least access the code abover the use in the first file.
12:33raekzippy314_: I think it hard to recommend a general strategy (except for "avoid circularity"). can you show us the code?
12:34raekin my experience, functional code tends to be "layered"
12:34zippy314_I'm going to try and distill it down to the basic parts and see if the layered thing happens naturally.
12:34raekwhere each layer is only dependent on functionality of layers below it
12:34zippy314_If not, I'll post some code.
12:37raeklets assume you have one namespace for apples and one for apple baskets. then it might be a good idea to move everything that involves both apples and baskets (e.g. basket-contains-apple?, list-apples, list-enclosing-baskets) into the basket namespace
14:04zippy314_can anybody point me to tips on opening a stream on a string? I'm trying to write some code for my test routines that simulates *in* and *out* and I think I can do it easily if I can get a stream that reads from a string.
14:05fliebelzippy314_: take a look at java.io and clojure.java.io
14:05fliebelI think there are StringOutputStreams and sucht, and even macroes like with-out or something like that.
14:21fliebelzippy314_: ##(doc with-out-str)
14:21sexpbot⟹ "Macro ([& body]); Evaluates exprs in a context in which *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls."
14:21chouser,(with-in-str "hello" (read-line))
14:21clojurebot"hello"
14:22hiredman1d2
14:22clojurebot1
14:22hiredman1d2
14:22clojurebot1
14:22fliebelhiredman: ?
14:23hiredmanfliebel: flipping a coin
14:23fliebel1d2
14:23clojurebot1
14:23fliebelDoes it over return non-1?
14:24zippy314_1d10
14:24clojurebot1
14:24zippy314_10d1
14:24clojurebot10
14:24robonoboapparently not
14:24fliebel&1d1
14:24sexpbotjava.lang.NumberFormatException: Invalid number: 1d1
14:24hiredman5d6
14:24clojurebot15
14:24ohpauleezwhat is that syntax for?
14:25ohpauleezclojurebot's coin flip?
14:25hiredmanit's not clojure syntax, it's dungeon's and dragons dice
14:26hiredman5d6 is five six sided dice
14:26clojurebot24
14:26ohpauleezahh, rad
14:26robonobo1d6
14:26clojurebot3
14:27fliebel1d2 should return 2 sometimes in that case...
14:27clojurebot2
14:27robonobothere you go
14:27fliebelI don;t see why a bot would need to throw dice, but it's cool :)
14:28hiredmansometimes you need some random bits
14:28fliebel1d0
14:28clojurebot#<NullPointerException java.lang.NullPointerException>
14:28robonobonoooo
14:28fliebel1d1e5
14:28clojurebot1
14:29opqdonut1d10000
14:29clojurebot8928
14:29opqdonut1d10
14:29clojurebot10
14:29fliebel0d2
14:29clojurebot0
14:29opqdonut1d10
14:29clojurebot1
14:29opqdonut1d10
14:29clojurebot8
14:29fliebel1d-2
14:29ohpauleezfails the regex
14:29fliebelhmhm
14:30fliebel,(print "1d2")
14:30clojurebot1d2
14:30fliebel&(print "1d2")
14:30sexpbot⟹ 1d2nil
14:30fliebeluh :(
14:31fliebelDoes clojurebot ignores itself completely?
14:32robonobofliebel: i would think it does, otherwise you could probably set it off in an infinite loop
14:32robonobos/think/hope
14:32sexpbot<robonobo> fliebel: i would hope it does, otherwise you could probably set it off in an infinite loop
14:32technomancyfliebel: it doesn't need to; IRC doesn't work that way
14:33technomancyyou don't see your own messages
14:33fliebelI'm thinking it would be fun to have clojurebot evaluate a… you know, those things that evaluate to themselves :)
14:33robonoboquine
14:33fliebelright
14:33robonoboi've never understood quines
14:33tonylkeywords :P
14:33robonoboexcept cat $0
14:33zanesNo. Quines print themselves. There's a difference.
14:34robonoboyes, i know, it's a cheat
14:35zanesWas quibbling about the definition, not your example.
14:35jkruegerhttp://d.hatena.ne.jp/ku-ma-me/20090916/p1
14:35fliebelrobonobo: that does not even work...
14:36robonobofliebel: it has to be a in a script, not from the shell
14:36robonobo$0 is the script file itself
14:37tonyl*1
14:37robonoboso cat $0 prints the contents of the script
14:37robonobojkrueger: that's just too much
14:39jkruegerrobonobo: i just thought i'd throw it in there :)
14:39jkruegernot that i comprehend it
14:40robonoboi've been told lisp quines are the easiest to understand due to the whole code is data thing
14:41robonoboanyone have a good short one?
14:41fliebelI wish I had...
14:42robonobo,((fn [x] (list x (list (quote quote) x))) (quote (fn [x] (list x (list (quote quote) x)))))
14:42clojurebot((fn [x] (list x (list (quote quote) x))) (quote (fn [x] (list x (list # x)))))
14:42robonobofrom here
14:42robonobohttp://en.literateprograms.org/Quine_(Clojure)
14:44fliebelI was trying something like this, but that is not how things work… bash -c "echo $@"
14:45robonobofliebel: yes, no
14:45robonobobash is hard
14:47fliebel&*1
14:47sexpbotjava.lang.IllegalStateException: Var clojure.core/*1 is unbound.
14:47fliebel,*1
14:47clojurebotjava.lang.IllegalStateException: Var clojure.core/*1 is unbound.
14:47fliebel:(
14:48fliebelthat var is real fun with quines :)
14:59fliebelWhoa, jQuery seems to have (promise)s :) http://www.erichynds.com/jquery/using-deferreds-in-jquery/
15:07hiredmanwell, single threaded promises are meh
16:17alpheusclojure-mode.el defines clojure-load-file which calls inferior-lisp-proc. inferior-lisp-proc doesn't exist afaict.
16:18alpheusOn one of my systems, C-c C-l runs slime-load-file (which works) and on another it runs clojure-load-file. Drove me crazy, since both systems have all that stuff installed by elpa.
16:19amalloyalpheus: C-c C-l is for reading the current file into the repl?
16:21alpheusyes
16:21amalloyi use C-c C-k, which looks like it's supposed to do the same thing (for clojure, anyway) and haven't had problems
16:21semperos_general q, what do folks here do for slideshow/powerpoint presentations with syntax-highlighted clojure code?
16:23amalloyi recently needed to select N items from a list of M unique items (M>N) at random without duplicates. it's pretty simple in an imperative language, and not too bad with loop/recur, but i couldn't find a pretty way to do it with the usual HOFs. anyone have an idea?
16:24brehautsemperos: i use pygments (pygments.org to get it) to generate HTML
16:24brehautsemperos: and then copy that generated result into keynote
16:24alpheusweird, C-c C-k isn't bound to anything on my broken system
16:24fliebel&(take 5 (shuffle (range 20)))
16:24sexpbot⟹ (8 16 17 0 3)
16:25fliebelamalloy: ^^
16:25semperos_brehaut: makes sense
16:25amalloyfliebel: which is O(M*ln M) instead of O(N)
16:26semperos_brehaut: thanks
16:26fliebelBut it's pretty :)
16:26amalloyer, just O(M)
16:26amalloyfliebel: *chuckle*
16:26fliebelamalloy: Can I see hte loop/recur?
16:27hiredmanseems like it should be doable with reduce
16:27amalloyfliebel: i haven't actually written the loop/recur but i'll show you the php :P
16:27fliebelnoo, no more php! these guys at automatic need to understand some functional concepts...
16:27fliebeloh well, bring it on.
16:28amalloyand reduce/iterate seem like the way to go but they'll be ugly anyway. https://gist.github.com/ce05ee104dd6b06e7f03
16:29fliebelI mean… the_title, that *prints* some title from a *global* variable that is *mutated* the represent the current post.
16:30amalloyfliebel: i know, php is dreadful. i'm sneaking functional code in where i can
16:30brehautamalloy: just start writing in pharen or similar :P
16:31fliebelbrehaut: That does not make sort actually return something, i suppose.
16:32brehautfliebel: is this what stockholm syndrome feels like?
16:32fliebel*googles*
16:33brehautamalloy: i think im missing something; how does that php snippet ensure that each index is unique?
16:33fliebelI was thinking the same...
16:34fliebelthis sounds much like (take 5 (repeatedly #(rand-nth seq)))
16:34amalloymaybe i left out something relevant. $candidates is (range M)
16:35amalloyevery time we select an index from that range, we store it in the list of return values, and then overwrite its entry in the candidate-list with the first element of the list
16:35brehautoh i see. clever
16:35fliebelI don't see...
16:35fliebelbut.. clever, I suppose.
16:35amalloybrehaut: it's not my idea; it's the classic way to do this
16:36brehautamalloy: i must have dozed throguh that algorithms lecture
16:36ossarehlo all
16:36amalloybrehaut: a lot of my early programs were card games. this was pretty interesting to me at the time :)
16:37fliebelAh, now I see...
16:38brehautamalloy: so thats more like O(m+n) than O(n) right?
16:38amalloybrehaut: no, because it's only looping N times, and each iteration is O(1)
16:38amalloy$howmany is my N
16:38amalloyand $max is M
16:38brehautamalloy: but it has to create the candidates structure
16:38brehautwhich is length M ?
16:38amalloybrehaut: hm, i suppose that's true
16:39fliebelamalloy: You can do select-keys on a vector, I think that's interesting :)
16:41ossarehgiven a protocol which has been extended with extend-protocol how can I tell if the methods have all been implemented?
16:42Schuylercan anyone please tell me why this sequence is not evaluated lazily? https://gist.github.com/804873
16:42amalloybrehaut, fliebel: the monstrosity of doing this with iterate: https://gist.github.com/8fff306833f5d0852277
16:43brehautyeah that isnt so nice
16:44amalloySchuyler: you have your cons on the wrong side of (primes). it should probably look more like (cons (primes ...) (next-prime factors))
16:44amalloythough i haven't looked deeply
16:46fliebelSchuyler: Have a look at this, and ate c.c.lazy-seqs/primes. https://gist.github.com/795374
16:46Schuylerhmm. I thought cons took a seq as its *second* argument.
16:46Schuylerdo I really want conj instead?
16:47amalloyer, yeah, my argument order is wrong
16:47amalloybut i think you want cons outside of the call to primes
16:48Schuylerok. I confess I don't understand. I am pretty sure I want to *add* to the seq before recursing.
16:48Schuylerif I'm not passing the extended sequence to primes, then what do I pass?
16:48fliebelamalloy: Would you mind to update the PHP sample with all the variables, to save me some mind overhead every time I look at it?
16:49SchuylerI'm sorry if I'm coming across like an idiot. Clojure's idea of lazy evaluation feels like magic. I can't see how I can know ahead of time whether Clojure will evaluate a sequence lazily or not.
16:49peikosgood evening all.. could someone please help me by explaining a ClassCastException in this small piece of code? http://pastebin.com/9ERCg7pn
16:50amalloyfliebel: done
16:50SchuylerI've been all over Halloway's book, and I am, if anything, *more* confused about recursion in Clojure than I was before./
16:50fliebelthanks
16:50Schuyleramalloy: could I trouble you to take a moment and give me some idea of what you'd actually pass to primes in your "..." above?
16:51Schuyler*that's* the part I'm flummoxed over.
16:51peikosI'm just starting out in Clojure, after using Haskell for quite some time.. This is my first time trying to access Java classes from Clojure, and the result is not very promising unfortunately..
16:51fliebelSchuyler: loop/recur is not lazy, and cons is magic. If you want to understand how laziness works, I found iterate to be much simpler to understand.
16:52amalloy(defn primes [factors] (lazy-seq (let [f (next-prime factors)] (cons f (primes (cons f factors)))))) is a sketch, Schuyler
16:53amalloythe point is you need to return a single element before doing something else lazy, as well as update the factor-list for the next call to primes
16:53tonylpeikos: is it giving you that error on the CompononetColorModel class?
16:53amalloy&(class (into-array [8]))
16:53sexpbot⟹ [Ljava.lang.Integer;
16:54peikosit does not give me any more information than that it's a ClassCastException, and that it occurs on the first line of the pasted fragement..
16:54Schuylerfliebel, amalloy, thank you for the feedback. I will ponder this and try to make sense of it.
16:54amalloy&(class (int-array [8]))
16:54sexpbot⟹ [I
16:54amalloypeikos: ^
16:56amalloyie, you can't pass that thing an Integer[] when it wants an int[]
16:57peikosah... of course. I was under the mistaken impression an int was an integer, because (into-array [(int 8)]) resulted in the same problem..
16:58peikosthanks for that bit of advise :-)
16:59Schuylerholy christ. amalloy, that worked perfectly.
16:59Schuylercould you please explain what you mean by "you need to return a single element before doing something else lazy"?
16:59Schuylerif you don't mind. I've been programming for decades, but aside from some LISP in college I still haven't got my head around pure functional programming
17:00amalloySchuyler: sure, i'll take a stab
17:00Schuylerand I find it a little baffling that Clojure doesn't support lazy tail recursion like, say, Haskell
17:00ossarehSchuyler: that is a JVM thing.
17:01jkruegerand not really as bothersome as it sounds
17:02Schuylerjkrueger, probably not. but I'm still trying to figure how to do iterative function calls in Clojure *without* loops *or* tail call optimization.
17:02brehautalso, as much as i love Haskell, it says a lot about the language that there is abook titled 'Real World Haskell'
17:02Schuylerbrehaut, notice I'm not trying to learn Haskell seriously :)
17:03brehautSchuyler: thats a mistake ;)
17:03Schuyleryou think?
17:03brehautyeah i do
17:03devnanyone know how tcrayford has his testing setup on http://vimeo.com/9350864 -- there's a link to his watchr script, but im interested in the emacs red/green output
17:03brehautI learn more every time i stick my head into haskell land for a day, than a week in another language
17:03brehautthat being said, im _way_ more productive in clojure
17:03jkruegerbrehaut: and if you read it it doesn't strike you as very application oriented either
17:04brehautjkrueger: depends on your application i think.
17:04amalloySchuyler: lazy-seq "delays" everything within its body, and when it is "forced", everything in the body is forced
17:04brehautjkrueger: it may sound insane, but i think it's probably unmatched for writing unix tools
17:05ossarehamalloy: not everything though right - just anything over the 32nd iteration.
17:05amalloywhat you really want is to non-lazily return the list (x the-rest-of-the-primes), and only be lazy about calculating the rest
17:05amalloyossareh: lazy-seq isn't chunked, just range is. but we can ignore chunking when talking about the concept of laziness
17:05ossarehamalloy: oh, sorry - you're talking about lazy-seq inparticular - I missed that.
17:05jkruegerbrehaut: i like haskell. don't get me wrong
17:06amalloyhaskell is on my to-learn list
17:06jkruegerbut in some ways it is like c++. it eats it's young by driving people into senseless complexity
17:07jkruegerc++ on the syntactic level. haskell with layers upon layers of abstraction
17:07brehautnah i dont think thats true. in general the levels of abstraction are about consistent with clojure, but they are organised according to more mathematical ideas
17:09Schuyleramalloy: thank you for explaining that.
17:10Schuyleris there a debugger or something for Clojure?
17:10SchuylerI'd like to step through what's happening here.
17:10Schuylerin an imperative language, I'd just stick print statements inside the loop.
17:10Schuylerbut I'm not even sure how to do that here.
17:10brehautSchuyler: i think any java debugger should work i think?
17:12fliebelamalloy: I'm a bit to sleepy to understand the php. But if I walk through it, writing down what would happen if rand was constantly 0, I seem to get [0 0 1 2 3 4], which is neither random or unique.
17:12brehautSchuyler: although there might be a caveat around the behaviour of let at the moment, it might be a bit squiffy. I saw some discussion o nthe clojure-dev ML recently
17:15amalloyfliebel: nah, you're wrong there
17:15amalloybecause i'm doing rand(i, max), so it will turn out to be 0, 1, 2, 3...
17:15amalloyrather than rand(0, max)
17:16fliebelah!
17:19Schuylerok, I definitely don't understand.
17:19Schuylerhow do you guys debug Clojure programs?
17:19fliebelSchuyler: print statements :)
17:19brehautSchuyler: i debug with prn and a repl
17:20amalloySchuyler: yes, sadly print statements are the state of the art. george jahad's cdt is supposed to be pretty cool though
17:20fliebelIn tricky cases, you can replace foo with (do (print) foo) and foo will still be returned as expected.
17:20Schuylerok... but I can't just bung print calls in anywhere, can I?
17:21brehautSchuyler: mostly you can.
17:21fliebelSchuyler: Why not?
17:21amalloyfliebel, Schuyler: i use https://gist.github.com/c93c37345c49c47dcfa2 for that
17:21brehautSchuyler: there are a few forms without implicit dos, and you can just use (do (prn ...) thing)
17:24brehautamalloy: that is really cool
17:24fliebelWhy isn't there reduce-indexed?
17:24amalloybrehaut: thanks. i've been tinkering/improving it over the ages as i realize bits that are missing. feel free to steal and/or disseminate
17:25brehautamalloy: done :)
17:27amalloythere's something similar called spy in contrib somewhere, maybe c.c.log
17:32Schuyleramalloy: can you give an example of how that macro would be used?
17:32SchuylerI mean syntatically
17:32Schuyler*syntactically
17:32fliebelah, reduce-indexed: (defmacro reduce-indexed [f i s] `(reduce (fn [a# [i# b#]] (~f a# b# i#)) ~i (map vector (range) ~s)))
17:38amalloySchuyler: (call-some-fn 10 (? (some-other-fn 10)))
17:38amalloywill print something like "(some-other-fn 10) is 55"
17:38amalloyso that you can verify you're passing the right args
17:39amalloyand it will of course still pass 55 as the second argument to call-some-fn
17:39Schuyler `.~>
17:39Schuyler~>
17:39Schuyler~>
17:39clojurebot<monads> is "yea, though I should walk in the valley of imperative code, I shall fear no evil, for your monad comforts me" - seen in #haskell
17:39Schuyler~>
17:39Schuyler~>
17:39Schuyler~>
17:40clojurebotthe world <reply>what the world needs is more higher order functions
17:40clojurebotthe world <reply>what the world needs is more higher order functions
17:40clojurebotthe world <reply>what the world needs is more higher order functions
17:49amalloyfliebel: why is that a macro? surely it can be a function
17:49fliebelamalloy: Uhm, because I felt like it, and because I'm much to tired.
17:53Schuyleroops.
17:53Schuylerthanks for the explanations, guys.
17:53fliebelamalloy: I give up, and go to sleep. please remember me to write you a nice indices function, next time I hop on.
17:54SchuylerI do all my day-to-day work in Python, so Clojure is a bit of a head trip.
17:54amalloySchuyler: and i do mine in php. you'll get used to it, and clojure is worth it
17:54Schuylerhowever, I'm reaching a point where Python isn't performant enough, and my coworkers don't want me to use C++.
17:54Schuylerand I don't want to use Java ;-)
17:55ossarehSchuyler: what are you writing that a language determines the performance?
17:55pdkyour coworkers are wise
17:57ossareha buddy of mine recently had to port what amounted to a mobile web browser from java to c++ because dalvik blows chunks for graphics (consider flick scrolling a page), but that was the only time that I could think there was a real difference in the performance of the language.
17:59Schuylerossareh, just real CPU intensive computational geometry stuff.
17:59ossarehSchuyler: huh.. cool - so clojure 1.3 is likely to be of interest to you then
17:59Schuylerhow come?
18:00pdkor the alpha of it at any rate
18:00ossarehSchuyler: it has a lot of native math stuff added to it so you don't suffer from the boxing / unboxing overhead.
18:00Schuylerinteresting. do you have a link to relevant docs?
18:04ossarehhttp://dev.clojure.org/display/design/Primitive+Support
18:04Schuylerthanks!
18:05ossarehThat is the rationale - and there is a lot in the google groups discussions
18:05ossarehhttp://groups.google.com/groups/search?q=clojure+primitive+math&amp;btnG=Search&amp;sitesearch=
18:34N8DawgHello group
18:34N8DawgI know its late...
18:35N8DawgHad a question about macroexpand
18:35pdkdo tell
18:35N8DawgCommon Lisp allows you to pass an env block to macroexpand
18:35N8Dawgcannot see a way to do that in Clojure
18:36Chousukethere's no such thing AFAIK
18:36brehautN8Dawg: that is the case
18:36N8Dawgnot sure i understand, you can access an env block from within a macro
18:36N8DawgClojure supports that I know
18:37N8Dawgso what you're saying is I cannot lexically expand a macro on demand
18:37N8Dawgdrat :(
18:39brehautN8Dawg: ithink ive missed something, but macroexpand doesnt eval the result, so you can still see symbols that would come from the lexical enviroment?
18:40N8Dawg(defmacro test1 [] (println &env))
18:41N8DawgIf you run it... you get nil as expected:
18:41N8Dawg(test1)
18:41N8Dawgnil
18:41N8Dawgbut run it inside a let block:
18:41N8Dawg(let [a 1] (test1))
18:41N8Dawg{a #<LocalBinding clojure.lang.Compiler$LocalBinding@4cb17167>}
18:41N8Dawgas expected
18:42N8Dawglastly:
18:42N8Dawg(let [a 1] (macroexpand '(test1)))
18:42N8Dawgnil
18:44N8Dawgdunno if that makes sense
18:44brehautN8Dawg: i see what you mean now
18:45N8Dawgthats wy common lisp lets you supply an ooptional env block to macroexpand
18:45N8Dawgi think...
18:46brehaut$source defmacro
18:46sexpbotdefmacro is http://is.gd/cDqC1Q
18:48N8Dawgdefmacro defines an implicit env block
18:48N8Dawgwhich is provided by the system when the macro is called
18:50N8Dawghttp://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_macroexpa_acroexpand-1.html
18:55N8Dawgi better head off
18:55N8Dawgbut thanks for the responses
19:20ossarehhow do I unextend a protocol?
19:22hiredmanyou don't
19:53mattmitchellis it possible to create a macro, that contains raw html?
19:54pdkif the html is in strings it should be
19:55mattmitchellpdk: but not like this: https://gist.github.com/805188 :)
19:55ossarehhiredman: thanks - I've taken to destroying the ns's and recreating them as needed.
19:55pdkit's not part of clojure syntax so writing it that directly probably isn't gonna happen
19:56pdkpractically every book that talks about lisp macros gives an example of using them to generate html
19:56pdkyou could take one those, tweak it a bit for clojure
19:56pdkand be able to write stuff like (html (div "text") ...)
19:57mattmitchellpdk: true yeah, that might be the way to go
19:57brehautpdk: a macro? seems a bit overkill. why wouldnt a function work?
19:57pdkpractical clojure i'm fairly sure uses the xml generating example in its macro chapter
19:59brehautpdk https://github.com/weavejester/hiccup/ ?
19:59pdkwell
19:59pdkthen there's hiccup :p
20:00mattmitchellyeah hiccup looks pretty good
20:03mattmitchellanyone know of a good html parser?
20:03brehautmattmitchell: enlive
20:03mattmitchellsomething that has good css/xpath selector support?
20:03mattmitchellbrehaut: enlive can parse too?
20:03brehautmattmitchell: enlive; it uses pseudo css selectors
20:04mattmitchellbrehaut: interesting ok
20:04brehautyes; enlive is clojures all singing, all dancing html solution
20:04mattmitchellbrehaut: :) cool I'll have a look
20:04brehautmattmitchell: dnolen's introductory tutorial shows how to use it to scrap as well as generate html
20:04mattmitchellbrehaut: oh right, i kinda remember seeing that. will dig it up now.
20:05brehautmattmitchell: from memory its selectors are more powerful than css because you can use fns
20:05brehautmattmitchell: https://github.com/swannodette/enlive-tutorial
20:05mattmitchellbrehaut: thanks!
20:07brehautmattmitchell: http://enlive.cgrand.net/syntax.html thats the full (if a little daunting when you havent used it) syntax for selectors in enlive
20:08mattmitchellbrehaut: looks really good.
20:10ossarehmattmitchell: enlive is the shit. I just got turned on to it last week and it has changed my life for the better
20:10ossarehas has discovering ~' !!
20:18mattmitchellossareh: good to know!
20:28gfrlog,(keys (transient {}))
20:28clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.PersistentArrayMap$TransientArrayMap
20:29gfrloganybody know how to get the keys from a transient map?
20:29amalloy&(-> {} transient persistent! keys)
20:29sexpbot⟹ nil
20:30gfrlogamalloy: does that forego the benefits of transients if I convert them to persistents at each step of my inner loop?
20:30amalloygfrlog: my suspicion is that it's impossible on purpose. the keyseq would be doing structural sharing with the transient map, and would therefore be subject to corruption at any time
20:31amalloyperhaps you should reconsider why you want to get a list of all the keys in a map multiple times in performance-sensitive code?
20:31gfrlogperhaps so
20:32gfrlogand I just realized that in my case (keys m) is the same as (range (count m))
20:32gfrlogso that's easy
20:32amalloygfrlog: so it sounds like you want a vector, not a map?
20:33amalloy&(keys [1 6 8])
20:33sexpbotjava.lang.ClassCastException: java.lang.Integer cannot be cast to java.util.Map$Entry
20:33mattmitchell&(doc reduce)
20:33sexpbot⟹ "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well... http://gist.github.com/805238
20:34gfrlogamalloy: man I was about to say "dangit no I need a map because..."
20:34gfrlogamalloy: but of course you're right. I am ashamed.
20:34amalloy*laugh* glad to have helped
20:34gfrlogalthough I'm confused as to why your code failed
20:35gfrlog&([1 6 8] 2)
20:35sexpbot⟹ 8
20:35amalloygfrlog: keys assumes a map
20:38gfrlogamalloy: thanks
20:46gfrlog,(apply partial (repeat partial))
20:46clojurebot#<core$partial$fn__3684 clojure.core$partial$fn__3684@ba372f>
20:46gfrlogawesome
20:47gfrlog,((apply partial (repeat partial)) 10)
20:47clojurebot#<core$partial$fn__3684 clojure.core$partial$fn__3684@9083c1>
20:47mattmitchellis there a way to handle strings without worrying about escaping quotes?
20:48mattmitchelllike heredoc syntax?
20:49amalloymattmitchell: not at the moment. there's a faction who want to add """python style "really long strings" to the language"""
20:50brehautmattmitchell: for future reference http://clojure.org/reader will tell you all the literal syntaxes supported by the reader
20:50mattmitchellamalloy: i see. i'm thinking about blobs of html. maybe not the right fit.
20:50mattmitchellbrehaut: cool that's helpful
20:52tomojwhy do you want blobs of html in your clojure?
20:56mattmitchelltomoj: oh, well i'm just playing around right now! nothing serious. learning etc..
20:58brehautmattmitchell: enlive looks for your templates (and snippets) in your source path
20:58brehautmattmitchell: so its trivial to package them with the rest of a project
20:59brehautmattmitchell: and it lets you find snippets inside your master templates; it makes working with the html as html much much easier
20:59brehaut(because it is just an html)
21:00brehautits a little more work initially to set up, but it pays off in a real project
21:00brehaut(even if that project is small)
21:01mattmitchellbrehaut: yes, enlive is looking like a good match for some of the things i'd like to do
21:04ossarehI'm actually working on something right now that amounts to a CMS - makes heavy use of enlive
21:04brehautmattmitchell: its also not really idiomatic lisp to tunnel other data in strings.
21:05mattmitchellossareh: is it open source/public?
21:05ossarehmattmitchell: I hope to get it there
21:06ossarehmattmitchell: it's not in github yet
21:07mattmitchellossareh: i'm actually kicking around a little project too. something like ruby's jekyll (https://github.com/mojombo/jekyll) -- but with an admin for editing and uploads.
21:07brehautmattmitchell: have a look at github.com/lauJensen/bestinclass.dk before you go too far
21:09mattmitchellbrehaut: nice! are the pages stored on the file system?
21:09brehautmattmitchell: database i think
21:09mattmitchellbrehaut: oh looks like it works with wordpress, interesting.
21:10brehautmattmitchell: i believe its more like the old movable type than jekyll/hyde
21:10brehautits a full web app, but it bakes html pages rather than generating them dynamically
21:11mattmitchellbrehaut: good stuff. i'll dig into it.
22:07kclHas anyone processed a post request using moustache where the content type is "application/vnd.adobe.xfdf"? Can't seem to figure out how to extract the body.
22:11amalloykcl: have you looked at http://partners.adobe.com/public/developer/xml/index_arch.html#dfdf ?
22:11amalloythat is the extent of my xfdf knowledge though, so happy hunting
22:12kclamalloy: Yup. Its actually just xml. I think I'm just missing something stupid here.
22:13kclamalloy: The body in the repl always comes back as org.mort...., with the form-params and query params empty.
22:13kclamalloy: Found something about forcing a mime type change so that it would parse as xml, but that does not seem to work (or I am doing it wrong)
22:15amalloykcl: from what i know of http, you should be able to have your server list the content types it understands
22:16kclamalloy: On the moustache side? I'm trying to capture a post from Acrobat, btw.
22:17tomojmoustache doesn't care, it's ring
22:17kcltomoj: That's what I thought - but how do I get ring to parse it?
22:17tomojyou have a request handy?
22:17brehautamalloy: the client can list the content types it accepts (Accepts header on request), but i cant think of any headers the server can send
22:17tomojwhat's (class (:body the-req)) ?
22:18kcltomoj: #<Input org.mortbay.jetty.HttpParser$Input@2471fd20
22:19tomojok, that's an InputStream
22:19kcltomoj: Right. I think I read that I could slurp* it, but I get nada
22:19tomojoh, maybe someone else has already read the body?
22:20kcltomoj: Could be. I'm fuzzy (obviously!) on the inner workings. :-)
22:20brehautkcl do you have any middleware defined?
22:21kclbrehaut: I'm using wrap-params and wrap-multipart-params
22:21kclbrehaut: I removed them at one point to see if it would help, but it did not. I also tried writing a wrap function to change the content type to application/xml
22:21kclbrehaut: but that did not work either.
22:22tomojso with no middleware, slurping the body still gives you nothing?
22:23kcltomoj: Let me try again. Been at this for a while :-/
22:23ihodestomoj: great first line to read, glancing back at irc
22:24kcltomoj: Still get "" back.
22:24tomojand you're sure the body isn't actually empty?
22:24tomoj:)
22:25kcltomoj: I used a sniffer and it showed the xml in all its glory :-)
22:25tomojyou tried it now on a brand new request, right
22:27kclkcl: Yup.
22:28tomojhuh. your setup reliably picked up changes?
22:28tomojwith no middleware, where could the body go? :O
22:31kcltomoj: :-)
22:31brehautkcl,how are you starting jetty?
22:31kclbrehaut: (run-jetty #'pdf-handler {:port 8080 :join? false}))
22:31brehautapproximately (run-jetty my-app {:port 3000})
22:32brehautok
22:32kclI may have been at this too long. I appreciate the help. I think I need to go watch Castle and dream of pdfs :-)
22:33brehautkcl just one second
22:34kclbrehaut: Ok. I'm tying something here as well...
22:34brehautcan you replace #'pdf-handler
22:34brehautwith
22:35brehaut(fn [{:keys [uri body]] (when (= uri "/your/test/uri/") (slurp body)))
22:35brehautcrap. missed a }
22:35brehaut(fn [{:keys [uri body]}] (when (= uri "/your/test/uri/") (slurp body)))
22:36kclbrehaut: Ok - uri is the local path?
22:36brehautyeah
22:36brehauti only put that in because sometimes the client may make multiple requests
22:36brehautand we want to filter it to only the one we care about
22:36brehautoh
22:36brehautyou want a print around slurb
22:36kclk
22:39brehautive also used the wrong slurp sorry
22:40kclbrehaut: np. working on it
22:44kclbrehaut: I need to do more to try your idea (not set up to handle inferior lisp, etc.
22:44kclbrehaut: I will give it a shot tomorrow and see what I get.
22:45kclbrehaut: (and all others) Thanks for the help!
22:45brehautthe actual work that ring does before it calls your handler is fairly minor
22:45brehautyou should be able to pinpoint the problem more easily from that point
22:46kclbrehaut: I'll give it a shot. Has to be (I hope) something simple I am missing.
22:46brehauthopefully
22:46brehauti need to go cook dinner
22:46kclbrehaut: Have a good one. Wife calling me for Castle. :-)
23:48tomojany gloss users thinking about validation?
23:49tomoja keyword typo means sending half a frame over before hitting an encoding error, breaking the connection
23:53arohneris there a pdoseq or pfor anywhere?
23:56amalloyarohner: ##(doc pcalls) maybe?
23:56sexpbot⟹ "([& fns]); Executes the no-arg fns in parallel, returning a lazy sequence of their values"
23:57amalloyie, ##(apply pcalls (for [x (range 5)] (constantly x)))
23:57sexpbot⟹ (0 1 2 3 4)
23:58arohnerthanks, I didn't know about pcalls, but I don't understand how that example could work
23:58arohneroh right, constantly returns a function
23:58amalloyarohner: right
23:59amalloywrap the functions you want to call up in some kind of thunk, and then pcall them