2011-03-22
| 00:07 | devn | technomancy: awesome. |
| 00:07 | devn | technomancy: not sure if it's possible, but it would be nice to not have lein-search reformat the project.clj on an add |
| 00:08 | technomancy | devn: if lein-search gets merged, it will only be for searching |
| 00:08 | technomancy | I'm not to keen on automated changes to project.clj |
| 00:09 | devn | technomancy: any reason in particular? ive never been burned by it. if it's only an add that seems reasonable... |
| 00:09 | technomancy | devn: you can embed arbitrary code into defproject |
| 00:09 | technomancy | :repositories [[org.clojure ~clojure-version]] |
| 00:10 | technomancy | pretty-printing aside it's just something you have to be very careful with |
| 00:11 | devn | fair enough -- ive just been noticing some of the pain associated with finding the version, saving, deps, swank, slime-connect, test |
| 00:11 | devn | wish i could cut that down even by a step or two |
| 00:12 | scottj | If I want to keep the last n items added to a collection what collection type should I use? |
| 00:12 | devn | having something like `gem` would be nice, which granted doesn't give you the ability to automatically add per se -- i mean a gem install foo will get the gem installed i suppose |
| 00:12 | technomancy | devn: you can do user-level plugins; you could have a lein-add plugin that just assumes you aren't doing anything fancy in project.clj |
| 00:14 | devn | technomancy: yeah i think im noticing some deficiencies in my setup |
| 00:14 | devn | not so much in lein, but regardless a lein deps + swank default task might be nice |
| 00:15 | devn | scottj: vector |
| 00:17 | devn | scottj: frankly it depends |
| 00:17 | technomancy | devn: so you add dependencies pretty frequently? |
| 00:18 | technomancy | you know you can chain tasks, right? |
| 00:18 | technomancy | lein clean, deps, swank |
| 00:18 | Derander | god I wish you could add deps w/o restarting swank |
| 00:18 | technomancy | doesn't compose with durendal, but hey |
| 00:19 | devn | technomancy: i didn't know that actually, and frankly it's not so bad -- it's just the waiting for the JVM coupled with the download time, with a slice of reconnecting in emacs |
| 00:19 | scottj | you could create an alias that runs lein deps, lein swank, and emacsclient slime -connect |
| 00:20 | devn | it would be awfully nice to type lein madison-square-clabango, have it grab deps, start the swank server, and connect my emacs |
| 00:20 | devn | scottj: yeah, i guess i don't because technomancy is right -- you don't add deps like a madman for the life of an entire project |
| 00:21 | devn | so once that setup time is over i think: hm, that sort of was a pain, i should think about automating that, and then dont think the same thing until the next time |
| 00:21 | devn | it's like a fly hitting a window -- after ~3 times it learns there's a window there |
| 00:22 | devn | but that doesn't mean it won't hit another window 3 more times |
| 00:22 | scottj | your alias wouldn't be project specific |
| 00:24 | devn | *nod* -- i understand what you're suggesting and agree i should absolutely do that, but either way it strikes me as kind of a wonky usability issue for most |
| 00:24 | devn | either way, im outta here -- have a good night |
| 00:40 | dsantiago | What the hell could Virtualbox even be doing to cause a kernel panic? |
| 00:41 | LuminousMonkey | The host is panicing? |
| 00:41 | dsantiago | Scuse me, wrong window. |
| 00:41 | dsantiago | But yes. |
| 00:42 | LuminousMonkey | No worries, next time I will correctly spell panicking. |
| 00:44 | LuminousMonkey | Error in the VirtualBox kernel modules maybe? |
| 00:45 | dsantiago | Yeah, must be it. |
| 01:19 | technomancy | devn: you could write durendal-jack-in alternates that do more than just start a swank server |
| 01:19 | technomancy | anyway |
| 01:19 | technomancy | food for thought |
| 02:11 | fmw | anyone awake that is using filters in Lucene? I can't get them to work at all, for some reason. Queries with a filter simply don't return any results. I've written a small demonstration project (including dummy data to run the test) here: https://github.com/fmw/clojure-lucene-demo/blob/master/test/clojure_lucene_demo/test/core.clj#L286 |
| 02:12 | fmw | incidentally, I'm also planning on keeping this online as example code for using Lucene from Clojure once its fixed, so feel free to yell at me in case I'm not being idiomatic somewhere as I'm very new to clj still ;) |
| 04:23 | TobiasRaeder | Morning |
| 05:16 | ejackson | Good morning noble coders |
| 05:21 | cemerick | nobility is a rare thing, I'm afraid |
| 05:21 | angerman | good morning sir ejackson... |
| 05:22 | angerman | cemerick: :) |
| 05:22 | Raynes | cemerick: Morning. |
| 05:23 | cemerick | Once Mick Jagger got knighted, I think the key certification body for nobility lost its caché. :-P |
| 05:23 | cemerick | Raynes: hi :-) |
| 05:24 | ejackson | you raise a valid point. |
| 05:24 | ejackson | steve yegge's piece is pretty cool. not surprising, I guess, but cool nevertheless. |
| 05:24 | cemerick | Even the Klingon high command lost its cred with that scandal in TNG. |
| 05:24 | ejackson | p'tak ! |
| 05:25 | cemerick | I've forgotten all my Klingon lore at this point. |
| 05:25 | cemerick | *sadface* |
| 05:26 | ejackson | you have forgotten even Kahless ? He's supposed to be the Unforgettable.... tsk tsk. |
| 05:26 | cemerick | ooo, ooo, Duras! |
| 05:26 | cemerick | :-D |
| 05:27 | hircus | cemerick: remember, even Shakespeare is better in the original Klingon :) |
| 05:27 | ejackson | LOL ! |
| 05:27 | cemerick | hircus: that, I did not forget! |
| 05:27 | cemerick | This channel's nerd quotient has never been higher. My apologies. ;-) |
| 05:28 | hircus | the recent Java refugees must be confused :p |
| 05:28 | raek | tlhIngan Hol bojatlhlaH'a'? |
| 05:28 | hircus | damn, I wish Google Translate supports Klingon |
| 05:28 | raek | }}:-) |
| 05:29 | brehaut | it doesnt?! |
| 05:30 | hircus | I remember the days when Red Hat Linux's Rawhide could be installed in Pig Latin and Swedish Bork |
| 05:30 | ejackson | Federation Flunkies. |
| 05:31 | ejackson | Well, this has been a great start to the day ! Much obliged, fellow nerds :) |
| 05:32 | cemerick | Too bad it had to go with the stereotypical sci-fi direction. Maybe next time, I'll open up with some obscure Truman references for the history nerds. |
| 05:35 | ejackson | the trouble with history is that its all local. |
| 05:36 | cemerick | One of its most appealing characteristics, IMO. |
| 05:37 | hircus | cemerick: as a history nerd myself, I look forward to tomorrow, then |
| 05:37 | cemerick | But that's what separates a good historian from the rest -- they can peel the onion back enough so that just about any history is universally relatable. |
| 05:39 | ejackson | hircus: a historian looking forward to tomorrow.... ? |
| 05:40 | ejackson | s/a /an / |
| 05:40 | sexpbot | <ejackson> hircus: an historian looking forward to tomorrow.... ? |
| 05:42 | cemerick | ejackson: "There is no present or future, only the past, happening over and over again, now." – Eugene O'Neill |
| 05:44 | ejackson | cemerick: that's tremendous ! |
| 05:44 | Fossi | is it? |
| 05:45 | Fossi | i'd rather say there is no past and future, only present, but who am i to argue... :] |
| 05:45 | cemerick | I doubt O'Neill had it all figured out in any case. |
| 05:46 | ejackson | wel.... he does sound a little too irish to be trusted |
| 05:47 | ejackson | (just kidding) |
| 05:47 | cemerick | smashing, I managed to stir up a centuries-old blood feud in just a few msgs! ;-) |
| 05:47 | Raynes | I wish there was a pill one could take that could force them to get work done. |
| 05:49 | ejackson | Raynes: i know that pill. Its called quitting a perfectly good job do try do something insane :) |
| 05:49 | ejackson | cemerick: hehe, I have the feud in my own blood, both sides, annoyingly. |
| 05:50 | Raynes | ejackson: Not work in context of employment. Just stuff I need to do. |
| 05:50 | Raynes | Everything I do is insane, but I have to do it in order for it to be insane. |
| 05:50 | hircus | those who don't understand history are doomed to repeat it -- my bad paraphrasing of Santayana |
| 05:51 | ejackson | Raynes: this _is_ what I mean. the only way to be motivated is to have consequences for inaction. Arrange that if you don't do this work, horrendous things happen to you. |
| 05:52 | hircus | ejackson, Raynes: stickK.com does something like that. you can set up punishments for yourself |
| 05:52 | hircus | like donating to your least favorite cause :p |
| 05:52 | Raynes | ejackson: So, essentially, I need to rig up blowguns to air compressors around my chair with trip wires that I'll trigger if I am to move? That sounds like it could work. |
| 05:53 | Fossi | nice variation of procrastination |
| 05:53 | hircus | NPR has a recent show on it, I believe -- or one of the other podcasts I listen to. one author actually threatened himself with suicide if he did not finished a long-delayed book in 10 days |
| 05:53 | ejackson | Raynes: yes... you've seen Saw ? Selfapply that.... :P |
| 05:54 | Raynes | That's just sadistic enough to work. |
| 05:54 | Raynes | Let's patent it! |
| 05:55 | ejackson | its certainly worth a jokey self help (or is that self harm ?) book :) |
| 05:59 | angerman | ,(defn shift [n coll] (let [l (count coll)] (take l (drop (mod n l) (cycle coll))))) |
| 05:59 | clojurebot | DENIED |
| 05:59 | angerman | :/ |
| 06:00 | angerman | that is a really useful fn. |
| 06:02 | raek | hrm, (defn roll [queue] (conj (pop queue) (peek queue))) |
| 06:03 | angerman | reak, that's just one and only in one direction |
| 06:03 | angerman | shift takes n \in N |
| 06:03 | angerman | err Z |
| 06:04 | Fossi | angerman: feeling stacky? |
| 06:04 | raek | fair enough :) |
| 06:04 | angerman | Fossi: more ringy. |
| 06:07 | angerman | on a more fundamental level, at least for the datastructure (which is not a mathematical ring), one would probably used a cyclic double linked list with a "current-position" pointer... |
| 06:07 | Fossi | yeah |
| 06:07 | Fossi | haven't seen one of those in java so far |
| 06:14 | Raynes | Anybody feel like proof-reading a relatively short blog post for me? |
| 06:15 | raek | Raynes: o/ |
| 06:15 | Raynes | raek: \o, is that an offer? :D |
| 06:16 | Raynes | angerman: That's what it is. |
| 06:16 | angerman | while \o/ obviously looks like "help" |
| 06:16 | Raynes | It's a high five gesture. |
| 06:16 | Fossi | or a rounded lol |
| 06:16 | Fossi | lol looks more like help imho |
| 06:16 | Raynes | Fossi: Good observation. |
| 06:16 | angerman | Never felt that "high five" thing to have reached Germany... |
| 06:16 | angerman | Fossi: no, that looks like egyptian ancient dance stuff. |
| 06:17 | angerman | (depending on font… i guess) |
| 06:17 | Fossi | lol always makes me see a bank robbery |
| 06:17 | Fossi | and now you cannot unsee it either mwahahah |
| 06:18 | angerman | /o/ \o\ /o/ \ \ |
| 06:18 | Fossi | ups, that guy lost his head somewhere |
| 06:19 | Fossi | or he's a lot smaller with freakishly long arms |
| 06:19 | angerman | interesting. those pictograms seem to be understandable. |
| 06:20 | angerman | I will though probably never really feel like seeing eyes in ^^ |
| 06:23 | Fossi | that's only because you aren't used to them |
| 06:24 | Fossi | most people really didn't see a face in :) for a while |
| 06:24 | angerman | No. I'm used to ^^ |
| 06:24 | Fossi | now you can even do stuff like ;§ and people will get the point |
| 06:24 | angerman | Friends and family use them so often. |
| 06:24 | Fossi | i think (^^) makes it clearer |
| 06:25 | Fossi | (^_^) rather |
| 06:25 | angerman | Even though I know where they come from. I have a hard time admiring them and really seeing their correlation to eyes. |
| 06:25 | angerman | (-_-) is ok, so is (O_O) or (O_o) or without parens. |
| 06:53 | fmw | anyone interested in some Apache Lucene example code in Clojure? I just wrote some: https://github.com/fmw/clojure-lucene-demo |
| 06:54 | fmw | keep in mind that I'm quite new to Clojure, so there is probably some non-idiomatic code lurking around in there (feel free to point it out and I'll gladly fix it and learn something) |
| 08:52 | carkh | hello |
| 08:54 | TimMc | fmw: (. Version LUECENE_30) can be rewritten Version/LUCENE_30 if that's a static field reference. |
| 08:56 | TimMc | fmw: Similarily, (. IndexReader open directory) can be (IndexReader/open directory) |
| 09:04 | fmw | TimMc: cheers, I updated that |
| 09:04 | fmw | looks better indeed |
| 09:19 | gfrlog | not finding too much by googling -- anybody know if there are any tools for using clojure with Jena? |
| 09:21 | angerman | Jena? |
| 09:22 | gfrlog | is a semantic web framework |
| 09:23 | gfrlog | guess I'll have to make one then :) |
| 09:23 | angerman | I guess you have to live with interop layer |
| 09:24 | clgv | gfrlog: it is java, so you just need to know java interop ;) |
| 09:24 | gfrlog | yep. |
| 09:34 | gfrlog | ,(def person-uri "http://somewhere/JohnSmith") |
| 09:34 | angerman | Oh Noes!... |
| 09:34 | clojurebot | DENIED |
| 09:35 | gfrlog | I get a strange exception from that line at the repl |
| 09:35 | angerman | what's the exception? |
| 09:35 | gfrlog | well it cleared up after I restarted the repl -- but it was printing out the following and then the def succeeded anyhow: |
| 09:35 | gfrlog | java.lang.Exception: Unable to resolve symbol: in this context (NO_SOURCE_FILE:0) |
| 09:36 | gfrlog | must have been some rodents gnawing on the bits or something |
| 09:40 | angerman | Ok, now I officially fail at proving. |
| 09:40 | gfrlog | like math? |
| 09:40 | angerman | yes |
| 09:40 | gfrlog | what are you trying to prove? |
| 09:41 | angerman | I tried to show that the product of two matrices with only real valued eigenvalues can only have real valued eigenvalues as well. |
| 09:42 | gfrlog | I did not take well to matrices... |
| 09:42 | angerman | gfrlog: well, I should be able to prove stuff correctly, it's my major after all. |
| 09:43 | ejackson | angerman: when do complex valued eigenvalues arise ? |
| 09:45 | angerman | ejackson: well. I have 8 skew-symmetric matrices. |
| 09:46 | angerman | skew-symmetric matrices have complex eigenvalues. In 3-space they have 1 vanishing (0) and two complex complementary eigenvalues. |
| 09:46 | ejackson | funkiness |
| 09:47 | gfrlog | angerman: I thought the only thing mathematicians did was come up with new equations |
| 09:48 | angerman | gfrlog: hmm no. |
| 09:48 | gfrlog | :) |
| 09:48 | ejackson | hehe, maths is meta. the mapping between its mappings and 'reality' are the key. |
| 09:48 | angerman | ejackson: no, that's physics |
| 09:48 | gfrlog | ejackson: please map transfinite induction to reality |
| 09:48 | angerman | ejackson: math does not need reality. |
| 09:49 | ejackson | eep. I retreat. |
| 09:49 | clgv | :D |
| 09:49 | gfrlog | now I need to go read the wikipedia article on transfinite induction |
| 09:50 | gfrlog | holy crap epsilon-induction |
| 09:52 | gfrlog | you learn something new every time you try to learn something new |
| 09:53 | clgv | but only if you learn something new ;) |
| 09:53 | gfrlog | oh right |
| 09:58 | TimMc | If I want to do animated rotations, I think I'll have to learn how to use them, though. |
| 09:58 | gfrlog | TimMc: angerman has 8 skew-symmetric matrices. Maybe they could help you rotate something? |
| 09:58 | TimMc | Nah, I need like 15 of them. |
| 09:59 | gfrlog | dag |
| 09:59 | TimMc | :-P |
| 09:59 | angerman | 15 for rotation? |
| 09:59 | angerman | in what space do you want to do rotations? |
| 09:59 | angerman | _and_ do animations. |
| 09:59 | TimMc | Was kidding. |
| 10:00 | TimMc | I'm just going to use Euler angles. (rot Z, rot X, rot Y) |
| 10:06 | TimMc | angerman: Does matrix stuff count as Algebra or Analysis? I once heard that all of math can be divided into those categories. |
| 10:06 | clgv | TimMc: algebra most of the time ;) |
| 10:06 | TimMc | Or are they simply a tool that is used in both? |
| 10:06 | clgv | though matrices are also used in higher dimensional analysis |
| 10:07 | angerman | TimMc: I wouldn't say that you can differentiate them so clearly, but matrices are "just a tool" of linear algebra… which then again is just a subset of algebra. |
| 10:07 | angerman | TimMc: Tensors are just the natrual extension of matrices. |
| 10:08 | clgv | I dont think they are just a tool of linear algebra - in fact they are one of its big subjects/topics ;) |
| 10:08 | angerman | clgv: matrices are _just_ a tool. That become pretty obvious if you read material from the 18th centrury. |
| 10:09 | angerman | matrices are just a way to arrange numbers in a rectangular format. |
| 10:09 | angerman | nothing more. nothing less. |
| 10:09 | angerman | these days though people seemingly equate matrices with linear algebra. |
| 10:09 | clgv | hm but they also form monoids and groups and there are results on them. seems more than just tools to me ;) |
| 10:09 | gfrlog | matrices == linear algebra |
| 10:10 | Fossi | hmm. quaternions. so yummy |
| 10:10 | angerman | gfrlog: someone had to follow suit on that statement. |
| 10:11 | angerman | clgv: groups? |
| 10:11 | TimMc | (= matrices linear-algebra) ##true or false? |
| 10:11 | gfrlog | I think this is a dispute about the meaning of "tool" |
| 10:11 | TimMc | bah, sexpbot wants parens |
| 10:12 | gfrlog | ,(= matrices linear-algebra) |
| 10:12 | clojurebot | java.lang.Exception: Unable to resolve symbol: matrices in this context |
| 10:12 | angerman | gfrlog: matrices are a way to write linear-algebra nicely. |
| 10:12 | TimMc | gfrlog: You forgot to require incanter. :-P |
| 10:12 | angerman | they are just a shorthand for writing multiple sums. |
| 10:12 | gfrlog | angerman: and heck, it's all just sets anyhow |
| 10:13 | clgv | angerman: invertible matrices form a group with multiplication afaik |
| 10:13 | gfrlog | if a math thing A can be formulated as a particular kind of math thing B, does that mean A doesn't really exist? |
| 10:14 | gfrlog | if I can construct set theory using matrices as a primitive, does that mean everything in math is really a matrix? |
| 10:14 | angerman | Oh, now this is becoming a flamewar. |
| 10:14 | gfrlog | whoops mybad |
| 10:14 | TimMc | This strikes me as a Formalism argument. |
| 10:14 | clgv | gfrlog: probably most of math doesnt really exists - did you ever spot a real number in the real world? ;) |
| 10:14 | gfrlog | clgv: agreed |
| 10:15 | TimMc | (What's the opposite of formalism?) |
| 10:15 | clgv | chaos |
| 10:15 | ejackson | comment threads |
| 10:15 | clgv | ejackson: good one :D |
| 10:15 | gfrlog | clgv: I once spotted a real number of real numbers |
| 10:15 | Chousuke | I think mathematical things are real, just not concrete. |
| 10:15 | TimMc | gfrlog: 0? |
| 10:15 | angerman | My point is: matrices eshew much of the underlying mathematics by being easily accessible. |
| 10:16 | Chousuke | even non-real numbers are real :P |
| 10:16 | gfrlog | TimMc: yeah, I thought of that |
| 10:16 | ejackson | i agree with Chousuke abstract is still real |
| 10:16 | TimMc | gfrlog: I'm not sure we have real numbers in this universe, actually. |
| 10:16 | clgv | "real" was never the question - "existence" was asked for |
| 10:17 | gfrlog | TimMc: you argue for physics being discrete? |
| 10:17 | TimMc | gfrlog: I'm not sure. |
| 10:17 | Chousuke | clgv: how do you define the existence of something abstract? |
| 10:17 | TimMc | I know a string theory professor, I should ask his opinion. |
| 10:17 | gfrlog | TimMc: I don't disagree |
| 10:17 | TimMc | But yes, that's what I'm referring to. |
| 10:18 | gfrlog | TimMc: if it is discrete, I believe that means that it is possible to encode every detail of the universe over all of history into a single real number |
| 10:18 | TimMc | In the realm of computers we *certainly* don't have the natural numbers even. |
| 10:18 | TimMc | gfrlog: Not just that, an integer. |
| 10:18 | gfrlog | TimMc: I disagree |
| 10:18 | gfrlog | TimMc: every integer only contains a finite amount of information |
| 10:19 | TimMc | yes? |
| 10:19 | gfrlog | TimMc: perhaps time is infinite |
| 10:19 | gfrlog | TimMc: perhaps space is infinite |
| 10:19 | TimMc | Ah, perhaps. |
| 10:19 | gfrlog | TimMc: if neither, I imagine that means you're right |
| 10:19 | clgv | Chousuke: why do I have to? |
| 10:20 | TimMc | gfrlog: Here's a fun one: A *deterministic*, finite, discrete universe will eventually start looping. |
| 10:20 | Chousuke | clgv: because without such a definition it's pretty hard to make a case either way :/ |
| 10:21 | clgv | Chousuke: I didn't draw "abstract" into the discussion ;) |
| 10:21 | gfrlog | TimMc: that is a fun one. Probably in practice it'd be a trivial loop |
| 10:21 | TimMc | Heat death, *then* loop. Fun times. |
| 10:22 | Chousuke | Would that mean that this conversation has already occurred uncountable times? :P |
| 10:23 | tomoj | at that point "occur" looks rather suspicious |
| 10:23 | gfrlog | Chousuke: either finite or countable I think |
| 10:23 | clgv | TimMc: well I read an article that explained that from a thermodynamic argument one can calculate the maximum distance where a parallel universe just like ours exists |
| 10:23 | clgv | the pity is we might never be able to travel there since we are too slow... |
| 10:24 | gfrlog | clgv: we could stay in this universe and have an equivalent experience |
| 10:24 | TimMc | clgv: Why would you want to go there? |
| 10:24 | ejackson | if you take Kant's perspective then anything which the mind perceives exists. We perceive numbers. They exist, even though we cant put them in our pipes and smoke them. |
| 10:24 | tomoj | if the universe is a looping record, why have the phonograph in our ontology at all? |
| 10:24 | Fossi | ejackson: damn |
| 10:24 | gfrlog | ejackson: what is that definition useful for? |
| 10:24 | ejackson | who said anything about useful ? |
| 10:24 | TimMc | tomoj: I... what. |
| 10:25 | clgv | "useful philosophy" - oxymoron or not? ;) |
| 10:25 | TimMc | :-) |
| 10:25 | gfrlog | ejackson: I just did; unfortunately I'll have to follow that up with leaving the conversation. academics call. |
| 10:26 | ejackson | good luck. |
| 10:26 | gfrlog | ejackson: thx |
| 10:26 | tomoj | TimMc: what's the difference between a universe that keeps repeating and one that just "plays" once? |
| 10:27 | clgv | hmm on a second thought: a parallel universe that is exactly like ours - couldnt be exactly like ours if you could just go there ^^ |
| 10:27 | TimMc | tomoj: It wouldn't loop back from the start. |
| 10:27 | tufflax | tomoj: You just said it? |
| 10:28 | TimMc | It would just eventually hit a loop, like the hailstone numbers. |
| 10:30 | tomoj | tufflax: I meant to suggest that the distinction is meaningless |
| 10:31 | tufflax | I thought meaningless subjects was what we were going for :) |
| 10:32 | TimMc | proofs -> matrices -> tools vs. objects -> philosophy of math -> all downhill from there |
| 10:38 | tomoj | for a bit I thought maybe I was attacking a straw man, but gfrlog's "either finite or countable" suggests otherwise - "how many times has the universe looped?" sounds like "how many times has god heard the record play?" |
| 10:39 | TimMc | heh |
| 10:39 | TimMc | OK, change of topic: |
| 10:40 | TimMc | Using α, β, & γ as variable names in a barycentric coordinate computation: Awesome or awesome? |
| 10:41 | TimMc | (Or will this screw someone over who tries to use my code?) |
| 10:41 | angerman | TimMc: unless he screws with the file-encoding, no I don't think so |
| 10:42 | tomoj | my slime can't handle it :( |
| 10:42 | ejackson | TimMc: although it might drive you nuts rather quickly. |
| 10:42 | TimMc | If someone on a CP-1252 encoding system (Windows) uses my source jar file, they might get a surprise? |
| 10:43 | TimMc | They're just local bindings, not exposed in the API. |
| 10:43 | raek | no, Clojure source files are always UTF-8 |
| 10:43 | tomoj | which as it turns out is quite annoying - when exploring production data, non-slime-compatible characters are hidden landmines |
| 10:43 | raek | but slime uses ISO 8859-1 for the socket |
| 10:43 | TimMc | Haha, that's terrible. |
| 10:43 | raek | (you can configure that) |
| 10:44 | tomoj | glad to hear it, dunno why I haven't tried to fix it yet... |
| 10:44 | raek | fortunately, slime and swank are coding-aware, and does the translation correctly (as long as you configure swank and slime for the same coding) |
| 10:44 | TimMc | slime-net-coding-system ? |
| 10:44 | raek | yes |
| 10:45 | foxupa | hi |
| 10:45 | chouser | TimMc: the other problem is people trying to edit your code having difficulty typing those chars |
| 10:45 | chouser | TimMc: That's the one that has bugged me the most with my non-ascii variable names |
| 10:45 | raek | and then something like lein swank localhost 4001 :encoding '"UTF-8"' |
| 10:48 | foxupa | so i was wondering if there is a way to do basic continuation passing style lazy seqs? |
| 10:51 | tomoj | hmm, β at least seems to work after just changing slime-net-coding-system, no encoding opt passed to lein swank |
| 10:52 | raek | tomoj: if you do (seq "β"), what do you get? |
| 10:52 | raek | \β ? |
| 10:52 | tomoj | (\β) |
| 10:52 | raek | great! |
| 10:53 | tomoj | I'm in your debt |
| 10:53 | clgv | ,(seq "β") |
| 10:53 | clojurebot | (\β) |
| 10:54 | raek | My work here (as the encoding nazi) is done. |
| 10:54 | TimMc | Thank you, encoding nazi! |
| 10:54 | Fossi | ,(seq "þ") |
| 10:54 | clojurebot | (\þ) |
| 10:54 | Fossi | hmmm |
| 10:54 | TimMc | :-þ |
| 10:54 | clgv | political incorrect vocabular here... tsk tsk :P |
| 10:55 | raek | :-ƿ |
| 10:55 | tomoj | I'd never before considered the literal meaning of "politically incorrect" which seems to apply :) |
| 11:01 | chouser | foxupa: like a sequence monad? or something else? |
| 11:02 | foxupa | chouser, the problem i'm trying to solve is as follows: I have a graph and want to compute the set of automorphisms of that graph |
| 11:02 | foxupa | this involves essentially recursively descending down a tree of possible permutations and at the bottom of the tree checking if the permutation is a valid automorphism |
| 11:03 | foxupa | but the problem is that for big graphs |
| 11:03 | foxupa | there could be a very large number of automorphisms |
| 11:03 | foxupa | so what i want is a lazy seq |
| 11:03 | foxupa | so that the first element of the seq is the first leaf of the tree |
| 11:03 | foxupa | the second element is the second leaf of the tree |
| 11:03 | foxupa | etc |
| 11:04 | foxupa | in scheme i know how to do this with continuations |
| 11:04 | foxupa | however i don't know anything about monads, and i want to learn how they work, but at this time i'd rather just find hte most straightforward solution to get the job done |
| 11:04 | chouser | manually building a lazy seq using lazy-seq is structurally very similar to CPS |
| 11:04 | raek | foxupa: are you familiar with writing functions that produce lazy-seqs? |
| 11:05 | foxupa | well i'm browsing through the book Programming Clojure |
| 11:05 | foxupa | but I just wanted to know that it is possible with lazy seq's right? |
| 11:05 | foxupa | is there some kind of "yield" function or something I can just call in my tree walk? |
| 11:06 | raek | foxupa: you return a (lazy-seq ...) expression. the contained body will not be evaluated until when it is needed |
| 11:07 | chouser | foxupa: take a look at the replace-symbol example in that book, chapter 5 |
| 11:07 | raek | when the body is evaluated, it most often returns something like (cons some-element (recursive-call)) |
| 11:07 | raek | so you get something like (cons some-element (lazy-seq ...)) |
| 11:07 | tomoj | you already have a tree of permutations sitting there? |
| 11:07 | chouser | I personally think there is another book with a better example of lazy-seq, but Halloway's replace-symbol will do. :-) |
| 11:07 | foxupa | no the tree is being generated recursively (depth first search at this time) |
| 11:08 | foxupa | raek, that method makes sense for the typical linear recursion pattern, but my difficulty is in walking back up the tree |
| 11:08 | foxupa | (I'm looking up the replace symbol example now) |
| 11:08 | raek | hrm. |
| 11:08 | chouser | foxupa: ah, I see what you're saying. |
| 11:09 | chouser | perhaps some clever combination with the trampoline function would do it. |
| 11:09 | raek | (general lazy-seq example https://gist.github.com/480608) |
| 11:09 | chouser | or tree-seq with filter |
| 11:09 | chouser | actually, that sounds better. |
| 11:10 | foxupa | chouser, yes, I was looking into using trampoline, but that's why I was just wondering if this type of problem has been solved... in scheme continuations solved this perfectly but clojure doesn't have first class continuations as far as i can tell |
| 11:10 | chouser | foxupa: tree-seq will walk a tree depth-first, returning *all* nodes. filter that for your leaves and you'll be done |
| 11:10 | foxupa | actually chouser, the tree-seq seems the correct approach |
| 11:11 | chouser | foxupa: clojure does not have continuations because it maintains method-call compatibility with Java, which does not support continuations. |
| 11:13 | foxupa | chouser, wait, the problem is that many of the leaves are not valid (and you won't know which ones till you get to the leaf), so i'd like to have the lazy-seq only return the valid ones, but actually on secontd thought combining tree-seq with filter seems correct |
| 11:13 | foxupa | actually maybe not |
| 11:13 | foxupa | i'll play with some simple examples and get back to you guys on whether it works |
| 11:19 | foxupa | also another general clojure-software-engineering question: sometimes I define a utility function within another function itself, but I'm not sure how to test this utility function from a separate test file that has my other tests... what is the best practice regarding this? |
| 11:26 | jkkramer | foxupa: if you want to test it, you'll have to def it at the top level. you could make it private with defn- (note trailing dash). there are tricks to access private vars from other namespaces, but not lexically-scoped locals |
| 11:29 | foxupa | jkkramer, I figured that would be the case... so is it generally better to hoist the util-function to top level and test or just do intensive testing of the entire function that it is in or is this always a case-by-case type of decision? (I'm trying to build better software-eng habits) |
| 11:30 | jkkramer | foxupa: case-by-case is how i decide. if the utility function is used in more than one place, probably good to test it on its own. if it's just one aspect of a larger, black-box-like function, maybe it's not needed |
| 11:31 | fliebel | goody morny :) |
| 11:43 | __name__ | GOod morning fliebel |
| 11:44 | fliebel | I suppose no-one has written a kick-ass GUI lib while I was sleeping? |
| 11:48 | semperos | I have a collection of maps |
| 11:49 | semperos | I want to filter that collection |
| 11:50 | semperos | keeping only those maps that have key-value pairs that I pass in |
| 11:51 | semperos | so something like ({:a "foo", :b "bar", :z "hello"} {:c "baz" :d "etc" :z "hello"}) |
| 11:51 | semperos | and filter to find the map that contains at least {:a "foo" :z "hello"} |
| 11:52 | semperos | how do I tackle this (cleanly)? |
| 11:54 | carkh | ,(select-keys {:a "foo", :b "bar", :z "hello"} (keys {:c "baz" :d "etc" :z "hello"})) |
| 11:54 | clojurebot | {:z "hello"} |
| 11:54 | carkh | ? |
| 11:55 | carkh | if the value needs to be the same, that's only one function calla way |
| 11:55 | semperos | ok |
| 11:55 | semperos | I'm actually dealing with records, so I know the keys are there |
| 11:56 | carkh | so your example is not quite good enough ! |
| 11:56 | carkh | =) |
| 11:56 | semperos | :) |
| 11:56 | semperos | it's a bit confusing, but the function allows an arbitrary number of key-value pairs to check against |
| 11:56 | semperos | and returns the first for which all match |
| 11:57 | semperos | that's the intent, anyway |
| 11:58 | raek | semperos: one way could be to use clojure.set/index |
| 11:59 | raek | (that approach is not lazy, though) |
| 11:59 | semperos | due to the nature of my domain, lazy isn't required (nor really possible) |
| 11:59 | raek | wait. |
| 11:59 | tomoj | docs on index utterly confuse me |
| 11:59 | semperos | me too :) |
| 11:59 | raek | clojure.set/superset? |
| 11:59 | clojurebot | clojure is like life: you make trade-offs |
| 12:00 | semperos | hehe |
| 12:00 | semperos | fewer than elsewhere, clojurebot |
| 12:00 | jkkramer | ,(filter #(every? (fn [[k v]] (= (% k) v)) {:a "foo" :z "hello"}) [{:a "foo", :b "bar", :z "hello"} {:c "baz" :d "etc" :z "hello"}]) |
| 12:00 | clojurebot | ({:a "foo", :b "bar", :z "hello"}) |
| 12:00 | raek | index partitions a set of maps. you give it the key you want to index on, and it will return a map from values of those keys to sets of the maps those values for the keys |
| 12:01 | raek | eh, not very easy to explain |
| 12:01 | semperos | jkkramer: lookin good |
| 12:01 | jkkramer | semperos: add a 'first' to that if you just want the first match, of course |
| 12:01 | semperos | right |
| 12:01 | raek | ,(filter (clojure.set/superset? % {:a "foo" :z "hello"}) [{:a "foo", :b "bar", :z "hello"} {:c "baz" :d "etc" :z "hello"}]) |
| 12:01 | clojurebot | java.lang.Exception: Unable to resolve symbol: % in this context |
| 12:01 | raek | ,(filter #(clojure.set/superset? % {:a "foo" :z "hello"}) [{:a "foo", :b "bar", :z "hello"} {:c "baz" :d "etc" :z "hello"}]) |
| 12:01 | clojurebot | () |
| 12:01 | semperos | I was using a for to go through all the key-vals in the map and then filtering |
| 12:02 | semperos | which gave me a seq of seqs |
| 12:02 | semperos | so I had to do a nasty flatten-distinct-first combo |
| 12:02 | semperos | jkkramer: that's quite nice, thank you |
| 12:02 | raek | ah, no. superset is for sets... *duh* |
| 12:03 | fliebel | raek: A set is to a map as a keyword is to a symbol :P |
| 12:04 | amalloy | *brain melts trying to puzzle that one out* |
| 12:04 | raek | (defn contains-mapping? [m k expected] (if-let [[_ actual] (find m k)] (= actual expected) false)) |
| 12:05 | fliebel | amalloy: Well, they are both hashes, but the keys of a set refer to themselves, while the keys in a map refer to their values. |
| 12:05 | amalloy | ah |
| 12:06 | raek | (defn contains-mappings? [m & key-vals] (every? #(apply contains-mapping? m %) (partition 2 key-vals))) |
| 12:06 | semperos | since I'm dealing with records, only change to jkkramer's code is (= (k %) v)) inside the second anon fn |
| 12:06 | semperos | thanks again, everyone |
| 12:07 | amalloy | semperos: fwiw that's equivalent to (comp #{v} k) |
| 12:08 | amalloy | er, except mine's a function and yours is a result |
| 12:08 | semperos | :) |
| 12:08 | semperos | concept understood |
| 12:09 | devn | amalloy: i really like your utils repo -- i hadn't considered doing that |
| 12:09 | jkkramer | semperos: another caveat is that nil vals always match |
| 12:09 | amalloy | jkkramer: and for me, nils and falses never do |
| 12:09 | amalloy | yours can be fixed with (= (k % (Object.)) v), mine can't :P |
| 12:09 | amalloy | devn: i'm glad! |
| 12:10 | amalloy | how'd you find it? |
| 12:11 | devn | someone posted it on twitter or disclojure i think? |
| 12:11 | semperos | jkkramer: understood; as I'm filtering against required record fields, that's ok |
| 12:12 | amalloy | yeah, i think it hit disclojure as well as planet-clojure |
| 12:12 | amalloy | feel free to use mine, of course, though the intent was that you go out and make your own as well |
| 12:13 | devn | and suggested it was a cool idea -- it's like dotfiles |
| 12:13 | devn | sorry some lag here |
| 12:13 | amalloy | heh |
| 12:13 | amalloy | no worries |
| 12:13 | devn | but yeah, the idea of dotfiles is great because it's kind of a condensory |
| 12:14 | fliebel | devn: Doesn't clojure actually support something like it? user.clj or something like that. no dot though :( |
| 12:14 | devn | it forces you to generalize and abstract to the fullest extent possible |
| 12:14 | devn | fliebel: yes, but I don't know how common it is to use |
| 12:14 | devn | either way i like the idea of having something on github to distribute |
| 12:14 | amalloy | fliebel: and it's not portable |
| 12:14 | devn | ^^ |
| 12:14 | amalloy | if your program depends on something in user.clj nobody else can use it |
| 12:15 | devn | amalloy: condensory is good when dealing with literature, language and stuff |
| 12:15 | devn | or at least that's where i use it |
| 12:15 | fliebel | amalloy: Yea, I figure that to. I thought a git hook could help here :D |
| 12:15 | devn | take a big paragraph and boil it down to its smallest parts inside your condensory |
| 12:15 | devn | that sort of thing :) |
| 12:15 | amalloy | fliebel: augh i just had breakfast, don't make me throw up |
| 12:16 | fliebel | condesnory is not even in any dictionary I know of :( |
| 12:16 | fliebel | (with that spelling, yeh) |
| 12:16 | amalloy | fliebel: what about condensory? |
| 12:16 | fliebel | nope |
| 12:16 | jkkramer | condensery |
| 12:17 | fliebel | I'm pretty sure my right click does not make such mistakes. |
| 12:17 | amalloy | haha |
| 12:17 | amalloy | $dict condensery |
| 12:17 | sexpbot | amalloy: noun: A place in which condensed milk is manufactured |
| 12:17 | amalloy | $dict condensory |
| 12:17 | sexpbot | amalloy: Word not found. |
| 12:19 | amalloy | fliebel: it's easy to make up a meaning from the roots, though. "having the effect of condensing" |
| 12:19 | amalloy | which i like rather better than the thing about milk |
| 12:33 | Raynes | devn: I see you forked cake-search. Don't know if you know this, but I already added clojars stuff to cake proper. |
| 12:44 | devn | Raynes: yeah i was confused :D |
| 12:44 | devn | Raynes: i was looking for the cake search functionality last night and didn't find it |
| 12:45 | devn | wow i didn't know condensory was such a fancy word |
| 12:46 | devn | i heard it w/r/t a minimalist poet a long time ago, she called her workspace a condensory because she would take big ideas and slowly boil them down to their smallest parts |
| 12:46 | devn | ^ fliebel amalloy |
| 12:56 | Raynes | devn: src/tasks/clojars.clj iirc |
| 12:59 | devn | Raynes: gotcha, thanks |
| 12:59 | fliebel | devn: cool |
| 13:00 | fliebel | Raynes: What did you mean the other day by "fun in a want-to-kill-yourself way"? |
| 13:05 | devn | fliebel: also: http://www.lorineniedecker.org/ is the poet -- can't believe i found that, but some of it is quite good |
| 13:05 | choffstein | hey all! I have a quick question -- I basically want to serve a zip file I create dynamically from my web host. Ideally I would pass into it a map with keys as file names and values as the file data. Returned would be the data for a zip file. Ruby has a library called Zippy that does this. Any idea what java library or clojure library might do this? |
| 13:07 | fliebel | choffstein: Probably a subclass of OutputStream. I know there is GZIPOutPutStream or something like that, but that does not do folders. |
| 13:08 | choffstein | Yeah. I found that as well... Was hoping there was just a plug-and-play solution :) |
| 13:08 | choffstein | Ruby has spoiled me :D |
| 13:09 | choffstein | Anyone know how to use the mail or mymail commands if i "Have a message"? |
| 13:09 | amalloy | choffstein: /msg sexpbot mail |
| 13:09 | cemerick | choffstein: sorry, is the zip file prepared when you deploy the app? |
| 13:09 | clojurebot | unzip-with is http://paste.lisp.org/display/76458,1/raw |
| 13:10 | choffstein | cemerick: no. Basically, I have a map with file names and the data. So let's say my app takes a bunch of images, works on them in memory, and wants to send them back. |
| 13:11 | choffstein | Nothing is written to disk. Everything is in memory. |
| 13:11 | amalloy | cemerick: it sounds to me like no; his user picks N files from some list and says "zip em up for me", and he wants to serve a single zip file in reponse |
| 13:11 | cemerick | aaaah |
| 13:11 | choffstein | yeah, exactly. |
| 13:11 | choffstein | But most of the Java examples have you reading from a file on disk. I just have the raw bits in memory. |
| 13:12 | fliebel | choffstein: You could use a stringWriter to get around that. |
| 13:12 | amalloy | choffstein: ByteArrayInputStream maybe? |
| 13:12 | cemerick | choffstein: simple with ZipOutputStream |
| 13:12 | choffstein | Haha. Hurrah! Answers! |
| 13:12 | cemerick | and the options fly :-P |
| 13:13 | cemerick | Not sure how a StringWriter would help tho… |
| 13:13 | amalloy | now let's all try to be offline when, in a few hours, he finds none of the solutions are satisfactory |
| 13:13 | choffstein | ZipOutputStream with ZipEntrys, perhaps? |
| 13:14 | choffstein | or at least pretend to idle ;) |
| 13:14 | cemerick | choffstein: only way to do it AFAIK |
| 13:14 | fliebel | cemerick: Oh, well, I don't know what they're called, but you know, stuff that takes a string and torns it into something that looks like it could be fron a disk. |
| 13:14 | cemerick | (with-open [zout (ZipOutputStream. (ByteArrayOutputStream.))] |
| 13:15 | fliebel | I was not able to quickly see how to fill a zipentry with content. |
| 13:15 | cemerick | (doseq [e entries](..putNextEntry ...make new zip entry...) |
| 13:15 | amalloy | fliebel: stringreader |
| 13:15 | cemerick | (.write zout ...entry data...) |
| 13:15 | cemerick | anyway |
| 13:15 | amalloy | but i don't think he has a string either |
| 13:15 | cemerick | fliebel: it's just a marker that the ZOS lays down in the file it's building. You write the entry's content to the ZOS itself. |
| 13:16 | cemerick | it's a bit of a screwy interface. |
| 13:16 | fliebel | ah… so you just add a zipentry and use write. |
| 13:16 | cemerick | yup |
| 13:16 | choffstein | that is a horrible interface |
| 13:16 | choffstein | jesus. |
| 13:17 | cemerick | If you have a bunch of data that won't fit in memory, that's the sort of API you end up with. |
| 13:17 | amalloy | it's much more convenient than hadoop |
| 13:17 | cemerick | *everything* is more convenient than hadoop |
| 13:18 | fliebel | Could be fun, having one thread write data to the stream, and have another add entries to it :) |
| 13:36 | devn | hmm...sandbar is nice |
| 13:37 | choffstein | i'm going to smash my head against this keyboard |
| 13:39 | choffstein | sometimes java feels like a sick joke |
| 13:40 | technomancy | choffstein: that's why they call it "wrap the crap" |
| 13:41 | choffstein | what does with-open return? |
| 13:41 | cemerick | the value of the last expression in its body |
| 13:42 | choffstein | hmmm...yep, definitely not what I want then :D |
| 13:42 | pdk | doesn't with-open have an implicit do |
| 13:42 | pdk | or the try form at least |
| 13:42 | choffstein | implicit try with finally |
| 13:43 | choffstein | cemerick: in the code you posted above, how would I go about ripping out the bytes of the zip data I wrote? |
| 13:43 | pdk | that's one thing that always bugs me |
| 13:44 | pdk | for some reason special forms are too special to have builtin docstrings |
| 13:44 | pdk | they're all just "please see [clojure special forms article]" |
| 13:44 | cemerick | choffstein: that stuff was totally off the top of my head :-) |
| 13:44 | choffstein | cemerick: well, it is close to working ;) |
| 13:44 | pdk | cause they are the unique snowflakes of forms |
| 13:44 | cemerick | but, what do you mean by "rip out the bytes of zip data"? |
| 13:45 | cemerick | pdk: 'course, forms like let would dump 1500 words in your lap. |
| 13:45 | pdk | well MAYBE |
| 13:46 | pdk | though if you think about it you could just say something like "let takes a vector with pairs of symbol names and their bindings then a body wrapped in an implicit do with the symbol names bound" |
| 13:46 | pdk | the other docs are already extremely terse so they'd fit in! |
| 13:47 | jkkramer | ,(clojure-version) |
| 13:47 | clojurebot | "1.2.0" |
| 13:48 | jkkramer | pdk: 1.3 has better docs for let and friends |
| 13:50 | pdk | i like the "and friends" |
| 13:50 | pdk | i'm picturing an edutainment cartoon series |
| 13:50 | jkkramer | :) |
| 13:56 | choffstein | can't ... figure out ... gzip library. too .... dense. ack... |
| 14:01 | choffstein | or maybe i'm too dense? |
| 14:02 | choffstein | ANyone mind taking a peek at https://gist.github.com/881685 |
| 14:02 | choffstein | I am confused as to why my zip file work work. To be used like (multiple-file-return {"ABC" "File data" "XYZ" "Other file data"}) |
| 14:05 | amalloy | choffstein: fwiw (.toString b) == (str b) |
| 14:05 | choffstein | ...word |
| 14:06 | choffstein | much appreciated :D |
| 14:06 | amalloy | code looks reasonable to me, probably because i've never had to use ZOS |
| 14:07 | choffstein | well, any other things you would change? |
| 14:07 | choffstein | i'm just trying to get better with clojure code in general. anything "ugly" about it? |
| 14:07 | amalloy | i prefer (Foo.) to (new Foo), but it's a matter of taste |
| 14:09 | amalloy | more importantly you might look into map destructuring: ##(let [m {1 2 3 4}] (doseq [[k v] m] (println (+ k v)))) |
| 14:09 | sexpbot | ⟹ 3 7 nil |
| 14:09 | choffstein | Yeah. I've noticed other people like that too |
| 14:09 | choffstein | oh, very cool. thanks! |
| 14:09 | amalloy | other than that i'd say it's pretty idiomatic |
| 14:09 | choffstein | destructuring ... yes, I remember that from my SML days 5 years ago :D |
| 14:11 | mids | maybe put the entire let in a separate function, right now you are doing 2 different things in one; building an http response and zipping files |
| 14:13 | choffstein | ah, right. |
| 14:13 | amalloy | oh, didn't even notice that let at the top :P. (apply str (interpose " " foo)) is (clojure.string/join " " foo) |
| 14:14 | choffstein | ah, thanks. |
| 14:15 | gfrlog | I can't pass a java.util.Iterator to (seq)? |
| 14:15 | choffstein | slowly getting there... |
| 14:16 | amalloy | gfrlog: iterators aren't seqs |
| 14:16 | choffstein | gist now re-written :D |
| 14:16 | amalloy | because to use them you have to mutate them |
| 14:16 | amalloy | but ##(doc iterator-seq), if for some reason you can't just call seq on the original Iterable |
| 14:16 | sexpbot | ⟹ "([iter]); Returns a seq on a java.util.Iterator. Note that most collections providing iterators implement Iterable and thus support seq directly." |
| 14:18 | gfrlog | amalloy: thanks |
| 14:19 | gfrlog | amalloy: I didn't think that iterators WERE seqs, but it seemed natural that calling (seq it) would return a seq |
| 14:19 | amalloy | gfrlog: i don't exactly disagree, but i also don't mind that it's made "hard" to get a seq from an iterator, since that causes side effects |
| 14:20 | amalloy | whereas seq on most anything else doesn't |
| 14:20 | gfrlog | amalloy: agreed |
| 14:25 | choffstein | arrrggghhhhh! |
| 14:25 | choffstein | can't even type correctly. *the window |
| 14:25 | gfrlog | making corrections after jumping out a window |
| 14:31 | fdaoud | chouser fogus congrats on completing The Joy of Clojure! |
| 14:33 | Lulu58e4 | fdaoud:seconded; will have to re-read full version |
| 14:36 | leeda | Hi, can I ask questions about leiningen here? |
| 14:36 | gfrlog | leeda: yes |
| 14:37 | leeda | I just installed both Clojure and lein yesterday on my Mac (OS 10.7) and for some reason, lein is really slow. Even `lein help` takes a couple seconds. What am I doing wrong? |
| 14:38 | gfrlog | huh. I've always just put up with that. |
| 14:38 | leeda | Oh... so it's normal? |
| 14:38 | leeda | 0m7.511s |
| 14:39 | gfrlog | I can't imagine anybody else putting up with that, so I wouldn't be surprised if somebody is about to swoop in and suggest something like nailgun or something to do with emacs. |
| 14:39 | gfrlog | but it's definitely normal for me |
| 14:39 | amalloy | cake uses something vaguely like nailgun already |
| 14:39 | hiredman | the jvm takes time to boot |
| 14:40 | gfrlog | nobody has written a clojure-to-bash compiler yet? |
| 14:40 | leeda | Hm ok. |
| 14:40 | amalloy | $ time cake help &>/dev/null ## real 0m0.129s |
| 14:40 | sexpbot | amalloy: The time is now 2011-03-22T18:38:12Z |
| 14:40 | amalloy | haha whoops. didn't mean to ask sexpbot for the time, there :P |
| 14:40 | leeda | amalloy: Yeah, cake is fast. |
| 14:40 | pdk | it's basically just attributable to jvm start time |
| 14:40 | pdk | cake has something to let it run with a persistent jvm to negate that |
| 14:40 | leeda | amalloy: I wanted to use the "ring" task for lein, can I use it with cake too? |
| 14:41 | leeda | This is what I'm talking about: https://github.com/weavejester/lein-ring |
| 14:41 | hiredman | lein has interactive mode, which starts up and you give it commands and you don't need to wait to boot the jvm everytime |
| 14:42 | Raynes | leeda: Leiningen plugins aren't compatible with cake plugins. |
| 14:42 | leeda | Raynes: ok, thanks. |
| 14:43 | leeda | I guess I'll just live with it for now. I'm too excited by Clojure to let that stop me... |
| 14:51 | technomancy | leeda: it's faster if you use a client JVM, but that can be hard to do on macosecks. try the interactive task and the swank task. |
| 14:56 | leeda | technomancy: could you explain briefly what swank is and how I would use it? I don't use SLIME... |
| 15:00 | technomancy | leeda: oh sorry; if you don't use slime then swank isn't useful. |
| 15:01 | leeda | technomancy: ah, ok, thanks anyway though. |
| 15:18 | tsdh | Is there a numerical equality function that doesn't care about type, so that I can compare a Double with a ratio? |
| 15:18 | TimMc | ,(== 5/2 2.5) |
| 15:18 | clojurebot | true |
| 15:18 | tsdh | Ah, great. |
| 15:19 | TimMc | tsdh: ##(= 5/2 2.5) works too, though |
| 15:19 | sexpbot | ⟹ true |
| 15:19 | tsdh | TimMc: What's ##? |
| 15:19 | TimMc | tsdh: sexpbot command flag |
| 15:20 | tsdh | Ok. |
| 15:20 | Raynes | Embedded evaluation trigger, to be specific. :> |
| 15:20 | TimMc | Yeah, that. |
| 15:20 | Raynes | amalloy and I use very long technical names whenever possible. |
| 15:21 | amalloy | embedded evaluation trigger? don't blame that shit on *me*: i implemented it but i refuse to call it something that long |
| 15:21 | TimMc | amalloy: Bat signal? |
| 15:21 | gfrlog | "crunch crunch" |
| 15:21 | TimMc | tsdh: You'll usually want to use a rounding function for comparing doubles. Here's what I do: https://github.com/timmc/CS4300-HW4/blob/master/test/timmcHW4/test/utils.clj |
| 15:21 | Raynes | amalloy: Is abbreviating it to EET a good compromise? |
| 15:22 | Raynes | Also, don't undermine me in front of company. |
| 15:23 | tsdh | TimMc: Thanks. But in my case, I just found out that the "rounding error" is about 10000. :-) |
| 15:23 | TimMc | haha |
| 15:23 | TimMc | close enough for theoretical physics work |
| 15:30 | tsdh | Haha, yeah. The problem was that I stuffed my numbers accidentially into a set, and thus duplicates vanished. |
| 15:31 | gfrlog | ,{[#{:tom}] #{['tim]}} |
| 15:31 | clojurebot | {[#{:tom}] #{[tim]}} |
| 15:35 | amalloy | gfrlog: testing that you can have complex objects as map keys? |
| 15:36 | gfrlog | amalloy: I have no defense for my utterances |
| 15:36 | gfrlog | at least not that one |
| 15:36 | gfrlog | sometimes I get a simple pleasure from ridiculous things |
| 15:37 | amalloy | gfrlog: (comp #{'tom} :name) is a simple pleasure of mine |
| 15:41 | gfrlog | amalloy: I find that delightfully difficult to untangle |
| 15:42 | amalloy | gfrlog: "return something truthy iff :name is 'tom" |
| 15:42 | amalloy | that is, it's equivalent to #(= (:name %) 'tom) |
| 15:42 | gfrlog | very good |
| 15:43 | gfrlog | I like (apply partial (repeat partial)) |
| 15:43 | gfrlog | but I doubt there's any practical application for it |
| 15:43 | fliebel | &(let [ 2] ) |
| 15:43 | sexpbot | java.lang.IllegalArgumentException: let requires an even number of forms in binding vector |
| 15:43 | gfrlog | fliebel: trying to let some whitespace? |
| 15:43 | fliebel | gfrlog: yea :D |
| 15:43 | fliebel | works locally :) |
| 15:44 | tsdh | Isn't there a standard `abs' function? |
| 15:44 | fliebel | ,(let [ 2] ) |
| 15:44 | clojurebot | java.lang.IllegalArgumentException: let requires an even number of forms in binding vector |
| 15:44 | amalloy | clojure.math/abs, probably |
| 15:45 | gfrlog | ,(map clojure.math/abs (range -5 5)) |
| 15:45 | clojurebot | java.lang.ClassNotFoundException: clojure.math |
| 15:45 | amalloy | &(require '[clojure.math :as math]) |
| 15:45 | sexpbot | java.io.FileNotFoundException: Could not locate clojure/math__init.class or clojure/math.clj on classpath: |
| 15:45 | amalloy | feh |
| 15:45 | fliebel | &' |
| 15:45 | sexpbot | java.lang.Exception: EOF while reading |
| 15:45 | gfrlog | my repl doesn't know about it ethire |
| 15:46 | pjstadig | ,java.lang.Math |
| 15:46 | clojurebot | java.lang.Math |
| 15:46 | pjstadig | ,(java.lang.Math/abs -3) |
| 15:46 | clojurebot | 3 |
| 15:46 | tsdh | amalloy: Is that contrib? Or why is clojure.math not listed on the API page? |
| 15:46 | fliebel | haha, ever tried a zero-width space in a monospaced font? |
| 15:46 | gfrlog | (map java.lang.Math/abs (range -5 5)) |
| 15:46 | amalloy | oh, i thought Math only worked with doubles |
| 15:46 | gfrlog | ,(map java.lang.Math/abs (range -5 5)) |
| 15:46 | clojurebot | java.lang.Exception: Unable to find static field: abs in class java.lang.Math |
| 15:47 | fliebel | gfrlog: You can;t use a method like that |
| 15:47 | pjstadig | ,(map (memfn java.lang.Math/abs) (range -5 5)) |
| 15:47 | clojurebot | java.lang.IllegalArgumentException: No matching method found: abs for class java.lang.Integer |
| 15:47 | gfrlog | ,(map #(java.lang.Math/abs %) (range -5 5)) |
| 15:47 | clojurebot | (5 4 3 2 1 0 1 2 3 4) |
| 15:47 | pjstadig | oh right it's static |
| 15:47 | gfrlog | I won |
| 15:47 | tsdh | :-) |
| 15:47 | tsdh | Thank you. |
| 15:48 | pjstadig | meh |
| 15:48 | Raynes | To whom it may concern: amalloy and I have decided to call our 'team' something and created a Github organization for our shared projects. Alas, sexpbot and clojail have been moved. https://github.com/cognitivedissonance |
| 15:48 | fliebel | the later |
| 15:48 | fliebel | Raynes: cool |
| 15:48 | gfrlog | Raynes: I don't think cognitive is a verb, and I've certainly never heard of the word "issonance" |
| 15:49 | tsdh | Ok, next question. Is there something like partial, that returns a partial function where the *last* arg[s] are fixed? |
| 15:49 | Raynes | gfrlog: en.wikipedia.org/wiki/Cognitive_dissonance |
| 15:50 | amalloy | Raynes: pretty sure gfrlog is messing with you |
| 15:50 | gfrlog | Raynes: this makes me uncomfortable |
| 15:50 | fliebel | tsdh: Some evil mind constructed macroes for that kind of stuff, yes. |
| 15:50 | Raynes | amalloy: Subtle, but effective. I had no idea. |
| 15:50 | Raynes | I'm so ashamed. |
| 15:50 | gfrlog | I've never once said anything constructive |
| 15:50 | tsdh | That's basically a cosmetic question, but I think it's more intuitive do define my floating-point-= with args [x y tolerance] instead of having tolerance first. |
| 15:51 | fliebel | tsdh: Noo! Do it the other way around, that way you can compare multiple ars at once |
| 15:51 | amalloy | fliebel: why would you use a macro for this? |
| 15:51 | fliebel | amalloy: I don't know… What else is this fnutils thing doing? |
| 15:51 | pjstadig | you could do (def shortened #(tolerance %1 %2 x)) |
| 15:52 | pjstadig | or similarly (def shortened (fn [x y] (tolerance x y z))) |
| 15:52 | pjstadig | so forth |
| 15:52 | amalloy | (fn [f last-arg] (fn [& args] (apply f (concat args [last-arg])))) |
| 15:53 | fliebel | But isn't this much nicer? (floating-point-= tolerance x y & zs) |
| 15:53 | tsdh | Hm, I guess, you are right. |
| 15:55 | phenom_ | when creating a map, is it possible for one value to depending on the value of an eearlier entry at creation time? |
| 15:55 | amalloy | phenom_: you probably want to use reduce? |
| 15:56 | fliebel | More like iterate… *lingual meltdown* |
| 15:56 | phenom_ | {:key "key:val" :key2 (.split (get :key) ":")} |
| 15:57 | phenom_ | ^^ amalloy, something like that? |
| 15:57 | gfrlog | phenom_: certainly that right there is not allowed |
| 15:57 | phenom_ | :P |
| 15:57 | fliebel | $doc iterate |
| 15:57 | gfrlog | phenom_: it's hard to say anything other than "no" without knowing why you're trying to do that |
| 15:58 | amalloy | phenom_: absolutely not, in a "literal" map |
| 15:58 | Raynes | &(doc iterate) |
| 15:58 | sexpbot | ⟹ "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects" |
| 15:58 | Raynes | Fixed that for you. |
| 16:06 | tsdh | Oh my god, macros are evil! |
| 16:06 | gfrlog | heck yes |
| 16:06 | gigamonkey | tsdh: why? |
| 16:07 | gfrlog | it is never a good idea to solve a problem requiring a macro with a macro |
| 16:07 | scottj | surely there's a better way to have a collection that doesn't grow beyond a limit than this http://paste.lisp.org/display/120786 right? |
| 16:07 | tsdh | After adding my fp-= function and adding that as a param to a defcomparisontest (my macro) using (partial fp-= 0.000001), I got an error at file position 1 that PersistintList cannot be cast to Named. |
| 16:08 | tsdh | The reason for the error was that in the macro's expansion code, there was a (println "Comparing with" ~(name equality-fn))... |
| 16:09 | amalloy | tsdh: macros are not evil. they're power tools, to be used with caution |
| 16:09 | tsdh | That obviously works only for named functions, but the error is not really helpful. |
| 16:10 | tsdh | amalloy: Yes, sure. But they have a high potential to lead to obscure errors. |
| 16:10 | gigamonkey | tsdh: I'm not a Clojure expert but that seems like it would be true in non-macro code to. I.e. if you pass a function to something that expects a name, boom! |
| 16:10 | tsdh | ,(name #(let [a 1] a)) |
| 16:10 | clojurebot | java.lang.ClassCastException: sandbox$eval5580$fn__5581 cannot be cast to clojure.lang.Named |
| 16:10 | tsdh | See? |
| 16:10 | tsdh | ;-) |
| 16:11 | amalloy | gigamonkey: the issue is that it's harder to find an error when the macro *can't expand* as opposed to "expands into something wrong" |
| 16:11 | tsdh | amalloy: Yes, exactly. |
| 16:11 | amalloy | tsdh: that seems like a pretty helpful error message to me though |
| 16:12 | amalloy | "you tried to treat a [list|function] as a Named, and it isn't" |
| 16:12 | amalloy | ¿que problema es? |
| 16:12 | gigamonkey | amalloy: but macro expansion code is just code, right? It can even be debugged separately from its use in the macro. |
| 16:12 | tsdh | amalloy: When you had it at least once. So from now on I'll remember that errors in line 1 probably result from a macro erroring during expansion. |
| 16:12 | gigamonkey | (I'm assuming that's the case; rather, I'm assuming Clojure macros are more like Common Lisp's than Schemes.) |
| 16:13 | amalloy | gigamonkey: you're correct |
| 16:13 | amalloy | but in practice, largely due to lukewarm debugger support, it's harder |
| 16:13 | amalloy | tsdh: that's the wrong lesson to take away |
| 16:14 | amalloy | the right lesson (imo) is to look at the stacktrace. is there a macroexpansion in there somewhere? |
| 16:14 | amalloy | if so, the problem is with a maco expansion |
| 16:14 | tsdh | amalloy: There was no stack trace at all. |
| 16:14 | tsdh | And because of... |
| 16:14 | tsdh | ,(class #(let [a 1] a)) |
| 16:14 | clojurebot | sandbox$eval5584$fn__5585 |
| 16:15 | tsdh | I didn't think of an anonymous function being a persistent listp |
| 16:15 | amalloy | tsdh: what, of course there's a stacktrace. i get a stacktrace when i reproduce your broken code. what are you doing that causes no stacktrace to exist? |
| 16:15 | amalloy | tsdh: and anonymous functions *aren't* lists, but the macro isn't being passed a function; it's being passed a list! when the compiler, after expansion, evaluates that list, it will result in a function, but the macroexpansion phase doesn't know that |
| 16:16 | tsdh | Hm, you are right. lein test produces a stack trace, but slime doesn't in this case... |
| 16:17 | amalloy | tsdh: i'm using slime. have you done anything weird that would hide stack traces? |
| 16:17 | tsdh | amalloy: No, I usually get them. But not with that error and just C-c C-k to recompile the current file. |
| 16:19 | amalloy | ah |
| 16:19 | amalloy | good point |
| 16:20 | amalloy | technomancy: how hard would it be to fix that? you get a nice useful stacktrace if you C-c C-c the problematic form, but C-c C-k on the file just gives you the top-level message |
| 16:23 | amalloy | did github just go down? |
| 16:24 | TimMc | seems up for me |
| 16:24 | amalloy | hey, so it is |
| 16:24 | amalloy | for ~45s i was getting 500 errors |
| 16:24 | technomancy | I'm not sure; the C-c C-k compiler errors are pretty useless |
| 16:24 | technomancy | would love to see that improved |
| 16:25 | amalloy | technomancy: can you point me in the right direction? last time i tried to browse the swank-clojure repo (is that even the right one?) i crashed github :P |
| 16:25 | tsdh | amalloy: Oh, now I managed to handle sexpbot's mail. I swear to open new threads instead of changing subjects (which I did at least in conformance with the relevant RfC). |
| 16:26 | Raynes | You had trouble retrieving messages? |
| 16:26 | amalloy | Raynes: i think he means google groups, not sexpbot |
| 16:26 | tsdh | Raynes: amalloy's message was the first message I ever got. :-) |
| 16:26 | technomancy | amalloy: I'm pretty clueless when it comes to swank's internals =\ |
| 16:27 | amalloy | aw. okay |
| 16:27 | Raynes | I'll have to review that. |
| 16:27 | tsdh | Raynes: You should see my IRC log. It's full of /mail RET, /mymail RET. ;-) |
| 16:28 | Raynes | Yeah, I couldn't include the prefix in the docstring because prefixes are user-defined. The message should be clarified a bit. |
| 16:28 | tsdh | Raynes: Reminds me of "a novice's first session with mighty ed" at http://www.gnu.org/fun/jokes/ed.msg.html. |
| 16:29 | amalloy | Raynes: instead of "the mail command", what about "/msg me the message "mail" |
| 16:29 | Raynes | amalloy: That'll work. Editing now. |
| 16:31 | amalloy | tsdh: i see you were talking about both sexpbot and google groups. that'll teach me to forget whether i use $mail or google |
| 16:32 | tsdh | I use Gmane. |
| 16:32 | jhartman | http://clojure.org/ says clojure35 gives 35% off Joy of Clojure (print or ebook), but the coupon doesn't seem to work for the print edition. Anyone had any luck? |
| 16:32 | Raynes | $reload |
| 16:32 | sexpbot | Reloaded successfully. |
| 16:33 | amalloy | technomancy: is your swank-clojure repo at least the right repo to be forking? |
| 16:34 | technomancy | amalloy: it is |
| 16:34 | amalloy | thanks. i'll see if i can find something that looks relevant and kick it |
| 16:35 | technomancy | that'd be great |
| 16:38 | hiredman | f/win 14 |
| 16:43 | phenom_ | also guys, is there a mven repo with the latest clojure 1,3 build? or atleast the alpha 6 build? |
| 16:51 | fliebel | phenom_: yes… You should look at the default repos of lein or cake to know what they are though. |
| 16:52 | TimMc | Oh man my code is so slow... I need to look into type hinting, parallelism, and transients. |
| 16:52 | fliebel | TimMc: The alternative for doing stuff faster is doing less stuff ;) |
| 16:53 | TimMc | fliebel: I need to render about 30,000 triangles no matter what. |
| 16:54 | TimMc | *still need to |
| 16:54 | fliebel | TimMc: Well, why not squares? :P |
| 16:54 | TimMc | Actually, I should *first* look at using BufferedImage instead of using Graphics directly. |
| 16:54 | TimMc | fliebel: When all you have is a .tri file... |
| 16:55 | fliebel | TimMc: Everything looks like a hammer? But, yea, using graphics that do less work internally couts as doing less work, in my opinion. |
| 16:55 | leeda | Can anyone figure out what `w` is supposed to be here? (defmethod print-dup ObjectId [x w] (.write w (str "#=" `(object-id ~(.toString x))))) |
| 16:55 | amalloy | leeda: output stream |
| 16:56 | TimMc | fliebel: It looks fairly nice for a first go, though: http://i.imgur.com/1o0Ix.png |
| 16:56 | leeda | amalloy: Thanks. How do I make an output stream? |
| 16:56 | amalloy | leeda: you shouldn't need to |
| 16:56 | leeda | amalloy: (.. System out)? |
| 16:56 | leeda | amalloy: oh |
| 16:56 | amalloy | ie, you shouldn't have to call this directly |
| 16:56 | fliebel | TimMc: Awesome! Is that this weird thing called ray tracing? |
| 16:56 | leeda | amalloy: oh ok |
| 16:56 | TimMc | fliebel: Nope, this is directional flat shading. |
| 16:57 | amalloy | &(binding [*print-readably* true] (pr-str *ns*)) |
| 16:57 | sexpbot | ⟹ "#<Namespace sandbox18840>" |
| 16:57 | fliebel | TimMc: I'd have to google that... |
| 16:57 | amalloy | &(binding [*print-readably* true] (pr *ns*)) |
| 16:57 | sexpbot | ⟹ #<Namespace sandbox18840>nil |
| 16:57 | amalloy | gr |
| 16:57 | TimMc | fliebel: http://www.ccs.neu.edu/course/cs4300/HW4/HW4.html |
| 16:58 | amalloy | &(binding [*print-dup* true] (pr-str *ns*)) |
| 16:58 | sexpbot | ⟹ "#=(find-ns sandbox18840)" |
| 16:58 | amalloy | leeda: ^ |
| 16:58 | fliebel | lol @ "practice re-using code without copy and paste" |
| 16:59 | TimMc | Or just flat shading, I guess. Parallel light source, each triangle is shaded according to how close its normal vector is to the light vector. |
| 17:00 | leeda | amalloy: thanks |
| 17:01 | amalloy | leeda: heh, thank you! i hadn't thought about using ` to write the print-dup function call |
| 17:01 | TimMc | Yeah, that was new to me too. |
| 17:02 | TimMc | fliebel: Flat shading is the third part. |
| 17:02 | leeda | heh, it's from here: https://github.com/somnium/congomongo/blob/master/src/somnium/congomongo.clj |
| 17:02 | fliebel | TimMc: I'm reading it :) |
| 17:06 | fliebel | TimMc: So this is computer science? What year? What university? |
| 17:11 | fliebel | TimMc: Wait, they allow you to write Clojure? |
| 17:13 | amalloy | fliebel: since TimMc appears to be afk: he gets to pick a language. i don't know TimMc personally but a friend of mine who goes to his school thought TimMc had graduated already so he's probably ~senior |
| 17:13 | TimMc | just came back |
| 17:13 | TimMc | amalloy: Correct. |
| 17:13 | TimMc | fliebel: Northeastern University. The prof said we can pick our implementation language. |
| 17:14 | TimMc | I'm using it for two different classes this year. |
| 17:14 | brehaut | TimMc, and you didnt choose befunge?! |
| 17:14 | TimMc | I wanted to complete the assignment! |
| 17:14 | brehaut | hah |
| 17:15 | TimMc | The other prof has expressly forbidden LOLCODE, incidentally. |
| 17:15 | fliebel | TimMc: But… You have already graduated? So… huh? I mean, I would understand if you did this stuff forfun… and I admit I don;t understand this bechlor master system all to well. |
| 17:15 | TimMc | No, senior. |
| 17:15 | brehaut | TimMc: i wonder if this is from the same department as the aftermarket stickers on the coffee grinders at my uni that said 'do not put your hand in the grinder!' |
| 17:16 | fliebel | *google senior* |
| 17:16 | amalloy | fliebel: highest undergraduate year |
| 17:16 | fliebel | ah! ( http://en.wikipedia.org/wiki/Senior_(education) ) |
| 17:16 | TimMc | fliebel: I've transferred schools several times, so I'm old for a senior. |
| 17:17 | TimMc | I'll be getting my bachelor's degree in May. A master's degree is an additional couple years of education focused on one subject. |
| 17:18 | fliebel | TimMc: Can you write compilers and stuff without doing the master stuff? |
| 17:18 | TimMc | yeah |
| 17:19 | amalloy | fliebel: compilers are roughly senior-level stuff |
| 17:19 | TimMc | amalloy: Metacircular evaluators, on the other hand, were taught to the honors freshmen. :-) |
| 17:20 | brehaut | fliebel: my university had us write a simple computer and bytecode interpreter as a second year project as part of (not the whole of) one course |
| 17:20 | TimMc | fliebel: The course I'm taking has a bunch of sophomores and juniors in it. |
| 17:20 | amalloy | fliebel: it all depends on how complicated a language you want to deal with |
| 17:20 | amalloy | a lisp compiler can be written with little effort; a java compiler, not so much |
| 17:20 | TimMc | Because of transferring, I'm taking required courses in a semi-random order. |
| 17:20 | fliebel | amalloy: One that can compile itself :) |
| 17:20 | brehaut | fliebel: a basic compiler for an imperative language can be done with 1 pass and a recursive decent parser |
| 17:21 | brehaut | fliebel: original c fits that description btw |
| 17:21 | amalloy | brehaut: original? |
| 17:21 | fliebel | TimMc: That'd be my style, minus the required and the transfering. |
| 17:22 | brehaut | amalloy: i dont know if c + standardisations and small extensions is still one pass |
| 17:22 | fliebel | Well, you know, once you have macroes, everything is just layers of macroes to assemly :) |
| 17:22 | TimMc | amalloy: I thought I was going to be done last year, so I told people I was a senior then. -.- |
| 17:22 | hiredman | also depends what your target is, generating asm vs. generating bytecode vs. some other language |
| 17:23 | amalloy | brehaut: i'm uncertain that a single "original" c exists. ansi and k&r both sorta fit the bill |
| 17:23 | amalloy | and something probably existed before that |
| 17:23 | brehaut | amalloy: k+r then :P its pre-coffee time down here |
| 17:23 | hiredman | compilers and interpreters are about bridging the grap between source and target, if there is little gap then the compiler is very simple |
| 17:24 | amalloy | (def lisp-compiler identity) |
| 17:25 | brehaut | amalloy: that holds for any language |
| 17:26 | fliebel | brehaut: nope, Python: SyntaxError: invalid syntax |
| 17:26 | amalloy | which, that something existed first? of course, but i meant "something that was publicly available and used" |
| 17:27 | brehaut | amalloy: i mean its obviously the identity function compile and anything from a compiled representation to that same representation |
| 17:27 | amalloy | brehaut: hm. no offense, but that's barely a sentence. go back to your coffee? |
| 17:28 | brehaut | wow you are right |
| 17:28 | brehaut | bbs |
| 17:28 | fliebel | It's post bed-time here, so don;t expect anything useful out of me either. |
| 17:38 | brehaut | fliebel: probably the simplest way you could get started writing a compiler is to write an interpreter first; you build up a tree of things (eg, expressions, different statements, functions etc) that know how to execute themselves (largely by executing their children). Once you have the that you tell the top level one (such as the main function) to execute it self |
| 17:40 | hiredman | which you can do very simply using protocols or multimethods |
| 17:47 | fliebel | brehaut(gone), hiredman: Thanks. |
| 17:48 | fliebel | With explanations like this, I really wonder if I would find cs very easy, very hard, both or just interesting. |
| 17:49 | brehaut | perhaps all of the above? |
| 17:49 | hiredman | I have no idea how this stuff is taught in a cs curriculum |
| 17:52 | amalloy | http://www.cs.ucsb.edu/~chris/teaching/cs160/lectures.html is fairly complete-looking slides and project listings for a compilers class |
| 17:52 | brehaut | fliebel: the value i got from a formal CS education is that i was made to learn about things i would have (for one reason or another) avoided if it was optional |
| 17:53 | brehaut | fliebel: another obvious candidate is to get the lecture videos and and inline copy of SICP; theres big sections on program evaluation |
| 17:54 | hiredman | the emphasis on parsing is just a huge *bleh* |
| 17:54 | opqdonut | agreed |
| 17:54 | opqdonut | intermediate representations and optimizations are the interesting part |
| 17:55 | opqdonut | and it's easy to play with them, just take a parser generator and llvm |
| 17:55 | brehaut | hiredman: i want to agree, but so many people seem to have CS degrees and think parsing is something that you need to be a rocket surgeon to do. |
| 17:55 | hiredman | brehaut: complete opposite |
| 17:55 | brehaut | hiredman: exactly! |
| 17:56 | hiredman | it is so boring and tedious |
| 17:58 | hiredman | which is why lisp is perfect for teaching this stuff, the parser is dead simple |
| 17:58 | brehaut | (defmulti myparser first) ? |
| 17:59 | hiredman | the problem is the myth that since code is data lisp code "is the ast" |
| 17:59 | opqdonut | indeed |
| 17:59 | fliebel | hiredman: It's pretty close though, no? |
| 18:00 | hiredman | it depends on the transforms you want to perform, and what kind of data you need to drive those |
| 18:01 | fliebel | brehaut: re videos: I'd miss another major reason to do university: peers. |
| 18:01 | hiredman | clojure's compiler is very simple, depends on hotspot for optimising |
| 18:01 | hiredman | so clojure doesn't really have an ast step between the code and bytecode |
| 18:02 | JohnShaft | Hi. Newbie question here. I am trying to install clojure within emacs. I have swank-clojure and slime installed. When I try to run slime it asks me if I want to download clojure and it complains that it cannot download the clojure jar files. Tried on Mac and PC same deal. Any help would be greatly appreciated |
| 18:03 | hiredman | JohnShaft: generally you'll want to use the clojure from the project you are working on |
| 18:03 | hiredman | and the way you start swank-clojure for a project depends on the build tool it uses |
| 18:04 | fliebel | Well, thanks for all the university/compiler discussion. |
| 18:05 | hiredman | clojurebot: lein |
| 18:05 | clojurebot | lein is http://github.com/technomancy/leiningen |
| 18:05 | hiredman | JohnShaft: ^- |
| 18:06 | sdeobald | Hey dudes. Is anyone awake who can speak to the present utility of ClojureScript? |
| 18:06 | JohnShaft | Hiredman: Thanks. I think I am in a bit over my head. I am new to Emacs and Clojure so not really sure what a clojure project consist of ( or even how to make one ). I have been trying to follow some of the online tutorials which claim it is easy to install clojure via slime. But looks like maybe the repo the script is looking for is outdated? |
| 18:07 | hiredman | JohnShaft: never do anything a blog post tells you |
| 18:07 | hiredman | I have yet to see one that wasn't outdated |
| 18:07 | hiredman | e.g. they are all from over a year ago |
| 18:07 | hiredman | JohnShaft: you may just downloaded swank clojure and run it yourself, then use slime-connect to connect to it |
| 18:08 | phenom_ | anyone know of a pure clojure mongodb driver ? |
| 18:08 | hiredman | whatever you do I recommend against using the clojure installed by slime or whatever |
| 18:08 | JohnShaft | Hiredman: Ok, thanks for the tips. Looks like I have some more reading up to do. I will also check out leiningen |
| 18:09 | lancepantz | JohnShaft: do you have ruby installed? |
| 18:09 | JohnShaft | lancepantz: No I do not |
| 18:09 | lancepantz | k, nevermind then |
| 18:09 | dakrone | sdeobald: are you just trying to convert clojure to javascript, or trying to use ClojureScript in particular? |
| 18:10 | sdeobald | dakrone: the first one, if it's at all suitable to the task. |
| 18:10 | sdeobald | ...which I can't really glean from github. |
| 18:11 | dakrone | sdeobald: I would recommend checking out https://github.com/zkim/cljs |
| 18:12 | dakrone | (check out the demo, it's pretty neat) |
| 18:12 | sdeobald | dakrone, thanks. Have you ever used this in a production app? |
| 18:13 | dakrone | sdeobald: no, but the author is a friend of mine, he's very responsive if you have feature requests or bug reports |
| 18:13 | raek | JohnShaft: the swank-clojure readme contains most of what you need to know https://github.com/technomancy/swank-clojure |
| 18:13 | sdeobald | dakrone: Cool. Is he doing work with it? Or is it just a toy project for now? |
| 18:14 | dakrone | sdeobald: he does work with it |
| 18:14 | sdeobald | Badass. |
| 18:15 | technomancy | swank's been 1.3.0-SNAPSHOT for ages... should probably cut a stable |
| 18:18 | lancepantz | technomancy: +1 |
| 18:33 | raek | hrm. I recall having problems with exceptions and that version, but now I am unable to reproduce it |
| 18:33 | raek | (inc technomancy) |
| 18:34 | technomancy | raek: there were some rough spots with a 1.3 fix breaking 1.2-compat and vice versa |
| 18:59 | foxupa | hi, I've noticed that the clojure function contains? doesn't work with lists |
| 18:59 | foxupa | which is confusing as I thought a list was a collection |
| 18:59 | technomancy | clojurebot: contains? |
| 18:59 | clojurebot | contains? is for checking whether a collection has a value for a given key. If you want to find out whether a value exists in a Collection (in linear time!), use the java method .contains |
| 18:59 | technomancy | foxupa: probably the #1 faq about clojure |
| 19:00 | technomancy | it's unnecessarily confusing =( |
| 19:01 | foxupa | well it makes sense that a map is like a function taking keys to values, and a set is a function testing membership, but how does "vector" fit in that explaination? |
| 19:01 | technomancy | vectors are functions of their indices |
| 19:02 | technomancy | ,(contains? [:a :b :c] 2) |
| 19:02 | clojurebot | true |
| 19:02 | foxupa | ok... i guess it makes sense now, though I have to say the following is a very easy way for a clojure programmer to slip up: |
| 19:02 | foxupa | (contains? [4 5 6] 2) = true |
| 19:03 | foxupa | i guess it just seems very counterintuitive to have labeled it contains? rather than contains-key? |
| 19:03 | technomancy | yes, contains? should have been called contains-key?. |
| 19:03 | foxupa | exactly, lol |
| 19:03 | hiredman | why wouldn't a clojure programmer know what contains? from core.clj does? |
| 19:03 | pdk | ,(type 9.0) |
| 19:03 | clojurebot | java.lang.Double |
| 19:03 | hiredman | most likely it would be a way for a non-clojure programmer to slip up |
| 19:03 | technomancy | foxupa: everyone makes mistakes, even language designers. |
| 19:04 | foxupa | yeah, is there a webpage listing any of these other common points of confusion? |
| 19:04 | technomancy | well 90% of the other top questions are about slime |
| 19:04 | technomancy | so I guess the swank-clojure readme? =) |
| 19:05 | Lulu58e2 | lol |
| 19:05 | technomancy | probably the other most common misunderstanding is about transients; you can read about that here: http://technomancy.us/132 |
| 19:05 | foxupa | yeah I never figured out how to get slime + clojure to work together, so I just use CCW w/ eclipse and use the Emacs keybindings plugin for eclipse |
| 19:06 | technomancy | (or just ignore transients since you don't need them.) |
| 19:08 | Lulu58e2 | Very alliterative |
| 19:24 | TimMc | technomancy: Oh hey, I never knew about the "performance characteristics" aspect of persistent data structures. |
| 19:28 | TimMc | technomancy: And Wikipedia still hasn't. |
| 19:29 | technomancy | I'm not entirely sure Rich didn't make it up. |
| 19:30 | technomancy | but it seems a bit disingenuous to have persistent data structures whose perf degrades over time. |
| 19:37 | amalloy | technomancy: degrades over time? is there a link i'm missing? |
| 19:37 | amalloy | oh, the thing about transients above. sorry, didn't connect the dots |
| 19:38 | hiredman | possibly not in the context of persistent datastructures, but they could have been presented as "mutable datastructures that allow you to access old versions" |
| 19:39 | hiredman | then the disingenuous bit is a feature |
| 19:39 | amalloy | hah |
| 19:41 | foxupa | does anyone have any recommendations for a clojure program or library that can render directed graphs? |
| 19:42 | brehaut | foxupa: have a look for loom |
| 19:43 | brehaut | foxupa: https://github.com/jkk/loom |
| 20:57 | foxupa | hi all, I was wondering if there is some way to get clojure.contrib.shell-out's sh function to spin off a new process |
| 20:57 | foxupa | I tired passing in "&" as my last argument but that didn't work |
| 21:01 | amalloy | foxupa: clojure.java.shell |
| 21:01 | amalloy | i mean, i think it does start a new process but may immediately join() it |
| 21:02 | foxupa | (clojure.java.shell/sh "gedit" "&") just starts up a gedit session for a file called & |
| 21:03 | foxupa | it says it starts a new sub-process |
| 21:03 | amalloy | foxupa: & is part of bash's syntax |
| 21:03 | foxupa | ah |
| 21:03 | amalloy | c.j.sh just does an exec of the first arg and passes the rest |
| 21:03 | foxupa | is there some standard way to do it invariant of the specific shell syntax? |
| 21:03 | amalloy | you can do "bash" "-c" "gedit" "&" or similar |
| 21:04 | amalloy | i have an example of this somewhere in sexpbot, one sec while i find it |
| 21:05 | amalloy | https://github.com/cognitivedissonance/sexpbot/blob/master/src/sexpbot/plugins/utils.clj#L195 |
| 21:07 | devn | I think my eyes are going |
| 21:07 | devn | I need like 14-16pt font to feel comfortable anymore |
| 21:07 | __name__ | Do you have glasses? |
| 21:07 | devn | yes |
| 21:08 | devn | I'm far-sighted |
| 21:08 | __name__ | Could it be that they do not correct your vision anymore? |
| 21:08 | devn | Nah, just had a checkup |
| 21:08 | devn | I just feel like I don't have the same ability to grep the screen that I used to |
| 21:09 | amalloy | devn: you are probably still better off than i. uncorrectable vision problems lead me to use 1280x960 on my 27" |
| 21:10 | devn | im 20/200 uncorrected |
| 21:10 | devn | lazy eye |
| 21:10 | amalloy | and corrected? |
| 21:10 | devn | 20/80 i believe |
| 21:10 | devn | that's an old number so not sure how accurate it is |
| 21:10 | amalloy | fair enough. that's close to me, last i checked (also long ago) |
| 21:11 | devn | amalloy: *shrug* i wouldn't complain about my vision |
| 21:11 | devn | lazy eyes are kind of cool -- lots of famous artists with them, jean-paul sartre, etc. :) |
| 21:22 | devn | amalloy: do you ever pair with anyone? |
| 21:25 | amalloy | devn: there aren't a lot of people nearby who like to pair. one coworker does though, and we use my computer |
| 21:28 | TimMc | We were forced to pair-program in Fundies class. :-) |
| 21:29 | TimMc | At least one prof was pretty good about matching people up by skill level so that the pairs were balanced, which is pretty important. |
| 21:35 | amalloy | srsly |
| 21:40 | TimMc | It was much less fun being paired randomly -- for both people. :-( |
| 21:44 | no_mind | I am looking for some use cases on clojure protocols. I cant figure out under what conditions I should go for a protocol/defrecord instead of a map ? |
| 21:50 | phenom_ | so who's used yourkit's profiler before ? |
| 21:52 | phenom_ | no_mind: you want a protocol went you went to define a set of methods that logically should be grouped together, ideally to work over an abstract data strcture or logical application/domain model |
| 21:52 | phenom_ | *when you want |
| 21:52 | devn | amalloy: if you want to pair id like to find some people to remote with |
| 21:52 | devn | i dont have anyone in my area to code with and i think pairing is the best way to learn more no matter your skill level |
| 21:53 | devn | osmosis is awfully effective |
| 21:56 | devn | amalloy: PM me if that's something you'd be interested in -- i need to take off now but if you feel like getting together on the internet to hack on something fun im interested |
| 21:56 | devn | ciao |
| 22:10 | amalloy | no_mind: or when you would like to use multimethods but performance is a huge issue |
| 22:10 | TimMc | technomancy: Have you used your collaborative editing Emacs plugin for pair programming? |
| 22:33 | TimMc | ,whoami |
| 22:33 | clojurebot | java.lang.Exception: Unable to resolve symbol: whoami in this context |
| 22:33 | TimMc | and ##(whichisthis) |
| 22:33 | sexpbot | java.lang.Exception: Unable to resolve symbol: whichisthis in this context |
| 22:33 | TimMc | OK, got it. |
| 22:33 | amalloy | &alsothis |
| 22:33 | sexpbot | java.lang.Exception: Unable to resolve symbol: alsothis in this context |
| 22:34 | TimMc | ,(#(% %) #(% %)) ##(#(% %) #(% %)) It's a proper botrace this time! |
| 22:34 | sexpbot | java.lang.StackOverflowError |
| 22:34 | clojurebot | java.lang.StackOverflowError |
| 22:34 | TimMc | Oh man, too close to call. |
| 22:34 | amalloy | har har |
| 22:37 | scottj | if you have (def a '(1 2 3)) and then run (def a (take 2 a)) does the 3 part get GCed or is it held bc take is lazy? if I'd done(def a (doall (take 2 a))) would it have been gced? |
| 22:39 | amalloy | scottj: i don't think it can get GCed |
| 22:39 | amalloy | i think doall would make it happen |
| 22:42 | scottj | ok, I'm wondering if there's a better way to do a collection that doesn't grow beyond a certain size than using vectors since i don't need random access. currently with vectors I have this http://paste.lisp.org/display/120786 but there must be a simpler way |
| 22:46 | amalloy | scottj: i'm not clear on the point. it couldn't be lazy anyway |
| 22:47 | amalloy | so you might as well just make it either a vector or a list |
| 22:48 | amalloy | apply subvec and/or take as needed |
| 22:49 | amalloy | but if you wanted to "do it up right" you could do a lot worse than steal from ken wesson's Bag deftype on the mailing list |
| 22:50 | scottj | what's a bag? |
| 22:50 | amalloy | unordered list, or a set with duplicates, depending how you think of it |
| 22:51 | scottj | something would have to be added right to track how old the items are so you could remove the oldest item in the bag when something new is added right? |
| 22:52 | amalloy | uhh, only if you wanted LRU behavior |
| 22:52 | amalloy | but my point wasn't that you should use Bag |
| 22:52 | amalloy | use his code as an example to define your own typew |
| 22:52 | clojurebot | code-review is <rhickey> yikes |
| 22:55 | no_mind | I have a requirement where user can define a record type/entity (not necessarily clojure defrecord) and add attributes to the record. Then the system should autogenerate the CRUD forms for the record. What will be the most suitable data type to represent a record type/entity ? |
| 23:00 | amalloy | no_mind: something wrong with a hash-map? |
| 23:03 | technomancy | TimMc: we've found it to be less hassle to pair over SSH with tmux |
| 23:03 | technomancy | no_mind: stick with regular maps as long as you can; they're least-hassle |
| 23:12 | no_mind | amalloy, nothing wrong or right here, just wanted to have oinion of more experienced clojure devs |
| 23:52 | technomancy | leiningen 1.5.0: http://j.mp/lein-news |