2012-02-19
| 00:15 | Scriptor | every time I try to run lein it crashes with NoClassDefFoundError for jline/ConsoleRunner |
| 00:15 | Scriptor | do I need to have jline installed somewhere beforehand? |
| 00:48 | muhoo | ah, take-nth is really take-every-enth |
| 00:48 | muhoo | &(take-nth 3 [0 1 2 3 4 5 6 7 8 9 10 11]) |
| 00:48 | lazybot | ⇒ (0 3 6 9) |
| 00:49 | muhoo | whereas ##(nth [0 1 2 3 4 5 6 7 8 9 10 11] 3) |
| 00:49 | lazybot | ⇒ 3 |
| 00:49 | muhoo | just gets the nth |
| 00:55 | amalloy | Scriptor: 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:57 | Scriptor | amalloy: just downloaded the script an hour or two ago, it says the version is 1.7.0? |
| 00:58 | mdeboard | muhoo: I ran into that myself just an hour or two ago |
| 00:59 | amalloy | i dunno, ask in #leiningen |
| 01:00 | muhoo | mdeboard: yes, i was replying to your question about it |
| 01:01 | muhoo | hmm, is this outdated? is there a built-in that does this now? http://nakkaya.com/2010/06/15/clojure-io-cookbook/ |
| 01:01 | muhoo | i.e. the fetch-url function there, is that now in some clojure core or library? |
| 01:02 | amalloy | &(doc slurp) takes URLs |
| 01:02 | lazybot | ⇒ "([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:02 | amalloy | this blog page is old enough that i'm not sure if it's outdated or was just never any good |
| 01:03 | muhoo | heh |
| 01:05 | muhoo | but, the fetch-data function will deal with binaary files. slurp doesn't seem to based on the docstring. |
| 01:05 | muhoo | or is there a core function that'll pull in a binary stream now. |
| 01:08 | citizenparker | Sorry for a n00b question but my google-fu is failing me: |
| 01:08 | citizenparker | Is there a way to specify a script or block of code that should run each time "lein repl" is run? |
| 01:08 | citizenparker | Similar to what .irbrc can achieve with irb in Ruby> |
| 01:12 | mdeboard | mmkay I'm pretty pleased with myself for getting http://www.4clojure.com/problem/46 |
| 01:20 | ibdknox | So I built an ipad interface for overtone using noir + cljs :) |
| 01:21 | replaca | ibdknox: man, you never stop! That's cool. Time to jam! |
| 01:22 | ibdknox | I'm going to record myself building it from scratch tomorrow |
| 01:22 | ibdknox | figured some people might find it interesting to see a cljs project from start to finish |
| 01:27 | amalloy | oh, for overtone. i read that as "everyone" a dozen times. that sounds pretty awesome |
| 01:27 | ibdknox | it controls a dubstep and has a row of buttons for piano keys |
| 01:27 | ibdknox | you can control the wobble and the note for the dubstep |
| 01:29 | muhoo | cool demo, can't wait to see/hear it |
| 01:29 | muhoo | so wait, cljs, meaning, the synth is running on a server somewhere, not on the ipad? |
| 01:30 | ibdknox | yeah the server is running on my laptop |
| 01:30 | ibdknox | and the web app controls the synth on the server |
| 01:30 | muhoo | very nice. if it could stream audio you could have an online collaboration |
| 01:30 | ibdknox | I tried that once upon a time ago |
| 01:30 | ibdknox | latency kills it |
| 01:31 | ibdknox | my friend and I tried all sorts of stuff to play guitar together, but it just never worked |
| 01:31 | muhoo | good point. i'd forgotten about that. |
| 01:31 | muhoo | ibdknox: are you a musician also? |
| 01:31 | ibdknox | a fake one :) |
| 01:32 | muhoo | that's fun. i'm a musician and a fake programmer. you make more money than i'll ever dream of |
| 01:32 | ibdknox | haha |
| 01:33 | muhoo | though i have quit music recently to try to focus on making a living instead. |
| 01:36 | Scriptor | what do you guys play? |
| 01:39 | ibdknox | sing + guitar |
| 01:39 | ibdknox | though I can only just barely play guitar |
| 01:40 | muhoo | every note of music i've done over the past 4 years has been made on and with linux |
| 01:41 | muhoo | so the step from there to clojure hacker isn't quite so far. |
| 01:43 | muhoo | http://storage.restivo.org/images/yankee.jpg (on left, partially cut off) |
| 02:55 | emezeske | muhoo: nice, laptop + keyboard, that's what I do |
| 02:55 | emezeske | I drilled some holes in my keyboard and installed a mount made for cars to hold my laptop |
| 02:55 | emezeske | :) |
| 03:32 | Scriptor | hmm, trying to run the lein batch file just results in "the syntax of the command is incorrect" |
| 03:34 | Scriptor | hmm, probably because I don't have wget |
| 03:37 | klang | fixed? |
| 03:38 | Scriptor | nope |
| 03:39 | Scriptor | I 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:39 | klang | you are running on a windows machine running lein via cmd, right? |
| 03:40 | Scriptor | right |
| 03:40 | Scriptor | I tried mingw32 earlier, lein downloaded fine but didn't run because it couldn't find jline |
| 03:41 | klang | you don't have jline.jar in the classpath .. |
| 03:42 | Scriptor | it has to be called jline.jar, without a version number? |
| 03:43 | Scriptor | also, seem to have fixed the batch file problem, for some reason it was wrapped in html, probably because of chrome |
| 03:43 | klang | as long as the jar file is on the classpath, you can call it what you want .. I think. |
| 03:44 | Scriptor | in that case, it's in the classpath and still doesn't work |
| 03:47 | klang | Step back a bit. Do you have a REPL up and running at all? |
| 03:47 | klang | lein new my-project;cd my-project;lein deps;lein repl |
| 03:49 | Scriptor | right now I just got lein to create a new project by using the batch file, repl seems to work fine |
| 03:49 | klang | http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started#Enhancing_Clojure_REPL_with_JLine |
| 03:49 | Scriptor | so that's good, it still gives the jline error when I try to use the shell version with mingw32 |
| 03:51 | klang | another hint you might have already seen: http://stackoverflow.com/questions/3218961/clojure-lein-repl-with-jline |
| 03:55 | Scriptor | first 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:56 | Scriptor | sorry, I think I confused something earlier, is there any way to set the classpath when using lein? |
| 03:56 | klang | well, you can modify it from the project.clj file |
| 04:03 | emezeske | Scriptor: You can view the CP with "lein classpath" and can add to it with :extra-classpath-dirs in your project.clj |
| 04:04 | Scriptor | emezeske: lein won't do anything though, it crashes when trying anything |
| 04:04 | emezeske | Scriptor: nevermind then! |
| 04:05 | Scriptor | I 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:48 | asmala | I'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:53 | amalloy | you need to load the file first |
| 04:53 | amalloy | with C-c C-k or similar |
| 04:54 | asmala | cool, that did the trick. thanks. |
| 04:55 | fliebel | Is there some sort of idiom for iterating with some extra state? It gets hairy really quick. |
| 04:56 | amalloy | reduce? |
| 04:56 | fliebel | amalloy: I need the seq, so that'd be reductions, let me see. |
| 04:58 | fliebel | amalloy: Hrm, I don't think so. What could work is maybe (map first (iterate f [x y])) |
| 04:59 | fliebel | Where y is some state that does metter, but is not the result I wnat. |
| 05:00 | amalloy | i assumed that was what you meant (and were objecting to) by "iterating with some extra state" |
| 05:01 | amalloy | though 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:02 | fliebel | amalloy: I see, *googles amalloy-utils* |
| 05:02 | amalloy | https://github.com/flatland/useful/blob/develop/src/useful/seq.clj#L121 |
| 05:05 | amalloy | my implementation is pretty dumb, though. the type signature in haskell is much nicer than mine |
| 05:07 | fliebel | amalloy: I think map-iterate reads easier in my case. I should have remembered that. Python spoiled me. |
| 05:14 | mikera | anyone from clojure core team around? |
| 05:40 | fliebel | I 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:00 | gfredericks | fliebel: can't you use regular functions in doto? |
| 06:02 | gfredericks | it seems to work just like -> |
| 06:16 | fliebel | gfredericks: I think you can... |
| 06:16 | fliebel | Writing a functional game isn't as easy as it seems :( |
| 06:18 | gfredericks | fliebel: what sorta game? |
| 06:18 | fliebel | gfredericks: pirate scrolling shooter multiplayer whatever |
| 06:19 | fliebel | So far, a sane time model is nice, but dealing with so much state hurts. |
| 06:20 | gfredericks | using a pile of the concurrency primitives? |
| 06:21 | fliebel | gfredericks: Currently none, just a lazy sequence of frames. The next frame is based on a pure function of the current frame. |
| 06:21 | AimHere | State? Just have a function describing your gamestate, and call it with the inputs, so that it returns the next function to call |
| 06:24 | fliebel | The pain is in modifying the map representing the world. The common case is just (-> world statements), but the reality gets really ugly. |
| 06:26 | AimHere | I 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:28 | fliebel | AimHere: My aim is to get a working game. |
| 06:33 | fliebel | Maybe I should just use a pile of refs, or read this stuff again: http://prog21.dadgum.com He has some posts about this. |
| 06:33 | fliebel | http://prog21.dadgum.com/3.html http://prog21.dadgum.com/23.html |
| 07:38 | tdrgabi | how 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:38 | tdrgabi | if the table has id, name. I can't (conj! tablename {:name "something"}) |
| 07:38 | tdrgabi | it just says "Evaluation aborted" |
| 09:19 | gfredericks | tdrgabi: 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:13 | kij | Hi all, In emacs - After lots of output, my slime repl gets really slow. Is there anyway to fix that? other than restarting it ? |
| 11:15 | otfrom1 | and that incanter-* release is a real 1.3.0 not a snapshot |
| 11:15 | stuartsierra | kij: There's a SLIME repl erase-buffer command. |
| 11:15 | stuartsierra | C-c M-o if I I recall |
| 11:17 | kij | stuartsierra: Thanks! |
| 11:17 | stuartsierra | np |
| 12:07 | mdeboard | Hm 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:07 | mdeboard | is `coll` not passed into the inner scope ? |
| 12:07 | mdeboard | (shot in the dark)\ |
| 12:08 | ieure | mdeboard: you're walking off the end of the vector. |
| 12:08 | mdeboard | Oh right |
| 12:09 | mdeboard | ieure: thanks, I get it |
| 12:09 | ieure | (.indexOf coll 5) -> 7 -> inc -> 8 -> nth -> |
| 12:09 | ieure | Yeah. |
| 12:09 | mdeboard | cool as soon as you said that it clicked |
| 13:26 | yoklov | excuse the dumb question, but how do I run a function repeatedly in another thread? is it just (Thread. #(while @running (function-to-run)))? |
| 13:27 | stuartsierra | yoklov: that will do it. You can also use future rather than creating a thread explicitly. |
| 13:27 | yoklov | so that would just be future instead of Thread.? |
| 13:27 | stuartsierra | yes |
| 13:27 | yoklov | what's the difference? |
| 13:28 | stuartsierra | future runs on the same thread pool as send-off for agents |
| 13:28 | yoklov | hm, okay, that more or less makes sense |
| 13:28 | stuartsierra | also `future` is a macro so you pass the body of code you want to execute instead of a function |
| 13:29 | yoklov | i see |
| 13:38 | yoklov | hrm, how exactly do I start that future? |
| 13:39 | yoklov | or, is it automatically invoked |
| 13:39 | TimMc | &(doc future) |
| 13:39 | lazybot | ⇒ "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:39 | yoklov | hm |
| 13:39 | TimMc | so, the latter |
| 13:57 | yoklov | Sorry 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:21 | yoklov | weird, that works if i paste the main into the repl, but it doesn't work via `lein run` |
| 14:26 | johnmn3 | hello all |
| 14:27 | johnmn3 | quick 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:30 | johnmn3 | And she wants to push the tool to the rest of her organization, but we're discussing how to monetize |
| 14:30 | johnmn3 | we 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:31 | johnmn3 | we could sell the bits for a one time fee and hand over the rights. |
| 14:31 | johnmn3 | we want them to come back for more though, when they see how much the current tools saves them money. |
| 14:33 | johnmn3 | It 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:34 | johnmn3 | so how would you guys characterize this particular kind of service I'm providing and how would you charge for it? |
| 14:34 | pipeline | woludn't it make more sense to talk to the customer about the options |
| 14:34 | pipeline | they may REQUIRE the source from you, at the very least via escrow |
| 14:34 | johnmn3 | providing the source is an option I'm completely open to. |
| 14:35 | johnmn3 | thus 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:36 | johnmn3 | so, 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:37 | johnmn3 | and 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:40 | johnmn3 | another 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:41 | johnmn3 | I also need to mind the licensing requirements of Clojure, clj-webdriver, selenium and the other libraries I'm leveraging |
| 14:45 | johnmn3 | as 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:45 | pipeline | the first step is to actually talk to management, not necessarily as a sales call |
| 14:45 | pipeline | just to explore the pain point |
| 14:45 | pipeline | because you don't know that they give a damn about saving thousands of dollars a month |
| 14:46 | pipeline | deployment or training or human factors may dictate that the value of the tool is zero or negative |
| 14:46 | pipeline | all you know is what a line worker thinks about it |
| 14:46 | johnmn3 | pipeline: she already talked to them and they're really excited about it. |
| 14:46 | johnmn3 | they're scheduling a presentation to see it in action |
| 14:48 | johnmn3 | the 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:53 | johnmn3 | my 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:56 | beffbernard | I 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:56 | beffbernard | How do I go about persisting the fn? |
| 14:57 | johnmn3 | beffbernard: what do you mean, persisting the fn? you mean persisting the output of the fn? |
| 14:58 | beffbernard | johnmn3: I need to persist both for HA purposes |
| 14:59 | beffbernard | Like 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:00 | johnmn3 | oh, the fn might be generated a runtime? |
| 15:00 | beffbernard | so if my node dies, I can just respawn on some other process |
| 15:00 | beffbernard | yup |
| 15:00 | johnmn3 | (def m {:a (fn [x] (str "hi " x))}) |
| 15:00 | johnmn3 | then persist the m |
| 15:00 | johnmn3 | I guess |
| 15:00 | ibdknox | that won't do what you want |
| 15:01 | ibdknox | unless persist means in memory in a clj process |
| 15:01 | ibdknox | if you're using pure functions, the only thing you'd need to persist is the input |
| 15:01 | ibdknox | since the fn could be generated again based on it |
| 15:02 | johnmn3 | i mean, fns are data, and can be stored in and datastructure/state machine you want |
| 15:02 | ibdknox | not how you did it :) |
| 15:02 | johnmn3 | how so? |
| 15:02 | ibdknox | ,(pr-str {:a (fn [] 1)}) |
| 15:02 | clojurebot | "{:a #<sandbox$eval27$fn__28 sandbox$eval27$fn__28@11e9862>}" |
| 15:03 | ibdknox | can't read that back in |
| 15:03 | Null-A5 | if I write call a function with the body (filter #(= arg0 arg1) ..) is the predicate code generated at runtime? |
| 15:03 | ibdknox | in 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:03 | johnmn3 | ,(({:a (fn [] 1)})) |
| 15:03 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap> |
| 15:04 | johnmn3 | ,(({:a (fn [] 1)} :a)) |
| 15:04 | clojurebot | 1 |
| 15:04 | beffbernard | ibdknow: It's a pure function but they are generated at runtime.. I don't understand what you meant by just save the input |
| 15:04 | ibdknox | johnmn3: yes, he wants to persist it |
| 15:04 | ibdknox | johnmn3: I assume persist means in some non-local process, which means it needs to be serialized |
| 15:04 | ibdknox | and you cannot serialize a function like that |
| 15:04 | stuartsierra | Null-A5: Clojure never generates code at run-time unless you call `eval` |
| 15:05 | johnmn3 | right, serialization is how that is usually done right in most languages, right? |
| 15:05 | ibdknox | beffbernard: if you have the input that creates your function, you don't need to store it |
| 15:05 | johnmn3 | beffbernard: I'd defer to idbknox's advice, as I have nominal foo |
| 15:05 | beffbernard | ibdknox: ahhhhh |
| 15:06 | Null-A5 | stuartsierra: 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:07 | ibdknox | then you can just go through the whole thing again magically and it'll be like nothing happened |
| 15:07 | stuartsierra | Null-A5: Anonymous functions are compiled into classes with generated names like that. The "evalXXX" may come from the REPL. |
| 15:07 | ibdknox | assuming there are no side-effects |
| 15:07 | ibdknox | beffbernard: that's the beauty of functional programming :) |
| 15:08 | Null-A5 | stuartsierra: alright, thanks! |
| 15:08 | stuartsierra | Null-A5: 'welcome |
| 15:08 | johnmn3 | anyone have any advice on how I should go about charging for my automation tools? |
| 15:09 | Raynes | Amazon Checkout. My answer to life, the universe, everything. |
| 15:09 | ibdknox | time for a run. catch you guys later |
| 15:11 | johnmn3 | Raynes: I liked your conj talk. I was noticing too that amalloy is always hyping juxt on irc |
| 15:11 | Raynes | Heh |
| 15:11 | Raynes | Thanks |
| 15:12 | johnmn3 | yea, another issue is how I actually get the money from them. I don't like dealing with paper checks |
| 15:12 | johnmn3 | was wondering about paypal or google check out |
| 15:13 | Raynes | I've learned to hate paypal since the etsy fiasco. |
| 15:14 | pipeline | johnmn3: 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:14 | johnmn3 | what is net 30/ net 90? |
| 15:14 | pipeline | 30 days to mail you a paper check, 90 days to mail you a paper check |
| 15:14 | johnmn3 | ah |
| 15:15 | pipeline | b2b payment processes suck |
| 15:15 | pipeline | this is basically why cdw exists |
| 15:15 | pipeline | nobody 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:16 | johnmn3 | so giving them a google check out interface isn't going to cut it? |
| 15:16 | pipeline | maybe it will |
| 15:16 | pipeline | sure would get you paid faster ;) |
| 15:16 | pipeline | it's not a normal way to do business, though :\ |
| 15:17 | johnmn3 | any new ycombinator startups making this easier? |
| 15:18 | pipeline | it continues the way it is because people like it this way |
| 15:18 | pipeline | small 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:18 | ivan | johnmn3: Stripe? |
| 15:19 | Null-A5 | Stripe looks promising |
| 15:19 | pipeline | stripe is awesome |
| 15:20 | Null-A5 | i wonder if they use clojure |
| 15:20 | pipeline | i actually saw people using stripe at the christmas fairs this year |
| 15:20 | Null-A5 | do you mean square? |
| 15:23 | TimMc | The little USB dongle? |
| 15:23 | pipeline | yes I meant square |
| 15:23 | pipeline | whoops |
| 15:23 | Null-A5 | heh they're both interesting |
| 15:23 | pipeline | they're both amazingly low-friction credit card processing |
| 15:23 | johnmn3 | whats the difference between stripe and square? |
| 15:24 | johnmn3 | well, with square, I can use my phone to charge your phone in person |
| 15:24 | Null-A5 | square is the stereo jack dongle |
| 15:24 | Null-A5 | stripe is sort of like paypal |
| 15:24 | johnmn3 | Null-A5: you don't need the dongle any more.. you can take a picture of the card |
| 15:24 | TimMc | Err, not USB, audio of course |
| 15:24 | Null-A5 | johnmn3: oh nice! |
| 15:25 | Null-A5 | I never even thought of that |
| 15:25 | TimMc | That's pretty fantastic. |
| 15:26 | johnmn3 | but I'd imagine you could do some kind of only checkout thing online with square too |
| 15:26 | Null-A5 | they're probably avoiding that market on purpose |
| 15:26 | sritchie | is anyone here using clutch past 0.3.1? |
| 15:26 | johnmn3 | and they'd take care of all state/federal/whatever taxes, right? |
| 15:39 | johnmn3 | going with stripe |
| 15:42 | TimMc | Yeah, I doubt they'd be thrilled giving you their corporate credit card. |
| 15:47 | demolithion | &(reduce {:1 1} merge [{:2 2}]) |
| 15:47 | lazybot | ⇒ {:2 2} |
| 15:48 | TimMc | demolithion: ##({} :key :not-found) |
| 15:48 | lazybot | ⇒ :not-found |
| 15:49 | Raynes | &(:key {} :not-found |
| 15:49 | lazybot | java.lang.RuntimeException: EOF while reading, starting at line 1 |
| 15:49 | Raynes | &(:key {} :not-found) |
| 15:49 | lazybot | ⇒ :not-found |
| 15:49 | Raynes | The last paren is always the hardest. |
| 15:50 | demolithion | TimMc: argh, thanks :) |
| 15:54 | TimMc | Functional programming can give you some pretty weird bugs. |
| 15:55 | TimMc | Raynes: Didn't lazybot used to auto-complete? ...testing ##(+ 2 3 |
| 15:56 | AimHere | Theoretically though, they should always be reproducible |
| 15:56 | Raynes | TimMc: 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:56 | TimMc | got it |
| 15:56 | Raynes | TimMc: We'd love for someone to rewrite it using a different parser or something though. Nobody has cared enough yet. |
| 15:56 | TimMc | Wait, fnparse is abandoned? :-( |
| 15:56 | ibdknox | poor lazybot he's only half the bot he used to be |
| 15:57 | Raynes | Parsley is probably a better choice, but I haven't had much luck with understanding cgrand software. ;) |
| 15:58 | TimMc | heh |
| 15:58 | ibdknox | lol |
| 15:58 | brehaut | haha |
| 15:58 | TimMc | Maybe it's like Emacs |
| 15:59 | TimMc | where it's really worth it, but you just have to keep banging your head against it |
| 15:59 | brehaut | Raynes: you could just roll your own lib from first principles with algo.monads |
| 15:59 | TimMc | until you acquire the right kind of brain damage in order to understand it. |
| 16:09 | ibdknox | Any of you guys using jekyll for your blog? |
| 16:10 | brehaut | ibdknox: jimduey is i believe |
| 16:10 | talios | morning brehaut |
| 16:10 | brehaut | morning talios |
| 16:11 | ibdknox | that appears to be true :) |
| 16:11 | Raynes | ibdknox: I use octopress which uses jekyll. |
| 16:12 | Raynes | I'm a big fan. |
| 16:12 | brehaut | ibdknox: github pages sites are likely to also be jekyll too (eg, mmcgrana.github.com at a guess?) |
| 16:12 | ibdknox | Raynes: I've decided to try it out |
| 16:12 | ibdknox | my poor website hasn't gotten any love in a very long time |
| 16:13 | TimMc | I finally wrote a technical blog post for the first time in like 2 years. |
| 16:13 | ibdknox | then I'll have something to post my little screencast for creating an overtone ipad controller :) |
| 16:14 | TimMc | Not much point in updating the look if the content is just about missing. |
| 16:14 | ibdknox | TimMc: yeah. I used to write all the time :( |
| 16:18 | brehaut | you can squirrel way too much writing time away building your own bloggy shaped ball of string |
| 16:19 | ibdknox | hence why I was going to move to jekyll :) |
| 16:19 | brehaut | probably wise :P |
| 16:19 | brehaut | on the other hand, i do love the flexibility i have ;) |
| 16:19 | citizenparker | ibdknox: I <3 jekyll for my blog |
| 16:20 | ibdknox | brehaut: I kept saying that... and then never actually did anything with it |
| 16:20 | ibdknox | lol |
| 16:20 | brehaut | lol |
| 16:21 | TimMc | $mail tmciver I finally built a working with-temp-ns in org.timmc.handy. |
| 16:21 | lazybot | Message saved. |
| 16:21 | brehaut | ibdknox: 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:21 | ibdknox | haha |
| 16:21 | ibdknox | cool |
| 16:29 | wubo | In 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:29 | TimMc | Yesterday, I discovered that 'eval gives you a free top-level to do fancy things in. |
| 16:29 | pipeline | free top-level? |
| 16:29 | TimMc | free as in beer |
| 16:29 | wubo | I'm seeing the same 3x-4x speedup he initially reported: http://dev.clojure.org/jira/browse/CLJ-894 |
| 16:29 | TimMc | not as in binding |
| 16:30 | TimMc | pipeline: https://github.com/timmc/handy/blob/master/src/org/timmc/handy.clj#L53 |
| 16:35 | tmciver | TimMc: does this solve the import deffing problem you ran into before? |
| 16:35 | tmciver | TimMc: testing of it, I should say. |
| 16:36 | TimMc | If we're thinking of the same thing, yes. |
| 16:36 | TimMc | I finally figured out how to combine it with deftest, too. |
| 16:36 | tmciver | Cool |
| 16:39 | TimMc | tmciver: https://github.com/baznex/imports/blob/defproxy/test/org/baznex/test/imports.clj#L86 |
| 16:40 | TimMc | Basically, use with-temp-ns to generate a set of answers, and check the results with clojure.test/is |
| 16:40 | TimMc | Good ol' eval. |
| 16:55 | tmciver | TimMc: looks like the test relies on with-test-ns returning the class that is imported? |
| 16:55 | TimMc | yep |
| 16:56 | TimMc | The class and .getName could just as easily be pushed inside the with-test-ns form. |
| 16:56 | tmciver | sure |
| 16:57 | TimMc | If 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:57 | TimMc | (build-static 'Math 'abs) => a proxy impl of Math/abs |
| 16:58 | TimMc | You know, separate the def from the value. |
| 16:59 | talios | arbscht - do you have a bog or anything online these days? lisp.geek.nz is all dead and everything |
| 17:01 | Raynes | I hope he doesn't have a bog online. |
| 17:01 | Raynes | That could get awfully wet. |
| 17:02 | brehaut | Raynes: i think a bog is any blog that runs on wordpress ;) |
| 17:03 | talios | muhahaa |
| 17:23 | TimMc | tmciver: Multi-clause def-statics: (def-statics (String valueOf) (Double parseDouble POSITIVE_INFINITY)) |
| 17:53 | TimMc | tmciver: Would it be insane to expand the scope of def-statics (under a different name) to pull in instance methods as well? |
| 17:55 | TimMc | I'm kind of curious what memfn does now. |
| 18:09 | tmciver | TimMc: what's an example of pulling in instance methods? |
| 18:16 | tmciver | TimMc: what branch is this new code on? |
| 18:29 | tmciver | TimMc: cool, I didn't know about memfn |
| 19:35 | TimMc | memfn is weird. |
| 19:36 | Raynes | TIL how hammers are made. |
| 19:36 | TimMc | Haha, someone doesn't know the difference between group and artifact. (Looking at clojurebot's announcement) |
| 19:37 | TimMc | tmciver: An instance method would just take an additional argument over the declared signature. |
| 19:38 | TimMc | and this is on the defproxy branch |
| 19:50 | amalloy | TimMc: you're curious about memfn? there's hardly anything to know, right? |
| 19:52 | amalloy | though it could be improved to support type-hinting. eg, (memfn ^String length) |
| 19:53 | lamed | Can't take value of a macro: #'compojure.core/GET, compiling:(kunabi/core.clj:7) |
| 19:56 | amalloy | TimMc: okay, you got me. it turns out i didn't understand what memfn actually does; the docstring is somewhat confusing |
| 19:59 | amalloy | i thought (memfn put k v) was (fn [obj] (.put obj k v)), not (fn [obj k v] (.put obj k v)) |
| 20:52 | murm | what's the cheapest hosting solution with root access? |
| 20:52 | murm | I have a linode, but 20 bucks a month is too much for what I want it for.. simple playing around and testing |
| 20:53 | brehaut_ | johnmn3: prgmr.com is pretty cheap. the IO is reputedly not as good as linode |
| 20:54 | brehaut_ | dunno if its the cheapest though |
| 20:54 | echo-area | http://pastebin.com/uf7KmsT7 |
| 20:55 | echo-area | Can somebody explain the behavior of the above program? I can't understand it. Thanks |
| 21:03 | echo-area | It's about alter and commute |
| 21:03 | echo-area | The retries count seems magical |
| 21:13 | weavejester | What do you want explained, exactly? |
| 21:14 | weavejester | I guess it's showing how commute requires less retries than alter. |
| 21:15 | weavejester | echo-area: Was there anything in particular about that program you didn't understand? |
| 21:15 | echo-area | There 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:17 | echo-area | s/It's/Its/ |
| 21:17 | weavejester | Well, the sleep times are only a few milliseconds, and threads take a little while to create. |
| 21:19 | weavejester | Also, the state of the refs isn't changed until the transaction commits |
| 21:21 | echo-area | Hmm, 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:25 | zawzey | Hmm, what's wrong with this function? |
| 22:26 | zawzey | https://gist.github.com/6a6bc3fee0669f6925de |
| 22:27 | zawzey | why can't i set the return value |
| 22:27 | zawzey | to a variable |
| 22:28 | zawzey | if 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:30 | brehaut_ | zawzey: you probably dont want to be deffing things inside a function |
| 22:30 | zawzey | brehaut_: Well, okay, bad example, but suppose i do some operations inside the function |
| 22:31 | zawzey | same question |
| 22:31 | zawzey | updated the gist |
| 22:31 | brehaut_ | zawzey: anyway, (def dummy 234) returns a var |
| 22:32 | zawzey | brehaut_: yes i know, but i'm not trying to return values, but execute something inside the if |
| 22:32 | zawzey | brehaut_: i was trying to execute 2 S-expressions inside the if loop |
| 22:33 | brehaut_ | zawzey: (+ 1 1) evalutes to 2, 2 is not a function |
| 22:33 | xeqi | ,(do (+ 1 1) nil) |
| 22:33 | clojurebot | nil |
| 22:34 | brehaut_ | zawzey: next time, ask the question you really mean, rather than a circuitious 'whats wrong with this' ? |
| 22:34 | brehaut_ | it makes it much easier to help |
| 22:35 | zawzey | brehaut_: Okay, i'm trying to come up with a better example... |
| 22:35 | brehaut_ | zawzey: you dont need a better example, xeqi already have you the answer |
| 22:35 | brehaut_ | zawzey: use a do |
| 22:36 | xeqi | not very explainitory though, stopped when I saw you explaining |
| 22:36 | brehaut_ | 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:37 | zawzey | brehaut_: Ah, yes, i think when might be the answer that i'm seeking |
| 22:42 | amalloy | when is a quick-fix to your particular issue; understanding why the if doesn't work is the real answer you're seeking |
| 22:43 | amalloy | it'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:44 | zawzey | well, the real question is why "if" cannot have multiple s-expressions |
| 22:45 | zawzey | that's the case coming from imperative programming, so i'm just caught by surprise by this |
| 22:45 | zawzey | (if expr ((then-expression 1) (then-expression2)) else-expr) |
| 22:46 | dnolen | zawzey: you have cond for that |
| 22:46 | dnolen | ,(doc cond) |
| 22:46 | clojurebot | "([& 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:46 | amalloy | dnolen: no, he wants side effects |
| 22:46 | amalloy | (ie, when) |
| 22:46 | dnolen | amalloy: ah oh yeah, do |
| 22:46 | zawzey | yes, i want side-effects |
| 22:46 | brehaut_ | do is roughly equivalent to squigly braces + semicolons |
| 22:47 | zawzey | yeah, just surprised by the if special form |
| 22:47 | amalloy | but 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:47 | amalloy | try to get rid of side effects and stop thinking about statements; expressions are king |
| 22:49 | zawzey | well, in this case the side-effects are caused by trying to interface with an external engine, Rhino |
| 22:49 | zawzey | and of course, i'm raw to clojure, so learning as i go along |
| 22:52 | pipeline | http://paste.lisp.org/display/127868 |
| 22:52 | pipeline | I'm trying to generate a deck of cards, i.e. a pair of every possible suit and value |
| 22:52 | pipeline | my nasty for-map construct ends up with a list of lists |
| 22:52 | pipeline | when I really want a single list |
| 22:53 | pipeline | what should I be doing here ? |
| 22:53 | brehaut_ | pipeline: you dont generally need to use map inside a for |
| 22:53 | TimMc | pipeline: Mkae that map a second clause in the for |
| 22:54 | TimMc | pipeline: (for [suit suits, ord (keys ordinals)] [ord suit]) |
| 22:54 | pipeline | oh that's vastly simpler |
| 22:54 | brehaut_ | for is magical |
| 22:54 | pipeline | I've failed to understand destructuring again |
| 22:55 | pipeline | TimMc: thanks |
| 22:56 | pipeline | I was this close to nesting macros to generate a set of two item vectors, and I just knew that was dead wrong |
| 22:56 | amalloy | nine through ace? someone playing pinochle or euchre or something? |
| 22:56 | pipeline | yep |
| 22:56 | pipeline | I needed something to play with, and card games are relatively simple problems |
| 22:57 | amalloy | pipeline: 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:58 | amalloy | https://github.com/amalloy/ddsolve is a solver for contract bridge, which is correct but way too slow to be viable |
| 23:00 | pipeline | haha good lord |
| 23:01 | pipeline | that's well beyond my capabilities. not least because I can't play bridge |
| 23:01 | amalloy | meh. the rules that matter for solving and the same as euchre rules |
| 23:01 | devn | did someone say pinochle? |
| 23:40 | jaimef | lein compile and uberjar seem to actually start the compojure app... |
| 23:41 | jaimef | https://gist.github.com/1867888 |
| 23:41 | Raynes | jaimef: Does Kunabi.core have a top level form that calls the function that starts the server? |
| 23:41 | Raynes | jaimef: If what I said doesn't make sense, please paste the core file. |
| 23:42 | jaimef | k |
| 23:43 | jaimef | https://gist.github.com/1867893 |
| 23:43 | Raynes | Ah, yes. |
| 23:44 | Raynes | jaimef: 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:44 | Raynes | You're also going to need to add (:gen-class) to your ns form. |
| 23:44 | jaimef | ok thanks |
| 23:44 | Raynes | (If what you're trying to do is uberjar this and run it as an executable) |
| 23:47 | jaimef | trying to deploy it. lein deps/run locally works fine, copied it over to remote server, but lein run tries to download dependencies |
| 23:55 | emezeske | If 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:55 | emezeske | Or is that a crazy thing to expect |
| 23:56 | technomancy | should be fine |
| 23:57 | emezeske | technomancy: Thanks. |
| 23:58 | jaimef | technomancy: 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:59 | technomancy | jaimef: in lein1 that should work as long as there are no snapshots |
| 23:59 | jaimef | yeah let me verify no skew in lein version |