#clojure logs

2014-06-05

00:01dbaschj0ni: you either want to exclude the version from capacitor, or use that version instead of the newer one
03:01Lajjlaem-dash, I approve of your name.
03:01LajjlaNow, how shall we use this information to conquer the world.
03:02em-dashum, typo nerd? or bot?
03:03Lajjlaem-dash, nahh, just trying to look intelligent by using them.
03:05em-dashwhich is nice… plus they look nicer than hyphens. by which I probably mean more ‘distinguished’, aka trying to look intelligent
03:05LajjlaIndeed
03:05Lajjlayou and I are much alike.
03:05LajjlaSo, assume the position and surrender your eye socket, we will make merry love.
04:39noncomdoes anyone know if zach oakes ever visits this place?
04:42clgvnoncom: dont remember seeing his name here during usual european day time
04:58TEttingernoncom: is he the guy behind play-clj, nightcode, and a bunch of other neat clojure tools?
04:59TEttingerAFAICT he doesn't use IRC
05:08noncomyeah, that very guy. wanted to talk with him about play-clj
05:08noncomso guess gotta go get him over reddit since it is pointed to at his website
05:13clgvnoncom: email? ;)
05:15TEttingeryeah, play-clj is nice
05:15TEttingerI used it
05:15noncomoh, right, email :) there is the address on his github page
05:16noncomi want to use libgdx. i like the "bining" part of play-clj, but i am not rather sure i like the workflow that it enforces
05:16noncomi mean, it is strictly functional. and that also makes it slower
05:17noncomi wanted to understand, to which extent is it possible to use it with mutual state
05:22noncomTEttinger: how was your experience? did not you feel it somewhat architecturally limiting?
05:27TEttingeri felt that way at first
05:27TEttingerit's easy to make your own whatever
05:27TEttingerwhich is what i did for the unusual map i needed to render
05:29TEttingerI'd imagine Morgawr's thing will be better for this in the long run
05:29TEttingerhttps://github.com/Morgawr/Cloister-engine
05:31noncomTEttinger: oh, cloister is on slick..
05:32noncomcan't take this one, since full 3d opengl is needed, and libgdx is a very advanced thing there
05:32noncomso i guess that i will have to write my own binding for it..
05:32noncomsuiting te needs
05:32noncomhence fragmentation of the ecosystem..
05:32noncomoh well...
05:39TEttingertalk to oakes first, noncom
05:39noncomyeah, gonna try that out
05:40TEttingerin my experience clojure is just not very fast for real-time games... price you pay for such abstraction
05:42noncomyeah, i understand, but it can be rather good if treated properly. the uber-functional way of clojure community mainstream does not play with it well
05:43noncomso i have to use the so unwelcomed mutable state
05:43TEttingeroh yes
05:43noncomwhere needed
05:43TEttingerthat is what happened to me
05:43TEttingerI spent so much time micro-optimizing
05:43TEttingerwhen I could have been blissfully writing C#
05:43noncomhaha)
05:43TEttingerI was porting a C# program to clojure
05:44noncomso what you came up with? what were your thoughts on this and conclusions
05:44TEttingerthe C# got a lot further in less time
05:44noncomwhat kind of game?
05:44TEttingerRPG/roguelike
05:44TEttingerI made a wallpaper out of it https://dl.dropboxusercontent.com/u/11914692/dungeon-wallpaper.png
05:45noncomreminds me of graphical nethack
05:45noncomso, clojure was slow even for that kind of game??
05:45lazybotnoncom: Definitely not.
05:45TEttingerhaha the sprites are from nethack
05:45TEttingeryeah, if I kept maps small it was OK
05:46TEttingerbut if they got above like 40x40, then I started having monster pathfinding slowdowns, various calculations slowing down as they played out every movement...
05:47TEttingerlarge parts were in java as well
05:47noncomhmm i think that if you would use enough mutable state and caching, that would not've been the case
05:47TEttingerI got good speedup by offloading level gen into a second thread with a promise
05:47TEttingeror was it a future?
05:48TEttingermutable state actually slowed down the program at one point when I had a plain array of java sprite objects
05:49TEttingerthey I believe couldn't be disposed
05:49noncomhmmm
05:49TEttingerI really hammered at it
05:50noncomso you think that clojure can have this large impact on performance?
05:50TEttingerspent way too much time trying to make it fast
05:50noncomhmm]
05:50TEttingeryeah, I just didn't understand why it was slow
05:50TEttingerimmutable data structures are part
05:50TEttingervector-to-other conversions are slow when done many times
05:51noncomit is just that i made some programs with variable geometries (using VBOs) wit clojure + jmonkeyengine 3 and it was rather fine..
05:51noncomi had to use java arrays though
05:51noncomor ByteBuffers from nio
05:51noncomwhich is ok
05:51TEttingerI think the issue was that there's no "easy way" to make clojure fast
05:53TEttingerI love how expressive clojure is, but in my experience games can't benefit much from that due to slowdown
05:53TEttingermy clojure code was monstrous though
05:53noncomhow do you think, is it slow on calculations or flow control?
05:53TEttingercalculations are mostly java speed
05:54noncomi don't know what to think of what you're saying coz i was kinda doing some games with clojure and they were very ok with speed...
05:54TEttingerif you have enough type hints you should be fine, and even then, untyped-arithmetic warnings didn't speed yup much
05:54noncombut i did not do this kind of game like you did
05:54TEttingerit's possible all my problems were logic related
05:54TEttingeror libgdx related
05:54noncomthis worth a further research
05:54TEttingersounds like you used less wrapping
05:55TEttingerhttps://github.com/tommyettinger/Ravager
05:55noncomi am not an addict of "make everything functional whatever the cost"
05:56noncomactually, i have designed and am using a OO system for my apps
05:56TEttingerwell https://github.com/tommyettinger/Ravager/tree/master/ravager/desktop/src-common/gaunt/ravager is where you want to look
05:56noncomthis OO things seems very fast
05:56noncom(comparingly)
05:57TEttingerI would guess that libgdx has some slowdown as well relative to a jmonkey bit
05:57noncomTEttinger: you have used play-clj, i think this served a huge lag too
05:57TEttingerno, actually it got faster on play-clj
05:57TEttingerbecause i wasn't leaking VRA<
05:57noncomwhy do you think libgdx is slower? i was thinking the opposite... it is more low-level than jme
05:57TEttingerM
05:58TEttingeri dunno. libgdx isn't just an OGL wrapper
05:58TEttingernever used JME
05:59noncomjme isn't either. it has a whole thick layer between ogl and user so that you do not even see a bit of ogl.. libgdx is different. it is like ogl but with optimisations (as i see it for now)
05:59noncomso i think that i will devise my thing and we shall see what comes out of it
06:00TEttingeryou don't see any OGL from libgdx either... the most I had was I called some things to clear the screen from GL
06:00TEttingerI need to go to bed
06:00TEttingergood luck with your non-functional clojure game lib?
06:01noncomok, good night! i will continue the research. i think that wen i get somewhere, we may run some tests to see what is all this slowdown thing for
06:56dabbelingCljHi there I want to build a clojure web app with absolute minimal UI, what approach and libraries can you suggest?
07:08dabbelingCljNo ideas on how to build simple web Uis?
07:08gyimdabbelingClj: i would suggest compojure, hiccup and Twitter UI bootstrap
07:08dabbelingClj3 libs
07:08dabbelingCljthat "feels" quite heavy
07:08scape:sigh
07:09dabbelingCljhiccup is templating?
07:10gyimclojure web libs usually do one thing well, which is in contrast to providing a big all-in-one framework like rails or django
07:10clgvdabbelingClj: no not heavy since the individual libs are small ;)
07:11clgvdabbelingClj: hiccup is for building html via clojure datastructures. for templating there are other option.
07:12dabbelingCljhow would the interaction between hiccup and twitter bootstrap look like?
07:13gyimhiccup is just for generating html. So you generate a html that uses the elements/attributes bootstrap supports
07:14dabbelingCljhow does bootstrap compare to clojurescript in regard to build "interactive" web apps?
07:14clgvdabbelingClj: apples and oranges ;)
07:15dabbelingCljI'd figure its not really a clojure problem
07:15dabbelingCljmore that the "web" is messed up
07:16dabbelingCljbut I still dont like it
07:16dabbelingClj"web-components"
07:16clgvdabbelingClj: you can setup a tiny web ui with ring+compojure+hiccup pretty fast. I did that for a project
07:17agarmanI liked this demo: http://rigsomelight.com/2014/05/01/interactive-programming-flappy-bird-clojurescript.html
07:17dabbelingCljclgv: you have example link?
07:17clgvagarman: not nightplay, right?
07:17agarmannope
07:17agarmanit uses figwheel
07:18clgvdabbelingClj: no, currently closed source. it's going to be open source in some weeks#
07:19clgvdabbelingClj: but is pretty easy getting started with the READMEs of these projects. but there are already enough blogposts that offer more I guess
07:19dabbelingCljclgv: can you suggest "good" blog posts?
07:20bhaumanagarman: :)
07:20clgvdabbelingClj: as I said I used the READMEs only ;)
07:20dabbelingCljclgv: yes and how long did it take you?
07:21dabbelingCljclgv: also interesting: how much exposure to javascript/HTML/CSS did you have before
07:22clgvdabbelingClj: it doesnt use CSS or javascript - that's what I assumed "tiny web ui" means ;)
07:22agarmanbhauman: I showed that demo to folks at work. Everyone loved it.
07:22agarman(inc bhauman)
07:22lazybot⇒ 4
07:22clgvdabbelingClj: if I had time I'd add twitter bootstrap
07:23clgvdabbelingClj: getting up and running with basic stuff and authentication/authorization approx 1-2 hours
07:23dabbelingCljclgv: see I dont need that
07:24dabbelingCljI think i misplaced my questions
07:24gyimdabbelingClj: how much experience do you have? I think clojure is not so good for learning about basic web technologies (http, html, css, js), but once you are familiar with these, it is very easy to use imho
07:24clgvdabbelingClj: yeah I did need authorization since the web ui controls a server program ;)
07:24dabbelingCljwhat clojure librariy can I use for rapid HTML prototyping, possibly with interactive feed back?
07:26clgvdabbelingClj: ring+compojure+hiccup
07:28dabbelingCljclgv: ok but that would still bee code in editor, go to browser and then hit refresh?
07:28dabbelingCljclgv: I think i'm looking for a more integrated approach , maybe with LT
07:29clgvdabbelingClj: well you start a server via ring and can reload the web ui in browser as you like
07:29dabbelingCljclgv: something where i see instantly my changes applied
07:29clgvdabbelingClj: yeah maybe LT has something like that since it is running in a browser itself
07:29dabbelingCljclgv: well i guess i give hiccup a try, but first lunch :)
07:31bhaumanagarman: thanks man1
07:58turbopapeHi guys,
07:58turbopapeI want to use storm, but I am afraid that the clojure DSL has not been worked on since at least two years...
07:59turbopapeCan I use it with peace of mind, or was its support dropped (the clojure DSL that is ?)
07:59agarmanI'm not sure the state of storm
07:59agarmanI skipped using it at previous gig, and same at this current
08:00turbopapeagarman storm as a whole seems to be well, It's for the clojure DSL that I'm worried ...
08:01turbopapeAnd I really am afraid of doing this in java ... :(
08:02agarmanturbopape: probably better to ask storm folks
08:03turbopapeindeed agarman, thank you, I just wanted to get a feel how much is it being used by clojurians...
08:03turbopapenot that much, as far as I can tell ...
08:03boyscaredi've used it, but it was about 2 years ago
08:03boyscaredin a primarily java app, no less
08:04boyscaredit worked fine back then, and i'd probably conclude that there's no reason it wouldn't still work
08:04turbopapethanks boyscared , did you use the clojure DSL ?
08:04boyscarednope
08:05turbopapeHave you heard about someone using it boyscared ?
08:06boyscarednot personally, no. i'd venture you'd be fine, but i can't really speak authoritatively on it
08:06turbopapeok boyscared . I'll ask about this on their mailing-list. Thanks ! cc agarman
08:06boyscaredwere i you, i'd probably slap together a quick prototype
08:28gfrederickspromise->future: https://github.com/fredericksgary/repl-utils/blob/master/src/com/gfredericks/repl/util.clj#L4
08:33clgvgfredericks: hehe. do you need that often enough?
08:54gfredericksclgv: no just this once
08:54gfredericksclgv: it supports the repl-utils library, it is not itself a repl utility I intend to use :)
09:05trptcolinany input y’all can give would be super-helpful: https://docs.google.com/forms/d/1ejjQgGkwmP1GLn2lFs5jGIBBQsKC1hc5aVieu1VwmYs/viewform
09:35bjaany thoughts on why clojure.lang.Reflector.invokeMatchingMethod would be failing on a class at runtime in a jetty handler but not in the repl?
09:36mpenetgfredericks: looks a bit like a lightweight lamina result-channel
09:36mpenetI think ztellman has been extracting this kind of stuff to a separate lib
09:37mpenethttps://github.com/ztellman/manifold
09:44myguidingstar_hi all, is there any tool that helps with producing url to static assets in HTML for Clojure webapps?
09:44ViestiIs there an idiomatic way to return a literal value from a function literal?
09:44justin_smithbja: is the repl using the same classpath as the jetty handler? is it running jetty via lein ring or something or is it an uberwar servlet?
09:45AeroNotixViesti: (constantly literal)
09:45TimMcViesti: #(do 5) (ew) or (constantly 5)
09:45justin_smithmyguidingstar_: look at ring.middleware.wrap-resource
09:45ViestiThanks AeroNotix and TimMc
09:46AeroNotixnw
09:47clgvbja: you probably have reflection warning there in the repl as well. if you add the expected typehint you probably get more information when the error happens in jetty
09:47justin_smithit is so appropraite that (partial take 5) is lazy
09:48Viestithough those two options still feel a bit funny, but maybe I'm doing it wrong
09:49justin_smiththere is always (fn [] 5)
09:49justin_smithI mean what feels funny about them?
09:50noncomconstantly is not funny
09:50Viesti(into {} (map #(do [(.replaceAll (key %) "\\." "\uFF0E") (val %)]) {"foo." "bar"}))
09:50Viesticould do
09:50Viesti(into {} (for [entry {"foo." "bar"}] [(.replaceAll (key entry) "\\." "\uFF0E") (val entry)]))
09:50justin_smithnoncom: it is funny that fn [& _] is fewer chars than constantly and gets you the same result
09:50Viestiusing for
09:51Viestijust realised the list comprehension option
09:51noncomjustin_smith: this is indeed funny :)
09:51fizruk,(take-while not-empty (map (partial take 2) (iterate (partial drop 2) [1 2 3 4 5])))
09:51clojurebot((1 2) (3 4) (5))
09:51fizrukis there a cleaner way to do that? ^
09:51fizrukthe actual list is “rest of the arguments"
09:51justin_smith(partition-all 2 (range 1 6))
09:51justin_smith,(partition-all 2 (range 1 6))
09:51clojurebot((1 2) (3 4) (5))
09:52fizrukjustin_smith: great!
09:54arrdem'mornin
09:54noncomhi!
10:01myguidingstar_justin_smith, sorry for my unclear question
10:03myguidingstar_hi all, is there any tool that helps with *producing url* to static assets in HTML for Clojure webapps? maybe something like: {{git commit's unique id}}+{{path-to-asset}}
10:05justin_smithwith caribou we have a reverse-routing function called route-for that we use in templates
10:06justin_smiththough you probably don't want to switch an existing app to caribou, such a function should not be hard to write
10:07justin_smiththough it is handy for DRY reasons to have a router that also lets you calculate in reverse (the info you provide eg. compojure is sufficient for compojure to generate a reverse routing lookup, though it does not do so)
10:08justin_smithI think there are a few routing libs that provide reverse routing (including polaris which we wrote for usage in caribou)
10:11gfredericksmpenet: these channel-things don't normally throw exceptions the way futures do, amirite?
10:28YourRatzonHello everyone, I am writing a compiler in clojure and having trouble tokenizing lines. Can someone help?
10:28gfredericksYourRatzon: probably so
10:29YourRatzonhere is my question on SO: http://stackoverflow.com/questions/24060195/tokenizing-a-string-in-clojure?noredirect=1#comment37103057_24060195
10:29YourRatzonhttp://stackoverflow.com/questions/24060195/tokenizing-a-string-in-clojure
10:30YourRatzonstill here
10:31gfredericksYourRatzon: you could look at how clojure's reader does it (in java): https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L444
10:35mpenetgfredericks: if you deref a result-channel where an exception occured, it will rethrow
10:35gfredericksoh nice
10:35mpenetgfredericks: so same thing I think
10:36gfredericksunlike core.async
10:36mpenetyep, I am annoyed by that too
10:36mpenetsee the example here https://github.com/ztellman/manifold#deferreds
10:36clojurebotNo entiendo
10:36gfrederickseh, it's a different model
10:36mpenetit is
10:37YourRatzongfredericks: not sure how that helps me...
10:37mpeneteverything is a value in core.async, no disctinction
10:37gfredericksYourRatzon: do you understand what it does?
10:37mpenetdistinction*
10:37YourRatzonscans the string until the strings end
10:37clgvgfredericks: slingshot annoys me right now. I just want to catch and rethrow an exception with throw+ to capture context information...
10:38gfredericksYourRatzon: you probably don't want to use a regex up front to split things
10:39YourRatzonOk, how should I do it? it's so simple for all the other tokens
10:39YourRatzonjust the string literals causing problems
10:39borkdudeYourRatzon someone has suggested instaparse, that may be what you ened
10:39gfredericks+1 to instaparse
10:39gfredericksclgv: huh? is this related to catch-data?
10:40clgvgfredericks: I just remembered talking about slingshot with you some other day ;)
10:40YourRatzonI see
10:41gfredericksclgv: yeah what exactly is slingshot doing for you? what's "context information"?
10:41YourRatzonwanted to see if there was a simple line i could add to my regex, guess not..
10:41clgvif I need this more often I build a rethrow-context macro ;)
10:41clgvgfredericks: local binding values are included
10:41gfredericksclgv: I think that feature is so weird
10:41clgvbut only if I throw data and not exceptions :(
10:42clgvgfredericks: huh? why?
10:42gfredericksclgv: because it's only going to be programmatically useful if you start making assumptions about the names of the locals at the throw point
10:43clgvgfredericks: I am processing large data and at some point it fails and I currently have no idea where. since it process parallel a println strategy doesnt tell me that much ;)
10:43clgvgfredericks: I need it for interactive debugging only^^
10:44gfredericksclgv: would be interesting to include it as metadata on the ex-info map
10:44gfredericksthat way it doesn't make its way into logging or anything, but it's there at the repl
10:44clgvright
10:45gfredericksclgv: so the throwing in this case is by your code or a library?
10:46clgvgfredericks: my code. so I could wrap a custom macro around it, that does the job without using slingshot...
10:46gfredericksclgv: mpenet just submitted a PR to catch-data with a throw-data macro
10:46gfredericksI could add the locals-as-metadata feature; would that solve all your problems?
10:47clgvgfredericks: sounds great
10:47clgvgfredericks: does throw-data offer an option to keep the exception chain intact?
10:47gfrederickswat does that mean
10:48clgvusually exceptions offer a constructor where you can pass another exception as cause
10:48gfredericksoh right; yes
10:48gfredericksjust like clojure.core/ex-info
10:48gfredericksright now the impl is just `(throw (ex-info ~@args))
10:48gfredericksI was considering a string-only option as well
10:48clgvyes indead
10:49gfrederickswhere you'd get an empty map, but still having locals-as-metadata
10:49clgvah ok. that'll work with the metadata added :D
10:49clgvgotta star your project to find it, when the change is released ^^
10:49YourRatzonok thank you gfredericks
11:00clgvgfredericks: humm according to the source catch-data is not combinable with other catch-declarations in the same "try"?
11:00clgverr same "try+"
11:01gfredericksclgv: comments? https://github.com/fredericksgary/catch-data/pull/3
11:01gfredericksclgv: it's not?
11:03clgvgfredericks: I did not try it but the macro expands to (try body-forms (catch Throwable t ...) final clause)
11:03clgvgfredericks: ah do you extract all other to that "cond"?
11:04gfredericksprollably
11:04clgvah ok.
11:04clgvI expected a (catch ExceptionInfo ....) and other catch clauses inserted literally
11:05gfredericksI think that's tricksy
11:05gfredericksdue to edge cases
11:05clgvyeah, I dont want to say anything about right and wrong with that. just my expectation when looking at the source ;)
11:06gfredericksthe main constraint is that you can't have one catch clause inspect the exception and defer to the next one
11:07gfredericksonce you rethrow you skip all the remaining catches
11:07gfredericksso certainly all the catch-data clauses have to be done together
11:07clgvgfredericks: are only maps allowed for throw-data? is that a limitation of ex-info?
11:08gfredericksI'm sure it's possible to statically determine a more optimal expansion -- I have no idea what the perf implications are
11:08gfredericks,(ex-info "not a map" [])
11:08clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.IPersistentMap>
11:09clgvok.^^ otherwise a check whether metadata can be added to the object would be needed
11:09deathknighthiya fellas
11:09clgvgfredericks: looks good so far
11:09deathknighta lot of firsts right now: Debian, because all of the Clojure tutorials were not on Windows, and now epic5 irc :)
11:11clgvdeathknight: you can start learning on any plattform where counterclockwise, cursive or lighttable work. since they offer you all you need to get started. later, when you need leiningen - well it's better test on linux and mac os ;)
11:12clgv*tested
11:12deathknight:) Hence I feel I made the right decision by dual bootingh.
11:13deathknightHas anyone made calls to the TeamworkPM API? They have a java example set up - it's a bit over my head at the moment
11:13deathknightSignoff: I'm using emacs live at the moment :]
11:13deathknighterr, I mean "clgv:"
11:14clgvwell you gotta ask someone else for solving emacs problems ;)
11:15gfredericksclgv: I think I also want string interpolation a lot of the time
11:15deathknightHah, emacs is treating me right. I'm referring to calling in java libraries and such
11:15clgvdeathknight: you read about java interop from clojure already?
11:16gfredericksclgv: e.g., if there were a throw-data-f that automatically used https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/strint.clj#L49 with the map data in scope
11:16gfredericksthat would be sooper hot
11:16deathknightI have not, clgv!
11:16deathknightI'm going through Clojure Programming by O'Reilly at the moment
11:17gfredericksthen I could (throw-data "Expected a keyword but got ~(pr-str arg)" {:arg x})
11:17clgvdeathknight: ah ok. then maybe you want to jump to that chapter to get to know as much as you need right now
11:18deathknight<3
11:19deathknightdeathknight wants to deathhug you for your help
11:19clgvgfredericks: I am not a fan of that string interpolation.I am used to just use "format" ;)
11:20gfredericksclgv: with format you can't identify the things by name though
11:20clgvgfredericks: no but by position
11:20gfredericksbut a map of data doesn't have positions
11:21clgv,(format "%2$s %1$s" 1 2)
11:21clojurebot"2 1"
11:21clgvgfredericks: but you dereference that data explicitely in your example?
11:21clgvah no. you build the map...
11:21gfredericksclgv: no, the map can be implicitly in scope
11:22clgvgfredericks: if it causes no unnecessary expensive overhead, there should be no harm to add that feature ;)
11:24clgv,(require 'clojure.core.strint)
11:24clojurebot#<FileNotFoundException java.io.FileNotFoundException: Could not locate clojure/core/strint__init.class or clojure/core/strint.clj on classpath: >
11:25clgv&(require 'clojure.core.strint)
11:25lazybotjava.io.FileNotFoundException: Could not locate clojure/core/strint__init.class or clojure/core/strint.clj on classpath:
11:25arrdemaw man why's Var final...
11:31technomancyit's weird how "final" means two completely unrelated things
11:33gfrederickscan't extend and can't reassign?
11:35hyPiRiontechnomancy: Guess what the keyword "transient" in Java means.
11:36cbp~reactjs
11:36clojurebotreactjs is a poorly implemented comonad
11:36cbpkek
11:40irctcIs there a way using just regex to pull out the number 1311 in brackets (re-find #"\[\d+\]" "Category 123 [1311]")? Right now I get [1311] but I want [ ] to be excluded?
11:41ToxicFrogirctc: wrap the \d+ in () and use groups
11:42mpenetworks with re-find just fine
11:42mpenet,(re-find #"\[(\d+)\]" "Category 123 [1311]")
11:42clojurebot["[1311]" "1311"]
11:43irctcthanks
11:44borkdudehow do I define a multimethod which I can call like this: (defmulti foo number? [x] "You have given a number") (defmulti foo coll? [x] "You have given a collection")
11:44mpenetyou prolly want to just dispatch on `type`, but this screams for a protocol
11:45borkdudehmhm
11:45gfredericksmultimethods are pretty good protocols
11:45gfredericksI think clojure.core/type is a sneaky-cool function :)
11:45mpenetdepends on the context (performance)
11:46cbp(defmulti foo type)
11:46technomancyit's very rare for multimethods to be a performance bottleneck
11:46borkdude(type 1) gives me something else than (type 1.0)
11:46borkdudeI want to use the same definition based on the output of number?
11:46gfredericksborkdude: use Number
11:46gfredericksborkdude: multimethods respect inheritance
11:47hyPiRiongfredericks: perhaps better to use `instance?` instead of `type`?
11:48borkdudeok cool (instance? java.lang.Number 1.0)
11:49hyPiRionwait hummm
11:49gfrederickshyPiRion: wat?
11:49cbptype will work fine
11:50mpenettype can be weird:
11:50gfredericksI like multimethods + type because you can do tricksy things with metadata
11:50mpenet,(type (with-meta {:a 1} {:type String}))
11:50clojurebotjava.lang.String
11:50borkdudeit just works: (defmethod text Number [x]
11:50borkdude "you passed a number")
11:50borkdudecool
11:50cbp(defmulti foo type) (defmethod foo Number [x] :number)
11:50borkdudeI used (defmulti text instance?) btw
11:50hyPiRionwoah, today I learned something new.
11:51akahyPiRion: that keeps happening to me
11:51hyPiRionI just thought it checked for equality
11:51justin_smiththat's what distinguishes type from class
11:51borkdudeso type? also works, hmm let me see
11:53cbp,(isa? Long Number)
11:53clojurebottrue
11:53gfrederickshyPiRion: I think it even does inheritance stuff in collections
11:54gfredericks,(defmulti jean (fn [a b] [(type a) (type b)]))
11:54clojurebot#'sandbox/jean
11:54gfredericks,(defmethod jean [Number Number] [a b] "haha two numbers")
11:54clojurebot#<MultiFn clojure.lang.MultiFn@1093b10>
11:54gfredericks,(jean 3M 4N)
11:54clojurebot"haha two numbers"
11:54gfredericks,(defmethod jean [Long Long] [a b] "haha two LONGs")
11:54clojurebot#<MultiFn clojure.lang.MultiFn@1093b10>
11:54gfredericks,(jean 3 4.2)
11:54clojurebot"haha two numbers"
11:55gfredericks,(jean 3 4)
11:55clojurebot"haha two LONGs"
11:55gfredericksI have no idea how nested it will get, or if it works with maps or what.
12:00borkdudeemacs question: is it possible if you put the point on a symbol, the places where the symbol is used get highlighted?
12:00clgv,(use 'clojure.set)
12:00clojurebot#<SecurityException java.lang.SecurityException: denied>
12:00clgvoh that's new
12:00technomancyborkdude: M-x package-install idle-highlight
12:00clgv,(require '[clojure.set :as s])
12:00clojurebotnil
12:00borkdudetechnomancy thanks :)
12:00technomancynp
12:01gfredericks(inc technomancy)
12:01lazybot⇒ 111
12:02gfrederickstechnomancy: where do you enable this? every file everywhere? just "code files" FSVO code?
12:02clgv,(let [types #(-> % type ancestors)] (->> [1 1.0 1M 1N] (map types) (apply s/intersection)))
12:02clojurebot#{java.lang.Number java.io.Serializable java.lang.Object}
12:02technomancygfredericks: (add-hook 'prog-mode-hook 'idle-highlight-mode) is my recommendation
12:02gfrederickstechnomancy: wat is prog-mode
12:03technomancyit's for progging
12:03justin_smithI think it is a parent mode that language modes inherit
12:03borkdude:-D
12:03gfredericks(inc prog-mode)
12:03lazybot⇒ 1
12:03borkdudegtg, thanks guys
12:03justin_smithhttp://emacsredux.com/blog/2013/04/05/prog-mode-the-parent-of-all-programming-modes/
12:04justin_smith"the parent of all programming modes"
12:05hyPiRiongfredericks: neat, you learned me something new today
12:05arrdemtheoretically
12:09gfrederickshyPiRion: I think clojure has a few interesting features that get mostly ignored
12:12bbloom_clojurebot: forget reactjs
12:12clojurebotExcuse me?
12:13bbloom_~forget reactjs
12:13clojurebotIt's greek to me.
12:13bbloom_*shrug*
12:13amalloygfredericks, hyPiRion: not collections in general, but vectors specifically i think
12:13amalloybbloom_: you have to tell him what to forget about it
12:13bbloom_~reactjs
12:13clojurebotreactjs is a poorly implemented comonad
12:13bbloom_clojurebot: forget reactjs is a poorly implemented comonad
12:13clojurebot'Sea, mhuise.
12:14amalloynow *that* will just make it worse. you taught him about "forget reactjs"
12:14amalloystand back, bbloom_, and let a pro do it
12:14gfredericksamalloy: and just shallow occurrences?
12:14bbloom_amalloy: LOL
12:14bbloom_i suck
12:14amalloyclojurebot: forget forget reactjs |is| a poorly implemented comonad
12:14clojurebotI forgot that forget reactjs is a poorly implemented comonad
12:14amalloyclojurebot: forget reactjs |is| a poorly implemented comonad
12:14clojurebotI forgot that reactjs is a poorly implemented comonad
12:14amalloygfredericks: i don't understand what that means
12:14bbloom_amalloy: much thanks
12:15gfredericksamalloy: [C1 C2 C3] vs [C1 [C2 C3]]
12:15bbloom_now that he who shall not be named has gone, we can purge his nonsense from the brain of poor sweet clojurebot
12:15tbaldridgebbloom_: I have still to understand why I would want to know that something is a co-monad
12:15bbloom_tbaldridge: you wouldn't :-P
12:15amalloygfredericks: see https://www.refheap.com/9b7060a5c29c0f80b43bbb598 - vectors cause recursion in isa?, so you can nest them arbitrarily
12:15gfredericksclojurebot: <X> is a poorly implemented <sufficiently abstract concept>
12:15clojurebot'Sea, mhuise.
12:16bbloom_tbaldridge: i'm trying to rescue reiddraper but i think jimduey may be too far gone ;-)
12:16justin_smith"this thing, I don't know what to call it but it reminds me of reactjs in its structure (though it is better implemented)"
12:16tbaldridgebbloom_: lol
12:16gfredericksamalloy: nice
12:16gfredericksbbloom_: I think test.check has at least three different monads
12:16tbaldridgeit does seem that once people go down the monad trail they stop producing practical code
12:17reiddraperreally?
12:17bbloom_tbaldridge: ah c'mon now
12:17amalloysshhh, tbaldridge is biased, don't listen to him
12:17bbloom_tbaldridge: you went down the trail and returned from the depths
12:17bbloom_you built something practical with monads
12:17tbaldridgebbloom_: very little, lol
12:18gfrederickstbaldridge: also test.check with its three monads has been very practical for me
12:18reiddraperi think test.check is practical.
12:18reiddraperand their use is basically 100% transparent to the user
12:18bbloom_and at least reiddraper had a good excuse for test.check, non-determinism and backtracking are actually a sensible use case
12:18tbaldridgeI've since repented of my ways, infact a prototype of the go macro I'm working on is based on mutable data structures, it cuts the code size by about 1/2
12:18bbloom_although i'd have used a state machine transducing over a sequence, but that's jsut me :-P
12:18gfredericksit's also worth mentioning that despite the three monads, reiddraper didn't try to twist clojure into having some sort of generic monad construct
12:18hyPiRiongfredericks: yet
12:18reiddraperhyPiRion: lol
12:19bbloom_as far as i'm concerned, there are two useful monads: the list monad (we've got that!) and the continuation monad (i'm putting it in to eclj :-P)
12:20amalloyaw, it's cheating to count continuations as one monad, and then use it to model exceptions and io
12:20amalloy(which i recall, perhaps incorrectly, is your plan)
12:20bbloom_amalloy: i didn't say i was going to include do notation or even expose the monadic protocol
12:20bbloom_simply that all this busienss about "free monads" is about creating interpreters
12:20amalloyi know you aren't. you hate generic monads and functors
12:20tbaldridgereiddraper: just out of curiosity does test.check need monads? I'm wondering since I've found that most/all of mukanren can be implemented via lazy seqs instead of monads
12:21bbloom_if you have an extensible interpreter that can (critically important!) grow as well as restrict it's set of functionality, then you don't do syntax
12:21reiddrapertbaldridge: suppose it depends on how you define "need"
12:21tbaldridgeor plerhaps once I start using mapcat + lazy seqs I'm technically using monads anyways,
12:21gfrederickstbaldridge: bbloom_: I think the most syntactically helpful thing I've done while using it is a variant of clojure.core/for, which works since the generators are monadic
12:22hiredmangfredericks: speaking of test.checks for, it doesn't seem to work just like clojure's, it didn't seem to let me refer to values from "outer" generators in "inner" generators
12:23gfrederickshiredman: that sounds wrong?
12:23bbloom_tbaldridge: yeah, you'd technically be using monads.... but i argue it's like technically using a turing machine
12:23gfrederickshiredman: the basic case with multiple clauses turns into bind
12:23bbloom_tbaldridge: nobody wants to program a turing machine
12:23tbaldridgeas to my comment awhile back about "practical code", what I meant was that there is so much dense theory involved in monads, free monads, co monads, etc. That people can spend years reading up on the stuff instead of producing code.
12:23gfrederickshiredman: so the outer value should be visible everywhere below
12:23hiredmangfredericks: ok, I'll try again(and harder) some time
12:23reiddrapertbaldridge: using monads was a really natural way for me to write it, and I think it lead to a clean external API, with little "magic" and gotchas
12:23gfrederickshiredman: if that's not the case, it's a bug
12:24reiddrapertbaldridge: whether you could achieve that or not without them, I'd have to reflect on that a bit
12:24bbloom_reiddraper: i'm actually with you that you made the right *practical* call to use monads if that made sense to you there
12:24gfrederickshiredman: e.g., this test passes: https://github.com/fredericksgary/test.chuck/blob/master/test/com/gfredericks/test/chuck/generators_test.clj#L20
12:24arrdemtbaldridge: by that argument the months I spent reading into lisps and functional languages rather than hacking more C were a waste.
12:24bbloom_reiddraper: but you really should consider reifying the internal state in to a map and then reducing over a command sequence
12:25bbloom_reiddraper: you'll get all the same properties, plus much better debuggability
12:25bbloom_you could pretty easily invent some kind of 'for' syntax for extracting intermediate answers from the state machine too, if you need several monads to cooperate
12:25gfredericksreiddraper: we just need one more monad -- the state monad :D
12:25reiddraperbbloom_: interesting, i'll definitely consider that
12:29YourRatzonHello, I have a question
12:30YourRatzoncan someone explain the following:
12:30reiddrapertbaldridge: to offer another perspective, many of the people who I admire most who're into that theory, produce insane amounts of practical code
12:30YourRatzon(filter empty [:s "" [:k "hi"]])
12:30YourRatzon([:k "hi"])
12:30YourRatzon(filter empty [:s "" [:k "hi"]])
12:30YourRatzon([:k "hi"])
12:30YourRatzon(filter empty [:s "" [:k "hi"]])
12:30YourRatzon([:k "hi"])
12:30YourRatzon(filter empty [:s "" [:k "hi"]])
12:30YourRatzon([:k "hi"])
12:30YourRatzon(filter empty [:s "" [:k "hi"]])
12:30YourRatzon([:k "hi"])
12:30YourRatzon(filter empty [:s "" [:k "hi"]])
12:30YourRatzonoops sorry for multiple lines
12:30amalloy~paste
12:30clojurebotpaste is not gist.github.com
12:30amalloy~refheap
12:30clojurebothttps://www.refheap.com/
12:31gfredericks,(empty :s)
12:31amalloyYourRatzon: anyway, you're confusing empty? with empty
12:31clojurebotnil
12:31gfredericks,(empty? :s)
12:31clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword>
12:31gfredericksweird
12:31YourRatzonI know, empty is what causes a coll to become empty
12:31YourRatzonso I don't understand the output
12:32amalloyfilter is not map
12:33tbaldridgeYourRatzon: so everything that is not a collection is returning nil and is removed by filter
12:33reiddraperamalloy: what's wrong with gist.github?
12:33tbaldridgeleaving only [:k "hi"]
12:33amalloyreiddraper: nothing. it's just clojurebot's stupid inference engine
12:33amalloyand the increasingly absurd things people teach him in order to have fun with said engine
12:33reiddraperah i see, ha
12:34YourRatzontbaldridge: is this intended behavior when filter is ran with a non-predicate, or a bug?
12:34tbaldridgeYourRatzon: no, there's nothing wrong with using a non-predicate, filter just removes items where (not (pred value))
12:35tbaldridgeYourRatzon: your example is just a bit odd since I can't think of a reason why you would want to do what you're doing, but hey it could work
12:35tbaldridge,(filter {:a :b :c :d} [:a :b :c :d])
12:35clojurebot(:a :c)
12:36YourRatzontbaldridge: well actually I have a vector full of collections and non-collections and I want to only keep the collections
12:36gill_try map?
12:36tbaldridgeYourRatzon: you could try this then
12:37tbaldridge,(filter coll? [:a "foo" 1 [1 2 3] #{1 2}])
12:37clojurebot([1 2 3] #{1 2})
12:37YourRatzonthanks that works
12:38YourRatzoni just came across the (filter empty) behavior by accident and didnt udnerstand why it was working the way it did
12:38YourRatzonthanks for the explanation
12:38caternI just went through https://devcenter.heroku.com/articles/clojure-web-application and I am a little confused - how am I supposed to debug things?
12:38caternwhen I stick print statements in my functions, they don't print to the REPL
12:38caternshould I print to the web page? /new to web development
12:39caterni think i would prefer it if I could print to the REPL..
12:39catern(Cider specifically)
12:41{blake}In working with this code https://www.refheap.com/61d3a3c7f691c1f26c8084770 amalloy volunteered yesterday (thanks to all for the feedback, btw) I realized that it gives me a list of maps containing vector keys and vector values, when I really want one map.
12:41{blake}So I changed the "(conj (index content tt) {tt content})" to "(assoc (index2 content tt) tt content)" figuring that would get me the right structure, even though multiple entries for a key would wipe each other out. Instead, I get a "clojure.lang.LazySeq cannot be cast to clojure.lang.Associative".
12:41nullptrcatern: they print to the browser debug console
12:42caternnullptr: whaaaaaaaaat really? just auto[magically?
12:42catern(by print to the web page I meant just stick in calls to "str" in random places)
12:42catern(and inject that into the hmtl)
12:43caternautomagically*
12:43caterni don't see them in "Console" in Firefox's debugger, where should I be looking?
12:43nullptrstr just makes a string -- but assuming you're using print and have enabled it[1] the messages should show up there 1. https://github.com/swannodette/om/blob/master/examples/counters/src/core.cljs#L7
12:44caternno no, haha
12:44caterni'm just using clojure and compojure and ring
12:44caternto serve static HTML
12:45nullptri see, assumed cljs from your commentary
12:45caternand if I put a (println "Foobar") in the function that produces my index page, it doesn't seem to print anywhere
12:45caternit sure would be cool if that somehow ended up in the browser debug console :D
12:46amalloy{blake}: a for-comprehension necessarily produces a sequence, and doesn't have access to "previous" values. but it should be possible to do what you want either by reducing over something, or using an `(into {} (for ...))` stanza once you're done producing the list
12:47{blake}amalloy, So the error itself is because it IS a lazy sequence, even though I'm realizing it right then?
12:48{blake}amalloy, (I mean, I figured I could do it that way, but I'm not always sure that the way I'm thinking is idiomatic.)
12:49amalloyit has nothing to do with laziness or realizing. sequences just aren't maps. i don't know what (index2 content tt) returns, but apparently it's a sequence, and you're trying to assoc onto it
12:49amalloyeven if it worked, you'd still get out a sequence in the end, because that's what for produces
12:50{blake}index = index2, I just renamed it to work on it.
12:50{blake}The idea was to make it return a map rather than a sequence.
12:52{blake}But it can't return a map because it's a "for"...that's what I'm missing.
12:56gill_{blake}: what data do you pass in? have a paste of that?
12:57devntechnomancy: any idea of how I can get rid of this error: java.io.FileNotFoundException: data/stats/all.edn (No such file or directory) -- this is after loading the test data for clojars.org
12:57devnand trying to view a specific project page, like 'clojure-useful' or whatever
12:58{blake}gill_, I'm using https://www.refheap.com/86314 for sample data.
12:59devntechnomancy: nevermind (for now) -- looks like we just need to run the tests
13:01{blake}So an "into {}" gives me the right structure, I just have to keep it from overwriting the existing value (which reminds me of a 4clojure exercise...)
13:03gill_so you could call with (into {} (index sample0 [])) ?
13:04{blake}Well, that still overwrites the keys.
13:05gill_okay just making sure i understood
13:05nullptrbx
13:05rasmustohrm, you're talking about overwriting keys in an (into {}) call?
13:06{blake}Right now I have a map of {[vector-key][]...} and I need a map of {[vector-key][value value value]}.
13:06{blake}rasmusto, yes
13:06rasmustoi wonder if you could use some combination of partition[-by] and merge-with
13:06rasmustoor just a plain old reduce
13:07amalloy(apply merge-with into the-maps)
13:08{blake}sorcery!
13:08amalloybut you need to be careful, {blake}. if you make `index` return a map, then its recursive calls to itself, which expect a sequence, will break! you instead probably want some function wrapping index, which converts the produced sequence into a map
13:10{blake}amalloy, Yeah. I've done that. =P
13:18dbaschsomeone needs to restart the process that logs this channel! http://clojure-log.n01se.net/
13:18dbaschor I could host my own on my trusty aws micro
13:20cbpdbasch: lazybot also logs logs.lazybot.org
13:20rasmustologlazyloglazy
13:21dbaschcool, I was already thinking about writing a logger with some evil replacement patterns
13:21dbasche.g. filter -> purify
13:21cbpmonad -> burrito
13:22dbaschI like your thinking cbp
13:26dbaschI’m hungry, let’s get a monad
13:27arrdemwhat? it's not 12:00UGT yet!
13:27gfredericksthere was a group that went out for monads at clojure/west one day
13:32behelitplanning to take clojure for a spin. figured i'd start with a web project. which framework(s) are worth looking into?
13:33nDuffbehelit, in general, we don't like frameworks here. :)
13:33deathknightHey guys, using java for my first time with lein and cider-jack-in can't start a REPL server.
13:33behelitcoming from python+django (form heavy, crud apps) and erlang+cowboy (webapps, ws etc).
13:33technomancy
13:33nDuffbehelit, ...the Clojure Way encourages small tools that aren't heavily opinionated about how they're used or combined with others.
13:33cbpbehelit: Luminus is gr8
13:33behelitnDuff: ok, hat lbs for form generation, validation, session management, dbdrivers etc?
13:34behelitheh, s/hat lbs/what libs/
13:34behelit:)
13:34rasmustoheh, s/hat
13:35behelitand routing of course.
13:35arrdem-f /dev/hat
13:35nDuff...now, if you wanted something that _was_ very framework-y, there's Hoplon (hoplon.io)
13:36technomancycompojure is what everyone uses for routing. there are about a bajillion validation libraries that seem to all do the same thing though.
13:37cbpI don't use compojure!!
13:37nDuff...in terms of database drivers, there's clojure.java.jdbc, which everything backends into, and then a few different flavors on top
13:37technomancy~guards
13:37clojurebotSEIZE HIM!
13:37behelithehe
13:37cbpNooo! death to macros
13:37behelitand templating?
13:38behelitring for middleware it seems
13:38technomancybehelit: templating depends on who's going to be writing them. if it's all going to be handled by clojure programmers then hiccup is definitely the simplest choice.
13:38technomancybut it's not so good for interacting with designers
13:38nDuffbehelit, ...so, the shiny new way to do things is to have your UI generated client-side with Om, which is bloody awesome (and has a hiccup-like interface).
13:38cbpbehelit: http://www.luminusweb.net/
13:38technomancyplease don't generate your HTML exclusively client-side =(
13:38nDuffbehelit, ...but that's if you're writing something that's a single-page-app everything-rendered-clientside type deal.
13:38behelitcpetzold: checking that out.
13:39cbp(inc cpetzold)
13:39lazybot⇒ 1
13:39justin_smithtechnomancy: you crufty old gnu-hippies who never turn on javascript will have to crack one of these days
13:39behelitnDuff: yeah, we've used react, angular et al for webapps previously. Will look into Om.
13:39koreth_Search engines also don't deal well with client-side page generation (though Google is improving in that area recently). Not an issue if your site isn't public, of course.
13:39arrdemjustin_smith: I'll just keep waiting until we replace JS with a real language...
13:39nDuffbehelit, ...also, the "death to macros" advice given by cbp should be taken into account when deciding on database libraries; Korma is much, much too macro-centric in my experience; makes it hard to work with sometimes.
13:40nDuffbehelit, *nod* -- if you're familiar with React, you'll be very very comfortable with Om.
13:40technomancyjustin_smith: maybe once they figure out a way to make JS not completely suck from the keyboard
13:40cbpAlso timbre
13:40behelitgreat stuff
13:40cbpso i herd u like macros
13:40rasmustowait, is that possible?
13:41michaniskini love macros
13:41rasmustomacro macros
13:41rasmustoi mean
13:41cbpi have a macro inside your defmacro inside your defmacro
13:41justin_smithrasmusto: maybe like using m4 and a configure script to generate your clojure macros?
13:41arrdemyo dawg i heard u leik macros...
13:41behelitnDuff: any db in particular that's commonly used in the community? i currently use postgres, riak, and/or redis in most projects.
13:41rasmustoic
13:42cbpbehelit: I guess datomic
13:42behelitoh. never did try datomic.
13:42amalloyarrdem: http://ro-che.info/ccc/20
13:43cbpno reason not to use any of the others though but I heard edn support in non clojure languages is kinda bad
13:43justin_smithcbp is very much a clojure niche thing, but I don't know how prevalent it is
13:43behelitcbp: edn support?
13:43justin_smith*it is
13:43clojurebotIt's greek to me.
13:43justin_smith~edn
13:43clojurebotTitim gan éirí ort.
13:43justin_smithbehelit: edn is a spec describing the most simple level of clojure data literals
13:43cbpbehelit: like json for clojure
13:44behelitah
13:44arrdemamalloy: heh
13:44cbpwhich is what datomic works with
13:44cpetzoldcbp: lazybot thinks i’m a 0 :(
13:44behelitgreat. i think i have all i need to get started.
13:45behelitthanks a million, guys
13:46Jaoodis there a favourite db for datomic?
13:46Jaoodstorage option
13:48gfredericksdepends on what you need for perf/scalability and how easy it is for you to setup things
13:48behelitoh, datomic can run on top of riak?
13:50Jaoodgfredericks: was wondering is there is one storage option that is more tested and more well supported than the others
13:50Jaoodbehelit: yes
13:51gfredericksJaood: not that I know of
13:55stompyjcatern: heroku logs --tail
13:55stompyjahhhh
13:55caternstompyj: wat?
13:56stompyjcatern: were you asking about seeing output from your heroku instance locally?
13:58caternstompyj: no, I want to see things I print in the REPL
13:58caternI don't use Heroku
13:58caternthings I print in functions that are executed by jetty*
13:58stompyjaha, I assumed you did when you linked a URL from heroku
13:59stompyjsorry bout that
13:59sandbags0I've added :jvm-opts ["-XX:-OmitStackTraceInFastThrow"] to my project.clj to avoid getting "NullPointerException [trace missing]" errors and now I get a trace, but only the first line of the trace
13:59clojurebotCool story bro.
14:00sandbags0anyone know how to get the full trace?
14:00justin_smithcatern: probably something like /var/log/jetty[N]/*
14:00cbpclojurebot: be nice
14:00clojurebotNo entiendo
14:00justin_smithwhere N if present would be the version
14:00sandbags0unfortunately finding out it's in Numbers.java isn't as helpful as it could be
14:01cbpmaybe its something like ##(+ 1 nil)
14:01lazybotjava.lang.NullPointerException
14:01cbp:-P
14:01dbaschcatern: are you using cider?
14:02cbpsandbags0: you can try using tools.trace
14:02amalloysandbags0: i think tieredstopatlevel can help? the problem is often that the code has been JITed to death
14:02sandbags0cbp: thanks, i will look into that
14:02sandbags0amalloy: is AOT related here? compojure seems to turn it on by default ":aot :all" maybe i should turn it off?
14:03sandbags0i'm not sure if the AOT thing is removing info that the runtime might later want to use
14:03amalloyprobably not, although i hate aot all
14:03sandbags0tyring it without
14:03behelitquick question, trying to persuade a colleague to join me: three reasons to use clojure.
14:03arrdemif the JIT is killing printlns or :aot :all is disabling code, there are huge correctness issues.
14:03arrdemneither of those compiler steps should do either of those things.
14:04sandbags0yep, removing aot didn't help things
14:04technomancyarrdem: it's a bug within hotspot
14:04arrdemtechnomancy: heaven help us all...\
14:04sandbags0okay so tools.trace looks useful (something like spy/p) but means i have to instrument all my code to figure out where the NPE Is being raised
14:04caterndbasch: yes
14:05dbaschcatern: check the *nrepl-server* buffer
14:05caterndbasch: thaaaaaaaaaank you
14:05sandbags0i'm struggling to understand how all the stack information is being lost bar the deepest point
14:06justin_smithsandbags0: JIT scrambles the call stack as it optimizes (or at least *can* do so)
14:07sandbags0hrmm... okay yes, thanks, that makes sense.
14:07sandbags0so i guess my next step is turning off the jit compiler
14:08arrdemAFAIK the JVM requires that stack trace frames be reported in JVM model order no mater what the runtime does to optimize code, failure to do so being a major JVM bug. More likely lazy sequence evaluation makes the stack appear out of order.
14:08arrdems/being/is a/g
14:09sandbags0hrmm... seems -Xnojit is no longer with us
14:11sandbags0so i found something suggesting -Djava.compiler=NONE will turn off the JIT compiler, not sure how up to date that is
14:12sandbags0but i'm still getting "NullPointerException clojure.lang.Numbers.ops (Numbers.java:961)"
14:12sandbags0starting to think binary searching with spy/p might have been quicker!
14:12sandbags0i struggle with the notion that Clojure can't actually deliver a useful stack trace in the REPL
14:15dbaschsandbags0: maybe you’re inc’ing nil or something like that? http://java.dzone.com/articles/reading-clojure-stacktraces
14:15dbasch,(inc nil)
14:15clojurebot#<NullPointerException java.lang.NullPointerException>
14:15arrdem,(doc fnin)
14:15clojurebotGabh mo leithscéal?
14:15sandbags0dbasch: yes, i could be doing anything
14:15dbasch&(inc nil)
14:15lazybotjava.lang.NullPointerException
14:15arrdem,(doc fnil)
14:15clojurebot"([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched."
14:15j0nidbasch: so i have tried this in my project.clj: [capacitor "0.2.2" :exclusions [org.clojure/core.async]]
14:15sandbags0the point is, without some implicated *clojure* code I am left to analyse my entire code path
14:15j0niit doesn't work though - did i do it right?
14:16arrdemsandbags0: er... or you could paste a stacktrace and get some help.
14:16sandbags0arrdem: i pasted it above
14:16sandbags0Numbers.java:961
14:16sandbags0that's the entire output in the REPL
14:16AWizzArdI would like to combine two leiningen calls: 1. lein jar 2. lein localrepo install target/foo-0.1.0.jar tld.expamle/foo 0.1.0
14:16dbaschj0ni: looks right to me, but you may want to ask someone who’s more familiar with how lein deals with dependencies
14:17AWizzArdCan this be done with actually calling Leiningen just a single time, and let the same jvm do both jobs?
14:17arrdemsandbags0: that single line is worthless. paste (or just read) the whole thing. If that's all the trace that you're getting printed, try (clojure.stacktrace/print-stacktrace *e) at the repl after you replicate the exception.
14:18gfredericksAWizzArd: `lein do` can combine commands
14:18arrdem*e is a dynamic variable that the last top level exception gets bound to.
14:18j0nidbasch: thanks, i guess that would be technomancy
14:18sandbags0arrdem: yep that's all i got, i'll try your trick, thanks
14:18AWizzArdgfredericks: will try that, thanks
14:19technomancyj0ni: without any context, that looks right to me
14:19sandbags0arrdem: marvellous! thank you
14:20aphyrWhat's the right way to establish a binding thread context in a future?
14:20aphyr,(future (eval '(do (ns foo) (prn *ns*))))
14:20clojurebot#<SecurityException java.lang.SecurityException: no threads please>
14:20sandbags0i've no idea why the REPL is hiding everything but the top line but that gives me the full-trace, thanks
14:20arrdemsandbags0: sane defaults or something, the presumption being that you know how to get the whole thing.
14:20justin_smithsandbags0: OK after the error, try (clojure.repl/pst)
14:21AWizzArdgfredericks: works well, thanks for the tip.
14:21sandbags0justin_smith: better yet!
14:21justin_smithit could be you don't have full stack traces turned on (and thus you would have to ask for them)
14:21sandbags0ah, i didn't realise this was something one would need to turn on
14:21sandbags0perhaps for those who are telepathic with the machine a stack trace is unnecessary ;-)
14:21justin_smithusually nrepl will (use 'clojure.repl) such that (pst) suffices
14:22sandbags0justin_smith: yep, that does work
14:25sandbags0i am now wishing i hadn't lifted prismatic/schema out of this code :)
14:25arrdemsandbags0: type signatures, type checking assertions and core.typed are all pretty nice ;P
14:27technomancysandbags0: it's super annoying that you don't get stack traces, and I would like to fix it in a future version
14:27arrdemtechnomancy: sometimes I get a popup stack trace buffer. sometimes. which is more annoying than all the time.
14:28technomancyarrdem: in cider you mean?
14:28arrdemyarp
14:28technomancyI was thinking of reply
14:28sandbags0technomancy: now that i know the (pst) trick it's not so bad, but it's a bit startling to be told (as it seemed) "There was an error somewhere fucknutz, take your best shot as to where"
14:28sandbags0certainly at a REPL
14:28technomancysandbags0: nah the pst trick is kinda crap
14:28technomancysince you have to re-use every time you change namespaces
14:28technomancyhell of tedious
14:28sandbags0O_o
14:29sandbags0do Rich & co just write perfect code first time often enough that error handling isn't an issue?
14:30technomancyoh man do not get me started on the core team's ideas about usability
14:30gfrederickstechnomancy: that's more due to the problem of having util stuff across namespaces at all
14:30arrdemtechnomancy: I just read the namespace/var code.. you were right about strictly non-hierarchical. I was kinda surprised.
14:30sandbags0heh... sorry... won't poke the bear :)
14:30technomancycan basically be summed up with "usability is hard, so why bother trying?"
14:30technomancygfredericks: that's why you need nrepl-discover
14:30dbaschtechnomancy: it’s surprisng how many hard-core tech people think that way, including the bitcoin team and the old linux devs
14:30gfrederickstechnomancy: oh man do not get me started on the leiningen team's ideas about doing things
14:31gfredericksthey always involve writing emacs libraries
14:31technomancysandbags0: context: https://github.com/technomancy/leiningen/issues/799
14:31arrdem(inc gfredericks)
14:31lazybot⇒ 66
14:31sandbags0well i guess this is always a problem when you have a "core team"
14:31sandbags0they'll have the shit they care about and everything else tends to wither
14:31trptcolinaphyr: (future-call (bound-fn [] #(do (ns foo) (prn *ns*)))) is one way to do it iiuc
14:31technomancygfredericks: vim libraries too, yo
14:31sandbags0at least it's a Lisp so you can work around it somewhat
14:31sandbags0technomancy: ta
14:31gfrederickssandbags0: yeah that
14:32technomancysandbags0: y'know, if you get a commit into lein, you get a free sticker
14:32technomancyjust sayin'
14:32sandbags0technomancy: is there any qwality control operating around accepting commits?
14:33technomancysandbags0: well if you fix #799 I'll make it three stickers
14:33sandbags0i look forward to claiming my stickers in 2029 or thereabouts
14:33sandbags0i'm still pretty much a clojure new bug
14:34amalloysandbags0: i can confirm that there is not: https://github.com/technomancy/leiningen/pull/688
14:34technomancyamalloy: good times!
14:34sandbags0heh
14:34amalloy(that was a joke pull request i sent, which was insta-merged)
14:34amalloyUSAGE: lein repeat 5 do deps, clean, compile, uberjar
14:34sandbags0technomancy: that discussion ended in May 2013
14:35sandbags0given the circs today i guess that's not encouraging
14:36technomancysandbags0: well, lein is pretty stable; there hasn't been all that much going on since then
14:37technomancysandbags0: and it's not surprising that a fix that involves two external libs would take longer to address than something that's solely in lein
14:37sandbags0i didn't so much mean it as a failure of lein
14:37sandbags0which i perceive it isn't
14:37sandbags0as... people talking about this in May 2013, still a problem in June 2014
14:37aphyrtrptcolin: good call
14:38sandbags0suggestive of still being a problem come July 2015
14:39technomancynot if you fix it =D
14:39sandbags0ha, i might understand it come July 2015
14:42arrdemtechnomancy: pardon my poking, but are there specific usability concerns you do have with the core? just curious.
14:45weavejesterOut of curiosity, what core?
14:50mdrogalisIs it that time of the week again to complain about Clojure's error messages?
14:50mdrogalisSorry I'm late!
14:50arrdemmdrogalis: sandbags0 started it
14:51sandbags0no no i think the core team started it :-P
14:52technomancy~gentlemen
14:52clojurebotYou can't fight in here. This is the war room.
14:52sandbags0ha
14:52mdrogalisHahah
14:53weavejesterHas anyone heard of a construct like multimethods, but one that merges matching results, rather than returning just one
14:53mdrogalisThat's an interesting idea.
14:53weavejesteri.e. multimethods will return the most specific match
14:54weavejesterbut what if you had something that merged the results via a custom function
14:54technomancysandbags0: anyway, it looks like this works in the current lein release: :repl-options {:caught clojure.repl/pst}
14:54weavejesterLike ‘some’
14:54tbaldridgesandbags0: I think it's worth pointing out that the "core team" differs drastically in what they use. Some emacs, some use nrepl many don't, etc. But none of that is maintained by "the core".
14:55tbaldridgetechnomancy: is there anything stopping lein/nrepl from having a different default for stacktraces?
14:55technomancynope, literally working on it right now
14:56technomancymy comments were more about the contents of the stack traces
14:56tbaldridgesandbags0: and if you want to go completely off the deep end, you can use stuff like this: https://github.com/AvisoNovate/pretty :-)
14:57mdrogalisSo I actually use that lib, and it's kind of awesome sometimes.
14:57arrdemtbaldridge: ooh nice
14:58weavejesterI guess what I’m looking for is a more general form of polymorphism…
14:58technomancyand the documentation
14:59mdrogalisweavejester: Sort of more general, but also more specific in the sense that results have to be associative.
14:59mdrogalisweavejester: side-effect order would also be another constraint.
14:59tbaldridgeweavejester: yeah, I've seen a need for that, where the match value is a pattern, and the multi method runs all matches
15:00weavejestermdrogalis: Yeah, the order would matter, but it sometimes does with multimethods as well. Hence prefer-method
15:00tbaldridgemultimethods aren't that complex, should be possible to write something like this. It'd basically be O(n) though
15:00sandbags0technomancy: nice!
15:01mdrogalisweavejester: That's a good point.
15:01weavejestertbaldridge: Yes, though I don’t think it would necessarily be O(n). You’d just need to run it through the ancestors of the dispatch value.
15:01technomancysandbags0: unfortunately getting it in by default has some issues around messing with *1 and friends
15:01technomancyso I think the best we can do is make it easy to enable
15:01weavejesterSo you take the ancestors of each dispatch value, run the function for each one, and then apply a combining function.
15:01weavejesterFor multimethods this would just be the most specific dispatch.
15:02tbaldridgeweavejester: ah! I see. If the multimethod has ASeq, ISeq and Cons you wan't all three to run, but not IPersistentVector.
15:02tbaldridge*want
15:02weavejesterBut you could have “every?” for predicates, so you could add new rules that would narrow the focus
15:04weavejestertbaldridge: Well, consider a keyword like ::natural, that derives from ::integer and ::positive. You’d want both ::integer and ::positive to run, and then their results combined together with “and”
15:04tbaldridgeright
15:04weavejesterWith a multimethod, you choose one. But if we add a combine function, we can extend functionality without overriding existing rules
15:04tbaldridgeOOP FTW!!!
15:05tbaldridgeclojurebot: OOP
15:05clojurebotCool story bro.
15:05weavejesterHaha :)
15:05tbaldridgethat's basically what you're asking for, super(foo)
15:05weavejesterYeah, kinda. But in OOP you manually add the super
15:06weavejesterreturn super(x) && pos?(x)
15:06weavejesterSo each class is responsible for combining the result
15:06clojurebotRoger.
15:09weavejesterI guess I’m wondering if this multi-multimethod idea has been done in another language
15:10weavejesterIf just so I can get a better name for it ;)
15:12bbloom_weavejester: sorry, i'm a bit late to the chat, but i think i can help
15:12weavejesterbbloom_: I welcome any help :)
15:12bbloom_you're saying you have some dispatch and want to return all possible matches
15:12bbloom_yes?
15:12clojurebotyes isn't is
15:12bbloom_do you need to *execute* all possible matches?
15:12bbloom_and in any particular order?
15:14weavejesterHm, in the simplest case, yes. In theory there are ways of discarding a result based on the dispatch vaue
15:14weavejesterYes, so consider a predicate multimethod
15:15weavejesterFor ::integer it returns true if a value is an integer
15:15weavejesterFor ::above-one it returns true if a value if above one
15:15dbasch~oop
15:15clojurebotTitim gan éirí ort.
15:15bbloom_yeah, so "decomplecting" dispatch and evaluation, you need a multi-result on dispatch, then some combining function, then you can evaluate that
15:15weavejesterSo then I derive ::natural from ::integer and ::above-one
15:16weavejesterYeah, essentially… (combine-f (map multi-f (ancestors dispatch-val)))
15:16bbloom_whenever you have multiple results, you can think about it as ambiguity
15:16bbloom_and you can resolve ambiguity by lifting in to a domain where it's explicitly ambiguous
15:16weavejesterNot sure I follow that
15:17bbloom_um... hmm how to explain
15:17weavejesterWith normal multimethods, the choice is simply “choose the most specific dispatch”
15:17bbloom_instead of saying you're returning multiple results, you return one result with multiple values in it
15:18weavejesterYes… multiple values combined by some function. So you’d have a dispatch-fn and a combine-fn
15:18bbloom_yup
15:18bbloom_do you have a particular use case in mind?
15:19bbloom_the fundamental issue w/ predicate dispatch is one of ambiguity... you can't tell who to dispatch to if you don't have proof of logical implication... but that's when you want only a "most specific" method to match
15:19bbloom_i'm curious if you need a combining function that respects the lattice for matches... that is you need to combine such that the arguments to the combining function are in some order with respect to what a single-result dispatch would have produced
15:20bbloom_or if combining happens on a set
15:20bbloom_w/o order
15:20weavejesterYeah, I have two use-cases in mind. One would be a predicate multimethod, i.e. the combine-fn would be #(apply and %) or (every? identity %) I guess.
15:21weavejesterThe other would expect a collection to be returned, and concatenate the collections, so the combine function would be concat
15:21bbloom_by every? identity, you mean you want to check if the logical conjunction of all the methods is true?
15:21bbloom_have you considered grammars?
15:21weavejesterGrammars?
15:21bbloom_so grammars are basically what you want for the first thing
15:22bbloom_for the second thing, you need to worry about order
15:22bbloom_people think of grammars as being for parsing
15:22bbloom_but that's selling them short!
15:22bbloom_a grammar production can be interpreted as a predicate
15:23weavejesterOh, such as “is this syntax correct”?
15:23weavejesterIn the most common case of parsers
15:23bbloom_yeah, basically "does this structure satisfy this grammar production"
15:23bbloom_you can use gramamrs on anything, not just text
15:23bbloom_and grammars can compose nicely
15:24bbloom_so if you're trying to test a logical disjunction, you can just union grammars... or a logical conjunction, you can just intersect grammars
15:24gfredericksclojurebot: bbloom is a fount of things you didn't know you didn't know
15:24clojurebotAck. Ack.
15:25bbloom_the concat case is a lot more alien though...
15:25weavejesterbbloom_: Do you have any links for further reading?
15:25hiredmanit also sounds similar to logic programming, e.g. getting a collection of results back
15:25bbloom_hiredman: yup, hence mention of ambiguity
15:26weavejesterYeah. It’s not so much a concat as a set merge
15:26bbloom_weavejester: i've had a hard time finding good research on grammars for things other than parsing
15:26weavejesterunion rather
15:27bbloom_weavejester: you can search for the words "union" and "intersection" with respect to grammars
15:27weavejesterI was experimenting with a system for representing realtime system state over a network
15:28bbloom_https://en.wikipedia.org/wiki/Context-free_language talks about stuff like compllement, intersection, difference
15:28bbloom_words suggestive of sets ;-)
15:28weavejesterEssentially pulling ideas from datomic and representing the current state as a set of [e a v] triples, with an addition time component
15:28dbaschbbloom_: I know of someone who used context-free grammars to test circuit designs
15:28bbloom_dbasch: awesome
15:29weavejesterI guess I have two broad goals
15:29bbloom_hmmm CFG are closed under union, but not complement, intersection, or difference
15:29bbloom_bummer :-P
15:30weavejesterdetermine whether a message is valid given a current state, e.g. (valid? state msg) -> bool
15:30weavejesterAnd to work out the consequences, or reactions to a message
15:30weavejester(reactions state msg) -> msg
15:30weavejesterI mean -> [msg]
15:30hiredmanso, like, a rules system?
15:30weavejesterYeah
15:31bbloom_yeah, so validation systems are deeply related to grammars too
15:31bbloom_you've got some value and you need to analyze it to see if it satisfies some requirements
15:31hiredmanhttps://twitter.com/aphyr/status/474627972641480704
15:32weavejesterIf a rule is a triple, [e a v], e.g. [:fred :age 30], and a state is a map {[e a v] -> t}
15:32weavejesterOr just a set #{[e a v t]}
15:33weavejesterThen I guess I both want to check if a rule can be added to the state - validation
15:33weavejesterAnd check what the effect of that rule will be
15:33weavejestervalid? :: state rule -> bool
15:33aphyrhiredman: pretty mad tbh
15:34weavejesterreactions :: state rule -> [rule]
15:34bbloom_aphyr: what patch are you waiting on?
15:34aphyrdev.clojure.org/jira/browse/CLJ-1415
15:34aphyrlike I spent a full week writing this patch and providing extensive benchmarks
15:34aphyrliterally doubles performance
15:34aphyrfor json parsing
15:35aphyrlike this close to just forking Clojure into a real project on github and accepting community PRs
15:35aphyrcuz jira and fighting git are taking up the bulk of my time
15:36bbloom_jira is a nightmare :-/
15:36aphyryeah, I've also got low confidence that any of this work will pay off in a merge
15:36aphyrlike, unclear whether I should put in another N hours if it's just gonna go round in circles
15:38bbloom_i mean, it looks like a non-trivial patch & alex seems like he's being pretty cooperative... what's the real problem here? that it's not merged yet?
15:39ViestiI'm using postwalk to transform a json structure with dots in keys (mongodb doesn't like those) and it seems that postwalk is slow, is there a faster alternative, maybe transients?
15:39bbloom_weavejester: have you seen daedalus? and bloom/bud ?
15:40bbloom_weavejester: it's aimed at distributed use cases, but there's some interesting stuff in there for logic rules & communicative operations
15:40weavejesterbbloom_: They don’t ring a bell
15:40bbloom_might be worth studying
15:40bbloom_http://www.bloom-lang.net/
15:42bbloom_but i guess that incorporates time, which you don't really care about yet... right?
15:42weavejesterI do have a time component
15:42bbloom_hm
15:43weavejesterEssentially I keep the state as {[e a v] t}
15:43j0nitechnomancy: the rest of the project.clj is here https://gist.github.com/j0ni/b173f407fc30e41f05d3
15:43bbloom_yeah, def check out the paper on deadalus
15:43weavejesterThat way I can calculate continuous functions and expiry
15:43bbloom_maybe cemerick have some ideas from the CRDT world too
15:43weavejesterWhere is the daedalus paper?
15:44weavejesterOh, I think I’ve found i
15:44weavejesterit
15:44weavejesterI was assuming it was Clojure at first
15:44bbloom_http://www.eecs.berkeley.edu/Pubs/TechRpts/2009/EECS-2009-173.html
15:44bbloom_i spelled it wrong
15:44bbloom_dedalus is right
15:45j0nitechnomancy: let me know if there's some debugging activity that might help figure out what up
15:45cemerickbbloom_: long scrollback, it seems. What's the question? Ways to represent time in a distributed fashion?
15:45weavejesterEssentially I have a system that takes events: [:assert/:revoke e a v t] and produces a state {[e a v] t} plus some indexes
15:45bbloom_cemerick: weavejester is exploring validation of states & transitions, i think
15:46weavejestercemerick: Yeah, essentially. A way of representing a current state that can be distributed across a network.
15:47aphyrbbloom_: yeah, alex is doing the right thing, it's just a ton of work is all
15:47aphyrI forked clojure internally and that solved the problem
15:47bbloom_aphyr: it sucks that it's so slow, but ... yeah that's what i was gonna say: you can always run your own branch while you "wait"
15:47aphyrafter a full week's work I got frustrated and didn't want to do any more
15:47bbloom_to me, the problem is that it's such a pain in the ass to fork & manage your own artifacts
15:47weavejesterI’m just considering how to manage validations, i.e. is an event for a particular state valid, and reactions, i.e. what are the consequences of an event
15:48bbloom_which is a problem w/ a lot more than just clojure
15:48bbloom_basically everything
15:48aphyrabsolutely agree, managing artifacts is a PITA, but less than jira
15:48bbloom_hence the desire to just run off the latest version from the primary maintainer
15:48hiredmansonian ran its own fork of clojure for a while, that may also have been keyword related
15:48aphyrAnd like N people in sidechannels have told me they'd support a fork on github
15:48cemerickweavejester: bbloom_ mentioned bloom/bud, and that's definitely interesting to tinker with; a Clojure impl would be pretty killer, but I've never investigated daedalus seriously
15:48aphyrI wanna do it, but tracking upstream is a timesink I don't want to deal with
15:50tbaldridgealthough tracking upstream isn't so bad on a project with as few commits as Clojure has.
15:50tbaldridgeperhaps once the two diverged enough
15:50cemerickweavejester: CRDTs certainly fit the bill as well, but that's not necessarily saying much. The hardest part is in reconciling the semantics you care about with the axiomatic requirements of CRDTs/semilattices. (ACI, etc)
15:51cemerickweavejester: and unless you're happy to accept LWW, then you need a more subtle notion of time than wall clocks, etc
15:51cemerickor, even then, given skew, etc.
15:51weavejesterLWW or LVW?
15:52cemerickweavejester: Last Writer Wins; LVW?
15:52weavejesterOh, last value wins
15:53weavejesterI couldn’t work out the middle w :)
15:53weavejesterI’m essentially going for a client/server model, with the server maintaining the canonical state, and the clients being somewhat lossy
15:53weavejesterSo time is server-time
15:54weavejesterA client connects, gets the approx. server time, then a dump of the current state {[e a v] t}
15:54cemerickweavejester: so the "clients" are retaining at least some portion of the data model, rather than making particular queries
15:55cemerickah, sure
15:55weavejesterYep. The whole thing, essentially.
15:55weavejesterEvery so often the server will pass them the whole thing so they don’t deviate too much.
15:56weavejesterBut usually they’ll accept [o e a v t] messages, where o is the operation, :assert or :revoke
15:56weavejesterThis produces a state {[e a v] t}
15:57cemerickweavejester: Well, that's so close to replication, you might as well go all the way. :-P
15:57weavejesterIt essentially is replication
15:58weavejesterWhere it gets fuzzy is that I have a function
15:58weavejester(tick state time) -> state
15:58cemerickright, with pessimistic deltas occasionally, etc
15:59cemerickeveryone wants a pleasant distributed state machine :-)
15:59weavejesterI also have functions:
15:59weavejester(valid? state event) -> bool
15:59weavejester(commit state event) -> state
15:59technomancyj0ni: try `lein deps :tree`
15:59weavejester(react state event) -> [event]
16:00cemerickweavejester: you have multiple concurrent actors touching shared data?
16:01weavejestercemerick: Yes, but the state can only be changed by commiting an event
16:01hiredmanhave you considered just implementing raft?
16:01weavejesterRaft?
16:01hiredmanthe concensus algorithm
16:02weavejesterAh, found it
16:02hiredmanyou have a leader replicating a log of operations to followers, and when a quorum of followers have and operation it is commited
16:02cemerickweavejester: Well, you have two choices. You can either have a real consensus mechanism (like paxos/zk/raft) mediate those concurrent changes, or you can change the model to think in terms of convergent states as opposed to proposal->commit
16:04cemerickIn the latter, a "commit" of a valid state can be seen as simply marking a particular causal history.
16:04weavejesterI was thinking just implementing a very naive first-one-wins approach for concurrent changes
16:05hiredmansure, but you want to replicate the changes?
16:05weavejesterYep
16:06mordocaiAnyone know if the latest (think it was released today?) cider might be broken? I hadn't tried to use it in awhile. Relevant data on my setup here: http://pastebin.com/VbzZjgyX
16:06hiredmanso a lot of concensus algorithms work on the baisis of replicating logs of operations and once a quorum has the logs, and advance the known commited operations
16:07hiredmanand once an operation is commited it can be applied to whatever state is being maintained in concensus
16:08weavejesterhiredman: Yes. In this case the server takes an incoming message from a client, checks if it’s valid, relays it to all the clients and updates the internal state.
16:08weavejesterAt regular intervals, the clients get the full state from the server, correcting any drift
16:08hiredmanit may be just because I have been fiddling with raft, but that sounds a lot like it
16:09weavejesterRaft seems more concerned with correctness than I am, reading through it
16:09hiredmanif you don't care about stale reads, that sounds a lot like how, uh, that one implmentation of raft did
16:10hiredmanweavejester: if you don't use the raft protocol to do reads of the state, then it sounds even more similar
16:10hiredmanso you can tolerate "stale" reads
16:10weavejesterRaft appears to be a protocol to manage distributed state, but in my case I have a single authority
16:11hiredmansure
16:14cminus1ls
16:14lazybotbin boot dev etc lib opt root srv usr var
16:25dawkirsthi, why does (doseq [ item '((1 2) [3 4] "D")] (prn item)) not work without the '?
16:26gfredericksdawkirst: it's a function call otherwise
16:26gfrederickswhile you're just trying to represent a list
16:26justin_smith(1 2) is not a function
16:27dawkirstok got it. so if I had a function that returned a list, I'd just call it there right?
16:27amalloyjustin_smith: well, 1 is not a function
16:27justin_smiththat too
16:27stompyj1, in fact, is the lonliest number
16:28stompyj(inc stompyj)
16:28lazybotYou can't adjust your own karma.
16:28stompyjNOOOOO
16:28gfredericks(dec stompyj)
16:28lazybot⇒ 0
16:28gfredericksFTFY
16:28stompyjHAHAHAHAHAHAHAHHA
16:28arrdemhahahaa
16:28stompyj(inc gfredericks)
16:28lazybot⇒ 67
16:28stompyjwell played
16:29dbaschdawkirst: yes, the second argument must be a seqable thing
16:29amalloyguys let's make (dec stompyj) a running joke. maybe people will finally hate him more than they hate so
16:30dawkirstthanks
16:30gfredericksI didn't even realizez so was a nick
16:30amalloyi don't know what the deal is with so either
16:30arrdemamalloy: the hatred of so is without bound
16:30amalloy$karma so
16:30lazybotso has karma -27.
16:31arrdemstompyj has some catching up to do
16:33stompyjlol
16:35stompyj$karma bitemyapp
16:35lazybotbitemyapp has karma 16.
16:35stompyjinteresting. What did so do to get ranked lower then the guy who has a clojure stacktrace as his twitter profile image
16:35justin_smithamalloy: which raises an old curiousity - has anyone made a language that was so pedantically mathematical that a number N treated as the function that compounds its argument N times?
16:36justin_smithstompyj: the highlighting is so so so annoying, if you have a client that highlights usernames
16:36stompyjohhhhhhhhhh
16:36stompyjwow
16:36amalloywell, i'd argue that's your client's fault
16:36arrdemjustin_smith speaks for the erc-hl-nicks users
16:37amalloyjustin_smith: isn't that exactly church encoding?
16:37justin_smithexactly, but what languages actually treat numbers that way?
16:38amalloynone that anyone uses
16:38TimMcjustin_smith: I think some theorem provers do that, at least on the surface.
16:38justin_smithI figured
16:38arrdemjustin_smith: smalltalk used church numerals.
16:38justin_smithI know. let's make Number implement IFn
16:38TimMcPeano numerals
16:38justin_smithsmalltalk? ahh, right 5.do(...) or whatever
16:39justin_smithbut does smalltalk also say that 5.5() is 25?
16:39dbaschin python you could multiply random things
16:39justin_smithright
16:39dbasch3 * long should give you a longlonglong
16:40dbaschas a type
16:40justin_smithnice
16:40justin_smithlol
16:40dbasch2 * float = double
16:41arrdemdbasch: that's just an issue of floating point error and single precision floats being silly..
16:42gfredericks,Float/MAX_VALUE
16:42clojurebot3.4028235E38
16:42justin_smithString / 2 = utf8 maybe?
16:42gfredericks,Double/MAX_VALUE
16:42clojurebot1.7976931348623157E308
16:42dbascharrdem: I mean, you can come up with semantics for multiplying any type by a number
16:42justin_smithno, never mind
16:42gfredericksutf4
16:42gfrederickshey can we compress arbitrary data like this
16:42justin_smithwell jvm uses utf16
16:42dbasche.g. 3 * Person = Trio
16:43dbaschat least in the SFW version
16:43arrdemdbasch: you can _define_ whatever you want, that doesn't mean you've granted it general meaning
16:44amalloy,(/ String Character)
16:44clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.Number>
16:45gfredericksI define multiplying a type by a number to be the identity function
16:46amalloy((* 5 String) :foo) => :foo
16:46dbaschwhy shouldn’t (n x) be the same as (repeat n x)?
16:46TimMcgfredericks: I just discovered today that Java doesn't support UTF-7 by default.
16:47gfredericksTimMc: man I sure hope that doesn't exist
16:47TimMchttps://en.wikipedia.org/wiki/UTF-7
16:47gfredericksaw crap
16:47gfredericksyou let me down man
16:47TimMcDashing your hopes and dreams since 2011.
16:47dbaschhttps://en.wikipedia.org/wiki/UTF-9
16:47justin_smithgfredericks: like so many terrible vile things, it is rooted in email
16:48TimMcdbasch: Ha!
16:48justin_smithhttps://en.wikipedia.org/wiki/UTF-ℇ
16:48erghi'm trying to learn core.async; is there a way to say "give me everything that currently in the channel (as a vector?) and if there's nothing, give me nothing (empty vector), don't block"? am i trying to do something you're not supposed to?
16:48TimMcdbasch: Second paragraph is great.
16:48gfredericksI was thinking the other day about a number system that uses an increasing radix
16:48gfredericksthe first digit is binary, the second ternary, etc
16:48TimMcFor other horrifying things that actually do exist: https://en.wikipedia.org/wiki/UTF-EBCDIC
16:48technomancy$kill
16:48lazybotKILL IT WITH FIRE!
16:49TimMcgfredericks: Have you heard of balanced ternary?
16:49gfredericksmaaaaaybe
16:49weavejesterergh: It does sound like you might be using core.async incorrectly
16:49gfredericksIt sounds like it was interesting when I knew about it
16:50weavejesterergh: What’s your end goal?
16:50TimMcIt's like having a set of ternary weights you can place on either side of a scale.
16:50dbaschTimMc: here, I improved it :P http://shrturl.co/I01U2
16:50TimMcdbasch: How so?
16:50gfredericksoh this doesn't sound familiar actually
16:50erghweavejester: im making a game and i want to collect all the commands that happened during a frame in the interface module and then pass those to the gameplay code for processing
16:51dbaschTimMc: removed the April fools part
16:51TimMchttps://en.wikipedia.org/wiki/Balanced_ternary
16:52justin_smithergh: do you have some synchronization requiring that the messages wait and get chunked in a vector rather than showing up as produced?
16:52justin_smithergh: why not put that on the receiver end via a queue, and just append the queue from core.async in that case?
16:52Hodappnumber system with base phi is also kind of interesting.
16:52erghjustin_smith: hm, in every frame, i want to process all events that came in till then
16:52amalloygfredericks: balanced ternary is neat
16:52justin_smithjava.util.concurrent.SynchronizedQueue
16:53Hodapphttps://en.wikipedia.org/wiki/Golden_ratio_base
16:53tbaldridgeergh: use alts! in a loop with a default
16:53justin_smithergh: read the queue in the context where "frames" are a thing, let async things be async
16:53tbaldridgeergh: if you hand alts! a :default, then it will never block
16:53TimMcgfredericks: Increasing radix... so 123 would be 1*4^2 + 2*3^1 + 3*2^0?
16:54tbaldridgeergh: https://clojure.github.io/core.async/#clojure.core.async/alts!
16:54amalloyTimMc: you can't use 3 in the 0s position, if the radix is 2
16:55erghtbaldridge: sounds like what i was looking for. thanks
16:55amalloyactually it should be radix 1, permitting only a 0 as the lowest digit
16:56TimMcamalloy: Nonsense. 30-base-2 is 6 in decimal.
16:56augustlanyone got some pure java key/value databases to recommend?
16:56TimMcaugustl: Why pure Java, does it need to run in the same process as your app?
16:56gfredericksamalloy: TimMc: right, 123 is not allowed
16:56dbaschaugustl: you mean local, distributed, in process?
16:57augustlTimMc: yeah that would be a plus
16:57augustldbasch: in process
16:57TimMcbecause otherwise you could just use a Java driver
16:57amalloygfredericks: isn't this increasing-radix like...non-distinct? there are multiple ways to represent the same number
16:57gfredericksamalloy: I thought of radix 1 in the first digit but it seemed silly
16:57amalloywhich is problematic for number systems
16:57gfredericksamalloy: are you sure? even if you avoid 123?
16:57dbaschaugustl: when I was at LinkedIn we built this https://github.com/linkedin/krati although I’m not sure what’s its current state
16:58technomancyaugustl: berkeley db is supposed to be nice
16:58dbaschaugustl: I know there’s a java port of leveldb, also not sure of the state
16:58gfredericksamalloy: oh maybe I haven't been specific enough
16:58amalloyi guess not. i keep forgetting how the increased radix works. i need to wriet some actual numbers down
16:58augustlthanks folks :) googling
16:58TimMcgfredericks: UTF-n is defined (but not always implemented) for n in 1 5 6 7 8 9 16 18 32
16:59gfredericks0,1,10,11,20,21,100,101,110,111,120,121,200...
16:59mordocaiAnyone know if cider for emacs is broken right now? I'm having issues, exhibited here: http://pastebin.com/VbzZjgyX
16:59augustlhmm, berleley db is agpl
16:59dbaschaugustl: krati is Apache 2.0
17:01amalloygfredericks: what number does 111 represent?
17:01TimMcgfredericks: 0,1,2,3,3,4,4,5,6,8,10,11,8.... on the fly, may be wrong
17:02TimMcSo 9 would be represented... 201
17:02mordocaiaugustl: The java edition of the berkeley db has a bsd looking license
17:02augustldbasch: the docs link 404's so I guess it's not that active :)
17:02gfredericksamalloy: 1 + 2 + 6 = 9 I think?
17:03mordocaiaugustl: Scratch that, has a code redistribution clause
17:03TimMcOh right, 2*3 not 3*3
17:03gfredericksyeah factorials are big in infimal
17:03TimMc"infimal"
17:04kzarDumb question but what's the best way to install Java for Clojure on a Debian Wheezy machine?
17:04arrdem1) install leiningen, 2) ??? 3) become enlightened 4) profit
17:04gfredericksstill needs java
17:05awwaiidkzar: I use "sudo apt-get install default-jdk"
17:05mordocaikzar: If you want oracle java then https://wiki.debian.org/JavaPackage. If you are fine with openjdk then apt-get install openjdk
17:05dbaschaugustl: do you really need a k/v store for performance, or could you do with other kinds of embedded dbs?
17:05augustldbasch: performance is not important :)
17:05dbaschaugustl: then just start with sqlite or something like that
17:05augustlthe thing I'm building is for self-hosting
17:05TimMckzar: Wheezy is stable, right?
17:06augustldbasch: would prefer to not have to do JNI, since that makes installing it a bit harder
17:06awwaiidactually, maybe kzar try "sudo apt-get install leiningen"
17:06mordocaiTimMc: Sure is
17:06augustlthen, suddenly.. I'll see if h2 has something :)
17:06technomancyawwaiid: erhm; that's not a good idea
17:06technomancy
17:06dbaschaugustl: h2
17:06mordocaiawwaiid: That is an old version of leiningen kzar
17:06awwaiidkzar: ok, based on technomancy please ignore my previous comment :)
17:06augustlhopefully it has a low level key/value store so I don't have to do sql and schemas :)
17:06awwaiidold yes. but does it work? seems to :)
17:06TimMckzar: Yeah, just grab openjdk-7-* packages.
17:06awwaiidmaybe I'm using unstable. oh. nevermind.
17:07kzarIt better to use oracle or openjdk? (This is on my little server.)
17:07amalloyi would recommend against taking leiningen from apt
17:07kzarI'm guessing oracle Java is going to perform better?
17:07technomancynah, use openjdk
17:07amalloyit's millions of years old, and won't work on many modern clojure projects
17:07mordocaitechnomancy: I was curious about that as well. So openjdk works fine in all cases or only most?
17:08amalloyopenjdk is fine always
17:08gfrederickswhy was oracle mentioned then?
17:08dbaschamalloy: unless you’re trying to squeeze the last bit of performance for a large cluster
17:08dbaschbut for an individual project, sure
17:09mordocaiI mentioned oracle in case kzar specifically wanted that since there is no package in the repositories.
17:09augustlh2 has something called a mvstore, http://www.h2database.com/html/mvstore.html
17:09augustlseems interesting to avoid sql
17:10kzaropenjdk it is then, thanks y'all :)
17:11gfredericksokay I'm going to release this throw-data thing
17:11gfrederickswho was it that wanted that
17:13awwaiidkzar et al -- I'm actually using a local lein, not the one in apt (despite it being installed). So yeah.
17:13augustlhttps://github.com/jankotek/mapdb looks nice
17:13mordocaiawwaiid: Sounds like you are doing it right then :P
17:13awwaiidexactly!
17:15augustlboth mapdb and h2 has a gazillion features I don't need..
17:16dbaschaugustl: well, the filesystem is always an ok k/v store :)
17:16augustldbasch: hehe :)
17:16dbaschonly half joking
17:16augustlthe only feature I do need is better than O(n) key lookup :)
17:16dbaschaugustl: what are you storing?
17:17augustldbasch: arbitrary bytes as both keys and values
17:17dbaschsize of your stored blobs?
17:17augustlkeys are small, values I'm not so sure about. Perhaps I'll have some sort of limit. But support for arbitrarily sized would be nice :)
17:18dbaschaugustl: you can go a long way with a directory tree made of partial hashes in a decent fs, if you feel like reinventing a db
17:19augustlsounds like that means I have to manage lots of fun things, like hitting the max amount of dirs etc
17:19augustlthink I'll just roll with h2, it's super stable and more than fast enough
17:20dbaschaugustl: that’s what I would do, but I’d stick to sql unless you have a good reason not to
17:20amalloyaugustl: have you looked at tokyocabinet? it's not java, but it's in process. at geni we used it, and wrapped it up in masai as a general byte-based kv store
17:20augustlyeah think I'll do that too
17:20augustlamalloy: got a link to that wrapper? :)
17:20amalloy$google clojure masai
17:20lazybot[ninjudd/jiraph · GitHub] https://github.com/ninjudd/jiraph
17:21amalloyreally. fascinating
17:21amalloyanyway, it's https://github.com/ninjudd/masai
17:22augustlamalloy: thanks, will check it out
17:22amalloyyou'd use https://github.com/ninjudd/masai/blob/develop/src/flatland/masai/tokyo.clj to create a Tokyo TB, and then the stuff in https://github.com/ninjudd/masai/blob/develop/src/flatland/masai/db.clj to operate on it
17:22augustlJNI scares me :S
17:22augustlwhich I assume is what it ends up using
17:23cbpthere are some issues with selmer that only happen with the openjdk
17:23cbpno one knows why
17:23cbpopenjdk + fedora
17:23amalloyaugustl: sure. https://github.com/ninjudd/tokyocabinet
17:24amalloyand we did have segfaults sometimes, when we were hacking on it. i think what's out now is stable, but you do open yourself up to more problems when you use jni
17:24cbphttps://github.com/yogthos/Selmer/issues/26
17:24FrozenlockI'm trying to run my clojure app on a small debian distro, but I get this error Caused by: java.net.ConnectException: Connection timed out-- at java.net.PlainSocketImpl.socketConnect(Native Method)
17:25FrozenlockAny ideas why I can't access the socket?
17:26augustlamalloy: yeah, the JVM isn't a big fan of JNI it seems
17:26dbaschFrozenlock: what are you connecting to? That’s not enough information
17:28justin_smithFrozenlock: what is getting the error - lein? your app?
17:28justin_smithcan other apps connect?
17:28FrozenlockI have 2 things connecting to localhost (port 47800 and 47999) and another connecting to the network on port 47808.
17:28Frozenlockjustin_smith: java -jar my-app
17:29FrozenlockI can connect with ssh and also browse the Internet from it.
17:29justin_smithand you know that there is someone listening on each of those ports?
17:29dbaschwhat do you see if you telnet into those ports?
17:30FrozenlockWell my application is the one going to listen :-/
17:30holo,(map str ["a" "b" "c"] ["d" "e"])
17:30clojurebot("ad" "be")
17:30FrozenlockLike if I do 'lein ring server-headless 2000'
17:31dbaschok, so what do you see if you telnet into your application when it’s running?
17:31holohowto return ("ad" "be" "c") instead, assuming when coll is empty, it yields nil?
17:31holoI mean, is there an fn somewhere for this?
17:31Frozenlockdbasch: I can't run it, that's the problem. I get the error when trying to start it.
17:32TimMcholo: If you knew which coll was longest, you could use concat and repeat to fake it...
17:32TimMc,(map str "abc" (concat "de" (repeat "")))
17:32clojurebot("ad" "be" "c")
17:33holoTimMc, dam that was fast coding thanks!
17:33TimMcIs that good enough for what you need? It's not general.
17:33holoTimMc, I don't know yet, but it's a good starting point even if it isn't. thanks :)
17:34holo(inc TimMc)
17:34lazybot⇒ 59
17:34ArseneReiWould there be any reason using swap! or reset! in a for loop would not let the value persist on an atom?
17:34{blake}What's a "named resource" and how do I go about making a file a "named resource"?
17:34ArseneReihttp://pastebin.com/rF4jYaeh
17:35dbaschFrozenlock: can you refheap the code that fails?
17:36dbaschArseneRei: for is not a loop
17:36ArseneReiList comprehension…ah…
17:36Frozenlockdbasch: No, that's a uberjar application. I hoped to avoid installing lein and running my program piece by piece, by I guess I won't have a choice :-/
17:36TimMcholo: I almost feel like partition-all is relevant here, but I can't figure out how.
17:36cbp{blake}: where did you read this
17:37dbaschArseneRei: almost certainly your list is not being realized
17:37ArseneReidbasch: Should I use a loop/recur pattern?
17:37arrdemArseneRei: doseq
17:37dbaschArseneRei: it depends, what are you trying to do?
17:38ArseneReidbasch: I'm writing a simplistic game loop to iterate over players, perform an action and update state.
17:38{blake}cbp: http://clojuredocs.org/clojure_core/clojure.java.io/resource
17:38jamesnvchello, I’ve run into an issue with compiling clojurescript on the server under immutant, and I’m wondering if I should be filing a bug to clojurescript, immutant, or if it’s something I can work around
17:38dbaschArseneRei: if your atom is defined outside of your loop, you can do an infinite loop with loop/recur
17:39dbaschArseneRei: that atom is inside the scope of your let, so it might as well not be an atom
17:39{blake}I've got an example where "(io/resource "response.xml")" returns "/home/blake/clojure/nzb/resources/response.xml", which is groovy, but I don't know how/why it came to point to the "resources" directory or how I can apply that to my current project.
17:39ArseneReiarrdem: I see what you mean. side-effects you want doseq.
17:39hiredman{blake}: n is the name of the resource, resources are loaded via classloaders
17:39jamesnvcWhen calling cljs.closure/build while running in an immutant context, cljs.js-deps/goog-resource fails to load the resources from the google-closure jar
17:39holoTimMc, I can't figure it out with partition-all. I never used that one before
17:39dbaschArseneRei: unless you’re doing some multi-threaded stuff inside your let
17:40cbp{blake}: the directory resources inside your project.clj is added to your classpath. a "name" is a path into your classpath
17:40ArseneReidbasch: Okay, so you're saying since it's a local variable the loop/recur pattern should be sufficient.
17:40jamesnvcApparently because (ClassLoader/getSystemClassLoader) doesn’t get the right classloader here
17:40jamesnvc(at https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/js_deps.clj#L233)
17:40hiredman{blake}: it is because lein automatically puts a directory in the project root named resources on the classpath (and things in that directory get packged in to jars)
17:40dbaschArseneRei: if you don’t have concurrency you don’t need an atom
17:40dbaschArseneRei: you could just recur with a new value
17:41cbpdbasch: I think a bit of mutabilty can make some algorithms much easier
17:41jamesnvcUsing (.getContextClassLoader (Thread/currentTHread)) instead of getSytsemClassLoader works though
17:41hiredman{blake}: you cannot treat resources as mutable
17:41TimMcholo: Do you want the final call to str to be (str "c") or (str "c" "")?
17:41hiredmane.g. writing to a content
17:41{blake}cbp, hiredman Thanks...so...huh, I thought I did that...added a "resources" and re-ran.
17:41jamesnvcIs this an issue with clojurescript not using the right loader, or immutant doing things strangely?
17:41hiredmanyou shouldn't treat resources as being read from a file
17:41ArseneReidbasch: Yeah, that makes sense. I'll remember that in the future. Thanks very much.
17:41TimMcI bet flatland/useful has somethign appropriate, by the way.
17:41{blake}hiredman, Mutable? I didn't intend to. Am I doing that somewhere?
17:42justin_smith{blake}: don't make a File out of a resource
17:42hiredman{blake}: oh, I am just looking at the clojuredocs example
17:42justin_smithbecause the resource could be in a jar
17:42hiredmanterrible
17:42justin_smithget an input stream from the resource
17:42amalloyTimMc: it does, in fact
17:42holoTimMc, actually it's irrelevant :)
17:43{blake}justin_smith, This is just for sample purposes, to provide some data similar to what will be coming in from a SOAP call.
17:43amalloynothing super-great, i guess. it'd be like (map (partial apply str) (zip "abc" "de"))
17:43justin_smithOK, still, use io/input-stream to get the contents, not io/file
17:43holoTimMc, but I guess (str "c") is more general
17:43justin_smith{blake}: because eventually that will matter
17:44holoTimMc, for ofther fns different than str
17:45TimMcamalloy: Do you still develop useful?
17:45{blake}justin_smith, this response should never see a file system. We're making a SOAP call, processing the value, passing it to some other webservice, getting the response back, pushing it back to the SOAP.
17:45amalloyTimMc: i haven't had a need to add anything to it recently, but it's mine and if there's anything general i want i'll put it there
17:46justin_smith{blake}: wait, then why does io/resource even come into question?
17:46amalloymost recent change was when glenjamin added docs for us
17:47justin_smith{blake}: my point is more that "if the thing is in your source repo, and you may every some day hypothetically make a jar, use io/resource to access it and don't assume it is a file"
17:47justin_smiths/every/ever
17:48TimMcholo: I tried to write up a quick "map-dregs" fn but it's surprisingly tricky.
17:48holoTimMc, I bet there is. meanwhile i'm playing with partition-all.. it's interesting, but hardly shorter than your solution
17:48TimMcOh, did you get a solution that uses that?
17:48holonot yet but close.. it's getting big :(
17:49holoTimMc, is map-dregs from useful?
17:49TimMcNaw, I'm writing it.
17:50holooh you call it dregs haha :o
17:50amalloyTimMc: https://www.refheap.com/d35476b87b8239ea4fb4ff3fd ?
17:50amalloydoesn't seem that hard to write
17:50amalloyso presumably i missed something
17:51amalloycould be shorter but i don't like repeated calls to apply
17:51TimMcamalloy: Does that give the same results for (map-dregs - [1 2 3] []) and (map-dregs - [] [1 2 3])?
17:52erghwhen i have (recur) at the end of one of the branches of an if, it works. but when its at the end of one of the branches of cond-let, it says "Can only recur from tail position". why?
17:52amalloysure, [-1 -2 -3] in both cases. shouldn't it?
17:52TimMcOh, I see -- you filter every time instead of weeding out the empty colls.
17:52hiredmanergh: look at the macro expansion of the cond-let
17:53{blake}justin_smith, Thanks. It comes into play because I'm working on functions to operate on the structure returned, and trying to provide examples of real use. I don't have access to any of the WebService calls myself, just a "Here, this is what the data looks like" in a file.
17:53amalloyergh: i can't imagine that cond-let is really what you want
17:53erghheh
17:53hiredmanergh: cond-let isn't in core, so it is likely to be some random macro of dubious quality
17:53amalloyhiredman: there's one in contrib and one in useful. i can confirm they are both highly dubious
17:53holoTimMc, this is so cool. i'll take a couple of minutes to get it.. really awesome
17:54hiredmanwell, there you go
17:55amalloyTimMc: you could weed out the bad ones as a performance optimization. doesn't seem like it would change results in any interesting way
17:55TimMc*nod*
17:55TimMcIt's just the mindset I had when I was reading your solution.
17:56holoTimMc naming it dregs is totally cool too :)
17:56amalloyyeah, https://www.refheap.com/2adba5f6c4cae810891ca981b
17:59stainhi - what should I call a library that is wrapping a Java library? https://github.com/stain/owlapi-clj is wrapping net.sourceforge.owlapi/owlapi-contract -- now I've used (ns owlapi-clj.core) and owlapi-clj in project.clj - but I would want to tidy up before putting it in clojars
17:59stainas it sounds silly to say -clj all over
18:00stainNote that although I work in the floor below the OWL API guy, I am not affiliated with the underlying Java project
18:01noonianstain: i prefer clj-owlapi to owlapi-clj, but you could always just make up a silly name that has nothing to do with owlapi :P
18:01TimMcamalloy: Here's what I came up with. Almost the same, of course. https://www.refheap.com/86323
18:01TimMcpellet :-P
18:01TimMcon the silly names front
18:02noonianlol
18:02amalloyright. that's the most straightforward way to write it, but the repeated calls to apply are gonna kill you performance-wise, TimMc
18:02TimMcamalloy: I like the removal of apply by using the inner fn.
18:02amalloyapply is a lot less slow than it used to be in 1.4
18:02amalloybut still kinda gross to call over and over
18:02TimMcAny thoughts on the filter vs. keep and next vs. rest?
18:02stainnoonian: just worried people would not find it at all with a silly name.. I know that worked for cheshire (which heavily depends on jackson, which again is kind-of silly name for something to do with JSON :)
18:03amalloyusing next is an error, because you realize one more element of the input seq than necessary
18:03stainnoonian: but would you keep "clj" in the namespaces and clojars (e.g. maven) package name as well?
18:03cbpstain they can find it from your project description
18:03amalloyusing filter instead of keep is just mildly slower, i would expect
18:03sjlstain: is it good
18:03noonianstain: yes, similar to clj-http
18:04cbpclo-*-jure is lame imo
18:04sjlif so call it "Superb Owl"
18:04danielcomptonSo clojuredocs is still on 1.3...
18:04stainsjl: no, it's like.. quite primitive at the moment :)
18:05noonianyou can always change the name later in a new version, i think github will take care of linking the old project page to the new one
18:05stainback in the olden olden days I wrote a series of Python libraries called "forgetHTML", "forgetSQL" and "forgetSomethingelse" (I've forgotten what the last thing forgot!)
18:05amalloystain: superb owl. super bowl. ye olde joke
18:05Glenjaminsuperb-owl is an awesome name
18:05nooniani like pellet or hooter
18:05Glenjamintwit (as in twit-twoo)
18:05stain"pellet" is already a well known OWL Reasoner
18:05noonianah
18:05nullptrdanielcompton: yeah, http://clojure.org/cheatsheet links to different sites depending on version...curious
18:05stainhttp://superb-owl.com/ hehe
18:06TEttingerbowl
18:06TEttingerbowel?
18:06cbpcall it tootsie and have the tootsie pop owl picture in the readme
18:06stainTEttinger: for a sh.tty library
18:06TEttingerpowell?
18:07TEttingeroh well?
18:07stainoh.. sh.tty -- that must be a terminal emulator written in sh!
18:07danielcomptonnullptr: Github, Clojuredocs, Oracle
18:07nullptrM-x clojure-cheatsheet
18:07Glenjaminhttp://en.wikipedia.org/wiki/Category:Fictional_owls
18:07Glenjamini am surprised but delighted that that page exists
18:08stainwell thanks for all your suggestions :)) I was mainly concerned about the "-clj" bit...
18:08justin_smithgoddammit o rly? is not a fictional owl
18:08stain> Errol, an aged Great Grey Owl who serves as the family's courier. He has trouble carrying loads and is often found unconscious after collision or exhaustion.
18:09technomancyhttps://en.wikipedia.org/wiki/List_of_animals_with_fraudulent_diplomas
18:09noonianGlenjamin: thats my go-to webpage for choosing a name in rpgs when the main character is an owl
18:09Glenjamini did the same thing for famous assassins once
18:09Frozenlockdbasch: lein repl returns the same error: java.net.BindException: Cannot assign requested address at java.net.PlainSocketImpl.socketBind(Native Method)
18:10justin_smithtechnomancy: brb signing up my neighbor's pug for a Clojure CA
18:10Glenjaminhe'll struggle with the code review phase
18:10stainhttp://www.telegraph.co.uk/news/uknews/crime/9876199/Police-under-investigation-over-dogs-witness-statement.html
18:10TimMcamalloy: Hmm, point taken on next being too eager.
18:11dbaschFrozenlock: are you sure the port is not taken by another process?
18:11justin_smith"updated stack traces to include more snorting and licking"
18:11TimMcstain: That article begins with "However," -- I feel like I walked into the middle of a conversation.
18:11SegFaultAXWhy does fnil have such a verbose definition?
18:12SegFaultAXWhy not like (defn fnil* [f & rep] (fn [& args] (apply f (map #(if (nil? %1) %2 %1) args rep))))
18:12Glenjamin(doc fnil)
18:12clojurebot"([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched."
18:12Glenjaminoh, in code
18:12Glenjamin(source fnil)
18:13justin_smithSegFaultAX: see also the source for map
18:13stainTimMc: however, the decline of journalistic language quality is ever increasing. You should try reading. Norwegian newspapers. They don't even complete. Sentences. Like this one.
18:13Frozenlockdbasch: doesn't 'lein repl' take a port at random?
18:13justin_smithSegFaultAX: it's for performance
18:13gfredericksGlenjamin: a lot of variadic core fns unroll some of their arities
18:13justin_smith$source fnil
18:13lazybotfnil is http://is.gd/9Lr9Rg
18:13gfredericksGlenjamin: and a few of them, like fnil, do it in two dimensions
18:13amalloytechnomancy: where's the list of animals with legitimate diplomas?
18:14gfredericksI guess fnil isn't actually variadic though; but it's almost variadic
18:14justin_smith() <- hey look, I found it
18:14{blake}amalloy, https://shine.yahoo.com/pets/3-dogs-college-degrees-125400686.html
18:14SegFaultAXjustin_smith: Yea.
18:15technomancyamalloy: it's wikipedia, go for it
18:16dbaschFrozenlock: yes, but before that it tries to evaluate your :main
18:16FrozenlockThere's no main. It's just lein repl without a project
18:17justin_smithok, then just before it gives you a prompt
18:17dbaschFrozenlock: can you paste the output of lein repl?
18:17dbaschrefheap?
18:17clojurebothttps://www.refheap.com/
18:17Frozenlockhttps://www.refheap.com/86326
18:18justin_smithif you start the repl yourself you can easily specify a specific port to use - maybe this is also possible for "lein repl", I don't recall if I have tried
18:18justin_smith(start the repl yourself as in nrepl.server/start-server in your :main)
18:18Glenjaminlein repl :port <num>
18:18dbaschFrozenlock: btw, why are you running as root? Also, what does your /etc/hosts look like?
18:19Frozenlockdbasch: Because there's just root on this image.
18:19brunovHey guys. I'm wondering, what do people use to deploy clojure apps to remote servers, typically?
18:19justin_smithideally: make an uberjar and a shell script with the apropriate java options
18:19Frozenlockdbasch: It runs on an arm processor, I don't really mind running as root for now.
18:20deathknight:)
18:20dbaschFrozenlock: can you ping localhost?
18:20holoTimMc I quit trying partition-all for this for more than two colls. maybe loop/recur could do it, but i can't sort it out. thanks for your algo :D
18:20amalloyFrozenlock: IME "cannot assign requested port" means that all 64k ports on the machine are already assigned. check out `netstat -a`
18:20deathknightIs there a clojure IRC channel specifically for seeking help?
18:20brunovjustin_smith: cool. I'm thinking of using capistrano and wanted to check here first in case there's something else I was missing.
18:20arrdembrunov: git with post-receive deploy scripts, or war
18:20dbaschholo: that would be trivial with loop/recur
18:21brunovarrdem: interesting idea!
18:21dbaschholo: you keep going while (or cur1 cur2 …)
18:21Frozenlockdbasch: Well sonofabitch, localhost doesn't respond
18:21justin_smithbrunov: I guess capistrano could replace that above mentioned shell script, if you need things it provides
18:21arrdemFrozenlock: .... what on earth did you do to {firewall,/etc/hosts}
18:22cbplol
18:22justin_smiththe key being that building (with lein of course) does not happen on prod
18:22kzarProbably missing relevant line in /etc/hosts
18:22deathknightQuick question: If I wanted to find the value of :status in {:body {:status "test"}}, wouldnt this work? (it doesnt) -> [{{val :status} :body} args]
18:22deathknightit returns nil
18:22Frozenlockarrdem: Nothing! I just took this image and assumed it was configured. https://www.olimex.com/wiki/A10s-OLinuXino-MICRO#How_do_I_write_the_Linux_image_to_a_micro_SD_card_to_use_with_my_A10S_board.3F
18:22deathknight(ex: (let [{{val :status} :body} args] (println val))
18:22FrozenlockObviously I was wrong
18:23holodbasch :> yes, I guess the point was not use loop/recur
18:23cbpconfigured to troll
18:23amalloydeathknight: that would work, if args were {:body {:status "test"}}
18:23amalloybut i imagine args is actually [{:body {:status "test"}}]
18:23deathknightthats correct amalloy
18:23deathknightas of right now, it returns nil
18:24Frozenlock/etc/network/interfaces ---> #auto lo, #iface lo inet loopback
18:24Frozenlock*facepalm*
18:24dbasch(doc get-in)
18:24clojurebot"([m ks] [m ks not-found]); Returns the value in a nested associative structure, where ks is a sequence of keys. Returns nil if the key is not present, or the not-found value if supplied."
18:24blrbrunov: you could look into pallet if you want a clojure solution (also for provisioning like chef etc)
18:24dbasch,(get-in {:body {:status "test"}} [:body :status])
18:24clojurebot"test"
18:25FrozenlockSorry for wasting everyone's time :-(
18:25dbaschdon’t worry Frozenlock. But I suggest getting a rubber duck :P
18:25justin_smithFrozenlock: things like that are why I so often jump to 127.0.0.1 - easy enough to remember, not as brittle as "localhost"
18:26deathknightclojurebot, sorry man. I just don't understand that
18:26clojurebotI don't understand.
18:26stainjustin_smith: and on a rainy day, you can even get a way with 127.0.0.2
18:26deathknightAmalloy, how would I get the value of :status in [{:body {:status "test"}}]?
18:26dbasch,(get-in {:body {:status "test"}} [:body :status]) ;; deathknight
18:26clojurebot"test"
18:27cbpprolly prepend a 0 if it's in a vector
18:27deathknightit is a map
18:27deathknightjust to be 100% sure, whats the command to check what data type it is?
18:27justin_smithsometimes -> is more readable than get-in
18:27cbp,(type {})
18:27clojurebotclojure.lang.PersistentArrayMap
18:27deathknightit is a persistentarraymap
18:27deathknightconfirming
18:28cbpjustin_smith: never!!
18:28justin_smith,(-> {:body {:status "test"}} :body :status)
18:28clojurebot"test"
18:28dbasch,(-> [{:body {:status "test"}}] first :body :status)
18:28clojurebot"test"
18:28deathknightjustin_smith, where is the input for the arg?
18:28justin_smithyeah, that helps too
18:28justin_smith(doc ->)
18:28clojurebot"([x & forms]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."
18:29amalloyjustin_smith: what. when would -> ever be more readable than get-in
18:29dbaschamalloy: I suppose if you had to do a bunch of stuff before the get-in
18:29deathknight(-> persistantArrayVariable :body :status) returns nil
18:29justin_smithamalloy: I find clearer thanks to less nesting, and being able to throw in something like first is a bonus
18:30amalloydbasch: *shrug* (-> foo blah bar whatever (get-in [x y]))
18:33dbaschamalloy: yeah, I don’t have an opinion
18:33cbpjustin_smith: (get-in [0 :a :b])
18:33deathknight{:body {:milestones {:status "test"}}}
18:34arrdemtools.analyzer uses the (-> {} :foo :bar first :baz quxx :val) format... it has its advantages, besides being gratuitous use of ->
18:34justin_smithcbp: doesn't work on list / seq
18:35kzarSo I've built the nginx-clojure jar, where do I put it though? When I start nginx it stalls because it can't find the jar but the readme doesn't explain where to put it
18:36FrozenlockUgh... any instances where 'java -jar uberjared.jar' doesn't run? I just get my shell prompt back
18:37cbpthat doesn't necessarily mean it doesn't run
18:37dbaschkzar: it’s in the readme, in the configuration section: jvm_options "-Djava.class.path=jars/nginx-clojure-0.2.2.jar:jars/clojure-1.5.1.jar";
18:38kzarRight I've put those lines in the config file
18:38kzardbasch: But that path looks relative jars/nginx-clojure-0.2.2.jar right?
18:38Frozenlockcbp: It would be running in the background but giving me the prompt back? (in this case it's not running in the background)
18:39dbaschkzar: that path is probably relative to /etc/nginx
18:39cbpFrozenlock: I have no idea what you have inside that jar but unless you have an infinite loop it gives you the prompt back
18:40nooniani think the example config assumes you put the jar in directory named 'jars' inside etc/nginx directory
18:40dbaschkzar: you could make it absolute
18:40kzardbasch noonian: OK, I'll try putting them in /etc/nginx/jars/ and see what happens
18:40kzar1 mo
18:40Frozenlockcbp: I have a compojure app in it. I've ran it thousands of time and it never gave me the prompt back while it was running.
18:41FrozenlockWhen all else fails.... reboot
18:41cbpoh nevermind you're right
18:41cbpthen
18:45kzarHmm that didn't work
18:46blrtechnomancy: that comment in #emacs reminded me, do you have any thoughts on how to best manage security notification for project deps? Feels like this is not handled very well by any system
18:46blrand depending on system packages is clearly untenable, but works in terms of security
18:46blrpip and gems suffer from this too, I think it's kind of universal
18:47kzardbasch noonian: OK changing paths to absolute /etc/nginx/jars/... worked. Is that the proper place to put them though? (Seems weird having the jars in the coonfig dir and the fact that the default relative path didn't point there makes me question it.)
18:47erghdoes clojure have some kind of support for synchronizing its datasctructures over the network?
18:47blrergh: in terms of serialisation? there's edn
18:48justin_smithblr: maybe a way to tag an artifact in a repo as insecure, and a lein audit command to check a given project's deps?
18:48nooniankzar: it's totally up to you, clojure and nginx-clojure are probably the only jars you'll need for nginx so you could put them wherever
18:49justin_smithwe should make the command to deprecate an artifact be "lein malign <version>"
18:49erghi was thinking for exampke if youre changing a datastructure on a server and a client has it's own copy of that, you'd only need to send some sort of "diff"
18:49blrwell, there's lein-ancient, but the onus is on the developer to run it regularly, and afaik there's no distinction between a feature and a security release
18:50justin_smithergh: like some kind of networked version of persistent data structures' data sharing?
18:50erghyeah
18:50justin_smithergh: if you used datomic for the coordinating of values, I think you would get that
18:50blrergh: I think the 'quilt' project is potentially related to your query, but afaik there's not much information about it currently
18:51justin_smithergh: though that is not the same as sending an update point to point
18:51technomancyblr: haven't really given it much thought. I think there's a security mailing list, but I don't know if they've got this use case in mind
18:51justin_smithmaybe send an "update please" message to the peer, and send the change to datomic?
18:52blrtechnomancy: right, it feels like a big gap in every tooling ecosystem I'm familiar with.. with ruby and python you just have to keep an eye on mailing lists and hope that you catch something
18:53blrwish we had something as rigourous as debian's security releases
18:54justin_smithblr: related, someone should make an updater / package manager than manages all your package managing updaters
18:55technomancyblr: well debian is different because you typically don't have people employed full-time to pay attention to many systems.
18:57blrsure.. although maybe there's some merit to justin_smith's suggestion of being able to 'taint' a dependency, which lein could provide a warning for?
18:58technomancygpg has support for revoking keys, I wonder if there's any mechanism for revoking signatures.
19:00blrgo-lang 'solves' this by having everything on edge, pointing to master on github :P
19:00justin_smithsince .m2 is a cache, maybe a "purge this value from the cache" model is apropriate?
19:01technomancyblr: http://p.hagelb.org/blam.gif
19:01justin_smithblr: go-lang development sounds fun
19:01justin_smitha real roller coaster
19:01technomancyfor serious issues we can consider straight up clojars deletion
19:02justin_smithright, but remember it gets cached in everyone's .m2/
19:02Frozenlockblr: Are your serious?!
19:02amalloyif we're deleting clojars, can i hold a flamthrower?
19:02justin_smithwhich is why some way of checking for things to purge would be nice
19:02technomancyyeah
19:03justin_smithmaybe friendlier to make a .m2/dont-use-these-insecure-packages-but-here-they-are-for-reference/ directory and move things there
19:04andres-v`requestnames,createaccount,customer_account,assign_name,create_client,toggle_ban_client,deleteclient,rqn_new,rqn_xactiontype_selected,rqn_bank_selected,rqn_book_selected,rqn_customeraccount_selected,rqn_newcustomeraccount,rqn_registernewcustomeraccount
19:08blrfood for thought at any rate, feels like something that could be better
19:10technomancyblr: it's unlikely that much will happen if you don't make it happen at this point
19:11blrtechnomancy: fair enough. Do you think the idea's worth exploring?
19:11technomancyblr: yeah, I believe so.
19:11technomancythe incentives around it are kinda pathological though unfortunately
19:11blrin what sense?
19:11technomancyit takes a big bad incident to get people to actually care, at which point it's too late
19:12blroh right, yeah that's always the way with security
19:14FrozenlockAt least nobody got #=ed... I think...
19:17stainclojars - I just get "Invalid PGP public key" at https://clojars.org/register - my PGP key is A0FFD119 and I've tried exporting it as gpg --export -a 0xa0ffd119
19:20justin_smiththat is a really small public key
19:20stainit's 597 lines in the export
19:21justin_smithahh, never mind, I misread
19:21stainhm, I registered with an empty PGP Public key, and then went to update the profile, and it worked OK
19:21kzarSo with nginx-clojure is the idea that you build your clojure project that includes your ring handlers to a jar and have nginx-clojure use that? (Each deploy you'd build a new jar for your project and put it in place?)
19:22justin_smithkzar: yeah, I think so. An uberjar that includes all your deps, of course.
19:23justin_smitherr... wait, this is looking different
19:24nooniankzar: i've not used nginx-clojure and that might be what you need, but if you are just trying to serve an app with nginx i think most people just do a simple reverse proxy to an embedded java server in the clojure app. http-kit has good documentation with examples on how to do that.
19:25justin_smith(inc noonian)
19:25lazybot⇒ 4
19:25justin_smithyeah, nginx clojure looks nifty and all but I am not sure how much it really gains you over having a separate clojure process
19:26amalloyfrom what i've seen of nginx-clojure it's a bit wacky
19:26hiredmantotally wacky
19:26justin_smithoh, it lets you put clojure code in the config, lol
19:27justin_smithyou can even put your handler code inline in your nginx location definition
19:27justin_smithhow "useful"
19:27amalloydare i say, gonzo bonkers?
19:27justin_smithhttps://github.com/nginx-clojure/nginx-clojure#231-inline-ring-handler
19:32deathknightIf I have {:body {:milestones [{:status 1} {:status 2}]}}, how can I create a collection of the values for each :status?
19:32deathknightI know how to get the value of the first status
19:33justin_smith(->> m :body :milestones (map :status))
19:33deathknightholy CRAP
19:33deathknightYOU ROCK
19:33justin_smithno kind sir, Clojure rocks
19:33amalloyinside voices
19:34deathknightnnnnnnnng
19:37justin_smitheventually you will likely want to doseq on that map, if this is you http://stackoverflow.com/questions/24071746/creating-a-collection-of-multiple-same-depth-values-in-a-nested-hashmap
19:37justin_smithin the doseq you could push the proper sync
19:38justin_smithhaha, small world, now I see what's going on
19:38justin_smithdeathknight: I am noisesmith on stackoverflow
19:40deathknightJustin!
19:40deathknightHoly crap!
19:41deathknightHahaha
19:41deathknightI'm smiling so hard
19:56kzarSorry was AFK there, so general consensus is to use http-kit + nginx instead of clojure-nginx?
19:57amalloywell, use anything+nginx
19:57amalloywhether http-kit or something else is the server you want is up to you
19:57amalloybut i would not touch nginx-clojure
19:58kzarOnly thing is if you run a server process with something like http-kit how do you make sure that process keeps running?
19:59amalloyclojure doesn't just randomly crash every five minutes
19:59kzarIn the past when I've done similar things with Python/Ruby instead of using nginx modules like passenger I've run into that problem
19:59kzarso you don't have something checking it's still running?