#clojure logs

2011-11-19

00:29amalloybrehaut: spotted at the conj: a shirt reading "Clojure programmers have more fn"
00:29brehautamalloy: lol :)
00:29jodaroheh
00:31brehautamalloy: re:syntax highlighting of quotes, i decided that italics is a good style for quoted forms, with non-italics for the unquoted subforms in quasiquotes
00:32amalloybrehaut: and `(`(`(foo))) will lean wayyyy to the right?
00:33brehauthaha
00:33brehauti thought about doing something for that but decided not to
00:33amalloyjust rotate the code 90 degrees for every level of quoting
00:33amalloyit'll teach people to stop trying to nest quoting
00:33brehautlol
00:34brehautjust mark it all black on black and change the contents to [REDACTED]
00:34amalloyhah
00:34brehauti think this thing is almost ready to announce on the ML
00:46Raynesamalloy: You had some fairly interesting shirts.
00:47RaynesSadly, my shirts were fairly benign. A family guy shirt that said "Paddle faster, I hear banjos" and another one that said "Those who think they know everything annoy those of us who do."
00:48brehauthmm. i kind of want to highlight deref '@'s the same as functions
00:51amalloybrehaut: having spent about two seconds thinking about it, i don't think i'd want that
00:52amalloyso feel free to input that into your weighted-usefulness model
00:52brehautsure :) im experimenting at the moment
00:54brehauttime to cook dinner
01:10hiredmanhttps://github.com/hiredman/syntax-quote/blob/master/src/syntax_quote/core.clj#L3
01:23RaynesHah, smacros. smackros.
03:13daakuis there a way to resolve a string reference to a qualified symbol like "clojure.string.blank?" without using eval?
03:16brehaut,(symbol "clojure.string" "blank?")
03:16clojurebotclojure.string/blank?
03:17amalloyi think he's looking for resolve
03:17amalloy,(resolve (symbol "clojure.string" "blank"))
03:17clojurebotnil
03:17amalloy,(resolve (symbol "clojure.string" "blank?"))
03:17clojurebotnil
03:17brehautns not imported?
03:17amalloyapparently
03:18brehaut,(resolve (symbol "clojure.core" "when"))
03:18clojurebot#'clojure.core/when
03:18daakuthanks all, resolve + symbol does the trick
03:21alex_baranosky,(resolve (symbol "clojure.core" "reductions"))
03:21clojurebot#'clojure.core/reductions
03:36TamytannHi
03:36TamytannIs there any live?
03:37Tamytanndoc lis
03:37Tamytann(doc list)
03:37clojurebot"([& items]); Creates a new list containing the items."
03:38amalloy~anyone
03:38clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
03:43TamytannHi clojurebot
03:44Tamytann(+ 2 4)
03:44clojurebot*suffusion of yellow*
04:15Tyuio(doc partial)
04:15clojurebot"([f arg1] [f arg1 arg2] [f arg1 arg2 arg3] [f arg1 arg2 arg3 & ...]); Takes a function f and fewer than the normal arguments to f, and returns a fn that takes a variable number of additional args. When called, the returned function calls f with args + additional args."
05:30mbachola
08:58pauldoois there an easy way to convert a javascript object to a human friendly string in clojurescript? (str foo) just says "Object"
09:14fliebelWhen do you use meta data? I feel like it's one of the Clojure gems I'm not making use of. Most often I feel it is easier to just return a vector or map rather than something with meta.
09:15fliebelAnd then there is still the problem of strings and numbers not supporting meta at all.
09:32fliebelWhat happens when you recur into a multimethod? It'll go *boom*, right?
09:36pauldooit'll work, but you can only recur into the same exact function, ie you won't get the dynamic dispatch
09:36pauldoo(I *think* this is true, but you should try it. my memory is hazy)
10:20shtutgartis there 'reset' equivalent for the alter-var-root?
10:54Saturnationhow do you create a URL[] in Clojure?
11:04brett_hSaturnation: http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/make-array
11:05Saturnationthanks
11:05Saturnationjust found add-classpath, which is ultimately what I'm wanting to do
11:05Saturnationand notices that it is deprecated as well :(
11:11SaturnationI really just want to add additional local classpaths to Leiningen...
11:41fliebelI got a weird exception. If I call a function from the repl, with seemingly the same values, it works, but in some other place it does not. I inserted a print statement right vefore it and the arguments are right. http://pastebin.com/j1c3Rdgz
11:52fliebelah, solved it. I was doing something silly of course.
12:05mars42a question about core logic - is it suitable for solving simple algebraic equations (eg y=a+b with some unknowns)?
12:05mars42(i dont want a solution, just want to know whether to bother trying)
12:08ejacksonmars42: nope, it needs the cKanren stuff to be able to do that. But its coming.
12:09mars42ejackson: thank you - look forward to that :)
12:09ejacksonyeah, I'm stupidly excited about that.
12:15mars42ejackson: any ETA or is it going to be a while yet
12:20fliebelmars42: dnolen or ambrosebs might be able to tell you that, if anyone.
12:24ambrosebscKanren FTW
12:25ambrosebsmars42: AFAIK the port isn't hard
12:25ambrosebscKanren is a clean extension of minikanren
12:26ambrosebsI'm still going through the cKanren paper
12:26ambrosebsDavid has a good idea of what is required
12:27mars42ambrosebs: thanks for the info!
12:28Saturnationambrosebs, back in warmer Perth? :)
12:28ambrosebsgood to be home :)
12:28SaturnationSeriously considering moving back to Australia soonish
12:28ambrosebswhere are you from?
12:28ambrosebsi just slept 3pm-11pm
12:29ambrosebsi think i've got a while to adjust!
12:29SaturnationBrisbane, spoke to you at the Conj briefly, tall guy with a slightly American accent :)
12:29Saturnationcurrently living in northern Vermont...
12:29mdh```wouldn't mind some brissy time
12:31ambrosebsit felt like every 4th person I talked to was Australian!
12:32SaturnationI thought you said there were only 4 there? :)
12:32ambrosebsmust have been 4 travelled specifically
12:32shtutgartWhy don't keywords implement IObj? I'd love to add metadata to them
12:33ambrosebshad to have been at least 10 of us
12:33hiredman:f is always the same object as :f, so how would you store metadata on one :f but not another?
12:33mdh```shtutgart - metadata wouldn't be quarantined by package (is my guess)
12:34hiredmanmdh```: clojure doesn't have packages
12:34mdh```urr namespace
12:34hiredman,(identical? :f :f)
12:34clojurebottrue
12:34hiredman,(identical? ::f ::f)
12:34clojurebottrue
12:35hiredman,(identical? 'f 'f)
12:35clojurebotfalse
12:35hiredmanso symbols can have metadata
12:35mdh```ah, indeed
12:37shtutgarthiredman: well, then why keywords are the same object? Is it possible to have, say, different, but equal objects for :foo and ^:qux :foo?
12:38hiredman:foo is the same object as :foo for a number of reasons, the big one is fast equaity checks
12:39mdh```other lisps applly that semantic to symbols as well, (identical? 'f 'f) -> false is a clojureism
12:41kralhi
12:43shtutgartok, thanks for explanation. Too bad it's impossible - it'd allow me to have some nice syntax
12:43kralhi pals
12:45shtutgartkral: hello
12:48kralfirst time here, I've been studying clojure for a month
12:49kralbut I've done a little lisp in the past
12:50shtutgartcool :) feel free to ask your questions
12:53kralI'm going to rewrite my website in clojure, so I think that I'll do a lot of questions :)
12:53kralty anyway
13:13frankieboy,(+1 2)
13:13clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
13:16goodieboyi'm playing around with macros today, and i'm wondering if it's possible to use ^ without clojure evaluating it as metadata?
13:18foodooCan you define default functions for types that can not be cast to IFn? Take the following expression: (1 < 2); 1 can not be cast to a IFn. But let's suppose the expression is implicitly used as an input to the function (defn f [obj f & args] (apply f obj args)); Is this possible in clojure? Or would this require a reader macro?
13:18devn speech recognition software in the terminal does not work so well.
13:24foodooI mean used as the input to the function (fn [obj f & args] (apply f obj args))
13:26Sindikathello everyone
13:27Sindikatusing clojure with Emacs and swank-clojure. when i try to compile a code having '(use 'clojure.contrib.prxml)' string, it throws 'error: java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate clojure/contrib/prxml__init.class or clojure/contrib/prxml.clj on classpath:'. i've installed clojure-contrib on Ubuntu
13:29foodooSindikat: are you using Clojure1.2 or Clojure1.3?
13:30SindikatUbuntu automatically installed clojure-1.2 as dependency
13:31foodooSindikat: okay. There are several clojure-contrib packages that are not compatible with 1.3. But that doesn't seem to be your problem. I suppose you installed everything with premade packages?
13:31Sindikati think so
13:32foodooAre you familiar with Java? Check your CLASSPATH variable. That's where Java (and therefore Clojure) searches the classes
13:33Sindikatno experience with Java on unices. my env variable is empty
13:34kephalein clojure repl you can do: (println (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))))
13:35Sindikatit gave me (#<URL file:/usr/share/java/clojure-1.2.1.jar>)
13:36foodooyou need to add the clojure contrib libraries to your CLASSPATH
13:36foodoobecause now you only have clojure on it
13:39Sindikatfoodoo: how can i do that?
13:42kephaleSindikat: is there a reason you aren't using leiningen?
13:43Sindikatkephale: well i created a project with it
13:45kephaleSindikat: try following the Usage section here: https://github.com/technomancy/swank-clojure
13:45kephaleyou might need to also call "lein deps" in the project directory
13:45Sindikathmm, that's what i do
13:46kephaleassuming that clojure-contrib is listed as a dependency inside your project.clj
13:49Sindikatoh, naughty Slime overrided my M-n
14:15devnHello everybody! How goes the clojuring?
14:32devnamalloy: ever figure out the problem you and i were looking at?
14:42amalloydevn: no, i think there are just so many contexts in which the level to which you can hoist is unclear. i'm putting it aside again; maybe someone will write a purity inferencer i can use :P
14:43devn:)
15:04TimMcdevn: I think I have cubital tunnel syndrome... so not that great.
15:04gfredericksTimMc: isn't there a macro for that?
15:05TimMcYes, it's called M-x surgery
15:05TimMcand lots of Ibuprofen.
15:08amalloyTimMc: foot pedals!
15:09TimMcMaybe that + a one-handed keyboard.
15:10kephalefacial recognition: smile for meta
15:10gfredericksTimMc: there are one-handed dvorak layouts
15:14theignoratihow do I swap 2 elements in a Java array?
15:14amalloykephale: genius. just give a twisted look of disgust and emacs will type in (flatten ...) for me?
15:14TimMcMaybe I should just get one of those EEG thingies.
15:15amalloytheignorati: aget/aset
15:15kephaleamalloy: exactly!
15:16devnTimMc: is it your mousing hand?
15:17devnTimMc: Are you using dragon dictation or anything like that?
15:19TimMcMousing.
15:20TimMcWell, no. It was, I switched hands.
15:20amalloyTimMc: put your mouse in another room. i went without a mouse for a month; it's good for your hands and will help you learn to avoid it when you don't need it
15:21TimMcI thought it was carpel tunnel, then a doctor said tendonitis in my forearm, but I just noticed that my right ulnar nerve feels like spaghetti.
15:21TimMclike, multiple pieces
15:21theignoratiamalloy, what if it's an array of chars?
15:21amalloythen use aget and aset
15:21TimMcand according to the internets, my ulnar nerve *shouldn't* pop out of that groove when I bend my arm.
15:22theignoratiwhat's wrong with (aset (.toCharArray "foofoofoofoofoo") 2 "x")
15:22amalloy"x" isn't a character
15:23theignoratiof course
15:23theignoratithanks
15:25duck1123`TimMc: I just got over the same thing in my left wrist
15:25duck1123`makes using emacs hell
15:29gfredericksamalloy: wrt mouselessness, you use mac?
15:29amalloylinux
15:30TimMcI use Eclipse at work. It cuts down on keystrokes in some ways (autobuilding and in-memory patching) but requires more mousing.
15:31gfredericksamalloy: what window manager?
15:31TimMcThere's really no alternative for Java.
15:31amalloygfredericks: a pretty stock ubuntu 10.04, so i guess gnome?
15:31duck1123`Macs will spit in the face of anyone that tries to go without a mouse. "Here's a dialog for you. good luck dismissing it"
15:32amalloyTimMc: it's true, using anything but eclipse is terrible. and you probably have to use the mouse sometimes, but i suspect not as often as you think - there are keyboard shortcuts all over the place
15:32gfredericksamalloy: do you do web browsing mouseless?
15:33amalloygfredericks: i *can*, and did during my mouseless period. normally i use the mouse to click on links but the keyboard to scroll
15:33duck1123`Conkeror is pretty good, but it's no replacement for Firefox most of the time
15:34gfredericksamalloy: I imagine the mouseless browsing experience can vary wildly between websites?
15:35amalloygfredericks: not that much, iirc
15:36duck1123For firefox: https://addons.mozilla.org/en-US/firefox/addon/lol/
15:36amalloythere are some clever cheats to avoid having to tab through all the links on a page, for example
15:45TimMcamalloy: Like incremental link search?
15:45amalloyTimMc: that would be handy as a real feature. i just faked it with chrome's search bar
15:46TimMcamalloy: ' on Firefox
15:46amalloyi'm still waiting for them to rerelease firefox 2
15:47TimMc?
15:49TimMcYeah, it's kind of sad.
15:52brehautamalloy: thats ok, there will be another one in 10 minutes
15:55gfredericksChangelog: Reverted to firefox 2
15:56pandeirowhy doesn't name resolve keywords with '/' in them to their full value?
15:58brehautpandeiro: namespaces
15:58pandeirochromium with the vimium plugin is great for mouseless browsing btw... easy to select any link, button, etc
15:58pandeirobrehaut: any way around that?
15:58gfrederickspandeiro: ##(str 'user/foo)
15:58lazybot⇒ "user/foo"
15:58gfredericksoh wait keywords
15:59gfredericks,(str :user/foo)
15:59clojurebot":user/foo"
15:59pandeiroah ok i can resolve them like that then, thanks gfredericks
15:59gfredericks(-> :user/foo str (subs 1))
15:59gfrederickspandeiro: yep
15:59Raynes&(namespace :user/foo)
15:59lazybot⇒ "user"
16:00gfredericks&(namespace (keyword "foo/bar/baz"))
16:00lazybot⇒ "foo/bar"
16:01amalloy&(apply str ((juxt namespace name) :foo/bar))
16:01lazybot⇒ "foobar"
16:01amalloyhrmph
16:01pandeiro; &((fn [k] (str (namepsace... nevermind amalloy wins
16:02gfredericks&(apply str ((juxt namespace (constantly "/") name) :foo/bar))
16:02lazybot⇒ "foo/bar"
16:02pandeirothanks guys
16:02Raynes&(clojure.string/join "/" ((juxt namespace name) :foo/bar))
16:02lazybot⇒ "foo/bar"
16:02Raynesamalloy: ^ lrn2code
16:02gfredericksRaynes: mine had an extra HOF in it
16:03amalloyhaha confession time: i thought of gfredericks's solution but not Raynes's
16:03brehaut&(apply format "%s/%s" ((juxt namespace name) :foo/bar))
16:03lazybot⇒ "foo/bar"
16:03gfredericks&((comp (partial apply str) (juxt namespace (constantly "/") name)) :foo/bar)
16:03lazybot⇒ "foo/bar"
16:04pandeiro&((fn [k] (str (namepsace k) "/" (name k)) :js/app.js)
16:04lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
16:04pandeirolol yeah
16:04gfredericksunreadable point-free code FTW
16:04pandeiro&((fn [k] (str (namepsace k) "/" (name k))) :js/app.js)
16:04lazybotjava.lang.RuntimeException: Unable to resolve symbol: namepsace in this context
16:04pandeirodaaah
16:04pandeiro&((fn [k] (str (namespace k) "/" (name k))) :js/app.js)
16:04lazybot⇒ "js/app.js"
16:06pandeiro&((fn [k] (str (namespace k) "/" (name k))) :js/lib/app.js)
16:06lazybot⇒ "js/lib/app.js"
16:06brehautgfredericks: ##((comp str (partial apply symbol) (juxt namespace name)) :foo/bar)
16:06lazybot⇒ "foo/bar"
16:06brehautreadable point free
16:07brehautvia egregious hack
16:08gfredericksbrehaut: I'm not sure what to think of that
16:08gfredericksbrehaut: at least seven points for not needing the "/" literal
16:08xenocorphey
16:08gfredericksxenocorp: hey
16:09xenocorpDoes anyone have any pointers for getting started? Which IDE/Worflow ?
16:09xenocorpworkflow*
16:09brehautgfredericks: but minus a lot for the misuse of an interstitial symbol?
16:09gfredericksbrehaut: only -3
16:09xenocorpI've spent 5 hours trying to get Emacs configured and I think I'm literally just too stupid for it
16:09brehautxenocorp: http://dev.clojure.org/display/doc/Getting+Started
16:10brehauttheres a bunch of sub pages for specific enviroments
16:10xenocorpThanks a lot
16:12robbe-Hendrik, hoi
16:12robbe-oops
16:17gfredericksbrehaut: out of curiosity, what is a valid use for an interstitial symbol?
16:17brehautresolving something?
16:19brehautwoo
16:19brehautpiles of javascript worked in IE without fault
16:21BahmanHi all!
16:24amalloybrehaut: i was unaware that cheat codes worked in real life, but there is no other explanation
16:25brehautamalloy: it is possible i have had some food related hallucinations
16:25brehautits more believable than this anyway
16:36samaaron,(+ 2 3)
16:36clojurebot5
16:36Raynessamaaron: I hate you. :<
16:36samaaronRaynes: that's slightly harsh
16:37Raynessamaaron: Your convo with cemerick got posted first and I had my convo with him waaaaaaaaay earlier that day. What makes you so special? That fancy accent? I can do that as well, you know.
16:37samaaronRaynes: it's probably because i was wearing blue shoes
16:37RaynesReally? Damn. I can't compete with that.
16:38samaaronRaynes: read it and weep buster
16:38samaaronbtw, did you enjoy the conversation?
16:39RaynesYou're assuming I listened to it.
16:39RaynesNo, I actually did. It was fun. :)
16:39samaaron:-)
16:40samaaronshould i bother listening to yours when it's released?
16:40RaynesProbably not.
16:40samaaronok, thanks for the advice
16:40RaynesIt is much shorter and orders of magnitudes less interesting.
16:41samaaronwe can beef it up with some exciting overtone bumpers
16:41RaynesAbsolutely.
16:41samaarondo you have a style of music in mind?
16:41RaynesAnything that comes out of overtone is an instant hit.
16:42amalloysamaaron: he likes to listen to really crappy music, so see if you can make some
16:42samaaronamalloy: crappy i certainly can do
16:42samaaronit'll be as crappy as a pint of bacon
16:42RaynesI only listen to the best music.
16:43samaaronRaynes: right
16:48Raynessamaaron: You used to play with Ioke, didn't you?
16:49RaynesI seem to recall a Sam Aaron from the mailing lists.
16:50samaaronRaynes: yep i did
16:50samaaroni really enjoyed what ola was doing with that language
16:50RaynesI did everything short of attack Ola Bini at the Conj. I think I may have forced him to shake my hand.
16:51samaaron:-)
16:51samaaronyou should have stolen his hat
16:52RaynesI believe I commented on how he always looked really, really cool.
16:52RaynesHe looks like the kind of fellow that rolls out of bed in the morning looking cool.
16:52RaynesBorn with a pair of sunglasses and black nail polish.
16:52samaaroni believe he was wearing blue nail polish at the conj
16:52RaynesIt looked very black.
16:52RaynesBut I didn't exactly examine his fingernails.
16:53samaaron:-)
16:54samaaronRaynes: so are you going to have a go at making the bumpers for your cemerick convo, or would you like me to have a go?
16:54RaynesYou!
16:54samaaronok
16:55samaaroni'll make it sound like a ring tone interupting your presentation
16:55fliebelsamaaron: You know what still bothers me? Macros. I have no real right-of-speech since I still have not read the source, but overtone is full of macro, while it does not *seem* to do any fundamentally macro-y business.
16:55samaaronfliebel: patches improving the situation will be happily considered
16:56RaynesHah
16:56samaaronfliebel: but we do require macros in some scenarios - either that or the use of eval
16:56fliebelsamaaron: why? (if it can be explained in a sentence or two)
16:56technomancycan someone explain to me why it's considered acceptable by some to check in your .classpath file from eclipse so others can use it?
16:57RaynesSee clojail
16:57technomancythat just sounds like a horrible horrible idea
16:57samaaronfliebel: because of the way we do local bindings
16:57Raynessamaaron: Where did you get your overtone stickers?
16:58samaaronRaynes: I made them using an online tool
16:58RaynesI'm considering making some clojail stickers.
16:58RaynesJust because.
16:58samaaronRaynes: from these guys: http://us.moo.com/products/stickers/
16:58samaaron(although I used the UK branch)
16:59samaaronfliebel: there are cases where I'd like to make non-macro versions of the functionality though
16:59samaaronRaynes: do you have a clojail logo?
16:59fliebelsamaaron: I'm lost in the files. Where si thins binding thing located?
17:00Raynessamaaron: Sadly, no. I think the closest I've got is the clojure-in-a-jail-cell image from my talk.
17:00fliebel(ok, I can;t type anymore, I should sleep)
17:02samaaronfliebel: look for with-overloaded-ugens
17:02RaynesI can't do graphic design. At all.
17:03fliebelsamaaron: thanks, I'll read a bit. good night :)
17:03samaaronfliebel: sleep well
17:05fliebelsamaaron: ah, so it is for making (+ ugen ...) work?
17:05samaaronfliebel: yup
17:06samaaronand we also use macros to allow the defsynth symbol-default bindings to be declared
17:06fliebelsamaaron: So what happened to contrib.generic.arithmic, or what was it?
17:06samaaronmaking the symbols control proxies as well as binding their internal use inside the synth body to the newly created control proxies
17:07samaaronfliebel: we were using that because it provided multi-method versions of the standard math operators
17:09samaaronbut now we just create our own dispatch fn which considers the arguments of the overloaded fns and either calls the original or our special new fn
17:10fliebelsamaaron: Okay, thanks for the explaination. I'll just have to read the code someday.
17:11Raynessamaaron: Did you make the Overtone logo?
17:12fliebelI think jeff did that... wow, it's ascii-fied
17:15RaynesAn awesome clojail logo would be the Clojure logo with a chain wrapped around it and a padlock hanging off the front. Maybe some red horns in there somewhere as well.
17:16alex_baranoskyRaynes: I think the horns might be cross-mojinating your imagery
17:16RaynesFair enough.
17:17RaynesJust the chain would be fantastic. Nice fat padlock.
17:17alex_baranoskymaybe a black and white clojure logo, with the chain
17:17alex_baranoskyor some other form of jail stripes
17:17alex_baranoskyI'm brainstorming mostly
17:18RaynesRight. Maybe instead of a padlock, it could be a ball and chain.
17:18technomancywhat if you had a ball and chain but instead of a ball it was ...
17:18technomancythe clojure logo.
17:18samaaronRaynes: no, Jeff Rose's brother made the overtone logo
17:18Raynestechnomancy: But then what would the chain be holding down? :<
17:19technomancywell actually logos that are a direct derivative of the clojure logo are on shaky ground wrt trademark law, so maybe that wouldn't work anyway
17:19samaaronI did the asciification of the Overtone logo
17:19technomancyoooh, hand-asciified? how artisinal. =)
17:20alex_baranoskysamaaron: yeah that's a lost art.
17:24RaynesI am pretty certain that Clojure and I just broke Github's API.
17:25RaynesCreated a repo with my new Github API library and then edited it as well. https://github.com/Raynes/edited-tentacles-test <-- teh brokes.
17:25alex_baranoskynice you're taking down the big boys
17:25RaynesI actually did it twice with two different repos. Happened both times.
17:25alex_baranosky~tentacles
17:25clojurebotCool story bro.
17:25k9quainttentacle rape
17:26samaarontechnomancy: alex_baranosky: Hopefully we can keep the craft going
17:27samaaronespecially now I've discovered JavE: http://www.jave.de/
17:28jblomoi'm generating a class with :gen-class and I'd like to call a static method on 'this'. it looks like I can't just use GeneratedClass/method because GeneratedClass isn't defined yet
17:29amalloyjblomo: ...just call a function
17:30jblomoi'd like to call a static method that is defined in the generated class's parent
17:30jblomoi guess I could just refer to the parent
17:35erlukoConsider (map #(/ 1 %) l). If l contains any zeros, an exception will be thrown when the lazy seq is forced. Is there any way to establish and exception handler at the time the lazy seq is created rather than relying on having a try/catch anywhere it might be forced?
17:36pandeirois there something like juxt that would take a collection of functions rather than individual arguments?
17:36erlukoClearly the code is just an illustration. I'm not trying to find reciprocals here, just looking at exception handling and laziness.
17:36amalloypandeiro: apply juxt
17:36pandeirofunctional programming, my name is pandeiro
17:38alex_baranoskyerluko: you can force the eager execution of the sequence using `doall`
17:38alex_baranoskythen catch the exception right there
17:38amalloy(map #(try ...) ...)
17:38theignoratiis there a more efficient way of doing (zipmap (keys bad-map) (map #(if (= String (type %)) (.trim %) %) (vals bad-map))) or is this ok?
17:41erlukoalex_baranosky: I'm looking for something applicable to lazy seqs that keeps them lazy.
17:42erlukoamalloy: still doesn't feel quite right, but may be the best there is at the moment
17:43RaynesI don't know -- seems pretty right to me.
17:44amalloyerluko: someone has to be able to handle the exception, at the time the code is executed. so either you wrap the forcing code in a try/catch, or you wrap the generating code
17:44technomancy(map (wrap-try #(/ 1 %)) l)
17:49erluko(doc wrap-try)
17:49clojurebotGabh mo leithscéal?
17:50alex_baranosky,(doc wrap-try)
17:50clojurebotCool story bro.
17:52erlukoI've been playing with some samples to find out how much early-exit from reduce and its kin would matter. So far it looks like it could have a large impact, even with my (flawed, exception-based) implementation. This lead me down the path of generalizing the test which injects exception throwing to trigger early exit. It worked until I hit lazy-seqs.
17:52erlukoI'll have to try a different approach
17:52amalloytechnomancy: that's what you get for extemporizing
17:53amalloyalex_baranosky, erluko: technomancy's point was you could write something like (defn wrap-try [f] (fn [x] (try (f x) (catch Exception _ nil))))
17:53alex_baranoskytheignorati: maybe use a map utility function such as: https://github.com/AlexBaranosky/Utilize/blob/master/src/utilize/map.clj#L47
17:54erlukoamalloy: thanks for clarifying. It was so similar to the code that lead me here that I didn't see it.
17:54amalloya little too specific, though, so perhaps (defn wrap-try [f default] (fn [& args] (try (apply f args) (catch Throwable _ default))))
17:54erluko,(shortcut :return (reduce (fn[a b] (if (> a 5000000) (:return a) (+ a b))) 0 (range)))
17:54clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: shortcut in this context, compiling:(NO_SOURCE_PATH:0)>
17:54erlukoexample
17:55amalloyerluko: augh don't use exceptions to early-exit from reduce
17:55amalloyjust use reductions, and tell it to stop when you want to
17:55erlukoI said it was ugly.
17:55erlukoIt's also much faster than reductions
17:56erlukoI'm exploring the potential benefit of the early-exit proposal, not writing the implementation.
17:56alex_baranoskytheignorati: so (map-vals bad-map #(if (= String (type %)) (.trim %) %))
17:56amalloysomeone proposed it?
17:56erlukoRich mentioned it at the conj
17:56erlukoThere's been talk about it in Haskell. Oleg has an implementation, I believe.
17:56theignoratiok thanks
17:57amalloyalex_baranosky: c'mon, you have the whole useful library available: (map-val bad-map (to-fix string? (memfn trim)))
17:57alex_baranoskyamallloy: nice
17:58theignoratiright string? that was dumb
17:58erluko{:shortcut "Elapsed time: 667.912 msecs" :reductions "Elapsed time: 5803.432 msecs"}
18:04technomancyevery time I read brehaut's blog I feel like I'm getting my daily dose of vitamin C
18:04technomancyjust by looking at it
18:04alex_baranoskytechnomancy: where is brehaut's blog?
18:04technomancyalex_baranosky: http://brehaut.net/blog/2011/clojure_brush
18:07alex_baranoskytechnomancy: thanks
18:15chousertechnomancy: yeah, that page tastes like Tang
18:16samaaronit's practically effervescent!
18:17erlukoAnyone interested in the early-exit stuff: https://gist.github.com/1379512
18:51devn:)
19:08justin`Anyone know how to get the location used for tempfiles in Ring?
19:09justin`or does it always just use /tmp/ ?
19:10amalloywhat does ring need temp files for?
19:10justin`file uploads
19:10justin`I think I figured it out actually
19:11justin`didn't realize there was a createTempFile method for java.io.File
19:28amalloywow, i just realized how clojure.core/assert-args works. that is some sneaky business
20:04gfredericksamalloy: it seems straightforward...am I missing something?
20:04amalloygfredericks: how does it get the name of the form?
20:05gfredericksha -- I skipped the exception code cuz I figured it was boring and predictable :)
20:06gfredericksoh man -- so it's emitting an &form which refers to the outer defmacro whatsitmajig?
20:07amalloyexactly
20:07gfredericksso that means assert-args is only useful when defining macros, not functions?
20:07amalloyi suppose that's true
20:08gfrederickswell that was an enjoyable tidbit. thanks.
20:13daakui seem to be getting a DB exception in korma.core/insert, but can't seem to catch it: https://gist.github.com/a6ee0899a1c1b587450f
20:14daakuits probably being logged not thrown, but not sure why korma would not throw by default :/
20:20sridany go players here?
20:41Saturnationproject.clj is just a Clojure, right? So I can evaluate within that to define the project?
20:42gfredericksSaturnation: looks like it
20:42gfredericksI just replaced my project version with (str "foo" "bar") and it accepted it
20:43SaturnationOK, so my issue appears to be something else then, thanks :)
20:45gfredericksSaturnation: `lein pom` might help you debug your project.clj?
20:51Saturnationthanks, all look into tomorrow. Just happy that I've got all the extra-classpath-dirs working at the moment
21:06amalloyproject.clj doesn't all get evaluated, exactly. it's a little more complicated
21:08amalloythe truth is closer to "none of it gets evaluated", except that you can unquote stuff if you want it to be evaluated
21:40Saturnationamalloy, unquote stuff?
21:40amalloy~
21:40clojurebotI don't understand.
21:41amalloy(defproject myproj "1.0" :dependencies ~(conj [] [clojure (read-version-from-disk)]))
21:41SaturnationI was hoping that I could programmatically define my vector for :extra-classpath-dirs, but it didn't really seem to like that
21:41Saturnationah, I think that makes sense now
21:44Saturnationsweet, that worked as expected, thanks amalloy
21:44Saturnationnow I can dynamically read in the java project dependencies and it will just work with leiningen :)
22:33brehautseancorfield: ping?
23:34daakutechnomancy: :require for life?
23:34technomancyyou know it
23:35technomancyis it totally terrible for a function to use one of its own arities as a reducer?
23:36daakuwhy not letfn?
23:37amalloyi don't think so, but i'm also not sure i know what you're asking
23:37daakualso, why not :use?
23:38technomancydaaku: http://dev.clojure.org/jira/browse/CLJ-879
23:39daakuoh, does :only not do what i think it does?
23:39technomancydaaku: the problem isn't :only, it's what happens when :only is absent
23:40daakuah, i didn't realize :refer was like :only
23:40daakudoes that exist in 1.3?
23:42technomancyI don't think so
23:42technomancyit's just not common since it's not useful on its own
23:45phdpHi, I'm having a small problem with the REPL. I installed Clojure and Lein from source (roughly with this guide: http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html) but when I press on an arrow in the REPL I get, e.g.: user=> (+ 1 2^[[D^[[D^.
23:45lazybotThe riddell.us tutorials are much more highly-ranked on Google than they deserve to be. They're old and way too complicated. If you're trying to install Clojure...don't! Instead, install Leiningen (https://github.com/technomancy/leiningen/tree/stable) and let it manage Clojure for you.
23:46technomancylazybot: botsnack!
23:46technomancyphdp: try installing rlwrap
23:47phdptechnomancy: Ok thanks!