#clojure logs

2012-08-01

00:00amalloy*shrug* i don't want clj-stacktrace in repl or test either
00:00amalloyhow nice
00:00technomancyyeah... there might be a way to do it
00:00technomancyIIRC tavisrudd added that stuff in
00:01amalloyoh, last message was mischanneled
00:01technomancyyou could probably just add an exclusion to clj-stacktrace; I think it degrades gracefully
00:01muhoowhere's the source for reply?
00:01technomancymuhoo: https://github.com/trptcolin/reply
00:01Raynesamalloy: Are you going to switch to nrepl.el?
00:01muhoothx
00:01RaynesI mean, at some point at least.
00:02amalloyprobably
00:02muhootechnomancy: no :caught in there either
00:02technomancymuhoo: ok, I must have misremembered; too bad
00:02technomancyit's possible it's all the way upstream in nrepl itself
00:04technomancywoo; so the whole coding-buffer-ns-not-getting-set bug is squashed: https://github.com/kingtim/nrepl.el/pull/51
00:05technomancyman, he's merging pull requests fairly quickly and there's still 5 open
00:06technomancythat's the last issue that was blocking wider uptake in my mind
00:06technomancymuhoo: that won't affect nrepl.el usage though; it sounds like raw `lein repl` already does what you want
00:07technomancysorry if I wasn't clear on that
00:08muhooright, and, with my rather brutal hack, nrepl.el does what i want too :-)
00:33muhoorabbit caught, fwiw. :caught is in clojure.tools.nrepl.middleware.interruptible-eval/evaluate
02:11TheBusbyso has there been any discussion of moving "merge" into PersistentHashMap?
02:11amalloywhat. that sounds awful
02:12TheBusbywhy?
02:12clojurebotwhy not?
02:13TheBusbywhy not, reducers into maps is dramatically slower than into other data types. The main bottleneck appears to be merge
02:13amalloylots of reasons. suddenly every clojure impl (eg cljs) needs to reimplement it, instead of just being a repeated conj
02:14TheBusbymaybe a pmerge then?
02:15amalloyperformance is a ludicrous reason, and pmerge doesn't make sense. first look at using ##(doc into) instead of merge, if intermediate persistent collections are feeling expensive to you
02:15lazybot⇒ "([to from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined."
02:16amalloy(or transients in general)
02:16TheBusbydoesn't (into {}) just use a transient?
02:16amalloyyes
02:17TheBusbyI'm curious what the rational for pmap is then?
02:17dnolenTheBusby: pmap is old.
02:18amalloypmap is more or less crazy
02:18amalloyi think it exists for advertising: "look how cool functional programming is, you can just add a P and your code goes on threads!"
02:18TheBusbyamalloy: too true
02:19TheBusbywhen using reducers though merging maps is dramatically more expensive than any of the other collection types...
02:19amalloyreducers, and specifically fold, promise to actually make that a reality, but pmap isn't it
02:20ro_stforgive the newb question, but what's the difference between reduce and fold?
02:20amalloyTheBusby: (a) that's a way more broad statement than you can possibly prove without qualifiers about what kind of reduce you're done, and (b) it's not astonishing because maps are paying a cost to provide random-access lookup that you don't care about while reducing
02:20TheBusbyfold uses fork/join for collections > 512 of a pre-determined size (vector)
02:20ro_stis there a nice primer on all these map/reduce/fold/fork/buzzword techniques i can read somewhere?
02:21TheBusbyro_st: http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html
02:21ro_stok so fold is parallel reduce+combine. what's combine in this context?
02:23TheBusbyamalloy: (a) I'm not trying to prove it for every case, it's just a case I run across often and I suspect others will as well. (b) I suspect the cost is more to do with ensuring lack of duplicates. Vectors also have random-access lookup
02:23amalloyTheBusby: are you using transients yet for your reduce?
02:23TheBusbyamalloy: yes
02:23clj_newb_2039i'm feeling somewhat lucky: time to order glass cups from amazon. anything else I should try?
02:23amalloythen merge in IPersistentCollection wouldn't help you anyway
02:24amalloyIPersistentMap, whatefver
02:24amalloyyou should try to find out if reduce-kv is getting involved or not - it would be another substantial improvement for a number of map operations
02:24TheBusbyamalloy: doesn't the transient version still just assoc everything one by one?
02:25TheBusbyreduce-kv is single threaded for 1.5-alpha2
02:25TheBusbys/reduce-kv/kvreduce/
02:26amalloyyou couldn't profitably parallelize merge
02:26TheBusbyamalloy: why is that?
02:26amalloytry writing a pmerge yourself
02:27amalloyat some point you need all the k/v pairs in a single place to make the output map
02:27amalloyand you need to know what order they came in so later ones can override earlier
02:28TheBusbyif you have two maps, can't you isolate each branch of the tree?
02:28amalloyi haven't tried, but it doesn't seem like it to me for the reasons i just said. feel free to prove me wrong with an implementation of pmerge
02:31TheBusbyamalloy: thank you for the feedback, I'll certainly give it a try since that seems to be my current bottleneck
02:44emezeskemuhoo: lein-cljsbuild pulls in the cljsbuild JAR by depending on it, that is all
02:45emezeskemuhoo: I don't know of any way to checkout-depend on that. I you figure out how, I'd love to know.
02:46clj_newb_2948is there some library that will let me use CLojure to directly modify the DOM of a webpage? i.e. the library wil bridge Clojure with safari/firefox/chrome? I want to use HTML/CSS/DOM elements for my GUI, but I don't want to develop in ClojureScript
02:49emezeskeclj_newb_2948: Why not clojurescript, just out of curiousity?
02:49clj_newb_2948becuase debugging clojure is about 100x easier than debuging clojurescript
02:49ro_stthere is a fantastic way to do this, clj_newb_2948: clojurescript
02:50ro_stand it's not as tough as you might think
02:50emezeskeI might argue that interacting with the DOM in a web page is about 100x easier with clojurescript than with clojure, so maybe it balances out? :)
02:50ro_stit's not as fun as jvm repl, but it's not so bad that you want to, say, code php
02:50clj_newb_2948I have spent the last 2 months coding clojurescript and written two interactive web apps
02:50clj_newb_2948I'm fairly certain that I like clojure a lot more.
02:51ro_stwhat are you using to do dom manip?
02:51ro_stenfocus? domina? your own concoction?
02:51clj_newb_2948goog.dom/appendChild
02:51emezeskeI could be wrong, but if you want to drive the DOM, clojure could maybe perhaps not be the right tool
02:51ro_sti suggest checking enfocus out. i'm in active dev with it at the mo. -ing rocks.
02:52dnolenclj_newb_2948: there's lot of room for improvement that's for sure ... did you submit any tickets or patches?
02:53clj_newb_2948dnolen: no, I tend to just complain
02:53ro_stdnolen: one idea that i had that would make reading the output js significantly easier, is to split the goog.* and the app code into two js files
02:53clj_newb_2948though for starters, if each line of gnerated javascript just had a comment ot tell me which line of clojurescript it came from ... that owuld be nice
02:54dnolenclj_newb_2948: if you're going to go that far might as well just do source mapping.
02:54ro_sthaving to wade through an ocean of cljs/goog code to get to one's own code is tedious, and it slows down whichever editor i have pointed at foo-debug.js quite a bit
02:54dnolenro_st: if you don't optimize, everything gets compiled to separate.
02:54ro_stclj_newb_2948: they're working on source-mapping at the moment, which, when it's done, would show you the source cljs in the chrome dev tools
02:55dnolenro_st: though this is also an issue addressed by source mapping.
02:55ro_stdnolen: i'm using whitespace
02:55clj_newb_2948ro_st: what is the time line on this?
02:55dnolenro_st: nobody's actively working on it. I've done some initial work.
02:55dnolenro_st: I may pick it up again before StrangeLoop. It seems likely that no one else will do it.
02:55clj_newb_2948actually this seems like a great way to learn about clojurescript internals
02:55ro_stah. there you go. it's obviously not a big enough problem for anyone yet
02:56clj_newb_2948dnolen: if I try to pull this off, will you provide mentorship?
02:56clj_newb_2948which basicaly means answer all my questions conerning how clojurescript internals work
02:56dnolenro_st: I wouldn't go that far. It's a massive pain in the butt. But people put up with it, god knows why.
02:56clj_newb_2948because working on compilers is hard work
02:56ro_stdnolen: incidence pit. easier to go forward than to stop and detour
02:57dnolenclj_newb_2948: sure I'm glad to help.
02:57dnolenclj_newb_2948: CLJS is relatively pleasant, being very small.
02:57clj_newb_2948do I check out the master branch, or is there some other branch I should start with?
02:58dnolenclj_newb_2948: there's a source-map branch.
02:58dnolenclj_newb_2948 :http://dev.clojure.org/display/design/Source+Maps
02:58dnolenclj_newb_2948: VLQ64 encode/decode already done. We need to be able to read in the entire Closure generated source map.
02:59dnolenclj_newb_2948: that's step 1. that would be a big step.
02:59dnolenclj_newb_2948: next step would be able to serial a Clojure data structure into a source map. Step 2.
03:00clj_newb_2948isn't step just (clj->json ...) ?
03:00clj_newb_2948isn't *step 2*
03:00dnolenclj_newb_2948: maybe, maybe not. the format is a little involved because of compression concerns.
03:01clj_newb_2948the greatest perfomrance gain is from not working to working
03:01dnolenfinal step is figuring a sensible way to generate the necessary data during emission.
03:02clj_newb_2948the first result on google for
03:02clj_newb_2948"VLQ64 sourcemap" is the clojure design docs
03:02clj_newb_2948what is VLQ64 ?
03:02dnolenclj_newb_2948: I gave you a link - read it and the referenced links :)
03:02dnolenclj_newb_2948: then I'll be happy to answer questions.
03:02ro_sthomework time :-)
03:03ro_stdnolen: i thought you could generate sourcemaps with, like, 12 maybe 15 lines of core.logic? sourcemapo, maybe? -grin-
03:03dnolenro_st: ha!
03:03ro_stthat sudoko solver is siiick
03:04dnolenro_st: it was fun to put together I'm actually a bit suprised that's it's as zippy as it is.
03:04ro_sti look forward to understanding it
03:04dnolenro_st: certainly not the fastest out there, but fast enough to be practical which is the goal.
03:05ro_styup
03:05clj_newb_2948http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/ does not explain why people did not say "we'll do it with json + use bzip2 instead of inventing a new format"
03:05ro_sti'm *so* glad cljs uses the goog library. makes so much stuff easier to do
03:05dnolenclj_newb_2948: I'm heading out, but I'm willing to pair on this. I kinda would like to get it working in time for StrangeLoop as that would be a pretty SWEET demo.
03:06ro_stcase in point: goog.dom.iframe
03:06clj_newb_2948I dont' know when strangeloop is, but we're probably on different time schedules
03:06dnolenclj_newb_2948: 2 months away.
03:07dnolenclj_newb_2948: in anycase, I'm not expecting anything. But will be pleasantly suprised if someone chip in!
03:07clj_newb_2948dnolen: one last question before you go
03:07dnolenclj_newb_2948: what's up?
03:07clj_newb_2948the key idea behind source map is that we do NOT make the minified js larger
03:07clj_newb_2948instead, we have a separte file, called blah.js.map
03:08clj_newb_2948and this file provides an index from characters/lines in blah.js to the un-minimifed version, right?
03:08dnolenclj_newb_2948: yes
03:08clj_newb_2948i.e. this is the problem the base64 VLQ solves ;
03:08clj_newb_2948great; thanks
03:08dnolenclj_newb_2948: as well original sources and everything.
03:08clj_newb_2948hope to see you later here
03:08dnolenclj_newb_2948: I'm nearly always around. talk soon.
03:08ro_stthe sourcemap + the min js gives you everything you need to break and step through the source right there in chrome dev tools
03:09ro_sthttps://www.youtube.com/watch?v=-xJl22Kvgjg&feature=player_embedded
03:10clj_newb_2948it's amazing; I would never click on a random youtube link on reddit; but in irc, somehow no second thought
03:10ro_st-grin-
03:10clj_newb_2948chrome is amazing
03:10ro_st1:26
03:10ro_ston that vid
03:11ro_stshould get you salivating
03:11Fossiclj_newb_2948: depends a whole lot on the channel ;)
03:11clj_newb_2948"compiled in pretty mode; but debugging this is still a pain" <-- no it's not, not pain at all, compared to what cljs output looks like
03:11Fossiin notorious ones we have a bot that fetches the title ;)
03:11clj_newb_2948wtf
03:12clj_newb_2948why is there java code in a chrome console?
03:12ro_stsourcemaps :-)
03:12clj_newb_2948so the app is written in java?
03:12ro_stsourcemap has all that detail inside it, and chrome groks it and shows you the source
03:12ro_stya that app is a GWT app
03:12clj_newb_2948how is it compiling java to javascript?
03:12clj_newb_2948hmm
03:12ro_stit's not
03:12clj_newb_2948why am I not using GWT ? :-)
03:13ro_stit's already compiled ont he server. the source map is just presenting the code that was compiled earlier
03:13ro_stcoffeescript, clojurescript, objective-j, etc etc etc, would all do the same, once they are able to produce full sourcemaps
03:13clj_newb_2948ro_st: your video may have just set back clojurescript sourcemaps until another volunteers comes along :-)
03:13ro_styou can already do this with 'traditional' google closure javascript
03:13ro_stclj_newb_2948: because writing java is sucky
03:14ro_stimagine seeing .cljs instead of .java? :-)
03:15clj_newb_2948no ... why can't I use GWT with Clojure? :-)
03:15ro_styou probably can
03:15ro_stnever used gwt
03:16clj_newb_2948crap:
03:16clj_newb_2948http://stackoverflow.com/questions/2135335/a-good-alternative-to-gwt-for-clojure
03:16clj_newb_2948GWT requires native java code; not compilex clojure bytecode
03:26emezeskeI want sourcemaps as much as the next guy, but honestly I don't think debugging the JS output from the compiler is really that bad
03:30ro_stwhitespace or simple, emezeske?
03:30ro_sti'm debugging whitespace and i find it ok
03:30emckenI've written a function that reads a csv file lazy and the lines are transformed into maps... I just can't figure out how to use a filter on the data ie. to only return some of the lines
03:30ro_stemcken: using (filter pred coll) ?
03:31emezeskero_st: Well, just whitespace of course for debugging
03:31ro_styeah. i just wish all the cljs+goog stuff was off to one side. would make spelunking in the app's js much easier
03:33emezeskeWhen I debug, the cljs+goog stuff is all at the top, and my app is at the bottom. Is it not that way for you?
03:33emckenro_st: Yes I'm trying to user the filter function... but obviously I'm doing it the wrong way.
03:33ro_sti know it's all in one file to avoid deps.js hopscotchery. yes, like that for me too. it just slows Sublime Text 2 down because it has to reload a meg of js every time (i use it to read the js)
03:34emckenro_st: If I pasted my code (pastebin) would to care to take a look at it?
03:34emezeskero_st: Ah, yeah, that is not ideal
03:34ro_stemcken: happily
03:35emezeskero_st: Finding errors is not that bad, though; my functions are all pretty short and the JS function name lines up perfectly with the cljs function
03:35ro_stemezeske: i'm guessing the cljs+goog stuff changes based on what your app uses, or is it the same stuff every time?
03:35emezeskero_st: The dead code elimination only kicks in for :advanced mode
03:35ro_styup, agreed. i'm getting pretty quick at identifying common issues
03:36ro_stok so it's all the same. that means it's quite worth splitting the two, if only just for whitespace
03:36emezeskero_st: If you really really want that, you might try compiling with no optimizations and doing the whole deps.js thing
03:37emezeskero_st: All your namespaces will be in their own files
03:37ro_stah. no, i don't want it quite that badly -grin-
03:37emezeskero_st: Although I have never set that up for a real project, so I don't know if it's easy/hard
03:37emezeskehaha yeah same here
03:39ro_stemezeske: what do you use for dom wrangling? domina? enfocus?
03:39emezeskero_st: jquery
03:39emezeskero_st: or, jayq
03:40ro_stah
03:40emezeskero_st: One day I'd like to drop jayq in favor of one of the swanky cljs libraries
03:40emezeskero_st: But for now, jquery has the plugins
03:41ro_st$ is fine for simple page decoration stuff, but for single-page apps it just feels a bit lacking
03:41ro_stthat's true, though. there are a lot of plugins
03:42emezeskeI use crate for templatey-type stuff
03:42ro_stmy big issue is that i can't compile jquery and its plugins into the js binary
03:42ro_sti'm absolutely fanatical about load performance. trying to keep it down to one html, one js, one css
03:42ro_stand one sprite png
03:43emezeskeIt is possible to get one JS with jquery and :advanced optimizations
03:43emezeskeBut it is not simple
03:43ro_stexactly. whereas with enfocus/domina, it's the default
03:43emezeskeYeah. I do really want to switch to using a native cljs lib instead of jquery, but not yet
03:43ro_stisn't jquery externed?
03:44emezeskeYeah it's externed, but you can concat its minified source with the :advanced closure output (with some namespace dicking around)
03:44ro_stor are you saying some intrepid explorer has managed to get jquery compiled with advanced
03:44emezeskeNo, not that
03:44ro_stohh i see. after-compilation concatenation
03:44ro_styuck :-)
03:47emezeskeyuck indeed!
03:49emckenro_st: awesome thanks alot... I've tried to simply my example: http://pastebin.com/eiBnSUj4
03:49francishttp://paste.lisp.org/display/130801 http://www.4clojure.com/problem/120 When I run my solution (see lisp paste) on the problem (see 4clojure) it times out - however when I run it on my my machine (in the repl) everything works great. I've tried running random stuff on 4clojure for that problem and it fails the tests - however I'm not sure what would be such a long running operation. No loops, no recursion. Anyone have thoughts as to why this would be?
03:50emlHey. Is there a function in either core or contrib to round up eg. 0.1 to 1? Round up to closest integer
03:51emezeskeeml: Use the java math library: &&(Math/ceil 0.1)
03:51ro_stemcken: ok, so how do you want to filter this data?
03:51emlemezeske: Ah, ceil is usually what it's called yeah. Thanks!
03:51emezeske,(Math/ceil 0.1)
03:51clojurebot1.0
03:51emlYup :) thanks man
03:52emezeskeI had to look around for a while too before I found out that you just use the Java library
03:52francis,(println ", to call clojurebot?")
03:52clojurebot, to call clojurebot?
03:52francisnifty
03:54ro_stemcken: i'm assuming you only want to write to sql if :text is 'good' ? if so, line 17 would be wrapped with (when (= (:text map) "good") ...)
03:58emckenro_st: actually the println was only so that I could see that something was happening... at some point I want it to lazy write out to a new csv file and/or database the lines the match a filter function
03:59emckenro_st: but I'll play at little with the when function, thanks :)
03:59ro_stthe filter function operates on a collection
03:59ro_stin this case, you don't have a collection, because you're creating the elements one by one from the csv
04:00ro_stit makes more sense to just use plain old conditionals to validate the data directly in that loop
04:00ro_stif you had a collection in memory already, you'd use: (filter #(= (:text %) "good") map-of-csv-lines)
04:01ro_stto produce a new collection of only good maps, which you could then doseq over to write to csv or a db
04:05TheBusbyemcken: since line-seq returns a line at a time, and CSV file formats allow multi-line records, will that work?
04:06TheBusbyTSV for the win :)
04:06emckenTheBusby: propably not... though the csv files I'm working with right now doesn't have multi-line records *hehe* one problem at the time xD
04:08emckenro_st: would a filter around the entire parse-file function work... and would i make sense? - just trying to understand how it works
04:08ro_stwhat does parse-file return?
04:09ro_stin that code, due to the doseq, it'd return nothing
04:12emckenro_st: you are right... of course it should return a collection but would a filter force the entire file to be read into memory before filtering - thus make the lazy stuff not matter?
04:12ro_stirc://irc.freenode.org:6667/#(=
04:12ro_steek
04:12ro_sthttps://www.refheap.com/paste/3955
04:13ro_stfilter would necessitate loading the entire file, unless your csv-line reader produced a lazy sequence
04:14ro_sti'm not sure if parse-file in this instance would produce a lazy-seq. i've no direct experience with intentionally lazy programming
04:15ro_sthave fun finding out :-)
04:15TheBusbyline-seq is lazy
04:15emckenro_st: thanks a lot mate, nice example... about intentionally lazy programming: as you might have noticed neither do I xD
04:16TheBusbyAll nice and lazy I think... (->> (line-seq file) (map get-as-map) (filter #(= "good" (:text %)))
04:17ro_stand there you have it
04:17ro_stthis is why i try to help out. i get to learn stuff too
04:19ro_stgosh, magit is awesome
04:19Raynesfrancis: There are some issues with clojail java interop taking a long time. We're working on fixing it and hopefully that'll solve time out issues. In the meantime, best I can recommend is try to write solutions that don't do much java interop.
04:20francisthanks
05:19RaynesEveryone stop panicking. I'm here now.
05:23otfromHi Raynes!
05:32ro_stRaynes: can you summon ohpauleez? i'd love to use shoreleave but it's broken :-(
05:32RaynesI don't think so.
05:33RaynesI don't know that particular spell.
05:33ro_stpity :-)
05:33ro_sthow are you enjoying nrepl.el?
05:33RaynesVery much.
05:34ro_stwhy'd you switch? what about it attracted you to it?
05:35Raynesnrepl.el is deprecating swank-clojure. It makes sense to move to it.
05:36ro_stok so not any one particular thing
07:31emlCould anyone here perhaps recommend an example Noir app to look at? Specifically one that includes testing (which the noir-blog doesn't :()
07:33ro_sttesting of noir-specific code, eml?
07:34emlro_st: Pretty much, though to be honest any code would be good to look at, I'm not even getting "lein test" to run :)
07:35cshellisn't there a (with-noir ..) macro which you can then call your pages just like functions?
07:35cshellyeah, http://bit.ly/MynCUl
07:35emlYeah, but I don't have the slightest idea how to write tests in clojure and I sort of want to pick up the style too
07:35eml(I'm completely new to Clojure)
07:36cshellLook at clojure.test and Midje for testing instructions
07:37emlMidje looks sweet but I suppose I should learn about clojure.test first
07:37cshellyep
07:38cshellclojure is just ab unch of functions, so you just validate outputs given sets of inputs
07:40emlYep, at least I'm running some stuff without getting namespace errors now, just gotta get the actual tests to run!
07:41cshellhaha
07:41ro_sti went straight to midje
07:41cshellclojure.test/run-tests or something
07:41ro_sti've written enough 'normal' unit tests for one life time. gimme the fancy
07:42emlI come from Ruby and went straight to RSpec there instead of Test::Unit, so I've only used the fancy :p
07:45ro_stgo for midje. i can give you a template project.clj if you like
07:45ro_sthttps://www.refheap.com/paste/3953
07:46ro_stthis includes both lein1 and lein2 data, because i got tired of fussing with that
07:46ro_stwith this, you can run lein2 midje —lazytest and get a reloading-test-runner
07:48ro_stthis includes lein-swank as well if you're brave enough to start with emacs
07:57emlro_st: Thanks man! Always such great help :)
07:58ro_sti do it for selfish reasons. i want clojure to take over the world
07:58ro_st… pinky.
08:09eml:D
08:19FrozenlockIs there an easy way to add an icon in the notification zone? Or is this OS specific?
08:23emlAh by the way ro_st, refheap's source code is quite nice to read too (to learn) :)
08:24ro_stvery true
08:24ro_stdon't know why i didn't think of that, actually
08:25emlI understand so little of Clojure to be honest, mainly because it takes a long time for me to read it at this point, but damn you get so much done with so little lines of code.. :)
08:25ro_styeah, it's awesome. coming from Ruby, right?
08:26emlPretty damn happy my boss gave me an "OK" for learning Clojure/Noir and making our next project in it!
08:26emlYup
08:26ro_stit blows your mind on so many levels
08:26ro_sthave you watched the Rich Hickey talks?
08:26ro_stSimple vs Easy, Hammock-driven Dev, Are we there yet?
08:27emlHave not :o
08:27ro_stvvv highly recommended
08:27ro_stSimple vs Easy was the pebble that started the avalanche, for me
08:29cshellI bought a hammock :)
08:29ro_st-grin-
08:29ro_sti just realised i never finished watching that one
08:29emlhttp://www.infoq.com/presentations/Simple-Made-Easy/ this one?
08:30ro_styes
08:30emlSweet, gonna watch it now :)
08:32ro_stenjoy
08:46djcoinIt seems many people coming to CLojure have a ruby background no ?
08:47ro_stit does
08:49djcoinHow is that ? Not afraid of the java boilerplate environment ? Yet, taking the risk to switch to a non statically typed language ? :)
08:50ro_stit's more a case of a Rails background. rails has too much magic in it
08:50djcoin(I mean taking a switch and still not making the move to a statically type language)
08:50ro_stit's the opposite of small and composable
08:50ro_sttoo much for a single brain to hold
08:51ro_stthis is why *I* looked away from it, anyway
08:52llasramro_st: +1 to that. I haven't been in love with Ruby for a long time, but I recently reached for Rails when I needed a basic CRUD web app, because I thought it would it be easiest. Was v frustrating, pouring through doco to find the one magic line to put in the magic place to make things happen
08:52cshellI thought it was because of the functional programming constructs
08:53ro_stllasram: exactly. you have to take on too much data to accomplish stuff
08:53ro_stcshell: that's a pull factor. i'm talking about the push factors
08:53_nmmnim still puzzled how ROR particularly could get that popular
08:53ro_stwhy *not* ruby rather than why clojure
08:54ro_st_nmmn: because php
08:54_nmmnwell php is php, still dont know how rails made ruby that popular
08:54llasram_nmmn: Yeah. I used early rails for some projects, and when it first came out it at least seem to me to be light years ahead of everything else
08:54_nmmnbut it was used in quite some places without ROR, seems like ROR was the real hype
08:54_nmmnwell thats what i thought at first also llasram
08:55ro_stit had convention-over-config and all the agile stuff arrive along with it
08:55ro_stpragprog books, 37signals' own rise, etc
08:55djcoinAnd aren't you afraid of all the java background (whether it's java, java lib and of course java build/environment). This kinda scare me
08:55_nmmni started from java, way too bloated to be usefull, imo :>
08:56_nmmnbut jvm is different stuff, many strange/nice langs use it
08:56_nmmnfor example ioke, ehehe
08:59ro_stdjcoin: also, Rhickey gave his simple-vs-easy talk at the latest rails conf
08:59djcoinyeah - I already watched this video
08:59ro_stthat might help to explain why ruby folks are arriving
09:00djcoinStill wonder - if so many people can make the move to a JVM environment
09:00djcoinwhy not switch to scala ? - it has also many benefits
09:00ro_stwhat's problematic about that?
09:00djcoinBut I guess it's even more far
09:00djcoinNothing - I, myself, am wondering about this choice
09:01djcoinStill not made the move (Im on python right now)
09:01ro_stwell, you're not switching to jvm, you're switching to clojure/lein. jvm is underneath
09:01djcoinSure
09:01ro_stcome on in, the water's great :-)
09:02_nmmn=]
09:02_nmmnwell i had smilar choices like djcoin erlang/scala/clojure/go
09:02_nmmngo is out of the choices for now hehe
09:03djcoin_nmmn: ahah, same for me ! I may also add lua
09:03djcoin_nmmn: why did you put Go out ? Did you choose clojure at last ?
09:04_nmmndont have enought time for clojure right now, but it still does look very promising
09:04_nmmnive mostly into erlang now
09:04_nmmn*im
09:04djcoin_nmmn: Oh RLY ? :) It seems nice
09:05_nmmnwell i start to see bad "points" of it now =] so i think i will dive more deep into clojure soon
09:05_nmmnjust for kicks
09:07brunchpoemsscala is intimidating and clojure seems to have a more established community for helping out those learning it.. in my experience and view
09:07djcoin_nmmn: how about scala and actors (vs erlang) ? What bother me is that i like the "lightweight" of erlang vm (+ other benefits as code reload)
09:07_nmmndjcoin: so far i actually didnt do much benchmarks, but scala seemed a bit too *java like*
09:08_nmmnwhile i really liked akka, but havent got above the ground when doind stuff with it
09:08_nmmni mean just some basic stuff only...
09:09_nmmnerlang feels more like "buit for this kinda stuff" compared to akka+scala which is like "good third party extensions/libs" feel
09:13djcoinYep yep yep
09:48tsdhOh my god, lazyness bit me again in a new form.
09:50tsdhIn a macro, there was something like ~@(if (seq? more) (map convert more) (convert more)), where the convert function depends on a dynamic var which was always correctly bound by the macro, but its value was wrong if convert was called thru map.
09:51tsdhSomehow, I expected ~@ to be eager, which it seems its not...
09:52tsdhOf course, I found the problem while trimming down my code to a minimal example I can show to you.
09:53tsdhWell, now it's solved, but maybe the example is still entertaining: http://pastebin.com/ytw6WgzB
09:56ro_stmacros, that's like, magic, right?
09:56ro_st-sigh-
09:58tsdhro_st: I'm fine with macros, but a mix of macros, dynamic vars at compile-time, and lazyness was a bit too much. :-)
09:59ro_sthehe
09:59ro_sti haven't grokked macros yet. going to see how long i can hold out :-)
10:01jolyI've only used them for simple things, but the code looks so much better for them being there
10:02ro_sti can believe it
10:02ro_stmy angle of attack will be to attempt to eliminate any boilerplate i might have creeping in
10:04ro_stgah. how did i ever get anything done without jenkins?
10:13casionis it possible to shortcircuit a loop form?
10:14ro_stshortcircuit how?
10:14casionhave it exit the loop before recur, or have it recur earlier
10:15ro_styou can recur multiple times, as long as it's the tail of that block
10:15ro_stif … recur | lots of stuff, recur
10:15hyPiRioncasion: a loop form is basically recursion.
10:15hyPiRiontail-recursion, but recursion nevertheless.
10:16casionyes, I get that
10:17casionI think I'm trying to ask something that you wouldnt want to do in a functional language anyway
10:18ro_styou want to jump out of your function early? if ( blah == null ) { break; } ?
10:18matteopHi guys just a question .....
10:18casionyes
10:18ro_stohpauleez!!!
10:19matteopHow transform a String into function in Clojure ?
10:19casionlike a break or continue I suppose
10:19jolyshould be able to just not call recur if that condition is true
10:19ro_stcasion: (if-not (nil? blah) (recur …))
10:19casionI suppose the idea is that you put everything in a conditional
10:19ro_stnot-recurring exits the loop
10:19casionthat just seemed bulky to me
10:19ohpauleezro_st: How's it going?
10:20ro_stbetter now that you're here. i am ITCHING to use pubsub and remote
10:20ro_sti literally have a comment saying 'refactor this update-ui tarball function to use pubsub'
10:20matteopi need to pass a function from java to clojure , anyone can help me ?
10:21ro_sti tweeted at you. i tried to use pubsub but it had some screwy dependency on localstorage somethingsomething
10:21ro_stmatteop: (resolve "clojure.core/some") ; #'clojure.core/some
10:21hyPiRioncasion: ah. I know what you're after. It seems bulky at first, but when you know Clojure better, you find ways to avoid break; and continue;. The language and the way you work with it is completely different.
10:22matteopthank ro
10:22casionhyPiRion: yeah... I'm fighting it tooth and nail so far
10:22ro_stcasion: a recur that isn't inside a conditional is by definition an infinite loop
10:23ro_sti found this out the hard way (having to reboot repl)
10:23casionro_st: I'm thinking that I want multiple recursion calls... except I know that's not right in clojure
10:24casionI'm just strugging to understand the common way of dealing with that
10:24ro_styou can recur multiple times
10:24casionmultiple call poins
10:24casionpoints*
10:24ro_styou just need to put those calls in the tail position of their respective blocks
10:25casionro_st: recur has to be the tail of the loop block only doesnt it?
10:25hyPiRion,(loop [a 1] (case a, 1 (recur 3), 3 (recur 2) 4))
10:25clojurebot4
10:25ohpauleezro_st: Just sweeing the tweet now (didn't show up in my email for some reason)
10:25ohpauleezI'm going to fix that - CLJS jar has an older version of the Closure Library
10:25ro_sti'd be happy to help you convert an imperative fn in a paste
10:25cshellhyperboreean: why don't you put the value you pass to recur into a local variable
10:26ro_stohpauleez: i'm using goog-jar right now. should i use something else?
10:26casionro_st: give me a few minutes here, I've learned a bit in the last few lines
10:27ohpauleezro_st: No, that's totally fine. The LocalStorage stuff in Google Closure lib was recently added. I'm going to take the offending code back out for now
10:27ohpauleezI'll be cutting a stable 0.2.2 release sometime soon
10:27ro_stor wrap it in a check for support?
10:29casionro_st: hum... this works now
10:29ohpauleezro_st: it'll probably be a conditional load, yes
10:29casionlast night everything I tried complained about recur not being in the tail
10:29casionno idea what I was screwing up
10:36pandeirohow do i create a secret key to be able to use lein deploy clojars?
10:37pandeirosorry, not really clojure-related i guess... i thought i already had a secret key tho, guess i deleted it at some point
10:43hyPiRionpandeiro: Ask in #leiningen, perhaps.
10:44hyPiRionA google search should help you too.
10:47pandeiroyeah i'm getting there
11:11goodieboytechnomancy: is it possible to specify more than one "resources" directory in project.clj?
11:25jonhicksquestion: how can I decrement a value from a hash-map and get back the new hash-map?
11:26ro_st(assoc map :foo (inc (:foo map)))
11:26ro_streplace inc with whatever
11:26jonhicksyup. testing in repl. thanks!
11:27stain(update-in p [:age] inc)
11:27stainfrom http://clojuredocs.org/clojure_core/clojure.core/update-in
11:27ro_stthere's that, too :)
11:27goodieboyanyone using leiningen 2 preview?
11:28duck1123oh, update-in, I know it's there, but I never think of it till after I've typed the assoc version
11:28ro_styeah
11:28duck1123goodieboy: lein2 is very good, time to upgrade
11:28goodieboyduck1123: that's great to hear. Would you happen to know if :resource-paths works? I'm trying it in version 1 with no luck.
11:29duck1123unless you have a very good reason to stay on 1.7, lein 2 is worth the upgrade. In most cases it's pretty easy
11:29goodieboyduck1123: are there upgrade instructions anywhere? Or do I just install lein 2, and go for it?
11:29jonhicksupdate-in. excellent
11:30jonhicksneed more time with the docs
11:30duck1123There was a precate task that listed what you need to change. can't remember if it came baked in or if it was a plugin
11:30duck1123https://github.com/technomancy/lein-precate
11:31raekgoodieboy: :resource-paths was probably called :resource-path in lein 1.x
11:31mabesclojure.contrib.ns-utils doesn't seem like it survived the 1.3 move.. Is something like it's immigrate still considered good practice or not? (http://clojuredocs.org/clojure_contrib/clojure.contrib.ns-utils/immigrate)
11:31uvtcgoodieboy: Since even Clojure itself is just another library/jar, if you like, you can simply upgrade like so: `rm ~/bin/lein`, `rm -fr ~/.lein`, `rm -fr ~/.m2`, download the latest lein, `chmod +x lein`, and run it.
11:31ro_stduck1123: cljsbuild is lein1 only
11:31duck1123ro_st: you sure, works fine for me
11:32ro_stcrossovers don't :-(
11:32goodieboyraek: cool thanks, i'll try that out in the meantime
11:32duck1123ahh, haven't gotten into that yet
11:32goodieboyuvtc: yeah, i'll give 2 a shot
11:32raekgoodieboy: make sure you read the correct version of the docs for the version of lein you use. lein 2 breaks compatibility with lein 1.
11:33goodieboyraek: good point yeah
11:33nDuff...when playing with cljsbuild on lein 2, it appeared that one could require code from the crossover libraries into .cljs files, but they don't appear to be compiled into .js by default, oddly enough.
11:33raek(you can change branch on github)
11:33ro_stnDuff: i was getting couldn't-find-crossover-namespace errors
11:34ro_sti'm sure it's a small issue, emezeske will get there sometime
11:34ro_stworks just fine with lein1
11:34ro_sti use both 1 and 2
11:34duck1123I keep both a lein2 and a lein1.7 in my bin directory then symlink lein2 to lein
11:35arkhcemerick, do you mind if I PM you?
11:35cemerickgo ahead
11:36goodieboyraek: oh too bad, 1x only accepts a single path for :resources-path
11:36duck1123I ran into a few odd cases where things were actually looking for a bin named "lein2"
11:36duck1123goodieboy: all the more reason to switch :)
11:41ro_stanyone know of a tool that formats clj source co… nevermind. i'm sure i can use pprint.
11:42ro_stjust need to learn how to load clj source as plain old clj data
11:44Chousukero_st: read does that.
11:45Chousukero_st: though if the code uses read-time evaluation that approach won't work
11:46gtrakro_st: M-x indent-region?
11:46duck1123C-x h <tab>
11:49ro_stit'd be plain clojure data. maps and vectors of ints and strings
11:49ro_stand the people producing this won't be using emacs
11:50ro_stit's a transitory step until we can get the software built that allows you to create this data in a nice UI
12:13goodieboywhat's the best way to expand a jar file in clojure?
12:13nDuffgoodieboy: expand to disk, or read contents of?
12:14goodieboynDuff: expand to disk
12:14nDuffgoodieboy: I'd expect that you'd be using the regular Java API for that (see the java.util.zip package).
12:15goodieboynDuff: gotcha, thanks!
12:31dnolenlooks like all those type hints in core.logic were unnecessary - keyword lookup via implementing valAt + case is really fast.
12:33xumingmingvhttps://github.com/killme2008/clj.guava/blob/hash/src/clj/guava/hash.clj#L50
12:33xumingmingvwhy type hint here does not work?
12:34xumingmingvI got many warning int the following lines:
12:34xumingmingvReflection warning, clj/guava/hash.clj:53 - call to putByte can't be resolved.
12:34xumingmingvReflection warning, clj/guava/hash.clj:54 - call to putShort can't be resolved.
12:34xumingmingvReflection warning, clj/guava/hash.clj:55 - call to putInt can't be resolved.
12:34xumingmingvReflection warning, clj/guava/hash.clj:56 - call to putLong can't be resolved.
12:36nDuffxumingmingv: the obvious guess is that the compiler isn't inferring the type of x from the instance? tests
12:37nDuffxumingmingv: ...you can check for that by hinting x in those calls.
12:37xumingmingvx? but The warning is saying that putByte cannt be resolved, but I type hinted the Hasher
12:38xumingmingvactually i dont know the type of x, this is why i use instance?
12:38nDuffxumingmingv: you know it at call time.
12:38nDuffxumingmingv: (.putByte hasher ^Byte x)
12:38xumingmingvoh, let me try it
12:39nDuff...by the way, that smells like a use case for a Hashable protocol.
12:40xumingmingvit did work!, but not for the putObject call
12:41xumingmingv:else (.putObject hasher ^Object x)))
12:42xumingmingvoh, its my fault..
12:42xumingmingvwrong api
12:42xumingmingvwhy it is not enough to just type hint Hasher here?
12:43nDuffxumingmingv: Because the type inference done by the compiler isn't (currently) smart enough to track when a branch is only reachable via a type test
12:44nDuff...I'd expect you wouldn't have that issues with protocols, though, and those are the preferred approach for doing that kind of thing.
12:46xumingmingvnDuff: thanks a lot!
12:59zerokarmaleftdnolen: if i want to dynamically declare a bunch of facts in core.logic (e.g. after parsing a bunch of relations from a file), what's the best way to do that?
13:00dnolenzerokarmaleft: assuming you used defrel, just call fact or facts
13:01zerokarmaleftdnolen: https://gist.github.com/3219448 <= this is an extension to a blog you tweeted about...simple genealogy example
13:02dnolenzerokarmaleft: haha sweet, Game of Thrones
13:03dnolenzerokarmaleft: cool, yeah, just call fact / facts
13:04zerokarmaleftthe problem i'm running into is difference in facts persisting at the repl and running as a script
13:05llasramzerokarmaleft: maybe you want a doseq vs map for calling `fact`? W/ `map` just have an unrealized lazy sequence and no actual applications of `fact`
13:06alexyakushevIs there some kind of map for clojure.org site? I've just discovered there are hidden pages like clojure.org/streams for which I can't find any links
13:08dnolenzerokarmaleft: yes fact / facts is side-effecting, you definitely want doseq
13:10zerokarmaleftllasram, dnolen: got it, thanks!
13:13technomancyalexyakushev: streams were actually removed on purpose; they were abandoned
13:50aaelonya friend is asking me to comment on using Clojure for data science. before I weigh in, does anyone have comments or experiences?
13:51gtrakwhat kind of data science?
13:51pandeiroemezeske: https://github.com/pandeiro/ghost & https://github.com/pandeiro/casper-cljs
13:51technomancyhttp://28.media.tumblr.com/tumblr_l7dfo7dpYS1qzamioo1_500.jpg
13:52gtrakaaelony: we have incanter for statistics stuff, and having JVM libs is pretty useful. Also this comes to mind: http://strataconf.com/strataeu/public/schedule/detail/25204
13:52aaelonyyes, let's collect a bunch of links
13:53gtrak"the research team work in one language to do the research in a ‘mathsy’ language. That is then handed off to a programming team who reconstruct the code in a production language like C# or C++. This fracture causes severe pain and error.
13:53gtrakClojure has solved this problem for me, allowing me perform the entire process from research to production in one language. "
13:53aaelonyfollowing this definition: http://en.wikipedia.org/wiki/Data_science
13:54aaelony"Data science is a discipline that incorporates varying degrees of http://en.wikipedia.org/wiki/Information_engineering, http://en.wikipedia.org/wiki/Scientific_method, http://en.wikipedia.org/wiki/Mathematics, http://en.wikipedia.org/wiki/Statistics, http://en.wikipedia.org/wiki/Computer_programming, http://en.wikipedia.org/wiki/Data_visualization, http://en.wikipedia.org/wiki/Hacker_(hobbyist), and http://en.wikipedia.org/wiki/Subject-matter_expert&quot;
13:57aaelonyI think Bradford's talk is a great example: http://www.infoq.com/presentations/Why-Prismatic-Goes-Faster-With-Clojure
13:57gtrakah yea
14:01aaelonyIn any case, I'm putting together a list and will share at some point as well.
14:04emezeskepandeiro: Nice!
14:05emezeskepandeiro: I hadn't looked at Casper before, it seems pretty cool
14:06rabidsnailAre the semantics of deliver expected to change? Right now (delever p v) is equivalent to (p v).
14:06rabidsnail(deliver p v), rather
14:06Bronsarabidsnail: that's an implementation detail
14:06rabidsnailSo,yes?
14:06BronsaI don't think you should rely on that
14:07Bronsa(though I don't think it will change)
14:07technomancyfun fact: deliver can be used as a one-arg funcall
14:07rabidsnailI'd rather there were an IDeliverable the same way there's IFn and IDeref
14:07pandeiroemezeske: yeah it is just some utility on top of PhantomJS, the real win are those wait-for fns, great for async stuff etc
14:08rabidsnailbecause right now I'm not sure if my thing-that-looks-like-a-promise will break in future clojure versions
14:08emezeskepandeiro: Yeah, that's handy looking
14:12jsabeaudrypandeiro, what is the expected mayhem of advanced compilation?
14:17pandeirojsabeaudry: oh it has a fit, i didn't really try to dig into it yet
14:17pandeirosimply ^:export'ing all my vars didn't work
14:17pandeirohmm maybe i needed to do it for all the wrapper fns too, didn't try that
14:18pandeiroi still don't fully understand externs files either
14:18hiredmanI've found externs to be very painful
14:19hiredmanthey don't work and I get no indication of why
14:20hiredmanb
14:23emezeskehiredman: I haven't been able to find any decent docs for "how to make an externs file", have you? I just had to copy existing files and stumble around.
14:26hiredmanemezeske: I just gave up and hack ground it
14:26hiredmanaround
14:27hiredman((goog/bind (aget obj "MethodName") obj) arg1 arg2)
14:28emezeskehiredman: Yeah. That's painful :(
14:28nDuffemezeske: I've found https://developers.google.com/closure/compiler/docs/js-for-compiler to be relevant and useful.
14:29emezeskenDuff: For generating externs files?
14:29hiredmanI found an extern file someone made for codemirror, tried to plug it in to cljsbuild, and it just didn't seem to work, builds "succeeded", but it wouldn't run because method names kept getting mangled
14:29nDuffemezeske: it's the same comment format given there used for externs files, yes
14:29emezeskeThe comments aren't the important part, compared to just not having the names mangled
14:30nDuffemezeske: The comments are essential to not having the names mangled. :)
14:30nDuff...at least if you're doing anything involving constructors.
14:30emezeskenDuff: Nope, I've built probably 5 externs files, no comments in any of them, they all work
14:30dnolenemezeske: nDuff is right about ctors
14:31emezeskehiredman: Yeah, there's no confirmation about "okay I found your externs file, and am using it"
14:31emezeskenDuff, dnolen: I guess I don't have any ctors...
14:31nDuffalso, @nosideeffects can be essential
14:31hiredmanemezeske: I started down the path of adding printlns through the pipeline
14:31technomancywhoa; pprint emits byte arrays as vectors of ints =\
14:32emezeskenDuff: interesting.
14:32emezeskehiredman: I think I did that once :(
14:32hiredmanbut the way cljsbuild works, adding in a dep makes it difficult
14:32nDuff...well, maybe "essential" is a little too strong, but having things get called that you aren't actually using in your code is... err... interesting.
14:32mkhow does the rationalize function work? (defn rationalize [num] (. clojure.lang.Numbers (rationalize num)) ); this seems recursive with no stopping condition, what am I missing here?
14:32hiredmanI can't just open the jar in lib/ in emacs and add printlns
14:34hiredmanI just put the finishing touches on a type that exposes the goog.storage methods (get,set,remove) but is also an event target, I'll have to see what advanced mode thinks of that
14:34nDuffmk: keep in mind that . is a special form, not a function
14:35hiredmanof course reify and deftype can't deal with closure types, so you have to monkey with it manually
14:35nDuffmk: ...so, rationalize is a symbol that indicates a method to call
14:35hiredman(defn F [] (js* "/*") (js "*/")) <-- comments out the "return ..." so your function can be a constructor
14:37mknDuff: ah. And I see now that the docs say (. instexpr (method args)) or (. instexpr method args). I thought only the latter was valid
14:38emezeskehiredman: It's very easy to use a clojurescript compiler checkout with lein-cljsbuild
14:38mkthat's strange. Is the paren'd form more efficient?
14:38emezeskehiredman: And that's where the printlns would need to go -- lein-cljsbuild just passes through any externs options untouched
14:39mkit seems substantially more confusing, since it differs from e.g. apply
14:39hiredmanemezeske: easy compared to just opening a jar in lib/ ?
14:39nDuffmk: it may differ from apply, but it's equivalent to -> / ->>
14:40emezeskehiredman: I'd say approximately as easy: https://github.com/emezeske/lein-cljsbuild/wiki/Using-a-Git-Checkout-of-the-ClojureScript-Compiler
14:40hiredmananyway, forget it, I have written off externs, maybe I'll care again later
14:40emezeskehiredman: sure
14:41mknDuff: ah, great. That helps, thanks
14:43cpineraHas anyone had success using lein-droid 0.0.8? I seem to be missing a dependency, [neko/neko "1.2.0-SNAPSHOT"] which I cannot find anywhere
14:45brainproxysuggestions for spitting out nicely formatted html, generated with hiccup, served by ring.. i tried tidy-up, but it complains about html5 tags like nav
14:46brainproxyi guess i could fork/hack tidy-up and see if I can have it run w/ more permissive settings, but was wondering if there's a ready-to-use alternative
14:46mkis clojure presently immune to decompilation?
14:48technomancythere are no known tools for turning bytecode back into clojure source, but it's still easy to see what it does by disassembling it
14:49kvothe9whois kvothe9
14:49mkthat'sa you!
14:50mkI thought that there was something that clojure did that broke decompilers
14:52mkI think I read that here, but maybe I misinterpreted http://news.ycombinator.com/item?id=708950
14:52nDuffmk: Clojure does sometimes generate valid bytecode that javac wouldn't. It's certainly imaginable that some decompilers couldn't handle the full range of source Clojure can create.
14:52hiredmanI started writing a bytecode -> datastructure thing, since disappointingly, asm's ClassReader doesn't give you info about method instructions
14:53AtKaaZhey guys, what am I missing here? http://cljbin.com/paste/50197ad5e4b08788cc6d3f6a
14:53hiredmanclass files are actually easy to pull apart, I've been basing my effort on https://gist.github.com/707630
14:53hiredmanAtKaaZ: read the exception
14:54AtKaaZyes I read but I don't understand:)
14:54cpineraAnyone working with Android?
14:54mkI understand that it's trivial to actually see the bytecode, I'm mostly curious about how far the ...legibility distance between the bytecode and the original source is. For unobfuscated java, that distance is almost nothing
14:55mkAtKaaZ: indentation. I'm not experienced enough to parse that easily :)
14:55AtKaaZoh wait, bit-xor was pasted as bitxor ?
14:55AtKaaZbut I pasted it correctly hmm
14:55AtKaaZmk, sorry, I just copy/pasted thatfrom a pdf in a book
14:56AtKaaZin repl the exception is: CompilerException java.lang.RuntimeException: Unable to resolve symbol: bit­xor in this context,
14:56mkAtKaaZ: pdfs are terrible, and sometimes elide - as end-of-line hyphens
14:56AtKaaZbut in the paste the dash was eaten
14:57AtKaaZmk, but why would first bit-xor work and second one not, they are both spelled correctly in my REPL (but in the paste something ate the dash)
14:57mkthe dash is missing in the repl as well, it seems. Highlight the dash, and type "-". It might be an imposter dash
14:57AtKaaZomg you were right
14:58AtKaaZhow odd, thank you mk
14:58AtKaaZso the pdf had evil dash... and the paste should've given me a clue
14:59mkthey're a devious lot
15:01vijaykiranHi all - I'm trying to run lein swank on a newly created project and getting "Exception in thread "main" java.lang.NoClassDefFoundError:"
15:01vijaykiranthis is with lein-2.0-p7
15:02vijaykirananyone seen this before ?
15:03jsabeaudryhmmm, missing lein deps?
15:03jsabeaudryI'm pretty sure I've seen that error before but can't remember what exactly I did to fix it, probably something trivial
15:04mkhttp://stackoverflow.com/questions/9285392/lein-swank-doesnt-work-after-lein-upgrade if you haven't seen. I just searched the exception , plus 'swank'
15:05AtKaaZmk, the evil dash was 173 and the normal one is 45, they look the same though heh
15:05vijaykiranhere's the full trace https://gist.github.com/3229826
15:05vijaykiranmk: did see that in google-search - but I get error even for repl
15:05technomancyvijaykiran: sounds like you have a bad plugin in your user profile interfering
15:06vijaykirantechnomancy: I have lein-pprint and lein-swank in the profiles.clj
15:07technomancywhat does `lein classpath` give you in the new project?
15:07mkAtKaaZ: good thing it wasn't one of the unicode foreign spies, or we might have never caught on (various cyrillic chars, for example; those don't disappear awkwardly like the dash did)
15:07vijaykirantechnomancy: https://gist.github.com/77552812859ca6b1fa06
15:08MosesHi, I'm looking to get started using Clojure with Vaadin, does anyone know how to set that up? I've seen some articles, but they all appear to be rather old and outdated.
15:08technomancyvijaykiran: if the clojure classes aren't being found, maybe your clojure jar in ~/.m2 is messed up
15:09vijaykirantechnomancy: ok, let me try with a fresh .m2
15:10MosesAnd by "appear", I mean I tried them and they didn't work because something was deprecated (like leiningen-war for example).
15:19nDuffIs there a better approach than (apply concat (for [...] [a b])) to have a for expression yield two values for each iteration (without putting them in nested vectors)?
15:21amalloynDuff: apply concat is usually most readable
15:21Iceland_jacknDuff: mapconcat
15:21Iceland_jackJust may be what you're looking for
15:21amalloybut if you want to be clever: ##(for [x (range 5), item [x (inc x)]] item)
15:21lazybot⇒ (0 1 1 2 2 3 3 4 4 5)
15:22Iceland_jack*mapcat
15:22Iceland_jack,(mapcat (juxt identity inc) (range 5)
15:23Iceland_jack)
15:23clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
15:23Iceland_jack,(mapcat (juxt identity inc) (range 5))
15:23clojurebot(0 1 1 2 2 ...)
15:23Iceland_jackBeen programming in elisp for too long
15:29mkis (biginteger ...) effectively deprecated?
15:36pjstadigmk: why would you say that?
15:36pjstadig~source biginteger
15:38mkpjstadig: due to clojure's bigint, and the fact that clojure arithmetic will never generate a biginteger. I guess it's a shortcut for (BigInteger. ...), but if that's the only time you'd ever use it, then it seems depreciated
15:38amalloy&(class (inc' Long/MAX_VALUE))
15:38lazybot⇒ clojure.lang.BigInt
15:40pjstadigBigInt doesn't implement all the same methods that BigInteger does, like pow
15:40pjstadigwhich makes it a bit awkward to work with
15:40pjstadigif you need to call those BigInteger functions
15:40pjstadigi think there's still need to make BigIntegers, especially if you're working with JDBC or any other kind of java interop
15:41mksure, but you shouldn't be using those via java interop. I think there's a clojure lib for that, but I agree that it's strange that it isn't in the core def.
15:42pjstadigthe BigInteger constructor takes a string, the biginteger function takes and coerces other things so its a bit more convenient
15:42mkyeah, I agree with java interop, but it seems safe to say that they're no longer part of clojure in the way that e.g. longs or BigDecimals are
15:42cemerickRatios know nothing of BigInt.
15:42pjstadigi would not go so far as to say that you "shouldn't" call methods like pow on BigInteger
15:42pjstadigthere's no easy alternative in clojure, and that's what interop is for
15:43mkcemerick: but do ratios expose BigInteger?
15:43cemerickI think it's safe to say that anything not labeled as deprecated isn't deprecated. :-)
15:43cemerickmk: yes
15:43mkdemo?
15:43clojurebotants-demo is https://gist.github.com/1093917
15:43cemerickmk: find yourself some sources ;-)
15:44mkcemerick: what sort of arithmetic on a ratio leaves me with a BigInteger?
15:44gfredericks &(type (* 3 1/3))
15:45gfredericks,(type (* 3 1/3))
15:45clojurebotclojure.lang.BigInt
15:45gfrederickshm
15:45mkI'm somewhat sure that they've been purged...
15:45hyPiRion&(type (let [a (/ 1 3)] (/ a a)))
15:45lazybot⇒ clojure.lang.BigInt
15:46cemerickmk: Ratio's only ctor accepts only BigIntegers.
15:46cemerick,(class (.bigIntegerValue (clojure.lang.Ratio. (biginteger 10) (biginteger 5))))
15:46clojurebotjava.math.BigInteger
15:46pjstadiglook, the point is there's probably a use for (biginteger x) when doing interop
15:46pjstadigand biginteger is not simply a wrapper for BigInteger.
15:46cemerickpjstadig: if only for HOF usage
15:47mkcemerick: constructing a ratio using java interop and getting the biginteger value using java interop is cheating :)
15:47michaelr525hello
15:48mdeboardhi
15:48mkpjstadig: right, though it's something like a convenience wrapper now, and (it seems) you'd never touch it unless you're doing interop
15:49pjstadig"unless you're doing interop" is a big reason for clojure's existence :)
15:49cemerickYou'd never touch proxy unless you're doing interop, either.
15:50mkpjstadig: clojure is close to its platform, but cljs is clojure as well
15:51mkif bigint really is gone except for interop, it makes understanding the whole bigint-biginteger thing much easier: "at one time, the clojure big integer structure was just java's BigInteger, but this was a mistake, and now clojure uses BigInt which gives correct hashcodes. You can still, of course, create BigIntegers using java interop, if you really need to"
15:52pjstadigclojure != cljs which is a major tenant of cljs' existence
15:52cemerickClojure is not ClojureScript is not ClojureCLR
15:53hiredmanit kills me that people are basing these "ports" on cljs
15:53cemerickPortability may eventually blur the lines enough so you won't care for many things, but they're hardly the same thing.
15:53hiredmanno vars, no reified namespaces
15:54mkI understand that jvm clojure is different from cljs, but I thought that clojure existed as a number of different close-to-platform implementations, clojure-jvm being only one among them and not primary
15:55hiredmanpart of why I am interested in disassembling java bytecode is to take that bytecode and do a "source" to source translation to make the .java parts of the clojure runtime available elsewhere without large amounts of rewriting
15:56ToxicFrogmk: no. Clojure is a JVM language first and foremost. cljs and clj-clr are related but secondary projects.
15:56pjstadigmk: that's correct, and rich was explicit from the beginning that clojurescript was not about trying to produce the same semantics on both the JVM and JS engines
15:57pjstadigso i don't see the point in talking about how biginteger is "only for interop"
15:57mkhiredman: perhaps I misunderstand, but why not use the .java source? Or why not simply treat the runtime as a .class black box that you can import as a lib?
15:58mkpjstadig: at one time, biginteger was much more important to clojure. It had the status of long, double, Future, Runnable, and BigDecimal. It no longer has that status.
15:59mkToxicFrog, pjstadig: who is correct?
15:59ToxicFrogmk: probably pjstadig
16:00hiredmanand translating one class based language to another should be fairly simple (jvm bytecode => python or ruby)
16:00mkit's probably true though that ...cljvm is the reference implementation, or something
16:00cemerickmk: biginteger was a Future, Runnable, and BigDecimal? o.0
16:01pjstadigi think of it more like clojure is an abstract concept including state management and persistent data structures and cljvm, cljs, and clj-clr and implementations of it
16:01pjstadigwith cljvm and clj-clr being more "full" implementations
16:02mkcemerick: same status. In the way that cljs numbers are all actually just javascript doubles
16:03mkthere's no longer any construct in clojure that's "actually just a" java BigInteger
16:03pjstadigi'm not actually convinced that BigInt was a good idea
16:04hiredmanpjstadig: it was a decision made before the hashing change
16:04pjstadigas much as clojure is about embracing the platform, there are all kinds of nasty little corners where it isn't a good citizen on the jvm
16:04mkhiredman: really? What were the reasons besides hashing?
16:05hiredmanI think motivated to have a bitint that hashed the same as long, of course now that hashing isn't exclusively .hashCode it's not required
16:05cemerickmk: Same goes for Future and Runnable; futures happen to be Futures, and functions happen to be Runnable and Callable. Those are interop affordances, not necessary, specified characteristics.
16:06mkas I understand it, clojure treats int, long, and BigInt as realizations of a single type, an integer number. The different realizations have different performance characteristics.
16:07gtrakis int any faster than long? I think it probably isn't
16:08dnolen_gtrak: int is slightly faster in Java - but there not enough support to really leverage that in Clojure
16:08mkcemerick: but BigDecimal, double, and long have the sort of status that I'm talking about, then?
16:09mkgtrak: long is actually faster than int, in the abstract way that I'm getting at, because integer multiplication takes an infinite or undefined amount of time for integer values above integer.maxvalue
16:11gtrakyour abstraction defines exceptions in term of values of time?
16:13mkgtrak: exceptions, overflows, and so on occur when the language tries to deal with various imperfections. Ideally, a language would, e.g. when multiplying two ints that overflowed, return a different realization of the type, probably a BigInt in this case
16:17mkwhen the value of a particular integer fell back within the range of long, or int, the language might replace it with a more performant realization
16:19mkif you're familiar with java string interning, you might imagine a thread, like the gc, that quietly interned strings, saving memory and improving the performance of the compareTo function
16:19gtrakmk: clojure used to promote numbers, those functions still exist, eg. +'
16:19pjstadigclojure doesn't autopromote anymore
16:20mkgtrak: yep, exactly :) clojure is a very high-level language for offering the ability to do that
16:20gtrakmk: that sounds like the job of a jvm optimization
16:20gtrakescape analysis, stack allocation, auto-unboxing etc..
16:21pjstadigAFAIK BigInt was created to fix a hashing bug that was actually a bug in Clojure's PersistentHashMap implementation, and it is not a drop-in replacement for BigInteger (in the Liskov Substitution sense), I think the vestigial appendage is BigInt, not biginteger or BigInteger
16:22mkgtrak: it can't be done at compile-time, if that's what you mean. But yes, it would probably be run on the jvm, like the gc is. Clojure's autopromotion is the same sort of process
16:23gtrakmk: right, you're basically defining a VM when you do stuff like that
16:23gtrakbrick-wall of abstraction
16:25gtrakit took java like 13 years to get fast?
16:25mkpjstadig: are you sure? I mean, you could technically implement a new hashing function for all your collections that returned the same hash for all realizations of numbers in integer, but that doesn't seem the right way to go
16:26pjstadigwell that's what Clojure has done
16:26gfredericksabedra told me that BigInt was for equality semantics? I don't think he got into the details though
16:26pjstadighashing used to be .hashCode but now theres RT/hash and clojure.core/hash
16:26mkgtrak: well, even the gc isn't a brick wall, since you can command it to collect, and sometimes system resources that need to be unloaded leak through the gc abstraction
16:27pjstadiggfredericks: clojure had already redefined equality for integer types
16:27gtrakmk: the actual behavior of System.gc() is left up to the implementation I believe
16:27pjstadigwhich was the problem with PHM, because it didn't use an appropriate hashing function that matched its equality function
16:28gfrederickspjstadig: yeah I don't really know what I'm talking about :(
16:28mkgfredericks: if both long and BigInt are mere realizations (not to be confused with subclasses) of an integer, then both should return the same value when thrown into hashCode, which they do.
16:28pjstadigmk: so does BigInteger
16:28pjstadigexcept in certain ranges
16:28pjstadignamely negative numbers
16:29mkpjstadig: then it's not a faithful realization of the "integer" type
16:30zelliowhat in the world does the error "Exception in thread "main" java.lang.AssertionError: Assert failed: Vanilla functions must have vars associated with them.
16:30zellio" mean and can I fix it without needing to defn everyhting
16:30hiredmanzellio: it is a cascalog exception
16:30hiredmanzellio: but yes, it basically means you need to defn your function
16:31zelliohiredman: okay, I thought so
16:31zelliojust wanted to make sure, thanks
16:32pjstadigmk: actually the problem is that java.lang.Long is not a faithful representation of the "integer" type (according to your definition)
16:32pjstadig,(.hashCode (Integer. -1))
16:32clojurebot-1
16:33pjstadig,(.hashCode (Long. -1))
16:33clojurebot0
16:33mkpjstadig: clojure now uses longs everywhere, I think for the same reason
16:34mkInteger, Long, and BigInteger are not compatible as representations of an integer type
16:34pjstadigthe Long class cuts its value into two 32-bit halves and XORs them together, which is the "correct" way to hash a long value in java
16:35pjstadigbut an Integer doesn't have two halves, and a negative Long when represented as two's complement happens to annihilate all of the bits
16:35pjstadigwhich is why the hashcodes come out different
16:35pjstadigcoercing a long to an int just discards the significant bits
16:35pjstadigwhich seems to be something like what BigInteger does in its hash
16:35pjstadigso the inconsistent class is Long
16:35mkclojure chose java Longs as the reference, and created the alternate BigInt realization of the "long-based integer" type, because values above maxvalue could not be realized as Longs
16:36pjstadigmk: you pretty much don't know what you're talking about at this point
16:37mkpjstadig: I suspect that I do
16:38mkpjstadig: do you understand what I mean when I say "realization"?
16:38mkI'm guessing you're familiar with referential transparency
16:39gtrakrealization sounds like reification
16:40mkgtrak: it might be, but I suspect that term might have baggage
16:40gtrakwhere's the term 'realization' coming from?
16:41mkit's not a standard term, but I don't know if there's a non-confusing term for what I'm referring to
16:42MosesIs it possible to replace leiningen-war with lein-ring, for someone trying to follow this tutorial? http://blog.rajithdelantha.com/2011/05/complete-guide-to-write-vaadin.html
16:42gtrakconcretization?
16:42pjstadigmk: please enlighten me, i'm all a twitter
16:43TimMcsnrk
16:43pjstadigyou're saying that BigInt was created to replace Long, or to replace BigInteger?
16:44mkusually, we think of different values as being tied to something like classes, or even prototypes or whatever. But you can "realize" a value under different "structures"
16:45mk(you can also realize the same value in different instances of the same structure. This is what happens with java strings.)
16:46technomancyMoses: I'm sure you could make it work, but it won't be a drop-in replacement
16:46MosesAm I better off just using the deprecated leiningen-war?
16:47pjstadighttp://en.wikipedia.org/wiki/Equivalence_relation
16:47MosesProbably right? At least for the purposes of the tutorial
16:47MosesI assume I can build it somehow outside leiningen and make it available to the app
16:47MosesThanks technomancy
16:48technomancynever heard of vaadin, so I couldn't tell you which would be easier
16:48mkpjstadig: something like that, but it can't be mathematical. Programmers care about the performance characteristics of potentially different realizations of a single value, which isn't the case for math
16:48gfredericksoh man; I remember vaadin
16:48MosesThat bad?
16:49gfrederickseh it was just a big pile of java classes; it might be good by java standards
16:49MosesI have a friend using it that thinks its made of win.
16:49mkjava's ArrayList and LinkedList are realizations of a list, but they have different performance characteristics under different functions
16:49pjstadigmk: how is this related to hashing?
16:50pjstadigdo you understand the fact that java.lang.Object.equals defines and equivalence relation? and the relationship between java.lang.Object.equals and java.lang.Object.hashCode?
16:51mkpjstadig: because hashCode is a function like any other. Different *realizations* of the same value must return the same resultant value, unless there's a program error (exception, overflow)
16:52mkint, long, and BigInteger are not realizations of the same value
16:52mkbut long and BigInt are different realizations of a single "longish integer" value
16:53pjstadigso what is int?
16:53pjstadignot a "longish integer"?
16:53cemerick"longish"?
16:54mkcemerick: produces the same value as long for the referentially transparent hashCode
16:55mkpjstadig: int is a type. long is a type with two realizations (long, BigInt). BigInteger is a third type.
16:55gtrakmk: hashcode is polymorphic on its first arg
16:55pjstadigarguments are realization
16:55pjstadigand "structures" aren't classes?
16:56pjstadigmk: what is different about the int type and the long type?
16:56gtrak,(.equals (int 1) (long 1)) ; mk: check it out
16:56clojurebotfalse
16:56pjstadigand what is the same about the long and BigInt as realizations of the long type?
16:57mkgtrak: right. All values have a hashcode, so polymorphic. But all realizations of the same value (whether long or int) produce the same value under all ref tranpsarent functions.
16:57gtrakturns out java doesn't consider them the same value
16:58mkgtrak: as expected?
16:58pjstadigmk: so the hashcode for -1 should be the same for an instance of Integer, Long, and BigInt?
16:59gtrakI thought one of your assumptions were that they're equal but different hashcodes
16:59mkpjstadig: they produce the same value under all functions. It's a big deal that they produce the same value for hashcode because of collections.
16:59pjstadigbut they don't
16:59pjstadig,(.hashCode (Integer. -1))
16:59clojurebot-1
16:59pjstadig,(.hashCode (Long. -1))
16:59clojurebot0
17:00mkgtrak: they are different types. long and BigInt are the same type, different realizations (one's a primitive, the other's technically a class)
17:00pjstadigi don't think BigInt is "technically" a class
17:00pjstadigi think it really *is* a class
17:01mkpjstadig: sure, that's fine by me
17:01gtrakwhat makes something a type vs a realization?
17:03mkgtrak: java classes aren't types. A type is a collection of values that work well together. A realization is a particular way that a value is represented, and different realizations have different performance characteristics.
17:04gtrakso like a domain?
17:05gtrakwiki says "a domain is any connected open subset of a finite-dimensional vector space." That seems to agree with saying ints and longs are different types
17:06mkgtrak: you might need to define domain, but probably not. Different realizations are identical mathematical values, in the same way that "1" and "one" 'realize' identical values
17:07mkgtrak: yes. Different realizations of a value are probably not in different domains.
17:07clojurebotexcusez-moi
17:07pjstadigmk: now i'm *sure* you don't know what you're talking about
17:07pjstadigbut that was fun
17:08pjstadigand also entirely unrelated to BigInt/BigInteger (somehow)
17:09mkpjstadig: I don't know enough about domains to explain the relation to them, and I pointed this out. As for everything else I've said, I'm fairly certain that I'm talking about a very definite abstraction
17:09mkpjstadig: bigint and biginteger are different types
17:09pjstadigok
17:09mkbigint and long are the same type
17:10pjstadigi don't agree
17:10mk"but they're... different, ones a primitive and one's a class!"
17:10gtrakmk: it seems what you're saying is a little informal at this point
17:10mkyeah, they are different. They're different "realizations" of the same type
17:10emezeskemk: What terminology are you using? Not Java terminology, it seems
17:10pjstadiggtrak: a littel?
17:11pjstadig*little
17:11stainhttp://imgur.com/7219T
17:11gtrakI don't know enough to be blatant authoritatively :-)
17:11staina bit confusing with those kind of brackets!
17:11emezeskemk: Are you using category theory terms?
17:11mkgtrak: I'm pretty sure this is easily formally defined, and I've come pretty close to a rather formal definition
17:12gtrakmk: it seems like it could be, yes, I agree
17:12emezeskemk: If you want to distinguish types in the category theory sense, you should probably be very clear about that, because in Java terminology, bigint and long are most definitely not the same type
17:12pjstadigmk: you have failed to show how bigint and long are the same "type" and bigint and biginteger are different types
17:13mkemezeske: as I understand it, I'm using "type" in that way. When I say type, I mean haskell-types. When I say value I mean clojure's definition of value.
17:13pjstadigwhat we have are an abstraction and several concrete realizations
17:13pjstadigbut a failure to show the connection between them
17:13pjstadigother than saying "they're different"
17:14mkemezeske: in java, bigint and long aren't the same haskell/category-type
17:14emezeskemk: Right. In this IRC channel, you should be aware that the overloaded "type" term by default resolves to Java Type
17:15tc34hello, looking for some suggestions on having a "rewriting" web reverse proxy. Is ring the right way to go?
17:15gtraktc34: any reason you can't use apache or something?
17:15mkpjstadig: bigint and long are the same type because, by design, nothing except performance would change if we made all longs into bigints.
17:16mkemezeske: my bad, thanks
17:16pjstadigso you're essentially talking about Liskov Substitution
17:17pjstadigthe problem is that BigInt and Long are not defined solely by their Java classes, but a combination of their java classes and some clojure semantics that overlay them
17:17tc34apache mod_rewrite, or nginx. But would like to define the config rewrites, redirects, url mappings in clojure code.
17:17pjstadigclojure could have just as easily defined the bits to make BigInteger work the way that BigInt does and BigInt would be unnecessary
17:18mkpjstadig: I'm not sure about Liskov, because it's a property of longs that they can't properly realize values above maxvalue, and a property of BigInt that they are substantially slower when thrown into the multiplication function.
17:18pjstadigthe only reason that BigInt was introduced instead of doing that, was that, at the time, the clojure machinery didn't exist
17:18gtraktc34: sounds a little... gruesome
17:18technomancytc34: unless you are planning on changing them at runtime, a clojure->nginx.conf compiler might be your best bet
17:20mkpjstadig: in java, BigInteger and long are not the same type. If clojure treated them as the same type, by treating isomorphic values in one as equal to those in the other, this would have been a mistake
17:21gtrakdoes a category theory type include all of something's polymorphic behavior?
17:21AtKaaZhow to create an alias deffn for defn?
17:21gtrakAtKaaZ: (def deffn defn)
17:21pjstadigmk: then clojure's already full of fail because it does that with Integers and Shorts and Bytes
17:21tc34technomancy: gtrak: thanks, i will try generating the config.
17:21pjstadigand walks all over equality
17:21mkgtrak: the way I understand types (from a programming, close to Haskell, not ct perspective) is that they are roughly defined by one or two functions among the values in that type
17:21AtKaaZgtrak, doesn't seem to work
17:21TimMcgtrak: Will that work? Might be some macro metadata problems.
17:21gtrakAtKaaZ: ah... oops
17:22gtrakyea, you have to write a macro
17:22TimMcI think Raynes or someone was writing a macro aliaser.
17:22RaynesA what?
17:22gtrakAtKaaZ: (defmacro deffn [& args] `(defn ~@args))
17:23mkpjstadig: yeah. And it also doesn't autopromote longs over maxvalue to bigint. On the other hand, I think that what I'm talking about now is one of the main reasons clojure now uses longs-bigints everywhere by default
17:23RaynesTimMc: Yeah, that isn't me.
17:23Raynes:p
17:23TimMc"or someone" = amalloy
17:23AtKaaZgtrak is it possible to ommit the args ?
17:24amalloythat sounds like something Raynes and i know better than to do
17:24gtrakAtKaaZ: well, macros take forms as input
17:24TimMcOh, maybe a var copier. I dunno.
17:24gtrakthe args are those forms
17:24TimMcAtKaaZ: What's the point of this anyway -- to make your code harder to read?
17:24gtrakTimMc: shh
17:25AtKaaZTimMc I just wanted to know how easily this aliasing can be done :)
17:25AtKaaZbut also the defn was for me def+n instead of def+fn when I first saw it
17:26pjstadigmk: "it doesn't promote longs over maxvalue to bigints" but earlier you said long and BigInt were the same type because we could replace every long with a BigInt?
17:26TimMcthey see me defn, they hatin
17:26pjstadigi'm confused as to what you are arguing
17:26pjstadigit's like trying to nail jello to the wall
17:26mkgtrak: for example, the integer type is a set of values that "work well together" under addition, and various functions derived from addition (integer negation, subtraction, mult, div, etc.)
17:26AtKaaZgtrak, thank you
17:27gtraknp
17:27TimMcmk: Work well? Hardly! int isn't closed under +.
17:27gtrakmk: I think the most we can say at this point is the integer type is a set of values
17:27mkTimMc: if you mean overflows, I mean the "integer" type, which is implemented in clojure using longs and bigints
17:28amalloyTimMc: useful does have code to alias things, including macros, but i don't really approve of it being used
17:28TimMcheh, I thought it might be or someone
17:28mkpjstadig: right. Clojure gives up correct representation or what have you when this would be impractical
17:29AtKaaZhow could I find out what ` does if I had only clojure repl at hand?
17:29hiredmanto people just not read docs?
17:29AtKaaZsomething like (doc or source ?
17:29gtrak(inc TimMc)
17:29lazybot⇒ 11
17:29nDuffIs there an easy way to conditionally insert something into a ->> pipeline?
17:30hiredman10 minutes of discussion of renaming/aliasing and no mention of the features in `use` and `require` ?
17:30mkAtKaaZ: see the answer to http://stackoverflow.com/questions/3704372/how-does-clojures-syntax-quote-work
17:31gtrakhiredman: that's some crazy voodoo
17:31mkAtKaaZ: there's no equivalent function, so you can't do a doc like you might (doc quote)
17:32cemerickhiredman: almost the first rule of programming is, other programmers don't read docs
17:33xeqican you mention the first rule?
17:33pjstadigi think that is the first rule
17:33Wild_Catxeqi: you'd know it if you read the docs! :p
17:33cemerickYes, but I can't mention the zeroth rule.
17:34aperiodicA robot must not harm humanity, or through inaction, allow humanity to come to harm?
17:35aperiodicoh, zeroth rule, not zeroth law
17:35pjstadigaperiodic: i like that, though, as the zeroth rule of programming
17:35mkgtrak: we can also say that the values in the integer type are realized in clojure by long and BigInt, that long and BigInt values have different performance characteristics, and that int and BigInteger have effectively been purged from clojure because clojure is on its way to distinguishing between types and what I call realizations, and because it doesn't want to deal with more than one integer type.
17:36hiredman"A robot must at all times set Will Smith up for witty remarks"
17:37AtKaaZrule #0: source code is also doc and binary
17:37mkor "a robot must at all times provide asimov with a good plotline"
17:37gtrakmk: I think I agree with that. It's a consequence of clojure being lovey-dubby with java and not having a clean-break
17:37pjstadigmk: you're still missing my point, which is that the same thing could have been accomplished with BigInteger, BigInt is/was unnecessary
17:38gtrakI guess we could have done it with protocols instead?
17:39pjstadigclojure.core/hash and RT/hash were added to create an "integer type" and the reason they were added was because of Long not BigInteger
17:39gtrakthis comes back to what I was saying earlier, a protocol implementation alters a java type in some sense, polymorphism is part of the type I think
17:39dnolenpjstadig: BigInt was added because of performance complaints
17:39pjstadigand clojure could just as well have implemented those functions for BigInteger instead of adding BigInt
17:39mkpjstadig: I think I addressed that. You can't do that by creating a special new clojureCollectionHash that returned the same value for longs and BigIntegers, because hashCode would still exist, proving that a long and a BigInteger aren't the same value. And hashCode isn't negligible, because it's the basis for half of java's collections.
17:41AtKaaZ,`(+ 1 2)
17:41clojurebot(clojure.core/+ 1 2)
17:41AtKaaZthat would've been quite the hint :D
17:41gtrakAtKaaZ: yes, I did that in my repl before posting it here :-)
17:42gtrakuser=> (macroexpand-1 '(deffn a [b c] d e))... (clojure.core/defn a [b c] d e)
17:42pjstadigmk: you are confusing java with clojure
17:42AtKaaZmk, thanks for the previous article link
17:43mkpjstadig: I'm not, because clojure "accepts" certain parts of java
17:43mkAtKaaZ: no problem :)
17:44pjstadigyes you are hashCode is a java function
17:44pjstadigand infact even in java you can define a hashmap using something other than hashCode
17:45pjstadigclojure doesn't use the same hashCode
17:45mkpjstadig: I mean that it doesn't just provide interop, but treats certain parts of the platform as if it were its own (long, double, BigDecimal, and Runnable are examples, I think)
17:45lucianmk: that *is* the interop as far as i'm concerned
17:46AtKaaZgtrak, in this: (defmacro deffn [& args] `(defn ~@args)) was the "`" really necessary though ?
17:46mkpjstadig: if you give clojure an immutable java collection, I don't think it treats it as a foreign body
17:47gtrakAtKaaZ: I think so?
17:47mkpjstadig: furthermore, clojure makes an effort to proudly implement various java interfaces, instead of hiding them
17:47gtrak,(read-string "(defn a [b c] d e)")
17:47clojurebot(defn a [b c] d e)
17:47gtrakhrm... maybe not
17:48AtKaaZwell I do get this: CompilerException java.lang.RuntimeException: First argument to def must be a Symbol; if I don't use ` :)
17:48pjstadigmk: if you look at Long and BigInt from the java perspective
17:48pjstadigthey are not equal
17:48pjstadigif you put them in a java collection they will behave accordingly
17:48gtrakAtKaaZ: could use regular-quote '
17:48pjstadigif you put them into a clojure collection they will behave differently
17:48pjstadigclojure adds a layer of equality and hashcode semantics on top of java
17:48gtrakAtKaaZ: you have to have a quote of some sort, otherwise you have to build the list yourself with cons
17:49AtKaaZgtrak, oh right that makes sense, silly me
17:49pjstadigit could have just as easily done so for BigInteger instead of introducing BigInt
17:49mklucian: you can have one without the other, I think. For example, you might build a language on the jvm but reject all java values, but offer ways to create them and call them, as second-class citizens. Or you might base your longs precisely on java longs, without offering any way to call Long.toString, for example.
17:49mkpjstadig: how would you have made a long 1 equal to a BigInteger 1?
17:50mkmake that a -1
17:50pjstadigRT/equiv
17:50AtKaaZ,`(defn)
17:50clojurebot(clojure.core/defn)
17:50AtKaaZ,'(defn)
17:50clojurebot#<ExecutionException java.util.concurrent.ExecutionException: clojure.lang.ArityException: Wrong number of args (0) passed to: core$defn>
17:50pjstadig,(.equals (Long. 1) 1N)
17:50clojurebotfalse
17:50pjstadig,(= (Long. 1) 1N)
17:50clojurebottrue
17:50AtKaaZ'(defn) this works for my repl
17:51mk,(class 1N)
17:51clojurebotclojure.lang.BigInt
17:51gtrakAtKaaZ: mine too
17:51AtKaaZ,*clojure-version*
17:51clojurebot{:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}
17:51pjstadigwhich brings me back to, "I'm pretty sure you don't know what you're talking about"
17:51technomancyclojurebot's not on the release?
17:51AtKaaZI'm on 1.3.0
17:52gtrakAtKaaZ: I think it's an issue with the stuff on top exposing the repl here, not the lang itself
17:52gtrak&'(defn)
17:52lazybot⇒ (defn)
17:52AtKaaZokie
17:52gtraklazybot does the right thing
17:52AtKaaZ&*clojure-version*
17:52lazybot⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}
17:52mkpjstadig: like I said, long (aka Long) and BigInt are the same type. Java .equals isn't a good measure of equality, I think (== is even worse).
17:53gtrakmk: it's the only one for java
17:53gtrak== is identity
17:53amalloyi'm betting clojurebot's macroexpander is a little broken. lazybot's certainly has been in the past, and that's way more likely than such a crazy error in the 1.4.0 snapshot
17:54mkgtrak: many programmers don't understand the difference between equality and identity, and treat == as a more-efficient but broken version of .equals
17:54pjstadigmk: like i said, you are conflating clojure and java
17:54lucianmk: sure, but that's still be interop, just less deep
17:54gtrakmk: turns out they're equally efficient in the case it doesn't break something
17:54pjstadigyes .equals fails to exemplify the integer "type"
17:54pjstadigthat's because it is Java's view of the world
17:54pjstadigclojure creates its own view
17:54pjstadigand it could just as well have extended that view to BigInteger instead of introducing BigInt
17:55mkpjstadig: if I'm in java, using a clojure function (which clojure explicitly endorses as a thing-to-do), and clojure informs me that a BigInteger and a long are equal, but java disagrees, that's a problem.
17:55pjstadigyes
17:55gtrakmk: a proper Object.equals() implementation first checks for identity
17:55pjstadigand it exists
17:55pjstadigthat's the way things work
17:55pjstadigyou just have to be "careful"
17:56AtKaaZ,(= 1M 1)
17:56clojurebotfalse
17:56AtKaaZ,(== 1M 1)
17:56clojurebottrue
17:56AtKaaZ,(.equals 1M 1)
17:56clojurebotfalse
17:57AtKaaZneat:)
17:57mkno, you don't. You just trust that java did separate its types correctly into BigInteger and long, and you avoid clobbering them into the same type.
17:57pjstadigi just showed you that BigInt and Long are not equal according to java, but are according to clojure
17:57mk,(= 1N 1)
17:57clojurebottrue
17:57pjstadigthe same is true for Integer and Long
17:57pjstadigand for sequence types
17:57pjstadigetc.
17:57AtKaaZ,(class 1N)
17:57clojurebotclojure.lang.BigInt
17:58pjstadigclojure creates its own view of the world which does not match at every point with java
17:59mkpjstadig: right. Initially, clojure treated them as if they were all realizations of the same type (which is ultimately the best view to take). This was a mistake which is now being corrected by dumping BigInteger and int.
17:59pjstadigno
17:59pjstadigBigInt
17:59pjstadigBigInt is the problem not BigInteger
17:59pjstadigBigInt is not equal to Long according to Java, but is according to Clojure
17:59mkpjstadig: are you saying that BigInteger and long are the same type?
18:00pjstadigthey could be
18:00pjstadigin the same way that BigInt and Long are
18:00pjstadigBigInt was and is unnecessary
18:00luciani think the same value of different types should always be equal, regardless of what java thinks
18:00mkjava's equality is imperfect, but works most of the time. I'm pretty sure different "realizations" are beyond the power of Java.
18:01gtrakif only there were an integer interface
18:02gtrakand an xml-configured integer factory
18:02lucianof course, it's not complete without xml
18:02mklucian: there's no such thing as a same value in different types. There are isomorphisms, but each value has exactly one type. Null is a practical hack.
18:02lucianmk: numerical value
18:03kaoD_hi
18:03mklucian: 2 and 2.0 are not the same numerical value
18:03clojurebotHuh?
18:04gtrak(inc clojurebot)
18:04lazybot⇒ 11
18:04lucianmk: 1 and 1M sure are. floats are debatable i guess
18:04mk(class 1M)
18:04mk,(class 1M)
18:04clojurebotjava.math.BigDecimal
18:05lucian,(class 1)
18:05clojurebotjava.lang.Long
18:05gtrak,(= 1 1.0)
18:05clojurebotfalse
18:05lucian,(class 1L)
18:05clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: Invalid number: 1L>
18:05gtrak,(= 1 1M)
18:05clojurebotfalse
18:05lucian(class 1.0)
18:05lucian,(class 1.0)
18:05clojurebotjava.lang.Double
18:05AtKaaZgtrak what is that inc nick for ?
18:05gtrakAtKaaZ: reputations
18:05gtrak(karma clojurebot)
18:06gtrak&(karma clojurebot)
18:06lazybotjava.lang.RuntimeException: Unable to resolve symbol: karma in this context
18:06gtrakhrm
18:06mkAtKaaZ: the bot implied that I was being confusing, which was funny. It triggers on the word "are", in case you want to add something to its dictionary
18:07metellus,(karma clojurebot)
18:07clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: karma in this context, compiling:(NO_SOURCE_PATH:0)>
18:07AtKaaZoh that's awesome I was about to ask why it responded
18:08AtKaaZ(find-doc "karma")
18:08AtKaaZ,(find-doc "karma")
18:08clojurebotnil
18:08mkI think the point is that longs and BigIntegers are not the same type, at the very least in java. Clojure should and generally does obey that.
18:09TimMc$karma clojurebot
18:09lazybotclojurebot has karma 11.
18:09luciani don't think clojure should pretend they're the same type, but i do think it should consider them equal and hash them to the same hting
18:09TimMcYou can /msg lazybot to query for that.
18:10AtKaaZ,(doc =)
18:10clojurebot"([x] [x y] [x y & more]); Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner. Clojure's immutable data structures define equals() (and thus =) as a value, not an identity, comparison."
18:10kaoD_I miss wildcards in multimethods (ala pattern matching), is there any way to fake it?
18:10kaoD_"compares numbers and collections in a type-independent manner" <- that's odd
18:10lucianthat's flat untrue
18:10mklucian: that's what it means to be the same type. Equality checks if two representations/instances/realizations of a value are the same value. A value can't have more than one type.
18:11AtKaaZ,(doc ==)
18:11clojurebot"([x] [x y] [x y & more]); Returns non-nil if nums all have the equivalent value (type-independent), otherwise false"
18:12mknote that equivalent is not equal
18:12goodieboywhat exactly does the clojure hash function do?
18:12goodieboyare there docs on how it works?
18:12AtKaaZ,(and (= 1 1.0) (== 1 1.0))
18:12clojurebotfalse
18:13mkgoodieboy: see http://clojuredocs.org/clojure_core/clojure.core/hash
18:13goodieboyahh String hashCode, thanks!
18:14AtKaaZhow could I do a xor between those two returns ?
18:14AtKaaZin place of "and"
18:14mkgoodieboy: Object hashCode. It doesn't do toString.hashCode, in case that's what you meant.
18:14goodieboymk: thanks!
18:14mknp :)
18:15mkAtKaaZ: xor is (A and -B) or (B and -A)
18:16mkalternatively, (A or B) and not(A and B)
18:16AtKaaZI mean like, (bit-xor true false) but I need the boolean to not be boolean:D
18:16AtKaaZwithout repeating
18:16AtKaaZthe A and B :)
18:17AtKaaZany way to convert boolean to bits ?
18:18mk(defn xor [a b] (or (and (not A) B) (and (not B) A))
18:18kaoD_AtKaaZ: what do you mean boolean to bits?
18:18kaoD_booleans are bits
18:19vijaykirantechnomancy: tried removing .m2 and reinstalling lein - but still no luck on "Exception in thread "main" java.lang.NoClassDefFoundError:" with 'lein repl'
18:19kaoD_(internally of course)
18:19AtKaaZ,(bit-xor true false)
18:19clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: bit operation not supported for: class java.lang.Boolean>
18:19AtKaaZthat's quite ok mk :)
18:20mkkaoD_: booleans are technically not really bits. I take it AtKaaZ wants to drop booleans into bits in order to do (bit-xor) as a way of defining an (xor), but there's a better alternative
18:21AtKaaZyeah, but I was hoping for something easier than having to def
18:21gtrakBooleans are a realization of bits, err wait... bits are the realization of booleans...
18:21kaoD_mk: booleans are bits in memory, just like any other value
18:21kaoD_I get what he means, I understood it the other way around
18:23hiredmanAtKaaZ: def creates vars, I of course have no context, no idea what your code looks like or is doing, but you almost certainly want let not def
18:23AtKaaZ,(bit-xor (if (= 1 1.0) 1 0) (if (== 1 1.0) 1 0) )
18:23clojurebot1
18:23technomancyvijaykiran: sorry, without knowing more about your setup it's impossible to say what's wrong
18:24gtrakI've never avoided def out of difficulty
18:24AtKaaZtoo ugly i know
18:24mkbooleans like all things are represented by bits. Or pixels. Or ink. Or holes in a surface. Or rotating pieces of metal. But those details are usually irrelevant.
18:24AtKaaZit was a need to use bit-xor for this: ,(and (= 1 1.0) (== 1 1.0))
18:24AtKaaZor any xor :)
18:24mkbooleans exist in the mind, man
18:25AtKaaZi like learning like this, it's exploratory somehow
18:25AtKaaZwhich implies fun;)
18:26mkso like, xor instead of and?
18:26vijaykirantechnomancy: okay - thx! Will try to figure out what I did wrong.
18:26AtKaaZyes
18:26AtKaaZ,(= 1 (bit-xor (if (= 1 1.0) 1 0) (if (== 1 1.0) 1 0) ))
18:26clojurebottrue
18:27AtKaaZaka return true if those 2 are different
18:27mkxor is what you get when all of your things are different from each other
18:28kaoD_mk: they're not that irrelevant, specially in languages where representation is quite "volatile" (i.e. languages that allow casts)
18:28kaoD_although in a Clojure context you're completely right
18:28mkperhaps something like (not (= (boolean A) (boolean B)))
18:29AtKaaZnice, much simpler mk
18:29mkkaoD_: when a cast is performed, one value goes in and a totally different value comes out
18:29AtKaaZ,(not= 1 2)
18:29clojurebottrue
18:29AtKaaZawesome
18:30kaoD_mk: nope
18:30AtKaaZ,(not= (= 1 1.0) (== 1 1.0))
18:30clojurebottrue
18:30kaoD_not at bit-level
18:30kaoD_(which is what we where talking about right?)
18:30mkkaoD_: for example, in javascript you might think "1" and 1 are equal, but they are not. As a convenience, javascript offers type conversion on one of its equality functions
18:31kaoD_okay, let me rephrase that
18:31kaoD_languages that allow hardware-level casts
18:31mkkaoD_: there's no such thing as the bit level if we're talking about values. Values don't have a bit level. Realizations of values do.
18:32kaoD_ok you can go all technical, but bits do still matter
18:32AtKaaZmk, definitely the right way is to use not equal instead of xor, but I really wanted to see that xor in action back then :D
18:32kaoD_e.g. what's the value of a boolean cast to an int in C? that sort of details are quite important
18:33kaoD_in-memory value != realized value
18:33gtrakin C the semantics are conflated with the hardware, much like clojure and java
18:33mkthe reason values don't have a bit level is because (gimmebitlevel 1) can't be a function. Two different ones might be realized in different places in the memory, or whatever. Sometimes, floating point 0 and -0 are treated as exactly the same value.
18:33kaoD_mk: we're definitely discussing about a semantic issue
18:33kaoD_when I say values I mean in-memory values
18:34kaoD_not realized values
18:34mkkaoD_: a boolean doesn't have a value when cast to an int. You now have a different value in front of you. A potato went in, a carrot came out.
18:34kaoD_I must repeat: when I say values I mean in-memory values
18:34kaoD_a boolean has a constant value
18:35kaoD_even when cast to int
18:35kaoD_because it's just a region in memory
18:35mkkaoD_: you'll need to correct your terminology. There's no such thing as an "in memory" value.
18:35kaoD_hmm
18:35kaoD_well, I do think so
18:36kaoD_a region in memory is a series of bits
18:36kaoD_those bits are an (unrealized) value
18:36mkkaoD_: a boolean is an abstract concept, existing in the platonic realm, or in our minds. We can represent "true" by writing T, or flipping bits, or whatever
18:36mkkaoD_: what do you mean by unrealized?
18:37kaoD_mk: sure, but it turns out that we're dealing with computers and that philosophical stuff is irrelevant
18:37mkI would have called them realized, because they ultimately represent a boolean
18:37kaoD_no, they don't represent anything
18:37kaoD_it's representation is volatile
18:37kaoD_now it's an int, now it's a boolean
18:37kaoD_and the bits didn't even change
18:38ThatOneGuyI believe a boolean is a single byte that is 1 or 0
18:38kaoD_ThatOneGuy: nope
18:38kaoD_a boolean is as wide as your hardware registers usually
18:38ThatOneGuywell in C the std.bool is an int of 1 or 0
18:38kaoD_for efficiency's sake
18:38ThatOneGuywhy is that more efficient?
18:38mkkaoD_: the philosophical stuff is what you do when you code. You're trying to represent your mental models of things faithfully, and my mental models don't include bits. If they did, I wouldn't be able to reason about things efficiently.
18:39ThatOneGuyare you talking about just doing pure boolean logic in the CPU?
18:39kaoD_mk: yep but C is a bit different because it ties you to hardware so you can't abstract as much with basic data types
18:39ThatOneGuyis that why its more efficient
18:39mka boolean is not a byte that is equal to 0 or 1. A boolean is a type having two possible values, True or False.
18:39kaoD_mk: not in C
18:39kaoD_well
18:39ThatOneGuyyeah we are talking about C ... low level stuff
18:39kaoD_let me rephrase that
18:39ThatOneGuyin the clojure channel :P
18:40ToxicFrogkaoD_: C doesn't even have a boolean type, it has boolean interpretations of integer types
18:40ToxicFrogConceptually, mk is right
18:40kaoD_just a sec, let me rephrase that
18:40mkkaoD_: then either C does not have values, or it has values, and an integer really isn't a boolean and C == is dead-broken.
18:40kaoD_you're right in the "boolean is just true/false" argument
18:41ToxicFrogThe fact that some languages might choose to represent a boolean as a byte and true as nonzero and false as zero doesn't mean that "boolean" and "integer" are synonyms.
18:41kaoD_but you can't forget that your type is represented with some other value (not related to the type)
18:41kaoD_your typed-value, I mean
18:42mkit isn't represented by a value. ink isn't a value.
18:42kaoD_there are two values here: the conceptual and the physical ones
18:42mkIn C, you can pretend that a 0 is a boolean, but it really isn't
18:42kaoD_mk: yes, it's a value
18:42kaoD_a series of zeroes and ones
18:42kaoD_in your memory
18:42mkthat's not a value
18:42ThatOneGuyso converting a C code
18:42ThatOneGuyif(*num) {
18:42ThatOneGuysomefn();
18:42ThatOneGuy}
18:43kaoD_then what it is?
18:43mkand it's a bunch of magnetic junk, not 0 and 1
18:43kaoD_information
18:43kaoD_nope
18:43kaoD_because it turns out your machine interprets those electromagnetic forces as zeroes and ones
18:43kaoD_in an organized and documented fashion
18:43kaoD_which is already abstracted in the CPU
18:44kaoD_there's a value there and you can represent/realize it in whatever fashion you want
18:44kaoD_there's a typed value and a hardware value
18:44kaoD_and the value is there in whatever base/representation you want to see it
18:44mkyour machine never interprets them as anything. It's not conscious. We presume that pulses of energy move around, causing us to eventually see screens with numbers on them.
18:44kaoD_I don't care, it's still a value
18:44kaoD_mk: what the fuck?
18:45kaoD_are you really discussing about machine's conscience?
18:45mkkaoD_: your computer doesn't know what a 0 or a 1 is.
18:45kaoD_humm
18:45kaoD_the CPU does indeed
18:45kaoD_it doesn't "know" in the traditional sense
18:45mkkaoD_: no, that's what you seem to be suggesting when you attribute human qualities like "interpreting as 0 or 1" to a machine
18:45ThatOneGuyhaha you guys are fighting over the interpretation of 'know' (in this small segment)
18:46kaoD_but it's just a way to use language and say in short that "opcodes in CPUs are tied to the data stored in memory as bits"
18:46mkThatOneGuy: justified true belief, man
18:46kaoD_you can't separate CPU opcodes from data!
18:47kaoD_CPU opcodes deal with that "magnetic junk" as bits
18:47kaoD_you're thinking too abstract
18:47kaoD_we're dealing with a electromagnetic machine after all
18:47kaoD_it's programmed
18:47ThatOneGuyI would say the machine doesn't not perceive therefore it does not know what values it is manipulating, but we can say its knows the values because we are thinking in the abstract mindset of the machine running instructions.
18:47kaoD_deterministic
18:47kaoD_ThatOneGuy: that's a good point too
18:48kaoD_ThatOneGuy: not sure if I said this yet, but booleans are as wide as your registers because if booleans aren't aligned, extra operations must be performed in CPU
18:48mkwe don't need to talk about this at this level. A boolean value like true is never equal to an integer value like 1, or a byte value like 00000001.
18:49kaoD_mk: well, talk to C then
18:49ThatOneGuycan you guys answer a clojure question for me?
18:50ThatOneGuyjust a quick aside.
18:50ToxicFrogWe can try!
18:50ThatOneGuywhat is the difference between (some-fn another-fn) and (some-fn #'another-fn)
18:55ThatOneGuy?
18:55aavThatOneGuy: another-fn will evolve to the function, bound to var names another-fn, and #'another-fn will evolve to var named another-fn
18:55mkkaoD_: I'm talking about C, and C doesn't try very much at all to have types or values
18:55aperiodicThatOneGuy: the second thing references the var directly, so if later another-fn is redefined, it will still be using the old value
18:56mkkaoD_: watch the start of http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey
18:56ThatOneGuyso when threading does either one work? and which is more idiomatic?
18:57ThatOneGuy(-> another-fn some-fn some-fn2 some-fn3)
18:57technomancyThatOneGuy: you would add the var indirection if you would want reloads to work
18:57technomancyotherwise the function value is fixed at compile time
18:59ThatOneGuyso when that code is compiled it evals another-fn to whatever function it is and puts it in there. where as #'another-fn would eval to the var that could be rebound in the future?
18:59technomancyexactly
19:00ThatOneGuyI am mostly being confused by this function in clj-http https://github.com/dakrone/clj-http/blob/master/src/clj_http/client.clj#L456
19:00ThatOneGuywell actually look at the function below it
19:00ThatOneGuybecause that is where it passes the #'core/request into the thread
19:00dakroneright as I push to the repo to mess up your lines numbers ;)
19:01ThatOneGuyreally? wow what are the odds
19:01ThatOneGuycorrected: https://github.com/dakrone/clj-http/blob/master/src/clj_http/client.clj#L459
19:02technomancydakrone: are you sticking with that meta syntax explicitly for 1.1 support?
19:04dakronetechnomancy: I only support 1.2 and up
19:04dakroneis ^:foo added in 1.2? I thought it was added in 1.3
19:04technomancyyeah, you can use it in 1.2
19:04dakronethen I'll have to change that
19:04technomancyerr--^{:key "value"} is in 1.2
19:04hiredmantechnomancy: no ^:foo is 1.3
19:05technomancythe only place I still see #^{:key "value"} is swank
19:05dakroneokay, that's what I thought
19:07technomancyanyway, you're safe to nix the #
19:09dakronenixed
19:09nicholasfI'm only getting started with clojure. I'm writing a model class, and I find I keep stepping on the function names from clojure.core - e.g. count, find, get
19:09nicholasfwhat do people do in this circumstance?
19:10nicholasfis there like a convention for working around this, or do you just override the core functions in this namespace and use them explicitly whenever required there?
19:10hiredmannicholasf: don't make classes
19:10nicholasfer, sorry, this isnt a class
19:10nicholasfthat was just a habit - it's not a type or a record
19:10nicholasfjust a namespace
19:10hiredmannicholasf: clojure doesn't have "classes", so obviously not
19:11ThatOneGuydakrone: if I do (client/get "google.com" {:cookies (cookies/get-cookies cs)}) the Cookie field in the headers is just an empty string. Bug? or incorrect sytax?
19:11nicholasfhiredman: so what's the convetion here?
19:11nicholasfe.g., my models.foo namespace wants to have a find method
19:11nicholasfa find function, rather
19:11technomancynicholasf: use the clojure.core version of count, get, etc
19:11technomancydon't define your own
19:12nicholasftechnomancy: my version of count, get goes to mongodb
19:12nicholasfin this namespace
19:12hiredman:(
19:12nicholasfhttps://gist.github.com/fcb3dd33dc23aa7fbc61
19:13nicholasfso should tally be count, user-count, or tally?
19:13Bronsayou're missing a parenthesis in create
19:13hiredmanseveral unhappy things, first of which is: why are people still using mongodb?
19:13nicholasfyeh, that's not the question
19:13nicholasfo ffs
19:13nicholasfforget I asked
19:13clojurebotexcusez-moi
19:13hiredmannicholasf: count-users
19:13nicholasfhiredman: thanks
19:14nicholasfhiredman: user/count-users seems redundant as a DSL tho
19:14hiredmannicholasf: don't write a dsl
19:16hiredmannicholasf: if you really want to write a dsl, the way to do it is not with many functions, it is with a data structure that describes an operation and a single function that interprets the datastructure
19:17hiredman(q {:fetch-count :users}) and (q {:find {:users {:username username}}}) vs. what you have
19:18hiredmanbut mongodb is dumb, so you'll need a pretty thick skin if you want to persist in using it
19:18bprhiredman: mongodb is dumb in comparison to what?
19:19bpror, if you'd rather answer: why is mongodb dumb?
19:19hiredmanbpr: real databases people use
19:19aperiodicnicholasf: FWIW, i have a simple namespace that redefines get & set, that i only every require, never use. you can resolve the clashes with (:refer-clojure :exclude [...]) in that namespace's ns macro, and refer to them by fully qualifying the symbol if you need them
19:19bprhiredman: haha
19:19nicholasfaperiodic: thanks mate - that sound spot on
19:19aperiodicnicholasf: it probably makes hiredman :(, but so do a lot of things ;)
19:19hiredmanbpr: mongodb is the worst parts of the nosql movement with the worst parts of rdbms
19:24timoxleyhiredman why
19:24gfredericksmongodb is webscale
19:27hiredmantimoxley: the "solution" used to "scale" mongodb is the same as used to scale rdbms, namely sharding, but you throw away the years of engineering work that have gone in to a mature rdbms
19:28nicholasfhiredman: that makes no sense
19:28timoxleyhiredman mongo isn't an rdbms
19:28hiredmanI am aware
19:28nicholasfyou're saying that mongodb isnt worthwhile because it uses a similar scaling mechanism to an rdbms, so you shouldn't use mongodb
19:29nicholasfand that entirely precludes why you'd choose it over a rdbms
19:29timoxleyhiredman how do you feel about similar tech like couch?
19:29hiredmannicholasf: if anything you should choose an rdbms over mongo because of the query language, the project maturity, etc
19:29hiredmantimoxley: couch is cute
19:30technomancycouch at least doesn't tune its out of the box settings to discard data in the case of failure just in order to come out looking better in superficial benchmarks =\
19:30timoxleytechnomancy cheap shot
19:31timoxleythey have explained that one over and over
19:31timoxleyanyway
19:31hiredmancouch, last I checked didn't have a good scaling story either
19:31hiredmanand was pretty slow, if I recall
19:31technomancybigcouch supposedly implements dynamo on top of couch
19:32hiredmanwe used riak for a while at work, it was not pleasant, all kinds of issues, but that was some time ago
19:32technomancybut anyway couch doesn't make outrageous claims at being crazy fast and scalable
19:33hiredmanmy suggestion is to use a sql database (sharded or not, etc) unless you cannot
19:34hiredmanand for a new project there is no reason not to
19:35hiredmansql is wonderful compared to shoveling around document store nonsense
19:35hiredmanhttp://static.lolyard.com/lol/key-value-store.png
19:35hiredmanto be fair we wrote our mapreduces in js
19:36timoxleyhiredman rdbms wonderful for certain things, not so wonderful at others. use right tool for the job. rdbms is not a silver bullet.
19:38aavhiredman: how would you store documents of arbitary structure in rdbms? implement key-value store on top of it?
19:38hiredmanaav: it depends
19:38hiredmantimoxley: sure
19:38timoxleyhiredman and don't be so quick to bury something. I learned a lot of new techniques for working with denormalised data by using mongo that I'd have never got using a sql db
19:39hiredmanI am not quick to bury it
19:39timoxleyjust for that on its own was worth it.
19:39hiredmantimoxley: *shrug* it may be worth something as a teaching tool, but not as a datastore
19:41hiredmanI am not advocating singgle system of record style rdbms, I think the best thing to come out of nosql is the acceptance of fragmented federated data storage
19:41hiredmanand picking data storage for the job not, not the other way around
19:41bpri would agree with that
19:41hiredmanthat being said, sql databases offer a lot of great things that most (all?) nosql stores lack
19:42aavhiredman: would you agree that for some jobs mongo is the right choice?
19:42hiredmanlike real proper transactions (for some sql dbs and sort of okish, still better than nothing for others)
19:43timoxley"real"
19:43hiredmanaav: if you are storing data for the local boy scout troupe
19:43aavhiredman: got your point :)
19:44hiredmaneven then I would look in to rds from amazon
19:44aavhiredman: for my scouts, external data service is not an option
19:45hiredmanaav: no cloud computing merit badges?
19:46aavhiredman: they are very paranoid about their data :) lot's of secrets, you know... :)
19:56aavhiredman: it's not very easy. if I say - i need an rdbms - i would not be allowed to take, postgres, or mysql. because, there is _official_ rdbms - oracle, and hopless IT who is in charge of it. and if I say, that i'm using some special data storage for documents, which is not, even a database - it's no problem.
19:58stainhihi
20:13TimMchiredman: People "actually use" mongo. I don't think you want to use that as an argument one way or another, though.
20:52Raynes&(zero? "0")
20:52lazybotjava.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
20:52Raynesgfredericks: Is that what you mean?
20:52amalloygfredericks: #(== 0 %), then?
20:53xeqi&(doc zero?)
20:53lazybot⇒ "([x]); Returns true if num is zero, else false"
20:53gfredericksyeah
20:53gfredericksah it has "num" in the docs
20:53Raynes&(== 0 "0")
20:53lazybotjava.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
20:53xeqi&(= 0 0M)
20:53lazybot⇒ false
20:54Raynes&(== 0 0M)
20:54lazybot⇒ true
20:54gfredericks&(time (remove zero? (repeat 100000 0)))
20:54lazybot⇒ "Elapsed time: 234.916051 msecs" ()
20:54RaynesPop goes the weasel.
20:54gfredericks&(time (remove #(= % 0) (repeat 100000 0)))
20:54lazybot⇒ "Elapsed time: 226.450155 msecs" ()
20:55gfredericks&(time (remove #(= % 0) (repeat 10000000 0)))
20:55lazybot⇒ "Elapsed time: 252.81306 msecs" ()
20:55gfredericksoops
20:55xeqi&(time (remove (partial = 0) (repeat 1000000 0)))
20:55lazybot⇒ "Elapsed time: 260.826661 msecs" ()
20:55gfredericks&(time (pr-str (remove zero? (repeat 100000 0))))
20:55lazybot⇒ "Elapsed time: 487.911061 msecs" "()"
20:55gfredericks&(time (pr-str (remove #(= % 0) (repeat 100000 0))))
20:55lazybot⇒ "Elapsed time: 340.684657 msecs" "()"
20:55gfredericksoh weird
20:56gfredericksso never use zero? for anything must be the lesson
20:57xeqi&(source zero?)
20:57lazybotjava.lang.RuntimeException: Unable to resolve symbol: source in this context
20:58gfredericks$source zero?
20:58lazybotzero? is http://is.gd/8YNLhA
20:59gfredericksI love that it appears right under the "sequence fns" heading
20:59Raynes$examples zero?
20:59lazybotYou must pass a name like clojure.core/foo or, as two arguments, clojure.core foo.
20:59Raynes$examples clojure.core/zero?
20:59lazybothttps://www.refheap.com/paste/3976
21:00RaynesOne day I hope I'll learn to use this bot.
21:00xeqi$examples clojure.core/juxt
21:01lazybothttps://www.refheap.com/paste/3977
21:01aperiodicwhere do those examples come from?
21:01xeqiah, it queries clojuredocs
21:01aperiodicwhy not just link to clojuredocs?
21:01xeqiI was hoping for some sort of fancy test.generative data set generation
21:02Raynesaperiodic: I'm not sure if gives a link to clojuredocs.
21:02Raynesaperiodic: But refheap is cooler.
21:02Raynesif cd-client*
21:03aperiodicRaynes: it doesn't link back, even
21:03RaynesIs there any legal obligation to give credit?
21:04Raynesfrrl
21:05aperiodicRaynes: no legal obligation, no. i think it's crummy to take their examples and not even link back, especially since it means it's not apparent that you can add to/improve those examples
21:06Raynesaperiodic: It's an open source project, btw.
21:06Rayneshttps://github.com/flatland/lazybot
21:06aperiodicRaynes: ok, expect a path in your near future
21:06aperiodic*patch
21:06RaynesAppreciated!
21:06amalloy"expect a path in your near future" sounds like a fortune cookie
21:07RaynesIf cd-client gives a link clojuredocs, I'm fine with just using that link rather than refheaping it. I only recall it giving me the examples themselves though, but I certainly could be wrong.
21:08RaynesSo it may very well be that I'm not an asshole and cd-client is an asshole instead. If so, we can just add a "From clojuredocs" to the paste.
21:09aperiodicwell, i will do my darndest to have it provide a link back to the relevant examples, one way or the other
21:30TimMccd-client had better build the links for you; clojuredocs does its own symbol munging to build doc URLs
22:55dakroneRaynes: I believe the cd-client method returns a map with a :url key
23:23Raynesdakrone: Awesome
23:59ro_stso i'm using goog-jar for my clojurescript project. how do i get a more up to date version of the google library than what's in goog-jar?