#clojure logs

2010-11-29

02:29raekI love the smell of homoiconicity in the morning
02:46Raynestechnomancy: Ever heard of PyTyle?
02:52pppaulwhat would be an easy way to write data with meta data to a file?
02:52pppaulwill spit record the meta-data?
02:55replacapppaul: see http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/*print-meta*
02:55replacapppaul: I've never used it, so YMMV
02:56Raynes&(doc *print-meta*)
02:56sexpbot⟹ "; If set to logical true, when printing an object, its metadata will also be printed in a form that can be read back by the reader. Defaults to false."
02:56pppaulthanks
02:57replacaoh, that's right, bots!
02:59Raynes&(-> (binding [*print-meta* true] (pr-str (with-meta [1 2 3] {:doc "ohai"}))) read-string meta)
02:59sexpbot⟹ {:doc "ohai"}
02:59RaynesTa da
03:01raek&(meta (-> (binding [*print-meta* true] (pr-str (with-meta [1 2 3] {:doc "ohai"}))) read-string meta))
03:01sexpbot⟹ nil
03:01raekoh. nevermind. :)
03:02RaynesThat would have been super meta metadata.
03:05pppaulonly the best kind
03:06pppauli'm trying to make a backup up a lasyseq using spit... how would i do so?
03:07pppauli tried doall, and doseq
03:07pppauldata looks like: ({:custom3114088 "Mr.", :firstname "Blair", :lastname "Collins"})
03:08pppaultried dorun too
03:09RaynesI'm not an expert, but I'm pretty sure it's impossible to print a lazy sequence without unlazifying it.
03:09pppauli would like to do so
03:10raekstore the data without looking at it? :-)
03:10RaynesSince, being lazy, it doesn't know what it's elements are, and if it were to print "I'm stupid", the reader wouldn't know what to read it back as.
03:11raekmaybe you could traverse the lazy seq and append the string version of each element to the end of a file
03:11raekif holding on to the head was the issue
03:11pppaulit's not... i gave the whole data
03:11pppaul({:custom3114088 "Mr.", :firstname "Blair", :lastname "Collins"})
03:12pppaulthat is the whole thing i want to save
03:12RaynesOh, you don't care if it remains a lazy seq?
03:12raekwhat do you get in your file?
03:12pppauldon't care
03:12pppaulnothing, or @lazyseq.clojure... sutff
03:13raekhrm, are you calling str on it?
03:13pppaulno
03:13raekweird
03:13pppaul(spit "file.bak" (dorun corrected-contacts))
03:13raekdorun returns nil
03:13pppaulyeah
03:13Raynes&(pr-str (lazy-seq [1 2 3 4]))
03:13sexpbot⟹ "(1 2 3 4)"
03:13RaynesUse pr-str
03:13RaynesThat's what all the cool kids do.
03:14pppauli'll give it a shot
03:14raekweird! I can see in the source that it uses 'str' to make a string from the form
03:14raekwhich is wrong
03:14pppaulbug?
03:15raeklooks like it
03:17raekI'll make a ticket
03:18pppaulthe last issue i have is backing up the metadata
03:18raek,(doc spit)
03:19raek&(doc spit)
03:19sexpbot⟹ "([f content & options]); Opposite of slurp. Opens f with writer, writes content, then closes f. Options passed to clojure.java.io/writer."
03:19raek&(doc slurp)
03:19sexpbot⟹ "([f & opts]); Reads the file named by f using the encoding enc into a string and returns it."
03:19pppaul(#^{:id 324234} {:custom3114088 "Mr.", :firstname "Blair", :lastname "Collins"})
03:19raekpppaul: sorry, I was wrong. spit and slurp does not operate on data structures as I assumed
03:19raekthey work on strings
03:20pppauloh
03:20raeki.e. no bug
03:20pppaulso, i should be using something else?
03:20raekwell, you simply have to convert your seq to a string first
03:20raekusing pr-str
03:21raek,(binding [*print-meta* true] (pr-str ^{:foo :bar} [1 2 3]))
03:21raek&(binding [*print-meta* true] (pr-str ^{:foo :bar} [1 2 3]))
03:21sexpbot⟹ "[1 2 3]"
03:21pppaulpr-str wasn't smart enough to walk my structure to print the meta-data of each element
03:22pppauli guess pr-str doesn't print meta data period
03:22pppaulmaybe there is a smarter way to write out objects
03:22raek&(binding [*print-meta* true] (pr-str (with-meta [1 2 3] {:foo :bar})))
03:22sexpbot⟹ "^{:foo :bar} [1 2 3]"
03:23brehautwhat is the correct way to compare two byte arrays for equivalence?
03:23raekbrehaut: value or identity?
03:23brehautvalue
03:23raekpppaul: ^
03:23raekpr-str can indeed print metadata
03:23pppaulok
03:24pppaulnot sure why it's not working for me
03:24raekbut metadata on the *code* (introduced by ^) is not the same as metadata on the *value*
03:24pppauloh, i didn't use binding
03:26raek&(= (seq (to-array [1 2 3])) (seq (to-array [1 2 3]))) ;; <-- this is one way
03:26sexpbot⟹ true
03:26brehautraek, works for me
03:26brehauti only need it for a testcase
03:26pppauli have metadata on the values
03:27raek&(java.util.Arrays/equals (to-array [1 2 3]) (to-array [1 2 3])) ;; <-- this seems to be the java way
03:27sexpbot⟹ true
03:28brehautraek cheers
03:29pppaulso, i used the binding and the metadata still isn't printing out
03:29pppaul(binding [*print-meta* true]
03:29pppaul (pr-str corrected-contacts))
03:29pppaul(meta (first corrected-contacts))
03:30pppaulsolve360=> "({:custom3114088 \"Mr.\", :firstname \"Blair\", :lastname \"Collins\"})"
03:30pppaulsolve360=> {:id 9916966}
03:30pppaulthe metadata is on the inner hashmap
03:35raekalso, which version of clojure do you use?
03:38pppaul1.2
03:38pppauldo i have to walk my structure calling pr-str on each item?
03:40pppaulactually, i just tried (map pr-str data) and it didn't work
03:42pppaul(binding [*print-meta* true]
03:42pppaul (pr-str (with-meta [123] {:doo 4})))
03:43raek&(binding [*print-meta* true] (pr-str (lazy-seq [(with-meta {:a 1, :b 2} {:foo "bar"})]))))
03:43sexpbot⟹ "(^{:foo \"bar\"} {:a 1, :b 2})"
03:43pppauljust prints [123]
03:43raek&(binding [*print-meta* true] (pr-str (with-meta [123] {:doo 4})))
03:43sexpbot⟹ "^{:doo 4} [123]"
03:43raekthat is very weird
03:43pppaulok
03:44pppaulbefore i used binding i did (def *print-meta true)
03:44pppaulcould that be screwing stuff up?
03:44raekyes
03:44pppaulis there a way to revert?
03:44raekthen you created your own var called *print-meta* in your namespace
03:44raekyes
03:44pppaul^_^
03:44raek(ns-unmap 'your-ns '*print-meta*)
03:44raek(refer-clojrue)
03:44raek(refer-clojure)
03:45pppaulok
03:45pppaulboth those, or just the last one?
03:45raekthe repl is in a binding form that rebinds the usual *earmuffed* vars
03:45raekso you can change it with set!
03:45raekns-umap to remove your
03:46raekrefer-clojure to add clojure's
03:46pppaulthanks so much, that fixed things :D
03:46pppauli'm so silly
03:46raek(set! *print-meta* true)
03:47pppaulspit is spitting good things
03:47raeknp.
03:49raekif you read it back using slurp and read-string, you might want to bind *read-eval* to false for security reasons
03:56pppauloh
05:52birdspiderhi, is there another option to call clojure from java apart of (typedef,gen-class + AOT) or RT,VAR, stuff ? something like gen-class without AOT ?
05:54LauJensennot yet, AFAIK
08:46Licenseraloaeh!
09:28chouserclojure.contrib.json can't be extended to add new kinds of things in the reader?
09:38tonylmorning
09:44opqdonuthow can I make eval evaluate something inside a given ns?
09:44opqdonutuse case: I'm dumping data as clojure exps that use a couple of utility functions to build the data
09:45opqdonut(also, it seems that evalling a very large vector of things causes the constant pool to overflow. thus i'm doing a (map eval (read-string "...")) )
09:48chouser(binding [*ns* your-namespace] (eval ...))
09:49chouser(binding [*ns* your-namespace] (vec (map eval ...)))
09:50opqdonutthanks
09:50opqdonuterr but in that case eval evals in the current namespace?
09:50opqdonutwhich doesn't seem to be the case
09:51chouserit evals in your-namespace
09:51opqdonuti mean, if I don't bind
09:54octei have a seq of strings and want to change on character in one of the strings, what's the simplest way?
09:54tonyljust one character in one string? do you know the index of that string?
09:55octeyes, i know the index in the seq and in the string
09:56jarpiainopqdonut: you get a VerifyError from (eval '[x y z ...]) ?
09:56octebasically, replace the nth item of a seq
09:56octei'll figure out how to create the new string
09:58tonylocte: you can use the nth function
09:58tonyland clojure.string/replace
09:58opqdonutjava.lang.ClassFormatError: Invalid this class index 3171 in constant pool in class file sick$eval8275 (measurements.txt:4)
09:58opqdonutthat's what I get when trying to load-file it
09:59octetonyl, i dont understand how to use the nth-function to generate a new seq with one item replaced
09:59octemap-indexed perhaps
10:00chouseryeah, map-indexed, though if you'll be dealing with indexes into that seq much at all, it may be worth using a vector instead
10:00tonylyes map-indexed would help in that case
10:00chouserthen you can just use update-in
10:01octechouser, yeah, i guess. it's a seq due to reading it from a file
10:01octei'm making an ascii-game and it's a representation of the level
10:01octefeels kind of inefficient to make a new copy of the structure every time something needs to change (door opened for example)
10:02chouserwith a vector, you'll get structural sharing
10:02chouserwith a seq, you'll likely have to keep working around the laziness of the thing (map-indexed is lazy!) and you'll get no structural sharing
10:03chouserjust sharing of unchanged leaf objects (which you'd get with vectors as well)
10:04Chousukeimmutable world state enables all kinds of fun things
10:04Chousukelike time travel
10:04octeupdate-in sounds like it's suppsoed to be used with maps
10:05Chousukeit works with anything associative
10:08octehmm, this seems convoluted
10:08octe,(update-in (vec '("a" "b")) '(1) (fn [& rest] "x"))
10:08chouserassoc-in, if you don't care about the old value
10:08chouser& (assoc-in ["a" "b"] [1] "x")
10:08sexpbot⟹ ["a" "x"]
10:09octenice, thanks
10:09octenew bot?
10:16chouseroh, he's been here a while now. handy to have a backup. :-)
10:17djpowellchouser: I was playing with finger trees - made a sortedvector. It seemed a bit slow though...
10:17chouseryeah. they have large constent cost compared to Clojure's collections. :-(
10:17chouserperformance patches welcome! :-D
10:18djpowellI tried using the jvisualvm sampling profiler - it pointed to a couple of things in clojure, but I'm not sure whether to trust it
10:20djpowellI think the vec call is taking a bit of a slow path in clojure because clojure can't determine whether there are <= 32 elements in the concat-ed expression
10:21chouserI can't work on it right now, but I'd be thrilled to accept a performance patch.
10:22djpowellI was wondering whether there could be a better way of combining the metrics too than calling reduce over them. When the metric is stored in a defrecord or something, it might be more efficient for the monoid to accept more than 2 params, rather than producing a bunch of junk intermediate defrecords
10:23djpowellWould be interesting to compare against Functional Java's fingertrees too
10:23djpowellI'll have a play with it
10:37octeis there a simple way of writing and reading clojure structures to files? like vectors and maps
10:37Chousukedepends on what they contains
10:37Chousuke-s
10:38octewell, assuming simple stuff, primitives, strings, vectors, maps
10:38Chousukethen you can use pr and read
10:38octewhat if they'd contain java serializable objects?
10:39Chousukethen I have no idea.
10:39Chousukeyou'd have to do something custom
10:39octealright
10:39octethought there might be something built in
10:41Chousukethe safest approach will probably be to use json or xml :P
11:05edbond /set irc_conf_mode 1
11:16AWizzArdhttp://news.ycombinator.com/item?id=1950312
11:18chouserstill trying to get cake working
11:19chouserah, don't need cake
11:19AWizzArdfogus`: grats :)
11:19chouserbah, said 'disj' not 'disj!'
11:20AWizzArd(:
11:20fogus`The struct stuff kills me. :-(
11:21jaleyhi guys. does anyone know what needs to be in project.clj file for leiningen to generate an uberjar including some java code from my source tree? do i need an :aot field?
11:22cemerickfogus`: bah, 16/20 here! :-D
11:23cemerickthe quiz should filter out subjects where the answer is in the doc as part of an example
11:24chouser16/20
11:26raekjaley: you want to compile the java sources with leiningen too?
11:26raekthen you need to use a plugin
11:26jaleyraek: yeah, i've compiled them with lein-javac actually. now i want the compiled classes included in the jar
11:27raekah, they don't get included?
11:27jaleyraek: not with my current configuration... that's why i'm wondering if anything special needs adding to the project.clj?
11:28jaleyraek: at least i imagine that's the issue. at the moment leiningen is trying to compile my clojure code and aborts on the (ns) form that attempts to import the java classes
11:29raekdoes it work in the repl?
11:30raekwhat happens if you do (import 'one.of.the.Classes) in the repl?
11:30jaleyraek: actually... no. not now that i've added a gen-class to my core.clj (where -main is)
11:31fogus`cemerick: My next attempt was only 15/20 ... apparently there is no unchecked-sub function :-(
11:32raekjaley: does you java code depend on you clojure code, or the other way?
11:32chouseryou gotta be kidding. 'unchecked-remainder-long' sheesh
11:33jaleyraek: clojure depends on java. i just found the issue actually, but not sure how to fix. lein uberjar "cleans up" the generated java classes
11:33fliebelIs there something like Clojure.news, similar to its arc counterpart? In other words: any reddit clones in Clojure?
11:33jaleyraek: lein javac puts them back, then the repl works again
11:34jaleyraek: but then lein uberjar will re-erase them before attempting to build the jar
11:35raekI'm afraid I'm out of advice
11:35raekmaybe you could ask technomancy when he is around
11:36raekalso, make sure you have a recent version of lein-javac, etc
11:37jaleyraek: cool, thanks, i'll play around with it some more. i have 1.2.1, which is the latest i can see on clojars
11:37chouser2nd attempt: 17/20
11:39raekjaley: also, leiningen has a mail list. could be worth checking out.
11:40fliebelhah! Not much, but it might do what I need. https://github.com/LauJensen/cloneit/blob/master/src/cloneit.clj
11:41raekjaley: also, it looks like the lein 1.4 release candidate has something like lein-javac built in
11:42jaleyraek: got it... lein-javac comes with a hook to add itself to the compile and clean targets, so you have to add :hooks [leiningen.hooks.javac] to project.clj for uberjar to work.
11:42raekI see
11:57fliebelHow would I remove the repetition in this code? There are some unique parts and a recur, which make it hard to abstract. Only workable thing I can come up with is putting the lets in a macro. https://github.com/pepijndevos/clojure-quiz/blob/master/src/clojure_quiz/core.clj#L43-54
12:33hugodlooking for github advice - best way to transfer a personal github repo into a github organisation? create the new repo and push from the pld? I know clojure went through this process, so hence the question here
12:34dgreensper
12:35dgreensp^H^H
12:35dgreenspdoes anyone know why this is false?
12:35dgreensp(list? (list* 1 '(2 3)))
12:37raek,(class (list* 1 '(2 3)))
12:37clojurebotclojure.lang.Cons
12:37raek,(seq? (list* 1 '(2 3)))
12:37clojurebottrue
12:37raeklist? checks if it is a persistent (counted) list
12:38raeklist* just conses things on a sequence
12:38dgreenspah, interesting
12:39dgreenspso, I'm trying to parse an s-expr, kind of a domain-specific language
12:39dgreenspand one of my cases is (list? x)
12:39dgreenspshould I be using something different?
12:39raek,(class ''foo)
12:39clojurebotclojure.lang.PersistentList
12:40raek,(class (read-string "'foo"))
12:40clojurebotclojure.lang.Cons
12:40mduerksenis the author of the clojure quiz in here?
12:40raekdgreensp: I think seq? would work in your case
12:40raekmduerksen: I think the author is fliebel
12:41dgreensp,(seq? [1 2 3])
12:41clojurebotfalse
12:41dgreenspso vectors are never seqs?
12:41raektrue
12:41dgreenspok, sounds like seq? is what I want then, thanks :)
12:42raekPersistentList and Cons are the only types that implement the ISeq interface directly
12:42raek*collection types
12:42tonyldgreensp: or if you want vectors too you can use coll?
12:47dgreenspI'm using a nested combination of vectors and parenthesized lists as a data structure
12:47dgreenspso basically I need to tell them apart, and when transforming them generate an expression that passes the tests again
12:48dgreenspI knew from past experience that (list? (map ... wouldn't necessarily be true, but I thought (list? (list* ... would be, heh
13:03fliebelmduerksen: Yes, he is :)
13:04fliebelmduerksen: ping
14:03mduerksenfliebel: pong :)
14:03fliebelmduerksen: what's up?
14:05mduerksenfliebel: i was enjoying your game, and will eventually use it to test my overall clojure knowledge
14:05nickikdid you make the clojure quiz?
14:06nickiki just downloading that atm. :)
14:06fliebelyes, I did.
14:08mduerksenfliebel: maybe you already considered this, but i have a suggestion (for the "hardmode"): i often could guess the answer because the exact funtion name was mentioned in the doc string. how about mask the occurrences of the literal funtion name in the doc string?
14:10fliebelmduerksen: Yes, I did consider this. But I found some occasions where the same word was used in a sentence in a not so obvious way. By emphasizing these words by removing them, you will also spoil it.
14:10fliebelI will look up an example
14:11fliebel&(doc class)
14:11sexpbot⟹ "([x]); Returns the Class of x"
14:11mduerksenfliebel: i know what you mean. another problematic example would be "key", as you could only guess the semantics with the word 'key'
14:12fliebel&9doc keys)
14:12sexpbotjava.lang.NumberFormatException: Invalid number: 9doc
14:12mduerksenexactly. for these cases, it could be sufficient to mask the literal function name in all sentences except the first one
14:13fliebel$(doc keyword)
14:13mduerkseni haven't completely checked if that would work all the time, but my impression (after 60 questions :) ) was that it might be sufficient
14:14fliebelkeyword has keyword mentioned in the second sentence
14:15mduerksenhmm, yes, and in an unemphasized way. :(
14:16fliebelAnd on the other hand, namespace would eb impossible to guess with the word namespace replaced.
14:18mduerksenwell that wouldn't be the case the first sentence remained unmasked.
14:18fliebeltrue
14:19fliebelSo that would work 99% of the time. Probably worth it.
14:20mduerksenmaybe there is a pattern to be found for the "spoilers", something like ' around it or so? i'm checking now :)
14:21tensorpuddinghow might one use 'require' on the repl to import namespaces?
14:21fliebelI think (<word> might be a good one.
14:21tonyl(require 'clojure.string)
14:22fliebeltensorpudding: (require 'some.namespace)?
14:22tonyltendsorpudding: ^^
14:22tensorpuddingi want to import something from clojure-contrib
14:22tensorpuddingah, that seems to give me classpath issues
14:22tensorpuddingi'm running the repl through lein
14:22tonylit's the same ##(require 'clojure.contrib.repl-utils)
14:22sexpbotjava.io.FileNotFoundException: Could not locate clojure/contrib/repl_utils__init.class or clojure/contrib/repl_utils.clj on classpath:
14:23tensorpuddinghey, that's the error i got
14:23tonylif that happens means that that namespace is not in the classpath
14:23dnolentensorpudding: useful to alias, (ns your.foo (:require [clojure.contrib.monads :as m]))
14:23dnolentensorpudding: is the contrib jar in your lib folder in your project?
14:23tensorpuddingyes
14:24tonylwhat ns are you trying to require?
14:24tensorpuddingoh wait
14:24tensorpuddingdamn
14:25tensorpuddingi was using a hyphen
14:25tensorpuddingit works now
14:25dnolenif you don't alias you will have to write really long names.
14:25dnolentensorpudding: clojure.contrib.repl-utils/source and the like
14:26tensorpuddingi was require-ing clojure-contrib.foo, not clojure.contrib.foo
14:26dnolenif you alias you can write r/source or whatever
14:26tensorpuddingi know
14:26tensorpuddingi have it aliased in my file
14:26tensorpuddingbut i'm testing things out on the repl at the same time
14:33fliebelThis returns all functions that contain their own name. (filter #(.contains (str "" (:doc (meta (val %)))) (name (key %))) (ns-publics 'clojure.core))
14:40mduerksen125 one of them. with the pattern (<name> i get 30
14:40mduerksenso 95 would be left :)
15:04fliebelmduerksen: But these 30 are good to replace for sure
15:05tensorpuddingwhat's the clojure equivalent to #' ?
15:05fliebeltensorpudding: #'?
15:05tensorpuddingfrom common lisp
15:06fliebelWhat does it do in CL?
15:06tensorpuddingfor instance, (apply #'+ '(10 10 10)) => 30
15:06zelliotensorpudding: you don't need it
15:06zellio(apply + [10 10 10]) works as is
15:06joly&(apply + '(10 10 10))
15:06sexpbot⟹ 30
15:07tensorpuddingah, but what i have is more complicated
15:07zelliotensorpudding: what do you have/
15:07tensorpuddingthough let me see
15:07fliebel#'+ allows you to redefine + though, and make it use the redefined version.
15:07zellio( sorry it's scrolled away )
15:07tensorpuddingapply is complaining that i give it a symbol
15:09zelliotensorpudding: pastebin your code
15:09tensorpuddingi've got a hash of functions, and i'm using (get table keyword) to pick a function, then apply-ing it
15:10tensorpuddingbut it turns out that i was referring to the functions with symbols, that was the issue
15:10zelliommkay
15:21Raynestensorpudding: You should be able to just do (keyword table), since keywords are functions that take a map and look themselves up in it. No need for get.
15:22Raynes&(:blah {: blah 1 :rawr 2})
15:22sexpbotjava.lang.Exception: Invalid token: :
15:23RaynesWell, you get the idea. Hard to type code on this phone.
15:24joly&(apply ({:add + :sub -} :add) '(10 10 10))
15:24sexpbot⟹ 30
15:27RaynesThat works too. ;)
15:27tensorpuddingwhat's the syntax of cond?
15:28dgreensptensorpudding: (cond test1 then1 test2 then2...
15:28Raynes&(cond false 1 true 2)
15:28sexpbot⟹ 2
15:28defndnolen: logos == cool
15:29tensorpuddingokay, so it's not like scheme
15:29Raynesdefn: Buy me a better phome for Christmas.
15:30jolyI think condp is more like Scheme's cond
15:30tensorpuddinglisp is quite the mess
15:31dgreenspno, scheme's cond is just like clojure's but with more parens
15:31tensorpuddingsyntax, i meant
15:31RaynesDare I say Clojure is less of a mess than some others?
15:31tensorpuddingthough lisps differing by frustrating little bits of syntax is par for the course
15:32dgreenspwhat's the most readable way to test whether a value is of the form ('Y foo), i.e. (list 'Y foo) for some foo?
15:33MunksgaardRaynes, i think things like (cond test1 then1 test2 then2) is much more of a mess than (cond (test1 then1) (test2 then2)). It has more parens, but imo it's much clearer what belongs to what.
15:33tensorpuddingyay, it builds! boo, it fails on running!
15:33dnolendefn: hey thx! a bit broken at the moment
15:33MunksgaardWhat is the advantages of clojures conds over lisps?
15:34tensorpuddingfewer parens, apparently
15:34dnolendefn: looking forward to seeing what kind of perf deftypes can bring to the mplus/bind stuff.
15:34tensorpuddingmy program somehow can't find my main method...
15:34dnolendefn: I'd like to have a Prolog-like REPL that you can start from w/in Clojure
15:35tensorpuddingbut it was able to build?
15:40RaynesMunksgaard: I am a fan of clear indentation rather than pointless parens.
15:43defndnolen: yeah! that'd be awesome.
15:44defnwww.github.com/jashmenn/clj-file-utils
15:45defnoh wait -- i forgot the 11th commandment: "thou shalt not say 'awesome' without considering tradeoffs"
15:46defndnolen: that's be 'interesting'. :)
15:47MunksgaardRaynes, I definitely see your point, but i'm just wondering if there are any implementational advantages. Is it faster to parse (cond test1 then1 test2 then2 ..) than (cond (test1 then1) (test2 then2) ..), or does it allow clojure to use some faster datatypes (vectors?) for the arguments, or whats the deal? I don't think you should be changing syntax just because you can get rid of a few
15:47Munksgaardparens, if you need to have way more messy compiler-code.
15:48chouserit's not *changing* syntax. Clojure's cond has always been that way.
15:48MunksgaardGood point :-)
15:48chouser:-)
15:49chouserto the extent that "too many parens" is cited as an excuse to ignore lisp, it may be worth some effort in the compiler code to reduce the validity of that claim.
15:50fogus`,(inc chouser)
15:50clojurebotjava.lang.Exception: Unable to resolve symbol: chouser in this context
15:50fogus`no love
15:51Raynes(inc chouser)
15:51sexpbot⟹ 1
15:51fogus`(inc chouser)
15:51sexpbot⟹ 2
15:51fogus`Raynes: thx
15:55Munksgaardchouser, you're propably right :-). I'm just a bit sad that the simplicity/purity of lisp is being sacrificed like this, but then again, as you said, this ain't lisp...
15:56fogus`Munksgaard: What defines purity?
15:56defnnot this paren talk again!
15:56Munksgaarddefn, sorry! I'll stop!
15:56defnhaha nono it's fine
15:57Munksgaard:-)
15:57defnI was going to take this opportunity to say that you check out Land of Lisp
15:57MunksgaardI guess it's been discussed a billion times in here already.
15:57defnthe author does a terrific job of "selling" lisp
15:57hiredmanI assume by "lisp" you mean "common lisp"
15:57chouserI think it'd be fair to say Clojure is a step or two away from the purity of something like scheme, in exchange for a whole load of practicality and avoidence of several kinds of accidental complexity.
15:57defnhiredman: that assumption (at least in my case) would be correct
15:57tensorpuddingis there a function which mangles strings to integers?
15:58hiredmanin which case a. common lisp is not the only lisp, so please specify and b. common lisp is hardly something to be considered "pure"
15:58chouser& (pr-str 1234)
15:58sexpbot⟹ "1234"
15:58defni've never heard that terminology: "mangles"
15:58Munksgaarddefn, yeah i'm actually in the (slow) process of reading through it atm. I like it and lisp a lot, but clojure also draws me a bit with it's smaller standard library, speed etc.
15:58tensorpuddingi want the other way around
15:58defnim just doing land of lisp to have some context
15:59tonyl&(Integer.parseInt "1234")
15:59sexpbotjava.lang.ClassNotFoundException: Integer.parseInt
15:59tonyl&(Integer/parseInt "1234")
15:59sexpbot⟹ 1234
15:59defni plan on sticking around in clojure-land for some time to come
15:59Munksgaardchouser, good way to put it, i'll keep that in mind.
15:59tensorpuddingi *have* to use java for this?
15:59tensorpuddingalso it would preferably not be restricted to integers?
16:00defntensorpudding: (defn str->int [i] (Integer/parseInt i))
16:00defn(str->int "5423")
16:00defnerr replace that i with an s
16:00chouser& (read-string "[:not :a Integer 123.456]")
16:00sexpbot⟹ [:not :a Integer 123.456]
16:00tonylso any number?
16:00mabesand type hint the i
16:01defni dont really see any problem with using Java in your clojure code. that's sort of the point, isn't it? use what's there? that being said, i like to break most of the java I use out into a tiny clojure function to keep things tidy
16:01tensorpuddingi don't know, when i feel that i must call java (which has happened twice since i started writing this thing) that it's a shortcoming of the language
16:02tensorpuddingmoreover, i have a dislike of java
16:02defntensorpudding: there are other ways to do it in clojure
16:02tensorpuddingi suppose i could use a regex
16:02tensorpuddingthat would be a lark
16:03defnim a walking lark
16:03danlarkinno I'm a walking lark!
16:03chousertensorpudding: Clojure intentionally embraces the host environment and so does not abstract parts of it that don't need to be abstracted. Using Java method calls really is fine.
16:03defnchouser: i had the same reaction initially to using Java in Clojure
16:03defnit felt...dirty...
16:03chouserdefn: we all did
16:04tensorpuddingi'm mostly using clojure because it's a lisp with more features and less cruft, in spite of my ambivalence about java
16:05chouserhttp://clojure-log.n01se.net/date/2009-10-04.html#21:24
16:05tensorpuddingin any case, if i used that parseInt i'd have to catch an exception if it's not an integer
16:05chousersorry to quote myself. :-P
16:05chousertensorpudding: you saw you could use read-string ?
16:05tensorpuddingand i haven't gotten far enough in clojure to handle exceptions
16:06defn1. "oh! Java!?" 2. "Eww! Java!" 3. "Ah... Java..."
16:06chouserthough that can throw exceptions too
16:06hiredmanI wouldn't use read-string
16:07hiredmanuse parseInt or similiar
16:07chouserhiredman: why?
16:08hiredmanthe domain and the range are just too broad
16:08tensorpuddinghmm, read-string works nicely
16:08hiredmanread-string will take any string and try and turn it into anything
16:09hiredmanyou may not even get the type of number you want
16:10hiredmanit's just way to loose
16:11defndont i remember some other way of doing it
16:11defnhmmm
16:12chouserI want a pod
16:12chouserso I can put a SimpleDateFormat in it.
16:12chouserI guess I'm back to 2
16:13defnwasn't there some way of mapping char across your string and then doing something to get a number?
16:13brehauttensorpudding: late reparens: dont forget that clj allows optional commas
16:13hiredmandefn: just use parseInt
16:14dakronedefn: ping
16:14chouserunless you want to allow floats, then use parseFloat or parseDouble
16:14chouseror if ints are big enough, then use parseLong
16:14hiredmanchouser: indeed
16:14chouseraren't
16:14defndakrone: pong
16:14clojurebotNo entiendo
16:14hiredmaninfact parseLong would be better than parseInt
16:15defnhiredman: oh i agree with you, i was just thinking for the sake of brevity
16:15defnmight as well mention it
16:15hiredmanchouser: why would you ever want floats :(
16:16tonylbecause we don't want to discriminate the natural numbers
16:17tonylthen again there are also imaginary ones
16:17qeddon't want the ACLU to get involved...
16:17qed(rimshot)
16:17hiredmanI wonder if Ratio has a parseRatio (my guess is no)
16:18hiredmanmight be a nice patch...
16:20tonylthat would be
16:20chouserhm, clojure.lang.LispReader/readNumber looks nice
16:20chousertoo bad it's private
16:21tonylI was thinking of a generic fn
16:21tonylchouser: like that readNumber
16:22hiredmanhttps://github.com/hiredman/clojure/blob/readerII/src/clj/clojure/reader.clj#L728
16:23Chousukethat is seriously a hideous function. :P
16:24ChousukeI mean read, not read-number
16:24Chousukebut I guess that's what you get when you translate java.
16:24hiredmanwell, you know, I was forced to it for bootstrapping reasons
16:25hiredmanand that
16:25ChousukeI somehow managed to get my reader working without any weird tricks.
16:25Chousukebut it's pretty bit-rotted right now.
16:25hiredmanmine too
16:25Chousukeit was fun to write though.
16:26hiredmanyep
16:27hiredmanI want to rewrite using defrecord(deftype?) sometime, should be much cleaner and easier, but I hate to have to muck with the build again
16:28hiredmanI re-worked the build to build normally -> aot compile the reader -> build again using the reader
16:29hiredmanand, uh, I can only imagine the build.xml has gotten worse since then
16:34defnis there no way to delete a jar from clojars?
16:35lancepantzdefn: correct
16:36hiredmanyou can ask someone (technomancy?)
16:40defnlancepantz: is that...intentional?
16:41hiredmanimmutable
16:44lancepantzdefn: i'm not sure, but it does make some sense, if your project is dependent on something there, you don't want it going away
16:44lancepantzit's obviously troublesome to correct accidents tho
16:56dmart_does clojure have a sorted list, or just the sorted map? I have a defrecord with one field being a date, and I'd like to create a list of them sorted by that date field, without re-referencing the date through a key
16:56dmart_did I just make any sense?
16:56chouserdmart_: how does a sorted-set strike you?
16:57dmart_hmm, does that also require a key/value? I suppose my dates are unique
16:58dmart_maybe it just makes sense to sort the list once I've built it up, heh
16:58dmart_I'm probably over complicating things
16:58chouserhm, could be. sort on a seq is pretty fast
16:59dmart_I also appear to be using a tonne of memory building up this data set, but I'll try and figure that out next
17:02chouserhuh, I thought there was a compare-by
17:02ossarehHey, I've a deftype which the defprotocol P implements the "talk" functions of. When im in other-ns and I import P I cannot call "talk" on P.
17:03chouserlike (defn compare-by [f] (fn [a b] (compare (f a) (f b))))
17:03hiredmanossareh: a protocol creates a group of functions
17:03ossareh(talk (P.)) => "Unable to resolve symbol: draw in this context"
17:03hiredmanuh
17:03ossarehs/draw/talk/
17:03sexpbot<ossareh> (talk (P.)) => "Unable to resolve symbol: talk in this context"
17:03chouser& (sorted-set-by #(compare (:date %1) (:date %2)) {:date 5 :name "foo"} {:date 3 :name "bar"} {:date 8 :name "baz"})
17:03sexpbot⟹ #{{:date 3, :name "bar"} {:date 5, :name "foo"} {:date 8, :name "baz"}}
17:04hiredmanand you don't create instances of a protocol
17:04ossarehhiredman: huh... I'm clearly in need of some education.
17:04ossareh:)
17:04hiredmanossareh: right, so go do some reading
17:07dnolenossareh: defprotocol and deftype/record are a bit abstract, easy to be confused at first. Joy of Clojure probable does the best job in explaining them.
17:12cpfrIf I am creating a graph structure that I want to be lightweight, should I use defstruct or defrecord?
17:12danlarkincpfr: neither
17:13cpfrdanlarkin, what should I use? maps and edgelists?
17:14danlarkinyup
17:16cpfrdanlarkin, when is using a defstruct or defrecord appropriate?
17:17danlarkincpfr: defstruct is never appropriate imo
17:17danlarkindefrecord is appropriate when used in conjunction with protocols
17:18danlarkinbut it's not right to use when what you really want are hash maps
17:18birdspiderhello, is it possible to use defprotocol/deftype with gen-class ? (and AOT)
17:18cpfras I understand protocols is for doing multimethod like things efficiently
17:19chouserdanlarkin: I think it's ok to use defrecord when you have a lot of hashmaps with the same keys. Sames time and memory, with very small downside.
17:20chouserSaves
17:21chouserbirdspider: yes, though if you're using gen-class for anything other than interop with existing Java code or creating static methods, there's probably a better way.
17:22dnolencpfr: if you want something to be very light weight, I would use deftype. But I would start with map and work backwards.
17:23dnolenthere are even many costs with defrecord - i.e. lookup time in collections.
17:23birdspiderchouser, i'm interoping (well experinmenting with)
17:23chouserdnolen: how is defrecord heavier than deftype when you wan something like a map?
17:25dnolenchouser: sorry I missed the part where he said he needed it to be like a map. then sure.
17:25mefestoHey everyone. I'm implementing a web service using jax-ws and want to use clojure for the impl. I'm using maven w/ the jaxws plugin which generates artifacts from an existing wsdl. It seems that the clojure-maven-plugin cannot see these generated artifacts and fails to compile. Does anyone know if there is a way to configure the classpath for the clojure-maven-plugin?
17:26stuartsierraI don't know, but the clojure-maven-plugin Google Group probably will.
17:26mefestostuartsierra: thanks, i should've checked
17:27stuartsierraI meant you'll probably have to ask there… that's a question for Mark Derricut (plugin author)
17:39mefeston/m my problem was completely user error :)
17:47birdspiderchouser, what could it be if the defprotocoll and reify things work in clojure but AOT gives me a "java.lang.ClassNotFoundException: test.withclass.H (withclass.clj:9)" clj: http://pastebin.com/AFj4G6Ew java: http://pastebin.com/grAt03Qy
17:54chouserbirdspider: sorry, won't be able to look at it just now
17:56birdspiderchouser, kk
17:58vilfredoI'm trying to run through the compojure getting starting, but hitting 'Wrong number of arguments to repl task. \n Expected ([] [project])'
17:58vilfredowhat is this beginner missing?
18:00joegalloIs your current directory in a place that has a project.clj file?
18:00joegalloYou might need to cd to the right place.
18:00technomancyvilfredo: sounds like the compojure tutorial is out of date
18:01technomancyjust do "lein repl" without any arguments, then (use 'whatever.namespace) that the tutorial needs
18:02vilfredoperfect. Cheers
18:19ossarehso I've read chapter 9 of The Joy of Clojure - so now I have a defprotocol that has a couple of methods on it and a defrecord that implements those methods. I guess the only thing that is tripping me up is accessing the methods on the record from a different NS.
18:21hiredmanthey are not methods
18:21hiredmanthey are functions
18:21ossarehyou're right. I meant that.
18:25ossarehthough that is a hard distinction to keep in mind given nearly everything refers to the functions on defrecords as methods. case in point (doc defrecord):
18:25ossareh,(doc defrecord)
18:25clojurebot"([name [& fields] & opts+specs]); Alpha - subject to change (defrecord name [fields*] options* specs*) Currently there are no options. Each spec consists of a protocol or interface name followed by ...
18:41birdspideri have a defprotocol and a call to reify which works as expected in repl, given I want to pass the reify generated object pack to java, what should I do in gen-class:methods ?
18:47qedwhoa. the little schemer book /is/ awesome. i had no idea about the format.
18:50replacaDoes anyone know if there's a maven command that takes a package name and version number and gives me a jar?
18:51Munksgaardqed, cool, i've considered buying it! What's it like?
18:52qedMunksgaard: There are two columns on every page. The column on the left asks a question like: What is (car (car l)) where l is (((hotdogs)) (and) (pickle) relish)
18:53qedThe column on the right says: (hotdogs)
18:53qedthe preceding question was: the same except it was (car l) instead of (car (car l)), the right column explains: ((hotdogs)), because (car l) is another way to ask for "the car of the list l."
18:54qedWhat is (cdr l) where l is ()? Right column: No answer.(1) You cannot ask for the cdr of the null list. footnotes: 1. (L: nil)
18:55qedand so on and so forth, slowly building you up from these basic components to the bigger ideas
18:56qedit's a really cogent way of explaining the process that a lisp programmer takes in everyday programming -- start with these basic things and combine them, evolve them, etc.
18:57brehautmunksgaard: it will take someone from no lisp understanding right through to the Y combinator and bit further
18:57Munksgaardsounds great! maybe i can find it on offer somewhere
18:57qedbrehaut: yeah I'm glancing at the back of the book -- this is pretty amazing.
18:57brehautqed yeah i really like it
18:58qedyou could literally read this in an afternoon
18:59qedi wonder -- has anyone "ported" this book to clojure? that could be fun.
18:59qedaww, yes, several people have in fact.
19:00Munksgaardjust searching for the little schemer on google, and the little lisper pops up too, looks like an older version (obviously using a different language too), is that correct?
19:00qedso... reading list for the next few months: land of lisp, the little schemer, lisp in small pieces, and create your own freaking awesome programming language
19:01brehautMunksgaard: i think so yeah.
19:01brehautMunksgaard: theres an equivalent book for smalltalk somewhere too
19:01brehautMunksgaard: 'A Quick Trip to ObjectLand' i think
19:01qedhm -- i didnt even think to google for the little lisper -- i guess i just assumed scheme and lisp were close enough and looking into scheme could be interesting
19:02qednow im wondering if i made the right choice
19:02brehautqed the schemer version is the more famous i think
19:02qedeveryone recommended the little schemer to me
19:02qedbrehaut: any particular reason why?
19:03brehautqed: i tihnk be because scheme is a 'cleaner' (not trying to start a war!) lisp, the book is able to teach ideas without some of the language getting in the way that might exist for say CL
19:03Munksgaardmakes sense
19:03brehautit really is a book a bout thinking computationally rather than just a 'learn lisp' book
19:03qedi dont know enough scheme to agree with that, nor enough CL
19:04qedbrehaut: now that makes more sense
19:04brehautthe TL;DR; history is CL is the Big, kitchen sink lisp designed by a committee of Lisp venders, and scheme is the tiny elegant science experiment devised by Steele
19:05brehautbut i think that does a disservice to both
19:05Munksgaardplease do elaborate
19:06Munksgaard:-)
19:06brehautwell, you will want to read http://www.paulgraham.com/thist.html
19:06brehautits related
19:07Munksgaardanother side added to my loooong reading-list
19:07Munksgaardanyone acquainted with The Seasoned Schemer, supposedly a sequel to the little schemer?
19:07ChousukeCL was cobbled together from existing Lisps, Scheme was built from the ground up. :P
19:09brehautChousuke: hah :)
19:10qedMunksgaard: there's the reasoned schemer, the seasoned schemer, and the little schemer
19:11qedim not quite sure on the order you're supposed to read them. being reasoned vs being seasoned, seasoned seems more senior-ish but i'm not entirely confident
19:11brehauti think seasoned is the followup to little
19:11brehautreasoned is sort of an aside. dnolen could tell you; hes ported the miniKanren library from the reasoned schemer to clj recently
19:12birdspiderany idea what could possibly induce such line number behaviour ? http://pastebin.com/ndkaGmPv
19:13brehautminiKanren in clj: https://github.com/swannodette/logos
19:27octe% ()
19:28octe,()
19:28clojurebot()
19:28octe,(map (fn [x] x) '("a" "b"))
19:28clojurebot("a" "b")
19:28octe,(defn read-level [fn] (map (fn [x] x) (streams/read-lines fn)))
19:28clojurebotDENIED
19:29octe,(defn read-level [fn] (map (fn [x] x) '("a" "b")))
19:29clojurebotDENIED
19:29octehmm
19:29octe(defn read-level [fn]
19:29octe (map (fn [x] x)
19:29octe (streams/read-lines fn)))
19:30octegives me Unable to resolve symbol: x in this context
19:30octestrange
19:30hiredmanocte: no it doesn't
19:30brehautocte, identity will save you two chars on those maps ;)
19:31octewell i was reducing it since i got that error
19:31octethere's more done in the fn
19:31hiredmanright, and the fn you pasted could not ever get you that error
19:31hiredmanso you reduced it wrong
19:31octestrange, maybe some slime / swank issue then
19:32hiredmanI doubt it
19:35clizzinI have a macro looks something like this (defmacro foo [strs] `(hash-map :bar ~(str/join \, strs))). However, if I pass in a symbol for strs, i.e. i pass in x, when previous i had (def x ["a" "b" "c"]), this expands to (hash-map :bar "x") instead of (hash-map :bar "a,b,c"). How can I further unquote x so that I get the result I want?
19:36clizzinsorry if that's not very readable, let me know if i can make it easier to read
19:37clizzinmacro that looks something like this: *
19:42Chousukeclizzin: you can't, really.
19:42Chousukeor shouldn't, because it's really hacky.
19:43Chousukeany solution will only work for def'd global values.
19:44Chousukeclizzin: basically you'd have to do in your macro (eval strs) to get the value of x instead of the symbol, and that only works if x is a global.
19:46clizzinChousuke: would i be able to bind ~x to an autogenerated symbol and then eval that symbol?
19:46ChousukeYou might be able to use the implicit &env parameter that is passed to macros but that too feels pretty hackish
19:46Chousukeclizzin: there's no ~x at macroexpansion time. (there's just the strs parameter)
19:47clizzinwhoops, sorry, i meant ~strs
19:47Chousukewhat would that help?
19:47Chousukeyou would have to generate code that evals something, which is almost never what you want to do
19:49Chousukein this particular case, why are you even using a macro though?
19:49Chousukethat looks like something a regular function can do just fine
19:49jjidowhat is the equivalent of indexOf in Clojure?
19:50Chousukefor Strings?
19:50jjidoyes
19:50ChousukeI guess that would be .indexOf :P
19:50jjido:(
19:50clizzinChousuke: the macro actually defines a variable, and the name of that variable is an argument to the macro. the version i put before was simplified.
19:50Chousukesince Clojure Strings are Java Strings
19:51jjidoChousuke: but Java methods are not first class
19:51Chousukejjido: wrap them in a function
19:51clizzinChousuke: the actual macro looks something like (defmacro foo [var files] `(def ~var {"key1" "value1" "key2" ~(str/join \, files)}))
19:51Chousukeclizzin: right.
19:52Chousukeclizzin: you cal always generate code that does `(def ~var {key val key2 (str/join \, ~files)})
19:53Chousukeclizzin: ie. doesn't actually do the joining at macroexpansion time.
19:53pdk`(doc some)
19:53clojurebot"([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
19:53pdk`(doc all)
19:53clojurebotGabh mo leithscéal?
19:53pdk`(doc none)
19:53clojurebotNo entiendo
19:54clizzinChousuke: that was my initial thought, but the str/join part becomes (join \, [file1 file2]), and that requires that 'join' exists in any namespace that i call the macro from
19:55Chousukeclizzin: well, yeah
19:55clizzinChousuke: and it seems silly to write something that requires a use/require in the calling namespace. shouldn't it be more self-contained?
19:55Chousukeor actually it requires that the namespace is require'd
19:56Chousukehm
19:56Chousukeclizzin: well you have two choices really
19:56Chousukeclizzin: make it work with literals only, or make it require str/join
19:56Chousukeat runtime
19:57Chousukeany other solution will most likely be really hacky and brittle :P
19:57clizzinChousuke: what is the danger of eval in a case like this?
19:57clizzinit seems to be the most straightforward solution on face
19:58Chousukewell if you do (let [x ["some" "stuff"]] (foo varname x)) it won't work
19:59Chousukeand even though you can inspect the local environment from a macro and theoretically make that case work, then you need to deal with (let [x [some variables]] (foo varname x))
19:59Chousukeit's a lot of work and prone to breakage.
20:00clizzinhmm okay
20:01Chousukein fact, dealing with (let [x [(some-function blah) ...]] (foo varname x)) is probably nigh impossible :P
20:01Chousukeyou'd have to do code walking
20:02Chousukeand that's never a good sign
20:02clizzini see. unfortunate. what is the danger of designing macros such that macros take on the same bindings as the call?
20:07Chousukeclizzin: same bindings?
20:10clizzinChousuke: hmm that may not actually make sense now that i think about it. let me mull it over, and i'll come back if i can't see an issue with it. thanks for your help!
20:10Chousukeclizzin: your problem here is that you want your macro to generate different code depending on the runtime value of x, instead of the symbol x
20:11Chousukeclizzin: in other words, the parameter to the macro can only be the symbol x, not what the symbol x represents at runtime.
20:11clizzinChousuke: right, i think this is what i was starting to realise...that the idea of bindings from the call don't make sense in a macro.
20:16jjidowhat does (or) expand into?
20:17tomoj$(macroexpand-1 '(or x y))
20:17tomoj,(macroexpand-1 '(or x y))
20:17clojurebot(clojure.core/let [or__3470__auto__ x] (if or__3470__auto__ or__3470__auto__ (clojure.core/or y)))
20:19jjidotomoj: thanks. I can't make sense of it
20:20tomoj(or x y) = (let [foo x] (if foo foo y))
20:20jjidook
20:21tomoj(or x y z) = (let [foo x] (if foo foo (let [bar y] (if bar bar z))))
20:22jjidoI see.
21:51brehautwhy does clojure.xml/emit and family use println for the xml text rather than returning it ?
21:54_atoso that it doesn't have to keep the entire XML output in memory
21:55_atowrap it in (with-out-str ...) if you need a string of it
21:55brehautoh right. cheers
22:10gertalotI'm trying to apply a function to every value of a map, and return a map. Is there an easier way than doing this?
22:10brehaut(into {} (map (fn [[k v] (fun k v)) source-map)
22:10brehaut)
22:10brehauti think
22:11gertalot,(apply hash-map (flatten (map (fn [kv] [(key kv) (* 2 (val kv))]) {:a 1 :b 2})))
22:11clojurebot{:a 2, :b 4}
22:11gertalotinto? cool
22:11brehautinto is great
22:11brehautgeneral purpose pouring stuff into collection fun
22:11_atoanother variant: (zipmap (keys m) (map f (vals map)))
22:11gertalotsee, everytime I dream up something convoluted and difficult it turns out there's already a function for it
22:11gertalotahh
22:12gertalotdidn't think of that
22:12gertalotawesome
22:12brehaut_ato wins
22:12gertaloti agree.
22:12gertalotthanks everyone!
22:13_atothere's also clojure.contrib.generic.function/fmap but that means pulling in a library ;-)
22:13_atoclojure.contrib.generic.functor/fmap, I mean
22:13_atohttp://clojure.github.com/clojure-contrib/generic.functor-api.html
22:14_ato,fmap
22:14clojurebotjava.lang.Exception: Unable to resolve symbol: fmap in this context
22:14_ato,(use 'clojure.contrib.generic.functor)
22:14clojurebotjava.io.FileNotFoundException: Could not locate clojure/contrib/generic/functor__init.class or clojure/contrib/generic/functor.clj on classpath:
22:14_atomm, thought so
22:21brehautim having a documentation fail regarding defrecords. how does clojure define accessors for the fields?
22:28_atobrehaut: not sure I understand your question. You can access fields with (:field some-record)
22:28brehautah right :)
22:28brehautcheers :)
22:28tomojin protocol method definitions, just pretend the field list is like defn's
22:28tomojyou can use those symbols to refer to the fields
22:29tomojfor self-access
22:29IntertricityCan anyone suggest a book for a programmer with no experience in java, just C and Python?
22:29KirinDaveIntertricity: Yes.
22:29KirinDaveIntertricity: SICP.
22:29IntertricityI was hoping for a clojure book >.>
22:29KirinDaveIntertricity: But for Clojure? :D
22:29IntertricityYes :P
22:30KirinDaveIntertricity: The book I am working on is for people who know either Java or Ruby/Python. But it's months from being even in beta.
22:30Intertricityaw ntus
22:30Intertricity*nuts
22:30brehautIntertricity: joy of clojure?
22:31Intertricitybrehaut, I can look that one up, thanks :)
22:32brehautIntertricity: its in beta/MEAP ATM
22:32IntertricityWhat's meap?
22:32brehautim from a python/javascript background and ive enjoyed it thus far
22:32brehautmeap is manning (the publishers) pdf beta program
22:35tomojyou will probably want to learn how to read javadocs someday :(
22:35KirinDavebrehaut: I love JoC, but I felt like it wants more java proficiency.
22:35IntertricityOoh I see
22:36IntertricityI'm learning clojure to use it on the CLR
22:36tomojoh
22:36tomojthen..
22:36Intertricityafter seeing the first bits of clojureclr showing up in binary
22:36tomojyou will not need to read javadocs
22:36Intertricityheh :P
22:36tomojdoesn't such a clojurist need to write most everything from scratch?
22:37tomojhow much of contrib has been ported, I wonder?
22:37brehautKirinDave: maybe? I learnt and used java in 2001-2003 and havent used it since and havent found that to be an impediment for JoC 
22:37Intertricitythere's a .Net library I plan to use
22:37KirinDave.net?
22:37Intertricityyeah, clojureclr gives access to .net
22:38tomojhuh
22:38tomojcould use that for f# interop I suppose?
22:39brehauttomoj, presumably you would just expose your F# with classes and consume them from clojureclr just like you consume them from C#?
22:39tomojI guess, I don't know f#
22:39brehautive only dabbled
22:40tomojlooks like even lamina won't work :(