2011-03-08
| 00:00 | tomoj | amalloy: maybe some history at work? |
| 00:00 | tomoj | [bindings then else & oldform] |
| 00:01 | amalloy | oh right, that dang oldform thing. i remember seeing that when i first looked up what if-let did |
| 00:01 | tomoj | what was the old way, I wonder? |
| 00:02 | amalloy | tomoj: (if-let a b x y), i'd guess? |
| 00:04 | amalloy | interestingly if-let doesn't mirror if by allowing only a then clause - you have to use when-let if you don't want an else |
| 00:05 | tomoj | eh? ##(if-let [a nil] 1) |
| 00:05 | sexpbot | ⟹ nil |
| 00:05 | amalloy | huh |
| 00:05 | amalloy | oh, i had scrolled past that part of the code without ever noticing it existed |
| 05:06 | clgv | Don't know how to create ISeq from: clojure.lang.PersistentVector$TransientVector - is that supposed to mean that I can only use transients for creating the collection and need to make it persistent before I can read from it? |
| 05:33 | raek | clgv: you generally only have a transient version of the collection temporarily when you create it or modify it. as soon as you are done with the changes, you should make a persistent version of it again |
| 05:34 | raek | an ISeq from a TransientVector sounds weird, since that would imply that you get an immutable, lazy, sequential view over something mutable |
| 05:35 | raek | clgv: you should be able to use nth other functions that works on datastructures rather than seqs to read from it though |
| 06:09 | clgv | ok thanks. I had that transient in a "local scope"in my concept but I noticed I still would have to read from it |
| 06:10 | clgv | but considering the whole scenario, I "seldom" add components to the transient. "seldom" is meant with respect to measured runtime. |
| 06:10 | clgv | so I think I will use a normal vector there |
| 06:11 | clgv | so any possible benefit from a transient in that concrete case is questionable |
| 08:15 | timvisher | hey all |
| 08:15 | timvisher | anyone feel like helping me understand why the following square-root definition is giving me a no method found exception? |
| 08:16 | timvisher | https://gist.github.com/860251 |
| 08:16 | timvisher | I'm working my way through SICP and I was surprised that Ratio wouldn't be automatically handled when I pass it to Math/abs |
| 08:16 | timvisher | I thought numbers were 'automagical' in Clojure |
| 08:18 | AWizzArd | timvisher: The function Math/abs only accepts primitives and not a clojure.lang.Ratio. |
| 08:19 | AWizzArd | Clojure can not translate from this class to a primitive type automatically. |
| 08:19 | AWizzArd | ,(Math/abs (double -1/3)) |
| 08:19 | clojurebot | 0.3333333333333333 |
| 08:20 | timvisher | (ah |
| 08:20 | timvisher | lol- |
| 08:20 | timvisher | not sure why I appended a ( to that |
| 08:20 | timvisher | I'm on 1.2 for clojure and clojure-contrib |
| 08:21 | timvisher | Is clojure.contrib.math available in 1.2? |
| 08:23 | AWizzArd | timvisher: I don't have 1.2 available here right now, but you could find out yourself by trying to require this lib. |
| 08:30 | timvisher | AWizzArd: that's what I tried. Thanks for your help! |
| 08:31 | clgv | timvisher: yes it is |
| 08:32 | clgv | ,(clojure-version) |
| 08:32 | clojurebot | "1.2.0" |
| 08:32 | clgv | clojurebot uses 1.2.0 himself ;) |
| 08:36 | timvisher | clgv: thanks! |
| 08:36 | timvisher | bye all |
| 08:38 | clgv | &(clojure-version) |
| 08:38 | sexpbot | ⟹ "1.2.0" |
| 08:38 | clgv | ah sexpbot uses 1.2.0 too^^ |
| 08:47 | __name__ | &(. Runtime getRunTime) |
| 08:47 | sexpbot | java.lang.NoSuchFieldException: getRunTime |
| 08:47 | __name__ | &(. Runtime getRuntime) |
| 08:47 | sexpbot | ⟹ #<Runtime java.lang.Runtime@19f20e5> |
| 08:47 | __name__ | &(. Runtime getRuntime availableProcessors) |
| 08:47 | sexpbot | java.lang.Exception: Unable to resolve symbol: availableProcessors in this context |
| 08:47 | __name__ | &(.. Runtime getRuntime availableProcessors) |
| 08:47 | sexpbot | ⟹ 4 |
| 08:48 | clgv | lol spying on sexpbots hardware ;) |
| 08:48 | __name__ | The bot in #scala blatantly lies on that matter. |
| 08:48 | clgv | but thanks for the processors hint. I could use that toorganize the chunks for one of my pmaps |
| 08:48 | clgv | what does it say? |
| 08:48 | cemerick | Note that .availableProcessors reports *cores*, not CPUs |
| 08:49 | clgv | cemerick: thats fine. it doesnt even have to mean real cores since it could be the hyperthreading part as well |
| 08:53 | raek | clgv: pmap already uses that to organize itself. https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L5878 |
| 08:55 | clgv | raek: but I have to build bigger chunks since otherwise the scheduler overhead will slow me down like described in several blog posts |
| 08:55 | __name__ | clgv: [14:54] <scalabot> Int = 1337 |
| 08:55 | clgv | and I can use the processors count as indication which decomposition makes sense |
| 08:56 | cemerick | clgv: how you build those chunks has far more to do with your dataset and the operations you're performing than the number of CPUs |
| 08:57 | clgv | if I have a list to execute a function on, I could simply split it into processorcount many parts to avoid scheduling overhead. dont you think? |
| 08:57 | bartj | how can I pick the key which has the maximum value in a hash-map? |
| 08:57 | bartj | without first sorting the values, picking the maximum |
| 08:58 | bartj | and then iterating through the map to check if the key is mapped to the maximum value! |
| 08:58 | cemerick | bartj: see max-key |
| 08:58 | bartj | is there a function which already does this? |
| 08:58 | bartj | cemerick, you type fast :) |
| 08:59 | cemerick | clgv: the point is to ensure that the work being done per chunk is greater than the parallelization overhead. The only way to find out what your chunk size should be is to test various chunk sizes using real data. |
| 09:00 | clgv | I definitely know how much data I have. it's N² with N depending on the problem |
| 09:00 | clgv | instance |
| 09:04 | clgv | is there an idiomatic abbreviation to create chunks? |
| 09:05 | clgv | something like (create-chunk size seq)? |
| 09:22 | choffstein | Hey all. I have a quick question. I am new to lisp and am trying to get clojure / conjure / Aquamacs / swank / slime all playing together nicely. I am using leiningan to launch a swank server and can connect from Aquamacs (slime-connect). I can even compile and execute my conjure server ... but once it runs, none of my code changes and executions (C-c C-c) seem to change the behavior of my web-server. Am I missing something |
| 09:24 | choffstein | I am making sure that run-jetty doesn't join ... but that doesn't seem to be the issue. |
| 09:24 | choffstein | *compojure, not conjure |
| 09:24 | dnolen | choffstein: what do your run-jetty line look like? |
| 09:24 | choffstein | dnolen: (run-jetty webservice {:port 8080 :join? false}) |
| 09:25 | dnolen | try replacing webservice with #'webservice. |
| 09:26 | dnolen | choffstein: compojure uses ring which also has a reload handler for development which recompiles namespaces on page load. |
| 09:26 | choffstein | oh really? didn't know that. thanks ... that may be very useful |
| 09:27 | yazirian | choffstein: this may also help https://github.com/mmcgrana/ring/wiki/Interactive-Development |
| 09:27 | yazirian | the magic part is the var |
| 09:27 | yazirian | so i guess i just said the same thing heh |
| 09:28 | yazirian | but that link also was really helpful to me figuring out how not to lose my repl to jetty :) |
| 09:31 | choffstein | thanks yazirian, i'll check it out |
| 09:35 | angerman | has anyone toyed with Catmull Clark subdivision? I'm having an issue with the weights. |
| 09:36 | angerman | Clojure+JReality (movie): http://t.co/nIoMXBr |
| 09:36 | angerman | The problem I'm having is that the first iteration is not convex and looks quite /strange/ so to say. |
| 09:38 | angerman | The weights are as far as I understand (n-3)/n, 2/n and 1/n. Thus the position of the old vertex has no impact on the new postition of the vertex if the vertex's valence is 3, and therfore the weight is (3-3)/3 = 0. |
| 09:38 | choffstein | Huzzah! It works! |
| 09:38 | choffstein | Thanks for the help guys. |
| 09:39 | choffstein | Now to just become a power Emacs user ... that should be easy, right ;) |
| 09:40 | angerman | choffstein: of course, emacs is a piece of cake :) |
| 09:42 | yazirian | oh absolutely, especially with paredit mode... i definitely didn't spend about three days wanting to punch my monitor directly in the parentheses, no sir! (...i got better) |
| 09:45 | danlarkin | gross names but so useful :) |
| 09:45 | jkdufair | yazirian: good luck! |
| 10:03 | lostern | What should I be using to debug java with emacs? GUD? jdibug? |
| 10:11 | raek | choffstein: my emacs workflow when developing with ring: http://groups.google.com/group/clojure/browse_thread/thread/4d8a1fc669a5a2df/5e754ed31361c09d?lnk=gst&q=better+work+flow#5e754ed31361c09d |
| 10:12 | choffstein | awesome! thanks |
| 10:28 | klang | raek: are you doing any testing of the web applications you develop? |
| 10:30 | raek | well, I should have done more... :-) |
| 10:30 | raek | but I have done unit tests for some middleware |
| 10:32 | klang | raek: shouldn't we all. A few months ago I was adding tests for some of the examples in abedra/clojure-web, but got sidetracked on the more complicated examples (making tests with concern for sessions were harder than a few euler problems .. :-) |
| 10:33 | klang | .but now I want to finish that work, and I am surveying the state of web-development in clojure .. |
| 10:35 | klang | .. nobody is making tests for web-applications it seems .. ring.mock is the closest I have found until now .. |
| 10:36 | raek | tests for middleware should be fairly simple if the middleware is free of side-effects |
| 10:37 | klang | true, and maybe it's a wild goose chase to make end-to-end clicking-through-the-application tests .. but it will give me some exercise .. |
| 12:29 | waxrose | Greetings all. |
| 12:29 | TimMc | ey |
| 12:30 | waxrose | TimMc, Howdy partner. :D |
| 12:30 | TimMc | I'm hoping to convince my Comp Arch prof to let me use Clojure for the semester project, |
| 12:30 | TimMc | which is an instructor set simulator for MIPS. |
| 12:30 | waxrose | ehh |
| 12:31 | waxrose | GL, hopefully he's not arrogant and open to new ideas. |
| 12:31 | TimMc | I think it'll actually be really easy, and as a bonus, I can make it reversible with hardly any extra work. |
| 12:31 | waxrose | What option would you have to do if you were not able to? |
| 12:32 | TimMc | He's a grad student, and quite a good professor. I think the limiting factor here would be whether he feels like trying to read Clojure. |
| 12:32 | TimMc | The "supported" languages are Java and C++. |
| 12:32 | waxrose | defacto |
| 12:33 | waxrose | But at least technically in some way Clojure is near that domain, so you might get away with it. |
| 12:33 | TimMc | So I'm going to write a tiny prototype and see what he thinks. He's open to different languages, and has set a deadline of March 17 for approval. |
| 12:33 | TimMc | Oh, and he has explicitly forbidden LOLCODE already. :-P |
| 12:34 | waxrose | Oh, that's coming soon. >.< |
| 12:34 | waxrose | lol |
| 12:34 | waxrose | LOLCODE haha |
| 12:35 | waxrose | What are the actual requirements of the project? |
| 12:35 | waxrose | Just any simple application? |
| 12:36 | TimMc | waxrose: https://myfiles.neu.edu/mccormack.t/EECE3230-project.pdf |
| 12:37 | waxrose | :P |
| 12:39 | waxrose | wow, this looks awesome. If only my classes actually had some "difficulty" put into them |
| 12:39 | angerman | I have a set of lists representing faces of a mesh (a b c d e). Now i'd like to find the two faces which share an edge, say, (e a). How would I go about that? |
| 12:40 | angerman | hmm. ok. maybe cycle, rest, interleave, partition. |
| 12:40 | TimMc | angerman: You have a collection of triangles (each represented as a list of vertices) and want to find adjacencies? |
| 12:41 | TimMc | I assume they're all CCW? |
| 12:41 | angerman | TimMc: kind of. not necessarily triangles though. |
| 12:41 | TimMc | OK |
| 12:41 | waxrose | TimMc, I think you could get approved, especially since he already stated he's open to the possibility. I'm sure he only wants to make sure that you can actually provide a sufficient application to meet the requirements, regardless of the language. |
| 12:41 | angerman | well, yes. the faces should be oriented consistently |
| 12:42 | angerman | ,(partition 2 (interleave '(a b c d e) (rest (cycle '(a b c d e)))) |
| 12:42 | clojurebot | EOF while reading |
| 12:42 | angerman | ,(partition 2 (interleave '(a b c d e) (rest (cycle '(a b c d e))))) |
| 12:42 | clojurebot | ((a b) (b c) (c d) (d e) (e a)) |
| 12:43 | TimMc | Oh, I see -- you know two vertices and want to find the faces for it. |
| 12:43 | angerman | I know the edge. |
| 12:44 | joshua__ | That project is awesome. |
| 12:44 | angerman | ,(some #{'(e a)} (partition 2 (interleave '(a b c d e) (rest (cycle '(a b c d e)))))) |
| 12:44 | clojurebot | (e a) |
| 12:44 | TimMc | It's a decent project, even though it's not a new application. |
| 12:45 | TimMc | I'm hoping to abstract out the logic pipeline manager, though. That could be new! |
| 12:45 | angerman | that feels a little a little heavy :/ |
| 12:45 | angerman | TimMc: what Project? |
| 12:45 | TimMc | angerman: https://myfiles.neu.edu/mccormack.t/EECE3230-project.pdf |
| 12:46 | waxrose | Yeah, I've never done that before. Sounds like fun though. I may use your project and work on it on my own. :D |
| 12:47 | TimMc | I'm writing it as a collection of logic blocks and registers. Each block has dependencies on registers, a main function that processes those values, and a set of output functions that take the result of the core function to make results that can be put back in registers. |
| 12:48 | TimMc | Crap, I just remembered that there won't be a register between each consecutive set of blocks... need to rework this a bit. :-) |
| 12:49 | TimMc | angerman: So you just want to see if '(x y) is in (cycle '(a b c d e))? |
| 12:49 | angerman | yep |
| 12:49 | angerman | the approach I picked above is, well … it feels like it a lot of plumbing. |
| 12:50 | TimMc | partition has a way of getting overlapping chunks |
| 12:50 | TimMc | ,(partition 2 1 '(a b c d)) |
| 12:50 | angerman | TimMc: I'd still need to interleave it. |
| 12:50 | clojurebot | ((a b) (b c) (c d)) |
| 12:50 | angerman | ohh, nice. |
| 12:51 | TimMc | And then tack on the missing wrap-around. |
| 12:51 | angerman | hmm. still need one more element. |
| 12:51 | TimMc | ,(partition 2 1 ['a] '(a b c d)) |
| 12:51 | clojurebot | ((a b) (b c) (c d) (d a)) |
| 12:51 | TimMc | So, (partition 2 1 (first verts) verts) |
| 12:52 | angerman | yep |
| 12:52 | TimMc | Err, wrap (first verts) in a list. |
| 12:53 | amalloy | partition-all? |
| 12:54 | amalloy | oh haha that's what i get for answering without reading the whole convo so far |
| 12:54 | TimMc | amalloy: Not this time, I think. |
| 12:54 | waxrose | :) |
| 12:54 | TimMc | Amusingly, the only two times I've wanted partitioning, partition-all has *not* been the right answer. |
| 12:55 | amalloy | &(let [list '(a b c d)] (partition 2 1 (cons (last list) list))) |
| 12:55 | sexpbot | ⟹ ((d a) (a b) (b c) (c d)) |
| 12:55 | angerman | oh, hmm good to know that I messed up my cube, … it's not oriented consistently |
| 12:56 | TimMc | (Actually, either one would have worked the first time, since I was checking mod count.) |
| 12:56 | angerman | amalloy: but(!) calling last on a list takes longer htan calling first |
| 12:56 | angerman | unless i missed something… it's cons cells in my head after all. |
| 12:56 | amalloy | it looks like TimMc has come up with all the good solutions. all that's left for me to propose are bad ones, angerman |
| 12:57 | angerman | amalloy: I see. At least there are multiple solutions :D |
| 12:57 | amalloy | there's more than one way to do it...but not as many as there are in perl |
| 12:57 | TimMc | haha |
| 12:58 | waxrose | :D @ perl |
| 12:58 | angerman | perl. |
| 12:58 | waxrose | Seemed like at the RubyConf I went to last year, there were more people proposing bad solutions than good ones. |
| 13:00 | __name__ | waxrose: is that a surprising thing? |
| 13:00 | waxrose | __name__, No.... |
| 13:01 | waxrose | but I would expect that if you are a speaker, that your application would at least 1% work |
| 13:01 | TimMc | OK, I should split this pipeline thingy off as a separate project. |
| 13:02 | pyr | hi |
| 13:02 | waxrose | pyr, Hello. :) |
| 13:03 | waxrose | TimMc, Let me know how it goes. |
| 13:03 | waxrose | :P |
| 13:03 | __name__ | waxrose: It's Ruby hipsters after all. |
| 13:04 | __name__ | I wish Inkscape did not suck. |
| 13:04 | TimMc | (That's a lie, I don't know Ruby at all. I just like that word.) |
| 13:04 | waxrose | Why? |
| 13:04 | clojurebot | http://clojure.org/rationale |
| 13:04 | pyr | I'm working with a java lib that has the following prototype: public long foo(final String... bar) { |
| 13:05 | TimMc | pyr: Last arg should be passed as an array, I think, if that's what you're asking. |
| 13:05 | waxrose | I started joining the Ruby band wagon till I realized it was more band than wagon. |
| 13:05 | drewr | and reefer |
| 13:05 | pyr | i don't see how i can call it (.foo object "something") |
| 13:05 | pyr | fails |
| 13:06 | pyr | ok i'll try with an arg |
| 13:06 | pyr | s,arg,list, |
| 13:06 | TimMc | ,(to-array ["hello" 5]) |
| 13:06 | amalloy | pyr: String[] |
| 13:06 | clojurebot | #<Object[] [Ljava.lang.Object;@76ef7b> |
| 13:07 | amalloy | TimMc: that's no good. you want into-array |
| 13:07 | amalloy | &(into-array ["hello"]) |
| 13:07 | sexpbot | ⟹ #<String[] [Ljava.lang.String;@af9dc4> |
| 13:07 | TimMc | ,(into-array String ["hello" "foo"]) |
| 13:07 | clojurebot | #<String[] [Ljava.lang.String;@668893> |
| 13:07 | pyr | erf |
| 13:07 | TimMc | amalloy: Oh, fancy! It determines the most specific type? |
| 13:07 | amalloy | haha you wish |
| 13:07 | amalloy | it determines the first type |
| 13:08 | TimMc | :-( |
| 13:08 | amalloy | &(into-array ["Test" 1]) |
| 13:08 | sexpbot | java.lang.IllegalArgumentException: array element type mismatch |
| 13:08 | TimMc | bah |
| 13:08 | pyr | yay |
| 13:08 | pyr | got it |
| 13:09 | amalloy | TimMc: but you could write one that determines the most specific type without too much difficulty |
| 13:10 | TimMc | (defn fancy-array [arr] (into-array (gcd arr) arr))) |
| 13:10 | TimMc | :-P |
| 13:11 | TimMc | ,(into-array []) |
| 13:11 | clojurebot | #<Object[] [Ljava.lang.Object;@1871392> |
| 13:12 | pyr | ,(into-array ["h"]) |
| 13:12 | clojurebot | #<String[] [Ljava.lang.String;@e95a23> |
| 13:12 | pyr | ,(into-array String ["h"]) |
| 13:12 | clojurebot | #<String[] [Ljava.lang.String;@1297ee0> |
| 13:12 | pyr | convenient |
| 13:17 | TimMc | waxrose: https://github.com/timmc/pipeline |
| 13:17 | TimMc | Long way to go. |
| 13:18 | waxrose | Well it's a start. :D |
| 13:20 | waxrose | I need to start on some Android apps I've been meaning to create. If I'm not mistaken, I think I am going to start with Moby Scheme. |
| 13:22 | waxrose | You just wrote this? |
| 13:22 | TimMc | This morning, yeah. |
| 13:23 | TimMc | It doesn't run yet, of course. |
| 13:23 | TimMc | Ugh, I'm going to need to do a topological sort or something. |
| 13:23 | TimMc | (I mean, yay!) |
| 13:24 | waxrose | lol |
| 13:25 | waxrose | Better than what I can do though. I'm still working my way through all this Lisp-oriented material I've collected. |
| 13:26 | amalloy | TimMc: what is this pipeline business? |
| 13:27 | TimMc | amalloy: For a semester project in Comp Arch, we have to write a machine code simulator. |
| 13:27 | waxrose | TimMc, I wish my classes were like that. |
| 13:28 | TimMc | I'm writing a logic pipeline utility that I can then pass all my actual data path and control path functions. |
| 13:28 | waxrose | Is this an undergrad class? |
| 13:28 | TimMc | yeah |
| 13:28 | waxrose | Big university? |
| 13:28 | TimMc | From what I understand, though, this is the best prof to teach this class in a while. |
| 13:28 | TimMc | Pretty big, I guess. Northeastern University, if you want to look it up. |
| 13:29 | waxrose | I need to transfer to Texas A&M. I attend a branch of it and we don't have any classes that require us to write a machine code simulator. |
| 13:29 | TimMc | haha |
| 13:29 | waxrose | I feel left out! |
| 13:30 | TimMc | I actually dropped this class last semester because the prof was... not good. |
| 13:30 | amalloy | waxrose: just write a compiler in your spare time |
| 13:30 | TimMc | I won't complain in specifics in a public channel. |
| 13:30 | waxrose | amalloy, I have some material on how to write a scheme compiler and a BF interpreter. I just need to go through them. |
| 13:31 | amalloy | waxrose: BF is boring. go whole hog with SNUSP |
| 13:31 | waxrose | TimMc, It's fine. |
| 13:31 | amalloy | i have a SNUSP interpreter i wrote in java, somewhere |
| 13:32 | waxrose | amalloy, Lol @ first link from google says.. "beautiful insanity".... sounds like my type of fun |
| 13:32 | TimMc | waxrose: Writing a MIPS simulator is... not new. Write something new! |
| 13:32 | amalloy | TimMc: the only CS class i ever dropped was because it was taught in lisp and i didn't get it |
| 13:32 | TimMc | aw |
| 13:32 | amalloy | the story gets more and more ironic as i get into clojure |
| 13:33 | waxrose | TimMc, I'll do it just to get it out of the way! :D |
| 13:33 | TimMc | "You'll never make it as a LISPer, amalloy!" |
| 13:33 | amalloy | srsly |
| 13:33 | TimMc | I never would have guessed. THat's pretty funny. |
| 13:34 | waxrose | amalloy, Lisp is actually the first language I've understood the first time I started reading about it. |
| 13:34 | waxrose | not sure why |
| 13:34 | amalloy | waxrose: first one i *didn't* get on my first try. maybe that's why it's so interesting |
| 13:34 | TimMc | Did either of you have a strong algebra background before encountering LISP? |
| 13:34 | TimMc | also, a strong programming background? |
| 13:34 | amalloy | yessss |
| 13:35 | amalloy | TimMc: i finished three semesters of calculus, diffEQ, linear algebra, and two years of java as well as years of hobby coding on the TI83/89 |
| 13:35 | amalloy | before dropping out of my scheme class |
| 13:36 | TimMc | The prof of my Scheme class (Olin Shivers) warned people that having a backgorund in programming could make learning Scheme harder, but that an algebra background would help. |
| 13:36 | amalloy | interesting |
| 13:36 | TimMc | Or a math background in general, I guess. |
| 13:36 | waxrose | TimMc, I read a lot of philosophy, so logic kind of comes naturally I guess. But my background is mainly in web, so Html, JavaScript, SQL, and framework design. |
| 13:37 | TimMc | I had been using JS in a functional style before hitting Scheme, so it wasn't too hard of a transition. |
| 13:37 | amalloy | i guess i can see that |
| 13:37 | waxrose | OOP confuses me, but for some reason functional programming makes sense to me. |
| 13:37 | amalloy | heh, damn you lisp! trying to write some php and after every newline my fingers type ( |
| 13:37 | waxrose | lol |
| 13:38 | Adamant | ah, Shivers |
| 13:38 | waxrose | If I would stop compiling Firefox and configuring my bash script for Ubuntu, I may actually make some time to finish reading my Lispish books. |
| 13:38 | waxrose | scripts* |
| 13:39 | TimMc | Adamant: Had him as a prof, or know him from his work? |
| 13:39 | Adamant | TimMc: know him from his work and Usenet postings |
| 13:39 | Adamant | which were hilarious |
| 13:39 | TimMc | heh |
| 13:40 | TimMc | I've read some of his rant collection. Good stuff. |
| 13:40 | Adamant | the one about firearms and academia was a creative writing classic |
| 13:40 | waxrose | TimMc, My previous school focused on Cold Fusion. :/ |
| 13:40 | Adamant | UNCLEAN! UNCLEAN! |
| 13:40 | Adamant | :P |
| 13:40 | amac | waxrose: dude, eww |
| 13:40 | waxrose | Tell me about it. |
| 13:40 | Adamant | it's ok. my first language was Visual Basic. |
| 13:41 | waxrose | haha |
| 13:41 | amalloy | Adamant: i tried visual basic after writing a bunch of TI-Basic. confused the crap out of me |
| 13:41 | waxrose | I didn't actually pay attention in the classes, so I don't remember anything from CF. |
| 13:41 | Adamant | I shit you not. fortunately I didn't absorb too much |
| 13:41 | amac | my first was qbasic... |
| 13:41 | Adamant | amalloy: I bet |
| 13:41 | TimMc | For anyone who isn't familiar with Shivers' excellent sense of humor, read the Acknowledgements section of the Scheme Shell manual: http://www.scsh.net/docu/html/man.html |
| 13:41 | Adamant | Visual Basic was it's own kind of weird thing |
| 13:42 | TimMc | TI-89 was my first, if you don't count screwing around with DOS batch files. |
| 13:42 | TimMc | I spent a lot of time bored in "pre-calc" class. |
| 13:42 | amalloy | TimMc: i actually found the TI-83 a lot more conducive to writing games than the 89 |
| 13:43 | waxrose | I remember people playing Doom on their TI-xx. |
| 13:43 | amalloy | though i eventually invented OOP on the 89 without knowing what it was called :P |
| 13:43 | TimMc | amalloy: Me too! |
| 13:44 | TimMc | Then I learned about Java and kicked myself. |
| 13:44 | waxrose | lol |
| 13:44 | amac | sadly, there's no qbasic channel on freenode |
| 13:44 | waxrose | I knew a little Java prior to finding Clojure, mainly because I've done mobile web apps before. |
| 13:44 | amalloy | amac: /join #qbasic. now there is! |
| 13:44 | waxrose | lol |
| 13:44 | amac | I just did |
| 13:45 | amac | now I must build a thriving community |
| 13:45 | waxrose | GL bro |
| 13:45 | amac | hah |
| 13:45 | amalloy | waxrose: i found the cvs repo for my SNUSP interpreter if you're interested |
| 13:45 | Adamant | amalloy: that happens all the time. lots of assembly programmers sort of informally figured out the basics of structuredimperative programming on their own |
| 13:46 | waxrose | amalloy, Sure! Also, why SNUSP and not BF? |
| 13:46 | amalloy | waxrose: snusp is BF but with more stuff |
| 13:46 | amalloy | and the 2d programming model is like whoa hilarious |
| 13:46 | waxrose | more features |
| 13:46 | fliebel | amalloy: 2D programming? |
| 13:46 | waxrose | Shoot me the link, I'll add it to my list of things to read. |
| 13:46 | amalloy | fliebel: a snusp program is a diagram |
| 13:47 | amalloy | waxrose: i have to remember how to use cvs first |
| 13:47 | waxrose | lol |
| 13:47 | fliebel | amalloy: I just dropped in… *googles snusp* |
| 13:47 | waxrose | I know how. |
| 13:48 | waxrose | -_- and now bzr |
| 13:48 | amalloy | waxrose: yeah but you don't have ssh access to my server :P |
| 13:48 | waxrose | oh |
| 13:48 | waxrose | lmao |
| 13:48 | amalloy | i checked it out, exporting to github shortly |
| 13:48 | TimMc | Adamant: Shivers mentioned being called into the Dean's office after that Acknowledgements section -- he said that's when he found out it's *really hard* to convince someone you're *not* crazy. |
| 13:48 | waxrose | kk |
| 13:50 | amalloy | https://github.com/amalloy/snusp |
| 13:50 | waxrose | TimMc, That is an awesome page. haha |
| 13:50 | waxrose | "I did it all by myself!" |
| 13:50 | amalloy | no guarantees about how useful it is, i haven't looked at the source for ~3 years |
| 13:50 | TimMc | waxrose: Now imagine how new students feel when they stumble across that page. :-P |
| 13:50 | waxrose | amalloy, I like junk code, scrapped projects. |
| 13:51 | waxrose | TimMc, I would imagine that would motivate them! |
| 13:52 | amalloy | omg that is quite a page |
| 13:52 | phenom_ | hey guys, if i have some peice of data that doesn't need to be udpated in conjuction with other data in a multithreaded context, I can use an atom versus a ref correct? |
| 13:52 | waxrose | amalloy, I followed you so I won't forget to clone it. |
| 13:52 | phenom_ | like in this example: http://stackoverflow.com/questions/2760017/producer-consumer-with-qualifications |
| 13:55 | Adamant | TimMc: oh yeah. |
| 13:56 | amalloy | fliebel: https://github.com/amalloy/snusp/blob/master/resources/add.snusp is a program for adding together two numbers read from stdin. it's been a long time, but it looks to me like they're both two-digit numbers |
| 13:58 | amalloy | oh durrr no they're single digit |
| 13:59 | fliebel | amalloy: Whoa, that looks like a monster of code! |
| 14:00 | amalloy | fliebel: tbh i have no idea what the whole bottom half of the program is for |
| 14:00 | waxrose | amalloy, that looks like a tractor or some farming equipment. >.< |
| 14:00 | clojurebot | amalloy: therfor I return [previous] if rest is empty |
| 14:00 | fliebel | amalloy: Could it be the actual adder? |
| 14:01 | amalloy | fliebel: no, the adder is the first loop on the left, starting with ~/==? |
| 14:01 | amalloy | er, !/==? |
| 14:01 | cemerick | amalloy: thank you for alerting me to SNUSP |
| 14:01 | waxrose | Interesting language. |
| 14:01 | waxrose | SNUSP looks like it will be fun. |
| 14:02 | amalloy | someone has an interactive snusp debugger/interpreter in javascript which could help explain what that enormous pile of -\!?/ is for |
| 14:03 | amalloy | i think it may be a copy instruction: "copy memory location N to location N+1" |
| 14:03 | klang | TimMc: what other material are you MISP project (if I may be so bold) |
| 14:04 | waxrose | amalloy, The hello world for SNUPS looks crazy. |
| 14:05 | amalloy | waxrose: iirc any BF program can be run as a SNUSP program: SNUSP is the C++ to BF's C |
| 14:05 | klang | TimMc: .. inject a "using for the" somewhere logical in that last sentence, please |
| 14:05 | amalloy | so you could use the BF hello |
| 14:05 | waxrose | What is a good beginning reference for SNUSP? |
| 14:06 | waxrose | amalloy, Thanks for clarifying. |
| 14:06 | amalloy | http://esoteric.voxelperfect.net/wiki/SNUSP ? |
| 14:08 | amalloy | or maybe http://www.c2.com/cgi/wiki?SnuspLanguage |
| 14:09 | cemerick | I always go for esolangs: http://www.esolangs.org/wiki/SNUSP |
| 14:09 | amalloy | ANYWAY sorry for bringing such a disgusting language into #clojure, i don't even remember how it came up |
| 14:09 | cemerick | But, that's only because I'm a dilettante :-P |
| 14:09 | amalloy | cemerick: my first link seems to be a mirror of the esolangs |
| 14:10 | cemerick | amalloy: don't apologize, I was happy to learn of it |
| 14:10 | amalloy | but yours is certainly canonical |
| 14:10 | amalloy | cemerick: it's really a psuedo-apology |
| 14:10 | amalloy | i'll probably tweet this shit up too, now that i've put it on github |
| 14:10 | cemerick | at first, I thought it was logic programming via ascii circuit diagram |
| 14:11 | waxrose | lol |
| 14:11 | waxrose | I think it was brought up because I mentioned BF. |
| 14:12 | amalloy | cemerick: it almost is |
| 14:14 | Adamant | 2-D programming is neat. so is heavily Unicoded programming and math equation simulation with ASCII/Unicode type stuff |
| 14:16 | cemerick | Even better is programming that doesn't rely upon text at all. |
| 14:16 | cemerick | But, I'm repeating myself now. |
| 14:21 | amalloy | waxrose: ugh. i just went to all the work of running cvs2git on my repo, to discover that it has only two commits anyway. one with all the code, another in which i add a sample program to the resources/ dir |
| 14:22 | waxrose | :/ |
| 14:23 | waxrose | gotta love it |
| 14:23 | amalloy | but at least i learned how to use cvs2git. now i can run that on all my old repos |
| 14:23 | waxrose | haha |
| 14:23 | waxrose | true |
| 14:23 | waxrose | See, some good came out of it. |
| 14:23 | amalloy | indeed |
| 14:26 | waxrose | I'm glad Google finally accepted me into their storage preview. Now I can start my Clojure web application on GAE. |
| 14:27 | waxrose | Any of you using a web framework? |
| 14:28 | waxrose | I think I'm going to go with Compojure. |
| 14:29 | amac | I don't see compojure as a framework so much as a sexiness layer for ring |
| 14:30 | raek | I see it as a route library for ring |
| 14:30 | raek | lol |
| 14:30 | semperos | +1 for Moustache |
| 14:30 | raek | I like this overview http://www.glenstampoultzis.net/blog/clojure-web-infrastructure/ |
| 14:32 | waxrose | lol |
| 14:32 | raek | inc for the modularity of the clojure web stack |
| 14:33 | amalloy | (inc clojure) |
| 14:33 | sexpbot | ⟹ 3 |
| 14:33 | waxrose | Which SQl implementation is the most popular? |
| 14:33 | companion_cube | mysql, postgresql... |
| 14:34 | waxrose | >.> |
| 14:35 | waxrose | ClojureSQl |
| 14:35 | raek | ClojureQL seems popular |
| 14:37 | waxrose | amalloy, Probably not holding the shift long enough. |
| 14:37 | waxrose | >.< |
| 14:37 | waxrose | I didn't even realize. haha |
| 14:37 | waxrose | I type too fast, so I have a tendency to typo a lot. |
| 14:38 | waxrose | AND not notice. |
| 14:42 | LauJensen | raek: its the bomb :) |
| 14:49 | TimMc | klang: The MIPS thingy will need the logic pipeline and an extremely simple assembler. Oh, and some logging, I guess. |
| 14:54 | klang | TimMc: I was wondering if you were following a book or more .. custom-designed course notes? |
| 14:56 | TimMc | klang: It's for a class. We're using the classic textbook Computer Organization and Design. |
| 14:57 | TimMc | I don't know the material yet for the 5-stage pipeline architecture we'll be using, but I *think* the book describes it. |
| 14:59 | klang | TimMc: that's probably a very good guess :-) |
| 15:00 | Adamant | TimMc: suggestion - if you want to get more into the hardware end, Computer Architecture by the same guys is also good |
| 15:00 | Adamant | COD is partially a rehash of CA, partially a simplification, and partially new material |
| 15:00 | TimMc | Adamant: Thanks, but I really don't. :-P |
| 15:00 | Adamant | fair enough :) |
| 15:00 | bartj | If there is a hash-map like: {:a 1 :b 2 :c 3} |
| 15:01 | bartj | what is the idiomatic way to create: {:a 10 :b 20 :c 30} |
| 15:01 | TimMc | The prof's work is vaguely interesting, though -- he's doing software (kernel) design for many-core architectures. |
| 15:01 | bartj | instead of doing: (zipmap (keys ) (map #(* % 10) (vals)) |
| 15:01 | amalloy | bartj: fmap is one way, or clojure.walk/walk should work |
| 15:02 | TimMc | ,(apply concat (seq {:a 1 :b 2 :c 3})) |
| 15:02 | clojurebot | (:a 1 :b 2 :c 3) |
| 15:03 | klang | TimMc: I like your use of the word "vaguely", there .. heh, anyway, thanks for the ref and good luck on the project, it looks interesting. |
| 15:03 | TimMc | That's probably not lazy, though, if you care. |
| 15:03 | amalloy | &(walk (fn [[k v]] [k (* 10 v)]) identity {:a 1 :b 2 :c 3}) |
| 15:03 | sexpbot | ⟹ {:a 10, :b 20, :c 30} |
| 15:03 | amalloy | TimMc: maps can't be lazy anyway |
| 15:03 | TimMc | bartj: Sorry, I missed the multiplication part. |
| 15:04 | bartj | er, that's fine! |
| 15:04 | raek | ,(let [m {:a 1 :b 2 :c 3}] (into (empty m) (for [[k v] m] [k (* 10 v)]))) |
| 15:04 | clojurebot | {:a 10, :b 20, :c 30} |
| 15:06 | amalloy | raek: i wonder why clojure.walk/walk doesn't just use (empty blah) |
| 15:06 | amalloy | &(empty [1 2 3]) |
| 15:06 | sexpbot | ⟹ [] |
| 15:07 | amalloy | cause it looks like the whole thing could be (defn walk [inner outer form] (outer (into (empty form) (map inner form)))) |
| 15:08 | raek | or perhaps... |
| 15:08 | raek | ,(let [m {:a 1 :b 2 :c 3}] (into (empty m) (map (juxt key (comp (partial * 10) val)) m))) |
| 15:08 | clojurebot | {:a 10, :b 20, :c 30} |
| 15:08 | raek | that one's for you, amalloy |
| 15:08 | amalloy | *laugh* |
| 15:09 | TimMc | That is much more readable! |
| 15:10 | TimMc | Oh man, I forgot that key and val were functions. |
| 15:12 | amalloy | TimMc: you don't really need them. you can use first and second |
| 15:13 | amalloy | raek: i'm sad to see "m" appearing twice. you could surely do better with something like (apply into ((juxt empty (partial map ...)) m)) |
| 15:14 | TimMc | amalloy: You, sir, are an instigator. |
| 15:15 | waxrose | lol |
| 15:15 | amalloy | TimMc: point-free ftw |
| 15:15 | TimMc | It's really a form of golf, isn't it? |
| 15:16 | amalloy | yes, except that you don't get shorter code |
| 15:20 | dnolen | fliebel: finally I found a clue, https://gist.github.com/860912 for the arithmetic issue. |
| 15:29 | fliebel | dnolen: Great you found something! I don't really understand the gist though. |
| 15:31 | fliebel | What is f? What is letrec? Where is the hyphen in cond-e? |
| 15:31 | amalloy | fliebel: do you have a link to your gist with the take-random or whatever it was? |
| 15:32 | dnolen | fliebel: basically miniKanren has some carefully placed thunk'ing. But I didn't understand *why* it's required. Many programs work w/o it. pluso didn't however. But pluso execution is too dense to really 'see' why we need it. I needed a minimal case that I can actually understand. |
| 15:33 | fliebel | amalloy: "or whatever it was" You're just asking for a random gist? |
| 15:33 | TimMc | fliebel: letrec allows the val-expr to be evaluated in a context where the name is bound. |
| 15:34 | amalloy | *laugh* |
| 15:34 | amalloy | fliebel: no, the take-randnth thing |
| 15:34 | amalloy | couldn't remember what we were calling it at the time |
| 15:34 | fliebel | amalloy: One moment please… Trying to understand dnolen and TimMc first. |
| 15:35 | TimMc | It's just a fancy way to create recursive expressions. |
| 15:35 | TimMc | s/fancy // |
| 15:35 | sexpbot | <TimMc> It's just a way to create recursive expressions. |
| 15:35 | dnolen | fliebel: the gist is from the latest Scheme miniKanren. |
| 15:36 | sritchie_ | hey all -- has anyone here had success with marginalia 0.5.0? |
| 15:36 | sritchie_ | I'm getting this error, and am not sure how to debug -- clojure.lang.PersistentVector cannot be cast to clojure.lang.Symbol |
| 15:36 | dnolen | looks like a good read, A Schemer's View of Monads, by none other than Daniel P. Friedman, http://www.cs.indiana.edu/cgi-pub/c311/lib/exe/fetch.php?media=manymonads.pdf |
| 15:37 | fliebel | dnolen: What is thunk'ing in this context? Does it has anything to do with ChunkedSeq? |
| 15:38 | dnolen | fliebel: no it just means delaying a computation by wrapping it in function that takes no args. |
| 15:38 | fliebel | ah |
| 15:39 | fliebel | amalloy: https://gist.github.com/805747 |
| 15:39 | amalloy | fliebel: there it is, thanks |
| 15:40 | fliebel | amalloy: Why do you need it? |
| 15:41 | amalloy | fliebel: came across a question on SO about functional shuffling techniques |
| 15:47 | amalloy | fliebel: http://stackoverflow.com/questions/3944556/what-if-anything-is-wrong-with-this-shuffling-algorithm-and-how-can-i-know/5238130#5238130 if you're interested |
| 15:49 | TimMc | waxrose: Here's a cute little utility I wrote for managing state updates in a GUI program I wrote: https://github.com/timmc/CS4300-HW3/blob/master/src/timmcHW3/cascade.clj |
| 15:49 | raek | sritchie_: you only get that when running marginalia and not otherwise? is the exception coming from within marginalia or your code? |
| 15:49 | waxrose | TimMc, kk, checking it out now |
| 15:49 | TimMc | waxrose: I'll be using some of the same techniques to make the pipeline utility, since both involve updating the nodes of DAGs. |
| 15:49 | sritchie_ | raek: just marginalia |
| 15:50 | sritchie_ | my code compiles fine |
| 15:50 | sritchie_ | I thought it had to do with the way I was declaring my namespaces -- I'll post an example of what I mean -- but the change didn't fix anything |
| 15:50 | TimMc | (cascade.clj is for side-effects; the pipelineis all functional) |
| 15:52 | sritchie_ | raek: here's a gist of the error I get, and my namespace change (which didn't affect the outcome): https://gist.github.com/861019 |
| 15:55 | raek | hrm. maybe it's a bug in marginalia |
| 15:56 | brehaut | morning everyone |
| 15:57 | TimMc | hey, brehaut |
| 15:58 | fliebel | amalloy: There are images of the graphs on my blog if you want. |
| 15:59 | waxrose | TimMc, What is the purpose of DAGs? I believe this is the first I've been introduced to it. Just simply to organize nodes on a graph? |
| 16:00 | brehaut | waxrose: walking a DAG is much simpler than walking a general graph; you dont have to worry about tracking visited nodes; it makes many algorithms much simpler |
| 16:01 | waxrose | hmm |
| 16:02 | sritchie_ | raek: I'll post an issue later today |
| 16:05 | amalloy | waxrose: a DAG is very similar to a tree. there's one additional constraint that trees have, namely that no vertex can have two incoming edges (two parents), but mostly they're the same |
| 16:05 | amalloy | and trees are substantially easier to work with than generalized graphs |
| 16:06 | __name__ | amalloy: Do you have a blog? |
| 16:08 | waxrose | amalloy, Thanks for explaining further. |
| 16:08 | brehaut | waxrose: DAGs also have useful properties for constructing concurrent systems |
| 16:09 | brehaut | waxrose: each node in your graph is a computation that depends on the results of the nodes that feed into it |
| 16:09 | amalloy | __name__: http://hubpages.com/profile/amalloy is the closest thing |
| 16:10 | __name__ | Thanks :) |
| 16:10 | __name__ | I subscribed to your rss :) |
| 16:10 | amalloy | enjoy! |
| 16:12 | TimMc | waxrose: In my program, the rendered image depends on both the user data (what elements they have put on the canvas) and also on where the mouse is hovering, which in turn *also* depends on the user data. https://github.com/timmc/CS4300-HW3/blob/master/src/timmcHW3/core.clj#L547 |
| 16:12 | waxrose | ah! |
| 16:13 | waxrose | Okay, thanks for explaining guys. Makes more sense now. |
| 16:13 | TimMc | Now, I could either propagate changes in the user data up through both those chains each time it changes, or I could recompute the rendering only when it is asked for. Either way, I have both a good chance of messing up the updates (due to complexity) or of recomputing things unnecessarily (if there are multiple paths back to it.) |
| 16:14 | TimMc | I chose to create something to manage those dependencies and only call the updater thunks when necessary. |
| 16:15 | TimMc | By the way cascade.clj enforces a DAG by requiring that each new node can only reference the nodes that have already been added. That's sufficient. |
| 16:17 | TimMc | waxrose: Elsewhere in core.clj, you'll see that I call (dirty! :udata) to mark a node and all dependencies as dirty, and (clean!) (after each event handler) to run all update code necessary to mark the :all node clean. |
| 16:18 | TimMc | The :all node is a hack; I should have a clean-all function in cascade that knows how to get the leaf nodes. |
| 16:19 | waxrose | And you will be doing similar to the pipeline application? or am I confused? |
| 16:20 | waxrose | some what similar* |
| 16:20 | TimMc | Sort of similar. The pipeline itself is pure functional, so I can probably use memoization. |
| 16:21 | waxrose | Or rather, applying the similar concepts I mean. |
| 16:22 | TimMc | In any case, I'll have cases where logic block A depends on B and C, which both depend on D -- but as a combinational circuit, there will be no cycles. That's a DAG, so I'll need the same concepts. |
| 16:23 | waxrose | Ah, okay. |
| 16:23 | waxrose | I vaguely remember DAGs but can't remember from where. |
| 16:23 | waxrose | refresher course haha |
| 16:26 | TimMc | Bonus: Look up "topological sort". It's a useful companion to DAGs. |
| 16:28 | waxrose | Thanks, I'll look into it after my Robotics class. |
| 16:41 | amalloy | TimMc: this reminds me of partially-ordered sets |
| 16:57 | TimMc | amalloy: I suppose so. I've never studied them, though. |
| 16:58 | amalloy | they're a handy tool for the sort of thing you seem to be doing, like job scheduling |
| 17:04 | semperos | brehaut: you still around? |
| 17:04 | brehaut | semperos: yeah |
| 17:04 | semperos | brief pm? |
| 17:10 | scottj | when threading, is there a better way to have a side-effecting form that ignores but passes the threaded value than this (-> 4 ((fn [sofar] (Thread/sleep 10) sofar)) ...) ? |
| 17:11 | brehaut | scottj: that isnt going to do what you want |
| 17:12 | brehaut | oh actually, it might, but its a horrible hack :P |
| 17:13 | scottj | it works, I guess this might be better: |
| 17:13 | scottj | ,(-> 4 (->> (do (Thread/sleep 10))) -) |
| 17:13 | clojurebot | -4 |
| 17:16 | __name__ | &(. Runtime exec "echo random stuff") |
| 17:16 | sexpbot | java.lang.IllegalArgumentException: No matching method: exec |
| 17:19 | brehaut | scottj: by threading do you mean capital T threads or the -> macro? |
| 17:20 | scottj | -> |
| 17:20 | scottj | sorry my side-effect example made that confusing :) |
| 17:24 | brehaut | yeah it did :) |
| 17:38 | semperos | clj-record has the init-model macro, which utilizes the namespace it finds itself under when called and uses that for many of its functions |
| 17:38 | semperos | I have a similar need, to use a namespace for various and sundry things |
| 17:38 | semperos | is the way clj-record handles that need idiomatic? are there alternatives? |
| 17:43 | amalloy | scottj: doto? |
| 17:47 | scottj | amalloy: I don't think that's a solution |
| 17:48 | amalloy | yeah, if you want to totally ignore i guess do is your best bet |
| 17:48 | amalloy | but eg ##(-> 1 inc (doto println) inc) |
| 17:48 | sexpbot | java.lang.IllegalArgumentException: Bad binding form, expected vector |
| 17:48 | amalloy | huh |
| 17:49 | amalloy | ,(-> 1 inc (doto println) inc) |
| 17:49 | clojurebot | 2 |
| 17:49 | clojurebot | 3 |
| 17:49 | amalloy | sigh. one more thing to fix in the sandbox i guess |
| 17:52 | patrkris | what are people mostly using for HTML in clojure web apps? enlive? hiccup? |
| 17:53 | semperos | +1 for enlive |
| 17:53 | brehaut | patrkris: i dont think anyone has done a survey |
| 17:53 | brehaut | they are both popular though |
| 17:54 | semperos | if you want to write your HTML in Clojure data structures, then use hiccup |
| 17:54 | brehaut | if i had to guess though, i would say hiccup is more common due to a) more gradual learning curve and b) links to compojure |
| 17:54 | brehaut | patrkris: but i use enlive myself |
| 17:55 | patrkris | i read somewhere that cgrand is cooking up something for filling in data in html forms with enlive |
| 17:55 | patrkris | something i think i bred |
| 17:56 | patrkris | *need - effin iPhone |
| 17:56 | lpetit | patrkris: I would invest in enlive. |
| 17:56 | brehaut | patrkris: i believe there is something like that in the roadmap |
| 17:57 | patrkris | lpetit: care to elaborate? |
| 17:57 | lpetit | patrkris: I like the concept more. |
| 17:58 | patrkris | lpetit: I think I agree |
| 17:58 | scottj | they're not mutually exclusive are they? can't you write your html in hiccup and then use enlive to stick stuff in it? |
| 17:58 | patrkris | i think you can |
| 17:58 | semperos | it's a bit round-about, as you're going from hiccup-data-structure to HTML string to Enlive data structure |
| 17:58 | lpetit | probably |
| 17:59 | semperos | but yes, you can, i've done it in places where I had small amounts of HTML to generate and just wanted to use hiccup to feed enlive |
| 17:59 | brehaut | patrkris: i think enlive does a better job handling separation of concerns, and is a more expressive tool overall (you can process content as well as generate it) |
| 17:59 | lpetit | you also probably can use hiccup in some places, and enlive in other places, in the same app |
| 18:00 | lpetit | And investing in enlive also opens the door of xml transformation, selection, etc. |
| 18:00 | patrkris | brehaut: i agree - and I think I prefer writing HTML in HTML |
| 18:01 | patrkris | lpetit: any advice/tips/tricks on handling HTML forms with enlive? |
| 18:02 | lpetit | patrkris: no, sorry, that's why I said "I would". I have not written webapps recently |
| 18:02 | brehaut | patrkris: that is actually the killer feature for me; i write my html in textmate (all the rest of my development is in emacs) and i use the built in preview that keeps up to date with my content with out having to have a web server in between |
| 18:02 | patrkris | ok |
| 18:02 | patrkris | exactly, brehaut |
| 18:04 | patrkris | i am sorry to admit I come from an asp.net background, where we have stuff like viewstate that helps automatically repopulating form fields on postback |
| 18:04 | semperos | if you're looking to deal with forms (fill out and submit), you can use Java's HtmlUnit headless browser |
| 18:04 | semperos | if you're not opposed to graphical browser, you can also use WebDriver to do the same |
| 18:05 | patrkris | semperos: not that, but thanks :) |
| 18:05 | semperos | on the front of authoring forms, the Sandbar library has things to add |
| 18:06 | patrkris | yeah, but as far as I know, it generates the HTML for you, given a form spec in Clojure? |
| 18:07 | lpetit | patrkris: please help me shake out this (it's a little bit far from what I've done recently). Is it possible to describe the postback problem in a few sentences ? |
| 18:08 | weavejester | Hi folks |
| 18:08 | patrkris | weavejester: just the man - we're talking about enlive vs hiccup |
| 18:08 | patrkris | and web forms in general |
| 18:08 | weavejester | You can probably guess where I fall in that debate ;) |
| 18:08 | weavejester | Well... I guess it really depends on what you want to do. |
| 18:09 | patrkris | i'm thinking about forms specifically |
| 18:09 | patrkris | e.g. repopulating form fields on postback |
| 18:10 | weavejester | I've been meaning to add in a binding form to Hiccup to do that automatically |
| 18:10 | weavejester | Something like... |
| 18:10 | patrkris | but also other concerns, such as validation, which I believe you had in compojure once |
| 18:11 | weavejester | (with-params {:x "x"} (text-field :x)) |
| 18:11 | scottj | sandbar definitely has some validation stuff |
| 18:11 | patrkris | (i'm a slow writer on an iPhone) |
| 18:11 | scottj | weavejester: didn't pre-split compojure have that? |
| 18:12 | weavejester | Yeah. pre-split compojure had something like a with-params macro. Not sure if that was the name. |
| 18:12 | weavejester | It also had some validation, but it wasn't very good. |
| 18:12 | patrkris | scottj: yeah, but I think sandbar wants to generate specific html for you? |
| 18:13 | weavejester | I've been thinking about creating a functional validation library. |
| 18:13 | scottj | patrkris: I don't know |
| 18:13 | patrkris | weavejester: the form element functions were to tightly coupled to validation? |
| 18:13 | weavejester | I think a lot of my early stuff was too tightly-coupled. |
| 18:13 | lpetit | Hmm, from the example I'm seeing, sandbar form validation doesn't help a lot to separate concerns ? |
| 18:13 | scottj | weavejester: did you ever take a stab at csrf protection? |
| 18:13 | weavejester | Too used to OOP |
| 18:13 | weavejester | Oh |
| 18:14 | weavejester | No, I forgot about CSRF middleware |
| 18:14 | lpetit | call to db/find-user inside the form declaration, etc. |
| 18:15 | patrkris | lpetit: my impression also |
| 18:15 | scottj | weavejester: ok, if you have the time and inclination I'll definitely upgrade from .4 for that :) |
| 18:15 | weavejester | scottj: I'll try and get it done this week |
| 18:15 | weavejester | It should be pretty straightforward |
| 18:15 | weavejester | I have a quick question unrelated to web forms and validation |
| 18:16 | weavejester | Given that fn is a special form... |
| 18:16 | weavejester | it would probably be a bad idea to override it, right? |
| 18:16 | amalloy | weavejester: if it were actually a special form it would be impossible to override |
| 18:16 | amalloy | but it's a macro somewhere that reduces to fn* |
| 18:17 | weavejester | Yeah, but it's listed as a special form in the docs |
| 18:17 | weavejester | I was making a macro that turns a template into a function. |
| 18:17 | amalloy | yeah, the docs in my experience mostly lie about special forms :P |
| 18:17 | weavejester | Like: (template/fn [x] "foo<% x %>") |
| 18:17 | weavejester | Which is equivalent to: (fn [x] (str "foo" x)) |
| 18:18 | weavejester | But even though I *can* override fn, should I? |
| 18:18 | amalloy | i'd just call it template |
| 18:18 | amalloy | or template-fn or fn-template or... |
| 18:18 | weavejester | Well, I also have (template/eval "foo<% x %>" {:x "bar"}) |
| 18:19 | weavejester | Which is equal to "foobar" |
| 18:19 | amalloy | for one, naming it fn will make it possible for someone to (use) your namespace without resolving conflicts with c.core |
| 18:19 | amalloy | *impossible |
| 18:19 | weavejester | Yeah, but clojure.string also shouldn't be :used |
| 18:20 | patrkris | later guys |
| 18:20 | weavejester | cya |
| 18:21 | weavejester | I like the idea of using foo/bar over foo-bar |
| 18:21 | weavejester | Because users can potentially shorten it |
| 18:21 | weavejester | And it seems more idiomatic |
| 18:22 | amalloy | weavejester: you're probably right |
| 18:22 | amalloy | though of course users could shorten it anyway with :use/:rename |
| 18:22 | weavejester | true |
| 18:22 | weavejester | I guess I was thinking of functions like clojure.set/join and clojure.string/join |
| 18:23 | weavejester | The function name is very generic |
| 18:23 | weavejester | It's just the namespace that distinguishes the use |
| 18:23 | amalloy | in my head, those are okay because there are already existing uses of "join" to mean both of those things |
| 18:23 | brehaut | weavejester: i think that is sound |
| 18:23 | brehaut | (not that my opinion carries any weight) |
| 18:24 | raek | ,`fn |
| 18:25 | clojurebot | clojure.core/fn |
| 18:25 | amalloy | ,`fn* |
| 18:25 | clojurebot | fn* |
| 18:25 | weavejester | Yeah, though there is a problem in extend-type and extend-protocol |
| 18:25 | weavejester | They have 'fn, rather than `fn |
| 18:25 | weavejester | In their code generation |
| 18:26 | weavejester | I'm trying to decide if that's a bug, or if I'm abusing fn :) |
| 18:27 | amalloy | could be both :) |
| 18:27 | weavejester | Haha - true |
| 19:13 | TimMc | Gah, I keep typing guthub.com -- pretty sure I don't want to see whatever's there. |
| 19:13 | technomancy | I type guthub all the time |
| 19:13 | technomancy | on purpose though |
| 19:13 | technomancy | it's a redirect |
| 19:14 | TimMc | Oh good. |
| 19:14 | technomancy | carry on. |
| 19:26 | brehaut | is there an stdlib equivalent to (defn first-of [arguments fns] (first (keep #(apply % arguments) fns))) |
| 19:26 | brehaut | ? |
| 19:26 | brehaut | (and if not, what is a better name for that) |
| 19:29 | brehaut | where (first-of [{:b 1}] [:a :b :c]) => 1 |
| 19:49 | fstephe | hello? |
| 19:49 | clojurebot | BUENOS DING DONG DIDDLY DIOS, fRaUline fstephe |
| 19:49 | fstephe | Sorry this is my first time on IRC |
| 19:49 | fstephe | I have found what looks like a bug in the contains? functiopn |
| 19:50 | TimMc | fstephe: Perhaps because contains? is ill-named |
| 19:50 | fstephe | ah, ok |
| 19:50 | technomancy | clojurebot: contains? |
| 19:50 | 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 |
| 19:50 | fstephe | ok, but I am checking for the presence of a Number in set |
| 19:51 | technomancy | ah yeah, that's a subtle JVM interop question |
| 19:51 | TimMc | fstephe: Ooh, is this an int vs. long problem? |
| 19:51 | fstephe | a hashset specifically |
| 19:51 | fstephe | haha |
| 19:51 | fstephe | it is |
| 19:51 | technomancy | Java's hashing semantics are all shot to hell. |
| 19:51 | fstephe | it is the BigInt vs long |
| 19:51 | technomancy | when it comes to numerics |
| 19:51 | fstephe | yes, it is true that Rich has made a really heroic effort to unify the numbers |
| 19:52 | technomancy | it's somewhat fixed in 1.3 since 1.3 only uses Java's semantics if you do .contains |
| 20:05 | __name__ | (Tomorrow I will propose changing ( to \ and ) to / in the Clojure syntax!) |
| 20:05 | TimMc | __name__: UK? |
| 20:05 | __name__ | TimMc: Nope, AT. |
| 20:05 | TimMc | ? |
| 20:05 | __name__ | Austria. |
| 20:05 | TimMc | Oh jeez, yeah, you should get to sleep. |
| 20:06 | __name__ | \+ 1 2 3/ |
| 20:07 | __name__ | Bye. |
| 21:22 | phenom_ | I've got a function that takes 2 parameters, the second of which can either be a string or a hashmap .. should I do the instance check myself or use a multimethod? |
| 21:22 | phenom_ | I've got a function that takes 2 parameters, the second of which can either be a string or a hashmap .. should I do the instance check myself or use a multimethod? |
| 21:23 | brehaut | phenom_: depends if you need / want it to be extensible |
| 21:23 | brehaut | phenom_: depends if you need / want it to be extensible |
| 21:34 | TimMc | phenom_: You should be able to turn it into a multimethod later. |
| 21:34 | TimMc | phenom_: You should be able to turn it into a multimethod later. |
| 21:42 | ossareh | hola clojurians |
| 21:42 | ossareh | hola clojurians |
| 21:42 | ossareh | hope to see some of y'all at the SF meetup tomorrow! |
| 21:42 | ossareh | hope to see some of y'all at the SF meetup tomorrow! |
| 22:03 | amalloy | ossareh: you'll be waiting a long time. try coming on thursday instead of tomorrow :) |
| 22:03 | amalloy | ossareh: you'll be waiting a long time. try coming on thursday instead of tomorrow :) |
| 22:04 | amalloy | provided that much, however, you'll see me there |
| 22:04 | amalloy | provided that much, however, you'll see me there |
| 22:04 | TimMc | Maybe ossareh is east of the Atlantic, but plans to fly to SF. :-) |
| 22:04 | TimMc | Maybe ossareh is east of the Atlantic, but plans to fly to SF. :-) |
| 22:05 | amalloy | i did consider that |
| 22:05 | amalloy | i did consider that |
| 22:05 | waxrose | Finally back home. |
| 22:05 | waxrose | Finally back home. |
| 22:06 | TimMc | waxrose: I am almost done writing pipeline.clj! |
| 22:06 | TimMc | waxrose: I am almost done writing pipeline.clj! |
| 22:07 | TimMc | THen comes the debugging, which will take a while. I haven't even written any tests yet, |
| 22:07 | TimMc | THen comes the debugging, which will take a while. I haven't even written any tests yet, |
| 22:07 | TimMc | because I have been scrapping and rewriting the internals of the pipeline itself. |
| 22:07 | TimMc | because I have been scrapping and rewriting the internals of the pipeline itself. |
| 22:07 | TimMc | (Stupid dangling commas forcing me to add another clause.) |
| 22:07 | TimMc | (Stupid dangling commas forcing me to add another clause.) |
| 22:08 | waxrose | TimMc, Woot! You uploaded it? |
| 22:08 | waxrose | TimMc, Woot! You uploaded it? |
| 22:08 | TimMc | Not yet. |
| 22:08 | TimMc | Not yet. |
| 22:08 | hippiehunter | anyone got an suggestions for how to debug "Unreadable form", it seems to be related to reloading namespaces in the repl.... first time through it works fine but after that its a crap shoot with each :reload-all |
| 22:08 | hippiehunter | anyone got an suggestions for how to debug "Unreadable form", it seems to be related to reloading namespaces in the repl.... first time through it works fine but after that its a crap shoot with each :reload-all |
| 22:08 | TimMc | It feels silly to commit when I'm so close to having it even compile. |
| 22:08 | TimMc | It feels silly to commit when I'm so close to having it even compile. |
| 22:08 | TimMc | hippiehunter: Does it show you what was unreadable? |
| 22:08 | TimMc | hippiehunter: Does it show you what was unreadable? |
| 22:09 | amalloy | &(read-string (pr-str *ns*)) |
| 22:09 | amalloy | &(read-string (pr-str *ns*)) |
| 22:09 | sexpbot | java.lang.Exception: Unreadable form |
| 22:09 | sexpbot | java.lang.Exception: Unreadable form |
| 22:09 | hippiehunter | no, also the stack trace is crap since its in a lazy seq |
| 22:09 | hippiehunter | no, also the stack trace is crap since its in a lazy seq |
| 22:10 | TimMc | amalloy: I think I am about to use the replace function! |
| 22:10 | TimMc | amalloy: I think I am about to use the replace function! |
| 22:11 | TimMc | I still think it is terribly named, though. |
| 22:11 | TimMc | I still think it is terribly named, though. |
| 22:11 | waxrose | Hmm, looks like Oracle will be at my school on thursday. |
| 22:11 | waxrose | Hmm, looks like Oracle will be at my school on thursday. |
| 22:12 | waxrose | I wonder if Oracle is doing any Clojure. |
| 22:12 | waxrose | I wonder if Oracle is doing any Clojure. |
| 22:16 | brehaut | waxrose: unless there is a provable link between anything and charging huge fees for it, oracle is bound to not be interested |
| 22:16 | brehaut | waxrose: unless there is a provable link between anything and charging huge fees for it, oracle is bound to not be interested |
| 22:17 | waxrose | brehaut, Sounds reasonable. Doesn't hurt to ask though when they visit. |
| 22:17 | waxrose | brehaut, Sounds reasonable. Doesn't hurt to ask though when they visit. |
| 22:17 | amalloy | well done, brehaut. i couldn't think of anything cynical enough to say about the possibility |
| 22:17 | amalloy | well done, brehaut. i couldn't think of anything cynical enough to say about the possibility |
| 22:18 | amalloy | waxrose: make sure to bring an index card with cloJure clearly spelled out as they may think you mean closure :P |
| 22:18 | amalloy | waxrose: make sure to bring an index card with cloJure clearly spelled out as they may think you mean closure :P |
| 22:18 | waxrose | amalloy, lmao |
| 22:18 | waxrose | amalloy, lmao |
| 22:18 | waxrose | good idea |
| 22:18 | waxrose | good idea |
| 22:27 | TimMc | Grrr, github is down. |
| 22:27 | TimMc | Grrr, github is down. |
| 22:33 | waxrose | TimMc, meh |
| 22:33 | waxrose | TimMc, meh |
| 22:33 | amalloy | TimMc: it's like hearing there's no santa claus |
| 22:33 | amalloy | TimMc: it's like hearing there's no santa claus |
| 22:33 | waxrose | lol |
| 22:33 | waxrose | lol |
| 22:33 | TimMc | But they've got a fun interactive 500 page! |
| 22:33 | TimMc | But they've got a fun interactive 500 page! |
| 22:34 | waxrose | They could at least have the catopus image smile at us |
| 22:34 | waxrose | They could at least have the catopus image smile at us |
| 22:34 | waxrose | or the unicorn |
| 22:34 | waxrose | or the unicorn |
| 22:34 | amalloy | waxrose: octocat |
| 22:34 | amalloy | waxrose: octocat |
| 22:35 | brehaut | is it still oatmeally? |
| 22:35 | brehaut | is it still oatmeally? |
| 22:35 | waxrose | lol |
| 22:35 | waxrose | lol |
| 22:35 | TimMc | Well, I'll push in the morning. G'night! |
| 22:35 | TimMc | Well, I'll push in the morning. G'night! |
| 22:37 | waxrose | night |
| 22:37 | waxrose | night |
| 23:07 | waxrose | And it's back up. |
| 23:07 | waxrose | And it's back up. |
| 23:14 | amalloy | if anyone's interested (waxrose, fliebel), i figured out what the bottom half of that snusp program is doing |
| 23:14 | amalloy | if anyone's interested (waxrose, fliebel), i figured out what the bottom half of that snusp program is doing |
| 23:14 | waxrose | Sure |
| 23:14 | waxrose | Sure |
| 23:15 | amalloy | it converts the internal number holding the sum (say, 15), into two separate numbers, one for each digit in base 10 (so, 1...5) |
| 23:15 | amalloy | it converts the internal number holding the sum (say, 15), into two separate numbers, one for each digit in base 10 (so, 1...5) |
| 23:18 | amalloy | amusingly, it only lets you type two single-digit numbers, so the sum "can't" be larger than 18 |
| 23:18 | amalloy | amusingly, it only lets you type two single-digit numbers, so the sum "can't" be larger than 18 |
| 23:18 | amalloy | but it happily converts anything to a number by subtracting 0x30, so you can add D+H (20+24) and it will print 44 |
| 23:18 | amalloy | but it happily converts anything to a number by subtracting 0x30, so you can add D+H (20+24) and it will print 44 |
| 23:21 | waxrose | Sorry if I respond late, arguing over a group assignment online. |
| 23:21 | waxrose | Sorry if I respond late, arguing over a group assignment online. |
| 23:23 | phenom_ | is there any put-if-absent function on maps ? |
| 23:23 | phenom_ | is there any put-if-absent function on maps ? |
| 23:23 | clojurebot | http://www.math.chalmers.se/~rjmh/Papers/whyfp.pdf |
| 23:23 | clojurebot | http://www.math.chalmers.se/~rjmh/Papers/whyfp.pdf |
| 23:25 | amalloy | phenom_: ninjudd has one in his clojure-useful library |
| 23:25 | amalloy | phenom_: ninjudd has one in his clojure-useful library |
| 23:25 | phenom_ | (defn put-if-absent [map key val] (if (contains? map key) map (assoc map key val))) i guess... |
| 23:25 | phenom_ | (defn put-if-absent [map key val] (if (contains? map key) map (assoc map key val))) i guess... |
| 23:25 | phenom_ | ,(defn put-if-absent [map key val] (if (contains? map key) map (assoc map key val))) |
| 23:25 | phenom_ | ,(defn put-if-absent [map key val] (if (contains? map key) map (assoc map key val))) |
| 23:25 | clojurebot | DENIED |
| 23:25 | clojurebot | DENIED |
| 23:25 | amalloy | or you can roll your own easily enough with (update-in m [k] #(or %1 new-value-to-put)) |
| 23:25 | amalloy | or you can roll your own easily enough with (update-in m [k] #(or %1 new-value-to-put)) |
| 23:26 | DespiteItAll | yeah, assoc/or was my solution |
| 23:26 | DespiteItAll | yeah, assoc/or was my solution |
| 23:27 | DespiteItAll | update-in is less repetitive |
| 23:27 | DespiteItAll | update-in is less repetitive |
| 23:28 | amalloy | phenom_: https://github.com/amalloy/clojure-useful/blob/master/src/useful.clj#L11 |
| 23:28 | amalloy | phenom_: https://github.com/amalloy/clojure-useful/blob/master/src/useful.clj#L11 |
| 23:29 | DespiteItAll | that's a nice collection |
| 23:29 | DespiteItAll | that's a nice collection |
| 23:29 | amalloy | that's my fork of clojure-useful, but i didn't write most of it - it just happened to come up first in my google search :P |
| 23:29 | amalloy | that's my fork of clojure-useful, but i didn't write most of it - it just happened to come up first in my google search :P |
| 23:35 | bytecoder | ,(defn assoc-or [m k v & kvs] (merge (apply hash-map k v kvs) m)) |
| 23:35 | bytecoder | ,(defn assoc-or [m k v & kvs] (merge (apply hash-map k v kvs) m)) |
| 23:35 | bytecoder | ,(assoc-or {:a 1 :b 2} :b 3) |
| 23:35 | bytecoder | just a suggestion - a merge might do the job for you. (merge {:a 1 :d 7} {:a 3 :b 5 :c 6}) for example |
| 23:36 | bytecoder | ,(assoc-or {:a 1 :b 2} :b 3) |
| 23:36 | bytecoder | just a suggestion - a merge might do the job for you. (merge {:a 1 :d 7} {:a 3 :b 5 :c 6}) for example |
| 23:36 | clojurebot | DENIED |
| 23:36 | clojurebot | DENIED |
| 23:36 | clojurebot | java.lang.Exception: Unable to resolve symbol: assoc-or in this context |
| 23:36 | clojurebot | java.lang.Exception: Unable to resolve symbol: assoc-or in this context |
| 23:36 | bytecoder | ,(defn assoc-or [m k v & kvs] (merge (apply hash-map k v kvs) m)) |
| 23:36 | bytecoder | ,(defn assoc-or [m k v & kvs] (merge (apply hash-map k v kvs) m)) |
| 23:36 | clojurebot | DENIED |
| 23:36 | clojurebot | DENIED |
| 23:36 | amalloy | good point bytecoder. merge is reasonable for this |
| 23:36 | amalloy | good point bytecoder. merge is reasonable for this |
| 23:41 | waxrose | amalloy, I think it's interesting how it does all that with so little. |
| 23:41 | waxrose | amalloy, I think it's interesting how it does all that with so little. |
| 23:41 | amalloy | &(merge {:a 1 :c 2} {:a 10 :b 20}) |
| 23:41 | sexpbot | ⟹ {:b 20, :a 10, :c 2} |
| 23:41 | amalloy | &(merge {:a 1 :c 2} {:a 10 :b 20}) |
| 23:41 | sexpbot | ⟹ {:b 20, :a 10, :c 2} |
| 23:42 | amalloy | &(merge {:a 10 :b 20} {:a 1 :c 2}) |
| 23:42 | amalloy | &(merge {:a 10 :b 20} {:a 1 :c 2}) |
| 23:42 | sexpbot | ⟹ {:c 2, :a 1, :b 20} |
| 23:42 | sexpbot | ⟹ {:c 2, :a 1, :b 20} |
| 23:42 | waxrose | amalloy, Is SNUSP turing complete? |
| 23:42 | waxrose | amalloy, Is SNUSP turing complete? |
| 23:42 | amalloy | waxrose: any interesting language is. BF is, i'm pretty sure |
| 23:42 | amalloy | waxrose: any interesting language is. BF is, i'm pretty sure |
| 23:43 | waxrose | amalloy, Now I want to see you do the same in CherryBlossom. :P |
| 23:43 | waxrose | amalloy, Now I want to see you do the same in CherryBlossom. :P |
| 23:44 | amalloy | Use CherryBlossom / Write seasonal poetry / Turing loves it |
| 23:44 | amalloy | Use CherryBlossom / Write seasonal poetry / Turing loves it |
| 23:44 | amalloy | would love it, i guess. silly old "loves" being only one syllable |
| 23:44 | amalloy | would love it, i guess. silly old "loves" being only one syllable |
| 23:48 | amalloy | (if cherryblossom doesn't have anything to do with haikus, i'm not interested) |
| 23:48 | amalloy | (if cherryblossom doesn't have anything to do with haikus, i'm not interested) |
| 23:55 | amalloy | nice, i see that it does |
| 23:55 | amalloy | nice, i see that it does |