#clojure logs

2015-02-07

00:00sdegutisSuper portable.
00:00Blake1But if I get the core right I could move it to different Clojure VMs and see ... stuff.
00:00sdegutisI'm currently investigating PureScript.
00:02Blake1Int'resting. I thought I would see what untyping this code could do for it.
00:02sdegutisSure go for it.
00:04Blake1For example, one of my utility classes was an integer array, where you didn't have to know the size of the integer in advance. Heh.
00:04Blake1Which strikes me as sort of funny now.
00:06sdegutisHuh. I found where clrnd gone to (from #clojure): http://www.reddit.com/r/haskell/comments/2mr7ks/im_debating_between_haskell_and_clojure_xpost/
00:12Blake1Reddit?
00:12Blake1That's...huh.
00:13Blake1Oh, that's interesting...wasn't someone here saying Haskell was rife with bad decisions that made it dangerous to use? Or was that Scheme?
00:13justin_smithsdegutis: almost forgot, there is also F#
00:14sdegutisBlake1: I imagine that was Scheme.
00:14sdegutisjustin_smith: lol, someone in #ocaml said the exact same thing almost at the exact same time
00:15Blake1So, if I do this thing in Clojure, am I going to get in trouble when it comes to the bit/byte twiddling stuff? Will I have to go into Java?
00:15justin_smithBlake1: you can bit-twiddle in pure clojure
00:16justin_smith,(bit-or 7 (bit-shift-left 42 1))
00:16clojurebot87
00:17Blake1justin_smith: My system uses a lot of byte-arrays, and treats them as lists of bits. Another thing is I load a byte array and treat it as a 1, 2, 4 or 8 byte integer array, depending on certain meta-data.
00:18justin_smithBlake1: you can use ByteBuffer for that
00:20Blake1justin_smith: Cool...well, except for being Java. =P (Which isn't really a problem but pure would be nice. OTOH, if I'm going down to the byte level, impure is...likely.)
00:21tomjackhave you seen ztellman's gloss?
00:22justin_smith,,(.getDouble (java.nio.ByteBuffer/wrap (byte-array [1 2 3 4 5 6 7 8]) 0 8))
00:22clojurebot8.20788039913184E-304
00:22Blake1Is that a personal question?
00:22justin_smithBlake1: the above treats 8 8 bit bytes as one 64 bit double
00:24justin_smithas you might imagine, there are also .getShort, .getInt, .getLong etc. etc. etc.
00:24justin_smithalso the above is 100% free of mutation
00:24Blake1justin_smith: Cool. I feel like this should end up being a lot less code in Clojure than Pascal.
00:25justin_smithwell .getDouble does advance a read pointer but hey that doesn't escape scope at all :)
00:25Blake1tomjack: Thanks for the gloss tip. I'm not doing anything with structures. Everything is the same simple physical shape.
00:25tomjackis e.g. the metadata for the integer size encoded in the bytes?
00:26Blake1tomjack: Actually, no...it's in the filename. =)
00:26justin_smithBlake1: from everything you described so far, you can probably do it all with the bitwise ops plus some very local ByteBuffers that stay local enough for the mutation not to leak (that's why I demonstrated the offset / length args to the constructor)
00:27tomjackah, then your usage of gloss would be even more minimal than I thought. but I think you could avoid touching byte-centric java APIs?
00:27Blake1tomjack: Ah...okay, yeah, I'll keep that in mind. It'd be cool to try this out on various VMs.
00:27justin_smithtomjack: when your domain is bytes, how is byte-centric API a disadvantage?
00:28tomjackmight not be
00:28Blake1justin_smith: Not the byte-centric API, the Java API.
00:28tomjackif I just want to parse an array of integers which is represented weirdly and move on, I'd rather not touch a byte-centric API, though
00:28Blake1justin_smith: Well, this code was very functional to begin with, now that I look at it. Which is kind of cool. Everything was as non-mutating as I could make it in Object Pascal.
00:30justin_smithBlake1: and as I mentioned, other than the read-pointer state (avoided by using the offset / size args) ByteBuffer is not mutating
00:31Blake1justin_smith: Cool. I'll give it a try.
00:32tomjackah, I wasn't reading your messages justin_smith, only Blake1's. that looks better than I assumed ByteBuffer would be
00:32justin_smithtomjack: it's quite direct, you hand it the bytes, and ask for a given type, and there it is
00:32tomjack(still not as 'nice' as gloss to me, but probably nice enough to make me pause before killing my jvm and adding a dep :))
00:32justin_smithheh
00:33justin_smithof course you still might end up doing some bitwise ops if you encoding had non-power-of-two sizes or something
00:33Blake1justin_smith: I could do that for larfs. Compactness and speed was the point of this library, though, so there'd have to be a damn good tradeoff.
00:34tomjackhuh http://ideolalia.com/gloss/gloss.core-api.html#gloss.core/bit-seq
00:34justin_smithBlake1: non-pow-of-2 sizes?
00:35tomjackI expected to find that gloss couldn't handle that
00:35Blake1tomjack: Oh, lol, no! This is for database stuff.
00:35Blake1justin_smith: Yeah.
00:35Blake1This is a DBMS system I developed a few years back. It's sort of like Amazon Redshift.
00:36Blake1This is interesting http://www.reddit.com/r/haskell/comments/2mr7ks/im_debating_between_haskell_and_clojure_xpost/
00:36Blake1sdegutis: Pointed to it.
00:36sdegutisOh.
00:36sdegutisUh.
00:38Blake1sdegutis: lol...sorry? It's interesting, no?
00:38Blake1Or am I being naive?
00:39sdegutissure
00:39justin_smithhe's just lucky he posted it during permitted haskell evangelism hours
00:39Blake1hahahah
00:42Blake1I'm intrigued by the backlash against dynamic typing I'm seeing these days. I would've figured it was destiny--well, ten years ago or more, I figured it would take over.
00:54sdegutisBlake1: static typing with type inference and reasonable polymorphism has all the same benefits of dynamic typing with none of the drawbacks
00:55sdegutisBlake1: you can usually write just as little code, worrying just as little about types, and also have assurance that it won't compile if there's a type error, instead of failing at runtime
00:55sdegutisBlake1: oh the other hand, Clojure often fails at runtime for me (while I'm doing TDD) which means I have to wait like 20 seconds while my whole test suite runs just to find out I made a simple typo.
00:56Blake1sdegutis: Static typing that you, the programmer, don't actually do, then?
00:57sdegutisBlake1: static typing simply means your types can be definitely known by looking at your source files, without actually running them
00:57sdegutisBlake1: it doesn't mean you actually *write* the types down in those source files
00:57sdegutisBlake1: hence type inference
00:57sdegutisBlake1: and yes, writing type names down in source files is annoying; fortunately we don't have to, thanks to type inference
00:59vasjustin_smith: hey man, thanks for helping me figure out the csrforgery protection stuff. turned out i just needed to change def app to use "wrap-session" and ring does the rest :]]] (def app (wrap-session app-routes site-defaults))
00:59Blake1sdegutis: I haven't had any problems with dynamic typing in Clojure, apart from my original feeling of working without a net (when I learned Smalltalk in '92).
00:59sdegutisBlake1: welp.
00:59Blake1sdegutis: But if you're not stating the type, isn't there still the issue of the compiler inferring a type different from what you meant?
00:59tomjackI don't think it has _all_ the same benefits
01:00sdegutistomjack: oh?
01:00sdegutisBlake1: that usually doesn't happen
01:00Blake1sdegutis: (I ask from ignorance, not having used any tools that did =good= type inference.)
01:01sdegutisBlake1: meh, I often end up documenting the argument/return types in my Clojure apps anyway
01:01sdegutisBlake1: so it doesn't hurt me any to add it in function signatures
01:02tomjackright, if you want to not worry about types, I don't think you go for Haskell :)
01:03Blake1sdegutis: Well, I need to play with it, 'cause I'm not getting it. Does core.typed do inference?
01:03Blake1tomjack: But it's so much better, apparently. =P
01:04sdegutisBlake1: I never said it's better
01:05Blake1sdegutis: Oh! No, I didn't mean you! I was talking about that reddit page.
01:05sdegutisOh.
01:05sdegutisAnyway.
01:05tomjacksdegutis: basically it's missing the (possible) advantage of "not having to understand how to work with a static type system", I think?
01:06sdegutistomjack: I'd argue that's not a thing in the first place
01:07sdegutistomjack: working with a static type system, in comparison to working with a dynamic type system, just means knowing to look for errors in the console instead of in backtraces
01:07sdegutistomjack: either way, you're still working with a type system, and type errors will surface *somewhere*
01:07tomjackyes, understanding the meanings of those errors, and making the requisite changes, is what I meant by "working with a static type system"
01:08sdegutistomjack: sure, but using that definition, there's a huge variance in static type systems
01:08sdegutistomjack: some give horrible errors, some give extremely good ones
01:08tomjackbut regardless, I need to understand a type system, no?
01:09sdegutistomjack: Not any more than you do with a dynamic type system.
01:09sdegutisdynamic system: "error: tried to call method "append" on a string object"
01:10sdegutisstatic system: "error: no method "append" on a string object"
01:10tomjackanyway, it's moot to me, because I _do_ want to worry about types, and want something better than Haskell. just confabulating about why I seem to prefer Clojure to Haskell, I guess
01:10sdegutistomjack: In what way do you want something better than Haskell? Also, in what way aren't you satisfied with Clojure?
01:11tomjackI want total dependently typed, and Clojure isn't
01:11tomjackthough given the choice between Haskell and Clojure (which I am), I seem to choose Clojure for some reason.. hmm
01:11Blake1dependently typed?
01:12sdegutistomjack: I do too, to be honest.
01:12sdegutistomjack: re: choosing Clojure
01:12tomjackBlake1: my personal confabulation is that haskell's type system is not expressive enough (too restrictive), and Clojure stays out of my way. dependent types are more expressive
01:13sdegutistomjack: that said, I really want to find a new favorite language that isn't tied to the JVM, also a language that's statically typed, which is why I'm not satisfied with Clojure
01:13tomjacka Clojuresque LISP, maybe?
01:13pdkc++ meets both criteria!
01:14justin_smithsdegutis: I don't get why you'd come here looking for it
01:14sdegutisjustin_smith: I don't think I was?
01:14sdegutisjustin_smith: oh yeah I totally was, now I remember
01:15sdegutisjustin_smith: I came here for that cuz when people like you and technomancy are here, I get good answers ;)
01:15justin_smithhehe
01:15sdegutis(his answer is "OCaml")
01:15Jaoodtomjack: what language with the dependent types have you use? idris?
01:16Jaoodwhy did techomancy left #clojure?
01:16Jaoodhe seems to be in the network
01:16tomjackJaood: not yet. I want a LISP so it's mostly Clojure for me for now
01:27tomjackalso I want good set/map/vector builtin data structures with literal syntax... :(
01:33tomjackthe set and map API should only optionally assume = is decidable for the key type. if it's not, count should be impossible, but one should at least be able to get an upper bound on the number of elements. that bound should be 1 for the set of functions #{(fn [x] x) (fn [y] y) identity}, and probably 2 for #{#(+ %1 %2) #(+ %2 %1)} (though the count of that is actually 1). seq shouldn't work unless you prove that your reduction over the
01:33tomjackseq is idempotent... etc
01:33tomjackthis is maybe why I don't use Haskell, I think :)
01:38Blake1tomjack: What's the advantage of built-ins here? I thought the point (again, I'm a naif) here, at least in part, is that you can add that stuff in yourself.
01:56tomjackwell, e.g. {:foo 1 :bar 2} should be in the syntax, and you shouldn't be able to magically define new syntax like {k v ...}
01:57tomjackyou could maybe do like Agda and allow the user to bind a datatype with certain operations to that syntax, but that's a mess
01:58tomjackif you have two Agda libraries which bind the same builtin syntax to different data structures, you're, uh, gonna have a bad time
01:58tomjackit's the "batteries-included" principle seen in Clojure and EDN I guess
01:59Blake1Sorta the same issue in any language where "you can always roll your own!"
02:03dagda1_I've been trying to solve this project euler problem https://www.hackerrank.com/contests/projecteuler/challenges/euler007 to display the nth prime number, I've tried multiple versions and they all work but they time out
02:04dagda1_here is my latest which is still too slow https://gist.github.com/dagda1/98caf10b195adda97f27
02:18Blake1Jaood: I believe he's doing charity work.
04:24dysfunJaood, Blake1: yes, he's off doing charity work in africa. he wrote a blog post about it recently
04:55kirQuestion about (doc ) : Is there some way to replace the docs with my own notes, without modifying src - explanations provided seem arcane to me?
04:56dysfunno, but you can fake it with an atom of alternative docs and a new function that maps one to the other
04:57dysfunbut it's probably not the most useful thing
04:57dysfunbetter to keep a snippets file somewhere to demonstrate how to do things you currently find confusing
04:57dysfunand to ask questions of course
04:58dysfunthe docs are a little...behind where they should be right now
04:58dysfunthere are some great alternative resources on the internet
04:58kirdysfun : I have extensive notes, but those functions (doc ), (find-doc ) are very convenient in the REPL
04:59dysfunwell you could start with a map inside an atom
04:59dysfunif you want the same calling convention as doc, it'll have to be a macro
05:00kircould you provide a brief example please?
05:01dysfun,(def my-docs (atom {}))
05:01clojurebot#'sandbox/my-docs
05:02kirI get the idea, and I'll need to load that map on reloading of the REPL
05:02kirthx
05:03dysfunah well i was going to continue but since you get the idea :)
05:03dysfunthe doc things come from an nrepl middleware fyi
05:03dysfunso you can use the same thing to load yours
05:04kirgreat
05:04dysfunjust remember to map fully qualified symbols as the key
05:04dysfunbecause otherwise you won't be able to use it without loading all the namespaces
05:05kirmakes sence, thx.
05:06dysfunand hence why it should be a macro rather than a fn, otherwise you'll have to call it like (my-doc 'my-fn)
05:07dysfunyou'll need to do some magic to map symbols to the fully qualified form
05:08kirI enjoy challenges/magic :)
05:09dysfunlikewise, although i seem to have bitten off a bit too much magic to chew recently
05:10dysfunthe clojure cheatsheet contains most of the functions you'll need though so it should be pretty straightforward
05:22dysfunyw
07:52justin_smith,({+ "adds all the args"} +) ; dysfun: without a macro
07:52clojurebot"adds all the args"
07:57justin_smith,(do (alter-meta! #'+ assoc-in [:doc] "adds all the args") (doc +))
07:57clojurebot"([] [x] [x y] [x y & more]); adds all the args"
07:57justin_smith^^ you can totally replace the doc strings
07:58justin_smithdysfun: also, technomancy isn't in Africa, he's in Thailand
08:02luxbockdoes technomancy still use IRC? I think he might be living in the same city as I do
08:09hyPiRionluxbock: yeah, but he recently moved, so he's probably a bit busy right now
09:10LauJensen/msg LauJensen test from LT
09:10LauJensen...
09:12ThingamagikFrom Clojure I insert like SET dt = "2015-04-01". Then I get the line "select .... where dt="2015-04-01" and get the same line back with all values intact, except dt which is now "2015-03-31". In SQL its type DATE. Any idea why?
09:14gfredericksThingamagik: smells like time zones
09:14justin_smithgfredericks: yeah, that was my first thought too
09:16expezrepl fails to start, lein deps :tree suggests over 100 exclusions, what's the best way to proceed?
09:16justin_smithexpez: don't use so many deps?
09:17justin_smith(just being glib - I have no idea)
09:18expezbetween the project and the tooling the transitive dependencies a significant fraction of all code ever written for the jvm
09:20LauJensengfredericks, Timezones?
09:21justin_smithLauJensen: typically a date is stored as a timestamp for midnight that day
09:21LauJensenAh, so its getting pushed one hour?
09:21LauJensenBest way to remedy?
09:22justin_smithLauJensen: bad timezone code can erroneously push the timestamp onto the wrong date
09:22justin_smithLauJensen: is the db local to your machine?
09:22LauJensenYes
09:24justin_smithI was going to suggest making sure the server and host time zones and clocks were set up properly, but everything being on the same machine rules that out
09:55imanc_is it possible to use destructuring in a recur func, or is it limited to let/fn etc.
09:56justin_smithimanc_: you mean loop? you can destructure loop bindings
09:56csd_How can I make CIDER automatically load my test namespaces when I load a project?
09:56imanc_I actually want to destructure in the recur bit - but perhaps i'm thinking about it wrong and need an inner (let) block or something
09:57justin_smithimanc_: wat
09:57justin_smithit makes no sense to destructure the recur call - there is no way that would be helpful
09:57justin_smithdestructuring is for the binding vector
09:58justin_smithyou don't need a let block, you need the destructuring to happen where the bindings are
09:58justin_smith,(loop [[a & r] (range)] (if (= a 4) (first r) (recur (rest r))))
09:58clojurebot5
09:58imanc_yeh, OK makes sense. Basically I have a func that returns a list of two lists. and I need to input each list back into recur, but I realise I can use (let) inside the loop to destructure the the results into two var to pass back into ercur
09:59imanc_hmm
09:59justin_smithimanc_: put the destructuring where the bindings happen (in the arg list of the function in this case)
10:00justin_smith,((fn [[a & r]] (if (= a 4) (first r) (recur (rest r))) (range))
10:00clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
10:00justin_smithoops
10:01justin_smith,((fn [[a & r]] (if (= a 4) (first r) (recur (rest r)))) (range))
10:01clojurebot5
10:02csd_justin_smith-- do you know if it's possible to have cider load a project's tests when doing cider-jack-in? right now i have to manually load each test clj
10:03justin_smithcsd_: cider should have a command for that - have you tried emacs' apropos command?
10:04csd_i'm looking through the commands listed in the github docs-- they all assume the tests are already loaded into the repl
10:04csd_figured there might just be something i need to put in my project.clj
10:06justin_smithcsd_: this is close, but not quite https://github.com/clojure-emacs/cider/blob/master/cider-test.el#L438
10:07justin_smithit just runs tests for the current context
10:08csd_do you use cider yourself?
10:08justin_smithcsd_: I did for a while, I gave up on it and just use inferior-lisp now
10:08csd_why did you give up on it?
10:08justin_smithtoo frequent breakage
10:09justin_smithI'd rather have fewer features
10:09csd_i would be a lot less effective using inferior lisp
10:09justin_smithrather than updates making things not work
10:09justin_smithOK
10:09justin_smithI manage alright
10:10pandeirothere's no existing feature expression support in master currently right?
10:10justin_smithpandeiro: no, it's in the 1.7 alphas
10:10justin_smithpandeiro: though cljx is a lein lib
10:11pandeirojustin_smith: sorry - that means what? i still need to use cljx?
10:11justin_smithpandeiro: or use the alphas
10:11pandeirojustin_smith: alphas are fine! trying to find a link to how to enable it
10:12julianlevistonooh does that mean stuart might be reworking component for cljs support?
10:12justin_smithpandeiro: http://mvnrepository.com/artifact/org.clojure versions are listed here
10:13pandeirojustin_smith: thanks, i already am working off alpha5 in my project
10:13justin_smithoh, I misunderstood
10:13pandeirojulianleviston: no idea but there's a cljs port
10:13pandeirojustin_smith: i found this https://github.com/levand/fx-hello-world -- looks like it might be what i need
10:13pandeiroi just don't get what i have to do, exactly :)
10:14justin_smithgot it
10:14julianlevistonpandeiro: yeah, I did one.
10:14pandeirojulianleviston: ah is that yours? sorry
10:14julianlevistonpandeiro: prolly not the one you’re thinking of...
10:14julianlevistoni just forked it
10:14justin_smithpandeiro: ahh there's a modified leiningen to work with the feature expressions
10:14pandeirojulianleviston: there are several yeah, i noticed
10:14pandeirojustin_smith: !!!
10:14pandeiro*that* is the info i was after -- so it doesn't work w/ regular lein?
10:15justin_smithpandeiro: it's listed on the page you linked
10:15julianlevistonare feature expressions even stable yet?
10:15julianlevistonI guess so coz there’s a diff… http://dev.clojure.org/jira/browse/CLJ-1424
10:15justin_smiththey are in the alphas :P - you need a forked lein for lein test or aot to work with feature expressions
10:16julianlevistonseems to still be heavily under dev.
10:16julianlevistonseems a bit broken to me.
10:17julianlevistonI don’t think #+cljs is a feature, is it? lol.
10:17justin_smithjulianleviston: that's the feature expression syntax
10:17julianlevistonjustin_smith: yeah, but cljs is not a feature, it’s a language.
10:18pandeirojulianleviston: guessing the terminology came from common lisp
10:18julianlevistonpandeiro: yep.
10:18pandeirolike interns
10:18justin_smithjulianleviston: feel free to put in a pr to change them to "semantics expressions"
10:18julianlevistonjustin_smith: that’s a bit broken too
10:18pandeirojustin_smith: 'awesome tags'
10:18julianlevistonjustin_smith: language markers would make more sense
10:18julianlevistonhaha :)
10:19justin_smith"super pedantic about semantics expressions"
10:21julianlevistonkind of thought the difference mattered, actually.
10:21julianlevistonall good, tho. :)
10:21justin_smithjulianleviston: I suggested "semantics expressions" as a joke, and you set me up to escalate the joke, sorry :)
10:22julianlevistonjustin_smith: oh it was a joke? i didn’t realise sorry :)
10:22pandeirodo you guys have a 'feature expressions' branch in your clojure repo?
10:22justin_smiththe idea being that the expressions describe sementics, and then you are questioning the semantics themeselves etc.
10:22justin_smithI found that funny in an odd way
10:23julianlevistonjustin_smith: but the expressions don’t describe the semantics… they name the target (or selected) language. I guess that’s why I missed the joke.
10:24justin_smithjulianleviston: they aren't just for language switching
10:24julianlevistonjustin_smith: oh?
10:24justin_smithjulianleviston: the examples also switch code for prod / dev
10:24justin_smithfor example
10:24julianlevistonjustin_smith: ew.
10:25julianlevistonjustin_smith: really? environment switching? guh that seems like a terrible thing to do
10:25justin_smithjulianleviston: you list an arbitrary set of "features" as a system property, and that guides the tags turning forms on / off
10:25julianlevistonjustin_smith: ah ok… that might end up being sane.
10:25julianlevistonjustin_smith: I’d be pretty suprised if it wasn’t given who was working on it...
10:26justin_smithso anyway, one special case is turning off lines of code that don't work in clj-java/ cljs/ clj-clr, but that is not their only usage
10:26julianlevistonjustin_smith: seems a little open to abuse tho… but time will tell I guess.
10:26justin_smithjulianleviston: we have so many features that are open to abuse, but we also have good community standards
10:27julianlevistonjustin_smith: the standards protect it from abuse. This seems still open to me. Just my opinion tho, really.
10:27justin_smithI mean anything in clojure.core (beyond the reader macros) can be pretty freely mutated and replaced at runtime. But we don't do that, because we aren't idiots.
10:27justin_smiththe standards are informal
10:28julianlevistonjustin_smith: sure. However here it would seem that people are going to use this by putting runtim selection info in it, which doesn’t seem like it has a very long view of the fture in mind.
10:28justin_smithit's trivial to access the underlying array of a persistent vector and mutate it, but once again, we are smart enough to know not to do it.
10:28julianlevistonruntime selection as in #+cljs / #+clj
10:29julianlevistonjustin_smith: having overloadable symbols/forms for each language would make more sense to me.
10:30julianlevistonjustin_smith: where you can overload on the language.
10:30julianlevistonjustin_smith: but I haven’t been in the hammock… :)
10:30justin_smithjulianleviston: some things just make sense in cljs but not clj, and to some degree visa-versa
10:30julianlevistonjustin_smith: yeah, I agree…
10:31julianlevistonjustin_smith: that’s in accord with what I reckon would be better.
10:31justin_smithjulianleviston: I mean, do we replace our current straightforward jvm interop with an abstraction that is guaranteed to work on any backend? that seems foolish
10:31clojurebotTitim gan éirí ort.
10:32justin_smithjulianleviston: though if that's the sort of urge for abstraction one wants, Haskell and friends do aim for that
10:32julianlevistonjustin_smith: mmm
10:33julianlevistonoh well, it’s night from me. :)
10:33julianlevistonthanks for the chat
10:33julianlevistonas always.
10:33justin_smithnp
10:43gfredericksanybody know an easy way to create a bmp/png file from scratch? like specifying each pixel?
10:44TEttingergfredericks: I don't know of any particularly easy ways on their own. AWT has setpixel and you can save a Graphics to a png or bmp
10:45TEttingersetPixel is extremely slow compared to drawing other textures, plus it's software rendered
10:45justin_smithgfredericks: setting pixels in png is tricky because it's a compressed format
10:45gfredericksjustin_smith: sure if I wrote something by hand I'd do bmp
10:46justin_smithgfredericks: but you can use the java awt image classes to get the png into an array, and set the pixels followed by exporting again
10:46justin_smithbut nothing that isn't datamosh is going to edit a png in place without an extraction/ recompression
10:46gfrederickssounds likely easier than figuring out the dang bmp header
10:46TEttingerI used to use a method in C# that drew a 4x4 pixel texture about 8000 times per sprite I was making. it was very slow. now I write to a byte buffer, and then slap that directly into memory using the Marshal class in C#. which only works because .NET has direct memory
10:46justin_smithgfredericks: heh, yeah
10:48ffwacomSup fuckers
11:10hyPiRion,(let [a (atom 0) inc! #(swap! a inc)] `#{~(inc!) ~(inc!)})
11:10clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: (clojure.core/unquote (inc!))>
11:10hyPiRionmy life is shattered
11:11hyPiRionWell, I guess I didn't even need to syntax-quote that to show the problem.
11:23gfrederickshyPiRion: man your life must've been super fragile
11:28hyPiRiongfredericks: I realised it's possible to bypass the problem, so I am fine now
11:29hyPiRion,`#{~(+ 2 3) ~(+ 3 2)}
11:29clojurebot#{5}
11:29hyPiRioneventually wrap some identities.
11:29justin_smith,(let [n 0] #{n (do n)})
11:29clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: 0>
11:30justin_smitherr, OK
11:30justin_smith,(let [n 0] `#{~n ~(do n)})
11:30clojurebot#{0}
11:30hyPiRionjustin_smith: you must syntax-quote it
11:30justin_smithright
11:30hyPiRion,'`#{}
11:30clojurebot(clojure.core/apply clojure.core/hash-set (clojure.core/seq (clojure.core/concat)))
11:30justin_smiththe opposite weirdness ;)
11:31justin_smith,`#{~@[1 1 1 1 1 1 1 1 1]}
11:31clojurebot#{1}
11:32hyPiRionhm
11:32hyPiRion,`#{~@(repeat 1)}
11:32justin_smithhaha
11:32clojurebotExecution Timed Out
11:33hyPiRionoh right, that's not at read time
11:35hyPiRion,'#(%1e10)
11:35clojurebot#<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>
11:35justin_smithoh, that's a fun one
11:36hyPiRionHm. I hope I didn't crash the whole thing by doing that :x
11:36hyPiRion,1
11:36clojurebot1
11:37justin_smithI wonder if that is one of those things, where if you made the mistake of catching throwable you'd be worse off than if you just let the exception go to the top
11:43hyPiRionhm, maybe
11:43hyPiRiondepends on how OOM is handled, I guess
11:46hyPiRionI am confused
11:46hyPiRion,(meta ^nil {})
11:46clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Metadata must be Symbol,Keyword,String or Map>
11:46hyPiRion,(meta ^+ {})
11:46clojurebot{:tag #<core$_PLUS_ clojure.core$_PLUS_@41996713>}
11:47hyPiRion+ is not a symbol, kw, string or map
11:48justin_smithhyPiRion: clearly the error message should say IObj
11:48hyPiRionI guess it makes sense if you consider it at read time.
11:48hyPiRion,(let [x nil] (meta ^x {}))
11:48clojurebot{:tag nil}
11:48hyPiRionnot sure if it's sensible though
11:50hyPiRionI guess it should say Class instead of Symbol to make sense.
12:13gfredericks,(defn uniformize-random-bits [bits] (->> bits (partition 2) (keep {[0 1] 0 [1 0] 1})))
12:13clojurebot#'sandbox/uniformize-random-bits
12:13gfredericks^ love how elegant that is
12:23justin_smith,({[0 1] [1 0]} '(0 1))
12:23clojurebot[1 0]
12:56creeseIn cider, output from println goes to server log but not to the repl. Is this expected behavior?
12:58justin_smithcreese: this is because you lost the binding of *out*
12:59justin_smithcreese: if you had created a future instead of using Thread directly (of if the thing you used did so...) that would be automatic
12:59justin_smithbut you can make or pass in some binding of *out*, and use that binding explicitly, to make things print to the repl in cider
13:01justin_smithcreese: the issue is that when a process is created in emacs, its stdio is attached to a buffer (the one cider uses as the *nrepl-output* buffer), but cider overrides *out* with a dynamic binding to make things print into the repl buffer
13:02justin_smithcreese: but because of how dynamic bindings work, sometimes if you create a new thread, they get the root value of the binding (that stream to print to the hidden by default buffer) instead of the newer thread-local repl binding
13:02sharmsIf I have a file, a.clj which runs fine, and I require it in b.clj, when I run my function it tells me it can't find a variable the function is looking for when called from b.clj
13:03sharmsI can fix it by adding an additional require statement, but could someone explain to me while having the require statement in a.clj isnt sufficient?
13:03justin_smithsharms: because we have namespaces, and that's how namespaces are intended to work
13:03sharmsjustin_smith: I am having trouble googling my way to understanding this - but I dont want to duplicate all of my require statements in b.clj, or is that pragmatic clojure?
13:04justin_smithsharms: if you are replicating all the required libs, whey are they even separate namespaces?
13:04justin_smithwhy not put everything in a?
13:04justin_smiththe idea with a namespace is that you can see explicitly in your clj file where the things you are calling come from
13:04justin_smithno magic
13:04justin_smithno transitive bindings
13:04brucehaumanguys I’ve struggled a bit with finding good cljfmt settings for Emacs, link anyone?
13:05justin_smithbrucehauman: cljfmt is super new, right?
13:05sharmsjustin_smith: a.clj is a model file, and b.clj is my swagger file - so I may have like 20 a.clj's and I would hate to take all of that and put them in a single file
13:05arrdemjustin_smith: yep.
13:05sharmsI just want to reference each model type without importing all of the things they already import
13:06creesebrucehauman: doesn't clojure-mode take care of this?
13:06brucehaumanjustin_smith: I’m really not that sure. But I’m definitely not liking how its indenting
13:06arrdembrucehauman: cljfmt is new in the last month or so, I'd be amazed if you can find non-default indentation settings floating around.
13:06justin_smithcreese: I don't think there has been a clojure-mode release since cljfmt was written
13:06brucehaumanarrdem: thanks !
13:06arrdembrucehauman: clojure-mode has a perfectly good indentation engine as well
13:06brucehaumanI’m using clojure-mode
13:06justin_smitharrdem: well, indentation, but not formatting
13:07arrdemjustin_smith: betweent the style guide, whitespace-cleanup (for which I'm happy to share my config)
13:07arrdemand clojure-mode I don't see what else you need.
13:07justin_smithsharms: typically I have between 3 and 10 requires in each namespace. Many of them are the same between namespaces in the same project.
13:07brucehaumanarrdem: would love to see you config
13:07t0What do you think about learning Clojure as a first programming language?
13:08arrdemt0: it can be done to be sure but Clojure seems to be a 2nd or 3rd language after some Java.
13:08justin_smitharrdem: cljfmt can take a piece of code with any given whitespace weirdness and bad line breaks and reformat, nothing in clojure-mode does that (it just indents) so that's less automatic
13:08brucehaumant0: I might suggest Scheme or Racket
13:08arrdemjustin_smith: sure
13:08arrdemt0: racket definitely
13:08arrdem<3 raket
13:08sharmsLet me try a different way: a.clj: (defn testfunc [x] (somelib/somefunc x) works fine. b.clj: (:require [core.a :as shortcut]) (shortcut/testfunc x) -- In this scenario calling it from b.clj wont work without importing somelib in the require statement of b.clj - this is as intended and there isnt a better way?
13:09justin_smithwhat?
13:09clojurebotwhat is your favorite number
13:09arrdembrucehauman: on windows right now but lets see if I can get this to you...
13:09martinklepschWhat's the right way to prevent Leiningen plugin deps from leaking into library consumers? using :scope "test"?
13:09brucehaumanarrdem: thanks
13:09justin_smithsharms: after requiring a from b, you can call testfunc without requiring what a does
13:10justin_smithb does not need to reference a's deps at all, unless it explicitly uses them
13:10sharmsok thats what I thought, but it appears to be my error - it says 'Unable to resolve symbol:'
13:11sharmsI must be just overlooking something
13:11justin_smithOK
13:11noonianI think Clojure is a fine first language to learn, but not as simple as scheme to be sure.
13:11brucehaumant0: The reason Clojure isn’t a good first language is because it is hosted in another language. Racket and or JavaScript are better ways to start.
13:11justin_smithsharms: do you literally have (:require ...) at the top level of b.clj?
13:11justin_smithbecause that will silently do nothing at all
13:12justin_smith,(:require ["whatever" "this" "does" "nothing"])
13:12sharmsjustin_smith: its inside of a (ns some.namepsace (:require ...
13:12clojurebotnil
13:12justin_smithsharms: oh, OK, just double checking :)
13:12sharmsNo I appreciate the help, clearly I am missing something simple and fundamental
13:13t0brucehauman: Thank you. I'm interested in learning programming with a functional language first
13:13justin_smithsharms: feel free to share a paste on refheap
13:13t0racket seems like a good choice
13:13gfredericksjustin_smith: wouldn't it crash?
13:13justin_smithgfredericks: what would crash?
13:13justin_smithahh, unbound symbols in the vector
13:13justin_smithyeah
13:13gfredericksjustin_smith :require at top level
13:14arrdembrucehauman: https://www.refheap.com/97032
13:14brucehaumant0: Thats a very enlightened perspective.
13:14gfredericks,(:require clojure.string) ;; justin_smith
13:14clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.string, compiling:(NO_SOURCE_PATH:0:0)>
13:15brucehaumanarrdem: thanks :)
13:15justin_smithgfredericks: yeah, good point
13:15arrdembrucehauman: I also think you need to setq tabs-<something> nil so that indentation is spaces
13:15sharmsjustin_smith: https://www.refheap.com/97033
13:16sharmsjustin_smith: I started learning clojure last week, so I am guessing I am just missing something super simple / core concept
13:16brucehaumanarrdem: thanks, giving it a try
13:17sharmsjustin_smith: The error itself ends up on the line of (swaggered "businesses" ... which I think I dont need to explicitly import since a.clj already contains it, and I dont reference it directly from b.clj
13:18arrdembrucehauman: just to clarify, that's a pasted .dir-locals.el file
13:18arrdembrucehauman: you can't just slap that in your .emacs and have it work.
13:18justin_smithsharms: either add (:import service-catalog-api.business Business) to the b.clj ns form, or explicitly qualify the package of the Business class
13:18arrdembrucehauman: https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html
13:18brucehaumanarrdem: thanks for the clarification
13:18justin_smitherr, I missed some parens, sorry
13:19justin_smithsharms: (:import (service-catalog-api.business Business))
13:19arrdembrucehauman: just thought I'd save you some confusion before I buzzed off :P
13:19brucehaumanI really appreciate it
13:19sharmsjustin_smith: ok so even though b.clj has no reference to Business, because I require a.clj and am calling a function from a.clj that references it, I need to require it in b.clj?
13:19justin_smithoh, wait...
13:21justin_smithI missed that you weren't even referencing Business
13:22justin_smithmaybe there is something weird going on with how the defroutes* is being expanded in b.clj
13:23justin_smithwell no, because it should be fully expanded in the first one
13:23justin_smithhmm
13:23sharmsjustin_smith: I havent run into this before so my suspicion is swagger magic
13:23justin_smithyeah, could be a bug in their macro
13:24sharmsI just wanted to make sure I understood the core concepts, being new to clojure, that maybe I didnt understand name spaces
13:24justin_smithbut you can likely at least prevent the bug from triggering by importing Business in that ns
13:24sharmsthank you so much for the help
13:24justin_smithnp
13:24justin_smiththat's really good for someone so new to clojure, btw
13:24justin_smithnot your first lisp I assume?
13:25bacon1989I was wondering, is there any support for clojureclr within leiningen?
13:25sharmsjustin_smith: I know a bunch of non-lisp languages and I did watch a few videos with SICP before taking a swing at making a test api
13:25bacon1989From what I can tell, there isn't as far as I know
13:26sharmsjustin_smith: Also I notice on github that when they do it in the examples, they use :refer :all so swagger must be expecting that
13:26bacon1989So I was wondering how difficult it would be to get clojureCLR working in leiningen
13:26bacon1989would it be a huge untertaking for me?
13:26justin_smithbacon1989: I recall seeing lein plugins that do clr stuff
13:27justin_smithsharms: the name "Business" led me to believe that it was a class being generated, and not a var
13:27justin_smithsharms: if it's a class it would need to be imported, if it's a var it would need to be referred / used
13:28justin_smithsharms: which reminds me, the convention is that capitalization is for things that generate classes, usually (though I am aware prismatic/schema also has its conventions etc.)
13:28bacon1989There's this https://github.com/kumarshantanu/lein-clr
13:28martinklepsch:profiles {:dev {:plugins [[com.cemerick/austin "0.1.6"]]}} — having this in a library, how can I ensure this does not end up being loaded as transitive dependency?
13:29sharmsjustin_smith: Ok that makes sense thanks
13:29justin_smithsharms: yeah, never mind, schema expects caps, but that's weird in the clojure world, so just expect people might misread things
13:29justin_smithso it is a var, just capitalized
13:30gfredericks,(def LOWER-CASE? false)
13:30clojurebot#'sandbox/LOWER-CASE?
13:30justin_smithhaha
13:30gfredericks,(def unbound)
13:30clojurebot#'sandbox/unbound
13:31gfredericks,(def reflexive #'reflexive)
13:31clojurebot#'sandbox/reflexive
13:32justin_smith,(def def def)
13:32clojurebot#'sandbox/def
13:33gfredericks,def
13:33clojurebot#<Unbound Unbound: #'sandbox/def>
13:33justin_smithoh wow, that is better than expected
13:33gfredericksis there anything else it could do?
13:34gfredericksor did you expect an error?
13:34justin_smithI naively expected sandbox/def would be assigned the value of clojure.core/def which is of course wrong, because def creates the var before the form is evaluated so by that time def refers to itself
13:35Bronsajustin_smith: also there is no such thing as clojure.core/def
13:35justin_smithoh, that's helpful to know
13:35bacon1989I remember reading an article on a bunch of security holes taht were patched
13:35clojurebotNo entiendo
13:35bacon1989* on clojurebot
13:38bacon1989but anyways, i'm interested in writing some clojureCLR libraries. I'm wondering if publishing .NET clojure code is possible
13:38bacon1989there doesn't appear to be anything on it
13:40justin_smithbacon1989: does .net have the kind of automatic dep resoltuion with a community repo that we use?
13:40bacon1989.NET has nuget
13:40justin_smithsounds like there should be a lein-nuget plugin (or maybe that's a candy bar)
13:40bacon1989so if need be, I wonder if writing something on top of nuget would make sense, sortof like how leiningen builds on top of Maven?
13:41justin_smithbacon1989: also, if you are using lein anyway, there's no reason you couldn't distribute clr code on maven
13:41justin_smith /clojars
13:41bacon1989justin_smith: hmmm
13:41bacon1989yeah, i'd prefer to take the 'less coding' path
13:42bacon1989and re-use what's already there
13:42bacon1989maybe i'll look through the lein-clr tool, and see if I can use that
13:42justin_smithand since much of what lein does is the maven stuff, maybe you'd just want nulein
13:42bacon1989there doesn't appear to be much interest in clojureCLR, I wish it could be just as easy to get started as in Java
13:43justin_smithbacon1989: the basics are there for sure, I think it's a question of tooling / community (of course that's chicken - egg)
13:43bacon1989yeah
13:43justin_smithbacon1989: I think the taint of MS keeps some of the sorts of folks that tend to develop free tooling for the community away from clr stuff
13:44bacon1989but there's Mono, and the latest Microsoft moves have been grand
13:44justin_smithbacon1989: not that clr isn't awesome and now very open, but the culture that leads to things like lein comes from a historical place that has a grudge against ms tech stacks
13:44bacon1989yeah true
13:44justin_smithnot a technical problem at all, but a social one
13:44bacon1989but I can see a better adoption of a language that works on the CLR with .NET
13:44arrdemis't that how all of the language tooling stuff shake sout?
13:45bacon1989when it comes to enterprise
13:45justin_smithit's true
13:45bacon1989microsoft is still a pretty strong contender when it comes to businesses. The business i'm at right now is only microsoft
13:46bacon1989but yeah, no one likes the microsofts taint
13:46justin_smitharrdem: yeah. it's just that in my experience, the kind of person who makes a free open source tool that makes building stuff in X easier, either really really really loves X, or is a bit of a GNU / freedom for the sake of freedom / community oriented person (usually it's actually both I think)
13:47bacon1989that's the thing though, if microsoft all of a sudden makes stuff open-source, shouldn't we reward them?
13:48justin_smithoh sure, but just try using rationality to influence human motivations, see how far that gets you :)
13:48bacon1989Sortof push the demographics on what people want, and other companies will follow suit and make their stuff open after they see the benefits
13:48bacon1989haha
13:48gfredericksis .NET realistically useful outside of windows?
13:50justin_smithgfredericks: yeah, big parts of Gnome are built in mono
13:50justin_smithwell - maybe not big parts, but it is in there
13:51gfredericksinteresting
13:51justin_smithhttp://www.mono-project.com/docs/faq/general/#mono-and-gnome
13:52martinklepschSomehow only Austin seems to be leaking from :profiles {:dev {:plugins [[lein-pprint "1.1.1"][com.cemerick/austin "0.1.7-SNAPSHOT"]]}}
13:52justin_smithI mean, for that matter the ancient windowmaker wm for linux was a port of a big part of next before it became OSX
13:53bacon1989gfredericks: idk about .NET, but the CLR runtime is use quite a bit outside of windows
13:53gfredericksI don't think I know the difference
13:54justin_smith.NET is oracle-jvm, CLR is the java spec
13:54justin_smithor something like that
13:54bacon1989.NET is a set of core libraries
13:54justin_smithahh
13:54bacon1989.NET core was recently open-sourced though
13:54bacon1989mono tries it's best to mimmick .NET core and everything else
13:55bacon1989that's why the recent .NET core dump was huge
13:55bacon1989(to opensource)
13:55justin_smithvery cool, thanks for the extra context
13:55bacon1989yeah, so .NET is a set of useful libraries, it's like Microsoft's Standard Libraries
13:56bacon1989sortof like Java's Standard Libraries get updated, C++11 std::, etc
13:56jwmopensource = more important than anything
13:57jwmreally monumental that so much is going oss these days
13:58justin_smithjwm: at this point, I think it's hard to justify a non-opensource lang for new projects
13:59justin_smithhyPiRion: so this is a really funny error https://www.refheap.com/97034
14:00justin_smithhyPiRion: regarding the whole "what would happen if you caught throwable" question
14:00justin_smithhyPiRion: I still get my usable repl back afterward though
14:01justin_smithoh I get it - the exception happens while the form is still being compiled, and somehow when it is caught and things are removed we are no longer in the context of the "try" ? that's weird though, I still don't quite get it
14:07martinklepschwow so my issue with Austin leaking into deps was that "lein install" runs with the :dev profile when I did lein with-profile -dev install, it wasn't there anymore
14:14gfredericksmartinklepsch: are you installing an uberjar?
14:14martinklepschgfredericks: no
14:14gfrederickser...AOT?
14:14gfredericksor you mean declared deps in the pom?
14:16martinklepschgfredericks: specifically talking about this project.clj https://github.com/verma/pani/blob/master/project.clj
14:16gfredericksoh something to do with cljs?
14:17martinklepschI dont think it has anything to do with cljs
14:17martinklepschgfredericks: the issue I had was that whenever I depend on "pani" as described in the link I get a dependency on com.cemerick/austin as well
14:18justin_smithmartinklepsch: I would say that's a problem with pani's pom file
14:19martinklepschjustin_smith: right. but I expected depencies in :profiles {:dev {:plugins []}} not to end up in said pom file
14:19martinklepschjustin_smith: is that a wrong assumption to make?
14:19justin_smithhmm - does clojars have a way to look at the pom file for an artifact? I guess I can just depend on pani to download it.
14:20justin_smithmartinklepsch: yeah, so a bug in lein or some lein plugin? clearly a problem with their pom is a problem with the tool that generated it (or how it is being used...)
14:21martinklepschjustin_smith: I couldn't replicate the behaviour with other plugins than austin (e.g. lein-ancient) so I thought it might be an issue in austin but then again that shouldn't be possible right?
14:21justin_smiththe pom file, for reference https://www.refheap.com/97036
14:22martinklepschjustin_smith: https://gist.github.com/martinklepsch/44f4d86ba3acead145c6
14:22martinklepschheh, guess I was too slow :P
14:23justin_smithmartinklepsch: this is terrible, but what if you tried removing the erroneous deps from the pom? better would be to clone the repo and see what change would prevent bad stuff from ending up in the pom, of course
14:24martinklepschjustin_smith: https://gist.github.com/martinklepsch/44f4d86ba3acead145c6#file-wo-austin-diff
14:24tomjackare there good alternatives to the common emoticons which are valid clojure forms?
14:24justin_smithtomjack: ;)
14:24tomjackoh, :/ is good. :) is all I need I guess
14:24justin_smith(comment to end of line)
14:24tomjackhah
14:24martinklepschjustin_smith: I cloned the repo and that "install" alias was the only way I could come up with that prevents austin from ending up in the pom
14:25tomjackof course I would like to be able to write more after the emoticon
14:25tomjacke.g. it should be able to go in the last spot of a one-line list
14:25tomjackusing comments is an interesting idea for actual clojure code, though
14:25justin_smithtomjack: there are unicode things that look like ) but will be accepted as symbol-constituent by the reader
14:26tomjackah, thanks, good idea
14:26justin_smithbut at that point you may as well use emojis
14:26arrdemwhat's wrong with using emojis?
14:26tomjackyeah, that would satisfy me
14:27tomjackunicode just didn't occur to me
14:27justin_smitharrdem: they are an upgrade, but you need to accept the whole "unicode you can't easily type in the codebase as var symbols" thing
14:27martinklepscharrdem: do those get rendered on github?
14:27justin_smith,:doge:
14:27clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: :doge:>
14:27tomjackI somewhat frequently turn on agda-input-mode in clojure-mode :O
14:28arrdemI pretty routinely use the TeX input mode in clojure-mode
14:28arrdem\gets
14:28arrdem\to
14:28arrdem\lambda
14:28justin_smithhaha
14:28arrdemI'm perfectly serious
14:28tomjackI want to someday patch paredit so that it deals better
14:29imanc_ (let [collided (filter (fn [x] (> (:x x) (:x obj))) active-list)] Why would this generate a null pointer exception? Strangely if i just delete the > func in the filter pred, the error no longer happens *grrr*
14:29tomjackimanc_: clojure is not sql :P
14:30imanc_changing the pred to (fn [x] true) or (fn [x] false) also solves it
14:30tomjackpresumably either (:x x) for some x or (:x obj) is nil
14:30tomjack,(> nil 42)
14:30clojurebot#<NullPointerException java.lang.NullPointerException>
14:30imanc_aha!
14:30imanc_that must be it... thanks tomjack
14:31tomjackI'm trying to decide how I'd deal with that in the case that the numbers can be negative
14:32justin_smith(and (:x x) (:x obj) (> (:x x) (:x obj)))
14:32justin_smithyou probably want a let block for that :)
14:32justin_smithwell no - you don't want and
14:32justin_smithnever mind
14:33imanc_and looks like it'd be a solution?
14:33justin_smithimanc_: false means either obj had a larger x, or one of the x's or things was nil
14:34justin_smiththat's a lot of things to encode in one false :)
14:34imanc_ah i see
14:34justin_smithbut if that is correct in your logic, run with it
14:35justin_smith(if (and (:x obj) (:x x)) (> (:x x) (:x obj))) :something-was-nil)
14:36justin_smithwell, those parens are wrong
14:36kryftDoes anyone happen to know if jdbc/update! can fail without throwing an exception (which would cause the transaction to roll back)?
14:37martinklepschjustin_smith: do you have any more input on that deps issue?
14:38justin_smithmartinklepsch: I would make my own version of the lib that didn't have erroneous deps in the pom
14:38justin_smithmartinklepsch: and it would be nice to make a pr for that, of course
14:39justin_smith"Clojure - Vatican City: Beautiful architecture and power well beyond its size, built over the bones of an ancient empire."
14:39martinklepschjustin_smith: sure, sure. I'm less concerned about solving it for me right now than solving it correctly
14:39martinklepschjustin_smith: that "install" task is a hack so I wonder what would be "the right way" to do it
14:39justin_smithhmm.
14:40justin_smithfigure out which plugin / which part of lein is screwing up there I guess?
14:40justin_smithI'm not really sure
15:07martinklepschjustin_smith: ok, I'll see what I can do
15:29expezI'm trying to spin up datomic with an h2 db and I get a NPE in find-log when it's trying to create a UUID. Do I have to do anything other than create-db before running connect?
15:32expezin the docs they just do create-db followed by connect, but that's in the groovysh *shrug*
15:37expezdamn this works just fine in the groovysh but not at the repl
15:47justin_smithexpez: it's calling the same bytrcode, so I'd imagine your groovy to clj adaption needs work?
15:49expezPeer.createDatabase(ur) => (datomic.api/create-database) and Peer.connect(uri) => (datomic.api/connect uri)
15:50expezthe problem was modular-datomic depends on datomic-extras which depends on old version of datomic free which wasn't loaded in the groovy console
15:51justin_smithexpez: yoi passed the uri to create-database, right?
15:52expezjustin_smith: yes, but the log formats weren't compatible between the old version of datomic which was pulled in by the transitive deps and the one running in the transactor
15:52expezit's working now but that was an annoying problem
15:52justin_smithahh
15:53expezwas trying to save a few minutes by using the juxt/modular components but between all the transitive deps and the complete lack of documentation I'm starting to regret that decision
15:57AeroNotixanyone got an up-to-date guide on using protobufs with clojure/
15:57AeroNotix?
16:21AeroNotixeugh, protobufs in clojure.
16:21AeroNotixfraught
16:22tcrayford____AeroNotix: can you copy whatever riemann does?
16:22tcrayford____AeroNotix: I know you're already familiar with riemann haha
16:23AeroNotixtcrayford____: oh I forgot riemann uses protobufs. good idea.
16:26AeroNotixIt's... not clear what it does.
16:26tcrayford____hahaha :(
16:26AeroNotixit just pulls in a package from com.riemann.protobufs
16:26AeroNotixcom.aphyr.riemann sorry
16:27tcrayford____ah, welp then :/
16:27tcrayford____that prolly uses generated java classes
16:27AeroNotixindeed
16:27tcrayford____as far as I understand things, https://github.com/ninjudd/lein-protobuf is basically the state of the art
16:28arohneris there a thing similar to clojure.core/bean for cljs?
16:28arohneri.e. get a hashmap from the fields of an arbitrary js obj?
16:28AeroNotixtcrayford____: Using that now and it's... less than perfect. It generates code that doesn't compile.
16:28AeroNotixworking myself through the forks of it now
16:28tcrayford____arohner: doesn't like, `into` work or something (I don't use cljs though)
16:29tcrayford____seeing as js objs are just maps anyway
16:29tcrayford____arohner: if not it seems trivial to write with `Object.keys` in js land
16:29arohnerError: [object Window] is not ISeqable
16:29tcrayford____AeroNotix: ah, sorry then, don't think I can help more
16:29arohnertcrayford____: yeah, I'm about to do that, was just asking if it existed first :-)
16:31AeroNotixtcrayford____: I think the riemann-clojure-client uses the java stuff which uses whatever the java compile machinery uses to compile protobufs
16:31AeroNotixand not lein-protobufs
16:32AeroNotix:/
16:32tcrayford____AeroNotix: that seems like an reasonable idea to me. It definitely wraps them in records futher inside riemann
16:32tcrayford____like, you can call `assoc` on an Event, but I guess aphyr just does that wrapping inside riemann itself
16:32AeroNotixyeah
16:32arohnerjs->clj exists, and the source looks like it does the right thing, but it is returning nil on me
16:32AeroNotixI'll persevere
16:33arohnerhrm, looks like js->clj doesn't have a case for things that are native code
16:57dagda1_I have been trying to solve this nth-prime problem on hackerrank https://www.hackerrank.com/contests/projecteuler/challenges/euler007 but I just cannot get it fast enough, I found lazy seqs the slowest and this
16:57dagda1_is the fastest I can get it and it still fails 2 tests https://gist.github.com/dagda1/9f182549988709c80610
16:58dagda1_I'm aghast, can anyone suggest an refinements, using lazy seqs was at least twice as slow
16:58justin_smitharohner: I woyld use .keys as a sequence to reduce over
16:58tcrayford____dagda1_: type hint function args so they take primitive, use a transient vector given that you're just banging on it
16:59tcrayford____currently you're boxing/unboxing on every call to is-prime? (I think)
16:59dagda1_tcrayford____: what do you mean banging on it?
16:59justin_smitharohner: due to inheritance stuff hasOwnProperty is udeful here
16:59tcrayford____like, it's single threaded and you're mostly mutating it rather than passing it around etc
17:00dagda1_tcrayford____: I've never heard ot type hints
17:00tcrayford____http://clojure.org/java_interop#Java%20Interop-Type%20Hints
17:00dagda1_tcrayford____: use a transient in n-primes?
17:00tcrayford____yea
17:00tcrayford____that might not even be a big win though
17:00tcrayford____what jvm options are you running it with?
17:00tcrayford____(hi: I do cleaxjure performance a lot)
17:01arohnerdagda1_: there are also significantly faster algos
17:01arohnerdagda1_: focus on algo first, clojure overhead is not your problem
17:01tcrayford____also that's prolly the real deal haha
17:01dagda1_tcrayford____: that is outside of my control, you paste the code into the site
17:02arohnerdagda1_: in general, the euler problems are very math heavy, so solving problems typically requires more math knowledge than clojure knowledge
17:02tcrayford____arohner: I've seen 5000x perf differences from bad jvm/clojure usage in the past haha. It's not always just the algorithm
17:02tcrayford____(though it prolly is here)
17:03dagda1_this was almost twice as slow than my loop recur but I was twice as pleased with this code :) https://gist.github.com/dagda1/c0165842dce687c6ab16
17:04dagda1_sorry, that is from the clojure lazy-seq docs and that got a stack overflow
17:05justin_smitharohner: acually (Object/keys j) and that slready filters inherited stuff
17:05arohnerjustin_smith: thanks
17:05arohnerI'll look into that
17:05dagda1_this is my lazy version that was twice as slow as using loop reucr https://gist.github.com/dagda1/41141f53b50b06c98094
17:08dagda1_this got me a big boost by only checking up to the square root (range 3 (inc (Math/sqrt n)) 2) and also only checking for odd number primes other than 2, I don't know what is left
17:09dagda1_I've seen the sieve of erathonese mentioned here http://clj-me.cgrand.net/index.php?s=eratosthenes but I'm not convinced it is faster
17:09dagda1_I'll have to try it
17:09michaelr525hey
17:09tcrayford____dagda1_: learn you some 2 millenia old mathematical optimization
17:10michaelr525i wonder why lein cljsbuild clean has been deprecated?
17:10dagda1_tcrayford____: I think I need to time travel
17:10amalloydagda1_: the real sieve is a lot faster than the trial division in your poaste
17:10dagda1_amalloy: I think I need a sieve, it is all I have left
17:10amalloysimply because it involves only addition and array lookups, rathre than division
17:11dagda1_pretty depressed about how slow lazy seqs are
17:13amalloydagda1_: they're really not. if you use a bad algorithm, work on that before you complain about the performance of underlying tools
17:13amalloylike, you're doing a ton of work recomputing primes, treating each test case as totally independent, instead of reusing a list of primes between the T test cases
17:14dagda1_amalloy: I think it is fair to say that there is a price on a lazy sequence, I don't see how i am dissing the language by saying that
17:14amalloythe sieve is a bit harder to use when you don't have the same goal in mine (it's designed for finding all primes less than N, rather than the first N primes)
17:14amalloyof course. there is a price for addition too
17:14amalloyare you depressed about how slow addition is?
17:15dagda1_amalloy: I'm just depressed I cannot pass the tests :)
17:15dagda1_amalloy: at least not quick enough
17:16dagda1_amalloy: I'm coming from the ruby world, I understand slow
17:17dagda1_I tried memoising also, I need to try the sieve for myself
17:17AeroNotixDoes anyone think that when-let could be improved somewhat?
17:17AeroNotixe.g. it doesn't really work with destructuring
17:17AeroNotixmultiple bindings would be nice too
17:18amalloyAeroNotix: when-let works fine with destructuring. (when-let [[x & xs] (seq coll)] ...)
17:19tcrayford____AeroNotix: also it should really be called whence-let
17:19AeroNotixamalloy: try a map destructure
17:19amalloyit only appears not to work because you imagine it doing other stuff like somehow knowing which bindings you want to be testing, rather than what it actually does, which is test the truthiness of the value you bind to
17:19AeroNotixamalloy: indeed
17:20AeroNotixI looked at the macroexpansion, there's no misunderstanding when the code is right there.
17:20AeroNotixPlease don't imply I'm just brain-dead.
17:20amalloyyou said it "doesn't work with destructuring", which is obviously false
17:20AeroNotixThere's no destructuring going on with (seq coll)
17:22justin_smith,(when-let [{a :a} nil] true)
17:22clojurebotnil
17:23AeroNotixThe truthiness check is done before the bindings
17:23amalloyor indeed if you want to assert that the key :a is present and still destructure, you can write (when-let [{:keys [a]} (not-empty (select-keys m [:a]))] ...). lots of avenues are open to you
17:23AeroNotixamalloy: and that's a bit gross. Imho
17:23amalloyso write your own macro
17:23AeroNotixI'm thinking it could be nice to improve on it a bit
17:23amalloythat does whatever you want
17:23AeroNotixamalloy: I am thinking about it
17:24AeroNotixI was hoping either this already exists somewhere :)
17:24justin_smithquorum: like when-let but multiple bindings snd all must be non-nil
17:24amalloyit probably does
17:25AeroNotixjustin_smith: that's.. pretty much what I want
17:25amalloy$google clojure and-let
17:25lazybot[Jay Fields' Thoughts: Clojure: Combining Calls To Doseq And Let] http://blog.jayfields.com/2013/05/clojure-combining-calls-to-doseq-and-let.html
17:25amalloyi dunno, that looks like a bad search result
17:25AeroNotixhmm
17:26amalloyyou can also try github.com/egamble/let-else
17:26AeroNotixamalloy: did you mean? http://edtsech.github.io/2012/12/and-let.html
17:26amalloywell, i haven't read that article
17:26amalloybut i know that the thing you are looking for is called and-let in other languages
17:26AeroNotixthis only focuses on simple bindings
17:27turbofailyeah most of those still won't check for truthiness on all of the destructuring variables
17:27turbofailprobably because doing so requires basically parsing the destructuring syntax
17:27turbofailfor which cfleming's approach would be nice again
17:28amalloyturbofail: well, you don't have to parse it yourself; that's whta clojure.core/destructure is for
17:28AeroNotixseems we could steal https://github.com/clojure/clojure/blob/clojure-1.6.0/src/clj/clojure/core.clj#L4045
17:28AeroNotixyeah
17:28turbofailamalloy: oh, didn't know that existed
17:28AeroNotixit.. needs to exis
17:28AeroNotixt
17:28AeroNotixlet is just a macro implemented in clojure
17:28amalloyeg i use it in https://github.com/flatland/useful/blob/develop/src/flatland/useful/utils.clj#L224
17:29AeroNotixthat's sweet^
17:29turbofailAeroNotix: i could totally have imagined it being an internal thing, not actually usable from elsewhere
17:29amalloyso that you can write like (let-later [x [1 2 3] [^:delay y] x] ...)
17:29turbofaillike the `for' parsing
17:30AeroNotixamalloy: doesn't Sir Tellman have a similar thing?
17:31amalloyare you thinking of riddley?
17:31amalloyno, probably you're not. i dunno
17:32AeroNotixhmm, no ztellman had a lib with something like this
17:32AeroNotixwhere the binding form would be executed in parallel
17:32AeroNotixwrapping them in delays and automatically forcing them seems neat though
19:42sdegutisIs there a way to specify easily when using assoc-in that one of the keys must simply be the last element of that vector?
19:43sdegutisI think I'm using assoc-in all wrong. I have the value of the node I want to update, but not the indexes of how to get to it.
19:43gfredericksdon't use assoc-in for that
19:43sdegutisIs there a better way to solve this?
19:43gfredericksuse update-in with conj
19:43sdegutisPlese help. Thanks in regards.
19:44sdegutisgfredericks: well the node already exists, it's a map deep in a nested structure, and I want to update a key in that map
19:44alandipertsdegutis: i have a thing for you maybe 1 sc
19:44gfredericksooh I see
19:44sdegutisI keep thinking tree-seq may help?
19:45gfredericksno you probably just want a special update function for vectors
19:45gfredericks,(defn update-last [v f & args] (apply update v (dec (count v)) f args))
19:45clojurebot#'sandbox/update-last
19:45sdegutisOr am I supposed to give this function a "path" to the node it represents?
19:46sdegutisI'd usually do it by just making sure this function has the path given to it in its entirety.
19:46gfredericks,(def the-data {:tacos [{:flavor 7} {:flavor "juice"}]})
19:46clojurebot#'sandbox/the-data
19:46sdegutisBut that means adjusting a lot of intermediate function parameters.
19:46sdegutisBut it seems cleanest.
19:46gfredericks,(update the-data :tacos update-last assoc :size "jumbo")
19:46clojurebot{:tacos [{:flavor 7} {:flavor "juice", :size "jumbo"}]}
19:47alandipertsdegutis: https://gist.github.com/alandipert/ac8e8b77e8660b9f947a
19:48sdegutisThat is some code.
19:48alandipertthe idea with the paths thing is it gives you all the paths into a nested map, which you can then filter
19:48sdegutisI dunno, I feel like this shouldn't be so special cased.
19:48alandiperti’ve been using it together with https://github.com/cgrand/seqexp to do unsound things with mongo records
19:48sdegutisHaha
19:49sdegutisalandipert: well played sir or madam
19:49alandipertit’s sort of xslt-ish
19:49alandiperttyty
19:49sdegutisOh! Maybe clojure.walk can help here?
19:49gfredericksdon't you just want to update a single thing?
19:49sdegutisYes, but that thing is very deep.
19:49gfredericksclojure.walk tramps all over your data
19:50sdegutisI'm okay with *walking* all over the data, I just want to find the deep thing.
19:50sdegutisI hope ClojureScript has clojure.walk
19:50sdegutisOtherwise I can just change my functions to take more parameters so that it can build up a path.
19:50sdegutisThe context is that I'm writing a budgeting app for myself using Reagent in ClojureScript.
19:51gfrederickssdegutis: so if you had a variant of assoc-in that took negative numbers as vector indices, would that solve your problem?
19:51sdegutisI'm updating an "actual" field (number) in an "expense" map which is the last key in the "months" vector.
19:52sdegutisgfredericks: technically yes, but it would be special casing it such that I can't easily change the thingy.
19:52sdegutisI think changing the parameters is the cleanest way to do htis.
19:52sdegutisThanks everyone for your charity.
19:52gfredericksgood luck
19:52sdegutisgfredericks++
20:41vasHello. I am playing with the ring.middleware.anti-forgery/*anti-forgery-token* and am not sure how to embedd it into my form as a hidden field that isn't evaluated until needed. Trying to run my server with lein ring server yields something like "attempting to call unbound fn" ..
20:44vasnevermind, i think i just biffed on the enlive html. thanks anyway, shall ping again!
21:32julianlevistonHey correct me if I’m wrong, but isn’t this broken because of lazy eval? (defn add-recipes [datas] (map add-recipe datas))
21:32julianleviston(from http://www.clojuregeek.com/2015/02/07/getting-the-hang-of-map/)
21:34montyxcantsinI think someone addresses that in the comments
21:34julianlevistonOh yeah, nevermind, a commenter pointed it out. all good.
21:35julianlevistonshe’s obviously doing all this at the REPL.
22:08vasIn using enlive to generate html for a form, i'm trying to incorporate the *anti-forgery-token* field but it is unbound on page access. how do I make sure it gets set? or would it simply be easier to incorporate the anti forgery token into page headers instead?
22:09justin_smithvas: how did you go about adding the anti-forgery field to the form?
22:10justin_smithvas: you should be able to insert the right vector into the data representing the form from your request handler
22:14vasjustin_smith: so on the (GET "/pagewithform" [] (renderpage)) you're saying i could pass the token along to renderpage?
22:14justin_smithright, and let renderpage insert the token into the form before rendering
22:15justin_smithyou may want to include more too - eg. if they are coming back from an error after having partially filled the form you could prefill the relevant parts etc.
22:15justin_smith(eventually that is)
22:15sdegutisWhat makes Clojure particularly good at writing parsers?
22:15vasjustin_smith: ah. that makes sense. that is a great direction! thanks a lot (=
22:15sdegutishi justin_smith
22:16justin_smithhello sdegutis
22:16sdegutisjustin_smith: you're so often helpful to me so I thought I'd be friendly to pay my respects
22:16justin_smithwell thank you kind sir, and a good day to you
22:17sdegutisjustin_smith: that was slightly humourous
22:17sdegutisjustin_smith: well done
22:17sdegutisWhat makes Clojure particularly good at writing parsers?
22:17julianlevistonhey this reminds me of the time a few seconds ago
22:17julianleviston… when you asked that.
22:18justin_smithmaybe because we have first class continuations and that makes parsing so much easier
22:18justin_smithoh wait, we don't!
22:18julianlevistonsdegutis: this? https://github.com/Engelberg/instaparse
22:19aaelonywhat does "good" mean? what does "particularly good" mean?
22:20sdegutisjulianleviston: right
22:20sdegutisjustin_smith: right, you don't
22:20sdegutisjulianleviston: ah okay
22:20sdegutisaaelony: I don't know
22:21julianlevistonsdegutis: and yet, you’re asking the question. What are you trying to ask here, really?
22:21aaelonycomparatively easier to write? more performant? something else?
22:21julianlevistonsdegutis: did you just read something someone said, and you’re asking us why s/he said it?
22:21justin_smithin all seriousness, I think functional programming is elegant for parsing, but I wouldn't say clojure, among the functional languages, was particularly good at it
22:22sdegutissure
22:22julianlevistonI think PEGs are particularly good for writing parsers.
22:22justin_smithfor example parsing can lead to huge stack and heap usage, which are both things clojure has a problem with already
22:22sdegutisjustin_smith: why not?
22:22sdegutisokay
22:22sdegutisthanks
22:23justin_smithnow for a web server back end, or a REST service? I think clojure really excells for that sort of thing.
22:23julianlevistonHe’s gone.
22:23justin_smith'tis his pattern
22:23julianlevistonhaha is it? :)
22:23julianlevistonAsk a question, don’t hang around for the full answer?
22:24justin_smithhe shows up, asks a bizarre (or at least oddly worded) question, and leaves. Sometimes it's trolling, other times I can't prove it is :)
22:24julianlevistonIt did feel like he didn’t actually care about the question. Hence the lack of response, I guess.
22:25julianlevistonReminds me of one of my friends who asks impossible questions like “What hat do you think I should get?”
22:25hueypwith core async, is there a method to not evaluate a put until a take happens? kind of like (lazy-seq ...) ?
22:26aaelonyI have a question like that... how much of a performance boost should one expect by converting pmaps over collections to core.async channels?
22:26justin_smithhueyp: you could put a delay, and deref it on the other end I guess
22:26julianlevistonhueyp: sure… wrap a go block around a blocking take and a put after it.
22:27justin_smithaaelony: core.async isn't actually a perf bonus usually (not that pmap tends to have great perf for most tasks either...)
22:27justin_smith~pmap
22:27clojurebotpmap is not what you want
22:27justin_smithjulianleviston: I was imagining he meant the take and put were in separate go blocks
22:27julianlevistonjustin_smith: oh… ok. It was a very general question.
22:27hueype.g. I have a lazy-seq of blocking http requests ... no request happens if you don't take from it
22:27aaelonyI have had good success by simply using pmap, but I'm considering adopting channels for future endeavors, any thoughts?
22:28vasthere's gotta be a simpler way to play with this csrf token... anybody have any good resources on schoolin' a neophyte on how to ring.middleware?
22:28hueypnot sure how to translate that into non-blocking without evaluating at least 1 http request
22:28julianlevistonaaelony: future endeavours?
22:28justin_smithhueyp: I think you would use pipeline, and evaluate each request as they are put on the channel
22:28julianlevistonvas: oh god… it’s so simple that it’s complex.
22:28aaelonythe next time I need to write something that will generate a lot of heat
22:28justin_smitheither that, or send delays or functions that get evaluated or forced on the other end
22:29julianlevistonaaelony: it entirely depends on what you’re trying to do. Ask when you have the problem, I reckon.
22:29vasjulianleviston: hahah i feel like i am finding icebergs every time i'm trying to pick up an ice cube, but it's good practice i s'pose
22:29aaelonyis there any general guidance?
22:29justin_smithaaelony: core.async is great for organizing otherwise complex interactions between different logical flows of code
22:30justin_smithaaelony: it won't always make things blazing fast, but it does tend to help with clarity and correctness
22:30julianlevistonaaelony: generally, … no.
22:30aaelonyjustin_smith: I have used pmap for that in the past.
22:30julianlevistonaaelony: it always depends… always.
22:30julianlevistonSpeaking of parsers, I really liked OMeta….
22:30aaelonyjulianleviston: that isn't a strong case to shift from the premise of avoiding pmap then
22:31justin_smithaaelony: yeah, if you only have one producing logic pmap can make sense (as long as there is a relatively large work load per item in the mapping) but once you have more complex flow between parallel processes core.async really starts to shine
22:32vasi got the token to print to the browser!! jello shots for everyone!
22:32julianlevistonaaelony: but if you have something that generates a lot of heat, it might be for various reasons… inefficiency (due to needing to rework your program into a more understandable state), or it might just be because it needs more or less parallelizing.
22:32justin_smithWOO
22:32julianlevistonvas: woo!
22:32aaelonyjustin_smith: I'm currently using it with two nested pmaps, it seems to work pretty well. For example, one pmap over choices of files to process and another pmap over the lines of a particular file
22:32julianlevistonhaha jynx
22:32justin_smithjulianleviston: well, of course shots mean WOO what else would they mean?
22:33julianlevistonjustin_smith: oh I was wooing coz he did the thing. I don’t drink.
22:33amalloylazybot: what do you say to free shots?
22:33lazybotIt's AWWWW RIGHT!
22:33vashhaha
22:33justin_smithhaha
22:33julianlevistonaaelony: does pmap allow you to specify the concurrency?
22:33julianlevistonI should know this
22:33aaelonyjulianleviston: the size of the box, right?
22:33justin_smithjulianleviston: it's automatic based on physical cores and magic numbers
22:34aaelonyjulianleviston: in effect, yes, because I spin up a box size I need to run it on :P
22:34julianlevistonLOL
22:34julianlevistonaaelony: but it depends on the task, right? sometimes you don’t want that particular part of the program to get all that bandwidth...
22:35julianlevistonaaelony: (of processors)
22:35aaelonyso the idea is that a channel approach with core.async would provide better control?
22:35julianlevistonaaelony: I feel like CSP gives you more control over your “concurrency”.
22:35aaelonyI see
22:35julianlevistonaaelony: exactly.
22:35justin_smithmy favorite is always the calculation of the core.async pool size https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/exec/threadpool.clj#L21
22:36justin_smithI mean if I just dropped that factoid, you'd likely think I was joking if you hadn't read the source already
22:36julianlevistonaaelony: As the programmer, you actually know how much concurrency you’d like, often… at least, in proportion to the other parts of your program. Some things are more important than others…
22:36aaelonyI thought it had to do with the threads in async being more lightweight due to better scheduling or something like that
22:36aaelonyjustin_smith: thanks for that link.
22:36julianlevistonaaelony: well it can use sharing, whereas I don’t think pmap can, right?
22:36justin_smithaaelony: the core.async threads are real OS threads (or they don't exist, in cljs) but in each one there is a state machine
22:36julianleviston42!!!!!
22:36justin_smithaaelony: hilarious, isn't it?
22:37aaelonyfunny stuff.
22:37justin_smithand the state machine picks up go blocks when they have been parking but are now ready to do work
22:37aaelonydouglas adams would be proud
22:37justin_smithindeed
22:37aaelonyhttp://en.wikipedia.org/wiki/42_%28number%29
22:38justin_smithblame says we have tbaldridge to thank for that calculation
22:38justin_smithwe have other reasons adams can be proud
22:38julianlevistonhehe
22:38justin_smith(+ 41 1)
22:38clojurebot*suffusion of yellow*
22:38aaelonyI didn't realize there was a term "pronic"
22:38justin_smith^ like that
22:38aaelonyfunny
22:39justin_smiththe number of rooted ordered binary trees with six leaves
22:39aaelonywell, at some point I'll try to invoke the same functions I use with pmap in a core.async setting and compare notes.
22:40justin_smiththe number of ways in which five pairs of nested parentheses can be arranged
22:41aaelonysounds like a knuth xmas lecture on trees with imaginary numbers being called imagin-ary trees...
22:41justin_smithhaha
22:48vasmy 404 page says "it is better to light a candle than to curse the darkness" .. just thought i would share, as it has stopped me from pulling hair out :)
22:49julianlevistonvas: it’s also substantially harder.
22:53julianlevistonwow… I’d never connected DSLs to protocol composition, but of course.
22:57justin_smithjulianleviston: care to elaborate?
23:01julianlevistonjustin_smith: I guess Ruby burnt me out about DSLs for quite a while… (coz we’re mad about them in Ruby, but they’re not really DSLs, they’re more subsets of Ruby), and so I’d consequently not given this talk the time of day it probably deserved: http://www.infoq.com/presentations/DSL-Clojure (Jim Duey))… but really, they should be more like the VPRI POL (problem-oriented languages), where they’re actually
23:01julianlevistonpotentially completely different languages, which necessitates protocols and their composition…
23:01astarjoin haskell
23:02julianlevistonastar: huh?
23:02julianlevistonastar: do you mean I should learn Haskell because of the types system? I’ve learned some Haskell… not fully in depth enough to be able to code in it...
23:03julianlevistonoh… he was trying to join #haskell lol
23:03justin_smithjulianleviston: I think he meant to do /join haskell but made a typo
23:12justin_smithjulianleviston: funny, so far he is showing DSLs that I have intentionally stopped using because they don't compose as well in higher order code than regular clojure would
23:12justin_smith*as
23:12julianlevistonjustin_smith: yeah it’s pretty ironic… in a way, clojure (being a lisp) is the ultimate DSL..
23:16julianlevistonI’m still super keen on POLs, but I couldn’t easily understand OMeta because I didn’t understand PEGs enough… I think now I should probably revisit it… I wonder if someone’s done a port to clojure… so far all I can find it something by someone “inspired” by OMeta. There’s Ometa/js so that might be cljs portable I guess. It’s very interesting!
23:16julianlevistonso much to learn.
23:31montyxcantsinhahaha sorry just read that "join haskell" incident
23:33justin_smithoh wow, another monty cantsin
23:33justin_smithis karen eliot around too?
23:34justin_smithalso, of the places I hang out this is the last one where I would expect to see a monty cantsin
23:35montyxcantsinme are legion
23:40julianlevistonmontyxcantsin: it’s oddly appropriate… “join haskell” ;-)
23:40jwmheh subethasmtp has left 300k tmp files in my temp folder
23:41justin_smithwoah
23:43julianlevistonI really wish commutativity was a first class programming construct rather than an afterthought, like core.async or somesuch.
23:44justin_smithjulianleviston: like a metadata that tells you if primitives commute, and then you could derive whether a function commutes based on what it calls?
23:46julianlevistonjustin_smith: no, more like… as it stands, everything is assumed to NOT be commutative… it’s assumed that each “line” of code is non-commutative… assumed to be sequential and that prior lines have already been executed. I’d like that not to be necessarily the case. The standard should be that lines execute commutatively (ie order doesn’t matter) unless you mark them as non-commutative…
23:47montyxcantsinyou should dig occam
23:48julianlevistonjustin_smith: because non-commutivity is really only a requirement sometimes… bindings indicate most of the non-commutivity, and for the side-effecting cases, it should be pretty trivial to mark them.
23:49julianlevistonmontyxcantsin: thanks I’ll take a loo
23:49julianlevistonlook even ;-)
23:50julianlevistonI *do* very much like CSP.