#clojure logs

2010-04-25

00:00gstamphrrm. the doc for 1.1 seems to suggest (require clojure.contrib.seq-utils) but I'm getting a not found error
00:02mmarczykyou're missing a quote
00:02mmarczyk,(require 'clojure.contrib.seq-utils)
00:02clojurebotnil
00:02mmarczyk,(clojure.contrib.seq-utils/partition-all 2 [1 2 3 4 5])
00:02clojurebot((1 2) (3 4) (5))
00:03gstampgot it going. Thanks very much
01:13reburgsay 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?
01:18reburgfrom experimentation, it looks like the root binding, but i'm wondering if the actual answer is undefined for some reason
01:25_atoreburg: the agent runs bar in a different thread, since bindings are thread-local it will indeed see the root binding
01:25_atoit's not undefined
01:25carkherr
01:25carkh,(doc bound-fn*)
01:25clojurebot"([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."
01:26_atooops, missed the mention of bound-fn
01:26carkhreburg: must be some timing error in your code
01:27mefestothis seems to work: http://pastie.org/933742
01:28mefestothe function returned from bound-fn* will see x as 10
01:29carkhclojure makes it easier to reason about multithreaded code, but it's still pretty darn hairy =P
01:43reburgcarkh: the discrepancy is that you are using the bound-fn as the agent message. i'm not.
01:43reburgthe agent is being sent the message within the bound-fn
01:44mefestoreburg: could you paste an example?
01:47carkhreburg: well you want to capture the dynamic environement at the moment you're sending that message
01:47carkhand the example was not mine =P
01:50reburghttp://paste.lisp.org/+23UU
01:51reburgis 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?
01:51mefestoin the end the increment function is executed on a different thread and the binding you've done is not active there
01:51mefestoafaik, always a different thread in a thread pool
01:51carkhreburg: yes always on a different thread
01:52mefestonot the _main_ thread
01:52carkhactually it could be the smae, but the bindings would be different
01:52reburgok, i guess that's really what i wasn't sure of
01:52carkhso for all purposes you can think of it as a different thread
03:19mitkokHey, guys. From where I can get swank-clojure jar, cause I think the download through elpa is corrupted
03:49remleduffhttp://repo.technomancy.us/swank-clojure-1.1.0.jar
03:52RaynesI don't think the ELPA version is corrupt though.
03:54mitkokremleduff: thanks
03:56mitkokRaynes: the ELPA version may be not corrupted, but I think the download process may corrupted the jar file.
03:58remleduffI get swank-clojure through lein deps, didn't realize it was actually possible to get it through elpa
04:18mudphone_is there some way to delete a jar I pushed to clojars.org?
04:20_atomudphone_: hadoop, zookeeper etc?
04:20_atoI'll delete 'em
04:20mudphone_yeah, the hadoop/hadoop, hbase/hbase, and zookeeper/zookeepers
04:21mudphone_I didn't put them in my group, sorry about that
04:21mudphone_and thanks for doing that for me
04:21mudphone_there's also an hbase-0.20.3 that I created by mistake
04:23mudphone__ato: thanks
04:23mudphone_seems like the :exclusions feature of lein is not working
04:24_atoit definitely works sometimes, maybe not in all cases though
04:24mudphone_i was trying out the log4j example, that I happen to need, and it doesn't seem to work for me
04:24mudphone_not a big deal in the short term
04:25mudphone_just wondering
07:37naeucan someone explain why: (seq? [1 2 3]) ;=> false
07:51esjbecause [ . . . ] is a literal vector
07:51esj,(vector [1 2 3])
07:51clojurebot[[1 2 3]]
07:51esj,(vector? [1 2 3])
07:51clojurebottrue
07:51esjif you want to seq over it (seq [1 2 3) will hand you a seq over the vector, which is a concrete class
07:56esjnaeu: 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.
07:57naeuesj: so why does (seq? '()) ;=> true?
07:57esjnaeu: i think, and i'm up for correction here, that '() is a literal list which implements exactly the same interface as a seq
07:58esjnaeu: but that's pretty much a guess
07:58naeu:-)
07:58naeuI was just trying to get my head around the threading macros -> ->>
07:58esjoh yeah, those are fun
07:58naeuso was reading the source in core.clj
07:58carkh,(instance? clojure.lang.ISeq '())
07:58clojurebottrue
07:58carkh,(instance? clojure.lang.ISeq '[])
07:58clojurebotfalse
07:59carkh,(instance? clojure.lang.ISeq [])
07:59clojurebotfalse
07:59carkh,(instance? clojure.lang.ISeq (seq []))
07:59clojurebotfalse
07:59carkh,(instance? clojure.lang.ISeq nil)
07:59clojurebotfalse
07:59carkh,(instance? clojure.lang.ISeq (seq [1 2 3]))
07:59clojurebottrue
08:00carkhanyways =)
08:00naeu:-)
08:00naeuhas anyone had a look at the source for ->>
08:00carkh~def ->>
08:01esjno, i just know it as -> where it threads on the last argument, rather than the first
08:01naeu i was just wondering about the central part of the implementation
08:01naeuparticularly: (with-meta `(~(first form) ~x ~@(next form)) (meta form))
08:02naeuoops, that's for ->
08:02naeuI mean: (with-meta `(~(first form) ~@(next form) ~x) (meta form))
08:02naeuI'm wondering why it's not: (with-meta `(~@form ~x) (meta form))
08:03_atoprobably because it was copy-pasted from ->
08:03naeuand also, the following line: (list form x))), why doesn't that try and preserve form's metadata?
08:03_atoit does preserve it
08:03_atoit just passes the form object through
08:03naeuaaah
08:03_atoso it reatins its metadata
08:03naeuok
08:03naeu:-)
08:05naeuI thought it might be due to copy/paste or to try and keep the implementation as similar as ->
08:09kzarCan you use wildcards in Enlive selectors? I'm trying to select a few different class names that are similar
08:17_atokzar: I don't think so, but you can write your own predicate
08:17_atohttp://enlive.cgrand.net/syntax.html
08:17sexpbot"selectors syntax"
08:18kzar_ato: Yea I've been reading that page actually but to be honest I'm not sure what predicates are
08:19_atoI *think* you can just use something like this as a selector: (pred #(str/starts-with? (:tag %) "foo-"))
08:20_ato(you could of course name that lamba for greater readability)
08:20_atohaven't tried it though
08:20kzaroh I get the idea now
08:20kzarthanks _ato :D
09:42kzar_ato: Hmm can you think why having a re-find inside the pred function would cause a Null pointer exception?
09:44_atohmm
09:45_ato,(re-find #"foo" nil)
09:45clojurebotjava.lang.NullPointerException
09:45_atokzar: whatever you're matching against doesn't exist on the node?
09:46_atomaybe try: (re-find #"foo" (or ... ""))
10:01kzar_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:01hamzais 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:09nurvHi.
10:23cYmenWhich build tool would you guys recommend I learn for clojure? Does anybody have a link to a nice tutorial?
10:26nurvcYmen: http://github.com/technomancy/leiningen
11:56djpowellshould I expect building contrib head with maven to work?
11:56djpowelli get lots of test failures
12:04iwillighi, 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:05iwilliganyone got any pointers ?
12:13cp2yikes, lag
12:13cp2anyway
12:13cp2iwillig: (defn foo-dispatch [arg & _] (class arg))
12:13cp2(defmulti foo foo-dispatch)
12:13cp2(defmethod foo String [s & _] (println "my arg was a string"))
12:13cp2and so on
12:14Raynesiwillig: 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:14cp2note the & _ depends on what you want
12:14cp2mhm
12:26iwilliggot it, thanks cp2 Raynes
12:35remleduffiwillig: 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:35AWizzArdtechnomancy: Hi. Do you know about ‘M-x delete-trailing-whitespace’?
12:36AWizzArdIt’s a very useful command. But in Clojure files it also deletes trailing commas, as those are seen as whitespace too (:
12:40joshua-choiI am reading a recent essay by Chouser on binding: http://blog.n01se.net/?p=134.
12:40sexpbot"Using binding to mock out even “direct linked” functions in Clojure « searching for signal"
12:41joshua-choiI'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:41joshua-choiIs this a new feature in Clojure 1.1?
12:47djpowelli thought direct binding was a 1.2 feature?
12:47djpowelldunno
12:47joshua-choidjpowell: How does direct linking work?
12:48joshua-choiThe impression I got from Chouser's essay is that it's some sort of prevention of var binding for performance
12:48joshua-choiBut I can't find any other information on direct linking with Google
12:49djpowelli think it avoids the var name lookup indirection somehow
12:49djpowelli'm not sure what the state of it is - i think it is a bit experimental
12:49cYmenhmhmhm
12:49djpowelli think it is needing some more control over what is done directly?
12:49remleduffI didn't think direct binding was in 1.1
12:50joshua-choiChouser's essay says so
12:50joshua-choiAs for control, it also mentions a :dynamic key in vars' metadata to turn this on or off
12:50cYmencan anybody recommend a leiningen tutorial?
12:50joshua-choiOther than that, I have no clue
12:52joshua-choicYmen: For using others' libraries or for adding Leiningen to your own?
12:53remleduffhttp://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:53cYmenjoshua-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:54cgrand_brian2_: selector is gone, youdon't need it anymore
12:55dnolen_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_brian2_?
12:56joshua-choicYmen: I used http://wiki.github.com/ato/clojars-web/tutorial, which is Clojars' tutorial.
12:56cgrandevery (selector x) becomes x
12:56cgrand_brian2_: ^^
12:56joshua-choicYem: 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:56dnolen_brian2_: changes pushed.
12:57_brian2_dnolen: thanks!
12:57joshua-choiremleduff: 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:59dnolen_brian2_: oh one sec while I fix that too.
12:59cYmenjoshua-choi: I'll check it out.
12:59cYmenjoshua-choi: Thanks!
12:59joshua-choiNo probem.
13:00dnolencgrand: 1.0.0-SNAPSHOT on clojars is the current one right?
13:00remleduffjoshuah-choi: Not really that I know of, there's an assembla issue about deciding what knobs it needs
13:00joshua-choiOh good, I'll go look for that.
13:00cYmenDoes anybody know how to start the nailgun server from the mercurial checkout of vimclojure?
13:01cYmenThis 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:02dnolenchange that as well yes
13:02dnolenchanging i mean
13:02_brian2_thanks
13:02Licenserhmm I jst read about the annotations. Am I mistaken or are they like metadata just in java?
13:03Licenserjoshua-choi: that isn't an answer :P
13:03LicenserI am very glad that I got tacos too but it doesn't change anything ;)
13:03joshua-choiNo, it isn't an answer. :)
13:03stuarthallowayLicenser: they are ugly metadata that Java canread
13:03Licenser:P evil person
13:03Licenserokay then I understood it correctly
13:03stuarthallowaythey are easy to write from Clojure
13:04stuarthallowaybut you shouldn't use them for design, only interop
13:04Licenserwouldn'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:05cYmenman gradle is so slow it might as well be in flash
13:05LicenserI 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:07cgranddnolen: yes, 1.0.0-SNAPSHOT is the current one
13:07remleduffOne 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:08dnolencgrand: thx
13:08stuarthallowayremleduff: clojure's version just creates java annotations
13:08stuarthallowayso it can be easier to use but can't do anything that would be impossible...
13:09dnolen_brian2_: should be fixed now
13:12remleduffstuarthalloway: 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:13AWizzArdstuarthalloway: 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:13stuarthallowayremleduff: yes, that is cool. The power is more in dynamic compilation than in annotation support per se, but good point anyway
13:14stuarthallowayAWizzArd: do you mean sql really? That's Steve Gilardi's
13:16remleduffstuarthalloway: 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:16AWizzArdstuarthalloway: okay, thanks for this info!
13:17stuarthalloway"my repl" meaning "labrepl"?
13:17remleduffstuarthalloway: No, any repl that uses clojure.main/repl
13:18remleduffDo java -cp clojure.jar clojure.main and then type that proxy form in and it will crash to the command line
13:18stuarthallowayremleduff: can you make a ticket for that on the clojure assembla?
13:18AWizzArd~seen technomancy
13:18clojurebottechnomancy was last seen joining #clojure, 101 minutes ago
13:18mmarczykshouldn't equals return a Boolean?
13:19remleduffI actually have a fix, but I haven't sent a CA in, and was having troubles writing a unit test
13:19mmarczykah, sorry, misunderstood -- certainly it shouldn't crash the repl
13:21remleduffmmarczyk: 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:22mmarczykright
13:24cYmenany idea where I could ask gradle questions?
13:31remleduff$ticket 317
13:31sexpbotCommand not found. No entiendo lo que estás diciendo.
13:31rhudsoncYmen: try #groovy
13:31remleduff,ticket 317
13:31clojurebotjava.lang.Exception: Unable to resolve symbol: ticket in this context
13:31hiredmanclojurebot: ticket #317
13:31clojurebot{: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:33stuarthallowayremleduff: thanks for the ticket
13:34stuarthalloway... and a patch with no test is better than not patch at all, so send that CA in sometime :-)
13:39cYmenjoin #groovy
13:39cYmengna :)
13:41rhudsoncYmen: http://www.gradle.org/community.html
13:41sexpbot"Gradle - The Gradle Community"
13:43RaynesGradle... MY EYES!
13:46LauJensenEvening gents
13:46BorkdudeEvening, Lau
13:48cYmenBonsoir
13:48Licenseraloa
13:51cYmenMan I wish kotarak would show up here sometime.
13:52LauJensen~seen kotarak
13:52clojurebotkotarak was last seen quiting IRC, 4075 minutes ago
13:52cYmenI want to bug him about vimclojure.
13:52LauJensenHe 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:54cYmenI hold little hope. :)
13:58cYmenwoohoo it works
13:59cYmenI need to write down what I did lest I be stuck again tomorrow.
14:45cYmenLauJensen: What does atom do?
14:45cYmen(Just reading your post on the ikeda function)
14:46LauJensenit creates a reference of the type 'atom', ie something which is mutable but governed by certain semantics
14:46LauJensen,(doc atom)
14:46clojurebot"([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:46LauJensen,(let [x (atom 5)] (swap! x inc) @x)
14:46clojurebot6
14:47cYmenWell, I looked at the docs but explaining "atom" in terms of "Atom" isn't very helpful to me.
14:48cYmenYour example makes it look like it's a variable in the imperative sense..
14:50LauJensenIndeed it is
14:51LauJensenreferences 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:53cYmenThat explanation of atom vs ref needs examples. :)
14:54livingstondon'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:54livingston e.g. ((bob fatherOf alice) (bob fatherOf mary)) unifies with ((?x
14:54livingston fatherOf ?y) (?x fatherOf alice)) => ?x : bob, ?y : mary
14:56LauJensencYmen: 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:59cYmenLauJensen: OK, thanks.
15:00LauJensennp
15:03remleduffDoes "coordinated changes" mean coordination between threads or coordination between potentially multiple different reference objects?
15:04livingstonmore or less, everything you change in a transaction happens at a single moment in percieved time to all the threads
15:45AWizzArdHow can I make the Emacs-Starter-Kit downloading the freshest versions of clojure-mode, swank-clojure, slime, clojure and contrib?
15:58LauJensenAWizzArd: Just looking at the source, it doesn't look like the starter-kit itself has any fn for downloading Clojure
15:59AWizzArdLauJensen: right, this seems to be done via swank-clojure
16:00AWizzArdAnd from that source it seems to look up things in .clojure, and it has hardcoded some snapshots from build.clojure.org
16:01LauJensenhttp://github.com/technomancy/swank-clojure/blob/master/swank-clojure.el#L119
16:10cYmenWhy does labrepl come with a webserver?
16:11Chousukeprobably for ease of setup
16:12yuno1Labrepl is an environment for exploring the Clojure language. It includes:
16:12cYmenBut it doesn't seem to actually do anything with that webserver, they might as well use static html.
16:12yuno1a web application that presents a set of lab exercises with step-by-step instructions
16:16yuno1maybe they used a web server so they could define the HTML in clojure
16:25mmarczykI wonder if print & Co. should use pr & Co. when recurring inside nested forms
16:25mmarczyk,(print-str {"ab" "ra, ca da"
16:25clojurebotEOF while reading
16:25mmarczyk "bra" "!"})
16:26mmarczyk,(print-str {"ab" "ra, ca da" "bra "!"})
16:26clojurebotEOF while reading string
16:26mmarczyk,(print-str {"ab" "ra, ca da" "bra" "!"})
16:26clojurebot"{ab ra, ca da, bra !}"
16:26mmarczyk(ouch)
16:27chouserwhy wouldn't you use prn-str, if that's the behaviour you want?
16:28mmarczyk,(pr-str {"ab" "ra, ca da" "bra" "!"})
16:28clojurebot"{\"ab\" \"ra, ca da\", \"bra\" \"!\"}"
16:29mmarczykchouser: well, I can't remember ever wanting to print nested strings without the quotes
16:29mmarczykbut you're right, the other option is always there
16:30mmarczykI wonder though, do pr-str and print-str only differ on string inputs?
16:34Licenser,(Integer. 1)
16:34clojurebot1
16:34cemerickThe first arg of protocol method impl fns should be auto-hinted, yes?
16:36rhudson,*clojure-version*
16:36clojurebot{:interim true, :major 1, :minor 1, :incremental 0, :qualifier "master"}
16:37cYmenIs there a convention for naming variables that should have the same name as an internal? Like "list" would be a common variable name..
16:38cemerickcYmen: perfectly fine to use the built-in name as a binding name, IMO.
16:38Chousukefor short functions, anyway
16:39Chousukethough I think alist, aseq, coll, items, <noun>s, are all good, depending on what the list actually is
16:39cYmenhmhm
16:41zakwilsonI 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:43livingstonzakwilson: group (and therefor register your "unregistered" nick) to your account
16:44zakwilsonlivingston: thanks.
16:47livingstonzakwilson: 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:48zakwilsonchouser: 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:49zakwilsonlivingston: I haven't had issues on other channels, and the message ("cannot change nickname while banned on channel") is confusing.
16:54chouserzakwilson: ... :message) will return a zip loc, which is essentially the whole tree with a pointer to the current node.
16:55chousercall clojure.zip/node on a loc to get an xml node
16:56zakwilsonchouser: thanks. I didn't quite get how the data structure works, and every example I saw called text.
16:58chouseryeah, my "docs" there are pretty weak.
16:58chousersorry.
17:00zakwilsonchouser: you make up for it by answering my newb questions on IRC.
17:01TcepsaIs 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:01zakwilsonI'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:02zakwilsonTcepsa: I had exactly that problem a few days ago. I ended up using subs.
17:02ordnungswidrigTcepsa: ,(name :keyword)
17:02ordnungswidrig,(name :keyword)
17:02clojurebot"keyword"
17:02ordnungswidrigthe , was only for clojurebot
17:02Tcepsaondnungswidrig: Excellent, thank you!
17:03Tcepsazakwilson: Thanks to you too--and now you know another way as well ^_^
17:42cYmenlabrepl still omits a lot.
17:42cYmenwhat does the :as mean here:
17:42cYmen [k & ks :as keys] (seq keys)
17:42cYmen(in a let)
17:45rhudsonIt means keys is bound to the whole seq
17:45cYmenas opposed to?
17:46LauJensenas opposed to just getting the keys
17:46rhudsonif the binding were just [k & ks] (seq keys), you wouldn't have a way to refer to the whole value
17:47cYmenthe whole value of what?
17:47rhudson(seq keys)
17:47cYmenoh, so keys is just an additional shortcut for (k.ks)?
17:48rhudsonBasically, yeah
17:49cYmenhttp://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:49remleduff,(let [a & b :as keys] (seq [1 2 3 4 5 6 78]))
17:49clojurebotjava.lang.IllegalArgumentException: let requires an even number of forms in binding vector
17:50remleduff,(let [[a & b :as keys] (seq [1 2 3 4 5 6 78])] [a b keys])
17:50clojurebot[1 (2 3 4 5 6 78) (1 2 3 4 5 6 78)]
17:53rhudsonIn 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:54rhudsonI agree in that in the case you reference, the algorithm could be tightened up
17:54foobar_dantest?
17:54clojurebotthe answer is 42
17:54rhudson:)
17:54foobar_danMicrophone check.
17:55cYmenrhudson: 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:55foobar_danAm I on?
17:56rhudsonfoobar_dan: loud and clear
17:57daniel__Microphone check.
17:57daniel__Test?
17:58daniel__Sorry to bother everyone. Are my messages coming through?
17:58rhudsoncYmen: 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:58rhudsondaniel__: yes
18:03cYmenrhudson: yeah, absolutely
18:05daniel__Great. I have a question about persistent data structures.
18:06daniel__In this code, I've def'd an agent, and a function that `mutates' the agent: http://pastebin.com/wT7PaXSd
18:07daniel__My question is this: When await returns, does the value of the agent share data with the symbol in the let bind?
18:07Chousukemost likely
18:08daniel__Hmm. What do you mean by most likely?
18:08Chousukesomething might have reset the agent to a completely different value in a different thread :)
18:08Chousukeafter the deref, but before the send
18:09Chousukebut 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:10Chousukebut it's all immutable so don't worry about it
18:10daniel__Neato.
18:10daniel__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:11rhudsonFor that matter, some other than could have held on to @a before this thread appended the 5.
18:12Chousukedaniel__: hm, I don't really understand that question
18:12daniel__Maybe I don't understand it either. :)
18:12mmarczykwell actually for a short vector like that
18:12mmarczykstructure might not be shared
18:12Chousukedaniel__: 'value' is the immutable state of the identity that the agent represents at one point in time
18:12daniel__Right.
18:12mmarczykvectors are chunked, 32 items per chunk
18:12rhudsondaniel__: whatever value a holds when it "receives" the send, it'll try to conj 5 to that value.
18:13rhudsonit's not necessarily the value you saw in the let
18:13mmarczykplus there's a separate 'tail'
18:13daniel__I see.
18:14mmarczykI believe normally conjing onto a vector shares most of the structure, but uses a longer tail
18:14Chousukeagents 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:15daniel__I see. A ref would probably be a better fit for this snip of code.
18:16Chousukepossibly
18:16daniel__Also, Is this little bit of code idiomatic? I know there's not much there.
18:16rhudsondaniel__: You don't need the "do"
18:16daniel__Oh reeeaallly.
18:16mmarczykif 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:16daniel__Nice.
18:17mmarczykbut if there's some other reason to use an Agent... who knows
18:17daniel__That's what I was thinking, mmarczyk.
18:17daniel__This code is for a presentation.
18:17daniel__So, a ref will definitely make it more clear.
18:18Chousukejust make sure you don't do any printing in a transaction
18:18daniel__I just wanted to make sure that I was demonstrating shared data.
18:18mmarczykyou could start with a simple example with an Atom
18:18Chousuketransactions must be pure functions
18:18daniel__Right, transactions are retried. :)
18:18daniel__err, can be.
18:18Chousukedaniel__: oh, that's easier to do without agents
18:18mmarczykthen expand that into a more elaborate example which requires coordination
18:18mmarczykand use Refs for that
18:19daniel__I did the producer consumer problem and used refs. :)
18:19daniel__It's pretty awesome. I had 2500 threads in the JVM yesterday.
18:19mmarczykthat also allows you to postpone the discussion of dosync & Co. until after you discuss the basics of the unified update model :-)
18:19Chousukejust do: (let [a '(1 2 3) b (conj a 2)] (identical? a (rest b))) or something
18:20daniel__Oh hey, I didn't know you could do that..
18:20daniel__That is, use a previously bound symbol in a let.
18:20Chousukedemonstrating structural sharing with vectors is probably trickier
18:21daniel__I mean, within the argument vector. [a 3 .... foo a] or whatever.
18:21Chousukeright, they're evaluated serially
18:21rhudsonIt's a very useful feature
18:22Chousukethere's even a recursive let in contrib :P
18:22daniel__Wowsers.
18:22Chousukebut it's black magics
18:22daniel__Yeah, I'm not quite ready for that. :)
18:22Chousukeuses an atom or something weird like that anyway
18:23daniel__I was really pumped when I got the producer/consumer problem working.
18:23daniel__I have a funny feeling, though, that my code is ugly.
18:23daniel__I'll come back and share it after I turn my work in.
18:24Chousukehmm
18:24Chousuke(doc seque)
18:24clojurebot"([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:24daniel__Thanks for the help, everybody.
18:24Chousukejust use that on a blockingqueue and pass it to your consumer!
18:24Chousuke:)
18:25daniel__...
18:25Chousukenah, I guess it's not very concurrent though
18:25chouserthat's for one thread on each side
18:26daniel__(doc seq)
18:26clojurebot"([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:26daniel__Ok, while we're on the topic: What, exactly, is a seq?
18:26Chousukea thing that supports first and rest
18:27daniel__When I see 'first' and 'rest' I think of a list.
18:27daniel__(first '(1 2 3))
18:27daniel__1
18:27Chousukea list is the simplest kind of sequence
18:27Chousukebut a sequence is really anything that has a head and a tail
18:27daniel__So, a vector is a sequence too.
18:28chouserno
18:28daniel__I'm listening.
18:28chouserYou can get a sequence on a vector, but a vector itself is not a sequence.
18:28Chousukea vector is not a seq, but a sequence view of a vector can be made
18:28chouser,(class (seq [1 2 3]))
18:28clojurebotclojure.lang.PersistentVector$ChunkedSeq
18:29Chousukethe practical reason a vector is not directly a seq is, I think, because they have different performance guarantees
18:29Chousukeonce you get a seq view on a vector you're no longer allowed random access via that view.
18:30Chousukethe original vector is of course unaffected
18:32daniel__I see. By the way, chouser, I have "The Joy of Clojure". I'm assuming that's you on the cover. :)
18:32daniel__I mean, your name. ;)
18:32chouserha
18:32fro0gwhat would it take for 'add-classpath' to be non-deprecated?
18:32mmarczykhttp://gist.github.com/378784
18:33mmarczykthat's to demonstrate structural sharing in clojure.lang.PersistentVector instances
18:33daniel__I see it. :)
18:33chouserdaniel__: thanks for both your patronage and your joke. :-)
18:34daniel__I can't wait to get more chapters...
18:34rhudsonfroOg: Probably some fundamental work on the JVM
18:34daniel__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:35mmarczykChousuke: there's a letrec in contrib??? wow, never noticed
18:35chouseryeah, there's some more on the MEAP site now.
18:35mmarczykwould you happen to remember where (and if it's called that :-))
18:35chouserdinner time. bbl.
18:35daniel__Great. Thanks everybody.
18:41fro0grhudson: so probably shouldn't hold my breath :/
18:48cheezeyis it possible to do say an include or something so i can split up my source files :X
18:49zakwilsoncheezey: see require and use
18:55cheezeyzakwilson: i think im being dumb but i dunno how to use it >_>
18:56zakwilsoncheezey: 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:57zakwilsoncheezey: you can also use (load pathname)
18:57zakwilsonThough that's probably not considered the Right Thing.
18:59rhudsoncheezey: 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:59rhudson[ right at the top => right at the top of each file ]
19:00cheezeylike (ns blah ...)?
19:00rhudsonyeah
19:02cheezeydo the files have to have a certain extension..? O_o
19:03rhudsonroughly (ns foo ...) in foo.clj; (ns bar (:use [foo])) ...) in bar.clj
19:03rhudsonI don't know "have to"; ".clj" is at least conventional
19:07mmarczykonly please don't use single-segment namespace names, they're not guaranteed not to break
19:07mmarczyk(single-segment = no dot in the name)
19:08rhudsonAgreed; "not guaranteed not to" is an understatement in my experience.
19:08mmarczyk:-)
19:09cheezeyX_x
19:10cheezeythis is weird =\
19:13cheezeyrhudson: 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:14mefestocheezey: can you paste an example of what you're doing?
19:15cheezeynot 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:15cheezeyit seems like this would be very trivial :\
19:15rhudson(System/getProperty "java.class.path")
19:16mefestofile2 should have: (ns file2 (:use [file1]))
19:16cheezeyrhudson: yeah, the files are listed in the output
19:17cheezeymefesto: it does :X
19:17cheezeymefesto: but i guess its more like (ns (:import ...) (:use ...)) is that fine?
19:18mefestocheezey: http://pastie.org/934755
19:20cheezeymefesto: yep it doesnt work for me :\
19:21mefestowhat error do you get?
19:21cheezeyCaused by: java.io.FileNotFoundException: Could not locate file1__init.class or file1.clj on classpath:
19:22mefestoim assuming you did name the files: file1.clj and file2.clj right?
19:22rhudsonAnd '.' is on your classpath?
19:25cheezeyer sorry my internet is weird
19:25cheezeyum rhudson the folder is in the classpath
19:25cheezeylet me include . just to be safe ;X
19:25cheezeyyep. same problem >_>
19:26mefestoassuming 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:28mefestocheezey: what OS are you running on?
19:28cheezeymefesto: that worked =o
19:28mefestonice :)
19:29cheezeyhm. it's still weird that it doesn't work with just clojure and etc
19:29cheezeymefesto: im running ubuntu but i installed clojure from source
19:29mefestojust a classpath issue
19:30mefestocheezey: what do you have your classpath set to?
19:31cheezeyjust a sec, i may have been very dumb in something :O
19:32cheezeymefesto: ya i was being dumb and setting the wrong variable :X
19:35rhudsoncheezey: By the by, :import is for Java stuff; :require and :use for Clojure
19:36rhudsone.g. (:import [java.io File FileReader])
19:38mefestocheezey: np, i've been bitten by classpath weirdness many times :)
19:38cheezeythanks for the help =D
20:09zakwilson_Is there an easy way to get the index of the element of a lazy seq that causes an exception when evaluated?
20:13cemerickrhickey: pling
20:20cemerickSeems like some subtle breakage in protocols' polymorphism: https://gist.github.com/780b7fe55a6358641bef
20:33rhickeycemerick: nope, no implementation inheritance
20:34rhickeyor rather, you get only one definition, not a mix of inherited and added. This is not Java
20:34cemerickOK -- so the default impl has rather less significance.
20:35rhickeycemerick: I don't see that
20:35rhickeythe default impl covers all types for which there is no impl
20:35rhickeyit's not about mixing
20:36rhickeyif you want mixins, use extend and method maps, you can do arbitrary reuse and composition
20:41defncould 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:50cemerickrhickey: OK, now I notice the usage of "evaluated" when discussing fn maps provided to extend
20:51rhickeycemerick: yes, it's quite cool, true implementation composition, and great speed too
20:52cemerickrhickey: indeed. Expect that to be a FAQ, though. :-)
20:53cemericki.e. why dispatch doesn't trickle back to Object, or other superclasses
20:54rhickeycemerick: ok, but I don't see where it implies it would
20:54rhickeyprotocols are not inheritance based
21:07_atoIf 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_atoI 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:17rhickey_ato: I don't disagree, there will be a lot of work in helping people retreat from mistaken conclusions
21:22rhudsonIs it possible to have a function that returns the extend map, say (extension AType AProtocol) ?
21:23rhickeyrhudson: there isn't yet, would only work for explicit extensions
21:24rhickeyrhudson: 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:24livingstonif 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:25rhickey,(type 'asymbol)
21:25clojurebotclojure.lang.Symbol
21:26livingstonI tried just Symbol (it works with just String) but for clojure types I have to fully qualify it?
21:26rhickeylivingston: yes, or import
21:26livingstonok fair enough
21:26livingstonthanks
21:27rhudsonlivingston: was it you asking about unification algorithms earlier?
21:27livingstonrhudson: yes
21:28rhudsonI got curious, dug around & came across this: http://www.doc.ic.ac.uk/~sgc/teaching/v231/lecture8.ppt
21:29livingston*looking
21:29rhudsonFound several discussions of the same algorithm, but this was the most thorough explanation
21:31rhudsonUnification discussion starts around slide 16
21:32livingstonok, yeah, that's basically what I have from porting Norvig's unify algorithm
21:32woobylivingston, the one from PAIP? i'm working on that also
21:33livingstonmy 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:34livingstonwooby: yes, I have it working, you can have it
21:34woobycool, i'd like to check it out
21:35mmarczyklinvingston: funnily enough I'm interested in unification from a logical / algebraic standpoint :-)
21:35livingstoni 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:36mmarczyknah, a second
21:36woobylivingston, instant & worthwhile to set up
21:36livingstonok wooby, I'll have that set up and shared by the end of the hour
21:37woobyreally cool, looking forward to it
21:37mmarczykditto :-)
21:37woobyout of curiousity, have you experimented at all with paralell unification
21:37woobyand-parallel or otherwise?
21:37rhudsonlivingston, have you looked at stuff in the RDF/OWL/SPARQL arena?
21:39livingstonmy 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:40livingstonrhudson: I was contemplating shoving all that into a SWRL rule engine to match it
21:40livingstonit'll require a lot of reification (in the RDF sense, not Clojure) though
21:42livingstonwooby: I don't know how you would parallelize that algorithm? since bindings need to grow and persist through it
21:44woobyhm true, perhaps only the simpler pattern matching forms can be parallelized
21:46livingstonrhudson: do you have any experience with RDF/OWL/etc.? especially from Java or Clojure?
21:47rhudsonIt's been a few years; mostly in Java (and Jython, my JVM lang of choice at the time)
21:47livingstonhave you worked with any of the rule engines?
21:48rhudsonI'm really fuzzy on the details, but my sense is you could express your problem & the rules & crank through it relatively efficiently.
21:48livingstoni've got Jena and AllegroGraph and Clojure mostly playing fair with each other
21:48rhudson* trying to remember what engine I used
21:49livingstonrhudson: 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:50rhudsonIt was the Jena stuff. This is 4-5 years back so I imagine the landscape has changed.
21:50rhudson-- Couldn't find anyone to hire me to do more RDF!
21:51livingstonyeah, I'm sure it has. you might have more luck now.
21:54livingstonwhat's the thing on github that's like pastie or whatever, where I can just throw something up quick?
21:55livingstonfound it - gist
21:57_atoput something ending in ".clj" in the "name this file..." box and it'll syntax highlight for clojure
21:57_atoah.. it's got a dropdown now
21:57_atothat's nice :)
21:58livingstonyeah 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_atoah, 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:59livingstonafter I make one I can just copy the URL at the top right? w/out giving away anything person, right?
21:59livingston_ato: oooh I should get that
22:00_atoyeah, 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:00livingstonwooby: 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_atogist.el: http://github.com/defunkt/gist.el
22:01livingstonI 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:02woobylivingston, great, thanks
22:03livingstonwooby: documentation is obviously light, it should work with lists or vectors and treat them the same
22:05woobylivingston, http://gist.github.com/378750 my progress on pattern match and a factdb if you're interested
22:05woobylooking forward to hacking more on this, thanks sharing and have a good evening livingston
22:06livingstoncool, 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:06livingstonlet me know if you run into any trouble or bugs
22:07woobywill do, thanks
22:08mmarczykwooby: cool prolog impl :-)
22:09rhudsonlivingston, I'm curious how you wired Clojure & Jena together
22:11woobymmarczyk, thanks ! research continues :)
22:11mmarczyk:-)
22:13dmiles_afkJena and CLojure togehter?
22:14dmiles_afki am wiring togher LarKC+ABCL+PrologCafe
22:15dmiles_afkbut Clojuire is on the hitlist
22:15livingstonit's mostly a hack right now but I'm spinning it up
22:15dmiles_afkare you hitting jena api via reflection?
22:16dmiles_afkwell as far a what clojure hits things with .. i guess its a step or two better than reflection
22:16livingstonI'm using symbols as the native representation of URI on the clojure side
22:17dmiles_afkthats what i like to hear
22:17dmiles_afkthe merging of object models.. thats the mst important part... way less thunking
22:18dmiles_afkless re-representation if they start sharing an innerloop (they calling each otehr frame by frame)
22:18livingstonmostly 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:19dmiles_afki am thinking sometime we (yu and I) are going to need a alias in source refernces
22:19livingstonthey 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:20dmiles_afkor does "langague" in clojure actually holds a URI in a new field?
22:20livingstonmaybe that was a bad exmaple but the point is RDF tripples are just a list of 3 symbols
22:21dmiles_afki kind of get it
22:21livingstonsince 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:21dmiles_afkare you changing clojres impl a bit?
22:21rhudsonThat'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:22dmiles_afkand/or Jena?
22:22livingstonnot create an Object that is of type Reference that holds a URI ... ugh
22:22livingstonrhudson: exactly
22:22livingstonif you look at Franz's lisp API for their AllegroGraph server it's a lot more like what we would want than Jena
22:23dmiles_afkyeah
22:23livingstonalthough one nice thing is if it's Jena that's wrapped, then it should be fairly portable across servers
22:24dmiles_afki 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:25dmiles_afkbut 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:25dmiles_afktriple*
22:25dmiles_afk(if the triple contains a number i it as an example)
22:26dmiles_afk(if the triple contains a number in it as an example)
22:26dmiles_afkbut if jena uses java.lang.Integer ... then i guess clojure is all happy
22:27dmiles_afkbut if its a RDFNumber.. thats the pain
22:27livingstonsome triple stores use name types, some turn everything into strings
22:28dmiles_afki guess that is just the way some stores are.. and not too bad i guess if that is the case
22:29livingstondepends - can't do numerical range queries then
22:29livingstonI gotta run ....
22:29livingstonthey are re-arranging the furniture in the coffee shop under me as I type...
22:29dmiles_afk:)
22:29livingstonI'll be on either later or tomorrow
22:30dmiles_afksounds good.. its a fun topic
22:30rhudsonsee ya
22:36sattvik /quit
22:48slyphonanyone know why i'd be gettting: No matching method found: invoke for class java.lang.reflect.Method
22:48slyphoni mean, it's obviously defined...
22:49cp2wrong signature/arity ?
22:49slyphonhmm
22:50cp2how are you calling it
22:50slyphon(. method (invoke obj (long 10000) nil))
22:50hiredmanhint method
22:51hiredman(. #^java.lang.reflect.Method method (invoke obj (long 10000) nil))
22:51slyphonah
22:51slyphonsame thing
22:52mefestojust guessing: (. method invoke obj (long 10000) nil)
22:52slyphonthe syntax is supposed to be equiv.
22:52hiredmanwell, as long as we are changing it up
22:52mefestoinvoke is a method on a Method obj
22:52hiredman(.invoke method obj (long 10000) nil)
22:52slyphonmefesto: yeah, that didn't work
22:53slyphonthe method is MessageProducer.setTimeToLive(long)
22:53slyphonin javax.jms
22:53mefestoleave out the nil?
22:53slyphonum
22:53hiredmanhave you looded at the javadocs for invoke on Method?
22:53mefesto(.invoke method obj (long 10000))
22:53hiredmanit takes an object then varargs
22:53hiredmanlooked
22:54slyphonmefesto: nah, invoke is a variadic
22:54mefestough :)
22:54slyphonhiredman: yeah
22:54slyphonhiredman: that's what obj is, an instance of MessageProducer
22:54hiredmanand you know that varargs in java are just sugar over passing an array
22:54slyphonno, i did not know that
22:55hiredmannow you know, and knowing is half the battle
22:55slyphon:)
22:55slyphonGI JOE!
22:55mefestolol
22:57slyphonoh fun
22:57slyphon(. #^java.lang.reflect.Method (*ttl* :method) invoke user/*p* (into-array Object [(long 10000) nil]))
22:57slyphonClass mbox.harpo.utils$eval__9138 can not access a member of class com.atomikos.jms.AtomikosJmsMessageProducerProxy with modifiers "public"
22:58slyphonIllegalAccessException
22:58slyphonso, i can't access a public method?
22:58hiredmanare you familiar with the reflection stuff in contrib?
22:58slyphonnot really :/
22:58slyphonwhere is it?
22:58mefestototally necessary to call it through Method?
22:58slyphonmefesto: well, i'm trying to dynamically set bean properties
22:59slyphonso i can say (update-bean obj {:ttl 80})
22:59slyphonand it'll DTRT
22:59hiredmanslyphon: http://richhickey.github.com/clojure-contrib/reflect-api.html
22:59hiredman(it was better when it was called wallhack)
23:00mefesto(.invoke method obj (into-array [(long 10000)]))
23:00mmarczykslyphon: hi
23:00slyphoni think it still is in my version
23:00slyphonmmarczyk: hai!
23:00mmarczykupdate-bean not cutting it for you? :-)
23:00slyphonmmarczyk: i'm trying reflection
23:00slyphonhahaha
23:01uberjarwould someone please port this project to clojure for me ? http://common-lisp.net/project/parenscript/ thnx
23:01sexpbot"Parenscript"
23:01hiredmanclojurebot: scriptjure?
23:01clojurebotExcuse me?
23:01hiredmanclojurebot: google scriptjure
23:01clojurebotFirst, out of 47 results is:
23:01clojurebotarohner&#39;s scriptjure at master - GitHub
23:01clojurebothttp://github.com/arohner/scriptjure
23:02uberjaruh wow that's awesome
23:03slyphonhiredman: so params in wall-hack-method is [java.lang.Long] ?
23:04slyphonnot the actual value?
23:04hiredmanuh, it's been a long time
23:04slyphonsince i rock and roll
23:04hiredmanthat sounds right
23:05slyphonbingo
23:05slyphonwow, that's gonna be a pain in the balls
23:05hiredman,(vec (map class '[(long 1) nil]))
23:05clojurebot[clojure.lang.PersistentList nil]
23:05hiredmangrrr
23:05hiredman,(vec (map class [(long 1) nil]))
23:05clojurebot[java.lang.Long nil]
23:06slyphoni think it's actually java.lang.Long/TYPE in this case
23:06slyphonunless java does auto-unboxing
23:06slyphonwhich i can't remember if it does
23:06hiredmananyway, it's totally doable
23:06slyphonyeah, right on
23:07slyphon(java-utils/wall-hack-method (class user/*p*) :setTimeToLive [java.lang.Long/TYPE] user/*p* 10000)
23:07slyphonthat just worked
23:07mmarczyk:-)
23:09mmarczykkudos for the cool name :-)
23:10mmarczykin addition to the function itself
23:10hiredmanit was cool, but it got changed a month or so ago
23:10mmarczykyup, so I see
23:10mmarczykin fact, so many cool names are getting ditched
23:11mmarczykduck-streams
23:11mmarczykI'm not sure if incanter.chrono, after becoming a separate project, wasn't renamed to clj-time
23:12mmarczykhope I was dreaming it (a nightmarish dream, that) ...?
23:12mmarczykwhat's up with this, I mean, duck-streams is soooo obviously a superior name to io, even if io makes more sense
23:12mmarczykand wall-hack & chrono actually do make perfect sense
23:12mmarczykah.
23:14slyphon"wall" is "write all" right?
23:15cp2slyphon: no
23:15slyphonit's what you beat your head against until you find "wall-hack-method"?
23:15cp2do you know what a wall hack is in regards to an fps/whatever?
23:15slyphonohhhh
23:15cp2seeing enemies through walls and objects
23:16slyphonright
23:16slyphongotcha
23:16cp2sort of like that but with access flags =P
23:16slyphonhahaha
23:20mefestoslyphon: is this basically the same thing? http://pastie.org/934940
23:21mefestoI'm still learning clojure so I'm curious what the difference is between that and the helper func
23:21slyphonyeah, seems like it
23:21slyphonwell, i'm calling a method on some third-party API
23:21slyphonand they're not being nice about it
23:23remleduffGiven 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:25hiredman,(into {} (map (juxt inc dec) [1 2 3]))
23:25clojurebot{2 0, 3 1, 4 2}
23:26remleduffThank you, was just fumbling my way towards that :)
23:26hiredman,(reduce #(assoc % (inc %2) (dec %2)) {} [1 2 3])
23:26clojurebot{4 2, 3 1, 2 0}
23:27mefestowow juxt is some pimp stuff
23:29slyphonholyshititjustworked
23:29slyphonhiredman: thank you!
23:29slyphonn
23:34slyphonhiredman: http://github.com/slyphon/sly-utils/blob/master/src/com/slyphon/utils/update_bean.clj
23:38mmarczykslyphon: have you tested the version of update-bean on the other branch, by the way?
23:38slyphonmmarczyk: hrm