2014-03-07
| 00:05 | felixflores | in the wiki page http://clojure.org/reader |
| 00:06 | felixflores | it says Keywords are like symbols, except: They cannot contain '.' or name classes. |
| 00:06 | felixflores | is that true? |
| 00:08 | ambrosebs | felixflores: sounds a bit odd, but that's the closest thing we have for a spec atm |
| 00:08 | ambrosebs | felixflores: the current implementation doesn't behave like that |
| 00:08 | ambrosebs | felixflores: of course that doesn't mean much |
| 00:10 | felixflores | how can that be true if even Datomic uses :db.part/user and :db.install/attribute ... |
| 00:14 | ambrosebs | these are all facts |
| 03:12 | hhenkel | Good morning all, I was wondering if there is a good way of "knowing" the current path within a postwalk call? |
| 03:14 | hhenkel | I got some code that reads a configuration and looks for strings of the form ${action.getThis} to look up some value in a map. |
| 03:14 | Null_A | hhenkel: not using postwalk, but you could write your own postwalk with path |
| 03:15 | hhenkel | This works fine so far but now I recognized that there may be times were I need to know in which path I'm currently working. |
| 03:16 | hhenkel | Null_A: okay, writing something new is always an option but I was hoping not to reinvent the wheel. |
| 03:16 | Null_A | hhenkel: if I recall postwalk implementation in only a few lines and build ontop of walk |
| 03:17 | hhenkel | Null_A: okay, I'm looking into it... |
| 03:26 | honza | how can i use a specific ns based on some condition? suppose i have (:require [a :as a] [b :as b])) and based on some condition i want to use functions from a, and then sometimes i want stuff from b; you can assume both a and b have a fn called "greet" |
| 03:27 | honza | the "a" and "b" don't seem to be fully qualified on their own for some reason |
| 03:29 | honza | all i have found was (find-var 'a/greet) |
| 03:34 | BartAdv | damn, I've played with lein-droid, and even though I can't connect my tablet with usb for dev-mode (no drivers), I've just copied the apk and repl into it. such happiness :) |
| 03:40 | muhoo | lein-droid is amazing. much nicer way to do android stuff. |
| 03:40 | muhoo | if you have an app where it's ok for it to take a while to load, and then stay up. |
| 03:44 | BartAdv | yeah, for now I'm jsut playing around, but I would be sad if I had to make some app and the startup time would be a 'no' argument for choosign clojure |
| 03:44 | BartAdv | choosing* |
| 03:45 | BartAdv | note that I'm total androd noob so I don't even know when app needs full startup time and when it's just put in background and restored and all those things |
| 04:25 | CookedGr1phon | Hopefully the startup time issue is getting some love : http://galdolber.tumblr.com/post/78110050703/reduce-startup |
| 04:26 | CookedGr1phon | I'm certainly betting on it, doing a lot in clojure-android at the moment |
| 04:28 | BartAdv | you mean it will eventuall be swallowed by the 'official' clojure? |
| 04:29 | CookedGr1phon | don't know about that |
| 04:30 | CookedGr1phon | might end up being a fork which tracks main clojure but with some tweaks for mobile |
| 04:30 | CookedGr1phon | it would certainly be nicer if it all worked off one main line though |
| 04:30 | CookedGr1phon | just don't know how feasible that is |
| 04:32 | BartAdv | and how do you rate the experience of developing for android? you're doing some commercial stuff? |
| 04:33 | CookedGr1phon | yeah, the experience is so much nicer than normal android/eclipse/spend half your day waiting for adb |
| 04:33 | CookedGr1phon | most of my code is pure and unit tested on my pc |
| 04:33 | CookedGr1phon | there's a thin layer of android specific stuff |
| 04:33 | CookedGr1phon | but even that i just tweak in the repl and don't have to restart all the time |
| 04:33 | CookedGr1phon | there's a few libraries have issues |
| 04:34 | CookedGr1phon | main one i've come across is duplicate classes don't get ignored like on the jvm |
| 04:34 | CookedGr1phon | so you get weird library conflicts |
| 04:34 | CookedGr1phon | but a few excludes usually fix that |
| 04:36 | BartAdv | what editor you use? are you maybe familiar with LightTable connection issues or you just do emacs/cider or something else? |
| 04:36 | CookedGr1phon | I just use emacs/cider |
| 04:36 | CookedGr1phon | never really used anything else |
| 04:37 | CookedGr1phon | the nice thing about cider is that you can C-c M-r to switch between two repl connections, so i can be unit testing something with midje locally with autotest running, then when everything passes rotate repls and eval there, start using it |
| 04:38 | CookedGr1phon | means you don't have to be so worried about exceptions causing AndroidRuntime exceptions and killing your process |
| 04:38 | CookedGr1phon | though I do still wish there was a way to catch those and not reset your process |
| 04:39 | BartAdv | hah true, too damn easy to just end with 'unfortunately, xxx has stopped' |
| 04:41 | sveri | hi, does someone know what happened to the "out of the tar pit" paper on the papers-we-love github repository? |
| 04:42 | CookedGr1phon | does anyone know of a *small* library for escaping/unescaping html entities |
| 04:43 | dsrx | sveri: since it's a git repo... presumably you can look through the history, right? |
| 04:48 | CookedGr1phon | further to my last question, how about one that just works? Pulled in apache commons lang stringescapeutils and it doesn't html encode all my entities |
| 04:48 | sveri | dsrx: thank you, i found it, the repo moved and there the paper was added to a new folder -.- |
| 04:50 | notostraca | CookedGr1phon, ouch. I wonder if there's some predefined mapping you can just plug into clojure.string/escape |
| 05:06 | chare | commute vs alter |
| 05:06 | chare | not getting it |
| 05:10 | szymanowski | hello, is there anybody how knows instaparse a bit? |
| 05:11 | szymanowski | (def foo |
| 05:11 | szymanowski | (insta/parser |
| 05:11 | szymanowski | "S = A B |
| 05:11 | szymanowski | A = 'a'+ |
| 05:11 | szymanowski | B = #'1|2|3|4' ")) |
| 05:11 | szymanowski | (foo "aa") |
| 05:11 | szymanowski | why does it success? B is empty |
| 05:23 | CookedGr1phon | notostraca: don't think so, I want to htmlencode emoji characters. I'm wondering if actually the issue is the html encoding I'm setting, and actually I could just put them in directly if i set that directly |
| 05:23 | notostraca | emoji are UTF-16 or more, right? |
| 05:24 | CookedGr1phon | utf-8 |
| 05:24 | notostraca | I didn't know you could do the ones that weren't in the BMP with UTF-8, but it kinda makes sense |
| 05:25 | CookedGr1phon | bmp? |
| 05:26 | notostraca | basic multilingual plane, the first 2^16 chars I think |
| 05:26 | notostraca | emoji are past that |
| 05:27 | CookedGr1phon | i think it's the other way around, utf-16 is a fixed size codepoint, utf-8 can have longer codepoints |
| 05:27 | CookedGr1phon | to include an arbitrary number of characters afaik |
| 05:27 | chare | clojure is too complicated |
| 05:27 | CookedGr1phon | characters is probably the wrong terminology there, but you get what I mean |
| 05:28 | notostraca | https://en.wikipedia.org/wiki/Emoticons_(Unicode_block) do you mean these emoticons? |
| 05:28 | CookedGr1phon | chare: commute is for something like addition, where order doesn't matter |
| 05:28 | CookedGr1phon | chare: so if you say I have 5, add 3 and add 8, it doesn't matter what order those operations come through |
| 05:29 | chare | I want to know how the underlying stm retry works differently for commute |
| 05:29 | chare | its not clear to me |
| 05:29 | CookedGr1phon | so if something's changed in a ref transaction but it's able to commute, you can just apply it on top of teh new thing |
| 05:29 | CookedGr1phon | but with alter, you have to do the whole transaction again |
| 05:29 | CookedGr1phon | to avoid getting into an inconsistent state |
| 05:31 | CookedGr1phon | but yea, I've been using clojure 2 years now and never felt like I actually needed a ref, I tend to use agents or atoms |
| 05:31 | CookedGr1phon | notostraca: no I mean these ones http://en.wikipedia.org/wiki/Emoji |
| 05:32 | notostraca | CookedGr1phon, the ones I linked are lower in the page |
| 05:32 | CookedGr1phon | ah ok |
| 05:40 | effy | is there a way to get a feeling of how much memory some nested datastructure/object take (i am not familiar with java and unlike C i dont have any intuition of what would take how much) i found this https://gist.github.com/nathell/417669 but it seems to always give me the same size |
| 05:42 | BartAdv | I come from .NET background, but System/gc looks suspicious to me, especially when it's invoked 4 times? |
| 05:42 | BartAdv | isn't there some flag for 'full collection' or something like that? |
| 05:42 | effy | BartAdv: it's not my code i found that on the mailing list |
| 05:43 | BartAdv | doesn't matter, I'm just hinting |
| 05:44 | effy | what i mean is that i think the full approach is kind of sketchy, i'm hopping for someone to have a better idea than calling gc |
| 05:45 | BartAdv | heh, would be quite interested in it too |
| 05:50 | BartAdv | what about just looking in the java world: http://stackoverflow.com/questions/52353/in-java-what-is-the-best-way-to-determine-the-size-of-an-object ? |
| 05:56 | effy | BartAdv: trying to import the instrumentation thing into clojure, but i've no idea what i am doing it might take a while |
| 06:01 | BartAdv | it seems it requires some tinkering with the way jvm is started/some manifest editing, so it might be not that straightforward |
| 06:02 | CookedGr1phon | doesn't visualvm have stuff for tracking memory usage? |
| 06:18 | effy | it's the second time in 3 days i hear about visualvm, i guess it's going to be time to see what it's all about this w-e |
| 06:18 | CookedGr1phon | well attaching a profiling tool and just browsing the interface has got to be easier than adding calls in your code |
| 06:19 | CookedGr1phon | yourkit is meant to be good too, but it's not free |
| 06:21 | effy | CookedGr1phon: in the first place i was hopping for something like a simple command that i could call from the REPL, kind of like (time) but for memory, seems like it's not as easy as i expected |
| 06:31 | clgv | effy: you can get free memory and total memory from the Runtime class. but that only gives a summary on the global state |
| 06:32 | Anderkent | the gist method could work, but I'd do it with 1000 or more instances then take average |
| 06:32 | Anderkent | i don't think you can be much more precise easily |
| 06:33 | Anderkent | if you really need precision then visualvm + oql is the way to go, I suppose |
| 06:37 | BartAdv | but is there a way to really force gc? as far as I know, calling System/gc can effect in nothing being done at all |
| 06:39 | Anderkent | it can, but in practice that will rarely happen |
| 06:43 | effy | Anderkent: i understand why you would like to instantiate a lot and average but i am dealing with large objects so i cannot afford to instantiate a lot, and the thing inside the gist always return 136bytes for me (for la 320 000 elemects matrix which seems improbable) |
| 06:45 | Anderkent | effy: ah, it's not transitive |
| 06:45 | Anderkent | no wait |
| 06:46 | Anderkent | was looking at wrong code :P |
| 06:50 | Anderkent | yeah I guess I was wrong about System/gc being usually reliable for short lived objects |
| 06:51 | Anderkent | effy: I guess your best bet is a profiler after all |
| 08:05 | llasram | ,(meta '^:foo foo) |
| 08:05 | clojurebot | {:foo true} |
| 08:05 | llasram | Why did I never think of that before? |
| 08:08 | clgv | llasram: uuuh. interesting |
| 08:08 | clgv | ,(meta '^:foo ~'foo) |
| 08:08 | clojurebot | {:foo true} |
| 08:08 | clgv | ,(let [bla 'foo] (meta '^:foo ~bla)) |
| 08:08 | clojurebot | {:foo true} |
| 08:10 | edbond | how can I destruct true/false result of group-by? ,(group-by odd? (range 10)) |
| 08:10 | edbond | ,(group-by odd? (range 10)) |
| 08:10 | clojurebot | {false [0 2 4 6 8], true [1 3 5 7 9]} |
| 08:10 | llasram | clgv: Well, those are kind of different |
| 08:10 | llasram | ,'~blah |
| 08:10 | clojurebot | (clojure.core/unquote blah) |
| 08:11 | clgv | llasram: but attach the meta as well |
| 08:12 | chouser | ,(let [{odds true, evens false} (group-by odd? (range 10))] evens) |
| 08:12 | clojurebot | [0 2 4 6 8] |
| 08:12 | llasram | clgv: Yes, but to the `unquote` form |
| 08:12 | llasram | ,(map (juxt identity meta) [^:foo 'foo, '^:foo foo]) |
| 08:12 | clojurebot | ([foo nil] [foo {:foo true}]) |
| 08:12 | llasram | The latter is what I realized you can achieve |
| 08:12 | edbond | chouser, thanks |
| 08:12 | edbond | (inc chouser) |
| 08:12 | lazybot | ⇒ 16 |
| 08:13 | clgv | '^:foo ~'foo |
| 08:13 | clgv | ,'^:foo ~'foo |
| 08:13 | clojurebot | (clojure.core/unquote (quote foo)) |
| 08:14 | chouser | edbond: sure, np. |
| 09:08 | trptcolin | if anybody's used delimc or delimited continuations via shift/reset in any other context, i'd appreciate any ideas on this: https://gist.github.com/trptcolin/8f91cdb2eddb6e7d9adc |
| 09:24 | martinklepsch_ | Raynes, if that's yours, has it been posted somewhere else: https://www.refheap.com/15296 |
| 11:02 | noprompt | are there any clojure source pretty printers? |
| 11:05 | gfredericks | I've never seen one |
| 11:06 | TravisD | noprompt: Not sure if this is what you're looking for, but Pygments supports clojure, and I guess that means you could use it with the minted latex package |
| 11:11 | noprompt | TravisD: that's not exactly what i'm looking for but nice thought. |
| 11:11 | noprompt | i think i might actually have to write something special |
| 11:11 | TravisD | noprompt: :) out of curiosity, what are you looking for? |
| 11:12 | noprompt | TravisD: best i demonstrate w/ an example... one moment. |
| 11:13 | dnolen_ | noprompt: pprint has a source code mode, it works ok |
| 11:14 | dnolen_ | it's what the macroexpander in Emacs uses |
| 11:14 | dnolen_ | Cider I mean |
| 11:23 | noprompt | https://github.com/noprompt/thorn :) |
| 11:23 | noprompt | basically i want to emit clean clojure files: https://gist.github.com/noprompt/9414584 |
| 11:25 | clgv | noprompt: there was one lib mentioned on the ML |
| 11:25 | noprompt | dnolen_: so this can convert css->clj right now. |
| 11:25 | clgv | noprompt: ah right. "fipp" was its name https://github.com/brandonbloom/fipp |
| 11:26 | noprompt | dnolen_: i'm wondering if there are any strategies for when i go to do sass, keeping track of free/bound vars etc. |
| 11:26 | noprompt | automatically generating correct refers if enough information is known. |
| 11:26 | bbloom | clgv: noprompt: how can i help? :-) |
| 11:27 | noprompt | bbloom: see the gist |
| 11:27 | noprompt | bbloom: essentially i just want to clean that up. |
| 11:27 | noprompt | whenever i write a file. |
| 11:27 | bbloom | clgv: noprompt: Fipp only pretty prints edn, not clojure code.... BUT! it's more of a pretty printer construction kit than anything else, you can look at the edn.clj file to see how you could easily make your own pretty printer for the output of your app |
| 11:28 | bbloom | you don't need to change the pretty printer engine, you just need to supply a pretty "document" |
| 11:28 | bbloom | https://github.com/brandonbloom/fipp/blob/master/src/fipp/edn.clj |
| 11:29 | noprompt | thanks brandon |
| 11:29 | noprompt | i'll work this in after i've nailed down the code generation. |
| 11:30 | bbloom | noprompt: let me know if you have any questions. i know a few folks are using fipp but i don't get much feedback, so i can only assume it works perfectly :-) |
| 11:30 | noprompt | it's pretty amazing how fast i was able to get to a point where i could generate code once the sass parse tree was converted to pure data. |
| 11:30 | bbloom | noprompt: you could also use fipp to pretty print the generated css as a backend from garden |
| 11:30 | bbloom | i assume garden does just indenting now, right? |
| 11:31 | noprompt | bbloom: basically, but it's horrible. |
| 11:31 | noprompt | bbloom: it gets a few things wrong. |
| 11:31 | bbloom | if you have an AST of the CSS code, you can easily translate that to an "AST" of Fipp's pretty print document format |
| 11:31 | noprompt | that's also because i didn't completely know what i was doing. |
| 11:32 | noprompt | sweet! that's awesome. |
| 11:32 | bbloom | that'll give you proper indenting, line breaking, and right-margin awareness |
| 11:32 | bbloom | there's even column alignment |
| 11:32 | gfredericks | ,(def foo #'foo) |
| 11:32 | clojurebot | #'sandbox/foo |
| 11:32 | clgv | ,foo |
| 11:32 | clojurebot | #'sandbox/foo |
| 11:33 | clgv | :O ;) |
| 11:34 | noprompt | the idea of thorn is pretty trippy. |
| 11:34 | noprompt | the cool thing is, the sass parse tree can be converted to anything. |
| 11:35 | bbloom | yeah, sass is pretty well engineered |
| 11:35 | bbloom | iirc it's got a proper AST for each of the various transformation levels |
| 11:35 | noprompt | all i had to do was write a new visitor and emit data instead of code. |
| 11:35 | bbloom | and the CSS AST is (was?) a strict subset of the scss and sass trees |
| 11:35 | bbloom | yeah, beautiful :-) |
| 11:36 | bbloom | fipp operates on a very compiler-ish functional model of pretty printing |
| 11:36 | bbloom | the "printer" is a machine that is just an interpreter for a little language |
| 11:36 | bbloom | that little language represents a pretty printed document |
| 11:36 | bbloom | so you just slap a pass on to your compiler pipeline |
| 11:37 | noprompt | gah! i'm so excited about this. |
| 11:38 | bbloom | also, fipp is designed to be memory efficient, so it accepts lazy seqs in the input documents, so you don't actually need to do all the work of realizing the entire AST in memory at once. just the spine of the AST that is currently being printed |
| 11:40 | bbloom | noprompt: if you want to use Fipp as a backend for "production" use, it *should* be fast enough, but if it isn't, you can probably swap out a different interpreter that doesn't do any of the actual pretty part of the pretty printing |
| 11:40 | bbloom | but if *that* is too slow, you have to just swap it out in your pipeline with an alternative backend |
| 11:42 | noprompt | bbloom: i'm sure it will be fast enough. the purpose of thorn is simply to generate proper clojure code from sass/css (maybe less later). |
| 11:42 | noprompt | someone can then clean it up, etc. so i doesn't have to be ultra fast. just correct. |
| 11:43 | bbloom | noprompt: ah, by "production" use i meant if you wanted it in the Garden backend |
| 11:43 | bbloom | for a run-once tool, i agree: who gives a shit if it's slow |
| 11:43 | bbloom | but for your app builds, it needs to be fast |
| 11:44 | noprompt | bbloom: oh, oh, yeah. well i definitely want to plug that in. will it work w/ cljs? |
| 11:44 | noprompt | it's not terribly important if it doesn't. |
| 11:45 | bbloom | noprompt: https://github.com/brandonbloom/fipp/pull/12 |
| 11:47 | noprompt | sweet |
| 11:56 | gfredericks | apparently throwing a function called `repl` into clojure.core doesn't go very well |
| 12:00 | gtrak | throwing anything into clojure.core probably won't go very well. |
| 12:01 | gtrak | just add a UUID suffix and let autocomplete do the work :-) |
| 12:07 | mzdravkov | I need some web framework for clojure, but there are like hundred of them. Can you point me to a framework, that is being actively maintened. Something simple, similar to Sinatra, would be perfect. |
| 12:07 | gtrak | mzdravkov: compojure is the sinatra analogue. |
| 12:07 | gtrak | the popular one |
| 12:09 | mzdravkov | gtrak: thanks |
| 12:30 | gfredericks | trying to change a var's metadata before its initial value finishes evaluating might be a bad idea |
| 12:35 | jcromartie | gfredericks: what kind of horrible things are you doing? |
| 12:38 | gfredericks | jcromartie: https://github.com/fredericksgary/repl-utils/blob/master/src/com/gfredericks/repl.clj#L50 |
| 12:40 | jcromartie | interesting |
| 12:40 | jcromartie | so it returns a symbol for a var, so that you don't have to worry about hanging on to a future or whatever |
| 12:41 | jcromartie | that's rather handy in the REPL |
| 12:42 | gfredericks | exactly |
| 12:42 | gfredericks | and if I'm using cider with C-u C-x C-e, the symbol for the job is printed right after the expression |
| 12:42 | gfredericks | I did it with a future initiall and then realized dereffing was too much trouble |
| 12:42 | gfredericks | life is too short to deref |
| 12:42 | koreth_ | I like Enlive's conceptual model, but man, is it a pain to debug. So much indirection I'm never sure what's going to call what when, and the stack traces are next to useless. No question, just wanted to vent. |
| 12:43 | gfredericks | clojurebot: enlive is a pain to debug |
| 12:43 | clojurebot | Alles klar |
| 12:44 | gfredericks | does anybody know why C-u C-x C-e doesn't print *out* to the repl buffer? |
| 12:44 | gfredericks | I can imagine it being intentional but it's pretty much never what I want (since I can't see *out* otherwise) |
| 13:02 | ptcek_ | Do I need to use rufoa/named-re or I can get named regexp groups when running on java 1.7 (but how...)? |
| 13:03 | mikerod | I originally thought that syntax-quote was at "read-time". However, I'm confused now because it is able to qualify symbols against the current environment. This sounds more like "compile-time" to me. What am I missing? |
| 13:05 | bbloom | mikerod: read-time and compile-time are interleaved |
| 13:06 | bbloom | mikerod: if you have two forms at the top level of a file, the first form is compiled before the second form is read |
| 13:06 | mikerod | bbloom: That confuses me because I can use the LispReader to read an input stream |
| 13:07 | bbloom | mikerod: they don't HAVE TO BE interleaved, they just are for the top level of a clojure file |
| 13:07 | mikerod | bbloom: so I was looking at it from the perspective of "nothing is compiled" |
| 13:07 | bbloom | mikerod: from that perspective, syntax-quote is broken |
| 13:07 | mikerod | bbloom: so if the reader finds syntax-quote like, `a in a stream and 'a doesn't belong anywhere, what happens? |
| 13:07 | bbloom | ,`a |
| 13:07 | clojurebot | sandbox/a |
| 13:08 | bbloom | mikerod: https://github.com/brandonbloom/backtick |
| 13:08 | bbloom | mikerod: syntax quote doesn't need to be part of the reader, nor does syntax quote need to use the "current" compiler environment |
| 13:09 | bbloom | mikerod: those are both implementation details of clojure |
| 13:09 | mikerod | ah, I have stumbled on this before and didn't go though it. I will take a look through what you have here. |
| 13:09 | bbloom | mikerod: from one perspective, it's a "bug" from another perspective, it's an "optimization" |
| 13:09 | mikerod | bbloom: yep, I also noticed that Clojure syntax quote is looking at symbols from the "current" ns perspective |
| 13:10 | mikerod | I understand that in a typical use-case for it in a macro returning code, it would make sense to work like it does |
| 13:11 | mikerod | bbloom: thanks for the link, I'll go through this. definitely looks interesting. |
| 13:16 | rufoa | <ptcek_> Do I need to use rufoa/named-re or I can get named regexp groups when running on java 1.7 (but how...)? << i made named-re because there wasn't (isn't?) a way to do it in clojure itself even on j1.7 |
| 13:16 | rufoa | it's a bit of a hack though |
| 13:16 | Raynes | People are still writing more task scheduling libraries in Clojure? o.o |
| 13:17 | ptcek_ | rufoa: response from author :) Thanks for making it clear that it does not work... |
| 13:17 | Raynes | Can it really be possible that out of the 400 existing libraries for it, there are still use cases not catered to? |
| 13:17 | Raynes | :p |
| 13:19 | TravisD | Raynes: afaik, there's quite a lot of active research on scheduling. Some of the new libraries maybe implement fancy new algorithms :P |
| 13:19 | Raynes | TravisD: But they don't :P |
| 13:21 | mindbender1 | Raynes: Prove it! |
| 13:25 | Raynes | mindbender1: I mean, I can't really prove that none of them (I may be missing some) implement exciting new algorithms. That said, it doesn't really *bother* me that all these libs exist. it's fantastic, even. Options are cool. I mean, I also wrote one. |
| 13:29 | TravisD | Raynes: My guess is that there are so many libraries because people write them as a learning experience |
| 13:29 | TravisD | and maybe a few of them are made by active researchers :) |
| 13:29 | Raynes | TravisD: Indeed. I just never realized that scheduling libraries were one of those projects people used for that. |
| 13:29 | TravisD | Ah, yeah, it's an interesting observation |
| 13:30 | Raynes | TravisD: When learning new languages I generally write an API client library and CLI tool for refheap. |
| 13:30 | Raynes | I like that particular project because it's trivial and still requires digging into how you do crucial things in a given language. |
| 13:31 | TravisD | heh, sounds cool. I don't learn new languages often enough to have go-to starter projects |
| 13:31 | TravisD | :( |
| 13:31 | TravisD | Whenever I try a new language, though, invariably I try to implement my experiments in it. Sometimes with a lot of frustration, lol |
| 13:32 | sdegutis | I just barely missed the Haskell debates in here a few days ago... what were the main pros/cons for Haskell? |
| 13:35 | technomancy | pros: your code is always correct. cons: you have to listen to people talk about monads all day. |
| 13:35 | technomancy | it's a trade-off |
| 13:36 | koalallama | a+ summary |
| 13:38 | TravisD | Did any of the #haskell guys chime in? |
| 13:43 | justin_smith | technomancy: don't forget the curse of the monad - if you figure them out you need to make a tutorial blog post within 7 days or you die. |
| 13:43 | justin_smith | it's like the category theory version of The Ring |
| 13:43 | technomancy | hehehe |
| 13:43 | TravisD | lol |
| 13:46 | dacc | haha |
| 13:48 | sdegutis | heh heh heh heh |
| 13:50 | koalallama | or at least tweet about a burrito |
| 13:51 | sdegutis | technomancy: I have a hard time imagining how Haskell code can be any safer than equivalent C# code. |
| 13:51 | sdegutis | (Picked a random type-safe language as example.) |
| 13:51 | justin_smith | the burrito loophole is your ethical way out - it fulfills the requirements of the curse, but will not lead to anyone else's monad nirvana and thus does not spread the curse |
| 13:52 | technomancy | sdegutis: it's true; haskell is so good that it defies imagination |
| 13:53 | sdegutis | heh, "WTF is a Monad? w/ Uncle Bob Martin -- Watch Uncle Bob use Clojure to stumble around this hideously complex topic and eventually give up and fail." -- http://www.meetup.com/Software-Craftsmanship-McHenry-County/events/144270572/ |
| 13:54 | sdegutis | That would have been fun to attend. |
| 13:54 | justin_smith | sdegutis: in all seriousness, haskell has more nuance in dealing with types - you can have something that is "not yet typed" or a member of a typeclass with a nuance and flexibility most static languages can't match |
| 13:54 | justin_smith | (as random examples and not the pinnacle) |
| 13:55 | TravisD | Yeah, I love watching failure :) |
| 13:56 | technomancy | anyway doesn't C# have null unioned with every type? that kind of disqualifies its type system from being taken seriously. |
| 13:56 | justin_smith | shrug oriented programming via the universal implicit maybe |
| 13:57 | technomancy | sounds like a conference talk title |
| 13:57 | TravisD | Hmm, isn't bottom a member of every type in Haskell? |
| 13:57 | technomancy | one of the speakers here said that he's being trolled by conference organizers who conspire to append "... an unexpected journey" to every talk he submits |
| 13:58 | technomancy | "Shrug-oriented Programming via the Universal Implicit Maybe: an Unexpected Journey" |
| 13:58 | sdegutis | technomancy: only if you add a ? mark at the end of the type |
| 13:58 | sdegutis | technomancy: bool can only be true/false, but bool? can be true/false/null |
| 13:58 | sdegutis | :D |
| 13:58 | justin_smith | TravisD: bottom is less like null and more like an Exception I think |
| 13:58 | justin_smith | (I could be wrong on that) |
| 13:58 | technomancy | sdegutis: huh; TIL. that's a hell of a lot better than java. |
| 13:59 | technomancy | Raynes: does elixir support identifiers with question marks and exclamation points? |
| 13:59 | TravisD | justin_smith: Heh, yeah, I guess they're not really the same. But it's a similar ugliness :P |
| 13:59 | Raynes | technomancy: Does Erlang? |
| 13:59 | technomancy | Raynes: no, erlang is super dumb about that |
| 13:59 | justin_smith | TravisD: well, if you are turing complete, you either have an error state implicitly or explicitly |
| 13:59 | sdegutis | technomancy: "that is lame"? |
| 13:59 | TravisD | true :) |
| 13:59 | technomancy | I wondered if they bothered fixing that in elixir |
| 14:00 | technomancy | sdegutis: faint praise, I know |
| 14:00 | TravisD | justin_smith: I don't know much about it, but I guess you can do quite a lot of interesting things without being turing complete |
| 14:00 | sdegutis | technomancy: did i guess TIL right? |
| 14:00 | clojurebot | Excuse me? |
| 14:00 | technomancy | sdegutis: oh |
| 14:00 | technomancy | no |
| 14:00 | technomancy | clojureTIL? |
| 14:00 | technomancy | dang it |
| 14:00 | justin_smith | TravisD: but not much programming? dunno |
| 14:00 | technomancy | clojurebot: TIL? |
| 14:00 | clojurebot | excusez-moi |
| 14:00 | technomancy | clojurebot: TIL is today I learned |
| 14:00 | clojurebot | Roger. |
| 14:00 | sdegutis | ahhh |
| 14:00 | technomancy | sdegutis: ^ |
| 14:01 | sdegutis | also, does Java just allow any tpye to be null? |
| 14:01 | technomancy | sdegutis: unless it's a primitive |
| 14:02 | technomancy | it's pretty terrible |
| 14:02 | sdegutis | So, regards to language design, I just replaced (keyword (format "quality-%s" quality)) with (get {"high" :quality-high, "low" :quality-low} quality) in our code... |
| 14:02 | gfredericks | technomancy: it could be worse |
| 14:02 | sdegutis | Am I.. am I doing dynamic programming wrong? |
| 14:02 | gfredericks | technomancy: we could have a boxed java.lang.Null |
| 14:02 | TravisD | justin_smith: I think languages like Coq and Agda are not turing complete, yet they are still useful programming langauges |
| 14:03 | technomancy | gfredericks: Null/valueof |
| 14:03 | gfredericks | technomancy: Null#equals always returns false |
| 14:04 | TimMc | sdegutis: Congratulations, your code is now more greppable. |
| 14:04 | sdegutis | TimMc: yea, that's one of the main benefits of avoiding the (keyword ...) style |
| 14:05 | stuartsierra | dnolen_: A while ago you asked for a G.Closure release, but there aren't any newer releases on https://code.google.com/p/closure-library/downloads/list . Did you want to go straight to the Git source? |
| 14:05 | sdegutis | Not only more greppable, but more grokkable, and especially easier to refactor using automated tools |
| 14:05 | dnolen_ | stuartsierra: yeah I noticed they stopped doing them :P |
| 14:05 | sdegutis | (Also there's a single `letfn` in our code, and it's about to go away.) |
| 14:05 | dnolen_ | stuartsierra: straight from Git source sounds fine. |
| 14:06 | stuartsierra | dnolen_: Much harder to pick a release point then. |
| 14:06 | dnolen_ | stuartsierra: do you have another solution in mind? |
| 14:06 | stuartsierra | dnolen_: No. :( |
| 14:07 | stuartsierra | Just wondering how best to go about versioning. |
| 14:08 | stuartsierra | Git SHAs don't sort. |
| 14:08 | stuartsierra | Maven-ish things expect version numbers to go up. |
| 14:08 | dnolen_ | stuartsierra: well ClojureScript version is just the commit number |
| 14:09 | stuartsierra | Bleh. Don't remind me. |
| 14:09 | TravisD | Can anyone recommend a visually appealing dark emacs theme? Sorry for being grossly off topic |
| 14:09 | dnolen_ | stuartsierra: I think you wrote that script :) |
| 14:09 | stuartsierra | dnolen_: Just following orders, judge. |
| 14:10 | `cbp | TravisD: I use zenburn |
| 14:10 | TravisD | `cbp: I'll check it out, thanks :) |
| 14:10 | stuartsierra | dnolen_: Well, the last release of G.Closure was 0.0-<DATE>-<SHA> so I guess we can stick with that. |
| 14:10 | technomancy | TravisD: zenburn and monokai are my favourites |
| 14:11 | stuartsierra | Re themes, I like Twilight. |
| 14:11 | TravisD | Yeah, I used monokai for a while! Is there a package for zenburn? |
| 14:11 | sdegutis | TravisD: I like this one: |
| 14:11 | `cbp | TravisD: yes there is on melpa |
| 14:11 | `cbp | TravisD: works great with clojure |
| 14:11 | TravisD | Just found it :) There seemed to be a few alternative packages, but I installed zenburn-theme |
| 14:11 | `cbp | TravisD: solarized/dark is also nice |
| 14:11 | dnolen_ | TravisD: I like tomorrow-night |
| 14:11 | sdegutis | TravisD: https://gist.github.com/sdegutis/9417820 |
| 14:12 | sdegutis | It's a fork of naquadah.el on Melpa, but nicer on the eyes in a few but important ways. |
| 14:13 | TravisD | hehe, thanks for all the suggestions! To summarize, they are zenburn, monokai, twilight, solarized, tomorrow-night, and sdegutis' modified version of naquadah.el |
| 14:13 | sdegutis | (Actually I was the one who put naquadah-theme.el on Melpa, but it was my fork, not the original, and eventually the author of naquadah-theme.el wanted his on there instead so mine got removed. So this gist is the only version of it now.) |
| 14:13 | amalloy | technomancy: i love that presentation title. plz to submit to a real conference |
| 14:14 | sdegutis | Wishing my nicks were colored in this IRC client right about now... |
| 14:14 | sdegutis | Or that stuartsierra's nick wasn't so close to technomancy's in length... |
| 14:15 | TravisD | I really miss my coloured nicks :( Now everyone is just a gray smudge of the same |
| 14:15 | sdegutis | I should write an IRC client that's programmable in ClojureScript. |
| 14:15 | sdegutis | Then I'd be able to easily add colored nicks. |
| 14:15 | `cbp | an irc client for light table :) |
| 14:17 | amalloy | TravisD: did someone steal your irc client? or make you colorblind? |
| 14:18 | TravisD | amalloy: No, I use colloquy which supports different themes. I really like one theme for how it formats messages, but I used to use another theme which had coloured nicks. I can probably splice the two together somehow, but I didn't want to bother |
| 14:18 | TravisD | maybe I will do that this afternoon... |
| 14:18 | sdegutis | TravisD: try out LimeChat |
| 14:19 | sdegutis | its simpler yet more powerful than colloquy |
| 14:19 | TravisD | sdegutis: Ah, cool, I'll check it out. I was under the impression that colloquy was the de-facto standard mac IRC client |
| 14:19 | sdegutis | it was once written almost entirely in MacRuby. then the author at one point must have realized thats a terrible idea, so he rewrote it all in objC |
| 14:20 | sdegutis | TravisD: among mac-fanboys yes, since its so shiny. |
| 14:20 | TravisD | I like shiny things :) |
| 14:20 | TravisD | It's been crashing a lot lately, though. |
| 14:20 | bbloom | I use Textual, seems to work fine |
| 14:20 | sdegutis | TravisD: shiny things are indeed nice when they work |
| 14:21 | TravisD | bbloom: but it's not free! :( |
| 14:21 | `cbp | the only free irc client is obviously erc |
| 14:22 | TravisD_ | Oh man, this limechat business is weird |
| 14:22 | bbloom | TravisD: it's 5 bucks and there is a demo |
| 14:22 | bbloom | TravisD: if you like it, spend the 5 bucks |
| 14:22 | sdegutis | plus im pretty sure LimeChat (free & open source) beats the heck out of Textual in terms of features |
| 14:22 | sdegutis | (and simplicity) |
| 14:22 | Jahkeup | +1 for LimeChat |
| 14:22 | sdegutis | i wonder if textual is a sig source of income for them |
| 14:23 | sdegutis | there's also http://conceited.net/products/linkinus |
| 14:24 | TravisD_ | I might give limechat a try. Are there more themes than it comes with by default? |
| 14:24 | sdegutis | yeah |
| 14:25 | TravisD_ | Can I get it to confirm my nick automatically? |
| 14:25 | TravisD_ | one sec. |
| 14:25 | sdegutis | yea |
| 14:25 | technomancy | erc's nick highlighting normalizes for trailing punctuation <3 |
| 14:25 | technomancy | (thanks to leathekd) |
| 14:26 | benmoss | limechat is weirdd |
| 14:28 | TravisD | Anyways, sorry for the off-topic nonsense. Is there a place to discuss this sort of thing that's not the main channel, like #not-clojure? |
| 14:28 | justin_smith | #clojure-social? |
| 14:29 | sdegutis | Yeah #clojure-social |
| 14:30 | TravisD | great, thanks :) |
| 14:43 | borkdude | I just had a conversation with Erik Meijer. He bashed Clojure today in favor of Scala :P |
| 14:43 | borkdude | just jokingly though |
| 14:44 | bbloom | borkdude: on what grounds? |
| 14:45 | borkdude | bbloom it wasn't really serious, but he's more in favor of a type system that helps him so he can program without thinking ;) |
| 14:46 | borkdude | he presented something about his Rx implementation |
| 14:48 | bbloom | borkdude: *shrug* i like some of his work, but i don't have positive things to say about either programming without thinking or Rx :-P |
| 14:51 | sdegutis | borkdude: i do enjoy typesystems that are integrated nicely into an IDE, they help tremendously in my productivity |
| 14:51 | sdegutis | although that may be more of a statement about how unproductive i am on my own? |
| 14:51 | borkdude | he spoke about covariants and contravariants of getters and setters |
| 14:51 | borkdude | :-S |
| 14:51 | sdegutis | oh. |
| 14:52 | koalallama | sdegutis: I feel the same way. |
| 14:53 | bbloom | accessors: a bad idea to solve problems caused by other bad ideas |
| 14:53 | justin_smith | (inc bbloom) |
| 14:53 | lazybot | ⇒ 30 |
| 14:53 | borkdude | I asked him, don't you think creating a class for each kind of data is anti code reuse? |
| 14:54 | sdegutis | (dinc bbloom) |
| 14:54 | borkdude | He mentioned something about traits in Scala, but I don't know Scala enough to judge if that takes away this pain |
| 14:55 | bbloom | borkdude: traits are a slightly less theoretically problematic version of mixins, which are wildly problematic in both theory and practice |
| 14:55 | borkdude | or extension methods |
| 14:55 | bbloom | extension methods are a syntax convenience, essentially |
| 14:55 | borkdude | I know them from C# |
| 14:55 | bbloom | so extension methods actually do add a little bit of actual expressivity |
| 14:55 | bbloom | b/c they are dispatched by type, so in that sense they can be seen as a form of return type polymorphism |
| 14:56 | bbloom | but most of the time, that little subtly of the spec is ignored |
| 14:56 | bbloom | and ppl just use them as free functions with . notation convenience |
| 14:56 | borkdude | right |
| 14:56 | bbloom | the static polymorphism aspect is totally lost on most people |
| 14:57 | bbloom | interestingly, people had asked the C# folks for extension methods for a while but the design team was like "fuck that".... until they needed the static polymorphism for Linq |
| 14:58 | bbloom | ppl just wanted the syntax tho |
| 14:58 | whilo | i am trying to debug my core.async channels, which proves difficult and confuses me by undetermined behaviour. |
| 14:59 | whilo | i have tried to build a wrapper to log values on channels: https://gist.github.com/ghubber/9418732 |
| 14:59 | whilo | but it doesn't work, only some values get through |
| 15:00 | sdegutis | bbloom: it does rock tho |
| 15:00 | whilo | any ideas or tipps of how to properly track connections and values in complex system? |
| 15:00 | bbloom | sdegutis: linq? yeah linq is super cool |
| 15:01 | sdegutis | bbloom: i meant ext methods but yeah linq too |
| 15:01 | sdegutis | as close to clojure.core as a static lang can polly get? |
| 15:01 | bbloom | sdegutis: you can just do what rich does: make a class called something small like RT and just load it up with static functions |
| 15:02 | sdegutis | thx |
| 15:02 | bbloom | i did a java project that was like 5k lines of code, and only 3 classes. one of them was just a giant static function bag. some java guru reviewing it was like "what the fuck is this!??!" but meanwhile it was dramatically faster than what he had, so he was like "*shrug* ok i guess" |
| 15:03 | dnolen_ | whilo: that's not going to work how you expect if someone else gets a reference to c. |
| 15:03 | dnolen_ | whilo: c needs to already be mult'ed |
| 15:05 | whilo | dnolen_: if i create the channel and mult it first before i return it, it should work? |
| 15:05 | bbloom | sdegutis: actually, i'm cheating a bit. there were also google protobufs, which i used like i use clojure maps... so i guess there may have been 50+ actual "classes" at runtime |
| 15:05 | dnolen_ | whilo: yes |
| 15:05 | whilo | dnolen_: thx! |
| 15:06 | abp | bbloom: Oh wow, i did an android project with mostly static functions, arrays and hashmaps at time. the guy who took it over immediatly started refactoring into tons of classes. because you don't use static. |
| 15:06 | whilo | dnolen_: are there debugging concept like auto-generated network-diagrams where you can follow values in general (e.g. erlang) or how do people debug channels? |
| 15:06 | bbloom | abp: and i'm sure his program is now slower, more code, and harder to debug |
| 15:07 | sdegutis | abp: did you have static variables for persistent state? |
| 15:07 | bbloom | yeah, static variables are the problem, not static functions |
| 15:07 | borkdude | state? |
| 15:07 | clojurebot | you're doing it wrong! |
| 15:07 | bbloom | although your static functions need to be pure |
| 15:07 | abp | sdegutis: nope, static methods for mostly querying, data transformation etc. |
| 15:08 | dnolen_ | whilo: no debugging tools visual or otherwise that I'm aware of, would be useful. |
| 15:09 | abp | bbloom: don't know if it got slower but more code for sure |
| 15:09 | whilo | dnolen_: ok, thx |
| 15:09 | gtrak | bbloom: just blame your old C tendencies instead of your new lispy ones |
| 15:09 | bbloom | abp: at minimum, it used a fuckton more memory :-P |
| 15:09 | abp | bbloom: yeah, just what androids gc likes ;) |
| 15:21 | jonasen | stuartsierra: dnolen_: a new version of GClosure Compiler was released a week ago: https://groups.google.com/d/msg/closure-compiler-discuss/f1lee2eThlg/HPZvnoWh1ncJ |
| 15:21 | dnolen_ | jonasen: we were actually talking about the Closure Library |
| 15:22 | jonasen | dnolen_: oh, sorry |
| 15:23 | stuartsierra | jonasen, dnolen_: Google used to release JARs to Maven Central for closure-compiler. Last one was 2013-10-14 |
| 15:23 | jonasen | stuartsierra: this has been discussed on the closure-compiler mailing list |
| 15:24 | stuartsierra | And? |
| 15:24 | jonasen | stuartsierra: let me see if I can find it |
| 15:24 | stuartsierra | 10 cents says Google doesn't care. |
| 15:27 | jonasen | stuartsierra: https://groups.google.com/d/msg/closure-compiler-discuss/G9y8oUGnZ58/_-UM3lhMPwgJ |
| 15:28 | jonasen | stuartsierra: and one from january https://groups.google.com/d/msg/closure-compiler-discuss/NXokuM4gpws/1SuKqVmGPKIJ |
| 15:30 | stuartsierra | Summary: the one guy who used to do it got busy |
| 15:30 | stuartsierra | with other things. |
| 15:30 | stuartsierra | So that's going to become ANOTHER dependency we have to package. |
| 15:30 | stuartsierra | FML |
| 15:32 | stcredzero | Best practices for logging exceptions? |
| 15:35 | stuartsierra | Some folks want to test these G.Closure lib releases out for me? |
| 15:36 | stcredzero | Anyone want to stress-test the beginnings of a Clojure MMO? http://casterly.publicvm.com |
| 15:36 | stuartsierra | I'll have repo URLs in a minute |
| 15:41 | stuartsierra | New G.Closure library release available for testing https://gist.github.com/stuartsierra/9419597 |
| 15:41 | stuartsierra | Please validate. |
| 15:42 | stcredzero | So who else is in http://casterly.publicvm.com ? |
| 15:42 | jcromartie | I have been in there three times |
| 15:42 | jcromartie | in no |
| 15:42 | jcromartie | now |
| 15:42 | dnolen_ | stuartsierra: does the new release include third party now? |
| 15:43 | stuartsierra | dnolen_: no, it's a dependency as before |
| 15:43 | stcredzero | Well, no crashes yet (MMO) |
| 15:43 | dnolen_ | stuartsierra: in your gist you're not including it? |
| 15:43 | stuartsierra | dnolen_: It's a dependency. |
| 15:43 | stuartsierra | i.e. automatic |
| 15:43 | dnolen_ | stuartsierra: but of what? |
| 15:44 | stuartsierra | third-party is a dependency of closure-library |
| 15:44 | dnolen_ | stuartsierra: k |
| 15:44 | stuartsierra | Which reflects the relationships in the JavaScript source. |
| 15:44 | dnolen_ | stuartsierra: didn't realize that, thought it would be the other way around |
| 15:45 | stuartsierra | Yes, one would expect that. |
| 15:46 | stuartsierra | http://dev.clojure.org/jira/browse/CLJS-418 if you want the ugly truth |
| 15:46 | dnolen_ | stuartsierra: thanks for putting this together, trying it out now |
| 15:47 | stuartsierra | The real reason for the separation is different licenses. But it's virtually impossible to use gclosure-library without -third-party. |
| 15:51 | whilo | dnolen_: this also works only partially, not sure why, values are put on the channels with pub-sub fns. https://gist.github.com/ghubber/9418732 |
| 15:55 | dnolen_ | whilo: you're returning the non-mult'ed original channel |
| 15:56 | whilo | dnolen_: if i return a mult'ed channel, will pushes to it propagate? the mult concept is not totally clear to me, also not through core.async source |
| 15:57 | dnolen_ | whilo: this just doesn't seem like the right way to do this. debug-chan should take a mult'ed channel, don't bother trying to encapsulate that part at all. |
| 15:57 | whilo | ok |
| 15:58 | dnolen_ | whilo: if you want to debug you need to construct a mult'ed channel and everyone else that wants to read from it needs to tap it. |
| 15:59 | `cbp | :-D |
| 15:59 | whilo | dnolen_: ok, this makes debugging non-transparent, i hoped i could have something like a logged channel, which otherwise behaves like a normal channel, so you can deactivate in production |
| 15:59 | dnolen_ | whilo: which basically means debug-chan really isn't going to be all that useful. |
| 16:00 | whilo | right |
| 16:05 | hiredman | wouldn't debug-chan take a channel and return a channel, when debugging it takes a channel and returns a new channel, spinning up a go block to copy values from the channel passed in to the channel returned, printing in between or something, and in production it is just identity? |
| 16:05 | dnolen_ | stuartsierra: k, tested a Om+core.async program still works and I get access goog.async.nextTick which is new |
| 16:06 | dnolen_ | stuartsierra: sanity checking the REPL now |
| 16:06 | TravisD | If I want to make a pair of two values, what clojure structure has the least overhead? |
| 16:07 | stuartsierra | dnolen_: Great. If you happen to know something that depends on third-party and can check it, that would be helpful too. |
| 16:07 | dnolen_ | TravisD: vector is pretty darn fast |
| 16:07 | dnolen_ | stuartsierra: browser REPL does, checking it now |
| 16:07 | whilo | hiredman: that was my idea |
| 16:07 | stuartsierra | cool |
| 16:10 | hiredman | whilo: I see, so what is this mutl and tap stuff about then? |
| 16:11 | whilo | hiredman: you need mult to create copies of a channel. then you give the mult to tap to copy all values from the mult to a target channel |
| 16:12 | hiredman | whilo: you don't need any of that |
| 16:12 | hiredman | whilo: you need two channels a go "thread" |
| 16:18 | whilo | hiredman: i have no idea how to write into that thing transparently, here is the code i am currently working on: https://github.com/ghubber/geschichte/blob/master/src/clj/geschichte/sync.clj#L148 |
| 16:19 | hiredman | (loop [] (>! chan2 (doto (<! chan1) prn)) (recur)) |
| 16:20 | hiredman | simplest possible one way copy |
| 16:22 | dnolen_ | stuartsierra: browser REPL appears to still work with latest Closure deps (there are some warnings, but these are unrelated analyzer issues far as I can tell). |
| 16:23 | TravisD | Is there a protocol that one can implement to make a type seqable? |
| 16:23 | stuartsierra | dnolen_: OK, thanks. I could just release this as-is, or post to the mailing list and ask for more testers. Any preference? |
| 16:23 | llasram | TravisD: clojure.lang.Seqable (JVM)? |
| 16:23 | llasram | Oh, protocol |
| 16:23 | stuartsierra | This is a new release build script, so I'm slightly more cautious. |
| 16:24 | llasram | TravisD: No -- interface on the JVM alas |
| 16:24 | dnolen_ | stuartsierra: I would post to ML. |
| 16:24 | stuartsierra | dnolen_: OK, sounds good. |
| 16:24 | TravisD | llasram: Ah, okay, thanks :) |
| 16:29 | whilo | hiredman: i am not worried about a simple copy, i want a transparent copy. your code touches the original channel and unblocks it. can you give me a channel which logs its values, but otherwise behaves like a single (chan)? with two channels it is no big problem |
| 16:29 | whilo | (i mean exposing two channels, but i basically want to monitor a channel) |
| 16:30 | whilo | maybe i miss something obvious, not sure |
| 16:31 | hiredman | whilo: if you want it to be transparent I think you'll have to implement the channel protocols, depending on when you want the logging to happen, on publish, on recieve, etc you can reify the channel protocols log, and then dispatch to a real channel under the hood |
| 16:32 | whilo | ok, not sure what is the best way to debug stuff like that. first i wanted to have a simple switch to monitor single channels, that's all |
| 16:32 | whilo | i also had a look at the source to reimplement a log-channel. |
| 16:33 | whilo | it is just that i shoot myself with dynamically creating and wiring channels atm. and am stuck, so i need a better idea of what is going on |
| 16:33 | malyn | whilo: Would mult and tap work? http://clojure.github.io/core.async/#clojure.core.async/tap |
| 16:34 | whilo | malyn: i tried to https://gist.github.com/ghubber/9418732 but i don't know how this could work out |
| 16:36 | whilo | malyn: also it doesn't work XD |
| 16:36 | sdegutis | The state of Clojure IDEs is becoming increasingly fragmented, especially with the arrival of NightCode, LightTable, and Cursive Clojure. |
| 16:37 | jcromartie | I don't mind, since the IDE choice rarely impacts anybody outside of an individual developer's decision. |
| 16:37 | jcromartie | so long as there's a project.clj, I can use anything I want |
| 16:37 | jcromartie | and so can you |
| 16:38 | dnolen_ | whilo: if you want it to be transparent, implementing the channel protocols is the only way to make it work |
| 16:38 | malyn | whilo: Details, details... :) I wonder if you have to return a tap instead of the original channel? I haven't used mult/tap yet. |
| 16:38 | sdegutis | True, but the fragmentation means those brilliant minds are not working together, but if they were, they could probably make something 3 times as good. |
| 16:38 | dnolen_ | whilo: as hiredman said |
| 16:39 | aconbere | anyone use nippy here? |
| 16:39 | aconbere | I'm seeing a weird issue in a long running process |
| 16:39 | aconbere | where after maybe 24 hours it wont thaw any data |
| 16:39 | aconbere | restarting the process magically fixes the issue |
| 16:40 | technomancy | sdegutis: try my product http://p.hagelb.org/clojurewest-2014.org.html |
| 16:41 | TravisD | Is there a rationale behind why clojure does not have a zip function (defn zip-with [f as bs] (map f as bs)) (defn zip [as bs] (zip-with vector as bs))? I miss these functions from Haskell, and I think they are clearer than the map alternatives |
| 16:42 | sdegutis | TravisD: it's built into map |
| 16:42 | hiredman | TravisD: map can take multiple seqs |
| 16:42 | sdegutis | TravisD: ##(map + [1 2 3] [4 5 6]) |
| 16:42 | lazybot | ⇒ (5 7 9) |
| 16:42 | hiredman | ,(map vector (range 10) (range 10)) |
| 16:42 | clojurebot | ([0 0] [1 1] [2 2] [3 3] [4 4] ...) |
| 16:42 | TravisD | Hmm, yes, I use that fact in my possible implementation |
| 16:42 | sdegutis | Yay I won that one. |
| 16:42 | hiredman | map is zip-with |
| 16:42 | sdegutis | TravisD: Then isn't your implementation inherently obsolete? |
| 16:43 | TravisD | Yes, but I personally find the term "zip" more interpretable. It makes it clear that you're combining several seqs |
| 16:43 | TravisD | I guess that is not enough to include it in the language, though |
| 16:43 | sdegutis | TravisD: #(def zip map) |
| 16:44 | sdegutis | TravisD: ##(def zip map) |
| 16:44 | lazybot | java.lang.SecurityException: You tripped the alarm! def is bad! |
| 16:44 | sdegutis | Aww |
| 16:44 | TravisD | sdegutis: should be (def zip (partial map vector)) |
| 16:44 | sdegutis | TravisD: looks good |
| 16:44 | stuartsierra | OK posted release to 'clojurescript' mailing list. |
| 16:45 | TravisD | hiredman: so it is. I didn't really notice that until you mentioned it |
| 16:46 | TravisD | hiredman: Even given my implementation of zip-with :P |
| 16:48 | stuartsierra | And 'clojure' mailing list. |
| 16:53 | isaacbw | how are there no official hoodies? D: |
| 16:56 | ToBeReplaced | is there a lib/script that tries to convert a jar to clojure namespaces? ex. i want to work with java.nio.file without needing to type-hint |
| 16:57 | isaacbw | ,'(a . b) |
| 16:57 | clojurebot | (a . b) |
| 16:58 | ToBeReplaced | seems like there's a lot of wrapper libraries (clj-time, fs, as examples) that don't provide (much) extra functionality, but i'd still like to be able to (require '[java.nio.file.Files :refer [create-directory]]) |
| 17:02 | noonian | this might help: https://github.com/juergenhoetzel/clj-nio2 |
| 17:02 | noonian | but otherwise you will need to use java interop an import java.nio.file.Files instead of require and .createDirectory |
| 17:04 | stcredzero | So, for exception logging clojure.tools.logging is perfectly cromulent? |
| 17:04 | ToBeReplaced | noonian: yeah... it's not hard to write a quick wrapper -- was wondering if someone wrote something to auto-generate a wrapper |
| 17:05 | ToBeReplaced | noonian: it's not always possible... and there would be a speed hiccup... so it's probably just not useful... i haven't thought it through at all |
| 17:06 | noonian | hmm, would be a fun project though, scrape javadocs and generate clojure library wrappers for them, idk how useful it'd be |
| 17:07 | jcromartie | noonian: I don't see the point. The Clojure/Java interop is already nice. And to make a more Clojure-friendly library takes thought. |
| 17:08 | hiredman | there was this lesser known object store with a vaguely rest api we had to use for work, I wrote a html documentation -> clojure code compiler/transformer/whatever for it |
| 17:08 | jcromartie | noonian: Also you can use reflection to iterate over the classes/interfaces/methods. So no need to scrape the javadocs. Maybe start form there. |
| 17:08 | hiredman | it was neat |
| 17:08 | noonian | jcromartie: good point |
| 17:08 | hiredman | then the company that backed the object store went out of бизнес |
| 17:16 | hiredman | anyway, clojure is great for all kinds of code generation, compilers, interpreters, etc |
| 17:16 | hiredman | etl jobs :) |
| 17:16 | akyte | But startup time. |
| 17:17 | hiredman | *shrug* |
| 17:17 | hiredman | there are more interpreters, compilers, and code generators than those in a scripting languages runtime |
| 17:23 | isaacbw | is anyone here planning to do the quil idea for clojurescript? |
| 17:23 | technomancy | quil needs a rewrite |
| 17:23 | technomancy | it's super imperative =\ |
| 17:23 | TravisD | Does anyone know of an efficient implementation of sparse vectors? |
| 17:25 | aconbere | efficient for what? |
| 17:25 | TravisD | aconbere: Computing inner products with other sparse vectors and dense vectors |
| 17:25 | TravisD | and all the vectorspace operations |
| 17:26 | aconbere | and these are presumable very large sparse vectors? so you're primarily concerned with memory efficiency? |
| 17:27 | TravisD | aconbere: Actually, the main thing I want is for the inner products to scale with the number of non-zero entries |
| 17:28 | TravisD | the space savings is nice, too |
| 17:28 | TravisD | but the vectors are not so large that they wouldn't fit in memory, or anything |
| 17:29 | aconbere | hmmm, I'm not sure I have anything immediately in my bag of tricks |
| 17:29 | aconbere | I could come up with a few ideas |
| 17:29 | aconbere | but I would have to just write up a test case and try them out |
| 17:29 | aconbere | :-/ |
| 17:29 | TravisD | A good representation is as a list of [index value] pairs, sorted by index |
| 17:30 | TravisD | all the operations can be implemented efficiently for this representation, but I'm wondering if someone has already done it :) |
| 17:30 | aconbere | heh |
| 17:30 | arrdem | TravisD: if it isn't blatantly part of core.matrix already I doubt it |
| 17:30 | isaacbw | does nbeloglazov hang out in irc? |
| 17:31 | isaacbw | (the quil author) |
| 17:31 | arrdem | $seen nbeloglazov |
| 17:31 | lazybot | nbeloglazov was last seen quitting 8 weeks ago. |
| 17:31 | arrdem | isaacbw: I'll take that for a no |
| 17:31 | isaacbw | ah well |
| 17:31 | isaacbw | technomancy: so how would that rewrite happen? |
| 17:31 | isaacbw | a fork? |
| 17:32 | TravisD | arrdem: Is there somewhere to see the api of core.matrix? I couldn't find one after a quick search |
| 17:32 | arrdem | I may have the lib name wrong it's been a while. |
| 17:32 | TravisD | arrdem: I think matrix.core is right |
| 17:32 | TravisD | there was a github page |
| 17:32 | technomancy | isaacbw: sam mentioned plans to try to make things more functional in quil 2 |
| 17:33 | technomancy | isaacbw: the API needs to look more like racket's functional image handling features |
| 17:33 | arrdem | TravisD: yeah so there's c.m but I think there's another good matrix library floating around. name escapes me :c |
| 17:34 | isaacbw | technomancy: hmm, so if I took on the quil->clojurescript project suggested in the GSoC ideas page, which API would make the most sense to target? The current quil API, or some new undefined API |
| 17:34 | arrdem | TravisD: this is the one you want https://github.com/clojure-numerics/core.matrix |
| 17:34 | llasram | arrdem: Are you think if clatrix, which uses jblas? |
| 17:35 | llasram | (and which core.matrix can use as a backend) |
| 17:35 | technomancy | isaacbw: personally I don't think quil1->cljs makes sense, but the maintainer might feel otherwise |
| 17:35 | technomancy | I think quil2 on the JVM should take priority |
| 17:35 | isaacbw | is it the API that's too imperative, or the implementation? Or both? |
| 17:36 | technomancy | I think the implementation has to be imperative behind the scenes |
| 17:36 | arrdem | llasram: I don't think that was it. I'm about 80% I was in fact thinking of numerics/core.matrix. the other 20% is offline. |
| 17:37 | llasram | haha |
| 17:37 | llasram | ok |
| 17:38 | isaacbw | technomancy: cool, thanks for the input. I'll send the maintainer an email and see what his goals are |
| 17:38 | llasram | TravisD: Oh, sparse vectors. Yeah -- the core.matrix API is vaguely aware of them, but none of the available backends provide them (last I checked) |
| 17:38 | isaacbw | on a similar note, do you folks have any additional ideas for good GSoC projects that aren't listed in the ideas page? http://dev.clojure.org/display/community/Project+Ideas |
| 17:38 | TravisD | llasram: Ah, alright :) That's too bad |
| 17:38 | llasram | TravisD: Mahout has okay sparse vector and matrix implementations, if you aren't adverse to some Java interop |
| 17:39 | arrdem | TravisD: if you aren't, please leave a core.matrix backend for the rest of us <3 |
| 17:40 | TravisD | arrdem: I'll have to look at the support core.matrix requires. It might be considerably more than I need for my own project :D |
| 17:40 | llasram | I've got most of a core.matrix backend which uses Mahout sparse impls... I just need to find the time to finish it |
| 17:41 | llasram | And have needed to so-do for like 4 months |
| 17:41 | llasram | So, there's that |
| 17:41 | arrdem | 's ok I have a PR on Loom that's been awaiting a rework since October :P |
| 17:46 | gfredericks | is there a reason that leiningen can't use classloader tricks to run on a single jvm? |
| 17:46 | gfredericks | is it possible to have two versions of clojure running? |
| 17:46 | technomancy | gfredericks: :eval-in :classloader |
| 17:46 | technomancy | doesn't work all that well |
| 17:46 | bob2 | note: breaks jetty in a bizarre way |
| 17:47 | gfredericks | interesting, thanks |
| 17:48 | isaacbw | ah yea, technomancy |
| 17:48 | isaacbw | I see what you mean about quil |
| 18:06 | rurumate | is there an easy way to have a history of repl, like in bash |
| 18:06 | rurumate | or shell |
| 18:12 | dnolen_ | rurumate: pretty sure lein repl already does this for you |
| 18:18 | justin_smith | rurumate: with lein repl it will use the readline history mechanism, if you have rlwrap installed (it uses readline via rlwrap if it finds it) http://linux.die.net/man/1/rlwrap |
| 18:18 | technomancy | gfredericks: afaik the weirdness of :eval-in :classloader is due to it being lightly tested rather than any inherent weirdness in using classloaders |
| 18:19 | justin_smith | rurumate: for the command foo, readline creates the file ~/.foo_history |
| 18:19 | justin_smith | (or maybe rlwrap creates it, one of those) |
| 18:20 | technomancy | rlwrap is only used by lein1 |
| 18:20 | technomancy | was |
| 18:20 | justin_smith | oh, my bad |
| 18:20 | justin_smith | what does lein2 use? |
| 18:20 | technomancy | justin_smith: uses jline2 in-process |
| 18:21 | technomancy | it's a pretty good port, but not foolproof |
| 18:23 | justin_smith | more to the point, does jline2 have a history mechanism? |
| 18:24 | justin_smith | otherwise I guess "rlwrap lein <args>" would be an option |
| 18:24 | technomancy | find ~/src -name .lein-repl-history |
| 18:37 | whilo | hiredman, malyn, dnolen_: just for reference, i have got it to work for me with this hack: https://github.com/ghubber/geschichte/blob/master/src/clj/geschichte/debug_channels.clj |
| 18:38 | whilo | everything is taken from async except for the two swaps and the pass-through of the logging stuff |
| 19:12 | cherukan | hi |
| 19:12 | chare | amalloy I am reading chapter 6 of programming clojure |
| 19:13 | cherukan | newbie question - I have two books on my shortlist - Clojure in Action, Joy of Clojure - which one do you recommend? (I know java) |
| 19:13 | isaacbw | cherukan: I just bought JoC and I love it so far |
| 19:13 | amalloy | JoC |
| 19:13 | arrdem | JoC |
| 19:14 | chare | why joc? |
| 19:16 | cherukan | Seems unanimous( ? ) - thanks |
| 19:16 | systemfault | Hmm.. how is your knowledge of Java going to be of any help with Clojure? |
| 19:17 | systemfault | Yeah, JoC is great... chapters can be boring at times. |
| 19:17 | technomancy | systemfault: depends on what you're going to be writing |
| 19:18 | cherukan | systemfault: Just mentioned that so I dont need to know pitfalls of java again |
| 19:39 | TravisD | I am representing sparse vectors as lists of [index value] pairs. Does it make sense to use (defrecord SparseVector [entries]) for the purpose of multimethod dispatching? |
| 19:40 | TravisD | I could also use a dispatch function that looks something like (comp coll? first) |
| 19:40 | justin_smith | TravisD: depends, how often would you use a sparse vector and regular vector as args at different times to the same function? |
| 19:40 | TravisD | justin_smith: quite often |
| 19:40 | hiredman | TravisD: use a map, not a list |
| 19:41 | TravisD | hiredman: I don't follow |
| 19:41 | TravisD | hiredman: Ah, I do now |
| 19:41 | TravisD | hiredman: If the lists are sorted, I believe there should be less overhead than if using a hashmap |
| 19:42 | justin_smith | hiredman: are you thinking a map like {:type "sparse-vector" 1 ... 2 ...} or am I missing something here? |
| 19:42 | hiredman | consider a sorted map |
| 19:42 | TravisD | justin_smith: He's saying that sparse vectors should be represented as maps from indices to values, instead of association lists, like I was proposing |
| 19:42 | justin_smith | ahh, right |
| 19:42 | justin_smith | yeah, alists are usually the wrong idea |
| 19:43 | hiredman | I never used clojure's sorted collections, so I never remember how the built in ones work, I think they are sorted based on keys, not insertion order |
| 19:43 | TravisD | hiredman: I think they are a suitable representation for this problem. I don't actually know how sorted maps work in functional languages |
| 19:43 | justin_smith | hiredman: yeah, there is sorted-set-by I think |
| 19:44 | justin_smith | (otherwise it is the default comparator like you get with sort) |
| 19:44 | justin_smith | ,(sorted-set 3 1 2 5 8 99 0 2 22) |
| 19:44 | clojurebot | #{0 1 2 3 5 ...} |
| 19:44 | TravisD | It's easy to write all the operations so that they return index-sorted alists |
| 19:44 | justin_smith | the problem with alists is the lookup side |
| 19:44 | hiredman | ,(doc sorted-map) |
| 19:44 | clojurebot | "([& keyvals]); keyval => key val Returns a new sorted map with supplied mappings. If any keys are equal, they are handled as if by repeated uses of assoc." |
| 19:45 | TravisD | Hmm, actually, with hashmaps I guess the cost of most operations will scale with the number of non-zero elements in the sparser of the two vectors |
| 19:46 | justin_smith | ,(sorted-map 1 :a 8 :b 2 :c) |
| 19:46 | clojurebot | {1 :a, 2 :c, 8 :b} |
| 19:46 | TravisD | while using alists, you will always have to traverse the longer of the two |
| 19:46 | TravisD | actually, maybe not. |
| 19:46 | justin_smith | depends if you need to do random lookup |
| 19:46 | TravisD | yes |
| 19:46 | TravisD | hm, some weird trade offs |
| 19:47 | justin_smith | what is your objection to a map? that it is too expensive in space / time / ? |
| 19:48 | TravisD | justin_smith: Yeah, there are tradeoffs between using an alist and a map |
| 19:49 | TravisD | I thought alists were strictly faster for the operations I want to implement, but it's not true |
| 19:49 | justin_smith | the slow lookup on alist way outpaces any speed costs on a map |
| 19:49 | TravisD | justin_smith: It depends on what you're doing |
| 19:52 | TravisD | Can you traverse sorted maps in the order of their keys? |
| 19:52 | justin_smith | yes, by calling seq on it |
| 19:52 | justin_smith | which is cheap, because it is sorted already |
| 19:52 | hiredman | TravisD: for sorted maps |
| 19:53 | TravisD | And what is the cost of building a sorted map with n entries, if I already have them sorted by key |
| 19:53 | hiredman | the sorted maps are a redblack tree |
| 19:54 | hiredman | https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentTreeMap.java |
| 19:54 | TravisD | so presumably it's n log n to construct, even if the elements are already sorted? |
| 19:55 | amalloy | TravisD: usually when inserting into a binary search tree, already-sorted input is the worst case |
| 19:55 | TravisD | amalloy: Ah |
| 19:56 | amalloy | because it requires the most rebalance operations |
| 19:56 | hiredman | I think it is log n, not n log n |
| 19:56 | TravisD | hiredman: how is that possible? Certainly you must at least read all of the elements |
| 19:56 | amalloy | hiredman: well he's inserting n things |
| 19:56 | hiredman | ah, sure |
| 19:57 | isaacbw | anyone have GSoC ideas aside from the stuff in the ideas page? |
| 19:58 | TravisD | Anyways, I think with a-lists I can write all the operations I need, and they will cost O(max(n, m)), where n and m are the number of nonzero components of the two vectors respectively. I think that using sorted maps, you'll depend on O(min(n,m)) most of the time, but potentially with some pesky log factors |
| 19:59 | TravisD | well, that doesn't do it justice. Sorry for the rambling |
| 19:59 | TravisD | I'll just work it out |
| 19:59 | justin_smith | are you doing more construction ops, or more lookups? |
| 20:00 | justin_smith | if construction >= lookup a list is probably better, given they are generated in order already |
| 20:00 | TravisD | justin_smith: I almost never need to do lookups. But, for example, computing inner products can look like lookups or traversals, so which structure is better depends a lot on the vectors you're using |
| 20:01 | TravisD | I'm also realizing that I can just implement all of these things and then benchmark later :) |
| 20:02 | justin_smith | yup, criterium rarely lies |
| 20:02 | gfredericks | it gave me a negative result once |
| 20:04 | justin_smith | well clearly, you should run whatever code triggered that, repeatedly, in order to give your other code more time to execute |
| 20:04 | justin_smith | should boost performance all around |
| 20:05 | TravisD | amalloy: Are there more efficient ways to construct a binary search tree, given that you know the data is already sorted? |
| 20:05 | TravisD | seems like there should be |
| 20:06 | amalloy | it should be possible, yes. i don't know any implementations that expose that operation, though |
| 20:10 | TravisD | Heh, if you don't care about constant factors and such an algorithm exists, when constructing a binary search tree from a list of elements you could check if the list was sorted and then call the appropriate method |
| 20:10 | TravisD | then the worst case would become nearly sorted lists :P lol |
| 20:11 | isaacbw | would writing a D3 library for clojurescript be worth a GSoC project? |
| 20:11 | amalloy | don't those already exist, isaacbw? |
| 20:11 | justin_smith | I saw a small proof of concept |
| 20:11 | isaacbw | ah, looks like there's C2 |
| 20:12 | amalloy | like c2 or strokes |
| 20:12 | isaacbw | how about a more general question: would writing a new library for the Clojure ecosystem be worthy of a GSoC project, or is it generaly for things in core or contrib |
| 20:13 | justin_smith | "C2 is a very early project, and there’s a lot left to do. If you are interested in contributing, ping @lynaghk on the Github." |
| 20:13 | TravisD | Ah, for those interested, it looks like the C++ boost library implements both types of sparse vector that we're talking about. |
| 20:13 | justin_smith | linked list and hashmap are both available? |
| 20:14 | technomancy | isaacbw: I think for a brand-new project you'd b every likely to underestimate how far you can get in a summer |
| 20:14 | TravisD | http://www.boost.org/doc/libs/1_35_0/libs/numeric/ublas/doc/vector_sparse.htm#coordinate_vector |
| 20:14 | technomancy | *be very |
| 20:14 | isaacbw | technomancy: but working on an established project outside of clojure itself is kosher? |
| 20:14 | technomancy | overestimate, I mean |
| 20:15 | TravisD | justin_smith: they have both "Mapped vectors" and "Compressed vectors", which are essentially the two representations we were talking about |
| 20:15 | technomancy | isaacbw: people working under an existing project are a lot more likely to accomplish their goals I think |
| 20:19 | TravisD | justin_smith: Also, strangely, it looks like sparse vectors are always represented using a-lists (essentially) in BLAS |
| 20:22 | justin_smith | TravisD: linked list based or array based alist? |
| 20:23 | TravisD | justin_smith: not clear from the documentation I was looking at. Probably array-based, I would guess |
| 20:23 | TravisD | they said they store two "vectors", one containing values and the other containing indices |
| 20:24 | justin_smith | OK. yeah an array of indexes you can binary search on |
| 20:24 | justin_smith | unlike a linked list (which is what a clojure list is) |
| 20:24 | akurilin2 | I have a silly question: if you're building a server-side templated (w/ Selmer in my case) non-MVC site, where do you place the JS for each individual page? Do you just add a <script> into each template file? |
| 20:25 | justin_smith | akurilin2: the pattern we always use here is a layout.html partial |
| 20:25 | TravisD | Yeah. Although, the same doc I was looking at seemed to indicate that the list of indices need not be sorted. Which sounds insane to me |
| 20:25 | TravisD | Maybe it's not a reputable source :) |
| 20:25 | justin_smith | and then the contents of each page are injected into the middle of layout.html |
| 20:25 | justin_smith | any js used by every page will be referenced in layout.html |
| 20:26 | justin_smith | I forget what the term is for an inside-out partial like that (that surrounds your content rather than being inserted into it) |
| 20:27 | amalloy | TravisD: are you implementing alists in clojure or something? i can't figure out the context |
| 20:27 | akurilin2 | justin_smith: so right now I have a base template with head/body, containing a toolbars template, which contains the actual inner site pages. So you're saying, do NOT place <script> inside of the individual inner site pages? |
| 20:28 | justin_smith | akurilin2: well depends if the script is used on every page |
| 20:28 | TravisD | amalloy: Ah, I'm trying to decide how to implement sparse vectors. The two competing representations are as a sorted association list, and as a map of some kind |
| 20:28 | TravisD | amalloy: The operations I want to implement are scaling, vector addition, and inner product |
| 20:28 | akurilin2 | justin_smith: I have a script that's on every page that's just referenced from the base layout, I think that's what you were referring to. I'm talking about a per-page script though. |
| 20:29 | justin_smith | ahh right |
| 20:29 | justin_smith | akurilin2: we usually put those at the foot of the individual files |
| 20:29 | justin_smith | I forget why, but that makes them easy to find |
| 20:30 | akurilin2 | justin_smith: ok so that's what I was thinking of doing, thanks for sanity-confirming. |
| 20:30 | akurilin2 | Ugh feels kind of hacky after working with MVCs for a bit |
| 20:30 | akurilin2 | but I guess that's what people used to do |
| 20:30 | akurilin2 | Or still do :P |
| 20:31 | justin_smith | hey, maybe we're both being total hacks now, let me know if you find a better solution |
| 20:31 | justin_smith | we have this idea for asset pipelines where the scripts needed on each page would be part of the pipeline, but that's kinda MVC |
| 20:32 | Nyyx | is there already a function like this? #(if (nil? %1) %2 %1) |
| 20:32 | justin_smith | or |
| 20:32 | amalloy | Nyyx: (or a b) |
| 20:32 | justin_smith | (which is a macro) |
| 20:33 | justin_smith | there is also fnil |
| 20:33 | Nyyx | oh I didn't realize it returned the original value |
| 20:33 | Nyyx | thought it was true/false |
| 20:33 | Nyyx | fnil only works on arguments |
| 20:33 | justin_smith | ,(map (fnil identity :default) [:a 0 nil]) |
| 20:33 | clojurebot | (:a 0 :default) |
| 20:33 | justin_smith | ,(map (fnil identity :default) [:a 0 nil false]) |
| 20:34 | clojurebot | (:a 0 :default false) |
| 20:34 | justin_smith | if you need to preserve false, don't use or |
| 20:34 | akurilin2 | justin_smith: we have a bajillion of frontend gurus on this channel, I'm just going to wait for them to open a can of wisdom on me |
| 20:35 | justin_smith | akurilin2: heh, we'll both be enlightened |
| 20:35 | Nyyx | ,((fnil identity :default) (get {} :non-existant)) |
| 20:35 | clojurebot | :default |
| 20:36 | justin_smith | ,(get {} :non-existant :default) |
| 20:36 | clojurebot | :default |
| 20:36 | justin_smith | that's why get has an extra arg! |
| 20:36 | Nyyx | :O |
| 20:36 | justin_smith | ,(:non-existant {} :default) |
| 20:36 | clojurebot | :default |
| 20:36 | justin_smith | even better :) |
| 20:36 | Nyyx | I really should read all the doc strings |
| 20:36 | Nyyx | I only know book explanations of what they do |
| 20:36 | Nyyx | skimps on details |
| 20:37 | justin_smith | you should have mentioned you were using get, we could have sorted this out much sooner |
| 20:37 | Nyyx | well still very helpful to know (or ) works like ruby |
| 20:37 | amalloy | justin_smith: well, i think it's reasonable for him to not realize that get is an important part of the question |
| 20:38 | justin_smith | sure, I almost added a :) there |
| 20:38 | justin_smith | ,(:existant {:existant nil} :default) |
| 20:38 | clojurebot | nil |
| 20:38 | justin_smith | the one gotcha - if you consider it a gotcha |
| 20:48 | akurilin2 | justin_smith: the other piece that feels hacky to me is that all of our .js files are assumed to be selmer templates, so by default I funnell every .js file through selmer with a set of basic parameters like domain name, to build the right <a href> links depending on the environment |
| 20:49 | akurilin2 | I know some of this is going to be bite me in the ass at some point :P |
| 20:49 | TravisD | On clojure maps, is count a constant time operation? |
| 20:50 | justin_smith | O(1) |
| 20:50 | justin_smith | (or so says the book "Clojure High Performance Programming" - recommended if you have these sorts of questions by the way) |
| 20:50 | TravisD | cool, thanks. Is it documented anywhere outside of a book? |
| 20:51 | bbloom | (doc counted?) |
| 20:51 | clojurebot | "([coll]); Returns true if coll implements count in constant time" |
| 20:51 | bbloom | (counted? {}) |
| 20:51 | bbloom | ,(counted? {}) |
| 20:51 | clojurebot | true |
| 20:51 | justin_smith | http://stackoverflow.com/questions/1273729/what-is-the-time-complexity-of-count-function-in-clojure |
| 20:51 | TravisD | oh cool |
| 20:51 | akurilin2 | (this is the part someone says "it's documented by reading the source") |
| 20:51 | bbloom | (doc count) |
| 20:51 | clojurebot | "([coll]); Returns the number of items in the collection. (count nil) returns 0. Also works on strings, arrays, and Java Collections and Maps" |
| 20:51 | TravisD | akurilin2: I was expecting that, actually, lol |
| 20:52 | bbloom | the doc string for clojure.core/count really should mention counted |
| 20:52 | TravisD | yeah, that would be nice |
| 20:55 | Nyyx | ,(counted? []) |
| 20:55 | clojurebot | true |
| 20:55 | amalloy | i like to sneak in sequences that implement Counted but take exponential time to do it |
| 20:55 | bbloom | ,(counted? (list)) |
| 20:55 | clojurebot | true |
| 20:55 | bbloom | ,(counted? (lazy-seq)) |
| 20:55 | clojurebot | false |
| 20:56 | bbloom | amalloy: you monster. |
| 20:56 | bbloom | amalloy: i feel like i've said that to you before... |
| 20:57 | amalloy | i think usually it's me accusing someone of monstrosity |
| 20:57 | technomancy | ~guards |
| 20:57 | clojurebot | SEIZE HIM! |
| 20:57 | TravisD | Is there a way to open the documentation for an interface from the repl? |
| 20:57 | Nyyx | how does list return count in constant time? |
| 20:58 | Nyyx | there is a constant that keeps track of it in the list implementation? |
| 20:58 | TravisD | Nyyx: Seems like there should be, but it also seems wasteful to store the length of every sublist |
| 20:58 | amalloy | amusingly, searching the #clojure logs for references to "monster", the only person to accuse anyone of being a monster last november was technomancy, who did it three times |
| 20:59 | TravisD | lol |
| 20:59 | isaacbw | TravisD: which repl |
| 20:59 | TravisD | isaacbw: I'm using cider |
| 20:59 | isaacbw | TravisD: C-c C-d should do it |
| 20:59 | Nyyx | so magic? |
| 20:59 | isaacbw | or maybe C-d d |
| 20:59 | technomancy | amalloy: three times consecutively? |
| 20:59 | isaacbw | *C-c d |
| 20:59 | amalloy | no, about a week apart |
| 20:59 | isaacbw | my fingers remember |
| 20:59 | isaacbw | but my brain doesn't |
| 21:00 | technomancy | huh |
| 21:00 | TravisD | You monster. you MONSTER. YOU MONSTER! |
| 21:00 | amalloy | oh, and i misread. one f those was october |
| 21:00 | technomancy | in preparation for halloween no doubt |
| 21:00 | amalloy | 2013-11-26.txt-[13:29:42] bitemyapp: seangrove: I do things that kill my Emacs r |
| 21:00 | amalloy | egularly. |
| 21:00 | amalloy | 2013-11-26.txt:[13:29:48] technomancy: you monster |
| 21:02 | amalloy | yeah, not judging you |
| 21:02 | akurilin2 | Can we talk Haskell yet? |
| 21:02 | akurilin2 | It's after 6pm. |
| 21:02 | amalloy | Maybe |
| 21:03 | dnolen_ | bbloom: so this is fun, starting to protocolize the state methods in Om, pretty close to the point where you can force a component to write into global state, or take an Om component and use it without the Om abstractions / batched render loop, etc - drop into Reagent or whatever. |
| 21:04 | akurilin2 | Btw, kind of a pita that you can't define a map literal and use above keys in the ones below |
| 21:04 | akurilin2 | that'd be a neat hack. |
| 21:07 | pdk | does clojure have something like cl let& |
| 21:07 | pdk | er |
| 21:07 | pdk | let* |
| 21:07 | amalloy | yes, it's called let |
| 21:09 | gfredericks | ,(defmacro let-map [& entries] (let [es (partition 2 entries) names (repeatedly gensym)] `(let [~@(mapcat list names (map second es))] {~@(mapcat list (map first es) names)}))) |
| 21:09 | clojurebot | #<RuntimeException java.lang.RuntimeException: Map literal must contain an even number of forms> |
| 21:10 | gfredericks | ,(defmacro let-map [& entries] (let [es (partition 2 entries) names (repeatedly gensym)] `(let [~@(mapcat list names (map second es))] (hash-map ~@(mapcat list (map first es) names))))) |
| 21:10 | clojurebot | #'sandbox/let-map |
| 21:10 | gfredericks | wait that's not helpful |
| 21:10 | gfredericks | akurilin2: how should this even work |
| 21:12 | gfredericks | we have to assume keyword keys or something amirite |
| 21:13 | amalloy | gfredericks: (let [a 1 b (inc a)] (flatland.useful.map/keyed [a b])), if we're going to be writing silly macros |
| 21:13 | gfredericks | so repetitive |
| 21:27 | akurilin2 | gfredericks: what are we talking about again? |
| 21:38 | akurilin2 | Hammock time! |
| 21:42 | bbloom | dnolen_: cool |
| 21:45 | bbloom | dnolen_: i'm come by the studio to chill with kovas tomorrow. if you're there, you'll have to show me how that works |
| 21:46 | dnolen_ | bbloom: sweet, I'll try to make it. |
| 21:52 | TravisD | is there a way to apply a function to each value in a map? |
| 21:54 | TravisD | aside from something like (defn map-map [m f] (reduce (fn [m [k v]] (assoc m k (f v))) {} m)) |
| 21:56 | bbloom | TravisD: there is no map-values or map-keys in core, but you can do something like (into {} (for [[k v] m] [k (f v)])) |
| 22:18 | TravisD | bbloom: ah yeah |
| 22:24 | bhenry | is there a performance benefit in requiring with :refer [x y z] vs. requiring with :as lib? |
| 22:28 | isaacbw | is clojure a lisp-1 or lisp-2? |
| 22:29 | ryanf | isaacbw: lisp-1 |
| 22:29 | isaacbw | woot |
| 22:30 | bhenry | is there any benefit (performance or otherwise) in requiring with :refer [x y z] vs. requiring with :as lib? |
| 22:33 | gfredericks | bhenry: only your readability preferences |
| 22:33 | gfredericks | performance is unrelated |
| 22:34 | bhenry | gfredericks: that's what i thought. thanks. |
| 22:57 | dsrx | terrible lein plugin idea: like slamhound, but it rewrites your source files with judicious use of :refer :rename, :as, etc to minimize file size |
| 22:57 | dsrx | s/source files/ns macros |
| 23:41 | firefaux | is there any actual documentation for clojure's data structures and interfaces to them? |
| 23:41 | TravisD | is there a function that will take an associative binary operator and turn it into an n-ary operator? |
| 23:42 | firefaux | TravisD: you could do something with reduce |
| 23:42 | TravisD | Hm, yes, it seems like that's pretty much exactly what reduce does |
| 23:42 | firefaux | yep |
| 23:42 | TravisD | thanks :) |
| 23:43 | TravisD | That's a surprising way to think about it |
| 23:43 | firefaux | no problem |
| 23:44 | firefaux | now does anybody know of any extensive documentation for the data structures in clojure? I want to understand the actual java code that went into them |
| 23:44 | firefaux | and what I have to conform to to make my own |
| 23:50 | amalloy | firefaux: nothing super official. i think most people figure it out by checking what interfaces are implemented by {}, #{}, [], (), and so on |
| 23:50 | amalloy | then you can look at those interfaces and the methods in them mostly make sense |
| 23:51 | firefaux | there really should be something official |
| 23:51 | firefaux | the source code is pretty readable |
| 23:51 | firefaux | but its comments are pretty sparse |
| 23:52 | firefaux | and some things would be nice to have an explanation for |