#clojure logs

2014-03-26

01:23startlingIt seems like rebindings of dynamic variables don't persist past protocol method calls, is that true? why? can it be avoided?
01:27startlingoh, no, I'm wrong. I see why, though.
01:29startlingI pass a function that uses a dynamic variable to 'map'; when this function gets called, it sees the original value of the bound variable. Can this be avoided?
01:32startlingexample: https://gist.github.com/startling/9777360
01:34startlingI suspect the answer is "make a pull request that judiciously eliminates all use of dynamic variables".
01:37arrdemstartling: yep, dynamic vars tend to be a major code smell
01:39ddellacostastartling: as arrdem says...I have rarely found a situation where a dynamic var was the right choice. More to the point, using pure functions as much as possible helps being able to reason about your code, tremendously.
01:39startlingddellacosta: I agree 100%
01:39startlingalas, I'm using other peoples' code.
01:39ddellacostastartling: ah, gotcha
01:39arrdemstartling: yeah PR that shit when you get time to fix it
01:40arrdemstartling: that's one thing I've been bad about lately, use a lib, don't like its design, spend the first two days rewriting it and then do a "fixed yo shitz" pr
01:42ddellacostaarrdem: that's kind of problematic though, 'cause I hate spending time on a pull request before I've had a chance to hash it out with the lib author. If they don't accept your fix for any reason it may be a waste...
01:42ddellacostaarrdem: I mean, still a good thing to do generally speaking
01:42arrdemddellacosta: sure.
01:42arrdemddellacosta: if I ever do finish cloutjure one thing I wanted to get to was library clout
01:42startlingwell, this is a pretty clear-cut bug, so I'm not that worried about it.
01:43startlingI *am* worried about the author being MIA, considering the last commit is 2 years old.
01:43arrdemstartling: which lib?
01:43startlinghttps://github.com/lancepantz/clj-yaml
01:43startlinglancepantz: hey
02:11startlinglancepantz, I PR'ed a fix to clj-yaml; if you don't want to deal with it I'd be happy to take over maintenance.
02:24TEttingerSnakeYAML wasn't exactly a high-performance library last I heard. someone mentioned taking 10 seconds to parse config files (he was using scala with no wrapper around SnakeYAML IIRC), but he had a fairly old computer
02:24TEttinger(we're talking under 1 MB config I think)
02:25startlingTEttinger: do you have a recommendation?
02:26TEttingerunfortunately no, other than use EDN...
02:27startlingTEttinger: that's not an option for us, unfortunately.
02:27TEttingerI helped the guy I'm talking about look for a replacement and couldn't find anything
02:27TEttingerYAML's grammar isn't exactly simple is it...
02:27socksyso in clojure, what's the idiomatic way for doing something like mean squared error? In an imperative language I would have a mutable variable and keep adding to it. This feels like bad practice in clojure
02:28startlingTEttinger: heh
02:28arrdemsocksy: map and reduce are gonna be your friends
02:28gfredericks,(def square #(* % %))
02:28clojurebot#'sandbox/square
02:29gfredericks,(->> (map - [1 2 3] [4 5 6]) (map square) (reduce +))
02:29clojurebot27
02:29arrdemgfredericks: you're missing a (/ (count))
02:29gfredericksyep
02:31socksythere's a confounding problem, in that this is being passed as a function to a map. So effectively I already have a function acting as map, called "read-and-do", which is a convenience function around with-open, which takes a function to do to each line
02:32arrdemsocksy: there's your problem
02:32socksyindeed
02:32arrdemsocksy: you want to read _all_ your input and build one datastructure
02:32arrdemsocksy: then you take _all_ that data and transform it
02:32arrdemsocksy: iterate until you've got the result you want
02:32socksythat's nice and all, but my data is generally bigger than my RAM
02:33socksythough I suppose I could load it up on to a large AWS instance
02:33arrdemthen you need to leverage lazy evaluation to achieve streaming computation.
02:33arrdemwhich in many cases you'll just get magically if you write idiomatic code.
02:34gfrederickswell
02:34gfredericksresource management isn't magical
02:34socksyi don't see how idiomatic code gets around the fact that "slurp" puts everything into a string?
02:34gfredericksright
02:34gfredericksyou don't use slurp
02:35gfredericksyou use line-seq
02:35gfredericksor something
02:35gfredericksyou just have to be sure that you've consumed the whole thing before your with-open finishes
02:36socksymy read-and-do is a very basic wrapper around line-seq because i found myself typing that code out repeatedly :)
02:36gfrederickssure
02:37gfredericksis there something still unclear about this? I've lost track of the question
02:38arrdemgfredericks: resource management to not blow ram
02:38gfredericks(with-open [r ...] (->> (line-seq r) (map parse-somehow) (map ...) (reduce ...)))
02:38socksywell, more just an idiomatic way to make this into a map function
02:39gfredericksI wrote most of MSE as map/reduce above
02:40socksyindeed, thanks! But what does your code mean when you say "map parse"? line-seq is lazy, and map is doing it lazily, and then you map that into a different map?
02:40socksywait, scrap the last bit
02:42gfredericksthe mapping is lazy, the reduce forces the whole thing; but neither the whole original seq nor the intermediates are ever in memory at once
02:42gfrederickswhich is of course exactly what laziness is buying you
02:42socksyaha, so it's still a lazy construct by the time of the second map
02:43socksyand hopefully the reduce will cause it to execute before closing the file
02:43socksyright, I'll play around with that, thanks for the help!
02:50startlinglancepantz, another PR; this one's a security issue.
02:53bob2<3 clojuring
02:58nwolfeAnybody working with Omchaya or is there a more appropriate place to ask this?
02:59nwolfeHa I bet the clojurescript channel would be the better place.... :D
03:00amalloystartling: i don't think lancepantz really reads IRC much. he'll just notice the github notification probably
03:00amalloygfredericks: you're on irc at clojure/west? or went home already? (that's what i did)
03:01startlingamalloy, there are a number of other open PRs, I mentioned it here on the off chance he was around.
03:03gfredericksamalloy: I'm did not go home already
03:35FrozenlockI think the cljs advanced compilation is screwing up something here... https://www.refheap.com/65821
03:35FrozenlockAny advice?
03:39amalloyFrozenlock: if you don't have externs defined for the jquery plugin or whatever you're using, the closure compiler will rename all dot-interop methods to save characters. but since it's not actually rewriting the jquery code itself, the chosen name doesn't exist there
03:39FrozenlockAh right.... that's the aget/aset thing, correct?
03:39amalloyso i think you either need externs, or to use something like (.apply (aget foo "modal") foo "show")
03:40amalloyi don't recall the details, since i don't use cljs, but i presume that's enough to make sense to you
03:40FrozenlockIt does, thank you very much.
03:51luxbockI'd like to define a couple of helper functions in my profiles.clj and then inject them into clojure.core with vinyasa. does anyone know if there's a way for me to do this without having to define the functions in their own separate namespace/library of their own
03:53luxbockat first I tried defining them as normal in :injections, and then using vinyasa.inject/inject to inject those functions from the user namespace but that didn't work
04:10beamsoi didn't realise there was a lein survey out
04:14zachmassiaI'm working on converting some js code over to cljs, and wondering if there is a better / cleaner way to write this: https://gist.github.com/ZachMassia/0cc4675b1ce7bbe6746c
04:20beamsomaybe inc and dec instead of + and -?
04:22zachmassiabeamso: Good call, that will clean it up a bit. Apart from that it's fine though? Fairly new to clojure and functional programming
04:24beamsolooks okay to me
04:24beamsofrom a weird perspective i hate the change from > to < and back again
04:25beamsobut i also hate the .js file leaving off curly brackets for the if cases so :/
04:27FrozenlockWhat's the difference between using an atom and transcient/persistent?
04:27zachmassiaHeh, didn't write the js :P, but now that you mention it I think I might move that last when up with the first one to keep it symmetrical
04:28beamsozachmassia: it's more that it jumps back and forth between less and more
04:28beamsonot the ordering of the tests
04:29beamsoFrozenlock: http://stackoverflow.com/a/15722398
04:29FrozenlockThanks
04:34zachmassiaWould this be a case where a transient is appropriate? I didn't really use it for the performance gains here
04:38Frozenlock,(let [[i j] [4 5] size 5] (for [x [-1 1] y [-1 1] :let [new-x (+ i x) new-y (+ j y)] :when (every? #(< % size) [new-x new-y])] [new-x new-y]))
04:38clojurebot([3 4])
04:38Frozenlockhttps://www.refheap.com/65834
04:39Frozenlock(or something like that...)
04:43zachmassiaHmm, initially that seems harder to read
04:44FrozenlockReally? o_O
04:46zachmassialol, I'm still getting used to the lisp way of doing things
04:48zachmassiaI'm attempting to port http://cjlarose.com/2014/01/09/react-board-game-tutorial.html over to om
04:49Frozenlockzachmassia: You might want to give reagent a try (especially if you are beginning with clojure) http://holmsand.github.io/reagent/
04:53mpenetzachmassia: atoms vs transients: one is a mutable ref the other is just an optimisation for performance (that you should never bash in place, which is what you were probably thinking of doing)
04:53mpenethttp://clojure.org/transients
04:55zachmassiaFrozenlock: I came across Reagent last week I believe. Any reason you suggest it over om?
04:56zachmassiampenet: Ya, I think I'm probably focusing too much on directly porting the logic from the js code instead of the overall result
05:02lockszachmassia: https://github.com/levand/quiescent#rationale
05:09zachmassialocks: Interesting read, thanks for the link :) I'll make sure to bookmark that one
05:10locksyeah, it’s a nice overview of the three libraries
05:14zachmassiaFrozenlock: Your snippet is giving me different results than the original fn: https://gist.github.com/ZachMassia/0cc4675b1ce7bbe6746c
05:20vmarcinkohello, noob question, i guess around data readers
05:20vmarcinkoi try to read datomic scehma.edn from my file
05:20vmarcinko(read-string (slurp (io/resource "datomic/schema.edn"))) works OK
05:20vmarcinkobut when Iuse EDN reader
05:20vmarcinkovia
05:21vmarcinko(edn/read-string (slurp (io/resource "datomic/schema.edn")))
05:21vmarcinkoi get error: No reader function for tag db/id
05:22vmarcinkoi thought reader functions are same for both clojrue reader and edn reader, no? and datomic jar has these readers registered for both, no?
05:23vmarcinkoreader function i meant for datomic jar
05:24trap_exitis there a way, in clojure, to forward declare variables _across_ namespaces ?
05:24trap_exiti.e. foo/cat and bar/dog mutualy call each other
05:24trap_exitis there a way to make this work?
05:24trap_exit(foo + bar are namespaces, cat +dog are functions)
05:25noidiif they're so closely intertwined, they probably belong to the same namespace
05:30Pate_what's the minimum code I need to "run" a fn in a .clj file?
05:30Pate_do I have to have a -main fn?
05:30xsynnope
05:30xsynyou can execute from top down without lein boilerplating
05:33Pate_so (defn foo ...) (foo) in my-file.clj?
05:37Pate_what's the shortest way to run a clojure file from the command line without using lein?
05:40Pate_is there any help on installing cake on Windows?
05:40clgvPate_: why not lein, the defacto standard build tool for clojure?
05:40Pate_does lein have a persistent jvm in the bg?
05:40clgvno. does cake?
05:41clgvPate_: do I remember correctly that you are the one that wants to use clojure CLR in the powershell for devops?
05:42dissipatehow do you get lein to load dependencies from outside a project folder?
05:42menguwould it make sense to have a clojurescript talk in a frontend conference?
05:42Pate_nope, not me. but that sounds like a cool idea!
05:43Pate_apparently cake tries to keep a jvm around: https://github.com/ninjudd/cake/wiki/Persistent-JVM
05:43clgvdissipate: you usually need to specify everything as dependencies in the project.clj so that leiningen automatically adds the jars to the classpath. but there might be an option to specify classpath additions
05:43Pate_mengu, absolutely, esp. if you show Om.
05:44dissipateclgv, then what is the point of the ~/.m2 directory?
05:44Pate_I also found Drip, which supposedly works with lein to keep a JVM around for faster startup: https://github.com/flatland/drip
05:44clgvdissipate: ah thats the maven cache. anything in there is found when you add its maven coordinates to the dependencies declaration in yourproject.clj
05:45clgvPate_: yeah and technomancy had some project for that as well. but I did not try any of them, so I can't recommend any ;)
05:46dissipatePate_, have you tried POM?
05:46Pate_not familiar with pom
05:46Pate_(clojure noob)
05:46dissipatePate_, sorry, i meant Pomegranate. https://github.com/cemerick/pomegranate
05:47clgvpomegranate is just for adding dependencies on the fly to a running repl
05:47dissipatesupposedly it allows you to load depedencies on the REPL so you don't have to reload the REPL
05:47Pate_that's cool
05:47clgvand is used in leiningen afaik
05:48clgvPate_: but mind the warning in the readme "Please note that there are a number of scenarios in which add-dependencies will not work, or will not work as you'd expect."
05:48Pate_ok. so how do I get a persistent jvm running on windows for faster clj startup?
05:48dissipateclgv, so lein acts as a 'virtual environment' for a project as well?
05:49clgvdissipate: I am not entirely sure what you mean with 'virtual environment'
05:49dissipatei guess i'm a bit confused because in the python world 'pip' and 'virtualenv' are two different tools
05:50AeroNotixdissipate: dependencies are much better in the JVM world than they are in Python
05:50Pate_does Drip work on Windows? https://github.com/flatland/drip
05:50AeroNotixdissipate: maven allows you to have a myriad of the same library in your "site-packages"
05:50AeroNotixwhen lein runs, it creates the JVM's version of PYTHONPATH each time
05:50Pate_drip keeps a fresh jvm around, instead of using a persistent jvm around, which can cause problems over time.
05:50clgvwell a project should depend on a concrete version of the library it uses and leiningen pulls them in for you
05:50AeroNotixthus giving your library a "virtualenv"
05:51AeroNotixdissipate: it works properly, unlike the hacks venv has to do to work.
05:51dissipateAeroNotix, i see. i'm starting to understand that lein is what are separate tools in other language ecosystems. :O
05:51clgvit is funny how you get the urge to run away screaming when someone explains you how dependencies and libraries work in GNU R
05:52AeroNotixdissipate: there's no downside to them being the same tool, in fact it works better
05:52clgvdissipate: well as AeroNotix pointed out the dependency approach is different
05:52Pate_(canonical Drip repo: https://github.com/ninjudd/drip)
05:52dissipateAeroNotix, yeah, it's pretty nifty. can't wait to publish my first project to clojars. :P
05:53clgvPate_: drip seems very *nix-only from its readme
05:53Pate_:(
05:53dissipatei'm working on a RNG library that uses different sources of entropy and will have a better 'shuffle' function
05:54Pate_there's not a lot of C code, so could probably be ported to Windows.
05:54Pate_or made cross-platform.
05:55dissipatemy god, someone is porting AIXI to clojure!
06:01Pate_how do I write to stdout when I'm in a REPL?
06:01Pate_(prn "test") ?
06:02clgvprint/println
06:02clgv,(println "Hello!")
06:02clojurebotHello!\n
06:02clgv,(prn "Hello!")
06:02clojurebot"Hello!"\n
06:02clgvprn/pr is for serialization to text
06:04Pate_how do I tell lein where to load Clojure from, after I downloaded and unzipped Clojure 1.6?
06:04Pate_or do I just add it as a dependency to any project.clj and run?
06:04MorgawrPate_: Lein uses its own Clojure, you don't need to download/unzip clojure yourself
06:05Morgawrjust list clojure as a dependency of a project and it will be downloaded automatically
06:05Morgawraka :dependencies [[org.clojure/clojure "1.6.0"]] in theproject.clj
06:05Morgawrthe project*
06:07BalkyDwarfcompletely off topic(s) but I just came across this blog post and found it very well done and nicely simple: http://www.clojured.com/2013/04/writing-clojureclojurescript-web.html
06:08Pate_BalkyDwarf, nice post.
06:14BalkyDwarfPate_: yeah it makes me feel like pedestal is not really needed... pedestal is too rails-like and springfuse-like for me...
06:14Pate_Pedestal is too big. It expounds on its simplicity, but it is too complex.
06:15Pate_I suspect that Om combined with sente/http-kit will win the common Clojure real-time story.
06:17BalkyDwarfPate_: oh ok, never heard of those... do they allow to make clojure + clojurescript webapps ?
06:18Pate_yes. Om is a ClojureScript integration on top of React. It blows away anything MV*: swannodette.github.io/2013/12/17/the-future-of-javascript-mvcs/
06:19Pate_the immutable Cljs memory model makes React's virtual DOM diffs near O(1), as far as I can tell.
06:20Pate_so you always re-render the whole "scene" or page, but the actual DOM changes are heavily batched and optimized. This lets you forget about state in the DOM.
06:20BalkyDwarfPate_: thanks, sounds interesting. Does it provide some tools for client/server communication via ajax/websocket?
06:20Pate_no, that's where sente comes in
06:20MorgawrI personally prefer quiescent over Om, it's simpler and for my use cases (aka very simple web apps) it feels much easier to reason about, check it out if you don't know it :)
06:20Pate_sente lets you do realtime over core.async channels
06:20Pate_Morgawr, had not heard of Quiescent.
06:21Morgawrhttps://github.com/levand/quiescent
06:21BalkyDwarfthank you guys
06:21Morgawrit's similar to Om in some ways but very different in others
06:21Pate_BalkyDwarf, and with an additional 13 lines, swannodette added undo to the "todo" example: http://swannodette.github.io/todomvc/labs/architecture-examples/om-undo/index.html
06:23Pate_Morgawr, Quiescent looks really interesting. Also hadn't heard of reagent: http://holmsand.github.io/reagent/
06:34deobaldsWe're attempting to use clojure.java.jdbc without any libs on top of it. We're writing some tests which hit the db (just using clojure.test). We've written a fixture which wraps the test in a transaction so we roll back our changes to the test db, but clojure.test/use-fixtures doesn't seem to run if we run a test individually (M-c M-, in our case). Does anyone have any advice in this area?
06:37BalkyDwarfMorgawr: what do you use, if anything, alongside quiescent, for ajax / websockets? sense or core.async or something else?
06:39MorgawrBalkyDwarf: heh, I'm not much of a webdev, I just played around with quiescent (still a WIP to remake my site but exams have been slowing me down)
06:39MorgawrI know quiescent is pretty much made to work with core.async for channels
06:39Morgawrand that's what I'm going to use to propagate events
06:39Morgawrbut that's it, really
06:40BalkyDwarfMorgawr: thanks!
06:55BalkyDwarfrandom ranting: from devops perspective, I wonder which is a lesser evil - something extremely young like http-kit, or a dinosaur like tomcat. I guess ring+jetty is a good middle ground, but that feels too organically grown for some reason...
07:33noidideobalds, I've just run (my-fixture my-test) in the REPL
07:34noidiI'm sure you can write a bit of elisp to do that for you. personally I wouldn't bother, given that recalling the previous entry in the REPL takes only a couple of keystrokes.
07:37xyprotoWhen building clojure from source, with the intent of packaging it for a linux distro, is it better to use ./antsetup.sh + ant or mvn package?
07:38xyprotoreadme.txt on github mentions both methods, but I don't know which method would be preferrable
07:38xyproto*preferable
07:38beamsofor a silly comparison, homebrew on mac os x distributes leiningen instead of clojure
07:39xyprotoAnd is the topic correct, is it not 1.6.0 that is the latest release version?
07:39beamsoit is 1.6.0 but i haven't seen anyone with ops
07:40xyprotobeamso: all programming languages wants to use their own language-specific package manager. This looks like the best solution from the point of view from the respective languages. From the perspective of packaging packages for a distro, they should be all be packaged in a somewhat similar way. (Until someone does something sensible, like making a package manager where the language-related package managers
07:40xyprotoare included as plugins).
07:41xyprotobeamso: that's why I just can't package leiningen and call it a day, for now :/
07:43beamsoyes and no
07:44xyprotohow does one run maven in order to only perform the tests, after having built clojure?
07:45beamsomvn clean package should run the tests
07:45xyprotobeamso: yes, but I only wish to run the tests
07:45beamsomvn test
07:45xyprotobeamso: first build, then test
07:45xyprotobeamso: ok, thanks!
07:45xyprotobeamso: (in two separate functions in the package description)
07:46beamsoin mvn, package depends on test
07:46beamsocompile doesn't depend on test
07:46xyprotobeamso: great!
07:46xyprotobeamso: testing it now
07:47beamsoit looks like mvn calls out to ant anyway
07:48xyprotobeamso: when run with "mvn test" it tries to compile clojure even though it has already been compiled with "mvn package -Dmaven.test.skip=true"
07:49beamsoif the timestamps aren't being checked i can see that happening
07:49xyprotook, but your answer didn't work
07:50beamsoa) i've never compiled clojure before
07:50beamsob) i believe you're asking me why maven isn't working as you'd expect
07:51xyprotobeamso: a) then why are you answering like you know the answer and b) it's not only maven, but the build system + configuration chosen by clojure
07:51AeroNotixGuys, chill
07:51xyprotoAeroNotix: am chill :)
07:51beamsoi'm simply using my knowledge of maven and looking at what i see in the github repo
07:52xyprotoI blame myself for asking before researching. Thanks for the help.
07:54beamsoTIL clojure is distributed compiled in debian
07:56reQunixShould someone update the topic since 1.6.0 has been released?
07:58hyPiRionreQunix: yeah
07:58hyPiRiontechnomancy: you know what you have to do
08:11mskoudTopic need change :-)
08:16clgvdoes someone fill out a tally sheet of how often the topic remark occurs? :P
08:18Averellonly 6 times since yesterday.
08:19reQunixIt'll stop once the topic is updated... Consider it added motivation. : )
08:33sm0ke,(java.util.Date. Long/MAX_VALUE)
08:33clojurebot#inst "292278994-08-17T07:12:55.807-00:00"
08:33sm0kewish some one lives to face the end of timestamp problem
08:34hyPiRionThat is not the timestamp problem
08:35hyPiRionsm0ke: http://www.youtube.com/watch?v=-5wpm-gesOY is the "timestamp" problem
08:39beamsoi thought the time problem was in 2037.
08:39sm0ke,(java.util.Date. Integer/MAX_VALUE)
08:39clojurebot#inst "1970-01-25T20:31:23.647-00:00"
08:40sm0ke,(java.util.Date. 0)
08:40clojurebot#inst "1970-01-01T00:00:00.000-00:00"
08:40beamsosomething like that one
08:41sm0ke,(java.util.Date. -1000000000000)
08:41clojurebot#inst "1938-04-24T22:13:20.000-00:00"
08:41beamsooops. 2038.
08:41beamsohttp://en.wikipedia.org/wiki/Year_2038_problem
08:41sm0ke,(java.util.Date. Long/MIN_VALUE)
08:41clojurebot#inst "292269055-12-02T16:47:04.192-00:00"
08:41sm0kehmm look weird
08:43ned-does anyone know why this exception is being thrown ? http://pastie.org/8970117
08:50beamsofor the earlier one, should it be (use 'clojure.contrib.duck-streams)
08:51beamso?
08:52beamsoand for the second, (:require [clojure.contrib.duck-streams :refer spit])
08:52beamso?
08:52clgvyay apparently I build a dead lock when on my first attempt to build a thread-safe "require"
08:53beamsoactually, (:require [clojure.contrib.duck-streams :refer [spit]])
08:55hyPiRionbeamso: spit was integrated into Clojure core in 1.3.0 I believe
08:55clgv,(meta #'spit)
08:55clojurebot{:ns #<Namespace clojure.core>, :name spit, :arglists ([f content & options]), :column 1, :added "1.2", ...}
08:55hyPiRionoh, even earlier
08:55clgvpretty close ;)
08:55hyPiRionI just remember that clojure.contrib was abandoned in 1.3
08:56AimHereI dread any language that doesn't just let me spit and slurp files as and when needed now
08:56ned-welp that explains it
08:56beamsooh. maybe that answer's ned-'s questions better.
08:56ned-wheres duck-streams now
08:56hyPiRionned-: you can just use `spit` without requiring anything these days :)
08:56ned-hyPiRion: ooh thank you sir.
08:56hyPiRionI believe everything in duck-streams is in clojure.core
08:56hyPiRionor in clojure.java.io
08:57hyPiRionat least spit and slurp is in clojure core
08:58clgvI have an immediate mental image of "duck-streams", anyone else?
08:59hyPiRionclgv: http://i.imgur.com/FsxIVgT.jpg
08:59clgvhyPiRion: almost ,)
08:59clgvI'd imagine several ducks on the water^^
09:00atyzclgv: This? http://image.shutterstock.com/display_pic_with_logo/410935/410935,1278271292,5/stock-photo-a-pair-of-ducks-in-a-gushing-stream-56501821.jpg
09:01clgvatyz: :D
09:54lnostdalwhat's the difference between fn and fn* ?
09:54CookedGryphonfn* is an internal implementation detail, don't use it unless you're tweaking the language
09:55lnostdalyeah, i'm curious about what it does internally compared to fn
09:55hyPiRionlnostdal: ##(macroexpand-1 '(fn [[a b]] (+ a b)))
09:55lazybot⇒ (fn* ([p__17884] (clojure.core/let [[a b] p__17884] (+ a b))))
09:55lnostdali'm not using it directly; code like #(if % :x :y) will generate it
09:55CookedGryphonwell for a start, I think it's defined in java
09:55hyPiRionone of the details
09:58clgvdo we have a specialized string compare in clojure that compares strings starting with a number by that number?
09:58clgvI'd guess someone wanted that behavior already ;)
09:59clgvotherwise I'd hack it together via regex and parseLong
10:00hyPiRionclgv: what would happen if the string doesn't start with a number?
10:01hyPiRion,*clojure-version*
10:01clojurebot{:interim true, :major 1, :minor 6, :incremental 0, :qualifier "master"}
10:02clgvhyPiRion: that's definition, either lesser or greater than then ones with a number
10:02hyPiRionalright
10:03clgvhyPiRion: somehow similar to when I use (sort-by :id data-coll) and there might be no :id in some items
10:07hyPiRion,(sort-by #(some-> (re-find #"^-?\d+" %) Long/parseLong) ["100 ten" "void" "103 foo" "-40 40"])
10:07clojurebot("void" "-40 40" "100 ten" "103 foo")
10:07hyPiRionclgv: ^?
10:09clgvhyPiRion: looks good :D - guess it is to specialized for clojure.core.* namespaces ;)
10:09CookedGryphonis there a looping construct like this: https://www.refheap.com/66001
10:10TimMcclgv: As opposed to version number comparison?
10:10CookedGryphoni find myself writing loop, when-let, recur so often in this basic format with core async
10:10clgvTimMc: pardon?
10:10hyPiRionclgv: yeah, seems probably a bit too specialised. It's not hard to make yourself though :)
10:10clgvCookedGryphon: write yourself a "while" macro
10:10TimMcWell, numerical sorting in a file listing shares some properties with version number sorting, but it's not the same.
10:11clgv,(doc while)
10:11clojurebot"([test & body]); Repeatedly executes body while test expression is true. Presumes some side-effect will cause test to become false/nil. Returns nil"
10:11TimMcand I was wondering which you wanted
10:11hyPiRionI just pad stuff with zeroes and use ISO 8601, then sort alphanumerically
10:12clgvah ok. just plain numerical sorting. I have items with ids that usually start with numbers that have chronological information
10:31CookedGryphonIs there anything falsey in clojure to which I can attach metadata?
10:32CookedGryphonI have a function in my api which currently returns true or false depending on the success or failure of the requested operation
10:33ambrosebsCookedGryphon: no
10:33CookedGryphonit's nice and clean doing (when (operation ...) ...) but now I want to in some cases query the cause of the false answer, and exceptions completely complicate the flow of the functions using this api
10:34clgvCookedGryphon: you can invert the meaning as they do in C/C++ by returning error reasons (e.g. clojure maps) or nil on success
10:34CookedGryphonugh, that's not nice or obvious to look at though...
10:35CookedGryphonperhaps if I had an appropriately named function... but still
10:35clgvwell you only need a when-success macro
10:36CookedGryphonI wish you could attach meta to nils, it feels like you should be able to do some really nice error handling with current nil-punning behaviour, but if anything wants to examine the root cause of the nil being passed down they examine the metadata
10:36clgvbtw. in the case of when you won't be able to look at the reasons of the error anyway ;)
10:36CookedGryphonthen you get the stack benefits of exceptions and the ease of use of nil-punning
10:37CookedGryphonclgv: good point, but you could still use when for the trivial case, and then let out the value if you wanted to examine more closely
10:39clgvCookedGryphon: in SBCL you could do that with multiple return values. as long as you do not care you get only the first value and you have to do something special to get the other values...
10:41CookedGryphonclgv: what I'm talking about would go a little further than that, your caller doesn't need to care about your error directly, as long as it deals with nils nicely and passes on the same nil on a nil input it can't do anything with
10:41CookedGryphonbut there's probably some major drawbacks I haven't considered
10:43clgva pity there is no to-boolean protocol method ;)
10:43clgvyou could have your metadata nil with it^^
10:51ambrosebsCookedGryphon: I don't think nil-punning is really worth worrying about.
10:51ambrosebsCookedGryphon: I just make a predicate function and move on
10:51ambrosebsif your solution works with nil-punning, great.
10:52ambrosebsbut meh
11:09Morgawrhttps://hackworth.be/2014/03/26/clojure-web-security-is-worse-than-you-think/ anybody read this?
11:24cbpMorgawr: yea
11:27arrdemMorgawr: yea
11:27jph-Morgawr, i wrote it
11:27jph-:P
11:27Morgawrjph-: good one :P
11:27MorgawrI'm watching the video talk now
11:27jph-i was really worried about how it'd be received
11:27Morgawrjust felt the need to spread it around :P
11:27jph-i didnt want it to come across as shitting on clojure
11:28jph-and it's really just a few of my notes from aarons talk
11:28Morgawrwhen I read the title I was a bit taken aback but both the article and the talk on which the article is based on raise valid and solid points
11:28jph-but i figured it needed calling out
11:29hyPiRionjph-: Valid criticism is not shitting, it's important
11:30jph-if we hit rails-like popularity, we dont want rails-like security issues with it
11:30Morgawror php-like (in)security :P
11:30jph-yep
11:31BalkyDwarfI wonder if these security concerns apply to pedestal
11:32jph-web security issues are fairly well understood
11:32jph-but if the controls aren't built in to address them
11:32jph-then by default, they're vulnerable
11:32Morgawryeah
11:32Morgawrthat's the problem, sane defaults
11:33jph-i link to the owasp testing guide and top 10 in the post, ask your web framework developers how the protect against them
11:33jph-s/the/they/
11:46sdegutisWhat's a good way to create some functions (representing third party services) that you will override with lightweight implementations during testing, and which you have to explicitly set to the real functions in production?
11:47Bronsasdegutis: just use with-redefs when testing
11:48mikerodis there anything "easy" available to allow Clojure to .clj source from somethiing like a JarInputStream. :)
11:48mikerodallow Clojure to compile .clj *
11:48sdegutisBronsa: So use dynamic vars to hold all the functions related to this service, and alter-root-var them in production, and with-redefs them in testing?
11:49sdegutisAlthough if they're just going to be alter-root-var'd, I probably don't need them to be ^:dynamic.
11:49Bronsawhy do you need to alter-var-root them?
11:50sdegutisI don't want them to be set to the real or fake services until I explicitly set them so during production.
11:50sdegutisThis is to avoid accidentally forgetting to override them in tests, and ending up using the real services by accident.
11:50Bronsaoh ok
12:03technomancyjph-: did aaron's talk mention read-eval?
12:03rkneufeld_technomancy: He didn't mention it specifically, but he did touch briefly on injection attacks.
12:03jph-technomancy, i don't believe so
12:03jph-he kinda sped over injection imo
12:04jph-i almost included a section on what he said re injection
12:04jph-but in reality, it boiled down to "we have korma, but it isn't abstract enough, but we dont need an ORM"
12:04jph-so i was left scratching my head
12:04jph-and it didnt really get to nitty gritty re injection
12:05technomancytoo bad; IMO the fact that you're just supposed to figure out that the reader isn't safe for user-provided data is trouble just waiting to happen
12:05jph-it did make me wonder how a user-input would be processed all the way into korma
12:05jph-ie if the old yaml issues with ruby applied to maps
12:06jph-compojure routes into functions into korma
12:07technomancyjph-: they do apply to the reader
12:07technomancyolder versions of ring used to use the reader for cookie storage
12:07jph-i haven't yet done much testing in that space... i'm still getting my head around the higher-level compojure architecture
12:08technomancyif people get that wrong even in ring, you can just imagine what actual apps in the wild are like
12:08jph-the other thing is that unlike ruby, there isn't really a 'security team' for clojure
12:08jph-since ownership of libraries is spread far and wide
12:09TimMcjph-: The HTML templating thing is my personal rant-in-a-can.
12:09jph-TimMc, in what sense?
12:09jph-too many?
12:09jph-or the security side?
12:10TimMcThe security side.
12:10TimMcMost of them are usnafe by default.
12:10cbpselmer is good against xss
12:10xeqiTimMc: hmm, I thought it was just hiccup
12:10TimMcNot just hiccup.
12:10jph-this is the kind of discussion i think the clojure community needs more of
12:11jph-otherwise clojure web apps will end up a ticking time bomb
12:11jph-ppl blindly assuming someone else has done the right stuff for us
12:11cbpBut a lot of people like their templates to be vectors :-D
12:11TimMccbp: You can have that and ahve it be secure as well.
12:12TimMccheck out the patch clojars uses on Hiccup
12:12xeqiTimMc: thats actually not 100% secure, someone found a bug in it :(
12:13xeqiwell, an unexpected interaction between nested params and it
12:14xeqiI'd love to find time to take hiccup out of clojars entirely
12:14xeqiand replace it with something safe
12:14TimMcxeqi: Oh, I'd like to see the bug and patch!
12:14xeqialong with many other things that take time ....
12:15hyPiRionxeqi: hey let's implement a Clojure version with fast startup time, port leiningen to it and all its plugins
12:15xeqiTimMc: my quick solution for clojars was to remove nested params, since we don't ever use it
12:15hyPiRionTakes a weekend tops
12:16cbphyPiRion: arrdem was gonna implement "lean clojure" for GSoC
12:16xeqihyPiRion: haha, are you making fun of satvvik's talk?
12:16hyPiRionxeqi: I'm not at west, so no =(
12:17rasmustolean-clojure-nrepl-cider.el
12:17sdegutisI've been taking Clojure's vars and destructuring for granted, they're each pretty great.
12:17felherHey folks. Would one sooner use '-' in longer namespace-names or '_'?
12:17xeqihyPiRion: there are people that want to pursue this, rhickey, satvvik, and tbaldridge had a discussion around the gsoc plans for that
12:17sdegutisfelher: - in the name, _ in the file
12:17rasmustofelher: - in the name-space, _ in name_space.clj
12:17Bronsaxeqi: hear hear
12:17sdegutisi won
12:17felherhehe :D
12:18rasmustosdegutis: my answer had both examples
12:18hyPiRionxeqi: leaner as in on the jvm?
12:18sdegutisrasmusto: touche
12:18felherThanks folks. :)
12:19xeqihyPiRion: yep, think more static compiled for production stuff where you don't need to redef and such
12:19hyPiRionAh, right
12:25CookedGryphonI have a proxy-super call in a proxy implementation, and it's eating 70% of my processing time in reflection
12:25CookedGryphondoes anyone have a clue how to type hint it? It looks like (proxy-super onTouchEvent event)
12:26CookedGryphonso I have no idea where to hint the implicit this...
12:26sdegutisLeiningen handles -h placed after an alias, intercepting it from the function itself.
12:26sdegutisThis was not expected behavior.
12:27hyPiRionsdegutis: yeah, it's a known issue
12:27hyPiRionI think it's scheduled for 2.4
12:27sdegutisOh.
12:27technomancyit's fixed in master
12:27technomancywell
12:27technomancyit still does that by default, but you can opt out
12:27sdegutisAh.
12:28sdegutisI liked that feature all the way up until last night when I used an alias to shorten a command line utility I'm writing.
12:34hyPiRiontechnomancy: while you're here, you better do something like `TOPIC=$(echo $TOPIC | sed 's|1.5.1|1.6.0|g')` before people complain about the outdated topic in this channel again
12:34technomancyoh yeah
12:35rasmusto,*clojure-version*
12:35clojurebot{:interim true, :major 1, :minor 6, :incremental 0, :qualifier "master"}
12:35clgv:D
12:35seangroveHas anyone else noticed that the topic is outdated?
12:35rasmusto##*clojure-version*
12:35seangroveAhhhh, damn
12:35clgv:P
12:36clgvmaybe it needs a rewrite as well. since 1.7/2.0 is not that near ;)
12:36AmandaCtechnomancy: I demand balanced news! I want the not-so-top analysis’s opposing opinion on the matter!
12:36jcromartiethe penultimate analyst?
12:36rasmusto##(prn *clojure-version* 'hmmm)
12:36lazybot⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil} hmmm nil
12:37technomancyAmandaC: depends, are you qualified as a not-so-top analyst?
12:38Averellthe number exploitation must end. I predict versions will run out in the next 30 years.
12:38justin_smith,*clojure-version*
12:38clojurebot{:interim true, :major 1, :minor 6, :incremental 0, :qualifier "master"}
12:38rasmustojustin_smith: why's lazybot on 1.4 still?
12:38hyPiRionclgv: 2.0 is not that near? I'm not sure, but I would've expected some news on that on the clojure-dev mailing list
12:39hyPiRionApologies for not understanding jokes
12:39justin_smithrasmusto: I think they intentionally leave them on the most recent two versions, but they have been *erherm* lazy in updating one of htem
12:39rasmustojustin_smith: was waiting for that :)
12:40AmandaCtechnomancy: nah, I’m a number denier. I refuse to accept numbers even exist.
12:40AeroNotixAmandaC: yo
12:40justin_smithclgv: hyPiRion: I like Knuth's versioning for TeX, where each release gets it incrementally closer to PI
12:40AeroNotixAmandaC: doing Clojure these days?
12:41AmandaCAeroNotix: and several other languages, yes
12:41AeroNotixAmandaC: cool!
12:42patchworkAmandaC: numbers don't exist, but they are useful
12:43rasmustomath has no applications outside of SAT testing
12:47justin_smithrasmusto: nonsense! just the other day I proved there was a 1:1 and onto mapping from my monthly budget (idealized as a continuous income stream) and the sum prices of the inventory of the local musical equipment store
12:48rasmustoare you saying you bought everything in a music shop?
12:49justin_smithrasmusto: I justified doing so in theory, that was good enough :)
12:50rasmustomoney is just a placeholder anyways, may as well replace it with guitar picks and midi keyboards
12:50justin_smithtrue enough
12:51justin_smiththey are isomorphic at least
12:52rasmustospeaking of investing, am I the only one who isn't freaking out and cancelling my order RE that facebook/oculus thing?
12:53jcromartierasmusto: it is really shocking
12:53justin_smithhttp://weareinstrument.com/labs/open-source/oculus-bridge my company may have played a small part in facebook finding the oculus rift useful :(
12:54jcromartieFacebook is just not where promising new technology goes to thrive.
12:54patchworkI am becoming increasingly weary of giant companies acquiring awesome things and destroying them
12:55patchworkI heard that right after I heard about the demise of OpenNI
12:55patchworkand primesense
12:55justin_smithpatchwork: oh, that is sad
12:55rasmustodoes it help that oculus is hardware+software and is so different from what facebook normally buys?
12:55patchworkglad I got my asus xtion when I did, you can't even find one anymore
12:56jcromartierasmusto: it might help mitigate the awfulness
12:56patchworkVery curious to see what the result is… any way oculus can come out of this unscathed? I can't imagine it being used for anything awesome at this point
12:58rasmustoI went in for a ue4 subscription, I'm still damn excited about the new hardware
12:59jcromartiepatchwork: well, if it's still a device that people can buy and develop for, with Carmack at the helm, it might be OK
12:59jcromartiebut if Facebook steers the dev experience AT ALL, then I'd imagine it will pretty much be the beginning of the end of Oculus
12:59patchworkjcromartie: I will hold some measure of hope
13:03S11001001the Oculus team thanks you for going on this incredible journey with them
13:03jcromartieS11001001: stop it you are making me sad
13:03mdrogalislol
13:12rasmustoany clojure/west must-see talk videos? I watched (and loved) the instaparse one
13:15jph-rasmusto, the security one
13:15rasmustojph-: with-security? I'll queue it up
13:15jph-rasmusto, yep, that one
13:16rasmustocool, thanks
13:24pyrhi clojure ! just dropping by because i'm really happy to release http://pithos.io today, an S3 compatible object store server written in clojure
13:27cbp(inc pyr)
13:27lazybot⇒ 2
13:28Raynes(inc pyr)
13:28lazybot⇒ 3
13:34pyr(btw if anyone deems it interesting, i'd love a few upvotes here: https://news.ycombinator.com/item?id=7474817
13:35Jahkeupvery nice pyr!
13:35Jahkeup(inc pyr)
13:35lazybot⇒ 4
13:36nickmbaileycool stuff
13:37nickmbaileypyr: what version of cassandra?
13:37pyr2.0+
13:37jcromartieNeat
13:38nickmbaileypyr: which clojure client did you use?
13:38pyralia, from mpenet
13:48r1chardhttp://www.youtube.com/watch?v=CBL59w7fXw4 <-- have you seen this "clojure.web/with-security"
13:48r1chardI feel like there's some BS in that talk.
13:48r1chardNot just feel, know.
14:00jph-good, call them out
14:00jph-i kinda think the speaker rushed through most of it, didnt really go into specifics for several areas
14:02jph-but i didn't spot anything obviously wrong, i just think some parts were glossed over
14:03r1chardWell first, you don't selectively escape or "strip" HTML tags in user input. That's a recipe for disaster.
14:03r1chardEither you escape HTML entities, or you don't.
14:03r1chardIf you need selective support for, say, bold and italic, you need to go through a string DSL allowing only that.
14:04r1chardHTML is full of edge cases, if you try to parse it, attackers will abuse the edge cases.
14:04jph-yep
14:04jph-like... what is it, there's 90+ ways of representing <
14:04jph-encoding
14:04r1chardSecond, he's complaining that pass hashing libraries don't offer HMAC.
14:05r1chardHMAC is for message origin codes, not for password hashes. Vastly different attacks. Vastly different approaches.
14:05TimMc++
14:05r1chardTacking on HMAC for password hashes feels like he has no idea why HMAC is used.
14:06jph-yes, i would have liked him to elaborate more on that point
14:06r1chardThird: "there are too many template engines and db vendors you guys. Let's just stop. Let's just stop." Uhmm okay? You go make people just "stop" their projects, what kind of a solutions is this?
14:06technomancysounds like ryah
14:06jph-my recollection is he was complaining about multiple template libraries within projects
14:07r1chardjph-, I don't know. It's very arbitrary to just put a limit on a project what it'll use. Any bigger project is done in separate components, and one has to pick the right tools for the job.
14:07technomancyhttp://shitryandahlsays.tumblr.com/post/33834861831/but-who-decides
14:07jph-r1chard, well, the speaker is entitled to his opinion, as are you :)
14:07shep-homeI've got this one hash, and it has a lot of data in it. When I print it to the REPL, it's big and slows down emacs. What are some options to customize the printing of that hash alone?
14:08r1chardjph- :D
14:08jph-r1chard, btw, i wrote the writeup of that vid that hit hn
14:08jph-:P
14:08r1chardjph- :D
14:09r1chardAlso the fact he's promoting ORM as better for DB security is making my heart bleed.
14:09jph-to me it sounded like a former ruby guy wanting better security in his new favourite language
14:09jph-well
14:09jph-the injection section was rushed as well
14:09r1chardORM may speed up development, but that's hardly the only way to fix DB security.
14:09jph-"korma is ok, but it isnt enough but we dont need ORM but we need more abstraction"
14:09jph-hence why i left it out of my post
14:09r1chard:)
14:09jph-i didnt really have any takeaways
14:09technomancyaren't most of the rails DB issues stemming from the fact that people don't bother to learn SQL precisely because of ORMs?
14:10jph-well its 2am here, i shall bid you all adieu
14:10technomancy"learn how your database works" is better advice, not that people will follow it
14:10jcromartietechnomancy++
14:10jcromartieoh sorry
14:10jcromartie(inc technomancy)
14:10lazybot⇒ 101
14:11tuft5 minutes into the talk and he hasn't said anything yet...
14:12Bronsashep-home: *print-lenght* and *print-level*
14:16shep-homeBronsa: thanks! won't that truncate my output at some arbitrary position though?
14:16Bronsayes it will
14:17gfredericksBronsa: me and a few guys are at the clojurewest hackfest thinking about extending codeq to have usage analysis stuff (similar to the code I sent earlier)
14:17gfredericksand the major hitch compared to my earlier approach is that it might not be reasonable to actually eval the code
14:17gfredericksmy guess is that this more or less precludes using tools.analyzer in a serious way -- can you confirm that's the case
14:18Bronsagfredericks: there's no way to evaluate a whole file/namespace without evaluating each form as you go
14:18Bronsahow would you be able to macroexpand?
14:18gfredericksright but I'm thinking it's not possible to eval _at all_
14:19gfredericksat least if you want the analysis to go over the whole history of the project, because then you have lots of changing dependency sets
14:19Bronsayeah I see where the problem lies
14:20TimMcshep-home: So, you can do things like (keys foo) and then select-keys
14:20gfredericksBronsa: so should I give up trying to do something general and maybe have it start a separate jvm for each commit we want to analyze?
14:20hiredmangfredericks: it seems like that would be better built as a service a long side/on top of codeq
14:21Bronsagfredericks: I honestly don't see why you would need tools.analyzer at all for this
14:21gfrederickshiredman: the first thought was to write a library that just interacts with the codeq db, adding usage info
14:21gfrederickshiredman: is that what you're thinking of?
14:21hiredmancodeq indexes the codebase, then you can pick shas to feed in to this other service that checks out the sha and enrichs the data codeq has
14:21hiredmanyeah
14:22gfredericksBronsa: the main thing we need is, given pieces of code, figuring out what vars it uses
14:23Bronsagfredericks: I see. whichever way you want to do it, I don't think you're going to be able to go anywhere without evaluating the forms for macroexpansion
14:23gfredericksBronsa: okay, that's what I was imagining
14:23Bronsa(defmacro x [a] (if (do-something-with a) `some-var `some-other-var))
14:24Bronsathere's no way to know statically if you're going to be using some-var, some-other-var or both
14:24gfrederickssure
14:24shep-homeTimMc: To use those, I would need to know that /this/ is the big hash, right? And I have a big vector too, not just a hash :-)
14:24gfrederickshiredman: okay, so one commit at a time sounds reasonable to you too?
14:25shep-homeI'd love to be able to "override to toString" for a single hash when I create it
14:25Bronsagfredericks: btw I don't know if you were logging yesterday but I added analyze+eval to t.a.j which doesn't require you to do any eval manually && doesn't require you to generate a new env everytime
14:26gfredericksBronsa: yeah, I saw that; thanks
14:30hiredmangfredericks: I think it would have to be
14:32Bronsagfredericks: also, if you decide to use t.a, this seems like a good place to use datomic's datalog to query the ASTs, example https://github.com/clojure/tools.analyzer/blob/master/src/test/clojure/clojure/tools/analyzer/query_test.clj#L17
14:33wei__is there such thing as reduce-while?
14:33rasmusto(doc reduced)
14:33clojurebot"([x]); Wraps x in a way such that a reduce will terminate with the value x"
14:34wei__e.g. taking from a collection until the sum is a certain amount
14:34rasmustowei__: ^^
14:34TimMcshep-home: Yeah. So you should bug gfredericks to write his giant datastructure visualizer. :-P
14:34wei__rasmusto: nice. does that also work with core.reducers?
14:35rasmustowei__: I believe so? Though it may be a 1.6 patch that allows that
14:36amalloyreduced was added in 1.5
14:36amalloyalong with reducers
14:37amalloywei__: although really you don't need reduced for use cases like reduce-while - you can use reductions and take-while
14:37wei__rasmusto: mind pointing me to an an example usage?
14:37wei__oh yeah, reductions is lazy too right
14:37andrzejsliwaHi guys, anyone using smartparens on emacs for clojure development? any sane defaults (to be more like paredit)
14:37andrzejsliwa?
14:38rasmustowei__: ah, nvm about the 1.6 thing. This is what I was remembering http://dev.clojure.org/jira/browse/CLJ-1160
14:38rasmustoreductions + take-while is probably a better answer
14:38amalloyhuh. what's better about smartparens than paredit, andrzejsliwa?
14:39andrzejsliwaI have it as default in my Emacs Prelude bundle
14:39gfredericksTimMc: do you solicit buggings on this issue every month or so?
14:40amalloyandrzejsliwa: well, reading over the docs, i'd suggest at least turning on smartparens-strict-mode
14:41andrzejsliwaand then use it with paredit?
14:41amalloywell, i think you're supposed to use one or the other
14:41andrzejsliwasome people mixing them... but I want to avoid it
14:42amalloyi'd just install paredit, because it's well known and has worked for decades(?). but if you're using smartparens, strict-mode will get you a behavior that i've found useful in paredit
14:45rasmustowei__: some examples
14:45rasmusto,(last (take-while #(<= % 10) (reductions + (range 30))))
14:45clojurebot10
14:45rasmusto,(reduce (fn [a b] (if (>= a 10) (reduced a) (+ a b))) (range))
14:45clojurebot10
14:46andrzejsliwathx for advice amalloy
14:46wei__so that's how you use reduced, thank
14:48TimMcgfredericks: Something like that yeah. *I* want that tool! :-P
14:49TimMc$mail xeqi nested params appears to be a ring thing -- how was it causing a problem with hiccup?
14:49lazybotMessage saved.
14:51arohnerI'm having trouble googling for the alan dipert gherkin video mentioned in the mal video. Any suggestions?
14:51gtrakarohner: it's in the lightning talks
14:52gtrakhttp://www.youtube.com/watch?v=bmHTFo2Rf2w
14:52arohnerty
14:56aaelonyanyone using Kovasb's session (https://github.com/kovasb/session/tree/master/src/cljs/session) ? It looks beautiful, but shift-enter isn't evaluating expressions for me...
14:57aaelonysorry, better link was : https://github.com/kovasb/session
15:06gfredericksTimMc: I've mitigated a small amount of the pain via my bg macro in my repl-utils
15:08futileAnyone here have experience embedding REPLy into a Clojure app?
15:12TimMcgfredericks: OWow does that help?
15:16TimMc*How
15:17DaReaper_Is there any working plugin for clojure development on NetBeans?
15:18DaReaper_or at least an editor?
15:20hfaafbthere's counterclockwise for eclipse
15:20hfaafbnightcode
15:20hfaafbemacs
15:20hfaafba few sublime text plugins
15:20hfaafblighttable
15:22yogthosalso cursive with intellij works pretty well
15:23Anderkentfutile: kind of. What's your issue?
15:23futileI'm trying to figure out how to change the namespace when you call reply.main/launch-nrepl directly from within Clojure.
15:23futileSo far I have this, but it fails: (launch-nrepl {:skip-default-init true :custom-init (in-ns 'billow.core)})
15:24amalloyfutile: you probably want to quote that custom-init form
15:24futileamalloy: I'll try that, although it looks like REPLy is pretty macro-heavy code. See https://github.com/trptcolin/reply/blob/master/src/clj/reply/conversions.clj
15:25futileamalloy: Yes, that worked perfectly.
15:25futileThank you both.
15:26Anderkentno prob, next time I recommend just asking your question immediately, amalloy could have probably helped you even before I got here :P
15:26futileYes, yes, very good ideas all around.
15:27futileNext time I will ask my question directly. Also I will try suggestions before doubting them.
15:27aaelonyquick update: shift-enter works for me in Chrome but not in Firefox...
15:29DaReaper_hfaafb: any for netbeans?>
15:35futileIt appears that if you use REPLy with another namespace like that, you no longer have access to (doc). How would you get access back?
15:35tpopeclojure.repl/doc
15:35tpope(use 'clojure.repl)
15:36futileAh yes, thank you.
15:46technomancyamalloy: afaict smartparens' main advantage is that it can work with multi-char delimiter sets
15:46technomancywhich is neat for html, but pointless for clojure
15:47dakronetechnomancy: well, useful for strings and maps in clojure
15:47amalloytechnomancy: might be useful if it supports #{...} and #(...), i guess
15:47technomancydakrone: hm; how so?
15:48dakronetechnomancy: ah nevermind, I forgot clojure-mode adds paredit support for "" and {}
15:48amalloydakrone: that's all in paredit, i'm pretty sure, not clojure mode
15:48dakronein-sexp highlighting is a nice feature smartparens has that paredit doesn't
15:48technomancystrings work for any lisp already
15:48amalloyin-sexp highlighting?
15:50dakroneamalloy: background highlighting the body of an expression the first time it's typed, it's difficult to explain :)
15:50amalloymmmm. so that's instead of bouncing the cursor/point?
15:50Blktwhat's the best way to handle configuration (files) in a Clojure webapp?
15:51technomancyso like show-paren-mode except for the body instead of just the delimiters?
15:51technomancyseems weird to tie that to smartparens instead of creating something orthogonal
15:51hyPiRionI'm fine with highlight-parentheses really.
15:51dakroneamalloy: technomancy: yes, except it's more "while-you-type-the-expression" than after the fact
15:51dakroneit is useful when typing JSON
15:52amalloytechnomancy: show-paren-mode will show the body if you ask
15:52technomancyoh, cool
15:52futileAh there is a clojure.test emacs plugin isn't there..
15:52technomancyooh, mixed. I like the sound of that
15:52technomancyfutile: yeah but it's kinda lame
15:59futileWould it be better to just get the clojure.test autorunner?
16:00technomancyit should be replaced with nrepl-discover
16:00futileAh.
16:01gtraktechnomancy: I thought it was funny/odd that bbatsov wanted to wait for nrepl-discover to mature..
16:01gtraksince there's few emacs-related nrepl projects besides cider.
16:01technomancygtrak: yeah, I don't really understand his project management style
16:01gtraklike.. not gonna mature unless we use it, dude.
16:05futileAll programming seems to be just finding new ways to call functions with arguments...
16:05technomancyfutile: except forth
16:06gtrakI just tried to explain my understanding of monads to a haskeller like that
16:06gtrakfancy parameter-passing
16:06futiletechnomancy: I call shenanigans.
16:06technomancygtrak: http://p.hagelb.org/mrfp.gif
16:06technomancyfutile: it's true
16:11eraserhdI'm having a weird bug that I can reproduce, but having trouble isolating small code that does it.
16:11tgoossensWhen I have a class with methods. If I change the representation of the object, my compiler tells me what methods don't work anymore. In clojure if i create function to work with a certain data structure and I change it, I don't automaticlly find what functions that must be changed.
16:11eraserhdIt seems to be about making a lazy list a key in a meta map in a macro, then accessing it at run time.
16:11eraserhdDoes this ring any bells?
16:13eraserhdOh, value. not key.
16:19devnwhoa. clojure/west talks are up already: http://www.youtube.com/watch?v=wVXjExRiFy0
16:20zerokarmaleftyea, somebody's cracking the whip in SF
16:20technomancydevn: there was an incredible amount of whining around this last year
16:20futileWhat are the great new ways to enhance our clojure.test experiences?
16:20klang.. there goes sleep tonight ..
16:21devntechnomancy: oh i remember! :)
16:27gtraklast year it was all Alex, now it's cognitect and friends
16:37jcromartieyeesh now I feel like my app is insecure?
16:37jcromartieI thought I had a pretty good handle on it :|
16:41amalloyeraserhd: metadata probably gets evaluated
16:50jcromartiehow often do you end up writing code that checks argument or return types?
16:51jcromartielike, :pre and :post maps, or asserts, or code that throws IllegalArgumentException?
16:51gtrakjcromartie: schema's been really nice for this
16:54tufttgoossens: true, but the flip side is that they can continue doing what they did before, as they aren't coupled to the type you changed.
16:55amalloyjcromartie: super rarely. i occasionally throw IAE; never use pre/post; and very rarely use assert
16:55tufttgoossens: .. and your tests should be able to provide the same checklist.
16:55hiredmanassertions and pre/post are great
16:56hiredmanI have only ever regretted not having them
16:56hiredman(not to say I use them a lot, I just regret not having them in places a lot)
16:56akurilinSo if I want to share a bunch of business logic pure functions across multiple projects, what should determine if the :source-paths approach is good enough or if I should go the separate .jar route?
16:57tuftanyone using schema in their project?
16:57futileI have been using preconditions for this utility I'm writing.
16:57hiredmannot having a custom message :pre/:post is a pain though
16:57AeroNotixtuft: schema?
16:58rasmustoAeroNotix: prismatic's thing for runtime type checking
16:58tuftAeroNotix: yes that ^^ =)
16:59tuftseems useful for when things get really nested
16:59AeroNotixoh ok
16:59tuft.. or when accepting input to the system from outside.
17:00futileWhat's a good way of pulling in data from a non-compile-time-loaded file?
17:00hiredmanthe cloud is a vast roiling sea where devops are prone to mad acts of maintaince and chatops, best not to assume anything
17:00jcromartiefutile: EDN/Clojure data?
17:00AeroNotixhiredman: chatops?
17:00rasmustofutile: slurp it from resources?
17:00futileMy users pass "my.config.namespace" which contains defs which may execute some code.
17:00futileAnd I need to access their defs.. and there's a lot of ways.
17:01jcromartiefutile: I'd say the right way to get at the vars in a namespace is ns-publics
17:01futileI could have them hook into a function of mine which redefs some defs I can access. Or I can have them (in-ns) into my namespace and do their defs, and I just access them at runtime.
17:01hiredman(for example changing the character encoding on a database in a way that some how twiddles the bits in your gzipped blobs)
17:01futilejcromartie: ah so the second one?
17:01jcromartiefutile: this sounds… weird
17:01jcromartie:-/
17:01futileAlternatively I could just make this file return a map that I def right into a def in my own namespace, and just use known keys.
17:02futileI'm going to great lengths to avoid the trouble of writing a leiningen plugin.
17:03futileI've used the map solution before to good effect.. very little runtime magic needed except (load the-file).
17:04futile(def my-map (load their-file)) ... (do-something-with (:some-key my-map))
17:04futileThat's simplest, I'll just do that.
17:08jcromartiefutile: why can't they just pass you data?
17:09jcromartieinstead of giving you something you'll turn around and load?
17:09jcromartieI don't know what you're building
17:10shep-homeDoes Mark Engelberg hang around here? Or anyone associated with instaparse?
17:11futilejcromartie: I'm building a lib that you install and then do `lein run -m mylib.main your-config-namespace`
17:11futilejcromartie: I control the entry-point of the lib, since it's a command-line util.
17:11futilejcromartie: Of course, that whole invocation will be hidden away in a lein-alias for good measure.
17:13akurilinshep-home: I don't remember seeing him on here but I had a really easy time getting hold of him on Instaparse's google groups
17:14akurilinguy's extremely reponsive and helpful
17:14shep-homeakurilin: thank you. I wanted to give that team a big thank you. They made this (https://github.com/shepmaster/clojure-ruby) fun to write
17:15futileWow.
17:18rasmustoshep-home: did you watch the clojure/west talk on instaparse?
17:19shep-homerasmusto: nope - is it worth watching?
17:20rasmustoYep: http://www.youtube.com/watch?v=b2AUW6psVcE
17:20rasmustoyou'll learn a bit more about the "team" :D
17:21shep-homerasmusto: excellent, thank you. I think I can find 40 minutes to watch this during funployment :-)
17:21rasmustoI found his mini-dive into the implementation to be really cool
17:21rasmustoit's all async + pseudo pubsub
17:22Anderkentit was nice, but I wish there was more info about why the algorithm is correct, it's not obvious (at least to me)
17:23rasmustoAnderkent: yeah, hence "mini-dive"
17:23rasmustoI don't mind the aabababa examples though, I'd get confused otherwise
17:23Anderkentyeah that was nice
17:28vermaanyone here uses lien-npm? can't get it to generate a package.json
17:30vermaos is it not persistent? in the sense that it would be removed when the task is done executing?
17:30vermaoh, it does remove it https://github.com/bodil/lein-npm/blob/master/src/leiningen/npm.clj#L74
17:35vermalein run seems to run my script, but its not generating package.json when running the file, I need it for node-webkit
17:46TravisDIs there a way to query how much memory is available in the JVM?
17:48justin_smith(.freeMemory (Runtime/getRuntime))
17:48znurglHow can you convince your boss about using Clojure in one sentence? (theoretical question)
17:49nightflyIt's new and cool
17:49justin_smithTravisD: depending what you mean by "how much memory is available" other methods may have better answers
17:49gtrakznurgl: 'it's a concurrency library'
17:50technomancyznurgl: "if I have to write any more java I'll quit."
17:50justin_smithTravisD: but you probably want the info returned by some method of (Runtime/getRuntime) http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html
17:50TravisDjustin_smith: Ah, I really just wanted to know how much space was reserved for the heap or something. I was running out of space and I was curious how much there is
17:50justin_smithmaxMemory is likely what you want
17:51TravisDah, yes, just saw it in the docs
17:51Averell"this will be more cost-effective than our current cobol code"
17:51justin_smith(.maxMemory (Runtime/getRuntime))
17:51TravisD,(.maxMemory (Runtime/getRuntime))
17:51clojurebot#<CompilerException java.lang.SecurityException: Reference To Runtime is not allowed, compiling:(NO_SOURCE_PATH:0:0)>
17:51justin_smithalso, you may want to compare that to the amount of mem currently allocated
17:51gtrakznurgl: 'we can't do feature x in a timely manner without it'
17:52sdegutisgtrak: boom got em
17:52TravisDjustin_smith: cool, thank s:)
17:55sdegutisdid I do that right?
17:56justin_smithsdegutis: http://www.urbandictionary.com/define.php?term=Got%20Em&amp;defid=1716329
17:56znurglI have another strange question. I've never used (def variable-name value) in Clojure. And I checked some project on GitHub and I can't find def, so is it a common thing in Clojure not using variables just dealing with data flow?
17:57gtrakdef's usually for constants
17:57gtrakor things that aren't functions, generally it's bad to hold state in a var
17:57justin_smithznurgl: well, technically defn is just a wrapper on def
17:57justin_smithdef + fn = defn
17:57znurgljustin_smith: sure, I know
17:58gtrakznurgl: you shouldn't call def within a function unless you know what you're doing
17:58znurglbut I did't use it for defining a variable
17:58cbpdef for global constants and also closures as i think a def inside a let is a little ugly :-P
17:58cbpa defn inside a let}
17:58cbp*
17:59bjathere's a letfn for that
17:59znurglso the good practice is stay away from def a variable as much as I can, isn't it?
18:00gtrakznurgl: def is to create a var, vars have their own semantics.
18:00cbpznurgl: no, you just wont use them much naturally
18:00gtrakhttp://clojure.org/vars
18:00sdegutisI am using vars like crazy today.
18:00cbpbja: but i want a closure in a var
18:00sdegutisSo many vars.
18:00cbpalso for holding stuff like atoms/refs/etc..
18:01gtraknot just a 'variable', to be precise it's a Var.
18:01sdegutisI even def a def within a def https://github.com/sdegutis/Billow/blob/master/src/billow/config.clj#L5-L7
18:01technomancyznurgl: clojure doesn't have variables
18:01gtrakclojure doesn't have local variables either, those are usually called bindings
18:01sdegutisTo be fair, there's like so little distinction.
18:02cbpsdegutis: i usually do that kind of thing with alter-var-root
18:02sdegutisI've found using Clojure to be nearly identical to using Ruby, except for the super-powers Clojure gives you.
18:02gtrakit's important to not use a term that means something in other languages :-)
18:02znurglthanks guys, I should check it again :-)
18:02sdegutiscbp: I wonder, what's the difference between the two approaches?
18:02sdegutis(def ...) vs (alter-var-root ...)
18:03technomancysdegutis: alter-var-root requires it to already exist
18:03gtrakcbp: well, for one, the var gets created at compile-time, alter-var-root won't do that.
18:03gtrakwhen your defn is eval'd the var gets created.
18:03cbpsdegutis: the namespace
18:03cbpAll sorts of scary business
18:03gtrakIt would probably cause concurrency problems to use def.
18:04gtrakpotentially.
18:04sdegutisI am doing so programming right now.
18:04technomancyso programming. much def. very excite.
18:04bjasdegutis, is that a doge thing?
18:05bjatechnomancy beat me to it
18:05sdegutisHmm, I didn't realize the connection but yeah, basically the style I was going for.
18:05sdegutisExcept a little less formal to the meme.
18:05sdegutisSo I have this really weird library/utility design..
18:05gtrak,(do (defn a [] (def b)) b)
18:05clojurebot#<Unbound Unbound: #'sandbox/b>
18:05gtraksee the problem?
18:06sdegutisYou put the ugly stuff into an alias, then run `lein billow`, and it shoves you into a REPL, and gives you access to a few commands like (list-servers), (create-server ...) etc
18:06gtrak,b
18:06clojurebot#<Unbound Unbound: #'sandbox/b>
18:06gtrak,c
18:06clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: c in this context, compiling:(NO_SOURCE_PATH:0:0)>
18:06pyrtsagtrak: It will probably cause concurrency problems to use alter-var-root as well.
18:06sdegutisIt's not conventional, but it gives you a little more flexibility and avoids lein-reloads when you wanna do multiple things in a row.
18:06pyrtsaJust a different kind of such.
18:07gtrakpyrtsa: I would imagine it wouldn't kill current bindings on the var, and the def would.
18:07cbpyou also cant require that function
18:07gtrakmaybe..
18:07cbpor you can do it with weird consequences..
18:07gtrakjust don't do it :-)
18:08gtrakaltervarRoot calls a method on the var, def might wholly replace it.
18:08gtraknot sure exactly when.
18:09gtrakalter-var-root notifies watches..
18:09cbp,(do (ns a) (defn f [] (def x 1)) (ns b) (require 'a) a/x)
18:09clojurebot#<Unbound Unbound: #'a/x>
18:09gtrakand takes a validator
18:09gtrakso that's one difference
18:09cbper i got a different result..
18:10cbpoh well
18:10pyrtsagtrak: If you alter-var-root a var while another thread is using it, its value will just suddenly be different, during the computation.
18:10amalloysdegutis: https://github.com/sdegutis/Billow/blob/master/src/billow/config.clj#L5-L7 shouldn't work at all
18:10gtrakpyrtsa: I don't believe it
18:10gtrakthat's only the case if that thread is using the root binding
18:11technomancy~tias
18:11clojurebotTry it and see! You'll get results faster than asking someone in #clojure to evaluate it for you, and you'll get that warm, fuzzy feeling of self-reliance.
18:11amalloyalter-var-root doesn't take a value, it takes a function and applies it to the old value
18:11gtrakhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Var.java#L188
18:11pyrtsagtrak: Easy to test: create two threads, one calling alter-var-root after a timeout, the other using that var repeatedly, sleeping in between.
18:11gtrakpyrtsa: bindings
18:11technomancyamalloy: the question is whether the root is replaced with a CAS or just a set
18:11gtrakknow what I mean?
18:11technomancyI don't think it's CAS
18:12gtraktechnomancy: i'm looking at it, it's a volatile
18:12amalloytechnomancy: that's the conversation y'all are having; i'm making a different point which is that sdegutis's use of alter-var-root is bogus regardless of your discussion
18:12technomancyoh, gotcha
18:12sdegutisamalloy: how so?
18:12amalloyand it's not CAS
18:13amalloy(03:08:22 PM) amalloy: alter-var-root doesn't take a value, it takes a function and applies it to the old value
18:13sdegutisOops.
18:13pyrtsagtrak: Sorry, I think I'm missing the point. Can you educate me? (In private if considered noise here.)
18:13cbpOh he updated it
18:13sdegutisFixed.
18:13cbpthe speed rivals dnolen's
18:14sdegutishttps://github.com/sdegutis/Billow/blob/master/src/billow/config.clj#L5-L7
18:14gtrakah, sure. your example is correct, but that's not the point. vars support a thread-local stack of bindings. if there's something bound, then the change to root wouldn't matter on that thread.
18:14gtrakpyrtsa: ^
18:14cbpI got confused for a second (he's not using alter-var-root at all!)
18:14pyrtsagtrak: Okay, cool. Now we agree.
18:15sdegutisThanks amalloy :)
18:15sdegutisamalloy: here's a pie to show my gratitute: \_/
18:15amalloyhah
18:15sdegutisNo wait sorry that's an upside-down lampshade.
18:16sdegutisHere's the pie: ___
18:17stcredzerosdegutis: \_/ looks like a standard grey alien glaring at you. Or the victory gesture guy beheaded \o/
18:18sdegutisquite
18:19stcredzeroActually, they are one and the same. (Now go off and read all of Grant Morrison's Doom Patrol)
18:21sdegutis~guards
18:21clojurebotSEIZE HIM!
18:21stcredzeroWho me?
18:23sdegutisHey clojurebot said it not me
18:24sdegutisI am not good at designing APIs and I get really tired out easily from it which wears down my concentration and I end up in here saying ~guards...
18:24stcredzeroWhy would you sic the guards on me?
18:24shalicke~gourds
18:24clojurebotSQUEEZE HIM!
18:24stcredzero~gads
18:24clojurebotPardon?
18:24sdegutisshalicke: one of the few times I can literally say LOL
18:24stcredzero~girds
18:24clojurebotexcusez-moi
18:24stcredzero~gauds
18:24clojurebotTitim gan éirí ort.
18:25technomancy~praetorian guards
18:25clojurebotCAESE HIM!!!
18:25amalloyniiiice
18:25shalicke(inc technomancy)
18:25lazybot⇒ 102
18:25sdegutis(dec technomancy)
18:25lazybot⇒ 101
18:25technomancycan't take the credit; stole it from #emacs
18:25sdegutisJust tryin to balance things out
18:25stcredzeroSo this is the Lispy version of Hogwarts?
18:25sdegutis(inc sdegutis)
18:25lazybotYou can't adjust your own karma.
18:25sdegutis:(
18:25AeroNotix(inc sdegutis)
18:25lazybot⇒ 6
18:25AeroNotixspread the love
18:25sdegutis(inc shalicke)
18:25lazybot⇒ 1
18:26sdegutis(inc stcredzero)
18:26lazybot⇒ 1
18:26technomancy(dec slytherin)
18:26lazybot⇒ -1
18:26AeroNotix,(prn AeroNotix)
18:26clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: AeroNotix in this context, compiling:(NO_SOURCE_PATH:0:0)>
18:26sdegutisok $karma has got to go
18:26technomancystcredzero: basically, yeah
18:26stcredzerostcredzero gets love? What did y'all do with the *real* clojure community?
18:26sdegutisNobody wants #clojure to turn into a popularity contest, and also I have a way low $karma.
18:26rasmusto~clojure
18:26clojurebotclojure is the king of the Sinatra-esque all-in-one-file webapp.
18:27stcredzeroLies!
18:27stcredzero~Lies!
18:27clojurebotPardon?
18:27stcredzeroClojurebot has the makings of a politician!
18:28winkI disagree with clojurebot's penultimate statement though
18:28stcredzero(pr-src stcredzero)
18:28winkbecause, just today, I wrote a sinatra app
18:28winkand because of a certain gem it would have taken me ages (probably) in clojure
18:29stcredzerowink: a good and big community counts for a lot
18:29winkplus I don't even want to think about inline templates in my clojure code :P
18:29sdegutiswink: what gem, you?
18:30winksdegutis: github-flavored markdown :P
18:30sdegutiswink: re: templates, looked at hiccup?
18:30winksdegutis: yeah, used it for a while, but that's not really like sinatra inline templates. not worse, but definitely different
18:31sdegutisRight, Clojure definitely needs to be used differently than Sinatra.
18:31sdegutisHmm yeah, we're missing a GFM lib..
18:31sdegutisI've been using github.com/yogthos/markdown-clj
18:31winkI would have never thought I'd "defend" ruby against clojure. ever
18:31winkbut in this case, as github is a ruby shop, anything else makes less sense
18:32sdegutiswink: Great, because in this channel, we admit and confess that Clojure is the best language.
18:32stcredzerowink: wish to accept the truth
18:32winkas I am *exactly* rendering github wiki links
18:32winks,links,pages,
18:32sdegutiswink: In #haskell though we know for a *fact* that Haskell is better than Clojure.
18:32sdegutiswink: Granted, in #ruby-lang we know that Ruby is actually the best.
18:32stcredzerosdegutis: In this channel, I hope that we also realize: best language != best environment
18:32brehautyou are all wrong. idris is the future
18:32technomancygfm from jruby. boom.
18:32winksdegutis: see, in the php channels I am no one even claims it's the best language. we just get shit done :P
18:32sdegutisstcredzero: chruby + bundler ftw
18:33technomancywink: same with elisp =)
18:33brehautwink: emphasis on the shit ;)
18:33stcredzerochruby? I would be disturbed by programmers telling me they have a chruby for me
18:33sdegutiswink: that's because PHP is the best language, no need to tout it.
18:33sdegutistechnomancy: yeah, elisp is so simple..
18:34technomancy...yet powerful
18:34sdegutis(dinc technomancy)
18:34sdegutisaww not a real thing
18:34stcredzero"double income no closures"
18:34brehautdouble income no cat?
18:34winkI'm allergic to income
18:34winkno, wait
18:34stcredzero~scheme
18:34winkI'm allergic to cats
18:34clojurebotscheme is Scheme is like a ball of snow. You can add any amount of snow to it and it still looks like snow. Moreover, snow is cleaner than mud.
18:35stcredzero~Haskell
18:35clojurebotIt's greek to me.
18:35stcredzero~Lua
18:35clojurebotPardon?
18:35wink~curry
18:35clojurebotExcuse me?
18:35stcredzero~coc
18:35clojurebotI don't understand.
18:35winkclojurebot: Lua is awesome
18:35clojurebotOk.
18:35stcredzero~coq
18:35clojurebotCool story bro.
18:36sdegutisstcredzero: boom got em
18:36sdegutis~Lua
18:36clojurebotLua is awesome
18:36stcredzerosdegutis: boom?
18:36brehautgfredericks has some work to do apparently
18:36winkI was literally bursing out laughing when someone recently mentioned a problem with coq and the solution was "you forgot Qed. in the end"
18:36sdegutisstcredzero: yes.
18:36stcredzerosdegutis: yes?
18:36sdegutisright
18:37stcredzero~greek
18:37clojurebotgreek is it to me
18:37stcredzero~me
18:37clojurebotIt's greek to me.
18:37winkstop breaking it
18:37winkits feeble mind has suffered enough
18:37stcredzero~Smalltalk
18:37clojurebotIt's greek to me.
18:38sdegutisI cannot take it.
18:38hiredmanI really should put a throttle in the bot so it automatically will ignore people when they excessively do this kind of thing
18:38hons~scala
18:38clojurebotScala often gets in the way when trying to write neat code -- seen in #scala
18:38stcredzerohiredman: sorry, I just got curious
18:39hons~java
18:39clojurebot
18:39hons;)
18:39winkthat entry should've been more verbose
18:40stcredzeroTrue story: Smalltalker is told by boss he should change to Java. So he changes all the app icons to coffee cups and gets to code in Smalltalk for an additional 6 months. Later, he came to work for the Smalltalk vendor. (Where I was working)
18:41technomancystcredzero: I am in awe.
18:41stcredzeroVasilly is awesome, actually. I should steal some of his ideas and rewrite them as pure functional versions
18:50stcredzero~monads
18:50clojurebotmonads are |monads|
18:50metellus~|monads|
18:50clojurebot|monads| is endofunctors
18:50rasmusto~burrito
18:50clojurebotExcuse me?
18:51stcredzero~lolcode
18:51clojurebotNo entiendo
18:54brehautstcredzero: i am disappointed that that story does not fit in 140 characters
18:54brehautwell, 137
18:54stcredzerobrehaut: And I am not bothered at all.
18:57stcredzerobrehaut: TrueStory: Boss tells Smalltalker: Switch 2 Java. Smalltalker changes icons to coffeecups and codes in Smalltalk for 6 more months.
18:58brehautstcredzero: haha thanks :)
18:59gfredericksa burrito is just a burroita in the menu of endofajitas
18:59justin_smith"This man's boss wanted him to switch from Smalltalk to Java. What he did next will restore your faith in humanity"
18:59rasmustogfredericks: haha
18:59brehautgfredericks: ftw
18:59justin_smith(inc gfredericks)
18:59lazybot⇒ 43
18:59gfredericksthat's the third time I've used that joke in 24 hours
18:59rasmusto(inc gfredericks)
18:59lazybot⇒ 44
18:59zspencer(inc justin_smith)
18:59lazybot⇒ 30
19:00gfredericksTimMc: it helps for easily putting giant results in vars without accidentally printing them
19:01BbarrettI am trying to move files from one directory into another, should I utilize Java's .move method in this case, or is there a better way to do with a built in Clojure library
19:01SegFaultAX(inc gfredericks)
19:01lazybot⇒ 45
19:01winkjustin_smith: you got a day job at gawker?
19:02sdegutisI am about to use lazy-infinite-sequences to solve a problem.
19:03brehautthats lucky, because strict-infinite-sequences are problematic in practise
19:03stcredzeroIncidentally: The Smalltalker's name is Vasilly Bykov, IIRC
19:03amalloyBbarrett: if a java method does what you want, use it
19:03TEttingerBbarrett: I'd personally avoid additional dependencies and just use the .move , it's always available
19:03amalloybrehaut: it's fine as long as you have infinite time
19:03winksdegutis: "I'll procrastinate the problem away" is what you meant?
19:03Bbarrettthanks
19:03amalloyand space
19:03brehautamalloy: problematic, not impossible
19:03BbarrettI kind of thought that might be the best path to take
19:03winkamalloy: if space is the final frontier, how can it be infinite?
19:03cbpBbarrett: it's likely that the clojure library calls that method anyway
19:03justin_smithwink: we use clojure to make optimized lazy headlines (no, I don't work at gawker, but those link bait headlines are too easy to mock)
19:03hiredmanTEttinger: it is in fact only always available since 1.7
19:03winkjustin_smith: :P
19:04TEttingerhiredman: agh
19:04Bbarrettthanks for the input!
19:04Bbarretthope everyone is having a kiler day or evening
19:04stcredzeroAs far as we know, all of us reappear an infinite number of times in the cold, empty void past the heat-death of the universe as Boltzmann brains
19:05SegFaultAXThis channel just got a lot more meta.
19:05TEttingerstcredzero: it's great being a brain in space. free IRC
19:06SegFaultAXTEttinger: For some reason your movie reminded me of the soul-crushing sadness of Her. Did you see that movie?
19:06sdegutisI just did it!! https://github.com/sdegutis/Billow/blob/master/src/billow/service.clj#L14-L19
19:06gfredericksall of us reappear an infinite number of times in universes that are entirely identical to ours except that the moon landing was a hoax
19:06TEttingerI had a movie?
19:06SegFaultAXTEttinger: Wow, I accidentally some words there.
19:06sdegutisI used lazy infinite sequences to come up with a uniquely numbered name!
19:06SegFaultAXTEttinger: Your comment reminded me*
19:07stcredzeroThis sentence no verb!
19:07TEttingerI was confused for a bit. no I have not seen Her
19:07brehautgfredericks: in some of those existances cabbage trees are true
19:07socksyugh i'm getting java.lang.OutOfMemoryError, but i have no idea which part of my code is producing it. Any tips for debugging?
19:07AeroNotixuh, with (time) is there something which'll give me the time as a value *and* the value of the expression I am evaluating?
19:07rasmustosocksy: jvisualvm?
19:08AeroNotixsocksy: visualvn
19:08AeroNotixvisualvm
19:08hiredmansee where your code is allocating lots of memory and stop doing that
19:08gfredericksAeroNotix: I have this bg macro that is awesome for that
19:08gfredericksAeroNotix: oh wait no
19:08gfredericksI did not read that carefully
19:08gfredericksI've needed that a lot too and keep re-writing it
19:08AeroNotixgfredericks: I want to make a "r u there db" call and time it, as a statistics healthpoint
19:08winkreading the last 15minutes makes me wonder if I am drunk or some of you are.
19:09AeroNotixwink: I am
19:09AeroNotixalways.
19:09rasmustosome-> people are
19:09hiredmana profile is great, but just a read through the code should give you a good idea at what is using all the memory
19:09cbpI am just dum
19:09hiredmanprofiler
19:09gfredericks(defmacro t [& body] `(let [b# (System/currentTimeMillis) ret# (do ~@body)] [ret# (- (System/currentTimeMillis) b#)]))
19:09amalloyAeroNotix: i remember seeing something called with-timing, but i forget where
19:09TEttingersocksy: I've gotten that in interesting places before, that error.
19:09gfredericksAeroNotix: ^there I wrote it again
19:10AeroNotixgfredericks: cool, ok. So I'll need to write something for this. No worries. I thought there might be something in the standard library for it
19:10socksygoing to check out visualvm, cheers
19:10AeroNotixgfredericks: or maybe there's a secret cheat mode for (time) where it binds some variable or w/e
19:10stcredzerosocksy: you going to run that on OS X?
19:10amalloyin one of ztellman's libraries, i think
19:10socksythe annoying thing about it is that it's an array that reaches the VM limit, but I'm not explictly creating any arrays
19:10hiredmanthe thing with oomes is they occur when you don't have enough memory to satisfy some request, which doesn't tell you about where all the memory is being used
19:11socksystcredzero: arch linux
19:11stcredzerosocksy: this is fortunate
19:11TEttingersocksy, I'm currently struggling with an odd issue with OpenJDK on windows giving that (or maybe something similar) on startup if more than half the RAM on the system is used
19:11socksyinteresting
19:12TEttingerbut mine's on startup of the JDK
19:12socksy(I've increased the heap size, so it's not a heap memory issue, rather, an issue with array sizes, given they're indexed by ints)
19:12winkTEttinger: there is openjdk for windows? oh, wow.
19:13hiredmansocksy: just because you get an oome while doing something with an array, that doesn't mean the memory is all being consumed there, it just means that is where the vm noticed it didn't have enough
19:13TEttingerwink, yeah it's the only full JVM that you're legally allowed to resdistribute modified versions of.
19:13hiredmanare you holding on to the head of large sequences
19:14socksyhiredman: agreed, but it's specifically an out of memory error regarding the array size limit
19:14winkTEttinger: interesting. the thought never crossed my mind actually, as I always had Sun/Oracle JDK on windows anyway.
19:15hiredmansocksy: seems unlike that would be an oome, do you have a gist of the stacktrace?
19:15TEttingerwink, yeah especially starting with JDK 8 there's a hefty advantage to modifying it. the JRE is something like 100 MB unaltered.
19:15winkTEttinger: you mean the download? I've never had to distribute it
19:16TEttingeractually JDK 8 is even larger, but the part you would distribute is (IIRC) 118 MB
19:16TEttingerI've been looking into distributing full JREs as a way of avoiding java installation/update hassles
19:17socksyhiredman: gimme a few minutes to rerun and run out of memory, but it's just the one liner "java.lang.OutOfMemoryError: Requested array size exceeds VM limit", from calling a function in the repl (no stacktrace :\)
19:17red00how can i interact with clojurebot?
19:17hiredmansocksy: (require 'clojure.stacktrace) (print-stack-trace *e)
19:17justin_smith,:red00
19:17clojurebot:red00
19:17red00thanks
19:18justin_smithnp
19:18rasmustored00: you can /msg clojurebot too
19:18socksyhiredman: fantastic
19:18hiredmansocksy: assuming you are using nrepl/cider for whatever annoying reason they decided to default to not displaying stacktraces
19:18hiredmansocksy: there is something setting you can toggle to get it to pop up the stracktrace, but I forget what it is
19:19justin_smithalso there is also clojure.repl/pst
19:19Averelltoggle-debug-on-error
19:19justin_smithAverell: that is for emacs errors
19:19justin_smithnot jvm ones
19:19Averelloh. i didn't read close enough
19:19hiredmanterrible defaults everywhere
19:20hiredmanpeople thing the stacktraces are ugly, so lets hide them, so now you can't figure out what broke
19:23socksyugh, obviously too sleep deprived because I knew about the stacktrace issue before and forgot to enable it this time. Running the program again...
19:26socksyaha, it's a stringbuilder
19:28arohnerhiredman: that's why I don't upgrade emacs libraries :-)
19:28arohnerthat, and I never remember how
19:29socksyhttps://gist.github.com/socksy/9796104
19:29brehautarohner: step one, find a goat…
19:29rasmustoM-x package-destroy-sanity
19:29murphy_haha
19:29justin_smith(inc rasmusto)
19:29lazybot⇒ 4
19:29rasmustoI just upgrade to cider, seems okay so far :p
19:29justin_smithyou'd think emacs people could make a better package management thing
19:30justin_smithfrom nrepl? did you just purge nrepl first?
19:30AeroNotixwhen will people learn to put their emacs config into vcs
19:30rasmustoI think I deleted ~/.emacs.d/elpa and changed around init.el to have cider in it
19:30murphy_probably never would be my guess ??
19:30lazybotmurphy_: Uh, no. Why would you even ask?
19:30rasmustothen re-ran everything
19:30amalloyarohner, hiredman: slime/swank for life? are we in that club?
19:31hiredmanno, I am using cider :/
19:31rasmustoI'm a big fan of pathogen + git-submodule
19:31rasmusto(sorry emacs ppl)
19:31justin_smithAeroNotix: how would I track my package state? is there a single file for that? Would I need to check in all my elc files?
19:31hiredmanrasmusto: git subtree is way better
19:31hiredmansubmodule is terrible
19:31socksynow this is during a function which is updating an agent map, which admittedly has strings in it, but each string should only be a few characters. I am wondering if it's actually having the error from the repl trying to print out the map
19:31arohneramalloy: I'm on some version of nrepl, but I was definitely the last person in my company to switch from slime
19:32rasmustohiredman: does it actually let you look at the contents of the "modules/trees"?
19:32rasmustoinstead of just dumping a sha into /.git
19:32hiredmansocksy: yes, it is just the repl printing
19:32amalloy; SLIME 20100404
19:32amalloy<3
19:32socksyso this time when I've been thinking it's been running out of memory, it hasn't really
19:33hiredmanrasmusto: http://makingsoftware.wordpress.com/2013/02/16/using-git-subtrees-for-repository-separation/
19:33amalloysocksy: you are trying to print something which is the size of a small country
19:33hiredmanrasmusto: you never have to submodule init or anything
19:34hiredmanwhen you do a git checkout, it is all there
19:35rasmustoso are the master sha1s derived from all of the content of local files and the subtrees?
19:35hiredmanrasmusto: I believe so
19:35rasmustohiredman: can I do a git subtree fetch --prefix blah/foo ?
19:36hiredmanI have no idea
19:36rasmustohiredman: I'll have to try it out, submodules fit the need of dotfiles, but subtrees sound better overall
19:36sdegutisAh, my test almost passed, but then I realized I need a really dynamic fake-service that stubs some remote calls and mocks others.
19:37stcredzeroAm I correct in thinking that cons is O(1)?
19:37hiredmanI still have a few emacs packages in my emacs as submodules but I have been converting to subtree
19:37sdegutisstcredzero: looks like it to me
19:37sdegutishiredman: I have been just vendoring them from elpa, seems to work great so far
19:37rasmustohiredman: can you do a git subtree foreach git pull? (not that it's safe)
19:37AeroNotixjustin_smith: I just check in .emacs and .emacs.d/
19:37sdegutishiredman: see https://github.com/sdegutis/dotfiles/tree/master/home/.emacs.d/elpa
19:38sdegutispackage.el takes care of all the grunt work for me
19:38AeroNotixjustin_smith: and yeah, there's a file which tracks what's installed.
19:39hiredmanno
19:39hiredmanbut the whole reason I stick emacs packages in git is I found something I like and I don't want to change it
19:42sdegutistechnomancy: honestly it's not elisp that's frustrating, it's the emacs api
19:42sdegutistechnomancy: it's probably just inherent in the problem space.. you've got so many different parts that need to work together, and they're mostly codependent
19:42justin_smithwait, elisp is somehow distinct from the emacs api?
19:42sdegutisI think defcustom vs defvar vs defadvice vs vs setq vs setq-default etc etc is a good example
19:44socksyok, going to call it a night. Thanks for all the help, everyone
19:44sdegutisjustin_smith: yessir
19:44sdegutissocksy: any time
19:48sdegutisIt fricken worked.
19:54sdegutisAlso I really don't like these tests.. but I don't know a better way: https://github.com/sdegutis/Billow/blob/master/test/billow/service_test.clj
19:54sdegutisAny suggestions?
19:54sdegutisThey're just so.. crappy overall.
19:55justin_smithresponses and testing-configs could easily go in a separate file / namespace
19:55amalloysdegutis: what is spec buying you over like clojure.test there?
19:55amalloyyou just have a bunch of assertions
19:55sdegutisamalloy: I couldn't find a test-autorunner for clojure.test
19:57technomancysdegutis: defadvice has nothing to do with the others
19:57technomancyI agree that defcustom is silly though
19:57technomancydefvar is just defonce; that's kind of important
19:57amalloytechnomancy: whaaaaat. defcustom is great
19:57sdegutistechnomancy: right, it's for hooks, and rms says non-users shouldn't even use them
19:58technomancyamalloy: the customize UI is pretty cringeworthy though
19:58justin_smithtechnomancy: defcustom is kind of like "view level" - it's telling emacs how to make a friendly interactive config wizard for your lib
19:58technomancyit seems like a lame attempt to make it so people can use emacs without writing elisp
19:58technomancylike the toolbar
19:58amalloytechnomancy: i mean, it's not great, but getting a color-chooser widget is so much nicer than having to guess what all available colors are named
19:58amalloyor a font-style widget, etc
19:59amalloyand feedback like "dude that's not the type that this variable expects" the moment you set it, instead of next time you reload your .emacs
19:59sdegutisamalloy: What's the motivation to use defcustom when someone isn't using customize-ui?
19:59amalloysdegutis: there is none
19:59amalloyafaik
19:59sdegutishyPiRion: thx
19:59amalloybut i use the customize ui
19:59technomancyamalloy: hm; I've never seen it used for either of those things
19:59sdegutisamalloy: ah
20:00justin_smithI find browsing a customize buffer gets me the option I need faster than reading docs does, and is more likely to be accurate to my version than googling
20:00technomancyunless you count M-x customize-face, which doesn't actually use defcustom
20:00amalloyokay, maybe i was counting customize-face
20:00sdegutisamalloy: I've used customize-themes just because it's the quickest way to try out new themes while disabling old ones, but I'd prefer a UI more like magit and less like windows-95
20:00amalloybut eg, you can specify :type int, and then the user can't enter strings
20:00sdegutissorry, windows-3.1
20:01sdegutisMagit is just wicked awesome.
20:09sdegutisyessss, it works so really.
20:14sdegutishyPiRion: hmm good idea
20:14sdegutisamalloy: do you know of a good test-autorunner for clojure.test?
20:15amalloy$ watch lein test
20:15sdegutisThat seems maybe not the best?
20:16sdegutisThought I remembered two ones that started existing.
20:17amalloydefinitely not best. but i don't really care about autotest, and if i did i'm not sure what a lein plugin would do that's better than just running tests constantly
20:17bob2I think midje's auto run thing can run c.t tests?
20:18technomancysdegutis: the in-emacs stuff is fine
20:18technomancyI just think we can do better
20:18sdegutisnot while network effect is a thing
20:19technomancyclojure-test-mode is probably the most widely-used monkeypatch in the whole clojure ecosystem
20:19technomancywell, no, that would be lein test. it's the oldest extant monkeypatch.
20:20jasonjcknso happy I went to clojure/west
20:22jasonjcknI think i'll register with clojure/conj now
20:24hiredmanthe conj tends to come together at the last minute, so you can't register until a few months before hand, and last time I think they sold out before they even announced who was speaking
20:24sdegutisOh hey, clojure-test-mode is nice.
20:25sdegutisOkay, so let's say someone wanted to help out and make clojure-test-mode not so monkey-patchy, and has a few spare hours.. what would need to be done?
20:25technomancysdegutis: steal rich's SSH key so clojure.test itself can be fixed
20:25sdegutisCan it not be just forked?
20:26sdegutis(his ssh key)
20:26sdegutis(I mean clojure.test)
20:27technomancynrepl-discover actually does the same monkeypatch https://github.com/technomancy/nrepl-discover/blob/master/src/nrepl/discover/samples.clj#L38
20:27technomancysdegutis: sorry, being a smartass
20:27technomancythe actual thing that's missing is just more detail about where the failure occurred
20:28bob2is it a backwards incompatible change?
20:30technomancyI don't think so
20:31technomancyin this case we're storing results on the vars where the failures occured
20:31technomancyseems unlikely that would break anything except code that was already doing that monkeypatch
20:33sdegutisWhy didn't someone just submit a pull request fixing it for Clojure 1.6?
20:38sdegutisHow do you assert that nothing is thrown in clojure.test?
20:38technomancydeftest
20:38technomancyor just is
20:41sdegutiswoot thx
20:41sdegutis<3
20:48chareso what do you guys think of this https://hackworth.be/2014/03/26/clojure-web-security-is-worse-than-you-think/
20:49brehautchare: the article is a bit wacky but the presentation is really good
20:49chareso you're saying clojure is broken in security for web?
20:49brehautim not sure where the author got “Building secure Clojure web applications needs to be easier, and requires integrated security frameworks - not standalone libraries!” from
20:50brehautchare: not at all. but it needs more work
20:50chareso does that mean i should stick with ruby on rails?
20:50brehautchare: you need to decide that for yourself
20:50charebrehaut i'm going to assume you're a security expert so i need advice
20:51brehautchare: assuming random people on the internet are security experts is probably a poor starting position ;)
20:51charebrehaut you admitting you don't know anything?
20:51brehautno
20:53btbngrcider-repl gives me nice argument hints in the minibuffer within the repl, but is just not doing anything so nice inside my .clj files, is there a way to improve that?
20:53btbngrcider* not cider-repl.
20:54scottjbtbngr: maybe eldoc-mode? (I haven't used cider, not sure if it uses eldoc-mode for that)
20:55btbngrnope, not as is anyway. hey ho. thanks anyhow.
20:56scottjjust confirmed nrepl.el uses eldoc-mode for that, so you might want to doublecheck
20:58btbngrhmm, okay, sounds like i need to investigate my configuration. ta.
20:58akhudekchare: there is no "inherent" problem with clojure prevent one from building a secure app. If you really care about security, you should not be relying on your framework to keep you safe anyways. That's not an argument against secure defaults of course, but rather one that suggests that every web developer should learn about security vulnerabilities anyways.
20:59rhg135I'm trying to convert https://www.refheap.com/66390 to tail-recursion or a loop but i'm completely lost. any ideas?
21:01amalloyrhg135: you can't recurse multiple times in constant space. you have to either use up some stack, or manage a stack/queue yourself as data
21:02rhg135amalloy, i only see 1 recursion there though
21:02amalloyrhg135: you're mapping
21:02amalloythat's "the same as" [(f x) (f y) (f z)]
21:02rhg135i see
21:02rhg135hmm
21:03btbngrscottj: aha, found (cider-turn-on-eldoc-mode) in cider-eldoc.el, thanks, that was the clue I needed.
21:03rhg135then cps conversion?
21:03amalloy*shrug* sure, if you want, although loop/recur with a local "todo" stack will probably be easier
21:04rhg135oh duh
21:04amalloyand clojure doesn't optimize tail calls anyway, so you'd have to transform the cps into a trampoline
21:04amalloyotoh, if this blows your stack, you're building a *really* deep map
21:04amalloywhich might later blow your stack anyway, when you try to work with it, even if you avoid doing so while building it
21:06charewhy does lein run take like 5 seconds to run a hello world program?
21:16pjstadigJVM
21:16jcromartieno, Clojure
21:17amalloyyeah, it's clojure for sure, not jvm
21:18jcromartiehttps://gist.github.com/anonymous/e3566f573eb7f7fd6bb5
21:19jcromartieJVM is fast now. Welcome to 2009.
21:19vermawhat is the general strategy for testing a lein plugin?
21:23vermaok, found this: https://github.com/technomancy/leiningen/blob/master/doc/PLUGINS.md
21:23jcromartieyou can test your core plugin function like any other
21:24brehautpython is slower than the jvm on my machine which is pretty funny
21:24hyPiRionverma: I generally just think really hard before I deploy it. And I usually do it when I'm not tired.
21:24hyPiRionIt's not your standard unit testing technique, but it's a supplement I guess
21:25hyPiRion=)
21:32stcredzerowhat's the fastest way to flatten sequences, if you don't give a __ about ordering?
21:34hyPiRion~flatten
21:34clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
21:35hyPiRionafaik, removing the ordering wouldn't help at all
21:35stcredzeroI'm using sequences aggregate a sequence of collections from pmap, and I really do want something completely flat.
21:36hyPiRionstcredzero: so essentially a list of lists? Then (apply concat (pmap ...)) should be sufficient
21:37stcredzeroTo put it another way, what's the fastest way to collect stuff coming out of functions sent to pmap as one collection?
21:37hyPiRionOr, if you want to be fancy, you can use an atom, set up your own threadpool, and make each process do (swap! atm concat my-results)
21:38arrdemmanually managed threadpools ++
21:38stcredzeroI'm actually not using pmap. I wrote my own pmap like thing using futures that blocks until everyone is finished. I think I'd rather not manage threadpools.
21:39jcromartiestcredzero: how about a set?
21:40stcredzeroWill just mapping futures mess things up? What thread pool are those coming out of? How big?
21:40hyPiRionjcromartie: will remove duplicates, which is not exactly the same as unordered?
21:40jcromartiedon't forget about laziness
21:40jcromartiehyPiRion: depends on what he wants
21:40stcredzerojcromartie: set might work. I'm tempted to use swap! and cons. I'm using mapv and doall to get rid of laziness in this case
21:41jcromartieOK so, pmap produces a seq of seqs?
21:41jcromartieand you want a single collection of the values of that inner seq?
21:41stcredzerojcromartie: yes, it would produce a seq of seqs if I just pumped it through pmap
21:42stcredzerojcromartie: and yes, I just want what would be the flattened seq
21:43jcromartiewhat about… (reduce into #{} (pmap whatever coll))
21:43hyPiRionstcredzero: (let [atm (atom [])] (mapv deref (mapv #(future (swap! atm into (list-of-elements))) unprocessed-data)) @atm) sounds sorta what you'd like
21:43hyPiRionbut I'm not sure it's very nice wrt. threading
21:44stcredzeronot nice wrt threading is bad.
21:45jcromartiedefine "nice"
21:45jcromartienice as in: well-behaved? or nice as in: using as many cores as fully as possible?
21:45hyPiRionstcredzero: I mean, pmap is already bad. Perhaps https://github.com/TheClimateCorporation/claypoole would help you here
21:45stcredzerohyPiRion: yes, so I've heard, so I'm not using pmap.
21:46hyPiRionstcredzero: so well, the solution I presented delegates all its work to the future threadpool. It's hard to control, but perhaps that's suitable for your type of work
21:47hyPiRion*harder
21:47jcromartiepmap uses futures
21:48stcredzerohyPiRion: how big is the future threadpool? (+ (count cores) 2)?
21:48arrdemstcredzero: I think it's bigger than that...
21:49jcromartielook
21:49jcromartieon my 4-core machine, (reduce into #{} (pmap f coll)) is 4X faster than with map
21:49jcromartieI think that's what you want
21:50jcromartie(for a long running op where threading overhead is negligible)
21:50stcredzerojcromartie: however, this is for cpu bound things which are still short. (Will be firing off many times per second.)
21:51jcromartiejust test it
21:51stcredzeroclaypoole looks very interesting
21:52hyPiRionstcredzero: to answer your question, the future threadpool uses the same threadpool as the agent threadpool. That one grows without any bound, but will reuse threads which are done with their work.
21:54stcredzerohyPiRion: so I think this means that I should keep claypoole in mind, but just use my mapv-futures-thing until I see an issue.
21:54arrdemunbounded threadpools are suckage.
21:54jcromartieare you positive that your mapv-futures-thing is any better than pmap?
21:55hyPiRionjcromartie: pmap is horrible if you have some large spikes in working time here and there. Try to check out how fast (pmap #(Thread/sleep %) (concat [1000] (repeat 0 (+ 2 (.. Runtime getRuntime availableProcessors))) [1000])) is
21:55stcredzerojcromartie: in that I don't want lazy evaluation for this part, yes.
21:55hyPiRionwhoops, flip order of the arguments in repeat
21:56jcromartiereduce forces the evaluation
21:56jcromartiebut I'm just saying, if you're using futures
21:56jcromartiepmap uses futures
21:58stcredzeroclaypoole looks very attractive. I'm using this for a parallelized game loop, so lazy evaluation is actually dangerous. Also, I can just keep the thread pool sized (+ cores 2) and keep it around for the game loop to use.
22:00hyPiRionjcromartie: The issue is that a slow task will block calls later in the list. E.g. if I have a dual core processor, then the 4th task after any task sent off will not be executed before that task is completed
22:02arrdemstcredzero: for that application probably what you'll wind up doing is just spinning off N threads and using atoms to implement message queues. Unless your drawing engine is single threaded and you need to coalate all the drawing results rather than splatting them directly "out".
22:02jcromartie,(time (doall (pmap #(Thread/sleep %) [1000 0 0 0 0 0 0 0 0 0 0 0 0 0 1000 0])))
22:02clojurebot#<SecurityException java.lang.SecurityException: no threads please>
22:02jcromartiewell anyway, for me, it was 1s
22:03stcredzeroarrdem: it's a multiplayer game. It doesn't "draw" so much as send maps over websockets
22:04hyPiRion&(Thread/sleep 1000)
22:04lazybot⇒ nil
22:05hyPiRion(time (doall (pmap #(Thread/sleep %) (concat [1000] (repeat (+ 2 (.. Runtime getRuntime availableProcessors)) 0) [1000]))))
22:05hyPiRion&(time (doall (pmap #(Thread/sleep %) (concat [1000] (repeat (+ 2 (.. Runtime getRuntime availableProcessors)) 0) [1000]))))
22:05lazybotjava.lang.SecurityException: You tripped the alarm! pmap is bad!
22:05hyPiRionoh, but Thread/sleep is fine? lazybot, I don't get you.
22:06jcromartiehyPiRion: I see, it's when it falls on the particular placement in the sequence?
22:08stcredzeroarrdem: also, it's a game that needs a discrete grid and I'd also like to have discrete time steps. agent-y/actor-y nondeterminacy is bad
22:08hyPiRionjcromartie: right, when there's one really heavy function call, the list won't proceed beyond some element behind it because pmap is lazy
22:08hyPiRionsemilazy, rather
22:11turbofailsounds like a job for claypoole
22:23rhg135amalloy, am I incorrect in thinking that `map` since it's lazy wouldn't cause a stack explosion
22:24amalloyrhg135: that's too general a question to really have an answer
22:24amalloyyou can absolutely blow the stack with map, via like ##((fn f [xs] (map f xs)) '(1))
22:24lazybotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long
22:25amalloy&((fn f [xs] (map f [xs])) '(1))
22:25lazybotjava.lang.StackOverflowError
22:25rhg135oh i see now, amalloy
22:25rhg135back to the drawing board :(
22:25rhg135can't figure out what to put in the queue
22:28zenoliHow does one go about reading a file into a Buffy buffer? I've been beating my head against this for an hour.
22:38amalloyrhg135: why are you trying to make this tail-recursive? it seems really unlikely that that will lead to a program that's better in any interesting way
22:39rhg135amalloy, it's for a build tool if this (dependency graph generator) blows the stack large project would be no-ops
22:42FrozenlockIf I put a CSS file in the resources of a library, will it be available for a project using this library?
22:43amalloyhmmm. do you have to build a big nested map? it seems like a one-level map of "all the things X depends on" should be useable (not sure if it needs to be transitive dependencies or direct)
22:45rhg135amalloy, yeah you know f*** it this is a POC and i'll try that
22:47TravisDNow that's a TLA that you don't see every day
22:49lemonodorzenoli: i don’t know, and i haven’t tried buffy, but i liked using https://github.com/ztellman/gloss pretty well,
22:50zenolilemonodor: Thanks...does it deal well with dynamic frames?
22:52lemonodori didn’t try. i was using it to parse AR.Drone telemetry data, which uses a tagged format, but i used my own logic to delimit tagged frames
22:53zenoliI just managed to finally get it to accept a file object...the version in Clojars is -beta1, which seems to not like wrapped buffers at all.
22:57lemonodorhttps://github.com/wiseman/turboshrimp/blob/master/src/com/lemondronor/turboshrimp/navdata.clj if you want to see an example
22:59bob2TravisD, depends where you work!
22:59zenoliWoo, just managed to successfully extract a string!
23:01zenolilemonodor: Thanks...that's really helpful. I'll poke at gloss as well, since I'm not deeply committed at this point.
23:06lemonodorbtw, one reason i did the tagged frame logic myself was to do lazy decoding, so i didn’t go to the overhead of parsing every frame if it wasn’t being used.
23:07lemonodorgo to the overhead? i meant go to the trouble.
23:10zenoliI'm trying out a modfile parser for overtone...my first attempt is morbidly inefficient, just sucking in the entire file.
23:11zenoliJava I/O is a terrible twisty maze of classes, all alike.
23:11brehautthe dwarf throws his axe.
23:11brehautit misses
23:12zenoliplugh
23:21malynlijnen___: I think it's here: https://github.com/swannodette/swannodette.github.com/blob/master/code/blog/src/blog/instrument/core.cljs
23:22zenoliHmm...can you specify endianness of the representation in gloss? I'm not see anything along those lines in the docs for either it or buffy.
23:23lemonodoryes, there are -be and -le versions of each type. you might be able to set the endian-ness of the bytebuffer you give it, i’m not sure
23:23stcredzeroso, if anyone wants to hop onto my online grid/map engine for my Clojure MMO, I'm running a stress test at http://raidsphere.com
23:24stcredzeroIt's not yet a game.
23:24zenolilemonodor: Ah, hadn't thought to check the classes I was passing in.
23:28zenoliYep, that does it. Excellent.