#clojure logs

2013-12-11

00:00TEttinger,"\uff"
00:00clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Invalid character length: 2, should be: 4>
00:05cljrdcolish: i was aware of that notation, but i basically am trying to get to a 16 character string, if it was python it would be something like 10 * "\x00" + 2 * "\xff" + "\x7f\x00\x00\x01"; if I used 0xff in java/cojure, it is easy enough to create a vector of those, but i dont know how to get th the string representation, if i do (str 0xff) -> "255"
00:06uvtc~botslack
00:06clojurebotNo entiendo
00:07cljri was using something akin to "\u007f\u0000\u0000\u0001", but then i realized that 0x7f != "\u007f"
00:09alandipert,(apply str (map char (repeat 5 0xff)))
00:09clojurebot"�����"
00:10cljr,(char 0xff)
00:10clojurebot\�
00:10cljralandipert: i believe that is what i needed, thanks
00:10alandipertcljr: np
00:19dcolishif you can use it, commons-codec has some niceties for working with Hex strings
00:19bitemyapparrdem: http://i.imgur.com/MJgBsoR.jpg
00:19arrdembitemyapp: you're about three hours early
00:20bitemyapparrdem: given finals, figured I'd let you sleep more
00:20arrdembitemyapp: the final is at 9am. my scheduler is tied voting for and against sleep.
00:21bitemyapparrdem: sleep
00:21trinaryalways sleep.
00:29arrdemthe effort will be made then
01:47SegFaultAXbitemyapp: I need to borrow your gun.
01:47bitemyappSegFaultAX: ...
01:48bitemyappSegFaultAX: okay, what?
01:48SegFaultAXbitemyapp: I must recreate: http://i.imgur.com/pyqtppN.jpg
01:49arrdemSegFaultAX: ............................. why
01:49bitemyappSegFaultAX: my gun is too pretty for it to work.
01:49SegFaultAXHaha
01:49bitemyappyou need a fugly handgun like that dude's.
01:49SegFaultAXI already have the sweater and everything.
01:49bitemyappI'm srs.
01:49arrdemSegFaultAX: go find a pair of gold deagles. it'll be great.
01:49bitemyappMasha is not to be trifled wish. She has feelingks.
01:49SegFaultAX.357 magnum would be perfect.
01:49bitemyappwith*
01:49bitemyappI do not own a .357
01:52bitemyappSegFaultAX: http://i.imgur.com/vi2KPFY.jpg
01:53bitemyappSegFaultAX: Mk23
01:54arrdemdat. can.
01:54bitemyapparrdem: ikr
01:56arrdemI'm gonna have to see if Reds has one of those next time I make a trip....
01:56bitemyapparrdem: I'm going to HATE YOU REALLY HARD from over here in California.
01:57arrdembitemyapp: bro. texas. I may wind up with a gunsafe in my appartment next year. you could too :P
01:57bitemyappWatching Zizek while hacking Haskell makes me feel intense.
01:57bitemyappand coke-addled.
01:57arrdemHOW THE SHIT IS THAT GUN $1905
01:57{[^-^]}Is there anywhere at all I can see complexity of clojure data structures?
01:57{[^-^]}in big-O notation
01:57bitemyapparrdem: H&K
01:58{[^-^]}because googling for it is a huge fail
01:58arrdembitemyapp: that's friggin silly
01:58bitemyapp{[^-^]}: clojure.org
01:58bitemyapparrdem: H&K is nazi brick of high price
01:58bitemyapparrdem: is par for course, comrade.
01:58arrdembitemyapp: but dat german engineering...
01:58arrdemDAS GERMANS
01:58bitemyapparrdem: nazi brick of high price.
01:58arrdemI'll just go build my $500 AR and feel poor now...
01:59{[^-^]}bitemyapp: there's barely any info about it
01:59{[^-^]}on clojure.org
01:59bitemyapparrdem: don't build a $500 AR
02:00bitemyapparrdem: that's not really worth it.
02:00bitemyapparrdem: if you need something more accurate than an AK, then Mosin or Mini-14. Or Mini-30.
02:05arrdemyay cheaper garands!
02:09mysamdogI'm having another clojurescript problem, this time with dommy.
02:10mysamdogHere's my cljs file: https://www.refheap.com/21667, my html file: https://www.refheap.com/21669, and the tail -n 500 of the js that it compiles to: https://www.refheap.com/21670
02:10echo-areaWhat's the point of adding macros like cond->, some->, as->? I can't think of a typical usage
02:11arrdemecho-area: as-> is great if your threaded value doesn't aways need to occur in the first position
02:12echo-areaAnd there's no examples in clojure's source code itself
02:12echo-area(Practical examples)
02:12echo-areaarrdem: Ah, I see that now
02:12echo-areaWhat about the others?
02:12mysamdogI'm tryring to use dommy for click events and such, and I made a quick test to make sure it worked, which it didn't.
02:12taliosthreading macros are for people who pretend they don't really want to use scala and symbol heavy code ;)
02:13arrdemecho-area: some-> provides shortcutting, it's potentially a nice way to chain predicates
02:13mysamdogWhat's supposed to happen is when I click the button with id "Home" is that the word test is added to the div with id "content"
02:14arrdemecho-area: cond-> is just shorthand for (cond e (...) (-> e ...))
02:14mysamdogCalling soar.site.test(); from the js console in my browser works, but clicking the button doesn't.
02:14arrdems/shortcutting/short circuting/g
02:15[Neurotic]It's not quite the same ;)
02:15[Neurotic]talios: You doing it right now?
02:16talios[Neurotic] - shceduled to record in about 15 mins ish
02:16echo-areaarrdem: Not exactly, cond-> doesn't short circuit after the first true test expression
02:16talios[Neurotic] - ah yes, its Kai whose wellington based right?
02:16[Neurotic]Argh! I would be delighted to join you, unfortunately, I have dinner with my parents shortly for their wedding anniversary
02:16[Neurotic]talios: That's the one :) German born, NZ based.
02:17arrdemecho-area: true, and I think that's a feature.
02:17talios[Neurotic] - if we guest on each podcast, we could be 3 devs down under :) hah
02:17arrdemecho-area: it allows for multiple cases to be true.. a better way to think about it is throwing #(if)s in your ->
02:17taliosaltho - we're under downunder
02:17[Neurotic]talios: I like it ;)
02:18[Neurotic]talios: I'm currently hassling Kai to do another podcast before year end. Nailing him down is proving to be struggle ;)
02:18talios[Neurotic] - and at this time of year even harder I imagine
02:19[Neurotic]He's travelling or something else fairly non-important (to me anyway ;) )
02:25[Neurotic]talios: good luck finding someone! If you ever need a guest, I'd be more than happy to fill in!
02:25taliossweet - you may get mocked for cold fusion however ;-)
02:26[Neurotic]I always get mocked for ColdFusion. I would expect no less ;)
02:26talioswe need more guests, shift things up a bit - can be a bit tedious us always the same
02:26talioshah - mind you - me/greg are both ex Delphi as well
02:26[Neurotic]I'm a terrible extrovert, so any chance I get to talk .. in front of people, I'm pretty much there :D
02:26[Neurotic]okay, I reely need to run. ttyl!
02:27taliosHappy Wedding Annivsary :)
02:27taliosfor your folks
02:41nonesis there any differences between (map :key) and (:key map)
02:41arrdemnones: practically no
02:41taliosdifferent functions, same outcome.
02:41taliosfor all intent - as arrdem says, nothing different
02:42taliosone may "read" better to human brains given different scenarios is all
02:42nonesthanks
02:45daniel_k_https://github.com/bbatsov/clojure-style-guide#collections says that (map :key) is susceptible to NullPointerException.
02:45scottjnones: (:key map) is better if map might be nil
02:49nonesthanks, i understood
04:38magnarsJust added introduce-let and expand-let refactorings to clj-refactor.el :) https://github.com/magnars/clj-refactor.el#introduce--expand-let-example
04:45ucbmagnars: !
04:45ucbmagnars: (that means "whoa, nice!")
04:45ucbbut shorter
04:45magnarsbrevity is the essence of wit
04:47ucb:)
05:26piranhamagnars: you list paredit 24 as a dependency for clj-refactor, but I see only paredit 22 on marmelade (and through el-get I got paredit 23)
05:27piranhamagnars: is that some kind of dev version? should I obtain it by hands somehow?
05:43magnarspiranha: oh, I guess paredit 24 isn't released yet. It certainly isn't necessary to get such a new version. I'll downgrade the dependency straight away.
05:43piranhamagnars: thanks :)
05:44magnarspiranha: 0.4.2 released and on marmalade :)
05:46piranhamagnars: error: Need package `multiple-cursors-1.2.2', but only 1.2.1 is available :)
05:46magnarshaha, really now :) Let me see what the difference between 1.2.2 and 1.2.1 is
05:47magnarsmulti-file packages are a pain to deploy to marmalade :P
05:47piranhathey are always a bit of pain :)
05:48magnarsBah, 1.2.1 is pretty old. I'll get 1.3.0 out on marmalade instead. Bear with me as I curse the tar command.
06:02magnarspiranha: multiple-cursors 1.3.0 is now deployed to marmalade
06:02piranhamagnars: cool, let me try...
06:03piranhadamn, 'package-handle-response: Error during download request: Not Found'
06:03piranhaI'll have to debug this to determine what's going on :(
06:03piranhalater then
06:03magnarshmm, that sucks
06:03piranhagive me few mins though, maybe I'll find the source quick enough
06:04piranhamagnars: that seems about multiple-cursors
06:05piranhamagnars: http://paste.in.ua/9150/
06:05magnarshmm ... it certainly is there: http://marmalade-repo.org/packages/multiple-cursors
06:06piranhaeh
06:07piranhawell, later then
06:07piranha:)
06:08magnarsI should find some way of having CI pull from both marmalade and melpa, in addition to git.
06:08piranhaI hope that's not el-get getting in the way...
06:10magnarsno, same error on a blank emacs
06:15magnarspiranha: seems like a marmalade fail - pressing "Download" on the marmalade page fails too.
06:15piranhaah...
06:16piranhamaybe we just need to wait for a bit
07:25CookedGryphonmagnars: I'm getting a runtime exception, EOF while reading when I try to do some refactors
07:25magnarsCookedGryphon: ok, would you mind opening an issue with an example, so I can reproduce it?
07:26CookedGryphonYeah, it might be quite an involved example though - I'm doing clojure on android.
07:26CookedGryphonfeel free to say "unsupported"!
07:28CookedGryphonI'll check if it works fine in some of my other projects and then do a little more investigation of my own before I bother you with an issue, but it seems to think I have unmatched delimiters
07:28CookedGryphonwhen I don't
07:30magnarsCookedGryphon: Clojure on android shouldn't be a problem. The refactorings pretty much only care about sexps. Which ones are giving you the issue? Might be that paredit is complaining.
07:31CookedGryphonmagnars: Why am I getting a runtime exception as a result? Is the manipulation purely elisp?
07:31CookedGryphonas in a java runtime exception
07:31magnarsWow, that's really odd. There's just elisp in there.
07:31CookedGryphonit's evaluating things automatically right?
07:33CookedGryphonmagnars: oh!
07:33magnarsIt might be that the `clojure-find-ns`, `clojure-update-ns` `clojure-expected-ns` calls are doing some evaluating. But there's no nrepl integration going on, so that seems strange too.
07:33CookedGryphonmagnars: I'm being really stupid
07:33magnarsThat happens to me some times too :)
07:34CookedGryphonmagnars: I set up my keybindings in scratch to try it out, picked something which was unbound, went and tried it out
07:34CookedGryphonbut of course while it wasn't bound in my scratch, it *was* already bound in clojure mode
07:34magnarsClassic!
07:34CookedGryphonokay, sorry to bother you, i'll try again :P
07:34magnarsNo worries :)
07:40magnarspiranha: Seems like this marmalade issue is a known bug without a fix atm: https://twitter.com/bbatsov/status/410747520940539904 - maybe try melpa?
07:41piranhamagnars: oh, ok; should I just switch repo to melpa and it will work?
07:41piranhaI have no idea how all those repos work with emacs to be honest :)
07:42magnarsIf you're comfortable living on the edge. melpa builds straight from master, so that comes with its ups and downs.
07:42piranhaah
07:43piranhaI'm ok :-) I initially tried to install with el-get straight from github but then it has dependencies so I thought that I have to use some package manager... anyway, let me try
07:43magnarsYou should be able to grab the dependencies with el-get too.
07:44rurumatehow to make clojure.pprint print things more pretty than, say, pr-str?
07:44rurumate'(clojure.pprint/pprint {12 13})
07:44piranhamagnars: I should, but then I need to add them by hand :)
07:48piranhamagnars: it works! :)
07:48magnarsexcellent! :)
07:49piranhamagnars: it's just great, I love 'ar' and 'rf' the most right now :)
07:49magnars:D
07:49piranhahow do you find files in project?
07:50piranhaI mean how do you decide "this is a project"?
07:50magnars(locate-dominating-file default-directory "project.clj")
07:51piranhaah :-)
07:51piranhamakes sense :P
07:51piranhamagnars: again, thanks a lot! That's something really sweet :))
07:51magnarsGlad to hear that :)
07:59seriously_randomhow do you apply a function on a vector? http://pastebin.com/PiPx9vAF
08:05john2xseriously_random: do you mean apply a function over each element in a vector?
08:06seriously_randomjohn2x, funtion
08:09seriously_randomjohn2x, got it! "(map rank hand)"
09:01seriously_randomhow to convert (2 3) to [2 3]?
09:02arrdemthe seq vs vector difference shouldn't be important, but you can use (vector)
09:03hyPiRionseriously_random: vec
09:03hyPiRion,(vec '(2 3))
09:03clojurebot[2 3]
09:05seriously_randomhyPiRion, (vec '(vals (frequencies ranks))) doesn't give me what I want
09:06seriously_randomhyPiRion, works without '
09:07arrdemseriously_random: of course, because you're quoting the list of symbols, giving you a list of symbols rather than a list of expressions
09:25deadghosthttp://pastebin.com/psjkr9zC
09:25deadghostI'm not sure if I should be using recur here
09:28clgvdeadghost: you can `reduce` over the list of predicate functions
09:30deadghostclgv, as in do I need to cram in recur somewhere to get TCO
09:30deadghost*as is
09:31ivanif anyone wants to become a "security researcher" just search github for everything that uses hiccup
09:31ivanfilenames, source lines, etc can all contain HTML
09:39clgvdeadghost: no. pure usage of `reduce`
09:40deadghostI mean the way I wrote it
09:40deadghostunless you're telling me shutup and just use reduce
09:43amalloydeadghost: if you were going to write it the way you did, recur is clearly better
09:43amalloybut (remove (apply some-fn
09:43amalloy(remove (apply some-fn fn-list) data-list) is much shorter
09:44amalloyreduce/remove would be okay, but not great
09:45AnderkentCan anyone help me with proxy? I'm trying to proxy a Reader java.io.reader, but I have no idea how to override only the abstract (read [char-array offest len]), and not the provided (read ^char [])
09:46deadghostamalloy, I was asking about recur because I totally don't know how to use recur
09:46deadghostcoming from CL
09:46deadghost(newbie at CL as well)
09:49amalloydeadghost: recur is used when, inside of a function f, the last thing you do is call f again and immediately return its result
09:50amalloy(defn f [x] (if (zero? x) 0 (f (dec x)))), for example: the last call in the false-branch is to f, so it could be replaced with recur
09:50deadghostso usage wise would I replace f with recur
09:50amalloyin (defn f [x] (if (zero? x) 0 (inc (f (dec x))))), however, the recursive call to f is *not* the final action, so recur would not apply
09:50amalloytry it and see!
09:52deadghosthmm ok looks like
09:52deadghost"While not as general as tail-call-optimization, it allows most of the same elegant constructs, and offers the advantage of checking that calls to recur can only happen in a tail position."
09:53Anderkentholy god of all that's clojure, is this accurate and the only way? https://groups.google.com/d/msg/clojure/TVRsy4Gnf70/7DwezPG9digJ (2009)
09:53deadghostI take it this isn't exaclty the same as TCO
09:57clgvamalloy, deadghost: oh right the new `some-fn` fits awesome there
09:58Anderkentoh my god it's true... (defn -read-char<>-int-int [])
09:59BobSchackAnderkent are you using proxy for Java interop?
09:59AnderkentI tried to use proxy but I can't figure out how to override just a single overload
09:59Anderkentso I'm trying gen-class right now
10:01amalloyAnderkent: if you want to implement a Reader, you could extend the approach we used in flatland/io (https://github.com/flatland/io/tree/develop/src/flatland/io) for Streams
10:02BobSchackAnderkent here's a good link for when to java interop http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/
10:03AnderkentBobSchack: ... that doesn't help at all. I'd LOVE to use proxy. It's not working. Telling me 'use proxy' does NOT help
10:04Anderkentamalloy: cool, thanks. I'd like to avoid having to write those wrappers, so if gen-class works I'd go with that. I only need one instance and the overriden behaviour is trivial (reader that writes to stdout whenever it's read from, to simulate stdin echo)
10:06deadghostha it took me a few passes before I realized some-fn is a function
10:19AnderkentCan't get gen-class to work - probably doing something stupid. https://www.refheap.com/21673
10:20nDuffAnderkent: gen-class only happens during AOT compilation.
10:20Anderkentargh, i knew that
10:21Anderkenttoo used to the repl by now!
10:21nDuffAnderkent: ...by the way, did you provide a reproducer for the issues you were reporting w/ proxy?
10:21nDuff...ahh, n/m.
10:23AnderkentI take it as a confirmation that yes it's an issue and no i can't do it with proxy :)
10:28Anderkentyay, it works!
10:37deadghosthmm amalloy some-fn doesn't seem to like me
10:38deadghost((apply some-fn '(even?)) 2)
10:38deadghostresults in nil
10:39amalloyuh, '(even?) is a list containing a symbol, not a function
10:42deadghostuhhhh
10:42deadghostI'm not sure what I'm missing then
10:42deadghostdo I need to denote even? is a function or something?
10:44Anderkentdeadghost: some-fn takes functions and returns a function to apply to the argument
10:44Anderkenti.e. &((some-fn even?) 2)
10:44Anderkentuhm
10:44Anderkent,((some-fn even?) 2)
10:44clojurebottrue
10:44Anderkentif you have a list of functions as an argument, you'd do
10:45`cbp' will turn even? into a symbol
10:45Anderkent,((apply some-fn [even? pos?]) 3)
10:45clojurebottrue
10:45`cbpuse list or use a vector or something
10:47deadghosthmm what
10:48deadghostI thought ' was shorthand for list
10:48deadghostor am I mixing clojure up with cl
10:49Anderkent'() is a way of escaping a list and its contents -> '(1 2 3) is the same as (list 1 2 3). But if oyu have symbols in it, it becomes (list 1 2 'symbol 3)
10:51`cbp' is quote not list, its the same for cl
10:51deadghostI guess I just got an oversimplified explanation then
10:51`cbpits to prevent evaluation
10:56Anderkentright, i didnt mean to say it expands to (list), just that it gives you the same result
10:57deadghostmore likely I didn't pay enough attention reading gentle introduction to symbolic computing
10:58`cbpwhen you run clojure code there are basically two stages: read and eval. read turns strings into data structures and some values. quote basically says stop right after read. It works with other data structures not just lists.
11:03fredyrdeadghost: unlike other lisps, in clojure you mostly want to use vectors
11:04ToBeReplacedone day, i would love not to have to type clojure.lang.PersistentQueue/EMPTY -- is there a ticket where a (queue) function or similar was discussed?
11:04deadghostfredyr, I never read up on why I'd prefer a vector over a list
11:04tbaldridgeToBeReplaced: yes there is, http://dev.clojure.org/jira/browse/CLJ-1078
11:05ToBeReplacedtbaldridge: thanks
11:05Anderkentdeadghost: if you need random access, for example
11:06Anderkentalso sometimes it just helps as a visual distinction between data and code.
11:06deadghostwhat really
11:06deadghostI thought vectors were like arrays
11:06deadghostand I needed to traverse through to a value
11:06deadghostor that arrays were a type of vector
11:06Anderkentthat's not how arrays work!
11:06deadghostlolidk
11:06tbaldridgedeadghost: you don't have to transverse an array
11:07tbaldridge*traverse
11:07tbaldridgearrays are basically a pointer lookup. arrayptr + (index * size of element)
11:08tbaldridgeit can be harder to grow arrays however, so vectors fill that void. Fast random access plus fast grow
11:09deadghostdoes SICP cover this material?
11:09Anderkentis there a function to always add a single object to the end of a collection? I guess I can do (concat coll [x])
11:09tbaldridgeAnderkent: conj will add to the end of vectors.
11:09fredyrconj does that
11:09deadghostI totally don't know my data structures
11:09Anderkentyeah the thing is i dont know if its a vector o rlist
11:09mdrogalisIs there a completely bullet-proof Clojure or Java function to check if a string is a number? When I say bullet proof I mean anything java.lang.Number.
11:09Anderkent,(conj '( 1 2 3) 4)
11:09mdrogalisApache's utils don't catch decimals.
11:09clojurebot(4 1 2 3)
11:09tbaldridgeAnderkent: convert it first with vec perhaps
11:10Anderkentmeh
11:10AnderkentI could :P
11:10tbaldridgeAnderkent: if it is already a vector I think vec is a no op
11:11Anderkentyeah it just feels wasted since i'll only ever read it once, and will read it like a list
11:11Anderkenti.e. it's (string.join \newline (concat lines [""]))
11:11tbaldridgeAnderkent: yeah, then concat is probably best
11:11tbaldridgeThat's what this does after all:
11:11CookedGryphonmdrogalis: ,(number? (read-string "123.2f"))
11:12ToBeReplacedtbaldridge: it seems like there was disagreement and now nothing is occurring -- does it seem like it's stuck to you? fwiw i like queue/queue* since list/list* and no clear match to vec/vector
11:12Anderkentactually, I guess the best answer is (str (map (str % "\n) lines)) :P
11:12tbaldridge, `(1 2 3 4 ~2)
11:12clojurebot(1 2 3 4 2)
11:12tbaldridge, '`(1 2 3 4 ~2)
11:12clojurebot(clojure.core/seq (clojure.core/concat (clojure.core/list 1) (clojure.core/list 2) (clojure.core/list 3) (clojure.core/list 4) ...))
11:12tbaldridgeactually, ick, that's rather gross...lol
11:13gfredericksToBeReplaced: que/queue :)
11:14tbaldridgeToBeReplaced: I think the latest changes are what Rich is looking for. Perhaps ping clojure-dev?
11:14ToBeReplacedque/queue is funny
11:16davok I'm banging my head against a wall simply trying to call some java classes..
11:16davhoping I can get a bit of guidance
11:16davI got a jar file off for XLLoop on here: http://xlloop.sourceforge.net/
11:16davThere's no explicit support for clojure but that shouldn't matter.
11:16gfrederickstbaldridge: I don't think vec is a noop; looks like it converts to a seq then back to a vector
11:17davThey have a simple bit of (Java) code under "Usage"
11:17tbaldridgereally? ick
11:17gfredericks,(let [v (vec (range 1000000))] (time (count (vec v))))
11:17clojurebot#<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>
11:17davI can't, for the life of me, instantiate the FunctionServer class
11:17gfredericks&(let [v (vec (range 1000000))] (time (count (vec v))))
11:17lazybot⇒ "Elapsed time: 2274.815886 msecs" 1000000
11:18Anderkentdav: what errors are you getting? Is the class on the classpath?
11:18gfredericks&(let [v (set (range 1000000))] (time (count (set v))))
11:18davAnderkent: I've put the jar file in the resources folder of my lein project
11:18davAnderkent: the folder is in the classpath
11:19Anderkentdav: I'm not sure if that'll work. What happens if you type (import 'org.boris.xlloop.FunctionServer) in the repl?
11:19Bronsagfredericks: ouch
11:19gfredericks&42
11:19davAnderkent: ClassNotFoundException
11:20davAnderkent: where else should I put it?
11:21Anderkentdav: lein tries to stick to the dependency-managed way. I don't think there's an easy way. For a local setup you can try something like http://www.elangocheran.com/blog/2013/03/installing-jar-files-locally-for-leiningen-2/
11:21Anderkentbut the preffered way is to build a pom.xml for that jar and deploy it to clojars :P
11:22davAnderkent: the folder is definitely in (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader)))
11:22AnderkentFor a really hacky way you can try unpacking the jar (it's just a .zip file) and putting the .class files on the classpath (in the resource/ directory, for example)
11:22davAnderkent: ok let me have a look.
11:22Anderkentyeah, but jars are special
11:23davAnderkent: clojars you mean upload the jar back onto some public repository?
11:23Anderkentdav: it involves more than that. You'd have to create a file that describes dependenceis of that jar, its verion etc.
11:24Anderkent(uh, I kinda assumed you're using lein. Are you?)
11:24davAnderkent: yes I am
11:24Anderkentok cool.
11:24davAnderkent: ok but it feels unsatisfying that I'd have to upload a jar online to be allowed to use it..
11:24davAnderkent: I'll try that blog post you linked to
11:25mdrogalis,(number? (read-string "12 lol"))
11:25clojurebottrue
11:25Anderkentdav: there is good reason for that. see https://github.com/technomancy/leiningen/wiki/Repeatability
11:25mdrogalisCookedGryphon ^
11:26Anderkentmdrogalis: read-string only reads one expression from the string
11:26Anderkentkinda funny how it doesnt even tell you how much it read, or throw an exception if there's stuff left over..
11:26mdrogalisAnderkent: Yep.
11:26mdrogalisIt does what it wants.
11:28CookedGryphonmdrogalis: http://stackoverflow.com/questions/2640169/whats-the-easiest-way-to-parse-numbers-in-clojure
11:29CookedGryphonmdrogalis: half way down it has a neat hack to pull the matchNumber method from clojure's reader
11:29CookedGryphonand invoke it to give you the number or nil
11:29wei__given java.jdbc/update!, what's the best way to write an update-and-return! function?
11:30mdrogalisCookedGryphon: Hah, that actually works.
11:35Anderkentargh why is it so hard to decide if strings should have a trailing newline or not
11:38davAnderkent: mvn install-file worked after a few tries :) thanks a lot.
11:42Bronsadnolen: ping
11:54deadghostclojure doesn't have second, third, etc?
11:55mdrogalis,(second [1 2])
11:55clojurebot2
11:55mdrogalis,(doc third)
11:55clojurebotTitim gan éirí ort.
11:55Bronsauuuh just found a tools.reader bug thanks to tools.analyzer.jvm and eastwood
11:55vijaykirandeadghost: use nth for stuff beyond second
11:55teslanick,(nth [1 2 3 4] 3)
11:55clojurebot4
11:55deadghostoh huh
11:55deadghostit's kinda funny it has second
11:56Anderkentit's because pairs are common
11:56vijaykirandeadghost: second is bit more useful/readable when you are recursing over stuff
11:56deadghostI see
12:00Anderkenthm, what's the idiom for executing an expression in a different namespace? (binding [*ns* (find-ns 'ns)] ...) seems a bunch of boilerplate
12:01tbaldridgeAnderkent: in-ns should do that.....but why would you want to?
12:01BronsaAnderkent: that won't work as you'd expect in some cases
12:04Anderkentwell, basically i'm simulating a repl - feeding a list of strings to clojure.main/repl. I want to switch to the user ns so that the output is as if someone was sitting there typing
12:04Anderkenttbaldridge: afaik in-ns just switches to it, it doesnt take a body expr
12:04tbaldridgeAnderkent: well switch to it, run your code, then switch back
12:05Anderkentugly!
12:05Anderkenti'd rather (binding) wrap it than (try finally) :P
12:05tbaldridge,(do (in-ns 'foo) (println *ns*) (in-ns 'user))
12:05clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: println in this context, compiling:(NO_SOURCE_PATH:0:0)>
12:05tbaldridge,(do (in-ns 'foo) (clojure.core/println *ns*) (in-ns 'user))
12:05clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: *ns* in this context, compiling:(NO_SOURCE_PATH:0:0)>
12:05deadghosthmm that's kinda funny
12:05deadghostnil isn't true or false
12:05Anderkent:) joy of uninitialized namespaces
12:06deadghostI guess I need to check for it
12:06Anderkent,(if nil :yes :no)
12:06clojurebot:no
12:06BronsaAnderkent: binding *ns* won't work. (binding [*ns* some-ns] some-ns-symbol) will fail
12:06AnderkentBronsa: that's okay
12:06Bronsathe compiler will try to resolve some-ns-symbol before in the current ns
12:06tbaldridgeAnderkent: yeah, so do what I suggested inside a try/finally. And it'll work as you want.
12:06Bronsa/ before/d
12:06Anderkentmy thing already works. I just wondered if there was something like (with-ns)
12:06tbaldridgebut once again, if you need to do that, I'll question your code structure.
12:07deadghost,(false? nil)
12:07clojurebotfalse
12:07Anderkentdeadghost: false? checks for 'is this Boolean.false'. There's rarely any reason to call it
12:07deadghostI see
12:11Anderkentugh, is there something that takes a predicate and basically returns [(filter pred list) (filter (not pred) list)] ?
12:11Anderkent(group-by pred) works, I guess. But ugly.
12:15murtaza52I want to sort a map by its value, is there a lib fn for it ?
12:15seangrove Anderkent: partition-by ?
12:16seangrovemurtaza52: You want the keys in the map to be sorted according to their values, or just the values sorted?
12:16murtaza52keys sorted by the values
12:17Anderkentseangrove: partition is not the same thing
12:17Anderkent,(partition-by odd? [1 2 3 4])
12:17clojurebot((1) (2) (3) (4))
12:17Anderkent,[(filter odd? [1 2 3 4]) (filter (comp not odd?) [1 2 3 4])]
12:17clojurebot[(1 3) (2 4)]
12:17seangroveAnderkent: True
12:18Anderkentit's ok, group-by works pretty nicely in retrospect
12:18hyPiRion,((juxt filter remove) odd? [1 2 3 4])
12:18clojurebot[(1 3) (2 4)]
12:19murtaza52seangrove: I am trying to sort the keys by values, and also need to preserve the structure as a map
12:19AnderkenthyPiRion: cool, but it does two passes right?
12:20hyPiRionAnderkent: sure, is that a problem?
12:21seangrovemurtaza52: Hrm, not sure, I think all the sorted-maps compare keys for sorting
12:21seangrovemurtaza52: Probably hints that you should use a different data structure
12:21Anderkentnot in practice, only in terms of elegance :P
12:21Anderkentbut thanks anyway
12:22AnderkentIn retrospect the group-by solution worked out pretty nicely
12:25stuartsierraRe `in-ns` discussion earlier, if you really want to create Vars in another namespace, use `intern`.
12:27murtaza52seangrove: thanks sorted it by converting it into a vector :)
12:27seangrovemurtaza52: Yeah, sounds considerably easier :)
12:28Anderkentstuartsierra: I don't! I just want the repl to run in a different context.
12:28stuartsierraoh nevermind then :)
12:30coventryAnderkent: Which repl? How is (ns 'ns-symbol) insufficient?
12:31Anderkentit's not an interactive repl. I'm using the clojure repl, feeding it strings, and looking at sdout
12:31Anderkentbut it starts in my current ns instead of user
12:31Anderkentthus, wanting to run a function in a different ns context
12:32coventryOh. I do a lot of that, and (binding) is the best solution I've seen so far.
12:33Anderkenta lot of running functions in different contexts, or a lot of feeding repls strings?
12:33Anderkentbecause if the second, then I definitely want to steal your code :P
12:37coventryRunning functions in different contexts. I mostly feed strings straight to the reader. https://github.com/coventry/troncle/blob/master/src/troncle/core.clj#L9
12:38coventryWhat's the advantage to driving clojure via the repl?
12:38AnderkentI'm writing doctest
12:41Anderkenti.e. put copy your repl session into docstrings / a file, and I'll run the code and verify that the output is the same
12:41Anderkentand now not only am i stuck on the airport, the wifi seems to be giving out. Gah.
12:43coventryNice.
12:44TimMcAnderkent: Negati id not recei last communica *HKSSHSHHHTTT* <connection dropped>
12:46TimMcI kind of wish digital stream failure modes were more like analog.
12:48tbaldridgeAnderkent: actually that's probably the best reason I've heard for doing this sort of thing.
12:51arrdembitemyapp: final survived. one haskell was sighted, several scalas were slain and monads where nowhere to be found
12:52arrdembitemyapp: the haskell was surprisingly helpful... the scalas all put up a fight
12:54seangroveAny kind of distinct-by function?
12:56gfredericksreiddraper: do you have any thoughts on some way of multiplying the trial times by some fixed number for a given test run? E.g., "run my tests with 10 times as many runs as usual"
12:56gfredericksuse case is I want quick tests in dev but longer/thorough tests in CI
12:56gfredericksso an env variable or some such would be the most convenient
12:57gfredericksI just peeked at simple-check.clojure-test and it looked like there isn't such a thing currently
12:57reiddrapergfredericks: yeah, i think something like that would be useful, but not yet sure how to best do it. i'd like to keep the quick-check function itself as magic-free as possible, and have everything be explicit
12:57arrdemnDuff: bitemyapp was helping me out yesterday in my studying for a type theory heavy programming languages final test.
12:57gfredericksreiddraper: is doing it in defspec too messy?
12:58arrdemnDuff: I'm referring to languages as animals because my sleep deprived brain thinks it's funny
13:00stompyjarrdem: specific languages? or theory?
13:01arrdemstompyj: type inference over typed lambda calculus + scala :/
13:01arrdemstompyj: that and multiple inheritance behavior was about 75% of it
13:01stompyjwow
13:01stompyjscala in schools, thats awesome
13:02reiddrapergfredericks: that's probably ok. i think in my ideal, it'd be something you'd pass in on the command line to 'lein test'
13:02stompyjwhen I was in school we used C, Scheme, Prolog, ML and that's about it
13:04reiddrapergfredericks: but yeah, i think defspec is probably a reasonable place
13:04gfredericksreiddraper: okay; if I end up needing this soon I'll draft it up on a branch and can open a PR for discussion when it feels ready
13:05reiddrapergfredericks: awesome, thanks. hopefully the move to contrib will happen sooner than later, i need to go bug people to start replying to the clojure-dev email
13:06reiddrapergfredericks: so, actually, if you don't mind, can you reply to it as well, just basically pasting what i wrote, but replacing with your name. (that is, if your cool with donating to contrib)
13:07gfredericksreiddraper: I'm curious what happens if I'm not cool with it; but my curiosity is not enough to overtake my coolness with it
13:07reiddrapergfredericks: feel free to dm me
13:10gfredericksOSS & licenses is so weird
13:16technomancycopyright assignment isn't so much about licenses
13:19justin_smithtechnomancy: well in the case of GNU at least, it is about being able to legally enforce licenses (if it came to that).
13:20justin_smithThey can't easily take someone to court for unlicensed usage if they don't have all copyright holders on board, copyright assignment makes this much easier.
13:21technomancyyeah, GNU is a special-case on account of being fairly high-profile though
13:22technomancythey've basically painted a big target on their back
13:25justin_smithright, and at this point some high percentage of computers run their code, nearly all if you count things that came out of their compilers
13:25justin_smithhmm... maybe not in embedded I guess
13:26arrdemjustin_smith: I don't think that the GPL2/3 covers the results of a GPL'd tool... does it?
13:26justin_smithno, of course not
13:26justin_smithjust a metric of their ubiquity
13:26justin_smithnot how far their licensing concerns go
13:27justin_smithalso copyright assignment is often a concern for smaller projects if they want to be able to dual license
13:27justin_smiththat is really hard to do if there are multiple copyright holders, and it rightly scares away any takers for alternate paid licenses
13:29technomancyyeah, I'm thinking more in the context of contrib
13:29dnolenpure React CLJS interface wip - https://github.com/swannodette/om
13:29clojurebotHuh?
13:30arrdemgfredericks: you have a CA in, right?
13:30TimMcarrdem: That's debatable.
13:30yazirianom.dom? what a missed opportunity for om.nom
13:30arrdemTimMc: how is that possible...
13:30technomancybut actually now I realize I don't know the motivation behind the CA at all any more
13:31technomancyhttp://p.hagelb.org/mystery.gif
13:31gfredericksarrdem: totes
13:31TimMcarrdem: Only to the extent that portions of the output were present in the GPL'd source.
13:31dnolenexample using om w/ #js literals and :include-macros https://gist.github.com/swannodette/7915826
13:32TimMcarrdem: If you have a GPL'd parser-generator, it has to output some source code based on templates that are carried in the generator's own source.
13:32dnolenall om.dom functions inline into direct React calls, so no overhead for standard use
13:33TimMcI don't know how yacc (or is it bison?) handles that, license-wise.
13:33seangrovednolen: Interesting, the :include-macros cleans up the ns form
13:33dnolenseangrove: yep
13:33arrdemI suspect that the short answer is nobody cares, or has tried to enforce license over those stubs.
13:34seangroveI'd prefer hiccup-style data structures, but that could be overlayed pretty easily
13:34dnolenseangrove: and because :include-macros is explicit it doesn't cause unintended madness
13:34dnolenseangrove: sure
13:34bitemyapparrdem: glad I was useful.
13:39seangroveoverlaid*, goodness
13:41seangrovednolen: Ah, I see, the :shouldComponentUpdate is where you get most of the speed up from
13:41seangrove#js {} doesn't look too bad actually
13:41bitemyapparrdem: using a GPL'd tool doesn't GPL the output of the tool. The GPL'd code has to live within the output somehow.
13:41bitemyapparrdem: it's pretty easy to reason about even if the implications are deep. Think of it like a tangible infection.
13:42coventry~/.lein/indices is taking up over a gig of space. Is that typical?
13:42clojurebotCool story bro.
13:42bitemyappcoventry: I don't even have one of those.
13:42bitemyappwhat did you do?
13:42coventrybitemyapp: I think it's generated by some command like "lein search"
13:43bitemyappoh.
13:43bitemyappI always know what I want ^_^
13:43danneuWhat's the general use-case for using stateful sessions as opposed to Ring's functional sessions?
13:44gfredericksclassic tradeoff of noise vs magic?
13:46bitemyappdanneu: stateful sessions aren't a good idea. Stash state in the request map.
13:46bitemyappdanneu: dynamic vars aren't async-safe.
13:46bitemyapp~dynamicvars are not async-safe
13:46clojurebotI don't understand.
13:46bitemyapp~dynamicvars is are not async-safe
13:46clojurebotc'est bon!
13:46bitemyappugly wording. ugh.
13:47bitemyapp~dynamic vars
13:47clojurebotCool story bro.
13:47bitemyapp~dynamicvars
13:47clojurebotdynamicvars is are not async-safe
13:47danneuRing's functional sessions are refreshing after a rather hellish experience with stateful sessions in a large Rails app
13:47bitemyappwow that is horrific
13:47bitemyappdanneu: what are the functional sessions exactly?
13:48bitemyappI don't really pay attention to what the cool kids use anymore.
13:48justin_smithbitemyapp: the session is replaced by the session you return
13:48justin_smithrather than being mutated as you go along
13:49justin_smiththe one gotcha being if you forget to return the session in your response, *POOF* no more session
13:49justin_smithotherwise it is perfect
13:49bitemyapplol.
13:49sritchiebitemyapp: I went down a serious deploy tools rabbit hole last night
13:49sritchiejesus
13:49sritchiedocker
13:49bitemyappsritchie: welcome to my bunny hutch then.
13:49bitemyappsritchie: ...are you okay?
13:50sritchie:) the docker pitch seems just so, so good
13:50sritchieI'm working on getting a dev environment up with a single "vagrant up"
13:50sritchieand it seemed like separate docker containers for riemann, graphite, nginx, etc was the cleanest way…
13:51sritchiebut now I'm degrading, falling back to the simpler thing of little ansible playbooks
13:51sritchiebitemyapp: (all to avoid pallet. sorry dudes.)
13:51technomancybeing on debian stable is great; no temptation to try out half-baked stuff like that when I'm on a kernel that's too old
13:51sritchiebitemyapp: any hot/cold reaction to the buzzwords I'm throwing out, from an experienced bunny hutcher such as yourself?
13:52seangrovesritchie: What makes you want to avoid pallet so much?
13:52justin_smithtechnomancy: yeah, I am tempted to upgrade my ubuntu install that shipped with this box to debian stable
13:52technomancydoooo eeeet
13:52sritchieseangrove: I've actually used pallet quite a bit, but vagrant does the VM thing much better
13:52bitemyappsritchie: I avoid pallet, I don't have much use for containers or stateful images. I automate mechanistically with idempotent composable tasks
13:53bitemyappsritchie: if docker makes you happy, cool, but it doesn't save me anything because I don't put multiple apps on a single server in a way that needs containment.
13:53bitemyappdocker, to my mind, is most useful as an abstraction to cgroups as much as anything else.
13:53gfrederickstechnomancy: I've been using nix for weeks now; no regrets
13:53bitemyappgfredericks: treating you well eh?
13:54bbloombitemyapp: yeah, i have to agree. i'm not sure i understand the fuss about docker. i mean it's pretty great for people building PaaS stuff, but i'm usually only deploying 1 app per host
13:54gfredericksI don't understand channels yet, with the result being I don't know how to install older versions of things
13:54justin_smithseangrove: my suspicion (and the reason I avoid it) is that because it seems over-architected. Same author as ritz, and I have similar isssues with that design.
13:54justin_smithor maybe I am just too stupid to use such tools
13:54gfredericksbut other than that it does exactly what I want
13:54bitemyappbbloom: well said.
13:54technomancygfredericks: yeah, my experience has been that you don't need to understand too many layers to get it to DWIM
13:54sritchiejustin_smith: it's very difficult to find my way around their new stuff
13:55sritchieBUT, the code sharing situation isn't great yet in ansible
13:55bitemyappsritchie: in my view of the universe, unless I'm concerned about containment (offering a PaaS to untrusted users that might smack each other around), all I need is automation and the ability to "bootstrap my universe" from my automation code.
13:55sritchiejust trying to play with all the new tooling and get a feel for how to build this up
13:55bitemyappsritchie: I use Fabric + Cuisine in Python more often than not for this stuff. It is not fancy at all.
13:55bitemyappBut I write tasks that work, quickly.
13:55bbloombitemyapp: i can see some usefulness for app-per-host containerization, but it's not worth the overhead of yet-another-tool when i'd already need a machine image, some config scripts, etc
13:55technomancyansible doesn't strike me as particularly fancy
13:56bitemyappsritchie: https://github.com/bitemyapp/fabric_recipes examples on my github as usual.
13:56sritchiebitemyapp: yeah, that's fair. down the road, I want to get to the point where every feature branch I have for this web app pushes a container to a single server, heroku style
13:56bitemyapptechnomancy: they went to a lot of trouble to add the MOAR_SPEED mode.
13:56sritchiein fact, the dokku project with docker does all of that
13:56technomancyhm; yeah this is my uneducated opinion
13:56bitemyappsritchie: buhhhhh. okay but is that really something that impacts users?
13:57sritchiehaha, no, I don't want to do it now
13:57bitemyappyou just really need to automate deployment and provisioning, quick-cheap-now, right?
13:57sritchieI want to spin on totally useless tech stack things
13:57bbloomit seems to me that virtualization is only ever going to be able to achieve incremental workflow improvements
13:57sritchiebitemyapp: yeah, what I really need is a local setup for riemann
13:57sritchieand the ability to bounce a config really quickly
13:57bbloomwe just need better tools that are built for isolation from the start
13:57sritchiethen push that up to an EC2 instance and forget about it
13:57bitemyappsritchie: that's how I use my fabric scripts.
13:57bbloomthe go folks seem to understand that, and so they just cheat (in a great way) by doing fully static linking :-P
13:57hiredmanmesosphere!
13:58bitemyappbbloom: native Haskell is statically linked dontchaknow.
13:58bitemyappdynamic linking was probably one of those billion dollar mistakes.
13:59bbloombitemyapp: yeah, i think we need to differentiate between late & dynamic linking. late linking is an implementation detail. dynamic linking is a bad idea :-P
13:59bbloomlate, but not dynamic, doesn't seem to exist anywhere i know of tho
13:59stompyjinfrastructure and deployment is a ridiculously exciting area of innovation right now
13:59bbloomi want to link against a SHA1 :-)
13:59bitemyappbbloom: late linking doesn't meaningfully exist, you know that.
14:00bitemyappa reminder that https://github.com/winterTTr/ace-jump-mode exists
14:00bbloomthis reminds me: guys. we need to start saying that clojure is "Latently typed" instead of dynamic :-)
14:01bitemyapp,(nil [:muh-data])
14:01clojurebot#<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)>
14:01bitemyappsmart-ass compiler is a smart-ass.
14:02bitemyapp,(let [my-fn nil] (my-fn [:muh-data]))
14:02clojurebot#<NullPointerException java.lang.NullPointerException>
14:02bitemyappbbloom: looks dynamically typed to me.
14:02mdrogalisbitemyapp: Google something trivial for me. :P
14:02bitemyappmdrogalis: wutcha need?
14:02bbloombitemyapp: dynamic implies, to me, change over time
14:02mdrogalisbitemyapp: How do I upgrade Leiningen?
14:03bitemyappmdrogalis: lein upgrade
14:03mdrogalisGotta keep you sharp.
14:03mdrogalisYou didn't Google that
14:03bitemyappmdrogalis: didn't have to.
14:03bbloombitemyapp: i think you'd agree that clojure types are dramatically less dynamic than ruby or python :-P
14:03mdrogalisThis was a sad exercise :|
14:03bitemyapp,(let [x "woohoo!"] (println (type x) (let [x 100] (println (type x)))
14:03clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
14:03bitemyapp,(let [x "woohoo!"] (println (type x)) (let [x 100] (println (type x)))
14:03clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
14:03bitemyapp,(let [x "woohoo!"] (println (type x)) (let [x 100] (println (type x))
14:03clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
14:03bitemyapp,(let [x "woohoo!"] (println (type x)) (let [x 100] (println (type x))))
14:03clojurebotjava.lang.String\njava.lang.Long\n
14:04seangroveDon't worry, we'll all wait for you to get it right bitemyapp
14:04bitemyappbbloom: looks dynamically typed to me.
14:04bitemyappseangrove: I blame the PARENS
14:04bitemyappseangrove: typing lisp code in irssi is tedious.
14:04seangrovebitemyapp: Too many of 'em, I'd say. I prefer bangs instead
14:04bitemyapp!:a {:a 1}! => 1
14:04bitemyappseangrove: I like the way you think. It can feel like writing Spanish.
14:04seangroveSee? So much more legible!
14:04bitemyapp!AVISO!
14:05justin_smith¡FTFY!
14:06gfredericksbbloom: you're saying ruby/python are dynamic (as in "change over time") because the type definitions themselves are dynamic?
14:06gfredericksrather than an object being able to change its type, which afaik is not the case
14:07seangrovegfredericks: Oh, that'd be cool though. I wonder how it'd be abused.
14:07tbaldridgegfredericks: oh you can soooo change a type in python
14:07bbloomgfredericks: a bigger issue is variables
14:07bbloomgfredericks: a variable's type can change when the value in that variable changes
14:07gfrederickstbaldridge: python I know less about
14:08gfredericksbbloom: okay so they're dynamic by virtue of having untyped local variables, which clojure doesn't?
14:08tbaldridgegfredericks: each object in Python has a __class__ attr. Change that to change the class type
14:09gfrederickstbaldridge: that's the grossest thing I've heard all day
14:09justin_smiththat's basically how transients work
14:09arohnerbbloom: I've been threatening for a while to start SHA1'ing the macroexpanded source of my fns
14:09bbloomgfredericks: that's one thing. the word dynamic implies change to me. i was just discussing with dnolen how clojure's vars are ALL dynamic variables. the :dynamic keyword is a misnomer, it really means :threadlocal
14:09justin_smithflag on the data structure
14:09bbloomarohner: hash all the things!
14:09arohnerand then serialize all the things!
14:10technomancyeh; dynamic can apply to scope, not just type
14:10bbloomtechnomancy: yeah, that was about scope. i think the word dynamic invokes a notion of time
14:11bbloomwhich implies a notion of chnage
14:11gfredericks,(letfn [(f [x] (println (type x)))] (f "foo") (f :bar))
14:11clojurebotjava.lang.String\nclojure.lang.Keyword\n
14:11seangrovebbloom: You thinking along the lines of stuartsierra's article?
14:11bbloomwhich?
14:11seangrovehttp://stuartsierra.com/2013/03/29/perils-of-dynamic-scope
14:11seangrovedynamic vs indefinite extent
14:12bbloomwell now we're getting in to a discussion of scope :-P
14:12seangrovebbloom: Well, I think the idea of extent was interesting, emphasizing time/when
14:13bbloomyeah, extent is a scope construct. it's like the area of influence of a binding
14:13bbloomdynamic extent is binding in time
14:13bbloomlexical extent is binding in space
14:14seangroveNever had any of these problems as a kid.
14:18gfredericksoh man and they were system-globals too, not just process globals; why can't we have more languages like that.
14:18bitemyappI started with GW-BASIC.
14:18bitemyapppretty depressing language.
14:19justin_smithgfredericks: that is still how haskell does it, makes naming so much easier when you are limited to one letter
14:19justin_smithand with unicode you won't run out of identifiers either
14:19tbaldridgegot my start there as well. then on to qbasic, then DJGPP
14:19BobSchackAnyone here familiar with fressian? I'm writing a JS port and trying to figure out what to do with Longs since JS only has 32 bit ints
14:19bitemyappjustin_smith: beg-pardon?
14:19justin_smithahh, djgpp, have not seen that character sequence in so long
14:19tbaldridge:-)
14:20bitemyappBobSchack: stringify.
14:20alandipertTI-BASIC was a nice language but i found it too academic, people only write it in school
14:20justin_smithbitemyapp: teasing about the idiomatic usage of one-letter names in so much haskell code
14:20gfredericksmy program's README was a piece of folded notebook paper with pencil scribbles on it explaining what each variable was for
14:20bitemyappjustin_smith: you can eliminate this complaint by writing point-free code and not naming variables at all.
14:21bitemyappjustin_smith: much like my preferred solution to, "there are gendered pronouns in the documentation" --- "we now have no documentation"
14:22justin_smithnot a complaint, a tease, I use one letter names for things with short scope of usage myself
14:23bitemyappjustin_smith: you've got me curious, checking my code to see what that looks like.
14:23stuartsierraI remember djgpp!
14:24bitemyappI see, db-uri, query, limit, offset, args, paginated, num-results, services, request.
14:24bitemyappkw, extant, ensured, new-reg.
14:25coventryYou should implement it in swearjure.
14:25justin_smithgfredericks: assembly, the variable names are address offsets :)
14:26gfredericksbitemyapp: that must be clojure code; haskell doesn't have anything nearly as sophisticated as dashes in names
14:26gfredericksjustin_smith: it's still local to a particular machine
14:26bitemyappgfredericks: right, that's the example I pulled from. Clojure.
14:26justin_smithahh! universal variable bindings
14:26bitemyappgfredericks: specifically from berossus which I just open sourced.
14:26gfredericks$google github berossus
14:27gfrederickslazybot are you still trying to make a large set for me
14:27justin_smithhe'll google it for you, but only if it isn't his own project
14:27bitemyapphttps://github.com/bitemyapp/berossus
14:27bitemyappgfredericks: REST API wrapper for Datomic.
14:28gfredericksbitemyapp: oh so you don't have to futz with the HTTPs?
14:28hiredmangfredericks: dns?
14:29gfrederickshiredman: hey that's a good idea; DNS as a language platform
14:29bitemyappgfredericks: roughly. Their REST API (Datomic's built-in) didn't make me happy.
14:29justin_smithbitemyapp: the readme claims that what the project does is up to me. I have decided it is a hot-or-not clone implemented in rails
14:29gfredericksDotComJure is a clojure-like lisp that runs on DNS
14:29bitemyappgfredericks: we're making a Python OEM for Datomic.
14:29bitemyappwhich will also be open sourced.
14:29hiredmanvllm: very large lisp machine
14:30gfredericksthe helloworld involves godaddy
14:30gfredericksand costs anywhere between $50 and $500 depending on whether you minify your code first
14:32coventryIf you want them to be truly global, you need some kind of reconciliation framework to deal with network partitions. The bitcoin ledger is probably a better platform.
14:33bitemyappcoventry: bitcoin has a built-in script language.
14:33bitemyappof sorts.
14:33justin_smithooo - maybe bitcoin itself could be leveraged as the vm
14:33hiredmanI wonder if anyone has tried to grab .lisp from icann
14:33justin_smithlater upgrading to bytecoin and shortcoin as scaling becomes neccessary
14:34bitemyappyou guys are in a really weird mood today.
14:34technomancy.paren
14:34technomancybitemyapp: "today"?
14:35justin_smithI crashed my bicycle on black ice today and did a belly flop on the asphalt, I am always a little loopy after things like that
14:36bitemyappjustin_smith: :(
14:37justin_smithI survived with some bruises and some bicycle repairs needed
14:42bitemyappjustin_smith: well I hope the repairs are minimal.
14:42bitemyappjustin_smith: and that you didn't crack a rib.
14:43justin_smiththanks
15:09TimMcgfredericks: TI-89 BASIC was my first programming language.
15:10TimMcYou could actually put the global vars in different "folders", so there's that.
15:10TimMcData composition was achieved via stringified arrays inside other arrays.
15:10justin_smithsounds like how tcl does "namespaces"
15:11TimMcOh, but you had to like... switch to the other folder before saving.
15:11justin_smith(for the folders thing that is)
15:11TimMcI was half-way to reinventing OOP before someone got me started learning Java.
15:12justin_smithheh, I did something similar (and totally incompetantly) with c++ and inventing fp, before discovering common lisp
15:21amalloyTimMc: haha, that happened to me too. invented objects on the ti-89, with methods as strings. i forget how parameter passing worked; i think i did replacement on the string $1 as first arg, or something
15:24TimMcamalloy: I was trying to turn the calculator into a PDA. Did you have a grand project as well?
15:24amalloygame programming
15:25TimMc*nod*
15:25TimMcI got partway through writing Mancala (2-player over the link cord) before getting fed up.
15:26TimMcI still have that calculator; it's at least 15 years old at this point.
15:27amalloythe link cord was such a pain that it was easier to just pass the calculator back and forth
15:29danneuIs there an example of http://yogthos.github.io/lib-noir/noir.validation.html usage?
15:29TimMcamalloy: There was also the lack of friends.
15:30TimMc(Well, friends with TI-89s...)
15:46malbertifejoin #lisp
15:46danneuoh yeah, i can read source
15:46mdrogalismalbertife: The irony is that you're already there.
15:48malbertifemdrogalis: :)
15:49bitemyappwhy do I have to install ansi-terminal to use a concurrency library?
15:49`cbpwat
15:49bitemyapp`cbp: Iuno. LVars be weird yo. How are you doing?
15:50`cbptrying to finish work stuff so i can be useful and finish revise :(
15:53gfrederickshttp://marmalade-repo.org/packages/cider-0.4.0.tar => "Don't have any version of cider.tar"
15:54bitemyapp`cbp: don't sweat it! Life stuff is more important than open source.
15:54bitemyapp`cbp: if you need any help, ping me.
15:54gfredericksTimMc: I seriously doubt my TI-83 had folders for variables
15:55danneui like this validation lib https://github.com/logaan/vlad
15:55gfredericksamalloy: I think I got a function link-cable version of hangman working; it was tedious and was not once used for pleasure
15:55gfredericksfunctional*
15:56gfredericksthe funnest thing I ever wrote was A) a snake game, and B) a version that played by itself
15:56TimMcMy minesweeper game took like... 30 seconds to display a move.
15:56gfredericksonce I collected 12 calculators and ran the auto snake program on all of them simultaneously like a horse race
15:56amalloygfredericks: actually the 83 sooooorta had folders for variables. you could use lists: each list gets a 4-character name, and can hold 0+ numbers
15:56TimMchaha, nice
15:57emaphis`hmm. my first programming language was HP-41 RPN
15:57emaphis`Hi, gfredericks
15:57amalloyor maybe that was an 83+ feature
15:57gfredericksamalloy: yeah I definitely used the heck out the lists
15:58gfredericksI had an 83+
15:58gfredericksI kept having to manage archival to fit all the programs/lists in memory
15:58gfredericksemaphis`: hi
15:59technomancygfredericks: argh @ marmalade
15:59technomancynode.js breakage
15:59gfredericksmarmalade runs on node?
16:00technomancyit is one of the great tragedies of our day =(
16:02gfredericksmarmalode
16:03emaphis`spreadable javascript.
16:03gfredericksI have this kids book called "Hop Toad" that seems to be mostly based on the phonetics of the word "toad" and I think maybe from now on I will probably think of it as "Hop Node"
16:04gfredericksthe primary conflict in the book is that the node.js almost gets run over by a truck while crossing the road
16:05gfredericksdoes node.js have a mascot yet? this one might work: http://www.amazon.com/Hoptoad-Jane-Yolen/dp/0152163522
16:06emaphis`Frogger?
16:07marcopolo2gfredericks: I always imagined this to be the mascot for node http://nodedublin-2012-strapping-turtles-to-rockets.jit.su/img/node_turtle.png
16:07TimMcThat looks pretty unbalanced.
16:08TimMcI'm no rocket scientist, but I did play one at summer camp.
16:08gfredericksthe book does have a turtle in it as well
16:08marcopolo2I'm no rocket scientist, but I'm pretty good at Kerbal Space Program
16:09TimMcgfredericks: I'm sold.
16:09gfredericksalso contains the line "Toadal disaster"
16:09marcopolo2gfredericks: hahaha
16:10TimMcMy partner jokes that I'm not interested in movies unless they have animals in them. I think this might be true.
16:10gfredericksnodal disaster?
16:11marcopolo2anyone here in North Florida?
16:12emaphis`North Ohio.
16:13marcopolo2You can take I-75 and get here in an hour
16:13marcopolo2+ some days...
16:13gfredericksNorth chicago?
16:13gfrederickseverybody list what you're north of!
16:13emaphis`not from Ohio.
16:14marcopolo2emaphis`: I must be thinking of cincinnati
16:15emaphis`marcopolo2: I'd guess closer to two hours. :-)
16:15emaphis`maybe three.
16:17TimMcgfredericks: -east.
16:17TimMc-east US, specifically
16:20gfredericksclojure not having a *rand* is rather annoying
16:21gfredericksis there any reason it shouldn't?
16:21gfrederickshas that been proposed before?
16:22marcopolo2gfredericks: what would *rand* do?
16:22marcopolo2set the seed for the rng?
16:22gfredericksit would _be_ the java.util.Random that all the built in rand functions use
16:31bitemyappgfredericks: northern california
16:31bitemyappgfredericks: north of Hell A
16:32seangroveNorth of my monitors.
16:34justin_smithnorth of a bread factory, south of a 20 foot tall wooden teepee with an imac in it
16:35bitemyappnorth and south are kinda relative if you allow looping around the spheroid.
16:35bitemyappjust like west and east
16:35gfrederickswhat?
16:35clojurebotwhat is wrong with you
16:36bitemyappis california really the "west"? We call Japan/China/etc the Far East, and California the west coast
16:36bitemyappbut California is east of Japan
16:36marcopolo2clojurebot: nice
16:36clojurebotPardon?
16:36gfredericksnorth/south have poles though
16:36bitemyappgfredericks: and west/east have the date line.
16:36bitemyappso a point vs. a line
16:37bitemyapphow is crossing and looping past the point any more meaningful than crossing a line?
16:37gfrederickswell the line is physically arbitrary
16:37bitemyappviolating the commonly held understanding of west/east crosses a higher dimensional barrier than north/south would.
16:37bitemyappthe poles are physically arbitrary too
16:37gfredericksthe planet rotates
16:38bitemyappwhy base north/south on that? why not the magnetic poles instead?
16:38bitemyappit would make instrumentation more accurate.
16:38indigo(inc bitemyapp)
16:38indigo:3
16:39seangroveIt would be lovely if IMAP let me retrieve a single message efficiently
16:39bitemyappindigo: I'm glad to see my nihilism appeals to you.
16:39bitemyappseangrove: how do you identify a single message?
16:40seangrovebitemyapp: With gmail's proprietary extension X-GM-MSGID
16:40gfredericksbitemyapp: less variance?
16:40indigobitemyapp: http://cravencottagenewsround.files.wordpress.com/2008/07/nihilists.jpg
16:40gfredericksin any case arbitrarily choosing between two reasonable alternatives is a different scale from arbitrarily choosing from a continuous range of options
16:40bitemyappgfredericks: variance from what? you can't find true north with a compass.
16:40emaphis`the magnetic poles shift over time.
16:41bitemyappseangrove: but absent that, how?
16:41bitemyappemaphis`: so?
16:41seangrovebitemyapp: Fix IMAP?
16:41emaphis`not a good standard for north/south
16:41bitemyappemaphis`: an arbitrary projection is no less for arbitrary when it is based on fixed as opposed to moving points.
16:41gfredericksbitemyapp: do you use a compass to find things?
16:41seangroveAnd by fix, I mean lay on a some standardized extensions
16:41bitemyappemaphis`: good is based on a set of priorities.
16:42bitemyappseangrove: I'm not totally convinced IMAP shouldn't be replaced with a federated database.
16:42bitemyappseangrove: since that's basically all it is.
16:42emaphis`On priority is having a north that doesn't move.
16:42seangroveI don't *think* IMAP is totally broken, but it would be nice if it had continued to evolve
16:42bitemyappemaphis`: that can work if you're okay with not using compasses to find north.
16:43gfredericksbitemyapp: can you find the date line with a compass?
16:43bitemyappseangrove: I think it's built on the wrong assumptions and will not be fixed.
16:43bitemyappgfredericks: no, but unless you memorize location-dependent offsets, you can't find true north with a compass either.
16:43seangrovebitemyapp: Please elaborate, as you continue two simultaneous conversations :)
16:43gfredericksbitemyapp: I never said you could
16:43bitemyappseangrove: like I said IMAP is basically just a federated database
16:44bitemyappseangrove: with "targeted" replication.
16:44gfredericksbitemyapp: my point was that not being able to find something with a compass doesn't make it useless; and having a fixed standard seems more useful than compass-findfulness
16:44bitemyappgfredericks: only because you live in a world with GPS.
16:45gfredericksyou don't?
16:45bitemyappgfredericks: I'm preparing for the zombie apocalypse. satellites fall eventually.
16:46gfredericksokay, my apologies for the noise everybody
16:46indigobitemyapp: Big fan of mechanical watches? ;)
16:46bitemyappgfredericks: sorry!
16:46bitemyappindigo: wind-up.
16:46indigo:D
16:59stompyjhey all, beginner question here. If I need to fork a library, but I don't want to publish it to clojars or something along those lines, in order to reference it in my dependencies... what's the best way to go about that?
16:59stompyj(or better yet, what should I be reading to help me figure it out)
17:00bitemyappstompyj: install locally or publish to private maven repo.
17:00bitemyappstompyj: `lein install` is a thing.
17:00stompyjthanks, I'll check that out
17:00coventryYou can publish it to clojars under a personal namespace. http://clojars.org:8001/org.clojars.coventry/tools.reader
17:01bitemyappcoventry: that still dirties up the search results, doesn't it?
17:01technomancyorg.clojars.* should be ranked below everything else in search results
17:01Jardahey
17:02bitemyapptechnomancy: cool, good to know.
17:02technomancybut if it's literally for one person, `lein install` is best
17:02Jarda(my-function "foo" "bar") and (my-function "foo" [1 2 3])
17:02Jardahow should I differ with these two?
17:02stompyjtechnomancy: bitemyapp: perfect. thanks guys
17:03Jardacan I even overload functions by their type?
17:03technomancypattern matching
17:04bitemyappJarda: case type
17:04Jardaok thanks
17:05coventryJarda: clojure.walk and clojure.walk2 have good examples.
17:06bitemyappcertainly better examples than my code.
17:27devnAnyone here deploy a caribou app to heroku yet?
17:28devnjustin_smith: ^
17:28technomancydevn: if it uses ring it should be the same as anything else
17:28justin_smithI know patchwork has, at least as a proof of concept
17:28justin_smithpatchwork: any wise words on caribou/heroku?
17:29justin_smithwe have seen hiccups with our default max mem and the default heroku app size
17:29justin_smithso you may need to bump down the mem asked for
17:30patchworkdevn: We have had someone successfully deploy to heroku, yes
17:30patchworkAre you having an issue?
17:31devnwell, im helping a coworker
17:31devnhe's not using a Procfile AFAICT
17:31devnHere was his error: 2013-12-11T22:09:26.480017+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
17:31patchworkThere were two small changes necessary which I'm integrating back into the caribou template
17:32technomancydevn: try an uberjar
17:32devnHe also dropped some fns into the production.clj
17:32devnwhich strikes me as odd since there's no ns associated with it
17:32technomancywhat is production.clj?
17:32patchworkdevn: Ah, yeah production.clj is just for config, he should be modifying core.clj
17:32justin_smithdevn: he can try production.clj locally: env _JAVA_OPTIONS=-Denvironment=production lein ring server
17:33justin_smithtechnomancy: caribou environment specific config file
17:33technomancydon't do lein ring server
17:33patchworktechnomancy: Why is that?
17:33technomancypatchwork: build an uberjar, or if you can't do that, use trampoline
17:33justin_smithtechnomancy: I am telling him to do lein ring server locally
17:33justin_smithwith prod config
17:33technomancyoh gotcha
17:33justin_smithnot lein ring server on prod
17:33patchwork(though I have been migrating over to httpkit lately)
17:33devnjustin_smith: so don't drop the jvm opts?
17:34technomancyI still don't get the point of lein ring, but if that's what you like it's fine for local stuff
17:34justin_smithwell try that too :) I think 512 is the limit for the default heroku
17:34technomancy512 is the total limit; the heap needs to be smaller
17:34davhi again
17:34davns some.Example (:gen-class)) (defn -tryThis [this] "yo") (ns user) (.tryThis (some.Example.))
17:34technomancyand 2x dynos get you 1024
17:34davproduces a classNotFound exception..
17:34patchworkdevn: Actually technomancy is right, heroku uses the -main function, so > lein run would be a better simulation of the heroku environment
17:34davany thouhgts?
17:35justin_smithtechnomancy: if you have a reason not to do it locally I am all ears, but it has been our standard MO for running locally
17:35technomancypatchwork: heroku uses whatever you tell it to, but all the docs suggest -main =)
17:35patchworkjustin_smith: I have been using > lein run lately
17:35davdoes gen-class not work from the repl?
17:35patchworkwhich runs httpkit in the latest template
17:35TimMcdav: You probably need to :import the class in the second namespace.
17:35justin_smithwell then I will too
17:36technomancyjustin_smith: -main is just the standard entry point for clojure applications across the board. I don't see the point of introducing a new way to start apps just because they're web apps.
17:36technomancynormalization, and all that
17:36bitemyappif one more person typedefs a function pointer in C and says, "look ma, FP!" I am going to just die
17:36patchworktechnomancy: That makes sense, we used lein ring server before to avoid directly referencing jetty anywhere
17:36technomancydav: gen-class requires AOT. you can do it from the repl with clojure.core/compile, but it's kind of cumbersome.
17:37devnjustin_smith: patchwork: I'm trying to connect to postgres on heroku. :database needs more than just the uri, it needs it split up
17:37devnso the functions he wrote were for splitting up the heroku env's postgres URL and putting it into the map
17:38devnso now he has a function call in that production.clj
17:38davtechnomancy: does that mean I can't put the gen-class in the same clj file that's going to be using it?
17:38technomancydav: no that should be fine as long as you precompile it
17:39patchworkdevn: Ah, interesting. Yeah that should probably go in boot.clj (that is where the config is loaded and the app is initialized).
17:39patchworkdevn: Yeah I have not used heroku with postgres so I haven't run into this issue
17:39patchworkWe can provide a function to generate the caribou config from the string heroku provides
17:40technomancydevn: why doesn't the string config work?
17:40devntechnomancy: he was just matching the way caribou was expecting it
17:40technomancydav: I'm not sure if AOT works with namespaces that don't have files behind them.
17:40patchworktechnomancy: Our db config is in a map, and it constructs the string out of that. We should probably support both since the string approach would be more direct
17:41devn:database {:host "..." :protocol "..."}
17:41devnpatchwork: yeah, that would make it way easier
17:41technomancyargh
17:41technomancyyeah I patched c.j.jdbc specifically to fix that
17:42devnpatchwork: so in boot.clj you're saying, what? to assoc on :database with the result of splitting the URI up?
17:43davtechnomancy: ok I'll try around a bit
17:43davtechnomancy: thx
17:43patchworkdevn: Added to the list!
17:43technomancynp
17:43justin_smithdevn: that can be done in boot.clj
17:43patchworkdevn: Yep, that should do the trick
17:43justin_smiththat is where the config is generated from the config
17:43justin_smith*from the env.clj
17:45justin_smithI ran into similar issues when I added c3p0 connection pooling support (which totally works in a branch btw).
17:45justin_smithregarding caribou.model's conservative expectations of db config layout
17:45devnpatchwork: justin_smith: so this confuses me a bit then. does this mean I need to check my env in boot.clj then?
17:46devnwhat happens to the production.clj config?
17:46justin_smithdevn: that is the source data file
17:46justin_smithboot.clj merges that with some defaults
17:46justin_smithbased on env
17:46justin_smiththen makes it the operating config
17:46justin_smithso anything other than static edn data should happen in that file
17:46patchworkdevn: In the config/config-from-environment call it merges in the config from whichever environment you are running in (production, staging, development etc)
17:47patchworkSo boot.clj has the global config settings, which is supplemented by config from specific environments
17:48patchworktechnomancy: You patched c.j.jdbc to enable database strings rather than maps?
17:48technomancypatchwork: right
17:48patchworkI will have to check out the latest version
17:48technomancythis was a long time ago
17:48technomancymaybe before 0.2.0 or 0.2.1
17:48justin_smithtechnomancy: awesome
17:49justin_smithpatchwork: but we should be more flexible anyway, for pooled data, or nosql, datomic when we add support for those
17:49devnpatchwork: so this is the rub then
17:49patchworkjustin_smith: Agreed, it is really just a relic of the format of c.j.jdbc when I started this project two years ago
17:49devnpatchwork: if that's true, then modifications i make to local-config will be overwritten if production.clj specifies :database
17:50devnso I guess I need to drop :database from that config file
17:50justin_smithdevn: you can check config/environment in boot.clj
17:50patchworkdevn: Check out the let form, config/config-from-environment happens last
17:50davtechnomancy: do I have to do lein build or something for AOT prior to jumping into the REPL?
17:50justin_smithand act conditionally on whether it is "production"
17:50patchworkdevn: So you can just add an extra binding under that that modifies it further
17:51technomancydav: put :aot [my.genclass.ns] in project.clj
17:51devnpatchwork: yeah, did that, now it's blowing up for a different reason, probably not related to caribou. more likely his expectation that we have a heroku env var set.
17:51patchworkdevn: post the stacktrace on a paste somewhere
17:51davtechnomancy: ah cool.
17:52patchworkdevn: like refheap or something
17:52bitemyapp,(set (mapcat (comp merge set keys) [{:a 1} {:b 0} {:c 3 :d 1}]))
17:52clojurebot#{:a :c :b :d}
17:52bitemyappanybody got a way to clean that up?
17:52bitemyappmy solution with "into" was dirtier.
17:54bitemyapp,(mapcat (comp merge keys) [{:a 1} {:b 0} {:c 3 :d 1}])
17:54clojurebot(:a :b :c :d)
17:54bitemyappimprovements from a coworker
17:55danneu would've expected ring.util.response/redirect to handle URI instead of just a string
17:55patchwork,(set (mapcat keys [{:a 1} {:b 0} {:c 3 :d 1}]))
17:55clojurebot#{:a :c :b :d}
17:55ztellmanbitemyapp: what does merge do here? the result is the same with out
17:55`cbp[{:a 1} {:b 0} {:c 3 :d 1}]
17:55`cbperr
17:55`cbpwell patchwork had what i wanted to paste
17:55patchworkbitemyapp: Do you want a set or a list back?
17:56bitemyappztellman: to uniqify. Should that be done at the end?
17:56bitemyapppatchwork: doesn't even really matter, it's just for a unit test, wanted to query all unique keys across a coll of maps.
17:56ztellmanI didn't even know you could call merge on something which isn't a map
17:56ztellmanI'm pretty sure you're not meant to
17:57TimMc&(merge 5)
17:57ztellmanpatchwork's answer is the right one, you could get away with 'distinct' if you don't care about the set-ness
17:57TimMcnullbot
17:57TimMc,(merge 5)
17:57clojurebot5
17:57`cbpoh goodness
17:57ztellmanTimMc: that's probably identity no matter what
17:57TimMc*nod*
17:58ztellmanah, so that's why it's working
17:58ztellmanthough apparently this is possible:
17:58ztellman,(merge #{1} #{2})
17:58clojurebot#{1 #{2}}
17:58`cbp=(
17:58davtechnomancy: so I did this: http://paste.debian.net/70441/
17:58TimMclolwut
17:58TimMc,(merge #{1} #{2} #{3} #{4})
17:58clojurebot#{1 #{2} #{3} #{4}}
17:58justin_smith,(last (take 500 (iterate merge merge)))
17:58clojurebot#<core$merge clojure.core$merge@d46b95>
17:59ztellmanmerge just calls conj, apparently
17:59davCompiling test-xlloop.methods
17:59davtechnomancy: lein repl prints: Compiling test-xlloop.methods
17:59ztellman,(apply merge [] (range 5))
17:59clojurebot[0 1 2 3 4]
17:59davtechnomancy: but once in the repl I can't get my hands on the class test-xlloop.methods
17:59ztellmanI'm never using into again
18:02TimMcI don't suppose merge uses transients, though...
18:03bitemyappTimMc: it's mostly reduce and conj with some boolean checks AFAICT
18:05bitemyappgood to see being untyped leads to !FUN!
18:05devnpatchwork: https://www.refheap.com/b1edceb8c7610770d5f73762e
18:05bitemyappztellman: don't like transients? :P
18:06devnpatchwork: something tells me that the default method of running migrations by specifying resources/config/production.clj is not going to work given there is no :database key/val in there.
18:06ztellmanbitemyapp: it seems like merge should use transients and assoc!, but apparently it doesn't
18:08devnpatchwork: it also seems funky that it's booting an nrepl server in production
18:08justin_smithis that really the default?
18:10devndoo itttt :)
18:10patchworkdevn: Ah, that is editable in the config
18:10patchworkJust take out the :nrepl line
18:10patchworkI'll fix the production config in the template
18:11justin_smithpatchwork: is boot.clj run for the config when running migrate? or will that be a future thing
18:11devnwhat about running migrations on heroku?
18:11patchworkAh! I already have, it has just not been released : )
18:11justin_smithyou can run a migration inside the app - you could make a version that just boots and runs the migration (though that is a total hack)
18:11devn:)
18:12patchworkdevn: If your config points to your database, you can run the migration locally
18:12devnpatchwork: right, but as we discussed earlier it can't
18:12devnbecause that env var lives on heroku
18:12patchworkdevn: Ah, so you have no access to the db info at all?
18:12patchworkStrange
18:13technomancyany reason not to migrate as part of app boot?
18:13technomancyshould be quick to check for needed migrations
18:14patchworktechnomancy: We have talked about it. More just that we don't want to surprise people by automatically running migrations if they didn't intend it
18:14devnpatchwork: nono, let me explain -- (System/getenv "HEROKU_POSTGRESQL_PURPLE_URL") returns a string: "postgres://blah:blah@foobarbaz.com" -- there are some user-defined fns in boot.clj which split that up into a map and assoc it onto the local-config
18:14patchworkBut maybe it does make sense
18:14bitemyappztellman: strange that it doesn't, I would've guessed that it did.
18:14technomancypatchwork: oh I don't think the framework should, but as an app author it's a decision you could amke
18:15patchworkdevn: Understood, but couldn't you log out that string once you receive it?
18:15bitemyapptechnomancy: we migrate as part of app deploy, not boot.
18:15patchworkOr is there a reason the db information is kept from you?
18:15bitemyapptechnomancy: I don't think boot is a good idea, but deploy seems fine.
18:15devnpatchwork: so i get the string and then you're saying to do what with it?
18:15ztellmanbitemyapp: I would have put money on it, before I actually checked
18:15technomancybitemyapp: we have a pretty big pile of reasons not to expose runtime config during build
18:16patchworkdevn: (println (System/getenv "HEROKU_POSTGRESQL_PURPLE_URL"))
18:16patchworkand check the logs
18:16patchworkOtherwise yeah, you can do as technomancy suggested and trigger pending migrations on boot
18:16devni dont see what that buys me for running migrations if the only way to currently run them is by specifying resources/config/production.clj
18:17devnshort of hand-editing that file
18:17patchworkBut I would feel safer about running them directly. Sorry I've never had a db I couldn't connect to directly, it makes the neckbeard in me uncomfortable
18:17bitemyappztellman: me too
18:18patchworkdevn: You could make a new config that just has the remote db info
18:18bitemyapptechnomancy: okay, then in a heroku context, that's not a good idea.
18:18bitemyapptechnomancy: I'd do it as a separate, ran locally, part of the deployment then.
18:18bitemyappnot on heroku
18:18technomancybitemyapp: it would if we had a step between build and release, but we currently don't
18:18technomancywe should though
18:18patchworkdevn: Then do > lein caribou migrate resources/config/local.clj
18:18patchworkwhere local.clj is pointing to the remote heroku db
18:18devnpatchwork: patchwork oh you're saying do this from my /local machine/!
18:19patchworkdevn: Yeah!
18:19devnwhooosh
18:19patchworkBut maybe you can't even connect to the heroku db locally
18:19devnyeah of course that'll work
18:19patchworkwhich is a possibility
18:19devnnono i should be able to
18:19patchworkOkay
18:19devnrunning migrations on deploy would be preferable in my case i think
18:19devnbut this will at least get it running out in space
18:19patchworkdevn: Yeah I see that now
18:19patchworkhaven't come across that before!
18:20patchworkThis is why caribou is still alpha ; )
18:21patchworkdevn: It will improve because you are using it ways we have not anticipated, so thanks!
18:22davI must be missing something very simple :(
18:24dav(1) I've put a trivial (ns :gen-class) in a myclass.clj (2) I've added :aot [test-proj.myclass] in project.clj (3) lein repl compiles myclass (4) java.lang.ClassNotFoundException anytime I try to do anything with myclass.. please help?
18:27bitemyapptechnomancy: realistically it can (and should most cases) just happen in the customer's deploy script before they git push heroku master
18:28amalloydav: not enough information to diagnose a problem. try gisting the relevant code
18:28bitemyapptechnomancy: but I guess the whole point of your company is that they not need to have a deploy script other than gphm huh?
18:28technomancybitemyapp: well, with tests it becomes more complicated. you want a pipeline.
18:28technomancyI think some folks hook it up to circleci &c
18:29devnpatchwork: no dice still, fails to connect, but it is connectable.
18:29technomancybut we don't do enough to make that easy ATM
18:29davamalloy: code is at http://paste.debian.net/70441/
18:29devnpatchwork: you should try out what im doing just to get a feel for the herku deployment situation. im just taking the stock example app and trying to get a deploy to heroku with postgres as the db.
18:30patchworkdevn: Right, I have used postgres with caribou, and heroku with caribou, but not postgres AND heroku with caribou
18:31patchworkI have added it to the list, should be straightened out in the next release
18:32devnpatchwork: patchwork Exception in thread "main" org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "xxx.xxx.xxx.xxx" user "xxx" password "xxx"
18:32devngah sorry for the double nick again, force of habit
18:32patchworkdevn: That is locally?
18:32devnyeah, using the postgres connection details on the heroku postgresql addon page
18:33patchworkSo can you log into the remote heroku psql db from your local machine directly?
18:34technomancydav: needs to include the caller
18:34davtechnomancy: what do you mean ?
18:34devnpatchwork: should be able to. i've done it before.
18:34technomancydav: the part that's actually failing
18:35technomancyis not in the paste
18:35davtechnomancy: I'm just typing (test-xlloop.methods.) in lein repl
18:35patchworkdevn: That looks like a host issue, which would mean your host is not authorized to access the db
18:35patchworkTry it and let me know
18:35patchworkif you can do it directly, you should be able to do it through jdbc
18:36devnyeah, im going to take a break -- but ill test it with straight jdbc to be sure
18:36patchworkdevn: Cool, yeah I'll improve the heroku story here
18:37technomancydav: oh gotcha. does the .class file exist in target/classes?
18:38patchworkdevn: Beyond connecting through jdbc, let me know if you can connect with psql!
18:39devnpatchwork: https://devcenter.heroku.com/articles/heroku-postgresql#external-connections-ingress
18:39devnim guessing it has to do with sslmode=require
18:39patchworkdevn: Hmm… so not with a regular psql command though
18:39patchworkThat is being mediated by heroku
18:40davtechnomancy: yes, target/classes/test_xlloop/methods.class
18:40devnpatchwork: check out this: https://devcenter.heroku.com/articles/heroku-postgresql#remote-connections
18:41technomancydav: has the repl been restarted since compiling?
18:41patchworkdevn: Ah, well there you go
18:41justin_smithpatchwork: devn: I think the easiest thing here is to add a call to caribou.migrate/migrate during the boot sequence, and deploy like that. It will migrate and then boot up. You can comment it out after the first deploy, but even re-running it won't hurt (except by making your boot-time take longer)
18:41devnpatchwork: fixed it
18:41clojurebotI don't understand.
18:42devnpatchwork: i needed to specify :ssl true, :sslfactory "org.postgresql.ss.NonValidatingFactory"
18:42patchworkdevn: Ah, radical!
18:42devni need to give you guys some doc PRs
18:42patchworkdevn: That would be most welcome
18:43technomancynot much longer, hopefully
18:43devntechnomancy: is that comment w/r/t the sslfactory thing?
18:44davtechnomancy: yes, in fact, it's the repl that compiles on startup.
18:44justin_smithdevn: thanks for being patient with these issues and keeping us informed
18:46technomancydav: what you're describing works for me
18:47justin_smithdevn: also we hang out on #caribou and it may be better to have the more in depth caribou specific convos there
18:50technomancydav: maybe try a fresh project. `lein new aoty-thingy; edit project.clj; edit core.clj; lein repl; (aoty-thingy.core.)` and see what's different between the two
18:53davtechnomancy: ok let me try that
18:56davtechnomancy: those exact step do not work for me.
18:57davtechnomancy: CompilerException java.lang.ClassNotFoundException: aoty-thingy.core
18:57davtechnomancy: http://paste.ubuntu.com/6558678/
18:57technomancydav: are you using leiningen 1.x?
18:58davtechnomancy: Leiningen 2.3.3 on Java 1.7.0_25 OpenJDK 64-Bit Server VM
18:59technomancydav: not sure what's going on; can't reproduce the problem
19:00davtechnomancy: could you send me a tar/zip of your aoty ?
19:01technomancysure http://p.hagelb.org/buggery.tar
19:01davtechnomancy: thanks!
19:01technomancyno offense; "buggery" is just what I always call my one-off debugging projects =)
19:03davtechnomancy: none taken ;-)
19:11davtechnomancy: I think it struck me
19:11davtechnomancy: can't have a - in a class name in Java can we?
19:11technomancyoh hum
19:11technomancyaccording to the spec you can't
19:12davtechnomancy: clojure converted it to a _ :-(
19:12davtechnomancy: mystery solved.
19:12technomancyI thought it actually worked ok on openjdk, but maybe not
19:12davtechnomancy: thanks.
19:12technomancyoh, right. you can do it, but clojure won't let you.
19:12technomancysuper annoying
19:12technomancyplease to vote for http://dev.clojure.org/jira/browse/CLJ-1297
19:13technomancywhich wouldn't solve this exact problem but is related
19:13technomancydav: usually gen-classed namespaces are camelcased
19:13technomancywhich is weird
19:15Bronsatechnomancy: clojure will happily compile (deftype foo-bar []) though
19:17arrdembitemyapp: dotas in a couple hours?
19:21davtechnomancy: will do. thanks for all the help!
19:27technomancynp
19:28pandeirois this :include-macros keyword for :require expressions new in cljs?
19:39bitemyapparrdem: dinner with technomancy, then we can.
19:39bitemyapparrdem: done with your finals?
20:17meoblast001Raynes: hi
20:18Raynesmeoblast001: Hi.
20:18meoblast001cool
20:44murtaza52I have a collection of tuples which are ordered. When I convert them into a map, I loose the order. How can I keep the order ?
20:44amalloydon't convert them into a map
20:47coventryIs ordered-map a bad idea? https://github.com/flatland/ordered
20:47gfredericksany guesses when clojure/west will be announced?
20:49amalloycoventry: i mean, it's not awful. there are specialized scenarios where you might want an ordered-map (which is why i wrote it). but most of the time, you either want a map or you want ordered tuples, and trying to conflate the two just leads to confusion
20:52coventryamalloy: Makes sense. Thanks.
20:57shep-homeDoes anyone have suggestions for Clojure projects I can read from and learn more about testing in Clojure?
20:57shep-homeI'm getting the distinct sense that most of the tests I want to write are duplication of the implementation
20:57shep-homeWhich doesn't sit well with me.
20:58gfredericksshep-home: what sort of code are you testing? business logic?
20:59shep-homegfredericks: I decided to do something nice and easy to (inc clojure-skill)
20:59shep-homeso, I'm trying to implement Raft
21:00shep-homehttps://ramcloud.stanford.edu/wiki/download/attachments/11370504/raft.pdf
21:00shep-homeWhich is stretching me in lots of ways
21:01shep-homeBut I've been reasonably happy with how I'm forced to separate my code
21:01shep-homebut I'll end up with tiny-ish functions
21:02coventryshep-home: Make tests for each of the paper diagrams.
21:03shep-homecoventry: so, here's where my imperitive programming background kicks in...
21:03shep-homeMos tof the diagrams seem to focus on successions of state
21:04shep-homeAnd it feels a little funny to have a test that is
21:04coventryDoesn't the corresponding logic in your implementation involve updating state somewhere? Test that that's happening as it should.
21:04coventryHow are you tracking the successions of state in your implementation?
21:05shep-home(let [server (-> (create-server) state-trans1 state-trans2 ...)] (is ...some assertion on state...)
21:05shep-homecoventry: well, I've punted a small bit there. I've started with an agent for it
21:06coventryThe code you wrote there looks sane to me.
21:06shep-homeBut testing against the agent feels like a comparitively high-level test
21:09shep-homeFor example, once I get that high, my "sockets" (aka in-memory queues for now) come into play
21:10shep-homeI also started to look into simple-check some. Some of those state-transition steps have parameters that I've arbitrarily chosen
21:11shep-homeBut I'm not sure that it makes sense for these tests...
21:12shep-homeMost of the books and whatnot have talked about how the testing frameworks work... but I'd love to see real-life examples
21:13gfrederickssimple-check is the knee of the bee
21:15coventryYou might try arranging it so that (create-server) contains a reference to the agent, and all the state-trans* fns refer to the agent that way. Then you can have (create-server :test) refer to a mock of it, or something. Or you could just bash the reference in your tests so that it points to a mock.
21:16coventryFor reading, try the tests in aleph. https://github.com/ztellman/aleph/tree/perf/test/aleph/test
21:18shep-homecoventry: to clarify, are you using * to mean one-or-more or as in "foo and foo*" method pair?
21:18coventryyeah, I meant it as a glob.
21:20shep-homeWould you expect that the functions take in server or server-agt?
21:22coventryThat server-agt is an agent should be an implementation detail of server which the state-trans* fns don't touch.
21:27shep-homeOk, I agree with that. So there would be user-facing method that ultimately do the send or swap or dosync, right?
21:27shep-homemethods*
21:28coventryFrom what you've described, that sounds like a sensible way to do things.
21:29shep-homeAnd would you expect I have tests that drive via these user-facing methods? That seems only sensible, but those start to feel like full-stack-ish / integration tests.
21:30coventryThe goal is to make anything like that an extremely simple wrapper around a pure function.
21:32shep-homeThat all makes sense. I'm also stuck with the fact that there are side effects scattered throughout
21:33shep-homeLike, when you get a message, you need to send a message
21:33shep-homeSo I've been trying to push all those to the outside of my pure state modification methods
22:02jweisswhat is the mechanism clojure uses to avoid duplicating the list in memory when you run something like (drop 5 (range 10000)) ? I thought it was STM but that seems to only deal with concurrency.
22:04eric_normanddnolen: when did #js come to be?
22:10Apage43jweiss: garbage collection? =P
22:10coventryjweiss: laziness.
22:10coventry$source range
22:10jweissno, it's not either of those. there's a diagram on the clojure site that shows a tree in memory
22:10jweisssorry maybe range was a bad example
22:10maravillasstructual sharing
22:11jweissyeah, that
22:11beppujweiss: http://paulsanwald.com/blog/234.html (intro to lazy-seq)
22:11coventryrange is definitely returning a lazy seq, and drop is dropping the head.
22:12coventryBut yeah, for non-lazy structures, it's structural sharing. I think hyperion had a good post on this recently
22:13jweisscoventry, but i'm pretty sure (take 5 (doall (range 10000)) wouldn't duplicate in memory either.
22:13coventrySure. http://hypirion.com/musings/understanding-persistent-vector-pt-1
22:19jweisscoventry: ah that's helpful, thanks. i would think this would be something common to many programming languages but i don't think i've used any other that has it. i'd guess haskell probably does
22:19`cbpevery lisp has structural sharing for lists :P
22:20`cbpnot that it's very hard to implement
22:20coventryIt's a pretty alien concept. Some folks on #python were arguing volumes that it wouldn't make sense to have such structures in python.
22:20coventry(a couple of weeks ago.)
22:21jweissi have been learning python lately and the #python channel is, shall we say, less pleasant than this one.
22:22jweissok i think perhaps the term i am looking for is 'persistent data structure'
22:22newblueRich Hickey explains structural sharing about 30 minutes into this video: http://www.youtube.com/watch?v=wASCH_gPnDw
22:22jweissultimately what i was wondering is, does this concept exist in any lower-level languages
22:23coventryWell, they've been ported to javascript. :-)
22:25jweissi suppose to make my question even more abstract, is how close to the machine can you get without being forced into looking at it in the von neumann perspective
22:38arrdembitemyapp: nice! I'm jelly. done with finals on saturday night but I'm done for the night so whatever
22:46bitemyappweeeeee
22:46bitemyapparrdem: that was technomancy. that was his way of saying hi.
22:46arrdembitemyapp: haha
22:46bitemyapparrdem: he doesn't know how to use irssi. (erc user. and dvorak.)
22:47arrdembitemyapp: ah yes... the emacs curse...
23:36bitemyapprickasaurus: "EXPERIENCE REQUIRED: [...] Object oriented programming experience in Haskell." http://t.co/A3MGRrykrK
23:37coventryYou can write java in any programming language.
23:38arrdem#fivehorrorsofprogramming
23:38arrdemor whatever that was
23:41hyPiRion#FiveWordTechHorrors
23:41arrdemyeah that
23:43{[^-^]}so, is it better to, after you've finished designing, optimize your clojure in different clojure or java?
23:44{[^-^]}I guess what I'm asking is can you optimize clojure to be as fast as java without becoming unreadable
23:44arrdemsometimes you just gotta write java if it's that much of an issue.
23:44arrdembut there are tricks you can play with profiling clojure code to speed things up
23:52eric_normandbitemyapp: data MonadManagerFactory = ...
23:56dnolenan MVC "framework" in ClojureScript, whopping 24 lines https://github.com/swannodette/om/blob/master/src/om/core.cljs