#clojure log - Apr 08 2011

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

0:00 livingston: eh, I got enough of what I need, more or less

0:02 Raynes: livingston: Opening it up in a text editor usually works for me.

0:03 livingston: Raynes: yeah I did I saw enough, I mostly wanted to verify what method signatures were there. then I confirmed it by importing the class into my repl and calling show on it.

0:08 mec: anyone know how to disable the automatic stack trace on exception in emacs?

0:09 livingston: mec: why? (in slime?)

0:09 mec: because 99% of the time just printing the exception to the repl would be fine

0:10 livingston: oh you mean you want it to just automatically hit '0' for you?

0:12 i'm sure if there isn't a setting for that, you could probably write some elisp to catch that buffer and just send it a '0' as input.

0:13 Havvy: My output is a lazy-seq and (doall) isn't removing the lazyness. :(

0:14 Hmm, might be the placement of the (doall)

0:15 mec: Im sure I saw a setting somewhere that enabled the stack trace, I just cant find it again

0:32 Havvy: (str (interpose " " ["nick:"

0:32 nick-lower "cmd:" cmd-lower "params:" parameters-lower]

0:32 ,(str (interpose " " ["nick:"

0:32 clojurebot: EOF while reading

0:32 Havvy: nick-lower "cmd:" cmd-lower "params:" parameters-lower]))

0:33 ,(str (interpose " " ["nick:" "cmd:"]))

0:33 clojurebot: "clojure.lang.LazySeq@73ee01f6"

0:33 mec: ,(apply str (interpose " " ["nick:" "cmd:"]))

0:33 clojurebot: "nick: cmd:"

0:34 Havvy: Why do you apply?

0:35 mec: ,[(str [1 2 3]) (apply str [1 2 3])]

0:35 clojurebot: ["[1 2 3]" "123"]

0:35 Havvy: Oh.

0:35 livingston: so if I'm calling some clj from java with something like this: ((IFn)RT.var("clojure.core", "println").deref()).invoke("Hello World");

0:36 but I want to call my own function in another ns that hasn't been loaded yet, how do I load it... I'm assuming there a function on RT?

0:40 Havvy: So, (or (= var 1) (= var 2)) and (#{1 2} var) are equivalent?

0:42 mec: yes

0:43 Havvy: Sweet.

0:46 mec: ok so it looks like i need to disable sldb any idea where that setting might be?

0:48 livingston: Havvy: if that's all you were doing and those are constants the first is greatly preferred

0:49 first you're not created a set, and second, your intensions as a coder are clearer. unless you actually have a set of numbers you're testing against.

0:55 dnolen: Havvy: livingston: the second version is three times faster.

0:56 livingston: how can that be?

0:58 dnolen: livingston: sorry it depends. if the data doesn't match often 2nd version quicker. depending on the number of tests (each a fn call), 2nd version faster.

0:59 mec: checking against a set is just a hash table lookup

0:59 dnolen: in anycase, 2nd version is plenty idiomatic.

1:00 livingston: the second version is hashing too... there's no way. that hash table would have many items I would think. if you're talking find in a linked-list verus a hash-table, usually you have to get up 10's of things before the hashtable wins. I don't know if there is something sneaky under the hood of clj for small sets

1:01 mec: I cant for the life of me figure out where swank-clojure actually hooks exception handling into sldb

1:02 dnolen: livingston: in an or test you have multiple fn calls. a hash look up 1 call.

1:02 mec: i believe small sets may use lists, at least clojure specifically says it changes underlying types sometimes for speed

1:06 dnolen: ,(type #{1 2})

1:06 clojurebot: clojure.lang.PersistentHashSet

1:06 dnolen: ,(type {1 2})

1:06 clojurebot: clojure.lang.PersistentArrayMap

1:07 dnolen: ,(type (into {} (map vec (partition 2 (range 32)))))

1:07 clojurebot: clojure.lang.PersistentHashMap

1:27 amalloy: i guess livingston is gone by now, but if someone else wanted to look into a compiled java .class file, javap is a good builtin

1:41 hiredman: I've been thinking of writing some to take clojure class file and print it out as pseudo clojure code

1:42 but javap works well

1:50 tomoj: hostname

1:50 oops

1:55 bartj: I see that the title-case function of c.c.str-utils2 is not implemented

1:55 how do I go about submitting an implementation ?

1:56 brehaut: bartj: well, old contrib is no longer being maintained

1:56 bartj: oh

1:56 brehaut: bartj: otherwise you need to have signed the contributer agreement and then should post to the dev mailing list

1:57 the maintainer of the package (or someone equally authoritive) will tell you the next step

1:57 bartj: I think it is Sierra

1:59 amalloy: isn't str-utils2 basically EOLed anyway?

1:59 brehaut: it seems likely

2:00 bartj: EOLed ?

2:00 brehaut: end of life

2:00 bartj: end of life ?

2:00 deprecated ?

2:00 amalloy: i think book authors should say "use this library, which at some point in the future will surely be deprecated"

2:00 bartj: ok, there are some useful functions in str-utils/str-utils2

2:01 which seem to be missing in clojure.string

2:01 amalloy: bartj: a lot of those got promoted to clojure.core

2:01 er

2:01 clojure.string

2:02 i like c.c.string, personally, but it's deprecated and that's just tough luck. there are good reasons, like not working well for non-english languages, i'm sure

2:02 bartj: hmm, ok; so I gather it is not worth the effort in this case

2:02 thanks

2:39 seancorfield_: i rely on c.c.sql so i want to see that promoted to core :)

2:40 amalloy: seancorfield_: tried clojureql?

2:41 seancorfield_: yeah, but i haven't really settled into it yet

2:42 i think i prefer the c.c.sql approach to be honest

2:42 markoman: anyone recall the site that had a good list of things you should know before running Clojure?

2:43 it talked about installing, lein, ides and so forth

2:43 short article / blog post

2:44 seancorfield_: http://dev.clojure.org/display/doc/Getting+Started ?

2:47 markoman: it wasnt that. it was more oriented for people who know almost nothing about clojure and what they would expect to face when learning it

2:47 seancorfield_: amalloy: my concern with clojureql is that it builds a representation of that then needs to be translated to sql (each time)... and i'm actually trying to get away from sql abstractions at the moment :)

2:48 markoman: hmm, then i've no idea... but i'd like to read it if someone figures out which page it is :)

2:49 i could do with more such references to feed to friends that i want to convert to clojure!

3:05 markoman: right, i bookmarked too much sites last week and some i didnt, so im messed with all information at the moment myself :)

3:08 dont you think lein is very easy? just load the script on bin directory, run it and lein repl and there you go?

3:16 amalloy: markoman: it sure is!

3:39 seancorfield_: markoman: oh, i love leiningen... that's my build tool of choice... i wish CCW respected it better :)

3:40 markoman: i have added some custon tasks/targets on lein, but im not sure, if I can get them on IntelliJ Lein panel like the default targets are there visible and usable as single clicks

3:40 or double clicks maybe

4:08 ejackson: Salwe.

4:12 amalloy: hey ejackson, fliebel was looking for you, in search of an airplane quote

4:13 ejackson: lol. Not surprisingly netjets figured I was a joker. I'm going to try again.

4:13 amalloy: hahaha

4:13 ejackson: they can smell time rich, money poor over the phone

4:14 amalloy: $mail fliebel netjets thinks ejackson is a wacko. he's trying again. next time you're looking for him, utilize sexpbot to $mail him instead of wandering away :)

4:14 sexpbot: Message saved.

4:15 ejackson: ,(conj long-list-of-people-who-thingk-ejackson-is-a-wacko netjets)

4:15 clojurebot: java.lang.Exception: Unable to resolve symbol: long-list-of-people-who-thingk-ejackson-is-a-wacko in this context

4:46 cuvavu: Hi

4:47 Is anyone using appengine-magic successfully with eclipse and ccw?

4:52 markoman: i have tried but couldnt

4:53 then i tried netbeans, didnt work too good and finally IntelliJ which has been working best in my case

5:00 they have a google group for support

5:07 what should I know when using lein pom to publish my jar to clojars?

5:09 and can i use lein to upload something to clojars?

5:13 cuvavu: what is their google group?

5:14 I've found a general web-apps one - is there one for appengine-magic itself?

5:20 ejackson: anybody else lost doc in swank with 1.3.0 ?

5:24 amalloy: markoman: lein push

5:24 markoman: cuvavu: https://groups.google.com/group/clojuredev-users

5:25 i havent found any group for magic thou...

5:25 amalloy: cuvavu: i just saw constantine today, he said he follows the webdev list

5:25 cuvavu: thanks, both of you :)

5:26 markoman: amalloy: i used the command from clojars scp, but when i try to get project on other machine i get a lot of errors about missing artifacts, maven and such...

5:27 amalloy: markoman: the information content in that statement, with regard to how someone could help you debug it, is zero

5:29 markoman: i think its a very common... oh my mistake, typo going on. it worked fine

5:35 when I create and use project.clj with lein, can I specify :main to point to my jar lib instead of src dir?

6:13 amalloy: for some reason i dont have push task on lein...

6:21 clgv: markoman: then I'd guess it's a plugin/extension ;)

6:32 markoman: clgv: very much so ;)

6:43 Borkdude: what is the appropriate way to end a "lein repl" or "lein swank"?

6:44 with (System/exit 0) I get some exceptions

6:44 clgv: ctrl+d`

6:44 Borkdude: in Windows?

6:45 clgv: in linux.

6:45 Borkdude: ah yes

6:45 clojurebot: No entiendo

6:45 Borkdude: in Windows it also works

6:45 clgv: it means end of file if I remember correctly

6:45 fliebel: Borkdude: By any chance IndexOutOfBounds?

6:46 Borkdude: with "lein swank" it doesn't work though

6:46 but then I can do "ctrl-C" to end the batch-file

6:47 fliebel: Exception in thread "Thread-3" java.lang.RuntimeException: java.net.SocketExcept ion: Connection reset

6:56 fliebel: Does anyone know the state of this thing? https://github.com/hoeck/clojurebox2d It seems at least pre-lein and tied to clj-processing, which are not desirable for me. I do like to have wrapper for JBox2D.

6:58 hoeck: fliebel: maybe write your own jbox2d wrapper, its not that hard anyway

7:00 fliebel: hoeck: Yea, I'll see what happens. I was just surfing around. Would you say it's harder to beat this into shape than write my own wrapper?

7:02 * hoeck is reading his own code ...

7:12 hoeck: fliebel: depends on your goals, https://github.com/hoeck/clojurebox2d/blob/master/hoeck/clojurebox2d/jbox2d.clj and utils are the main namespaces for jbox2d wrapping action, and they do not depend on clj-processing

7:13 fliebel: unfortunately, I had to write my own iteration macro, because jbox2ds c++ heritage, many things are done by mapping/filtering java arrays, and I don't want to use lazy-seqs for that in the main loop

7:14 if you're okay with the tradeoffs taken and the look of the interface, then its easier to beat this into shape

7:15 fliebel: hoeck: I see. Well, the goal is to have some more interesting stuff for my game engine. Right now I have collisions based on java.awt.Rectangle. This is all fine, but I was looking around if there was a simple way to get some more advanced stuff.

7:15 hoeck: using another backend for drawing is not a big deal

7:16 fliebel: Okay, so this is really 3 layers of duck tape. Running C++ code in Clojure via Java does not sound very ideomatic :)

7:16 hoeck: not c++, but c++ translated to java

7:17 fliebel: Same thing.

7:18 hoeck: leads to lots of set!s https://github.com/hoeck/clojurebox2d/blob/master/hoeck/clojurebox2d/jbox2d.clj

7:19 but is fast and humble on resources, more things for clojure to spend, like using multimethods for object collision :)

7:20 fliebel: if you already have a game engine, I ca extract all the jbox related stuff from clojurebox2d and make it a separate lib (if you're interested)

7:23 fliebel: hoeck: Well, I don't know. I don't need the physics right now, but I guess I'll need them later anyway. Game engine is a big word btw, I have a game loop and some drawing, animation and collision stuff.

7:26 So, no, not right now.

7:28 This is also an option(DIY): http://www.wildbunny.co.uk/blog/2011/04/06/physics-engines-for-dummies/

7:29 hoeck: fliebel: right, and given all the new clojure capabilities (native ints, mutable deftypes), it may even perform well

7:30 fliebel: hoeck: I think you have to go pretty far in 2D for anything not to perform well.

7:33 Actually, the only thing I had to do for smooth animations is changing the GC. Besides that it renders more frames than is useful for anything else than stress-testing.

7:35 hoeck: I don't think we're supposed to use mutable deftypes for anything other than implementing Clojure in Clojure.

7:38 choffstein: I have a question. Is there a rule of thumb in clojure for knowing what goes first ... the 'subject' or the 'object'. e.g. (assoc hash key value) vs (cons element list). In the first, the object that the function is acting on comes first. In the latter, the object comes last. I find this sort of confusing and was wondering if there was a good way to remember it.

7:41 fliebel: &(println (subs (:doc (meta #'deftype)) 1043 1241))

7:41 sexpbot: ⟹ Note well that mutable fields are extremely difficult to use correctly, and are present only to facilitate the building of higher level constructs, such as Clojure's reference types, in Clojure nil

7:43 fliebel: choffstein: I think the object comes first in most cases. The way I think about it is "what would make the most sense grammatically, or using partial"

7:44 &(map (partial nth 3) [[1 2 3] [4 5 6]])

7:44 sexpbot: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number

7:44 fliebel: *facepalm*

7:45 choffstein: fliebel: hmm, okay.

7:45 fliebel: So, there are weird cases, but most of the time, it makes sense when you use partial and ->

7:46 choffstein: Alright. I'll try to keep that in mind. Time to jump on a plane. Have a wonderful day :)

7:47 * fliebel thinks of nth as nth-of

7:48 fliebel: Does anyone have a more consistent view on these things?

8:06 hoeck: fliebel: re physics engines and deftypes: I would consider this as an excuse to use (thread confined) mutation of primitives and arrays :)

8:06 fliebel: hoeck: Maybe, but I see that as an optimization rout when, and only when I run into performance troubles.

8:08 I'm not even using transients right now, while that would probably make the inner game loop a lot faster, it rules out any multithreading, and everyone I spoke to agreed it was bad style to expose transients to the outer world.

8:13 clgv: fliebel: you can't even expose transients to the outer world since in fact you cant read them only add to or change them

8:13 so the "exposing scenario" is extremely limited

8:14 fliebel: clgv: What do you mean by "can't read"?

8:14 clgv: hmm well, I might have to correct, what I experienced is that they are not seq-able.

8:15 I didnt try to use nth or something

8:15 fliebel: true, but you can get stuff from them, and update-in! (not in core)

8:16 clgv: ok nth works

8:16 so it's "only" the seq-able property but which is a huge show-stopper for elegant code on exposed transients ;)

8:17 I avoided doing that as result of that experiments ;)

8:18 fliebel: very true.

8:18 clgv: but knowing that nth works I might do a performance experiment some time later ;)

8:19 fliebel: So how fast is it to become a transient? Is it just a flag? Because I read it's constant-time.

8:20 clgv: well usually I started with empty transient collections

8:20 guess thats pretty much constant time ;)

8:20 fliebel: Because idk, the implementor might decide to use a transient during his modifications.

8:20 &(doc transient)

8:20 sexpbot: ⟹ "([coll]); Alpha - subject to change. Returns a new, transient version of the collection, in constant time."

8:21 fliebel: I'll have to track that call down into clojure.lang sometime.

8:21 clgv: :)

8:22 fliebel: wow

8:22 * fliebel realizes he almost did something really cool

8:26 * clgv is curious now

8:28 fliebel: clgv: My game engine accidentally almost does not care if you use a vector or a map for the game state. I'm not sure how useful that is, but I'm considering going the full 100% now and make it work.

8:29 clgv: you have to point out the coolness aspect and its implications for the coffee-drained clgv ;)

8:31 fliebel: clgv: Well, imagine all sorts of things happening to the game state, like iterating over it and drawing it to the screen, or checking if 2 things collide. And it's written in such a way that it almost does not matter if I get just a val or a MapEntry.

8:33 What I did is that I extended MapEntry to the protocol of my game objects, to save me from some destructuring. This means I can do (function MapEntry args) and it will transparently invoke that on its val.

8:37 clgv: ah kk. I did that for my improved clojure inspector ;)

8:37 fliebel: clojure inspector?

8:38 clgv: original: http://richhickey.github.com/clojure/clojure.inspector-api.html

8:38 I build upon the inspect-table function

8:38 to support map entries better and atoms and refs at all

8:39 and realized parts of infinite lazy collections ;)

8:42 oh I was wrong: I used inspect-tree as startpoint

8:48 fliebel: Hey, you Swing! Why are you beating my ref to death? RetryEx clojure.lang.LockingTransaction

8:52 AWizzArd: fliebel: what do you mean? Do you code something with Swing?

8:53 fliebel: AWizzArd: Yea, I have an event listener update a ref, but it gives me exceptions.

8:55 The strange thing is that it is the only place that writes to it. Or… wait, maybe I just need to restart my repl.

8:55 no...

8:56 It used to work, but not anymore. A deref can never ever retry a transaction, can it?

8:57 AWizzArd: A deref outside of a dosync?

8:57 fliebel: yea

8:57 no..

8:57 wait… this is all really weird stuff happening here :P

8:57 AWizzArd: A read outside should not force a transaction to retry.

8:58 fliebel: yes, outside, but it does not matter.

9:00 w-wait… D'oh! I :reload-all'd the thing, which must have caused the thing to have registered 2 listeners or something.

9:01 stuartsierra: yeah, that kind of thing can happen

9:02 clgv: fliebel: but eventhandler should be sequential in the swing gui thread, shouldnt they?

9:03 fliebel: clgv: I'd say so, but still, not loading the event thing twice solved it.

9:04 clgv: fliebel: maybe they introduced a swing threadpool sometime...

9:05 fliebel: btw, in a dosync with but a single statement, is it useful to use commute? Because the change is communicative, but using commute will execute it twice.

9:09 clgv: are there any java-only implementations for console guis?

9:32 raek: Charva looks nice... I should use it some time (http://www.pitman.co.za/projects/charva/Screenshots.html)

9:32 it's not pure java, though...

9:32 fliebel: You know what would be cool? A generic JSR 323(whatever; scripting bridge) REPL. So you could do any JVM lang on the REPL.

9:34 AWizzArd: fliebel: you can provide this from within Clojure.

9:34 fliebel: AWizzArd: How?

9:34 AWizzArd: (change-to-repl :jython)

9:36 fliebel: AWizzArd: Okay, and now back?

9:44 oh! http://download.oracle.com/javase/6/docs/technotes/tools/share/jrunscript.html

9:46 and https://github.com/pmf/clojure-jsr223 and http://java.net/projects/scripting/sources/svn/show/trunk/engines?rev=236

9:48 AWizzArd: fliebel: this python-repl would be programmed in Clojure. You just sit in a loop/recur, and it runs the code via jython.

9:48 In that repl however you won't have the clojure reader macros etc.

10:03 angerman: does anyone speak sapnish?

10:03 clgv: never done sap ;)

10:03 fliebel: does anyone know aleph?

10:03 how many roads must a man walk down?

10:03 angerman: fliebel: that's the async server, no?

10:04 fliebel: angerman: What I meant is, ask your question :)

10:04 angerman: fliebel: I'm in need of a tiny translation (en->es) "Lock to Point" or "Lock to Here"

10:05 ejackson: angerman: now you're pushing the linguistic boundary...

10:05 angerman: https://img.skitch.com/20110406-qds7h4efuy6682y5eadrmwkd2y.png

10:05 ejackson: of course! :D

10:05 fliebel: ejackson: Hey, how is the jet stuff going?

10:06 ejackson: fliebel: netjets are studiously ignoring me

10:06 angerman: ejackson: weird thing is, even though I am German and live in Europe, I have more easy access to asian languages then to european… :/

10:06 ejackson: is there context for your query ?

10:06 I'm tracking down a spaniard for you

10:07 angerman: ejackson: see the iamge

10:07 https://img.skitch.com/20110406-qds7h4efuy6682y5eadrmwkd2y.png

10:07 ejackson: ummm.... what ?

10:07 angerman: if enabled, the first few digits to the blue bar are greyed out and will stay even when the field is cleared

10:08 ejackson: ok

10:08 angerman: idea is that if you have a bunch of euro notes in succession (e.g. with near continuous serial numbers), you might want to "lock" the first few, because they will always be the same.

10:09 ejackson: gotcha

10:09 angerman: And only the last two, three or what ever change :)

10:11 fliebel: ejackson: Ignore? They think you are mocking theme because you don't talk with a big cigar on the phone?

10:11 ejackson: yeah, they can tell i sound poor

10:12 clgv: how can I used destructuring in a function signature to refer to the parameters by name and as a vector as well?

10:12 angerman: ?! lol emendio got mentioned in a russion document about clojure use.

10:13 clgv: doesn't :keys … :as work_

10:14 clgv: I guess :as could work. but I dont know whether it works outside that map with :keys

10:14 fliebel: ejackson: So the trick is to sound rich. don't ask "How much?" but say "I want a plane, sent me a quote please" O even "my boss wants…" :P

10:14 ejackson: oh no, I went even more hardcore

10:14 fliebel: tell me :)

10:15 ejackson: we're holding our company retreat, and I was thinking as a bonus for their hard work I'd fly the employees out

10:16 angerman: my best guess is "fijar de aqui"

10:16 where fijar is 'to fix'

10:16 (or at least my hive mind tells me that is a good guess)

10:17 pdk: arreglar

10:17 fijarse de X = to notice X

10:17 angerman: ejackson: thanks.

10:17 fliebel: ejackson: Google Translate agrees more or less.

10:18 ejackson: better find you a real spaniard though :)

10:18 pdk: cool

10:18 angerman: ejackson: if it's wrong I hope at least one spaniard will complain with a better translatioN :D

10:18 ejackson: i like it.

10:18 pdk: what are we translating, i didnt catch it

10:18 ejackson: 'lock to here' or 'fix to here'

10:18 fliebel: https://img.skitch.com/20110406-qds7h4efuy6682y5eadrmwkd2y.png

10:19 angerman: wow guys you are great… (and faster then I am… :D)

10:19 pdk: like

10:19 to affix something to a spot?

10:19 or to lock something into a socket etc

10:19 angerman: pdk: pressing that button will grey out the first digits up to the blue vertical line.

10:20 fliebel: Maybe someone needs to launch #lazyI18n on Twitter.

10:20 angerman: if the field is cleared, only the part that is not "fixed" (grey) is cleard.

10:21 pdk: hm

10:21 in that case fijar would prob work

10:21 fijar desde aquí

10:22 angerman: pdk, google translate sais desde would be "from"… and it's intention is "to"

10:23 e.g. the first digits are locked, not the last.

10:23 pdk: hasta then

10:23 ejackson: hasta la vista, BABY !

10:23 pdk: de/desde would convey from

10:23 a = to, at

10:23 hasta would convey "up to"

10:24 angerman: pdk: fijar hasta aqui then, I assume.

10:24 pdk: yeah i'd go with that

10:24 note aquí though

10:25 angerman: aqu? google keeps on correcting me it's aqui… confused.

10:25 pdk: acute accent over the I

10:26 irc kicks ass so it probably dropped the accented I

10:26 _fogus_: nick fogus`

10:27 angerman: pdk, ahh thanks

10:27 ejackson: fogus`: why with all the decorators ?

10:27 what do they denote ?

10:28 is _fogus_ dynamically scoped ?

10:28 pdk: they denote STYLE BABY

10:28 ejackson: lol

10:28 no wonder i don't get it

10:29 fliebel: I know my client gets me fliebel1 when I log off an on real quick, and I've also seen people use a _ when they are away, such as amalloy_.

10:30 fogus`: ejackson: Someone else took fogus on freenode.

10:31 cemerick: there's more than one?

10:31 fliebel: ejackson's gone

10:31 fogus`: cemerick: Apparently. Weird huh?

10:31 * cemerick was miffed that there was already a cemerick@gmail.com

10:31 fliebel: fogus`: Did you try talking to him?

10:32 * fliebel always gets to use pepijndevos, unless he makes a bad move and picks fliebel.

10:33 cemerick: what *is* a fliebel, anyway?

10:33 fogus`: fliebel: I did, but he never responds. He's also squatting my Last.fm name

10:35 fliebel: cemerick: Dunno, but wait… Nope, my dictionary does not know either. I think me and my friends made that up a long time ago to mean 'something'

10:36 but more specifically something dangling loose like a shoe tie or whatever.

10:51 Dantas: hi everyone !! using the map function over a map data structure (map f {:a 0, :b 1} ) . what is suppose to be the arguments passed through the function (f ) inside the map ?

10:51 pdk: ,(seq {1 2 3 4})

10:51 clojurebot: ([1 2] [3 4])

10:52 devn: hello all

10:52 pdk: each pair in the map is going to be passed to f in a vector [key value]

10:52 ejackson: dantas: kv pairs

10:52 Dantas: pdk: ejackson : Thanks a lot !

10:53 jweiss_: anyone have problem with swank-clojure to list callers using C-c C-w c, gets "Error in process filter: wrong type argument: char-or-string-p, nil"?

10:53 ejackson: ,(map (fn [[k v]] v) {:a 0, :b 1} )

10:53 hmm.

10:53 clojurebot: (0 1)

10:53 ejackson: $(map (fn [[k v]] v) {:a 0, :b 1} )

10:54 hmmm... the bots scorn me today

10:54 Dantas: exacly, I thought it was a sub map ! thanks a lot

10:54 ejackson: ,(map (fn [[k v]] k) {:a 0 :b 1 :c 2})

10:54 clojurebot: (:a :b :c)

10:55 pdk: ,(type (seq {1 2 3 4}))

10:55 clojurebot: clojure.lang.PersistentArrayMap$Seq

10:59 raek: 'for' and destructuring can be very useful too: ##(for [[k v] {:a 0 :b 1 :c 2}] (inc v))

10:59 sexpbot: ⟹ (1 2 3)

11:01 Dantas: ejackson: watching the pdk expression (type (seq {1 2 3 4})) i did the same to a list . is list a sequence ?

11:02 ,type(seq '(1 2 3))

11:02 clojurebot: #<core$type clojure.core$type@11c1cdf>

11:02 Dantas: ,(type(seq '(1 2 3) ) )

11:02 clojurebot: clojure.lang.PersistentList

11:02 pdk: sequences are an abstraction over all four basic collection types

11:02 lists/vectors/sets/maps

11:02 and strings

11:04 Dantas: pdk, yeah . a interface , right ?

11:04 ejackson: sequences can be thought of a bit as like iterators... they're not, but its a nice crutch.

11:04 stuartsierra: A list is the only Clojure data structure that is its own sequence.

11:04 ejackson: lists, vectors, maps are concrete data structures

11:04 raek: lists are their own seqs

11:04 ejackson: a sequence is not

11:04 (as far as i understand these things)

11:05 Dantas: pdf, but for a map the type is a nested class form the map - clojure.lang.PersistentArrayMap$Seq

11:06 raek: ,(isa? clojure.lang.PersistentArrayMap$Seq clojure.lang.ISeq)

11:06 clojurebot: true

11:07 raek: Dantas: yes, it's an interface

11:07 Dantas: thanks all !!

11:17 mefesto: Hey everyone. I have a leiningen project that has both clojure and java sources. When generating a pom file (lein pom) the result does not include the java source path. Is this a known problem or am I doing something wrong?

11:18 fliebel: mefesto: I think you need lein-javac

11:18 Or cake

11:18 mefesto: fliebel: lein-javac will generate a different pom file?

11:19 fliebel: mefesto: I don't know. I've only heard you need that to compile java files.

11:19 mefesto: fliebel: leiningen is building the project correctly it's just the pom file that doesn't include the java src path

11:20 fliebel: oh, okay, don't know then.

11:20 mefesto: the only reason I care about the pom file is so I can seemlessly use netbeans for the gui form building portion and use emacs for general coding

11:21 i could just give in and use netbeans clojure support but i just figured if lein pom included the java source path then it wouldn't matter

11:22 fogus`: How might one defer a test with clojure.test?

11:23 raek: mefesto: are you using the latest version of leiningen?

11:23 mefesto: raek: Leiningen 1.5.0 on Java 1.6.0_22 Java HotSpot(TM) 64-Bit Server VM

11:25 raek: mefesto: does the pom.xml need to contain the source paths? I have one which lacks those...

11:26 mefesto: raek: yeah for this project to work in netbeans. perhaps my setup is hoakey but I only use netbeans for the gui forms which are stored as java sources (plus some form type type)

11:27 trptcolin: fogus`: if you're running w/ leiningen you can tag them w/ metadata & use test-selectors to only run the ones you're interested in

11:28 fogus`: trptcolin: Anyway w/o Lein?

11:29 mefesto: my project layout is like this: http://pastie.org/1772379

11:29 trptcolin: not that i know of aside from commenting them out :)

11:29 mefesto: I'd like to consolidate the myapp-client and myapp-client-ui into a single leiningen project

11:29 fogus`: trptcolin: Seems like a useful feature. :-(

11:30 mefesto: myapp-client-ui only contains the netbeans swing forms which myapp-client depends on. I'm open to other approaches :)

11:33 raek: mefesto: I would recommend asking on the lein mail list. the java source path missing sounds like an easy to fix bug to me, and I know that technomancy makes new releases quite often

11:34 mefesto: raek: Will do. Thanks

12:06 technomancy: mefesto: it's an unintended omission; go ahead and open an issue on github for it

12:06 mefesto: if you can get a patch in for it, that would help it happen more quickly; otherwise I'll try to be sure it makes it into 1.5.1

12:09 thickey: p.s. food

12:09 p.p.s BEER

12:09 lol, sry

12:26 jweiss_: having a little trouble with destructuring - can :keys maps be nested?

12:27 i am not quite sure what (defn g [{:keys [a b c {:keys [d e]} z]}] [a b c d e z]) will be interpreted as

12:27 i can't seem to call it so that the d e or z are non-nil

12:28 raek: jweiss_: you can't use :keys like that. :keys is the shortcut for the case when you want to bind the symbol foo to the value associated with :foo.

12:29 jweiss_: raek: ok. is it me or does the doc here http://clojure.org/special_forms#toc4 not consistent about whether you need the :as keyword?

12:30 is it that if no other keywords are specified, :as is assumed?

12:30 raek: jweiss_: {a :a, b :b, c :c, {d :d, e :e} :z}

12:30 or {:keys [a b c], {:keys [d e]} :z}

12:30 :as is used when you want to call the whole map something

12:31 jweiss_: raek: ok so what is z there?

12:31 sorry :z

12:32 raek: when destructuring a map, a pair can either have a symbol or a keyword as its key

12:32 mefesto: technomancy: thanks, i'll try to put a patch together later today

12:33 raek: when it's a symbol, like in {a :b}, that symbol will be bound to the value you get when you look up :b in the map

12:33 but instead of a symbol there, you can have another destructuring form

12:33 jweiss_: raek: ok i think i see why i'm confused, the doc is showing let bindings, which is not what i'm doing :)

12:34 i'm doing defn

12:34 mec: let and defn destructure identically

12:35 jweiss_: mec, yeah, but in a let there's a 2nd item (the value being destructured)

12:35 raek: with let, you have [destructuring-form value, destructuring-form value, ...] but with function parameters, you only have [destructuring-form, destructuring-form, ...]

12:35 jweiss_: so i was looking at "(let [{fred :fred ethel :ethel lucy :lucy} m] ..."

12:36 and wondering what m was

12:36 not realizing i'm looking at a le

12:36 let

12:36 raek: as mec pointed out, "destructuring-form" works the same for let and fn

12:37 jweiss_: ah, I see. :) was my example of nested map destructuring clear?

12:37 jweiss_: raek: still having a bit of trouble interpreting {:keys [a b c], {:keys [d e]} :z}

12:38 the :z seems to be dangling there

12:39 raek: if you "expand" the first :keys, it looks like this: {a :a, b :b, {:keys [d e]} :z}

12:39 jweiss_: ah ok

12:39 that helps thanks :)

12:58 amalloy: ejackson: for sexpbot it's &(expr) at start of line, or ##(dec 1) anywhere in the line; $ is for commands

12:58 sexpbot: ⟹ 0

12:59 mec: sexybot gets it done

13:09 dabd: struggling with http-agent here: how do you make a POST? url encode the parameters? what is the separator? thx

13:10 amalloy: mec: i read that like four times before i even noticed you'd changed the P to a Y

13:10 mec: amalloy: lol thats how i read sexpbot all the time

13:11 ejackson: amalloy: gracias.

13:12 amalloy: and If I could stop reading pom.xml as porn.xml...

13:12 amalloy: ejackson: sexiest data-exchange format around

13:16 Raynes: amalloy: Did he ask a question somewhere? I missed it.

13:16 amalloy: Raynes: no, he just discovered that, when he used the wrong syntax, sexpbot ignored him

13:16 robinkraft: newbie question: How do I use 3rd party Java libraries? I'd like to do something like (import import org.apache.thrift.TBase), or include thrift as a dependency in project.clj. Even if you don't know anything about thrift, general info on how to use 3rd party libraries would be really helpful.

13:17 Thrift is already compiled and works in my Mac Python environment. I can even get thrift to work using demo Java classes that come with the thrift source code. But that's as far as I've gotten. FWIW there's a a jar file at /usr/local/lib/libthrift.jar.

13:17 p.s. pardon the typos - just saw the "import import"

13:19 mec: if the jar is on your classpath then the (import ..) should work

13:19 amalloy: robinkraft: you can depend on backtype/thriftjava 1.0.0

13:19 surely the wrong way to do it, but i happen to know he's published thrift there

13:19 robinkraft: I'm not sure, probably

13:19 dnolen: robinkraft: you can also just copy that jar into your project lib folder.

13:19 robinkraft: but I'd like to know for other libraries that aren't so convenient

13:20 ok. what about using it from the repl

13:20 ?

13:20 dnolen: robinkraft: lein repl, user=> (import '[org.apache.thrift TBase])

13:22 robinkraft: dnolen: seems it's not in my classpath. So, that's the next question I guess: how do I add something to my classpath?

13:22 dnolen: robinkraft: copy the jar into your project lib folder.

13:23 robinkraft: dnolen: so I can't just load it interactively in the repl? I need a project first?

13:23 dnolen: robinkraft: you can do it without a project but then you need manage the classpath yourself.

13:24 robinkraft: ^

13:24 java -cp path/to/clojure.jar:path/to/thrift.jar clojure.main

13:25 robinkraft: ahhh that looks promising

13:31 fliebel: Is there something that lets me update multiple keys in a nested structure?

13:32 mec: are they all at the same level?

13:32 fliebel: yes

13:32 mec: ,(update-in [[[1 2 3]]] [0 0] assoc 0 2 1 3 2 4)

13:32 clojurebot: [[[2 3 4]]]

13:33 fliebel: w-what?

13:33 amalloy: fliebel: you want to do something like [:a :b [:c :d :e]]?

13:33 chrissbx: How do you install swank with leiningen? Someone showed it to me once, but it installed an old version of swank and there are issues with it.

13:33 mec: a map might be more clear:

13:33 fliebel: This is what my data looks like: {:a {:x 2 :y 2}}

13:34 mec: ,(update-in {:a {:x 2 :y 2}} [:a] assoc :x 3 :y 3)

13:34 clojurebot: {:a {:x 3, :y 3}}

13:34 robinkraft: dnolen: I think you gave me enough to go with, I just need to figure out where the right jar file is ... Thanks much for your help

13:36 amalloy: mec: i've never managed to find a version of that that lets you use something more like update-in at the bottom level instead of assoc

13:36 fliebel: mec: Very nice. Now say I want to *update* and not assoc. If it's more than one line, I wrote something that does this already using reduce.

13:36 amalloy: Ah, right

13:36 amalloy: maybe this is finally an argument for a plain update (rather than update-in)

13:36 mec: i dont follow

13:37 amalloy: eg (update-in {:a {:x 2 :y 2}} [:a] update [:x :y] inc)

13:37 fliebel: amalloy, mec: This is what I have now: https://gist.github.com/910326

13:37 chrissbx: Where should I start if I want to work with clojure from emacs?

13:37 amalloy: but update doesn't exist

13:37 mec: you can give update-in any function you want

13:37 fliebel: mec: But not multiple

13:37 amalloy: mec: you can't easily give it multiple keys

13:38 obviously it's possible by asking update-in to use a function that does all the work, but the "prettiest" version of that would be a version of update that works like assoc

13:38 fliebel: Yea, I;ve always wondered why it does not exist. Is it in amalloy utils?

13:39 amalloy: fliebel: it's not; i haven't wanted it for several months

13:39 after this discussion i'm thinking of adding it :P

13:39 fliebel: I still need a better acronym.

13:40 amalloy: ?

13:40 chouser: technomancy: no where useful. Mainly I wish there were no object model built in, no inheritance, and no requirement to declare an exception type ahead of time.

13:41 fliebel: amalloy: You made me an acronym to convince me that amalloy had nothing to do with your name. I need to make myself a better one, because it wasn't very convincing.

13:41 mec: $findfn {:a 1 :b 2} [:a :b] inc {:a 2 :b 3}

13:41 sexpbot: []

13:41 amalloy: heh

13:41 fliebel: mec: It should at least be inc inc

13:42 or.. maybe not.

13:42 $findfn {:a 1 :b 2} [:a :b] inc inc {:a 2 :b 3}

13:42 sexpbot: []

13:42 amalloy: fliebel: k it's written. not very complicated

13:42 mec: (update-in {:a {:x 2 :y 2}} [:a :x] inc)

13:43 fliebel: cool

13:43 mec: ,(update-in {:a {:x 2 :y 2}} [:a :x] inc)

13:43 clojurebot: {:a {:x 3, :y 2}}

13:43 dnolen: chrissbx: http://clojure02.managed.contegix.com/display/doc/Getting+Started+with+Emacs

13:43 amalloy: https://gist.github.com/910333, and i'll get it into amalloy-utils later

13:43 i don't think you want inc inc

13:43 fliebel: amalloy: Why is it using update-in? I would have based it on get and assoc personally.

13:44 mec: you can do (apply update-in m [k] f args) instead of (update-in m [k] #(apply f % args))

13:45 amalloy: mec: thanks, i knew it was silly to need a closure

13:45 fliebel: amalloy: Now you are updating the whole datastructure every time, while you could only update the outer one once and the inner one as much as you need.

13:45 amalloy: fliebel: what? (update-in {:a {:x 2 :y 2}} [:a] update [:x :y] inc)

13:45 mec: you would still use update-in for that

13:45 fliebel: okay… oh right...

13:46 amalloy: i used update-in because it's crazy to use get+assoc to change a value in a map when you have update-in available

13:46 fliebel: I wasn't reading and thinking in a coherent manner.

13:47 livingston: if I use extend to add a protocol to a defrecord, and then pass that record instance out to Java, there is no way for java to see or use that object as that interface, is there? I would have to put that interface/protocol on at defrecord definition time right?

13:47 fliebel: yes

13:48 extend stores the extension on the protocol, not on the record.

13:48 (I only recently found out protocols are actually just maps)

13:48 livingston: whammy ok, guess I need to reorganize this code

13:50 fliebel: huh, that's interesting, especially since they allow objects to be created that don't need any dispatch or anything to get to their methods.

13:51 fliebel: {:impls {java.lang.String {:stuff #<user$eval359$fn__360 user$eval359$fn__360@5c1a1ff9>}}, :on-interface user.stuffer, :on user.stuffer, :sigs {:stuff {:doc nil, :arglists ([x y]), :name stuff}}, :var #'user/stuffer, :method-map {:stuff :stuff}, :method-builders {#'user/stuff #<user$eval340$fn__341 user$eval340$fn__341@13899213>}}

13:51 livingston: one more question on exposing clj data to java, if I pass out a record, and (since it's also a map) the java side wanted one of the fields, they could get it with get and passing a keyword as a parameter, right?

13:52 mec: you can also just do record.field

13:53 livingston: ooh - that's hugely handy

13:54 even if I use assoc to add on fields? that won't work then right, it wouldn't be available to the compiler?

13:54 mec: no just the default fields

13:55 livingston: makes sense, how would I get a non-default then, with get, right?

13:55 fliebel: Yea, using the ILookup protocol.

13:55 I think it's actually entryAt

13:56 cemerick: livingston: Just using get all the time is generally a lot easier than worrying about the impl details.

13:56 (and having to document concrete types on the java side)

13:56 fliebel: cemerick: But is there get at the Java side? I thought it was called entryAt.

13:57 cemerick: fliebel: records implement j.u.Map

13:57 fliebel: As well as ILookup, so both work?

13:57 cemerick: yeah, it implements a bunch of interfaces

13:58 ,(supers (defrecord A []))

13:58 clojurebot: DENIED

13:58 cemerick: anyway

13:58 livingston: that's really convienent for the java side, I would assume they would just use the java.util.Map interface that they are used to

13:58 amalloy: fliebel: everything is a map if you stand far enough back

13:59 livingston: although the Java users hav

13:59 e a casting nightmare on their hands

14:00 amalloy: livingston: you can typehint record fields

14:00 er, maybe no

14:00 i guess you can typehint them as primitives but that's about it

14:00 stuartsierra: yeah, primitive or Object

14:01 livingston: Object is not very useful as an interface to the java guys, but I guess that's what they get.

14:02 if I have a map that could have symbols strings or numbers, there's no way to give their compiler a better type anyway

14:09 stuartsierra: Generic types in Java, like Map<String, String> are not much more than syntactic sugar for type casts anyway.

14:10 livingston: in the end yes, but it save you from either flagging off the type checking, or putting casts everywhere. (i'm trying to be as accommodating as I can)

14:11 is there an example out there of how to defrecord using 2 protocols at the same time. the docs make it look kinda like you can only use one.

14:12 dnolen: livingston: something like this, https://github.com/swannodette/logos/blob/master/src/logos/minikanren.clj#L71

14:13 livingston: perfect (assuming that works for records too) thanks. the ordering of everything wasn't clear.

14:14 dnolen: livingston: works just the same for records, defrecord is just a deftype w/ extra stuff.

14:15 livingston: cool, thanks

14:15 what happens if two different protocols have the same function name? is that legal and can your point them to two different implementations or to the same implementation?

14:16 dnolen: livingston: two protocols can't use the same name with/in the same namespace as far as I understand.

14:16 mec: amalloy: in your update why do [& keys] instead of just keys

14:16 amalloy: &(doc update-in)

14:16 sexpbot: ⟹ "([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created."

14:17 amalloy: mec: i know it's not necessary. it makes it more clear, for me, that it should be a seq

14:17 and i'm sure i've seen it somewhere in clojure.core. maybe ##(doc clojure.string/join)?

14:17 sexpbot: ⟹ "([coll] [separator [x & more]]); Returns a string of all elements in coll, separated by an optional separator. Like Perl's join."

14:23 stuartsierra: Clojure 1.2.1 is released and on its way to Maven Central.

14:29 technomancy: stuartsierra: still no tag?

14:30 stuartsierra: tag?

14:30 oh, in git

14:31 There's a branch I think. Bug stuarthalloway to make a tag.

14:35 Raynes: https://github.com/clojure/clojure/pull/6

14:36 stuartsierra: rhickey doesn't accept pull requests.

14:36 Raynes: stuartsierra: He certainly wouldn't accept that one.

14:36 stuartsierra: well no

14:36 * Raynes chuckles

14:38 cemerick: that's sooo bizarre

14:39 redinger: Wow, he actually went through all the work to do that

14:40 cemerick: I presume it was just s/clojure/lava, but…

14:40 amalloy: redinger: what work? find . | xargs perl -pi -e 's/clojure/lava'

14:40 stuartsierra: I wonder if it builds?

14:40 cemerick: The fact that he submitted a pull request is great.

14:40 opqdonut_: haha, what's the story behind lava

14:40 znutar: I think the story is that it's cool

14:41 amalloy: i like how he renamed the repo too. style

14:41 Raynes: So cool.

14:41 fliebel: #findfn [1 2 3 2 1] [1 2 3]

14:41 $irc://irc.freenode.net:6667/#findfn [1 2 3 2 1] [1 2 3]

14:41 $findfn [1 2 3 2 1] [1 2 3]

14:41 sexpbot: [clojure.core/distinct]

14:41 fliebel: ah

14:41 Raynes: fliebel: Type slower. :>

14:41 redinger: Well it's rename all the files & replace text in files. Not a lot of work still - but why

14:42 cemerick: Reminds me of the guy who cloned the google code repo, swapped out the copyright notices for his own name, and pushed to github.

14:42 amalloy: but he left the homepage the same. clojure.org

14:42 fliebel: Raynes: Good idea.

14:42 znutar: Lava's got a sophisticated French feel if you pronounce it right too. As a newbie clojure user I look for this in my languages.

14:44 Raynes: Looks like the guy is a big Go fan.

14:44 The language; not the game.

14:46 raek: stuartsierra: will there be an official announcement for 1.2.1?

14:46 stuartsierra: raek: There just was. ;)

14:47 raek: :)

14:47 stuartsierra: Once it's sync'd to Central I'll notify the mailing list.

14:47 raek: I was thinking about a URL to point people to

14:47 ok

14:49 * cemerick waits for the day when stuartsierra gets sick of shepherding the mvn bits and pushes makefiles to all of the clojure repos.

14:49 stuartsierra: Don't tempt me.

14:49 I just spent the past 3 weeks implementing a 6-machine deployment strategy in Bash.

14:49 cemerick: Holy jeebus.

14:50 stuartsierra: It wasn't that bad actually.

14:50 cemerick: That's a bad time / node ratio, dude.

14:50 I've been spoiled in the department in the past year.

14:51 s/in the/in that

14:51 sexpbot: <cemerick> I've been spoiled in that department in that past year.

14:51 stuartsierra: Well, it wasn't 3 weeks full-time.

14:52 cemerick: oh well

14:52 it's makes for good lore, anyway

14:52 livingston: mvn has it crufty bits (especially for dynamic language debugging in repl etc.) but it makes a lot of things really easy too

14:52 cemerick: Next time someone asks me "how long will it take to implement a 6-machine deployment strategy?"…

14:53 stuartsierra: Ruby + Rails + Clojure + C + Bash + Cron + TCL + a bunch of other stuff I forgot.

14:53 cemerick: livingston: Of course, your environment really should pull config from your pom.xml once, and work from there without ever running mvn for REPL stuff.

14:53 kephale00: Can anyone imagine complications with making the size of the fixed thread pool for agents tweakable?

14:54 stuartsierra: cemerick: On that note, I've been trying to think about what an interactive dev environment for Clojure would look like outside of an IDE.

14:54 Maven alone isn't great for interactive development.

14:54 technomancy: we just had that discussion last night at seajure

14:55 stuartsierra: Oh, good, so you've solved it then? ;)

14:55 technomancy: apparently Steve Yegge is using Clojure for a cloud-y code indexing and support tool internally for Google

14:55 well, not so much "outside an IDE" as a backend that's easy to support across environments

14:55 stuartsierra: Really???

14:55 cemerick: stuartsierra: It's an interesting question, but a non sequitur for me. I don't know that I'd have much to add or usefully suggest.

14:56 stuartsierra: technomancy: yeah, that's what I mean

14:56 technomancy: stuartsierra: yeah, I was surprised he got away with it. apparently when you've been at Google for six years you get some leverage.

14:56 stuartsierra: Classloader wrangling, thread management, reloading, introspection, …

14:57 cemerick: oh, I thought you were talking about UX stuff.

14:57 livingston: the really nice thing about mvn is if you are working in a mixed clojure and java environment you can, for the most part, make things work. I get my repl, they don't have to figure out my goofy dependencies etc.

14:58 stuartsierra: cemerick: No, like technomancy said, I'm thinking of a backend that's accessible to anything, including a command-line UI.

14:58 I played with Nailgun last year: https://github.com/stuartsierra/classpath-manager

14:58 livingston: what do you mean outside of an ide? oh you mean just the back end?

14:58 stuartsierra: yeah

14:59 So I can interact with it from the command line, Emacs, a web browser, etc.

14:59 livingston: I'm pretty happy with swank and slime...

14:59 stuartsierra: me too, but I dream of more… :)

14:59 technomancy: doesn't seem to be any public data on Google Grok, but if you could be a fly on that wall...

14:59 livingston: web browser etc. - why would you want that pain?

15:00 stuartsierra: well, I'm not volunteering to write the web front-end, but app servers sometimes have admin interfaces, like Glassfish.

15:01 livingston: the only thing I miss about swank+slime and clojure is some of the debugging isn't quite at the same level as I had it with lisps (also I was able to use swank/slime with AllegroCL and still use their dialog for trace output - it was a comfortable setup)

15:01 stuartsierra: I'd love if I could get the same kind of Java class/method lookup in Emacs that Java IDEs have.

15:02 * technomancy deeply wishes argument names were part of the bytecode

15:02 technomancy: that's like the one thing I still have to go to javadoc for

15:02 livingston: re glassfish: that seems like something with different goals than development. but maybe there are commonalities.

15:02 stuartsierra: Yeah, this is all just random thoughts, not a coherent plan.

15:03 livingston: I would be surprised if there isn't an emacs hook to get you to the javadocs?

15:03 stuartsierra: yes, there is. In Clojure, in fact.

15:03 cemerick: surely there's something like http://eclim.org/ for emacs?

15:03 livingston: the other bummer about slime and clj and maven is when you look up a function or something it will always whisk you away into the jar, instead of your local files - that sucks.

15:04 stuartsierra: Yeah, Maven's lifecycle model wasn't designed for interactive development in a dynamic language.

15:05 livingston: if there was a way to get it to load local some in dev mode that would be good. (I think there may be a way to do that with a system dependency and a profile, but I haven't hacked that yet)

15:05 cemerick: stuartsierra: maven shell / aether to the rescue?

15:06 livingston: well then if you can hook the java doc you can get the data you need for autocomplete (there are java modes for emacs too right?) or is the javadoc rendered as a webpage and not parsed.

15:06 stuartsierra: Maven shell. Interesting. Don't know that.

15:06 livingston: I don't know those projects either?

15:10 maybe those would help. really all I want it to be able to have maven be willing to provide a local (system?) location for a select set of libraries that I'm developing and not have to jar them and put them in the repository first and then get them from there.

15:10 cemerick: stuartsierra: it's just a persistent jvm that you can load/reload poms into and invoke goals / lifecycles with.

15:10 Its presence gives me the same vibe as polyglot maven though (i.e. going nowhere), so I'm not betting anything on it.

15:11 stuartsierra: intriguing. Does it reload dependent JARs each time.

15:11 ?

15:11 technomancy: sounds like sbt

15:11 cemerick: technomancy: yeah, same shtick.

15:15 markoman: would someone like to review and comment my first clojure study project on git?

15:16 mids: just share the url

15:16 markoman: code, principles, best practices, anything, id appreciate that before continuing on other project

15:16 https://github.com/mmstud/websesstudy

15:18 amalloy: markoman: holy cow, sudo lein deps? i'm not sure i can imagine a reason to recommend that ever

15:19 kephale00: lol

15:19 _fogus_: cemerick: Are you still thinking of putting together an authors' panel at Conj '11?

15:19 markoman: havent done harm on my machine yet ;) but good point, i constantly get problems to use lein because of directory or file permissions

15:20 livingston_: anyone want to check my code, just sudo ... , yeah you almost got me there internet ... just kidding ;)

15:20 markoman: adds some frustration to the high pile already

15:20 redinger: _fogus_, cemerick: I've already got it listed as a proposal with my initial list of names. :) I'll flesh it out if Chas sends more info

15:21 amalloy: markoman: i've never had a problem with permissions using lein. do you have both lein and your project inside of ~?

15:22 markoman: project is inside home dir on my mac, lein is on /bin

15:22 cemerick: _fogus_, redinger: It was an idle idea. I'm not really sure what a proposal would look like though.

15:22 amalloy: markoman: i use a copy of lein in ~/bin/lein

15:22 cemerick: I suppose we could collect questions ahead of time, or have someone run around Donahue-style to take questions from the audience.

15:23 amalloy: if you put it in /bin it seems like eg lein self-install would fail because you don't have write perms

15:23 markoman: i dont haven even ~/bin dir here

15:23 amalloy: markoman: it's a good idea to create one and add it to your PATH

15:24 mids: markoman: in your defrouters I'd suggest a more REST behaviour, like using POST for routes with side effects

15:24 markoman: yeah, thats true. i should add bin to my home and put it on path probably working then better?

15:24 amalloy: *blink* didn't follow that sentence as a whole, but all the bits in it sound good

15:25 markoman: sorry, clumsy finglish

15:25 amalloy: technomancy: do you recommend for/against installing lein in /(user/)bin?

15:26 mids: markoman: also, how does your session/flash stuff different from what sandbar offers?

15:26 https://github.com/brentonashworth/sandbar

15:27 markoman: mids, I looked sandbar but I couldnt follow its code by every part, it looked complicated to me, lol

15:27 mids: markoman: fair enough, it probably is :)

15:27 markoman: but yes, it overlaps with my other project too, forms, but its not same anyway

15:32 technomancy: amalloy: it's fine. keeping self-installs somewhere other than ~/.lein is something that might need some thought, but so far I've left that to the packagers.

15:32 markoman: mids: do you mean I should use POST for setting session value and adding a task? or maybe PUT or what do you mean with "more REST" ?

15:33 ataggart: Anyone here have the power to alter fields on Jira tickets?

15:34 stuartsierra: such as?

15:34 amalloy: markoman: GET requests shouldn't have side effects

15:34 steven: (it was pretty much just a s/clojure/lava/g, yeah)

15:35 ataggart: stuartsierra: For some reason the only thing I can do on tickets is manage comments and attachments. There are a few tickets that need to be marked ready for test, but alas I don't seem to be able to do that.

15:35 cemerick: steven: why, but why is the only real question…

15:36 stuartsierra: ataggart: Ask on the dev list for your account to be upgraded.

15:36 steven: cuz its a cooler name

15:36 markoman: amalloy: they still need to output something, but I think I got you. but to keep example simple, is there other way to do it than POST forms? it makes thing unnecessary complicated on this case, but real app, yes I agree

15:36 steven: closure is something your girlfriend wants after you break up

15:36 cemerick: Well, I'm convinced.

15:36 devn: Will the reader puke on ##(symbol "$foo.bar")? I know it's ill-advised, but *how* ill-advised is it?

15:36 sexpbot: ⟹ $foo.bar

15:36 steven: lava levels cities and gets immediate results

15:36 stuartsierra: If only it weren't for the darned Los Angeles Venture Association home page...

15:37 ataggart: stuartsierra: I wrote to Aaron, he said I should be able to modify tickets.

15:38 oh well

15:38 stuartsierra: sorry, I don't know much about JIRA

15:38 ataggart: yeah, I was hoping someone here was able to do what I can't, and would be kind enough to modify them for me.

15:39 amalloy: session-bind is going out of its way to make its use of this atom not threadsafe

15:40 you could write it as "(swap! *STORE* assoc sid session) session", or "(:session (swap! *STORE* assoc sid session))"

15:41 but (swap! foo...) @foo is rarely right

15:44 markoman: hmh.. im not sure if I understand

15:44 amalloy: markoman: do you intend for session-bind to always return the session the user passes in?

15:46 markoman: yes, sid is mandatory there so it will be empty map or map having session data for user. thats what its meant for

15:47 amalloy: i think you answered a question different from what i asked. you have session-bind doing a swap, and then returning (get m the-key-you-just-set). do you want that to always return the value the user supplied?

15:50 technomancy: ,(reduce (partial merge-with concat) (for [i (range 1878) ] {:a []}))

15:50 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.StackOverflowError>

15:52 amalloy: technomancy: (concat (concat (concat (concat....)))) all gets realized at once

15:53 markoman: hmh... I just want *STORE* to keep all users session data. session-bind is used by session-set and get primarily.

15:54 amalloy: you're missing the point. imagine two threads both want to change the session data at once, to two different values: it's possible they both swap before either returns, and then they both return the newest value; the guy who set it first gets silently overwritten

15:54 markoman: i think i choose doing swap every time to simplify process so that i dont need to have set, get, save, update, delete functionaility for the session-bind

15:55 ouh

15:55 technomancy: yeah, something is lazy even coming out of reduce. interesting.

15:56 raek: ,(reduce (partial merge-with (comp doall concat)) (for [i (range 1878) ] {:a []}))

15:56 clojurebot: {:a ()}

15:57 raek: this avoids a cascade of forcings

15:58 markoman: amalloy: i think I got some of what you meant. Im about to use code on google app engine at the end, I guess there is no thread problem or am I wrong?

15:58 amalloy: markoman: in practice there's unlikely to be

15:59 but it's crazy to introduce this sort of race condition when the code would be *simpler* if you didn't introduce it

15:59 markoman: but you suggested some change, could it work on threaded environment better then?

16:00 amalloy: &(let [a (atom {}] (:name (swap! a assoc :name "test")))

16:00 sexpbot: java.lang.IllegalArgumentException: let requires an even number of forms in binding vector

16:00 markoman: yeah, Im not used to think threads from PHP side

16:00 amalloy: &(let [a (atom {})] (:name (swap! a assoc :name "test")))

16:00 sexpbot: ⟹ "test"

16:00 amalloy: here, instead of deref-ing the atom again once you're done swapping, you take advantage of the fact that swap! returns the new value

16:01 or since you *know* what the key will be, you could just ##(let [name "test" a (atom {})] (swap! a assoc :name name) name)

16:01 sexpbot: ⟹ "test"

16:04 markoman: amalloy: sounds interesting and certainly I need to test these things more. can you advice how could I test session behaviour if its working with threads at the end?

16:05 amalloy: not really. i don't do any webdev in clojure, really

16:07 markoman: so could we say, my session-bind is not thread safe at the moment? :)

16:13 amalloy: it's hard to say for sure because you refuse to clarify what you expect it to return :P

16:16 markoman: user session data

16:17 ssideris: hello

16:17 ,(str (drop 1 [5 6 7]))

16:17 clojurebot: "clojure.lang.LazySeq@482"

16:18 ssideris: how could I get "[6 7]" instead?

16:18 raek: ssideris: use pr-str

16:18 ssideris: ah, thanks

16:18 raek: ,(pr-str (drop 1 [5 6 7]))

16:18 clojurebot: "(6 7)"

16:18 amalloy: apply str

16:18 oh nm

16:19 markoman: i cant say it simpler way. it should return only the user related session data. not all sessions or not only some particular data on user session, but all for user

16:22 and it should return it on form of map, not atom. and of course, it should work on all possible situation without deleting or missing data, when several users are getting their session data from same store

16:22 clojurebot: http://groups.google.com/group/clojure/msg/fd0371eb7238e933

16:23 markoman: I think I recall now my problem on this case, I didnt really know, how to update certain part of the atom

16:24 amalloy: lol thanks for the years-old discussion about atoms, clojurebot

16:25 markoman: if atom has a map {sid1 {} sid2 {}} how can i update only sid2 {} maybe link tells it :)

16:26 amalloy: &(let [a (atom {:a {} :b {}})] (swap! a update-in [:b] assoc :data 10))

16:26 sexpbot: ⟹ {:a {}, :b {:data 10}}

16:26 trptcolin: the fn that atom! takes as an arg can look at the current atom and do whatever it wants with it

16:27 raek: markoman: (swap! a update-in [sid2] <your update function here>)

16:27 trptcolin: s/current atom/current value of the atom/

16:27 sexpbot: <trptcolin> the fn that atom! takes as an arg can look at the current value of the atom and do whatever it wants with it

16:28 markoman: amalloy, so I think that would be much better way on session-bind and it should cut out the race condition

16:40 :b should be updated with any kind of data, not just one key value pair but :b {:data 10 :tasks [1 2 3]}

16:41 what kind of update function can do that?

16:41 i guess not assoc?

16:43 raek: markoman: you want to update something for a certain session and something common to all sessions?

16:43 markoman: something for certain session

16:44 raek: can you give an example of how the map should look like before and after?

16:47 ataggart: markoman: you probably want update-in

16:47 markoman: sure: before {:sid "35bcf8b4"} after {:sid "35bcf8b4" :flash "message" :count 2 :tasks ["task 1" "task 2"]}

16:48 ataggart: ,(assoc {:sid "35bcf8b4"} :flash "message" :count 2 :tasks ["task 1" "task 2"])

16:48 clojurebot: {:tasks ["task 1" "task 2"], :count 2, :flash "message", :sid "35bcf8b4"}

16:48 markoman: even flash count and tasks are updated one by one, on each request they are retrieved all by one

16:50 ah ok , you can just put them all in row

16:52 ataggart: ,(doc assoc)

16:52 clojurebot: "([map key val] [map key val & kvs]); assoc[iate]. When applied to a map, returns a new map of the same (hashed/sorted) type, that contains the mapping of key(s) to val(s). When applied to a vector, returns a new vector that contains val at index. Note - index must be <= (count vector)."

17:01 markoman: i see, now i realize what & kvs means

17:05 currentB: is there a somewhat clean way to produce an original, quoted form which defines a function from that function object itself?

17:06 in otherwords, I have a function object defined with (fn [x] (+ x 1)), is there a way I can get access to that form in a program?

17:07 amalloy: no

17:07 currentB: k, thanks

17:07 amalloy: you could ask technomancy about his print-dup-able fn, though, if it excites you

17:09 technomancy: clojurebot: google serializable-fn

17:09 clojurebot: First, out of 6370 results is:

17:09 technomancy/serializable-fn - GitHub

17:09 https://github.com/technomancy/serializable-fn

17:09 technomancy: ~botsnack

17:09 clojurebot: thanks; that was delicious. (nom nom nom)

17:11 amalloy: technomancy: i can never remember what the dang thing is called, so it's hard to google for. last time i searched for technomancy (or maybe hagelberg?) on the mailing list and filtered manually :P

17:11 technomancy: it's on Seajure's github too

17:13 * amalloy is polluting the irc logs with references to anything he finds hard to google, in the hopes that they get crawled

17:13 * fliebel has a very bad log search

17:15 fliebel: technomancy: What is that save-env doing?

17:17 amalloy: fliebel: capturing closed-around values

17:19 devn: Hey all -- I'm trying to add metadata on a def generated by a defmacro

17:19 here's a code sample...

17:20 (defmacro deftemplate [name & forms] `(def (with-meta ~name {:soy true} ) ~(deftemplate-helper forms)))

17:20 amalloy: devn: move the ~ outside of with-meta

17:21 fliebel: amalloy: Are these &env and &form some special values?

17:21 amalloy: fliebel: macros all get them

17:21 * fliebel tries that

17:21 markoman: hillarious bots you have here

17:21 amalloy: as of, what, 1.2 i think?

17:22 Raynes: We have the most awesome bots ever.

17:23 amalloy: clojurebot: show markoman how well you speak languages nobody else does

17:23 clojurebot: please show us that ugt is not broken

17:23 amalloy: aw

17:23 ~maybe like this?

17:23 clojurebot: Gabh mo leithscéal?

17:24 markoman: :D

17:25 maybe one day she can interpret my english to you

17:26 fliebel: amalloy: Where is v defined? I see val, but not v.

17:27 amalloy: fliebel: what? plz context, what code are you talking about

17:27 fliebel: the printable function

17:28 amalloy: it looks like it's .v, a member function. i haven't looked into how &env actually works

17:29 markoman: i was planning new app with lein yesterday, formjure but jury told *jure ends are not available anymore. so i figured it went really bad at some point, lol

17:31 livingston: due to an oddity of the rdf spec strings can have a language tag associated with them, for example @en for English. I would really like to just stash that in meta data but no meta data on strings...

17:31 Raynes: Didn't leiningen remove that restriction a while back?

17:32 livingston: any good suggestions? a structure that has a string and a tag seems annoying because I'd like it to generally behave like a String

17:35 raek: what does the spec say about strings with different languages and equality?

17:36 livingston: they are explicitly non-equal (although there is an operator to just get their string guts, which you could compare)

17:37 markoman: Raynes, version 5 i have still have it

17:37 livingston: also the absence of a tag is not wild card so "foo" != "foo"@en

17:37 raek: metadata does not affect equality, so that could be an argument against coding it as metadata of some sort

17:38 one obvious way could be to represent them as ["foo" :en] or [:en "foo"] (with nil as no language)

17:39 since the language tag is really a part of the string data, I'm inclined to be explicit about it

17:40 another way could be to skip the vector if there is no language tag. that would force the functions that use them to have cases for both, though

17:40 livingston: raek: that's not awful, but I'd kinda like them to behave like strings out of the box as much as possible. I guess I could accommodate "foo" and ["foo" :en]

17:42 raek: this does not inhibit you from "massaging" input to the program, e.g. by normalizing "foo" to ["foo" nil]

17:42 livingston: right

17:42 raek: but I feel that allowing both as the internal representation only complicates matters

17:43 ...and vice versa for prettyprinting output

17:44 livingston: my use case (and what I assume is the most average use case) is that people have data in their language and data with no language tag and that's all they use, so for the most part it's a flag that sometimes caused inequality for no good reason (because there's no way to say just treat the default and mine (e.g., @en) as the same)

17:46 raek: heh, this reminds me of the name of the country Monaco and Munich, a German city

17:46 in italian, the name of Munich is "Monaco"

17:46 markoman: how do you overline word(s) on .markdown language?

17:48 jweiss_: i'm figuring out destructuring. but i also want to do some structuring :) as in, i have 5 keyword arguments, i want to return a nested map structure with only the keys that were passed in, in place in the structure. using literals doesn't work because i end up with all the keys, not just the ones passed in.

17:48 raek: ...so, "Monaco"@en and "Monaco"@it are quite different

17:49 jweiss_: as in, given keys [a b c d e] return {:a a :b :b :c {:d d :e e:} } but leave out keys not provided

17:50 livingston: raek: yeah. that's I think what they are getting at. but really I think they should have probably just used different properties so instead of lable and the predicate it could be label-en or label-it that are subs of label etc.

17:51 raek: jweiss_: the thing you are describing sounds a bit like select-keys

17:51 ataggart: ,(select-keys {:a a :b :b {:d d :e e:} } [:a :b])

17:51 clojurebot: Invalid token: e:

17:51 ataggart: bah, whatever

17:51 jweiss_: yeah i gotcha, that is simple for a flat map, but gets ugly when it's nested

17:52 ataggart: back to trying to learn scala

17:54 raek: destructuring only helps you with extracting the pieces

17:54 jweiss_: raek: yeah, i said i want to do structuring :)

17:54 taking pieces and putting them into a structure

17:54 raek: oh, misread that...

17:55 martin_mcgovern: \msg nickserv help

17:55 livingston: jweiss_: so just use backquote and ~

17:55 raek: is there a fixed number of nestings?

17:55 jweiss_: raek, yes

17:56 the structure is known, the real issue is how to leave out items not provided

17:56 raek: I would start with the inner one

17:56 that should be a simple select-keys

17:56 jweiss_: actually livingston 's idea makes sense

17:57 sorta... can't figure out how i'd do it without a bunch of ifs everywhere

17:57 but that's a start

17:57 livingston: I mean assuming it's a fixed transformation or is this for any old list?

17:57 raek: what would syntax-quote add?

17:57 you can just have a map literal in your code

17:57 jweiss_: raek but how to remove keys that weren't provided to my fn?

17:58 livingston: actually I think I got confused about the problem.

17:58 how does it know to make that nested hash?

17:58 raek: jweiss_: what key does the {:d d :e e:} value belong to?

17:58 jweiss_: raek: c

17:59 raek: oh, right. it's right there...

17:59 jweiss_: so if i call (myfn :a 1 :b 2 :d 3), i want {a: 1 :b 2 :c {:d 3}}

18:00 livingston: so you have a hash of hashes ... and a list of keys and you only want the stuff that matches the keys wherever they are?

18:00 jweiss_: yeah

18:00 raek: (fn [{:keys [a b c], :as outer-map}] (-> outer-map (select-keys [:a :b]) (assoc :c (select-keys c [:d :e]))))

18:00 livingston: in your example how does it get the :c ? and know to nest the :d ??

18:01 jweiss_: livingston that is what i'm trying to solve

18:02 raek: jweiss_: ^ that should work, assuming that the involved keys are fixed

18:03 jweiss_: raek: ok thanks. do ou think there's a way to specify the literal, and transform it in a generic way to get what i want?

18:03 i mean i know there is

18:03 simple way :)

18:04 livingston: i still don't follow. if the input is just what's given, then I have to assume you want the first tow out and the rest in a nested hash... then yeah go with something like raek said or just cons it together yourself if you know what the structure is. I either missed something or this is too abstract

18:05 jweiss_: livingston: i have multiple functions that do similar things, different structures

18:05 so i'm looking for something more generic

18:05 sorry one of you asked me that earlier and i gave a misleading answer

18:06 raek: it is possible with a macro

18:07 jweiss_: ah well, i was hoping i was missing a straightforward solution. i'll take your suggestions and see what i can do - thanks!

18:07 raek: so you want something that takes something like {:a _, :b _, :c {:d _, :e _}} and turns it into the code above?

18:08 jweiss_: raek: yeah, something like that

18:08 raek: hrm, wait. you only need a macro if you need it to expand into a destructuring form

18:08 jweiss_: i mean, destructuring already does what i want in that sense

18:08 except it exposes that structure to my callers, which i don't want to do

18:08 raek: but you should still be able to solve the problem with a function

18:08 livingston: if it's only 2 or 3 specific keys going to something: `(:a ~(get input :a) ... or create your list with the things your wanted substitued a template and recursively substitue in use your input hash keys/vals as the things to replace

18:09 raek: (although, in that case, you'd use a bunch of gets instead of destructuring)

18:09 jweiss_: ok

18:09 livingston: ok what raek said is now something else... you need to make up your mind ;)

18:10 jweiss_: sorry i am not sure what raek meant by "the code above"

18:10 raek: oh, the (fn ...) I wrote...

18:11 jweiss_: i want a fn that takes the template {:a _, :b _, :c {:d _,

18:11 :e _}} and a flat map with possible keys :a :b :d :e and builds the map

18:11 by replacing _ with the value and leaving out what was not provided

18:12 oh sorry raek then that isn't what i wanted

18:12 raek: in addition, destructuring is syntactic sugar for humans. if you need to automate stuff at runtime, it might not be that useful

18:13 jweiss_: it seems like what i want is pretty common

18:13 maybe not

18:13 just a list of optional fn args, and i want to stick them in a datastructure

18:13 the only thing is i don't want nils where keys were left out

18:14 i could traverse and remove nils, but that makes nil the "magic" value

18:14 and won't distinguish if a real nil was passed in.

18:15 livingston: make a macro (key-and-val input :a) then have that macro look up :a in the input if it's there return (:a (get input :a)) if it's not return nil

18:16 then syntax quote your structure and call that macro where you need it with the stitch in command ~@

18:17 markoman: amalloy: so i changed session-bind to return session argument without using get. tests didnt fail so it should be ok. thanks for your input

18:17 livingston: jweiss_: that's the simplest thing that could possibly work that's quick to code

18:18 jweiss_: livingston: not seeing how my syntax quoted structure won't have nils in it.

18:19 livingston: jweiss_: that's why you splice it in with ~@

18:19 actually if it's not there you need to return '() from the macro probably (not nil, sorry, I still think in lisp)

18:25 amalloy: livingston: there's nothing wrong with quoting it for clarity, but i'd like to make sure you know that you don't need to quote the empty list: ##()

18:25 sexpbot: ⟹ ()

18:25 clizzin: are there any clojure libs for bundling AMIs on EC2?

18:26 livingston: jweiss_: so you would do `{~@(kv i :a) ~@(kv i :b) :c {~@(kv i :d) ...} where kv takes a hash and a key either returns '() or (list key (get input key))

18:26 amalloy: ah thanks. (like I said, *still thinks in lisp*)

18:26 amalloy: indeed

18:26 livingston: CL that is

18:27 amalloy: livingston: i showed up last night after you were asking about inspecting clojure .class files. have you used javap?

18:27 livingston: no

18:27 jweiss_: cool, thanks

18:28 TimMc: amalloy: I should try running a Java disassembler on a clojure class file. :-)

18:28 livingston: last time I seriously programmed java my second edition java in a nutshell was current (enough)

18:28 amalloy: https://gist.github.com/295631

18:28 livingston: does it ship with the jdk

18:28 amalloy: yes

18:29 livingston: super cool that would have been useful and exactly what I needed

18:29 amalloy: heh

18:29 but too late?

18:30 livingston: I wanted to look at exactly what clj was compiling as an interface definition

18:31 I was able to see enough with less, then I just called import on the .class file in my repl then show, that did the trick too

18:31 amalloy: livingston: yeah, show is handy

18:31 livingston: I call it constantly

18:31 amalloy: javap has options to show you the debugger symbols, like locals and line numbers

18:32 well. maybe not line numbers. but assembly code, anyway

18:32 TimMc: Does the JVM have an assembler?

18:33 Is that how JVM compilers work?

18:33 I think I'll write my next program in bytecode. :-P

18:33 amalloy: TimMc: there's not an assembler that's easy to get access to

18:33 but the clojure.asm package outputs jvm bytecode and then runs it through some library to generate classes from it

18:34 livingston: TimMc: byte code. the jvm takes it from there. (as far as I understand)

18:34 raek: clojure uses the ASM (yes, that's its name) library http://asm.ow2.org/

18:35 there's some assemblers out there. I have tried Jasmin a little

18:35 though, there doesn't seem be any standardized assembly syntax for the jvm

18:36 TimMc: Curious.

18:36 raek: so in clojure's case, the code goes directly from AST to .class-file

18:39 I really recommend to try to write a class with a JVM assembler and call the code from clojure...

18:39 it's an interesting experience

18:47 TimMc: You recommend this?

18:51 livingston: that's like when someone says, "this tastes awful. see, you try."

19:06 so deftype/record examples show the function definitions being "in-lined" right into the deftype macro, is there any advantage / disadvantage to pointing at some other function?

19:07 if it's a big protocol it seems like this could be a bit messy?

19:08 amalloy: livingston: reuse existing functions that are useful for multiple protocols. define protocol functions as (comp inc +) instead of explicit (fn) forms

19:09 livingston: I'm not quite following the (comp int +) bit?

19:16 amalloy: livingston: you could implement a protocol function by composing together existing functions

19:17 (extend String Splittable {:split (juxt first rest)})

19:19 livingston: I was just wondering about (defrecord Foo [bar] Splittable (split [x] (my-split x))) seems a little redundant.

19:49 hiredman: ~search for reduce

19:49 clojurebot: <#clojure:raek> ,(reduce (partial merge-with (comp doall concat)) (for [i (range 1878) ] {:a []}))

19:49 <#clojure:technomancy> yeah, something is lazy even coming out of reduce. interesting.

19:49 <#clojure:technomancy> ,(reduce (partial merge-with concat) (for [i (range 1878) ] {:a []}))

19:49 <#clojure:fliebel> mec: Very nice. Now say I want to *update* and not assoc. If it's more than one line, I wrote something that does this already using reduce.

21:34 livingston: so I have a root set of functionality and an extension (or two), I have them as two separate protocols, but if I pass objects of these types out to java users they are going to have to constantly cast between the types if they want to use functions in the core with functions in the extension, right?

21:38 danbell: Does anyone know of a clojure/tomcat tutorial?

21:46 ignacio: @danbell: http://stackoverflow.com/questions/1464071/clojure-web-application-where-do-i-start?

21:54 danbell: ignacio---thanks

21:55 eventually found a link chain

22:12 dnolen: livingston: hmm I'm beginning to think exposing deftype and defrecord to Java users might not be such a hot idea. They aren't meant to be higher-level then what Java can provide.

22:12 s/aren't/are

22:12 sexpbot: <dnolen> livingston: hmm I'm beginning to think exposing deftype and defrecord to Java users might not be such a hot idea. They are meant to be higher-level then what Java can provide.

22:13 livingston: dnolen: ? higher level

22:13 oh

22:13 dnolen: livingston: defrecord specifically has a bunch of magic so that Clojure code doesn't need type hints. Java user don't have any such luck.

22:13 er, I mean protocols.

22:13 livingston: it can't be that unintended defprotocol automatically generated a java interface to go with it.

22:14 dnolen: livingston: I think that's a hosty implementation detail.

22:14 livingston: what else should I do, create POJOs instead

22:15 dnolen: livingston: pre deftype/record/protocols, to expose Clojure goodness to Java people used genclass.

22:19 livingston: from clojure.org/datatypes "While datatypes and protocols have well-defined relationships with host constructs, and make for a great way to expose Clojure functionality to Java programs, they are not primarily interop constructs"

22:20 also: "If you use datatypes and protocols you will have a clean, interface-based API to offer your Java consumers. If you are dealing with a clean, interface-based Java API, datatypes and protocols can be used to interoperate with and extend it. If you have a 'bad' Java API, you will have to use gen-class. "

22:21 none of the documentation says how java users are supposed to deal with typecasting though

22:21 dnolen: livingston: hmm, I guess I fail to see how that's true. Since protocols have untyped arguments (except for the first arg).

22:22 livingston: the args aren't the problem. java users can shove anything in and it'll just pass as Object. it's really the return values that are going to be the most trouble

22:25 at least I would think ... I'm not the biggest java programmer.

22:25 dnolen: livingston: well if you're record implements two protocols I don't think users will need to do any casting. Not sure about return values.

22:27 livingston: dnolen: they will if they code to the interface(s) and not the concrete type right?

22:28 consider iA iB sets of functions, and implementations X and Y that do iA and iB differently. if they just care about A/B functionality and want to abstract themselves from X and Y

22:30 dnolen: livingston: yeah but that's true of Java too right?

22:31 livingston: presumably, I supposed. I just wanted to make sure I wasn't missing something to make it easier or whatever.

22:50 if I have a standard let type vector [a 3 b 4] what's the best way to pull the variables out?

22:52 pdk: what do you mean by pull them out

22:53 pass them to code outside the let block?

22:53 livingston: just get them in a list or something I just want'ed '(a b)

22:53 pdk: [a b] then?

22:53 remember let returns the value of the last thing in its body

22:53 livingston: any sequence is fine

22:54 no sorry that was misleading to say let, I just ment a vector like that (pairs of things) and I want the "keys"

22:56 pdk: can you clarify on keys here

22:56 sattvik: ,(keys (apply assoc {} [:a 1 :b 2]))

22:56 clojurebot: (:b :a)

22:56 pdk: you want to grab items 0 2 4 etc out of a list?

22:56 amalloy: livingston: ##(take-nth 2 '[a 1 b 2])

22:56 sexpbot: ⟹ (a b)

22:56 livingston: that's what I was looking for, thanks amalloy

22:57 sorry for the confusion everyone.

22:57 there's always an easy way to do that but I can never remember

22:57 clojurebot: Pardon?

23:04 livingston: is this the best way to combine two vectors and get one out? (vec (concat '[a b] '[3 4]))

23:06 amalloy: livingston: ##(into '[a b] [3 4]) is better if you're sure that (at least) the first one is a vector, but these are all linear-time; concatenating vectors is difficult to do at the source level because it's not performant

23:06 sexpbot: ⟹ [a b 3 4]

23:07 livingston: cool. they are short and they are in macros ... so they can be slow (er)

23:29 can anyone tell me why this isn't working: https://gist.github.com/911074

23:33 amalloy: livingston: i can't really look in detail, but (~args ~@special-args) looks suspicious

23:34 as does (~(vec ...))

23:35 livingston: argh I'm an idiot... there's an extra paren in (concat (special-vars args)) .. should be (concat special-var args) and I'm good

23:36 basically I want to make a function that if you call with out the special args it just gives you defaults, but if you call with new values for the special args, it needs to bind them too, so that downstream calls will get them too

23:38 amalloy: livingston: would it do any harm to bind the specials when you use the default?

23:38 livingston: no

23:39 amalloy: you might be able to use ##(doc fnil) then

23:39 sexpbot: ⟹ "([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take... http://gist.github.com/911078

23:39 livingston: but if they are getting called with any frequency or depth it seems like a lot of bindings to stack up.

23:42 oh that's a little weird, no I want something more like partial I think

23:43 amalloy: mkay

23:43 livingston: it's the first arg that I'm binding with a special (global) var. so if the user doesn't care (or know the first arg) they get the default (and they call it with one less arg)

23:48 joshua__: Hmm. I'm doing a commit in my local git repository and it isn't making it origin/master etc. When I try to push the changes it says everything is up to date. I don't get it.

23:52 amalloy: joshua__: you probably haven't done a git add. what's git status show?

23:52 joshua__: amalloy, It says nothing to commit.

23:53 amalloy: joshua__: and git log shows the commit you want to push? in that case git push origin master should work

23:56 joshua__: amalloy, Says "Everything is up to date." Doesn't push my commit.

23:56 amalloy, Thus, the confusion.

23:57 amalloy: joshua__: you can ask in #git. if the branch you're on locally is master, and your log shows the commits you want to push, then i don't know the right questions to ask :P

Logging service provided by n01se.net