#clojure log - Jan 26 2012

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

0:02 jeremyheiler: clj_newb: Anything that you send to an agent will be executed at the end of a transaction, or not executed at all if the transaction is rolled back.

0:03 clj_newb: jeremyheiler: I'm not using transactions; apparely just agents have sufficed so far

0:03 jeremyheiler: You are using transactions, although implicitly.

0:05 At the very least, an agent will never change unless a transaction completes.

0:09 muhoo: is it possible for javascript apps to use libraries from clojurescript in much the same way that java programs can use libraries written in clojure?

0:10 zenoli: What version of SLIME is currently recommended for use with the swank-clojure 1.4.0 snapshots?

0:13 clj_newb: jer

0:13 jeremyheiler: ah, your point is that the value of a @ is either the old value, or the new value if the function completes, right?

0:14 jeremyheiler: (I, personally, was just amazed when I read that agents are automatically run in different threads, thus providing concurrency)

0:14 jeremyheiler: clj_newb: yeah, it's cool stuff.

0:16 muhoo: nice, so stuff you write on a 1 core machine is already ready to run on a sun server

0:18 jeremyheiler: muhoo: re: clojurescript; I haven't used CLJS, but I don't see why not. CLJS compiles to straight JS. The problem is if you compile your CLJS with google closure's advanced option, you probably cannot rely on function names being consistent from compile to compile.

0:19 I could be wrong, though.

0:19 dnolen: muhoo: yes, it can work even under advanced compilation, just declare your exports

0:19 (defn ^:export name-should-not-change [] ...)

0:20 jeremyheiler: nice, that's awesome

0:21 zenoli: nvm, found it - 20100404, the version in ELPA.

0:23 muhoo: jeremyheiler: dnolen thanks

0:25 one really fundamental question: i'm trying to understand the difference between for and map/filter. are they different in syntax only, or in function?

0:26 for seems prettier in most cases.

0:29 alandipert: muhoo: map and filter are functions, for is a macro, so they're different in that sense

0:30 muhoo: oh, i'll look at the source of for. i bet it's implemented as map and filter

0:31 jeremyheiler: the source for `for` is really intense.

0:31 muhoo: hm, maybe i'll wait then :-)

0:32 dnolen: muhoo: not quite, it does quite a few fancy things - more similar to Haskell list comprehensions

0:32 hiredman: the source for map is more complicated then you would expect as well

0:33 muhoo: i don't know haskell. i'm coming to clojure from python, with some scheme background.

0:33 dnolen: muhoo: similar to for comprehensions in Python too

0:34 muhoo: good to know, thanks

0:34 Raynes: I used to turn on the parallel list comprehension GHC extension in Haskell and pretend I was high.

0:34 muhoo: heh

0:35 this language is obsessively addicting

0:44 amalloy: fwiw for is implemented mostly with mapcat, which is more general than map and filter

0:51 romanandreg: quick, dummy question: what does the ^:dynamic flag means on def sexps?

0:51 I'm trying to google the hell out of that but can't find any specific result that would answer that

0:51 clj_newb: read about bindings

0:52 Raynes: It declares the var dynamic, meaning it will be possible to rebind that var with binding.

0:58 romanandreg: Raynes: oh so… if I want to use "binding" form on a def, I have to set it as dynamic

0:58 that explains everything… thanks

0:58 Raynes: As of Clojure 1.3, yes.

0:59 adam_: what is the ->> operator called?

0:59 Raynes: I've heard both -> and ->> referred to as the 'threading' function.

1:06 adam_: word, i found it on clojureDocs, its actually a macro

1:07 http://clojuredocs.org/clojure_core/clojure.core/-%3E%3E

1:07 amalloy: $cd ->>

1:07 adam_: http://clojuredocs.org/clojure_core/clojure.core/->>

1:07 amalloy: hm. Raynes, is clojuredocs plugin off, or am i forgetting how to use it?

1:07 Raynes: amalloy: What did you expect to happen?

1:08 Oh.

1:08 I thought that what adam_ said was lazybot sayin git.

1:08 * Raynes doesn't do drugs.

1:08 * Raynes promises

1:08 Raynes: Let me check the logs for breakage.

1:09 amalloy: Looks like cd-client doesn't like the symbols in the URL.

1:09 adam_: i corrected it when I realized it didn't copy

1:10 amalloy: adam_: the first paste is a more correct url. urlencoding, dudes (apparently cd-client needs a lesson on that too)

1:12 Raynes: amalloy: FYI, people who have 'develop' branches without master branches are the devil.

1:12 * devn is not a fan of git-flow :X

1:12 Raynes: devn: We use the shit out of git-flow, but it isn't git flow if you don't have a bloody master branch.

1:13 Also, dakrone is in here, so I'm being rude.

1:13 * Raynes smiles awkwardly.

1:13 devn: Raynes: it sort of is, no? master is production.

1:13 develop before production, right?

1:13 Raynes: Right, but in this case, many releases have gone by with no master branch.

1:14 devn: maybe he doesn't think of them as releases?

1:14 Raynes: Uh. Okay.

1:14 devn: bumping a number on a repo doesn't make a release a release. it could be the buggiest piece of garbage ever written. just playing devil's advocate here.

1:14 Raynes: I've seen some stuff man, and some things. I wouldn't recommend it.

1:15 I think pushing to clojars and using it in production constitutes a release. *shrug*

1:15 But you could be right.

1:15 devn: not crazy by any stretch of the imagination

1:16 Raynes: There is always the chance that he grew up on Mars and is only just now adapting to life on Earth, pretending to be one of us.

1:17 devn: for the sake of argument, why is master, "master"? Verbs are nice. "develop" serves the role of "canonical edge branch" and "verb suggesting this is 'in development'" nicely

1:18 master is clojars

1:18 it's not for developing from -- there's a tag or a commit for that, y'kno?

1:19 that's one way of looking at it, anyway.

1:24 btw, I hate oauth

1:25 oauth manages to make every mashup, done in 15min programming idea and turn it into 2 hours of bullshit.

1:26 Raynes: devn: Generally the same experience. It's why I went with BrowserID on RefHeap. I don't like difficult and annoying authentication protocols.

1:26 devn: unless you have boilerplate at the ready, hence the reason most oauth libs have examples of how to use oauth with their library, with specific APIs

1:26 muhoo: oauth2 does in fact suck. but are there any libraries for doing it in clojure?

1:26 Raynes: $google clojure-oauth

1:26 lazybot: [mattrepl/clj-oauth - GitHub] https://github.com/mattrepl/clj-oauth

1:26 devn: muhoo: oauth-clj

1:26 muhoo: nice

1:26 thanks

1:26 Raynes: People really need to stop naming shit like that.

1:26 devn: oauth-clj.v2 handles v2 oauth stuff

1:26 Raynes: agree 10,000%

1:26 Raynes: o-clj-auth is coming next, I bet.

1:26 devn: clo-jauth

1:27 muhoo: part of the problem is that lot of the cool names are already taken

1:27 devn: We need to just programatically exhaust clj-* combinations, and dilute the search space so much that existing libraries will need to change their names to stay relevant.

1:29 i will create a list of random names for current clj-* maintainers to use when renaming their project. for instance, a small sample: ["baked-potato" "merle" "burt-reynolds" "foozball" "donut-buyer"] and so on.

1:29 muhoo: not worth the time. but it could be worse, you could end up with names like they have in ruby land, like "texticle" and "cheepnis" and such.

1:29 devn: honestly i think that's an improvement

1:30 Raynes: muhoo: I named a project 'conch' just a few days ago. Don't tell me all the good names are taken.

1:30 devn: what are we arguing about again?

1:30 Raynes: The price of tea in China.

1:30 muhoo: this library seems very useful; thanks

1:31 devn: adam_: ->> is often referred to as thread-last, -> would be thread-first

1:31 clj_newb: Is there a notion of priority in clojure agents? What I have here in my WYSIWYG editor is an (doc-Agent), which renders to a (image-Agent) [which blits to a Java Graphics2D]. I would like to make my doc-Agent, image-Agnet VIA (Very Important Agents) ... right now, this extra level of indirection (having rendering to image done in extra thread rather than directly in swing), seems to be causing some extra lag

1:33 jeremyheiler: So, i've started working on an SMTP client lib for Clojure that doesn't depend on JavaMail. I'm calling it Lime (not smtp-clj or something wicked awesome like that) either case, it's up on github, and i'm keeping a blog that tracks my progress: http://abitofclojure.com/

1:33 devn: jeremyheiler: cool!

1:34 jeremyheiler: devn: thanks

1:34 Raynes: jeremyheiler: I tried wrapping JavaMail a long time ago.

1:34 devn: jeremyheiler: do you follow the list?

1:34 Raynes: I still have the scars.

1:34 jeremyheiler: I, for one, applaud your word. Keep it up.

1:34 jeremyheiler: Raynes: I've seen a lot of wrappers, even created one myself ... but yeah, you don't need me to explain .. lol

1:34 adam_: devn: thank you!

1:35 jeremyheiler: devn: yeah im on the list

1:35 Raynes: thank you, much appreciated.

1:35 devn: adam_: np. to remove a -> or a ->> from an expression is to "unthread" a form

1:36 jeremyheiler: you might consider sending an email announcing your library if you're interested in feedback?

1:36 Subj: [ANN] Lime: SMTP Library for Clojure

1:36 jeremyheiler: devn: Thanks, I will. I'm not sure I want to do it yet, but there's probably no reason to wait.

1:37 devn: no pressure, just mentioning it. i'm on the list and when I don't have time it's still fun to peek at [ANN] emails, so I'm being self-centered to suggest it to you in the first place ;)

1:38 jeremyheiler: releasing is nice. it's kind of like gambling. either no one will care, or you'll get a bunch of pull requests and wind up supporting a library a lot of people in the community find valuable

1:39 jeremyheiler: except it's the opposite of gambling in that either way you sort of win

1:40 jeremyheiler: devn: haha yeah. i think i might write up an email tomorrow. I mean, i forced myself to get enough done to write a couple blog entries before saying anything to anyone, which has made me happy. I just want it to be clear that it's no where near ready to be really used.

1:42 amalloy: Raynes: fwiw, oauth and browserid have different goals. the thing you decided not to do was openid, not oauth

1:42 Raynes: amalloy: I was comparing openid to oauth in complexity. Didn't mean to imply I used browserid in place of openid.

1:47 devn: You're a clojuredocs-client commiter?

1:47 committer*

1:48 Could have swore I glanced "devn" under list of people to notify of my pull request.

1:58 emezeske: Totally on-topic: could somone please type the word "relevant"? I'm trying to get my IRC client to *not* hilight that, even though it contains my name (evan).

1:58 Raynes: relevant

1:58 emezeske: As it stands, the word "relevant" gets typed a lot in here

1:58 Raynes: Thanks!

1:58 Raynes: No problem.

1:59 emezeske: I recently noticed you're the one who put up the paredit.vim repo I've been using. Thanks for that.

1:59 emezeske: Haha, awesome. No prob!

2:00 Do you know that I made a funky change to it?

2:00 Raynes: Nope.

2:00 emezeske: The default version does weird things when I "cw", so I disabled paredit for that (I think)

2:01 Raynes: I don't know what that does.

2:01 * Raynes is still learning vimfu.

2:01 emezeske: Change Word

2:01 Raynes: I see.

2:01 That's useful.

2:01 I needed that like 20 minutes ago.

2:01 emezeske: :)

2:01 I use that command a *ton*

2:02 jeremyheiler: nice, it beats the heck out of doing "dw" then "i" lol

2:02 Raynes: I do a lot of da( i

2:02 emezeske: jeremyheiler: Definitely!

2:02 Raynes: I guess I could just be doing ca(

2:02 jeremyheiler: gonna have to train my fingers to hit the cw quickly, though.

2:03 emezeske: I also like doing "c2w" or "c3w" to change two or three words

2:03 Or really, any motion; "c$" or "c3l"

2:04 The best thing about "c" is that you can repeat it with "."

2:04 * emezeske realizes he's not in #vim.

2:04 jeremyheiler: emezeske: it think it's safe that the emacs guys aren't watching

2:04 ***hides

2:04 Raynes: They're always watching.

2:05 emezeske: Yeah, I'm sure their emacs has IRC built in, and they can see all vim-related heresy by pressing C-M-Win-x-p-t

2:06 jeremyheiler: hahaha

2:06 acts_as_david: question, is there a way to keep leiningen from opening the java applet in the dock when starting a repl?

2:06 Raynes: I used ERC when I used Emacs.

2:07 acts_as_david: running clojure manually has never done this for me (via java -cp, etc.), so I'm assuming this is a lein thing

2:07 Raynes: acts_as_david: That shouldn't happen.

2:07 jeremyheiler: acts_as_david: are you using lein-ring?

2:07 Raynes: What version of Leiningen and are you running `lein repl` in a project?

2:07 It has to be a plugin or a dependency or something that's causing it, because Leiningen certainly doesn't.

2:08 acts_as_david: ah okay

2:08 hold on a sec

2:08 lein --version: Leiningen on Java 1.6.0_26 Java HotSpot(TM) 64-Bit Server VM

2:08 jeremyheiler: i know lein-ring will use clojure.java.browse/browse-url and for me (on linux/xfce) it opens a java swing window and loads the page in it *pukes*

2:09 acts_as_david: the only dependency so far is incanter, which i know comes with a sort of "interactive mode" that would do such a thing

2:09 any way of suppressing it?

2:10 jeremyheiler: need to find out what's opening it first

2:10 acts_as_david: here's my project.clj:

2:10 (defproject ml "0.0.1-SNAPSHOT"

2:10 :description "A study in machine learning, using Clojure"

2:10 :repositories { "sonatype-oss-public"

2:10 "https://oss.sonatype.org/content/groups/public/" }

2:10 :dependencies [[org.clojure/clojure "1.3.0"]

2:10 oops sorry for the multiline. damn irssi

2:10 [incanter "1.3.0-SNAPSHOT"]])

2:10 jeremyheiler: it good, just don't let it happen again.

2:10 ;-P

2:11 acts_as_david: lesson learned ... pastie all the way heh

2:11 Raynes: acts_as_david: https://refheap.com </shamelessplug>

2:11 acts_as_david: so i'm assuming it's incanter. is the first step to require indiv. incanter modules instead of the wholesale package?

2:11 jeremyheiler: yeah... https://github.com/liebke/incanter/blob/master/src/incanter/main.clj

2:11 Raynes: You can also set java.awt.headless

2:11 acts_as_david: Raynes, I'll check out it out :)

2:12 ah i see

2:12 Raynes: acts_as_david: You are required by law to use refheap if you plan to be friends with me.

2:12 acts_as_david: is java.awt.headless the way to go?

2:12 heh

2:12 Raynes: It's *a* way. I'm not sure if there are consequences to using it besides preventing a dock icon from showing up.

2:13 acts_as_david: i don't do the whole "law" thing ;-)

2:13 ah okay

2:13 jeremyheiler: ~guards

2:13 clojurebot: SEIZE HIM!

2:13 Raynes: Should acts_as_david use refheap??

2:13 lazybot: Raynes: Uh, no. Why would you even ask?

2:13 Raynes: Betrayal!

2:13 acts_as_david: maybe the solution is to remove it in a pull request ;-)

2:14 clj_newb: can I stick an ImageIcon directly in a JPanel, or do I have to throw in an intermediate JLabel first?

2:14 acts_as_david: anyone know leibke?

2:14 Raynes: I interacted with him in an elevator once.

2:14 acts_as_david: Raynes, it's like a magic eight ball. ask enough times and you'll get the right answer

2:14 jeremyheiler: http://incanter.org/developer/ might get you started

2:15 acts_as_david: so did i, if by elevator you mean e-mail, and by interacted with, you mean "chatted"

2:15 jeremyheiler: acts_as_david: ^

2:15 acts_as_david: thanks jeremy

2:15 Raynes: I wanted to touch his beard but he had shaved it.

2:15 acts_as_david: at one point i considered adding some stats functionsi to incanter but the codebase scared me a little bit

2:15 does he have an epic beard

2:17 Raynes: He did.

2:22 acts_as_david: just sent an e-mail to the incanter group

2:23 i want to see if they can turn this off -- seems like it'd be covered by some sort of a "start-friendly-version-of-incanter" script

2:23 Raynes, so why do i need to use refheap instead of gist/pastie?

2:23 i'm curious

2:24 Raynes: Well, I was hoping being friends with me was enough.

2:24 muhoo: because it has clojure syntax highlighting?

2:24 Raynes: Well, so does gist and pastie.

2:24 muhoo: and it's shit-tons faster than either pastebin or pastie

2:24 Raynes: It is?

2:24 muhoo: was for me

2:24 Raynes: Well, that's cool.

2:24 muhoo: pastebin is always a 3-second wait

2:24 Raynes: acts_as_david: Go paste something and then click "maximize" in the upper right corner of your paste.

2:25 For best effect, paste something large.

2:25 muhoo: Raynes: was it written with noir or compojure? :-)

2:25 Raynes: Both.

2:25 Noir uses compojure.

2:25 But technically I use noir. :)

2:26 acts_as_david: ah cool

2:26 Raynes: acts_as_david: Anyways, that's my favorite feature.

2:26 acts_as_david: okay, so fast + friends-with-Raynor + zomg-expansion

2:27 Raynes: You can link people to your code and only your code if you want.

2:27 acts_as_david: you should totally put this in your next billboard sign

2:27 muhoo: + written in clojure

2:27 acts_as_david: ;-)

2:27 ah cool

2:27 Raynes: We plan to implement revisions and diffs as well. Basically do what github does without git.

2:27 acts_as_david: have you ever considered taking all pastes, concatenating, and typing (eval ...) in a repl? :p

2:28 nice idea

2:28 Raynes: Heh.

2:28 muhoo: dangerous?

2:28 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>

2:28 Raynes: acts_as_david: I wrote this a couple of days ago: https://github.com/Raynes/refh if you want a command-line app for pasting.

2:28 acts_as_david: wow does clojurebot eval all clojure code?

2:28 * muhoo shouts OOH OOH MEE MEE

2:28 Raynes: Also wrote a vim plugin and there is a super alpha elisp library.

2:29 No, he just sometimes says random things.

2:29 I guess it isn't fair to say refheap is written in Clojure. It's actually written in Clojure, Ruby, Python, and Javascript.

2:30 acts_as_david: nice. i'm going to investigate. is the token passed over ssh?

2:30 Raynes: And a little VimL if you count refheap.vim.

2:30 muhoo: heh, refh is in ruby.

2:31 Raynes: acts_as_david: Over ssh? :o

2:32 acts_as_david: sry ssl ... i'm in server mode today

2:32 Raynes: Haha.

2:32 Yeah everything is SSL.

2:32 Any non-ssl request redirects to SSL.

2:32 But your token is basically disposable.

2:32 You can generate a new one at any time, rendering the old one useless.

2:32 acts_as_david: excellent. back to the swing problem, how do i set java.awt.headless?

2:33 it's been way too long since i've tweaked JVM options

2:33 is it like -D java.awt.headless=true or something

2:33 Raynes: acts_as_david: In your project.clj, set :jvm-opts ["-Djava.awt.headless=true"]

2:33 Ought to do it.

2:33 acts_as_david: awesome

2:34 that did the trick. excellent

2:35 Raynes: acts_as_david: Also, in all seriousness, you don't have to use refheap. I've been told in the past that my marketing abilities are terrible, so I thought I'd tackle you with refheap and make a user out of you.

2:35 muhoo: i'm already sold

2:35 Raynes: :p

2:35 muhoo: is there a RESTful way to post to it (so i could write my own CLI to do it)?

2:35 acts_as_david: i'll certainly give it a look. i'm all for supporting the new guy on the block

2:36 Raynes: muhoo: https://github.com/Raynes/refheap/wiki/Documentation:-API

2:36 muhoo: thx

2:36 acts_as_david: boom ... just followed you on GH

2:37 Raynes: https://github.com/Raynes/innuendo or https://github.com/Raynes/rubyheap for examples of using that API.

2:37 I've got an even 100 followers on Github.

2:37 * Raynes is trying to not let the fame get to his head.

2:37 muhoo: oh yes https://github.com/Raynes/refheap.el

2:38 Raynes: Not promising that actually works.

2:38 :p

2:38 My elisp isn't so great.

2:38 alandipert: Raynes: you guys should do structural diffs!

2:38 Raynes: alandipert: I like how enthusiastic you are about that!

2:38 alandipert: !!!

2:38 muhoo: i don't like the way that google code shows diffs

2:39 i do like a plain old "diff -u" style diff.

2:40 acts_as_david: all right i'm heading out. ciao

2:40 Raynes: He's a nice fellow.

2:42 alandipert: I just can't wait for revisions, myself.

2:42 Revisions are super cool.

2:42 alandipert: Raynes: yes that will be great

2:42 Raynes: You can edit and fork right now, but we needs us some revisions.

2:44 muhoo: Do you actually plan on writing your own CLI tool?

2:44 Or were you asking just in case?

2:58 muhoo: Raynes: my cli tool will likely be bash wrapping curl

2:58 unless i end up using the emacs mode, which i'd prefer

2:59 but bash+curl+shell-command-on-region would work just fine if the emacs mode isn't ready

3:16 emezeske: jkkramer: Any chance I could convince you to update Clojuresphere? ^_^

3:16 jkkramer: It looks really cool, but it's a ways out-of-date.

3:34 Blkt: good morning everyone

3:35 AWizzArd: Buongiorno Blkt

3:35 frankvil1elmsen: I can have two expressions in a partition-by such as (partition-by # (<% 3) "(>% 8)"? (range 1 9))

3:37 Blkt: buondì AWizzArd :D

3:38 frankvil1elmsen: sorry it should be a question

3:43 AWizzArd: frankvil1elmsen: what is your example supposed to do?

3:44 frankvil1elmsen: I would like to have them less than three, AND those larger than 8

3:46 AWizzArd: frankvil1elmsen: then you can just do this in your function.

3:46 for example:

3:46 ,(group-by #(or (< % 3) (> % 8)) (range 1 15))

3:46 clojurebot: {true [1 2 9 10 11 ...], false [3 4 5 6 7 ...]}

3:47 AWizzArd: If you are just interested in those elements that match to your rule you can run (filter #(or (< % 3) (> % 8)) (range 1 20)).

3:48 partition-by will traverse the whole sequence and not group those elements that your rule describes, but instead split at that point.

3:48 frankvil1elmsen: cool - I have gone completely in the wrong direction, thx, I think I got it :-)

3:50 haha,, the group-by is perfect in my case .. thanks AWizzArd

3:51 clj_newb: I'm in Clojure. I'm having Java run out of memory heap errors.

3:51 Are there clojure functions to help me print out heap statistics, and manually call GC?

4:24 atc-: morning all :)

4:25 Quick question: I have three collections, I want to put the last item from the latter two into the first, but without nils. What's the best way to do this? Some application of reduce?

4:26 clgv: atc-: make a small example to rule out misunderstandings ;)

4:27 Fossi: also, how often, etc

4:27 i'd reverse and find or such

4:28 but might not be what you need performancewise

4:29 atc-: OK, let me drum up an example quick :)

4:32 Hopefully the following will clarify: http://pastebin.com/0uaPH7ni

4:32 Sorry, I don't want to paste all the code 'cause I want to solve the greater problem myself :)

4:33 clgv: hopefully the pastebin will clarify a little.

4:35 clgv: atc-: you could make pairs of both seqs until both run out and then cons/conj them on a list and do a filter afterwards. instead of filtering you can remove nils when before adding to the list

4:36 atc-: clgv: yeah, I'm trying to avoid "post processing" by using a filter to remove the nils afterwards at that could be very inefficient.

4:37 clgv: so how do I achieve not adding nils? :|

4:37 clgv: BTW, I'm a newbie! :)

4:39 clgv: I currently conj the three together: (conj pile (last top) (last btm))

4:39 clgv: but of course, the last calls yield nils when there's nothing in top/btm

4:39 god I keep writing ) at the end of sentences!

4:43 clgv: atc-: you definitely want to use loop-recur for that?

4:44 atc-: clgv: perhaps not. I'll show you all my code, it'll give a better context for you

4:44 clgv: I'm solving a shuffle problem using brute force

4:44 clgv: brute because it makes me write more code and learn clojure

4:44 clgv: here's the code: https://github.com/atc-/clojure-playground/blob/master/shuffle/shuffle.clj

4:46 clgv: atc-: a right, you want to just interleave the two collections, right?

4:47 atc-: haha

4:47 yes, probably

4:47 haha, that's cheating! :P

4:47 I didn't know the term...

4:47 clojurebot: excusez-moi

4:47 atc-: cheating?

4:47 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>

4:47 Fossi: wat?

4:47 ;D

4:47 atc-: wut

4:47 cheating?

4:47 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>

4:48 atc-: hehe, perhaps a bug

4:48 clgv: atc-: well interleave does not handle different sized collections correctly

4:48 atc-: clgv: oh, that's a bummer. That's exactly what I'll have

4:48 clgv: atc-: it'll stop when one of the sequences runs out

4:48 atc-: but you can take the interleave code and patch it ;)

4:48 atc-: clgv: I definitely don't want that

4:49 clgv: now THAT'S brute force :P

4:49 jaley: anyone know if there's a function like (find-first #(odd? %) [2 4 6 8 9]) in the core libs anywhere? There was one in clojure.contrib.seq in 1.2 but now I've lost it.

4:50 clgv: atc-: there is a "(when (and s1 s2) .." form in it. you can change that "and" to "or" then you#ll have nils and all elements in it

4:50 atc-: clgv: hmmm, those dasterdly nils again :|

4:50 clgv: atc:- to get rid of the nils you'll have to check via 'if

4:51 Fossi: there's gotta be a mor eclever way to do that

4:51 atc-: atc-: ok, just thought I could do it more succintly than that

4:52 Fossi: yeah, my thoughts. hence why I haven't written an if for it

4:52 clgv: hmm well it'll be lazy so filter-ing it afterwards is almost no overhead

4:52 atc-: unless I use a set?

4:52 that'll mean only one nil will be there

4:52 unless they're true sets?

4:53 i.e not allowing nulls/nil

4:53 clgv: atc-: rewrite interleave with "or" and filter with identity

4:54 atc-: both operations are lazy so it's almost as if you included the if-dispatch in the rewritten interleave but without the pain ;)

4:54 atc-: clgv: forgive me, but it feels like a hack :|

4:54 clgv: atc-: nope thats idiomatic clojure.

4:55 the only missing part in clojure is a "consume all" interleace and also a "map" version of it

4:55 *interleave

4:55 atc-: clgv: ok, I'll take your word for it

4:55 I think I might've solved the interleaving by using nested cons

4:56 (cons (last btm) (cons (last top) pile)))

4:56 (ignore the last ")")

4:56 Raynes: Rewriting core functions isn't idiomatic Clojure. :p

4:56 Using filter certainly is.

4:56 clgv: atc-: in idoimatic clojure you usually shouldnt start with loop-recur

4:56 atc-: Raynes: so filtering on the possible very large result would be idiomatic?

4:57 clgv: really? how would you solve it?

4:57 clgv: Raynes: yeah. but he needs interleaving and the is no consume all version of it

4:57 atc-: clgv: I thought recursion was very clojurish :(

4:57 Raynes: atc-: Yes, because filter is lazy.

4:57 clgv: Raynes: you cant even "mapcat list" on the sequences since it wont consume both completely

4:58 atc-: Raynes: lazy? how so? it won't evaluate all? can you elaborate perhaps?

4:58 Raynes: clgv: I'm not saying he shouldn't roll his own interleavr here.

4:58 clgv: ~lazy-seq

4:58 clojurebot: Titim gan éirí ort.

4:58 atc-: lemme RTFM on lazy

4:58 clgv: Raynes: thats what I suggested to him - not rewriting the whole core ;)

4:58 atc-: I've got enough clojure.org tabs open to sink a ship

4:59 Raynes: atc-: It won't evaluate anything until you actual need them.

4:59 clgv: Just the way you worded it irked me.

5:00 atc-: Raynes: ok. in my example problem I was afraid that it would evaluate it entirely because I'd do something like this: (filter #(not (nil? %) (conj pile (last top) (last btm)))

5:00 clgv: Raynes: yeah, well you have to think in context. All I was saying that the resulting implementation from taking interleave implementation with 'or and filtering is idiomatic. but as you see explaining it carefully out of context gets pretty long ;)

5:01 amalloy: you can do it in just a couple lines, really, but i don't want to spoil the fun by just pasting it

5:01 atc-: amalloy: the shuffle problem? or interleave consuming all?

5:02 amalloy: interleave

5:02 atc-: right

5:02 amalloy: i didn't notice anyone had a shuffle question

5:02 atc-: I'll go read the interleave source and see what I can muster up

5:02 amalloy: also, (cons x (cons y z)) is just (list* x y z)

5:02 Raynes: $cd interleave

5:02 lazybot: clojure.core/interleave: http://clojuredocs.org/v/1869

5:02 clojure.core/interleave: http://clojuredocs.org/v/5560

5:03 atc-: thank you

5:04 ok, lots of food for thought

5:04 amalloy: my solution to the interleave problem is at https://refheap.com/paste/435 if you want a spoiler

5:04 Raynes: amalloy: Didn't you want those all in one message? You should patch it.

5:04 atc-: thanks clgv, Raynes, amalloy

5:05 Raynes: amalloy: braid is a significantly awesome name.

5:05 clgv: amalloy: ah right, if you do it for arbitrary collections its the map first and keep. good one :)

5:05 amalloy: Raynes: braid is a significantly awesome game

5:05 atc-: amalloy: oh nice, that list* had eluded me thus far. very handy

5:05 amalloy: $findfn 1 2 3 [4 5] [1 2 3 4 5]

5:05 lazybot: [clojure.core/list*]

5:05 clgv: inc lazybot

5:05 ;)

5:06 Raynes: $botsnack

5:06 lazybot: Raynes: Thanks! Om nom nom!!

5:06 atc-: heh

5:06 clgv: (inc lazybot)

5:06 lazybot: ⇒ 4

5:06 Raynes: $karma

5:06 clgv: since you guys are here - what do you use for debugging?

5:06 Raynes: $karma Raynes

5:06 lazybot: Raynes has karma 12.

5:07 Raynes: (doto x prn)

5:07 clgv: and what do you think are good tools for debugging clojure code that you might not use?

5:07 amalloy: i use useful.debug's ? macro mostly, since i wrote that. it's primitive but useful and easy

5:07 clgv: Raynes: nothing more elaborate?

5:07 Raynes: Nope.

5:08 Just (doto x prn). Has never failed me.

5:08 amalloy: it'd be nice to have a debugger like gdb or eclipse's java debugger, but in a non-stateful language it's both less necessary and less useful

5:08 clgv: hm ok. I use debug-repl quite frequently and adapted it a bit

5:08 amalloy: I use eclipse debugger sometimes. but debug-repl more frequently

5:09 Raynes: Wow. Why am I still awake?

5:09 clgv: Raynes: since it's almost noon - at least over here ;)

5:09 Raynes: $time -6

5:09 lazybot: Raynes: The time is now 2012-01-26T04:12:43Z

5:10 clgv: $time 1

5:10 lazybot: clgv: The time is now 2012-01-26T10:13:00Z

5:10 clgv: oh thats wrong

5:10 $time 2

5:10 lazybot: clgv: The time is now 2012-01-26T10:13:16Z

5:10 clgv: $time +1

5:10 lazybot: clgv: The time is now 2012-01-26T11:13:26Z

5:10 Fossi: :D

5:10 clgv: ah better

5:11 * clgv guesses that string concatenation is used inside :P

5:11 Raynes: I should have only made it work for my timezone.

5:11 Fossi: debug-repl looks nice

5:12 but not being able to use it in slime makes it fail :(

5:12 Raynes: Night.

5:12 clgv: Fossi: yeah it's pretty awesome. often more handy like eclipse's or visual studio's debugger

5:12 Fossi: slime does use a client-server-architecture, right?

5:12 Fossi: then thats the reason

5:12 Fossi: well, i use println and then realise i had to print something else

5:13 so it'd be nice for that

5:14 clgv: Fossi: I thought of rewriting it to open a Swing Console and let the executing process wait for that one to close. then it would work in slime and nrepl as well

5:14 Fossi: something like that

5:14 then again, you could prolly just use some slime hook

5:15 clgv: Fossi: but you can switch to lein repl, for the cases where you want to use debug-repl

5:15 Fossi: I have no idea about slime implementation details and am not even using it ;)

5:16 googling for clojure debug doesnt turn up much more than debug-repl and "clojure debugging toolkit" which seems to be libn using java debug interface

5:17 but the cdt 'set-catch seems awesome

5:38 faust45: hi guys

5:48 ordnungswidrig: is there a way to have flymake work with clojure-swank?

6:23 clgv: Fossi: according to this page you can use the 'break macro in slime similar to the debug-repl https://github.com/GeorgeJahad/debug-repl

6:34 leiningen always aot-compiles everything that is referenced in the ":main clojure file". if I understand correctly, I'll be able to remove all AOT class files that do not belong to that :main class and my jar should be runnable right?

6:54 casperc: hi folks

6:55 ordnungswidrig: slime-compile-and-load-file report "unkown location". altough in reports the line number afterwards...

6:55 casperc: i am looking at creating a lazy seq from an atom feed, but I don't quite know how to get started

6:56 basically you ask a service for a chunck of events and then get a link to the next chuck

6:57 so I need to be able to get a chuck and keep a reference to the next chuck but I don't know how to do that

6:58 faust45: casperc: sounds good idea, wrap atom to lazy seq

6:58 casperc: oh and the chuck is a number of events btw (bad formulation on my part)

6:58 clgv: casperc: keeping the ref is easy by passing it to the next function call in the lazy-seq

7:00 casperc: hmm, how would that look? I am looking at the fibo example in programming clojure

7:00 i can't quite get the state in there in my head :)

7:02 clgv: you do something like: (defn f [url] (lazy-seq (when url (let [[chunks next-url] (get-my-feed-stuff url ...)] (concat chunks (f next-url)))

7:03 chunks is a list of events (bad name then ;) )

7:06 casperc: ah right, so next-url keeps the internal state

7:06 clgv: casperc: exactly. now the technical part of getting the data remains for you to solve

7:06 casperc: had to get my head around this, but i'l give it a go. Thanks alot :)

7:08 thorwil: after updating swank-clojure, i now get this, when i try to start my appengine-magic project: http://paste.pocoo.org/raw/541000/

7:08 casperc: clgv: right, that is actually the easy part :) Thanks again!

7:09 thorwil: in short "No such var: ae/serve". i guess after not touching this for weeks, i'm missing something silly again

7:10 clgv: thorwil: ae = appengine and that lib is missing?

7:10 thorwil: or there is no (:require [... :as ae]) ?

7:11 thorwil: clgv: yes and no, there's a matching jar in lib/dev/

7:13 clgv: i did indeed forget a require, thanks

7:16 what a success :) [Thrown class java.lang.NullPointerException], where the important thing seems to be "NO_SOURCE_FILE:1 tlog.routes.routes/eval2049"

7:17 oh, and [No Locals]

7:21 how do i find out what "tlog.routes.routes/eval2049" refers to?

7:28 nm, works after deleting everything in classes

7:29 * lytton info

7:39 faust45: is it possible use arguments destruction in clojure? like http://friendpaste.com/lHZAupyqQTNGEee9mFTtw

7:42 ordnungswidrig: faust45: argument desctructuring is available but not with matching like the example

7:42 faust45: ordnungswidrig: thanks

7:42 ordnungswidrig: you can have (defn foo [a [b c] {d :e}] ...) and call it like (foo 1 [2 3] {:e 123})

7:43 giving a = 1 b = 2 c = 3 d = 123.

7:43 works with let as well

7:43 see here http://clojure.org/special_forms

7:53 is there a ref on how to use cdt with swank? The recent changes of clojure-swank suggest support for locals

8:18 clgv: ordnungswidrig: afair you can connect to host:port or process id via cdt

8:19 ordnungswidrig: clgv: cdt fails loading...

8:19 clgv: ordnungswidrig: oh. clojure 1.3 issues?

8:19 ordnungswidrig: cfe with com.sun.jdi.Bootstreap

8:20 tools.jar is added by cdt

8:44 warning: unabled to add tools.jar to classpath. This may cause CDT initialization to fail. #<IllegalAccessError java.lang.IllegalAccessError: Context classloader is not a DynamicClassLoader>

8:44 is there any known problem on cdt with clojure 1.3?

8:45 cdt comes from swank-clojure todays git HEAD

8:54 pyr: 1/win3

9:15 jsabeaudry: Is autodoc the defacto standard for automatic documentation generation in clojure?

9:20 jkkramer: jsabeaudry: there's also marginalia and codox

9:22 jsabeaudry: jkkramer, Would you have a suggestion between the 3 of them?

9:22 ordnungswidrig: jkkramer: use all three, let the user decide :-)

9:23 is there an example doc for codox?

9:24 jkkramer: jsabeaudry: I kinda of prefer reading code & comments directly

9:24 ordnungswidrig: http://mmcgrana.github.com/ring/

9:25 ordnungswidrig: jkkramer: ah, then I like it

9:26 mdeboard: it's electrifyin'

9:26 jkkramer: wish it had a "source" links, since I usually end up seeking out the source for libs i use anyway

9:29 arkh: I'm still new to emacs - how does clojure-jack-in know which project (and project.clj) a person would like to work with?

9:29 compj: arkh: I think it uses the cwd

9:29 Bronsa: arkh: the one in the cwd

9:30 arkh: ok, so where I launch emacs matters - thank you. Feeding parameters at run-time to clojure-jack-in didn't seem to be an option.

9:30 compj: you can also M-x cd

9:31 arkh: oh - cool

9:36 stuartsierra: Whenever you find (open) a file in Emacs, the cwd becomes that dir.

9:40 arkh: stuartsierra: also good to know : )

9:41 I am an emacs tabula rasa : (

9:45 has anybody tried the new release of Clojurescript One? When I execute (dev-server) from from a slime connected repl it acts like either the classpath or ns isn't set up correctly. Error: "Unable to resolve symbol: dev-server in this context"

9:47 dakrone: Raynes, amalloy_: cd-client is really old, it needs a rewrite, but until then it will hobble along

9:47 clgv: since there are now more people online here, I'd like to ask you again: What debug facilities do you use for your clojure projects?

9:49 pandeiro: arkh: haven't tried it from slime, but maybe you can do (use 'one.sample.repl) first and then try

9:51 arkh: pandeiro: thank you - that worked.

9:55 pandeiro: arkh: thank you for giving me the idea to run cljs in slime instead of *shell* :)

9:56 manutter: clgv: have you tried counterclockwise in Eclipse?

9:56 clgv: manutter: It's kind of a survey question to get to know what others use and what options there are

9:57 manutter: so, you use ccw?

9:57 manutter: clgv: I've used it in the past and I've played with the debugger, which works pretty well

9:57 clgv: I'm still mostly emacs though

9:59 clgv: manutter: so what do you use when debugging within emacs?

9:59 manutter: clgv: well, um, (println)

10:00 I'm not doing anything really hard core at the moment

10:08 clgv: ok, lets see if others have different debugging tools

10:14 arkh: clgv: +1 for println

10:18 pandeiro: arkh: were you able to get the cljs repl working in slime mode?

10:23 clgv: arkh: thx. that one seems pretty dominant and widespread ;)

10:24 arkh: clgv: for better or worse

10:26 pandeiro: I'm currently working on what happens when I execute (cljs-repl) - "ClojureScript:cljs.user> java.lang.RuntimeException: EOF while reading"

10:27 I think it's running that in another thread and the error message is printed in a loop

10:28 pandeiro: arkh: yeah i think that is what's going on for me, too

10:33 arkh: pandeiro: hmm - works just fine from a shell launched repl

11:09 18WABFMSC: ,(byte 128)

11:09 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for byte: 128>

11:11 18WABFMSC: how do I get bytes between 128 and 255?

11:11 dnolen: 18WABFMSC: Java doesn't have unsigned bytes

11:13 18WABFMSC: ,(byte -1)

11:13 clojurebot: -1

11:16 TimMc: &(.byteValue 255) ; 18WABFMSC

11:16 lazybot: ⇒ -1

11:25 pjstadig: you can work with bytes just fine if you're adding, subtracting, multiplying, or using bitops

11:25 when they get converted to decimal they will have a signed range from -127 to 128

11:26 so you'd have to be careful about printing them or something

11:26 http://blogs.oracle.com/darcy/entry/unsigned_api

11:26 TimMc: pjstadig: -128 to 127, actually

11:27 pjstadig: er

11:27 right

11:27 two's complement division is totally different than unsigned division, but otherwise the bits are the same and just interpreted differently

11:28 i guess comparison is a problem too

11:29 llasram: lol. usually *the* problem :-)

11:29 (for what I've done w/ unsigned, anyway)

11:29 pjstadig: well it depends on if you're using bytes as numbers or data

11:29 if you're using them as data and doing some occasional bit ops, then you're probably ok

11:30 if you're doing math and comparisons...uh don't use bytes?

11:31 llasram: How else would you suggest implementing a sort-comparison operation for IPv6 addresses?

11:31 pjstadig: use a library :)

11:31 llasram: heh

11:31 pjstadig: or represent them as what 64-bit ints?

11:32 llasram: Ok, sure, but whatever library you use is going to need to do that under the hood.

11:32 128-bit

11:32 pjstadig: 128

11:32 llasram: You can do it in C/C++ with gcc

11:32 But Java, not so much

11:32 pjstadig: yeah, i haven't had that problem, so i'm blissfully unaware at least while we still have IPv4 addresses to allocate

11:33 llasram: Anyway, being to pendantic. I just wanted to make the point that there are some situations where you can't help but wanting to compare bytes unsigned, although they are rare

11:33 s,to,too,

11:33 TimMc: pjstadig: Allocation is done.

11:33 pjstadig: well

11:33 yeah, but they're still being "allocated"

11:34 rlb: llasram: it's also handy to be able to work with unsigned bytes when you're wanting to talk to a squeezebox over a socket (or other binary packet based device).

11:34 TimMc: Sure, the block holders are still assigning from their pools.

11:34 pjstadig: llasram: yeah, agreed

11:39 ljos: I might be using the wrong terminology here, but: Is there a way to make print/println synchronous over multiple threads? Or, I guess they sort of are on a per character basis as they don't write over each other. I just want the whole string from one thread written before the next one starts.

11:40 m0smith_: ljos: you can use an agent to do that. Log everything to an agent and have it do the actual write

11:40 I am still trying to get the hang of numbers in 1.3

11:40 &(Character/toChars 65)

11:40 lazybot: ⇒ #<char[] [C@bab86d>

11:40 m0smith_: does not work in my repl

11:42 ljos: m0smith_ : ofc. Thank you. I didn't really think of that. It would still be quite nice if I didn't have to do that myself. :P

11:42 TimMc: m0smith_: What does *clojure-version* give you?

11:43 &(seq (Character/toChars 65))

11:43 lazybot: ⇒ (\A)

11:43 m0smith_: :major 1, :minor 3,:incremental 0

11:44 muhoo: &*clojure-version*

11:44 lazybot: ⇒ {:major 1, :minor 3, :incremental 0, :qualifier nil}

11:44 TimMc: And what happens in your REPL?

11:44 m0smith_: Characer/toChars gives me IllegalArguementException

11:44 tmciver: cast to long?

11:44 m0smith_: I am using swank in emacs

11:44 jeremyheilers: Are you sure your using toChars and not toChar?

11:45 tmciver: wasn't that a problem I've seen discussed here before?

11:45 jeremyheilers: ,(Character/toChar 65)

11:45 clojurebot: #<CompilerException java.lang.IllegalArgumentException: No matching method: toChar, compiling:(NO_SOURCE_PATH:0)>

11:45 m0smith_: toChars

11:46 ,(class 65)

11:46 clojurebot: java.lang.Long

11:46 dnolen: m0smith_: on 1.3.0, works for me.

11:46 m0smith_: could it be swank?

11:46 TimMc: tmciver: This doesn't have to do with longs/ints -- there would be a dispatch problem if it were.

11:47 dnolen: m0smith_: doubtful, why don't you paste the output from your repl somewhere?

11:48 m0smith_: pastebin?

11:48 TimMc: or refheap

11:48 tmciver: TimMc: dispatch? there's only one single-arg toChars method which takes an int.

11:49 TimMc: If you pass it a long, you'd get that exception, no?

11:49 TimMc: &(seq (Character/toChars (Long. 65)))

11:49 lazybot: ⇒ (\A)

11:49 TimMc: ^ I do not understand this

11:49 whoops, lunch

11:50 tmciver: Ha!

11:50 m0smith_: I changed from swank-clojure 1.3.3 to 1.3.4 and now it works

11:51 dnolen: m0smith_: oof

11:52 m0smith_: (char 200) still blows up though

11:52 muhoo: Raynes: thanks!! https://refheap.com/paste/437

11:56 stuartsierra: TimMc: Java chars are (mostly) UTF-16.

11:56 m0smith_: Ok, here is what I am trying to accomplish

11:57 stuartsierra: Unicode code points higher than 16 bit integers get represented as a pair of chars.

11:57 m0smith_: I have a byte array and I want to convert it into something similar to what emacs does with hexlify-buffer

11:58 which is print the hex for each byte and if the byte represents a printable char, print that as well

11:58 this should be a no-brainer

11:58 except type conversion of numbers is making me crazy

12:00 &(Character/toChars 65)

12:00 lazybot: ⇒ #<char[] [C@35672e>

12:00 m0smith_: works

12:00 (Character/toChars. 65)

12:01 &(Character/toChars. 65)

12:01 lazybot: java.lang.IllegalArgumentException: No matching method: toChars.

12:01 m0smith_: That is one of the problems

12:02 jeremyheilers: m0smitih_: The form with a dot at the end of it indicates a constructor call.

12:03 m0smith_: I was just looking it up. I do not know where I got the idea it was a static method call as well

12:03 jeremyheilers: nice

12:03 dnolen: m0smith_: it is a static method - not a constructor.

12:04 m0smith_: If you are using emacs and swank type \0200 and see if you go into the emacs debugger

12:04 \u0200

12:04 it seems to hate that character

12:05 dnolen: m0smith_: works just fine though it doesn't print at the REPL

12:07 m0smith_: \u0223?

12:08 dnolen: m0smith_: also doesn't print for me, but that's probably because of my Emacs settings

12:11 jcro: hi

12:12 is it useful to define protocols for various "components" of a business domain model?

12:13 even if I don't use records, and just use maps, or some other structure?

12:14 bah, every time I set out to design something big in Clojure I get paralyzed by the array of choices

12:14 dnolen: jcro: protocols w/o types/records doesn't make much sense.

12:14 jcro: don't overthink it, write some functions, use maps.

12:14 drewr: jcro: use the simplest thing that works (in clojure that usually means maps)

12:14 jcro: :P rigth

12:14 right

12:15 I am trying to come up with a strategy to build a decently functional system and then tie it into our existing (quite nasty) DB

12:15 I don't want to just create ORM mappings between the DB and business objects

12:17 but I'm also having a hard time imagining how to model our domain without going to the DB

12:17 like, how can I worry about the DB later?

12:18 m0smith_: I have a project that maps Hibernate to clojure

12:18 it uses maps to represent the "entities"

12:20 dnolen: jcro: should be simpler, right? Clojure avoids the ORM problem entirely, you just have maps.

12:20 jcro: I wonder if I can do it in a way that avoids keeping the whole model in memory

12:23 I guess I need to write a repository layer that can be swapped for the ugly DB later?

12:37 technomancy_: clgv: slime has pretty good tracing facilities built in: C-c C-t

12:37 that plus swank.core/break means I only reach for cdt in times of great distress

12:38 clgv: technomancy_: what does C-c C-t do?

12:38 technomancy_: it toggles tracing on a given defn

12:39 clgv: technomancy_: ah ok. do you have an example for the trace output? link to an example/blogentry...?

12:40 technomancy_: not off the top of my head; just try it

12:40 Bronsa: wtf

12:40 clgv: ok

12:41 Bronsa: telecom network is crashing in the whole italy

12:41 TimMc: jcro: memory-mapped maps?

12:41 Bronsa: They accidentally the whole Italy?

12:42 Bronsa: yeah :(

12:42 TimMc: You're still online...

12:42 jcro: TimMc: interesting idea

12:42 Bronsa: TimMc: just got back

12:42 jcro: TimMc: I'm also looking into the Domain-Driven Design material

12:43 which seems to be pretty friendly to FP

12:43 TimMc: jcro: Totally messes with the immutability thing...

12:43 jcro: TimMc: what does? DDD?

12:43 TimMc: Maps backed by databases.

12:43 jcro: yeah

12:43 TimMc: Unless you have persistent databases, like Nathan Marz explained.

12:44 persistent persistence :-)

12:44 jcro: that would be nice

12:44 I think I'll end up with a "root" object representing a client/organization

12:44 and it would act like a ref

12:44 TimMc: ah, nice

12:44 jcro: or just be a ref

12:45 TimMc: What about references to old versions? Could be a problem...

12:45 jcro: I guess I'll need some revision number

12:45 TimMc: and you'll need to let the DB know when it is OK to GC.

12:45 jcro: Transients, maybe?

12:46 I think they throw on access to old verisons.

12:46 versions, even

12:47 I think there are some serious problems here.

12:48 dnolen: jcro: have you seen Out of the Tarpit?

12:49 glob157: im a little concerned about all the clojureScript traffic i feel like its making it harder to learn the fundamentals of functional/lisp style programming - because its so heavily focused on the side effects of web ui, javascript, etc.

12:50 dnolen: glob157: Clojure is about managing side effects, functional programming is one aspect of that story

12:50 jcro: dnolen: yes, but I have never seen a good implementation

12:50 dnolen: or anything even close to one

12:51 tmciver: dnolen: I have not seen it. What is it?

12:51 dnolen: tmciver: an interesting paper

12:51 tmciver: dnolen: link? or just google it?

12:52 dnolen: tmciver: google it :)

12:53 tmciver: ah, by Moseley and Marks, 2006?

12:53 TimMc: The "Tar Pit" being a reference to MMM?

12:54 jcro: TimMc: yes

12:55 I think certian principles are more easily applied than the entire proposal

12:55 jimduey: That paper is great. I'm thinking you could implement it in clojure pretty easily, if you were of a mind to.

12:55 technomancy: the first half of the paper is awesome. the second half is merely interesting.

12:57 faust45: which paper?

12:57 tmciver: faust45: http://web.mac.com/ben_moseley/frp/paper-v1_01.pdf

12:58 faust45: its about functional approach?

12:58 technomancy: clojurebot: out of the tarpit?

12:58 clojurebot: Out of the Tarpit is a short, accessible paper on FP and reducing complexity by identifying and minimising state: http://ben.moseley.name/frp/paper-v1_01.pdf

12:59 technomancy: clojurebot: botsnack

12:59 clojurebot: Thanks! Can I have chocolate next time

12:59 muhoo: wow, it seems like rich hickey got a lot of stuff from that paper

12:59 faust45: interesting clojurebot is a bot? or not

13:00 hi ask my question O_0

13:00 he answer my question

13:00 i mean

13:00 TimMc: faust45: Everyone in here is a bot except for you.

13:00 dnolen: muhoo: rhickey got a lot of things from a lot of papers

13:00 faust45: TimMc: huh , good

13:04 glib: Hello, I have been studying clujure and I am wondering how to prpeperly create and denote an anonymous function?

13:04 Please help

13:04 Philip__: Well, if you are in chrome, you are going to type in ctrl-shift n and then your function will be created

13:04 however,

13:04 if you are in firefox the clojure language changes

13:04 so...

13:04 i suggest setting your default browswer to chrome in order to use clojure correctly

13:04 glib: im on ie6 however

13:05 dnolen: glib: (fn [] ...)

13:05 glib: but thanks anyway!!!

13:05 Philip__: dnolen please stop trolling

13:05 smokecfh: is Seesaw the most mature swing-wrapper for clojure?

13:05 Philip__: this is supposed to be a channel to help people

13:06 dnolen: I suggest ignoring Philip__

13:06 glib: Why?

13:06 clojurebot: http://clojure.org/rationale

13:07 muhoo: glib: anonymous functiosn are fn http://clojure.org/special_forms#Special%20Forms--%28fn%20name?%20[params*%20]%20exprs*%29

13:08 babilen: glib: You can also use a reader macro #(...) - http://clojure.org/reader#The%20Reader--Macro%20characters

13:08 muhoo: hm, does the bot do docs?

13:09 ,fn

13:09 clojurebot: #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/fn, compiling:(NO_SOURCE_PATH:0)>

13:09 tmciver: ,(doc fn)

13:09 clojurebot: "([& sigs]); params => positional-params* , or positional-params* & next-param positional-param => binding-form next-param => binding-form name => symbol Defines a function"

13:09 muhoo: &(doc ffn)

13:09 lazybot: java.lang.RuntimeException: Unable to resolve var: ffn in this context

13:09 muhoo: &(doc fn)

13:09 lazybot: ⇒ "Macro ([& sigs]); params => positional-params* , or positional-params* & next-param positional-param => binding-form next-param => binding-form name => symbol Defines a function"

13:09 muhoo: ,(doc fn)

13:09 clojurebot: "([& sigs]); params => positional-params* , or positional-params* & next-param positional-param => binding-form next-param => binding-form name => symbol Defines a function"

13:09 muhoo: terse, but helpful

13:10 * dnolen actually finds the now daily appearance of trolls a relief - the fruits of success

13:12 babilen: More ops would help -- This channel's access list is a bit, well, short. Maybe clojure/core members or something :-/

13:12 chouser: I'm not always paying attention, but PMs to me about trolls may sometimes bare fruit.

13:12 mabes: C-c C-t for tracing in slime is pretty sweet... yay for lurking the IRC channel :)

13:13 chouser: bear

13:13 erewhon: bare fruit!?

13:13 chouser: sorry

13:13 erewhon: heh

13:13 tmciver: Mmm, bear fruit!

13:13 TimMc: dnolen: Kind of like how spam lets you know your mail provider is working?

13:13 muhoo: is it straightforward to have slime connect to a swank on a remote machine?

13:14 TimMc: tmciver: Haha, I went the same place.

13:14 mabes: muhoo: I always ssh tunnel and connect to my local host on the forwarded port.. works like a charm

13:15 babilen: chouser: PM ok? (re: ops)

13:15 technomancy: muhoo: in the next version of clojure-mode you just might be able to do M-x clojure-jack-in over tramp

13:15 World_of_Warcraf: Hello what is the best clojure REPL?

13:15 TimMc: speaking of which...

13:15 muhoo: technomancy: thanks. i looked at the code to clojure-jack-in and it looked like localhost was hardcoded in.

13:16 WorldOfWarcraftT: how do u define a value in clojure i want yourmom to be equal to 7

13:16 TimMc: chouser: ^ case in point, high schooler brought in unwisely by zmaril

13:16 World_of_Warcraf: it goes yourmom ==== "&&7&&" that might work im a little rusty

13:16 tmciver: Philip_, is that you?

13:17 pandeiro: how do i set a ring session using the default memory-store provided by ring.middleware.session.store from within a compojure route?

13:18 tmciver: muhoo: I think you can connect to a remote swank session via 'slime-connect'

13:19 muhoo: ok, i have to try it. right now i'm just using comint-mode via telnet to an ssh-forwarded connection to the lein repl on the remote

13:19 chouser: babilen: yeah, PMing me about ops stuff is fine

13:19 muhoo: it's time i try all this slime/swank goodness people are raving about

13:37 smokecfh`: does emacs/slime have code completion on keywords? i had expected that (when using seesaw) :monospaced could be completed from :m M-tab

13:39 technomancy: smokecfh`: keywords can be arbitrarily named, so using slime for completing them doesn't make sense. you can use dabbrev to search for similarly-named keywords present in other buffers though

13:39 usually M-/

13:39 muhoo: smokecfh`: there's always M-/

13:40 (well, not always, if you rebind it)

13:40 what's the clojure-ish to reconcile databases with the STM?

13:40 smokecfh`: hm.

13:40 faust45: i try implement custom behavior for ISeq http://friendpaste.com/2relveMN9ZAf1yUR6LjYxu

13:41 but in repl i got error

13:41 IllegalArgumentException No matching field found: SeqFly for class java.lang.String clojure.lang.Reflector.getInstanceField (Reflector.java:289)

13:41 for user=> (.toString (.SeqFly "cool"))

13:41 whats i am doing wrong?

13:45 TimMc: faust45: .foo is a method call, foo. is a constructor call

13:46 faust45: user=> (.toString (SeqFly. "cool"))

13:46 TimMc: faust45: You're doing the Java equivalent of "cool".SeqFly().toString()

13:46 faust45: CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: SeqFly, compiling:(NO_SOURCE_PATH:65)

13:46 TimMc: faust45: And now your problem is that you haven't import'd the class.

13:46 (guessing)

13:47 faust45: but i have this declaration http://friendpaste.com/2relveMN9ZAf1yUR6LjYxu

13:47 muhoo: wow, cool, http://stackoverflow.com/questions/4522796/how-should-i-make-a-clojure-stm-program-persistent

13:47 TimMc: Yes, and your repl's namespace doesn't know about that JVM class yet. import.

13:47 franks: technomancy: making up some random filename, passing that to a function, then checking whether that filename was ever used to make an actual file and if so trampoline into that one... you are one nasty hacker! ;-)

13:48 faust45: TimMc: hm

13:48 technomancy: franks: trust me; I only resorted to that after exhausting all other possibilities =)

13:48 could probably use a few more comments though!

13:49 faust45: TimMc: this is my source http://friendpaste.com/5FHstkUHvAm9Jqhdmw8TXN i use lein repl

13:49 TimMc: and user=> (use 'test.core :reload-all)

13:49 franks: technomancy: very creative though... comments would be nice to guide a casual coder thru your brain-twists ;-)

13:50 faust45: TimMc: i am confused why repl couldn't resolve my class SeqFly

13:50 * technomancy muses on "literate bash"

13:50 TimMc: faust45: 'use is not enough when it comes to classes. You're doing interop; you'll need import.

13:51 franks: technomancy: (good thing you didn't use perl...)

13:52 faust45: TimMc: thanks, looks good (import '(test.core SeqFly))

13:52 TimMc: good

13:53 Huh. Within 24 hours I have seen three different people do "nick: (side-comment in parens)". I haven't seen that construction in IRC before. I suppose it's just another grammatical meme.

13:54 tavis: TimMc: ((oddly appropriate here))

13:54 franks: technomancy: submitted a 3rd iteration pull-request for lein - pls take a look when you have a moment

13:55 technomancy: sure, thanks

14:06 TimMc: I wonder if there are more open or close parens in this channel. There are those people who don't bother closing sample expressions, but there are also emoticons.

14:09 OK, that's 64428 open and 73059 close in my logs.

14:09 I don't know why I did that.

14:09 jeremyheilers: TimMc: I would guess emoticons would win (and they did lol)

14:09 It's a cool random stat :-P

14:09 TimMc: That was just (count (filter #{\(} (slurp "..."))) for each. Nice.

14:10 tavis: maybe the bots should be trained as parens enforcers

14:11 TimMc: :-()

14:11 duck1123: By the time someone posts a simley, it's too late to open it. :(

14:12 tavis: bot replies )

14:12 tmciver: The bots could enforce non-emoticon parens.

14:12 TimMc: THat would be even more irritating than clojurebot.

14:12 tmciver: We should expect nothing less in this channel.

14:12 TimMc: tavis: ^

14:13 duck1123: That was one of the reasons I loved XQuery. it used (: and :) to delimit comments. Such a friendly language

14:15 muhoo: what are people using for dom stuff in clojurescript?

14:15 m0smith_: thanks for you help this morning. I got my hexlify working: https://gist.github.com/1684476

14:15 llasram: muhoo: All the people using clojurescript so far are subs. I'll be here all night, folks!

14:16 (Sorry, don't actually know.)

14:16 gtrak``: domina, I think it's called?

14:17 https://github.com/levand/domina

14:17 muhoo: gtrak``: thanks

14:18 TimMc: llasram: Terrible.

14:18 technomancy: IIRC you can use jquery if you set up externals

14:18 supposedly it's not as nice, but if it's familiar it may be easier to start out with

14:18 muhoo: i already am used to jquery, but it seems there's no advanced mode compilation for it

14:19 technomancy: muhoo: you can still make it work; maybe bug ibdknox about it when he comes online.

14:19 muhoo: there seems to be dojo and mochikit, both of which i haven't touched since 2006

14:19 technomancy: thanks

14:19 tsdh: Does anyone know if the parser combinators Nate Young demonstrates in his strangeloop talk are available from somewhere?

14:21 gtrak``: yes

14:21 let me give a look

14:21 technomancy: parsatron, innit?

14:21 gtrak``: https://github.com/youngnh/parsatron

14:22 tsdh: technomancy: Oh, yes.

14:22 Great, thank you.

14:22 Cool name, btw.

14:22 gtrak``: he's a pretty creative guy

14:23 technomancy: I wonder if he gets any "Young Neil" jokes from Scott Pilgrim fans.

14:23 oh, the project's name... yeah, that's cool too.

14:26 dnolen: http://dosync.posterous.com/comparing-javascript-coffeescript-clojurescri

14:26 first blog post in a long time, please upvote on HN if you got a second, thx

14:28 gtrak``: sp error, abstration

14:28 dnolen: gtrak``: thx

14:30 tsdh: dnolen: Nice post.

14:30 dnolen: tsdh: thx!

14:30 tsdh: dnolen: And what's HN, and how do I upvote?

14:31 muhoo: dnolen: "haven't had this much fun", i agree

14:31 dnolen: tsdh: Hacker News

14:31 tsdh: But not this one, right? http://www.hackernews.com/

14:31 gtrak``: dnolen: when you submitted my ruby/python/clojure post to HN, I got 4k views :-)

14:32 tsdh: http://news.ycombinator.com/ ?

14:32 TimMc: yeah

14:33 tsdh: Ok, the eagle has not yet landed. :-)

14:33 dnolen: http://news.ycombinator.com/new

14:33 gtrak``: //newest

14:34 tavis: dnolen: have you ever played with slices in R?

14:35 dnolen: tavis: no I haven't use R much, though the slices aspect is really just about using objects as fns :)

14:35 jeremyheilers: dnolen: great blog post -- i look forward to using clojurescript in the near future.

14:37 tavis: yeah, I like that. Great post. It just made me think of the polymorphic behaviour of indices/slices in R. They're multimethods under the hood and R libraries make some great use out of them.

14:37 same with numpy in Python

14:40 phil: clojurebot: botsnack

14:40 clojurebot: Thanks, but I prefer chocolate

14:40 arkh: In ClojureScript One, why would 'lein repl' work but a clojure-jack-in repl need a namespace qualification before working?

14:41 gtrak``: clojurebot: have some chocolate, then

14:41 clojurebot: Pardon?

14:41 phil: clojurebot: chocolate

14:41 clojurebot: It's greek to me.

14:41 tavis: clojurebot: swiss is better

14:41 clojurebot: You don't have to tell me twice.

14:41 phil: ,(println "Thank you sir.")

14:41 clojurebot: Thank you sir.

14:41 phil: clojurebot: no problem

14:41 clojurebot: excusez-moi

14:41 phil: lol

14:42 amalloy: clojurebot: swiss?

14:42 clojurebot: swiss is better

14:46 smokecfh`: technomancy, muhoo: i've managed to get the auto-completion i want with ac-slime

14:47 ferd: Anybody playing with ClojureScript(One) on a mobile device (iPhone/Android) ? Anything preventing that?

14:47 clojurebot: Cool story bro.

14:51 gtrak``: ferd: compiling from android, or browsing the result?

14:52 or something else

15:05 chewbranca: dnolen: fun article, very interesting to see protocols in action with javascript

15:06 dnolen: any thoughts on whether that would work well for adding extensions to existing javascript libraries? ie could you piggy back on objects created in backbone.js or google maps or anything else?

15:06 ferd: gtrak``: I mean, having the app running on the device, connecting to it from Emacs on my laptop

15:10 brehaut: chewbranca: you can safely implement protocols for the core javascirpt types (object, array, string etc) and thats normally verboten. i would imagine that backbone or google stuff would be fine too

15:11 chewbranca: brehaut: interesting

15:11 brehaut: chewbranca: if i understand how it works correctly, clojurescript stashes namespaced protocol implementations in the types _constructor_ rather than its prototype

15:12 which means it wont bleed into instances via prototypal inheritance and the namespacing avoids collisions

15:12 chewbranca: I need to play around with clojurescript more, but I'm very curious to see how well the interop is for existing libs, I've seen some examples of calling out jquery methods and what not, but being able to use protocols to extend objects of third party libs is very intriguing

15:12 brehaut: likewise

15:12 * technomancy heard you could call seq on jquery selectors

15:13 brehaut: wow. jquery without the argument order confusion

15:13 chewbranca: technomancy: is that actually lazy though? seems like it could be problematic if it does the full load of everything

15:14 technomancy: no idea; it's just a rumor

15:14 ieure: Can someone explain what I'm doing wrong with this gen-class usage, please? https://gist.github.com/dae8f53f89388e8e1b76

15:14 brehaut: chewbranca: the jquery selector would be just as strict as always, but any computation based on it would still be lazy; just like seq on a vector

15:14 hmm. vector might be a bad example

15:14 ieure: Alternately, if someone knows how to make (proxy) and lein's :main play nicely together, I think that is a viable alternative.

15:15 amalloy: ieure: you want the gen-class inside of the ns

15:15 maybe some other changes are needed, i dunno; i don't really do that

15:15 technomancy: TimMc: I believe you're the man ieure needs to speak with.

15:15 did you end up renaming your uberjit thingy?

15:15 TimMc: hrm?

15:15 lein-jit

15:15 technomancy: Although now I want to rename it lein-otf, for on-the-fly

15:16 ieure: amalloy, Non-obvious from my example, but that is not an option for what I actually want to do.

15:16 technomancy: TimMc: yeah, I like otf a lot better

15:16 TimMc: since "JIT" is a confusing name

15:16 ieure: amalloy, Or do you mean I need a :gen-class in there as well?

15:16 TimMc: Maybe I'll do it and piss off the people who rely on it...

15:16 amalloy: ieure: i think your example makes no sense. i can't tell what you're trying to do, much less how you should do it

15:17 chewbranca: I wonder if you could seq on events, that would be cool. I was reading clojure in action a recently and I liked how he created a lazy seq on a rabbitmq queue so that you could just lazy listen on the seq for messages to come in, would be very cool to be able to do something similar with events

15:17 TimMc: ieure: Are you just trying to get something that can be called with java -jar, or do you really need a specific classname for that namespace?

15:18 ieure: amalloy, I am trying to create a Clojure wrapper for Dropwizard; I need to extend Dropwizard's Service class, and have that end up as the mainClass that gets set in the pom.

15:18 I want to write e.g. (defservice blah), which I don't think works with putting my class stuff in the (ns ) block.

15:19 brehaut: chewbranca: have a look at microsofts Rx linq extensions to jquery

15:19 muhoo: i remember seeing a macro or function that basically does this : (reduce #(str %1 " " %2) stuff) , but i don't remember the name of it

15:19 brehaut: chewbranca: erik meijer has done some stuff about reactive programming on jquery

15:19 (as well as in .net with C#)

15:19 TimMc: muhoo: interpose

15:19 muhoo: TimMc: thas

15:19 TimMc: muhoo: string join, actually

15:20 gtrak``: ferd: perhaps, but i imagine it would be hard, plus I think the working android clojure is 1.2 and cljs requires 1.3?

15:20 chewbranca: brehaut: oh fun, checking that out now

15:20 TimMc: ,(do (require 'clojure.string :as 's) s/join)

15:20 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.Symbol>

15:20 TimMc: oops

15:20 gtrak``: and in general I think getting clojure to work at all on android was quite an accomplishment, don't know how far it can go

15:20 amalloy: TimMc: that wouldn't work even if you had the syntax right, i think. not sure, i guess

15:20 TimMc: it would

15:21 amalloy: ,(do (require '[clojure.string :as s]) (s/join " " [1 2 3]))

15:21 clojurebot: "1 2 3"

15:21 amalloy: okay, you win

15:21 muhoo: oh it works on android

15:21 TimMc: \o/

15:21 muhoo: it just takes up like 4mb or something, IIRC

15:21 i tried clojure, kawa, and one other i forget, on android, last year

15:22 TimMc: ,(do (require '[clojure.string :as s]) (s/join (range 10) ", ")) ; amalloy, look what happens if you accidentally reverse the args

15:22 clojurebot: ",clojure.lang.LazySeq@9ebadac6 "

15:22 technomancy: mirah on android is OK if you can survive without a repl

15:22 (I can't)

15:22 TimMc: pretty slick, in a way

15:22 amalloy: or, not slick at all? you be the judge

15:24 ieure: Okay, maybe someone can explain this: (do (import [com.yammer.dropwizard Service]) (proxy [Service] ["x"])) -> java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType

15:25 benares_98: chewbranca: I haven't gone through this completely but it maybe relevant http://www.infoq.com/presentations/Event-Driven-Programming-in-Clojure

15:25 ieure: Service takes a type param, which seems like it might be what's up. But I thought those were ignored in Clojure.

15:26 TimMc: ieure: I'm pretty sure your first statement in that 'do is wrong.

15:26 'import outside of an 'ns form needs to have its args quoted

15:27 chewbranca: benares_98: fun link, I'll check it out but I was talking more about event driven programming in clojurescript, not sure how much ports over

15:28 ieure: TimMc, Works in the repl. Import's args are in a vector. But that is not relevant to my question.

15:29 ,(import [java.io InputStream])

15:29 clojurebot: java.io.InputStream

15:29 muhoo: ,(do (require '[clojure.string :as s]) (seq (s/join (range 10) ", ")))

15:29 clojurebot: (\, \c \l \o \j ...)

15:29 muhoo: more readable

15:30 wait, what?

15:31 wtf is that thing actually doing?

15:31 ieure: muhoo, Turning it into a seq of characters.

15:31 ,(seq "abc")

15:31 clojurebot: (\a \b \c)

15:32 muhoo: i mean the (s/join (range 10) ", ")

15:32 tmciver: muhoo: you've swapped the args to s/join

15:32 muhoo: oh

15:33 ,(do (require '[clojure.string :as s]) (s/join ", " (range 10))))

15:33 clojurebot: "0, 1, 2, 3, 4, 5, 6, 7, 8, 9"

15:33 brehaut: you dont need to keep requiring namespaces with the bots

15:34 ,(s/join "," (range 10))

15:34 clojurebot: "0,1,2,3,4,5,6,7,8,9"

15:34 muhoo: nice

15:34 what happens if the ns gets clobbered in the bot?

15:34 hiredman: brehaut: well, safebot resets every 10 minutes or so

15:34 brehaut: the bots recycle their evaluation contexts somewhat regularly

15:34 hiredman: clojurebot

15:35 amalloy: brehaut: lazybot doesn't

15:35 hiredman: (there is no safebot)

15:35 amalloy: haha i was wondering who safebot was

15:35 muhoo: safebot is hiding

15:35 somewhere safe.

15:35 hiredman: safebot is the instance of clojurebot we have at work

15:36 amalloy: ah. sensible. what does he do that's different? a non-sandboxed mode, i'd guess; anything else?

15:36 hiredman: no, still sandboxed

15:36 has some github and ci integration

15:36 brehaut: is it short for safe-from-muppets-bot

15:36 muhoo: muppets?

15:37 kermit the frog is sending forms to a clojure bot?

15:37 hiredman: safe is just the name of the project

15:37 brehaut: thats an angloism isnt it?

15:37 muppet = idiot

15:38 amalloy: brehaut: yeah, i only ever hear it from english folks. apparently kiwis too

15:39 Raynes: brehaut: lazybot doesn't recycle his evaluation context because clojail keeps it from being changed.

15:39 amalloy: uhhhh, except for use/require/refer

15:39 Raynes: brehaut: Though a better solution would probably be to just give everybody their own namespace and reset them every once in a while.

15:39 amalloy: Yeah, that's *your* fault. I've been wanting to get rid of use for forever.

15:45 TimMc: ieure: Ah, I didn't realize 'import is a macro, unlike 'require and 'use: ##(.isMacro #'import)

15:45 lazybot: java.lang.SecurityException: You tripped the alarm! class clojure.lang.Var is bad!

15:45 TimMc: pffft

15:45 ,(.isMacro #'import) ; let's use unsafebot

15:45 clojurebot: true

15:51 amalloy: &(-> import var meta :macro)

15:51 lazybot: ⇒ true

15:54 TimMc: amalloy: Calling a method directly on a forbidden class is the bad part?

15:55 gtrak``: maybe the fact that it's a reader macro?

15:55 &(.isMacro (var import))

15:55 lazybot: java.lang.SecurityException: You tripped the alarm! class clojure.lang.Var is bad!

15:55 amalloy: right. you can call as many functions on an object as you want; if the functions are dangerous we blacklist them instead. but for interop, it's safer to just say "don't do it"

15:56 gtrak``: ahh

15:56 TimMc: How do you know that it is being called on Var?

15:58 amalloy: TimMc: (.isMacro x) gets changed to (dot x isMacro), where dot is a macro we use that inserts a bunch of safety checks

15:58 TimMc: Ah! Clever.

15:59 Ashii: i'm kind of new here, and i got intrested of clojure after hearing so much talk about it, what is it about? i've been reading on webpage but.. i can't comprehend if its new or not

15:59 muhoo: whomever wrote (pp), i've wished for it for years in repls of various kinds

15:59 TimMc: &(dot 4 toString)

15:59 lazybot: ⇒ "4"

15:59 Ashii: is there any good intro videos for clojure?

16:00 TimMc: Ashii: Simple Made Easy is pretty good.

16:00 muhoo: Ashii: all the blip.tv talks by rich hickey

16:00 Ashii: ty :)

16:00 muhoo: http://blip.tv/clojure

16:03 TimMc: Ashii: Clojure takes a whole bunch of great ideas from Lisp but also features some really great abstractions that were totally missing. Also, there's the whole bi-directional interop with Java, which is a big boost.

16:06 muhoo: i think i'm weird. i find (:macro (meta (var import))) easier to read than (-> import var meta :macro)

16:08 amalloy: well, that's because it's easier to read

16:08 the -> version was shorter to type

16:08 TimMc: muhoo: The var part is weird, because it's a macro.

16:09 amalloy: if i were aiming to make it most readable, maybe (:macro (-> #'import (meta)))

16:09 TimMc: &(-> 5 (if true false)) ; WTF

16:09 lazybot: ⇒ true

16:09 muhoo: oic, if i pretend there are .()'s between, it makes sense :-)

16:09 clj_newb: is there a way to atach java member fields to a proxy? (instead of just functions)

16:09 amalloy: ...TimMc, what is the WTF?

16:09 clj_newb: amalloy: !

16:09 amalloy: so great to see you again

16:09 amalloy: especially since I have a clojure question :-)

16:09 TimMc: amalloy: Just visually, I find it pretty fucked-up to "pass" stuff to a macro.

16:10 clj_newb: hmm; if I need extra fields

16:10 TimMc: It should be called a nesting macro, not a stitching macro.

16:10 clj_newb: maybe this is a time to use defType instead of proxy

16:11 muhoo: clj_newb: or just assoc, maybe

16:12 clj_newb: screw it; I think I can do this without state

16:12 * clj_newb puts on thinking cap

16:13 TimMc: woo

16:13 muhoo: i dunno, just having done enough lisp, when i see () my brain skips into (foo (bar (baz))) mode, and seeeing (-> baz bar foo) seems sdrawkcab to me

16:14 gtrak``: foo bar baz bar foo is a little less clear

16:14 TimMc: "chaining", that's it

16:15 gtrak``: i thought the -> was weird at first, but I like it now, there's also -?>

16:15 muhoo: wat?

16:15 -?> ?

16:15 gtrak``: null-safe threading

16:15 muhoo: um, how would i even look that up in the reference, i wonder

16:15 gtrak``: somewhere

16:15 TimMc: Eh, I dunno. I still feel that macros that quote or rearrange syntax shouldn't be used in ->

16:15 clj_newb: , (doc ->)

16:16 clojurebot: "([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."

16:16 clj_newb: ,(doc ->)

16:16 clojurebot: "([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."

16:16 tmciver: gtrak``: I felt the same way; much easier to read than the deeply-nested alternative.

16:16 muhoo: ,(doc -?>)

16:16 clojurebot: Excuse me?

16:16 muhoo: see

16:16 gtrak``: TimMc: you can always use the reduce variant

16:16 muhoo: ,(doc -?>)

16:16 clojurebot: I don't understand.

16:16 muhoo: ,(i SAID. DOES HE LOOK LIKE A -?>) ?

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

16:16 gtrak``: TimMc: http://blog.fogus.me/2010/09/28/thrush-in-clojure-redux/

16:17 TimMc: muhoo: http://symbolhound.com/?q=-%3F%3E

16:17 clj_newb: i want to define a function namned )

16:17 TimMc: muhoo: It's in monolithic contrib, unfortunately.

16:17 clj_newb: so it looks like () args ... )

16:18 muhoo: oh

16:18 it's a haskell-ism, i gather, based on that link

16:18 brehaut: its really not

16:19 comp is a much closer fit to what haskell does

16:20 TimMc: clj_newb: Try this in a REPL: (eval `(def ~(symbol ")") 5))

16:20 gtrak``: than reduce?

16:20 TimMc: clj_newb: and @(resolve (symbol "adhoc.core/)"))

16:21 That's as close as you're getting.

16:21 brehaut: gtrak``: oh i didnt see the link to fogus's article

16:21 TimMc: @(resolve (symbol ")")), rather

16:25 * muhoo is now in his 44th hour of clojure exploration

16:26 clj_newb: damn it; I feel like clojure is making me a better programmer day by day

16:26 muhoo: started keeping track of time, to see how long exactly it takes me to go from "wtf?" to "oh, i can do that, give me a minute or two"

16:26 clj_newb: muhoo: I have found that the time it takes me to do something in clojure is inversely porportional to how reponstive #clojure is

16:26 muhoo: that's nota good sign

16:27 i figure if i have to ask on irc, that means i failed at googling/studying/reading/thinking

16:27 which i do often, but still :-)

16:38 TimMc: or Clojure failed at documentation

16:45 ieure: If anyone is feeling helpful: http://stackoverflow.com/questions/9025882/extending-dropwizard-service-class-in-clojure

16:46 jaley: so... i just did ;; (time (dotimes [i 500000] (+ 1 2 3 4))) ; in a 1.2 and a 1.3 REPL, and it appears 1.3 is 50x faster o_O

16:50 brehaut: jaley: primatives vs boxed types

16:50 ztellman: jaley: micro benchmarks are the opiate of the masses

16:51 pjstadig: ztellman: especially on the JVM

16:51 jaley: ztellman: damn straight, i was much pleased

16:52 ztellman: do people know about https://github.com/hugoduncan/criterium ?

16:52 it injects some semblance of reality into these sorts of measurements

16:52 hiredman: neat

16:52 ztellman: I was pleased when I found it

16:53 technomancy: ,((vec (range 10)) 3 7)

16:53 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: PersistentVector>

16:53 technomancy: why doesn't that just subvec it up?

16:53 maybe because of GC issues we don't want to encourage subvec?

16:54 or maybe (like having negative numbers count backwards from the end) it's "just nutty"?

16:54 amalloy: i wouldn't be surprised to hear that nobody thought of it. but also it's less clear that subvec is ther ight behavior: maybe it should be ##(get (vec (range 10)) 3 7)

16:54 lazybot: ⇒ 3

16:56 technomancy: hmmm... I'm pretty sure making it work like c.c/get is the wrong thing, but maybe maintaining the parallel between .invoke and get is enough to disqualify subvec

16:56 brehaut: ,({:a 1} :b 2)

16:56 clojurebot: 2

16:57 sritchie: Raynes: can the default "lein new project-name" command take any extra arguments?

16:57 muhoo: get or take?

16:58 Raynes: sritchie: Possibly. I've purposely left it open so that it shouldn't be difficult to use it for general scaffolding purposes, so probably. If not, I'd accept a patch.

16:59 sritchie: Raynes: ah, never mind -- I was going to say that w/o lein-newnew on the classpath, something like "lein new noir project-name" works, just not as expected

16:59 technomancy: so how about this: javascript is CVS, coffeescript is svn, parenscript is monotone, and clojurescript is an early version of git?

17:00 sritchie: Raynes: looks like that creates a project called "noir" with a namespace of "project-name"

17:00 dnolen: technomancy: not bad

17:01 technomancy: or... parenscript might be darcs? I don't know.

17:01 muhoo: ,(get (vec (range 10)) 3 7

17:01 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

17:01 muhoo: ,(get (vec (range 10)) 3 7)

17:01 clojurebot: 3

17:01 muhoo: hm

17:01 sritchie: w/ lein-newnew on the classpath, you either get a new noir project, or a failure if the noir template isn't found

17:02 technomancy: need to get newnew to look on clojars for templates it can't find locally

17:03 muhoo: and what's jquery? bzr? hg?

17:03 Raynes: jquery is a library.

17:03 technomancy: I dunno; sourceforge?

17:03 Raynes: Not a programming language.

17:04 muhoo: part of the set of Things Which Attempt To Make Javascript Suck Less.

17:05 Raynes: sorry, i should have gone down the tree a level or two :-)

17:05 brehaut: i thought jquery was on github these days?

17:05 muhoo: analogy soup!

17:09 jcrossley3: can someone please clarify how with-redefs affects "all threads"? if i rebind say, 'str', does that mean every thread in the jvm sees that change even if not running the body of with-redefs?

17:09 hiredman: with-redefs isn't binding

17:10 it changes the value of the var and then changes it back at the end

17:10 technomancy: the root value, to be specific

17:10 jcrossley3: but if the fn i want to redefine isn't dynamic, i can't use binding, right?

17:10 hiredman: right

17:11 and with-redefs is not safe

17:11 technomancy: with-redefs is there primarily for testing purposes

17:11 hiredman: it should really only be used for testing

17:11 technomancy: jinx!

17:11 jcrossley3: so what's the right way to redefine a non-dynamic fn? :)

17:11 hiredman: "you owe me a coke"

17:11 jcrossley3: why do you want to do that?

17:12 jcrossley3: hiredman: it's complicated.

17:12 hiredman: well, so the first easy answer is "don't do that"

17:12 technomancy: changing the root value of a var is monkeypatching

17:12 * jcrossley3 waits for the next answer

17:13 technomancy: I'm going to go with "submit a pull request"

17:14 jcrossley3: monkeypatching gets a bad rap. monkeys are adorable!

17:14 technomancy: I think you can automate that these days with tentacles and pomegranate

17:14 brehaut: id prefer lemur patching

17:14 technomancy: how awesome would it be for a program to submit a pull request for its own dependencies, monitor the mailing list for a release announcement, and pull in the changed version via pomegranate?

17:14 (hint: so awesome)

17:15 tmciver: Ha!

17:15 jcrossley3: technomancy: so if i want to monkeypatch, i should use ruby or python instead of clojure?

17:15 technomancy: start filling out the :mailing-list field in your project.clj files, guys

17:15 jaley: and fix compatibility breaks itself

17:16 technomancy: well

17:17 hiredman: jcrossley3: you can do it

17:17 just know what you are doing

17:17 jcrossley3: hiredman: i'm listening

17:17 hiredman: like, if you don't know enough about clojure to know how to do it, I dunno if you qualify under "know what you are doing"

17:18 technomancy: it's akin to the rules of optimization: "rule 1: don't optimize. rule 2: (for experts only) don't optimize yet..." =)

17:18 hiredman: :|

17:19 technomancy: if you take a look at the source for with-redefs it might give you the hints you need

17:21 jcrossley3: hiredman: technomancy: thanks, i guess. :)

17:23 muhoo: is there a way to run lein commands from inside the repl?

17:24 Raynes: (require 'clojure.java.shell) (clojure.java.shell/sh "lein" "deps")

17:24 muhoo: heheh

17:24 Raynes: For even more fun, https://github.com/Raynes/conch

17:24 </shamelessplug>

17:24 technomancy: muhoo: your project runs in an isolated context from leiningen

17:25 muhoo: technomancy: that's kind of what i suspected, thanks

17:26 i'm trying to run "lein ring uberwar" to see if i can generate a war that'll run in tomcat (from a noir project)

17:26 and it says "That's not a task."

17:27 i pulled "lein ring uberwar" from fragments of many google search results, wasn't sure if it was going to actually work

17:28 Raynes: i can run a bash shell from inside clojure inside jvm inside emacs!

17:30 ah, i didn't have it iin dev-dependencies

17:30 scottj: muhoo: you can even run emacs from bash.

17:31 muhoo: hmm Exception in thread "main" java.lang.NullPointerException (NO_SOURCE_FILE:0)

17:31 AimHere: If you do that, it eliminates the need for hardware

17:32 muhoo: so, trying this lein ring uberwar trick, no luck so far

17:33 llasram: muhoo: uberwar not war ?

17:33 muhoo: so saith the internets

17:33 supposdly a uberwar will enable the noir app to run in tomcat not jetty

17:34 llasram: Ah, sorry. Only played with it and misremembered. Yes, uberwar

17:35 muhoo: and, indeed, lein ring help shows uberwar as a choice, so it's all installed. i have something else misconfigured, apparently.

17:40 jcrossley3: technomancy: hiredman: muhoo's use case is a great example!

17:41 why should he have to create a war to run his noir app in tomcat?

17:41 because noir makes assumptions about the current directory that aren't valid in tomcat

17:41 technomancy: weeeeelllll... I refer you to my comment about pull requests? =)

17:41 seriously though, monkeypatching at build time can be appropriate

17:42 it's in production contexts where you need to be more vigilant

17:43 hiredman: jcrossley3: I have no problem with monkey patching as long as you enough about what you are doing to be responsible for it, instead of "oh I have this magic thing that makes what I want work"

17:43 if you can explain it in terms other than "it's magic" (or similar) go ahead

17:43 jcrossley3: technomancy: why not runtime? i can envision ring middleware to "monkeypatch/decorate/whatever" io/file to resolve relative to the app root or delegate to the *real* io/file if it can't find it.

17:44 hiredman: jcrossley3: that is pretty horrible

17:44 jcrossley3: horribler than forcing the creation of a war file?

17:44 hiredman: no

17:45 but the silent change of behavior solution to that problem

17:45 jcrossley3: horribler than forcing noir to always use absolute paths?

17:45 hiredman: you should provide a (get-app-root) that the functions can use if they want

17:45 jcrossley3: hiredman: i agree it requires care, and done poorly, could piss someone off.

17:45 but it also could be a huge help

17:46 hiredman: but then noir would have to use that!

17:46 hiredman: sure

17:46 and it would be more flexible and useful for it

17:47 technomancy: jcrossley3: well, the thing about middleware is that it's explicitly inserting a layer in there you can inspect

17:47 faust45: i just try this code http://friendpaste.com/3wUpitsB3SPO0HsJmQcuql

17:47 and run in repl

17:47 user=> (some-seq '())

17:47 but got error

17:47 IllegalArgumentException No implementation of method: :some-seq of protocol: #'test.core/Some found for class: clojure.lang.PersistentList$EmptyList clojure.core/-cache-protocol-fn (core_deftype.clj:495)

17:47 user=>

17:47 technomancy: the problem with monkeypatching is that it modifies something at a distance, and you have no way of tracking it down

17:48 faust45: can any one help me?

17:48 technomancy: middleware is explicitly composable

17:48 hiredman: well, middleware doesn't modify anything

17:48 technomancy: ah, quite

17:48 hiredman: it returns a new thing with different behavior

17:48 jcrossley3: y'all are referring to ring middleware specifically, right?

17:49 hiredman: I am yes

17:50 jcrossley3: hiredman: so it sounds like you're suggesting the best course is to change noir to use absolute paths?

17:50 hiredman: no, I am not

17:50 I have not suggested any changes to noir

17:51 faust45: can any one suggest whats wrong with this code ? http://friendpaste.com/3wUpitsB3SPO0HsJmQcuql

17:51 hiredman: I have just said that your changes sound horrible

17:51 faust45: please

17:51 technomancy: (that was me suggesting the patching, albeit not having a firm grasp on the problem at hand)

17:52 hiredman: 53.215 jcrossley3 technomancy: why not runtime? i can envision ring middleware to "monkeypatch/decorate/whatever" io/file to resolve relative to the app root or delegate to the *real* io/file if it can't find it.

17:52 looks like jcrossley3 suggesting it to me

17:54 jcrossley3: hiredman: so what would your approach be to the problem of allowing a noir app to be deployed to tomcat (or let's say... immutant ;) where it sits on disk, without having to go through the annoying step of war file creation?

17:56 hiredman: jcrossley3: I am not familiar enough with the code to say, but as someone who uses clojure.java.io a lot I would be very annoyed if someone changed the behaviour out from under me

17:56 amalloy: faust45: i guess what's wrong with it is that you haven't posted enough code to guess at what you're trying to do

17:56 so far, it all seems correct, if a little weird

17:56 devn: anyone use test.generative?

17:57 jcrossley3: hiredman: even if only changed/bound for the short duration of creating the noir handler?

17:57 devn: is it anything like quickcheck?

17:57 faust45: amalloy: i just find out ) i was typo error in name same-seq must be some-seq

17:58 is it possible define Protocols in this way http://friendpaste.com/4bxhUYkpQDdd6minNK3nO0

17:58 ?

17:58 technomancy: devn: haven't used it, but I hear its goal is to be quickcheck-ish

17:58 Raynes: Wow. The pastebins people find…

18:02 faust45: is it possible define method with diff num arguments for Protocol?

18:06 jkkramer: ,(doc defprotocol)

18:06 clojurebot: "([name & opts+sigs]); A protocol is a named set of named methods and their signatures: (defprotocol AProtocolName ;optional doc string \"A doc string for AProtocol abstraction\" ;method signatures (bar [this a b] \"bar docs\") (baz [this a] [this a b] [this a b c] \"baz docs\")) No implementations are provided. Docs can be specified for the protocol overall and for each method. The above yields a...

18:06 jkkramer: faust45: ^

18:08 Raynes: jkkramer: ##(doc defprotocol)

18:08 lazybot: ⇒ "Macro ([name & opts+sigs]); A protocol is a named set of named methods and their signatures: (defprotocol AProtocolName ;optional doc string \"A doc string for AProtocol abstraction\" ;method signatures (bar [this a b] \"bar docs\") (baz [this a] [this a b] [this a ... https://refheap.com/paste/439

18:08 Raynes: Point being: lazybot pastes.

18:08 And word wraps terribly, but you can't have your cake and eat it too.

18:09 faust45: clojurebot: thanks man )

18:09 clojurebot: Gabh mo leithscéal?

18:09 jkkramer: I can never remember which uses , or ## or &

18:09 Raynes: jkkramer: & is for code at the beginning of a line. ## is for code embedded in a message. , is for clojurebot.

18:09 jkkramer: i know, i just mean which bot is which

18:09 Raynes: One is lazy, the other isn't.

18:10 Not hard.

18:10 ;)

18:10 TimMc: jkkramer: clojurebot got the cool eval-trigger, but lazybot doesn't suck

18:10 amalloy: ~guards

18:10 clojurebot: SEIZE HIM!

18:10 TimMc: haha

18:11 Raynes: TimMc: funfact: , works for lazybot in every channel except for this one.

18:11 technomancy: it's worse if you hang out in #emacs, because , triggers factoids in there

18:13 TimMc: Raynes: I noticed!

18:16 jcrossley3: technomancy: so because with-redefs sets the root binding, it's useless if the thing you're redefining has a thread-local binding, right?

18:17 cemerick: technomancy: that's a fabulous write-up

18:17 technomancy: jcrossley3: correct; it will be shadowed by binding

18:17 cemerick: thanks!

18:17 just trying to distill all the "yeah, don't do that" moments I've had so far =)

18:19 TimMc: link?

18:19 technomancy: https://github.com/technomancy/leiningen/wiki/Repeatability

18:19 TimMc: clojurebot shut up

18:20 Oh hey, it didn't even try.

18:20 jondot2: hey guys - if anyone read both of these - what should i go for - clojure in action or 'the joy of clojure' ?

18:23 sorenmacbeth: technomancy: what's the recommended proceduce to keep -SNAPSHOT versions of lein plugins up to date?

18:23 AimHere: Does "The Joy of Clojure" have charcoal drawings of bearded hippy Clojure hackers doing clojure in various different positions, because, if so, that

18:24 technomancy: sorenmacbeth: hmm; what's the context?

18:24 you mean like third-party plugins, or stuff you're developing internally?

18:24 sorenmacbeth: third-party, swank-clojure in this particular context

18:25 technomancy: right now I occasionally do a lein plugin uninstall, followed by a lein plugin install

18:25 technomancy: sorenmacbeth: swank-clojure and other user-convenience plugins kind of stand outside that whole "build-as-a-function" metaphor

18:25 if it doesn't reflect the output of the build, the repeatability concerns don't really apply

18:27 sorenmacbeth: so just do the uninstall, install dance then?

18:27 technomancy: oh, sorry; no I think I fixed the bug where you had to do a manual uninstall first

18:27 just do install again

18:28 sorenmacbeth: lein2 will allow you to just declare it in a user-level profile that's applied across the board

18:28 rather than having a plugins directory

18:28 jondot2: AimHere, hmm?

18:29 sorenmacbeth: technomancy: nice, I like that

18:29 technomancy: the lein2 bit I mean

18:29 technomancy: it's pretty close to being ready to try out

18:29 AimHere: jondot, Maybe you've not heard of "The Joy of Sex", which was where the title was pilfered from

18:29 technomancy: what?

18:29 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>

18:29 technomancy: I thought it came from the joy of cooking.

18:30 jondot2: AimHere, sorry, i haven't. i'll go for that one though.

18:30 technomancy: that's what my obscure joke on the back cover suggests anyway

18:33 AimHere: I though The Joy of Sex was the original, but it seems I'm mistaken

18:33 TimMc: This can be arranged at the next Conj.

18:36 tmciver: Alex Comfort wrote "The Joy of Sex", technomancy: you should have said "What Alex Comfort did for sex ..."

18:36 technomancy: Alex "Comfort"? really.

18:37 tmciver: funny, I know.

18:37 TimMc: Phil "Hagelberg"

18:38 tmciver: Tim "Mc"?

18:38 TimMc: yup

18:38 bow chicka wow wow

18:38 tmciver: Ha!

18:41 sritchie: how would you guys recommend checking if a namespace exists from java>

18:41 ?

18:42 RT.var("clojure.core", "symbol").invoke("user");

18:42 gives me a symbol for user --

18:42 I'm looking for a better way than catching a FileNotFoundException from RT.var("clojure.core", "require").invoke(userSymbol);

18:43 technomancy: elisp's require accepts a "noerr" argument

18:44 I don't think there's a better way than try/catch though unless you want to bring in some serious classpath-searching

18:44 sritchie: technomancy: I'll describe this weird case, maybe there's a better way --

18:45 cascalog needs to require a namespace, but I want to catch the error if the ns doesn't exist, since the user might be working at the repl

18:45 the problem is that if the namespace does exist but (require 'my.namespace) throws an error,

18:45 the error passes silently

18:45 and later calls to the functions throw "Attempting to call unbound fn"

18:46 hiredman: and namespaces are not always loaded from files

18:46 sritchie: yeah

18:46 so the question is, what to catch in a call to "require"

18:46 technomancy: probably need to inspect the message of the exception then

18:47 sritchie: oh, yeah, of course

18:47 hiredman: sritchie: I'd suggest that if users have errors in their code (requires not working, etc) they should fix their code

18:47 sritchie: hiredman: you're right, but this is a little odd, since it's a distributed hadoop process that's doing the require

18:48 in local mode, a call to "require" from java can fail if the ns doesn't have a file, but functions will still be invokable

18:48 from the "user" namespace, for example

18:48 hiredman: the call to require from java shouldn't fail if the namespace exists

18:48 sritchie: it's if it doesn't exist

18:48 if you define it at the repl

18:48 for example

18:49 hiredman: :|

18:50 sritchie: technomancy: I'll inspect the error message and add in a test so I can catch it if it changes

18:50 hiredman: https://gist.github.com/

18:50 err, https://gist.github.com/1685941

18:51 Raynes: amalloy: So, I've been thinking about your paste mirroring idea. It makes sense to mirror pastes from crappy pastebins like pastebin.com to refheap. I think I'm going to get a list of crappy non-clojure-supporting pastebins and consider the whole mirroring thing.

18:53 faust45: if when override methods first next and rest which Protocol i need to use ?

18:53 hiredman: sritchie: RT.load has a failIfNotFound argument

18:54 sritchie: hiredman: oh, nice

18:54 and that's all I need instead of "require", I'm guessing

18:54 hiredman: should do the trick

18:56 sritchie: you're the man, thanks

18:58 phil: how can this be simplified? {:x (+ (:x p1) (:x p2)) :y (+ (:y p1) (:y p2))}

18:58 sritchie: (merge-with + p1 p2)

18:59 ,(merge-with + {:x 1 :y 1} {:x 2 :y 2})

18:59 clojurebot: {:y 3, :x 3}

19:00 phil: ah, merge-with, many thanks

19:00 sritchie: np

19:00 amalloy: or use a [y x] vector instead of a map

19:01 &(map + [1 1] [2 2])

19:01 lazybot: ⇒ (3 3)

19:02 dgrnbrg: why is clojure EPL? I've never heard of that license, and the FAQ likes to an IBM FAQ that 404ed.

19:03 technomancy: it's a non-viral copyleft license

19:03 best of both worlds

19:03 dgrnbrg: is there a req to redistribute source code for epl portions of shipped binaries?

19:05 technomancy: yes, if you ship a modified version of Clojure you must distribute your modifications

19:05 but you don't have to license your own application under the EPL just because it's what Clojure uses

19:09 AimHere: Nor is there a clause insisting you distribute your apps via the Clojure appstore

19:12 faust45: i try implement custom Seq http://friendpaste.com/2WeL6Co1rofx7GCWMnzdq7

19:12 and got this error

19:12 user=> (next (SeqFly. '(1 1 2 3 3)))

19:12 (AbstractMethodError clojure.lang.RT.seqFrom (RT.java:473)

19:13 what its mean?

19:25 the-kenny: Funny. The ThinkRelevance Podcast is marked "explicit" in iTunes.

19:28 gfredericks: I think the alternative should be to mark things as "implicit".

19:29 TimMc: Stuart Halloway and the Naked Abstractions

19:30 faust45: can any one help me with this error

19:30 user=> (next (SeqFly. '(1 1 2 3 3)))

19:30 (UnsupportedOperationException nth not supported on this type: SeqFly clojure.lang.RT.nthFrom (RT.java:835)

19:30 ?

19:30 sorry guys

19:30 )

19:31 gfredericks: what is SeqFly?

19:31 faust45: thttp://friendpaste.com/1PqCEPdXCaSQmlyzTASKeu

19:31 SeqFly define this place http://friendpaste.com/1PqCEPdXCaSQmlyzTASKeu

19:33 gfredericks: hmmm. I do not know.

19:33 faust45: TimMc: can you help?

19:34 ztellman: faust45: AbstractMethodError means you didn't implement the method

19:35 faust45: ztellman: nth? but why when i call next clojure need nth?

19:37 the-kenny: Maybe split needs nth

19:38 gfredericks: but split operates on the field

19:38 (the list)

19:38 aphyr: Clojurites: any recommendations for parser libraries? Looking for a PEG, LALR, or parser combinator library with good performance characteristics.

19:39 TimMc: aphyr: I don't know the details of any of them, but parsley and fnparse get mentioned a lot.

19:39 faust45: interesting but i don't call split

19:39 i call next

19:39 technomancy: I don't know about you, but clojure.core/read-string is my favourite parser

19:39 gfredericks: faust45: the impl of next calls split

19:40 ztellman: I'm pretty sure the issue is that you can't just return 'this' in seq

19:40 TimMc: faust45: You didn't finish implementing ISeq

19:40 gfredericks: My fingers are tired of C-x o; how can I switch emacs windows more efficiently?

19:41 alt with arrow keys doesn't work

19:41 aphyr: technomancy: yep, I've got to be compatible with an existing protocol though

19:41 faust45: TimMc: hm, but which methods i missing ?

19:41 ztellman: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/ISeq.java

19:41 TimMc: faust45: https://github.com/clojure/clojure/blob/1.3.x/src/jvm/clojure/lang/ISeq.java

19:41 ztellman: more cons

19:41 faust45: TimMc: also it's confused if i have own impl of next, and then call, why it try call something else?

19:42 http://friendpaste.com/1PqCEPdXCaSQmlyzTASKeu

19:42 technomancy: gfredericks: I have C-x C-o go forwards two and C-x S-o go backwards 1

19:42 gfredericks: that covers you until you get to more than four, which I never really do.

19:42 gfredericks: this suggests there must be a natural ordering that it goes in, which I haven't figured out yet

19:43 ...or tried

19:43 ztellman: faust45: this isn't a minimal example, but here's some code that implements an ISeq: https://github.com/ztellman/gloss/blob/master/src/gloss/data/bytes/core.clj

19:46 TimMc: faust45: Why do you keep pasting that link?

19:47 faust45: TimMc: point to impl of ISeq

19:47 Raynes: Because he really, really likes friendpaste.

19:48 faust45: this new version of impl ISeq but still have error

19:48 http://friendpaste.com/4lZlMSpfZN6DCCcxE2canl

19:48 user=> (next (SeqFly. '(1 1 2 3 3)))

19:48 (UnsupportedOperationException nth not supported on this type: SeqFly clojure.lang.RT.nthFrom (RT.java:835)

19:49 which interface have nth ?

19:58 hm, its not simple to implement custom seq behavior

20:04 dgrnbrg: Hello clojurians, I just posted a writeup of a part of a talk I gave on Clojure concurrency. This post is about vars: http://blog.dgrnbrg.com/post/16449608086/concurrency-with-vars

20:20 TimMc: Ugh, ##(compare [1] '(1))

20:20 lazybot: java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IPersistentVector

20:21 tmciver: TimMc: why not ##(= [1] '(1))

20:21 lazybot: ⇒ true

20:21 tmciver: ?

20:22 faust45: how i can identify which interface declare method?

20:22 TimMc: &(compare 9 1)

20:22 lazybot: ⇒ 1

20:22 faust45: for example nth

20:22 TimMc: &(compare [9] [1 1 1])

20:22 lazybot: ⇒ -1

20:22 tmciver: right

20:22 TimMc: tmciver: I'm trying to compare collections lexicographically; turns out compare isn't worth shit for that.

20:23 brehaut: ,(compare (seq [1]) (seq (list 1)))

20:23 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector$ChunkedSeq cannot be cast to java.lang.Comparable>

20:23 TimMc: Or rather, vectors implement it non-lexicographically. (A.k.a., wrongly.)

20:23 brehaut: ,(compare [1] (vec '(1)))

20:23 clojurebot: 0

20:24 TimMc: Time to make a library...

20:28 amalloy: TimMc: (some (complement #{0}) (map compare a b))? not quite right because if one is a prefix of the other they compare as equal, but otherwise probably good

20:28 TimMc: That's not enough.

20:29 amalloy: no, certainly not. just a starting point that might be easy to build from (not that it's hard to do by hand recursively)

20:32 TimMc: I'll just go for the loop/recur, I think.

20:35 amalloy: TimMc: https://github.com/flatland/useful/commit/019801cc04e70ca784c03853ec4c579c589e7820 is something i wrote recently, if you want to steal that

20:52 rads: anyone have experience with enfocus? I'm trying to append a dom fragment then fade it, but I'm not sure how to get the newly appended node and do something with it

20:53 for example say I have a dom node, n, and I append it to the document like so: (em/at ["body"] (em/append n)). now how do I get the actual dom object for n now?

20:54 enfocus appears to make clones of n, so trying to call something on n directly does not work

20:55 my workaround so far has been to generate an ID for the node if it does not have one then select that, but it seems like a hack to do it that way

20:55 ckirkendall: any ideas?

20:56 ckirkendall: rads: hold on thinking about it

20:57 you can do an (at n (em/fade-in time))

20:57 if you still have a refrence to N

20:58 rads: you can also reference through css selector

20:58 rads: ckirkendall: I tried your first suggestion but it doesn't seem to actually work

20:59 ckirkendall: (em/at js/document

20:59 ["body"] (em/append n)

20:59 ["#idofN"] (em/fade-in 500))

20:59 rads: in this case the node is dynamically generated and does not have an ID, so it does not have a unique selector

20:59 ckirkendall: what is the type

21:00 you can use last-child

21:00 rads: it's an <li>

21:00 I didn't think of first-child, but I'm essentially doing what you said: I dynamically assign a temporary id to the node before appending it, then I select that

21:01 I was just wondering if there was a better way to do it

21:01 ckirkendall: (em/at js/document

21:01 ["body"] (em/append n)

21:01 ["body > *:last-child"] (em/fade-in 500))

21:03 it might be body:last-child

21:03 rads: what if I want to keep a reference to that node after appending more?

21:04 ckirkendall: if you do you can always pass it into an (at)

21:04 rads: it doesn't work -- for me at least

21:05 if you try to (at) that same node you just appended, nothing happens

21:05 ckirkendall: crap sorry forgot I have to do a clone

21:05 I do that because you can append to all selected nodes.

21:06 I might be able to modify it so if you select on it will append the exact node

21:06 select one

21:07 rads: well let me tell you my use case. maybe this is part of a deeper problem

21:07 ckirkendall: I would love to here it

21:10 rads: I have these "events", which are simply <li> documentfragments generated from an enlive template with clojurescript macros

21:11 so it compiles to (defn event-snippet [] (goog.dom/htmlToDocumentFragment "<li>...</li>"), something like that

21:11 these snippets do not have IDs when they are created

21:11 I want to fill a list with these snippets

21:13 hmm after thinking about this some more maybe I should figure out how to assign some meaningful IDs to the snippets dynamically

21:13 ckirkendall: If you know the index you can also access that way with li:nth-of-type(n)

21:14 enfocus supports snippets

21:14 rads: I wanted them to load at compile time though

21:14 not on page load

21:14 ckirkendall: oh

21:14 not a bad idea

21:15 rads: I actually need to get going but thanks for helping me out with this. I'll think about this some more and if I come up with anyhting interesting I'll ping you on github

21:16 ckirkendall: If I think of something I will post it out on the enfocus google groups.

21:17 phil: if anyone is feeling helpful: http://stackoverflow.com/questions/9026863/locally-editing-a-purely-functional-tree

21:17 rads: cool. I really like your library by the way. it's just magical to be able to use the same templates and selectors on both the server and the client

21:18 later

21:25 TimMc: Hmm, a good way to check if something is either nil or meets a predicate? fnil seems a bit weird here.

21:26 ckirkendall: rads: thanks

21:26 TimMc: Perhaps there's a way to check multiple predicates and use nil? as one of them.

21:28 brehaut: wasnt there a function that was introduced in 1.3 to test multple predicates?

21:29 amalloy: ,(do (require 'clojure.repl) (clojure.repl/apropos "every"))

21:29 clojurebot: (every-pred not-every? every?)

21:29 TimMc: I could do something cute with juxt and some...

21:29 brehaut: (doc every-pred)

21:29 clojurebot: "([p] [p1 p2] [p1 p2 p3] [p1 p2 p3 & ps]); Takes a set of predicates and returns a function f that returns true if all of its composing predicates return a logical true value against all of its arguments, else it returns false. Note that f is short-circuiting in that it will stop execution on the first argument that triggers a logical false result against the original predicates."

21:29 TimMc: &(doc every-pred)

21:29 lazybot: ⇒ "([p] [p1 p2] [p1 p2 p3] [p1 p2 p3 & ps]); Takes a set of predicates and returns a function f that returns true if all of its composing predicates return a logical true value against all of its arguments, else it returns false. Note that f is short-circuiting in that... https://refheap.com/paste/442

21:29 amalloy: &(map (any-pred nil? even?) [0 1 2 3 nil])

21:29 lazybot: java.lang.RuntimeException: Unable to resolve symbol: any-pred in this context

21:30 amalloy: &(map (every-pred nil? even?) [0 1 2 3 nil])

21:30 lazybot: java.lang.IllegalArgumentException: Argument must be an integer:

21:30 amalloy: well, there's an any version, but i forget what it's called

21:30 TimMc: some?

21:30 amalloy: ,(clojure.repl/apropos "pred")

21:30 clojurebot: (every-pred)

21:30 amalloy: ,(clojure.repl/apropos "some")

21:30 clojurebot: (some some-fn)

21:30 amalloy: some-fn

21:30 TimMc: hah

21:30 brehaut: huh. why doesnt every-pred short circuit?

21:31 amalloy: brehaut: it does

21:31 nil passes the first test, so you have to try the second

21:31 brehaut: oh right. my bad

21:33 jeremyheiler: \msg clojurebot

21:33 oops

21:38 muhoo: heh, the war file for tomcat deployment of a "hello world" app in noir, is 6.5MB

21:39 tavisrudd: 1 byte per person almost

21:40 amalloy: huh?

21:40 muhoo: person?

21:40 tavisrudd: http://www.google.ca/search?q=world+population+2012

21:40 amalloy: almost one byte per thousand people, if you mean world population

21:40 tavisrudd: er, right

21:42 brehaut: muhoo: my site (embeded jetty) is 7.4MB

21:42 although thats just a jar, not a war

21:43 jeremyheiler: 6.5 mb isn't bad if contains all its clojure dependencies inside.

21:43 if it*

21:44 muhoo: it does. it's a uberwar, contains the whole language, all the dependencies, etc.

21:44 brehaut: huh. and apparently 75mb of resident ram

21:46 tavisrudd: not bad when you consider 'du -sh /usr/lib/python2.7' -> 41M

21:47 brehaut: not really a hugely relevant measure though is it?

21:47 ivan___: tavisrudd: yeah, but python is shipped with almost every OS so you never think about it!

21:47 amalloy: not at all relevant. you forgot to include the jvm in the clojure measurements

21:47 brehaut: exactly

21:47 muhoo: it's amusing, but not terribly meaningful.

21:47 amalloy: brehaut: it probably doesn't need those 75MB either, if you tuned the heap/gc params

21:48 brehaut: amalloy: yeah i suspect you are completely right. thats entirely untuned

21:48 muhoo: i come from an era where floppy disks had 400kb on them

21:49 when i see huge numbers like that for "hello world", it's just kinda funny.

21:49 brehaut: 64bit hello world via the web is a bit different to 16bit hello world on the console too ;)

21:50 ivan___: muhoo: with playframework when you create a uberwar its like 41mb (although they include the scala compiler for some reason) - it seems really excessive - especially when you live in NZ with our crap upload speeds :(

21:50 tavisrudd: I mean 6.5mb is pretty good if includes the lang, all the deps, etc. The 45MB for Python is just the stdlib

21:50 gfredericks: bit-inflation

21:51 brehaut: ivan___: push the source to a vm on the net and build there; dont push built resources from down here

21:51 ivan___: brehaut: your here too? or missing a t?

21:51 brehaut: ivan___: correct. the tron

21:51 hiredman: I had to download the jdk earlier, it was 79M

21:51 clojurebot: Pardon?

21:51 ivan___: brehaut: yeah thats what i do

21:52 brehaut: haha, cambridge

21:52 brehaut: rimu?

21:52 ivan___: i used to work there

21:52 brehaut: of course ;)

21:52 ivan___: now i work for cloudbees

21:52 * gfredericks fears they will drop into a local dialect

21:52 ivan___: so just work from home, but i live with others that work at rimu hehe

21:53 brehaut: gfredericks: our local dialect is a) replace all vowels with 'u' and b) string a chain of 'yea' sand 'nah's together

21:54 gfredericks: brehaut: interpret the latter as binary ASCII?

21:54 brehaut: yeah nah

21:54 gfredericks: yuuh nuh

21:54 brehaut: bingo

21:54 you could fake it down here

21:54 hiredman: aren't the dialects of nz all "bah bah baaaaah"? it's like 80% sheep

21:54 gfredericks: I'm Nuw Zuulunduc!

21:54 ivan___: thats aus now, New Zealand is diary more

21:55 gfredericks: er, U'm

21:56 hiredman: ivan___: huh

21:56 go figure

21:57 brehaut: hiredman: its especially cow heavy near ivan___ and i. other parts of the country are more like the stereotype (a lot of the south island for example)

21:57 ivan___: yeah

21:57 hiredman: thats too bad about sheep farming not being profitable for many farmers anymore, I wish more things were wool

21:57 * hiredman is scanning the wikipedia page

21:57 ivan___: basically any flat land is generally diary, or is being converted.

21:58 sheep can handle hilly area better, and they cant be used for cows

21:59 tavisrudd: funny thing about Lord of the Rings is most of the forest filled valleys in the film have had the trees painted in. They're really full of sheep.

21:59 hiredman: I seem to recall a big mad cow scare in korea a while back over american beef so you could only get newzealand

21:59 brehaut: tavisrudd: actually, the stacked the sheep up and painted them green

21:59 but i understand how the confusion arrises

21:59 ivan___: haha

22:00 gfredericks: green sheep on pole == tree

22:00 hiredman: http://en.wikipedia.org/wiki/2008_US_beef_protest_in_South_Korea

22:00 tavisrudd: http://blogs.reuters.com/wp-content/uploads/2006/09/sheep360.jpg

22:00 brehaut: gfredericks: have you considered a job at weta workshop?

22:01 gfredericks: brehaut: nope.

22:04 duck1123: what's the best lein plugin for clojurescript currently. Ideally, one that also gives me access to goog.dom.query and optionally goog.net.WebSocket

22:05 jeremyheiler: whoa, clojure? this is sheeptalk.

22:06 duck1123: i think i read somewhere today that clojurescriptone has converted to lein.

22:06 duck1123: It got to me that clojurescriptone went against the standard lein structure

22:06 I wound that a bit odd

22:07 jeremyheiler: hmm

22:07 wasn't it just how they depend on clojurescript and domina, since there's no official releases for them yet?

22:09 duck1123: I really haven't done much clojurescript yet, I did a short proof of concept and then set it aside. I'm trying to get a tad further tonight, but am having no luck even after I tried yanking pinot out

22:10 time to abuse M-;

22:10 tavisrudd: duck1123: have you tried lein-cljsbuild?

22:11 duck1123: no, does that one work well for you?

22:11 cljs-watch hasn't been updated in a while, so I assumed there was a new star

22:11 tavisrudd: I've only played with it so far, but it seemed good.

22:13 * emezeske shamelessly plugs lein-cljsbuild.

22:17 phil: is clojure.algo.monads compatible with cljs?

22:21 duck1123: for some reason, every now and then, lein deps takes forever for me

22:21 gfredericks: duck1123: whenever there's a cache miss?

22:22 duck1123: I think so, yeah it's checking the repos now

22:23 devn: phil: if you mean out of the box the answer is no. with some work you could get it going though, i believe.

22:24 phil: devn: im checking out the source right now, doesnt look too hard

22:30 devn: phil: i'm sure you can handle it, just tough to gauge where someone is when they ask if something in contrib is compatible

22:30 that could be driving in a lot of different directions

22:31 phil: devn: yea of course, what i rather meant is i *hope* it wont get too hard :)

22:32 devn: phil: the dependency on clojure.tools.macro is something i don't know very well

22:33 phil: devn: yea that stroke me as odd too, but i hope in the worst case im just gonna be able to rip out the single macro they depend on

22:33 technomancy: duck1123: probably checking for snapshots; try moving to releases or timestamp-locked snapshots

22:34 muhoo: aha. i may have figured out why nobody likes to talk about how to use vars

22:35 looks to me like they can be used to do mutable c/java/etc style mutable stuff

22:35 duck1123: I've gotten rid of as many snapshots as I can. Timelocking will probably come next

22:36 technomancy: the only reason vars are mutable is to support interactive development; using them otherwise is an abuse.

22:37 muhoo: um, i see them in noir

22:37 technomancy: you're seeing set! and/or alter-var-root?

22:37 muhoo: not set, i'm seeing binding

22:37 and declare

22:37 technomancy: oh, that's not using mutability

22:38 muhoo: oh good

22:38 gfredericks: man that link technomancy just tweeted has one of the worst definitions of functional programming I've come across.

22:38 muhoo: still, if i understand what i'm reading (and i probably don't quite yet), it looks like they can create new bindings for existing vars

22:39 hiredman: also LISP

22:40 gfredericks: I think I went into that with my expectations way too high.

22:40 technomancy: gfredericks: oh, were you not greatly entertained?

22:41 gfredericks: technomancy: if you're not in the right mood for it it becomes sad

22:41 maybe if I had known ahead of time it was bad I would have enjoyed it.

22:41 My favorite sentence: "Working in this paradigm requires a different, more mathematically oriented mindset than working with imperative languages like C, Java, and Basic, but it offers some distinct advantages."

22:42 hiredman: oh right, that sounds just like PHP

22:42 brehaut: "LISP programmers are free to create their own verbs, called functions" seriously? have OO programmers forgotten so much that they need to be told what a function is?

22:42 TimMc: haha

22:42 gfredericks: my guess is programmers aren't the intended audience

22:42 maybe I'm expecting too much again though

22:43 technomancy: "IT Software Community"... yeah, never really sure what "IT" means.

22:43 it makes me think of printers.

22:43 TimMc: It makes me think of shitty ads on teh subway.

22:44 gfredericks: "Get the insight and confidence it takes to always perform better"

22:44 not sure what's unclear about that

22:44 brehaut: technomancy: im pretty sure IT is a clown or a spider or something

22:44 thought he was more concerned with eating children than software though

22:44 devn: brehaut: hahaha

22:44 jeremyheiler: clown: http://www.imdb.com/title/tt0099864/

22:45 devn: it makes me think of a weird john dvorak, Dev Null, Apple Newtons, majordomo

22:45 aol 2.5, something like that

22:45 those were the IT days

22:46 gfredericks: I hear it used a lot around here and it can usually be traced back to mainframes

22:46 brehaut: is this parody?

22:46 gfredericks: me? no

22:46 devn: brehaut: i...don't know.

22:47 gfredericks: oh the article

22:47 brehaut: the comments are newest first. wtf

22:47 gfredericks: brehaut: == best first

22:47 brehaut: lol

22:47 devn: haha

22:47 muhoo: frank zappa said about rock journalists: "people who can't write, interviewing people who can't think, to prepare articles for people who can't think"

22:48 i suspsect tech "journalism" isn't far removed.

22:48 devn: guys...cut him some slack

22:48 TimMc: muhoo: think * 2?

22:48 muhoo: sorry, can't READ

22:48 gfredericks: The "User Rank" for the PHP commenter is just "BASIC CODER", so I guess that means...I don't even know

22:49 muhoo: i'm kind of done with pundits of the musical, political, and technical variety.

22:49 technomancy: gfredericks: couple upvotes on that comment and they'll be promoted to "VISUAL BASIC CODER"

22:49 devn: it would be a shame if the article talking naively about how great lisp is, had snarky comments by people who objectively know how great it is

22:50 technomancy: devn: yeah, better keep it to IRC =)

22:50 TimMc: I'm not falling into that trap.

22:50 devn: IT'S A TARP!!1

22:50 gfredericks: those Scala bastards again

22:50 almost had us

22:50 muhoo: i also love when journalists write "science says". really? where did you interview science? at starbucks?

22:51 TimMc: (seq some-empty-collection) => nil ; was a bad decision

22:51 technomancy: muhoo: http://files.sciencegallery.com/files/images/i%20will%20do%20science%20to%20it.jpg

22:51 muhoo: technomancy: +1

22:52 * gfredericks goes to bed

22:54 jeremyheiler: technomancy: i love your "more magic" switch.

22:54 * adm_ackbar *psst* It's a trap.

22:55 technomancy: jeremyheiler: yeah, problem is sometimes I forget to turn it off

22:55 gotta be sustainable, you know?

22:55 jeremyheiler: yeah i hear ya

22:56 the natual magic resources are limited these days

22:56 brehaut: thats the result of less perl programmers

22:57 phil: is there a way to (extend-type clojure.lang.Atom) in clojurescript?

22:57 or are only native types supported

23:02 brehaut: phil: yes of course. (defprotocol Foo (do-foo [this])) (extend-type clojure.lang.Atom Foo (do-foo [this] (str "foo: " @this))) (do-foo (atom 1)) ;=> "foo: 1"

23:03 phil: and you can try this in your own clojurescript repl

23:04 phil: brehaut: in the compiled js output the browser complains about clojure.lang being undefined... did i miss something?

23:05 brehaut: i would presume so

23:05 phil: brehaut: (havent set up a repl yet)

23:05 hmm

23:05 brehaut: phil: the clojurescript repl ships as part of the git repo

23:05 scripts/repl

23:05 (ive only used the repl)

23:07 phil: brehaut: are we talking about a bash repl or browser repl here?

23:07 brehaut: bash

23:07 phil: ah... is it possible the bash repl somehow includes the clojure runtime or something?

23:08 which isnt compiled down to js?

23:08 brehaut: i dont think that makes any sense

23:09 phil: brehaut: yea possibly, just guessing

23:14 brehaut: when i look at the src/cljs/cljs/core.cljs Atom is defined there, i.e. in the cljs.core namespace

23:15 brehaut: oh may well be i ran the wrong repl then

23:16 yes https://github.com/clojure/clojurescript/wiki/Quick-Start

23:19 and as i just wacked the pinched nerve in my foot, im going to go away

23:24 tavisrudd: swank-clojure 1.4.0-SNAPSHOT is just about ready for release. If you have time in the next day, pull the latest snapshot to give it a final spin.

23:25 The clj-stacktrace version issues should be gone.

23:30 franks: added swank-clojure to my project's dependencies in the hope that I could use some of the completion magic - however, clojure can not find any swank-clojure namespaces... anything "special" about swank-clojure?

23:30 tavisrudd: it's best to install it as a plug-in, actually

23:31 lein plugin install swank-clojure 1.4.0-SNAPSHOT

23:31 franks: even if you only want to use a few functions and not the server part?

23:31 muhoo: how would i go about, say, viewing or printing the contents of a ring request from inside a page request in noir?

23:32 tavisrudd: franks: oh, I see

23:32 muhoo: i have this: (defpage "/req" [] ((noir.request/ring-request)))

23:32 tavisrudd: the ns is swank.xxx

23:33 swank.commands.completion, etc.

23:33 not sure if it will work without some of the server state though

23:33 franks: tavisrudd: right - trying to require swank.commands.completion, but cannot find it - weird...

23:33 tavisrudd: and the jar is on the classpath?

23:34 muhoo: but it gives me a pretty massive spew: https://refheap.com/paste/443

23:34 franks: can see the swank-clojure jar file that was added by lein deps...

23:34 and inside it I can find swank.commands.completion...

23:35 tavisrudd: muhoo: looks like double parens

23:35 ((noir

23:35 (noir and it should work is my guess

23:36 muhoo: tavisrudd: doh, thanks.

23:37 franks: Exception in thread "main" java.io.FileNotFoundException: Could not locate swank/commands/completion__init.class or swank/commands/completion.clj on classpath: (core.clj:9)

23:38 tavisrudd: franks: does lein swank work at least?

23:40 jeremyheiler: speaking of sheep http://zongmusic.wordpress.com/2010/01/17/clojure-concurrency/ (and on topic ;)

23:42 franks: tavisrudd: no... i seem to have 2 versions of swank in my plugin dir already... let me clean up first...

23:43 jeremyheiler: travisrudd: that is completely awesome

23:50 clj_newb: I run my code. I get "NullPointerException clouure.core/add-watch (core.clj:1926)." Question: how do I get a stack trace out of this? I want to know which line of code in my *.clj files causes this null pointer exception

23:52 jeremyheiler: ,*e

23:52 clojurebot: #<Unbound Unbound: #'clojure.core/*e>

23:52 ivan: https://github.com/clojure/tools.trace

23:52 clj_newb: ,(doc *e)

23:52 clojurebot: "; bound in a repl thread to the most recent exception caught by the repl"

23:53 clj_newb: jeremyheiler: nice; thanks

23:53 ivan: jotted down to look into the next time I get a cryptic error

23:53 franks: tavisrudd: ough - removed 1.3.2, 1.3.3 and installed 1.3.4, and then I can find the swank.* ns - if I use dependencies only, it doesn't work - some black magic in that code...

23:54 bbloom: i'm not sure i understand the behavior of "Vars" and "binding" especially with respect to asynchronous code

23:55 (import java.lang.Thread)

23:55 (defn set-timeout [ms fn] (.run (Thread. #(do (Thread/sleep ms) fn))))

23:55 (binding [x "in-binding"] (println x) (set-timeout 1000 #(println x)))

23:55 prints "in-binding" and nil

23:56 oh actually, the nil is the return value

23:56 isn't not running

23:56 nevermind, ignore me :-P

23:57 ah yes ok: missed some ()

23:57 (defn set-timeout [ms fn] (.run (Thread. #(do (Thread/sleep ms) (fn)))))

23:57 ok, that prints what I expect: in-binding and then in-binding again

23:58 now… the problem: clojurescript doesn't have vars:

23:58 (binding [x "in-binding"] (.log js/console x) (js/setTimeout #(.log js/console x)))

23:58 franks: bbloom: and no threads...

23:58 bbloom: well right

23:59 but i still expected the var to be bound in the callbacks

23:59 that line prints "in-binding" and "top-level"

23:59 when i expected "in-binding" twice like clj proper

Logging service provided by n01se.net