2012-08-10
| 00:10 | mk | is compile-time something different from read/eval-time? |
| 00:14 | _tca | mk: it's a part of "eval-time" |
| 00:14 | mk | does it refer only to the evaluation of fns (compilation/bytecode generation), or to any eval? |
| 00:15 | _tca | what other kind of eval is there? |
| 00:18 | mk | well, when (+ 1 2) is evaluation, no bytecode is generated. + is mapped to an instance of a fn, that fn takes 1 and 2 and returns 3. But when fn explicitly eval'd (through loading or repl), bytecode is generated |
| 00:18 | mk | evaluated* |
| 00:20 | mk | so basically, the thing that eval usually does is one thing, and then there are times when eval hits a freshly-read fn special form, and bytecode generation occurs |
| 00:20 | _tca | how does that not get compiled? |
| 00:21 | mk | _tca: does what not get compiled? |
| 00:21 | _tca | (+ 1 2) |
| 00:21 | clojurebot | 3 |
| 00:21 | uvtc | clojurebot no longer needs the weirding module! |
| 00:22 | uvtc | I mean, you know, the leading comma. |
| 00:22 | mk | well, + got compiled a long time ago. Then an instance was assigned into the clojure namespace map under "+" (and probably copied to the current namespace) |
| 00:22 | mk | (fn [] 1) |
| 00:22 | mk | ,(fn [] 1) |
| 00:22 | clojurebot | #<sandbox$eval27$fn__28 sandbox$eval27$fn__28@647c1f70> |
| 00:22 | mk | ,(fn [] 1) |
| 00:22 | clojurebot | #<sandbox$eval55$fn__56 sandbox$eval55$fn__56@68ad1b9f> |
| 00:23 | mk | the difference between 28 and 56 means that a new fn class was compiled, and instantiated |
| 00:25 | _tca | so a program that has no function defenitions in it doesn't get compiled? |
| 00:26 | mk | yeah I'm not sure what the terminology on that is. But yes in the sense of no-class-is-generated, I think that's the case |
| 00:27 | mk | a bunch of instances just get... instantiated |
| 00:31 | mk | actually, I think the only time something like a function gets instantiated programmatically is in the case of (defn makefn [] (fn [] 1)) |
| 00:41 | brainproxy | okay.. so my coworker is building a clojure project which my clojure project depends on; the latter is not open source, so can't put it out on clojars, but it's in a private repo on github so I can get at it easily enough |
| 00:42 | brainproxy | what's the best way to set it up as a dep in my project.clj? |
| 00:43 | brainproxy | i'm not asking about syntax so much as I am about a methodology that favors repeatability, short of setting up a private clojars instance |
| 00:43 | dnolen | brainproxy: you can install it locally. if it's a git repo, lein checkouts works. |
| 00:43 | brainproxy | oh, derp |
| 00:43 | xeqi | best -> company repository ; easiest -> git pull and `lein install` |
| 00:44 | brainproxy | didn't even know about lein checkout |
| 00:44 | dnolen | brainproxy: supposedly deprecated but pretty darn useful still. |
| 00:45 | brainproxy | yeah.. `lein help checkout` didn't give me anything |
| 00:45 | dnolen | brainproxy: people involved in or using CLJS use it all the time when testing against CLJS HEAD |
| 00:46 | brainproxy | dnolen: is it a pre lein2 feature only? |
| 00:47 | dnolen | brainproxy: I believe it still exists in lein2 in some form. |
| 00:47 | brainproxy | researching.. |
| 00:48 | xeqi | brainproxy: https://github.com/technomancy/leiningen/blob/master/doc/FAQ.md - question 5 |
| 00:49 | brainproxy | xeqi: cool, thatnks |
| 01:08 | uvtc | Just a ##(println "test") here. |
| 01:08 | lazybot | ⇒ test nil |
| 01:11 | brainproxy | so I have my checkouts/ dir and the other project symlinked into it, e.g. checkouts/foo |
| 01:11 | brainproxy | but when I `lein repl` in my project and (require 'foo), it says it can't find it on the classpath |
| 01:12 | brainproxy | i tried sticking it in :dependencies but then the repl wouldn't start at all, as it couldn't find the dep... like it's not checking in checkouts/ |
| 01:12 | brainproxy | I must be missing a step |
| 01:15 | xeqi | step1 : make it work without checkouts |
| 01:16 | brainproxy | nvm, i'm just tired, was doing something stupid |
| 01:16 | xeqi | then you can use checkouts to work on them in parallel |
| 01:16 | mk | how do things get added to (loaded-libs)? |
| 01:16 | mk | is load, which loads from the classpath, the only way? |
| 01:19 | mk | if I call (ns ...) from the repl, nothing new appears in loaded-libs |
| 01:26 | tomoj | maybe use all-ns instead? |
| 01:26 | tomoj | require/etc work for adding stuff to (loaded-libs) |
| 01:32 | muhoo | lein checkout is good when you're depending on a moving target in development |
| 01:33 | muhoo | for production, if the jar is private, a private repo is better though. |
| 01:33 | brainproxy | muhoo: you mean setup a private clojars or maven? |
| 01:33 | muhoo | i mean a private maven repo, which i found is just a directory tree |
| 01:34 | brainproxy | ah gotcha |
| 01:34 | muhoo | there's some maven tools to create one IIRC, but i just hacked one up by mimicking the directory structureo of ~/.m2 |
| 01:34 | muhoo | structure, not structureo. this isn't core.logic |
| 01:34 | brainproxy | speaking of that... so i have checkouts/foo, and foo has something like this |
| 01:34 | brainproxy | :repositories {"local" ~(str (.toURI (java.io.File. "./maven_repository")))} |
| 01:34 | xeqi | `lein deploy file:///path/to/repo` might work |
| 01:35 | brainproxy | and some of foo's deps are indeed in ./maven_repository |
| 01:35 | xeqi | to publish to a file repo |
| 01:35 | brainproxy | now, if I launch a repl in the project root of foo, all is well |
| 01:35 | brainproxy | however, if I'm in the project which has foo in chckouts/foo |
| 01:36 | muhoo | might. i do checkouts by having for example stuff/foo stuff/bar , and then "ln -s stuff/foo stuff/bar/checkouts/foo" then, from bar, i have access to foo |
| 01:36 | brainproxy | and I launch a repl, when i (require 'foo.core) it's throwing exception complaining about missing classes |
| 01:36 | mk | tomoj: I'm mostly wondering what (loaded-libs) is used for |
| 01:36 | brainproxy | iow, it doesn't seem to be honoring the ./maven_repository thing |
| 01:39 | xeqi | brainproxy: in foo, if you do `lein pom` does it produce a relative path? |
| 01:39 | xeqi | in the <repository> tag for that |
| 01:40 | muhoo | i don't remember the syntax of :repositories, but i'd try :repositories {"myrepo" "file:///maven_repository"} |
| 01:40 | muhoo | oh, wait |
| 01:40 | muhoo | :local-repo "/home/dude/.lein/repo" |
| 01:40 | muhoo | that too |
| 02:00 | rbarraud | Hiya arbscht |
| 02:00 | rbarraud | Any highlights here today? |
| 03:19 | arrdem | ,(doc conj) |
| 03:19 | clojurebot | "([coll x] [coll x & xs]); conj[oin]. Returns a new collection with the xs 'added'. (conj nil item) returns (item). The 'addition' may happen at different 'places' depending on the concrete type." |
| 03:39 | rahcola | if I have a type defined by (defrecord Foo []), why (= (type (Foo.)) (type (->Foo))) => false |
| 03:52 | ejackson | rahcola: weirdness. You shouldn't get that. I'm on 1.4 and it evals to true |
| 03:53 | yonatane | Is there a proper version of the 2008 Clojure Sequences talk? http://blip.tv/clojure/clojure-sequences-740581 |
| 03:54 | yonatane | This one is cut after a few seconds |
| 03:55 | rahcola | ejackson: ok, this might be something related to the repl session |
| 04:20 | rahcola | or not, even in a clean repl session (= (Behavior. 1 1) (->Behavior 1 1)) => false |
| 04:21 | rahcola | where (defrecord Behavior [name duration]) |
| 04:26 | ejackson | rahcola, clojure-version ? |
| 04:28 | clgv | rahcola: works in 1.4.0 |
| 04:29 | clgv | in 1.3.0 as well |
| 04:30 | ejackson | rahcola: I had a similar experience before when using AOT compilation as -> does some strange stuff |
| 04:30 | ejackson | do you have .class files lying around perhaps ? |
| 04:32 | clgv | it might happen if you compiled the defrecord two times |
| 04:34 | clgv | like that: (defrecord Behavior [name duration]) (def a (->Behavior 1 1)) (defrecord Behavior [name duration]) (def b (Behavior. 1 1)) (= a b) => false |
| 04:38 | clgv | rahcola: (->Behavior 1 1) expands to (new user.Behavior 1 1) as well as (Behavior. 1 1) does - provided the record has less than 20 fields |
| 04:45 | rahcola | ok, definately a problem with stale .class files |
| 04:45 | rahcola | purged them, and now the project doesn't even compile |
| 04:47 | rahcola | yeah, solved |
| 04:53 | clgv | rahcola: what was it? |
| 04:54 | rahcola | stale .class file for the record type I guess |
| 04:54 | rahcola | the ->TypeName function probably held a reference to the old class and the TypeName. was using the new class |
| 04:54 | rahcola | or something |
| 04:55 | rahcola | appearantly I need to make a habbit of running lein clean |
| 04:58 | rahcola | ejackson, clgv: thanks for the help |
| 04:59 | otfrom | morning |
| 05:05 | ejackson | morning |
| 05:05 | naeg | hi * |
| 05:11 | otfrom | ejackson: we really need to get stuck back into redstats with all our spare time |
| 05:12 | ejackson | otfrom: hehe sparetime -> 0 :) |
| 05:13 | otfrom | tell me about it |
| 05:14 | otfrom | though as Sam Aaron suggested we should make time instead http://www.youtube.com/watch?v=K-GGEJRz6So&feature=related |
| 05:15 | ejackson | Sam is a smart dude :) |
| 05:23 | clgv | "This video is not available in your country." - hoooorrrray to intellectual property :( |
| 05:26 | otfrom | boo |
| 05:26 | otfrom | it is the Making Time bit from Withnail and I if you can find a non-UK version to watch |
| 06:02 | kral | namaste |
| 08:22 | _ato | anyone know of a Clojure source parser and serializer pair that preserves whitespace and comments? |
| 08:24 | clgv | _ato: what's the goal? |
| 08:25 | _ato | script bumping of version numbers in project.clj |
| 08:26 | _ato | I'll just hack it with regexes otherwise, I've several times found myself wanting to be able to manipulate a file full of Clojure data or even code without messing up the formatting though and wondered if anyone's has the same itch and solved it. ;-) |
| 08:28 | clgv | _ato: I'd go with regexps as well |
| 08:29 | cemerick | _ato: you're looking for https://github.com/cgrand/sjacket |
| 08:29 | clgv | cemerick: interesting |
| 08:29 | cemerick | _ato: It's rough, but worked well when I was fiddling to accomplish the same thing. |
| 08:30 | cemerick | And, the regex approach is already underway @ https://github.com/relaynetwork/lein-release if sjacket proves not-yet-ready |
| 08:31 | _ato | brilliant |
| 08:32 | _ato | lein-release's README is virtually identical to the one I just wrote |
| 08:32 | _ato | cemerick: thanks! |
| 08:32 | cemerick | :-) |
| 08:32 | cemerick | I'm hoping sjacket can eventually be brought in. It definitely seems to be a brighter path than regexes. |
| 08:35 | _ato | I even searched for "lein-release" but was distracted by a decoy. https://github.com/technomancy/lein-release |
| 08:36 | cemerick | sneaky :-| |
| 08:51 | eduard | is it possible to reset emacs/swank repl after I use'd clojure.string - it says "replace already refers..." and doesn't compile? |
| 08:52 | eduard | or I need to restart clojure-jack-in? |
| 08:57 | clgv | if I have projectX is there a possibility to include projectX.jar as jar in the projectX-standalone.jar? |
| 08:58 | jsabeaudry | Wow, just wow, RandomAccessFile.writeShort does 2 writes of 1 byte instead of 1 write of 2 bytes... |
| 09:07 | jsabeaudry | No wonder java is slow |
| 09:07 | clgv | jsabeaudry: you can switch to java.nio |
| 09:08 | loliviera | hi, i'm trying to use clj-time and congomongo but i can;t make the conversion work. I'm receving the following error message when i try to extend ConvertibleFromMongo as indicated by the docs: interface somnium.congomongo.coerce.ConvertibleFromMongo is not a protocol |
| 09:08 | loliviera | but i'm sure the ConvertibleFromMongo is a prococol |
| 09:08 | loliviera | https://github.com/aboekhoff/congomongo/blob/master/src/somnium/congomongo/coerce.clj#L31 |
| 09:11 | cemerick | jsabeaudry: "RandomNamespacingEntity.foo does $STUPID_THING. No wonder $LANGUAGE is slow." :-| |
| 09:15 | ro_st | macrologists, i'd appreciate some input: https://www.refheap.com/paste/4225 disclaimer: i've written zero macros. |
| 09:17 | ro_st | the resulting functions are used in an undo/redo stack, which, when run, returns a closure for undo to use, which, when run, returns a closure for the redo to use, which, when run, returns a closure for the undo to use… you get the idea |
| 09:18 | clgv | ro_st: can you minimize this example? or break it up into it's several features? |
| 09:18 | ro_st | i already have working undo/redo and several fns that do this written in long-hand. i'm wondering if i can clean up |
| 09:18 | jsabeaudry | clgv, Thanks I'll look into that, any idea which class has equivalent functionality in nio? |
| 09:18 | ro_st | let me cut out the concrete |
| 09:18 | clgv | jsabeaudry: there should be a shortbuffer |
| 09:24 | XPherior | Can anyone help me come up with an implementation for the 'with-specification' function? https://gist.github.com/1a69309438b44227e9ca |
| 09:24 | XPherior | It should return a vector of pairs (names to values). In the end, I want to pass that to a let form. |
| 09:25 | clgv | XPherior: (defmacro with-specification [& args] [~@args]) - but it seems of not much use |
| 09:27 | XPherior | clgv: Gimmie a sec to think. |
| 09:27 | clgv | XPherior: you could just write the let-form instead |
| 09:28 | XPherior | clgv: I'm used it in conjunction with a 'where' macro, like the Haskell style. |
| 09:28 | XPherior | Where turns it into a let |
| 09:29 | clgv | XPherior: maybe you should sketch what it should do? input, output ... |
| 09:30 | XPherior | clgv: I think I've confused myself with too many macros. :) |
| 09:30 | ro_st | clgv: https://www.refheap.com/paste/4226 |
| 09:30 | wmealing | say i wanted to mention the line number in a log file, how can i find the current line number easily ? |
| 09:32 | XPherior | wmealing: I'm not sure that's going to be easy because of how it compiles to Java and/or bytecode. :/ |
| 09:33 | XPherior | Maybe I'm completely wrong though. |
| 09:33 | wmealing | that was my thought too |
| 09:33 | wmealing | although the reader somehow knows about it |
| 09:33 | XPherior | That's true/ |
| 09:34 | XPherior | clgv: I want to do something like: (let (with-spec (x 1)) x) ; => 1 |
| 09:34 | XPherior | Basically have with-spec return a vector |
| 09:34 | XPherior | The macro you wrote was the same thing I did, it doesn't work |
| 09:35 | wmealing | XPherior, my motive was simply for the debugger to be able to know where the logline was generated |
| 09:36 | XPherior | wmealing: Yeah, I understand why you'd want that. |
| 09:38 | ckirkendall | ro_st: why do you do something like (defcommand [inval] {:do #(...) :undo #(..).}) then you could do this with out macros. |
| 09:39 | clgv | XPherior: but thats a simple let. why call it different? |
| 09:40 | XPherior | Because another macro is going to stick it in the let. I'm using a where macro to declare my data at the bottom of a test. |
| 09:41 | XPherior | I'll show you if I can write it the way I want. It's going to be a really neat testing language |
| 09:41 | clgv | XPherior: uff that sounds like you complicate it a lot |
| 09:42 | XPherior | It's not as bad as it sounds. |
| 09:43 | ro_st | ckirkendall: i'd like to use a macro to wire up the fns so that they return closures of each other |
| 09:43 | ro_st | but, for readablity, i'd like the hand-wrtten source to simply be :do … and :undo ... |
| 09:44 | ro_st | also, i'd like the macro to produce te code that does the register at the bottom, so that it's all nice and DRY |
| 09:44 | ckirkendall | how about this: https://www.refheap.com/paste/4227 |
| 09:45 | ckirkendall | ro_st: it would also be eays to add syntax checking in for :do and :undo |
| 09:45 | clgv | ro_st: have a look at an article or book chapter on macro. when you read it you should be able to straightforwardly write that down |
| 09:47 | ckirkendall | ro_st: I missed the recusion piece of this. |
| 09:47 | clgv | ro_st: generating multiple forms in a macro can be done, e.g. via `(do (defn ...) (register ...)) |
| 09:48 | ro_st | ckirkendall's first stab gives me enough to get me all the way, i think |
| 09:48 | clgv | ro_st: I mean the macro returns code that defines the function first and then registers it |
| 09:49 | ro_st | oh, no. it doesn't show how to put the undo inside the do at ?undo, which is the whole point of the exercise (so that the undo has access to the do's let bindings because it's a closure |
| 09:49 | ro_st | clgv: i have done some reading, and i suppose i should do more homework before consulting #clojure |
| 09:50 | clgv | ro_st: one hint - build the macro incrementally and check if each step works as expected with macroexpand |
| 09:52 | ro_st | good advice, thank you |
| 09:53 | casion_ | out of curiosity are there any other decent working environments for clojure besides counterclockwise/emacs+slime/vimclojure? |
| 09:53 | ro_st | emacs+nrepl.el :-) |
| 09:54 | ro_st | some folks use intellij and la-clojure, i believe |
| 09:54 | casion_ | ro_st: I havent been able to find those folks :| |
| 09:55 | ro_st | not got the patience to learn emacs? |
| 09:55 | casion_ | trying to get my brother to try out clojure and he can't stand emacs, vim or eclipse |
| 09:55 | ro_st | ah |
| 09:55 | casion_ | I've used emacs for 2 decades lol |
| 09:55 | ro_st | the counter-intuitive issue is that clojure is easier with emacs |
| 09:55 | casion_ | trying to get others to try clojure |
| 09:55 | ro_st | but getting emacs first is hard |
| 09:55 | casion_ | yeah, I know |
| 09:55 | michaelr` | casion_: i'm using sublime2 for editing clojure |
| 09:56 | ro_st | 2 decades, nice. you must be close to approaching novicehood, now? |
| 09:56 | michaelr` | and `lein repl` for repl |
| 09:56 | ro_st | michaelr`: masochist |
| 09:56 | casion_ | michaelr`: I looked into that, can you give me an overview of its capabilities with the clojure plugin? |
| 09:56 | michaelr` | i didn't try the clojure plugin |
| 09:56 | casion_ | ro_st: pretty much. I can use it pretty well, but I still don't know a lick of elisp |
| 09:56 | michaelr` | i just use it for editing |
| 09:56 | casion_ | that long using emacs, and clojure is my first lisp heh |
| 09:57 | michaelr` | ro_st: the painfull thing sometimes is that I don't have a debugger at hand |
| 09:57 | casion_ | michaelr`: so you run lien-repl in a terminal (or inside st2?) |
| 09:57 | michaelr` | ro_st: when i tried ccw i looked like the debugger there works really well |
| 09:57 | ro_st | michaelr`: coding without paredit is the painful thing |
| 09:58 | michaelr` | casion_: in a terminal |
| 09:58 | casion_ | yeah, I've only been using clojure for about a month, and I can't begin to think of how people manage without paredit |
| 09:58 | ro_st | and having to manually copy code into a repl? ouch |
| 09:58 | ro_st | that'd do my bloody head in |
| 09:58 | casion_ | michaelr`: yeah, how do you handle testing while you work in st2? |
| 09:59 | casion_ | just copy stuff to the repl? |
| 09:59 | michaelr` | ro_st: well, i mostly don't copy code there. i usually change something in the editor and then reload the namespace to try it |
| 09:59 | wmealing | XPherior, http://dev.clojure.org/jira/browse/CLJ-849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel |
| 09:59 | michaelr` | or when i just need to try something i just type it in the repl |
| 10:00 | wmealing | i dont know if you care, or dont.. but either way i'm not the only one who wants it |
| 10:00 | ckirkendall | ro_st: adding in the recursion actually made this a bit simpler. https://www.refheap.com/paste/4227 |
| 10:01 | ro_st | michaelr`: take a week off, learn emacs, come back to me so that i can apologise to you for the pain you went through, and so that i can accept your gratitude for the suggestion -grin- |
| 10:01 | casion_ | a week to learn emacs? |
| 10:01 | michaelr` | hehe |
| 10:01 | michaelr` | i tried using emacs a few times |
| 10:01 | michaelr` | even with paredit and slime |
| 10:02 | ro_st | took me a week to get to the point where i could open it, open a file, start a repl, compile and run |
| 10:02 | ro_st | without swearing once |
| 10:02 | casion_ | a week? |
| 10:02 | michaelr` | i just can't stand it, it's such a time demanding piece of junk |
| 10:02 | XPherior | Okay, I can simplify the problem. I want to pass the args x 1 y 2 to a function or macro and get back [x 1 y 2 all [1 2]] |
| 10:02 | ro_st | and then a day or two of referenching printed cheat sheets for stuff |
| 10:02 | XPherior | I can't for the life of me figure out how to write that |
| 10:02 | casion_ | it's not that hard lol |
| 10:02 | casion_ | michaelr`: how so do you find it time demanding? |
| 10:02 | ro_st | ckirkendall: awesome!! |
| 10:03 | casion_ | ro_st: hey man… I still have an emacs cheatsheet on my desk |
| 10:03 | casion_ | albeit one I made for myself for some obscure shit, but still |
| 10:03 | XPherior | So something like (let (implicits x 1 y 2) ...) Where it becomes (let [x 1 y 2 all [1 2]] ...) |
| 10:03 | ckirkendall | casion_: I think he mean it takes a week to realize how powerful it really is. |
| 10:03 | ro_st | ckirkendall: so to be clear, when calling the resulting fn, it'd return the undo all wired up, and calling the undo would return a closure that is the same as calling the initial fn with the initial args? |
| 10:03 | ckirkendall | yes |
| 10:04 | ckirkendall | no |
| 10:04 | casion_ | ckirkendall: eh, I think that's nonsense too. |
| 10:04 | ro_st | casion_: by emacs-in-a-week i mean get to the point where i can focus on work |
| 10:04 | ro_st | pick a font and a colour scheme, be able to compile and run clojure in a repl |
| 10:04 | michaelr` | casion_: time demanding to learn how to work with it and time demanding because the defaults are really shitty and every simple feature i am used to from other editors i have to digg some piece of elisp code from some arcane site etc.. |
| 10:04 | casion_ | michaelr`: I see. That's how I felt when I tried st2 ;) |
| 10:04 | ckirkendall | it took me about a week to switch over after 15 years of java development in eclipse and intellij |
| 10:05 | michaelr` | casion_: hehe |
| 10:05 | casion_ | searching through plugins, taying to figure out all the keys, new names for stuff, weird tabbed shit etc.. |
| 10:05 | casion_ | trying* |
| 10:05 | ro_st | michaelr`: you just need to push through. there is gold at the end of the rainbow |
| 10:05 | ckirkendall | ro_st: yes it returns an clojure of the orignial do |
| 10:06 | CmdrDats | i tried to switch back to ccw after a while of emacs.. I couldn't handle not being able to arbitrarily add new functionality to my editor |
| 10:06 | casion_ | I have to use eclipse for one major project… I can't say it's something I look forward to |
| 10:07 | pandeiro | anyone know any good Clojure- or programming-related podcasts besides Relevance's recent one with Rich Hickey? |
| 10:07 | ro_st | ckirkendall: thank you so much. i'll try it out! |
| 10:07 | ro_st | CmdrDats: yes, exactly. adding Sass/Compass support was M-x package-install scss-mode |
| 10:08 | ro_st | pandeiro: unfortunately not. there are the disclojure vids on vimeo |
| 10:08 | casion_ | michaelr`: do you know of any sublime learning resources? something like "Sublimetext for people with beards and a wretched pinky finger" |
| 10:08 | ro_st | in fact, just search infoq.com, blip.tv, and vimeo for clojure and sort by date |
| 10:08 | pandeiro | ro_st: can vimeo stuff be downloaded? |
| 10:08 | ro_st | most of it can |
| 10:09 | pandeiro | yeah i am wanting to listen to stuff in transit and my data connection is useless for audio/video |
| 10:09 | ro_st | ah right |
| 10:09 | cemerick | pandeiro: http://mostlylazy.com is one, which will be getting back on the horse shortly |
| 10:09 | ro_st | it'd be nice to grab all the vimeo stuff, esp the euroclojure stuff |
| 10:09 | michaelr` | casion_: hmm, just look at it's help to see the key shortcuts and there is a lot of stuff in the menus... what exactly are you looking for in an editor? |
| 10:09 | ro_st | some awesome stuff there |
| 10:10 | ro_st | cemerick: lookin' forward to that |
| 10:10 | CmdrDats | i was actually determined to contribute to ccw - but I got to cloning the repo and realized that I'm really not interested in dealing with eclipse plugins…. |
| 10:10 | pandeiro | cemerick: cheers |
| 10:10 | Cheiron | Hi, I'm collecting analytics data. My main data structure is a map that will be consisting of many nested map. Only one thread is accessing the map. Does it makes sense to use a transient map then persist it when I'm done? |
| 10:10 | casion_ | michaelr`: well… I'm not looking for anything. Many of my friends keep bugging me to try sublime, and I make an effort to try new things as such |
| 10:11 | casion_ | michaelr`: if somehow it turns out to be decent, I'll use it. not much more to it than that |
| 10:11 | ro_st | casion_: ST2 is actually pretty self evident |
| 10:11 | ro_st | this'll get whoever started |
| 10:11 | ro_st | http://net.tutsplus.com/tutorials/tools-and-tips/sublime-text-2-tips-and-tricks/ |
| 10:12 | ro_st | it covers the package installer plugin which is crucial |
| 10:12 | wmealing | &form ! nice |
| 10:12 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: form in this context |
| 10:12 | casion_ | ro_st: there's been a few times where I want a function, and I can't even figure out what it's called in st2 |
| 10:12 | michaelr` | casion_: well, it's simple, has very good visual experience and very good defaults and sytax coloring themes |
| 10:12 | casion_ | however I cant think of anything specific atm, it's been about 3-4 months since I tried st2 last |
| 10:12 | casion_ | err |
| 10:12 | casion_ | st1 |
| 10:12 | ro_st | i use it for php maintenance and quick text munging |
| 10:12 | casion_ | I just dl'd st2 2 weeks ago |
| 10:13 | ro_st | what's nice about st2 is it is FAST |
| 10:13 | ro_st | a great default editor for osx |
| 10:13 | michaelr` | and this ^^^^^^^^^^^ |
| 10:13 | michaelr` | it's fast yes |
| 10:13 | ro_st | ok. break time. happy cloding all |
| 10:13 | michaelr` | i'm using it on windows |
| 10:13 | casion_ | It'd be worth using if a single buffer (or tab.. whatever they call it) can't hang the whole god damned editor |
| 10:16 | casion_ | oh there we go, subleimeblockcursor. that makes life way better in this thing |
| 10:18 | Cheiron | if a data structure is transient, does this mean each nested data structure inside it is transient also? |
| 10:19 | michaelr` | casion_: what does it do? |
| 10:19 | casion_ | michaelr`: block cursor instead of the default pipe |
| 10:19 | casion_ | so you can actually see the cursor |
| 10:19 | michaelr` | casion_: haha |
| 10:24 | michaelr` | casion_: i would really love to have decent clojure integration with st2, and an integrated debugger is a dream :) |
| 10:24 | casion_ | michaelr`: the sublimerepl doesnt seem too bad |
| 10:24 | Cheiron | how to check of a data structure is transient or not? |
| 10:24 | casion_ | it's not nearly as nice as slime so far, but it's usable |
| 10:24 | michaelr` | casion_: really? |
| 10:24 | casion_ | maybe I'm missing something though, will see |
| 10:24 | michaelr` | casion_: i'll have to try it |
| 10:28 | dgrnbrg | is there a way to run leiningen on a project without being in that project's directory? |
| 10:48 | `fogus | Good morning my conservative brethren! |
| 10:49 | mdeboard | Keep it down, we're watching Wapner |
| 10:49 | dnolen | `fogus: haha |
| 10:50 | cemerick | Oh no, it's started. :-) |
| 10:51 | ohpauleez | haha, this is mint |
| 10:51 | cemerick | anyone got that clojurescript-haskell effort underway, so we can all finish the conversion? |
| 10:51 | `fogus | I wonder if Clojure programmers are more likely to eat at Chick-Fil-A? |
| 10:52 | `fogus | Too much? ;-p |
| 10:52 | cemerick | `fogus: just the right amount! |
| 10:52 | casion_ | I refuse to eat there because of their stance on serving shitty tasting food :P |
| 10:52 | scriptor | most boring chicken sandwich I've ever had |
| 10:52 | cemerick | `fogus: congrats on the new book, BTW. I'm very much looking forward to it. :-D |
| 10:53 | casion_ | new book? |
| 10:54 | `fogus | cemerick: It's not a book yet. Time will tell if it ever becomes one |
| 10:55 | cemerick | Well then, whatever it becomes. |
| 10:55 | cemerick | Perhaps I should say 'Good Luck' then. |
| 10:56 | scriptor | casion_: this might be it http://blog.fogus.me/2012/08/07/100-languages-in-100-weeks/ |
| 10:57 | casion_ | jeez, does everyone in here write books? |
| 10:58 | casion_ | I came to this chat to learn, not to read |
| 10:58 | ohpauleez | *certain people* perpetuate the pop-culture-of-computer-science |
| 10:58 | ohpauleez | and it annoys me to no end that *certain people* have such a large and receptive audience |
| 10:59 | mdeboard | I know you're talking about me |
| 10:59 | casion_ | in 1 month of learning clojure, I've bought 4 books on the subject… and ended up speaking with 4/7 authors |
| 10:59 | casion_ | weird community you people have, all accessible and such |
| 11:00 | ohpauleez | mdeboard: haha |
| 11:03 | michaelr` | wrap-facebook-auth is a macro, if i do (count (wrap-facebook-auth {} (doall (albums)))) i get 12, but if i do (count (doall (wrap-facebook-auth {} (albums)))) i get 7? |
| 11:03 | cemerick | casion_: There's the secret Clojure Authors' Guild next door; most of us hang there so we don't have to be amongst the plebs. :-P |
| 11:04 | michaelr` | remove that question mark |
| 11:04 | michaelr` | anyway, the question is what is the difference here? |
| 11:04 | casion_ | cemerick: oooOOOoooOOOooo, sounds secretive and powerful |
| 11:05 | cemerick | Yup, Clojure book authorship: that's where all the power is. |
| 11:05 | `fogus | ohpauleez: Sounds like a nice beer-induced discussion. |
| 11:06 | cemerick | ohpauleez: X is blue and Y is red is eternal linkbait. |
| 11:07 | scriptor | wait, rich hickey hasn't written a clojure book, has he? |
| 11:07 | jsabeaudry | Why does this throw an exception about no matching clause: http://pastebin.com/UYpMzh5g ? |
| 11:08 | ohpauleez | `fogus: I'll see you at the conj :) dnolen, you want in too? we'll start at the "small language" discussion and make our way to pop-culture-computer-science. |
| 11:08 | ohpauleez | cemerick: For sure |
| 11:09 | `fogus | jsabeaudry: What are you hoping to accomplish with that snippet? |
| 11:09 | ohpauleez | cemerick: I've been debating picking up your ML lib, but I'm lacking free cycles |
| 11:09 | cemerick | ML? |
| 11:09 | clojurebot | XML is case-sensitive |
| 11:09 | jsabeaudry | `fogus, I'm trying to do different things based on which function I receive as an argument |
| 11:10 | ohpauleez | cemerick: Machine learning - the name of the lib escapes me |
| 11:10 | cemerick | oh :-( |
| 11:10 | jsabeaudry | `fogus, So I tried case but it does not seem to like functions |
| 11:10 | cemerick | ohpauleez: look elsewhere, I'm afraid |
| 11:10 | ohpauleez | psssh no worries, but sound pieces of advice in the readme |
| 11:11 | cemerick | glad you found it without me linking :-) |
| 11:12 | acheng | it'd be nice if this irc client could color-code entries by #hashtag. it'd be easier to follow the different conversations |
| 11:15 | Cheiron | I have a ref type that wrap a map, this map is consisted of many many nested maps. how this effects the rules of immutability? (updating an immutable data structure causing a new one to be returned) |
| 11:16 | casion_ | jsabeaudry: that's interesting |
| 11:16 | jsabeaudry | `fogus, Here is a btter example with functions test and test2 : http://pastebin.com/1kELTuGZ |
| 11:16 | XPherior | Can anyone help me figure out why I'm getting the exception at the bottom of my Gist? https://gist.github.com/1a69309438b44227e9ca |
| 11:16 | XPherior | I feel like it's something obvious |
| 11:16 | `fogus | jsabeaudry: case will not work for you there. If you *really* want to go that route then you'll need condp |
| 11:16 | jsabeaudry | `fogus, casion_ : test works and test2 throws a no matching clause exception |
| 11:17 | casion_ | jsabeaudry: well, you can get rid of that by having a default |
| 11:17 | casion_ | jsabeaudry: but it still doesnt compare the functions… and I do not know why |
| 11:18 | nDuff | XPherior: tried asking macroexpand what that expands into? |
| 11:18 | nDuff | XPherior: ...by the way, are you sure you really want flatten there (being, as it is, a recursive operation)? |
| 11:20 | jsabeaudry | `fogus, Oh yes if I replace "case fn" by "condp = fn" it does work. I really though that was the definition of case however... |
| 11:20 | `fogus | case does a lot of complicated things. |
| 11:21 | casion_ | `fogus: why doesnt case work in this instance? |
| 11:21 | `fogus | jsabeaudry: All caveats about "are you sure you really want to do this yada yada" apply. ;-) |
| 11:25 | gtrak | macrowizards: this seems too complicated, is there a simpler way? https://gist.github.com/3314988 |
| 11:25 | jsabeaudry | `fogus, casion_ : Ah I should have rtfm, the test constant of case must be a compile time litteral... |
| 11:26 | XPherior | nDuff: Yeah, I think that's messing me up |
| 11:26 | casion_ | jsabeaudry: i see |
| 11:32 | llasram | gtrak: The '#' suffix only has special effect for symbols which appear plain w/in syntax-quote, so you can actually drop it for all of the symbols in that gist |
| 11:32 | gtrak | ah |
| 11:34 | gtrak | symbols which appear plain, ah, since I'm doing ~ it doesn't matter |
| 11:35 | chouser__ | Oh, Yegge... |
| 11:35 | llasram | Right. "Appear plain" <-- probably a better phrasing, but thought better than "un-unquoted" :-) |
| 11:35 | hiredman | chouser__ lives |
| 11:36 | chouser__ | with too many underscores, apparently |
| 11:36 | `fogus | chouser__: Sounds like an exasperated parent. ;-) |
| 11:36 | gtrak | is there any way to simplify the make-servlets thing? I'm just getting rid of it I think. The idea was to just specify a map of servlets to handlers but it doesn't seem worth it. |
| 11:37 | hiredman | I expect at some point someone is going to email the article to the ml (cause no one hasseen it right?) and it will spin off yet another thread of nonsense |
| 11:37 | cemerick | 103 replies later? |
| 11:38 | chouser | I opened this window to see if anyone needed to be comforted, or anything needed to be defused. |
| 11:38 | chouser | Happy to see neither is the case. |
| 11:38 | cemerick | chouser: Nice to see your handle, in any case. :-) |
| 11:38 | hiredman | /topic Anarcho-Crypto ML Collective |
| 11:38 | cemerick | Although you missed the moment when I almost hurled the laptop across the room. |
| 11:39 | ohpauleez | cemerick: haha |
| 11:39 | chouser | oh, dear. Not regarding Yegge I hope? |
| 11:39 | hiredman | maybe he saw yegge across the room? |
| 11:39 | ohpauleez | now, everything is right in the world |
| 11:39 | cemerick | ha |
| 11:39 | chouser | Good to see you man. Congrats on the walking/thinking paths. Look nice. |
| 11:39 | cemerick | Group hug on `fogus. :-D |
| 11:40 | `fogus | chouser: I got lost on the paths yesterday :-o |
| 11:40 | chouser | `fogus: perfect! |
| 11:40 | cemerick | chouser: Less about Yegge than about the inevitable traction that those…notions…will likely get for years. |
| 11:40 | pjstadig | `fogus: seriously. you're office is like 2 miles from my house |
| 11:40 | pjstadig | which is also my office :) |
| 11:41 | `fogus | pjstadig: In Burke? |
| 11:41 | cemerick | I better have a drink in my hand the first time someone asks if I'm a Clojure Conservative. |
| 11:41 | chouser | cemerick: would make a great topic to casually dismiss in an audio conversation... |
| 11:41 | pjstadig | oh |
| 11:41 | pjstadig | hmm |
| 11:41 | pjstadig | nvm |
| 11:41 | pjstadig | i was thinking you were at the Fair Oaks office |
| 11:41 | pjstadig | i saw Fair Oaks and Orlando and stopped :) |
| 11:42 | cemerick | chouser: Dude, anytime. Here, even easier: Monday, 10:30am. There. |
| 11:42 | `fogus | pjstadig: Nah, I have my own little space here |
| 11:42 | chouser | cemerick: yes |
| 11:42 | llasram | gtrak: Maybe something like?: https://gist.github.com/3315099 (nb: untested, may have typos etc) |
| 11:43 | cemerick | chouser: I'm serious. If you're not on skype, I'll have a conversation with a sock puppet wearing a sign that says 'chouser, for realz'. |
| 11:43 | gtrak | llasram: ah fun, I've never used list* like that |
| 11:43 | cemerick | chouser: are you in EST? |
| 11:43 | chouser | cemerick: me too. The only delay on my end has been travel, which is now sorted for a while |
| 11:44 | chouser | cemerick: yes, EST |
| 11:44 | cemerick | OK. There's funky timezone business in Indiana, IIRC. |
| 11:44 | `fogus | cemerick: picking up the podcast again? |
| 11:45 | cemerick | Not really sure if I'm submitting a conj proposal yet. |
| 11:45 | cemerick | gah, wrong window :-( |
| 11:45 | ohpauleez | So I wasn't going to come out with this information, but cemerick and I are working on a new podcast: The Conjervative |
| 11:45 | casion_ | now we all know! |
| 11:45 | chouser | ha! |
| 11:46 | ohpauleez | haha |
| 11:46 | hyPiRion | haha |
| 11:46 | joly | too funny |
| 11:46 | cemerick | `fogus: been meaning to for a couple of months now. Going to try to get serious real-soon-now. :-) |
| 11:46 | `fogus | cemerick: I look forward to it. I've loved every episode so far |
| 11:47 | `fogus | pjstadig: Bummer. I was hoping we could easily meet for lunch. |
| 11:47 | cemerick | `fogus: If you're interested, come on. |
| 11:48 | `fogus | cemerick: If I ever have anything interesting to say then sure. |
| 11:48 | pjstadig | `fogus: yeah, well we should work something out sometime, Burke is still not too distant |
| 11:49 | cemerick | `fogus: oy vey |
| 11:51 | gtrak | the left/right spectrum applies to everything... old news |
| 11:51 | mk | how can I get the docstring using a function? (I'm trying to return a list ns-map keys that begin with "Returns a lazy", (map doc (keys (ns-map *ns*))) doesn't work due to doc macro) |
| 11:51 | gfredericks | mk: use the vals of the ns-map |
| 11:51 | gfredericks | those will be vars, and you can get their metadata |
| 11:52 | gfredericks | so (map (comp :doc meta) (vals (ns-map *ns*))) probably |
| 11:52 | llasram | So... Steve Yegge accused the Clojure community of being radically conservative... or something? |
| 11:52 | cemerick | wow, time zones in Indiana have a deeper history than I thought: https://en.wikipedia.org/wiki/Time_in_Indiana |
| 11:52 | mk | gfredericks: great, thank you |
| 11:53 | hiredman | llasram: he accused the clojure community of being secret ml and haskell lovers |
| 11:53 | pjstadig | hiredman: he accused them of being ml and haskell lovers |
| 11:53 | pjstadig | no secret |
| 11:53 | llasram | hiredman: I was looking in all the wrong places -- just found G+ rant :-) |
| 11:53 | cemerick | Who's this Yegge fellow everyone's on about? :-P |
| 11:54 | pjstadig | or having been "prepopulated" from ML and Haskell |
| 11:54 | hiredman | clojure is a 5th column for java for ml/haskell dependng who ask, I guess |
| 11:54 | llasram | I used to really like his writing, and actually picked up Clojure in the first place because of his foreword to /JoC/ |
| 11:55 | hiredman | who you ask |
| 11:55 | pjstadig | cemerick: it seems that time zones have a deep history...most anywhere |
| 11:55 | acheng | there's a large country out there that has one time zone (or used to) |
| 11:57 | casion_ | I've never touched haskell or ML, so obviously he's wrong |
| 11:57 | gtrak | I'd love to learn those things |
| 11:57 | `fogus | I think Sam Aaron's tweet is the perfect rebuttal. :-) |
| 11:57 | casion_ | wait, I did touch haskell… but it was ugly and the community was odd |
| 11:58 | cemerick | There *is* no rebuttal. Trying to come up with one is like attempting to be clever in response to being mooned. |
| 11:59 | hiredman | I have rebuttal: |
| 11:59 | hiredman | that's dumb |
| 11:59 | ohpauleez | so, how many other people just tried to come up with a clever response to being mooned and failed to? |
| 12:00 | pjstadig | hiredman: you say that about everything |
| 12:00 | ohpauleez | surely, I'm not alone |
| 12:00 | hiredman | it is a zinger, I admit, I've been working on it all morning |
| 12:00 | ohpauleez | pjstadig: hiredman that is true |
| 12:00 | cemerick | pjstadig: beat me to it ;-) |
| 12:00 | acheng | maybe he thrives on being discussed. he's growing stronger now. |
| 12:00 | cemerick | no doubt |
| 12:00 | mdeboard | https://twitter.com/d6/status/233954764008873984 |
| 12:00 | mdeboard | relevant |
| 12:00 | pjstadig | agreed, let's stop discussing |
| 12:01 | ohpauleez | inc |
| 12:01 | cemerick | the twitters will be roiling for hours now; probably more gas there than in #clojure anyway |
| 12:02 | casion_ | on a lighter note… it's sunny |
| 12:03 | casion_ | and I have to take a 2 hour buss journey to see my wife perform on a trapeze |
| 12:03 | casion_ | how can I solve this with clojure? |
| 12:03 | ohpauleez | probably atoms |
| 12:04 | hiredman | ~women |
| 12:04 | clojurebot | women are just jealous, since lisp has nice curves. -- Chousuke |
| 12:05 | Chousuke | I wish I could remember the context where I said that |
| 12:05 | hiredman | for a quote like that, who needs context |
| 12:05 | nDuff | casion_: Bus ride sounds like good hammock time. |
| 12:05 | nDuff | casion_: ...so you can at least be operating in accordance with Clojure _principals_. :) |
| 12:06 | casion_ | nDuff: in this area, 'bus ride' is a euphemism for 'walking between bus stops in the searing heat' |
| 12:06 | casion_ | hammock time involves a brain that's not occupied with not dying of heat stroke lol |
| 12:06 | nDuff | casion_: Ahh. Yeah, that's not so much fun. |
| 12:07 | hiredman | Chousuke: http://clojure-log.n01se.net/date/2009-03-23.html#17:29 |
| 12:09 | casion_ | nDuff: I live in florida, and i have bradbury-eggleston syndrome... |
| 12:09 | casion_ | stupid wives. |
| 12:09 | nDuff | casion_: *nod*. In her case, it's a complication from spina bifida -- no sweat response at all. |
| 12:10 | nDuff | ...suffice to say that we're looking forward to moving up north when the opportunity arises. |
| 12:10 | casion_ | I've been trying to figure out how to move north |
| 12:11 | casion_ | we just extended our house since we couldnt figure out the logistics of moving.. so that probably wont happen for a while |
| 12:13 | hiredman | cemerick: this load-file-command thing is horrible, are you suggesting nrepl.el should slurp in clojure code and send it across the wire as a string for evaling when loading a file? |
| 12:14 | chouser | Bleh. I started writing a response that was *only* going to compare Clojure as it acutally is to Yegge's own defenition of software conservatism. |
| 12:14 | chouser | But even that is tiring |
| 12:14 | hiredman | my scratch.clj is 2438 lines |
| 12:15 | chouser | "actually", "definition" ...still tiring |
| 12:17 | mk | is there a fn for mapping just keys? |
| 12:18 | mk | I mean value. Takes map, returns map with fn applied to each value |
| 12:19 | nDuff | mk: I think the common approach is to use zipmap but just pass the key through |
| 12:19 | nDuff | err |
| 12:19 | nDuff | ...not zipmap, but forgetting what it _is_ |
| 12:22 | chouser | nDuff: no, you're right |
| 12:23 | mk | so just giving it the (keys) and mapped (vals)? Isn't that slightly inefficient? |
| 12:24 | chouser | ,(let [m {:a 1 :b 2}] (zipmap (keys m) (map inc (vals m)))) |
| 12:24 | clojurebot | {:b 3, :a 2} |
| 12:25 | mk | presumably it has to do unneeded lookups |
| 12:25 | chouser | or (let [m {:a 1 :b 2}] (into m (for [[k v] m] [k (inc v)]))) |
| 12:26 | mk | ah, thanks |
| 12:26 | chouser | mk: the fns keys and vals don't do lookups, they just walk the tree |
| 12:27 | mk | seems like you'd need two walks. Though that might be no more inefficient than creating the extra vecs |
| 12:38 | chouser | mk: each is a walk, but zipmap consumes them simlutaneously |
| 12:50 | DaoWen | nDuff: I moved to Texas from up north last year. I was so sick of the freezing winters with snows all the time... The summer heat sucks, but I still think the freezing winter was way more miserable. |
| 12:51 | DaoWen | (just don't move too far north) |
| 12:52 | nDuff | DaoWen: I've lived in cold before and enjoyed it -- the significant other even moreso (she's from Chicago). |
| 12:52 | cgag | i find it hard to believe people who claim they like cold |
| 12:52 | cgag | madness |
| 12:52 | mebaran151 | I'm a big cold liker, though I grew up in LA |
| 12:53 | DaoWen | nDuff: I don't so much hate the cold as the snow and ice |
| 12:53 | DaoWen | if it were freezing outside but the ground was always dry then I might like it |
| 12:54 | rlb | DaoWen: there's always McMurdo Station |
| 12:55 | mattmoss | Cold and snow are liked by me provided I don't have to shovel. |
| 12:55 | rlb | hmm, though perhaps it's melty there at the station... |
| 12:56 | mk | are hierarchies only used to determine multimethod dispatches? |
| 12:58 | lynaghk | ping: emezeske |
| 12:59 | S11001001 | mk: internally, yes, but the api is public |
| 13:00 | mk | does they tend to get used for anything? |
| 13:00 | S11001001 | mk: I never have, but can't say about others |
| 13:01 | mk | lynaghk: looks like you summoned him from clear outside of irc |
| 13:02 | gtrak | when there is ice, code from home... |
| 13:03 | mk | S11001001: right. I was just wondering if it was something that found uses beyond multimethods. Presumably not so much |
| 13:04 | S11001001 | mk: I have a special dislike for type hierarchies; maybe some of that translates over |
| 13:05 | mk | what's wrong with type hierarchies? |
| 13:09 | S11001001 | the cost/benefit is all out of whack |
| 13:10 | mk | what's the cost? |
| 13:11 | S11001001 | dealing with co/contravariance and the substitution rules that come with it |
| 13:12 | acheng | woah, partial can handle keyword args. nice! |
| 13:13 | DaoWen | S11001001: don't variance rules only apply when you have parameterized types? |
| 13:14 | S11001001 | you always have parameterized types, because you always have functions |
| 13:14 | technomancy | chouser: so... I'm procrastinating on clj-stacktrace bugs... just so you know =) |
| 13:15 | DaoWen | S11001001: ah, good point. |
| 13:16 | skoodge | I am trying to write a macro similar to "extend", which takes maps with protocol specs as arguments and then builds the correct deftype definition. The problem is that I want these maps to be evaluated on macro invokation, so that I can pass vars containing the maps. How do I do that? using (eval) seems not very clean |
| 13:19 | nDuff | skoodge: yes, but using macros rather than HOFs isn't very clean either. :) |
| 13:20 | skoodge | nDuff: I would like to use a HOF if possibe, but how can I do the equivalent of an "unquote-splice" in a HOF? |
| 13:20 | mk | why do functions imply parameterized types? |
| 13:21 | nDuff | skoodge: ...well, I'm not saying you _can_; sometimes a macro is the right tool for the job. |
| 13:21 | nDuff | (and, err, it depends on where/why/how you're using unquote-splice) |
| 13:21 | nDuff | (sometimes uses of unquote-splice can be replaced by passing a function around, sometimes it can be replaced with apply, sometimes it can't be replaced) |
| 13:22 | S11001001 | mk: a function that takes an object is also a function that takes a string (functions are contravariant in their parameter positions), and a function that returns a string is a function that returns an object (covariant) |
| 13:23 | skoodge | nDuff: I need an unquote-splice à la the following: `(deftype ~name [param#] ~@specs) I have no idea how to do that in a HOF. I can't do something like (apply deftype specs) because deftype is a macro |
| 13:23 | stuarthalloway | given a non-infinite supply of afternoon, what Clojure tickets should I be screening |
| 13:23 | nDuff | skoodge: yup; if you really need deftype, you really need a macro |
| 13:24 | nDuff | skoodge: I wasn't saying you _could_ do what you wanted with a HOF, just that if you're getting your hands dirty with macros, you may need to resign yourself to getting your hands dirty with eval |
| 13:24 | technomancy | thinking of putting out leiningen 2 preview8 early next week, any open issues that should be addressed before it goes out? |
| 13:25 | mk | S11001001: I don't usually think of strings as a subtype of object. They're more like haskell typeclasses. I'm probably confused somewhere, though |
| 13:25 | S11001001 | mk: just an example |
| 13:25 | skoodge | nDuff: yes, that's what I feared. Thanks anyway, I thought maybe there was some clever HOF trickery that could have helped here. |
| 13:26 | mk | S11001001: what's an example of problems with the substitution rules? |
| 13:27 | skoodge | nDuff: btw, is the situation of requiring a macro that evaluates its arguments all that unusual? I try to avoid eval if possible, but it seems like a good idea to write macros that evaluate their arguments, since this gives you macros that are still composable |
| 13:27 | S11001001 | mk: give me the type relationship between immutable rectangle and square (the problem is harder for mutable so I'm starting light) |
| 13:29 | mk | ok, so the usual "a square is a rectangle" |
| 13:33 | antifuchs | a square is somebody trying to teach OOP using geometric shapes? (: |
| 13:33 | mk | geometric shapes are nice. Animals, on the other hand, are a huge mistake |
| 13:35 | septomin | once in high school i wrote a C++ chess program where Queen inherited from Rook and Bishop |
| 13:35 | septomin | why not to give the stroustrup book to teenagers |
| 13:35 | xclite | well duh |
| 13:36 | xclite | queen should inherit from king, obviously |
| 13:36 | acheng | when we did message passing in SICP i had a walking pot of coffee and if you found it you could get two game moves per tick instead of one |
| 13:36 | nvy | hello |
| 13:36 | mk | septomin: sounds right to me. The queen is part of both typeclasses |
| 13:36 | mk | nvy: hey, welcome |
| 13:37 | emezeske | mk: I actually think that geometric shapes are a bad example for OOP, especially the "square is a rectangle" thing |
| 13:37 | technomancy | septomin: classic |
| 13:37 | nvy | I'm very new to Clojure, and always having troublr receiving some kind of dependency exceptions - or something simply doesn't work |
| 13:38 | nvy | I was following this: https://github.com/weavejester/compojure/wiki/Getting-Started |
| 13:38 | mk | emezeske: why's that? |
| 13:38 | nvy | and last command gives, "That's not a task. Use "lein help" to list all tasks." |
| 13:38 | emezeske | mk: Well, a square is not a rectangle. A rectangle has a width and a height, and a square only has a single size |
| 13:39 | emezeske | mk: The only things that can really go in a geometric shape interface are extremely broad, like "getArea()" and they can't share any code |
| 13:39 | scriptor | well, a square *could* be defined as a rectangle with the same values for width and height |
| 13:39 | nvy | I don't know whether it's fine to ask questions about libraries that aren't included in Clojure by default :) |
| 13:39 | emezeske | scriptor: That is a stupid example though |
| 13:40 | emezeske | scriptor: Like, if I saw a class Square derived from Rectangle that just added a bunch of checks to make sure width==height, I would be pissed off |
| 13:40 | mk | emezeske: squares have both a height and width. They're a constrained rectangle. They may very well me implemented using two fields, width and height |
| 13:40 | technomancy | nvy: it's fine. what version of Leiningen are you using? (`lein version`) |
| 13:40 | nvy | technomancy: Leiningen 1.7.1 on Java 1.6.0_24 OpenJDK 64-Bit Server VM |
| 13:41 | mk | emezeske: it wouldn't be efficient, but that's essentially what a square is |
| 13:41 | emezeske | mk: Why aren't squares rectangular hyperprisms, then? With a zero depth and hyperdepth? May as well |
| 13:41 | technomancy | nvy: ok, you'll probably have an easier time using 2.0.0-preview7; can you try upgrading? |
| 13:41 | nvy | sure |
| 13:41 | septomin | is there a word for unnecessarily trying to replicate the ontological structure of the world? |
| 13:41 | emezeske | mk: The point is, if you want to represent a square as a rectangle, just use a Rectangle, don't subclass it |
| 13:41 | emezeske | septomin: OOP |
| 13:43 | mk | emezeske: I suspect that such a thing is a degenerate hyperprism, and not a square... |
| 13:44 | emezeske | mk: It's exactly the same as a Square class that enforces width==height, it just has more than 1 useless field |
| 13:45 | DaoWen | mk: getting back to covariance and contravariance |
| 13:45 | DaoWen | if you have a method that takes a square in your base class |
| 13:45 | emezeske | mk: Anyway, just my opinion, I'll stop off-topicing #clojure now |
| 13:45 | DaoWen | you should be able to override it with a method that takes a rectangle in a subclass |
| 13:45 | nvy | a side question: I am on Linux, and executing anything-Java (like lein or Clojure) means having to wait at least 5 seconds for it to load. Is there a catch? A fix? |
| 13:46 | mk | I'm not sure if that field is zero though. It's probably on topic. |
| 13:46 | DaoWen | that's contravariance |
| 13:46 | DaoWen | it's a type-widening relationship |
| 13:47 | DaoWen | by widening the types of the arguments in a method in a sub-class you can still cover all of the inputs accepted by the original method, so it's legal |
| 13:47 | DaoWen | the return-type is the opposite |
| 13:47 | rlb | nvy: I'd be surprised if it takes that long after the first time. |
| 13:47 | nDuff | nvy: 5 seconds, really? What kind of hardware? |
| 13:47 | hyPiRion | nvy: That's not Java, it's Clojure. It's slow at starting up, and we know it. |
| 13:47 | pyykkis | nvy: are you using oracle java or something else? |
| 13:47 | DaoWen | it's covariant because you can only narrow the type that's returned |
| 13:48 | rlb | nvy: here "time clojure < /dev/null" takes about 1.2s fwiw |
| 13:48 | mk | DaoWen: ok, what's the problem with that opposition? |
| 13:48 | rlb | That's with debian wheezy openjdk 7 |
| 13:48 | rlb | and the debian clojure1.4 package |
| 13:48 | DaoWen | mk: yeah, I don't understand why he says that makes type hierarchies bad |
| 13:49 | lynaghk | emezeske: do you have any suggestions on how to compile-in different configs with lein cljsbuild? E.g., using a different main.cljs file to kickoff the app. (Anything better than symlinking the shared codes into different paths and using the :src-path option?) |
| 13:49 | rlb | (the openjdk-7-jdk package) |
| 13:49 | nvy | I'm on a Laptop with a C2D. Running Noobuntu 12, with an SSD and luks. I checked the clojure time, and it's: user 4s, real 3s |
| 13:49 | mk | DaoWen: I'm a bit confused as to why the functions are part of the hierarchy though. Types and functions are different, and all that |
| 13:49 | _ato | nvy: in my experience running off an SSD helps startup time but doesn't "fix" it. There's no easy answer to it unfortunately or someone would have solved it by now. |
| 13:49 | emezeske | lynaghk: You shouldn't have to symlink anything -- all of the cljs source paths are on the classpath |
| 13:50 | emezeske | lynaghk: But I do think the easiest thing right now would be a separate directory for each main.cljs file |
| 13:50 | nvy | all right, then |
| 13:50 | DaoWen | mk: the functions aren't really part of the hierarchy so much as they interact with the hierarchy |
| 13:50 | lynaghk | emezeske: yeah, but src-path takes only one string, right? |
| 13:50 | emezeske | lynaghk: I tend to just have several exported "main" functions in one main.cljs file, and just call the one I want |
| 13:50 | emezeske | lynaghk: Yes |
| 13:50 | nvy | technomancy: using lein 2 works, and the tutorial went through. Cheers |
| 13:51 | emezeske | lynaghk: If you have a build like ":base-libs" that points to the common files, that will put them in the classpath where other builds can see them |
| 13:51 | nvy | out of curiousity, are a significant number of Clojure programmers using emacs? |
| 13:51 | rlb | nvy: a direct "time java -server -jar /usr/share/java/clojure-1.4.jar < /dev/null" is a touch faster, but not enough to matter. |
| 13:51 | nDuff | nvy: Yes, very. |
| 13:52 | lynaghk | emezeske: "base-libs" is a lein cljsbuild option? |
| 13:52 | hiredman | nvy: http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/ |
| 13:52 | nvy | is there a good /recent/ tutorial to set it up with the repl and all that? |
| 13:52 | emezeske | lynaghk: Nah, just a name I made up for a :build identifier |
| 13:52 | nDuff | nvy: slime/swank+paredit makes emacs probably the best available environment for writing Clojure |
| 13:52 | emezeske | lynaghk: :builds* |
| 13:52 | rlb | nvy: and fwiw, I'm on luks, etc. too, (though not an ssd), but my cpu's probably faster. |
| 13:52 | mk | DaoWen: right. They way I see it, there are just polymorphic functions on different types. The relations between these types are classtypes, in the haskell sense. |
| 13:52 | lynaghk | emezeske: ah. I'm thinking with advanced optimizations everything should be in one build |
| 13:53 | DaoWen | mk: I agree that keeping track of variance relationships is a pain, but that wouldn't even apply in clojure so the point is kind of moot. |
| 13:53 | nvy | yeah rlb, my CPU is quite slow. I've got a four-year-old thinkpad |
| 13:53 | emezeske | lynaghk: It will all get put into one JS file for each dir |
| 13:53 | lynaghk | emezeske: rather than try to put the libs into one js file and then the main fn in another. |
| 13:53 | rlb | right, mine's a mobile i5. |
| 13:53 | mk | DaoWen: unsure of what a variance relationship is |
| 13:53 | emezeske | lynaghk: That's not how it will work out |
| 13:53 | emezeske | lynaghk: Each JS output file will contain all the code it needs |
| 13:53 | mk | or why it wouldn't apply |
| 13:53 | rlb | (and even then, for some things 1.2s is too slow -- so I just don't use clojure for those things right now) |
| 13:53 | DaoWen | mk: I just meant covariance and contravariance |
| 13:54 | nDuff | nvy: ...there are some good videos showing off Emacs Live + Overtone if you're curious about the environment's draw. |
| 13:54 | emezeske | lynaghk: If one of your main.cljs files requires a bunch of namespaces from :base-lib, then the output JS for that main.cljs will include everything it needs |
| 13:55 | emezeske | lynaghk: The :base-libs dir will have its own JS output, if you build it, but you will never use it |
| 13:55 | lynaghk | emezeske: And that will work even if "build A" only has "main-A.cljs" on its classpath, and none of the shared libs? |
| 13:55 | DaoWen | mk: in clojure you'd typically make your own hierarchies and check them with isa? or something like that, and I don't think the "is a" relationship is something that confuses many people |
| 13:55 | DaoWen | until you get into parameterized types |
| 13:55 | mk | DaoWen: yeah, I don't know. I'm not sure that types even directly inherit from each other. The relationship is a typeclass. If there are squares and rectangles, sure, they're both part of the rectangular typeclass. |
| 13:55 | rlb | nvy: I haven't tried nailgun, but that might help, depending on what you're doing -- and of course if you use emacs, depending on how you use it, you might not start up very often. |
| 13:55 | rlb | (assuming clojure works with nailgun...) |
| 13:56 | chouser | technomancy: ha! ok. Something will have to give... |
| 13:56 | emezeske | lynaghk: That will work if "build A" only has "main-A.cljs" in its *:source-path. When it's built, its classpath will contain "build A", "build B" and "build Libs" |
| 13:57 | lynaghk | emezeske: ahhhh, got it. So put everything on the leiningen classpath, then make individual builds that only have their specific files on the :src path? |
| 13:57 | rlb | (oh right, nailgun has no security... -- I haven't actually tried it) |
| 13:57 | emezeske | lynaghk: yeah, exactly |
| 13:57 | lynaghk | emezeske: ah, sweet. Thanks Evan! |
| 13:57 | mk | DaoWen: is a point a circle, or is a circle a point? |
| 13:57 | emezeske | lynaghk: no problem, let me know if you have trouble with that |
| 13:58 | DaoWen | mk: I'm guessing that's supposed to be a rhetorical question—but I don't see either relationship working. |
| 13:58 | nvy | this is crazy, what I've been missing out on for years |
| 13:59 | chouser | skoodge: did anybody mention using extend, which is a function, rather than trying to build on top of macros? |
| 13:59 | mk | DaoWen: you can cast points into 0-radius circles |
| 14:00 | chouser | skoodge: the desire to eval in a macro is often (not always) because an underlying thing is a macro when it should be a function |
| 14:00 | skoodge | chouser: I would use that if I could, but unfortunately I have to use deftype on interfaces (I want to extend some built-ins like conj, peek and pop) |
| 14:00 | technomancy | nvy: you can get simple clojure code to run in under a second with some tricks on a fast SSD, but it's definitely a weak point. the solution is to keep long-running processes going. |
| 14:00 | technomancy | but it means there are certain kinds of programs it's simply not suitable for. |
| 14:01 | amalloy | chouser: when i use extend i often end up wanting to make it a macro anyway, so that the functions automatically get the right type-hints |
| 14:01 | technomancy | I think 0.7s is my record. |
| 14:01 | mk | DaoWen: that suggests that maybe points are circles. But you can also imagine extending a point class, and adding a radius. They both have getPosition, but circles in addition have getRadius. So maybe circles are points. |
| 14:01 | nDuff | nvy: ...this is one of the draws of ClojureScript and other alternative implementations -- much faster startup time. |
| 14:01 | nvy | technomancy: I guess one could use a ramdisk to run it |
| 14:02 | nvy | nDuff: yesplease, is there a website for that? |
| 14:02 | nvy | I've been a huge lua fan |
| 14:02 | emezeske | Circles are not points are not circles |
| 14:02 | emezeske | A circle is a composition of a point and a radius |
| 14:02 | amalloy | very cool, gfredericks |
| 14:03 | nDuff | nvy: It's an ongoing summer-of-code project, not something polished for production -- you'll see a lot more production readiness from the javascript one right now. |
| 14:03 | DaoWen | mk: I agree with emzezeske. the zero-radius circle as a point is kind of an interesting idea—but it's still a point with a radius of zero. |
| 14:03 | nDuff | nvy: that said, https://github.com/raph-amiard/clojurescript-lua |
| 14:03 | rlb | what's likely the fastest (wrt startup), reasonably solid clojure dialect now? |
| 14:03 | rlb | (solid-ish at least) |
| 14:03 | DaoWen | mk: it's 2am my time though, so I'm going to have to call it a night with the shapes discussion :-p |
| 14:03 | amalloy | probably cljs? |
| 14:04 | amalloy | you pay the startup cost at compile time instead of startup time, mostly |
| 14:04 | mk | emezeske: co/contravariance and isa have roughly to do with casting. It seems natural to cast a 0-radius circle into a point, and a point into a 0-radius circle... |
| 14:04 | rlb | what about the clojure -> gambit route -- does that work? |
| 14:04 | mk | DaoWen: have a good night |
| 14:04 | rlb | (well yet) |
| 14:04 | hiredman | you also lose concurrency, vars, etc |
| 14:04 | technomancy | rlb: suspect calling that "solid" would be a huge stretch |
| 14:04 | technomancy | it's very new and untested |
| 14:05 | rlb | technomancy: right, thanks. |
| 14:05 | rlb | And I suppose I should have clarified -- I'm curious about both, but I was only asking about fast run-time startup. |
| 14:05 | emezeske | mk: Ugg... If you ever make a geometry library, I will stay far, far away from it |
| 14:05 | rlb | (as opposed to fast interpreted behavior -- I don't mind a long comple step in this case) |
| 14:05 | technomancy | if you want fast startup time and FP you're stuck with either cljs-on-node or haskell/ocaml |
| 14:06 | S11001001 | mk: what is the type of the operation on Point to set the radius of the circle? |
| 14:06 | technomancy | so the vim nrepl stuff is done in haskell |
| 14:07 | technomancy | and jark is ocaml |
| 14:07 | S11001001 | mk: by set I mean return-copy-with-altered, as yet again the mutable problem is harder |
| 14:07 | nDuff | *shrug* -- I've used cljs successfully in production-y code (client side of an in-house JIRA plugin); it's worked well for what I needed, and patches get merged much more quickly than Clojure proper takes them. |
| 14:07 | rlb | technomancy: if you happen to know -- has much been done lately wrt clojure-in-clojure? |
| 14:07 | technomancy | rlb: nothing I'm aware of |
| 14:08 | mk | S11001001: which circle? to create a point? (circle point radius), or some such |
| 14:08 | rlb | technomancy: that seems promising wrt ports... |
| 14:08 | mk | to create a circle, I mean |
| 14:09 | hiredman | the clojurescript lobby will tell you that clojurescript is cinc, but clojurescript discards a lot of clojure |
| 14:09 | rlb | to the extent that it might reduce the non-clj core |
| 14:09 | dnolen | rlb: CLJS is effectively a CLJ-in-CLJ, as evidenced by the growing number of implementations based on it. regardless of various opinions from people like technomancy and hiredman. |
| 14:09 | hiredman | clojurescript (on javascript) is whole program compilation, which clojure on the jvm is not |
| 14:09 | hiredman | which is a very different experience |
| 14:09 | S11001001 | mk: better yet, given your suggestion that a circle is a point, what is the type of the operation on a circle that alters that radius? |
| 14:10 | dnolen | rlb: there's a lot of work going into making it easier and less specific to JS, with the caveat that changes don't disrupt CLJS usage. |
| 14:10 | hiredman | yes, there are changes to clojurescript happening to make it easier to port clojurescript, but clojurescript is not clojure |
| 14:10 | dnolen | rlb: someone doing a proper CLJ-in-CLJ is probably inevitable and I won't be surprised if it has CLJS in it's genes. |
| 14:10 | mk | S11001001: for the record I didn't say that one was either. I gave two arguments, one for why a circle is a point and another for why a point is a circle. |
| 14:10 | rlb | dnolen: so (I know nothing) did cljs port the core data structures to clojure code? |
| 14:11 | dnolen | rlb: yes. |
| 14:11 | mk | S11001001: (circle circle radius), perhaps |
| 14:11 | rlb | ahh, ok -- well that *is* a significant step. |
| 14:11 | S11001001 | mk: yes, but this is type hierarchy design; you only get to pick one |
| 14:11 | S11001001 | mk: and what if you pass a radius of 0? |
| 14:11 | mk | let's go with it returning a circle |
| 14:11 | technomancy | I guess making getting the analyzer portable is a necessary prerequisite to cinc |
| 14:12 | technomancy | but that's a 3rd-party lib IIRC |
| 14:12 | Gnosis- | has anyone been able to run Java bytecode on GPUs? |
| 14:12 | dnolen | rlb: main missing bits which CLJS will probably never handle itself is inline macros, reified namespaces / vars. |
| 14:12 | Gnosis- | (or, more specifically, Clojure on GPUs) |
| 14:13 | emezeske | dnolen: CLJS won't ever do "eval", will it? |
| 14:13 | Gnosis- | it seems like GPUs would be ideal because of their multiple cores |
| 14:13 | S11001001 | mk: now you have two representations of a point: a point that is not a circle, and a point that is a circle with radius 0. You've gained no expressive power by having a point type. |
| 14:13 | dnolen | rlb: things like real keywords/symbols, fast full reader probably likely eventually in CLJS |
| 14:13 | dnolen | emezeske: a fully bootsrapped CLJS could do that. but non-goal since that's a lot more code to send over the wire. |
| 14:14 | S11001001 | mk: a similar game can be played if you reverse the type relationship: the type of the set-radius result is dependent on what value you give for radius if you want to be consistent |
| 14:14 | scriptor | clojurescript doesn't have keywords yet? |
| 14:14 | dnolen | emezeske: and code that you could not dead code eliminate if eval occurs. |
| 14:14 | mk | S11001001: there's only one point. It's fine if there are two representations, but we're not quite talking about representations, yet anyway |
| 14:14 | emezeske | dnolen: I agree for web stuff it's not all that desirable, just curious |
| 14:14 | scriptor | ah, stored as js strings |
| 14:14 | dnolen | scriptor: keywords and symbols in CLJS are strings for perf reasons at the moment. |
| 14:14 | emezeske | dnolen: Could be useful for the "cljs is clj with a faster startup time" crowd though |
| 14:15 | S11001001 | mk: we are talking about representations, because types are sets of values, and we're trying to deal with totality at the same time, which we must, because that's what variance is talking about |
| 14:15 | dnolen | emezeske: I imagine we'll get there one day. but I honestly I find CLJS/Lua more compelling since it has potentially easy C interop. |
| 14:15 | dnolen | emezeske: compelling for that I mean. |
| 14:15 | emezeske | dnolen: That's a good point, C interop would be sweeeeeet |
| 14:16 | scriptor | dnolen: any research being done on how they could be implemented as something closer to clojure symbols/keywords? |
| 14:16 | dnolen | scriptor: I've put some thought into as well as Brandon Bloom. |
| 14:17 | mk | S11001001: are we talking about typeclasses, or some sort of strange subtypes? I'm actually not sure about how I'd want to model constrained sets (like equal-sided rectangles, strings with no spaces, etc.) |
| 14:18 | scriptor | dnolen: any writeups I could read? |
| 14:18 | cgray | dnolen: sorry to beat my own hobbyhorse (and i joined the conversation in the middle), but what is the philosophical objection to inline macros in cljs? |
| 14:19 | mk | S11001001: the relationship I'm talking about is: you have one type, rectangle, and another type, square. Each has distinct values, and a 1 1 rectangle is distinct from the 1 1 square. But you can safely cast any square value into a rectangle value. |
| 14:19 | dnolen | scriptor: not really. I should do that. Or you could read the source and see how symbols/keywords are currently handled. |
| 14:20 | scriptor | looking through the regular clojure impl now |
| 14:21 | mk | S11001001: this means that you can mess around with squares, and then just suddenly pretend that you were dealing with a rectangle from the very start (that's casting) |
| 14:22 | Gnosis- | mk, S11001001: maybe I'm way off, but what if you had one type for "set of points"? and functions such as circle?, rect?, etc. that tested whether a set of points was a circle or rectangle, etc.? |
| 14:23 | Gnosis- | I definitely don't know any details of what you're trying to do, though :) |
| 14:23 | mk | Gnosis-: we're trying to understand types, with respect to clojure's hierarchies. Circles would be represented with only one point, and a radius |
| 14:24 | S11001001 | Gnosis-: we're discussing the value of type hierarchies; I'm proposing that they're far more trouble than they're worth, and I assume mk agrees, as the last proposed API isn't a hierarchy anymore :) |
| 14:24 | Gnosis- | mk: ahhh... if you're trying to understand type hierarchies, then disregard what I said :) |
| 14:24 | mk | S11001001: is what I described not a hierarchy? |
| 14:25 | dnolen | cgray: no philosophical objection - just yet to see a compelling design document. |
| 14:25 | mk | S11001001: I think it's a classtype hierarchy. If there's such a thing as a "type" hierarchy, that might be something different entirely. |
| 14:26 | S11001001 | mk: it isn't; presence of an isomorphism isn't sufficient to infer presence of a hierarchy |
| 14:26 | cgray | dnolen: ok, makes sense. |
| 14:26 | mk | S11001001: why not? what is a hierarchy above that? |
| 14:26 | S11001001 | mk: type hierarchies feature variance, but total (explicit) coercion to Rectangle is just an isomorphism |
| 14:27 | S11001001 | iow toString is an isomorphism but I wouldn't describe it as meaning that all toStringable things are strings |
| 14:27 | S11001001 | sorry, toString is a homomorphism |
| 14:27 | S11001001 | mk: haskell-wise I'm speaking of the Show typeclass of course |
| 14:28 | mk | you don't need to explicitly coerce the values. You can choose to use the original square as a representation of a rectangle. Its type changes, its data does not. |
| 14:29 | mk | (its value also changes, but again, the representation is still the good ol' java Square "class") |
| 14:30 | technomancy | btw; lein search is now much faster thanks to using incremental index updates |
| 14:30 | technomancy | no more 20-minute wait for those of you on the other side of the pacific |
| 14:33 | mk | S11001001: if we're in java, which we can agree is a terrible model of these things, and we've recently thrown those squares into a rectangle list, we can turn these rectangle values back into square values by using instanceof Square, and then doing an explicit cast |
| 14:38 | ibdknox | I'm trying to decide if I should respond to Yegge's nonsense |
| 14:39 | Iceland_jack | ibdknox: don't :P |
| 14:39 | technomancy | my g+ account was mysteriously deleted, so I'm actually straight up not able to read it. |
| 14:39 | technomancy | it's proven to be a blessing in disguise. |
| 14:39 | ibdknox | lol |
| 14:39 | hiredman | I for one already have my copy of "ml for the working programmer" on order |
| 14:39 | ibdknox | hiredman: haha |
| 14:40 | ibdknox | technomancy: what were your previous languages? |
| 14:40 | davidd___ | I'm an anarchist programmer |
| 14:40 | technomancy | ibdknox: elisp and ruby mostly |
| 14:40 | Iceland_jack | technomancy: You're not missing much, it was interesting if you remove your Serious Glasses® before reading it |
| 14:40 | emezeske | ibdknox: Did Yegge comment on Light Table or something? |
| 14:40 | davidd___ | no, on programmer 'politics' |
| 14:40 | technomancy | ibdknox: I did really enjoy about a week's worth of ocaml last summer |
| 14:40 | technomancy | which has undoubtedly tainted me |
| 14:41 | ibdknox | emezeske: no, he used Clojure as a "case study" |
| 14:41 | emezeske | ibdknox: Uh oh |
| 14:41 | cemerick | very light touch on the 'study' part of that phrase |
| 14:41 | ohpauleez | ibdknox: Abraham lincoln was taller than five feet, I have five toes, how many keystrokes should an ideal function take? |
| 14:41 | ibdknox | lol |
| 14:41 | technomancy | cemerick: "It was Yegge in the study with the candlestick!" |
| 14:41 | ibdknox | ohpauleez: 27, everyone knows that ;) |
| 14:41 | ohpauleez | We need to turn his name into verb |
| 14:41 | mattmoss | lol |
| 14:41 | cemerick | technomancy: shoulda s/candlestick/dart |
| 14:42 | technomancy | cemerick: uh oh, really? |
| 14:42 | ohpauleez | "You function is complected, you've totally yegged the meaning here" |
| 14:42 | dnolen | cemerick: "light" aka "never bother to look at Clojure survey which basically shows Haskell/ML programmers don't generally give two craps about Clojure" |
| 14:42 | stuarthalloway | suggestions welcome for how/whether to fix http://dev.clojure.org/jira/browse/CLJ-1039 |
| 14:42 | antifuchs | hahahaha, it's great to see how yegge manages to troll alll the language communities (: |
| 14:43 | stuarthalloway | also looking for suggestions as to which patches to screen today |
| 14:43 | technomancy | if you come from elisp and JS, I guess clojure seems pretty rigid. |
| 14:43 | technomancy | given that elisp is the perl of lisps. |
| 14:44 | antifuchs | technomancy: more like the awk (: |
| 14:44 | antifuchs | as in ward |
| 14:45 | ibdknox | meh, I'll leave it be |
| 14:45 | ibdknox | in happy news, there will be a big Light Table update next week :D |
| 14:45 | ohpauleez | yessssssssss |
| 14:46 | technomancy | I guess I can stop feeling sorry for yegge over how he got roasted on the seajure mailing list |
| 14:46 | scriptor | technomancy: what happened? |
| 14:46 | amalloy | stuarthalloway: i don't mind selfishly suggesting http://dev.clojure.org/jira/browse/CLJ-1032, which is a bug for which i managed to drum up five "voters" |
| 14:46 | ibdknox | Real Work® can soon be done in the playground |
| 14:46 | stuarthalloway | amalloy: will do |
| 14:47 | technomancy | scriptor: he made some points that I agreed with about certain attitudes in the Clojure community but then followed it up with some really horrible examples when pressed for details. |
| 14:47 | technomancy | and got taken to town over it |
| 14:49 | dnolen | ibdknox: excellent! |
| 14:49 | ibdknox | dnolen: this is definitely an experiment. I'm interested to see how it works out :) |
| 14:50 | scriptor | ibdknox: ah, so new/interesting feature? |
| 14:50 | amalloy | thanks stuarthalloway! |
| 14:50 | ibdknox | I haven't figured out what to call it, but introduces the notion of a document that is made up of parts from many files |
| 14:51 | ibdknox | but works as if it were a single file - meaning you can move between the various editors like you normally would |
| 14:51 | scriptor | neat! also pretty awesome that this is coming so soon |
| 14:53 | ibdknox | I think after this update, the playground is going to turn into a very nice starting point for CLJS (something we really, really need) |
| 14:53 | gfredericks | ~ping |
| 14:53 | clojurebot | PONG! |
| 14:53 | ibdknox | I watched a very smart guy struggle endlessly trying to get the CLJS repl working |
| 14:53 | hiredman | see, there is the mistake |
| 14:54 | cemerick | stuarthalloway: have def strip :type metadata and issue a warning? Seems decidedly Wrong. |
| 14:54 | cemerick | if only `type` used e.g. :clojure.core/type or something. |
| 14:54 | hiredman | the compilation model for cljs makes the repl very "meh" so it is not good place to start |
| 14:54 | stuarthalloway | cemerick: I am just afraid of breaking anything |
| 14:55 | ibdknox | hiredman: well to be fair, he was upset about compile times and was trying to get the repl up to make development faster |
| 14:55 | cemerick | stuarthalloway: anyone putting :type meta on vars would have hit this and bounced off due to the error, no? |
| 14:55 | hiredman | cemerick: well really the :default case for print-method needs to be smarter |
| 14:55 | dnolen | ibdknox: that would be sweet - CLJS is productive but only if you've gone through the gauntlet a few times. |
| 14:55 | acheng | ibdknox: a document woven from many files sounds like literate progamming but in the other direction. have you written a blurb about this somewhere? |
| 14:55 | S11001001 | mk: this should probably go in #haskell instead :) |
| 14:55 | ibdknox | acheng: not yet, but soon |
| 14:55 | hiredman | cemerick: I think you'd only really see it doing a def at the repl |
| 14:55 | acheng | ok cool |
| 14:56 | cemerick | ibdknox: this may be OT for you, but the cljs REPL will work over nREPL (and therefore lein, ccw, reply, and nrepl.el) shortly: https://gist.github.com/3308381 |
| 14:56 | ibdknox | acheng: in practice it's been really neat - still a lot of work to do around making it really efficient finding the things you want to add to the document, but that's just a matter of time |
| 14:56 | ibdknox | cemerick: oh nice! |
| 14:56 | mk | ibdknox: is it this a virtual file that imports other files? Is it used for display like the function bubbles are, or for something else? |
| 14:57 | dnolen | cemerick: neat! |
| 14:57 | cemerick | hiredman: anything that prints a var that contains the offending meta will pop the error. (do (def ^{:type :a} a 5) nil) will set the trap. |
| 14:57 | mk | S11001001: I don't think haskell allows that two distinct things might represent the same value |
| 14:57 | hiredman | cemerick: sure, but outside of the repl how oftend do people print vars? |
| 14:57 | cemerick | nearly never, sure |
| 14:58 | ibdknox | mk: basically imagine function bubbles, without a lot of the visual weight and that seem to connect together as far as text interaction goes |
| 14:58 | cemerick | Been meaning to ask: what do people use for cljs tooling? /cc dnolen lynaghk et al. |
| 14:58 | pjstadig | i like to print my vars each morning so i know where i left off the night before |
| 14:58 | S11001001 | mk: there is a natural transformation from Maybe to [] |
| 14:58 | cemerick | Mostly cljsbuild and a terminal REPL, probably? |
| 14:59 | hiredman | maybe print-method needs a rewrite in to two levels |
| 14:59 | technomancy | cemerick: had a prolonged case of easing the pain caused by not using cljsbuild in here yesterday |
| 14:59 | dnolen | cemerick: lein, lein-cljsbuild |
| 14:59 | hiredman | the first level looks at (type ...) or (class ...) and the second level explicitly passes the result |
| 15:00 | hiredman | so you could call a different method without mucking with the metadata |
| 15:00 | cemerick | dnolen: Have you gotten a cljs repl working through lein? I've not had luck without the nREPL middleware I gisted. |
| 15:00 | hiredman | lein-cljsbuild + codemirror in the browser |
| 15:01 | dnolen | cemerick: lein-cljsbuild can start REPLs standard or browser |
| 15:01 | ibdknox | dnolen: cemerick: I've actually got pretty much everything done for the CLJS stuff, just need to hook it into a websocket so that another browser can listen - I've been modifying LT in itself lately |
| 15:01 | dnolen | ibdknox: nice |
| 15:01 | stuarthalloway | cemerick: not sure if there is any legitimate reason for such hints |
| 15:01 | cemerick | dnolen: oh, the cljsbuild repls; sure, that's a different animal. |
| 15:02 | cemerick | stuarthalloway: Although: printing anything else IMeta that isn't IObj but which has a :type slot is going to bonk even if def screens it out. |
| 15:02 | hiredman | stuarthalloway: I dunno if you caught my suggestion about splitting print-method I think it could be done in a backwards compatible way, but doing it that way is certainly more complicated |
| 15:03 | mk | S11001001: perhaps, but you can't choose to represent the same list values as either arrays or linked lists |
| 15:04 | stuarthalloway | hiredman, cemerick thanks -- think I will paste summary into ticket and if somebody cares enough they can code ie |
| 15:04 | stuarthalloway | s/e/t |
| 15:06 | S11001001 | mk: depends on what you mean by value :) |
| 15:10 | kenneth | hey -- so i was having this problem yesterday which seems to be related to AOT compilation of a dependency -- https://gist.github.com/7c21052f4d192abc362d |
| 15:11 | kenneth | is there any way to fix that? |
| 15:11 | rhoward | can this done in clojure: adding icons to images which expand on mouseover. eg: https://stipple.com/a#browse/photos/3298561 |
| 15:12 | emezeske | rhoward: Anything you can do in javascript, you can do in clojurescript |
| 15:13 | drewr | ...except access an attribute that's also a reserved word |
| 15:13 | amalloy | drewr: (aget x "int"), done? |
| 15:14 | drewr | I had some use that was apparently beyond that functionality |
| 15:14 | mk | S11001001: I mean the usual. The natural value 1 as distinct from the rational 1, and values are equal to themselves, and can't be put twice into a set, and they assure referential transparency |
| 15:15 | drewr | some node lib that had "boolean" attr as a function |
| 15:16 | S11001001 | sure, but haskell does have isomorphisms (i.e. two things having different values but representing the same thing), and it doesn't have type hierarchies |
| 15:17 | cmiles74 | Does the autodoc plugin get cranky with lein2? I'm wondering if it's me or not. |
| 15:17 | amalloy | drewr: you can still do that, it's just unpleasant |
| 15:18 | drewr | amalloy: oh; dnolen told me at the time it was a compiler bug but maybe it's been fixed or worked around |
| 15:18 | amalloy | i don't actually use cljs at all, but i think the following would work: (.call (aget x "boolean") x args) |
| 15:18 | amalloy | if dnolen says it's impossible, he's probably right though |
| 15:19 | drewr | ;-) |
| 15:19 | dnolen | drewr: amalloy: seems possible, though I also recall this bug maybe getting fixed. if it hasn't seems like a relatively simple fix. |
| 15:19 | stuarthalloway | amalloy: looks like the patch https://gist.github.com/b7ecd4395a0d3d473de6 would try to treat s as an Exception and then as a seq, in the case where log-error gets retried after a failed .offer |
| 15:20 | gfredericks | &(let [++ #'+] (with-redefs [+ (fn [a b] (++ a b))] (+ 1 2))) |
| 15:20 | lazybot | ⇒ 3 |
| 15:20 | gfredericks | can anybody explain to me why that doesn't stack overflow? |
| 15:20 | gfredericks | (by calling the new function over and over) |
| 15:20 | dnolen | drewr: just tried at the the repl (.-boolean (js-obj)), seems to work. |
| 15:20 | amalloy | stuarthalloway: yikes, you're right. should be (if (instance? Exception s) (log-error q s) (try ...)), right? |
| 15:20 | drewr | dnolen: great! |
| 15:21 | amalloy | oh wait, no, it already is that way, just the indentation looks weird in the diff you're looking at |
| 15:21 | mk | S11001001: the natural 1 and the rational 1 don't represent the same thing. They're distinct entities, values, incidentally both called 1 |
| 15:21 | stuarthalloway | amalloy, that is what I was checking next :-) |
| 15:22 | stuarthalloway | the patch is easier to read than the gist -- you tricked me! |
| 15:22 | amalloy | gfredericks: + is inlined |
| 15:23 | S11001001 | mk: yes, though that doesn't forbid a nat -> rat isomorphism |
| 15:23 | gfredericks | amalloy: that's it, thx |
| 15:25 | S11001001 | mk: and I'm totally a fan of them being distinct values as well |
| 15:29 | mk | S11001001: in addition, some languages allow that the very same value (not merely isomorphic) can be represented in different ways. In java, you might represent the very same value using two distinct classes |
| 15:30 | mk | in clojure, there are longs and bigints |
| 15:31 | mk | S11001001: have to go though, thanks for the chat |
| 15:38 | Gnosis- | has anyone written a conditions system similar to Lisp's condition sytem? |
| 15:38 | Gnosis- | Common Lisp's* |
| 15:39 | Gnosis- | I think it would be a fun project to write one :) http://www.gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts.html |
| 15:41 | Gnosis- | it seems like a *condition-handlers* var that's a list of handler maps would be the natural way to do this |
| 15:45 | cemerick | Looks like the cljs repl can only be used once? Quitting a cljs REPL and then starting another one up results in org.mozilla.javascript.EcmaError: TypeError: Cannot read property "StringBuffer" from undefined (cljs/core.cljs#6154) |
| 15:49 | dnolen | cemerick: you mean trying to start the Rhino REPL again from the Clojure REPL? |
| 15:49 | devn | Hello conservatives. |
| 15:49 | devn | RE: https://plus.google.com/u/0/110981030061712822816/posts/KaSKeg4vQtz |
| 15:49 | cemerick | dnolen: yeah |
| 15:50 | kenneth | anybody? i'm kind of stuck here, no idea how to debug this issue |
| 15:50 | dnolen | cemerick: just tried at the command line - works for me. but that's using vanilla Clojure 1.4.0 repl. |
| 15:51 | kenneth | https://gist.github.com/7c21052f4d192abc362d |
| 15:51 | cemerick | dnolen: Yeah, same here; I'm using script/repl in the cljs source tree. |
| 15:52 | cemerick | cljs master FWIW |
| 15:52 | dnolen | cemerick: yep, I'm not seeing that on master, are you constructing a new env each time? |
| 15:53 | cemerick | though I'm getting the same over nREPL too, which prompted me to go to script/repl to verify… |
| 15:54 | technomancy | Gnosis-: an implementation exists, but it's been disavowed by its author |
| 15:54 | Cheiron | Hi, would you please have a look at this question: https://groups.google.com/forum/?fromgroups#!topic/clojure/MfRvSMZV_ok%5B1-25%5D |
| 15:54 | Gnosis- | technomancy: haha, why? |
| 15:54 | cemerick | kenneth: can you re-ask? |
| 15:55 | technomancy | Gnosis-: I think it did too much |
| 15:55 | hiredman | I imagne because a condition system is only useful if people use it, 90% of the time you deal with exceptions you are catching other people's |
| 15:55 | Gnosis- | oh. I was picturing a very simple implementation |
| 15:55 | cemerick | dnolen: just did a complete wash-and-repeat. Same error. |
| 15:55 | Gnosis- | with some macros for ease of use |
| 15:55 | technomancy | and what hiredman said |
| 15:55 | Raynes | emezeske: Hi |
| 15:55 | hiredman | ~slingshot |
| 15:55 | clojurebot | slingshot is the successor to clojure.contrib.condition: https://github.com/scgilardi/slingshot |
| 15:55 | kenneth | cemerick: i'm seeing https://gist.github.com/7c21052f4d192abc362d this exception / compilation error |
| 15:56 | hiredman | kenneth: I told you last night, mismatched clojure versions |
| 15:56 | kenneth | hiredman: right, how do i attack / debug that? |
| 15:56 | kenneth | how would that even happen on a clojar? |
| 15:57 | hiredman | kenneth: you are using something that was aot compiled to bytecode with a different version of clojure |
| 15:57 | technomancy | clojurebot: have you excepted ex-info into your heart? |
| 15:57 | clojurebot | Gabh mo leithsc?al? |
| 15:57 | Gnosis- | hiredman: what if there was a macro for wrapping calls to foreign code that would map exceptions to conditions wherever possible? |
| 15:57 | hiredman | clojure.contrib.condition speak of the devil |
| 15:57 | hiredman | kenneth: what version of clojure are you using? |
| 15:57 | kenneth | hiredman: my project.clj only has one dependency: [com.github.drsnyder/beanstalk "1.0.0-SNAPSHOT"] + clojure 1.3 (also tried 1.4) |
| 15:58 | hiredman | clojure.contrib.* is deprecated post 1.2 |
| 15:58 | hiredman | Gnosis-: *shrug* |
| 15:58 | hiredman | kenneth: so this beanstalk thing may not work post 1.2 |
| 15:59 | xeqi | kenneth: https://github.com/drsnyder/beanstalk/blob/master/project.clj |
| 15:59 | xeqi | shows using 1.2.0 / contrib |
| 15:59 | kenneth | okay, so i should use one of the java libs via interop then… |
| 15:59 | hiredman | it is way weird though, because the project.clj doesn't look like it aot compiles |
| 15:59 | seancorfield | and parts of contrib are AOT compiled and can't be used with 1.3 or later |
| 15:59 | hiredman | ah, right |
| 15:59 | hiredman | the aot contrib |
| 16:00 | hiredman | kenneth: it is for the best, a lot of little wrapper things like this are not very good |
| 16:00 | seancorfield | there's four old contrib modules that are AOT compiled and if you use code that depends on them, then you're stuck on clojure 1.2 |
| 16:00 | dnolen | cemerick: can't repro here as long as I fully construct the REPL each time according to CLJS Getting Started wiki. |
| 16:01 | xeqi | kenneth: https://github.com/weavejester/lein-beanstalk looks like it talks to the java api too, so that might be best |
| 16:01 | cemerick | dnolen: e.g. (repl/repl (rhino/repl-env)), correct? |
| 16:04 | cemerick | A full terminal log, FWIW: https://gist.github.com/3317393 |
| 16:09 | alexyakushev | Does anyone need a patched 'count-words' function for Emacs that counts how many Yegges (as unit of measurement) there are in the text? |
| 16:09 | alexyakushev | It says that the last gem was about 1.93 Yegges |
| 16:10 | amalloy | stuarthalloway: i have a patch for sortedmap/kvreduce that fixes the issue in your patch, as well as a separate issue regarding handling of Reduced values. should i attach it to your ticket, or create a new issue since it addresses another problem? |
| 16:11 | stuarthalloway | amalloy: create a new ticket, just with the different part -- my ticket is already ok'ed |
| 16:11 | amalloy | stuarthalloway: i added a comment to your ticket explaining that i don't think your patch is correct yet; mind taking a look? |
| 16:11 | stuarthalloway | amalloy: will do |
| 16:11 | stuarthalloway | breaking for the aft though -- probably Sunday |
| 16:12 | amalloy | okay. still want a separate ticket, given that i think i'm fixing your patch as well? |
| 16:12 | stuarthalloway | have a great weekend, fellow conservatives :-) |
| 16:13 | dnolen | cemerick: works just fine for me. |
| 16:13 | cemerick | meh, ok |
| 16:15 | cemerick | gfredericks: you'll get there sometime tomorrow |
| 16:16 | dnolen | chouser: nice post! |
| 16:16 | gfredericks | well I hope when I do that it makes me angry |
| 16:16 | cemerick | dnolen: well, it pops up using the cljs maven dep too. Oh well, someone else will either hit it or not. |
| 16:16 | nDuff | Is there a motion in emacs/paredit for bringing the following line's code to the pointer? Simply pressing delete at EOL brings all the leading whitespace over. |
| 16:16 | cemerick | gfredericks: if you haven't facepalmed a couple dozen times already… |
| 16:17 | gfredericks | cemerick: I must not be opinionated enough? so far it seems reasonable |
| 16:17 | Raynes | emezeske: Ping me when you've got a couple of moments. I've got problems to complain about. |
| 16:17 | chouser | dnolen: thanks. I don't consider Yegge a troll, so this is feeding, right? |
| 16:17 | gfredericks | reasonable that some people are conservative, not the conservative ideas themselves |
| 16:18 | technomancy | context: http://groups.google.com/group/seajure/browse_thread/thread/18baa18ffdbdd790/917004da1b517f11 |
| 16:20 | alexyakushev | nDuff: I use 'join-line' from the line I want to bring up |
| 16:21 | cemerick | gfredericks: My temperature was raised simply by his throwing around political labels like a frenzied monkey working a carnival dunk tank…in a domain that has thankfully avoided the (mis)use of those labels for the most part before now. |
| 16:22 | cgray | My understand of Yegge's argument is "functional languages like Haskell are statically typed and therefore conservative, Clojure is functional, therefore Clojure is conservative" |
| 16:22 | technomancy | «When people announce: "hey, I made a loop macro!" the response absolutely can NOT be: "why can't you just write it as a series of maps and reductions?" If anyone says that they need to be re-educated in the *economic* importance of embracing diverse programming styles.» |
| 16:23 | acheng | cemerick: gfredericks: yeah, no one likes to be bundled and boxed... he continues to grow stronger as we discuss him. i wouldn't have read it had i not heard about it here |
| 16:23 | technomancy | http://p.hagelb.org/what.gif |
| 16:23 | gfredericks | yeah I guess he did make strong assertions about the permanence of the labels |
| 16:25 | technomancy | haha: "Clojure's been around for over three years now. It's fairly mature. But |
| 16:25 | technomancy | it's not in the TIOBE top 50 languages. [...] To me that says Clojure is doing something seriously wrong." |
| 16:25 | gtrak` | you guys ever seen 'lein compile' compile the same namespace twice? what's that about... |
| 16:26 | gtrak` | doing :aot :all |
| 16:26 | technomancy | gtrak`: probably an issue with timestamps |
| 16:26 | Raynes | technomancy: Oh man, that's awesome. |
| 16:26 | cemerick | Anyway; politics and programming are two of my favorite pastimes/topics, and they are both incredibly nuanced fields with rich histories and interesting futures. It's sad to have seen them intertwined and abused so poorly in the process. |
| 16:26 | technomancy | gtrak`: on the filesystem |
| 16:27 | gtrak` | technomancy: it goes away when I remove the class from the :main key |
| 16:27 | technomancy | Raynes: yeah, better get valim on the phone and let him know the clock is ticking. |
| 16:27 | technomancy | gtrak`: oh, in that case it's a leiningen bug. does it happen on master too? |
| 16:27 | gtrak` | 1.6.1.1 |
| 16:28 | technomancy | gtrak`: wow |
| 16:28 | gtrak` | old? |
| 16:28 | technomancy | beyond old |
| 16:28 | technomancy | nearly 12 whole months |
| 16:28 | gtrak` | hehe, sorry I guess we have some legacy clojure code here that depends on it ;-) |
| 16:28 | gtrak` | but it seems harmless |
| 16:29 | technomancy | yeah, it will probably mostly work, but the number of bugs that have been fixed since then is enormous =) |
| 16:30 | dnolen | chouser: I actually always considered him to be a bit of celebrity troll who had a soft spot for Lisp & JS |
| 16:34 | scriptor | it's also nicely timed with election season |
| 16:35 | gtrak` | I don't know why he bothered with submitting as evidence that someone said macros are risky, his only piece of evidence |
| 16:36 | gtrak` | the point of a language is to give a baseline of abstractions |
| 16:37 | gtrak` | he should just use forth |
| 16:38 | scriptor | a paper citing the opinion of one person at a conference as a marker for general opinion would get laughed at in most scientific fields |
| 16:51 | cgray | technomancy: I asked the other day about writing a plugin for a new jvm-based lang... I've written an ant task, but my boss (i.e. the compiler writer) hates the idea of including ant.jar in the compiler... is that fairly standard practice? |
| 16:52 | technomancy | cgray: it's probably fine to keep it in a separate artifact |
| 16:53 | cgray | technomancy: it = the ant task? |
| 16:53 | technomancy | yeah |
| 16:53 | chouser | dnolen: oh, no, so I did feed a troll? But I like so many of his articles... |
| 16:53 | dgrnbrg_ | I am pondering a new use of lein that I have encountered at work |
| 16:53 | technomancy | chouser: I hate to break it to you, but ... yeah |
| 16:53 | chouser | shoot |
| 16:53 | dgrnbrg_ | I'm building a research environment, and there are global/config variables that I want to set that should be visible inside the project |
| 16:54 | technomancy | top of HN; too late to back out now. pivot to having done it ironically. =) |
| 16:54 | dgrnbrg_ | things like "where should I save results?" or "which hosts should be used for rendering?" or "which datasources are on the table?" |
| 16:54 | chouser | technomancy: ha! |
| 16:54 | dgrnbrg_ | Is there a good way to pass leiningen project keys into the project's JVM? |
| 16:55 | dgrnbrg_ | or is there another accepted way of doing that kind of thing? |
| 16:55 | technomancy | dgrnbrg_: take a look at configleaf |
| 16:55 | chouser | I would have left it with Rich's tweet, except I'm not happy being called a liberal either. :-P |
| 16:55 | technomancy | which is a wonderful name |
| 16:55 | technomancy | chouser: "classical liberal" maybe? |
| 16:55 | dgrnbrg_ | technomancy: this looks AWESOME! |
| 16:55 | dgrnbrg_ | thank you |
| 16:55 | technomancy | early-20th-century definition |
| 16:55 | antifuchs | wow, those binary political classifications again. |
| 16:55 | technomancy | thank dsantiago |
| 16:56 | gtrak` | oo, rich's HN response is good: http://news.ycombinator.com/item?id=4366661 |
| 16:56 | hiredman | dgrnbrg_: my favorite for that kind of thing is to just but a config.clj on the classpath that just contains a map of config options |
| 16:57 | hiredman | the coolest sound binary classification is hard style / soft style, so that is what we should use |
| 16:57 | hiredman | sounding |
| 16:57 | antifuchs | hiredman: ahahah yes, always. |
| 16:58 | antifuchs | also, mandatory dance routines |
| 16:59 | technomancy | hiredman: like hard/soft sci-fi? http://harkavagrant.com/index.php?id=231 |
| 16:59 | hiredman | http://en.wikipedia.org/wiki/Hard_and_soft_%28martial_arts%29 |
| 17:00 | technomancy | H.G. Wells is totally JS sci-fi |
| 17:00 | antifuchs | hiredman: I thought you meant dance styles |
| 17:00 | hiredman | hard or soft style egg |
| 17:00 | hiredman | using the word "style" is where the style comes from |
| 17:00 | antifuchs | also, http://www.youtube.com/watch?v=SnfbEU5wUHg - assembly is jump style programming |
| 17:01 | technomancy | uvtc: no, the important thing there is endianness =) |
| 17:01 | uvtc | technomancy: hahaha. :) |
| 17:02 | chouser | gtrak`: heh, yes, but he uses "FOX-news" in the way he complains about Yegge using "conservative" |
| 17:03 | gtrak | chouser: ha, that's something clearly a liberal would say |
| 17:16 | gtrak | anyone seen a java.io.FileNotFoundException: maven-artifact-2.0.8.jar error with lein-ring? |
| 17:20 | pauldoo | Is there any difference between the final value object produced by (vec '(1 2 3)) and [1 2 3] ? I'm observing that using the latter uses much less memory.. |
| 17:21 | gtrak | doubtful |
| 17:21 | hiredman | (vec '(1 2 3)) will create a list, turn it into an array and make a vector from it |
| 17:21 | hiredman | (if I recall) |
| 17:21 | pauldoo | yep, that's correct |
| 17:21 | hiredman | [1 2 3] it depends |
| 17:21 | pauldoo | but should the vector value it returns be any smaller than [1 2 3] |
| 17:22 | hiredman | pauldoo: how are you measuring? |
| 17:22 | gtrak | perhaps your GC hasn't kicked in yet in the first case |
| 17:23 | pauldoo | gtrak: yeh maybe, though I am calling (System/gc) before measuring heap usage.. it seems to be fairly repeatable |
| 17:23 | uvtc | This http://clojars.org/repo/ is a big list of group-id's, correct? |
| 17:23 | pauldoo | hiredman: I'm using lots of these things and placing them into collections. I'm then calling System.gc, then Runtime.getRuntime().availableMemory(), etc to measure heap usage |
| 17:23 | technomancy | uvtc: the first segment of the group-id, rather |
| 17:24 | hiredman | I suppose the create from array for vectors could have a special case |
| 17:24 | uvtc | Did not know group-id's could have multiple segments. What does a multi-segment group-id look like? |
| 17:24 | hiredman | pauldoo: have you seen tuples? |
| 17:24 | hiredman | https://github.com/hiredman/tuples |
| 17:25 | technomancy | uvtc: com.cemerick/drawbridge, for example |
| 17:25 | pauldoo | hiredman: hehe, by coincidence I've been peering at your tuples code for a few hours tonight. I'm interested in reducing memory usage and I was considering a hardcoded 3-tuple deftype.. |
| 17:26 | pauldoo | hiredman: I got stuck at needing to make my 3-tuples comparable, and noticed that [1 2 3] form gave me most of the reduce memory usage I want already |
| 17:26 | hiredman | I noticed tuples hit the "most forked today" list for clojure |
| 17:26 | uvtc | technomancy: Oh. dot-separated. Like namespaces. Hm. |
| 17:27 | uvtc | technomancy: thanks for finding me that example. |
| 17:28 | hiredman | pauldoo: I think the tuples are comparable |
| 17:29 | pauldoo | hiredman: I'll go drag those in and see how those compare. they boil down to fixed java classes with N fields right? no other runtime baggage? |
| 17:30 | hiredman | yes |
| 17:30 | pauldoo | hiredman: perfection :) |
| 17:30 | mindbender1 | God bless technomancy for M-. |
| 17:30 | hiredman | the elements are still objects though, so integers will be boxed |
| 17:30 | Raynes | technomancy: https://github.com/textmate/textmate |
| 17:30 | Raynes | Er darn |
| 17:30 | Raynes | technomancy: https://github.com/textmate/textmate/pull/37 actual link |
| 17:31 | hiredman | pauldoo: I should warn you they have not seen a lot of use, so there could be rough edges |
| 17:31 | hiredman | if you are holding primitives you may also look at gvec |
| 17:32 | technomancy | Raynes: ieure is tops |
| 17:32 | hiredman | https://github.com/clojure/clojure/blob/master/src/clj/clojure/gvec.clj |
| 17:34 | technomancy | mindbender1: wasn't me dude =) |
| 17:35 | pauldoo | hiredman: I'm using the version from clojars.. Do I really need to (generate-tuples) in my own code.. ? |
| 17:36 | hiredman | pauldoo: no, you should be able to use the constructor functions from tuples.core |
| 17:36 | hiredman | like in the readme |
| 17:36 | pauldoo | (oh, I was looking at your test code..) |
| 17:37 | hiredman | the test code is like that for a reason that escapes me at the moment |
| 17:38 | pauldoo | hiredman: hm, so your tuples suffer from the same compareTo issue that my attempt at defrecord does |
| 17:38 | Cheiron | I want to measure how much space my algorithms is occupying. how to do it? |
| 17:38 | hiredman | pauldoo: what is that? |
| 17:38 | Cheiron | connect jconsole to lein repl? |
| 17:39 | pauldoo | hiredman: I'm using these objects, as well as String objects as keys into a map |
| 17:39 | pauldoo | hiredman: they blow up when compared against String values |
| 17:40 | hiredman | ah |
| 17:40 | amalloy | pauldoo: if you're using a heterogeneous sorted-map, you need to provide a comparator that can compare the things in it |
| 17:40 | Cheiron | why map literal creates an array map but not a hash map by default? |
| 17:40 | amalloy | eg, you couldn't store vectors and strings as keys in a sorted-map either without additional work |
| 17:41 | rbxbx | Is https://github.com/dakrone/cheshire the preferred tool for json parsing/encoding currently since the deprecation of contrib ? |
| 17:41 | technomancy | rbxbx: yup |
| 17:41 | hiredman | rbxbx: since before |
| 17:41 | rbxbx | technomancy hiredman thanks :) |
| 17:41 | Raynes | rbxbx: cheshire is probably the most common, but there is also an acceptable contrib library to use too. |
| 17:41 | pauldoo | amalloy: hm, yeh of course.. this problem must be coming from elsewhere... |
| 17:41 | Raynes | https://github.com/clojure/data.json |
| 17:41 | Raynes | AFAIK, cheshire is much faster. |
| 17:41 | pauldoo | amalloy: it's a hash map thing, so I've presumably misread exactly where this problem is coming from |
| 17:42 | hiredman | a map in java would normally use .hashcode and .equals, but I guess you could use .hashcode and .compareTo |
| 17:42 | rbxbx | Raynes performance isn't super important, but this is good to know. Thanks. |
| 17:46 | Raynes | emezeske: I'll find you. I'll hunt you down. |
| 17:47 | Cheiron | Hi, what are the advantages of array map over hash map? |
| 17:47 | Cheiron | I might be wrong but i guess hash maps are O(1) |
| 17:47 | gtrak | insertion-order iteration, rt? |
| 17:48 | gtrak | an array-map will eventually become a persistenthashmap if you do enough assocs |
| 17:48 | gtrak | http://clojure.org/data_structures#Data%20Structures-ArrayMaps |
| 17:49 | technomancy | Cheiron: big-o notation is immaterial for small values of N |
| 17:50 | pauldoo | hiredman: it's actually a call to Util/equiv which is causing my issue. I haven't figured out what the other object type is, but one is certainly a tuple. Util/equiv calls to compareTo (via Tuple3's equiv), and this is when I get my crash |
| 17:50 | emezeske | Raynes: Haha, I am kind of busy but I can try to respond |
| 17:51 | Cheiron | so why the designers of clojure decided that map literal will create an instance of array map? |
| 17:51 | Raynes | emezeske: No worries. :) |
| 17:51 | emezeske | Raynes: Don't blame me if my Engrish is the badness |
| 17:51 | Raynes | I promise I wont kill you or anything. |
| 17:51 | hiredman | pauldoo: do you know which objects .compareTo is being called? what is the stacktrace? |
| 17:51 | amalloy | hiredman: check https://github.com/hiredman/tuples/blob/master/src/tuples/core.clj#L191 |
| 17:51 | pjstadig | hiredman: pauldoo: that may be an issue, since clojure's equality and hashing functions aren't open |
| 17:52 | pauldoo | hiredman: I haven't figured that out yet. The objects are keys to PeristentArrayMaps. I thought I was only using String and Tuple, but Util/equiv works fine between these types on the repl. |
| 17:52 | pjstadig | any classes you create that don't fall into clojure's equality partitions probably won't work well with hashmaps |
| 17:52 | pauldoo | hiredman: I'll need to do a little more digging |
| 17:52 | hiredman | amalloy: oh, huh, I wonder that I did that for |
| 17:52 | Raynes | emezeske: Anyways, I'm mostly wondering if there is some example of a working project targeting nodejs with lein-cljsbuild. I tried it, but doing (:require [cljs.nodejs :as node]) and having :target :nodejs results in an exception stating that cljs.nodejs doesn't exist. |
| 17:52 | amalloy | hiredman: faster than comparing (seq this) to (seq other), probably |
| 17:53 | hiredman | amalloy: it is gaurded by an (if (instance? Sequential though |
| 17:53 | amalloy | hiredman: so? you can't compare all Sequentials, can you? |
| 17:53 | amalloy | &(compare [1 2] '(1 2)) |
| 17:53 | lazybot | java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IPersistentVector |
| 17:53 | hiredman | it calls the tuples .compareTo, which should work on all Sequentials, it uses nth |
| 17:54 | hiredman | ah |
| 17:54 | amalloy | hiredman: no, your tuple compareTo casts to vector |
| 17:54 | hiredman | yeah |
| 17:54 | hiredman | and nth is from randomaccess not Sequential |
| 17:54 | amalloy | from Indexed, i think |
| 17:55 | hiredman | right randomaccess is the java one |
| 17:55 | amalloy | yeah, that sounds right |
| 17:55 | emezeske | Raynes: Unfortunately, I don't know of any such example (could be one, I just am not aware) |
| 17:55 | Raynes | emezeske: It should Just Work, right? |
| 17:55 | emezeske | Raynes: I've never set that up myself, so I am not sure whether it works, etc, although I would expect it to |
| 17:55 | Raynes | I can put together an example for you if that'd be helpful. |
| 17:56 | Raynes | But there isn't any hurry for you to look at it. |
| 17:56 | Raynes | If we can get things working, we can add an example project. |
| 17:57 | emezeske | Yeah, I would be very much in favor of adding an example project |
| 17:57 | emezeske | And I would like things to work nicely with nodejs, so I can help with that for sure |
| 17:57 | Raynes | Awesome. I'll throw what I've got onto github and ping you. You can take a look whenever you've got some time. |
| 17:58 | pauldoo | hiredman: sorry, I was deep in code there and missed the conversation. Do you understand what the problem might be? (or should I keep debugging?) |
| 17:58 | hiredman | I have an idea |
| 17:58 | emezeske | Raynes: Sweet. Mind opening a lein-cljsbuild issue so I don't forget? |
| 17:59 | Raynes | Will do. I'm kinda worried I'm just doing something stupid though, so don't hold it against me if it isn't an actual issue with lein-cljsbuild. :p |
| 17:59 | pauldoo | hiredman: hehe, cool :) I'm guessing it occurs on hash-collision between a tuple and a string. But I can't reproduce this in a repl, and I only have a strong suspicion the other type is a string |
| 17:59 | emezeske | Raynes: No worries -- doesn't matter how we get to a working example project as long as we get there! |
| 17:59 | hiredman | pauldoo: more likely a list |
| 18:00 | hiredman | hmmm that didn't fail in my test either |
| 18:01 | pauldoo | hiredman: whatever the values in the list returned by re-seq are |
| 18:01 | pauldoo | hiredman: I'd have guessed strings, but they might be some other CharSequence things |
| 18:02 | hiredman | pauldoo: if you could paste a stacktrace that would be good |
| 18:02 | hiredman | pastebin |
| 18:03 | Raynes | emezeske: Issue 114 created, kind sir. |
| 18:03 | solussd | "Caused by: java.io.IOException: File name too long". I'm screwed, aren't I? |
| 18:04 | Raynes | Well, you could use a shorter file name. |
| 18:04 | nDuff | solussd: On a Microsoft platform, I'm guessing? |
| 18:05 | nDuff | (there _are_ limits on *nix systems as well, but they tend to be pretty insanely long) |
| 18:05 | pauldoo | hiredman: http://pastebin.com/F2XmFxM3 |
| 18:05 | emezeske | Raynes: grazie |
| 18:06 | hiredman | pauldoo: fuh, weird |
| 18:07 | hiredman | oh |
| 18:07 | hiredman | I see |
| 18:07 | hiredman | yeah, I cannot use .compareTo for a composite type like that |
| 18:07 | solussd | nDuff: Heroku |
| 18:07 | nDuff | hiredman: ...oh, this reminds me -- I went looking for where the existing substring-matching factoids live in clojurebot (to submit a patch to warn folks away from pastebin.com), and had no luck finding it. |
| 18:07 | solussd | nDuff: and OSX |
| 18:07 | nDuff | solussd: ...how long _is_ this filename? |
| 18:08 | solussd | nDuff: it's the name of a function (the expansion of several macros w/ closures) |
| 18:08 | solussd | I don't know what it is expanded though, not in the stacktrace |
| 18:08 | nDuff | ...hrm, just 255 bytes in OS X; that's... limiting. |
| 18:09 | solussd | it's 255 bytes on just about all modern filesystems |
| 18:09 | nDuff | solussd: ...anyhow, the usual approach for this kind of case is to make the end of it a hash when the rest would go over |
| 18:09 | solussd | mae the end of what a hash? |
| 18:09 | solussd | *make |
| 18:09 | nDuff | solussd: ...oh, you're right -- it's total path length I was thinking about (that's usually several K, but comparatively tiny on win32 except when using the Unicode file API) |
| 18:10 | nDuff | solussd: *nod* -- replace the tail of the filename with a hash of its contents with a known maximum length |
| 18:10 | solussd | but the file is a .class being generated by the clojure compiler |
| 18:11 | nDuff | Ahh. |
| 18:11 | solussd | at least i'm assuming since I'm not reading any files and the exception is thrown on a line that ultimately expands into a function |
| 18:13 | solussd | methinks the clojure compiler should support arbitrarily long class$subclass.class names, bc namespaces are classes and functions are subclasses |
| 18:16 | amalloy | solussd: are you using cryptfs or something? i had this problem when AOT-compiling an unusually-deeply-nested function, because cryptfs was like doubling the filename's length |
| 18:17 | amalloy | eg, ##(class ((fn [] ((fn [] ((fn [] ((fn [] ((fn [] ((fn [] (fn [])))))))))))))) |
| 18:17 | lazybot | ⇒ sandbox8867$eval26107$fn__26108$fn__26109$fn__26110$fn__26111$fn__26112$fn__26113$fn__26114 |
| 18:19 | amalloy | granted the clojure compiler perhaps ought to be a little more careful about the length of the filenames it generates, but even that absurdly long classname is easily short enough to fit in a filename unless your filesystem mangles it |
| 18:20 | talios | amalloy - one might suggest at that point your should just stop using anonymous functions and move them out to a well named one. |
| 18:20 | amalloy | talios: sure, except that lots of macros introduce incidental functions for you |
| 18:21 | Raynes | And enlive introduces like 400 for you. |
| 18:21 | talios | of course - theres nothing to stop the compiler putting all of those $fn's at the same level, they don't HAVE to be nested, just cause the clojure source is nested |
| 18:21 | amalloy | eg, try compiling (for [xs foo, ys xs, zs ys, z zs] z), which generates a function nested about as deeply as that |
| 18:22 | hiredman | pauldoo: 0.0.2 is up on clojars |
| 18:22 | talios | this is something where I think method handles/invoke dynamic would be good - they don't HAVE to be classes. |
| 18:22 | pauldoo | hiredman: I've just thought, is it because my tuples contain strings? |
| 18:23 | hiredman | pauldoo: it because tuples equiv calls .compareTo which compares the elements, and strings and keywords are not comparable |
| 18:24 | pauldoo | hiredman: yay! success!, it works :) Thanks for the amazing real-time support! :) |
| 18:25 | hiredman | it owuld be nice to hear if it works out for you (better memory footprint) or not (for whatever reason) |
| 18:26 | pauldoo | hiredman: just running that test now… * drumroll * |
| 18:27 | pauldoo | hiredman: more memory usage than literals.. apparently.. |
| 18:27 | hiredman | Hah, well, egg on my face then? |
| 18:28 | pauldoo | hiredman: I mean [a b c] seems to use less memory than (tuple a b c) |
| 18:28 | amalloy | really? how is it even possible for a Tuple3 to use up more memory than a vector? |
| 18:28 | pauldoo | amalloy, I have no idea.. I also have no idea why [a b c] takes less space than (vec collection-known-to-contain-3-things) |
| 18:29 | hiredman | pauldoo: I would start questioning the measurements |
| 18:29 | amalloy | me too |
| 18:29 | pauldoo | amalloy: I suspect my very naive memory testing is partly to blame. I'm just using System.gc, and Runtime.*Memory() |
| 18:29 | pauldoo | hiredman: yep - me too, I completely question the measurements |
| 18:29 | amalloy | a valid implementation of System/gc is (constantly nil) |
| 18:30 | kenneth | hey -- i'm getting a class not found exception for "broker" with this code https://gist.github.com/1278d12a6792b7a2ff7a |
| 18:30 | pauldoo | amalloy: yep - I know.. :P |
| 18:30 | amalloy | (vec '(a b c)) is absolutely going to create exactly the same object as '[a b c], but it may create more ephemeral garbage |
| 18:30 | kenneth | running lein run -m broker |
| 18:30 | hiredman | ~namespaces |
| 18:30 | clojurebot | namespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it |
| 18:31 | kenneth | used to work fine. i did change my (ns) macro, did i fuck up my gen-class something? |
| 18:32 | hiredman | ^- |
| 18:34 | pauldoo | hiredman: thanks for the help tonight.. I'm stopping now but I might look further into this memory usage. I agree that my numbers are likely to be borked. |
| 18:36 | casion | any suggestions for 'good' clojure projects to peruse the source of for learning purposes? |
| 18:37 | casion | I've been browsing github, rosetta code and the clojure source, but I'd be interested in anything else folks find useful to check out |
| 18:38 | kenneth | hiredman: okay, refactoring for a two-level namespace |
| 18:38 | hyPiRion | casion: Are you interested in dipping your toe in the pool, or do you want to drink from the firehose? |
| 18:39 | casion | hyPiRion: stuff I can understand is as good as stuff that will make me want understand more |
| 18:40 | casion | so… anything :) |
| 18:40 | kenneth | hiredman: i'm using a two-level namespace now (lein run -m cb.broker) :) |
| 18:40 | hiredman | casion: there is a lot of variety, at lot of which compared to what we have work (were we are very strict about style) makes me cringe |
| 18:40 | casion | hiredman: I didnt understand that… I think you missed a word in there? |
| 18:41 | hiredman | casion: should be "a lot" |
| 18:41 | casion | or a comma or something |
| 18:41 | casion | ah ok |
| 18:42 | kenneth | i'm still having the same problem though -- not sure what's wrong with my ns definition¬ i think it's connected to that |
| 18:42 | hiredman | so I think just reading a lot is good, so you are exposed to the differences |
| 18:42 | casion | I'm still figuring out functional programming concepts and more or less funding idiomatic clojure code has been invaluable in this regard |
| 18:42 | casion | finding* |
| 18:44 | hiredman | casion: leinigen might be good, fair sized project with many contributors |
| 18:44 | hiredman | kenneth: pastebin the stacktrace |
| 18:45 | xeqi | casion: I like ring and compojure sources |
| 18:45 | hiredman | https://github.com/scgilardi/slingshot/ has some interesting sort of conditional compilation |
| 18:46 | kenneth | hiredman: https://gist.github.com/1278d12a6792b7a2ff7a -- added the stack trace at the bottom |
| 18:46 | xeqi | lein has to do a bunch of java/filesystem interaction, but parts of it could be good |
| 18:47 | hiredman | kenneth: and what is the path from the project root to your clojure file? |
| 18:47 | hiredman | xeqi: yeah, well, so do real programs :) |
| 18:47 | kenneth | hiredman src/clj/cb/broker.clj |
| 18:48 | kenneth | hiredman: fwiw, i did a test with an empty core.clj in the same folder, and running lein run -m cb.core and that works fine |
| 18:48 | hiredman | what version of lein? |
| 18:48 | kenneth | (all i did was println inside the -main of the otherwise empty file) |
| 18:48 | kenneth | 1.7.1 and clojure 1.4 |
| 18:49 | hiredman | kenneth: does the file load? |
| 18:49 | hiredman | like if you copied and pasted it in to the repl are their errors? |
| 18:50 | hiredman | my guess is lein is trying to load the namespace, fails, and falls back to looking for the class |
| 18:52 | pbostrom | kenneth: you appear to be requiring the java package com.surftools.BeanstalkClient, is that correct? |
| 18:54 | pbostrom | kenneth: by that I mean, that's probably not what you want to do |
| 19:12 | Cheiron | How to profile clojure code with jvisualvm? I attached jvisualvm to a running lein repl but it is measuring jlint |
| 19:13 | gtrak | ? |
| 19:13 | gtrak | Cheiron: it should work, not there are two lein processes usually |
| 19:13 | aperiodic | are you sure you're hitting the right java process? |
| 19:13 | gtrak | note* |
| 19:13 | Cheiron | i started cpu profiling, but all profiled methods are jlines |
| 19:14 | Cheiron | from jvisualvm, Local -> jline.ConsoleRunner (pid 6980) and connect |
| 19:14 | gtrak | ... did you read what we just said? |
| 19:15 | aperiodic | try different processes |
| 19:19 | Cheiron | forgive my ignorance but under Local, there are only two items, VisualVM and jline.ConsoleRunner (pid 6980) |
| 19:23 | aperiodic | are you sure the repl is running? when you have visualvm open and you launch more lein repls, do you see them show up? |
| 19:24 | aperiodic | on my visualvm (1.6.0_33 build 120430 on OS X 10.6.8), any clojure applications show up as 'Clojure application (pid xxxxx)' |
| 19:24 | Cheiron | yes the lein repl is running. I launched a second lein repl. both are shown as jline.ConsoleRunner (pid ....) |
| 19:25 | Cheiron | I'm launching the repl with lein |
| 19:25 | aperiodic | i have repls running and i don't see any jline.ConsoleRunner processes |
| 19:26 | Cheiron | should I launched a raw Clojure repl? (without lein) |
| 19:26 | Cheiron | *launch |
| 19:26 | aperiodic | worth a shot, i guess |
| 19:27 | aperiodic | sounds like a problem with visualvm, honestly. not sure what to do, sorry |
| 19:28 | Cheiron | actually my environment is exactly like yours, both the jvm and the os |
| 19:28 | aperiodic | hmm |
| 19:28 | aperiodic | what lein version? |
| 19:29 | aperiodic | s/what/which/ |
| 19:29 | kenneth | hiredman: sorry i stepped out for a second |
| 19:29 | Cheiron | Leiningen 1.7.1 on Java 1.6.0_33 Java HotSpot(TM) 64-Bit Server VM |
| 19:31 | aperiodic | Cheiron: i'm using lein2 from master. give either that or lein2-preview7 a shot |
| 19:32 | kenneth | i'm indeed importing the package com.surftools.BeanstalkClient -- https://github.com/jpeffer/JavaBeanstalkClient/blob/master/src/main/java/com/surftools/BeanstalkClient/Client.java |
| 19:32 | kenneth | \ |
| 19:32 | amalloy | hiredman: i'm trying to use a scheduled executor to perform background tasks at regular intervals as you usually advocate, but i can't see a way to get all my background tasks to share threads from an automatically-sized pool, because ScheduledThreadPoolExecutor mandates that corePoolSize==maximumPoolSize. do you know any clever solution to this, or should i just suck it up and give each background task its own executor (and thus thread)? |
| 19:32 | kenneth | this is the first time i ever require java code from clojure so i might be doing it wrong |
| 19:33 | xeqi | kenneth: the gist is also trying to :require it, which shouldn't work |
| 19:33 | amalloy | kenneth: he was concerned because BeanstalkClient is a terrible name for a java package, and it was likely you were confused into thinking it's a package when it's not. but apparently it is |
| 19:33 | hiredman | amalloy: are you schedule lots of longing running taks that run at the same time? |
| 19:34 | kenneth | amalloy: yeah, i'm kind of confused by it myself. i don't quite get the point of having a package for the interface implemented by an implementation package |
| 19:34 | amalloy | hiredman: right now i only have one not-very-long task. but i'm trying to make this reusable |
| 19:34 | amalloy | the idea is to pass a thunk and a duration, and have the thunk called for you every [duration], saving the results somewhere you can get at them |
| 19:35 | Cheiron | aperiodic: launching a raw repl shows "Clojure application pid ..." |
| 19:35 | amalloy | at the moment, this is to compute/cache a function that might take a very long time, and just serve the last-cached value since being exactly correct isn't important |
| 19:36 | hiredman | amalloy: I would lean more towards what scheduledthreadpool provides, but if you want an open ended threadpool you can use a scheduled thread pool to launch futures |
| 19:36 | kenneth | okay let me ask you this, then. if i've included this java maven packaging in lein with [com.surftools/BeanstalkClient "1.4.6"] -- considering the library look like this https://github.com/jpeffer/JavaBeanstalkClient/tree/master/src/main/java/com/surftools how would i use it from a clojure project? |
| 19:37 | aperiodic | Cheiron: ok, i'm gonna blame this on lein 1.7.1, then. FWIW, I've found profiling/sampling to make much more sense when I compile the project into an uberjar and launch that (so lein/repl/swank stuff doesn't get in the way, I guess) |
| 19:38 | hiredman | amalloy: actually for the cache case like that using an stpe to schedule sending actions to an agent might work well |
| 19:39 | amalloy | hiredman: yes, agents are certainly easier. i didn't want to do that though, because if your function takes longer than your schedule duration, the agent queue grows without bound |
| 19:39 | amalloy | perhaps i'm just jumping at shadows, though, and i should use agents since they're so easy/perfect except for that one problem |
| 19:40 | hiredman | you don't want the agent queue to grow without bounds, but you want the threadpool for stpe to grow without bounds? |
| 19:41 | hiredman | well, thats not fair, I guess maximumPoolSize would be a bound |
| 19:41 | amalloy | right, and it seems to me like the scenario for an agent queue growing without bound (a single badly-behaved task) is more likely than the scenario for the threadpool growing without bound (a large number of concurrently-executing tasks) |
| 19:44 | amalloy | as an aside, am i crazy for wanting to customize the thing agents use to store their queue? eg, pass it a max-size-one queue so that tasks can't pile up if repeat sends don't matter |
| 19:46 | hiredman | amalloy: I think scheduling jobs that may run for longer then their period is the problem |
| 19:47 | mk | amalloy: what do you mean about repeat sends? note that agent tasks aren't queued right away during transactions, but come in in bulk afterwards |
| 19:47 | hiredman | one possiblity is to check some kind of mutex in the scheduled job to see if the agent action is running, if not send-off, if so do nothing |
| 19:47 | amalloy | okay. so you think, just use agents because they're convenient/performant, and if the queue fills up that's your problem? |
| 19:49 | hiredman | no, if their is a chance the job will run longer than the period that is a real problem and should be addressed, one way would be to use something like a try-lock to ensure that only one version of the job runs |
| 19:50 | hiredman | the agent cold hold the value + a status flag, and you use 2 actions the first to set the flag and the second to run the job and unset the flag |
| 19:51 | hiredman | I guess that still has the queue problem |
| 19:51 | hiredman | you need the mutex for each job before you queue/run it |
| 19:51 | amalloy | hiredman: i think that's arguably a problem of the person using this cache-queue function, which they should address, but not a problem of the cache-queue implementation |
| 19:53 | kenneth | gs |
| 19:53 | kenneth | whoops wrong window there |
| 19:53 | kenneth | looks like you don't need to require something before importing it! neat |
| 19:53 | mdeboard | I will never forgive you. |
| 19:54 | amalloy | kenneth: require and import are entirely orthogonal |
| 19:54 | mk | amalloy: are you computing something based on new data, like an approximate average or something? |
| 19:54 | amalloy | require loads a clojure namespace; import makes available short names for already-loaded java classes |
| 19:55 | amalloy | mk: yeah, based on whatever changes have happened to the database |
| 19:56 | amalloy | a potentially slow query that can't be sped up (yet), but which doesn't need to be exactly up-to-date |
| 19:56 | hiredman | perfect for caching |
| 19:56 | kenneth | amalloy: right but i figured it wasn't loaded already. or does including a java package as a dependency in lein auto load it? |
| 19:56 | amalloy | hiredman: yeah, which is exactly what i'm doing here |
| 19:57 | hiredman | amalloy: you can just provide scheduling and rate limiting as separate complementary bits |
| 19:57 | amalloy | oh, rate-limit the agent-send function? |
| 19:57 | hiredman | yeah |
| 19:58 | mk | amalloy: this doesn't seem like a job for an agent. At least, the agent would be used to accept requests, but then the agent would have to dump them into a managed secondary queue. |
| 19:58 | amalloy | that's a good idea. i already have a rate-limit function. but how can i do it? i can't know what rate to limit it to, because i don't know how long the task will take |
| 19:58 | hiredman | amalloy: hmmm |
| 19:59 | hiredman | yeah I guess you cannot do that separately, would have to take it as an option |
| 20:01 | mk | can the agent just decrement numInQueue, while the sender sends and increments it, but only if it's below n? |
| 20:03 | hiredman | I noticed https://github.com/stuarthalloway/orolo/blob/master/src/orolo/periodically.clj the other day, which looks neat but I haven't played with it |
| 20:03 | hiredman | it exposes scheduled tasks to jmx so you can suspend and resume them |
| 20:07 | amalloy | that's cool |
| 20:07 | hiredman | it would be cooler if we used jmx at all at sonian |
| 20:09 | hiredman | expose counters, etc, over jvm plus something like http://code.google.com/p/jminix/ would be neat |
| 20:19 | mk | what is loaded-libs used for? |
| 20:44 | wkelly | 92=== |
| 20:44 | wkelly | erm, sorry! |
| 20:44 | gfredericks | 93+++ |
| 20:51 | meredydd | Hey, does Hiccup do something weird with thread-local bindings and Ring? |
| 20:52 | amalloy | i doubt it |
| 20:52 | meredydd | I've just hit an issue where I get strange errors about unbound fns when calling hiccup.core stuff |
| 20:52 | meredydd | but it doesn't reproduce when calling the same model fns from the repl |
| 20:53 | weavejester | meredydd: What does your code look like? |
| 20:53 | meredydd | and it doesn't reproduce if I specifically spawn off a separate thread right before the call |
| 20:53 | meredydd | Oh, hello weavejester :) |
| 20:53 | weavejester | meredydd: Hey there |
| 20:53 | meredydd | It's a Ring handler for an API |
| 20:53 | meredydd | which then calls into a bunch of model code |
| 20:53 | meredydd | some of which then attempts to send an HTML email, some of which is rendered with Hiccup. |
| 20:54 | meredydd | If I make exactly the same calls into the model code from the repl, the emails render and send fine |
| 20:54 | weavejester | meredydd: Hiccup doesn't do anything with bindings, except for adding an optional common prefix onto relative URIs. |
| 20:54 | meredydd | Okay...so why is it complaining that hiccup.compiler/render-html is unbound? |
| 20:55 | weavejester | Well, that would imply that the hiccup.compiler namespace was never loaded. |
| 20:55 | meredydd | (but only when I call it from the thread that's servicing the web request - if I spawn a new thread to make the call, it works fine) |
| 20:55 | meredydd | Is it not loaded automatically by hiccup.core? |
| 20:55 | weavejester | It is. |
| 20:56 | weavejester | So… I'm not certain what could be unbinding it. Or making hiccup.core forget. Certainly I've never had any problems like it. |
| 20:56 | meredydd | ugh |
| 20:56 | meredydd | It's a very temporary and (thread-)local form of forgetting, as well. |
| 20:56 | weavejester | Could you reproduce the behaviour in a small project? |
| 20:57 | meredydd | Working on it. |
| 20:57 | weavejester | Okay, let me know what you find... |
| 20:57 | weavejester | Expanding the html macro might also shed some light on the issue. |
| 21:00 | meredydd | and just like that, it's started working again, with my original code. |
| 21:01 | meredydd | (And I had already started with a fresh VM in an attempt to avoid this problem. Humph.) |
| 21:02 | meredydd | I'll get back to you if it starts again and I can narrow it down at all, weavejester. |
| 21:27 | wmealing | meredydd, i try to run all my testing in jenkins |
| 21:27 | wmealing | allows me to know if i'm doing something stupid |
| 21:49 | Cheiron | Hi, any ideas what is wrong with code: http://pastie.org/4453058 |
| 21:50 | Cheiron | I'm getting ClassCastException java.lang.Long cannot be cast to clojure.lang.Associative clojure.lang.RT.assoc |
| 21:54 | xeqi | Cheiron: after line 3 what do you think the atom looks like? |
| 21:58 | Cheiron | xeqi: sorry unable to figure it out |
| 21:58 | xeqi | &(let [accumulator (atom {})] (swap! accumulator #(update-in % [:p1 :p2 :p3] (fnil + 0) 1)) @accumulator) |
| 21:58 | lazybot | ⇒ {:p1 {:p2 {:p3 1}}} |
| 22:00 | Cheiron | yes but why second swap! isn't working? i guess |
| 22:01 | xeqi | (get-in {:p1 {:p2 {:p3 1}}} [:p1 :p2 :p3]) |
| 22:01 | xeqi | &(get-in {:p1 {:p2 {:p3 1}}} [:p1 :p2 :p3]) |
| 22:01 | lazybot | ⇒ 1 |
| 22:01 | xeqi | &(get-in {:p1 {:p2 {:p3 1}}} [:p1 :p2 :p3 :p4]) |
| 22:01 | lazybot | ⇒ nil |
| 22:02 | Cheiron | sorry but still not following why i'm getting classcastexception |
| 22:02 | xeqi | &(update-in {:p1 {:p2 {:p3 1}}} [:p1 :p2 :p3 :p4] identity) |
| 22:02 | lazybot | java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.Associative |
| 22:02 | xeqi | there we go |
| 22:02 | xeqi | had to figure out which part it was |
| 22:02 | xeqi | expected the get to fail |
| 22:02 | amalloy | it's the assoc |
| 22:03 | amalloy | &(get 1 :foo) works fine |
| 22:03 | lazybot | ⇒ nil |
| 22:03 | amalloy | as an aside: you can guess that from the stacktrace, since get uses ILookup, and assoc uses Associative |
| 22:05 | Cheiron | i appreciate your time guys but still unable to figure out why i'm getting the exception :'| |
| 22:05 | xeqi | it is trying to (assoc 1 :p4 1) in your second line |
| 22:05 | xeqi | since the value for the :p3 key is 1 |
| 22:05 | xeqi | second swap! / line 4 |
| 22:07 | xeqi | basically, line 3 sets the value of :p3 to 1; line 4 expects the value of :p3 to be a map so it can place :p4 1 in it |
| 22:08 | Cheiron | but according to update-in |
| 22:08 | Cheiron | 'Updates' a value in a nested associative structure, where ks is a |
| 22:08 | Cheiron | sequence of keys and f is a function that will take the old value |
| 22:08 | Cheiron | and any supplied args and return the new value, and returns a new |
| 22:08 | Cheiron | nested structure. If any levels do not exist, hash-maps will be |
| 22:08 | Cheiron | created. |
| 22:09 | metellus | the :p3 level does exist, it's just not a map |
| 22:10 | Cheiron | i started to see |
| 22:10 | metellus | (or the :p4 level, depending how you look at it) |
| 22:13 | alpheus`` | where do I find what used to be clojure.contrib.repl-utils? |
| 22:15 | xeqi | ~contrib |
| 22:15 | clojurebot | Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go |
| 22:17 | alpheus`` | thanks. last time I used clojure it was 1.2 so 1.4 seems different. really nice, though! |
| 22:17 | alpheus`` | lein2 is pretty fancy |
| 22:19 | duck1123 | If I have a fn like (fn [a b & {:as opts}] ...) how do I call that fn if I have the opts in a map? 'apply' doesn't do the trick |
| 22:20 | jkkramer | ~mapply |
| 22:20 | clojurebot | You could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args)))) |
| 22:21 | Cheiron | I'm running this (dotimes [n 300] (harness)) |
| 22:21 | duck1123 | that's annoying. route-one needs to not use [& {:as opts}] |
| 22:21 | Cheiron | with jvisualvm, update_in.doInvoke is called 3600 times. why? |
| 22:22 | Cheiron | harness is calling update-in three times, and dotimes repeat harness function 300 times |
| 22:23 | Cheiron | why update-in.doInvoke is called 3600? |
| 22:24 | jkkramer | Cheiron: update-in is defined recursively |
| 22:26 | Cheiron | so every update-in call is issuing four times update-in? |
| 22:27 | xeqi | once per key |
| 22:28 | Cheiron | is this efficient in my case? am i misusing it? |
| 22:29 | Cheiron | should i care about the fact that it is called 3600 times? |
| 22:29 | jkkramer | Cheiron: what are the speed and memory requirements of your program? |
| 22:30 | Cheiron | it will run on a server machine |
| 22:30 | Cheiron | jvisualvm says update-in.doInvoke self time is 16.6 ms |
| 22:30 | jkkramer | that's pretty vague |
| 22:30 | jkkramer | I'm guessing you don't need to worry about it |
| 22:31 | Cheiron | I know but still don't know what our server specs is going to be |
| 22:32 | xeqi | thats like asking how much concrete to use in a bridge, but not knowing the weight requirement or strength of the concrete |
| 22:32 | Cheiron | very true :) |
| 22:33 | xeqi | my instinct is to say the time in update-in will be dwarfed by something else |
| 22:34 | Cheiron_ | what I'm trying to do is collecting analytics data. what I'm trying to do is to use an atom that refers to a map. the map will be consisting of many other nested maps |
| 22:34 | Cheiron_ | to save memory, since clojure maps are immutable, do you suggest to use a persistent map? |
| 22:35 | Cheiron_ | sorry, transient map i mean |
| 22:36 | Cheiron_ | hmm, guess it wont work since update-in is going to create immutable maps |
| 22:39 | Cheiron | while profiling with jvisualvm. i noticed Cons instances are the most created objects. why? afaik, clojure doesn't depend on Cons concepts as other lisps |
| 22:42 | cemerick | FYI: Piggieback allows you to run a ClojureScript REPL over any nREPL session—for Leiningen, nrepl.el, Counterclockwise, &c https://github.com/cemerick/piggieback |
| 22:42 | cemerick | It's still a bit rough in getting it set up, but it works well AFAICT. |
| 22:46 | Cr8 | cemerick: just saw the tweet, what's the easist way to get on to lein latest git? |
| 22:48 | cemerick | Cr8: clone from https://github.com/technomancy/leiningen, read https://github.com/technomancy/leiningen#building. You'll be off in ~2 minutes. |
| 22:49 | cemerick | I hear a new preview release will be out shortly, in which case you can just `lein upgrade`, and use piggieback reasonably easily. |
| 22:49 | cemerick | The top priority is getting rid of that horrible :nrepl-handler business. |
| 22:50 | cemerick | ideally, just adding piggieback as a Leiningen hook will do, if you're using it primarily. Being able to easily drop in new nREPL middlewares for your app-side REPL servers will become a ton easier shortly as well. |
| 23:00 | xeqi | cemerick: is this a rhino backed cljsrepl? |
| 23:00 | cemerick | Cr8: oh, yeah; sorry. That'll be waiting on the next sync. |
| 23:01 | cemerick | Cr8: you can add https://oss.sonatype.org/content/repositories/releases/ as a repository if you're impatient :-) |
| 23:01 | cemerick | xeqi: By default, yes. |
| 23:02 | cemerick | I don't suppose I'll ever use anything else (at least until nashorn comes around?!), but I'll be happy to take a patch adding V8 support or whatever. |
| 23:02 | xeqi | heh, I had my hopes up for a second for a browser based repl |
| 23:03 | cemerick | oh, over nREPL, you mean? |
| 23:03 | xeqi | and was trying to imagine how that would look |
| 23:04 | xeqi | .. yes? one that I can get all the nice nrepl.el interaction with |
| 23:04 | xeqi | I don't know enough to say if thats a new nrepl server or middleware or what |
| 23:05 | cemerick | all in good time ;-) |
| 23:05 | cemerick | There's a bunch of different approaches that could be taken. |
| 23:08 | cemerick | There's actually one radical approach that I think might beat 'em all, though I'm not certain yet: an applet running an nREPL server + piggieback. |
| 23:08 | xeqi | I'm sure its more complicated then swtiching rhino/repl-env with browser/repl-env |
| 23:09 | cemerick | browser/repl-env may be just fine. Like I said, I'm a noob. :-) |
| 23:11 | cemerick | wow: both rhino.clj and browser.clj extend IJavaScriptEnv to IPersistentMap |
| 23:15 | alpheus | what's a good way to use the unix mkdir system call? I need the atomicity. |
| 23:30 | alpheus | I'd like to use clojure.java.io/make-parents and be assured of failure if the path existed without any race conditions in the face of other processes doing the same thing. |
| 23:43 | uvtc | alpheus: Looks like [fs](https://clojars.org/fs) has a mkdir function. |
| 23:44 | xeqi | cemerick: does piggyback go in :dependencies or :plugins to be used as nrepl middleware? |
| 23:51 | xeqi | has to be :dependencies .. that seems strange |