#clojure log - Oct 13 2011

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

0:00 technomancy: because it returns false for some listy things

0:00 dsantiago: Then why do they both exist?

0:01 technomancy: dsantiago: a lot of useful predicates got promoted from contrib together, and list? snuck in. but it shouldn't be in clojure.core; it's very misleading

0:01 dsantiago: No, I mean why do both clojure.core.PersistentList and clojure.core.Cons both exist?

0:01 technomancy: one's PersistentList is counted; Cons isn't

0:01 but caring about the difference is like caring about array maps vs hash maps

0:02 dsantiago: I know, I'm trying to understand Clojure's code. Why does it return one sometimes and the other other times?

0:03 amalloy: when it has the list as a source-code literal it usually uses a list

0:03 but consider, eg, ##(let [x 1] `(+ ~x 2)) - it has to cons a bunch of stuff together to get the list you want

0:03 lazybot: ⇒ (clojure.core/+ 1 2)

0:04 amalloy: and especially ##(let [elts (range 5)] `(+ ~@elts))

0:04 lazybot: ⇒ (clojure.core/+ 0 1 2 3 4)

0:05 dsantiago: And it can't do that with a list and conj?

0:06 amalloy: not really? what list would it conj to?

0:07 i mean, for this example, maybe. but `(+ ~@foo 10), and lots of more complicated forms, it's a waste of time to try to optimize for list-y-ness

0:07 since these forms are generally just fed back to the compiler anyway, which doesn't care

0:08 dsantiago: I feel like I'm missing something big, if that is an explanation for why both data structures are needed.

0:11 amalloy: it's not, i think. you asked why it sometimes returns one and why another

0:12 they both exist so you can choose what tradeoffs to make, i think? you can have conj-to-front with or without being Counted

0:17 but mostly lists are just seqs with some slightly different performance characteristics; you should usually care whether something is a seq, not a list

0:17 dsantiago: Right, I get that.

0:17 Just trying to understand the compiler.

0:31 brehaut: ,(map #(class (partial cons)) [nil ())

0:31 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>

0:32 brehaut: ,(map #(class (partial cons)) [nil ()])

0:32 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval51$fn>

0:32 roodytood: The plant then took the guano molecule into it's root... going up it's stalk or shoot it deftly

0:32 turned into a pollen grain, swept up by a bee taking it to it's nest

0:32 The nest gave birth to a larvae, which turned into a pupae, and finally into an adult bee

0:32 They see me mowin' my front lawn

0:32 I know they're all thinkin' I'm so

0:32 White and nerdy

0:32 Think I'm just too white and nerdy

0:32 Think I'm just too white and nerdy

0:32 Can't you see I'm white and nerdy

0:32 Look at me, I'm white and nerdy

0:32 I wanna roll with the gangstas

0:32 But so far they all think I'm too

0:32 White and nerdy

0:32 Think I'm just too white and nerdy

0:32 Think I'm just too white and nerdy

0:32 I'm just too white and nerdy

0:32 Really, really white and nerdy


0:32 They see me mowing my front lawn

0:32 I know they're all thinking I'm so

0:32 White and great at math and science but socially unskilled and

0:32 unaccepted

0:32 Think I'm just too white and nerdy

0:32 Think I'm just too white and nerdy

0:32 Can't you see I'm white and nerdy

0:32 Look at me, I'm white and nerdy

0:32 ANSWER ME!\

0:32 I want to go places with the gangsters

0:32 But so far they all think I'm too

0:32 White and nerdy

0:32 Think I'm just too white and nerdy

0:32 Think I'm just too white and nerdy

0:32 I'm just too white and nerdy

0:32 Really, really white and nerdy

0:32 First in my class here at MIT

0:32 Got skills, I'm a champion at D&D

0:32 M.C. Escher, that's my favorite M.C.

0:32 Keep your 40, I'll just have an Earl Grey tea

0:32 My rims never spin, to the contrary

0:32 You'll find that they're quite stationary

0:32 All of my action figures are cherry

0:32 Stephen Hawking's in my library

0:32 I'm the best student here at MIT

0:32 I have got skills, but they are not rapping skills--I'm a champion at

0:32 Dungeons and Dragons, a fantasy role playing game favored by nerds

0:33 When I think of the term "M.C." I don't think about rappers (the

0:33 association cool people would make.) Instead, I think of Dutch artist

0:33 M.C. Escher, whose math related art focused on impossible fantasy

0:33 worlds

0:33 Keep your 40 oz. malt liquor that rappers like, I'll just have an Earl

0:33 Grey tea

0:33 The rims on my car never spin, to the contrary

0:33 You'll find that they don't move

0:33 All of my action figures are in perfect, original condition because I

0:33 don't take them out of the box or play with them

0:33 I have books by astrophysicist Stephen Hawking in my library

0:33 My MySpace page is all totally pimped out

0:33 Got people beggin' for my top eight spaces

0:33 Yo, I know pi to a thousand places

0:33 Ain't got no grills but I still wear braces

0:33 I order all of my sandwiches with mayonnaise

0:33 I'm a wiz at Minesweeper, I could play for days

0:33 Once you've seen my sweet moves, you're gonna stay amazed

0:33 My fingers movin' so fast I'll set the place ablaze

0:33 My MySpace page is wonderfully designed and decorated

0:33 I have got people begging to be one of my favorite friends

0:33 And listen to this! I know pi to a thousand places

0:33 I don't have dental jewelry, like rappers. Instead, I still wear

0:33 braces like a teenager

0:33 I order all of my sandwiches with mayonnaise

0:33 I'm a great at the Minesweeper computer game and I could play for days

0:33 Once you've see how good I am, you're going to stay amazed

0:33 My fingers are moving so fast my keyboard will catch on fire

0:33 There's no killer app I haven't run

0:33 At Pascal, well I'm number one (one)

0:33 Do vector calculus just for fun

0:33 I ain't got a gat, but I got a soldering gun

0:33 "Happy Days" is my favorite theme song

0:33 I could sure kick your butt in a game of ping pong

0:33 I'll ace any trivia quiz you bring on

0:33 I'm fluent in JavaScript as well as Klingon

0:33 Here's the part I sing on...

0:33 duck1123: well, this is going to be in the logs

0:33 roodytood: There's no wonderful computer program I haven't run

0:33 I am the best at computer programming in Pascal

0:33 I do vector calculus just for fun

0:33 I don't have a real gun, but I have got a tool that looks like a gun,

0:33 which I can use to connect pieces together in electronics projects

0:33 "Happy Days" is my favorite theme song

0:33 I could sure beat you in a game of ping pong

0:33 I'll get a high score in any trivia quiz you bring me

0:33 I'm fluent in JavaScript programming language as well as Klingon,

0:33 language spoken by the Klingons (an alien race) on the series Star

0:33 Trek.*

0:33 Here's the part I sing on...

0:33 *Note: Most speakers of Klingon are nerds. not space aliens.

0:33 You see me roll on my Segway

0:33 I know in my heart they think I'm

0:33 White and nerdy

0:33 Think I'm just too white and nerdy

0:33 Think I'm just too white and nerdy

0:34 Can't you see I'm white and nerdy

0:34 Look at me, I'm white and nerdy

0:34 I'd like to roll with the gangstas

0:34 Although it's apparent I'm too

0:34 White and nerdy

0:34 Think I'm just too white and nerdy

0:34 Think I'm just too white and nerdy

0:34 I'm just too white and nerdy

0:34 How'd I get so white and nerdy

0:34 You see me travel on my Segway

0:34 I know in my heart they think I'm

0:34 White and nerdy

0:34 Think I'm just too white and nerdy

0:34 Think I'm just too white and nerdy

0:34 Can't you see I'm white and nerdy

0:34 * amalloy wonders what brehaut was trying to show with that map

0:34 brehaut: ,(map #(class (cons 1 %)) [nil ()])

0:34 clojurebot: (clojure.lang.PersistentList clojure.lang.Cons)

0:35 brehaut: i.e., nothing major, just interesting

0:35 dsantiago: Interesting.

0:35 duck1123: because you can't create a cons with a nil?

0:37 amalloy: &((juxt identity class) (cons 1 (lazy-seq nil)))

0:37 lazybot: ⇒ [(1) clojure.lang.Cons]

0:37 brehaut: duck1123: its particularly curious because () is a PeresistentList$EmptyList

0:37 dsantiago: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L547

0:52 brehaut: 4clojure is indicating that i rely too heavily on point free

0:54 amalloy: brehaut: how so?

0:54 brehaut: I'm still working through all the easy ones, and partial and comp are my default tools

0:54 im sure id be more succinct if just wrote some fns

0:57 * amalloy regrets that 4clojure emphasizes succinctness so strongly

0:58 brehaut: well, frinstance i could write #(map first (partition-by identity %)) for 30, but instead i wrote (comp (partial map first) (partial partition-by identity))

0:58 which is getting a bit ridiculous

0:58 amalloy: blech. you *do* deserve to be hanged

0:59 i mean, it's sad that clojure doesn't let you express that with less typing

1:00 but given that it doesn't, your code is surely less clouttered if you write some functions :P

1:00 brehaut: obviously :P

1:13 zakwilson: http://pastebin.com/VbW6TkLG <-- this congomongo update isn't changing the value and I have no idea why.

1:17 amalloy: zakwilson: the "where" part of your update doesn't make a lot of sense to me

1:18 which is not to say that it's necessarily wrong, but it's definitely what i'd look into first

1:20 ibdknox: is it guaranteed to give you the same item each time you call fetch-one?

1:20 * ibdknox knows nothing about congomongo or mongodb

1:20 zakwilson: ibdknox: I don't know if it is, but it has been while I was trying to test this.

1:21 amalloy: there isn't a where part. This is (update! collection old new).

1:21 amalloy: right. your "old"

1:21 ibdknox: fetch-one, without a where clause, gives you any arbitrary object

1:22 ibdknox: that's what I would have expected

1:22 zakwilson: Yeah, it can be anything, but every time I've called it on this collection, it has given me the same object.

1:23 Why doesn't the old make sense? It's the item to be updated.

1:24 amalloy: zakwilson: i usually update based on just a sub-part of the object

1:24 eg, (update! :users {:user "amalloy"} {:$set {:skill "AWESOME"}})

1:27 technomancy: oh man; I found some of my old code from 2008

1:27 seven add-classpath calls at the top of the file


1:28 hiredman: :D

1:28 zakwilson: amalloy: an approach based on that worked, but I don't understand why using the whole object didn't.

1:29 ibdknox: technomancy: that's the old vintage stuff, code gets better with age right? ;)

1:30 technomancy: ibdknox: well it's not a fine wine if that's what you mean.

1:30 hiredman: ~search for Vars

1:30 clojurebot: <#clojure:technomancy> hiredman: heh; vals vs vars? so like ... clojure.lang.IRefs are all blue? =)

1:30 <#clojure:duck1123> I really wish the dynamic warnings had shown the fully-qualified vars

1:30 <#clojure:duck1123> melipone: usually it's better to either require with a prefix (:as) or use only the vars you need (:only)

1:30 <#clojure:duck1123> I like vars because they allow me to write multimethods that dispatch on the function

1:30 hiredman: bleh

1:30 technomancy: ibdknox: actually it's funny you say that because I'm considering porting it to noir

1:31 ibdknox: haha

1:31 so it *will* be wine.

1:31 zakwilson: I wonder if it doesn't use all of the keys in the "where" and was picking one that wasn't unique?

1:32 zakwilson: or some such

1:32 zakwilson: ibdknox: could be. That would be a bit pathological though.

1:32 ibdknox: technomancy: well if you do, feedback is very welcome :)

1:32 technomancy: ibdknox: so far its competition is "HERE IS SOME ELISP TO START A SWANK SERVER THAT CAN BE USED TO LAUNCH JETTY"

1:33 so, thumbs up!

1:33 ibdknox: lol

1:34 Now if only I can convince amalloy to use it some day. That's when I know I've succeeded... Also that hell has frozen over :D

1:34 technomancy: ibdknox: although my version did have fewer 80-column violations

1:35 ibdknox: technomancy: I've never been good about that

1:35 amalloy: zakwilson: suppose that, for example, entry is {:text "Everything OK"}

1:36 if there are multiple objects in the db with that text, then ibdknox's possible problem should arise

1:37 zakwilson: amalloy: entry, in the call from my paste is the return value of calling (fetch-one :http-log) and has an :_id of the autogenerated and supposedly guaranteed to be unique sort.

1:38 ibdknox: zakwilson: if you just use the _id does it work?

1:39 amalloy: okay. then you're just seeing that fetch-one returns the "first" object, and updating an object causes it to no longer be "first"

1:39 your update should work, but your later fetch is getting a different object

1:39 zakwilson: ibdknox: yes

1:39 ibdknox: that was my first guess! :D

1:39 lol

1:39 technomancy: ibdknox: having the newly-generated project include next steps as the default static splash page is a nice touch

1:40 though it's a little vague about what file should be used

1:40 ibdknox: technomancy: years of being annoyed with trying to figure out what to do next :)

1:40 zakwilson: amalloy: I thought that, but that wasn't what was happening. It was the same object, with the same :_id and no :date.

1:40 ibdknox: technomancy: I haven't touched it since I first created it

1:40 technomancy: definitely should get cleaned up and made a bit nicer

1:40 amalloy: zakwilson: ibdknox is okay for debugging database problems, but he can pry my HTTP headers out of my cold dead hands

1:41 ibdknox: hahaha

1:41 oh it'll happen

1:41 zakwilson: eh?

1:41 ibdknox: one day.

1:41 amalloy: *ashamed* yes, it will

1:42 zakwilson: i persist in telling people ring/compojure are cooler than noir

1:42 ibdknox: ooo

1:42 technomancy: can I just say... HTTP status code jokes: great jokes or greatest jokes?

1:42 zakwilson: Ok, let's see if trying to do this to all 15000 log entries blows up the server!

1:43 ibdknox: the latest version of ring fixed some things I've been wanting for a while :)

1:43 technomancy: so I was kind of on the whole "you should use lower-level libs like ring and compojure if you already know how the whole web stack works and maybe use something like noir if you are still figuring things out" idea

1:43 brehaut: amalloy: you are half right; ring/moustache is cooler than both

1:43 technomancy: then I realized *I* don't really know the web stack all that well

1:43 and I'm not sure I have the patience to do a lot of that stuff by hand

1:44 ibdknox: brehaut: I'll get you too

1:44 lol

1:44 brehaut: :)

1:44 ibdknox: just wait.

1:44 amalloy: technomancy: you can only tinker with so many things at once, i guess

1:44 ibdknox: haha

1:44 it's true

1:44 amalloy: i prefer http to elisp :P

1:44 ibdknox: everybody should prefer http to elisp

1:45 technomancy: http is a lot more stateless that elisp

1:45 ibdknox: though I'm sure the greater clojure community is glad technomancy took up the burden

1:45 zakwilson: I haven't tried noir yet. I've built a few things on compojure/ring.

1:45 amalloy: high five, bro

1:45 ibdknox: lol

1:45 technomancy: whether I'm glad I got caught up in the madness is another question...

1:46 ibdknox: technomancy: too late now lol

1:46 that's always the problem with these things

1:46 you get pegged as the go to guy for x... and then you're stuck with it forever

1:47 zakwilson: I need to read over the noir docs and see if it's something I should be interested in.

1:47 ibdknox: hm

1:47 technomancy: ibdknox: is there a reason the pregenerated server.clj must call load-views?

1:47 ibdknox: I vote.. yes.

1:47 technomancy: seems like that could be infered

1:48 ibdknox: technomancy: I suggest a project structure, but you don't have to keep to it

1:48 amalloy: technomancy: i need to have a better recall of the http response codes

1:48 ibdknox: I *do* need to load view files somehow though, to capture the routes

1:48 amalloy: so that i can more quickly respond with 406 to your suggestion that we tell status-code jokes

1:49 technomancy: ibdknox: seems like server/start gets the ns root; it could call (load-views (format "src/%s/views" (:ns opts))) or something

1:49 amalloy: sudo gem install cheat; cheat http

1:49 my secret is out

1:49 although that leaves out important ones like 418

1:49 ibdknox: technomancy: ah, there's a load-views-ns function as well

1:49 amalloy: i assume that's the teapot?

1:49 ibdknox: but yeah

1:49 technomancy: amalloy: naturally

1:50 brehaut: ibdknox: i could be convinced to switch to noir if you include support for HTCPCP

1:50 cemerick: are the auxiliary namespaces like clojure.zip available in 4clojure?

1:50 ibdknox: brehaut: lol

1:50 zakwilson: I once considered causing everything on a non-paying client's site to return 402.

1:50 brehaut: i don't need the 418 response handled though

1:50 amalloy: cemerick: they often are, by accidents of sandboxing, but we don't put them there on purpose

1:51 cemerick: amalloy: Thanks. BTW, try-clojure is down for the count, if you've got a hand in that.

1:51 amalloy: i think what happens is you can use whatever namespaces we happen to already use while implementing the site

1:51 cemerick: thanks, i'll go restart it

1:51 technomancy: ibdknox: the filter call in load-views-ns doseq should be a :when clause

1:51 cemerick: amalloy: It was a permgen error — is class GC not enabled there?

1:52 amalloy: whuuuuut? it runs with the same settings as 4clojure, and i *know* classes get GCed there

1:52 cemerick: I didn't keep the window open, but the error was "PermGen Space" IIRC

1:53 ibdknox: technomancy: indeed, I always forget to use those

1:53 amalloy: Raynes: ^

1:53 cemerick: the process is still running, too. this has happened before, and i don't know why it's not serving responses

1:54 i'm not going to restart it till Raynes has a chance to look at it and maybe know what's going on

1:54 Raynes: amalloy: Don't look at me. I've got no clue.

1:54 It has been doing this since forever, so no, not really.

1:54 amalloy: well then. /me gets out the axe

1:56 technomancy: ibdknox: any plans to trim down the bare :use clauses in the skeleton project?

1:56 * technomancy is in nit-pick mode

1:57 ibdknox: technomancy: I like nit-picks :) Yeah, I need to go through the whole project and clean that up.

1:57 I'm making a list :)

1:57 technomancy: a public list?

1:58 ibdknox: if you want to add them as issues, I'm fine with that, but I was just keeping a list here

1:58 technomancy: ok, I may

1:59 have you looked at the lein spawn plugin?

1:59 ibdknox: I think I did once upon a time ago

2:00 technomancy: I haven't tried it myself, but it seems like it could be a good fit

2:00 hm; can you only label issues in repos you can write to?

2:01 github issues; that is

2:01 amalloy: technomancy: yeah, you can't do much otherwise

2:01 technomancy: I guess that makes sense

2:03 * amalloy harbors secret plans to vandalize issue labels

2:04 technomancy: you never know!

2:04 amalloy: or i did, anyway, but i guess they're not secret anymore

2:05 technomancy: I know a guy who makes pull requests that delete every whole file and submits them as "Architectural Improvements to MongoDB"

2:05 amalloy: *chuckle*

2:05 technomancy: which I secretly find hilarious

2:05 amalloy: $google clojure lava github pull request

2:05 lazybot: [renamed all references to "clojure" to "lava" - GitHub] https://github.com/clojure/clojure/pull/6

2:06 amalloy: ^ my favorite ever

2:06 technomancy: classic

2:07 hiredman: good thing clojure doesn't take pull requests...

2:10 amalloy: technomancy: in fairness, i *did* once get an issue filed by some spambot

2:10 selling shoes or something

2:11 hiredman: did you close it "wontfix"?

2:11 amalloy: hiredman: man, i wish github issues let you categorize closed issues

2:12 i guess i could create a wontfix label, and only apply it to closed issues


2:13 ibdknox: lol


2:15 ibdknox: ach nein!

2:15 was sollten wir tün?

2:15 lol

2:16 technomancy: ibdknox: there's a 16kb .swp binary file in noir-1.2.0.jar; I assume that's unintentional?

2:16 ibdknox: haha

2:16 hiredman: ibdknox: cry

2:16 amalloy: hiccup has a couple .swp files too

2:17 ibdknox: that is indeed unintentional :-p

2:17 amalloy: it's nice of the vim pariahs to label themselves to clearly

2:17 *so

2:17 ibdknox: A badge of courage ;)

2:47 cemerick: who needs reliable REPL interruption when there's OOM errors?

2:47 amalloy: eh?

2:49 cemerick: don't mind me, just melting chips over here

2:50 companion_cube: amalloy: .swp is more discrete than a myfile~ :þ

2:51 amalloy: companion_cube: there are a fair share of those in jars too, i'm sure

2:52 be a good citizen, and configure your editor to back your files up somewhere OTHER than the cwd. then nobody needs to know what editor you're using :P

2:52 cemerick: standard .gitignores are good things, too

2:53 amalloy: cemerick: not much use for jar files, though

2:53 cemerick: you all do releases out of working directories, huh? o.0

2:59 brehaut: its there a tails function in clj?

2:59 amalloy: brehaut: (partial reductions rest), i think

2:59 er, no

2:59 brehaut: (take-while seq (iterate next s)) ?

2:59 amalloy: &((partial reductions conj []) [1 2 3 4])

2:59 lazybot: ⇒ ([] [1] [1 2] [1 2 3] [1 2 3 4])

3:00 amalloy: though seq/next is probably closer to how tails would be implemented in haskell

3:00 brehaut: i think reductions is backwards to tails

3:01 time to eat anyway

3:01 amalloy: i guess it probably is. alas

3:02 cemerick: chouser: nice problem

3:02 (if you're awake)

3:37 amalloy: cemerick: the requirement for ordering is no fun at all :P

3:37 cemerick: yeah

3:38 I've got the 'hard' case, just filling in for the smaller ones.

3:43 Blkt: good morning everyone

3:48 emil`: does anyone know why the clojurescript repl sample doesn't respond after the second post is sent to the server? can't get the example to work :|

3:57 symbole: When editing in the SLIME repl, is there a way to insert new expressions in the middle of the code without causing evaluation? In other words, I want to evaluate my code when I hit ENTER at the end of the expression, not in the middle of it.

4:01 tomoj: hitting C-j instead of RET is a workaround

4:01 ibdknox: technomancy: I addressed your nits :)

4:02 symbole: tomoj: That worked. Maybe I should use paredit. Hmmm...

4:12 tomoj: symbole: you convinced me to finally figure out how to do that

4:12 (add-hook 'slime-repl-mode-hook 'durendal-slime-repl-paredit)

4:12 durendal being in marmelade

4:20 symbole: tomoj: So that's paredit in the repl?

4:27 fhd: Does anybody know what the status of Leiningen's transition to Aether is?

4:28 I've read a one year old post by technomancy saying it would be a good idea, but couldn't find much more.

4:29 symbole: fhd: Look into Pomegranate. That might be of interest.

4:30 fliebel: What are these? *googles*

4:30 symbole: https://github.com/cemerick/pomegranate

4:31 fhd: symbole: Wow, very fresh. So I guess Leiningen is waiting for this to reach a usable state, eh?

4:31 cemerick: fhd: coming sooner rather than later, insofar as I need lein to do things it can't do yet.

4:32 fhd: cemerick: I'm asking because a colleague of mine is a Maven geek and I guess Aether would make him not curse about Leiningen all the time :)

4:32 cemerick: He might want to help out, I'll point him to the GitHub project.

4:32 cemerick: I doubt technomancy is waiting for pomegranate, but I'll bet he'll take a clojure wrapper if he can get one.

4:33 cark: is anyone using hsqldb ? is it good enough for embedded use, and is there any bad war stories to tell ?

4:34 symbole: What is Leiningen using now to interact work with Maven artifacts?

4:35 fhd: symbole: The Maven Ant Tasks

4:35 symbole: Makes it kind of hairy to work with Leiningen in a pure Maven environment here

4:35 fliebel: cark: That is like... SQLite in Java?

4:36 cark: fliebel: kinda, got tired of doing type conversions with sqlite so i'm looking for an alternative

4:36 looks like the java contenders are h2 and hsql

4:36 fliebel: cark: I think Clojurebot uses derby.

4:36 cark: derby looks a bit too hairy

4:36 ah =)

4:37 it's a shame postgres is not embeddable

4:40 cemerick: fhd: Yes, aether will make it so that all of settings.xml and settings-security.xml is recognized

4:40 lpetit: cark: what about java db, which is embedded with the JDK ? (afaik, not an expert in this area)

4:40 cark: lpetit: it's derby

4:41 my application is time sensitive (not too much but still)

4:41 so i need good concurrency in the database

4:41 can't have a long statistics query blocking the whole thing for a couple seconds

4:42 symbole: Embedded Derby is easy to work with. The standalone Derby is a bit hairy because of all the tools and options available.

4:42 cark: so h2 is out, and i *think* i read somewhere derby's concurrency wasn't top notch

4:42 fhd: cemerick: That's exactly our problem right now. Some settings are respected, some not. Makes for very ugly project.cljs and custom scripts.

4:43 cark: changing database engine is always such a pain =(

4:44 cemerick: fhd: Totally understood. Getting that fixed is fairly high on my priority list.

4:44 fhd: cemerick: I've pointed my colleague to pomegranate, it would already be a big help for us, simplifying our custom scripts. Hope he is in a mood to contribute :)

4:45 While I'm at it, does anybody know a process library for Clojure? Couldn't find anything.

4:45 I want to execute processes, read stdio and write stdin. Pretty ugly with pure Java.

4:48 symbole: fhd: This might help http://commons.apache.org/exec/.

4:48 raek: clojure.java.shell wraps java.lang.Runtime.exec

4:53 lpetit: fhd: plain old contrib's sh worked well for me. Maybe clojure.java.shell is it's reincarnation ?

5:10 cemerick: lpetit, fhd: it is, and has worked well enough for me, though I'm not a big shell/script user in general

5:24 kzar: I'm destructuring a vector into a bunch of names, I then need to return a map of those names and values. It seems redundant writing out the map manually like `{:var-name var-name :something something :example example}`, is there a better way?

5:24 (I figured there might already be a way to do it, but if not I figure I could write a macro to do it.)

5:26 raek: kzar: nothing in core, but a macro that does that is simple to write

5:27 kzar: raek: Yea I reckon I can do it, OK thanks

5:27 raek: (I know I have at least one gist with that macro somewhere)

5:29 kzar: raek: (Although I now realised I would have to pass each variable name into the macro so it would still be quite verbose. Figure it's better to write a function that's designed for destructuring a vector into a map.)

5:29 raek: ,(zipmap [:a :b :c] [0 1 2])

5:30 clojurebot: {:c 2, :b 1, :a 0}

5:30 fhd: lpetit: Wow, didn't know about clojure.java.shell, looks good!

5:30 kzar: raek: Oh, cool!

5:31 raek: kzar: if you're not going to touch the values from the vector before you put them in a map then I think zipmap does the trick

5:31 kzar: raek: Then I can always use update-in or the likes afterwards

5:33 cark: kzar : have you looked into the :as keyword when destructuring ?

5:33 mindbender1: hi All.

5:33 cark: ,(let [{:keys [a b c] :as m} {:a 1 :b 2 :c 3}] (assoc m :a 3))

5:33 clojurebot: {:a 3, :c 3, :b 2}

5:33 kzar: cark: Yea, :as is handy sometimes. Not sure it helps me here though

5:34 mindbender1: Is code completion possible with emacs when doing clojure dev?

5:34 cark: mindbender1: yes

5:34 mindbender1: ok. How do I get it?

5:34 cark: mindbender1: i assume you have a slime setup already ?

5:34 mindbender1: cark: yes I do

5:35 cark: mindbender1: i'm using the auto-complete mode

5:35 i think you can get it through packages

5:36 raek: you can press C-c tab with standard slime

5:36 cark: raek : that's too long =P

5:36 think about your RSI !

5:36 http://www.emacswiki.org/emacs/AutoComplete

5:36 raek: it's not as impressive as auto-complete-mode, though

5:37 cark: we emacs users are well known for wrist pains already =D

5:38 wink: so it seems La Clojure won't work with WebIde, only with IDEA, right? :|

5:41 kzar: cark: As Slashdotters liked to incant; "correlation is not causation". Or, in other words, the average EMACS user has used a computer for years - a lot - and spends a decent amount of time programming.

5:41 cark: true, but correlation *may* imply causation

5:41 kzar: cark: Perhaps the hotkeys in EMACS are the cause for people's problems but I suspect not, I worry that it gets a bad name.. but then on the other hand people have been making fun out of it for years

5:42 cark: or at least correlation is a first lead

5:42 you cannot deny that emacs key-chords are sometimes painfull

5:43 specially for non-us keyboards

5:43 kzar: Well I can, but it's personal I guess

5:43 cark: anyways, best tool for the job, so we're stuck with it

5:44 kzar: true, true also you can re-bind any combinations you find painful

5:44 cark: oh that's something i try to avoid as much as possible

5:45 i try to learn new hand positions for the same combinations instead

5:57 mindbender1: cark: how does auto-completion pick out the list of words to use for completion?

5:57 cark: i don't know, it has several different sources it seems

5:58 mindbender1: but when we define new words does it get listed automatically?

5:58 cark: yes

5:58 mindbender1: ok, that's just what I wanted. thanks

6:00 gu: what is the most ideomatic way of writing this? (get (:my-key my-map) my-map)

6:19 fliebel: gu: Huh, so you get key of the value of the key for the map? or are my-map and my-map two different things?

6:23 gu: fliebel: nope, my-map and my-map are the sa

6:23 *same

6:24 fliebel: Your approach looks valid to me.

6:24 &(let [m {:a :b :b :c :c :d}] (take-while identity (iterate (partial get m) :a)))

6:24 lazybot: ⇒ (:a :b :c :d)

6:24 cark: ((:my-key my-map) my-map) seems the smallest

6:27 fliebel: &(take-while identity (iterate {:a :b :b :c :c :d} :a))

6:27 lazybot: ⇒ (:a :b :c :d)

6:28 fliebel: I keep writing iterate with take-while around it. Maybe iterate should have a stop condition built in?

6:29 raek: isn't that operation called "unfold"?

6:29 in FP terminology

6:30 fliebel: raek: We don't have that, do we?

6:30 raek: no

6:30 fliebel: I think amalloy-util has :)

6:34 raek: unfold seems to do a couple of extra things.

6:51 thorwil: hmm, i guess hiccup can be helpful for writing atom, too

7:24 i have a file atom_fee.clj that used to def "base" via a macro. it no longer contains any symbol or even string of that name anymore and has been recompiled

7:25 but if i try to :use it, on compiling i get a complaint "java.lang.IllegalStateException: base already refers to: #'tlog.views.parts/base in namespace: tlog.views.views"

7:26 how can this be and how to mend it, short of terminating the session?

7:27 fliebel: Does anyone know why vimclojure uses a custom nailgun server?

7:31 raek: thorwil: you can use ns-unmap and remove-ns to clean up old vars

7:32 when you use remove-ns to remove namespace foo, you also need to remove the namespaces that use any vars from foo

7:33 thorwil: but in this case the solution could be as simple as (ns-unmap 'something-here.atom-fee 'base)

7:33 thorwil: raek: i just did that, worked, thanks!

7:34 time and time again i run into issues because what's in the session is not what is in the (compiled) files

7:34 but usually i only notice starting up the next time, when something breaks. not during a session /:

7:36 is the only way out to pay attention to the vars i remove and to manually remove them from my namespaces?

8:39 mindbender1: with the way clojure talks about identity and state, is there a way to retrieve previous state of an object after mutation? Or am I not grabbing the concept?

8:46 lnostdal_: ,(+ 2 2)

8:46 clojurebot: 4

8:47 lnostdal_: mindbender1, perhaps you mean http://paste.lisp.org/display/125291

8:48 ..or do you mean when using STM (DOSYNC etc.)? .. the FN for ADD-WATCH is passed the old-value

8:49 raek: mindbender1: when you get the current state ("deref") the reference you get an object that never changes. if the reference is then changed, that state object becomes the previous state. the point is that once you have something that was the current state for a certain point in time, that something does not change when the reference changes

8:51 so the point is not to have the history available as a list of values that you can browse through, but the ability to take a snapshot that does not change

8:51 (however it's possible to record the history using add-watch, as lnostdal_ pointed yout)

8:52 mindbender1: I am now enlightened.. thanks

8:52 I thought probably you could browse it as a history:-D

8:53 raek: well, refs (the reference type that is governed by transactions) actually keep a history of values internally

8:54 but I don't know if you can access it

8:55 mindbender1: ok

8:55 raek: the STM simply makes sure there is enough history there so that you can read from multiple refs atomically in a transaction

8:56 mindbender1: ok

8:57 raek: all this lets you program without worrying that a value "changes beneath your feet" while you process it

8:57 by separating mutation from data

8:57 mindbender1: ok

9:16 fliebel: What is teh question mark? (java) new StdHttpClient?.Builder()

9:16 Just a type in the docs?

9:16 *typo

9:24 jcromartie: HI EVERYBODY!

9:29 Reading a journal file of 100K simple changes to a map (assoc :x n) is pretty fast: 4 seconds.

9:29 reading and applying, that is

9:30 (reduce apply-event {} (form-seq "/path/to/journal-file"))

9:31 rafl: for integration with another build system, i'm looking for a way to get the version number out of my lein project's project.clj. can anyone think of a way to do that without actually reading the file myself?

9:37 wilkes: rafl: we do this, https://gist.github.com/1284233

9:37 not sure if this the best way, but it works for us

9:38 wjlroe: I'm having a problem with atoms. http://paste.lisp.org/display/125292 The first time I run get-setting - it returns the setting I want (@config isn't null) - then @config is null, stacktraces - then it works, then is breaks again. I can't see where @config is being repeatedly set back to nil

9:39 dnolen: wow Google Closure canvas graphic is slow … less I'm missing somthing

9:52 ThreeCups: I'm new to clojure. I'm building a REST app. I'm looking at https://github.com/ordnungswidrig/compojure-rest. It looks simple and useful (in my very un-informed opinion). But it's old. Any thoughts on libs to build a REST app?

9:53 Hmm... I can't build it using leiningen. org.clojure:clojure:jar:1.1.0-alpha-SNAPSHOT is missing

9:53 It's pretty old...

9:55 rafl: wilkes: that does help. cheers!

10:08 ThreeCups: How does one figure out what version to put in a leinengen project.clj file for clojure (1.3) contrib libs?

10:08 for the :dependencies key

10:09 in the defproject form

10:10 wilkes: rafl: you're welcome

10:11 ThreeCups: I'd like to use the 'raise' function (form?)

10:11 wjlroe: Does anyone know how to get DNS name resolution working with Clojure on 64bit Ubuntu?

10:13 TimMc: wjlroe: I'm using Clojure on x64 Ubuntu. Whta's the problem?

10:14 wjlroe: TimMc: java.net.UnknownHostException for everything

10:14 TimMc: wjlroe: Give me a snippet to try.

10:15 ...but I'm pretty sure it works for me, given that lein can bootstrap itself.

10:15 Maybe it only uses curl and maven.

10:24 arohner: wjlroe: it's very likely a problem with your box. There's nothing special about Clojure + DNS

10:24 Clojure just uses the built-in Java sockets code

10:26 wjlroe: Yeah but there are problems with Java and DNS: http://stackoverflow.com/questions/6277692/how-can-i-set-the-dns-servers-to-use-from-a-java-program

10:28 arohner: wjlroe: right, a problem with your ubuntu install :-)

10:31 wjlroe: Well it's seems that it's that it can't resolve using IPv6 - you can work around by forcing IPv4 but that's really messy with Leiningen +Clojure

10:31 jcromartie: so I made this journaled ref thing https://gist.github.com/1284348

10:32 but I am not sure it's effective

10:32 or that it needs to be refs

10:32 TimMc: wjlroe: Do you have lib32nss-mdns installed?

10:32 wjlroe: TimMc: there is no such package afaics

10:32 TimMc: Oh, I see.

10:32 wjlroe: TimMc: probably quite out-of-date and related to debian.

10:32 jcromartie: Since the (dosync) is inside my command-processing function, are the benefits lots?

10:32 lost?

10:32 or no...

10:33 the actual commands could still take advantage of other refs inside the transaction

10:33 so that's fine I guess

10:34 TimMc: wjlroe: I think it is a problem Ubuntu inherits from Debian... nasty bug. Can you get the package to install stand-alone?

10:36 http://packages.ubuntu.com/dapper/libnss-mdns it was present in hardy, then dropped out of sight until lucid.

10:38 jweiss: i have a coll i want to process in parallel, it does some calls over the network (side-effecty), but i want to limit the number of threads. future appears to be unlimited. what's the suggested solution here? agents?

10:43 TimMc: jweiss: Java might provide some sort of thread pool lib.

10:46 ThreeCups: jweiss: I can speak for Java, it has java.util.concurrent package. Look at the Executors class. You could also look at the Google Guava stuff. It has a ListenableFuture that helps in composing these things.

10:46 jcromartie: anybody want to take a look at this... https://gist.github.com/1284348

10:46 ThreeCups: not sure if there's a pure clojure solution

10:46 wjlroe: TimMc: libnss-mdns hasn't changed anything. but the problem seems to be that Java ignores /etc/resolv.conf

10:46 jweiss: ThreeCups: ok, i know about Executors, thought there might be an alternative here. thanks

10:46 TimMc: weird

10:47 jcromartie: (the code is not set up as a proper lib yet... just copy/pasted out of the middle of my new project's scratch pad)

10:47 TimMc: jweiss: And if the thread pool stuff is too cumbersome... make a wrapper and share it! :-)

10:50 duck1123: jweiss: you might want to check out getwoven/work, but I had some dependency issues when I tried it

10:50 jweiss: this is actually a pretty thorny problem - the items in my coll could either call xmlrpc (in which case too many threads overloads the apache client and throws errors), or attempt to deref a promise, which could block. so it's very difficult to avoid both deadlocking AND overloading the xmlrpc client.

10:51 right now i'm using futures and getting xmlrpc client thread errors

10:51 that xmlrpc client sucks by the way

11:05 devn: ,`',(o'_'o);'

11:05 clojurebot: (quote (sandbox/o'_'o))

11:05 devn: yay for ascii art

11:11 TimMc: OK, time for a Clojure/Perl bilingual programming contest!

11:11 You start. :-P

11:13 devn: haha, no thanks.

11:13 I was just thinking about a fun sticker or something -- someone once showed me a really nice fish-looking combination with '` and such

11:25 ,(conj [(symbol "<")] [:o])

11:25 clojurebot: [< [:o]]

11:25 devn: Anyone have a more convincing whale up their sleeve?

11:25 dnolen: huh one of the largest online forums in China - Clojure users

11:25 devn: dnolen: whoa.

11:26 dnolen: methinks I need to go back to studying mandarin

11:27 dnolen: out of curiosity, how did you come across that info?

11:27 dnolen: devn: the Clojure Success Stories on Confluence

11:27 clojurebot: clojureql is http://gitorious.org/clojureql

11:29 ejackson: thats unexpected

11:31 devn: dnolen: interesting.

11:31 clojurebot: clojureql

11:31 clojurebot: clojureql is http://gitorious.org/clojureql

11:31 devn: the Clojure Success Stories on Confluence

11:31 devn: the Clojure Success Stories on Confluence

11:32 * devn shrugs

11:36 dnolen: OMG, http://objectcommando.com/blog/2011/10/13/appendo-the-great/

11:39 kevinburke: https://groups.google.com/group/compojure/browse_thread/thread/42d6e550d7bdeae5?pli=1 is the syntax here still valid or is this out of date?

11:39 zerokarmaleft: dnolen: hah, nice army of darkness reference

11:42 dnolen: looks like puredanger put it on HN, upvote! http://news.ycombinator.com/item?id=3107531

11:45 gtrak: still waiting for my copy of 'reasoned schemer' to show up from your talk

11:46 ejackson: upvoted....

11:47 gtrak: mitpress is dropping the ball

11:48 dnolen: gtrak: it may be out of print? Amazon is saying it ships 1 to 2 months now. That's not how it was before.

11:49 gtrak: you possibly single-handedly caused a run on them

11:50 dnolen: nice 4 more days before strangeloop releases Simple Made Easy video

11:51 stevedb: I'm glad they are starting with that talk

12:00 lobotomy: hey guys, any ideas for clojure syntax highlighting for a blog? apparently there are a few syntaxhighlighter brushes around for it

12:05 srid: lobotomy: octopress. or just plain old pygments.org

12:06 lobotomy: cheers

12:06 srid: i use octopress for my blog, and it can highlight clojure without any extra configuration

12:13 kzar: srid: What's octopress like? Also what's it written in?

12:13 srid: $google octopress blog

12:13 lazybot: [imathis/octopress - GitHub] https://github.com/imathis/octopress

12:14 srid: its written in ruby, with plugins and good enough default configuration for programmer blogs

12:16 arkh: how does one use dec' without fouling up the reader? e.g. this doesn't work: (let [x (atom 0)] (swap! x dec'))

12:16 jcromartie: what is dec'

12:16 hiredman: it works if you are using clojure 1.3

12:16 arkh: like dec but promoted to long if needed

12:16 hiredman: no

12:16 arkh: oh... busted

12:16 hiredman: like dec but promoted to bigint if needed

12:17 jcromartie: ah

12:17 srid: why would you want to promote to bigint if dec will return a smaller number?

12:17 arkh: hiredman: I'm still using 1.2, my bad

12:17 jcromartie: is there any hope of getting reader macros in Clojure?

12:17 srid: overflow

12:18 ,dec Integer/MIN_VALUE)

12:18 clojurebot: #<core$dec clojure.core$dec@8c6282>

12:18 jcromartie: ,(dec Integer/MIN_VALUE)

12:18 clojurebot: -2147483649

12:18 jcromartie: oh

12:18 :P well apparently it works for clojurebot

12:19 ,*clojure-version*

12:19 clojurebot: {:interim true, :major 1, :minor 3, :incremental 0, :qualifier "master"}

12:19 srid: i get overflow exception

12:19 .. on 1.2

12:19 jcromartie: ,(type (inc Integer/MAX_VALUE))

12:19 clojurebot: java.lang.Long

12:19 jcromartie: ,(type (inc' Integer/MAX_VALUE))

12:19 clojurebot: java.lang.Long

12:19 jcromartie: so yeah

12:19 ,(doc inc')

12:19 clojurebot: "([x]); Returns a number one greater than num. Supports arbitrary precision. See also: inc"

12:20 jcromartie: ,(type (inc' Long/MAX_VALUE))

12:20 clojurebot: clojure.lang.BigInt

12:20 jcromartie: here we go

12:21 joly: ,(let [x (atom 0)] (swap! x dec'))

12:21 clojurebot: -1

12:23 arkh: 1.2 thinks the quote is a reader macro character

12:23 gtrak: dnolen, would you say the curviness of the kinesis is particularly useful? I'm looking at this one: http://www.trulyergonomic.com/

12:25 dnolen: gtrak: yes, the bowled Kinesis design is actually by the same fellow who did the Maltron keyboards

12:26 like a piece of sculpture, http://www.amazon.com/gp/product/B000YL4EPM/r

12:26 $645 dollars just for one side!

12:27 gtrak: those look pretty awesome

12:27 hiredman: "A maker of particularly durable, expensive, ergonomic keyboards" -- product features

12:28 dnolen: they're not kidding about the durable thing, I think this Kinesis could easily last me another ten years.

12:33 srid: dnolen: are these keyboards significantly better than the MS ergo keyboard 4000?

12:34 (i don't use much of the arrow keys)

12:35 dnolen: srid: honestly can't say I've been using the Kinesis for 5 years. but the again the innovation around the Kinesis is the ability to leverage your thumbs for control keys, so a lot less moving off home.

12:36 they're also reprogrammable, and all the keys are physically switchable

12:41 arohner: dnolen: are you an emacs user?

12:41 wastrel: emacs

12:41 dnolen: arohner: yup

12:43 arohner: I notice my left wrist getting sore more often than my right. I blame the control keys on emacs for that. Do you notice any improvement with your keyboard?

12:43 dnolen: also OS X user, and OS X supports the basic Emacs bindings for movement everywhere.

12:43 arohner: the faux emacs irritates me more than no emacs at all

12:43 dnolen: arohner: I hate control pinkie. mapping CTRL to Caps Lock doesn't fix that.

12:44 arohner: when I was using the GUI Cocoa Emacs 24, I mapped CTRL to Command, stink to move off home keys but no more CTRL pinkie.

12:45 arohner: where is ctrl on your keyboard? It looks like caps lock is in the same place

12:45 dnolen: people like to complain about Emacs chording, TextMate chords are way more insane (hold down 4 keys at the same time, seriously?!)

12:45 arohner: I have caps -> control on an MS ergonomic

12:45 dnolen: arohner: on my laptop caps lock is in a different spot

12:47 TimMc: dnolen: C-M-H-S-8

12:49 srid: Enlive question -- within an <li>, I need to inject a different HTML structure based on the element in a collection. should I construct this HTML structure (hiccupp-style) and then add to it to the <li> in enlive template, or is that possible to do from enlive itself?

12:49 technomancy: the MS natural uses rubber membranes that get pretty mushy after 3-4 years

12:49 it'll still work, but the key response is a lot less present

12:50 srid: <li><b>event1</b1>: <i>attr</i></li> ............. <li><b>event2</b1>: <div>event's data</div></li> ... etc..

12:50 technomancy: not that it's all that crisp when new

12:50 TimMc: technomancy: On the other hand, it is only like $45.

12:50 arohner: technomancy: why is crispness desirable?

12:50 technomancy: TimMc: true, it's definitely the best in that price range

12:51 * technomancy shugs, de gustibus non est disputandum

12:51 technomancy: most people like a crisp response, but I guess it's a matter of taste

12:51 TimMc: I can't figure out how you would use that Maltron.

12:51 * dnolen hates keyboards that get mushy

12:51 cark: mechanical keyboards are the best

12:52 clicky ones =)

12:52 arohner: technomancy: no, it's just I've never met people in real life who had an opinion about keyboard response, so I haven't thought about it enough to develop a taste

12:52 TimMc: \o/

12:52 technomancy: I guess one thing is that with a mushy response it's not clear exactly when the keypress registers.

12:52 dnolen: TimMc: you do have to spend some time training - 2 weeks, then you get up to full speed in a couple of months

12:52 technomancy: so it makes you press harder than necessary

12:52 TimMc: technomancy: Exactly.

12:52 dnolen: arohner: Kinesis keyboard response is incredible.

12:52 TimMc: dnolen: My hand hurts just looking at it.

12:52 technomancy: cark: if they made a split model M, that would make my day

12:53 dnolen: they actually have a little speaker inside the keyboard that clicks when you pass the threshold for activation.

12:53 and a physical click as well

12:53 TimMc: It looks like you have to move and re-angle your hand quite a bit.

12:53 dnolen: Nice.

12:53 dnolen: TimMc: you do not reangle your hand

12:53 TimMc: you reangle your hand on traditional keyboards

12:54 cark: technomancy: i made a unicomp comme accros from usa, that's the same technology than model M

12:54 and feels the same too

12:54 also they do all layouts (even belgian ones)

12:55 and you can kill someone with it =)

12:56 but no split that i know of

12:56 TimMc: dnolen: To hit those top keys in the curve, don't you have to straighten your fingers and punch them forward?

13:06 ghiu: what is the best way to join two sets? like #{} #{:a :b} => #{:a :b} || #{:a} #{:a :b} => #{:a :b} || #{:a :c} #{:a :b} => #{:a :c}

13:07 (set (concat a b)) ?

13:07 raek: ghiu: are you looking for set union?

13:07 clojure.set/union

13:07 Bronsa: o

13:07 ghiu: thanks

13:08 raek: is the last example correct? shouldn't it be #{:a :c} #{:a :b} => #{:a :b :c}

13:08 ghiu: raek: yes, sorry, you stand correct

13:08 raek: http://clojuredocs.org/clojure_core/clojure.set

13:09 ghiu: thank you very much, union is what i was looking for :)

14:06 jamiltron: Where did clojure.contrib.math go in 1.3?

14:08 mattmitchell: is there a way to replace a value with another in a list? example: (replace '(1 4 990) 990 7) => '(1 4 7) ?

14:09 ugh, yeah the replace function :)

14:09 nickmbailey: did 1.3 allow you to type hint java arrays or can you still not do that?

14:10 hiredman: you've always been able to

14:10 nickmbailey: well that's interesting, wonder why i thought you couldn't

14:12 thorwil: jamiltron: clojure.math.numeric-tower

14:13 jamiltron: Anything crazy I need to do to be able to use that? When I try using or requiring it I get a message that its not in my classpath. This is in a lein-created project using 1.3

14:14 gfredericks: jamiltron: probably need to add it as a separate dependency

14:14 * gfredericks waits for someone to correct him

14:15 thorwil: you need to add the right repository. one moment

14:15 in your project.clj: :repositories {"sonatype-oss-public" "https://oss.sonatype.org/content/groups/public/&quot;}

14:15 raek: isn't that one included by leiningen by default? (I could be wrong)

14:16 technomancy: raek: it's not; default is just central and clojars

14:16 gfredericks: why would a clojure library not be in clojars?

14:17 thorwil: some of the former contrib libs are in beta state

14:17 brehaut: because clojars is for the hop polloi ?

14:17 * gfredericks hops

14:17 brehaut: goddamn autocorrect

14:18 amalloy: brehaut: you can't even disable that "feature"?

14:18 gfredericks: "hop polloi" is a good way to indicate to a crowd of people that you want them to get riled up

14:18 brehaut: amalloy: I've disabled it multiple times

14:18 amalloy: nice

14:18 thorwil: it autocorrects the disablement?

14:18 gfredericks: :D

14:20 jamiltron: Sorry for being completely ignorant, but how do I go about including this in lein. I'm only really accustomed to looking on clojars for dependencies.

14:20 nickmbailey: hiredman: i see how to type hint primitive arrays but how do you type hint arrays of java Objects 'Object[]'

14:20 amalloy: ^"[Ljava.lang.Object"

14:21 nickmbailey: aha

14:21 raek: ^"[Ljava.lang.Object;" ?

14:21 amalloy: raek: probably

14:22 &(aget ^"[Ljava.lang.Object;" (into-array Object [1]) 0)

14:22 lazybot: ⇒ 1

14:22 amalloy: &(aget ^"[Ljava.lang.Object" (into-array Object [1]) 0)

14:22 lazybot: ⇒ 1

14:22 amalloy: &(aget ^"[Ljava.lang.String" (into-array Object [1]) 0)

14:22 lazybot: ⇒ 1

14:22 amalloy: hm

14:23 if the hinting is working, at least one of those should fail, no?

14:23 thorwil: jamiltron: like http://paste.pocoo.org/show/492114/

14:24 jamiltron: Thank you!

14:24 thorwil: np

14:35 jcrossley3: what's the equivalent of (. "foo" contains "f") using apply?

14:35 apply doesn't seem to like the dot operator as its fn

14:36 amalloy: you answered your question right there: . isn't a function

14:36 apply applies functions, therefore you can't apply .

14:37 PPPaul: is there anything in javascript similar to clojure's walk?

14:38 Squeese: I wanted to learn something new, clojure and I had the book "Land of Lisp" avaliable but it's using Common Lisp, thinking.. lisp is lisp, right? I sure as hell hope Clojure is prettier than Common Lisp.. caddrd cddrrrd cdrrdr >P

14:38 TimMc: PPPaul: Does ClojureScript have walk? :-P

14:39 Squeese: So anyway, tips on book for Clojure, any tips? :)

14:39 apage43_: caddrd sounds like something out of watership down

14:39 Squeese: function named CAAAAR, CADAAR, CDDDDR.. really?

14:40 PPPaul: it does, and it's sexy

14:40 i'm making half assed walks for some of my JS stuff

14:40 TimMc: Squeese: nth and get-in are better names, no?

14:41 amalloy: Squeese: meh. when your primitive data structure is a pair, having a way to walk through pairs is important

14:41 Squeese: Dunno, refering to clojure? Im 1hour into my Lisp venture

14:41 PPPaul: how well does clojurescript work with stuff like jQuery?

14:41 TimMc: ca*d*r are there for ... what amalloy said

14:41 Iceland_jack: TimMc: the C*R were mainly thought of as arguments to higher-order functions

14:41 amalloy: c[ad]+r

14:41 TimMc: amalloy: Oh, right.

14:41 amalloy: cause you know you love using CDDAAR

14:42 TimMc: c[ad]{1,4}r as far as I know

14:42 amalloy: sound like a confused pirate

14:42 TimMc: that's all that are guaranteed, yes

14:42 TimMc: Squeese: Clojure has actual data abstractions. Not everything is a cons cell.

14:43 Squeese: TimMc: ok

14:43 amalloy: Let Over Lambda spends some time developing a (with-c*r ...) macro. inside the body of that it checks to see which c*rs you use, and defines any that don't already exist

14:44 Squeese: I got curious of Lisp because I was told "its beutifly symmetric", CAADDR doesnt strike me as symmetric

14:44 TimMc: amalloy: Haha, nice.

14:44 amalloy: Squeese: well, that's why you're here instead of in #lisp :P

14:45 Squeese: haha

14:45 amalloy: &car

14:45 lazybot: java.lang.Exception: Unable to resolve symbol: car in this context

14:45 amalloy: &first

14:45 lazybot: ⇒ #<core$first clojure.core$first@1797e27>

14:46 amalloy: common lisp has a lot of beauty too, but i prefer to admire it from afar

14:46 Squeese: hehe ^^

14:46 TimMc: Squeese: Be forewarned, Clojure has some pragmatic design decisions baked in that aren't entirely pure, beautiful, symmetric, or whatever. I don't disagree with them, though.

14:47 If you want purity over all else, Haskell is probably a good candidate.

14:47 Squeese: Dont disagree with the pragmatic decisions?

14:47 TimMc: right

14:47 For the most part. :-)

14:49 chewbranca: Squeese: port land of lisp to clojure! fun times and not overly

14:49 difficult. gives you the benefit of reading land of lisp while

14:49 still using clojure

14:49 amalloy: chewbranca: someone did that already though

14:49 Squeese: chewbranca: DING! thanks =)

14:49 chewbranca: amalloy: didn't mean publish it, just to do it, he's looking for

14:49 a fun way to learn clojure

14:50 amalloy: i mean, i'm sure it's still a good exercise if you're interested. but don't do it because you think it's the only way to read it

14:50 gfredericks: chewbranca: you got something going on with line breaks there?

14:50 amalloy: erc word-wrap strikes again?

14:50 chewbranca: gfredericks: odd, so not just on my end? breaking at the edge of

14:50 the window

14:51 amalloy: yeap :/

14:51 amalloy: chewbranca: your multi-line messages are being sent as multi-lnie

14:51 *line

14:51 chewbranca: amalloy: ok wasn't sure, I'll keep lines short

14:51 while I look for a fix

14:51 I take it erc word wrap like this has presented itself before?

14:52 amalloy: i've seen it before, yeah

14:52 chewbranca: odd I haven't seen it before, just showed up after erc disconnected

15:12 jamiltron: If I wanted to go about converting base10 to base62 in clojure, is there any way to do it better than something like this: https://gist.github.com/1285184

15:13 amalloy: base...62? why not the usual 64?

15:13 also, base10-base62 is a weird name. the number it's taking in isn't in base2, or indeed in any base

15:13 jamiltron: I want to use the translation in a url. Doesn't base64 include '/'

15:13 amalloy: s/base2/base10

15:13 lazybot: <amalloy> also, base10-base62 is a weird name. the number it's taking in isn't in base10, or indeed in any base

15:13 chouser: jamiltron: start with () instead of [] and you can skip the reverse at the end

15:14 jamiltron: Right

15:14 chouser: jamiltron: use (pos? q) instaed of (>= 0 q)

15:14 amalloy: chouser: those are different comparisons. not sure if it makes a difference here, but...

15:15 jamiltron: you...want to use it in a url? why not just url-encode, then?

15:15 chouser: oh, indeed!

15:15 sorry

15:15 jamiltron: I take back the pos? suggestion

15:17 amalloy: i'm not sure if my url-encoding suggestion makes sense, but eg going number->base64->urlencode seems less error-prone, because there are well-tested algorithms for both of those

15:17 jamiltron: I'm trying to go about building a url-shortener for web app practice.

15:20 I was just thinking base62 would be an easy way to go about that while keeping the extra libraries to a (relative) minimum.

15:22 amalloy: jamiltron: yeah, it's probably not an actual bad idea, i was just confused

15:23 jamiltron: I understand for a production app it would be silly to do, but for a quick throw-something together I think its easier to just do the conversion myself and not have to worry about encoding special characters.

15:24 Thanks for the help

15:39 MasseR: Damn that clojurebot is starting to annoy me. Time to either ignore it or check whether I can prevent actions triggering highlight event

15:49 amalloy: MasseR: wait, what? what is he saying that's causing your client to highlight you?

15:49 you're not talking about the NOTICEs he's sending, are you? your client is supposed to treat those as low-importance, not high-importance

15:56 thoefer: imagine i start in namespace A, then call a func X in namespace B. Is it possible to def a var in X that can be used in ns A? It seems not, but maybe I´m missing something ...

15:57 MasseR: amalloy: Ah yeah, notices not actions, but irssi blings on every one of them

15:57 amalloy: MasseR: nuke irssi from orbit; that's a terrible behavior

15:58 thoefer: you could probably hack something together, but i doubt that you should

15:59 thoefer: this implies yes - it´s possible?!

16:00 zerokarmaleft: MasseR: you can configure irssi to ignore NOTICES

16:01 e.g. /set beep_msg_level MSGS DCC DCCMSGS

16:03 MasseR: you can include any of the levels specified here: http://irssi.org/documentation/settings#a_a

16:04 jcromartie: oh look it's what I'm building :) http://nathanmarz.com/blog/how-to-beat-the-cap-theorem.html

16:04 (in a very small capacity)

16:05 appending data and updating queries happen at the same time

16:55 TimMc: neat article

17:00 amalloy: yeah, thanks for the link

17:03 Borkdude: anyone using twitter-api (the clojure project) here?

17:05 ibdknox: ~anyone

17:05 clojurebot: Please do not ask if anyone uses, knows, is good with, can help you with <some program or library>. Instead, ask your real question and someone will answer if they can help.

17:05 ibdknox: hm

17:05 that sounds meaner than it should

17:05 lol

17:07 amalloy: ibdknox: yeah. draft a better message and replace it

17:07 technomancy: I just stole it wholesale from #emacs

17:07 Borkdude: lol

17:07 ghiu: is there any function that given a seq and a function, returns two seqs, one with the values that applied the function return true and the other with the false, like this? odd? (1 2 3 4 5) => (1 3 5) (2 4)?

17:08 amalloy: (juxt filter remove)

17:08 ghiu: i can make one with a recursion, but i wanted to know if there is a built-in

17:08 Borkdude: ok I'm wondering why it asks for the monolithic contrib, I thought I didn't need it anymore in Clojure 1.3

17:08 amalloy: clojurebot: anyone is <reply> Why so vague? You know ibdknox is going to be the one to answer anyway.

17:08 clojurebot: Ack. Ack.

17:08 amalloy: there. now you have a real motivation to fix it

17:09 Borkdude: using version 0.6.0 here of the project

17:09 bhenry: is it possible to view all namespaces on the classpath?

17:09 manutter: or anyone could fix it, eh?

17:09 ibdknox: :p

17:09 lol

17:09 bhenry: just a list of them?

17:09 jamiltron: Man amalloy I'm continuously amazed at how quick you can recall/think-up this stuff.

17:10 I can never remember to use juxt, especially when I need it.

17:10 ibdknox: jamiltron, juxt is awesome

17:10 ~juxt

17:10 clojurebot: juxt is usually the right answer

17:10 zerokarmaleft: ~amalloy

17:10 clojurebot: amalloy is <amalloy> just use juxt, it'll be great

17:10 jamiltron: Haha

17:10 technomancy: bhenry: clojure.tools.namespaces I think

17:10 zerokarmaleft: things to live by, apparently

17:10 TimMc: and for

17:10 technomancy: it's a separate project

17:11 ibdknox: bhenry, just keep in mind it only works in relatively simple scenarios... i.e. not in a WAR

17:11 bhenry: i just have a jar i want to explore.

17:11 thanks technomancy and ibdknox

17:11 jamiltron: I always put together way over-complicated recursions or destructuring scenerios and then come back to it like two months later and find all this work I did easily replaced by a single juxt.

17:11 technomancy: bhenry: if you have Emacs you can just open the jar like a regular file and browse

17:12 bhenry: technomancy: even better. thanks

17:12 ibdknox: you can do that in VIM too :)

17:13 zerokarmaleft: Borkdude: clj-oauth hasn't been updated for 1.3

17:13 amalloy: jamiltron: in fairness, i've answered the filter/remove question a number of times

17:14 jamiltron: You've probably answered me asking that same questions several times, in fact :P

17:14 ibdknox: jamiltron, don't listen to him amalloy is a magical being able to always produce the correct, very succinct answer every time

17:14 amalloy: clojurebot: separate is in clojure.contrib.seq-utils, but just use (juxt filter remove) instead

17:14 clojurebot: 'Sea, mhuise.

17:15 bsod1: clojure.contrib still has priority-map, right? I can't use clojure.contrib.priority-map, I'm getting this error: java.io.FileNotFoundException: Could not locate clojure/contrib/priority_map__init.class or clojure/contrib/priority_map.clj on classpath: (NO_SOURCE_FILE:0)

17:16 amalloy: oh, interesting. clojurebot doesn't like ?s in |is| messages

17:16 hiredman: he didn't correctly soak up my instruction earlier: "anyone is <reply> Why so vague? You know ibdknox is going to be the one to answer anyway." instead he just learned to reply "Why so vague"

17:17 ibdknox: hah

17:17 I win. :D

17:17 amalloy: is that even a victory??

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

17:18 ibdknox: lol

17:18 Is amalloy trying to cheat to win???

17:18 lazybot: ibdknox: How could that be wrong?

17:18 * amalloy <3 bots

17:19 bhenry: what has to go in my dependencies in order to (use 'clojure.java.jdbc)? or is that from an outdated wiki?

17:19 bsod1: can anyone help me? I can't find priority-map in clojure.contrib

17:20 ibdknox: bhenry, https://github.com/clojure/java.jdbc

17:20 bhenry, tells you at the bottom

17:20 you'll also need a driver

17:20 bhenry: ibdknox: just found that thanks

17:21 ibdknox: which is specific to whatever db you want

17:21 bhenry: i have the driver. it was the jar i wanted to explore

17:23 Borkdude: zerokarmaleft: so I should include clojure.contrib?

17:26 jamiltron: bsod1: are you using 1.3?

17:26 bsod1: jamiltron: 1.2

17:27 amalloy: clojurebot: forget anyone |is| <reply> Why so vague

17:27 clojurebot: I forgot that anyone is <reply> Why so vague

17:28 bsod1: jamiltron: so, do you know where is priority-map?

17:31 ok, I downloaded it from github and loaded..

17:32 jamiltron: bsod1: sorry, stepped away

17:32 dnolen: rhickey cites a pretty sick paper on the problems of mutability from 1981, http://citeseerx.ist.psu.edu/viewdoc/summary?doi=

17:32 choice quote

17:32 "Update-in-place strikes many systems designers as a cardinal sin: it violates traditional accounting practices that have been observed for hundreds of years."

17:34 hiredman: sites where?

17:35 dnolen: hiredman: HN thread on nathanmarz CAP blog post

17:35 hiredman: interesting

17:38 brehaut: dnolen: is there any mechanism in core.logic to store and index relations on disk rather than in memory?

17:39 dnolen: brehaut: nope, and nothing planned. Though very interested in other folks ideas about that.

17:39 mindbender1: please how can I get a tree view with emacs

17:40 dnolen: mindbender1: of your files?

17:40 mindbender1: dnolen: yes

17:40 project files

17:40 dnolen: mindbender1: there's a couple things, speedbar is one

17:41 mindbender1: might want to ask on emacs, I just use Dired

17:41 brehaut: dnolen: it seems like it would be a really great alternative to something like sqlite

17:41 mindbender1: ok I'm on emacs already and getting response thanks

17:43 dnolen: brehaut: yes, tho there some things missing (negation). it's not clear to me what needs to happen in core.logic to achieve datalog (guranteed termination) beyond tabling.

17:44 brehaut: I agree, tho, would be cool.

17:45 amalloy: ugh. (update-in some-map [:key-to-ref] alter f) *looks* like it should work, in the same way that (alter some-ref update-in [:subkey] f) does, but because alter returns the value rather than the ref it doesn't

17:45 hiredman: (alter (:key a-map) f)

17:46 amalloy: hiredman: i needed to actually return the updated version of a-map from this function, so an update-in/alter chain felt natural

17:47 duck1123: srid: Are you running aleph behind Apache, by any chance?

17:47 hiredman: but, uh, it doesn't change the map

17:48 ,(let [m {:a (ref 1)} _ (dosync (alter m inc)) m2 m] (= m2 m))

17:48 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.Ref>

17:48 hiredman: bleh

17:48 amalloy: hiredman: context is more like (-> m (assoc :foo :bar) (update-in [:key] alter f)), which is what i wished would work

17:48 hiredman: ,(let [m {:a (ref 1)} _ (dosync (alter (:a m) inc)) m2 m] (= m2 m))

17:48 clojurebot: true

17:48 amalloy: i understand why it doesn't, of course

17:49 ie, the alter doesn't change the map, but something else does

17:49 technomancy: do folks use swank.swank/-main much?

17:49 hiredman: yes

17:49 clojurebot does, so does sunyata

17:50 amalloy: technomancy: what does it do?

17:50 technomancy: amalloy: just starts a server

17:50 hiredman: oh foo

17:50 I take that back, I use start-repl

17:50 technomancy: I'm fixing a bug where it doesn't let you customize the host it listens on

17:51 briefly considered changing its arglist, but I think that's a bad idea

17:51 arohner: anyone have experience using clojure + rails on jruby?

17:52 technomancy: arohner: no, but I saw this: http://yokolet.blogspot.com/2011/09/haml-on-clojure-web-app.html

17:52 I guess that's not actually rails

17:54 * ibdknox dies a little inside :p

17:54 arohner: ibdknox: I know. not my preferred solution either

17:54 technomancy: ,(re-find #"\w" "ö")

17:54 clojurebot: nil

17:54 ibdknox: huh

17:55 technomancy: is \w specifically ASCII word constituents?

17:55 ibdknox: I didn't know that

17:55 TimMc: ew

18:03 brehaut: ,user=> (re-find #"\p{L}" "ö")

18:03 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: user=> in this context, compiling:(NO_SOURCE_PATH:0)>

18:03 brehaut: ,(re-find #"\p{L}" "ö")

18:03 clojurebot: "ö"

18:03 brehaut: those pattern incantations get crazy fast

18:04 ipostelnik: ibdknox, in noir, is there a way for a defpartial to get access to the current request, specifically the uri?

18:04 ibdknox: ipostelnik, in 1.2.0 yes, though what's the use case? :)

18:05 amalloy: ibdknox: i dunno what this defpartial is but given the number of people who ask this exact question maybe there's some doc somewhere that needs to be updated?

18:05 ipostelnik: ibdknox, I have a partial that renders a menu, I'd like to render the current item specially. I could have everyone pass the current in or have it figure out automatically

18:07 ibdknox: amalloy, usually it's defpage :p

18:07 ipostelnik, look at the noir.request namespace

18:08 ipostelnik: yeah , amalloy shamed me into scouring the docs :)

18:21 brehaut: how do i get slime to interupt the currently executing expression in the repl?

18:31 duck1123: C-c C-c

18:32 brehaut: thanks

18:32 amalloy: i love that command, because it's so natural. "ack holy shit stop" and you start pounding on C-c by shell-reflex

18:33 duck1123: That's what I do in the terminal. C-c till it's all better

18:49 ghiu: ,(-> 1 (partial and 1))

18:49 clojurebot: #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/and, compiling:(NO_SOURCE_PATH:0)>

18:50 ghiu: can anyone explain the problem and how to fix it?

18:50 dnolen: ghiu: and is not a function

18:51 ghiu: it is a macro

18:51 dnolen: ghiu: thus you can't pass it around as an argument

18:51 ghiu: how to express the same ?

18:51 brehaut: im pretty happy with my answer to 4clojure 65

18:52 amalloy: &(->> 1 (and 1))?

18:52 lazybot: ⇒ 1

18:53 amalloy: brehaut: if i'd thought of it soon enough i would have disallowed empty, too

18:53 brehaut: haha

18:53 ghiu: what is the & sign?

18:55 brehaut: amalloy: has that been the go to trick for a bunch of people?

18:55 amalloy: brehaut: have you looked at any of the solutions?

18:55 brehaut: not yet

18:55 amalloy: the super-hacky ones are to condp on the first character of (str x)

18:56 brehaut: haha oh man

18:56 how do i see other people solutions if im not following them?

18:56 amalloy: brehaut: you gotsta follow them

18:56 brehaut: ok

18:56 amalloy: &(map #({\# :set \[ :vector \{ :map \( :list \c :list} (first (str %)) [{} #{} [] ()])

18:56 lazybot: java.lang.Exception: EOF while reading

18:57 brehaut: haha oh man

18:57 suddently i dont feel like my solution was that sneaky

18:57 amalloy: &(map #({\# :set \[ :vector \{ :map \( :list \c :list} (first (str %))) [{} #{} [] ()])

18:57 lazybot: ⇒ (:map :set :vector :list)

18:57 amalloy: \c is the one that makes me laugh

18:58 because of ##(str (range 5))

18:58 lazybot: ⇒ "clojure.lang.LazySeq@1b554e1"

18:58 brehaut: haha

18:58 who came up with this ?

18:58 amalloy: brehaut: i think youz was first

18:58 brehaut: amalloy: i mean the string sneak

18:58 amalloy: he's always got the craziest, shortest solutions. follow him for endless laughs

18:59 yeah, i meant him

18:59 brehaut: oh right

18:59 will do

19:00 his solution to #63 just broke my brain

19:02 i dont think i would ever have thought to use syntax quotes outside of a macro

19:03 amalloy: yep, that's a trick i learned from 4clojure and have used a few times outside now

19:03 brehaut: anyone else got particular clever solutions worth following?

19:04 amalloy: nobody else stands out like youz, but i follow a couple dozen people. most of the contributors, the top 10, and people i know from irc

19:06 wow, #65 is labeled Hard? the difficulty of the site has gone up since then

19:06 * amalloy sets it to Medium

19:07 brehaut: i think #53 is the one that has caused me the most consternation so far. im sure theres a better solution than mine

19:13 gfredericks: 65 is weird...

19:17 brehaut: amalloy: is clojure.set available in 4clojure?

19:17 amalloy: should be

19:17 but also, just try it?

19:26 rascion: are you supposed to escape-html stuff before you put it in your db, or after you take it out of the db before you display it to the user?

19:27 gfredericks: rails does the latter, which makes sense to me

19:27 that way you always have the original if you want it for some reason. On the other hand, maybe that could be considered riskier.

19:28 amalloy: i think you're supposed to do whatever you want, provided it doesn't cause problems. the latter makes more sense to me

19:29 TimMc: rascion: Never encode for html before putting in a DB!

19:29 It's a terrible idea that will bite you in the ass.

19:29 gfredericks: also if you like premature optimization you'll prefer encoding beforehand

19:29 TimMc: gfredericks: Probably.

19:30 gfredericks: since then you only have to do it once!

19:30 it's obviously a good idea!

19:30 TimMc: gfredericks: And then undo it later once you find out why it's wrong.

19:30 gfredericks: yeah, because you always write inverses for all your functions, right?

19:30 that's right up there with basic TDD

19:30 amalloy: TimMc: it's not really invertible anyway, right?

19:31 TimMc: rascion: Only encode when you need to. Embedding in HTML? Encode for HTML. Embedding in SQL? ENcode for SQL.

19:31 amalloy: Maybe?

19:31 amalloy: hm. i think that what i just said is probably nonsense

19:31 gfredericks: shouldn't be -- what if the user inputs sanitize(s)?

19:32 TimMc: gfredericks: For example?

19:32 gfredericks: so your function does f("<p>") => "&lt;p&gt;", right?

19:32 amalloy: gfredericks: then you escape it another level, and on unescaping get back their original input

19:32 TimMc: "Sanitize" is ambiguous. There is validation and there is encoding.

19:33 gfredericks: oh right, I forgot you'd escape the '&' too

19:33 nevermind, I believe it's invertible

19:33 TimMc: You can make it invertible.

19:34 rascion: is there some kind of escaping necessary with congomongo before putting data from user in mongodb?

19:34 TimMc: rascion: I worked at Crutchfield, and a third-party product did encode-before-store. The result was that searching for "amp" (amplifier) returned &amp; all over the place.

19:35 gfredericks: TimMc: so the search-result size was amplified?

19:35 TimMc: :-)

19:36 brehaut: all these mathy 4clojure problems are going to kick my arse

19:37 TimMc: rascion: I'm not familiar with mongo, but it will have some sort of injection-prevention feature you should familiarize yourself with.

19:37 rascion: SQL RDBMSs use prepared statements and such; Mongo will have something equivalent, possibly not even requiring any effort on your part.

19:39 gfredericks: I'm going to steal that.

19:40 amalloy: rascion, TimMc: i don't think mongo needs any kind of escaping

19:40 mattmitchell: how do i check if a var has been bound?

19:40 TimMc: amalloy: No query-building?

19:40 amalloy: bound?

19:40 srid: duck1123: no, i'm running aleph using netty.

19:40 amalloy: TimMc: no

19:40 TimMc: nice

19:40 I guess

19:41 amalloy: TimMc: i mean, obviously you have to write queries somehow. but they're structured data structures, not strings

19:41 TimMc: gfredericks: Maybe I should write a rant like the StackOverflow "regexps can't parse HTML" one, descending into a mess of &&amp;;

19:41 &amp;amp; I mean

19:41 lazybot: java.lang.Exception: Unable to resolve symbol: amp in this context

19:41 gfredericks: TimMc: lol

19:41 amalloy: a typical call looks like (update! :users {:username "amalloy"} {:$set {:skills ["juxt"]}})

19:41 also that SO post is epic

19:41 TimMc: Sweet.

19:42 gfredericks: I only saw it just recently

19:42 is that a coincidence?

19:42 I can't remember why I saw it

19:42 amalloy: probably. i saw it ~5mo ago

19:42 TimMc: gfredericks: I revisit it about twice a year, I think.

19:42 gfredericks: oh yes it is. was a link on cs-theory stack-exchange

19:43 TimMc: It's also a little unfair -- you *can* use regexes to parse HTML, just not in a single call. You have to iterate and keep a stack.

19:43 gfredericks: hmm.

19:43 without backtracking?

19:44 TimMc: Depends how fancy you want to get.

19:44 mattmitchell: amalloy: thanks, i forgot i needed to do #'my-var and not just my-var

19:44 gfredericks: I guess it ought to be no trickier than parsing matching parens

19:46 TimMc: gfredericks: Example in JS: http://lab.brainonfire.net/markup-sanitizer/demo.html

19:47 (I really should put some non-copyrighted Lorem Ipsum in there.)

19:47 rascion: in compojure how do you wrap only a subset of routes with a piece of middleware?

19:48 gfredericks: TimMc: wait are we talking about 'regular expressions' or regexes? former being the strict cs-theory type

19:49 brehaut: gfredericks: the things in perl are irregular expressions

19:49 gfredericks: somebody tell chomsky!

19:50 TimMc: gfredericks: Regular expressions. I'm only matching tags, not pairs.

19:50 The SO rant is (IIRC) in response to someone wanting to build a regex that could match a pair at a time.

19:52 gfredericks: ah ha. I guess what you're really doing is using the regular expression as a tagger and then writing the parser yourself

20:08 * gfredericks is going to use "'" as a symbol suffix all the time now

20:09 hiredman: ′ is what you want

20:09 unicode prime mark

20:09 gfredericks: front-tick? :)

20:09 hiredman: prime

20:10 http://en.wikipedia.org/wiki/Prime_%28symbol%29

20:10 gfredericks: you're quite a fan of unicode aren't you?

20:11 hiredman:

20:11 gfredericks: hiredman: do you use non-ascii in serious code?

20:12 TimMc: I � Unicode

20:12 hiredman: I have used ′ in code at work

20:12 technomancy may have added an interrobang somewhere

20:12 technomancy: it's perfect for destructive predicates!

20:13 hiredman: for a mutating predicate

20:13 TimMc: I used alpha, beta, and gamma in a Clojure HW assignment once.

20:13 technomancy: I am also known to use the venerable page break character, though that's actually in ascii.

20:13 hiredman: but I don't think my ′ survived very long

20:13 gfredericks: you're all horrible people

20:14 hiredman: of the best sort

20:14 technomancy: page breaks are unanimously treated as whitespace!

20:14 gfredericks: :)

20:14 technomancy: I did also run into a clojure bug where the non-breaking space wasn't being treated as whitespace

20:14 amalloy: rascion: (routes foo bar (-> (routes baz bang) (wrap-whatever)))

20:14 technomancy: and it got closed as WONTFIX; can you believe the nerve?

20:14 duck1123: especially if you define two different functions that look the same like that

20:14 hiredman: the meaning of prime is taylor made for computing with values

20:15 gfredericks: technomancy: why would you ever need anything besides the comma?

20:15 hiredman: tailor

20:15 technomancy: gfredericks: it's actually a terrifying story

20:15 gfredericks: I was attempting to start a swank server via wine

20:15 and wine wouldn't let me escape things properly

20:15 I needed something like clojure.main -e "(foo.bar/-main abc)"

20:16 but the quotes got swallowed by wine and no amount of escaping would make them propagate to the JVM

20:16 gfredericks: technomancy: the first line of your story sounds like a reasonable rule of thumb for when to stop drinking

20:16 rascion: amalloy: do you know if you can just wrap-foo a specific route? like (defroutes app (wrap-something (GET "/blah"...)) (GET ....))

20:16 technomancy: so I tried clojure.main -e (foo.bar/-main abc)

20:17 so the shell treated everything after -e as a single token

20:17 problem solved

20:17 except clojure didn't honor the non-breaking space!


20:17 gfredericks: and it doesn't work with a comma?

20:18 technomancy: wait a minute

20:18 that actually makes tons of sense

20:18 pandeiro: is select-keys supposed to exclude keys whose value is false? in clojure it includes them, in clojurescript it excludes

20:18 technomancy: why didn't I just do that?

20:18 gfredericks: technomancy: story woulda been boringer?

20:19 technomancy: gfredericks: that's right; it wouldn't have resulted in this epic bug report: http://dev.clojure.org/jira/browse/CLJ-419

20:19 dang. a comma. of course.

20:19 duck1123: now it has a punchline

20:20 amalloy: rascion: that probably works, but trying it would be easier than asking me

20:20 gfredericks: the man got up and walked away, leaving my unopened bag of cookies on the table.

20:21 * duck1123 loves Douglas Adams

20:21 gfredericks: :)

20:23 amalloy: pandeiro: seems like it should include keys whose value is false *or* nil

20:23 &(select-keys {:x nil, nil :y} [:x nil])

20:23 lazybot: ⇒ {nil :y, :x nil}

20:23 gfredericks: I would assume select-keys wouldn't consider values at all

20:24 hiredman: should have used contains?

20:24 gfredericks: exactly

20:24 pandeiro: amalloy: it seems to exclude keys that have false values in ClojureScript

20:25 hiredman: interesting, uses RT/find

20:25 amalloy: hiredman: probably more like get w/not-found, or find

20:26 hiredman: (doc find)

20:26 clojurebot: "([map key]); Returns the map entry for key, or nil if key not present."

20:26 amalloy: &(map #(find {:x nil} %) [:x :y])

20:26 lazybot: ⇒ ([:x nil] nil)

20:28 amalloy: &((fn select-keys [m ks] (->> ks (map #(find m %)) (filter identity) (into {}))) {:x nil :y 5} [:x])

20:28 lazybot: ⇒ {:x nil}

20:30 hiredman: is filter required there?

20:30 amalloy: &((fn select-keys [m ks] (->> ks (map #(find m %)) (into {}))) {:x nil :y 5} [:x])

20:30 lazybot: ⇒ {:x nil}

20:30 hiredman: ,(into {} [nil])

20:30 amalloy: apparently not

20:30 clojurebot: {}

20:33 st3fan: hey i grabbed the latest clojure mode but i am getting a lot of errors and beeping inside emacs now .. http://pastebin.com/8DvEuT4Z

20:33 has anyone seen that before?

20:55 technomancy: st3fan: you probably have two versions of slime installed?

20:59 gfredericks: dang vim doesn't color :R' correctly :/

21:00 nor with prime

21:00 TimMc: W00t! I'm on the /contributing list!

21:00 redinger: Thanks!

21:02 st3fan: hmm two versions of slime .. let me check

21:03 technomancy: no but i might have an old version of slime, i'll try to update it

21:03 technomancy: st3fan: you should be able to remove any slime you have installed and use M-x clojure-jack-in; see the swank readme

21:03 * technomancy &

21:03 lazybot: java.lang.Exception: EOF while reading

21:03 st3fan: ok

21:05 oh i had a slime in .emacs.d

21:05 where did that come from

21:05 yay this is much better

21:07 how do i turn a keyword :foo into a string "foo" ?

21:08 ah! name :)

21:09 &(name :foo)

21:09 lazybot: ⇒ "foo"

21:10 aperiodic: hi all, i'm having some trouble using gen-class. specifically, i'm trying to generate multiple classes in the same source file, but only the class file for the main class (which has :main true and shares its name with the name of the namespace) shows up after compilation

21:13 amalloy: $findfn :foo "foo" ; st3fan

21:13 lazybot: [clojure.core/name clojure.contrib.string/as-str]

21:21 gfredericks: aperiodic: you're using the fully qualified class names in the :name arg?

21:21 aperiodic: gfredericks: yes

21:23 gfredericks: aperiodic: and you're doing this with the gen-class macro rather than the (:gen-class) expression in the (ns) macro?

21:23 aperiodic: gfredericks: also yes

21:23 gfredericks: aperiodic: then I have no idea.

21:24 aperiodic: I don't think gen-class gets used a lot. I've been using it lately though. Just not with multiple classes in a single file.

21:24 aperiodic: gfredericks: that's the answer i was fearing

21:24 TimMc: Is that even supported?

21:24 gfredericks: TimMc: it's in the docs

21:25 TimMc: OK

21:25 gfredericks: aperiodic: I don't mean that it's probably broken, I just mean that help with gen-class is scarse, in my experience

21:25 at least in #clojure

21:27 aperiodic: it's kinda the seedy underbelly of clojure :)

21:27 gfredericks: aperiodic: doing sticky interop?

21:28 aperiodic: gfredericks: yup, with hbase and hadoop

21:28 gfredericks: aperiodic: I did get some weird behavior with "lein compile", where I started running clean first just to make sure I knew what was coming out.

21:29 I was seeing one class compiled and not the other, but after cleaning realized actually none of them were

21:29 aperiodic: i thought lein might be interfering with it as well, so i tried compiling with the repl, with the same result

21:30 gfredericks: aperiodic: you know about the *compile-files* var, right?

21:30 aperiodic: and i've been compulsively rm -rf-ing the classes dir

21:30 no

21:30 gfredericks: I guess it's kind of explained in the docs

21:30 the "when not compiling does nothing" part

21:31 but I think you can simulate compiling with (binding [*compile-files* true] (gen-class ...)), if that helps for some reason

21:31 (e.g., when testing at the repl)

21:32 aperiodic: that's the special var that controls whether or not "compile mode" is on?

21:32 gfredericks: well it controls whether or not gen-class does anything at least

21:32 gen-class is implemented as (when *compile-files* ...)

21:33 aperiodic: alright, i'll try messing around with that in the repl to see if i can replicate it there

21:34 might as well make a minimal test case too

21:34 gfredericks: yeah. don't the gen-class docs give an explicit example of two classes? Or maybe that was a blog...

21:35 either way, if you can find that, I'd start there and see if that works.

21:35 aperiodic: yeah, they do

21:36 it's at http://clojure.org/compilation, FYI

21:36 gfredericks: ah ha

21:38 jcromartie: wow, for $3K I can get 12 cores and 24 GB of RAM

21:39 that would make quite a beastly Clojure-leveraging application server

21:39 gfredericks: that's more ram than my server has disk

21:49 aperiodic: well, the example from the docs works

21:49 huh

21:50 gfredericks: time to bisect

21:58 aperiodic: will be interested to hear what it ends up being

22:00 aperiodic: gfredericks: my own incompetence! an error in the macro i was using to generate the gen-class macro form

22:01 gfredericks: silly macros

22:02 aperiodic: somehow the string i was using for the name came out of the macro \o \n \e \b \y \o \n \e

22:02 gfredericks: :)

22:03 aperiodic: well, good to know that lein/clojure work as advertised, sorry to cast aspersions on them

22:03 thanks for the help, gfredericks!

22:04 gfredericks: aperiodic: np

22:04 jcromartie: aperiodic: ah yes, anything that converts a string to a seq

22:04 ,(seq "asdf")

22:04 clojurebot: (\a \s \d \f)

22:04 gfredericks: jcromartie: I prefer ##(seq "aoeu")

22:04 lazybot: ⇒ (\a \o \e \u)

22:05 jcromartie: dvorak weenie

22:06 :P

22:06 gfredericks: :P :P :P

22:06 aperiodic: i was generating the name based off of the namespace name by invoking another fn in the macro

22:06 must confess that i haven't quite grokked macros

22:07 jcromartie: on my second week using dvorak! still rather inaccurate

22:08 gfredericks: never look back

22:08 jcromartie: aperiodic: I find it best to keep macros "lightweight"

22:09 gfredericks: aperiodic: yeah, what jcromartie said. Outsource the work to regular functions.

22:09 jcromartie: yes that's the key

22:09 write functions to compile your code

22:09 "compile", I should say

22:09 but yeah, pretty much :P

22:10 congratulations you're a compiler writer now

22:12 aperiodic: this seemed pretty lightweight, just sticking a name into a syntax-quoted gen-class construct... i think the issue was that i didn't understand the distinction between unquoting and unquote-splicing

22:13 i see how the string came out as a seq now :)

22:16 is unquote splicing just a mechanims for sticking exprs that evaluate to sequences inside of other sequences without having to do inconvenient things like concat them?

22:16 gfredericks: I think so.

22:17 aperiodic: handy tip: you can play with the quotes at the repl without writing macros

22:17 ,`(foo ~@(range 5) bar)

22:17 clojurebot: (sandbox/foo 0 1 2 3 ...)

22:18 aperiodic: oh, nurr

22:18 thanks

22:18 gfredericks: yep

22:19 ibdknox_: that's not entirely true

22:20 it lets you do some things that you can't do with apply

22:20 like call a macro with by unpacking the vars

22:20 aperiodic: could you give some examples?

22:20 ibdknox_: -with

22:21 aperiodic: what do you mean by "unpacking"?

22:21 amalloy: ibdknox_: i'm not sure what point you're making but i think you're wrong

22:22 ibdknox_: amalloy: I can't (apply some-macro ..)

22:23 but I could do `(some-macro ~@(range 0 2))

22:23 amalloy: ibdknox_: his question was whether ~@ is a convenient way to avoid writing concat, not apply

22:23 which is true

22:23 ibdknox_: ah

22:23 dnolen: amalloy: is it possible to see other solutions to 4clojure 130?

22:23 ibdknox_: I misread

22:23 amalloy: dnolen: yeah, if you've solved it you can see solutions of any users you follow

22:24 aperiodic: oops, stupid qwerty reflexes

22:24 gfredericks: ibdknox_: for your example, don't you have to have the seq at compile-time?

22:24 dnolen: amalloy: I have no interest in solving, only comparing the kotarak's core.logic version to other solutions.

22:24 amalloy: heh

22:24 i'll go steal them for you, then

22:24 dnolen: amalloy: thx

22:25 gfredericks: I think I just witness dnolen hacking into 4clojure and stealing consumer data

22:25 dnolen: haha

22:26 aperiodic: ibdknox_: could you list your example regarding ~@ again?

22:26 i accidentally parted right after you posted it

22:27 amalloy: ~search for ~@

22:27 clojurebot: #<Exception java.lang.Exception: 500>

22:27 amalloy: hiredman: ^?

22:31 aperiodic: https://gist.github.com/32a3730c04fcee671ab1

22:31 aperiodic: grazie

22:45 ThreeCups: I've got a string that I'm trying to put quotes around. I've done this: (str "\"" my-str "\""). Is there a better way to do this?

22:46 dnolen: of course the fun part about kotarak's solution (white longer) is that we can go from the solution and infer the node and the original tree :D

22:46 s/white/while

22:46 lazybot: <dnolen> of course the fun part about kotarak's solution (while longer) is that we can go from the solution and infer the node and the original tree :D

22:46 amalloy: ThreeCups: it seems unlikely that what you actually want to do is put quotes around a string

22:46 dnolen: will have to see if we can make it shorter later ...

22:46 amalloy: more likely you want to take a string that you have, and embed it in some other string, like ##(pr-str "test")

22:46 lazybot: ⇒ "\"test\""

22:47 amalloy: in which case if the original string already has a quote inside it, your version has an "injection" issue, while pr-str doesn't: ##(pr-str "this is kinda \"cool\"")

22:47 lazybot: ⇒ "\"this is kinda \\\"cool\\\"\""

22:48 ThreeCups: amalloy: I hear you... I know there are no quotes inside it. But there prolly is a better way to go about this

22:48 This is my first clojure code, so I've got a lot that I'm trying to figure out

22:49 amalloy: ThreeCups: pr-str is the simplest, shortest, and safest solution. there doesn't seem to be much point to go looking for something more complicated because pr-str provides features you don't need :P

22:50 ThreeCups: amalloy: sounds good. right now I'm just trying to get familiar with what's available in the std lib. FWIW, I'm using the clojure-contrib.json stuff and I need to quote a date string

22:52 BruceBGordon: newbie alert: I tried to install Clojure following the directions at http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html

22:53 brehaut: BruceBGordon: http://dev.clojure.org/display/doc/Getting+Started+for+Beginners

22:53 BruceBGordon: ...running ant to build clojure use sun jdk the build fails because clojure.test-clojure.java.io fails

22:53 ThreeCups: Very beginner question: I'm on linux. I write my code in vim. I'm building using leiningen. I'm using compojure (and ring). So I ran

22:53 $ lein ring server

22:53 brehaut: github.com/technomancy/leiningen

22:53 ThreeCups: and I've got my browser up and running. Now I need to debug some code. How do I go about this? Logging? Debugger? print to the output stream?

22:54 brehaut: BruceBGordon: go get lein from github and flag installing clojure from source

22:54 jcromartie: ThreeCups: the REPL and println are your friend

22:55 brehaut: BruceBGordon: the leiningen readme tells you how to install it

22:55 jcromartie: you should be able to test anything your web app does from the REPL

22:55 i.e. pass requests to routes

22:55 brehaut: i second jcromartie's comments

22:55 BruceBGordon: ok, will abandon http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html

22:56 ThreeCups: jcromartie: Thanks! so $lein repl?

22:56 BruceBGordon: For my information, does "git://github.com/clojure/clojure.git" get the equivalent of "head"

22:58 amalloy: BruceBGordon: it gets everything

22:58 jcromartie: ThreeCups: yes, from your project directory

22:58 BruceBGordon: and then the ant task will build what? the latest?

22:59 amalloy: BruceBGordon: brehaut's suggestion, to not build clojure, is a good one in almost all cases

22:59 Apage43: mrm, on clojure 1.3 now. The one thing I used from old-contrib pretty much all the time was clojure.contrib.json. What's the favorite json parser right now?

23:00 BruceBGordon: k, I'm following http://dev.clojure.org/display/doc/Getting+Started+for+Beginners

23:00 jkkramer: ~cheshire

23:00 clojurebot: https://github.com/dakrone/cheshire

23:00 jkkramer: Apage43: ^

23:00 Apage43: heck yeah

23:01 brehaut: BruceBGordon: clojure differs from a lot of languages in that the compiler etc is treated more like a service, and other tools – such as leiningen – provide the enviroment (project managment, repls, etc) that you interact with.

23:01 amalloy: BruceBGordon: looks like a good guide. afaict it's not telling you to build anything, right?

23:01 brehaut: BruceBGordon: in particular its quite uncommon to have a system wide clojure installation

23:01 amalloy: the prior link BruceBGordon was following had pages of crap to build

23:05 BruceBGordon: amalloy: re good guide, are you talking about http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html

23:05 amalloy: no, definitely not

23:05 BruceBGordon: :-), k

23:06 brehaut: there are far too many guides in the wild with no version numbers or datestamps

23:06 (as well as completely crazy instructions)

23:07 ibdknox_: brehaut: something I'll complain about at the conj

23:08 brehaut: ibdknox_: problem is, the people at the conj are going to be the sort of people who a) produce non-lunatic docs b) know how to either get them in a central place or keep them up to date themselves

23:09 jcromartie: brehaut: true that

23:09 ibdknox_: I was thinking more of coming up with a canonical solution to the problem

23:10 as in clojure.org is pretty :)

23:10 jcromartie: brehaut: I'd say most Clojure writing on the web is obsolete

23:10 ibdknox_: and gets you going very quickly

23:10 brehaut: jcromartie: i think you are right

23:10 ibdknox_: I find that weird

23:10 jcromartie: clojure.org reads very nicely

23:10 you can go read it in order and get a nice terse overview

23:10 ibdknox_: hm

23:11 jcromartie: the front page doesn't have a single line of Clojure on it

23:11 brehaut: i personally found clojure.org really helpful, but i know people who found it impenatrable

23:11 jcromartie: no, but if you start going down the left-hand list of topics, it's great

23:11 if you can read, that is :)

23:11 ibdknox_: lol

23:11 jcromartie: many people just don't have the patience to read something from the beginning

23:11 ibdknox_: I think it can be improved immensely :)

23:12 jcromartie: of course a "Hello, World!" would be great on the front page

23:12 but it's really so trivial that it's not worth it

23:12 ibdknox_: I disagree

23:12 let's say your friend goes "hey check out this Clojure thing"

23:12 and the first thing you do is go to clojure.org

23:13 tons of text

23:13 it looks academic

23:13 jcromartie: it is

23:13 yes

23:13 ibdknox_: no obvious getting started path

23:13 compare that to: http://www.ruby-lang.org/en/

23:13 aperiodic: clojure.org has been invaluable to me, especially all those topics along the lhs

23:13 jcromartie: so

23:13 "Clojure is..."

23:14 aperiodic: but then again, i have a lot of patience for reading

23:14 jcromartie: yeah

23:14 ibdknox_: aperiodic: there's no doubt that there's great content there

23:14 brehaut: aperiodic: what sort of background do you have?

23:14 ibdknox_: aperiodic: it just needs to be presented in a slightly better way :)

23:14 brehaut: (aperiodic: programming / learning experience)

23:15 ibdknox_: I suspect the people using clojure at this point are also the more patient (and/or gung ho') types anyways

23:15 brehaut: ibdknox_: i agree

23:15 ibdknox_: but we should try to break that barrier at some point :)

23:15 jcromartie: the Ruby front-page code is not the best way to show off a language though

23:15 ibdknox_: and at the end of the day it helps those types too

23:16 jcromartie: don't get me wrong, I don't like ruby's page either

23:16 brehaut: i think the blub paradox is a good argument against code on teh front page

23:16 ibdknox_: brehaut: you need to anchor people, even if they can't understand it at first

23:16 aperiodic: i started out programming in actionscript (don't laugh), but i really cut my teeth on processing. then i mainly programmed in c or obj-c, with a little bit of ruby

23:17 jcromartie: I'd like to see some snippet of code involving an agent or something.

23:17 or pmap

23:17 scottj: I think the clojure website design is the way it is bc it came from before there were any books on clojure so it filled that gap and also before there was much of a community so it didn't have to play a portal role. I personally still like it though

23:18 aperiodic: i was exposed to scheme in a pl course, but didn't use it after that; clojure is the first lisp i've really gotten into

23:18 oh, i also did a lot of fooling around with haskell, but nothing too serious

23:19 brehaut: aperiodic: given all that, im not surprised you found the clojure.org site useful

23:19 aperiodic: brehaut: why do you say that?

23:20 brehaut: aperiodic: because the content favors people who have a broad programming experience

23:21 aperiodic: yeah, they do kind of assume that you know what to expect in a language

23:22 jcromartie: not many noobs come to Clojure

23:22 or Lisp of any kind

23:22 except 3rd graders in Logo :P

23:22 20 years ago

23:22 brehaut: clojure solves problems that noobs dont really know they have ;)

23:22 jcromartie: yeah

23:22 hah

23:22 aperiodic: haha

23:24 ibdknox_: I'm actually very curious to try teaching programming from scratch with Clojure

23:24 jcromartie: my brother just started working in finance, and has inherited some gnarly C++ mess, where (SURPRISE, SURPRISE!) concurrency and mutable state are causing all sorts of headaches

23:25 ibdknox_: I think it's actually pretty hard, because a lot of the Java underpinnings show through

23:26 ibdknox_: jcromartie: I don't know that I believe that. When you first start, interacting with the host is largely unimportant

23:26 assuming it's instructor lead

23:26 jcromartie: ibdknox_: until you want to upper-case a string

23:26 ibdknox_: ,(use 'clojure.string)

23:26 clojurebot: WARNING: replace already refers to: #'clojure.core/replace in namespace: sandbox, being replaced by: #'clojure.string/replace

23:26 jcromartie: or catch an exception?

23:26 clojurebot: WARNING: reverse already refers to: #'clojure.core/reverse in namespace: sandbox, being replaced by: #'clojure.string/reverse

23:26 nil

23:26 ibdknox_: ,(upper-case "woohoo")

23:26 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalStateException: replace already refers to: #'clojure.string/replace in namespace: sandbox>

23:26 jcromartie: :) I got it

23:27 brehaut: i think someone broke the bot :P

23:27 ibdknox_: whoops

23:27 lol

23:27 brehaut: ,1

23:27 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalStateException: replace already refers to: #'clojure.string/replace in namespace: sandbox>

23:27 ibdknox_: haha

23:27 ,(+ 1 2)

23:27 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalStateException: replace already refers to: #'clojure.string/replace in namespace: sandbox>

23:27 ibdknox_: :(

23:27 hiredman: I killed clojurebot

23:27 jcromartie: YOU BROKE HIM

23:27 amalloy: haha again? wasn't it ibdknox last time too?

23:28 ibdknox_: no

23:28 amalloy: &(+ 1 2)

23:28 lazybot: ⇒ 3

23:28 ibdknox_: I did no such thing

23:28 jcromartie: how many bots are there?

23:28 amalloy: lazybot: see if you can impress them

23:28 jcromartie: clojurebot, lazybot, sexpbot

23:28 clojurebot: sexpbot is not a clojurebot

23:28 amalloy: jcromartie: sexpbot is dead, long live lazybot

23:28 ibdknox_: &(require 'clojure.string)

23:28 lazybot: ⇒ nil

23:28 ibdknox_: &(clojure.string/upper-case "hey")

23:28 lazybot: ⇒ "HEY"

23:28 ibdknox_: in any case

23:29 I think you can actually get quite far learning "programming" without ever running into the java bits

23:29 what's also interesting, is teaching the java-bits in the context of clojure to being with

23:29 jcromartie: ibdknox_: probably pretty far

23:29 ibdknox_: and Java is probably easy after Clojure :)

23:29 ibdknox_: hehe

23:30 amalloy: jcromartie: that's a brave assertion

23:30 ibdknox_: I actually think Clojure is simpler than Java

23:30 amalloy: "Argh I just want to map over this stupid array, why do I have to write another freaking for loop?"

23:30 jcromartie: heh

23:30 ibdknox_: the problem is you had to unlearn a bunch

23:30 jcrossley3: is it possible to catch multiple exception types in a single catch clause?

23:30 jcromartie: that's true

23:30 ibdknox_: but if you started from there...

23:30 amalloy: jcrossley3: no, but you can catch a common parent if they have one

23:30 jcromartie: jcrossley3: only with a shared superclass

23:31 aperiodic: "why do i have to spend half my time casting things?"

23:31 jcromartie: and with one fell swoop, jcrossley3 demonstrates how easily Java concepts bleed through :)

23:31 jcrossley3: heh

23:31 ibdknox_: jcromartie: you wouldn't even know what an exception is :p

23:31 but yeah

23:31 jcromartie: ibdknox_: until you did (/ 1 0)

23:32 &(/ 1 0)

23:32 lazybot: java.lang.ArithmeticException: Divide by zero

23:32 ibdknox_: but again, you'd understand it as a Clojure concept

23:32 I produced an error

23:32 not as some class that follows some crazy hierarchy

23:32 jcromartie: &(int nil)

23:32 lazybot: java.lang.NullPointerException

23:33 jcromartie: &(int "asdf")

23:33 lazybot: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Character

23:33 ibdknox_: lol

23:33 jcromartie: OH GOD WHAT IS THAT'

23:33 jcrossley3: i need to react the same way for both javax.naming.NameNotFoundException and javax.jms.JMSException. seems verbose. thought there might be some clever destructuring trick.

23:33 jcromartie: 'says the n00b

23:33 ibdknox_: no different than if they did the same thing in *any* language

23:33 jcromartie: jcrossley3: you can nest try/catches and re-throw

23:34 or... if you're feeling really brave, write a multi-exception try/catch macro

23:34 amalloy: you don't need a macro *really*

23:34 jcromartie: (multi-try ... (catch [javax.naming.NameNotFoundException javax.jms.JMSException] e ...))

23:35 sounds wrong though

23:35 amalloy: (let [handle (fn [e] (...deal with it...))] (try (...) (catch SomeException e (handle e)) (catch OtherException e (handle e))))

23:35 you're repeating more than you'd have to if you had a macro, but functions get you most of the way there

23:36 jcrossley3: amalloy: that's the direction i was headed. just wanted to make sure i wasn't missing something. thanks!

23:38 jcromartie: pffft, sissy... you don't want to make a recursive try-catch-generating macro?

23:38 :)

23:39 amalloy: huh? it's not hard, it's just silly

23:40 jcromartie: yes

23:41 ibdknox_: amalloy is a no-nonsense kind of guy

23:44 dnolen: ibdknox: not only is Clojure simple, I think there's good argument that it's simpler then many, many languages. ClojureScript's compiler is ~1K LOC! CLJS ~3K LOC.

23:45 ibdknox_: dnolen: I agree.

23:45 dnolen: it's shameful to say, but core.match is bigger than the CLJS compiler :P

23:45 ibdknox_: haha

23:57 dnolen: ibdknox_: have you messed around much w/ CLJS + Canvas. I tried out Google Closure CanvasGraphics, dog slow.

Logging service provided by n01se.net