#clojure log - Oct 02 2011

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

0:00 amalloy: you are never going to get that from clojure

0:00 Arafangion: amalloy: I find that hard to believe.

0:01 amalloy: it is a hosted language, and C isn't really a "host" so much as "someone who, if you're polite, won't murder you"

0:01 jli: haha

0:01 amalloy: and java lacks the capability to talk to hardware except through native libraries which have to be written in C (or something else native) anyway

0:01 Arafangion: amalloy: I'm very comfortable with such bindings.

0:02 amalloy: As comfortable as one can be, anyway...

0:02 S11001001: Arafangion: why not require mono on mac?

0:02 Arafangion: S11001001: It's a large, unusual download.

0:02 amalloy: great, then deploy your clojure app with the jvm or .net dependency and your native libraries

0:02 ibdknox: fwiw

0:02 Arafangion: On windows I use .net, so that's fine there.

0:02 ibdknox: I think there are at most a handful of people doing gui's in clojure

0:03 Arafangion: Oh, I'm not doing the gui in this!

0:03 I'm doing the GUI natively on each platform. (For better or for worse)

0:03 amalloy: nobody will ever write a clojure->C compiler because clojure depends on the host to do all kinds of things that C just doesn't do. if you wrote such a thing, it wouldn't be at all like clojure by the time you were done

0:04 Arafangion: amalloy: How so?

0:04 amalloy: (or, you would realize that what you wrote turned out to be the jvm)

0:04 Arafangion: amalloy: Actually, I suspect that what the 'C target' ends up writing could well be a javascript host.

0:05 amalloy: memory management, for example

0:05 miwillhite: hey all…what are people using for clojure and mysql?

0:05 Arafangion: memory management is a minor point.

0:07 ibdknox: miwillhite: you have a few options: clojureql, clj-record, or writing against clojure.java.jdbc

0:07 S11001001: Arafangion: you might consider common lisp or scheme; some implementations have great C binding support and compile to standalone binaries

0:08 jli: Arafangion: hm, what do you mean it's a minor point?

0:08 ibdknox: haha, could you imagine clojure with explicit memory management? *shudders*

0:08 amalloy: (inc S11001001)

0:08 lazybot: ⟹ 2

0:09 amalloy: ibdknox: i actually read about a lisp someone had written without garbage collection

0:09 miwillhite: thanks ibdknox

0:10 S11001001: you can still turn off the gc in some lisps

0:10 Arafangion: ibdknox: There are a number of ways to manage memory in C, including adding a garbage collector.

0:10 S11001001: then it's your fault if you don't turn it back on :)

0:10 ibdknox: haha

0:10 Arafangion: The best non-GC way of managing memory I've seen is probably that with the ObjC legacy runtime, but ugh, it still falls massively short of true GC.

0:10 ibdknox: Arafangion: I really hope you do use Clojure, but based on what you've described so far, I don't think Clojure is currently the right tool to solve your problem

0:10 Arafangion: NSAutoreleasePools are awesome.

0:11 jli: Arafangion: I wonder if trying to use clojure for your problem is really the best solution :(

0:11 Arafangion: ibdknox: Actually, it's not the right tool - I'm mostly exploring and learning for my own education.

0:11 jli: haha

0:11 ibdknox: Arafangion: party on then :D

0:11 amalloy: but yes. lisp was the first language do to a lot of things, including garbage collection. there's a reason this is the case, and also a reason why gc is the lisp-innovation most commonly used by mainstream languages

0:11 Arafangion: The rest of the people I'm working with are still learning Python, pushing yet *another* language isn't going to work. :(

0:13 ibdknox: lol

0:13 especially one this different

0:14 Arafangion: I'm basically the languages geek, it seems. :(

0:14 Despite never using erlang, or haskell. (Both are on my TODO list!)

0:14 jli: Arafangion: what's the program, if you can discuss any more detail?

0:15 Arafangion: jli: I can't really discuss, and it's not really relevant save that it requires the GUI to be written in the native toolkit (whatever that means), and that it interacts with hardware.

0:16 jli: Arafangion: what does interacting with hardware entail?

0:16 Arafangion: jli: From my perspective, it entails interacting with a C++ library.

0:16 srid: in enlive, can I select all <p> nodes that come after a <h2> node?

0:17 Arafangion: jli: Which I tend to handle by wrapping it, badly, into a more convenient library.

0:18 amalloy: $google java compute md5

0:18 lazybot: [Java simple class to compute MD5 hash] http://www.anyexample.com/programming/java/java_simple_class_to_compute_md5_hash.xml

0:18 amalloy: ugh. someone have a link to a real library?

0:18 Arafangion: http://stackoverflow.com/questions/415953/generate-md5-hash-in-java

0:19 amalloy: Despite SO's poor reputation on this network, they are remarkably good at answering dumb questions. :)

0:19 ibdknox: amalloy: it's relatively simple with MessageDigest

0:19 jli: srid: you mean the equivalent of the CSS selector "h2 + p" ?

0:19 srid: jli: yup

0:19 jli: should be. let's see.

0:19 srid: enlive docs are sadly insufficient

0:19 http://enlive.cgrand.net/syntax.html is terrible to understand for humans

0:20 ibdknox: srid: https://github.com/marick/enlive-tutorial

0:20 srid: https://github.com/swannodette/enlive-tutorial

0:20 muuuuuch better intros

0:20 srid: i read them

0:21 amalloy: ah, excellent. i'm already depending on commons-codec for base64; i might as well use their md5

0:21 jli: srid: seems like there's no "+" in enlive, but you could just use seq processing I think

0:21 ibdknox: I don't think you need +

0:22 :h2 :p should work?

0:22 Arafangion: What kind of lisp is Clojure? Is it feasible to write "lisp code" that happens to be run by different lisp implementations? (Eg, Clojure, ChickenScheme, etcetera)

0:22 jli: ibdknox: wouldn't that only match <p>'s inside <h2>'s?

0:22 khaliG: ibdknox, curious, why are there only a handful?

0:23 srid: jli: seq processing? you mean tree processing? what is the simplest way to select <p>'s that come after the <h2>?

0:23 ibdknox: jli: oh, whoops, it helps if I read what he wants

0:23 jli: :)

0:23 scottj: Arafangion: any clojure code more than a simple like (+ 2 2) isn't going to run on scheme w/o changes

0:23 * srid is parsing an terrible HTML page to convert to epub. for that he needs only the <p>'s that come after the page title (<h2>)

0:23 ibdknox: khaliG: swing sucks, and I don't know that Clojure makes it particularly easy to write GUI code

0:24 amalloy: Arafangion: clojure picked different keywords for a lot of the low-level primitives, so there will be issues with a "direct transplant" even on the most common lisps

0:24 eg, fn instead of lambda

0:25 def and defn instead of define or defun

0:25 ibdknox: makes things so much easier to read

0:25 Arafangion: amalloy: That sucks - but I suppose that is a minor point? The more serious concern is probably the object system?

0:25 khaliG: ibdknox, hmm i think it does - miglayout + swing + clojure is pretty nice if you ask me as far as lisps go. Then again, I haven't tried for example lispworks CAPI so that might be better

0:26 amalloy: *shrug* the host interop, the standard libraries, the data types...

0:26 jli: Arafangion: I think it'd be a headache to try to compile clojure to another lisp

0:26 Arafangion: jli: What about compiling "another lisp" to clojure?

0:26 amalloy: livingstone was writing a scheme->clojure translator to help him learn clojure

0:27 jli: scheme is easy though :)

0:27 amalloy: don't know how that turned out

0:27 Arafangion: jli: Yeah, infact, scheme is the lisp I'm thinking of.

0:27 amalloy: jli: it's the most similar, i think, but there are plenty of pitfalls

0:27 jli: well, maybe modulo continuations

0:27 Arafangion: Business logic isn't exactly that damanding.

0:27 *demanding

0:27 khaliG: Arafangion, btw CAPI might be a good fit for your problem (native look and feel GUI on different platforms)

0:28 amalloy: continuations, tail calls, reified environments, "real" cons cells...

0:28 Arafangion: khaliG: The GUI isn't that difficult to do on the native platforms, honestly.

0:28 jli: amalloy: yeah. hmm, I wonder how macro -> macro compilation would work out. seems hairy.

0:28 Arafangion: khaliG: Modern toolkits more or less let you just click-click-click and you have the UI done.

0:29 jli: Arafangion: the GUIs can self-replicate now? it is truly the end of days

0:29 Arafangion: jli: Consider - it's also a good way to ensure separation of UI from business logic.

0:30 srid: jli: (drop-while #(= :p (:tag %)) (select dom [#{:h2 :p}])) does it.

0:30 khaliG: btw offtopic question perhaps - but what are some warm and fuzzy things about using the JVM for you guys?

0:30 srid: thanks to 4clojure, i didn't reinvent drop-while

0:31 miwillhite: exit

0:31 scottj: khaliG: very few bugs in my experience compared to common lisp and smalltalk environments I've used.

0:31 Arafangion: khaliG: It's generally easy to use anywhere, except perhaps, most smartphones.

0:32 S11001001: khaliG: it made our language of choice sound enterprisey when akamai bought us :)

0:33 jli: srid: it seems like that would select all <p>'s?

0:34 amalloy: srid: fwiw, (comp #{:p} :tag) is a prettier way to write #(= :p (:tag %))

0:34 khaliG: scottj, true, it's easy to take the extensive work that has gone into the JVM for granted but it's quite impressive if you reflect on it! S11001001 nice! :)

0:34 srid: jli: yes, but only those that come after <h2>

0:34 amalloy: thanks

0:35 i tend to forget the comp way of doing things

0:35 jli: amalloy is just a comp fanboy

0:35 :)

0:35 amalloy: in a fight between comp and juxt, on the MOON, who would win?

0:35 srid: ,(doc juxt)

0:35 clojurebot: "([f] [f g] [f g h] [f g h & fs]); Alpha - name subject to change. 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 applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"

0:35 jli: srid: hm, I thought #{:h2 :p} would match all h2 and p elements, without regard for ordering.

0:36 amalloy: juxt

0:36 khaliG: yea i follow amalloy on 4clojure and noticed his use of comp a few times.. made me use it myself since :P

0:36 srid: jli: seems like the ordering is top to bottom (no nested <p>'s in the HTML here)

0:36 amalloy: jli: i know, it's a no-brainer. i just put it out there so i could /ignore anyone who thinks comp would win

0:37 jli: my 4clojure solutions have a hideous amount of partial, apply, comp, and generally pointlessness. just getting it out of my system, I hope.

0:37 amalloy: jli: he's getting a list of all the h2s and ps; then he throws them away until he gets an h2

0:37 khaliG: jli, i think that's the point, to learn the language better imho

0:39 jli: amalloy: oh, I see now. srid: so there's only 1 h2?

0:40 srid: jli: yes.

0:40 this webpage was created in frontpage

0:40 * ibdknox cringes

0:40 srid: i'm trying to convert it to to epub for reading on the phone

0:41 specifically - Microsoft FrontPage 4.0

0:41 * jli cheers

0:41 brehaut: srid: thats what, Mesozoic?

0:41 or cretaceous. i never can remember

0:41 srid: late 1990's I think

0:42 Arafangion: Ancient! I was 5!

0:42 (And still learning to talk)

0:43 amalloy: so was frontpage

0:43 Arafangion: That's depressing.

0:43 ibdknox: that was back when frontpage would overwrite any html changes you made

0:43 Arafangion: Maybe that was why my speech was delayed.

0:45 scb: anybody doing anything serious on the web using clojure?

0:45 * ibdknox raises hand

0:45 amalloy: www.4clojure.com

0:45 for certain values of "serious"

0:46 jli: is there anything that does this? https://gist.github.com/1257064

0:46 * Arafangion is considering writing 'scheme that gets compiled to various different language backends', ala coffeescript for javascript..

0:46 jli: basically, partition but overlapping groups

0:46 amalloy: &(partition 3 1 (range 1 9))

0:46 lazybot: ⇒ ((1 2 3) (2 3 4) (3 4 5) (4 5 6) (5 6 7) (6 7 8))

0:46 jli: oh, darn.

0:47 haha

0:47 cark: =)

0:48 srid: how this made any more concise?

0:48 (filter #(not (empty? (select % [:span :a :> text-node]))) nodes)

0:48 jli: srid: anyway. so, you could also use partition. (filter #(= (:tag (first %)) :h2) (partition 2 1 dom))

0:49 I think at least.

0:49 that would get you all (h2, p) pairs

0:49 amalloy: srid: (filter seq (...))?

0:49 scottj: srid: filter not is remove

0:50 amalloy: scottj: and empty is not seq...

0:50 S11001001: Arafangion: so you mean like bigloo, which compiles to C, java, and .net?

0:50 srid: filter seq works for enlive returning ()

0:50 Arafangion: S11001001: Yes.

0:50 * Arafangion actually came across bigloo not 2 minutes ago.

0:50 srid: my filter must always return one result.

0:50 i wish there was something like pick-first

0:51 jli: srid: I think some contrib library defines filter-first

0:51 srid: I find myself using destructing for this a lot. (let [[result1] (filter ...)] ...)

0:51 Arafangion: S11001001: Although bigloo gives me low confidence, I'd trust 'C# generation' more than 'Experimental bytecode generation'.

0:53 Hmm, also, #bigloo is practically empty.

0:53 srid: ok, in actuality it turns out that i don't need filter

0:53 (take-while #(not (seq (select % [:span :a :> text-node]))) (drop-while (comp #{:p} :tag) (select x [#{:h2 :p}])))

0:53 S11001001: a moment ago, you were considering starting your own such project, Arafangion

0:53 srid: that gets all paras after <h2> but stops at the para with a <span><a> link (which is the footer)

0:53 this becomes a chapter in epub

0:54 Arafangion: S11001001: Considering, yes, but I'm not planning on actually using it professionally.

0:54 S11001001: Because the rest of the team would probably move to get me fired. ;)

0:55 S11001001: as I understand, you only are interested in the C part though

0:55 Arafangion: C is one of my targets.

0:55 ObjC and .NET are my primary targets.

0:56 ibdknox: I target awesome.

0:56 *rimshot*

0:56 scb: ibdknox: how ready do you think clojure is for the web? Like in comparisson to other solutions like Django, Rails, Lift, ..., that seem to come with batteries included? I mean I have been using Clojure for a while but I am still not decided whether to pursue working with it on webapps.

0:57 jli: scb: you should probably just do it :)

0:57 brehaut: is there any point specifically targeting objc? doesn't it all come down to c + objcMsgSend anyway

0:57 ibdknox: brehaut: he likely means cocoa :)

0:58 scb: jli: you think?

0:58 ibdknox: scb: yeah, I'd say just try it: http://www.webnoir.org

0:58 Arafangion: There are a lot of nice things provided by Cocoa.

0:58 brehaut: ibdknox: not that you have an oar in the game :P

0:58 ibdknox: not at all!

0:58 :D

0:58 S11001001: I believe the gnustep people put a message-sending thing in guile

0:58 brehaut: scb: clojure's web story is very compelling

0:58 scb: ibdknox: just when i thought that compojure was the way to go...

0:58 brehaut: is it? how so?

0:59 ibdknox: it's beautifully succinct

0:59 brehaut: scb: toot toot http://brehaut.net/blog/2011/ring_introduction

1:00 (does not include any noir stuff; sorry chris)

1:00 ibdknox: !

1:00 * ibdknox shuns brehaut

1:00 brehaut: ibdknox: noir was either very new or not on my radar when i wrote that. its had already gotten way out of control :P

1:01 S11001001: I hope clojure is ready for the web

1:01 ibdknox: brehaut: haha :)

1:01 S11001001: it is

1:01 brehaut: ibdknox: would you believe i cut stuff from that blog?

1:01 ibdknox: lol

1:01 scb: Well, heh, this is arguably the most biased place to ask :)

1:01 ibdknox: it's a great post

1:02 scottj: scb: according to state of clojure survey 62% of clojurians are using it for web dev

1:02 brehaut: scb: i do django for a day job. django is great, but its also very 2005

1:02 ibdknox: thanks

1:02 ibdknox: scb: I've done web dev in all the common languages

1:02 scb: I may be biased, but that's because I know from experience that Clojure is beautiful

1:03 brehaut: scb: in terms of breadth closures web ecosystem is not as complete as python or ruby frinstance, but the tools that are there of a very high quality

1:03 ibdknox: we're missing a solid ORM

1:03 which I started earlier :)

1:03 brehaut: ibdknox: in lets call it a data mapping layer ;)

1:03 s/in//

1:03 lazybot: <brehaut> ibdknox: lets call it a data mappg layer ;)

1:03 ibdknox: yes

1:03 scottj: ibdknox: oh so by database layer do you mean only sql?

1:03 ibdknox: not really an ORM

1:04 brehaut: ibdknox: clojureql is very promising though

1:04 scb: brehaut: was just about to ask that. for example i always check for pre-made stuff for common tasks (like authing, users, stuff that has been made over and over and you just reconfigure, you know)

1:05 ibdknox: scottj: it's hard for me to imagine what a database layer that covers more than SQL would look like

1:05 scottj: maybe I'm misunderstanding though

1:05 brehaut: scb: the ring layer provides a lot of commonality

1:06 scb: however, very few of the tools prescribe particular data 'types'

1:06 scottj: ibdknox: nosql dbs. see clojurize I think it supported sql and mongo or maybe couch

1:07 ibdknox: scottj: the semantics of something like redis are totally different than SQL

1:07 I would use them in entirely different ways

1:08 scottj: http://anvil.io/posts/clojurize-the-data-not-the-database

1:09 ibdknox: that doesn't appear to solve the thing that's annoying to me

1:09 which is managing relations between tables

1:09 Arafangion: Abstracting the database has other advantages, anyway.

1:10 justinus: hi, I need to consume messages from a JMS Queue….. is there any idiomatic clojure code which uses the standard javax.jms interface ?

1:10 srid: what is the alternative for (for [item items]) that doesn't return the values?

1:10 more like loop

1:10 amalloy: doseq

1:14 jli: ibdknox: well-known fact, clojurians are only biased by truth and beauty :)

1:15 ibdknox: jli: truth

1:16 brehaut: jli: it helps that clojure is young enough that most people who are interested in it have come from at least one other language (and its a broad range of other langues)

1:17 Arafangion: And that such people aren't terrified of lisps.

1:19 scb: Well I guess I'll have to check Clojure for the web eventually. the no solid orm point raised by ibdknox is kind of a put off.

1:19 amalloy: scb: it's hard to have a standard orm when your standard is to not have objects

1:20 ibdknox: yeah, sorry I shouldn't have said ORM

1:21 jli: what's an orm? something that takes SQL queries and returns language-native data structures?

1:21 cark: i think functional programming works well with databases

1:21 brehaut: jli:it stands for object/relational mapping

1:21 ibdknox: from object to table back to object

1:21 companion_cube: jli: objects map to some database table row

1:22 ibdknox: the advantage is primarily that it handles relations for you

1:22 cark: instead of thinking in a object/single row fashion, you think in termns of streams of data

1:22 brehaut: ibdknox, jli: via insurmountable impedance mismatch

1:22 ibdknox: yes

1:22 I firmly believe that ORM is an anti-pattern

1:22 relation management isn't

1:22 jli: ibdknox: how does it handle the relations? do you feed it a schema?

1:23 cark: ibdknox: i agree, but then again i might have given up on these before finding the right one

1:23 Arafangion: Yes - I think ORM gives programmers an excuse NOT to separate the layers.

1:24 ibdknox: for those interested: http://seldo.com/weblog/2011/08/11/orm_is_an_antipattern

1:24 jli: yeah simple relation definitions

1:25 cark: this post was severly flammed on /r/programming

1:25 jli: hum, interesting

1:25 scb: ibdknox: what do you use for databases in clojure?

1:25 ibdknox: https://gist.github.com/1257094

1:25 cark: sure

1:25 cark: some points he brings up are true though

1:26 scb: I screwed around with clj-record

1:26 it works, sort of

1:26 clojureql is neat

1:26 but is missing a lot and tries to be like clojure instead of accurately representing what it is

1:26 I used redis a lot

1:26 cark: i'd love to have a clojureql with a more "functional" interface

1:27 brehaut: ibdknox: thats a good summary of the problems with clojureql.

1:27 cark: i use postgres and sqlite

1:27 ibdknox: cark: what would that look like?

1:27 since I'm starting on this..

1:27 lol

1:27 brehaut: ibdknox: also, the ordering of operations matters sometimes and i inevitably get confused by it

1:27 cark: well

1:27 ibdknox: brehaut: yeah. it could be cleaner

1:28 Arafangion: That said, some ORM's are really useful in providing database abstraction.

1:28 In theory, the code does not depend on the database provider.

1:28 cark: what i'm always doing an half-assed implementation to is this : query building

1:28 ibdknox: cark: so something like this gist? https://gist.github.com/1257094

1:28 Arafangion: In practice, I find writing SQL to be simple enough.

1:28 cark: i would love to have a well thought out way to compose parts of queries

1:29 kevinburke: Hey, have a quick question about http-agent. I can't seem to get it to return properly

1:29 I posted most of the details here http://stackoverflow.com/questions/7624686/get-body-of-http-response-in-clojure

1:29 brehaut: Arafangion: the advantage of a layer like clojureql is that it can make your queries composable

1:29 cark: ibdknox: if these are not macros, then yes

1:29 brehaut: Arafangion: e.g. this the select, where, from etc clauses could all come from different functions, and without string bashng

1:29 Arafangion: brehaut: That's pretty cool.

1:30 cark: ibdknox: i don't care about the defentity stuff, i want to make a function that will return a "select object" then use it as part of another select

1:31 ibdknox: or maybe construct the where parts in several functions, then put it all together later

1:31 Arafangion: brehaut: Personally, I think the biggest problem with ORM's is that they try to return instances of dynamically generated *classes*.

1:32 cark: last time i checked, clojureql was documenting a mostly macro oriented , static queries oriented, interface

1:32 brehaut: Arafangion: its the giant awkwardness of expression that grinds my gears

1:32 cark: it was a while back tho

1:32 brehaut: Arafangion: easy things are easy, hard things are maddenning

1:32 ibdknox: cark: that is the intent of what I'm building

1:33 brehaut: cark: they did scrap the entire thing and rebuild from scratch onto of relational algebra

1:33 ibdknox: cark: select is a macro of convenience, but it has a function behind it to do the same thing

1:33 cark: brehaut: ok well i was "away" for a while, i might have to look back into it

1:33 amalloy: ibdknox: do you actually need sql? i've been using mongodb for all my clojure projects and it's been much simpler

1:33 Arafangion: brehaut: I can agree with that, too.

1:33 cark: ibdknox: make sure to document the functional interface as well as the macro interface

1:34 ibdknox: cark: of course :)

1:34 cark: ibdknox: for any serious work you'll want to fall back to it anyways

1:34 ibdknox: amalloy: result of history, not choice

1:34 Arafangion: OO databases are a fad. :(

1:35 cark: i won't start again on the sql vs nosql stuff, siuffice it to say that sql isn't hard at all, and eliminate most book keeping

1:35 ibdknox: cark: both have their uses :)

1:35 cark: the world is big enough for both, yes

1:36 Arafangion: OO databases are a poor reinvention of heirchical databases.

1:36 cark: oo databases aren't a bad concept

1:36 there is none which is both free and good that i know of

1:38 ibdknox: so what's behind the scene of this syntax you showed us on your gist ?

1:38 ibdknox: a map :)

1:38 cark: yes

1:38 ibdknox: https://gist.github.com/1257106

1:40 cark: i think the defentity stuff shoudl be a completely different layer than the query building stuff

1:42 ibdknox: it's not dependent on it

1:42 cark: brehaut: indeed clojureql is nothing like it was oO

1:43 brehaut: cark: I still use raw SQL for inserts because I've found cql a bit quirky with its insert and update fns

1:43 cark: which raises the question, why doesn't it fit ibdknox' needs ?

1:43 brehaut: (in particular returning last index etc)

1:43 cark: brehaut: ah yes

1:44 does clojureql work with different kind of databases ?

1:44 ibdknox: cark: because it doesn't handle relations, and tries to be clever

1:44 cark: like sqlite/mysql/postgres?

1:44 ibdknox: cark: yes

1:45 brehaut: cark: some crappy clojureql code i wrote: https://github.com/brehaut/burningbot/blob/master/src/burningbot/db.clj

1:50 cark: brehaut: i see your ql/where clause in query-logmarks-for-day

1:51 and i'm wondering how i could compose two of these in a single one

1:51 let's say i would have the start-date and end-date part coming from one function

1:51 then the channel part from another function

1:54 brehaut: cark: i stopped when i got it working

1:54 cark: hehe ok

1:54 brehaut: i agree that it should be nicer ;)

1:55 cark: see a common use case for a query builder is for providing a filtering option to your end-user

1:55 brehaut: to be clear, i got the SQL running quickly in the DB, but porting it to clojureql took some time

1:55 cark: so you want to compose those where clauses in a nice way

1:56 brehaut: well that's to be expected for any dsl, should be easier once you know what you're doing

1:57 think about the common lisp loop macro ... takes a while to know much about it, bu once you do it's very powerfull

1:57 ibdknox: cark: eh, I think cql didn't get to the right level of prettiness

1:57 brehaut: yeah, although, part of the promise of clojureql is that if you can write the SQL, its a straight forward mapping because its the same conceptual model

1:57 Arafangion: Then again, you could do an sql->clojure transformation to give you a hint.

1:57 That involves parsing sql, though.

1:58 cark: hehe yes, the whole problem is with the sql language itself, it's horrible for computer generation

1:58 brehaut: and human generation (unless the human is willing to devote their life to typing)

1:59 cark: why couldn't they choose a lisp syntax, it's beyond me !

1:59 brehaut: cark: committee, lisp doesn't have enough syntax to let everyone get their own fillip in

1:59 Arafangion: Perhaps the problem with SQL is that people use too much of it on the client side.

2:00 cark: Arafangion: what do you mean ?

2:00 Arafangion: Rather than defining views, and other convenient routines on the server side.

2:00 brehaut: views are (historically) out for performance reasons on many smaller SQL DB imps

2:01 cark: think again about my use case, providing filtering options to your end-user ...there is no way around building the sql on the client side

2:01 brehaut: a lot of people went to stored procs but thats a different can of horror

2:01 Arafangion: brehaut: Is performance really a primary consideration for smaller SQL DB's?

2:01 brehaut: If it's an issue, surely, the right place to improve that is in the database implementation?

2:02 brehaut: Arafangion: not everyone can afford a MSQL or oracle license

2:02 Arafangion: There are other alternatives.

2:02 cark: postgres is fast enough, and free

2:02 brehaut: yeah postgres is good

2:02 Arafangion: Exactly.

2:02 brehaut: but if you are using mysql (because for whatever reason you can't get or install pg) you were screwed

2:03 Arafangion: I've never had a good opinion for mySQL, though - although I am using sqlite3, but not because I want a "real" database.

2:03 cark: i never had to use mysql ... that's living a happy life isn't it ?

2:03 Arafangion: And yeah, mySql has never been reputable.

2:04 It's probably a good implementation, but how can you trust a database implementation that claims 'ACID is crap', along with other relational database theories... Without justifying it!?"

2:04 I mean, there's arguably good reasons to avoid ACID, but dammit, *justify it*!

2:04 brehaut: Arafangion: if you are just building this months hot new blog engine, does it matter? :P

2:04 Arafangion: brehaut: You could use flat files, even.

2:05 cark: i thought there was a mysql backend which is acid complient ? innodb or some such ?

2:05 Arafangion: brehaut: Does it matter? ;)

2:05 cark: There are, but that's besides the point.

2:05 brehaut: Arafangion: yes, relational querying is much easier than multiple flat files when you want to cross cut your data :P

2:05 Arafangion: brehaut: Frankly, I'd probably use sqlite3. :)

2:06 * Arafangion has lost one of his shoes, and looks for it...

2:06 cark: my current project is serverless application, and i'm using sqlite

2:06 * Arafangion found it, where it was supposed to be - damn it.

2:07 cark: lol

2:07 Arafangion: cark: Yeah, sqlite's pretty impressive for what it is.

2:07 cark: Arafangion: do you know if its query planner is any good

2:07 ?

2:08 Arafangion: cark: I have no idea, to be honest, I only use it for small databases.

2:08 michaelr525: hey

2:08 Arafangion: cark: It's too implicit for my liking for large stuff.

2:09 cark: what other embedded database is there which are a good fit for clojure ?

2:09 Arafangion: (Heck, it can generate tables on-the-fly without a CREATE TABLE)

2:10 cark: sqlite3's pretty much the choice, these days. There are other alternatives, but while sqlite3 exists, there isn't any point.

2:11 cark: that was my conclusion, but you never know, might have missed something =P

2:12 Arafangion: Keep in mind that I've yet to use or learn clojure... But I think this is a fairly language-agnostic discussion.

2:12 cark: well you have to consider the runtime, we're ont he jvm

2:13 Arafangion: Even so.

2:13 Then again, I'm probably too happy with doing native binding, but that said, I'm sure sqlite3's well supported on the jvm.

2:13 I'm off for some crappy "thai".

2:14 cark: have a good meal

2:14 Arafangion: Thanks. It's "thai" because it does'nt have much fish sauce, soy sauce, chilli, herbs, or other spices.

2:14 It's all... westernised.

2:15 cark: yuk =/

2:15 Arafangion: But at least they don't make the sauce gummy, it's otherwise good. (Although they *do* add too much sugar)

2:15 cark: it's 8am here, i'm more looking at some croissants =)

2:15 Arafangion: It's 5:15pm here. :)

3:18 justinus: anybody here used clamq?

3:40 michaelr525: justinus: what's that?

4:04 jli: whoo hoo, I'm in the top 100 on 4clojure

4:19 justinus: https://github.com/sbtourist/clamq

4:20 Blafasel: Is clojure-clr a reality (i.e. usable, at least for exploration and tests) or more of an experiment?

4:22 amalloy: jli: congrats dude. now go sign up for a gravatar! we just added that feature

5:05 Blafasel: amalloy: Any plans to increase the session timeout? I often end up doing real work *cough*, get back, submit something and get the 'please log in to record that' message. The header is still showing my username, so no way to see that I'm logged out before that

5:06 amalloy: Blafasel: it's not actually a session timeout; as far as i know we only break sessions when we deploy a new version

5:06 which we did tonight

5:08 Blafasel: Nope, happened just now.

5:08 amalloy: yep

5:09 it's 2am here; that counts as tonight to me :P

5:09 Blafasel: Oh. Right :)

5:09 Sorry

5:10 amalloy: well, i'm sorry our deploy involves breaking sessions. if you know how to fix that, let us know with a pull request :)

5:11 cark: amalloy: you should have a bit of advertisement on this web site

5:11 amalloy: never

5:11 cark: something not too intrusive would not be any trouble to your users

5:12 this work is usefull and deserve some reward

5:13 amalloy: there are much less annoying ways to generate revenue than ads. eg, if someone designs some t-shirts for us, we can sell them on zazzle

5:13 cark: well then you still need to advertise them on your site, that's the same thing really

5:14 anyways i don't care, that just popped into my head when visiting the site

5:14 amalloy: well, thanks for your interest

5:25 jli: amalloy: yeah, I noticed. are gravatars keyed on email?

5:25 amalloy: jli: yeah. if you've registered, with gravatar.com, the email address you use on 4clojure, you get an image

5:26 they have a nice scheme which enables us to get your image from them without ever sending your email address over a public channel, in case you're worried about that

5:29 jli: amalloy: no, I was just trying to figure out why my gravatar wasn't already showing up.

5:54 thorwil: root-cause is in both clojure.stacktrace and clojure.repl?!

5:54 Blafasel: Huh?

5:55 Looks like I scored _good_ this time in the golf ranking?

6:05 jli: hurray, #70

7:03 Blafasel: Hmm.. :) 183. But makes "work" bearable at least.

7:22 fliebel: How would you write a webmail client in Clojure?

7:23 I see 3 routes. One is to talk over SMTP and IMAP to a server, the other option is to interact with the datastore used by the server, the last is to *be* the server.

7:27 Arafangion: (Not all routes are practical!)

7:30 cark: is there a predicate that will tell is a value is Seqable ?

7:31 ,((supers (type [])) clojure.lang.Seqable)

7:31 clojurebot: clojure.lang.Seqable

7:31 cark: something that does what i just did

7:32 kzar: What would be the Enlive selector for the last script tag inside the head? I've got [:head :> :script (last-of-type)] but it's not working

7:35 cark: ,(sequential? [1 2 3])

7:35 clojurebot: true

7:35 cark: ,(coll? [1 2 3])

7:35 clojurebot: true

7:38 kzar: oh, got it [:head [:script last-of-type]]

7:44 fliebel: Arafangion: Which one are (not) in your opinion?

7:46 kzar: fliebel: I would take the "talk over SMTP and IMAP" option, make an RESTful API that let you do things like send mail and list messages. Then I would make the webmail interface with Javascript

7:46 krl: what is the cleanest way to get a list of a form repeated n times?

7:47 kzar: fliebel: But on the otherhand who am I to decide

7:48 fliebel: kzar: One way to look at it is that HTTP and IMAP are both a V in MVC. Which is how I came to the talk to the datastore option.

7:49 kraft: Like... ##(repeat 3 4) ?

7:49 lazybot: ⇒ (4 4 4)

7:49 fliebel: *krl

7:51 I think writing a custo mail server in Clojure is to painful to even consider.

8:14 Arafangion: fliebel: Bingo.

8:14 fliebel: Actually, the writing of the custom mail server isn't that big a deal.

8:14 fliebel: But running it is.

8:15 fliebel: Arafangion: Why? I imagined the building to be the problem. Esp. IMAP.

8:15 Arafangion: Far from it. :)

8:16 It's the spammers that are - and how the email infrastructure has had to cope with it.

8:22 joelehmann: Hello

8:44 kzar: Is there a way to do a regexp replace of a string, the replace value being a call to a function that takes the matching sub-string?

8:49 dabd: I expected ,(/ 47.8486 100) to return 0.478486

8:49 ,(/ 47,8486 100)

8:49 clojurebot: 47/848600

8:50 dabd: ,(/ 47,8486 100.0)

8:50 clojurebot: 5.538534056092387E-5

8:50 dabd: well the clojurebot returns the result in scientific notation but my repl returns 0.47848599999999997

8:51 why is it that clojure does not return the exact value 0.478486?

8:51 opqdonut: 0.478486 is not representable as a floating point number

8:51 cark: http://download.oracle.com/docs/cd/E19957-01/806-3568/ncg_goldberg.html

8:51 oops

8:51 opqdonut: and btw, you shouldn't use , as the separator

8:52 ,(/ 1,100 10)

8:52 clojurebot: 1/1000

8:52 opqdonut: ,(/ 1 100 10)

8:52 clojurebot: 1/1000

8:52 opqdonut: "," is just whitespace in clojure

8:52 stoneg: hi, how can I ref to a object in clojure (like I want to create a db connection, then do operations using that connection, how can I do this in clojure)?

8:52 cark: stoneg: do you mena a java object ?

8:52 dabd: opqdonut: is there some way I can obtain the exact value?

8:53 cark: ,(/ (rationalize 47.8486) 100)

8:53 clojurebot: 239243/500000

8:53 opqdonut: dabd: depends very much on what you mean by "exact value", but for example clojure's rational numbers are exact

8:53 stoneg: no, I come from oo background, not that familiar with functional way of doing this kind of things.

8:54 dabd: well I just wanted to get 0.478486 not a fraction

8:54 opqdonut: representing and printing a number are quite different

8:54 cark: (let [a (String. "hello")] (.toString a))

8:54 now that's a silly example

8:55 but you have the value a, which is bound to the string object

8:55 and you can work with it

8:55 i'm not quite sure that's what you're saking

8:55 asking*

8:55 Chousuke: stoneg: the standard way is to have your procedures take a db connection object as the argument and work on that

8:56 then you just create a db connection and call your procedures

8:56 stoneg: so you mean it's like first set the connection to a var, and then using it like : (operation conn params) ?

8:56 Chousuke: or just use let

8:57 cark: stoneg : yes juste like in java or c#

8:57 but chousuke's way is the most important

8:57 dabd: opqdonut: but shouldn't this return the true? (= (Float/parseFloat "0.478486") (/ (Float/parseFloat "47.8486") 100))

8:57 opqdonut: no

8:57 wait a sec, I'll give you a link

8:58 stoneg: Chousuke: let is for def local bindings , right?

8:58 cark: dabd: you really need to learn about the pitfalls of floating point arithmetics

8:58 opqdonut: dabd: http://download.oracle.com/docs/cd/E19957-01/806-3568/ncg_goldberg.html

8:58 Chousuke: stoneg: local binding, yes

8:58 opqdonut: oh, cark pasted that above

8:58 stoneg: Chousuke: But a connection acts as a global thing.

8:58 Chousuke: you can also bind the connection to a global dynamic *db* variable that is used in procedures

8:58 cark: stoneg: gloal things are evil

8:58 global*

8:59 dabd: opqdonut: looks heavy I'll read it thx

8:59 opqdonut: ,(= (float 1.0) (* (/ (float 1.0) (float 3.0)) (float 3.0)))

8:59 clojurebot: true

8:59 Chousuke: or you can use some database library :) clojure has a couple

8:59 cark: first you learn to do without globals, then you break the rule when needed

8:59 opqdonut: ,(= (float 1.0) (* (/ (float 1.0) (float 11.0)) (float 11.0)))

8:59 clojurebot: true

8:59 stoneg: cark: Is it ok using curring ?

8:59 opqdonut: hmm, I could've sworn those weren't true

8:59 cark: stoneg: what has currying got to do with that ?

9:00 opqdonut: that's the point, you never know with floating point numbers

9:01 stoneg: cark: sorry, I mean some techniques like using currying to memorize the initialized connection, and do operations against the conn later.

9:01 opqdonut: cark: indeed

9:02 Chousuke: stoneg: what matters is how well you can keep the stateful thing (the connection) separate from the rest of the code

9:02 if the db connection is always an explicit parameter to procedures then it's easier to follow what happens to it

9:02 cark: stoneg: for what it's worth, i'm using clojure.java.jdbc for connections and database interactions, and it is setting a dynamic var up for connections and transactions

9:03 then the actual queries do not require a connection parameter

9:03 as it is in the dynamic scope

9:03 is defined*

9:03 or bound really

9:03 ohwell

9:06 stoneg: cark: http://clojure.org/vars , says Functions defined with defn are stored in Vars, and Vars are global like thing, so is functions evil ?

9:06 cark: http://clojure.org/vars , says Functions defined with defn are stored in Vars, and Vars are global like thing, so are functions evil ?

9:06 cark: so in practice : (sql/with-connection db-settings (sql/transaction (with-query-results rs ["select * from blah"] (do-something rs)))

9:07 stoneg: at some point you need some form of global state

9:07 but you're trolling now =)

9:10 stoneg: cark: In the example, it has many level of nesting, will it affect code readability ?

9:10 cark: sorry couldn't properly indent on irc

9:13 https://gist.github.com/1257440

9:13 there you go, see that's not that bad =P

9:15 stoneg: cark: thanks.

9:15 cark: but for real code, I saw many nestings that that, like : https://github.com/nathanmarz/storm/blob/master/src/clj/zilch/virtual_port.clj

9:16 cark: and this: https://github.com/nathanmarz/storm/blob/master/src/clj/backtype/storm/clojure.clj

9:16 cark: it's not so bad

9:16 you may clean that up a bit by decomposing a bit more

9:17 stoneg: cark: I am learning clojure and reading some real code. But it looks to messy (sorry just the feeling as a new functional guy). :-(

9:17 cark: i'm guessing it's all still very alien to you

9:18 stoneg: cark: yes. kinda of.

9:18 cark: to me it's weirder reading java code =)

9:19 stoneg: cark: Actually, I learned lot of FP languages(haskell, erlang, clojure, scala), but not wrote a lot using it in production and real project.

9:19 cark: i've been using common lisp and clojure almost exclusively for 10 years now

9:20 stoneg: cark: Maybe I need use it more, think in functional style, and read more fp code.

9:20 cark: the good way to learn is start a project

9:20 and suck it up until you're done with it =)

9:20 and ask advice

9:20 stoneg: cark: that's cool. I started fp from 2008. first is erlang.

9:21 cark: Thanks! very good advice.

12:08 srid: how do I refer java static methods as first class object? this doesn't work: ((comp Integer/valueOf trim) "12 ")

12:09 TimMc: srid: memfn is the old way, but #() is the current idiom

12:09 srid: so this code can't be improved to use comp instead of #() http://stackoverflow.com/questions/7623633/how-do-i-convert-a-string-into-two-integers-in-clojure/7624355#7624355

12:09 TimMc: Integer/valueOf becomes #(Integer/valueOf %)

12:10 Right, there's not much you can do.

13:14 mister_roboto: ,(seq? [:x])

13:14 clojurebot: false

13:14 mister_roboto: ,(seq? '(:x))

13:14 clojurebot: true

13:15 mister_roboto: I thought from reading the docs that a vector is an ISeq. Can someone tell me what I'm not understanding ? Why does the first return false?

13:16 ,(coll? [:x])

13:16 clojurebot: true

13:21 TimMc: mister_roboto: All the collection types as well as seqs are coll? -> true.

13:22 Vectors are seqable: ##(seq [1 2 3])

13:22 lazybot: ⇒ (1 2 3)

13:23 TimMc: and the reason (seq? '(:x)) is true is that lists are implemented as seqs

13:23 mister_roboto: TimMc: but why does (seq [:x]) for example return false? vectors are not seqs i guess?

13:24 just seqable?

13:24 TimMc: right

13:24 mister_roboto: ok thx

13:24 TimMc: "seqable" is a confusing topic, though

13:24 ,(seq? "foo")

13:24 clojurebot: false

13:24 TimMc: ,(seq "foo")

13:24 clojurebot: (\f \o \o)

13:26 TimMc: ,(seqable? "foo")

13:26 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: seqable? in this context, compiling:(NO_SOURCE_PATH:0)>

13:27 TimMc: ,(use 'clojure.contrib.core)

13:27 clojurebot: #<RuntimeException java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate clojure/contrib/core__init.class or clojure/contrib/core.clj on classpath: >

13:27 TimMc: ,(use 'clojure.contrib)

13:27 clojurebot: #<RuntimeException java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate clojure/contrib__init.class or clojure/contrib.clj on classpath: >

13:27 TimMc: bah

13:27 mister_roboto: TimMc: is it safe to say that you should use (coll?) to determine if you have a seqable thing? and not seq?

13:27 TimMc: &(clojure.contrib.core/seqable? "foo")

13:27 lazybot: ⇒ true

13:27 TimMc: Use seq: (if (seq foo) ... ...)

13:28 Or even better, (if-let [sfoo (seq foo)] ... ...)

13:28 mister_roboto: TimMc: why not just (coll? foo) is there a downsie?

13:28 if i just want to test it, that is

13:29 TimMc: Usually you want to *do* something with it.

13:29 mister_roboto: ,(coll? '(:x))

13:29 clojurebot: true

13:29 mister_roboto: ,(coll? [:x])

13:29 clojurebot: true

13:29 TimMc: If you want to test... well, I'd have to go back and look at the intricacies of seq, seqable, coll?, seq? and ISeq

13:30 ,(if (seq 5) 'seq 'not-seq)

13:30 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>

13:30 mister_roboto: TimMc: sure. np. i need to read up more

13:30 TimMc: Right, so seq blows up on non-seqables.

13:30 One of the Clojure experts needs to write a blog post explaining this once and for all. (Or maybe there is a book chapter?)

13:33 ,(seqable? nil)

13:33 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: seqable? in this context, compiling:(NO_SOURCE_PATH:0)>

13:33 TimMc: &(clojure.contrib.core/seqable? nil)

13:33 lazybot: ⇒ true

13:56 dabd: why there is not function to extract a subsequence between two elements. afaik there is only subvec for vectors but there is nothing for lists

13:56 dnolen: huzzah match uses efficient backtracking except in the presence of recur (still efficient in time, just possibly more code for certains kinds of patterns)

13:58 dabd: of course it is trivial to implement with drop/take

13:59 dnolen: dabd: because subvec has a constant time guarantee

13:59 ,(doc subvec)

13:59 clojurebot: "([v start] [v start end]); Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive). If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done."

14:00 dabd: dnolen: yes but sometimes you are working with vectors but when you use a seq function it becomes a list

14:00 Blkt: good evening everyone

14:01 jeremyheiler: Blkt: good afternoon :-)

14:01 Blkt: :)

14:01 dabd: for example ,(map identity [1 2 3]) transforms the vector into a list

14:02 then you cannot use subvec unless you turn it into a vector with into []. Does 'into' run in constant time or O(n)?

14:03 dnolen: dabd: if you want to keep working w/ vectors put it back into vector. O(n)

14:03 dabd: Then this is somewhat cumbersome

14:03 dnolen: dabd: not saying that the functionality you're talking about is not useful, but it shouldn't be called subvec

14:03 dabd: But why clojure changes the types of objects like this

14:04 It goes against the referential transparency of functional languages imho

14:04 dnolen: dabd: it doesn't change types, the map is lazy.

14:04 dabd: but map turns the vector into a list

14:05 dnolen: dabd: not a list, a lazy sequence.

14:05 dabd: but a lazy sequence is not a vector

14:06 so i guess the original type changed

14:06 dnolen: dabd: consider why map has to be lazy - Clojure doesn't have TCO

14:07 pbiggar: hi folks, quick question: from within noir/defpage, how can I get access to a user's session id?

14:07 glob157: seven programming languages in seven weeks is the best book on clojure ive read (im new) ... do you guys agree ?

14:08 \

14:08 dabd: well at least a map-vec would be useful to avoid the O(n) into [] every time you use map on a vector and need a vector afterwards

14:08 dnolen: dabd: if map wasn't lazy, you would still need to construct the new vector - O(n)

14:08 if you wrote a loop/recur that updated vector in place, stlll O(n)

14:09 dabd: so you either want subvec, or you want something new for sequences that does something similar which doesn't have O(1) guarantee

14:10 dabd: dnolen: but if the mapping function preserved the type you would traverse the structure once not twice, once for the 'map' and another one for 'into'

14:10 dnolen: dabd: *lazy* sequences

14:10 dabd: there is only one traversal.

14:12 dabd: dnolen: ok thx

14:13 zerokarmaleft: glob157: i haven't read that book, but i imagine the coverage is pretty light

14:14 chouser: dnolen: in the abstract, backtracking is sometimes less fast, right?

14:14 zerokarmaleft: glob157: Joy of Clojure is great if you're looking to go deeper

14:15 dnolen: chouser: a backtrack is equal to longjmp, I haven't seen any discernible performance difference. And for complex pattern, there's a massive performance gain, since JVM refuses to inlining magic on large methods.

14:15 chouser: dnolen: very interesting!

14:16 I assumed backtracking would mean checking the same input element multiple times. Hard to see how that's not slower.

14:18 dnolen: chouser: the algorithm groups as many patterns as possible for testing them together.

14:18 [1 2 3] [1 3 4] [1 & r] grouped together for testing, if that fails, we backtrack like to something completely different.

14:19 chouser: so tries to fail fast on each group

14:19 dnolen: chouser: it's tougher with guards (arbitrary tests), where grouping is less clear. I need to work that out still.

14:19 clojurebot: Ok.

14:20 dnolen: but mostly likely guards will involve retesting a element.

14:21 chouser: sounds great. We've got a project at work that I think might benefit a lot from match. Hoping to try it this week or next.

14:23 dnolen: chouser: cool! would love to hear your input. There's still a lot of details left, but I think the big picture stuff is falling into place.

14:24 TimMc: Shouldn't (vec (seq some-vector)) be O(1)?

14:25 I would assume that vec could peek at the seq's implementation and see that it is backed by a vec.

14:26 Chousuke: I don't think that's really an issua :/

14:26 how often will you seq a vector and then immediately make it a vector again?

14:26 chouser: TimMc: it potentially could be, and I wouldn't be shocked if someday Clojure has that kind of thing built in. But not today.

14:27 TimMc: Chousuke: I'll get back to you on that. :-)

14:27 chouser: Hm, actually, maybe Chousuke's right.

14:27 I was thinking it might happen across different function-call boundaries.

14:28 Chousuke: yes, it might happen, but I don't think it's very likely

14:28 chouser: but to happen would require something to call seq (but nothing else -- not map, take, drop, anything) and return that.

14:28 TimMc: hmm

14:28 chouser: maybe (drop-while odd? [2 3 4])

14:29 TimMc: Would it be bad for (drop (seq some-vector)) to maintain the backing vector?

14:29 Chousuke: maybe clojure will some day have lazyvectors :P

14:30 TimMc: I guess the feasabiity would depend on how much the implementing seq is asked to do.

14:30 Chousuke: so when you do (vecmap foo somevector) you get back a vector instantly but the calculation only happens when you index the vector

14:30 chouser: TimMc: what if the first element in the vector is a really large object that you're specifically trying to GC?

14:30 gtrak``: didn't it have lazy vecs at some point? or a placeholder at least?

14:30 TimMc: Right, that's what I'm worried about.

14:30 chouser: today you could say (vec (next the-vec))

14:31 TimMc: Whereas subvec would not allow GC of out-of-range portions of the backing vec.

14:31 chouser: gtrak``: no, it had a thing that would act like a vector while holding a backing array, and then if you used assoc or conj it would then create a real vector.

14:31 not really lazy in the lazy-seq sense.

14:32 gtrak``: ah

14:32 TimMc: It would be cute if a vector could know just how much of itself was accessible and could wipe the out-of-range portions.

14:33 I guess then you'd be getting into the GC business.

14:35 dnolen: pushing match-0.2.0-alpha1 out the door

15:02 kencausey: dnolen: yay!

15:43 Bronsa: dnolen: wouldn't it be better if clojure.core.match.core was clojure.core.match?

15:43 dnolen: Bronsa: hmm not a bad idea

15:44 Bronsa: i find it annoying to write core twice in a ns

15:45 anyway, i'd like to thank you for your excellent work :)

15:55 ibdknox: +1 for removing the extra core :)

15:59 * dnolen is a couple steps away from real ClojureScript support

16:02 ibdknox: dnolen: awesome! :D

16:07 srid: has anyone used core.match with enlive?

16:15 (first (.getBytes "’")) returns -43. to convert that to a byte, I do this: (apply str (reverse (take 8 (reverse (Integer/toBinaryString -43)))))

16:15 is that too much?

16:18 TimMc: What does that get you?

16:19 raek_: srid: you want it in binary form?

16:19 srid: that gets me "11010101"

16:19 i'm playing with char encoding conversions in clojure/java

16:20 enlive has a bug where it always reads a URL as utf-8

16:20 but a webpage is encoded in ISO/IEC 8859-2

16:20 S11001001: getBytes takes an encoding arg, and String has a bytes[], encoding constructor

16:20 raek_: ,(Byte/toString -43 2)

16:20 clojurebot: #<CompilerException java.lang.IllegalArgumentException: No matching method: toString, compiling:(NO_SOURCE_PATH:0)>

16:20 raek_: ,(Byte/toString (byte -43) (int 2))

16:20 clojurebot: #<CompilerException java.lang.IllegalArgumentException: No matching method: toString, compiling:(NO_SOURCE_PATH:0)>

16:21 duck1123: toString only takse 1 param according to the javadoc I'm looking at

16:21 S11001001: ,(String. (byte-array [-43]) "ISO-8859-2")

16:21 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Byte>

16:21 raek_: srid: aren't URLs always suposed to be in UTF-8?

16:21 S11001001: cute

16:21 srid: S11001001: ok, am I right in thinking that the java String also 'remembers' the original encoding of the string?

16:21 S11001001: srid: no.

16:21 srid: IOW, is the constant inside the form, and the value returned by it different? (String. (.getBytes "’" "UTF-8") "UTF-8")

16:21 S11001001: a string is an array of codepoints, encoded in UTF-16

16:22 (not the same as ucs2, by the way)

16:22 duck1123: ,(Byte/parseByte "-43")

16:22 clojurebot: -43

16:22 raek_: ,(Integer/toBinaryString -43)

16:22 clojurebot: "11111111111111111111111111010101"

16:22 S11001001: so some codepoints actually take two chars

16:22 maybe 3, I forget

16:22 srid: raek_: i was referring the page content, not page url

16:22 raek_: ,(subs (Integer/toBinaryString -43) 24 32)

16:22 clojurebot: "11010101"

16:23 S11001001: ,42b

16:23 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: Invalid number: 42b>

16:23 S11001001: haven't used 1.3 enough yet

16:23 raek_: srid: enlive uses some "magic" to recognize the coding of the page. I think you can give it a reader with the correct encoding specified manually

16:24 ,11010101r2

16:24 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: Invalid number: 11010101r2>

16:24 raek_: ,2r11010101

16:24 clojurebot: 213

16:24 S11001001: ,(String. (to-array Byte/TYPE [-43]) "ISO-8859-2")

16:24 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$to-array>

16:24 srid: ,(seq (.getBytes "’" "UTF-16"))

16:24 clojurebot: (-2 -1 32 25)

16:24 srid: (seq (.getBytes "’" "ISO 8859-2"))

16:25 S11001001: missed a hyphen and a comma

16:25 srid: (seq (.getBytes "’" "ISO-8859-2"))

16:25 works for me in repl. what comma?

16:25 it returns (63)

16:25 S11001001: ,(seq (.getBytes "’" "ISO-8859-2"))

16:25 clojurebot: (63)

16:25 srid: oh

16:25 kij: ,(clojure-version)

16:25 clojurebot: "1.3.0-master-SNAPSHOT"

16:25 raek_: ,(seq "åäö")

16:25 clojurebot: (\å \ä \ö)

16:26 S11001001: uri, incidentally, doesn't proscribe your charset choices

16:26 though even at the character it must be aware of the encoding you intend to use so it can urlencode/decode correctly

16:26 s,character,character level,

16:27 srid: so how do I read a file encoded in "ISO-8859-2" into a string that uses utf-8/16 codepoints??

16:27 lazybot: srid: Definitely not.

16:27 srid: i didn't enter the second ?

16:27 raek_: srid: ideally, a string is not in any coding

16:27 S11001001: srid: clojure.java.io/reader lets you specify the input encoding

16:27 TimMc: srid: InputReader or somesuch allows an encoding

16:27 raek_: it is just a sequence of characters

16:28 in java/clojure, this is true for characters in the Basic Multilingual Plane (code points below 65536)

16:28 srid: https://github.com/cgrand/enlive/blob/master/src/net/cgrand/enlive_html.clj#L36 is hardcoding utf-8

16:29 S11001001: yeah, people tend to do that

16:29 srid: i need to pass a stream that is encoded in utf8, not some other encoding

16:29 raek_: srid: where you write the filename, you should be able to pass something like (io/reader "filename" :encoding "ISO-8859-2")

16:30 srid: ok, this is how I am using enlive's html-resource: (html-resource (InputStreamReader. (FileInputStream. url) "ISO-8859-2"))

16:30 but that doesn't help at all.

16:31 does InputStreamReader "decode" the url content and stream a sequence of characters to html-resource?

16:31 raek_: yes

16:31 InputStream = bytes

16:31 Readerr = chars

16:31 S11001001: do you mean the %things?

16:32 raek_: InputStreamReader = bridge between the two

16:32 srid: your row should be equivalent to (html-resource (io/reader (io/as-file url) :encoding "ISO-8859-2")

16:33 but since the argument is called "url", I'm gettings suspicious that it's actually not a filename but a url... :-)

16:33 srid: its file:// url for now

16:34 html-resources returns a map that contains strings. when I copy paste the subset of that string in to repl, i see the .getBytes on that character returns -43

16:34 raek_: you might need to pass it as (io/reader (io/as-url url) ...) then

16:34 srid: which means, .getBytes somehow "knows" that it is supposed to return bytes encoded in "ISO-8859-2"

16:34 raek_: srid: what did you pass as the encoding argument to .getBytes?

16:35 srid: nothing

16:35 raek_: if you did not pass any encoding argument, it guesses

16:35 and defaults to whatever is the "default encoding" of your platform

16:35 srid: why should it guess at all when getBytes is passed a string (character stream) as opposed to bytes?

16:35 raek_: you should never use this "default encoding"

16:35 srid: default encoding is certainly not "ISO-8859-2" which is the file's encoding

16:36 raek_: imho, that method (without the encoding parameter) is broken and should be deprecated

16:36 srid: to see what characters are in a string, use 'seq' to look at them individually, or (map int ...) to see their codepoints

16:36 srid: (System/getProperty "file.encoding") returns "MacRoman", btw

16:37 raek_: in this case, no encoding of the string is done. all you see is the characters.

16:37 ,(map int "abcåäö")

16:37 clojurebot: (97 98 99 229 228 ...)

16:38 raek_: ,(.getBytes "abcåäö" "UTF-8")

16:38 clojurebot: #<byte[] [B@9f2146>

16:38 raek_: ,(seq (.getBytes "abcåäö" "UTF-8"))

16:38 clojurebot: (97 98 99 -61 -91 ...)

16:38 srid: ,(map int "’")

16:38 clojurebot: (8217)

16:39 srid: i'll write a simple program with data file to reproduce my problem.

16:43 how do I find the default encoding used by InputStreamReader?

16:43 (System/getProperty "file.encoding"). yup. MacRoman is it. and it is screwing up files that are utf8 encoded as well

16:46 ibdknox: Noir 1.2.0 is out :D

16:46 https://github.com/ibdknox/noir/blob/master/history.md

16:48 cgroza: I see you have a pretty big community...

16:49 clojurebot:

16:49 clojurebot: #<ClassCastException java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;>

16:56 dnolen: wow throw is cheap in JS if you don't construct an error

16:58 ibdknox: Help me get the word out about Clojure web stuff and comment/vote: http://news.ycombinator.com/item?id=3063973 :)

16:58 dnolen: done

16:58 brehaut: done

16:59 ibdknox: Thanks gentlemen :)

17:00 dnolen: releasing core.match 0.2.0-alpha2, ClojureScript support in

17:01 brehaut: dnolen: excellent :)

17:02 ibdknox: Happy release day haha

17:10 having a server agnostic framework is pretty damn cool

17:10 here's noir running on aleph (and thus Netty)

17:10 https://gist.github.com/1257857

17:17 wink: cool. upvoted :)

17:21 ibdknox: now time to work on korma

17:25 brehaut: dnolen: would i be right in assuming that predicate dispatch would make a url routing library (eg moustache) trivial to write?

17:27 dnolen: brehaut: probably haven't really dug into that use case.

17:33 brehaut: ibdknox: re your common on the HN thread, has noir overtaken compojure for community activity?

17:34 s/common/comment/

17:34 lazybot: <brehaut> ibdknox: re your comment on the HN thread, has noir overtaken compojure for community activity?

17:34 brehaut: amalloy: how can i get added to the regexp exclusion list for lazybot?

17:34 amalloy: brehaut: ask me or Raynes nicely; there's no user-facing way atm. i'll make it so

17:35 Raynes: amalloy: Call it the whiner-list.

17:35 So that we can be polite and snarky at the same time.

17:35 amalloy: good call

17:36 $login

17:36 lazybot: You've been logged in.

17:36 amalloy: $reload

17:36 lazybot: Reloaded successfully.

17:36 amalloy: $logout

17:36 lazybot: You've been logged out.

17:36 amalloy: brehaut: fire away

17:36 brehaut: foobar

17:36 s/foo/baz/

17:36 ibdknox: brehaut: I think they're about equal, I've been getting messages a tad bit more frequently on the noir group than compojure lately, but I don't think there's a clear winner

17:36 brehaut: awesome, thanks

17:37 amalloy: wait, now i'm confused. should i spam the noir group to make it more popular than compojure, or because i want to annoy people reading it?

17:38 * ibdknox readys the ban hammer :D

17:38 ibdknox: readies*

17:47 amalloy: ibdknox: accidentally ban yourself from #clojure?

17:47 brehaut: dropped the ban hammer on his foot

17:47 ibdknox: amalloy: got a little overzealous with the hammer ;)

17:48 or I forgot to plug my computer in... turns out it *will* shutoff if you don't

17:49 brehaut: ibdknox: #2 on the HN front page

17:50 ibdknox: I was #1 until just a couple minutes ago

17:50 :)

17:50 brehaut: sorry to be the bearer of bad news then

17:50 ibdknox: More exposure for Clojure! :D

17:50 wow

17:50 I hate the way that sounds

17:50 brehaut: ha

17:58 Twey: Expojure

17:58 That's going to be a library at some point…

17:59 ibdknox: I think leiningen actually prevents you from creating projects that are *jure

17:59 :D

17:59 TimMc: yep

17:59 I think I approve of that.

18:00 Zolrath: ibdknox: There's something wrong with the pinot on clojars methinks

18:00 ibdknox: oh?

18:00 Zolrath: whenever I try to compile with it it tells me that pinot.dom was never provided

18:00 Twey: Nice.

18:00 So how did Compojure happen? :þ

18:00 TimMc: Grandfathered in.

18:00 Zolrath: but I downloaded the source and compiled it myself earlier and if I use that copy it works

18:00 ibdknox: Zolrath: yes it is screwed up

18:00 Twey: Haha.

18:01 TimMc: http://clojars.org/jrill <- I'm ashamed to admit that I'm responsible for this name

18:01 ibdknox: haha

18:01 TimMc: It was a throwaway joke when someone asked for a name, but no one else had any suggestions..

18:01 ibdknox: tsk tsk :p

18:02 I can't say much, I just keep picking food names

18:02 Twey: Pinot is food now?

18:02 TimMc: I'm going to start using species names.

18:02 (and variants on them)

18:03 ibdknox: Zolrath: should be fixed

18:03 TimMc: I picked "chelydra" (snapping turtle) for a personal bookmarking site.

18:03 ibdknox: Twey: Pinot noir

18:03 Twey: Yes

18:03 Drink ≠ food

18:03 Food substitute, sometimes, but not food :þ

18:03 ibdknox: lol

18:04 Twey: http://en.wikipedia.org/wiki/Food

18:04 incorrect ;)

18:04 the internets says so

18:05 Twey: Haha.Haha

18:06 wink: ibdknox: some caveat? I just noticed, maybe it's documented or intended, but I forgot to do a models.clj (like in noir_blog) but :require'ing the models and the result (FileNotFoundException for resources\public (Access Denied)) left me very clueless

18:07 ibdknox: wink: hm? those two things don't sound related

18:07 wink: the resources/public issues is usually the result of not having any routes defined

18:07 I should fix that in compojure

18:07 amalloy: TimMc: jrill? i don't get it

18:07 TimMc: drill

18:07 It's an XPath wrapper.

18:08 Breaking out of the standard s->j transform.

18:08 wink: ibdknox: basically the same code you looked at yesterday, just with another :require to a file in the models namespace

18:09 then I put a models.clj next to server.clj with just (ns x.models (:require [x.models.y :as y])) and it worked

18:09 ibdknox: hm

18:09 that shouldn't be necessary

18:13 wink: what you just described would be an issue at the Clojure level, I don't do any special stuff with require. If you come up with a small repro for it, I'll gladly look into it

18:13 wink: ibdknox: yup, trying just now

18:22 ibdknox: woah, what happened ther?

18:22 there*

18:24 TimMc: Netsplit?

18:25 Zolrath: ibdknox: the pinot snapshot it pulls still gives the same pinot.dom error

18:25 ibdknox: Zolrath: did you remove the cached copy in ~/.m2/

18:25 ?

18:25 Zolrath: it only checks for updates once a day

18:25 Zolrath: yeah

18:25 ibdknox: hm

18:25 ok

18:26 Zolrath: which version of pinot?

18:27 Zolrath: Downloading: pinot/pinot/0.1.0-SNAPSHOT/pinot-0.1.0-20110809.143608-17.jar from clojars

18:27 ibdknox: you need 0.1.1

18:27 Zolrath: fixing readme now

18:28 Zolrath: Ah, thanks

18:28 0.1.1, no snapshot?

18:28 ibdknox: Zolrath: sorry, 0.1.1-SNAPSHOT

18:29 Zolrath: And all is well again, working great.

18:54 wink: ibdknox: gah, ofc it was just me bein stupid, there was a ] missing after the last require. But why creating the models.cls with that missing import inside it fixed it instead of still erroring out due to syntax error.. no clue

18:55 ibdknox: lol

18:55 wink: those sorts of errors are really, really finicky

18:55 wink: on the plus side, I've read the noir_blog source from top to bottom now

18:56 ibdknox: hehe

21:30 brehaut: just watched brenton ashworth's browser repl intro video (http://vimeo.com/29535884) thats fantastic stuff

21:43 sjl: Is Marginalia supposed to pick up docstrings and comments inside functions?

21:47 amalloy: docstrings inside functions?

21:47 sjl: amalloy: yep

21:48 amalloy: ...what would that look like?

21:48 sjl: amalloy: looks like it's not just me being dumb for a change :) https://github.com/fogus/marginalia/issues/57

21:49 amalloy: like this: http://fogus.me/fun/marginalia/ for this: https://github.com/fogus/marginalia/blob/master/src/marginalia/core.clj#L92

21:52 amalloy: i would just describe those as docstrings. docstrings inside functions sound like they must be something else. but anyway, sounds like a bug; go fix it! :)

21:54 sjl: amalloy: ahh, heh, "... pick up (docstrings) and (comments inside functions)"

21:54 stupid english language

22:15 scottj: reading a cljs article says using namespace name as function or param name is a problem. if your ns is foo.bar.tar what can't you use, foo or tar?

22:16 amalloy: scottj: tar, i think

22:16 er, maybe not. i have no experience, don't listen to me

22:17 ask Raynes, in fact

22:18 Raynes: scottj: I don't know exactly how it works, but I had a project called 'portal' and my namespaces were 'portal.foo', wherein I had a 'portal' function that made the word explode.

22:18 Therefore, I say that amalloy is likely incorrect here.

23:12 dzderic: is there any way I can run a compojure from a shared hosting account with only JSP enabled?

23:13 sorry if it's a stupid question but I know nothing about JSP

23:14 brehaut: dzderic: im going to be guessing here, but i believe that JSP is ontop of / compiles to servlets. Servlets is the most basic requirement you need to host a ring based app (which a compojure site is)

23:14 JSPs themselves dont really feature in the clojure web stack

23:15 dzderic: I know that much, it's just that I'm doing work for a client and it must be hosted on their shared hosting account

23:15 I found a script which starts swank (here: http://paste.lisp.org/display/71209), but I'm not sure if I can do something similar to run the actual webapp

23:15 ibdknox: there's a good chance that they will have locked down a bunch of stuff

23:17 dzderic: can you upload a war to it?

23:17 clojurebot: Cool story bro.

23:17 ibdknox: clojurebot: shutup

23:17 clojurebot: Huh?

23:17 ibdknox: clojurebot: smack

23:17 clojurebot: It's greek to me.

23:17 ibdknox: hm

23:17 amalloy: ~botsmack

23:17 clojurebot: Owww!

23:17 dzderic: ibdknox: I'm not sure because the account hasn't been set up yet

23:17 ibdknox: ah

23:17 dzderic: ibdknox: how does this sort of thing normally work?

23:18 ibdknox: which sort of thing? hosting a clojure website?

23:18 dzderic: JSP

23:18 I've used compojure with jetty and tomcat

23:18 ibdknox: I have no idea, I stayed as far away from JSP as I possibly could

23:19 dzderic: fair enough

23:19 I'll ask the hosting company

23:20 mrh0057: If you want to do hosting on the JVM you probably want to have a vertical dedicated server.

23:20 dzderic: unfortunately the client wants it done on their shared hosting

23:21 if I can't get compojure working, I guess I'll have to go with (shudder) PHP

23:21 brehaut: wee bit of a step down there

23:21 mrh0057: There can be problems that can cause the container to crash then you have to wait for the hosting company to reset it.

23:21 dzderic: :S that doesn't sound pleasant

23:21 ibdknox: in general, shared hosting is scary with something as memory intensive as java

23:22 gtrak``: dzderic, if they have a servlet hosting, you can most likely aot-compile stuff and build a WAR

23:22 * brehaut <3 his prgmr instance

23:22 dzderic: I just sent them an email asking if I can just upload a war (I really hope the answer is yes :)

23:22 amalloy: brehaut: linode ftw

23:23 dzderic: brehaut: good luck finding something as good in australia

23:23 brehaut: dzderic: im in new zealand

23:23 gtrak``: i mess around with virpus, it's hella cheap

23:23 dzderic: then have fun with the latency

23:23 gtrak``: 512MB at $4/month

23:24 brehaut: the entire internet has latency for me, and this way the majority of the visitors to my site dont experience any :P

23:24 mrh0057: dzderic: The most import thing is being able to restart the container yourself.

23:24 brehaut: gtrak``: thats cheap

23:24 gtrak``: hells yea it is

23:24 amalloy: brehaut: maybe he means disk space. only 640k of RAM

23:24 brehaut: amalloy: i looked at linode, i understand that its better than prgmr (faster io in particular) but its not as cheap

23:24 ibdknox: lol

23:24 dzderic: gtrak11: but does it work?

23:24 gtrak``: I wouldn't use it for anything serious, but I use it for a personal site

23:24 dzderic, sure

23:25 i think like 40GB of disk and you have root access

23:25 dzderic: mrh0057: I'll ask and see how much access I can get

23:25 mrh0057: dzderic: If you deploy multiple time in tomcat, the jvm can run out of permspace.

23:25 brehaut: amalloy: 640k should be enough for anyone

23:25 amalloy: brehaut: yeah, linode is charging a premium. mostly for reliability and customer service, i thought

23:25 brehaut: amalloy: im sure; prgmr is bare bones. although their customer service has been completely adequate for my needs

23:25 gtrak``: like i said... if you just want to mess around with something virpus is totally cheap, or heroku if you don't care about disk

23:26 amalloy: my linode is almost a year old now. crashed once, brief network outages maybe three times

23:26 brehaut: amalloy: thats about the same as my prgmr

23:26 amalloy: and it's hosting lazybot, 4clojure, tryclojure, and a few personal websites without breaking a sweat

23:26 ibdknox: I've only had one issue on EC2

23:26 brehaut: nice. mines only hosting my site and burningbot

23:27 amalloy: brehaut: what is this "burningbot"?

23:27 brehaut: amalloy: i pay about $9/mo for 512mb ram, 12gig of disk

23:27 amalloy: its an irc bot for the burning wheel rpg channel on a different server

23:27 amalloy: built on raynes irclj

23:28 ibdknox: I was surprised how easy it was to build and IRC bot from scratch

23:28 brehaut: likewise

23:28 ibdknox: an*

23:28 amalloy: we have 1.5gb ram, 60gb disk. $60/mo but who cares, right

23:28 brehaut: (at least if you leave the arrows out of it ;)

23:28 ibdknox: the protocol is stupid simple

23:28 Raynes: ibdknox: Mostly just stupid.

23:29 brehaut: Raynes: lol

23:29 ibdknox: Raynes: haha, true

23:29 gtrak``: if i'm expecting to make money off of something, obviously i'll pay more than $4 a month :-)

23:29 Raynes: A million and one edge cases.

23:29 brehaut: gtrak``: likewise :)

23:29 Raynes: whats with you trying to implement libs for shitty protocols? irc, xmlrpc

23:30 Raynes: Just wanted 'em.

23:30 brehaut: Raynes: for your own sake, dont try to write a soap lib

23:30 Raynes: Luckily, somebody else write an xmlrpc lib that deprecated mine.

23:30 brehaut: so not a masochist then

23:30 haha what a tool

23:31 (him, not you)

23:32 Raynes: ironically when i search for clojure xmlrpc your lib is ranked higher by google

23:33 Raynes: That's because he opted for a clever name while I recognize that the inherent boringness of the protocol isn't worthy of a clever name.

23:33 * brehaut worries he used 'ironically' incorrectly

23:33 jli: oh noes, 4clojure problems?

23:34 getting "502 Bad Gateway". amalloy: friendly ping :)

23:34 amalloy: jli: yeah, thanks. i actually had noticed already, but usually i don't

23:35 Raynes: brehaut: I am a masochist.

23:35 brehaut: I do not, under any circumstances, know any Python. That said, I've spent the last 4 hours writing a sublime text 2 plugin for Clojure (it supports highlighting, but I'm adding fun stuff like evaluation).

23:35 amalloy: we have several components that probably consume memory without bound. would love to see some of those replaced :P. anyway jli, back up

23:36 brehaut: Raynes: huh? whats hard about python?

23:36 Raynes: Nothing. The problem is that sublime text's API is utter undocumented.

23:36 jli: brehaut: you have to remember to type "return" at the end of all your functions

23:36 Raynes: utterly*

23:37 jli: amalloy: woot, thanks

23:37 brehaut: jli: i have to remember to put the paren after the first identifier :P

23:37 amalloy: brehaut: i don't think he said it was hard. he just said he didn't know any

23:37 i think remembering return is trickier

23:38 technomancy: explicit return is such a goof

23:38 brehaut: Raynes: that sounds like most python except for some of django

23:38 technomancy: newbie mistake among language designers

23:38 brehaut: technomancy: not as much of a goof as non anon functions

23:38 ibdknox: hashmaps in JS are what always screw me up, stupid trailing colon

23:38 brehaut: s/non/no/

23:39 jli: amalloy: I seriously blow between 30 seconds to 10 minutes on that every time I do anything in python, because I've forgotten it by the time I have to write python again

23:39 amalloy: technomancy: more important feature for imperative language, right?

23:39 brehaut: technomancy: and mutable iterators.

23:39 technomancy: brehaut: I dunno; explicit return is usually caused by a statement/value distinction

23:39 which really betrays a lack of exposure to good languages

23:40 jli: ibdknox: trailing colon, hmm? you mean trailing commas?

23:40 ibdknox: {mykey: "hey"}

23:40 instead of {:mykey "hey"}

23:40 amalloy: jli: {foo: 1} vs {:foo 1}

23:40 technomancy: it's actually more work to introduce a statement/value distinction

23:40 you have to actively screw it up

23:40 jli: oh, haha

23:41 technomancy: lack of λ is a simple omission

23:41 brehaut: technomancy: i'll give you that, but the iterators are still busted

23:42 technomancy: brehaut: sure... I haven't actually used iterators.

23:42 ibdknox: there are a number of things busted in python, ever try to make a decorator that takes a parameter?

23:42 lol

23:42 jli: seems like people are done with messing up scoping

23:42 brehaut: ibdknox: hahaha

23:42 jli: oh, except for js :(:(:(:(:(

23:44 brehaut: technomancy: to get a value out of the iterator you have to call next, theres no current value, and the iterator throws an exception to indicate that its done. your fine if you can use a comprehension, for… or itertools, but you are hosed otherwise.

23:44 its a perfect storm of bad mutation

23:45 technomancy: brehaut: people actually do this?

23:45 napping: sounds like Java Iterators

23:46 brehaut: technomancy: yes :(

23:48 jli: truly excellent: http://countercomplex.blogspot.com/2011/10/algorithmic-symphonies-from-one-line-of.html

23:48 * brehaut wonders why so many people are so keen for a reimplemention of rails in clj; surely we can do things better in 2011 than they were in 2004.

23:49 ibdknox: brehaut: they want the lowest possible barrier to entry. For many rails turned into that

23:49 Raynes: brehaut: Also, if you set something to read-only, apparently not even your own plugin code can write to it.

23:49 Something that I just spent about 30 minutes debugging.

23:50 brehaut: ibdknox: rails is a low barrier to entry‽

23:50 ibdknox: Raynes: I was playing with sublime text 2 today

23:50 brehaut: It was, but less so now

23:51 Raynes: ibdknox: This has been editorweek for me. I've learned to use Vim, gotten bored, and now I'm screwing with Sublime Text.

23:51 brehaut: ibdknox: ive never learnt rails; more ceremony than a church

23:51 ibdknox: brehaut: Rails popularized scaffolding, which was a site in a box :)

23:51 brehaut: ibdknox: yeah, djangos similar with its models + admin magics

23:51 Raynes: ibdknox: I'd use Sublime Text, but no paredit makes me cringe. I no longer understand how to write Clojure code without it.

23:51 ibdknox: Raynes: I couldn't deal with the fact that it indented incorrectly

23:51 Raynes: My finger don't work this way.

23:51 ibdknox: lol

23:52 Raynes: What doesn't it indent properly?

23:52 It doesn't seem to do much in the way of auto-indent at all.

23:52 ibdknox: pretty much anything

23:52 brehaut: technomancy: does emacs easily support having scoped modes within a file yet?

23:53 Raynes: brehaut: What editor do you use?

23:53 brehaut: Raynes: i hate emacs and textmate in equal quantities; i hate all other editors in larger quantities

23:53 Raynes: That is wonderfully vague.

23:53 ibdknox: vim is still my favorite :D

23:53 Raynes: But I'm guessing that means you use Emacs and/or textmate?

23:54 brehaut: Raynes: both

23:54 ibdknox: that's mostly because I can't convince myself to be at 10% efficiency for a couple weeks to learn emacs

23:54 brehaut: emacs for clojure, textmate for python + js

23:54 cemerick: brehaut: I'm stealing that answer, and just replacing the particulars. :-)

23:54 brehaut: cemerick: hah awesome :)

23:54 cemerick: which one becomes eclipse?

23:55 Raynes: ibdknox: My experiments with Vim have led me to not hate it. That said, editing Clojure with it is as much of a pain as doing it with Sublime for me, because I have to switch to command-mode to do paredit commands, and I always forget where my leader character is on my blank keyboard.

23:55 I'm giving it all time though.

23:55 I'm just happy that I don't care about swank anymore and don't have to deal with that crap.

23:55 ibdknox: Raynes: you could map those commands to something in insert mode

23:56 * cemerick ,(format "i hate %s and %s in equal quantities; i hate all other editors in larger quantities" "eclipse" "sublime text")

23:56 cemerick: that wasn't supposed to happen

23:56 Raynes: Yeah, but I might have to learn VimScript.

23:56 cemerick: ,(format "i hate %s and %s in equal quantities; i hate all other editors in larger quantities" "eclipse" "sublime text")

23:56 clojurebot: "i hate eclipse and sublime text in equal quantities; i hate all other editors in larger quantities"

23:57 * jrabbit mentally notes format

23:57 cemerick: jrabbit: it's the duplo of string interpolation in clojure :-)

23:57 (just FYI)

23:57 ibdknox: speaking of... you performance people, should I resort to a stringbuilder to get efficient string concatenation?

23:57 jrabbit: cemerick: I don't know what that is but it works like python string formatting which is nice

23:57 brehaut: cemerick: the giant brightly colored blocks of string interpolation?

23:58 cemerick: ibdknox: StringBuilder

23:58 ibdknox: k, that's what I figured :(

23:58 cemerick: oooh, I'm tired enough that I thought ibdknox wrote 'StringBuffer"

23:58 ibdknox: lol :p

23:59 cemerick: brehaut: the not-very-powerful, not-very-flexible, but anyone-can-understand-it approach.

23:59 brehaut: cemerick: aha, whats the technic version?

Logging service provided by n01se.net