#clojure log - Jan 13 2012

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

1:10 devn: Hello all.

2:17 romanandreg: has anyone tried to used the implementation of a multimethod defined in a namespace you are requiring? say you are working on namespace a, and the namespace b has a definition of a multimethod from a namespace c

2:18 I want to be able to use the impl of the multi method defined on namespace b in namespace a

2:18 any thoughts?

2:18 jcromartie: I'd say try iy

2:18 it

2:18 romanandreg: no luck

2:18 jcromartie: make a quick test

2:18 ok

2:20 romanandreg: I could do a copy-paste, but I wouldn't feel clean after that :-p

2:21 jcromartie: but really, that's the whole point multi methods

2:21 of multimethods

2:21 the interface is the only thing you reference directly

2:21 including the implementations in *any* way installs them

2:22 and then you are isolated from that implementation

2:22 romanandreg: well I'm doing a require :as for namespace b from namespace a

2:24 ns a requires b and c; c has a defmulti, b has a defmethod of mulit defined on c; a wants to use the defmethod defined in b

2:24 uhmm…. gotta be a way

2:25 jcromartie: so it would not be sufficient for namespace "a" to require the multimethod from namespace "c"

2:25 romanandreg: jcromartie: it should, but is not, it seems the "defmethod" from b is not being loaded

2:26 jcromartie: huh, so the implementation itself is not loaded?

2:26 romanandreg: jcromartie: that's my wild guess

2:26 jcromartie: and you're sure it's not just a problem with the dispatch value

2:26 and you're sure namespace b is loaded

2:27 romanandreg: jcromartie: yes, as soon as I'm trying to use the symbol (dispatch value is a symbol in this case) on ns a, the thing barfs back at me

2:27 saying there is no dispatch for the given symbol

2:27 jcromartie: ok let's try it in a REPL

2:30 in my experiment, doing (ns c) (defmulti foo …) (ns b) (defmethod c/foo …) (ns a) (c/foo b-dispatch-val) seems to work

2:31 I'd check the dispatch function

2:31 but well it's a symbol

2:31 so

2:31 romanandreg: uhmm weird

2:31 jcromartie: you know already :P

2:31 romanandreg: I can show you the actual real code, or at least where is coming from

2:31 jcromartie: anyway time for be… it's 2AM here

2:31 sure

2:31 I'll give it a second

2:31 romanandreg: ok

2:32 getting sources

2:32 from github links

2:33 jcromartie: I'm working with this library => https://github.com/rnewman/clj-apache-http/blob/master/src/com/twinql/clojure/http.clj#L190

2:33 also with this other

2:33 I'm trying to use this impl

2:33 https://github.com/mattrepl/clj-oauth/blob/master/src/oauth/client.clj#L44

2:34 that also requires that project

2:34 jcromartie: with entity-as

2:34 romanandreg: my project uses those two project

2:34 s

2:34 jcromartie: so what about your code

2:34 romanandreg: (:require [com.twinql.clojure.http :as http]

2:34 [oauth.client :as oauth])

2:34 access-token (oauth/success-content

2:34 (http/post access-token-uri

2:34 :as :urlencoded))

2:34 barfs at me

2:35 Exception: java.lang.IllegalArgumentException: No method in multimethod 'entity-as' for dispatch value: :urlencoded

2:35 http/post uses internally entity-as

2:36 jcromartie: :urldecoded

2:36 romanandreg: LOL

2:36 jcromartie: DE not EN

2:36 :P

2:36 have a good night

2:36 later

2:36 romanandreg: LOL

2:36 jcromartie: I'm sleepy

2:36 thaaaaaanksss!

2:36 gosh 2 am at your TZ and like a sharp

2:36 jcromartie_sleep: thanks

3:07 AWizzArd: Moin moin.

3:13 devn: is it right to assume that if i have a sorted map and call (vals) on it that I will get a sorted seq?

3:14 ,(let [sorted-m (sorted-map :0 10.11 :1 9.10 :2 8.9 :3 7.8 :4 6.7 :5 5.6 :6 4.5 :7 3.3 :8 2.1 :9 1.0)] (vals sorted-m))

3:14 clojurebot: (10.11 9.1 8.9 7.8 6.7 ...)

3:14 devn: Does that work all the time? It's type is ValSeq.

3:14 Its*

3:18 AWizzArd: Yes, this works.

3:19 devn: a sorted map sorts its keys, so when you call vals it can be any result.

3:20 depends on the keys

3:20 ,(vals (sorted-map :a 5 :b 2 :c 17))

3:20 clojurebot: (5 2 17)

3:21 AWizzArd: Without this feature a sorted map would be mostly useless, because the random lookup of keys is for practical reasons nearly O(1).

3:31 Blkt: good morning everyone

3:33 amalloy: AWizzArd: i'm not quite clear on what you mean by the random lookup of keys being O(1)

3:37 AWizzArd: amalloy: (get a-sorted-map some-key) ==> this is +/- O(1) for maps, if they are sorted or not doesn't matter.

3:37 amalloy: no way. for sorted maps it's O(log2(n))

3:38 AWizzArd: Okay good, thanks for clarifying that.

3:38 amalloy: for hashmaps it's log32, which i agree is effectively constant given that the max size is 2^32

3:39 AWizzArd: Yes, I was thinking of Clojures hashmaps.

3:39 amalloy: yeah. clojure uses red/black trees for sorted maps

3:39 AWizzArd: But when the lookup for sorted maps is even more expensive then this underlines the point that I was trying to make: sorted maps deliver a sorted seq for the (keys of-a-sorted-map)

3:40 Otherwise this data structure would be useless, if even the lookup is already more expensive.

3:41 amalloy: do you know if there is a way to implement fully persistent sorted maps that have a lookup time closer to O(1)?

3:41 amalloy: i doubt it

3:42 you can't even do it with ephemeral maps

3:57 notostraca: AWizzArd, maybe Judy Arrays? they are a kind of trie

3:58 AWizzArd: notostraca: are Judies fully persistent, as the second paragraph here explains? http://en.wikipedia.org/wiki/Persistent_data_structure

3:58 notostraca: but they are mostly known by one implementation in C, 20,000 lines of C, though you can do it in under 1,000 i think

3:59 AWizzArd, absolutely they are not

4:00 AWizzArd: notostraca: so mvcc doesn't work on them I guess.

4:00 notostraca: AWizzArd, I believe it does

4:00 AWizzArd: I need something that can be modified while I traverse a snapshot.

4:01 notostraca: I have never tried a zipper myself

4:01 but that sounds like what you are talking about

4:01 ,google zipper data structure

4:01 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: google in this context, compiling:(NO_SOURCE_PATH:0)>

4:01 notostraca: no idea the syntax you want, clojurebot

4:18 kral: namaste

4:19 G0SUB: kraft: hello

4:27 amalloy: $google zipper data structure

4:27 lazybot: [Zipper (data structure) - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Zipper_(data_structure)

4:27 amalloy: notostraca: ^

4:29 notostraca: thanks amalloy

4:34 Raynes: G0SUB: I am not prejudice! Damn Indians, always thinking I'm prejudice. :p

4:34 G0SUB: Raynes: lol

4:35 Raynes: well, TBH, you expected people to tweet back at you and ask you to use emacs instead. that's prejudice :-)

4:36 Raynes: G0SUB: I'm pretty sure that you yourself did that when I tweeted a while back about my editor experimentation.

4:37 Which is the whole reason I tweeted that. :p

4:37 G0SUB: Raynes: I did. Unfortunately there is no well-established emoticon to denote a "tongue-in-cheek" comment.

4:37 Raynes: Hehe

4:37 G0SUB: Raynes: I see your point.

4:39 Raynes: Someone else has done that as well. I was just trying to avoid 10 "why not Emacs" tweets by morning, since I already use it and just like playing with editors.

4:40 G0SUB: Raynes: true. people are passionate about their tools and try to evangelise given any opportunity.

6:07 bpr: does anyone know if there's a fork of clj-http that allows you to accept unsigned ssl certs?

6:08 AWizzArd: bpr: which one are you using?

6:09 bpr: medSage

6:10 AWizzArd: well, i just forked it and i'm adding that functionality, but I was thinking that I shouldn't reinvent the wheel

6:10 AWizzArd: bpr I know the one from dakrone.

6:10 That one supports it.

6:10 bpr: oh nice

6:10 thanks, you just saved me some time :)

6:11 AWizzArd: The original author is mmcgrana.

6:11 bpr: oh

6:11 ok

6:11 AWizzArd: He now says himself to use the version of dakrone.

6:11 And in the dakrone version you can say :insecure true

6:11 bpr: ah. i seem to have a hard time finding the "real" version of libraries on github

6:11 AWizzArd: or :insecure? with a questionmark

6:11 bpr: great

6:12 AWizzArd: bpr: yes, there is this posting about the github forking model: t-machine.org/index.php/2012/01/13/2012-the-year-of-uncollaborative-development-or-when-github-kills-open-source/

6:12 bpr: yeah, i was just looking at that too haha

6:23 AWizzArd: bpr: you can also specify as an option: {... save-request? true ...}, which will give you the request object which was used by clj-http. Helpful for debugging.

6:23 jowag: where is destructuring handles in clojure? Is it in reader?

6:24 AWizzArd: And there is the option :debug true too.

6:24 jowag: *handled

6:32 G0SUB: bpr: dakrone is the canonical repository of clj-http now. mmcgrana mentions that on the github page.

6:35 bpr: AWizzArd, G0SUB: thanks

6:50 tsdh: Hi.

6:52 Does anybody know where I can find documentation about Clojure's JIRA issue procedure? For example, what are the "Fix Versions" Backlog, Approved Backlog, etc. meant for?

6:55 AWizzArd: tsdh: you typically want to add bug reports and feature requests to the 1.4 milestone.

6:56 When you click on “Versions” you will find a short description.

6:56 Though the description “Backlog” for the Backlog doesn't really add much information ;)

6:56 tsdh: AWizzArd: See. ;-)

6:57 Well, I only have a minor enhancement request + the patch implementing it. I guess, I'll say Backlog. Sounds somehow right...

6:59 Should I add myself as Assignee? Basically, I only need a review by some core team member...

7:00 I'll stick with automatic, whatever that means... :-)

7:03 AWizzArd: tsdh: when it is not your turn to review the issue, then assign the one who should do it.

7:03 tsdh: AWizzArd: How should I know who's responsible?

7:05 Hopefully, that's the intention of the Backlog. You add patches, and eventually some core team member picks them up and reviews them.

7:28 AWizzArd: tsdh: then leave the assignee unfilled.

7:42 tsdh: AWizzArd: Did so./

8:36 _carlos_: hi

8:43 bpr: _carlos_: heya

8:49 `fogus: OK. I am determined to roll out CLJS prop access syntax today even if it kills me (it will)

9:24 pjstadig: `fogus: doooooiiiiiiiittttt!!!!!

9:32 `fogus: pjstadig: Underway

9:32 pjstadig: BTW, I am ready to move to StadigOS. Please finish it post haste

9:33 jcromartie: is there any chance of continuations getting first-class support in Clojure?

9:34 `fogus: jcromartie: Vegas odds are very low

9:39 jimduey: jcromartie: I'd love to see that but don't think it'll happen on the JVM at least not until the JVM supports it.

9:39 and maybe not even then.

9:46 duck1123: are there any good ways to get Korma to retry a query in the event of a communications link failure? Or do I have to explicitly wire in retries

9:56 pjstadig: `fogus: you may be waiting quite a while :)

10:10 TimMc: `fogus: Only if it kills you temporarily.

10:10 Otherwise, where would we get our footnotes?!

10:14 WorldOfWarcraft: hey guys what is this question asking for me to do: (= (__ (sort (rest (reverse [2 5 4 1 3 6])))) (-> [2 5 4 1 3 6] reverse rest sort __) 5)

10:17 joegallo: my initial read: (= a b c) is true if a and b and c are all equal, so it wants you to fill in the blanks with expressions that will get you 5 for all three expressions

10:17 so, how do you get 5 out of the first expression and the second expression?

10:17 i'm not sure if it wants you to use the same exact function for each, though

10:17 WorldOfWarcraft: oh so last

10:17 ill try last

10:18 joegallo: that seems like a nice short answer

10:18 WorldOfWarcraft: hooray it worked thx for getting me started :)

10:18 joegallo: np, good luck with the rest of the problems

10:19 kral: WorldOfWarcraft: nice nick! :)

10:29 Fujitsu: Can anybody help me with this exercise? http://www.4clojure.com/problem/19

10:29 manutter: Fujitsu: sure

10:30 how much help do you want?

10:30 Fujitsu: Well, I tried using (reverse (first))

10:30 kral: WorldOfWarcraft: if only i could have back all the time wasted playing wow...

10:30 Fujitsu: but that didn't work...

10:30 WorldOfWarcraft: lol wasted noooooooo

10:31 no its (first (reverse))

10:31 wow is the best thing in the world its not wasted time

10:32 Fujitsu: WorldofWarcraft: That didn't work at all...

10:32 babilen: Fujitsu: Which makes sense.. you want the last element which is why you reverse it first and take the first element (formerly the last) afterwards.

10:32 WorldOfWarcraft: right

10:32 babilen: Fujitsu: You might want to understand why #(peek (vec %)) works

10:33 manutter: Fujitsu: he gave you the short version, but you need to make it an anonymous function to fit it into the exercise

10:33 Fujitsu: Oh

10:33 I see

10:33 Gotchya

10:33 WorldOfWarcraft: ok cool

10:34 babilen: manutter: "he" == I?

10:35 tvadakumchery: if there a way todefine an anonymous multimethod?

10:35 *is

10:36 babilen: I would be surprised, but don't take my word for it. (fairly new to clj)

10:36 tvadakumchery: not that it would be particularly useful, but still

10:36 I'm on 4clojure

10:37 and I'm trying to shorten my character count

10:37 WorldOfWarcraft: what problem is this?

10:37 stuartsierra: No, there are no anonymous multimethods

10:37 tvadakumchery: #128

10:37 manutter: babilen: no, wow

10:38 babilen: ack :)

10:41 stuartsierra: 1.4.0-alpha4 released

10:42 manutter: Sweet

10:43 tvadakumchery: speaking of that

10:44 how do I instal 1.3.0 on emacs

10:44 I have 1.2.0 running now

10:45 Fujitsu: more specifically clojurebox

10:45 tvadakumchery: Yeah

10:57 how do I instal 1.3.0 on emacs

10:59 gtrak: tvadakumchery: you should be using leiningen to manage projects, specify 1.3.0 in the project and emacs can connect to a swank server with slime-connect

11:10 aravart: Hey all. I had a quick question. Let's say I had a hash map {:a 1 :b 2} and I wanted to write a let-form where a and b got bound to 1 and 2, is there some way to do that dynamically for all the keys of a map (in other words, where I don't know at compile time what the map's keys will be)?

11:12 gtrak: if you don't know them at compile-time, you also won't know to use them in code within the scope, why not just keep them in a vector instead of generating a let?

11:16 joegallo: good answer

11:17 `fogus: aravart: you'll need eval for that

11:18 aravart: I have a little lib that does just that https://github.com/fogus/evalive

11:21 melipone: how can I upgrade to clojure.contrib 1.3.0? I'm using lein but I get an error with lein deps on that.

11:22 gtrak: ~contrib

11:22 clojurebot: It's greek to me.

11:22 jamiltron: There is no clojure.contrib in 1.3

11:22 http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

11:22 melipone: i know, but i don't understand it. what do I do now?

11:22 gtrak: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

11:23 melipone: I wanted duck-streams and priority-map

11:23 gtrak: "clojure.contrib.duck-streams mostly migrated to clojure.java.io"

11:23 jamiltron: duck-streams is mostly handled by clojure.java.io

11:23 ^ What he said :)

11:23 he or she

11:23 melipone: what about priority-map?

11:24 jamiltron: Migrated to clojure.data.priority-map

11:24 duck1123: usually what I do is go to clojuredocs and search for the fn I'm looking for, It'll usually show up as being in both the old and the new spot

11:24 melipone: duck1123: okay, I'll do that.

11:24 jamiltron: thanks

11:26 duck1123: also a quick scan down the clojure user page on github finds the library I'm looking for

11:30 melipone: duck1123: what's the url for the clojure user page on github?

11:44 raek_: melipone: https://github.com/clojure

11:51 melipone: raek: I've downloaded clojure.data.priority-map form github. What do I do now to have it installed on my machine?

11:57 raek: melipone: you most often don't download the source and build it yourself. it should already be available in a maven repo (assuming it is maintained and has been released. this is not the case for all new contrib libs)

11:57 melipone: first, do you know about leiningen

11:57 ?

11:58 melipone: raek: a little. clojure.contrib 1.3.0 is not available on a maven repo, tho?

11:58 raek: there is no clojure.contrib 1.3.0 (and will not be)

11:58 Intersession: Can anybody here help me out with http://www.4clojure.com/problem/26 ?

11:59 raek: melipone: you want to find the group id, artifact id and the version of the library. it should be something like [org.clojure/data.priority-map "0.0.1"]

12:00 for any mature library this should be the first thing mentioned in the readme

12:00 jamiltron: Intersession: Sure, what do you need help with?

12:00 Intersession: I just don't know where to begin....

12:01 manutter: Intersession: do you know how to make a lazy seq?

12:01 raek: melipone: so you add that line in your project.clj file and run "lein deps". then you should be able to just use it from that project

12:01 Intersession: Nope, lol

12:02 raek: melipone: this workflow is explained here (I recommend reading at least the first half): https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md

12:02 jamiltron: Intersession: do you know how to make a function that infinitely generates the fibonacci numbers?

12:03 Intersession: Jamiltron: No, I don't

12:03 raek: melipone: also this is quite useful when migrating a contrib-using project to 1.3: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

12:04 melipone: raek: I'm familiar with lein deps.

12:04 raek: lein deps didn't find org.clojure/data.priority-map though

12:05 manutter: Intersession: it's a bit old, but have a look at http://formpluslogic.blogspot.com/2009/07/clojure-lazy-seq-and-recursion.html

12:06 Intersession: if you know how lazy-seq's work, a fibo sequence is pretty easy to write

12:06 Intersession: manutter: Thanks, I definitely will :)

12:08 Out of curiosity, did anybody here learn clojure as their first programming language?

12:08 raek: melipone: what did you specify as a dep in your project.clj?

12:08 Intersession: Because I'm having a hard time with it, and it's the first programming language I've tried to tackle

12:09 raek: (note that I have no idea whether priority-map is actually ready to be used.)

12:09 jamiltron: Intersession: It takes time, you're doing good by getting practice like 4clojure in. My first language wasn't Clojure but it was a Lisp, and I certainly think Clojure is suited to be a good first-language.

12:10 raek: this seems to indicate that there is a version available though: http://repo2.maven.org/maven2/org/clojure/data.priority-map/0.0.1/

12:10 manutter: Intersession: you're the first person I've heard of who took clojure as their first programming lang

12:10 Intersession: I don't think there's a whole lot of material specifically geared to "Intro to Clojure for people who've never coded before"

12:11 Intersession: however I think with the right approach Clojure could be the best, or at least among the best, of any lang you could choose to start with

12:11 Intersession: I'm taking a crash course on clojure for my high school, but apparently I missed the "previous programming experience recommended" in the fine print

12:12 mabes: Intersession: this is a helpful tutorial if you haven't seen it already: http://java.ociweb.com/mark/clojure/article.html

12:13 Intersession: mabes: That seems... thorough. I'll take a look

12:13 TimMc: I think that's a little old.

12:13 mabes: Intersession: Yeah.. it is a little dated, and is geared more to an experienced programmer.. still worth the read though.

12:14 e.g. it talks about clojure-contrib

12:15 manutter: I was thinking about putting together a VirtualBox image of a system already set up for Clojure/emacs/NetBeans/etc, but I wouldn't know where to host an image that big

12:16 TimMc: manutter: clojars :-P

12:16 manutter: Heh :)

12:16 duck1123: man, I envy Intersession. Programming has got to be so different coming to Clojure with a completely clean slate

12:19 tmciver: duck1123: yeah, I was thinking the same thing.

12:20 devinus: anybody in here use protobuf or thrift?

12:20 TimMc: I dunno about Clojure as a first language -- you *have* to poke around in Java from time to time, and that's confusing. Better to have Scheme as a first lang, I think.

12:20 tmciver: Intersession: I recommend just getting a good book on Clojure, if you haven't already done so. Programming Clojure by Halloway is good, though a little dated now.

12:21 TimMc: what about Java -> Clojure?

12:21 manutter: Intersession: Another good book is Clojure in Action, a bit more recent

12:22 tmciver: I almost feel like it would be better to start with a non-functional programming so you can better see the virtues of it.

12:22 manutter: Though I hear there's a new edition of the Halloway book either coming soon or recently released

12:22 tmciver: Heh, start with PHP, you'll REALLY appreciate Clojure

12:25 TimMc: tmciver: I feel like Scheme allows you to focus on the important stuff first, then broaden your scope to implementationy stuff.

12:25 tmciver: e.g. no one needs to be focusing on 1/5 vs. 1/5.0 while they're learning their first language.

12:25 duck1123: You don't really appreciate modern languages unless you start by numbering your lines by 10. (started with Atari Basic)

12:26 jamiltron: TimMc: I agree with that, as someone who started with Scheme.

12:26 TimMc: and the REPL is essential for exploration

12:28 dnolen: tmciver: I'm not sure that's true. mutable variables fly in the face of basic math taught in schools.

12:28 TimMc: Oh yeah, that definitely confuses newcomers.

12:32 flazz: i have clojure and repl installed via brew. any reason readline seems to not work anymore?

12:38 melipone: raek: I probably didn't have the right name or the right version, he?

12:39 raek: I couldn't see what the right version of clojure.data.priority-map was until after I ran mvn install. Where is the version specified?

12:41 raek: unless it's on clojars, I'm completely lost on where to find the libraries

12:47 dnolen: flazz: installing clojure via brew is not a great idea, just use lein.

12:48 flazz: dnolen: is there a way to use lein without a project for a repl?

12:48 dnolen: flazz: lein repl

12:48 flazz: duh, sorry/thanks

12:48 :)

12:48 i should just get used to emacs

12:48 `fogus-away: OK, I'm about to break ClojureScript... ready?

12:51 TimMc: yay

12:59 ljos: Hi - is there a map similar to this : (map #(f %1 %2) l1 l2) where %1 becomes the element in l1 and %2 is l2. %1 %2 is the same placement in each list.

13:00 mrBliss: this one: ##(map + [1 2] [10 100])

13:00 lazybot: ⇒ (11 102)

13:00 dnolen: `fogus: hurrah!

13:00 mrBliss: so just map ;-)

13:01 ljos: Oh. I understood that map didn't do that but something else when there where two lists.

13:01 Thanks.

13:02 _carlos_: hi

13:03 why is "partial" name used for a function that returns, say HTML?

13:04 TimMc: _carlos_: partial doesn't have anything to do with HTML -- you'd have to provide context.

13:05 _carlos_: TimMc: that is why I said "say", like an example. in the context of Noir. probably hiccup

13:06 amalloy: he probably means defpartial

13:06 TimMc: Oh!

13:06 _carlos_: amalloy, TimMc, yes I am sorry. I mean "partial" from defpartial

13:06 TimMc: _carlos_: I thought you were talking about ##(map (partial + 2) [5 9])

13:06 lazybot: ⇒ (7 11)

13:07 amalloy: *shrug* it returns "part of a page". there's no deeper meaning

13:07 TimMc: What API is it part of? hiccup?

13:07 amalloy: noir

13:08 `fogus: http://groups.google.com/group/clojure/browse_frm/thread/9367b4d6ed4bc96b

13:08 Announced

13:08 Now to ClojureScript One

13:08 _carlos_: TimMc: Noir. I said also hiccup, because I suspected Noir is using it, but not sure

13:12 amalloy: partial is cool!

13:13 seancorfield: _carlos_: tell amalloy juxt is cool and you'll have a friend for life :)

13:13 amalloy: haha

13:13 seancorfield: i'm actually surprised how often i use juxt...

13:16 technomancy_: does 4clojure only score by char count rather than token count?

13:17 amalloy: technomancy: yes

13:18 token count is easy to compute but harder to explain, and none of us were clever enough to make a graph that combines the two results

13:19 dnolen: `fogus: sweet

13:32 priv_cooper: Are there any lein plugins for auto code reloading?

13:32 As in, the equivalent to "lein run" every time a file is saved?

13:33 Or, lein plugin or not, what would be the best way to achieve this?

13:33 technomancy: priv_cooper: usually that's achieved through editor integration

13:34 manutter: Noir does that by default, doesn't it?

13:34 Depends on what you're re-running

13:34 priv_cooper: manutter: Not building a web app

13:34 :)

13:34 manutter: Ah well, worth a shot :)

13:34 priv_cooper: Hmm..

13:34 I use vim :/

13:35 manutter: jark might help?

13:35 Are you in a unix/linux environment?

13:36 priv_cooper: Yeah, osx

13:37 manutter: Hmm, ubuntu has a watch command, but I don't think osx does

13:38 emezeske: priv_cooper: Are you using vim-clojure or slimv?

13:39 priv_cooper: I believe both plugins support sending the current file to a repl

13:39 priv_cooper: emezeske: Ahh, I need to check these out

13:39 emezeske: priv_cooper: You could easily set up a "file saved" hook that did that

13:39 priv_cooper: I believe I have vim-clojure setup.

13:39 emezeske: priv_cooper: I personally use vim-clojure, it is very nice

13:40 jowag: does vim have paredit-like mode?

13:40 emezeske: jowag: The slimv plugin has that.

13:40 Although I ripped it out of there so I could use it with vim-clojure :)

13:45 technomancy: babilen: have you updated clucy to fix the ^:dynamic warnings in 1.3?

13:53 babilen: technomancy: Yes

13:54 technomancy: babilen: is it ready to merge or do you have more work to do?

13:54 babilen: technomancy: Along with an update to lucene 3.5.0 and other things -- I'll push it to GH as soon as I am happy.

13:54 technomancy: very nice; thanks.

14:01 jsabeaudry: What are the good libraries for working with binary data? I've seen bytebuffer and Gloss but are there more?

14:06 anntzer: hi, is there an easy rule as to when arguments to :use/:require/:refer/use/require/refer need to be quoted? (at least it's unclear for me)

14:07 `fogus: I think I have both Domina and CLojureScript One migrated to the property lookup functionality. That was almost too easy. :p

14:07 technomancy: anntzer: the ns form is declarative, so no quoting there. the repl versions of the functions are lower-level and require quoting

14:08 anntzer: ook

14:09 TimMc: `fogus: Any idea when cljs leaves alpha?

14:10 `fogus: TimMc: Not sure. Once we have our release process in place it'll be more clear.

14:10 TimMc: Ah, right -- still no artifacts.

14:10 anntzer: also, it seems that there is a problem with circular dependencies if declared in (ns), but not using the low-level functions?

14:11 (I had a nullpointerexception when the circular dependency was in the ns but it disappeared when I moved one of the "use"s out of the ns)

14:11 is that correct?

14:12 jsabeaudry: anntzer: My reflex would be to remove the circular dependency

14:12 jowag: `fogus: btw is accesing deftype fields with (.-field t) idiomatic in CLJS?

14:12 dnolen: anntzer: circular deps are not allowed

14:13 jowag: yup

14:13 `fogus: what dnolen said

14:13 jowag: thank you

14:14 and what about persistent collections, are they on a roadmap?

14:15 I have to be carefull where I use dis/assoc now :)

14:15 and it's more performant to have atoms allover the place rather than have one megaatom

14:15 ibdknox: `fogus: didn't know about as-this :) That'll be fine

14:17 `fogus: ibdknox: Excellent!

14:20 ibdknox: jowag: you've profiled that?

14:21 jowag: ibdknow: yep, assoc/dissoc is doing shallow array copy

14:21 TimMc: But have you profiled it?

14:22 jowag: yes :) in chrome, had 25ms and got it down to 12ms in my keyboard input handling fn

14:23 profiled with advanced compiler turned on

14:23 TimMc: Factor of 2? Yeah, that's significant.

14:23 amalloy: in a single-threaded language like javascript, isn't an atom just a simple mutable variable?

14:24 heh, yes, looks like it is

14:24 devth: what regex would match a mixed line ending character ^M in clojure?

14:25 amalloy: well, #"\r" would, but i doubt that's what you mean

14:25 TimMc: I *think* \n is cross-platform.

14:25 devth: I was using #"\n" but it didn't seem to match. I'll try \r

14:26 amalloy: &(re-seq #"\n" "\r\n")

14:26 lazybot: ⇒ ("\n")

14:26 amalloy: &(re-seq #"[\r\n]" "\r\n")

14:26 lazybot: ⇒ ("\r" "\n")

14:26 TimMc: I always forget if ?m is important here...

14:27 emezeske: I hope \n isn't auto cross-platform

14:27 Tcl tried making newlines all cross-platformy, and it was a nightmare

14:27 Always doing subtle things you didn't expect

14:28 TimMc: I might have been thinking of another language.

14:28 emezeske: (Tcl maybe? Although nobody uses that.)

14:29 TimMc: Not that. :-)

14:32 technomancy: quick survey: what are your top lein tasks?

14:32 history | grep lein | awk '{print $3}' | sort | uniq -c | sort -nr | egrep -v "^ +1"

14:32 _carlos_: in noir: when I remove [noir.content.getting-started] from welcome.clj, the home page doesn't render and a java exception is thrown. how do I enable the server to point to the content described in welcome.clj?

14:33 ibdknox: _carlos_: did you define /

14:33 _carlos_: or is it only /welcome

14:33 jcromartie: repl

14:34 amalloy: technomancy: i don't think that's very accurate, simply because history files don't work very well when multiple sessions/shells are open. my history alleges i've never run lein swank, despite that being my most common

14:34 jcromartie: technomancy: repl is the winner

14:34 dnolen: jowag: it could probably be done but I wouldn't expect performance to be acceptable outside the fastest JS engines.

14:34 _carlos_: ibdknox: no, just a second

14:34 technomancy: amalloy: yeah I don't expect swank to show up in there anyway due to M-x clojure-jack-in

14:34 amalloy: i don't do that though

14:34 technomancy: definitely not scientific, but interesting.

14:34 ibdknox: _carlos_: if you update to noir 1.2.2 that exception will no longer happen and you'll get a 404

14:35 technomancy: amalloy: right; just saying there's lots of reasons not to trust it =)

14:35 amalloy: *chuckle*

14:35 anyway, apparently: deps, protobuf, self-install

14:36 jowag: dnolen: but it would't have worse performance than it has now, right?

14:36 manutter: lein upgrade, lein test too

14:36 _carlos_: ibdknox: how do I clean the cache withou restarting the server?

14:37 ibdknox: _carlos_: the cache?

14:37 _carlos_: just refreshing your browser should work

14:37 TimMc: technomancy: I run repl all the time on my work machine, but I leave one open on my home server.

14:38 _carlos_: ibdknox: I just removed that getting-started and it still loads that page. refreshing the page and cleaning cache doesn't work. I know restarting the server will work, but it's not practical

14:38 tmciver: technomancy: repl, new, swank, help

14:38 ibdknox: _carlos_: it can't knowingly remove a page, but it can replace it just fine

14:38 tmciver: deps

14:39 technomancy: cool; thanks

14:39 jowag: dnolen: Even if JS does not have such concurrency problems as JVM has, I try to have most of my functions pure and mutate only through atoms in a very few places, so I'm producing lot of garbage right now.

14:39 ibdknox: _carlos_: in other words, the only time you have to restart is if you completely remove a page and expect it to 404

14:40 dnolen: jowag: for small amounts of data - persistent data structures aren't a huge win. remember Clojure data types are generally constructed in sizes of 32

14:42 jowag: what type of code are you writing? 15ms sounds like a lot of time for anything.

14:43 _carlos_: ibdknox: grr.. only after I restarted the server it worked.. -.-' yes, I had to set a "/" like you said. thanks! still, it would be nice to know why the page wasn't refreshing. restarting everytime is not practical

14:43 ibdknox: _carlos_: you don't need to restart

14:43 _carlos_: one potential reason why it may not have worked is if reloading the given code throws an exception

14:43 _carlos_: ibdknox: yeah, of course, but I still have to find out why this is happening

14:44 ibdknox: ha yes, it was throwing this: java.lang.IllegalStateException: GET-- already refers to: #'noir.content.getting-started/GET-- in namespace

14:44 ibdknox: this even after removing the getting-started line

14:45 ibdknox: anyways, probably this wont happen often. thanks!

14:45 clojurebot: excusez-moi

14:46 ibdknox: _carlos_: np

14:46 jowag: dnolen: some kind of an editor :) 15ms is good but I have to keep an eye on it that it won't go up or else it lags

14:46 acagle: 50 deps 42 help 24 search 20 swank 6 jar 5 upgrade 5 noir 4 localrepo 3 version 3 new

14:46 devth: amalloy: TimMc: not sure why, but I could only match with #"\cM". even #"\r?\n?" did not match.

14:47 solussd: why does this cause an integer overflow? (take 100 (iterate #(* 2 %) 1))

14:47 TimMc: solussd: Try *'

14:47 1.3 stopped autopromoting to BigInt(eger) with normal arith ops

14:47 solussd: really? why?

14:47 _carlos_: can someone add some cool sentences for lazybot in japanese? it's so cool! or nevermind

14:48 TimMc: I don't think there's a whole lot of demand...

14:50 solussd: Seems it should be the other way around- if I want efficiency I should go out of my way- correctness should be default

14:50 TimMc: technomancy: 72 repl, 54 run, 29 deps, 22 new, 6 uberjar... but I suspect that last one will change quite a bit after my lein-jit terminal is closed and its history absorbed.

14:51 Also, I just don't believe that I've only run deps 29 times.

14:51 technomancy: TimMc: yeah, having multiple shells makes history very lossy

14:51 rabbler: solussd: I agree with you, I can see how that could be a big issue if upgrading clojure and now you start getting a bunch of exceptions you never got before. Perhaps you could rebind the non-promoting to the promoting versions in you code.

14:52 but I am still very green when it comes to clojure.

14:53 _carlos_: haha, I can see pain in the future and some rvm coming into spring

14:54 TimMc: rabbler: That's not enough -- range uses + directly, for instance.

14:54 _carlos_: cvm - clojure version manager ^^

14:55 rabbler: Ahh.

14:55 _carlos_: rabbler: wait, I don't know if this exists really...

14:56 gtrak: but range still promotes, yea?

14:56 TimMc: gtrak: Nope!

14:56 &(take 5 (range Long/MAX_VALUE Double/POSITIVE_INFINITY))

14:56 lazybot: java.lang.ArithmeticException: integer overflow

14:59 raek: &(take 5 (range 9223372036854775807N Double/POSITIVE_INFINITY))

14:59 lazybot: ⇒ (9223372036854775807N 9223372036854775808N 9223372036854775809N 9223372036854775810N 9223372036854775811N)

14:59 gtrak: well, my opinion is if you are relying on unbounded input, you should use promotion, in the majority of cases, you're not?

15:00 raek: if any argument of an arithmetic operation is a BigInt, then the result will be a BigInt too, I think

15:01 gtrak: I think I remember reading that it made substantially more code faster than the code it broke

15:02 solussd: ill buy it

15:02 amalloy: _carlos_: cvm doesn't make any sense for clojure. lein already handles that part of the equation

15:02 solussd: I guess it is safe, since it at least throws an exception

15:03 amalloy: (because, unlike ruby, clojure doesn't want to be installed system-wide, or even user-wide)

15:03 gtrak: it looks like clojure still promotes ints to longs and floats to doubles

15:04 _carlos_: amalloy: I have to think about those sentences. I have to go now, if I still don't undertsand, I will look for your nickname here. thanks!

15:04 amalloy: gtrak: clojure does arithmetic with 64-bit quantities

15:05 gtrak: amalloy: so it ALWAYS promotes?

15:05 amalloy: &(class (short 1))

15:05 lazybot: ⇒ java.lang.Short

15:05 amalloy: &(class (int 1))

15:05 lazybot: ⇒ java.lang.Long

15:06 gtrak: documentation says "Clojure will seamlessly promote ints to longs and floats to doubles as needed"

15:06 not whenever it feels like it :-)

15:07 amalloy: it's a complicated topic that has been in flux from 1.2-1.4

15:07 gtrak: ah, but it gets boxed to be used by 'class'

15:07 amalloy: right

15:08 TimMc: Clojure functions only accepts objects, yeah?

15:09 gtrak: primitives too if you do it on purpose with hints AFAIK

15:09 dnolen: gtrak: my mental model - Clojure basically only has 64 bit numerics. anything else is interop.

15:09 TimMc: gtrak: up to 4 arguments.

15:10 TimMc: oh right, I've seen that

15:10 gtrak: dnolen: yea, that makes sense, probably because there's no perf gain for 32-bit math on 64-bit chips. why 4 args?

15:10 dnolen: gtrak: because interfaces are generated to support it. exponential in the number of args.

15:11 amalloy: gtrak: because 4 args require 273 interfaces, and 5 require 342749823615

15:11 gtrak: oh, gross

15:11 are you serious? it generates 273 classes for that?

15:11 amalloy: yes. check out IFn.java

15:11 TimMc: gtrak: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IFn.java#L91

15:12 gtrak: omg, that's awesome, I hadn't looked at the 1.3 IFn

15:12 TimMc: "static public interface LOL"

15:12 ibdknox: /win

15:12 replaca: dnolen: Interfaces or signatures?

15:12 dnolen: replaca: interfaces

15:12 replaca: wow

15:12 amalloy: apparently 358. i misremembered

15:12 TimMc: dnolen: I see 5 in IFn

15:13 Ah, one is return

15:13 amalloy: TimMc: return type

15:13 dnolen: this is of course all old news

15:13 like 1.5 years old

15:13 TimMc: Yeah, never really investigated it though.

15:13 gtrak: i need to follow the dev list more closely

15:13 replaca: yeah,, I just don't look that closely at how the sausage is made :)

15:21 guns: Hello, is there a convention regarding the capitalization of `foo` in (require '[some.ns :as foo])?

15:22 Raynes: Never ever doing it is the convention.

15:22 guns: What's problematic about it? Seems better than a straight up (use)

15:24 I'm just wondering if capitalization of symbols is supposed to be reserved for Java classes

15:24 amalloy: never capitalize it, not never require

15:24 guns: oh

15:25 ok ty

15:26 replaca: guns: yeah, in general folks will read capitalized syms as Java classes/interfaces.

15:26 hiredman: (Foo/bar 1 2) looks like a static method call

15:27 amalloy: guns: the only clojure things we capitalize are types (as in deftype/defrecord) and protocols (which generate interfaces of the same name)

15:27 TimMc: guns: It will mess up your editor's syntax highlighting. :-)

15:27 and your readers

15:27 guns: amalloy: ah, that's helpful

15:27 TimMc: my vim setup doesn't seem to mind; too primitive I suppose

15:28 TimMc: Yeah, depends on the highlighter.

15:59 amalloy: siiiiigh, i hate when i find i've written ten lines of code, including writing out three lines twice. so i figure out a way to condense it into eight lines with no duplication at all, and (as expected) at the end i look at it and am like..."that's too confusing, there's no way i'd want to read that. i'll go back to the lame way"

16:00 technomancy: amalloy: the worst part about that is you know that someone else is going to do the exact same thing when they're looking over it three months in the future.

16:00 s/else //

16:00 because it will probably be you

16:00 amalloy: technomancy: aw man, sniped my fix

16:00 technomancy: hah

16:01 amalloy: you should come join #leiningen

16:01 it's the hip place to be

16:01 amalloy: i'm in too many dang channels. you better make this worth my while, buddy

16:02 technomancy: rcirc has this cool feature where you can put someone on notification-ignore

16:02 you still see their lines in the channel, but when they speak it doesn't cause the client to consider that channel as having unread messages

16:03 anyway, if your client has something like that you should use it for the travis-ci bot.

16:03 because he's noisy

16:03 well, he's noisy when I'm not lazy

16:06 amalloy: that sounds nice. maybe i'll look for a decent client one of these days

16:06 technomancy: you're not on irissi, are you?

16:07 (you don't have to answer that question if it's embarrassing.)

16:07 amalloy: no, but i'm not allergic to perl either

16:08 no, it's cool. i tell people i use pidgin, and i refuse to be embarrassed

16:09 a bit of "comfort food", if you will, from my "use windows but kinda wanna be a hacker" days

16:10 technomancy: sometimes it's OK to follow your heart.

16:11 Raynes: technomancy: It is NOT okay to use Pidgin for IRC.

16:11 It just isn't.

16:12 foodoo: Now that the topic is up: What kind of IRC clients do you use? I use irssi

16:12 technomancy: Raynes: http://www.youtube.com/watch?v=lYMRsngqPAc I guess

16:12 jsanda_afk: sorry, my irc client froze up

16:13 technomancy: foodoo: I just switched to rcirc from erc.

16:13 Raynes: I use ERC when I use Emacs. I've been using Textual for the past two days because I'm using Vim.

16:14 ibdknox: I use LimeChat

16:14 Raynes: But now that technomancy is using rcirc, I probably will to. He's mah role model.

16:14 foodoo: dammit, I'm a Vim user so rcirc and erc are not an option for me ;)

16:14 ibdknox: he's everybody's role model ;)

16:14 Raynes: ibdknox: Textual is better than LimeChat.

16:14 ibdknox: how so?

16:15 technomancy: there are a couple things I miss about erc, but the fact that I can have join/part hiding active for idlers only is pretty rad.

16:15 Raynes: Because I use it.

16:15 The whole client is based on LimeChat and designed to suck less.

16:19 scottj: riece is an interesting emacs irc client that has a feature that appears to be designed for users who are in many non-active channels in that you have one window for your current channel and another for all the others.

16:21 `fogus: Tales from the CLJS migration trenches ---> http://groups.google.com/group/clojure/browse_frm/thread/9367b4d6ed4bc96b

16:22 ibdknox: `fogus: does it break doing (set! some.thing.blah 4)?

16:22 `fogus: ibdknox: no

16:23 ibdknox: cool

16:23 `fogus: ibdnox: Only (set! (.old-prop-style obj) 42)

16:24 ibdknox: `fogus: yeah. I'm glad this is finally out :) I can stop worrying about it now.

16:24 `fogus: ibdknox: me too ;-)

16:25 ibdknox: dnolen, `fogus: thanks for the effort!

16:25 `fogus: :-)

16:26 dnolen: glad it's over with, onward!

16:26 `fogus: yay!

16:26 I'm going to get a drink now. ;-)

16:27 ibdknox: haha enjoy

16:27 `fogus: se ya at Clojure West. :-)

16:30 foodoo: is this information still current? https://github.com/clojure/clojurescript/wiki/Quick-Start ./bin/cljsc hello.cljs '{:optimizations :advanced}' > hello.js produces a JS file that does /not/ define the goog object.

16:31 and therefore my browser complains

16:32 amalloy: technomancy: guess what other client gives you join/part hiding for idlers only

16:32 technomancy: surely not pidgin?

16:33 amalloy: sorry to break it to you, but it's pidgin

16:33 technomancy: mind: blown

16:33 I hate using programs that don't have a repl, but I actually do keep pidgin open because it's the only thing I've found with decent libjingle support.

16:34 TimMc: whatever that is

16:34 technomancy: TimMc: voip that doesn't crash all the time

16:34 it's what google talk uses

16:35 TimMc: got it

17:06 augustl: hi folks. Trying to find out how to make noir/compojure/ring do asynchronous/concurrrent things, but failing

17:06 I'm new to clojure, but it would seem sensible to be able to, say, return an actor in a route, but it seems all I can do is to synchronously return a string/map

17:08 perhaps these frameworks perform every request in a single thread already, so it doesn't matter if I'm being synchronous?

17:10 s/in a single thread/in a separate thread/

17:11 dnolen: augustl: those libraries are already concurrent (because of jetty). is there something else you're trying to accomplish?

17:12 augustl: dnolen: currently not trying to accomplish much, other than grokking how these things work :)

17:12 dnolen: augustl: I believe aleph provides an async http server (on top of netty) that conforms to the ring spec

17:12 augustl: I'm a jvm noob as well, that doesn't help I guess.

17:13 dnolen: augustl: I'm assuming you're coming from the node.js world :)

17:13 augustl: rails, then node, some iOS, then a whole lot more node :)

17:13 you'd think I'm some kind of a hipster

17:14 vijaykiran: What does "In traditional Lisp, only the list data structure is structurally recursive" mean ?

17:14 yoklov: traditional lisp only has lists

17:14 vijaykiran: which is related to clojure "Extends the code-as-data paradigm to maps and vectors"

17:15 yoklov: which is defined as the first element (the ``car'') attached to the list of the rest of the elements

17:15 (the ``cdr'')

17:15 car and cdr are weird terms that refer to outdated technology.

17:15 but a list is defined as the first element attached to the list of the rest of the elements

17:15 which is structually recursive

17:16 augustl: does it make sense to say that most APIs in clojure are blocking/synchronous, then threads are used for concurrency?

17:16 yoklov: vijaykiran: finally, it will end with the empty list, nil (or, in scheme () or null)

17:16 does that make sense?

17:17 dnolen: augustl: pretty much, though again, you do node.js like things with Netty / aleph

17:17 augustl: in anycase unlike node.js real multithreading programming is possible - and not too scary.

17:17 amalloy: augustl: to clarify/simplify what dnolen said: clojure's popular web servers do service each request in its own thread

17:17 vijaykiran: yoklov: thanks .. yes. But the second statement - clojure extends the code-as-data to maps, vetors - means they are also seqs ?

17:19 augustl: amalloy, dnolen: I see. Makes sence, since threading apparently is both simple and easy in clojure

17:19 sense*

17:19 brehaut: augustl: its also fairly trivially to turn a blocking function into a nonblocking function, but going the other direction requires a bit more work

17:20 amalloy: i don't think i would allow the word "trivial" to be used anywhere near those sentences

17:21 brehaut: lol

17:21 yoklov: clojure provides literals for vectors (e.g. [1 2 3 4]), maps (e.g. {:a 1 :b 2 :c 3}) and sets (e.g. #{:a :b :c :d}) as well as lists, all of these implement seq, meaning that you can use the seq functions (conj, first, next, rest, etc) on them.

17:21 err

17:21 that was directed at vijaykiran

17:21 amalloy: you can take a blocking function and run it in a future; that much is easy. but actually taking advantage of that and not breaking the rest of your app...

17:22 brehaut: amalloy: i was just talking about that at the level of a single function call, not the whole app

17:22 the equivalent promise / deliver setup for going the other direction is a bit clunkier

17:23 * technomancy finally watches the cljs launch video

17:24 vijaykiran: yoklov: ok .. got it! thanks!

17:25 yoklov: no problem! i used to TA a course on scheme so i've explained lists many many times :)

17:26 amalloy: technomancy: spoiler alert: you can compile clojure to javascript

17:26 and since clojure and javascript each rock independently, this necessarily will rock in concert

17:26 TimMc: amalloy: You can compile *clojurescript* to javascript.

17:27 and cljs looks like clj

17:27 scottj: technomancy: did you have some code that let you pick a user agent from a list in conkeror?

17:27 vijaykiran: brehaut: (assuming you are guy who wrote) thanks for the article .. http://brehaut.net/blog/2011/ring_introduction inspired me to bootstrap my web dev post http://www.vijaykiran.com/2012/01/11/web-application-development-with-clojure-part-1/

17:27 brehaut: vijaykiran: i am, thanks :)

17:29 * TimMc waits for more jokes to get all pedantic on

17:35 yoklov: nice going TimMc, now everyone is too afraid to talk.

17:35 * TimMc lurks o\___/o

17:35 TimMc: OK, heading home, everyone can talk now.

17:43 technomancy: amalloy: you're saying that rockingness is composable?

17:44 scottj: https://github.com/technomancy/dotfiles/commit/2904fe4868d6254820b1c2519d85327158df4394#.conkerorrc

17:44 scottj: beware though, if you claim to be FF or chromium, the google search results page becomes unusable

17:44 just starts stealing keystrokes left and right

17:45 OTOH mobile.twitter.com becomes a lot more pleasant

17:45 is it just me, or does "ditch jquery for gclosure in order to use clojurescript" sound an awful lot like "learn emacs in order to learn clojure"? as far as advice goes?

17:45 scottj: technomancy: yeah, I've noticed the annoying google page when I tried to fix the weird o's in Google on conkeror page

17:46 ibdknox: technomancy: yeah :(

17:46 amalloy: technomancy: yes. it's way easier to just use jquery and not enable advanced optimizations

17:46 ibdknox: amalloy: jQuery doesn't prevent advanced optimization, we need to stop telling people that :p

17:47 amalloy: really?

17:47 well stop telling me that, then

17:47 technomancy: "That thing you are really familiar with that has a technically-superior alternative? Yeah, you're going to want to get rid of it. This other thing is way better."

17:47 ibdknox: I said that?

17:47 amalloy: no, not you specifically

17:47 ibdknox: ah

17:47 yeah

17:48 it will prevent jquery names from being munged, but properly wrapped that happens exactly once per name

17:48 if you're trying to optimize size to that degree, you're probably doing it wrong

18:01 technomancy: is anyone using swank with cljs-one?

18:02 swank kind of assumes you aren't going to be doing insane things like script/setup_classpath

18:04 * technomancy pinches his nose and runs inferior-lisp

18:04 Raynes: technomancy: Do you have some kind of insatiable urge to do *everything* in Emacs?

18:05 augustl: hmm, noir seems to use a lot of side effects, such as cookies being set with (session/put! ...)

18:05 emezeske: Raynes: isn't that a trait of all emacs users?

18:05 augustl: is that bad?

18:05 ibdknox: Raynes: technomancy *us* emacs

18:05 meh

18:05 is rather

18:05 yoklov: yeah thats just an emacs user thing

18:05 Raynes: augustl: Web development is a side-effecty thing.

18:06 ibdknox: augustl: try the alternative, it's painful

18:06 augustl: Raynes: true that, I'd imagine a more clojure-esque soltion would simply be to return something

18:06 Raynes: augustl: Setting sessions inside of a highly isolated environment is okay imo, especially when the alternative is insane code for something that should be easy.

18:06 technomancy: Raynes: inferior-lisp is in emacs too

18:06 it's just gross

18:06 augustl: {:cookies {:foo "bar"}, :body "test} or whatever

18:06 Raynes: You can do that if you want.

18:06 technomancy: http://penny-arcade.com/comic/2005/06/06

18:06 augustl: Raynes: in general, or in Noir?

18:06 ibdknox: augustl: both

18:06 Raynes: Both.

18:07 technomancy: s/have a regular DVD player/use a repl via a shell command/

18:07 Raynes: Noir's stateful session is a layer on top of existing session infrastructure in ring.

18:07 ibdknox: augustl: But I can tell you from experience that that adds an immense amount of complexity for literally no benefit

18:07 Raynes: Same with cookies.

18:07 augustl: hmm, is this documented somewhere?

18:08 ibdknox: augustl: "Alternatively, you can return a map with keys that correspond to the Ring spec. Here's an example of returning a response with a different status code:"

18:08 augustl: http://www.webnoir.org/tutorials/routes

18:08 augustl: hmm, can't seem to find anything about setting cookies in there

18:09 oh

18:09 ibdknox: augustl: why do you want to, though?

18:09 augustl: ibdknox: not currently writing an application, just exploring a bit

18:10 ibdknox: the reason I don't talk about it in the docs is because it doesn't work very well

18:10 even before Noir there was sandbar which made sessions stateful

18:10 Raynes: Not using stateful sessions is like a one night stand. It feels really good at first, but you're gonna hate yourself in the morning.

18:10 ibdknox: lol

18:11 augustl: Raynes: what exactly do you mean by stateful sessions?

18:11 Raynes: uggtghtgbhrh WHAT HAVE I DONE TO MY CODEEEE!?!?!

18:11 That's what we're talking about here.

18:12 augustl: so stateful sesions == storing data in cookies?

18:12 ibdknox: hm?

18:12 augustl: or do you mean storing additional session data on the server?

18:12 ibdknox: they're intrinsically tied

18:13 the way a session is stored is by setting a session id cookie for the user

18:13 augustl: hmm, good point, it's refering to data on the server

18:13 ibdknox: sessions are inherently stateful things, as are cookies

18:13 yoklov: use continuations!

18:13 ibdknox: you're storing some state to later be read (and usually modified)

18:13 Raynes: Monads are like burritos!

18:13 augustl: are ring cookies signed btw? Doesn't seems so according to the docs.

18:14 ibdknox: Noir has a way to sign cookies

18:14 Raynes: I like to use a pen.

18:14 augustl: :D

18:14 http://www.webnoir.org/tutorials/sessions doesn't mention signing either

18:15 ibdknox: augustl: not many people have asked about it

18:15 and it's not generally something a beginner needs to know

18:15 augustl: it makes sense that you can't simply set the data of the cookie to an arbitrary user ID..

18:15 Raynes: Those tutorials are kind of a getting started sort of thing and less of a "this explains EVERYTHING" sort of thing.

18:15 The API docs explain ALL the things.

18:15 ibdknox: augustl: http://webnoir.org/autodoc/1.2.1/noir.cookies-api.html

18:15 augustl: but then I have to learn how it works :)

18:16 ibdknox: augustl: you don't store sensitive info in cookies usually

18:16 augustl: ibdknox: indeed, but when storing the users ID for authenticatino, you do want signing

18:16 amalloy: augustl: ring cookies are just a session-id; all the important data is stored server-side in a map keyed by the session-id

18:17 augustl: oh, didn't know that, I thought setting session data just meant storing that data directly in the cookie

18:17 amalloy: someone sniffing the network could steal the session-id and claim it as their own afaik, but they could do that with a signed cookie too

18:18 ibdknox: sorry, I thought I made that clear earlier

18:18 augustl: amalloy: right if they get the contents of the cookie they own the session

18:18 amalloy: but ideally that won't happen (https yay)

18:18 ibdknox: no real data should ever be stored in a cookie

18:18 amalloy: indeed

18:18 augustl: but it would be a shame if all it took was storing the value "1" in the cookie to log in as user with id 1 :)

18:18 Raynes: I only store fake data in my cookies.

18:18 ibdknox: me too

18:19 amalloy: Raynes: #clojure's expert on one night stand psychology?

18:19 augustl: storing a session ID only is more security than obscurity

18:19 I don't know what the session ID looks like but I have a feeling it's easier to guess than a signature..

18:19 ibdknox: it's a high entropy uuid

18:19 amalloy: augustl: ring has configurable cookie storage backends, though

18:19 Raynes: amalloy: I guess I'm just not great at metaphor.

18:20 amalloy: there's a backend which uses a private key or something to encrypt (not sign) the cookie data and send it across to the client

18:20 ibdknox: augustl: either way, you can easily set the session cookie options and make it http only

18:20 augustl: where is this documented? Not here, it seems http://mmcgrana.github.com/ring/ring.middleware.cookies.html

18:20 ibdknox: augustl: where is what documented?

18:20 Raynes: amalloy has a mongo-session for storing session data in mongodb. It's the best thing ever.

18:20 amalloy: documented in "read the source" mode, i imagine

18:20 technomancy: Raynes: "I'm like a shark; I just gotta keep... making analogies."

18:21 http://www.penny-arcade.com/comic/2006/03/01

18:21 augustl: ibdknox: ring storing the session data on the server

18:21 ibdknox: augustl: http://mmcgrana.github.com/ring/ring.middleware.session.html

18:22 augustl: ah, didn't know there was a separate "sessions" api

18:22 ibdknox: that's essentially how all sessions work though, I'm not aware of a server implementation that stores sessions actually in the cookie

18:22 augustl: ibdknox: Ruby on Rails does this by default

18:22 all session data is stored in a cookie, then it's signed with a server-side secret

18:23 you can tell it to store in memory, in db, memcached, etc too, though

18:23 amalloy: ibdknox: there's a backend which uses a private key to encrypt (not sign) the session data and send it across to the client via the cookie

18:24 ibdknox: augustl: really? http://guides.rubyonrails.org/security.html

18:24 augustl: not sure why Rails just signs, instead of encrypring everything

18:24 ibdknox: really :)

18:25 "To prevent session hash tampering, a digest is calculated from the session with a server-side secret and inserted into the end of the cookie."

18:25 jcrossley3: augustl: ibdknox: that's only the default for dev convenience. sadly, some leave it that way in production.

18:25 ibdknox: ah

18:25 augustl: in other words, signing

18:25 ibdknox: that's a new change

18:25 augustl: it's been there since 2.3 iirc

18:25 ibdknox: jcrossley3: yeah, cookiestore didn't used to be the default

18:25 I'm out of date :)

18:26 jcrossley3: ibdknox: the default used to be in the db, which had other problems.

18:27 vijaykiran: play! does same thing too (like RoR) saving "session" in a cookie

18:27 ibdknox: jcrossley3: yeah, being painfully slow was one of them lol

18:27 augustl: jcrossley3: why is it "sadly" that someone uses it in production?

18:28 jcrossley3: augustl: it's always a risk to store user data in the browser, but i take your point -- it depends on the data.

18:29 augustl: I guess there are situations where you don't even want to expose the user ID

18:29 ibdknox: in memory seems like a nice compromise

18:29 augustl: or more generally, want to store any user-specific information in a cookie

18:29 jcrossley3: i just meant that some folks accidentally store sensitive data due to the default.

18:32 ibdknox: agree about in-memory, until you need replication

18:32 ibdknox: jcrossley3: sticky sessions

18:32 jcrossley3: that is a common choice, yes.

18:33 augustl: memcached makes sense

18:34 ibdknox: jcrossley3: at the point at which you need replication, it's time to use an in-memory store (redis or memcached)

18:34 which is pretty easy to do

18:35 writing a session-store is pretty simple :)

18:37 hiredman: jcrossley3 would prefer, I am sure, that you use infinispan

18:42 jcrossley3`: ibdknox: did you answer my last question? (i got bounced)

18:43 ibdknox_: jcrossley3`: I didn't see your question :)

18:43 jcrossley3`: [18:39] <jcrossley3> ibdknox: is redis or memcached what you meant when you first referred to "in memory", cuz i took you to mean "sharing ring's memory"?


18:43 ibdknox_: jcrossley3`: nope, I meant in process

18:44 but you brought up the point of replication, at which point it's easy enough to just go out of process

18:44 and use something like memcached

18:44 jcrossley3`: ibdknox_: right. does ring/noir support using memcached/redis as a session store?

18:45 ibdknox_: jcrossley3`: it supports anything you want if you write your own session store

18:45 jcrossley3`: amalloy has a mongo one

18:45 jcrossley3`: we have a postgres one

18:46 jcrossley3`: ibdknox_: so you're not aware of one written for memcached or redis?

18:47 ibdknox_: jcrossley3`: I don't know of one off the top of my head, but that doesn't mean there isn't one

18:48 amalloy: jcrossley3`: confirmation of how easy it is configure session-store backends: https://github.com/amalloy/mongo-session/blob/develop/src/mongo_session/core.clj is the whole library i wrote for doing it, and https://github.com/4clojure/4clojure/commit/1249c6d is the change i made to my app to use it

18:49 Raynes: https://github.com/Raynes/refheap/blob/develop/src/refheap/server.clj#L23 weeeeee

18:49 jcrossley3`: amalloy: perfect example, ty!

18:50 ibdknox_: has anyone used the new mongo library?

18:50 Raynes: Monger?

18:50 ibdknox_: yeah

18:50 Raynes: I've been thinking of moving refheap to it.

18:50 ibdknox_: it looks nicer

18:50 Raynes: Probably after the 1.0.0 release.

18:50 Moving will be a bitch though.

18:50 Plenty of queries/updates to screw up.

18:51 ibdknox_: lol

18:55 jcrossley3`: /nick jcrossley3


19:05 _carlos_: hi!

19:05 how am I supposed to use repl doc to find documentation about stuff installed inside a project by lein?

19:06 technomancy: (find-doc #"set")

19:06 ,(find-doc #"set")

19:06 clojurebot: -------------------------

19:06 clojure.core/*flush-on-newline*

19:06 When set to true, output will be flushed whenever a newline is printed.

19:06 Defaults to true.

19:06 -------------------------

19:06 clojure.core/*loaded-libs*

19:06 A ref to a sorted set of symbols representing loaded libs

19:06 -------------------------

19:06 clojure.core/*print-dup*

19:06 When set to logical true, objects will be printed in a way that preserves

19:06 ibdknox_: oh god

19:06 TimMc: ugh

19:06 technomancy: oh cripes

19:06 clojurebot: their...

19:07 technomancy: clojurebot: you had me panicking there for a minute.

19:07 clojurebot: Excuse me?

19:08 _carlos_: technomancy: was that for me?

19:09 wait ._. you are the one who did this lein script right?

19:09 technomancy: I had some help.

19:09 TimMc: haha

19:10 technomancy: amalloy: hey, you use M-x slime-connect rather than jack-in right?

19:10 it used to be that as long as slime-repl.el was loaded, M-x slime-connect would open a repl buffer

19:11 but now I just get the connection opened without a repl, and M-x slime-repl opens some CL-USER> nonsense

19:11 what did I break?

19:12 and is it broken for you too?

19:13 _carlos_: technomancy: (find-doc #"drop-down") nil <- I get this I am sure I have hiccup installed, because it's not complaining about the name when running the app

19:13 technomancy: _carlos_: find-doc only works with code that has been loaded

19:14 _carlos_: technomancy: yeah, makes sense. thanks!

19:15 technomancy: sure

19:16 TimMc: Ah, it looks at ns-interns for all-ns

19:27 brehaut: TimMc: i love how easy it is to read the implementation of so much of clojures stuff.

19:28 im pretty sure i know more about the internals of clojures functions in a few years of dabbling than i know about python after many years of serious use

19:28 alexbaranosky: brehaut, my thoughts exactly

19:29 gtrak: the scope of python's implementation is much broader than clojure's, comparatively, clojure is a thin layer over java i think

19:31 brehaut: gtrak: im not sure thats relevant or especially accurate

19:31 clojurebot: Titim gan éirí ort.

19:33 TimMc: Hmm, why don't I have clojure-jack-in... I bet I'm using an old repo site.

19:35 tmciver: TimMc: are you using marmalade as a repo?

19:36 TimMc: I believe that's where you should get clojure-mode

19:37 _carlos_: after lein repl inside the project, I run (:require [hiccup.form-helpers :as form-helpers]) , but I get compiling:(NO_SOURCE_PATH:1) . something is escaping me

19:38 tmciver: _carlos_: did you do lein deps first?

19:38 _carlos_: and do you have a version of hiccup listed in :dependencies in project.clj?

19:38 TimMc: tmciver: Right now I'm trying to figure out whehter it's bad that I have el-get commands in my .emacs

19:38 gtrak: brehaut: well I'm trying to run cloc on jython and clojure, that'd be more apples

19:39 to apples

19:39 _carlos_: tmciver: no, I ran lein run, which copied alot of files. I thought it ran deps implicitly. probably I'm wrong, but anyways, form-helpers/drop-down name is recognized, so I assume it is loaded

19:40 tcrawley: form-helpers/drop-down name is recognized when running the web app

19:40 gtrak: brehaut: I also know some python and the semantics are much more involved than clojure imo, there's a lot more magic going on

19:40 brehaut: gtrak: thats exactly my point.

19:40 _carlos_: sorry, tmciver above, it was for you

19:40 tmciver: _carlos_: you may be right; not sure. If you're getting form-helpers, then it's loaded.

19:40 brehaut: gtrak: i can read clojure.core and understand it; the equivalent python code is much more magical

19:40 gtrak: brehaut: yea, we agree

19:41 I just wanted to try to explain *why*

19:41 tmciver: _carlos_: ahh, it's not (:require . . . it's (require . . .

19:42 ibdknox: I can't tell you how many people I've seen run into that...

19:43 gtrak: brehaut: fyi, jython's at 97k lines of java and 83k lines of python

19:44 mdeboard: dat JPype

19:44 tmciver: TimMc: I'm not even sure what el-get is . . . it's spanish for 'the get' right?

19:44 gtrak: clojure has 35k lines of java

19:44 TimMc: tmciver: or elpa-get, dunno

19:45 Something that pulls from a repo.

19:45 technomancy: tmciver: you shouldn't ever have to run lein deps by hand

19:45 _carlos_: :require is meant for ns declarations; for repl use you want require

19:45 without the colon

19:46 tmciver: technomancy: really? I don't usually use lein run.

19:46 technomancy: tmciver: for any task

19:46 if it needs the deps, it will get them

19:46 Raynes: I use lein run more than I use my text editor.

19:46 ibdknox: technomancy: even if you update the project?

19:46 Raynes: It's just… it's just magical.

19:46 technomancy: ibdknox: as of 1.6.2, yes

19:46 ibdknox: hah, didn't know that

19:46 hiredman: or if you task you want to run is a lein plugin

19:47 TimMc: technomancy: Right, you don't have to run lein deps... you just have to delete lib. >_>

19:47 Raynes: technomancy: As soon as I get a chance, I'll set us up with a dependency on lein-newnew in Leiningen.

19:47 technomancy: Don't want you to think I've forgotten or am being lazy or anything. I just haven't gotten around to it.

19:47 technomancy: ibdknox: just noticed I left it out of the release notes.

19:47 which I'm sure you study thoroughly!

19:47 TimMc: no, not even that

19:47 Raynes: It isn't like I haven't looked at your elisp for like a week and a half or anything like that. I'm not a bad person.

19:47 tmciver: technomancy: then you're to blame!

19:47 ibdknox: technomancy: study the kerning of each letter

19:47 technomancy: guys

19:47 guys

19:47 TimMc: technomancy: Oh, is it schmott enough now?

19:47 technomancy: I just want someone to answer my slime question

19:48 halp

19:48 ibdknox: ~guards

19:48 clojurebot: SEIZE HIM!

19:48 Raynes: $guards

19:48 lazybot: SEIZE HIM!

19:48 technomancy: it checksums the concatenation of :dependencies and :dev-dependencies or whatever

19:49 smartypants lein

19:49 hiredman: technomancy: that doesn't seem to work well if you delete a file from lib/

19:49 technomancy: seriously though, why does the slime-repl buffer not show up when I do M-x slime-connect. it used to do that, but then I got spoiled by jack-in and stopped paying attention.

19:49 hiredman: true, unless you're also using :local-repo-classpath, in which case lib/ isn't even populated

19:49 hiredman: (because you are working on a mvn project and installed a new snapshot and what to pull it in)

19:50 tmciver: technomancy: it does for me (sometimes)

19:50 sometimes I get an error that I don't understand.

19:50 technomancy: tmciver: the plot thickens!

19:51 hiredman: technomancy: interesting

19:51 tmciver: technomancy: it seems that sometimes when I ', quit' slime, swank continues to run and I can connect to it.

19:51 I think that's what's happening anyways.

19:52 But as with many errors I run into I just restart emacs and fuh-get abaht it!

19:52 _carlos_: (require [hiccup.form-helpers :as form-helpers]) CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: hiccup.form-helpers, compiling:(NO_SOURCE_PATH:1)

19:52 hiredman: '

19:52 _carlos_: probably I'm just doing something dumb..

19:53 ibdknox: _carlos_: you need to quote it '[hiccup...

19:53 _carlos_: hiredman: I need '?

19:53 ok

20:00 gtrak: brehaut, check it out: clojure: 35k lines java, 15k clj; jython: 97k java, 84k python, jruby: 191k java, 5k yacc, 1.5k ruby.

20:00 no tests

20:00 _carlos_: thanks ibdknox, technomancy, I can require and read documentation properly now

20:00 ibdknox: so a 3-4x difference

20:00 gtrak: err, wait, I got the python one wrong

20:01 94k java, 3k python

20:01 ibdknox: lol

20:01 2-4x then

20:03 ashafa: hello

20:05 _carlos_: hello

20:05 ashafa: Question ... is there a new way of setting *main-cli-fn* with a recently pulled clojurescript master?

20:05 yoklov: what do people use for 2d grids in clojure. vector-of-vectors is kind of… awkward to use

20:05 ashafa: sorry, this is fore nodejs

20:06 for*

20:07 ibdknox: yoklov: depends on what you're doing with it, you can use a map with positions as keys {[0 0] "x" [0 1] "y"}

20:08 yoklov: well it's going to be representing a square that's totally full

20:08 so thats probably not that good.

20:08 ibdknox: it's easy enough to flatten it

20:08 brehaut: gtrak: thats pretty interesting

20:10 yoklov: hrm.

20:10 you know that might actually be really convenient.

20:10 and they're probably not going to be significantly higher than 20 by 20 so performance isn't a big issue.

20:10 ibdknox: if I remember right, that's what I did for the sudoku solver I wrote

20:11 it was straightforward

20:11 yoklov: yeah, this is for a small game

20:11 ashafa: Anyone use the new clojurescript master with nodejs?

20:11 ibdknox: ashafa: I don't know of many folks using CLJS with node yet

20:12 ashafa: I thought so...

20:13 http://mmcgrana.github.com/2011/09/clojurescript-nodejs.html this worked perfectly till I pulled latest from github

20:13 *til

20:15 ibdknox: ashafa: the property syntax changed

20:15 ashafa: so things like (.end x) need to be (.-end x)

20:17 ashafa: ibdknox: you, i knew about that and changed my code base accordingly... but the error i'm getting is genereated by core

20:17 sorry typing is off

20:18 (= ibdknox swanodette)

20:19 ?

20:19 cause I used that same example earlier on twitter

20:20 when swanodette was helping me out

20:24 thanks all... i'll do more investigating when I have the chance

20:31 ibdknox: ashafa: no, I'm not swanodette :) that would be dnolen

20:33 ashafa: ibdknox: sorry about that... it seems core has changed but my compiler is still emitting old js

20:34 maybe i need to delete my repo and re-bootstrap

20:36 yoklov: if i do something like (derive ::foo ::bar) in one namespace (ns1) and use ns1 in another (ns2), i then need to call refer to those by :ns1/foo and :ns1/bar in order to be talking about the same thing, right?

20:39 ashafa: i take that baske

20:39 back

20:41 yoklov: err, really i just want to know where i can learn more about hierarchies :/

20:41 even some code that uses them a lot

20:42 ashafa: ok found the problem

20:42 line 8 of nodejscli.cljs needs to change to (apply cljs.core/*main-cli-fn* (drop 2 (.-argv nodejs/process)))

20:43 will start the github process

20:45 priv_cooper: What would you say is the best tutorial for setting up clojure/swank/slime with aquamacs?

20:45 babilen: yoklov: Joy of Clojure and Clojure in Action have good chapters on it.

20:45 hiredman: don't

20:45 babilen: heh

20:45 yoklov: oh i think i have one of those

20:45 hiredman: priv_cooper: http://emacsformacosx.com/ is what you want

20:46 yoklov: ^^^^^^

20:46 that is really true.

20:48 priv_cooper: hiredman: Thanks

20:50 `fogus: ashafa: Just pushed the node.js changes

20:51 ibdknox: when doing read-string/eval is there a way to preserve line numbering such that an exception would still reference lines correctly?

20:51 people who know the compiler well ^

20:54 _carlos_: its really hard for me to find out what is the second argument of hiccup.form-helpers/drop-down. am I missing something reading the doc?

20:55 hiredman: ibdknox: you can try putting :line metadata on the form passed to eval

20:56 brehaut: _carlos_: its a seq of the options in the dropdown

20:56 _carlos_: brehaut: how did you find out?

20:57 brehaut: _carlos_: i looked at the source

20:57 _carlos_: https://github.com/weavejester/hiccup/blob/master/src/hiccup/form_helpers.clj#L76-91

20:57 ibdknox: hiredman: no luck :(

20:58 hiredman: ,(eval '[do 1])

20:58 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

20:58 brehaut: _carlos_ looks like (drop-down "foo" ["a" "b"]) and (drop-down "foo" [{:name "a" :id "1"} {:name "b" :id "23"}]) are both valid ways to use it

20:59 wait. screwed that up. second should be (drop-down "foo" [["a" "1"] ["b" "23"]])

21:19 _carlos_: brehaut: thanks, that worked

21:21 its time to continue studying the language. I still look at the language like I'm seeing just alot of parentheses

21:22 yoklov: i miss the parentheses when i program in non-lisps

21:34 TimMc: How do I tell which library is the culprit for a "not declared dynamic" warning?

21:34 No namespace is provided in the warning.

21:35 I guess creating an uberjar, unzipping it, and grepping that will have to do.

21:35 babilen: TimMc: Isn't the var name included in the warning? You might be able to track it down by using that.

21:36 yeah, something like that :) (not very elegant, but it probably works)

21:58 yoklov: is it frowned upon to have a bunch of maps with :type keys?

21:59 should i just be using defrecord

22:01 TimMc: yoklov: No, maps are fine.

22:02 They're recommended over defrecord (unless you need interop).

22:02 yoklov: and using a :type tag isn't bad?

22:03 TimMc: I don't see why it would be.

22:06 lancepantz: Oh good, I see clj-json is getting 1.3-ified. Any idea when that will be released?

22:12 yoklov: oh damn.

22:12 i don't even have the _slighest clue_ how to write a flood fill functionally.

22:12 TimMc: yoklov: Want a hint?

22:12 yoklov: badly.

22:13 TimMc: yoklov: Are you familiar with the concept of a worklist?

22:13 yoklov: oh, yeah.

22:13 use a queue?

22:13 that makes sense.

22:13 TimMc: I would use a set, I guess.

22:13 But a queue would probably be more efficient, and prettier if it is graphical.

22:14 yoklov: it's not

22:14 TimMc: Well, I'd say use two sets -- a completed set and a todo set.

22:15 yoklov: hm

22:16 TimMc: yoklov: Are you actually modifying, say, an image, or are you just gathering the set of points in the fill?

22:17 yoklov: neither i'm setting every point in a 2d array to be a certain thing. it's for a game, the grid is a room the value i'm setting is the floor tiles

22:18 typically its been more expressive/easier for me to implement describing rooms in terms of bitmap operations (e.g. (fill room floor) (outline room wall))

22:18 TimMc: You start with both sets empty and a current element. Process the current element. For each neighbor, if it is not in the completed set, add it to the worklist. Add the current element to the completed set.

22:18 Recur with the first of the worklist, dropping it from that set.

22:18 yoklov: right, i've done it imperatively before

22:18 w/o recursion

22:19 i'm just wondering if this might be vastly harder in clojure than, say, just drawing ascii art to represent it

22:19 which seems very likely.

22:19 TimMc: You'll probably end up with a little library of grid operations.

22:22 yoklov: that's certainly true

22:22 TimMc: Quick way to read a SQL table out as a collection of records?

22:27 Oh, doall on a sql/with-query-results result seems to do it!

22:31 yoklov: \# is the '#' character in clojure, right?

22:31 emacs seems to balk at the idea of allowing me to type it.

22:33 jodaro: oh, logging

22:34 TimMc: yoklov: Mine isn't giving me any trouble.

22:36 yoklov: hm.

22:37 yeah, i must have been mistaken, i can't get it to happen again.

23:28 well thats all the code i got in me tonight

23:28 thanks for all the help

23:40 guns: If I wanted to map values of a hashmap and return a hashmap, is (into {} (map λ hm)) an optimal way to do it, or do I use assoc?

23:44 TimMc: map

23:44 'for can also be nice, since it has destructuring.

23:44 guns: for with assoc?

23:44 into {} is too roundabout?

23:45 TimMc: (into {} (for [[k v] hm] ...))

23:45 guns: TimMc: Oh that's nice

23:45 ty

23:47 TimMc: guns: (zipmap (keys hm) (map λ (vals hm)))

23:47 guns: TimMc: oh like interleave, but → hashmap

23:47 nice

Logging service provided by n01se.net