#clojure log - Apr 25 2010

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

0:00 gstamp: hrrm. the doc for 1.1 seems to suggest (require clojure.contrib.seq-utils) but I'm getting a not found error

0:02 mmarczyk: you're missing a quote

0:02 ,(require 'clojure.contrib.seq-utils)

0:02 clojurebot: nil

0:02 mmarczyk: ,(clojure.contrib.seq-utils/partition-all 2 [1 2 3 4 5])

0:02 clojurebot: ((1 2) (3 4) (5))

0:03 gstamp: got it going. Thanks very much

1:13 reburg: say i create a function with some bound var *foo* using bound-fn*. in that function i send a message bar to an agent. which binding for *foo* does bar see?

1:18 from experimentation, it looks like the root binding, but i'm wondering if the actual answer is undefined for some reason

1:25 _ato: reburg: the agent runs bar in a different thread, since bindings are thread-local it will indeed see the root binding

1:25 it's not undefined

1:25 carkh: err

1:25 ,(doc bound-fn*)

1:25 clojurebot: "([f]); Returns a function, which will install the same bindings in effect as in the thread at the time bound-fn* was called and then call f with any given arguments. This may be used to define a helper function which runs on a different thread, but needs the same bindings in place."

1:26 _ato: oops, missed the mention of bound-fn

1:26 carkh: reburg: must be some timing error in your code

1:27 mefesto: this seems to work: http://pastie.org/933742

1:28 the function returned from bound-fn* will see x as 10

1:29 carkh: clojure makes it easier to reason about multithreaded code, but it's still pretty darn hairy =P

1:43 reburg: carkh: the discrepancy is that you are using the bound-fn as the agent message. i'm not.

1:43 the agent is being sent the message within the bound-fn

1:44 mefesto: reburg: could you paste an example?

1:47 carkh: reburg: well you want to capture the dynamic environement at the moment you're sending that message

1:47 and the example was not mine =P

1:50 reburg: http://paste.lisp.org/+23UU

1:51 is the agent /always/ guaranteed to run in a separate thread? or might it run in the same thread if that's how the scheduling works out?

1:51 mefesto: in the end the increment function is executed on a different thread and the binding you've done is not active there

1:51 afaik, always a different thread in a thread pool

1:51 carkh: reburg: yes always on a different thread

1:52 mefesto: not the _main_ thread

1:52 carkh: actually it could be the smae, but the bindings would be different

1:52 reburg: ok, i guess that's really what i wasn't sure of

1:52 carkh: so for all purposes you can think of it as a different thread

3:19 mitkok: Hey, guys. From where I can get swank-clojure jar, cause I think the download through elpa is corrupted

3:49 remleduff: http://repo.technomancy.us/swank-clojure-1.1.0.jar

3:52 Raynes: I don't think the ELPA version is corrupt though.

3:54 mitkok: remleduff: thanks

3:56 Raynes: the ELPA version may be not corrupted, but I think the download process may corrupted the jar file.

3:58 remleduff: I get swank-clojure through lein deps, didn't realize it was actually possible to get it through elpa

4:18 mudphone_: is there some way to delete a jar I pushed to clojars.org?

4:20 _ato: mudphone_: hadoop, zookeeper etc?

4:20 I'll delete 'em

4:20 mudphone_: yeah, the hadoop/hadoop, hbase/hbase, and zookeeper/zookeepers

4:21 I didn't put them in my group, sorry about that

4:21 and thanks for doing that for me

4:21 there's also an hbase-0.20.3 that I created by mistake

4:23 _ato: thanks

4:23 seems like the :exclusions feature of lein is not working

4:24 _ato: it definitely works sometimes, maybe not in all cases though

4:24 mudphone_: i was trying out the log4j example, that I happen to need, and it doesn't seem to work for me

4:24 not a big deal in the short term

4:25 just wondering

7:37 naeu: can someone explain why: (seq? [1 2 3]) ;=> false

7:51 esj: because [ . . . ] is a literal vector

7:51 ,(vector [1 2 3])

7:51 clojurebot: [[1 2 3]]

7:51 esj: ,(vector? [1 2 3])

7:51 clojurebot: true

7:51 esj: if you want to seq over it (seq [1 2 3) will hand you a seq over the vector, which is a concrete class

7:56 naeu: i had trouble with this at first as well, but the concrete classes: maps, vectors, etc, are differrent from seqs. A seq can be thought of as a highly clever iterator over those concerete classes.

7:57 naeu: esj: so why does (seq? '()) ;=> true?

7:57 esj: naeu: i think, and i'm up for correction here, that '() is a literal list which implements exactly the same interface as a seq

7:58 naeu: but that's pretty much a guess

7:58 naeu: :-)

7:58 I was just trying to get my head around the threading macros -> ->>

7:58 esj: oh yeah, those are fun

7:58 naeu: so was reading the source in core.clj

7:58 carkh: ,(instance? clojure.lang.ISeq '())

7:58 clojurebot: true

7:58 carkh: ,(instance? clojure.lang.ISeq '[])

7:58 clojurebot: false

7:59 carkh: ,(instance? clojure.lang.ISeq [])

7:59 clojurebot: false

7:59 carkh: ,(instance? clojure.lang.ISeq (seq []))

7:59 clojurebot: false

7:59 carkh: ,(instance? clojure.lang.ISeq nil)

7:59 clojurebot: false

7:59 carkh: ,(instance? clojure.lang.ISeq (seq [1 2 3]))

7:59 clojurebot: true

8:00 carkh: anyways =)

8:00 naeu: :-)

8:00 has anyone had a look at the source for ->>

8:00 carkh: ~def ->>

8:01 esj: no, i just know it as -> where it threads on the last argument, rather than the first

8:01 naeu: i was just wondering about the central part of the implementation

8:01 particularly: (with-meta `(~(first form) ~x ~@(next form)) (meta form))

8:02 oops, that's for ->

8:02 I mean: (with-meta `(~(first form) ~@(next form) ~x) (meta form))

8:02 I'm wondering why it's not: (with-meta `(~@form ~x) (meta form))

8:03 _ato: probably because it was copy-pasted from ->

8:03 naeu: and also, the following line: (list form x))), why doesn't that try and preserve form's metadata?

8:03 _ato: it does preserve it

8:03 it just passes the form object through

8:03 naeu: aaah

8:03 _ato: so it reatins its metadata

8:03 naeu: ok

8:03 :-)

8:05 I thought it might be due to copy/paste or to try and keep the implementation as similar as ->

8:09 kzar: Can you use wildcards in Enlive selectors? I'm trying to select a few different class names that are similar

8:17 _ato: kzar: I don't think so, but you can write your own predicate

8:17 http://enlive.cgrand.net/syntax.html

8:17 sexpbot: "selectors syntax"

8:18 kzar: _ato: Yea I've been reading that page actually but to be honest I'm not sure what predicates are

8:19 _ato: I *think* you can just use something like this as a selector: (pred #(str/starts-with? (:tag %) "foo-"))

8:20 (you could of course name that lamba for greater readability)

8:20 haven't tried it though

8:20 kzar: oh I get the idea now

8:20 thanks _ato :D

9:42 _ato: Hmm can you think why having a re-find inside the pred function would cause a Null pointer exception?

9:44 _ato: hmm

9:45 ,(re-find #"foo" nil)

9:45 clojurebot: java.lang.NullPointerException

9:45 _ato: kzar: whatever you're matching against doesn't exist on the node?

9:46 maybe try: (re-find #"foo" (or ... ""))

10:01 kzar: _ato: Yea that was it, sometimes there wasn't a class and in those cases I was trying to search nil. So obvious in hindsight heh

10:01 hamza: is it possible to set a timeout on a future object? i have a future which may get stuck i was wondering if there is native way without using external variables?

10:09 nurv: Hi.

10:23 cYmen: Which build tool would you guys recommend I learn for clojure? Does anybody have a link to a nice tutorial?

10:26 nurv: cYmen: http://github.com/technomancy/leiningen

11:56 djpowell: should I expect building contrib head with maven to work?

11:56 i get lots of test failures

12:04 iwillig: hi, i am trying to use a multimethod to dispatch based on the class of the first argument... its not clear to me how to use a multimethod with several arguments and you only care about the first arg

12:05 anyone got any pointers ?

12:13 cp2: yikes, lag

12:13 anyway

12:13 iwillig: (defn foo-dispatch [arg & _] (class arg))

12:13 (defmulti foo foo-dispatch)

12:13 (defmethod foo String [s & _] (println "my arg was a string"))

12:13 and so on

12:14 Raynes: iwillig: As mentioned above, if all you care about is the first arg, just ignore the rest of the args wherever you need to ignore them.

12:14 cp2: note the & _ depends on what you want

12:14 mhm

12:26 iwillig: got it, thanks cp2 Raynes

12:35 remleduff: iwillig: Also, multimethods that dispatches on only the type of the first argument are exactly the point of Protocols (an upcoming feature in 1.2)

12:35 AWizzArd: technomancy: Hi. Do you know about ‘M-x delete-trailing-whitespace’?

12:36 It’s a very useful command. But in Clojure files it also deletes trailing commas, as those are seen as whitespace too (:

12:40 joshua-choi: I am reading a recent essay by Chouser on binding: http://blog.n01se.net/?p=134.

12:40 sexpbot: "Using binding to mock out even “direct linked” functions in Clojure « searching for signal"

12:41 joshua-choi: I've got a question: what does Chouser mean by saying, "Starting with Clojure 1.1, most clojure.core Vars are linked directly into code that uses them."?

12:41 Is this a new feature in Clojure 1.1?

12:47 djpowell: i thought direct binding was a 1.2 feature?

12:47 dunno

12:47 joshua-choi: djpowell: How does direct linking work?

12:48 The impression I got from Chouser's essay is that it's some sort of prevention of var binding for performance

12:48 But I can't find any other information on direct linking with Google

12:49 djpowell: i think it avoids the var name lookup indirection somehow

12:49 i'm not sure what the state of it is - i think it is a bit experimental

12:49 cYmen: hmhmhm

12:49 djpowell: i think it is needing some more control over what is done directly?

12:49 remleduff: I didn't think direct binding was in 1.1

12:50 joshua-choi: Chouser's essay says so

12:50 As for control, it also mentions a :dynamic key in vars' metadata to turn this on or off

12:50 cYmen: can anybody recommend a leiningen tutorial?

12:50 joshua-choi: Other than that, I have no clue

12:52 cYmen: For using others' libraries or for adding Leiningen to your own?

12:53 remleduff: http://github.com/richhickey/clojure/commit/4d08439a9cf79f34a730714f12edd5959aae126e added direct linking, I don't think that's in 1.1, but I'm not good enough at git to completely verify that

12:53 cYmen: joshua-choi: for my own stuff

12:54 _brian2_: dnolen> Something weird is happening when I try to run template2 example, oddly it used to run, but i downloade it just now, and get java.lang.IllegalAccessError: selector is not public

12:54 cgrand: _brian2_: selector is gone, youdon't need it anymore

12:55 dnolen: _brian2_: yeah I need to merge my changes into master

12:55 _brian2_: cgrand: so i just take that out of the header

12:55 ?

12:56 joshua-choi: cYmen: I used http://wiki.github.com/ato/clojars-web/tutorial, which is Clojars' tutorial.

12:56 cgrand: every (selector x) becomes x

12:56 _brian2_: ^^

12:56 joshua-choi: cYem: I ran into some problems installing Leiningen, which that tutorial didn't really address, but if you've already installed it, it should be fine.

12:56 _brian2_: hmm

12:56 dnolen: _brian2_: changes pushed.

12:57 _brian2_: dnolen: thanks!

12:57 joshua-choi: remleduff: Is that the only documentation of direct linking there is, other than Chouser's essay?

12:58 _brian2_: dnolen: is this a new enlive?

12:59 dnolen: _brian2_: oh one sec while I fix that too.

12:59 cYmen: joshua-choi: I'll check it out.

12:59 joshua-choi: Thanks!

12:59 joshua-choi: No probem.

13:00 dnolen: cgrand: 1.0.0-SNAPSHOT on clojars is the current one right?

13:00 remleduff: joshuah-choi: Not really that I know of, there's an assembla issue about deciding what knobs it needs

13:00 joshua-choi: Oh good, I'll go look for that.

13:00 cYmen: Does anybody know how to start the nailgun server from the mercurial checkout of vimclojure?

13:01 This may be more of a java than a clojure problem, though. :)

13:01 _brian2_: dnolen: are you also reflecting this in your readme.textfile ?

13:02 dnolen: change that as well yes

13:02 changing i mean

13:02 _brian2_: thanks

13:02 Licenser: hmm I jst read about the annotations. Am I mistaken or are they like metadata just in java?

13:02 * joshua-choi is very glad annotations are being added

13:03 Licenser: joshua-choi: that isn't an answer :P

13:03 I am very glad that I got tacos too but it doesn't change anything ;)

13:03 joshua-choi: No, it isn't an answer. :)

13:03 stuarthalloway: Licenser: they are ugly metadata that Java canread

13:03 Licenser: :P evil person

13:03 okay then I understood it correctly

13:03 stuarthalloway: they are easy to write from Clojure

13:04 but you shouldn't use them for design, only interop

13:04 Licenser: wouldn't it be really cool if clojure metedata could be stored like that too? *hides* I mean it would make clojure data way more interoppy

13:05 cYmen: man gradle is so slow it might as well be in flash

13:05 Licenser: I didn't wanted to use them, I was just reading through the latest assembla stuff and tried to figre out what they are. Then I read a intro on the java side and was not much smarter then before since it seems some java people think explaining stuff simple is overrated so I figured i boil what I got down and ask if I'm right :P

13:07 cgrand: dnolen: yes, 1.0.0-SNAPSHOT is the current one

13:07 remleduff: One thing I wasn't sure of is that if I remember correctly, annotations in java only support literal values. That makes clojure's version strictly more powerful than java's, because you can def{type|record|interface} wherever you want.

13:08 dnolen: cgrand: thx

13:08 stuarthalloway: remleduff: clojure's version just creates java annotations

13:08 so it can be easier to use but can't do anything that would be impossible...

13:09 dnolen: _brian2_: should be fixed now

13:12 remleduff: stuarthalloway: Well, in java you literally have to say @Annotation(property = "thisMustBeAStringLiteral") interface B {}, in clojure couldn't you could do (definterface #^{Annotation {:property somStringVariable})?

13:13 AWizzArd: stuarthalloway: I saw that you are the author of Contribs sql package. If you have the time, could you please try to compile it with *warn-on-reflection* set to true? (:

13:13 stuarthalloway: remleduff: yes, that is cool. The power is more in dynamic compilation than in annotation support per se, but good point anyway

13:14 AWizzArd: do you mean sql really? That's Steve Gilardi's

13:16 remleduff: stuarthalloway: While I have your attention: last night I discovered that objects that override Object.equals with a method that throws an exception cause your repl to crash because there's an unguarded call to "=" in clojure.main/repl. For example: (proxy [Object] [] (equals [o] (.toString nil))) will crash your repl

13:16 _brian2_: dnolen: ok thanks

13:16 AWizzArd: stuarthalloway: okay, thanks for this info!

13:17 stuarthalloway: "my repl" meaning "labrepl"?

13:17 remleduff: stuarthalloway: No, any repl that uses clojure.main/repl

13:18 Do java -cp clojure.jar clojure.main and then type that proxy form in and it will crash to the command line

13:18 * stuarthalloway restarting a repl

13:18 stuarthalloway: remleduff: can you make a ticket for that on the clojure assembla?

13:18 AWizzArd: ~seen technomancy

13:18 clojurebot: technomancy was last seen joining #clojure, 101 minutes ago

13:18 mmarczyk: shouldn't equals return a Boolean?

13:19 remleduff: I actually have a fix, but I haven't sent a CA in, and was having troubles writing a unit test

13:19 mmarczyk: ah, sorry, misunderstood -- certainly it shouldn't crash the repl

13:21 remleduff: mmarczyk: What's super bad for me is that I'm using a 3rd party library with a bug in it (it's clearly a bug to throw an exception from your equals method) but it's quite hard to prevent objects from getting incidentally printed sometimes

13:22 mmarczyk: right

13:24 cYmen: any idea where I could ask gradle questions?

13:31 remleduff: $ticket 317

13:31 sexpbot: Command not found. No entiendo lo que estás diciendo.

13:31 rhudson: cYmen: try #groovy

13:31 remleduff: ,ticket 317

13:31 clojurebot: java.lang.Exception: Unable to resolve symbol: ticket in this context

13:31 hiredman: clojurebot: ticket #317

13:31 clojurebot: {:url http://tinyurl.com/36y7mj6, :summary "clojure.main/repl isn't quite defensive enough", :status :new, :priority :normal, :created-on "2010-04-25T13:29:00-04:00"}

13:33 stuarthalloway: remleduff: thanks for the ticket

13:34 ... and a patch with no test is better than not patch at all, so send that CA in sometime :-)

13:39 cYmen: join #groovy

13:39 gna :)

13:41 rhudson: cYmen: http://www.gradle.org/community.html

13:41 sexpbot: "Gradle - The Gradle Community"

13:43 Raynes: Gradle... MY EYES!

13:46 LauJensen: Evening gents

13:46 Borkdude: Evening, Lau

13:48 cYmen: Bonsoir

13:48 Licenser: aloa

13:51 cYmen: Man I wish kotarak would show up here sometime.

13:52 LauJensen: ~seen kotarak

13:52 clojurebot: kotarak was last seen quiting IRC, 4075 minutes ago

13:52 cYmen: I want to bug him about vimclojure.

13:52 LauJensen: He used to have a habit of traveling on weekends then getting back sunday evenings, that might be the case, in which case he's here in 1+ hour :)

13:54 cYmen: I hold little hope. :)

13:58 woohoo it works

13:59 I need to write down what I did lest I be stuck again tomorrow.

14:45 LauJensen: What does atom do?

14:45 (Just reading your post on the ikeda function)

14:46 LauJensen: it creates a reference of the type 'atom', ie something which is mutable but governed by certain semantics

14:46 ,(doc atom)

14:46 clojurebot: "([x] [x & options]); Creates and returns an Atom with an initial value of x and zero or more options (in any order): :meta metadata-map :validator validate-fn If metadata-map is supplied, it will be come the metadata on the atom. validate-fn must be nil or a side-effect-free fn of one argument, which will be passed the intended new state on any state change. If the new state is unacceptable, the validate-fn should return

14:46 LauJensen: ,(let [x (atom 5)] (swap! x inc) @x)

14:46 clojurebot: 6

14:47 cYmen: Well, I looked at the docs but explaining "atom" in terms of "Atom" isn't very helpful to me.

14:48 Your example makes it look like it's a variable in the imperative sense..

14:50 LauJensen: Indeed it is

14:51 references are the closest thing you'll come to an imperative variable. It points to a value (ie something immutable), but can atomically point to another value. atoms to that without coordinations (ie. not looking at 2 things at ones), refs do it with multiple references (ie transactional)

14:53 cYmen: That explanation of atom vs ref needs examples. :)

14:54 livingston: don't know how many people play with symbolic logic here, but I'll ask anyway... anyone know of a method/algorithm for unifying two sets of assertions

14:54 e.g. ((bob fatherOf alice) (bob fatherOf mary)) unifies with ((?x

14:54 fatherOf ?y) (?x fatherOf alice)) => ?x : bob, ?y : mary

14:56 LauJensen: cYmen: Atoms reflect singular timelines, ie a counter incrementing. references are multiple synchronized timelines, ie. a banktransfer where there must not be a state in between withdrawal from one account, and the insertion in the receivers account

14:59 cYmen: LauJensen: OK, thanks.

15:00 LauJensen: np

15:03 remleduff: Does "coordinated changes" mean coordination between threads or coordination between potentially multiple different reference objects?

15:04 livingston: more or less, everything you change in a transaction happens at a single moment in percieved time to all the threads

15:45 AWizzArd: How can I make the Emacs-Starter-Kit downloading the freshest versions of clojure-mode, swank-clojure, slime, clojure and contrib?

15:58 LauJensen: AWizzArd: Just looking at the source, it doesn't look like the starter-kit itself has any fn for downloading Clojure

15:59 AWizzArd: LauJensen: right, this seems to be done via swank-clojure

16:00 And from that source it seems to look up things in .clojure, and it has hardcoded some snapshots from build.clojure.org

16:01 LauJensen: http://github.com/technomancy/swank-clojure/blob/master/swank-clojure.el#L119

16:10 cYmen: Why does labrepl come with a webserver?

16:11 Chousuke: probably for ease of setup

16:12 yuno1: Labrepl is an environment for exploring the Clojure language. It includes:

16:12 cYmen: But it doesn't seem to actually do anything with that webserver, they might as well use static html.

16:12 yuno1: a web application that presents a set of lab exercises with step-by-step instructions

16:16 maybe they used a web server so they could define the HTML in clojure

16:25 mmarczyk: I wonder if print & Co. should use pr & Co. when recurring inside nested forms

16:25 ,(print-str {"ab" "ra, ca da"

16:25 clojurebot: EOF while reading

16:25 mmarczyk: "bra" "!"})

16:26 ,(print-str {"ab" "ra, ca da" "bra "!"})

16:26 clojurebot: EOF while reading string

16:26 mmarczyk: ,(print-str {"ab" "ra, ca da" "bra" "!"})

16:26 clojurebot: "{ab ra, ca da, bra !}"

16:26 mmarczyk: (ouch)

16:27 chouser: why wouldn't you use prn-str, if that's the behaviour you want?

16:28 mmarczyk: ,(pr-str {"ab" "ra, ca da" "bra" "!"})

16:28 clojurebot: "{\"ab\" \"ra, ca da\", \"bra\" \"!\"}"

16:29 mmarczyk: chouser: well, I can't remember ever wanting to print nested strings without the quotes

16:29 but you're right, the other option is always there

16:30 I wonder though, do pr-str and print-str only differ on string inputs?

16:34 Licenser: ,(Integer. 1)

16:34 clojurebot: 1

16:34 cemerick: The first arg of protocol method impl fns should be auto-hinted, yes?

16:36 rhudson: ,*clojure-version*

16:36 clojurebot: {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "master"}

16:37 cYmen: Is there a convention for naming variables that should have the same name as an internal? Like "list" would be a common variable name..

16:38 cemerick: cYmen: perfectly fine to use the built-in name as a binding name, IMO.

16:38 Chousuke: for short functions, anyway

16:39 though I think alist, aseq, coll, items, <noun>s, are all good, depending on what the list actually is

16:39 cYmen: hmhm

16:41 zakwilson: I can't change from my unregistered nick zakwilson_ to my registered nick zakwilson while in this channel. If that's intended behavior, it seems like a misfeature.

16:43 livingston: zakwilson: group (and therefor register your "unregistered" nick) to your account

16:44 zakwilson: livingston: thanks.

16:44 * zakwilson <-- IRC non-expert.

16:47 livingston: zakwilson: I only know because I read the freenode documentation on it, when I all the sudden realized that I need to register now to talk (it's been a while since I used IRC as well)

16:48 zakwilson: chouser: I have a bit of confusion with zip-filter.xml. (xml1-> foo :envelope :message text) returns the text of a single <message> element, which is expected. (xml1-> foo :envelope :message) returns a bunch of elements. I thought xml1-> would only return one.

16:49 livingston: I haven't had issues on other channels, and the message ("cannot change nickname while banned on channel") is confusing.

16:54 chouser: zakwilson: ... :message) will return a zip loc, which is essentially the whole tree with a pointer to the current node.

16:55 call clojure.zip/node on a loc to get an xml node

16:56 zakwilson: chouser: thanks. I didn't quite get how the data structure works, and every example I saw called text.

16:58 chouser: yeah, my "docs" there are pretty weak.

16:58 sorry.

17:00 zakwilson: chouser: you make up for it by answering my newb questions on IRC.

17:01 Tcepsa: Is there an easy way (not requiring String manipulations like trimming or taking a substring) to extract just the name of a keyword (without the colon)?

17:01 zakwilson: I've found that to be really useful about Clojure in general. I've found it comparatively hard getting help in places like #rubyonrails or #emacs.

17:02 Tcepsa: I had exactly that problem a few days ago. I ended up using subs.

17:02 ordnungswidrig: Tcepsa: ,(name :keyword)

17:02 ,(name :keyword)

17:02 clojurebot: "keyword"

17:02 ordnungswidrig: the , was only for clojurebot

17:02 Tcepsa: ondnungswidrig: Excellent, thank you!

17:03 zakwilson: Thanks to you too--and now you know another way as well ^_^

17:42 cYmen: labrepl still omits a lot.

17:42 what does the :as mean here:

17:42 [k & ks :as keys] (seq keys)

17:42 (in a let)

17:45 rhudson: It means keys is bound to the whole seq

17:45 cYmen: as opposed to?

17:46 LauJensen: as opposed to just getting the keys

17:46 rhudson: if the binding were just [k & ks] (seq keys), you wouldn't have a way to refer to the whole value

17:47 cYmen: the whole value of what?

17:47 rhudson: (seq keys)

17:47 cYmen: oh, so keys is just an additional shortcut for (k.ks)?

17:48 rhudson: Basically, yeah

17:48 * cYmen looks for a pastebin.

17:49 cYmen: http://paste.pocoo.org/show/206108/ Can you tell me what it's good for? I think (and keys vals) could just be replaced by (and k v)..

17:49 remleduff: ,(let [a & b :as keys] (seq [1 2 3 4 5 6 78]))

17:49 clojurebot: java.lang.IllegalArgumentException: let requires an even number of forms in binding vector

17:50 remleduff: ,(let [[a & b :as keys] (seq [1 2 3 4 5 6 78])] [a b keys])

17:50 clojurebot: [1 (2 3 4 5 6 78) (1 2 3 4 5 6 78)]

17:53 rhudson: In general, it's good for cases where the destructuring is really convenient -- in your pasted case, it avoids calls to first and rest -- but you still want to refer to the whole structured value.

17:54 I agree in that in the case you reference, the algorithm could be tightened up

17:54 foobar_dan: test?

17:54 clojurebot: the answer is 42

17:54 rhudson: :)

17:54 foobar_dan: Microphone check.

17:55 cYmen: rhudson: I think it's a little misleading to keep the entire list and test it instead of the first element (which is what we're actually interested in)

17:55 foobar_dan: Am I on?

17:56 rhudson: foobar_dan: loud and clear

17:57 daniel__: Microphone check.

17:57 Test?

17:58 Sorry to bother everyone. Are my messages coming through?

17:58 rhudson: cYmen: I agree that's not the best example of the use. But suppose you had some code where sometime you needed to pass the whole collection to another function if things didn't pan out with the first element.

17:58 daniel__: yes

18:03 cYmen: rhudson: yeah, absolutely

18:05 daniel__: Great. I have a question about persistent data structures.

18:06 In this code, I've def'd an agent, and a function that `mutates' the agent: http://pastebin.com/wT7PaXSd

18:07 My question is this: When await returns, does the value of the agent share data with the symbol in the let bind?

18:07 Chousuke: most likely

18:08 daniel__: Hmm. What do you mean by most likely?

18:08 Chousuke: something might have reset the agent to a completely different value in a different thread :)

18:08 after the deref, but before the send

18:09 but if you assume there are no other threads, then yes, the value of the let binding and the agent's value will share data.

18:10 but it's all immutable so don't worry about it

18:10 daniel__: Neato.

18:10 So, given a change to the agent between the deref and send, the value of `value' is still part of the identity of the agent, right?

18:11 rhudson: For that matter, some other than could have held on to @a before this thread appended the 5.

18:12 Chousuke: daniel__: hm, I don't really understand that question

18:12 daniel__: Maybe I don't understand it either. :)

18:12 mmarczyk: well actually for a short vector like that

18:12 structure might not be shared

18:12 Chousuke: daniel__: 'value' is the immutable state of the identity that the agent represents at one point in time

18:12 daniel__: Right.

18:12 mmarczyk: vectors are chunked, 32 items per chunk

18:12 rhudson: daniel__: whatever value a holds when it "receives" the send, it'll try to conj 5 to that value.

18:13 it's not necessarily the value you saw in the let

18:13 mmarczyk: plus there's a separate 'tail'

18:13 daniel__: I see.

18:14 mmarczyk: I believe normally conjing onto a vector shares most of the structure, but uses a longer tail

18:14 Chousuke: agents are asynchronous and uncoordinated so you can never be sure any value of the agent you have is the most current state, but... if you need that, you shouldn't be using agents :)

18:15 daniel__: I see. A ref would probably be a better fit for this snip of code.

18:16 Chousuke: possibly

18:16 daniel__: Also, Is this little bit of code idiomatic? I know there's not much there.

18:16 rhudson: daniel__: You don't need the "do"

18:16 daniel__: Oh reeeaallly.

18:16 mmarczyk: if you're doing a send, then an await straight away on just the one agent you've been sending sth to, then in isolation a Ref / Atom seems like a better choice

18:16 daniel__: Nice.

18:17 mmarczyk: but if there's some other reason to use an Agent... who knows

18:17 daniel__: That's what I was thinking, mmarczyk.

18:17 This code is for a presentation.

18:17 So, a ref will definitely make it more clear.

18:18 Chousuke: just make sure you don't do any printing in a transaction

18:18 daniel__: I just wanted to make sure that I was demonstrating shared data.

18:18 mmarczyk: you could start with a simple example with an Atom

18:18 Chousuke: transactions must be pure functions

18:18 daniel__: Right, transactions are retried. :)

18:18 err, can be.

18:18 Chousuke: daniel__: oh, that's easier to do without agents

18:18 mmarczyk: then expand that into a more elaborate example which requires coordination

18:18 and use Refs for that

18:19 daniel__: I did the producer consumer problem and used refs. :)

18:19 It's pretty awesome. I had 2500 threads in the JVM yesterday.

18:19 mmarczyk: that also allows you to postpone the discussion of dosync & Co. until after you discuss the basics of the unified update model :-)

18:19 Chousuke: just do: (let [a '(1 2 3) b (conj a 2)] (identical? a (rest b))) or something

18:20 daniel__: Oh hey, I didn't know you could do that..

18:20 That is, use a previously bound symbol in a let.

18:20 Chousuke: demonstrating structural sharing with vectors is probably trickier

18:21 daniel__: I mean, within the argument vector. [a 3 .... foo a] or whatever.

18:21 Chousuke: right, they're evaluated serially

18:21 rhudson: It's a very useful feature

18:22 Chousuke: there's even a recursive let in contrib :P

18:22 daniel__: Wowsers.

18:22 Chousuke: but it's black magics

18:22 daniel__: Yeah, I'm not quite ready for that. :)

18:22 Chousuke: uses an atom or something weird like that anyway

18:23 daniel__: I was really pumped when I got the producer/consumer problem working.

18:23 I have a funny feeling, though, that my code is ugly.

18:23 I'll come back and share it after I turn my work in.

18:24 Chousuke: hmm

18:24 (doc seque)

18:24 clojurebot: "([s] [n-or-q s]); Creates a queued seq on another (presumably lazy) seq s. The queued seq will produce a concrete seq in the background, and can get up to n items ahead of the consumer. n-or-q can be an integer n buffer size, or an instance of java.util.concurrent BlockingQueue. Note that reading from a seque can block if the reader gets ahead of the producer."

18:24 daniel__: Thanks for the help, everybody.

18:24 Chousuke: just use that on a blockingqueue and pass it to your consumer!

18:24 :)

18:25 daniel__: ...

18:25 Chousuke: nah, I guess it's not very concurrent though

18:25 chouser: that's for one thread on each side

18:26 daniel__: (doc seq)

18:26 clojurebot: "([coll]); Returns a seq on the collection. If the collection is empty, returns nil. (seq nil) returns nil. seq also works on Strings, native Java arrays (of reference types) and any objects that implement Iterable."

18:26 daniel__: Ok, while we're on the topic: What, exactly, is a seq?

18:26 Chousuke: a thing that supports first and rest

18:27 daniel__: When I see 'first' and 'rest' I think of a list.

18:27 (first '(1 2 3))

18:27 1

18:27 Chousuke: a list is the simplest kind of sequence

18:27 but a sequence is really anything that has a head and a tail

18:27 daniel__: So, a vector is a sequence too.

18:28 chouser: no

18:28 daniel__: I'm listening.

18:28 chouser: You can get a sequence on a vector, but a vector itself is not a sequence.

18:28 Chousuke: a vector is not a seq, but a sequence view of a vector can be made

18:28 chouser: ,(class (seq [1 2 3]))

18:28 clojurebot: clojure.lang.PersistentVector$ChunkedSeq

18:29 Chousuke: the practical reason a vector is not directly a seq is, I think, because they have different performance guarantees

18:29 once you get a seq view on a vector you're no longer allowed random access via that view.

18:30 the original vector is of course unaffected

18:32 daniel__: I see. By the way, chouser, I have "The Joy of Clojure". I'm assuming that's you on the cover. :)

18:32 I mean, your name. ;)

18:32 chouser: ha

18:32 fro0g: what would it take for 'add-classpath' to be non-deprecated?

18:32 mmarczyk: http://gist.github.com/378784

18:33 that's to demonstrate structural sharing in clojure.lang.PersistentVector instances

18:33 daniel__: I see it. :)

18:33 chouser: daniel__: thanks for both your patronage and your joke. :-)

18:34 daniel__: I can't wait to get more chapters...

18:34 rhudson: froOg: Probably some fundamental work on the JVM

18:34 daniel__: I have through chapter 4. Has there been an update? I haven't looked and I just got the book 2 weeks ago. (or so)

18:35 mmarczyk: Chousuke: there's a letrec in contrib??? wow, never noticed

18:35 chouser: yeah, there's some more on the MEAP site now.

18:35 mmarczyk: would you happen to remember where (and if it's called that :-))

18:35 chouser: dinner time. bbl.

18:35 daniel__: Great. Thanks everybody.

18:41 fro0g: rhudson: so probably shouldn't hold my breath :/

18:48 cheezey: is it possible to do say an include or something so i can split up my source files :X

18:49 zakwilson: cheezey: see require and use

18:55 cheezey: zakwilson: i think im being dumb but i dunno how to use it >_>

18:56 zakwilson: cheezey: not a shock. Clojure uses Java naming/path conventions, such that foo.bar.baz refers to the file foo/bar/baz.clj when used with require/use.

18:57 cheezey: you can also use (load pathname)

18:57 Though that's probably not considered the Right Thing.

18:59 rhudson: cheezey: One way to do it is to split your code into different files, and put a "ns" (namespace) form right at the top. Then you can use :require and :use clauses of the ns form to get the necessary cross-references.

18:59 [ right at the top => right at the top of each file ]

19:00 cheezey: like (ns blah ...)?

19:00 rhudson: yeah

19:02 cheezey: do the files have to have a certain extension..? O_o

19:03 rhudson: roughly (ns foo ...) in foo.clj; (ns bar (:use [foo])) ...) in bar.clj

19:03 I don't know "have to"; ".clj" is at least conventional

19:07 mmarczyk: only please don't use single-segment namespace names, they're not guaranteed not to break

19:07 (single-segment = no dot in the name)

19:08 rhudson: Agreed; "not guaranteed not to" is an understatement in my experience.

19:08 mmarczyk: :-)

19:09 cheezey: X_x

19:10 this is weird =\

19:13 rhudson: it's like "could not locate on classpath" .. how do i check whats in the classpath? (the two files are in the same folder..)

19:14 mefesto: cheezey: can you paste an example of what you're doing?

19:15 cheezey: not sure if i can paste it but it's just two files, each have many functions in them. i'd like to use one function in file1 from file2.

19:15 it seems like this would be very trivial :\

19:15 rhudson: (System/getProperty "java.class.path")

19:16 mefesto: file2 should have: (ns file2 (:use [file1]))

19:16 cheezey: rhudson: yeah, the files are listed in the output

19:17 mefesto: it does :X

19:17 mefesto: but i guess its more like (ns (:import ...) (:use ...)) is that fine?

19:18 mefesto: cheezey: http://pastie.org/934755

19:20 cheezey: mefesto: yep it doesnt work for me :\

19:21 mefesto: what error do you get?

19:21 cheezey: Caused by: java.io.FileNotFoundException: Could not locate file1__init.class or file1.clj on classpath:

19:22 mefesto: im assuming you did name the files: file1.clj and file2.clj right?

19:22 rhudson: And '.' is on your classpath?

19:25 cheezey: er sorry my internet is weird

19:25 um rhudson the folder is in the classpath

19:25 let me include . just to be safe ;X

19:25 yep. same problem >_>

19:26 mefesto: assuming you are in the same dir as the clj files then you should be able to run: java -cp /path/to/clojure.jar:. clojure.main file2.clj

19:28 cheezey: what OS are you running on?

19:28 cheezey: mefesto: that worked =o

19:28 mefesto: nice :)

19:29 cheezey: hm. it's still weird that it doesn't work with just clojure and etc

19:29 mefesto: im running ubuntu but i installed clojure from source

19:29 mefesto: just a classpath issue

19:30 cheezey: what do you have your classpath set to?

19:31 cheezey: just a sec, i may have been very dumb in something :O

19:32 mefesto: ya i was being dumb and setting the wrong variable :X

19:35 rhudson: cheezey: By the by, :import is for Java stuff; :require and :use for Clojure

19:36 e.g. (:import [java.io File FileReader])

19:38 mefesto: cheezey: np, i've been bitten by classpath weirdness many times :)

19:38 cheezey: thanks for the help =D

20:09 zakwilson_: Is there an easy way to get the index of the element of a lazy seq that causes an exception when evaluated?

20:13 cemerick: rhickey: pling

20:20 Seems like some subtle breakage in protocols' polymorphism: https://gist.github.com/780b7fe55a6358641bef

20:33 rhickey: cemerick: nope, no implementation inheritance

20:34 or rather, you get only one definition, not a mix of inherited and added. This is not Java

20:34 cemerick: OK -- so the default impl has rather less significance.

20:35 rhickey: cemerick: I don't see that

20:35 the default impl covers all types for which there is no impl

20:35 it's not about mixing

20:36 if you want mixins, use extend and method maps, you can do arbitrary reuse and composition

20:41 defn: could anyone explain the effect of placing a namespace in :namespaces [my.core] in my project.clj -- does that cause that NS to be AOT compiled?

20:50 cemerick: rhickey: OK, now I notice the usage of "evaluated" when discussing fn maps provided to extend

20:51 rhickey: cemerick: yes, it's quite cool, true implementation composition, and great speed too

20:52 cemerick: rhickey: indeed. Expect that to be a FAQ, though. :-)

20:53 i.e. why dispatch doesn't trickle back to Object, or other superclasses

20:54 rhickey: cemerick: ok, but I don't see where it implies it would

20:54 protocols are not inheritance based

21:07 _ato: If you implement a protocol on an interface then it applies to all classes that implement that interface -- and to create a default implementatino you extend Object -- that sounds similar to inheritance. If you're used to java class style inheritance, it's easy to jump to the conclusion that the same applies for individual methods.

21:08 I agree that it will become a FAQ but that's going to inevitable with a lot of things in datatypes and protocols. People are going to assume it's the same old system and get confused when it doesn't behave how they expect

21:17 rhickey: _ato: I don't disagree, there will be a lot of work in helping people retreat from mistaken conclusions

21:22 rhudson: Is it possible to have a function that returns the extend map, say (extension AType AProtocol) ?

21:23 rhickey: rhudson: there isn't yet, would only work for explicit extensions

21:24 rhudson: it would probably be better for code that wanted to share impls to publish them explicitly, as code that 'hijacks' them is subject to breakage should someone move the impl inline

21:24 livingston: if I have this: (defmulti ag-ify type) what do I put as the third symbol after these (defmethod ag-ify <something-here> in order to dispatch on clojure symbols

21:25 rhickey: ,(type 'asymbol)

21:25 clojurebot: clojure.lang.Symbol

21:26 livingston: I tried just Symbol (it works with just String) but for clojure types I have to fully qualify it?

21:26 rhickey: livingston: yes, or import

21:26 livingston: ok fair enough

21:26 thanks

21:27 rhudson: livingston: was it you asking about unification algorithms earlier?

21:27 livingston: rhudson: yes

21:28 rhudson: I got curious, dug around & came across this: http://www.doc.ic.ac.uk/~sgc/teaching/v231/lecture8.ppt

21:29 livingston: *looking

21:29 rhudson: Found several discussions of the same algorithm, but this was the most thorough explanation

21:31 Unification discussion starts around slide 16

21:32 livingston: ok, yeah, that's basically what I have from porting Norvig's unify algorithm

21:32 wooby: livingston, the one from PAIP? i'm working on that also

21:33 livingston: my new problem is effecinetly finding out if one set of statements entails the other - so it's kinda like unifing sets (the problem in the standard unifier order matters)

21:34 wooby: yes, I have it working, you can have it

21:34 wooby: cool, i'd like to check it out

21:35 mmarczyk: linvingston: funnily enough I'm interested in unification from a logical / algebraic standpoint :-)

21:35 livingston: i should put this up on github but I don't have an account set up (how long does that take? should I send it some other temporary way first?

21:36 mmarczyk: nah, a second

21:36 wooby: livingston, instant & worthwhile to set up

21:36 livingston: ok wooby, I'll have that set up and shared by the end of the hour

21:37 wooby: really cool, looking forward to it

21:37 mmarczyk: ditto :-)

21:37 wooby: out of curiousity, have you experimented at all with paralell unification

21:37 and-parallel or otherwise?

21:37 rhudson: livingston, have you looked at stuff in the RDF/OWL/SPARQL arena?

21:39 livingston: my slightly larger new problem is if I have patterns like (?e isa Event) (?e doneBy ?a) (?a isa Agent) I need them to match this: (?b doneIntentiallyBy Bob) (?b isa Bombing) where it's know that Bob is an Agent and bombings are types of events and the one predicate is more specific than the other

21:40 rhudson: I was contemplating shoving all that into a SWRL rule engine to match it

21:40 it'll require a lot of reification (in the RDF sense, not Clojure) though

21:42 wooby: I don't know how you would parallelize that algorithm? since bindings need to grow and persist through it

21:44 wooby: hm true, perhaps only the simpler pattern matching forms can be parallelized

21:46 livingston: rhudson: do you have any experience with RDF/OWL/etc.? especially from Java or Clojure?

21:47 rhudson: It's been a few years; mostly in Java (and Jython, my JVM lang of choice at the time)

21:47 livingston: have you worked with any of the rule engines?

21:48 rhudson: I'm really fuzzy on the details, but my sense is you could express your problem & the rules & crank through it relatively efficiently.

21:48 livingston: i've got Jena and AllegroGraph and Clojure mostly playing fair with each other

21:48 rhudson: * trying to remember what engine I used

21:49 livingston: rhudson: it should be expressible with SWRL and then forward-chained through a rete engine, but I don't know how effecent that will be with the mountains of rules it will need.

21:50 rhudson: It was the Jena stuff. This is 4-5 years back so I imagine the landscape has changed.

21:50 -- Couldn't find anyone to hire me to do more RDF!

21:51 livingston: yeah, I'm sure it has. you might have more luck now.

21:54 what's the thing on github that's like pastie or whatever, where I can just throw something up quick?

21:55 found it - gist

21:57 _ato: put something ending in ".clj" in the "name this file..." box and it'll syntax highlight for clojure

21:57 ah.. it's got a dropdown now

21:57 that's nice :)

21:58 livingston: yeah I just found that too, actually I picked clojure, but then put in a file name that didn't end in clj (it didn't end in anything really - it was the ns name) and it said auto-detecting and overided my dropdown selection

21:59 _ato: ah, that must be why I never noticed the dropdown, I use gist.el to submit from emacs so I never see it without someting in the filename box ;-)

21:59 livingston: after I make one I can just copy the URL at the top right? w/out giving away anything person, right?

21:59 _ato: oooh I should get that

22:00 _ato: yeah, you can just copy the url of the gist: http://gist.github.com/377629 or an individual revision like https://gist.github.com/377629/f3d891782d256f85b832d7fed27cf6d8ce7808df

22:00 livingston: wooby: here it is http://gist.github.com/378900 I'll make a real repo of all the code that will end up in that package eventually

22:01 _ato: gist.el: http://github.com/defunkt/gist.el

22:01 livingston: I would have had it up sooner if there weren't some highschool kids yammer about inane crap behind me - shut up! breath! something... I can't hear myself think

22:02 wooby: livingston, great, thanks

22:03 livingston: wooby: documentation is obviously light, it should work with lists or vectors and treat them the same

22:05 wooby: livingston, http://gist.github.com/378750 my progress on pattern match and a factdb if you're interested

22:05 looking forward to hacking more on this, thanks sharing and have a good evening livingston

22:06 livingston: cool, yeah I'm going to need too much stuff to have it in memory, so I'll be connecting to some big triple stores

22:06 let me know if you run into any trouble or bugs

22:07 wooby: will do, thanks

22:08 mmarczyk: wooby: cool prolog impl :-)

22:09 rhudson: livingston, I'm curious how you wired Clojure & Jena together

22:11 wooby: mmarczyk, thanks ! research continues :)

22:11 mmarczyk: :-)

22:13 dmiles_afk: Jena and CLojure togehter?

22:14 i am wiring togher LarKC+ABCL+PrologCafe

22:15 but Clojuire is on the hitlist

22:15 livingston: it's mostly a hack right now but I'm spinning it up

22:15 dmiles_afk: are you hitting jena api via reflection?

22:16 well as far a what clojure hits things with .. i guess its a step or two better than reflection

22:16 livingston: I'm using symbols as the native representation of URI on the clojure side

22:17 dmiles_afk: thats what i like to hear

22:17 the merging of object models.. thats the mst important part... way less thunking

22:18 less re-representation if they start sharing an innerloop (they calling each otehr frame by frame)

22:18 livingston: mostly I'm setting of a proxy layer to wrap Jena - the Jena objects and structures are a big pile of obnoxious classes because in java you can't just do '(clojure isa langague)

22:19 dmiles_afk: i am thinking sometime we (yu and I) are going to need a alias in source refernces

22:19 livingston: they won't be that tight, but it's a start - really there should be a clojure API that's the Clojure equivalent of Jena, but I'm doing what I gotta do for now

22:20 dmiles_afk: or does "langague" in clojure actually holds a URI in a new field?

22:20 livingston: maybe that was a bad exmaple but the point is RDF tripples are just a list of 3 symbols

22:21 dmiles_afk: i kind of get it

22:21 livingston: since there's all kinds of support in a langague like clojure or lisp for lists of symbols you should just use the native stuff

22:21 dmiles_afk: are you changing clojres impl a bit?

22:21 rhudson: That's what I was particularly interested in -- there's kind of an impedance mismatch between the obvious way to represent a triple in Clojure & what you have to do in Java.

22:22 dmiles_afk: and/or Jena?

22:22 livingston: not create an Object that is of type Reference that holds a URI ... ugh

22:22 rhudson: exactly

22:22 if you look at Franz's lisp API for their AllegroGraph server it's a lot more like what we would want than Jena

22:23 dmiles_afk: yeah

22:23 livingston: although one nice thing is if it's Jena that's wrapped, then it should be fairly portable across servers

22:24 dmiles_afk: i always start attecking their impls.. and try to unify their obkject model.. when sometimes really waht i want is just Jena tripple store quickly access.. and query very fast

22:25 but for sure if i decend into the parts of the trimple.. i dont want to spend time remodeling the numbers into my programming language (like clojure)

22:25 triple*

22:25 (if the triple contains a number i it as an example)

22:26 (if the triple contains a number in it as an example)

22:26 but if jena uses java.lang.Integer ... then i guess clojure is all happy

22:27 but if its a RDFNumber.. thats the pain

22:27 livingston: some triple stores use name types, some turn everything into strings

22:28 dmiles_afk: i guess that is just the way some stores are.. and not too bad i guess if that is the case

22:29 livingston: depends - can't do numerical range queries then

22:29 I gotta run ....

22:29 they are re-arranging the furniture in the coffee shop under me as I type...

22:29 dmiles_afk: :)

22:29 livingston: I'll be on either later or tomorrow

22:30 dmiles_afk: sounds good.. its a fun topic

22:30 rhudson: see ya

22:36 sattvik: /quit

22:48 slyphon: anyone know why i'd be gettting: No matching method found: invoke for class java.lang.reflect.Method

22:48 i mean, it's obviously defined...

22:49 cp2: wrong signature/arity ?

22:49 slyphon: hmm

22:50 cp2: how are you calling it

22:50 slyphon: (. method (invoke obj (long 10000) nil))

22:50 hiredman: hint method

22:51 (. #^java.lang.reflect.Method method (invoke obj (long 10000) nil))

22:51 slyphon: ah

22:51 * slyphon tries that

22:51 slyphon: same thing

22:52 mefesto: just guessing: (. method invoke obj (long 10000) nil)

22:52 slyphon: the syntax is supposed to be equiv.

22:52 hiredman: well, as long as we are changing it up

22:52 mefesto: invoke is a method on a Method obj

22:52 hiredman: (.invoke method obj (long 10000) nil)

22:52 slyphon: mefesto: yeah, that didn't work

22:53 the method is MessageProducer.setTimeToLive(long)

22:53 in javax.jms

22:53 mefesto: leave out the nil?

22:53 slyphon: um

22:53 * slyphon tries

22:53 hiredman: have you looded at the javadocs for invoke on Method?

22:53 mefesto: (.invoke method obj (long 10000))

22:53 hiredman: it takes an object then varargs

22:53 looked

22:54 slyphon: mefesto: nah, invoke is a variadic

22:54 mefesto: ugh :)

22:54 slyphon: hiredman: yeah

22:54 hiredman: that's what obj is, an instance of MessageProducer

22:54 hiredman: and you know that varargs in java are just sugar over passing an array

22:54 slyphon: no, i did not know that

22:55 hiredman: now you know, and knowing is half the battle

22:55 slyphon: :)

22:55 GI JOE!

22:55 * slyphon sings

22:55 mefesto: lol

22:57 slyphon: oh fun

22:57 (. #^java.lang.reflect.Method (*ttl* :method) invoke user/*p* (into-array Object [(long 10000) nil]))

22:57 Class mbox.harpo.utils$eval__9138 can not access a member of class com.atomikos.jms.AtomikosJmsMessageProducerProxy with modifiers "public"

22:58 IllegalAccessException

22:58 so, i can't access a public method?

22:58 hiredman: are you familiar with the reflection stuff in contrib?

22:58 slyphon: not really :/

22:58 where is it?

22:58 mefesto: totally necessary to call it through Method?

22:58 slyphon: mefesto: well, i'm trying to dynamically set bean properties

22:59 so i can say (update-bean obj {:ttl 80})

22:59 and it'll DTRT

22:59 hiredman: slyphon: http://richhickey.github.com/clojure-contrib/reflect-api.html

22:59 (it was better when it was called wallhack)

23:00 mefesto: (.invoke method obj (into-array [(long 10000)]))

23:00 mmarczyk: slyphon: hi

23:00 slyphon: i think it still is in my version

23:00 mmarczyk: hai!

23:00 mmarczyk: update-bean not cutting it for you? :-)

23:00 slyphon: mmarczyk: i'm trying reflection

23:00 hahaha

23:01 uberjar: would someone please port this project to clojure for me ? http://common-lisp.net/project/parenscript/ thnx

23:01 sexpbot: "Parenscript"

23:01 hiredman: clojurebot: scriptjure?

23:01 clojurebot: Excuse me?

23:01 hiredman: clojurebot: google scriptjure

23:01 clojurebot: First, out of 47 results is:

23:01 arohner&#39;s scriptjure at master - GitHub

23:01 http://github.com/arohner/scriptjure

23:02 uberjar: uh wow that's awesome

23:03 slyphon: hiredman: so params in wall-hack-method is [java.lang.Long] ?

23:04 not the actual value?

23:04 hiredman: uh, it's been a long time

23:04 slyphon: since i rock and roll

23:04 * slyphon headbangs

23:04 hiredman: that sounds right

23:05 slyphon: bingo

23:05 wow, that's gonna be a pain in the balls

23:05 hiredman: ,(vec (map class '[(long 1) nil]))

23:05 clojurebot: [clojure.lang.PersistentList nil]

23:05 hiredman: grrr

23:05 ,(vec (map class [(long 1) nil]))

23:05 clojurebot: [java.lang.Long nil]

23:06 slyphon: i think it's actually java.lang.Long/TYPE in this case

23:06 unless java does auto-unboxing

23:06 which i can't remember if it does

23:06 hiredman: anyway, it's totally doable

23:06 slyphon: yeah, right on

23:07 (java-utils/wall-hack-method (class user/*p*) :setTimeToLive [java.lang.Long/TYPE] user/*p* 10000)

23:07 that just worked

23:07 mmarczyk: :-)

23:08 * hiredman wrote wall-hack-method

23:09 * slyphon tips his hat to hiredman

23:09 mmarczyk: kudos for the cool name :-)

23:10 in addition to the function itself

23:10 hiredman: it was cool, but it got changed a month or so ago

23:10 mmarczyk: yup, so I see

23:10 in fact, so many cool names are getting ditched

23:11 duck-streams

23:11 I'm not sure if incanter.chrono, after becoming a separate project, wasn't renamed to clj-time

23:12 hope I was dreaming it (a nightmarish dream, that) ...?

23:12 what's up with this, I mean, duck-streams is soooo obviously a superior name to io, even if io makes more sense

23:12 and wall-hack & chrono actually do make perfect sense

23:12 * mmarczyk is done ranting

23:12 mmarczyk: ah.

23:14 slyphon: "wall" is "write all" right?

23:15 cp2: slyphon: no

23:15 slyphon: it's what you beat your head against until you find "wall-hack-method"?

23:15 cp2: do you know what a wall hack is in regards to an fps/whatever?

23:15 slyphon: ohhhh

23:15 cp2: seeing enemies through walls and objects

23:16 slyphon: right

23:16 gotcha

23:16 cp2: sort of like that but with access flags =P

23:16 slyphon: hahaha

23:20 mefesto: slyphon: is this basically the same thing? http://pastie.org/934940

23:21 I'm still learning clojure so I'm curious what the difference is between that and the helper func

23:21 slyphon: yeah, seems like it

23:21 well, i'm calling a method on some third-party API

23:21 and they're not being nice about it

23:23 remleduff: Given two functions, f and g, and something seq-like: [1 2 3], what's the best way to make {(f 1) (g1), (f 2) (g 2), (f 3) (g 3)}?

23:25 hiredman: ,(into {} (map (juxt inc dec) [1 2 3]))

23:25 clojurebot: {2 0, 3 1, 4 2}

23:26 remleduff: Thank you, was just fumbling my way towards that :)

23:26 hiredman: ,(reduce #(assoc % (inc %2) (dec %2)) {} [1 2 3])

23:26 clojurebot: {4 2, 3 1, 2 0}

23:27 mefesto: wow juxt is some pimp stuff

23:29 slyphon: holyshititjustworked

23:29 hiredman: thank you!

23:29 * slyphon posts the new versio

23:29 slyphon: n

23:34 hiredman: http://github.com/slyphon/sly-utils/blob/master/src/com/slyphon/utils/update_bean.clj

23:37 * slyphon might have been able to use partial there

23:38 mmarczyk: slyphon: have you tested the version of update-bean on the other branch, by the way?

23:38 slyphon: mmarczyk: hrm

23:38 * slyphon tries

Logging service provided by n01se.net