#clojure logs

2012-05-16

00:01brehautfrom looking at enlives source it does appear that theres a bucket load of configuration available on tagsoup, but none of it appears to be exposed to the enlive consumer
00:01brehautwhich really limits its utility as a scraper
00:01chouserdata.zip isn't very good at changing stuff -- it's mostly for scraping. But maybe in this limited circumstance I could use it to change what I need
00:03brehautthis calls for update-in abuse
00:07chouserstencil uses non-html patterns to insert strings?
00:07dsantiagochouser: Stencil is an implementation of mustache: mustache.github.com
00:07dsantiagoIt lets you make tags that signify insertion points in arbitrary text, HTML included.
00:08chouserok. tinsel looks more interesting.
00:08brehautdsantiago: does tinsel allow you to load an plain html template and then insert text containing markup ?
00:08dsantiagobrehaut: What do you mean by plain HTML? With no mustache tags? Then no, it needs mustache tags to do anything interesting.
00:09dsantiagoOh wait, tinsel.
00:09dsantiagobrehaut: Then the answer for tinsel is yes.
00:09dsantiagoBut, it is optimized for read-the-template-once, write-it-billions-of-times.
00:10dsantiagoIf you need to process a new template each time, it will probably be slow for that.
00:10brehautso it doesnt parse any markup in the substitation?
00:10dsantiagoNot sure I undertand.
00:11brehautso on my site i have bunch of html blobs in my DB, and i stuff them into my templates with enlive.
00:11brehautto do that, enlive has to parse the blobs into clojure data before stitching them into the template
00:11brehaut(which is slow as hell)
00:12dsantiagoYeah.
00:12brehautif i switched to tinsel would i need to worry about that?
00:12dsantiagoSo, I've used tinsel exactly the way you are. It does not parse what you insert.
00:12brehautfantastic
00:12dsantiagoYou could manually create a new template with the result and reparse that, if that's what you want. But it's optimized to be fast.
00:13brehautdsantiago: thanks
00:13dsantiagobrehaut: No problem.
00:17chouserdsantiago: would it be foolish to try to use tinsel to extract data from xml?
00:17dsantiagochouser: Yes. tinsel is entirely built around your template being parsed, and then processed and compiled into a very fast to render function that takes your data and produces the result.
00:19chouserwhat about parsing the template from .html instead of using hiccup?
00:19dsantiagoWhat about it? It can do that.
00:19chouserok, just hadn't found that in the docs yet.
00:20chousernote I'm not complaining about docs -- I'm in no position to.
00:21dsantiagoWhere would you like the docs to have more detail?
00:21dsantiagoAll the functions are in Readme.
00:21devndsantiago: functions != general use
00:22dsantiagoThere's two worked examples.
00:22devnive seen libs where all functions are documented beautifully, but their composition is neglected indefinitely
00:22devndsantiago: im speaking from ignorance, just saying...
00:23dsantiagoAh, OK. I'm happy to expand on things that aren't adequate.
00:23devndsantiago: it's a weird position to be in. the hardest part is foreseeing how other people use your software
00:23devnbut as soon as they do there are all of these blind spots no one could have foreseen
00:24dsantiagoYeah. I guess I'm pretty lucky in that I think absolutely no one but me uses tinsel.
00:24devnhaha dsantiago i wrote a garbage lib: https://github.com/devn/yokogiri
00:24devnbehold the power! ;)
00:25devnive tried to reuse it and ive already discovered several cases I didn't consider
00:27dsantiagodevn: Is this an XSLT lib?
00:27devnno, just HTML
00:27devnand outdated at that
00:27dsantiagoEr, I meant XPath.
00:27dsantiagoI think.
00:27chouserdsantiago: bam. and like that my use of tinsel has caught up and passed enlive. Thanks.
00:27dsantiagochouser: Awesome!
00:27devndsantiago: ive worked a bit on kyleburton's clj-xpath
00:27devnim not sure it'd be useful to you but
00:28devnhttps://github.com/kyleburton/clj-xpath
00:28devnit introduced to me to anaphoric macros, so that's something ;)
00:28dsantiagoInteresting.
00:28devni just picked up Let over Lambda today. enjoying the U-Language thoroughly
00:29chouseroh, but the doctype is gone and some whitespace has been stripped.
00:29chouserdsantiago: anything I can do to get those back?
00:30dsantiagoOK, I'm not aware of why the doctype would drop, so let me look at that. But it does not attempt to keep whitespace pretty.
00:30dsantiagoDo you have an example case on the doctype?
00:31chouserwell, I had <a href="foo">foo</a> <a href="bar">bar</a>, and the space between those words was stripped, so now it renders as foobar
00:32chouserthe doctype was just <!DOCTYPE html> and I used html-file to parse it
00:33dsantiagoLooking…
00:36chouserit's crazy how much xslt calls to me for projects like this
00:36chousereven though I know it will betray me in the end
00:36dsantiagochouser: Looks like the problem in both cases is in tagsoup.
00:37dsantiagoOr rather, clj-tagsoup.
00:37amalloyi remember when i was young and in love with xslt
00:37dsantiagoIt drops the doctype before I get it, and it drops that whitespace in its output.
00:38dsantiagoSo, it looks like Daniel Janus has released a new version of clj-tagsoup, let me see if updating helps with these.
00:38devn04:35 < amalloy> i remember when i was young and in love with xslt
00:38devnclassic.
00:39dsantiagochouser: No dice. I'm sorry about this, my own usage has always been with the hiccup syntax (aside from basic tests).
00:40dsantiagoLet me see if I can take a look at clj-tagsoup and see if there's a way to fix this up easily.
00:41chouserdsantiago: wow, thanks.
00:46_KY_How to enumerate all distinct pairs in a list, for example [1 2 3 4...]?
00:47_KY_Would be [1 2] [1 3] [1 4] ... [2 3] [2 4]...
00:49tmciver_KY_: probably something from clojure.math.combinatorics perhaps.
00:50_KY_Yeah I guess... thought there might be a short answer...
00:52terom&(let [l [1 2 3 4]] (for [i l j l] [i j]))
00:52lazybot⇒ ([1 1] [1 2] [1 3] [1 4] [2 1] [2 2] [2 3] [2 4] [3 1] [3 2] [3 3] [3 4] [4 1] [4 2] [4 3] [4 4])
00:53tmciverterom: nice
00:54chouser&(mapcat #(map vector (repeat %) %2) [1 2 3 4] (iterate next [1 2 3 4]))
00:54lazybot⇒ ([1 1] [1 2] [1 3] [1 4] [2 2] [2 3] [2 4] [3 3] [3 4] [4 4])
00:54chouseroops
00:55chouser&(mapcat #(map vector (repeat %) (next %2)) [1 2 3 4] (iterate next [1 2 3 4]))
00:55lazybot⇒ ([1 2] [1 3] [1 4] [2 3] [2 4] [3 4])
00:58teromAh, missed the word "distinct"...
00:58terom&(let [l [1 2 3 4]] (for [i l j l :while (not= i j)] [j i]))
00:58lazybot⇒ ([1 2] [1 3] [2 3] [1 4] [2 4] [3 4])
00:58_KY_Right... the last one is neat=)
00:59amalloyit's probably not what you want, though. what if the input list is [1 2 2 3] - you never get the [2 2] pair
00:59dsantiagochouser: I'm really sorry. I'm embarrassed, but I am amazed that clj-tagsoup works at all.
00:59dsantiagoLet me poke around and see if I can find a way to replace that.
01:01_KY_It works for me because the original list is supposed to have distinct elements
01:05chouserdsantiago: don't worry about it. The template is under my control, so I can fiddle with it as needed.
01:06dsantiagochouser: I'm glad to hear that, but I still have to fix this.
01:06dsantiagoI use this thing myself.
01:06chouserI'm manually reiserting the doctype for now
01:06dsantiagoThe nasty goes all the way down to Tagsoup itself.
01:06dsantiagoI'm looking at maybe NekoHTML.
01:14_KY_How can I "use" or "require" a jar library in REPL?
01:19Chousuke_KY_: you can use the ns form as usual, or use require directly. The jar needs to be in classpath though.
01:20_KY_And I can't set classpath in REPL?
01:29_KY_So I set the classpath outside REPL... but it doesn't seem to locate the reference
01:35devndsantiago: nekohtml is a good way to go
01:36devndsantiago: CyberNeko HTML parser, CyberNeko DTD Converter
01:38_KY_"FileNotFoundException Could not locate clojure/math/combinatorics__init.class"
01:38_KY_My classpath is set to the directory containing the jar
01:38ivanit should be the jar itself
01:40ivanalso, lein will handle all this for you
01:40_KY_Yeah but I want to try it with REPL
01:41ivanlein repl
01:41amalloy_KY_: with lein available on the scene, trying to manage the classpath on your own is really only valuable from an archaeological perspective:"look at all the unpleasant work our ancestors had to do"
01:43_KY_Yeah but I want to learn the basics also
01:43_KY_=)
01:44_KY_Doing jar that [jar file] doesn't list the contents of that jar...I wonder why?
01:44_KY_Doing jar t [jar file] doesn't list the contents of that jar...I wonder why?
01:44_KY_Ok.. it's jar tf
01:45amalloyjar (as a descendant of tar) takes its input from stdin; the f flag tells it to use a filename as input instead
01:45amalloyso you could instead: $ jar t < myjar.jar
01:46michaelr`hello
01:46_KY_So I can see the .clj file in the jar...
01:46_KY_But "require" doesn't locate it
01:46arohner_KY_: the jar needs to be on the classpath explicitly, it's not enough to put the jar's dir on the classpath
01:47_KY_Yeah I did that now
01:49muhooshould i be proud of this, or embarassed by it? https://www.refheap.com/paste/2746
01:49amalloyif you want help with these low-level sorts of issues it will probably help you to gist a transcript of what you're actually typing (including an ls or two to show file locations)
01:49amalloymuhoo: whenever i ask that i'm proud but should be embarrassed
01:50amalloy#((juxt :name :_id) %) => (juxt :name :_id)?
01:50muhooyeah, it's like, if you have to ask how much it costs, you can't afford it.
01:51amalloyalso your assoc/get looks like an update-in
01:51muhooi'm proud that i got it to work, and how easy it was. i'm embarassed that it's an unreadable mess.
01:51muhooah, good catch, thanks
01:52amalloyand are you using (or interested in using) useful? there are a few functions that would really reduce boilerplate
01:52amalloyeg: (to-fix z/branch? f) => (fn [thing] (if (z/branch? thing) (f thing) thing))
01:52muhooi have it cloned somewhere. which functions do you mean?
01:53_KY_I just set my classpath to the combinatorics.jar (absolute path), and in REPL I said (require 'clojure.math.combinatorics)
01:54_KY_In the jar file there is clojure/math/combinatorics.clj
01:55amalloymuhoo: (join "" xs) => (join xs)
01:55muhoohmm, to-fix is cool.
01:57dsantiagodevn: How does it ocmpare to htmlcleaner? That seems to be the newest kid on the block.
02:08xumingmingvif I declare a class(through gen-class) named com.test.ClassA in namespace: com.test.nsb
02:08xumingmingvthen i want to use this class in another clj file
02:09xumingmingvi should :import com.test.ClassA, or :use com.test.nsb?
02:12aperiodicin a clojure context, why not just use it?
02:13aperiodicthat's what i usually do, but i only gen-class for java interop
02:14xumingmingvyeah, for java interop
02:14xumingmingvbut clojure code also need to use it
02:15aperiodici think you can do either, but i don't know why you'd want to do the former
02:15aperiodici'd say just use it
02:16aperiodicif you imported it, you'd have to use interop syntax with it
02:16aperiodicyuck
02:19xumingmingvaperiodic, oh, thanks
02:20aperiodicno problem
03:27echo-areaHow do people leave memo to another with lazybot?
03:28rfgpfeifferhas anyone here used webgl with clojurescript?
03:29muhooecho-area: $mail?
03:29muhoo$mail echo-area like this?
03:29lazybotMessage saved.
03:30echo-areaOh, that's it. Thank you, muhoo
03:33kralmorning (here)
03:35clgvmorning (GMT+-3) ;)
03:35brehaut~ugt
03:35clojurebotugt is Universal Greeting Time: http://www.total-knowledge.com/~ilya/mips/ugt.html
03:39clgvno. I only wanted to greet the specified time zones :P
03:46mduerksenthose who are awake salute you :)
03:48brehauti just assume everyone else is living in the past. its usually true
03:52fliebelAre there any cool lisp-y apps fro iOS that I should know of?
03:54michaelr`anyone here runs a clojure app on tomcat?
03:54michaelr`i want to setup something like this and wonder whether there is a fast start tutorial
03:56clgvmichaelr`: you can use noir for a website which will use jetty by default but you can build a tomcat archive vie lein-ring if I remember correctly
04:01michaelr`clgv: yup, i have a noir app which i developed using the builtin jetty, now i want to move to production so I gather the obvious choice in the java world is tomcat. so what I need to know now is how to setup tomcat
04:02michaelr`will probably just read at their website but i wonder whether someone has already done it and wrote a fast start tutorial :)
04:03clgvmichaelr`: install tomcat and rop your war-archive in its webapps folder ^^
04:03clgvs/rop/drop/
04:05michaelr`clgv: yeah, thanks ::)
04:15scottjfliebel: there's a scheme (maybe even clojure) ide for ipad I think
04:16scottjmaybe more of a fancy editor than an ide
04:46robertstuttafordi have emacs24 + emacs starter kit. i change my font and save my options using the newbie menu bar method but when i restart emacs, it's back to the old font. where in blazes do i fix this?
04:47robertstuttafordit's also hiding the menu-bar. i put (menu-bar-mode) into both .emacs and .emacs.d/init.el (all permutations: one, then the other, then both) with no effect on startup
04:50robertstuttafordif anyone has emacs set up on osx and is willing to hold a newbs hand for a little bit, i'd be most greatful. i just want to get the basics: font, color scheme (solarized) and then how to start my ring server and get swank's code navigation stuff working. swank/slime is working (i get a repl) but go-to-definition isn't working
04:51robertstuttafordi'd be most grateful, too :p
04:51scottjrobertstuttaford: by go-to-definition do you mean M-.?
04:51robertstuttafordyes
04:51robertstuttafordi get stacktrace can't-find errors
04:52robertstuttafordi don't know how to feed swank/slime my source code for indexing, if that's what it needs
04:52scottjdid you already C-c C-k the file?
04:53scottjbtw you could try (menu-bar-mode 1) since (menu-bar-mode) will toggle it I think
04:53vijaykiranrobertstuttaford: M-x menu-bar-mode
04:53vijaykiranalso, which word are you 'go-to-definition'ing ?
04:53scottjmaybe (set-default-font "DejaVu Sans-12")
04:54robertstuttafordvijaykiran: i know how to get the menu up once emacs is started, i don't know how to force it to start up that way
04:55vijaykiranrobertstuttaford: I guess with startupkit, you need to put your customizations in your $USERNAME.el file
04:55robertstuttafordshould those go in .emacs or in .emacs.d/init.el?
04:56robertstuttafordah
04:56michaelr`is there a default key binding for move-to-end-of-the-previous-word?
04:56michaelr`like M-b but to the end instead of to the start
04:56michaelr`instead of M-b M-f
04:56scottjmichaelr`: vim user? :)
04:57michaelr`yes :)
04:57scottjthere's something, searchign through my .emacs
04:57michaelr`it's a simple thing but it drives me crazy, really
04:57scottjmichaelr`: (global-set-key (kbd "M-F") 'forward-to-word) (global-set-key (kbd "M-B") 'backward-to-word)
04:58scottj(require 'misc) maybe
04:58michaelr`hmm
04:59michaelr`so nothing by default? i actually need this for bash/psql/repl and everything else which has emacs key bindings
04:59scottjnothing by default
04:59michaelr`very strange imho
04:59scottjrun everything inside emacs is your only option
05:00michaelr`right now i gave up on emacs, i just don't have enough nerves for things like that..
05:01michaelr`everything simple/basic feature i'm used to from other "sane" environments in emacs i have to customise it
05:01michaelr`problem is after trying to use emacs for a while i'm actually using it's key binding in the shells all the time :)
05:02michaelr`bindings
05:02scottjwell, to be fair, is there an non-vim-keybinding environment that has that feature?
05:02bobryIf I have a function '(defn f [& {:keys [foo]}] fo)', how can I apply it to a map?
05:02bobry(apply f opt) doesn't work :/
05:02michaelr`scottj: ctrl-left, ctrl-right does that in every other editor
05:03scottjmichaelr`: maybe I'm not understanding you, in gedit c-left appears to do what M-b does, not what my M-B does
05:04michaelr`bobry: i think the & should come before fo
05:05michaelr`scottj: well, i mainly work in microsoft environments and when in linux i don't use gedit
05:05michaelr`just ssh to a remote shell
05:07michaelr`abc efg
05:07scottjmichaelr`: fair enough, I don't remember windows behavior, but in chrome on linux "foo |bar" C-left takes you to "|foo bar" not "foo| bar" like I thought you wanted
05:07michaelr`for example if I'm at 'g' and i press ctrl-left i get to e, another ctrl-left i get to 'c' and etc
05:08scottjyeah that's not like linux text fields
05:10michaelr`err, just checked and it seems that everything works like you described in chrome :)
05:11scottjmaybe you can add keybindings to readline or rlwrap. you could probably add it to bash
05:11bobryokay, one more question -- is there a builtin function for converting a map into a list of bindings; ex: '{:foo 1}' ==> '(:foo 1)'
05:11bobryi came up with (interleave (keys ...) (vals ...) but that's kindof ugly
05:12robertstuttafordinstalling a color theme shouldn't be this damn hard!
05:12michaelr`&(into '() {:a 1 :b 2})
05:12lazybot⇒ ([:b 2] [:a 1])
05:12michaelr`worked!
05:12scottjrobertstuttaford: get used to it :)
05:12michaelr`bobry: ^^^
05:12robertstuttaford-sigh-
05:12vijaykiranrobertstuttaford: it is a onetime thing anyway :)
05:13bobrymichaelr`: not exactly, I need a flat list (:b 2 :a 1)
05:13michaelr`ooh
05:13scottj&((comp flatten seq) {:b 2 :a 1})
05:14lazybot⇒ (:a 1 :b 2)
05:14michaelr`cool
05:14michaelr`:)
05:14vijaykiranrobertstuttaford: are you using Emacs.app or emacs in the terminal ?
05:14robertstuttafordemacs.app 24
05:14bobryhm, i wonder why flatten isn't documented in clojure docs
05:14bobryanyway, thanks scottj :)
05:14robertstuttafordvijaykiran: may i pm?
05:14amalloy~flatten
05:14clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
05:15vijaykiranrobertstuttaford: sure
05:15robertstuttaforddon't want to turn this into #fucking-emacs-dammit
05:15vijaykiranthere's #emacs though :)
05:15robertstuttafordthey scare me :-(
05:48michaelr`wtf, lein ring uberwar is creating THE uberwar 900mb and growing
05:48michaelr`something went wrong
05:53michaelr`halp
05:54ssedanomaybe is the rigth size for it
05:54ssedanoaccording to your project description
05:54ssedanoconfiguration I mean
05:56michaelr`only if i included that swap partition by mistake :)
05:57ssedanoI don't know your configuration, neither what is lein packaging
06:01michaelr`ssedano: a noir website..
06:01michaelr`which configuration?
06:07michaelr`here is my project.clj https://www.refheap.com/paste/2747
06:10dbushenkowhat is paz-support?
06:10michaelr`oh shit
06:11michaelr`i have symlinks to the images directory which is huge :)
06:11michaelr`dbushenko: a small library of stuff i collected for this project
06:14michaelr`dbushenko: utility functions for environment/filesystem/xml/net/db
07:00bobrywhy doesn't clojurescript compiler generate 'deps.js', which seems to be required by google closure library?
07:25michaelr`problem deploying to tomcat, can anyone please look at this https://www.refheap.com/paste/2750
07:34Borkdudeer, anyone has tips for moving partitions on OSX to free up space for an other partition… for free on OSX?
07:43gtrakBorkdude: try http://gparted.sourceforge.net/
07:44michaelr`err
07:45Borkdudegtrak: ah yes..
08:01BorkdudeI just copied the data from the next partition, deleted it, resized the prev. partition and made a new next partition..
08:11adeelkhis there a good way to do [[[0 1] 2] [3 4] [5 6]] -> [[0 1] 2 3 4 5 6]? I know about flatten, but I need to do only one "layer" of flattening.
08:12babilenadeelkh: $(apply concat [[[0 1] 2] [3 4] [5 6]])
08:13clgv&(apply concat [[[0 1] 2] [3 4] [5 6]])
08:13adeelkhbabilen: oh, duh. thanks!
08:13lazybot⇒ ([0 1] 2 3 4 5 6)
08:13augustlI have strings of HTML, and want to find all <code> tags and HTML escape its contents. Suggestions? :)
08:13clgvalias flatten-1 ;)
08:14babilenclgv: Oh, never seen flatten-1 in core.
08:14adeelkhaugustl: you can probably use Enlive
08:14clgvbabilen: no, I meant apply+concat is flatten-1 ;)
08:15babilenAh, right. Yes :)
08:15augustladeelkh: looking it up, thanks
08:16adeelkhaugustl: this SO answer is kind of relevant http://stackoverflow.com/questions/2695701/how-to-select-nth-element-of-particular-type-in-enlive
08:16augustladeelkh: thanks again :)
08:19augustlhmm, can't seem to find an example of replacing. The SO post just queries.
08:19foxdonutaugustl: on the client you could try $("code").each(function() { $(this).text($(this).html()); });
08:19augustlI'd rather do it on the server :)
08:20foxdonutsure, I understand
08:27adeelkhaugustl: it looks like this should work http://stackoverflow.com/a/2903592/113397
08:28@rhickeypoll: readable non-print-dup printing of java.util Collections? i.e. j.u.List,j.u.RandomAccess,j.u.Set,j.u.Map print like (),[],#{},{}
08:29@rhickeyinstead of current #<>
08:31augustladeelkh: thanks again
08:31foxdonutrhickey: +1
08:33@rhickeytoo early for a poll I guess
08:34clgvrhickey: +1
08:34kaoDrhickey: yes please, I find it quite annoying
08:35clgvrhickey: an information on the type should be printed as well to avoid confusion
08:35kaoDbut also some hinting of the underlying type
08:35kaoDclgv: ditto
08:37devngood morning
08:37kaoDmorning devn
08:37@rhickeyshowing the type is the argument against printing uniformly - you have *print-dup*
08:39augustladeelkh: you happen to know if there is API docs for enlive? All I can find are complex tutorials
08:39augustlwith references from "Part 1: Intro" in "Part 2983: Actually getting stuff done"
08:40clgvrhickey: ok, when not printing the type, one could make clear that these are no clojure datastructures
08:40devnaugustl: maybe this is helpful if you haven't seen it already? http://enlive.cgrand.net/syntax.html
08:40augustldevn: hadn't seen that one, thanks
08:40augustlhmm, that page doesn't document the transformations
08:40adeelkhaugustl: haha yeah. i actually never used enlive myself before which is what I'm not being more helpful
08:41augustlI see
08:41kaoDrhickey: I didn't mean printing the type, just some kind of hinting
08:41@rhickeycould bifurcate on *print-readably*, but a pain, and repl prints readably
08:42foxdonutrhickey: because of you there is a breath of fresh air in my lifelong passion for software development. thank you so much.
08:42augustladeelkh: think I'll use https://github.com/nathell/clj-tagsoup and work with the vector
08:42devnrhickey: ill +1 your readable printing of j.u colls
08:42kaoDI'm just annoyed by the unreadable output
08:43@rhickeyprinting is not even mostly about programmers, it's about programs, and when not print-duping the program doesn't care because it is going to read a Clojure data structure back, not an e.g. ArrayList
08:44@rhickeyfoxdonut: you're welcome
08:44robertstuttafordeeee the emacs it burns
08:45devnrhickey: does this also mean readable printing of clojure.lang.PersistentQueue?
08:45@rhickey#this-wasn't-originally-aclojure-vector [1 2 3] doesn't help programs at all, and not user much either.
08:46clgvright^^
08:46@rhickeydevn: coming separately in a #queue reader extension
08:46devn(defmethod print-method clojure.lang.PersistentQueue [q,w] (print-method '<- w) (print-method (seq q) w) (print-method '-< w)) is fine and all, but... whoops
08:46devnrhickey: cool
08:46kaoDrhickey: good point
08:47robertstuttafordhow do i set up M-x clojure-jack-in as a key binding? or is that a Bad Idea™ ?
08:47kaoDrobertstuttaford: do you really jack in that many times?
08:47devnrobertstuttaford: i dont see why you couldn't do it
08:48robertstuttafordkaoD: actually, i'm trying to set it up so that i start emacs, and it: has my project.clj and app.clj buffered, a running swank and app.clj compiled and ready to rock
08:49devnrobertstuttaford: (global-set-key (kbd "C-x M-c") 'clojure-jack-in)
08:49vijaykiranrobertstuttaford: add a hook to clojure-mode and add global-set-key
08:49vijaykiranwhat devn ^^
08:50kaoDrobertstuttaford: then you don't need a keybinding but just an init script, right?
08:50devnwhat kaoD ^^ ;)
08:50robertstuttafordawesome devn thanks. kaod: that too :)
08:51devnrobertstuttaford: (eval-after-load "clojure-mode" '(progn (add-hook 'clojure-mode-hook ...)))
08:51robertstuttafordthanks devn, i'll give it a go
08:51kaoDin fact I would cook my own command
08:51devngodspeed
08:51kaoDclojure-project which prompts for a path and then starts it all
08:52robertstuttafordthat sounds ideal
08:52devnooo the efficiency! think of all the time you'll save! ;)
08:52kaoDbecause, well, forcing clojure-mode to do things automatically might get between you and productivity
08:52VinzentCould someone please explain me why there is `mapv` and `filterv`? Is it impossible to make standart map, filter and others return a collection of the same type rather than a seq?
08:53clgvVinzent: yes, because map, filter ... are intended to be lazy, hence they return a lazyseq
08:53kaoDyou can enforce types anyways
08:54kaoD&(vec (map (partial +2) [1 2 3 4]))
08:54lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: core$partial
08:54kaoD&(vec (map (partial + 2) [1 2 3 4]))
08:54lazybot⇒ [3 4 5 6]
08:54kaoDnever used mapv/filterv, so not sure if just a shorthand or more efficent
08:55devnmore efficient
08:55devnsee http://dev.clojure.org/jira/browse/CLJ-847
08:55kaoDdevn: that's what I suspected
08:55Vinzentclgv, yeah, I understand that, but 1) I thought this new reducers thing can become default in the future 2) you could still force lazyness by turning your vector (or whatever you have) into seq before passing it to map\filter\etc
08:56kaoDnot sure if I understand #2
08:56clgvVinzent: afair both ideas shall be kept: laziness and possible parallelism via reducers
08:56VinzentkaoD, (->> [1 2 3] seq (map ...)) when you need lazyness instead of (->> [1 2 3] (map ...) (into [])) all the time
08:57kaoDmap is lazy by default, isn't it?
08:57kaoDyou don't need seq
08:58robertstuttafordholy crap this is awesome
08:58devn:)
08:58robertstuttafordthat xkcd comic about lisp underpinning the universe comes to mind
08:58kaoD&(take 10 (map (partial + 2) (range)))
08:58lazybot⇒ (2 3 4 5 6 7 8 9 10 11)
08:59kaoDVinzent: that's lazy
08:59kaoDoh
08:59kaoDI just got what you meant
08:59@rhickeyok, I made it so j.u collections print like their Clojure variants only when *print-readably* is true, so you can still see the old print rep (with type) when using print* and readable when pr*
08:59magnarsQuestion: How would you change specific nodes in a tree of vectors without resorting to recursion?
09:00devnmagnars: zippers
09:00magnarsdevn: thanks for the tip, will look into that!
09:01kaoDmagnars: update-in?
09:01Vinzentclgv, yes, but laziness will be the default one, right? Also, theoretically there should be mapm (for maps), maps (for sets), etc (there probably won't exist, because they're not faster).
09:01devnmagnars: to save you a google trip: clojure.zip
09:01VinzentkaoD, yep :)
09:01devnrhickey: cool. looking forward to it
09:01kaoDor assoc-in
09:02clgvVinzent: a map returng a set or hashmap doenst make much sense. in that case you probably mean a reduce.
09:02clgvVinzent: map: Seq -> Seq
09:03devnkaoD: he said nested vectors not maps
09:03mikemhi, i have a fresh lein project which required clojure 1.3.0 and in which i already ran `lein deps`. I've since changed project.clj to require clojure 1.4.0, ran `lein clean` and `lein deps`, but `lein repl` still launches with clojure 1.3.0. what am I missing?
09:03mikemI'm using lein 2
09:03Licenserclgv there is a god reason for a map returning a hashmap - if you want to apply a funciton to all values for example
09:03devna good reason, too! ;)
09:04devnbut yes, there is also a god reason.
09:04clgvLicenser: that's a different function except you want an all-in-one function ^^
09:04Licenserclgv talking bout map as a idea not a function
09:04Licenserthe idea map can be applied to many things
09:04@rhickeyhttps://github.com/clojure/clojure/commit/92b4fc76e59e68d3bdae4ebd5b8deec915cb7ab5
09:05clgvLicenser: there was an implementation for mapping of an hashmap, I saw lately.
09:05Licenseryou could even do it laziely
09:06Licenseras long as you only map values, won't work for mapping keys
09:08Vinzentclgv, why not? I wrote code like this: (->> a-map (map ...) (into {})) thousand times! I understand that map always returns a seq; I'm just interested why this path was chosen (given that it introduces perfomance overhead, problems with dynamic binding and forces programmer to write all those (into {})) and does including mapv, filterv and reducers library in core means that this decision might be reconsidered
09:09clgvVinzent: you could use reduce as well^^
09:09LicenserVinzent then you're doing it wrong
09:09Licenseryou should have started refacturing and reusing it after the 10th time you write it at max!
09:10clgvLicenser: 3rd time ;)
09:11VinzentLicenser, well it's quite silly to write 3 version of every seq function :)
09:13Licenserclgv I was generouse :)
09:13Licenserwell you could try to make it one function that works for all!
09:15devnVinzent: im not sure there are performance implications given transients are used and hashmaps are IEditableCollections
09:16devnrobertstuttaford: I only use about 6 of the things on that giant sheet, fwiw
09:16robertstuttafordis there a fuzzy-open-file for emacs? like PeepOpen or sublime-text-2 does it
09:16Vinzentdevn, well, mapv is faster than map according to http://dev.clojure.org/jira/browse/CLJ-847
09:16devnM-s, M-(, C-), M-S
09:17robertstuttafordido is nice but it requires that i get the directory right before the file
09:17devnrobertstuttaford: peepopen if available if you're into that kind of thing
09:17Licenserdevn also (,),[,],{,} ;)
09:17Licenserand M-left, M-right
09:17Vinzentrobertstuttaford, take a look at find-file-in-project
09:18devnrobertstuttaford: have you tried emacs-live?
09:18robertstuttafordthanks Vinzent. devn, no, i'll look at that too
09:19devnrobertstuttaford: sam aaron posted this to the overtone list the other day. i switched to it and i like it quite a bit, perhaps it has a better default ido-find-file setup than you currently have: https://github.com/samaaron/emacs-live
09:19devn"It Just Works" (as long as you're on Emacs 24.1 or so)
09:20devnit might save you some time wrangling your config
09:20robertstuttafordawesome, thanks
09:21devnrustlin' 'n wranglin' that golsh darn emacs config
09:21robertstuttafordfind-file-in-project seems to do what i want, thanks!
09:21robertstuttafordlooks like i've got all the config right, now. colors, font, maximised window, swank works. now the fun part: internalising the keyboard stuf
09:22robertstuttafordi've got all the windows text editing hardcoded into my fingers, so this should be .. fun
09:22foxdonut(GET "/user/{id}" [id] ...) vs @RequestMapping(value="/user/{id}", method=RequestMethod.GET) public ModelAndView methodName(@PathVariable Integer id) { ... }
09:23devnrobertstuttaford: are you sure? If I just enter a few characters, if it can't find a match it will look outside of my current dir
09:23devnwhoops, my buffer was out of sync, nevermind
09:24devnfoxdonut: not sure how to respond to that... :)
09:25pandeirowould a web service incrementing/decrementing a simple counter be a use case for a ref or atom? i thought atom since inc/dec addition is associative
09:26foxdonutdevn: my bad, wrong channel... was contrasting compojure vs spring mvc ;)
09:27devnpandeiro: sounds like an atom to me
09:27pandeirodevn: thanks
09:28augustlfor (defn foo [str & {:keys [a b c]}]), how do I invoke it so that a is set?
09:29augustltrying to set the "xml" option for https://github.com/nathell/clj-tagsoup/blob/master/src/pl/danieljanus/tagsoup.clj#L108
09:30tmciveraugustl: the second arg to foo should be a map with key :a whose value is a set.
09:30devntmciver: im not sure that works
09:30augustltmciver: ah, thanks
09:30tmciverdevn: no?
09:31devntmciver: maybe im just being daft but it didnt work for me
09:31tmciverI didn't try :/
09:31augustlodd, "java.lang.IllegalArgumentException: No value supplied for key: :xml"
09:31devn(foo "hello" {:a #{1 2 3} :b 1 :c 2}) => No value supplied for key: {:a #{1 2 3}, :c 2, :b 1}
09:33augustlso how is it done? :)
09:33tmciverdevn: hmm, you're right but I don' know why . . .
09:33devnme either :)
09:34augustlno tests or docs for that lib so I can't copy paste, boo
09:34devn,(let [{:keys [a b c]} {:a #{1 2 3} :b 2 :c 3}] [a b c])
09:34clojurebot[#{1 2 3} 2 3]
09:35devnbut it doesnt work in defn
09:35augustl#{} is a set, right?
09:35devn*nod*
09:35devn,(set [1 2 3])
09:35clojurebot#{1 2 3}
09:36augustlthe docs calls them a "keyword argument"
09:37tmciverit works if foo is defn'd w/o 'more' args.
09:37augustlhmm
09:37tmciver(defn foo [str {:keys [a b c]}] [str a b c])
09:37augustlI wonder why the & exists
09:37tmciverI guess it's because the map arg is packed into a seq
09:38devnwhy does it need to be a set?
09:38devn(maybe this is obvious, but i dont see why)
09:39augustlperhaps it worked in an older version of clojure
09:40augustlso is it impossible to call it?
09:41devnwell, let's try an older version, shall we? :)
09:41augustlpassing in "{:xml true} {:xml true}" works
09:42augustlthat is, it doesn't throw an exception, but it also doesn't seem to set the option
09:42robertstuttafordswank: does compiling (C-c C-k) also automatically reload the code in swank, such that visiting the ring server's served pages will reflect the changes?
09:44foxdonut,((fn [s & {:keys [a b]}] [a b]) "duck" :a #{"quack"} :b 42)
09:44clojurebot[#{"quack"} 42]
09:44augustlhmm
09:45devnin 1.1.0 you couldnt destructure maps
09:45devnso...on to 1.2.0 :)
09:45devn(that being said, it didnt blow up, just returned [nil nil nil])
09:46foxdonutaugustl: so I guess (parse input :xml #{your-set}) ?
09:47augustlhmm, why a set?
09:47devnit doesnt work in 1.2.0
09:47augustldevn: :D
09:47devn:)
09:47foxdonutI thought you said you wanted it to be a set
09:47devn^- i hear the same
09:47augustlfoxdonut: not sure what it needs to be, the docs doesn't say
09:47foxdonutwhatever you need it to be then :)
09:47augustlseems I just need to set it to true
09:47augustlI see
09:47devn:) problem solved!
09:48augustlgrr, it seems the property is only used to set the encoding
09:48augustleven though the docs say it will also make it parse invalid HTML
09:48foxdonutaugustl: yeah it looks like it's just a flag
09:48devnetc.
09:48devnaugustl: what's the problem you're trying to solve
09:49devnaside from making this particular thing work
09:49devnwould something other than tagsoup suit your needs?
09:49augustldevn: I have a string of HTML, I want to get a new string where all script tags have their contents escaped
09:49augustlI write my blog posts in HTML, but I some times have html that I want escaped inside code tags
09:49augustls/script tags/code tags/ btw
09:50foxdonutgreat, now my head and neck are bruised and I smell like fish.
09:51devnit could be worse! ;)
09:51augustlI totally misread the docs on the invalid HTML part btw
09:51devnaugustl: i have to run, but sometimes a statement like the one you just made about the general problem
09:52devncan yield results that aren't necessarily "use tagsoup"
09:52augustlhehe yeah
09:52devngood luck and happy clojuring
09:52achefoxdonut: I do not envy you the headache you will have when you awake. But for now, rest well and dream of large fish.
09:52foxdonutyak shaving
09:52augustlthere's always regexps!
09:52foxdonutache: :D
09:52augustlthat's what I used before I rewrote it in clojure
09:53augustl\<code>(.*?)\<\/code\> dawg
09:54foxdonutaugustl: see first answer in http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags
09:56robertstuttafordalthough i have ring-serve 0.1.2 in my project.clj, when i try to (use 'ring.util.serve) i get a classnotfound exception
09:56augustlfoxdonut: haha yeah
09:56robertstuttafordlein2 deps runs without errors
09:57pandeirohow can i verify what version of clojure a slime repl is running?
09:57robertstuttafordis this the right way? i want to use clojure-jack-in, and from there start a ring server
09:58babilenpandeiro: *clojure-version*
09:58robertstuttafordso that the emacs repl is running the same code that my browser is accessing
10:01pandeirobabilen: awesome thanks
10:05robertstuttafordanyone using ring-serve successfully?
10:06robertstuttafordsooo close
10:09foxdonutrobertstuttaford: do you mean lein ring server?
10:09robertstuttafordno, ring-serve, for starting a ring server within a running repl
10:09foxdonutok
10:09robertstuttafordi have clojure-jack-in going. i'm trying to use this: https://github.com/weavejester/ring-serve
10:10robertstuttaford(use 'ring.util.serve) gives me a classnotfound exception even after adding it to project.clj and running lein2 deps
10:10robertstuttafordannoying
10:13robertstuttafordeven after a day of headless-chicken muddling, i can see the value to emacs+clojure
10:13robertstuttafordjust a bloody steep learning curve!
10:14pandeirorobertstuttaford: i went through this about 6-7 months ago, don't worry, it gets (a little) better
10:15pandeirowait until you add clojurescript to the mix
10:17pandeirois there a way to skip aot without having a :main entry in a lein project? say if i am making a lib and i don't want aot
10:18robertstuttafordpandeiro: i assume you're still using emacs?
10:18pandeirorobertstuttaford: absolutely, love it
10:23robertstuttafordgreat
10:24robertstuttafordi'm going to get the peepcode cast and also watch all of the disclojure series
10:24robertstuttafordand then force myself to use emacs to edit every bit of text that i need to
10:24Borkduderobertstuttaford: I used emacs before, but eclipse is a pretty good experience with the counterclockwise plugin
10:25robertstuttafordi was using ccw with the lein plugin but ran into showstopper issues
10:25robertstuttafordfigured i'd take the plunge with emacs
10:25Borkduderobertstuttaford: like what?
10:25robertstuttafordworth it, in the long term
10:26robertstuttafordit was all working. then, i added stuff to project.clj, used lein >update deps. the lein deps item in the project dissappeared, and no matter what i did i couldn't get it back
10:26robertstuttafordeven after destroying all eclipse metadata in workspace and project
10:26Borkduderobertstuttaford: did you do a lein deps from the cmd prompt?
10:27Borkduderobertstuttaford: or with the leiningen plugin
10:27Borkduderobertstuttaford: from eclipse I mean
10:27robertstuttafordwith the plugin
10:27augustlhmm, shouldn't this match?
10:27augustl,(re-find #"<code>((?m).*?)</code>" "<code>foo\nbar</code>")
10:27clojurebotnil
10:27Borkdude(fucking hell, I have to teach myself Struts2… it all seems so verbose)
10:27augustl(yes I know, I'm matching HTML with a regexp, but it's my own HTML)
10:28augustl(parentheses are cool apparently)
10:28Borkduderobertstuttaford: do you use a profiles.clj?
10:28Borkduderobertstuttaford: I mean, do you have a profiles.clj sitting in .lein?
10:29robertstuttafordi don't use profiles at all
10:29robertstuttafordonly been clojuring about a week
10:29robertstuttafordhavne't gotten to profiles yet
10:30Borkduderobertstuttaford: hmm, then I don't know. I had a bug with that, but furthermore it works as desired…
10:30Borkduderobertstuttaford: if you have any problems, please file them at https://groups.google.com/forum/?fromgroups#!forum/clojuredev-users
10:30robertstuttafordit's ok. i've just paid a day's braincells to get emacs all set up
10:31augustlnobody has written about multiline regexps for clojure either, nothing on google
10:32pandeiroanyone know about skipping aot in lein without specifying a :main ns? is it possible?
10:32augustlah, needed the s flag too
10:36gfredericksaugustl: probably it's not well documented because it's just defers to java; the clojure part is very thin
10:36robertstuttaforddoes emacs use multi-core?
10:43timvisheranyone care to help me understand why we tend to be so comfortable with eschewing the UAC in favor of something like hash-maps in the clojure community?
10:43timvisherthe best answer i can come up with is that you shouldn't have to change your data that often
10:43timvisherwhich is pretty darn week
10:43timvisherweak*
10:43RickInGAwhat is UAC?
10:43timvisheruniform access principle
10:43timvisherhttps://en.wikipedia.org/wiki/Uniform_access_principle
10:44timvisherbasically says that you should not be able to tell whether a field on an object is served by storage or by computation
10:44vijaykiranrobertstuttaford: nope, AFAIK
10:45timvisherbasically allows you to refactor from a field to a calculation transparently to your clients because they were accessing the field anyway
10:46gfredericksso a standard OOP interface gives you this, right?
10:46Borkdudetimvisher if you want smth like that, write a function get-value-x or smth?
10:46gfredericksBorkdude: maybe he's asking why we usually assume we don't want that?
10:46timvisherbut if you're using a map, for instance, everyone's accessing that data via `(:key ...` construct, but if that key eventually needs to become a calculation, you've got to change all the callers
10:46timvishergfredericks: yes
10:47timvisherBorkdude: obviously, but I'm asking about rationale
10:47RickInGAwhy would the key become a calculation? the value could become a calculation without breaking anything
10:47Borkdudetimvisher: I sometimes use indirections using a function, so I could switch from one representation to another
10:47RickInGAthe key is a function
10:47timvisheri'm somewhat sold but I'm trying to write up my next functional thinking article and I don't feel like I have an answer to the UAC
10:47gfrederickstimvisher: I was working with someone new to clojure who eventually asked how she could redefine the keyword function to be a calculation; I didn't have a good answer
10:48gfredericksi.e. she wanted (:name m) to do (str (:first-name m) " " (:last-name m))
10:48timvisherBorkdude: of course, but that decision would have to be made up front
10:48S11001001so naturally you explained how to extend the lookup protocol, right? :)
10:49timvisherRickInGA: i'm not expressing myself well enough. The key obviously never becomes a function. But the value would have to become a calculation rather than a value
10:49timvisheryou're saying you can do that pretty easily?
10:49timvisheri think if you had a constructor function of sorts then it wouldn't be too hard but that's also not terribly idiomatic from what i've seen
10:49timvisherusually if you want a map you just construct a map
10:49timvisherof course even in my own code that's not true
10:50RickInGAtimvisher: {:sum 2} or {:sum (+ 1 1)} I don't know the difference... but I may be thinking too simplisticly
10:50timvishermy central data structure is a map but I have a function to create it because i do all sorts of things to the data that comes in before i spit out my fields…
10:50S11001001I think the idea is that your code that works with the particulars of your structure should be closely associated with the definition of that structure, anyway.
10:51timvisherRickInGA: there's no difference there but the problem is in the creation. if you're creating these data structures all over the place then you need a constructor function to introduce the indirection so that you can freely transform it like you just showed
10:51antares_Just announced Welle, a Clojure client for Riak: https://groups.google.com/forum/?fromgroups#!topic/clojure/zUFKYZlYjfw, would love some feedback on the docs
10:51robertstuttafordgoogle's code editor: https://docs.google.com/macros/edit?lib=Mbw95NICHwdISJahdkaj98y7y8BqBqiEP
10:52timvisherS11001001: I agree. I think maybe the best way to express it is that you just have to make a design decision up front and it may be worth creating a constructor function which gives you all the benefits of the UAC while still maintaining the fact that it's just a simple map or record or whatever
11:04gfrederickstimvisher: in contrast the benefit of UAC is not having to design up front
11:05gfredericksyou just use eclipse to generate your getters and setters :)
11:21timvishergredericks: and the benefit of not using the uac is that maps have all of the same access benefits without a custom api and an ide to support it. :)
11:24S11001001and a crapload of boilerplate
11:33robertstuttaforddoes clojurescript use google closure templates?
11:33robertstuttafordi know cljs one uses enlive snippets + domina
11:35vijaykirantemplating is independent of clojurescript - so you should be able to use anything
11:36robertstuttafordok. templating is a separate java compiler so i guess if cljs doesn't use it, it'll be pretty tough to integrate
11:37robertstuttafordis anyone using cljs to produce webapps for mobile?
11:37robertstuttafordi wonder about the performance characteristics on mobile
11:38vijaykirandepends on your design though, if you want client-side templating, then you can use anything as long as you can call the corresponding JS function from cljs
11:38robertstuttafordgclosure templates compile .soy files to .js, with the intent that the js files are used in the whole-source advanced mode compilation that takes place
11:39robertstuttafordso if they can't be compiled in then, the advantages to using them dwindle rapidly
11:39robertstuttafordanother cljs question. can i pass clojure forms down the wire to a compiled cljs app to parse?
11:39robertstuttafordie, can i use clojure as a wire format for client <> server comms?
11:39wkmanireHowdy folks.
11:40vijaykiranrobertstuttaford: that's one of the ideas, yes.
11:41gtrakrobertstuttaford: but there's no eval
11:41robertstuttafordso i could, for instance, serve up a graph of maps vectors and other literals and have it work with client side data manip like map reduce etc
11:42robertstuttafordright now i have a clojure json rest service and a traditional gclosure client consuming those. i want to convert the gclosure client to a cljs app and have them use clojure instead of json
11:44foxdonutrobertstuttaford: yes. essentially instead of a json string you have a string representation of the clojure data structure, which you can read back into a clojure data structure on the cljs side.
11:44robertstuttafordour app has a media format (structured data plus html + images) and a document format (just structured data). the tentative plan is to compile the media format with cljs and have it use externs generated by the base app so that the base app and the compiled media packages can talk, and then use plain clojure for the document format
11:45robertstuttafordwhy cljs for the media format? we have a light requirement for computation in these packages
11:45robertstuttafordand i'd prefer to put that comp in the package instead of hardcode all the cases into the base app
11:46robertstuttafordi've just come out of the shower, hence the bajillion questions. does cljs support the concept of model <> view bindings?
11:47robertstuttafordi guess one has to set this up manually using react-to
11:49robertstuttafordi know cljs is still brand new so perhaps it hasn't gotten there yet :-)
11:49robertstuttafordit's very exciting, though
11:50robertstuttafordah, found cljs-binding
11:50gtrakrobertstuttaford: atoms give you some kind of binding event-handling
11:50robertstuttafordwith add-watch?
11:50robertstuttafordi see that in cljs one
11:50vijaykiranclojurescript-one seems to be having some kind of binding eample right ?
11:51gtrakyea
11:52robertstuttafordit'll be interesting to see how much less code the cljs rebuild will be. right now the gclosure codebase is just shy of 10k lines
11:54AndroUserHi, wondering if anyone using emacs has a simple solution to reload multiple namespaces at once - i.e. instead of visiting multiple files and pressing C-c C-k on each, how can i have one action?
11:54robertstuttafordAndroUser: i found that compiling my root app.clj reloads the whole app
11:54solussdcan I use map destructuring in a protocol declaration? if so, can I use the form {:keys […] :or { … }}. When I implement it, if I leave off the :or, will I get the ones defined in the protocol declaration?
11:56AndroUserThanks robert, will try
12:01robertstuttafordhow are folks doing testing in cljs?
12:02robertstuttafordcljsone has great integration testing stuff, but what about model unit testing?
12:02robertstuttafordi've been writing jasmine bdd with coffeescript for my js unit testing
12:05duck1123isn't there a version of clojure.test for cljs?
12:06robertstuttafordlooks like one uses rhino
12:07duck1123I wonder if it would be hard to use jasmine from clojurescript
12:08duck1123you would probably still want to wrap it to make it more clojure-esque
12:08robertstuttafordjasmine would only be able to access the generated js
12:08robertstuttafordthe jasmine test runner, i mean
12:09duck1123but by that point, you care less about the code, and all about the behavior, right? As long as you can still invoke functions
12:10robertstuttafordyeah
12:10robertstuttafordbut by using jasmine here you'd be forced to understand your code in two forms
12:10robertstuttafordwhich, when you look at the js output by the cljs compiler, is not a happy prospect
12:12duck1123I haven't really used Jasmine yet, but I was thinking about giving it a try
12:12robertstuttafordit's really nice
12:12bradwrightJasmine is quite nice
12:12bradwright(Speaking as a JS person rather than a Clojure one)
12:12robertstuttafordwaaaay better'n the stuff google foists on you
12:14duck1123I'm waiting for Midje-cljs
12:15robertstuttafordinteresting: https://github.com/fmw/vix
12:19solussdIf i have a boolean argument to a function, should the arg name end in a question mark (e.g. my-arg?), or does ending with a question mark in a function arg signify optional?
12:19solussd^a convention question
12:20duck1123? is for bool in clojure
12:20robertstuttafordman vix is a goldmine of code
12:21Vinzent? is actually for predicates (e.g. functions returning boolean values)
12:21solussdVinzent: this is my understanding.. it is also being used to signify optional args in several libraries…
12:31Vinzentsolussd, yeah, there is some confusion in naming. In arglist ? usually means "optional" (ans is used along with *). In names ? means predicate (and * on the end (like in foo*) can mean "it's like foo, but slightly different"
12:31solussdVinzent: thanks
12:31Vinzentsolussd, funny thing that foo' is used for the same purpose, and *foo* indicates dynamic var %)
12:32solussdi used to use foo', actually still do in letfn'd functions inside a function
12:33solussd*if they have the same name as the function… anyway. I think i'm being mostly consistent. :)
12:35VinzentYeah, I actually like how foo' looks - clean and nice :)
12:42solussdany suggestions for the best synchronization mechanism to control access to a git repository on disk? It wil be manipulated from a website, so I cannot have 2 threads checking out different branches concurrently. Simple locking, or is there a more elegant approach (need to block readers too)
12:43S11001001solussd: clone for every access
12:44solussdS11001001: I'd really like to avoid that- they're large repos. I'm just pulling stats from them and contents of select files at different revisions
12:44S11001001solussd: no such thing if you're on unix
12:44S11001001solussd: as for the latter, I think git cat exists
12:44S11001001though it's not called that
12:45solussdwhat do you mean by ' no such thing' ?
12:45S11001001clones hardlink repo files
12:45solussdS11001001: really? that's awesome.
12:46dsantiagochouser: Not sure if you're there, but I've written a replacement for clj-tagsoup, and am closing in on having that hooked up to tinsel today.
12:46raeksolussd: use a bare repo and extract the tree of the chosen commit into a temporary location
12:46S11001001ah yes, git cat-file
12:47S11001001have you looked over the java implementation of git repo access?
12:47solussdi haven't, seems incomplete
12:47solussd*havent much
12:48raeksolussd: you might be interested in the source of this tool: https://github.com/EugeneKay/scripts/blob/master/bash/git-deploy-hook.sh
12:48S11001001so, uh, java spawning sucks enough that you might be better off adding what you need
12:48raekbut it seems to extract a tarball, though
12:48technomancyS11001001: I played with jgit a bit. it's fine for read-only stuff.
12:49solussdonly other problem I now have is the upstream repos need to be pulled locally, I still need to do that synchronously
12:50duck1123eclipse seems to do well enough using it
12:51S11001001completeness isn't necessarily a virtue
13:06BorkdudeI have used egit a bit in eclipse, which uses jgit
13:12hugodhiredman: just pushed clj-ssh 0.3.3-SNAPSHOT with a clj-ssh.ssh/ssh-agent function that returns an agent that integrates with the system's ssh-agent - I remember you asking for that way back...
13:14pandeiroanyone know if noir's defpage destructuring form should work with {:as data} ?
13:14pandeiroseems like the only way it works is with named query parameters
13:16hiredmanhugod: cool
13:22Borkdudepandeiro: it should work
13:22Borkdude(defpage foo "/" {:as data} ...)
13:23Borkdudesorry, foo should not be there
13:24pandeiroBorkdude: i am testing with beta 2 now, am using beta 7 in the project
13:25pandeiro(defpage [:post "/foo"] {:as data} ...) doesn't work
13:25Borkdudepandeiro: see the last defpage here https://github.com/Borkdude/tictactoe/blob/master/src/tictactoe/views/tictactoe.clj
13:26Borkdudehmm, it is the same
13:26Borkdudepandeiro: I only tested it with noir 1.2.0
13:27pandeiromaybe it's a regression
13:42timvisherCan anyone explain what's going on in clojure.java.shell/sh here? https://gist.github.com/2712514
13:43timvisherit appears that there is some discrepancy as to what it and cmd believes PATH is
13:43Borkdudepandeiro: I'm testing now, and I get the same problem
13:46TimMctimvisher: Are you in Cygwin?
13:46timvishernope
13:46timvisheremacs
13:46Borkdudepandeiro: https://gist.github.com/2712544
13:47pandeiroBorkdude: a couple of things changed in defpage from 1.1.0 to 1.2.0 to 1.2.1 (which hasn't changed since)
13:47timvisheremacs can find convert fine, but a true cmd prompt cannot
13:47timvishermeaning i can launch an inferior-shell process using cmdproxy and typing `convert` gets me the right convert program, as well as which reporting correctly
13:47timvisherbut sh only seems to get it right in the case of which
13:49pandeiroBorkdude: in your example i'm not sure there should be any value in foo, since you don't send any data with the request
13:50Borkdudepandeiro: D'OH… good point
13:50pandeirobut i am testing with POST and sending data and it doesn't get parsed unless it is in querystring format and i explicitly name it by key
13:51pandeiroi am pretty sure it's a bug but i still suck at debugging macros, and the parse-args also needs to be tested
13:57Borkdudepandeiro: here it works now
13:57Borkdudehttps://gist.github.com/2712544
13:59pandeirohmm, with what version of noir?
13:59Borkdudeclone from git
13:59Borkdudepandeiro: also added a post example now
14:00Borkdudepandeiro: can you put the full code on a gist, maybe there is smth else going on?
14:02pandeiroi've already worked around it in my project for now, but to test you could just do this:
14:03pandeiro(defpage [:put "/test"] {:as data} (str "hi, " data))
14:03Borkdudepandeiro: are you sure about put?
14:03pandeiro$ curl -X PUT localhost:8080/test -d 'abcdef'
14:03pandeirotried with put and post and get
14:03pandeirowhat version are you testing on?
14:04Borkdudeworks fine here
14:04pandeiroversion?
14:05Borkdudepandeiro: I just did a "git clone https://github.com/ibdknox/noir.git&quot;
14:05pandeirohuh, ok
14:06pandeirosomething is very weird, maybe it's the terminal or emacs or something
14:08sritchiehey all, does anyone use the :parent key in leiningen?
14:09sritchieah, nm, got it
14:09Borkdudepandeiro: with curl -X PUT I get the right results
14:09Borkdudepandeiro: also with POST
14:12pandeiroBorkdude: thanks for testing it out... still not working for me, must be something stupid somewhere
14:12OwenOuhi guys, is there any background job implementation in clojure?
14:12devnwhat the what? http://clojars.org/search?q=datomic => 500
14:12OwenOui mean library
14:12otfromlive pic from the London Clojurians meetup tonight http://twitpic.com/9lre9e
14:12Borkdudepandeiro: maybe you use data is a local in the body of the defpage… I can't think of anything without seeing the code, sorry ;)
14:13pandeiroBorkdude: code is literally as simple as what i posted... did you try sending data with curl that wasn't in the form of a querystring?
14:14Borkdudepandeiro: I used -d 'name=michiel'
14:14pandeirotry -d 'michiel' ?
14:14pandeirothis is what i am getting at
14:14Borkdudepandeiro: then the map is empty
14:14pandeiroyeah, so that's the question
14:15pandeiroin compojure it's possible to just send raw data without any destructuring, in noir i thought :as could handle that case, apparently only if the data is structured as query params though
14:15pandeiromakes sense i guess
14:16BorkdudeOwenOu: http://clojuredocs.org/clojure_core/clojure.core/future ?
14:16pandeiroBorkdude: thank you for confirming i am not completely insane, much appreciated
14:17Borkdudepandeiro: np, now I learned how to test noir a bit more ;)
14:17OwenOuBorkdude: ok, i guess the convention in clojure is to process background job on the same process
14:18BorkdudeOwenOu: threads are in-process
14:18technomancyOwenOu: if you can do it in-process it's much simpler. you can get away with that a lot more easily in Clojure than in a runtime like Ruby, but it still doesn't always work.
14:19michaelr525hello
14:19OwenOuBorkdude technomancy: yup, that's what i was planning to say, because clojure's true concurrency, it can run background processing in the same web process
14:19OwenOua bit different from ruby/python
14:35dnolen_ibdknox: at the rate you're going seems like you might hit 300K :)
14:44wkmanirehttp://darevay.com/talks/clojurewest2012
14:44wkmanireThis is an awesome slideshow
14:44wkmanireReally helpful.
14:44wkmanireIs there a recording of the talk that went with it?
14:45xeqiwkmanire: http://clojurewest.org/news/2012/5/11/clojurewest-video-schedule.html
14:47wkmanirexeqi: I'm not seeing videos on this site. Am I just blind?
14:47xeqiits the schedule
14:48xeqilooks like the seesaw one won't come out until 7/16/2012
14:48wkmanireoh!
14:48wkmanireCrap
14:48wkmanireThat's along wait.
14:55acheibdknox: will Light Table eventually be able to support literate programming (since files are "merely a serialization") .... maybe through a plug-in ?
14:58mduerksen*print-dup* is nice, but i'm wondering how i should serialize a clojure datastructure that has java.util.Date in it (to be parsed again later). at least as of clj1.3, print-dup isnt directly supported. i guess i could defmethod my own which would output the read macro (#=(...)), but i would rather like to disable *read-eval*. any other suggestions?
15:00sritchietechnomancy, when I run "lein2 push, I'm getting "Caused by: java.io.FileNotFoundException: Could not locate clojure/contrib/java_utils__init.class or clojure/contrib/java_utils.clj on classpath"
15:00sritchiehave you seen that before?
15:00technomancysritchie: I'm not familiar with lein push
15:02sritchieah, whoops, thought it was in there by default -- makes sense, I'll upgrade the plugin
15:02sritchielein-clojars
15:22dsantiagoHey weavejester, I notice hiccup represents doctypes as a plain string instead of an html vector. Is there a reaason for that?
15:22weavejesterdsantiago: Doctypes aren't elements per se
15:23dsantiagoYeah. I just wonder if someone might want to pick them apart.
15:23dsantiagoBut it seems we are out of clojure data structures to represent other things with.
15:24weavejesterdsantiago: Pretty much
15:27michaelr525err
15:27michaelr525trying to configure aliases for my ROOT context/app on tomcat
15:27michaelr525doesn't seem to work
15:28michaelr525anyone knows the proper way to do it?
15:28amalloymduerksen: as of 1.4 dates print with a custom reader literal
15:41mittchelEvening:)
15:45uvtcJust made the upgrade from Emacs 23 and installed an Emacs 24 snapshot. Added the bit about "(require 'package)" and added marmalade in my ~/.emacs. Did `M-x package-install` <Ret> `clojure-mode` and it works (.clj files are automatically recognized). Only problem is, zenburn color theme doesn't automatically load.
15:49mittchelDoes anyone have a good example how to parse xml into a map
15:51devnmittchel: slightly outdated, but this should probably do the trick: http://www.gettingclojure.com/cookbook:xml-html
15:51michaelr525mittchel: why would you want to do that?
15:51mittchelSchool exercise lol
15:52mittchelAlright devn giving it a try
15:57devnyou have a clojure school assignment?
16:03mduerksenamalloy: i feared you might say that ^^ oh well, ich guess i'll have to put up with some not so nice workaround until then
16:13mduerksenhmm, actually, (defmethod print-dup java.util.Date [this out] (.write out (str "#java.util.Date[" (.getTime this) "]"))) isn't all that bad
16:29fil512how do you do a double group-by? i want to group by one column, and then group each group by another column to end up with nested maps...
16:30mittchel(["Piet" "7"] ["Klaas" "10"])
16:30mittchelis this a map?
16:30weavejestermittchel: No, it's a list of vectors.
16:30technomancymittchel: no, but it can be poured into a map easily with the into function
16:30fil512or another way to ask my question is how can you transform one map into another by apoplying a function to the values...
16:31weavejesterfil512: I guess you'd group-by, then map a group-by. Isn't there a contrib function for mapping over the values in a map?
16:31mittchel(into{} [(holiday-name elt) (holiday-month elt)])
16:31mittchelI;m doing something wrong getting error haha
16:31mittchelCharacter cannot be cast to java.util.Map$Entry
16:32aperiodicfil512: there's no builtin, but (into {} (for [[k v] map] [k (f v)])) is pretty straightforward
16:32AimHereYou could do something like (zipmap (keys foo) (map f (vals foo)))
16:32weavejesterclojure.algo.generic.functor has fmap
16:32mittchel({"Piet" "7"} {"Klaas" "10"})
16:33mittchelNow it's a map rigt
16:33mittchelright*
16:33weavejestermittchel: It's a list of maps
16:33S11001001,(map? '({"Piet" "7"} {"Klaas" "10"}))
16:33clojurebotfalse
16:33mittchelI'm parsing this XML and the output of tags are: :naam Piet :cijfer 7
16:34mittchelI want both stored into a map, but its not really working for me lol
16:34mittchel(zipmap [(holiday-name elt)] [(holiday-month elt)]))
16:34mittchelthis what I did
16:34weavejesterfil512: I think you could do something like (->> coll (group-by :foo) (fmap (partial group-by :bar)))
16:34fil512fmap seems kind of vague. would I need to into{} the output of fmap?
16:35fil512I kind of like the zip answer--seems fairly intuitive
16:35weavejester,(into {} '(["Piet" "7"] ["Klaas" "10"]))
16:35clojurebot{"Piet" "7", "Klaas" "10"}
16:35mittchelcan you do into on functions too?
16:36weavejesterfil512: If zipmap will do it, that might be the better solution.
16:36weavejestermittchel: No, it's for pouring one data structure into another.
16:36AimHere,(into #() [3 4 5])
16:36clojurebot#<ClassCastException java.lang.ClassCastException: sandbox$eval79$fn__80 cannot be cast to clojure.lang.IPersistentCollection>
16:36mittchel,(for [elt (xml-seq xml-doc) :when (= :resultaat(:tag elt))] (into {} '(holiday-name elt) (holiday-month elt)))
16:36clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: holiday-month in this context, compiling:(NO_SOURCE_PATH:0)>
16:37mittchelhm can't show you my error
16:38weavejestermittchel: You probably want: (into {} [(holiday-name elt) (holiday-month elt)])
16:38weavejesterOr make holiday-name and holiday-month return maps
16:38weavejesterThen you could just merge them
16:38mittchelClassCastException java.lang.Character cannot be cast to java.util.Map$Entry
16:38mittchellol :D
16:38weavejesterOr just have them return the values
16:39mittchelhm
16:39weavejesterSo: {:name (holiday-name elt) :month (holiday-month elt)}
16:39aperiodicmittchel: that exception sounds like a string is being returned where a map is expected
16:39mittchelWell
16:39mittchelMy function is like this
16:39mittchel(defn holiday-name [resultaat] (first (:content (first (:content resultaat)))) )
16:40mittchelthis gets the first result, but is it also possible to return the first result + its tagname?
16:40aperiodicmittchel: whenever a sequence function is called on a string, it turns it into a sequence of characters, which is probably where the character that can't be cast is coming from
16:40mittchelaperiodic: thanks.. but very new at clojure so hard to see for me.
16:41mittchelholiday-name gets some value out of its xml tag.. but I want it to return as a map, how am I able to do that? lol :/
16:42mittchelthis is hard stuff ;d
16:43aperiodicmittchel: i'd hazard a guess that the value of (:content (first (:content ...))) is a string, so then the outermost first returns a single character, which into tries to cast to a map entry (since when the first arg to into is a map, it expects the rest of its args to be sequential collections of map entries)
16:45mittchelahw
16:45jamiiI'm not sure what to call this: https://gist.github.com/2713787
16:45jamiiSome kind of syntax/type checker thing
16:46aperiodicmittchel: to return a map, just construct a map literal, e.ge (defn holiday [elem] {:name (holiday-name elem), :month (holiday-month elem)})
16:46mittchelaperiodic: where should I return the map in every holiday function? so (holiday-name) etc
16:48aperiodicmittchel: i would just keep the primitive-returning holiday-name and holiday-month functions, then write another one that constructs the map you want using those
16:48mittchelbut
16:48mittchelahh screw it
16:48mittchelI'm quitting
16:48mittchellol
16:49aperiodicbut what?
16:49mittchelI understood 5% of what you said
16:50mittchelI'm just gonna mess around
16:51mittchelCause I made the holiday function but it returns errors when I use it in the for loop
16:51aperiodicwhat do you get when you just call it on an element?
16:52mittchelhttp://pastebin.com/17AZXS7X
16:52mittchelThis is what I'm trying
16:52mittcheland the for has to stay an expression, cause I need to write an expression for the assignment:P
16:54aperiodiceverything in clojure is an expression, so that shouldn't be hard
16:55mittchelSo
16:55mittchelbasically what I want is
16:55mittchelKey value in a map of the results
16:55mittchelso
16:55mittchelNaam: Klaas
16:55mittchelCijfer: 10
16:55mittcheletc.
16:56aperiodicso, the only thing that looks wrong to me is you're not actually calling holiday. to call a function, it has to be the first element of a list.
16:58mittchelhm
16:58mittchelwhere should I call it?
16:58mittchel(for [elt (xml-seq xml-doc) :when (= :resultaat(:tag elt))] holiday [elt])
16:58mittchelactually calling it
16:59mittchelhm
16:59aperiodicit's in the right place
16:59aperiodicjust malformed
16:59mittchelwell what am I doing wrong then:o
16:59lucianprobably s/holiday [elt]/(holiday elt)/
16:59aperiodicaye
17:00mittchelhm
17:00mittchelahh close
17:00mittchel({:naam nil, :cijfer nil} {:naam nil, :cijfer nil})
17:00mittchelnils for the win
17:00mittchelhaha
17:01aperiodicso, where are the nils coming from?
17:01aperiodicwhich functions?
17:01mittchelnot sure
17:01mittchel(defn resultaat-naam [resultaat] (first (:content (last (:content resultaat)))) )
17:01mittchelguess this
17:01mittcheland th eother 1
17:02aperiodicwell, you have a repl, so you should be able to verify your suspicions there
17:02lucian,(last [1])
17:03clojurebot1
17:03lucian(last [])
17:03lucian,(last [])
17:03clojurebotnil
17:03lucianprobably from something like that
17:04mittchel(defn resultaat-naam [resultaat] (count (:content resultaat)) )
17:04mittchelthis returns 0
17:04mittchelso maybe thats nil?
17:04mittchelhttp://pastebin.com/LTpM2XwS
17:05mittcheleverything is nil so not only where last is called:o
17:05aperiodicgood find! if that list empty, then the last and firsts in resultaat-naam/cijfer will return nils, which bubble up to holiday
17:06mittchelYep
17:06mittchelbut not sure why its nil
17:06mittchelhaha
17:06hyPiRionSo this is interesting: http://pastebin.com/JAX5S0FX shows an attempt where I try to make n lazy lists out of a single lazy list. The first one works fine but sets up many transactions. For my work, I'm okay with it just working in a single thread. For some strange reason, this doesn't work when I have lazy-seq in the function passed to map (NullPointerException), but when I leave it out it works just fine. Anyone have any idea of what's going on? I suspe
17:07hyPiRion... And now I see that this should've been posted to the Clojure Group instead.
17:07aperiodicheh, me neither. you could try not calling holiday in the body of the for, and just passing the element through, to see what the elements look like, which might reveal why calling :content on them returns an empty list
17:08mittchelIn the body, you mean.. remove when?
17:08aperiodic,(doc for)
17:08clojurebot"([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost fastest, and nested coll-exprs can refer to bindings created in prior binding-forms. Supported modifiers are: :let [binding-form expr ...], ...
17:08mittchelhehe
17:09mittchel({:naam nil, :cijfer nil} {:naam nil, :cijfer nil}
17:09mittcheletc..
17:09mittchela lot of them
17:09aperiodicso, there are two things you pass to for, the first is the bindings vector (seq-exprs in the docstring), and the second is the body
17:10hiredmanhyPiRion: that code is horrible
17:10hiredmanlike, just utter garbage
17:10mittchelI know, everything is nil
17:11hiredmanhyPiRion: so I doubt anyone is going to bother trying to tease out exactly why it isn't doing what you want
17:11aperiodicmittchel: but that's *after* you call holiday, i'm asking what they look like *before* you call it
17:12mittchelehh
17:12mittchelok
17:12hyPiRionhiredman: Okay, thanks. Is it ugly in terms of being long, or is also due to my horrible nestings?
17:12hiredmanit's just bad
17:12mittchel([{:tag :naam, :attrs nil, :content ["Piet"]}] [{:tag :naam, :attrs nil, :content ["Klaas"]}])
17:13S11001001hyPiRion: throw that away, and write a function that takes your preds and the seq, mapping each element of the seq to the index of the first passing predicate
17:13mittchelaperiodic: can I pm you for a sec?
17:13hiredmanside effects in lazy seqs, transactions for little to no reason, horrible nesting, function size
17:13hiredmanetc etc
17:13aperiodicmittchel: sure
17:14hyPiRionhiredman: okay, thanks.
17:15mittchelaperiodic: done
17:16hiredmanhyPiRion: (fn f [ps items] (when (and (seq ps) (seq items)) (lazy-seq (let [{a true b false} (group-by (first prs) items)] (cons a (f (rest ps) b)))) ;; or something
17:17hiredmanwhile not being lazy it has none of the nightmarish qualities
17:21brehauthi PeregrinePDX
17:23PeregrinePDXHeya brehaut
17:47notNicolasdoes anybody have an explanation of the "loop" command that isn't written for world class phd computer science students?
17:47technomancyyou probably don't want to use loop
17:47notNicolasI need to understand what it does to solve a problem in 4clojure
17:48jasonjcknnotNicolas: do you understand recursion?
17:48jasonjcknnotNicolas: perhaps you should check out one of the great clojure books
17:48notNicolasjasonjckn, I think I have a decent understanding
17:48technomancyoh, well that's different
17:48BorkdudenotNicolas: &&(loop [i 0] (if (< i 10) (do (println i) (recur (inc i)))))
17:48raeknotNicolas: if loop is a label, then recur is a goto
17:48raek(but with parameters)
17:49brehautnotNicolas: you arent you thinking of common lisps loop macro are you?
17:49Borkdude&& doesn't work anymore?
17:49lazybotjava.lang.RuntimeException: Unable to resolve symbol: & in this context
17:49notNicolasI'm thinking about this http://clojuredocs.org/clojure_core/clojure.core/loop
17:49amalloyyou want ##
17:49notNicolasBorkdude, you should add an example of that simplicity on that page. As it stands, the page is completely impossible to understand for a beginner like me
17:50BorkdudenotNicolas: ##(loop [i 0] (if (< i 10) (do (println i) (recur (inc i)))))
17:50lazybot⇒ 0 1 2 3 4 5 6 7 8 9 nil
17:51jasonjcknthose examples look like they were taken from some massive source code base
17:51jasonjckninstead of written for explanation purposes
17:51notNicolastotally
17:51BorkdudenotNicolas: go ahead
17:51hiredmannotNicolas: clojuredocs.org has never struck me as very useful, consider reading the docs on clojure.org, particularly http://clojure.org/special_forms
17:52notNicolashiredman, oh yeah, this is way more descriptive
17:52jasonjcknfree stuff will only be so good hough, that's why we have great books
17:52BorkdudenotNicolas: if you want to grasp the basics, read a book like jasonjckn says indeed
17:53notNicolasI don't have time to read a book. I'm just hacking my way through 4clojure when I have time to spare :p
17:53jasonjcknwell use the clojure community's time wisely please :)
17:54Borkdudewhat happens when I have ##"multiple" expressions in my ##"sentence" ?
17:54Borkdude,(doc loop)
17:54clojurebot"([bindings & body]); Evaluates the exprs in a lexical context in which the symbols in the binding-forms are bound to their respective init-exprs or parts therein. Acts as a recur target."
17:54amalloyhe actually only responds to things that are obviously clojure expressions - ie the reader returns a sequential thing for them
17:55amalloybut you can ask for ##(inc 1) and ##(+ 1 2) if you want
17:55lazybot(inc 1) ⇒ 2
17:55lazybot(+ 1 2) ⇒ 3
17:55clojurebot*suffusion of yellow*
17:55Borkdude,"dude"
17:55clojurebot"dude"
17:55Borkdude##"dude"
17:56notNicolasjasonjckn, I remember how last year I harassed ##C++ for 8 months straight and learnt everything I know about C++ there to a point that I can teach senior programmers new things
17:56jasonjcknnotNicolas: cool, glad you gave back
17:57notNicolaspft lol
17:57notNicolaswell, I stay there and answer questions for other noobs now.
17:57BorkdudeI had this thought: one category of FP-people lose attention immediately when a new prog. language has no advanced type system, another category loses interest immediately when it has no Lisp-like macro's
17:58raekBorkdude: for some reason lazybot requires the expression after the ## to be wrapped in parens
17:58jasonjcknBorkdude: is that category list exhaustive?
17:59Borkdudejasonjckn: not all FP-people belong to any of these categories
17:59jasonjcknnow that you mention it, eveyr since I've learned about macros, it really colors my perception of other languages
17:59jasonjcknparticularly when they try to solve the problems that macro solves with 'hacks'
17:59amalloyraek: notNicolas just provided an example for us - we don't want him trying to eval ##C++
17:59amalloybut he'll eval anything you want if you just put a & at the front of your message, as always
18:00kaoDunless you put another extra space before
18:00hyPiRionBorkdude: I changed from Common Lisp to Clojure only because it is more succinct.
18:00raekhadn't thought of that channel name convention
18:00notNicolasI'm glad to have been of help
18:00hyPiRionHopefully other people change from one language to another when they find out that they program faster in the other language.
18:01Borkdudeto tell you one example where I got this thought: the Dutch FP-days, organized by academia. It is Haskell only… a dynamic language like Clojure isn't taken seriously
18:01amalloykaoD: "at the front", in contrast to "somewhere near the front"
18:02kaoDadmit it, he's just mean to me
18:02kaoDbtw, just learn about ## multiple expressions
18:03jasonjcknBorkdude: there's a lot of arbitrary criteria people apply to languages, sometimes language features themselves become goals, as oppose to goals for creating excellent product
18:04hyPiRionBorkdude: That's a bit sad. I hoped academia opened its arms for new ideas, or at least evaluated them before saying no.
18:06Borkdudeyeah… but to be honest, Lisp macro's are really cool and powerful.. any language that doesn't have that feels kind, can it still be awesome? :P
18:06dnolen_Borkdude: there's plenty of interesting verification work going on outside of types.
18:06dnolen_Borkdude: it always boggles my mind how little FP *users* seem to know about Prolog and all its offshoots.
18:06Borkdudefeel kind of … incomplete (forgot some letters, must be beer)
18:07technomancyBorkdude: comparing elisp to ocaml, I feel the lack of referential transparency much more strongly than the lack of macros
18:08dnolen_jasonjckn: so how did using core.logic for static analysis work out for you in your compiler project?
18:08Borkdudednolen_: I like the approach of the reasoned schemer: logic programming is a natural extension of FP…
18:09brehautsounds like someone is preaching to the converted
18:09dnolen_Borkdude: The Reasoned Schemer is bigger than that. Logic programming on the same terms of the language is written in.
18:10Borkdudetechnomancy: ocaml has immutability as default, or what do you mean exactly?
18:10jasonjckndnolen_: Worked extremely well, particularly for checking various constraints about the type hierarchy (duplicates declarations, cycles, final classes are not extended, etc)
18:11dnolen_jasonjckn: very cool, will you write up anything about it?
18:12Borkdudednolen_: I must admit I have only read the first couple of pages but I'm impressed already.. I also like their style of "teaching"
18:12Borkdudednolen_: I have done some contraint logic programming in the past, but I didn't see the natural connection then
18:13jasonjckndnolen_: It's a pretty niche subject to write up on type hierarchy checking, i considered doing a write up about how to write a java compiler, but now looking back on the code, it's a huge undertaking, and i think we have around 4k lines
18:13dnolen_Borkdude: it's a great book if sometimes oblique.
18:13technomancyBorkdude: more or less
18:13jasonjckndnolen_: i'm not sure how many people would read a blog post on type hierarchy checking with core.logic (?) many a dozen people
18:14technomancyif I had to pick between macros and referential transparency, macros would lose.
18:14dnolen_jasonjckn: I see - even a little experience report on how you approached using core.logic from a high level.
18:14Borkdudetechnomancy: so common lisp or haskell, it would be haskell?
18:14dnolen_jasonjckn: probably more people than you think.
18:15amalloyjasonjckn: if you get dnolen_ to tweet it you'll get way above a dozen readers
18:16Borkdudedon't mean to start language fights in here… I was just thinking about the type-obsessed and macro-obsessed
18:17dnolen_Borkdude: both categories of people are probably worth ignoring.
18:17jasonjckndnolen_: amalloy it's definitely a good idea, i'll think about it more, i'm not sure if I want to start a blog, or just do a write up.
18:18yoklovhaha, academia is cool until you realize that to a large extent it's a brute force approach
18:18bderooms_I wrote a program that parallellizes reading a huge file processes it and then writes it out. Everything works fine, but once I increase the size of the file to a certain size the program behaves weird.. In stead of crashing, it just drops the cpu usage and does nothing anymore
18:18yoklovresearch anything that seems publishable
18:18BorkdudeThis quote of @fakerichhickey is absolutely awesome though: I am not out to win over the Haskell programmers; I am after the Lisp programmers. I managed to drag a lot of them about halfway to Haskell.
18:18yoklovat least that was my experience outside of computer science, but I can't imagine it's significantly different in cs
18:19bderooms_does anyone have an idea what is happening? .. no memory to store the agents messages or something?
18:20jasonjckndnolen_: amalloy it'd be interesting to a lot of people if i showed how to write type systems for DSLs with core.logic, do you know any examples of this?
18:21dnolen_jasonjckn: nope, do it!
18:26yoklovIs it possible to use rlwrap or jline or anything readline-like with lein-cljsbuild
18:27yoklovand by possible, i mean is it easy/already done
18:35notNicolasis clojure slow
18:35technomancyno
18:36PeregrinePDXFor certain definitions of slow all programming languages are.
18:36Borkdudegive me an example of a slow programming language
18:37technomancyspeed isn't a property that can be applied to a programming language, it's a property of programs.
18:37technomancya better question would be "does this language make it easy to write code that isn't slow?"
18:38notNicolasis it faster or slower than clisp?
18:38Borkdudeor maybe also "is it easy to write very slow code"
18:39technomancynotNicolas: again, languages don't have a speed
18:39technomancydo you mean "is it possible to write faster programs in Clojure or clisp?" or do you mean "is it easier to write fast code in Clojure or clisp?"
18:40technomancytotally different questions
18:40notNicolasThere's just something about an interpreted language running on Java that sounds slow
18:40Cr8hell, the same clisp program is going to run differently on different implementations
18:40BorkdudenotNicolas: common lisp is commonly compiled to native code, clojure is commonly compiled towards non-native code...
18:40technomancy◔_◔
18:40yoklovnotNicolas: clojure isn't interpreted, it's compiled
18:40notNicolasoh ok
18:40Cr8notNicolas: Clojure is as much a JVM-native language as Java is.
18:40technomancyCr8: clisp is an implementation
18:40Cr8ah, I thought he was just shortening common lisp
18:41Cr8bells.
18:41technomancyCr8: he may be confused
18:41notNicolastrust me, I am very confused
18:41technomancyBorkdude: clojure usually gets JITed into native code where appropriate
18:44Borkdudetechnomancy: ah
18:44technomancyit's possible to write very fast Clojure code, but sometimes it can be a lot of work: http://meshy.org/2009/12/13/widefinder-2-with-clojure.html
18:45yoklovnotNicolas: for the most part, it's easier to write fast code in clojure than it is in common lisp, but you probably can get faster programs in common lisp (depending on the implementation)
18:45technomancyit's usually easy to beat out things like ruby, js, and python though. beating Java and Scala is hard but possible.
18:45Borkdudetechnomancy: btw I noticed that powershell scripts take a while to load
18:46PeregrinePDXnotNicolas, both learning clojure style books I have both talk about clojure being compiled in the first chapter. A book might help answer some of these questions for you.
18:46Borkdudetechnomancy: in combination with the effort to keep lein startups below x seconds that may not be good
18:46yoklovnotNicolas: if you want, compare http://shootout.alioth.debian.org/u64q/program.php?test=mandelbrot&amp;lang=sbcl&amp;id=1 and http://shootout.alioth.debian.org/u64q/program.php?test=mandelbrot&amp;lang=clojure&amp;id=6 (neither are idiomatic, but clojure's is much easier to read, albeit slower)
18:46hiredmanor just read clojure.org
18:47technomancyBorkdude: hm; what kind of numbers are we talking about?
18:47hiredmanthe first paragraph of the first page of clojure.org says "Clojure is a compiled language - it compiles directly to JVM bytecode, yet remains completely dynamic."
18:47Borkdudetechnomancy: a few seconds?
18:47technomancyBorkdude: wow, that's terrible.
18:47technomancygood to know though
18:48technomancyhiredman: it also still says "every feature of Clojure is available at runtime" =\
18:48hiredmantechnomancy: which aren't?
18:48technomancyAOT and stuff
18:48Borkdudetechnomancy: http://stackoverflow.com/questions/4208694/how-to-speed-up-startup-of-powershell-in-the-4-0-environment
18:49technomancyBorkdude: useless
18:49hiredmantechnomancy: you can aot stuff at runtime
18:50technomancyhiredman: I guess it doesn't strictly imply the ability to repeat a given operation
18:50technomancyBorkdude: thanks for the info though
18:50hiredmanbut why would you want to do something called "ahead of (run)time compilation" at runtime?
19:00brainproxyanyone having an issue w/ clojurescript r1236 (latest rel) where sometimes dependencies are out of order in the compiled js?
19:01technomancyI just think it's somewhat misleading
19:01technomancyit has features that aren't intended to be used at runtime even if technically it's possible to do so.
19:06yoklovIt's too bad that the 'every feature supported by clojure is supported at runtime' statement doesn't hold true in clojurescript
19:07yoklovI definitely miss some of them when writing cljs code
19:10hiredmanwell, you know, when you build upon sand
19:10yoklovso true :(
19:11brehauti like to think of javascript as very tiny pieces of broken glass: it looks like sand, but cuts you more often
19:11bderooms_if anyone gets why this code goes outofmemory http://pastebin.com/hJe4jpjz
19:11Borkdudethis is why some people want (common) lisp all the way down :P
19:12bderooms_I thought if I don't keep the head and since line-seq is lazy it would traverse the file without exploding in memory
19:12hiredman(doc doall)
19:12clojurebot"([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time."
19:12hiredmanread it carefully
19:12bderooms_auch..
19:13bderooms_thanks hiredman
19:13bderooms_so I need dorun
19:13bderooms_whej.. works!
19:15hiredmanyou could also play with https://gist.github.com/2714805 and the new reducers stuff
19:16bderooms_mmm interesting
19:16brainproxyis the clojuredocs site stagnant?
19:16brainproxyor just low activity w/r/t its blog component
19:17amalloyhiredman: that's not really a correct implementation, is it? you need to check (reduced? result) to short-circuit
19:17hiredmanamalloy: possibly
19:21hiredmanamalloy: correctness is someone else's problem, I have the first public code using reducers for io now
19:21amalloyhaha
19:21midrangiolike the canononical reduce function?
19:22midrangioor like map/reduce type reducers
19:22hiredmanmidrangio: http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html
19:23hiredmanclojurebot: reducers |are| http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html
19:23clojurebotAck. Ack.
19:23midrangiothat's amazing
19:23midrangioi guess python has parallel map too
19:23midrangiobut i feel like this is probably safer
19:23hyPiRionIs there a sequential pcalls, or do I have to do something like (map #(%) list) to achieve the same result?
19:26midrangiohiredman: can you explain the following line: What is the generic gateway to a collection applying things to itself? In Clojure, it is (internal) reduce.
19:28bderooms_hiredman: could you also explain why pmap acts funny on huge files? http://pastebin.com/PmkQfFPp
19:28bderooms_well.. actually anything 'parallel' .. since I tried it also with a fixed number of actors.
19:29bderooms_basically from the moment I replace map with pmap my processors run at 90 percent each and then just 'freeze' to 1 percent usage after a few seconds
19:29hiredmaninternal reduce is a protocol that can be used to give a an implementation of reduce that is specialized to a particular object
19:29hiredman(that can take davantage of special knowledge about that collection)
19:30hiredmanbderooms_: that code is garbage
19:30midrangioahh guess i have to learn more about clojure then
19:30hiredmanbderooms_: def (and by extension defn) creates a global var
19:30hiredmandef is not lexically scoped
19:30wkmanireIs type reserved?
19:30hiredmanlet is
19:31midrangiohow should he do it then
19:31hiredmanwkmanire: type is a function in clojure.core, but it is just a function
19:31midrangiouse anonymous function?
19:31wkmanireI see.
19:31wkmanirehiredman: Thanks
19:31hiredmanmidrangio: as far as I can tell you are not calling a function at all
19:32hiredmanbut it could just be cause it is hard to tell which parens line up there
19:32hiredman(the code could just be poorly formatted)
19:32midrangioisn't it calling process-transaction inside
19:32bderooms_okay so I'll put the defn outside the main scope
19:32bderooms_but the question remains
19:32hiredmaninside of what?
19:33midrangiohiredman: on line 11
19:33midrangioi wonder why pastebin doesn't run it through an autoindenter
19:34bderooms_sry for the formatting.. I have been trying lots of code already this night with my eyes half closed
19:51alex_baranoskyTimMc: hey man, it would be cool to get sorted-set into sees-ad-colls … I was showing the guys here your webpage
20:01augustlI want to get a new vector where the 2nd item in another vector is transformed by a function, suggestions?
20:02augustlthe use case is [2010 5 4], a date of y m d, where the month needs to be increased by one
20:02hiredman(doc update-in)
20:02clojurebot"([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created."
20:02augustlhmm, it's under maps in the cheat sheet, I'll look it up
20:03augustlI only have one vector, not nested, just trying to avoid saying "changing" a vector since you don't really do that ;)
20:03augustlbut yeah, it's just [2010 5 4] => [2010 6 4]
20:04aperiodic,(update-in [2010 5 4] [1] inc)
20:04clojurebot[2010 6 4]
20:04augustlah
20:05scottjaugustl: there's no non-nested version of update-in. it's like assoc but you pass a function instead of value.
20:07augustlscottj: ah, I see
20:08wkmanireI'm jacking with tkinter in clojure-py. when I try to .config the root widget it is throwing a generic exception with no description.
20:09wkmanireDo I need to declare the root widget as dynamic?
20:09hiredmangiven the blog posts I've seen describing clojure-py I would be surprised if it worked at all
20:09wkmanireI'm able to set up a frame with a grid layout
20:10wkmanireI've tested text boxes and entries with success.
20:10wkmanireAdding a menu has been a no go so far.
20:10wkmanireHere's the borked code. https://www.refheap.com/paste
20:10wkmanireworks on 2.7.2 if you remove line 41.
20:11wkmanirePython 2.7.2 that is.
20:12wkmanireWhat would be the syntax to make tk dynamic?
20:15nDuffIn a case where I expect to have a native Java object of a specific type, I instead have an instance of $Proxy1555, such that isa? against the class it wraps (which I expect to have a handle on directly) returns false. What exactly is going on here, and -- more to the point -- should I be doing something differently to do isa? tests through this layer of wrapping?
20:16hiredmannDuff: read the docstring of isa? and make sure you have the arguments in the right order
20:17hiredmannDuff: you may also want to switch to instance?
20:17nDuffahh
20:17nDuffinstance? is what I needed
20:25technomancyisa? is the new contains?
20:30kaoDwat
20:30kaoDI just discovered the true Overtone power
20:30kaoDjust awesome
20:30brehautgeneraeting dubstep by seeding the random generator with a twitter stream?
20:31kaoDnope, just regular music
20:31brehautprobably for the best
20:31kaoDI'm (kind of) a musician so I am biased not to do that kind of crazy stuff
20:32kaoDalso: I'm tired of wobble basses :P
20:33kaoDtheir roadmap looks awesome too, I was thinking on doing something simillar (kinda tired of "static" synths)
20:34brehautim also a kind of musician, and likewise
20:36wkmanirebrehaut: lol @ twitter comment
20:40xeqi~isa?
20:40clojurebotHuh?
20:48mudphonew00t, my Clojure Bee iPhone app's latest version was just released (free copies for anyone interested) :)
20:49aperiodicclojure Bee?
20:49aperiodicis that like a spelling bee?
20:50mudphoneaperiodic: yeah, but the quiz isn't done yet
20:50mudphonei just have the api browser/surfer done
20:50mudphonei'm building it to be a personal navigator through the api
20:51aperiodicdid you make up the quiz questions, are they sourced from somewhere?
20:51aperiodic(real question: can i look at them?)
20:52mudphonei don't have any quiz questions yet
20:52mudphonesuggestions?
20:53mudphoneI was going to start simple… like multiple choice… doc string matching to symbol?
20:55mudphonemore interesting quiz questions would be more fun though… hmmm
20:59aperiodicquestions that can be easily answered with google or the clojure cheatsheet don't sound that fun. a 4clojure client would be more interesting to me, and the crappy keyboard would encourage code golf
21:01devnmudphone: cool!
21:01devnmudphone: ill take a copy if you're offering. :)
21:02devnmudphone: you could do a series of questions like: "expand this macro"
21:02mudphonedevn: promo code sent
21:02devn"what is the result of calling macroexpand-1 given the following..."
21:04aperiodicman, i would love macro quizzes. i've barely written any macros.
21:05mudphonedevn: that sounds scary… hmmm… interesting ideas
21:05devni just started reading let over lambda
21:05devndoug hoyte friggen /loves/ macros
21:05mudphonehow does multiple choice macro expansion sound?
21:05mudphonealso Paul Graham :)
21:06devnmudphone: could work... you could ask things about underlying implementation and so on
21:06devnlike, what is the class of []? what is the class of (iterate inc 0)? etc.
21:08technomancyPaul Graham's assertion that ViaWeb was 25% macros terrifies me.
21:09technomancythat's just Not Right
21:09mudphonehow you would calculate that percentage, terrifies me
21:09devntechnomancy: have you read Let Over Lambda?
21:09mudphonedevn: excellent ideas...
21:09technomancydevn: no, but I've heard it's more or less a CL troll
21:10mudphone(on the what is the…)
21:10devntechnomancy: what does that mean?
21:10technomancydevn: I guess he takes every available opportunity to talk about how great lisp-2 is?
21:10devnlike it's designed to elicit negative reactions from the CL community or?
21:11devntechnomancy: don't know. just started it. he's pretty passionate about his macros, though. im looking forward to reading his treatment of anaphoric macros and so on
21:11technomancyhttps://mobile.twitter.com/trptcolin/status/197859522021302272
21:13devnheh. im not joining a religion. i think the talk christophe gave at the first conj and fogus' talk at the last conj are probably right. but Joy of Clojure still lists Let Over Lambda as a reference. I'm interested to see what truth it holds.
21:14amalloytechnomancy: there is some good stuff in LoL, to be sure
21:15amalloybut there is more smugness than is really warranted
21:18mudphoneI had bookmarked this as a good set of instructions for installing Slime: http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html
21:18mudphoneBut, it seems to be dead now… Anyone have another good set of instructions?
21:19amalloy~swank
21:19clojurebotswank is trust the readme and the readme only. all others will lead you astray.
21:20technomancywhat happened to the riddell.us warning?
21:20lazybotThe riddell.us tutorials are much more highly-ranked on Google than they deserve to be. They're old and way too complicated. If you're trying to install Clojure...don't! Instead, install Leiningen (https://github.com/technomancy/leiningen/tree/stable) and let it manage Clojure for you.warning?
21:20technomancylazybot: belated botsnack
21:20mudphonemoce
21:20mudphones/moce/nice/
21:21mudphonei've been away too long :)
21:21technomancyoh, I guess if it's 404ing then the warning can be removed
21:21technomancyyay
21:21mudphonewell, the website says that it will be coming back
21:22technomancyhopefully that particular page doesn't
21:23amalloyyeah, i dunno why lazybot didn't jump on that the first time
21:24devnamalloy: yeah i can smell the smug in the first 20 pages. he's laying it on thick.
21:24LoganLKclojure + vert.x . could you smart people share some insight?
21:25brehauthuh. two lisp books with LoL as their abbreviation. thats a little difficult
21:25mudphoneso, I should read the Swank readme and use Leiningen for all else?
21:25technomancyLoganLK: if it gets people off node, I'm for it.
21:25devnlol
21:26LoganLKis the "concurrency model" of vertx compatible with clojure's? I know very little about both :(
21:26technomancyLoganLK: it works fine, but I gather most people doing async work in Clojure are happy with aleph.
21:27technomancyI don't know if Vert.x brings much that's new to the table.
21:27LoganLKgotcha. thanks :)
21:27technomancyit does seem to have better docs
21:27amalloybrehaut: yeah, i accidentally unleashed a long rant about land of lisp
21:29brehautwait, you were talking about Land of Lisp?
21:29amalloyoh, not just now
21:29brehautoh right
21:29amalloythis time my wrath was well-directed
21:30brehautha
21:34wkmanireI got that menu to work and have no idea why.
21:35wkmanireI hate it when I fix bugs without ever knowing what was wrong.
21:52bhenryping ibdknox
22:07amalloybhenry: btw, if you instead say "ibdknox: ping", lazybot will send you a PM when ibdknox is around, in case (for example) he's careless and doesn't mention you
22:08bhenryamalloy: interesting.
22:08amalloyyou can even PM that to lazybot and he'll still notify you, giving you an efficient way to politely stalk someone if it's not urgent
22:09bhenryhaha even cooler
22:10bhenrylazybot should recognize ping commands when ping is the first word of a message
22:14amalloynah
22:14amalloy"ping me when you get back, bro" and stuff like that is too common
22:14amalloy"ping is my favorite ICMP command"
22:15devnICMP is my favorite band
22:28aperiodichello from clojerks!
22:29PeregrinePDXI almost went to clojerks today
22:29aperiodicwhy not? it looks like a great talk
22:30PeregrinePDXVarious things got in my way.
22:31PeregrinePDXAnd I am brand new to clojure so it looked like the talk would go way over my head.
22:34aperiodicaw, too bad. hope to see you at the next one!
22:37muhooclo...jerks?
22:38aperiodicmuhoo: the pdx clojure group is called clojerks
23:03muhoonice. tho it's hard to beat "seajure"
23:03muhoojava... makes me want to puke blood: https://www.refheap.com/paste/2760
23:04aperiodici wanted it to be called pojure (pronounced "poser")
23:07muhooi knew an electronic music artist named "preshish moments". it had to be pronounced just that way too.
23:10muhoothank gawd for (-> ) https://www.refheap.com/paste/2761
23:15devnmuhoo: some guys i work with recently created a tool called "bwoken"
23:17muhoocute
23:19muhoowow, he's still touring http://preshishmoments.com/
23:25yoklovhm, can anybody think of a 1 character true value?
23:25Raynes1
23:26RaynesAny single digit integer.
23:26yoklovwow, how dumb of me. thanks
23:36nsxt_Raynes: thanks for refheap.vim
23:37zcaudateI'm using fetch's defremote.... Is there a canonical way to convert a date in clojure to a date in clojurescript?
23:38zcaudateor should i just turn it into a a long a parse it as a Date() object?