#clojure logs

2013-06-21

00:00tomjackmdeboard: reify is good
00:00tomjackI wouldn't camel-case my fn names..
00:01mdeboardYeah, holdover from my first 15 stabs at this tonight. Transliterating a tutorial from java to clojure :)
00:04muhoonice, i've got spyscope, nrepl-discover, and possibly even nrepl-ritz to try out
00:04amalloymdeboard: the (. obj method) syntax looks *very* awkward
00:05noonian(.get matrix 4)
00:05callenI really could've used spyscope a long time ago.
00:06mdeboardamalloy: I'm ok with awkward-looking for now, more concerned with logic than style atm
00:07mdeboardUnless there's a clojure styleguide somewhere in which case that would be great too
00:08malyn_mdeboard: Clojure style guide -- https://github.com/bbatsov/clojure-style-guide
00:08mdeboardAwesome.
00:10amalloymdeboard: if i were going to edit this and make only cosmetic changes, my version would look like https://gist.github.com/amalloy/5828691
00:10amalloyhaha whoops, except i introduced a new local named coords, which stomps on the "hidden" global coords. so call mine something else
00:11amalloyalso i strongly suspect you don't want coords to have "keywordized" integers as keys, like :2. just make it the integer 2
00:11mdeboardok so here's method invocation syntax "fixed" https://gist.github.com/mattdeboard/5828696
00:11n_bI recall someone in here mentioning they had a Whirldwind Tour of Clojure slide deck - anyone recall who it was or where I might find it?
00:12amalloy$google Whirlwind Tour of Clojure slide deck
00:12lazybot[Building Web Apps with Clojure / Open Source Bridge: The ...] http://opensourcebridge.org/sessions/836
00:13mdeboardamalloy: Yeah, I have questions about that (``coords`` ref) too. Since this java method I'm invoking doesn't actually return anything I guess I have to resort to mutable state; that said I'd rather not pollute namespace scope with refs but I can't pass that ref to the MatrixRenderListener
00:13mdeboardWhat I SHOULd do is extend the PdfReaderContentParser and add a new method. Good idea
00:13tomjackdoes #spy/p really work as advertised?
00:13tomjackI don't get it
00:13amalloymdeboard: right, you probably can't do without it in the context of the larger problem. although it also is very likely that an atom would be fine and there's no need for a ref
00:14mdeboardatom is... uncoordinated and something?
00:14tomjack#spy/d makes sense I guess, but seems kinda nuts..
00:15amalloytomjack: doesn't it just expand to code that prints the given thing and thenn returns it?
00:15amalloylike, it's a macro for "wrapping" a value in printing, except that it works for devs whose keyboards lack () keys
00:16mdeboardamalloy: In what sense is a ref overkill but an atom isn't?
00:16amalloymdeboard: well, you need some global state, but you don't need to coordinate across multiple stateful things
00:16tomjackthat's what seems kinda nuts
00:17amalloytomjack: i agree it's stupid
00:17tomjack#spy/p just seems impossible t ome
00:17tomjackor useless
00:17amalloyi mean, i'm totally in favor of a macro like (? (x)) which prints "(x) is 5" and returns 5; i wrote one myself and use it all the time
00:17amalloybut making a reader macro out of it because you can't figure out how to use paredit? it's stupid
00:18tomjackah that is a reason that makes (some) sense at least
00:18tomjackdidn't occur to me that it would be easier for some people to type a reader macro
00:18tomjacker. data reader.
00:19amalloynow, there is one actual benefit of doing it that way
00:19amalloyie, you can use #spy/p in a namespace that doesn't (require 'spy.whatever)
00:19amalloysince reader macros are global
00:20tomjackah, yeah, it occurred to me but I explained it away too easily with "well you have to require it anyway"
00:28tomjackswitching to nrepl and tmux today. /me crosses fingers
00:29muhoonrepl is great
00:34wastrelnrepl you say
00:37noonianim trying out light table right now as an alternative to emacs
00:52muhooah, i think my PermGen errors are triggerd by trying to run alembic
00:52muhooseems to be what causes the breakage, pretty reliably.
01:05muhoosomewhat mitigating nrepl's awesomeness, is trying to use C-c C-e with tools.trace or spyscope, in which case, the trace output goes nowhere
01:21bluegatorhello all
01:21bluegatoris there a way to query at runtime if lein is running with a particular profile?
01:46mjc&(byte 120)
01:46lazybot⇒ 120
01:46mjc&(byte 129)
01:46lazybotjava.lang.IllegalArgumentException: Value out of range for byte: 129
01:57amalloy&(doc unchecked-byte)
01:57lazybot⇒ "([x]); Coerce to byte. Subject to rounding or truncation."
02:40mjcamalloy: that is indeed what I'm looking for, thanks!
02:41mjcdoing some analysis type stuffs on xor "encrypted" data
03:35Zamarok&(assrt (= (conj '(false) true) (conj [false] true)))
03:35lazybotjava.lang.RuntimeException: Unable to resolve symbol: assrt in this context
03:35Zamarok&(assert (= (conj '(false) true) (conj [false] true)))
03:35lazybotjava.lang.AssertionError: Assert failed: (= (conj (quote (false)) true) (conj [false] true))
03:35Zamarokwhy does conj work differently for '() and []?
03:36Zamarok[(conj '(false) true) (conj [false] true)]
03:36Zamarok&[(conj '(false) true) (conj [false] true)]
03:36lazybot⇒ [(true false) [false true]]
03:49mjcZamarok: I believe it's due to how the data structures are implemented under the hood, i.e. head vs tail insertion
03:50ZamarokThat was a very disrupting bug to work out, and the docs aren't helpful
03:51Zamarok&(doc conj)
03:51lazybot⇒ "([coll x] [coll x & xs]); conj[oin]. Returns a new collection with the xs 'added'. (conj nil item) returns (item). The 'addition' may happen at different 'places' depending on the concrete type."
03:51ZamarokWhich concrete types? Which "different 'places'"? Why is 'places' in suspicious quotes?
03:52mjchttp://clojure.org/data_structures has more detail
03:53callenZamarok: where's your book?
03:54ZamarokBook? I have 'Programming Clojure'...
03:54callenThat's not a good one.
03:54callenZamarok: okay we'll do this the old fashioned way.
03:54callenZamarok: in Clojure, what is a []?
03:54ZamarokA vector
03:54callenZamarok: and, approximately, how is it implemented?
03:55ZamarokSome sort of Java array, I'm guessing?
03:55callenZamarok: if you don't know, just say you don't know. Don't google. Just talk to me.
03:55callenZamarok: wrongo!
03:55callenZamarok: okay, what's a '()?
03:55ZamarokPersistentSequence
03:56ZamarokNot sure how they're implemented either
03:56callenhrm, less concretely.
03:56callenZamarok: how are traditional Lisp lists implemented?
03:56Zamarokno idea. just got into lisp a few days ago
03:57callenZamarok: you should be using your book more. Lets speak in broad terms.
03:57callenZamarok: what is orthogonality?
03:57mthvedtzamarok: 'places' and 'addition' are in quotes because clojure data structures are persistent, or follow the link mjc gave
03:58Zamarokdunno about orthogonality either
03:58callenZamarok: https://en.wikipedia.org/wiki/Orthogonality_(programming)
03:58Zamarokmthvedt: that makes sense, thanks
03:59ZamarokOh, as in "clojure code is just clojure data"
03:59callenZamarok: does it sound better to have a bunch of data structures with the same weaknesses and strengths or to have a set of data structures that have a mix of strengths and weaknesses?
03:59ZamarokA mix, so you can choose the right one for the right job
04:00callenZamarok: if there's a mix, does that mean adding values to them is going to be equally performant in all cases?
04:00callenadding values in a particular fashion, anyway.
04:01ZamarokI guess not.. I know adding to beginning of an array is expensive in many languages, if it's even possible
04:02callenZamarok: so a vector looks like this: http://blog.higher-order.net/2009/02/01/understanding-clojures-persistentvector-implementation/
04:02Zamarokbut easy to add a new head to the beginning of a linked list
04:02mjcinteresting. I'd always heard orthogonal to describe the abilities of pieces of a system to be modifiable in isolation.
04:03callenmjc: that's something else.
04:03callenZamarok: okay, so if conj isn't making any promises about "where", but rather, "what", why do you suppose the behavior is different?
04:05callenZamarok: also when I said '(), I was asking for IPersistentList. Behaves more or less like a standard Lisp list with the stacky cons/conj characteristics
04:06callenZamarok: Seq is the generic collections abstraction that sits atop Clojure collections.
04:06callenZamarok: although it's not a fantastic book, you do have a book. You should read it.
04:09Blktgood day everyone
04:09callenBlkt: good evening.
04:09ZamarokSo, if I understand correctly, conj is different for vectors because Clojure wants to add nodes to the tree in a balanced way, rather than inserting nodes in awkward places.. yes?
04:09callenZamarok: no. Read your book.
04:09katratxohehehe
04:16amalloythat's not far from true, really. conj goes last for vectors because that's where it's efficient to put them. who cares about "balanced" and "awkward"?
04:17mthvedti think starting socratic inquiry, only to terminate it with "no, read your book" is an anti-pattern
04:17callenmthvedt: I gave him a link that demonstrated visually exactly why it is the way it is
04:17callenmthvedt: the "read your book" was a reaction to the evident laziness.
04:18callenmthvedt: Beginner mind? no problem. Lazy mind? not my problem.
04:18callenbut anti-pattern is a delightful way to say "I don't like this". I'll have to use that to describe somebody's cooking tomorrow.
04:20ZamarokI read quick ;) thought I got the gist, wanted to confirm so I can move on, research it later
04:20amalloycallen: he asked why tea is so popular in england, and you sent him a diagram of the structure of a taste bud. asking for clarification by rephrasing what he thought he'd learned was pretty reasonable
04:20Zamarokbut thanks for the cryptic assistance
04:20callenZamarok: nobody ever said lazy meant slow.
04:21callenamalloy: I think that's a fair characterization. But if he's in such a hurry, he has no time to wait for anybody in IRC to respond to anything. So godspeed.
04:21mthvedtcallen: i think not understanding unnecessary details of persistent data structures is not proper evidence of a "lazy mind", particularly when it's obvious he attempted to understand them
04:22callenwhy aren't you helping him instead of spending time discussing how I helped him?
04:22mthvedtcallen: tu quoque
04:22callenI had an epiphany - then shared it.
04:22callendon't be a bore.
04:23callenPeople that wait for an excuse to toss out latinate nouns for acts of sophistry are terrible conversation partners.
04:24mthvedti also actually tried to help, so that's both wrong and fallacious.
04:30callenddellacosta: what joke?
04:30ddellacostahas lein changed how it handles checkouts recently? I thought that you merely had to put something in checkouts, then remove the dependency in projects.clj, and it would pick it up. I could swear I've done it that way many times in the past.
04:30ddellacostacallen: what?
04:30callenddellacosta: your twitter. What joke did you try to tell?
04:31ddellacostahaha, that?
04:31callenddellacosta: American jokes told to Japanese people. You said they weren't ever funny.
04:31callenddellacosta: what joke did you try to tell? Or were you simply witness to it?
04:31ddellacostaI was in Starbucks, and the cashier gave me a free sample
04:31ddellacostaand I said, "are you trying to make me fat?" and she just looked at me, and I was like, right, not funny...
04:31ddellacostaof course, it's not really funny anyways
04:32ddellacostabut it *is* a very American thing to say
04:32callenddellacosta: I kinda feel for her. I tend to stare blankly when people are insincere.
04:32callenddellacosta: what does lein classpath say?
04:32ddellacostaI was sincere! Always sincere. In my desire to get her to chuckle at least…*sigh*
04:32ddellacostacallen: lein classpath says it's there.
04:33ddellacostacallen: hmm, wonder if it's cause my repl is loaded with-profile test?
04:34callenddellacosta: well you have a good candidate for a testable hypothesis now.
04:34ddellacostacallen: regarding the joke thing, I guess it's more just that I suck at Japanese small talk--it's all about knowing the thing that makes them smile. I can do it in the states, I can't do it here. Don't have the cultural depth yet.
04:34ddellacostacallen: yeah, I'll try that.
04:35callenddellacosta: could be worse. I can't make anybody smile unless you count winces.
04:35callenddellacosta: I wonder what Japanese small talk sounds like? I don't think I've ever heard it before.
04:35ddellacostacallen: haha…seriously? I'd be surprised if that were really true.
04:35callenddellacosta: I've only heard conversations in shows.
04:36ddellacostacallen: like I said, if I could manage it, I would have made my cashier chuckle…maybe.
04:36callenddellacosta: did flipping the profile to dev or user change the behavior?
04:36ddellacostacallen: well, the thing I realized is that because I am testing, I can't really do that without essentially making it a moot point. Hmm.
04:37callenddellacosta: I think part of the problem is that it's a transactional conversation and it's hard to do small talk in Japanese without pre-established information or to use as a prelude to further conversation.
04:37callenddellacosta: passing one-liners is a very American thing, I think.
04:37ddellacostalet me re-state the issue: how do I mock ring's anti-forgery-token in a routing test?
04:37callendid you just xy my ass?
04:37ddellacostacallen: I think you're absolutely correct.
04:37ddellacostaxy?
04:37clojurebotxy is http://mywiki.wooledge.org/XyProblem
04:37callenthank you clojurebot.
04:37callen~botsnack
04:37callensigh. god dammit.
04:37clojurebotbotsnack is scoobysnack
04:38callen,scoobysnack
04:38clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: scoobysnack in this context, compiling:(NO_SOURCE_PATH:0:0)>
04:38callen~scoobysnack
04:38clojurebotscoobysnack is botsnack
04:38callen...the bot is fucking with me now.
04:38ddellacostacallen: yeah, I guess I may have….I'm sorry though, it was my own fault for going too far down the wrong road before I realized I should back it up and try asking the *real* question. My apologies!
04:39callenoh it's okay, I probably earned the torment earlier
04:39ddellacostayeah, I mean, this all came from me trying to test a post action which I have wrapped in ring-anti-forgery middleware
04:40callenddellacosta: in terms of mocking it, what exactly do you want it to do? you could just monkeypatch the middleware.
04:40callenddellacosta: if you want it to stop validating the token, write a no-op ring middleware and swap it out.
04:40ddellacostacallen: yeah, I *was* trying to stub out the actual *anti-forgery-token*, but I may just go and try stubbing the middleware itself
04:41callenddellacosta: well nothing happens but by the grace of god - or in this case, middleware.
04:41callenddellacosta: better to smash the arm swinging the hammer rather than try to stop it hitting the anvil.
04:41ddellacostacallen: and while it may be a better practice conceptually, I don't like pulling the specific routes out and just testing against those--I often end up missing something because my environment is different
04:42ddellacostacallen: haha, interesting metaphor
04:42callenddellacosta: I generally write tests for the complicated bits and for API QA. I don't feel compelled to TDD things like you do.
04:43ddellacostacallen: I mean, I think sometimes I get too caught up in it. I'm still trying to find a good balance. But usually when I've gotten to this point, it means I'm doing something wrong.
04:43callenddellacosta: so now I'm an enabler.
04:43ddellacostacallen: haha, no--but you've given me good food for thought (as always).
04:44ddellacostaalthough, I have to say, you didn't help me at all with my Japanese smalltalk. *sigh*
04:44callenddellacosta: you could say Amerika kara desu, but that'd be painfully obvious and out of place.
04:44callenddellacosta: having a prop might help.
04:44ddellacostacallen: yeah, I look different enough that no one needs me to call *that* out...
04:46ddellacostaalright, gonna try to get this working. Thanks callen, and sorry for the xy-ing earlier…
04:46callenddellacosta: I'm a big fan of doing quasi-evil things with (binding...) when I need to monkeypatch.
04:46callenddellacosta: good luck :)
04:46ddellacostacallen: another interesting idea, will try it. thanks :-)
04:46callenddellacosta: it at least scopes the evil.
04:46callenfailing that, just smash the fuckin' var.
04:47ddellacostahaha…HULK MOCK/SMASH
04:47callenI should pass that one on to Raynes for his next testing library.
04:47Raynescallen: wat
04:47callenRaynes: I've had a lot of tea.
04:54ddellacostacallen: ring.middleware.anti-forgery/valid-request? (constantly true)
04:54ddellacostain with-redefs
04:54ddellacostaSMASHED
04:54callenddellacosta: handy if you still want the token floating around.
04:54callenddellacosta: nice :)
04:55ddellacostacallen: thanks for helping me think outside the box. ;-)
04:55Raynescallen: I managed to break the dash and interior gauge light dimmer housing before actually buying the car, btw. At least the dimmer breaking loose was not my fault, I barely touched it. Breaking the dash loose on the left, on the other hand, was my fault while I was trying to fix it.
04:55callenddellacosta: you're always welcome to my padded cell.
04:56ddellacostaheh
04:56callenRaynes: stop hulk-smashing your future car.
04:56RaynesI'm not even sure how to get something like that fixed.
04:56RaynesI mean, I can't find the dash online anywhere, so I'm not sure how a mechanic would either.
04:56callenmechanics have resources.
04:56callenalso, junkyards.
04:56RaynesYeah, but if it's this hard to find it I'm going to end up paying a fortune.
04:57callenI don't think that's an epistemologically valid statement.
04:57RaynesI don't think I know what that word means.
04:57calleneasy to test hypothesis though.
04:57callenwhy not call a mechanic and maybe a few junkyards?
04:57RaynesWell, I will.
04:57callenthen why the distress? you already know what to do. :)
04:57RaynesGoing to talk to Alex about it tomorrow and see if he has any suggestions on what we should do.
04:58RaynesBecause it sucks, man.
04:58RaynesI've still got to get my CA license. Going to the DMV tomorrow, crossing my fingers that they don't force me to do a behind-the-wheel test and waste another day of my time.
04:58callenRaynes: well I hope the problem unravels inexpensively.
04:59RaynesLuckily i didn't break anything on the car that would make it unusable for testing.
05:02callenddellacosta: I really need to pick ring-anti-forgery apart. Way too tightly bound together.
05:02ddellacostacallen: I mean, there's not that much to it in the end
05:03ddellacostacallen: but it would be nice if it was a bit more configurable I think
05:03callenddellacosta: quite right, but it locks off the whole ring app.
05:03maleghastAnyone in here used / using Compojure, I have an odd question...
05:03maleghastIf I wanted to define a POST route, with a URL pattern like this -> /:country/payment/submit/:type.:format - how would I assign / bind :country, :type and :format as well as get hold of the POST Body (which is going to be JSON, EDN or XML)
05:03maleghast?
05:03maleghast(All the examples I can find on the web seem to assume that you don't need to bind anything from the URL if you're handling a POST)
05:03ddellacostacallen: yes
05:03callenddellacosta: that's uh, unacceptable for my purposes :P
05:03maleghast(sorry about the copy/paste - I originally posted in wrong room - d'oh!)
05:03ddellacostacallen: for mine too, it turns out…I learned the hard way today
05:04callenyou've been having a grand time lately it seems.
05:04ddellacostaheh, dunno if I would say "grand..."
05:07echo-areaIs Compojure deprecated or not?
05:07maleghastecho-area: Not that i'm aware of, no
05:08maleghastecho-area: I mean weave jester (James) hasn't made any commits or integrated any pull-requests for a month, but I don't think it's dead or anything
05:08maleghastecho-area: Why?
05:08callenecho-area: Noir is the web framework that got deprecated, Compojure is still very popular and maintained.
05:09callenmaleghast: compojure is pretty close to not really needing much changed unless the mission statement or requirements change.
05:09maleghastcallen: I figured - I have found it excellent, apart from my confusion above ^^ and one other Q I have
05:09echo-areacallen: That's it. Is Noir deprecated because its design is not simple in the sense in Rich's presentation? I recall I read it somewhere saying so.
05:10echo-areamaleghast: Never mind, it's just I was trying to recall what I saw.
05:11callenNoir is deprecated because the creator found better things to do and the community wasn't interested in maintaining that kind of web framework.
05:11callenthe more useful bits live on in lib-noir
05:11Raynescallen: http://www.youtube.com/watch?v=Vw5MYv-5xZE
05:11Raynescallen: I recently discovered how much I love this band.
05:11maleghastecho-area: ??
05:11lazybotmaleghast: Definitely not.
05:11RaynesJust throwing that out there.
05:12maleghastRaynes: Interesting… I will check it out later - work does not currently lend itself to video consumption ;-)
05:13callenRaynes: this is pretty good. I'm hella tired though.
05:13Raynescallen: The band fills a hole left by the departure of My Chemical Romance for me, which is dark rock.
05:14callenRaynes: you need to be filling your holes with black metal.
05:14RaynesThey remind me of The White Stripes crossed with MCR. I'm particularly excited to see a young female lead not doing bubblegum pop.
05:14RaynesShe was 17 in that video, fwiw.
05:14clgvecho-area: arguments against noir mainly criticised its global variabls as far as I remember. you are encouraged to use lib-noir though if you need some of its features
05:14callenThere are females in black metal.
05:14ddellacostagot booted and now you guys are talking about metal
05:15callenddellacosta: somebody was asking about Noir (again) and raynes is still musical.
05:15ddellacostamaleghast: did you find a solution? I was about to say, I have routes which are like that, and they are basically like GET in terms of destructuring and whatnot
05:15ddellacostacallen: Noir…? Is there a metal-band called Noir?
05:15maleghastecho-area: Here's the announcement about Noir -> http://blog.raynes.me/blog/2012/12/13/moving-away-from-noir/
05:16maleghastddellacosta: Not as yet - can you give me an e.g., please?
05:16ddellacostahmm, lemme see, one sec
05:16echo-areamaleghast: I read somewhere complaining about some web framework being deprecated because of not implemented with composite functions, or not being simple. I forgot its name (actually the many web frameworks written in Clojure is a little confusing to me), and tried to recall its name.
05:16callenddellacosta: Noir web framework. It was the daily, "is Noir deprecated?" conversation.
05:16ddellacostacallen: haha, oh, that. Just not sure what it has to do w/music
05:16echo-areamaleghast: Okay, thanks
05:16echo-areaclgv: Good to know, thanks.
05:17echo-areamaleghast: I think I read it on ycombinator or somewhere.
05:17callenddellacosta: nothing. I wasn't framing a causal relationship, just rattling off isolate conversations.
05:17callenecho-area: be careful, those ycombinator folk are tricksy.
05:17maleghastecho-area: You might want to consider Compojure + lib-noir, or Liberator + Compojure for an API and finally you could always give Pedestal a try...
05:17ddellacostacallen: ah, gotcha…now I see.
05:18callenecho-area: use compojure and lib-noir. See Luminus or bitemyapp/neubite for examples.
05:18clgvecho-area: you get pretty far with ring, compojure and friend...
05:18callenecho-area: don't use Friend either.
05:18clgvcallen: huh, why?
05:18maleghastcallen: Yeah, why no Friend usage?
05:18callenpain, irrelevancies that will confuse noobies just trying to learn and maybe get something done.
05:18echo-areaSee, that's why I'm confused. Currently I use only Ring, for I don't need to rend complex web pages.
05:18callenwriting their own auth middleware will be a good exercise.
05:19maleghastcallen: Fair point
05:19callenevery single time a noobie gets told to use Friend, they're invariably in here for hours trying to bash it into place to make it work.
05:20callenwhy not eliminate the tire spinning and let them focus on the parts that matter? it's bad pedagogy to recommend something like Friend to anybody who isn't already "together" in other respects.
05:20ddellacostamaleghast: I can't copy and paste the code I'm using or my boss would be mad, but here is a rough idea of how we did it…no guarantees on this working as is though, of course: https://www.refheap.com/15978
05:21maleghastddellacosta: Cheers mon ami - 'sis appreciated :-)
05:21ddellacostare Friend questions, you can throw them my way, but I can understand where Callen is coming from. Not really n00b-friendly lib
05:21ddellacostamaleghast: hope it helps!
05:21callenit's just a low value thing for them to fight
05:22callenit's added complexity that has nothing to do with learning Clojure or making a web app. They'll know later on when/if Friend makes sense for them.
05:22ddellacostayah, I think that's probably reasonable
05:22callenand I still think writing auth middleware is a good exercise for learning Ring.
05:22clgvcallen: ah learning clojure was echo-area's main goal? I read it as being building a webapp... ;)
05:22callenmaleghast: nope.
05:22ddellacostaI think it's definitely a "once you get comfortable with Ring/Compojure and maybe a template lib, then give it a shot" kind of thing
05:23callenI'm starting to suspect nobody reads anything I say and just looks for keywords like #clojure #friend and #bad
05:23callenclgv: reread what I said.
05:23callenclgv: "or making a web app."
05:24ddellacostamaleghast: one note on what I gave you, I don't think there's any need for the context in there--it's just how we have it structured. Presumably you could use that path in the POST call directly.
05:24maleghastcallen: FWIW I got what you meant, and you're not wrong.
05:24maleghastddellacosta:
05:24maleghastddellacosta: OK, cool - thanks :-)
05:24clgvcallen: well if I want to make a web app and am not a clojure beginner and need authentication+authorization why shouldnt I use friend?
05:24irctc081callen, I am looking what you said. lol
05:25callenclgv: that's not what I was talking about.
05:25clgvcallen: well, then your repetition of "or making a web app" was pointless for me ...
05:26callenthe universal, perpetual, and exclusive qualifier was "noobie"
05:26callenmaybe my sentences need to be structured like clojure macros.
05:27callen(defnoobie [(or (making-web-app :use-friend?) ; returns nil (learning-clojure :use-friend?) ; also returns nil)])
05:27clgvcallen: then my question whether echo-area's main goal is learning was totally valid ;)
05:27callenclgv: top level is a macro scoping it to noobies.
05:28callenclgv: possible predicate applicators are making a web app or learning clojure.
05:28callenclgv: in either case, there's not much cause to use Friend.
05:28callenwhether your goal is to make a web app (as a noobie. Remember the defnoobie?) or to learn Clojure (as a noobie. Remember the defnoobie?)
05:28callenI'm starting to see why XML was so popular.
05:28clgvcallen: I found it pretty useful in setting up access control for a web ui to control a computation
05:29callenclgv: that's wonderful but also maximally irrelevant to what I was talking about.
05:29callenclgv: one of the very first sentences I wrote on the subject was that it was, "bad pedagogy" to recommend Friend.
05:29callenclgv: do you know what pedagogy is?
05:30clgvcallen: ok, short answer would have been "echo-area just wants to learn how to make web apps in clojure"
05:31maleghastI love the word pedagogue, in fact it's even better if you enhance it with the adjective peripatetic...
05:31maleghast…you get alliteration and "clever words" as a combo bonus. ;-)
05:31callenclgv: but the deeper answer?
05:32callenit's kind of sad that you can't alliterate alliteration. Only assonance.
05:32mthvedtmaleghast, i think what we have here is a pair o pathetic peripatetics.
05:33maleghastmthvedt: I couldn't begin to comment - but I do love that this channel often surfaces fantastic vocabulary as well as helpful insights into its supposed subject / purpose.
05:35mthvedtmaleghast: tbh my comment was partially motivated by the desire to use "pair o pathetic peripatetics" in a sentence
05:36maleghastmthvedt: Entirely reasonable in my not-even-remotely-humble opinion… ;-)
05:37echo-areacallen: What do you think the main problem of Friend is?
05:37noncomhi, i want to split my single cljs file into several cljs files. do i simply do this like with clj files? i mean the namespace stuff, :use and :require things
05:37callenecho-area: I was talking about pedagogy.
05:37echo-areaHmm
05:38echo-areaTo be honest, I still don't get the key to decide by reading your discussions earlier.
05:39echo-areaI'll check them later, when I need one of them.
05:39callenecho-area: use compojure + lib-noir, look at Luminus or bitemyapp/neubite for examples.
05:40echo-areacallen: The reason behind your recommendation is?
05:43noncomis there no condp in cljs?
05:51supersymola
06:16clgvecho-area: just start developing your web app and defer adding authorization/authentication until you really need it
06:22ZamarokWhat's the best Clojure book? For someone who's been programming a few years, functional programming maybe one year
06:22echo-areaclgv: Let things grow spontaneously is the normal way.
06:22echo-area*Letting
06:22callenZamarok: Clojure Programming, Chas Emerick's book.
06:22echo-areaZamarok: Yes, that one.
06:22ZamarokOk. Is the Clojure Cookbook any good?
06:22clgvecho-area: well you can plan ahead a bit by grouping together the potential routes that may need authorization
06:23echo-areaclgv: I don't know if authorization is needed, I don't do web development now :)
06:23callenZamarok: Clojure Cookbook just got started getting written...
06:24Zamarokoh, saw it referenced somewhere.. love the Python one
06:26Pupnik3rd on clojure programming, it's the only programming book ive ever read, but I liked it
06:27ddellacostaZamarok: I would check that one (Clojure Programming) out as well as Joy of Clojure, but I think Clojure Programming is a bit more accessible at first. I like them both. There are others too, like Programming Clojure by Stuart Halloway et al.
06:27ddellacosta…which I've only skimmed, but seemed solid enough.
06:28ZamarokClojure Programming must be damn good then..
06:28ZamarokI have the Stuart Holloway one, it's decent
06:28maleghastZamarok: FWIW I learned Clojure from Stuart Halloway's book published by Pragmatic; I found it to be an excellent book, and I still refer to it form time to time.
06:29xecycleHi. Can I ask CLR here?
06:29echo-areaxecycle: Maybe you could just ask
06:29maleghastZamarok: I would also recommend the O'Reilly video(s) that Stuart Halloway did recently, "Clojure Inside OUt"
06:29vijaykiran~anyone
06:29clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
06:30Zamarokmaleghast: ooh, I like videos.. can code and learn at the same time
06:30xecycleOkay. Why does the binary distribution for .NET 3.5 failed to launch on my Windows 7? I have .NET 4.0 installed on it, but I assume a proper backwards compatibility here.
06:30Zamarokmaleghast: did you do the 'lancet' project in Holloway's book?
06:31xecycleThe one for 4.0 runs fine.
06:31maleghastZamarok: Also, try to get to a Clojure event near you if you possibly can - learning in person from other programmers is the best. The London Clojure Dojo really helped me - I wish I could still attend more often, but babies happened… I'm not complaining; my kids are awesome, but...
06:31Zamarokxecycle: if someone here can't help you, try asking in a C# channel
06:31xecycleZamarok: :/ Thank you but how can C# be relevant...?
06:31maleghastZamarok: yes I did work through that project
06:31maleghastZamarok: Long time ago now though...
06:32Zamarokxecycle: well, those guys deal with .NET more than most other types of programmers, and they're usually helpful over there
06:32ddellacostaxecycle: seems like it's more relevant than closure, if we are just talking about .NET generically
06:32maleghastxecycle: Ask away, the worse you're gonna get is "huh?"
06:32ddellacostajinx
06:32Zamarok>_<
06:32ddellacostaclosure -> clojure *#$!spellcheck
06:32xecycleOkay. Anyway I am talking about ClojureCLR.
06:32ddellacosta;-)
06:32Zamarokmaleghast: just wondering if the project is worth doing along with the book.. would you say?
06:33maleghastZamarok: IMHO it's better to find something that you want to do and do that as a "learning by doing" project, but I still did the follow-along project in the book, so whadda I know? ;-)
06:34ZamarokJust did the first ten Project Euler problems to start.. looking for more programmer-y, less math-y stuff to practice on
06:34maleghastZamarok: *nods*
06:35clgvZamarok: try 4clojure
06:35maleghastZamarok: Have you considered building a Roman Numeral Calculator? *snigger*
06:36hyPiRionRoman Numeral Calculator?
06:36Zamarokclgv: oh, this site will keep me busy for a while O_O
06:36hyPiRionOh right.
06:36Zamarokmaleghast: that was an /r/dailyprogrammer project a few months back
06:37hyPiRion,(require '[clojure.pprint :refer [cl-format]])
06:37clojurebotnil
06:37hyPiRion,(for [n (range 1 11)] (cl-format nil "~@R" n))
06:38clojurebot("I" "II" "III" "IV" "V" ...)
06:38maleghastZamarok: Fair enough - I was trying to see if Bruce was lurking in here today
06:41Zamarokmaybe I'll clone clojurebot ... such an awesome tool
07:08noncomin ClojureScript I cant use update-in to descend JavaScript objects?
07:08noncomis it recommended to use the dot-notation and set! ???
07:08lazybotnoncom: Yes, 100% for sure.
07:09noncomlazybot: heeey
07:09hyPiRionnoncom: it's a bot. It automatically responds to two and three question marks at the end of a message
07:09hyPiRionwhat??
07:09lazybothyPiRion: What are you, crazy? Of course not!
07:10noncomyeah i know :D just testing the AI
07:10hyPiRionheh
07:10noncomwow
07:10hyPiRion~the door
07:10clojurebotthe door will show you what jars (including the clojure jar) leiningen is using
07:10callenit's not AI
07:10noncomi thought lisps and AI go hand in hand
07:10noncomjoke :)
07:11noncomheh the door seems to be a secret
07:11noncom,(println "wow")
07:11clojurebotwow\n
07:11noncom,(print "wow")
07:11clojurebotwow
07:11noncom,(print "hyPiRion: check")
07:11clojurebothyPiRion: check
07:13noncom,(ns test)
07:13clojurebotnil
07:13noncom,*ns*
07:13clojurebot#<Namespace sandbox>
07:13noncomeh
07:13noncom,(do (ns test) *ns*)
07:13clojurebot#<Namespace test>
07:14noncom,js/console
07:14clojurebot#<CompilerException java.lang.RuntimeException: No such namespace: js, compiling:(NO_SOURCE_PATH:0:0)>
07:14noncomin ClojureScript I cant use update-in to descend JavaScript objects? is it recommended to use the dot-notation and set! ???
07:14lazybotnoncom: How could that be wrong?
07:14noncomdoh
07:15noncom*out*
07:15noncom,*out*
07:15clojurebot#<StringWriter >
07:15noncom,*in*
07:15clojurebot#<LineNumberingPushbackReader clojure.lang.LineNumberingPushbackReader@1ebf6ed>
07:17supersymsomeone who knows a bit more about def-memo, its hardly mentioned and I'm updating/learning from this forked project
07:17supersymhttps://github.com/clojens/slice/blob/master/src/slice/core.clj#L211
07:18supersymdefn-memo it is,... has a null pointer exception that I just can't seem to figure out
07:18supersymprobably in the head (since all the code before that just properly compiles to a function, but after head it gets the null ptr
07:21noncom,(.write *out* "check" 0 5)
07:21clojurebotcheck
07:23noncom,(ns-map)
07:23clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$ns-map>
07:23hyPiRion,(.write *out* "\000 hey what")
07:23noncom,(ns-map *ns*)
07:23clojurebot{sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, cond->> #'clojure.core/cond->>, keyword? #'clojure.core/keyword?, ...}
07:24romain_1pHi everyone, could someone help me with an xml-zip parsing problem ?
07:24romain_1pThis http://pastebin.com/9UD6rthh always result in an empty sequence
07:25noncom,(map println (range 0 2))
07:25clojurebot(0\n1\nnil nil)
07:26romain_1p(and yes, my document has a "en-export" root :) )
07:26jtoyhow should I go about finfing an error if the only stacktrace i get is: NullPointerException clojure.lang.Numbers.ops (Numbers.java:942)
07:26hyPiRionnoncom: you know, /msg clojurebot also gives you back results from evaluating clojure code
07:27noncomhyPiRion: you mean, personally, so other don't see?
07:27hyPiRionyeah
07:27hyPiRionjtoy: You can do (pst) and get the complete stack trace usually
07:27noncomor many thanx, i did not know... i think its an irc feature, but i do not know irc
07:28hyPiRionjtoy: If that's not working, I tend to throw prns around everywhere.
07:32supersymnvm got it
07:44jtoyhyPiRion: i didnt know about pst,thanks
07:45hyPiRionnp
07:47jtoydoes try not catch "NullPointerException clojure.lang.Numbers.ops (Numbers.java:942)" ? I have atry/catch on the line it references
07:48gfredericksjtoy: it looks like (try (/ 3 0) (catch Exception e ...))?
07:51jtoygfredericks: this is the line it dies on:
07:51jtoy(fn[x] (== 0 (try (predictor model (x :data)) (catch Exception e (do (println x) (println e) nil)))))
07:51hyPiRionjtoy: When you catch the exception, you return null/nil.
07:52hyPiRionIs that what you'd like?
07:52jtoyhyPiRion: yes, the error is happening inside there though
07:52hyPiRionuh
07:52hyPiRion,(== 0 nil)
07:52clojurebot#<NullPointerException java.lang.NullPointerException>
07:52hyPiRion,(= 0 nil)
07:52clojurebotfalse
07:52hyPiRionReturn 1 instead or something
07:53jtoyI mean I can return anything and i will still get that errore, i will tes tit now
07:55jtoyyes, I sitll get the same error, the error is happenning inside the try block
07:57jtoyi see something weird though, still testing
07:59jtoyhmm, im not sure why, i cant compare 1 == nil, but 1 = nil works
07:59jtoywtf
08:00jtoyhyPiRion: yes, i didnt understand what you were saying earlier, is that expected behavior?
08:02hyPiRionjtoy: yeah
08:02hyPiRion,(doc ==)
08:02clojurebot"([x] [x y] [x y & more]); Returns non-nil if nums all have the equivalent value (type-independent), otherwise false"
08:02hyPiRionnums mean in this case any number
08:03hyPiRion,(doc =)
08:03clojurebot"([x] [x y] [x y & more]); Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner. Clojure's immutable data structures define equals() (and thus =) as a value, not an identity, comparison."
08:04jtoythx
08:04jtoysometimes i really hate programming :)
08:05hyPiRionjtoy: yeah, sometimes it's really horrible. That single character destroying all your hopes and dreams =/
08:28jtoythis looks fun to debug; OutOfMemoryError Java heap space [trace missing]
08:28jtoythis machine has tons of memory also, wtf
08:28clgvjtoy: heap space? buy some more 4GB ram sticks ;)
08:29clgvjtoy: do you process large data in a lazy way?
08:29Blktjtoy: how do you start your JVM? -Xmx?
08:29jtoyI just startjvm with lein clojure
08:30jtoyI am processing some data in memory, but is only ~10k rows of data from sqlite3
08:30Zamarokjtoy: :javac-options ["-Xlint:unchecked"
08:30Blktmmm, I suppose it gives the standard maximum heap size
08:30Zamarokadd that to project.clj
08:30Zamarokoh wait, wrong option
08:30Zamarokthe option is "-Xmx4096m"
08:31Blktstill, you may be loading too much stuff eagerly
08:31Blktyou can probably flip a few functions to flush elaborated data earlier in your loop
08:31clgvjtoy: do you have the sql result in map-form in your program?
08:33jtoyclgv I am using sql korma, i think it is in map form, here i the funciton that reads from sql: https://www.refheap.com/15983
08:35jtoyZamarok: Ihave the same options when I added: :javac-options ["-Xmx4096m"]
08:36jtoyi think its jvm-options though
08:36clgvjtoy: you could request less line say 100 to measure memory consuption (profiler ...) and calculate if the 10k lines should fit into your ram. if not you will have to split up the result data in chunks you can handle
08:36Zamarokhttps://github.com/antoniogarrote/lein-javac/blob/master/README#L25
08:36ZamarokDefinitely :javac-options
08:37clgvdefinitely not! https://github.com/technomancy/leiningen/blob/stable/sample.project.clj#L295
08:37jtoyZamarok: :jvm-opts change fixed it
08:37ZamarokOh, does :javac-options only apply to actual Java code?
08:38jtoythat sucks i need to deal with memory issues like this, why doesnt it just "autoscale" in use
08:38hyPiRionjtoy: :jvm-opts ^:replace [] should fix that too
08:38hyPiRionThe issue is that the jvm optimizations lein shut off for some strange reason removes stack traces after some time
08:38clgvZamarok: you linked to a former plugin. java compilation is built into leiningen since a while. :javac-options are for the java compiler
08:39hyPiRionyeah, javac is for javac, jvm is the java virtual machine options
08:40Zamarokah I see.. my use case was actual java code
09:01clgvZamarok: but your use case must have been compilation, not running java code ;)
09:04jtoyis there a simple way to do something like: ({:car "test"} "car" :car 11) I have data that comes into a function that somtimes uses strings or keywords as the key for maps
09:05jtoyor how can i write code that grabs the value whether it is as tring or keyword?
09:17aroemersjtoy: clojure.walk/keywordize-keys may be of help? Depends on how large the data is.
09:20Zamarokwhat happened to clojure.contrib.repl-utils/show ?
09:21aroemers,(let [data {:foo 'bar}] (or (data :foo) (data "foo") 'baz))
09:21clojurebotbar
09:21aroemersjtoy: ^
09:22clgvZamarok: it vanished
09:27jweissamalloy_: hiredman: thanks for the hint about that xml parser loading behavior yesterday. i turned on some debugging and it seems like both "behaviors" are using the same class of TransformerFactory: org.apache.xalan.processor.TransformerFactoryImpl https://www.refheap.com/15985
09:40noncomhow do i get a JavaScript array element in ClojureScript? if I excersize (type) on the array, it says "function Array() { [native code] } "
09:41noncomhow do I get inside this one?
09:44jcromartienoncom: how about nth
09:45jcromartiejust a guess
09:47noncomjcromartie: ok, it worked, but there is another trouble now :(
09:48jcromartienoncom?
09:48noncomjcomartie: i got my array with (clj->js [[0 1] [2 3]]) and now that I get what should be [0 1], using (nth % 0), that type is now Object... no access inside.... same if I do plain array [0 1 2 3], (nth % 0) typeis Object
09:49noncomwhy is that...
09:49jcromartiehmm, let me fire up my cljs
09:51jcromartienoncom: it works fine for me
09:51noncomhmmmm
09:51jcromartie(-> [[1 2] 3] clj->js (nth 0))
09:51jcromartie#<Array [1, 2]>
09:52jtoyaroemers: thanks
09:53noncomso where have i missed...
09:55noncomjcromartie: i have "function Number() { [native code] } ", "function Object() { [native code] } " and "function Array() { [native code] } " all over the place..l don't you know how could that happen? looks like i did not do anything special to get that.. maybe you have some idea?
09:55jcromartiewell let's see your actual code
09:56jcromartiecan you paste it (Gist or refheap)
09:56jcromartienoncom: also, if you're not already using a REPL I'd highly recommend it
09:56jcromartiejust to be able to bang out this sort of thing
09:57noncomjcromarite: i'll try to factor a reafhep case now.. wait..
10:02cmajor7"https://github.com/flatland/https://github.com/flatland/clojure-protobuf&quot;: is there a reason why "flatland.protobuf.PersistentProtocolBufferMap$Def" is not serializable?
10:03cmajor7(https://github.com/flatland/clojure-protobuf/blob/develop/src/flatland/protobuf/PersistentProtocolBufferMap.java#L60)
10:06noncomjcromartie: here: https://www.refheap.com/15986 it'snot a perfectcase though..
10:08jcromartienoncom: so where is your issue coming up
10:09jcromartienoncom: is it mk-line?
10:09noncomjcromartie: i have updated the snippet, check it out. tehre is the ; <<< comment
10:09clojurebotYou don't have to tell me twice.
10:10noncomjcromartie: basically i just try to update the coordinates of the line, which are stored in the array "points" of the object "attrs" of the object of type Kinetic.Line.
10:10noncomall these are plain javascript..
10:10noncomat least should be
10:13jcromartienoncom: what is attr??
10:13lazybotjcromartie: What are you, crazy? Of course not!
10:13jcromartiethe bots are being awfully snarky today
10:14noncomjcromartie: attrs is a JSON
10:14noncomjcromartie: it simply stores the properties of a KineticJS object
10:15jcromartienoncom: I just don't know what "attr??" is
10:15jcromartie(attr?? ti-cursor :cursor-position)
10:15noncomjcromartie: (defn attr?? [elem k] (.getAttr elem (name k))) ; same as (k (.-attr elem))
10:16jcromartiealrighty then
10:16jcromartieI figured but I'm not sure why you'd call it that
10:16noncomjcromartie: here is the spec: http://kineticjs.com/docs/Kinetic.Node.html
10:16noncomjcromartie: simply a wrapper for handling the JSON which stores the props
10:17noncomjcromartie: i try to use the Kinetic idiomaticy..
10:17noncomjcromartie: sorry if it all is a little cumbersome..
10:17jcromartieI'm still not sure where the actual problem is
10:17noncomwould you recommend something?
10:17jcromartiecur-y-1 (type (attr?? ti-cursor :cursor-position)) ; <<< function Number() { [native code] } WTF
10:18noncomehh.. me too.
10:18jcromartiethat's fine
10:18noncomwell,i guess,i'll try to check everything again..
10:18jcromartieit's a number
10:18noncombut why function Number() { [native code] }
10:18noncomimmutability?
10:18jcromartieno
10:19jcromartiejust try (type 1)
10:19jcromartieit's the prototype of the object
10:19noncomin javascript "typeof 5" would be"number" or not?
10:20jcromartieyes but Clojurescript's "type" is not Javascript's "typeof"
10:20jcromartie"type" returns the constructor of the object
10:20jcromartieyou can do it in a JS console: (42).constructor
10:21jcromartiereturns "function Number() { [native code] }"
10:21noncomwell, anyway, in case of [ [] [] ] the code (nth external (nth internal 0) 0) returns error because (type (nth external 0)) is function Array() { [native code] } and not #<Array >..
10:22noncomi'm lost.. i guess you're wasting time, and i just have to do a refactoring iof my code and more study on the language
10:22jcromartiethat is a JavaScript array
10:22jcromartieit's fine
10:23jcromartieBTW use aget to get at JavaScript objects
10:23noncomi'll try aget
10:24jcromartielike, (aget some-obj "attribute-name")
10:24jcromartieor (aget js-array 0)
10:25jcromartieanyway, good luck
10:26jcromartieI'm a CLJS noob myself… lots to learn
10:27atyzHey guys, my team is about to start a new project, I'm trying to convince them to do it in clojure (which they aren't particularly against as we just built a small webservice) but it seems like they're leaning more towards ruby. Their reasoning for this is that they think it will be more familiar in the case of hiring people. They also feel like the ruby tooling is better. I've already said that the clojure tooling is pretty good. Are there any a
10:27atyzand you can deploy compiled code
10:27atyzand that there is the whole java ecosystem to pull from
10:27noncomjcromartie: thanks! :)
10:28jcromartieatyz: your first message was cut off at "Are there any"
10:28atyz Are there any arguments for clojure over ruby, other than that its the jvm, and you can deploy compiled code and that there is the whole java ecosystem to pull from
10:28atyzthanks jcromartie
10:29vijaykiranatyz: is your team familiar with Java ?
10:29jcromartieI think that in terms of hiring, yeah, Rails is going to be easier
10:29atyzvijaykiran: they have used java, I'm the only member with significant ruby experience
10:29jcromartiewow, today is the day: when you choose Rails because it is easier to hire for
10:29maleghastatyz: Immutable State makes for more reliable predictable testing and code, and smaller codebase(s) - that's a plus
10:29atyzjchauncey: we would definitely not choose rails
10:29jcromartieatyz: what kind of project?
10:30atyzjcromartie: it's probably going to be a backend with a frontend in angular
10:30atyzso all interaction would be through apis
10:30jcromartiewell since Angular has no opinion on backend APIs, I'd say you could easily go with Clojure
10:30jcromartiebut again it depends on what the system does
10:30atyzjcromartie: i know, the trick is convincing them to go with clojure over ruby
10:31cmajor7atyz: why do _you_ think clojure is a better fit over ruby?
10:31jcromartiewhat kind of data model?
10:31maleghastatyz: What jcromartie said, though you could argue for Pedestal and have a single language front and back (isn)
10:31jcromartiehonestly ActiveRecord is a huge time saver if you have anything like a normal CRUD app with nested models
10:31atyzcmajor7: I personally feel that all the ruby tools are a little bloated - I like the simplicity that comes with clojure
10:32cmajor7atyz: ok, so here is your first point for clojure
10:32maleghastActiveRecord is a lame dog in terms of performance, though… Productivity win, but final result is poor.
10:32jcromartieyes
10:32atyzI've mentioned that, but they feel that our lack of experience with the language (I have the most and I'm sitting at about 3 months)
10:32atyzwould hinder us more in a functional language than an imperative one
10:32jcromartieatyz: experience with Clojure or Ruby?
10:33atyzI have 4.5 years of ruby and 3 months or clojure
10:33jcromartiesure it's easier to hack out a solution in Ruby
10:33jcromartieif you don't know Clojure
10:33cmajor7ruby as a language is also quite simple, but I agree tooling and a heavy weight Rails and inflexible ActiveRecord hide most of the Ruby simplicity, whereas in Clojure it is not the case => language primitives come first..
10:33jcromartieatyz: so what kind of data model? what kind of app?
10:33atyzThe rest of the team doesn't have much ruby experience either
10:34cmajor7Clojure culture (over Ruby) is "libraries vs. frameworks" which comes from functionality (things are composable)
10:34maleghastThe classic case-study is U-Switch, right..? They ported to Clojure with sub 6 month hobbyist Clojurians and had massive wins in productivity, code clarity, low line count and maintainability, not to mentions stability and quality.
10:34atyzjcromartie: its mostly going to be leveraging apis from other content providers and putting a mapping over the data we receive from them
10:34jcromartieatyz: sounds like Clojure would be quite pleasant for that
10:34atyz(content providers as in things like salesforce content)
10:34maleghastatyz: If that's the case then Clojure all the way
10:34atyzmaleghast, jcromartie why over ruby?
10:35jcromartieyou can do everything from a single Clojure process
10:36atyzjcromartie: I'm not entirely sure what you mean by that
10:36jcromartieClojure's concurrency will make it a snap to go out and fetch a bunch of data and map over it and turn it into a canonical representation and then provide further functions on that
10:36jcromartieI've done this sort of thing :)
10:36cmajor7atyz: can you just write a simple prototype for a single content type in Clojure and discuss with the team? this would be the best, since you would know "what it takes" for this problem in Clojure, at the same time I don't foresee more than 100 lines of code to show to the team
10:36jcromartiean RSS/Atom feed aggregator in both Clojure and in Rails
10:36jcromartiebut you said not Rails
10:37jcromartieand if not Rails, then I don't really imagine why you'd got with Ruby for it
10:37atyzcmajor7: i did that with the last webservice, thats why it's done in clojure :)
10:37cmajor7atyz: so what are their reservations?
10:37atyzjcromartie: ruby has lots of other tooling which is also honestly quite great
10:37cmajor7besides hiring, which is a valid one
10:37jcromartieatyz: do you mean gems?
10:37atyzjcromartie: yes
10:38jcromartieatyz: how much data are you talking about BTW?
10:38atyzso grape - for writing apis
10:38atyzjcromartie: potentially quite a lot
10:38maleghastatyz: Really? Re Grape I mean..?
10:38jcromartieatyz: if you're storing everything forever and you need a database, then the Ruby solution would push concurrency and state to the DB
10:39maleghastClojure + Compojure will give you a lot more power and more importantly performance than ruby + grape
10:39atyzmaleghast: i basically meant that - there are well written librarys for anything you could want to do in ruby
10:39maleghastThere are in Clojure
10:39jcromartieClojure + Java
10:39atyzmaleghast: yes, but the issue is that nobody is familiar with it
10:39maleghasthttp://www.clojure-toolbox.com/
10:39jcromartielibs(Clojure + Java) > libs(Ruby)
10:39maleghastalso true
10:40jcromartiebut Clojure doesn't have any libraries like "trollop" or "tranny" or "girlfriend"
10:40maleghast(though I love the fact that other, better engineers have already wrapped up a lot of powerful Java libraries in Clojure so that I don;t have to do Interop)
10:40maleghastI use Ruby for my job and I don't know what they are, jcromartie
10:40atyzmaleghast: i have explained to them that they can leverage the java ecosystem
10:40atyzand thats rather attractive
10:41maleghastIt should be
10:42maleghastIf you're building a RESTful API, Clojure, using Liberator and Compojure will more than get the job done, it will be fast, flexible and easy to test.
10:43atyzmaleghast: our last webservice was exactly that, and we have all enjoyed working on it, but i think the fear of unfamiliarity with conventions is the primary motivator for this insecurity
10:43atyzwell conventions and the tools
10:44maleghastWell, all I can offer is that I banged on about Clojure until people finally gave in - I am building our first bit of Production Clojure at the moment, and it's built on Compjure and HTTP-Kit
10:44maleghastJust grind 'em down until all they want to do is say "yes" so you'll stop talking about Clojure ;-)
10:45atyzmaleghast: I basically did the same thing and just built our last webservice - but the next service we're building is a lot bigger and i think they're nervous about doing it in a functional language that they don't know a lot about and there aren't as many resources available
10:46maleghastatyz: Just tell them:
10:46maleghast"“I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has gone past I will turn the inner eye to see its path. Where the fear has gone there will be nothing. Only I will remain.”"
10:46noncom+1
10:46atyzHah
10:47zerokarmaleftmight as well use the Voice to compel them if you already have the prerequisite Bene Gesserit training
10:47maleghastIf things weren't hard and / or scary sometimes they wouldn't be worth doing, but in general I have heard no horror stories about failed projects in Clojure - all I have heard is "we worried it would be hard, but we did it anyway and now we use Clojure for everything"
10:48maleghastatyz: Good Luck!
10:48maleghastzerokarmaleft: The wyrding way is beyond my level of skill, I am sorry to say.
10:48atyzthanks maleghast, jcromartie, cmajor7
10:48atyzMy motivation is that I'm really bored of ruby and I like clojure and feel it would be a good fit
10:49jcromartie"I have heard no horror stories about failed projects in Clojure"
10:49maleghastatyz: I think you are right about the fit, so cling to that and your enthusiasm and evangelise...
10:49jcromartiemaleghast: I had a "failed" project in Clojure
10:50maleghastjcromartie: Well I haven't - if you want to tell me some then I'l be able to offer a more balanced outlook, but as of now I haven't heard any.
10:50jcromartiewell :)
10:50atyzwhat are somw big clojure projects though?
10:51jcromartiethe Clojure project was good, but I rewrote it in Rails because other people needed to work on it
10:51maleghastatyz: Deutsche Bank has some Production Clojure Code, there is U-Switch - that's all Clojure on the backend, handling the provider tariffs etc.
10:51jcromartieto be a team player
10:51jcromartieoh, and THEN I lost my job there…
10:51maleghastjcromartie: You are too nice
10:51jcromartieso much for thoughtfulness
10:51antares_atyz: https://groups.google.com/forum/#!topic/clojure/a4Dp8gdHev8
10:51antares_atyz: there are banks known to have over 2M lines of Clojure (and that's probably dated by a year)
10:51jcromartiethis one? http://www.uswitch.com/
10:52antares_but "I'm bored with Ruby" is not a good enough reason to choose Clojure
10:52atyzantares_: i agree, like i said earlier, I prefer the flexibility that comes with clojure,
10:53antares_on the other hand, "I hate Ruby because it's terrible at X and I primarily do X" is a different story
10:53antares_Ruby can be really flexible, in fact, too much so :D
10:53atyzmost ruby tools/frameworks all seem to be too full featured
10:53futileIs ClojureScript actually way awesome?
10:53jcromartiefutile: it could use better documentation
10:53antares_atyz: are you a Web developer?
10:54futileYes, that part of it terrifies me.
10:54futileBut is it so awesome in itself that it's worth such a hassle of having lacking documentation?
10:54jcromartiepeople say that Ruby is good at DSLs because the syntax is so flexible, but that's not really what's going on… they just mean they like method_missing and blocks
10:54atyzantares_ yes
10:54antares_atyz: if so, Clojure would work OK for you but don't expect wonders. I'd probably just use JavaScript or Play with Scala for Web apps
10:54jcromartiefutile: if you can read the sources instead of docs, then yes
10:54futilejcromartie: oh! good idea for a blog!
10:54antares_Clojure is excellent and data processing and APIs but not Web apps with templates
10:55jcromartie(inc antares_)
10:55lazybot⇒ 2
10:55jcromartiethat's exactly it
10:55atyzantares_: it would be a cllojjure api with an angular frontend
10:55jcromartieif you have a bog-standard web app with a login page and user profiles and pages with content and CRUD, then just go use Rails
10:55futileatyz: do not listen to antares_, Clojure is excellent for web apps, using compojure and hiccup and ring.
10:55antares_*and => at
10:55futile(dec antares_)
10:55lazybot⇒ 1
10:55atyzthe api would be pure data processing
10:56futileWe use Clojure + ring + compojure + hiccup at work, and the results are amazingly better than any other web framework I've ever used in any language.
10:56antares_atyz: ok, that's better
10:56antares_atyz: the reason, of course, is not technical but a social one
10:57antares_you will have a hell of a time convincing good frontend engineers to use Hiccup and stuff
10:57atyzour "frontend" devs are full stack
10:57antares_even though they may have strong interest in Clojure and FP, it's just too inconvenient for many
10:57antares_even so
10:57jcromartiefutile: where is "work"?
10:57jcromartiefutile: I'd love to believe you :)
10:57antares_but single page apps that only need an API and HTML can use anything
10:57atyzthey won't have trouble with hiccup/lazer/whatever
10:57maleghastfutile: Yes, where is your work and do you want more Clojurians...
10:57maleghast?
10:58jcromartiemaleghast: no! me first!
10:58futilemaleghast: we're not hiring right now
10:58maleghastfutile: Fair enough - I do get to do some Clojure where I am so really I'm just being greedy ;-)
10:59robewaldtechnomancy: Forked your nrepl-proposal on github and added some notes: https://github.com/robewald/nrepl-discover/blob/master/notes-bob.md
11:01noncomjcromartie: FYI: the problemwas with KineticJS. It transforms the passed object in a hidden way: http://stackoverflow.com/questions/13732758/kineticjs-how-to-get-points-from-a-line and http://stackoverflow.com/questions/15893697/cant-get-transformed-points-out-of-a-kinetic-js-line
11:01noncomjust in case you ever stumbleupon the case
11:02jcromartienoncom: mutable state strikes again
11:02noncomyeah :)
11:09manutteratyz: http://www.infoq.com/presentations/Clojure-powered-Startups
11:10noncomif I want to break my cljs file into several files - do i do this just the same way as in clj? I mean the :use and L:require things?
11:11jtoyis there debugging support? I want to inspect the elements of a hash at a certain point in my code im not sure exactly how to inspec the data
11:14edwHas anyone used Carmine to talk to a Redis server? It's getting connection errors for params that redis-cli takes happily.
11:18RogachQ: Is it possible to use clojure compiler programmatically, for example, from java code? I tried something along the lines of `clojure.lang.Compiler.load(new StringReader("(println 1)"));`, but that failed with NPE.
11:19hyPiRionfairly certain load attempts to read the file "(println 1)" with that incantation
11:21RogachhyPiRion: Woah. That's not good. Out of curiosity, why somebody would pass a file name parameter as a Reader?
11:21hyPiRionwait
11:22trptcolin,(* -9223372036854775808 -1)
11:22clojurebot-9223372036854775808
11:22trptcolin(+ -9223372036854775808 -1)
11:22trptcolin,(+ -9223372036854775808 -1)
11:22clojurebot#<ArithmeticException java.lang.ArithmeticException: integer overflow>
11:22trptcolindoes the multiplication seem like it ought to throw as well?
11:23hyPiRionRogach: I thought Compiler.load mapped to clojure.core/load, but that's not right.
11:24hyPiRion,(*' -9223372036854775808 -1)
11:24clojurebot-9223372036854775808
11:24hyPiRionwhah.
11:25trptcolinwhoa, it gets worse
11:25trptcolin,(* -1N -9223372036854775808N)
11:25clojurebot9223372036854775808N
11:25trptcolin,(* -9223372036854775808N -1N)
11:25clojurebot-9223372036854775808N
11:25RogachhyPiRion: Looking at the source of Compiler.java, it accepts a reader, and it seems that it should try to execute that as a code.
11:25hyPiRionRogach: yeah, I'm looking into it now
11:26RogachhyPiRion: But the NPE is thrown during Compiler static init, on line 47.
11:27hyPiRionRogach: do you have Clojure on the classpath?
11:27RogachhyPiRion: Sure.
11:27RogachhyPiRion: (when I don't, java executable complains about failing to find class file)
11:27hyPiRionYeah, you should've gotten some LinkingError or something if that weren't the case I suppose.
11:28hyPiRionRogach: could you inspect the stack trace of that NPE?
11:28RogachActually, I want to do two things: 1) I want to be able to interpret/run arbitrary string of clojure code at runtime, 2) I want to be able to compile some code to standard classfiles and execute them afterwards (so I will be able to amortize costs of compilation)
11:28RogachhyPiRion: I'll paste it.
11:29hyPiRionOk, great.
11:29RogachhyPiRion: http://pastie.org/8066786
11:29RogachhyPiRion: And here's the code: http://pastie.org/8066791
11:35RogachhyPiRion: Ah, seems it's a known issue (with a workaround): http://dev.clojure.org/jira/browse/CLJ-1172
11:35hyPiRionah
11:36hyPiRionOh well, good it has a workaround
11:37RogachhyPiRion: No, it's hilarious.
11:38RogachhyPiRion: I applied the workaround, it worked, but here's what gets printed to output: "No need to call RT.init() anymore"
11:38hyPiRionwhaat
11:38hyPiRionFrom the issue: Doing this: RT.load("clojure/core"); at the top works avoids the message from RT.init()
11:39RogachhyPiRion: No it doesn't :)
11:39RogachhyPiRion: I tried that already.
11:39hyPiRionoh dumm
11:39RogachhyPiRion: Same message gets printed. (I'm using 1.5.1)
11:40hyPiRionI'll update the ticket to at least include that information
11:41RogachhyPiRion: Thanks!
11:42RogachhyPiRion: Actually, it's already awesome that I can run arbitrary strings of clojure (modulo that warning).
11:42atyzSo I've just run into something where my tests are about to be run on a CI. However it seems to want a database connection on boot of lein test
11:43atyzis there anyway to prevent this?
11:43atyzit's a compojure / ring app
11:43hyPiRionRogach: what a strange thing though. If you want to avoid that warning, you can probably replace System.err and swap it back after calling RT.init();
11:43hyPiRion(Seems like hassle though)
11:43RogachhyPiRion: Yes, that will work, as a temp workaround.
11:44RogachhyPiRion: Is there some similarly simple method to compile some clojure file to classfiles?
11:45RogachhyPiRion: I want my app to use clojure files as some sort of "programmable configuration", so it would be nice if I could recompile those class files only when needed - it would shave ~1 sec on most runs.
11:45hyPiRionRogach: At runtime I suppose?
11:45RogachhyPiRion: Yes.
11:46RogachhyPiRion: Currently, I keep config as scala file, but compiling it is *very slow* - around 8 seconds on each run.
11:46RogachhyPiRion: I hope that clojure will compile faster.
11:47hyPiRionRogach: I think http://clojure.org/compilation should have sufficient information about this
11:47hyPiRionhave a look at Compiler.compile.
11:49RogachhyPiRion: Hm. It compiles a java class. But it is possible to compile a heap of clojure code into classfiles?
11:53hyPiRionHumm, it should in theory compile it down to a classfile, but I've not done runtime loading from java, soo..
11:54RogachhyPiRion: Runtime loading is not a problem ;)
11:55RogachhyPiRion: Compiler.compile takes three args - `superName`, `interfaceNames`, `oneTimeUse`. How do I specify which code I actually want compiled?
11:56hyPiRionYou're reading at the wrong compile: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L7162 <--
11:56hyPiRionRogach: well, Compiler.compile() should dump out a classfile in `*compile-path*`, which is by default "target/classes"
11:58ak5hey guys, I have been looking at clojure, thinking about learning lisp finally - and now there is lisp made for the web kinda. However, Java scares me, I dislike it and don't want to touch it if possible - how much Java do i need to know to start with clojure?
11:58hyPiRionSo e.g. if you attempt to compile a file through Compile.compile(reader, "source/name",
11:58hyPiRionoops.
11:59hyPiRionak5: You have to know how to run `java` to set up your server, and that should be it :)
11:59ak5hyPiRion: sounds good enough for me
11:59ak5thanks
11:59Rogachak5: What's so wrong with java per se?
11:59ak5what about standard libs? Which are the java essential libs that end up being used often in clojure?
12:00ak5Rogach: call it a personal preference?
12:00Rogachak5: "Personal preference" also has some reasons.
12:00hyPiRionak5: the string class has some functions, but they are very easy to invoke. Apart from that, I haven't had the need to use any Java yet.
12:01hyPiRionSo for instance, you would sometimes like to do ##(.indexOf "Hello world!" \w)
12:01lazybotjava.lang.IllegalArgumentException: No matching method found: indexOf for class java.lang.String
12:01ak5Rogach: I feel like it's sucking my soul out through my fingers when I type java
12:01ak5it's just a feeling
12:01hyPiRion(See, I don't know how to do that and I'm still fine)
12:01Rogachak5: Well, you mean the verbosity?
12:01ak5Rogach: yes
12:01Rogachak5: You can try scala ;)
12:02hyPiRion,(.indexOf "Hello world" "w") ; << ak5, that's probably the most java you have to understand for a web app.
12:02clojurebot6
12:03VFeak5: Clojure's ecosystem has matured a lot, unless you're specifically writing a wrapper or some library to interact with a java client, I haven't had to use actual java for anything at all.
12:03hyPiRion(the .indexOf is a java call)
12:03ak5VFe: thanks
12:03ak5hyPiRion: good :) thanks
12:04ak5Rogach: I haven't ever looked at scala, its like clojure in that in runs on the JVM, right? but it's not lisp-like?
12:04VFeI think not lisp-like is…a very under-stated way of putting it XD
12:04Rogachak5: Something like it.
12:04Rogachak5: It's very different, but still runs on jvm.
12:05ak5yeah, I see. It seems to be super object oriented
12:05Rogachak5: But I wouldn't compare it to clojure - both languages have their place.
12:05Rogachak5: Yes, that's true.
12:06noncom,(take "hello" 3)
12:06ak5well I just want to know WTF this deal with macros is, everyone says they're "the shit". I'm a javascript kinda guy, have been for a while. Think it's time to step up my game, you know? xD
12:06clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number>
12:06noncom,(take 3 "hello")
12:06clojurebot(\h \e \l)
12:06noncomhow do I make the result of (take 3 "hello") to be "hel" and not a list?
12:06RogachhyPiRion: I tried loading a string of clojure code with `ns` and `gen-class`, and then loading a string that called `compile`, but it seems that `compile` requires source file.
12:06ak5and since the web is my home, why not learn a dialect of lisp that does that well <-- is that a good enough reason to look into clojure?
12:07hyPiRionnoncom: subs
12:07noncomoh
12:07noncomthanks
12:07hyPiRion,(subs "hello" 3)
12:07clojurebot"lo"
12:07hyPiRion,(subs "hello" 0 3)
12:07clojurebot"hel"
12:07VFeak5: imho yes, that's one of primary reasons I got into clojure as well
12:08noncom,(str (subs "what is where" 4) (subs ("what is where" 5))
12:08clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
12:08noncom,(str (subs "what is where" 4) (subs ("what is where" 5)))
12:08clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn>
12:08noncom,(str (subs "what is where" 4) (subs "what is where" 5))
12:08clojurebot" is whereis where"
12:08noncom,(str (subs "what is where" 0 4) (subs "what is where" 5))
12:08clojurebot"whatis where"
12:09noncomnice
12:10ak5VFe: cool, whats a good place to get started? I just got leiningen cause I like the logo :P
12:11VFeak5 I'd start at luminusweb.net , it's a "framework"(more a collection of libs) thats incredibly beginner friendly
12:11hyPiRionAlso, to get familiar with clojure, check out 4clojure.
12:11VFeand the site guides you through a lot of the basics of creating a simple web app in clojure/clojurescript
12:12VFeand yeah, 4clojures a great place to just try problems to get familiar with lisp style programming
12:13ak5I like to get the syntax in project euler or something, but i'll check that last one out too
12:16VFeAnyone have thoughts on Mailer vs Postal?
12:17ohpauleezVFe: Depends on the goal you're looking to achieve, I dislike them both for different reasons, but have used both
12:18ohpauleezI haven't taken a look at them in a year or so though
12:18VFeI'm just looking at sending out validation and password reset kind of emails
12:23jtoywhat am I doign wrong with this reduce: (reduce (comp + :precision) [{:precision 0.3} {:precision 0.5} ])
12:24ohpauleezVFe: I would use Mailer - the metadata abuse in Postal always seemed to be annoying
12:24ohpauleezjtoy: reduce fns take two args, the accumulator and the new value
12:25ohpauleezyou probably want something like (fn [accum newv] (+ accum (:precision newv)))
12:25hyPiRionohpauleez: or even better, (reduce + (map :precision [...]))
12:25VFeThanks, appreciate the input before I bothered learning one or the other =0
12:26ohpauleezhyPiRion: yes, that's even better
12:26ohpauleezand change the reduce to apply there, to get a call-site cache hit
12:26jtoyhyPiRion: why doesnt your version take seperatevalues?
12:26hyPiRionjtoy: what do you mean?
12:26hyPiRion,(reduce + (map :precision [{:precision 0.3} {:precision 0.5}]))
12:26clojurebot0.8
12:27jtoyhyPiRion: yours doesnt have accum and newv, just + as the function
12:27hyPiRion,(map :precision [{:precision 0.3} {:precision 0.5}])
12:27clojurebot(0.3 0.5)
12:27ohpauleezbecause + takes as many args as you pass it
12:27hyPiRionoh right
12:27hyPiRionthat's what you meant, sorry
12:28ohpauleezin your example before, your accumulator doesn't have the key, :precision, so the comp fails
12:28ohpauleezjtoy: So the solution is to get a seq of all your values (with map), and then sum them up
12:29jtoyohpauleez: im not 100% clear on waht that means, but i can follow that
12:29ohpauleezjtoy: Play with `reductions` a little to see how reduce is working
12:30dnolen_a simple reason why your version doesn't work
12:30dnolen_((comp + :precision) {:precision 0.3} {:precision 0.5})
12:30dnolen_this makes no sense
12:31dnolen_but that's what you've written
12:32dnolen_,(:precision {:precision 0.3} {:precision 0.5})
12:32clojurebot0.3
12:32dnolen_,(+ 0.3)
12:32clojurebot0.3
12:32dnolen_,(reduce (comp + :precision) [{:precision 0.3} {:precision 0.5}])
12:32clojurebot0.3
12:34jtoythx
12:35jtoydnolen_: I thought the use case for comp was to add funtions together
12:37dnolen_jtoy: it does add two functions together
12:37dnolen_jtoy: but your composition does not make sense when used with reduce
12:38dnolen_jtoy: or rather, it doesn't work as you intend because of the examples I showed above
12:39dnolen_jtoy: hyPiRion's answer is the correct one, you want to first *extract* :precision via map, and then reduce the resulting seq of numbers with +
12:58jtoydnolen_: yup, im using that now, thanks guys
13:01mhoogeI'm new to Clojure. Is this the proper IRC channel to ask general questions, style, functionality, and the like?
13:02TimMcYep.
13:04hyPiRionlazybot: it's true, right???
13:04lazybothyPiRion: How could that be wrong?
13:05mhoogeSweet. So I've been spending some of my free time writing up some Clojure for our API. Is there a preference to :pre conditions or exceptions?
13:09aroemersmhooge: we use assert, which is another option, and you can turn them off.
13:10hyPiRionI think it kind of depends on the system. preconditions are nice when speed is not critical.
13:11hyPiRionHmm, I think The Joy of Clojure has a discussion on preconditions, but I don't remember exactly what they concluded with.
13:12llasramThere's also the pretty common idiom of just GIGO. Instead of throwing an explicit exception for invalid input, just return undefined results or `nil`
13:12technomancymhooge: preconditions are for "if this ever happens, it's a bug". for the kind of problems that are unavoidable in the real world (out of disk space, network goes down, input got garbled, etc) you should use exceptions
13:15mhoogethank you for all the response. In our case, invalid input would just result in the server kicking back an error response. So the asserts would just help developers debug.
13:20dnolen_cemerick: fwiw, I don't really understand what you're saying in the ticket 527 at all :)
14:29aphyr ,(* -1 Long/MIN_VALUE)
14:29clojurebot#<ArithmeticException java.lang.ArithmeticException: integer overflow>
14:29aphyr,(* Long/MIN_VALUE -1)
14:29clojurebot-9223372036854775808
14:33aphyrwhat you know about multiplication?
14:34llasramWell, we can infer from this example that it is not commutative
14:34mmitchellAnyone have tips on deploying a jar file to s3? This is not a clojure project, but a java project. It has an ant build file, no pom.
14:37amalloy&(*' Long/MIN_VALUE -1)
14:37lazybot⇒ -9223372036854775808
14:37justin_smithmmitchell: lein ring uberwar will create the thing beanstalk would use
14:37justin_smith(or tomcat on ec2)
14:38llasram&(*' (inc Long/MIN_VALUE) -1)
14:38lazybot⇒ 9223372036854775807
14:38llasramCool!
14:38tomjackmmitchell: there is s3-wagon-private
14:39tomjackoh, nevermind
14:39mmitchelljustin_smith: oh this is just a regular java lib that i'd like my clojure project to use from s3
14:39technomancymmitchell: you can deploy it to a directory on disk and then use s3cmd to upload that directory
14:39mmitchellinteresting, maybe that's the simplest approach
14:39justin_smithmmitchell: ahh, in that situation I would push it to clojars
14:40amalloyaphyr: that's funny. c.l.Numbers/multiply does: "multiply the two numbers; if dividing the result by y doesn't give you back x, then throw an exception"
14:40amalloyin the case of (* Long/MIN_VALUE -1), the overflow-check itself suffers the same overflow, and no exception is thrown
14:42Bronsa,[(== 4.0 4) (== 4.0 4.0M) (== 4 4.0M)]
14:42clojurebot[true true false]
14:44tomjackI guess even haskell has trouble with floats :(
14:45Bronsathe fix is really simple https://github.com/Bronsa/clojure/commit/f0082056c2470420fd16067b23bd7b210305d509
14:48tomjackI see, that seems pretty nuts
14:50tomjackwhy (== 4.0 4.000M) now?
14:51tomjackwell that makes sense maybe, but also (== 4.000M 4.0)?
14:52tomjackoh, yeah
14:52tomjack&(== 4.0000000000000000000001M 4.0000000000000000000001M 4.0)
14:52lazybot⇒ true
14:54moquist_seancorfield: do you mind a PM to talk about clojure.java.jdbc.ddl ?
14:54aphyramalloy: jesus
14:56TimMc&(* Long/MIN_VALUE -0.99999999)
14:56lazybot⇒ 9.223371944621055E18
14:58seancorfieldmoquist: fire away!
14:59TimMc&(= (*' -1 Long/MIN_VALUE) (*' Long/MIN_VALUE -1))
14:59lazybot⇒ false
14:59Bronsafeels good to have a locally patched clojure where everything is working fine
15:02trptcolinaphyr / amalloy / TimMc: patch attached to http://dev.clojure.org/jira/browse/CLJ-1222
15:07aphyrtrptcolin: http://aphyr.com/media/dancing.gif
15:08hyPiRionI very frequently multiply Long/MIN_VALUE with -1, so it is good that this is fixed
15:09trptcolinhehe
15:11trptcolinit's funny, there are actually bunches of generative tests for math, including commutative multiplication. alas, 2^64 is a big space to hope we get all the cases
15:11trptcolinsurely there's some smart way generative tests could be made to seek out edgy cases (MAX_VALUE, 0, 1, MIN_VALUE, ...)
15:11trptcolin[not with full generality of course, i get that]
15:13stuartsierradnolen: ping
15:13dnolen_stuartsierra: what's up?
15:14stuartsierradnolen_: Working on ClojureScript release. Can you test something for me?
15:14dnolen_stuartsierra: sure
15:14stuartsierradnolen_: OK. Add a :repository for "https://oss.sonatype.org/content/repositories/orgclojure-1017/&quot;
15:14stuartsierraThen try a dependency [org.clojure/clojurescript "0.0-1834"]
15:14stuartsierraAnd see if everything works.
15:15TimMctrptcolin: Generative tests usually *do* focus on the edge cases.
15:15dnolen_stuartsierra: like in an empty project?
15:16stuartsierradnolen_: Any Lein project will do.
15:16trptcolinTimMc: oh. cool, maybe it's just underusing what's available then
15:16stuartsierradnolen_: Preferably something that uses ClojureScript somewhere. :)
15:17amalloytrptcolin: 2^128, really, since you need to find pairs of numbers
15:17trptcolinah, good point.
15:17amalloybut i think it would be better to talk to a mathematician
15:17trptcolini was considering being sly and citing the birthday paradox, but that is totally irrelevant.
15:17dnolen_stuartsierra: how do I add that repository?
15:18dnolen_:repository [...] doesn't work
15:18dnolen_in my project.clj
15:18stuartsierraSorry, meant :repositories {"clojurescript" "that URL"}
15:18stuartsierra(This is a temporary staging repository.)
15:20dnolen_stuartsierra: thx testing now
15:20dnolen_stuartsierra: seems to work
15:21stuartsierradnolen_: Great, thanks. I'll commit these changes and get a real release out this afternoon.
15:21dnolen_stuartsierra: thx!
15:22stuartsierradnolen_: Hopefully this will make it *actually* automated instead of sort-of-automated.
15:24dnolen_stuartsierra: excellent
15:35stuartsierradnolen_: ClojureScript 0.0-1835 released to Sonatype.
15:35stuartsierraUNTOUCHED BY HUMAN HANDS!
15:35dnolen_stuartsierra: thank you!
15:35dnolen_rkneufeld: ^
15:36dnolen_rkneufeld: the namespace aliased keyword patch is in there
15:42bbloomdnolen_: I love git. I wanted to know what that patch was about, so I did `git show :/alias` and poof the most recent relevant commit came up :-)
15:43bbloomdnolen_: did we break this when we made the related fix? or was this already broken?
15:44dnolen_bbloom: was always broken
15:44bbloomdnolen_: k
15:44bbloomanything having to do w/ the reader is pretty tricky to get right
15:44dnolen_bbloom: someone had committed a half fix at one point which I applied
15:44dnolen_bbloom: removed what they did and did the correct thing, it was simple in the end
15:45bbloomcool
15:45dnolen_https://github.com/clojure/clojurescript/commit/4a04114aedbd1073c4a7c58cee122fcfd0ef1eb4
15:46dnolen_form-seq wasn't lazy enough, and there was pointless dynamic var, should have just used *cljs-ns*
15:46bbloomread
15:52futileand it's all thanks to callen
15:57futilenot really Clojure-specific, i know, but its something i really wish everybody knew
16:02futileThat sounds arrogant, doesn't it? But really that's the only reason people write blogs..
16:04bbloomfutile: personally, i write my blog primarily for myself. teaching is an excellent way to learn. polishing up the spelling, grammar, and formatting for consumption is basically because it's free publicity after i've paid the price of tuition
16:05hyPiRionfutile: nah, I agree with the statement somewhat, but I limit it to what I want to publish for others to see
16:05futilehyPiRion: which statement
16:06hyPiRionfutile: oh right, the statment you made in the post
16:06hyPiRionSo e.g. I find it justifiable to "hack 'till it works" in programming competitions for instance.
16:08hyPiRionAnd I may implement X on the side for fun, curiosity and/or to learn how to make a good X.
16:09futilehyPiRion: oh, yeah.
16:10futilehyPiRion: I'd agree.
16:10futilehyPiRion: hence that last paragraph about polishing up abandoned sw as good practice
16:11tomjackevery time I try to write a blog post it just makes me realize I still need to think more :)
16:12robewaldtechnomancy: thanks for your comments on my notes on github.
16:14mhoogeI've noticed that my preconditions with the :pre keyword don't always trigger an Assertion error, even though an actual (assert something) will. Is there something I'm missing? I've check that *assert* has not been set to false
16:15mhooge*checked
16:17avishaihi
16:18avishaican lein fetch pom dependencies? e.g. multi module dependency
16:25robewaldmhooge: do you have an example to look at?
16:25mhoogeSure, where would you like me to put it? Gist?
16:26robewaldAs long as I get a link it should be fine :)
16:28mhoogerobewald https://gist.github.com/mhooge/5834051
16:30futilebbloom: To further explain my point from the other day:
16:30futilehttps://gist.github.com/evanescence/5833954
16:32bbloomfutile: your first example uses 7 commas and your second example uses 6
16:32futilebbloom: think you're missing the point
16:33futileor maybe I just explained it wrong, but I think it's the former
16:33futileIt's not about the commas, it's about all of it, the commas are just one part.
16:33bbloomfutile: did you write both of those examples?
16:33futileyes
16:33futilewhy
16:34bbloomjust curious
16:34futilei used to write in the first style, now i write in the second style
16:34futilemainly because i wouldnt read the first one if someone else wrote it, but id read the second one
16:34bbloomyour first example includes several run-on sentences that can easily be broken up and it would be much clearer than the second paragraph
16:34futilebbloom: meh
16:35bbloomthey also contain different content, so it's not really a reasonable comparison
16:35futilebbloom: look I'm not saying my point is well made, just that it's right.
16:35futilebbloom: yea, it is.
16:35futilethe content is an integral part of the sentence.
16:35bbloomfutile: lol ok well, since you know you're right, i'll just leave you alone to be right then
16:35futileit's a perfect comparison, apples and oranges.
16:38robewaldmhooge: It works for me an breaks with a IllegalArgumentException. You don't catch that at another place, do you?
16:38futileha, i /knew/ i'd win if only i said enough nonsense bbloom
16:38futile:D
16:39bbloomfutile: and knowing that you view this as a winnable game means that i know it's not worth discussing with you
16:39mhoogerobewald interesting. No, I'm not catching it anywhere else. I'm just testing it with the repl
16:39futilebbloom: assuming I wasn't joking, sure
16:40futilebbloom: I think you're taking a pointless IRC conversation and a couple empty blog posts way too seriously
16:41futiletechnically the word is vain, from Latin vanus, meaning "empty", i.e. void of real substance or purpose or meaning
16:41futilebut yeah, empty and pointless work too
16:46mhoogerobewald how are you executing the code, if you don't mind me asking?
16:48robewaldmhooge: wrong, i just noticed... The pre doesn't get triggered for me either
16:52robewaldmhooge: the docstring is in the wrong position. take it away and it works.
16:54robewaldmhooge: yes, the docstring goes after the :pre, :post map
16:54mhoogerobewald ooohhhh. Sweet, good to know. Thank you.
16:55mhoogeand there it is.
16:56mhoogerobewald I appreciate your help, thank you.
16:59robewaldmhooge: my pleasure.
17:35futilebbloom: sorry for being kind of rude earlier
17:36bbloomfutile: no worries
17:40callenI really wish he would stop attributing those posts to me.
17:40r0bgleesonhe reminded me of 'Sebastian' from Kitchen Nightmares.
17:40callenparade of narcissists.
17:41mdeboarda phrase I never thought I'dsee in #clojure
17:43wastreli decided to write a clojure program
17:45r0bgleesonis clojure being used to write web applications?
17:46callenr0bgleeson: nope never.
17:46wastreli think it is likely the case
17:46callenr0bgleeson: totally impossible.
17:46wastrelthat people are using it to write web applications but i don't know any examples because i'm not really a clojure person
17:46bbloomcallen: seriously. please don't be sarcastic with the newcomers
17:46patchworkr0bgleeson: I have several in production
17:47r0bgleesonpatchwork: did you use a framework?
17:47mdeboardwastrel: Yes, getprismatic.com is written entirely in Clojure.
17:47mdeboardFor example.
17:47callenr0bgleeson: you want to use Luminus.
17:47r0bgleesonbbloom: its fine, question was sort of stupid and open-ended :)
17:47callenr0bgleeson: http://www.luminusweb.net/
17:47r0bgleesonthanks
17:47technomancyHTML uses angle brackets and Clojure uses parentheses, so they are clearly incompatible.
17:47mdeboardEr, sorry, r0bgleeson, getprismatic.com is written entirely in Clojure, for example.
17:47callenr0bgleeson: example app based on Luminus: github.com/bitemyapp/neubite/
17:47callentechnomancy: oh so you're allowed to be sarcastic and I'm not?
17:48callentechnomancy: watch out, bbloom will scold you.
17:48mdeboardeternal junetember
17:48callen^^
17:48r0bgleesonmdeboard: fast as hell, too :)
17:49r0bgleesonmdeboard: did you use luminus?
17:49mdeboardr0bgleeson: Yeah, seeveral very very very smart people working on it.
17:51wastreli set up clojure on my laptop
17:51callenwastrel: you mean Leiningen?
17:51r0bgleesonhum interesting, clojure might be a great fit for a project i have, I need to talk to MS-SQL but i'm not good enough to do a project of that size in a language i dont know
17:51r0bgleesonid love to though
17:52wastrelcallen: no i just downloaded the clojure zip
17:52callenr0bgleeson: most Clojure apps sit atop existing Java tooling like JDBC either via cjj or Korma so database compatibility isn't a "problem"
17:52callenwastrel: that's a bad idea. Use Leiningen.
17:52wastreli haven't read about lenanignen yet
17:52wastreli set up a clj script that uses rlwrap
17:52callenwastrel: it's like a one or two line installation. I'd hop to it.
17:52wastreland vimclojure
17:52r0bgleesoncallen: yup, as soon as I saw JDBC I wanted to use clojure :p
17:52callenI don't think I've heard of anybody actually liking JDBC, but okay.
17:53callenit's useful as mortar I guess.
17:53r0bgleesonwell, it has good MS SQL support doesn't it?
17:53r0bgleesonthat's not that easy to find in open source (ruby at least)
17:53wastreli'm going to start writing scripts in clojure
17:53callenRuby isn't a community known for having an ecumenical attitude towards technology.
17:54r0bgleesonI think it has more to do with not a lot of people choosing an MS stack and also using open source.
17:55r0bgleesoninterest isn't there to work on it
17:55callenI personally left the .NET world very purposefully, I'm not sure I blame them.
17:55mdeboardr0bgleeson: Last I looked Clojure-CLR is up to date with 1.4 :)
17:55mdeboardJust throwing it out there
17:56mdeboardSo if you're coming from C# or whatever, there's that.
17:56mdeboardup to date with clojure 1.4, that is.
17:56r0bgleesonmdeboard: not a C# guy myself, but got to integrate with a .NET stack
17:56mdeboardMight be worth a look.
17:56r0bgleesonill check it out, thanks
18:25wastrelit seems lanenign is very popular
18:25ToxicFrogleiningen, you mean??
18:25lazybotToxicFrog: Uh, no. Why would you even ask?
18:25justin_smith(dec lazybot)
18:25lazybot⇒ 17
18:45kyled2(inc lazybot)
18:45lazybot⇒ 18
18:58gt`hi getting this erro when starting joodo server using lein joodo server .. here is the error java.lang.IllegalArgumentException: No implementation of method: :make-writer of protocol: #'clojure.java.io/IOFactory found for class: nil
18:58gt`any help appreciated
19:05justin_smithgt`: can you put the stack trace on refheap or pastebin or something? - there are lots of places something may want to call make-writer on something that is accidentally nil
19:08gt`thanks will try that
19:12gt`justin_smith: https://www.refheap.com/15996
19:14gt`justin_smith: i am just new to clojure
19:14justin_smithwhat is your code's namespace?
19:16justin_smithmy guess, just looking at the stacktrace is that joodo.kuzushi.comands.server/execute is expencting something that it can make a writer out of
19:16gt`justin_smith: just downloaded joodo a frame work for herouku and starting the server
19:16justin_smithoh, so no code of your own in there at all?
19:16gt`I am no even coding anything
19:16justin_smiththere may be an arg or config missing there
19:17gt`I am just following the instructions i downloaded
19:17justin_smithso did you create a project?
19:17hyPiRiongt`: may I guess that you do `lein joodo` or something?
19:17gt`yes i did
19:17justin_smithok, when you create a project, that creates your namespace
19:17gt`yes lein joodo new
19:17justin_smiththat gets loaded when you run
19:18gt`it creates the directory skeleton and project.clj
19:18hyPiRiongt`: did you follow these instructions? https://github.com/slagyr/joodo/blob/master/README.md
19:18justin_smithso the answer to my question "what is your code's namespace" is what joodo generated for you when you did lein judo new
19:18gt`yes that is the instructions i am following
19:18justin_smithI ask because knowing which code is yours helps me narrow down where a problem likely is in a stacktrace
19:19hyPiRionhm, that's strange. Let me just quickly set it up myself.
19:19gt`I guess yes
19:19gt`what ever namespace joodo creates
19:19justin_smithwell new usually takes an argument
19:19justin_smithand after joodo creates it, it is your code from that point on :)
19:19technomancyis there something specifically in joodoo you need? if you just want to put a web app together there are simpler ways =)
19:20hyPiRiongt`: I can confirm that I get the same error as you do, so fear not. (well, at least I can reproduce it)
19:20gt`justine_smith: I guess but i don't feel like i own it yet :)
19:21gt`hyPiRion: thats great I am not alone
19:30hyPiRiongt`: ok, I figured it out
19:30hyPiRiongt`: when you specified the plugin in your config.clj, change the version number to "1.2.0" and it should work
19:30hyPiRion*profiles.clj
19:31hyPiRionI would also delete the old project and make a new one, in case the project has changed on the default setup somehow.
19:31tomjackyes, delete the old project, then abandon joodo :)
19:34gt`hyPiRion : thanks will try that
19:35gt`tomjack: :) I will when i can't get an app running on herouku hahaha
19:36technomancy`lein new heroku myapp`
19:43gt`HyPiRion: thanks alot now the server is working I am able to load the page on my browser
19:43hyPiRiongreat!
19:44gt`hyPiRion: now the next step is to deploy wots working on herouku
19:44gt`so that i get a sense of deployment
20:05sevengraffclojure is for smelly nerds.
20:05sevengraffim a nerd. i smell. teach me clojure
20:05bbloomcallen: you can be sarcastic to this one
20:07sevengraffno but for real im taking a Clojure class tomorrow https://workshopweekend.net/oakland/catalog#workshop-clojure
20:07sevengraffand im pretty excited so i thought i'd chill with the cool kids in the irc room
20:07sevengraffwhat does a noob need to know about clojure?
20:09technomancybbloom: haha nice
20:09hyPiRionsevengraff: The parens may seem scary in the beginning, but you'll like them after you've played around with clojure for some time
20:10sevengraffim ok with the parens, we did scheme for a few days in a class at university
20:10sevengraffbut ive seen some clojure code with square brackets. whats [ and ] all about?
20:12noonianunlike scheme, clojure has more than 1 built-in types with syntax for literals of those types
20:12noonianso a collection that uses square brackets instead of parens is a vector
20:12amalloynoonian: you're claiming scheme only has one literal type?!
20:13sevengraffwoah a vector, this sounds cool
20:13noonianamalloy: not claiming anything, which types are available in scheme other than the pair? I think there are vectors actually I'm remembering but I never see them used much
20:14amalloynumbers, strings, symbols, lists, booleans...just off the top of my head
20:14noonianer, maybe composite types is a better term for what I'm getting at?
20:14technomancymeh; numbers are just an optimization over church numerals
20:15amalloytechnomancy: same for cons cells :P
20:15hyPiRiontechnomancy: couldn't that be said for vectors, maps and sets as well? :p
20:16nooniananyway, i'm not trying to bash scheme, I love scheme actually :P
20:17technomancyhyPiRion: the secret twist ending of all computer science
20:17hyPiRionheh
20:18noonianI was despairing that I'd have to wait until r7rs large language was ratified to find a lisp with decent library support, but then I found Clojure
20:19technomancyisn't r7rs large just a standardization of all the stuff the racket guys couldn't get in r6rs?
20:20noonianmy understanding is it will be a large set of standard libraries to do useful stuff like http and it will be part of the language standard so that implementations that want to say they support it will have to support all of it
20:20bbloomtechnomancy: i got the impression that racket isn't a direct superset of scheme, it's the language that those guys implemetned several schemes with :-P
20:20noonianbut toy implementations and research ones can opt to only implement the 'small' language
20:20bbloomtechnomancy: i mean, if you're gonna go meta, you might as well go meta meta and iterate until a fixed point
20:21noonianyeah, the racket languages that they teach to people don't conform to any of the scheme standards anyway
20:26gt`to those who deploy on heroku can one deploy through some other port other than port 22. I am sitting behind a firewall trying to git push
20:34nooniangt`: I don't have much experience with circumventing heroku restrictions, but this (heroku plugin?) might help with what you are trying to do. I found it through stack overflow where he says it uses https
20:34noonianhttps://github.com/ddollar/heroku-push
20:39gt`noonian: thanks looking at it now
20:41technomancygt`: you can use port 2222 on gitproxy-default.herokussl.com, though it's not officially supported
20:42technomancywait, your firewall blocks 22 specifically but lets any other through?
20:42technomancywhat kind of company does that? =\
20:43muhoothe kind of company who knows how easy it is to tunnel out of the firewall with ssh?
20:44ken_barberone can tunnel on any port really.
20:47technomancytunneling out on other ports is arguably easier since it doesn't require root
20:48wastrelhi candy canes ♥
20:57wastreli downloaded the leaningen
21:01wastreli think i prefer the rlwrap repl
21:06wastrelmy main question about leningean - what's a project and why do i want one
21:08TimMcLeiningen projects allow you to have dependencies and have versioned releases.
21:12nooniana lot of useful development tasks for specific libraries and technologies have been implemented as leiningen plugins, think rake tasks for rails and the like
21:13gt`noonian: hmm i was able to deploy but not to the app i just created it is deploying to one of the default app created by heroku called still-castle-3461. There must be a way around it some how :)
21:13gt`
21:13gt`
21:13gt`
21:13gt`
21:14r0bgleesonnoonian: it's more like bundler.
21:15gt`noonian: here is the deployed site http://still-castle-3461.herokuapp.com/
21:16gt`i wanted to deploy to this http://mexams.herokuapp.com
21:18nooniangt`: hmm, I think there is an --app-name flag you can pass into heroku calls to specify which of your apps you're targeting
21:18noonianr0bgleeson: yeah, bundler + rake combined :)
21:19gt`noonian: mmm i think so too i will have a look thanks for the help so far
21:19nooniangt`: no problem, good luck
21:21seangroveHey all, wondering how I can make this more idiomatic
21:21seangrovehttps://www.refheap.com/3076119d0daf6d917de7518b5
21:21seangroveThere are a few places that state is changed, though they're all at the top at least, and the whole function just look ugly... that may be a consequence of dealing with streaming http api's async, but it's still a bit sad
21:22seangroveAnywya, idiomatic/better code suggestions readily welcome
21:23noonianwell, instead of using swap I might do some sort of accumulation with reduce or use loop/recur
21:23noonianI'm very new to clojure also so take my advice with a grain of salt
21:28seangroveThat might work, but then I need to keep track of when to kill the connection
21:28seangroveI feel like I'm going to end up introducing state and tying everything together in an ugly way
21:33gt`noonian: found out how to add the app name one is deploying too .. in the .git/config file add app name there. I added this url = git@heroku.com:mexams.git. and heroku push and it deploy to the app i specify . Thank you so much for the help i am getting
21:34wastrelvim clojure thing is spazzing about indenting
21:34wastrelborkage
21:47wastreli think if it doesn't understand some keyword it doesn't indent properly :p
21:56tomjack"http.async.client"? wow
21:58seangrovetomjack: ?
21:59tomjackjust seems crazy to claim http.*
21:59seangroveAh, fair enough
21:59seangroveThat'd be like cemerick claiming cljs.test :)
22:00tomjackworse I think
22:00tomjackno suggestions, I agree it is sad :(
22:00seangroveAh well, thought there may be something obviously better I was missing
22:01seangrove'course, the new async stuff hickey is working on might add some nice options
22:01dnolen_seangrove: sounds like it
22:01tomjackmaybe
22:01tomjackstill going to be ugly, but not that ugly
22:04dnolen_seangrove: I'm honestly more excited about core.async for client side code
22:05seangrovednolen_: I agree, could be some really cool stuff there. Just surprising how ugly concurrent code is currently
22:07amalloyseangrove: (.getTime (java.util.Date.)) is just a gross/expensive way to write (System/currentTimeMillis)
22:07dnolen_seangrove: yeah it's really little better than JS at the moment
22:07seangroveamalloy: Ah, well, that's good to know at least
22:08amalloybut i don't think you can avoid the atom, given that your http client only exposes a callback-based API
22:08amalloythough honestly (atom "") that you keep concat-ing to is just an inefficient StringBuilder
22:09tomjackseangrove: do you even need async?
22:09amalloyi wouldn't unconditionally println in there
22:09seangrovetomjack: Not necessarily, but I wanted to explore using it
22:09paultagAnyone know how I might run a program and drop to a REPL with lein?
22:09seangroveamalloy: More concerned about the ugly nature of it, given the callback-based api
22:10tomjacksince you're taking up a thread anyway seems it'd be a lot simpler to just use clj-http or whatever
22:10seangroveamalloy: If you were writing this async http api, how would you do it instead? Would you still use callbacks?
22:10amalloyi'd use lamina and aleph
22:11seangroveAlright, will play with those next time instead then
22:11seangroveThis was just for fun to play with a seemingly trivial problem
22:11amalloywhich doesn't fundamentally change the process, but it does hide some of the state for you, and lets you build some things that look functional
22:13tomjackdeceivingly so :)
22:13tomjackcan't decide whether that's better or worse than core.async's approach
22:15tomjackwith core.async I'd guess that code would turn into a loop inside go
22:16tomjackwhich would be nice and somewhat clear
22:16tomjackbut do we just write new loops inside go every time?
22:17amalloyhaha, https://github.com/clojure/core.async/blob/master/test/clojure/clojure/core/async/buffers_test.clj#L14 - a slap in the face to the claim that clojure.test/is is extensible
22:18tomjacklamina seems lax in that you pretend these non-values are values, which lets you use nice things like map/filter/etc
22:18tomjackbut they're not values. otoh writing (go (loop [])) all over doesn't sound fun :(
22:19amalloyi couldn't find any docs for core.async, and the tests don't mention this "go" thing, so i can't have a meaningful discussion with you about it
22:19amalloyor, at least, not the two test files i chose based on my guess at whether they'd be interesting
22:19tomjackthe go tests are https://github.com/clojure/core.async/blob/master/test/clojure/clojure/core/async/ioc_macros_test.clj
22:19bbloomamalloy: the doc strings are reasonable for a first cut in core.async
22:20bbloomhttps://github.com/clojure/core.async/blob/master/src/clj/clojure/core/async.clj#L322
22:21tomjack(go (let [done (timeout 1000)] (loop [posts []] (alt! conn ([post] (recur (conj posts post))) done (do (close! conn) posts)))))
22:21tomjackoslt
22:22tomjackwhich, yeah, is clearly so much better than http.async :)
22:22bbloomdnolen_: tomjack: during QnA for my walk on wednesday, rich asked if i had considered the applicability of the core.async IOC macros to building generators
22:22tomjackI saw tbaldridge experimenting with that I think in the precursor to core.async
22:22bbloomsince Fipp is basically a pipeline of communicating sequential processes
22:23bbloomtomjack: yeah, i think one could directly use channels instead of generators, but i guess you could re-use the IOC macros if they are made extensible
22:23tomjackthey are extensible already :)
22:23bbloomeven better
22:23bbloom:-)
22:24tomjackonly extensibility problem is the alt thing
22:24tomjackwhich bakes in async-chan-wrapper
22:24tomjackbut irrelevant if you don't want to support alt inside your go-like thing
22:24bbloomin Fipp, I used reducers to eliminate the lazy seq overhead for using mapcat to non-forking chain of communicating processes
22:24bbloom….to *simulate* non-forking… i mean
22:24dnolen_bbloom: yeah sad I couldn't make your talk, work thing. I caught up w/ Rich afterwards. somewhat related I mentioned I was very interested in seeing core.logic could use channels
22:25dnolen_he said on his machine he's been able to get a million events a second, which is promising
22:25dnolen_core.logic can only execute 200-300,000 goals a second
22:25bbloomwow. that's pretty good
22:25bbloomhow would core.logic utilize channels?
22:26dnolen_bbloom: parallel AND and OR
22:26bbloomdnolen_: hmmm excellent :-P
22:27dnolen_I looked into setTimeout performance today
22:27dnolen_it's pretty dismal if you want to handle a million events a second in JS
22:27dnolen_not gonna happen
22:27dnolen_but I toyed around with this https://gist.github.com/swannodette/5833247
22:27bbloomoh yeah, it's baad
22:27bbloomit's tied to the UI look
22:27bbloomloop*
22:27dnolen_if you use a queue, you can handle a million events a second
22:27dnolen_one of the fast events in the browser at least under OS X is mouse events
22:28dnolen_but that threshold is around 6ms
22:28tomjackthere are a few tricks I've seen used for getting better perf than setTimeout
22:28dnolen_so you can set a event queue flush around that, and that seems like it might work
22:29bbloomdnolen_: have you tried post message on browsers that support it?
22:29wastrelis there an easy/quick way of finding dependency version numbers for project.clj?
22:29bbloomdnolen_: http://dbaron.org/log/20100309-faster-timeouts
22:29wastreli'm looking at old tutorials and all their jazz is out of date
22:30bbloomwastrel: clojars.org ?
22:30bbloomwastrel: or maven central or wherever the artifacts are
22:31bbloomdnolen_: seems like postmessage is supported pretty much everywhere since IE 8. caveat is that IE 8 to 10 only allow string messages
22:31bbloomhttp://caniuse.com/#search=postMessage
22:32tomjackhttp://caniuse.com/#search=mutationobserver :(
22:32seangrovetomjack: We rely on mutation observers, but don't support ie
22:33seangroveHas worked out pretty well
22:33dnolen_seangrove: yeah not supporting ie is a non starter
22:33bbloomtomjack: agreed. that sucks. would be nice to be able to sync the dom w/ a virtual dom or something like that. but it's not a huge deal b/c you can just assume that external changes to the dom are made via inspector or by some extension that is likely trying (at least a little) not to break assumptions about the shape of the dom
22:33dnolen_bbloom: that does look interesting, should be measured against queue
22:34seangrovednolen_: Depends on what you're talking about of course - I wouldn't expect anything in cljs core to touch mutation observers
22:34bbloomdnolen_: i assume that the actual solution would be some combination of a flag, a queue, and a message/timeout :-P
22:35dnolen_bbloom: yeah postMessage is unacceptable slow for 1000000 events
22:36dnolen_my solutions takes 200-300ms
22:36dnolen_to enqueue all events
22:36dnolen_and finishes 200ms or so later
22:36bbloomdnolen_: yeah, keep the queue, just swap out setTimeout with postMessage
22:36dnolen_postMessage takes 53 seconds for 1000000 events
22:37bbloomyou're using queue+setTimout, try queue+postMessage
22:38bbloomand don't post a function, i think that serializes the function
22:39dnolen_bbloom: oh oops that test is messed up anyhow you may be right
22:39dnolen_the events are not independent
22:40dnolen_they should be
22:45tomjackhttps://code.google.com/p/dart/codesearch#dart/trunk/dart/tools/dom/src/Microtask.dart
22:46dnolen_bbloom: yeah, even w/o queueing naive calls to setTimeout destroys postMessage
22:46dnolen_8s for setTimeout for independent events
22:46dnolen_60s for postMessage
22:46bbloomdnolen_: really? wow. that's strange.
22:46dnolen_the benchmark is flawed it's only testing events that depend on each other
22:46dnolen_e0 -> e1 -> e2
22:46dnolen_etc
22:47bbloomdnolen_: http://dbaron.org/mozilla/zero-timeout
22:47bbloomwhat does that report for you?
22:47dnolen_bbloom: yes i just ran that and modified it to benchmark independent events
22:47dnolen_postMesage loses massively
22:48bbloomdnolen_: can i see your benchmark?
22:48bbloomtomjack: i'm not positive, but i think dart is DOA
22:48dnolen_bbloom: http://gist.github.com/swannodette/5835632
22:49tomjacksure, I don't plan to ever touch dart, I just plan to steal the idea from Microtask.dart
22:50dnolen_bbloom: I commented out the setTimeout case if you have them both run browser goes haywire
22:52dnolen_tomjack: that implementation does looks like a pretty good approach, more fully fleshed out version of what I was considering
22:53bbloomdnolen_: https://gist.github.com/swannodette/5833247 why is this calling clearInterval?
22:54bbloomdon't you mean clearTimeout?
22:54dnolen_bbloom: oops yeah a typo
22:59bbloomdnolen_: i'm still confused by your code here
22:59bbloomwhy are you setting a timeout if there is already one?
22:59dnolen_seangrove: definitely not against hybrid approach as pointed out by the Dart code ^
22:59dnolen_bbloom: because you may not fill the queue, i.e. mouse stops moving
23:00bbloomhuh?
23:01bbloomlet me see if i understand the goal here
23:01bbloomyou want a callback to be fired
23:01bbloomat some later time, so you can use setTimeout(aCallback)
23:01bbloombut that's too slow, so you do: enqueue(theCallback); notifyQueueNoLongerEmpty()
23:01dnolen_bbloom: remember this is for core.async dispatch
23:01bbloomright?
23:01clojurebotflatten |is| rarely the right answer. What if your "base type" is a list
23:01bbloomyes, i remember
23:01bbloomclojurebot: you are not helping.
23:01clojurebotPardon?
23:03dnolen_bbloom: yes you could probably do it differently, I'm not sure which performs better but I how it did was this
23:03bbloomoh yeah, i'm just an idiot. you are checking (!fulsh_timer)
23:03dnolen_oh ok
23:06dnolen_bbloom: i mean it's some pretty silly imperative code just to demonstrate an idea :)
23:06bbloomdnolen_: yeah, i'm just confused why postMessage wins so much here http://dbaron.org/mozilla/zero-timeout
23:07dnolen_bbloom: yeah I tried to explain earlier those aren't independent events
23:07bbloomi don't know what you mean by that
23:07dnolen_the next increment doesn't get to run until the previous one
23:08dnolen_in my queue code 1000000 events actually get queued
23:08dnolen_none of them know about it each other at all
23:08dnolen_which more similar to what core.async needs I would think
23:12seangroveAnyone use cemerick's cemerick.cljs.test? I just get "ReferenceError: Can't find variable: cemerick"
23:12mhrHave any of you read this article: http://e-texteditor.com/blog/2010/beyond-vi ? Their website went down, and I can't find a mirror. I'm trying to find someone with a local copy. I'm trying to figure out why a Vim user would consider switching to an editor other than Emacs (http://stevelosh.com/blog/2010/09/coming-home-to-vim/#vims-feeling), but I can't figure out what that editor was about.
23:15tomjackwhat is the point of dispatch in cljs?
23:16tomjackjust 'make sure this happens AFTER the rest of the stuff I'm about to do synchronously' like process.nextTick?
23:17dnolen_tomjack: I don't see how core.async could work at all without it
23:18tomjack(defn run [f] (f))
23:18tomjackthat would break things?
23:18dnolen_think about it some more
23:18dnolen_core.logic is an obvious example
23:18dnolen_f may not terminate
23:18dnolen_but if it's work is broken apart by dispatch
23:18dnolen_it can't steal all the time
23:19dnolen_and in fact it can be closed if somebody else say we don't need your information anyway
23:20bbloomtomjack: setTimeout or some other form of dispatching allows for concurrency
23:20tomjackI see, yeah
23:20bbloomthe IOC takes a task and breaks it into parts, so you need some strategy for breaking it up
23:20tomjackyou'd still get concurrency without it, maybe
23:20bbloombut i'm not convinced setTimeout is the answer tho
23:20tomjackbut only when you park
23:20bbloomi think you can just have a pseudo-random queue
23:20tomjackthis way you can (go ..) (go ..) and have em both go
23:20tomjackregardless of contents
23:21bbloomi think that when parking happens, you can just execute the next thing in the queue
23:22tomjackhmm of course they can't both go
23:22tomjackso I'm back to the reason q.js has, that it's useful to know stuff isn't going to happen until after the current tick
23:22bbloomdnolen_: right? is timeout really necessary?
23:23tomjackI'm reminded of CurrentThreadScheduler
23:23dnolen_bbloom: you need something to say schedule this later. it could be many things - but setTimeout is widely available, with queue'ing it need not be slow
23:24dnolen_but I like tomjack's Dart link, picking the fastest option available is wise
23:24bbloomdnolen_: but what constitutes "later"? how much later?
23:25dnolen_bbloom: yeah in general you shouldn't care
23:25dnolen_obvious for stuff like mouse events or server calls
23:25dnolen_Rich has a neat thing called timeout channels
23:25dnolen_I'm very curious how this will port
23:25bbloomso i don't see why you can't just run all async code in an event loop off a queue and "later" == "later this tick, after i yield control to the task loop"
23:25tomjackI think that's what CurrentThreadScheduler is basically?
23:26tomjackfrom Rx
23:26dnolen_bbloom: but that loop will need to ... call setTimeout
23:26dnolen_there no such thing as yielding control w/o some browser based async service
23:26bbloomdnolen_: only after it's timeslice is up, right?
23:27bbloomi understand that you need setTimeout to say "OK, i'm not done with the queue, but i want to give the browser time to eexecute normal DOM stuff"
23:27bbloomso yeah, setTimeout
23:27bbloombut you don't need to setTimeout every time you call core.async/go
23:27dnolen_bbloom: in anycase, I think Rich's intuition is correct, browsers already do a bunch of work to figure out what the optimal time for JS to run is as setTimeout is a common pattern
23:28dnolen_he's pretty much against building a scheduler of any kind
23:28dnolen_and whatever we come up with needs to be very fast
23:28bbloomdnolen_: either i'm wildly confused or i'm not explaining myself clearly
23:28bbloomdnolen_: or you're not listening :-P
23:29bbloomis there a 1 to 1 mapping between setTimeout and core.async/go ?
23:29tomjackthe clojure go always does a dispatch/run
23:29dnolen_bbloom: currently yes
23:29bbloomtomjack: yes, but they have threads :-P
23:29dnolen_bbloom: and in JS you have setTimeout
23:30bbloomdnolen_: so there is a little virtual machine that drives the IOC-ed code, yes?
23:30bbloomlike the thing that just calls the function slices on the queue is just a loop
23:30bbloomand presumably, when your async code is running, you're already in that loop, right?
23:30tomjackso go inside go could use a queue?
23:31bbloomthat's what i'm saying. if you're already async, you don't need to call setTimeout
23:31tomjack(again that's exactly CurrentThreadScheduler I think)
23:31bbloomyou only need to cal setTimeout (or postMessage or whatever) if you're not in the dispatch loop already
23:31bbloombut you do need to have a time limit on the dispatch loop
23:32bbloomif you have async code that creates an infinite chain of async functions, the queue will never be empty
23:32bbloomso you need to have a time limit ont hat loop & if you hit the time limit, you abort & setTimeout to come back and finish up
23:32tomjackwould that ever be not a bug?
23:32dnolen_bbloom: which sounds pointlessly complicated
23:32dnolen_if you can use setTimeout and handle a million dispatches a second who cares?
23:33bbloomdnolen_: surely you can beat that by a lot if you dont' call setTimeout a few million times a second :-P plus it's not that complicated....
23:34bbloomyou've already got a queue, so you already have this problem where you might have an infinite chain of async calls
23:34bbloomso you need a time limit on dequeue-ing anyway
23:34dnolen_bbloom: but you're just reinventing setTimeout
23:34dnolen_you pick some arbitrary time N to yield control
23:35dnolen_it maybe that some patterns maybe more efficient with that knob
23:35dnolen_or might turn out that setTimeout + queue'ing makes the different insignificant
23:35bbloomtomjack: i dunno if that would ever be sensible, but it seems like you certainly wouldn't want to kill the browser if you make an infinite loop like that even if it's just during development
23:35dnolen_difference
23:36bbloomdnolen_: even ignoring efficency, there's that infinite loop case
23:36bbloomor not even infinite, just potentially long
23:36tomjackCurrentThreadScheduler.scheduleRelative used to block the vm :)
23:36bbloomit's quite possible for totally reasonable code to schedule enough stuff to make the app slow
23:36bblooma 100ms time limit would keep the app & dev tools responsive in that situtation
23:37bbloomand once you build the time limit in, it's trivial to rely on it instead of always scheduling a timeout
23:37bbloomit's one mroe if test :-P
23:37dnolen_bbloom: yeah I don't follow why that's an issue if the loop is in a go block
23:37dnolen_bbloom: I'm skeptical, but hey we're close to point where we can see for ourselves :D
23:37tomjackyou don't mean (go (loop [] (recur)))?
23:37dnolen_tomjack: yes
23:37tomjackI'd expect that to still block everything
23:39dnolen_tomjack: I mean if there's a write or read from a channel in there of course
23:39tomjackah yeah
23:44bbloom*shrug* basically my brain must be shot, soooo i'll pour myself a gin :-P
23:44dnolen_bbloom: haha
23:44tomjackshit
23:45tomjacktesting (go (loop [] (recur))) was a bad idea https://www.refheap.com/bd5fbcabc5dd3b41cab2c89ff
23:45bbloomguy at the liquor store sold me a bottle of http://www.brooklyngin.com/ -- sooo good. i might become an alcoholic, it's so yummy
23:45tomjackmade it to the charger in time :)
23:45callenbbloom: tried bombay sapphire?
23:45dnolen_bbloom: nice
23:45callenthat's my usual drinking gin, so trying to figure out if I have something new to look into.
23:46dnolen_tomjack: heh yeah, you need the read / write, but that of course will be given for core.async code
23:46Raynescallen: I drove. Nobody died. Good stuff.
23:46dnolen_a loop/recur in a go w/o read/write make no sense
23:46callenRaynes: congrats.
23:46RaynesLA drivers are unpredictable, but manageable so far.
23:46tomjackyeah, I expected it to do what it did
23:46bbloomcallen: bombay is pretty good
23:46tomjackjust didn't expect full cpu use to drain my battery down to nothing in 10s O_o
23:47callentomjack: what other-worldly awful computer do you own?
23:47bbloomdnolen_: in theory, the compiler could trivially reject that :-P
23:47callenwas the battery capacity getting sucked into another eldritch dimension?
23:47tomjackdunno if the computer is bad, but the battery has been severely mistreated
23:47callentomjack: I genuinely want to know what make it is.
23:48callentomjack: I'm having battery troubles that are my fault atm, so it's a subject of present interest.
23:48tomjacktoshiba tecra a11
23:48bbloomdnolen_: hey so cljs idea/question
23:48tomjackthis is my second battery :( maybe I _should_ blame it on toshiba instead of feeling guilty for leaving it plugged in and on all night
23:49bbloomdnolen_: if i were to experiment with doing some of our own js-level analysis, what would you consider the best intermediate language to target?
23:49bbloomdnolen_: interesting choices are ES > 5, TypeScript, and Google Closure's little type system stacked thing
23:49callenbbloom: typescript added generics recently, if you didn't catch that.
23:50callenbbloom: which is information that is principally useful to me so that I can taunt Golangers more.
23:50bbloomcallen: saw the announcement, but didn't dig in
23:51tomjackno activity on the chrome asm.js ticket :(
23:51bbloomcallen: the golang generics thing is kinda odd…. i'm not sure what the rational is
23:51tomjacks/chrome/v8/
23:51callenbbloom: rationale* - they think they can't do generics without comprising performance or their version of simplicity.
23:51bbloomcallen: yeah, but boxing to interface{} is the exact same loss of performance :-p
23:52QortznivRaynes, your name is so clsoe to Gayness
23:52Qortznivwe must be made for each other
23:52Qortznivit's a sign from the gods.
23:52callenbbloom: the interface boxing and type-casting I think tells all that need be said. I think it's partly from their Suckless heritage that they take a bizarre version of minimialism into their aesthetic.
23:52bbloomthey could add type checker support without changing the code generation or runtime
23:53callenbbloom: the concern is generics code generation if they really wanted to support it
23:53callenbbloom: they're superstitious with regards to anything C++, so they're refusing to learn anything from what they did. Other alternatives "compromise performance" or implementation simplicity. So.
23:54bbloomcallen: but i don't think that could possibly be it… b/c they already decided that boxing is fine… so they could just do boxing :-P i think that they realize average devs can't figure out co and contravariance, and so having generics at the type level would be pointless, hence interface{} is good enough
23:54bbloomat the type CHECKER level, i mean
23:54bbloomalso the C# people called them "in" and "out" annotations & people seem to grasp that well enough, so who knpws :-P
23:54callenbbloom: Golang is an LCD language designed to facilitate Pharaonic project management styles. *shrug*
23:55bbloomcallen: Go is the new Java & that's a very good thing
23:55bbloomI think Go is absolutely brilliant for it's particular design criteria
23:55callenQortzniv: may his merciful shadow fall upon you.
23:55bbloompersonally, i hope that Go and the community takes off in a big way, such that the Go runtime replaces the JVM as the target of choice
23:55callenbbloom: I'd rather get a cleaned up Scala as a "java next"
23:56callenbbloom: you're scaring kitty :(
23:56wastrelwi 10
23:56bbloomactually.. has anybody tried a clj->go yet? dnolen_ ?
23:59hiredmanugh
23:59hiredmanthe jvm is so much better