#clojure logs

2012-02-19

00:15Scriptorevery time I try to run lein it crashes with NoClassDefFoundError for jline/ConsoleRunner
00:15Scriptordo I need to have jline installed somewhere beforehand?
00:48muhooah, take-nth is really take-every-enth
00:48muhoo&(take-nth 3 [0 1 2 3 4 5 6 7 8 9 10 11])
00:48lazybot⇒ (0 3 6 9)
00:49muhoowhereas ##(nth [0 1 2 3 4 5 6 7 8 9 10 11] 3)
00:49lazybot⇒ 3
00:49muhoojust gets the nth
00:55amalloyScriptor: you probably have an old version of lein or something? it should be trying to use jline as a fallback if it can't find readline (although technomancy is removing the jline fallback at some point because it's so dreadful)
00:57Scriptoramalloy: just downloaded the script an hour or two ago, it says the version is 1.7.0?
00:58mdeboardmuhoo: I ran into that myself just an hour or two ago
00:59amalloyi dunno, ask in #leiningen
01:00muhoomdeboard: yes, i was replying to your question about it
01:01muhoohmm, is this outdated? is there a built-in that does this now? http://nakkaya.com/2010/06/15/clojure-io-cookbook/
01:01muhooi.e. the fetch-url function there, is that now in some clojure core or library?
01:02amalloy&(doc slurp) takes URLs
01:02lazybot⇒ "([f & opts]); Opens a reader on f and reads all its contents, returning a string. See clojure.java.io/reader for a complete list of supported arguments."
01:02amalloythis blog page is old enough that i'm not sure if it's outdated or was just never any good
01:03muhooheh
01:05muhoobut, the fetch-data function will deal with binaary files. slurp doesn't seem to based on the docstring.
01:05muhooor is there a core function that'll pull in a binary stream now.
01:08citizenparkerSorry for a n00b question but my google-fu is failing me:
01:08citizenparkerIs there a way to specify a script or block of code that should run each time "lein repl" is run?
01:08citizenparkerSimilar to what .irbrc can achieve with irb in Ruby>
01:12mdeboardmmkay I'm pretty pleased with myself for getting http://www.4clojure.com/problem/46
01:20ibdknoxSo I built an ipad interface for overtone using noir + cljs :)
01:21replacaibdknox: man, you never stop! That's cool. Time to jam!
01:22ibdknoxI'm going to record myself building it from scratch tomorrow
01:22ibdknoxfigured some people might find it interesting to see a cljs project from start to finish
01:27amalloyoh, for overtone. i read that as "everyone" a dozen times. that sounds pretty awesome
01:27ibdknoxit controls a dubstep and has a row of buttons for piano keys
01:27ibdknoxyou can control the wobble and the note for the dubstep
01:29muhoocool demo, can't wait to see/hear it
01:29muhooso wait, cljs, meaning, the synth is running on a server somewhere, not on the ipad?
01:30ibdknoxyeah the server is running on my laptop
01:30ibdknoxand the web app controls the synth on the server
01:30muhoovery nice. if it could stream audio you could have an online collaboration
01:30ibdknoxI tried that once upon a time ago
01:30ibdknoxlatency kills it
01:31ibdknoxmy friend and I tried all sorts of stuff to play guitar together, but it just never worked
01:31muhoogood point. i'd forgotten about that.
01:31muhooibdknox: are you a musician also?
01:31ibdknoxa fake one :)
01:32muhoothat's fun. i'm a musician and a fake programmer. you make more money than i'll ever dream of
01:32ibdknoxhaha
01:33muhoothough i have quit music recently to try to focus on making a living instead.
01:36Scriptorwhat do you guys play?
01:39ibdknoxsing + guitar
01:39ibdknoxthough I can only just barely play guitar
01:40muhooevery note of music i've done over the past 4 years has been made on and with linux
01:41muhooso the step from there to clojure hacker isn't quite so far.
01:43muhoohttp://storage.restivo.org/images/yankee.jpg (on left, partially cut off)
02:55emezeskemuhoo: nice, laptop + keyboard, that's what I do
02:55emezeskeI drilled some holes in my keyboard and installed a mount made for cars to hold my laptop
02:55emezeske:)
03:32Scriptorhmm, trying to run the lein batch file just results in "the syntax of the command is incorrect"
03:34Scriptorhmm, probably because I don't have wget
03:37klangfixed?
03:38Scriptornope
03:39ScriptorI googled it and found an old irc log, but the only solution offered there was to make sure java is installed, which I have (error persisted for that guy too)
03:39klangyou are running on a windows machine running lein via cmd, right?
03:40Scriptorright
03:40ScriptorI tried mingw32 earlier, lein downloaded fine but didn't run because it couldn't find jline
03:41klangyou don't have jline.jar in the classpath ..
03:42Scriptorit has to be called jline.jar, without a version number?
03:43Scriptoralso, seem to have fixed the batch file problem, for some reason it was wrapped in html, probably because of chrome
03:43klangas long as the jar file is on the classpath, you can call it what you want .. I think.
03:44Scriptorin that case, it's in the classpath and still doesn't work
03:47klangStep back a bit. Do you have a REPL up and running at all?
03:47klanglein new my-project;cd my-project;lein deps;lein repl
03:49Scriptorright now I just got lein to create a new project by using the batch file, repl seems to work fine
03:49klanghttp://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started#Enhancing_Clojure_REPL_with_JLine
03:49Scriptorso that's good, it still gives the jline error when I try to use the shell version with mingw32
03:51klanganother hint you might have already seen: http://stackoverflow.com/questions/3218961/clojure-lein-repl-with-jline
03:55Scriptorfirst link mainly seems to be about using the clojure jar directly, the second is osx-based although I'm looking for other jline installations now
03:56Scriptorsorry, I think I confused something earlier, is there any way to set the classpath when using lein?
03:56klangwell, you can modify it from the project.clj file
04:03emezeskeScriptor: You can view the CP with "lein classpath" and can add to it with :extra-classpath-dirs in your project.clj
04:04Scriptoremezeske: lein won't do anything though, it crashes when trying anything
04:04emezeskeScriptor: nevermind then!
04:05ScriptorI found out CLASSPATH wasn't even set as an environment variable though (doh!) and set it to at least contain the directory with jline, although that still doesn't work
04:48asmalaI'm running clojure-jack-in in Emacs using the latest Clojure, Leiningen, and swank-clojure. The REPL loads fine but running C-c M-P doesn't allow me to load the NS I'm working with ("[No match]"), even though the said file is inside the project directory in the right location (compiles fine and all). I tried googling for a solution, but so far nothing conclusive. Any ideas where I should look?
04:53amalloyyou need to load the file first
04:53amalloywith C-c C-k or similar
04:54asmalacool, that did the trick. thanks.
04:55fliebelIs there some sort of idiom for iterating with some extra state? It gets hairy really quick.
04:56amalloyreduce?
04:56fliebelamalloy: I need the seq, so that'd be reductions, let me see.
04:58fliebelamalloy: Hrm, I don't think so. What could work is maybe (map first (iterate f [x y]))
04:59fliebelWhere y is some state that does metter, but is not the result I wnat.
05:00amalloyi assumed that was what you meant (and were objecting to) by "iterating with some extra state"
05:01amalloythough that general pattern is captured by unfold, i think. you might grab an implementation of that and see if it simplifies things or makes them more complicated
05:02fliebelamalloy: I see, *googles amalloy-utils*
05:02amalloyhttps://github.com/flatland/useful/blob/develop/src/useful/seq.clj#L121
05:05amalloymy implementation is pretty dumb, though. the type signature in haskell is much nicer than mine
05:07fliebelamalloy: I think map-iterate reads easier in my case. I should have remembered that. Python spoiled me.
05:14mikeraanyone from clojure core team around?
05:40fliebelI wonder if there is something between let and doto. I need weave in some other code in the doto, so I'm now doing (let [ x ...] ... x)
06:00gfredericksfliebel: can't you use regular functions in doto?
06:02gfredericksit seems to work just like ->
06:16fliebelgfredericks: I think you can...
06:16fliebelWriting a functional game isn't as easy as it seems :(
06:18gfredericksfliebel: what sorta game?
06:18fliebelgfredericks: pirate scrolling shooter multiplayer whatever
06:19fliebelSo far, a sane time model is nice, but dealing with so much state hurts.
06:20gfredericksusing a pile of the concurrency primitives?
06:21fliebelgfredericks: Currently none, just a lazy sequence of frames. The next frame is based on a pure function of the current frame.
06:21AimHereState? Just have a function describing your gamestate, and call it with the inputs, so that it returns the next function to call
06:24fliebelThe pain is in modifying the map representing the world. The common case is just (-> world statements), but the reality gets really ugly.
06:26AimHereI reckon that the more state your game involves, the sillier it is to choose a pure functional approach to coding it, but it depends on what your aim is here
06:28fliebelAimHere: My aim is to get a working game.
06:33fliebelMaybe I should just use a pile of refs, or read this stuff again: http://prog21.dadgum.com He has some posts about this.
06:33fliebelhttp://prog21.dadgum.com/3.html http://prog21.dadgum.com/23.html
07:38tdrgabihow can I insert into a table with clojureql if I want an auto_incremented key? clojureql doesn't like when I insert with a missing value
07:38tdrgabiif the table has id, name. I can't (conj! tablename {:name "something"})
07:38tdrgabiit just says "Evaluation aborted"
09:19gfrederickstdrgabi: I think I may have solved that problem once before. Let me know if you're still around and I'll see if I can find it
11:13kijHi all, In emacs - After lots of output, my slime repl gets really slow. Is there anyway to fix that? other than restarting it ?
11:15otfrom1and that incanter-* release is a real 1.3.0 not a snapshot
11:15stuartsierrakij: There's a SLIME repl erase-buffer command.
11:15stuartsierraC-c M-o if I I recall
11:17kijstuartsierra: Thanks!
11:17stuartsierranp
12:07mdeboardHm can anyone explain to me why I'm getting the error on the bottom of this paste when I run the code on the top? http://paste.pocoo.org/show/553511/
12:07mdeboardis `coll` not passed into the inner scope ?
12:07mdeboard(shot in the dark)\
12:08ieuremdeboard: you're walking off the end of the vector.
12:08mdeboardOh right
12:09mdeboardieure: thanks, I get it
12:09ieure(.indexOf coll 5) -> 7 -> inc -> 8 -> nth ->
12:09ieureYeah.
12:09mdeboardcool as soon as you said that it clicked
13:26yoklovexcuse the dumb question, but how do I run a function repeatedly in another thread? is it just (Thread. #(while @running (function-to-run)))?
13:27stuartsierrayoklov: that will do it. You can also use future rather than creating a thread explicitly.
13:27yoklovso that would just be future instead of Thread.?
13:27stuartsierrayes
13:27yoklovwhat's the difference?
13:28stuartsierrafuture runs on the same thread pool as send-off for agents
13:28yoklovhm, okay, that more or less makes sense
13:28stuartsierraalso `future` is a macro so you pass the body of code you want to execute instead of a function
13:29yoklovi see
13:38yoklovhrm, how exactly do I start that future?
13:39yoklovor, is it automatically invoked
13:39TimMc&(doc future)
13:39lazybot⇒ "Macro ([& body]); Takes a body of expressions and yields a future object that will invoke the body in another thread, and will cache the result and return it on all subsequent calls to deref/@. If the computation has not yet finished, calls to deref/@ will block, un... https://refheap.com/paste/780
13:39yoklovhm
13:39TimMcso, the latter
13:57yoklovSorry for all the questions, I really have no experience with concurrency in any way, but am I doing anything wrong here? https://gist.github.com/1865156 At the very least, this code never seems to return from the call to `read-line`...
14:21yoklovweird, that works if i paste the main into the repl, but it doesn't work via `lein run`
14:26johnmn3hello all
14:27johnmn3quick question. I used clj-webdriver to build an automation tool for my sister's job. She works from home, processing scientific papers for publications.
14:30johnmn3And she wants to push the tool to the rest of her organization, but we're discussing how to monetize
14:30johnmn3we could leave it open source, do some service fee. Or we could hand over the code and charge them for the hours spent to write it.
14:31johnmn3we could sell the bits for a one time fee and hand over the rights.
14:31johnmn3we want them to come back for more though, when they see how much the current tools saves them money.
14:33johnmn3It is a bit of a hack, mind you, but it automates a repetitive process on a web-based workflow system that could save them thousands a month.
14:34johnmn3so how would you guys characterize this particular kind of service I'm providing and how would you charge for it?
14:34pipelinewoludn't it make more sense to talk to the customer about the options
14:34pipelinethey may REQUIRE the source from you, at the very least via escrow
14:34johnmn3providing the source is an option I'm completely open to.
14:35johnmn3thus far, it's like my sister is my customer, and I've shaved 20% of the time it takes to process a paper for her
14:36johnmn3so, in terms of specing out what the requirements are, my sister has more intimate knowledge than even her bosses on where the pain points exist
14:37johnmn3and she realizes that by providing this tool the rest of the organization, this activity can shave 20% across the board, for this type of task, which is one of the main tasks
14:40johnmn3another factor: should the price of the tool be influenced by how much money it saves the organization, regardless of how simple or how long it takes me to write it?
14:41johnmn3I also need to mind the licensing requirements of Clojure, clj-webdriver, selenium and the other libraries I'm leveraging
14:45johnmn3as a side note, I find it quite amazing that I can 355 lines of clojure, save an organization thousands of dollars a month, and charge them for it.
14:45pipelinethe first step is to actually talk to management, not necessarily as a sales call
14:45pipelinejust to explore the pain point
14:45pipelinebecause you don't know that they give a damn about saving thousands of dollars a month
14:46pipelinedeployment or training or human factors may dictate that the value of the tool is zero or negative
14:46pipelineall you know is what a line worker thinks about it
14:46johnmn3pipeline: she already talked to them and they're really excited about it.
14:46johnmn3they're scheduling a presentation to see it in action
14:48johnmn3the company is 3 managing partners, around 8 midlevel people, and problably around 50 or so people like my sister teleworking, actually doing the processing
14:53johnmn3my sisters group is one of three groups, probably around 12 people. The company is paid per paper they process, so if the tools I'm building can increase the number of papers that the worker bees can process by 20% a month, that's a pretty good incentive
14:56beffbernardI have a style question.. I have a fn and piece of state that I need to persist. You can think of it as a state machine.. you pass in the state to the fn.
14:56beffbernardHow do I go about persisting the fn?
14:57johnmn3beffbernard: what do you mean, persisting the fn? you mean persisting the output of the fn?
14:58beffbernardjohnmn3: I need to persist both for HA purposes
14:59beffbernardLike I mention before..it's like state machine.. that has a piece of state and transition-fn… I'd like to be able to store both somewhere
15:00johnmn3oh, the fn might be generated a runtime?
15:00beffbernardso if my node dies, I can just respawn on some other process
15:00beffbernardyup
15:00johnmn3(def m {:a (fn [x] (str "hi " x))})
15:00johnmn3then persist the m
15:00johnmn3I guess
15:00ibdknoxthat won't do what you want
15:01ibdknoxunless persist means in memory in a clj process
15:01ibdknoxif you're using pure functions, the only thing you'd need to persist is the input
15:01ibdknoxsince the fn could be generated again based on it
15:02johnmn3i mean, fns are data, and can be stored in and datastructure/state machine you want
15:02ibdknoxnot how you did it :)
15:02johnmn3how so?
15:02ibdknox,(pr-str {:a (fn [] 1)})
15:02clojurebot"{:a #<sandbox$eval27$fn__28 sandbox$eval27$fn__28@11e9862>}"
15:03ibdknoxcan't read that back in
15:03Null-A5if I write call a function with the body (filter #(= arg0 arg1) ..) is the predicate code generated at runtime?
15:03ibdknoxin any case, storing code sounds like a bad idea, you should write the system such that the desired fn can be regenerated from the input
15:03johnmn3,(({:a (fn [] 1)}))
15:03clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap>
15:04johnmn3,(({:a (fn [] 1)} :a))
15:04clojurebot1
15:04beffbernardibdknow: It's a pure function but they are generated at runtime.. I don't understand what you meant by just save the input
15:04ibdknoxjohnmn3: yes, he wants to persist it
15:04ibdknoxjohnmn3: I assume persist means in some non-local process, which means it needs to be serialized
15:04ibdknoxand you cannot serialize a function like that
15:04stuartsierraNull-A5: Clojure never generates code at run-time unless you call `eval`
15:05johnmn3right, serialization is how that is usually done right in most languages, right?
15:05ibdknoxbeffbernard: if you have the input that creates your function, you don't need to store it
15:05johnmn3beffbernard: I'd defer to idbknox's advice, as I have nominal foo
15:05beffbernardibdknox: ahhhhh
15:06Null-A5stuartsierra: I have this perf bottleneck, around a set of functions with symbols ..$evalXXXX$fn_XXX but i'm not calling eval anywhere in my code
15:07ibdknoxthen you can just go through the whole thing again magically and it'll be like nothing happened
15:07stuartsierraNull-A5: Anonymous functions are compiled into classes with generated names like that. The "evalXXX" may come from the REPL.
15:07ibdknoxassuming there are no side-effects
15:07ibdknoxbeffbernard: that's the beauty of functional programming :)
15:08Null-A5stuartsierra: alright, thanks!
15:08stuartsierraNull-A5: 'welcome
15:08johnmn3anyone have any advice on how I should go about charging for my automation tools?
15:09RaynesAmazon Checkout. My answer to life, the universe, everything.
15:09ibdknoxtime for a run. catch you guys later
15:11johnmn3Raynes: I liked your conj talk. I was noticing too that amalloy is always hyping juxt on irc
15:11RaynesHeh
15:11RaynesThanks
15:12johnmn3yea, another issue is how I actually get the money from them. I don't like dealing with paper checks
15:12johnmn3was wondering about paypal or google check out
15:13RaynesI've learned to hate paypal since the etsy fiasco.
15:14pipelinejohnmn3: if you're dealing with a business you can pretty well assume it's gonna be net 30 or net 90, and they'll pay you when they feel like, after repeated begging ;)
15:14johnmn3what is net 30/ net 90?
15:14pipeline30 days to mail you a paper check, 90 days to mail you a paper check
15:14johnmn3ah
15:15pipelineb2b payment processes suck
15:15pipelinethis is basically why cdw exists
15:15pipelinenobody actually likes firms like cdw, they don't necessarily add any value... they just exist to put up with the bullshit in your purchasing process
15:16johnmn3so giving them a google check out interface isn't going to cut it?
15:16pipelinemaybe it will
15:16pipelinesure would get you paid faster ;)
15:16pipelineit's not a normal way to do business, though :\
15:17johnmn3any new ycombinator startups making this easier?
15:18pipelineit continues the way it is because people like it this way
15:18pipelinesmall businesses don't like paying for things on time. "net 30" is really more like "net when i get around to it" for a lot of people. mmm interest-free, practically-no-recourse credit.
15:18ivanjohnmn3: Stripe?
15:19Null-A5Stripe looks promising
15:19pipelinestripe is awesome
15:20Null-A5i wonder if they use clojure
15:20pipelinei actually saw people using stripe at the christmas fairs this year
15:20Null-A5do you mean square?
15:23TimMcThe little USB dongle?
15:23pipelineyes I meant square
15:23pipelinewhoops
15:23Null-A5heh they're both interesting
15:23pipelinethey're both amazingly low-friction credit card processing
15:23johnmn3whats the difference between stripe and square?
15:24johnmn3well, with square, I can use my phone to charge your phone in person
15:24Null-A5square is the stereo jack dongle
15:24Null-A5stripe is sort of like paypal
15:24johnmn3Null-A5: you don't need the dongle any more.. you can take a picture of the card
15:24TimMcErr, not USB, audio of course
15:24Null-A5johnmn3: oh nice!
15:25Null-A5I never even thought of that
15:25TimMcThat's pretty fantastic.
15:26johnmn3but I'd imagine you could do some kind of only checkout thing online with square too
15:26Null-A5they're probably avoiding that market on purpose
15:26sritchieis anyone here using clutch past 0.3.1?
15:26johnmn3and they'd take care of all state/federal/whatever taxes, right?
15:39johnmn3going with stripe
15:42TimMcYeah, I doubt they'd be thrilled giving you their corporate credit card.
15:47demolithion&(reduce {:1 1} merge [{:2 2}])
15:47lazybot⇒ {:2 2}
15:48TimMcdemolithion: ##({} :key :not-found)
15:48lazybot⇒ :not-found
15:49Raynes&(:key {} :not-found
15:49lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
15:49Raynes&(:key {} :not-found)
15:49lazybot⇒ :not-found
15:49RaynesThe last paren is always the hardest.
15:50demolithionTimMc: argh, thanks :)
15:54TimMcFunctional programming can give you some pretty weird bugs.
15:55TimMcRaynes: Didn't lazybot used to auto-complete? ...testing ##(+ 2 3
15:56AimHereTheoretically though, they should always be reproducible
15:56RaynesTimMc: I removed it because we were moving to Clojure 1.3 and the stuff that did that required fnparse which as long since been abandoned.
15:56TimMcgot it
15:56RaynesTimMc: We'd love for someone to rewrite it using a different parser or something though. Nobody has cared enough yet.
15:56TimMcWait, fnparse is abandoned? :-(
15:56ibdknoxpoor lazybot he's only half the bot he used to be
15:57RaynesParsley is probably a better choice, but I haven't had much luck with understanding cgrand software. ;)
15:58TimMcheh
15:58ibdknoxlol
15:58brehauthaha
15:58TimMcMaybe it's like Emacs
15:59TimMcwhere it's really worth it, but you just have to keep banging your head against it
15:59brehautRaynes: you could just roll your own lib from first principles with algo.monads
15:59TimMcuntil you acquire the right kind of brain damage in order to understand it.
16:09ibdknoxAny of you guys using jekyll for your blog?
16:10brehautibdknox: jimduey is i believe
16:10taliosmorning brehaut
16:10brehautmorning talios
16:11ibdknoxthat appears to be true :)
16:11Raynesibdknox: I use octopress which uses jekyll.
16:12RaynesI'm a big fan.
16:12brehautibdknox: github pages sites are likely to also be jekyll too (eg, mmcgrana.github.com at a guess?)
16:12ibdknoxRaynes: I've decided to try it out
16:12ibdknoxmy poor website hasn't gotten any love in a very long time
16:13TimMcI finally wrote a technical blog post for the first time in like 2 years.
16:13ibdknoxthen I'll have something to post my little screencast for creating an overtone ipad controller :)
16:14TimMcNot much point in updating the look if the content is just about missing.
16:14ibdknoxTimMc: yeah. I used to write all the time :(
16:18brehautyou can squirrel way too much writing time away building your own bloggy shaped ball of string
16:19ibdknoxhence why I was going to move to jekyll :)
16:19brehautprobably wise :P
16:19brehauton the other hand, i do love the flexibility i have ;)
16:19citizenparkeribdknox: I <3 jekyll for my blog
16:20ibdknoxbrehaut: I kept saying that... and then never actually did anything with it
16:20ibdknoxlol
16:20brehautlol
16:21TimMc$mail tmciver I finally built a working with-temp-ns in org.timmc.handy.
16:21lazybotMessage saved.
16:21brehautibdknox: i made sacrifices on my site to get to write things and poke at the string. Everything is on couchdb and futon is my admin interface ;)
16:21ibdknoxhaha
16:21ibdknoxcool
16:29wuboIn case anyone has been holding off reviewing mikera's better-reduce branch, I've merged his changes all-together into one commit so it's easier to review. https://github.com/netguy204/clojure/commit/b262a69c32d26bb6f3c5ba711310361d77609a22
16:29TimMcYesterday, I discovered that 'eval gives you a free top-level to do fancy things in.
16:29pipelinefree top-level?
16:29TimMcfree as in beer
16:29wuboI'm seeing the same 3x-4x speedup he initially reported: http://dev.clojure.org/jira/browse/CLJ-894
16:29TimMcnot as in binding
16:30TimMcpipeline: https://github.com/timmc/handy/blob/master/src/org/timmc/handy.clj#L53
16:35tmciverTimMc: does this solve the import deffing problem you ran into before?
16:35tmciverTimMc: testing of it, I should say.
16:36TimMcIf we're thinking of the same thing, yes.
16:36TimMcI finally figured out how to combine it with deftest, too.
16:36tmciverCool
16:39TimMctmciver: https://github.com/baznex/imports/blob/defproxy/test/org/baznex/test/imports.clj#L86
16:40TimMcBasically, use with-temp-ns to generate a set of answers, and check the results with clojure.test/is
16:40TimMcGood ol' eval.
16:55tmciverTimMc: looks like the test relies on with-test-ns returning the class that is imported?
16:55TimMcyep
16:56TimMcThe class and .getName could just as easily be pushed inside the with-test-ns form.
16:56tmciversure
16:57TimMcIf you look at the last test, there's a with-test-ns that returns the def'd IFn itself, indicating we should really expose a build-static macro too.
16:57TimMc(build-static 'Math 'abs) => a proxy impl of Math/abs
16:58TimMcYou know, separate the def from the value.
16:59taliosarbscht - do you have a bog or anything online these days? lisp.geek.nz is all dead and everything
17:01RaynesI hope he doesn't have a bog online.
17:01RaynesThat could get awfully wet.
17:02brehautRaynes: i think a bog is any blog that runs on wordpress ;)
17:03taliosmuhahaa
17:23TimMctmciver: Multi-clause def-statics: (def-statics (String valueOf) (Double parseDouble POSITIVE_INFINITY))
17:53TimMctmciver: Would it be insane to expand the scope of def-statics (under a different name) to pull in instance methods as well?
17:55TimMcI'm kind of curious what memfn does now.
18:09tmciverTimMc: what's an example of pulling in instance methods?
18:16tmciverTimMc: what branch is this new code on?
18:29tmciverTimMc: cool, I didn't know about memfn
19:35TimMcmemfn is weird.
19:36RaynesTIL how hammers are made.
19:36TimMcHaha, someone doesn't know the difference between group and artifact. (Looking at clojurebot's announcement)
19:37TimMctmciver: An instance method would just take an additional argument over the declared signature.
19:38TimMcand this is on the defproxy branch
19:50amalloyTimMc: you're curious about memfn? there's hardly anything to know, right?
19:52amalloythough it could be improved to support type-hinting. eg, (memfn ^String length)
19:53lamedCan't take value of a macro: #'compojure.core/GET, compiling:(kunabi/core.clj:7)
19:56amalloyTimMc: okay, you got me. it turns out i didn't understand what memfn actually does; the docstring is somewhat confusing
19:59amalloyi thought (memfn put k v) was (fn [obj] (.put obj k v)), not (fn [obj k v] (.put obj k v))
20:52murmwhat's the cheapest hosting solution with root access?
20:52murmI have a linode, but 20 bucks a month is too much for what I want it for.. simple playing around and testing
20:53brehaut_johnmn3: prgmr.com is pretty cheap. the IO is reputedly not as good as linode
20:54brehaut_dunno if its the cheapest though
20:54echo-areahttp://pastebin.com/uf7KmsT7
20:55echo-areaCan somebody explain the behavior of the above program? I can't understand it. Thanks
21:03echo-areaIt's about alter and commute
21:03echo-areaThe retries count seems magical
21:13weavejesterWhat do you want explained, exactly?
21:14weavejesterI guess it's showing how commute requires less retries than alter.
21:15weavejesterecho-area: Was there anything in particular about that program you didn't understand?
21:15echo-areaThere are many points I don't understand. 1. Why does commute-a-alter-b's transaction become the second committed? It's thread sleeps longer than alter-b's thread
21:17echo-areas/It's/Its/
21:17weavejesterWell, the sleep times are only a few milliseconds, and threads take a little while to create.
21:19weavejesterAlso, the state of the refs isn't changed until the transaction commits
21:21echo-areaHmm, you're right. I should make the sleep time larger. I changed 60, 70, 100 to 1000, 2000, 2700, respectively, and the result changed. I'll try to explain the new behavior myself later. Thanks
22:25zawzeyHmm, what's wrong with this function?
22:26zawzeyhttps://gist.github.com/6a6bc3fee0669f6925de
22:27zawzeywhy can't i set the return value
22:27zawzeyto a variable
22:28zawzeyif i called that function, the following is returned: ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn clojure.lang.Var.fn (Var.java:378)
22:30brehaut_zawzey: you probably dont want to be deffing things inside a function
22:30zawzeybrehaut_: Well, okay, bad example, but suppose i do some operations inside the function
22:31zawzeysame question
22:31zawzeyupdated the gist
22:31brehaut_zawzey: anyway, (def dummy 234) returns a var
22:32zawzeybrehaut_: yes i know, but i'm not trying to return values, but execute something inside the if
22:32zawzeybrehaut_: i was trying to execute 2 S-expressions inside the if loop
22:33brehaut_zawzey: (+ 1 1) evalutes to 2, 2 is not a function
22:33xeqi,(do (+ 1 1) nil)
22:33clojurebotnil
22:34brehaut_zawzey: next time, ask the question you really mean, rather than a circuitious 'whats wrong with this' ?
22:34brehaut_it makes it much easier to help
22:35zawzeybrehaut_: Okay, i'm trying to come up with a better example...
22:35brehaut_zawzey: you dont need a better example, xeqi already have you the answer
22:35brehaut_zawzey: use a do
22:36xeqinot very explainitory though, stopped when I saw you explaining
22:36brehaut_or, if you are really using just the 'then' portion of an if, and you have a real condition rather than a tautological one, (when condition (+ 1 1) nil) which contains an implicit do, and an else clause that evaluates to nil
22:37zawzeybrehaut_: Ah, yes, i think when might be the answer that i'm seeking
22:42amalloywhen is a quick-fix to your particular issue; understanding why the if doesn't work is the real answer you're seeking
22:43amalloyit's the difference between (do x y) and (x y). the former does x and then y, the latter calls x as a function with y as an argument
22:44zawzeywell, the real question is why "if" cannot have multiple s-expressions
22:45zawzeythat's the case coming from imperative programming, so i'm just caught by surprise by this
22:45zawzey(if expr ((then-expression 1) (then-expression2)) else-expr)
22:46dnolenzawzey: you have cond for that
22:46dnolen,(doc cond)
22:46clojurebot"([& clauses]); Takes a set of test/expr pairs. It evaluates each test one at a time. If a test returns logical true, cond evaluates and returns the value of the corresponding expr and doesn't evaluate any of the other tests or exprs. (cond) returns nil."
22:46amalloydnolen: no, he wants side effects
22:46amalloy(ie, when)
22:46dnolenamalloy: ah oh yeah, do
22:46zawzeyyes, i want side-effects
22:46brehaut_do is roughly equivalent to squigly braces + semicolons
22:47zawzeyyeah, just surprised by the if special form
22:47amalloybut seriously if you find yourself wanting side effects at a time when you don't know how to use 'do, you're probably not diving into the language mindset
22:47amalloytry to get rid of side effects and stop thinking about statements; expressions are king
22:49zawzeywell, in this case the side-effects are caused by trying to interface with an external engine, Rhino
22:49zawzeyand of course, i'm raw to clojure, so learning as i go along
22:52pipelinehttp://paste.lisp.org/display/127868
22:52pipelineI'm trying to generate a deck of cards, i.e. a pair of every possible suit and value
22:52pipelinemy nasty for-map construct ends up with a list of lists
22:52pipelinewhen I really want a single list
22:53pipelinewhat should I be doing here ?
22:53brehaut_pipeline: you dont generally need to use map inside a for
22:53TimMcpipeline: Mkae that map a second clause in the for
22:54TimMcpipeline: (for [suit suits, ord (keys ordinals)] [ord suit])
22:54pipelineoh that's vastly simpler
22:54brehaut_for is magical
22:54pipelineI've failed to understand destructuring again
22:55pipelineTimMc: thanks
22:56pipelineI was this close to nesting macros to generate a set of two item vectors, and I just knew that was dead wrong
22:56amalloynine through ace? someone playing pinochle or euchre or something?
22:56pipelineyep
22:56pipelineI needed something to play with, and card games are relatively simple problems
22:57amalloypipeline: you might be interested in one of my first clojure projects, just to get a look at what another beginner (me from ages ago) thought about writing a card-game program
22:58amalloyhttps://github.com/amalloy/ddsolve is a solver for contract bridge, which is correct but way too slow to be viable
23:00pipelinehaha good lord
23:01pipelinethat's well beyond my capabilities. not least because I can't play bridge
23:01amalloymeh. the rules that matter for solving and the same as euchre rules
23:01devndid someone say pinochle?
23:40jaimeflein compile and uberjar seem to actually start the compojure app...
23:41jaimefhttps://gist.github.com/1867888
23:41Raynesjaimef: Does Kunabi.core have a top level form that calls the function that starts the server?
23:41Raynesjaimef: If what I said doesn't make sense, please paste the core file.
23:42jaimefk
23:43jaimefhttps://gist.github.com/1867893
23:43RaynesAh, yes.
23:44Raynesjaimef: When it tries to load this file, the `run-jetty` call fires and starts the server. Try (defn -main [& args] (run-jetty kunabi {:port 8080}))
23:44RaynesYou're also going to need to add (:gen-class) to your ns form.
23:44jaimefok thanks
23:44Raynes(If what you're trying to do is uberjar this and run it as an executable)
23:47jaimeftrying to deploy it. lein deps/run locally works fine, copied it over to remote server, but lein run tries to download dependencies
23:55emezeskeIf I start my clojure app with the CLASSPATH set to include /my/dir, and then *after* the app has started, add Clojure files to that dir, should I expect the app to be able to load them?
23:55emezeskeOr is that a crazy thing to expect
23:56technomancyshould be fine
23:57emezesketechnomancy: Thanks.
23:58jaimeftechnomancy: hey, if you lein deps on a system, and lein runs works fine, can it be assumed that that project directory could be lein run from another system without need to pull down deps?
23:59technomancyjaimef: in lein1 that should work as long as there are no snapshots
23:59jaimefyeah let me verify no skew in lein version