#clojure log - Apr 22 2012

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

0:00 kovasb: regarding the syntax, I was looking at examples in clojurescript core; deftype and extend-type treat the arity grouping differently

0:01 mmarczyk: hm, true

0:01 possibly worthwhile to unify syntax, or have both handle both options

0:02 kovasb: yeah, I just assumed the syntax was the same

0:02 since everything else looked the same on first glace

0:02 (doesn't make a whole lotta sense for it to be different)

0:02 mmarczyk: sure

0:02 kovasb: lemme try it on my actual code now..

0:05 no errors! thanks for the help

0:05 lynaghk: mmarczyk: thanks for all of your work on the cljs internals

0:06 I'm really stoked about all of these performance improvements = )

0:06 mmarczyk: lynaghk: not at all, it's really a fantastic experience

0:06 amalloy: i think it's different for sorta implementation reasons. deftype prefers to inline method bodies implementing the backing interface, so each method body is separate; extend-type is shoving functions into a map, so it wants one function with N bodies

0:07 mmarczyk: amalloy: ah, good point

0:07 lynaghk: mmarczyk: the crucial ingredient for excellent work.

0:07 amalloy: it's definitely possible to make them support the same syntax, of course, and still probably a good idea

0:07 kovasb: amalloy: thats interesting. The syntax is still inconsistent with defn tho

0:08 i would prefer to be able to write defn in separate cases like that

0:08 but without that, better for deftype to support a superset

0:09 that includes the defn style

0:16 lynaghk: Is there a nice way I can redefine the print function for an atom? (Subclassing and overriding print, basically). The best I can think of is to either use deftype and copy the implementation of atom, or use reify to proxy to an internal atom and just forward the methods. Both feel gross.

0:20 danlarkin: why do you think you need to do that?

0:22 lynaghk: I'm using atoms to represent state machines, and it'd be nice if they printed to the console just showing the current state rather than a huge nested map structure filled with anonymous fns.

0:22 danlarkin: write a format-machine function :)

0:23 lynaghk: danlarkin: yeah, but that won't make lookin' at them any nicer on the console

0:24 And I'm developing the library at the moment = )

0:24 kovasb: lynaghk: is this cljs or clj?

0:24 danlarkin: can't you call format-machine from the console?

0:24 I don't see why that's any harder than derefing the atom

0:24 lynaghk: danlarkin: yeah, but it's not automatic! =P

0:24 kovasb: danlarkin: not if u want to see it embedded in other structures

0:25 lynaghk: kovasb: I'm writing it out in Clojure, but I'm using CLJX so the library will be for both platforms.

0:25 kovasb: lynaghk: in cljs at least, printing is defined in terms of protocols

0:25 lynaghk: kovasb: the motivating use case is managing rich apps built in ClojureScript.

0:25 kovasb: lynaghk: which i believe means you cannot override the implementation for existing types

0:26 lynaghk: but makes it easy to implement for your own type

0:26 lynaghk: kovasb: yeah, I was wondering if there was any clever way to do effectively that without defining a new type and all of the associated implementation

0:26 kovasb: lynaghk: though, there seem to be a variety of print functions, not sure if there is a way to intercept one of them

0:26 lynaghk: (that = override print method implementation)

0:26 danlarkin: please do not implement your own atom just to override .toString

0:27 that is so 100% crazy

0:27 lynaghk: danlarkin: I know, that's why I wanted to ping the IRC first = )

0:27 mmarczyk: lynaghk: redefine print-method for atom to check the atom's metadata for a key indicating that it's a state machine?

0:27 kovasb: if you look at the atom definition in cljs, it is totally trivial

0:27 lynaghk: mmarczyk: yeah, I thought about that too. I think it might be the best option here

0:28 kovasb: yep, I was surprised when I first read it, but after some thought there's not really anything else to atoms.

0:29 kovasb: what kind of state are you keeping in the atoms?

0:31 lynaghk: kovasb: it's similar to ibdknox's Waltz library: the atom has a map of states, events, and a set describing the current states the machine is in

0:31 (it can be in more than one state at the same time)

0:31 kovasb: lynaghk: cool. how does that relate to helping with webapps?

0:32 lynaghk: mmarczyk: yeah, the metadata approach works nicely, thanks.

0:32 kovasb: it's a good structure to have, rather than spreading the logic around in a handful of callbacks

0:32 (add-watcher functions)

0:32 mmarczyk: lynaghk: great

0:33 kovasb: lynaghk: you mean, what you do on callback depends on the state?

0:34 lynaghk: kovasb: if you're not careful about organization you'll end up with the logic splattered around different places

0:34 e.g., in a callback that is executed when a DB call from the server returns, you check some UI widgets to make sure that the data is still needed

0:34 kovasb: lynaghk: believe me, i know :) just curious what it would look like

0:35 lynaghk: kovasb: ah, right. Know and love =P

0:35 kovasb: lynaghk: sounds interesting.

0:35 lynaghk: my js apps definitely suffer from that. the cljs ones slightly better, but still not great

0:36 lynaghk: kovasb: the reason I'm writing a new lib instead of just using Chris's Waltz is because I need more emphasis on actual mutable state---associating atoms with states in the state machine

0:36 kovasb: right

0:36 lynaghk: kovasb: the motivating use case for that is because I need to be able to serialize the entire application state (e.g., the current drop down selections and such)

0:37 kovasb: lynaghk: i think we are working on the same problem

0:37 lynaghk: kovasb: I'm getting a little demo up and running in the next hour (hopefully). I'll add you to the github repo and you can check it out.

0:37 kovasb: lynaghk: awesome, will definitely check it out.

0:37 lynaghk: I'd love to hear your thoughts on the design.

0:37 kovasb: lynaghk: its a hard problem :)

0:38 lynaghk: right now I'm working on serializing document representing my cljs app, which is a webrepl

0:39 lynaghk: kovasb: no README on the github repo grr! =P

0:39 kovasb: lynaghk: haha, leon reps && leon run baby

0:39 *lein

0:39 muhoo: is there anything special involved in building lein2 from source? isn't it just lein2 uberjar, then copy the uberjar to ~/.lein/self-installs, then change the lein2 shell script to use that SNAPSHOT version?

0:39 kovasb: not ready for public consumption to say the least..

0:40 just refactored the whole thing today to use deftype

0:44 lynaghk: i think i understand what its doing

0:45 lynaghk: in terms of serialization, its that so the user can come back to the app and find it in the same state?

0:46 lynaghk: kovasb: yep. It has several views and toggles, so they need to be able to bookmark it and come back later

0:46 (using pushState to serialize into the URL)

0:47 kovasb: lynaghk: how do you hook up the state with the content of the widgets?

0:48 lynaghk: kovasb: need to put together a serialization protocol that people can implement for different widgets.

0:49 kovasb: lynaghk: cool. we should definitely coordinate

0:49 lynaghk: basically, i want to make the interactive repl where people can type in their widgets, and share / come back to them later

0:50 lynaghk: Basically, any of the state machine states can be associated with ref-like things that implement IWatcher (which I'm calling "wub" to differentiate from state machine states). If the user wants to be able to serialize the state machine, the wubs will also need to implement the serialization protocol.

0:51 kovasb: sure, I'd be happy to chat about that. This particular thing needs to get written tomorrow and delivered Monday, but the design definitely isn't set in stone. I'd be interested to see what other people think of it and end up doing with it

0:51 kovasb: lynaghk: cool

0:52 lynaghk: one thing that kinda stretches the metaphor of "state machine" is for example the content of a dynamic visualization.. changes over time, but the changes don't put the logic into a different state

0:52 lynaghk: anyway will let you work for now :)

0:53 lynaghk: kovasb: yeah, that's a problem I've been thinking about w.r.t. C2 stuff

0:53 kovasb: lynaghk: I've been hitting my head super hard against the wall. have some ideas but they need reality testing.. anyway lets connect soon

0:54 lynaghk: on one hand, I think the data should be logical, and the mappings should always be one-to-one from the data to the visulization elements. But if you're going to be strict about that, it's unclear how to do things like graph layout and stuff (since the data depend on each other). Personally, I've been using separate layout fns that run after the initial data->DOM mapping, but I'm not sure if that's the best solution.

0:55 kovasb: sure. I'll get in touch later this week and we can skype or something

0:55 kovasb: lynaghk: sweet. will have my stuff in better shape by then too..

0:58 yoklov: Hm. I think the level generator is officially "good enough"

0:58 http://dl.dropbox.com/u/13069163/crash.png

1:00 emezeske: yoklov: Neat!

1:01 ibdknox: yoklov: lol I love you bookmark folders :p

1:02 your*

1:02 yoklov: hahaha, yeah, didn't think about those :p

1:04 they at least make me feel more organized, but… maybe I should move piracy inside of saved or something.

1:05 ibdknox: haha

1:11 kovasb: ibdknox: are you gonna keep the publicity flowing by making more awesome demos? :)

1:13 amalloy: yoklov: just rename piracy to "liberation" or some other synonym

1:14 yoklov: amalloy: that is a good idea

1:19 * ivan discovers -Xbootclasspath/a:clojure.jar from lein.bat and https://groups.google.com/group/clojure/browse_thread/thread/33f80f1bb8277351/20d529318aebbab8

1:26 ivan: I am curious as to *why* it is faster though

1:29 amalloy: i wouldn't be surprised to learn that code on the boot classpath doesn't get run through the verifier, or is verified less rigorously

1:32 ivan: "Several large caveats go with this, however. To begin with, any and all security policy set by the SecurityManager or the associated Policy implementation (see [8] for details) are completely ignored and entirely unenforced for code loaded from the bootstrap ClassLoader."

1:36 amalloy: sure, or that. i was close!

1:39 ivan: heh heh -Xbootclasspath/a:C:\stuff\clojure.jar does not work while forward slashes do work

1:45 jblomo: ,(meta ^{:test true} (sorted-set 1 2 3))

1:45 clojurebot: nil

1:45 jblomo: ,(meta ^{:test true} [1 2 3])

1:45 clojurebot: {:test true}

1:45 jblomo: does the reader meta macro work differently on function calls that return an object?

1:46 amalloy: it only works on object literals

1:46 jblomo: ah ok. otherwise i have to use with-meta?

1:46 amalloy: personally i recommend using with-meta always

1:46 to avoid confusion with what's happening at runtime with what's going on at read time

2:02 as an aside, putting reader metadata on lists is a problem for other reasons too: if you typehint a macro call, the typehint is silently discarded. see http://dev.clojure.org/jira/browse/CLJ-865 if you're interested

2:04 jblomo: amalloy: thanks, i was more trying to understand how metadata was stored for non-reader datatypes

2:04 like sorted-set

2:04 I am trying my hand at CLJ-248

2:04 trying to understand if a subset should carry along the metadata of the superset

2:11 amalloy: i don't think so, but i haven't thought hard about it

2:12 sub-sortedsets would be interesting but i can't imagine how they'd work with good performance. do you have an algorithm in mind?

2:16 jblomo: amalloy: it looks like sorted sets are backed by PersistentTreeMap, which are kept in order

2:16 so i was hoping to use subtrees which i have a vague hope would not require making a lot of new objects

2:29 amalloy: it seems like you couldn't keep the balance properties of PTM, though

2:30 eg, if you have a perfectly balanced tree of 15 elements, and only keep some of the inner ones, you have a tree that is very poorly balanced

2:31 and then conjing onto that structure would be a mess, right?

3:11 bolic: I'm getting confused by namespaces and -main, help anyone? See here: http://pastie.org/3832210

3:27 muhoo: bolic: post your project.clj?

3:32 amalloy: bolic: note it's #<Namespace user>, not #<Namespace ack.doodle>

3:33 *ns* is bound at compile-time, not runtime, i believe. the whole namespace gets compiled with *ns* bound to ack.doodle, and then lein invokes the -main function after compilation is done, so *ns* is set to the default binding of user

4:01 Hali_303: hi! can someone confirm that C-M-x does not work on protocol stuff in Emacs?

4:05 muhoo: is there a more current appengine/bigtable library for clojure than this one: github.com/smartrevolution/clj-gae-datastore ?

4:05 it's old, only works with clojure 1.2, doesn't have lein support yet, etc

4:09 nm, found it: https://github.com/gcv/appengine-magic

4:09 appengine-magic.services.datastore

4:19 amalloy: Hali_303: works fine, though i suppose no answer can be definitive if you don't specify what you mean by "protocol stuff" and "does not work"

4:54 bolic: got disconnected.. did anyone answer my previous question? *ns* appears to be 'user in -main, but functions defined in the same file, and from a different namespace, can be called. What's going on? see http://pastie.org/3832210, thanks

5:06 Borkdude: Strange, I can't edit a clj in Eclipse anymore

5:06 When I copy/paste smth: ccw.editors.clojure.handlers$apply_paredit_command cannot be cast to clojure.lang.IFn

5:07 talios: 'lo Borkdude

5:07 Borkdude: hi talios

5:08 talios: How goes the evening?

5:08 (well, evening my time anyway)

5:08 Borkdude: it's morning here

5:14 Has anyone got the leiningen plugin in Eclipse functioning (update dependencies)?

5:16 cirwin: (noob alert) is there a varargs version of every? (or if not how do I go about making one). I want to check a condition against every pair in two sequences.

5:31 AimHere: cirwin > Not hard to roll your own - something along the lines of: (defn everyv? [f & x] (cond (every? empty? x) true (apply f (map first x)) (recur f (map rest x)) :else false))

5:32 cirwin: AimHere: awesome

5:32 I'm just struggling to find everything at the moment — I remember about the & now you say it :)

5:33 kab3wm: Having some "IO" issues with binary files. I'm trying to build an image cache with Redis, but just testing with copying my byte-array to file, the files are missing around 3500 bytes. See: https://gist.github.com/2462911

5:33 AimHere: cirwin > Looks right to me, but I do make lots of mistakes when I write code, so check it before you use it!

5:34 cirwin: will do, thanks again

5:37 Borkdude: Does someone know if I want to use a leiningen project in Eclipse, how I can get a REPL in Eclipse running?

5:37 I did a "lein deps" and then added references to the jars manually

5:38 (because I can't get the leiningen plugin to work)

5:41 hiredman: kab3wm: you need to close the stream or call .flush

5:42 kab3wm: hiredman: I will give that a shot. thank you.

5:52 Borkdude: Trying "lein ccw" now... NullPointerException

5:53 I'm giving up almost...

6:58 fliebel: $mail samaaron Any luck with PureJavaComm? Does my patch work for you?

6:58 lazybot: Message saved.

7:01 georgeMonet: hello

7:06 mercurian: hello is anyone active

7:07 I need some help in installing Clojure with AcquaMac

7:23 bordatoue: hello

7:24 what a shit

7:50 angerman: Dammit clojure… gimme a fist!

7:50 (Spelling is hard)

7:52 bordatoue: hello could anyone tell me how to install clojure with Acquamac

7:53 angerman: bordatoue: you mean how to configure Aquamacs?

7:53 _KY_: What is the test for lower-case characters?

7:53 bordatoue: yes,

7:53 _KY_: Thanks in advance! =)

7:53 bordatoue: I want to work with AcquaMac and Clojure i have been following the instruction specified in http://dev.clojure.org/display/doc/Getting+Started+with+Emacs

7:54 it say in the web page to download clojure-mode.el , but there is no link

7:54 https://github.com/technomancy/clojure-mode/blob/master/README.md

7:55 angerman: bordatoue: it's this one: https://github.com/jochu/clojure-mode

7:55 err https://github.com/technomancy/clojure-mode

7:55 that one

7:55 bordatoue: thanks very much

7:56 i will try with those file

7:56 angerman: follow the instructions; (I'd recommend using Marmalade)

7:56 bordatoue: how do I install the package manager for AcquaMac ; Marmalade

7:57 that was the hinderence when I tried Marmalade approach

7:58 angerman: bordatoue: if aquamacs does not come with package.el; try without Marmalade

7:58 bordatoue: okay

7:58 is it possible to install Marmalade for acquamacs

8:00 angerman: I assume. You would need to install ELPA package.el

8:01 bordatoue: is there any instruction on how to install ELPA package.el

8:02 angerman: I guess you basically just need to install http://bit.ly/pkg-el23 (put in ~/.emacs.d/) and load it in ~/.emacs.d/init.el

8:03 bordatoue: okay thanks, I will try them

8:34 _KY_: How can I use set/union?

8:35 The REPL can't resolve the symbol

8:36 yangsx: KY: (require '[clojure.set :as set])

8:36 _KY_: Thanks=)

8:37 yangsx: or (clojure.set/union #{1 2 3} #{2 3 4})

8:44 michaelr525: hey

8:50 _KY_: How to append 2 lists?

8:54 Nevermind... what I need is concat

9:40 jimi_hendrix: what is the most "clojure" way of creating a Vec3 type structure? just pass around a vector with 3 elements?

9:43 AimHere: jimi_hendrix, Probably. If you can do it with a vector or a sequence, then do it that way

9:43 Failing that, do something lispy with lambdas and macros

9:44 If all else fails, shoehorn it into object orientation with protocols and deftypes/defrecords

9:44 I think that's roughly the idiomatic Clojure pecking order

9:45 jimi_hendrix: first situation should work

9:48 also, i am using slime and emacs. when i am defining functions and typing the argument list i get stuff like error in process filter: wrong argument type listp 1

9:49 this slows down typing. what gives?

10:07 _KY_: How can I add an element to the beginning of sequence?

10:08 tmciver: _KY_: use cons

10:08 mk: ,(cons 1 [2 3])

10:08 clojurebot: (1 2 3)

10:09 _KY_: But that adds to the end of list

10:09 AimHere: cons doesn't

10:09 patrikkarlin: what?

10:09 clojurebot: what is exceptions

10:09 _KY_: Or, what I need is to add to the end

10:09 mk: _KY_: the list is the second argument

10:09 AimHere: If you want to add to the end of a vector, you could use 'conj'

10:09 _KY_: Sorry I confused head with tail =)

10:10 mk: ,(conj 1 [2 3])

10:10 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentCollection>

10:10 _KY_: ,(conj [2 3 5] one)

10:10 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: one in this context, compiling:(NO_SOURCE_PATH:0)>

10:10 _KY_: ,(conj [2 3 5] '1)

10:10 clojurebot: [2 3 5 1]

10:10 _KY_: Ah I see...

10:10 fliebel: conj ads to the start fro a list, tail for a vector.

10:10 mk: ,(conj '(2 3) 1)

10:10 clojurebot: (1 2 3)

10:10 tmciver: _KY_: no need to quote the 1

10:10 _KY_: ,(cons [2 3 5] '1)

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

10:10 _KY_: ,(cons '1 [2 3 5])

10:10 clojurebot: (1 2 3 5)

10:11 AimHere: ,(conj [1 2 3 4] 5 6 7 8)

10:11 clojurebot: [1 2 3 4 5 ...]

10:11 mk: the arguments are reversed, which can cause mild annoyance

10:11 fliebel: Adding to the end of a list is inefficient. But you could use ##(concat '(1 2 3) '(4))

10:11 lazybot: ⇒ (1 2 3 4)

10:11 fliebel: or a vector, of course.

10:12 _KY_: Yes I think conj is what I need

10:12 mk: conj should not be used for adding things to the start or end of anything, though

10:12 _KY_: Why not?

10:13 mk: because the specification specifies that depending on the "concrete type", adding can occur anywhere (the start, end, middle...)

10:13 mdeboard: &''x

10:13 lazybot: ⇒ (quote x)

10:13 mdeboard: &'#"\\"

10:13 lazybot: ⇒ #"\\"

10:13 mdeboard: &'#{1 2 3}

10:13 lazybot: ⇒ #{1 2 3}

10:13 mdeboard: &''#{1 2 3}

10:13 lazybot: ⇒ (quote #{1 2 3})

10:13 mdeboard: weird

10:14 mk: _KY_: in practice, this means that conj adds to the front of lists and to the tail of vectors

10:14 AimHere: What's weird about that?

10:17 _KY_: Well, I found out I could use cons afterall

10:17 But conj won't add to the middle right?

10:18 Are you kidding?

10:21 mk: _KY_: I'm not. It adds into the most efficient place in the list. If we implemented special new vectors where adding into the middle was fastest, conj would add into the middle

10:22 (actually, it wouldn't, because everyone uses conj, incorrectly, to add to the start of lists and the end of vectors, but that's beside the point)

10:27 _KY_: Fine... I'm not using conj anyway

10:28 mk: _KY_: :)

10:29 why did clojure implement bigints in addition to bigintegers?

10:29 mmarczyk: mk: nothing incorrect about that

10:31 mk: as for bigints -- that's so that you can get convenient and efficient arbitrary precision arithmetic with the >= 1.3 numerics

10:32 mk: just using bigintegers would be unbearably slow with the current jvms, so the idea is to write a faster bigint class

10:32 mk: mmarczyk: it assumes that append for vectors is fastest at the end, but this need not be the case

10:32 mmarczyk: mk: as far as I remember (<- about bigints)

10:33 mk: mmarczyk: our bigint has a BigInteger field (and a few other things) in it. Are you sure?

10:33 mmarczyk: mk: strictly speaking, conj doesn't promise to insert into the "fastest" place, but rather some fixed place for each concrete collection type, which might be different for different collection types

10:34 mk: although even more strictly speaking, it doesn't necessarily make sense that the insertion place is different, because it doesn't necessarily make sense to compare

10:34 mk: say, vaguely sequential colls vs. associative colls

10:34 mk: it also has a long field

10:35 mk: the idea is to use that whenever possible and fall back to biginteger

10:35 raxelo: hi all, please help to resolve this compilation problem http://pastebin.com/N7sdD2mp

10:35 seems like it requires seq instead of reference to the predicate

10:35 mmarczyk: mk: for now, anyway -- maybe biginteger will be completely replaced one day

10:35 mk: mmarczyk: I've heard something vague about the hash values of biginteger being off

10:37 mmarczyk: mk: ah, right, I think I remember something like that too

10:37 mk: in addition to the precision issue.

10:37 &(hash (BigInteger. "126463241243514"))

10:37 lazybot: ⇒ -2069874442

10:37 mmarczyk: &(hash 126463241243514)

10:37 lazybot: ⇒ -2070792066

10:38 mmarczyk: &(hash 126463241243514N)

10:38 lazybot: ⇒ -2070792066

10:38 mmarczyk: indeed.

10:40 returning to the conj issue, the idea is that you need to pick the collection types which make sense for your algorithms and know their behaviour, and in particular their behaviour w.r.t. conj et al. -- but without guarantees as to that behaviour conj would be pretty useless

10:42 raxelo: guys, I have got message "IllegalArgumentException: Don't know how to create ISeq from: dp_toolkit.layout$discovery_script_QMARK_, compiling:(layout.clj:23)

10:42 but function discovery_script has to be evaluated before call, right ?

10:42 http://pastebin.com/N7sdD2mp

10:43 before applied in map-function call

10:43 mmarczyk: raxelo: (mapcat walk subdirs filter-fn)

10:44 raxelo: you probably want (mapcat #(walk % filter-fn) subdirs)

10:45 raxelo: oh, also note #((and (.isFile %) (filter-fn %))) -- you need to remove the outer layer of parens

10:46 raxelo: otherwise you're calling the return value of (and ...) as a function

10:47 raxelo: mmarczyk: thanks a lot for the help, I have stuck at 23 line where error points me (newbie)

10:47 mmarczyk: raxelo: there's also line 20

10:47 raxelo: you probably want sth like (.endsWith the-interesting-string "py")

10:48 raxelo: "xml", rather, "py" is on line 15 -- same story

10:48 raxelo: also remove the outer (= "py" ...) from around the new .endsWith form

10:49 mfex: raxelo, you can turn a tree directory/file structure into a seq with (tree-seq #(.isDirectory %) #(.listFiles %) (File. root)) and then filter for dir/file and apply filter-fn

10:49 raxelo: aha

10:49 mfex: about

10:50 mfex: about "turn tree to seq" is very cool! thanks

11:01 thanks a lot, mfex and mmarczyk

11:28 _KY_: How come the set union of 2 lists is a joined list?

11:28 Instead of a set containing 2 lists

11:32 tmciver: _KY_: because the doc says so: ##(doc union)

11:32 lazybot: ⇒ nil

11:32 tmciver: &(use 'clojure.set)

11:32 lazybot: ⇒ nil

11:32 tmciver: &(doc union)

11:32 lazybot: ⇒ ------------------------- clojure.set/union ([] [s1] [s1 s2] [s1 s2 & sets]) Return a set that is the union of the input sets nil

11:33 tmciver: _KY_: and it takes and returns set, not lists.

11:33 _KY_: Yes but I expect to get a set of 2 lists

11:33 Like { [1 2 3], [4 5 6] }

11:34 tmciver: _KY_: then you'd have to create sets containing lists as input to union

11:34 &(union #{[1 2 3]} #{[4 5 6]})

11:34 lazybot: ⇒ #{[1 2 3] [4 5 6]}

11:35 tmciver: _KY_: but I think sets don't typically contain lists like that.

11:35 _KY_: Well that's exactly what I need...=)

11:37 tmciver: _KY_: keep in mind union may not combine your lists as you'd expect: ##(union #{[1 2 3]} #{[2 3 4]})

11:37 lazybot: ⇒ #{[1 2 3] [2 3 4]}

11:37 tmciver: _KY_: i.e. it does not 'combine' the 2 and 3.

11:38 _KY_: That's what I expect

11:38 They are different lists

11:53 I want something like this to work:

11:53 (clojure.set/union {[1 2 3 4]} {[1 2] [3 4]} )

11:53 ,(clojure.set/union {[1 2 3 4]} {[1 2] [3 4]} )

11:53 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Map literal must contain an even number of forms>

11:53 tmciver: _KY_: sets are prefixed with #

11:55 _KY_: ,(clojure.set/union #{[1 2 3 4]} #{[1 2] [3 4]} )

11:55 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.set>

11:55 Bronsa: ,(require 'clojure.set)

11:55 clojurebot: nil

11:55 Bronsa: ,(clojure.set/union #{[1 2 3 4]} #{[1 2] [3 4]})

11:55 _KY_: ,(clojure.set/union #{[1 2 3 4]} #{[1 2] [3 4]} )

11:55 clojurebot: #{[3 4] [1 2] [1 2 3 4]}

11:55 #{[3 4] [1 2] [1 2 3 4]}

11:55 _KY_: Ahhh works...

11:55 =)

11:58 Another question: there is no built-in test for lowercase characters in clojure

11:58 Maybe we can call java's library for that?

11:59 tmciver: &(Character/isLowerCase \a)

11:59 lazybot: ⇒ true

12:00 tmciver: &(Character/isLowerCase \A)

12:00 lazybot: ⇒ false

12:00 _KY_: Oh I see

12:00 Thanks=)

12:00 tmciver: np

12:10 charles_r: Can someone explain to me what's going on with 'recur'?

12:11 tmciver: charles_r: maybe. got some code to refheap?

12:16 jimi_hendrix: so it seems my typing of stuff in emacs is really slow (it seems to pause to show prototypes or whatever). can i speed this up somehow?

12:23 mfex: ha jimi_hendrix' dexterity too much for emacs, story check out :)

12:24 jimi_hendrix: i am not even typing that fast!

12:26 umren: what is current state of clojure on android, can i make full native applications with clojure and have same load spead as java?

12:26 mk: umren: clojure compiles into bytecode, just like java

12:27 jimi_hendrix: umren, last i checked, the non-java jvm languages were slower on android because the dalvik jvm is optimized for java's style. this could have changed though

12:27 umren: this is what i fear

12:28 mk: umren: this is almost never a problem unless you make a prototype and find that it dies due to performance

12:28 jimi_hendrix: umren, it doesnt matter much though, unless you are making a game or a similarly resource intensive app

12:28 umren: yep, i would like to make a game

12:29 hcumberdale: Hi ;)

12:29 mk: umren: most of clojure itself is written in java - it uses .java files and classes

12:29 hcumberdale: hey and welcome :)

12:29 umren: yes, this is what theory is about

12:30 mk: umren: the speed might be different in expected areas; for example, clojure uses fast immutable lists, which are slower than mutable lists, but much more bug-free

12:30 jimi_hendrix: but has anyone experienced a similar issue with emacs and slime?

12:32 umren: mk: http://goo.gl/BXVQ2

12:33 i don't think he lie

12:33 mk: umren: you can just post the full url :)

12:33 umren: nah, it's too big

12:35 mk: http://www.deepbluelambda.org/programming/clojure/creating-android-applications-with-clojure

12:35 sattvik: umren: There is still a bit of a load time issue with Clojure, but appplying a few tricks can make things practical.

12:36 For example, Clojure 1.4's metadata elision can reduce load time slightly and make a big difference in heap use.

12:36 On a newer phone, the load time is down to 2-3 seconds.

12:37 mk: umren: load time is one of the things that you would give up in order to use a still-new higher-level language like clojure

12:37 sattvik: The current best practice is to use a Java activity to throw up a splash screen while Clojure bootstraps itself.

12:38 However, once you experience REPL-driven Android development, everything else just seems backwards.

12:39 mk: umren: I believe that sattvik is the author of that post you linked

12:39 sattvik: Things are generally getting better, though.

12:39 Yes, I am.

12:40 umren: well, i like android, but i don't like java, clojure seems good and easy

12:40 zakwilson_: I was just wondering about the current suitability of Clojure for Android.

12:42 mk: umren: which language are you coming from?

12:43 umren: mk: php/javascript

12:43 zakwilson: It seems like a serious misfeature that you can't run code on Android that generates new classes.

12:44 sattvik: zakwilson: It's something that they have left open for future development. For now, there are workarounds.

12:44 zakwilson: I figured it was security/verifiability related.

12:45 mk: umren: if you've used jquery, clojure leans in that direction

12:45 sattvik: No, you can dynamically load new classes. It's supported by the platform, it's just a little on the slow side.

12:46 zakwilson: It seems like Android might work better if they had chosen something lighter than Java as the fundamental basis for their platform. On the other hand, it might not have gotten the popularity.

12:47 umren: they targeted java devs, which are really big community, and dalvik was designed with java in mind

12:54 mk: umren: this is similar to what clojure has done

13:29 gozala: Hi folks

13:29 Mimisbrunnr: hello

13:29 gozala: I'm trying to find some examples how to write tests to cljs lib

13:29 anyone has any good pointers ?

13:30 RickInGA: lein-cljsbuild has a sample project with tests built in, that might be a good place to look

13:30 gozala: RickInGA: ahh stupid me, thanks!

13:31 RickInGA: gozala: it has 2 sample projects, simple and advanced. the tests are in the advanced. they use phantom.js to run the tests

13:33 gozala: RickInGA: could you also give a link to your tests ?

13:33 I'd like to take a look

13:34 RickInGA: I have not done any tests in cljs, just I am still new to cljs, but the samples I was talking about are at: https://github.com/emezeske/lein-cljsbuild/tree/master/example-projects/advanced

13:35 gozala: RickInGA: yeah I was looking there

13:35 I'm still not sure how to write async tests though

13:35 that don't finish execution in the same turn of event loop

13:43 _KY_: What's the difference between {} and []?

13:43 What's the difference between {} and [] and #{}?

13:43 dnolen: yoklov: was the mem issue resolved for you?

13:44 yoklov: dnolen: yes, it was!

13:44 dnolen: _KY_: hashmap, vector, and set - different data structures.

13:44 yoklov: excellent!

13:44 mk: _KY_: http://clojure.org/cheatsheet

13:44 _KY_: I see....

13:44 What memory issue?

13:44 yoklov: dnolen: yes, its been running smoothly all day and was doing great last night too

13:44 jimi_hendrix: what is the clojure way of doing a left fold?

13:44 mk: _KY_: a data structure is a way to represent a value

13:44 RickInGA: dnolen: did you see gozala's questions about testing in cljs?

13:44 dnolen: yoklov: that's great to hear. you were right all along :)

13:45 RickInGA: I did, but I haven't done much testing outside the CLJS compiler.

13:45 _KY_: I have a memory problem running NetBeans with Enclojure =(

13:50 gfredericks: I'm curious about the reasoning behind CLJS-113

13:53 dnolen: gfredericks: then Clojure data can be a JSON superset

13:53 gfredericks: I did not expect that as a goal

13:54 dnolen: numerics is still undealt with, right? I'm about to create a JIRA issue. Seems I finally have some free time.

13:56 dnolen: gfredericks: a JIRA issue for what?

13:56 gfredericks: building numeric types

13:56 dnolen: gfredericks: do you mean Ratios, BigInts stuff like that?

13:57 gfredericks: I talked to Stu H. and I _think_ that's how he recommended to go about it but now my memory seems hazy

13:57 yes that sort

13:58 dnolen: gfredericks: it's still not clear to me how that could work without slowing down arithmetic elsewhere.

13:58 gfredericks: dnolen: I fiddled around with the double dispatch after talking to you about it a month ago and ended up with a question, but will have to collect my thoughts before I remember what it was

13:58 dnolen: right, I imagine it would either be a separate ns with separate arithmetic protocols, or a compiler option

13:58 I didn't expect full integration

14:00 dnolen: gfredericks: before a JIRA ticket, something like that probably needs a plan.

14:00 jonasen: dnolen: Has anyone used the clojurescript analyzer for code walking? I'm finding several bugs in the :children vectors. Maybe I'm missing something.

14:01 dnolen: jonasen: I think ibdknox has, I saw your ticket but I haven't looked closely.

14:02 jonasen: dnolen: there are more I think.

14:02 _KY_: How can I read a seq 3 elements at a time, like [x y z]?

14:02 jonasen: :children is missing for :fn

14:02 and :dot puts the environment in there.

14:03 * josteink has some nooby questions

14:04 josteink: Im reading a file (via java.io readers) and I want to itereate over each line, and for each line evaluate a specific condition

14:04 if that condition is true, I want to do something in to "yield return" in C#

14:04 basically, build up a iterable collection of some sort to process later

14:04 dnolen: jonasen: :children for fn is inside :methods

14:04 josteink: what would be the idiomatic/clean way of doing that?

14:07 gfredericks: dnolen: is there a more appropriate place for developing a plan?

14:07 dnolen: gfredericks: Confluence

14:07 samaaron: is there a safe way of accessing a protected field on an arbitrary java object where no getFoo() method exists

14:08 gfredericks: I bet that's what stu said and I just revised history

14:08 jonasen: dnolen: yes, but shouldn't it be exposed to :fn?

14:08 dnolen: jonasen: I'm wary to mess w/ the analyzer - it would probably best to see a detailed description of what exactly could be made more uniform.

14:09 RickInGA: samaaron can you inherit from the class? protected is available to children, I believe

14:09 jonasen: dnolen: np. I know how to work around it :)

14:10 samaaron: RickInGA: so I have a proxy object - I'm not sure how you can inherit in this case. Perhaps there's a way of writing a proxy fn which can poke directly in?

14:10 jonasen: but I might open tickets as I find (what I think is) bugs.

14:10 dnolen: jonasen: I understand that uniformity is beneficial for a code walker - but if we're going to work on the analyzer it would be best to get *one* ticket.

14:11 jonasen: dnolen: ok

14:12 dnolen: jonasen: so say keep your notes and create an improve analyzer confluence page so others can follow along.

14:12 RickInGA: I need to stop answering questions… followups are almost always over my head :)

14:13 samaaron: I'm totally out of my depth too

14:14 RickInGA: samaaron: checking chapter 9 of Clojure Programming right now… got to proxys….

14:14 gfredericks: does confluence require special privileges to add a new page?

14:14 RickInGA: it says that proxy can extend an existign class...

14:15 samaaron: yep, so I'm overriding class fns with my proxy

14:15 I can refer back to original class methods with proxy-super

14:15 dnolen: gfredericks: it might if it does ask for privilges on clojure-dev

14:15 samaaron: i wonder how you can refer to a specific field

14:16 gfredericks: dnolen: okay; I simply can't figure out how to add one, so that seems a reasonable explanation

14:16 dnolen: gfredericks: yes if you have permissions you should be able create pages.

14:17 gfredericks: well I just created my account 10 minutes ago so there's no reason for me to have permissions if they aren't given by default

14:19 first to apply for clojure dev membership

14:19 RickInGA: samaaron: found this on clojure.org/java_interop Method fns are closures and can capture the environment in which proxy is called. Each method fn takes an additional implicit first arg, which is bound to this. Note that while method fns can be provided to override protected methods, they have no other access to protected members, nor to super, as these capabilities cannot be proxied.

14:20 samaaron: RickInGA: yeah I just read this

14:21 doesn't look hopeful i guess

14:21 jimi_hendrix: what is the clojure version of a left fold? i need to retain information from the previous item in the iteration when examining the next one

14:21 jonasen: https://refheap.com/paste/2290

14:22 dnolen: ^ my workaround. Which I think does the right thing

14:22 TimMc: jimi_hendrix: reduce

14:25 jimi_hendrix: TimMc, thanks

14:48 jayunit100: good mornin

14:52 whats the best way to "extend" a namespace in a new file, while retaining access to private methods etc ...?

14:55 Raynes: Not trying to do that at all is usually the best option.

14:56 gfredericks: I don't know if there's any idiomatic way to do it, due to what raynes said, but you can use (in-ns ...) at the top level

14:56 but please only do this if you're trying to upset Raynes

14:56 Raynes: Indeed.

14:57 tmciver: I just tried to use lein's checkouts feature and it looks like the external project's lib directory is not on the classpath by default. Seems like it should be. Any way around this?

14:58 gfredericks: tmciver: shouldn't you have all its deps in your lib directory?

14:58 or are you mucking with its deps as well...

14:59 (i.e., changing the project's project.clj)

14:59 dnolen: mmarczyk: you around?

15:00 tmciver: gfredericks: I shouldn't have to list an external project's deps in my own project.clj, right?

15:00 jayunit100: oh ok.

15:00 yup (in-ns) i guess.... is the way to (not) go :)

15:00 gfredericks: tmciver: no, the indirect dependencies normally end up in your lib directory. using checkouts shouldn't change that, at least if you don't change the external project's dependencies

15:00 jayunit100: thanks anyways tho :)

15:01 gfredericks: jayunit100: that might complicate getting those files loaded, which would be part of why people don't do that

15:02 dnolen: k CLJS compiler now warns on fn invokes w/ incorrect # of args

15:03 angerman: I have a bunch of image urls. how could I simply display? Should I go with seesaw or clarity?

15:03 tmciver: I expected the transitive dependencies to be made available to the main project either by including the external project's lib dir on the classpath or by lein obtaining the needed deps by reading the ext project's project file.

15:04 It doesn't look like either happens which I guess means I must list those deps in the main project's project file...yuk!

15:06 Well, there's the :checkout-deps-shares that I could use. I still feel that the external project's lib dir should be put on the classpath by default.

15:11 gfredericks: tmciver: so...you are changing the dependencies then?

15:13 mmarczyk: dnolen: hi

15:13 tmciver: gfredericks: not at all. I have a project that depends on another project that I've simlinked to from the checkouts dir.

15:14 gfredericks: tmciver: so it sounds like you're claiming that the checkouts feature doesn't work as advertised; I've never had to include transitive deps, just like I don't have to when not using checkouts

15:15 tmciver: gfredericks: but 'lein classpath' does not show the external project's lib dir. Shouldn't it?

15:15 gfredericks: I shouldn't have to list transitive deps in the main project's project file.

15:16 gfredericks: I'm probably missing something.

15:18 gfredericks: tmciver: no I don't believe it should have the other lib directory. `leid deps` should put all transitive deps into your lib directory just like it normally does. Is it not?

15:18 s/leid/lein/

15:19 tmciver: gfredericks: no, it doesn't seem to.

15:19 and I can't get the :checkout-deps-shares to work. :'(

15:19 gfredericks: tmciver: the project in your checkouts directory is also listed in your project.clj, right?

15:19 as a direct dependency?

15:20 tmciver: gfredericks: well, no . . .

15:20 gfredericks: oh that's it then

15:20 sorry I should have mentioned that first

15:21 tmciver: gfredericks: I guess I assumed the checkouts magic would make that unnecessary. Now to figure out the right dependency vector... Thanks.

15:21 gfredericks: yessir

15:21 (I think I made that mistake at first too)

15:21 (or rather made that totally reasonable assumption)

15:22 tmciver: gfredericks: ha, thanks. That makes me feel a little better. :)

15:22 gfredericks: the detail is in the last sentence of the Q/A that mentions checkouts in the README

15:23 tmciver: Yup. Makes sense now.

15:23 I did read that, I just don't listen.

15:50 gfredericks: I still can't get this to work. I put [externalprojectname "1.0-SNAPSHOT"] under :dependencies in my project.clj, but lein is still trying to fetch it externally. What else am I missing?

15:52 externalprojectname and "1.0-SNAPSHOT" are what are found in the external project's project.clj.

15:52 abedra: has anyone hooked friend up inside of a noir application yet?

15:52 tmciver: I'm probably screwing up that dep vector. I usually do screw it up if I'm unable to copy it from clojars.

15:54 jayunit100: seems like using qouted lists in "require" never works...

15:54 (require '(clj-json [core :as json])) failed

15:54 (require [clj-json [core :as json]] ) succeeds

15:55 mdeboard: Yeah that's the syntax

15:55 jayunit100: why no qouted list ?

15:55 mdeboard: hell I dunno

15:57 amalloy: lists are for prefixes

15:57 oh, you're trying to use them that way. so your issue is that you're trying to quote at all, in the ns form?

15:58 jayunit100: well.. i only qouted one

15:58 Im trying to qoute the "require" package statement,,, but i always get weird errors

15:59 I guess Im wondering why one works and the other fails, just curious.

15:59 laurus: Does anyone know how one would convert the Python statement b.sum(axis=0) to Clojure-py?

16:01 ibdknox: Blog post on the realities of Light Table: http://www.chris-granger.com/2012/04/22/on-concepts-and-realities/

16:02 if you believe it merits it, please vote it up from the HN new page: http://news.ycombinator.com/newest

16:02 laurus: Hm, interesting. The correct conversion seems to be: (kwapply (.-sum b) {"axis" 0})

16:03 mmarczyk: dnolen: those arity warnings are great! just prepared a patch for three missing arg cases in core (in PHM, PST and PV)

16:05 dnolen: mmarczyk: cool, that's what I was pinging you about :) thx

16:06 mmarczyk: dnolen: http://dev.clojure.org/jira/browse/CLJS-196 :-)

16:11 angerman: wasn't there "indexed" ?

16:12 hcumberdale: Does anyone know how to format an url "pretty"

16:12 mdeboard: What does that mean

16:12 @ hcumberdale

16:12 hcumberdale: (defn urlfriend [unfriendly] (s/replace (s/trim (s/lower-case unfriendly)) #"[^A-Za-z0-9_]+" "-"))

16:12 that's what I am using now

16:12 "I am a blogpost about ... $" >> "i-am-a-blogpost-about-"

16:13 angerman: ibdknox: did that really need a blog response? That post on concepts vs realities was completely off to me; and as someone on HN already said: it was comparing apples to oranges)

16:13 ibdknox: angerman: it was for that

16:13 wasn't*

16:13 hcumberdale: It does not nice things like "replace $ with "usd", € with "eur" and so on

16:13 ibdknox: and I was writing this before that post existed

16:14 angerman: he brings up some valid points and he's not the only one who has been wondering about some of these things.

16:14 angerman: ibdknox: alright. Sorry for commenting on the title already. Will go and read it.

16:14 ibdknox: angerman: I actually didn't realize the title collided with his, whoops

16:17 mdeboard: hcumberdale: Why replace those characters? They're valid URL characters

16:17 laurus: Is there any way to make clojure-py "print" something automatically in the repl, like the standard Clojure repl does?

16:17 mdeboard: hcumberdale: That's called slugifying a URL btw

16:19 laurus: What environment are you using it in?

16:20 laurus: mdeboard, just CPython.

16:20 ibdknox: technomancy: I think to me that falls under tryings being encouraged (RE: your tweet)

16:20 mdeboard: laurus: I'm not familiar with clojure-py at all so I'm confused by your question. Normal Python automatically prints things in the repl.

16:20 ibdknox: s/tryings/trying

16:21 angerman: Wasn't there an `indexed' function that returned the list with indices?

16:21 laurus: mdeboard, well, what I mean is, that if I run, say, (np/arange 3), it shows #<numpy.ndarray object at 0x1dea060>

16:21 But if I run (println (np/arange 3)) I get [0 1 2] and then nil.

16:21 So somehow it is not "printing" the first one.

16:22 mdeboard: laurus: I'd suspect `(np/arange 3)` internally calls the `__repr__` method in Python

16:22 laurus: mdeboard, ah, that's interesting.

16:22 I wonder if there is any way to change the REPL behavior.

16:23 mdeboard: and forcing evaluation calls the __call__

16:23 laurus: Because it's kind of annoying to have to run println on everything...

16:23 mdeboard: Clojure-py is kind of an annoying concept imo

16:23 laurus: Why?

16:23 clojurebot: Why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone

16:25 mdeboard: Because Python is already an abstraction, so is Clojure, then you combine these two abstractions and make something even leakier and you wind up with weird crap like having to run (println) to call a method

16:25 like if you want to use Clojure, use Clojure

16:26 Frozenlock: How does one use a function on a map? This was my naive approach: (map #(pr-str %1 %2) {:a 1 :b 2 :c 3})

16:26 mdeboard: I can understand like Jython or JRuby or whatever to target the JVM and all

16:26 laurus: mdeboard, but I want SciPy, matplotlib, etc. etc.

16:26 hcumberdale: mdeboard << slugifying... ahh

16:27 amalloy: angerman: indexed went out in 1.2, i think. you want something like ##(doc map-indexed)

16:27 lazybot: ⇒ ------------------------- clojure.core/map-indexed ([f coll]) Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f... https://refheap.com/paste/2292

16:27 angerman: amalloy: great, thanks

16:27 amalloy: Frozenlock: map only passes its function one argument. if you seq over a map, you get a seq of pairs - so to do something with the keys and values in a map, your function needs to accept one argument, a pair

16:28 Frozenlock: Oh!

16:28 I was over complicating things :)

16:28 Thanks!

16:29 mdeboard: laurus: Does Clojure-py let you use those libraries in clojure programs?

16:30 laurus: mdeboard, yeah, that's what's so great about it ;)

16:30 mdeboard: Ahh

16:30 laurus: For scientists it seems like Python has become the main "glue" language.

16:30 mdeboard: Wait, what

16:31 Frozenlock: laurus: no org-babel?

16:31 mdeboard: How would that work

16:31 laurus: mdeboard, I mean, they seem to use Python to link together a bunch of libraries written in Fortran, C++, etc.

16:32 So Clojure-py may not be so misguided after all :)

16:32 mdeboard: No, I mean, how would it work to have Python libraries compiled in a jar

16:32 laurus: mdeboard, oh, it doesn't let you do that, of course

16:32 By "Clojure" programs I meant Clojure programs compiled to Python bytecode.

16:32 I need to go; thank you for the help!

16:32 mdeboard: Oh, then why not just write in Python?

16:33 Iceland_jack: mdeboard: Personal preference?

16:33 laurus: mdeboard, because Clojure is a great language

16:35 mdeboard: I'm just averse to the notion of using only one language

16:35 Iceland_jack: Sorry what does that matter to you?

16:36 mdeboard: Because I enjoy having opinions

16:36 Iceland_jack: hah

16:36 ibdknox: I have no opinions. They are icky things ;)

16:37 Iceland_jack: Indeed, rid yourself off them. They will not be missed

16:40 jimi_hendrix: question: in (defmulti foo class), what does the class bit refer to?

16:41 mdeboard: Iceland_jack: You must be a hoot at parties

16:41 Iceland_jack: I am

16:42 mdeboard: PURGE IMPURITY FROM YOUR MIND

16:42 Iceland_jack: Yes?

16:42 clojurebot: yes is is

16:48 amalloy: mdeboard: have you tried applying your clojure-py objections to clojure-jvm? why would you write clojure to use java libraries? just writing in java works fine

16:49 mdeboard: amalloy: I was literally just thinking about that

16:49 babilen: Wouldn't it be great if you could use Python and Java libraries at the same time?

16:50 zakwilson: ibdknox: your resume links to diderot.com, which is dead.

16:50 Iceland_jack: babilen: If done correctly, it would be fantastic.

16:50 ibdknox: zakwilson: aw

16:50 zakwilson: that was a ridiculous project

16:50 mdeboard: I was reading the clojure py docs, I just don't feel like you gain anything close to what you do moving from Python to Clojure as you do from Java to Clojure

16:50 * zakwilson just wanted to see what it was.

16:51 ibdknox: zakwilson: it was an incredibly dumb idea lol, but they sank so much money into it

16:51 zakwilson: basically it was like open table, but for wine reservations

16:51 zakwilson: I wish somebody would sink money in to something I'm doing.

16:51 ibdknox: zakwilson: the guy had the largest single database of wines in the world

16:51 zakwilson: it's where I learned how much I hate SQL :)

16:51 zakwilson: Or just hire me for a well-funded project.

16:52 I hate SQL too!

16:52 Iceland_jack: Imagine there's noSQL...

16:52 zakwilson: I like the concept of relational databases, but how we interact with them is on a level comparable to assembly language, except SQL is a *horrible* assembly language.

16:55 kasterma: Is there a command to restart the slime-repl? Today twice I got bitten by old defs still being around; I'd like an easy way to start with a fresh slate.

16:55 raek: kasterma: well, you can use remove-ns

16:56 but if you have namespaces that depend on the namespace you removed, you have to remove the (manually) as well

16:56 or you can re-run clojure-jack-in

16:58 kasterma: Ahh, I thought I had tried the re-running of clojure-jack-in, but now it does give me a clean slime.

16:58 mdeboard: kasterma: I am sure there's a better way than this but what I do is switch to the swank buffer, kill that, then re-run clojure-jack-in

16:59 kasterma: I had tried re-running clojure-jack-in, but apparently I failed. Now it works. Not the cleanest, but much better than restarting my whole emacs. Thx!

16:59 zakwilson: In other news, who here gets too much email and uses android?

17:00 * zakwilson is working on something that could help. To stay on topic, at least the server-side parts will be Clojure.

17:00 amalloy: kasterma: technomancy tells me the latest (snapshot?) version of lein-swank clears old defs when you recompile

17:04 kasterma: amalloy: That would have saved me lots of time today. Added to my todo-list to update.

17:04 amalloy: or swank-clojure or whatever the relevant library is. you're probably better off looking around on the web than listening to me

17:05 kasterma: Todo item updated. :-)

17:05 mindbender1: please how do I prevent gen-class from overriding public final methods of the superclass

17:05 umren: in java, they using swing for guis?

17:11 mindbender1: am I hopeless with the gen-class issue. Please guys I need some pointers

17:15 dnolen: hmm does the Clojure compiler optimize calls to variadic fns? Does it create the seq at compile time?

17:15 muhoo: mindbender1: don't define them?

17:16 amalloy: dnolen: i don't think it can create the seq at compile-time unless all the arguments are known, right?

17:16 dnolen: amalloy: yes I'm talking about the common optimizable case (not higher order)

17:17 amalloy: no, i mean like (defn f ([x] ...) ([x y] ...)) (f a b) - it can't create a seq of a and b at compile time because they only have runtime values

17:17 but i think it doesn't even need to, unless you're using apply

17:17 ideally_world: is 4clojure working properly? I submitted an answer for #28 and I'm getting a "You tripped the alarm! def is bad!" message. The only restriction is flatten? :(

17:17 amalloy: ideally_world: you can't def things

17:18 ideally_world: really? been a while since I used it, thought I could defn ? :/

17:18 muhoo: ideally_world: use let

17:18 amalloy: no, just use letfn or whatever

17:18 ideally_world: ah, cool, thanks

17:18 so, then, yes it is working correctly :)

17:18 amalloy: dnolen: that is, (f a b) should compile into f.invoke(a, b), which is about as optimal as they come

17:19 mindbender1: muhoo: I don't understand clearly what you mean

17:19 dnolen: amalloy: sorry was not clear I only mean the rest arg case.

17:20 amalloy: so for something like (defn f [x & xs] ...) (f 1 2 3 4)?

17:20 muhoo: mindbender1: i don't either, because i haven't seen your code. but if gen-class is overriding stuff, usually it's because you've overridden it in your code somewhere

17:20 hcumberdale: mhhh!

17:20 (if number (q/limit number) nil)) << does not work

17:21 I want to add the code (q/limit number) if number is not nil

17:21 mindbender1: muhoo: the gen-class doc says that it overrides all public methods of the super class but I think it forgot to take public final methods into consideration

17:21 muhoo: it overrides the ones you define, IIRC

17:23 mindbender1: muhoo: I didn't define any of the super class methods I only specified that it extends the super class then I compiled the ns and then tried instantiating the generated class and the jvm throws an error that a public final method has been overridden

17:24 muhoo: did it say which one?

17:24 mindbender1: when I looked at the generated class the jd-gui I noticed all methods of the super class has been overridden

17:24 *with jd-gui

17:25 yes it did

17:25 muhoo: the constructor, perhaps?

17:26 mindbender1: you mean I shouldn't specify a constructor signature?

17:27 muhoo: i dunno. i haven't seen any problems like that, but i've been kind of cheating and using this instead of gen-class: https://github.com/llasram/shady

17:28 mindbender1: I'm sure if you can try extending a super class with a public final method you can reproduce the same errors

17:28 muhoo: post a simple breaking example on refheap.com maybe?

17:28 true_droid: hey guys! does clojure scan the entire source code for each function definition expanding all macros that it finds?

17:30 mindbender1: muhoo: I will try doing that in the mean time thanks for the link I want to definitely try that one out and see how it goes for the same situation

17:33 muhoo: do I use the same compile fn to generate the classes from shady as there no such instruction on the readme

17:34 true_droid: I'm trying to figure out this behavior https://refheap.com/paste/2294

17:38 dgrnbrg: I just synthesized my first simulatable module in piplin, a Clojure HDL, to Verilog: http://bit.ly/JZK1GO

17:38 Sorry, full link: http://blog.dgrnbrg.com/post/21600152008/hooray-first-synthesized-code-result-with-piplin

17:38 I'm very excited :)

17:39 amalloy: macros don't have a value, true_droid

17:39 though, bonus points for using a lambda as your shell prompt

17:41 true_droid: amalloy: yeah, I see that :) but why does the compiler generate the error and not runtime?

17:42 does this mean that the compiler is eager enough to look into the `let` form and evaluate its args?

17:42 amalloy: because...it's a compiled language, and you tried to refer to a symbol it can't find a value for?

17:43 true_droid: amalloy: hm, I see; so this behavior might be different in other Lisps, right?

17:43 amalloy: it absolutely does not evaluate the args of the let form, but it has to compile code for computing their values

17:43 *shrug*

17:43 anything might be different

17:48 true_droid: amalloy: thanks

17:48 dnolen: amalloy: yeah I'm thinking about (f 1 2 (array 3 4 ...))

17:49 and direct invocation to the rest case, no going through JS arguments object of course.

17:50 amalloy: in jvm-clojure, at least, i think (f 1 2 3 4) compiles to something like f.invoke(1, 2, new ArraySeq(new Object[] {3, 4}))

17:50 but now it sounds like you're talking about cljs

17:50 dnolen: amalloy: yes I was wondering how it was done in CLJ - that was the approach I'm thinking about for CLJS

17:57 amalloy: dnolen: just had a quick peek at some .class files - it looks like (f 1 2 3 4) compiles to f.invoke(1,2,3,4). c.l.RestFn implements that by calling doInvoke (which is your function's impl) by wrapping the remaining args in an ArraySeq

18:04 jimi_hendrix: does clojure not have tuples, or am i insane?

18:04 amalloy: it doesn't have/need tuples. just use vectors or whatever

18:04 dnolen: i think that layer of indirection is necessary for dynamism in clojure (what if f is recompiled to take a different number of positional args), but you could do better in a precompiled language like cljs

18:04 jimi_hendrix: ok

18:06 dnolen: amalloy: yeah this would be an optimization for advanced compilation or :static-fns true

18:11 mmarczyk: anybody interested in running some jsPerf tests for CLJS? (trying to figure out just how fast small ObjMaps are for access) see links on the ticket: http://dev.clojure.org/jira/browse/CLJS-190

18:14 ah, wait

18:14 should have included aget on object, I guess

18:15 oh bother.

18:15 I'll edit.

18:16 oh no, I will not -- forgot to wrap aget in prep code -- in the next batch then

18:17 dnolen: mmarczyk: looks about right

18:18 mmarczyk: dnolen: yeah

18:18 dnolen: I think the current reprecating patch doesn't use transients when doing the conversion though

18:19 dnolen: so I'll make a new one

18:20 dnolen: mmarczyk: I wonder what a good threshold is?

18:22 mmarczyk: dnolen: yeah... not at all clear to me

18:22 dnolen: the 16 is totally random (slightly more than array map threshold in clj)

18:23 dnolen: mmarczyk: try 64?

18:23 mmarczyk: dnolen: I'm thinking to do a jsPerf tests for conversions from various sizes, will try 8, 6, 32, 64, 128

18:24 dnolen: constructing an ObjMap by hand, then running the conversion function. we'll see what sort of difference this makes

18:25 dnolen: mmarczyk: we should pick the size where PHMs overtake, clearly at 500 keys PHMs win based on your earlier tests.

18:25 mmarczyk: ^"I'm thinking about doing a jsPerf test"

18:28 dnolen: ok, I'll do some lookup tests for larger sizes too

18:30 hm, must take care of sth else though just now, will post the new tests when I get back w/ the new patch

18:31 dnolen: btw, I don't know what to make of the "hand-assoc'd" vs. literal thing

18:31 dnolen: if there were no difference -- fine, but hand-assoc'd >> literal is just weird

18:32 ok, bbl

19:40 huangjs: hmm...my slime repl will drop if I do completion for keywords (i.e. (get :k <--- then press tab to complete), in *swank* it says "unreadable message: (:emacs-rex (swank:completions-for-keyword ":k" ...

19:40 anyone has the same trouble?

20:09 hcumberdale: how can I get the context (url) of my web application in clojure?

20:09 http://www.xyz.ch/tickets/123 << I mean http://www.xyz.ch

20:18 lynaghk: mmarczyk: your suggestion yesterday about using metadata to change how an atom prints works fine in Clojure, but in cljs printing is implemented as a protocol rather than multimethod so the same trick doesn't work

20:19 Have any other ideas?

20:33 jimi_hendrix: has anyone had an issue with slime/swank where connecting to 'lein swank' via slime-connect does not spawn a repl

20:36 ibdknox: Anyone know who has the power on HN to change the title of someone else's post?

20:40 charles_r: I've noticed that every so often, my repl just hangs. I'm using slime in emacs 22. Has anyone solved this?

21:03 brehaut: charles_r: are you driving a mac?

21:13 mdeboard: cemerick: Hey do I get a check for $1 if I spot an error in your book

21:14 (re: SICP)

21:14 cemerick: mdeboard: If I open myself up to that, I may be signing my AOT bankruptcy papers. :-)

21:14 mdeboard: Page 63 of my edition has an error right at the top when describing the reduce function

21:15 &(reduce max [0 -3 10 48])

21:15 lazybot: ⇒ 48

21:15 mdeboard: but the book says 10 :(

21:15 lol

21:15 @ bankruptcy

21:16 cemerick: well, now I just hate myself :-|

21:16 Hopefully that's the only blatantly stupid error in the thing.

21:16 mdeboard: thanks for pointing it out though :-)

21:16 mdeboard: Feh this is by far the best Clojure book

21:16 I've read Joy of and Practical Clojure

21:17 cemerick: mdeboard: you can open an issue on the github repo if you like

21:17 There's an errata tag.

21:17 mdeboard: The "down the rabbit hole" and chapter 1 are both amazing intros that weren't matched in the other two

21:17 cemerick: Thanks :-)

21:17 mdeboard: be sure to leave your reviews when you're ready

21:17 mdeboard: Where's the repo?

21:17 cemerick: https://github.com/clojurebook/ClojureProgramming

21:18 mdeboard: Do I need to tag it with errata somehow?

21:20 cemerick: mdeboard: you don't need to, I can do it. There should be an errata label on the 'new issue' screen for the repo.

21:20 mdeboard: Ok then

21:21 https://github.com/clojurebook/ClojureProgramming/issues/9

21:22 cemerick: thanks :-)

21:22 mdeboard: np, thanks for the awesome book.

21:24 cemerick: thanks for the feedback, keep it coming

21:24 s/feedback/bug reports ;-)

21:41 clojure_newb: I think the following is a perfectlyr easoanble request. If not, please explain to me why. I want a clojure IDE (with repl, documentation, browsing of the source tree, and listing of all the def's and defn's) -- written and scriptable in clojure. Why does this not exist?

21:42 hiredman: I want a flying car

21:42 also peace on earth, I guess

21:42 but war on mars

21:43 seancorfield: clojure_newb: clooj probably comes closest - that's written in clojure

21:43 clojure_newb: hiredman: I think my requests are slightly less ambitious

21:43 seancorfield: https://github.com/arthuredelstein/clooj

21:44 clojure_newb: I've looked at clooj

21:44 I would have to do work myself, i.e. hack in the scriptability part

21:44 seancorfield: why not contribute to that open source project to make it better? i'm sure arthur would appreciate the help

21:44 brehaut: the simple answer is "because nobody has written one"

21:45 the more complex answer is "it takes a lot of effort to write all that"

21:45 clojure_newb: because I would slow down the project

21:45 <-- not professionaly trained, mainly a hobbyist

21:46 seancorfield: fork it on github, add scriptability, send arthur a pull request

21:48 most clojurians are probably not writing clojure for their paid day job btw

21:53 TimMc: OK, how do I initialize a DB schema in Korma?

21:54 I've tried (exec-raw db (slurp "schema.sql")) but the SQLite file remains empty.

21:57 mdeboard: hiredman: lol @ war on mars

21:58 TimMc: Isn't that what defdb does

21:58 oh, right.

22:03 TimMc: I've looked at Lobos, but the only example I've seen is insane: https://github.com/vijaykiran/clog/blob/master/src/lobos/migrations.clj

22:05 kab3wm: with-open should negate the need to (flush) or (.close s) right?

22:06 TimMc: And Ragtime doesn't seem to provide a way to initialize.

22:06 kab3wm: Right.

22:09 jayunit100: guys i just saw this question on stackoverflow its a really good one

22:09 http://stackoverflow.com/questions/10271653/is-there-a-clean-way-to-add-functions-to-a-dynamically-created-namespace

22:09 he poses the question of how to dynamically add functions to a namespace - and has a macro solution which doesnt seem to work.

22:12 xeqi: TimMc: korma.incubator has some schema stuff in it

22:12 TimMc: xeqi: Thanks, I'll check that out.

22:12 It just feels like I must be missing something obvious.

22:14 Hmm, that doesn't allow loading of raw SQL, which is what I assumed.

22:15 Well, anything that works...

22:15 _KY_: I find it rather strange that (nil? ()) is false, why is that?

22:16 charles_r: only 'nil and 'false are false . . . just like Ruby if I recall

22:16 metellus: () is a list with no elements

22:16 felideon: shouldn't it be like lisp?

22:16 kab3wm: TimMc: I've used Korma, but didn't require initalizing a DB. Looking at the API, exec-raw seems like a good approach. Seems like if you could get a simple 'SELECT * from whatevs' with exec-raw working you could do anything.

22:17 mdeboard: &(nil? '())

22:17 lazybot: ⇒ false

22:18 mdeboard: Someone had a good table of truthy and falsey values that I cannot find atm

22:18 might have been TimMc?

22:18 ivan: is repl-utils available anywhere but clojure.contrib?

22:18 mdeboard: ivan: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

22:18 says uhm

22:18 felideon: &(nil? ())

22:18 lazybot: ⇒ false

22:18 mdeboard: migrated to clojure.repl and clojure.java.javadoc

22:19 &(nil? 0)

22:19 lazybot: ⇒ false

22:19 xeqi: TimMc: ah, you want to just send sql, it looks like exec-raw uses jdbc/do-query which doesn't handle that

22:19 ivan: mdeboard: thanks! I should've looked there

22:19 xeqi: I can try and paste something with jdbc in a moment

22:20 TimMc: xeqi: Oh, huh.

22:20 Well, if I use JDBC, I'll use do-commands

22:20 with splitting on semicolons -.-

22:20 xeqi: basically what I would have written

22:21 TimMc: I've got something like that lying around.

22:21 I'm just having trouble believing that's not already in JDBC.

22:22 xeqi: theres lots of things that aren't built yet

22:22 like nested transaction rollback w/ savepoints

22:22 ivan: I'm making clj-swingrepl better, anyone have feature requests?

22:23 _KY_: The word nil means something empty, and () is empty...

22:23 What is nil equal to? only false? then what is the difference between nil and false?

22:23 felideon: _KY_: I wonder if this it's why When you ask a sequence on its last element for the rest it returns another logical sequence. You can only tell if that sequence is empty by calling seq on it in turn. This enables sequences and the sequence protocol to be lazy.

22:24 hiredman: ~google "define nil"

22:24 clojurebot: First, out of 1060 results is:

22:24 Nil | Define Nil at Dictionary.com

22:24 http://dictionary.reference.com/browse/nil

22:24 xeqi: &(= nil false)

22:24 lazybot: ⇒ false

22:24 jappinen: so if I do a $lein swank, then a M-x slime-connect I can successfully connect to my swank server and execute code from buffers... in addition how do I open up a repl to that swank server... I don't see a repl buffer like I do if I M-x clojure-jack-in?

22:24 felideon: this is*

22:24 _KY_: ,(rest ())

22:24 clojurebot: ()

22:25 brehaut: trying to pin down the exact meaning of nil seems like a difficult task

22:25 _KY_: Yes, nil means "nothing"

22:25 brehaut: what kind of nothing

22:25 in clojure its a value, but it also doubles as null in java which is a reference nothing

22:25 _KY_: It seems to have no use if it's not equal to (), from what I see'

22:26 * brehaut boggles

22:26 _KY_: You mean null pointer?

22:26 lynaghk: mmarczyk: for reference, I used (extend-protocol IPrintable...) to get the cljs serialization working.

22:26 brehaut: well, the null reference; its not a bare pointer in java

22:27 felideon: "Keywords are not Symbols" ... so what are keywords if I may ask?

22:27 _KY_: What would be an example that returns nil?

22:27 brehaut: ,({:a 1} :b)

22:27 clojurebot: nil

22:27 _KY_: I see... thanks for explaining...

22:27 brehaut: huge amounts of the clojure library return nil for things

22:29 seancorfield: ,((juxt next rest) ())

22:29 clojurebot: [nil ()]

22:30 seancorfield: ,(map seq [nil ()])

22:30 clojurebot: (nil nil)

22:30 seancorfield: ,(map empty? [nil ()])

22:30 clojurebot: (true true)

22:31 seancorfield: ,(map type [:a-keyword 'a-symbol])

22:31 clojurebot: (clojure.lang.Keyword clojure.lang.Symbol)

22:32 seancorfield: ,(identical? :a-keyword :a-keyword)

22:32 clojurebot: true

22:33 seancorfield: ,(identical? 'a-symbol 'a-symbol)

22:33 clojurebot: false

22:33 seancorfield: felideon: does that help?

22:33 felideon: hmm

22:34 seancorfield: keywords evaluate to themselves - a unique instance - symbols evaluate to whatever they are bound to

22:34 ,(let [a-symbol "my-value"] a-symbol)

22:34 clojurebot: "my-value"

22:36 felideon: ,'foo

22:36 clojurebot: foo

22:37 seancorfield: ,(quote foo)

22:37 clojurebot: foo

22:37 felideon: ,(let [foo 'bar] foo)

22:37 clojurebot: bar

22:37 seancorfield: ,(macroexpand 'foo)

22:37 clojurebot: foo

22:37 seancorfield: hmm, that didn't do what i expected :)

22:38 ,(let [a :one, b a, a :two, c a] (str "b is " b " and c is " c))

22:38 clojurebot: "b is :one and c is :two"

22:38 seancorfield: in that expression the symbol a is bound to :one, then b is bound to a's value, then a is (re-)bound to :two, then c is bound to a's (new) value

22:48 ivan: how do I do something like (binding (get-bindings) blah)?

22:48 that causes Caused by: java.lang.IllegalArgumentException: binding requires a vector for its binding in ...

22:49 felideon: ,(nil? [])

22:49 clojurebot: false

22:50 metajack: How do other people do webapp configuration in clojure? Do you use the servlet JNDI stuff? How do you do the config when you are testing at the repl? So far what I'm doing feels a little clumsy.

22:53 brehaut: metajack: my clojure web stuff is pretty simple; im just running an embeded jetty and using couchdb via clutch. i do all my configuration via a binding based middleware around my ring handler

22:54 metajack: brehaut: I don't suppose there is a sample on github I could look at?

22:55 wkmanire: Good evening.

22:55 :)

22:55 brehaut: metajack: sorry, windows VM is grinding my machine to a crawl. one moment

22:55 metajack: right now I am reading things out of JNDI for production and have that wrapped in an (if …) for when the JDNI lookup fails at the repl. I suppose one alternative is to somehow bundle a .config in the distributed jar or read from /etc

22:56 brehaut: metajack: http://brehaut.net/blog/2012/configuration_middleware is the closest i have to public examples

22:58 beffbernard: Style question… do I do something like (for [option options] [:option option]) or (mapcat #(vector (option %)) options) given (defn option [value] [:option value])

22:58 xeqi: metajack: clojars reads a resource file, and using lein2 profiles can specify different resource-paths

22:59 metajack: xeqi, brehaut: thanks for these examples!

23:01 wkmanire: brehaut: The ring link on your site is broken.

23:01 404

23:01 brehaut: huh, so it is

23:02 wkmanire: try http://brehaut.net/blog/2011/ring_introduction

23:02 metajack: xeqi: so it looks like clojars puts some production config.clj into ./resources. does it get added to the war or is clojars deployed some other way?

23:02 wkmanire: brehaut: Thanks.

23:02 That is one badass link transition by the way.

23:03 brehaut: ?

23:03 oh, the mouse over?

23:03 wkmanire: When you mouse over hyperlinks they do a transformation.

23:03 Very cool

23:03 xeqi: it's deployed just using an uberjar that starts jetty

23:03 brehaut: thanks :)

23:03 xeqi: but I don't see why it wouldn't work with the config in a war

23:04 muhoo: is ther some way to grab ahold of the handler in noir from within the repl?

23:04 i see gen-handler to create a new one. i don't want that. i want somehow to grab ahold of the handler that was gen'ed and handed to jetty

23:04 brehaut: wkmanire: fixed; it'll be live next time the nginx cache is refreshed

23:05 metajack: xeqi: i guess i was trying to keep the config outside of the war. i probably need to see what tomcat does for classpath stuff

23:06 Frozenlock: Is there a function to sort "smartly"? For example, I would like if "10" was coming after "2" when sorting strings.

23:06 ,(sort ["x1" "x10" "x2"])

23:06 clojurebot: ("x1" "x10" "x2")

23:08 rlander: I just create my first (very) small utility library in clojure. Could anybody take a look at the code, please? I'm not sure if it's idiomatic...=)

23:09 http://hastebin.com/xexeqicufo.lisp

23:10 tmciver: rlander: the body of the trim-to function could simply be (take trim-value string-to-trim)

23:11 salisbury: is there an easy manner in which to change a byte from BE to LE?

23:11 tmciver: actually (apply str (take trim-value string-to-trim))

23:11 technomancy: is it crazy that I'm a lot more interested in Light Table as a browser than as an editor?

23:12 rlander: tmciver: Thanks for looking, I'll try that and run the tests!

23:12 tmciver: technomancy: lein question: if I use checkouts do I need to include that dep in the project file?

23:12 xeqi: technomancy: yes

23:12 technomancy: tmciver: yes, checkouts are supplemental

23:13 xeqi: my first thought when clojurescript was announced was: I wonder if I can use this for extending my browser

23:13 tmciver: technomancy: what if the lib has no public pom, how does lein get it's deps? I see that the checked out project's lib directory is not put on the classpath by default.

23:14 technomancy: tmciver: right; leiningen doesn't work with dependencies that don't have poms

23:15 rlander: tmciver: Other than that, is it ok? It's my first time touching Java since college =)

23:16 tmciver: technomancy: OK. I tried to use a function in :checkout-deps-shares as I saw in the sample project.clj but I get a NPE somewhere.

23:16 technomancy: tmciver: ooh interesting; I hadn't thought of that

23:16 tmciver: technomancy: I was trying to just add that project's lib dir.

23:17 rlander: well, I don't know anything about that Normalizer thing but it looks pretty good to me.

23:17 technomancy: tmciver: the path of least resistance is definitely to create a project.clj file

23:17 tmciver: technomancy: for what? The checked out project? It has one.

23:18 rlander: tmciver: thanks!

23:18 technomancy: tmciver: I must be misunderstanding you then; I thought you said the lib has to public pom

23:19 "Philosophers and logicians--including Aristotle--have long discoursed on the properties and attributes of objects. Von Wright, according to [Hughes68,p.184], distinguishes between formal properties, "whose belonging to an object is always either necessary or impossible", and material properties "whose belonging to an object is always contingent"."

23:19 <- from the Egal paper

23:19 "Obviously, material properties--being contingent--cannot contribute to an object's identity, while formal properties--being necessary--are an inherent part of an object's identity."

23:19 makes me think of values vs metadata

23:21 though he talks about material properties being mutable, which isn't true of metadata

23:21 though it is true of text-properties on emacs strings

23:21 tmciver: technomancy: when I say no public POM I mean this lib is not on clojars or maven central so lein's attempts to find its deps will fail. But it does have a project.clj, of course, so I could create a POM but I thought the point of checkouts was to avoid all of that.

23:21 ivan: how do I apply a map like {:init set-defaults!} to call like (func :init set-defaults!)?

23:21 tmciver: I'm sure it's something I'm misunderstanding.

23:22 technomancy: tmciver: the point of checkouts is to offer a more convenient workflow while developing on two projects

23:22 it really doesn't have anything to do with declaring dependencies

23:22 you need to get things working solely in terms of project.clj first, then you can add the convenience of checkout deps

23:23 ivan: oh, got it, (flatten (seq

23:23 technomancy: flatten?

23:23 clojurebot: flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.

23:23 xeqi: &(apply (partial apply str) {:a :b})

23:23 lazybot: ⇒ ":a:b"

23:23 tmciver: technomancy: but in order for the main project to access the transitive deps I need to either declare the checked out project in project.clj or have the checked out project's lib dir on the classpath. Am I thinking about this correctly?

23:24 technomancy: tmciver: the lib dir is an implementation detail

23:24 tmciver: ?

23:24 technomancy: if you're thinking in terms of the lib dir or the classpath directly then you're making an abstraction leak

23:25 you should be thinking in terms of declaring your dependencies and letting Leiningen worry about finding them

23:26 if you have dependencies that aren't part of a repository, your first order of business should be to get them into a repository

23:26 (this is assuming a proper project that you want to automate rather than just screwing around or experimenting)

23:27 kovasb: anyone here use c2?

23:27 tmciver: technomancy: as an example my main project does not depend on commons-lang but the checked out project does. Running 'lein deps' on the main project does not pull it down though; running on the checked out project does. But the main project does not seem to have access to commons-lang.

23:29 technomancy: tmciver: is this because the main project doesn't have the other in its :dependencies?

23:29 tmciver: technomancy: yes, and if I put it there, lein complains that it can't find it.

23:30 technomancy: tmciver: ok, then what you need to do is make sure that the checkout project is in a repository that the main project can reach

23:30 tmciver: if you only care about making it work on your machine, you can use `lein install`; otherwise you need to do `lein deploy` on a private repository

23:30 easiest way to do that is with s3-wagon-private

23:30 ~repeatability

23:30 clojurebot: repeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability

23:30 technomancy: ^ probably want to read that while you're at it

23:31 tmciver: technomancy: Ah! Looking... I think 'lein install' might be what I want.

23:32 technomancy: I'd like the checkouts thing to work if I were using a private project (that wasn't in any public repo yet).

23:32 technomancy: sure

23:34 Lajjla: $(apply str {:a :b})

23:34 &(apply str {:a :b})

23:34 lazybot: ⇒ "[:a :b]"

23:35 Lajjla: Intruiging

23:35 &(apply + {:a :b})

23:35 lazybot: java.lang.ClassCastException: Cannot cast clojure.lang.MapEntry to java.lang.Number

23:35 yoklov: apply probably coerces it to a seq or something

23:36 Lajjla: &(apply str (seq {:a :b}))

23:36 lazybot: ⇒ "[:a :b]"

23:36 Lajjla: &(seq {:a :b})

23:36 lazybot: ⇒ ([:a :b])

23:36 Lajjla: You gotta explain that one to me

23:36 Ohhhhhhh

23:36 tmciver: &(seq {:a 1 :b2})

23:36 lazybot: java.lang.RuntimeException: Map literal must contain an even number of forms

23:37 tmciver: &(seq {:a 1 :b 2})

23:37 lazybot: ⇒ ([:a 1] [:b 2])

23:37 Lajjla: &(str '[a b c d])

23:37 lazybot: ⇒ "[a b c d]"

23:37 Lajjla: Am I the only one who finds that particularly weird?

23:37 &(str "I worship his shadow")

23:37 lazybot: ⇒ "I worship his shadow"

23:37 metellus: what's weird about it?

23:37 tmciver: Oh no!

23:38 Lajjla: Clojure, you confuse me.

23:38 metellus, well, check that

23:38 Why would a string called with a vector be that?

23:38 &(str [\a \b \c \d])

23:38 lazybot: ⇒ "[\\a \\b \\c \\d]"

23:38 metellus: so you know it's a vector

23:38 Lajjla: But surely it should signal an error since it's not a character

23:39 &(str [\a \b \c \d] [\e \f \g \h)

23:39 lazybot: java.lang.RuntimeException: Unmatched delimiter: )

23:39 mdeboard: What

23:39 Lajjla: &(str [\a \b \c \d] [\e \f \g \h])

23:39 lazybot: ⇒ "[\\a \\b \\c \\d][\\e \\f \\g \\h]"

23:39 metellus: that's not what str does

23:39 Lajjla: &(str \a \b \c)

23:39 lazybot: ⇒ "abc"

23:39 mdeboard: &(for [s "Hello world"] s)

23:39 lazybot: ⇒ (\H \e \l \l \o \space \w \o \r \l \d)

23:39 Lajjla: metajack, then what does it?

23:39 mdeboard: What are you confused by, Lajjla?

23:40 I don't understand your question, "Why would a string called with a vector be that?"

23:40 metellus: With one arg x, returns

23:40 x.toString()

23:40 Lajjla: And with two/

23:40 metellus: a concatenation of their .toString(0s

23:40 .toString()s

23:41 Lajjla: So a character .toString in java returns just a single character string?

23:41 metellus: yes, what else would it return?

23:41 Lajjla: THe external repraesentation of the character apparently if it does that with a vector?

23:41 metellus: a vector is not a character

23:41 Lajjla: Why does it return the external repraesentation in one case but just the sequence of codepoints in another

23:41 Yes

23:42 so why does it do something fundamentally different on a character as it does on a vector

23:42 metellus: how is it fundamentally different?

23:42 Lajjla: Because in one case it's the external repraesentation and in antoher is not.

23:42 metellus: I don't know what you mean by "the external representation"

23:42 Lajjla: Basically, if this was on an IQ test, as in [a b] is to "[a b]" as \a is to ...

23:43 You would answer "\a" and not "a"

23:43 metellus, what you write down in code to denote that datum

23:43 the external repraesentation of a character z is like "\z" in code

23:43 mdeboard: I think you mean literal representation, not external.

23:43 xeqi: &(str (Object.))

23:43 lazybot: ⇒ "java.lang.Object@9a6cc8"

23:44 Lajjla: mdeboard, same thing, different terminology

23:44 Well

23:44 mdeboard: No.

23:44 It's not.

23:44 Lajjla: that is the part where it's even more confusing, though I can see what it means

23:44 tmciver: Lajjla: I think you're expecting (str [:a :b]) to behave like ##(apply str [:a :b])

23:44 lazybot: ⇒ ":a:b"

23:44 Lajjla: Not at all

23:45 I'm saying that if (str \a) returns "a" then that thing should signal an error or return nil, because it doesn make sense.

23:45 amalloy: i think he just wants pr-str

23:45 &(pr-str \a)

23:45 lazybot: ⇒ "\\a"

23:45 Lajjla: To call it on a non character in that sense

23:45 Well, that is the reverse case

23:45 Raynes: amalloy: WAZUP

23:45 mdeboard: &(class \a)

23:45 lazybot: ⇒ java.lang.Character

23:45 mdeboard: &(class "a")

23:45 lazybot: ⇒ java.lang.String

23:45 Lajjla: If (str [1 2 3]) returns that then (str \a) should return "\a"

23:46 amalloy: hey, Raynes, you made it home! when i didn't see you at all yesterday i thought maybe you died on the way

23:46 Raynes: amalloy: Bahaha. Didn't I talk to you earlier today? I thought I did.

23:46 tmciver: technomancy: thanks for the help; 'lein install' was what I needed.

23:46 mdeboard: Lajjla: Then how would you propose differentiating a Character instance from a symbol?

23:46 yoklov: ugh, callbacks are awkward in cljs :/

23:46 Lajjla: tmciver, but surely you agree that [a b c] in code is to "[a b c]" as \a in code is to "\a" ?

23:46 amalloy: oh, i guess you did. i don't really pay attention

23:47 Lajjla: mdeboard, what do you mean, a character becomes "\a", a symbol becomes "a-symbol"

23:47 muhoo: and stop calling him shirley.

23:47 mdeboard: What.

23:47 metellus: Lajjla: it doesn't show up as "[a b c]" because that's how it's represented in code, it shows up that way because it's a logical way to display it as a string

23:47 mdeboard: Are you trolling?

23:47 amalloy: tmciver, muhoo: Lajjla just likes to complain about existing functionality

23:47 muhoo: i noticed that

23:47 amalloy: oh, and mdeboard

23:47 metellus: similarly, the logical way to display a character as a string is to display that character

23:47 Lajjla: metellus, but surely to display a character as a string as "a" is not useful since (str \a) becomes the same as (str "a")

23:48 If you're talking about differentiating

23:48 metellus: I'm not talking about differentiating

23:48 Lajjla: Well, define for me, what does str do then exactly?

23:48 Because with vectors it seems to display the code you must enter to parse into that datum

23:49 metellus: calls .toString() on its arguments

23:49 Lajjla: and with strings and characters it does something unrelated

23:49 What is the definition of .toSTring() then?

23:49 muhoo: there's that shirley again :-)

23:50 http://www.youtube.com/watch?v=0A5t5_O8hdA

23:50 metellus: it takes the object and converts it to a string, generally for reading by humans

23:51 Lajjla: metellus, reading as in, inferring what that object is?

23:51 As we already established that there is colission

23:51 metellus: [a b c] becomes "[a b c]" because that's a handy way to display a list, not because that's how you write the code (although the two are similar)

23:51 no, not reading as in inferring what that object is

23:51 Lajjla: Reading for what purpose then?

23:51 xeqi: more collision ##(str "[a b c]")

23:51 lazybot: ⇒ "[a b c]"

23:51 metellus: reading as in reading and seeing what it represents

23:52 Lajjla: Quite, was about to point that out.

23:52 That is the same thing in different words.

23:52 metellus: for example calling toString on a Date object gives a string of the form dow mon dd hh:mm:ss zzz yyyy

23:52 Lajjla: But there is colission, does "[a b c]" repraesent a vector or a string as xeqi pointed out?

23:52 metellus: which does not and should not have anything to do with how the Date looks in code

23:52 Lajjla: Well, that's another case then I guess.

23:52 str seems to do many things.

23:52 Depending ont he type of its argument

23:53 metellus: in Java, each class defines its own .toString

23:53 so yes

23:53 well, either defines its own or inherits it

23:53 Lajjla: True

23:53 xeqi: I'm surprised I haven't heard serialization come up yet

23:58 felideon: what's the best way to just pop into a REPL without having a project.clj

23:59 amalloy: lein repl, for whatever recent version of lein

23:59 felideon: hmm that works

Logging service provided by n01se.net