#clojure log - May 16 2015

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:03 epichero: speaking of i should exit freenode before i'm drunk

0:23 tolstoy: Is that just because of the way it is, or because it seems to be morphing into Java?

0:50 brainproxy: tmtwd: see http://hypirion.com/musings/understanding-persistent-vector-pt-1

0:50 ^ the author wrote a multi-part series which goes really in depth

0:50 tmtwd: okay interesting

0:51 brainproxy: persistent data structures aren't always the answer; even in clojure, sometimes you may still reach for, say, a combo of ConcurrentHashMap and a mutex

0:51 but those are going to be edge cases

3:01 tmtwd: does cljs fall under the category of js 'transpiler'?

3:01 TEttinger: it translates to JS but also does compiler optimizations, I would think

3:02 it isn't just translating, it's also analyzing the code IIRC

3:02 I'm probably wrong here

4:37 ro_st: for 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?

4:38 i 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.

4:39 it's listed at the top level in the tree, rather than as a sub-dep of another dep

4:41 ah. it has :scope "test" on it in the tree. presumably some dep i'm bringing in has this. how to override?

4:42 gigasquid: your book has helped us skill up two new tech interns very well. thank you :-)

4:43 crocket: What does "_" do in destructuring?

4:44 ro_st: _ is a valid symbol name

4:44 by convention, it means, 'i don't care about this value'

4:47 crocket: ro_st, Yes, by convention.

4:47 only by convention.

4:47 It doesn't seem to be a reserved word.

4:47 ro_st: yes. it has no special semantic meaning

4:47 you could totally use it as a normal symbol in your code and Clojure wouldn't care. your colleagues might, though :-)

4:48 crocket: What do you use clojure for?

4:48 Is clojure a good choice if you want to write a reliable back-end system?

4:48 ro_st: fullstack software-as-a-service product

4:48 with clojure clojurescript and datomic

4:48 yes. very good choice

4:48 crocket: datomic isn't free.

4:49 ro_st: incorrect. it isn't opensource. it is free

4:49 if you don't want HA or memcached support more than 2 connected pears

4:49 … support OR more than ...

4:49 crocket: Datomic isn't free beyond 2 simultaneous peers.

4:49 ro_st: we do, and so we pay, and with a smile. it's saved us money in so many other ways

4:50 crocket: Ah, capitalism

4:51 ro_st, Can it serve haskell's niche?

4:51 ro_st: i don't know. i've never used haskell

4:51 crocket: Probably, clojure is a better choice for facebook, too.

4:51 or twitter

4:52 Facebook used to use PHP.

4:52 ro_st: twitter uses clojure

4:52 crocket: Twitter also uses scala.

4:52 ro_st: faceboo still uses php. their own version and VM

4:52 crocket: Scala is complex...

4:52 It has a complex syntax.

4:53 I surmise it's probably cheaper to just buy datomic support than to pay your own developers.

4:55 ro_st: yes, in a way. you spend less time worrying about some things

4:55 like data consistency and read caching

4:55 both hard to reason about when using mutable databases

4:56 crocket: If rich hickey was paid unconditional basic income, he'd consider open-sourcing datomic.

4:57 ro_st: i'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-

4:58 wasamasa: I somehow can't believe this unconditional basic income would be enough for such people

4:58 from what I've read, wouldn't it allow you to live a bit better than your average student?

5:00 crocket: wasamasa, As an economy developers, UBI will pay enough for decent living...

5:00 develops

5:00 As an economy develops, UBI grows together.

5:00 By the way, an average student lives well from my point of view....

5:01 He doesn't get to buy a smartphone every 6 months, but I am ok with it.

5:01 wasamasa: sure, if you're used to that level of living standard

5:02 crocket: For me, freedom to use one's own time is more worth than any amount of material wealth.

5:02 wasamasa: I'm more worried whether someone not used to it can manage to lower it significantly

5:02 crocket: wasamasa, People can adapt.

5:02 People adapted to north pole.

5:02 People adapted to desert.

5:03 Surely, they can adapt to a lower standard of living in exchange for freedom from boss.

5:03 wasamasa: ok, let's send rich hickey to the north pole and see what happens

5:04 crocket: wasamasa, You will come to realize that you didn't actually need a lot of money in the first place.

5:04 I used to get the monies from a job, and now I'm jobless.

5:04 I'm happy for being jobless every single day.

5:04 wasamasa: and while we're at it, all the politicians to the sahara

5:04 crocket: I can pursue my interests at home freely.

5:04 This freedom!!

5:05 I never knew I could learn 10 hours a day before I was freed from a school and a job.

5:05 I could learn 10 hours a day and feel good about it.

5:05 If I was tied to a job or a school, I could never have known the pleasure of learning.

5:07 Not just my long-term economy value increased by tens of times, but I also became a better man.

5:08 *economic value

5:11 I don't need other people's recognition(a job) to make money.

5:13 wasamasa, Rich Hickey could be simply afraid of economic disenfranchisement...

5:15 the-kenny: Or, you know, you could leave other people not involved out of your discussion :)

5:21 crocket: Are there open-source alternatives to datomic?

8:10 TimMc: devn: How do I mean what, the silly statement about there only being one program?

8:13 gfrederi`: TimMc: it reminds me of http://joearms.github.io/2013/11/21/My-favorite-erlang-program.html, which I always found confusingly unimpressive

8:14 tmtwd: Can I use the same dev environment as clojure for clojurescript?

8:14 ie, can I use cider for cljs, or do I need something new?

8:15 crocket: There is PossibleDB which is very alpha.

8:17 tmtwd: but I can use cider and the normal repl?

8:19 crocket: tmtwd, cider uses 'lein repl'

8:19 Clojure's built-in repl is inferior to 'lein repl'

8:20 gfredericks: tmtwd: I can't keep track of all the cljs tooling, but you might get somewhere by looking at figwheel

8:20 tmtwd: ok

8:23 crocket: Is clojure suitable for production machine learning systems?

8:23 escherize: tmtwd: checkout luminus +cljs mode

8:23 it has really great docs about getting started with cljs

8:24 http://www.luminusweb.net/docs/clojurescript.md

8:24 crocket: Not sure if clojure or JVM is ready to handle GPUs.

8:24 gfredericks: crocket: in all likelihood clojure can handle it about as well as java can

8:25 questions about what clojure is capable of w.r.t. systems/integration/performance often reduce to questions about java

8:25 hellofunk: crocket: if there isn't already, i'd bet an OpenCL library for clojure will exist

8:25 crocket: I heard OpenCL was written badly.

8:26 hellofunk: crocket: possible but its main alternative is proprietary, so it will likely improve with time. Apple has certainly taken a big bet on it.

8:28 crocket: The problem with OpenCL is it was written in C.

8:28 It could have been better if it was written in Rust.

8:29 Rust can fill C's niche quick.

8:29 It has a very good C ffi.

8:29 tmtwd: ok

8:30 crocket: I heard Rust 1.0 was released. This is the first stable release of Rust.

8:30 hellofunk: it is possible to write good software in C

8:31 * wasamasa gasps

8:31 hellofunk: hard to believe, but it's true

8:31 crocket: hellofunk, I know

8:32 C is good if you need a small set of features to work reliably and fast.

8:32 It suits ZeroMQ for example.

8:32 If you need to add features quick, C is not a very good deal.

8:32 Rust is better than C since it prevents most memory leaks.

8:33 It also has a decent package management system which C and C++ don't have.

8:34 Since Rust 1.0 was released, Rust will drive C out over time.

8:34 hellofunk: my point is that if you think OpenCL is written badly, it's choice of C as a language is certainly not the reason

8:34 crocket: hellofunk, It's possible to write perfect softwares in C if you have well disciplined programmers.

8:35 wasamasa: this discussion feels like watching one of these xtranormal video clips

8:35 hellofunk: crocket: fyi there is also #clojure-offtopic

8:36 wasamasa: you know, https://www.youtube.com/watch?v=b2F-DItXtZs

8:38 the_dude: :)

8:39 tmtwd: ;; bad; distinct lines

8:39 (when something

8:39 (something-else)

8:39 )

8:39 why is that bad style?

8:40 wasamasa: it just looks disconcerting to lisp programmers, that's all

8:40 hellofunk: are you asking why on seprate lines rather than the whole shebang on a single line?

8:40 tmtwd: if 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

8:41 no the trailing paren

8:41 hellofunk: tmtwd: oh you are talking about the trailing end paren?

8:41 gotcha, if you have a good editor with parenethesis control automated, what you describe is not an issue

8:41 wasamasa: tmtwd: use paredit

8:41 tmtwd: wasamasa, i dont know if that solves the problem

8:42 wasamasa: tmtwd: there are exceptions to this rule of course, such as lengthy lists or lists where there's a comment at the end

8:42 tmtwd: i will try again

8:42 wasamasa: see http://mumble.net/~campbell/scheme/style.txt for further explanation

8:42 "Rationale: The parentheses grow lonely if their closing brackets are all kept separated and segregated."

8:42 hellofunk: tmtwd: 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

8:43 wasamasa: the actual explanation follows later

8:45 tmtwd: hellofunk, i see

8:45 hellofunk, there is some learning curve, or is it automatic?

8:45 hellofunk: tmtwd: paredit does have a learning curve, yes

8:45 wasamasa: there is always a learning curve

8:46 hellofunk: tmtwd: and so does emacs

8:46 tmtwd: like, there are some key bindings I suppose

8:46 wasamasa: a whole lot of them

8:46 hellofunk: tmtwd: there are many many keybindings

8:46 tmtwd: I'm already on emacs

8:46 I usually just learn the 2 or 3 key bindings I need

8:46 hellofunk: tmtwd: this might help you get started: https://github.com/hellofunk/emacs-clojure-hints

8:46 tmtwd: I forget the rest too quickly

8:47 hellofunk, okay

8:47 is paredit included in cider?

8:47 wasamasa: no

8:47 crocket: Hellish....

8:47 wasamasa: CIDER's README recommends installing paredit

8:47 among other things

8:48 tmtwd: okay I think I have paredit

8:48 hellofunk: tmtwd: the cider team does have this more robust config that includes paredit: https://github.com/clojure-emacs/example-config

8:48 tmtwd: I'm using a premade emacs config from clojure the brave

8:50 crocket: (sum 1 help me)

8:52 the_dude: (webscraping)

8:52 is there anything sweet other than https://github.com/cgrand/enlive

8:53 TimMc: gfredericks: That's a good way of describing it.

9:08 n8dawg: hello, 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

9:08 is there a way to error the macro with line number information as well as a helpful error message?

9:19 gfredericks: TimMc: the erlang thing you mean?

9:22 TEttinger: my favorite programs in any language are always confusingly impressive

9:23 like this C http://keiapl.org/rhui/remember.htm#incunabulum

9:26 TimMc: gfredericks: Yeah.

9:27 TEttinger: But in gfredericks' link, confusingly *unimpressive*.

9:31 wasamasa: n8dawg: sounds like you wish for something along the lines of racket's syntax objects

9:32 gfredericks: TEttinger: hey btw thanks for randomly mentioning java.util.SplittableRandom a few months back

9:32 I didn't know it existed and it pretty much rerouted my entire clojure/west talk and associated test.check work

9:34 TEttinger: haha that's great!

9:34 what does it do that improves it so much?

9:34 wasamasa: n8dawg: http://docs.racket-lang.org/guide/stx-obj.html

9:34 n8dawg: they're used for its macros and contain extra meta data, such as source locations

9:35 TEttinger: I really only use the implementation of it for its convenient only-a-long-state, high-speed, high-quality stuff

9:35 ^ gfredericks

9:36 I 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?

9:39 gfredericks: TEttinger: splittability is surprisingly crucial for general functional programming

9:40 in particular, function composition w/o the state monad, laziness, and parallelization. details in the talk https://www.youtube.com/watch?v=u0t-6lUvXHo

9:40 TEttinger: cool thanks

9:40 I don't really know what splittable means other than "you can chop a banana in half with a knife"

9:41 gfredericks: yeah the talk introduces the concept in the first half

9:41 TEttinger: clojurebot: splittability is an important concept for bananas and functional composition

9:41 clojurebot: You don't have to tell me twice.

9:41 gfredericks: the talk outline is "splittability is a thing, you need it for things, and here's how you can get it in clojure"

9:41 also anecdotes about test.check

9:42 TEttinger: gfredericks! I love random stuff!

9:42 gfredericks: !!

9:43 wasamasa: TEttinger: I can't believe that K and Kdb look like this while managing to be fast as heck

9:44 TimMc: gfredericks: Ooh, is this from the conj? I've been wanting to watch that talk.

9:44 gfredericks: the western conj

9:44 TimMc: yeah, that

9:44 yay

9:44 gfredericks: TimMc: the video was posted within 3 hours

9:45 TimMc: hah

9:48 kaiyin: I 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))

9:49 justin_smith: kaiyin: in one case, you can safely throw away r

9:49 errr... wait

9:50 which part of the joy of clojure is that from?

9:51 TimMc: Some 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.

9:52 (No, I'm not, because I don't know how to make videos, but I like the idea.)

9:52 kaiyin: justin_smith: 6.3.3 Losing your head. Page 128

10:36 clojer: I 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:36 The SQL is correct and works via pgAdmin. How do I call getNextException? On which object?

10:37 I can call a (get-user .... OK from YeSQL but not an insert.

10:48 Resolved by wrapping (try ....... (.getNextException e))

11:20 crocket: I 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:24 pdk: sounds very raunchy indeed

11:25 crocket: pdk, sorry for the word 'indecent'

11:45 the_dude: Up to date clojure book recommendation?

11:49 schaueho: what are you looking for? gentle introduction? intermediate stuff? overview or specific topics?

12:06 zimablue: I'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:08 AimHere: Recommend 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:32 wasamasa: crocket: https://github.com/kovasb/gamma

12:32 crocket: look what I've found!

13:29 progrocker: thanksis there a way to run a method/function for every method call?

13:29 prior to calling teh method with the correct dispatch value?

13:56 justin_smith: ,(apropos "method")

13:56 clojurebot: (clojure.core/-reset-methods clojure.core/defmethod clojure.core/find-protocol-method clojure.core/get-method clojure.core/method-sig ...)

13:56 justin_smith: (doc get-method)

13:56 clojurebot: "([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:57 justin_smith: progrocker: actually, maybe what you want is a normal function, that does some f, and then calls your method on the arg

14:07 brainproxy: the-kenny: Clojure Programming, despite being 3 years old, should still be a good intro

14:07 while you're reading it, keep clojuredocs.org and/or clojure.github.io handy

14:08 justin_smith: brainproxy: the-kenny: everything in it will still work, but some of it has shiny new better performing alternatives now

14:08 brainproxy: justin_smith: okay, good to know re: everything still working

14:09 I read it back in 2012, just after it came out

14:09 the-kenny: brainproxy: Huh, when did I ask? :)

14:09 brainproxy: the-kenny: whoops, I meant to mention the_du

14:09 the_dude

14:09 ah, he left the channel

14:10 justin_smith: haha, yeah, I kind of figured the-kenny wasn't looking for a first clojure book

14:10 brainproxy: i just tab and went w/ weechat's autocomplete w/o double-checking

14:10 *hit tab..

14:10 the-kenny: Don't worry :)

14:25 Seylerius: Okay. I need some help getting my head around mikera's core.matrix.

14:32 justin_smith: Seylerius: first thing is that it defines things in terms of a protocol, and you need to pick some library that implements that protocol

14:32 similar to using clojure.java.jdbc then picking a driver for a particular sql version

14:37 Seylerius: justin_smith: Right. So, I'm going with NDArray for it.

14:37 Playing around with it in CIDER, and getting my head around it little bits.

14:37 justin_smith: cool

14:37 Seylerius: (Making a 3d sudoku solver)

14:37 Paying project, so it's kinda cool.

14:57 lvh: Hi :-) 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:59 justin_smith: lvh: that's your option, if secretary does not expose a function you could bind to a var yourself.

14:59 lvh: also #clojurescript may have more secretary specific info

14:59 lvh: justin_smith: I'll ask again there too

15:00 justin_smith: what do you mean by just binding to a var yourself?

15:00 @#'?

15:01 (Does that even work?)

15:02 justin_smith: lvh: you can assign something to a symbol without using def - let me take a moment to look it up

15:02 lvh: justin_smith: OK, thanks. I don't see how that works if secretary *doesnt* expose a fn, though

15:02 justin_smith: ~grim intern

15:03 clojurebot: Gabh mo leithscéal?

15:03 justin_smith: $grim intern

15:03 lvh: anyway, the function is called intern

15:03 it takes an ns symbol, a name symbol, and a value

15:03 so it's like def, but not a macro

15:04 so if secretary exposes a function that returns what defroute would bind, then you would be all set using intern in a loop

15:04 (doc intern)

15:04 clojurebot: "([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:06 lvh: justin_smith: Ah, I see, you're saying if it *DOES* expose a fn I could just use that

15:06 justin_smith: right, since you can use intern in a loop

15:06 unlike defroute

15:08 lvh: well, turns out secretary is small, and I just read the code, and you're out of luck

15:08 lvh: justin_smith: Yeah

15:08 justin_smith: That's cool, I just did the fairly obvious doseq -> for + `(...) ~a ~b macro thingy

15:09 justin_smith: yeah, it's too bad more libs don't create a function plus a thin macro wrapper though

15:09 macros are about syntax, not functionality, dammit

15:10 lvh: justin_smith: Yeah, I agree

15:14 Apparently `(some-ns/some-fn ...) is not a thing you can do? https://gist.github.com/lvh/8f3059832e2136e914f1

15:16 justin_smith: lvh: you'll need to cons a do on the front of that for

15:16 otherwise it will generate a call to the first result, with all the others as args

15:17 lvh: justin_smith: wait, just a (cons (for ...))? What am I consing it on to?

15:17 justin_smith: (cons 'do (for ...))

15:17 because otherwise you are generating a function call that you don't want

15:17 because it's a macro

15:18 lvh: ah, right

15:18 justin_smith: not that this helps your current issue

15:18 lvh: I forgot I'm supposed to create one form :)

15:18 justin_smith: I assume you checked the macroexpand output?

15:23 lvh: justin_smith: I didn't; my in-editor repl doesn't work with cljs until weasel cuts a release :/

15:24 also the default figwheel one doesn't seem to understand basic readline? (i.e. arrows don't work, C-k doesn't work...)

15:31 justin_smith: lvh: the macroexpand will work in clj

15:31 it's just the resolution of of the symbols if you actually ran the macro normally that would fail

15:32 ,(defmacro foo [x] `(bar ~(inc x)))

15:32 clojurebot: #'sandbox/foo

15:32 justin_smith: ,(macroexpand '(foo :a))

15:32 clojurebot: #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:32 justin_smith: ,(macroexpand '(foo 1))

15:32 clojurebot: (sandbox/bar 2)

15:32 justin_smith: so you need to get anything in a ~ properly implemented, but unresolved calls generated by the macro are fine

15:41 borkdude: brucehauman 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:41 brucehauman I am getting "goog.require could not find: figwheel.connect" inside my browser console now

15:41 brucehauman: borkdude: yep :)

15:42 borkdude: maybe I should try a lein clean

15:42 brucehauman: borkdude: make sure you do a good cleaning

15:42 borkdude: the connect script is now generated and required for you if you set :figwheel true in the compiler config

15:44 borkdude: brucehauman that's very cool.

15:44 brucehauman: borkdude: if you are still calling fw/start manually you can do that just don’t set the :figwheel value in build optoins

15:47 borkdude: brucehauman 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:49 kaiyin: http://stackoverflow.com/questions/30201930/mandelbrot-set-function-does-not-perform-as-expected/30278302#30278302 why is apply so slow?

15:51 wasamasa: don't abuse apply please, especially when there's a better function you can make use of

15:51 arohner: kaiyin: apply has to look up the fn at runtime, rather than jumping directly to the code

15:51 It wouldn't surprise me if it breaks JVM inlining

15:54 kaiyin: chas implies in his answer that there is a trivial fix for apply, do you know what he meant?

16:02 amalloy: kaiyin: just write (* x y z) instead of (apply * [x y z])

16:30 expez: "bounded by the generator's size paramter" Where can I read about setting this 'size param"?

16:51 tmtwd: if you have an instance of a repl and the source code up, can you modify the source code from the repl?

16:51 ie in cider

16:56 expez: tmtwd: modify your source file on disk form the repl? no

16:56 tmtwd: I see

16:57 socksy: well, in theory you could just write over the file and then reload the namespace, but that's probably not what you mean

16:57 tmtwd: So you can interact with the source from repl

16:57 But I mean, you can call

16:57 (js/alert "hello world)

16:57 from the repl and the browser does an alert

17:03 devn: So I was thinking about this partition and partition-all when step or n is not positive thing..

17:04 I 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:06 like (partition -2 -1 [1 2 3 4]) => ((4 3) (3 2) (2 1))

17:07 whodidthis: maybe it would be too weird to add that functionality while keeping the default use case lazy

17:08 devn: ah, yeah, good point

17:08 it gets funky when you're dealing with vectors and seqs, messing with it now

17:09 maybe 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:09 s/maybe/made

17:10 but you wind up with a bunch of special case nonsense

17:13 oh 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:14 you make the positive step in to 1, but it feels like maybe it'd be more correct to have it produce ((1) () () () ...)

17:14 since -1 from the initial positive step is nothing, just as is the case with n=0 step=0

17:16 i guess the same goes for inifinite repetition of the initial N for step=0

17:17 if 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:30 TimMc: gfredericks: I like the idea of a random number generator that is actually a constant number generator + a random number generator generator. :-P

17:32 gfredericks: TimMc: wat.

17:33 TimMc: watching the Purely Random talk

17:33 Calling rand-int on a given immutable splittable RNG always gives the same value, right?

17:33 so clearly it's a constant number generator

17:34 gfredericks: I suppose so

17:36 TimMc: and it also generates RNGs

17:36 but constantly :-)

18:13 ?

18:13 TEttinger: &(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:13 lazybot: ⇒ (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:15 TEttinger: it'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:16 I think that's what it does

18:16 $google halton sequence wikipedia

18:16 lazybot: [Halton sequence - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Halton_sequence

18:17 TEttinger: I think I screwed something up in that impl though

18:18 TimMc: TEttinger: Ah, "uniform random", got it.

18:19 TEttinger: not actually random, it fails all tests for randomness I think? but it seems random

18:20 TimMc: I've seen this used in graphics programs for generating noise.

18:20 TEttinger: the graphs of sobol sequences show a definite symmetry

18:20 some here https://en.wikipedia.org/wiki/Low-discrepancy_sequence

18:21 https://en.wikipedia.org/wiki/Sobol_sequence#/media/File:Sobol_sequence_2D.svg

18:23 andyf: gfredericks: 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:25 Trying 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:26 (inc gfredericks)

18:26 lazybot: ⇒ 137

18:32 gfredericks: andyf: oh have you not done lein plugins much?

18:33 like your problem is "I know how to do this in my project.clj but can't translate that into plugin-land"?

18:33 andyf: Figure out how lein plugins work? No, not much. Work on enhancing one (e.g. Eastwood)? Yes, quite a bit :)

18:34 gfredericks: ah right

18:34 you know how plugin functions take a project arg and can modify it before calling other tasks?

18:35 andyf: I saw that in the Leiningen docs yesterday, and saw where in lein-dynalint it calls leiningen's test function.

18:36 I 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:36 gfredericks: ah gotcha

18:36 sounds like you know as much as I do without me digging into it myself then

18:37 andyf: I figure as long as I document clearly how to do it, that will make it reasonably easy for others to do it, too.

18:37 even if there is no plugin to make it even easier.

18:38 :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:38 gfredericks: oh ha right

18:39 andyf: I guess if I want that, I should figure out how Leiningen plugins actually work :)

18:40 gfredericks: there 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:41 andyf: It 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:41 gfredericks: which it probably isn't :)

18:42 but yes agreed

18:42 TimMc: TEttinger: Neat.

18:42 gfredericks: andyf: I imagine at worst you can wire it up to write errors to a file eh?

18:42 andyf: Right 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:43 I haven't measured, but seems like that would reduce its performance cost.

18:43 gfredericks: andyf: 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:45 andyf: It 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:46 gfredericks: ah true

19:27 Seylerius: Weirdness. CIDER's reporting that it's unable to resolve "difference" as a symbol

19:27 justin_smith: Seylerius: clojure.set/difference

19:27 it's not in clojure.core

19:28 Seylerius: Oh!

19:29 justin_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:30 justin_smith: how densely filled do you expect the matrix to get?

19:31 Seylerius: justin_smith: I'm making a cube-doku solver.

19:31 justin_smith: or, so very full

19:31 Seylerius: Yep

19:32 justin_smith: weren't you just going to use core.matrix?

19:33 Seylerius: justin_smith: Yep. My question is this: do I mutate my cube repeatedly, or do I return new ones?

19:33 justin_smith: shouldn't that be up to your implementation??

19:33 lazybot: justin_smith: Uh, no. Why would you even ask?

19:34 Seylerius: Hah.

19:34 justin_smith: lazybot, are you an annoying idiot???

19:34 lazybot: justin_smith: Yes, 100% for sure.

19:36 Seylerius: I'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:38 justin_smith: Plus, the mutability functions are very poorly documented, and I don't know if they're even allowed in the NDArray implementation.

19:42 Why is this failing with an Illegal State Exception? http://ix.io/iB6

19:43 justin_smith: is http://ix.io/iB6 the wrong way to get the clojure.set functions into easy usability?

19:44 justin_smith: ~use

19:44 clojurebot: use is don't use use.

19:44 justin_smith: Seylerius: require with an :as clause is almost always preferred

19:45 because, among other issues, what happens if two namespaces you want to call define vars with the same names

19:54 Seylerius: I think core.matrix may define some symbols that are in clojure.core, and the compiler may not like it

20:06 Seylerius: justin_smith: Makes sense.

20:06 I'll switch 'em both to require then

20:17 justin_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:18 justin_smith: bad namespace form?

20:18 Seylerius: Even without namespace fun.

20:18 Illegal Argument Error

20:18 justin_smith: C-c C-k requires being able to load the ns form afaik

20:19 I 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:20 Seylerius: justin_smith: This code (http://ix.io/iB8), when compiled, got this error (http://ix.io/iB7).

20:21 justin_smith: Seylerius: constraint-sheet needs []

20:21 you can't do a defn without a param vector

20:21 that's what that error is saying

20:22 also, set-current-implementation should probably be matrix/set-current-implementations

20:22 without the s, sorry

20:22 also, the definition of blank-square needs to be above the definition for sample-2d

20:24 Seylerius: Oh, snap, I forgot that I wasn't done with constraint-sheet

20:28 There any good guides on using Java gui crap in Clojure?

20:29 I'm going to need that once I'm done with the algo here.

20:29 TimMc: gfredericks: Great talk!

20:29 Seylerius: TimMc: gfredericks did a talk?

20:29 * Seylerius has not paid enough attention.

20:30 TimMc: A bit back: https://www.youtube.com/watch?v=u0t-6lUvXHo

20:32 wei: what’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:32 Seylerius: TimMc: That looks shiny. I'll have to watch it later. Randomness and crypto are kinda minor obsessions of mine.

20:33 Also...

20:33 (inc gfredricks)

20:33 lazybot: ⇒ 1

20:33 Seylerius: (inc gfredericks)

20:33 lazybot: ⇒ 138

20:33 Seylerius: Just for doing that talk.

20:33 And btw, justin_smith, thanks for all the help.

20:33 (inc justin_smith )

20:33 lazybot: ⇒ 11

20:43 justin_smith: (identity justin_smith )

20:43 lazybot: justin_smith has karma 11.

20:43 justin_smith: (identity justin_smith)

20:43 lazybot: justin_smith has karma 253.

20:44 justin_smith: oh man so close to having palendromes for both at once

20:44 (identity justing_smith)

20:44 lazybot: justing_smith has karma 0.

20:49 TimMc: (dec justin_smith)

20:49 lazybot: ⇒ 252

20:50 TimMc: \o/

20:50 savor it before I inc you

20:50 justin_smith: (inc palindromes)

20:50 lazybot: ⇒ 1

20:50 TimMc: (inc justin_smith)

20:50 lazybot: ⇒ 253

21:22 gfredericks: TimMc: oh hey thanks

22:26 crocket: When does clojure's dynamic typing get in the way?

23:01 raspasov: crocket: when you don't use {:keys [k1 k2 ...]} destructuring : )

23:07 crocket: Destructuring is called pattern matching in SML.

23:08 SML types are strong and static

23:08 Clojure types are strong and dynamic.

23:08 Java types?

23:21 timvisher: wow. TIL. `boolean?` is not a thing...

23:21 how would you check if something is `true` or `false`? hopefully something better than `(#{true false} var)`?

23:23 amalloy: ,(let [boolean? (comp (partial apply =) (juxt identity boolean))] (map boolean? [1 true false]))

23:23 clojurebot: (false true true)

23:23 amalloy: timvisher: ^ the worst answer

23:23 timvisher: heh

23:24 seriously though. there's nothing like what i would expect `boolean?` to be? is there anyting even in interop?

23:24 i can't remember from my java days :)

23:24 metellus: timvisher: maybe or true? and false?

23:24 timvisher: metellus: right. but that's no better than my #{true false}

23:24 amalloy: timvisher: (partial instance Boolean)

23:25 timvisher: #{true false} is not a correct implementation

23:25 so his was better

23:25 timvisher: amalloy: that's more what i was looking for maybe :)

23:25 amalloy: whoa. you're blowing my mind. :)

23:25 what else is Boolean?

23:25 amalloy: &(let [boolean? #{true false}] (map boolean? [1 true false]))

23:25 lazybot: ⇒ (nil true false)

23:26 amalloy: presumably you want (boolean? false) => true

23:26 timvisher: indeed... let me wrap my head around that...

23:26 why is `false` not 'in' that set?

23:27 amalloy: timvisher: you are misunderstanding what sets do when called as functions

23:27 timvisher: clearly

23:27 i thought they tested for membership, what do they actually do?

23:27 amalloy: you imagine they are doing the thing that i wish they did, but they actually don't

23:27 they return the item, if it's present

23:27 and otherwise nil

23:28 timvisher: oh wow. heh. and in this case i then return a falsey value, which would fail as a predicate... lol.

23:28 oh the cleverness of me...

23:28 i like the `(partial ...` solution then

23:29 ,(map (partial instance? Boolean) [1 true false])

23:29 clojurebot: (false true true)

23:29 timvisher: is there a reason this isn't in core?

23:29 amalloy: the HOFs are not really that exciting. i'd just (defn boolean? [x] (or (true? x) (false? x)))

23:29 if you wanted to use a HOF i'd actually use (some-fn true? false?)

23:29 since that works on other platforms

23:31 * timvisher $ wtf HOF

23:31 timvisher: :)

23:33 HOF: nothing appropriate

23:33 there's so much i don't know

23:33 so exciting

Logging service provided by n01se.net