#clojure logs

2012-02-24

00:01devn&(symbol "_-*!?.omg.?!*-_")
00:01lazybot⇒ _-*!?.omg.?!*-_
00:01devnmuhoo: that's not a real function name, that is a replacement made by the editor
00:02devnmuhoo: the overtone emacs configuration replaces the "fn" in (fn [x] (+ 1 x)) with a lambda
00:02devnit still says fn underneath
00:02muhooah, thanks
00:02devnyou *can* use unicode, but it is not common at all to do that
00:03devnin fact, i've never seen anyone do that outside of demonstrating is *can* be done
00:03devnso if you see that sort of thing, it likely is just an editor thing
00:03muhoo&(let [_-*!?.omg.?!*-_ "buuaahhaha"] )
00:03lazybotjava.lang.ClassFormatError: Illegal field name "___STAR__BANG__QMARK_.omg._QMARK__BANG__STAR___" in class sandbox16652$eval22430
00:04muhoojava no likey
00:04arohner&(let [_-*!?omg?!*-_ "buuaahhaha"] )
00:04lazybot⇒ nil
00:04arohnerit didn't like the periods
00:04muhooah, namespace delimiters
00:05bbloom…soo type hinting + generics = simply ignore the generics?
00:05bbloomit seems that clojure.reflect will return symbols with <> at the end of the name… which doesnt seem to hint right
00:07devnbbloom: example?
00:08arohnerbbloom: pretty much. generics are only at the java "user" level. The JVM doesn't know or care about generics
00:08devnarohner: you're right, (symbol ..) is not the ultimate test
00:08bbloomdevn: clojure.reflect/type-reflect returns symbols with <> in them
00:08arohneror foo(String…)
00:08bbloombut then i get an error can't find SomeType<> when trying to use that symbol in type hints
00:08devnbbloom: i was thinking of a code example
00:09bbloomyeah, working on one
00:09taapaNew to both Clojure and Java. Java is vast. What is a good intro to Java resource for learning enough for Clojure?
00:09devntaapa: "enough" is always relative to your goals. :)
00:10bbloomdevn: hmmm maybe i'm mistaken…. this works:
00:10bbloomblah.interop=> (reify Iterable (^:java.lang.Iterator<> iterator [this] nil))
00:10bbloom#<interop$eval1744$reify__1745 blah.interop$eval1744$reify__1745@5d5cd49f>
00:10bbloomi'll try to figure out what the heck i'm doing wrong :-)
00:10devntaapa: google as you go. or read a book. your choice.
00:11devnbbloom: i think ^: is old style, but i dont use hinting much
00:11devni think you want ^java.lang.Iterator
00:11bbloomdevn: what's new style?
00:11bbloomi need the hinting to reify an interface that differentiates overloads by argument type
00:11devnbbloom: i might have this completely wrong.
00:12devnarohner: back me up? :)
00:13arohneryes, in 1.3, ^Iterator
00:14bbloomok i figured out what's up here… take a look at this
00:14bbloom(reify Iterable (^{:tag java.util.Iterator} iterator [this] nil))
00:14bbloom#<interop$eval1784$reify__1785 blah.interop$eval1784$reify__1785@405084c6>
00:14bbloom^^ works
00:14bbloombut...
00:14bbloom(reify Iterable (^{:tag java.util.Iterator<>} iterator [this] nil))
00:14bbloomCompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: java.util.Iterator<>, compiling:(NO_SOURCE_PATH:1325)
00:14bbloomnotice the <>
00:14bbloomthe output of clojure.reflect isn't directly usable for type hinting… you need to strip the <>
00:15bbloomseems like the <> should just be stripped automatically
00:16devntype hints remove reflection, no?
00:16muhoowow, aleph is unhappy https://refheap.com/paste/815
00:17bbloomright, but i'm doing reflection at macro expansion time, so i dont have to do it at run time
00:17taapaJust curious (class 8) => java.lang.Integer. Why don't Clojure implements its own clojure.lang.Integer? Soory if it is naive qn, its my third day learning Clojure
00:17devntaapa: why would/should it implement its own?
00:19devnmuhoo: you're using clojure 1.3 and the version of aleph you're using is 1.2(.1)
00:19devn1.3 throws those warnings for "earmuffed" vars
00:19taapadevn: maybe less confusion to noob and to someone not from Java? since its such basic type. Not sure maybe it is how clojure is, expect it to be less dependent on host platform especially for core type.
00:19bbloomdevn: this helps:
00:19bbloom(defn- hint [obj tag]
00:19bbloom (let [tag (-> tag .toString (.replace "<>" "") symbol)]
00:19bbloom (with-meta obj {:tag tag}));)
00:20arohnertaapa: Clojure sees being able to interop with JVM libraries as a strength
00:20devntaapa: it is a symbiotic relationship
00:20devntaapa: the JVM is a mature platform
00:20gtrakdevn, I managed to make it work by keeping a refcount of pressed notes, though I'm pretty sure kill isn't the right way to go, it pops at the end
00:20devnit's core types are used as an advantage
00:21devngtrak: :\ sorry man, you really should ask on the overtone list
00:21devnid like to know the right answer as well
00:21gtrakhttps://gist.github.com/1897956
00:21gtraktake a look, for posterity anyway
00:22devnnot a bad idea i suppose, but maybe more heavy handed than required gtrak
00:22devngtrak: it seems like having a ref or atom of layers would be handy
00:22gtrakyea
00:22bbloomupdated version of my reify-delegate macro with type hinting: https://refheap.com/paste/816 — I'll see if I can file a bug regarding the <> mismatch
00:22devnbut it also seems sort of like whipped cream on a nice cup of coffee, too much :)
00:23gtrakthis works if what you want is a note to play only once
00:23gtraki think in my case that's right
00:23devngtrak: perhaps you just need to add a duration when playing?
00:23devngtrak: i believe there are insts which have a :dur arg
00:24devnbbloom: sorry i couldnt have been of more help
00:24gtrakdevn, it's going to be a little weird, I'm trying to make it act like an accordion
00:24gtrakso notes don't really stand on their own
00:24technomancydevn: serializable-fn is primarily to allow functions to be first-class in a cluster of workers
00:24bbloomdevn: was still helpful :-) my hint function solves the problem
00:24devngtrak: matter of fact i've seen someone else do an accordion :)
00:24muhoohmm, went with the latest aleph snapshot, and got these https://refheap.com/paste/817
00:24bbloomwill file a bug for sake of others trying to use clojure.reflect to generate reify forms
00:25gtrakdevn, probably me :-)
00:25technomancylike for https://github.com/technomancy/die-roboter
00:25devntechnomancy: that makes sense. sorry for prodding
00:25devnjust wanted to eek out a use case, 'cause i couldn't see one
00:25technomancyfair enough; it doesn't make much sense in a non-distributed setting.
00:26devnnow i wanna use it
00:26devnavout + serializable-fn
00:26technomancydude
00:26technomancydie-roboter is like 100LOC
00:27technomancyjust sayin
00:27devntechnomancy: plus it has the word tachyon in it, and german in the README
00:28devnconsider me sold :)
00:28technomancyit's got it's own theme song!
00:28gtrakdevn, github.com/gtrak/clj-accordion
00:28devnyeah! i've played with this!
00:29gtrakit's like a week old
00:29devni know :)
00:29gtrakha, lol, you played with it alread?
00:29devni like playing with overtone, i like browsing insts people have made
00:29devnyeah :)
00:29gtrakI have a pull request on overtone/grid right now, you'll need my forked version to try it out
00:29devnthere's an overtone-toys repo ( i think that's the name )
00:29technomancyjohnmn3: you should set -Xmx256m for both JVM_OPTS and LEIN_JVM_OPTS I think
00:29gtrakassuming you have a launchpad
00:29technomancyadjust the numbers as appropriate
00:29devnit has a really cool binaural inst
00:30johnmn3technomancy: so put that in my project.clj?
00:30devni have to bed all, happy clojuring, and may the power of hash array mapped tries be with you
00:30devnto *go to* bed
00:31devng'night
00:31johnmn3oh, put in my environment variables
00:35johnmn3technomancy: didn't work
00:35johnmn3trying with trampoline
00:38muhooso what's the clojureish way to find out what functions are available for a particular peice of data?
00:39muhooin oop, it's easy, the object has methods, etc. but for a clojure thing, how do i find out what functions are valid to do upon it?
00:41amalloystep 1, use a language with static typing?
00:42amalloygiven some function x, you can't possibly know what types it accepts, because it doesn't say so anywhere
00:46johnmn3functions should be as datastructure-agnostic as possible, right?
00:46callenjohnmn3: possible, practical, etc.
00:51johnmn3,(#(if (= :rare-data %) "usually nil" nil) :common-data)
00:51clojurebotnil
00:56Raynesamalloy: 1) write a function 2) run function against every single data type possible 3) ????????? 4) profit!
01:02johnmn3any selenium/clj-webdriver gurus out there?
01:06bbloomis there a way to get the . form to play nice with apply?
01:08johnmn3if the driver clicks and opens a new window and then the user closes that window, the driver is hosed
01:11johnmn3and then I can't get a way back into the running browser
01:12bbloom&(apply .charAt "asdf" [2])
01:12lazybotjava.lang.RuntimeException: Unable to resolve symbol: .charAt in this context
01:12bbloomany way to make that work? preferably with the isolated dot form?
01:12johnmn3methods aren't functions
01:12callen&(apply (. charAt "asdf") [2])
01:12lazybotjava.lang.RuntimeException: Unable to resolve symbol: charAt in this context
01:12shaolynnIs anyone here familiar with aleph? What's the best way to serve a policy file for web sockets?
01:12johnmn3,(memf .charAt)
01:13clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: memf in this context, compiling:(NO_SOURCE_PATH:0)>
01:13bbloomaaaah memf
01:13bbloom,(docmf .charAt)
01:13clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: docmf in this context, compiling:(NO_SOURCE_PATH:0)>
01:13bbloomblah
01:13bbloom,(doc memfn)
01:13clojurebot"([name & args]); Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn."
01:17bbloomhmmm does memfn play nice with varargs?
01:18bbloomlook at the impl doesn't suggest it would....
01:19johnmn3might as well wrap it in a function at that point
01:19johnmn3memfn is kinda like comp
01:19bbloomwell if i knew how to write the wrapper function, i'd have just written that inline :-)
01:20johnmn3#(.charAt %)
01:20bbloomjohnmn3: charAt was just a simplified example
01:21bbloomi'm trying to reify a varargs method
01:21johnmn3what were you trying to do with [2]?
01:25bbloomjohnmn3: I am trying to call a varargs java method against a sequence
01:25bbloombut i cant even get it to work against a non-vararg method
01:25bbloom&(apply #(.charAt "asdf" %) [2])
01:25lazybot⇒ \d
01:25bbloomthat seems to work… but what about varargs?
01:27bbloomhmmm or are varargs not even really a thing?
01:27bbloomlike is it just compiler knowledge & it's actually just an array?
01:28Apage43bbloom: yes, according to java's docs
01:28Apage43"It is still true that multiple arguments must be passed in an array, but the varargs feature automates and hides the process."
01:28bbloomApage43: ah. thanks. link?
01:29Apage43http://docs.oracle.com/javase/1.5.0/docs/guide/language/varargs.html
01:29bbloomah ok thanks
01:32muhoowhat's the function in clojure to render a number in any base?
01:33muhooi.e. in binary, hex, etc, there's one function that takes the number and base, and displays it
01:33bbloom,(doc *print-base*)
01:33clojurebotExcuse me?
01:33muhoowasn't that one
01:33bbloom&(doc *print-base*)
01:33lazybotjava.lang.RuntimeException: Unable to resolve var: *print-base* in this context
01:33bbloomblah.
01:33muhooit was a function, like (foo 295 16)
01:34bbloomgrepping for *print-base* produces some results…. um… let's see
01:34muhooit was in clojure.contrib.math IIRC
01:35bbloomwell you can simply bind *print-base*
01:35bbloomin pretty print
01:35bbloompprint
01:36bbloom(use '[clojure.pprint])
01:36muhoowell i don't want to change the base for every number, just fo rone
01:36bbloom(with-out-str (binding [*print-base* 16] (write 100)))
01:36bbloom"64"
01:36muhoooh i see
01:36muhoostill, there was a simpler way, my memory fails me though
01:37bbloomlet me know if you find it :-)
01:43shaolynnWhat's the best way to examine libraries from the REPL - for example: how can I list the methods of a library?
01:46bbloom&(doc dir)
01:46lazybotjava.lang.RuntimeException: Unable to resolve var: dir in this context
01:46bbloomhmm.
01:46bbloom,(doc dir)
01:46bbloomuser=> (doc dir)
01:46bbloom-------------------------
01:46bbloomclojure.repl/dir
01:46bbloom([nsname])
01:46bbloomMacro
01:46bbloom Prints a sorted directory of public vars in a namespace
01:46bbloomnil
01:48clojurebot"([nsname]); Prints a sorted directory of public vars in a namespace"
01:48bbloomheh… clojurebot was a little slow on that 1 :-)
01:50shaolynnbbloom: awesome, thx!
01:56gfredericksdoes this sort of thing ring a bell to anyone? Don't know how to create ISeq from: clojure.lang.Var$Unbound
02:00muhoomethinks it was called 'rad' or 'radice'
02:01bbloomgfredericks: you've got something that was (def foo) without an init value
02:01bbloomand you're trying to dereference it
02:07muhoobbloom: (Integer/toHexString 42)
02:07muhoo&(Integer/toHexString 42)
02:07lazybot⇒ "2a"
02:07muhoo&(Integer/toBinaryString 42)
02:07lazybot⇒ "101010"
02:08bbloommuhoo: heh, isn't that Java's? Cheating ;-)
02:08muhooit works, and it doesn't wreck my fingers or my brain, so i'm happy
02:08bbloomindeed
02:28ibdknox|awaywhen you're doing deftype and you are implementing a protocol it doesn't throw if you don't implement all the methods?
02:35nuclearsandwichibdknox|away: first time playing with Noir in earnest. Does it still support named routes?
02:35ibdknox|awayyeah
02:36nuclearsandwichI have `(defpage auth-callback "/auth/callback" {code :code}
02:36nuclearsandwichignore the backtick... and it says "Routes must be either string or a vector, not a class"
02:37ibdknoxwhat version of Noir?
02:37nuclearsandwichibdknox: 1.2.2
02:38ibdknoxweird
02:38ibdknoxcan I see a gist of the file? I just tried your code in a repl and it was fine
02:38ibdknoxis there a symbol in that file for auth-callback?
02:40nuclearsandwichibdknox: I try to use it in a (url-for )
02:41nuclearsandwichAs far as gisting the file, I'd have to sanitize it as it isn't mine.
02:41ibdknoxhm, nothing is jumping out at me immediately
02:41muhoowow, that's freaky. i actually think i understand aleph
02:42ibdknoxFwiw though, I've found that that pattern is actually best done by creating vars for the urls in a urls-file
02:42ibdknoxsince you'll run into cyclic deps
02:42ibdknoxsince you'll run into cyclic deps
02:42muhooibdknox: does the aleph port of noir actually work?
02:43ibdknoxmuhoo: it's not really a port, but yeah :)
02:43muhoothanks
02:43nuclearsandwichibdknox: what do you mean creating vars for the urls?
02:43ibdknoxnuclearsandwich: so you do (def auth-callback "/auth/callback") (defpage auth-callback {code :code} ...)
02:43ibdknoxthen (url-for auth-callback ...)
02:44nuclearsandwichibdknox: ah, makes sense. Will noir change to embrace this new pattern?
02:44muhooaleph seems to me like the kind of thing node.js wants to be, but can't.
02:44ibdknoxnuclearsandwich: the other way will continue to work, but my guidance henceforth will point in that direction
02:45ibdknoxmuhoo: aleph has a ways to go performance-wise
02:45ibdknoxnuclearsandwich: it's far more robust
02:46muhooibdknox: really? what's the bottleneck?
02:46ibdknoxmuhoo: some of the abstractions are quite costly
02:46nuclearsandwichibdknox: agreed. I am saving a paste of this conversation to use as evidence wen I am later asked wtf I am doing. :D
02:47muhooi wondered about that. looking at the code, lots of deeply-nested namespaces
02:47muhoonever a good sign
02:48ibdknoxmuhoo: he's working on it though :)
02:48muhoogood to know
02:49bbloomdocs
02:50bbloom^^whoops wrong box
02:50muhoosudo shutdown -h now
02:50muhoo:-)
02:55muhoo91 hours and counting into clojure, and 174 pages into joy of clojure, the first lightbulbs start to flicker on dimly.
02:59johnmn3would there be a way to attach clojurescript to a running browser?
08:26gtrakis there a simpler way to nest elts in a vector?
08:26gtrak,(map conj [1 2 3 4 5])
08:26clojurebot#<ExecutionException java.util.concurrent.ExecutionException: clojure.lang.ArityException: Wrong number of args (1) passed to: core$conj>
08:26gtrak,(map #(conj nil %) [1 2 3 4 5])
08:26clojurebot((1) (2) (3) (4) (5))
08:27clgvgtrak: what dou you want to do?
08:27gtrakwhat i just did there, but maybe there's a simpler way
08:28cemerick&(map vector (range 5))
08:28lazybot⇒ ([0] [1] [2] [3] [4])
08:28clgv&(map list [1 2 3 4 5])
08:28lazybot⇒ ((1) (2) (3) (4) (5))
08:28gtrakah, slightly better
08:28TimMcgtrak: partition 1 ?
08:28gtrakhmm
08:29gtrak,(partition 1 (range 5))
08:29clojurebot((0) (1) (2) (3) (4))
08:29gtrak,(partition 2 (range 5))
08:29clojurebot((0 1) (2 3))
08:30gtraki see
08:31TimMc,(partition-all 2 (range 5))
08:31clojurebot((0 1) (2 3) (4))
08:32TimMc,(partition-all 3 2 (range 10))
08:32clojurebot((0 1 2) (2 3 4) (4 5 6) (6 7 8) (8 9))
08:32gtrakhmm, inclusive
08:32gtrakvery very nice
08:33gtrakthis kind of stuff is such a pain in java that you'd avoid it
08:34jamiiis there an equivalent in clojure to the traditional zip?
08:35jamii(zip '(1 2 3) '(:a :b :c)) == '([1 :a] [2 :b] [3 :c])
08:36Chousukejamii: map vector
08:36gtrak,(map vector '(1 2 3) '(:a :b :c))
08:36clojurebot([1 :a] [2 :b] [3 :c])
08:37clgvjamii: zipmap if you want a hashmap afterwards
08:37jamiioh, weird
08:37jamiithanks
08:37gtrak,(into {} (map vector '(1 2 3) '(:a :b :c)))
08:37clojurebot{1 :a, 2 :b, 3 :c}
08:37clgvgtrak: zipmap is better for that ;)
08:39jamiiI would have expected map to behave like for
08:39gtrakand join them together?
08:41jamii,(for [x '(1 2 3) y '(:a :b :c)] [x y])
08:41clojurebot([1 :a] [1 :b] [1 :c] [2 :a] [2 :b] ...)
08:42gtrakbut that's what for is for
08:42jamii:)
08:42jamiiok
08:42jamiiso now I have (for [[x y] (map vector ...)] ...)
08:44clgvjamii: what's the big picture?
08:45jamiiI have a list of overtone instruments and a matching list of cpu stats. I want to periodically set the instruments freq/volume according to the cpu stats.
08:46jamiiclgv: https://gist.github.com/1901031
08:46Chousukejonasen: for is not meant to do side-effects
08:47Chousukeright, doseq will work
08:47clgvjamii: ok thats code. in words - what do you want to do? what is the input leading to which output?
08:47jamiiChousuke: I wrote it right in the gist (doseq)
08:48jamiiclgv: the words came before the gist ^^^
08:49clgvjamii: there is no (for [[x y] (map vector ...)] ...) in it
08:49jamiiclgv: its a (doseq [[inst cpu...
08:50jamiiIts not a big deal, I was just wondering if thats really the most idiomatic way to do it
08:50Chousukeseems fine to me
08:51jamiiChousuke: thakns
08:52clgvjamii: looks fine in that context.
08:57tsdhWhat's the right function to convert a clojure value, where everything except nil and false is truthy, to a java boolean value?
08:58tsdh(boolean 1) gives a reflection warning, so I probably have to go with (if value true false)?
09:00si14guys, can I ask here a question about ClojureScript?
09:00TimMcsi14: Yes, that's in scope for the channel.
09:00TimMcgtrak: Check out the other arities of partition, there's also a "fill" argument.
09:00si14ok :) here is it: how can I build stand-alone ClojureScript files without Noir?
09:01si14I've followed some tutorials and it's clear; the problem is that I want to use ClojureScript without Clojure server in my production
09:02TimMcsi14: CLJS includes a compiler shell script -- you can run that against your cljs files.
09:02si14I'm serving directory with simple html page with python in my dev environment and keep getting "GET http://localhost:8000/deps.js 404 (File not found)"
09:02si14TimMc: I'm already using leiningen for this with it's "lein cljsbuild"
09:03TimMc(I've actually just reached the limits of my knowledge of CLJS development...)
09:04si14here is my files: https://gist.github.com/fe7bd94031a026b5fb9c
09:04si14*are
09:07timvisherhey kids
09:08timvisheris there a way to coerce an object into a readable string? I'm currently using `pr` to print it to a file, but i'd like to un-complect that
09:09clgvtimvisher: pr-str?
09:09timvisherclgv: nice!
09:09timvisheri had done a find-doc for reader
09:09timvisherand nothing came back that looked interesting
09:09timvisher:)
09:09clgvoh there was a 50% chance I was guessing your problem wrong ;)
09:10timvisherexplain?
09:10timvisheri'm trying to store a set for reading later via slurp
09:10timvisheror rather
09:11timvisherslurp and read-string
09:12timvisherthought I remembered their being a load-file or something, but maybe there was a reason i didn't use that…
09:12si14so, how can I "statically" build CLJS?
09:13si14without any external deps such as "deps.js"
09:13timvisheranyway, that's working fine, but my function calls (pr obj) internally and I'd rather define something that accepts something that is readable and just writes it to a file as is, rather than having it mashed together.
09:21timvisheri'm trying to set up a generic interface with multimethods in a namespace that then would have multiple possible implementations that you can choose from via the dispatch method. The implementations would all be in their own namespaces, ideally, to separate the implementations out for readability. However, doesn't that lock me in to using or requiring all of the sub-namespaces whenever I want to call my generic interface m
09:22timvisheris there a better way to accomplish what i'm going for?
09:25clgvyou know 'print-method?
09:25timvisherclgv: me? I do not.
09:26clgvthat multimethod is used for printing objects
09:26clgvtimvisher: yeah, I meant you
09:26timvisherok
09:27clgvin JoC there is an example for clojure.lang.PersistentQueue
09:27timvisheri should really just read the PC.8 chapter again
09:27timvisher:)
09:27`fogusQueue Fish!
09:29si14TimMc: did you use hiccup?
09:31clgv`fogus: what?
09:32clgvtimvisher: you mean chapter 9 on multimethods?
09:33si14how can I generate a bunch of divs with different margins with crate?
09:35timvisherclgv: 8 for me. i think i'm still back on v1 or something
09:35clgvtimvisher: lol k. there is a metadata chapter at 8 in my copy
10:00TimMcsi14: Did I use Hiccup where?
10:02clgvis there a leiningen task that only updates resources in a jar/uberjar?
10:34si14TimMc: nevermind, already figured out myself :)
11:26jaleyany recommendations for performance testing? I have a couple of functions I want to monitor performance of. I thought there was some function in clojure.test, but appears I was wrong.
11:28Bronsamaybe https://github.com/hugoduncan/criterium ?
11:28mabes+1 criterium
11:30jaleyBronsa, mabes: thanks for the recommendation, will take a look
11:38bsteubercemerick: finally saw the 2nd half of your talk, nice framework
11:39bsteuberactually I was close to doing sth. like raposo in CL for my master thesis
11:39bsteuberbut than I chose to turn haskell into a lisp instead :)
11:39bsteubers/than/then
11:46magnarsI must be doing something wrong, because my code is littered with (filter identity ...) and to a lesser degree (flatten ...) after recursing over a tree structure to gather information. What would be an idiomatic way of traversing a tree structure, and returning information about a subset of the nodes?
11:46RickInGAtree-seq
11:46RickInGA&(doc tree-seq)
11:46lazybot⇒ "([branch? children root]); Returns a lazy sequence of the nodes in a tree, via a depth-first walk. branch? must be a fn of one arg that returns true if passed a node that can have children (but may not). children must be a fn of one arg that returns a sequence of th... https://refheap.com/paste/821
11:46raekmagnars: maybe mapcat?
11:47magnarshmm, those are both intriguing. Thanks, I'll give them a go.
11:47raekmagnars: also, note that (flatten x) is not the same as (apply concat x)
11:47raekmagnars: flatten removes multiple levels of nesting
11:48magnarsraek: yes, that has bitten me hard a couple of times - luckily I'm writing tests as I go along.
11:48magnarsapply concat looks nice
11:48RickInGAmagnars: I want to start testing, what do use? closure.test? midje?
11:49magnarsRickInGA: I just wanted to get started quickly, so went for simple clojure.test
11:49TimMcmagnars: for, with :let and :while and :when
11:50magnarsTimMc: oh, hm, that's interesting. Thanks, now I have another three tools to try out.
11:51TimMcmagnars: Multi-level for is great for fixed-depth data structures.
11:51TimMctree-seq is great if you have varying depth
11:52magnarstree-seq looks very promising
12:03clgvRickInGA: midje has some nice checkers for sequences hashmaps...
12:05RickInGAclgv: you think if I am just getting started with testing in clojure, I should just start with midje?
12:05tripodmanis clojure fairly easy to set up on a small vps for someone with little experience?
12:06clgvRickInGA: well, if you have more complex result data to check it can pay off to use midje. you can just try pure clojure.test and then midje afterwards. that shouldnt consume that much time
12:06RickInGAtripodman: in my experience, setting up clojure is 2 things, setting up leiningen (build tool) and setting up an editor
12:07RickInGAleiningen will build your clojure environment for you.
12:07tripodmanRickInGA: awesome i'll look into that
12:07clgvtripodman: if you are familiar with eclipse you can also checkout CCW
12:08RickInGAIf you have an editor/ide you like you can get a clojure plugin
12:08tripodmancool ty
12:08RickInGAif you aren't familiar with any editors on the java or *nix platforms (like me) , checkout clooj
12:10jamiihttps://github.com/jamii/mechanical-sympathiser
12:10jamiimy first clojure project, its alive!
12:11mdeboardI'm sorry
12:11krlif i have a namespace X with a defrecord, of a protocol in namespace Y, and a namespace Z that :uses X, do i need something special for clojure to recognize a method of the protocol?
12:12clgvkrl: you will always have to :use or :require that namespace to use the methods of the protocol
12:12krlok, thanks.
12:13RickInGAjamii: your computer makes noise if you overwork it?
12:14jamiiRickInGA: at the moment, each cpu gets a pure sine wave tone with the volume corresponding to the cpu load
12:14jamii(with the cpus tuned in perfect fifths so they make nice chords)
12:14RickInGAnice!
12:15rplevydsantiago: Hi. what kind of setup is required in order to successfully run the tests for clojure-hbase? I am able to connect to hbase via hbase shell, but I get java.lang.reflect.InvocationTargetException caused by an IllegalArgumentException Not a host:port pair: �
12:15jamiiI'm going to add a bunch of other sounds and data sources
12:15RickInGAwasn't the 5th considered the devil interval in the middle ages? fits with my theory that computers are evil.
12:15rplevywhen I run lein test that is
12:15jamiiRickInGA: flatted fifth
12:16jamiiRickInGA: the fifth sounds nice
12:16rplevyjamii: discordianism / law of fives ;)
12:16dsantiagorplevy: Hi, hang on a second.
12:17rplevydsantiago: thanks!
12:17clgv,(+ 2 3)
12:17clojurebot5
12:17clgv;)
12:18jamiirplevy: Interestingly, it seems that both chromatic and pentatonic scales come from trying to fit fifths (ie 3/2 ratios) and octaves (2/1 ratios) into the same system
12:18RickInGAjamii: you are right, flatted fifth is devils interval, makes more sense.
12:18jamiirplevy: http://www.math.niu.edu/~rusin/uses-math/music/
12:21jamiino, wait, http://www.math.niu.edu/~rusin/uses-math/music/12
12:22RickInGAjamii: nice application for overtone
12:22jamiiRickInGA: thanks
12:22jamiiRickInGA: I hope to actually make music eventually, but one thing at a time
12:22jamiiLearning clojure + overtone + composing all at once would be hard
12:22rplevydsantiago: btw I am running the thrift service on localhost
12:23RickInGAI can run overtone from lein repl, or from repl in emacs if I start swank externally
12:23dsantiagorplevy: So when I run the tests, I always run it in standalone mode on version 0.90.5.
12:23dsantiagoNo configuration is required.
12:23dsantiagoI have had problems with connecting to it, and this is a known issue in HBase, when there are multiple entries for localhost in hosts.conf.
12:23dsantiagoSo lately I've had to comment some of those out in order to run the tests.
12:24dsantiagoBut I can't remember if that is the exception that gets thrown then.
12:24RickInGAbut when I try to use overtone.live from editor and try to evaluate I crash
12:24rplevydsantiago: interesting, I'll try these tips, thanks!
12:30dsantiagoI mean /etc/hosts, not hosts.conf.
12:31rplevyyup
12:32rplevythat doesn't seem to fix my problem though, I'll try installing hbase 0.90.5 (I'm on 0.92.0)
12:41dsantiagorplevy: OK, I haven't tested with .92.
12:43dsantiagoAre they just going to not put those in maven or what?
13:08TimMccemerick: Why do you call proxy and gen-class the "interop zone"? I think of deftype and reify as interop as well.
13:56cemerickbsteuber: thanks; obviously, it's not finished yet, or really in a releasable state :-(
13:59cemerickTimMc: Because proxy and gen-class are fundamentally associated with the JVM's semantics and constructs. deftype et al. are "Clojure native" insofar as they should translate well to other hosts (witness ClojureCLR and ClojureScript, neither of which have gen-class).
14:00cemerickAlso, deftype would work fine from within Clojure even if it had been implemented some other way that didn't involve an interop-friendly manifestation.
14:00TimMcHmm, OK.
14:01cemerickI'm open to counterarguments / suggestions on the diagram; not too late yet :-)
14:01TimMcI'm makin' a spreadsheet.
14:02TimMc(purely for organizing my thoughts)
14:09rplevydsantiago: I've confirmed that it was the client / server version difference that was the problem (they should really add 92.x to maven, or is that not considered stable yet?)
14:16dsantiagorplevy: I actually don't know. I assume if it's not in maven, it's not released.
14:17rplevyyeah, that makes sense. though I remember Jython for example took a couple years to get their latest version into maven once, so I guess it's not always the practice, haha.
14:36ferdI need a customizable bot for IRC and XMPP. Written in clojure I see lazybot, sexpbot (deprecated?), clojurebot. Any recommendations?
14:36hiredmanclojurebot's xmpp support is currently limited to non-existent
14:36miltondsilvahmm.. using clojure 1.4 beta-1... I get some weird results http://pastebin.com/CbdexLYQ shouldn't the areduce be faster than reduce?
14:37hiredmanearlier versions had support but it was dropped as part of a rewrite
14:37hiredmana good clojure xmpp library would be nice
14:39miltondsilvaoh, forget it, there was a missing ^ints hint
14:39amalloysexpbot is an older lazybot
14:39ferdThanks... After a quick look, it seems like lazybot is easier to extend (at least it has some documentation)
14:39gfredericksolder and wiser
14:40amalloythere was an effort to make lazybot support twitter too, but it was abandoned. apparently like clojurebot's xmpp support
14:40ferdamalloy: thanks, that's what I imagined... You might want to put a banner on its README on github pointing to lazybot
14:42hiredmanI think the lack of good xmpp libraries is a testament to its complexity
14:42amalloyferd: yeah, i thought we already had. done now
14:43twhumeI'm a total Clojure newbie. Am working through the book, writing my very first functions. Is there a better place than here to ask really trivial questions?
14:43technomancyask the repl first =)
14:44amalloyor ask lazybot if you haven't gotten your own repl set up satisfactorily
14:45amalloywell, i guess http://tryclj.com/ would be easier than that :P
14:45dnolentwhume: this is the ultimate stopping point for really trivial Clojure questions ;)
14:45twhumeI have a REPL going, and counterclockwise w/Eclipse; and I have functions running.
14:45twhumeOK, I'll shoot…
14:46eggsbyI'm another total clojure newbie twhume, nice to meet you!
14:46eggsbyi've been using http://4clojure.com its been pretty good to me so far
14:47twhumeI've implemented my own version of the frequencies function, just to kick off. It seems to work, in that when I print out the results of running my function and running frequencies() on the same string, the REPL prints the same thing. I thought I'd add a unit test to check for equivalence of the two maps produced, and this is where I'm stuck...
14:47twhumeMy function is called digest:
14:47twhume=> (println (digest "the quick brown fox jumps over the lazy dogg"))
14:47twhume{the 2, quick 1, brown 1, fox 1, jumps 1, over 1, lazy 1, dogg 1}
14:47twhume=> (println (= [frequencies (str/split "the quick brown fox jumps over the lazy dog" #"\s") digest "the quick brown fox jumps over the lazy dogg"]))
14:47twhumetrue
14:47twhumenil
14:48amalloyyour []s and ()s are nuts in that
14:48TimMctwhume: No need for println
14:48amalloy(= (frequencies (str/split "the quick brown fox jumps over the lazy dog" #"\s")) (digest "the quick brown fox jumps over the lazy dogg"))
14:49TimMctwhume: (= only-one-thing) always returns true
14:49twhumeThanks
14:50twhumeThanks very much - I've misread the clojure quick reference, and thought = had to be passed a list.
14:50twhumeMuch appreciated.
14:51babilentwhume: You might find http://clojuredocs.org/, http://www.4clojure.com/ and http://clojure.org/cheatsheet helpful btw (just saying)
14:52twhumeThanks babilen - I hadn't come across 4clojure before. Will self-flagellate and look around harder before next time. Cheers for your help everyone!
14:54magnarsRickInGA and TimMc: thanks a bunch for the tip about tree-seq earlier - just the function I needed. I'm thrilled!
14:54the-kennyIs there a reason why clojurescript doesn't feature `case'?
14:56TimMcthe-kenny: I would guess that JS doesn't support that sort of fast literal branching.
14:56the-kennyHm :(
14:56amalloyi was thinking that too, but...
14:56TimMcOr no one has implemented it. :-)
14:56amalloyeven if it did, perhaps case couldn't be implemented the same way it is in clojure
14:56the-kennyWhy not do a fallback to (cond ((= op v) ..) ((= op w) ...))?
14:57the-kenny(I'm currently working with code shared between clojure & clojurescript)
14:57amalloyclojure computes some hashcodes at compile-time, and then switches on them at run-time. in cljs, the compile-time hashes will be in java, but in cljs they'll be js
14:58the-kennyHm, if it's not available, I'll rewrite this function using multimethods. Performance shouldn't be a problem
15:05jrobiei'm sure this is a newbie FAQ, but is there a reason to prefer cons vs. conj?
15:06TimMcamalloy: I'm guessing it uses the same bytecode behind Java's switch.
15:06amalloyTimMc: have you looked? it uses switch but does a lot of stuff before that because switch only supports ints
15:06TimMchah
15:07lucianit could use Object.hashCode and switch on that, with a check
15:08scriptorjrobie: conj's behavior is dependent on the implementation
15:08scriptorthat's why conj appends to the end for a vector and the beginning for a list
15:08jrobiethanks, scriptor
15:09gtrak``,(conj (seq [1 2 3]) 4)
15:09clojurebot(4 1 2 3)
15:09TimMcjrobie: cons always produces a seq with the new element at the front
15:09jrobiethese results surprised me
15:09jrobieuser=> (conj (list "one" "two" "three") "four")
15:09jrobie("four" "one" "two" "three")
15:09jrobieuser=> (cons (list "one" "two" "three") "four")
15:09jrobie(("one" "two" "three") \f \o \u \r)
15:09TimMcno matter what the collection was
15:10TimMcjrobie: argument order
15:10jrobieis \f \o \u \r the same as "four"?
15:10hiredmanhave you read the docstring for those functions?
15:10TimMc&(seq "four")
15:10lazybot⇒ (\f \o \u \r)
15:10jrobiethanks, hiredman, shoulda done that
15:10gtrak``jrobie: cons and conj flip the seq and the value argument to make it more obvious I guess?
15:10scriptorjrobie: the order of what argument is what is different for conj and cons
15:11TimMcscriptor: that's *one* difference, yes
15:11scriptorTimMc: yea, not sure why I said "what is"
15:11scriptorI explained another difference earlier
15:12gtrak``looking at RT.java, conj calls .cons on the collection object, which is polymorphic
15:12scriptoryep
15:12jrobieone Big Picture question: when should i use clojure vs scala vs. java?
15:12gtrak``,(class (seq [1]))
15:12clojurebotclojure.lang.PersistentVector$ChunkedSeq
15:12gfredericksuse java for implementing Clojure
15:12jrobieanother Big Picture question: is there anything like Scala's Parser Combinators or Haskell's Parsec or Haskell's Happy for Clojure?
15:12scriptoruse scala if you like it's type system, I guess
15:13scriptorI don't know that much about it
15:13scriptorjrobie: yep, there was a big discussion about clojure parsers on the mailing list, one sec
15:13gtrak``ah, chunkedseq extends ASeq, that's why that works
15:13technomancythere's a parsec port
15:13hagnain (defmulti compiler :os) I guess :os is the dispatch function, but it's a keyword huh?
15:13lucianjrobie: all three are general purpose, use whichever you like
15:13lucianhagna: keywords are functions
15:14TimMc&(instance? clojure.lang.IFn :foo)
15:14lazybot⇒ true
15:14jrobiea parsec port would make me happy. (DSLs are one of the things i most like to do)
15:14hagnalucian: ok I guess that's why I can do (:keyword map)
15:14gtrak``ASeq cons returns new Cons(o, this);, PersistentVector.cons pushes it on the tail
15:14scriptorjrobie: some parsec-like things are mentioned here http://groups.google.com/group/clojure/browse_thread/thread/d9f18dba071d903a/eb0c7381f4ffcf29?lnk=gst&amp;q=parser
15:15gtrak``a seq view of a vector is still an ASeq implementation, and conj's like ASeq
15:15jrobiethanks, scriptor
15:15gtrak``jrobie: check out parsatron
15:15jrobiethanks, gtrak
15:15gtrak``that's what it's meant to be
15:16jrobiegtrak, what do you particularly like about parsatron?
15:16gtrak``Nate's a nice guy? :-)
15:17gtrak``I don't know that much about parsers, but I think we're using it internally for some stuff
15:17jrobiei like nice guys, i'm mostly hoping for something that reads like the original grammar, like parsec or parser combinators
15:17jrobieespecially if it's also efficient
15:18gtrak``jrobie: he gave a talk on it at strangeloop, you could watch that
15:18technomancythe strangeloop talk on parsatron was great
15:18gtrak``http://www.infoq.com/presentations/Parser-Combinators
15:18eggsbyI thought that was mostly on parsec?
15:18gtrak``no, he showed stuff in parsatron
15:19eggsbyah
15:19eggsbybut ya that talk was great
15:20jrobiehmmm, he says most of his talk comes from walking through the parsec source
15:23gtrak``jrobie: the whole project looks quite small
15:26jrobielein is the package manager for clojure, right? so how do i install parsec with lein?
15:26TimMcjrobie: It's not actually a package manager.
15:27jrobieah
15:27jrobie*is* there a package manager?
15:28lucianjrobie: it's more like virtualenv + pip if you've used python
15:28cemerickjrobie: clojure libraries are .jar files, and so they aren't "installed"; you declare dependencies on them in your project.clj file, and leiningen obtains them when necessary
15:28lucianor rvm + gem if you've used ruby
15:29jrobieok, that makes sense
15:30amalloyhas anyone thought about why we have (dissoc m :a :b) but (select-keys m [:a :b])? i just noticed and it seems weird
15:30technomancyamalloy: the dissoc/disj split is werid too
15:31amalloyis it?
15:31ibdknox|awayit's more common to select keys based on a collection you build over time?
15:32technomancyI expected to be able to dissoc out of a set, but maybe that's silly
15:32TimMcThere, it's all easy now.
15:32ibdknox|awaytechnomancy: I did too
15:42amalloyi think everyone expects that once. but you can't assoc into a set, and nobody seems to be surprised by that
15:43TimMcsets do a better job than maps of pretending to not be key-value pair collections
16:01jrobiei've defined a function in a buffer in emacs, and did M-x run-lisp, now i put my cursor at the end of a function invocation and do C-x C-e ... no dice
16:02jrobieif i position the cursor after (+ 1 4), it works great
16:02jrobiewhat am i missing?
16:04mdeboardjrobie: What does no dice mean
16:04gfredericksmdeboard: it don't work
16:04mdeboardgfredericks: Yeah was looking for specifics :P
16:04jrobiemdeboard, "no dice" is spelled user=> java.lang.IllegalStateException: Var user/pig-latin is unbound. (NO_SOURCE_FILE:0)
16:04gfredericksoh
16:05jrobiehah! turns out the parsatron guy is working on pig latin, i'm working on jsoniq, very similar projects
16:06jrobie(where his pig latin is a query language, and has nothing to do with the example at hand)
16:09jrobiemdeboard, did the error message help? the file has been saved
16:09mdeboardOh I thought your problem was resolved, guess I misunderstood
16:10jrobiei get this when i try to evaluate a function call: user=> java.lang.IllegalStateException: Var user/pig-latin is unbound. (NO_SOURCE_FILE:0)
16:10jrobieclojure-mode, lisp
16:10mdeboardare you in clojure mode
16:10mdeboard:D
16:10jrobieif i do the same for (+ 1 3), i get 4
16:10mdeboardI got nothin'
16:10jrobiewell, i'm in clojure mode if the expression is (+ 1 3) ;->
16:11jrobiedid you do M-x run-lisp?
16:11mdeboardWell, (+ 1 3) is properly evaluated in elisp as well
16:11TimMcjrobie: Presumably there's a bug in your code?
16:11jrobieTimMc - i doubt it, i copied and pasted it from the tutorial, i can copy it and paste it into the interpreter and it works
16:11TimMchmm
16:12mdeboardjrobie: Can you paste the exact code you're trying to evaluate
16:13TimMcjrobie: refheap.com
16:14mdeboardOh a new pastebin
16:14mdeboardSince scpaste doesn't like naquadah theme :-\
16:14jrobiehttp://fpaste.org/JLVD/
16:14TimMcmdeboard: Raynes'
16:15jrobieif i evaluate the (defn) in the interpreter first, then i can evaluate line 11 or line 12
16:15jrobieif not, i get that error
16:15mdeboardjrobie: Dunno, runs perfect for me in clojure mode
16:16TimMcjrobie: How else would you expect the defn to be visible to the later expressions?
16:20jrobieTimMc, mdeboard - i must be missing a step. is there a way to process all (defn)s in a buffer so i can evaluate expressions?
16:20jrobieif i do that by hand (cut and paste into the inferior lisp buffer), it works fine
16:21TimMcI believe there is a command for that, yes -- I don't use swank myself, so I don't know what it is.
16:21jrobieok, thanks - i'll look around
16:21mdeboardjrobie: There's M-x slime-eval-region and M-x slime-eval-buffer
16:22jrobiethanks, mdeboard !
16:22mdeboardnp
16:25photexmdeboard is slime-eval-buffer different than C-c C-l ?
16:25mdeboardphotex: I dunno
16:25photexsorry to chime in, but I'm new to the swanky universe as well, and have been using that to evaluate my file
16:26photexoh
16:26photexthat is slime-load-file
16:26mdeboardYouc an do C-h w
16:26mdeboardthen type the command to get the hotkey
16:26TimMcphotex: C-h k C-c C-l will tell you what C-c C-l does
16:26Bronsaoh god, dem many C-*
16:26TimMcs/does/is bound to/
16:27photexok, C-c C-l loads a file, slime-eval-buffer is not bound
16:27TimMc(Make sure you do it in the right mode.)
16:29photexchecked from clojure mode
16:30photexseems like it would save time to map slime-eval-buffer to a key
16:30photexnot sure how often I'd just load a file I didn't already have open
16:30jrobiephotex, C-c C-l works for me
16:31photexbut it asks for the filename first
16:31TimMcI'm on the verge of trying to figure out how to add a keybinding for paredit-convolute-sexp
16:34photexoh snap C-c C-c
16:51mdeboardI feel like whoever made these 4clojure problems knew exactly what my first-pass solution would be, and wrote the last test specifically to foil it, every time.
17:08callenmdeboard: aye, they did.
17:09callenmdeboard: they want to force you to learn something, so they eliminate the shortcuts that occur on the way there.
17:09lakeI would like to get autocomplete inside of the clojure repl (clj). Is it possible?
17:09technomancylake: leiningen 2 has that
17:09callentechnomancy: o_O
17:09technomancyclj is weak sauce though; you will want to ditch that
17:09callenoh, so you mean in slime?
17:10technomancycallen: no, jline2
17:10technomancy"the jline that isn't terrible"
17:10callenso lein repl then.
17:10technomancyit's pretty slick
17:10technomancyyeah
17:10callentechnomancy: what about auto-complete for clojure-mode and slime that doesn't rely on my magic autocomplete?
17:10muhoois the idiomatic way to loop over stuff for side effects to (doall (for [b something] (stuff b))), or is there a better way?
17:11pandeiromuhoo: doseq?
17:11callento be fair, I saw Hickey's code do that in the concurrency talk IIRC
17:11technomancycallen: M-tab should do smarter completion
17:11technomancysmarter than dabbrev, for when you need it
17:11callensmarter...as in...knows the classpath?
17:12technomancyyeah
17:12technomancywell, for everything that's already been required
17:12technomancyand java static stuff
17:12callenokay. that seems good.
17:12technomancyit is!
17:12technomancyit's pretty good, I mean
17:12technomancystill no method completion on type-hinted locals
17:12technomancythat would be the best
17:12muhoopandeiro: thanks, that seems better
17:16laketechnomancy: my version of lein is 1.7, having trouble finding version 2
17:17lakeshould i just use clojure-mode in emacs? would that give me autocompltere
17:17lakeautocomplete*
17:17technomancylake: sorry; should have mentioned it's not technically released yet
17:17technomancyactually I think you can use lein2's repl in lein1 with a plugin
17:17technomancyclojurebot: reply?
17:17clojurebotIt's greek to me.
17:17technomancyclojurebot: reply is the new high-powered repl that powers lein2's repl task https://github.com/trptcolin/reply
17:17clojurebotc'est bon!
17:18trptcolinlol @high-powered :)
17:18emezesketechnomancy: So I *think* the only task that remains for cljsbuild to support lein2 is updating its hooks
17:19emezesketechnomancy: But I am a little confused about how they need to change
17:19emezesketechnomancy: The existing hooks look like the ones here: https://github.com/technomancy/robert-hooke/blob/master/README.md
17:19muhooclojurebot: it's greek to me too.
17:19clojurebotCool story bro.
17:20emezesketechnomancy: But they're doing weird things when 'eval-in-project' is called
17:20technomancyemezeske: what functions are you hooking?
17:21emezeskejar/write-jar clean/clean test/test compile/compile
17:21technomancyemezeske: write-jar is the only one that may have changed
17:21laketechnomancy, trptcolin: reply is working well. thanks for your contributions to the community!
17:21technomancyemezeske: actually scratch that; it hasn't
17:22emezesketechnomancy: Hmm, I've tried various combinations of commenting out each hook independently, they all seem to do odd things
17:22trptcolinlake: great, glad to hear it! please do open github issues if you have ideas on things you'd like to see
17:22technomancytrptcolin: does it work as a lein1 plugin now?
17:23emezesketechnomancy: It's like when eval-in-project is called, the hook code is somehow getting executed
17:23trptcolini haven't tackled that yet
17:23technomancybut it's still usable via the shell script?
17:23trptcolinright. thanks for the reminder though, i'll add an issue for a lein1 plugin
17:27emezesketechnomancy: Okay, so what seems to be happening is that leiningen.core.main/apply-task is somehow being invoked inside the subproject when my code calls eval-in-project
17:27technomancywhoa; that's crazy
17:27emezesketechnomancy: https://refheap.com/paste/822
17:28emezesketechnomancy: line 38 is where eval-in-project is called
17:28technomancyemezeske: oh, ok
17:28technomancybefore you run any code inside the project, you have to prep it
17:28technomancythis means seeing if you need to do any AOT or javac
17:29technomancyso eval-in-project is triggering the hook you added to the compile task
17:29emezeskeahh, preparing the project involves compiling it
17:30emezeskethe thing I don't understand is, why does the subproject see my hooks?
17:30emezeskeI am not passing through the :plugins
17:30technomancyit never gets to the subprocess
17:30emezeskeohh
17:30emezeskethe preparations happen in the parent?
17:30emezeskeso somehow I need to unhook my hooks right before calling eval-in-project
17:30technomancywell, the compilation should happen inside the project, but your hook is blowing up before it reaches that
17:31emezeskethe subproject is being passed to my hook, and the subproject doesn't have the :cljsbuild config in it
17:31emezeskeso my hook blows up with "hey no :cljsbuild config found"
17:32emezeskeI wonder if there's something better for me to hook than compile/compile
17:32emezeskeanyway, thanks for the insight, I think I at least get why this is happening now
17:32technomancyoh, maybe check the leiningen.core.eval/*prepping?* flag?
17:32technomancy
17:33emezeskeooh
17:33emezeskethat might do the trick
17:33technomancywon't work in 1.x
17:33emezeskethat's easy enough to deal with
17:40hagnaRaynes: is irclj supposed to work with clojure 1.3?
17:42aaelonyRickInGA: Devil's interval is the tritone
17:45hagnaaaelony: heh maybe in the 1800s
17:50muhooi love tritones
17:50muhooi've used them a lot in my devil's music.
17:54aaelonyhagna: even today. tritone substitution is pretty common in jazz as well
18:01muhoowhat is import-fn?
18:01muhooi see it all over the place in aleph code, but can't figure out where it is coming from
18:01muhooactually it's in gloss, everywhere. still can't figure out where it is coming from though.
18:02RaynesInsane is what it is.
18:02Rayneshttp://github.com/ztellman/potemkin it's the most vile thing ever thought up.
18:03muhoo:-/
18:03muhoogreat
18:04muhoocan you recommend good asynchronous network socket stuff for clj that is not based on things that are "vile" and "insane" ?
18:04muhoobecause i was really liking aleph. until now.
18:04RaynesWell, Aleph is actually pretty good.
18:05muhoobut it's based on potemkin
18:05muhoowell, let me be clear, it's based on a million things, including gloss, which is based on potemkin
18:05Raynes'based' is the wrong word here
18:05RaynesYou shouldn't really have to know that it uses potemkin under the hood.
18:05RaynesUnless, of course, you're digging around for some reason
18:05muhoono, but if i'm tracing the source code to see what it does
18:06muhooi have to go deeper, and deeper, and deeper..
18:06muhooand i find stuff that is "vile", i get worried.
18:06RaynesHeh
18:06muhoolike, maybe i shouldn't be wasting time with this.
18:06RaynesWell, anyways, aleph and gloss are generally excellent things.
18:06muhoomaybe i should ask if there's a better option
18:07RaynesTake a deep breath.
18:07muhooi'm not trippin.
18:07hagnaaaelony: b eb e a
18:07muhoojust amused, mostly.
18:07Rayneshagna: It should work on 1.3, theoretically. I think I tested it against 1.3.
18:08muhooseriously, what's so wrong with potemkin?
18:08callenI'm wondering too.
18:09muhoohmm, i think i see https://github.com/ztellman/potemkin/blob/master/src/potemkin/namespace.clj
18:09muhoowhy would he be writing a macro to import functions from another namespace?
18:09muhoowhat's wrong with use?
18:09RaynesIt is a bandaid over bad library organization.
18:09muhooaye
18:10callenthat's pretty strange.
18:10hagnaRaynes: well in lib/irclj-0.5.0-20111019.122151-1.jar I get an error about not resolving send-message on core.clj:65
18:10callenthe throw-arity stuff is pretty hilarious.
18:10RaynesI'm not sure I actually released any snapshots of the rewrite because it wasn't finished.
18:11TimMcAnything named "potemkin" has a good chance of hideousness.
18:11muhooi mean, i don't want to slag the dude, he's obviously way more skilled than me
18:11Rayneshttps://github.com/ztellman/potemkin/blob/master/src/potemkin/map.clj#L30
18:11muhoostill, i don't want to learn how to write stuff that's "vile", nor base my apps on it
18:11RaynesDear God.
18:12callenso.
18:12ibdknox|awaylol
18:12callentellman is a madman, right?
18:12muhoowhat the screaming fuck?
18:12RaynesThere aren't really any good alternatives.
18:13hagnaRaynes: so that's idiomatic clojure?
18:13RaynesThis shit I just linked to?
18:13hagna:)
18:13RaynesI don't even know what this *is*, but I highly doubt it is a good idea.
18:13muhoono "If your name isn't Rich, don't write a form as long as, say, the definition of doseq."
18:13muhoohttp://dev.clojure.org/display/design/Library+Coding+Standards
18:14ibdknoxin general, much of core serves as an example of how not to write idiomatic clojure ;)
18:14callenso are there any alternatives to Aleph, or is this the bed we've made?
18:14RaynesWell, keep in mind that Aleph isn't potemkin.
18:14hiredmanreally?
18:14RaynesIt just used the library for whatever reason.
18:15muhoono, it just calls gloss which calls potemkin
18:15muhoowhich mean throw-arity will appear in your stacktrace, sometime, when you least expect it :-)
18:15RaynesI don't much like Java, but Clojure calls Java under the hood sometimes. :p
18:15muhoogood point.
18:15RaynesThough I feel your throw-arity pain.
18:15ibdknoxI wouldn't let the implementation detail distract from the use of the lib
18:16emezeskex86_64 assembly is a beast too, and it's even harder to get away from
18:16Raynesibdknox: I think his biggest issue is that it muddles the stacktraces.
18:16RaynesWhich is a serious problem, if true.
18:16ibdknoxhm yeah
18:16muhoono, i'm just scared that i'll be faced with a problem and be stuck in a corner having to deal with code like that
18:16ibdknoxah, it should limit you
18:16ibdknoxI wouldn't worry about that
18:17Raynesshouldn't*
18:17ibdknoxyeah, sorry. shouldn't limit you
18:17muhoothis is interesting
18:18muhooin other languages, i'm used to crappy code in underlying libraries bubbling up and causing me Pain and Anxiety
18:18muhooi'm getting the sense that in clojure perhaps it's not as much a concern?
18:18accelI wnat to delete an element from a map; I don't want to do (merge MAP {:key nil}) ... is there an away to actually delete the entry?
18:18ibdknoxaccel: dissoc
18:19muhoobut it does limit my ability to reason about the code
18:19ibdknoxyou shouldn't have to think down at that level
18:19ibdknoxif you do, there's something wrong with the lib
18:20muhoowell, or with me. but it's possible in this case, that it's the lib.
18:20muhoohere's what i was trying to do, as an example
18:20Kowboyibdknox, considering your work on jayq, do you have any thoughts on using modernizr with cljs?
18:20muhooi was trying to figure out how to stop an http server created with start-http-server
18:21accel,(doc dissoc)
18:21clojurebot"([map] [map key] [map key & ks]); dissoc[iate]. Returns a new map of the same (hashed/sorted) type, that does not contain a mapping for key(s)."
18:21accelibdknox: nice; thanks
18:21muhoothere is no stop-http-server. so i'm tracing the code of start-http-server, to see if anywhere there's some *thing* i can grab onto, and call some kind of (stop *thing*) on it
18:21ibdknoxmuhoo: it used to be that it returned a function that you could use to stop it
18:22muhooand only 2 layers deep i get to gloss, calling import-fn, and that let me to that brain-exploding namespace.clj page
18:22muhooit returns a function, but it's unclear to me what the function does :-/
18:22ibdknoxKowboy: it'd probably look similar to jayq
18:22muhooagain, sent me diving into the source to try to figure it out
18:23ibdknoxmuhoo: that's a documentation problem
18:23ibdknoxmention it on the aleph list, Zach is usually very good about trying to clear those up
18:23muhoook, will do, thanks.
18:23Kowboymaybe I found something I can contribute then
18:23Kowboyhmmm
18:24ibdknoxit'd actually be quite a bit simpler than jayq
18:24ibdknoxsince you don't have an object you'd need to extend to the collection stuff
18:28muhooibdknox: got it, (defn start-server "Starts a server. Returns a function that stops the server."
18:29muhoostart-http-server calls start-server, and bob's yer uncle.\
18:29ibdknoxthat's annoying
18:29ibdknoxthat docstring should be on start-http-server as well
18:29ibdknoxI'd file a bug
18:29muhoowill do
18:30muhoodoesn't functional programming tail-recurse docstrings? :-)
18:31callendo ho ho.
18:31callenwe got a comedian here.
18:32qbgReal programmers read the generated byte code instead
18:32callenI thought they wrote Fortran instead.
18:36Kowboyibdknox, " Virtually the entire web is built on $ and that means nearly every computer connected to the internet already has a google CDN'd version of jquery on their machine."
18:36Kowboythat's not necessarily true of modernizr
18:36Kowboybut I don't think it is very big anyway
18:37pandeirowhat would be the expected behavior for let bindings inside a doseq in cljs? i thought i could use the let bound symbols in event handlers because cljs would be doing some gensym for the actual var names but that's not the case.
18:37ibdknoxKowboy: using modernizr is a much higher-level choice
18:37ibdknoxyou can't really do much in JS without dom manipulation, and so no matter what you need goog.* or jquery or mootools or something
18:38ibdknoxpeople who want to use modernizr are explicitly making a trade-off
18:38ibdknoxKowboy: in short, I don't think that point is nearly as important in that case :)
18:39KowboyI see
18:39Kowboyis it even worth wrapping with cljs?
18:41ibdknoxnot sure, I haven't used enough to know how much code you actually have write to use it
18:41ibdknoxI thought actually you didn't really have to write anything
18:42lynaghk`Kowboy, Modernizr is not very large, and there is a custom build tool online that lets you pick out only the features you want to detect
18:42pandeiroKowboy: i'd say it depends what features you need to detect... if it's just 2-3 things i'd just write cljs fns to do it the same way Modernizr does it, that's what I've done for things eg localStorage support
18:51pandeirok answering myself, no, let bindings inside doseq in cljs do not behave as they do in clojure...
18:51ibdknoxpandeiro: hm?
18:53pandeiroibdknox: if you do let bindings inside a doseq in cljs, the references shadow each other if you're using those bindings for say event handlers
18:54hiredmanthere is an open bug for it, dnolen was discussing it in here the other day
18:54callenAHA, antirez is an Emacs user.
18:54callenI knew it.
18:54pandeirohiredman: ah ok, so i won't make a ticket then
18:54ibdknoxah
18:54ibdknoxthat
18:57technomancyemezeske: were you going to use prep-tasks in lein-cljsbuild?
19:02emezesketechnomancy: yeah, that's my plan
19:03emezesketechnomancy: basically just make my hooks noops if it's set
19:03technomancyemezeske: ok, I just pushed out a change that might affect you
19:03technomancythe list of prep tasks to run gets passed around in the project map now
19:04technomancyit's possible that instead of adding hooks, you could just tell the user to put :prep-tasks ["cljsbuild"] into project.clj
19:05technomancyI can elaborate if you need
19:05emezesketechnomancy: hmm, would that work for e.g. what is now the "lein clean" hook?
19:05technomancyoh, for that you should just put all your stuff in the :target-path
19:05technomancyand it will get cleaned
19:06emezeskeI don't know about this :target-path -- what is it normally used for?
19:07technomancyit's a place for all generated files
19:07technomancy.class files, jars, what have you
19:07emezeskethis is a new lein2 thing?
19:07technomancyyeah
19:07technomancyhm; that might make it harder to support both 1.x and 2.x in the same codebase
19:07technomancyyou should join #leiningen =)
19:12mdeboardWhat determines the order of the following:
19:12mdeboard&(group-by (fn [x] x) (range 50))
19:12lazybot⇒ {0 [0], 32 [32], 1 [1], 33 [33], 2 [2], 34 [34], 3 [3], 35 [35], 4 [4], 36 [36], 5 [5], 37 [37], 6 [6], 38 [38], 7 [7], 39 [39], 8 [8], 40 [40], 9 [9], 41 [41], 10 [10], 42 [42], 11 [11], 43 [43], 12 [12], 44 [44], 13 [13], 45 [45], 14 [14], 46 [46], 15 [15], 47 [47]... https://refheap.com/paste/825
19:12mdeboard0, 32, 1, 33, 2, 34, 3, etc.
19:12qbghashcode
19:12mdeboardah
19:12mdeboard&(hash 0)
19:12lazybot⇒ 0
19:12mdeboard&(hash 32)
19:12lazybot⇒ 32
19:12mdeboardor what
19:13qbgIt seems to be using only the lower 5 bits due to the small number of items
19:14mdeboardahhhh
19:14mdeboardinteresting
19:14qbgNot sure what the cut off point is for persistent hashmaps
19:15qbgIf you want it in order, use a sorted map instead
19:17mdeboard&(doc group-by)
19:17lazybot⇒ "([f coll]); Returns a map of the elements of coll keyed by the result of f on each element. The value at each key will be a vector of the corresponding elements, in the order they appeared in coll."
19:22amalloymaps aren't ordered in any way. the order of seq (or printing, which relies on seq) is arbitrary
19:23mdeboardThey must be ordered in some way, right
19:23qbgimplementation detail
19:23qbgfor general purpose maps that is
19:24amalloymdeboard: the map {:a 1, :b 2} has no ordering. it is a "node" with two children. neither is left or right - there's just the one labeled :a and the one labeled :b. it has to give them to you in *some* order when you ask for all of them, but that's an accident, not an integral property
19:25mdeboardunderstood
19:25mdeboardso (group-by) isn't a function to call when order is important
19:25qbgYou can pour it into a sorted map afterwards if you want
19:25amalloygroup-by preserves the order of the values within each key, but not the order of keys
19:26qbgor sort the map if you want a sorted seq of map entries
19:26amalloyhow could it, anyway? ##(group-by even? (range 5))
19:26lazybot⇒ {true [0 2 4], false [1 3]}
19:27qbgUsually no need to do either of those though
19:27mdeboardWell, just speaking in the context of the particular problem I'm working on
19:31muhooi vaguely remember some function that will give me a list of all the symbols in a (or current) namespace. but i don't remember what it was
19:31ibdknox,(doc ns-publics)
19:31qbg,(ns-publics 'clojure.core)
19:31clojurebot"([ns]); Returns a map of the public intern mappings for the namespace."
19:31clojurebot{sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, keyword? #'clojure.core/keyword?, unchecked-inc-int #'clojure.core/unchecked-inc-int, ...}
19:31ibdknoxlol
19:32qbgclojurebot feels burdened today :p
19:32muhooah, ns-publics, thanks
19:32muhoo,(keys (ns-publics 'clojure.core))
19:32clojurebot(sorted-map read-line re-pattern keyword? unchecked-inc-int ...)
19:33qbgSee also ##(doc ns-interns)
19:33lazybotjava.lang.SecurityException: You tripped the alarm! ns-interns is bad!
19:33qbg,(doc ns-interns)
19:33clojurebot"([ns]); Returns a map of the intern mappings for the namespace."
19:34qbgInteresting lazybot behavior...
19:34qbgMakes sense I guess...
19:40dnolenpandeiro: hiredman: ibdknox: i fixed the let locals in loops bug a couple days ago
19:41pandeirodnolen: awesome, thanks... unrelated: what about the gratuitous property syntax warnings?
19:41technomancyhah; three-star review for the Reasoned Schemer: "I guess this book is OK, but it could really be written in all of about 5 to 10 pages of text with half a page of implementation code - in Haskell."
19:43technomancy...with a reply from dnolen himself; awesome =D
19:43dnolentechnomancy: heh
19:43dnolenpandeiro: probably will get removed in the next release (whenever that is)
19:44muhoohipstergrammers
19:44alexykis there a shorter way to return nil or keep computing: (if (= res "skip") nil (s2l res))
19:45hiredman,(doc when)
19:45clojurebot"([test & body]); Evaluates test. If logical true, evaluates body in an implicit do."
19:45technomancyalexyk: if-not?
19:45alexykI want nil returned too
19:45technomancy,(if-not true :a)
19:45clojurebotnil
19:45hiredmanalexyk: do you not get that everthing is an expression?
19:46alexykhiredman: getting it sir!
19:48alexykthanks for when
19:56choffsteinDoes anyone have any exampe source-code of using ring / aleph / moustache to force an https connection? I can't quite seem to figure it out. Should I just be writing a custom wrapper?
19:57weavejesterchoffstein: Usually that's handled by a redirect. If the user goes to HTTP, redirect to the HTTPS URL.
19:57alexykin (fn [[[id1 ks1] [id2 ks2] res extra]] …), how do you name [id1 ks1] as a whole?
19:57alexykin destructuring
19:57choffsteinweavejester: that's what I assumed -- but I can't figure out where it should go in my logic. Is that a handler wrapper to just redirect?
19:58weavejesterchoffstein: You could write it as middleware...
19:58choffsteinweavejester: that's what I thought. Okay, I'll have at it. Thanks.
20:10qbgalexyk: That is a pretty complex destructuring for fn. Why not use a let inside the fn?
20:17arohnerI'm somewhat confused by slingshot/throw+. If I do (throw+ {:foo :bar} "a message %s" "foo"), I expect to get a :message in the &throw-context that I catch. Is that correct?
20:18arohnermy &throw-context contains only the data I threw, no :message, :cause, :environment, etc
20:26murmhello
20:27murmany selenium/clj-webdriver gurus in the house tonight?
20:28arohnerclojurebot: ~questions
20:28clojurebotCool story bro.
20:29mdeboardlol
20:30alexykqbg: still if I want to name a sub vector in restructuring, how would I do it?
20:30qbgYou mean in addition to the names for its elements?
20:31qbgor instead of?
20:31arohnermurm: rather than asking if you can ask a question, just ask your question. Maybe someone will answer, maybe they won't
20:32alexykqbg: in addition of course
20:32murmarohner: I have instances where an operation fails and then my driver loses connection to the browser.
20:32qbg,(let [[[id1 ks1 :as foo] [id2 ks2] res extra] [[1 2] [3 4] 5 6]] [id1 ks1 foo id2 ks2 res extra])
20:32clojurebot[1 2 [1 2] 3 4 ...]
20:33murmI'd like to be able to regain that connection to the browser and not have to start up a new driver/browser
20:33alexykright, thx!
20:33qbgthere :)
20:42mdeboardI'm a little confused by the wording of a 4clojure problem, http://www.4clojure.com/problem/95 ... why is `nil` considered a node?
20:43muhoothat's weird. in my classpath is clj-json-0.4.3.jar , but (require [clj-json.core :as json]) fails, CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: clj-json.core, compiling:(NO_SOURCE_PATH:19)
20:43muhoowhat gives?
20:43gfredericksforgot to quote it?
20:44muhoo(require ['clj-json.core :as json]) CompilerException java.lang.RuntimeException: Unable to resolve symbol: json in this context, compiling:(NO_SOURCE_PATH:22)
20:44gfredericksquote the whole vector
20:44muhoodoh, thanks
20:44gfredericksor equivalently, also quote the json
20:44muhooWarning: *coercions* not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic *coercions* or change the name.
20:45muhoobut i expected that already :-)
20:45muhooworks
20:52zakwilsonRing's url-encode seems to think a space should be +. The rest of the world, last I checked thinks it should be %20. What am I missing?
20:53technomancyISTR they're both acceptable
20:53weavejesterzakwilson: It just wraps the standard URLEncoder Java class, so any quirks are carried through
20:55zakwilsontechnomancy: + doesn't seem to be treated as space by nginx, so this is at least a little problematic for the purpose of url-izing filenames to be served by a static web server.
20:55weavejestertechnomancy: The "+" isn't actually part of URL encoding - it's something of a de facto standard that grew from HTML forms.
20:55zakwilsonweavejester: yeah, I read the source.
20:56technomancyhuh
20:56technomancywho has time for standards in today's modern lifestyles?
20:56weavejesterHaha :)
20:57weavejesterWhen I was writing the cookie middleware for Ring, I read the specs carefully
20:57weavejesterThen, after I implemented it, I found out that no browser actually follows those specs
20:57zakwilsonHeh... well, I don't have time for stuff that doesn't work, and it appears in this case it's java.net.URLEncoder that doesn't work.
20:58zakwilson(no offense to weavejester; Ring is awesome)
20:58weavejesterzakwilson: I'll change it for RIng 1.1 if I get a patch. I'd like to have a url-encode/decode and a form-encode/decode
20:59weavejesterAnd the form-encode should be able to handle maps as well...
20:59weavejesterAnd I'd like a pony :)
20:59zakwilsonweavejester: are you saying I should write a URL encoder and give it to you?
21:00weavejesterOr maybe a form-encode-params...
21:00technomancydelegating is the best way to get code written!
21:00technomancyclojurebot: isn't that the secret behind your origin tory?
21:00clojurebotTitim gan éirí ort.
21:00technomancystory
21:00weavejesterzakwilson: You might be able to cheat a little
21:01espringeHow do I concat strings in a sequence? e.g. (str (concat ["a" "b" "c"])) (except that doesn't actually work)
21:01zakwilsonweavejester: I can get somebody else to shoot the author of the Java library?
21:01technomancyespringe: apply str
21:01espringetechnomancy: thanks
21:01weavejesterzakwilson: https://github.com/weavejester/clout/blob/master/src/clout/core.clj#L28
21:01technomancynp
21:02weavejesterzakwilson: In the Java URLEncoder, spaces are erroneously encoded as +, and + is encoded as %2B
21:03weavejesterzakwilson: So combine URLEncoder with a search and replace to patch the behaviour :)
21:03zakwilsonweavejester: so I could just string-replace + with %20 after... yeah, that.
21:03qbgOr you write your own
21:03zakwilsonqbg: I don't want to.
21:03qbgBut its fun!
21:04zakwilsonAnd you can't make me!
21:04qbg(once)
21:04cemerickThe big-ball-o-mud keeps on rollin'.
21:04zakwilsonSomebody else's problem!
21:04qbgThere needs to be Lisp flavored ice cream
21:04weavejesterA lot of Java libraries are programmed wrong :/
21:05zakwilsonweavejester: really? I hadn't noticed!
21:06weavejesterI'm not too fond of the HttpServlet family myself :)
21:06weavejesterMixing cookies, sessions and raw HTTP request parsing? Ack!
21:06weavejesterCGI is a better implementation.
21:06qbgJava needs a @Joke annotation
21:07weavejesterThe Jetty 6 SSL API is terrible as well. Fortunately it's very much improved in Jetty 7.
21:08weavejesterAnd KeyStores!
21:08weavejesterDon't get me started on KeyStores :(
21:08qbghttp://static.springsource.org/spring/docs/2.5.x/api/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.html
21:09weavejesterqbg: Noooooooooo!
21:09qbgBut that is a different kind of brokenness
21:10qbghttp://nooooooooooooooo.com/
21:11weavejesterJava often reinvents the wheel, and makes it square.
21:12zakwilsonI'm stealing that.
21:13qbgAnd in Java land, 'square' means you need to implement four classes to use it
21:15espringeIs there a clojure equiv to haskells 'intercalate' function? E.g. (intercalate "," ["aa" "bb" "cc"]) would return "aa,bb,cc"
21:16arohnerespringe: clojure.string/join
21:16espringearohner: perfect! Thanks
21:17callenwow.
21:17callenthey managed to rename join to intercalate?
21:17callennever let mathematicians design a programming language I guess, hahahaha.
21:18qbgWell, if the motto of your language is "Avoid success"...
21:18tensorpuddingthere's already a function in haskell called join
21:18Guest38809weavejester: i was doing java the other day, and did astring.replace and wondered why it wasnt working, i forgot that unlike everything else in java, strings are immutable and therefore replace returns a new string
21:18tensorpuddingit does something totally different
21:18Guest38809err
21:19callentensorpudding: dare I ask?
21:19espringeAnd intercalate in haskell is a bit different in that it works on lists as opposed to strings. The type is: [a] -> [[a]] -> [a]
21:19ivan___i use scala a lot, but i assume immutablity there, in java i assume mutablity
21:19qbg&(interpose "," ["aa" "bb" "cc"])
21:19lazybot⇒ ("aa" "," "bb" "," "cc")
21:21weavejesterYeah, in Clojure intercalate = interpose, but in Haskell strings are, IIRC, just lists of characters, rather than their own thing.
21:21weavejesterIt's pretty convenient because list operations work on strings.
21:22tensorpuddinghaskell doesn't have an object-ful language that undergirds it
21:22tensorpuddingcallen, join in haskell is a monad thing
21:22tensorpuddingwhy it's called join i don't knew, though, probably tradition
21:24callentensorpudding: I have an easier time understanding monads in languages that aren't Haskell, than I do in Haskell.
21:24callenI've not determined why this is the case yet.
21:24tensorpuddingi have not seen monads outside of haskell and scheme
21:24tensorpuddingi don't care enough to look
21:25weavejesterYeah, join in Haskell is really odd
21:26tensorpuddingit just "flattens" a layer of monad
21:27weavejesterYeah, I mean, it's not odd, but it's one of those functions that seems to do such wildly different things, even if underneath it's simple.
21:28weavejesterYou can use it to flatten lists, for instance, but also to compose functions.
21:28tensorpuddingit's because monads are such a generic thing
21:29tensorpuddinglist monads are easy to understand, the function monad is less so
21:29weavejestertensorpudding: Yeah. They're technically very simple, but because they're so abstract, they can be difficult to understand because they often don't relate to anything concrete.
21:30devnwhere'd clojure.contrib.seq-utils go?
21:30devnspecifically includes?
21:30devn"includes?"
21:42mdeboardFor anonymous functions how do you indicate variable arity? e.g. #(assoc my-map :key [% & more]) sort of syntax.
21:44Kowboywell, poo
21:44Kowboywas trying out ibdknox's overtone example, the the site hosting the piano samples file is down
21:46jeremyheilermdeboard: you use %&
21:47mdeboardjeremyheiler: Thanks :)
21:50devnKowboy: I could host it for you if you want
21:51devnKowboy: you'll need to figure out where it puts the samples though
21:55muhooKowboy: use a differnt soundfont then?
21:59muhoosomeone explained monads to me as being "like jquery". that made sense to me. until it didn't.
22:00muhooah, this, it was: http://importantshock.wordpress.com/2009/01/18/jquery-is-a-monad/
22:08devnKowboy: I wouldn't worry too much about using the sampled-piano inst. Just use any old instrument.
22:09devnKowboy: also, there's the #overtone channel. It
22:09devnIt's not as active, but it'd be nice if it were
22:11devnmuhoo: monad is a word that is bigger than its name suggests
22:13devnmuhoo: id focus on specific kinds of monads, and even then, forget about them for the most part. read about them, but don't obsess over them. there's an old rhetorical joke in the haskell community: "brb, reading another monad tutorial"
22:14devnyou learn about them when you need them only because you know enough to consider them as a possibility when you actually need them.
22:18devnfor instance, i read a ton about monads, "got them", and then started to program actual stuff i wanted to use. it wasn't until i started toying parser combinators and thinking about quickcheck that i found them useful in practice. don't find monads. let them find you. :)
22:19devn</rant>
22:20devnmuhoo: ^
22:21devnmuhoo: that, or...get obsessed with them and write another monad tutorial for clojure. both are worthwhile endeavors, just trying to underscore that it is not a pre-requisite to making substantial things that people find useful and interesting.
22:22devn</second-rant>
22:23murmhas anyone ever used htmlunit with clj-webdriver?
22:24devnmuhoo: not yet, but ive been looking forward to parallelizing some tests with clj-webdriver
22:24devnerr murm*
22:25murmwould love to get htmlunit working
22:25murmI need headless
22:25devnmurm: gist what you have?
22:25devnmurm: i probably can't help you honestly, leaving in a moment
22:25devnbut i'd like to see the germ of the idea
22:26murmjust automating a web workflow to save time
22:26tmciverI'm running through an enlive tutorial (https://github.com/swannodette/enlive-tutorial/). I'm having trouble with the part that has you 'load' a file and the 'in-ns' to that file's namespace. Trouble is trying to evaluate *base-url* fails for me. Anyone have any insight into what's going on?
22:26murmhaven't looked at the problem in a few weeks
22:26murmbut my issue was getting javascript turned on for the htmlunit driver, I think
22:27devntmciver: could you explain how you get to the place where *base-url* is supposed to be available?
22:27murmI'm rolling my sleaves up now, to get back into the probelem
22:27devnmurm: ahhh, yeah, i have no idea on that front.
22:28devnmurm: seems like a driver-level issue
22:28tmciverdevn: From tutorial: user=> (load "tutorial/scrape1")
22:28tmcivernil
22:28tmciveruser=> (in-ns 'tutorial.scrape1)
22:28tmcivernil
22:28tmcivertutorial.scrape1=> *base-url*
22:28tmciver"http://news.ycombinator.com/&quot;
22:28tmciversorry for spamming.
22:28devntmciver: no prob this time, but in the future gists are nice, or inline it
22:28murmyea, I'm not sure if htmlunit implements all the same options that the other drivers do
22:29devnmurm: htmlunit is faster, but yeah, i think it leaves out the kitchen sink on purpose
22:29tmciverNot sure if this tutorial is old but I don't usually see 'load' followed by 'in-ns'; usually one uses use.
22:30murmnot being able to turn on the javascript is a showstopper though
22:30devnmurm: are you peeking at source
22:30tmciverActually, it looks like the tutorial is a little old.
22:30devntmciver: what editor do you use?
22:30devntmciver: it is a little old...
22:30murmdevn: I went spulunking... no luck
22:30murmjust confused me
22:31tmciverI use emacs, but this tutorial includes code so I just fire up 'lein repl' and run that code there.
22:31devnmurm: it seems fairly straightforward in some ways. im just browsing, but the functions for things like "refresh", "switch-to-window", etc. are pretty common
22:31devntmciver: do you ever use clojure-jack-in?
22:31murmdevn: yea, I can use those fairly effectively
22:32tmciverdevn: Yes, I actually usually do, I was trying to follow the tutorial to the letter.
22:32tmciverdevn: maybe I shouldn't . . .
22:32devnclj-webdriver is really a nice library
22:33devntmciver: i could try out your exact steps if you gist them
22:34devntmciver: it sounds like you lein deps, lein repl, (load "foo/bar.clj"), (in-ns 'foo.bar), *base-url*
22:34tmciverdevn: yes, that's it. It's given at the link I gave for the tutorial under the heading: "Your First Scrape with Enlive – Hacker News"
22:35murmoooh, check out clj-webdriver-taxi: https://github.com/semperos/clj-webdriver/wiki/Introduction%3A-Taxi
22:35devntmciver: it works for me
22:35tmciverdevn: *base-url* resolves? Hmmm.
22:35devntmciver: yeah, no problem here
22:36tmciverdevn: I'll try again. Thanks for the verification.
22:36tardowhat's the website with the clojure lessons/challenges
22:36tardoi can't find it anywhere
22:36Raynes4clojure.org
22:36tardotyvm
22:36Raynesyavw
22:36devntmciver: git clone url-for-enlive-tutorial, cd enlive-tutorial, lein deps, lein repl, (load "tutorial/scrape1"), (in-ns 'tutorial.scrape1), *base-url* => "http://news.ycombinator.com/&quot;
22:36taufiq1does gen-class let you add java annotations? need to interop with an existing library
22:37devnRaynes: you swooped in there for the kill. well done, sir.
22:37devntaufiq1: http://kotka.de/blog/2010/02/gen-class_how_it_works_and_how_to_use_it.html
22:38tmciverdevn: ran through it again and it works. Don't know what I did wrong but thanks again!
22:38devntmciver: no problem man. have fun! :)
22:40taufiq1devn: thanks, i've been through that page, perhaps I missed the mention of adding annotations but I haven't seen any. Is it done as part of the metadata?
22:40devntaufiq1: honestly I've never done it, I just had that link in my bag of gen-class tricks.
22:41devntaufiq1: could you speak in a more general sense about the problem? you seem to want annotations, what got you there?
22:41taufiq1Need to interoperate with an existing java library that looks for specific method annotations
22:41taufiq1I can probably make do with using deftype and its annotation support instead
22:42devntaufiq1: yeah i think that's where i was headed next
22:42devntaufiq1: deftype seems like the way to go
22:42taufiq1haven't used it before, always good to learn something new
22:43devntaufiq1: here's an old thread, but it looks pretty relevant to your issue: http://groups.google.com/group/clojure/browse_thread/thread/d2128e1505c0c117
22:43tardowould you compare lists to arrays in other languages, or is there a notable difference
22:43taufiq1mm, that example looks good, thanks again devn
22:43devntaufiq1: no problem
22:44devntardo: there is a notable difference. http://en.wikipedia.org/wiki/Linked_list#Linked_lists_vs._dynamic_arrays
22:46tardodevn: oh i see, i had to write linked lists object classes back in highschool lol, just didnt realize that's what '(1 2 3 4) was
22:46tardoty
22:46devntardo: it's not === a clojure '(1 2 3)
22:46devnbut in general the above link draws the distinction
22:47tardokk
22:48devntardo: check out http://clojure.org/data_structures
22:48muhoodevn: thanks i won't obsess over stuff i don't understand and probably don't need; there's plenty still that i don't understand and definitely do need
22:49muhoohmm, where was i in 2010 when everyone was writing blogs about clojure?
22:49devnmuhoo: it's fun. clojure is a great opportunity to learn a ton, but my experience has been to pick my battles or it will be overwhelming. sometimes i devote a weekend to thinking about something specific, other times i just make stuff for fun. it's been a balancing act for me.
22:49devnmuhoo: they're still writing them! :)
22:49devnmuhoo: planet.clojure.in
22:50devndisclojure.org
22:50muhooseems to me like 2010 was Peak Clojure Blog
22:50devnmuhoo: scrape all of the clojure RSS feeds and prove it to me. :)
22:50muhoonow, that'd be an interesting program
22:50devnmuhoo: if you feel that way it underscores that "We Need Your Help, Soldier."
22:51devnwrite about clojure on your blog :)
22:51muhoono, i meant, it'd be interesting to write a clojure program that scrapes all the clojure blog entries and comes up with a graph of # of posts by year
22:52muhooto prove or disprove my conjecture about Peak Clojure Blog
22:52devnmuhoo: it's not hard! check out webmine for clojure
22:53devntardo: read about clojure collections, then read about list, vector, array
22:53muhoobaahaaa
22:53muhooi found a blog entry about using webmine.... from 2010 http://www.dzone.com/links/mining_the_web_withclojure.html
22:53devn:)
22:53tardodevn: aye aye!
22:53devni think webmine is being used to power prizmatic, bradford cross's startup
22:53devni forked it to preserve it for posterity
22:54devni mean, it is a very small tool in their toolbelt, there are a lot of really interesting algorithms going on behind the scenes
22:54devnbut even still, RSS scraping and so on is built-in
22:54devn(to webmine i mean)
22:56devnmuhoo: i won't disagree with you about 2010 being a big year. but i think it's far from the max. in the time since then the number of unblogged contributions has grown exponentially
22:57brehautalso a bunch of the bloggers who were prolific in 2010 spent 2011 writing books
22:58devnor at least it seems that way to me. there may well be fewer blog posts, but at the same time there are more conferences, and more people adopting it. perhaps the barrier for getting your blog post talked about on an aggregator has grown
22:58muhoowow, richard gabriel-- who gave the world xemacs-- presenting at clojure west
22:58devnsort of a sign of maturity
22:58devnyeah im still pissed i cant make it to clojure/west, but i need to go sit in the carribean and do nothing for a week or two
22:58devnhopefully euroclojure will take me
22:58Raynesmuhoo: That's a good thing?
22:58muhoodevn: a better metric is the quantity and quality of code, which i guess scraping github might facilitate measuring
22:58Raynes:p
22:59devnmuhoo: my gut tells me all code has gotten better, period.
22:59devnor at least, the average for quality has been raised.
22:59muhooRaynes: it's an odd thing. totally unexpected. old-skool lisper, worked with rms at mit, etc.
22:59clojurebotPardon?
23:00devnmuhoo: it's weird but also not at all weird. unix is simple and yet i see people say things like: "i use heroku because it's easy. i'm not a command line masochist."
23:01devnthere is a similar theme with clojure. it is simple, but the gut reaction for many is to run around yelling fire about parens or some other equally funny aspect.
23:02devnreminds me of "worse is better"
23:02devnwhich, lol, is written by...
23:02devnRichard Gabriel: http://www.jwz.org/doc/worse-is-better.html
23:03muhooyep
23:05leviHe also wrote a book on software patterns.
23:05levihttp://dreamsongs.net/Files/PatternsOfSoftware.pdf
23:06muhoohahaha, "tough man to make a tender chicken" is frank perdue http://www.youtube.com/watch?v=uN37i9qr0zY
23:06muhoonew jersey joke, circa 1970s-1980s
23:12leviHis Patterns of Software book is interesting, as it's more of a set of essays applying Christopher Alexander's work on design patterns in architecture to the crafting of software than it is a catalog of patterns like the GOF book.