#clojure logs

2013-12-25

00:01logic_progargh
00:01logic_progapparetly I need one terminal for "lein cljsbuild auto"
00:01logic_progand another for "lein cljx auto"
00:02rovaryou could maybe pdo them both?
00:03rovarlein pdo cljb auto, cljsbuild auto,
00:03rovaror something to that effect
00:12logic_progrovar: lein-pdo is awesome!
00:12logic_progI used to have a tmux with 3 terminals
00:12logic_progfor "lein run main", "lein cljsbuild auto", and "lein cljx auto"
00:13rovarit is rather helpful, I've found
00:13logic_progI tried for the longest tie to get "lein do" to do multiple things that don't return
00:13logic_proggave up, and then assumed it couldn't be done
00:23logic_progsorry for dumbass question: does #+clj go until #+cljs , and #+cljs go until end of the sexp?
00:23logic_progi.e. how doe #+clj and #+cljs decide when to terminate?
00:29ivanlogic_prog: they apply to the next token, no?
00:29rovarI don't even know what you're referring to
00:29ivanhttps://github.com/lynaghk/cljx
00:30logic_progivan: ah, got it working, thanks!
00:47egosumis there a way to use functions as predicates in core.match? seems like that just might not be doable?
00:50ddellacostaegosum: got an example of what you want to do in a gist/refheap? Also, looked into this? https://github.com/clojure/core.match/wiki/Advanced-usage#extending-pattern-matching
00:50egosumddellacosta: that isn't working for me; let me throw it in a gist
00:50egosumi'm not sure it's possible with the way match is implemented, but i've just started looking at it tonight. give me a minute
00:51ddellacostak
00:54egosumddellacosta: https://gist.github.com/ihodes/8120514
00:55ddellacostaegosum: gimme a sec, let me get a repl going
00:55egosumddellacosta: no worries, thanks for checking it out :) appreciate it
01:00ddellacostaoh, I see, I misunderstood--you're talking about evaluating a function in the result
01:00ddellacostaegosum: sorry, that was to you ^
01:01egosumin the result? i'm not sure i follow
01:01egosumi'd like to evaluate a function in the decision tree that match generates
01:01egosuma predicate function
01:01ddellacostasorry, nevermind--one sec
01:04egosumit works with vars, but not with function definitions of any sort
01:04egosumso it's not a showstopper
01:04logic_prog>! puts to the _end_ of a channel
01:04rovarthe way I read the advanced usage.
01:04logic_progis there a way to push to the _front_ of a channel ?
01:04rovarlogic_prog: like a priority message?
01:05logic_progi.e. something like (let [msg (<! ...)] ... oh crap, we cna't handle msg, we need to push msg back into the chan at the front)
01:05rovaroh
01:05logic_progrovar: I may be in the X-Y problem.
01:05rovarlike a peek
01:05logic_proghere's the real problem:
01:05logic_progIm wriitng a piece of code in cljs, which takes stuff of a chan and sends it over a websocket
01:05egosumddellacosta: i lied, it doesn't work with named functions, sorry. Yeah I can't get it to work with functions at all…
01:05logic_progso something like (go (loop [msg (<! input-chan)] (. websocket send msg) (recur (<! input-chan))))
01:06logic_prognow, when the .websocketd send throws an error
01:06logic_progI'd like to catch it, fire up a new websocket, and send the msg
01:06logic_progthus, I'd like to "push the msg back to the front of the channel"
01:06logic_progdoes this make sense? am I solving this in the wrong way?
01:06ddellacostaegosum: yeah, I was having trouble getting it to load at all, so I was still digging into the code
01:07ddellacostaegosum: but I'm pretty sure the patterns don't get evaluated, as it seems you want to do
01:08egosumsee how i extended the pattern emission to sets, though? evaluation is happening there; similary with regexes
01:09egosumi may just need to dig into the code, or post on SO and hope dnolen will see it :)
01:09rovarhmm
01:14ddellacostaegosum: right, I see what you're saying
01:14rovaregosum: hmm. I'm mucking about with your gist in the repl.. it seems like it should definitely work.. I might try to macroexpand to make sure everything's getting evaluated at the right time..
01:16egosumrovar: right, in my super basic debugging, it looks like the #() form is getting expanded to (fn* …) and then match tried to destructure it like an list. Also, if I use a named function, it treats it like a wildcard… so there's that, too.
01:16egosumWill have to return to it tomorrow. Thanks rovar and ddellacosta for the help
01:16rovaregosum: my guess is that it can't determine the type
01:17rovarnot for the multimethod
01:17rovarI don't think multimethods can switch on functions because it doesn't know exactly what they are
01:17egosumeggnoggin: ah interesting
01:17egosumrovar: ^* oops
01:18rovarI thought I remember reading that about multimethods.. but I am not sure
01:18rovaroh well.. time for sleep
01:18rovarhappy Christmas all
01:19ddellacostaoh, you guys both went away. Sad. ;-(
01:19ddellacostalogic_prog: did you get your core.async thing working?
01:19logic_progddellacosta: yeah, cljx fucking rules
01:20logic_progalso learned about lein pdo
01:20logic_progguess santa delivered twice this year
01:20ddellacostalogic_prog: sweet. :-)
01:20logic_progit's aamazing
01:20logic_proghow damn simple #+clj and #+cljs are
01:20logic_progit's so "obvious" in retrospect
01:21ddellacostayeah, I had a similar experience the first time I used cljx--I was really impressed by how *simple* it was to use.
01:21ddellacostaI was kind of skeptical before that.
01:21bitemyappcljx is a lot more obvious if you've done C before - especially on a legacy project.
01:21logic_progddellacosta: yeah, it's as if someone smart looked at the problem and asked "what is the most fundamental primitive to make this happen" -- rather than someone hack something up, then realize they forgot about Foo + hack something else up + forgot about Bar + hack somethign else up
01:21bitemyappold code in old languages is 50% preprocessing, 50% sanity you're willing to put on the altar.
01:22bitemyapp10% coworker's sanity you're willing to involuntarily put forth for burning.
01:23ddellacostabitemyapp: you must be talking about macros, huh? I mean the C variety. The last time I wrote C "professionally" was making a printer driver like 14 years ago...
01:24bitemyappmacros are a part of it. There's more than that even though.
01:24ddellacostabitemyapp: C scares the crap out of me, honestly...it seems like you really have to invest serious time to get good at it before you run the risk of seriously f'ing things up.
01:24bitemyapppragmas, ifdefs, yadda yadda.
01:24bitemyappddellacosta: writing C is less like programming and more like being a lawyer with a gun to your head.
01:24bitemyappa loaded gun. with a faulty trigger.
01:24ddellacostabitemyapp: ah, that shows my ignorance, I thought that all fell under the category of "macros..." but I guess you'd say, "preprocessing directives," huh?
01:24ddellacostabitemyapp: haha, scary dude
01:25ddellacostabitemyapp: "oh shit, wait " *BLAM*
01:25bitemyappddellacosta: yes, preprocessing directives.
01:25bitemyappmy "test all the things!" tendency came from C, not from the newfangled Python/Ruby crap.
01:25bitemyappOnly knowledge of the C Standard, paranoia, and empiricism can save you.
01:25ddellacostabitemyapp: that makes a whole lot more sense
01:26bitemyappempiricism alone isn't enough because undefined behavior can make things blow up at unexpected times that previously worked on your machine
01:26ddellacostaI have a lot of respect for anyone who can write C well though.
01:26bitemyapp-Wall -Werror is advisable too.
01:26bitemyappto help catch UB.
01:26ddellacostaugh
01:26andyfddellacosta: bitemyapp: Or avoid the corners of the language, and stick with a reasonable subset.
01:27bitemyappddellacosta: nobody writes C well in the courageous sort of way that I think of as "language comfort". There are people who are merely terrified of the right things to not stray from the golden path very often.
01:28bitemyappas much as people to rail on it, it's sometimes (in certain contexts) easier to write valid C++ if you know the right patterns.
01:28ddellacostayeah, well, I'm hanging out in #clojure for a reason...
01:28bitemyappbecause in C++ there are rules and patterns to resource acquisition you can follow that will generally be okay. You get some help from the compiler WRT types as well.
01:28bitemyappbut in C? nihilism reigns supreme.
01:28ddellacostahaha
01:29ddellacostabitemyapp: with you, it always ends up getting philosophical. ;-)
01:29bitemyappvoid* all the things. Look before you leap? pffft. that's for quiche eaters.
01:29andyfC++ has a lot more language-lawyerism to it than C does -- there is just a lot more to it.
01:29bitemyappif you think C++ has a lot more language lawyerism, you haven't spent much time around ##C or C programming in general.
01:29bitemyapp90% of C is simply not fucking yourself with UB or nonsensical code that seems reasonable on the face of it.
01:30bitemyappand knowing which 3/4s of the standard library is hopelessly teacherous.
01:30bitemyappthe primitives, tooling, and libraries provided in C++ are safer.
01:30andyfUnless I'm completely ignorant of the kinds of things that have undefined behavior (I may be), there is a reasonable subset of C that produces predictable behavior.
01:31bitemyapphum, yeah. spend some time writing C and bringing it up in ##C
01:31bitemyappyour starry-eyed, "but surely C is okay and C++ is not?" will disappear fast.
01:31andyfI use C professionally on a regular basis.
01:31bitemyappIME, C++ gives you more brick and mortar to actually scale up and away from petty problems.
01:31bitemyappyou can't scale up in C without producing bullshit like glib.
01:32andyfOr you just don't scale up to the same levels of abstractions
01:32bitemyappright but that's part of the problem.
01:32andyfNot if the application doesn't need it.
01:32bitemyappYou'll never stop using poisoned toothpicks in C.
01:32bitemyapppoison-tipped*
01:35ddellacostac'mon guys...don't argue about C in #clojure. Not on Christmas. *sob*
01:35andyfSo on a happier #clojure note, the Eastwood lint tool is coming along nicely, probably ready to release a new improved version in a week or two.
01:36bitemyappddellacosta: I love FP, but sometimes...just sometimes...an opaque function was not the right choice for the outer layer of an API.
01:36bitemyappsometimes data with the "do-er" functions provided besides is better for introspection.
01:36bitemyappandyf: this is part of the shift to the new analyzer tooling and the like?
01:37andyfyes. Bronsa has improved tools.analyzer(.jvm) quite a bit in the past month.
01:37ddellacostathat's pretty cool, I gotta give it a shot
01:38andyfI can't say it will turn your life around, but I've heard it has found one case where a clojure.test deftest was not being run (because of duplicate deftest names), and the disabled tests when run pointed out a bug in the project.
01:39bitemyappeastwood and kibit have cleaned stuff up in the past for me, but I think it was mostly kibit doing the clean-up duty before...I think this was before the improvements to eastwood started.
01:39andyfRunning it right now requires doing 'lein install' on tools.analyzer, tools.analyzer.jvm, and eastwood itself, all latest versions, because there are no released JARs for the first two yet.
01:39bitemyappI decided to take your example and try it in Haskell: Multiple declarations of `blah'
01:39bitemyappso uh, denied :)
01:39bitemyappSSA ftw?
01:40andyfmeaning the Haskell compiler disallowed a redefinition?
01:40yedii wanna read some good clojure code to learn some better clj design techniques, anyone have suggestions for repos / projects i should look at?
01:41bitemyappandyf: correct.
01:41andyfIf so, such a change to Clojure would never happen.
01:41bitemyappGHCi caught it too.
01:42andyfMaybe, maybe, an optional warning that was not the default, but even that would be an uphill battle.
01:42bitemyappandyf: if I was to change Clojure it'd end up being Haskell with S-expressions and macros.
01:42bitemyappNot exaggerating.
01:43andyfIIRC there are 1 or 2 past projects that were some blend of Haskell + a lisp.
01:43bitemyappwell I mean there was Chris Done's thing. Lisk.
01:44bitemyappandyf: mostly I just don't really care for Haskell's syntax or glyphs - but it doesn't bother me enough to stop by any means.
01:44bitemyappeverything is an expression.
01:44andyfWhat I'd like to see is some automated way of detecting whether an interesting subset of Clojure functions are pure functions or not.
01:45andyfi.e. it would say "definitely pure function", "definitely has side effects of type X, Y, Z", or "I can't analyze this".
01:46bitemyappandyf: had core.typed been designed with monads and effect typing in mind that might've been trivial.
01:47andyfbitemyapp: Why would core.typed's being designed with monads in mind help it determine whether Clojure functions as they are typically written today are pure or not?
01:48bitemyappbecause then you could be sufficiently expressive as to say whether a function has side effects or not.
01:48andyfyou mean, then the language used to specify types in core.typed would be expressive enough?
01:48bitemyappthe type system, as it stands, only concerns itself with a subset of what Clojure code actually does.
01:48bitemyappandyf: have you written any Haskell?
01:49andyfNot anything more than a toy.
01:49bitemyappandyf: I guessed this type signature from memory: http://www.haskell.org/hoogle/?hoogle=Chan+a+-%3E+%5Ba%5D+-%3E+IO+%28%29
01:50bitemyappandyf: IO () means it executes for side effects alone and those side effects occur in the IO Monad with a return type of unit.
01:50bitemyappandyf: http://www.haskell.org/hoogle/?hoogle=IO+a+-%3E+a
01:51bitemyappandyf: http://www.haskell.org/hoogle/?hoogle=ST+s+a+-%3E+IO+a I can see exactly where side effects and mutation occur and what sort of things they're doing at the type level.
01:52andyfSo if I understand (at least partially), the IO monad would be involved in a correct type of a function that did IO.
01:52bitemyappandyf: strictly speaking, it's only functions that do something that requires binding their operations against the IO monad in order to 'reach' the outside world...but we can go with that approximation if you like.
01:53bitemyapp>>= in the end is just inversion of control for functional languages.
01:53andyfIs there anything in these types to represent things such as set! ing a value, or swap!ing an atom value, or other non-IO things, or do they all fall under IO, too?
01:53bitemyappandyf: gods no.
01:53bitemyappandyf: you're getting ST, State, etc.
01:54bitemyappandyf: The closest equivalent to a promise or atom in Clojure is an MVar: http://www.haskell.org/hoogle/?hoogle=a+-%3E+IO+%28MVar+a%29
01:54bitemyappandyf: there are other kinds of *Vars, and you can see where they're used - in the type signature.
01:54TEttingerbitemyapp, be advised: dogecoin is a thing now
01:54bitemyappTEttinger: oh I know.
01:55andyfDoes effect typing include things that cannot be expressed as a Haskell type?
01:55bitemyappandyf: IO is *not* the only way to know a function is effectful, it's just the default monad for "outside world" stuff.
01:56bitemyappandyf: it's technically not just effect typing. Monads and the typeclasses that implement cover a vast superset of what you're thinking of, effects are just one of them.
01:56bitemyappandyf: you'd need to give me an example for me to be able to tell you what cannot be expressed as a Haskell type or not.
01:56dsrxmonads can also be used to model burritos, for example
01:56bitemyappI actually have yet to encounter something that is inexpressible.
01:56TEttingerbitemyapp: love
01:56TEttingerwhat is love?
01:58bitemyappandyf: Haskell's type system isn't limitlessly powerful, but only competent Haskell users know where those limits lie. Most of which would be solved by dependently typed langs like Agda and Idris (both participating in the Haskell ecosystem)
01:59dsrxe.g. data Burrito m where RollBurrito :: Meat m => m -> Burrito m
01:59andyfSo here is a maybe-too-trivial question, but if all you cared about was whether a function was pure, or had side effects of type X, or Y, or Z, would you need to become familiar with one or half dozen kinds of monads, or could it be expressed and proved in some other way that doesn't need the concept of a monad?
01:59bitemyappandyf: dependent types can be best summarized (although they reach deeper than that) as types that express constraints on the subset of values the type can represent.
01:59dsrxinstance Monad Burrito where ...
01:59bitemyappsuch as, Int having a dependent type, "OnlyEvenIntegers"
01:59bitemyappandyf: hum. Monads aren't strictly obligatory, they're just so nice and convenient that they're how you box all this stuff up.
02:00bitemyappandyf: hypothetically you could use arrows, but only the psychotic do that.
02:00bitemyappunabomber types.
02:00bitemyappandyf: generally IO is enough if you care about touching the "outside world"
02:01bitemyappandyf: if you care about in-process mutation, it's usually something that is designed to poke at a specific thing like an MVar.
02:01dsrxIO functions are pure with an implicit parameter being the state of the world
02:01bitemyapp^^ lol.
02:01bitemyappone of those "technically correct...not that helpful" statements.
02:03andyfI would guess there is something similar to an MVar, but allows assignment to non-empty locations as well?
02:28ivanis a new line with `nil` the idiom for returning nil instead of the last form's evaluation?
02:28ivanit looks kind of odd
02:28seancorfieldivan: nil is just an expression
02:29ivanwell, of course
02:29TEttingerivan, it seems fine to me
02:29seancorfieldthen maybe I'm not following you?
02:30ivanTEttinger: thanks. thought I might have been missing out on some cool way to throw away the return value
02:31seancorfieldivan: isn't that up to the caller, to decide what to do with the result?
02:31ivantrue; in this case giving the caller a Writer to write to a closed file would have been rather mean
02:31seancorfield(let [_ (call-something 123)] 42) ;;=> returns 42 but also invokes call-something (and throws away the result)
02:32seancorfieldapologies if i came in halfway through a conversation :)
02:32ivanno, nothing above
02:33ivanseancorfield: thanks, forgot I could have done that
02:34seancorfieldor (with-open [r (make-resource :x)] (do-something-to r)) ;;=> closes r but returns result of do-something-to call?
03:14bitemyappivan: 60?
03:14ivanthat's a <
03:16ivanI have been finding jig extremely handy and suggest y'all check it out despite the lack of new announcements on the list
03:16ivanunless you've already got your own jig, but maybe even then
04:45logic_progam I not allowed to use "recur" inside of a try/catch block?
04:48ddellacostalogic_prog: recur has to be in the tail position, and unless you can use a try/catch block as a recursion point, it's doubtful...
04:49logic_progddellacosta: what does "use a try/catch block as a recursion point" mean?
04:49logic_progmy current solution ends up doing something like (let [status (try .... catch ...)] depending on status, figure out how to recur)
04:50ddellacostalogic_prog: so, you need to have your recur go back to a recursion point, which is either a loop or function...not sure what else qualifies (looking it up now). And since it has to be the tail position in that, you'll never be able to put it inside a try/catch block...
04:51logic_progddellacosta: can you point me at the docs you're reading?
04:51ddellacostalogic_prog: ah, sure, sorry: http://clojure.org/special_forms#Special%20Forms--(recur%20exprs*)
04:52ddellacostalogic_prog: what I'm not sure about is what qualifies as a recursion point--maybe let could qualify as well?
04:52logic_progso in short, recur = only where tail recursion would have otherwise worked; recur != goto
04:52ddellacostalogic_prog: yeah, that's my understanding.
04:53logic_progI think "if you did a recurisve call here, it would be tail-call-optimized if jvm supported tail-call-optimiation" = "qualifies as 'recur' recursion point"
04:53logic_progthe cljs compiler could give slightly more informative compile errors, had to binary search to figure out what line of code was causing thi smess :-)
04:53ddellacostaah.
04:54logic_progbtw, out of courisity, given you helped me with crossovers / cljx, what's your occupation? do you use clojure in your daily work?
04:54ddellacostayeah, I was thinking about writing a blog post on more common errors to explain them to newbs (not saying you're a newb, just thinking about the blog post)
04:54ddellacostaseems like it's a sticking point with a lot of folks
04:54ddellacostayeah, I work for a Canadian startup, we do full-stack Clojure
04:54logic_progyeah, someone neds to write a wrapper around the cljs/clj wrappers,
04:54logic_progto regex match the error message and print out a list of 5-10 things you should try to fix it
04:55ddellacostalogic_prog: yeah, that kind of thing could be handy
04:55ddellacostathe thing is, once you get a feel for them they really do seem relatively clear--there are a lot of type errors, or complaints about undefined names and whatnot
04:55logic_progddellacosta: ah, nice, is this part of the waterloo incubator group? (there's some canadian group taht apaprently has been funneling top talent startups to the valley)
04:55ddellacostalogic_prog: huh, I don't think so--but our lead is from Waterloo, so maybe there's a connection?
04:56logic_progyeah, it reminds me the early days of debugging C++ templates
04:56ddellacostaI'm an American working remotely, and I don't know all the details on that.
04:56logic_progafter a year or so, you stare at the mess and go, of course, I should remove that const
04:56ddellacostayeah. But definitely, it is confusing at first.
04:57bitemyappI had a wonderful dinner tonight. Housemates made pasta, turkey meatballs, and marinara.
04:57bitemyappGlass of wine and a brownie dessert too.
04:57ddellacostabitemyapp: nice. :-)
04:57bitemyappBest meal I've had in a long time.
04:57ddellacostajealous, just found out my wife won't be home until 9:00 or later. :-(
04:58ddellacostathinking I'll do a workout then cook myself a sad Christmas dinner. *sniff8
04:58logic_progI ate frozen left overs + listened to talks by Musk, Khosla, and Draper. I win christmas eve right?
04:59ddellacostalogic_prog: haha...sure. :-)
04:59ddellacostalogic_prog: where are you, btw.?
04:59logic_progsilicon valley
04:59logic_progyou?
04:59clojurebotyou are likely to be eaten by a grue.
04:59ddellacostassh, clojurebot
04:59ddellacostalogic_prog: I'm in Tokyo
04:59ddellacostabitemyapp, logic_prog: what time is it for you guys?
04:59bitemyapplogic_prog: hello fellow SV-ite.
04:59logic_prog1:58am
04:59bitemyappddellacosta: 0158
04:59ddellacosta2 AM ish,
05:00logic_progholy shit, our clocks are synched
05:00ddellacostajust realized how easy it was to look it up myself...
05:00logic_progbitemyapp: what startup do you work at?
05:00ddellacostaI suppose you are probably using the same ntp server?
05:00bitemyapplogic_prog: genetics company in SOMA - InVitae.
05:00bitemyappddellacosta: mos' likely.
05:01ddellacostawell, I'm going to take my leave for the time being, do a workout and then consider how I can roast up some chicken thighs...
05:01arcatanthe same ntp server network
05:01logic_progbitemyapp: crunchbase says you guys know how to fund raise
05:01bitemyapplogic_prog: yeah our executive team is baller.
05:02logic_progddellacosta: thanks again for help pointing out the recur issue
05:02ddellacostalogic_prog: sure, glad I could help! Cheers. ;-)
05:02bitemyapplogic_prog: what company are you at?
05:03logic_progi'm a grad student
05:03bitemyapplogic_prog: what school and what subject?
05:03logic_prog*shakes fist* @ startups raising the local rent
05:04bitemyapplogic_prog: pffft, I'm figuring out how soon I can leave the Yay Area - partly because of the rent.
05:04logic_progI think ti's this vicisou cycle
05:04logic_progwhere all cs people are forced to do startups to pay rent
05:04logic_progwhich in turn raises the rent
05:05bitemyappStartups are not a good way to pay the rent.
05:05bitemyapplogic_prog: what school and field are you in as a grad student?
05:05logic_progStanford/CS
05:05bitemyappwell that's borderline typical.
05:05bitemyapplogic_prog: MS or PhD?
05:05logic_progwhat is borderline typical?
05:07bitemyappyou're a bay area resident in #clojure - if not a working programmer, a person doing CS at Stanford seems approriate but not my first guess.
05:09logic_progyeah, statistically, there's also that other school
05:09TEttingersan gabriel valley resident, no degree... I just like clojure
05:09logic_progBerkeley or something
05:09bitemyapplogic_prog: fuck those hippies.
05:09logic_progactually, I tihnk a significant # of stanford faculty are from berkeley, ...
05:10TEttingerhow can you tell, they smell like weed?
05:10bitemyappI reiterate what I said a moment ago.
05:11logic_progokay, finall killed this bug
05:11logic_prognow let's see if code runs
05:11TEttingerkilled it alive
05:14logic_progworked :-)
05:34cYmenGood morning crowd and merry christmas!
05:37cYmenAfter adding a dependency to my project.clj what do I have to do to make my repl aware of it?
05:37logic_progrestart the repl
05:40logic_progis node.js significantly more lightweight than jvm ?
05:41cYmenDamn, I hate doing that. The errors are always so opaque.
05:41logic_progi'm considering having server side also run on node.js since jvm is q bit heavy
05:41cYmenWait, how do I restart the repl?
05:42cYmenC-x k, right?
05:46kilonmerry christmass :)
05:47cYmenMeh, it hangs at "connecting to nrepl on localhost:port"...any ideas what that means?
05:47noneswhat right way to convert `[Ljava.lang.String;` to clojure vector
05:48cYmennones: Not sure what you want to do but you can just use it as a sequence so you probably don't have to.
05:50arcatancYmen: maybe try to start the repl from the command line and see if there are helpful error messages? cd your-project; lein repl
05:50TEttinger,(let [^"[Ljava.lang.String" s "whee"] (vec s))
05:51clojurebot[\w \h \e \e]
05:55arcatan,(vec (into-array String ["a" "b" "c"]))
05:55clojurebot["a" "b" "c"]
05:58cYmenarcatan: That's what I usually do
08:16tzach_,"test clojure bot"
08:16clojurebot"test clojure bot"
08:18troezencYmen: isn't that what alembic is for? https://github.com/pallet/alembic
08:18troezenhaven't used it myself though
08:58pandeiroanyone know what needs to go in the http_proxy environment variable to access repos when behind a proxy? i tried http_proxy= my external IP and that failed...
09:28rovar_awaypandeiro: http_proxy=http://my_proxy:3128
09:29rovar_awaypandeiro: or whatever is the address and port of your proxy
09:31pandeirorovar_away: yeah unfortunately i'm behind a hotel wifi proxy, and no combination i've tried has allowed me to access private repos :(
09:33rovar_awaypandeiro: usually they're just a wall that you have to click through with your browser, then all http/s works..
09:33rovar_awaydunno
09:33pandeirorovar_away: yeah, that is what is happening... EXCEPT for with lein
09:34pandeiroi'm getting 403 Forbidden's back from S3... no idea really, I just saw the message about http_proxy from lein and thought that might be it. Maybe something else entirely.
09:34pandeiroThanks for the help.
09:41rovar_awaycould be the hotel, most likely its the perms on the s3 repo not allowing public access..
10:26Morgawrmerry christmas clojurians
10:29Morgawr,(str (apply str (reverse "samtsirhc yrrem")) " " (reduce str (take 5 (repeat "ho! "))))
10:29clojurebot"merry christmas ho! ho! ho! ho! ho! "
10:29Morgawr:)
10:47cYmen,"merry christmas!"
10:47clojurebot"merry christmas!"
10:47cYmenlook mine's a quine! :)
10:51rovar_awaynow write a clojurebot that writes more clojurebots
10:51rovar_awayone word: skynet
11:36Borland_IslaamAimHere, hey sweetie
12:22arrdemMerry christmass folks!
12:26grandy_hello, i'm curious what the best way to do the following in clojure would be --- i want to read two csv files, "join" them, and output a new one
12:27seancorfieldgrandy_: how big are they?
12:27seancorfield,(doc slurp)
12:27clojurebot"([f & opts]); Opens a reader on f and reads all its contents, returning a string. See clojure.java.io/reader for a complete list of supported arguments."
12:27seancorfield,(doc spit)
12:27clojurebot"([f content & options]); Opposite of slurp. Opens f with writer, writes content, then closes f. Options passed to clojure.java.io/writer."
12:28seancorfieldotherwise you'll need to read/write the first one and then read/append the second one using more low-level Java file I/O stuff
12:29seancorfieldbut (spit "out.csv" (str (slurp "in1.csv") (slurp "in2.csv"))) might be sufficient
12:29kirreanis there a way to attach messages to failing :pre/:post like you can with (assert false "oh no!")?
12:30grandy_seancorfield: a few thosand rows each, ,not big
12:30clojurebotIt's greek to me.
12:31grandy_seancorfield: thanks
13:19devnHappy Day Off Day
13:23edwMy day off is an opportunity to read the GNU Emacs Lisp Reference Manual cover to virtual cover.
15:26davidbeI've a strange error with selmer. https://www.refheap.com/22225 {{profile}} is what I'm passing through and contains address-information. The first two lines of the paste are for testing and work well. I get "street + number" and "zip-code + city".
15:27davidbeBut when passing {{profile.street}} and {{profile.city}} to input, it doesn't pass behond space. So what works in the first two lines, get wrong there. e.g. instead of "Wetstraat 16", I get "Westraat"; and "1000 Brussel" becomes "1000" in <input>
15:44rovar_awaydavid118: enclose your {{...}} in ""
15:44rovar_awaywhen its in html
15:44rovar_awaydavidbe: enclose your {{...}} in ""
15:45davidberovar_away: that helped
15:45davidberovar_away: thanks alot!
15:47mrhankytotal beginner here. how can i access a method from a ns without specifying it's ns? i'll do (:require [ns.sub]), in ns.sub i have a method "test". i want to access test via (test) and not (ns.sub/test)
15:53arcatan(:require [[ns.sub :refer [test]])
15:54arcatanor if you want to refer to all the variables in ns.sub, :refer :all
16:06mrhankythanks arcatan, forgot to mention i'm on clojurescript right now, this wont work as expected
16:08mrhankyanyway, i did some ugly defn, this will work for now
17:02devnI have a map def'd: (def fn-map {:a #(.foo %1 %2), :b #(.bar %1 %2) ...}). I get reflection warnings on all of these because I don't have an annotation on %1. Is there any way to annotate those all programatically, rather than do #(.qux ^BlahBlahBlah %1 %2) a bunch of times?
17:14justin_smithyou could make a macro that creates an anonymous function with the right annotation, if they have a predictable structure especially
17:38arrdemarcatan: did nobody answer you?
17:38arrdemoops. arcatan got it taken care of.
17:45logic_proganyone know of a good library for combining some type of crawling (say net.cgrand.enlive-html or org.httpkit.client) together with core.async ? I want something where (1) there is this channel, where I send it urls, and (2) there's this thread pool of some sort that grabs the urls in parallel, and (3) pushes the contents back onto the core.async channel
18:14bitemyapplogic_prog: httpkit async + callbacks -> core.async channel
18:14logic_progbitemyapp: who manages the thread pool in the above example?
18:15logic_progoh wait, is there no thread pool since httpkit wgets are async?
18:16bitemyapplogic_prog: iunno. read the code.
18:58fredyr_for the clojurescript+react/om interested, i posted a blob post earlier today http://www.lexicallyscoped.com/2013/12/25/slice-of-reactjs-and-cljs.html
19:48Mandaris there a way to bind a symbol conditionnally?
19:48Mandarsomething like (let [x :a if something, x :b if something else] x)
19:49Mandari know i can use a function call to do this
19:49Mandarbut i'm wondering if there's any other way
19:50Mandar(let [x (my-fun)] x) obviously works
19:53TEttingerMandar, if-let ?
19:54TEttinger(doc if-let)
19:54clojurebot"([bindings then] [bindings then else & oldform]); bindings => binding-form test If test is true, evaluates then with binding-form bound to the value of test, if not, yields else"
19:54Mandarif-let only works if if want to bind the var used in the test, doesn't it?
19:55TEttingercorrect...
19:55TEttingerthe simplest way I can think of is
19:55Mandarlet's say i want to do some work with a seq, but filter the seq first if i have a specific parameter (a filter function) given to my function as an arg
19:56TEttinger&(let [x (if true :a :b)] x)
19:56lazybot⇒ :a
19:56Mandaroh yes
19:56Mandarthat's awesome thank you!
19:56TEttingerheh, you almost had it!
19:56TEttingerno prob
19:59Mandarwould have never found it
19:59Mandari'm not used to (if) being something returning a value
20:16logic_prog_ibdknox: why does lighttable use node.js instread of jvm on the server side?
20:25Mandarlogic_prog_ he explains it a bit here http://www.youtube.com/watch?v=V1Eu9vZaDYw&amp;t=19m58s
20:26Mandarbasically, he's using chrome and css instead of coding all the user interface server-side
21:17bitemyappin what universe is lighttable server-side?
21:17bitemyappit's a client application.
21:17bitemyappalso harnessing the browser + clojurescript was a really good idea on his part - JVM is slow for client-apps :(
21:24arrdembitemyapp: yo you had a database you were suggesting as an alternative to Mongo. What was it?
21:34bitemyapparrdem: RethinkDB.
21:34bitemyapparrdem: you need schema-free right?
21:38Mandar(having a server-side IDE i mean)
21:39bitemyappMandar: best example of that is FPComplete.
21:39Mandarbitemyapp, looks nice!
21:41bitemyappMandar: it seems pretty well designed. Backend is Haskell, frontend is JS compiled from Fay (Haskell). I don't use it because I'm an Emacs user, but I recommend it to people that need something shake-n-bake.
21:42Mandarwhen i'm trapped with clients who want me to work from their computers, i often ssh to a remote server just to have vim
21:42arrdembitemyapp: not really.. I may in fact bust out an embedded SQL. Really I'm just building a price time series.
21:43arrdembitemyapp: yeah rethinkdb was the name I was searching for tho. thanks.
21:44bitemyapparrdem: if you use RethinkDB, you should try Revise :)
21:47arrdembitemyapp: hehe bias not withstanding I'll check it out.
21:49arrdemI may just use an EDN serialized file for a while tho... we'll see.
21:52bitemyapparrdem: files are for plebs, but okay :)
21:53arrdembitemyapp: hey now, I'm a Plan 9er. watch yoself.
21:54bitemyappPlan 9ers are also the ones responsible for Go, so they're in my "burn" pile.
21:55Mandarbitemyapp, heh, why do you hate go? :)
21:55arrdemI'll take no credit for Go, but IMHO standardizing on the filesystem as the general system interface is a good thing
21:55arrdemprocfiles and devfiles you have the 9ers to thank for.
21:59bitemyapparrdem: and I'm fine with that.
22:00bitemyapparrdem: but the parsimonious and primitive mindset that improved one thing, ruined another (prog langs)
22:00bitemyappMandar: "How do we make something less versatile and powerful than C, with an equally pointless type system, but less expressive than almost every other language too?"
22:02Mandarbitemyapp, gc + fast compile time maybe?
22:02Mandarbut i don't think it's trying to be a competitor to c
22:03hyPiRionWell, the authors said it was for replacing their C and C++ use, so I'm pretty sure it is.
22:03andreiWhy does clojure want to box up my loop argument? (fn [] (loop [i 0] (if true 0 (recur (+ i 0)))))
22:03MandarhyPiRion, oh
22:03andreirecur arg for primitive local: i is not matching primitive, had: Object, needed: long
22:05ddellacostaandrei: that is bizarre, and I just get 0 each time anyways...not sure what is up
22:06ddellacostaandrei: not sure how that would increment at all, honestly
22:07bitemyappddellacosta: Spent this Christmas with my loved ones this year again - myself.
22:07ddellacostaI'm writing some tests, and I'm mocking out some (mutative) functions using with-redefs, then testing the arguments that get passed into a function inside. Don't like it--anyone have any other approaches?
22:08Mandargood night
22:08ddellacostabitemyapp: I hope you had a good time regardless. At least you know I'll be working and around, so you can always ping me!
22:08bitemyappddellacosta: your morning is about when I usually start coding (1906 here)
22:08ddellacostaMandar: 'night
22:08ddellacostaarrdem: heh, it's noon for me
22:08arrdembitemyapp: your clock is good. god bless ntpd.
22:08bitemyappddellacosta: I talked to my parents on the phone today and yesterday. Good enough for me - for now. I do need to leave the bay area, get some land and dog though.
22:09ddellacostabitemyapp: my wife and I spent most of our Christmas evening looking at videos of frolicking Shiba Inus in Hokkaido snow...looked very very nice. We would like a dog and land too, so I know exactly where you're coming from. That plus fast internet and I'm good, I think...
22:10bitemyappddellacosta: that sounds delightful <3
22:11ddellacostabitemyapp: doesn't it?
22:11ddellacostaif I do say so myself
22:11bitemyappddellacosta: I like big dogs. Rottie/Pit bull and larger.
22:11bitemyappenglish mastiff, if I had my way.
22:12ddellacostabitemyapp: I am a labrador kinda guy myself. But recently started liking (very selectively) some smaller dogs
22:12justin_smithI never got the point of tiny dogs until I moved to the city
22:13bitemyappyou can own certain breeds of large dog in the city.
22:13bitemyappPrimarily great danes.
22:13justin_smithright, but they can be hell on an apartment (and miserable in a small one)
22:13ddellacostayeah, exactly--here in Tokyo you occasionally see folks with great danes, and the mind boggles
22:14bitemyappjustin_smith: great danes? Not particularly compared to most large breeds.
22:14justin_smitha french bulldog can actually get exercise by running circles around an apartment, a german shepherd would break things doing the same
22:14bitemyappjustin_smith: great danes are very chill and low maintenance.
22:14bitemyappjustin_smith: hum, GSDs are high energy working dogs, great danes are not.
22:14justin_smithso not a high energy breed, OK
22:14bitemyappit's not the size, it's the breed and what they were designed for.
22:14ddellacostagood point, probably really depends on the breed...
22:14justin_smithyeah, I have had a shepherd, never had a dane
22:14bitemyappgreat danes are couch thieves, that's about all they do.
22:14justin_smithgotcha
22:14ddellacostabut still, a big dog in a small apartment it just...takes up so much space.
22:14bitemyappso as long as you can shove the massive bastards over, they're fine in an apartment.
22:15ddellacostaheh
22:15andreiddellacosta: What the loop does doesn't matter
22:15bitemyappddellacosta: I think you could manage a single great dane in a studio, honestly.
22:15ddellacostaandrei: okay, well, I'm not seeing the boxing you are
22:15andreiddellacosta: Do you have the appropriate warnings enabled?
22:16ddellacostaandrei: ...no I guess not...?
22:16ddellacostabitemyapp: yeah, but unfortunately we can't have *any* dogs here. :-(
22:16ddellacostabitemyapp: or pets in general. I'd be happy with a cat too.
22:16bitemyappddellacosta: I like cats, but I have a chunk of my psyche devoted to dogs.
22:17bitemyappnot having a dog is like missing a limb.
22:17ddellacostaandrei left
22:17TEttingerso I have some variables I'd like to just spit into a file. the problem is, some are atoms, of maps, containing primitive arrays.
22:17ddellacostawhat warnings was he talking about? I was just searching around and couldn't figure it out
22:18TEttingerpr-str won't produce re-read-string-able output with arrays, is there an alternative way where I could convert these things to vectors and deref atoms?
22:19justin_smithddellacosta: there is a primitives lib that gives warning when numbers get boxed
22:20justin_smithddellacosta: though code like he had should get fully unboxed by clojure
22:20justin_smithhttps://github.com/ztellman/primitive-math
22:20ddellacostajustin_smith: huh, okay...I was very confused by his issue
22:20justin_smithhis loop was clearly faked up (if true) and all
22:21ddellacostayeah, good point...something weird was going on there
22:22justin_smiththe compiler should have seen that i could only be an int (unless it got boxed because it could have gotten promoted / overflowed?)
22:22TEttingerI think literals default to boxed in recent clojure versions, but I can't be sure
22:23ddellacostayeah, I have no idea...I've never ever seen anything like that in Clojure, but I've only been using since 1.3
22:23TEttingerand it would be Long
22:23justin_smithTEttinger: I left my copy of "high performance clojure programming" at work, but iirc the clojure compiler unboxes when it can statically know the arg types
22:24justin_smithand yeah, without a declaration it would default to a long / Long of course
22:25TEttingerso any ideas on how to modify the behavior of pr-str to vec any arrays before printing?
22:27justin_smithI think you need to define print-dup / print-method for the type
22:27allenj12hey i wanted to make a machine learning library for myself for kaggle competitions. but i am having trouble finding a good linear algebra library, i tried using vectorz-clj but it seems to be impossible just to be up and running. are there any better librarys or should i roll my o
22:27allenj12own
22:27justin_smithTEttinger: yeah, there is a print-dup multi-method you can define
22:27justin_smiththat is what pr-str ultimately calls in most cases
22:27arrdemallenj12: roll your own on top of core.matrix
22:27bitemyappddellacosta: do you like to read?
22:28ddellacostabitemyapp: yeah, although lately mostly random scifi and compsci books
22:28justin_smithTEttinger: if the *print-dup* dynamic var is false, then the print-method multimethod is called instead, same deal, define a dispatcher for the multimethod
22:28ddellacostabitemyapp: why do you ask?
22:28bitemyappddellacosta: I "I learned years ago never to argue with a specialist; you can't win. But I also learned that the history of progress is a long, long list of specialists who were dead wrong when they were most certain."
22:28allenj12arrdem: kk seems sad we dont have a ready library yet since clojure seems so great for machine learning
22:28bitemyappwoops, wrong pasta.
22:29ddellacostabitemyapp: haha, good quote though...
22:29bitemyappddellacosta: I really enjoyed this: http://hpmor.com/
22:29bitemyappwhen I first read it, I was enthralled.
22:29bitemyappddellacosta: it does help if you've read the original Harry Potter series though.
22:30TEttingerwizard people dear readers
22:30ddellacostabitemyapp: ah, haha...sounds fun. Not a big Harry Potter fan, but I know I'm not a big fan as I've read all of them...swearing the whole way through.
22:30justin_smithTEttinger: I saw him do that live
22:30justin_smithfucking hilarious
22:31TEttingerheh it's on youtube now https://www.youtube.com/watch?v=xjYPfOnuf9w
22:31arrdemallenj12: yeah... the real issue is that clojure's numeric operations are for the most part strictly slower than Java's due to immutability constraints so people tend to just roll wrappers around Java ML toolkits.
22:33arrdemallenj12: math.matrix is a step in the direction of aknowledging that and mitigating it by making it easy for wrapped (fast) matrix representations to behave like a naive Clojure vector of vectors
22:33bitemyappddellacosta: hum. hpmor has an appeal above and beyond harry potter though.
22:33bitemyappddellacosta: the rationalist spin on it is fascinating and massively entertaining (for me)
22:33ddellacostabitemyapp: oh, it looks like it does, which is why I'm interested in taking a look.
22:34bitemyappddellacosta: it was one of those rare bits of reading where it absolutely hooked me.
22:34bitemyappddellacosta: last thing to hook me like that was game of thrones and the mistborn series.
22:34ddellacostabitemyapp: what's mistborn?
22:34bitemyappddellacosta: Brandon Sanderson fantasy trilogy. Very very well done.
22:35ddellacostabitemyapp: cool, will check it out. Unfortunately, my reading list is...quite long.
22:36allenj12arrdem; interesting.. well looks like im off righting my own. hopefully it wont be too long tho till something just works for atleast simple operations.
22:36justin_smithI've been reading Murakami's "Hard Boiled Wonderland and the End of the WOrld" and it gives me the weirdest programming related dreams
22:37justin_smithlike cyberpunk meets alice in wonderland
22:38TEttingerjustin_smith, uh... do you have any docs on the print-dup stuff? I don't think I've ever used multimethods yet
22:38justin_smithhttp://clojuredocs.org/clojure_core/clojure.core/print-dup
22:39justin_smitha multimethod is a dispatch function plus an implementation for each match
22:39justin_smiththat doc shows how to extend to a new dispatch result
22:40justin_smithprint-dup is the simple kind of multimethod, it just dispatches on the class of the arg
22:40TEttingerright, but arrays aren't classes... right?
22:41justin_smitharrays have a class
22:41TEttingermaybe i could detect the type like "[D"
22:41justin_smithits just that their contents are not boxed objects
22:41justin_smithyeah, that is actually a class
22:43justin_smith,(= (class (double-array [1.0 2.0 3.0])) (Class/forName "[D"))
22:43clojurebottrue
22:44justin_smithit's a class called [D
22:45justin_smithclojure has problems with using that class directly, for obvious reasons
22:49TEttingerwould doubles work?
22:50justin_smith(Class/forName "[D") returns the correct class for the dispatch declaration
22:50justin_smithor does that not work?
22:50justin_smithdoubles is not a class, but a function
22:51justin_smithan inline function that does a cast at compile time
22:52justin_smiththe class [D has a name that can't be referenced the way other classes can, because the clojure reader hates it
22:52TEttingerok, it works now
22:52TEttingerthanks a bunch
22:52justin_smithcool!
22:53justin_smithwas Class/forName sufficient then?
22:53TEttingerI do:
22:53TEttinger(defmethod print-dup (Class/forName "[D") [a out] (.write out (str "#=" `(double-array ~(vec a)))))
22:53TEttingerand now it does work, I can pr-str and read-string
22:54TEttinger(binding [*print-dup* true] (read-string (pr-str (prepare-some-array))))
22:55TEttingerthat seems to work just fine when used like that
22:55justin_smithnice
22:57justin_smithnow that "#=" in the examples finally makes sense - it is constructing the reader macro
22:57justin_smithcool
23:36proteneerthis may be a dumb as hell question - is there an alternative "compiler" that targets C or Python? There was something like clojure-py from a year ago on github but it seems to have died
23:37proteneerany thoughts on clojurec?
23:42justin_smiththere is a python targeting compiler, I don't know how mature it is or what the use case is for really wanting it
23:43bitemyappproteneer: I use clojure-py for some stuff.
23:43proteneeris it worth it?
23:43proteneer(granted I've always wanted to learn FP for some projects, but we develop exclusively in C/C++/Python)
23:44bitemyappproteneer: if you're trying to learn FP, use the language as it was intended.
23:44bitemyappproteneer: specifically if you want to learn FP, use Clojure on the JVM and Haskell with GHC.
23:44proteneerhm interesting
23:44proteneerok
23:45proteneerthough my boss will probably kill me if I try to develop a web framework using Haskell
23:45bitemyappproteneer: "alternative" environments are for people that know what they're doing.
23:45bitemyappproteneer: I don't see why, but for that matter, I'm not sure why you'd need to make your own web framework.
23:45proteneerwell just for fun :P
23:45proteneerright now i'm using tornado
23:46proteneerbut I'm sort of in the state where I need an excuse to learn a new language
23:46proteneer(FP language being one)
23:46bitemyappproteneer: vanilla Ring+Compojure in Clojure and WAI + Scotty in Haskell is my typical recommendation.
23:48proteneerrofl: beam <- param "word"
23:49bitemyappproteneer: structurally, Ring in Clojure and WAI in Haskell are similar.
23:49bitemyappboth involve the use of function composition to "build up" web applications.
23:49bitemyappthey also both act as an interface to specific server implementations.
23:51yediso i have an app that takes text files and does some analysis on it and returns clojure data / edn
23:51yedithe analysis takes a while to do, so i'd like to store/cache both the text and the edn result of the analysis
23:52arrdem$google clojure core memoize
23:52lazybot[clojure/core.memoize · GitHub] https://github.com/clojure/core.memoize
23:52arrdemnext!
23:52yedii'd like to keep the data persisted though
23:53arrdemyedi: this is a repeatedly booted application?
23:53yedii don't think it would be
23:53yediusing a db / text files, and i was wondering if there were simple nosql dbs for edn or if i should just use tedt files
23:54yedii'd like to be able to keep track of the files that have been analyzed so i wouldn't want the data to dissapear if the app goes down
23:56yediare there any really simple edn datastores that don't cost money (like datomic)? if not i'll just use text files i guess
23:56justin_smithyedi: one option is to write a simple and complete input-file -> output-file transform, and for each one you are going to analyze, check for existing output file
23:56bitemyappyedi: Datomic doesn't cost money :|
23:56justin_smithby simple and complete I mean trivially derived from input, and not conflicting
23:56bitemyappyedi: if simple files can suffice, then so can Datomic Free or Pro Starter.
23:56arrdemyedi: yeah I agree with justin_smith here. odds are you'll wind up rolling a custom once-off
23:57yediill check out datomic free, otherwise i'll prolly just go with justin_smith's suggestion
23:57yedithanks