#clojure logs

2013-09-10

00:00ddellacostacallen: is there a way to link to a session in himera?
00:02callenzanes: not really. I'm very sick, my throat hurts, and I'm cringing and shaking at just swallowing food.
00:03zanescallen: Oh no!
00:03callenddellacosta: screenie
00:04ddellacostacallen: naw, I won't make you deal with my IE8 woes. I'm going to poke at it and see if I can reproduce it in an isolated environment with the latest version of CLJS, and if so I'll file a bug report.
00:04TEttingercallen, kittens make sick times better http://imgur.com/gallery/iYfbrwb . just adopt all the cats at the local humane society in a fevered daze
00:05callenTEttinger: don't say that. I love dogs and cats.
00:12callenTEttinger: thank you for the therapeutic kitty
00:12TEttingerget well soon
00:12callenTEttinger: thank you ;_;
00:13TEttingerwe need you back and having to repeat yourself to people who ask poor questions in 24 hours
00:15callenI can't tell if that's genuine sympathy or a characterization.
00:16TEttingercallen, you fill a role here. if you're sick, #clojure has no bouncer for poorly asked questions.
00:17callenwell don't that just warm the cockles. :)
00:17TEttingerand we do seem to get a lot lately
00:17callenTEttinger: I'm more worried about the bad answers than I am the bad questions these days ;)
00:18coventry`How can I tell lein to run clojure built from source, in such a way that I will end up with clojure/test-closure on my classpath?
00:18TEttingerwhen I'm here I'm probably too forgiving with people who really should get the advice "read a book/tutorial" and I try to solve their problems when they won't learn from it. and I also usually fail to solve their problems.
00:18rhgcheckouts
00:18callencoventry`: ^^ what rhg said.
00:18coventry`Great. I assumed that wasn't going to work, because it's not a lein project.
00:19callenoh wait
00:19callensource?
00:19clojurebotsource is http://github.com/hiredman/clojurebot/tree/master
00:19rhgoh
00:19callencoventry`: is it a single file?
00:19rhgehm
00:20rhgadd it to the cclasspath manually?
00:21callenit sounds like it should either be made into a lein project, symlinked, or copied.
00:21akurilinDoes ring by default turn on the stacktrace middleware in dev profile? I've never seen the ring stacktrace for 500s until now, and I never enabled it explicitly.
00:22callenakurilin: lein ring
00:22callenring doesn't "do" anything
00:23rhgcallen be right ofc
00:23akurilinI guess this is the first time I'm doing an html content type GET, which explains why I haven't seen it before.
00:23coventry`Thanks, guys. I'll make clojure-test into a project, and symlink to that from checkouts/
00:24callencoventry`: good choice.
00:24callenI need to start charging y'all.
00:24callensurcharge for "sick and dying" support.
00:25akurilincallen, thanks for pointing that out, found out that stacktraces are on by default from the docs.
00:26akurilinNot that anybody can read those things until a couple of months in.
00:26akurilinstacktraces, not docs.
00:26akurilin:)
00:26coventry`callen: If I succeed with this, it might reduce the number of stupid questions. I hope that's sufficient reward. :-) Anyway, off to bed. Hope your recovery is swift and painless.
00:29callencoventry`: your questions aren't crazy.
00:36fkeyHey there, trying to solve a issue the clojure way, and can't decide the best route. Bascially given a list of coordinates, i want to draw lines connecting each coordinate. For the last pair of coordinates, i want to determine the direction in which the line was drawn and then draw a arrow head at the end.
00:37fkeycurrently i got a bunch of procedural code and want to do away with it
00:38fkeyso, for the connecting of arrows, using reduce does sound like a nice solution
00:39fkeybut theres no way to determine if you are currently on the last item being evaluated, and i rather now calculate the direction vector every time reduced is called...seems wasteful
00:41ambrosebsfkey: map-indexed is often useful.
00:41fkeyso , you think its fair to do something like
00:41fkeyah
00:42fkeymeh still..i rather not do a if statement in each function map call..seems wastefulk
00:42fkeywas planning on doing something like
00:43fkey(defn drawConnectionWithArrow [canvas points] (reduce drawLines ...) (drawArrow points ...))
00:43ambrosebsseems like you need a branch somewhere though?
00:43ambrosebsah
00:43ambrosebssee butlast.
00:44ambrosebsprobably what you want
00:44ambrosebsyou can then feed the everything except the last thing into one fn, then the (last ..) into the other one.
00:44fkeyhmm
00:45fkeyas far as functional programming goes though, in clojure is it alright do do the above what i have posted? Seems a little procedural... but works
00:46ambrosebswith reduce?
00:46ambrosebsnothing wrong with that.
00:46ambrosebsunless it's too slow.
00:47fkeyambrosebs: well just function call right after the other... i mean i can probably do something like have drawLines return the last 2 points it operated on, then i can do (drawArrowAtTail (drawLines ... ))
00:47ambrosebsoh. yes that's fine.
00:47fkeynot sure what is more succinct though
00:48fkeyi just like the idea of have a function operate on the return value of another function
00:48ambrosebsfkey: seems better to separate them
00:49fkeyoh yeah?
00:49ambrosebsyou can then run whichever you want in any order.
00:49ambrosebsor at the same time
00:49fkeyhmmmm true true
00:50fkeyi think back in common lisp, you had to use let or do to perform multiple forms in a function
00:50mtpprogn
00:50mtpand no
00:50fkeyor w/e you want to call it..still getting use to that being alright in clojure
00:51ambrosebsfkey: a `do` can still be readable. Says "side effects!" to me.
00:51MisterSinisterCould someone teach me how to use if-let?
00:51ambrosebsso don't be afraid of putting extra ones.
00:52fkeyambrosebs: alright. i watched a talk on monads, i forgot who gave it but was talking about haskell and how they dealt with ouput and whatnot..i liked the idea
00:52fkeyalthough my previous code isn't following monadic design at all heh
00:53fkeywasn't sure if it was something to strive for in clojure
00:53francis_wolkeMisterSinister: clojuredocs.org
00:53ambrosebsfkey: not often.
00:53MisterSinisterfrancis_wolke: I've looked at it, and I still don't really get the idea. I also suspect I might be thinking of the wrong tool to refactor my particular code pattern
00:53MisterSinisterCould I gist it to you and see if you can suggest anything?
00:54MisterSinisterI've seen that pattern before, and I dunno how to refactor it away.
00:54francis_wolkeyea
00:54ambrosebsMisterSinister: put it here if you want.
00:54MisterSinisterambrosebs: It'll be tidier in a gist than me pasting it in here.
00:54MisterSinisterGimme a moment.
00:54ambrosebssorry I meant the link :)
00:55ambrosebsI figured you were pming.
00:56MisterSinisterambrosebs: PMed.
00:57MisterSinisterhttps://gist.github.com/mrsinister13/6504991 if anyone else wants to help me refactor away this pattern I keep seeing.
00:59fkey ambrosebs:: ty for help
00:59ambrosebsfkey: np
01:01francis_wolkeMisterSinister: I fail to see what you'd like to factor out - though prehaps I'm missing something?
01:02francis_wolkeMisterSinister: `if-let' is an anaphoric macro, there is no 'it' in either of those examples.
01:02ambrosebsI think MisterSinister want something like `if-every`.
01:03ambrosebsDoes that exist?
01:03clj_newb_2345how does swank/nrepl relate? is nrepl a repalcmenet for swank?
01:03MisterSinisterI've never seen an 'if-every' in Clojure.
01:03s4muelclj_newb_2345: Yes.
01:03ambrosebswell it would be if-every-let :P
01:04MisterSinisterBecause what I'm trying to avoid is having to retype the same destructure and the same method call to the same let binding.
01:04clj_newb_2345so I should not use the lein-swank [plugin?
01:04francis_wolkeMisterSinister: macros....
01:04MisterSinisterfrancis_wolke: This is why I'm asking for help - I suck at them and wouldn't even know where to begin.
01:04ambrosebsMisterSinister: what do you want to write instead?
01:05MisterSinisterSomething like this:
01:05francis_wolkeMisterSinister: aplogies, but I don't answer questions for people who won't read.
01:06xeqiclj_newb_2345: if you are used to swank it continues to work, but is unmaintained. nrepl is the prefered mechanism moving forward
01:06MisterSinisterfrancis_wolke: What do you mean? It's not like I haven't read about macros - I just haven't ever written one and am unsure how to proceed.
01:06ambrosebsThe best place to start with a macro is what you want the output to be.
01:07MisterSinisterYeah - I'm trying to think that through right now.
01:07francis_wolkeMisterSinister: If you need some material on them, buy or pirate a book. Sit down with it, and read the chapter on macros - look at the examples, write the code, experiment, write some more code, experiment...
01:08MisterSinisterfrancis_wolke: And I've tried that, and haven't gotten very far. Which is why I thought I could come to a channel full of people obviously better than I am at this to ask for some help with something I've tried to solve in the past but failed horribly, as I'm not even sure where to begin.
01:09ambrosebsfrancis_wolke: please, newbie questions are more than welcome here.
01:09ambrosebswriting your first macro is not easy.
01:11fkeyambrosebs: can you take a quick look at my coding style? For some html5 canvas stuff i usually end up writing code like so http://pastebin.com/iTYMVVXs
01:11fkeyoh, i messed up the parenthesis ...but the overall style..is it alright? or am i still thinking to procedurally?
01:12francis_wolkeambrosebs: acknowledged.
01:14fkeyi probably can get away with the (first Points) and (restPoints) with parameter deconsturction
01:14fkeyi think thats the name...
01:15ambrosebsfkey: yes, [p & ps]
01:15clj_newb_2345in nrepl
01:15clj_newb_2345how do I get the last command?
01:15clj_newb_2345i.e. UPARROW in bash/zsh
01:16clj_newb_2345so basiclaly, I want the last expression I valuated to be thrown back into the current line
01:16clj_newb_2345so I can edit it and rerun it
01:16xeqiclj_newb_2345: it depends on what nrepl client you are using
01:16clj_newb_2345what emacs command can I run to report this info to you?
01:17ambrosebs,(drop 2 [1 2 3 4 5])
01:17clojurebot(3 4 5)
01:17xeqiclj_newb_2345: emacs was sufficent. then you are using nrepl.el. Try M-p
01:17ambrosebswhat's the function for [1 2 3 4 5] => [4 5]?
01:17xeqifor reference, there are also nrepl clients for vim, eclipse, and a standalone one
01:18clj_newb_2345ah, M-p works, thanks
01:18xeqi$findfn [1 2 3 4 5] [4 5]
01:18clj_newb_2345I was trying C-p but it was sending me to preivous line
01:18lazybot[]
01:19xeqi$findfn 2 [1 2 3 4 5] [4 5]
01:19ambrosebs,(take-last 2 [1 2 3 4 5])
01:19clojurebot(4 5)
01:19lazybot[clojure.core/take-last]
01:19ambrosebswow.
01:19ambrosebsthat's epic.
01:21srruby$findfn 2 [1 2 3 4 5] [4 5]
01:21heathohai bear #clojure
01:21lazybot[clojure.core/take-last]
01:21ambrosebsfkey: ^^ use take-last 2
01:21heath"the value of values" by ye ole rick
01:21srruby$findfn first [1 2 3 4 5] 4
01:21heathrich, rather
01:22lazybot[]
01:22heathhe's saying values should be immutable, just wondering why everyone seems to agree with him and not pipe up :)
01:23fkey ambrosebs: it amazes me how theres always a function in clojure for opearting on a data set..but then again
01:23ambrosebsheath: cos he's right?
01:23fkeyi think rich hickey said few data types, many functions
01:23srruby$findfn [1 2 3 4 5] 1
01:23heathambrosebs: why is he right?
01:23lazybot[clojure.core/first]
01:23ambrosebsheath: I can't explain it better than rich.
01:24heathhe didn't explain it
01:24heath"do we want to go back, no"
01:24heaththat's about it
01:24heaths/it/all\ he\ said
01:24fkeyambrosebs: ty ty ty once again, i really appreciate the input
01:25clj_newb_2345is there a way to have "(use '[clojure.tools.namespace.repl :only (refresh)])" auto executed at the start of every "lein repl" ?
01:26heathhe mentions comparibility and equality around the 10 minute mark
01:26heathbut you can compare values even if they aren't immutable
01:26ambrosebsheath: so the biggest thing for me that immutable values just never change.
01:27xeqiclj_newb_2345: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L296
01:27ambrosebsheath: if you have a language that facilitates that like Clojure, you have to think less about "will this change here"?
01:27clj_newb_2345is this a hint to read the rest of the file? :-)
01:27ambrosebsheath: transforms the way you program.
01:27ambrosebswell, if you weren't programming in a "functional" style already.
01:27francis_wolkeclj_newb_2345: look for :injections
01:28MisterSinisterImmutability is awesome.
01:28MisterSinisterIt's what actually drew me to Clojure.
01:28xeqiclj_newb_2345: I woudln't wory about it, maybe just :repl-options 's :init and :init-ns
01:29ambrosebsthat's a local view however. bigger things like concurrency and databases like datomic use immutability to their advantage.
01:29ambrosebsdatomic can easily give you an immutable snapshot of you database, that never changes.
01:29francis_wolkeclj_newb_2345: ignore me xeqi is correct.
01:29clj_newb_2345noted
01:29clj_newb_2345 /ignore ...
01:30ambrosebsand Clojure's atoms and refs show that you can have managed mutability holding immutable values without deadlocks or concurrency problems.
01:30ambrosebsand it's fast!
01:30ambrosebsand efficient!
01:31ambrosebshow shit I love immutability! ;)
01:31ambrosebs*holy
01:31ambrosebshaha
01:32heathah, if i would have just shut up and listened, he does explain a little later :)
01:33ambrosebsheath: is your background heavy with mutability?
01:33heathmostly
01:34ambrosebsheath: it's a different world out here, it may take some rubbing off.
01:34heathwhy dynamic and not static
01:35ambrosebstypes?
01:35heathi thought he was referring to static typing :P
01:35heathturns out clojure is dynamic :)
01:35ambrosebsI think Rich often says dynamic to mean types and runtime.
01:35MisterSinisterheath: I came from Java. Mutability was burned into my brain too.
01:35ambrosebsat least that's my take on it
01:37heathmost of my functional programming comes from my excursions with haskell
01:37MisterSinisterYay, I've used if-let correctly.
01:37MisterSinister\me does a happy dance.
01:37MisterSinisterFFF
01:37MisterSinisterBetter.
01:37ambrosebsheath: nice. immutable haven there.
01:37heathyerp
01:37ambrosebsMisterSinister: yay!
01:38heathmost of my professional work is javascript and soon to be python
01:38MisterSinisterBrb
01:38heatherlang has the same typing as clojure
01:39heathanyway, at this point i'm just picking a fight for no reason, i should listen to the guy while transfer pdfs to the kindle
01:39ambrosebsheath: they're both strong dynamically typed langs.
01:39heathright
01:40heathwhen i think of immutability, i think of strong and static
01:40ambrosebsright, fair enough.
01:40ambrosebsthey tend to have good support for immutability.
01:41ambrosebsthe functional ones, that is.
01:42ambrosebsimmutability also makes it much nicer to build a type system on top of Clojure.
01:44gvickersMade this as part of a plugin system to load .clj files dynamically and make sure they have the required function. It seems messy and a very un-clojure way of doing things. Prehaps dynamically loading the jar's would be better? Anyone have any experience with this sort of thing? https://www.refheap.com/b18653541d9bb3409904b3a51
01:46ambrosebsgvickers: you have to roll your own solution to that often.
01:46ambrosebsgvickers: I don't think there's a particular accepted way to do it.
01:47ambrosebsgvickers: FWIW it looks about right to me.
01:48sdegutisgvickers: another option is to use read-string on the file's contents and look for a list starting with (defn the-required-function ...)
01:48sdegutisProbably not 100% foolproof, but probably good enough.
01:49ambrosebssdegutis: if you want to go that ^ route, use jvm.tools.analyzer.
01:49ambrosebsgvickers: ^ rather
01:49ambrosebsIt seems any other solution would be more complicated than your current one.
01:52gvickersHmmm thank you. I assumed this sort of thing would be more common with established design patterns. Thanks for your help!
01:53ambrosebsRacket is way ahead of Clojure in that regard unfortunately.
01:54xeqigvickers: lein does something similar with https://github.com/technomancy/leiningen/blob/master/leiningen-core/src/leiningen/core/utils.clj#L53
01:55sdegutisambrosebs: now's our time to copy whatever they're doing and catch up
01:56ambrosebssdegutis: I have no idea how to write lazy-require :)
01:56sdegutisWhat's it do?
01:56xeqigvickers: are you using the ref somewhere else?
01:56ambrosebsonly load a namespace when a var is used.
01:57sdegutisOoooh. Yeah.
01:57ambrosebsdo want.
01:57sdegutisThat's probably not even a good idea.
01:57sdegutisBecause namespaces could have side effects upon loading that you want happening early. Maybe.
01:57sdegutisAnd other stuff.
01:57gvickersxeqi: yea
01:58ambrosebssdegutis: yes, turns out Racket handles all of this.
01:58ambrosebssdegutis: See Flatt's keynote at Clojure/West
01:59gvickersI gotta check out Racket
01:59sdegutisambrosebs: ok thx
02:03heathi guess this is my real question: how can one consider a value immutable if it's there's dynamic typing?
02:03heaths/it\'s//
02:03sdegutisheath: can you change the value of 3?
02:04sdegutis3 = 2
02:04heatha = 3
02:04sdegutis(now 3 + 3 = 4)
02:04heatha = 2
02:04heatha + b
02:04ambrosebsthey are unrelated. The type system helps you reason about your code, immutable values just never change.
02:04sdegutisheath: a represents a value, a is not a value
02:04ambrosebsheath: can you explain what you think links static typing and immutability?
02:05heathisn't a representation simply a variable?
02:05heathcollections, numbers, i guess these are the things considered values within clojure
02:06sdegutisheath: what is your strongest language besides Clojure?
02:06heathclojure isn't my strongest :)
02:06sdegutisheath: what is your strongest language?
02:07heathjavascript -> python -> haskell || agda -> erlang || c++
02:08sdegutisheath: in Python, you can create a list like X = [1, 2, 3], and then you can actually delete 3 out of X, and anyone who has access to X now sees [1, 2] right?
02:08heathsure
02:08sdegutisheath: in Clojure what we mean by "immutable" is that if I have X pointing to [1 2 3], and I "remove" 3 from it which gives me [1 2], anyone else who had access to X before I did that still has [1 2 3]
02:09heathambrosebs: a = 1; a cannot equal anything else, that's how i see the link between immutability and static typing
02:09sdegutisheath: All I did was create a new copy of [1 2 3] that doesn't have 3 in it. I didn't "mutate" the list.
02:09sdegutisambrosebs: nice tangent :P
02:10heathfunctions reference older copies of values, hm.
02:10sdegutisheath: No, not that.
02:11sdegutisheath: Even inside the same function, I can create X = [1 2 3] and create Y = X, and "remove" 3 from X, and Y is still [1 2 3] even though X is now [1 2]
02:11xeqiand becareful of the ""remove" 3 from X" part
02:11sdegutisheath: because when we say we're "removing" an element from a list in Clojure, we really mean something more like X = X.copy, X.remove_last
02:12heaththat's what i was getting at sdegutis
02:12heaths/getting\ at/said :)
02:12ambrosebsheath: there is nothing fundamental about immutable data structure or immutable variables that requires a static type system.
02:12sdegutisheath: This is all discussed in the Programming Clojure book. Please read it.
02:13heathbut let's say you have a function that which will reference a variable each time it is called, if that variable is changed to represent an entirely different type, you will get a different result everytime the function is invoked
02:13heaths/which//
02:14sdegutisheath: that's lexical scoping. Values are distinct from from variables.
02:15sdegutisheath: that's why this works ##(for [x [1 2 3]] (inc x))
02:15lazybot⇒ (2 3 4)
02:15sdegutisheath: it's not that 1 is being mutated, but that "x" changes to hold a different value each time
02:15heaththe 'vary' part of 'variable'
02:15ambrosebstry "local binding"
02:16ambrosebsit's an immutable link from a name to a value.
02:18andyfingerhutI hope I'm not simply muddying the water by giving a similar example like (for [x ["foo" #{1 2 3} [3.5 2.8]]] (count x))
02:18andyfingerhutEach time through the for, x is bound to a different value. In my example, each of those values has a different type. So the name x names a value with a different type in different iterations. Each of those values is immutable, though.
02:20ambrosebsA static type system might type `x` as (Vector Any), but either way, it's still immutable.
02:21sdegutisandyfingerhut: add # before it and it evals like magic :)
02:21sdegutisNo matter where it is in your message.
02:22andyfingerhutsdegutis: Thanks. I haven't kept up with all the bot-magic available.
02:22andyfingerhut#(for [x ["foo" #{1 2 3} [3.5 2.8]]] (count x))
02:22sdegutisWait let me test it. #(+ 1 2)
02:22sdegutisMaybe it's two.
02:22sdegutisTesting ##(+ 1 2)
02:22lazybot⇒ 3
02:22sdegutisOkay yeah two.
02:22andyfingerhut##(for [x ["foo" #{1 2 3} [3.5 2.8]]] (count x))
02:22lazybot⇒ (3 3 2)
02:23andyfingerhut##(for [x ["foo" #{1 2 3} [3.5 2.8]]] (type x))
02:23lazybot⇒ (java.lang.String clojure.lang.PersistentHashSet clojure.lang.PersistentVector)
02:23sdegutisHeh for a second I misread that as an exception and was wondering what was wrong with the code which seemed fine.
02:29zRecursive##(for [x ["foo" #{1 2 3} [3.5 2.8]]] (count x))
02:29lazybot⇒ (3 3 2)
02:32rhgHeh
02:38clj_newb_2345what does defroutes return, and how do I "intercept it" ? So for example, I'm runing my ring/compojure server via : (run-server (site #'all-routes) {:port 3000})) ---- now, suppose I wnat to update my routes; how can I setup it up so that I can dynamically update the routes?
02:40SegFaultAXclj_newb_2345: It just returns a function.
02:46mangeclj_newb_2345: If you use that line to start your server then you should be able to re-evaluate your (defroutes all-routes ...) form and the server will automatically pick up the new version.
02:47mangeThe trick is that your #' introduces another level of indirection that looks up the function in the all-routes var when it's invoked.
02:49MisterSinisterDoes anyone know if there's some function that takes a collection and returns every ith item in it?
02:49MisterSinisterI don't wanna have to write it if it exists already.
02:50mangetake-nth, I think?
02:50clojurebotHuh?
02:50MisterSinisterLol@clojurebot.
02:51MisterSinisterThanks mange, you're absolutely right.
02:51MisterSinisterI swear, Clojure's thought of everythign you could ever want from sequences.
02:52MisterSinister,(doc take-nth)
02:52clojurebot"([n coll]); Returns a lazy seq of every nth item in coll."
02:55akurilinQuick question about function purity in Clojure. Say I have this map with config settings for my Ring app somewhere in a configs.clj. If I wanted to be completely pure I'd just pass this map along to every call that might need it. On the other end of the spectrum I could read it from anywhere in the codebase as immutable global state. What is the sweet spot in Clojure for this kind of tradeoffs?
02:55akurilinShould I have a convention where, for example, I never reference that var outside of say, the top level functions in my controllers.
02:56ambrosebsakurilin: if it never changes I think a def is fine.
02:57akurilinambrosebs, is the idea then that for testing I just override the def with appropriate settings?
02:58ambrosebsakurilin: ah, good point
02:59akurilinThe prob is that I'd have to either load a test-only config file for lein test runs, which is I believe what Rails does, or I could wrap all tests in with-redefs fixtures.
03:01ambrosebsakurilin: maybe a top-level atom might be useful.
03:05MisterSinisterAlso, holy shit source code for if-let.
03:06ambrosebsMisterSinister: *mind blown*
03:06ambrosebsit's if... and let
03:07MisterSinisterIf I actually had to write if-every, I'd probably have some trouble.
03:11MisterSinister,(doc drop-nth)
03:11clojurebotTitim gan éirí ort.
03:11MisterSinisterDafuq.
03:12MisterSinisterWhy is clojurebot telling me to get down and stay down in Gaelic?
03:12ambrosebs##(doc drop-nth)
03:12lazybotjava.lang.RuntimeException: Unable to resolve var: drop-nth in this context
03:12ambrosebshaha
03:12ambrosebsthese bots..
03:12MisterSinisterOK, looks like I'll have to write it.
03:14MisterSinisterMaybe I'll have to bite the bullet and actually learn for.
03:14MisterSinister,(doc for)
03:14clojurebot"([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost fastest, and nested coll-exprs can refer to bindings created in prior binding-forms. Supported modifiers are: :let [binding-form expr ...], ...
03:16ambrosebsMisterSinister: something like this: https://gist.github.com/frenchy64/6505818
03:16MisterSinisterThat is a very nice macro you got there.
03:16MisterSinister\me borrows it for his utilities.
03:18ambrosebsMisterSinister: haven't tested it.
03:18ambrosebsactually just updated it too.
03:18ambrosebsforgot an unquote
03:18MisterSinisterI'll do a few macroexpands with it.
03:19MisterSinisterIn the let?
03:19MisterSinisterFor rhs?
03:19ambrosebsyes, should be fixed.
03:20ambrosebsyou might want to steal if-let's error reporting too.
03:20MisterSinisterProbably.
03:21MisterSinisterI need to figure out how to call this thing.
03:21MisterSinisterI get it in theory.
03:21ambrosebslike if-let
03:21ambrosebsthere's an example on the gist now
03:21MisterSinisterOK.
03:22MisterSinisterAh, I see now.
03:22MisterSinisterAwesome.
03:23MisterSinisterThanks!
03:27MisterSinisterIs there a macro that automatically destructures a map whose only keys are symbols (i.e. a record) and binds to the non-symbol equivalents of each key?
03:28MisterSinisterFor instance, if I had {:foo "a" :bar "b}
03:28callenMisterSinister: bravo on coming up with something I haven't seen requested before
03:28MisterSinisterIt would expand into {:keys [foo bar]}
03:28callenseriously, bravo.
03:28MisterSinistercallen: Are you being sarcastic?
03:28callenMisterSinister: do you want this for fn arg destructuring?
03:28callenno, very sincere. initially.
03:28callenthe initial problem statement was unique
03:28callenthe final request sounds like it won't be
03:29MisterSinisterYeah, I did want it for function arg destructuring.
03:29MisterSinisterBut ordinary let destructuring would be nice also.
03:29callenMisterSinister: a few points of order: don't do that. Just pass a map around
03:29callenMisterSinister: you do *not* want implicit symbol injection like that. it makes it impossible to know where the fuck they came from.
03:29MisterSinisterI see.
03:29callenalso, the macro can't possibly know what keys are in the map
03:29callenthe map doesn't exist at compile-time, ya dig?
03:30MisterSinisterYeah, I dig.
03:30MisterSinisterOh well.
03:30calleninstead, I will (apply hash-map rest) where the fn restructuring is [arg1 arg2 & rest]
03:30callenand rest is something like [:a 1 :b 2]
03:31callenMisterSinister: avoid unnecessary/low-productivity sources of magic. Save the brainpower for solving your actual problem.
03:31MisterSinistercallen: Still something I'm learning about, admittedly.
03:31maxthoursieHi. The style guide says use (:kw object-like-map) for objects and (collection-like-map :kw) for collections. Whats the difference between objects and collections?
03:31ambrosebs[arg1 arg2 & {:as rest}] might be clearer.
03:32callenahhhh fuck.
03:32callenambrosebs: just outclassed me. Thanks.
03:32ambrosebssniped.
03:33ambrosebsxD
03:33callenis there any better drug than happy users?
03:33MisterSinisterNone whatsoever.
03:33MisterSinister:D
03:33callenI have like 3 users and making them happy is FUNNNNNN
03:33MisterSinisterPeople on here are so nice.
03:33callenMisterSinister: I'm not. the rest are. mostly.
03:33ambrosebshaha
03:33maxthoursie"The style guide" might be vauge, I was refering to http://dev.clojure.org/display/community/Library+Coding+Standards
03:34callenfor any who run into it, do not listen to batsov's style guide.
03:35maxthoursiecallen: that guide differ on that point
03:35maxthoursiebut since I don't understand the library coding stadards, it makes no differnce to me right now
03:35maxthoursie:)
03:35MisterSinistercallen: Actually, that was a very nice response.
03:35MisterSinisterI never expected that.
03:36maxthoursie(= nice (rest ppl))
03:36MisterSinisterSo that makes callen (first ppl).
03:37MisterSinisterAlso, maxthoursie, wouldn't it be (every? nice? (rest ppl))
03:37MisterSinister?
03:37maxthoursieMisterSinister: indeed, was just thinking about it
03:38Ember-I prefer (-> ppl (make-nice) (throw-a-party-with))
03:38callenEmber-: looks kinda side-effecty
03:38MisterSinisterThey make new people.
03:38callenEmber-: wouldn't the throw-a-party-with fn create a lot of garbage to collect?
03:38MisterSinisterIt's referentially transparent.
03:38maxthoursieno fun to party with only new ppl
03:38Ember-callen: sure it would. Good that we have an efficient gc
03:38Ember-I'd like one into my apartment too
03:39callenEmber-: and HotSpot (TM ORACLE TOUCH IT AND WE KILL YOU)
03:39Ember-my wife is doing a decent work but there's always room for improvement
03:39callenmy landlord actually pays for cleaners. I have no wife :(
03:39callenI started out that sentence bragging, then saw your comment about your wife :P
03:39Ember-I own the flat I live in and I have a wife
03:39Ember-I have no landlord
03:39MisterSinisterEmber-: Some of us are lucky like that.
03:40callenEmber-: I'm young and live in the bay area. I'm not sore about being a renter. Nobody expects me to own land.
03:40callenor a flat.
03:40Ember-hehe
03:40Ember-I live in Helsinki Finland
03:40maxthoursieI think I use a generational gc, I only clean up the young collection, I never get to cleaning it all
03:40MisterSinisterI think my brain needs better gc.
03:40Ember-and I'm youngish (31)
03:40callenmaxthoursie: I used to have that problem, but I started collecting more often and it fixed the problem.
03:41callenEmber-: I've been a working-coder for 7 years but I'm younger than you.
03:41maxthoursiecallen: That's probably exactly what I would need
03:42Ember-callen: I've founded a software company, ran it and sold it
03:42Ember-had 11 ppl working in it when we sold it
03:43Ember-bragging contest(tm)
03:43callenEmber-: I've worked for 3 startups, started one, and joined one as a CTO. No exits/surviving successes yet. Last one was a near miss though. :(
03:43MisterSinisterCTO?
03:43Ember-chief technology officer
03:43callenfor which the responsibilities vary *wildly* depending on how mature the company is.
03:44Ember-indeed
03:44MisterSinisterAh.
03:44MisterSinisterI'm just a grad student.
03:44Ember-in a bit larger company that feller would actually be responsible of technology choices being used in the company
03:44MisterSinisterI use Clojure for implementing algorithms I'm working on.
03:45Ember-in a small startup that is just a title
03:45callena CTO at a startup can be anything from a glorified code monkey, to a PM, to a strategist, to a futurist.
03:45Ember-that guy *will* do *anything*
03:45Ember-CTO in a startup will do sales too
03:45Ember-and maybe even marketing
03:45callenEmber-: I was half PM/cheerleader, half hacker. I implemented the 2nd version of the core algorithm our product was based around, a neuroscientist did the first version.
03:45MisterSinisterSo CTO = Chief Trouble-solving Officer?
03:46callenEmber-: I've done sales before, but not for that company, only for the company I founded.
03:46Ember-MisterSinister: ha :)
03:46callenMisterSinister: to be fair, the CEO does plenty of problem solving too, just of a different sort typically :)
03:46Ember-callen: oh, you're still continuing on the bragging contest? :)
03:46MisterSinisterOr possibly Chief Trick-turning Officer, by the sounds of it.
03:46callenEmber-: more just catharsis. Like I said, last one was a near-miss. Kinda need to talk about it.
03:46MisterSinisterAlso, holy shit, this code.
03:46Ember-I created a SPA framework back when SPA was pretty much unheard of which gave our product a competetive edge
03:46callenHaven't really had a chance to sit down and talk it out with anybody who would understand.
03:46MisterSinister(if ((comp contains?) (set (keys vertex-map)) u)
03:46MisterSinisteryeah....
03:47Ember-that product had a distributed versioning data model
03:47callenmost people who haven't done startups aren't sympathetic at all.
03:47Ember-but lol, this is so stupid
03:47Ember-I actually have some work to do :)
03:47MisterSinistercallen: Try me.
03:47callennah. I need sleep. meeting at 10 am.
03:48MisterSinisterThis is why I love being at GMT+12.
03:48MisterSinisterI exist in everyone else's bedtimes.
03:49seancofieldMisterSinister: bedtime is a movable concept :)
03:51MisterSinisterseancofield: Depends on your line of work.
03:51MisterSinisterWhat kind of music do you guys like to code to?
03:51MisterSinisterI need some.
03:51seancofieldI work from home full time and my team is spread across several timezones...
03:51MisterSinisterseancofield: So your concept of 'bedtime' is 'whenever i can find an hour'.
03:52seancofieldif i had my way, i'd sleep 'til noon and work 'til midnight :)
03:53MisterSinisterLikewise. Unfortunately, I have to teach classes, and they start rather too early for my liking.
03:53callenseancofield: I have psychotic coworkers who think meetings before lunch time is anything other than torture, so I can't do that :(
03:53callen(I exaggerate for dramatic effect, I love my coworkers. Srsly.)
03:53seancofieldI did some traning today... fortunately the client was in Australia so it was 8-10pm for me :)
03:54callenseancofield: I taught some Clojure today! also where's your r?
03:54callendid you change from corfield to a mathematical topology?
03:54MisterSinistercallen: Yay for you teaching Clojure! I wish I could.
03:54seancofieldlol... i clearly couldn't type when i signed in on my other machine!
03:55callenseancorfield`: you should just use a persistent IRC session.
03:56seancorfieldbetter? :)
03:56seancorfieldteaching clojure is good :)
03:56callenyes but you should eliminate the schelp altogether with a persistent IRC session.
03:56callenschlep*
03:56seancorfieldcallen: it's complicated :)
03:57callenpersistent IRC sessions aren't complicated :(
03:57callenyou use ZNC or GNU Screen.
04:04seancorfieldwindows...
04:04callenseancorfield: you can still do it.
04:05callenseancorfield: i will even halp :)
04:05seancorfieldi like the setup i have... i use erc in emacs for IRC
04:05ucbseancorfield: you could bounce via znc
04:06callenwhich is my point
04:06ucboh, it's been suggested already :)
04:06callenseancorfield: you can use any client you want :)
04:07callenucb: hi!
04:07ucbcallen: !
04:07ucbcallen: colloquy doesn't play nice with ZNC mind you
04:07ucbthere's a znc thing for ERC though
04:07ucbI used it for a while
04:10ucbcallen: how you?
04:11callenbeen absurdly ill and fighting to meet a deadline
04:12ucbnot a great combination
04:12callennever taken as good care of myself while sick as I have at this job while sick.
04:12ucbso that's a good thing then
04:12callenI have to basically defend the use of Clojure and Datomic for a project in front of most of the engineers at my company in two days and I can barely speak.
04:13ucbdo it mime style with plenty memes on every slide -_-
04:13callenI'm probably going to set some ground-rules before beginning the talk.
04:13callenucb: considering that option :P
04:13ucbheh
05:29glosolihmm how can one do OR in query using clojure.jdbc
05:29glosoli ?
05:29glosoliclojure.java.jdbc"
06:00TEttingercongrats Clojure! You're the #1 Lisp dialect since january 1st 2013 in terms of projects created on github. Unless you have an odd definition of what is lisp.
06:01TEttingerhttps://dl.dropboxusercontent.com/u/11914692/LanguageStats.txt got this off the Github API today
06:01TEttingerbehind prolog because github thinks PDF files are prolog source
06:04ambrosebskaw: did you figure out how to provide arguments to reduce with core.typed?
06:06kawambrosebs: No, I think I could still use some help with it.. but I looked at the example project and got a little further
06:07ambrosebskaw: FYI there's also #typed-clojure
06:07kawI can't look at it in detail now because I'm at work and it wasn't a work project, but is there a simple solution?
06:07kawAha, might look into that
06:08ambrosebskaw: what was the problem again?
06:08kawWell, when you pass a non-empty sequence to map you get a non-empty sequence back out
06:08ambrosebsand you're passing that to reduce?
06:08ambrosebsas the 3rd arg?
06:08kawYeah
06:09kawWhich I don't think should be a type error if I can guarantee that the original sequence isn't empty?
06:10ambrosebsYou should be hitting this funciton type of reduce: [[a c -> a] a (Option (Seqable c)) -> a]
06:10ambrosebsthat's the most general one.
06:10ambrosebsit doesn't expect a non-empty seqable.
06:11ambrosebsSo I suspect the error is somewhere else in the call to reduce.
06:11ambrosebsDid you get a big polymorphic error from reduce?
06:12kawHmm
06:12kawWell, can't remember the details now, but it was the two-argument reduce, not the three-argument one (was mistaken saying it was the third arg, sorry)
06:12ambrosebsah ok.
06:12kawNot sure if that would influence anything
06:13kawBut my core problem was that map didn't seem to preserve nonemptiness
06:13kawMy code would have broken if the sequence was empty, but I could guarantee that it wasn't empty
06:14ambrosebsa quick way to cast to nonempty is (let [s (map ...) _ (assert (seq s))] (reduce ... s))
06:14ambrosebsmap isn't accurate enough yet to figure that out.
06:15kawHm, okay
06:15kawI guess I'd like to keep the typed stuff at the top level as much as possible
06:16ambrosebskaw: as in, you don't mind the assertion?
06:16ambrosebsor you'll skip checking that function?
06:17kawWell, maybe I'll add it if it's the only way.. depends on how many such things I have to change all over my project
06:18kawMaybe skipping the tricky functions would be an option, I haven't really looked into skipping yet
06:18ambrosebskaw: map could be made more accurate. I'll have a look.
06:19kawBut I guess I can see that just preserving nonemptiness would be a bit hackish
06:19kawSince there's actually much more that it preserves
06:19ambrosebskaw: Maybe not, because a lot of functions have different behaviour based on emptiness.
06:20ambrosebsit may be worth adding.
06:20kawTrue
06:20kawBut I mean, I can see how it would be a challenging function to type
06:21ambrosebskaw: it would have to be hard-coded in general, but I think an arity [[a -> b] (NonEmptySeqable a) -> (NonEmptyLazySeq a)] would be useful.
06:21ambrosebsthat wouldn't need hard coding.
06:21ambrosebsperhaps even for variable arguments of non-empty seqables.
06:30ambrosebskaw: (cf (map inc [1 2 3])) => (NonEmptyLazySeq AnyInteger)
06:30ambrosebsworks well
06:31ambrosebsshall push a release for you to play with.
06:32kawWow, thanks, I'll look into it when I get home
06:33kawGood to have the project dev so easily accessible
06:38ambrosebskaw: Try 0.2.5-20130910.101144-9
06:38ambrosebsrepository info for snapshots is in README
06:59Fenderhi there, I have a question: I deploy my JAR (created with lein jar) manually to a server and I want to fetch all the dependencies over there, what is the program I need?
07:00FenderI suppose it is maven / leiningen, however, the question seems so basic that it's hard to find something about it
07:02Fenderof course I dont want to pull all my source on the cloud server and run "lein deps" over there
07:03hyPiRionFender: would it be viable to do `lein uberjar` instead, and deploy that jar?
07:03Fenderhmm, this is how I do it right now
07:04Fenderbut I hate to upload all the complete uberjar after just fixing a minor error in my source
07:05hyPiRionThen I'd just use git and push the source code up, and pull it from the server
07:05hyPiRion*on the server
07:05Fenderhmm, this is also not the "clean solution"
07:06FenderI thought the whole thing about maven is to just run one command and it automatically fetches all JAR dependencies
07:06hyPiRionyes?
07:07clojurebotyes isn't is
07:07FenderI mean if lein does such a great job why shouldnt there be something as simple as a jar dependency fetcher
07:08Fenderhowever, it is hard to find anything useful if you google for "maven jar fetch dependencies"
07:08Fenderand lein in the query doesnt really help either
07:08justin_smithmvn deps?
07:09Fenderhmm, let me check
07:11justin_smithwell there is no mvn deps command, I wonder what 'lein deps' runs
07:11Fenderhmm, didnt find anything either
07:11supersym:refer-clojure excludes from the core namespace, but how to exclude the other ns functions? :exclude on the required coords doesn't seem to work (anymore)?
07:12FenderI'd like "X deps myjar.jar" that downloads myjars deps, the question is "what is X?"
07:13Fenderwhy is project.clj and pom.xml in the jar if not for this very purpose?
07:13justin_smithmvn dependency:get
07:14justin_smithfigures the java version is more verbose
07:15supersymok nvm, this is definitly due to LT
07:17Fenderalternatively, a "lein deps" on a jar would be even nicer
07:17Fendersupersym, I dont understand what you mean with coords
07:18supersym(require '[some.lib :excludes [some-func])
07:18supersymI guess not coordinates,...those are the vectors in :dependencies
07:19justin_smithis it :exclude or :excludes?
07:19Fenderdo you need this when you require it? this IMO makes much more sense when you 'use the dependency
07:19Fenderok, afk
07:19supersymFender: yeah I've been hardly using 'use but for a few of those cases perhaps :)
07:19ambrosebs,refer
07:19clojurebot#<core$refer clojure.core$refer@1dfe879>
07:20ambrosebs,(doc refer)
07:20clojurebot"([ns-sym & filters]); refers to all public vars of ns, subject to filters. filters can include at most one each of: :exclude list-of-symbols :only list-of-symbols :rename map-of-fromsymbol-tosymbol For each public interned var in the namespace named by the symbol, adds a mapping from the name of the var to the var to the current namespace. Throws an exception if name is already mapped to somethin...
07:20clgvvision for JDK 10+: "No more primitives, make everything objects"
07:20ambrosebssupersym: (:refer some.lib :exclude [some-func]) I think
07:20supersymmy mistake, I had it correct here
07:21clgvinteresting statement. since I do not think they want to sacrifice performance for numerical computations, the goal is probably to have efficient numeric objects
07:21supersymambrosebs: right, thanks
07:22justin_smithclgv: maybe packed up numerics, all ready for simd
07:22justin_smithstandardized groups of 128 or whatever
07:23clgvwell wont happen before 2017 anyway and most likely later...
07:48Fenderif efficient "primitive objects" were possible, I think they would have gone in that direction a long time ago
08:19ivanJVMLS 2013 for your youtube-dl needs https://www.refheap.com/66950723e1aa930701728f696/raw
08:34clgvFender: well, but do you think they will sacrifice performance for numerical computation?
08:53Fenderclgv: No, that would be also "stupid" :) Then again, Oracle isnt exactly known for its wise decisions wrt Java in the last years
08:53Fenderfrankly, I have no clue why they'd do that
08:53Fenderafaik, the Java "deciders" are as efficient as a committee", i.e. not
09:57ljosAnyone know of any resources on using clojurescript in phantomjs?
10:03ljosI am especially wondering how to do the /require/ part as it seems like from the examples that phantomjs uses requirejs to do that that.
10:12jjttjj`Hmm not sure where I should even ask this, but how do I properly escape a string that contains quotes that's being sent within clojure code to nrepl in elisp
10:12jjttjj`https://www.refheap.com/18505
10:13jjttjj`Where the string being upper-cased has a quote in it
10:14jjttjj`(just using upper-case as an example fn here, that's not what i'm trying to accomplish)
10:15wakeuphi all
10:16jjttjj`hello wakeup
10:17wakeupAm I right to assume that [org.clojure/java.jdbc "0.3.0-alpha4"] is what is currently recommended to work with SQL databases?
10:17wakeupand further more what do I have to do to get the SQLite driver loaded?
10:17wakeupI get a SQLException No suitable driver found for jdbc:sqlite:...
10:18jjttjj`Have you seen the githup page? https://github.com/clojure/java.jdbc
10:18coventry`jjttjj: String manipulation is a pain in elisp. This may get you started. Not sure it's the best way, given that you'll be looking for multiple quotes, some of which may already be escaped. (let ((target "bar \"foo\"")) (string-match "\"" target) (replace-match "\\\\\"" nil nil target))
10:18ljoswakeup: I used https://github.com/korma/Korma the last time I was doing sqlite work in clojure.
10:18wakeupjjttjj`: thanks I should have scroleld down more
10:19wakeupljos: I will go with plain param. queries since my use case is very simple
10:20jjttjj`coventry`: cool thanks gonna stare at that until it makes sense :)
10:22coventry`C-h i d m elisp <RET> i string-match <RET>
10:24jjttjj`coventry`: cool
10:26wakeup"SQLException query does not return results" Why would it I do a CREATE?
10:28wakeupis there a version of jdbc/query that doesn't expect a result?
10:35jkkramerwakeup: clojure.java.jdbc/execute!
10:39wakeupjkkramer: using DB-DO-COMMANDS now, thank you anyways
10:49ambrosebs,(doc *file*)
10:49clojurebot"; The path of the file being evaluated, as a String. Evaluates to nil when there is no file, eg. in the REPL."
10:49ambrosebsis *file* usually relative or absolute?
10:50wakeupOh yes this is fun...
10:50pepijndevos,*file*
10:50clojurebot"NO_SOURCE_PATH"
10:51wakeupSIGSEGV (0xb) at pc=0xb6f0abed, pid=6859, tid=2675309376
10:51wakeupMy JRE segfaults when I do a jdbc/query
10:51wakeupwhile doing some kind of get unicode char thing
10:51ToxicFrogAwesome
10:54wakeup(jdbc/query spec "INSERT INTO store(key, value) VALUES(?, ?)" key value)
10:54squidzcemerick: I'm trying to use clojurescript.test, but I keep running into the following error: TypeError: Undefined is not an Object (evaluating 'Function.prototype.bind.apply')
10:54wakeupany ideas what I am doing wrong? (key and value are strings)
10:55squidzhas anybody come across this before? here is my project.clj, plus the full error --> https://www.refheap.com/18507
10:56Bronsaambrosebs: *file* should be absolute
10:56ambrosebsBronsa: thanks.
10:56cemericksquidz: no idea what that is. Looks more like an app- or library-level problem?
10:57cemerickor maybe you're trying to use some JS API that phantom doesn't support?
10:57jkkramerwakeup: what db? are you using the latest driver? are you sure the JRE and db are set up for utf-8 correctly?
10:57squidzcemerick: yeah, I get the same problem with specljs, and when I was playing around with that, starting a new project seemed work fine. Just when I'm trying to use phantomjs with my already existing code seems to freak it out
10:58cemericksquidz: have you gone and looked to see what's going on at the specified line number in the generated js?
10:59justin_smithwakeup: what db? a coworker discoverd utf8 table name bugs in postgres that are still outstanding
10:59wakeupjkkramer: sqlite, org.xerial/sqlite-jdbc "3.7.2", how do I check?
10:59squidzcemerick: yeah this is being called: (js/Function.prototype.bind.apply orig-fn nargs)
11:00ciphergothis this the right place to talk about ring? I have an idea on how ring could be extended to make my life better :)
11:00wei_how do you test compojure routes with sessions? specifically with sandbar stateful sessions, if anyone's using that
11:01ciphergothI'm looking at the method "set-body" in ring-servlet. It tests if :body is a string, a seq, an InputStream or a File, and writes the body to the servlet output stream in each case
11:01wakeupjkkramer: could you try to reproduce if I gave you a minimal gist?
11:01jkkramerwakeup: does (System/getProperty "file.encoding") say utf8?
11:02ciphergothhttps://github.com/ring-clojure/ring/blob/master/ring-servlet/src/ring/util/servlet.clj#L81
11:02jkkramerwakeup: not at the moment, have to get back to work. guessing it's a problem with sqlite driver or something. google shows some results for "java sqlite segfault"
11:02ciphergothit would be neat if it had a clause that read (fn? body) (body (.getOutputStream response))
11:02wakeupjkkramer: yes it does
11:02squidzcemerick: I tried setting it up on windows and linux and I get the same error. Phantomjs may be to blame
11:03cemericksquidz: do the tests in question work under e.g. chrome or firefox?
11:05gfredericksI think I am opposed to macros that just wrap things in (var)
11:05squidzcemerick: I haven't tried. Can I call one of clojurescript.tests run functions from the console? if so which one?
11:07cemericksquidz: all of the test-* fns work under any suitable cljs REPL
11:10squidzcemerick: it seems to work. It returns cljs.core.PersistentArrayMap {} after running run-all-tests in the console. I think it may be related to this: https://github.com/ariya/phantomjs/issues/10522
11:10sm0keHello why is this giving stream closed error? (with-open [rdr (reader "src/examples/utils.clj")] (take 2 (line-seq rdr)))
11:11llasramsm0ke: Lazy evaluation
11:11llasramsm0ke: Well, lazy sequences
11:11sm0keaha
11:11cemericksquidz: heh, yeah, that'll do it
11:11sm0kedoall?
11:12llasramsm0ke: That's what it's there for :-)
11:13cemericksquidz: you could try getting slimerjs to work with clojurescript.test? Looks like it's easy to do, and might give you relief from the phantom issue? https://github.com/cemerick/clojurescript.test/issues/10
11:13cemerick'course, slimerjs might have the same problem (or a whole different set of them)
11:13sm0kehmm ... hey are you the one with abracad repo?
11:13sm0kei am using it..thanks for open sourcing
11:13llasramsm0ke: Oh, yep. That's me.
11:13llasramsm0ke: Oh! Awesome
11:14squidzhm yeah it may. I read that adding this function seems to do the job, but i'm not sure where would be a good place to put it https://github.com/c9/smith/blob/master/tests/public/test.js#L2-L7
11:15squidzmaybe in my runner.js
11:16squidzadding it seemed to change nothing :/ maybe I just have to give slimerjs another shot, but IIRC it didn't work/had the same problem when I tried last time
11:18cemericksquidz: that code would need to be added to your generated test js, not in the runner. You can just transliterate it to ClojureScript if you want, and include it in your codebase (with suitable guards to not overwrite an existing bind impl.)
11:18sm0kehello i am new to clojure , is actor based concurrency encouraged in clojure? If yes what libraries are most common ?
11:19dnolensm0ke: not encouraged, though I'm sure there are proponents, also there's core.async which gives you CSP.
11:20squidzcemerick: is there an easy way of adding it to my compiled js without translating it to clojurescript to compile it?
11:20cemericksquidz: :libs or :foreign-libs...but, it's only 5 lines...
11:20sm0kethanks
11:21squidzcemerick: after pasting it into the head of my compiled js it seems to be working now. Thanks
11:22tbaldridgesm0ke: actors couple concurrency, state management, and processes all together in a single "thing" that can't be decoupled. In core.async, we have queues for concurrency, go blocks for processes, and atoms/refs for state management.
11:22tbaldridgesm0ke: this allows you to create stateless queue processors, or processes that share a single mutable state for instance
11:23sm0ketbaldridge: isnt single mutable instance bad?
11:23sm0kestate*
11:23tbaldridgesm0ke: "power through pulling things apart" is probably a motto of the Clojure community.
11:24tbaldridgesm0ke: Clojure provides primitives for allowing safe mutating of shared references, but yes, in general we should avoid state, but no matter what you do, you'll always have "mutable state".
11:24tbaldridgesm0ke: notice how Erlang users like to say "no mutable state". They still have it, it's just hidden as the arguments to the function that processes the next message.
11:24mdrogalisI'd get a kick if you guys renamed core.async to "actresses".
11:25sm0keok one more thing? actors libraries if propery designed run several thousand actors on a sigle thread? how is this in clojure core.async?
11:25mdrogalissm0ke: go blocks are extremely light weight.
11:26sm0keis go blocks something similar to golang channels? sorry i am very new to the scene!
11:26tbaldridgesm0ke: we can do that as well, go processes can be as light as a few hundred bytes (or less). And they do not map 1:1 to threads.
11:27tbaldridgesm0ke: yes, core.async is basically a implementation of many of Go's channel features on Clojure (and the JVM).
11:27tbaldridgesm0ke: good way to get started, https://github.com/clojure/core.async/blob/master/examples/walkthrough.clj
11:28sm0kethanks guys! i am enjoying learning clojure!
11:28tbaldridgesm0ke: awesome!
11:28mdrogalis:)
11:29sm0kealso since we are at it? do we have a high performance rest server already written?
11:29fredyrgo blocks are similar to goroutines, isn't it?
11:29sm0ke:)
11:30tbaldridgefredyr: close, I'm not exactly sure how Go's goroutines are implemented, but they should be similar
11:30fredyrright
11:30mdrogalistbaldridge: You recall the code review I sent you about buffered, spatial aware queues?
11:31tbaldridgemdrogalis: yes
11:31mdrogalistbaldridge: I took your approach through the entire simulation. It's getting close to finished. That bit of code is 1/4 it's original size, 1x times faster, and testable.
11:32mdrogalis1 thousand x faster* ^
11:32tbaldridgemdrogalis: nice!
11:32mdrogalisBlew my mind man.
11:33sm0kehmm http-kit and compjure seemsto be doing pretty well http://www.techempower.com/benchmarks/#section=data-r6&amp;hw=i7&amp;test=json
11:34mdrogalisIs there any reason to use reducers over pmap when the latter works okay?
11:34tbaldridgesm0ke: yes, look into compojure and ring, and then those two run on a bunch of JVM servers.
11:35tbaldridgemdrogalis: it really depends on the task, pmap will convert a vector to a seq. Reducers will keep it as a vector, and since the structure of vectors is basically a tree, reducers will allocate a thread to each branch.
11:36tbaldridgemdrogalis: so pmap will try to allocate a thread to each item (up to a max number of threads). reducers will allocate a thread to each branch (up to a max). pmap processes in order, reducers will process in whatever order offers the best performance.
11:36tbaldridgemdrogalis: so reducers can be faster when you don't have side effects in the code.
11:39rkneufeldmdrogalis: reducers do also let you compose transformations in a pretty nifty way (completely separate from how it is executed)
11:40mdrogalistbaldridge: Ahh, thanks. That's a useful bit of knowledge. :)
11:40mdrogalisrkneufeld: Yeah, you know I've been using reducers since it came out and I still don't *really* understand how it does that.
11:44tbaldridgemdrogalis: so there are two aspects of this. What rkneufeld mentioned is that you can chain a bunch of functions together that won't end up creating tons of LazySeq allocations that are simply thrown away.
11:45tbaldridgemdrogalis: consider this (-> (range 1000) (map inc) (map dec)), here we have to create cons cells in between each map. With reducers these allocations don't happen. Read Rich's reducers blogs for more info there.
11:45tbaldridgemdrogalis: the other side is the fork/join stuff I was talking about. This talk goes into details on that: http://www.youtube.com/watch?v=ZampUP6PdQA
11:46wakeupCan someone try to run (segv) from this paste http://paste.lisp.org/display/138889 ? On my machine it segfaults the jre!
11:46tbaldridgeNot about reducers, but these ideas are the same ones that reducers use
11:46wakeupI want to know if others can reproduce this?
11:46wakeupYou need clojure.java.jdbc and an jdbc sqlite backend
11:47wakeupOh and this will touch /tmp/sqlite-seegv !
11:48wakeupAll help would be much appreciated!
11:48nDuffwakeup: Including a project.clj for the dependencies you used wouldn't hurt.
11:49tbaldridgewakeup: looking at the clojure jdbc docs I'm not sure that your query syntax is right: "Given a database connection and a vector containing SQL and optional parameters,"
11:49tbaldridgeYour query and params are not in a vector
11:50wakeuphmm
11:50wakeupyou're right
11:50wakeupstill shouldn't segfault but I'll try
11:52mdrogalistbaldridge: I've read the reducers post a bunch of times. It's still hard for me to understand.
11:53mdrogalisFortunately, I guess I dont have to in this case. Using it is very easy
11:58tbaldridgewakeup: agreed, but I don't think that input is being validated, so it's probably crashing something deep down in the jdbc drivers
12:22sdegutisPhew.
12:29sdegutisHey guys wanna see my new Clojure website?
12:29sdegutisJust deployed.
12:30ambrosebssdegutis: sure!
12:36gfredericks(defmacro as->>> [args] `(as->> ~(last args) ~@(butlast args)))
12:46sdegutisgfredericks: Do you mean as->>> in the definition?
12:56gfrederickssdegutis: no
12:58sdegutisgfredericks: Oh you must be using C 1.6
12:58sdegutisClojure 1.6
12:59TimMcsdegutis: Such a tease.
13:00lgs32ais anybody here going to hack through the clojure cup?
13:00sdegutislgs32a: I'm terrible at those.
13:01jjttjj` I'm gonna try it, I'm also probably going to do terrible and never submit anything though
13:01sdegutisAlso some Rubyists are on the judge panel and I'm not super comfortable with them judging my Clojure code.
13:02lgs32aI consider doing a chess-web-app
13:02lgs32abut i think it would be nice to work on it as two people
13:03lgs32aclient-side could be done using something like raphel on js and pedestal
13:03lgs32aserver side clojure
13:04lgs32aalso pedestal service
13:07sdegutisI'm not sure I understand what Pedestal offers.
13:08lgs32aits basically a bunch of libraries like domina, enlive packed together
13:08lgs32apartly offering wrappers, mainly to enhance functionality
13:08lgs32athen it gives you this "development server"
13:08nDuff...well, the dataflow model is the big thing.
13:08tbaldridgesdegutis: and a very opinionated view of how state should be handled when it comes to a UI
13:08sdegutisnDuff: Oh?
13:08lgs32ayes the dataflow model
13:09sdegutistbaldridge: Yeah the one thing that stuck out to me was it constantly swapped a giant ref at each event received.
13:09lgs32awhats wrong with that?
13:09tbaldridgesdegutis: the gist is this, implement your app state as a database, then run a dataflow over that to generate a list of changes to the ui.
13:09tbaldridgesdegutis: yep, transactional UIs
13:09sdegutistbaldridge: Hmm.
13:14lgs32abut its not just the ui
13:14lgs32aalso the complete state of the client is in that dataflow model
13:15lgs32ai recently wrote a small chat-app with that and i must say that it ends up in very little code at all
13:15tbaldridgelgs32a: well yes, client side apps are mostly UI, but I get your point.
13:15sdegutisSounds like Rails.
13:15lgs32athe events can be recorded and replayed
13:15tbaldridgesdegutis: how on earth is that?
13:15sdegutistbaldridge: in that I don't fully understand it :)
13:16sdegutisAnd that it sounds very scary.
13:18xeqitbaldridge: can you reprogram the dataflow in the repl?
13:18tbaldridgexeqi: that I'm not sure, I do know that it's data-driven, so maybe?
13:19xeqiheh, gotta find the hooks into the system implementing the dataflow
13:21loliveirahi folks! can somebody please tell me why I can't get the whole body's text? If I change from [:body] to [:p] works, but I can't do that. https://www.refheap.com/18508 I'm using enlive and clj-http.
13:21llambdawith clojure.test, what's the best way to test if a certain input causes an expected assertion error?
13:22dakroneloliveira: do you perhaps need to use `:body` to pull the body out after the http/get?
13:22xeqillambda: (is (thrown? ErrorType ...))
13:22llambdathank you :)
13:23xeqillambda: or (is (thrown-with-msg? Type regex ...)) if you want to get more specific
13:25loliveiradakrone: You nailed it. thank you! =)
13:26dakroneloliveira: :)
13:28tbaldridgebbloom: more bedside reading: http://www.cs.indiana.edu/~sabry/papers/exteff.pdf
13:29bbloomtbaldridge: yeah, read that one too. I was greatly amused by the use of Typable
13:29bbloomTypeable*
13:33mdrogalisbbloom & tbaldridge: Looks dense
13:34mdrogalis(to me)
13:35bbloommdrogalis: it is.
13:35bbloommdrogalis: http://math.andrej.com/wp-content/uploads/2012/03/eff.pdf is much more approachable
13:35tbaldridgemdrogalis: but it's on my favorite subject, killing monads >:-)
13:36mdrogalistbaldridge: Can you sum up your objection in 1-2 sentences?
13:36mdrogalisThanks bbloom :)
13:36bbloommdrogalis: they don't compose.
13:36mdrogalisHeh, palatable statement. Got'cha.
13:36xeqibut, but, monad tranformers :p
13:37bbloomxeqi: ok, they compose poorly
13:37tbaldridgemdrogalis: memory allocation, poor composition
13:37xeqioh, oh, how bout those error messages
13:39bbloomtbaldridge: so about types & optimizing effects....
13:39bbloomtbaldridge: my understanding is that you basically have to do abstract interpretation instead of traditional type checking (ie logic solving)
13:40boblarrickI'm working on adding type hints to my program and wondering how to fix something like "Reflection warning, syncro/core.clj:77:16 - call to com.aerospike.client.Bin ctor can't be resolved." ?
13:40bbloomtbaldridge: what you do is you sub out top-level resources w/ non-resourceful handlers & then record all effect operations
13:40bbloomtbaldridge: you can then basically do algebra on that log
13:40mdrogalisboblarrick: http://clojuredocs.org/clojure_core/clojure.core/*warn-on-reflection*
13:41pierre1oreos
13:42bbloomtbaldridge: so for example if you have a mutable cell and you see 3 sets in a row, you can throw out 2 :-)
13:43tbaldridgebbloom: as long as the mutable cell isn't being read by another thread :-)
13:45bbloomtbaldridge: but you can prove it isn't if it's bound by a handler in the dynamic extent
13:48mdrogalisI know ZooKeeper versions data on the znodes.. Does anyone know how to actually see the data changes across versions of a znode? Can't find it in the docs anywhere.
13:49mdrogalisOh, lovely. They have a channel.
13:53boblarrickmdrogalis: Yeah I have warn-on-reflection on, but I don't know what kind of type hint to add to my program to resolve the warning pasted above. How to add a type hint to a call to a java interop constructor?
13:54coventry`What should I do to make clojure a lein project so that I can put it under another directory's checkouts/ dir? I want to access clojure's unit tests in clojure-test, and make sure that I am using the same version of clojure that the tests are coming from.
13:55mdrogalisboblarrick: Ah, I understand. Sorry, I'm not sure how to help. :/
13:59sdegutisFor my next magic trick, I'll be making this website way faster by replacing MongoDB with Datomic.
14:00xeqisdegutis: can you make if faster by making it static?
14:00sdegutisxeqi: Nope.
14:01sdegutisxeqi: I already used up that trick on the github-wiki version of clojuredocs.org
14:01sdegutisre https://github.com/sdegutis/clojuredocs/wiki
14:05scriptorquick and dumb question, but it's not possible to modify existing protocols by adding new functions, right?
14:06SegFaultAXsdegutis: The source for your clojuredocs thing is insane.
14:06sdegutisSegFaultAX: sorry :(
14:07sdegutisSegFaultAX: Wait, what do you mean by insane?
14:07SegFaultAXsdegutis: A nightmare.
14:07sdegutisSegFaultAX: ok yeah, sorry :(
14:07SegFaultAXsdegutis: I think it's a neat project, but you should definitely clean it up.
14:07llasram~gentleman
14:07sdegutisSegFaultAX: I hacked it up as a proof-of-concept the other night.
14:07clojurebotHuh?
14:08llasramAhh
14:08llasram~gentlemen
14:08clojurebotYou can't fight in here. This is the war room.
14:08llasramThere we go
14:08SegFaultAXHeh
14:08SegFaultAXsdegutis: You can easily improve it.
14:08sdegutisSegFaultAX: It doesn't make sense to clean it up until the community generally agrees that it's a good direction to move in.
14:08SegFaultAXsdegutis: That's not really how it works.
14:09llasramscriptor: No, but you don't need to, and probably wouldn't be that helpful if you could. You can always just provide a new parallel protocol. Which as a side-benefit you can actually implement separately
14:09sdegutisSegFaultAX: It's kind of dumb to have 2 versions of clojuredocs running about, because the examples will be spread between two places. So if the community prefers the original, then this one should die.
14:09scriptoryeah, that's what I assumed
14:09SegFaultAXsdegutis: You need to put some effort behind it to show that your thing is actually viable before people will even consider adopting it.
14:09scriptorit'd probably be a nightmare to retroactively add the implementation for all types and records that support the protocol
14:09SegFaultAXsdegutis: Naw, I think the root idea is pretty cool.
14:09sdegutisSegFaultAX: Oh I think I see the confusion. That source file is only the initial seeder, and it isn't necessary anymore since it was used.
14:10coventry`SegFaultAX, sdegutis: Are you talking about main.clj? It's a one-off script for pulling in the data from the old website, isn't it? So how much benefit would there be to cleaning it up?
14:10sdegutiscoventry`: Right, that's what I'm saying.
14:11sdegutisSegFaultAX: The real meat is in the actual wiki files, and that part's already done. So I could just as easily delete main.clj and the githib wiki would still be a valid proposal to the community.
14:11SegFaultAXcoventry`: A lot, I think. It would be better if it emitted data and also had a formatter that could create the wiki or whatever.
14:12sdegutisSegFaultAX: But that's just a variation of YAGNI.
14:12SegFaultAXsdegutis: If you don't care about making it useful, maybe.
14:12sdegutisSegFaultAX: It already *was* useful. It's no longer needed.
14:12sdegutisSegFaultAX: What else does it need to be used for?
14:12SegFaultAXUnless you need to entirely reformat it.
14:12SegFaultAXIn which case you have to re-write it, because you don't have the /data/ anymore.
14:13sdegutisSegFaultAX: Reformatting the existing wiki requires an entirely different script that would do HTML scraping on the existing wiki files.
14:13SegFaultAXsdegutis: Okay.
14:13sdegutisSegFaultAX: (Well actually just Markdown scraping)
14:13SegFaultAXNevermind.
14:14sdegutisSegFaultAX: I'm just confused about your rationale. It seems like you're suggesting it be cleaned up in preparation for some abstract vague future feature.
14:15SegFaultAXsdegutis: Okay.
14:16sdegutisSegFaultAX: But you're right, if someone says "hey can you generate wikidocs for clojure-ring using this thing?" then I'll certainly clean it up in preparation for that.
14:17SegFaultAXI thought you were trying to create a migration path away from the utterly outdated clojuredocs site. That's clearly not the plan, you just wanted to reformat their data.
14:17coventry`What's an example of a lein project with .java files?
14:17sdegutisSegFaultAX: Oh, I see the misunderstanding.
14:17technomancycoventry`: reply, I guess?
14:17sdegutisSegFaultAX: No, this wasn't to create a migration path away from it. It was to write an experimental static wiki-based replacement for it. And that's already done.
14:18coventry`technomancy: thanks.
14:18SegFaultAXsdegutis: Thanks for the clarification.
14:18sdegutisSegFaultAX: I'm glad that's cleared up :)
14:20sdegutisIt's hard being so confused so often.
14:20sdegutisSo, I had this really weird idea that's kind of related to Clojure...
14:22sdegutisI want to write a simple Lisp interpreter in ObjC, where symbols starting with a period turn into a function that calls the given method on the receiver with args. So you could do (.length my-str) and it calls [my-str length]. But you could also do (map .length my-strs) because .length is just a function.
14:22sdegutisBut every time I write a Lisp interpreter, I get really confused as to how '() and (rest ()) should work, and how they're related to nil.
14:23sdegutisSo I basically want to copy Clojure in this regard.
14:23sdegutis,(rest ())
14:23clojurebot()
14:23sdegutisWeird.
14:23SegFaultAXThat's why we have next
14:23SegFaultAX,(next ())
14:23clojurebotnil
14:24SegFaultAXBut in most lisps, () is just another name for nil.
14:24sdegutisRight, because they focus on list-based recursion which favors that relationship.
14:24scriptor,((just [first rest next]) '())
14:24clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: just in this context, compiling:(NO_SOURCE_PATH:0:0)>
14:24scriptor,((juxt [first rest next]) '())
14:24clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Key must be integer>
14:24scriptorfuck it
14:24sdegutisLOL
14:24sdegutis:)
14:25TimMcscriptor: Drop those brackets.
14:25SegFaultAXIt doesn't really have anything to do with list-based recursion.
14:25sdegutis,((juxt first rest next) '())
14:25clojurebot[nil () nil]
14:25scriptorah
14:25SegFaultAXIt's more to do with how cons are structured.
14:25technomancyfirst vs next is a laziness distinction
14:25sdegutisSegFaultAX: Really? I thought the purpose was to make truthy comparisons see () as false so they know when to branch out in recursive functions.
14:25technomancyrest vs next rather
14:26SegFaultAXsdegutis: Again, () is just an alias for nil traditionally.
14:26SegFaultAXAnd it has to do with cons cells, not list recursion.
14:26sdegutisOkay.
14:27technomancythe reason rest returns a seq is that it avoids forcing anything
14:27coventry`If I want to make a project file for clojure, should test/java go in both :java-source-paths and :test-paths?
14:27technomancycoventry`: lein doesn't support tests written in java
14:27SegFaultAXsdegutis: It happens that it's convenient to stop recursion when the cdr is nil.
14:28sdegutisI see.
14:28coventry`Thanks, technomancy.
14:28sdegutis,((juxt first rest next) ())
14:28clojurebot[nil () nil]
14:29sdegutisI think I'll have to skip the whole lazy sequences thing in my interpreter. It's really confusing to me from an implementation stand-point.
14:29scriptorsdegutis: check out http://clojure.org/sequences
14:29sdegutisThanks.
14:29SegFaultAX,(cons 1 ())
14:29clojurebot(1)
14:29SegFaultAX,(cons 1 nil)
14:29clojurebot(1)
14:29scriptorit's actually not too bad once you get your head around it
14:30sdegutisI get lazy sequences when actually using Clojure, like I understand that (map prn [1 2 3]) won't print them until it's asked for that number of elements, and that it caches whatever elements have been consumed so far (so it won't repeat side-effects).
14:31coventry`sdegutis: Why not write an Objective-C backend to clojurescript's compiler? Could be huge.
14:31SegFaultAXClojure hides these details from us with higher level abstractions (or just differently named functions). We very often don't think about cars and cdrs like you might in traditional lisps.
14:31sdegutiscoventry`: (1) There's already one in Chicken Scheme that probably works with ObjC, (2) I'm not smart enough nor do I have enough time to become smart enough, (3) I don't see the practical application of that
14:32sdegutiscoventry`: Rather I just want this so I can script my window manager from in-process without having to resort to heavy-hitters like MacRuby/RubyCocoa/PyObjC or lame languages like F-Script or Lua.
14:32scriptorsdegutis: skim the java sources for lazy-seq some day, it's actually fairly straightforward
14:32dnolencoventry`: clojurec already supporting ObjC
14:32scriptorhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LazySeq.java
14:33sdegutisscriptor: cool, thanks :)
14:33coventry`dnolen: Thanks.
14:33scriptorthe hardest part is the naming (sv, s, etc.)
14:33dnolencoventry`: personally I think it makes more sense to just script your ObjC applications with ClojureScript directly given JavaScriptCore.framework support around the corner
14:36coventry`dnolen: interesting.
14:44sdegutisdnolen: That was actually the plan with the first Zephyros release, which was scripted using embedded JS via JSCocoa (basically the same as JavaScriptCore.framework, just not made by Apple).
14:45sdegutisdnolen: But embedding JS into ObjC and trying to interface with *all* of C and ObjC turns out to be actually really ugly and have some insidious caveats, especially around struct params/returns and out-params.
14:46SegFaultAXFortunately you probably don't need *all* of ObjC.
14:46sdegutisdnolen: That's why I moved it to a unix-socket-based protocol that communicates via a simple JSON-based Ruby-like message-passing protocol. Sure, it's not as easy, but it's cleaner.
14:47sdegutisSegFaultAX: Right, that's why I'm going to write my own lisp interpreter in it. The intentional limitation of it will be that it can *only* handle ObjC types for params/returns. That simplifies it a *ton*. And it means I also don't need to pull in libffi either.
14:48sdegutisI think it'll be straight-forward to mimic a minimalist vision of Clojure in it. It won't have everything, but that's okay too, since it's just for in-process scripting.
14:50dnolensdegutis: I don't know too much about JSCocoa, but its looks appears permeated with scope creep. From my basic poking around at what's coming down the pipe with JSC.framework looks simpler/nicer.
14:51sdegutisdnolen: yeah, I had to turn off a lot of features of JSCocoa to get it working like JSC. Although right before I abandoned the embedding-scripting idea, I was about to take on writing a JSC-like framework that would be simpler than JSCocoa and do a lot less (and be a little less buggy as a side-effect).
14:52sdegutisdnolen: good thing I didn't, since Apple's doing it themselves :)
14:52sdegutisdnolen: Also have you been looking into integrating CljS with JSC.f?
14:53sdegutisIf done right, it could be really neat, although I'm not sure what for yet.
14:53dnolensdegutis: I don't know what there really is to "integrate". It works. Ejecta is a good model and the next JSC.f enables that style of integration.
14:54dnolensdegutis: i.e. not trying to transparently bridge - just protocols that enable communication between the parts - and you provide them.
14:54dnolen"not trying to transparently bridge everthing" is what I mean.
14:57sdegutisAh.
14:59sdegutisShameless plug: I just deployed a new version of www.cleancoders.com, go buy stuff from it :)
14:59sdegutisIt's a Clojure web app so it's kind of on-topic ;)
15:04coventry`What's the "right" way to grovel pom.xml to get the version of the main application out? The following gives me the answer at the head of the returned list, but it would be nice to know make sure I'm getting it from the right place in the tree. (->> "/home/coventry/clojure/alien/clojure/pom.xml" java.io.File. parse xml-seq (filter #(= (:tag %) :version)))
15:05coventry`(That's after (use 'clojure.xml)).
15:07coventry`Oh, maybe I want to use clojure.data.zip.xml instead.
15:13muhoofor serializing access to an i/o resource... agents?
15:14muhooi was using a homemade work queue, but now i think that was overkill.
15:14gfredericksI've used agents for serialization before
15:14gfredericksthe locking macro looks straightforward, I'm not sure why nobody seems to use it
15:15TimMcgfredericks: A coworker is using it in some current work.
15:15bbloomgfredericks: b/c locks don't compose? :-)
15:17TimMcSpecifically, there are two loops that both wake up and run the same action under different conditions, but they shouldn't run at the same time.
15:18gfredericksbbloom: that's prollably it
15:23astevehow do I call function "run-local" inside of core.clj under the namespace name.space?
15:23astevename.space.core.run-local?
15:23gfredericksso you're intentionally not associating files with namespaces?
15:24asteveno
15:24callenmuhoo: could use core.async too.
15:24asteveat the top of core.clj is (ns name.space.core
15:25gfredericksasteve: okay so the namespace is called name.space.core then, not name.space
15:25gfredericksasteve: and the function could be called from clojure code by (name.space.core/run-local)
15:25astevegfredericks: I see that now, thank you for the clarification
15:25tbaldridgemuhoo: yeah, that's like 10 lines of core.async code
15:25callentbaldridge: if that.
15:26callentbaldridge: I like how learning to use core.async feels like I've acquired super powers.
15:26callen"I can do this! I know core.async!"
15:26callen"PICK MEEE PICK MEEE, I KNOW THE ANSWERRRRRR" *waves hand frantically in the air*
15:28fredyrtrying to understand the state machine stuff feels far from super powers tho
15:29fredyrprolly me being thick
15:29gfrederickscallen: xkcd/208?
15:30fredyrhah
15:31sdegutisHa.
15:31sdegutisOh man I thought today's xkcd was gonna be about Lisp.
15:31tbaldridgefredyr: no, it can be hard to understand if you don't have someone explaining it to you. I hope to go over some of that stuff at the Conj
15:32sdegutistbaldridge: Do those get recorded and put online?
15:32callengfredericks: actually, I'm far more powerful than that, I have Instaparse.
15:32sdegutistbaldridge: I'd love to see your talk eventually but I can't go this year.
15:32callengfredericks: GLL based parser combinators for CFG and context sensitive parsing FTWWWWWWWWW
15:32tbaldridgesdegutis: yeah, they end up on youtube after a few weeks. Or they did last year
15:32sdegutisCool.
15:33fredyrtbaldridge: oh, looking forward to that then
15:44danielszmulewiczGood people, what's your preferred way to host private libraries? I did `lein install`on some project that is not on clojars or maven, but I have yet to organize a private repo. What's your recommendations?
15:44mdrogalisdanielszmulewicz: Archiva is working out alright for my place.
15:45danielszmulewiczmdrogalis: is it lightweight?
15:45callenit's an apache project.
15:45mdrogalisdanielszmulewicz: What do you mean?
15:45technomancydanielszmulewicz: a private repo can just be a directory you rsync to an nginx server
15:46danielszmulewicztechnomancy: that's what I mean by lightweight. Cool solution. That's my style.
15:46callenI'm a fan of using things like Unison and a private server for this.
15:46callentechnomancy: which is written in OCaml, by the by.
15:46danielszmulewiczThanks.
15:46technomancycallen: sweet. what's the advantage over rsync?
15:47technomancyI thought it was mostly about being 2-way, which isn't as relevant here
15:47callentechnomancy: 2 way, not requiring any real active thought.
15:48callenit just "goes"
15:48callenI recommend it when people ask me how to migrate away from Dropbox/GDrive.
15:48callenI used to use Unison years and years ago. It's gotten better since too.
15:48technomancyheh; I just use rsync for that =)
15:48callennot every likes draining volition to transport state.
15:48calleneveryone*
15:48callenbut I get your meaning.
15:49technomancyoh, so unison is a daemon?
15:49sdegutisWhy do people migrate away from Dropbox?
15:49sdegutisI just got Dropbox and am super happy with it.
15:49technomancyproprietary gunk
15:49nDuff...why would anyone trust Dropbox in the first place?
15:49mtpbecause you don't control the dropbox infra
15:49mtpand they don't care about your data
15:49sdegutisnDuff: what's not to trust?
15:50mtpwhat IS there to trust
15:50mtpif they take a shredder to your data, their responsibility ends with "SORRY"
15:50rlbtechnomancy: unison just a bidirectional sync program -- haven't messed with it in a while, but wasn't using a daemon back when I was.
15:50rlb"unision's just"
15:50rlbtechnomancy: it tries to keep track of state, etc.
15:50sdegutismtp: I'm as likely to lose my data with them as I am by hosting it on my own personal backup hard drives.
15:50rlb(to handle conflicts, etc.)
15:50rlbiirc
15:51nDuffsdegutis: ...well, for an example...there was a bug mid-2011 when they disabled password authentication by mistake for a 4-hour period
15:51nDuffsdegutis: ...so anyone could impact the target users' files without their credentials.
15:51nDuffs/impact/interact with/
15:51sdegutisnDuff: Sounds like they won't be making that mistake again any time soon (nor have they apparently).
15:51mtpsdegutis: why yes, you are, but then it's at least YOUR FAULT
15:52nDuffsdegutis: sure, but it answers the question re: trust.
15:52mtpthat is not a selling point to dropbox
15:52mtpit's more of a warning to take salient backups
15:52sdegutisnDuff: They've earned my trust so far by doing one job and doing it well for as long as I've had an account with them.
15:52_________can anyone give me an example where one would actually use a set of vectors and a vector of sets?
15:52nDuffsdegutis: I'm not telling you not to trust them. I'm only saying that I don't.
15:52mtpyes, but it'd be contrived
15:52technomancymy main gripe with dropbox is how they encourage their users to spam their friends in order to get higher quotas
15:53technomancyso. annoying.
15:53sdegutistechnomancy: Hey btw...
15:53mtp_________: a more helpful question would be for me to ask "what do you represent using vectors" and (separately) what do you represent using sets
15:53sdegutisOh never mind, you'll probably say no.
15:53mtpand once we've agreed on an understanding, going from there
15:54sdegutismtp: what? make sentient backups?
15:54mtpsalient
15:54mtp"backups that not only back up, but that you can restore from"
15:54sdegutisoh man, my imagination just went crazy for a second
15:55mtpgood. stay with that. :)
15:55callensentient people know what sentient means.
15:55_________mtp i was looking for where a combination of them could be used but me being a clojure rookie i think i put the question wrong. like you said, what can vectors be used to represent and what can sets be used to represent?
15:55callen_________: what's with the nick :|
15:55mtpwell, you were the one who wanted an example
15:55mtpalso, this has nothing to do with clojure specifically
15:56sdegutisI usually use vectors to represent param lists.
15:56mtp_________: the only examples i can come up with are utterly contrived and wouldn't make any sense. i want you to help me com eup with a concrete example from those two questions
15:57sdegutis_________: your nick makes me uneasy for some reason :)
15:57_________callen i've Textual as my IRC client don't really know how to set a nick and it gave me this default, utterly absurd nick
15:57sdegutisLike I'm talking to The Invisible Man.
15:57mtpmaybe you should learn how to operate the tools you're using before you jump in. :)
15:57TEttingeror webchat
15:57TEttinger_________, sets are often used in checks for whether something has a value that equals one taken from a certain set of values
15:57sdegutis_________: use LimeChat, it's great on Mac.
15:58TEttinger,(#{:a :b :c} :c)
15:58sdegutisLeast buggy and most sane client I've ever used.
15:58clojurebot:c
15:58TEttinger,(#{:a :b :c} :d
15:58clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
15:58TEttinger,(#{:a :b :c} :d)
15:58clojurebotnil
15:58TEttingeruseful for filter and stuff
15:58sdegutis(some #{:simple :easy} java.Swing) ;=> nil
15:59tbaldridgesdegutis: (inc limechat)
16:01sdegutisIf you were going to implement a really minimalist subset of clojure.core in a simple Lisp that doesn't have lazy sequences and is also hosted, what primary functions would you have?
16:03callen(inc irssi) ; which works everywhere.
16:03lazybot⇒ 1
16:05sdegutisAs long as you're okay with text-based clients.
16:06^_^callen: Dunno what you're complaining about. :-P
16:06coventry`What's the right way to point lein at a local build of clojure, in the defproject :dependencies? Just putting [org.clojure/clojure "1.6.0-master-SNAPSHOT"] in there doesn't work. Putting a symlink in checkouts/ doesn't work, because it's not a lein project.
16:06callencoventry`: clojure is just a jar.
16:06callencoventry`: repeat that three times to yourself.
16:07Guest99251coventry`: mvn install your build of Clojure
16:08muhootbaldrid_: to be fair, it was also like 10 lines of lamina. but i'm still wondering if it's not the correct thing to use a queue for this. will play with agents instead in a bit
16:10callenmuhoo: it's just critical section serialization, no?
16:10coventry`Guest99251: Thanks, mvn install DWIW.
16:12kovaslooks like a partial lineup of clojure conj talks has been released
16:12kovashttp://lanyrd.com/2013/clojureconj/schedule/
16:13hhenkelHi all, I got a question regarding http://www.luminusweb.net/docs#guestbook_application (CRUD Applications with Clojure). When I do test the example application "guestbook" I get a non empty textarea resulting in a failing check. Anyone aware of what is causing this?
16:15callenthis conj is looking pretty awesome.
16:15hhenkelThe textarea is described as <textarea rows="4" cols="50" name="message"> in the home.html
16:16kovaslooks like there something for everyone
16:16kovasi sure it will be great but wasn't blown away by the lineup
16:17dnolennice Andy Keep talking about compilers
16:18kovasthat will be cool
16:18kovasdnolen: did u submit a talk?
16:18dnolenkovas: I did not
16:18kovasyeah me neither
16:19kawI'm getting a "No such var: comp/namespaces, compiling:(cljs/closure.clj:318:8)" when trying to "lein cljsbuild once", does anyone have any idea what might cause that?
16:20kawJust to be clear, cljs/closure.clj isn't part of my code, I assume it's part of ClojureScript -- some sort of version mismatch between two components in my project setup, maybe?
16:22dnolenkaw: what version of ClojureScript?
16:22dnolenkaw: are you specifying a version?
16:23dnolenkaw: if not, you should - I recommend 1859, 1877 is a little buggy and we need patch it up a bit - plus projects need to catch up with the breaking change around keyword identical anyhow.
16:24dissipate__other than clojure, what are the top picks for FP languages in industry? Haskell and OCaml?
16:24dnolendissipate__: Scala
16:25dissipate__dnolen: so, haskell, ocaml, clojure, scala
16:25dnolendissipate__: which is more a hybrid, but more likely users use it in an FPish way
16:25dissipate__dnolen: and non OOP languages? haskell and clojure?
16:29dissipate__dnolen: is the fact that the playing field of non-OOP FP languages is down to 2 choices a good thing or a bad thing?
16:30dnolendissipate__: I don't really see how it matters much.
16:30dissipate__dnolen: well, it matters in the sense that i only have to learn 2 languages to cover the space.
16:31hhenkelOkay solved the problem by myself. Seems like the indentation in the example file results in a textarea with blanks...
16:33dissipate__kmicu: do you reeketh of the cube farm?
16:36armadillo;
16:38armadillo(+ 1 2)
16:38clojurebot3
16:40sheldonhdoes core have a non-short-circuiting (and)?
16:41nDuffsheldonh: well, you can always get that behavior with a let doing your evaluation early.
16:41nDuffsheldonh: ...might I ask the circumstance?
16:41sheldonhnDuff: hmmm... okay, i'll try again
16:42kawdnolen: Thanks, setting [org.clojure/clojurescript "0.0-1859"] seemed to fix it
16:42dissipate__nDuff: what about lazy let?
16:42kawWell, it's still failing really, but it looks like it's failing at my code now
16:43coventry`sheldonh: It is short-circuiting. E.g., ##(and nil (do (println \.) 1))
16:43lazybot⇒ nil
16:43sheldonhnDuff: like, say you were using midje, and didn't know you could make prerequisites optional, and then found out, but were still curious :)
16:43nDuff,(let [n (do (println "hello") nil)] 10)
16:43clojurebothello\n10
16:43coventry`(It's worth looking at the source, which does as nDuff suggests.)
16:44nDuff...or, to be a little more explicit...
16:44kurtisHey guys, sorry for asking here but #leiningen seems idle. Has anyone had problems running 'lein repl' in OSX?
16:44nDuff,(let [n (do (println "hello") nil)] (and false n))
16:44clojurebothello\nfalse
16:44sheldonhcool. i must have screwed it up when i tried. thanks
16:46llasramkurtis: host firewall?
16:46justin_smithkurtis: I think most lein users are on osx actually, it worked last I tried it (main maching is linux but I have an osx machine)
16:46justin_smithwhat error are you getting?
16:47coventry`sheldonh: Sorry I misread your question.
16:48llasramjustin_smith: This is what they posted in #leiningen: https://dpaste.de/0GI28/
16:48kurtisllambda, My firewall is disabled and I'm just trying to run it locally. (literally just executing 'lein repl')
16:48llasramkurtis: Wrong `ll` user :-)
16:48kurtiswhoops, that was meant for llasram sorry :)
16:48llasramkurtis: The lein repl tasks works is by launching an `nrepl` server then attaching a local client to it
16:49kurtisllasram, Yeah, I saw that after further reading. I went ahead and launched a "headless" nrepl server. At that point, there were no problems. I tried to connect to it but then it refused my connection and I believe ended up crashing
16:49llasramkurtis: Hmm. That really is suggestive of a host firewall, or potentially network configuration issues
16:50llasramkurtis: Sorry, no other ideas here
16:50kurtisllasram, haha no problem! I'll keep investigating. I wonder if it has anything to do with OSX's weird application-level security? Although I run Django and all sorts of other apps without problems
16:51coventry`kurtis: If you do "python -m SimpleHTTPServer" and browse to localhost:8000 does it show your directory listing?
16:52kurtiscoventry`, Yep, and just to check on the hostname resolution -- both 127.0.0.1:8000 and localhost:8000 work
16:53kurtisHere's my output from 'lein repl' in case anyone might have a better idea than myself: https://dpaste.de/0GI28/
16:54llambdaheh poor llasram...you had the `ll` first :(
16:55kurtisOther than ~/.lein -- are there files stored anywhere else? Maybe I had a bad initial install and something corrupt has persisted?
16:55justin_smithkurtis: all the jars are under ~/.m2
16:55coventry`kurtis: Presumably you saw this, and checked that non-HTTP traffic is working, too? https://github.com/heroku/heroku-buildpack-clojure/issues/19#issuecomment-9366427
16:57TimMcsheldonh: What's your use-case for non-short-circuiting and?
16:58kurtiscoventry`, Thanks, I'll read into that more. It might be a good work-around although I think (unless it's just ignorance on my part) this should work fine? -- justin_smith I appreciate it! I'll wipe that directory as well
17:01coventry`kurtis: I meant that you might have a firewall which is only allowing HTTP through, as all of the traffic you've mentioned so far is HTTP. Does "nc -l -v 1234" let you "telnet localhost 1234"?
17:04astevewas .getLong replaced with something from 1.2->1.4?
17:06kurtiscoventry`, Makes sense! I just ran that command and from another terminal tried to telnet to localhost. Received connection refused from 'localhost' but it automatically retried at 127.0.0.1 which worked
17:06kurtisI take that back
17:06kurtisLet me copy + paste the copy to dpaste
17:07kurtiscoventry`, Here's my output: https://dpaste.de/UpOHq/
17:08coventry`OK, and if you type into the telnet window and hit return, does the input show up in the nc window?
17:08kurtiscoventry`, Yep
17:08coventry`OK, it's not that, then.
17:09kurtisShould I try wiping ~/.lein and ~/.m2 and reinstall lein?
17:10llasramkurtis: It certainly can't make things worse :-)
17:10kurtishaha cool. I'll give it a shot
17:12kurtisHmm, the problem is still there :/ https://dpaste.de/IOnHD/
17:13kurtisI guess Leiningen doesn't like my Mac haha. It works fine on my linux boxes but -- that's not ideal for work
17:15justin_smithkurtis: what about specifying a port?
17:16kurtisjustin_smith, I'll give it a shot. I think I've done that once before but I can't hurt
17:16llasramYou know, there was a recent change in Leinigen to change how the repl-port is communicated
17:16llasramkurtis: Are you trying to do this w/in a project?
17:17kurtisjustin_smith, Tried 8080. Same error
17:18kurtisllasram, Interesting. And no -- not at this moment. Although I have tried both from within a projeect and just from my home directory
17:18llasramkurtis: Hmm. Well, that blows one theory. But you can try downgrading a version
17:19kurtisllasram, True! Any suggestion on how to do that? Just grab the appropriate script from github? (different tag/release I'm assuming)
17:19llasramTry: lein upgrade 2.3.1
17:19llasramkurtis: The `upgrade` command actually lets you hit arbitrary versions
17:20llasramActually, you might try even older. I've found 2.1.2 to be very stable
17:21kurtisYeah, 2.3.1 didn't do the trick. Let me try that
17:22kurtisllasram, 2.1.2 worked.
17:22justin_smithyeah, 2.1.2 is golden (using it here myself)
17:22kurtisAm I missing out on anything important by down-grading? I'm not a clojure expert -- trying to replace a Django API w/ Clojure (learning on the job haha)
17:23llasramkurtis: Nothing super-major. 2.2 turned on profile separation, but then 2.3 turned it off again :-)
17:23technomancyit could at least help you find the root cause
17:23kurtishaha cool. Well I will use this to get started and maybe file a bug report to see if the core lein developers might have some ideas. Thanks guys!
17:23technomancyhopefully you don't stay on the old version once you figure out what's going on
17:24llasramkurtis: Anyway, several nice improvements, and you don't want to stay old forever
17:24llasramkurtis: ^^ core lein developers == #{technomancy, ...}, btw
17:25kurtisoh haha
17:25kurtisWell I'm in the right place :)
17:26kurtistechnomancy, Should I file a Github Ticket?
17:26technomancykurtis: not sure what can be done there if you can't provide a repro case
17:27kurtistechnomancy, hmm. True. Maybe cycle through all versions from 2.1.2 to 2.3.1 and see where the breakage occurs?
17:27coventry`Sounds like a good application for git bisect, though. (Not that I've ever done one of those.)
17:27kurtisAlthough if I can't help anyone reproduce the problem since I don't know what it is myself
17:27kurtisAre you guys using Java 6 or 7 with OSX?
17:28technomancyoh, did you find a version that works?
17:28kurtistechnomancy, Yeah the 2.1.2 worked
17:28technomancyoh, I missed that
17:29technomancyin that case maybe a ticket would be warranted
17:32kurtistechnomancy, Thanks. I went ahead and created one. https://github.com/technomancy/leiningen/issues/1321 -- Let me know if you guys need anymore information or want me to test anything. I appreciate the help and awesome project!
17:32kurtiscoventry`, Thanks for the suggestion on switching versions too. Hopefully not a permanent solution but at least I can get started :)
17:33coventry`kurtis: That was llasram, I think.
17:34llasramWithout lazybot to keep track of karma everyone is confused about who gets credit
17:35kurtishaha sorry, thank you llasram
17:57dissipate__does the partial function return a closure?
17:57sheldonhTimMc: it was just curiosity. the use case was bogus (not knowing how to make midje prerequisites optional)
17:58coventry`,(do (use 'clojure.repl) (source partial))
17:58clojurebotSource not found\n
17:59justin_smithdissipate_> if passed a locally bound fn, it will wrap that in a closure, if that is what you mean
17:59nopromptif i'm using lein ring server with an :init option and an exception occurs during somewhere in the :init fn, how do i safely terminate the application?
18:00justin_smithnoprompt: (System/exit numeric-code)
18:00dissipate__justin_smith: i'm reading a warning about 'partial' in 'clojure programming'.
18:01justin_smith0 is success, by convention, anything else indicates an error
18:01justin_smithdissipate_> yes, since it calls fn, that fn creates a closure, which has performance implications since it is created at runtime
18:02dissipate__justin_smith: is the use of 'partial' discouraged for any argument arity over 4?
18:02nopromptjustin_smith: i tried that with (System/exit 1) and it just hangs.
18:02nopromptie. i still need to use C-c to stop it.
18:02justin_smithno, all core functions special case below 4 or so args if they are vararg
18:02justin_smithnoprompt: maybe some thread is hanging? I have never seen that issue
18:03dissipate__justin_smith: i don't understand.
18:03nopromptjustin_smith: actually no that did the trick. i must have forgotten to save the file the first time.
18:03justin_smiththe reason it has seperate versions for each arg count below 5 is because that is how things are written in core
18:03justin_smithfor efficiency reasons
18:04dissipate__justin_smith: and functions that have a fixed arity?
18:04justin_smithwell you wouldn't special case those, would you
18:05dissipate__justin_smith: so if i have a function of a fixed arity of 50, what happens?
18:05justin_smithas opposed to? the function would be annoying to use for one
18:06justin_smithI may not understand your question
18:06dissipate__justin_smith: just trying to figure out these efficiency issues.
18:06nopromptughh, actually scratch that (System/exit 1) does not work. :-(
18:07justin_smiththe efficiency issue with varargs is that it creates a sequence to hold the args, when generally the first thing your function does is break it back down again
18:07justin_smithso you have a small gain by not having to create it if short arg counts are more common
18:07justin_smiththe issue with partial is the calls to fn at runtime need to create a lexical closure, which can't be optimized ahead of time
18:08dissipate__justin_smith: interesting. makes sense, thanks for the info.
18:08justin_smithsimilar issues with allocating a bunch of data, with likely a short lifespan
18:08justin_smithnp
18:08nopromptmaybe it has something to do with nrepl
18:10dissipate__justin_smith: well, now i see much better by looking at the source: https://github.com/clojure/clojure/blob/c6756a8bab137128c8119add29a25b0a88509900/src/clj/clojure/core.clj#L2388
18:11dissipate__justin_smith: strange that the book didn't just point to the source, it's much less confusing.
18:11justin_smith,(source partial)
18:11clojurebotSource not found\n
18:12justin_smithweird
18:12justin_smithin a real repl that would work
18:12dissipate__justin_smith: perhaps clojurebot doesn't have the core loaded up
18:13justin_smith,((partial + 1) 1)
18:13clojurebot2
18:15amalloy~def partial
18:15amalloyjustin_smith: source is in clojure.repl, which is not loaded by default *except* in repls
18:16callenlancepantz: herro :)
18:16callenamalloy: me gusta.
18:16justin_smithamalloy: it found the source function, it just didn't find source code
18:16dissipate__amalloy: thanks
18:17justin_smithamalloy: oh, you mean as a caveat to suggesting using that function, good point
18:19justin_smith,#'source
18:19clojurebot#'clojure.repl/source
18:22TEttinger,(source source)
18:22clojurebotSource not found\n
18:24Apage43https://github.com/clojure/clojure/blob/4004d267e124f12b65b0d7fb6522f32a75e3c4fb/src/clj/clojure/repl.clj#L156-L163
18:24Apage43see also https://github.com/clojure/clojure/blob/4004d267e124f12b65b0d7fb6522f32a75e3c4fb/src/clj/clojure/repl.clj#L134-L154
18:25Apage43expects the var to have a :file and :line on its metadata, then prints the first form on that line
18:26Apage43(which means if you do something like (comment 'blah) (defn foo []) in a file on the same line, and (source foo), you'll see (comment 'blah), I think
18:27Apage43interesting thing it does though
18:28bbloomis there a shorthand for integer (not long) literals?
18:28Apage43it reads all the lines before the line the function starts on, then has the reader read a single form, but through a *proxy* that is also dumping each character it reads into a stringbuilder
18:28Apage43that's how it gets the comments and such
18:29Bronsabbloom: nope
18:29bbloombooo ok thanks
18:30amalloybbloom: integer literals are amazingly difficult to construct
18:30bbloomamalloy: ?
18:30amalloywell, (int 10) isn't an integer literal. it's a literal list containing a symbol and a long
18:31amalloyhow can you create an actual integer literal, eg for some poorly-written macro that demands to be given an int?
18:31bbloomit's for some java interop
18:31bbloomamazing i can't do 10I or something
18:31bbloom10i
18:31bbloomor whatever
18:32amalloyi know. i was just saying it's very hard
18:32bbloomit's not hard, it's impossible :-P
18:32amalloy(if you need an actual literal. which in this case you don't)
18:32bbloomyeah, i don't need an actual literal, but it would certainly be nice :-)
18:32Bronsaamalloy: you can "create" an integer literal during macro-expansion
18:32amalloyBronsa: yes, i was about to link to http://stackoverflow.com/questions/18280626/clojure-annotations-and-integers/18296618#18296618
18:32bbloomheh, #long 5
18:33bbloomer i mean #int 5
18:33amalloybbloom: that's a good idea, actually
18:33Bronsabbloom: hmm, not sure if that's going to work though
18:33Apage43you can get an Integer =P
18:33Apage43sort of
18:33Bronsathere's not an invokePrim that returns an int
18:34amalloyBronsa: right, it could only actually return Integer
18:34BronsaI think that the tagged literal function would box the int returning it
18:34Apage43yep
18:34bbloomnumerics suck in all languages ever :-/
18:34clojurebotI don't understand.
18:35Apage43#java.lang.Integer[5]
18:35bbloomrather than goofy hacks… could we just fix for realzies please?
18:38BronsaI wonder, if the problem with supporting int and the other primitives in invokePrim is only the (very) large number of interfaces that would need to be generated -- can't we generate those interfaces dynamically as we need them instead of generating all the possible interfaces?
18:42dissipate__bbloom: are you saying the numeric values in clojure are a hack?
18:43bbloomdissipate__: why is your perspective always so negative?
18:44dissipate__bbloom: consider it a side effect of dealing with OOP and imperative languages for years
18:44callendissipate__: more accurate to consider it an aspect of having a bad attitude.
18:45dissipate__callen: i have a good enough attitude to learn clojure, right?
18:53TimMcdissipate__: Clojure's host, the JVM, has iffy numerics. It's a compromise.
19:09clj_newb_2345does nrepl have an equiv of "C-c" ? i.e. I want to cancel /kill my last command
19:10amalloyclj_newb_2345: C-c C-c works in slime, dunno about nrepl
19:11clj_newb_2345java still seems hung
19:11clj_newb_2345I think I will just kill the nrepl buffer
19:15clj_newb_2345given a java.io.OutputStream
19:15clj_newb_2345is there a clojure builtin for writing a string to said OutputStream?
19:15clj_newb_2345(rahter than writing single chars at a time)
19:27dissipate__TimMc: how are the numerics on .NET?
19:29ThatOneGuyclj_newb_2345: check out this namespace http://clojure.github.io/clojure/clojure.java.io-api.html
19:30s4muelclj_newb_2345: Take a look at java.io.writer -- OutputStream by nature writes byte by byte, you probably want to send encoded characters to that stream (via a writer). Also, what ThatOneGuy said ;)
19:32ThatOneGuyclj_newb_2345: a really simple function in clojure.core for writing strings and other simple data is 'spit' http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/spit
19:32clj_newb_2345sample code would relaly help :-)
19:32ThatOneGuyits the opposite of 'slurp' if you've used that one before
19:34ThatOneGuyif you can go all the way back to the file abstraction that is probably a good function to use, but if you are given an OutputStream then just using the 'writer' and 'with-open' from clojure.java.io should be easy
19:35xeqiclj_newb_2345: C-c C-b will interrupt, there is a list of keybindings at https://github.com/clojure-emacs/nrepl.el#clojure-buffer-commands
19:35mrcheeksclj_newb_2345: I don't do any clojure coding yet, but this looks straightforward, especially with an internet connection to lookup docs and example: http://stackoverflow.com/questions/7756909/in-clojure-1-3-how-to-read-and-write-a-file
19:35clj_newb_2345ThatOneGuy: noted, thanks!
19:36s4muelclj_newb_2345: look at the source for 'spit' -- it's likely exactly what you want, except you replace the file with the OutputStream.
19:37ThatOneGuy(with-open [w (writer clj_newb_2345_s_OutputStream)] (.write w "super awesome string I want to write"))
19:39Apage43also clojure.java.io/copy is quite handy
19:40clj_newb_2345got my file IO working :-)
19:44TimMcdissipate__: I haven't used .NET.
19:58clj_newb_2345does clojure's "while" not have a correponding "beak" ?
19:59technomancyclj_newb_2345: no, but reduce has the equivalent
19:59clj_newb_2345technomancy: how so?
20:00clj_newb_2345can you explain it for mortals
20:00clj_newb_2345who have not written their own clojure project manager?
20:00clj_newb_2345:-)
20:01technomancyyou can return (reduced x) from your reducer fn and it will short-circuit the rest of the collection
20:01technomancy,(doc reduced)
20:01clojurebot"([x]); Wraps x in a way such that a reduce will terminate with the value x"
20:01bjaclojure.core.reducers/reduce fwiw
20:02technomancy,(reduce (fn [acc x] (if (zero? x) (reduced acc) (conj x acc))) [] [2 3 4 0 3 2 1])
20:02clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentCollection>
20:02technomancy,(reduce (fn [acc x] (if (zero? x) (reduced acc) (conj acc x))) [] [2 3 4 0 3 2 1])
20:02clojurebot[2 3 4]
20:03clj_newb_2345noted
20:03clj_newb_2345thanks
20:03technomancynp
20:09noprompthas anyone used the cljs-http library
20:09nopromptthat was a question :-|
20:10callennoprompt: https://github.com/yogthos/cljs-ajax
20:10nopromptcallen: i was looking at this one https://github.com/r0man/inflections-clj
20:11callenviri for virus is actually wrong.
20:12callenvirus in software plural is viruses, virus in biology plural is virii
20:15callenviruses is the safer option.
20:15nopromptwhoops
20:16nopromptcallen: sorry i meant https://github.com/r0man/cljs-http
20:17nopromptgrabbed the wrong url
20:29serycjonHello! Is there any way to temporarily remap Caps-lock for /leave
20:30serycjon(oh sorry
22:20cjfriszambrosebs: I'm trying to follow up on that JIRA, but I forgot how to get run the type checker on a cljs namespace
22:20ambrosebs(cljs.core.typed/check-ns 'my.ns) in a CLJ REPL
22:21cjfriszambrosebs: ah, there's my problem: I was trying to use clojure.core.typed
22:23cjfriszambrosebs: ok, I got 5 type errors from stuff in cljs.core: vector, first, fnext, and 2 for assoc
22:24cjfriszIs this expected and the JIRA is resolved, or did I encounter an unexpected problem
22:24ambrosebscjfrisz: could you past them?
22:24ambrosebs*paste
22:25cjfrisz?
22:26ambrosebswhat are the errors?
22:26cjfriszambrosebs: Yes, sorry, should have been more specific
22:26cjfriszambrosebs: here's the paste https://gist.github.com/cjfrisz/09c7359d22987378478f
22:27cjfriszambrosebs: They're all "found untyped var"
22:27ambrosebsthat sounds about right.
22:27ambrosebsI don't think they have types yet
22:28cjfriszambrosebs: That's what I figured
22:28ambrosebsso that's a good thing :)
22:28cjfriszBut at least the type checker seems to run
22:28ambrosebsyes
22:29ambrosebscjfrisz: you can use (ann ^:no-check v t) to skip any functions that are missing annotations.
22:29ambrosebscjfrisz: or you can add them by using a fully qualified `ann`.
22:30cjfriszambrosebs: then I'd have to think about the types of those things! :-)
22:30ambrosebscjfrisz: steal them! https://github.com/clojure/core.typed/blob/master/src/main/clojure/clojure/core/typed/base_env.clj#L663
22:30ambrosebscjfrisz: don't bother trying assoc, it needs to be hard coded.
22:30cjfriszambrosebs: sweeeeeeet
22:31cjfriszambrosebs: I think I remember you talking about trying to work out the type for that
22:32ambrosebscjfrisz: still dreaming :)
22:32cjfriszambrosebs: it struck me as a thing I probably wouldn't knock out with my brain turned off and youtube videos on
22:33ambrosebs:)
22:37ddellacostaI'm having a heck of a time figuring out how to understand where this exception is originating
22:37ddellacostahttps://www.refheap.com/18526
22:38Apage43me too
22:38ddellacostato complicate things, I'm using a patched version of https://github.com/thegeez/clj-browserchannel (jetty-adapter). Any tips on how to figure it out?
22:39Apage43it looks to me like a socket is getting closed before you finish writing to it
22:40Apage43in this context, I expect that's something like a long-polling HTTP request
22:40cjfriszambrosebs: I stole the types from base_env.clj got "Cannot parse type: (APersistentVector x)"
22:40cjfriszAdded ^:no-check to all the annotations and got the same thing
22:41ddellacostaApage43: yeah, that's about as much as I can figure out as well. It seems to happen after a session is established, and when the first bind message is sent (in browser channel, the protocol seems to be like "test, then bind"
22:41ddellacosta)
22:41ambrosebscjfrisz: try cljs.core/IVector instead of APersistentVector
22:41Apage43it's already something that jetty is only printing to the DEBUG level log. I wouldn't worry about it.
22:41ddellacostaApage43: yeah, I guess you're right, I could just leave it well enough alone--it works otherwise--but feels "dirty" not knowing where this is coming from or why. Don't like it.
22:42Apage43ddellacosta: you could confirm by watching the chrome network inspector something
22:42Apage43or even using that inspector's "copy request as cURL" command feature and see if you can start a longpoll request and cause the exception when you ctrl-c curl
22:43ddellacostaApage43: interesting idea--I'll give that a shot. Hadn't thought to look in the chrome network inspector, but I see a canceled test call already--so that seems like a good lead. Thanks, I'll see what I can figure out from this!
22:45clj_newb_2345[02:15:55.899] TypeError: cljs.core.async.impl.dispatch.exists_QMARK_ is undefined @ http://crfx:3000/static/main.js:27781
22:45clj_newb_2345this is what I get from use cljs.core.async
22:45clj_newb_2345use [cljs.core.async :only [chan <! >! put!]]
22:45clj_newb_2345in particular -- what is this bug, and how do I get rid of it?
22:53cjfriszambrosebs: Now I'm getting "Cannot parse type: (Option (EmptySeqable x))"
22:53cjfriszI assume it has to do with that EmptySeqable, but perusing cljs.core didn't turn up anything immediately obvious to me
22:53ambrosebsdo you know where EmptySeqable is coming from?
22:54ambrosebsoh it might be Option.
22:54ambrosebstry (U nil (EmptySeqable x))
22:56cjfriszambrosebs: That got me to "Cannot parse type: (EmptySeqable x)"
22:56ambrosebstry (I (cljs.core/ISeqable x) (ExactCount 0))
22:56ambrosebswhich type are you copying?
22:58ambrosebsmaybe this is more useful :) (def-alias EmptySeqable (TFn [[x :variance :covariant]] (I (cljs.core/ISeqable x) (ExactCount 0)))
22:58cjfriszambrosebs: let me know if you don't have time to deal with my pestering right now; I feel like I'm throwing a lot of whining your way
22:58clj_newb_2345alright
22:59clj_newb_2345in ptojrect.clj, how do I specify what version of clojurescript ot use
22:59ambrosebscjfrisz: will do :)
23:00ambrosebscjfrisz: just hanging out at home today.
23:03cjfriszambrosebs: it seems happy with the def-alias for EmptySeqable, now I'm trying to figure out NonEmptySeqable
23:04ambrosebs(def-alias EmptySeqable (TFn [[x :variance :covariant]] (I (cljs.core/ISeqable x) (CountRange 1)))
23:04ambrosebs(def-alias NonEmptySeqable (TFn [[x :variance :covariant]] (I (cljs.core/ISeqable x) (CountRange 1)))
23:04ambrosebscjfrisz: come to #typed-clojure
23:04cjfriszAh, didn't know about CountRange
23:04cjfriszambrosebs: good call
23:22ddellacostaI have a proxy. I need to call the protected member of a parent class on the instance, outside the definition of the proxy. Is this possible, or do I need a different mechanism (gen-class...?) to do this?
23:40amalloy&(doc proxy-super)
23:40amalloyRaynes: lazybot is gone again. any idea why?
23:43amalloyddellacosta: ^
23:43amalloyif you need to do it from a scope that is not inside the definition of the proxy, you are probably out of luck, but also crazy
23:44ddellacostaamalloy: the problem is that the method I have to call is protected, and I have to call it outside of the proxy--after I've created an instance. Not sure how to do this without adding a new method which is public, and therefore seems like I have to use gen-class
23:44ddellacostaamalloy: hmm why crazy?
23:49amalloyddellacosta: i mean, i could be wrong. if it's a protected method for a reason, then accessing it willy-nilly from anywhere doesn't sound like a good plan
23:50amalloybut i suppose people sometimes make things protected for no reason
23:50seangroveamalloy: I think especially in the Java world
23:50amalloyyou can just define your own version of it that's public and delegates to the protected one
23:51ddellacostaamalloy: that's what I intend to do. I was hoping I could do that with proxy, but seems pretty clear I have to use hen-class. :-(
23:51ddellacosta*gen-class
23:52amalloywow, is proxy-super not thread-safe? the source looks that way
23:52clj_newb_2345when communicating data back and forth clojure and clojurescript over a websocket, is json the ideal way to serialize?
23:53xeqiclj_newb_2345: I'd consider edn
23:53clj_newb_2345wait, can't I just use "read" ?
23:53ddellacostaamalloy, seangrove: why I'm calling a protected method: I'm extending Apache Shiro, and need to invalidate the cache. I'm only using authorization capabilities of Shiro so I don't rely on their framework to manage the overall flow--I using bits and pieces as suits me. As such, I'm doing stuff like what "framework implementers" (according to their docs) do, more or less, so I have some reasonable use-cases for calling protected
23:53ddellacostamethods.
23:53ddellacosta*I am using bits and pieces
23:53clj_newb_2345xeqi: http://clojure.github.io/clojure/clojure.edn-api.html ?
23:54ddellacostaclj_newb_2345: yep, edn is nice if you have a clojure <-> cljs thing going
23:54clj_newb_2345ddellacosta: is there an example?
23:54dissipate_clj_newb_2345, ideally you wouldn't have to worry about it at all. see web frameworks like opa and mojito.
23:54clj_newb_2345well
23:54xeqiclj_newb_2345: yep, those are the read functions on the clojure side
23:54clj_newb_2345I'm going sorta minimal
23:55dissipate_clj_newb_2345, but i've been told that running clojurescript on the back end is blasphemy
23:55ddellacostaclj_newb_2345: er, I mean, it's just calling str/ read-string on either side, more or less
23:55clj_newb_2345well
23:55clj_newb_2345there are security issues no?
23:55xeqinot with the edn readers
23:55xeqiwith clojure.core/read, possibly
23:58ddellacostaclj_newb_2345: yes, use clojure.edn/read-string, not clojure.core/read-string
23:58clj_newb_2345noted; was confused; but undersand the difference now
23:58clj_newb_2345thanks
23:59ddellacostanp