#clojure log - Apr 09 2011

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

0:02 joshua__: amalloy, Somehow I wasn't in the master branch.

0:02 amalloy: tada!

0:02 joshua__: amalloy, All better now =).

0:16 carllerche: If I'm looking to implement an HTTP proxy (in clojure), should I be focusing on using aleph?

0:23 mec: according to joy of clojure, rest is more lazy than next, but if I need to do (seq (rest coll)) is that the same thing as (next coll)?

0:23 amalloy: $source next

0:23 sexpbot: next is http://is.gd/dijgWa

0:23 amalloy: (in short: yes)

0:24 mec: I looked at the source but its just a .next call now, i think at one point it wasnt

0:26 amalloy: mec: if you read the java source, next is (seq (rest coll)

0:26 mec: ah ok

0:26 amalloy: or just read the docstring

0:26 &(doc next)

0:26 sexpbot: ⟹ "([coll]); Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil."

0:27 amalloy: er no, i guess rest says the same thing

0:27 mec: ya ;p

0:34 livingston: can you have circular uses ? (ns a (use b)) (ns b (use a)) ?

0:34 amalloy: no

0:35 livingston: didn't think so. so, how do I get around that? (I might not actually have it, still working though)

0:36 amalloy: livingston: basically, pull out part of the cyclic dependency into a new namespace b that they both depend on

0:37 transform that DAG into a tree

0:37 man

0:37 that is not a DAG. i am dumb. but the advice stands

0:37 livingston: yuch. I had a reasonable cut in my code but there are pieces that refer across them

0:40 can I use declare to forward declare something in another namespace?

0:40 amalloy: livingston: i don't believe so. (declare foo) is ~= (def foo nil)

0:40 and you can't def someone else's namespace

0:42 livingston: i think I could if the namespace existed already?... ugh this is a pain

0:47 tomoj: you couldn't even if it did

0:53 livingston: can I signal non-Object return types on defrecord / defprotocol definitions? it keeps telling me it's seeing boolean and expecting Object (I think I have everything flagged as boolean)

0:56 amalloy: livingston: what version of clojure? i don't really keep up but i think that changes in 1.3

0:56 livingston: I'm on 1.2 still

0:57 so soon we'll be able to set return types on protocols/defrecord that will get back to the java interface?

0:58 amalloy: i think that's always been possible for definterface

0:58 and for...some types, you can return/pass primitive long/double values. i don't think boolean is getting in

0:59 livingston: yes it is (based on the examples I see) protocols just generate an interface too

0:59 amalloy: but i think you can set *non*-primitive hints with ^Boolean, rather than ^boolean?

0:59 livingston: ^ -- possible for definterface don't know about your second (and now third ) comment

1:00 don't know, didn't try that. I'll try again later, all of this is just to be kind to the java users and it has taken way to looong now.

1:02 mec: going to need a new book just to clarify all the 1.3 changes

1:03 livingston: that's odd I have a function with the call signature [a b & _] and when I try to make another function with this body ([x y] (foo x y)) it says unsupported call signature?

1:03 mec: yeah I've been a bit out of the loop with my head in the sand lately

1:05 mec: is it in an interface or protocol?

1:06 amalloy: livingston: code snippet? not clear what you're talking about

1:06 livingston: the protocal defines (bar [x y] [x y z]) I have the defrecord doing (bar ([x y] (foo x y)) ([x y z] (foo x y z)))

1:07 where foo is signature [x y & _] it says no binding pattern [x y]

1:08 amalloy: protocols don't support multiple arities in a single declaration. they're java-level methods

1:09 you would need (bar [x y]) (bar [x y z]) iirc

1:09 livingston: really? I've been doing it (or at least I think I've been doing it

1:09 amalloy: i could be wrong. i don't do a lot of interop

1:09 livingston: z is optional

1:10 amalloy: either way protocols "shouldn't" have optional args really. just demand that the implementor supply a version for x y z, and then wrap a function around it that handles the optional-ness of z

1:10 livingston: well it worked with extend but not trying to instantiate it into a defrecord now

1:11 amalloy: then instead of everyone who extends the protocol having to supply N versions of bar, they all supply one and you add an extra wrapper to handle the rest: protocols love minimalism

1:11 livingston: that'd kinda suck for the java people to call the plain function but yeah..

1:12 yeah that's kinda what I have it works great with a set of functions from clojure world it's the java world that's always a pain...

1:13 I do have some legitimate multi-signature function though and wait there are exiting java APIs that work fine that way. (addTriple s p o) (addTriple t) etc.

1:14 amalloy: mkay

1:15 livingston: I'm not saying l like those java apis but they are out there, and when you need to pick one of a dozen call signatures to hit from clojure they are really fun

1:17 amalloy: livingston: i specialize in opinionated advice about things i don't actually do, so feel free to ignore the bits that you don't like

1:18 livingston: I just know java can do it, I don't know that protocol can too

1:19 I'm also a bit grouchy this re-factor is taking forever, I haven't eaten, it's 11pm and my friends are drinking

1:22 but I just poked my head into the real world an at least the government is still running (for some definition of running)

1:26 amalloy: livingston: most governments are indeed running

1:26 livingston: our's almost just shut down. (you're not in the US are you?)

1:27 amalloy: i am, but i was objecting to the american tendency to treat the US as the only interesting country

1:27 tomoj: ..our government almost shut down?

1:28 amalloy: tomoj: squabbling over the budget

1:28 livingston: amalloy: oh. isn't it? get in line or we'll bring democracy to you lol

1:28 tomoj: too bad

1:29 amalloy: tomoj: it's all over the news. lots of name-calling across the aisle

1:29 livingston: tomoj: last minute deal. 800,000 people would have been furlowed (or whatever) it would have been a huge mess wasted time and money (it's already done enough of that)

1:29 amalloy: livingston: oh, they worked it out?

1:29 i stopped watching once i got home

1:30 cemerick: It's always a game of chicken.

1:30 And someone always blinks.

1:30 livingston: yeah, apparently. I should look at see what the new NIH budget is.

1:30 amalloy: cemerick: recently it's been the democrats blinking, from what i hear

1:31 cemerick: amalloy: Democrats are born with a twitch that induces it.

1:31 Though it looks like the deal just reached is pretty even-handed.

1:32 livingston: now it says it a short term deal. is there a long term one behind it? or are we going to keep winging it every couple of weeks?

1:33 cemerick: AFAICT, it's a 1-week temporary patch, with the real thing essentially locked down.

1:33 tomoj: popular dynamics necessitate a great degree of winging, I suspect

1:34 cemerick: We're only 5 months from the start of the next fiscal year though, so "long term" is shakily-defined.

1:34 livingston: tomoj: there's no need for this. it's half way into the year. there's been stupidity on both sides long before now dragging this out.

1:35 cemerick: yeah, that's why worrying about this one is so silly. how long you think they'll go before they start to think about the next one

1:35 tomoj: I meant in general. the public doesn't have a mind of its own

1:35 justinlilly: is there something like "Practical Common Lisp" in clojure? ie: "We're going to make an X, and you'll learn clojure along the way"?

1:35 cemerick: Just wait until the round this year into 2012. Them'll be some fireworks.

1:36 justinlilly: What X is doesn't entirely matter, just that it doesn't amount to "do all of project euler, then come back to me"

1:36 amalloy: cemerick: it won't matter. the world will end six months after that, so the budget can take a back seat

1:37 cemerick: oh, right

1:37 tomoj: I am not looking forward to the hysteria

1:37 cemerick: Is this 2012 thing Mayan, Nostradomus, Jehovah's Witnesses, or a melange?

1:38 justinlilly: variatons on a theme?

1:38 amalloy: rather small-minded of you to even consider the budget, really

1:38 tomoj: the real hysteria will be humorous, but the flurry of books and tv shows and other things sold will be hard to take

1:38 livingston: justinlilly: poor guy asks an on topic question and we're talking about how stupid people are... yes there are some good tutorials (although I don't know one off the top of my head)

1:38 tomoj: I think there was some effort to translate PCL?

1:39 or was that another book

1:39 amalloy: tomoj: little schemer, i think?

1:39 livingston: there's "casting spels" or whatever

1:39 amalloy: that's Land of Lisp, i think

1:39 tomoj: http://thinkrelevance.com/blog/2008/09/16/pcl-clojure.html

1:39 certainly less compelling than this hypothetical one written from scratch would be

1:40 justinlilly: thx.

1:48 livingston: the reddit commentary comparing the budget the oregon trail is kinda amusing

1:52 cemerick: livingston: wha?

1:52 No, nevermind, I don't want to know.

1:54 amalloy: cemerick: "i wish they'd all die of dysentery". i haven't read the reddit stuff, but this is at least as good

1:54 livingston: cemerick: "Spend all the money on ammunition so you can shoot at stuff, then wonder why your wagon is falling apart and everyone is dying of dysentery"

1:54 cemerick: Scholarly.

1:55 Many thanks for the tidbit, saving my sanity in the process. :-)

1:55 "#clojure reads reddit so you don't have to"

1:57 livingston: that would do wonders for my productivity -- so would having this @#$% refactor done

1:59 amalloy: livingston: cemerick will write it for you, in exchange for your help with reddit

1:59 #inadreamworld

1:59 livingston: i'd much rather be reading reddit right now. actaully I'd rather be at the pub with my friends.

2:01 justinlilly: there's an interesting thing called "hacker news daily".. takes the latest top 10 posts based on total score that hasn't been on the daily list yet.

2:01 http://hnfluence.com/ -- also this.. which is hacker news ratings mushed with bitly clicks, tweets, etc.

2:02 cemerick: livingston: I can wish you well, at the very least. :-)

2:02 Good night all.

2:02 livingston: oh great more distractions...

2:02 cemerick: thanks

2:22 oh finally made it (half way but enough to know the rest is good) ... good night and thanks everyone

9:01 ejackson: is there anything about map that should destroy a dynamic binding ?

9:15 here's a gist of the unfortunate behaviour: https://gist.github.com/911386

9:17 mrBliss`: ejackson: I've also noticed bindings are ignored in (fn ..). But I think with-redefs (1.3) will do what you're looking for.

9:18 ejackson: hmmm.... its the (fn ...) thanks. I wonder what this is about

9:18 i'm scared to try moving my project to 1.3

9:21 mrBliss`: thanks, though, this puts me on the correct track

9:21 pimeys: is there some magic you have to do to get mysql connection work with clojure. I'm writing my first web app with clojure+ring, installed mysql adapter with maven (lein didn't work) and my sql query throws an error: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306

9:21 google doesn't find any decent answers

9:22 I'm making a decision which language+library to use: clojure+ring or haskell+lift for my future web apps

9:23 lisp is easier for me than haskell though...

9:24 ejackson: pimeys: it looks you don't have the jdbc mysql setup

9:24 pimeys: oh, I meant snap+haskell :)

9:24 ejackson: there is a jar you need in your classpath, let me go look quickly

9:24 pimeys: lift is for scala

9:24 ejackson: I have some jar in my project lib

9:24 3304179 Apr 9 16:10 mysql-connector-java-5.5.15.jar

9:25 ejackson: yeah, that's the one

9:25 in that case you need to diagnose the jdbc itself

9:25 there is a util somewhere that does that

9:26 pimeys: all the other libs work just fine, but those installed without errors using leinegen, that mysql adapter is installed with maven because lein couldn't find the adapter library

9:27 ejackson: yeah, i had to jiggle and shake to make it work, but it does !

9:27 pimeys: of course I could use postgresql, but our server has mysql already installed and configured...

9:27 ejackson: mrBliss`: the answer is bound-fn !

9:28 pimeys: oh and also, how do you guys deploy clojure/ring apps?

9:28 ejackson: https://gist.github.com/911386

9:28 pimeys: I'm looking for something like capistrano

9:29 ejackson: pimeys: people tend to dev with jetty and then deploy into tomcat or such

9:29 pimeys: its a bit different. You package as a .war file and send that to tomcat

9:29 its much less fiddling about than rubyland

9:30 pimeys: my setup would be something like this: nginx serving static html+js from the project's public dir and clojure+ring would serve only json

9:30 so clojure listens some other port and everything is rendered with jquery/ajax

9:30 ejackson: out of my depth now, I don't do web apps :)

9:49 Scorchin: What are the best examples of taking a Java API/Lib and converting it into an idiomatic Clojure API/Lib?

10:45 x6763: is there a way to use clojure.contrib.http.agent/http-agent with an http proxy server?

11:17 angerman: Did anyone else note reCaptcha to ask for math formulas recently?

12:56 jweiss_: how come this doesn't work

12:57 ,`{~@[:c :d]}

12:57 clojurebot: 1

12:57 jweiss_: on my repl i get ArrayIndexOOB

12:57 i expect {:c :d}

13:01 huh, i didn't realize syntax quote, unquote splicing etc don't have non-shortcut equivalents like quote.

13:02 trptcolin: ,(let [things [:c :d]] `(~@things))

13:02 clojurebot: (:c :d)

13:02 trptcolin: jweiss: because you're trying to eval (:c :d), which is nil, and splicing that doesn't work

13:03 hmm, although `(~@nil) doesn't bomb, so i'm probably missing some piece

13:03 jweiss_: trptcolin: huh, i thought that evaling [:c :d] would yield a vector literal.

13:04 trptcolin: yeah my bad, missed the vectorness of it

13:05 jweiss_: trptcolin: this works

13:06 `[~@[:c :d]]

13:06 ,`[~@[:c :d]]

13:06 clojurebot: [:c :d]

13:06 jweiss_: but trying to splice into a map literal doesn't

13:06 trptcolin: yup

13:06 ,{[1 2]}

13:06 clojurebot: java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: 1

13:07 trptcolin: ok, so the splicing's a red herring? :)

13:07 Raynes: I would have guessed a purple trout.

13:07 jweiss_: trptcolin: it shouldn't be - since we're splicing it shouldn't have the square brackets around 1 2

13:08 trptcolin: oh yeah, weird

13:08 so does splicing just not work inside maps?

13:09 jweiss_: doesn't seem to.

13:09 ,`{:a :b ~@[1 2] ~@[2 4]}

13:09 clojurebot: {1 2, 2 4, :a :b}

13:09 trptcolin: Raynes: maybe a green salmon

13:09 jweiss_: that is... weird

13:09 works if there are an even number of splices

13:09 dnolen: jweiss_: it has to do w/ how the reader deals with map literals. Use hash-map fn not a literal. It's been this way for a while. Don't think there's any interest in fixing that behavior.

13:10 it's the same reason why weird syntax in (comment ...) can cause errors as well.

13:11 jweiss_: dnolen: well the comment thing i get, once i saw it's implemented as a macro, not in the reader

13:31 Lajla: ,(print "I worship his shadow")

13:31 clojurebot: Lajla: Pardon?

13:31 Lajla: =(

13:32 Forever alone.

13:36 dbyrne: Does anyone have experience with the clj-sandbox library? I think I might have found a bug.

13:36 https://gist.github.com/911545

13:40 Borkdude: Can anyone give me a clue on why "lein deps" is going wrong? http://pastie.org/1776027

14:06 TimMc: Lajla: I don't think clojurebot watches much TV.

14:06 ,`{~@[:c :d]} ; why doesn't clojurebot throw an exception here?

14:06 clojurebot: 1

14:07 TimMc: 1 is the index that is out of bounds

14:07 Lajla: TimMc, ah you know it.

14:07 TimMc: Lajla: No, I googled it. I don't watch TV either.

14:07 Lajla: Ah

14:07 No one understands me.

14:13 Borkdude: Nobody?

14:17 TimMc: clojurebot: Do you understand Lajla?

14:17 clojurebot: Titim gan éirí ort.

14:17 TimMc: Yeah, me neither.

14:17 Lajla: Borkdude, hmm

14:17 no

14:17 nobody

14:18 Borkdude: I think lein downloads some conflicting libraries or smth

14:18 if I remove the lib folder and type 'lein', it lists me the options

14:18 if I do lein deps, it downloads the libs

14:18 and again 'lein', I get this exception: http://pastie.org/1776027

14:19 TimMc: Yeah, that does look like lib version conflict.

14:19 Pastie a listing of your lib folder.

14:22 Borkdude: http://pastie.org/1776146

14:22 it worked on the other system I was just on

14:24 TimMc: I have to wonder if the Clojure 1.1 in your dev folder is interfering with your Clojure 1.2.

14:24 Have you tried blowing away both lib folders, ./classes, and your ~/.m2 folder?

14:25 Borkdude: wait

14:25 now I did: 'lein plugin install swank-clojure 1.3.0'

14:25 and it all works

14:27 I don't know what causes it

14:28 but at least things work...

14:29 currentB: I'm a little shaky on my understanding of protocols, but is it possible to use them to protect arithmatic operators from nil values?

14:56 Dantas: Hello everyone !! Im thinking about develop a web application using clojure ?is there any framework , i heard about compojure? How handle the states from a crud ?

15:00 bobo: Dantas: have a look at compojure, hiccup,enlive and clojureQL for example

15:01 clojureQL should make crud stuf pretty easy

15:02 Dantas: bobo: thanks a lot !! what is cojureQL ?

15:02 bobo: for sql

15:03 Dantas: im thinking use noSQL

15:03 bobo: ok, then dont look at it =)

15:03 Dantas: but, will be on my list, thanks a lot

15:13 dnolen: finally a sane way to log from lazy sequence computations, agents!

15:15 thorwil: is there a way to shorten/make-nicer something like (map fn1 (map fn2 (whatever)))?

15:15 dnolen: thorwil: comp

15:16 (map (comp fn1 fn2) whatever)

15:17 thorwil: nice, thanks!

15:17 Dantas: wow ! nice !

16:14 markoman: just watched a cool presentation of simplicity from clojure.blip.tv

16:15 Dantas: is the apply function like a reduce ?

16:17 morphling: Dantas: no, but some functions (like +) use reduce internally

16:18 amalloy: mrBliss`: your advice to ejackson earlier re with-redefs seems wrong. there's nothing about (fn ...) that "ignores/destroys" bindings. the map function returns a lazy sequence immediately, and when it is forced those bindings are no longer in scope. for his example, i'd use doseq (all he wants is side effects)

16:19 joshua__: Can you guys give me the names of a few libraries with some of the "best" Clojure code?

16:30 markoman: joshua__: maybe clojure contrib source contains some good code?

16:30 joshua__: markoman, thanks

16:30 Raynes: http://raynes.me/hfiles/contract.jpg

16:30 thorwil: Dantas: re apply: http://stackoverflow.com/questions/1257028/why-should-i-use-apply-in-clojure

16:32 Dantas: thorwil: thanks

16:34 pdk: [16:10] <Dantas> is the apply function like a reduce ?

16:35 (apply myfn 1 2 [3 4 5]) = (myfn 1 2 3 4 5)

16:35 (reduce myfn [1 2 3 4]) = (myfn (myfn (myfn 1 2) 3) 4)

16:37 Dantas: pdk: awesome ! thanks a lot . so the apply will expand the list as arguments to the function

16:37 pdk: yeah

16:37 basically if i want to compose some of the arguments to pass to a fn within one list

16:37 and then tack them on to the arguments list inline when i call that fn

16:38 sorta like how languages like java/c++ give you varargs

16:38 i.e. void main(String... args)

16:38 Dantas: yeah, perfect

16:38 pdk: though working in the opposite direction

16:38 reduce works in pairs

16:38 it assumes the function you give it takes 2 arguments

16:38 it will call it with the first two items in the list as arguments

16:39 then call it with the result of the first call and the third item

16:39 then the result of the second call and the fourth item etc for the rest of the list

16:39 Dantas: the reduce i understand .. the problem was that i create a too simple example using the + ! (reduce + '(1 2 3)) and (apply + '(1 2 3))

16:40 pdk: yeah using + isn't too illuminating since reducing and applying + are equivalent anyway

16:40 Dantas: yeah !

16:40 pdk: plus iirc + with more than two args gets compiled down to a reduction with a two-argument +

16:40 amalloy: &((juxt reduce apply) (partial list '+) [1 2 3])

16:40 sexpbot: ⟹ [(+ (+ 1 2) 3) (+ 1 2 3)]

16:41 pdk: juxt is effin magic

16:41 (doc juxt)

16:41 clojurebot: "([f] [f g] [f g h] [f g h & fs]); Alpha - name subject to change. Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"

16:41 Dantas: wow ! :D

16:42 amalloy: this is just like the example with +, but uses (list +) so you can visualize the computation it would make instead of it actually running

16:42 pdk: yeah that shows you better what the difference looks like compiled

16:42 cause you can still see the structure it's producing

16:42 doing it with just + shows you only the end result which is the same in both cases

16:43 amalloy: i think i should take that code and paste it as a new answer to every question on stackoverflow about apply vs reduce

16:43 Dantas: yeah

16:43 pdk: then you have to explain juxt and partial :p

16:44 amalloy: pdk: feh. the example will be so awe-inspiring that they'll go look everything up

16:48 markoman: is there any general data validation library available for clojure? how about data sanitazion lib?

16:52 validation as comparing given string to some function like (is-number str), (is-length str len), (is-a-member str map) and so on?

16:52 amalloy: markoman: sounds like the recently-released pretzel

16:53 $google clojure pretzel predicate

16:53 sexpbot: First out of 35 results is: Announcement: pretzel - a predicate library + call for suggestions ...

16:53 http://osdir.com/ml/clojure/2011-04/msg00196.html

16:53 amalloy: wtf, osdir? google isn't first?

16:54 pdk: bot was tempted by delicious pretzels

16:54 markoman: found github for it, thanks

16:58 looks-like-email? funny

16:59 amalloy: the moment i hear that, i fear for my life

17:01 david`: man i wish i could afford to go to this clojure class in june

17:02 amalloy: $google clojure github pretzel looks-like-email

17:02 sexpbot: First out of 20 results is: Re: Announcement: pretzel - a predicate library + call for ...

17:02 http://osdir.com/ml/clojure/2011-04/msg00259.html

17:02 amalloy: sexpbot: i hate you

17:02 now i have to open a browser myself

17:02 Dantas: lol

17:03 amalloy: that search on the-real-google works

17:04 looks-like-email is never implemented right. Just Don't Do It

17:08 markoman: i guess thats why it says looks like email, not is-email

17:08 amalloy: indeed

18:42 jsnikeris: So, I'm using ring.adapter.jetty/run-jetty to start a server. It seems like if I change and re-evaluate my ring handler, I need to restart the server. Is there a better way to do this?

18:45 Also, I'm trying to write a restart-server procedure. The only way I can think of to implement this is to call (.stop *server), and then redefine *server* by calling run-jetty again. However I feel like I'm doing this the wrong way. Any pointers?

18:46 amalloy: $google ring reload wrap

18:46 sexpbot: First out of 17900 results is: Clojure Web Development with Ring

18:46 http://mmcgrana.github.com/2010/03/clojure-web-development-ring.html

18:46 amalloy: feh

18:47 jsnikeris: there's a wrap-reload middleware or something like that

18:47 jsnikeris: ahh thanks

18:47 I'll check that out

18:48 dnolen: hmm why can't lein find this clojar? http://clojars.org/org.lpetit/net.cgrand.parsley

18:48 is it because it's the way it's named?

18:52 amalloy: dnolen: that seems weird

18:54 dnolen: it looks to me like one of that project's dependencies has a weird mvn repo

18:54 Cannot find layout implementation corresponding to: 'p2' for remote repository with id: 'ccw'. for project org.lpetit:net.cgrand.parsley

18:54 or possibly the parsley pom.xml is malformed

19:56 dnolen: anybody here mess with paredit.clj for it's Clojure parser?

20:02 amalloy: dnolen: a tiny bit

20:02 dnolen: amalloy: thoughts? opinions?

20:02 amalloy: i made it undesrstand []{} before that was added to clojure-mode

20:03 dnolen: about what?

20:03 dnolen: amalloy: any issues using the paredit.clj parser?

20:04 amalloy: i think i misunderstood your question? did you mean, have i used code from paredit for parsing clojure in non-paredit contexts?

20:08 dnolen: amalloy: yeah

20:08 amalloy: then no, i've never done that

21:19 TimMc: I would expect the Clojure compiler to expose its AST .

21:41 tomoj: TimMc: is its AST not just the forms being compiled?

21:48 livingston: is it not possible to have multiple call signatures for a function in defprotocol / defrecord ?

21:51 I tried by putting multiple signatures on the same line e.g. (foo [x y] [x y z]) and then in the record (foo ([x y] ..) ([x y z] ...)) this croaks. if I give it two independent definitions (foo [x y]) and (foo [x y z]) it seems happier and compiles at least

22:06 amalloy: livingston: isn't that basically what i said last night? that the former doesn't work but the latter does?

22:07 livingston: amalloy: probably. I was perhaps starting to fade at that point...

22:08 amalloy: (10:04:10 PM) amalloy: protocols don't support multiple arities in a single declaration. they're java-level methods

22:08 (10:04:26 PM) amalloy: you would need (bar [x y]) (bar [x y z]) iirc

22:08 livingston: it's weird that the protocol needs it this way (foo [x y] [x y z]) but the record needs two independent lines

22:10 yep just confirmed that (defprotocol P (foo [x] [x y])) (defrecord R [] P (foo [x] ...) (foo [x y] ...)) works

22:11 any variation on that doesn't eg defprotocol P (foo [x]) (foo [x y]) makes things mad.

22:37 amalloy: anyone know who "owns" the clojure translation of "casting SPELs in lisp"? i was just looking over it and there are some things that could use fixing

22:39 livingston: oh, did that guy from last night start looking into that? (things change a lot in developing languages, I hope they tag it with the version it was based on, or last updated with)

22:49 amalloy: livingston: i don't know. but today i remembered it being mentioned so i went to look at it

22:50 livingston: there's been a version of that around since 1.1 at least. it would be easy for there to be something 'old' in it.

22:54 amalloy: livingston: for sure. the text indicates that they're using 1.1, but i didn't find anything especially "old", just generally subpar. eg some "sample output" contains an apostrophe that wasn't present in the input that created it

22:56 livingston: amalloy: well, as long as it's documented and not too far off at least it's not a disservice. updating it would benefit the community though.

22:56 amalloy: no, of course, i don't want to badmouth it, just fix it

22:57 livingston: oh I just meant it's existence wasn't going to screw anyone new up.

22:57 amalloy: it also uses (apply concat (map (fn [x] ...))) instead of (mapcat (fn [x] ...)) in a section where they're like "here's a function for fixing up the clojure-specific aspects of the output; explaining it is beyond the scope of this book". is mapcat new?

22:57 livingston: ,(doc mapcat)

22:57 clojurebot: "([f & colls]); Returns the result of applying concat to the result of applying map to f and colls. Thus function f should return a collection."

22:58 livingston: how do you make it tell you when it showed up?

22:58 amalloy: livingston: usually i don't bother because a lot of functions lie

22:58 but ##(meta #'mapcat)

22:58 sexpbot: ⟹ {:ns #<Namespace clojure.core>, :name mapcat, :file "clojure/core.clj", :line 2117, :arglists ([f & colls]), :added "1.0", :doc "Returns the result of applying concat to the result of applying map\n to f and colls. Thus function f should return a collection."}

22:59 livingston: it wouldn't surprise me that it's been around that long, it's a pretty core thing in a lisp.

22:59 ,(meta #'mapcat)

22:59 clojurebot: {:ns #<Namespace clojure.core>, :name mapcat, :file "clojure/core.clj", :line 2117, :arglists ([f & colls]), :added "1.0", :doc "Returns the result of applying concat to the result of applying map\n to f and colls. Thus function f should return a collection."}

22:59 livingston: just curious.

23:00 what's the difference between these two bots anyway?

23:00 amalloy: livingston: they were built from the ground up independently. there are a lot of differences

23:02 livingston: amalloy: i recall a lisp channel having something like sexpbot, but maybe I'm confused, I wonder if they are related.

23:02 why both building two, work together ;)

23:02 amalloy: livingston: lambdabot lives in #lisp, i think

23:02 livingston: AH! that's the one

23:02 amalloy: but sexpbot is in a lot of channels, so you might have found him anyway

23:03 livingston: amalloy: it's possible lambda bot is signaled with something like sexp or something that might have been the commonality

23:07 amalloy: anyway sexpbot was started by Raynes, and i joined in october or so. clojurebot is owned by hiredman

23:08 livingston: good to know. I see hiredman talk to clojurebot a lot, I figured it's probably his.

23:12 ssideris: hello... does anyone know how to pass jvm flags from leiningen? I'm trying to debug with JSwat (see http://markmail.org/message/s42sxxv6a2zshwdy )

23:13 the leiningen sample.project.clj has this :jvm-opts ["-Xmx1g"]

23:13 but it's unclear whether these are applied when I do "lein swank"

23:13 amalloy: they are

23:13 livingston: that looks like it - that's sen

23:13 oop accidental enter

23:15 ssideris: amalloy: well, it seems that JSwat can't connect to the jvm, that's why I thought they weren't

23:15 but it must be some other problem then...

23:16 amalloy: ssideris: i've used the jvm-opts setting to make the swank server accept incoming java-debugger connections, so it works

23:17 livingston: how are you setting jvm-opts?

23:18 ssideris: livingston: :jvm-opts ["-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n"]

23:18 amalloy: or it's at least supposed to

23:18 oh, good catch livingston

23:18 livingston: that's how you'd normally do things like that but in lein given you example was a vector

23:19 I'm guessing it expects multiple string?

23:19 amalloy: i would assume so, yeah

23:19 ssideris: let me try...

23:19 amalloy: ["-Xdebug" "-Xrun..."]

23:19 ssideris: yep! that's what it is!

23:19 thanks a lot :-)

23:20 livingston: I caught a bug in the swank mvn target this way...

23:23 ok it was my "mistake" in the first place for using extend instead of having defrecord refer to my protocols directly, but if I ever offer to fix that mistake again, just shoot me.

Logging service provided by n01se.net