#clojure logs

2014-03-07

00:05felixfloresin the wiki page http://clojure.org/reader
00:06felixfloresit says Keywords are like symbols, except: They cannot contain '.' or name classes.
00:06felixfloresis that true?
00:08ambrosebsfelixflores: sounds a bit odd, but that's the closest thing we have for a spec atm
00:08ambrosebsfelixflores: the current implementation doesn't behave like that
00:08ambrosebsfelixflores: of course that doesn't mean much
00:10felixfloreshow can that be true if even Datomic uses :db.part/user and :db.install/attribute ...
00:14ambrosebsthese are all facts
03:12hhenkelGood morning all, I was wondering if there is a good way of "knowing" the current path within a postwalk call?
03:14hhenkelI 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:14Null_Ahhenkel: not using postwalk, but you could write your own postwalk with path
03:15hhenkelThis 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:16hhenkelNull_A: okay, writing something new is always an option but I was hoping not to reinvent the wheel.
03:16Null_Ahhenkel: if I recall postwalk implementation in only a few lines and build ontop of walk
03:17hhenkelNull_A: okay, I'm looking into it...
03:26honzahow 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:27honzathe "a" and "b" don't seem to be fully qualified on their own for some reason
03:29honzaall i have found was (find-var 'a/greet)
03:34BartAdvdamn, 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:40muhoolein-droid is amazing. much nicer way to do android stuff.
03:40muhooif you have an app where it's ok for it to take a while to load, and then stay up.
03:44BartAdvyeah, 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:44BartAdvchoosing*
03:45BartAdvnote 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:25CookedGr1phonHopefully the startup time issue is getting some love : http://galdolber.tumblr.com/post/78110050703/reduce-startup
04:26CookedGr1phonI'm certainly betting on it, doing a lot in clojure-android at the moment
04:28BartAdvyou mean it will eventuall be swallowed by the 'official' clojure?
04:29CookedGr1phondon't know about that
04:30CookedGr1phonmight end up being a fork which tracks main clojure but with some tweaks for mobile
04:30CookedGr1phonit would certainly be nicer if it all worked off one main line though
04:30CookedGr1phonjust don't know how feasible that is
04:32BartAdvand how do you rate the experience of developing for android? you're doing some commercial stuff?
04:33CookedGr1phonyeah, the experience is so much nicer than normal android/eclipse/spend half your day waiting for adb
04:33CookedGr1phonmost of my code is pure and unit tested on my pc
04:33CookedGr1phonthere's a thin layer of android specific stuff
04:33CookedGr1phonbut even that i just tweak in the repl and don't have to restart all the time
04:33CookedGr1phonthere's a few libraries have issues
04:34CookedGr1phonmain one i've come across is duplicate classes don't get ignored like on the jvm
04:34CookedGr1phonso you get weird library conflicts
04:34CookedGr1phonbut a few excludes usually fix that
04:36BartAdvwhat editor you use? are you maybe familiar with LightTable connection issues or you just do emacs/cider or something else?
04:36CookedGr1phonI just use emacs/cider
04:36CookedGr1phonnever really used anything else
04:37CookedGr1phonthe 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:38CookedGr1phonmeans you don't have to be so worried about exceptions causing AndroidRuntime exceptions and killing your process
04:38CookedGr1phonthough I do still wish there was a way to catch those and not reset your process
04:39BartAdvhah true, too damn easy to just end with 'unfortunately, xxx has stopped'
04:41sverihi, does someone know what happened to the "out of the tar pit" paper on the papers-we-love github repository?
04:42CookedGr1phondoes anyone know of a *small* library for escaping/unescaping html entities
04:43dsrxsveri: since it's a git repo... presumably you can look through the history, right?
04:48CookedGr1phonfurther 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:48sveridsrx: thank you, i found it, the repo moved and there the paper was added to a new folder -.-
04:50notostracaCookedGr1phon, ouch. I wonder if there's some predefined mapping you can just plug into clojure.string/escape
05:06charecommute vs alter
05:06charenot getting it
05:10szymanowskihello, is there anybody how knows instaparse a bit?
05:11szymanowski (def foo
05:11szymanowski (insta/parser
05:11szymanowski "S = A B
05:11szymanowski A = 'a'+
05:11szymanowski B = #'1|2|3|4' "))
05:11szymanowski (foo "aa")
05:11szymanowskiwhy does it success? B is empty
05:23CookedGr1phonnotostraca: 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:23notostracaemoji are UTF-16 or more, right?
05:24CookedGr1phonutf-8
05:24notostracaI didn't know you could do the ones that weren't in the BMP with UTF-8, but it kinda makes sense
05:25CookedGr1phonbmp?
05:26notostracabasic multilingual plane, the first 2^16 chars I think
05:26notostracaemoji are past that
05:27CookedGr1phoni think it's the other way around, utf-16 is a fixed size codepoint, utf-8 can have longer codepoints
05:27CookedGr1phonto include an arbitrary number of characters afaik
05:27chareclojure is too complicated
05:27CookedGr1phoncharacters is probably the wrong terminology there, but you get what I mean
05:28notostracahttps://en.wikipedia.org/wiki/Emoticons_(Unicode_block) do you mean these emoticons?
05:28CookedGr1phonchare: commute is for something like addition, where order doesn't matter
05:28CookedGr1phonchare: so if you say I have 5, add 3 and add 8, it doesn't matter what order those operations come through
05:29chareI want to know how the underlying stm retry works differently for commute
05:29chareits not clear to me
05:29CookedGr1phonso 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:29CookedGr1phonbut with alter, you have to do the whole transaction again
05:29CookedGr1phonto avoid getting into an inconsistent state
05:31CookedGr1phonbut 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:31CookedGr1phonnotostraca: no I mean these ones http://en.wikipedia.org/wiki/Emoji
05:32notostracaCookedGr1phon, the ones I linked are lower in the page
05:32CookedGr1phonah ok
05:40effyis 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:42BartAdvI come from .NET background, but System/gc looks suspicious to me, especially when it's invoked 4 times?
05:42BartAdvisn't there some flag for 'full collection' or something like that?
05:42effyBartAdv: it's not my code i found that on the mailing list
05:43BartAdvdoesn't matter, I'm just hinting
05:44effywhat 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:45BartAdvheh, would be quite interested in it too
05:50BartAdvwhat 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:56effyBartAdv: trying to import the instrumentation thing into clojure, but i've no idea what i am doing it might take a while
06:01BartAdvit seems it requires some tinkering with the way jvm is started/some manifest editing, so it might be not that straightforward
06:02CookedGr1phondoesn't visualvm have stuff for tracking memory usage?
06:18effyit'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:18CookedGr1phonwell attaching a profiling tool and just browsing the interface has got to be easier than adding calls in your code
06:19CookedGr1phonyourkit is meant to be good too, but it's not free
06:21effyCookedGr1phon: 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:31clgveffy: you can get free memory and total memory from the Runtime class. but that only gives a summary on the global state
06:32Anderkentthe gist method could work, but I'd do it with 1000 or more instances then take average
06:32Anderkenti don't think you can be much more precise easily
06:33Anderkentif you really need precision then visualvm + oql is the way to go, I suppose
06:37BartAdvbut 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:39Anderkentit can, but in practice that will rarely happen
06:43effyAnderkent: 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:45Anderkenteffy: ah, it's not transitive
06:45Anderkentno wait
06:46Anderkentwas looking at wrong code :P
06:50Anderkentyeah I guess I was wrong about System/gc being usually reliable for short lived objects
06:51Anderkenteffy: I guess your best bet is a profiler after all
08:05llasram,(meta '^:foo foo)
08:05clojurebot{:foo true}
08:05llasramWhy did I never think of that before?
08:08clgvllasram: uuuh. interesting
08:08clgv,(meta '^:foo ~'foo)
08:08clojurebot{:foo true}
08:08clgv,(let [bla 'foo] (meta '^:foo ~bla))
08:08clojurebot{:foo true}
08:10edbondhow can I destruct true/false result of group-by? ,(group-by odd? (range 10))
08:10edbond,(group-by odd? (range 10))
08:10clojurebot{false [0 2 4 6 8], true [1 3 5 7 9]}
08:10llasramclgv: Well, those are kind of different
08:10llasram,'~blah
08:10clojurebot(clojure.core/unquote blah)
08:11clgvllasram: but attach the meta as well
08:12chouser,(let [{odds true, evens false} (group-by odd? (range 10))] evens)
08:12clojurebot[0 2 4 6 8]
08:12llasramclgv: Yes, but to the `unquote` form
08:12llasram,(map (juxt identity meta) [^:foo 'foo, '^:foo foo])
08:12clojurebot([foo nil] [foo {:foo true}])
08:12llasramThe latter is what I realized you can achieve
08:12edbondchouser, thanks
08:12edbond(inc chouser)
08:12lazybot⇒ 16
08:13clgv'^:foo ~'foo
08:13clgv,'^:foo ~'foo
08:13clojurebot(clojure.core/unquote (quote foo))
08:14chouseredbond: sure, np.
09:08trptcolinif 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:24martinklepsch_Raynes, if that's yours, has it been posted somewhere else: https://www.refheap.com/15296
11:02nopromptare there any clojure source pretty printers?
11:05gfredericksI've never seen one
11:06TravisDnoprompt: 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:11nopromptTravisD: that's not exactly what i'm looking for but nice thought.
11:11noprompti think i might actually have to write something special
11:11TravisDnoprompt: :) out of curiosity, what are you looking for?
11:12nopromptTravisD: best i demonstrate w/ an example... one moment.
11:13dnolen_noprompt: pprint has a source code mode, it works ok
11:14dnolen_it's what the macroexpander in Emacs uses
11:14dnolen_Cider I mean
11:23noprompthttps://github.com/noprompt/thorn :)
11:23nopromptbasically i want to emit clean clojure files: https://gist.github.com/noprompt/9414584
11:25clgvnoprompt: there was one lib mentioned on the ML
11:25nopromptdnolen_: so this can convert css->clj right now.
11:25clgvnoprompt: ah right. "fipp" was its name https://github.com/brandonbloom/fipp
11:26nopromptdnolen_: i'm wondering if there are any strategies for when i go to do sass, keeping track of free/bound vars etc.
11:26nopromptautomatically generating correct refers if enough information is known.
11:26bbloomclgv: noprompt: how can i help? :-)
11:27nopromptbbloom: see the gist
11:27nopromptbbloom: essentially i just want to clean that up.
11:27nopromptwhenever i write a file.
11:27bbloomclgv: 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:28bbloomyou don't need to change the pretty printer engine, you just need to supply a pretty "document"
11:28bbloomhttps://github.com/brandonbloom/fipp/blob/master/src/fipp/edn.clj
11:29nopromptthanks brandon
11:29noprompti'll work this in after i've nailed down the code generation.
11:30bbloomnoprompt: 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:30nopromptit'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:30bbloomnoprompt: you could also use fipp to pretty print the generated css as a backend from garden
11:30bbloomi assume garden does just indenting now, right?
11:31nopromptbbloom: basically, but it's horrible.
11:31nopromptbbloom: it gets a few things wrong.
11:31bbloomif you have an AST of the CSS code, you can easily translate that to an "AST" of Fipp's pretty print document format
11:31nopromptthat's also because i didn't completely know what i was doing.
11:32nopromptsweet! that's awesome.
11:32bbloomthat'll give you proper indenting, line breaking, and right-margin awareness
11:32bbloomthere's even column alignment
11:32gfredericks,(def foo #'foo)
11:32clojurebot#'sandbox/foo
11:32clgv,foo
11:32clojurebot#'sandbox/foo
11:33clgv:O ;)
11:34nopromptthe idea of thorn is pretty trippy.
11:34nopromptthe cool thing is, the sass parse tree can be converted to anything.
11:35bbloomyeah, sass is pretty well engineered
11:35bbloomiirc it's got a proper AST for each of the various transformation levels
11:35nopromptall i had to do was write a new visitor and emit data instead of code.
11:35bbloomand the CSS AST is (was?) a strict subset of the scss and sass trees
11:35bbloomyeah, beautiful :-)
11:36bbloomfipp operates on a very compiler-ish functional model of pretty printing
11:36bbloomthe "printer" is a machine that is just an interpreter for a little language
11:36bbloomthat little language represents a pretty printed document
11:36bbloomso you just slap a pass on to your compiler pipeline
11:37nopromptgah! i'm so excited about this.
11:38bbloomalso, 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:40bbloomnoprompt: 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:40bbloombut if *that* is too slow, you have to just swap it out in your pipeline with an alternative backend
11:42nopromptbbloom: 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:42nopromptsomeone can then clean it up, etc. so i doesn't have to be ultra fast. just correct.
11:43bbloomnoprompt: ah, by "production" use i meant if you wanted it in the Garden backend
11:43bbloomfor a run-once tool, i agree: who gives a shit if it's slow
11:43bbloombut for your app builds, it needs to be fast
11:44nopromptbbloom: oh, oh, yeah. well i definitely want to plug that in. will it work w/ cljs?
11:44nopromptit's not terribly important if it doesn't.
11:45bbloomnoprompt: https://github.com/brandonbloom/fipp/pull/12
11:47nopromptsweet
11:56gfredericksapparently throwing a function called `repl` into clojure.core doesn't go very well
12:00gtrakthrowing anything into clojure.core probably won't go very well.
12:01gtrakjust add a UUID suffix and let autocomplete do the work :-)
12:07mzdravkovI 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:07gtrakmzdravkov: compojure is the sinatra analogue.
12:07gtrakthe popular one
12:09mzdravkovgtrak: thanks
12:30gfrederickstrying to change a var's metadata before its initial value finishes evaluating might be a bad idea
12:35jcromartiegfredericks: what kind of horrible things are you doing?
12:38gfredericksjcromartie: https://github.com/fredericksgary/repl-utils/blob/master/src/com/gfredericks/repl.clj#L50
12:40jcromartieinteresting
12:40jcromartieso it returns a symbol for a var, so that you don't have to worry about hanging on to a future or whatever
12:41jcromartiethat's rather handy in the REPL
12:42gfredericksexactly
12:42gfredericksand if I'm using cider with C-u C-x C-e, the symbol for the job is printed right after the expression
12:42gfredericksI did it with a future initiall and then realized dereffing was too much trouble
12:42gfrederickslife is too short to deref
12:42koreth_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:43gfredericksclojurebot: enlive is a pain to debug
12:43clojurebotAlles klar
12:44gfredericksdoes anybody know why C-u C-x C-e doesn't print *out* to the repl buffer?
12:44gfredericksI can imagine it being intentional but it's pretty much never what I want (since I can't see *out* otherwise)
13:02ptcek_Do I need to use rufoa/named-re or I can get named regexp groups when running on java 1.7 (but how...)?
13:03mikerodI 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:05bbloommikerod: read-time and compile-time are interleaved
13:06bbloommikerod: if you have two forms at the top level of a file, the first form is compiled before the second form is read
13:06mikerodbbloom: That confuses me because I can use the LispReader to read an input stream
13:07bbloommikerod: they don't HAVE TO BE interleaved, they just are for the top level of a clojure file
13:07mikerodbbloom: so I was looking at it from the perspective of "nothing is compiled"
13:07bbloommikerod: from that perspective, syntax-quote is broken
13:07mikerodbbloom: so if the reader finds syntax-quote like, `a in a stream and 'a doesn't belong anywhere, what happens?
13:07bbloom,`a
13:07clojurebotsandbox/a
13:08bbloommikerod: https://github.com/brandonbloom/backtick
13:08bbloommikerod: syntax quote doesn't need to be part of the reader, nor does syntax quote need to use the "current" compiler environment
13:09bbloommikerod: those are both implementation details of clojure
13:09mikerodah, I have stumbled on this before and didn't go though it. I will take a look through what you have here.
13:09bbloommikerod: from one perspective, it's a "bug" from another perspective, it's an "optimization"
13:09mikerodbbloom: yep, I also noticed that Clojure syntax quote is looking at symbols from the "current" ns perspective
13:10mikerodI understand that in a typical use-case for it in a macro returning code, it would make sense to work like it does
13:11mikerodbbloom: thanks for the link, I'll go through this. definitely looks interesting.
13:16rufoa<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:16rufoait's a bit of a hack though
13:16RaynesPeople are still writing more task scheduling libraries in Clojure? o.o
13:17ptcek_rufoa: response from author :) Thanks for making it clear that it does not work...
13:17RaynesCan it really be possible that out of the 400 existing libraries for it, there are still use cases not catered to?
13:17Raynes:p
13:19TravisDRaynes: afaik, there's quite a lot of active research on scheduling. Some of the new libraries maybe implement fancy new algorithms :P
13:19RaynesTravisD: But they don't :P
13:21mindbender1Raynes: Prove it!
13:25Raynesmindbender1: 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:29TravisDRaynes: My guess is that there are so many libraries because people write them as a learning experience
13:29TravisDand maybe a few of them are made by active researchers :)
13:29RaynesTravisD: Indeed. I just never realized that scheduling libraries were one of those projects people used for that.
13:29TravisDAh, yeah, it's an interesting observation
13:30RaynesTravisD: When learning new languages I generally write an API client library and CLI tool for refheap.
13:30RaynesI like that particular project because it's trivial and still requires digging into how you do crucial things in a given language.
13:31TravisDheh, sounds cool. I don't learn new languages often enough to have go-to starter projects
13:31TravisD:(
13:31TravisDWhenever I try a new language, though, invariably I try to implement my experiments in it. Sometimes with a lot of frustration, lol
13:32sdegutisI just barely missed the Haskell debates in here a few days ago... what were the main pros/cons for Haskell?
13:35technomancypros: your code is always correct. cons: you have to listen to people talk about monads all day.
13:35technomancyit's a trade-off
13:36koalallamaa+ summary
13:38TravisDDid any of the #haskell guys chime in?
13:43justin_smithtechnomancy: 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:43justin_smithit's like the category theory version of The Ring
13:43technomancyhehehe
13:43TravisDlol
13:46dacchaha
13:48sdegutisheh heh heh heh
13:50koalallamaor at least tweet about a burrito
13:51sdegutistechnomancy: I have a hard time imagining how Haskell code can be any safer than equivalent C# code.
13:51sdegutis(Picked a random type-safe language as example.)
13:51justin_smiththe 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:52technomancysdegutis: it's true; haskell is so good that it defies imagination
13:53sdegutisheh, "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:54sdegutisThat would have been fun to attend.
13:54justin_smithsdegutis: 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:54justin_smith(as random examples and not the pinnacle)
13:55TravisDYeah, I love watching failure :)
13:56technomancyanyway doesn't C# have null unioned with every type? that kind of disqualifies its type system from being taken seriously.
13:56justin_smithshrug oriented programming via the universal implicit maybe
13:57technomancysounds like a conference talk title
13:57TravisDHmm, isn't bottom a member of every type in Haskell?
13:57technomancyone 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:58technomancy"Shrug-oriented Programming via the Universal Implicit Maybe: an Unexpected Journey"
13:58sdegutistechnomancy: only if you add a ? mark at the end of the type
13:58sdegutistechnomancy: bool can only be true/false, but bool? can be true/false/null
13:58sdegutis:D
13:58justin_smithTravisD: bottom is less like null and more like an Exception I think
13:58justin_smith(I could be wrong on that)
13:58technomancysdegutis: huh; TIL. that's a hell of a lot better than java.
13:59technomancyRaynes: does elixir support identifiers with question marks and exclamation points?
13:59TravisDjustin_smith: Heh, yeah, I guess they're not really the same. But it's a similar ugliness :P
13:59Raynestechnomancy: Does Erlang?
13:59technomancyRaynes: no, erlang is super dumb about that
13:59justin_smithTravisD: well, if you are turing complete, you either have an error state implicitly or explicitly
13:59sdegutistechnomancy: "that is lame"?
13:59TravisDtrue :)
13:59technomancyI wondered if they bothered fixing that in elixir
14:00technomancysdegutis: faint praise, I know
14:00TravisDjustin_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:00sdegutistechnomancy: did i guess TIL right?
14:00clojurebotExcuse me?
14:00technomancysdegutis: oh
14:00technomancyno
14:00technomancyclojureTIL?
14:00technomancydang it
14:00justin_smithTravisD: but not much programming? dunno
14:00technomancyclojurebot: TIL?
14:00clojurebotexcusez-moi
14:00technomancyclojurebot: TIL is today I learned
14:00clojurebotRoger.
14:00sdegutisahhh
14:00technomancysdegutis: ^
14:01sdegutisalso, does Java just allow any tpye to be null?
14:01technomancysdegutis: unless it's a primitive
14:02technomancyit's pretty terrible
14:02sdegutisSo, 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:02gfrederickstechnomancy: it could be worse
14:02sdegutisAm I.. am I doing dynamic programming wrong?
14:02gfrederickstechnomancy: we could have a boxed java.lang.Null
14:02TravisDjustin_smith: I think languages like Coq and Agda are not turing complete, yet they are still useful programming langauges
14:03technomancygfredericks: Null/valueof
14:03gfrederickstechnomancy: Null#equals always returns false
14:04TimMcsdegutis: Congratulations, your code is now more greppable.
14:04sdegutisTimMc: yea, that's one of the main benefits of avoiding the (keyword ...) style
14:05stuartsierradnolen_: 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:05sdegutisNot only more greppable, but more grokkable, and especially easier to refactor using automated tools
14:05dnolen_stuartsierra: yeah I noticed they stopped doing them :P
14:05sdegutis(Also there's a single `letfn` in our code, and it's about to go away.)
14:05dnolen_stuartsierra: straight from Git source sounds fine.
14:06stuartsierradnolen_: Much harder to pick a release point then.
14:06dnolen_stuartsierra: do you have another solution in mind?
14:06stuartsierradnolen_: No. :(
14:07stuartsierraJust wondering how best to go about versioning.
14:08stuartsierraGit SHAs don't sort.
14:08stuartsierraMaven-ish things expect version numbers to go up.
14:08dnolen_stuartsierra: well ClojureScript version is just the commit number
14:09stuartsierraBleh. Don't remind me.
14:09TravisDCan anyone recommend a visually appealing dark emacs theme? Sorry for being grossly off topic
14:09dnolen_stuartsierra: I think you wrote that script :)
14:09stuartsierradnolen_: Just following orders, judge.
14:10`cbpTravisD: I use zenburn
14:10TravisD`cbp: I'll check it out, thanks :)
14:10stuartsierradnolen_: Well, the last release of G.Closure was 0.0-<DATE>-<SHA> so I guess we can stick with that.
14:10technomancyTravisD: zenburn and monokai are my favourites
14:11stuartsierraRe themes, I like Twilight.
14:11TravisDYeah, I used monokai for a while! Is there a package for zenburn?
14:11sdegutisTravisD: I like this one:
14:11`cbpTravisD: yes there is on melpa
14:11`cbpTravisD: works great with clojure
14:11TravisDJust found it :) There seemed to be a few alternative packages, but I installed zenburn-theme
14:11`cbpTravisD: solarized/dark is also nice
14:11dnolen_TravisD: I like tomorrow-night
14:11sdegutisTravisD: https://gist.github.com/sdegutis/9417820
14:12sdegutisIt's a fork of naquadah.el on Melpa, but nicer on the eyes in a few but important ways.
14:13TravisDhehe, thanks for all the suggestions! To summarize, they are zenburn, monokai, twilight, solarized, tomorrow-night, and sdegutis' modified version of naquadah.el
14:13sdegutis(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:13amalloytechnomancy: i love that presentation title. plz to submit to a real conference
14:14sdegutisWishing my nicks were colored in this IRC client right about now...
14:14sdegutisOr that stuartsierra's nick wasn't so close to technomancy's in length...
14:15TravisDI really miss my coloured nicks :( Now everyone is just a gray smudge of the same
14:15sdegutisI should write an IRC client that's programmable in ClojureScript.
14:15sdegutisThen I'd be able to easily add colored nicks.
14:15`cbpan irc client for light table :)
14:17amalloyTravisD: did someone steal your irc client? or make you colorblind?
14:18TravisDamalloy: 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:18TravisDmaybe I will do that this afternoon...
14:18sdegutisTravisD: try out LimeChat
14:19sdegutisits simpler yet more powerful than colloquy
14:19TravisDsdegutis: Ah, cool, I'll check it out. I was under the impression that colloquy was the de-facto standard mac IRC client
14:19sdegutisit 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:20sdegutisTravisD: among mac-fanboys yes, since its so shiny.
14:20TravisDI like shiny things :)
14:20TravisDIt's been crashing a lot lately, though.
14:20bbloomI use Textual, seems to work fine
14:20sdegutisTravisD: shiny things are indeed nice when they work
14:21TravisDbbloom: but it's not free! :(
14:21`cbpthe only free irc client is obviously erc
14:22TravisD_Oh man, this limechat business is weird
14:22bbloomTravisD: it's 5 bucks and there is a demo
14:22bbloomTravisD: if you like it, spend the 5 bucks
14:22sdegutisplus im pretty sure LimeChat (free & open source) beats the heck out of Textual in terms of features
14:22sdegutis(and simplicity)
14:22Jahkeup+1 for LimeChat
14:22sdegutisi wonder if textual is a sig source of income for them
14:23sdegutisthere's also http://conceited.net/products/linkinus
14:24TravisD_I might give limechat a try. Are there more themes than it comes with by default?
14:24sdegutisyeah
14:25TravisD_Can I get it to confirm my nick automatically?
14:25TravisD_one sec.
14:25sdegutisyea
14:25technomancyerc's nick highlighting normalizes for trailing punctuation <3
14:25technomancy(thanks to leathekd)
14:26benmosslimechat is weirdd
14:28TravisDAnyways, 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:28justin_smith#clojure-social?
14:29sdegutisYeah #clojure-social
14:30TravisDgreat, thanks :)
14:43borkdudeI just had a conversation with Erik Meijer. He bashed Clojure today in favor of Scala :P
14:43borkdudejust jokingly though
14:44bbloomborkdude: on what grounds?
14:45borkdudebbloom 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:46borkdudehe presented something about his Rx implementation
14:48bbloomborkdude: *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:51sdegutisborkdude: i do enjoy typesystems that are integrated nicely into an IDE, they help tremendously in my productivity
14:51sdegutisalthough that may be more of a statement about how unproductive i am on my own?
14:51borkdudehe spoke about covariants and contravariants of getters and setters
14:51borkdude:-S
14:51sdegutisoh.
14:52koalallamasdegutis: I feel the same way.
14:53bbloomaccessors: a bad idea to solve problems caused by other bad ideas
14:53justin_smith(inc bbloom)
14:53lazybot⇒ 30
14:53borkdudeI asked him, don't you think creating a class for each kind of data is anti code reuse?
14:54sdegutis(dinc bbloom)
14:54borkdudeHe mentioned something about traits in Scala, but I don't know Scala enough to judge if that takes away this pain
14:55bbloomborkdude: traits are a slightly less theoretically problematic version of mixins, which are wildly problematic in both theory and practice
14:55borkdudeor extension methods
14:55bbloomextension methods are a syntax convenience, essentially
14:55borkdudeI know them from C#
14:55bbloomso extension methods actually do add a little bit of actual expressivity
14:55bbloomb/c they are dispatched by type, so in that sense they can be seen as a form of return type polymorphism
14:56bbloombut most of the time, that little subtly of the spec is ignored
14:56bbloomand ppl just use them as free functions with . notation convenience
14:56borkduderight
14:56bbloomthe static polymorphism aspect is totally lost on most people
14:57bbloominterestingly, 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:58bbloomppl just wanted the syntax tho
14:58whiloi am trying to debug my core.async channels, which proves difficult and confuses me by undetermined behaviour.
14:59whiloi have tried to build a wrapper to log values on channels: https://gist.github.com/ghubber/9418732
14:59whilobut it doesn't work, only some values get through
15:00sdegutisbbloom: it does rock tho
15:00whiloany ideas or tipps of how to properly track connections and values in complex system?
15:00bbloomsdegutis: linq? yeah linq is super cool
15:01sdegutisbbloom: i meant ext methods but yeah linq too
15:01sdegutisas close to clojure.core as a static lang can polly get?
15:01bbloomsdegutis: you can just do what rich does: make a class called something small like RT and just load it up with static functions
15:02sdegutisthx
15:02bbloomi 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:03dnolen_whilo: that's not going to work how you expect if someone else gets a reference to c.
15:03dnolen_whilo: c needs to already be mult'ed
15:05whilodnolen_: if i create the channel and mult it first before i return it, it should work?
15:05bbloomsdegutis: 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:05dnolen_whilo: yes
15:05whilodnolen_: thx!
15:06abpbbloom: 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:06whilodnolen_: 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:06bbloomabp: and i'm sure his program is now slower, more code, and harder to debug
15:07sdegutisabp: did you have static variables for persistent state?
15:07bbloomyeah, static variables are the problem, not static functions
15:07borkdudestate?
15:07clojurebotyou're doing it wrong!
15:07bbloomalthough your static functions need to be pure
15:07abpsdegutis: nope, static methods for mostly querying, data transformation etc.
15:08dnolen_whilo: no debugging tools visual or otherwise that I'm aware of, would be useful.
15:09abpbbloom: don't know if it got slower but more code for sure
15:09whilodnolen_: ok, thx
15:09gtrakbbloom: just blame your old C tendencies instead of your new lispy ones
15:09bbloomabp: at minimum, it used a fuckton more memory :-P
15:09abpbbloom: yeah, just what androids gc likes ;)
15:21jonasenstuartsierra: dnolen_: a new version of GClosure Compiler was released a week ago: https://groups.google.com/d/msg/closure-compiler-discuss/f1lee2eThlg/HPZvnoWh1ncJ
15:21dnolen_jonasen: we were actually talking about the Closure Library
15:22jonasendnolen_: oh, sorry
15:23stuartsierrajonasen, dnolen_: Google used to release JARs to Maven Central for closure-compiler. Last one was 2013-10-14
15:23jonasenstuartsierra: this has been discussed on the closure-compiler mailing list
15:24stuartsierraAnd?
15:24jonasenstuartsierra: let me see if I can find it
15:24stuartsierra10 cents says Google doesn't care.
15:27jonasenstuartsierra: https://groups.google.com/d/msg/closure-compiler-discuss/G9y8oUGnZ58/_-UM3lhMPwgJ
15:28jonasenstuartsierra: and one from january https://groups.google.com/d/msg/closure-compiler-discuss/NXokuM4gpws/1SuKqVmGPKIJ
15:30stuartsierraSummary: the one guy who used to do it got busy
15:30stuartsierrawith other things.
15:30stuartsierraSo that's going to become ANOTHER dependency we have to package.
15:30stuartsierraFML
15:32stcredzeroBest practices for logging exceptions?
15:35stuartsierraSome folks want to test these G.Closure lib releases out for me?
15:36stcredzeroAnyone want to stress-test the beginnings of a Clojure MMO? http://casterly.publicvm.com
15:36stuartsierraI'll have repo URLs in a minute
15:41stuartsierraNew G.Closure library release available for testing https://gist.github.com/stuartsierra/9419597
15:41stuartsierraPlease validate.
15:42stcredzeroSo who else is in http://casterly.publicvm.com ?
15:42jcromartieI have been in there three times
15:42jcromartiein no
15:42jcromartienow
15:42dnolen_stuartsierra: does the new release include third party now?
15:43stuartsierradnolen_: no, it's a dependency as before
15:43stcredzeroWell, no crashes yet (MMO)
15:43dnolen_stuartsierra: in your gist you're not including it?
15:43stuartsierradnolen_: It's a dependency.
15:43stuartsierrai.e. automatic
15:43dnolen_stuartsierra: but of what?
15:44stuartsierrathird-party is a dependency of closure-library
15:44dnolen_stuartsierra: k
15:44stuartsierraWhich reflects the relationships in the JavaScript source.
15:44dnolen_stuartsierra: didn't realize that, thought it would be the other way around
15:45stuartsierraYes, one would expect that.
15:46stuartsierrahttp://dev.clojure.org/jira/browse/CLJS-418 if you want the ugly truth
15:46dnolen_stuartsierra: thanks for putting this together, trying it out now
15:47stuartsierraThe real reason for the separation is different licenses. But it's virtually impossible to use gclosure-library without -third-party.
15:51whilodnolen_: 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:55dnolen_whilo: you're returning the non-mult'ed original channel
15:56whilodnolen_: 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:57dnolen_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:57whilook
15:58dnolen_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:59whilodnolen_: 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:59dnolen_whilo: which basically means debug-chan really isn't going to be all that useful.
16:00whiloright
16:05hiredmanwouldn'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:05dnolen_stuartsierra: k, tested a Om+core.async program still works and I get access goog.async.nextTick which is new
16:06dnolen_stuartsierra: sanity checking the REPL now
16:06TravisDIf I want to make a pair of two values, what clojure structure has the least overhead?
16:07stuartsierradnolen_: Great. If you happen to know something that depends on third-party and can check it, that would be helpful too.
16:07dnolen_TravisD: vector is pretty darn fast
16:07dnolen_stuartsierra: browser REPL does, checking it now
16:07whilohiredman: that was my idea
16:07stuartsierracool
16:10hiredmanwhilo: I see, so what is this mutl and tap stuff about then?
16:11whilohiredman: 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:12hiredmanwhilo: you don't need any of that
16:12hiredmanwhilo: you need two channels a go "thread"
16:18whilohiredman: 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:19hiredman(loop [] (>! chan2 (doto (<! chan1) prn)) (recur))
16:20hiredmansimplest possible one way copy
16:22dnolen_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:23TravisDIs there a protocol that one can implement to make a type seqable?
16:23stuartsierradnolen_: OK, thanks. I could just release this as-is, or post to the mailing list and ask for more testers. Any preference?
16:23llasramTravisD: clojure.lang.Seqable (JVM)?
16:23llasramOh, protocol
16:23stuartsierraThis is a new release build script, so I'm slightly more cautious.
16:24llasramTravisD: No -- interface on the JVM alas
16:24dnolen_stuartsierra: I would post to ML.
16:24stuartsierradnolen_: OK, sounds good.
16:24TravisDllasram: Ah, okay, thanks :)
16:29whilohiredman: 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:29whilo(i mean exposing two channels, but i basically want to monitor a channel)
16:30whilomaybe i miss something obvious, not sure
16:31hiredmanwhilo: 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:32whilook, 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:32whiloi also had a look at the source to reimplement a log-channel.
16:33whiloit 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:33malynwhilo: Would mult and tap work? http://clojure.github.io/core.async/#clojure.core.async/tap
16:34whilomalyn: i tried to https://gist.github.com/ghubber/9418732 but i don't know how this could work out
16:36whilomalyn: also it doesn't work XD
16:36sdegutisThe state of Clojure IDEs is becoming increasingly fragmented, especially with the arrival of NightCode, LightTable, and Cursive Clojure.
16:37jcromartieI don't mind, since the IDE choice rarely impacts anybody outside of an individual developer's decision.
16:37jcromartieso long as there's a project.clj, I can use anything I want
16:37jcromartieand so can you
16:38dnolen_whilo: if you want it to be transparent, implementing the channel protocols is the only way to make it work
16:38malynwhilo: Details, details... :) I wonder if you have to return a tap instead of the original channel? I haven't used mult/tap yet.
16:38sdegutisTrue, 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:38dnolen_whilo: as hiredman said
16:39aconbereanyone use nippy here?
16:39aconbereI'm seeing a weird issue in a long running process
16:39aconberewhere after maybe 24 hours it wont thaw any data
16:39aconbererestarting the process magically fixes the issue
16:40technomancysdegutis: try my product http://p.hagelb.org/clojurewest-2014.org.html
16:41TravisDIs 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:42sdegutisTravisD: it's built into map
16:42hiredmanTravisD: map can take multiple seqs
16:42sdegutisTravisD: ##(map + [1 2 3] [4 5 6])
16:42lazybot⇒ (5 7 9)
16:42hiredman,(map vector (range 10) (range 10))
16:42clojurebot([0 0] [1 1] [2 2] [3 3] [4 4] ...)
16:42TravisDHmm, yes, I use that fact in my possible implementation
16:42sdegutisYay I won that one.
16:42hiredmanmap is zip-with
16:42sdegutisTravisD: Then isn't your implementation inherently obsolete?
16:43TravisDYes, but I personally find the term "zip" more interpretable. It makes it clear that you're combining several seqs
16:43TravisDI guess that is not enough to include it in the language, though
16:43sdegutisTravisD: #(def zip map)
16:44sdegutisTravisD: ##(def zip map)
16:44lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
16:44sdegutisAww
16:44TravisDsdegutis: should be (def zip (partial map vector))
16:44sdegutisTravisD: looks good
16:44stuartsierraOK posted release to 'clojurescript' mailing list.
16:45TravisDhiredman: so it is. I didn't really notice that until you mentioned it
16:46TravisDhiredman: Even given my implementation of zip-with :P
16:48stuartsierraAnd 'clojure' mailing list.
16:53isaacbwhow are there no official hoodies? D:
16:56ToBeReplacedis 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:57isaacbw,'(a . b)
16:57clojurebot(a . b)
16:58ToBeReplacedseems 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:02noonianthis might help: https://github.com/juergenhoetzel/clj-nio2
17:02noonianbut otherwise you will need to use java interop an import java.nio.file.Files instead of require and .createDirectory
17:04stcredzeroSo, for exception logging clojure.tools.logging is perfectly cromulent?
17:04ToBeReplacednoonian: yeah... it's not hard to write a quick wrapper -- was wondering if someone wrote something to auto-generate a wrapper
17:05ToBeReplacednoonian: 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:06noonianhmm, would be a fun project though, scrape javadocs and generate clojure library wrappers for them, idk how useful it'd be
17:07jcromartienoonian: I don't see the point. The Clojure/Java interop is already nice. And to make a more Clojure-friendly library takes thought.
17:08hiredmanthere 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:08jcromartienoonian: Also you can use reflection to iterate over the classes/interfaces/methods. So no need to scrape the javadocs. Maybe start form there.
17:08hiredmanit was neat
17:08noonianjcromartie: good point
17:08hiredmanthen the company that backed the object store went out of бизнес
17:16hiredmananyway, clojure is great for all kinds of code generation, compilers, interpreters, etc
17:16hiredmanetl jobs :)
17:16akyteBut startup time.
17:17hiredman*shrug*
17:17hiredmanthere are more interpreters, compilers, and code generators than those in a scripting languages runtime
17:23isaacbwis anyone here planning to do the quil idea for clojurescript?
17:23technomancyquil needs a rewrite
17:23technomancyit's super imperative =\
17:23TravisDDoes anyone know of an efficient implementation of sparse vectors?
17:25aconbereefficient for what?
17:25TravisDaconbere: Computing inner products with other sparse vectors and dense vectors
17:25TravisDand all the vectorspace operations
17:26aconbereand these are presumable very large sparse vectors? so you're primarily concerned with memory efficiency?
17:27TravisDaconbere: Actually, the main thing I want is for the inner products to scale with the number of non-zero entries
17:28TravisDthe space savings is nice, too
17:28TravisDbut the vectors are not so large that they wouldn't fit in memory, or anything
17:29aconberehmmm, I'm not sure I have anything immediately in my bag of tricks
17:29aconbereI could come up with a few ideas
17:29aconberebut I would have to just write up a test case and try them out
17:29aconbere:-/
17:29TravisDA good representation is as a list of [index value] pairs, sorted by index
17:30TravisDall the operations can be implemented efficiently for this representation, but I'm wondering if someone has already done it :)
17:30aconbereheh
17:30arrdemTravisD: if it isn't blatantly part of core.matrix already I doubt it
17:30isaacbwdoes nbeloglazov hang out in irc?
17:31isaacbw(the quil author)
17:31arrdem$seen nbeloglazov
17:31lazybotnbeloglazov was last seen quitting 8 weeks ago.
17:31arrdemisaacbw: I'll take that for a no
17:31isaacbwah well
17:31isaacbwtechnomancy: so how would that rewrite happen?
17:31isaacbwa fork?
17:32TravisDarrdem: Is there somewhere to see the api of core.matrix? I couldn't find one after a quick search
17:32arrdemI may have the lib name wrong it's been a while.
17:32TravisDarrdem: I think matrix.core is right
17:32TravisDthere was a github page
17:32technomancyisaacbw: sam mentioned plans to try to make things more functional in quil 2
17:33technomancyisaacbw: the API needs to look more like racket's functional image handling features
17:33arrdemTravisD: yeah so there's c.m but I think there's another good matrix library floating around. name escapes me :c
17:34isaacbwtechnomancy: 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:34arrdemTravisD: this is the one you want https://github.com/clojure-numerics/core.matrix
17:34llasramarrdem: Are you think if clatrix, which uses jblas?
17:35llasram(and which core.matrix can use as a backend)
17:35technomancyisaacbw: personally I don't think quil1->cljs makes sense, but the maintainer might feel otherwise
17:35technomancyI think quil2 on the JVM should take priority
17:35isaacbwis it the API that's too imperative, or the implementation? Or both?
17:36technomancyI think the implementation has to be imperative behind the scenes
17:36arrdemllasram: 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:37llasramhaha
17:37llasramok
17:38isaacbwtechnomancy: cool, thanks for the input. I'll send the maintainer an email and see what his goals are
17:38llasramTravisD: 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:38isaacbwon 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:38TravisDllasram: Ah, alright :) That's too bad
17:38llasramTravisD: Mahout has okay sparse vector and matrix implementations, if you aren't adverse to some Java interop
17:39arrdemTravisD: if you aren't, please leave a core.matrix backend for the rest of us <3
17:40TravisDarrdem: 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:40llasramI've got most of a core.matrix backend which uses Mahout sparse impls... I just need to find the time to finish it
17:41llasramAnd have needed to so-do for like 4 months
17:41llasramSo, there's that
17:41arrdem's ok I have a PR on Loom that's been awaiting a rework since October :P
17:46gfredericksis there a reason that leiningen can't use classloader tricks to run on a single jvm?
17:46gfredericksis it possible to have two versions of clojure running?
17:46technomancygfredericks: :eval-in :classloader
17:46technomancydoesn't work all that well
17:46bob2note: breaks jetty in a bizarre way
17:47gfredericksinteresting, thanks
17:48isaacbwah yea, technomancy
17:48isaacbwI see what you mean about quil
18:06rurumateis there an easy way to have a history of repl, like in bash
18:06rurumateor shell
18:12dnolen_rurumate: pretty sure lein repl already does this for you
18:18justin_smithrurumate: 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:18technomancygfredericks: afaik the weirdness of :eval-in :classloader is due to it being lightly tested rather than any inherent weirdness in using classloaders
18:19justin_smithrurumate: for the command foo, readline creates the file ~/.foo_history
18:19justin_smith(or maybe rlwrap creates it, one of those)
18:20technomancyrlwrap is only used by lein1
18:20technomancywas
18:20justin_smithoh, my bad
18:20justin_smithwhat does lein2 use?
18:20technomancyjustin_smith: uses jline2 in-process
18:21technomancyit's a pretty good port, but not foolproof
18:23justin_smithmore to the point, does jline2 have a history mechanism?
18:24justin_smithotherwise I guess "rlwrap lein <args>" would be an option
18:24technomancyfind ~/src -name .lein-repl-history
18:37whilohiredman, 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:38whiloeverything is taken from async except for the two swaps and the pass-through of the logging stuff
19:12cherukanhi
19:12chareamalloy I am reading chapter 6 of programming clojure
19:13cherukannewbie question - I have two books on my shortlist - Clojure in Action, Joy of Clojure - which one do you recommend? (I know java)
19:13isaacbwcherukan: I just bought JoC and I love it so far
19:13amalloyJoC
19:13arrdemJoC
19:14charewhy joc?
19:16cherukanSeems unanimous( ? ) - thanks
19:16systemfaultHmm.. how is your knowledge of Java going to be of any help with Clojure?
19:17systemfaultYeah, JoC is great... chapters can be boring at times.
19:17technomancysystemfault: depends on what you're going to be writing
19:18cherukansystemfault: Just mentioned that so I dont need to know pitfalls of java again
19:39TravisDI 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:40TravisDI could also use a dispatch function that looks something like (comp coll? first)
19:40justin_smithTravisD: depends, how often would you use a sparse vector and regular vector as args at different times to the same function?
19:40TravisDjustin_smith: quite often
19:40hiredmanTravisD: use a map, not a list
19:41TravisDhiredman: I don't follow
19:41TravisDhiredman: Ah, I do now
19:41TravisDhiredman: If the lists are sorted, I believe there should be less overhead than if using a hashmap
19:42justin_smithhiredman: are you thinking a map like {:type "sparse-vector" 1 ... 2 ...} or am I missing something here?
19:42hiredmanconsider a sorted map
19:42TravisDjustin_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:42justin_smithahh, right
19:42justin_smithyeah, alists are usually the wrong idea
19:43hiredmanI 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:43TravisDhiredman: I think they are a suitable representation for this problem. I don't actually know how sorted maps work in functional languages
19:43justin_smithhiredman: yeah, there is sorted-set-by I think
19:44justin_smith(otherwise it is the default comparator like you get with sort)
19:44justin_smith,(sorted-set 3 1 2 5 8 99 0 2 22)
19:44clojurebot#{0 1 2 3 5 ...}
19:44TravisDIt's easy to write all the operations so that they return index-sorted alists
19:44justin_smiththe problem with alists is the lookup side
19:44hiredman,(doc sorted-map)
19:44clojurebot"([& 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:45TravisDHmm, 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:46justin_smith,(sorted-map 1 :a 8 :b 2 :c)
19:46clojurebot{1 :a, 2 :c, 8 :b}
19:46TravisDwhile using alists, you will always have to traverse the longer of the two
19:46TravisDactually, maybe not.
19:46justin_smithdepends if you need to do random lookup
19:46TravisDyes
19:46TravisDhm, some weird trade offs
19:47justin_smithwhat is your objection to a map? that it is too expensive in space / time / ?
19:48TravisDjustin_smith: Yeah, there are tradeoffs between using an alist and a map
19:49TravisDI thought alists were strictly faster for the operations I want to implement, but it's not true
19:49justin_smiththe slow lookup on alist way outpaces any speed costs on a map
19:49TravisDjustin_smith: It depends on what you're doing
19:52TravisDCan you traverse sorted maps in the order of their keys?
19:52justin_smithyes, by calling seq on it
19:52justin_smithwhich is cheap, because it is sorted already
19:52hiredmanTravisD: for sorted maps
19:53TravisDAnd what is the cost of building a sorted map with n entries, if I already have them sorted by key
19:53hiredmanthe sorted maps are a redblack tree
19:54hiredmanhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentTreeMap.java
19:54TravisDso presumably it's n log n to construct, even if the elements are already sorted?
19:55amalloyTravisD: usually when inserting into a binary search tree, already-sorted input is the worst case
19:55TravisDamalloy: Ah
19:56amalloybecause it requires the most rebalance operations
19:56hiredmanI think it is log n, not n log n
19:56TravisDhiredman: how is that possible? Certainly you must at least read all of the elements
19:56amalloyhiredman: well he's inserting n things
19:56hiredmanah, sure
19:57isaacbwanyone have GSoC ideas aside from the stuff in the ideas page?
19:58TravisDAnyways, 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:59TravisDwell, that doesn't do it justice. Sorry for the rambling
19:59TravisDI'll just work it out
19:59justin_smithare you doing more construction ops, or more lookups?
20:00justin_smithif construction >= lookup a list is probably better, given they are generated in order already
20:00TravisDjustin_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:01TravisDI'm also realizing that I can just implement all of these things and then benchmark later :)
20:02justin_smithyup, criterium rarely lies
20:02gfredericksit gave me a negative result once
20:04justin_smithwell clearly, you should run whatever code triggered that, repeatedly, in order to give your other code more time to execute
20:04justin_smithshould boost performance all around
20:05TravisDamalloy: Are there more efficient ways to construct a binary search tree, given that you know the data is already sorted?
20:05TravisDseems like there should be
20:06amalloyit should be possible, yes. i don't know any implementations that expose that operation, though
20:10TravisDHeh, 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:10TravisDthen the worst case would become nearly sorted lists :P lol
20:11isaacbwwould writing a D3 library for clojurescript be worth a GSoC project?
20:11amalloydon't those already exist, isaacbw?
20:11justin_smithI saw a small proof of concept
20:11isaacbwah, looks like there's C2
20:12amalloylike c2 or strokes
20:12isaacbwhow 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:13justin_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:13TravisDAh, for those interested, it looks like the C++ boost library implements both types of sparse vector that we're talking about.
20:13justin_smithlinked list and hashmap are both available?
20:14technomancyisaacbw: I think for a brand-new project you'd b every likely to underestimate how far you can get in a summer
20:14TravisDhttp://www.boost.org/doc/libs/1_35_0/libs/numeric/ublas/doc/vector_sparse.htm#coordinate_vector
20:14technomancy*be very
20:14isaacbwtechnomancy: but working on an established project outside of clojure itself is kosher?
20:14technomancyoverestimate, I mean
20:15TravisDjustin_smith: they have both "Mapped vectors" and "Compressed vectors", which are essentially the two representations we were talking about
20:15technomancyisaacbw: people working under an existing project are a lot more likely to accomplish their goals I think
20:19TravisDjustin_smith: Also, strangely, it looks like sparse vectors are always represented using a-lists (essentially) in BLAS
20:22justin_smithTravisD: linked list based or array based alist?
20:23TravisDjustin_smith: not clear from the documentation I was looking at. Probably array-based, I would guess
20:23TravisDthey said they store two "vectors", one containing values and the other containing indices
20:24justin_smithOK. yeah an array of indexes you can binary search on
20:24justin_smithunlike a linked list (which is what a clojure list is)
20:24akurilin2I 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:25justin_smithakurilin2: the pattern we always use here is a layout.html partial
20:25TravisDYeah. 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:25TravisDMaybe it's not a reputable source :)
20:25justin_smithand then the contents of each page are injected into the middle of layout.html
20:25justin_smithany js used by every page will be referenced in layout.html
20:26justin_smithI forget what the term is for an inside-out partial like that (that surrounds your content rather than being inserted into it)
20:27amalloyTravisD: are you implementing alists in clojure or something? i can't figure out the context
20:27akurilin2justin_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:28justin_smithakurilin2: well depends if the script is used on every page
20:28TravisDamalloy: 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:28TravisDamalloy: The operations I want to implement are scaling, vector addition, and inner product
20:28akurilin2justin_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:29justin_smithahh right
20:29justin_smithakurilin2: we usually put those at the foot of the individual files
20:29justin_smithI forget why, but that makes them easy to find
20:30akurilin2justin_smith: ok so that's what I was thinking of doing, thanks for sanity-confirming.
20:30akurilin2Ugh feels kind of hacky after working with MVCs for a bit
20:30akurilin2but I guess that's what people used to do
20:30akurilin2Or still do :P
20:31justin_smithhey, maybe we're both being total hacks now, let me know if you find a better solution
20:31justin_smithwe 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:32Nyyxis there already a function like this? #(if (nil? %1) %2 %1)
20:32justin_smithor
20:32amalloyNyyx: (or a b)
20:32justin_smith(which is a macro)
20:33justin_smiththere is also fnil
20:33Nyyxoh I didn't realize it returned the original value
20:33Nyyxthought it was true/false
20:33Nyyxfnil only works on arguments
20:33justin_smith,(map (fnil identity :default) [:a 0 nil])
20:33clojurebot(:a 0 :default)
20:33justin_smith,(map (fnil identity :default) [:a 0 nil false])
20:34clojurebot(:a 0 :default false)
20:34justin_smithif you need to preserve false, don't use or
20:34akurilin2justin_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:35justin_smithakurilin2: heh, we'll both be enlightened
20:35Nyyx,((fnil identity :default) (get {} :non-existant))
20:35clojurebot:default
20:36justin_smith,(get {} :non-existant :default)
20:36clojurebot:default
20:36justin_smiththat's why get has an extra arg!
20:36Nyyx:O
20:36justin_smith,(:non-existant {} :default)
20:36clojurebot:default
20:36justin_smitheven better :)
20:36NyyxI really should read all the doc strings
20:36NyyxI only know book explanations of what they do
20:36Nyyxskimps on details
20:37justin_smithyou should have mentioned you were using get, we could have sorted this out much sooner
20:37Nyyxwell still very helpful to know (or ) works like ruby
20:37amalloyjustin_smith: well, i think it's reasonable for him to not realize that get is an important part of the question
20:38justin_smithsure, I almost added a :) there
20:38justin_smith,(:existant {:existant nil} :default)
20:38clojurebotnil
20:38justin_smiththe one gotcha - if you consider it a gotcha
20:48akurilin2justin_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:49akurilin2I know some of this is going to be bite me in the ass at some point :P
20:49TravisDOn clojure maps, is count a constant time operation?
20:50justin_smithO(1)
20:50justin_smith(or so says the book "Clojure High Performance Programming" - recommended if you have these sorts of questions by the way)
20:50TravisDcool, thanks. Is it documented anywhere outside of a book?
20:51bbloom(doc counted?)
20:51clojurebot"([coll]); Returns true if coll implements count in constant time"
20:51bbloom(counted? {})
20:51bbloom,(counted? {})
20:51clojurebottrue
20:51justin_smithhttp://stackoverflow.com/questions/1273729/what-is-the-time-complexity-of-count-function-in-clojure
20:51TravisDoh cool
20:51akurilin2(this is the part someone says "it's documented by reading the source")
20:51bbloom(doc count)
20:51clojurebot"([coll]); Returns the number of items in the collection. (count nil) returns 0. Also works on strings, arrays, and Java Collections and Maps"
20:51TravisDakurilin2: I was expecting that, actually, lol
20:52bbloomthe doc string for clojure.core/count really should mention counted
20:52TravisDyeah, that would be nice
20:55Nyyx,(counted? [])
20:55clojurebottrue
20:55amalloyi like to sneak in sequences that implement Counted but take exponential time to do it
20:55bbloom,(counted? (list))
20:55clojurebottrue
20:55bbloom,(counted? (lazy-seq))
20:55clojurebotfalse
20:56bbloomamalloy: you monster.
20:56bbloomamalloy: i feel like i've said that to you before...
20:57amalloyi think usually it's me accusing someone of monstrosity
20:57technomancy~guards
20:57clojurebotSEIZE HIM!
20:57TravisDIs there a way to open the documentation for an interface from the repl?
20:57Nyyxhow does list return count in constant time?
20:58Nyyxthere is a constant that keeps track of it in the list implementation?
20:58TravisDNyyx: Seems like there should be, but it also seems wasteful to store the length of every sublist
20:58amalloyamusingly, 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:59TravisDlol
20:59isaacbwTravisD: which repl
20:59TravisDisaacbw: I'm using cider
20:59isaacbwTravisD: C-c C-d should do it
20:59Nyyxso magic?
20:59isaacbwor maybe C-d d
20:59technomancyamalloy: three times consecutively?
20:59isaacbw*C-c d
20:59amalloyno, about a week apart
20:59isaacbwmy fingers remember
20:59isaacbwbut my brain doesn't
21:00technomancyhuh
21:00TravisDYou monster. you MONSTER. YOU MONSTER!
21:00amalloyoh, and i misread. one f those was october
21:00technomancyin preparation for halloween no doubt
21:00amalloy2013-11-26.txt-[13:29:42] bitemyapp: seangrove: I do things that kill my Emacs r
21:00amalloyegularly.
21:00amalloy2013-11-26.txt:[13:29:48] technomancy: you monster
21:02amalloyyeah, not judging you
21:02akurilin2Can we talk Haskell yet?
21:02akurilin2It's after 6pm.
21:02amalloyMaybe
21:03dnolen_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:04akurilin2Btw, kind of a pita that you can't define a map literal and use above keys in the ones below
21:04akurilin2that'd be a neat hack.
21:07pdkdoes clojure have something like cl let&
21:07pdker
21:07pdklet*
21:07amalloyyes, it's called let
21:09gfredericks,(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:09clojurebot#<RuntimeException java.lang.RuntimeException: Map literal must contain an even number of forms>
21:10gfredericks,(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:10clojurebot#'sandbox/let-map
21:10gfrederickswait that's not helpful
21:10gfredericksakurilin2: how should this even work
21:12gfrederickswe have to assume keyword keys or something amirite
21:13amalloygfredericks: (let [a 1 b (inc a)] (flatland.useful.map/keyed [a b])), if we're going to be writing silly macros
21:13gfredericksso repetitive
21:27akurilin2gfredericks: what are we talking about again?
21:38akurilin2Hammock time!
21:42bbloomdnolen_: cool
21:45bbloomdnolen_: 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:46dnolen_bbloom: sweet, I'll try to make it.
21:52TravisDis there a way to apply a function to each value in a map?
21:54TravisDaside from something like (defn map-map [m f] (reduce (fn [m [k v]] (assoc m k (f v))) {} m))
21:56bbloomTravisD: 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:18TravisDbbloom: ah yeah
22:24bhenryis there a performance benefit in requiring with :refer [x y z] vs. requiring with :as lib?
22:28isaacbwis clojure a lisp-1 or lisp-2?
22:29ryanfisaacbw: lisp-1
22:29isaacbwwoot
22:30bhenryis there any benefit (performance or otherwise) in requiring with :refer [x y z] vs. requiring with :as lib?
22:33gfredericksbhenry: only your readability preferences
22:33gfredericksperformance is unrelated
22:34bhenrygfredericks: that's what i thought. thanks.
22:57dsrxterrible lein plugin idea: like slamhound, but it rewrites your source files with judicious use of :refer :rename, :as, etc to minimize file size
22:57dsrxs/source files/ns macros
23:41firefauxis there any actual documentation for clojure's data structures and interfaces to them?
23:41TravisDis there a function that will take an associative binary operator and turn it into an n-ary operator?
23:42firefauxTravisD: you could do something with reduce
23:42TravisDHm, yes, it seems like that's pretty much exactly what reduce does
23:42firefauxyep
23:42TravisDthanks :)
23:43TravisDThat's a surprising way to think about it
23:43firefauxno problem
23:44firefauxnow 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:44firefauxand what I have to conform to to make my own
23:50amalloyfirefaux: nothing super official. i think most people figure it out by checking what interfaces are implemented by {}, #{}, [], (), and so on
23:50amalloythen you can look at those interfaces and the methods in them mostly make sense
23:51firefauxthere really should be something official
23:51firefauxthe source code is pretty readable
23:51firefauxbut its comments are pretty sparse
23:52firefauxand some things would be nice to have an explanation for