2013-01-01
| 00:00 | mpan | is the version of slime in the repo not the right one for ritz? |
| 00:00 | Frozenlock | mpan: swank/slime is no longer supported IIRC. |
| 00:00 | Frozenlock | (for clojure) |
| 00:01 | mpan | I'm following the directions for ritz and I thought it asked me to install slime |
| 00:01 | mpan | or am I misreading? |
| 00:01 | Frozenlock | ... ritz? Like the cookies? |
| 00:02 | Frozenlock | https://github.com/pallet/ritz I see... |
| 00:03 | mpan | should I use that or something else for repl/debugging? |
| 00:03 | Frozenlock | I simply use nrepl.el on emacs |
| 00:03 | Frozenlock | Lein does the rest. |
| 00:04 | mpan | what if anything do you use for interactive debugging/stepping? |
| 00:04 | callen | mpan: http://github.com/pallet/ritz/ |
| 00:04 | Frozenlock | the repl will show you a backtrace if you get an error |
| 00:05 | mpan | callen: do you know if that works with the ver of slime the package installer fetches? |
| 00:05 | mpan | or should I specifically use the version that page links me to? |
| 00:06 | callen | mpan: use clojure-mode and nrepl. |
| 00:06 | callen | mpan: ritz is designed to interact directly with nrepl. |
| 00:07 | mpan | am I misinterpreting the install instructions here? https://github.com/pallet/ritz/tree/master/swank |
| 00:07 | mpan | is the section on slime something else? |
| 00:07 | callen | mpan: just go with it, but realize people are switching away from slime. |
| 00:08 | mpan | how should I install ritz independent of slime? |
| 00:08 | callen | mpan: what did I tell you? |
| 00:08 | callen | mpan: I said, repeatedly, keep it simple. |
| 00:08 | callen | mpan: get one thing working at a time. |
| 00:08 | mpan | sorry but I think I'm misinterpreting |
| 00:08 | callen | mpan: start with vanilla emacs, get comfortable editing Clojure code that way. |
| 00:09 | callen | maybeeee toss in Clojure mode, no more. |
| 00:09 | callen | then maybeee toss in nrep |
| 00:09 | callen | then maybeeee toss in ritz. |
| 00:09 | callen | mpan: comprende? |
| 00:09 | mpan | in the meantime, do you mean to use "lein repl" independently? |
| 00:09 | mpan | I get your point now; sorry about before |
| 00:10 | mpan | I was misinterpreting some instructions as "this is the next step in the same process" |
| 00:10 | callen | you can do whatever you want, but you're attempting to learn too many things at once. |
| 00:10 | mpan | I was fundamentally misunderstanding that these components were independently usable |
| 00:10 | mpan | my misinterpretation was that this was one set of install instructions and I was trying to complete them |
| 00:10 | mpan | sorry about that |
| 00:11 | mpan | and thank you for clarifying it |
| 00: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. |
| 00:12 | callen | 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. |
| 00:12 | callen | mpan: out of all of that, the nifty toys are the most disposable element and the least critical to you learning Clojure or Emacs. |
| 00: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 |
| 00:13 | amalloy | if i'm feeling really fancy i'll try d$ |
| 00:13 | mpan | callen: thank you for clarifying that they are separately usable |
| 00:13 | mpan | amalloy: well at least they taught you undo; that's a real plus |
| 00:13 | amalloy | oh, there was no "they" |
| 00:14 | amalloy | that was me using eclipse in real life, and vim whenever i needed to ssh somewhere; and occasionally looking for tips on the web |
| 00:14 | tomoj | "hmm, what's the least googleable name possible that's still distinctive? oh, "d$"!" |
| 00:15 | tomoj | huh, wait |
| 00:15 | tomoj | google can apparently see \$ now |
| 00:15 | tomoj | oh, it's not a name :) |
| 00: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 |
| 00:19 | tufflax | callen, mpan: hehe I wanna setup emacs with ritz and everything, because I just wanna use it as a debugger :P |
| 00:19 | tufflax | Trying atm... |
| 00:20 | mpan | yes, in the long run, a debugger would be a big help for my use case |
| 00: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? |
| 00:31 | callen | alright so we've had enough of text editors...where's this channel on Team Edward vs. Team Jacob? |
| 00:31 | tufflax | :p |
| 00:34 | mpan | it's funny because I associate twilight with someone I used to know and said person's relationships with certain others |
| 00:35 | p_l | callen: burn it with fire |
| 00:35 | callen | mpan: given that nobody in this channel likely knows your personal life, what you just said was meaningless :P |
| 00:35 | mpan | callen: given the situation, that's probably for the better :p |
| 00:36 | callen | mpan: then why mention it at all? |
| 00:36 | tufflax | I don't even get who Edward and Jacob are :p |
| 00:36 | mpan | it crossed my mind and perhaps I speak too soon when that happens |
| 00:49 | Raynes | callen: I |
| 00:49 | Raynes | callen: I am more interested in team Damon vs team Stephen. |
| 00:49 | Raynes | (I watch The Vampire Diaries) |
| 00:51 | Frozenlock | You can still save yourself: do you watch twilight? |
| 00:51 | Frozenlock | -Where vampires 'shine' in the sun, cause why not- |
| 00:53 | Raynes | I've read the series twice, once out loud to someone else. |
| 00:53 | Raynes | I've seen the former three movies, care little about the rest. |
| 00:53 | Raynes | I am not really a fan. |
| 00: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...) |
| 00:54 | Raynes | I really enjoy The Vampire Diaries. There is a lot of deus ex machina with the witches though. |
| 00:54 | Raynes | "OH NO, THERE IS NO SAVING US, WE'RE ALL DOOMED. NO, WAIT, I FOUND A SPELL!" |
| 00:55 | Raynes | At least vampires burn in the sun. Unfortunately, some have magic rings that make it ok. |
| 00:55 | Raynes | But the stories in the show tend to be intelligent at least, and have a purpose. |
| 00:55 | Frozenlock | Yeah, that's so inconvenient to have to deal with the sun stuff. :P |
| 00:55 | Raynes | But I would probably like anything with Ian Somerhalder in it, so take it at face value. |
| 00:56 | Frozenlock | I'll admit I watched the first season. |
| 00:56 | Raynes | He is my man crush. |
| 00:58 | Frozenlock | Way too much 'ken' IMO. |
| 00:58 | Raynes | Like barbie's ken? |
| 00:59 | Frozenlock | Yeah. |
| 00: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. |
| 00:59 | Raynes | But yes, ken. |
| 01:00 | Frozenlock | rrrRRRrrr |
| 01:00 | Raynes | <3 |
| 01:00 | Raynes | She looks *outstanding* in the third season. |
| 01:01 | callen | Raynes: I haven't seen the vampire diaries. |
| 01:02 | Raynes | http://www.imdb.com/media/rm3373303296/nm2127038 for anyone wondering who Candice Accola is. |
| 01:02 | callen | wow. |
| 01:04 | p_l | looks fine, despite being blonde :P |
| 01:05 | gfredericks | is this what happens in #clojure late at night? |
| 01:05 | p_l | dunno |
| 01:05 | Raynes | Yes. |
| 01:05 | p_l | it might be new year's and champagne |
| 01:05 | Raynes | This is what happens late at night when people start talking about vampire shows. |
| 01:05 | Frozenlock | gfredericks: No. Special day I guess |
| 01:06 | mpan | happy new year folks |
| 01:06 | Frozenlock | I watched Hellsing Ultimate OVA recently. Really enjoyed it. (Vampire anime) |
| 01:06 | mpan | internet new years is funny because of time zones |
| 01:07 | Raynes | Frozenlock: Blood+ is the only vampire-related anime I've ever seen. I enjoyed it. |
| 01:07 | Frozenlock | Who isn't in the new year yet? West coast? |
| 01:07 | Raynes | I am 2 minutes away. |
| 01:07 | tomoj | not quite yet central |
| 01:07 | Frozenlock | Raynes: excellent, I'll download it immediately. |
| 01:08 | gfredericks | &(filter #(and (zero? (rem 2013 %)) (.isProbablePrime (biginteger %) 100)) (range 2 2014)) |
| 01:08 | lazybot | ⇒ (3 11 61) |
| 01: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 |
| 01:09 | mpan | eastern is in, central is so nearly in |
| 01:10 | Frozenlock | Let's all talk in UTC. |
| 01:10 | gfredericks | breakfast time? |
| 01:10 | tomoj | so new years was 6 hours ago? |
| 01:10 | Frozenlock | Yes, for everyone! |
| 01:11 | Raynes | p_l: Ashley Greene is nice. |
| 01:11 | Raynes | Alice was by far the best character in Twilight. |
| 01:11 | Raynes | The only one with real personality. |
| 01:11 | p_l | heard similar on TVTropes |
| 01:12 | tomoj | well I guess I've completely stopped being interested in the fact that it's 2013 by now |
| 01:12 | tomoj | as of, hmm, 5 hours 50 minutes ago? |
| 01:12 | gfredericks | it's been a while since we had a 4-distinct-digit-year |
| 01:13 | gfredericks | 1987? |
| 01:13 | Raynes | gfredericks: 1987 |
| 01:13 | Raynes | I was dead at the time. |
| 01:13 | tomoj | wow |
| 01:13 | tomoj | I never noticed all those years |
| 01:13 | p_l | also 2013 => 0123 :D\ |
| 01:13 | gfredericks | slick |
| 01:14 | tomoj | last time was 1230? |
| 01:14 | gfredericks | 1320 |
| 01:14 | ivan | 1320 |
| 01:14 | tomoj | ah, ofc |
| 01:14 | Frozenlock | Something is very odd with #clojure this evening. |
| 01:14 | ivan | this is a job for core.logic, not our puny brains |
| 01:15 | gfredericks | who will write logicbot |
| 01:15 | Frozenlock | Can't clojurebot just require logic? |
| 01:15 | gfredericks | ,(require '[clojure.core.logic]) |
| 01:15 | clojurebot | #<RuntimeException java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate clojure/core/logic__init.class or clojure/core/logic.clj on classpath: > |
| 01:15 | p_l | and inevitably run it on memory-starved VM that will die under Clojure's memory hunger? :P |
| 01:15 | gtrak | Raynes, I think being not born is not the same as being dead |
| 01:15 | tomoj | maybe you'll live to see more of those days :/ |
| 01:16 | Raynes | gtrak: What is the difference? |
| 01:16 | ivan | 2111 is a long way away |
| 01:16 | Raynes | gtrak: If you're dead, you're not alive, if you're not born you're not alive. |
| 01:16 | gtrak | Raynes: there had not yet been a you |
| 01:17 | gtrak | to be dead |
| 01:17 | p_l | shit. I haven't slept, and I have to arrive at 0730 at work tomorrow |
| 01:17 | Frozenlock | p_l: What kind of work? Corner store? |
| 01:17 | tomoj | when, say, the sun goes, will there then be a me to be dead? |
| 01:17 | p_l | Frozenlock: IT? |
| 01:18 | Raynes | gtrak: But matter can never be created nor destroyed, therefore I already existed, just in a different state. |
| 01:18 | mpan | Raynes: philosophers are very interested in that |
| 01:18 | gtrak | nah... haven't you ever read strange loop? |
| 01:18 | tomoj | :D |
| 01:19 | gtrak | Hofstadter at least thinks there's no I without consciousness |
| 01:19 | callen | Raynes: your identity is a configuration of matter which exists in a continuous flux |
| 01:19 | callen | Raynes: that configuration had not manifested yet. You were not dead, you did not exist. |
| 01:19 | Raynes | $dict dead |
| 01:19 | lazybot | Raynes: adjective: Having lost life; no longer alive. |
| 01:19 | callen | PWNT! |
| 01:19 | tomoj | 'configuration' good word choice |
| 01:19 | Raynes | You can all go to hell. |
| 01:20 | callen | Raynes: philosophy was a very serious hobby of mine until an ex burnt it out of my soul. |
| 01:20 | callen | Raynes: I can win this game blind drunk and punched in the gut. |
| 01:20 | Raynes | You might get the latter. |
| 01:21 | callen | Raynes: I've been known to accept impromptu fight offers. |
| 01:21 | Raynes | I've been known to win. |
| 01: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. |
| 01:22 | callen | anyone notice HN is down? |
| 01:22 | Raynes | I didn't because it isn't. |
| 01:22 | Raynes | Okay, now it is. |
| 01:22 | Raynes | It wasn't literally 1 minute ago. |
| 01:23 | tomoj | Y2013 bug? |
| 01:23 | Raynes | I wouldn't doubt it. |
| 01:23 | Raynes | HN is not a feat of quality softwaresmanship. |
| 01:24 | callen | you'd be surprised how often people will defend the indefensible. |
| 01:24 | Raynes | It's written in a half-assed language. |
| 01:24 | Frozenlock | Y2013 bug at 14min past the hour? |
| 01:24 | callen | Raynes: glorified dialect of Racket. |
| 01:24 | tomoj | software man-ship |
| 01:24 | gtrak | but but Arc can write a web form handler in 4 lines! |
| 01:24 | Raynes | Abandoned dialect. |
| 01:24 | callen | Raynes: the real key to the hilariousness is the refusal to use a proper database or a normal persistence model. |
| 01:25 | callen | Raynes: the site itself persists to file paths and the links are based on continuations. |
| 01:25 | Raynes | callen: Oh, don't forget the lovely table-based layout. |
| 01:25 | callen | Raynes: that I can more readily forgive than the continuations and file path silliness. |
| 01:25 | ivan | you have to use AutoPager more pages quickly |
| 01:25 | callen | Frozenlock: that would be due to the continuations. |
| 01:26 | callen | which plugs into the caching model |
| 01:30 | gtrak | is anyone still using stackless python? |
| 01:30 | callen | gtrak: try very hard to forget that period in my life. |
| 01:30 | callen | gtrak: most people use gevent or twisted these days. |
| 01:30 | technomancy | I have to maintain a twisted codebase |
| 01:30 | callen | technomancy: I'm sorry. |
| 01:30 | gtrak | I remember glancing at it and thinking it was cool a few years ago, but I never had to actually use it. |
| 01:30 | technomancy | it's only like 100 lines and I'm working on replacing it |
| 01:30 | callen | LOL |
| 01:34 | dcb | ... so I'll bite. Whats wrong with Racket/Scheme? |
| 01:35 | technomancy | dcb: not racket, arc |
| 01:36 | dcb | Callens comment was that Arc is a glorified dialect of Racket, imlying Racket is... I'm not sure what he was implying |
| 01:36 | dcb | which was why I asked |
| 01:37 | gtrak | it sounded to me like it's not needed, since Racket is good enough at being Racket |
| 01:37 | technomancy | I think he was implying Racket is a thing which it is possible to make crappy dialects of =) |
| 01:37 | dcb | hah. fair enough |
| 01: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 |
| 01:45 | yogthos_ | amalloy: I'm surprised there's not Clojure implementation on top of racket ;) |
| 01:45 | technomancy | amalloy: harder to get legions of adoring fans that way |
| 01:46 | yogthos_ | seems like it could be an easy one to port clojurescript to :) |
| 01: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 |
| 01:50 | callen | I talked to PG about Lisp dialects not too long ago, he endorsed Clojure. |
| 01:50 | callen | I think he recognizes Arc was a personal indulgence. |
| 02:10 | gtrak | (is 3) |
| 02:18 | tomoj | it would be convenient (but unfortunately misleading) if #inst had a special case where 'now read to (Date.), like #inst now |
| 02:19 | tomoj | (java.util.Date.) is just too much for me to type I guess |
| 02:20 | gtrak | (now) might make more sense in terms of eval-time-guessing |
| 02:20 | tomoj | oh, yes, I have that but was too lazy to require it |
| 02:20 | tomoj | would love to see that in core :) |
| 02:21 | tomoj | oh, you mean #inst (now) ? |
| 02:21 | gtrak | not quite sure what that means, as I haven't used instant literals ever, I just mean having a function somewhere |
| 02:21 | tomoj | right |
| 02:25 | gtrak | but I'm a fan of huge util namespaces |
| 02:26 | Raynes | You are my sworn enemy. |
| 02:26 | gtrak | I think it's worse for libs than applications |
| 02:26 | gtrak | I get annoyed when I have to require external packages more than a couple of times |
| 02:28 | gtrak | whatever.. I see how you guys do it at flatland... aliasing the heck out of everything |
| 02:29 | tomoj | useful is one giant util namespace, yes? |
| 02:29 | tomoj | virtually |
| 02: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) |
| 02:31 | tomoj | aha |
| 02:32 | callen | amalloy: dude, there is a fuckload of undocumented functionality floating around in there. |
| 02:33 | amalloy | okay? |
| 02:33 | clojurebot | okay is pokau |
| 02:34 | callen | amalloy: would a PR to start documenting stuff be welcomed? |
| 02:34 | amalloy | certainly. i was trying to find a link to the "fork this repo" button i could snarkily link you to |
| 02:34 | amalloy | but that button appears to be mainly javascript, so you're off the hook |
| 02:35 | callen | amalloy: pardon me for trying to bring the power of clojure to people who aren't part of the inner circle. |
| 02:35 | callen | This is the sort of fucking thing I'm talking about as far as a wiki goes. |
| 02:37 | amalloy | most of the functions do in fact have docstrings, and they also mostly have tests |
| 02:38 | callen | amalloy: that's not what I mean and you know it. How is anybody supposed to find out this exists? |
| 02:38 | callen | amalloy: that's the point of a wiki, it raises awareness of code that can prevent duplicated effort. |
| 02:42 | gtrak | clojuresphere has a list of dependents and dependencies for a bunch of github projects, that might be a good starting point |
| 02: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 |
| 02:42 | callen | I'm talking about curation and discussion. |
| 02:43 | callen | amalloy: I'm mostly frustrated by the negativity towards a community wiki and the seemingly intentional and persistent misunderstanding of where the utility lies. |
| 02:47 | dyreshark | hi guys! i don't mean to butt in, but i've got a question about macros really fast. |
| 02:47 | dyreshark | i'm reading clojure in action, and i got to this bit of code: |
| 02:47 | dyreshark | http://pastebin.com/TeVrVHAS |
| 02:47 | gtrak | ~guards |
| 02:47 | clojurebot | SEIZE HIM! |
| 02:48 | dyreshark | how is it that you can call login-user with a single argument? |
| 02:48 | gtrak | `(defn ~name [{:keys ~args}] emits a defn form that expects a single argument |
| 02:48 | dyreshark | (don't seize me bro) |
| 02:49 | gtrak | &((eval '(defn a [b] (inc b))) 1) |
| 02:49 | lazybot | java.lang.SecurityException: You tripped the alarm! eval is bad! |
| 02:49 | gtrak | it works, trust me :-) |
| 02:50 | dyreshark | haha, alright. cool :p |
| 02:50 | dyreshark | thanks :D |
| 02:50 | amalloy | dyreshark: has the book covered destructuring yet? |
| 02:51 | amalloy | i guess it must or he wouldn't be writing this |
| 02:51 | dyreshark | amalloy: to an extent. i know how to do something like (let [ [a b c] some-list ] ...) |
| 02:51 | gtrak | unless it's one of those 'behold the power of this thing you don't understand yet' deals |
| 02:51 | dyreshark | or something to that effect |
| 02:51 | dyreshark | i don't quite get the {:keys ~args} bit though :/ |
| 02:52 | amalloy | &(let [m {:a 1 :b 2 :d 4}, {:keys [a b c]} m] [a b c]) |
| 02:52 | lazybot | ⇒ [1 2 nil] |
| 02:52 | cemerick | That's a *bizarre* sample |
| 02:52 | cemerick | Maybe it's more sensible in context. |
| 02:53 | gtrak | &(macroexpand '(let [m {:a 1 :b 2 :d 4}, {:keys [a b c]} m] [a b c])) |
| 02: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]) |
| 02:53 | dyreshark | OH. OH. OH. I GET IT NOW |
| 02:54 | dyreshark | thank you |
| 02:54 | gtrak | ha, really? |
| 02:54 | dyreshark | all |
| 02:54 | dyreshark | :P |
| 02:54 | dyreshark | i just had to think it through. :P |
| 02:54 | callen | it expands to let* |
| 02: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 |
| 02:55 | dyreshark | and then it occured to me that i was thinking of it wrong. thanks again XD |
| 02:55 | gtrak | ah, yea, that looks weird initially |
| 02:56 | gtrak | you'll really flip when you see keyword args destructuring |
| 02:56 | dyreshark | link? :o |
| 02:56 | dyreshark | /terms to google? :p |
| 02:56 | dyreshark | or just make me flip out live in the channel. i'm not picky |
| 02:56 | amalloy | ugh, don't link to that. keyword args is overused |
| 02:56 | gtrak | &((fn [& {:keys [a]}] a) :a 3) |
| 02:56 | lazybot | ⇒ 3 |
| 02:57 | gtrak | yea, I don't really like it, but it's fun |
| 02:57 | dyreshark | wat. |
| 02:57 | amalloy | dyreshark: advice: don't worry about it |
| 02:58 | amalloy | handy to know, and a neat feature, but not mission-critical to learning clojure |
| 02:58 | dyreshark | oh. can that just be approximated to something like debug(output = "statement", prio = Debug.ERROR) in python? |
| 02:58 | dyreshark | or your language of choice? :p |
| 02:58 | gtrak | yea.. it saves you from { } |
| 02:58 | dyreshark | oh, that's nifty |
| 02:58 | dyreshark | cool |
| 02:59 | gtrak | it breaks apply though |
| 02:59 | gtrak | complicates it, I guess |
| 02:59 | dyreshark | yeah, i can see that |
| 03:03 | gtrak | amalloy: I was against it in general until I saw this: "do you have a counter-arg |
| 03:03 | gtrak | "Unroll optional named arguments. Callers should not have to wrap optional named arguments in a map literal" in clojure-dev library coding standards |
| 03:04 | gtrak | desregard my typo |
| 03:04 | gtrak | maybe more relevant as top-level api and not beneath |
| 04:35 | arkydo | I try to get clojure running in emacs. What should I put in .emacs.d/init.el to make work? |
| 04:35 | azkane | have you downloaded nrepl yet? |
| 04:37 | arkydo | I've try to run clojure with M-x run-lisp in emacs. |
| 04:38 | azkane | you should get this: https://github.com/kingtim/nrepl.el |
| 04:47 | arkydo | azkane: I've installed nrepl.el. How do I run it in emacs? |
| 04:49 | azkane | arkydo: open a file of a lein project, then run nrepl-jack-in |
| 05:10 | arkydo | azkane: Where I find the files in the lein project? |
| 05:11 | azkane | arkydo: you need to download lein and create a new project if you havent done so |
| 05:12 | azkane | nrepl also has nrepl-interaction-mode, but its very limited |
| 05:32 | arkydo | How do I start a new repl session? |
| 05:32 | ejackson | lein repl ? |
| 05:32 | ejackson | you need to be in the directory of the clojure project |
| 05:33 | arkydo | ejackson: That's works. |
| 05:34 | ejackson | sweeet |
| 05:34 | arkydo | How do I open a repl session in emacs if possible? |
| 05:35 | ejackson | the easiest thing to do is get your paws on emacs-live |
| 05:36 | ejackson | https://github.com/overtone/emacs-live |
| 05:36 | ejackson | follow the easy install process |
| 05:36 | ejackson | then open your project.clj file |
| 05:36 | ejackson | m-x nrepl-jack-in |
| 05:36 | ejackson | and you're a rock star! |
| 05:48 | Ralt | happy new year people! |
| 05:49 | arkydo | ejackson: That's awesone, thank very much. |
| 05:51 | ejackson | arkydo: enjoy, enjoy. |
| 05:57 | tomoj | https://www.refheap.com/paste/d3fe53cb90a9e9fa3df2fe17b evil? |
| 05:58 | callen | tomoj: after Let over Lambda, nothing surprises me. |
| 05:58 | tomoj | I guess it's probably buggy still |
| 05:58 | tomoj | yeah, using str doesn't work of course |
| 05:59 | ejackson | funky |
| 06:01 | ejackson | tsk tsk... a non namespaced literal :P |
| 06:02 | tomoj | I wouldn't release it outside of core as 'fn |
| 06:02 | tomoj | that's just a demo |
| 06:03 | tomoj | I guess `#fn 1` could be (constantly 1) ? |
| 06:03 | ejackson | just teasing - as if I don't do the very same thing :) |
| 06:03 | tomoj | curious, what non-namespaced literals do you use? |
| 06:03 | tomoj | #fn % is identity? |
| 06:04 | tomoj | #fn %2 is neat then |
| 06:04 | ejackson | oh, just little tags for when i'm passing my own data structures about |
| 06:04 | ejackson | you know, #mythingie and the like |
| 06:05 | tomoj | ah |
| 06:05 | ejackson | pure laziness |
| 06:43 | svedubois | I would like to write an image with the name of the effect ("smooth") with the extension .png. |
| 06:43 | svedubois | So using (write smooth) will write to output/smooth.png. |
| 06:43 | svedubois | When (write sharpen) will write to output/sharpen.png. |
| 06:43 | svedubois | What I am doing wrong? |
| 06:43 | svedubois | (defn write [effect] |
| 06:43 | svedubois | (str data "output/" (str effect) ".png")) |
| 06:48 | Raynes | svedubois: What is the error? |
| 06:48 | Raynes | Are you passing the symbol just like that? |
| 06:48 | Raynes | (write sharpen) will not work |
| 06:48 | Raynes | You'd need to do (write 'sharpen) |
| 06:49 | svedubois | Thanks it works |
| 07:03 | svedubois | I have retested and it doesn't works |
| 07:03 | svedubois | When I try to use the symbol sharpen inside the function |
| 07:04 | svedubois | it gives and error |
| 07:04 | svedubois | 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 |
| 07:05 | svedubois | Type error but I cannot use it as a symbol in other parts of the function |
| 07:09 | svedubois | Any advice to convert a parameter of a function to a string inside the function? |
| 07:12 | AimHere | svedubois, 'str' should do the trick |
| 07:15 | svedubois | It doesn't work |
| 07:15 | svedubois | (defn write [image] |
| 07:15 | svedubois | (println (str data "output/" (str image) ".png"))) |
| 07:15 | svedubois | (write smooth) |
| 07:15 | svedubois | (str image) it doesn't result in "image" |
| 07:16 | svedubois | Using smooth it doesn't gives "output/smooth.png" |
| 07:18 | svedubois | Any advices? |
| 07:24 | terom | svedubois: why not just use string in the first place? (write "smooth") etc? |
| 07: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 |
| 07:30 | azkane | svedubois: have you tried (str (quote arg))? |
| 07:30 | AimHere | .(str (quote arg)) |
| 07:30 | AimHere | &(str (quote arg)) |
| 07:30 | lazybot | ⇒ "arg" |
| 07:32 | azkane | if youre calling str already you dont need to call it again on (quote) |
| 07: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 |
| 07:40 | svedubois | With quote it works, thanks |
| 07:56 | svedubois | Retested, not it doesn't works |
| 07:56 | svedubois | (defn show [image] |
| 07:56 | svedubois | (println (str (quote image)))) |
| 07:56 | svedubois | (show smooth) |
| 07:57 | svedubois | ;-> image |
| 07:59 | AimHere | (defmacro show [image] `(println ~(str image))) |
| 08:00 | AimHere | That probably does what you want, providing that this stuff can all be done at compile time |
| 08:01 | AimHere | If you're generating symbols at runtime to pass them into the macro, it won't work |
| 08:01 | pmaes | Perhaps I'm misunderstanding what you're trying to do, but isn't the name function suitable here? |
| 08:02 | AimHere | Wouldn't he have to quote the symbol he's passing to 'name'? |
| 08: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 | cjfrisz | 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 | gfredericks | 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 | cjfrisz | 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 | brainproxy | 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 | gfredericks | that was my issue in both cases :) |
| 13:00 | cjfrisz | Foxboron: I think I tried it one point |
| 13:00 | cjfrisz | I used Crunchbang linux for a long time, and it shipped with Terminator |
| 13:00 | cjfrisz | 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 | thorwil | (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 | q_ | friend/new in law |
| 13:35 | brainproxy | q_: may try #phsyics |
| 13:35 | brainproxy | *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 | brainproxy | try: ##physics |
| 13:44 | gfredericks | dnolen: https://gist.github.com/4429226 if that looks weird I'll file a bug |
| 13:45 | gfredericks | 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 | gfredericks | but I haven't had more than maybe 15 seconds of patience |
| 13:46 | gfredericks | 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:54 | gfredericks | why the heck is "Hyperbolic Topology" listed under "Crazy Clojure" in the clojure/west CFP? |
| 13:55 | gfredericks | 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 | dnolen | 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 | tpope | 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 | tufflax | nothing special |
| 14:10 | tufflax | 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 | tpope | when I added it to my path, +ruby started working automatically |
| 14:12 | tpope | I had to do it in the system settings or whatever. :let $PATH inside vim is too late |
| 14:13 | tpope | 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 | svedubois | binaryerodeimagefilter.setKernelType(org.itk.simple.BinaryErodeImageFilter.KernelType.Ball); |
| 14:28 | tmciver | svedubois: |
| 14:28 | tmciver | oop |
| 14:29 | tmciver | svedubois: The convention is (.methodName object args) |
| 14:29 | tmciver | Well, it's not a convention so much as it is the rule. |
| 14:29 | svedubois | Something like this? |
| 14:29 | svedubois | (-> 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 | svedubois | public final static class KernelType { |
| 14:31 | svedubois | 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 | svedubois | With / or with . |
| 14:34 | tmciver | with / |
| 14:35 | tmciver | &(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 | svedubois | to be able to use an static method like (System/currentTimeMillis)? |
| 14:41 | svedubois | Always? |
| 14:41 | svedubois | 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 | tmciver | 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 | svedubois | 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 | tmciver | svedubois: the slash (/) is used for static methods and member variables; the dot is used with instance method calls. |
| 14:46 | tmciver | 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 | svedubois | (Classname/staticMethod args*) ==> (. Classname staticMethod args*) |
| 14:48 | svedubois | Classname/staticField ==> (. Classname staticField) |
| 14:50 | tmciver | svedubois: yes, that's another way I had apparently forgotten about. |
| 14:52 | tmciver | 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 | gfredericks | dnolen: looks great! |
| 15:02 | svedubois | What does it mean the "$" in "org.itk.simple.BinaryErodeImageFilter$KernelType"? |
| 15:02 | svedubois | The others methods don't have the "$". |
| 15:02 | svedubois | 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 | Ralt | successfully wrote passing tests! |
| 15:08 | Ralt | clojure is getting prettier and prettier. |
| 15:12 | tufflax | tpope: nope, i can't copy it :p |
| 15:12 | tufflax | tpope: or, how do you mean? with the mouse? no |
| 15:13 | tufflax | or are there a vim trick to copy those? |
| 15:13 | tufflax | 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 | demmonoid1 | user=> (= [1 2 3] '(1 2 3)) |
| 15:28 | demmonoid1 | true |
| 15:28 | demmonoid1 | 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 | gfredericks | (let [v [1 2 3]] [v (map identity v)]) |
| 15:29 | gfredericks | &(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 | tpope | 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 | tpope | 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:43 | AimHere | Probably only very slightly harder than concocting a rigourous definition of 'basicness' |
| 15:44 | gfredericks | haha |
| 15:45 | gfredericks | well we have to order (range 256) by basicness first |
| 15:46 | gfredericks | 0,255,127,63,191,... |
| 15:47 | AimHere | Do you mean, by 'basicness', closeness to a primary colour? |
| 15:47 | gfredericks | maybe? |
| 15:47 | gfredericks | well no |
| 15:48 | gfredericks | 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 | gfredericks | I want the former a whole lot closer to the front of the list than the latter |
| 15:48 | gfredericks | 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 | AimHere | Don't you just want colours to be very far from each other? |
| 15:50 | AimHere | In which case, treat the colourspace as a 3-dimensional cube, and use some standard metric, like the euclidean one |
| 15:50 | AimHere | and then for a given set of colours, pick the ones most distant |
| 15:50 | AimHere | from each other |
| 15:51 | gfredericks | doing it in order of entropy seemed like the most elegant idea |
| 15:52 | gfredericks | though not an obvious algorithmic way to do that |
| 15:52 | gfredericks | 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 | gfredericks | 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 | AimHere | 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 | AimHere | 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 | AimHere | 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 | hyPiRion | 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 | svedubois | I have tried differents ways but without any result. |
| 16:10 | svedubois | Can you give me some advice? |
| 16:10 | svedubois | I would like to set the kernel filter to cross in clojure. |
| 16:10 | svedubois | The information about the class is here (it describes the C++ API of BinaryErodeImageFilter): |
| 16:10 | svedubois | http://www.itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1BinaryErodeImageFilter.html |
| 16:10 | svedubois | This is in java: |
| 16:10 | svedubois | filter.setKernelType(org.itk.simple.BinaryErodeImageFilter.KernelType.Cross); |
| 16:10 | svedubois | And this is in python: |
| 16:10 | svedubois | filter.SetKernelType ( sitk.BinaryErodeImageFilter.Cross ) |
| 16:11 | svedubois | 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 | hyPiRion | 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 | borkdude | hyPiRion will try that now |
| 16:14 | borkdude | 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 | svedubois | 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 | svedubois | public final static class KernelType { |
| 16:20 | svedubois | public final static BinaryErodeImageFilter.KernelType Cross = new BinaryErodeImageFilter.KernelType("Cross"); |
| 16:20 | technomancy | deg: what are typed nested Clojure maps? |
| 16:20 | technomancy | 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 | deg | 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 | svedubois | (.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 | deg | (if somone already answered between 2:08 and 2:11, sorry, I missed your reply) |
| 16:30 | deg | 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 | xeqi | 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 | deg | 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 | technomancy | since json encoding is often a bottleneck |
| 16:48 | technomancy | 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 | xeqi | clojuresphere, clojureatlas, github |
| 17:01 | borkdude | xeqi clojuresphere, that's what I meant - unable to find it by google…. |
| 17:04 | borkdude | 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 | dnolen | 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 | metellus | does exactly what you want |
| 17:42 | metellus | 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 | xeqi | &(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 | edlich | 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 | edlich | 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 | edlich | 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 | xeqi | 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 | 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 | hyPiRion | 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 | edlich | 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 | Sgeo | 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 | gfredericks | &(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 | gfredericks | 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 | hyPiRion | That's what I meant. |
| 18:17 | gfredericks | I see |
| 18:17 | gfredericks | yes |
| 18:17 | gfredericks | 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 | gfredericks | 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 | gfredericks | oh whoops |
| 18:58 | gfredericks | 255 is supposed to be simple |
| 18:58 | gfredericks | can't just look at the number of trailing zeros :/ |
| 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 | ecmendenhall | 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 | AimHere | *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 | Sgeo | 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 | cjfrisz | 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 | ecmendenhall | 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 | cjfrisz | The piece of Scheme you posted should never loop |
| 19:20 | Sgeo | >.> |
| 19:20 | cjfrisz | That just wouldn't make any sense |
| 19:22 | ecmendenhall | Okay, I'll blame it on mit-scheme. |
| 19:23 | ecmendenhall | 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 | ecmendenhall | (= 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 | Sgeo | cjfrisz, I've heard that r6rs is generally despised |
| 19:24 | Sgeo | And I don't know if Racket has implemented an r7rs thing yet |
| 19:25 | cjfrisz | Sgeo: I suppose that's true |
| 19:25 | cjfrisz | Had to think about it for a second |
| 19:26 | cjfrisz | 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 | cjfrisz | 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 | Sgeo | Well, not all |
| 19:28 | Sgeo | But I keep being undecided between Chicken Scheme and Racket, for example |
| 19:28 | cjfrisz | Chicken Scheme is pretty bad |
| 19:28 | cjfrisz | I would stay away from it, personally |
| 19:28 | cjfrisz | Overall, I'd say Racket is a pretty good choice |
| 19:28 | Sgeo | o.O how so? |
| 19:28 | Sgeo | (About Chicken Scheme being bad) |
| 19:29 | cjfrisz | It's one of the implementations that essentially fully cross-compiles to C |
| 19:29 | cjfrisz | Many of those implementations have problems with semantics correctness, and I've encountered more goofy stuff in Chicken Scheme than others |
| 19:30 | cjfrisz | About 8 months back, someone showed me a piece of Chicken Scheme code where let* was scoped completely incorrectly |
| 19:30 | cjfrisz | I don't remember off the top of my head |
| 19:30 | Sgeo | Suddenly I remember an annoyance I have with Factor |
| 19:30 | Sgeo | (Besides the fact that stack shuffling hurts my head) |
| 19:32 | Sgeo | 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 | Sgeo | (define p (make-parameter #f)) (define q (make-parameter #f)) (parameterize ((p 5)) (set! q 6)) |
| 19:34 | Sgeo | Oh, whoops |
| 19:34 | Sgeo | (define p (make-parameter #f)) (define q (make-parameter #f)) (parameterize ((p 5)) (q 6)) |
| 19:34 | Sgeo | Imagine if after that, (q) was #f |
| 20:06 | Sgeo | Problem with making a Clojure language for Racket: Handling keywords |
| 20:07 | Sgeo | 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 | Sgeo | 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 | Sgeo | ..."third"? |
| 20:11 | Sgeo | different channel |
| 20:11 | Sgeo | Whatever |
| 20:12 | Sgeo | 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 | ticking | 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 | cjfrisz | Give me a second to think on that stuff |
| 20:31 | cjfrisz | Sgeo: Ok, plugged it in and thought about it; that's gross |
| 21:13 | cjfrisz | Is there a Clojure function that takes an arbitrary number of arguments and returns the last one? |
| 21:14 | cjfrisz | 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 | Sgeo | $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 | Sgeo | $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 | cjfrisz | I'm an idiot |
| 21:17 | cjfrisz | 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 | Sgeo | 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 | bbloom | 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 | Sgeo | #lang planet sgeo/clojure |
| 22:32 | Sgeo | Or something |
| 22:32 | Sgeo | 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 | theatticlight | 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 | callen | 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 | bbloom | technomancy: i agree. vars and locals are two very different things, i like that |
| 22:40 | bbloom | my issue is that clojure files are evaluated as a sequence of forms after reading the file, like a ruby script |
| 22:40 | bbloom | 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 | bbloom | but if your compile time and runtime environments are distinct, like in clojurescript, that's a problem |
| 22:41 | bbloom | here too: http://clojure-log.n01se.net/date/2012-12-25.html#17:01 |
| 22:41 | bbloom | 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 | bbloom | but that's simply not the case, consider *warn-on-reflection* |
| 22:42 | bbloom | 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 | bbloom | 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 | cemerick | 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 | cemerick | well, I still blame aether |
| 22:51 | cemerick | oh, hrm, I guess I can't blame it :-/ |
| 22:51 | cemerick | 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 | cemerick | I'm guessing someone else will have to do the 1.0 API :-P |
| 22:53 | cemerick | 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 | xeqi | cemerick: is some modifications to hiccup something tha twould be of interest on the -sec list? |
| 23:28 | xeqi | to automatically do escaping |
| 23:29 | cemerick | xeqi: hrm, perhaps |
| 23:29 | cemerick | 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 | xeqi | 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. |