#clojure logs

2011-08-19

00:01talioscemerick: want milk and cookies, and a story? :)
00:01cemericktalios: Yes, please.
00:01cemerickNow talios has to deliver :-P
00:02taliosThere was once a developer called Chas who...... BED TIME!
00:10sshackhi, stupid question. But I saw a website for I think a literate clojure documentation package, but can't remember it now.
00:10cemerickmarginalia
00:10sshackThe website had documentation on the left, clojure code on the right, anyone remember what that was?
00:11dnolenalandipert: got an example of matching on a single expression?
00:14alandipertdnolen: http://alan.dipert.org/post/172774481/fizzbuzz-in-scala
00:15alandipertup there with fib as a crucially important algorithm to our science, i know :-)
00:15alandipertbut porting of which is what caused me to feel like something was missing
00:19dnolenalandipert: so how would you improve over this? https://gist.github.com/1156032
00:20dnolenjust that you can use expressions where a & b are?
00:22sshackyah ha! marginalia
00:22sshackThat's what it was.
00:23alandipertdnolen: https://gist.github.com/1156032#comments
00:24dnolenalandipert: yeah no need for a different macro.
00:24alandipertdnolen: i agree
00:25kencauseysshack: there's a google group for it now also, not terribly active as of yet
00:25sshackCool.
00:27alandipertlooking at old scala, i think that 'missing' feeling is from cases that in clojure would be multimethod
00:27alandipertdnolen: thanks for indulging me though! having fun experimenting
00:28dnolenalandipert: cool! any other feedback so far?
00:30akovwhen i try to (eval (list my-fn (list 1 2 3))) i get an ExceptionInInitializerError exception, but using the function straight up (my-fn (list 1 2 3)) works fine, am i misunderstanding what eval does?
00:32raekakov: you need to quote the symbol too
00:32raek(eval (list 'my-fn (list 1 2 3)))
00:32amalloyraek: that will fail too: 1 isn't a function
00:32raekof course... :)
00:33amalloy(eval `(my-fn (list 1 2 3)))
00:34akovboth of those seem to work
00:35raek(1 2 3) is not a valid expression, since 1 isn't a function
00:36alandipertdnolen: not yet, need to use it more
00:39alandipertdnolen: did you mean to have y and z rows in the 'or patterns' section of the readme? because there is a mismatch
00:40amalloyi wonder if the fact that IFn isn't a protocol, in either clj or cljs, is related to the fundamental-ness of lambda? like, you can build anything out of lambdas, and thus you shouldn't try to rebuild lambda in a hosted environment
00:40dnolenalandipert: oops
00:44alandiperti can't decide if it would be nice or confusing if you didn't need a vector for your pattern in the single-row case, precedent being condp
00:45alandipertdnolen: but enough syntax bitching from me for tonight :-) see you later
00:46dnolenalandipert: thx for the feedback, good stuff
00:48dnolenalandipert: exprs now supported.
00:49alandipertdnolen: neat! hopefully not at the expense of anything?
00:50dnolenalandipert: nope, match design is fairly clean, such extensions are not hard.
00:51dnolenalandipert: https://github.com/swannodette/match/commit/28e0ee49a3a7737e07bb8799d966edaff1f1026e
00:52dnolen10-15 lines or something
00:52dnolenthat diff looks big because of reformatting.
00:57dnolenalandipert: single match support back in
00:58dnolenalandipert: don't need to wrap in vector
00:59alandipertdnolen: you're a machine. so you don't think that makes it confusing?
00:59tbatchelliscottj: better now? (re: disclojure tweet links)
00:59dnolenalandipert: I don't think so. I don't think we'll hype that you can do it. But some people will like it.
01:00dnolenalandipert: really I just transform back into vector wrapped form.
01:01alandipertdnolen: cool
01:04scottjtbatchelli: I'd say worse, I think links are harder than normal text to read so more is worse imo
01:05tbatchelligotcha
01:05scottjtbatchelli: I guess one option would be only have one link in the body of the text, or maybe make the person's name the here link.
01:05tbatchelliI think that'd be confusing
01:05tbatchellibut I hear you
01:08scottjyeah I agree the person's name would be confusing, but it would grant technomancy's original(?) wish of having unique names for the links
01:10tbatchelliscottj: I think I am going with adding an MD5 hash and making this the link then ;)
01:10scottjhaha
01:10tbatchelliscottj: I could tone down the style on the links
01:10tbatchellii.e. not bold
01:11scottjthe thing is, in conkeror to follow a link you can either type part of the name or a number that's over it, so really the here is not that hard to type
01:11scottjtbatchelli: oh I'm not seeing your css since I'm viewing in reader
01:11scottjactually on the page it looks better
01:11scottjit's underlined links that I think are harder to read when they're long
01:11tbatchellioh, I didn't try it that way
01:11scottjit might just be me
01:12tbatchelliscottj: I see it now
01:13tbatchellichecking planet clojure now… to see how it looks (planet clojure bungles my posts because it doesn't honor the unsorted list tag)
01:13tbatchelli(it's not there yet)
01:13tbatchelliwell, I'll let it be there and see what other feedback I get...
01:14scottjyeah, just to be clear I'm fine with yesterday's behavior (descriptive links in tweet) combined with today's (single link per tweet, othe rlinks go in your comments)
01:17kencauseytbatchelli: don't forget the relevant comment at the bottom of today's entry
01:18kencauseyactually I guess it is still accurate, I forget how short tweets tend to be
01:19tbatchellikencausey: ?
01:20kencauseytbatchelli: not relevant I guess, I thought for a moment that your comment about formatting in your most recent blog entry was now inaccurate due to further changes
01:21tbatchellikencausey: gotcha. No, I left it as is, and I'll collect the hate mail during the next few days ;)
01:22tbatchelliit's hard to find a system that works for everyone across browsers and RSS readers
01:22tbatchelliI think I'll just write an iOS app for that ;)
01:40bool_anyone have any suggestions for https://github.com/bool-/clojure-dict/blob/master/src/anthony/dict/dictclient.clj
01:40bool_essentially i'd like to abstract some more of the parsing code
01:41amalloybool_: you wrote the same code over and over a lot of times
01:41bool_yeah
01:41bool_i noticed that
01:41bool_working on it now
01:47amalloybool_: i forked it with an example of how you can pull out the repetition in client/auth
01:48amalloyyou should be able to generalize that to define and match, probably by making action take a function that decides what other stuff to do
01:48bool_yeah
02:10bool_amalloy,
02:10bool_ffs
02:10bool_one sec clipboard is borked
02:10bool_https://github.com/bool-/clojure-dict/blob/master/src/anthony/dict/dictclient.clj
02:10bool_there
02:10bool_i changed it up a bit
02:10bool_can't think of how to do define
02:10bool_as it gets two lines as a response before the text block
02:10bool_instead of one
02:11amalloyugh, all this (declare) shit is making me dizzy. is there a reason you're not just defining things in the order you use them?
02:12bool_i just prefer it at the end
02:12bool_i have no idea why
02:12bool_old habits
02:15amalloyi still think it's easier if you make (push-command) return a function instead of actually doing anything
02:16bool_why is that? =O
02:16amalloyalso, instead of (let [text-responses [...]] (if (some #{code} text-responses))), it's faster and clearer to write (let [text-responses #{...}] (if (text-responses code)))
02:17amalloybool_: iirc you're used to functional programming, right? but in haskell or ml or something?
02:17bool_uhm, i wouldn't say used to it
02:18bool_i've done very little in haskell
02:18bool_i've been an imperative guy for pretty much the extent of my programming life
02:18amalloyi mean, mostly it's just an aesthetic opinion i have, and i'm sure people would disagree with me
02:18bool_i see
02:19amalloybut it has benefits. here for example, it means you could add an extra optional arg to the "function" version of push-command
02:19amalloyand you don't have to keep repeading-and-passing conn-info all over the damn place
02:20bool_hmm i didn't think about
02:20bool_that
02:20amalloy(def define (push-command "DEFINE" (fn [& args] (...special post-processing for DEFINE here...))))
02:20bool_it doesn't need post-processing though =P
02:21bool_it needs it pretty much in the middle
02:21amalloywell it needs whatever. i dunno
02:21bool_basically you get two responses 150 and 151
02:21bool_then a text block
02:21bool_most are just response then text block
02:21bool_define is the only exception
02:21amalloywhereas all the others can be minimal: (def auth (push-command "AUTH")). no need to declare arglists, or mess with conn-info
02:22bool_the arguments manually prevents user-error though
02:22amalloy*nod*
02:22bool_that's the main reason i like that
02:22amalloyif you want to keep that, you can specify how many args to expect: (def auth (push-command "AUTH" 2))
02:22bool_expecting a number of args isn't the same as which args they are
02:23amalloy*shrug* okay
02:23bool_someone could still muck them up simply because they aren't labeled
02:36PupenoClojure is driving me crazy. Is there a way to get actual stack traces? I'm only getting errors such as "org.postgresql.util.PSQLException: FATAL: role "lobos" does not exist (config.clj:1)" and the line 1 of config.clj is the namespace declaration, so it doesn't say much.
02:49kencauseyPupeno: sounds like an authentication error
02:55Pupenokencausey: I know… but that doesn't help.
02:56Pupenokencausey: I need a stack trace… and I'm not talking about this specific error. For the past two or three days I been getting one liners, totally useless.
02:58kencauseyall related to the same library or?
03:04maaclI am trying to using cake swank and Emacs for developing a compojure based webapp, but am having trouble debugging it. Where is for instance output from println sent? Also what is a good way of debugging XHR requests? the wrap-stack trace (in Chrome) opens a window containing unparsed html which cannot be closed.
03:15thorwilmaacl: print output should appear on the repl from were you started the server
03:15thorwil(at least, that's what happens with a jetty started on a lein repl)
03:16maaclthorwil: Ok, I start it from within the file and was expecting something in *slime-events*
03:17Pupenokencausey: right now, yes, but it happened to me in other cases too.
03:25maaclthorwil: I don't get any output even if I start it from the REPL within emacs
03:27kencauseyeven in the simplest of test examples, not involving your webapp?
03:29MasseRCan I browse what symbols a ns exports?
03:33maaclkencausey: yes, if just call a function in the webapp from the REPL I see the result of println statements
03:34clgvMasseR: see ##(doc ns-publics)
03:34lazybotjava.lang.SecurityException: You tripped the alarm! ns-publics is bad!
03:34clgvups
03:34clgv##(doc 'ns-publics)
03:34lazybotjava.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol
03:35clgv##(eval "(doc ns-publics)")
03:35lazybotjava.lang.SecurityException: You tripped the alarm! eval is bad!
03:37clgvMasseR: well just see ns-publics - the bot doesnt like me ;)
03:38MasseRYup, thanks
03:38amalloyclgv: ns-publics isn't allowed since it's a security risk
03:38amalloysorta
03:38clgvamalloy: an exception for doc or a proxy command for doc would be handy ;)
03:39clgvthe proxy could just be a function and take a given symbol
03:40amalloyclgv: file an issue on https://github.com/cognitivedissonance/clojail - it has some special handling for doc, and giving it more might not be that hard
03:40amalloyyou could probably write a $doc command yourself if you wanted; getting special handling for (doc) in ordinary evals is harder
03:41amalloy(the $doc command would have to be on lazybot)
03:41clgvyeah^^ like source and such
03:44amalloylazybot: whaddaya say, do you want a $doc command???
03:44lazybotamalloy: Yes, 100% for sure.
03:45clgvlol
03:45clgvlazybot: you always agree with amalloy? :P
03:46ibdknoxlol
03:46ibdknoxyou don't have the magic touch ;)
03:46clgvlazybot: you always agree with amalloy???
03:46lazybotclgv: Oh, absolutely.
03:46clgv;)
03:46ibdknoxbotsnack
03:47ibdknoxhm
03:47ibdknoxlazybot: botsnack
03:47lazybotibdknox: Thanks! Om nom nom!!
03:47amalloyis there anything better than a botsnack??
03:47lazybotamalloy: Definitely not.
03:47ibdknoxhah
03:47ibdknoxI'm sensing a pattern :-p
03:48amalloyibdknox: new feature, inspired by fsbot in #emacs
03:48ibdknoxhaha fun
03:50ibdknoxlazybot: are you tired??
03:50lazybotibdknox: Definitely not.
03:50maaclWhat is the best way to generate debug information when using cake swank and emacs slime to develop a compojure app?
03:52ibdknoxamalloy: wow, lazybot can do quite a lot
03:52amalloyibdknox: most industrious lazy guy i know
03:52ibdknoxhaha
03:55ibdknoxlazybot: 8ball
03:55lazybotibdknox: You may rely on it.
03:56ibdknoxlazybot: elite hacker
03:56lazyboth4ck3r
03:58ibdknoxlazybot: fortune
03:58lazybotI have no fortune cookies. Please feed me some!
03:58amalloyibdknox: try the ping plugin. one of the most useful
03:59ibdknoxlazybot: ping
03:59lazybotibdknox: Ping completed in 0 seconds.
03:59ibdknoxlazybot: ping google.com
04:00lazybotibdknox: FAILURE!
04:00amalloyibdknox: actually there are two ping commands. one of them sucks
04:00ibdknoxlol
04:00amalloytry: "amalloy: ping"
04:00ibdknoxamalloy: ping
04:00amalloyyeah ibdknox what's up
04:00ibdknoxlol
04:00amalloy(he /msgs you even if i'm too much of a jerk to highlight you)
04:01ibdknoxyeah
04:01ibdknoxhaha
04:01ibdknoxthat's cool
04:01ibdknoxlazybot: list
04:01lazybotI know about these topics:
04:01amalloyibdknox: he also doesn't care what channel you ping from. i sometimes send him a private msg like "ibdknox: ping"; then he lets me know when you're around, without me having to bother you
04:02ibdknoxoh nice, that's actually really useful
04:02amalloy*nod*
04:02ibdknoxthat addition of the milliseconds is a nice touch :-p
04:02ibdknoxhaha
04:03ibdknoxI know *exactly* when someone shows up
04:03ibdknoxthe ultimate in stalking software :D
04:03amalloyibdknox: not usually
04:03amalloyit only tells you the two most-significant time units
04:03ibdknoxah
04:03amalloyeg, "1 hour and 42 minutes"
04:03ibdknoxthat's no fun :-p
04:04amalloyheh. well, i did it on purpose. fork it and take out the (take 2) :P
04:04ibdknoxlazybot: thoughts?
04:04ibdknoxlazybot: markov
04:05ibdknoxhm
04:05amalloyibdknox: disabled
04:05ibdknoxah
04:05amalloyi wrote the markov plugin and it worked fine, but when i added the mongo persistence layer it turned to total crap
04:05amalloy$login
04:05lazybotYou've been logged in.
04:05amalloy$loaded?
04:05lazybot:brainfuck :clojure :debug :dictionary :eball :embedded :fortune :github :google :haskell :help :internal :javadoc :karma :leet :lmgtfy :load :log :logger :login :macro :mail :max :mute :operator :ping :rss :sed :seen :shorturl :timer :title :translate :utils :weather :whatis :yesno
04:05clojurebot$what is love
04:05lazybotIt's AWWWW RIGHT!
04:05amalloyhahahaha
04:06ibdknoxlol
04:06ibdknoxlazybot: lmgtfy irc
04:06lazybothttp://www.lmgtfy.com/?q=irc
04:07ibdknoxlazybot: brainfuck
04:07ibdknoxlazybot: bf +++
04:07lazybot{:ptr 0, :cells {0 3}}
04:07lazybot[]
04:07ibdknoxjust because? lol
04:07amalloyibdknox: i dunno. Raynes wrote a lot of plugins
04:08ibdknoxit is interesting to see how simple a turing complete language can be
04:08ibdknoxlol
04:08ibdknoxthat plugin is 73 lines
04:08ibdknoxthe part that does the evaling at least
04:09amalloythat seems kinda long, given the language. i've never looked at most of the plugins
04:09ibdknoxlazybot: weather
04:09amalloy$weather 94109
04:09amalloy$fcst 94106
04:09lazybotamalloy: Location not found!
04:09ibdknoxamalloy: it's well spaced and such
04:09amalloyfeh
04:09amalloy$fcst 94109
04:09lazybotamalloy: 1:30 PM PDT
04:09lazybotamalloy: TODAY: Mostly clear in the evening then becoming mostly cloudy. Patchy fog after midnight. Lows in the mid 50s. West winds 10 to 15 mph.
04:09lazybotamalloy: TONIGHT: Mostly cloudy. Patchy fog in the morning. Highs near 60. Southwest winds 10 to 15 mph.
04:10ibdknox$ is a shortcut to get it to execute a command?
04:10ibdknox$lmgtfy brainfuck
04:10lazybothttp://www.lmgtfy.com/?q=brainfuck
04:11ibdknox$botsnack
04:11lazybotibdknox: Thanks! Om nom nom!!
04:11ibdknoxok
04:11ibdknoxI've had enough fun with the bot
04:11amalloyis there any such thing??
04:11lazybotamalloy: Definitely not.
04:11ibdknoxhaha
04:12ibdknoxtime for sleep!
04:12ibdknoxG'nite sir.
04:12amalloynight
04:13clgvis there any such thing???
04:13lazybotclgv: Oh, absolutely.
04:13clgvhehe ok confirmed
04:17PupenoWTF? loading a file in lein repl works and in La Clojure it doesn't.
04:19lnostdal_j #java
04:41PupenoAnybody know what might be wrong with La Clojure's command line: https://groups.google.com/forum/#!msg/lobos-library/oXLDpGFsAwU/Zr8MA-9fUPEJ ?
05:01clgvPupeno: you might try to delete entries until you find something working and then adding again until you find the maximal working entryset, then you should know the problem
05:01Pupenoclgv: I removed all the jars from La Clojure, and it still fails :(
05:02PupenoThe command still looks quite different though, but that's as close as I can get with La Clojure.
05:02clgvthe other way would be: under what circumstances can it happen that the role "lobos" is not created?
05:05Pupenoclgv: the role lobos doesn't exist and that's ok. The weird thing is that it's being used at all. Loading the file shouldn't ever try to do that, but somehow, it does, only in La Clojure.
05:05clgvhmm sounds like pretty weird side-effects. check the places where you have side-effects in that file
05:13PupenoWell, in emacs it seems to work.
05:28Pupenoclgv: I removed all side effects and found that adding a jar is triggering the problem: https://groups.google.com/d/msg/lobos-library/oXLDpGFsAwU/92akh2KXIHoJ
05:43Raynes$mail idbknox I took that brainfuck code from rosettacode. Never even looked at it. Just noticed it worked and threw it in. If it's a monstrosity, I had *nothing* to do with it. ;)
05:43lazybotMessage saved.
06:02clgvPupeno: humm you have a dependency called lobos? does it have the namespace lobos.*? if so why do you also use that namespace? is it possible that lobos.config already exists in the lobos-dependency?
06:04maaclCan someone *please* tell me where std our directs to when using cake swank with Emacs/Slime?
06:04Pupenoclgv: yes, there's a dependency called lobos, it doesn't create a lobos.config namespace but expects a lobos.cofig to be created.
06:05clgvPupeno: so maybe it has the default of using a role called lobos if you dont specify a different one?
06:06Pupenoclgv: it doesn't, the creator of Lobos doesn't know where that error is coming from and it only happens with La Clojure, not with lein repl.
06:09Raynesmaacl: Very likely <project>/.cake/cake.log
06:09RaynesThat's where all input and output goes to die.
06:09maaclRaynes: thank you, will look there
06:11maaclRaynes: btw, are you going to the conj this year?
06:11Raynesmaacl: Absolutely.
06:18Raynesmaacl: Any particular reason for asking, or do you plan on stalking me? ;)
06:18maaclRaynes: No, I just recalled last year and wondered if it was possible for you to go
06:18Raynesmaacl: This year I have a job. :>
06:19maaclRaynes: Well that is both good and bad :-)
06:21Raynesmaacl: Did cake.log have what you were looking for?
06:21maaclRaynes: yes, thanks a lot. I have been asking all morning with no response
06:22Raynesmaacl: When that happens, the best place to go is the cake mailing list, where you *know* we'll see it.
06:22maaclRaynes: good to know
06:22RaynesLater. :)
08:52`fogusdnolen: The video of your talk is a master-class in the state-of-art in pattern matching. Great job.
08:52ambrosebs+1
08:52dnolen`fogus: thx!
08:52opqdonutlink please?
08:54pyrindeed great talk
08:54Scriptoropqdonut: http://vimeo.com/27860102
08:55`fogusdnolen: Do you have a list of influential papers/presentations? I need to make sure I'm up to speed.
08:55opqdonutyay, finally pattern matching
08:56nachtalp`fogus: there's a list on the github page
08:57dnolenwhich I need to rearrange
08:57dnolendone
08:58dnolen`fogus: Maranget paper, Predicate Dispatch paper, and the Racket paper on Extensible Pattern Matching.
09:04`fogusdnolen: This guy? http://cristal.inria.fr/~maranget/
09:04dnolen`fogus: yep.
09:04`fogusdnolen: Practical Predicate Disp?
09:05dnolenEfficient Predicate Dispatch, http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.47.4553
09:05`fogusGreat! One down. ;-)
09:05dnolenCompiling Patterns to Good Decision Trees, http://pauillac.inria.fr/~maranget/papers/ml05e-maranget.pdf
09:05`fogusThank you sir
09:05dnolenExtensible Pattern Matching For Extensible Languages, http://www.ccs.neu.edu/home/samth/ifl2010-slides.pdf
09:07`fogusdnolen: Do you typically hold court here? That is, do you have a mailing list, group, etc.?
09:08arohner`fogus: lol, hold court. I'm going to use that
09:08`fogusSorry, I hold the patent on that particular sequence of words
09:08algalhello. newbie question. Is macports the recommended way to install clojure on os x? I expect to use it via my existing slime / aquamacs install.
09:09arohneralgal: I use lein
09:09dnolen`fogus: mostly in here and on ML yeah. no mailing list or group for match yet. Not sure if it needs one really :)
09:09arohneralgal: and unless you're lucky, an existing CL slime isn't compatible
09:09algalarohner: this is actually my problem. When I tried using macports to install clojure, the install of leiningen failed.
09:10algalarohner: ugh.. You mean I need to maintain two different slime installs?
09:10arohneralgal: yeah, sorry :-(
09:10arohnerd/l lein from here https://github.com/technomancy/leiningen
09:10manutteralgal: there was a guy here yesterday talking about setting up emacs to support both CL slime and Clojure slime
09:11algal(loved the short story, btw)
09:11manutterI think it was a user named rpg
09:11algalmanutter: I thought he'd be at #arc.
09:12algalSlightly confused. I thought leiningen was more a built tool rather than a development envrio... Hmm.. I should do my homework before bothering you chaps.
09:13algalmanutter: more seriously, is there a channel bot with yesterday's traffic?
09:14manutterThere's an online log somewhere, I saw a link once...hmm...
09:14dnolenhttp://clojure-log.n01se.net/
09:14algalokay. googling clojure irc logs pulls it. sorry again.
09:33chouserdnolen: sorry if this is a dumb question, but for predicate dispatch couldn't the DAG be a function full of the same kind of cond forms that match produces?
09:34chouserdnolen: basically re-generating a new dispatch function each time the predicate is extended.
09:35chouserIt would consume PermGen, but only when a user is defining a new function of their own anyway
09:38dnolenchouser: the dag would be a fn I think yes, but we don't want to eval. So perhaps a fn with a bunch of cond tests that actually gets their tests out of an object array is what I've been thinking.
09:39MasseRI'm learning clojure, and thought about implementing markov chain for text generation. My current version for creating the database is like this: http://pastebin.com/mX7vNz0f, but I get a stack overflow. What steps should I take it prevent that?
09:40ChousukeMasseR: use (rest xs) instead of (drop 1 xs) for starters
09:40chouserdnolen: I'm not sure you'd need eval. If extend-pred is a macro, it could generate the new dispatch function code and emit it along with whatever else it has to do.
09:41Chousukealso merge-with concat might be a problem, since concat creates a lazy seq always
09:41dnolenchouser: problem is that could be a LOT of code. decision trees are exponential. that's why people use backtracking.
09:42dnolenbetter I think to convert the decision tree into a DAG with sharing.
09:42MasseRChousuke: What should I use instead?
09:43chouserdnolen: ok, I'm willing to trust you've thought these things through. :-)
09:43ChousukeMasseR: since the value things are put in a vector, try merging with into
09:43dnolenchouser: Maranget shows in his paper that for real world match expressions it's rare for decision tree code to be more than 1.5-2X the size of the backtracking code.
09:44dnolenchouser: however when we start treading into open set, I think you have to really think about how much code is getting produced.
09:44Chousuke,(merge-with into {:a ['b]} {:a ['c 'd]})
09:44clojurebot{:a [b c d]}
09:45MasseROh nice, seems better now. At least from memory perspective. Thanks
09:45chouserdnolen: it just seems a shame to walk away from the nested 'if's that match produces, and all that hotspot can do with them.
09:46ChousukeMasseR: you can do destructuring in the function argument vector directly btw
09:46tibell_cgrand around?
09:46tibell_@seen cgrand
09:46ChousukeMasseR: so the value function could just be (defn values [[x & xs]] ...)
09:46ChousukeMasseR: without the let
09:46MasseRChousuke: Yes I know. I actually used to do that, but a lot of the "literature" around seems to prefer explicit taking/dropping/head/etc
09:46dnolenchouser: definitely.
09:46MasseROh that
09:47ChousukeMasseR: (rest foo) is always preferable to (drop 1 foo) though
09:47MasseRI had some syntax quirks, I tried with (defn [[x & xs] foo] ..
09:47Chousukeyeah that defines two arguments
09:47Chousukeone that gets destructured and another that doesn't.
09:48ChousukeMasseR: your makedb function can also be expressed without an explicit loop though
09:49MasseRChousuke: If you mean (defn makedb [xs db] ( .. recur (rest ..) then I prefer my version
09:49MasseRNo need to create a wrapper function for easier calling
09:49ChousukeMasseR: no
09:50Chousuke(apply merge-with into (map values (partition 3 1 (words x)))) or something
09:51MasseRHmm.. partition is handy.
09:52ChousukeMasseR: it might not behave the way you want if the number of elements is not evenly divisible though. check the docs because I don't remember the details
09:53MasseRChousuke: Yup it apparently disregards those with length < 3
09:53Chousukeyou can give it padding or something I think
09:53manutterpartition-all
09:53manutter,(doc partition-all)
09:53clojurebot"([n coll] [n step coll]); Returns a lazy sequence of lists like partition, but may include partitions with fewer than n items at the end."
09:53Chousukeoh, right
09:54ChousukeMasseR: it'll take a while before working without explicit loops becomes second nature, but keep in mind that they are seldom needed
09:55manutterit would be interesting to see that function expressed as a reduce
09:55Chousukeinfinite lazy sequences get you far
09:55MasseRChousuke: I actually have experience with Haskell, but as it doesn't have (easily) available partition, those functions that require more than 1 value are a bit .. unnatural
09:55Chousukemanutter: well you can replace apply in my version with reduce but it'll be less efficient
09:56Chousukeand will need a starting value
09:57MasseRHmm.. Not sure I like how slimv changes my cw behaviour
09:57manutterisn't apply more likely to blow the stack, though? (not that I know what I'm talking about, but I thought I heard something about apply realizing the seq before passing the args to the function)
09:58MasseRmanutter: Seems to work fine
10:01manutterwell allrighty then
10:05Chousukemanutter: no
10:05Chousukemanutter: apply is lazy if the function is lazy
10:12rpgalgal: Were you asking about my experience with swank/slime?
10:17xianHi. I'm looking for a function like iterate but which takes no second argument, i.e. (take 4 (simple-iterate gensym)) => (G__3330 G__3331 G__3332 G__3333)
10:18Chousukerepeatedly?
10:18xianYes, just like iterate without the second argument.
10:18Chousuke(doc repeatedly)
10:18clojurebot"([f] [n f]); Takes a function of no args, presumably with side effects, and returns an infinite (or length n if supplied) lazy sequence of calls to it"
10:18Chousuke:P
10:19xianlol, okay :)
10:20MasseRApparently good, descriptive function names have their cons too :D
10:23manutterrpg: algal was asking about running dual Clojure/CL slime setups under aquamacs
10:24rpgmanutter: I didn't really find a good solution: what I do is have a defvar, lisp-mode-to-use that takes one of three values: slime (CL slime); allegro (Franz's ELI mode) or nil (none). The last is compatible with technomancy's clojure-jack-in
10:24rpgYou can't really have a clojure-compatible SLIME version and an up-to-date CL SLIME version coexist.
10:24mrBlissrpg: I use this https://github.com/mrBliss/swank-clojure
10:25rpgMy personal belief is that at some point the clojure community should fork SLIME, rename it so it doesn't conflict with the CL version, and then be free to turn it into a full-fledged clojure interaction mode.
10:26manutterdoesn't sound like a bad idea (except that "forking slime" sounds like a name you'd call someone you really didn't like...)
10:26rpgI just don't think that a stable interaction can ever happen given the lack of a release mechanism for CL SLIME.
10:27rpgmanutter: maybe "slime on a fork" would be better? ;-)
10:28manutterheh
10:28rpgmrBliss: thanks for the pointer. Very interesting....
10:29rpgmanutter: My experience crashing swank-clojure by trying to use the "sync package name and directory" command still stings! ;-)
10:39sleepynategrr seq? vs. sequential?
10:41chousersleepynate: depends on what you mean, I'm afraid.
10:41algalrpg: Yes, I was!
10:41chouserwe've got a gnarly section in JoC that tries to clarify that
10:41sleepynatechouser: see the problem with putting question marks after predicates is that you think i'm asking as oppoed to complaining :)
10:41chouser:-)
10:42sleepynatechouser: i just had a recusion going wonky due predicating on the wrong interface
10:42rpgalgal: I was just saying: "I didn't really find a good solution: what I do is have a defvar, lisp-mode-to-use that takes one of three values: slime (CL slime); allegro (Franz's ELI mode) or nil (none). The last is compatible with technomancy's clojure-jack-in"
10:42algalrpg: I've got slime installed for work with CL, and I'd like to get setup for clojure without too much duplication and with a clean uninstall path..
10:42mrBlissalgal: try this https://github.com/mrBliss/swank-clojure
10:43rpgalgal: I get a fresh emacs started up with no SLIME loaded at all, and then I use the "clojure-jack-in" facility (from technomancy's "radical simplification" blog post).
10:43algalmrBliss: thx. will check it.
10:43rpgalgal: I have to do this cumbersome process of resetting the lisp-mode-to-use in my .emacs then starting a fresh emacs. But I have ALREADY had that problem, since I use both Franz's ELI and SLIME on different occasions, and they are incompatible.
10:46mrBlissrpg: I prefer my solution, I can fire up a Clojure and a CL (SBCL in my case) repl at the same time (same instance!)
10:46algalrpg: hmm.. ok. I'm only on SBCL so I'm not already committed to having to restart emacs for slime purposes.. It would be nice to avoid if possible.
10:47rpgmrBliss: Sounds good. In the end I decided I wasn't really willing to maintain a merged SLIME for myself alone. Seemed like it would be fighting the upstream maintainers too much. But more power to you for doing it!
10:48algalmrBliss: intriguing. so is this your fork of swank-clojure? or is this the standard swank-clojure ?
10:48rpgAgain, my personal opinion is that having SLIME be the clojure mode is kinda like trying to use Python mode to program perl ;-) We'd just be better off with a separate Clojure interaction mode.
10:49rpgBut since I don't know nearly enough clojure to do that, my opinion is of course not worth much to the people who actually do the Real Work involved.
10:49mrBlissalgal: my fork differs only by a couple of changes. The SLIME protocol chaned a bit, and TerjeNorderhaug updated swank-clojure.
10:49algalrpg: you mean we need a SLIME fork dedicated to clojure?
10:50rpgalgal: Yes, and with all uses of "slime-" changed to "scime-" or something.
10:50no_mindanyone here from clojure-conj organizing committee ?
10:50mrBlissrpg: it's not a merged version of SLIME, it's just a snapshot of SLIME. Like the one used with clojure-jack-in, but not stripped-down. It's a later snapshot that includes backends for other Lisps and slime-contrib.
10:51algalDo either of you chaps know if ELPA helps with this at all? For instance, does ELPA offer separate SLIME packages for CL and clojure?
10:51manutterrpg: name it CRIME: Clojure REPL Interaction Mode for Emacs.
10:51manutter:)
10:51mrBlissalgal: the one on ELPA are only compatible with clojure
10:51sjlmanutter: If there's a synonym for "interaction" that starts with a U we could have SCUM
10:52mrBlisss/are/is
10:52lazybot<mrBliss> algal: the one on ELPA is only compatible with clojure
10:52rpgmrBliss: I think it's great you did this, but isn't it a real uphill battle to try to identify a stable build of SLIME? The community of SLIME maintainers doesn't seem to be interested in supporting that idea.
10:52mrBlissrpg: hugoduncan found a stable build, see the README :-)
10:52rpgI am VERY impressed with the SLIME maintainers and their project, but I wish they were willing to issue releases instead of just commits...
10:53algalrpg: agreed.
10:53rpgmrBliss: I understand, but going forward is someone committed to repeatedly finding such a stable build? Stable for both CL and Clojure? *And* continuing to paper over the differences between the lisps?
10:54mrBlissrpg: I'm not trying to keep swank-clojure compatible with the HEAD of SLIME, but just with a not stripped-down version that offers the functionality I need and is compatible with CL.
10:54MasseRI remember there being a function which takes a map and a path. For example (überget x :attrs :number)
10:54mrBlissMasseR: ##(doc get-in)
10:54lazybot⇒ "([m ks] [m ks not-found]); Returns the value in a nested associative structure, where ks is a sequence of ke(ys. Returns nil if the key is not present, or the not-found value if supplied."
10:55rpgmrBliss: Sounds great. I'm all for it!
10:55MasseRmrBliss: Thanks
10:56rpgmrBliss: so you try to keep your version of swank-clojure in sync with https://github.com/pallet/ritz/tree/master/slime ?
10:56algalwhat do most clojure programmers use? Is emacs in the minority b/c everyone's hanging on to netbeans/eclipse/etc..?
10:56mrBlissrpg: that version doesn't change, so it's an easy job :-)
10:56mrBlissrpg: do you know of any new features in SLIME that we're missing?
10:57rpgmrBliss: but eventually, surely, you'd want some of the new stuff (like nikodemus's cl indentation improvements), if you are also a CL developer, right?
10:57rpg(note: I don't know what's in the hugoduncan fork, and what isn't...)
10:57sjlalgal: I use MacVim + SLIMV + a few VimClojure files. It's a bit of a mess.
10:58algalsjl: Yeah, that does sound awkward.
10:58mrBlissrpg: it's just the protocol stuff that can cause problems, cl-indentation shouldn't be a problem. I haven't actually tried the SLIME @ HEAD with this version of swank-clojure, so it's possible it works without problems
10:59sjlalgal: Once you learn the idiosyncrasies of it it's not too bad. And using SLIMV means all the keybindings are pretty much the same as Lisp, which is nice.
10:59mrBlissrpg: hugoduncan just took a snapshot of SLIME trunk some time ago, he didn't actually remove anything (that I know of).
10:59coopernurseI've been happy with IntelliJ + La Clojure + lein -- REPL just seems to work, and IntelliJ will pick up on JARs downloaded by lein if you add the lib dir to your intellij module
10:59algalsjl: yes. I can learn a new language but not new keybindings.
11:00mrBlissalgal: 61% of Clojure users use Emacs + SLIME according to http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/
11:01algalmrBliss: interesting. but the situation is still so horked that there's no standard way to handle an emacs install used for CL and clojure.. odd.
11:02bioinformaticszeCan anyone recommend a persistent value store for working with clojure? I was going to try tokyo-cabinet but I thought it worth checking if there was a more commonly used clojure library/store.
11:02cemerickalgal: Wanting to do both is unusual. The shenanigans that happen upstream in SLIME apparently don't help.
11:02sjlReally? That's weird. Vim works fine with both (just not connected to both at the exact same time).
11:04algalcemerick: shenanigans == churn with no stable releases ?
11:04coopernursebioinformaticsze: how big is your data set? if it can fit in RAM then I've had good luck with Redis
11:05cemerickalgal: that and "just use cvs HEAD"
11:05algalcemerick: yeah, I had to read that one twice the first time I saw it. Does it mean "b/c HEAD is *that* stable" or "because you can cope with *THAT* much instability".
11:05bioinformaticszecoopernurse: It's around 400 - 600k entries, each with a 200-400 character string.
11:06cemerickalgal: …or "because we don't give a…"
11:06bioinformaticszeI have 4GB of RAM.
11:06bioinformaticszeI guess that might be possible?
11:06coopernursebioinformaticsze: ok, so ~500MB - yes, Redis would work with that data set
11:07algalcemerick: what annoys me more than the lack of stable releases is the paucity of the documentation. I mean, I have a hunch there's a decent stepping debugger interface in there somewhere, but where?
11:07bioinformaticszecoopernurse: Can you point me to the library?
11:07coopernursethe nice thing about it is that it has a rich set of operations for manipulating data structures, and it has a couple of persistence models depending on your read/write mix
11:07tomojbioinformaticsze: if you wind up using redis you might check out the redis client in aleph
11:07cemerickalgal: for CL, yes, IIRC; for Clojure, I don't think so.
11:07tomojvery minimal
11:07tomojbut it works great
11:08coopernursebioinformaticsze: https://github.com/mmcgrana/clj-redis
11:08mrBlissalgal: http://vimeo.com/23932914
11:08coopernursebioinformaticsze: http://redis.io
11:08tomojoh, that's probably easier to use
11:08bioinformaticszeThank you.
11:08cemerickalgal: I remain very surprised that no one has done a hard fork or bottom-up reimpl of SLIME *just* for Clojure. But then, I'm no emacs-er, so I generally stay on the sidelines of that sort of stuff.
11:08pyrbioinformaticsze: for redis
11:08cemerick(short of shooting my mouth off in irc occasionally :-P
11:08pyrbioinformaticsze: i recommend also looking at jedis
11:08tomojbut it's synchronous..
11:09pyrah, didn't see the aleph recommendation, that's good too
11:09coopernursepyr: it looks like clj-redis wraps jedis in a clojure interface
11:09bioinformaticszeI'm still new to clojure so which ever library is easiest to use.
11:09bioinformaticszeI'm trying out some work stuff in the clojure to see how it feels.
11:10tomojdon't check out aleph yet :)
11:10pyrtomoj: yeah, probably not the best choice to start with :)
11:10bioinformaticszeOk
11:11bioinformaticszeThe clj-redis looks straight forward.
11:11cemerickmrBliss: I sit corrected; more good works by hugod :-)
11:12tufflaxI can't write 'closure' anymore. I write 'clojure' (even when writing this, i failed to write 'closure' the first time (and now again!))
11:13mrBlisscemerick: I haven't gotten it working though
11:13coopernursebioinformaticsze: excellent. yes, the operations in redis seem to map very well to functional programming
11:13rpgcemerick: I don't think a reimplementation is necessary; simply a fork-and-rename. As I said, I think the differences in the two languages are sufficient to suggest a different emacs framework (even if starting from the CL one is a good idea).
11:14bioinformaticszecoopernurse: Thank you for the recommendation
11:14rpgAlso, the CL SLIME developers "own" the swank backend and the emacs front end and keep them in sync in the same repo. Trying to do this from outside the repo (maintaining only the swank backend) seems like a recipe for pain.
11:14cemerickrpg: Yeah, whatever the lead(s) want to do. It just seems like an obvious win (though of course, a ton of work) for Clojure/emacs tooling.
11:15bioinformaticszeUsing homebrew it seems easy to get redis and leiningen working on my mac too
11:15coopernursebioinformaticsze: yep, I use redis on my mac - it works well
11:16coopernurseand lein / clojars is a great combination. imho the packaging tools for clojure are what really make a solid dev platform
11:16mrBlissrpg: https://github.com/bigfoote/slclj is a rename of slime just for Clojure, but I still couldn't use a Clojure repl at the sime time as a CL repl with it.
11:18bioinformaticszeIs lein used mainly for creating clojars or can it also be used for creaing a workflow of scripts?
11:18algalspeaking of lein, has anyone had problems using macports to install leiningen because of this bug in maven-ant-tasks ( https://trac.macports.org/ticket/30060 ) ? Or is everyone just installing it from source? or on ubuntu?
11:19coopernursebioinformaticsze: lein is primarily a build / packaging tool for clojure. it supports maven, which gives you easy access to traditional Java libs. clojars is a separate project that stores clojure specific maven artifacts (libraries)
11:19coopernurselein also has a plugin architecture, and many folks have written plugins for various applications
11:20coopernursefor example, ring has a lein plugin that will create a WAR file from your clojure web project
11:20bioinformaticszeOk. Thank you.
11:20bioinformaticszeI think I understand
11:21bioinformaticszeClojars is like rubygems.
11:22bioinformaticszeAnd lein is like rake + bundler?
11:22pyrthere is one big difference
11:22pyrbioinformaticsze: in ruby dependencies are per environment
11:22bioinformaticszeSorry for the analogy, I am coming from Ruby.
11:22coopernursebioinformaticsze: yes, that seems right
11:22pyrbioinformaticsze: in clojure (actually maven)
11:22pyrbioinformaticsze: they are per project
11:22bioinformaticszeI see
11:23coopernursepyr: good point -- which is very useful for packaging / deployment
11:23bioinformaticszeThey get vendored into the project.
11:23pyrbioinformaticsze: yes
11:23pyrbioinformaticsze: so lein, - as a maven frontend - takes the place of rvm + rake
11:23coopernursebioinformaticsze: yes, but the tools are smart enough to create a local cache of JARs that are project independent (usually in: ~/.m2/repository)
11:24bioinformaticszeSo I can use lein where I would use rake?
11:24pyrbioinformaticsze: short answer, yes
11:24bioinformaticszeThat's great!
11:25bioinformaticszeThank you. This is very helpful to me.
11:25pyrbioinformaticsze: you can also get plugins for it which enhances its functionnality
11:25pyrbioinformaticsze: where in the ruby world you have rails as a separate command to start a new rails project
11:25bioinformaticszeI see.
11:26pyrbioinformaticsze: in clojure there is a noir plugin for leiningen, which once install lets you do: lein noir new cool_website
11:26pyrs/install/installed
11:26lazybot<pyr> bioinformaticsze: in clojure there is a noir plugin for leiningen, which once installed lets you do: lein noir new cool_website
11:26pyrlazybot: i love you
11:26pyrlazybot: botsnack
11:26lazybotpyr: Thanks! Om nom nom!!
11:26bioinformaticszeSo everything can be automated/run from lein rather than clojure scripts
11:27pyrit's good practice to have tasks that modify the life of the software project live in lein, yes, as rake tasks to for ruby projects
11:30bioinformaticszecoopernurse: When you mean modify the life of the project, installing clojars etc?
11:30bioinformaticszeI often used rake to build a set of analyses. E.g. populate a database, pull required records, analyse the records.
11:37coopernursebioinformaticsze: you could use lein to automate tasks like that. I haven't done it, but the plugin model is very simple, so it would be easy to write plugins that are part of your project
11:38coopernursethat you would invoke via lein
11:38bioinformaticszecoopernurse: Great! Thank you. I'll have to give this a try.
11:46PupenoWould you use http://www.jasypt.org/ to encrypt passwords in a web app?
11:48algalhas anyone here looked into using clojurescript for graphics programming in the browser ?
11:48pyrPupeno: no
11:48duck1123Pupeno: Thanks for that link. I might give this lib a try this weekend
11:48Pupenopyr: what would you use?
11:48pyrPupeno: https://github.com/ibdknox/noir/blob/master/src/noir/util/crypt.clj
11:49pyrPupeno: this method
11:49pyralways you bcrypt for passwords
11:50pyrPupeno: i'm a bit partial
11:50Pupenopyr: how so? you wrote bcrypt?
11:51pyrPupeno: no, the implementation in noir
11:51pyrthat file
11:51pyrand I'm from the openbsd team, where we have a history with bcrypt
11:52pyrbut it's now become a de-facto standard for strong hashing
11:52pyrhttp://codahale.com/how-to-safely-store-a-password/
12:05whiddenSo I was going to pose this question to #clojure :So I have a problem that deals with 3 collections of integers of various lenghts and I need to combine them into one collection such that they have some order. And in the process of writing the question the answer hit me in the face like a king salmon that had been lying on some untraveled river bank for a week. Just combine them and then sort by whatever order you wish!
12:06whiddenIf I would have posed the question sooner I wouln't have wasted a couple of hours writing a stupid loop that didn't work!
12:06whiddenEach of you may pat yourselve on the back for giving such wonderful advise and insight!
12:14PupenoI'm not sure why, but Slime seems to be appearing splitting the window vertically instead of horizontally, any ideas how to switch that?
12:15BronsaPupeno: it depends on the size of the window
12:15PupenoBronsa: I see, but how do you change it once it's done?
12:16Bronsayou can C-x 0 and then C-x 2
12:16PupenoThanks :)
12:41bioinformaticszeI'm struggling to write a plugin that can be found by lein.
12:41bioinformaticszeShould I define my plugins under $PROJECT/src/plugin.clj ?
12:42bioinformaticszeThen use the (ns plugin "description") syntax?
12:46cemerickbioinformaticsze: read https://github.com/technomancy/leiningen/blob/master/doc/PLUGINS.md
12:56bioinformaticszecemerick: Thanks!
12:58PPPaulhas anyone used clutch?
13:01cemerickPPPaul: I'm a committer for it. Questions?
13:02PPPauli'm following the github start guide
13:02PPPauli'm getting an error when i do (:use asa...clutch)
13:02cemerickSounds like either a typo or your dependencies aren't in order.
13:03PPPaul"could not initialize class clojure.data.json__init (utils.clj:26)"
13:03cemerickPPPaul: are you using lein? If so, ensure that you've run `lein deps`.
13:03PPPauli did
13:03PPPauli did lein deps
13:03cemerickCan you paste a full stack trace?
13:04PPPaulgive me a sec
13:06PPPaulhttps://gist.github.com/1157374
13:08PPPauldoes that help?
14:51chewbrancadnolen: yeah really like the idea of it, pattern matching is one of my favorite features from the brief exposure I've had with erlang, and as for hacker news, that video is way too much coding and theory, we really need a site like hacker hacker news or startup news lol
14:52sridself-organizing reddit communities?
14:52sridmore like -- reddit.com/r/self - where you see links relevant to *your* interests. similarly, for every other user of the site.
14:53chewbrancathat could work, I mean I've learned a lot from hacker news over the years, but much less programming on there now
14:54dnolenchewbranca: yeah I feel even a year ago HN was much friendly excited about this kind of thing.
14:55dnolendecision trees are big in AI, it's fun to see them applied to pattern matching.
14:55dnolenAI/machine learning.
14:56chewbrancadnolen: so from what I understand, the order or your pattern definitions decides its priority correct? what's your thoughts on using order versus more of a declarative approach
14:56dnolenchewbranca: what do you mean?
14:57chewbrancadnolen: yeah fun to see the decision trees brought in, hadn't thought about using that, and that guy Luc has some interesting looking papers, was taking a peek at his "algebraic pattern matching in join calculus" as well
14:58dnolenchewbranca: using decision trees for pattern matching is an old technique. innovation here is using heuristics to simulate lazy pattern matching
14:59chewbrancadnolen: well I always go back and forth on order as priority, or exactness, as once you get rather large pattern matching sets going it can get tricky to track down bugs when order is a priority, although I could see that being less of an issue here
14:59dnolenchewbranca: are you talk about the fact that pattern matching is top down?
14:59chewbrancamy experience with large pattern matching pain comes from nginx rules and routing in rails where overtime it can get a little tricky
14:59chewbrancadnolen: ahhh ok interesting
14:59chewbrancadnolen: yeah top down pattern matching
15:01chewbrancaI've just run into situations before where you have a pattern that matches /foo/ and a pattern that matches /fooo/ and naturally you want to have the latter matched if the example is 'fooo', but you didn't order them properly so it matched /foo/
15:01dnolenchewbranca: never written very large patterns but I can imagine it gets complex. perhaps the next step - predicate dispatch - will shed some light how to do without the complexity.
15:01dnoleni.e. give warning on subsumed patterns.
15:02chewbrancayeah I mean you could easily argue that having very large patterns is a bad design, or that you can just be more careful with how you structure them; I was just asking because its something I've been wondering about lately and you're more familiar with pattern matching than I am
15:03dnolenchewbranca: well the predicate dispatch approach I'm considering would use a logic engine. I'm hopeful that will 1) free you from thinking about order 2) warn you about ambiguities.
15:04chewbrancadnolen: very cool
15:08nickmbaileyare github pull requests the standard way of submitting fixes to clojure contrib stuff
15:08dnolennickmbailey: no you have to have submitted a CA, must to go through JIRA w/ issue + patch.
15:09nickmbaileydidn't know there was a jira
15:09nickmbaileyCA stands for ...?
15:09hiredman~ca
15:09clojurebotCA is Contributor Agreement: http://clojure.org/contributing
15:09nickmbaileyi already sent a pull request haha
15:10bioinformaticszeCould anyone tell me what I'm doing wrong here?
15:10bioinformaticsze(ns leiningen.database (:require [clj-redis.client :as redis]))
15:10bioinformaticszeI'm getting a file not found error.
15:10bioinformaticszeI've run lein deps
15:11nickmbaileygood lord i have to send mail?
15:11bioinformaticszeI seem to be able to use the require outside of the (ns ...) list
15:11PPPaulcemerick!
15:13cemerickPPPaul!
15:13technomancyclojurebot: fax machine?
15:14clojurebotfax machine is http://achewood.com/index.php
15:14technomancy=(
15:15nickmbaileyis there a way to fax/email the CA? or i really have to buy stamps for the first time in years
15:17coopernursebioinformaticsze: can you post a gist of your project.clj and the .clj file you're using in src?
15:19technomancyclojurebot: forget fax machine |is| http://achewood.com/index.php
15:19technomancyclojurebot: fax machine is http://tinyurl.com/ygc9w2
15:19clojurebotc'est bon!
15:25bioinformaticszecoopernurse: https://gist.github.com/1157747
15:25bioinformaticszecoopernurse: Thank you
15:28PPPaulcemerick. it works! my db is alive!
15:28cemerickPPPaul: Fabulous.
15:28cemerickMy invoice is on its way.
15:28cemerick;-)
15:29cemerickPPPaul: some neat new stuff coming to clutch soon, hopefully. Glad things are working out for you. :-)
15:30dnolenhmm looks like we can't really follow map destructuring style in map patterns.
15:30@chouserooh, why's that?
15:31dnolenchouser: well the keys have to be unique, shoulda noticed earlier but was busy thinking about other things.
15:32dnolen{0 :a 0 :b} won't fly.
15:32@chouserah
15:32@chouserof course
15:32PPPaulcemerick... what do you use for dates/times?
15:32PPPaulclj-time isn't working for me
15:33cemerickPPPaul: Just standard ISO date strings.
15:33PPPaulok... more code for me
15:33dnolenchouser: it's why :as is so easy to support in Clojure, because maps are reversed in destructuring.
15:33cemerickPPPaul: https://github.com/cemerick/utc-dates
15:33dnolenchouser: so it also means we have to move :only out of the map pattern.
15:34dnolen({:a 0 b: 0} :only [:a :b]), not so bad really, but it was a nice dream before.
15:57chewbrancadnolen: ahhh interesting, just getting to the part of the video where you talk about predicate dispatch and top down ordering, I didn't even think about the issues with order and dynamically adding new predicate matches, that's tricky
15:57chewbrancadnolen: switching back and forth between watching this and handling emails :-)
15:59chewbrancadnolen: I see where you were going with core.logic integration now, cool stuff
16:11coopernursebioinformaticsze: sorry, was in a meeting.. looking at your gist now
16:12chewbrancadnolen: hrmmm that gets tricky, looking at your example of (defpred foo ..., so lets say you have an initial match when a is 2, but then you extend-pred with a match of c is 3, what happens when you have a hash that matches multiple predicates? do you prioritize on the user extended predicate, or prioritize the original, or run them both? or can you leverage core.logic to the point where you can detect user added ambiguous cases
17:25bioinformaticszeNo problem. You've aleady been a great help!
17:26NetpilgrimWell, I'm glad I haven't drawn too much criticism. I thought I was still not thinking functional enough with my visited variable. Thanks for your help guys. I'm off to the Clojure Web site to read some more.
17:27jamiltronMake heavy use of clojuredocs.org
17:27Netpilgrimjamiltron: Yeah, thanks. I've already found this site but not really looked at it.
17:37amalloyNetpilgrim: tooting my own horn here, have you tried 4clojure.org?
17:37Netpilgrimamalloy: No.
17:38amalloyif you're writing dfs with a visited atom, you should have little trouble with most of the 4clojure problems, but there are some tricky ones
17:40Netpilgrimamalloy: Nice idea. I'll have another look at it later.
17:43Netpilgrimamalloy: Using into and map instead of reduce and concat leaves me with nested lists with a lot of empty lists in it. Probably bad design on my part in returning empty lists whenever I reach leaves in the trees.
17:44amalloyNetpilgrim: mapcat, right? that should solve the problem, but i confess this sort of thing usually takes a couple tries for me
17:45Netpilgrimamalloy: Is there a way for a function to return nothing, not even nil?
17:46amalloyno
17:46Netpilgrimamalloy: Thought so.
17:47Netpilgrimamalloy: Then returning an empty list for a corner case if a function usually returns a sequence is probably not a bad idea.
17:53jeremyheiler,(seq ())
17:53clojurebotnil
17:53jeremyheilerIf it returns a seq normally, wouldn't nill mak emore sense then?
17:55dnolenjeremyheiler: ? isn't what you just demonstrated and said the same thing?
17:55jeremyheilerSorry, I wa replying to Netpilgrim
17:57Netpilgrimjeremyheiler: Could be that nil would be the more correct choice. I'm still new at this, and '() seemed to work fine.
17:59jeremyheilerNetpilgrim: If a function returns a sequence, and a sequence cannot be empty, than nil seems to make more sense than an empty list. I suppose if you have a use-case for wanting the empty list, that's fine.
18:01jeremyheilerThen again...
18:01jeremyheiler,(empty? nil)
18:01clojurebottrue
18:02Netpilgrimjeremyheiler: O, nil works perferctly fine here. BTW: I'm still not too sure about the use of the words sequence and collection. Is it right that sequence is basically an interface that all collections implement?
18:04Netpilgrimjeremyheiler: And if all collections are sequences, are there sequences that are not collections? Otherwise the words would be synonymous.
18:04jeremyheilerA sequence is a view on a collection.
18:04Netpilgrimjeremyheiler: That doesn't really explain anything for me. :)
18:05lobotomyhmm, is always returning a sequence and then using apply concat (or something similar) on the upper level considered good practice?
18:05lobotomywhen i was learning the basics of clojure, the most difficult thing was trying to get a non-nested list of lists out of recursive functions :)
18:06Netpilgrimlobotomy: That was my problem, too. And mapcat solved it. I have no idea if it's good practice.
18:06lobotomyso nowadays i just do (if success (list result)) and otherwise, (apply concat (for [...] (recursive-call ...)))
18:06lobotomybut not sure if there's something better. yeah, mapcat would be similar to apply concat there i think
18:08amalloylobotomy: i recently realized that the (apply concat (for ...)) construct is never necessary
18:08amalloy&(apply concat (for [x (range 5)] (range x))) ;; option 1
18:08lazybot⇒ (0 0 1 0 1 2 0 1 2 3)
18:09amalloy&(for [x (range 5), y (range x)] y) ;; option 2
18:09lazybot⇒ (0 0 1 0 1 2 0 1 2 3)
18:09jeremyheilerNetpilgrim: collections in seqable (they implement clojure.lang.Seqable) which then returns a sequence that operates over the collection. This allows you to use any collection as a sequence, and therefore all the fuctions that operate on sequences.
18:10jeremyheilercollections are seqable**
18:10TimMcWhere "seqable" means "can be passed to "seq", yeah?
18:13Netpilgrimjeremyheiler: This sounds like it's just interesting stuff about the internal implementation of Clojure. But can't I just use collections wherever the documentation talks about sequences without doing something like calling seq? When is seq ever necessary?
18:13jeremyheilerTimMc: yeah
18:13amalloyNetpilgrim: it's rarely necessary
18:13amalloybut knowing whether you have a seq or some other kind of collection does frequently matter
18:14Netpilgrimamalloy: Could you give an example?
18:14lobotomyamalloy: hmm, not sure i see your point... are you saying that the double for works for every situation?
18:14amalloy&(let [coll (vector 1 2 3 4), seq-version (seq coll)] {:coll (conj coll 5), :seq (conj seq-version 5)})
18:14lazybot⇒ {:coll [1 2 3 4 5], :seq (5 1 2 3 4)}
18:15amalloylobotomy: any time you would (apply concat (for [...] body)), you can instead write (for [... x body] x)
18:15lobotomyhere's a piece of some code i wrote just now: https://gist.github.com/1158162
18:15lobotomy(yeah, there are other issues etc, but)
18:16lobotomyhow would i apply the "smarter for" in that?
18:16TimMcNetpilgrim: ##(let [mystery [1 2 3 4]] (if (seq mystery) "It's seq'able!" "Not seq'able"))
18:16lazybot⇒ "It's seq'able!"
18:16TimMcAnd when something is seq'able, then you can call (first ...) on it, etc.
18:17TimMcThat's my major use for it, as a guard predicate.
18:17amalloylobotomy: something like https://gist.github.com/1158172
18:17NetpilgrimTimMc: Hm, I guess it will come up some time in my code.
18:18TimMc&(let [coll (vector 1 2 3 4), seq-version (seq coll)] {:coll (cons coll 5), :seq (cons seq-version 5)})
18:18lazybotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
18:18amalloyi'm pretty sure your filter is complete nonsense, but i added a :when just in case
18:18TimMcbah
18:19amalloyTimMc: cons takes args opposite from conj
18:19TimMcyeah
18:19TimMc&(let [coll (vector 1 2 3 4), seq-version (seq coll)] {:coll (cons 5 coll), :seq (cons 5 seq-version)})
18:19lazybot⇒ {:coll (5 1 2 3 4), :seq (5 1 2 3 4)}
18:20amalloylobotomy: you see what i mean? pull the filter and the nested-iteration into the `for` bindings, and then there's no need to filter or concat
18:20Netpilgrimamalloy: Your example shows that sequences prepend with conj like lists. What is the difference between lists and sequences?
18:20TimMcNetpilgrim: ^ cons calls seq on its argument, conj does not -- amalloy's example was a little sneaky (you wouldn't call (conj (seq coll) ...), you would call (cons ... coll))
18:21amalloyTimMc: i disagree re: sneakiness
18:21amalloysomeone passes you a collection, and it might be a seq or something else, so you conj into it rather than consing
18:21TimMcYou would, wouldn't you.
18:21amalloythus, the person who passes it to you should know ehther it's a seq or a vector or what, to know what the result of the conj will be
18:22TimMcamalloy: I said (comp conj seq), not conj
18:22TimMc(effectively)
18:22amalloyright...and i never do (comp conj seq) either
18:22amalloyi'm supposing that those values get passed to you from elsewhere
18:23amalloyNetpilgrim: that's a complicated question. lists are a kind of collection, and thus seqable. they conj to the front because that's the efficient way to do it for lists, just like for seqs
18:24TimMc,(type (seq ()))
18:24clojurebotnil
18:24TimMc,(type (seq (list 1 2 3)))
18:24clojurebotclojure.lang.PersistentList
18:25TimMc,(type (list 1 2 3))
18:25clojurebotclojure.lang.PersistentList
18:25TimMcOho!
18:25jeremyheiler,(type (seq [1 2 3]))
18:25clojurebotclojure.lang.PersistentVector$ChunkedSeq
18:25TimMc,(type (cons 4 [1 2 3]))
18:25clojurebotclojure.lang.Cons
18:26jeremyheilerhah
18:26TimMcSo yeah, some seqs are implemented with list, others not.
18:27lobotomyamalloy, actually the when-let returns nil when the condition isn't met, which is why i have that filter complement nil :)
18:27amalloylobotomy: ##(apply concat '[(seq A) nil (seq B)])
18:27lazybot⇒ (seq A seq B)
18:27amalloyyou don't have to filter the nil out, is my point
18:28lobotomyah, ok
18:28NetpilgrimI'm all for interesting implementation details but I still don't see why it's necessary or useful to have sequences in the language when there are lists and arrays and ways to transform between them.
18:28amalloysequences are FANTASTIC
18:28lobotomyand it apparently works when it's all nil. heh
18:28lobotomythe more you know!
18:28amalloyyou don't have to *know* whether you have a list or an array or what. that's the whole beauty
18:28jeremyheilerTimMc: Interestingly, It seems that both PersistentVector.ChunkedSeq and PersistentList extends ASeq
18:28lobotomyi mean apply concat works with all nil
18:29lobotomyanyway, trying to get that to work with the actual code, and something's expecting a list where there's now only a boolean
18:29amalloyTimMc: "So yeah, some seqs are implemented with list, others not." - this is backwards
18:29TimMcNetpilgrim: They are two different abstractions that interconvert nicely.
18:30TimMcamalloy: Apparently!
18:30amalloylist is a collection which implements seq directly, and so returns itself when asked for a sequential view
18:30amalloythe others need some munging to get sequentialized, so they return a different type
18:30lobotomyhow do i get a backtrace that's actually worth a damn... slime is saying the error happens in mything.core$eval12317.invoke(NO_SOURCE_FILE)
18:31lobotomywhile running the unit tests from the command line tells me it happens in a similar eval thing in mything.test
18:33Netpilgrimamalloy: But why isn't it enough to say that there are functions like first or what have you that work on both lists and arrays (possibly sets and maps?) without worrying the programmer about some implementation voodoo that makes using this unified interface possible?
18:33lobotomyoh well, it's bedtime anyway ;p
18:33TimMcNetpilgrim: first calls seq on its argument
18:33TimMcsorry, misread
18:33TimMcI should head home before I do any more damage. :-P
18:34amalloybecause by introducing seq as a globally-used interface, you only have to implement map once, for seqs; not once for maps and once for sets and...
18:34NetpilgrimTimMc: That's exactly what I mean: It's something done internally. Why do I have to know about it?
18:34amalloyit also means you can create your own data types that act as seqs, and first/map/etc will work on them without a problem
18:36Netpilgrimamalloy: Couldn't lists be used instead of seqs? Are there list functions that aren't seq functions?
18:36amalloyi think you should write some more clojure before you decide that the underlying architecture is wrong
18:37Netpilgrimamalloy: Sorry, I wasn't suggesting anything of the kind. I'm just trying to understand it – not even the architecture, just how to use the language and what the constructs are for.
18:37amalloythe seq abstraction is extremely powerful, and having to work explicitly with N different data types is a tremendous limiting factor
18:38amalloy&(nth (range) 1e8)
18:38lazybotExecution Timed Out!
18:38jeremyheilerFrom Joy of Clojure: It is better to have 100 functions operate on one data abstraction than 10
18:38jeremyheilerfunctions on 10 data structures.
18:38jeremyheiler—Rich Hickey
18:38amalloytoo large, i guess? anyway, lazy sequences mean that you can work with lists that are a hundred million elements long without needing to use up any memory
18:38amalloyby only creating elements as they're needed, and throwing them away when they're not
18:39Netpilgrimamalloy: Only seqs can be lazy, not collections?
18:39Netpilgrimamalloy: So lazy seqs would be an example of seqs that aren't collections?
18:39amalloy&(instance? clojure.lang.IPersistentCollection (seq (range 10)))
18:39lazybot⇒ true
18:40amalloyseqs are collections
18:40Netpilgrimamalloy: Argh, I thought I had it. :)
18:40amalloybut the point is that many collections can't be lazy; they instead choose to realize all their elements at once in order to provide other guarantees, like fast random access
18:42amalloybut often all you *need* is to be able to walk through the items one at a time, and you don't care how you get those items. so then you say to the collection, "hey, gimme a sequential view of yourself", and you work with that
18:42Netpilgrimamalloy: So to finally get my definitions straight: seqs are collections and other collections are not seqs but can always made into seqs?
18:42amalloyyes
18:43NetpilgrimHeureka! :)
18:43Netpilgrimamalloy: Thanks for your patience.
18:46jeremyheilerNetpilgrim: Sorry if I cause some confusion
18:46jeremyheilercaused*
18:46lobotomyamalloy: in my code, it seems your extended for thing just doesn't work. the base case returns a map, but putting the "item rec-result" there somehow does (apply vec that-map) or something, which i don't quite get
18:47dnolenBitVectors here we come :D
18:47lobotomyand that's probably why it gives those errors about expected list, got boolean
18:47Netpilgrimjeremyheiler: No problem. My confusion couldn't be improved upon.
18:48lobotomywhen i take away the "item rec-result" bit, it for some reason (apparently) works, except that there are empty lists, and it returns nested lists :)
18:48Netpilgrimjeremyheiler: BTW: The Joy of Clojure is already on its way to me. I've ordered it this afternoon.
18:48jeremyheilerNetpilgrim: You'll like it, it's a really good book
18:49Netpilgrimjeremyheiler: It sounds really good. I can't wait. But it will probably not arrive before Monday.
18:55lobotomyamalloy: apparently for turns the things it gets into vectors? or something? i don't fully understand what goes on there, but it seems if you have the "item rec-result" line there the item gets mangled
18:55amalloy&(seq {:a 1 :b 2})
18:55lazybot⇒ ([:a 1] [:b 2])
18:56amalloy&(for [entry {:a 1 :b 2}, x entry] x)
18:56lazybot⇒ (:a 1 :b 2)
19:00lobotomy&(for [a [1 2 3] x (assoc {} a (- a))] x)
19:00lazybot⇒ ([1 -1] [2 -2] [3 -3])
19:00lobotomy&(for [a [1 2 3]] (assoc {} a (- a)))
19:00lazybot⇒ ({1 -1} {2 -2} {3 -3})
19:00lobotomyso if i want the latter, how to make that work with the "both things inside for" thing? or is there no way?
19:15chouserlobotomy: what return value do you want there?
19:38ibdknoxanyone in the bay area looking for a Clojure job? :)
19:39amalloyibdknox: no, but i'm still curious
19:40ibdknoxI joined a YC backed startup a while ago
19:40ibdknoxwww.readyforzero.com
19:40ibdknoxand we're looking for some folks :)
19:40sridI heard that the creator Noir joined RFZ. is that you, ibdknox?
19:41ibdknoxsrid: yep yep
19:41sridgood for you. i'm still learning clojure.
19:41RaynesAlas! I have submitted abstracts for the Conj! Now I shall live in fear of public speaking.
19:41ibdknoxhaha
19:42ibdknoxRaynes: what's the worst that could happen ;)
19:42RaynesI could have to speak!
19:42sridit is hard to believe that one can make money with esoteric parenthesizes ;-)
19:42ibdknoxhaha
19:42ibdknoxsrid: you can make a lot if you do it right ;)
19:42amalloysrid: the money to be made is in the very small number of *other* characters you use
19:43sridthe worst that could happen is that amygdala can trigger an intense fear response. damn the amygdala.
19:46ibdknoxwell in case anyone *is* interested, you should shoot me an email: chris@readyforzero.com
20:24chewbrancainteresting, so clojure sorted sets sort on case sensitive values, but test uniqueness on non case sensitive values
20:24amalloychewbranca: i am willing to bet about a million dollars that this is untrue
20:24chewbranca(sorted-set "bar" "Baz")
20:25amalloy&(sorted-set "bar" "Baz")
20:25lazybot⇒ #{"Baz" "bar"}
20:26amalloy&(sorted-set "bar" "Baz" "baz")
20:26lazybot⇒ #{"Baz" "bar" "baz"}
20:27chewbrancayeap, typo on my end :/
20:28chewbrancaamalloy: good call
20:28amalloyit's a good thing, because i don't have a million dollars
20:28chewbrancahahaha
21:48duck1123Midje works in 1.3, right?
22:16amalloyduck1123: try it and see
22:36duck1123I keep getting no method errors from keyword in one project, it works in the other
22:59sridwhat is the recommended way to name a clojure library? eg: https://github.com/antoniogarrote/clj-haml uses "clj-haml" ... is "clj-" a common prefix, or should it just be "haml"?
23:00redingerIn general, no clj- prefix. However, that is a Clojure port of HAML, so in that case it makes sense.
23:06TimMcwait wait wait
23:06TimMcjeremyheiler: Did you just attribute an Alan Perlis quote to Rich Hickey?
23:06TimMcjeremyheiler: http://www.cs.yale.edu/quotes.html #9
23:09sridi think RH merely adapted that quote to use 'data abstractions' (instead of 'data structures')
23:09sridi'm just guessing.
23:10sridredinger: also, the twitter api is named "clojure-twitter" and the oauth api is named "clj-oauth"
23:10sridand there is "com.twinql.clojure/clj-apache-http"
23:11sridso I'd name it "stackoverflow"?
23:12greghthe api can apply to all stackexchange sites, not just stackoverflow
23:12amalloyi'm sure someone would call it stackojureflow
23:13amalloybut if anyone suggests that for real you should murder them
23:13duck1123clj- is for when you can't think up a good name
23:14sridanother naming related question - why are some clojars named "com.zacharykim/clj-http" instead of "clj-http"?
23:15redingeryeah, I think if you go with something generic like stackoverflow, you'd have to go with a clj- prefix. Whereas if you go with something like German literary figures, you can skip the prefix
23:15sridclj-stackexchange, perhaps.
23:15alandiperti think there's an argument for tossing clj/clojure- on the front if it's not consumable from other jvm langs
23:16sridsomeone named their Lucene api "clucy". heh.
23:24TimMcsrid: I like clever, simple, quasi-descriptive names. No mention of implementation. I wrote a (not great) behavioral circuit simulator called "feedback" and am writing a JS DOM/Canvas yoking thing called "syzygy".
23:24TimMcGood names are hard, though.
23:42coopernursesrid: +1 for clj-stackoverflow
23:50amalloysrid: what do they expose in their api? what would i use it for?
23:52sridi want to write something similar to http://weeklyreddit.appspot.com/ - to get, say, a feed of top stackoverflow posts on the [clojure] tag in the past week.
23:55sridthey expose pretty much everything I believe.