#clojure logs

2013-01-01

00:00mpanis the version of slime in the repo not the right one for ritz?
00:00Frozenlockmpan: swank/slime is no longer supported IIRC.
00:00Frozenlock(for clojure)
00:01mpanI'm following the directions for ritz and I thought it asked me to install slime
00:01mpanor am I misreading?
00:01Frozenlock... ritz? Like the cookies?
00:02Frozenlockhttps://github.com/pallet/ritz I see...
00:03mpanshould I use that or something else for repl/debugging?
00:03FrozenlockI simply use nrepl.el on emacs
00:03FrozenlockLein does the rest.
00:04mpanwhat if anything do you use for interactive debugging/stepping?
00:04callenmpan: http://github.com/pallet/ritz/
00:04Frozenlockthe repl will show you a backtrace if you get an error
00:05mpancallen: do you know if that works with the ver of slime the package installer fetches?
00:05mpanor should I specifically use the version that page links me to?
00:06callenmpan: use clojure-mode and nrepl.
00:06callenmpan: ritz is designed to interact directly with nrepl.
00:07mpanam I misinterpreting the install instructions here? https://github.com/pallet/ritz/tree/master/swank
00:07mpanis the section on slime something else?
00:07callenmpan: just go with it, but realize people are switching away from slime.
00:08mpanhow should I install ritz independent of slime?
00:08callenmpan: what did I tell you?
00:08callenmpan: I said, repeatedly, keep it simple.
00:08callenmpan: get one thing working at a time.
00:08mpansorry but I think I'm misinterpreting
00:08callenmpan: start with vanilla emacs, get comfortable editing Clojure code that way.
00:09callenmaybeeee toss in Clojure mode, no more.
00:09callenthen maybeee toss in nrep
00:09callenthen maybeeee toss in ritz.
00:09callenmpan: comprende?
00:09mpanin the meantime, do you mean to use "lein repl" independently?
00:09mpanI get your point now; sorry about before
00:10mpanI was misinterpreting some instructions as "this is the next step in the same process"
00:10callenyou can do whatever you want, but you're attempting to learn too many things at once.
00:10mpanI was fundamentally misunderstanding that these components were independently usable
00:10mpanmy misinterpretation was that this was one set of install instructions and I was trying to complete them
00:10mpansorry about that
00:11mpanand thank you for clarifying it
00:12callenmpan: 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.
00:12callenmpan: 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.
00:12callenmpan: out of all of that, the nifty toys are the most disposable element and the least critical to you learning Clojure or Emacs.
00:13amalloympan: 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
00:13amalloyif i'm feeling really fancy i'll try d$
00:13mpancallen: thank you for clarifying that they are separately usable
00:13mpanamalloy: well at least they taught you undo; that's a real plus
00:13amalloyoh, there was no "they"
00:14amalloythat was me using eclipse in real life, and vim whenever i needed to ssh somewhere; and occasionally looking for tips on the web
00:14tomoj"hmm, what's the least googleable name possible that's still distinctive? oh, "d$"!"
00:15tomojhuh, wait
00:15tomojgoogle can apparently see \$ now
00:15tomojoh, it's not a name :)
00:15mpanthey've been gradually improving their handling of short, punctuation-y, and otherwise strange queries in what feels like the past year or few
00:19tufflaxcallen, mpan: hehe I wanna setup emacs with ritz and everything, because I just wanna use it as a debugger :P
00:19tufflaxTrying atm...
00:20mpanyes, in the long run, a debugger would be a big help for my use case
00:30tufflaxI 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?
00:31callenalright so we've had enough of text editors...where's this channel on Team Edward vs. Team Jacob?
00:31tufflax:p
00:34mpanit's funny because I associate twilight with someone I used to know and said person's relationships with certain others
00:35p_lcallen: burn it with fire
00:35callenmpan: given that nobody in this channel likely knows your personal life, what you just said was meaningless :P
00:35mpancallen: given the situation, that's probably for the better :p
00:36callenmpan: then why mention it at all?
00:36tufflaxI don't even get who Edward and Jacob are :p
00:36mpanit crossed my mind and perhaps I speak too soon when that happens
00:49Raynescallen: I
00:49Raynescallen: I am more interested in team Damon vs team Stephen.
00:49Raynes(I watch The Vampire Diaries)
00:51FrozenlockYou can still save yourself: do you watch twilight?
00:51Frozenlock-Where vampires 'shine' in the sun, cause why not-
00:53RaynesI've read the series twice, once out loud to someone else.
00:53RaynesI've seen the former three movies, care little about the rest.
00:53RaynesI am not really a fan.
00:53p_lRaynes: 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...)
00:54RaynesI really enjoy The Vampire Diaries. There is a lot of deus ex machina with the witches though.
00:54Raynes"OH NO, THERE IS NO SAVING US, WE'RE ALL DOOMED. NO, WAIT, I FOUND A SPELL!"
00:55RaynesAt least vampires burn in the sun. Unfortunately, some have magic rings that make it ok.
00:55RaynesBut the stories in the show tend to be intelligent at least, and have a purpose.
00:55FrozenlockYeah, that's so inconvenient to have to deal with the sun stuff. :P
00:55RaynesBut I would probably like anything with Ian Somerhalder in it, so take it at face value.
00:56FrozenlockI'll admit I watched the first season.
00:56RaynesHe is my man crush.
00:58FrozenlockWay too much 'ken' IMO.
00:58RaynesLike barbie's ken?
00:59FrozenlockYeah.
00:59RaynesIt's funny because that's just him. They don't do a whole lot to make him look the way he does.
00:59RaynesBut yes, ken.
01:00FrozenlockrrrRRRrrr
01:00Raynes<3
01:00RaynesShe looks *outstanding* in the third season.
01:01callenRaynes: I haven't seen the vampire diaries.
01:02Rayneshttp://www.imdb.com/media/rm3373303296/nm2127038 for anyone wondering who Candice Accola is.
01:02callenwow.
01:04p_llooks fine, despite being blonde :P
01:05gfredericksis this what happens in #clojure late at night?
01:05p_ldunno
01:05RaynesYes.
01:05p_lit might be new year's and champagne
01:05RaynesThis is what happens late at night when people start talking about vampire shows.
01:05Frozenlockgfredericks: No. Special day I guess
01:06mpanhappy new year folks
01:06FrozenlockI watched Hellsing Ultimate OVA recently. Really enjoyed it. (Vampire anime)
01:06mpaninternet new years is funny because of time zones
01:07RaynesFrozenlock: Blood+ is the only vampire-related anime I've ever seen. I enjoyed it.
01:07FrozenlockWho isn't in the new year yet? West coast?
01:07RaynesI am 2 minutes away.
01:07tomojnot quite yet central
01:07FrozenlockRaynes: excellent, I'll download it immediately.
01:08gfredericks&(filter #(and (zero? (rem 2013 %)) (.isProbablePrime (biginteger %) 100)) (range 2 2014))
01:08lazybot⇒ (3 11 61)
01:08p_las 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
01:09mpaneastern is in, central is so nearly in
01:10FrozenlockLet's all talk in UTC.
01:10gfredericksbreakfast time?
01:10tomojso new years was 6 hours ago?
01:10FrozenlockYes, for everyone!
01:11Raynesp_l: Ashley Greene is nice.
01:11RaynesAlice was by far the best character in Twilight.
01:11RaynesThe only one with real personality.
01:11p_lheard similar on TVTropes
01:12tomojwell I guess I've completely stopped being interested in the fact that it's 2013 by now
01:12tomojas of, hmm, 5 hours 50 minutes ago?
01:12gfredericksit's been a while since we had a 4-distinct-digit-year
01:13gfredericks1987?
01:13Raynesgfredericks: 1987
01:13RaynesI was dead at the time.
01:13tomojwow
01:13tomojI never noticed all those years
01:13p_lalso 2013 => 0123 :D\
01:13gfredericksslick
01:14tomojlast time was 1230?
01:14gfredericks1320
01:14ivan1320
01:14tomojah, ofc
01:14FrozenlockSomething is very odd with #clojure this evening.
01:14ivanthis is a job for core.logic, not our puny brains
01:15gfrederickswho will write logicbot
01:15FrozenlockCan't clojurebot just require logic?
01:15gfredericks,(require '[clojure.core.logic])
01:15clojurebot#<RuntimeException java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate clojure/core/logic__init.class or clojure/core/logic.clj on classpath: >
01:15p_land inevitably run it on memory-starved VM that will die under Clojure's memory hunger? :P
01:15gtrakRaynes, I think being not born is not the same as being dead
01:15tomojmaybe you'll live to see more of those days :/
01:16Raynesgtrak: What is the difference?
01:16ivan2111 is a long way away
01:16Raynesgtrak: If you're dead, you're not alive, if you're not born you're not alive.
01:16gtrakRaynes: there had not yet been a you
01:17gtrakto be dead
01:17p_lshit. I haven't slept, and I have to arrive at 0730 at work tomorrow
01:17Frozenlockp_l: What kind of work? Corner store?
01:17tomojwhen, say, the sun goes, will there then be a me to be dead?
01:17p_lFrozenlock: IT?
01:18Raynesgtrak: But matter can never be created nor destroyed, therefore I already existed, just in a different state.
01:18mpanRaynes: philosophers are very interested in that
01:18gtraknah... haven't you ever read strange loop?
01:18tomoj:D
01:19gtrakHofstadter at least thinks there's no I without consciousness
01:19callenRaynes: your identity is a configuration of matter which exists in a continuous flux
01:19callenRaynes: that configuration had not manifested yet. You were not dead, you did not exist.
01:19Raynes$dict dead
01:19lazybotRaynes: adjective: Having lost life; no longer alive.
01:19callenPWNT!
01:19tomoj'configuration' good word choice
01:19RaynesYou can all go to hell.
01:20callenRaynes: philosophy was a very serious hobby of mine until an ex burnt it out of my soul.
01:20callenRaynes: I can win this game blind drunk and punched in the gut.
01:20RaynesYou might get the latter.
01:21callenRaynes: I've been known to accept impromptu fight offers.
01:21RaynesI've been known to win.
01:21callenI 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.
01:22callenanyone notice HN is down?
01:22RaynesI didn't because it isn't.
01:22RaynesOkay, now it is.
01:22RaynesIt wasn't literally 1 minute ago.
01:23tomojY2013 bug?
01:23RaynesI wouldn't doubt it.
01:23RaynesHN is not a feat of quality softwaresmanship.
01:24callenyou'd be surprised how often people will defend the indefensible.
01:24RaynesIt's written in a half-assed language.
01:24FrozenlockY2013 bug at 14min past the hour?
01:24callenRaynes: glorified dialect of Racket.
01:24tomojsoftware man-ship
01:24gtrakbut but Arc can write a web form handler in 4 lines!
01:24RaynesAbandoned dialect.
01:24callenRaynes: the real key to the hilariousness is the refusal to use a proper database or a normal persistence model.
01:25callenRaynes: the site itself persists to file paths and the links are based on continuations.
01:25Raynescallen: Oh, don't forget the lovely table-based layout.
01:25callenRaynes: that I can more readily forgive than the continuations and file path silliness.
01:25ivanyou have to use AutoPager more pages quickly
01:25callenFrozenlock: that would be due to the continuations.
01:26callenwhich plugs into the caching model
01:30gtrakis anyone still using stackless python?
01:30callengtrak: try very hard to forget that period in my life.
01:30callengtrak: most people use gevent or twisted these days.
01:30technomancyI have to maintain a twisted codebase
01:30callentechnomancy: I'm sorry.
01:30gtrakI remember glancing at it and thinking it was cool a few years ago, but I never had to actually use it.
01:30technomancyit's only like 100 lines and I'm working on replacing it
01:30callenLOL
01:34dcb ... so I'll bite. Whats wrong with Racket/Scheme?
01:35technomancydcb: not racket, arc
01:36dcbCallens comment was that Arc is a glorified dialect of Racket, imlying Racket is... I'm not sure what he was implying
01:36dcbwhich was why I asked
01:37gtrakit sounded to me like it's not needed, since Racket is good enough at being Racket
01:37technomancyI think he was implying Racket is a thing which it is possible to make crappy dialects of =)
01:37dcbhah. fair enough
01:45amalloythe 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
01:45yogthos_amalloy: I'm surprised there's not Clojure implementation on top of racket ;)
01:45technomancyamalloy: harder to get legions of adoring fans that way
01:46yogthos_seems like it could be an easy one to port clojurescript to :)
01:46amalloyyou 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
01:50callenI talked to PG about Lisp dialects not too long ago, he endorsed Clojure.
01:50callenI think he recognizes Arc was a personal indulgence.
02:10gtrak(is 3)
02:18tomojit would be convenient (but unfortunately misleading) if #inst had a special case where 'now read to (Date.), like #inst now
02:19tomoj(java.util.Date.) is just too much for me to type I guess
02:20gtrak(now) might make more sense in terms of eval-time-guessing
02:20tomojoh, yes, I have that but was too lazy to require it
02:20tomojwould love to see that in core :)
02:21tomojoh, you mean #inst (now) ?
02:21gtraknot quite sure what that means, as I haven't used instant literals ever, I just mean having a function somewhere
02:21tomojright
02:25gtrakbut I'm a fan of huge util namespaces
02:26RaynesYou are my sworn enemy.
02:26gtrakI think it's worse for libs than applications
02:26gtrakI get annoyed when I have to require external packages more than a couple of times
02:28gtrakwhatever.. I see how you guys do it at flatland... aliasing the heck out of everything
02:29tomojuseful is one giant util namespace, yes?
02:29tomojvirtually
02:31amalloyyes. 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)
02:31tomojaha
02:32callenamalloy: dude, there is a fuckload of undocumented functionality floating around in there.
02:33amalloyokay?
02:33clojurebotokay is pokau
02:34callenamalloy: would a PR to start documenting stuff be welcomed?
02:34amalloycertainly. i was trying to find a link to the "fork this repo" button i could snarkily link you to
02:34amalloybut that button appears to be mainly javascript, so you're off the hook
02:35callenamalloy: pardon me for trying to bring the power of clojure to people who aren't part of the inner circle.
02:35callenThis is the sort of fucking thing I'm talking about as far as a wiki goes.
02:37amalloymost of the functions do in fact have docstrings, and they also mostly have tests
02:38callenamalloy: that's not what I mean and you know it. How is anybody supposed to find out this exists?
02:38callenamalloy: that's the point of a wiki, it raises awareness of code that can prevent duplicated effort.
02:42gtrakclojuresphere has a list of dependents and dependencies for a bunch of github projects, that might be a good starting point
02:42amalloywell, 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
02:42callenI'm talking about curation and discussion.
02:43callenamalloy: I'm mostly frustrated by the negativity towards a community wiki and the seemingly intentional and persistent misunderstanding of where the utility lies.
02:47dyresharkhi guys! i don't mean to butt in, but i've got a question about macros really fast.
02:47dyresharki'm reading clojure in action, and i got to this bit of code:
02:47dyresharkhttp://pastebin.com/TeVrVHAS
02:47gtrak~guards
02:47clojurebotSEIZE HIM!
02:48dyresharkhow is it that you can call login-user with a single argument?
02:48gtrak`(defn ~name [{:keys ~args}] emits a defn form that expects a single argument
02:48dyreshark(don't seize me bro)
02:49gtrak&((eval '(defn a [b] (inc b))) 1)
02:49lazybotjava.lang.SecurityException: You tripped the alarm! eval is bad!
02:49gtrakit works, trust me :-)
02:50dyresharkhaha, alright. cool :p
02:50dyresharkthanks :D
02:50amalloydyreshark: has the book covered destructuring yet?
02:51amalloyi guess it must or he wouldn't be writing this
02:51dyresharkamalloy: to an extent. i know how to do something like (let [ [a b c] some-list ] ...)
02:51gtrakunless it's one of those 'behold the power of this thing you don't understand yet' deals
02:51dyresharkor something to that effect
02:51dyresharki don't quite get the {:keys ~args} bit though :/
02:52amalloy&(let [m {:a 1 :b 2 :d 4}, {:keys [a b c]} m] [a b c])
02:52lazybot⇒ [1 2 nil]
02:52cemerickThat's a *bizarre* sample
02:52cemerickMaybe it's more sensible in context.
02:53gtrak&(macroexpand '(let [m {:a 1 :b 2 :d 4}, {:keys [a b c]} m] [a b c]))
02:53lazybot⇒ (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])
02:53dyresharkOH. OH. OH. I GET IT NOW
02:54dyresharkthank you
02:54gtrakha, really?
02:54dyresharkall
02:54dyreshark:P
02:54dyresharki just had to think it through. :P
02:54callenit expands to let*
02:55dyresharki 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
02:55dyresharkand then it occured to me that i was thinking of it wrong. thanks again XD
02:55gtrakah, yea, that looks weird initially
02:56gtrakyou'll really flip when you see keyword args destructuring
02:56dyresharklink? :o
02:56dyreshark/terms to google? :p
02:56dyresharkor just make me flip out live in the channel. i'm not picky
02:56amalloyugh, don't link to that. keyword args is overused
02:56gtrak&((fn [& {:keys [a]}] a) :a 3)
02:56lazybot⇒ 3
02:57gtrakyea, I don't really like it, but it's fun
02:57dyresharkwat.
02:57amalloydyreshark: advice: don't worry about it
02:58amalloyhandy to know, and a neat feature, but not mission-critical to learning clojure
02:58dyresharkoh. can that just be approximated to something like debug(output = "statement", prio = Debug.ERROR) in python?
02:58dyresharkor your language of choice? :p
02:58gtrakyea.. it saves you from { }
02:58dyresharkoh, that's nifty
02:58dyresharkcool
02:59gtrakit breaks apply though
02:59gtrakcomplicates it, I guess
02:59dyresharkyeah, i can see that
03:03gtrakamalloy: I was against it in general until I saw this: "do you have a counter-arg
03:03gtrak"Unroll optional named arguments. Callers should not have to wrap optional named arguments in a map literal" in clojure-dev library coding standards
03:04gtrakdesregard my typo
03:04gtrakmaybe more relevant as top-level api and not beneath
04:35arkydoI try to get clojure running in emacs. What should I put in .emacs.d/init.el to make work?
04:35azkanehave you downloaded nrepl yet?
04:37arkydoI've try to run clojure with M-x run-lisp in emacs.
04:38azkaneyou should get this: https://github.com/kingtim/nrepl.el
04:47arkydoazkane: I've installed nrepl.el. How do I run it in emacs?
04:49azkanearkydo: open a file of a lein project, then run nrepl-jack-in
05:10arkydoazkane: Where I find the files in the lein project?
05:11azkanearkydo: you need to download lein and create a new project if you havent done so
05:12azkanenrepl also has nrepl-interaction-mode, but its very limited
05:32arkydoHow do I start a new repl session?
05:32ejacksonlein repl ?
05:32ejacksonyou need to be in the directory of the clojure project
05:33arkydoejackson: That's works.
05:34ejacksonsweeet
05:34arkydoHow do I open a repl session in emacs if possible?
05:35ejacksonthe easiest thing to do is get your paws on emacs-live
05:36ejacksonhttps://github.com/overtone/emacs-live
05:36ejacksonfollow the easy install process
05:36ejacksonthen open your project.clj file
05:36ejacksonm-x nrepl-jack-in
05:36ejacksonand you're a rock star!
05:48Ralthappy new year people!
05:49arkydoejackson: That's awesone, thank very much.
05:51ejacksonarkydo: enjoy, enjoy.
05:57tomojhttps://www.refheap.com/paste/d3fe53cb90a9e9fa3df2fe17b evil?
05:58callentomoj: after Let over Lambda, nothing surprises me.
05:58tomojI guess it's probably buggy still
05:58tomojyeah, using str doesn't work of course
05:59ejacksonfunky
06:01ejacksontsk tsk... a non namespaced literal :P
06:02tomojI wouldn't release it outside of core as 'fn
06:02tomojthat's just a demo
06:03tomojI guess `#fn 1` could be (constantly 1) ?
06:03ejacksonjust teasing - as if I don't do the very same thing :)
06:03tomojcurious, what non-namespaced literals do you use?
06:03tomoj#fn % is identity?
06:04tomoj#fn %2 is neat then
06:04ejacksonoh, just little tags for when i'm passing my own data structures about
06:04ejacksonyou know, #mythingie and the like
06:05tomojah
06:05ejacksonpure laziness
06:43sveduboisI would like to write an image with the name of the effect ("smooth") with the extension .png.
06:43sveduboisSo using (write smooth) will write to output/smooth.png.
06:43sveduboisWhen (write sharpen) will write to output/sharpen.png.
06:43sveduboisWhat I am doing wrong?
06:43svedubois(defn write [effect]
06:43svedubois(str data "output/" (str effect) ".png"))
06:48Raynessvedubois: What is the error?
06:48RaynesAre you passing the symbol just like that?
06:48Raynes(write sharpen) will not work
06:48RaynesYou'd need to do (write 'sharpen)
06:49sveduboisThanks it works
07:03sveduboisI have retested and it doesn't works
07:03sveduboisWhen I try to use the symbol sharpen inside the function
07:04sveduboisit gives and error
07:04sveduboisI 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
07:05sveduboisType error but I cannot use it as a symbol in other parts of the function
07:09sveduboisAny advice to convert a parameter of a function to a string inside the function?
07:12AimHeresvedubois, 'str' should do the trick
07:15sveduboisIt doesn't work
07:15svedubois(defn write [image]
07:15svedubois (println (str data "output/" (str image) ".png")))
07:15svedubois(write smooth)
07:15svedubois(str image) it doesn't result in "image"
07:16sveduboisUsing smooth it doesn't gives "output/smooth.png"
07:18sveduboisAny advices?
07:24teromsvedubois: why not just use string in the first place? (write "smooth") etc?
07:27sveduboisbecause smooth it is not a string is and image smoothed, and in the function I write the image smoothed with the name smooth
07:30azkanesvedubois: have you tried (str (quote arg))?
07:30AimHere.(str (quote arg))
07:30AimHere&(str (quote arg))
07:30lazybot⇒ "arg"
07:32azkaneif youre calling str already you dont need to call it again on (quote)
07:32AimHereIf 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
07:40sveduboisWith quote it works, thanks
07:56sveduboisRetested, not it doesn't works
07:56svedubois(defn show [image]
07:56svedubois (println (str (quote image))))
07:56svedubois(show smooth)
07:57svedubois;-> image
07:59AimHere(defmacro show [image] `(println ~(str image)))
08:00AimHereThat probably does what you want, providing that this stuff can all be done at compile time
08:01AimHereIf you're generating symbols at runtime to pass them into the macro, it won't work
08:01pmaesPerhaps I'm misunderstanding what you're trying to do, but isn't the name function suitable here?
08:02AimHereWouldn't he have to quote the symbol he's passing to 'name'?
08:04pmaesOh, yeah, you're right
10:20borkdudehappy 2013 everybody
12:18cjfriszFirst unintentional New Year's resoluation fulfilled: stop being too lazy to use screen+irssi to get vertical screen split for IRC
12:18cjfriszSomething went wrong with the word "resolution" there...and it almost happened the second time, too
12:24Natchif you like screen you might love tmux. I recommend checking it out
12:36gfrederickshow can I figure out why my /checkouts aren't being picked up?
12:41gfredericksman even `lein install` doesn't work. Will have to push to clojars just to try this out :/
12:48cjfriszI know it's heavier-weight, but I'm a Terminator guy myself
12:48cjfriszBut it just feels right to know screen splitting in screen
12:53Foxboroncjfrisz, checked out tmux?
12:56brainproxygfredericks: have symlink/s in the checkouts dir? double-check to make sure link is pointing to the right place?
12:56brainproxyI've made that mistake a couple of times...
12:58dcbAnyone 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:59gfredericksbrainproxy: I think my issue was accidentally having the wrong groupname in the projecteclj
12:59gfredericksthat was my issue in both cases :)
13:00cjfriszFoxboron: I think I tried it one point
13:00cjfriszI used Crunchbang linux for a long time, and it shipped with Terminator
13:00cjfriszI came to really like it, so that's my default terminal emulator
13:00Foxboroncjfrisz, tmux is suppose to be a improved screen. But i cant apt-get on my vps so never been able to try it.
13:15thorwilhow can i create a java.sql.timestamp (for testing purposes, actual time doesn't matter)?
13:17thorwil(java.sql.Timestamp. (.getTime (java.util.Date.)))
13:18brainproxyFoxboron: older version of debian/ubuntu? tmux is probably available through backports
13:19tmciverthorwil: or (java.sql.Timestamp. (System/currentTimeMillis))
13:19Foxboronbrainproxy, i think the vps is partly fucked :P But i only use it for screen+irssi anyway ^^
13:19thorwiltmciver: nicer, ty
13:21brainproxyFoxboron: gotcha ... I used to use irssi w/ screen, decent combo, but I switched to weechat w/ tmux, luv it
13:22Foxboronbrainproxy, weechat...sounds like a fun chat.
13:23brainproxyFoxboron: similar to irrsi, but I've enjoyed weechat more
13:24Foxboronbrainproxy, yeah looking at it now.
13:33q_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:33q_friend/new in law
13:35brainproxyq_: may try #phsyics
13:35brainproxy*maybe
13:37q_no one in there :(
13:39brainproxyq_: check spelling, i see 268 nicks in there :)
13:40gfredericksdnolen: ping
13:41dnolengfredericks: pong
13:41gfredericksdnolen: got a gist with weird FD behavior, one sec
13:43brainproxyq_: 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:43brainproxytry: ##physics
13:44gfredericksdnolen: https://gist.github.com/4429226 if that looks weird I'll file a bug
13:45gfredericksdnolen: this came up when trying out 0.8.0-beta4 on the code with which I discovered LOGIC-77
13:45dnolengfredericks: so it does terminate? it just takes a lot longer?
13:45gfredericksdnolen: I haven't seen it terminate
13:46gfredericksbut I haven't had more than maybe 15 seconds of patience
13:46gfredericksusually 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:47dnolengfredericks: do you see the same problem if you use (interval 0 4) ?
13:48gfredericksdnolen: yeah; (interval 0 3) returns fast; (interval 0 4) is at ~15 seconds now and still going
13:54gfrederickswhy the heck is "Hyperbolic Topology" listed under "Crazy Clojure" in the clojure/west CFP?
13:55gfredericksit'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:59dnolengfredericks: yeah checked it out, looks like a bug, feel free to add a ticket.
14:01gfredericksdnolen: will do; is a patch with this code as a test at all helpful?
14:01FrozenlockStill no video of the clojure conj?
14:02dnolengfredericks: 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:03dnolengfredericks: mark it as blocking ticket, I'm rounding up the tickets I want to wrap up 0.8.0
14:04gfredericksdnolen: okay cool; just got the example down to half the size
14:04dnolengfredericks: great, thanks
14:09tufflaxtpope: there?
14:09tpopeyep
14:09tufflaxhi, i'm the windows guy, as you may remember
14:10tpopeyes
14:10tpopeI solved one of your problems, and failed to reproduce the other
14:10tufflaxI installed ruby with a windows installer from the ruby homepage I think
14:10tufflaxnothing special
14:10tufflaxbut, do i need +ruby on vim?
14:11tpopeyou either need +ruby or ruby in your path
14:11tufflaxi have ruby in my path
14:11tpopeyou'll probably want the former as executing external processes is painful on windows
14:11tpopewhen I added it to my path, +ruby started working automatically
14:12tpopeI had to do it in the system settings or whatever. :let $PATH inside vim is too late
14:13tpopethat's how I installed ruby too, btw
14:14tufflaxok, hm, let me see... I'll get back to you
14:27sveduboisHow I can convert this java line to clojure ?
14:27sveduboisbinaryerodeimagefilter.setKernelType(org.itk.simple.BinaryErodeImageFilter.KernelType.Ball);
14:28tmciversvedubois:
14:28tmciveroop
14:29tmciversvedubois: The convention is (.methodName object args)
14:29tmciverWell, it's not a convention so much as it is the rule.
14:29sveduboisSomething like this?
14:29svedubois(-> binaryerodeimagefilter (.setKernelType (org.itk.simple.BinaryErodeImageFilter.KernelType/Ball))
14:30tmciverSo: (.setKernelType binaryerodeimagefilter org.itk.simple.BinaryErodeImageFilter.KernelType.Ball) I think.
14:31sveduboisAnd in the class:
14:31svedubois public final static class KernelType {
14:31svedubois public final static BinaryErodeImageFilter.KernelType Ball = new BinaryErodeImageFilter.KernelType("Ball");
14:32tmciversvedubois: Yes, I believe what you wrote should work too.
14:34sveduboisMy main problem is how to use static methods.
14:34sveduboisWith / or with .
14:34tmciverwith /
14:35tmciver&(System/currentTimeMillis)
14:35lazybot⇒ 1357068346562
14:38sveduboisSomething like this (more longer) it will be correct? "foo.bar.more.System/currentTimeMillis"
14:39tmciversvedubois: yes. You need to fully qualify the class if you did not :import it in the ns declaration.
14:40sveduboisSo I need to write (import '(foo.bar.more System))
14:40sveduboisto be able to use an static method like (System/currentTimeMillis)?
14:41sveduboisAlways?
14:41sveduboisIt is not possible to use the long "foo.bar.more.System/currentTimeMillis"?
14:43tmciversvedubois: It is possible to use the longer fully qualified form.
14:44tmciversvedubois: but if you don't want to type it out all the time, it's better to import it.
14:44sveduboisAnd there are any other way with dots "." ?
14:45sveduboisWithout the "/"?
14:45tmciversvedubois: 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:45tmciversvedubois: the slash (/) is used for static methods and member variables; the dot is used with instance method calls.
14:46tmciversvedubois: see http://clojure.org/java_interop
14:46gfredericks&(.getMethods Integer)
14:46lazybot⇒ #<Method[] [Ljava.lang.reflect.Method;@932fb0>
14:48tmcivergfredericks: static method?
14:48sveduboisIn http://clojure.org/java_interop
14:48svedubois(Classname/staticMethod args*) ==> (. Classname staticMethod args*)
14:48sveduboisClassname/staticField ==> (. Classname staticField)
14:50tmciversvedubois: yes, that's another way I had apparently forgotten about.
14:52tmcivergfredericks: ah, that's a method call on the non-static Integer class?
14:53ToxicFrogtmciver: IIRC, under the hood it all macroexpands to calls to (.)
14:55tmciverToxicFrog: yup: ##(macroexpand-1 '(.getMethods Integer))
14:55lazybot⇒ (. (clojure.core/identity Integer) getMethods)
14:55dnolengfredericks: thanks for the report, fixed in master
14:56ToxicFrog,(doc macroexpand-1)
14:56clojurebot"([form]); If form represents a macro form, returns its expansion, else returns form."
14:56ToxicFrog,(doc macroexpand)
14:56clojurebot"([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:56ToxicFrogAhaa.
14:58gfredericksdnolen: trying out the new commit now
15:00gfredericksdnolen: looks great!
15:02sveduboisWhat does it mean the "$" in "org.itk.simple.BinaryErodeImageFilter$KernelType"?
15:02sveduboisThe others methods don't have the "$".
15:02sveduboisI obtain this when I use reflection
15:02dnolengfredericks: excellent
15:03tmciversvedubois: it's the way clojure identifies an inner class; KernelType is an inner class here.
15:03dnolencore 0.8.0-beta5 going out
15:03gfredericksw00h
15:06tufflaxtpope: how can I display the output of foreplay so I can copy it
15:07tpopetufflax: if it's enough for a press enter prompt, it should just be copyable?
15:08Raltyay
15:08Raltsuccessfully wrote passing tests!
15:08Raltclojure is getting prettier and prettier.
15:12tufflaxtpope: nope, i can't copy it :p
15:12tufflaxtpope: or, how do you mean? with the mouse? no
15:13tufflaxor are there a vim trick to copy those?
15:13tufflaxis* :P
15:17tpopetufflax: with the mouse, yes. but it may be different on windows
15:18tufflaxtpope: oh, C-y can copy
15:28demmonoid1Guys, I can't get the point of the following:
15:28demmonoid1user=> (= [1 2 3] '(1 2 3))
15:28demmonoid1true
15:28demmonoid1So 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:29gfredericks= would be a lot less useful if it were sensitive to that sort of thing
15:29demmonoid1Exactly
15:29gfredericksin particular because of how things like vectors easily get turned into arbitrary seqs
15:29gfredericks(let [v [1 2 3]] [v (map identity v)])
15:29gfredericks&(let [v [1 2 3]] [v (map identity v)])
15:29lazybot⇒ [[1 2 3] (1 2 3)]
15:30demmonoid1Ah, less
15:30gfredericks&(doc =)
15:30lazybot⇒ "([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:30tufflaxtpope: this is what happened https://www.refheap.com/paste/8010
15:31tpopetufflax: okay, the hanging is probably the real issue
15:32tufflaxtpope: want me to try anything? :P
15:33tpopetufflax: I would guess that solving this would be less productive than just trying to get +ruby working
15:33tpopetufflax: if you :echo has('ruby'), it returns 0, correct?
15:34tufflaxtpope: yes. So, +ruby/dyn is not good?
15:34tpopetufflax: +ruby/dyn means support is compiled in, but it can't find the library
15:34tpopetufflax: :help ruby-dynamic
15:35tufflaxok, I'll try to fix that
15:36tpopetufflax: otherwise, you're going to get really sick of that dumb minimized DOS box popping up all the time
15:36tufflaxhehe
15:43AimHereProbably only very slightly harder than concocting a rigourous definition of 'basicness'
15:44gfrederickshaha
15:45gfrederickswell we have to order (range 256) by basicness first
15:46gfredericks0,255,127,63,191,...
15:47AimHereDo you mean, by 'basicness', closeness to a primary colour?
15:47gfredericksmaybe?
15:47gfrederickswell no
15:48gfredericksbecause [0,0,255] should be quite basic while [0,0,254] should not
15:48AimHereAs in #ff0000 is very very basic, and #ff3454 very much less basic
15:48gfredericksI think low entropy is a lot closer intuitively
15:48AimHereThose colours are almost identical though
15:48gfredericksquite
15:48gfredericksI want the former a whole lot closer to the front of the list than the latter
15:48gfredericksuse case is to use (take n (colors)) to get n decently different colors
15:49AimHereIn that case, does it matter whether you pick (0,0,254) or (0,0,255)?
15:49AimHereDon't you just want colours to be very far from each other?
15:50AimHereIn which case, treat the colourspace as a 3-dimensional cube, and use some standard metric, like the euclidean one
15:50AimHereand then for a given set of colours, pick the ones most distant
15:50AimHerefrom each other
15:51gfredericksdoing it in order of entropy seemed like the most elegant idea
15:52gfredericksthough not an obvious algorithmic way to do that
15:52gfredericksthe 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:53gfredericksrather than doing it ad-hoc
15:55AimHereCouldn't you just do it with the highest k bits of the 3 colour values, for the smallest k you have
15:55AimHereIf 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:58AimHereSo for the 6- case, you just have either 0xff, 0x7f, 0xbf and 0x3f for each of the r,g, and b values
15:59AimHerePick your favourite 6 of the available 12 colours
16:00degProbably 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:01borkdudeIs there something different with stdout when I execute "lein run" and "lein repl"?
16:02hyPiRionsomething different?
16:02hyPiRionIn both cases, stdout = stdout
16:05borkdudehyPiRion 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:08technomancyborkdude: yes, lein repl uses a socket connection for stdin/out so it can work remotely
16:08gfredericksAimHere: that's probably the most reasonable way to do it -- order by the number of lower-order 0's
16:09technomancyborkdude: unless you lein trampoline repl, in which case it skips nrepl
16:10borkdudetechnomancy it works fine with lein repl, but I don't see (some) output in lein run
16:10sveduboisI have an example in python and in java that I would like to convert to clojure.
16:10sveduboisI have tried differents ways but without any result.
16:10sveduboisCan you give me some advice?
16:10sveduboisI would like to set the kernel filter to cross in clojure.
16:10sveduboisThe information about the class is here (it describes the C++ API of BinaryErodeImageFilter):
16:10sveduboishttp://www.itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1BinaryErodeImageFilter.html
16:10sveduboisThis is in java:
16:10sveduboisfilter.setKernelType(org.itk.simple.BinaryErodeImageFilter.KernelType.Cross);
16:10sveduboisAnd this is in python:
16:10sveduboisfilter.SetKernelType ( sitk.BinaryErodeImageFilter.Cross )
16:11sveduboisHow I can write this line in clojure ?
16:11technomancyborkdude: very strange; lein run is much simpler so you'd expect it to have fewer weird cases
16:11borkdudetechnomancy hyPiRion https://www.refheap.com/paste/8011
16:11technomancyborkdude: lein trampoline run maybe?
16:12borkdudetechnomancy as you can see, with lein run I don't get the printlns from register-heart-beat
16:12hyPiRionborkdude: try (binding [*block-server* true] (run)) instead
16:12hyPiRioncheck if that changes anything
16:12borkdudehyPiRion -main already has that?
16:13deg(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:13hyPiRionborkdude: in the repl, I mean
16:13borkdudetechnomancy lein trampoline run doesn't change anything
16:14borkdudehyPiRion will try that now
16:14borkdudehyPiRion works the same as just (run)
16:14technomancyborkdude: in that case I suspect it's not Leiningen
16:15borkdudeweird
16:15svedubois (.setKernelType filter org.itk.simple.BinaryErodeImageFilter.KernelType.Cross)
16:15sveduboisit doesn't work.
16:18xeqisvedubois: is org.itk.simple.BinaryErodeImageFilter.KernelType.Cross an inner class?
16:20sveduboisyeqi Yes, it is an inner class
16:20svedubois public final static class KernelType {
16:20svedubois public final static BinaryErodeImageFilter.KernelType Cross = new BinaryErodeImageFilter.KernelType("Cross");
16:20technomancydeg: what are typed nested Clojure maps?
16:20technomancydeg: you mean type hints? or records?
16:21hyPiRionsvedubois: try out org.itk.simple.BinaryErodeImageFilter.KernelType/Cross
16:24degHmm. connection closed while I was typing ahead. Looks like my last few lines were lost. sigh.
16:25degby "typed nested maps" I meant that each of my objects is a simple clojure map, with :type metadata.
16:25svedubois(def erode (org.itk.simple.BinaryErodeImageFilter.))
16:25svedubois(.setKernelType erode org.itk.simple.BinaryErodeImageFilter.KernelType/Cross)
16:25degSome of the values in these maps are other maps, also typed.
16:25sveduboishyPiRion: Doesn't work
16:26degI 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:27deg(if somone already answered between 2:08 and 2:11, sorry, I missed your reply)
16:30degtechnomancy: 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:32xeqisvedubois: org.itk.simple.BinaryErodeImageFilter$KernelType/Cross
16:32xeqiinner classes need to use a $ instead of a . for the differentiation from the parent
16:34sveduboisxeqi: It works!! Thanks
16:39technomancydeg: I don't think cheshire supports metadata but I could be wrong
16:44degtechnomancy: Do you know what kind of objects it does support? (confession: I'm still pretty vague on the fancier typing in clojure)
16:45technomancydeg: no shame in that; most code doesn't need any knowledge of types. I don't know how to extend cheshire myself though.
16:46degI'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:47degAnd, for now, I guess I'll get by without dumping my annotations. They were just "nice-to-have"s.
16:48technomancyyeah personally I use multimethods any time I need polymorphism but I can understand why it's not appropriate for cheshire
16:48technomancysince json encoding is often a bottleneck
16:48technomancybut as a general rule in Clojure: if you can do it with a plain map you almost always should
16:50degYup, I'm only a few dozen hours into Clojure, but maps definitely rock.
16:51borkdudewhat is that website again with information about dependencies on clojure libraries
16:51degI'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:59xeqiborkdude: clojars?
16:59xeqiclojuresphere, clojureatlas, github
17:01borkdudexeqi clojuresphere, that's what I meant - unable to find it by google….
17:04borkdudeanyway tnx
17:05gfrederickswhat's the status on cljs sourcemaps?
17:09ibdknoxgfredericks: dnolen said there's some changes to emit that would need to happen. Probably a solid couple weeks' worth of work
17:18dnolengfredericks: what ibdknox said, waiting on 1.5.0 release to merge the work in.
17:19dnolengfredericks: 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:40edlichHi 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:41hyPiRionThat's not immutable though, better just iterate over it I suppose
17:41edlichhow?
17:41clojurebotwith style and grace
17:41metellusedlich: cycle
17:41metellusdoes exactly what you want
17:42metelluswell, it gives a lazy infinite seq of those elements cycled
17:42xeqi(for [x (take 10 (cycle ["A" "B" "C"]))] (str x "->"))
17:42xeqi&(for [x (take 10 (cycle ["A" "B" "C"]))] (str x "->"))
17:42lazybot⇒ ("A->" "B->" "C->" "A->" "B->" "C->" "A->" "B->" "C->" "A->")
17:42hyPiRionxeqi beat me to it
17:42edlichI do not want to realzie the cycle
17:42edlichI do not not if its 10, 100 , 1000 or more
17:44hyPiRionYou're not realizing the cycle though.
17:44edlichYes I do. In the example you take 10
17:44edlichBut my grandma wants N
17:45hyPiRion,(do (take 10000 (for [x (take 10000 (cycle ["A" "B" "C"]))] (do (Thread/sleep 1000) x))) (println "that was fast"))
17:45clojurebotthat was fast
17:46edlichA function that wrapps this: (getnext (cycle ["A" "B" "C"]))
17:48edlichPerhaps 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:48xeqithere is not a builtin function that acts like an Iterator.
17:48xeqiusually those require mutable data structures, and clojure avoids them
17:49edlichok.
17:49hyPiRionYou could use `atom` and update the cycle of course, if you really want to
17:50metellusis it rest or next that holds onto the head?
17:50xeqiedlich: when do you learn how much of the cycle you want?
17:50amalloymetellus: neither one?
17:50edlichnever.
17:51gfredericksamalloy: let's write one; what should it be called?
17:51metellusdid 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:51amalloylet's call it let
17:51metellusbut I must have misunderstood the reason
17:51gfredericks(fn ned [coll] (with-meta (rest coll) {:head coll}))
17:52amalloymetellus: 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:52amalloyamalloy: three cheers, amalloy, for extraneous highlighting, amalloy. amalloy
17:53hyPiRionmetellus: Just remember to `lose your head`, and you should be fine.
17:53clojurebotI don't understand.
17:53tufflaxedlich: why do you want a function like the one you described? Side effects are no good! :p
17:53gfredericksclojurebot: wait till you're older
17:53clojurebotNo entiendo
17:54edlichThis is not cycle-alike. But I understand that my wish requires a persistent index :-(
17:55hyPiRiontransient you mean
17:55hyPiRionProbably.
17:55amalloyhyPiRion: persistent, in the opposite sense of the word that we usually use in here
17:55tufflaxedlich: but why do you need a function like that?
17:55edlichIn games you need this often.
17:56tufflaxI don't believe you :p
17:56amalloyno you don't. you use it often, when writing games in a language that encourages it, but you certainly don't need it
17:56edlichTic Tac Toe might be the wrong example because you can determine the size here.
17:57edlichLets simply have 10 players who play an infinite game. How do you mark them?
17:58tufflaxWhat do you mean by mark them?
17:58edlichyou need an infinite cycle to adress them.
17:58AimHereCouldn'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:58edlichPlayer 10 make a move. Player one make a move, Player two...
17:59hyPiRionI'd recurse over them.
17:59edlichok instead of persisting the index I would pass it around. Hm.
17:59amalloy(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:59SgeoFun 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:00azkanequick question is getting a random number considered as side effect?
18:01xeqiyes
18:01gfredericksdepends who you ask :)
18:01SgeoWhen you return a random number from a function, your function is no longer referentially transparent
18:01SgeoTwo invocations of the function can return different results
18:01edlichThanks amalloy and all the others!
18:01gfredericksI remember an involved discussion about that a couple months ago
18:02tufflaxSgeo: but it is not quite the same thing as a side effect
18:02azkaneso i shouldnt use them in lazy seqs?
18:02gfredericksit seemed legit to distinguish between nondeterminism and full-blown side effects
18:02gfredericks&(take 10 (repeatedly #(rand-int 20)))
18:02lazybot⇒ (16 7 8 12 9 19 13 1 11 8)
18:03SgeoI'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:03tufflaxSgeo: 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:04gfrederickstufflax: Sgeo: in particular with side effects you get nervous about accidentally doing them twice; not an issue here
18:05xeqianyone know of a book being written for clojure web stuff?
18:05gfredericks&(split-with (fn [_] (zero? (rand-int 2))) (range 10))
18:05lazybot⇒ [() (1 2 3 4 5 6 7 8 9)]
18:05gfredericks&(split-with (fn [_] (zero? (rand-int 2))) (range 10))
18:05lazybot⇒ [(0 1) (0 1 2 3 4 5 6 7 8 9)]
18:06azkaneis it common that functions get evaluated twice in a lazy seq?
18:06gfrederickssort of an issue there I guess :)
18:06gfredericksazkane: 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:07hyPiRiongfredericks: Well.... (dosync (alter foo + (rand-int 10))) would be inconsistent
18:08gfredericksinconsistent?
18:08SgeoI'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:08azkanehmm, 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:09cemerickxeqi: Brian Marick was IIRC, then adjusted to the fp/oo thing
18:09hyPiRionugh, not inconsistent, but (let [r (rand-int 10)] (dosync (alter foo + r))) would lead to a different result
18:09azkanethe closure its also updated with (repeatedly) so i think thats where my bugs are coming from...
18:10hyPiRion(possibly)
18:11gfrederickshyPiRion: ah gotcha
18:11tufflaxazkane: 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:11gfrederickshyPiRion: though not distinguishably different :)
18:12tufflaxazkane: or return deltas, and not a whole state maybe
18:12hyPiRiongfredericks: true
18:13azkanetufflax: that sounds interesting, where in the docs should i start looking?
18:14tufflaxazkane: look for what?
18:14azkanethe delta thing
18:15tufflaxI just mean delta as in "the change to the state" instead of the whole state, it's not a clojure concept
18:15hyPiRionThen 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:16gfrederickswhat's the real deal?
18:16hyPiRionSheesh, I'll go to sleep now
18:16gfredericksat 5pm?
18:16hyPiRionNot in Europe
18:16gfrederickswhat're you doing in europe? this is chicago.
18:17hyPiRionWell, multiple calls to the function would be indistinguishable from a single call.
18:17hyPiRionThat's what I meant.
18:17gfredericksI see
18:17gfredericksyes
18:17gfrederickssort of
18:23yoshie902aI 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:47gfredericksAimHere: yo
18:47AimHereHello
18:47gfredericksAimHere: 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:48AimHereAll of the colours?
18:48gfredericksall of the colors!
18:48AimHereSixteen million colours, each with a name and a measure of basicness
18:48gfrederickswell I don't know about names
18:49gfredericksnot good ones anyways
18:49AimHereJust as well. You probably wouldn't be able to spell fuchsia anyways, apparently nobody can
18:50gfredericksI think I just found need for a (sort-by sort ...)
18:51AimHereWell that's just a special case of a sort sort
18:52gfrederickssort-sort is the most correctest sorting algorithm
18:53AimHereYes. If you sort sort sorting algorithms by correctestness, sort sort is the most correctestest
18:54gfredericksthis conversation has been well worth my time
18:58gfredericksoh whoops
18:58gfredericks255 is supposed to be simple
18:58gfrederickscan't just look at the number of trailing zeros :/
19:06ecmendenhallHi, 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:06ecmendenhallIf you have a minute to help me out, I'd appreciate it!
19:08gfredericksAimHere: http://upload.gfredericks.com/colors.html
19:09alexbaranoskyecmendenhall in your example`p` is never called
19:09AimHereWell 0 255 0 and 0 255 64 Jump out at me as being almost identical to the naked eye
19:09alexbaranoskyif you had called it, then it would stackoverflow
19:10SgeoGood idea or bad idea: Implementing Clojure as a Racket language?
19:10AimHereYou can never have too many implementations of lisp inside lisp. It's never a bad idea
19:11gfredericksAimHere: that doesn't mean there's obviously a better ordering does it?
19:11AimHereNooe
19:11AimHere*nope
19:11ecmendenhallOkay, I think I get it. Evaluating (= 0 p) doesn't actually call p in Clojure. Does it do so in Scheme?
19:12AimHereBut that ordering is upper bounds at about 30 colours
19:12gfredericksAimHere: huh?
19:12Sgeoecmendenhall, what is the exact Scheme code?
19:13AimHereAfter 30 colours or so, you're getting colours you think you've seen before, if your eyes are like mine
19:13amalloyecmendenhall: no, it doesn't in scheme either
19:13Sgeop should not be a function call in Scheme (unless you're messing with macros, I guess)
19:13gfredericksAimHere: if you're curious at all: https://gist.github.com/4431141
19:14SgeoI'm wondering about your define in Scheme, since you need to remember that Clojure (defn p [] (p)) is Scheme (define (p) (p))
19:14gfredericksAimHere: I would think that's roughly inevitable though
19:15ecmendenhallHere's the Scheme code, as written in SICP: http://pastebin.com/UKA5xukp
19:15Sgeoecmendenhall, that shouldn't loop
19:16SgeoGrr, perfect time for Racket to freeze on me
19:16amalloyreally, Sgeo? i thought scheme took its arguments eagerly, like clojure
19:17Sgeoamalloy, yes, but if you never call p, you never cause a loop
19:17cjfriszSorry, Coming in late here: Scheme and Clojure are both call-by-value languages
19:17gfredericksO_O
19:17amalloydangit, i thought i was reading carefully
19:17cjfriszThey'll evaluate their arguments before passing the values to the function call
19:17cjfriszI'm catchign up on the pastes, will try to help shortly
19:19ecmendenhallSgeo, amalloy, cjfrisz: Thank you! I just tried this in the DrRacked IDE, and it returns 0. In mit-scheme, it seems to loop.
19:19ecmendenhallSorry if I just derailed this into a Scheme conversation.
19:19cjfriszecmendenhall: mit-scheme must be wrong
19:19ecmendenhall*DrRacket
19:19cjfriszecmendenhall: I'm primarily a Schemer; it never bothers me to turn this into a Scheme conversation :-)
19:20cjfriszThe piece of Scheme you posted should never loop
19:20Sgeo>.>
19:20cjfriszThat just wouldn't make any sense
19:22ecmendenhallOkay, I'll blame it on mit-scheme.
19:23ecmendenhallSo 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:23ecmendenhall(= 0 ( p )) calls p (hence the parenthesis), and should loop in both.
19:23amalloyyes
19:23ecmendenhallGot it. Thanks, everyone.
19:23amalloyalthough ( p ) would be pretty weird, in either language. usually just (p)
19:24cjfriszSgeo: Why you throwin' that old stuff at me??
19:24lazybotcjfrisz: Uh, no. Why would you even ask?
19:24Sgeocjfrisz, I've heard that r6rs is generally despised
19:24SgeoAnd I don't know if Racket has implemented an r7rs thing yet
19:25cjfriszSgeo: I suppose that's true
19:25cjfriszHad to think about it for a second
19:26cjfriszR6RS has a lot of really good ideas that were done a little poorly
19:26SgeoI don't really know that much about it
19:26cjfriszAnd consulting my resident Racketeer, they have not implemented any R7RS stuff yet
19:26cjfriszI'm a Chez Schemer myself, and there's no R7 stuff in there yet
19:27ecmendenhallamalloy: Haha, got it. my irc client changed ℗ to a copyright symbol, so I added the spaces.
19:27cjfriszI think it's too far from ratification for the implementers to start adopting any of the new features
19:27SgeoOne of the big problems with me and Scheme is that I tend to keep vacillating between all the options
19:27SgeoWell, not all
19:28SgeoBut I keep being undecided between Chicken Scheme and Racket, for example
19:28cjfriszChicken Scheme is pretty bad
19:28cjfriszI would stay away from it, personally
19:28cjfriszOverall, I'd say Racket is a pretty good choice
19:28Sgeoo.O how so?
19:28Sgeo(About Chicken Scheme being bad)
19:29cjfriszIt's one of the implementations that essentially fully cross-compiles to C
19:29cjfriszMany of those implementations have problems with semantics correctness, and I've encountered more goofy stuff in Chicken Scheme than others
19:30cjfriszAbout 8 months back, someone showed me a piece of Chicken Scheme code where let* was scoped completely incorrectly
19:30cjfriszI don't remember off the top of my head
19:30SgeoSuddenly I remember an annoyance I have with Factor
19:30Sgeo(Besides the fact that stack shuffling hurts my head)
19:32SgeoThe 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:33Sgeo(define p (make-parameter #f)) (define q (make-parameter #f)) (parameterize ((p 5)) (set! q 6))
19:34SgeoOh, whoops
19:34Sgeo(define p (make-parameter #f)) (define q (make-parameter #f)) (parameterize ((p 5)) (q 6))
19:34SgeoImagine if after that, (q) was #f
20:06SgeoProblem with making a Clojure language for Racket: Handling keywords
20:07SgeoWhen 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:09ToxicFrog...what are they?
20:10SgeoThey're specially given to the function
20:10SgeoSomehow
20:11ivanhttp://docs.racket-lang.org/guide/keywords.html
20:11SgeoI 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:11Sgeo..."third"?
20:11Sgeodifferent channel
20:11SgeoWhatever
20:12SgeoThis also means you can mix a rest argument with keywords, and the rest list won't include keywords and the following
20:20tickinghm why is does cast take the class as first argument, wouldn't it be better as the second so that it works with -> ?
20:22amalloysimple solution: don't waste characters on cast
20:27tickingamalloy: hm?
20:27amalloyit's a function that does nothing
20:27tickingamalloy: you mean the most specific class will be choosen anyways?
20:28tickinghrm whys that?
20:28Sgeo,(doc cast)
20:28clojurebot"([c x]); Throws a ClassCastException if x is not a c, else returns x."
20:29tickinghm k didn't think that it really returns x without the cast ^^
20:29cjfriszSgeo: Stepped away for a bit, but caught up on Factor
20:30cjfriszGive me a second to think on that stuff
20:31cjfriszSgeo: Ok, plugged it in and thought about it; that's gross
21:13cjfriszIs there a Clojure function that takes an arbitrary number of arguments and returns the last one?
21:14cjfriszIt's like identity; I could write it in 2 seconds, but I feel like it's already in clojure.core
21:14SgeoWas about to use a lambda, but I see what you mean
21:14Sgeo$findfn [1 2 3 4 5 6 7] 7
21:15lazybot[clojure.core/last clojure.core/count clojure.core/peek]
21:15SgeoOh
21:15Sgeo$findfn 1 2 3 4 5 6 7 7
21:15lazybot[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:17ivan&(do 1 2 3 4)
21:17lazybot⇒ 4
21:17cjfriszWait...that's not what I wanted anyway
21:17cjfriszI'm an idiot
21:17cjfriszI wanted to do swap! with conj as the function
22:29SgeoIf I were to make a Clojure language in Racket, would it make sense to also port some of the limitations of Clojure?
22:29Sgeoe.g. needing to declare to define mutually-recursive functions
22:29bbloomSgeo: 1) that's an extremely loaded question
22:29Sgeo(No way I'd bring over lack of TCO)
22:29bbloomand 2) clojure separates let and letfn on purpose
22:30theatticlightIf you want it to be compatible probably.
22:30bbloomlet intentionally implies sequential semantics, since that's what you *usually* want
22:30Sgeobbloom, I'm talking about defn
22:30bbloomoh, yes
22:31bbloomi don't really think that's a big deal
22:31theatticlightIf I write code for racket-clojure, I want it to compile for java-clojure.
22:31bbloomyou could pretty trivially make a defns macro
22:32Sgeotheatticlight, no matter what else, code for racket-clojure would have to start #lang clojure or similar
22:32Sgeo#lang planet sgeo/clojure
22:32SgeoOr something
22:32SgeoSo would it be ok to have to remove that?
22:32bbloomclojure'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:33theatticlightSgeo, I think so.
22:34theatticlightEven clojurescript isn't 100% identical.
22:36callenbbloom: I thought let implies parallel semantics and that let* was sequential?
22:36bbloomcallen: that's scheme
22:36callenmy brain isn't working, got it.
22:37bbloomlet* is an implementation detail in clojure and it primarily differs only by not having destructuring
22:37callensigh, too much SICP as a kid.
22:37callenbbloom: thanks for clearing that up.
22:38technomancybbloom: how do you mean top-level oddities? you mean how different vars and locals are?
22:38bbloomtechnomancy: h/o let me dig up where i explained
22:39technomancyIMO 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:39bbloomtechnomancy: http://clojure-log.n01se.net/date/2012-12-25.html#17:08a
22:39bbloomtechnomancy: i agree. vars and locals are two very different things, i like that
22:40bbloommy issue is that clojure files are evaluated as a sequence of forms after reading the file, like a ruby script
22:40bbloomthat's a problem because you can have side effects at the top level which are generally expected to affect the runtime environment
22:40bbloombut if your compile time and runtime environments are distinct, like in clojurescript, that's a problem
22:41bbloomhere too: http://clojure-log.n01se.net/date/2012-12-25.html#17:01
22:41bbloomin short (when false (def x 1)) will unconditionally define x in clojurescript
22:41technomancymeh; if you have top-level code that has a side effect that isn't def then your code is wrong
22:42bbloomtechnomancy: i totally agree with that too
22:42bbloombut that's simply not the case, consider *warn-on-reflection*
22:42bbloomthat sets compiler state
22:42technomancyI don't know anything about cljs
22:42xeqihttps://github.com/ato/clojars-web/blame/master/src/clojars/promote.clj#L87
22:43bbloomtechnomancy: the compiler runs in java and the runtime runs remotely, in a javascript environment.
22:43technomancyxeqi: that's a def! =)
22:43bbloomin theory (when false (def x 1)) is a sensible thing to do if that's the expansion of some macro
22:43bbloomif release mode, define these 2 things, if debug mode define those 3 things
22:43augustloh gosh, it's hard to write code that isn't lisp after you've gotten used to paredit-mode in emacs
22:44empiricalthoughtaugustl: python is OK :)
22:44bbloomtechnomancy: make sense?
22:44technomancyxeqi: 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:45xeqiI think thats a pomegranate artifact.. bad cemerick
22:45cemerickI blame aether too.
22:46cemerickDunno what the topic is, but that's a fine null hypothesis.
22:46xeqihaha, it was not a fun api to use.. I'd blame it too
22:47technomancycemerick: context is whether non-def top-level side-effects are ever OK
22:48SgeoHmm, 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:48cemericktechnomancy: oh, is this the wagon factory registration business?
22:48SgeoEssentially, 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:49augustlempiricalthought: hmm I don't know much python.. JavaScript has enough quotes and brackets to make it annoying though
22:49technomancycemerick: well, I was blathering about it and xeqi pointed out that my actions have not been entirely consistent with my words =)
22:49cemerickheh
22:50cemerickwell, I still blame aether
22:51cemerickoh, hrm, I guess I can't blame it :-/
22:51cemerickI guess resolve-dependencies et al. could take a :repository-system param
22:52xeqiadds more things to the 1.0 api redesign
22:52cemerickwell, that's additive and backwards-compatible
22:52cemerickI'm guessing someone else will have to do the 1.0 API :-P
22:53cemerickotherwise, I'll have a ptsd relapse or something
22:56xeqiyeah... I think thers a non trivial chance that the current one is "good enough"
23:28xeqicemerick: is some modifications to hiccup something tha twould be of interest on the -sec list?
23:28xeqito automatically do escaping
23:29cemerickxeqi: hrm, perhaps
23:29cemerickavoiding js injections, etc?
23:29xeqiyeah
23:30cemerickyeah, sounds topical
23:30xeqiI hate having to remember to use (h ..) everywhere
23:32xeqiblah, apparently I signed up to clojure-sec and told it not to send me email :(
23:46Deecehow do I get the directories where Leiningen installs dependencies onto my classpath?
23:48tpope`lein classpath`?
23:51DeeceAh, 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.