#clojure logs

2010-10-22

00:14_rata_well... I've finally bound the keyseq C-S-right to what M-x right does and the same for left... much better than M-x right
00:15_rata_at least it allows me to change many buffers in one row
00:17_rata_(does "in one row" mean "at the same time" or something similar in english?)
00:26amalloy_rata_: "in a row"
00:29_rata_amalloy: thanks :)
00:30LauJensenGood morning
00:31_rata_good morning LauJensen
00:32amalloymorning LauJensen
00:35_rata_I need something like atoms or refs but immutable... I've been thinking of this problem a lot a yet can't figure out a solution
00:37_rata_maybe something lazy is the solution
00:37_rata_I haven't think of that yet
00:37LauJenseneh?
00:37LauJensenYou need something like a mutable construct, yet immutable?
00:37_rata_s/think/thought/
00:37sexpbot<_rata_> I haven't thought of that yet
00:38_rata_I need refs just to have mutually-referring things, not for the mutable part
00:38amalloyheh, sounds like the named anonymous functions we were discussing a few hours ago
00:38LauJensenhehe
00:38LauJensen_rata_: What are you working on ?
00:39_rata_a continuous-time Markov chain (CTCM) simulator
00:40_rata_but for a special language called kappa
00:40LauJensenOk. Since refs/atoms only exist to allow mutability, Im guessing you mean you want immutable because you want to drive progress by function application ?
00:41_rata_indeed the project is named clj-kappa... I wasn't really very original on the name :P
00:41LauJensenwhy not kapjure? :)
00:41LauJensenkapjure the flag?
00:42_rata_hahahaaha that's a nice name :)
00:42_rata_thank you very much for the idea
00:42_rata_I'll propose it
00:43LauJensennp :)
00:44_rata_I want immutable just because I prefer it
00:44_rata_I'd like to have a function gen-event that creates a new states based on the rules and the prior state... I wouldn't like it to mutate the prior state
00:45amalloyand mutable because it's easier :)
00:46_rata_hahahaha... no, I don't want mutable... I just wanted refs for referring to kappa agents from other kappa agents
00:46_rata_maybe lazyness can help me there
00:47LauJensen_rata_: it says like you need a sequence [state0 state1 state2] etc
00:47_rata_just a random intuition... probably I'm wrong
00:48_rata_LauJensen, yes, I'd love to be able to generate such a sequence
00:48_rata_perhaps that's too much in memory though
00:49LauJensenWell you're in luck. Clojures standard vector will do just fine. Build it with map, conj, for, or whatever makes sense for your application
00:49_rata_hahahahaha... the problem is generating the states and defining the state
00:49amalloyi think rata's dream is to have, within a state, objects that refer to each other
00:50_rata_yeah, that's it
00:50amalloyit's a dream i can sympathize with
00:50_rata_:)
00:52_rata_I've thought of having an id for each kappa agent and then, instead of having seqs as collections of kappa agents, to have maps id -> kappa agent
00:53amalloy_rata_: that's really the only way you can do it immutably
00:53_rata_lazy isn't useful for this?
00:53_rata_s/lazy/lazyness/
00:53sexpbot<_rata_> lazyness isn't useful for this?
00:54amalloyi don't see how it will help, but i'd love to be enlightened
00:55_rata_maybe a trip to #haskell land will enlighten me too :)
00:56LauJensen_rata_: Im quite convinced you'll come back with monads
00:56_rata_hahahaahaha :)
00:56_rata_I don't understand them yet... so the trip would become a long one
00:56amalloyyes, monads are like a disease, except also magic
00:57amalloy,domonad
00:57clojurebotjava.lang.Exception: Unable to resolve symbol: domonad in this context
00:57amalloy,clojure.contrib.monad/domonad ;?
00:57clojurebotjava.lang.ClassNotFoundException: clojure.contrib.monad
00:57LauJensen_rata_: monads are what you do when you dont have reference types
00:57LauJensen(+ a little extra)
00:57KirinDaveFigured out the ab thing I was experiencing
00:58KirinDaveab consideres a request a failure if content-length changes over the duration of the test
00:58_rata_LauJensen, that's interesting... maybe they could be useful and I'm not even taking them into account
00:59amalloy_rata_: one classic use of monads is the ability to simulate mutability in a functional way
00:59_rata_do you have a good reference for learning about monads?
00:59amalloy$google clojure monad tutorial amalloy
00:59sexpbotFirst out of 3 results is: #clojure log - Oct 07 2010
00:59sexpbothttp://clojure-log.n01se.net/date/2010-10-07.html
01:00amalloyboo, it's not in there
01:01amalloy_rata_: try http://intensivesystems.net/tutorials/monads_101.html
01:01amalloyi found it enlightening and challenging
01:05ymasorysorry of this is a dumb question, but what separates clojure's typing from python-style duck-typing? is there a difference?
01:08amalloyymasory: it's basically the same. i don't know about the internals of python, but clojure will call methods on any object so long as those methods exist. what it won't do is implicitly convert to "equivalent" types in order to make an operation work
01:08amalloy,(+ "1" 5)
01:08clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
01:08amalloy,(.length 5)
01:08clojurebotjava.lang.IllegalArgumentException: No matching field found: length for class java.lang.Integer
01:09amalloy,(.size [1 12])
01:09clojurebot2
01:09ymasoryamalloy: thanks
01:09amalloy,(.size "1 2 3")
01:09clojurebotjava.lang.IllegalArgumentException: No matching field found: size for class java.lang.String
01:09amalloy,(.size (seq "1 2 3"))
01:09clojurebot5
01:09ymasoryi'm so used to the term "duck typing" only being used in reference to python and ruby i was wondering why
01:09amalloyit's used in clojure a little
01:10ymasorywhy just a little?
01:10amalloybecause java is strongly typed, and clojure relies on the java type system, it has to be strongly typed at some level
01:11ymasoryright
01:12ymasorythanks again
01:23kumarshantanu,(binding [*assert* false] (assert false))
01:23clojurebotjava.lang.AssertionError: Assert failed: false
01:24kumarshantanuam I missing something in the assert? I thought it is supposed to return nil
01:25amalloy,*assert*
01:25clojurebottrue
01:25amalloy,(binding [*assert* false] *assert*)
01:25clojurebotfalse
01:26amalloy,(doc assert)
01:26clojurebot"([x]); Evaluates expr and throws an exception if it does not evaluate to logical true."
01:28tonyl,(source assert)
01:28clojurebotjava.lang.Exception: Unable to resolve symbol: source in this context
01:28amalloy~source assert
01:28tonylcool source
01:29tonyl,(binding [*assert* false] (assert false))
01:29clojurebotjava.lang.AssertionError: Assert failed: false
01:29tonylshould've return nil then
01:29amalloy,(let [*assert* false] (assert false))
01:29clojurebotjava.lang.AssertionError: Assert failed: false
01:29amalloyhm
01:29kumarshantanuthis http://clojure.org/special_forms#toc10 seems to say that *assert* can control whether the assertion actually takes place
01:30tonylwhich means if *assert* is false it won't take place
01:31tonylshouldn't throw an exception, as the doc says
01:31amalloy,(var *assert*)
01:31clojurebot#'clojure.core/*assert*
01:31amalloy,(meta (var *assert*))
01:31clojurebot{:ns #<Namespace clojure.core>, :name *assert*}
01:31kumarshantanu,(binding [*assert* false] (with-bindings (assert false)))
01:31clojurebotjava.lang.AssertionError: Assert failed: false
01:32tonylthat's peculiar
01:32kumarshantanubug?
01:32tonyl~source when
01:33amalloykumarshantanu: seems unlikely. it's a pretty un-subtle feature; if there were a bug i doubt we'd be the first to notice
01:34kumarshantanuI am behind a proxy that won't let me see the source (the tinyurl one), but never mind
01:34tonyljust type (source assert) in your clj repl
01:35kumarshantanutonyl: yup
01:37tonyl,(binding [*assert* false] (when *assert* "im here"))
01:37clojurebotnil
01:37amalloyi think the issue is that assert, being a macro, has no access to the current value of vars
01:38tonylyeah, it seams it is a macro evaluation problem
01:38tonyl*seems
01:40tonyla macro is just a fn isn't it?
01:41amalloymacros are functions with two special properties
01:41amalloytheir arguments are not evaluated - they take the forms passed in as literals
01:41amalloytheir return value is expanded in place as code
01:42amalloyi suspect the issue is that *assert* is special
01:42amalloyif you rewrite the assert macro so that it looks at a different var, it behaves fine
01:42tonylso the (when *assert* part of the assert macro should still be accessed
01:43kumarshantanu,(binding [*assert* false] (if *assert* (assert false))) ; +yay!+
01:43clojurebotnil
01:44tonylthat is as much as I know of macros
01:44tonylmaybe somebody in the group would know more about it. If it is a bug of not
01:45tonyl*or not
01:46tonylwell i am leaving, laters. and anybody at conj have fun and take video of the talks :P please
01:48amalloyquel bafflement
01:48amalloybut i'm gonna follow tony's lead. night folks
01:48kumarshantanuI posted the question on the list
01:49kumarshantanuamalloy: thanks
04:44esjYello
04:47angermanh
04:47angermani
06:27bOR_small question on namespaces and emacs development. If I C-c C-r my (ns burrows.core ... ... ) function, I cannot just do another C-c C-r with (in-ns 'burrows.core), but have to copy-paste that to the slime-repl. I am probably just not understanding something
06:28bOR_anyone knows what? :-)
06:28bOR_e.g. (in-ns 'burrows.core) doesn't switch the namespace in the repl window.
06:29raekakhudek: glad to help! i cloned your fork and from what I can tell, it works perfectly.
06:29raekakhudek: (seq "flüggåɘnkð€čhiœßølʃênn") returns a sequence of the consistituent characters correctly (an easy test for encoding issues)
06:30raekbOR_: yes, slime keeps a file-namespace mapping
06:30raekbOR_: try C-c M-p
06:31raekit changes the repl namespace to the on of the current file
06:31bOR_thanks!
06:31raek(it is listed at http://github.com/technomancy/swank-clojure, among other very useful commands)
06:34bOR_raek do you know what the function is that is tied to C-c M-p? Want to try if I can just call that function when I block-select a large part of my file with C-c C-r
06:35raekwell, you can find out with C-h k
06:37raekbOR_: for me C-h k C-c M-p gave "C-c M-p runs the command slime-repl-set-package"
06:37bOR_thanks for the education. made a note :-)
06:37raekEmacs is a big world
06:37raekI don't judge you... :)
07:04G0SUBConj goers, are you ready?
07:06esj*sniff*
07:24Uppercut, (seq "1 2 3")
07:24clojurebot(\1 \space \2 \space \3)
07:24Uppercut(seq (1 2 3))
07:24Uppercut, (seq (1 2 3))
07:24clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
07:24Uppercutok
07:25bartjUppercut, ?
07:28Uppercutjust a test to know if it prints "4"
08:02drewrwhat's for breakfast?
08:04esjthe ill conceived preconcepiton of mutabilitly !
08:04esj*BAM**
08:04esjand then the ravenous hord of Clojurians
08:05esjwill turn on any other silly traditions that dare show their face
08:05esjand in my case - more coffee, as I'm clearly lacking...
08:12Uppercut, (fn [& vals] (map #(apply % vals) 20)
08:12clojurebotEOF while reading
08:12Uppercut, (fn [& vals] (map #(apply % vals) 20))
08:12clojurebot#<sandbox$eval5082$fn__5083 sandbox$eval5082$fn__5083@5805bc>
08:13BahmanHi all!
08:14esjwotcha
08:26Uppercut, (1 to 50) map(r =>r*r) toSet
08:26clojurebotjava.lang.Exception: Unable to resolve symbol: to in this context
08:26Uppercut, (1 to 50).map(r =>r*r).toSet
08:26clojurebotjava.lang.Exception: Unable to resolve symbol: to in this context
08:26Uppercut, (1 to 50).map(r =>r*r)
08:26clojurebotjava.lang.Exception: Unable to resolve symbol: to in this context
08:26Uppercut:/
08:26raekhrm, what language is that?
08:27raek(map (fn [r] (* r r)) (range 1 51))
08:27raek,(map (fn [r] (* r r)) (range 1 51))
08:27clojurebot(1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361 400 441 484 529 576 625 676 729 784 841 900 961 1024 1089 1156 1225 1296 1369 1444 1521 1600 1681 1764 1849 1936 2025 2116 2209 2304 2401 2500)
08:27raek,(for [i (range 1 51)] (* i i))
08:27clojurebot(1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361 400 441 484 529 576 625 676 729 784 841 900 961 1024 1089 1156 1225 1296 1369 1444 1521 1600 1681 1764 1849 1936 2025 2116 2209 2304 2401 2500)
08:27Uppercutyou´re right, was Scala. I need clojure too
08:28raekscala seems to be a neat language
08:29raekalso, toSet is (set the-collection) in Clojure
08:30Uppercuthmm
09:02vijaykiran,(time (apply + (distinct (concat (range 0 1000 5) (range 0 1000 3)))))
09:02clojurebot233168
09:02clojurebot"Elapsed time: 34.862 msecs"
09:03vijaykiran,(time (reduce + (distinct (concat (range 0 1000 5) (range 0 1000 3)))))
09:03clojurebot233168
09:03clojurebot"Elapsed time: 11.951 msecs"
09:07raekvijaykiran: variadic + uses reduce internally
09:08raekiirc, it is considered good style to use reduce for these cases (with exceptions for apply str and apply concat)
09:09vijaykiranraek: (clojure noob here) just started learning was wondering which one is better/faster
09:09tmarblehey, is there a separate channel for clojure-conj?
09:10raekok. they are the same in this case, since + with more than two arguments is implemented with reduce +
09:11tonylmorning
09:11vijaykiranraek: thanks!
09:12bforesterg'morning.
09:12raekbut if reduce makes sense for your function, use that variant instead
09:12raek(unless that function is str or concat)
09:12raeksince reduce can be more performant
09:21sempahHow can I iterate over a list -> passing each element + a second fix parameter to a given function and put each result of the function in a map?
09:22G0SUBwoohoo! At the Conj!
09:23AWizzArdGreetings :)
09:23jolyHello!
09:24sempahmy list: (def l '("a", "b", "c")) + my function: (defn f [s1 s2] (str s1 s2))
09:24tonylsempah: (map #(into {} (myfn % fix-param)) mylist)
09:24sempahnow I want a map/list with a+my second parameter passed
09:25raeksempah: my guess would be a (into {} (for [x coll] [...key... ...val...]))
09:25raekbut I might have misinterpreted the last requirement
09:25sempahok, lets say the fix parameter would be "d"
09:26sempahthe final map/list should be: "ad", "bd", "cd"
09:26sempahthe first letter comes from the list
09:26raek#(f % "d") gives a function that you can use in map
09:26sempahthe second from the fix parameter
09:27tonyl,(map #(str % "d") '("a" "b" "c"))
09:27clojurebot("ad" "bd" "cd")
09:27raek,(map #(f % "d") ["a" "b" "c"])
09:27clojurebotjava.lang.Exception: Unable to resolve symbol: f in this context
09:27raekright.
09:27raekalso, map + anonymous functions can also be expressed with 'for'
09:28raek,(for [x ["a" "b" "c"]] (str x "d"))
09:28clojurebot("ad" "bd" "cd")
09:28tonyloh yeah, destructing
09:28sempahfirst thx for the answers, have to evaluate em
09:29mike5160raek: i got emacs and everything up and running (on my 3rd attempt). just wanted to thank you for your input yesterday.
09:29raeknp :-)
09:35sempahthx raek and tonyl
09:35sempahit's really annoying coming from an imperative language -.-
09:36tonylbeen there (still there for some times :P)
09:38DrakesonHow does one refer to a sibling namespace (foo.bar.baz.x -> foo.bar.baz.y), without spelling out the common part (foo.bar.baz) ?
09:41raekDrakeson: in one way or another, you have to...
09:41raekthere is no special connection between namespaces that share prefixes
09:43raek(assuming you asked about how to do this inside one of the sibling namespaces)
09:43raek(ns foo.bar.baz.x (:require foo.bar.baz.y)) ; unavoidable
09:44raek(ns some.other.ns (:require (foo.bar.baz x y))) ; shortcut
09:58G0SUBfogus finished his talk. it was great.
09:59esjG0SUB: are there any video cameras in the room ?
10:00xkbyup, there's 2 herre
10:00esjxkb: that's awesome news, can't wait to see the talks
10:05tonylooh god, i wish i was there
10:06sempahI know immutabilty first, but how can I add a value to an existing list in a loop?
10:06sempahhave something like doseq ... list.add(value)
10:06Chousukeis it a mutable list? :P
10:07Chousukeif it isn't, then you need to restart the loop with a new list with the value added :)
10:07sempahthe default list is immutable or?
10:07Chousukeyes
10:08Chousukeie. (loop [l ()] ... (recur (conj l 1))
10:08Chousukeyour loop must be like a recursive function. You can't modify things, but you can "restart" the loop with new values
10:09esjsempah: but the general idiom is to return a NEW list, which is formed by cons'ing a value to an existing list, ala
10:09esj,(cons 1 (2 3 4))
10:09clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
10:09esj,(cons 1 '(2 3 4))
10:09clojurebot(1 2 3 4)
10:09esjbah
10:09tmarblewell
10:10ChousukeIf you're translating an imperative loop that usually means you'll have to spend some time thinking about how to express it recursively
10:10sempahbut I have a list that I want to print at the end of the loop
10:10Chousukesempah: then have the loop return the list, and print the return value of the loop
10:10G0SUBesj: yes. the videos will be uploaded.
10:11esjG0SUB: back in Her Majesty's Green and Pleasant Land, I am doing a little dance of joy :)
10:11G0SUBesj: haha!
10:11esjG0SUB: a video of which will _not_ be uploaded :P
10:11Chousukesomething like (print (loop [l ()] (if (done-with? l) l (recur (do-stuff-with l)))) :P
10:11G0SUBesj: lol
10:12Chousukewhere do-stuff-with returns a new list
10:12Chousukeand done-with? determines if the loop needs to terminate
10:13Chousukeof course I wouldn't recommend putting loop statements as function arguments
10:14tonyl,(print (loop [l '()] (if (= 5 (count l))) l (recur (cons :t l)))))
10:14clojurebotjava.lang.Exception: Too few arguments to if
10:14ChousukeIf you don't need the value of the list, you can just do (print l) instead of returning l. But even better might be making a function out of the loop
10:14sempahlooks a lil bit chinese to me :/
10:15ChousukeGood, idiomatic Clojure code contains relatively few explicit loops
10:15Chousukeusing higher-order functions and recursive functions is more common.
10:15raekoh, the Conj... how I wish I was there!
10:16raekunfortunately, the spacial-temporal-monetary interval was of too high magnitude
10:17esjsempah: Don't worry, take it slow and easy, and you'll get there. Its a real mind job at first.
10:17esjraek: :)
10:17tonyl,(loop [l '()] (if (= (count l) 5) (println l) (recur (cons :ty l))))
10:17clojurebot(:ty :ty :ty :ty :ty)
10:19tonyl,(loop [l '(), val 0] (if (= (count l) 5) (println l) (recur (cons val l) (inc val))))
10:19clojurebot(4 3 2 1 0)
10:20tonylis there a fn like cons that appends it to the end instead to the beginning?
10:20raeksempah: in my experience, it is far more common to compose functions in clojure's library than writing loops
10:20sempahdidnt finish to understand your first loop, u'll posting your 2nd :)
10:20raektonyl: lists can't do that, but vectors can
10:20tonylaah true
10:21Chousukethere's concat though
10:21raekwith conj
10:21Chousukebut don't overuse it
10:21Chousukedoing lots of concats adds up overhead
10:21Chousukeand eventually your stack will be blown :P
10:22tonylwhy? it holds the head?
10:22Chousukewell a concat creates a new lazy seq that holds a reference to both of the seqs that are concatenated
10:23Chousukeso if you concat something that's a result of a concatenation, you have one more level of indirection before you can get to the actual items.
10:23raekI think the result will be something like (concat () (concat (1) (concat (2) ((concat (3) (...)))))
10:23raekmodulo one of the parens
10:23hiredmandanlarkin: !!
10:24tonylooh got it
10:24tonyl,(loop [l [], val 0] (if (= (count l) 5) (println l) (recur (conj l val) (inc val))))
10:24clojurebot[0 1 2 3 4]
10:25raekconj works for lists too. (conj l e) ~= (cons e l)
10:26tonylyeah, but they are in descending order
10:26tonyl,(into '() (for [x (range 4 -1 -1)] x))
10:26clojurebot(0 1 2 3 4)
10:26tonyla bit simpler :P
10:27raek,(into () (range 4 -1 -1)) ; even simpler :P
10:27clojurebot(0 1 2 3 4)
10:27raek,(range 4 -1 -1) ; nevermind...
10:27clojurebot(4 3 2 1 0)
10:28tonyloh snap, yeah raek
10:28tonyli overthink it
10:28raekhrm, interesting way of implementing reverse
10:28tonylfor numbers
10:28hiredmaneven my mifi is lagged
10:29raek(defn reverse [coll] (into () coll))
10:29pbuckleyhiredman: you at the conj? laggy network?
10:29tonylis reduce faster than into?
10:29hiredmanyes yes
10:30pbuckleysame here
10:30tonylor "better" in any sense?
10:31esjtonyl: reduce is more general, hence into is better form if it does the job
10:31sempahhttp://paste.bradleygill.com/index.php?paste_id=58064 this is my function
10:31tonylesj: thanks
10:31sempahi'll pass in n = times, f = function, words = string, l = liste
10:32sempahit works, but I want to know the average time of the run
10:32raektonyl: (defn into [to from] (reduce conj to from))
10:32tonylinstead of testing speed within the function you could just make the function and call it like (time (testit ...))
10:33sempahwith a list, adding each runtime
10:33tonylraek: haha i see, i was fooled by into
10:33sempahyea I know the time macro
10:33sempahbut how I will get the average time
10:33sempahwith the time macro
10:33tonylthat's true
10:34sempahand I do not want "estimated time ..."
10:34danlarkinhiredman: internetsssssssssss!!!!!!!!!
10:34sempahso I thought a list, adding each time would do it
10:35hiredmandanlarkin: do you have soome?
10:35raekwhen doing quick tests, I have seen people using (time (dotimes [_ 1e6] ...)) to compare solutions
10:35danlarkinhiredman: I have plenty to share
10:36sempahwhat does 1e6 mean?
10:36esj1million
10:36tonylengineering notation
10:36raek,1e6
10:36clojurebot1000000.0
10:36tonyl1 with 6 ceros
10:36sempahyea I know what a million is ;)
10:37tonyl:P raek bit me to it
10:38tonyli haven't use dotimes but it seems more idomatic then system/nanotime average, but i don't know if dotimes affects the execution time
10:38esjsorry, i thought you'd asked, my bad.
10:38sempahhm
10:39tonylcool
10:39tonylhow is Conk?
10:39tonyl*Conj?
10:39sempahlooked some other jvm languages before, in scala/groovy there is something like: list.each { element => print(element.join(, ) }
10:40sempahis there something similar in clojure?
10:40sempah,(print '(1 2 3))
10:41clojurebot(1 2 3)
10:41esj,(map prn (interpose "," "The quick brown fox"))
10:41clojurebot(nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)
10:41tonyljust want to print each element in a list?
10:41sempahyes
10:41sempahmaybe format it
10:41sempah./join it with a ,
10:42esjwell, printing aside my example will do that
10:43esjsomething like
10:43esj,(apply str (interpose "," [1 2 3 4 5]))
10:43clojurebot"1,2,3,4,5"
10:43sempah;>
10:43esjif i understand ?
10:44sempahyes
10:44sempahthis it what I wanted
10:44esjcool
10:49tonyl,(map prn (interpose "," "the quick brown fox"))
10:49clojurebot(nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)
10:49tonyl,(map prn (interpose \, "the quick brown fox"))
10:49clojurebot(nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)
10:49tonyl,(interpose \, "the quick brown fox")
10:49clojurebot(\t \, \h \, \e \, \space \, \q \, \u \, \i \, \c \, \k \, \space \, \b \, \r \, \o \, \w \, \n \, \space \, \f \, \o \, \x)
10:50tonyl,(apply str (interpose \, "the quick brown fox"))
10:50clojurebot"t,h,e, ,q,u,i,c,k, ,b,r,o,w,n, ,f,o,x"
10:50tonyl,(apply #(str % "#") (interpose \, "the quick brown fox"))
10:50clojurebotjava.lang.IllegalArgumentException: Wrong number of args (21) passed to: sandbox$eval5204$fn
10:55sempahgtg
10:55sempahthx for all your help :)
11:00G0SUBLuke van der Hart talking about Clojure Zippers.
11:07esjG0SUB: keep turning that knife buddy ! :P
11:09esjG0SUB: I'm just kidding :)
11:22edoloughlinNice chat implementation with history and linking of responses to oroginal posts at stackoverflow.com. Clojure room is at http://chat.stackoverflow.com/rooms/68/clojure
11:28Drakesonhow do call a function and get a vector of it's printed output and its returned value?
11:29qbgThe latest master causes the following error for me: http://gist.github.com/640760
11:30tonylDrakeson: what kind of value does the function print and returns?
11:30tonylDrakeson: sounds like a work for the vec function
11:32tonylqbg ^double should be ^Double
11:33tonylqbg: I don't have the latest master so I can't check it right now
11:33qbgIf you remove the ArrayList type hint, it works
11:35Drakesontonyl: nevermind, thanks
11:35qbgSo currently primitive fns can only return an Object
11:38tonylDrakeson: np
11:38tonylqbg: isn't ArrayList an object
11:39qbgYes it is, but the return type of the function isn't Object
11:39tonyloh interesting, that defeats the point of type hinting fn's
11:40qbgWell, the interfaces that primitive fns use can only return double, long, and Object
11:40qbgWhich makes me wonder how that fn can be defined at all...
11:41tonylit seems that the only Object implementation is not supported to the interface level, but the fn level.
11:41qbgThis problem didn't exist with the older primitive fn system
11:42tonylno, i have 1.2.0 and it works fine with the code you posted
11:42qbg1.2 didn't have primitive fns
11:42tonylmaybe that is why :P
11:43qbgBefore in 1.3 you had to use ^:static, and in that system it worked
11:44qbgNow static is the default
11:45tonylok, that is better, then doto returns an Object
11:46tonylthat can break some code
11:46hiredmanqbg: not exactly
11:46qbgexplain
11:46hiredmannon-dynamic vars are not the same thing as static
11:48hiredmanwith static var resolution is only done at compile time, but with the new default non-dynamic vars var resolution is done at run time but cached
11:49qbgWith ^:static the fn had a known class so it could use a static method on it, hence the need for interfaces in the new system, right?
11:50hiredmanqbg: that doesn't scan
11:52qbgThe class of the fn was known with ^:static so the code could use a static call on it; since the exact class can't be known now (since ^:static is currently a nop), interfaces must be use for primitive support, and hence the limited options
11:52qbgRight?
11:52hiredmanI don't know anything about primitive support, just var resolution
11:56bforestershould I do this bit of code any differently?
11:56qbgWell, 358 (IIRC) interfaces were added to IFn
11:56bforester,(map #(reduce (fn [key value] (assoc (hash-map) key value)) (.split %1 "=")) (.split "A=3,B=4,C=234234" ","))
11:56clojurebot({"A" "3"} {"B" "4"} {"C" "234234"})
11:59raek(assoc (hash-map) key value) -> (hash-map key value)
11:59raek(fn [key value] (assoc (hash-map) key value)) -> #(hash-map %1 %2)
11:59qbg,(map hash-map (partition 2 (.split "A=3,B=4,C=234234" "=|,")))
11:59clojurebotjava.lang.IllegalArgumentException: No value supplied for key: clojure.lang.LazySeq@bd3
11:59bforestercan't nest the anon functions.
12:00raek,(for [x (.split "A=3,B=4,C=234234" ",")
12:00clojurebotEOF while reading
12:00bforesterwith the # macro
12:00raekeh
12:00raekanyway, map + anon fn -> for
12:01bforesterah
12:01bforesterI'll get that working: map + anon fn -> for
12:02qbg,(map #(apply hash-map %) (partition 2 (.split "A=3,B=4,C=234234" "=|,")))
12:02clojurebot({"A" "3"} {"B" "4"} {"C" "234234"})
12:04raek,(into {} (for [pair (.split "A=3,B=4,C=234234" ",")] (vec (.split pair "="))))
12:04clojurebot{"A" "3", "B" "4", "C" "234234"}
12:05raekor maybe this as a pre processing:
12:05Uppercut, (+ (map (fn [r] (* r r)) (range 1 51)))
12:05clojurebotjava.lang.ClassCastException
12:06Uppercut, (+ (map (range 1 9)))
12:06clojurebotjava.lang.IllegalArgumentException: Wrong number of args (1) passed to: core$map
12:06raekhrm, neverminf
12:06qbg,(apply + (map (fn [r] (* r r)) (range 1 51)))
12:06clojurebot42925
12:06Uppercut:)
12:07raek,(reduce + (for [r (range 1 51)] (* r r)))
12:07clojurebot42925
12:07Uppercutwith reduce cannott i use map?
12:07bforesterthanks raek, qbg
12:08qbgUppercut: explain
12:08Uppercut,(apply (reduce + (map (fn [r] (* r r)) (range 1 51))))
12:08clojurebotjava.lang.IllegalArgumentException: Wrong number of args (1) passed to: core$apply
12:08qbg,(reduce + (map (fn [r] (* r r)) (range 1 51)))
12:08clojurebot42925
12:08Uppercuthmm
12:08qbgapply needs a fn to apply
12:09Uppercut, (.contains (map (fn [r] (* r r)) (range 1 51))) 25)
12:09clojurebotjava.lang.IllegalArgumentException: No matching field found: contains for class clojure.lang.LazySeq
12:09raek,(let [x [1 2 3 4]] (apply + x))
12:09clojurebot10
12:09Uppercutand to check if a map contains a number
12:09qbg,(some #{25} (map (fn [r] (* r r)) (range 1 51))))
12:09clojurebot25
12:09raekthat is not map - the data structure
12:09qbg,(some #{26} (map (fn [r] (* r r)) (range 1 51))))
12:09clojurebotnil
12:11Uppercutdoes I need to iterate a data structure to check, one by one?
12:11qbgYes, since it is a lazy seq
12:11Uppercut, (map (fn [r] (* r r)) (range 1 11)))
12:11clojurebot(1 4 9 16 25 36 49 64 81 100)
12:12Uppercut, (dotimes [n(n+1)] "test" )
12:12clojurebotjava.lang.Exception: Unable to resolve symbol: n+1 in this context
12:14tonyl,(let [n 4] (dotime [n (inc n)] "test"))
12:14clojurebotjava.lang.Exception: Unable to resolve symbol: dotime in this context
12:14tonyl,(let [n 4] (dotimes [n (inc n)] "test"))
12:14clojurebotnil
12:15tonyl,(let [n 4] (dotimes [n (inc n)] (prn "test ")))
12:15clojurebot"test " "test " "test " "test " "test "
12:17Sweetsharkmeh, I meant clojure of cause. enclojure is likely just following suit as did others (swank-clojure f.e. says somehing about being GPL too)
12:18Uppercut, ,(let [n 40] (dotimes [n (inc n)] (if ( = 25 (map (fn [r] (* r r)) (range n (+ n 1)))) )true ))
12:18clojurebotjava.lang.Exception: Too few arguments to if
12:18raekSweetshark: which Clojure file are under GPL?
12:18Uppercuthelp
12:19qbgUppercut: What are you trying to do?
12:20Uppercutcheck if a number 25 exists in that list or Data structure de (1 4 9 16 25....)
12:20qbg,(boolean (some #{25} (map (fn [r] (* r r)) (range 1 51)))))
12:20clojurebottrue
12:20qbg,(boolean (some #{26} (map (fn [r] (* r r)) (range 1 51)))))
12:20clojurebotfalse
12:21qbg(you wouldn't need the boolean cast to use it in a conditional)
12:21Uppercutyeah
12:21qbg,(doc some)
12:21clojurebot"([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)"
12:21Sweetsharkraek: clojure is only EPL AFAIK, but at least enclojure has both GPL2/EPL1 headers in the source, swank-clojure seems to have been GPL2 once, but has moved to EPL1.
12:23tonyl,(map * (range 1 51)
12:23clojurebotEOF while reading
12:23tonyl,(map * (range 1 51))
12:23clojurebot(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50)
12:29raekSweetshark: from what I can tell from the license texts and from what I have heard from others, EPL'ed code and GPL'ed code can't be combined. (LGPL should be ok though)
12:30raekbasically, if code C = A + B, where A is GPL'ed and B is EPL'ed, the GPL requires C, and thus B, to be GPL'ed too
12:34raekI don't think Rich has any plans for releasing Clojure under the GPL. this has been discussed many times before, so if you browse the mail archive or the IRC logs, you could probably find the rationale for all this
12:34Sweetsharkraek: well, EPL allows relicensing (so in theory you could relicense to another license), but it has some restriction on how the stuff is allowed to be relicensed which is incompatible with the GPL. so enclojure is violating both the EPL and the GPL ...
12:35raekheh
12:37ohpauleezI thought you could now relicense to GPL3 from EPL? Maybe I'm thinking of Apache2 and GPL3 compatibility
12:37Uppercut, (sort-by val > (frequencies “abcdaabccc”))
12:37clojurebotjava.lang.Exception: Unable to resolve symbol: “abcdaabccc” in this context
12:37raekcompability with Apache2 was one of the goals of GPLv3, at least...
12:38ohpauleezahh ok, thanks raek
12:38Uppercut, (sort-by second (frequencies “abcdaabccc”))
12:38clojurebotjava.lang.Exception: Unable to resolve symbol: “abcdaabccc” in this context
12:38tonyl, (sort-by val > (frequencies (seq “abcdaabccc”)))
12:38clojurebotjava.lang.Exception: Unable to resolve symbol: �abcdaabccc� in this context
12:38raekbut I dunno about any GPLv3 and EPL specifics
12:38tonyl, (sort-by val > (frequencies (seq "abcdaabccc")))
12:38clojurebot([\c 4] [\a 3] [\b 2] [\d 1])
12:38tonylwrong quotes
12:39Uppercutah
12:39ohpauleezWho's at the conj today?
12:40Sweetsharkohpauleez: would not matter as the files in question are EPL1 and GPL2+classpath (no "or later")
12:41raekI'm not a lawyer, so take all this with a metric assload of salt
12:41ohpauleezSweetshark: ahh ok
12:42Uppercutwhat is the conj?
12:42raekthe first clojure conference
12:42raeki really wished I was there...
12:43raekhttp://first.clojure-conj.org/
12:45Sweetsharkoh, btw are there any other GUI-repls implementations available that are easily pluggable into an existing application. (I am thinking of adding a clojure repl to OpenOffice.org which is LGPL3+SCA to make the licensing insanity even more fun, so I am looking for something that is at least consistent with itself licensewise ...)
12:46ohpauleezraek: You and me both, had to cancel because of work
12:48Sweetshark(the OOo API isnt ttoo much fun in java because of all the static typing going on and it isnt too much fun in Basic because of ... Basic, but with clojure it could be really nifty ...)
12:53_rata_good "morning"
12:53ohpauleezgood morning
12:55raek_rata_: good morning (UGT)
12:58_rata_it's not really the morning here, but I'm just waking up... so it's my morning :)
13:01UppercutDo Speakers´s Conj join in this channel?
13:06raekmost of them hang around here, yes
13:07_rata_raek: I didn't know about UGT, great thing
13:07raekmakes greetings a lot simpler :-)
13:19polypusthis just tweeted: big ups to matt courtney of fgm (and #conjure!) for enabling recording talks.
13:19polypusguess they're recording, good to know.
13:21_rata_polypus, yes, they are recording :) I hope they upload them asap to do a mini-conj this weekend at home
13:22rlbWhat's the best way to detect eof from read, catch and check the exception, or create and pass in a unique eof token?
13:23rlb...and if the latter, what's clojure's equivalent of (gensym)?
13:23MayDanielrlb: (gensym)
13:23rlbMayDaniel: ahh, right -- just noticed.
13:24rlbSo probably just (read false eof-token) where eof-token was generated via gensym.
13:25raekrlb: I often do something like (let [eof-token (Object.)] ...)
13:25rlbraek: that's what I was really asking -- what's the cheapest unique value.
13:25raekthen just check for (= return-value eof-token)
13:26rlbI suppose (Object.) would probably be cheaper than (gensym).
13:26rlbThanks
13:26raekanother strategy would be to use a ns-quilified keyword
13:26raek,::eof-token
13:26clojurebot:sandbox/eof-token
13:46_rata_amalloy, I was finally kind of enlightened yesterday :)
13:46amalloyyeah?
13:46amalloyglad you found my reference useful
13:48_rata_but it wasn't in monads... it was in closures
13:48rlbIn guile it's possible to create an empty environment, and then populate it with only the bindings you want. Then you can call (eval form environment). Is something that possible in clojure?
13:48rlbIn particular for sandboxing?
13:48rlbs/something that/something like that/
13:49polypusrlb: at the repl, try (in-ns foobar)
13:49rlbThere's also a (safe-environment) that you can call and then adjust the result.
13:50rlbpolypus: right, I know about namespaces, I'm just wondering if they could/would be secure.
13:50polypus(in-ns 'foobar) i mean. given that you haven't already populated foobar, it will be clear of most (all?) bindings. as far as secure, i have no idea
13:50rlbi.e. you probably have to remove or override ".", etc.
13:52rlbI'm just wondering about feasibility. Such an approach can be nice because you can build s-expression actions (based on user input or whatever), and then just eval them in the safe envt.
13:52amalloyrlb: you could probably find out by looking at the source for sexpbot or clojurebot
13:52amalloythat's exactly what they do
13:52polypusamalloy: took the words right out of my mouth
13:52rlbamalloy: ahh, of course, excellent point -- I should have thought of that.
13:52amalloyclojurebot: source?
13:52clojurebotsource is http://github.com/hiredman/clojurebot/tree/master
13:52amalloy$source
13:53amalloy$ source
13:53amalloybah
13:53rlbThat certainly answers my main "is it feasible" question. Thanks.
13:53amalloyrlb: neither of them is perfectly secure yet though. it should be possible, but every so often someone finds a hole
13:53amalloy,eval
13:53clojurebot#<core$eval clojure.core$eval@c40ed6>
13:54nishantis this the right place to ask questions about the clojure slime-repl?
13:54rlbYeah, I suppose it doesn't *completely* answer the question, but they're certainly a good example of the problem.
13:55amalloynishant: sure. if it's complicated internals-stuff, you may be better off asking technomancy, but here's good
13:57_rata_amalloy, http://gist.github.com/641036
13:57nishantamalloy: Sometimes, the repl doesn't remember command history, so when I type META-p it prints "no previous note", I don't remember ever enabling/disabling anything related to history, so not sure what's wrong.
13:58amalloynishant: next time it happens check out what major/minor modes are active
14:00amalloyit sounds like REPL mode may have gotten disabled somehow; M-p will look for notes and compile errors if it's not overridden by the REPL mode binding
14:01nishantamalloy: the mode text is (REPL Slime[clojure{local}])
14:02amalloynishant: try M-x slime-repl-mode
14:03amalloy(i'm not an expert in emacs or slime, just guessing here)
14:05nishantamalloy: thanks, I restarted emacs, and it switched to the right mode when I reconnected to swank
14:08amalloy_rata_: i don't see what you're getting at with this gist
14:10_rata_if I have a kappa agent, i can ask it with which kappa agent is it linked to through his site "x"
14:10_rata_I just need that the last function call of each agent is called as-needed, not eagerly
14:11_rata_amalloy, ^
14:13amalloyhm. so you're creating a function get-linked-agent, which closes around the source agent in order to create an agent which refers back to the source
14:14_rata_yes, that's it I think
14:14nishant,dec
14:14clojurebot#<core$dec clojure.core$dec@1737301>
14:14nishant,(dec 5)
14:14clojurebot4
14:15amalloybut doesn't this have the same problem? a3 can't contain a function which closes around a3, because a3 doesn't exist yet
14:16_rata_no, that doesn't happen because the agent an agent closes around is parameterized
14:17_rata_so they musn't exist at the moment you create the agent, you can "bind" them later
14:17_rata_what does clojurebot when I ask him to evaluate (iterate inc 0)?
14:18amalloy_rata_: timeout
14:18amalloyor possibly he prints the beginning then chokes on max message length
14:18_rata_ok
14:18amalloyat any rate you won't kill him with that
14:18amalloy,(range)
14:19clojurebotExecution Timed Out
14:19_rata_ok
14:20_rata_is there something like Scheme's rec in clojure? (to create anonymous recursive closures)
14:21raek_rata_: (fn f [] ...)
14:21_rata_thanks :)
14:21raekin the anonymous function, f will refer to the function itself
14:22raekbtw, that is the only thing that (letfn [(f [] ...)] ...) does more than (let [f (fn [] ...)] ...)
14:23_rata_but (let [f (fn f [] ...)] ...) would be the same as the letfn expression
14:24_rata_amalloy, so, the minimal example would be ((fn f1 [b] {:x (b f1)}) (fn f2 [b] {:x (b f2)}))
14:25_rata_the return value of that is a kappa agent f1 linked to f2
14:26_rata_and putting (fn f2 ...) at the beggining would return the kappa agent f2 linked to f1
14:27_rata_is there anything like a lazy map?
14:28amalloy_rata_: not as a data structure. maps can't usefully be lazy like seqs
14:29_rata_amalloy, I know, it would be useful just for this case
14:29_rata_:(
14:29amalloy_rata_: you want a lazy mapping from one seq to some other seq. that's what the map *function* does
14:31_rata_mmmm... so I would need ((fn f1 [b] {:x (map b [f1])}) ...)?
14:32amalloyi don't know. i'm still not convinced that what you're trying to do is really possible in an immutable context. you can dance around with laziness or closures, but in the end you need an object that refers to itself, which is a chicken/egg problem
14:33amalloyi think the best you can do is have a global (or similar) map that tracks all the pointers, and have the agents themselves not know who they're next to without referring to the global map
14:36_rata_amalloy, you're probably right... but as you said me it was a common problem, I was trying to figure out a solution that's self-contained
14:41shanmuhi.. I am trying to use clojure.contrib.zip-filter.xml to extract a nodeset from an xml document.... is it possible?
14:41shanmuwhen I use (xml->) without a final text, then I get a nested list of vector/ map /lists with the elements repeated multiple times
14:44amalloyshanmu: i did this just yesterday. lemme go find it for you
14:45shanmuamalloy: thanks a lot! I am trying to understand how zip works.. a bit too abstract for me now...
14:49amalloyhttps://gist.github.com/54446f11e4e3dd85f998
15:09vibranthey ho!
15:09vibrantanyone alive?
15:09_rata_hi vibrant
15:09vibranthey rata
15:10vibranti'm trying to install penumbra, and i'm getting this error after running lein native-deps
15:10vibrantCaused by: java.lang.IllegalAccessError: default-repos is not public
15:12_rata_http://gist.github.com/641036 <- why stack overflow? the delay seems to be not working
15:14technomancyvibrant: probably an old version of lein-deps; try 1.0.4
15:14technomancys/lein-deps/native-deps/
15:14sexpbot<technomancy> vibrant: probably an old version of native-deps; try 1.0.4
15:14vibranti am using 1.0.4
15:15vibranti googled first and saw that bug/and the fix of it :)
15:15vibrantbut it didn't fix anything for me.
15:15technomancy=\
15:15technomancylein 1.3.1?
15:17vibrantnow that i run it, it fails with an error
15:18vibranti mean lein by itself, let me see what's the reason..
15:19vibrant1.1.0
15:19vibrant:)
15:22shanmuamalloy: many thanks for the pointer!! zip/children was the function I was after to return the nodeset :)
15:23vibranttechnomancy; now that i updated it works like a charm.
15:26rlbIs there a test like list? for a Cons?
15:26rlbNaively, I was surprised list? returned false there.
15:27MayDanielrlb: seq?
15:28rlbWon't work in this case -- need to omit set, map, string, etc.
15:28rlbI just want to test if something's a vector, list, or cons.
15:29rlbI can always just use (instance? Cons x)...
15:32MOOOOf
15:32fffLLL
15:36raekrlb: 'seq?' tests if it is a ISeq. it is not the same as 'seq'
15:37raek,(seq? (cons 1 nil))
15:37clojurebottrue
15:37raek,(seq? {})
15:37clojurebotfalse
15:37vibranthumm... now i get this: Exception in thread "main" java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol (opengl.clj:9)
15:37raek,(seq? (list 1))
15:37clojurebottrue
15:37amalloy,(seq? [])
15:37clojurebotfalse
15:38amalloy,(seq? "")
15:38clojurebotfalse
15:38amalloyrlb: looks like seq? does what you want
15:38raekPersistentLists and what you get from a seq call are pretty much the only things for which seq? returns true
15:39raekand conses, of course :-)
15:42raekvibrant: are you sure you have matching clojure and penumbra versions?
15:43vibrantraek; well.. i'm using la clojure which supposedly uses 1.1, but i think i deleted it and added 1.2 to lib/
15:43raekclj 1.2 and penumbra 0.5 goes together
15:43raek*clojure 1.1
15:44raekand clojure 1.2 and penumbra 0.6 goes together
15:44raekvibrant: http://github.com/ztellman/penumbra/wiki/getting-started
15:44vibrantyeah i thought i was using 1.2, but it seems that 1.1 is set on classpath by IDEA
15:44vibrantso maybe I'll butcher that one and change it to 1.2?
15:44vibrantinside IDEA
15:45raekdoes IDEA maintain different different classpaths for different projects?
15:46raekI think the easiest way is to let lein download the right jars
15:46vibranti think it does.
15:46vibrantwell is 0.5 old or crippled or something?
15:46raekand then tell the IDE to use all jars in the lib/ dir
15:46vibrantyea that's what it did
15:46raekno idea...
15:46vibrantbut it still included clojure.jar from the plugin as first in the classpath
15:46vibrantso now i switched it to 1.2 and let's see if it works :)
15:47vibrantok, now i get: Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path (slate.clj:9)
15:47raekcodes compiled with different versions of clojure aren't compatible
15:47fffLL)
15:47fffLL)
15:47fffLL:)
15:48raekpenumbra requires a lot of special libraries
15:48raekwell, some "native" libs
15:48fffLLwhat's penumbra anyway)
15:48raekopengl lib
15:48fffLLoh ok :P)
15:48raekvibrant: have you done a "lein native-deps"?
15:49vibrantyup, but it's not on java.library.path
15:49vibranti'm adding it
15:49fffLLI'm super stoked, I made my irc client
15:49raekfffLL: cool!
15:49raekin clojure?
15:49fffLLtyping this in repl as function calls :P
15:49fffLLyes
15:50fffLLthis is tedious I have to make an UI for this
15:50raekdid you base it on a library or did you roll your own?
15:50fffLLmy own, it's really basic :)
15:51fffLLdoesn't do anything but sit in the channel and send messages
15:51raekit's fun that interfacing with IRC is very simple
15:51vibrantyea writing irc cliens/bots is great
15:51vibranti wrote one in C, C++, Perl
15:51raekRaynes wrote the irclj lib
15:51raekI have been hacking on it too
15:52vibrantraek; now that I run tetris from the demos it says that process exited with exit code 0 :)
15:52vibrantraek; but doesn't do anything
15:54_rata_http://gist.github.com/641036 <- why stack overflow? the (delay ...) seems to be not working
15:59ymasoryhow can i collect a list of characters into a string?
15:59raekvibrant: if you try to start the application with lein repl, you will get the error messages in a form that more persons in this channel are familiar with
16:00raek(I have never used IDEA myself)
16:00vibrantraek; it seems that there is not error, it's just that nothing is being run (only the script is compiled)
16:00vibrants/not/no/
16:00sexpbot<vibrant> raek; it seems that there is no error, it's just that nohing is being run (only the script is compiled)
16:00raekvibrant: I think you launch the demo by require'ing its namespace
16:00dakroneymasory: (apply str '(\a \b \c))
16:00ymasorydakrone: thank you
16:01dakroneymasory: you're welcome
16:02raekvibrant: doing something like (require 'example.game.tetris) would perhaps work
16:02vibrantok i got it. just did (start) at the end of the file.
16:02amalloy_rata_: delays are forced autmatically when you look at them in the repl
16:02raekbut that file is in the test/ folder, which I'm not certain if it is on the classpath
16:02vibranthave to change it to some main func, i'm not experienced yet :)
16:02vibrantso i'm playing tetris! wow!
16:02raekok, great!
16:03_rata_mmmm ok, thanks again amalloy :)
16:03amalloytry (def x (delayed-func))
16:03vibrantraek; only it took a really long time to launch.
16:03vibranti wonder why.
16:05MOOOOhow do declare stuff private again?
16:05MOOOO#^private but I don;t know where to put it
16:06MOOOO,(defn #^private f [] nil)
16:06clojurebotDENIED
16:06dakroneMOOOO: you can use (defn- foo ...) or (def #^{:private true} ...)
16:06raekMOOOO: 1.1: (def #^{:private true} foo ...) 1.2 (def ^:private foo ...)
16:06raekMOOOO: or with defn: defn-
16:06MOOOOhow about a var
16:07MOOOOthat is not a function
16:07raekeither by adding metadata, or using clojure.contrib.def/defvar-
16:07MOOOOthank you
16:15vibrantraek; any idea why it takes like 17 seconds before the app window shows up?
16:15vibrantis compilation so lengthy?
16:16amalloyvibrant: probably
16:17vibrantyea starting the repl takes 2 seconds
16:25raekvibrant: I think it is due to the libs penumbra use
16:26vibrantraek; taht's why compilation is long?
16:26raekI noticed one that when I had penumbra and its dependency jars on the classpath, clojure started much slower
16:27raekI don't think it is the compilaiton
16:27raekbut I'm not certain about this at all
16:30raekclojure source is only compiled when required
16:30raek(unless it was AOT-compiled)
16:32crowbar71I wrote a fairly simple bot in clojure. it's using the pirc java lib though.
16:37raekclojurebot uses pirc too
16:41vibrantraek; well when i just start the repl with that big-ass classpath - it starts in 2 seconds
16:41vibrantraek; but when i also add that tetris.clj to commandline it starts in 20
16:48raekvibrant: hrm, ok. then it sound more resonable that it is the compilation...
16:49vibrantraek; yea it's surprisingly slow.
16:49dpritchetti like your strangeloop slides chouser
16:50KirinDaveDoes anyone know if there is an easy way to add new lein commands from a project.clj?
16:50raekvibrant: you could ask the folks at the penumbra mail list. I'm sure this has been noticed before...
16:50maharishican anyone tell me what this is called so I can find documentation on it: #(.startsWith % "A") is pound a macro here?
16:51MayDanielIt's a reader macro.
16:51KirinDavemaharishi: It's the quick syntax for (fn [] ...)
16:51raekKirinDave: a lein command foo is just a function called foo in the namespace leiningen.foo . you can but that file in your src/ dir, or make it another project
16:52KirinDaveraek: Is there an easy example of this somewhere?
16:52technomancyKirinDave: see the slides from the talk I just gave. =)
16:52KirinDavetechnomancy: I am not at the conj.
16:53KirinDavetechnomancy: Are your slides up?
16:53technomancyyou can do (in-ns 'leiningen.mytask) (defn mytask [project] ...) inside project.clj but a separate file is cleaner
16:53raekKirinDave: I tested this once: http://gist.github.com/629745
16:53amalloymaharishi: #(.startsWith % "A") is shorthand for (fn [arg1] (.startsWith arg1 "A")). so you want to look at the javadoc for startsWith (which is in the java.lang.String class, as it happens)
16:53technomancythe slides arent that detailed: http://p.hagelb.org/conj-2010-slides.org.html
16:54technomancyKirinDave: yeah I know. =(
16:54vibrantraek; normally it should be faster, right?
16:54KirinDavetechnomancy: haha, "slides"
16:54raekvibrant: 20 seconds is very slow
16:55technomancyKirinDave: well they certainly aren't film.
16:56KirinDavetechnomancy: Thnaks
16:56dpritchetti just installed epresent thanks to you technomancy ... i'm entertained so far
16:57dpritchettdoes it look better in xwindows or is it the regular console font there too?
16:57technomancydpritchett: it's not polished, but it does everything I need.
16:57technomancyit looks good in X; maybe M-x customize-face?
16:57dpritchettand it's perfect for an emerging language conference
16:57technomancyI don't know how the defaults look on OS X
16:58technomancydpritchett: the Factor talk at emerginglangs had slides written in Factor.
16:58technomancybonus points!
16:58_schulte_technomancy: no to push you away from that elegant solution, but org-mode has nice LaTeX Beamer publishing facilities :)
16:58dpritchetti'm looking at it in putty with my font set to consolas and it's fine i was just wondering if it had any gee-whiz graphics
16:59maharishiamalloy: KirinDave: MayDaniel: thanks
16:59technomancy_schulte_: I kind of thought you would say that. =) will check it out for next time.
16:59mike5160hi all
17:00dpritchettneat! $ ln -s swank-clojure.jar ~/.lein/plugins
17:01ymasorydumb question: is there an identity function?
17:01_rata_ymasory, yes, identity
17:01_rata_,identity
17:01clojurebot#<core$identity clojure.core$identity@8c530>
17:02tonyl,(identity :ew)
17:02clojurebot:ew
17:02ymasorythank you
17:04MOOOOis there a way to combine :import and :requires in ns macro?
17:04_schulte_technomancy: actually, your epresent presentation looks surprisingly nice, if I find some free time I may adapt that to Org-mode
17:05technomancyMOOOO: import and require do pretty different things. use and require may be merged in the future, but import will always remain separate.
17:06technomancyin other words, clojure vars are not classes
17:06technomancy_schulte_: it's tromey's actually; he just handed it off to me.
17:07_schulte_technomancy: oh nice, either way anything fun in Emacs must be subsumed by Org-mode
17:08technomancyNOM
17:10_rata_is there any way to have a map that always applies a function before returning a value? something like ((weird-map inc {:a 1}) :a) -> 2
17:10_rata_or do I need to extend a protocol or similar?
17:12tonyl_rata_ can a normal function just do it?
17:13bhenry_rata_ how about (defn weird-map [f m] (fn [k] (f (k m))))
17:14bhenry,(let [werid-map (fn [f m] (fn [k] (f (k m))))] ((weird-map inc {:a 1} :a)
17:14clojurebotEOF while reading
17:15bhenry,(let [werid-map (fn [f m] (fn [k] (f (k m))))] ((weird-map inc {:a 1} :a))
17:15clojurebotEOF while reading
17:15bhenrygrrr
17:15bhenryhttps://gist.github.com/cee23f6bff8f33ee90f2
17:15bhenry_rata_: ^
17:15_rata_bhenry, yes, that's it
17:16bhenrycool. with chouser focused on the conj i can get some answers in now.
17:16_rata_thanks :)
17:21kevinsnewbie quesion....what am I doing wrong here?
17:21kevins(take 10 (iterate rand-int 50))
17:22kevinsuser=>
17:22kevins(50 33 4 1 0 0 0 0 0 0)
17:22kevinsuser=>
17:22kevins(50 42 7 0 0 0 0 0 0 0)
17:22kevinsuser=>
17:22kevins(50 19 9 4 2 0 0 0 0 0)
17:22kevinsseems like a lot of 0's for rand?
17:22amalloykevins: repeatedly, not iterate
17:23kevinsI just read the docs...but I'm not catching the difference...is there a quick explanation?
17:23kevinsthanks (btw)
17:24nDuffkevins, it's using the result as each call as the argument to the next
17:24bhenryiterate is doing (rand-int (rand-int 50)) and so on
17:24nDuffkevins, so the ceiling for the random number drops each iteration
17:24kevinsI see...cool thanks.
17:24amalloy_rata_, bhenry: you can do it this way and get an actual map back:
17:24amalloy,(let [remap (fn [f m] (into {} (map (fn [[k v]] {k (f v)}) m)))] (remap inc {:a 1 :b 3}))
17:24clojurebot{:a 2, :b 4}
17:28_rata_that doesn't work for me... I think because of chunking
17:28_rata_I get a stack overflow
17:29bhenry(defn remap [f m]
17:29bhenry (apply hash-map
17:29bhenry (interleave (keys m)
17:29bhenry (map f (vals m)))))
17:30bhenryokay rich gets my undivided attention now.
17:30MayDaniel,[(zipmap [1 2] [3 4]) (apply hash-map (interleave [1 2] [3 4]))]
17:30clojurebot[{2 4, 1 3} {1 3, 2 4}]
17:35MayDaniel,(clojure.contrib.generic.functor/fmap inc {:a 1 :b 2})
17:35clojurebotjava.lang.ClassNotFoundException: clojure.contrib.generic.functor
17:38_rata_thank you all guys... see you later
17:39ymasoryhow does one append to the end of a sequence?
17:40raekymasory: 1. use a vector or 2. use concat
17:41replacatechnomancy: what's the right version of lein-swank to use these days? Is iit built in now?
17:42ymasoryraek: thanks
17:42raekymasory: you cannot modify the sequence to have something else at its end, but concat makes a lazy sequence that will traverse the sequences you give it
17:42ymasoryright, but i have wrap the element i'm appending if i use concat
17:42raekymasory: vectors are made to have efficient append to the back
17:43raekif you do multiple concats, you end up having nested "concat objects"
17:43ymasoryraek: right. i imagine there's a one-liner to copy a list into a vector?
17:43raekymasory: yup. it is 'vec'
17:44ymasorythanks
17:44ymasoryisn't that a little awkward though? if i write a function that takes any sequence i now have to pass it off to a helper (after converting it to a vector) to make sure i don't linear time appends
17:47cj_, (map (fn [r] (* r r)) (range 1 10000)))
17:47raekhow would you do a linear time append accidentally?
17:48cj_, (map (fn [r] (* r r)) (range 1 20)))
17:51raekif you need to build something sequential one item at a time, use a vector
17:51raekif you need to glue together two sequences, use concat
17:53cj_me?
17:53cj_, (map (fn [r] (* r r)) (range 1 20))
17:53cj_where is clojurebot
17:54amalloy,1
17:54amalloy->1
17:54sexpbot⟹ 1
17:54MayDaniel,(map (fn [r] (* r r)) (range 1 20))
17:57Derander-> (+ 1 1)
17:57sexpbot⟹ 2
17:57cj_-> (map (fn [r] (* r r)) (range 1 20))
17:57sexpbot⟹ (1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361)
17:58cj_-> (boolean (some #{25} (map (fn [r] (* r r)) (range 1 10000)))))
17:58sexpbot⟹ true
17:59cj_-> (boolean (some #{25} (map (fn [r] (* r r)) (range 1 10000))) (str "True"))
17:59sexpbotjava.lang.IllegalArgumentException: Wrong number of args (2) passed to: core$boolean
18:00cj_-> (boolean (some #{31} (map (fn [r] (* r r)) (range 1 20))))
18:00sexpbot⟹ false
18:01cj_-> (boolean (some #{31} (map (fn [r] (* r r)) (range 1 20))) (str "True"))
18:01sexpbotjava.lang.IllegalArgumentException: Wrong number of args (2) passed to: core$boolean
18:03cj_-> (if (= true (boolean (some #{numero} (map (fn [r] (* r r)) (range 1 10000))))) (str "square") )
18:03sexpbotjava.lang.Exception: Unable to resolve symbol: numero in this context
18:03cj_-> (if (= true (boolean (some #{25} (map (fn [r] (* r r)) (range 1 10000))))) (str "square") )
18:03sexpbot⟹ "square"
18:04cj_on ideon. i can´t see the result
18:05raekcj_: you can talk to clojurebot and sexpbot in private if you need to evaluate a lot of expressions
18:05cj_alright
18:06raekI'm not telling you to stop evaling code here, just that you have that option too
18:07bsteuberis it possible to build a variadic method using gen-class?
18:08cj_what (some) key does?
18:09raek,(some odd? [2 4 6 7 8 10])
18:09raek->(some odd? [2 4 6 7 8 10])
18:09sexpbot⟹ true
18:10raek->(some #(if (odd? %) %) [2 4 6 7 8 10])
18:10sexpbot⟹ 7
18:10raeksome applies the function you give it to each element in turn and return the first result that is truthy
18:10raekthat is, non-nil and non-false
18:14tensorpudding-> (some #(= 4 (mod % 7)) (map #(* % %) (range 0 7)))
18:14sexpbot⟹ true
18:14raek->(some {:a 1, :b 2} [:x :y :z :a :b :c])
18:14sexpbot⟹ 1
18:24amalloyRaynes: forget the conj, everyone's using sexpbot intead of clojurebot, you gotta see this
18:25cj_-> ( - (.getTime (java.util.Date.)) 10000)
18:25sexpbotjava.lang.SecurityException: Code did not pass sandbox guidelines: ()
18:27tensorpuddingis there a way to recurse in a lambda?
18:29mattctensorpudding: yes, this is what the Y combinator does
18:29raekrecur
18:29tensorpuddingrecur isn't strong enough for what i wanted
18:30raekyou want to do a self call in a non-tail position?
18:31tensorpuddingyes
18:31Chousukeyou can name anonymous functions :P
18:31Chousuke(fn name ...)
18:32Chousukethen just (name) in the function
18:32tensorpuddingoh, darn, i didn't know that
18:32ChousukeIt doesn't come up very often :)
18:32amalloy-> (let [anon (fn f [i] (when-not (zero? i) (f (dec i))))] (anon 4))
18:32sexpbot⟹ nil
18:33amalloyor i guess if you wanted it really anonymous, with no let:
18:33amalloy->((fn f [i] (when-not (zero? i) (f (dec i))))) 4)
18:33sexpbotjava.lang.IllegalArgumentException: Wrong number of args (0) passed to: box5645$eval5813$f
18:33amalloyblah, whatever, something like that
18:34cj_inside the (range 1 20) can I add a "if" to check a condition?
18:34Chousukewhat do you mean?
18:35raekcj_: no, but you can use 'filter' or 'remove' to get a sequence of only some of the elements
18:37tensorpuddingugh, what's an ISeq
18:37tensorpuddingthese error messages are no fun
18:37polypuscj_: or use for (for [i (range 1 20) :when (odd? i) ] i)
18:38cj_hmm I guess it works
18:38raektensorpudding: a cons, an instance of IPeristentList, or anything you can get from a 'seq' call
18:39raekin traditional Lisps, it would be just "list"
18:40Chousukeyeah error messages suck
18:41fielcabralHi is there a way to start a java debugger from within slime? or is it necessary to start a separate debugger and load your code there?
18:44replacafielcabral: I think you have to start slime with the java debugger enabled
18:46fielcabralokay thank you
18:49KirinDaveI fiercely wish I had multiple return values from common lisp in Clojure right now.
18:53replacaKirinDave: you can throw metadata on the return value
18:53lazy1KirinDave: You can bind multiple values - (let [[x y] (f)] ...)
18:53lazy1KirinDave: See http://codepad.org/fYbcrrKP
18:53replacabut I am usually just happy with destructuring the return value
18:53replacaas lazy1 says
18:53KirinDavelazy1: That's not multiple return values.
18:53KirinDaveThe problem is that the 1st return value might be anything, even a vector
18:54KirinDavereplaca: Metadata is interesting, but this has to place nice with scala.
18:54replacaI think it was jochu who wrote a version with metadata a long time ago
18:54KirinDaveWhich is where the complexity comes in.
18:54tensorpudding-> (take 20 ((fn f [l] (if (nil? l) nil (let [y (first l)] (lazy-seq (cons y (f (filter #(> (mod % y) 0) (next l)))))))) (iterate inc 2)))
18:54sexpbot⟹ (2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71)
18:54replacaKirinDave: well that's a whole other kettle of fish :)
18:54KirinDavereplaca: Yeah.
18:54KirinDaveSo imagine a function is asked to return true, false, or an annotation and true or false.
18:55tensorpuddingit's nice that clojure has laziness
18:55KirinDaveI'm sort of left mandating that every return value basically be a APersistentMap of {:result ..., :annotations {}}
18:55tensorpuddingeven if you have to use lazy-seq to get it
18:56KirinDavetensorpudding: Controlled laziness is a little more practical than what Haskell is doing. At least, for now. :)
18:56Chousuketensorpudding: it's kind of a "why not?" feature I think. since you're dealing with seqs anyway, dealing with lazy ones is not much more work :P
18:57tensorpuddingThat nearly-literal port of Haskell's one-liner fake-sieve-of-eratosthenes is about three times longer in clojure
18:57KirinDavetensorpudding: Because it's a literal port?
18:58tensorpuddingactually, not really literal, because the haskell used a list comprehension
18:58tensorpuddinginstead of filter
18:58tensorpuddingprimes = sieve [2..] where sieve (p:xs) = p : sieve [x|x<-xs, x `mod` p > 0]
18:59tensorpuddingthough now that i think about it, the nil? is vestigial
19:01ymasorywhy does seq? return false for a vector?
19:02raekymasory: a vector is not a seq itself, but it is seqable
19:02raekymasory: meaning that (seq a-vector) will return a seq
19:02tensorpuddingHaskell is orthogonal to Clojure, since it has syntax sugar, static typing and pattern matching, not just the obligatory laziness
19:02ymasoryraek: thanks. is there something like a seqable? function
19:03raekI think there is in contrib
19:03raekthere is also coll?
19:03raek,(doc coll?)
19:04ymasorythanks
19:04raekymasory: what do you want to detect?
19:04ymasoryi don't know enough about clojure's collection system to answer that
19:04ymasoryjust beginning
19:05tensorpuddingso i heard that people are interested in making clojure work on clojure
19:05tensorpuddinginstead of on the jvm
19:05Chousukewell
19:05Chousukeit would work on the JVM still
19:05tensorpuddingoh
19:05Chousukejust be written in itself
19:05tensorpuddinghmm
19:05Chousukethat could of course make it easier to port to other hosts.
19:06tensorpuddingit'd be neat to port it to other targets though
19:06tensorpuddinglike the clr, or llvm
19:06ChousukeThere's ClojureCLR, but it's basically a reimplementation
19:07clojurebot(1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361 400 441 484 529 576 625 676 729 784 841 900 961 1024 1089 1156 1225 1296 1369 1444 1521 1600 1681 1764 1849 1936 2025 2116 2209 2304 2401 2500 2601 2704 2809 2916 3025 3136 3249 3364 3481 3600 3721 3844 3969 4096 4225 4356 4489 4624 4761 4900 5041 5184 5329 5476 5625 5776 5929 6084 6241 6400 6561 6724 6889 7056 7225 7396 7569 7744 7921 8100 8281 8464 8649 883
19:07ymasoryi'm interested in llvm. i don't know enough yet but i'd like to contribute to scala llvm
19:08ChousukeAFAIK in 1.2 the final bits needed for Clojure-in-Clojure to actually happen went in, but I'm not sure what's happening on that front right now.
19:08clojurebot(1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361)
19:08clojurebottrue
19:08clojurebot(1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361)
19:08clojurebot1
19:08tensorpuddingi am interested in llvm also, since clang is growing, and haskell's ghc has llvm codegen now, which will hopefully make it more portable
19:08clojurebot"([x]); Returns true if x implements IPersistentCollection"
19:08Chousukeclojurebot is clearing the backlock I see...
19:08clojurebot(1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361)
19:08Deranderwhy'd clojurebot randomly spew numbers?
19:08Deranderup above w/ the squares
19:08Deranderoh
19:09Chousukeit sometimes lags like that.
19:09Chousukeno idea why
19:09Deranderodd. network problems perhaps
19:09Chousukebacklog, too
19:09Deranderyeah, maybe it gets a whole flood of messages at once
19:09Derander,(range)
19:09Deranderor stuff like that breaks it?
19:09clojurebotExecution Timed Out
19:10Chousukenope :)
19:10Derander:-(
19:41KirinDaveIf I have defrecord'd something
19:42KirinDavehow do I tell if an object of that given defrecord type?
19:42KirinDaveCan I?
19:43bsteuberdoes anyone know from scratch in which source file rich implemented the . operator?
19:58amalloybsteuber: i think it's in src/jvm/asm
19:58bsteuberthx
20:04muschneiderhow can i construct a map list of ten first sum of odd numbers, making a perfect square, example. (1, 4, 9,16...)
20:05muschneider=> (1 10) map (r => r*r) toKey
20:05muschneider-> (1 10) map (r => r*r) toKey
20:05sexpbotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
20:05muschneider-> (1 10) map (r => r*r)
20:05sexpbotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
20:06muschneider-> (+ 1 10)
20:06sexpbot⟹ 11
20:07AWizzArdmuschneider: which odd number needs to be squared to result in 16?
20:07muschneider-> (+ 1 3 5 7)
20:07sexpbot⟹ 16
20:08muschneiderI want to do a data structure containing this numbers....
20:08AWizzArdmaybe with iterate?
20:08AWizzArdyou could construct a sequence of all odd natural numbers
20:09AWizzArd(iterate #(+ 2) 1)
20:09AWizzArd#(+ % 2)
20:11Chousuke(into {} (filter (fn [[k v]] (square? v)) (zipmap (odd-numbers) (reductions + (odd-numbers))))) ; something like this
20:11Chousukeparens not counted :P
20:11Chousukethough, hm
20:11Chousukeyou might not actually want to use maps :D
20:12Chousukeinfinite seqs is not a problem, but infinite maps are
20:12Chousukeare*
20:13Chousukeyou can replace zipmap with (map vector ...) and just put a (take 10 ...) before filter
20:22amalloyChousuke: (comp square? val) seems nicer than that anon function there
20:22muschneideralright, how can i check if a numbers exists in results of this map (map (fn [r] (* r r)) (range 1 100))
20:23amalloy,(some #{10} (range 1 100))
20:23clojurebot10
20:23amalloy,(some #{1000} (range 1 100))
20:23clojurebotnil
20:24Chousukeamalloy: hmm, true
20:24Chousukeamalloy: I don't use function composition much :)
20:24amalloyyeah, there are a lot of features in clojure. hard to use all of them often
20:25amalloyuntil recently it hadn't occurred to me to use (fn [[k v]]) to iterate through maps; i was doing some horrible stuff like #(whatever (key %) (val %))
20:42amalloy,(map #((juxt vec (partial reduce +)) (->> (range) (filter odd?) (take %))) (range 1 11))
20:42clojurebot([[1] 1] [[1 3] 4] [[1 3 5] 9] [[1 3 5 7] 16] [[1 3 5 7 9] 25] [[1 3 5 7 9 11] 36] [[1 3 5 7 9 11 13] 49] [[1 3 5 7 9 11 13 15] 64] [[1 3 5 7 9 11 13 15 17] 81] [[1 3 5 7 9 11 13 15 17 19] 100])
20:43amalloybut i guess he's gone
21:00Anniepoo_how's the conj?
21:46cjj=> (map #(* % %) (range 1 10))
21:46cjj-> (map #(* % %) (range 1 10))
21:46sexpbot⟹ (1 4 9 16 25 36 49 64 81)
21:56amalloycjj: are you the one who was trying to do the sum-of-odd-integers thing earlier?
21:57cjjall my class here
21:57cjjone alumn of university spreaded this channel
21:57amalloyah
22:06cjjbut this was me here, just a little early today the teacher joined too, probably soon more will too by mailling right now
22:07cjjthis homework is a exam
22:07cjjlol
22:57kevinsplaying around with for and assoc.....I don't think I have building a map correct yet.
22:57kevins(def props (for [prop (System/getProperties)]
22:57kevins (assoc {} (. prop getKey) (. prop getValue))))
22:57kevins(get props "java.vm.name" "nope")
22:57kevinsgives me nope...
22:59kevins,(+ 1 1)
22:59clojurebot2
23:04amalloykevins: (assoc {} ...) builds a new map each time, with one key/value pair, and adds all those maps to a single list
23:05kevinsI see. so I'm pretty much getting a map of one?
23:05amalloyso props will look like ({"name" "kevin"} {"OS" "Unix"}) or whatever
23:06kevinsah...a list of single maps.
23:06amalloyexactly
23:06amalloycheck into: it's perfect for things like this
23:06amalloy,(doc into)
23:06clojurebot"([to from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined."
23:06amalloy,(into {} [1 2 3 4])
23:06clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
23:06amalloy,(into {} [[1 2] [3 4]])
23:06clojurebot{1 2, 3 4}
23:07kevinscool. Let me give that a try.
23:11amalloykevins: i'm semi-afk, but happy to help; include my nick in your message and i'll hop back in
23:36dakroneso, everyone that's here enjoying the conj so far?
23:41amalloythe conjugates are probably still out partying
23:42dakronesuppose so
23:44amalloycheck back in three hours :)
23:55yousefhello, sorry if this has been asked before but, can any one recommend either an online resource or book on clojure for someone who has done neither lisp or java. I mean, I've done java but nothing beyond really basic stuff i.e. loops, conditionals, input/output etc.
23:55yousefthe books ive found usually cater to people with prior lisp or java experience :(
23:56amalloyyousef: you might try Structure and Interpretation of Computer Programs
23:56amalloyit's a scheme book, not a clojure book, but it's an excellent introduction to the lisp family
23:57amalloyhttp://mitpress.mit.edu/sicp/full-text/book/book.html
23:59yousefamalloy: ah thank you. i also considered the route of learning another dialect before clojure. apologies for my forgetfulness