#clojure log - Jan 01 2013

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

0:00 mpan: is the version of slime in the repo not the right one for ritz?

0:00 Frozenlock: mpan: swank/slime is no longer supported IIRC.

0:00 (for clojure)

0:01 mpan: I'm following the directions for ritz and I thought it asked me to install slime

0:01 or am I misreading?

0:01 Frozenlock: ... ritz? Like the cookies?

0:02 https://github.com/pallet/ritz I see...

0:03 mpan: should I use that or something else for repl/debugging?

0:03 Frozenlock: I simply use nrepl.el on emacs

0:03 Lein does the rest.

0:03 * Frozenlock praises technomancy

0:04 mpan: what if anything do you use for interactive debugging/stepping?

0:04 callen: mpan: http://github.com/pallet/ritz/

0:04 Frozenlock: the repl will show you a backtrace if you get an error

0:05 mpan: callen: do you know if that works with the ver of slime the package installer fetches?

0:05 or should I specifically use the version that page links me to?

0:06 callen: mpan: use clojure-mode and nrepl.

0:06 mpan: ritz is designed to interact directly with nrepl.

0:07 mpan: am I misinterpreting the install instructions here? https://github.com/pallet/ritz/tree/master/swank

0:07 is the section on slime something else?

0:07 callen: mpan: just go with it, but realize people are switching away from slime.

0:08 mpan: how should I install ritz independent of slime?

0:08 callen: mpan: what did I tell you?

0:08 mpan: I said, repeatedly, keep it simple.

0:08 mpan: get one thing working at a time.

0:08 mpan: sorry but I think I'm misinterpreting

0:08 callen: mpan: start with vanilla emacs, get comfortable editing Clojure code that way.

0:09 maybeeee toss in Clojure mode, no more.

0:09 then maybeee toss in nrep

0:09 then maybeeee toss in ritz.

0:09 mpan: comprende?

0:09 mpan: in the meantime, do you mean to use "lein repl" independently?

0:09 I get your point now; sorry about before

0:10 I was misinterpreting some instructions as "this is the next step in the same process"

0:10 callen: you can do whatever you want, but you're attempting to learn too many things at once.

0:10 mpan: I was fundamentally misunderstanding that these components were independently usable

0:10 my misinterpretation was that this was one set of install instructions and I was trying to complete them

0:10 sorry about that

0:11 and thank you for clarifying it

0:12 callen: mpan: they are independently usable in some capacity, the point is that you don't have the mental bandwidth to learn emacs, and clojure, and a bunch of nifty toys for doing clojure in emacs.

0:12 mpan: part of the reason I recommended Emacs earlier wasn't the nifty toys, but because unmolested it would be a simple and clean way to write Clojure code without the slowness of CCL.

0:12 mpan: out of all of that, the nifty toys are the most disposable element and the least critical to you learning Clojure or Emacs.

0:13 amalloy: mpan: your high school intro is about as functional as i am in vi. i know how to type things in, undo, and either save or abort when quitting

0:13 if i'm feeling really fancy i'll try d$

0:13 mpan: callen: thank you for clarifying that they are separately usable

0:13 amalloy: well at least they taught you undo; that's a real plus

0:13 amalloy: oh, there was no "they"

0:14 that was me using eclipse in real life, and vim whenever i needed to ssh somewhere; and occasionally looking for tips on the web

0:14 tomoj: "hmm, what's the least googleable name possible that's still distinctive? oh, "d$"!"

0:15 huh, wait

0:15 google can apparently see \$ now

0:15 oh, it's not a name :)

0:15 mpan: they've been gradually improving their handling of short, punctuation-y, and otherwise strange queries in what feels like the past year or few

0:19 tufflax: callen, mpan: hehe I wanna setup emacs with ritz and everything, because I just wanna use it as a debugger :P

0:19 Trying atm...

0:20 mpan: yes, in the long run, a debugger would be a big help for my use case

0:30 tufflax: I got emacs and clojure-mode. Then I did what the readme say here https://github.com/pallet/ritz/tree/develop/nrepl (putting stuff in init.el and .lein/profiles.clj) and then did M-x nrepl-ritz-jack-in, it started downloading stuff, but then failed with "Exception in thread "main" java.lang.ClassNotFoundException: com.sun.jdi.VirtualMachine" Am I doing something wrong?

0:31 callen: alright so we've had enough of text editors...where's this channel on Team Edward vs. Team Jacob?

0:31 tufflax: :p

0:34 mpan: it's funny because I associate twilight with someone I used to know and said person's relationships with certain others

0:35 p_l: callen: burn it with fire

0:35 callen: mpan: given that nobody in this channel likely knows your personal life, what you just said was meaningless :P

0:35 mpan: callen: given the situation, that's probably for the better :p

0:36 callen: mpan: then why mention it at all?

0:36 tufflax: I don't even get who Edward and Jacob are :p

0:36 mpan: it crossed my mind and perhaps I speak too soon when that happens

0:49 Raynes: callen: I

0:49 callen: I am more interested in team Damon vs team Stephen.

0:49 (I watch The Vampire Diaries)

0:49 * Raynes swears he isn't a teenage girl.

0:51 * Frozenlock finds it hard to believe, given the new information just received.

0:51 Frozenlock: You can still save yourself: do you watch twilight?

0:51 -Where vampires 'shine' in the sun, cause why not-

0:53 Raynes: I've read the series twice, once out loud to someone else.

0:53 I've seen the former three movies, care little about the rest.

0:53 I am not really a fan.

0:53 p_l: Raynes: well, for what's it worth, Vampire Diaries seem better than Twilight (my sis is big into it, had to be middleman in recent purchase of gadgets on ebay...)

0:54 Raynes: I really enjoy The Vampire Diaries. There is a lot of deus ex machina with the witches though.


0:55 At least vampires burn in the sun. Unfortunately, some have magic rings that make it ok.

0:55 But the stories in the show tend to be intelligent at least, and have a purpose.

0:55 Frozenlock: Yeah, that's so inconvenient to have to deal with the sun stuff. :P

0:55 Raynes: But I would probably like anything with Ian Somerhalder in it, so take it at face value.

0:56 Frozenlock: I'll admit I watched the first season.

0:56 Raynes: He is my man crush.

0:58 Frozenlock: Way too much 'ken' IMO.

0:58 Raynes: Like barbie's ken?

0:59 Frozenlock: Yeah.

0:59 Raynes: It's funny because that's just him. They don't do a whole lot to make him look the way he does.

0:59 But yes, ken.

0:59 * Frozenlock watched the first season for Candice Accola

1:00 Frozenlock: rrrRRRrrr

1:00 Raynes: <3

1:00 She looks *outstanding* in the third season.

1:01 callen: Raynes: I haven't seen the vampire diaries.

1:02 Raynes: http://www.imdb.com/media/rm3373303296/nm2127038 for anyone wondering who Candice Accola is.

1:02 callen: wow.

1:04 p_l: looks fine, despite being blonde :P

1:05 gfredericks: is this what happens in #clojure late at night?

1:05 p_l: dunno

1:05 * gfredericks is never up this late

1:05 Raynes: Yes.

1:05 p_l: it might be new year's and champagne

1:05 Raynes: This is what happens late at night when people start talking about vampire shows.

1:05 Frozenlock: gfredericks: No. Special day I guess

1:06 mpan: happy new year folks

1:06 Frozenlock: I watched Hellsing Ultimate OVA recently. Really enjoyed it. (Vampire anime)

1:06 mpan: internet new years is funny because of time zones

1:07 Raynes: Frozenlock: Blood+ is the only vampire-related anime I've ever seen. I enjoyed it.

1:07 Frozenlock: Who isn't in the new year yet? West coast?

1:07 Raynes: I am 2 minutes away.

1:07 tomoj: not quite yet central

1:07 Frozenlock: Raynes: excellent, I'll download it immediately.

1:08 gfredericks: &(filter #(and (zero? (rem 2013 %)) (.isProbablePrime (biginteger %) 100)) (range 2 2014))

1:08 lazybot: ⇒ (3 11 61)

1:08 p_l: as for mainstream hormonal teenage girl^W^W^Wvampire flicks, I have to say that I was strangely enticed by... Alice? in New Moon promo stuff

1:09 mpan: eastern is in, central is so nearly in

1:10 Frozenlock: Let's all talk in UTC.

1:10 gfredericks: breakfast time?

1:10 tomoj: so new years was 6 hours ago?

1:10 Frozenlock: Yes, for everyone!

1:11 Raynes: p_l: Ashley Greene is nice.

1:11 Alice was by far the best character in Twilight.

1:11 The only one with real personality.

1:11 p_l: heard similar on TVTropes

1:12 tomoj: well I guess I've completely stopped being interested in the fact that it's 2013 by now

1:12 as of, hmm, 5 hours 50 minutes ago?

1:12 gfredericks: it's been a while since we had a 4-distinct-digit-year

1:12 * gfredericks thinks

1:13 gfredericks: 1987?

1:13 Raynes: gfredericks: 1987

1:13 I was dead at the time.

1:13 tomoj: wow

1:13 I never noticed all those years

1:13 p_l: also 2013 => 0123 :D\

1:13 gfredericks: slick

1:14 tomoj: last time was 1230?

1:14 gfredericks: 1320

1:14 ivan: 1320

1:14 tomoj: ah, ofc

1:14 Frozenlock: Something is very odd with #clojure this evening.

1:14 ivan: this is a job for core.logic, not our puny brains

1:15 gfredericks: who will write logicbot

1:15 * amalloy reminisces about the days when multiplying the digits of the year together didn't just result in zero

1:15 Frozenlock: Can't clojurebot just require logic?

1:15 gfredericks: ,(require '[clojure.core.logic])

1:15 clojurebot: #<RuntimeException java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate clojure/core/logic__init.class or clojure/core/logic.clj on classpath: >

1:15 p_l: and inevitably run it on memory-starved VM that will die under Clojure's memory hunger? :P

1:15 gtrak: Raynes, I think being not born is not the same as being dead

1:15 tomoj: maybe you'll live to see more of those days :/

1:16 Raynes: gtrak: What is the difference?

1:16 ivan: 2111 is a long way away

1:16 Raynes: gtrak: If you're dead, you're not alive, if you're not born you're not alive.

1:16 gtrak: Raynes: there had not yet been a you

1:17 to be dead

1:17 p_l: shit. I haven't slept, and I have to arrive at 0730 at work tomorrow

1:17 Frozenlock: p_l: What kind of work? Corner store?

1:17 tomoj: when, say, the sun goes, will there then be a me to be dead?

1:17 p_l: Frozenlock: IT?

1:18 Raynes: gtrak: But matter can never be created nor destroyed, therefore I already existed, just in a different state.

1:18 mpan: Raynes: philosophers are very interested in that

1:18 gtrak: nah... haven't you ever read strange loop?

1:18 tomoj: :D

1:19 gtrak: Hofstadter at least thinks there's no I without consciousness

1:19 callen: Raynes: your identity is a configuration of matter which exists in a continuous flux

1:19 Raynes: that configuration had not manifested yet. You were not dead, you did not exist.

1:19 Raynes: $dict dead

1:19 lazybot: Raynes: adjective: Having lost life; no longer alive.

1:19 callen: PWNT!

1:19 tomoj: 'configuration' good word choice

1:19 Raynes: You can all go to hell.

1:20 callen: Raynes: philosophy was a very serious hobby of mine until an ex burnt it out of my soul.

1:20 Raynes: I can win this game blind drunk and punched in the gut.

1:20 Raynes: You might get the latter.

1:21 callen: Raynes: I've been known to accept impromptu fight offers.

1:21 Raynes: I've been known to win.

1:21 * Raynes puts his dukes up

1:21 callen: I really enjoy fighting, I don't need to win to enjoy it. Fighting me is like wrestling a pig. He'll enjoy it regardless and you'll just end up covered in shit.

1:22 anyone notice HN is down?

1:22 Raynes: I didn't because it isn't.

1:22 Okay, now it is.

1:22 It wasn't literally 1 minute ago.

1:23 tomoj: Y2013 bug?

1:23 Raynes: I wouldn't doubt it.

1:23 HN is not a feat of quality softwaresmanship.

1:24 * callen high fives Raynes

1:24 callen: you'd be surprised how often people will defend the indefensible.

1:24 Raynes: It's written in a half-assed language.

1:24 Frozenlock: Y2013 bug at 14min past the hour?

1:24 callen: Raynes: glorified dialect of Racket.

1:24 tomoj: software man-ship

1:24 gtrak: but but Arc can write a web form handler in 4 lines!

1:24 Raynes: Abandoned dialect.

1:24 callen: Raynes: the real key to the hilariousness is the refusal to use a proper database or a normal persistence model.

1:25 Raynes: the site itself persists to file paths and the links are based on continuations.

1:25 Raynes: callen: Oh, don't forget the lovely table-based layout.

1:25 * Frozenlock Hates how the 'next page' link always fails after a few minutes.

1:25 callen: Raynes: that I can more readily forgive than the continuations and file path silliness.

1:25 ivan: you have to use AutoPager more pages quickly

1:25 callen: Frozenlock: that would be due to the continuations.

1:26 which plugs into the caching model

1:30 gtrak: is anyone still using stackless python?

1:30 callen: gtrak: try very hard to forget that period in my life.

1:30 gtrak: most people use gevent or twisted these days.

1:30 technomancy: I have to maintain a twisted codebase

1:30 callen: technomancy: I'm sorry.

1:30 gtrak: I remember glancing at it and thinking it was cool a few years ago, but I never had to actually use it.

1:30 technomancy: it's only like 100 lines and I'm working on replacing it

1:30 callen: LOL

1:34 dcb: ... so I'll bite. Whats wrong with Racket/Scheme?

1:35 technomancy: dcb: not racket, arc

1:36 dcb: Callens comment was that Arc is a glorified dialect of Racket, imlying Racket is... I'm not sure what he was implying

1:36 which was why I asked

1:37 gtrak: it sounded to me like it's not needed, since Racket is good enough at being Racket

1:37 technomancy: I think he was implying Racket is a thing which it is possible to make crappy dialects of =)

1:37 dcb: hah. fair enough

1:45 amalloy: the good news is, racket is a lisp focused on language-building, so you can write a crappy dialect without leaving the language at all! silly arc

1:45 yogthos_: amalloy: I'm surprised there's not Clojure implementation on top of racket ;)

1:45 technomancy: amalloy: harder to get legions of adoring fans that way

1:46 yogthos_: seems like it could be an easy one to port clojurescript to :)

1:46 amalloy: you think it would matter? seems to me pg would have a similar number of arc-lovers whether it was wholly new or a racket #lang

1:50 callen: I talked to PG about Lisp dialects not too long ago, he endorsed Clojure.

1:50 I think he recognizes Arc was a personal indulgence.

2:10 gtrak: (is 3)

2:18 tomoj: it would be convenient (but unfortunately misleading) if #inst had a special case where 'now read to (Date.), like #inst now

2:19 (java.util.Date.) is just too much for me to type I guess

2:20 gtrak: (now) might make more sense in terms of eval-time-guessing

2:20 tomoj: oh, yes, I have that but was too lazy to require it

2:20 would love to see that in core :)

2:21 oh, you mean #inst (now) ?

2:21 gtrak: not quite sure what that means, as I haven't used instant literals ever, I just mean having a function somewhere

2:21 tomoj: right

2:25 gtrak: but I'm a fan of huge util namespaces

2:26 Raynes: You are my sworn enemy.

2:26 gtrak: I think it's worse for libs than applications

2:26 I get annoyed when I have to require external packages more than a couple of times

2:28 whatever.. I see how you guys do it at flatland... aliasing the heck out of everything

2:29 tomoj: useful is one giant util namespace, yes?

2:29 virtually

2:31 amalloy: yes. and i'll thank you to pretend useful.core doesn't exist, gtrak; it's a terrible namespace that i added just because ninjudd thought he might get tired of remembering what namespaces various functions are in (so far, this has not happened)

2:31 tomoj: aha

2:32 callen: amalloy: dude, there is a fuckload of undocumented functionality floating around in there.

2:33 amalloy: okay?

2:33 clojurebot: okay is pokau

2:34 callen: amalloy: would a PR to start documenting stuff be welcomed?

2:34 amalloy: certainly. i was trying to find a link to the "fork this repo" button i could snarkily link you to

2:34 but that button appears to be mainly javascript, so you're off the hook

2:35 callen: amalloy: pardon me for trying to bring the power of clojure to people who aren't part of the inner circle.

2:35 This is the sort of fucking thing I'm talking about as far as a wiki goes.

2:37 amalloy: most of the functions do in fact have docstrings, and they also mostly have tests

2:38 callen: amalloy: that's not what I mean and you know it. How is anybody supposed to find out this exists?

2:38 amalloy: that's the point of a wiki, it raises awareness of code that can prevent duplicated effort.

2:42 gtrak: clojuresphere has a list of dependents and dependencies for a bunch of github projects, that might be a good starting point

2:42 amalloy: well, as i said we'd love some pull requests or wiki edits improving documentation. we don't maintain useful so that everyone can find it, though; it's there because we need it, and it's open-source and moderately documented because that's the amount of work anyone's excited to do to make it usable by others

2:42 callen: I'm talking about curation and discussion.

2:43 amalloy: I'm mostly frustrated by the negativity towards a community wiki and the seemingly intentional and persistent misunderstanding of where the utility lies.

2:47 dyreshark: hi guys! i don't mean to butt in, but i've got a question about macros really fast.

2:47 i'm reading clojure in action, and i got to this bit of code:

2:47 http://pastebin.com/TeVrVHAS

2:47 gtrak: ~guards

2:47 clojurebot: SEIZE HIM!

2:48 dyreshark: how is it that you can call login-user with a single argument?

2:48 gtrak: `(defn ~name [{:keys ~args}] emits a defn form that expects a single argument

2:48 dyreshark: (don't seize me bro)

2:49 gtrak: &((eval '(defn a [b] (inc b))) 1)

2:49 lazybot: java.lang.SecurityException: You tripped the alarm! eval is bad!

2:49 gtrak: it works, trust me :-)

2:50 dyreshark: haha, alright. cool :p

2:50 thanks :D

2:50 amalloy: dyreshark: has the book covered destructuring yet?

2:51 i guess it must or he wouldn't be writing this

2:51 dyreshark: amalloy: to an extent. i know how to do something like (let [ [a b c] some-list ] ...)

2:51 gtrak: unless it's one of those 'behold the power of this thing you don't understand yet' deals

2:51 dyreshark: or something to that effect

2:51 i don't quite get the {:keys ~args} bit though :/

2:52 amalloy: &(let [m {:a 1 :b 2 :d 4}, {:keys [a b c]} m] [a b c])

2:52 lazybot: ⇒ [1 2 nil]

2:52 cemerick: That's a *bizarre* sample

2:52 Maybe it's more sensible in context.

2:53 gtrak: &(macroexpand '(let [m {:a 1 :b 2 :d 4}, {:keys [a b c]} m] [a b c]))

2:53 lazybot: ⇒ (let* [m {:a 1, :b 2, :d 4} map__126488 m map__126488 (if (clojure.core/seq? map__126488) (clojure.core/apply clojure.core/hash-map map__126488) map__126488) c (clojure.core/get map__126488 :c) b (clojure.core/get map__126488 :b) a (clojure.core/get map__126488 :a)] [a b c])

2:53 dyreshark: OH. OH. OH. I GET IT NOW

2:54 thank you

2:54 gtrak: ha, really?

2:54 dyreshark: all

2:54 :P

2:54 i just had to think it through. :P

2:54 callen: it expands to let*

2:55 dyreshark: i was being silly and thinking of the arg list in more of a let context. so i was wondering where the map got passed in

2:55 and then it occured to me that i was thinking of it wrong. thanks again XD

2:55 gtrak: ah, yea, that looks weird initially

2:56 you'll really flip when you see keyword args destructuring

2:56 dyreshark: link? :o

2:56 /terms to google? :p

2:56 or just make me flip out live in the channel. i'm not picky

2:56 amalloy: ugh, don't link to that. keyword args is overused

2:56 gtrak: &((fn [& {:keys [a]}] a) :a 3)

2:56 lazybot: ⇒ 3

2:57 gtrak: yea, I don't really like it, but it's fun

2:57 dyreshark: wat.

2:57 amalloy: dyreshark: advice: don't worry about it

2:58 handy to know, and a neat feature, but not mission-critical to learning clojure

2:58 dyreshark: oh. can that just be approximated to something like debug(output = "statement", prio = Debug.ERROR) in python?

2:58 or your language of choice? :p

2:58 gtrak: yea.. it saves you from { }

2:58 dyreshark: oh, that's nifty

2:58 cool

2:59 gtrak: it breaks apply though

2:59 complicates it, I guess

2:59 dyreshark: yeah, i can see that

3:03 gtrak: amalloy: I was against it in general until I saw this: "do you have a counter-arg

3:03 "Unroll optional named arguments. Callers should not have to wrap optional named arguments in a map literal" in clojure-dev library coding standards

3:04 desregard my typo

3:04 maybe more relevant as top-level api and not beneath

4:35 arkydo: I try to get clojure running in emacs. What should I put in .emacs.d/init.el to make work?

4:35 azkane: have you downloaded nrepl yet?

4:37 arkydo: I've try to run clojure with M-x run-lisp in emacs.

4:38 azkane: you should get this: https://github.com/kingtim/nrepl.el

4:47 arkydo: azkane: I've installed nrepl.el. How do I run it in emacs?

4:49 azkane: arkydo: open a file of a lein project, then run nrepl-jack-in

5:10 arkydo: azkane: Where I find the files in the lein project?

5:11 azkane: arkydo: you need to download lein and create a new project if you havent done so

5:12 nrepl also has nrepl-interaction-mode, but its very limited

5:32 arkydo: How do I start a new repl session?

5:32 ejackson: lein repl ?

5:32 you need to be in the directory of the clojure project

5:33 arkydo: ejackson: That's works.

5:34 ejackson: sweeet

5:34 arkydo: How do I open a repl session in emacs if possible?

5:35 ejackson: the easiest thing to do is get your paws on emacs-live

5:36 https://github.com/overtone/emacs-live

5:36 follow the easy install process

5:36 then open your project.clj file

5:36 m-x nrepl-jack-in

5:36 and you're a rock star!

5:48 Ralt: happy new year people!

5:49 arkydo: ejackson: That's awesone, thank very much.

5:51 ejackson: arkydo: enjoy, enjoy.

5:57 tomoj: https://www.refheap.com/paste/d3fe53cb90a9e9fa3df2fe17b evil?

5:58 callen: tomoj: after Let over Lambda, nothing surprises me.

5:58 tomoj: I guess it's probably buggy still

5:58 yeah, using str doesn't work of course

5:59 ejackson: funky

6:01 tsk tsk... a non namespaced literal :P

6:02 tomoj: I wouldn't release it outside of core as 'fn

6:02 that's just a demo

6:03 I guess `#fn 1` could be (constantly 1) ?

6:03 ejackson: just teasing - as if I don't do the very same thing :)

6:03 tomoj: curious, what non-namespaced literals do you use?

6:03 #fn % is identity?

6:04 #fn %2 is neat then

6:04 ejackson: oh, just little tags for when i'm passing my own data structures about

6:04 you know, #mythingie and the like

6:05 tomoj: ah

6:05 ejackson: pure laziness

6:43 svedubois: I would like to write an image with the name of the effect ("smooth") with the extension .png.

6:43 So using (write smooth) will write to output/smooth.png.

6:43 When (write sharpen) will write to output/sharpen.png.

6:43 What I am doing wrong?

6:43 (defn write [effect]

6:43 (str data "output/" (str effect) ".png"))

6:48 Raynes: svedubois: What is the error?

6:48 Are you passing the symbol just like that?

6:48 (write sharpen) will not work

6:48 You'd need to do (write 'sharpen)

6:49 svedubois: Thanks it works

7:03 I have retested and it doesn't works

7:03 When I try to use the symbol sharpen inside the function

7:04 it gives and error

7:04 I can use it as string in the output, that's fine, but I can use it as a symbol in other parts of the function

7:05 Type error but I cannot use it as a symbol in other parts of the function

7:09 Any advice to convert a parameter of a function to a string inside the function?

7:12 AimHere: svedubois, 'str' should do the trick

7:15 svedubois: It doesn't work

7:15 (defn write [image]

7:15 (println (str data "output/" (str image) ".png")))

7:15 (write smooth)

7:15 (str image) it doesn't result in "image"

7:16 Using smooth it doesn't gives "output/smooth.png"

7:18 Any advices?

7:24 terom: svedubois: why not just use string in the first place? (write "smooth") etc?

7:27 svedubois: because smooth it is not a string is and image smoothed, and in the function I write the image smoothed with the name smooth

7:30 azkane: svedubois: have you tried (str (quote arg))?

7:30 AimHere: .(str (quote arg))

7:30 &(str (quote arg))

7:30 lazybot: ⇒ "arg"

7:32 azkane: if youre calling str already you dont need to call it again on (quote)

7:32 AimHere: If you want to pass a symbol to a function, and have it converted to a string, you should be either passing the quoted symbol or you should be using a macro

7:40 svedubois: With quote it works, thanks

7:56 Retested, not it doesn't works

7:56 (defn show [image]

7:56 (println (str (quote image))))

7:56 (show smooth)

7:57 ;-> image

7:59 AimHere: (defmacro show [image] `(println ~(str image)))

8:00 That probably does what you want, providing that this stuff can all be done at compile time

8:01 If you're generating symbols at runtime to pass them into the macro, it won't work

8:01 pmaes: Perhaps I'm misunderstanding what you're trying to do, but isn't the name function suitable here?

8:02 AimHere: Wouldn't he have to quote the symbol he's passing to 'name'?

8:04 pmaes: Oh, yeah, you're right

10:20 borkdude: happy 2013 everybody

12:18 cjfrisz: First unintentional New Year's resoluation fulfilled: stop being too lazy to use screen+irssi to get vertical screen split for IRC

12:18 Something went wrong with the word "resolution" there...and it almost happened the second time, too

12:24 Natch: if you like screen you might love tmux. I recommend checking it out

12:36 gfredericks: how can I figure out why my /checkouts aren't being picked up?

12:41 man even `lein install` doesn't work. Will have to push to clojars just to try this out :/

12:48 cjfrisz: I know it's heavier-weight, but I'm a Terminator guy myself

12:48 But it just feels right to know screen splitting in screen

12:53 Foxboron: cjfrisz, checked out tmux?

12:56 brainproxy: gfredericks: have symlink/s in the checkouts dir? double-check to make sure link is pointing to the right place?

12:56 I've made that mistake a couple of times...

12:58 dcb: Anyone know of an efficient way to construct a tree out of the set of leaf->root paths? The paths are lazy sequences and expensive to realize. This has been bothering me all morning...

12:59 gfredericks: brainproxy: I think my issue was accidentally having the wrong groupname in the projecteclj

12:59 that was my issue in both cases :)

13:00 cjfrisz: Foxboron: I think I tried it one point

13:00 I used Crunchbang linux for a long time, and it shipped with Terminator

13:00 I came to really like it, so that's my default terminal emulator

13:00 Foxboron: cjfrisz, tmux is suppose to be a improved screen. But i cant apt-get on my vps so never been able to try it.

13:15 thorwil: how can i create a java.sql.timestamp (for testing purposes, actual time doesn't matter)?

13:17 (java.sql.Timestamp. (.getTime (java.util.Date.)))

13:18 brainproxy: Foxboron: older version of debian/ubuntu? tmux is probably available through backports

13:19 tmciver: thorwil: or (java.sql.Timestamp. (System/currentTimeMillis))

13:19 Foxboron: brainproxy, i think the vps is partly fucked :P But i only use it for screen+irssi anyway ^^

13:19 thorwil: tmciver: nicer, ty

13:21 brainproxy: Foxboron: gotcha ... I used to use irssi w/ screen, decent combo, but I switched to weechat w/ tmux, luv it

13:22 Foxboron: brainproxy, weechat...sounds like a fun chat.

13:23 brainproxy: Foxboron: similar to irrsi, but I've enjoyed weechat more

13:24 Foxboron: brainproxy, yeah looking at it now.

13:33 q_: a friend said to me yesterday "Without quantum mechanics there would be no transistor" , this is the smartest channel I know of, can anyone explain why or if this is true ?

13:33 friend/new in law

13:35 brainproxy: q_: may try #phsyics

13:35 *maybe

13:37 q_: no one in there :(

13:39 brainproxy: q_: check spelling, i see 268 nicks in there :)

13:40 gfredericks: dnolen: ping

13:41 dnolen: gfredericks: pong

13:41 gfredericks: dnolen: got a gist with weird FD behavior, one sec

13:43 brainproxy: q_: derp, I mispelled it when I typed it in here a few min ago, but had it right when i used the /join cmd in my irc client

13:43 try: ##physics

13:44 gfredericks: dnolen: https://gist.github.com/4429226 if that looks weird I'll file a bug

13:45 dnolen: this came up when trying out 0.8.0-beta4 on the code with which I discovered LOGIC-77

13:45 dnolen: gfredericks: so it does terminate? it just takes a lot longer?

13:45 gfredericks: dnolen: I haven't seen it terminate

13:46 but I haven't had more than maybe 15 seconds of patience

13:46 usually when core.logic runs for a while it means it's going to run my VM out of memory, so I don't experiment with that too much :)

13:47 dnolen: gfredericks: do you see the same problem if you use (interval 0 4) ?

13:48 gfredericks: dnolen: yeah; (interval 0 3) returns fast; (interval 0 4) is at ~15 seconds now and still going

13:48 * gfredericks interrupts it

13:54 gfredericks: why the heck is "Hyperbolic Topology" listed under "Crazy Clojure" in the clojure/west CFP?

13:55 it's super weird because I've never heard of the two topics connected before but I was twiddling the two in my head for the last month... o_O maybe it's a joke

13:59 dnolen: gfredericks: yeah checked it out, looks like a bug, feel free to add a ticket.

14:01 gfredericks: dnolen: will do; is a patch with this code as a test at all helpful?

14:01 Frozenlock: Still no video of the clojure conj?

14:02 dnolen: gfredericks: just put the code in the ticket, I will add a test case for it - it looks like a bug w/ the <=fd constraint

14:03 gfredericks: mark it as blocking ticket, I'm rounding up the tickets I want to wrap up 0.8.0

14:04 gfredericks: dnolen: okay cool; just got the example down to half the size

14:04 dnolen: gfredericks: great, thanks

14:09 tufflax: tpope: there?

14:09 tpope: yep

14:09 tufflax: hi, i'm the windows guy, as you may remember

14:10 tpope: yes

14:10 I solved one of your problems, and failed to reproduce the other

14:10 tufflax: I installed ruby with a windows installer from the ruby homepage I think

14:10 nothing special

14:10 but, do i need +ruby on vim?

14:11 tpope: you either need +ruby or ruby in your path

14:11 tufflax: i have ruby in my path

14:11 tpope: you'll probably want the former as executing external processes is painful on windows

14:11 when I added it to my path, +ruby started working automatically

14:12 I had to do it in the system settings or whatever. :let $PATH inside vim is too late

14:13 that's how I installed ruby too, btw

14:14 tufflax: ok, hm, let me see... I'll get back to you

14:27 svedubois: How I can convert this java line to clojure ?

14:27 binaryerodeimagefilter.setKernelType(org.itk.simple.BinaryErodeImageFilter.KernelType.Ball);

14:28 tmciver: svedubois:

14:28 oop

14:29 svedubois: The convention is (.methodName object args)

14:29 Well, it's not a convention so much as it is the rule.

14:29 svedubois: Something like this?

14:29 (-> binaryerodeimagefilter (.setKernelType (org.itk.simple.BinaryErodeImageFilter.KernelType/Ball))

14:30 tmciver: So: (.setKernelType binaryerodeimagefilter org.itk.simple.BinaryErodeImageFilter.KernelType.Ball) I think.

14:31 svedubois: And in the class:

14:31 public final static class KernelType {

14:31 public final static BinaryErodeImageFilter.KernelType Ball = new BinaryErodeImageFilter.KernelType("Ball");

14:32 tmciver: svedubois: Yes, I believe what you wrote should work too.

14:34 svedubois: My main problem is how to use static methods.

14:34 With / or with .

14:34 tmciver: with /

14:35 &(System/currentTimeMillis)

14:35 lazybot: ⇒ 1357068346562

14:38 svedubois: Something like this (more longer) it will be correct? "foo.bar.more.System/currentTimeMillis"

14:39 tmciver: svedubois: yes. You need to fully qualify the class if you did not :import it in the ns declaration.

14:40 svedubois: So I need to write (import '(foo.bar.more System))

14:40 to be able to use an static method like (System/currentTimeMillis)?

14:41 Always?

14:41 It is not possible to use the long "foo.bar.more.System/currentTimeMillis"?

14:43 tmciver: svedubois: It is possible to use the longer fully qualified form.

14:44 svedubois: but if you don't want to type it out all the time, it's better to import it.

14:44 svedubois: And there are any other way with dots "." ?

14:45 Without the "/"?

14:45 tmciver: svedubois: for the case of static methods in java.lang.System, you don't have to fully qualify it because everything in java.lang is automatically imported.

14:45 svedubois: the slash (/) is used for static methods and member variables; the dot is used with instance method calls.

14:46 svedubois: see http://clojure.org/java_interop

14:46 gfredericks: &(.getMethods Integer)

14:46 lazybot: ⇒ #<Method[] [Ljava.lang.reflect.Method;@932fb0>

14:48 tmciver: gfredericks: static method?

14:48 svedubois: In http://clojure.org/java_interop

14:48 (Classname/staticMethod args*) ==> (. Classname staticMethod args*)

14:48 Classname/staticField ==> (. Classname staticField)

14:50 tmciver: svedubois: yes, that's another way I had apparently forgotten about.

14:52 gfredericks: ah, that's a method call on the non-static Integer class?

14:53 ToxicFrog: tmciver: IIRC, under the hood it all macroexpands to calls to (.)

14:55 tmciver: ToxicFrog: yup: ##(macroexpand-1 '(.getMethods Integer))

14:55 lazybot: ⇒ (. (clojure.core/identity Integer) getMethods)

14:55 dnolen: gfredericks: thanks for the report, fixed in master

14:56 ToxicFrog: ,(doc macroexpand-1)

14:56 clojurebot: "([form]); If form represents a macro form, returns its expansion, else returns form."

14:56 ToxicFrog: ,(doc macroexpand)

14:56 clojurebot: "([form]); Repeatedly calls macroexpand-1 on form until it no longer represents a macro form, then returns it. Note neither macroexpand-1 nor macroexpand expand macros in subforms."

14:56 ToxicFrog: Ahaa.

14:58 gfredericks: dnolen: trying out the new commit now

15:00 dnolen: looks great!

15:02 svedubois: What does it mean the "$" in "org.itk.simple.BinaryErodeImageFilter$KernelType"?

15:02 The others methods don't have the "$".

15:02 I obtain this when I use reflection

15:02 dnolen: gfredericks: excellent

15:03 tmciver: svedubois: it's the way clojure identifies an inner class; KernelType is an inner class here.

15:03 dnolen: core 0.8.0-beta5 going out

15:03 gfredericks: w00h

15:06 tufflax: tpope: how can I display the output of foreplay so I can copy it

15:07 tpope: tufflax: if it's enough for a press enter prompt, it should just be copyable?

15:08 Ralt: yay

15:08 successfully wrote passing tests!

15:08 clojure is getting prettier and prettier.

15:12 tufflax: tpope: nope, i can't copy it :p

15:12 tpope: or, how do you mean? with the mouse? no

15:13 or are there a vim trick to copy those?

15:13 is* :P

15:17 tpope: tufflax: with the mouse, yes. but it may be different on windows

15:18 tufflax: tpope: oh, C-y can copy

15:28 demmonoid1: Guys, I can't get the point of the following:

15:28 user=> (= [1 2 3] '(1 2 3))

15:28 true

15:28 So far I understand, vectors and lists are serving different purposes and have different O-complexities for their operations (like, length, head-append and tail-append, and so on). Why are they considered equal in the above example then?

15:29 gfredericks: = would be a lot less useful if it were sensitive to that sort of thing

15:29 demmonoid1: Exactly

15:29 gfredericks: in particular because of how things like vectors easily get turned into arbitrary seqs

15:29 (let [v [1 2 3]] [v (map identity v)])

15:29 &(let [v [1 2 3]] [v (map identity v)])

15:29 lazybot: ⇒ [[1 2 3] (1 2 3)]

15:30 demmonoid1: Ah, less

15:30 gfredericks: &(doc =)

15:30 lazybot: ⇒ "([x] [x y] [x y & more]); Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner. Clojure's immutable data structures define equals() (and thus... https://www.refheap.com/paste/8009

15:30 tufflax: tpope: this is what happened https://www.refheap.com/paste/8010

15:31 tpope: tufflax: okay, the hanging is probably the real issue

15:32 tufflax: tpope: want me to try anything? :P

15:33 tpope: tufflax: I would guess that solving this would be less productive than just trying to get +ruby working

15:33 tufflax: if you :echo has('ruby'), it returns 0, correct?

15:34 tufflax: tpope: yes. So, +ruby/dyn is not good?

15:34 tpope: tufflax: +ruby/dyn means support is compiled in, but it can't find the library

15:34 tufflax: :help ruby-dynamic

15:35 tufflax: ok, I'll try to fix that

15:36 tpope: tufflax: otherwise, you're going to get really sick of that dumb minimized DOS box popping up all the time

15:36 tufflax: hehe

15:40 * gfredericks wonders how easy it is to generate a lazy seq of all hex colors ordered by basicness

15:43 AimHere: Probably only very slightly harder than concocting a rigourous definition of 'basicness'

15:44 gfredericks: haha

15:45 well we have to order (range 256) by basicness first

15:46 0,255,127,63,191,...

15:47 AimHere: Do you mean, by 'basicness', closeness to a primary colour?

15:47 gfredericks: maybe?

15:47 well no

15:48 because [0,0,255] should be quite basic while [0,0,254] should not

15:48 AimHere: As in #ff0000 is very very basic, and #ff3454 very much less basic

15:48 gfredericks: I think low entropy is a lot closer intuitively

15:48 AimHere: Those colours are almost identical though

15:48 gfredericks: quite

15:48 I want the former a whole lot closer to the front of the list than the latter

15:48 use case is to use (take n (colors)) to get n decently different colors

15:49 AimHere: In that case, does it matter whether you pick (0,0,254) or (0,0,255)?

15:49 Don't you just want colours to be very far from each other?

15:50 In which case, treat the colourspace as a 3-dimensional cube, and use some standard metric, like the euclidean one

15:50 and then for a given set of colours, pick the ones most distant

15:50 from each other

15:51 gfredericks: doing it in order of entropy seemed like the most elegant idea

15:52 though not an obvious algorithmic way to do that

15:52 the idea is that it's conceivable to have a single ordering over all the colors for which any prefix of that list gives you a "decently different" color set for that size

15:53 rather than doing it ad-hoc

15:55 AimHere: Couldn't you just do it with the highest k bits of the 3 colour values, for the smallest k you have

15:55 If you want 6 different colours, then you just pick the top 2 bits for each of the R,g, b values, giving you 3 *4 = 12 values to pick from

15:58 So for the 6- case, you just have either 0xff, 0x7f, 0xbf and 0x3f for each of the r,g, and b values

15:59 Pick your favourite 6 of the available 12 colours

16:00 deg: Probably better to weight the choice of values. On a typical monitor, the darker colors require a greater numeric difference in R, G, or B to be distinguished.

16:01 borkdude: Is there something different with stdout when I execute "lein run" and "lein repl"?

16:02 hyPiRion: something different?

16:02 In both cases, stdout = stdout

16:05 borkdude: hyPiRion when I run 4clojure locally with lein repl and then (run), when a registered heart-beat (it executes a println periodically about memory usage), I see it's output, but not with lein run

16:08 technomancy: borkdude: yes, lein repl uses a socket connection for stdin/out so it can work remotely

16:08 gfredericks: AimHere: that's probably the most reasonable way to do it -- order by the number of lower-order 0's

16:09 technomancy: borkdude: unless you lein trampoline repl, in which case it skips nrepl

16:10 borkdude: technomancy it works fine with lein repl, but I don't see (some) output in lein run

16:10 svedubois: I have an example in python and in java that I would like to convert to clojure.

16:10 I have tried differents ways but without any result.

16:10 Can you give me some advice?

16:10 I would like to set the kernel filter to cross in clojure.

16:10 The information about the class is here (it describes the C++ API of BinaryErodeImageFilter):

16:10 http://www.itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1BinaryErodeImageFilter.html

16:10 This is in java:

16:10 filter.setKernelType(org.itk.simple.BinaryErodeImageFilter.KernelType.Cross);

16:10 And this is in python:

16:10 filter.SetKernelType ( sitk.BinaryErodeImageFilter.Cross )

16:11 How I can write this line in clojure ?

16:11 technomancy: borkdude: very strange; lein run is much simpler so you'd expect it to have fewer weird cases

16:11 borkdude: technomancy hyPiRion https://www.refheap.com/paste/8011

16:11 technomancy: borkdude: lein trampoline run maybe?

16:12 borkdude: technomancy as you can see, with lein run I don't get the printlns from register-heart-beat

16:12 hyPiRion: borkdude: try (binding [*block-server* true] (run)) instead

16:12 check if that changes anything

16:12 borkdude: hyPiRion -main already has that?

16:13 deg: (new topic) Can any of you point me to examples of using Cheshire to dump typed nested Clojure maps? Details: I'm using Cheshire to dump some clojure maps as JSON. I need to annotate the JSON with some extra info that is not in the maps. This includes annotations on objects that are deep in the tree I'm dumping. It looks like Cheshire has protocol support that should make this trivial, but I am near-ignorant of this part of Clojure. So,

16:13 hyPiRion: borkdude: in the repl, I mean

16:13 borkdude: technomancy lein trampoline run doesn't change anything

16:14 hyPiRion will try that now

16:14 hyPiRion works the same as just (run)

16:14 technomancy: borkdude: in that case I suspect it's not Leiningen

16:15 borkdude: weird

16:15 svedubois: (.setKernelType filter org.itk.simple.BinaryErodeImageFilter.KernelType.Cross)

16:15 it doesn't work.

16:18 xeqi: svedubois: is org.itk.simple.BinaryErodeImageFilter.KernelType.Cross an inner class?

16:20 svedubois: yeqi Yes, it is an inner class

16:20 public final static class KernelType {

16:20 public final static BinaryErodeImageFilter.KernelType Cross = new BinaryErodeImageFilter.KernelType("Cross");

16:20 technomancy: deg: what are typed nested Clojure maps?

16:20 deg: you mean type hints? or records?

16:21 hyPiRion: svedubois: try out org.itk.simple.BinaryErodeImageFilter.KernelType/Cross

16:24 deg: Hmm. connection closed while I was typing ahead. Looks like my last few lines were lost. sigh.

16:25 by "typed nested maps" I meant that each of my objects is a simple clojure map, with :type metadata.

16:25 svedubois: (def erode (org.itk.simple.BinaryErodeImageFilter.))

16:25 (.setKernelType erode org.itk.simple.BinaryErodeImageFilter.KernelType/Cross)

16:25 deg: Some of the values in these maps are other maps, also typed.

16:25 svedubois: hyPiRion: Doesn't work

16:26 deg: I just want to dump the whole structure with each node knowing how to dump itself, but leveraging as much as possible of the Cheshire infrastructure.

16:27 (if somone already answered between 2:08 and 2:11, sorry, I missed your reply)

16:30 technomancy: Just found your question in the IRC logs. I meant type hints (if that's the term for :type metadata) but I could switch to records if that will help.

16:32 xeqi: svedubois: org.itk.simple.BinaryErodeImageFilter$KernelType/Cross

16:32 inner classes need to use a $ instead of a . for the differentiation from the parent

16:34 svedubois: xeqi: It works!! Thanks

16:39 technomancy: deg: I don't think cheshire supports metadata but I could be wrong

16:44 deg: technomancy: Do you know what kind of objects it does support? (confession: I'm still pretty vague on the fancier typing in clojure)

16:45 technomancy: deg: no shame in that; most code doesn't need any knowledge of types. I don't know how to extend cheshire myself though.

16:46 deg: I've just looked at the Cheshire source code. I don't really understand the typing stuff it is doing, but looks like it should be pretty straightforward for me to add metadata support (at least in a private branch where I don't have to worry about it slowing down the existing cases).

16:47 And, for now, I guess I'll get by without dumping my annotations. They were just "nice-to-have"s.

16:48 technomancy: yeah personally I use multimethods any time I need polymorphism but I can understand why it's not appropriate for cheshire

16:48 since json encoding is often a bottleneck

16:48 but as a general rule in Clojure: if you can do it with a plain map you almost always should

16:50 deg: Yup, I'm only a few dozen hours into Clojure, but maps definitely rock.

16:51 borkdude: what is that website again with information about dependencies on clojure libraries

16:51 deg: I've possibly even taken the paradigm one step too far, using maps as "whiteboards" (in the AI sense from way back when) to carry around lots of data where each function picks and chooses what it cares about.

16:59 xeqi: borkdude: clojars?

16:59 clojuresphere, clojureatlas, github

17:01 borkdude: xeqi clojuresphere, that's what I meant - unable to find it by google….

17:04 anyway tnx

17:05 gfredericks: what's the status on cljs sourcemaps?

17:09 ibdknox: gfredericks: dnolen said there's some changes to emit that would need to happen. Probably a solid couple weeks' worth of work

17:18 dnolen: gfredericks: what ibdknox said, waiting on 1.5.0 release to merge the work in.

17:19 gfredericks: then I'd like to switch to blind for the source reader so we can get enough information, then probably a couple of weeks of work

17:40 edlich: Hi all, is there a way to write a function that gets me all the elements of a cycle lazy: Like (def mycycle (cycle ["A" "B" "C"])) And then I want to call something like: > (take 1 mycycle) "A" > (take 1 mycycle) "B" > (take 1 mycycle) "C" > (take 1 mycycle) "A" Any hints?

17:41 hyPiRion: That's not immutable though, better just iterate over it I suppose

17:41 edlich: how?

17:41 clojurebot: with style and grace

17:41 metellus: edlich: cycle

17:41 does exactly what you want

17:42 well, it gives a lazy infinite seq of those elements cycled

17:42 xeqi: (for [x (take 10 (cycle ["A" "B" "C"]))] (str x "->"))

17:42 &(for [x (take 10 (cycle ["A" "B" "C"]))] (str x "->"))

17:42 lazybot: ⇒ ("A->" "B->" "C->" "A->" "B->" "C->" "A->" "B->" "C->" "A->")

17:42 hyPiRion: xeqi beat me to it

17:42 edlich: I do not want to realzie the cycle

17:42 I do not not if its 10, 100 , 1000 or more

17:44 hyPiRion: You're not realizing the cycle though.

17:44 edlich: Yes I do. In the example you take 10

17:44 But my grandma wants N

17:45 hyPiRion: ,(do (take 10000 (for [x (take 10000 (cycle ["A" "B" "C"]))] (do (Thread/sleep 1000) x))) (println "that was fast"))

17:45 clojurebot: that was fast

17:46 edlich: A function that wrapps this: (getnext (cycle ["A" "B" "C"]))

17:48 Perhaps cycle is wrong here. I should write a function that gets the list, maintains the index and resets the index ant the and. Then returns the elements from the list.

17:48 xeqi: there is not a builtin function that acts like an Iterator.

17:48 usually those require mutable data structures, and clojure avoids them

17:49 edlich: ok.

17:49 hyPiRion: You could use `atom` and update the cycle of course, if you really want to

17:50 metellus: is it rest or next that holds onto the head?

17:50 xeqi: edlich: when do you learn how much of the cycle you want?

17:50 amalloy: metellus: neither one?

17:50 edlich: never.

17:51 gfredericks: amalloy: let's write one; what should it be called?

17:51 metellus: did one of them used to? I thought I remembered there being a stack overflow issue if you used recur with the wrong one of those

17:51 amalloy: let's call it let

17:51 metellus: but I must have misunderstood the reason

17:51 gfredericks: (fn ned [coll] (with-meta (rest coll) {:head coll}))

17:52 amalloy: metellus: it's possible rest used to, metellus, but i think if you go as far back in time as that, rest acted like next now does, and next didn't exist

17:52 amalloy: three cheers, amalloy, for extraneous highlighting, amalloy. amalloy

17:53 hyPiRion: metellus: Just remember to `lose your head`, and you should be fine.

17:53 clojurebot: I don't understand.

17:53 tufflax: edlich: why do you want a function like the one you described? Side effects are no good! :p

17:53 gfredericks: clojurebot: wait till you're older

17:53 clojurebot: No entiendo

17:54 edlich: This is not cycle-alike. But I understand that my wish requires a persistent index :-(

17:55 hyPiRion: transient you mean

17:55 Probably.

17:55 amalloy: hyPiRion: persistent, in the opposite sense of the word that we usually use in here

17:55 tufflax: edlich: but why do you need a function like that?

17:55 edlich: In games you need this often.

17:56 tufflax: I don't believe you :p

17:56 amalloy: no you don't. you use it often, when writing games in a language that encourages it, but you certainly don't need it

17:56 edlich: Tic Tac Toe might be the wrong example because you can determine the size here.

17:57 Lets simply have 10 players who play an infinite game. How do you mark them?

17:58 tufflax: What do you mean by mark them?

17:58 edlich: you need an infinite cycle to adress them.

17:58 AimHere: Couldn't you do what you want with a functional style. you have a function that returns a vector containing a) the next player in the cycle and b) the next function to call

17:58 edlich: Player 10 make a move. Player one make a move, Player two...

17:59 hyPiRion: I'd recurse over them.

17:59 edlich: ok instead of persisting the index I would pass it around. Hm.

17:59 amalloy: (loop [game-state {...}, players (cycle [a b c])] (if (done? game-state) finish, (recur (make-move game-state (first players)) (rest players)))), for example

17:59 Sgeo: Fun fact: I think Racket has the sort of "namespaced anaphors" I described, although I don't think anaphor is an appropriate term for anything in a hygienic macro system

18:00 azkane: quick question is getting a random number considered as side effect?

18:01 xeqi: yes

18:01 gfredericks: depends who you ask :)

18:01 Sgeo: When you return a random number from a function, your function is no longer referentially transparent

18:01 Two invocations of the function can return different results

18:01 edlich: Thanks amalloy and all the others!

18:01 gfredericks: I remember an involved discussion about that a couple months ago

18:02 tufflax: Sgeo: but it is not quite the same thing as a side effect

18:02 azkane: so i shouldnt use them in lazy seqs?

18:02 gfredericks: it seemed legit to distinguish between nondeterminism and full-blown side effects

18:02 &(take 10 (repeatedly #(rand-int 20)))

18:02 lazybot: ⇒ (16 7 8 12 9 19 13 1 11 8)

18:03 Sgeo: I'd be uneasy to use them in lazy sequences when there's a need for cryptographic randomness, but except for that, I don't really see an issue

18:03 tufflax: Sgeo: A side effect sounds like it affects something, but getting a random number (although it does affect the random number generator, but forget about that) does no affect anything.

18:04 gfredericks: tufflax: Sgeo: in particular with side effects you get nervous about accidentally doing them twice; not an issue here

18:05 xeqi: anyone know of a book being written for clojure web stuff?

18:05 gfredericks: &(split-with (fn [_] (zero? (rand-int 2))) (range 10))

18:05 lazybot: ⇒ [() (1 2 3 4 5 6 7 8 9)]

18:05 gfredericks: &(split-with (fn [_] (zero? (rand-int 2))) (range 10))

18:05 lazybot: ⇒ [(0 1) (0 1 2 3 4 5 6 7 8 9)]

18:06 azkane: is it common that functions get evaluated twice in a lazy seq?

18:06 gfredericks: sort of an issue there I guess :)

18:06 azkane: I don't know of any examples besides split-with; atoms/refs are another context where you have to worry about something getting called twice

18:07 hyPiRion: gfredericks: Well.... (dosync (alter foo + (rand-int 10))) would be inconsistent

18:08 gfredericks: inconsistent?

18:08 Sgeo: I'd think there's more of an issue with being unable to predict when the side-effects happen, when using side-effects with lazy lists

18:08 azkane: hmm, the thing is i have a closure that saves stuff in an atom and im afraid of the closure updating the atom twice or so

18:09 cemerick: xeqi: Brian Marick was IIRC, then adjusted to the fp/oo thing

18:09 hyPiRion: ugh, not inconsistent, but (let [r (rand-int 10)] (dosync (alter foo + r))) would lead to a different result

18:09 azkane: the closure its also updated with (repeatedly) so i think thats where my bugs are coming from...

18:10 hyPiRion: (possibly)

18:11 gfredericks: hyPiRion: ah gotcha

18:11 tufflax: azkane: Well if you need updating an atom you need it somewhere, it's hard for us to say if what you are doing is bad without knowing more about the code. But what I usually do with stuff like that is have one single place where the sideeffects happen, and the other functions just return the new state, not update it

18:11 gfredericks: hyPiRion: though not distinguishably different :)

18:12 tufflax: azkane: or return deltas, and not a whole state maybe

18:12 hyPiRion: gfredericks: true

18:13 azkane: tufflax: that sounds interesting, where in the docs should i start looking?

18:14 tufflax: azkane: look for what?

18:14 azkane: the delta thing

18:15 tufflax: I just mean delta as in "the change to the state" instead of the whole state, it's not a clojure concept

18:15 hyPiRion: Then again, if I make a function which prints random data of random length to *out*, and it contains random pauses, it would also be indistinguishable from the real deal

18:16 gfredericks: what's the real deal?

18:16 hyPiRion: Sheesh, I'll go to sleep now

18:16 gfredericks: at 5pm?

18:16 hyPiRion: Not in Europe

18:16 gfredericks: what're you doing in europe? this is chicago.

18:17 hyPiRion: Well, multiple calls to the function would be indistinguishable from a single call.

18:17 That's what I meant.

18:17 gfredericks: I see

18:17 yes

18:17 sort of

18:23 yoshie902a: I need to detect and index sentence and paragraph boundaries. Any recommendations on how to identify them? I know openNLP can do sentence detection, but I never saw anything that can handle html. I need to mark the boundaries in the HTML doc. http://stackoverflow.com/questions/14111953/opennlp-html-formating

18:47 gfredericks: AimHere: yo

18:47 AimHere: Hello

18:47 gfredericks: AimHere: my brain just decided to take your idea and turn it into a giant for; if I'm lucky in 10 minutes I'll have printed out a sample of the list of all the colors by basicness :)

18:48 AimHere: All of the colours?

18:48 gfredericks: all of the colors!

18:48 AimHere: Sixteen million colours, each with a name and a measure of basicness

18:48 gfredericks: well I don't know about names

18:49 not good ones anyways

18:49 AimHere: Just as well. You probably wouldn't be able to spell fuchsia anyways, apparently nobody can

18:50 gfredericks: I think I just found need for a (sort-by sort ...)

18:51 AimHere: Well that's just a special case of a sort sort

18:52 gfredericks: sort-sort is the most correctest sorting algorithm

18:53 AimHere: Yes. If you sort sort sorting algorithms by correctestness, sort sort is the most correctestest

18:54 gfredericks: this conversation has been well worth my time

18:58 oh whoops

18:58 255 is supposed to be simple

18:58 can't just look at the number of trailing zeros :/

18:59 * gfredericks hrms

19:06 ecmendenhall: Hi, everyone. I'm new to Clojure and learning by working through SICP. I have a question about function evaluation in Clojure vs Scheme, all explained in this paste: http://pastebin.com/r9LwcNeD

19:06 If you have a minute to help me out, I'd appreciate it!

19:08 gfredericks: AimHere: http://upload.gfredericks.com/colors.html

19:09 alexbaranosky: ecmendenhall in your example`p` is never called

19:09 AimHere: Well 0 255 0 and 0 255 64 Jump out at me as being almost identical to the naked eye

19:09 alexbaranosky: if you had called it, then it would stackoverflow

19:10 Sgeo: Good idea or bad idea: Implementing Clojure as a Racket language?

19:10 AimHere: You can never have too many implementations of lisp inside lisp. It's never a bad idea

19:11 gfredericks: AimHere: that doesn't mean there's obviously a better ordering does it?

19:11 AimHere: Nooe

19:11 *nope

19:11 ecmendenhall: Okay, I think I get it. Evaluating (= 0 p) doesn't actually call p in Clojure. Does it do so in Scheme?

19:12 AimHere: But that ordering is upper bounds at about 30 colours

19:12 gfredericks: AimHere: huh?

19:12 Sgeo: ecmendenhall, what is the exact Scheme code?

19:13 AimHere: After 30 colours or so, you're getting colours you think you've seen before, if your eyes are like mine

19:13 amalloy: ecmendenhall: no, it doesn't in scheme either

19:13 Sgeo: p should not be a function call in Scheme (unless you're messing with macros, I guess)

19:13 gfredericks: AimHere: if you're curious at all: https://gist.github.com/4431141

19:14 Sgeo: I'm wondering about your define in Scheme, since you need to remember that Clojure (defn p [] (p)) is Scheme (define (p) (p))

19:14 gfredericks: AimHere: I would think that's roughly inevitable though

19:15 ecmendenhall: Here's the Scheme code, as written in SICP: http://pastebin.com/UKA5xukp

19:15 Sgeo: ecmendenhall, that shouldn't loop

19:16 Grr, perfect time for Racket to freeze on me

19:16 amalloy: really, Sgeo? i thought scheme took its arguments eagerly, like clojure

19:17 Sgeo: amalloy, yes, but if you never call p, you never cause a loop

19:17 cjfrisz: Sorry, Coming in late here: Scheme and Clojure are both call-by-value languages

19:17 gfredericks: O_O

19:17 amalloy: dangit, i thought i was reading carefully

19:17 cjfrisz: They'll evaluate their arguments before passing the values to the function call

19:17 I'm catchign up on the pastes, will try to help shortly

19:19 ecmendenhall: Sgeo, amalloy, cjfrisz: Thank you! I just tried this in the DrRacked IDE, and it returns 0. In mit-scheme, it seems to loop.

19:19 Sorry if I just derailed this into a Scheme conversation.

19:19 cjfrisz: ecmendenhall: mit-scheme must be wrong

19:19 ecmendenhall: *DrRacket

19:19 cjfrisz: ecmendenhall: I'm primarily a Schemer; it never bothers me to turn this into a Scheme conversation :-)

19:20 The piece of Scheme you posted should never loop

19:20 * Sgeo is currently interested in Racket

19:20 Sgeo: >.>

19:20 cjfrisz: That just wouldn't make any sense

19:21 * Sgeo throws a #lang r5rs at cjfrisz

19:22 ecmendenhall: Okay, I'll blame it on mit-scheme.

19:23 So just to be clear, (= 0 p) tests 0 and p for equality, and since one is a function and the other a numeric value, evaluates to 'false' in Clojure and '#f' in Scheme.

19:23 (= 0 ( p )) calls p (hence the parenthesis), and should loop in both.

19:23 amalloy: yes

19:23 ecmendenhall: Got it. Thanks, everyone.

19:23 amalloy: although ( p ) would be pretty weird, in either language. usually just (p)

19:24 cjfrisz: Sgeo: Why you throwin' that old stuff at me??

19:24 lazybot: cjfrisz: Uh, no. Why would you even ask?

19:24 * cjfrisz still needs to read the r7rs small draft

19:24 Sgeo: cjfrisz, I've heard that r6rs is generally despised

19:24 And I don't know if Racket has implemented an r7rs thing yet

19:25 cjfrisz: Sgeo: I suppose that's true

19:25 Had to think about it for a second

19:26 R6RS has a lot of really good ideas that were done a little poorly

19:26 Sgeo: I don't really know that much about it

19:26 cjfrisz: And consulting my resident Racketeer, they have not implemented any R7RS stuff yet

19:26 I'm a Chez Schemer myself, and there's no R7 stuff in there yet

19:27 ecmendenhall: amalloy: Haha, got it. my irc client changed ℗ to a copyright symbol, so I added the spaces.

19:27 cjfrisz: I think it's too far from ratification for the implementers to start adopting any of the new features

19:27 Sgeo: One of the big problems with me and Scheme is that I tend to keep vacillating between all the options

19:27 Well, not all

19:28 But I keep being undecided between Chicken Scheme and Racket, for example

19:28 cjfrisz: Chicken Scheme is pretty bad

19:28 I would stay away from it, personally

19:28 Overall, I'd say Racket is a pretty good choice

19:28 Sgeo: o.O how so?

19:28 (About Chicken Scheme being bad)

19:29 cjfrisz: It's one of the implementations that essentially fully cross-compiles to C

19:29 Many of those implementations have problems with semantics correctness, and I've encountered more goofy stuff in Chicken Scheme than others

19:30 About 8 months back, someone showed me a piece of Chicken Scheme code where let* was scoped completely incorrectly

19:30 I don't remember off the top of my head

19:30 Sgeo: Suddenly I remember an annoyance I have with Factor

19:30 (Besides the fact that stack shuffling hurts my head)

19:32 The way dynamic scoping works in Factor, when you do the equivalent to (parameterize or (binding etc., it semantically (not physically) rebinds all dynamic variables, such that within such a form, setting a dynamic variable, even one not mentioned by the form, will go out of scope with the form

19:33 (define p (make-parameter #f)) (define q (make-parameter #f)) (parameterize ((p 5)) (set! q 6))

19:34 Oh, whoops

19:34 (define p (make-parameter #f)) (define q (make-parameter #f)) (parameterize ((p 5)) (q 6))

19:34 Imagine if after that, (q) was #f

20:06 Problem with making a Clojure language for Racket: Handling keywords

20:07 When you call a function with keywords in Racket, the keywords themselves are NOT actually arguments to the function, the way they are in Clojure

20:09 ToxicFrog: ...what are they?

20:10 Sgeo: They're specially given to the function

20:10 Somehow

20:11 ivan: http://docs.racket-lang.org/guide/keywords.html

20:11 Sgeo: I don't know the details of how they work, fundamentally, but I gather that function application looks for keywords in the syntax, removes them and the following item, and passes it to the function through effectively a third channel

20:11 ..."third"?

20:11 different channel

20:11 Whatever

20:12 This also means you can mix a rest argument with keywords, and the rest list won't include keywords and the following

20:20 ticking: hm why is does cast take the class as first argument, wouldn't it be better as the second so that it works with -> ?

20:22 amalloy: simple solution: don't waste characters on cast

20:27 ticking: amalloy: hm?

20:27 amalloy: it's a function that does nothing

20:27 ticking: amalloy: you mean the most specific class will be choosen anyways?

20:28 hrm whys that?

20:28 Sgeo: ,(doc cast)

20:28 clojurebot: "([c x]); Throws a ClassCastException if x is not a c, else returns x."

20:29 ticking: hm k didn't think that it really returns x without the cast ^^

20:29 cjfrisz: Sgeo: Stepped away for a bit, but caught up on Factor

20:30 Give me a second to think on that stuff

20:31 Sgeo: Ok, plugged it in and thought about it; that's gross

21:13 Is there a Clojure function that takes an arbitrary number of arguments and returns the last one?

21:14 It's like identity; I could write it in 2 seconds, but I feel like it's already in clojure.core

21:14 Sgeo: Was about to use a lambda, but I see what you mean

21:14 $findfn [1 2 3 4 5 6 7] 7

21:15 lazybot: [clojure.core/last clojure.core/count clojure.core/peek]

21:15 Sgeo: Oh

21:15 $findfn 1 2 3 4 5 6 7 7

21:15 lazybot: [clojure.core/bit-or clojure.core/dosync clojure.core/sync clojure.core/max clojure.core/and clojure.core/locking clojure.core/io! clojure.core/when]

21:17 ivan: &(do 1 2 3 4)

21:17 lazybot: ⇒ 4

21:17 cjfrisz: Wait...that's not what I wanted anyway

21:17 I'm an idiot

21:17 I wanted to do swap! with conj as the function

22:29 Sgeo: If I were to make a Clojure language in Racket, would it make sense to also port some of the limitations of Clojure?

22:29 e.g. needing to declare to define mutually-recursive functions

22:29 bbloom: Sgeo: 1) that's an extremely loaded question

22:29 Sgeo: (No way I'd bring over lack of TCO)

22:29 bbloom: and 2) clojure separates let and letfn on purpose

22:30 theatticlight: If you want it to be compatible probably.

22:30 bbloom: let intentionally implies sequential semantics, since that's what you *usually* want

22:30 Sgeo: bbloom, I'm talking about defn

22:30 bbloom: oh, yes

22:31 i don't really think that's a big deal

22:31 theatticlight: If I write code for racket-clojure, I want it to compile for java-clojure.

22:31 bbloom: you could pretty trivially make a defns macro

22:32 Sgeo: theatticlight, no matter what else, code for racket-clojure would have to start #lang clojure or similar

22:32 #lang planet sgeo/clojure

22:32 Or something

22:32 So would it be ok to have to remove that?

22:32 bbloom: clojure's top level does have some oddities, but i don't know of any lisp that doesn't have some oddities at the top level... convenience at the REPL tends to make some odd behavior and special cases

22:33 theatticlight: Sgeo, I think so.

22:34 Even clojurescript isn't 100% identical.

22:36 callen: bbloom: I thought let implies parallel semantics and that let* was sequential?

22:36 bbloom: callen: that's scheme

22:36 callen: my brain isn't working, got it.

22:37 bbloom: let* is an implementation detail in clojure and it primarily differs only by not having destructuring

22:37 callen: sigh, too much SICP as a kid.

22:37 bbloom: thanks for clearing that up.

22:38 technomancy: bbloom: how do you mean top-level oddities? you mean how different vars and locals are?

22:38 bbloom: technomancy: h/o let me dig up where i explained

22:39 technomancy: IMO the fact that vars are so different from locals actually makes things a lot clearer; the semantics between globals and locals in CL always seemed muddier to me

22:39 bbloom: technomancy: http://clojure-log.n01se.net/date/2012-12-25.html#17:08a

22:39 technomancy: i agree. vars and locals are two very different things, i like that

22:40 my issue is that clojure files are evaluated as a sequence of forms after reading the file, like a ruby script

22:40 that's a problem because you can have side effects at the top level which are generally expected to affect the runtime environment

22:40 but if your compile time and runtime environments are distinct, like in clojurescript, that's a problem

22:41 here too: http://clojure-log.n01se.net/date/2012-12-25.html#17:01

22:41 in short (when false (def x 1)) will unconditionally define x in clojurescript

22:41 technomancy: meh; if you have top-level code that has a side effect that isn't def then your code is wrong

22:42 bbloom: technomancy: i totally agree with that too

22:42 but that's simply not the case, consider *warn-on-reflection*

22:42 that sets compiler state

22:42 technomancy: I don't know anything about cljs

22:42 xeqi: https://github.com/ato/clojars-web/blame/master/src/clojars/promote.clj#L87

22:43 bbloom: technomancy: the compiler runs in java and the runtime runs remotely, in a javascript environment.

22:43 technomancy: xeqi: that's a def! =)

22:43 bbloom: in theory (when false (def x 1)) is a sensible thing to do if that's the expansion of some macro

22:43 if release mode, define these 2 things, if debug mode define those 3 things

22:43 augustl: oh gosh, it's hard to write code that isn't lisp after you've gotten used to paredit-mode in emacs

22:44 empiricalthought: augustl: python is OK :)

22:44 bbloom: technomancy: make sense?

22:44 technomancy: xeqi: it's unfortunate that it can't be done declaratively; I think you can make a pretty good case for "aether is wrong there"

22:45 xeqi: I think thats a pomegranate artifact.. bad cemerick

22:45 cemerick: I blame aether too.

22:46 Dunno what the topic is, but that's a fine null hypothesis.

22:46 xeqi: haha, it was not a fun api to use.. I'd blame it too

22:47 technomancy: cemerick: context is whether non-def top-level side-effects are ever OK

22:48 Sgeo: Hmm, another problem with Racket-Clojure: Although defmacro is present in Racket, you still have to worry about the "phase" stuff is brought in as

22:48 cemerick: technomancy: oh, is this the wagon factory registration business?

22:48 Sgeo: Essentially, in Racket, if you want to bring in a function to call during macroexpand-time, you need to bring it in differently than bringing it in during run-time

22:49 augustl: empiricalthought: hmm I don't know much python.. JavaScript has enough quotes and brackets to make it annoying though

22:49 technomancy: cemerick: well, I was blathering about it and xeqi pointed out that my actions have not been entirely consistent with my words =)

22:49 cemerick: heh

22:50 well, I still blame aether

22:51 oh, hrm, I guess I can't blame it :-/

22:51 I guess resolve-dependencies et al. could take a :repository-system param

22:52 xeqi: adds more things to the 1.0 api redesign

22:52 cemerick: well, that's additive and backwards-compatible

22:52 I'm guessing someone else will have to do the 1.0 API :-P

22:53 otherwise, I'll have a ptsd relapse or something

22:56 xeqi: yeah... I think thers a non trivial chance that the current one is "good enough"

23:28 cemerick: is some modifications to hiccup something tha twould be of interest on the -sec list?

23:28 to automatically do escaping

23:29 cemerick: xeqi: hrm, perhaps

23:29 avoiding js injections, etc?

23:29 xeqi: yeah

23:30 cemerick: yeah, sounds topical

23:30 xeqi: I hate having to remember to use (h ..) everywhere

23:32 blah, apparently I signed up to clojure-sec and told it not to send me email :(

23:46 Deece: how do I get the directories where Leiningen installs dependencies onto my classpath?

23:48 tpope: `lein classpath`?

23:51 Deece: Ah, the problem is not with lein - it's with a project that i've checked out which has a bash script that assumes the bash classpath has everything from ~/.m2 added.

Logging service provided by n01se.net