#clojure log - Apr 20 2012

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

0:07 brweber2__: does anyone have any idea why (iterator-seq (.iterator x)) would be calling (.next x) ?

0:07 is that it caching the first 32 values?

0:13 amalloy: i expect .iterator is implemented in terms of .seq

0:16 yoklov: dnolen: awesome

0:16 they work very well

0:20 ibdknox: anyone work in finance?

0:21 I got an email from someone and I was curious if they were a well known organization

0:23 SlavikG: What's the .symbol syntax again?

0:27 tmciver: SlavikG: you mean Java interop? (.someMethod someJavaObject)

0:28 eggsby: I always forget the difference between member method and static method... tmciver the version there is member, right?

0:28 SlavikG: Ah

0:29 So it's someJavaObject.someMethod?

0:29 eggsby: where (. (Date.) getTime) is an example of using a static?

0:29 amalloy: that's not static either

0:29 SlavikG: So like ehh (.reverse "Foo") would be "Foo".reverse() in java basically?

0:29 eggsby: :O

0:29 amalloy: that's just (.getTime (Date.))

0:30 muhoo: i finally figured out why i can relate to the clojurebook.com more than joy of clojure. clojurebook uses ruby often as point of familiarity/contrast.

0:30 eggsby: I've been using 'clojure in action'.

0:30 I'm starting a course on codelesson.com next week hosted by the author

0:30 muhoo: not quite "cloojure for ruby webdevs", but close enough for me to get it.

0:31 yoklov: SlavikG: yeah

0:31 eggsby: amalloy: so they are just different notations, is there a difference in clojure syntax between calling a static method and an instance method?

0:31 yoklov: you can access fields with (.-field obj) in 1.4 now too

0:31 eggsby: oh wow yoklov, that's neat

0:32 amalloy: eggsby: the same syntax works: ##(.parseDouble Double "11")

0:32 lazybot: java.lang.IllegalArgumentException: No matching method found: parseDouble for class java.lang.Class

0:32 eggsby: cool

0:32 amalloy: well, maybe not, i guess? ##(macroexpand '(Double/parseDouble "11"))

0:32 lazybot: ⇒ (. Double parseDouble "11")

0:33 amalloy: apparently the shorthand is different but the longhand is the same

0:34 eggsby: macroexpand, I'd never seen that before

0:34 how neat

0:35 muhoo: wait, isn't field access (.field obj) in 1.3?

0:35 amalloy: that still works

0:35 eggsby: So what are the implications of the new extensible reader?

0:35 muhoo: why the extra - now?

0:37 dnolen: muhoo: in ClojureScript (which targets JS), it's impossible to differentiate field access from method calls, thus -.

0:38 eggsby: JSON-like convenience + XML-like extensibility

0:38 amalloy: dnolen: not actually impossible, obviously. we could have chosen to do something like (. obj (foo)), right? the .-foo syntax was, afaik, chosen because authors expected (.foo obj) to be a method rather than a property

0:39 which i guess is how things were before

0:40 dnolen: amalloy: yes

0:41 muhoo: thanks for explaining

0:48 dnolen: mmarczyk: ping

1:04 wkmanire: crap

1:04 My fridge was set to be too cold.

1:04 :(

1:04 Froze all the beer.

1:04 ben_m: Beer ice!

1:04 wkmanire: beer solid.

1:05 * wkmanire is eating a beer.

1:06 wkmanire: (map defrost (:beers fridge))

1:07 ben_m: pmap

1:07 So it's faster.

1:07 technomancy: pmap if you have multiple consumers

1:07 ben_m: Multiple defrosters?

1:07 wkmanire: You guys wanna come over?

1:08 technomancy: Did you write clojure-mode from scratch or did you modify another LISP major mode?

1:15 amalloy: wkmanire: neither. he took over from jchoi

1:16 wkmanire: amalloy: Oh, I thought he was the author.

1:16 amalloy: if you want to know about its beginnings, i'd look at the git log

1:16 wkmanire: Well yeah.

1:23 devn: lol, https://skitch.com/thinkslate/8wtam/mixtent-clojure-cemerick-vs-rhickey

1:26 wkmanire: devn: Is that for real?

1:26 :D

1:30 lynaghk: ibdknox, you around?

1:30 ibdknox: lynaghk: hey

1:30 lynaghk: I've been using Waltz and thinking about different approaches to integrate it more tightly with, um, state. Atoms, for the most part.

1:30 ibdknox: I thought about them having properties

1:31 lynaghk: each state?

1:31 ibdknox: "properties"

1:31 no on the machine

1:31 what's the example?

1:31 lynaghk: I'm using the states roughly to correspond with UI screens

1:32 so, say, the user is in the :dashboard state, which shows a screen with some multiselect widgets

1:32 The state of those widgets is held in atoms---I'm thinknig of different ways to try and persist that stuff

1:33 ibdknox: so far that's what I've been doing

1:33 lynaghk: so, perhaps, adding serialize/deserialize functions for each state.

1:34 ibdknox: lynaghk: I'd have to see it

1:34 lynaghk: (I need to persist the entire application state in the URL)

1:34 ibdknox: ah

1:34 I see

1:34 ok

1:35 didn't realize that part

1:35 eggsby: lynaghk: have you seen http://hashify.me ?

1:36 lynaghk: adding serialization fns to the state machine is the most general solution I can think of---I'm also considering making mutable state an explict part of the machine itself---you'd pass each state a reference to the atoms you're using and it'd handle (de)serialization automagically.

1:37 eggsby: nope, I hadn't. I'll be doing something similar---using prn to save all of the Clojure data structures and base64 encoding, probably.

1:37 ibdknox: lynaghk: seems like you could do something in combination with my transition on hash stuff

1:38 lynaghk: ibdknox: then I'd need to represent *all* of the state using state machine states, no?

1:40 ibdknox: I don't think you necessarily have to, that it would need access to all of it

1:40 lynaghk: I've been reading around trying to figure out how people structure this stuff. It feels sort of backhanded to use a "state machine" and then juggle some extra hoops to handle additional state =)

1:40 ibdknox: -that +but

1:40 lynaghk: yeah, I haven't thought about trying to represent all state in the url

1:40 never really had a need to

1:41 so not something I've given a lot of hammock time to :)

1:41 lynaghk: ibdknox: me neither, until last week. I can think of some ways to do it, but I'm trying to come up with a nice, general method.

1:41 ibdknox: I did think that realistically you needed to be able to adorn the machine with properties

1:42 even my metrics thing would need it for something simple like dependent metrics

1:42 lynaghk: ibdknox: I'm not sure what you mean; global machine properties, or properties that individual states have?

1:42 ibdknox: I was thinking global state.

1:43 in your case it seems like there'd be one machine controlling the transitions between views

1:43 and one for each view if it needs it

1:44 lynaghk: ibdknox: yeah. Right now everything is on one machine, with individual screen behavior mediated by watchers (e.g., watch dropdown selection, when it changes fetch new data and update chart)

1:45 ibdknox: I think it might be better to break them apart, but that's just based on what I'm envisioning in my head

1:45 lynaghk: ibdknox: sub-machines would be cleaner though, especially to move between loading/error states

1:45 ibdknox: managing all of it in one will get msesy

1:46 lynaghk: ibdknox: any thoughts on a hierarchical state machine? I could use what's in Waltz now to build additional machines for different views, but there might be some advantage to integrating them all

1:46 Some sweet debugging, at the very least.

1:47 ibdknox: so I think you could do that with the properties thing I was talking about

1:47 the big machine would have the sub ones as properties

1:47 but I haven't really thought through that either

1:47 lynaghk: (:current-sub-statemachine sm)?

1:47 ibdknox: basically

1:48 then the states would manage that themselves

1:48 it strikes me as potentially being very clean, but still integrated, but I obviously haven't tried it yet :D

1:48 so I could be spewing nonsense

1:48 lynaghk: Well, I need to bite the bullet and do something.

1:49 That said, I'm pretty sure this won't be the last CLJS project I do, so I'll get some chances to try out different approaches in the future =)

1:49 ibdknox: yeah, I'm going to be figuring out a bunch myself for light table

1:49 lol

1:50 lynaghk: A friend of mine pointed out that I'm hit with a double punch---my work is for clients (so it needs to get done), but I also open source a ton of it (so it needs to be clean).

1:51 ibdknox: yeah, props on the light table. Must have been a surprising change of direction for you from the other project

1:52 ibdknox: definitely unexpected

1:52 lol

1:53 lynaghk: so I take it you'll be having a GSoC intern do most of the work, while you test out different hammocks in the South Pacific?

1:53 ibdknox: that's the plan ;)

1:53 lynaghk: = P

1:53 devn: gah

1:53 we need to fix clojars

1:55 lynaghk: ibdknox: alright, I'm out. Thanks for the tips.

1:55 ibdknox: lynaghk: anytime! ttyl

1:57 devn: ibdknox: howdy

2:15 * devn gets no respect

2:15 devn: anyone around this evening?

2:15 Raynes: I am.

2:15 On LA time.

2:15 devn: hey man!

2:15 Raynes: Suuuup

2:15 devn: you're in LA now?!

2:15 Raynes: Until day after tomorrow. I've been here since last Friday.

2:15 I'm moving out here in like a month and a half.

2:15 :p

2:16 devn: I was trying to figure out how to send you a damned hard drive in the middle of Nowhere, TN

2:16 eggsby: cool, I'm from LA :)

2:16 devn: and all of a sudden you're fighting traffic in LA

2:16 the world is strange my friend

2:16 eggsby: ~socal clojure meetup~

2:17 devn: :)

2:17 Raynes: eggsby: o/

2:17 devn: are those smell lines?

2:17 or?

2:17 eggsby: \o

2:17 devn: Raynes: are you leaving geni?

2:17 Raynes: No, I'm joining Geni.

2:17 I'm coming out here to work full time.

2:17 devn: oh, i thought you worked with them already

2:17 were you remoting?

2:18 (this doesn't need to be public btw)

2:18 (sorry)

2:18 amalloy: eggsby: there's already an LA meetup, usually in century city

2:18 Raynes: devn: Totally cool with public.

2:18 eggsby: amalloy: I gotta get in the loop

2:18 Raynes: And yeah, I was remoting part time for a year.

2:18 devn: gotcha

2:19 well, congrats. i actually have a few friends and relatives in LA. I will probably be there early Aug.

2:19 I'll bug you then!

2:19 Raynes: devn: Sounds great! :D

2:20 devn: im still angry you're not going to euroclojure

2:20 (where i'm going to bomb a co-presented talk)

2:20 Raynes: I wish I could man.

2:21 devn: im freaking out a bit. im annoyed at how calm you were during your talk at the conjh

2:21 Raynes: But they're paying so much for me to fly back and forth over the next couple of months (not to mention relocation fees)… And I certainly can't afford it myself.

2:21 :P

2:21 devn: conj*

2:21 Raynes: devn: Oh God no, I was scared to death.

2:21 devn: i have a co-presenter, but im still not entirely sure what the game plan is

2:21 and...it's the closing talk

2:21 of...the entire conference

2:22 * devn facepalm

2:22 Raynes: devn: I was deep, deep inside my head when I started the talk. I put myself in a place where I didn't care whether or not I did a good job and just started talking.

2:22 Once people express joy, you're fine.

2:22 devn: Raynes: *nod* it's just tought to know what the person im presenting with will be like

2:22 tough*

2:23 i have a sense of it based on talks of his ive watched, and ive shared a google doc with him with experiences and so on

2:23 but i want to have people leave this talk feeling like they're goddamn alan kay on a mission

2:23 let's fucking *do this*

2:24 but i dont know if im affable enough to pull that off

2:24 nor am i sure that is something the crowd will generally respond to

2:24 in other words, im overthinking it.

2:24 ;)

2:24 Raynes: :p

2:24 That's one thing I think I didn't do.

2:25 I didn't think about much in my talk. I just wrote what was on my mind.

2:25 devn: Raynes: i think that's totally reasonable. i rather enjoyed your talk. you're fun to listen to

2:25 i guess the idea of being the last talk just freaks me out a bit

2:26 i feel like it needs to be a solid book end

2:26 seancorfield: what's your talk about devn

2:26 devn: and im trying to figure out what that is

2:26 seancorfield: it's a "soft talk" about community, building clojure communities, what we do right, what we need to improve, etc.

2:26 seancorfield: (and i'm still up because i'm in the SF Bay Area and i'm a bit of a night owl - esp. when the wife's away)

2:26 devn: aka, no category theory

2:27 seancorfield: soft talks can be good too - we shouldn't have hard tech stuff all the time

2:27 Raynes: The last talk is bad because it means you have to anticipate it and it might make it difficult to enjoy the conference.

2:27 devn: it's a lay up in some respects

2:27 but it's deadly serious in others

2:28 im very serious about this stuff, so that makes it easy, but whether or not this is something the audience generally gives a shit about is another matter

2:28 seancorfield: The Bay Area now has three Clojure meetups a month. Two full-on user groups and a dojo group.

2:28 devn: ^-fucking winning

2:29 i took neal ford's advice and started lurking around schools

2:29 i went to a presentation this evening by a student on ruby on rails and repped my clojure meetup group

2:29 seancorfield: That could be misinterpreted :)

2:29 Raynes: devn: Taken out of context, that could....

2:29 devn: :)

2:29 Raynes: Bahahahaha

2:29 seancorfield: o/

2:29 devn: seancorfield: he already made that joke!

2:30 Raynes: devn: You're now on the twitters.

2:31 devn: wtf is twitter?

2:31 OH: [23:22:02] <devn> i took neal ford's advice and started lurking around schools

2:31 lol, you sonofabitch

2:32 pardon my portugese

2:32 Raynes: Haha

2:32 devn: no but seriously. this sounds terrible and in some ways totally weird

2:33 but i think we need a "clojure street team"

2:33 people who take up the cause of being the creepy language evangelist

2:33 in all of the right places

2:33 hahaha, Raynes -- @rbxbx

2:34 Raynes: Yeah, heh

2:35 devn: seancorfield: how often do you attend the aforementioned user groups?

2:36 seancorfield: I run the SF one, so every month for that. I was supposed to go to the MV one tonight but with the wife away, it's hard to get all the chores done and still get across the bay by 6pm so I skipped it.

2:36 I'm hoping to get to the next dojo on the 24th

2:37 devn: seancorfield: wanna come hang out in madison for a long weekend sometime?

2:37 summer is nice here FWIW

2:37 seancorfield: LOL... only if there was a cat show there my wife was judging!

2:38 Raynes: seancorfield: Lance said he'd take me to SF at some point after I move out here. Could I see your kitties?

2:38 devn: im just...

2:38 im going to abstain...

2:38 Raynes: He has cats!

2:38 seancorfield: She was out in WI a month or so back actually, but we're under a deadline at work so it's hard to get more time off...

2:38 Raynes: I like cats!

2:38 devn: ...

2:38 just...

2:38 Raynes: I want to see his cats. Is that so bad? :(

2:39 devn: i dont know...

2:39 seancorfield: Raynes: we live in the East Bay, about 35 miles from SF... But, yeah, you'd be welcome to come see the cat house :)

2:39 devn: seancorfield: threaten to quit!

2:39 ;)

2:39 seancorfield: See our kitties here: http://bangles.com

2:39 devn: dude you own the bangles domain

2:40 seancorfield: My wife's name is Bangle. She's owned it for years and years.

2:40 devn: haha that's awesome

2:40 seancorfield: But, yeah, we get a steady stream of requests to buy it.

2:40 devn: i remember going to buy devin.com

2:40 and this bastard, devin carraway

2:40 ive followed him his entire damned life

2:40 seancorfield: Turned down $20k for it last year.

2:40 devn: silently waiting for him to go broke and fail to pay his reg fee

2:40 so i could buy that goddamn domain

2:40 but no dice

2:41 seancorfield: LOL... I own corfield.org but haven't managed to get corfield.com yet :)

2:41 Raynes: I just… I'm just Raynes.

2:41 devn: i have some rot13 domains

2:41 Raynes: I'd just change my name to Raynes before I'd pay for the "anthony" domain.

2:41 devn: qriva.com => devin.com, pbqr.org => code.org

2:42 seancorfield: most of the domains i own are cat-related: sites i maintain for friends in the cat fancy...

2:42 Raynes: mraow

2:42 devn: rot13 domains are the rotten food scraps of a generation of interneters

2:43 seancorfield: i was on the cover of cat fancy

2:43 the picture: it was all seductive-like

2:44 seancorfield: heh, which issue - i bet we have a copy

2:47 wow, our clojure-powered email / matching profile process has sent out 100,000 emails in the last 24 hours... my tweaks to its concurrentness must have worked :)

2:52 devn: seancorfield: what are you using to achieve that?

2:53 seancorfield: it's just a bunch of clojure code that scans a MySQL DB (clojure.java.jdbc), runs searches (custom code against Discovery by Transparensee), generates HTML emails (Enlive) and sends them (wrapper around javax.mail)

2:54 and right now we're just using pmap in a couple of places for parallelizing

2:54 nothing fancy

2:54 devn: really? pmap?

2:54 I see that being used in so many wrong scenarios

2:55 constructing an email seems like it might not be the right fit?

2:55 i guess it depends largely on chunking

2:56 seancorfield: the per-item process calls out to another server for the search as well as running some compute-intensive filtering as well as generating the email

2:56 so pmap works pretty well

2:56 devn: gotcha

2:56 pmap was this magical thing to me when i first got to clojure

2:56 and i realized pretty quickly i had to use my head before using it

2:56 seancorfield: we could certainly streamline it a bit... right now we're only hitting 50-75% CPU utilitization on a 16 core box

2:57 devn: the power can sometimes be too much, even for us... ;)

2:57 seancorfield: that's really cool

2:58 seancorfield: i may be starting a project where i have access to some /serious/ machines

2:58 80 core machines, SSDs, clustered

2:58 seancorfield: nice

2:59 we just have five 16 core, 16GB dell servers in a data center on the east coast

2:59 devn: im excited to drop clojure on it and see what happens

2:59 seancorfield: well, for this new platform

2:59 we have tons of windows servers too but those are all going away :)

2:59 devn: seancorfield: that's not small. :)

3:01 seancorfield: either way, i may bug you at some point about perf stuff. it sounds like you're doing this in practice

3:02 this project is heavy on agent-based modeling

3:03 seancorfield: so far we have about a million members on the new platform - with another two and a half million members being migrated over in the next few weeks

3:03 then we'll really be able to see how far we can tweak things :)

3:04 then we can start to think about migrating from mysql to mongodb for a few more things

3:05 but it's all just basic stuff... persistence, json/xml transformation, web service interactions, some html email generation

3:06 devn: seancorfield: cool, that's a big user base

3:06 seancorfield: are you guys doing perf testing?

3:08 seancorfield: haven't needed to do much so far

3:08 devn: http://www.youtube.com/watch?v=G5NdmOCe0Z4&feature=related

3:08 seancorfield: bizarre

3:09 devn: :D

3:09 keep it weird.

3:09 keep it clojure.

3:09 seancorfield: we know there are some hotspots in the application and we're rewriting bits of the code as necessary to speed things up... but that's mostly rewriting from CFML to Clojure :)

3:10 and we have a smart DBA who reviews and tweaks a lot of SQL so we don't bog down on that side of the house

3:24 muhoo: what's the differenced between into and merge when adding stuff to maps?

3:25 hmm, ok nevermind, into only takes 2 args, merge is multi-arity

3:30 SlavikG: What's the reasoning again that you can just use (vec 4) for lookup in a random vector and hash and what not etc butn ot with lists?

3:30 amalloy: vectors can do it fast

3:31 SlavikG: That's it?

3:31 Just to notgive the ilussion of performance?

3:31 amalloy: as far as i know

3:32 SlavikG: At least give me somthing like (list true) is the first element and (list false) the tail or something. ==

3:32 I want something, it's cool

3:32 amalloy: okay, i'll let you in on a secret

3:32 (list x), for all x, is an exception

3:32 !!!

3:32 SlavikG: Yeah, so that I don't want

3:33 Gimme something with it.

3:33 amalloy: beggars can't be choosers

3:33 SlavikG: Looks cooler.

3:33 muhoo: write it

3:34 amalloy: okay, how about: ##(:gimme-the-magic (list 1 2 3 4 5) 15)

3:34 lazybot: ⇒ 15

3:34 muhoo: hahaha

3:34 SlavikG: Shouldn't that throw an exeption or something because a list doesn't have symbolic keys?

3:35 muhoo: &(:foo :bar :baz)

3:35 lazybot: ⇒ :baz

3:35 SlavikG: Or keywordic keys

3:35 technically

3:35 Oh wow

3:35 I'm not sure if I agree with that

3:35 &(:I :worship :his :shadow)

3:35 lazybot: java.lang.IllegalArgumentException: Wrong number of args passed to keyword: :I

3:35 SlavikG: Well

3:35 that's a start

3:36 muhoo: o GAWD not with the lexx references again

3:36 someone put one up a few weeks ago, and i was singing the goddamned "brunnen g" song for a fricking week. BAD.

3:36 SlavikG: That was most likely I.

3:36 I always use 'I worship his shadow' if I need four symbols

3:37 I also constantly change my nickname.

3:37 amalloy: Llajla, you always use that no matter how many symbols you need

3:37 SlavikG: Well, I use it when I need four or the number doesn't matter

3:37 If I need 3 I can't let it work

3:37 with five, maybe I can use 'I wroship his divine shadow'

3:38 muhoo: &(:as :you :command :stan)

3:38 lazybot: java.lang.IllegalArgumentException: Wrong number of args passed to keyword: :as

3:38 muhoo: ah, as means something

3:39 amalloy: no it doesn't

3:39 muhoo: it thought i was destructuring

3:39 &(:foo :bar :baz)

3:39 lazybot: ⇒ :baz

3:39 SlavikG: &(:the {:giga "Shadow"})

3:39 lazybot: ⇒ nil

3:39 muhoo: &(:as :foo :bar :baz)

3:39 lazybot: java.lang.IllegalArgumentException: Wrong number of args passed to keyword: :as

3:39 amalloy: muhoo: you're passing the wrong number of args

3:39 SlavikG: wants 2 or 3

3:39 muhoo: i see

3:39 amalloy: &(:waffle :walkie :talkie :brigade)

3:39 lazybot: java.lang.IllegalArgumentException: Wrong number of args passed to keyword: :waffle

3:40 muhoo: &(:as :foo)

3:40 lazybot: ⇒ nil

3:40 muhoo: !

3:40 &(:as :foo :bar)

3:40 lazybot: ⇒ :bar

3:40 muhoo: &(:as :foo :bar :baz)

3:40 lazybot: java.lang.IllegalArgumentException: Wrong number of args passed to keyword: :as

3:40 muhoo: &(:as :foo :bar :baz :huh)

3:40 lazybot: java.lang.IllegalArgumentException: Wrong number of args passed to keyword: :as

3:40 muhoo: interesting

3:40 SlavikG: I disagree though

3:40 it should barf because the second argument is not a record or structmap or dict or whatever

3:41 muhoo: i guess i don't really understand what it's doing there then

3:42 why (:foo :bar :baz) evaluates to :baz, but (:foo :bar :baz :quux) is an error?

3:42 amalloy: &(:foo {:x 1} :not-there)

3:42 lazybot: ⇒ :not-there

3:43 amalloy: &(:foo {:x 1 :foo 2} :not-there)

3:43 lazybot: ⇒ 2

3:43 SlavikG: muhoo, what it does is (:foo bar x) tries to look up foo in bar, if it's not there returns x as sentinal

3:43 when x is not supplied, it returns nil

3:43 But basically it doesn't barf when bar is not a record or dict or structmap or set or whatever can look that up

3:43 which is kind of weird

3:44 &(get :x :x}

3:44 lazybot: java.lang.RuntimeException: Unmatched delimiter: }

3:44 SlavikG: &(get :x :x)

3:44 lazybot: ⇒ nil

3:44 muhoo: ah, sentinel, got it

3:45 SlavikG: &(get 3 5)

3:45 lazybot: ⇒ nil

3:45 SlavikG: Yea ehhh

3:45 I'm not sure about not throwing an error there

3:45 But then again

3:45 ##(symbol? (symbol "I worship his shadow"))

3:45 lazybot: ⇒ true

3:46 SlavikG: I'm not too sure about that either

3:46 muhoo: &(get 3 5 8)

3:46 lazybot: ⇒ 8

3:46 muhoo: ok, makes sense now

3:49 SlavikG: muhoo, no it doesn't

3:49 it should raise an exception

3:49 muhoo: *sigh*

3:50 SlavikG: What, it should

3:50 looking up a number inside another number makes no sense

3:53 muhoo: i dunno then, report it as a bug in jira, i guess.

3:54 i'd be curious what you hear back on that.

3:59 bohl: Which is the most popular sql / persistence library?

4:00 vijaykiran: hibernate

4:00 * vijaykiran ducks

4:01 vijaykiran: sqlkorma has been working fine for me though.

4:04 GeraldMacDuich: muhoo, clojure has no bugs because it doesn't have a formal specification

4:04 Everything the implementation does is a feature.

4:05 I just think this feature is particularly ill thought out or just sloppy oversight, latter case being rare as one assumes that however you twist or turn it, it still investigates the type of the haystack and just defaults to 'not found' for any non collection

5:12 fliebel: I wonder how hard this really is? https://www.coursera.org/course/compilers I mean, doing a simple forth/lisp compiler isn't all that hard, but maybe they do something more involved?

5:15 clgv: fliebel: I think these courses cover attributes of formal language as well and introduce parser, lexer, .. based on that.

5:16 fliebel: the course at my university did it like that

5:16 fliebel: clgv: attributes of what? So it *is* hard?

5:18 clgv: fliebel: depends on your background. if you study computer science at a university, it is a course like others. likely more theoretical of course

5:21 devn: anything worth learning is probably "hard"

5:27 jaen: Parsing a language on it's own isn't that hard, but if they cover stuff like register allocation or optimizations then it could be somewhat worthwile course

5:27 Even if you end up using LLVM in the future or somesuch

5:30 mmarczyk: fliebel: transforming the program into static single assignment form / continuation passing style, register allocation (graph colouring and all that), noticing various optimization opportunities etc.

5:30 fliebel: plenty of stuff to talk about :-)

6:16 Killeroid: Hi, can anyone point me in the direction of where I can report a bug?

6:18 clgv: Killeroid: a bug in what? clojure or one of the many libs?

6:19 Killeroid: I think clojure.string

6:19 running (str 08) or (str 09) gives me an error

6:19 (str 01) to (str 07) dont give any erros

6:19 *errors

6:20 Also (str 010) returns "8"

6:21 clgv: thats not in clojure.string but in clojure.core/str and it's no bug since you use an octal representation of your number indicated by the leading zero

6:21 &010

6:21 lazybot: ⇒ 8

6:21 clgv: &0109

6:21 lazybot: java.lang.NumberFormatException: Invalid number: 0109

6:22 clgv: &[010 8r10 9r8]

6:22 lazybot: ⇒ [8 8 8]

6:22 clgv: that is the same notation as in java

6:22 Killeroid: Bah, completely forgot about about the base-8 num system

6:23 Thanks for clearing this up for me!1

6:24 clgv: the error message could be more specific though

6:25 Killeroid: Yeah, it could

7:49 the-kenny: Can someone recommend me a ClojureScript library for canvas manipulation?

8:27 mmarczyk: oh noes, Gmail's old look is gone :-(

8:28 Borkdude: mmarczyk: I still have the old one but my wife has only got the new one and can't revert anymore

8:28 mmarczyk: it's so ugly

8:30 mmarczyk: Borkdude: I don't mind the aesthetics that much -- although I hardly consider them an improvement -- but I think its inferior functionally :-(

8:30 there might be an improvement or two, but mostly it seems like a step back...

8:30 (a minor improvement or two)

8:31 Borkdude: mmarczyk: like what?

8:31 mmarczyk: Borkdude: actually there's just one thing that I can see -- separate scrolling for labels list

8:31 but the conversation view... ouch :-(

8:32 at least the avatars are no longer ginormous like they were in the earlier versions of the new look

8:32 (still don't know wtf I'd want to see them at all)

8:33 well, gotta dash -- got my lunch ready -- it's gonna feel solemn now, the goodbye-to-old-Gmail lunch

8:34 Borkdude: I wonder why google is doing this while I see nothing but complaints about this design

8:36 maybe it is like the windows vista of designs, making the next thing look better

8:40 kral: what the hell is a finger tree?

8:46 I'm talking about this: https://github.com/clojure/data.finger-tree

8:46 oh, ok, found the answer... http://www.soi.city.ac.uk/~ross/papers/FingerTree.html

9:01 jondot_: hi all, any mime-type detection in ring

9:05 ah. ringfinger

9:14 gko: Is it possible for clojure-mode (from package.el) to coexist with official SLIME ?

9:20 joegallo: if you've got a chance to review pull requests, there's some good ones, eng-2345 in particular is intended for -stable.

9:20 ha, wrong channel. ignore me.

9:29 mdeboard: Consider yourself ignored


9:29 RickInGA: harsh

9:31 mdeboard: I'm always harsh on Monday mornings, sorry

9:31 RickInGA: wow, the weekend is over already? that went fast

9:41 mdeboard: damn light table 3/8 of the way to the goal

9:41 wru PR campaign

9:50 clgv: mdeboard: he needs another video ;)

9:50 mdeboard: celebrity endorsement*

10:37 wkmanire: Good morning!

10:37 edw: Good morning.

10:47 samaaron`: Good afternoon!

10:53 mmarczyk: dnolen: ping

10:56 timvisher: hey kids

10:56 can anyone explain to me how I would mock the definition of a function for my tests?

10:56 i thought it would be as simple as a (binding ... form but that doesn't work because i can't bind a non-dynamic function

10:57 i don't really understand the implications of making the function definition dynamic either

10:58 S11001001: ,(doc with-redefs)

10:58 timvisher

10:59 timvisher: where's the bot? ;)

10:59 S11001001: &(doc with-redefs)

10:59 lazybot: java.lang.SecurityException: You tripped the alarm! with-redefs is bad!

10:59 S11001001: ugh

10:59 whatever, you get it

10:59 timvisher: lol

10:59 yes i do

10:59 awesome

11:00 S11001001: though you ought to look at tools.mock if rplevy ever got around to releasing it

11:00 ibdknox: hiredman1: clojurebot is dead?

11:00 oh no's!

11:00 S11001001: which is a test-friendly wrapper for with-redefs

11:00 ibdknox: he was our only link to the guards...

11:00 timvisher: sweet

11:00 wkmanire: S11001001: Wow, nice reference. I might even end up usnig that today.

11:00 :)

11:00 dnolen: mmarczyk: pong

11:01 wkmanire: using*

11:01 mmarczyk: dnolen: thanks for merging PHM! :-)

11:01 dnolen: also, for asking around for perf tests

11:01 dnolen: mmarczyk: np, exciting stuff!

11:02 mmarczyk: yeah, sounds like people using small maps - no difference, people using large ones big difference.

11:02 mmarczyk: dnolen: I'll get around to the transients tests sometime soon -- I'm closing in on the PersistentTreeMap impl, so I guess I'll wrap that up first

11:02 dnolen: mmarczyk: k

11:02 mmarczyk: dnolen: ohhh, sounds perfect then :-)

11:06 S11001001: timvisher: especially when mocking out purely impure functions, it's test-relevant to assert that they get called with the right arguments the right number of times, rather than just turning them into (constantly nil) or whatever

11:07 timvisher: S11001001: definitely. In this instance i'm trying to mock out an api that hits the network so i'm more interested in turning the call into a constant, but for more traditional mocking uses i see what you're saying

11:07 wkmanire: I sure wish I had two monitors. I'm tired of working on a laptop.

11:08 S11001001: timvisher: I actually mean cases like yours

11:10 timvisher: hmm. ok. except that the functions i'm calling are pure

11:10 there's no side effects, i just don't want to hit the network

11:10 S11001001: ok

11:20 Borkdude: Is there a way to create a REPL without "load file in REPL" in Eclipse?

11:58 jaju: &(println "hello"_

11:58 lazybot: java.lang.RuntimeException: EOF while reading, starting at line 1

11:58 clgv: Borkdude: there is "Run as". but you probably mean without having a source file?

12:01 Borkdude: clgv: yes, just a REPL to mess round, with having the possibility to insert code over multipline lines, before evaluating

12:01 zerokarmaleft: technomancy: why is :java-source-paths no longer included in get-classpath?

12:02 clgv: Borkdude: I know the idea. I want to be able to integrate it in my standalone application ;)

12:02 Borkdude: clgv: I use lein repl a lot, but when I need more than one line it gets more difficult to use

12:02 clgv: Borkdude: but afaik you need some file.

12:04 Borkdude: you could create an issue on the CCW tracker

12:04 or ping cemerick ;)

12:05 Borkdude: clgv: what is your standalone app?

12:06 clgv: Borkdude: an experiment environment for an optimization algorithm.

12:06 Borkdude: cemerick: I ordered the Clojure Programming book, can't wait to get it in the mail

12:08 clgv: Borkdude: nice trick to get his attention ;)

12:09 Borkdude: clgv: hehe, but I meant it

12:09 clgv: even

12:09 clgv: I thought so ;)

12:11 Borkdude: I think clojure.java.io is a really good illustration of the use of protocls

12:11 protocols

12:17 dnolen: interesting seems like Clojure interest on GitHub has skyrocketed in the past couple of days - https://github.com/clojure/clojure/graphs/traffic

12:18 ibdknox: Light Table?

12:18 what else happened really recently?

12:18 timvisher: has to be

12:19 Licenser: has someone wrote a clojure visit bot?

12:19 timvisher: i didn't see any big interest because of 1.4

12:19 dnolen: ibdknox: that's what I was thinking - though you don't link to it directly in your posts, or KickStarter.

12:19 Borkdude: maybe because I'm giving a clojure course, but that's only 30 people ;)

12:19 dnolen: Licenser: no, the watch list has increased dramatically as well - we're about to be the 4th most popular Java project on Github :P

12:19 TimMc: heh

12:19 Licenser: a watch bot too?

12:19 sneaky people

12:20 * ibdknox goes to turn of "watchy" before anyone can find out ;)

12:20 Licenser: ^^

12:20 TimMc: ibdknox: you mean watjure, of course

12:20 Licenser: also I want light table!

12:20 jappinen: its cause clojure is da bomb!

12:20 ibdknox: TimMc: hahaha

12:22 wkmanire: I have some functions that save and load addresses to a text file. They all take the file-name as their first argument. I want to write a function that uses partial to "configure" all of these functions at once with a file-name provided by the user.

12:22 Is this a normal thing to do?

12:25 jodaro: wow, cool github graph

12:25 timvisher: can anyone point me to reading as to why the use of `use` is increasingly being deprecated?

12:26 ibdknox: timvisher: technomancy led the fight :)

12:27 technomancy: timvisher: it's redundant, complicated, and has bad defaults

12:27 ibdknox: use and require confuse the crap out of new people

12:28 mmarczyk: it's only redundant with :require :refer, and that's assuming there's an :all option (not sure?)

12:28 technomancy: yeah, there's a :refer :all option to :require

12:28 mmarczyk: oh, cool

12:28 * wkmanire is one of the confused new people.

12:28 technomancy: though it should only be used for tests

12:28 timvisher: yes, that's actually the option that lead to my confusion

12:28 technomancy: or live-coding

12:29 noidi: wkmanire, you could replace the parameter with a dynamic var (e.g. *address-file*), and then call the functions with that var bound to the correct filename

12:29 timvisher: i agree with everything you said, but since I can now just refer all, the new solution seems to present the same problems

12:29 wkmanire: technomancy: So I should not use :use with ns?

12:29 timvisher: albeit with more work required

12:29 it's not a bad change, but i was just trying to understand if there were technical things that i didn't get about use

12:29 wkmanire: noidi: Is that generally the way this sort of thing is handled?

12:30 zerokarmaleft: technomancy: nvm wrt :java-source-paths, took the leap to preview lein2

12:30 * mmarczyk has what appears to be a working PersistentTreeMap impl in ClojureScript

12:30 technomancy: timvisher: the difference is you have to ask for everything with :refer, whereas with :use you'd get the bad behaviour by default

12:30 which I guess is what you said

12:31 TimMc: ~use

12:31 technomancy: wkmanire: if you know your code will never be run on pre-1.4 Clojure, then yes; best to avoid :use. but it's going to be a while before we can rely upon that

12:31 TimMc: Bah, deadbot

12:31 mmarczyk: given :all for tests, I guess I'm getting onto the ":use / :require unification" bandwagon

12:31 noidi: wkmanire, I think so, but you can of course wait for a second opinion :)

12:31 solussd: 'mapv' is not lazy, correct?

12:32 TimMc: right

12:32 wkmanire: noidi, technomancy: Ok. Thanks.

12:32 TimMc: &(doc mapv)

12:32 lazybot: java.lang.RuntimeException: Unable to resolve var: mapv in this context

12:32 TimMc: &(use 'clojure.repl)

12:32 lazybot: ⇒ nil

12:32 TimMc: &(doc mapv)

12:32 lazybot: ⇒ nil

12:32 noidi: wkmanire, for example, the print and println functions use

12:32 TimMc: bah

12:32 noidi: wkmanire, for example, the print and println functions use *out* so you don't have to pass the output stream argument to them

12:33 wkmanire: noidi: And this is a very similar effort. That makes sense.

12:33 dnolen: cemerick: congrats by the way on the book, perusing it now, looks amazing!

12:34 wkmanire: dnolen: I'm enjoying it so far. Once you get to chapter two its rapid fire library functions and explanations.

12:34 :)

12:34 Great stuff.

12:34 lunch time.

12:36 timvisher: is `(into #{} ...` the simplest way to compare 2 non-map seqs for order-agnostic equality?

12:36 thought that has obvious problems if you want to be aware of duplicates

12:36 maybe sort ?

12:36 gfredericks: yeah sort is probably the best you can do

12:37 timvisher: cool cool

12:37 technomancy: (set my-coll) is simpler than (into #{} my-coll) fwiw

12:37 mmarczyk: https://github.com/michalmarczyk/clojurescript/tree/persistent-tree-map

12:37 gfredericks: (def unordered= (comp (partial apply =) (partial map sort) list))

12:37 timvisher: I guess frequencies would also do it

12:38 mmarczyk: the above in case there's any interest in helping to test :-)

12:38 gfredericks: ,(apply = (map frequencies [[2 48 3 4 5 53 2] [2 3 5 53 4 2 48]]))

12:38 &(apply = (map frequencies [[2 48 3 4 5 53 2] [2 3 5 53 4 2 48]]))

12:38 lazybot: ⇒ true

12:38 timvisher: gfredericks: not a bad option either

12:39 gfredericks: &(apply = (map frequencies [[2 48 3 4 5 53 2] [2 3 5 53 4 48]]))

12:39 lazybot: ⇒ false

12:39 dnolen: mmarczyk: excellent! it's refreshing to see all that Java get converted into Clojure :)

12:39 mmarczyk: dnolen: indeed :-)

12:39 dnolen: creating the ticket & posting to clojure-dev now

12:40 pooya72: Hi Everybody!

12:40 dnolen: mmarczyk: it's also a big win for all future Clojure implementations.

12:40 mmarczyk: dnolen: I certainly hope so

12:43 http://dev.clojure.org/jira/browse/CLJS-187

12:45 this automatically means we've got PersistentTreeSet with a tiny bit of code which I'll add after testing the map impl a little bit more

12:45 devn: dnolen: are you planning on mentoring the pluggable backend for cljs?

12:47 Roxxi: Hey, dnolen, what book were you an wkmanire refering to?

12:48 mmarczyk: Roxxi: http://www.clojurebook.com/

12:48 Roxxi: Ah, thanks!

12:50 dnolen: mmarczyk: excellent

12:51 mmarczyk: dnolen: :-)

12:51 Roxxi: Has anyone ordered a programming book to use on their kindle? (Seeing as I now have a choice to make...) Is it easy enough to "flip through" when you want to look things up?

12:52 technomancy: Roxxi: it's not very good for reference, but generally you get a PDF along with the kindle version

12:52 Roxxi: Oh really? I didn't know that. Thanks :)

12:56 When you're loading the repl and it complains of some sort of syntax error, is there an easy way to ask it to reprocess the file?

12:57 Though, I suppose I should be more specific- when using the repl with lein

12:57 technomancy: you can add a :reload argument to your require call

13:01 gozala: Hi folks I'm trying to understand following lines of code

13:01 https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L3519-3529

13:01 could someone give me a hand ?

13:01 wkmanire: Damn, juxt looks scary.

13:02 TimMc: wkmanire: You will come to love it.

13:02 wkmanire: (def separate (juxt filter remove))

13:03 &((juxt filter remove) odd? (range 15))

13:03 lazybot: ⇒ [(1 3 5 7 9 11 13) (0 2 4 6 8 10 12 14)]

13:03 wkmanire: TimMc: Oh wow.

13:03 I needed that example.

13:03 That is pretty cool.

13:03 eggsby: hmm

13:03 &((juxt :a :b) {:a 1 :b 2 :c 3 :d 4})

13:03 lazybot: ⇒ [1 2]

13:04 TimMc: (map {:a 1 :b 2 :c 3 :d 4} [:a :b])

13:04 &(map {:a 1 :b 2 :c 3 :d 4} [:a :b])

13:04 lazybot: ⇒ (1 2)

13:04 wkmanire: I was just thinking that.

13:05 TimMc: Just so you know... juxt is not lazy

13:05 ...but that usually doesn't matter either way.

13:05 gozala: dnolen: do you have time to help me with https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L3987-3993

13:05 wkmanire: You know, it'd be neat if instead of a simple evaluator, lazybot made a namespace for each user that joins the channel and leaves your stuff in there for some specified period of time.

13:06 And it should let you call functions from other users' namespaces but not define stuff in them.

13:06 :)

13:06 that could be cool.

13:07 IRCREPL &c

13:12 TimMc: I think I've seen a Scheme bot do that.

13:12 Maybe rudybot?

13:13 wkmanire: TimMc: I'm thinking maybe it might not be a good idea. Might get too much flooding in the channel...

13:13 Unless you could pm the bot your entries.

13:15 njdirk: syntax ?: destructure compojure route : keys remote-addr + params email (TIA)

13:16 [email] works, and {keys [remote-addr scheme] works, but not seeing how to to both

13:17 S11001001: destructuring language is recursive on all binding positions

13:17 learn the non-shortcut syntax for picking out keyed values and you'll have your answer

13:20 noidi: njdirk, try something like {[email] :params}

13:21 mmarczyk: gozala: what's the problem?

13:21 technomancy: https://github.com/mruby/mruby <- interesting that ruby is working on the same decouple-the-compiler-from-runtime approach as clojurescript

13:21 gozala: mmarczyk: I'm trying to figure out what's the state is there ?

13:22 fliebel: Did seq-utils go anywhere in new contrib?

13:22 gozala: I kind of understand that this is destructuring [{:keys [done] :as curr-state}] of argumnts

13:22 mmarczyk: gozala: apparently {:done true/false, :value some-value}

13:22 gozala: hmm so is :keys and :as are something special ?

13:22 wkmanire: Is there a way I can reset my REPL?

13:22 gozala: mmarczyk: ^

13:23 wkmanire: Like nuke everything in it without restarting it?

13:23 noidi: gozala, yes

13:23 gozala: noidi: anyone can point out where I can read about them ?

13:23 noidi: map destructuring works like let binding: names on the left and values on the right

13:23 {name :value}

13:24 S11001001: wkmanire: the global state of the clojure environment can't be rewound

13:24 noidi: gozala, http://clojure.org/special_forms#Special%20Forms--(let%20[bindings*%20]%20exprs*)

13:24 wkmanire: S11001001: :/ ok

13:24 technomancy: wkmanire: you could remove all namespaces that aren't part of Clojure itself though

13:24 but there are no tools to do this for you

13:25 mmarczyk: gozala: see the section on special forms on clojure.org

13:25 gozala: the description of let

13:25 S11001001: and it's not entirely reliable; e.g. if you installed new entries in the global-hierarchy

13:25 gozala: noidi: so :keys will be vecrot of key names ?

13:25 mmarczyk: gozala: the destructuring language is documented there

13:26 wkmanire: No big deal. I'll just make a new namespace and work outa that.

13:26 mmarczyk: gozala: {:keys [foo bar]} m, in particular, is shorthand for {foo :foo :bar bar} m

13:26 gozala: oops, {foo :foo bar :bar} m

13:26 gozala: mmarczyk: awesome thanks!

13:27 mmarczyk: gozala: and :as provides a binding for the whole map in addition to the bindings for the stuff destructured out of it

13:27 gozala: np

13:29 njdirk: maybe my confusion is the sourcing of the values -- its clear to me that :params is provided by wrap-params, is :keys the result of ring?

13:29 {remote-addr :remote-addr email :email} seems like the non-shorthand, but generates lotta nil love

13:31 in my particular use case, I'm pulling a single value from each sourced dict -- based on both coming back nil, its clear that some secret sauce isn't dumping both into a single dict for my enjoyment

13:32 mmarczyk: njdirk: you could replace the whole map with a symbol and (prn ...) it on the next line -- then you'd know what's going on

13:32 jondot_: so, after 2-3 months of doing clojure, i got to the point when i'm absolutely in need to debug things, any idea how to do that? (im using vim for editing)

13:33 wkmanire: jondot_: As in setting breakpoints and stepping through the execution?

13:33 jondot_: wkmanire: and peeking around variables, yes

13:33 wkmanire: jondot_: I want to know how to do that too.

13:33 mmarczyk: njdirk: NB. you need to add wrap-keyword-params explicitly (or use compojure.handler/{api,site}, say) to have the map keys keyified

13:33 jondot_: well im assuming emacs supports it pretty well, but thats not my editor

13:34 technomancy: you can use the debug-repl without emacs

13:34 it doesn't give you stepping, but it's basically a way of injecting a breakpoint

13:34 jondot_: technomancy: i'll check that out

13:34 technomancy: you have access to all locals

13:34 jondot_: technomancy: but the concensus is doing that via emacs correct?

13:35 or is there some kind of eclipse/intellij thing?

13:35 technomancy: jondot_: if you need stepping I think that requires emacs or counterclockwise

13:35 in my experience actually needing stepping is rare though

13:35 (but when you need it, you really need it)

13:35 I don't know if this is the most up-to-date, but it's a starting point: https://github.com/GeorgeJahad/debug-repl

13:36 jondot_: technomancy: yea i know, just trying to debug some concurrency trouble, and not having that much time on my hands right now

13:36 technomancy: oh, apparently CDT can be used without emacs? http://georgejahad.com/clojure/cdt.html

13:36 worth a try

13:37 wkmanire: bookmarked and bookmarked.

13:37 Thanks technomancy

13:37 jondot_: yup, thanks

13:38 fliebel: mind bending. http://clj-me.blogspot.com/2009/01/recursive-seqs.html

13:38 technomancy: sure

13:48 scriptor: does anyone have any links handy on the benefits of making almost all seq-handling functions (filter, map, concat) lazy?

13:49 I know how it's beneficial for very long ones, but I want to get a better idea on the benefits for shorter ones

13:52 wkmanire: https://refheap.com/paste Would it be possible to replace the repeated use of nth in my paste with a destructuring expression?

13:52 ibdknox: wkmanire: wrong link

13:53 wkmanire: yep

13:53 https://refheap.com/paste/2256

13:53 ibdknox: ^ sorry about that

13:53 robinkraft: How would you round all of the values in a vector? I've tried (map Math/round [5.9 1.1]) but I get this exception: "Unable to find static field: round in class java.lang.MathUnable to find static field: round in class java.lang.Math"

13:54 ibdknox: robinkraft: (map #(Math/round %) [...])

13:54 scriptor: split returns a vector, right?

13:54 ibdknox: just name them

13:54 robinkraft: ibdknox: interesting, will give that a shot

13:54 fliebel: &(do (declare cdr) (binding [cdr (lazy-seq (cons 1 cdr))] (identical? cdr (rest cdr))))

13:54 lazybot: java.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!

13:54 ibdknox: instead of (let [fields ...

13:55 (let [[name address1 address2 ...] ...

13:55 wkmanire: &(split "head" #"")

13:55 lazybot: java.lang.RuntimeException: Unable to resolve symbol: split in this context

13:55 robinkraft: ibdknox: Ha! Thanks

13:55 it works like a charm

13:56 ibdknox: wkmanire: even better would be to just use something like zipmap

13:56 wkmanire: &(doc zipmap)

13:56 lazybot: ⇒ ------------------------- clojure.core/zipmap ([keys vals]) Returns a map with the keys mapped to the corresponding vals. nil

13:57 ibdknox: (zipmap [:name :addres1 :address2] (string/split my-str #","))

13:57 wkmanire: I want an array-map so that the order is maintained.

13:57 ibdknox: ?

13:57 probably shouldn't be using a map if order matters

13:57 wkmanire: :)

13:58 I'm trying to represent an address in a way that its components are easily accessable

13:58 while also being able to write it to a simple CSV formatted file

13:58 and then read it back in.

13:58 scriptor: you could use a function that converts it into a CSV-friendly form

13:58 ibdknox: so represent it as a map and on write just print out the fields in order

13:58 RickInGA: cemerick: someone just tweeted about this. http://oreillynet.com/pub/e/2273 adding to my calendar now

13:59 wkmanire: ibdknox: https://refheap.com/paste/2257

13:59 ibdknox: in my zipmap case I would I have the fields in a var (def address-fields [..])

13:59 wkmanire: These functions all work but I just read that nth is a code smell.

13:59 I'm also seeing that array-maps are a code smell?

13:59 scriptor: since split returns a vector, I don't think you need nth in the first place

13:59 ibdknox: you shouldn't usually specify the type of map

14:00 that's asking for disaster later on if something modifies it and doesn't return that exact map type

14:00 wkmanire: ibdknox: I was thinking about that. It really shouldn't matter so long as it contains the fields required by the file format.

14:00 ANd the functions that read and write them should be responsible for order.

14:00 SO I'll refactor this a bit.

14:01 ibdknox: Thanks for the advice, I'll repaste the modified edition in a few.

14:02 mmarczyk: wkmanire: https://github.com/flatland/ordered

14:02 fdaoud: ibdknox: for Light Table, is there any difference in the different wordings of "early beta access" and different "Estimated Delivery" dates, or is it all the same?

14:03 ibdknox: all the same

14:03 njdirk: +LT, best $50bones ever spent!

14:03 wkmanire: mmarczyk: Neat. I don't think that should be used here according to ibdknox but good to know there is an lib for ordered associative types.

14:04 fdaoud: ibdknox: good, thanks for confirming. I know it's out of your control, what kickstarter lets you edit.

14:04 ibdknox: yeah, I'm very annoyed by that

14:04 RickInGA: as much as I want LT for Clojure, I just cant get over what a difference it will make for JS

14:04 fdaoud: as well you should be.

14:04 mmarczyk: wkmanire: that's probably true, but no harm in knowing about that lib just in case :-)

14:05 wkmanire: mmarczyk: Yes, exactly

14:05 mmarczyk: There are so many core library functions and such, I'm starting to get a little overwhelmed.

14:05 fdaoud: you should have a light color scheme for Light Table and the current darker scheme called Night Table

14:05 wkmanire: I'm just going to have to make sure I do a little clojure every day and eventually it will all soak in.

14:06 ibdknox: wkmanire: don't worry about trying to remember them, just try to learn how to find them :)

14:06 fdaoud: lol

14:06 fdaoud: themes will just be CSS :)

14:06 so they should be nice and simple

14:06 wkmanire: ibdknox: apropos and doc are my best friends.

14:07 fdaoud: ibdknox: sounds excellent. wish you great success with this project!

14:07 ibdknox: thanks!

14:07 wkmanire: ibdknox: I saw this morning that you are well on your way to getting funded.

14:07 I'm also really excited about the shadowrun game

14:07 :)

14:07 ibdknox: haha

14:07 wkmanire: I've been wanting that game made for at least 8 years now.

14:08 I played a lot of 2nd Edition with my buddies up in Washington.

14:08 * wkmanire misses the good times.

14:09 jaju: Question about creating maps - When is a PersistentArrayMap created - and when is a PersistentHashMap created?

14:10 fliebel: jaju: Over 8 items, i think you get a hashmap

14:10 amalloy: jaju: i think if you care about the difference other than as a matter of curiosity your program is broken

14:11 jaju: fliebel: That's what I understood too (not sure of the number 8) - but even the smallest map I create is a PHM

14:11 amalloy: &(map (juxt count class) (reduce conj {} (map vec (partition 2 (range 20)))))

14:11 lazybot: ⇒ ([2 clojure.lang.MapEntry] [2 clojure.lang.MapEntry] [2 clojure.lang.MapEntry] [2 clojure.lang.MapEntry] [2 clojure.lang.MapEntry] [2 clojure.lang.MapEntry] [2 clojure.lang.MapEntry] [2 clojure.lang.MapEntry] [2 clojure.lang.MapEntry] [2 clojure.lang.MapEntry])

14:11 amalloy: &(map (juxt count class) (reductions conj {} (map vec (partition 2 (range 20)))))

14:11 lazybot: ⇒ ([0 clojure.lang.PersistentArrayMap] [1 clojure.lang.PersistentArrayMap] [2 clojure.lang.PersistentArrayMap] [3 clojure.lang.PersistentArrayMap] [4 clojure.lang.PersistentArrayMap] [5 clojure.lang.PersistentArrayMap] [6 clojure.lang.PersistentArrayMap] [7 clojure.la... https://refheap.com/paste/2258

14:12 jaju: amalloy: Yes - curiosity.

14:12 mmarczyk: jaju: how do you go about creating it?

14:12 jaju: Alright - I use the literal syntax {...}

14:12 ben_m: &(doc juxt)

14:12 lazybot: ⇒ ------------------------- clojure.core/juxt ([f] [f g] [f g h] [f g h & fs]) Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of apply... https://refheap.com/paste/2259

14:12 jaju: which gives me the hashed version

14:12 mmarczyk: jaju: and you're on the JVM Clojure?

14:13 jaju: yes

14:13 mmarczyk: &(class {})

14:13 lazybot: ⇒ clojure.lang.PersistentArrayMap

14:13 mmarczyk: ^- not so for you? which version of Clojure?

14:13 jaju: Interesting. I'm on 1.4.0

14:13 &(class {:a :A :b B})

14:13 lazybot: java.lang.RuntimeException: Unable to resolve symbol: B in this context

14:14 jaju: &(class {:a :A :b :B})

14:14 lazybot: ⇒ clojure.lang.PersistentArrayMap

14:14 mmarczyk: same here, and I definitely get array maps for small literals

14:14 jaju: strange. I get that as a PHM in my REPL.

14:14 Let me check again!

14:15 mmarczyk: oh, automatic refheap paste -- neat :-)

14:15 jaju: ok - here's what I am doing. (def m {:a :A :b :B})

14:15 now - (class m) says hash-map

14:15 mmarczyk: wow

14:15 jaju: but (class {:a :A :b :B}) is array-map

14:16 <aside> yes, that refheap paste is neat!

14:16 mmarczyk: it's been the same in 1.3.0, but not 1.2.1

14:17 jaju: The (def m {}) thing gives me a hash-map. Is it the def doing something differently?

14:17 this is getting stranger

14:18 (def m {}) -> (class m) is array-map [note: empty map]

14:18 mindbender1: is it possible to customize the behavior of the compile fn in clojure

14:18 jaju: one key-val pair, and the class is now a hash-map.

14:19 RickInGA: I saw taht the cljs compiler has a :target option, which you can set to node.js what does the target do? include differen libraries?

14:20 mindbender1: gen-class is generating class files that override public final classes which I don't think is correct behavior and java complains when I try to instantiate the generated class

14:21 *public final methods

14:22 RickInGA: nm, found it

14:23 jaju: (repeating - to have it all in one place) - I'm using clojure 1.4.0. (class {}) => PersistentArrayMap. (def m {}) (class m) => PersistentArrayMap. (def m {:a :A}) (class m) => PersistentHashMap. Can someone help in understanding this?

14:23 gfredericks: jaju: there are different underlying implementations for clojure maps

14:24 jaju: &(do (def m {:a :A}) (class m))

14:24 lazybot: java.lang.SecurityException: You tripped the alarm! def is bad!

14:24 gfredericks: does this make a difference to you or are you just curious?

14:25 jaju: I'm curious. I know there are different underlying implementations. In fact, all I'm doing is looking at all the underlying Java code and playing at the REPL to understand the internals better.

14:25 gfredericks: I don't know the details of why you'd get a hashmap for a singleton map

14:25 I'm sure that all empty maps though are identical

14:26 so they're pointing to some constant declared in one of the classes

14:26 &(identical? {} {})

14:26 lazybot: ⇒ true

14:26 technomancy: it's bizarre that whether a map is stored in a var or not affects the underlying class

14:26 gfredericks: oh is that what's going on

14:26 technomancy: I thought the size of the map was the only factor that was considered

14:26 gfredericks: &(map type [{} {:a 'b}])

14:26 lazybot: ⇒ (clojure.lang.PersistentArrayMap clojure.lang.PersistentArrayMap)

14:26 gfredericks: oh you're right

14:27 technomancy: not that it matters in any way; it's just really weird

14:27 jaju: Not really. (def m {}) (class m) -> array-map

14:27 gfredericks: &(identical? {} (dissoc {:a 'b} :a))

14:27 lazybot: ⇒ false

14:29 jaju: actually, I need an insertion-ordered map. So, I started exploring the Java code to see what exists and if I could add another impl.

14:30 When I ran into this observation.

14:30 wkmanire: ibdknox: (defn parse-address [line] (zipmap [:name :address1 :address2 :city :state :zip] (split line #",")))


14:30 ibdknox: Awesome advice. That is about a 1000% better.

14:31 ibdknox: if you move the fields into a def you can use those for your ordering later too :)

14:31 gfredericks: jaju: I assume you've also found the ordered map?

14:31 mmarczyk: jaju: https://github.com/flatland/ordered for that, as discussed previously, with the caveats discussioned previously

14:31 gfredericks: oh wait insertion-ordered

14:31 I fell for that again

14:31 I think flatland has a lib for that

14:31 jaju: https://github.com/flatland/ordered

14:32 ibdknox: lol

14:32 mmarczyk: jaju: see http://clojure-log.n01se.net/ for the log if you've just joined

14:32 gfredericks: just linked to that :-P

14:32 gfredericks: BAH

14:32 jaju: gfredericks, mmarczyk: I'll check those links. Thanks!

14:32 * gfredericks is worthless

14:32 mmarczyk: np

14:32 ibdknox: mmarczyk: gfredericks: just found this, might be of interest https://github.com/flatland/ordered

14:32 ;)

14:32 gfredericks: :P

14:32 mmarczyk: ibdknox: oh great, lemme see

14:32 :-P

14:32 gfredericks: not at all, it's good to reinforce some points ;-P

14:33 cemerick: RickInGA: cool, didn't know they were promoting it already :-)

14:33 wkmanire: ibdknox: https://refheap.com/paste/2260

14:33 * wkmanire learnt hisself sumpin.

14:33 RickInGA: cemerick: don't know if they are promoting it, I saw a tweet from someone who signed up for it.

14:34 so they had to hear about it somehow, I suppose :)

14:34 ibdknox: RickInGA: promoting what?

14:34 wkmanire: Man, I'm having so much fun with this. I don't want to go back to VB.Net land for the rest of the day. :(

14:34 cemerick: dnolen: Thanks :-) I hope you enjoy it!

14:34 mmarczyk: jaju: I'm trying to git bisect the array map thing, but git is refusing to cooperate atm :-(

14:34 cemerick: ibdknox: http://oreillynet.com/pub/e/2273

14:35 ibdknox: OMG CEMERICK IS COMING TO SF!!!

14:35 * ibdknox faints

14:35 ibdknox: :D

14:35 how long you going to be in town?

14:35 RickInGA: I would relink to it on my feed, but I just liked LT, and I want to spread out my propagandizing

14:35 cemerick: ibdknox: heh, no, I'm still in MA; doing it remotely

14:35 ibdknox: aw

14:36 cemerick: I don't know when I'll be back on the west coast

14:36 Raynes: cemerick: I want you close to me.

14:36 So close.

14:36 technomancy: cemerick: looks cool. is that interactive or broadcast?

14:36 ibdknox: lol

14:36 cemerick: technomancy: Interactive. Should be Q&A and such too.

14:36 technomancy: nice

14:36 ibdknox: ooo

14:36 so I can heckle

14:37 jaju: mmarczyk: Oh, I definitely wasn't expecting such instantaneous action! :D Thanks, and maybe, something that I'd also want to fix myself to learn more if this really is an issue!

14:37 RickInGA: if we are still using clojure then. I am reading all about how clojure sequences suck on twitter. Oh, and someone linked an article yesterday from 2009 about Clojure being a bad lisp.

14:37 I think I am going to go back to FoxPro

14:38 ibdknox: RickInGA: I would. Fox had it right.

14:38 technomancy: they should have gotten Fox Mulder for celebrity endorsement

14:38 missed opportunity

14:38 mmarczyk: jaju: no worries, not having much success with the bisect anyway

14:39 ibdknox: technomancy: I thought MSFT bought fox software before that show existed

14:39 wkmanire: Is there a way to refer to the args of a function as a collection?

14:39 Similar to javascript's arguments variable.

14:39 ibdknox: My mom worked for Fox :)

14:39 technomancy: no kidding

14:39 gfredericks: (fn [[a b & cs :as arguments]] ...)

14:39 technomancy: I thought they kept the name though

14:39 gfredericks: wait no

14:39 (fn [& [a b & cs :as arguments]] ...)

14:39 ibdknox: yeah, turned it into Fox Pro and gutted the engine to put into SQL

14:40 RickInGA: ibdknox is it true that the query optimizer was called "Rushmore" because a bunch of people from the company liked the movie North By North West?

14:40 gfredericks: wkmanire: ^ that should work, but I think it precludes your function having fixed arity

14:40 ibdknox: the technology was called rushmore

14:40 wkmanire: gfredericks: I see. not quite what I was looking for.

14:40 jaju: mmarczyk: Is it worthy of being reported as a bug? (It's not a bug in the real sense of the word - but definitely does not follow the intended behavior as well - right?)

14:40 ibdknox: RickInGA: lol I never asked. I could ask my mother and see if she remembers

14:40 wkmanire: I'll just retype the args. he he he, no need for me to get clever with it.

14:40 fdaoud: cemerick: amazon canada delayed your book for the Nth time so I gave up, canceled my order, and got the ebook direct from o'reilly.

14:40 technomancy: it's funny that "SQL Server" is actually a trademarkable name

14:40 wkmanire: technomancy: Agreed.

14:41 cemerick: fdaoud: Weird.

14:41 jaju: mmarczyk: Reporting a bug technically allows me to try and fix it and an opportunity to submit code! :)

14:41 mmarczyk: jaju: I'd say so, as minor priority defect, I guess

14:41 * technomancy runs `lein new computer-program`

14:41 wkmanire: technomancy: Especially considering that M$ SQL Server doesn't actually serve SQL.

14:41 mmarczyk: jaju: reason enough to me :-)

14:41 technomancy: wkmanire: heh; never thought of it that way

14:41 jaju: mmarczyk: Cool - Thanks! :)

14:41 mmarczyk: :-)

14:42 cemerick: ibdknox: I'll let the organizer know to mute your feed. ;-)

14:42 oh, I guess it'll be text-based anyway, right

14:42 ibdknox: damn

14:42 foiled again

14:43 jweiss: i'm looking at trying to make a clojure library java compatible (not originally designed to be java compatible). Looks like my functions that take maps are in trouble because I can't substitute java.util.Map. For isntance, keyword lookups only work in IPersistentMap. is there a reason for this? is there a way around it?

14:43 wkmanire: Alright folks. Time to go earn money :( I hope I'll have time to get back to this today.

14:44 gfredericks: jweiss: would the Maps coming in have keyword-keys anyhow?

14:44 technomancy: gfredericks: clojure.walk/keywordize-keys might work on j.u.Map

14:44 fdaoud: 10 AM pacific time? I thought nobody on the west coast got up before noon.

14:44 gfredericks: technomancy: and if it did you'd get a clojure map back maybe? solving both problems?

14:45 jweiss: gfredericks: hm, doesn't destructuring sort of depend on kw's

14:45 * ivan has neighbors who wake up at 05:30

14:45 gfredericks: you mean {:keys [...]}?

14:45 noidi: jweiss, maybe you could use records instead of maps in your app, and make the records implement an interface that the java API could use?

14:45 technomancy: gfredericks: actually no, this is crazy

14:45 jweiss: gfredericks: yeah {:keys [...]}

14:45 fdaoud: ivan: pm ?

14:45 technomancy: gfredericks: (clojure.walk/keywordize-keys (doto (java.util.HashMap.) (.put "hello" 12))) ; -> #<HashMap {hello=12}>

14:45 it's a no-op

14:45 ivan: fdaoud: hah

14:46 gfredericks: jweiss: :strs works too

14:46 for string keys

14:46 technomancy: that's crazy

14:46 jweiss: gfredericks: ok so if i used a Map with string keys, i could still destructure it?

14:46 fdaoud: cemerick: do you know if these things are recorded and reposted?

14:46 gfredericks: jweiss: I believe so

14:47 cemerick: fdaoud: I believe so, yes. I'll be recording too, just in case.

14:47 mmarczyk: &(let [{:keys [foo]} (doto (java.util.HashMap.) (.put :foo 1))] foo)

14:47 lazybot: ⇒ 1

14:47 fdaoud: cemerick: cool, thanks.

14:47 mmarczyk: &( :foo (doto (java.util.HashMap.) (.put :foo 1)))

14:47 lazybot: ⇒ 1

14:48 mmarczyk: &(get (doto (java.util.HashMap.) (.put :foo 1)) :foo)

14:48 lazybot: ⇒ 1

14:48 mmarczyk: jweiss: apparently everything works in 1.4

15:04 metajack: Is there some reason that for would mess with dynamic bindings? If i do (binding [x y] (some-fn)) then the binding is there. if i put somefun inside a for, it disappears.

15:06 zamaterian: metajack, returns a lazy-seq

15:07 metajack: oh duh

15:07 that explains a lot about the last 30 minutes ;)

15:08 achin: Is there a function/macro already defined that'll create a map from a list of values and associate each value to a keyword created from the value's name? e.g. (foo a b c) => {:a a, :b b, :c c}

15:08 timvisher: how do you defend yourself from the old definition of a renamed function allowing your tests to pass in a running slime session?

15:10 technomancy: timvisher: you run tests with a fresh JVM before you push

15:10 timvisher: lol

15:10 ok, what i was doing already. :)

15:10 amalloy: timvisher: also i think if you use ritz, its swank/slime thingy clears old vars when you recompile

15:10 timvisher: i usually just re-run jack in every once and awhile to be sure

15:10 technomancy: amalloy: actually that's in swank 1.5.0-SNAPSHOT too

15:11 timvisher: haven't heard of ritz

15:11 technomancy: are you saying that the behavior i'm looking for exists in a later swank?

15:12 noidi: achin, maybe this could help http://permalink.gmane.org/gmane.comp.java.clojure.user/20310

15:12 technomancy: timvisher: yeah, when you do C-c C-l rather than C-c C-k

15:12 it forces a reload-all too

15:12 timvisher: interesting

15:13 is that public yet?

15:13 njdirk: thx 2all for assist

15:13 technomancy: sure

15:14 timvisher: hmm, C-c C-l = slime-load-file?

15:14 there's no bot that yells at me for infix?

15:14 technomancy: ja

15:14 timvisher: ah, awesome

15:16 technomancy: that's fantastic. no idea that load-file forced a full reload. thank you!

15:16 technomancy: the secrets of swank

15:16 timvisher: yeah, that whole infinite spiral learning curve thingamaijg ;)

15:17 mmarczyk: technomancy: incidentally -- is it usual and expected that swank silences pretty much all exceptions ("; Evaluation aborted" & next prompt)?

15:18 well, maybe not all... some. no idea what's the rule. I've only recently started to feel moderately bothered.

15:18 technomancy: mmarczyk: that usually points to a bug in clj-stacktrace

15:18 but I haven't seen it since clj-stacktrace 0.2.4 was released

15:18 mmarczyk: (also, I'm using multiple versions -- anything post 1.3 refuses to work with my custom setup for M-x slime and I'm too lazy to investigate)

15:18 technomancy: oh good, thanks -- I'll check that

15:22 patchwork: With lein2, where are class files put?

15:22 They don't seem to be anywhere in the project dir

15:23 gfredericks: Should clj-http be setting :query-string to "" (rather than nil) if :query-params is an empty map?

15:24 it kind of screws up clj-http-fake

15:32 dakrone: gfredericks: setting :query-string to "" isn't harmful from the perspective of an actual request, it seems like something that should be fixed in clj-http-fake

15:33 gfredericks: dakrone: that sounds totally reasonable; I've already forked it so I can do that too

15:37 jsabeaudry: ,java.util.Arrays/fill

15:38 Is that the proper way to write it?

15:39 gfredericks: jsabeaudry: well it doesn't mean anything unless it's being used at the front of a list, I believe

15:39 &java.util.Arrays/fill

15:39 lazybot: java.lang.RuntimeException: Unable to find static field: fill in class java.util.Arrays

15:41 jsabeaudry: gfredericks, ah yes, i was getting a no matching method but thats because my parameters were not right, thanks

15:41 gfredericks: yeah that's usually the issue :/

15:45 dabd: i'm trying (MessageFormat/format "{0,number,percent}" 0.125) but i get java.lang.Double cannot be cast to [Ljava.lang.Object;

15:45 the documentation shows format arg should be on Object how can i invoke this method from clojure?

15:46 MessageFormat comes from java.text namespace

15:47 joegallo: dabd -- you need to put that Double into an array of Object.

15:48 dabd: joegallo: this works (MessageFormat/format "{0,number,percent}" (to-array [0.125]))

15:48 joegallo: okay, excellent.

15:48 dabd: but i get 12% it looses the decimal points

15:49 joxer: Bronsa

15:49 joegallo: i think that's a java question at the point then :)

15:49 s/the/that/

15:50 dabd: joegallo: true thx!

15:50 joegallo: which is not to be snide -- just that i don't happen to know. :)

15:51 gozala: anyone can help me with https://gist.github.com/2431249#comments

15:53 Probably I miss something obvious, but I don't know what

15:55 mmarczyk: gozala: you don't have to use IMeta to get at the state -- (.-state deferred)

15:56 gozala: mmarczyk: ok so type arguments are just stored as own properties ?

15:56 mmarczyk: gozala: you'll want to (reset! state {:done true :value value}) or (swap! state assoc :done true :value value) in -realize

15:56 gozala: yes

15:57 charles_r: Anyone know how to do color themes in emacs?

15:57 gozala: mmarczyk: thanks

15:57 mmarczyk: gozala: (swap! state @state {:done true :value value}) changes the of state to be the result of applying the old value to the map {:done true :value value}

15:58 gozala: the old value will be {:done false} -- a map -- a map, when applied as a function to an argument, looks the argument up in itself

15:58 gozala: as a key, that is: ({:foo 1} :foo) => 1

15:59 gozala: mmarczyk: I see

15:59 mmarczyk: gozala: here it doesn't find {:done true :value value} to be a key in itself, so it returns the default: nil

15:59 gozala: but why the hell it ends up with

15:59 {:done true, :value undefined }

16:02 mmarczyk: gozala: ah, sorry, got mixed up a bit

16:02 tuxit: evening all

16:02 what do people use for editing clojure code ?

16:02 mmarczyk: gozala: what will happen is that the original state -- {:done false} -- will get applied to two arguments

16:03 tuxit: is there an eclipse plugin or an emacs mode

16:03 mmarczyk: gozala: the original state of {:done false} and {:done true :value value}

16:03 ivan: there's an Eclipse plugin and an Emacs mode and an IntelliJ plugin

16:03 charles_r: tuxit: I'm using swank/emacs

16:03 https://github.com/technomancy/swank-clojure

16:04 tuxit: oooh thx enough choice then

16:04 mmarczyk: gozala: so actually one would expect it to swap in {:done true :value value}, cause the second argument is the not-found default

16:04 gozala: so basically it should work

16:05 gozala: mmarczyk: either way I was clearly misuseing swap

16:05 mmarczyk: gozala: I'll give it a closer look (you should still probably switch to reset! or swap! as given above)

16:05 gozala: yeah I'll do that

16:05 ja_: hello

16:05 gozala: I sat swap was taking previos value next value

16:05 i thought*

16:06 mmarczyk: may I ask you one more thing

16:06 mmarczyk: gozala: it's not compare and swap :-)

16:06 gozala: I'm trying to implement promises for cljs

16:06 mmarczyk: sure

16:07 gozala: actually this sort of atom manipulation works for me in Rhino -- what environment are you executing this in?

16:07 gozala: in rhino as well

16:07 strange

16:07 it works if I do just swap on atom

16:07 but it does not when called as method -realize

16:08 mmarczyk: got it

16:08 gozala: so I thought maybe somehow value was not captured

16:08 by if-not expression

16:09 mmarczyk: I get same issue with reset as well

16:10 mmarczyk: to me it complains that there's no -realize method defined for this object type

16:10 cool

16:10 let's see if there's a trivial fix for that

16:11 gozala: mmarczyk: probably we run diff version of cljs

16:11 mmarczyk: gozala: oh that's for sure

16:11 gozala: cause exact code from gist works for me

16:12 mmarczyk: gozala: I'm actually running this in a branch where I'm working on some other code

16:12 gozala: can't see how it'd break things, but...

16:12 gozala: which version are you using?

16:12 gozala: I was using latest from master

16:12 which may not be latest now

16:12 let me pull in lasest and retry

16:12 mmarczyk: could you check the sha?

16:12 oh, ok

16:13 gozala: I'm on afd21fb147f88789bfe20a98a36ab55d475c65ac

16:13 gottfried: how to compute ack(4,2) in clojure

16:14 gozala: now I'm on latest

16:14 27e0bc8f2e27d599690cbe1444530af66cb676c9

16:15 mmarczyk: ok now I get same error as you do

16:21 mfex: hi all, any suggestions on what to do when emacs ends up in the debugger for the slime repl when loading some xml?

16:23 gozala: mmarczyk: is there something wrong with the code

16:23 why would not it implement IDeferred

16:24 mmarczyk: gozala: I must say I've no idea

16:25 gozala: :)

16:26 mmarczyk: gozala: I'll try to find out, though if this takes more than a couple of minutes, I'll have to postpone it until a bit later -- in which case I'll comment on the Gist if I have relevant info

16:26 gozala: mmarczyk: thanks a lot

16:27 mmarczyk: not at all

16:27 this is really weird

16:28 dnolen: gozala: promises don't make much sense in CLJS IMO

16:28 gozala: at least not the ones in Clojure on the JVM

16:28 gozala: dnolen: why not ?

16:28 dnolen: no I'm doing ones like in js

16:29 dnolen: gozala: k, yes that's different.

16:29 gozala: dnolen: I prototyped my idea in js first

16:30 https://github.com/Gozala/eventual/blob/master/core.js

16:30 and now I'm trying to port it to cljs

16:30 pjstadig: ~suddenly

16:30 clojurebot: CLABANGO!

16:31 gozala: idea is that you can make operations on eventual values same way as on regular values with a difference that they produce promise for those values rather than actual values

16:32 dnolen: This basically what I'd like to get https://github.com/Gozala/eventual/blob/master/tests/test-all.js#L69-88

16:32 technomancy: clojurebot: we missed you! ♥

16:32 clojurebot: It's greek to me.

16:32 gozala: if it's a bad idea I'd be better off knowing it now :)

16:32 technomancy: oops, I forgot robots do not understand emotions

16:33 hiredman: ~clojurebot

16:33 clojurebot: clojurebot is a multimap

16:33 hiredman: ~clojurebot

16:33 clojurebot: clojurebot is not very good at indicating the difference between a return value and an exception

16:33 dnolen: gozala: so you're overloading valueOf to allow your promises to flow through?

16:34 gozala: dnolen: sort of that yeah

16:34 In js you cant really do by overriding valueOf

16:35 as you have operations like + - etc

16:35 dnolen: gozala: yeah - so what happens with console.log(promise + 1 + 2) ?

16:35 gozala: [ object Object ]12 :)

16:35 you have to wrap your functions

16:35 https://github.com/Gozala/eventual/blob/master/tests/test-all.js#L16

16:36 dnolen: for example

16:36 sum = eventual(function(a, b) { return a + b })

16:36 console.log = eventual(console.log)

16:36 console.log(sum(promise, 2))

16:36 -> 3

16:37 mmarczyk: gozala: oh man

16:37 gozala: if deliver(promise, 1)

16:37 mmarczyk: gozala: (defprotocol IDeferred (-realize [this value]))

16:37 gozala: note the this

16:37 gozala: apparently I'm getting tired

16:37 gozala: mmarczyk: oops !

16:38 mmarczyk: I'm sorry I thought this was implied

16:38 mmarczyk: gozala: nope

16:38 gozala: no worries though, should have payed attention :-)

16:39 wait, did I say "payed"

16:39 definitely getting tired.

16:40 gozala: dnolen: so it's kind of reactor pattern

16:40 but I figured in cljs you could take it much further

16:40 as you could implement most of the standard stuff useing protocols

16:40 so that

16:41 (+ promiseFor1 promiseFor5) -> promiseFor6

16:41 dnolen: gozala: interesting - I tried something similar years ago in JS

16:41 gozala: dnolen: I think it may have value on node.cljs

16:41 Raynes: mmarczyk: I'll take 5 attentions. PAY ME

16:42 dnolen: gozala: I felt (at least my attempt) it was only slightly better than callbacks.

16:42 gozala: how are you going to handle errors?

16:42 gozala: dnolen: I think you might want to take a look at

16:42 http://jeditoolkit.com/2012/04/26/code-logic-not-mechanics.html#post

16:42 I write why this is much better than callbacks

16:43 dnolen: erros propagate through the promise chain

16:43 so for example if promise a was rejected

16:43 mmarczyk: Raynes: man, I'm paying, like, all the time -- you want more!? -- talk about extortion

16:43 gozala: all the computations of it will be rejected with the same error

16:44 dnolen: gozala: errors flowing through stink - what about provenance?

16:44 gozala: think Infinity and NaN - that's why they suck

16:45 gozala: dnolen: not sure I follow

16:45 gfredericks: gozala: makes it hard to figure out where the error started?

16:45 dnolen: gozala: how can you determine the exact location where the error was generated.

16:45 gozala: dnolen: well you handle errors where it makes sense and is relevant

16:46 gfredericks: handling them is different from determining where they started while debugging

16:46 gozala: also you can use same stack traces as you would with callbacks

16:46 no better no worse

16:46 dnolen: gozala: again think about Infinity and NaN errors in JS - why allow poisonous values at all?

16:46 gozala: if you need to include more info you could rewrap promises to include more data

16:46 with errors

16:46 dnolen: gozala: again the system I built was nearly identical to yours - poisonous errors are no fun.

16:47 gozala: I'm not sure what are the problems with NaN and Infinity

16:48 dnolen: gozala: you don't know who created them, you only see the results

16:48 gozala: dnolen: that's in fact ocaps

16:48 dnolen: gozala: ocaps?

16:48 gozala: well allows you to build object capability model around that

16:49 dnolen: all these concepts are from E language

16:49 they are not my brain child

16:50 dnolen: gozala: are you saying you don't see a problem with NaN or Infinty behavior in JS?

16:51 gozala: dnolen: I see many problems in JS but not sure how that relates to promises

16:51 gfredericks: gozala: the stack trace with NaN/etc doesn't take effect until the perverse number conflicts with something somewhere

16:51 so it tells you when the number became a problem but not where it came from

16:52 dnolen: gozala: if a promise becomes an error and I forgot to check for it, how do I find who created it in your system?

16:52 gozala: dnolen: let's take a step back for the moment

16:52 idea is that if you write sum(a, b) you want to get a + b

16:53 if one of those values are eventual

16:53 you mean something like this

16:53 in js

16:53 sum (a, b, function( c) { …. } )

16:54 what this system does is that it returs you c

16:54 on which you can set up a listener

16:54 instead of passing it directly

16:54 if sum throws exception than that's error listener is called with that exception

16:55 now this allows you to sum(c, x) without doing it in callback

16:55 TimMc: gozala: What if I do (+ a b) where a is an integer and b is eventual? Then a gets to decide, and BOOM.

16:55 mmarczyk: condition systems are the bee's knees

16:55 TimMc: hmm

16:55 gozala: if one of the arguments is eventual

16:56 you get back eventual for the operation that will be performed eventually

16:56 if one of the eventuals boomed

16:56 than error will propagate to your resulting computation

16:56 same way as exceptions propagate

16:57 this solves just an expression problem nothing else

16:57 TimMc: Maybe I misunderstand what you are proposing. If + is a protocol, it pdispatches on first arg...

16:57 Or would you replace +, etc.

16:57 RickInGA: realizing that a good subtitle for my blog would be 'the blind leading the blind' I thought I should see if anyone was willing to fact check my hello world cljs post before I posted it. http://dl.dropbox.com/u/54389223/post.html

16:58 gozala: TimMc: that's something I have to learn about I guess

16:58 In js I just wrap functions

16:58 dnolen: gozala: yes but there still a problem with locating the error right? you get the bad operation - but the not location where the operations where composed right?

16:58 gozala: so instead of using sum you would use eventual(sum)

16:59 TimMc: I see.

16:59 gozala: dnolen: if operation threw exception than you get a stack

16:59 if operation did not threw exception than probably function is broken

17:00 if function can't handle value it should reject it

17:00 dnolen: How would a callback be any different here

17:01 if you do sum(Nan, 3, callback)

17:01 technomancy: RickInGA: you should never have to run "lein deps" by hand

17:01 gozala: you'll get same broken value in callback

17:02 dnolen: gozala: what I mean is this

17:02 RickInGA: technomancy: really? I had no idea

17:03 dnolen: f(e, 1) -> e', f(e', 2) -> e''

17:03 technomancy: RickInGA: it's been that way for ages, but habits are hard to break

17:03 dnolen: say all that composes, since e isn't resolved yet.

17:03 gozala: ok

17:04 dnolen: then when e resolves and fails, does the call stack make any sense?

17:04 gozala: you mean e''

17:04 dnolen: no e'' can't resolve w/o e

17:04 gozala: if e is rejected if e'' makes sense

17:05 dnolen: gozala: if nothing blocks and eventuals always produce eventuals - e'' depends on the resolution of e' and e' on e

17:05 gozala: so rejector of `e` rejects it with an error

17:05 it's the one deciding what the error is like

17:06 dnolen: exactly

17:06 dnolen: gozala: yes, but when I see the error will it make sense? is it easy to decipher that it was e that failed?

17:06 and not e', and not e''

17:06 RickInGA: technomancy: what do you use? lein search?

17:07 gozala: dnolen: It all depends on error I guess

17:07 technomancy: RickInGA: what do I use for which?

17:07 gozala: if youre asking if more stack traces are adde on the way

17:07 RickInGA: for pulling in dependencies.

17:07 gozala: they don't but it's easy to add

17:07 technomancy: RickInGA: I don't understand

17:07 dnolen: gozala: in anycase, I'm just saying I tried this. I didn't like it. But I'm curious where you go w/ it.

17:07 RickInGA: you said that I should not call lein deps

17:08 gozala: dnolen: have you used Q or dojo deferreds ?

17:08 gfredericks: RickInGA: I imagine the other commands call it

17:08 dnolen: gozala: no I wrote my own thing similar to yours where fns were decorated to produce eventuals if they received them.

17:08 gfredericks: RickInGA: so you don't have to call in deps explicitly

17:09 gozala: dnolen: Also I wrote streams on top of this

17:09 where element is a promise that resolves to head, tail

17:09 technomancy: if you want to build a jar, call lein jar; if you want a repl, call lein repl

17:09 gozala: tail being another promise

17:10 dnolen: anyway I'll write about this once I'll get it somewhere

17:10 dnolen: Also errors in async code is just panful because event queue cuts the stack traces

17:11 meaning that your example would have same issues if you were doing it with callbacks

17:11 it's just you would be forced to do error handling on each step

17:12 dnolen: gozala: I'm more curious these days about approaching this problem w/ good CPS transforms

17:12 gozala: that's interesting about streams, have you looked at RxJS?

17:13 RickInGA: technomancy: the instructions on the lein-cljsbuild readme say to add :plugins lein-cljsbuild "0.1.8" to project.clj , then lein deps to install the plugin, then configure the build options, and use lein cljsbuild once (or auto) to compile… should I install cljsbuild with lein plugin-install lein-cljsbuild instead?

17:13 technomancy: RickInGA: no, if your project can't build without lein-cljsbuild then it must be in the :plugins declaration in project.clj

17:14 RickInGA: technomancy: so I add it to plugins, then will lein cljsbuild once install the plugin for me?

17:14 technomancy: yeah

17:14 RickInGA: technomancy cool, I will try that

17:14 technomancy: I mean, if it doesn't then it's a bug in Leiningen

17:16 if anyone's looking for a learning hack project, I have a great one

17:16 it's a proxy that turns github issues into a git repository full of static files

17:16 probably yaml or something

17:17 would let you work with issues as conveniently as github wikis

17:18 RickInGA: technomancy: thanks for information… lein cljsbuild once pulled in the plugins just like you said it would

17:18 technomancy: cool

17:18 RickInGA: I will update that in my instructions

17:22 gozala: dnolen: do you have a link I can just find https://github.com/Reactive-Extensions/rxjs-node

17:23 but it's not very informative

17:23 dnolen: my streams are very similar to lamina

17:23 https://github.com/Gozala/streamer/wiki/stream

17:24 dnolen: gozala: http://codebetter.com/matthewpodwysocki/, lot of content, I met him at JSConf, nice guy, working on porting Rx from C# (?) to JS

17:24 gozala: dnolen: and they have clojure seek like API

17:24 https://github.com/Gozala/streamer/blob/experimental/promise/core.js#L480

17:25 BTW in long term I actually want to implement seek or ISeeq API for eventual streams

17:25 don't remember actual protocol name

17:25 dnolen: also regarding error handling I forgot to mention that it has recovery scheme

17:26 p2 = p1.then(map, recover)

17:26 so you could handle errors as you need and recover from them

17:26 or add more info and propagate if you need to

17:26 dnolen: gozala: interesting stuff. you should definitely look into Rx, there was some talk at some point in making lamina more Rx like and stuartsierra's cljque

17:27 work was interesting along those liens

17:27 gozala: dnolen: I'll take look, thanks for pointers

17:32 dnolen: BTW microsoft also went with promises for Windows8 js APIs

17:32 http://msdn.microsoft.com/en-us/library/windows/apps/hh700330.aspx

17:46 neotyk: dnolen: if you could take a look at http://dev.clojure.org/jira/browse/CLJS-35 , I've updated a patch in it

17:46 Simmons: Hi Newbie question but could someone point me to an explanaition of what #' does in the following example (run-jetty #'app {:port 8080}). I know it is something to do with var but I don't quite understand it. Many thanks

17:48 dnolen: neotyk: thanks! will give it a shot in a bit.

17:48 technomancy: Simmons: it passes the var app to run-jetty rather than the function itself

17:48 Simmons: which means it will pick up changes when it's recompiled

17:50 Simmons: technomancy: So is it a little bit like a pointer in C (maybe a very bad analogy)?

17:50 technomancy: it's an additional layer of indirection

17:52 Simmons: technomancy: Thank you for your help. I don't suppose you have any idea whre I might find a more detailed explanaition of this feature?

17:54 technomancy: mark volkmann's introduction probably covers it

17:55 Simmons: technomany - many thanks.

17:55 neotyk: dnolen: thanks!

17:57 muhoo: is anyone deploying clojure/noir apps on appengine?

17:57 i.e. is that even worth trying, and are there any gotchas involved?

17:57 emezeske: muhoo: I am working on such an app, but I haven't deployed to the real appengine yet (I've just used local testing)

17:58 muhoo: It's very worth trying; appengine-magic is pretty sweet

17:58 muhoo: emezeske: are you using lein jetty for your local testing, or are you wrapping a war in google's appengine sdk to run it locally?

17:59 emezeske: muhoo: Look at appengine-magic, it takes care of all that

17:59 muhoo: ok

17:59 * muhoo is suspicious of anything with "magic" in its name, but will look

17:59 emezeske: It's just a clj wrapper on top of the Java API, which some convenience built in.

18:00 muhoo: this? looks very cool indeed, thanks: https://github.com/gcv/appengine-magic

18:00 emezeske: That would be it

18:01 dnolen: neotyk: small bug - can you rm -rf closure if it exists? otherwise you get SVN errors.

18:02 neotyk: dnolen: it should update, oh wait, you had it bootstrapped before?

18:02 dnolen: neotyk: yep

18:02 neotyk: most folks will have.

18:03 neotyk: dnolen: I will cleanup before checking out

18:03 dnolen: neotyk: thx, once that's sorted I'll happily apply and push to master.

18:04 neotyk: please add a new patch to JIRA.

18:04 neotyk: dnolen: will ping you once it is there

18:23 squeaky_pl: Hello. I hate you. You ruined my world. I always believed Python is the most elegant language out there. Now I need to rewrite everything in Clojure :-)

18:24 bhenry: ibdknox: can you immediately see what's wrong here? i've been fighting for far too long. https://gist.github.com/a9bed362b99ccbac398c

18:24 i have other remotes that work, but this one is being a jerk

18:25 ibdknox: bhenry: asynchrony

18:25 can't get away from the callbacks I'm afraid

18:26 bhenry: aha.

18:27 ibdknox: bhenry: so what I do is I usually treat remotes as functions that are actually on the client and use letrem

18:27 so in your case instead of having a get-user

18:28 I would just call (user) whenever I need it

18:28 (letrem [me (user)] (js/alert (:username me)))

18:30 bhenry: awesome. thanks

18:39 austinh: I am really enjoying "Clojure Programming." It's quickly answering a lot of the questions I had after the Volkmann tutorial.

18:40 I'm very happy that I could buy a downloadable PDF.

18:43 Licenser: what is the way to go of cljs browser development until we get Light Table?

18:44 xeqi: I've heard good things about lein-cljsbuild

18:45 Licenser: xeqi it does reply stuff?

18:45 xeqi: https://github.com/emezeske/lein-cljsbuild/blob/0.1.8/doc/REPL.md

18:45 like that?

18:46 I've not used it, just see it mentioned positively alot

18:47 ibdknox: lein-cljsbuild or noir-cljs

18:47 cljs-template will get you up and running quickly

18:48 Licenser: while I like noir it is not my thing now, my backend is not clojure but erlang

18:49 ibdknox you made some kind of ui stiff for cljs right?

18:49 ibdknox: what kind of UI?

18:49 monet = canvas

18:49 crate = hiccup for cljs

18:49 Licenser: ibdknox thanks :)

18:50 * Licenser cheks the two

18:50 mmarczyk: monet for canvas

18:50 I love your library names

18:51 yoklov: ^

18:54 monet's pretty nice, but its more than i really need/want for most stuff, and it doesnt really help the path api is still somewhat awkward with it (in general the path api requires lots of repetetive code)

18:56 i think theres a spot open for a cljs canvas library that generates lots of that awkward canvas code for you

18:58 ibdknox: yoklov: I would be more than happy to take some changes/additions/happiness to monet to fit those needs too :)

18:58 rhickey: dnolen: ping

18:58 dnolen: rhickey: hullo

18:58 rhickey: phmap looks very cool, one quick question

18:58 I saw this ObjMap DEPRECATED

18:59 neotyk: dnolen: cljs-35 updated

18:59 rhickey: but ObjMap is a pretty important optimization

18:59 the entire design of symbols and keywords is there to support it

18:59 dnolen: rhickey: we could keep it, though it seemed hard to find a scenario where it's any faster than PHM

19:00 rhickey: are you concerned about size here?

19:00 rhickey: no, it is an Object, and its keys are object keys, subject to tons of optimizations

19:01 so if you are testing assoc perf you are missingthe point

19:01 gozala: dnolen: I looked into rx it's very similar to what I'v being doing with streamer and would like to port to cljs

19:01 rhickey: lookups should be much, much faster

19:01 esp given literal maps

19:02 Licenser: ibdknox cljs-template seems not to work correctly, lein2-preview3 seems not to find

19:02 kenneth: hey, how do you merge two sequences (lazily)

19:02 mmarczyk: rhickey: http://jsperf.com/cljs-persistent-hash-map-access

19:02 kenneth: like merge, but for seq

19:02 gfredericks: kenneth: concat?

19:03 ibdknox: Licenser: I think you still need to download it

19:03 Licenser: ah because the readme said it does not need it

19:03 mmarczyk: rhickey: admittedly there may be something the matter with my testing methodology

19:03 dnolen: rhickey: we benched access times, but perhaps we should try more cases.

19:03 ibdknox: Licenser: took that as a pull request and haven't switched to lein2 yet

19:03 Licenser: ah :)

19:03 dnolen: rhickey: ibdknox also tried on a project with many smalls maps and he didn't see much diff in perf.

19:04 rhickey: that said I understand your reservations.

19:04 rhickey: should we keep ObjMap for maps of a certain size?

19:04 mmarczyk: rhickey: I also have a working patch whereby ObjMaps get created for small maps w/ string keys and switch at some threshold

19:05 rhickey: Your use cases may be too dynamic to see the differences, but e.g. v8 will actually compile classes on the fly for objects with constant key sets, tyielding offset (no lookup) field access - how could you possibly beat that?

19:05 mmarczyk: rhickey: plus a patch with a TransientObjMap w/ the obvious semantics (and a conceptual problem -- should it switch to transient hash map at some size?)

19:05 Licenser: https://refheap.com/paste/2272 <- this is what happens, it seems a bit odd

19:05 rhickey: yes, the idea was always ObjMaps for small sizes

19:05 replacing HashMap with phmp is fine

19:06 mmarczyk: right, that's was the plan

19:06 mm re: threshold

19:06 mmarczyk: rhickey: sure

19:06 rhickey: I'll prepare a patch against current master then? 16 as threshold?

19:07 rhickey: then we can do some more elaborate perf testing.

19:07 amalloy: kenneth: https://github.com/flatland/useful/blob/develop/src/useful/seq.clj#L218

19:07 rhickey: it's really hard to read the test source but the results are literally unbelievable

19:07 like, I don't believe them

19:07 dnolen: rhickey: yes, V8 is prety good.

19:08 mmarczyk: rhickey: I have to say that was my reaction

19:08 rhickey: in safari here

19:08 mmarczyk: rhickey: as noted in my original comment on the ticket -- crazy results

19:08 dnolen: rhickey: I saw one of the V8 engineers talk at JSConf, I think also think V8 is a bit finicky

19:09 mmarczyk: rhickey: the functions called in the tests literally just wrap whatever they're named after

19:09 dnolen: rhickey: there scenarious where V8 will not produce an optimized type behind the scenes, so perhaps our tests are dynamic enough where V8 ObjMap magic doesn't kick in.

19:09 rhickey: we need to make sure objmap is doing what it is supposed to, but we shouldn't walk away from the objective that objmaps are same speed as object access, one of the most highly optimized aspects of JS

19:09 dnolen: I suspect that

19:09 gozala: emezeske: for some reason I get different cljs version when running lein trampoline cljsbuild repl-rhino

19:10 mmarczyk: rhickey: dnolen: actually, should we have an access test for very small maps on jsperf?

19:10 4-6-8 entries

19:10 gozala: from when I just run cljs-repl from scripts

19:10 rhickey: mmarczyk: esp literals like {:a 1 :b 2}

19:10 mmarczyk: rhickey: right

19:10 gozala: Is there any way I could set it up so to use one from $CLOJURESCRIPT_HOME ?

19:10 emezeske: gozala: lein-cljsbuild uses only tagged versions of clojurescript, the latest is 0.0-1011 I think

19:11 gozala: It doesn't just grab the HEAD, as that can be unstable

19:11 gozala: emezeske: I see, but is there way to tell it to use a diff one instead ?

19:11 emezeske: like one from $CLOJURESCRIPT_HOME

19:12 mmarczyk: rhickey: (defn obj-map-from-literal [k1 v1 k2 v2 k3 v3 k4 v4] {k1 v1 k2 v2 k3 v3 k4 v4}) for use in tests...

19:12 rhickey: dnolen: mmarczyk: ok guys, well good work! please keep this issue in mind - don't throw out objmap just yet

19:12 dnolen: rhickey: definitely I actually had pretty big reservations about that myself. Thanks for pushing us to dig deeper :)

19:12 rhickey: mmarczyk: taking keys as args is not like literals

19:12 emezeske: gozala: https://github.com/emezeske/lein-cljsbuild/issues/58#issuecomment-5013471

19:12 rhickey: [v1 v2 v3] {:k1 v1 :k2 v2 :k3 v3}

19:13 mmarczyk: rhickey: ohhh, gotcha

19:13 gozala: emezeske: thanks!

19:13 emezeske: gozala: NP. I need to add that to the official docs one of these days...

19:13 mmarczyk: rhickey: I'll post a new set of jsperf links on a separate ticket then -- "re-precating ObjMap", say

19:13 rhickey: ha

19:14 gotta run there, thanks again for the great cljs work

19:14 mmarczyk: thanks!

19:14 Raynes: Goodnight your highness. <3

19:15 Missed him by 4 seconds.

19:15 Reflexes need sharpening.

19:20 dnolen: neotyk: checking now

19:23 neotyk: works!

19:23 yoklov: emezeske: have you ever run into situations where cljsbuild will just say "Compiling ClojureScript." and then exit without doing anything else? lein cljsbuild clean seems to fix it.

19:24 emezeske: yoklov: It will do that if e.g. the output file is newer than all the input files

19:25 yoklov: hm, I think its probably because of weirdness from version control then

19:25 gozala: emezeske: I have tried https://github.com/emezeske/lein-cljsbuild/issues/58#issuecomment-5013471

19:25 but it does not seems to work for me

19:25 yoklov: gozala: try using lein-checkouts, and also adding "checkouts/clojurescript/src/cljs" to the extra-classpath-dirs vector

19:26 emezeske: He shouldn't have to use lein-checkouts

19:26 gozala: What version of leiningen?

19:26 yoklov: hm, I had been wondering if I had to…

19:26 gozala: https://github.com/emezeske/lein-cljsbuild/issues/58#issuecomment-5255126

19:27 dnolen: neotyk: done! thx!

19:27 yoklov: gozala

19:27 add "checkouts/clojurescript/src/cljs" to extra classpath dirs

19:27 that is what that error means

19:27 its using your the same .cljs as before, just a new compiler, however the compiler is emitting code that uses, in this case, PersistentHashMaps

19:28 gozala: yoklov: I do have it

19:29 emezeske: lein is 1.7.0 lein-cljsbuild "0.1.8"

19:29 emezeske: Ah, I think yoklov is right

19:29 yoklov: oh, hm. maybe try 'lein deps, clean'? I don't really know, this is usually what I try

19:30 emezeske: My example only includes "checkouts/clojurescript/src/cljs" to the classpath

19:30 Maybe "checkouts/clojurescript/src/clj" is also required?

19:30 yoklov: both are i think

19:31 or at least, I don't think i've really gotten it to work right with just one

19:31 emezeske: gozala: Maybe try :extra-classpath-dirs ["checkouts/clojurescript/src/cljs" "checkouts/clojurescript/src/clj"] ?

19:31 yoklov: Makes sense. Probably when I tested it with just one, it *happened* to be compatible

19:31 gozala: emezeske: wait you actually have clj in example instead of cljs

19:31 I'll try both

19:32 yoklov: emezeske, yeah, thats why i dont _think_ i've really gotten it to work right with just one.

19:32 it will compile but now that theres an incompatibility, it doesn't work right

19:32 gozala: emezeske: yoklov: I thin you meant cljs but wrote clj

19:32 with just cljs it works

19:32 yoklov: gozala, you want both

19:33 emezeske: You really should include both

19:33 gozala: ok

19:33 emezeske: I will update the issue

19:33 yoklov: :extra-classpath-dirs ["checkouts/clojurescript/src/cljs" "checkouts/clojurescript/src/clj"]

19:34 gozala: yoklov: emezeske thanks!

19:34 emezeske: gozala: Yeah, thanks for noticing the problem!

19:34 gozala: Saves me from dealing with it next time :)

19:34 yoklov: gozala: no problem!

19:35 emezeske: yoklov: Nice fix, btw .

19:35 yoklov: emzeske: dnolen is the one who suggested it to me, haha

19:35 dnolen: yoklov: emezeske: gozala: you def need both

19:36 otherwise a you have a newer compiler but old core.cljs

19:36 emezeske: dnolen: Yeah, I think when I tested it with just one, it was right after 0.0-1011 was released, so one or the other may not have yet been modified

19:36 dnolen: And I just got lucky (unlucky?)

19:37 dnolen: emezeske: unlucky because PHMs landed in the compiler

19:37 but if you have a old core.cljs, it's missing

19:37 emezeske: Makes sense

19:37 BTW, that is strictly awesome

19:37 dnolen: emezeske: yes, it's awesome levels far beyond JS :)

19:37 mmarczyk: :-)

19:38 emezeske: I've finally gotten to the point with cljs where I'm more effective than with regular js

19:38 I realized that yesterday, and it's a pretty sweet feeling

19:39 gozala: emezeske dnolen maybe you guys should write how to get that effective

19:40 I'm having hard time with repl

19:40 dnolen: gozala: well it's easier if you've done a lot of Clojure (and I've done a lot of JS too)

19:40 gozala: specific problems?

19:40 gozala: I loose connection every now and then

19:40 or repl just get's stack and I have to refresh

19:41 emezeske: gozala: For me it was a rather slow process, but as dnolen says it helps if you know clojure & js already :)

19:41 dnolen: gozala: yeah, no one's looked closely but if errors occur the REPL breaks.

19:41 gozala: dnolen: not to say that I have to learn emacs instead of using my vim

19:41 dnolen: gozala: it's less brittle now, but I don't think we've found all the edge cases.

19:41 patches welcome!

19:41 gozala: dnolen: emezeske: I have played with clojure

19:41 yoklov: mmarzyk: I've been meaning to mention, I tried out your TransientHashMaps and I think they have a bug. (get (assoc! t :foo 0) :foo) returns undefined as of when i tried

19:41 gozala: but nothing serious

19:42 mmarczyk: yoklov: that's right, it's fixed in the latest patch

19:42 gozala: dnolen: also ideally I'd love to use it with node

19:42 mmarczyk: yoklov: on the ticket

19:42 yoklov: mmarczyk, awesome

19:42 mmarczyk: yoklov: thanks a bunch for testing, btw!

19:42 emezeske: gozala: Personally I think that source maps (for good debugging/stacktraces in browsers) will be the biggest step towards usability

19:42 dnolen: gozala: that would be nice, again, someone needs to work on that.

19:42 gozala: but as far as I understand there is no repl for it or is it ?

19:42 dnolen: gozala: I created one and drewr is working in it I think (?)

19:42 yoklov: mmarczyk, heh, I couldn't resist :p.

19:43 mmarczyk: yoklov: :-)

19:43 dnolen: definitely ready to take a good Node.js REPL if someone writes one.

19:43 gozala: dnolen: Once I'll get enough knowledge I'll try to do it

19:43 unless someone will do it earlier

19:43 mmarczyk: dnolen: I'm totally on it once we wrap up the current batch of things, Rhino is starting to drive me crazy

19:43 yoklov: source maps would be amazing.

19:43 dnolen: gozala: no better time to dig in then now - the CLJS compiler is awesome.

19:43 yoklov: we should probably just start - we have line info.

19:44 yoklov: dnolen: what sort of output is required for that?

19:44 gozala: dnolen: BTW is there any chance that dependency on rhino will go away ?

19:45 for cljs I mean

19:45 mmarczyk: gozala: there is no dependency

19:45 gozala: except for the Rhino REPL

19:45 dnolen: yoklov: just the creating v3 sourcemap JSON

19:45 gozala: mmarczyk: I mean to run repl compile I need rhino

19:45 which is pretty slow

19:46 dnolen: gozala: repl doesn't require Rhino, copmile doesn't either.

19:46 gozala: what does require it then ?

19:46 mmarczyk: gozala: well, the Rhino REPL does, naturally

19:46 gozala: nothing else

19:46 dnolen: gozala: there are 2 repls, browser and Rhino. compile doesn't evolve a js engine at all.

19:47 involve

19:47 gozala: dnolen: ok but you still need jvm and clojure to compile

19:47 mmarczyk: gozala: nothing to do with Rhino

19:47 gozala: I guess what I meant is I'd like to move to all node based cljs

19:47 dnolen: gozala: sure, that's probably not going to change anytime soon.

19:48 mmarczyk: oh, I see

19:48 dnolen: gozala: it woudn't be any faster.

19:48 gozala: well for startup it will

19:48 starting jvm takes a while

19:48 dnolen: gozala: but analysis and compilation wouldn't be any faster.

19:48 gozala: in fact lein would benefit much from being node based as well I think

19:48 mmarczyk: gozala: you only need to do that once per work session though

19:49 hiredman: :(

19:49 mmarczyk: gozala: well, Lein uses Maven stuff

19:49 hiredman: gozala: not unless you want to rewrite all the maven dependency stuff

19:49 yoklov: gozala: at the very least, the closure compiler will probably never be node based

19:49 gozala: ok I'll shut up!

19:49 will try to learn more and hopefully get node-repl

19:49 dnolen: gozala: haha, bootstraping would be interesting no doubt.

19:49 yoklov: haha, i mean, cljs-in-cljs would be awesome, but its… hard

19:50 gozala: I think what I mean is after using node

19:50 having all these layers makes it hard to switch

19:50 dnolen: gozala: but it's a bit of work - not the least because we rely on GClosure to do some fancy optimizations that none of the other minifiers do as far as I know.

19:51 gozala: dnolen: sure no doubt on that but if I could get deoptimized version

19:51 mmarczyk: gozala: you can pretty much treat lein-cljsbuild as a black box though

19:51 dnolen: gozala: it's true that the optimization pass is probably less relevant for node.js ...

19:51 gozala: it's good enough for dev and then you can optimize before doployment

19:51 mmarczyk: gozala: start up the jvm once and forget about the layering

19:52 dnolen: gozala: in anycase, this just something someone needs to work on, no one is against it :)

19:52 yoklov: mmarczyk: honestly i wish that were true

19:52 gozala: thanks everyone for insights ;)

19:52 yoklov: GClosure crashes all the time for me :)

19:52 *:(

19:53 dnolen: yoklov: that's weird.

19:53 yoklov: runs out of heap

19:53 hiredman: uh, give it more?

19:53 yoklov: iirc I can't because its not an option in lein-cljsbuild yet

19:53 GeraldMacDuich: mmarczyk, I am the greatest programmer safe only for the microsfot chief software architect

19:53 mmarczyk: yoklov: really? well, tbh, I never use auto personally, but I've used cljs.closure/build from a long-running REPL -- never experienced a crash

19:53 hiredman: yoklov: have you tried profiling gclosure?

19:54 yoklov: hiredman: no, usually more interested in just restarting

19:54 mmarczyk: I mean, never use auto where it would actually matter... always want a Clojure REPL then anyway

19:54 yoklov: mmarczyk: yeah, judging by the stacktraces its during the parse portion of auto.

19:55 dnolen: mmarczyk: auto is actually pretty nice

19:55 hiredman: are you sure?

19:55 dnolen: mmarczyk: I sometimes run auto + repl

19:55 hiredman: I've been staring at jvisualvm graphs for the past week, they are rather pretty

19:55 mmarczyk: dnolen: oh? I'll give it a shot then

19:56 yoklov: yeah, I run auto and repl also, but I use auto more than the repl because I'm an interactive development noob :p.

19:56 mmarczyk: yoklov: well, whether I end up using this much, this should be fixed

19:56 dnolen: yoklov: yeah it's pretty weird - but pretty awesome once you figure out a workflow.

19:56 mmarczyk: yoklov: I'll see if it crashes on me too

19:57 yoklov: mmarczyk, I think I'm the only one who has had it happen, there's a ticket open in lein-cljsbuild though to allow increasing the heap size

19:58 dnolen: yeah, I've been trying to use it more. at the very least, it's been helpful for finding errors in clojurescript when the compiler just barfs

19:58 mmarczyk: yoklov: ah, that's easy then -- gclosure gets lost playing with your demos and forgets actually to compile

19:58 dnolen: yoklov: I'm assuming you've read about GOAL & GOOL?

19:58 yoklov: dnolen: I have not

19:59 Oh, yeah I have

20:01 There was actually a guy in #racket a while back who worked for the same company, but I guess they had switched to using scheme for the AI.

20:01 dnolen: yoklov: supposedly they've got some Racket in the Uncharted series

20:02 yoklov: dnolen: Haha, yeah, it's awesome that there's actually people using lisp for game development professionally. I was fairly shocked when I heard about it.

20:02 gozala: dnolen: If someone could write up some pointers what needs to be done for node-repl

20:02 I'd be happy to give it a try

20:02 at the moment I'm pretty lost

20:04 yoklov: I should have another cljs game up by the end of the weekend by the way. Ludum Dare 23 starts in one hour (and runs for the next 48), haha

20:04 ibdknox: yoklov: good luck

20:05 yoklov: ibdknox: thanks!

20:05 dnolen: yoklov: awesome! I realize that I'd seen one of your old posts on the Racket ML about a past one.

20:05 yoklov: good luck!

20:05 mmarczyk: yoklov: good luck, can't wait to see it!

20:06 yoklov: dnolen: Haha, yup, that one was… pretty bad to be honest, but it was a lot of fun to make

20:06 dnolen, mmarczyk: thanks!

20:07 gozala: dnolen: BTW I have hard time figuring out some things about protocols

20:07 for example I can see that they take some args

20:07 https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L215-218

20:07 and if one of them is function how can I find out

20:07 what should this function be called with

20:08 dnolen: gozala: ?

20:08 gozala: defprotocol is just a declaration

20:08 gozala: At the moment I'm trying to find examples that implement protocol

20:08 hiredman: higher order doc strings

20:08 gozala: but that not always works

20:08 hiredman: most likely atoms

20:08 gozala: dnolen: let me give you example

20:08 so I define Deferred type

20:08 hiredman: the function you want is add-watch

20:09 gozala: and I figured I can implement IPending

20:09 now I need to register listeners

20:09 so I'm considering implementation of IWatchable

20:09 but than it's not clear

20:09 what does -add-watch does with a key or f

20:10 dnolen: gozala: it adds a watcher, how it's done is not important. the contract is that the f will be called on changes.

20:11 gozala: hiredman: yeah in this case I can lookup add-watch

20:11 but it would be great if protocols had some details as well so I don't have to search for a function that uses it

20:13 dnolen: but I guess there is some expectation how registered `f` is called

20:13 what are the arguments for it I mean

20:14 mmarczyk: gozala: it's possible to specify a docstring for the protocol as well as docstrings for any or all of the methods

20:16 dnolen: gozala: yeah, would happily take a doc patch.

20:17 gozala: dnolen: sure I need to figure out first ;)

20:17 Please don't take it as complains

20:17 dnolen: gozala: of course

20:17 gozala: just a feedback from someone who's trying to get involved

20:18 dnolen: gozala: feedback appreciated!

20:18 netrealm: If I have a vector [:A :B :C], is there a way to do process it two elements at a time? e.g., call a function with two parameters, :A and :B the first time, and :B and :C the next time?

20:19 mmarczyk: &(doc partition)

20:19 lazybot: ⇒ ------------------------- clojure.core/partition ([n coll] [n step coll] [n step pad coll]) Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection... https://refheap.com/paste/2273

20:19 mmarczyk: see also partition-all

20:19 gfredericks: &(partition 2 1 [:A :B :C])

20:19 lazybot: ⇒ ((:A :B) (:B :C))

20:19 netrealm: Aha! Thank you!

20:21 kenneth: is there a better way to do

20:21 (apply concat some-sequence)

20:22 gfredericks: kenneth: well that's pretty short

20:22 you could (mapcat identity some-sequence) just for variety

20:22 kenneth: isn't there a cost to calling a function with potentially infinity arguments?

20:22 gfredericks: not that I know of

20:23 kenneth: okay, just wanted to check if that was kosher

20:23 gfredericks: happens all the time

20:23 it's all done lazily

20:24 dnolen: yoklov: hey are you on Twitter?

20:24 yoklov: dnolen: i have an account but I'm terrible at using it

20:24 dnolen: yoklov: what's your username?

20:25 yoklov: https://twitter.com/#!/thomcc_

20:25 haha

20:25 dnolen: yoklov: I've been hyping your CLJS game experiments would like to give proper attribution :)

20:26 yoklov: haha, sounds great! that definitely gives me more motivation to use it :)

20:28 dnolen: yoklov: https://twitter.com/swannodette/status/193494380445827072

20:28 yoklov: haha, awesome!

20:34 mmarczyk: dnolen: yoklov: just discovered a bug in HashCollisionNode, will post a patch in a moment

20:34 konr: ,(contains? [0 2] 1)

20:35 I can't believe THAT was the bug, hah

20:35 dnolen: mmarczyk: cool, I'm out but I'll take a look tomorrow.

20:35 mmarczyk: dnolen: ok, thanks

20:37 charles_r: I have slime working in emacs. When I execute a block it only shows in this tiny space in the status area. Is there any way to send this to a regular emacs buffer?

20:37 mmarczyk: it's just a typo really... I need to check if it's even in the patch which went into master

20:39 ah, it is. well, patch forthcoming

20:46 http://dev.clojure.org/jira/browse/CLJS-188 for anyone who needs PHM to work

20:47 w/ hash collisions, anyway

20:49 hiredman: clojurebot: ping?

20:49 clojurebot: PONG!

20:50 offby1: N00b: what's like "printf", except it goes to stderr instead of stdout?

20:50 yoklov: mmarczyk, you put nil instead of not-found? what is not-founds default, nil anyway?

20:51 mmarczyk: yoklov: the method which doesn't take a not-found returns nil, yes

20:51 yoklov: okay, I won't worry about it then.

20:52 mmarczyk: yoklov: it actually causes weird breakage in the presence of hash collisions

20:52 yoklov: oh

20:52 hm

20:53 mmarczyk: like wrong answers from contains?

20:53 yoklov: I see.

20:55 alright seems worth applying

20:56 not worth not doing and then wondering about it whenever I get an error

20:56 offby1: Answering my own question: (:use [clojure.pprint :only (write)]) (defn eprintf [& args] (write (apply format args) :stream *err*))

20:56 mmarczyk: yoklov: right

20:56 offby1: Criticisms solicited :)

20:56 S11001001: cl-format is way cooler, and takes a stream arg

20:57 yoklov: offby1, I think you could do (binding [*out* *err*] (printf whatever))

20:57 hiredman: ^-

20:57 offby1: yoklov: probably :) Thanks.

20:59 yoklov: offby1: np, was going to say something but forgot

21:04 mmarczyk: yoklov: just a heads-up -- apparently there's something the matter with hash collision handling in transients too... working on it now

21:04 yoklov: mmarczyk, thats okay, those aren't in cljs head are they?

21:05 mmarczyk: yoklov: nope

21:05 yoklov: okay

21:09 alright, game on. theme for ludum dare is 'Tiny World'

21:10 mdeboard: I've got a string like "(country:(\"United States\") AND city_slug:(baltimore) AND state_slug:(maryland) AND title_slug:(database\\\-administrator\\\-oracle))" andI want to strip those escape characters out. I tried (cs/strip s "\\" "") but still throws the same error.

21:13 (solr escaping stuff :( )

21:13 extra-super escaping

21:15 S11001001: mdeboard: won't unescaping before parsing leave the result grammatically ambiguous?

21:16 offby1: Return of the n00b -- http://ix.io/2kw this simple program attempts to print a word to stderr, but the word doesn't appear. What am I doing wrong?

21:16 mdeboard: S11001001: How so?

21:17 hiredman: offby1: are you sure you're looking in the right place for stderr output?

21:18 mdeboard: Maybe I'm inventing a problem.

21:18 S11001001: mdeboard: blahthing:(alpha\) AND injection:(beta)

21:18 mdeboard: I'm parsing logs, not passing data to Solr

21:18 I should've mentioned that I reckon.

21:19 S11001001: I don't know what solr is

21:20 but regardless, it's easier, not to mention uniquely possible, to parse before unescaping

21:20 mdeboard: Please do tell

21:20 offby1: hiredman: sorta ... I'm expecting it to appear in emacs' *compilation* buffer. That's where the stderr of other (non-clojure) commands goes

21:20 hiredman: anyway if I just run that command (in the comment) at the shell, I don't see "eprintf" but I do see "printf".

21:20 mdeboard: S11001001: Because this barfs https://gist.github.com/6b815ddecb4dcdfed66a

21:21 S11001001: mdeboard: (?!<\\)

21:22 mdeboard: Is that an emoticon

21:22 jk

21:22 S11001001: anyway, e.g.: you're parsing a key-value series where values are delimited by parens and arrows. You intend the result "alpha) AND injection:(beta". You can parse blahthing:(alpha\) AND injection:(beta) correctly. You can't parse blahthing:(alpha) AND injection:(beta) correctly.

21:23 mdeboard: parens and arrows?

21:23 S11001001: er, not sure how arrows slipped in

21:23 mdeboard: I'm not trying to parse multiple parameter values simultaneously

21:23 S11001001: s/arrows/special chars escaped by backslashes/

21:23 mdeboard: e.g. https://gist.github.com/6b815ddecb4dcdfed66a

21:23 S11001001: weird typo

21:23 right, but even so, you can't do it by unescaping and then matching, because the result will be ambiguous

21:24 your regex needs to know when to skip over an escaped terminator

21:24 and ?!< is the best tool for that

21:25 mdeboard: Well, I can't even print the string because of the 'Unsupported escape character \-' error message.

21:25 muhoo: wow i'm spoiled. after doing some clojure for a while, i had to go back to doing some python coding, and finding it comically verbose and unnecessarily complex.

21:25 *python*, ffs. i used to love python. now, meh.

21:26 mdeboard: Switch back and forth a few times, your zealotry will be leavened a bit

21:26 they both have great features.

21:27 muhoo: i find the repl in ipython nicer than clojure, true.

21:27 mdeboard: ah there we go (cs/replace (re-pattern s) #"\\" "")

21:27 muhoo: but i wrote some quick clojure functinos to make clojure repl more like python

21:28 mdeboard: Well, there's just no comparing lein repl to ipython, ipython is far and away best in its class for repls

21:28 muhoo: true that.

21:28 S11001001: muhoo: http://www.catb.org/jargon/html/F/functino.html

21:28 mdeboard: ha

21:28 muhoo: functino is a little function in italian

21:29 piccolo functiono, quanta e' bella

21:29 bello

21:29 mdeboard: SPAGHETTI RIGATONI

21:29 Also, S11001001 you don't know what Solr is?

21:29 huh

21:29 S11001001: nope

21:30 muhoo: but i was speaking of the code, not the tooling/repl. of course a language that's over 10 years old will have better tooling.

21:30 wow, 20 years old!

21:31 mdeboard: I mean, I definitely know what you mean, I have implemented a few lisp features for specific problems

21:31 seancorfield: i'm not experienced with python - what's so good about its repl?

21:31 muhoo: what's the best way to describe it. fluidity? maybe?

21:31 mdeboard: seancorfield: Well, the built-in interpreter is pretty vanilla, but iPython is extremely full-featured.

21:31 S11001001: comparing ipython to lein repl isn't quite fair

21:31 seancorfield: (python has been on my list of languages to learn for years but never reached the top due to pressures of work)

21:31 mdeboard: Agreed

21:31 w/ S11001001

21:32 muhoo: no, like i said, lein is very new. great, but new.

21:32 seancorfield: can any of you give some specifics?

21:32 mdeboard: A better comparison would be slime repl

21:32 S11001001: I am going to quote what I literally wrote before your message popped up mdeboard: "a better comparison would be slime repl"

21:32 mdeboard: seancorfield: Sure. http://ipython.org/ipython-doc/dev/interactive/htmlnotebook.html which has some of the features that ibdknox is aiming for with Light Table

21:32 muhoo: hmm, maybe i should get around to using slime then. i've been putting it off.

21:33 * seancorfield reads mdeboard's link

21:33 mdeboard: To be honest I haven't even begun to touch ipython's features. There are a *lot*, and it's extremely customizable.

21:34 S11001001: I may try it out sometime if I feel like setting up the emacs integration

21:34 seancorfield: 'k i can see how that's more like slime / swank... with bells on too...

21:34 mdeboard: I am also a big fan of iPython integration with pdb https://github.com/gotcha/ipdb

21:34 seancorfield: i guess since i'm in emacs all the time with a slime repl, i tend to think of the repl as being pretty good :)

21:34 mdeboard: step-through debugging with tab completion, syntax highlighting, etc., etc.

21:35 Yeah I'm in emacs full-time too for sure

21:35 seancorfield: mdeboard: well, cdt has that for clojure, right?

21:35 mdeboard: there's a way to get ipython running in emacs but alt-tab is faster than learning how to set that up

21:35 seancorfield: (step debugging)

21:35 mdeboard: hell I dunno, I only write clojure on weekends (for now)

21:35 If you say it does I believe you :P

21:36 seancorfield: :) cdt's not bad at all, esp. with clojure 1.4.0's disable-locals-clearing compiler setting :)

21:36 S11001001: at least slime has step debugging for some CLs, know nothing about clojure stepping

21:37 seancorfield: cdt was rolled into swank-clojure as of 1.4.0 i believe

21:37 i don't use it a huge amount but it's been very helpful to track down certain bugs over the last few months

21:38 mdeboard: (i)pdb is a critical part of my development process

21:38 I'm gonna look into ipdb as soon as I figure out how to make this string not throw up.

21:38 s/ipdb/cdt

21:39 seancorfield: when we took clojure 1.4.0 to production this week, we also added the ability to start/stop a swank server in various long-running processes... so we can slime-connect into a production instance to examine data and run functions in a "real world" environment

21:39 mdeboard: Oh wow

21:39 holy crap that's awesome.

21:39 lstoll: that's sweet

21:39 mdeboard: do want.

21:40 seancorfield: was very helpful today - we did a data migration a while back (as part of our move from our legacy platform to our new system) and we created a number of duplicate records - a bug in the migration that hadn't shown up in any tests (of course!)

21:41 so i was able to run some clojure functions to identity the problematic records and eliminate them, and provide business with the data they needed to decide what to do about the issue, all from inside emacs

21:42 mdeboard: That's great.

21:42 amalloy: seancorfield: is there any particular reason to start/stop the swank servers, rather than just have them on all the time?

21:42 mdeboard: Dammit. Is #"string" not just a macro for (re-pattern "string")

21:43 seancorfield: amalloy: a little nervousness about leaving a process listening on a port, even tho' it's all inside the DMZ and only accessible via VPN

21:43 S11001001: we don't want to eat pattern compilation every time

21:43 emezeske: &(class #"string")

21:43 lazybot: ⇒ java.util.regex.Pattern

21:43 emezeske: &(class (re-pattern "string"))

21:43 lazybot: ⇒ java.util.regex.Pattern

21:43 mdeboard: That's great but I get different behaviors.

21:43 amalloy: mdeboard: escaping

21:43 S11001001: and we want #"a\(" not to get weirded out about the \

21:44 ever written a bunch of regexes in emacs lisp?

21:44 amalloy: &#"a\("

21:44 muhoo: still, i doubt russian haxx0rs would know what do do with a clojure repl if they managed to gain access to it

21:44 lazybot: ⇒ #"a\("

21:44 amalloy: &(re-pattern "a\\(")

21:44 lazybot: ⇒ #"a\("

21:44 amalloy: muhoo: i nominate this for Worst Security Policy

21:44 mdeboard: e.g. https://gist.github.com/07ce84a751a6814ce02e

21:45 amalloy: mdeboard: escaping

21:45 mdeboard: amalloy: peppercorn

21:45 muhoo: amalloy: security through s-expressions? yeah, doesn't seem very solid

21:45 mdeboard: amalloy: Do you have more specific guidance ?

21:46 amalloy: mdeboard: your \\\ isn't the same in those two

21:46 mdeboard: How not?

21:46 amalloy: #"\\\-" matches the literal string "\-"

21:46 "\\\-" is an illegal string escape

21:47 seancorfield: amalloy: like i say, i wouldn't want to leave a slime repl open all the time, just in case... which is why we didn't do it until swank-clojure 1.4.2, which added stop-server :)

21:47 mdeboard: RIght, that's the error I"m trying to overcome

21:47 amalloy: &"\\\-"

21:47 lazybot: java.lang.RuntimeException: Unsupported escape character: \-

21:47 S11001001: &(str #"\\\-")

21:47 lazybot: ⇒ "\\\\\\-"

21:47 mdeboard: &(str (re-pattern "\\\-"))

21:47 lazybot: java.lang.RuntimeException: Unsupported escape character: \-

21:47 mdeboard: Which is why I"m boondoggled.

21:48 amalloy: mdeboard: you aren't calling re-pattern with "\\\-", because as you can see "\\\-" isn't a legal value - it doesn't exist

21:48 seancorfield: &(str (re-pattern "\\\\-"))

21:48 lazybot: ⇒ "\\\\-"

21:48 amalloy: S11001001 has helpfully demonstrated that if you want re-pattern to result in #"\\\-", you need to give it "\\\\\\-"

21:48 mdeboard: Sure, but how do I deal with parsing loglines that come in with "\\\-" in them then?

21:49 I am surprised that #"string" and (re-pattern "string) behave differently for some inputs.

21:49 (re-pattern "string") rather

21:49 S11001001: mdeboard: are you testing your function by copy-pasting bits with \s in them?

21:49 into clojure literal strings?

21:50 amalloy: the whole point of #"string" is to avoid having to escape all this crap twice

21:50 i suppose S11001001 might argue that performance is the main point; i dunno

21:50 S11001001: no, I care about the escaping more too

21:50 but I do have the habit of splitting re.compiles off in python

21:51 mdeboard: It probably goes without saying that I'm confused.

21:51 About this difference in behavior between #"string" and (re-pattern "string") since I was under the impression #"string" was a macro for (re-patterN)

21:51 amalloy: it is not

21:52 emezeske: S11001001: You know python caches like the last 100 expression compiles?

21:52 S11001001: no I did not

21:52 even so, "last"?

21:52 emezeske: Well, the cache only holds 100 (I think) entries

21:52 So, 100 different regular expressions

21:53 amalloy: python uses pcre, right? afaik i know pcre does that caching

21:53 emezeske: I don't know about that, but last time I looked at the regex source (in Python) it just stuck stuff in a dictionary

21:53 That was for 2.x, though, not 3.x

21:54 amalloy: although, what the hell, why are you calling clojure.string/replace with a regex as its first argument? it wants a string, not a regex

21:54 gfredericks: amalloy: ooh, regex editing!

21:55 mdeboard: Because I can't do anything with the damn string because it's got the "\-" character in it, because it's coming from Solr logs, where "-" is a special character and must be escaped.

21:55 S11001001: mdeboard: so are you, indeed, putting "...\-..." into a literal clojure string to test the function?

21:55 mdeboard: Yes, I'm copy-pasting aline from the log.

21:56 S11001001: right, that won't work

21:56 mdeboard: Why's that

21:56 S11001001: because the string with the two characters backslash and hyphen is written like this in clojure: "\\-"

21:56 &(count "\\-")

21:56 lazybot: ⇒ 2

21:56 S11001001: &(first "\\-")

21:56 lazybot: ⇒ \\

21:56 S11001001: heh

21:56 mdeboard: Yes, I get that, I understand why it's failing

21:56 S11001001: &(second "\\-")

21:56 lazybot: ⇒ \-

21:56 mdeboard: I understand the regex

21:56 S11001001: so you *can't* just copy-paste

21:56 nothing to do with regular expressions

21:57 mdeboard: I understand the reason for the failure, really

21:58 amalloy: if you don't understand why pasting into a repl from a log file is a problem, i'm not sure you do. try getting the repl to *read* from the log file; you'll get out the string you wanted, escaped just enough times

21:59 mdeboard: Yeah it gets parsed by cascalog beautifully, but it just dawned on me I'm sitting here escaping double quotes but then scratching my head like an idiot over escaping anything else.

22:00 literally was just typing escape characters in front of double quotes grumbling about the \- thing.

22:02 Thanks. It takes me awhile sometimes, I'm special.

22:40 technomancy: offby1: I think slime might be doing some shenanigans with *out* that don't apply to *err*

22:42 the whole project-in-a-subprocess thing combined with the JVM's crappy process API requires some annoying workarounds; `lein trampoline repl` and `lein trampoline run` let you work around them

23:01 charles_r: (doc +) gives "[Thrown class java.lang.RuntimeException]

23:01 clojurebot: "([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0. Does not auto-promote longs, will throw on overflow. See also: +'"

23:01 charles_r: I'm using slime in emacs.

23:02 S11001001: charles_r: clojurebot disagrees with you

23:02 charles_r: heh

23:02 I disagree with me too. Something isn't right with my config

23:02 xeqi: (use clojure.repl)

23:03 charles_r: no quote?

23:03 xeqi: it needs a quote

23:04 charles_r: thanks, I thought I had tried that

23:14 miniyuki: Hi, does anybody know if lazy-cat is not supported on ClojureScript?

23:15 S11001001: lazy-cat is no longer cool

23:15 miniyuki: what should I use then?

23:15 S11001001: and is anyway equivalent to (concat (lazy-seq x) (lazy-seq y) ...)

23:15 that is literally what it expands to now, iirc

23:16 miniyuki: thanks a lot

23:16 S11001001: only room for 1 cat in clojure.core

23:16 2 cats

23:17 brehaut: im pretty sure you should generalise to N cats at this point

23:17 S11001001: nope, no infinite cats

23:17 just the ≈2

23:18 * brehaut looks at the logs to work out what we are talking about

23:23 brehaut: oh right

23:36 mindbender1: please I need a little help with my gen-class problems

Logging service provided by n01se.net