#clojure logs

2015-05-16

00:03epicherospeaking of i should exit freenode before i'm drunk
00:23tolstoyIs that just because of the way it is, or because it seems to be morphing into Java?
00:50brainproxytmtwd: see http://hypirion.com/musings/understanding-persistent-vector-pt-1
00:50brainproxy^ the author wrote a multi-part series which goes really in depth
00:50tmtwdokay interesting
00:51brainproxypersistent data structures aren't always the answer; even in clojure, sometimes you may still reach for, say, a combo of ConcurrentHashMap and a mutex
00:51brainproxybut those are going to be edge cases
03:01tmtwddoes cljs fall under the category of js 'transpiler'?
03:01TEttingerit translates to JS but also does compiler optimizations, I would think
03:02TEttingerit isn't just translating, it's also analyzing the code IIRC
03:02TEttingerI'm probably wrong here
04:37ro_stfor some reason my lein deps :tree shows tools.nrepl 0.2.6 but i don't have it in project.clj anywhere. it's listed at the top level. ~/.lein/profiles.clj is empty. what could be causing this?
04:38ro_sti want to switch to 0.2.10 for CIDER but adding it with that version number has no effect. it stays at 0.2.6. i have lein cleaned plenty.
04:39ro_stit's listed at the top level in the tree, rather than as a sub-dep of another dep
04:41ro_stah. it has :scope "test" on it in the tree. presumably some dep i'm bringing in has this. how to override?
04:42ro_stgigasquid: your book has helped us skill up two new tech interns very well. thank you :-)
04:43crocketWhat does "_" do in destructuring?
04:44ro_st_ is a valid symbol name
04:44ro_stby convention, it means, 'i don't care about this value'
04:47crocketro_st, Yes, by convention.
04:47crocketonly by convention.
04:47crocketIt doesn't seem to be a reserved word.
04:47ro_styes. it has no special semantic meaning
04:47ro_styou could totally use it as a normal symbol in your code and Clojure wouldn't care. your colleagues might, though :-)
04:48crocketWhat do you use clojure for?
04:48crocketIs clojure a good choice if you want to write a reliable back-end system?
04:48ro_stfullstack software-as-a-service product
04:48ro_stwith clojure clojurescript and datomic
04:48ro_styes. very good choice
04:48crocketdatomic isn't free.
04:49ro_stincorrect. it isn't opensource. it is free
04:49ro_stif you don't want HA or memcached support more than 2 connected pears
04:49ro_st… support OR more than ...
04:49crocketDatomic isn't free beyond 2 simultaneous peers.
04:49ro_stwe do, and so we pay, and with a smile. it's saved us money in so many other ways
04:50crocketAh, capitalism
04:51crocketro_st, Can it serve haskell's niche?
04:51ro_sti don't know. i've never used haskell
04:51crocketProbably, clojure is a better choice for facebook, too.
04:51crocketor twitter
04:52crocketFacebook used to use PHP.
04:52ro_sttwitter uses clojure
04:52crocketTwitter also uses scala.
04:52ro_stfaceboo still uses php. their own version and VM
04:52crocketScala is complex...
04:52crocketIt has a complex syntax.
04:53crocketI surmise it's probably cheaper to just buy datomic support than to pay your own developers.
04:55ro_styes, in a way. you spend less time worrying about some things
04:55ro_stlike data consistency and read caching
04:55ro_stboth hard to reason about when using mutable databases
04:56crocketIf rich hickey was paid unconditional basic income, he'd consider open-sourcing datomic.
04:57ro_sti'd also consider open-sourcing it for guaranteed pay. i wouldn't be able to do more than that, because i don't actually have the source. but i'd be totally happy to consider it for pay -grin-
04:58wasamasaI somehow can't believe this unconditional basic income would be enough for such people
04:58wasamasafrom what I've read, wouldn't it allow you to live a bit better than your average student?
05:00crocketwasamasa, As an economy developers, UBI will pay enough for decent living...
05:00crocketdevelops
05:00crocketAs an economy develops, UBI grows together.
05:00crocketBy the way, an average student lives well from my point of view....
05:01crocketHe doesn't get to buy a smartphone every 6 months, but I am ok with it.
05:01wasamasasure, if you're used to that level of living standard
05:02crocketFor me, freedom to use one's own time is more worth than any amount of material wealth.
05:02wasamasaI'm more worried whether someone not used to it can manage to lower it significantly
05:02crocketwasamasa, People can adapt.
05:02crocketPeople adapted to north pole.
05:02crocketPeople adapted to desert.
05:03crocketSurely, they can adapt to a lower standard of living in exchange for freedom from boss.
05:03wasamasaok, let's send rich hickey to the north pole and see what happens
05:04crocketwasamasa, You will come to realize that you didn't actually need a lot of money in the first place.
05:04crocketI used to get the monies from a job, and now I'm jobless.
05:04crocketI'm happy for being jobless every single day.
05:04wasamasaand while we're at it, all the politicians to the sahara
05:04crocketI can pursue my interests at home freely.
05:04crocketThis freedom!!
05:05crocketI never knew I could learn 10 hours a day before I was freed from a school and a job.
05:05crocketI could learn 10 hours a day and feel good about it.
05:05crocketIf I was tied to a job or a school, I could never have known the pleasure of learning.
05:07crocketNot just my long-term economy value increased by tens of times, but I also became a better man.
05:08crocket*economic value
05:11crocketI don't need other people's recognition(a job) to make money.
05:13crocketwasamasa, Rich Hickey could be simply afraid of economic disenfranchisement...
05:15the-kennyOr, you know, you could leave other people not involved out of your discussion :)
05:21crocketAre there open-source alternatives to datomic?
08:10TimMcdevn: How do I mean what, the silly statement about there only being one program?
08:13gfrederi`TimMc: it reminds me of http://joearms.github.io/2013/11/21/My-favorite-erlang-program.html, which I always found confusingly unimpressive
08:14tmtwdCan I use the same dev environment as clojure for clojurescript?
08:14tmtwdie, can I use cider for cljs, or do I need something new?
08:15crocketThere is PossibleDB which is very alpha.
08:17tmtwdbut I can use cider and the normal repl?
08:19crockettmtwd, cider uses 'lein repl'
08:19crocketClojure's built-in repl is inferior to 'lein repl'
08:20gfrederickstmtwd: I can't keep track of all the cljs tooling, but you might get somewhere by looking at figwheel
08:20tmtwdok
08:23crocketIs clojure suitable for production machine learning systems?
08:23escherizetmtwd: checkout luminus +cljs mode
08:23escherizeit has really great docs about getting started with cljs
08:24escherizehttp://www.luminusweb.net/docs/clojurescript.md
08:24crocketNot sure if clojure or JVM is ready to handle GPUs.
08:24gfrederickscrocket: in all likelihood clojure can handle it about as well as java can
08:25gfredericksquestions about what clojure is capable of w.r.t. systems/integration/performance often reduce to questions about java
08:25hellofunkcrocket: if there isn't already, i'd bet an OpenCL library for clojure will exist
08:25crocketI heard OpenCL was written badly.
08:26hellofunkcrocket: possible but its main alternative is proprietary, so it will likely improve with time. Apple has certainly taken a big bet on it.
08:28crocketThe problem with OpenCL is it was written in C.
08:28crocketIt could have been better if it was written in Rust.
08:29crocketRust can fill C's niche quick.
08:29crocketIt has a very good C ffi.
08:29tmtwdok
08:30crocketI heard Rust 1.0 was released. This is the first stable release of Rust.
08:30hellofunkit is possible to write good software in C
08:31hellofunkhard to believe, but it's true
08:31crockethellofunk, I know
08:32crocketC is good if you need a small set of features to work reliably and fast.
08:32crocketIt suits ZeroMQ for example.
08:32crocketIf you need to add features quick, C is not a very good deal.
08:32crocketRust is better than C since it prevents most memory leaks.
08:33crocketIt also has a decent package management system which C and C++ don't have.
08:34crocketSince Rust 1.0 was released, Rust will drive C out over time.
08:34hellofunkmy point is that if you think OpenCL is written badly, it's choice of C as a language is certainly not the reason
08:34crockethellofunk, It's possible to write perfect softwares in C if you have well disciplined programmers.
08:35wasamasathis discussion feels like watching one of these xtranormal video clips
08:35hellofunkcrocket: fyi there is also #clojure-offtopic
08:36wasamasayou know, https://www.youtube.com/watch?v=b2F-DItXtZs
08:38the_dude:)
08:39tmtwd;; bad; distinct lines
08:39tmtwd(when something
08:39tmtwd (something-else)
08:39tmtwd)
08:39tmtwdwhy is that bad style?
08:40wasamasait just looks disconcerting to lisp programmers, that's all
08:40hellofunkare you asking why on seprate lines rather than the whole shebang on a single line?
08:40tmtwdif you are going back to a function after you have written it, and adding stuff to the body, it is way easier with a trailing paren
08:41tmtwdno the trailing paren
08:41hellofunktmtwd: oh you are talking about the trailing end paren?
08:41hellofunkgotcha, if you have a good editor with parenethesis control automated, what you describe is not an issue
08:41wasamasatmtwd: use paredit
08:41tmtwdwasamasa, i dont know if that solves the problem
08:42wasamasatmtwd: there are exceptions to this rule of course, such as lengthy lists or lists where there's a comment at the end
08:42tmtwdi will try again
08:42wasamasasee http://mumble.net/~campbell/scheme/style.txt for further explanation
08:42wasamasa"Rationale: The parentheses grow lonely if their closing brackets are all kept separated and segregated."
08:42hellofunktmtwd: emacs with paredit makes it easy to automatically insert a new expression in something like your where example, without uglifying the shebang with a trailing end paren
08:43wasamasathe actual explanation follows later
08:45tmtwdhellofunk, i see
08:45tmtwdhellofunk, there is some learning curve, or is it automatic?
08:45hellofunktmtwd: paredit does have a learning curve, yes
08:45wasamasathere is always a learning curve
08:46hellofunktmtwd: and so does emacs
08:46tmtwdlike, there are some key bindings I suppose
08:46wasamasaa whole lot of them
08:46hellofunktmtwd: there are many many keybindings
08:46tmtwdI'm already on emacs
08:46tmtwdI usually just learn the 2 or 3 key bindings I need
08:46hellofunktmtwd: this might help you get started: https://github.com/hellofunk/emacs-clojure-hints
08:46tmtwdI forget the rest too quickly
08:47tmtwdhellofunk, okay
08:47tmtwdis paredit included in cider?
08:47wasamasano
08:47crocketHellish....
08:47wasamasaCIDER's README recommends installing paredit
08:47wasamasaamong other things
08:48tmtwdokay I think I have paredit
08:48hellofunktmtwd: the cider team does have this more robust config that includes paredit: https://github.com/clojure-emacs/example-config
08:48tmtwdI'm using a premade emacs config from clojure the brave
08:50crocket(sum 1 help me)
08:52the_dude(webscraping)
08:52the_dudeis there anything sweet other than https://github.com/cgrand/enlive
08:53TimMcgfredericks: That's a good way of describing it.
09:08n8dawghello, i'm writing a macro implementing a DSL and I want to give helpful feedback to the user in event of an error, i'm writing my own validator
09:08n8dawgis there a way to error the macro with line number information as well as a helpful error message?
09:19gfredericksTimMc: the erlang thing you mean?
09:22TEttingermy favorite programs in any language are always confusingly impressive
09:23TEttingerlike this C http://keiapl.org/rhui/remember.htm#incunabulum
09:26TimMcgfredericks: Yeah.
09:27TimMcTEttinger: But in gfredericks' link, confusingly *unimpressive*.
09:31wasamasan8dawg: sounds like you wish for something along the lines of racket's syntax objects
09:32gfredericksTEttinger: hey btw thanks for randomly mentioning java.util.SplittableRandom a few months back
09:32gfredericksI didn't know it existed and it pretty much rerouted my entire clojure/west talk and associated test.check work
09:34TEttingerhaha that's great!
09:34TEttingerwhat does it do that improves it so much?
09:34wasamasan8dawg: http://docs.racket-lang.org/guide/stx-obj.html
09:34wasamasan8dawg: they're used for its macros and contain extra meta data, such as source locations
09:35TEttingerI really only use the implementation of it for its convenient only-a-long-state, high-speed, high-quality stuff
09:35TEttinger^ gfredericks
09:36TEttingerI wasn't really sure what problem it solved in the first place, is it something related to multiple threads continuing to get random values off the same state, in some predictable manner?
09:39gfredericksTEttinger: splittability is surprisingly crucial for general functional programming
09:40gfredericksin particular, function composition w/o the state monad, laziness, and parallelization. details in the talk https://www.youtube.com/watch?v=u0t-6lUvXHo
09:40TEttingercool thanks
09:40TEttingerI don't really know what splittable means other than "you can chop a banana in half with a knife"
09:41gfredericksyeah the talk introduces the concept in the first half
09:41TEttingerclojurebot: splittability is an important concept for bananas and functional composition
09:41clojurebotYou don't have to tell me twice.
09:41gfredericksthe talk outline is "splittability is a thing, you need it for things, and here's how you can get it in clojure"
09:41gfredericksalso anecdotes about test.check
09:42TEttingergfredericks! I love random stuff!
09:42gfredericks!!
09:43wasamasaTEttinger: I can't believe that K and Kdb look like this while managing to be fast as heck
09:44TimMcgfredericks: Ooh, is this from the conj? I've been wanting to watch that talk.
09:44gfredericksthe western conj
09:44TimMcyeah, that
09:44TimMcyay
09:44gfredericksTimMc: the video was posted within 3 hours
09:45TimMchah
09:48kaiyinI don't quite understand what "retaining the head" really means, take an example from the joy of clojure book, what's the difference between these two except order? (let [r (range 1e6)] (last r) (first r)) (let [r (range 1e6)] (first r) (last r))
09:49justin_smithkaiyin: in one case, you can safely throw away r
09:49justin_smitherrr... wait
09:50justin_smithwhich part of the joy of clojure is that from?
09:51TimMcSome day I'm going to get some of those barrel of monkey toys that chain together and make a video about garbage collection and holding onto the head of a linked list.
09:52TimMc(No, I'm not, because I don't know how to make videos, but I like the idea.)
09:52kaiyinjustin_smith: 6.3.3 Losing your head. Page 128
10:36clojerI have a YeSQL function: (add-birth! {:date_time "1967-07-31 06:30:00 America/Caracas" :tz_location "America/Caracas"}) which gives me this error: 1. Unhandled java.sql.BatchUpdateException Batch entry 0 INSERT INTO births (date_time, tz_location) VALUES ('1967-07-31 06:30:00 America/Caracas', 'America/Caracas') was aborted. Call getNextException to see the cause.
10:36clojerThe SQL is correct and works via pgAdmin. How do I call getNextException? On which object?
10:37clojerI can call a (get-user .... OK from YeSQL but not an insert.
10:48clojerResolved by wrapping (try ....... (.getNextException e))
11:20crocketI find "Chas Emerick, Brian Carper, Christophe Grand-Clojure Programming-O'Reilly Media (2012)" an indecent introduction to clojure for people who don't know programming well already.
11:24pdksounds very raunchy indeed
11:25crocketpdk, sorry for the word 'indecent'
11:45the_dudeUp to date clojure book recommendation?
11:49schauehowhat are you looking for? gentle introduction? intermediate stuff? overview or specific topics?
12:06zimablueI'm halfway through the joy of clojure and I don't know whether to recommend it, it's fairly well written but very terse/full-on
12:08AimHereRecommend it for people who will cope with a terse/full on clojure guide. It is widely acknowledged that Joy of Clojure tends to work better for people already somewhat acquainted with Lisps or functional programming
12:32wasamasacrocket: https://github.com/kovasb/gamma
12:32wasamasacrocket: look what I've found!
13:29progrockerthanksis there a way to run a method/function for every method call?
13:29progrockerprior to calling teh method with the correct dispatch value?
13:56justin_smith,(apropos "method")
13:56clojurebot(clojure.core/-reset-methods clojure.core/defmethod clojure.core/find-protocol-method clojure.core/get-method clojure.core/method-sig ...)
13:56justin_smith(doc get-method)
13:56clojurebot"([multifn dispatch-val]); Given a multimethod and a dispatch value, returns the dispatch fn that would apply to that value, or nil if none apply and no default"
13:57justin_smithprogrocker: actually, maybe what you want is a normal function, that does some f, and then calls your method on the arg
14:07brainproxythe-kenny: Clojure Programming, despite being 3 years old, should still be a good intro
14:07brainproxywhile you're reading it, keep clojuredocs.org and/or clojure.github.io handy
14:08justin_smithbrainproxy: the-kenny: everything in it will still work, but some of it has shiny new better performing alternatives now
14:08brainproxyjustin_smith: okay, good to know re: everything still working
14:09brainproxyI read it back in 2012, just after it came out
14:09the-kennybrainproxy: Huh, when did I ask? :)
14:09brainproxythe-kenny: whoops, I meant to mention the_du
14:09brainproxythe_dude
14:09brainproxyah, he left the channel
14:10justin_smithhaha, yeah, I kind of figured the-kenny wasn't looking for a first clojure book
14:10brainproxyi just tab and went w/ weechat's autocomplete w/o double-checking
14:10brainproxy*hit tab..
14:10the-kennyDon't worry :)
14:25SeyleriusOkay. I need some help getting my head around mikera's core.matrix.
14:32justin_smithSeylerius: first thing is that it defines things in terms of a protocol, and you need to pick some library that implements that protocol
14:32justin_smithsimilar to using clojure.java.jdbc then picking a driver for a particular sql version
14:37Seyleriusjustin_smith: Right. So, I'm going with NDArray for it.
14:37SeyleriusPlaying around with it in CIDER, and getting my head around it little bits.
14:37justin_smithcool
14:37Seylerius(Making a 3d sudoku solver)
14:37SeyleriusPaying project, so it's kinda cool.
14:57lvhHi :-) I have a deffoo macro (specifically, secretary's defroute) that I want to run a few times based on some information in a data structure. (doseq [[x y z] my-seq] (deffoo x y z)) obviously won't work since the macro will see symbols, not the actual data structures. The macro is too complex to copy the internals. What do I do for idiomatic clojure? Write my own macro that expands to a number of defroutes forms?
14:59justin_smithlvh: that's your option, if secretary does not expose a function you could bind to a var yourself.
14:59justin_smithlvh: also #clojurescript may have more secretary specific info
14:59lvhjustin_smith: I'll ask again there too
15:00lvhjustin_smith: what do you mean by just binding to a var yourself?
15:00lvh@#'?
15:01lvh(Does that even work?)
15:02justin_smithlvh: you can assign something to a symbol without using def - let me take a moment to look it up
15:02lvhjustin_smith: OK, thanks. I don't see how that works if secretary *doesnt* expose a fn, though
15:02justin_smith~grim intern
15:03clojurebotGabh mo leithscéal?
15:03justin_smith$grim intern
15:03justin_smithlvh: anyway, the function is called intern
15:03justin_smithit takes an ns symbol, a name symbol, and a value
15:03justin_smithso it's like def, but not a macro
15:04justin_smithso if secretary exposes a function that returns what defroute would bind, then you would be all set using intern in a loop
15:04justin_smith(doc intern)
15:04clojurebot"([ns name] [ns name val]); Finds or creates a var named by the symbol name in the namespace ns (which can be a symbol or a namespace), setting its root binding to val if supplied. The namespace must exist. The var will adopt any metadata from the name symbol. Returns the var."
15:06lvhjustin_smith: Ah, I see, you're saying if it *DOES* expose a fn I could just use that
15:06justin_smithright, since you can use intern in a loop
15:06justin_smithunlike defroute
15:08justin_smithlvh: well, turns out secretary is small, and I just read the code, and you're out of luck
15:08lvhjustin_smith: Yeah
15:08lvhjustin_smith: That's cool, I just did the fairly obvious doseq -> for + `(...) ~a ~b macro thingy
15:09justin_smithyeah, it's too bad more libs don't create a function plus a thin macro wrapper though
15:09justin_smithmacros are about syntax, not functionality, dammit
15:10lvhjustin_smith: Yeah, I agree
15:14lvhApparently `(some-ns/some-fn ...) is not a thing you can do? https://gist.github.com/lvh/8f3059832e2136e914f1
15:16justin_smithlvh: you'll need to cons a do on the front of that for
15:16justin_smithotherwise it will generate a call to the first result, with all the others as args
15:17lvhjustin_smith: wait, just a (cons (for ...))? What am I consing it on to?
15:17justin_smith(cons 'do (for ...))
15:17justin_smithbecause otherwise you are generating a function call that you don't want
15:17justin_smithbecause it's a macro
15:18lvhah, right
15:18justin_smithnot that this helps your current issue
15:18lvhI forgot I'm supposed to create one form :)
15:18justin_smithI assume you checked the macroexpand output?
15:23lvhjustin_smith: I didn't; my in-editor repl doesn't work with cljs until weasel cuts a release :/
15:24lvhalso the default figwheel one doesn't seem to understand basic readline? (i.e. arrows don't work, C-k doesn't work...)
15:31justin_smithlvh: the macroexpand will work in clj
15:31justin_smithit's just the resolution of of the symbols if you actually ran the macro normally that would fail
15:32justin_smith,(defmacro foo [x] `(bar ~(inc x)))
15:32clojurebot#'sandbox/foo
15:32justin_smith,(macroexpand '(foo :a))
15:32clojurebot#error {\n :cause "clojure.lang.Keyword cannot be cast to java.lang.Number"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.Number, compiling:(NO_SOURCE_FILE:0:0)"\n :at [clojure.lang.Compiler macroexpand1 "Compiler.java" 6644]}\n {:type java.lang.ClassCastException\n :message "clojure.lang.K...
15:32justin_smith,(macroexpand '(foo 1))
15:32clojurebot(sandbox/bar 2)
15:32justin_smithso you need to get anything in a ~ properly implemented, but unresolved calls generated by the macro are fine
15:41borkdudebrucehauman I'm trying to update my figwheel version. I'm reading the quickstart and it seems to only require the lein plugin in the project.clj, not the main project itself?
15:41borkdudebrucehauman I am getting "goog.require could not find: figwheel.connect" inside my browser console now
15:41brucehaumanborkdude: yep :)
15:42borkdudemaybe I should try a lein clean
15:42brucehaumanborkdude: make sure you do a good cleaning
15:42brucehaumanborkdude: the connect script is now generated and required for you if you set :figwheel true in the compiler config
15:44borkdudebrucehauman that's very cool.
15:44brucehaumanborkdude: if you are still calling fw/start manually you can do that just don’t set the :figwheel value in build optoins
15:47borkdudebrucehauman probably found it: I had an older version of lein-figwheel in my dev profile and added the newer one in the top level :plugins :)
15:49kaiyinhttp://stackoverflow.com/questions/30201930/mandelbrot-set-function-does-not-perform-as-expected/30278302#30278302 why is apply so slow?
15:51wasamasadon't abuse apply please, especially when there's a better function you can make use of
15:51arohnerkaiyin: apply has to look up the fn at runtime, rather than jumping directly to the code
15:51arohnerIt wouldn't surprise me if it breaks JVM inlining
15:54kaiyinchas implies in his answer that there is a trivial fix for apply, do you know what he meant?
16:02amalloykaiyin: just write (* x y z) instead of (apply * [x y z])
16:30expez"bounded by the generator's size paramter" Where can I read about setting this 'size param"?
16:51tmtwdif you have an instance of a repl and the source code up, can you modify the source code from the repl?
16:51tmtwdie in cider
16:56expeztmtwd: modify your source file on disk form the repl? no
16:56tmtwdI see
16:57socksywell, in theory you could just write over the file and then reload the namespace, but that's probably not what you mean
16:57tmtwdSo you can interact with the source from repl
16:57tmtwdBut I mean, you can call
16:57tmtwd(js/alert "hello world)
16:57tmtwdfrom the repl and the browser does an alert
17:03devnSo I was thinking about this partition and partition-all when step or n is not positive thing..
17:04devnI realize I'm probably insane for wondering this, but... Why can't we make partition work with negative n and step sizes, assuming that it steps from the end of the seq?
17:06devnlike (partition -2 -1 [1 2 3 4]) => ((4 3) (3 2) (2 1))
17:07whodidthismaybe it would be too weird to add that functionality while keeping the default use case lazy
17:08devnah, yeah, good point
17:08devnit gets funky when you're dealing with vectors and seqs, messing with it now
17:09devnmaybe a "rnthrest" to do what nthrest does with negative values, added a "pick" function that is like take, but handles taking from the end using a negative n
17:09devns/maybe/made
17:10devnbut you wind up with a bunch of special case nonsense
17:13devnoh well, i tried... partition is kinda weird. I think (partition 0 [1 2 3]) => (() () () () ...) makes sense, but (partition 1 -1 [1 2 3]) => ((1) (1) (1) ...) bothers me
17:14devnyou make the positive step in to 1, but it feels like maybe it'd be more correct to have it produce ((1) () () () ...)
17:14devnsince -1 from the initial positive step is nothing, just as is the case with n=0 step=0
17:16devni guess the same goes for inifinite repetition of the initial N for step=0
17:17devnif the step is 0, you haven't moved, so okay, i guess ill buy that ((1) (1) ...) makes sense in that instance, but in the case of -1, im not sure
17:30TimMcgfredericks: I like the idea of a random number generator that is actually a constant number generator + a random number generator generator. :-P
17:32gfredericksTimMc: wat.
17:33TimMcwatching the Purely Random talk
17:33TimMcCalling rand-int on a given immutable splittable RNG always gives the same value, right?
17:33TimMcso clearly it's a constant number generator
17:34gfredericksI suppose so
17:36TimMcand it also generates RNGs
17:36TimMcbut constantly :-)
18:13TimMc?
18:13TEttinger&(let [n 500] (map #(let [halton (fn [idx base] (loop [result 0, f (/ 1.0 base), i idx] (if (<= i 0) result (recur (+ result (* f (mod i base))) (/ f base) (int (/ i base))))))] (halton % 5)) (range 20 521)))
18:13lazybot⇒ (0.16 0.36 0.56 0.7600000000000001 0.9600000000000001 0.008 0.20800000000000002 0.40800000000000003 0.6080000000000001 0.808 0.048 0.24800000000000003 0.448 0.6480000000000001 0.8480000000000001 0.088 0.28800000000000003 0.48800000000000004 0.6880000000000001 0.888 ... https://www.refheap.com/101186
18:15TEttingerit's strictly based on the previous element's mathematical properties, it's just reversing the representation in a given base (here it uses base 5) and treating it as a floating-point before turning it back into normal representation (not base 5)
18:16TEttingerI think that's what it does
18:16TEttinger$google halton sequence wikipedia
18:16lazybot[Halton sequence - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Halton_sequence
18:17TEttingerI think I screwed something up in that impl though
18:18TimMcTEttinger: Ah, "uniform random", got it.
18:19TEttingernot actually random, it fails all tests for randomness I think? but it seems random
18:20TimMcI've seen this used in graphics programs for generating noise.
18:20TEttingerthe graphs of sobol sequences show a definite symmetry
18:20TEttingersome here https://en.wikipedia.org/wiki/Low-discrepancy_sequence
18:21TEttingerhttps://en.wikipedia.org/wiki/Sobol_sequence#/media/File:Sobol_sequence_2D.svg
18:23andyfgfredericks: Thanks for suggesting in your dynalint bug report the suggestion to use Leiningen :injections keyword. I couldn?t figure out how to make lein-dynalint do that, but I can use :injections in a test Leiningen project to enable dynalint for ?lein test? and ?lein repl? of that project.
18:25andyfTrying to figure out how to make it more straightforward to use dynalint without having to manually enter any forms to eval when starting a REPL, or running their tests.
18:26andyf(inc gfredericks)
18:26lazybot⇒ 137
18:32gfredericksandyf: oh have you not done lein plugins much?
18:33gfrederickslike your problem is "I know how to do this in my project.clj but can't translate that into plugin-land"?
18:33andyfFigure out how lein plugins work? No, not much. Work on enhancing one (e.g. Eastwood)? Yes, quite a bit :)
18:34gfredericksah right
18:34gfredericksyou know how plugin functions take a project arg and can modify it before calling other tasks?
18:35andyfI saw that in the Leiningen docs yesterday, and saw where in lein-dynalint it calls leiningen's test function.
18:36andyfI tried modifying the project map to add an :injections key to it, but could not figure out why it was not executing the code I put there. Once I figured out that I could put the :injections key in my own project, I gave up on figuring out how to make lein-dynalint do it for me.
18:36gfredericksah gotcha
18:36gfrederickssounds like you know as much as I do without me digging into it myself then
18:37andyfI figure as long as I document clearly how to do it, that will make it reasonably easy for others to do it, too.
18:37andyfeven if there is no plugin to make it even easier.
18:38andyf:injections makes it possible to eval forms you want before Leiningen does its regular thing. Is there by any chance something similar to make Leiningen eval some forms you specify after it does its regular thing?
18:38gfredericksoh ha right
18:39andyfI guess if I want that, I should figure out how Leiningen plugins actually work :)
18:40gfredericksthere are definitely options, the question is whether there are options that allow you to treat `lein test` as an opaque thing you can call
18:41andyfIt isn't just 'lein test' though. dynalint seems useful for more than only one's tests, e.g. REPL development, perhaps even deployed applications if the performance overhead is reasonable.
18:41gfrederickswhich it probably isn't :)
18:42gfredericksbut yes agreed
18:42TimMcTEttinger: Neat.
18:42gfredericksandyf: I imagine at worst you can wire it up to write errors to a file eh?
18:42andyfRight now it wraps each core function that it adds checks to in a separate function. It could also be changed so that it replaces core function with its own versions, that do not wrap the originals, yes?
18:43andyfI haven't measured, but seems like that would reduce its performance cost.
18:43gfredericksandyf: I'm just assuming that it will always want to modify functions that are low-level enough that the effects would be severe; I'm happy to be wrong
18:45andyfIt doesn't do this now, but it could also be modified to selectively enable/disable different warnings, so you could tune it for performance vs. more error catching
18:46gfredericksah true
19:27SeyleriusWeirdness. CIDER's reporting that it's unable to resolve "difference" as a symbol
19:27justin_smithSeylerius: clojure.set/difference
19:27justin_smithit's not in clojure.core
19:28SeyleriusOh!
19:29Seyleriusjustin_smith: What's the clojurish way to work with a cube-shaped array, where you need to progressively refine restrictions in the non-locked boxes, and and progressively lock boxes when only one is left?
19:30justin_smithhow densely filled do you expect the matrix to get?
19:31Seyleriusjustin_smith: I'm making a cube-doku solver.
19:31justin_smithor, so very full
19:31SeyleriusYep
19:32justin_smithweren't you just going to use core.matrix?
19:33Seyleriusjustin_smith: Yep. My question is this: do I mutate my cube repeatedly, or do I return new ones?
19:33justin_smithshouldn't that be up to your implementation??
19:33lazybotjustin_smith: Uh, no. Why would you even ask?
19:34SeyleriusHah.
19:34justin_smithlazybot, are you an annoying idiot???
19:34lazybotjustin_smith: Yes, 100% for sure.
19:36SeyleriusI'm actually leaning towards treating them as immutable, since I can then track the history for branching purposes, since I'm trying to find _all_ solutions to a given puzzle.
19:38Seyleriusjustin_smith: Plus, the mutability functions are very poorly documented, and I don't know if they're even allowed in the NDArray implementation.
19:42SeyleriusWhy is this failing with an Illegal State Exception? http://ix.io/iB6
19:43Seyleriusjustin_smith: is http://ix.io/iB6 the wrong way to get the clojure.set functions into easy usability?
19:44justin_smith~use
19:44clojurebotuse is don't use use.
19:44justin_smithSeylerius: require with an :as clause is almost always preferred
19:45justin_smithbecause, among other issues, what happens if two namespaces you want to call define vars with the same names
19:54justin_smithSeylerius: I think core.matrix may define some symbols that are in clojure.core, and the compiler may not like it
20:06Seyleriusjustin_smith: Makes sense.
20:06SeyleriusI'll switch 'em both to require then
20:17Seyleriusjustin_smith: Why would a def that works in cider on its own fail when I try to C-c C-k compile it in from my source file?
20:18justin_smithbad namespace form?
20:18SeyleriusEven without namespace fun.
20:18SeyleriusIllegal Argument Error
20:18justin_smithC-c C-k requires being able to load the ns form afaik
20:19justin_smithI don't actually use cider, but iirc that command wants to load things in a specific ns (and needs the ns form to figure out which)
20:20Seyleriusjustin_smith: This code (http://ix.io/iB8), when compiled, got this error (http://ix.io/iB7).
20:21justin_smithSeylerius: constraint-sheet needs []
20:21justin_smithyou can't do a defn without a param vector
20:21justin_smiththat's what that error is saying
20:22justin_smithalso, set-current-implementation should probably be matrix/set-current-implementations
20:22justin_smithwithout the s, sorry
20:22justin_smithalso, the definition of blank-square needs to be above the definition for sample-2d
20:24SeyleriusOh, snap, I forgot that I wasn't done with constraint-sheet
20:28SeyleriusThere any good guides on using Java gui crap in Clojure?
20:29SeyleriusI'm going to need that once I'm done with the algo here.
20:29TimMcgfredericks: Great talk!
20:29SeyleriusTimMc: gfredericks did a talk?
20:30TimMcA bit back: https://www.youtube.com/watch?v=u0t-6lUvXHo
20:32weiwhat’s clojure.template for and how is it used? I’m interested in simplifying boilerplate code, e.g. the stuff required to initialize sente
20:32SeyleriusTimMc: That looks shiny. I'll have to watch it later. Randomness and crypto are kinda minor obsessions of mine.
20:33SeyleriusAlso...
20:33Seylerius(inc gfredricks)
20:33lazybot⇒ 1
20:33Seylerius(inc gfredericks)
20:33lazybot⇒ 138
20:33SeyleriusJust for doing that talk.
20:33SeyleriusAnd btw, justin_smith, thanks for all the help.
20:33Seylerius(inc justin_smith )
20:33lazybot⇒ 11
20:43justin_smith(identity justin_smith )
20:43lazybotjustin_smith has karma 11.
20:43justin_smith(identity justin_smith)
20:43lazybotjustin_smith has karma 253.
20:44justin_smithoh man so close to having palendromes for both at once
20:44justin_smith(identity justing_smith)
20:44lazybotjusting_smith has karma 0.
20:49TimMc(dec justin_smith)
20:49lazybot⇒ 252
20:50TimMc\o/
20:50TimMcsavor it before I inc you
20:50justin_smith(inc palindromes)
20:50lazybot⇒ 1
20:50TimMc(inc justin_smith)
20:50lazybot⇒ 253
21:22gfredericksTimMc: oh hey thanks
22:26crocketWhen does clojure's dynamic typing get in the way?
23:01raspasovcrocket: when you don't use {:keys [k1 k2 ...]} destructuring : )
23:07crocketDestructuring is called pattern matching in SML.
23:08crocketSML types are strong and static
23:08crocketClojure types are strong and dynamic.
23:08crocketJava types?
23:21timvisherwow. TIL. `boolean?` is not a thing...
23:21timvisherhow would you check if something is `true` or `false`? hopefully something better than `(#{true false} var)`?
23:23amalloy,(let [boolean? (comp (partial apply =) (juxt identity boolean))] (map boolean? [1 true false]))
23:23clojurebot(false true true)
23:23amalloytimvisher: ^ the worst answer
23:23timvisherheh
23:24timvisherseriously though. there's nothing like what i would expect `boolean?` to be? is there anyting even in interop?
23:24timvisheri can't remember from my java days :)
23:24metellustimvisher: maybe or true? and false?
23:24timvishermetellus: right. but that's no better than my #{true false}
23:24amalloytimvisher: (partial instance Boolean)
23:25amalloytimvisher: #{true false} is not a correct implementation
23:25amalloyso his was better
23:25timvisheramalloy: that's more what i was looking for maybe :)
23:25timvisheramalloy: whoa. you're blowing my mind. :)
23:25timvisherwhat else is Boolean?
23:25amalloy&(let [boolean? #{true false}] (map boolean? [1 true false]))
23:25lazybot⇒ (nil true false)
23:26amalloypresumably you want (boolean? false) => true
23:26timvisherindeed... let me wrap my head around that...
23:26timvisherwhy is `false` not 'in' that set?
23:27amalloytimvisher: you are misunderstanding what sets do when called as functions
23:27timvisherclearly
23:27timvisheri thought they tested for membership, what do they actually do?
23:27amalloyyou imagine they are doing the thing that i wish they did, but they actually don't
23:27amalloythey return the item, if it's present
23:27amalloyand otherwise nil
23:28timvisheroh wow. heh. and in this case i then return a falsey value, which would fail as a predicate... lol.
23:28timvisheroh the cleverness of me...
23:28timvisheri like the `(partial ...` solution then
23:29timvisher,(map (partial instance? Boolean) [1 true false])
23:29clojurebot(false true true)
23:29timvisheris there a reason this isn't in core?
23:29amalloythe HOFs are not really that exciting. i'd just (defn boolean? [x] (or (true? x) (false? x)))
23:29amalloyif you wanted to use a HOF i'd actually use (some-fn true? false?)
23:29amalloysince that works on other platforms
23:31timvisher:)
23:33timvisherHOF: nothing appropriate
23:33timvisherthere's so much i don't know
23:33timvisherso exciting