#clojure log - Apr 20 2011

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

0:00 technomancy: it looks like that class is in the default package; consider moving it to a package instead

0:00 unclear if that's the cause, but it's good hygiene

0:00 xcv: ok

0:00 technomancy: hrm; gotta take off for a few; might be able to look more later.

0:00 xcv: thanks for the help!

0:00 I'll try hacking at it a bit more

0:09 carllerche: if I need a type / "object" that is really just a two tuple, is it more idiomatic to use a vector or a map? My guess would be map since records and such behave like maps.

0:10 brehaut: carllerche: if its a pair of things rather than an association then a vector

0:10 carllerche: it makes for more natural destructuring for instance

0:10 carllerche: hmm... true

0:11 brehaut: carllerche: MapEntrys look like vectors too ;)

0:11 ,(type (first (seq {:a 1})))

0:11 clojurebot: clojure.lang.MapEntry

0:11 brehaut: ,(first (seq {:a 1}))

0:11 clojurebot: [:a 1]

0:11 carllerche: cool, thanks

0:11 I guess I'll go w/ a vector for now and see where it goes

0:12 brehaut: carllerche: go with a vector until a) other requirements emerge or b) it gets to be a performance issue then use a record

0:13 carllerche: will do

0:19 KirinDave: Hum

0:19 Yegge _does_ have a point about Clojure's community being more scheme and haskell expats than Common Lisp expats.

0:19 Although, you'd think we'd have MBE by now if that were an overwhelming bias.

0:21 xcv: technomancy: I moved the java files into a package as you suggested, but 'lein uberjar' hangs just the same.

0:26 technomancy: xcv: ok, if you send me the java file I can try it here

0:26 xcv: you probably want to get this into version control soon though.

0:27 in fact, learning that may be more important than learning clojure =)

0:27 ataggart: johnmn3: enlive might do what you want. http://github.com/swannodette/enlive-tutorial

0:27 technomancy: not to say you can't do them at the same time

0:30 KirinDave: he did kind of get goaded into posting before he was ready.

0:30 KirinDave: technomancy: Probably true.

0:31 technomancy: I'll wait for the director's cut before I get offended.

0:33 xcv: technomancy: Great! There are two java files: The lexer SchemeLexer.java (generated by jflex) is here: http://pastie.org/1814222, and Yytoken.java is here: http://pastie.org/1814225

0:34 (these are the only java files, that is)

0:35 mec: What do I do if I'm using a deftype with 2 protocols that both have the same fn

0:36 technomancy: xcv: that should even compile; your java file says the class is lexer.SchemeLexer, but Clojure is looking for just SchemeLexer

0:37 amalloy: mec: (extend-type MyType Proto1 (the-fn [this] ...) Proto2 (the-fn [this] ...)), i think

0:38 xcv: technomancy: sorry about that, I updated the import statement to match the packaging: http://pastie.org/1814234 (it compiles on my end)

0:38 amalloy: ie, just what you would do if they had different names

0:39 though i don't think the two protocols can be declared in the same namespace - they'd both try to define myns.the-fn

0:41 technomancy: xcv: your project.clj is pretty funny. I was able to make it work by structuring it like this: http://p.hagelb.org/project.clj.html

0:41 in general you should just base your projects off the skeleton that "lein new" gives you.

0:43 amalloy: technomancy: down with the man! don't let lein tell you what to do!

0:43 technomancy: amalloy: if you sayjure so

0:43 ataggart: amalloy: deftype emits the protocol fns as methods, so it'll fail on duplicate method signature (assuming they have the same arity)

0:44 amalloy: ataggart: that's why i used extend-type

0:44 ataggart: ah very good

0:45 amalloy: but thanks for clarifying the fact that that's a necessary component

0:46 ataggart: just checked, and you are correct, extend type lets you do it no prob

0:48 xcv: technomancy: that worked!

0:48 technomancy: I guess I mangled the project file while getting it working initially

0:50 technomancy: thanks a million for the help!

0:51 technomancy: xcv: sure thing

0:52 xcv: I don't use javac myself; if you have suggestions how to make its docs clearer, please post 'em to the list.

0:52 * technomancy is off to read Alan Moore.

0:54 brehaut: technomancy: which particular alan moore?

1:01 mec: bah github dead

1:08 amalloy: long love github

1:12 ataggart: hmm, ^:cost

1:12 ^:const

1:17 seancorfield__: anyone here working with mongoDB?

1:17 i'm considering it for a project and wondered about clojure wrappers for it...

1:20 ataggart: the only one I know of is congomongo

1:23 seancorfield__: that seemed to be the only one i could find that is getting updates...

1:25 amalloy: congomongo has worked fine for me

1:26 sexpbot and 4clojure both using it, though not super-heavily in either case

1:28 seancorfield__: thanx... i'll try it and see what i think

1:32 KirinDave: Hell yes. Very stoked I got patches for clothesline from an outside-of-banksimple source.

1:32 Nice to know someone else is using it.

1:34 amalloy: seancorfield__: also, the last guy who asked about congomongo hasn't come back to complain afaik :)

1:36 ataggart: ah cool, didn't know BS was using clojure

1:37 seancorfield__: well, world singles needs to move some data from mysql to one of the more flexible data stores and mongoDB leads our short list for the first stage

1:38 not going to happen any time soon but i want to start experimenting

1:38 KirinDave: ataggart: Truth be told, we are not going to use it so much going forward.

1:39 ataggart: It's a bummer, but evidently I was more willing to learn scala than some of my peers were willing to learn clojure.

1:40 ataggart: I just don't get that. I've been trying to make myself learn scala over the last few weeks, and I just can't do it.

1:40 KirinDave: Why?

1:40 clojurebot: why not?

1:40 KirinDave: It's...

1:40 ataggart: syntax

1:40 Derander: clojurebot: <3

1:40 clojurebot: <3 is </3

1:41 KirinDave: I think what's most disappointing about Scala is that it has this type inferencing system which really sucks on things that are exciting about Haskell

1:41 amalloy: poor clojurebot is depressed

1:41 KirinDave: And it lacks something analogous to clojure's generic methods.

1:41 Or haskell's typeclasses

1:41 Which is a BIG hit in my opinion.

1:41 ataggart: well, to be fair, I can't speak to any of scala's non-aesthetic qualities

1:42 it's just so much visual noise to me

1:42 KirinDave: As for aesthetics, you gotta admit the _ syntax for simple lambdas is so much nicer than Clojure's #() ass soup.

1:42 ataggart: haven't gotten that far

1:42 KirinDave: I love you clojure, but your lambda syntax...

1:42 ataggart: e.g., (map #(+ 100 %) someNumbers) => someNumbers.map(_ + 100)

1:43 seancorfield__: we're using scala for performance-critical low-level stuff but i wouldn't want my whole team trying to learn it

1:43 KirinDave: seancorfield: It is broad and deep, as they say

1:44 ataggart: KirinDave: but is this not also true: (map + someNumbers) vs someNumbers.map(_ + _)

1:44 KirinDave: Heck, the finer points of its type system make haskell's monomorphism restriction error look positiviely readable.

1:44 No.

1:44 ataggart: Nope.

1:45 ataggart: You may be thinking of a fold there

1:45 ataggart: ah possibly

1:45 KirinDave: In which case still no. :)

1:45 ataggart: I coulda sworn there was somewhere saw (_ + _)

1:45 KirinDave: Yeah _ + _

1:45 That's for fold

1:46 someNumbers.reduceLeft( _ + _ ) // == someNumbers.sum

1:46 Please pardon me, I gotta get to the gym or I won't go today.

1:46 ataggart: isn't it like 2am for you?

1:46 amalloy: ataggart: KirinDave is in sf, not ny, iirc

1:46 ataggart: ah k

1:47 seancorfield__: my team just plain ol' prefers dynamic languages

1:47 so scala is reserved for corner cases

1:47 KirinDave: seancorfield: Fair enough

1:47 Scala can be onerous about that.

1:47 ataggart: what perf corner cases was scala faster than clojure?

1:48 KirinDave: ataggart: Pre-1.3 there are many many.

1:48 ataggart: I don't doubt it, just don't know what they are

1:48 seancorfield__: we started uses scala in production in early 2010

1:48 KirinDave: Ngh. I really should go.

1:48 ataggart: go

1:48 seancorfield__: i only just got the green light to go to production with clojure

1:48 KirinDave: gone

1:48 * ataggart wishes someoen in Canada would open a clojure shop

1:53 livingston: why does this say "_" is not a ns (defmacro foo [x] (let [fv (symbol "_" (str (gensym)))] `(~x ~fv))) when called (macroexpand-1 (foo 'bar))

1:53 but this works just fine: (let [x 'bar] (let [fv (symbol "_" (str (gensym)))] `(~x ~fv)))

1:54 amalloy: &(symbol "_" "foo")

1:54 sexpbot: ⟹ _/foo

1:54 amalloy: you probably want ##(symbol (str "_" "foo"))

1:54 sexpbot: ⟹ _foo

1:55 livingston: I want a symbol with the underscore namespace. it works just fine without there being a defined "_" namespace when called, but not in the macro

1:56 amalloy: interesting

1:56 livingston: it's somehow trying to evaluate my symbol, but I can't tell why? is there something wrong with the structure of my macro

1:57 amalloy: i don't see anything wrong

1:57 but i'm open to second opinions

1:57 seancorfield__: ataggart: any thoughts on what the clojure job market is really like out there?

1:57 livingston: so if I go to my repl and (ns _) now I get: "No such var: _/G__4235" as an error

1:57 ataggart: which "there"?

1:58 seancorfield__: the clojure mailing list has nearly 5,000 people on it, all using clojure in some form

1:59 livingston: DOH *livingston fails to quote the thing inside the call to macroexpand*

1:59 ataggart: livingston: the yeah

1:59 just about to say

2:01 livingston: sign it's time for bed probably

2:05 seancorfield__: ataggart: well, we see lots of talk of Clojure on the list of course but there seem to be several calls for "Who's using Clojure?" so i get the impression that there aren't a huge number of jobs out there yet

2:06 ataggart: relative to other languages, it does seem that way

2:07 not sure why though.

2:07 livingston: seancorfield__: a little bird told me it has appeared inside the walls of google, but not how much or for what.

2:07 ataggart: the banksimple case is an interesting one. I'd be curious to know why scala was preferable over clojure

2:08 livingston: you're probably only going to find it at small places / startups - it's a bit to new for places like accenture to pick it up

2:08 seancorfield__: the main scala-user maling list has only 1200 people on it

2:08 ataggart: #clojure is always more populated than #scala

2:08 hiredman: clojurebot: tell use about scala

2:08 clojurebot: chouser is ruthless about breaking other people's code

2:09 hiredman: clojurebot: really?

2:09 clojurebot: It's greek to me.

2:09 hiredman: clojurebot: tell use about scala

2:09 clojurebot: use vs require is (:use [lib :only [a b c]) or (:require [lib :as alias]) -- (:use lib) is only for playing around

2:09 hiredman: clojurebot: you seem kind of borked

2:09 clojurebot: kind of interesting if unfold is the intermediate steps of a fold

2:09 ataggart: clojurebot: tell us about scala

2:09 clojurebot: the scala compiler | is | <reply> see: http://harrah.github.com/browse/samples/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala.html#65760

2:10 hiredman: anyone used jffi?

2:10 livingston: scala has been around since 2003 -- twice as long as clojure. it's also probably easier for a random java programmer to pick up.

2:11 hiredman: it would be nice to be able to call posix_spawn from clojure, but jffi is not well document

2:11 ataggart: doesn't JNA sit on top of jffi?

2:11 hiredman: (Runtime.exec being borked if the jvm has a decent heapsize)

2:12 no

2:12 jffi may sit on top of jna

2:12 https://github.com/wmeissner/jffi

2:12 jruby uses it

2:12 ataggart: ah, I was thinking of libffi

2:13 hiredman: jffi sits on top of libffi

2:13 ataggart: and apparently so does JNA

2:13 hiredman: I doubt that

2:13 I think libffi is relatively new

2:14 ataggart: I just go by what wikipedia tells me

2:14 hiredman: huh, I guess so

2:14 thats kind of neat

2:15 ataggart: may be of interest: https://github.com/Chouser/clojure-jna

2:24 holy crap! I can finally edit jira tickets

2:40 seancorfield__: you got a promotion :)

2:42 amalloy: ataggart: now, mark my ticket as accepted so i can finally say with a straight face that i've contributed to clojure.core

2:42 ataggart: #?

2:43 amalloy: 757

2:44 ataggart: as with many tickets, there is an open question.

2:45 amalloy: yeah, i know. i was really just hoping for magic fairy dust

2:45 ataggart: it's "waiting on" rich though, so it might get answered some day :)

2:46 and my ticket has been around since september

2:46 CLJ-445

2:47 had to rewrite the damn Reflector

2:48 amalloy: yuck

2:49 ataggart: it was fun though, and it sets up adding support for calling vararg methods

2:51 amalloy: ataggart: i can't find the issue number, and it's been declined, but i wonder whether you were a fan of my patch to add CL-style #| comments |#

2:51 ataggart: 714

2:52 markoman: is it possible to use clojure with gdb on ecams?

2:53 kriyative: Hi all, anyone know of a clojure lib for creating Unix pipes? I've hand hacked something using code from clojure.contrib.shell-out but would rather use something better.

2:53 ataggart: amalloy: I just use #_"my multi-line comment here"

2:54 amalloy: so do i, but i'm not really a fan

2:54 markoman: gdn docs says i need to compile app with -g option. and then point gdb to the executable file

2:54 s/gdn/gdb/

2:54 sexpbot: <markoman> gdb docs says i need to compile app with -g option. and then point gdb to the executable file

2:54 amalloy: gdb will never debug clojure

2:55 you want swank/slime, and probably the cdt to plug into swank

2:55 markoman: how so?

2:55 amalloy: you would be debugging the native-compiled jvm executable

2:55 clojure is not native code

2:56 markoman: im using swank and slime. how do you set breakpoints with it for example?

2:56 amalloy: $google clojure cdt george jahad

2:56 sexpbot: First out of 9 results is: CDT - The Clojure Debugging Toolkit

2:56 http://georgejahad.com/clojure/cdt.html

2:57 amalloy: it's not as time-tested as gdb, or as feature-complete as slime's CL debugger, but it's a big step up from println

2:57 livingston: the CL style comments is more than that though, the pipes are for making a symbol with arbitrary text in it's name - that's really useful (I don't think there is anything like that in the clojure reader is there?

2:57 amalloy: livingston: uh

2:58 you are perhaps thinking of |symbol thingy| without #?

2:58 livingston: amalloy: yeah, but I thought they shared parts of the reader, I could be grosly confused

2:59 amalloy: they well might. i've never looked at CL's impl of...anything

3:00 but there's no particular reason they would share code in the clojure compiler

3:01 markoman: alright, need to test cdt then

3:02 ataggart: amalloy: I'm inclined to agree with those in the nay column

3:02 short of some compelling example which couldnt; readily be met with existing features

3:03 amalloy: ataggart: i just think it's grotesque that i can't write TODO: in my multi-line comment, really

3:03 ataggart: multiline comments lead people to write them, which leads to red herrings

3:03 amalloy: get a better editor?

3:03 amalloy: ataggart: huh?

3:03 hiredman: amalloy: doesn't your editor place ;; when needed?

3:03 livingston: the pipes are reader macro for long symbol and the # is the dispatch function, I though that pipe comment thing was really a cool hack that just said dispatch on this symbol - noop, effectively telling the compiler to throw it away -- I thought.

3:03 amalloy: hiredman: for sure, i can do it with more than one single-line comment

3:04 but we might as well throw away ##(doc comment) if it's not usable for at least two reasons

3:04 sexpbot: ⟹ "Macro ([& body]); Ignores body, yields nil"

3:04 hiredman: oh, sure

3:04 amalloy: that's my second-best, if i can't have #|..|#

3:04 hiredman: well, I dunno, it's kind of useful to keep code for testing functions in as you write them

3:05 amalloy: hiredman: but it yields nil. at anything but the top level it will break things

3:05 ataggart: is there a usecase for comment that's not met by #_

3:05 hiredman: amalloy: which is where I use it

3:05 amalloy: ataggart: commenting out something that isn't a balanced sexp

3:06 wrap it with a "string", sure

3:06 then escape all the "s in your string...

3:06 ataggart: amalloy: good point about the non-sexp

3:06 amalloy: or even commenting out multiple balanced sexps at once

3:07 the list of very-small gains for #| is longish, but they're all quite small

3:07 just little things about (comment) and #_ that will surprise you

3:07 ataggart: no one uses comment for comments though, right?

3:07 amalloy: i did

3:07 ataggart: ah

3:08 amalloy: anyone who sees the language for the first time will

3:08 i mean, we put a macro called comment into clojure.core, people should know not to use it?

3:08 ataggart: heh

3:08 well poor naming of comment aside, ; seems to do what we need for actual comments

3:09 livingston: ok, I'm full of shit, just looked in Steele - I really thought it was some cute trick leveraging the symbol reader - it's not it's a defined comment sequence -- sorry for the bad info

3:09 amalloy: ataggart: it just leaves clojure in the embarrassing position of being practically the only language without multi-line comments. java could do fine with //, but they have /**?

3:10 livingston: the CL reader really just sees #, then looks at the next *character*, not next *symbol*

3:10 ataggart: amalloy: meh, in every case where /* */ is useful is for documentation, and clojure has doc strings

3:10 livingston: amalloy: I know that - (I've actually mucked with the CL reader more than most, but it's been so long)

3:11 ataggart: I'm inclined to agree with the school of thought that large in-code comments are a Bad Thing

3:11 livingston: I never used that commenting style because my editor always did block comment out for me with semicolons

3:11 ataggart: as opposed to documentation

3:11 amalloy: ataggart: i don't really disagree, i just wish clojure would get some consistent story for comments. add a """ multi-line-string or something

3:11 or say "look, don't do multi-line comments, they're bad"

3:11 like it does with inheritance

3:12 ataggart: amalloy: look, don't do multi-line comments, they're bad.

3:12 amalloy: but having multiple, broken versions of multi-line commenting is what i see when i look at (comment)

3:12 livingston: amalloy: I'm actually really disappointed I can't add reader macros in clojure, it's really useful for DSLs

3:12 ataggart: :)

3:12 amalloy: ataggart: indeed. put it on clojure.org for me

3:12 ataggart: but then steve yegge will yell at us for being prescriptive

3:13 amalloy: that's how we'll get market share!

3:13 ataggart: or maybe proscriptive

3:13 livingston: I think the point of excluding reader macros was to stop people like amalloy from making their code unreadable to others ;)

3:14 hiredman: livingston: you can if you really want, all you have to do is know how to do it

3:14 amalloy: ataggart: meh. i have a program that would love a reader macro in it, but i don't especially care

3:15 livingston: ataggart: no rich has some thing about them having the potential to need state and thus mucking with things

3:15 hiredman: have a good example?

3:15 amalloy: livingston: the primary objection is, i think, ataggart's

3:16 hiredman: livingston: I refuse to give give examples due to various non-proliferation agreements

3:16 ataggart: clojure's prime directive

3:16 livingston: yeah see that's what I thought

3:16 amalloy: yeah, seriously. the implementation hiredman refers to is so disgusting, hacky, and non-portable. you're better off not knowing

3:16 (non-portable to future clojure versions, that is)

3:17 hiredman: jna is such a bummer

3:17 livingston: reader macros are like regular macros, 9 times out of 10 you don't need them and shouldn't use them, but there are some really cool places where they can change the world.

3:17 if people use them bad, don't use their code.

3:18 ataggart: hiredman: how so? is it worse than JNI?

3:18 hiredman: oh, no

3:18 just a drag

3:19 * hiredman tries to figure out the type of this stupid pointer

3:21 hiredman: and you can't generate the interface you need with definterface

3:21 ataggart: requires interface inheritance?

3:21 hiredman: yes

3:21 ataggart: bleh

3:23 amalloy: seems like definterface is bound to get an :extend option sooner or later, right? i don't know any way it goes against clojure's philosophy

3:24 hiredman: extension via inheritence instead of composition

3:25 amalloy: but not actually inheriting any code

3:26 ataggart: why won't gen-interface work?

3:26 amalloy: &(doc gen-interface)

3:26 sexpbot: ⟹ "Macro ([& options]); When compiling, generates compiled bytecode for an interface with the given package-qualified :name (which, as all names in these parameters, can be a string or symbol), and writes the .class file to the *compile-path* directory. When not compil... http://gist.github.com/930595

3:27 ataggart: it has :extends [interface ...]

3:27 amalloy: when not compiling, does nothing

3:27 ie, it demands aot

3:27 hiredman: oh, it may, definterface is just nicer

3:27 ataggart: where is definterface from?

3:27 hiredman: clojure

3:27 amalloy: &#'definterface

3:27 sexpbot: ⟹ #'clojure.core/definterface

3:28 ataggart: odd, it's not in the docs

3:32 amalloy: TimMc: you use findfn, right? mec added $findarg recently:

3:32 $findarg map % [1 2] [2 3]

3:32 sexpbot: [clojure.core/unchecked-inc clojure.core/inc]

4:22 talios: hola - where does one find maven artifacts for clojure-contrib these days? I don't see any 1.3.0-alpha6 or anything in maven central next to clojure-core...

4:27 fliebel: talios: I believe they are on the Clojure server, not on the central one.

4:29 talios: ah cool - will hunt over there then.

4:32 raek: talios: I think they stop at the 1.3.0-alpha4 version

4:33 talios: they seem to yeh, wonder why/how mvnrepository.org gave me -alpha6

4:33 raek: http://dev.clojure.org/display/design/Contrib+Library+Names

4:34 some stuff is being considered for "new contrib"

4:34 the "old contrib" was an important step for clojure, but now it's largely unmaintained

4:35 fliebel: Any Python programmers around? I wonder how writing Clojure influenced your Python code. Do you go all functional in Python, or just go back to mutating stuff? I also just found this: http://packages.python.org/pysistence/

4:39 thorwil: hmm, i fell in love with map, and filter in python, wasn't thrilled about lambda's limitations. gained some motivation to look at other languages that don't treat these things so stepmotherly

4:39 fliebel: I'm asking because last time I tried to do stuff as I'd do in Clojure, it was kind of slow and ugly. Another reason is that someone showed interest in hiring me for a Python job, where I'd have to collaborate with people probably writing non-functional code. (that sounds funny)

4:39 thorwil: so far the clojure influence on my pathon is that i don't want to use it anymore :)

4:40 /s/pathon/python/

4:41 fliebel: thorwil: That is an interesting thing to say, as it would imply learning Clojure limits your career to… cool places.

4:42 thorwil: heh. no career in programming here, i'm more of a designer :)

4:42 talios: put down photoshop and back away from the laptop!

4:50 fliebel: So, when we have cinc, PyPy should be an interesting target :)

5:05 hoeck: fliebel: I did learn Python for my current job after mainly using clojure for about 2 years during my studies

5:06 and pypy is definitely a nice clojure target, I'm on the boat when cinc is ready, or even before

5:07 I just don't know yet how to (efficiently) implement method overloading on python targets

5:07 fliebel: hoeck: So, what is your Python like, ofter writing Clojure for 2 years?

5:08 hoeck: fliebel: more like clojure :)

5:08 not that I'm using filter & map or itertools everywhere - thats just a pain in python, imo

5:09 but I try hard to avoid stateful classes, and try more to create clean interfaces and referential transparent functions

5:11 fliebel: So you do use for loops and mutation and all that…

5:12 oh, neat: http://docs.python.org/release/3.1.3/howto/functional.html

5:12 hoeck: of course, you have to, in python, there is just not enough infrastructure to give that up

5:12 fliebel: ghehe

5:12 opqdonut_: generators are quite nice actually

5:13 capture some of the use cases of lazy lists

5:13 fliebel: yea, yield is magic :)

5:13 hoeck: I'm not trying to write unidiomatic python, but I strongly dislike those typical python oo-apis foo = create_object(); foo.set(prop); ...

5:15 especially now that I know that 80% of the mutation there is just unnecessary and makes code more complex :/

5:16 but I'd currently rather work with python than taking a java job

5:16 fliebel: oh, shit comas.

5:16 yea, Python is nice...

6:09 raek: does @planetclojure tweet all clojure tagged questions on stack ocerflow?

6:20 talios: raek: i hope not

7:09 noidi_: Is there a predicate like fn? that returns true for all objects that can be used like a function, e.g. sets, maps, etc.?

7:10 ambrosebs_: i guess they would all implement the java interface Callable .. and there's another one

7:11 runnable?

7:11 noidi_: thanks!

7:11 fliebel: noidi_: ifn?

7:11 noidi_: even better! >(

7:11 :)

7:48 ilyak: hi *

7:49 How would I pass a record constructor /Track./ as a parameter to higher order function?

7:54 hoeck: ilyak: either wrap it into a function like #(Track. %1 %2) and pass that or use reflection if you need to call the ctor with varying arguments

7:55 ilyak: Sad

7:55 Why isn't it a function by itself?

7:59 raek: ilyak: this is being though upon: http://dev.clojure.org/display/design/defrecord+improvements

8:00 ilyak: Is there a repository of clojure dependencies or like? For example, I can't figure whether https://github.com/david-mcneil/defrecord2 is good and supported, and no idea how to integrate it into my project

8:02 raek: ilyak: yes, clojars.org is the place

8:02 though it doesn't look like David McNeil has uploaded it there...

8:03 but apparently someone else did: http://clojars.org/me.hspy/defrecord2

8:19 ilyak: looks like defrecord2 doesn't accept n arguments

8:19 only one map

8:19 I mean, defrecord2-s constructor

8:19 so you can't say (apply new-track seq)

8:19 which sucks

8:37 ordnungswidrig1: hi all

8:37 fliebel: hi

8:38 ordnungswidrig1: I need a way to detect bindings which a not local to a macros body.

8:39 say, e.g. if have (let [a 1] (foo-macro (let [b 2] (* a b)))

8:40 fliebel: detect?

8:40 ordnungswidrig1: then during macro expansion I need to know that a is bound outside of the macro body

8:43 Chousuke: ordnungswidrig1: the &env magic parameter of the macro *might* be of use

8:44 ilyak: There is (if-not bool on-false on-true)

8:44 but is there (if-something bool on-true on-false)?

8:44 ordnungswidrig1: Chousuke: a little backround information: i'm playing to event sourcing / prevalence and I'm trying to write a macro that records the body to a like before execution.

8:44 Chousuke: ilyak: what's wrong with just if?

8:44 fliebel: ilyak: Just drop the not?

8:45 ordnungswidrig1: Chousuke: during replay of the body I must make sure that all bindings that are referenced by the body are in place

8:46 Chousuke: ordnungswidrig1: that sounds difficult

8:46 ilyak: cheatsheet doesn't have if

8:46 fliebel: ordnungswidrig1: What does your macro do?

8:46 ilyak: for some reason

8:46 fliebel: ilyak: Then do (if-not (not bool) true false) :P

8:47 ordnungswidrig: https://gist.github.com/931238

8:47 ilyak: (map #(if (= % "NULL") % nil) '("foo" "NULL" "NULL" "bar" "NULL"))

8:48 returns (nil "NULL" "NULL" nil "NULL") for some reason

8:48 why?

8:48 ordnungswidrig: you can do (in-log l (do something nice here) and "(do something nice here)" will be logged and executed

8:48 ilyak: oops, it should be wrong way around

8:48 disregard that

8:48 ordnungswidrig: afterwards you can do (replay l) and it should execute all forms that have been logged in l before

8:50 Chousuke: ordnungswidrig: examine &env in your macros

8:50 ordnungswidrig: Chousuke: that sounds good

8:50 Chousuke: it's pretty much undocumented but you can access all locals and the forms that define them

8:50 note: not the values. those are only known at runtime :)

8:51 fliebel: Chousuke: There is &env, and another one… &form or something like that?

8:51 Chousuke: yes

8:51 chouser: and not the "source code" forms, but the analyzed forms, iirc.

8:51 fliebel: chouser: Difference?

8:51 ordnungswidrig: when I know which bindings exists I need to replace them by hand. e.g.

8:52 fliebel: ordnungswidrig: Easier would be to log env as well :)

8:52 ordnungswidrig: fliebel: nice idea!

8:53 fliebel: ordnungswidrig: Is this for debugging? Sounds really nice to log stuff, and then rerun it later to see what it does.

8:55 ordnungswidrig: fliebel: it's for recording and restoring the state of the application

8:55 fliebel: like a database or filesystem log

8:56 chouser: fliebel: normally when we talk about forms we mean nested lists of symbols and similar things. &env gives you the Java objects generated from that in the analysis stage, things like LocalBinding, NumberExpr, etc.

8:57 fliebel: chouser: Oh, so will that go away with cinc?

8:57 ordnungswidrig: chouser: that's not what I want

8:58 fliebel: ordnungswidrig: Someone made a printable fn, or fn literal. Maybe that does what you want.

8:58 chouser: well, I think the hope is that LocalBinding, NumberExpr, etc. will be immutable records rather than mutable non-collection Java objects.

8:59 ordnungswidrig: merely I want to have (let [a (rand-int 1000)] (in-log (alter foo + a))) such that a is expanded in the expression before the form is logged.

8:59 Such that the logged (and executed) form is (alter foo + 557)

9:00 Is clojure.walk of any help here?

9:00 fliebel: ordnungswidrig: But are these even avaliable at macro time?

9:00 Chousuke: ordnungswidrig: that's not possible in general

9:00 chouser: ordnungswidrig: you can use &env to get the names of the locals, and emit code that refers to them at runtime in order to collect their real runtime values.

9:00 ordnungswidrig: fliebel: no, at macrotime is expanded to (in-log (a b c)) (do (alter log-ref conj '(in-log a b c) (a b c))

9:04 chouser: (defmacro in-log [& block] `(do (prn (zipmap '~(keys &env) ~(cons `list (keys &env)))) ~@block))

9:05 (let [x 5, y (rand-int 100)] (in-log (prn (+ x y)))) ;=> {x 5, y 39} 44

9:05 Something like that?

9:05 ordnungswidrig: not so bad

9:06 (let [b 3] (in-log2 (let [a (+2 b)] (inc a))))

9:06 ; => java.lang.Integer cannot be cast to clojure.lang.IFn

9:06 freiksenet: hi! is it possible to make clojure behave more like haskell/CL in terms of undefined functions, so that I don't have to declare all functions in a file if I prefer to have toplevel functions on the top of the file?

9:08 ordnungswidrig: ah, sorry, (+ 2 b) not (+2 b)

9:10 Chousuke: freiksenet: you can use the declare macro to declare functions before defining them

9:10 freiksenet: frankly it's just a fucking shame that clojure can't do a pass over the file before compilation to do that declare automatically

9:10 Chousuke: I guess it could, but it won't.

9:10 fliebel: chouser: I love that macro

9:11 freiksenet: Chousuke: I know that. that's tedious. I was wondering if there is something (maybe in some build system) that arleady does that

9:11 Chousuke: fliebel: for simplicity. No-one wants to do anything to the compiler beyond what is necessary anymore, because it's written in Java :P

9:11 the long-term plan is to replace it anyway, perhaps Clojure will get two-pass compilation then

9:12 Though I don't know what that implies for the repl

9:12 freiksenet: well, nothing I guess.

9:12 matthias_: mayube someone should rewrite it in clojure ;)

9:12 freiksenet: I mean twopass compilation won't really modify how repl works

9:12 Chousuke: freiksenet: what harm is one declare at the top anyway :)

9:12 freiksenet: Chousuke: well I need to declare all functions on top

9:13 or most of them

9:13 Chousuke: yeah, but declare takes multiple functions

9:13 chouser: I'm pretty sure Rich has rejected having Clojure accept the use of vars before they're declared.

9:13 freiksenet: maybe it's my haskell/cl background, but I am used to writing stuff from top to bottom

9:13 chouser: in long conversations on the google group.

9:13 freiksenet: chouser: it just needs an autodeclaration for all def and defns, no need to make clojure accept undeclared vars

9:14 like CL does I guess

9:14 thouhg CL I think doesn't mind undeclared vars or functions too

9:14 chouser: I'm pretty sure CL allows use of undefined symbols at the REPL

9:14 fliebel: freiksenet: You can do #'var as long as you *use* them in the correct order.

9:15 Chousuke: that's ugly though :/

9:15 fliebel: Quite, and slow even :)

9:16 chouser: fliebel: really?

9:16 , #'foo

9:16 clojurebot: java.lang.Exception: Unable to resolve var: foo in this context

9:16 chouser: oh

9:16 I see what you mean

9:17 freiksenet: in any case that adds up to list of annoying things in clojure :D

9:17 chouser: yeah, I think even that doesn't work

9:17 freiksenet: not like show stoppers, but thinks that annoy you every time you encounter them :)

9:17 chouser: freiksenet: note that this is an intentional decision. You can assume it's without value if you'd like, but be aware others have almost certainly come to a different conclusion.

9:18 ilyak: What if I want to loop/recur on some array (first/rest) growing some cache during looping, but yielding sequence elements instead of collecting them and then returning the whole seq?

9:18 What should I use?

9:18 matthias_: true and false should be able to be used as functions so we could write ifs without "if". does anyone thing that's a good idead? :p

9:19 Chousuke: that's not possible

9:19 fliebel: matthias_: You mean like… (true 1) > 1?

9:19 Chousuke: true and false are java objects

9:20 fliebel: And probably final too

9:20 matthias_: (true 1 2) would return 1, (false 1 2) would return 2

9:20 fliebel: Oh, what was that stinking pit called "making your own boolean"?

9:20 raek: matthias_: if is not a function. for it to work correctly, only one of the branches should be evaluated, but for a function application *all* arguments are evaluated before the function is applied

9:21 matthias_: yeah i know. make it a special form then or whatever

9:21 raek: so the compiler would need to know that in (a b c), a will be a boolean

9:21 fliebel: matthias_: Boolean a special form?

9:21 opqdonut_: this doesn't make sense, matthias_

9:23 fliebel: (def true #(do %1)) (def false #(do %2)) :P

9:24 Fossi: that has no condition

9:25 so "true" would have to be something that evaluates to true or false

9:25 fliebel: Fossi: That is nonsense altogether.

9:25 (mything, not what you said)

9:26 Fossi: i guess you have to have some kind of sugar in there

9:26 ordnungswidrig: Chousuke: I still need a way to determine the binding that are actually used in the form

9:26 Fossi: like ?((condition?) (thenpart) (elsepart))

9:27 ordnungswidrig: in (let [a 1 b (make-big-graph-of-data)] (in-log (ref-set ref a))) b should not be recorded

9:27 Fossi: without the ?() it would be real funky

9:27 fliebel: Fossi: What is the advantage?

9:28 Fossi: none

9:28 i think it would be pretty fucked up :)

9:28 fliebel: ordnungswidrig: Why not?

9:28 Fossi: it would also mess with ordering

9:29 ordnungswidrig: In my case b is really big / not recordable

9:29 In my special case b is the reference to the form log.

9:30 and I get a Stackoverflow while printing

9:32 I can add a binding clause to the macro where you have to declare the bindings to be evaluated: (let [a 1] (in-log l a (alter-ref ref + a))

9:32 but then I need to make sure that all needed bindings are declared.

10:36 cemerick: LOL @ http://groups.google.com/group/seajure/browse_frm/thread/18baa18ffdbdd790

10:40 ejackson: eep! I guess ->> could be interpreted as a very mean stare

10:41 Fossi: now, where's that shotgun operator?

10:42 ejackson: :get-off-my-lawn

10:43 see the two dots, thats you, looking down the barrel of Clint's shotgun

10:44 Fossi: i tried to come up with something, but rediscovered that my ascii art skills are far below mediocre

10:45 don't know whether that's a bad thing though ;D

10:46 ejackson: i'd say you should rejoice in that deficiency

10:46 Fossi: weird rantish post

10:46 interesting read though

10:50 imho the "yes" part is bs

10:50 but, i guess arguing the points here goes nowhere

10:51 the best example of a "yes" type language i can think of is c++

10:51 and if you want clojure to be where that ended up then thanks, but no thanks

10:52 earning money and all

10:54 xcv: I'm having a problem with mutually recursive functions; I use forward declarations, and that works fine in the REPL, but after I compile and run 'lein uberjar' I get an 'Unable to resolve symbol in this context' error. Should forward declarations break like this?

10:54 cemerick: As long as you (declare foo) before using it, you'll be good.

10:55 s/using/referring to

10:55 sexpbot: <cemerick> As long as you (declare foo) before referring to it, you'll be good.

10:55 Fossi: it prolly works in the repl because you defined it once before

10:55 and you have an "old" reference lying around

10:57 xcv: I'm using declare on each function beforehand, and it works on a fresh repl, but that doesn't seem to be enough

10:57 cemerick: Maybe paste what you have?

10:58 Fossi: yeah, sounds weird then

10:58 cemerick: (in a pastebin, of course)

10:58 xcv: ok, http://pastie.org/1815696

10:59 cemerick: heh, ok, and the error is where?

11:00 xcv: no error in the repl, but after lein compile and lein uberjar (the main function is in the pasted code file) I get "Unable to resolve symbol: reduce-form in this context"

11:01 manutter: does it give you a line number?

11:01 xcv: that's the first function call in the code that references a function that is defined later on

11:01 no, but I think it's in the walk-over function

11:01 line 190

11:01 evals the string (reduce-form)

11:02 that's the first call to a function with a body defined later on

11:03 that's the only explanation I could think of for that particular error coming up

11:05 cemerick: I have to run, but there's no need to use eval there

11:05 use resolve to get the var, and call it straight off

11:05 manutter: hmm, wonder if you changed that to (str "(compy.core/reduce-" symbol ")" ) ...?

11:06 though I like cemerick's answer better :)

11:38 xcv: hope I don't sound like an idiot, but could you explain how to call the var after I get it with resolve? Convert the string into a symbol and apply to an argument list?

11:39 manutter: hmm

11:39 ,(doc resolve)

11:39 clojurebot: "([sym]); same as (ns-resolve *ns* symbol)"

11:41 manutter: I'm just guessing but I think you could just use ((resolve (str "foo" bar "baz")) arg-list)

11:41 or ((resolve (symbol (str ... etc

11:52 dnolen: xcv: you want to get the value in the var? like a fn or something?

11:52 xcv: the value in the var is "form"

11:52 and I want to call reduce-form with no arguments

11:53 so I make a symbol out of (str "reduce-" form)

11:53 used to work with eval, but after lein compile + lein uberjar it doesn't work anymore

11:54 that is, can't get it to work with (apply (resolve (symbol (str "reduce" var))) [])

11:55 manutter: cemerick mentioned using resolve just before he left, and I made a guess, but I don't really know how to use resolve

11:56 if it returns the var instead of the contents of the var, though, this might work:

11:56 dnolen: xcv: I mean *Clojure var*, var in your example is just a local variable.

11:56 amalloy: it returns the var

11:56 manutter: (apply ((resolve (symbol (str "reduce-" var)))) [])

11:57 dnolen: xcv: resolve will get you the var, but you want the *value* contained in the var, in your case an fn I believe, right?

11:58 xcv: that's right

12:00 dnolen: xcv: have you looked at, var-get ?

12:00 ,(doc var-get)

12:00 clojurebot: "([x]); Gets the value in the var object"

12:00 xcv: (apply (resolve (symbol (str "print" "ln"))) ["hello"]) ->

12:00 hello

12:00 hum

12:01 raek: (<var> ...), ((deref <var>) ...) and ((var-get <var>) ...) are equivalent

12:01 xcv: so (apply (var-get (resolve (symbol (str "reduce-" var)))) []) ?

12:01 raek: vars implement IFn by calling whatever they contain

12:01 xcv: doesn't work either

12:02 raek: ,(apply (resolve 'print) ["hello"])

12:02 clojurebot: hello

12:02 xcv: every time I get "java.lang.String cannot be cast to clojure.lang.IFn"

12:02 raek: ,(apply (resolve (symbol "print")) ["hello"])

12:02 clojurebot: hello

12:02 raek: xcv: sounds like you have (def x "foo") instead of (defn x ...)

12:03 xcv: do you have multiple levels of indirection?

12:04 in what people has said before, "the var" has been refering to the var that contains the function you want to call

12:04 amalloy: ,((resolve 'print) "hello") ; don't need apply

12:04 clojurebot: hello

12:05 raek: xcv: in other words, it looks like your reduce-... function is not a function, but a string

12:07 xcv: that's strange, I declared every function ahead of time with declare, shouldn't that yield functions?

12:08 or should I use defn-s with empty bodies?

12:10 manutter: ,(let [reduce-foo (fn [] (println "foo")), foo2 "foo"] (apply ((resolve (symbol (str "reduce-" foo2)))) []))

12:10 clojurebot: java.lang.NullPointerException

12:10 manutter: o snap

12:10 ,(let [reduce-foo (fn [] (println "foo")), foo2 "foo"] (apply (resolve (symbol (str "reduce-" foo2))) []))

12:10 clojurebot: java.lang.NullPointerException

12:11 xcv: ,(let [reduce-foo (fn [] (println "foo")), foo2 "foo"] (apply (resolve (symbol (str "reduce-" foo))) []))

12:11 clojurebot: java.lang.Exception: Unable to resolve symbol: foo in this context

12:12 xcv: ,(let [reduce-foo (fn [] (println "foo")), foo2 "foo"] (apply (resolve (symbol (str "reduce-" foo2))) []))

12:12 clojurebot: java.lang.NullPointerException

12:13 manutter: xcv can you re-post the link to your pastebin with the source code?

12:14 xcv: http://pastebin.com/sFimY4mX

12:15 the problem occurs on line 190

12:15 with symbol = "form"

12:15 ah

12:15 that might be it

12:15 same name as the loop variable

12:15 raek: xcv: (declare a b c) is the same as (def a) (def b) (def c)

12:16 xcv: oh. I see that you have defs in your defns. that will not wotk

12:16 *work

12:16 def should only be used at the top level

12:16 since it defines/mutates *global* variables

12:18 xcv: also, are you using resolve outside a macro? if so, consider having a single def that contains a map instead if you need to look up things at runtime

12:20 manutter: oh I see: you are using "symbol" as a local var, so when you call (symbol (str it's not executing clojure.core/symbol, it's trying to execute your local var

12:20 raek: you are not supposed to change the value of a var, i.e. use 'def', except when you are defining something for the first time, or when you fix a bug

12:20 xcv: I'm redefining the globals inside functions (not good style, I know, but has worked fine so far)

12:21 after I changed symbol to sym in the doseq head it works, but I get another error after compilation

12:21 manutter: aha

12:21 raek: xcv: it will break as soon as multiple thread call the function the same time, or a single thread calls the function recursively

12:22 clojure is not meant to be used this way. you have no guarantees that anything will work.

12:22 xcv: I know

12:22 it's not functional

12:23 raek: (def inside a function in clojure is like static local variables in C)

12:24 aslo, taking user-supplied string and unconditionally calling a function with that name is most probably a *serious* security issue

12:24 xcv: of course

12:25 but this is only a small school project that I had to hack together very quickly

12:25 and it's too late for me to go back and fix it now

12:25 __name__: That's what they all say!

12:25 That's why we had Windows ME.

12:25 xcv: :P

12:25 I would never do this sort of thing in production code

12:27 raek: it's not just an issue of style... it's an issue of understating what the program even does

12:36 xcv: sorry for ranting. I'm convinced that you are aware of the issues ;-)

12:36 xcv: of course

12:37 __name__: xcv: WINDOWS ME IS YOUR FAULT!

12:37 Sorry for ranting, I just /had/ to say that to someone.

12:37 * __name__ grins :)

12:37 xcv: it's just that I was getting into FP, learning a new language and doing a big project on a very tight deadline, so I didn't follow all the rules for the sake of getting it done

12:38 manutter: boy do I know the tune to that song... :/

12:38 __name__: xcv: How do you think the MS folks felt about ME?

12:44 xcv: I wonder why it works in the repl but not after compilation?

12:44 that's somewhat of a surprise

12:44 that is, if I just read the whole file into a clean repl

12:44 and run the -main function with the same args, it works

12:45 manutter: what are the symptoms of the failure?

12:47 xcv: I'm getting a null pointer exception from line 187 here http://pastebin.com/XaWEuuSv

12:47 but the same works fine in the repl

12:47 it's from the call to apply

12:49 manutter: I think you can get rid of that apply, since you're only calling it on a constant empty list

12:49 Might change the error msg at least (?)

12:50 :else ((resolve (symbol (str "reduce-" sym)))))))))

12:51 raek: perhaps the NPE is from resolve (since it returns nil if there is no such var)

12:51 ,(str nil)

12:51 clojurebot: ""

12:51 raek: ,(symbol (str nil))

12:51 manutter: or for maintainability: (let [other-fn (resolve (symbol (str "reduce-" sym)))] (other-fn))

12:52 heh, raek had a good thought while I was counting parens in my post

12:53 raek: xcv: you could try to print the value of 'sym' there

12:53 manutter: kill 2 birds with one stone: (if-let [other-fn (resolve (symbol (str "reduce-" sym)))] (other-fn))

12:54 does if-let allow you to specify an else clause (like for error handling)?

12:54 ,(doc if-let)

12:54 clojurebot: "([bindings then] [bindings then else & oldform]); bindings => binding-form test If test is true, evaluates then with binding-form bound to the value of test, if not, yields else"

12:54 manutter: guess so

12:54 raek: (if-let [other-fn (resolve (symbol (str "reduce-" sym)))] (other-fn) (throw (Exception. (str "this symbol is crazy, I tell ya: " sym))))

12:55 amalloy: manutter: when-let is for when you don't need an else clause

12:56 manutter: that makes sense

12:57 I don't quite follow the reference to & oldform in the docstring for if-let, can someone explain what that means?

12:57 amalloy: manutter: if-let used to have some different syntax. don't use it

12:58 something like (if-let x 10 true false)

12:58 raek: I think it's a remnant from old times when if-let didn't have a vector around the symbol and the expression

12:58 xcv: guys, thanks for all the help

12:58 but I've run out of time

12:58 manutter: cool, thanks

12:58 good luck xcv

12:58 xcv: nice community here

12:58 very friendly :)

12:58 gl hf

13:10 ev4l: good morning guys

13:11 manutter: morning?

13:11 Oh, right, internet...

13:11 Good morning :)

13:11 ev4l: manutter: UGT ;)

13:13 kephale: hrm...

13:13 , (let (into [] (mapcat seq {'a 5 'b 7})) (+ a b))

13:13 clojurebot: java.lang.IllegalArgumentException: let requires a vector for its binding

13:24 ev4l: wow, just experienced the reader going crazy when feeding it a messy-spaced multiline map

13:24 it pointed me to an error to my ns declaration

13:25 amalloy: pics or it didn't happen :P

13:27 (maybe "gist or it didn't happen" is more appropriate here?)

13:29 ev4l: amalloy: lol, i'm preparing one :D

13:50 amalloy: https://gist.github.com/932121

13:50 i just used the map in the same format as the gist

13:51 when i removed it, the code would get compiled without errors

13:51 ieure: ev4l, I think your issue is that you didn’t include the [] for the arguments to your method.

13:51 clojurebot: 'Sea, mhuise.

13:51 ieure: So it’s trying to use the map as the docstring for that fn

13:52 amalloy: ieure: eh? he doesn't have a method

13:52 it's a def

13:52 ieure: Ah, I see.

13:52 That’s what I get for parachuting in.

13:53 amalloy: &(let [m {"1" 2}] (m "1"))

13:53 sexpbot: ⟹ 2

13:54 ev4l: amalloy: when i laid out the map the same way you did now it worked

13:57 jkkramer: ev4l: what repl are you using?

13:57 ev4l: jkkramer: hmm... i was using lein repl

13:58 freiksenet: is there an analog of asdf:load-op in lein?

13:58 jkkramer: ev4l: and you got this error when calling (test) or when loading the file?

13:58 ieure: ev4l, For whatever it’s worth, the last Gist you pasted works fine for me.

13:58 ev4l: jkkramer: loading the file

13:59 jkkramer: worked for me too. I regularly spread defs/maps over multiple lines

14:00 ev4l: hmmm... let me try again here

14:04 ieure: ev4l, I just fired up `lein repl' and pasted the code in.

14:11 ev4l: jkkramer: ieure i undoed the code to my initial state and reproduced the error. I copied the map the way it's on my editor

14:12 ev4l: and called lein repl from the project directory

14:12 amalloy: ev4l: the map is not the problem. i don't know what the problem *is*, but saying "it breaks when the map is like this" isn't useful to reproduce - can you post the surrounding code?

14:14 ieure: ev4l, That code also works for me when I paste it into `lein repl'. How are you loading the file?

14:18 patrkris: nå da

14:18 oops

14:37 ev4l: ieure: In the lein repl i type (use 'crazy-reader)

14:37 amalloy: ev4l: i doubt it matters here, but don't use single-segment namespaces

14:38 ev4l: amalloy: oh , i used only for the demonstration. In the original, i use a full one :D

14:39 amalloy: but it's a good thing to know

14:41 ieure: ev4l, Is there perhaps another crazy_reader.clj on your classpath?

14:42 ev4l,h ttps://gist.github.com/7ab089e7e4e0ab16096e

14:42 Er, https://gist.github.com/7ab089e7e4e0ab16096e

14:43 ev4l: ieure: no, that's the only file actually.

14:43 ieure: Hm.

14:43 Sorry, I’m not sure what to tell you. Everything you have pasted works fine for me.

14:44 I’m using "Leiningen 1.4.2 on Java 1.6.0_24 Java HotSpot(TM) 64-Bit Server VM", Clojure 1.2.1, & Clojure-Contrib 1.2.0.

14:48 ev4l: ieure: Leiningen 1.4.2 on Java 1.6.0_24 Java HotSpot(TM) 64-Bit Server VM & Clojure-Contrib 1.2.0

14:53 amalloy: ieure: surroundng code => https://gist.github.com/932309

14:53 i'm just toying around with the enlive-tutorials

14:53 add : [enlive "1.0.0-SNAPSHOT"] to the project.clj

14:54 and try to run (require 'crawlers.core) in the lein repl

14:55 if this code compiles in your machines, that's probably some environmental issue

14:56 raek: ev4l: if you run "file core.clj", what does it say?

14:56 "UTF-8 Unicode text"?

14:57 ev4l: raek: wow

14:57 raek: it gives me nothing

14:58 raek: nothing? which operating system are you using?

14:58 ev4l: raek: i've never seen that empty output before with 'file'

14:58 mac os x leopard

14:58 i'll try to save the gist into the project directory

14:58 raek: anyway, clojure source files are encoded using UTF-8

14:59 and JLine (which lein repl uses if rlwrap is not installed) has broken UTF-8 support

15:02 if you eval (seq "Suíços") in the repl and don't get (\S \u \í \ç \o \s) back, then you have an encoding problem

15:05 ev4l: raek: it seems you are right

15:06 raek: When typing the same map manually it works

15:06 raek: I bet there's a funny character in the text i've copied/pasted initially at the map

15:07 raek: the dreaded "byte order mark"?

15:08 as long as your source files are in UTF-8, you have rlwrap installed and have your terminal configured for UTF-8, everything should work

15:08 ev4l: raek: I evaled at the Lein repl, and ? appeared at the places of í and ç

15:09 (when i pasted the code)

15:09 LauJensen: Any OSX users in here with a Danish/Nordic keyboard setup ?

15:09 raek: ev4l: that has happened for me too with JLine

15:11 (since leiningen 1.5.something, a warning is printed if you don't have rlwrap installed)

15:14 ev4l: have you tried installing rlwrap?

15:14 ev4l: that's what i'll do =]

15:14 thanks a bunch guys

15:21 kolektiv`: hi all, i'm tempted to have a play with clojure, but i'm probably more comfortable in the clr world than the jvm one

15:21 i don't really have a feel for whether clojure-clr is at parity, or whether it's likely to bite me in some way

15:22 can anyone give me a word of advice? thanks!

15:26 TimMc: kolektiv`: I certainly don't hear much of anything about it.

15:27 Don't know if that's due to paucity of implementation or interest.

15:27 kolektiv`: TimMc: that's my hunch - there seems to be very little said, and i'm thinking that will translate in to a lack of support or help if i run in to odd issues...

15:28 ...which may not exist in the jvm sphere

15:34 cemerick: kolektiv`: It's kept pretty up to date with changes happening in HEAD, and I know there are people using it for real work, but there's definitely far less activity around it.

15:35 FWIW, I know of a couple of .NET shops that are now using Clojure and Eclipse for some new projects with success. The transition is apparently reasonable enough, at least in those cases.

15:48 dnolen: cemerick: I see you've got your controversy quota for the next month or so settled :)

15:48 cemerick: dnolen: Ooh, what'd I say this time? :-) Or do you simply mean the HN submission?

15:49 dnolen: cemerick: the submission

15:49 cemerick: heh, yeah. It's not often I get to go karma-whoring.

15:49 The balance of the discussion panned out nicely, I thought.

15:49 Couple of silly sideshows, but all-around positive.

15:50 dnolen: cemerick: I see steve_yegge is now an HN User.

15:50 cemerick: Excellent!

15:50 He should pop in here and we could hash it all out in about 3 minutes. :-P

15:51 ataggart: Rich gave a good coverage about the single-pass thing, which was edifying.

15:51 cemerick: dnolen: is there some kind of feed for new handles being registered or something?

15:52 Yeah, that was great.

15:52 dnolen: cemerick: no his handle is green, signifies new user.

15:52 ataggart: where did this "clojure users hate macros" meme come from?

15:52 dnolen: ataggart: unknown.

15:52 ieure: ataggart, A misunderstanding at best.

15:53 A deliberate mischaracterization at worst.

15:53 ataggart: I blame Christophe's thick accent

15:53 chouser: ataggart: clojure_conj, I suspect, which had a recurring theme of "beware the overuse of macros"

15:53 osoleve: why can I not recur outside of the tail position, and why are self-calls discouraged?

15:54 chouser: osoleve: recur is only slightly more powerful than a goto, and thus only makes sense in a tail position

15:54 osoleve: self-calls are perfectly all right, but consume JVM call stack space which is finite

15:54 cemerick: chouser: afternoon :-)

15:54 bah

15:54 chouser: cemerick: howdy!

15:55 osoleve: chouser, so I should use self-calls, save for in tail position, when I should recur?

15:55 ok, thanks

15:55 cemerick: dnolen: Good luck with the talk tonight.

15:55 Beg someone to record it. :-)

15:56 dnolen: cemerick: it's gonna be a bit ... rough I think.

16:00 Raynes: cemerick: Wow @ Steve Yegge's group posts. It's amazing how quickly he went from high praise in the Joy of Clojure forward to... whatever this is.

16:01 osoleve: general computed science, 0x123 is hex, 0110b is binary...

16:01 whoops, wrong channel :[

16:01 choffstein: How can I make sure my maven repo is added to my clojure class path?

16:02 cemerick: Raynes: you mean: do X, Y, and Z, or "Clojure's dead at the starting gate"?

16:02 Yeah.

16:02 bulters: Raynes: Is he officially against clojure now? :S

16:03 Raynes: bulters: Looks like it, comrade.

16:03 bulters: Only thing I got from that thread is that he doesn't agree with the way the language is designed.

16:03 ataggart: choffstein: you don't. lein will pull the jars into your rojects classpath

16:03 bulters: i.e. the process of ~

16:03 choffstein: ataggart: but what if I want to use clj?

16:04 ataggart: so if I just want to play with a script or not have to create a whole lein project

16:04 sorry -- I mean the clj repl

16:04 opqdonut_: link to yegge's messages?

16:04 ieure: opqdonut_, http://news.ycombinator.com/item?id=2466731

16:04 bulters: + surely; the fact that he 'agitates' in such a way only indicates he want clojure to 'succeed' (definition pending)

16:04 Raynes: http://groups.google.com/group/seajure/browse_thread/thread/18baa18ffdbdd790/917004da1b517f11 This whole thread, opqdonut_

16:04 ataggart: choffstein: you'd have to do what lein does, but manually

16:04 opqdonut_: thanks

16:05 choffstein: Ack. That's ... horrible.

16:05 I assume that is a legacy java issue ?

16:05 ataggart: choffstein: if you want a common set of dependencies, separate from a lein project, try using cake

16:06 choffstein: ataggart: basically, I want to do "lein install ...", then jump into the clj repl and play around with the new library

16:06 Raynes: "If you embrace users, then Rich won't have to publicly beg for money. The

16:06 raek: ataggart: this you can do with cake

16:06 Raynes: money will come naturally as an emergent ecosystem. But you need users!"

16:07 Methinks that was a bit too far.

16:07 cemerick: choffstein: isn't that what `lein repl` is for?

16:07 choffstein: cemerick: I'm obviously a moro

16:07 *moron

16:08 cemerick: choffstein: no worries :-)

16:08 choffstein: herm ... but maybe it isn't working the way I expect it to.

16:09 ataggart: ok, back to portal2

16:10 bulters: Raynes: I'm more worried about the discussion on HN; I'm new to Clojure and will probably need all the help I can get. But indications of people getting "laughed at" always worry me a bit.

16:10 choffstein: Can I not start a new project and simply do a 'lein install' and 'lein repl' in any directory and have access to the libraries I installed?

16:10 dnolen: bulters: people are generally nice here, such statements are overblown.

16:10 Raynes: bulters: I've been here for a while, and I've never seen anything like that. I think people are beginning to make up things about the Clojure community because they have trouble finding real issues.

16:11 choffstein: bulters: as a clojure moron and local village idiot, I have never once gotten laughed at here

16:11 bulters: dnolen: I guess so, have been leeching for a while now, didn't see any laughing yet ;-)

16:11 choffstein: or, at least not while I have been in the chat

16:11 cemerick: bulters: I cannot remember a single time that anyone has ever been laughed at here.

16:11 ataggart: choffstein: lein install doesn;t do what you think it does

16:11 hiredman: cemerick: really?

16:11 dnolen: bulters: people also don't talk to you like you're stupid here. Can't say count how many times that's happened to me in #python and #ruby.

16:12 choffstein: ataggart: I figured. It seemed to -- doing 'lein install inflections 0.4.3' put it in my maven repo ...

16:12 cemerick: hiredman: The log may prove me wrong, I'm sure, but I can't think of a time when it's happened.

16:12 bulters: dnolen: can't vouch for #python... but am too aware of #ruby

16:12 choffstein: dnolen: yeah, #ruby and #ror got vicious a couple years back

16:12 ataggart: choffstein: lein help

16:12 osoleve: in #lisp they're very mean, too.

16:12 hiredman: I must have laughed at some point

16:12 cemerick: hiredman: People certainly have been rude before, which sucks, and I do whatever I can to tamp that down.

16:12 choffstein: ataggart: lein install can install the project specified...

16:12 bulters: Seems to be a tendency of rubyists (or rails-ists more particular) to smack down 'newbies'.

16:13 choffstein: bulters: I think it is because the space is so competitive now

16:13 bulters: Can see it happening in the office sometimes.

16:13 ataggart: choffstein: the missing part of that sentence is "... into your local maven repo"

16:14 choffstein: ataggart: ...but it did

16:14 bulters: choffstein: which sucks... the only competition i see in programming (itself) is against a deadline; or your competitors

16:14 KirinDave: I knew I shouldn't have gotten involved in that news.ycomb thread. :(

16:14 It is only a mistake when I talk to people.

16:15 choffstein: bulters: I agree. As someone who used Ruby for about 5 years now, it makes me sad. I've pretty much stopped using it for Clojure at this point.

16:15 ataggart: choffstein: ok then I'm not clear on what you want. create a project; configure the project.clj file to specify what the dependencies are; run lein repl

16:15 bulters: KirinDave: why is it a bad thing? Did someone get hurt

16:16 I mean... physically!?

16:16 KirinDave: bulters: No.

16:16 choffstein: ataggart: I don't want to have to create a project. I want to just download a library to my maven repo and run the repl and have the library available. I don't want to have to create a project

16:16 hiredman: KirinDave: I think the point is a. common lisp is dumb, and b. I will certainly laugh when people do ridiculous things, just like I laugh at america's funniest home videos

16:16 KirinDave: hiredman: Yes. You were the one I was referring to. Directly.

16:16 ataggart: choffstein: well it doesn;t work that way.

16:17 hiredman: KirinDave: :)

16:17 choffstein: ataggart: Is there any way to do it? Because there should be. I shouldn't have to create a new project just to try out a new library.

16:17 ataggart: I'm assuming my ignorance is getting in my way

16:17 KirinDave: hiredman: Seriously man. Why you gotta hate on macros? Esp when it ended up being a known issue with aot-compilation in 1.2.

16:17 arohner: choffstein: you can java -cp clojure.jar:your_new_jar clojure.main

16:17 ataggart: choffstein: lein is a tool for projects. you don;t want a project. so there's a mismatch

16:18 KirinDave: Macros: Not dumb sometimes. Anyways.

16:18 hiredman: KirinDave: hate macros?

16:18 choffstein: gotcha. alright...

16:18 dakrone: hiredman hating on macros?

16:18 KirinDave: I am just stunned weavejester prefers %1 + %2 * 2 vs _ + _ * 2.

16:18 Pretty bummed that we're in such opposed opinions.

16:18 hiredman: KirinDave: what happens when you want to refer to the first argument twice?

16:18 bulters: KirinDave: _'s just look more like prologs anonymous variables ;-)

16:18 KirinDave: hiredman: You use fn.

16:19 hiredman: It's a convenience syntax.

16:19 But also the two are not mutually exclusive. Indeed any improvement to the lambda convenience syntax would require a transitional period. I just find #() prohibitively noisy in my code.

16:19 cemerick: KirinDave: Is the look of anonymous fn syntax really that much of an irritant that you'd want to pull it for something less useful?

16:20 hiredman: dakrone: apparently I hate macros

16:20 KirinDave: cemerick: Well the degree of discourse far outweighs my actual passion for the subject at this point.

16:20 ataggart: KirinDave: _ + _ is a scala lambda?

16:20 KirinDave: ataggart: yes.

16:20 hiredman: Not quite what I said.

16:20 hiredman: Let's not get into it.

16:20 cemerick: But yes.

16:21 hyperboreean: hi guys, how can I find out the absolute path of a file from clojure ?

16:21 KirinDave: cemerick: I feel the utility of a convenience syntax for anonymous functions is in the readability & brevity it offers.

16:21 ataggart: hyperborean: (.getPath file)

16:21 hiredman: KirinDave: "The clojure version is obviously more noisy." doesn't actually seem to be obvious given the disagreement about it

16:21 KirinDave: cemerick: While #() is very brief, I consider it less than a stellar performer in the reability part.

16:21 ataggart: or .getAbsolutePath or .getCanonicalPath

16:21 KirinDave: hiredman: I don't think people are saying, at any point, that the scala version is arguably more noisy.

16:22 Chousuke: I don't find #() noisy :/

16:22 KirinDave: hiredman: The question is the value judgement of reducing the power of the syntax to make it contain less hash.

16:22 Chousuke: It's a relative thing.

16:22 bulters: KirinDave: so how DO (for emphasis) you would like to see anonymous functions?

16:22 Chousuke: the scala version is weird. does _ always refer to the same argument?

16:22 cemerick: Chousuke: they're positional

16:22 KirinDave: Chousuke: Nope. it's a blank. It's positional.

16:22 Yes, that reduces the power of them.

16:22 cemerick: No rest args either, if memory serves.

16:23 KirinDave: Correct.

16:23 Chousuke: That sounds confusing to be honest.

16:23 KirinDave: Chousuke: I think that evidence suggests it is not.

16:23 Chousuke: Esp for very simple cases.

16:23 ataggart: For very simple cases, who cares?

16:23 hyperboreean: ataggart: thanks

16:23 KirinDave: ataggart: They come up a lot.

16:23 cemerick: I don't think there's much of anything like "evidence" re: programming language design.

16:23 ataggart: de gustibus non est disputandum

16:24 I don;t see how you could have a "better" syntax for an anonymous function.

16:24 I'd like to see it though

16:24 one that isn;t just syntax magic

16:24 Chousuke: I can sort of see how #() might get unreadable if you overdo it but usually it's pretty easy I think.

16:25 KirinDave: What is #() but syntax magic anyways?

16:25 hiredman: there was just some ibm article linked somewhere about quantitative language design

16:25 bulters: Chousuke: then don't overuse it :P

16:25 Chousuke: bulters: yeah :P

16:25 KirinDave: I just don't get why people like having perlisms in their code.

16:25 ataggart: KirinDave, from the examples you gave on hn, it seems your problems were with parenthesis/prefix-notation

16:25 KirinDave: %1 %2, etc.

16:25 So perlish.

16:26 ataggart: hardly.

16:26 bulters: Chousuke: I thing in about every language you can overuse some features, perl has sigils, python has whitespace (sorry :P), ruby has prettification

16:26 ataggart: then please suggest a workable alternatuve

16:26 bulters: think**

16:26 cemerick: KirinDave: I think it was originally intended to align with e.g. format

16:26 stabin: Hi all, trying to call getSuperclass() method on some Class instance. The first, straightforward code I wrote did not work - (. java.util.ArrayList getSuperclass) tries to call static method on ArrayList and fails with NoSuchMethod. Slightly modified version works: (let [foo java.util.ArrayList] (. foo getSuperclass)). Just curious - is there any way to write this without intermediate variable (which just does not seem nice to me)?

16:27 KirinDave: cemerick: Okay.

16:27 Chousuke: KirinDave: you need to change your font so that % is something more visually pleasing :D

16:27 KirinDave: Chousuke: Like unicode snowman

16:27 ataggart: We could start by making % substitutable with _ for single argument lambdas.

16:27 bulters: Now THAT would be a huge improvement

16:27 Chousuke: Yes, ☃ for everyone

16:28 hiredman: ·!

16:28 cemerick: stabin: The "lone dot" form of interop is the most primitive, and rarely used; try (.getSuperclass java.util.ArrayList)

16:28 ataggart: KirinDave: except that woud break the community standard of using underscores for ignored parameters

16:28 KirinDave: ataggart: It doesn't have to.

16:28 ataggart: How would that ever collide?

16:28 Chousuke: KirinDave: it wouldn't but it'd overload the meaning of _

16:28 stabin: cemerick: thanks, it works and looks nice enough :)

16:28 hiredman: (fn [_] #(+ _ _))

16:29 KirinDave: Chousuke: No one asked for a perfect solution, only a workable one.

16:29 hiredman: collision

16:29 bulters: KirinDave: It introduces 'ambiguity' the accepted use of _ as a throwaway placeholder, or as a language construct in the case of a lambda

16:29 Chousuke: hiredman: not really, in that case the _ function parameter is just shadowed

16:29 * KirinDave sighs.

16:29 Chousuke: hiredman: and since you're ignoring it, closing over it is not what you want

16:30 bulters: KirinDave: no sweat; nobody got hurt (yet ;))

16:30 KirinDave: hiredman: Besides, I said in % cases.

16:30 Few people would actually WANT that piece of code, so if it's an ugly edge case, it's probably not a foul.

16:30 ataggart: so to be clear, #(foo _(bar _ _) _) is cool?

16:30 KirinDave: What is _(

16:30 ataggart: a missing space

16:31 KirinDave: Ah

16:31 Chousuke: so does that take 4 arguments or just one? :/

16:31 ataggart: 4

16:31 KirinDave: I suppose, although again few people would write #(foo % (bar % %) %)

16:31 bulters: #(foo % (bar % %) %)

16:31 hmm

16:31 ataggart: but % is an alias for %1

16:31 KirinDave: Actually for now, we're saying _ means first argument. So it'd be _ => %1

16:32 ataggart: I;m trying to guage what you find distasteful, aesthetically

16:32 I bet you could write a macro to do that underscore/positional thing

16:33 KirinDave: Yes.

16:33 Its easy.

16:33 ataggart: do eet

16:33 KirinDave: It's in com.banksimple.clj-utils. Will be open sourced soon enough.

16:33 It's just... it's of more value to readers than writers.

16:34 ataggart: I'm inclined to think anything like that should probably not be an anonymous fn

16:34 cemerick: KirinDave: Perhaps it's fair to say that the underscore syntax is most valuable with those that are used to underscore syntax…

16:34 s/with/to

16:34 sexpbot: <cemerick> KirinDave: Perhaps it's fair to say that the underscore syntax is most valuable to those that are used to underscore syntax…

16:34 bulters: ataggart: that's a complete different discussion i guess.

16:34 KirinDave: cemerick: Of which there is probably a greater number than those familiar with #( %1) syntax, as that's like pretty much only clojure. :)

16:35 ataggart: %1

16:35 nor #(%1)

16:35 s/nor/not

16:35 sexpbot: <ataggart> not #(%1)

16:35 ataggart: sonce we'd keep the #(), right?

16:35 KirinDave: ataggart: Maybe?

16:35 cemerick: KirinDave: positional underscores being the most widely-known anon fn syntax?

16:36 ataggart: could we mix and match _ with %n?

16:36 KirinDave: cemerick: I suspect the most widely known fn syntax is function() {} or perhaps { |x| ... }

16:36 ataggart: Perhaps.

16:37 technomancy: % clearly has more pixels than _

16:37 KirinDave: It has a higher ascender too.

16:37 :)

16:37 cemerick: KirinDave: I know, I was being sarcastic re: how _ is so well known :-)

16:37 KirinDave: cemerick: Haskell and ocaml, right?

16:37 Although for slightly different meanings

16:37 * KirinDave shrugs

16:37 KirinDave: Like I said tho, the degree to which the debate has grown far outstrips my personal passion for this issue.

16:37 cemerick: KirinDave: Clearly evidentiary. ;-)

16:37 Chousuke: what was that quote about the relation between the amount of discussion and the importance of an issue? :)

16:38 KirinDave: It's easy to spiral off into endless debates about syntax minutiae .

16:38 Something I care far more about is scheme-style pattern macros.

16:38 bulters: but the fact that you can change it yourself says enough about clojure I guess...

16:38 Chousuke: Well those you can implemen as a library I think

16:39 cemerick: KirinDave: someone was working on those in here just a little while ago…

16:39 * cemerick can't remember the handle at the moment

16:39 Chousuke: I'm sure some people would welcome such an effort. Personally, I find Clojure's system nice enough.

16:39 KirinDave: Chousuke: You can, and clojure actually does a lot of the work for you.

16:39 dnolen: cemerick: as qbg, it's now abandoned as far as I can tell, and the scope was too large.

16:39 ataggart: I'll say this much: KirinDave's kvetching seems to have more substance than yegge's

16:39 dnolen: s/as/was

16:39 sexpbot: <dnolen> cemerick: was qbg, it's now abandoned was far was I can tell, and the scope wwas too large.

16:39 Chousuke: Though it might just be that I don't know what I'm missing.

16:40 KirinDave: ataggart: I actually know a few dialects of lisp, Yegge doesn't really.

16:40 ataggart: release that macro!

16:40 dnolen: KirinDave: my question is why don't you build this macro frontend push it into contrib? that's the only reason it hasn't happened as far I can tell.

16:40 cemerick: https://github.com/qbg/syntax-rules

16:40 KirinDave: Chousuke: Pattern-based macros great for a lot of macros because they bring error reporting to the table. Got an error in your macro? Good luck with that.

16:40 cemerick: dnolen: abandoned, really?

16:40 KirinDave: dnolen: I should.

16:40 Oh rad.

16:40 I hadn't seen this yet.

16:41 ataggart: KirinDave: I thought clojure had pattern macros

16:41 coulda sworn

16:41 bulters: KirinDave: That's more of a debugging thing right? :P

16:41 dnolen: cemerick: last commit in Jan, I followed it closely.

16:41 KirinDave: bulters: No, they often are shorter and more declarative than defmacro macros, too.

16:41 cemerick: dnolen: maybe it's simply perfect as it is. :-P

16:41 ataggart: KirinDave: is this what you mean? http://clojure.github.com/clojure/clojure.template-api.html

16:41 KirinDave: ataggart: That's kinda the start of it.

16:41 bulters: KirinDave: I was referring to the error thing

16:42 technomancy: didn't clojure.template get promoted solely to support clojure.test? it's my recollection nobody else has ever used it.

16:42 KirinDave: bulters: Well yeah, but an error in a macro can be a terrible thing. See also enlive when your html file is missing.

16:42 bulters: See http://pre.racket-lang.org/docs/html/guide/pattern-macros.html

16:42 bulters: rotate is a good macro to check out the implementation in defmacro of.

16:43 it's _much_ less obvious what's going on there.

16:43 choffstein: Okay. I think I am still really confused. In ruby, I can do a "gem install" and after setting gem_path, "require" from irb and play with the new library without ever having to set up a new project. With lein, I can do "lein install library version" and get the library into my maven repo. Can I somehow set my java class path so that when I use clj I can just (use ...) the new library?

16:43 dnolen: KirinDave: I would love to see a faithful implementation of syntax-rules w/o a bunch of extra stuff. qbg was working on error detection but didn't get very far I think.

16:43 ataggart: choffstein: because you local maven jars are not made available to every java instance

16:43 technomancy: choffstein: you probably want cljr or jark or some such. leiningen is for managing projects.

16:43 KirinDave: dnolen: I should get on that. Having a serious startup job has really kicked the legs out from under my independent hacking efforts.

16:43 ataggart: choffstein: that's what the classpath is for

16:44 choffstein: ataggart: But can I make them?

16:44 ataggart: them?

16:44 choffstein: ataggart: my jars available to every java instance.

16:44 KirinDave: A lot of people from common-lisp vampire bloodlines are not familiar with how badass syntax rules can get.

16:44 ataggart: no

16:44 choffstein: I obviously am having trouble comprehending the "java way"

16:44 ataggart: bad idea is bad

16:45 technomancy: choffstein: it certainly comes down to a weakness of the JVM

16:45 choffstein: Can you explain why, por favor? I assume something to do with how the JVM works?

16:45 dnolen: KirinDave: for day-to-day macros, they are much more readable, for more involved transformations, yuk.

16:45 bulters: KirinDave: Ok, so probably this discussion is not really 'my place'; since I have little to no understanding of macro internals (i.e. how they work internally)

16:45 technomancy: choffstein: you can't reliably change the classpath at runtime

16:45 ataggart: choffstein: get cake, configure the default project.clj and be done with it

16:45 unless lein aded support for a default project.clj

16:46 KirinDave: dnolen: Yep. That's why one needs both.

16:46 choffstein: ataggart: how does that help if I install a new library?

16:46 bulters: KirinDave: But the proplem you state is that debugging in such a macro (perhaps more complex) is difficult due to the fact that - in clojure - it's based on normal macros?

16:46 KirinDave: dnolen: defmacro is the portable particle cannon. syntax-rules is the raygun.

16:46 bulters: Syntax rules macros are based on pattern matchers.

16:46 choffstein: ataggart: I don't want to have to edit the projects.clj file. That's my whole point. I don't want a project. I want to just play in a repl.

16:46 Chousuke: bulters: clojure's macros are pretty simple... Just a datastructure transformation, basically

16:46 KirinDave: Chousuke: yes.

16:46 bulters: So you basically define little declarative programs to do syntax transformation

16:46 ataggart: choffstien: it doesn;t work like that. sorry.

16:47 KirinDave: bulters: The generation of these programs could include error reporting.

16:47 Chousuke: bulters: syntax-quote and such things are just tools to make creating code data structures easier

16:47 cemerick: choffstein: I'm not familiar with Ruby; what happens when you have multiple versions of the same library installed?

16:47 KirinDave: cemerick: You suffer in despair. OR you know about it and use gem_require with a version tag. Which usually works. Not always.

16:48 ataggart: choffstien: classpath is a pin to adapt to when youi;re used to "installing" libraries that are globally available. But it has its advantages too

16:48 choffstein: cemerick: do you mean libraries A and B depending on different versions of C? All taken care of behind the scenes.

16:48 cemerick: And you can specify a version you want to use when you require the library

16:49 bulters: KirinDave: So a syntax rule is like a - and please excuse my oversimplification - syntactic sugar macro?

16:49 ataggart: choffstien: why the aversion to specifying what your dependencies are explicitly?

16:49 cemerick: choffstein: ah -- you want something like Groovy's grape, but for Clojure.

16:49 choffstein: ataggart: okay. So if you want to try out a new library in isolation, how do you do it?

16:50 ataggart: open project.clj, add the dependency, run cake

16:50 KirinDave: bulters: Yes, but it's not exactly a 1:1 translation

16:50 bulters: Most syntax-rules macros produce program fragments which can then be fed to defmacro

16:50 choffstein: gotcha. so just create a 'playground' project, add the dep, install, run the repl and have fun

16:50 KirinDave: (and when I say this I say this in a conceptual sense, it is not literally what happens)

16:50 bulters: KirinDave: but that's true for normal macro's as well right?

16:51 cemerick: choffstein: no need to install in that context

16:51 KirinDave: bulters: Yes, but normal macros are imperative.

16:51 ataggart: choffstien: no install; delete install from your vocabulary

16:51 choffstein: okay. removing it from my vocabulary.

16:51 * cemerick now thinks choffstein is our third bot ;-)

16:51 KirinDave: Syntax-rules are declarative, so you end up with a more powerful (albeit somewhat restricted) set of functionality.

16:51 choffstein: ;)

16:52 And that process is necessary because of JVM requirements, or just because nobody has built the right tool?

16:52 Raynes: choffstein: Cake has a concept of a default project. That is, a top-level project that you can put dependencies in like you would normally and then when you run commands (such as cake repl) outside of a project (such as just to get an REPL running), cake will use that global project. This is probably what you're looking for.

16:52 cemerick: choffstein: the latter

16:52 KirinDave: choffstein: Some from column a, some from column b. We are bound, at some point, to the ecosystems of the java world.

16:52 Raynes: That process is necessary because you aren't using cake or jark, from what I can gather.

16:52 choffstein: Raynes: Seems sort of like what I am looking for ... but I don't really want to have to specify the deps. I'd rather just everything be included by default. Or, have it dynamically get included as I use it...

16:53 KirinDave: As interesting as this has been, I really should get back to work. For those I offended, I beg pardon. :)

16:53 Raynes: Right, understood.

16:53 cemerick: choffstein: Groovy provides a dynamic classpath extension mechanism that is maven-repo-aware called grape. I've thought about giving a shot at implementing a corollary for Clojure, but it's not been a high priority for me.

16:54 choffstein: cemerick: taking on that project may be above my clojure abilities, but I'll check it out. Thanks :)

16:54 bulters: KirinDave: Sorry for being such a noob on this. Thanks for putting up :P

16:54 Raynes: cemerick: It should be. It would be so much easier to explain things with something like that around.

16:55 cemerick: Raynes: Oh, I'll get right on it, then. ;-)

16:55 Raynes: Good boy. :p

16:55 bulters: *keeps refreshing cemerick's github page*

17:00 hyperboreean: I need some help with this issue: http://pastebin.com/fVikhX5Y ; is it coming from lein or is just me doing something wrong ? Thanks :-)

17:05 arohner: hyperboreean: try lein run -m gen-bundle.core

17:05 i.e. - rather than _

17:06 ataggart: (ns gen_bundle.core)

17:07 arohner: doesn't lein run require there be a main method?

17:08 raek: the lein run that comes with leiningen nowadays does, the plugin it was based on doesn't

17:09 hyperboreean: quick fix: change (ns gen_bundle.core) into (ns gen-bundle.core) and rename do-something to -main

17:09 bulters: *off to work*

17:10 raek: (the filename should still be gen_bundle/core.clj and the command as arohner showed)

17:13 hyperboreean: raek: that worked, thanks

17:21 raek: hyperboreean: oh, and remove the call to (-main), since lein will call it for you

17:35 semperos: trying out the vim Clojure dev experience; using pathogen, trying to use paredit.vim (copied out of Slimv) with Vimclojure, can't seem to get paredit.vim loaded; any takers?

17:47 devn: cemerick: hurry up with the atlas already!

17:48 * devn fidgets

17:49 cemerick: devn: :-D

17:49 I'm burning down the rough cut of the ontology right now.

17:49 devn: cemerick: also, anything I/we can do to help?

17:50 cemerick: Only ~300 vars to go.

17:50 devn: just core at the moment or are you taking it further?

17:50 cemerick: Yeah, just the standard lib.

17:51 Once I have a rough cut of the ontology, I'm bringing in a couple of beta testers.

17:51 Once it doesn't absolutely, completely suck, I'll open things up entirely. The thing probably won't be functionally done for another month or so though.

17:51 * devn raises his hand like a kindergartener

17:51 cemerick: Lots of content to be written.

17:51 devn: pick me!

17:52 cemerick: devn: Shoot your email to help@clojureatlas.com :-)

17:52 The private beta list is now closed.

17:52 * cemerick avoids the rush of other irc denizens.

17:52 amalloy: hah

17:52 * devn runs

17:54 cemerick: devn: Thanks for the offer of help, but I'm going solo on this one, at least until it's out there. Then people can raise tickets and such through uservoice as needed.

17:55 devn: cemerick: *nod*

17:56 cemerick: I've yet to formulate a proper plan for third-party libs though. Lots of options.

17:58 devn: http://news.ycombinator.com/item?id=2467809

17:58 ^cool.

17:59 cemerick: Yeah, not an easy one I'm sure

17:59 cemerick: i would imagine there's an extremely active effort to avoid scope-bloat on your first pass

18:00 cemerick: devn: if things go *really* well, I'd like to build similar services for other languages. That will necessitate some process for collaborations, etc.

18:00 devn: cemerick: reporting programs vs transactional programs and all of the inherent complexity that falls out of the combination of those systems...

18:01 cemerick: very cool -- ive had an idea for awhile that runs parallel to yours I think: a semi-agnostic relationship-finder-thing for source code

18:02 I was thinking about it while playing with Racket -- I really enjoyed the way you could mouseover and see arrows between bound vars, etc.

18:02 cemerick: I haven't touched racket / PLT in sooo long…

18:03 devn: I've just been toying around going back to the "roots" so to speak

18:04 So much history to glean ever since I began to <3 lisp

19:01 osoleve: how do i test if a character is a digit-char?

19:01 e.g. \3 => true, \a => false

19:01 amalloy: &(Character/isDigit \a)

19:01 sexpbot: ⟹ false

19:01 amalloy: &(Character/isDigit \b)

19:01 sexpbot: ⟹ false

19:01 amalloy: &(Character/isDigit \1)

19:01 sexpbot: ⟹ true

19:01 osoleve: thank you

19:02 amalloy, you missed my substantive question earlier! D:

19:02 amalloy: oh, on SO? yeah, i was asleep when you posted it and the answers seemed adequate by the time i saw it

19:02 osoleve: no, here.

19:03 did i post on s/o? hm

19:03 * osoleve checks

19:03 amalloy: no, probly not

19:03 osoleve: weird thing is, i dreamt i did

19:03 so i genuinely wasn't sure

19:03 amalloy: osoleve: but there was someone whose name i don't remember. he asked a question in the comments, and i was like "plz post a real question"

19:03 figured maybe it was you

19:04 osoleve: hahaha

19:04 no, i'veyet to post anything Clojure-related on there

19:24 * osoleve beeps

19:29 seancorfield: i have a situation where i need a particular symbol to only exist after another function is called

19:29 my temptation is to put the (def some-symbol ...) inside the body of (defn other-fn ...)

19:29 it works but ... it feels dirty

19:29 hiredman: def has nothing to do with symbols

19:30 seancorfield: bad phrasing on my part

19:30 hiredman: def creates vars

19:30 seancorfield: yes, i know really

19:30 hiredman: there are other ways to create vars

19:30 seancorfield: pretend i said var instead of symbol :)

19:30 hiredman: you may be better over using something like a promise

19:31 seancorfield: well, this is part of an API that is called from outside

19:32 if i have a top-level (def my-var ...) then it is defined and bound when the ns is loaded, right?

19:32 hiredman: yes

19:32 seancorfield: but i need it to be an error to attempt to reference my-var until other-fn has been called by the external code

19:33 KirinDave: Well, I may be wrong...

19:33 hiredman: sounds like a bad idea

19:33 KirinDave: But at least I am not outdated.

19:33 seancorfield: i did say it felt dirty :)

19:33 KirinDave: Like this guy, who is both wrong and terribly outdated: http://corbinsimpson.com/entry/take-a-bow

19:33 seancorfield: (but it does work)

19:33 hiredman: what you want is somethine like (def x (delay do stuff)) then (force x) at the start of your functions

19:34 and x should be :private

19:34 seancorfield: why :private ?

19:34 hiredman: if it isn't part of the api, don't expose it

19:35 seancorfield: it _is_ part of the API but it isn't valid until the other-fn has been called

19:35 pdk: ,(* (/ 770 1024) 100)

19:35 clojurebot: 9625/128

19:35 hiredman: seancorfield: part of in what sense?

19:35 pdk: :|

19:35 ,(double (* (/ 770 1024) 100))

19:35 clojurebot: 75.1953125

19:35 hiredman: is it a function?

19:36 seancorfield: the outside code must be able to reference this as a variable that has been evaluated (to a map) but only after it calls other-fn

19:36 hiredman: :(

19:36 why?

19:36 clojurebot: why not?

19:36 seancorfield: it's a weird edge case but them's the requirements

19:36 hiredman: I doubt it

19:37 it sounds kind of like a resource that you open, get some kind of 'cookie' passthrough another set of functions, then close

19:37 in which case there are ways to do that (with-open [..]) etc

19:37 seancorfield: after calling other-fn, my-var is valid and can be accessed for the rest of the life of the program

19:37 the outside code is _not_ clojure

19:37 hiredman: so?

19:38 doesn't mean it has to be bad

19:38 seancorfield: there is no "close" here

19:38 consider other-fn to be some sort of initialization for the rest of the stuff in that namespace

19:38 hiredman: if you really want this, as I said, I would use a promise, which would atleast avoid race conditions

19:40 seancorfield: i don't think outside code can deal with a deref'able object but i'll check

19:42 alekx: hi all! Is Compojure still the simplest web framework in Clojure?

19:42 seancorfield: hmm, actually i might be able to use a derefable

19:43 trptcolin: alekx: define simple :)

19:43 technomancy: vars are IDeref.

19:43 brehaut: alekx: i think that depends on how you measure simple

19:43 alekx: basic (?)

19:43 brehaut: alekx: if you mean easiest to get off the ground quickly, then yes

19:43 alekx: let's say something that would allow a Clojure newbie to get started easier

19:43 trptcolin: compojure's great, yeah

19:44 brehaut: alekx: i personally find that moustache is actually simpler in practise, but it comes at a cost of being a little less… obvious

19:44 alekx: (the Clojure newbie is me is there're any doubts :)

19:44 used moustache before... but isn't that just a template engine?

19:44 brehaut: alekx: i have a blog draft about all this if you would be interested in proof reading

19:44 alekx: different moustache i believe

19:45 alekx: moustache in clojure fills a very similar role to compojure

19:45 alekx: brehaut: absolutely

19:45 brehaut: I'm not much into moustaches so the only one I knew about is the templating engine

19:46 someone told me about #clothesline... any feedback?

19:46 short story: Clojure newbie with new CloudFoundry account willing to push both forward

19:47 trptcolin: that sounds like a question for KirinDave ^

19:47 KirinDave: What does?

19:47 trptcolin: alekx was asking about clothesline

19:47 KirinDave: Ahh

19:47 I like it. :)

19:48 trptcolin: i hear you had something of a hand in that

19:48 :)

19:48 KirinDave: yes, there are many of my opinions in that code.

19:48 Although excitingly enough, I just got some good patches for it.

19:48 Most of my projects die in obscurity.

19:48 trptcolin: i've been wanting to look into it, just haven't had a chance to yet

19:49 brehaut: likewise

19:49 alekx: summarizing: 1) compojure seems to remain the top one; 2) there's also (some) moustache and clothesline

19:49 but for a #Clojure newbie Compojure should be quite easy to get started

19:50 thanks

19:50 brehaut: alekx: its important to note that none of them are frameworks in isolation

19:50 trptcolin: alekx you might also take a look at http://mmcgrana.github.com/2010/03/clojure-web-development-ring.html

19:50 technomancy: alekx: doesn't cloudfoundry already support Clojure via war deployment?

19:50 brehaut: alekx: they are all libraries in an ecosystem

19:51 trptcolin: compojure is built on top of ring

19:51 or ring extracted from compojure, or some similarly close relationship

19:51 alekx: technomancy: I assume you should be able to deploy it with a war... but I still need to build my app right? :)

19:51 brehaut: ring grew seperately to compojure, andthen compojure was rewritten in terms of it

19:52 alekx: ring is something related to request/response processing?

19:52 brehaut: (at 0.4.0, at which is also when clout and hiccup became their own projects)

19:52 technomancy: alekx: the lein-ring plugin turns ring projects into war files

19:52 alekx: well, I'll have to read first, as I don't want to abuse your time

19:52 ieure: I have hacked on some Compojure/Ring stuff, and it has been incredibly pleasant.

19:52 KirinDave: lein-ring is pretty cool for elastic beanstalk deploys.

19:53 brehaut: alekx: its an interface for http functions

19:53 ieure: The lein-beanstalk plugin is also amazing.

19:53 Yeah.

19:53 KirinDave: I've sent clothesline services To The Cloud that way.

19:53 technomancy: alekx: not to say there's nothing to be done, but it might involve more documentation than coding

19:53 ieure: if __name__ == '__main__': print "Wrong channel"

19:53 __name__: Wrong channel.

19:54 alekx: thanks a lot guys

19:55 seancorfield: hiredman: i was able to use a derefable object in the end - i tested it with an atom but i might look at a promise since that would be cleaner i think

19:55 hiredman: definitly

20:11 devn: ,(doc reify)

20:11 clojurebot: "([& opts+specs]); reify is a macro with the following structure: (reify options* specs*) Currently there are no options. Each spec consists of the protocol or interface name followed by zero or more method bodies: protocol-or-interface-or-Object (methodName [args+] body)* Methods should be supplied for all methods of the desired protocol(s) and interface(s). You can also define overrides for meth...

21:23 osoleve: what's the call stack limitation on the JVM?

21:30 amalloy: osoleve: question too vague? the limitation is, when you have a call stack too deep to be contained within the limits set at jvm start time, it breaks

21:31 chewbran1a: hi all, what's the best way to handle using a github repo as a dependency in leiningen? basically I need to use a patched version of clj-http not available on clojars, and to make it more complicated, I'm using other libraries that depend on a clj-http version from clojars, not sure how to handle this

21:31 osoleve: hmm, okay. then there must be a show-stopping bug somewhere in my code that's causing this.

21:31 thanks

21:42 brehaut: chewbran1a: lein install will install a local version

21:43 chewbran1a: but there is no way to depend on a repo in lein (by design) if i recall correctly

21:43 amalloy: brehaut: checkout dependencies?

21:44 brehaut: amalloy: pass

21:44 amalloy: i don't use lein, but isn't that what they're for?

21:44 brehaut: i didnt think it had them. im likely wrong though

21:45 huh

21:45 * brehaut reads the documentation and learns things

22:02 devn: chewbran1a: figure it out yet?

22:04 chewbran1a: fwiw you could setup a really simple FTP repository for your version and set :repositories {"my-repo" {:url "http://.../foo"}}

22:04 chewbran1a: https://github.com/technomancy/leiningen/blob/master/sample.project.clj

22:16 chewbran1a: brehaut: devn yeah the local repository is a good idea, only issue is that one of the other clojars I'm using depends on clj-http 0.1.1 and I'm using a patched version of 0.1.2, so not sure how thats going to work

22:16 sorry for the delayed response, in the process of messing with this I completely broke some other dependencies and now I'm trying to fix that

22:27 johnmn3: hi

23:33 gjahad__: hey phil, i sent you email

23:35 about swank-cdt

23:36 the problem is it can't find tools.jar

Logging service provided by n01se.net