#clojure logs

2011-03-08

00:00tomojamalloy: maybe some history at work?
00:00tomoj[bindings then else & oldform]
00:01amalloyoh right, that dang oldform thing. i remember seeing that when i first looked up what if-let did
00:01tomojwhat was the old way, I wonder?
00:02amalloytomoj: (if-let a b x y), i'd guess?
00:04amalloyinterestingly 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:05tomojeh? ##(if-let [a nil] 1)
00:05sexpbot⟹ nil
00:05amalloyhuh
00:05amalloyoh, i had scrolled past that part of the code without ever noticing it existed
05:06clgvDon'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:33raekclgv: 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:34raekan ISeq from a TransientVector sounds weird, since that would imply that you get an immutable, lazy, sequential view over something mutable
05:35raekclgv: you should be able to use nth other functions that works on datastructures rather than seqs to read from it though
06:09clgvok thanks. I had that transient in a "local scope"in my concept but I noticed I still would have to read from it
06:10clgvbut considering the whole scenario, I "seldom" add components to the transient. "seldom" is meant with respect to measured runtime.
06:10clgvso I think I will use a normal vector there
06:11clgvso any possible benefit from a transient in that concrete case is questionable
08:15timvisherhey all
08:15timvisheranyone feel like helping me understand why the following square-root definition is giving me a no method found exception?
08:16timvisherhttps://gist.github.com/860251
08:16timvisherI'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:16timvisherI thought numbers were 'automagical' in Clojure
08:18AWizzArdtimvisher: The function Math/abs only accepts primitives and not a clojure.lang.Ratio.
08:19AWizzArdClojure can not translate from this class to a primitive type automatically.
08:19AWizzArd,(Math/abs (double -1/3))
08:19clojurebot0.3333333333333333
08:20timvisher(ah
08:20timvisherlol-
08:20timvishernot sure why I appended a ( to that
08:20timvisherI'm on 1.2 for clojure and clojure-contrib
08:21timvisherIs clojure.contrib.math available in 1.2?
08:23AWizzArdtimvisher: I don't have 1.2 available here right now, but you could find out yourself by trying to require this lib.
08:30timvisherAWizzArd: that's what I tried. Thanks for your help!
08:31clgvtimvisher: yes it is
08:32clgv,(clojure-version)
08:32clojurebot"1.2.0"
08:32clgvclojurebot uses 1.2.0 himself ;)
08:36timvisherclgv: thanks!
08:36timvisherbye all
08:38clgv&(clojure-version)
08:38sexpbot⟹ "1.2.0"
08:38clgvah sexpbot uses 1.2.0 too^^
08:47__name__&(. Runtime getRunTime)
08:47sexpbotjava.lang.NoSuchFieldException: getRunTime
08:47__name__&(. Runtime getRuntime)
08:47sexpbot⟹ #<Runtime java.lang.Runtime@19f20e5>
08:47__name__&(. Runtime getRuntime availableProcessors)
08:47sexpbotjava.lang.Exception: Unable to resolve symbol: availableProcessors in this context
08:47__name__&(.. Runtime getRuntime availableProcessors)
08:47sexpbot⟹ 4
08:48clgvlol spying on sexpbots hardware ;)
08:48__name__The bot in #scala blatantly lies on that matter.
08:48clgvbut thanks for the processors hint. I could use that toorganize the chunks for one of my pmaps
08:48clgvwhat does it say?
08:48cemerickNote that .availableProcessors reports *cores*, not CPUs
08:49clgvcemerick: thats fine. it doesnt even have to mean real cores since it could be the hyperthreading part as well
08:53raekclgv: pmap already uses that to organize itself. https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L5878
08:55clgvraek: 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:55clgvand I can use the processors count as indication which decomposition makes sense
08:56cemerickclgv: 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:57clgvif 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:57bartjhow can I pick the key which has the maximum value in a hash-map?
08:57bartjwithout first sorting the values, picking the maximum
08:58bartjand then iterating through the map to check if the key is mapped to the maximum value!
08:58cemerickbartj: see max-key
08:58bartjis there a function which already does this?
08:58bartjcemerick, you type fast :)
08:59cemerickclgv: 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:00clgvI definitely know how much data I have. it's N² with N depending on the problem
09:00clgvinstance
09:04clgvis there an idiomatic abbreviation to create chunks?
09:05clgvsomething like (create-chunk size seq)?
09:22choffsteinHey 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:24choffsteinI am making sure that run-jetty doesn't join ... but that doesn't seem to be the issue.
09:24choffstein*compojure, not conjure
09:24dnolenchoffstein: what do your run-jetty line look like?
09:24choffsteindnolen: (run-jetty webservice {:port 8080 :join? false})
09:25dnolentry replacing webservice with #'webservice.
09:26dnolenchoffstein: compojure uses ring which also has a reload handler for development which recompiles namespaces on page load.
09:26choffsteinoh really? didn't know that. thanks ... that may be very useful
09:27yazirianchoffstein: this may also help https://github.com/mmcgrana/ring/wiki/Interactive-Development
09:27yazirianthe magic part is the var
09:27yazirianso i guess i just said the same thing heh
09:28yazirianbut that link also was really helpful to me figuring out how not to lose my repl to jetty :)
09:31choffsteinthanks yazirian, i'll check it out
09:35angermanhas anyone toyed with Catmull Clark subdivision? I'm having an issue with the weights.
09:36angermanClojure+JReality (movie): http://t.co/nIoMXBr
09:36angermanThe problem I'm having is that the first iteration is not convex and looks quite /strange/ so to say.
09:38angermanThe 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:38choffsteinHuzzah! It works!
09:38choffsteinThanks for the help guys.
09:39choffsteinNow to just become a power Emacs user ... that should be easy, right ;)
09:40angermanchoffstein: of course, emacs is a piece of cake :)
09:42yazirianoh 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:45danlarkingross names but so useful :)
09:45jkdufairyazirian: good luck!
10:03losternWhat should I be using to debug java with emacs? GUD? jdibug?
10:11raekchoffstein: my emacs workflow when developing with ring: http://groups.google.com/group/clojure/browse_thread/thread/4d8a1fc669a5a2df/5e754ed31361c09d?lnk=gst&amp;q=better+work+flow#5e754ed31361c09d
10:12choffsteinawesome! thanks
10:28klangraek: are you doing any testing of the web applications you develop?
10:30raekwell, I should have done more... :-)
10:30raekbut I have done unit tests for some middleware
10:32klangraek: 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:33klang.but now I want to finish that work, and I am surveying the state of web-development in clojure ..
10:35klang.. nobody is making tests for web-applications it seems .. ring.mock is the closest I have found until now ..
10:36raektests for middleware should be fairly simple if the middleware is free of side-effects
10:37klangtrue, 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:29waxroseGreetings all.
12:29TimMcey
12:30waxroseTimMc, Howdy partner. :D
12:30TimMcI'm hoping to convince my Comp Arch prof to let me use Clojure for the semester project,
12:30TimMcwhich is an instructor set simulator for MIPS.
12:30waxroseehh
12:31waxroseGL, hopefully he's not arrogant and open to new ideas.
12:31TimMcI think it'll actually be really easy, and as a bonus, I can make it reversible with hardly any extra work.
12:31waxroseWhat option would you have to do if you were not able to?
12:32TimMcHe'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:32TimMcThe "supported" languages are Java and C++.
12:32waxrosedefacto
12:33waxroseBut at least technically in some way Clojure is near that domain, so you might get away with it.
12:33TimMcSo 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:33TimMcOh, and he has explicitly forbidden LOLCODE already. :-P
12:34waxroseOh, that's coming soon. >.<
12:34waxroselol
12:34waxroseLOLCODE haha
12:35waxroseWhat are the actual requirements of the project?
12:35waxroseJust any simple application?
12:36TimMcwaxrose: https://myfiles.neu.edu/mccormack.t/EECE3230-project.pdf
12:37waxrose:P
12:39waxrosewow, this looks awesome. If only my classes actually had some "difficulty" put into them
12:39angermanI 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:40angermanhmm. ok. maybe cycle, rest, interleave, partition.
12:40TimMcangerman: You have a collection of triangles (each represented as a list of vertices) and want to find adjacencies?
12:41TimMcI assume they're all CCW?
12:41angermanTimMc: kind of. not necessarily triangles though.
12:41TimMcOK
12:41waxroseTimMc, 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:41angermanwell, yes. the faces should be oriented consistently
12:42angerman,(partition 2 (interleave '(a b c d e) (rest (cycle '(a b c d e))))
12:42clojurebotEOF while reading
12:42angerman,(partition 2 (interleave '(a b c d e) (rest (cycle '(a b c d e)))))
12:42clojurebot((a b) (b c) (c d) (d e) (e a))
12:43TimMcOh, I see -- you know two vertices and want to find the faces for it.
12:43angermanI know the edge.
12:44joshua__That project is awesome.
12:44angerman,(some #{'(e a)} (partition 2 (interleave '(a b c d e) (rest (cycle '(a b c d e))))))
12:44clojurebot(e a)
12:44TimMcIt's a decent project, even though it's not a new application.
12:45TimMcI'm hoping to abstract out the logic pipeline manager, though. That could be new!
12:45angermanthat feels a little a little heavy :/
12:45angermanTimMc: what Project?
12:45TimMcangerman: https://myfiles.neu.edu/mccormack.t/EECE3230-project.pdf
12:46waxroseYeah, I've never done that before. Sounds like fun though. I may use your project and work on it on my own. :D
12:47TimMcI'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:48TimMcCrap, I just remembered that there won't be a register between each consecutive set of blocks... need to rework this a bit. :-)
12:49TimMcangerman: So you just want to see if '(x y) is in (cycle '(a b c d e))?
12:49angermanyep
12:49angermanthe approach I picked above is, well … it feels like it a lot of plumbing.
12:50TimMcpartition has a way of getting overlapping chunks
12:50TimMc,(partition 2 1 '(a b c d))
12:50angermanTimMc: I'd still need to interleave it.
12:50clojurebot((a b) (b c) (c d))
12:50angermanohh, nice.
12:51TimMcAnd then tack on the missing wrap-around.
12:51angermanhmm. still need one more element.
12:51TimMc,(partition 2 1 ['a] '(a b c d))
12:51clojurebot((a b) (b c) (c d) (d a))
12:51TimMcSo, (partition 2 1 (first verts) verts)
12:52angermanyep
12:52TimMcErr, wrap (first verts) in a list.
12:53amalloypartition-all?
12:54amalloyoh haha that's what i get for answering without reading the whole convo so far
12:54TimMcamalloy: Not this time, I think.
12:54waxrose:)
12:54TimMcAmusingly, the only two times I've wanted partitioning, partition-all has *not* been the right answer.
12:55amalloy&(let [list '(a b c d)] (partition 2 1 (cons (last list) list)))
12:55sexpbot⟹ ((d a) (a b) (b c) (c d))
12:55angermanoh, hmm good to know that I messed up my cube, … it's not oriented consistently
12:56TimMc(Actually, either one would have worked the first time, since I was checking mod count.)
12:56angermanamalloy: but(!) calling last on a list takes longer htan calling first
12:56angermanunless i missed something… it's cons cells in my head after all.
12:56amalloyit looks like TimMc has come up with all the good solutions. all that's left for me to propose are bad ones, angerman
12:57angermanamalloy: I see. At least there are multiple solutions :D
12:57amalloythere's more than one way to do it...but not as many as there are in perl
12:57TimMchaha
12:58waxrose:D @ perl
12:58angermanperl.
12:58waxroseSeemed 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:00waxrose__name__, No....
13:01waxrosebut I would expect that if you are a speaker, that your application would at least 1% work
13:01TimMcOK, I should split this pipeline thingy off as a separate project.
13:02pyrhi
13:02waxrosepyr, Hello. :)
13:03waxroseTimMc, Let me know how it goes.
13:03waxrose:P
13:03__name__waxrose: It's Ruby hipsters after all.
13:04__name__I wish Inkscape did not suck.
13:04TimMc(That's a lie, I don't know Ruby at all. I just like that word.)
13:04waxroseWhy?
13:04clojurebothttp://clojure.org/rationale
13:04pyrI'm working with a java lib that has the following prototype: public long foo(final String... bar) {
13:05TimMcpyr: Last arg should be passed as an array, I think, if that's what you're asking.
13:05waxroseI started joining the Ruby band wagon till I realized it was more band than wagon.
13:05drewrand reefer
13:05pyri don't see how i can call it (.foo object "something")
13:05pyrfails
13:06pyrok i'll try with an arg
13:06pyrs,arg,list,
13:06TimMc,(to-array ["hello" 5])
13:06amalloypyr: String[]
13:06clojurebot#<Object[] [Ljava.lang.Object;@76ef7b>
13:07amalloyTimMc: that's no good. you want into-array
13:07amalloy&(into-array ["hello"])
13:07sexpbot⟹ #<String[] [Ljava.lang.String;@af9dc4>
13:07TimMc,(into-array String ["hello" "foo"])
13:07clojurebot#<String[] [Ljava.lang.String;@668893>
13:07pyrerf
13:07TimMcamalloy: Oh, fancy! It determines the most specific type?
13:07amalloyhaha you wish
13:07amalloyit determines the first type
13:08TimMc:-(
13:08amalloy&(into-array ["Test" 1])
13:08sexpbotjava.lang.IllegalArgumentException: array element type mismatch
13:08TimMcbah
13:08pyryay
13:08pyrgot it
13:09amalloyTimMc: but you could write one that determines the most specific type without too much difficulty
13:10TimMc(defn fancy-array [arr] (into-array (gcd arr) arr)))
13:10TimMc:-P
13:11TimMc,(into-array [])
13:11clojurebot#<Object[] [Ljava.lang.Object;@1871392>
13:12pyr,(into-array ["h"])
13:12clojurebot#<String[] [Ljava.lang.String;@e95a23>
13:12pyr,(into-array String ["h"])
13:12clojurebot#<String[] [Ljava.lang.String;@1297ee0>
13:12pyrconvenient
13:17TimMcwaxrose: https://github.com/timmc/pipeline
13:17TimMcLong way to go.
13:18waxroseWell it's a start. :D
13:20waxroseI 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:22waxroseYou just wrote this?
13:22TimMcThis morning, yeah.
13:23TimMcIt doesn't run yet, of course.
13:23TimMcUgh, I'm going to need to do a topological sort or something.
13:23TimMc(I mean, yay!)
13:24waxroselol
13:25waxroseBetter than what I can do though. I'm still working my way through all this Lisp-oriented material I've collected.
13:26amalloyTimMc: what is this pipeline business?
13:27TimMcamalloy: For a semester project in Comp Arch, we have to write a machine code simulator.
13:27waxroseTimMc, I wish my classes were like that.
13:28TimMcI'm writing a logic pipeline utility that I can then pass all my actual data path and control path functions.
13:28waxroseIs this an undergrad class?
13:28TimMcyeah
13:28waxroseBig university?
13:28TimMcFrom what I understand, though, this is the best prof to teach this class in a while.
13:28TimMcPretty big, I guess. Northeastern University, if you want to look it up.
13:29waxroseI 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:29TimMchaha
13:29waxroseI feel left out!
13:30TimMcI actually dropped this class last semester because the prof was... not good.
13:30amalloywaxrose: just write a compiler in your spare time
13:30TimMcI won't complain in specifics in a public channel.
13:30waxroseamalloy, I have some material on how to write a scheme compiler and a BF interpreter. I just need to go through them.
13:31amalloywaxrose: BF is boring. go whole hog with SNUSP
13:31waxroseTimMc, It's fine.
13:31amalloyi have a SNUSP interpreter i wrote in java, somewhere
13:32waxroseamalloy, Lol @ first link from google says.. "beautiful insanity".... sounds like my type of fun
13:32TimMcwaxrose: Writing a MIPS simulator is... not new. Write something new!
13:32amalloyTimMc: the only CS class i ever dropped was because it was taught in lisp and i didn't get it
13:32TimMcaw
13:32amalloythe story gets more and more ironic as i get into clojure
13:33waxroseTimMc, I'll do it just to get it out of the way! :D
13:33TimMc"You'll never make it as a LISPer, amalloy!"
13:33amalloysrsly
13:33TimMcI never would have guessed. THat's pretty funny.
13:34waxroseamalloy, Lisp is actually the first language I've understood the first time I started reading about it.
13:34waxrosenot sure why
13:34amalloywaxrose: first one i *didn't* get on my first try. maybe that's why it's so interesting
13:34TimMcDid either of you have a strong algebra background before encountering LISP?
13:34TimMcalso, a strong programming background?
13:34amalloyyessss
13:35amalloyTimMc: 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:35amalloybefore dropping out of my scheme class
13:36TimMcThe 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:36amalloyinteresting
13:36TimMcOr a math background in general, I guess.
13:36waxroseTimMc, 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:37TimMcI had been using JS in a functional style before hitting Scheme, so it wasn't too hard of a transition.
13:37amalloyi guess i can see that
13:37waxroseOOP confuses me, but for some reason functional programming makes sense to me.
13:37amalloyheh, damn you lisp! trying to write some php and after every newline my fingers type (
13:37waxroselol
13:38Adamantah, Shivers
13:38waxroseIf 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:38waxrosescripts*
13:39TimMcAdamant: Had him as a prof, or know him from his work?
13:39AdamantTimMc: know him from his work and Usenet postings
13:39Adamantwhich were hilarious
13:39TimMcheh
13:40TimMcI've read some of his rant collection. Good stuff.
13:40Adamantthe one about firearms and academia was a creative writing classic
13:40waxroseTimMc, My previous school focused on Cold Fusion. :/
13:40AdamantUNCLEAN! UNCLEAN!
13:40Adamant:P
13:40amacwaxrose: dude, eww
13:40waxroseTell me about it.
13:40Adamantit's ok. my first language was Visual Basic.
13:41waxrosehaha
13:41amalloyAdamant: i tried visual basic after writing a bunch of TI-Basic. confused the crap out of me
13:41waxroseI didn't actually pay attention in the classes, so I don't remember anything from CF.
13:41AdamantI shit you not. fortunately I didn't absorb too much
13:41amacmy first was qbasic...
13:41Adamantamalloy: I bet
13:41TimMcFor 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:41AdamantVisual Basic was it's own kind of weird thing
13:42TimMcTI-89 was my first, if you don't count screwing around with DOS batch files.
13:42TimMcI spent a lot of time bored in "pre-calc" class.
13:42amalloyTimMc: i actually found the TI-83 a lot more conducive to writing games than the 89
13:43waxroseI remember people playing Doom on their TI-xx.
13:43amalloythough i eventually invented OOP on the 89 without knowing what it was called :P
13:43TimMcamalloy: Me too!
13:44TimMcThen I learned about Java and kicked myself.
13:44waxroselol
13:44amacsadly, there's no qbasic channel on freenode
13:44waxroseI knew a little Java prior to finding Clojure, mainly because I've done mobile web apps before.
13:44amalloyamac: /join #qbasic. now there is!
13:44waxroselol
13:44amacI just did
13:45amacnow I must build a thriving community
13:45waxroseGL bro
13:45amachah
13:45amalloywaxrose: i found the cvs repo for my SNUSP interpreter if you're interested
13:45Adamantamalloy: that happens all the time. lots of assembly programmers sort of informally figured out the basics of structuredimperative programming on their own
13:46waxroseamalloy, Sure! Also, why SNUSP and not BF?
13:46amalloywaxrose: snusp is BF but with more stuff
13:46amalloyand the 2d programming model is like whoa hilarious
13:46waxrosemore features
13:46fliebelamalloy: 2D programming?
13:46waxroseShoot me the link, I'll add it to my list of things to read.
13:46amalloyfliebel: a snusp program is a diagram
13:47amalloywaxrose: i have to remember how to use cvs first
13:47waxroselol
13:47fliebelamalloy: I just dropped in… *googles snusp*
13:47waxroseI know how.
13:48waxrose-_- and now bzr
13:48amalloywaxrose: yeah but you don't have ssh access to my server :P
13:48waxroseoh
13:48waxroselmao
13:48amalloyi checked it out, exporting to github shortly
13:48TimMcAdamant: 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:48waxrosekk
13:50amalloyhttps://github.com/amalloy/snusp
13:50waxroseTimMc, That is an awesome page. haha
13:50waxrose"I did it all by myself!"
13:50amalloyno guarantees about how useful it is, i haven't looked at the source for ~3 years
13:50TimMcwaxrose: Now imagine how new students feel when they stumble across that page. :-P
13:50waxroseamalloy, I like junk code, scrapped projects.
13:51waxroseTimMc, I would imagine that would motivate them!
13:52amalloyomg that is quite a page
13:52phenom_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:52waxroseamalloy, I followed you so I won't forget to clone it.
13:52phenom_like in this example: http://stackoverflow.com/questions/2760017/producer-consumer-with-qualifications
13:55AdamantTimMc: oh yeah.
13:56amalloyfliebel: 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:58amalloyoh durrr no they're single digit
13:59fliebelamalloy: Whoa, that looks like a monster of code!
14:00amalloyfliebel: tbh i have no idea what the whole bottom half of the program is for
14:00waxroseamalloy, that looks like a tractor or some farming equipment. >.<
14:00clojurebotamalloy: therfor I return [previous] if rest is empty
14:00fliebelamalloy: Could it be the actual adder?
14:01amalloyfliebel: no, the adder is the first loop on the left, starting with ~/==?
14:01amalloyer, !/==?
14:01cemerickamalloy: thank you for alerting me to SNUSP
14:01waxroseInteresting language.
14:01waxroseSNUSP looks like it will be fun.
14:02amalloysomeone has an interactive snusp debugger/interpreter in javascript which could help explain what that enormous pile of -\!?/ is for
14:03amalloyi think it may be a copy instruction: "copy memory location N to location N+1"
14:03klangTimMc: what other material are you MISP project (if I may be so bold)
14:04waxroseamalloy, The hello world for SNUPS looks crazy.
14:05amalloywaxrose: iirc any BF program can be run as a SNUSP program: SNUSP is the C++ to BF's C
14:05klangTimMc: .. inject a "using for the" somewhere logical in that last sentence, please
14:05amalloyso you could use the BF hello
14:05waxroseWhat is a good beginning reference for SNUSP?
14:06waxroseamalloy, Thanks for clarifying.
14:06amalloyhttp://esoteric.voxelperfect.net/wiki/SNUSP ?
14:08amalloyor maybe http://www.c2.com/cgi/wiki?SnuspLanguage
14:09cemerickI always go for esolangs: http://www.esolangs.org/wiki/SNUSP
14:09amalloyANYWAY sorry for bringing such a disgusting language into #clojure, i don't even remember how it came up
14:09cemerickBut, that's only because I'm a dilettante :-P
14:09amalloycemerick: my first link seems to be a mirror of the esolangs
14:10cemerickamalloy: don't apologize, I was happy to learn of it
14:10amalloybut yours is certainly canonical
14:10amalloycemerick: it's really a psuedo-apology
14:10amalloyi'll probably tweet this shit up too, now that i've put it on github
14:10cemerickat first, I thought it was logic programming via ascii circuit diagram
14:11waxroselol
14:11waxroseI think it was brought up because I mentioned BF.
14:12amalloycemerick: it almost is
14:14Adamant2-D programming is neat. so is heavily Unicoded programming and math equation simulation with ASCII/Unicode type stuff
14:16cemerickEven better is programming that doesn't rely upon text at all.
14:16cemerickBut, I'm repeating myself now.
14:21amalloywaxrose: 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:22waxrose:/
14:23waxrosegotta love it
14:23amalloybut at least i learned how to use cvs2git. now i can run that on all my old repos
14:23waxrosehaha
14:23waxrosetrue
14:23waxroseSee, some good came out of it.
14:23amalloyindeed
14:26waxroseI'm glad Google finally accepted me into their storage preview. Now I can start my Clojure web application on GAE.
14:27waxroseAny of you using a web framework?
14:28waxroseI think I'm going to go with Compojure.
14:29amacI don't see compojure as a framework so much as a sexiness layer for ring
14:30raekI see it as a route library for ring
14:30raeklol
14:30semperos+1 for Moustache
14:30raekI like this overview http://www.glenstampoultzis.net/blog/clojure-web-infrastructure/
14:32waxroselol
14:32raekinc for the modularity of the clojure web stack
14:33amalloy(inc clojure)
14:33sexpbot⟹ 3
14:33waxroseWhich SQl implementation is the most popular?
14:33companion_cubemysql, postgresql...
14:34waxrose>.>
14:35waxroseClojureSQl
14:35raekClojureQL seems popular
14:37waxroseamalloy, Probably not holding the shift long enough.
14:37waxrose>.<
14:37waxroseI didn't even realize. haha
14:37waxroseI type too fast, so I have a tendency to typo a lot.
14:38waxroseAND not notice.
14:42LauJensenraek: its the bomb :)
14:49TimMcklang: The MIPS thingy will need the logic pipeline and an extremely simple assembler. Oh, and some logging, I guess.
14:54klangTimMc: I was wondering if you were following a book or more .. custom-designed course notes?
14:56TimMcklang: It's for a class. We're using the classic textbook Computer Organization and Design.
14:57TimMcI don't know the material yet for the 5-stage pipeline architecture we'll be using, but I *think* the book describes it.
14:59klangTimMc: that's probably a very good guess :-)
15:00AdamantTimMc: suggestion - if you want to get more into the hardware end, Computer Architecture by the same guys is also good
15:00AdamantCOD is partially a rehash of CA, partially a simplification, and partially new material
15:00TimMcAdamant: Thanks, but I really don't. :-P
15:00Adamantfair enough :)
15:00bartjIf there is a hash-map like: {:a 1 :b 2 :c 3}
15:01bartjwhat is the idiomatic way to create: {:a 10 :b 20 :c 30}
15:01TimMcThe prof's work is vaguely interesting, though -- he's doing software (kernel) design for many-core architectures.
15:01bartjinstead of doing: (zipmap (keys ) (map #(* % 10) (vals))
15:01amalloybartj: fmap is one way, or clojure.walk/walk should work
15:02TimMc,(apply concat (seq {:a 1 :b 2 :c 3}))
15:02clojurebot(:a 1 :b 2 :c 3)
15:03klangTimMc: 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:03TimMcThat's probably not lazy, though, if you care.
15:03amalloy&(walk (fn [[k v]] [k (* 10 v)]) identity {:a 1 :b 2 :c 3})
15:03sexpbot⟹ {:a 10, :b 20, :c 30}
15:03amalloyTimMc: maps can't be lazy anyway
15:03TimMcbartj: Sorry, I missed the multiplication part.
15:04bartjer, that's fine!
15:04raek,(let [m {:a 1 :b 2 :c 3}] (into (empty m) (for [[k v] m] [k (* 10 v)])))
15:04clojurebot{:a 10, :b 20, :c 30}
15:06amalloyraek: i wonder why clojure.walk/walk doesn't just use (empty blah)
15:06amalloy&(empty [1 2 3])
15:06sexpbot⟹ []
15:07amalloycause it looks like the whole thing could be (defn walk [inner outer form] (outer (into (empty form) (map inner form))))
15:08raekor perhaps...
15:08raek,(let [m {:a 1 :b 2 :c 3}] (into (empty m) (map (juxt key (comp (partial * 10) val)) m)))
15:08clojurebot{:a 10, :b 20, :c 30}
15:08raekthat one's for you, amalloy
15:08amalloy*laugh*
15:09TimMcThat is much more readable!
15:10TimMcOh man, I forgot that key and val were functions.
15:12amalloyTimMc: you don't really need them. you can use first and second
15:13amalloyraek: i'm sad to see "m" appearing twice. you could surely do better with something like (apply into ((juxt empty (partial map ...)) m))
15:14TimMcamalloy: You, sir, are an instigator.
15:15waxroselol
15:15amalloyTimMc: point-free ftw
15:15TimMcIt's really a form of golf, isn't it?
15:16amalloyyes, except that you don't get shorter code
15:20dnolenfliebel: finally I found a clue, https://gist.github.com/860912 for the arithmetic issue.
15:29fliebeldnolen: Great you found something! I don't really understand the gist though.
15:31fliebelWhat is f? What is letrec? Where is the hyphen in cond-e?
15:31amalloyfliebel: do you have a link to your gist with the take-random or whatever it was?
15:32dnolenfliebel: 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:33fliebelamalloy: "or whatever it was" You're just asking for a random gist?
15:33TimMcfliebel: letrec allows the val-expr to be evaluated in a context where the name is bound.
15:34amalloy*laugh*
15:34amalloyfliebel: no, the take-randnth thing
15:34amalloycouldn't remember what we were calling it at the time
15:34fliebelamalloy: One moment please… Trying to understand dnolen and TimMc first.
15:35TimMcIt's just a fancy way to create recursive expressions.
15:35TimMcs/fancy //
15:35sexpbot<TimMc> It's just a way to create recursive expressions.
15:35dnolenfliebel: the gist is from the latest Scheme miniKanren.
15:36sritchie_hey all -- has anyone here had success with marginalia 0.5.0?
15:36sritchie_I'm getting this error, and am not sure how to debug -- clojure.lang.PersistentVector cannot be cast to clojure.lang.Symbol
15:36dnolenlooks 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:37fliebeldnolen: What is thunk'ing in this context? Does it has anything to do with ChunkedSeq?
15:38dnolenfliebel: no it just means delaying a computation by wrapping it in function that takes no args.
15:38fliebelah
15:39fliebelamalloy: https://gist.github.com/805747
15:39amalloyfliebel: there it is, thanks
15:40fliebelamalloy: Why do you need it?
15:41amalloyfliebel: came across a question on SO about functional shuffling techniques
15:47amalloyfliebel: 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:49TimMcwaxrose: 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:49raeksritchie_: you only get that when running marginalia and not otherwise? is the exception coming from within marginalia or your code?
15:49waxroseTimMc, kk, checking it out now
15:49TimMcwaxrose: I'll be using some of the same techniques to make the pipeline utility, since both involve updating the nodes of DAGs.
15:49sritchie_raek: just marginalia
15:50sritchie_my code compiles fine
15:50sritchie_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:50TimMc(cascade.clj is for side-effects; the pipelineis all functional)
15:52sritchie_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:55raekhrm. maybe it's a bug in marginalia
15:56brehautmorning everyone
15:57TimMchey, brehaut
15:58fliebelamalloy: There are images of the graphs on my blog if you want.
15:59waxroseTimMc, 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:00brehautwaxrose: 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:01waxrosehmm
16:02sritchie_raek: I'll post an issue later today
16:05amalloywaxrose: 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:05amalloyand trees are substantially easier to work with than generalized graphs
16:06__name__amalloy: Do you have a blog?
16:08waxroseamalloy, Thanks for explaining further.
16:08brehautwaxrose: DAGs also have useful properties for constructing concurrent systems
16:09brehautwaxrose: each node in your graph is a computation that depends on the results of the nodes that feed into it
16:09amalloy__name__: http://hubpages.com/profile/amalloy is the closest thing
16:10__name__Thanks :)
16:10__name__I subscribed to your rss :)
16:10amalloyenjoy!
16:12TimMcwaxrose: 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:12waxroseah!
16:13waxroseOkay, thanks for explaining guys. Makes more sense now.
16:13TimMcNow, 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:14TimMcI chose to create something to manage those dependencies and only call the updater thunks when necessary.
16:15TimMcBy 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:17TimMcwaxrose: 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:18TimMcThe :all node is a hack; I should have a clean-all function in cascade that knows how to get the leaf nodes.
16:19waxroseAnd you will be doing similar to the pipeline application? or am I confused?
16:20waxrosesome what similar*
16:20TimMcSort of similar. The pipeline itself is pure functional, so I can probably use memoization.
16:21waxroseOr rather, applying the similar concepts I mean.
16:22TimMcIn 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:23waxroseAh, okay.
16:23waxroseI vaguely remember DAGs but can't remember from where.
16:23waxroserefresher course haha
16:26TimMcBonus: Look up "topological sort". It's a useful companion to DAGs.
16:28waxroseThanks, I'll look into it after my Robotics class.
16:41amalloyTimMc: this reminds me of partially-ordered sets
16:57TimMcamalloy: I suppose so. I've never studied them, though.
16:58amalloythey're a handy tool for the sort of thing you seem to be doing, like job scheduling
17:04semperosbrehaut: you still around?
17:04brehautsemperos: yeah
17:04semperosbrief pm?
17:10scottjwhen 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:11brehautscottj: that isnt going to do what you want
17:12brehautoh actually, it might, but its a horrible hack :P
17:13scottjit works, I guess this might be better:
17:13scottj,(-> 4 (->> (do (Thread/sleep 10))) -)
17:13clojurebot-4
17:16__name__&(. Runtime exec "echo random stuff")
17:16sexpbotjava.lang.IllegalArgumentException: No matching method: exec
17:19brehautscottj: by threading do you mean capital T threads or the -> macro?
17:20scottj->
17:20scottjsorry my side-effect example made that confusing :)
17:24brehautyeah it did :)
17:38semperosclj-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:38semperosI have a similar need, to use a namespace for various and sundry things
17:38semperosis the way clj-record handles that need idiomatic? are there alternatives?
17:43amalloyscottj: doto?
17:47scottjamalloy: I don't think that's a solution
17:48amalloyyeah, if you want to totally ignore i guess do is your best bet
17:48amalloybut eg ##(-> 1 inc (doto println) inc)
17:48sexpbotjava.lang.IllegalArgumentException: Bad binding form, expected vector
17:48amalloyhuh
17:49amalloy,(-> 1 inc (doto println) inc)
17:49clojurebot2
17:49clojurebot3
17:49amalloysigh. one more thing to fix in the sandbox i guess
17:52patrkriswhat are people mostly using for HTML in clojure web apps? enlive? hiccup?
17:53semperos+1 for enlive
17:53brehautpatrkris: i dont think anyone has done a survey
17:53brehautthey are both popular though
17:54semperosif you want to write your HTML in Clojure data structures, then use hiccup
17:54brehautif 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:54brehautpatrkris: but i use enlive myself
17:55patrkrisi read somewhere that cgrand is cooking up something for filling in data in html forms with enlive
17:55patrkrissomething i think i bred
17:56patrkris*need - effin iPhone
17:56lpetitpatrkris: I would invest in enlive.
17:56brehautpatrkris: i believe there is something like that in the roadmap
17:57patrkrislpetit: care to elaborate?
17:57lpetitpatrkris: I like the concept more.
17:58patrkrislpetit: I think I agree
17:58scottjthey're not mutually exclusive are they? can't you write your html in hiccup and then use enlive to stick stuff in it?
17:58patrkrisi think you can
17:58semperosit's a bit round-about, as you're going from hiccup-data-structure to HTML string to Enlive data structure
17:58lpetitprobably
17:59semperosbut 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:59brehautpatrkris: 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:59lpetityou also probably can use hiccup in some places, and enlive in other places, in the same app
18:00lpetitAnd investing in enlive also opens the door of xml transformation, selection, etc.
18:00patrkrisbrehaut: i agree - and I think I prefer writing HTML in HTML
18:01patrkrislpetit: any advice/tips/tricks on handling HTML forms with enlive?
18:02lpetitpatrkris: no, sorry, that's why I said "I would". I have not written webapps recently
18:02brehautpatrkris: 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:02patrkrisok
18:02patrkrisexactly, brehaut
18:04patrkrisi 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:04semperosif you're looking to deal with forms (fill out and submit), you can use Java's HtmlUnit headless browser
18:04semperosif you're not opposed to graphical browser, you can also use WebDriver to do the same
18:05patrkrissemperos: not that, but thanks :)
18:05semperoson the front of authoring forms, the Sandbar library has things to add
18:06patrkrisyeah, but as far as I know, it generates the HTML for you, given a form spec in Clojure?
18:07lpetitpatrkris: 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:08weavejesterHi folks
18:08patrkrisweavejester: just the man - we're talking about enlive vs hiccup
18:08patrkrisand web forms in general
18:08weavejesterYou can probably guess where I fall in that debate ;)
18:08weavejesterWell... I guess it really depends on what you want to do.
18:09patrkrisi'm thinking about forms specifically
18:09patrkrise.g. repopulating form fields on postback
18:10weavejesterI've been meaning to add in a binding form to Hiccup to do that automatically
18:10weavejesterSomething like...
18:10patrkrisbut also other concerns, such as validation, which I believe you had in compojure once
18:11weavejester(with-params {:x "x"} (text-field :x))
18:11scottjsandbar definitely has some validation stuff
18:11patrkris(i'm a slow writer on an iPhone)
18:11scottjweavejester: didn't pre-split compojure have that?
18:12weavejesterYeah. pre-split compojure had something like a with-params macro. Not sure if that was the name.
18:12weavejesterIt also had some validation, but it wasn't very good.
18:12patrkrisscottj: yeah, but I think sandbar wants to generate specific html for you?
18:13weavejesterI've been thinking about creating a functional validation library.
18:13scottjpatrkris: I don't know
18:13patrkrisweavejester: the form element functions were to tightly coupled to validation?
18:13weavejesterI think a lot of my early stuff was too tightly-coupled.
18:13lpetitHmm, from the example I'm seeing, sandbar form validation doesn't help a lot to separate concerns ?
18:13scottjweavejester: did you ever take a stab at csrf protection?
18:13weavejesterToo used to OOP
18:13weavejesterOh
18:14weavejesterNo, I forgot about CSRF middleware
18:14lpetitcall to db/find-user inside the form declaration, etc.
18:15patrkrislpetit: my impression also
18:15scottjweavejester: ok, if you have the time and inclination I'll definitely upgrade from .4 for that :)
18:15weavejesterscottj: I'll try and get it done this week
18:15weavejesterIt should be pretty straightforward
18:15weavejesterI have a quick question unrelated to web forms and validation
18:16weavejesterGiven that fn is a special form...
18:16weavejesterit would probably be a bad idea to override it, right?
18:16amalloyweavejester: if it were actually a special form it would be impossible to override
18:16amalloybut it's a macro somewhere that reduces to fn*
18:17weavejesterYeah, but it's listed as a special form in the docs
18:17weavejesterI was making a macro that turns a template into a function.
18:17amalloyyeah, the docs in my experience mostly lie about special forms :P
18:17weavejesterLike: (template/fn [x] "foo<% x %>")
18:17weavejesterWhich is equivalent to: (fn [x] (str "foo" x))
18:18weavejesterBut even though I *can* override fn, should I?
18:18amalloyi'd just call it template
18:18amalloyor template-fn or fn-template or...
18:18weavejesterWell, I also have (template/eval "foo<% x %>" {:x "bar"})
18:19weavejesterWhich is equal to "foobar"
18:19amalloyfor one, naming it fn will make it possible for someone to (use) your namespace without resolving conflicts with c.core
18:19amalloy*impossible
18:19weavejesterYeah, but clojure.string also shouldn't be :used
18:20patrkrislater guys
18:20weavejestercya
18:21weavejesterI like the idea of using foo/bar over foo-bar
18:21weavejesterBecause users can potentially shorten it
18:21weavejesterAnd it seems more idiomatic
18:22amalloyweavejester: you're probably right
18:22amalloythough of course users could shorten it anyway with :use/:rename
18:22weavejestertrue
18:22weavejesterI guess I was thinking of functions like clojure.set/join and clojure.string/join
18:23weavejesterThe function name is very generic
18:23weavejesterIt's just the namespace that distinguishes the use
18:23amalloyin my head, those are okay because there are already existing uses of "join" to mean both of those things
18:23brehautweavejester: i think that is sound
18:23brehaut(not that my opinion carries any weight)
18:24raek,`fn
18:25clojurebotclojure.core/fn
18:25amalloy,`fn*
18:25clojurebotfn*
18:25weavejesterYeah, though there is a problem in extend-type and extend-protocol
18:25weavejesterThey have 'fn, rather than `fn
18:25weavejesterIn their code generation
18:26weavejesterI'm trying to decide if that's a bug, or if I'm abusing fn :)
18:27amalloycould be both :)
18:27weavejesterHaha - true
19:13TimMcGah, I keep typing guthub.com -- pretty sure I don't want to see whatever's there.
19:13technomancyI type guthub all the time
19:13technomancyon purpose though
19:13technomancyit's a redirect
19:14TimMcOh good.
19:14technomancycarry on.
19:26brehautis there an stdlib equivalent to (defn first-of [arguments fns] (first (keep #(apply % arguments) fns)))
19:26brehaut ?
19:26brehaut(and if not, what is a better name for that)
19:29brehautwhere (first-of [{:b 1}] [:a :b :c]) => 1
19:49fstephehello?
19:49clojurebotBUENOS DING DONG DIDDLY DIOS, fRaUline fstephe
19:49fstepheSorry this is my first time on IRC
19:49fstepheI have found what looks like a bug in the contains? functiopn
19:50TimMcfstephe: Perhaps because contains? is ill-named
19:50fstepheah, ok
19:50technomancyclojurebot: contains?
19:50clojurebotcontains? 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:50fstepheok, but I am checking for the presence of a Number in set
19:51technomancyah yeah, that's a subtle JVM interop question
19:51TimMcfstephe: Ooh, is this an int vs. long problem?
19:51fstephea hashset specifically
19:51fstephehaha
19:51fstepheit is
19:51technomancyJava's hashing semantics are all shot to hell.
19:51fstepheit is the BigInt vs long
19:51technomancywhen it comes to numerics
19:51fstepheyes, it is true that Rich has made a really heroic effort to unify the numbers
19:52technomancyit'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:05TimMc__name__: UK?
20:05__name__TimMc: Nope, AT.
20:05TimMc?
20:05__name__Austria.
20:05TimMcOh jeez, yeah, you should get to sleep.
20:06__name__\+ 1 2 3/
20:07__name__Bye.
21:22phenom_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:22phenom_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:23brehautphenom_: depends if you need / want it to be extensible
21:23brehautphenom_: depends if you need / want it to be extensible
21:34TimMcphenom_: You should be able to turn it into a multimethod later.
21:34TimMcphenom_: You should be able to turn it into a multimethod later.
21:42ossarehhola clojurians
21:42ossarehhola clojurians
21:42ossarehhope to see some of y'all at the SF meetup tomorrow!
21:42ossarehhope to see some of y'all at the SF meetup tomorrow!
22:03amalloyossareh: you'll be waiting a long time. try coming on thursday instead of tomorrow :)
22:03amalloyossareh: you'll be waiting a long time. try coming on thursday instead of tomorrow :)
22:04amalloyprovided that much, however, you'll see me there
22:04amalloyprovided that much, however, you'll see me there
22:04TimMcMaybe ossareh is east of the Atlantic, but plans to fly to SF. :-)
22:04TimMcMaybe ossareh is east of the Atlantic, but plans to fly to SF. :-)
22:05amalloyi did consider that
22:05amalloyi did consider that
22:05waxroseFinally back home.
22:05waxroseFinally back home.
22:06TimMcwaxrose: I am almost done writing pipeline.clj!
22:06TimMcwaxrose: I am almost done writing pipeline.clj!
22:07TimMcTHen comes the debugging, which will take a while. I haven't even written any tests yet,
22:07TimMcTHen comes the debugging, which will take a while. I haven't even written any tests yet,
22:07TimMcbecause I have been scrapping and rewriting the internals of the pipeline itself.
22:07TimMcbecause I have been scrapping and rewriting the internals of the pipeline itself.
22:07TimMc(Stupid dangling commas forcing me to add another clause.)
22:07TimMc(Stupid dangling commas forcing me to add another clause.)
22:08waxroseTimMc, Woot! You uploaded it?
22:08waxroseTimMc, Woot! You uploaded it?
22:08TimMcNot yet.
22:08TimMcNot yet.
22:08hippiehunteranyone 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:08hippiehunteranyone 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:08TimMcIt feels silly to commit when I'm so close to having it even compile.
22:08TimMcIt feels silly to commit when I'm so close to having it even compile.
22:08TimMchippiehunter: Does it show you what was unreadable?
22:08TimMchippiehunter: Does it show you what was unreadable?
22:09amalloy&(read-string (pr-str *ns*))
22:09amalloy&(read-string (pr-str *ns*))
22:09sexpbotjava.lang.Exception: Unreadable form
22:09sexpbotjava.lang.Exception: Unreadable form
22:09hippiehunterno, also the stack trace is crap since its in a lazy seq
22:09hippiehunterno, also the stack trace is crap since its in a lazy seq
22:10TimMcamalloy: I think I am about to use the replace function!
22:10TimMcamalloy: I think I am about to use the replace function!
22:11TimMcI still think it is terribly named, though.
22:11TimMcI still think it is terribly named, though.
22:11waxroseHmm, looks like Oracle will be at my school on thursday.
22:11waxroseHmm, looks like Oracle will be at my school on thursday.
22:12waxroseI wonder if Oracle is doing any Clojure.
22:12waxroseI wonder if Oracle is doing any Clojure.
22:16brehautwaxrose: unless there is a provable link between anything and charging huge fees for it, oracle is bound to not be interested
22:16brehautwaxrose: unless there is a provable link between anything and charging huge fees for it, oracle is bound to not be interested
22:17waxrosebrehaut, Sounds reasonable. Doesn't hurt to ask though when they visit.
22:17waxrosebrehaut, Sounds reasonable. Doesn't hurt to ask though when they visit.
22:17amalloywell done, brehaut. i couldn't think of anything cynical enough to say about the possibility
22:17amalloywell done, brehaut. i couldn't think of anything cynical enough to say about the possibility
22:18amalloywaxrose: make sure to bring an index card with cloJure clearly spelled out as they may think you mean closure :P
22:18amalloywaxrose: make sure to bring an index card with cloJure clearly spelled out as they may think you mean closure :P
22:18waxroseamalloy, lmao
22:18waxroseamalloy, lmao
22:18waxrosegood idea
22:18waxrosegood idea
22:27TimMcGrrr, github is down.
22:27TimMcGrrr, github is down.
22:33waxroseTimMc, meh
22:33waxroseTimMc, meh
22:33amalloyTimMc: it's like hearing there's no santa claus
22:33amalloyTimMc: it's like hearing there's no santa claus
22:33waxroselol
22:33waxroselol
22:33TimMcBut they've got a fun interactive 500 page!
22:33TimMcBut they've got a fun interactive 500 page!
22:34waxroseThey could at least have the catopus image smile at us
22:34waxroseThey could at least have the catopus image smile at us
22:34waxroseor the unicorn
22:34waxroseor the unicorn
22:34amalloywaxrose: octocat
22:34amalloywaxrose: octocat
22:35brehautis it still oatmeally?
22:35brehautis it still oatmeally?
22:35waxroselol
22:35waxroselol
22:35TimMcWell, I'll push in the morning. G'night!
22:35TimMcWell, I'll push in the morning. G'night!
22:37waxrosenight
22:37waxrosenight
23:07waxroseAnd it's back up.
23:07waxroseAnd it's back up.
23:14amalloyif anyone's interested (waxrose, fliebel), i figured out what the bottom half of that snusp program is doing
23:14amalloyif anyone's interested (waxrose, fliebel), i figured out what the bottom half of that snusp program is doing
23:14waxroseSure
23:14waxroseSure
23:15amalloyit converts the internal number holding the sum (say, 15), into two separate numbers, one for each digit in base 10 (so, 1...5)
23:15amalloyit converts the internal number holding the sum (say, 15), into two separate numbers, one for each digit in base 10 (so, 1...5)
23:18amalloyamusingly, it only lets you type two single-digit numbers, so the sum "can't" be larger than 18
23:18amalloyamusingly, it only lets you type two single-digit numbers, so the sum "can't" be larger than 18
23:18amalloybut it happily converts anything to a number by subtracting 0x30, so you can add D+H (20+24) and it will print 44
23:18amalloybut it happily converts anything to a number by subtracting 0x30, so you can add D+H (20+24) and it will print 44
23:21waxroseSorry if I respond late, arguing over a group assignment online.
23:21waxroseSorry if I respond late, arguing over a group assignment online.
23:23phenom_is there any put-if-absent function on maps ?
23:23phenom_is there any put-if-absent function on maps ?
23:23clojurebothttp://www.math.chalmers.se/~rjmh/Papers/whyfp.pdf
23:23clojurebothttp://www.math.chalmers.se/~rjmh/Papers/whyfp.pdf
23:25amalloyphenom_: ninjudd has one in his clojure-useful library
23:25amalloyphenom_: ninjudd has one in his clojure-useful library
23:25phenom_(defn put-if-absent [map key val] (if (contains? map key) map (assoc map key val))) i guess...
23:25phenom_(defn put-if-absent [map key val] (if (contains? map key) map (assoc map key val))) i guess...
23:25phenom_,(defn put-if-absent [map key val] (if (contains? map key) map (assoc map key val)))
23:25phenom_,(defn put-if-absent [map key val] (if (contains? map key) map (assoc map key val)))
23:25clojurebotDENIED
23:25clojurebotDENIED
23:25amalloyor you can roll your own easily enough with (update-in m [k] #(or %1 new-value-to-put))
23:25amalloyor you can roll your own easily enough with (update-in m [k] #(or %1 new-value-to-put))
23:26DespiteItAllyeah, assoc/or was my solution
23:26DespiteItAllyeah, assoc/or was my solution
23:27DespiteItAllupdate-in is less repetitive
23:27DespiteItAllupdate-in is less repetitive
23:28amalloyphenom_: https://github.com/amalloy/clojure-useful/blob/master/src/useful.clj#L11
23:28amalloyphenom_: https://github.com/amalloy/clojure-useful/blob/master/src/useful.clj#L11
23:29DespiteItAllthat's a nice collection
23:29DespiteItAllthat's a nice collection
23:29amalloythat'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:29amalloythat'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:35bytecoder,(defn assoc-or [m k v & kvs] (merge (apply hash-map k v kvs) m))
23:35bytecoder,(defn assoc-or [m k v & kvs] (merge (apply hash-map k v kvs) m))
23:35bytecoder,(assoc-or {:a 1 :b 2} :b 3)
23:35bytecoderjust a suggestion - a merge might do the job for you. (merge {:a 1 :d 7} {:a 3 :b 5 :c 6}) for example
23:36bytecoder,(assoc-or {:a 1 :b 2} :b 3)
23:36bytecoderjust a suggestion - a merge might do the job for you. (merge {:a 1 :d 7} {:a 3 :b 5 :c 6}) for example
23:36clojurebotDENIED
23:36clojurebotDENIED
23:36clojurebotjava.lang.Exception: Unable to resolve symbol: assoc-or in this context
23:36clojurebotjava.lang.Exception: Unable to resolve symbol: assoc-or in this context
23:36bytecoder,(defn assoc-or [m k v & kvs] (merge (apply hash-map k v kvs) m))
23:36bytecoder,(defn assoc-or [m k v & kvs] (merge (apply hash-map k v kvs) m))
23:36clojurebotDENIED
23:36clojurebotDENIED
23:36amalloygood point bytecoder. merge is reasonable for this
23:36amalloygood point bytecoder. merge is reasonable for this
23:41waxroseamalloy, I think it's interesting how it does all that with so little.
23:41waxroseamalloy, I think it's interesting how it does all that with so little.
23:41amalloy&(merge {:a 1 :c 2} {:a 10 :b 20})
23:41sexpbot⟹ {:b 20, :a 10, :c 2}
23:41amalloy&(merge {:a 1 :c 2} {:a 10 :b 20})
23:41sexpbot⟹ {:b 20, :a 10, :c 2}
23:42amalloy&(merge {:a 10 :b 20} {:a 1 :c 2})
23:42amalloy&(merge {:a 10 :b 20} {:a 1 :c 2})
23:42sexpbot⟹ {:c 2, :a 1, :b 20}
23:42sexpbot⟹ {:c 2, :a 1, :b 20}
23:42waxroseamalloy, Is SNUSP turing complete?
23:42waxroseamalloy, Is SNUSP turing complete?
23:42amalloywaxrose: any interesting language is. BF is, i'm pretty sure
23:42amalloywaxrose: any interesting language is. BF is, i'm pretty sure
23:43waxroseamalloy, Now I want to see you do the same in CherryBlossom. :P
23:43waxroseamalloy, Now I want to see you do the same in CherryBlossom. :P
23:44amalloyUse CherryBlossom / Write seasonal poetry / Turing loves it
23:44amalloyUse CherryBlossom / Write seasonal poetry / Turing loves it
23:44amalloywould love it, i guess. silly old "loves" being only one syllable
23:44amalloywould love it, i guess. silly old "loves" being only one syllable
23:48amalloy(if cherryblossom doesn't have anything to do with haikus, i'm not interested)
23:48amalloy(if cherryblossom doesn't have anything to do with haikus, i'm not interested)
23:55amalloynice, i see that it does
23:55amalloynice, i see that it does