#clojure log - Oct 20 2014

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

0:36 justin_smith: rritoch: (alter-var-root #'*somevar* (fn [old-val] ...))

0:36 rritoch: it takes a function as an argument, but you can use (constantly :foo) to just return that value no matter what the previous value was

1:19 kenrestivo: i have to do a bunch of mutable crap, like .remove'ing stuff from a java arraylist. i naively tried to doseq on it, and got a concurrent exception. what's the right way to do this? loop/recur?

1:20 or use clojure seq functions like filter and then convert it back to an arraylist somehow before returning?

1:31 hmm, this is ugly. this clojure function is running inside a callback of a java library. i may be screwed.

1:37 amalloy: kenrestivo: you can't modify a list while iterating over it: your iterator breaks

1:37 kenrestivo: i noticed that :-/ any alternatives?

1:38 amalloy: one other approach is to iterate over the list, make some decisions; then when you're done you implement all the decisions

1:39 (doseq [removal (doall (filter get-rid-of? xs))] (.remove xs removal))

1:39 kenrestivo: cool, thanks. so i can iterate over a seq of decisions, but not over the actual arraylist itsef

1:39 amalloy: right

1:39 and be careful of laziness, as my example is

1:40 kenrestivo: noticed the doall, yes

1:40 rritoch: kenrestivo: Check out iterator-seq, that is probably what you really want http://clojuredocs.org/clojure.core/iterator-seq

1:42 kenrestivo: in this case, the arraylist appears to implement seq via that mechanism already. i'm being bitten by a different thing, and amalloy's device seems like it'll work. trying now.

1:42 amalloy: rritoch: no, java collections are iterable

1:42 ie, you already have something iterable, you don't have to work with something as clunky as a bare iterator

1:44 justin_smith: does cljs have amap?

1:44 oh, but removing things is a no go in amap probably

1:45 rritoch: amalloy: I don't see the problem with (doseq [item (iterator-seq (.iterator myarraylist))] ...

1:45 justin_smith: kenrestivo: what about reducing over the array building a collection of items to remove, and then removing them as a separate step?

1:46 rritoch: iterable only means it exports iterator, it doesn't do anything to allow it to be processed as a sequence

1:46 exports = implements method

1:47 amalloy: rritoch: it is the same as the original problem. (iterator-seq (.iterator xs)) is not any different from just xs

1:47 all of clojure's sequence functions operate on iterables

1:47 kenrestivo: done. it worked, thanks!

1:48 amalloy: or rather, seq works on iterables

1:48 kenrestivo: one of the joys of using a hosted language... for those of us without a deep background in the hosting language.

1:53 amalloy: kenrestivo: what is one of those joys?

1:58 learn2code: hi

1:59 is there anyone has exp with overtome/at-at

1:59 I have a question about it

2:00 justin_smith: learn2code: I have used overtone a bit, but not at-at

2:00 but ask your question anyway, it could be something someone with general clojure experience could answer

2:00 learn2code: yeah, what i am trying to do is try to call the server every 1 min

2:01 i look at the at-at in github

2:01 I can do the example there

2:01 but when I apply to my function

2:01 it doesn run

2:01 justin_smith: what is your function?

2:01 learn2code: can I type it here

2:01 to see

2:02 justin_smith: use a paste bin if it's more than a one liner

2:02 learn2code: sorry, I am a new in IRC

2:02 justin_smith: np

2:02 refheap.com is good

2:02 learn2code: thanks, wait 1s

2:06 https://www.refheap.com/27d7b8fd0de929a4bda8e09fb

2:06 something like this

2:06 it's very simple now

2:10 opps, I have extra ")" at the end

2:10 and I rename the at-at as schedule in my main function

2:11 it does run

2:11 but the problem here is it just prints "0" once!

2:12 as I understand, it should print "0" every 1s

2:18 justin_smith: learn2code: that will try to run once, and it will throw an exception

2:19 println returns nil

2:19 the extra parens mean that it will attempt to call nil as if it were a function

2:20 that will throw an exception, and likely prevent the rescheduling

2:20 TEttinger: yeo

2:20 learn2code: so, how can I chnage it

2:20 TEttinger: ,(#((println (+ % %))) 5)

2:20 learn2code: ???

2:20 lazybot: learn2code: Oh, absolutely.

2:20 clojurebot: 10\n#<NullPointerException java.lang.NullPointerException>

2:21 justin_smith: learn2code: remove the extra set of parens

2:21 TEttinger: ,(#(println (+ % %)) 5)

2:21 clojurebot: 10\n

2:21 justin_smith: #((let ...)) -> #(let ...)

2:21 TEttinger: yep

2:21 (inc justin_smith)

2:21 lazybot: ⇒ 98

2:22 learn2code: yeah :v

2:23 when I have extra ()

2:23 it does run once

2:23 and hang there without any exception

2:23 TEttinger: and then it returns nil, and calls nil as a fn, and crashes that silently

2:24 at-at is likely doing some try-catch thing to capture exceptions

2:24 learn2code: thanks justin_smith and TEttinger :D

2:24 TEttinger: np

2:26 learn2code: there is one more question

2:27 nvm, i got it

2:35 justin_smith: learn2code: likely the code that would have re-scheduled your task was prevented from running because of the exception, and since it wasn't in the main repl thread it did not print the stack trace of the exception (though if you had used try/catch yourself you could have made it do so)

2:38 learn2code: thanks for your advice, I will remember to use try/catch from now on

2:40 justin_smith: learn2code: I find if I am doing something in a thread, and I don't understand what went wrong, a try/catch with a clear error message print out will quickly get me on the right track

2:40 dysfun_: what function does ` expand to?

2:40 justin_smith: dysfun_: there isn't one, sadly

2:40 dysfun_: well, special form, rather

2:41 justin_smith: it is known as syntax-quote

2:41 dysfun_: but there isn't a non-reader form for it?

2:41 justin_smith: I think tools,macro has a function version

2:41 but nothing official that I know of

2:42 dysfun_: this isn't terribly encouraging. it means that in order to feed clojure valid clojure code that uses syntax-quote, i'm going to have to feed it a string

2:42 justin_smith: weird, huh

2:42 dysfun_: i can just use (list 'quote form) to construct a quoted form

2:43 justin_smith: right, but not so for syntax-quote

2:43 ,''form

2:43 dysfun_: syntax-quote is too useful to not support :(

2:43 clojurebot: (quote form)

2:43 justin_smith: dysfun_: I know, it sucks

2:43 dysfun_: is the work actually done in the reader then?

2:44 that might help to explain why the code for the reader is huge

2:44 justin_smith: Bronsa or arrdem could tell you a lot more than me. Or puredanger.

2:44 * dysfun_ wonders if anyone with such knowledge is awake

2:45 dysfun_: this seems very un-lisp too

2:45 justin_smith: this is Bronsa's big project https://github.com/clojure/tools.analyzer.jvm

2:46 I had a hope it might interact with syntax-quote itself, but looks like that is outside the scope

2:47 dysfun_: hrm, i have a cunning idea

2:48 if i use a macro at the top level, it can expand into code that includes a lambda that contains code that (ab)uses the reader, so syntax will be resolved in the correct namespace

2:48 justin_smith: that may be the way to do it

2:49 there could be something in clojure.tools.macro that would make this more sane

2:49 https://github.com/clojure/tools.macro/blob/master/src/main/clojure/clojure/tools/macro.clj

2:49 dysfun_: this seems like an odd limitation

2:50 hrm, deftemplate might be handy

2:51 otherwise i'm going to have to embed a clojure reader within my custom reader and this seems like overkill

2:55 hrm, i can postprocess. that might be a valid option

2:57 justin_smith: best of luck, I'm turning in

3:04 dysfun_: heh

3:05 matt_d: dysfun_: Yup.

3:05 dysfun_: okay, so i think i'm going to have to construct the code data structure and then turn that back into a string once i'm done manipulating it. and then pass that to clojure

3:05 probably by writing out a tmpfile

3:06 luxbock: dysfun_: what are you working on?

3:06 dysfun_: a syntax sugaring reader for clojure

3:06 luxbock: so you can write Clojure with an alternative syntax?

3:07 dysfun_: exactly

3:07 luxbock: cool, was just curious :)

3:07 dysfun_: this is draft 1 of the syntax if you're still curious http://paste.scsys.co.uk/432825

3:07 well, that's some clojure i rewrote into it

3:09 i've taken the opportunity to go overboard because it's fun, so i've added fexprs and infix parsing

3:09 it would have been nice to just return a data structure to clojure and eval it

3:11 one major obstacle right now is there isn't a syntax for java classnames with a dot in them except in imports because we've stolen it for infix function application

3:12 does clojure do laziness on regex matching results?

3:13 TEttinger: classnames with a dot? like inner classes?

3:13 inner classes use $

3:13 dysfun_: package-qualified classes

3:13 or indeed packages

3:14 i thought about using '..', but that's fugly

3:15 i'm liable to settle for some prefix operator that says it's a qualified classname

3:16 TEttinger: the / is a weirdly taken character already

3:16 since it's already used for accessing static members, but also division

3:16 and of coure, ##(* 1/2 3/5)

3:16 lazybot: ⇒ 3/10

3:28 dysfun_: yep. i just behave as the clojure reader does. you can't start a symbol with it, but you can continue one with as many as you like

3:28 i'm not trying to rewrite clojure here, just the reader

3:30 amalloy: dysfun_: it doesn't sound like just the reader, if you're translating record into defrecord

3:31 that has to be a part of the compiler: your reader can't know what contexts that transformation is appropriate for

3:34 dysfun_: that was me playing. but it can be done with fexprs, just replace () with {}

3:34 the fexpr implementation is actually based on macros, of course

3:37 effectively, rather than exposing reader macros, i've just defined a few of my own that happen to do more complex processing, as part of the reader

3:38 as you can see, what would be a symbol to clojure could be a number of forms to this http://paste.scsys.co.uk/432826

3:38 rritoch: How can you compile the results of load-reader? I have a case where I'm loading a "remote" resource which has a gen-class and I need to compile it but I don't know ahead of time what namespace the resource represents though I can possibly guess based on the URL

3:39 The actual code is (load-reader (InputStreamReader. (.openStream (.toURL r)))) but I'm getting a class not found exception when I attempt to create an instance of the class defined in the remote resource.

3:41 dysfun_: eval?

3:41 clojurebot: eval is evil

3:41 dysfun_: that too :)

3:43 kenrestivo: ,(clojure.string/reverse "evil")

3:43 clojurebot: "live"

3:44 dysfun_: that three :)

3:49 pdmct: Hi, how can I do a merge-with with default values? eg, something like (merge-with-default "0" (s/join ",") {:a "1" :b "2"} {:b "3" :c "4"}) gives {:a "1,0" :b "2,3" :c "0,4"} -- is there such a beast?

3:52 schmir: pdmct: fnil may help

3:52 ,doc fnil

3:52 clojurebot: #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.repl/doc, compiling:(NO_SOURCE_PATH:0:0)>

3:52 LauJensen: Clojurescript question: (defn tst [b] (aget b 5)) compiles to "return (b[(5)]);" - How do I avoid the parens around the 5?

3:52 schmir: ,(doc fnil)

3:52 clojurebot: "([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched."

3:53 dysfun_: you could do that with reduce-kv fairly easily

3:53 pdmct: schmir: thanks I will take a look

3:53 ,(doc reduce-kv)

3:53 clojurebot: "([f init coll]); Reduces an associative collection. f should be a function of 3 arguments. Returns the result of applying f to init, the first key and the first value in coll, then applying f to that result and the 2nd key and value, etc. If coll contains no entries, returns init and f is not called. Note that reduce-kv is supported on vectors, where the keys will be the ordinals."

4:02 dysfun_: actually, if you do that you'll have to process the remaining keys on the right hand side

4:03 rritoch: I checked the return value of load-reader and it's returning a symbol which refers to the last method defined, I'm not sure if I can compile that directly or if I need to resolve it but it may be enough to avoid eval.

4:05 dysfun_: (reduce (fn [acc k] (assoc acc (str (or (left k) "0") \, (or (right k) "0")))) {} (set/union (keys left) (keys right)))

4:05 or something like that

4:05 er that should be clojure.set/union

4:05 and you might need to cast it to a set first

4:11 SagiCZ1: hi, can i defmethod in a different namespace than where corresponding defmulti was called?

4:13 pdmct: dysfun_: thanks I'll take a look at that too

4:13 dysfun_: SagiCZ1: yes, but you will need to either qualify it or import it

4:14 pdmct: schmir: fnil doesn't seem to work as I don;t think the function gets called if the keys aren't in each map

4:14 schmir: (merge-with (fnil (fn [x y] (clojure.string/join "," [x y])) "0") {:a "1" :b "2"} {:b "3" :c "4"}) --> {:c "4", :a "1", :b "2,3"}

4:14 dysfun_: (merge-every-with) would be a handy macro, now i think about it

4:16 er utility function

4:21 visof: hi

4:21 is this line val conf = new SparkConf().setMaster("local[2]").setAppName("NetworkWordCount"); eq to (.setAppName (SparkConf/setMaster "local[2]") "HelloWorld")) ?

4:22 rweir: did you want #scala

4:22 amalloy: no, visof. you're never constructing the SparkConf

4:22 rweir: to ask them about translating java to clojure?

4:22 schmir: pdmct: oh, sorry. you probably shouldn't trust random people on the internet. at least you did learn about fnil :)

4:23 rweir: ah

4:23 TEttinger: (.setMaster (SparkConf.) "local[2]")

4:23 like this?

4:23 amalloy: (.setAppName (.setMaster "local[2]" (SoarkConf.))) is the most literal translation

4:23 TEttinger: amalloy, order may be wrong

4:23 amalloy: but (-> (SparkConf.) (.setMaster "local[2]") (.setAppName "HelloWorld")) is a lot nicer

4:24 pdmct: schmir: yeah probably, but thanks I did learn about fnil

4:24 amalloy: TEttinger: no, i did it in the same order

4:24 TEttinger: (.setMaster "local[2]" (SoarkConf.)) is what I mean

4:24 amalloy: i did, however, forget the "hello world" argument, and misspelled spark

4:24 oh

4:24 SagiCZ1: (doc fnil)

4:24 clojurebot: "([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched."

4:24 amalloy: man, my first version is total garbage, yeah

4:24 TEttinger: (inc amalloy) ;for the second version

4:24 lazybot: ⇒ 175

4:25 schmir: (though you could still use the fnil'ed function when iterating over the keys).

4:26 SagiCZ1: what is that fnil for i dont get it

4:34 schmir: SagiCZ1: default arguments. I"ve used this together with update-in and providing a default value for a non-existent key

4:34 ,(update-in {} [:foo] (fnil conj []) :baz)

4:34 clojurebot: {:foo [:baz]}

4:41 dysfun_: pdmct: http://pastebin.com/fXYqFHJF

4:41 make sure that your function takes the right number of args (or is variable arity)

4:42 * dysfun_ adds to his utility library

4:42 pdmct: dysun_: thanks, works a treat

4:43 dysfun_: well yeah, i've tested it and everything :)

4:43 it may already exist in 'useful' anyway

4:44 but it seemed like an interesting enough thing to do intellectually

4:47 pdmct: updated with a check to behave better http://pastebin.com/ybc4UvLC

4:49 visof: i should use this (:import (org.apache.spark.*)) to import ?

4:52 dysfun_: lose the .*

4:53 but it would be good practice to name then and use prefixing (org.apache.spark Foo Bar Baz Quux)

4:55 visof: dysfun_: .* should work?

4:56 dysfun_: it's not something i do myself, but i think you just don't put .* on the end

4:59 okay, you end it with a .

5:00 ,(import '(java.lang.))

5:00 clojurebot: nil

5:03 visof: dysfun_: i guess it doesn't work?

5:03 dysfun_: that i can't answer

5:04 visof: hey guys, how can i import using '*' ?

5:04 or i can't do this?

5:05 dysfun_: are there so many classes you can't use prefixing and import them individually?

5:05 it sounds like this is begging for a convenient clojure wrapper

5:07 clgv: visof: that is not possible afaik

5:08 ,(import '(java.util.))

5:08 clojurebot: nil

5:08 clgv: ,List

5:08 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: List in this context, compiling:(NO_SOURCE_PATH:0:0)>

5:08 clgv: so `import` just isn't throwing ;)

5:08 ,(import 'java.util.)

5:08 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: java.util.>

5:08 clgv: ,(import 'java.util)

5:08 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: java.util>

5:09 clgv: ah right so that's because you have a prefix and no element for the syntax (import '(ns-prefix class1 class2)) ;)

5:09 visof, dysfun_: ^^

5:13 noncom: visof, clgv: https://groups.google.com/forum/#!topic/clojure/-gCg_0wmT5o

5:13 from good old times when rich was accessible..

5:14 clgv: noncom: yeah, I think that was linked on IRC several times already ;)

5:21 vijaykiran: "This seemingly beneficial property actually exacerbates the hierachical issue and often leads to an incredible amount non-modular programming"

5:21 wondering how difficult it is to parse for non-native english speakers

5:22 * vijaykiran is referring to https://groups.google.com/forum/#!topic/clojure/I8-kYj-eKBs

5:27 rritoch: dysfun_: I finally solved part of my problem for compiling remote resources when using (load-reader), I just had to bind *compile-files* as true when calling load-reader. In this particular case since I"m inside an OSGi instance I still have some class-loading problems to work out, but it is a big step closer.

5:32 amalloy: vijaykiran: i'm curious why that matters. it's written in english, for an english-speaking audience. are you just interested out of curiosity?

5:32 Rhainur: I would say that decent English skills are a requirement for being a software developer

5:33 writing documentation, naming things, explaining things, communicating with the dev community at large

5:33 dysfun_: i would say that non-english speaking japanese ruby programmers that produce awesome things disagree with that

5:33 and there are loads of them

5:34 Rhainur: dysfun_: for example?

5:34 dysfun_: not speaking japanese myself, i have little cause to rememberthem

5:35 also, rarely programming ruby

5:35 Rhainur: if you want your library/code to be used by the dev community at large, documentation and an API in english is a requirement, surely.

5:35 I'm not saying you can't program if you don't know english

5:40 dysfun_: well it maximises your audience, sure

5:40 but there's a difference between being able to read and being able to write english

5:41 you need to be able to write it for people to use your stuff, but you only need to be able to read it if the docs are in english

5:43 ddellacosta: dysfun_: I've worked in a Japanese company w/Japanese developers and most of them need at least some English ability if they want to read up-to-date documentation (for example).

5:44 dysfun_: for better or for worse Japanese developers can remain somewhat isolated in their own bubble, but usually it's to their detriment, and most Japanese devs I've met actively want to get better at English, communicate with English-speaking developers, and use English professionally

5:46 ...and one talk that Matz gives is explicitly about how he wrote the docs for Ruby in English--even though he knew he sucked at it--because he wanted to grow as a developer and person. So it's definitely recognized that English skills = access to the broader dev community

5:47 rritoch: Rhainur: The main reason english skills are required for programming is that most languages pre-date Unicode, and initially only supported ANSI encoded source files.

5:47 Rhainur: rritoch: I specifically tried to use the term "software development" rather than programming

5:48 I don't think it matters what language you use if you're doing the kind of stuff that Project Euler is all about or the ACM programming contest or whatever

5:49 I'm talking projects that need to last for a long time and need to be maintained by multiple people or need to be used by thousands/millions of people

5:49 you absolutely have to agree on a language and English is the richest by far when it comes to technical terms

5:49 dysfun_: ddellacosta: i don't disagree. but in my experience devs generally would like to be able to speak other language

5:49 Rhainur: I've worked with developers from all around the world and even when they speak in their native tongue they drop into english for technical terms

5:49 ddellacosta: dysfun_: don't follow

5:50 dysfun_: Rhainur: when i worked at nokia, they spoke 'finnglish'. lots of terms just don't have finnish names, so you'd get terms like "failing test case" injected into the middle of a finnish sentence

5:51 ddellacosta: there's a correlation between liking programming and liking linguistics. is it specific to the japanese at all? my guess is not.

5:51 ddellacosta: dysfun_: now you've totally lost me

5:51 dysfun_: admittedly their language is very different

5:51 nevermind :)

5:51 ddellacosta: dysfun_: I thought we were talking about why English is the Lingua Franca (love that term...the irony is amazing) of software development?

5:52 dysfun_: oh. right, i was suggesting that "most japanese devs" wanting to be better at english is probably common to most nationalities

5:52 and english devs wanting to learn other languages

5:52 hellofunk: any Om users clarify why the docs for om/build and build-all removed mention of "cursor" and replaced with "value" -- we no longer have to pass actual cursors into the app state?

5:52 ddellacosta: dysfun_: oh, if that's your point I totally agree 100%

5:52 Rhainur: ddellacosta: fun thing, the language spoken by the elite in Ancient Rome wasn't Latin, but Greek, because that's what the literature they studied was written in

5:53 dysfun_: perhaps for non-english langs, there's more of a desire for it to be english because it's the lingua franca, but apart from that, i think it's nothing specific

5:53 ddellacosta: Rhainur: ah, makes sense! Definitely interesting

5:53 hellofunk: I dunno, but as far as I know a cursor is still required

5:53 Rhainur: dysfun_: yes but I'd say learning English is an essential part of being a dev

5:53 ddellacosta: hellofunk: but two things you can do: 1) try it, and 2) check the code. ;-)

5:53 dysfun_: never say never, but you'd find dev a lot harder if you couldn't tap into all the english code out there

5:54 ddellacosta: yeah, seriously

5:54 Rhainur: even if your var names and docs are in your native language

5:54 hellofunk: ddellacosta a lot of things in Om work even if they are not advised. So the docs help clarify these matters.

5:54 Rhainur: just knowing what "template" or "variable" means

5:54 ddellacosta: it's always a bit of a shock to me when I see code written with names from Spanish or German or something, or comments in Japanese--reminds me of how much of a bias I have

5:54 Rhainur: or to be honest, reading the answers on StackOverflow for your problem :P

5:55 how can you develop ANYTHING without SO @_@

5:55 ddellacosta: hellofunk: oh, definitely! I don't disagree--just saying, when in doubt, check the code and/or try it.

5:55 dysfun_: but it turns out that people are remarkably good trial-and-error machines, so it's entirely possible

5:55 ddellacosta: hellofunk: additionally, if you do figure it out, update the Om docs--anyone can I think

5:55 hellofunk: (alternatively post on the mailing list if no one here knows, dnolen responds there pretty regularly)

5:56 hellofunk: ddellacosta - there was a recent update to the Docs by Nolen where he specifically noted in the commit notes that he removed all language referring to "cursors" for those functions but offered no additional details

5:56 Rhainur: dysfun_: well yes but that's the equivalent of saying you don't need high level languages because you can write apps in ASM :P

5:56 ddellacosta: hellofunk: ah, okay--you're ahead of me then. I don't remember hearing that.

5:56 Rhainur: it makes your life so much easier if you learn the tools you need for your job

5:56 and I'd say that if you're doing software dev, English is one of those tools

5:56 ddellacosta: hellofunk: curious that he did that, maybe he wants to shed the term "cursor" at some point? huh

5:57 hellofunk: ddellacosta but it was only and specifically for those functions that he removed the term "cursor" so i suspect they have been updated in some way

5:57 ddellacosta: huh

5:58 hellofunk: well, it's curious to me because he just announced the 8.x alpha with reference cursors, and I'm pretty sure that "cursor" was emphasized there

5:58 certainly "cursor" is all over the codebase

5:59 hellofunk: ddellacostas: exactly. except, in the case of build and build-all for which they no longer document the requirement for cursors

5:59 ddellacosta ^

5:59 ddellacosta: there is only one of me :-p

5:59 dysfun_: Rhainur: well, almost nothing massive happens without the network effect, so *shrug*

5:59 ddellacosta: hellofunk: seriously though--yeah, I dunno

6:00 hellofunk: seems like it may be worth posting on the mailing list

6:09 rritoch: Grumble!

6:09 dysfun_: binding *compile-files*, while it compiled the class, it didn't compile the initializer *__init.class

6:10 Any ideas?

6:10 dysfun_: nope

6:11 rritoch: I have a feeling I'm going to have to dig alot deeper into the clojure compiler to find a solution to this one :(

6:11 It is just very wierd because all of the method classes where generated

6:15 The only missing classes are the __init.class and a *$fn_##.class

6:17 dysfun_: yeah, it sounds pretty odd

6:17 rritoch: Yeah, I've never really paid much attention to all of the classes that get generated when you compile. For this test case I have a locally compiled version to test against the remote compiled version

6:18 dysfun_: interesting

6:18 if you figure out what's going on, i'd be interested to hear about it

6:18 rritoch: This $fn__##.class is showing up in all of the AOT compiled classes that were compiled with leiningen

6:19 dysfun_: are you compiling with :aot ?

6:20 :gen-class requires ahead of time compilation

6:21 rritoch: I compiled locally with :aot, but I also have them remotely setup where I'm using (binding [*compile-files* true] (load-reader (InputStreamReader. (.openStream (.toURL r)))))

6:21 dysfun_: can you try calling gen-class yourself

6:21 er, you can

6:23 rritoch: Hmm, that sounds like a good idea. If I can hunt down the source code leiningen is using to generate these classes that may solve these missing classes..

6:24 This is actually just a failback mechagnism I'm building, most of the time these classes should already be available from the classloader, but when the class doesn't exist it attempts to load and compile it from a remote "repository".

6:25 It will be VERY slow, but mildly better than the application crashing.

6:28 dysfun_: yes, but loading is a one time deal

6:28 i hope your jobs are long running

6:29 rritoch: It is a web application, clojure+osgi+tomcat, so it isn't long running, but once the missing classes are compiled to WEB-INF/classes it should be a smooth process

6:30 Probably only slow for the first web request

6:35 dysfun_: it sounds utterly insane and prone to failure, but also really interesting

6:35 vijaykiran: amalloy_: I'm not criticising, just wondering - because it took time for me to understand -given that English isn't my native lang.

6:35 dysfun_: for instance, what do you do when the network goes away?

6:36 Aidos: Hello everybody. Can i development on Clojure with Oracle Database and Weblogic ???

6:36 lazybot: Aidos: Yes, 100% for sure.

6:36 dysfun_: modelling it as a promise with a retry loop seems like a tidy approach

6:37 rritoch: Normally you don't have web requests when the network is away, but anything like "partial browsing" where not all sites are reachable would lead to error conditions, which for tomcat is a server 500 error page.

6:37 Aidos: What the Lazybot?))

6:37 dysfun_: you might have two networks and one goes out

6:37 internal network and external

6:37 that's pretty common

6:37 well, the outage less so, but two networks is common

6:39 rritoch: Once these are compiled (correctly) to the WEB-INF/classes the remote resources won't be needed anymore

6:40 But in your example, if you deploy while the network is partially down the system would stay in server 500 errors until the network returned.

6:41 dysfun_: what purpose does doing all of this serve, btw?

6:41 rritoch: Once I get this working I'll look into issuing bad-gateway or something more accurate for that situation, but first I need the basic proof-of-concept to function.

6:41 dysfun_: grid deployment

6:41 Taking a clojure application and automatically deploying it to thousands of "clones" which handle the incoming web requests

6:42 At least thats the theory

6:42 dysfun_: i could have sworn we had puppet for this sort of thing

6:42 hellofunk: rritoch isn't that how Heroku works with clojure web apps and their "dynos" ?

6:42 dysfun_: build a jar, replace it, restart processes individually

6:43 hellofunk: "dynos" are just processes. you can just restart them

6:55 rritoch: Browsing through clojure.core sources I still don't see why these classes are missing, it must really be something in the clojure.lang.Compiler java class.

6:57 I'm going to try dropping :aot from the local copy and compile from repl manually to see if the __init is missing when using the compile function

6:58 dysfun_: may be in RT as well.

6:59 'ag'/'ack' is quite handy

7:01 rritoch: Well, using lein repl, and calling compile manually does generate the *__init.class

7:01 dysfun_: curious

7:02 rritoch: And (resolve 'compile) returns #'clojure.core/compile so this excludes leiningen

7:03 dysfun_: unless it's rebound some dynamic var that affects compilation?

7:03 rritoch: dysfun_: That is possible also

7:04 dysfun_: and it could be either lein, or nrepl

7:05 rritoch: dysfun_: Fundamentally though the only difference I see between (compile) and (load-reader) seems to be the *compile-files* binding which I have set.

7:07 I actually just found a major fundamental difference between compile and load-reader

7:08 dysfun_: oh?

7:08 rritoch: I missed it because it's just the namespace. Compile ultimatly calls clojure.lang.RT/load while load-reader calls clojure.lang..compiler/load

7:08 dysfun_: right. and you wanted the former?

7:09 no, the latter

7:09 rritoch: That seems odd, maybe I need to plugin to RT instead of the compiler to get these missing functions.

7:09 err classes

7:10 I just want the missing __init.class file and the *fn*.class file that are missing so these objects will load, I don't fundamentally care if it is done by RT or the Compiler, as long as it happens

7:10 perplexa: hello

7:10 rritoch: Ive never needed to dig into the compiler before, so this is a big "learning experience".

7:12 dysfun_: the reader is pretty terrifying too

7:13 perplexa: when i have a function, which allows passing parameters via :keywords, and i want to intercept+modify that, would the cleanest way be to check if &args has :keyword be using .indexOf and then modify the returned index+1 or is there something builtin?

7:14 rritoch: Well, I just confirmed that RT creates the *__init.class file

7:14 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L414-L415

7:15 dysfun_: there you go then. so call clojure.lang.RT/load then?

7:15 rritoch: I can't do that without caching the file locally

7:16 I'd prefer to do this all in RAM if possible, at least until the final writing of the needed classes.

7:16 dysfun_: because of clojure versions?

7:16 rritoch: No, justbecause RT/load doesn't accept a reader, it only accepts a path to a local file.

7:17 dysfun_: oh. well you can write to tempfiles

7:17 leiningen does that

7:18 or possibly nrepl

7:24 rritoch: I'm not sure, As far as I can tell RT is only providing classloading, it didn't actually create the __init file, it was just using __init to determine if the source was modified. It is ultimatly calling the same Compiler/load method converting the filename into a InputStreamReader

7:25 It seems this RT/load ensures that compile only happens when needed

7:26 So there still must be something in Compiler/load that generates the missing __init.class files

7:33 Ok, so this is either a bug in Clojure's compiler, or bad programming, but I think I found the problem

7:34 clojure.lang.Compiler/load calls load(rdr, null, "NO_SOURCE_FILE")

7:34 It is passing null as the source filename

7:34 Pretty standard stuff right there

7:35 But when you get the compile with null for the sourcePath it will be a null pointer exception

7:36 Assuming load ever calls compile()

7:37 martinklepsch: how do you ppl start your gpg-agent so you can deploy to clojars?

7:39 clgv: martinklepsch: on my linux system I just do "lein deploy" and it seems to handle the gpg itself. for non-snapshot I just need to provide the password for the gpg key when asked

7:41 martinklepsch: seems gpg-agent is started by x-session-manager

7:41 n

7:41 martinklepsch: clgv: yeah, I'm on OS X I'm afraid (should've mentioned that earlier)

7:42 hellofunk: ddellacosta you still around?

7:42 ddellacosta: yeah, but about to be busy, what's up?

7:43 hellofunk: quick question: since all Om component fns must return a single dom/X component, I often wrap them in dom/div. But what if this throws off page layout? is there a more generic wrapper?

7:43 clgv: martinklepsch: mainly "gpg-agent --daemon --sh" and then a probably optional --write-env-file ... --exit-with-session ...

7:44 hellofunk: ddellacosta ^

7:44 ddellacosta: hellofunk: a div shouldn't throw off layout necessarily, but in any case I don't find myself with that problem often, I have to say

7:45 hellofunk: sorry I can't give you better advice. :-(

7:45 hellofunk: ddellacosta no problem thanks.

7:45 ddellacosta: hellofunk: more to the point, I find that a component often maps pretty well to a single HTML node of some sort--if not, you may want to see if there's a way you can restructure things so it does.

7:45 clgv: hellofunk: how is the starting with CLJS experience these days?

7:46 hellofunk: ddellacosta i agree but i have a rather complex interface and the designer provided a very pretty layout in HTML and CSS but I have to add my own divs to make some of it modular React components, and then the layout goes wonky with these new divs that have a nil class for wrapping

7:47 clgv i've been using cljs and Om for about 6 months now and it's going pretty well

7:48 ddellacosta: hellofunk: yeah, all I can say is, in practice either structuring components the way I describe or adding "container" divs when necessary hasn't been a big deal, even with relatively complex layouts.

7:49 clgv: hellofunk: ah ok, thought you started recenty - so I must have confused you with someone else

7:57 martinklepsch: when I specify a GPG key in my .lein/profiles.clj the :signing key is first-level, is that right?

7:58 https://github.com/technomancy/leiningen/blob/master/doc/GPG.md#overriding-the-gpg-defaults

7:58 (It's a bit unclear here and worked for me after putting it first-level)

8:13 TimMc: martinklepsch: Looks like it.

8:13 That code block is ambiguous, though.

8:16 martinklepsch: TimMc: https://github.com/technomancy/leiningen/pull/1735

8:18 hyPiRion: martinklepsch: thanks

8:19 rritoch: dysfun_: It looks like I've found the issue. It seems that load-reader never actually calls the main compile function which generates the loader (__init.class), but with *compile-files* set it does generate all of the other required files. Because of this it looks like my only option is to make a direct call to Compiler/compile with the reader which "should" generate the missing __init files.

8:19 martinklepsch: hyPiRion: do I get a free sticker now? ;D

8:19 (glad I was able to help :)

8:21 hyPiRion: martinklepsch: yeah, sure thing :)

8:21 martinklepsch: hyPiRion: haha, how is that managed? I don't want to waste anyones time just to send me a sticker.... otoh I freakin love stickers

8:22 hyPiRion: It's not too much work

8:24 martinklepsch: are you from Europe or America? It's easier to let technomancy do it if you're American, otherwise I can send one to you

8:25 martinklepsch: hyPiRion: Berlin, Germany

8:37 TimMc: SASL, I think.

8:56 sam__: Hi!

8:56 Would people who have already contributed to Clojure have more chance at gsoc than those who will during the gsoc period?

8:58 Bronsa: sam__: I think if you can demonstrate that you have some experience and that you understand what you'll be doing, you'll definitely have more chances to get in

9:00 sam__: that said, prior contribution is not a prerequisite and students with no prior contribution have been accepted into GSoC

9:01 sam__: Bronsa: But would a prioir contribution put me ahead than the others?

9:02 Bronsa: sam__: it certainly wouldn't hurt, but there's no guarantee that you'll be chosen over other students just because you have contributed earlier, there are many other factors that come into play

9:02 sam__: Oh ok )

9:03 * :)

9:03 BTW Does typed clojure have reserved slots/

9:03 Or is it decided as a whole?

9:04 Bronsa: sam__: last GSoC core.typed had no reserved slot over other clojure projects, no idea about next year's GSoC

9:05 sam__: it's a bit early but if you want to prepare you can ping ambrosebs and ask him, he definitely can answer your questions better than anybody else :)

9:06 sam__: Thanks. I thought that might be an easier place to start off with. :)

9:16 rurumate: anyone using emacs + i3? is it ok>

9:16 hfaafb: you need at least a 16 core i7 to even consider using emacs

9:16 rurumate: hfaafb: I meant i3 window manager

9:18 dysfun_: hfaafb: you appear to havce mistaken emacs with firefox

9:27 rritoch: dysfun_: This "hack" worked. I just had to call Compiler/compile directly, manufacturing a path from the expected class name, replacing . with File/separator and appending ".clj"

9:27 dysfun_: I don't see any other way to create the __init files for remote resources without directly manipulating the clojure compiler or caching locally

9:29 dysfun_: thanks for your help. Your ideas helped me find a path to a solution, even if the solution is probably verssion dependent.

9:31 dysfun_: rritoch: oh that's quite nice :)

9:31 i mean fugly, but sort of neat in a way

9:31 :)

9:33 ckirkendall: dnolen_: What are your thoughts on supporting something more extendable than simple paths in om. At Outpace we implemented something like Ref Cursors on top of om but based them on path protocols of fresnel. This allowed us to do data transformations and still keep the ability to push back into app state. Here is an example of what I mean: https://gist.github.com/ckirkendall/9a3ebe92bd9d4c279241

9:33 rritoch: lol, yeah. There should be a cleaner way of compiling remote resources, like (compile-resource) or something like that.

10:23 borkdude: I have to do a short Rails project for my job. Are there any shortcuts for learning Rails when knowing Clojure?

10:23 stuartsierra: borkdude: Forget everything?

10:24 borkdude: stuartsierra I am trying to do that in this Play Java project, but not succeeding so far

10:24 :'(

10:24 stuartsierra: `reduce` is `inject` in Ruby, that's all I remember.

10:25 Everything is mutable, including the runtime Kernel.

10:26 stompyj: borkdude: you can write ruby in a very functional style, if you like

10:26 but it’s not idiomatic

10:26 so if rubyists are doing code review, they may complain

10:27 ruby 2.0 even has lazy structures

10:28 stuartsierra: I actually like Ruby. It has a lot of the stuff I like from both Lisp and Perl.

10:28 borkdude: probably I'll like it better than Java

10:29 hhutch: borkdude: I did the exact same thing, i had never touched ruby/RoR but had a lot of clojure experience

10:29 and past Perl experience

10:29 borkdude: hhutch any good pointers where to start except that Rails tutorial book maybe?

10:30 hhutch: i didn't even need the tutorials that much, i would just point out some caveats more than anything

10:30 stompyj: ruby is actually great, its the community decision on what is idiomatic code that soured it for me

10:30 hhutch: borkdude: i was under this impression due to community propaganda that "the most common things just work"

10:31 this is not necessarily true

10:31 for instance, i had a very difficult time getting an API workflow for token based authentication working

10:31 and i know plent of RoR people, i had to figure out a solution on my own

10:32 borkdude: hhutch hmm ok

10:32 hhutch: it's really not different than any other MVC opensource platform, just don't believe the hype that "everything just works" ... a lot of solutions have aged and aren't updated

10:33 stompyj: if you had been comingfrom any other language but clojure, I’d say, enjoy the conciseness of the ruby code

10:33 but ruby is more verbose :)

10:41 joshhead: I have some java types that represent associative or sequential data. Are there some protocols I can extend to these types that will allow me to use destructuring with them?

10:42 dysfun_: dnolen_: do you have any idea how fast om is relative to plain jquery?

10:43 joshhead: Specifically they are from JInterface, an Erlang messaging library for Java. I want to (let [[a b c] tuple] ...) when tuple is an OtpErlangTuple instance.

10:44 stuartsierra: joshhead: Is the tuple Iterable? Then you can just call `seq` on it.

10:44 joshhead: OtpErlangTuple has a length and access by index but doesn't implement any collection interfaces.

10:44 stuartsierra: Otherwise, you'll need some kind of conversion function. Clojure (JVM)'s core types are interfaces, not protocols.

10:44 joshhead: stuartsierra: it's not iterable

10:45 stuartsierra: got it, thanks. I'll try the conversation route.

10:49 rritoch: joshhead: I believe you can destructure arrays, so you should be able to let [[a b] (.elements myTuple)] ...

10:53 joshhead: the following works, so calling the elements method of your tuple should work. (let [[a b] (int-array [1 2]) _ (println (str "a=" a " b=" b))])

10:53 gfredericks: ,(def my-nums (into-array [1 2 3 4 5]))

10:53 clojurebot: #'sandbox/my-nums

10:53 gfredericks: ,(let [[a b] my-nums] [a b])

10:53 clojurebot: [1 2]

10:54 joshhead: rritoch: yeah array from .elements does work, just tried it

10:54 noprompt: dnolen_: do you have a second?

10:55 joshhead: rritoch: didn't think of that. thanks :)

11:22 BorisKourt: Hello does anyone know how to figure out what a "Fully qualified service type" is on a device? Only a single example comes with this function: http://jmdns.sourceforge.net/apidocs/javax/jmdns/JmDNS.html#requestServiceInfo%28java.lang.String,%20java.lang.String%29

11:23 I am trying to setup clojure zeroconf to discover an Intel Galileo on my network but haven't been able to figure out what to put for the type in order to listen for it :(

11:40 rritoch: BorisKourt: See rfc6763 that describes everything you need to know about DNS discovery, including how the types are defined.

11:45 BorisKourt: I looked at that yesterday, will look again.

11:48 SagiCZ1: is there a way to interrupt execution of last repl command?

11:49 nevermind, found it

11:53 TimMc: SagiCZ1: C-c?

12:01 SagiCZ1: TimMc: yeah that didnt work, but there is a button for it in my ide

12:09 arrdem: Anyone have a fun side project they could use a hand on? Feeling kinda burned on my own heavyweight stuff and looking for an opportunity to make headway somewhere :P

12:11 SagiCZ1: if i call map on some collection with a function foo and i change the function foo in the middle of execution and load it, why doesnt it change the rest of the map execution?

12:12 csd_: I'm having trouble printing to stdout when using ScheduledThreadPoolExecutor. Is there something special I need to be doing?

12:15 BorisKourt: rritoch Do you know if .local. refers to local network or local to the machine only

12:17 stuartsierra: SagiCZ1: The Var #'foo only gets resolved when you first call `map`. After that you have the (immutable) function value.

12:18 SagiCZ1: If you were to do `(map #'foo …)` instead, you would see the new version.

12:18 csd_: Not trying to print to STDOUT from more than one thread.

12:19 csd_: stuartsierra: don't follow. are you saying it's not possible to do so?

12:19 mdeboard: What are the transformers referred to in core.async documentation in the deprecation notes for e.g. map<, filter< etc

12:19 stuartsierra: csd_: I'm saying it's not a great idea. You can get interleaved bits of output.

12:20 csd_: i'm just trying to debug. not going to do it permanently. even so though, the output just isn't printing period

12:20 stuartsierra: SagiCZ1: Also, keep in mind that `map` is not one-at-a-time lazy. It eagerly evaluates "chunks" of up to 32 elements for performance.

12:20 SagiCZ1: stuartsierra: is using #'foo common?

12:20 stuartsierra: SagiCZ1: no

12:20 SagiCZ1: not something i want to leave in a production version?

12:21 stuartsierra: SagiCZ1: There are legitimate use cases for invoking Vars directly. But it's not common.

12:21 SagiCZ1: stuartsierra: okay

12:21 mdeboard: &(doc map<)

12:21 lazybot: java.lang.RuntimeException: Unable to resolve var: map< in this context

12:21 stuartsierra: csd_: Different REPL / IDE / editor environments do weird things with `*out*` and STDOUT (which are not necessarily the same thing).

12:21 mdeboard: &(doc core.async/map)

12:21 lazybot: java.lang.RuntimeException: Unable to resolve var: core.async/map in this context

12:21 stuartsierra: csd_: My recommendation is to use a real logging framework.

12:22 csd_: ok

12:22 mdeboard: Ok, well what I mean is this doc for `map<': Deprecated - this function will be removed. Use transformer instead

12:22 csd_: anyone in particular you prefer?

12:22 mdeboard: What is transformer?

12:22 stuartsierra: mdeboard: a transducer

12:22 mdeboard: I see

12:23 stuartsierra: csd_: Mine is https://github.com/stuartsierra/log.dev

12:23 mdeboard: I know those are just docstrings from the function but in that case some clarification would be good

12:24 stuartsierra: mdeboard: core.async is still alpha and those functions are probably going to be removed before it leaves alpha.

12:25 mdeboard: i see

12:25 thanks

12:27 tbaldridge: mdeboard: map< (and friends) have considerable overhead as they require pushing data through yet another channel. Transducers don't require this as the transducer is run inside the channel itself.

12:27 mdeboard: makes sense

12:28 tbaldridge: mdeboard: plus then you don't need partition<, interpose<, etc.

12:28 mdeboard: You mean run inside the goroutine?

12:28 or what does inside the channel mean

12:29 tbaldridge: mdeboard: no, when you create a channel it takes an optional argument of a transducer. All values put into that channel then are passed through the transducer.

12:29 * mdeboard tries to remembre the conveyor belt metaphor

12:29 arrdem: gfredericks: so corncob will just to text references to the version?

12:29 mdeboard: or the luggage-loading metaphor

12:29 arrdem: s/to/do/g

12:29 tbaldridge: , (chan 10 (map inc))

12:30 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: chan in this context, compiling:(NO_SOURCE_PATH:0:0)>

12:30 tbaldridge: mdeboard: ^^ that'll create a channel that increments all input by 1 before passing it to the output.

12:30 dnolen_: ckirkendall: gotta run - please write this up in an Om issue thanks

12:30 mdeboard: tbaldridge: I see

12:38 ckirkendall: dnolan_ sure

12:42 csd_: Is it possibe to prevent clojure from spawning a clojure.main process that is visible in OS X?

12:42 It pops up on it's own when I do SQL operations and such

12:53 arohner: dose the opposite of a/into exist? i.e. 'slurp' all output from a channel, returning a collection

12:54 gfredericks: arrdem: yeah so far

12:56 arrdem: gfredericks: just idly wondering if it will interact with clojars svgs at all

12:57 gfredericks: arrdem: those don't contain the version in the source, right? so what could it even want to do?

13:04 mdeboard: Anyone have a good blog post or something showing proper examples of core.async/merge and /mix ?

13:06 gfredericks: arrdem: or does clojars serve fixed version svgs?

13:07 arrdem: gfredericks: yeah you're right the version doesn't occur in the svg url

13:07 gfredericks: nevermind. that was the only other thing in a README that I could imagine being impacted/needing updating

13:08 justin_smith: perplexa: did anyone address your question?

13:08 sg2002: Hello. I have a question about xml namespaces. Has anyone had any luck with them? There sem to be a new fork of of data.xml here https://github.com/bendlas/data.xml, how usable is it?

13:09 perplexa: justin_smith: nope

13:10 sg2002: Also there is https://github.com/grammati/eksemel, it semes to have been abandoned, but people are saying it was working, though was very "eager".

13:10 justin_smith: perplexa: via some set of keywords, or pairs of keyword/value?

13:11 for the former, put them in a set and use contains?

13:11 ,(contains? (set [:a :b :c]) :b)

13:11 clojurebot: true

13:11 gfredericks: arrdem: I actually don't really like those SVGs anyhow -- I think the only upside is not having to update your README manually

13:11 justin_smith: perplexa: for key / val, create a map and use get with an extra arg

13:12 arrdem: gfredericks: I would agree with that. I think hiredman is not alone in complaining that you can't just copy/paste the SVG into your project.clj

13:12 perplexa: justin_smith: always pairs

13:12 hm ok :)

13:12 justin_smith: ,(get (into {} [:freeform true] [:last :OK]) :opening :default)

13:12 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Key must be integer>

13:12 justin_smith: err

13:12 ,(get (into {} [[:freeform true] [:last :OK]]) :opening :default)

13:12 clojurebot: :default

13:13 justin_smith: where you are checking for the :opening option

13:13 of course the map will act as get if put in the calling position, but I prefer to be more explicit when it isn't a map literal

13:14 perplexa: gonna check it out later, thx

13:14 gfredericks: arrdem: yep that's my primary gripe

13:15 justin_smith: arrdem: gfredericks: how about an extension to embed them as data via analemma

13:16 * arrdem afk school work

13:19 pkkm: any people knowledgeable on Clojure coding style here? I've written my first Clojure program, and I'd appreciate a review -- I've got the impression that it does a lot of things in a non-Clojurey way: <https://gist.github.com/pkkm/7f9fcdc0f8d52950ce50>.

13:23 justin_smith: pkkm: one style point: put blank lines between globals (the def / defn calls)

13:23 arrdem: line wrapping at 70/80 is also the norm... M-q is your friend.

13:24 Gurkenmaster: What am I supposed to do with that screen space?

13:24 mr-: Can someone explain #(+ % 5) ? Is that built in syntax, or implemented in clojure?

13:24 justin_smith: Gurkenmaster: what screen space? long lines are hard to read, so I make my window narrower

13:25 hiredman: ,'#(+ % 5)

13:25 clojurebot: (fn* [p1__25#] (+ p1__25# 5))

13:25 pkkm: what about comments on the end of lines? for example, if the line is 60 chars long, and I want to comment it?

13:25 mr-: Oh, I was expecting a different order of arguments

13:26 justin_smith: pkkm: I think he is referring to the single line comments

13:26 pkkm: particularly bad in a gist where they get a horizontal scrollbar at the very bottom of their box

13:26 very hard to read

13:27 pkkm: ok, line breaks between globals added, wrapping lines now.

13:27 justin_smith: pkkm: in defn number, the let ... if could be if-let

13:29 pkkm: consider making calculator-prompt and quit-string arguments to repl, rather than globals

13:29 or locals within -main

13:30 pkkm: like this?

13:31 justin_smith: yeah - though the whitespace inside the defn is also bad form I think

13:31 and you'll need to provide those args to repl, of course :)

13:32 pkkm: thanks, fixed.

13:32 reading on if-let now.

13:32 justin_smith: if-let is desinged for exactly the case you have there - where you bind something and then immediately use it as a conditional

13:34 pkkm: should I also wrap the `take-while' in a `seq'?

13:38 justin_smith: pkkm: that would be redundant

13:39 ,(seq? (take-while #(< % 10) (range)))

13:39 clojurebot: true

13:40 dbasch: justin_smith: he’s asking if he should check that his input is not empty, because he could get a NPE if it is

13:40 but I don’t understand why go through so much trouble to parse a number

13:41 justin_smith: dbasch: but seq won't prevent it from being nil...

13:41 dbasch: no, but an empty list would cause a NPE

13:41 gfredericks: justin_smith: huh what? What's the point of doing SVGs at all?

13:41 justin_smith: gfredericks: probably none

13:42 dbasch: ,(bigint “”)

13:42 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: “” in this context, compiling:(NO_SOURCE_PATH:0:0)>

13:42 dbasch: stupid smart quotes

13:42 &(bigint "")

13:42 lazybot: java.lang.NumberFormatException: Zero length BigInteger

13:43 pkkm: so I need to use `seq' when using lists and vectors as booleans to check for emptiness, but not when using the output of functions like `map' and `take-while'?

13:43 justin_smith: ahh, I get what you are doing now

13:44 yeah, apply the seq directly to the take-while in the if-let

13:44 TimMc: pkkm: If you know that an expression will be nil if it doesn't contain elements, you don't need to wrap it with seq.

13:44 justin_smith: sorry, I got distracted by some work stuff, came back, and lost a bit of context, my bad

13:44 TimMc: right, but take-while won't return nil, just an empty list

13:44 ,(take-while (constantly false) (range))

13:44 TimMc: ah

13:44 clojurebot: ()

13:45 TimMc: lovely

13:45 justin_smith: that surprised me too until I tried it :)

13:45 TimMc: I dislike nil-punning, so I will often wrap it anyway (to be explicit) or call not-empty.

13:45 &(map not-empty [[] nil [1]])

13:45 lazybot: ⇒ (nil nil [1])

13:46 justin_smith: yeah, not-empty is nice

13:47 TimMc: Using seq that way is *too* idiomatic for my tastes. (Idioms, like design patterns, are things that are described and named because they are not *completely* obvious in your language.)

13:47 justin_smith: TimMc: it's cannonized in the doc strings

13:48 ,(doc empty?)

13:48 clojurebot: "([coll]); Returns true if coll has no items - same as (not (seq coll)). Please use the idiom (seq x) rather than (not (empty? x))"

13:49 Bronsa: justin_smith: honestly, always disliked that docstring. seq is not nearly as descriptive as not empty?

13:49 * justin_smith is going to use (not (not-empty? x)) instead of seq as a predicate now

13:50 justin_smith: err, make that (not (not-empty x)) of course

13:55 pkkm: do you think the general structure of the code is good? for example, is my usage of parsed-<name> for the "parse result" data structure, parser-<name> for parser combinators, etc. good form in Clojure, or is it better to use namespaces?

13:55 abaker: is there any harm in using a closure as a reducing function - eg as a way to parameterize a reducing function?

13:56 justin_smith: abaker: got an example? in general internal mutible state stinks if that's what you mean

13:57 noonian: if you just mean a function with a reference to a variable bound in an earlier scope then you should be fine

13:57 abaker: justin_smith: no mutable state, just using another parameter other than the collection in the reduction

13:57 justin_smith: abaker: well, that's not even a parameter

13:57 it's just a captured binding, and that's fine

13:58 it's hard to even create a function without that kind of closure

13:58 noonian: all good there, if it is a top-level var though you can improve performance by binding it in a let before the reduce so clojure doesn't lookup the var every time its called

13:58 technomancy: I use partially-applied reducer functions all the time, but closures work fine too

13:58 justin_smith: (inc noonian)

13:58 lazybot: ⇒ 7

13:58 justin_smith: I keep forgetting that trick

13:59 technomancy: I would be surprised if that made a difference in any nontrivial function

14:00 abaker: thanks, and yes it's just a good ole fashioned closure, closed over a value somewhere else that is needed in the reduce

14:01 mr-: I am doing the exercises at 4clojure.com and should define a function that returns the last element in a list. I tripped the "def" alarm with (defn foo [[x & xs]] (if (empty? xs) x (foo xs))). Is there a non-tripping solution?

14:01 justin_smith: mr-: s/defn/fn

14:01 hiredman: it may want an anonymous function

14:02 mr-: justin_smith: why is one better than the other?

14:02 justin_smith: that answer will work if you take out the de

14:02 mr-: indeed :-)

14:02 weird

14:02 justin_smith: mr-: it is not asking you to define a global variable (which would return nil and not be valid in that code) it is asking for a form that calculates the rite answer when inserted in the specified position

14:03 *right

14:03 err wait - the defn would return the var, and that would work

14:03 my bad

14:03 mr-: justin_smith: I checked the defn-solution in the repl. It works. So the difference is that foo in the fn version is only visible in the body of the function?

14:03 justin_smith: but anyway, it wants a form and not a global def

14:04 yeah, I was wrong

14:04 mr-: Cool, so fn is for named anonymous functions :-)

14:04 justin_smith: mr-: fn is local, so yeah foo is only visible inside the fn, and you are not creating a global that unrelated code could access

14:04 mr-: Thanks

14:04 justin_smith: mr-: pseudonymous? :)

14:05 mr-: Is that a thing? ;-)

14:05 canweriotnow: justin_smith lulz

14:06 (* 88 8 8 8 8 88 88 8)

14:06 clojurebot: *suffusion of yellow*

14:06 mdeboard: lol

14:06 canweriotnow: wha?

14:07 mdeboard: http://www.urbandictionary.com/define.php?term=A%20Suffusion%20of%20Yellow

14:09 jro_: when do you expect to see 1.7.0 released?

14:10 justin_smith: ,(* 88 8 8 8 8 88 88 8)

14:10 clojurebot: 22330474496

14:14 SagiCZ1: soon(tm)

14:16 justin_smith: FTFY™

14:25 perplexa: justin_smith: btw, it's not vector pairs but just one vector of all the params :)

14:26 justin_smith: perplexa: ,(apply hash-map '(:a 0 :b 1 :c 2))

14:26 ,(apply hash-map '(:a 0 :b 1 :c 2))

14:26 clojurebot: {:c 2, :b 1, :a 0}

14:27 perplexa: eh wat

14:27 damn, justin_smith

14:27 i was thinking something like ##(let [x [:a "hai" :b 2 :c 3]] (nth x (inc (.indexOf x :a))))

14:27 lazybot: ⇒ "hai"

14:28 justin_smith: haha

14:28 perplexa: that's what i get for being a newb :P

14:28 justin_smith: perplexa: if you want to look something up, it makes sense to convert to a data structure that supports lookup...

14:29 perplexa: but these things take time and exposure to learn, of course

14:29 perplexa: yeah :) i agree

14:30 justin_smith: and if performance is super important, depending on the size of an array and how many of them you are doing lookup in, it can be much faster to do linear searches on the array rather than converting to a data structure that supports lookup

14:30 but wait until you have a performance problem for that kind of thing - it's probably not needed

14:41 mr_rm: how do i destructure a vector like this in a function argument? (let [[x & xs] [1 2 3]] [x xs])

14:42 (defn foo [[x & xs] arg] [x xs]) doesn't work

14:43 stuartsierra: mr_rm: function arguments don't use pairs like `let` bindings. (fn foo [[x & xs]] …)

14:43 mr_rm: ahhh

14:43 stuartsierra: doh! thanks!

14:43 justin_smith: ,((fn foo [[x & xs] arg] [x xs]) (range 10) :whatever)

14:43 clojurebot: [0 (1 2 3 4 5 ...)]

14:46 mr_rm: justin_smith: hmmm not with defn though

14:47 justin_smith: mr_rm: sure it works - you just need to provide an unused arg

14:47 the syntax is valid, it just isn't the same as expected

14:48 mr_rm: justin_smith: provide an unused arg just to get the syntax to work? that's a friggin' kludge. the right way is as stuart suggested

14:49 justin_smith: but yeah, if you throw in some random extra thing just to make it run, that works. <shudder/>

14:50 justin_smith: just saying, it's valid, just not correct

14:50 mr_rm: :)

14:50 justin_smith: mr_rm: and it wasn't a defn / fn difference

14:51 mr_rm: justin_smith: oh right... same thing with the unused arg

14:52 i was just thinking it would be the same as in a (let []) where you were providing the name of the thing to be destructured

14:52 justin_smith: that's why we have :as

14:52 ,((fn [[x & y :as all]] all) (range 10))

14:52 clojurebot: (0 1 2 3 4 ...)

14:52 mr_rm: i obviously don't write enough clojure code :)

14:53 csd_: Is it possibe to prevent clojure from spawning a clojure.main process

14:53 that is visible in OS X?

14:53 justin_smith: mr_rm: I can highly recommend the practice of writing more, it's a great language and there's much to learn

14:53 csd_: is there a headless option for the osx jvm?

14:53 mr_rm: justin_smith: oh believe me, i'm totally sold. the only thing i'm slightly conflicted on is the dynamic typing.

14:54 justin_smith: mr_rm: I've been intending to use prismatic/schema in anger one of these days

14:54 csd_: not sure, i'd have to check

14:54 stuartsierra: csd_: You mean visible as a GUI app? Look up 'headless java'

14:54 mr_rm: justin_smith: but i'd much rather use clojure, or groovy, than clojure

14:54 oops, i mean than JAVA

14:54 csd_: stuartsierra: no. this is a non GUI app, but when I do SQL operations, the clojure.main visible process will be created

14:54 so it shows up when i command-tab etc.

14:55 justin_smith: csd_: he's saying the same thing I was - you can get a headless java / tell java to start headless (or at least that's a thing on linux)

14:55 stuartsierra: csd_: Yeah, something's loading AWT. Look for 'awt headless' to set the right command-line properties.

14:55 teslanick: That would be because the library is calling out to a javax namespace, which OS X "helpfully" thinks is a use of gui stuff.

14:55 csd_: ok thx

14:56 justin_smith: csd_: lein ring uses awt for the desktop integration (making the page load in your browser) for example

14:56 csd_: that's probably what's doing it rather than SQL

14:56 justin_smith: csd_: but you can tell it not to with the :headless arg

14:56 lein ring server :headless if using that plugin

14:57 or is it server-headless

14:57 one of those

14:57 amalloy: justin_smith, csd_: see also https://developer.apple.com/library/mac/documentation/java/Reference/Java_PropertiesRef/Articles/JavaSystemProperties.html

14:58 specifically apple.awt.UIElement or java.awt.headless

15:01 aaelony: I have a silly question. I'd like to use ztellman's Rhizome library (https://github.com/ztellman/rhizome) which requires Graphviz's dot to be installed. Rhizome calls 'dot' but can't find it. 'dot' on my computer is in /usr/local/bin/dot . Does anyone know what I need to do to tell Rhizome where the 'dot' program is? is it an environment variable? if so, which is it? thanks

15:02 martinklepsch: What do you think about adding extern generation to lein-cljsbuild?

15:05 stuartsierra: aaelony: probably just PATH

15:05 aaelony: stuartsierra: thank-you, but /usr/local/bin is already in my path...

15:06 stuartsierra: huh, then I don't know

15:06 justin_smith: aaelony: are you running cider inside emacs on osx?

15:06 stuartsierra: oh yes

15:06 justin_smith: because if so, emacs does not get your PATH from .bashrc etc.

15:06 aaelony: justin_smith: yes, I am actually

15:06 justin_smith: because it was invoked via the GUI and the GUI never loaded your .bashrc

15:07 you can change emacs' PATH using M-: (setenv "PATH" ...)

15:07 aaelony: justin_smith: I think you're on to the issue here. What's the fix, run from lein repl?

15:07 justin_smith: set emacs' path properly before jacking in

15:07 and make sure it is exported

15:07 aaelony: justin_smith: ok cool! will attempt.

15:07 justin_smith: or just launch emacs from a terminal

15:08 relevant SO http://stackoverflow.com/questions/8606954/path-and-exec-path-set-but-emacs-does-not-find-executable

15:08 aaelony: cool, big thanks!

15:08 justin_smith: np

15:08 OSX is silly about path settings

15:09 aaelony: add that to my silliness, & it's a winner ;)

15:09 justin_smith: heh

15:10 aaelony: I'm back on Mavericks now on the work computer... I much prefer Mint Linux though

15:13 worked like a charm

15:13 thanks again

15:13 justin_smith: cool

15:16 danielszmulewicz: I had hoped transit would allow me to serialize and deserialize nested Clojure maps. Instead, I get this sort of stuff :transit-params {"twitter[access-token-response][user_id]" "123577893"}. Using ring-transit and clj-http with :transit+json as content type. What went wrong and where?

15:18 csd_: amalloy: thanks that worked very easily

15:20 it's remarkable how every time i wonder whether some unlikely emacs package exists, it does. most recently, there is a package that interfaces with pubmed

15:27 SagiCZ1: can i require only part of library and refer all it?

15:27 (require [table.core :only [table :refer :all]]) doesnt work

15:28 teslanick: Not sure what you're trying to accomplish. :refer :all imports all the names from the provided ns into the current ns.

15:29 SagiCZ1: teslanick: and what does :only do?

15:30 teslanick: I don't think :only works with require

15:30 turbofail: yeah, i don't think it makes sense to use :only with require

15:31 amalloy: SagiCZ1: it doesn't do anything in that context

15:31 Raynes: TEttinger3: YO.

15:31 amalloy: it's not really clear what you hope your require line will do, so it's not easy to tell you how to fix it

15:31 danielszmulewicz: SagiCZ1: With :use and it does what you've been asking.

15:31 SagiCZ1: But don't do that.

15:31 turbofail: what does it even mean to "require part of a library but refer all of it"?

15:31 SagiCZ1: in the ns form, i want to specify taht i want to import that one var from that particular namespace, and refer to it by its simple name

15:34 turbofail: (require [table.core :refer [table]])

15:35 SagiCZ1: turbofail: thats it, thank you

15:35 (inc turbofail

15:35 (inc turbofail)

15:35 lazybot: ⇒ 4

15:36 amalloy: SagiCZ1: that's actually requiring all of it but referring part of it, by the way

15:37 SagiCZ1: amalloy: i realize that, but from what i understood above, there is no way to require only part of a namespace

15:37 turbofail: yeah, there isn't

15:37 amalloy: indeed

15:38 turbofail: that would seriously mess with a namespace's autonomy

15:39 amalloy: turbofail: well, i don't think we have to hold to democratic ideals for our namespaces. autonomy isn't at issue, but working at all is

15:41 SagiCZ1: the ns, use and require calls are extremely confusing and not at all intuitive.. im still fighting them, but i guess i will just get used to it

15:41 turbofail: amalloy: well that's basically what i mean. requiring part of a namespace would require interfering with the execution of the namespace's code, which would probably break all sorts of things

15:47 nonrecursive: SagiCZ1: I have a require/refer/use/ns tutorial at http://www.braveclojure.com/organization/, in case that helps

15:50 zerokarmaleft: messing around with defining a state machine in core.async with mutually recursive functions. seems to work but is an order (or several orders) of magnitude slower than I expected due to trampolining. is there a recommended way around this?

15:50 justin_smith: SagiCZ1: it sounds like you may not understand the basic structure and function of namespaces in the clojure world

15:51 stuartsierra: Who does, really?

15:51 justin_smith: SagiCZ1: the tl:dr version is that a namespace is a mapping of names to definitions - you can look up the docs to alias, refer, intern for more details

15:52 stuartsierra: zerokarmaleft: core.async isn't really designed to compete on performance with plain function calls.

15:53 zerokarmaleft: If I recall correctly, the current implementation of `go` dispatches to a thread pool on every 'parking' operation.

15:57 SagiCZ1: justin_smith: thanks for the tutorial, i will read up on that.. i did read several chapters about namespaces from different books, but i cant say i fully understand it

15:57 gzmask-oh: is this doesn't run like what I think it does: (defn [^Float x] (= 0.1 x)) ?

15:57 arrdem: gzmask-oh: what do you think that does? :P

15:57 justin_smith: SagiCZ1: well, that was just a tl;dr, nonrecursive's link is more of a tutorial

15:57 SagiCZ1: justin_smith: sorry, u didnt link the tutorial, your name had a similar color in my client

15:58 justin_smith: ahh

15:58 amalloy: gzmask-oh: well, it does what *i* think it does, but i can't say whether it does what you think it does

15:58 justin_smith: np

15:58 gzmask-oh: arrdem: returns true if x is 0.1?

15:59 justin_smith: gzmask-oh: did that initially have a name?

15:59 gzmask-oh: if it had a name, it would do exactly what you said

15:59 amalloy: justin_smith: okay, you got me. it doesn't do what i thought, because i didn't notice the name was missing

15:59 gzmask-oh: whops, wrong example. should be: (defn is-one [^float x] (= 1.0 x))

15:59 arrdem: (inc justin_smith)

15:59 lazybot: ⇒ 99

16:00 arrdem: good greif

16:00 justin_smith: ,(= 1 1.0) ; gzmask-oh: is this your beef?

16:00 clojurebot: false

16:00 justin_smith: ,(== 1 1.0)

16:00 clojurebot: true

16:00 justin_smith: type hints are not type conversions

16:00 they are hints telling the compiler what to expect

16:01 ,((fn [x] (= (float x) 1.0)) 1)

16:01 amalloy: does ^float there even work? i would be nervous putting a primitive type hint that's not long or double on a function arg

16:01 clojurebot: true

16:01 justin_smith: amalloy: excellent point

16:01 gzmask-oh: so type hints basically are just documentations and nothing functional?

16:02 justin_smith: gzmask-oh: they tell the compiler how it can optimize runtime lookups

16:02 arrdem: justin_smith: but only for primitive types

16:02 justin_smith: I probably worded that wrong

16:02 dbasch: gzmask-oh: be careful when comparing floats to literals

16:02 ,(= 1.0 (+ (float (/ 3 7)) (float (/ 4 7))))

16:02 clojurebot: false

16:02 justin_smith: arrdem: I was thinking about the avoiding reflection thing

16:02 dbasch: because

16:02 ,(+ (float (/ 3 7)) (float (/ 4 7)))

16:02 clojurebot: 1.0000000298023224

16:03 arrdem: justin_smith: that may be true for some things, I'm only confident on fn parameter type annotations.

16:03 justin_smith: OK

16:03 stuartsierra: And Clojure doesn't use Float, it uses Double.

16:03 dbasch: there are few good reasons to use floats these days

16:03 amalloy: arrdem: i don't follow - what claim are you making?

16:04 SagiCZ1: lets say i have a sequence of maps, what would be the easiest way to extract particular values and join them together? example [{:a 0 :b

16:04 arrdem: amalloy: I'm just pointing to the special case of type annotations for primitive call support. that's it.

16:04 gzmask-oh: Got it. Thanks for the pointers :)

16:04 SagiCZ1: [{:a 0 :b 3}, {:a 5 :b 42}] --> [[0 5] [3 42]]

16:04 justin_smith: amalloy: that annotations on function arguments only help optimize lookup of methods for primitives, if I understood correctly - but I think he is wrong because the annotations help with reflection avoidance...

16:05 amalloy: (map (juxt :a :b) maps)

16:05 SagiCZ1: juxt

16:05 thanks

16:05 dbasch: ,(map (juxt :a :b) [{:a 0 :b 3}, {:a 5 :b 42}])

16:05 clojurebot: ([0 3] [5 42])

16:05 justin_smith: (inc juxt)

16:05 lazybot: ⇒ 15

16:05 amalloy: justin_smith: i don't think arrdem has said anything specific enough to be wrong :P

16:05 justin_smith: oh, OK

16:05 dbasch: something like that, though not exactly that

16:05 SagiCZ1: thank you guys

16:05 arrdem: amalloy: I am in fact slowly learning to hold my tongue :P

16:07 amalloy: arrdem: i am now imagining a weird bar scene, where someone is talking nonsense at you, and you respond by - ever so slowly - reaching for your tongue and holding it in place

16:07 dbasch: ,(map vals [{:a 0 :b 3}, {:a 5 :b 42}])

16:07 clojurebot: ((3 0) (42 5))

16:07 justin_smith: amalloy: sounds like a Jan Svankmayer film

16:07 arrdem: amalloy: Maybe comment

16:08 ode: Can someone explain lines 2-4 of http://pastebin.com/RU3SbA37 to me please? Thanks

16:08 verma: killing stuff after a lein pdo is so painful, or am I doing it wrong?

16:08 justin_smith: ode: it's defining a function with multiple arities, which version is called depends on the number of arguments provided

16:09 verma: I just end up killing the terminal

16:09 gzmask-oh: can I place type restrictions into my function arguments?

16:09 justin_smith: gzmask-oh: you can use a :pre condition for that

16:09 gzmask-oh: or jump into core.typed

16:10 amalloy: verma: if you run a task with pdo that never terminates, i can imagine that happening

16:11 ode: justin_smith: Thanks, got it.

16:11 amalloy: gzmask-oh: although you should probably try drinking the "relaxed typing" flavor koolaid for a while, instead of writing code that feels comfortably like C or whatever

16:11 justin_smith: verma: there's always killall -9 java, and if that doesn't work, sudo telinit 2

16:11 amalloy: you're a monster, justin_smith

16:12 gzmask-oh: amalloy: that means the pre/post condition rather than the core.typed?

16:12 EvanR: that would also kill minecraft

16:12 so its a no go

16:12 amalloy: gzmask-oh: i mean, don't do any of them. just let your function take args, and blow up if it gets args it doesn't like

16:13 SagiCZ1: is there a way to programatically clear the repl window? delete all the text?

16:13 justin_smith: amalloy: a monster?

16:13 arrdem: SagiCZ1: cider-repl-clear-buffer?

16:13 verma: justin_smith, wouldn't that put system in run level 2/

16:13 SagiCZ1: arrdem: without emacs?

16:13 verma: justin_smith, given that you're running linux in the first place?

16:13 Bronsa: is there a world outside emacs?

16:13 justin_smith: verma: which would kill your terminal, among other things

16:13 arrdem: "without emacs" <- wrong answer

16:14 verma: justin_smith, :)

16:14 amalloy: verma: justin_smith's suggestions are as gentle as dousing your cpu in a vat of honey

16:14 verma: amalloy, yes I realize that :)

16:14 SagiCZ1: arrdem: that was a question..

16:14 amalloy: (which is why i was calling you a monster)

16:14 ode: Is 'loop' the preferred way to do recursion or just 'another' way?

16:14 Bronsa: ode: the low-level way

16:14 technomancy: ode: it's the fallback way

16:15 Bronsa: ode: use map/reduce/doseq/dotimes if you can

16:15 verma: aw man, I gotta do some work in C++ now :(

16:15 arrdem: SagiCZ1: there is no editor/terminal independent technique for clearing a "repl", no

16:15 justin_smith: ode: recur is what literally does recursion (or a self call), but we have many nice abstractions for what would otherwise be recursive processes

16:15 SagiCZ1: arrdem: okay, thats what i needed, thanks

16:15 technomancy: SagiCZ1: you can remove-ns for everything but clojure.core

16:15 SagiCZ1: but it won't help with defrecord/deftype stuff

16:16 Bronsa: technomancy: he didn't mean clearing in that sense :)

16:16 arrdem: Bronsa: a Clojure instance with no defs is pretty clear to me..

16:17 SagiCZ1: i meant clearing the visual part of the console, so i could use it as a makeshift gui

16:17 justin_smith: SagiCZ1: what kind of terminal or container is the repl in? it likely has a command that will clear it and put you on the top line

16:17 technomancy: oh, haha

16:17 so nothing to do with the repl then

16:17 arrdem: that would be curses/ncurses

16:17 Bronsa: arrdem: not sure I follow, I thought SagiCZ1 was asking how to empty the repl output or whatever

16:17 SagiCZ1: probably stupid idea, sorry

16:18 technomancy: it's not stupid; you're just addressing the wrong layer of the system

16:18 justin_smith: SagiCZ1: if you want to be able to clear the terminal, print at a specific x/y etc. you want curses/ncurses as arrdem said

16:18 but this seems weird and messy inside the same terminal providing a repl

16:18 SagiCZ1: justin_smith: oh i thought he was cursing me

16:19 justin_smith: haha,

16:19 it's a cursor control library

16:19 SagiCZ1: i will look into that package, thanks arrdem

16:19 justin_smith: thus the name

16:19 ode: Thanks guys, less confused now :)

16:19 technomancy: (repeat n curses)

16:24 justin_smith: verma: mea culpa, I was thinking of telinit 1 (kill everything but the kernel, open a root shell)

16:29 zerokarmaleft: stuartsierra: it's a fairly simple state machine, a different version of this https://gist.github.com/zerokarmaleft/5fd329479e476911e207 was taking ~15s to unpark the go bloack at line 45. the current version of that gist seems to show that semantics might be violated?

16:30 stuartsierra: zerokarmaleft: sorry, no time to debug things now

16:31 zerokarmaleft: stuartsierra: np

16:31 arohner: fun transducers question. Let's say I have a small input 'collection' (say, ones to tens of items), and I want to write a transducer that expands that into a large number of items (thousands to millions). is there a way to make the transduce lazy? all examples I've seen of 'expanding' the input use reduce, which isn't lazy

16:32 visof: hi

16:32 hiredman: arohner: look at mapcat

16:32 justin_smith: arohner: iterate? or yeah mapcat

16:32 visof: this line TwitterUtils.createStream(jssc); converted to (TwitterUtils/createStream jssc) in clojure like?

16:32 right?

16:32 zerokarmaleft: it's just a fun example and translates nicely from hoare's notation (if it worked)

16:33 SagiCZ1: in this code: (foo (map #(consume % event) coll)) why isnt foo called? i guess its because map returns lazy-seq? does it matter what foo does?

16:33 arohner: hiredman: but looking at mapcat -> cat, that ends up calling reduce

16:34 amalloy: yeah, i don't think you can actually do that lazily, arohner. i look forward to rich's clever solution

16:34 justin_smith: SagiCZ1: I would guess foo is being called, but it's internals are lazy

16:35 arohner: amalloy: yeah, that was my suspicion :-(

16:35 justin_smith: *its

16:35 hiredman: arohner: what does laziness mean to you?

16:35 arohner: the mapcat tranducer doesn't produce stuff until it is demanded

16:35 zerokarmaleft: are you sure the example you are translating is using a single channel like that?

16:36 gzmask-oh: ok should I really drink the koolaid and writes no test and no type annotation etc. ? That saves a lot of time and I am leaning towards it now ...

16:36 amalloy: hiredman: suppose you (mapcat f [1]), and (f 1) returns (range). is there any way then to do something like (take 5 (mapcat f [1])) and still use that as a transducer?

16:37 tbaldridge: amalloy: it can use a transducer, but if you call sequence on it, it'll give you an OOM exception

16:37 hiredman: amalloy: I think that just works

16:37 the take whatever returns a reduced which short circuits the reduce

16:38 zerokarmaleft: hiredman: no, it's not made explicit in hoare's book (afaict) how channels should be delineated

16:39 Bronsa: hiredman: there was a ticket for this and IIRC the response was that there's no way to make the mapcat transducer as lazy as the lazy-seq version

16:39 zerokarmaleft: hiredman: that's been a source of confusion for me actually, not knowing whether alphabets of processes equate to a set of different values that are sent on a channel, or to a set of channels

16:39 Bronsa: hiredman: searching for it, it had an example demonstrating the issue, one sec

16:40 hiredman: Bronsa: sure, but arohner has not said what lazy means to him

16:40 Bronsa: so we can't say if the level of laziness you can get satisfies

16:40 tbaldridge: Bronsa, unless you have co-routines/continuations then you can ;-)

16:40 perplexa: i'm sitting here with popcorn, readin ;x

16:40 arohner: hiredman: during the transducer, going from 1-> 1000 items, I would like to not put the second item onto f1 until the first item is taken

16:42 hiredman: arohner: if I understand you correctly that sounds exactly like how transducers work now

16:43 zerokarmaleft: tbaldridge: re: https://gist.github.com/zerokarmaleft/5fd329479e476911e207 is there a known bad interaction between trampolines and the go macro?

16:44 arohner: hiredman: I strongly suspect it isn't. still trying to find the smoking gun

16:45 Bronsa: well I can't find the ticket, maybe it was just a mail

16:45 tbaldridge: hiredman: it's easy to prove that mapcat is only half-lazy with transducers. Just have a map call that incs an atom. or use print or something.

16:46 arohner: https://groups.google.com/forum/#!searchin/clojure/transducer$20lazy/clojure/tiMTLJEt9fQ/FP8xRjdAgDQJ

16:46 tbaldridge: hiredman: but that only comes into play when using sequence, you're right, take will terminate the reduce as expected

16:46 hiredman: tbaldridge: sure, I am not distbuting the that the "laziness" is different

16:46 tbaldridge: I am saying, given what arohner has said, it sounds like transducers just do that

16:47 arohner: hiredman: I never said I was using sequence

16:47 amalloy: i was surprised to find just now how few calls to mapcat there are in clojure.core. i would have expected like five or ten for such a useful primitive function, but it turns out there are only two. one in tree-seq, and one in load-lib which could just be an apply concat

16:47 hiredman: arohner: I never assumed you were

16:47 I barely know what sequence is

16:48 tbaldridge: sequence can transform a transducer into a lazy-seq. That's normally what I think of when I think 'lazy', a lazy-seq

16:48 dbasch: amalloy: I hope there are no calls to flatten

16:48 ode: Can someone explain what the empty vector in http://pastebin.com/pSi5Etmd is for? Thanks

16:49 hiredman: tbaldridge: which is sort of my point, "lazy" is kind of a fuzzy label for computations with results made available on demand

16:49 amalloy: ode: have you read the docstring for reduce?

16:49 hiredman: some people may strongly associated that kind of behaviour with lazy seqs

16:49 justin_smith: dbasch: to my surprise, even flatten does not call flatten (though with the obvious implementation it would)

16:50 tbaldridge: hiredman: fair enough

16:51 stuartsierra: tbaldridge: puredanger avoids 'lazy' when describing `sequence`

16:51 There's some distinction between what `sequence` does and Clojure lazy seqs. It's fuzzy to me.

16:51 puredanger: I'm going with "incrementally computed" now to avoid confusion. sequence is "lazy" but with different semantics than we usually use

16:51 dbasch: justin_smith: here's a nice solution to a questionable (imo) interview question, marred by the unnecessary use of flatten http://java.dzone.com/articles/my-favorite-coding-interview#comment-121223

16:52 hiredman: clojurebot: puredanger |prefers| to describe `sequence` as a shiftless wanderer on the highway of life

16:52 clojurebot: Alles klar

16:52 stuartsierra: puredanger: "on-demand transducing power"

16:52 puredanger: y'll crazy

16:52 hiredman: poetic

16:52 stuartsierra: "Elastic Transduction"

16:52 puredanger: who's in to deprecate flatten? :)

16:53 hiredman: don't toy with us

16:53 tbaldridge: , (first (sequence (map (fn [x] (range)) [1]))

16:53 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

16:53 stuartsierra: puredanger: ooh, me!

16:53 tbaldridge: , (first (sequence (map (fn [x] (range)) [1])))

16:53 clojurebot: (0 1 2 3 4 ...)

16:54 tbaldridge: now that's interesting....

16:54 ah, didn't mapcat, << I fail

16:54 , (first (sequence (mapcat (fn [x] (range)) [1])))

16:54 clojurebot: 0

16:54 puredanger: tbaldridge: exactly - sequence fully evaluates each "step" so a step that generates an infinite intermediate value will blow up (compared to lazy seqs which generally will not)

16:55 this is not a bug; just a consequence of different computation models

16:55 tbaldridge: yeah, that's what tripped me up originally, I was just pointing it out.

16:55 yep, I agree, not a bug

16:55 arohner: le'ts say the output of my transducer is (a/chan 1), and my intermediate step generates 1000 items. does the reduce finish?

16:55 hiredman: puredanger: if you generate an infinite reducible I am not sure it will blow up

16:55 arohner: where do those intermediate items go?

16:55 dbasch: how many times do I need to use clojure.string/split to remember that the string comes first and the regexp second?

16:55 justin_smith: dbasch: fascinating

16:55 (dec flatten)

16:55 lazybot: ⇒ -3

16:56 hiredman: oh, pfft, channels? who knows

16:56 ode: amalloy: I read it, but I still don't understand.

16:56 puredanger: dbasch: just think of the string as the "collection" and collections always go first

16:56 dbasch: collections first, no collection left behind

16:56 ode: amalloy: Is the empty vector the value?

16:57 technomancy: collections go first now??

16:57 lazybot: technomancy: Uh, no. Why would you even ask?

16:57 justin_smith: ode: yes, it's the arg named "val" in the parameter list

16:57 puredanger: I'm running some generative tests that compose operations with both seqs and transducers and compare results right now. just got a nice weird failure after a few thousand tests.

16:59 ,(partition-by pos? (take 33 [-10 27 22 7 6 9 -1 -43 1 -12 -9 21 -9 35 -30 8 -7 -38 -30 33 6 4 -15 45 -39 -43 -29 -44 0 -10 -31 0 23 -15 9 -22 -40 -7 -31 46 -13 -44 28]))

16:59 clojurebot: ((-10) (27 22 7 6 9) (-1 -43) (1) (-12 -9) ...)

16:59 puredanger: ,(sequence (comp (take 33) (partition-by pos?)) [-10 27 22 7 6 9 -1 -43 1 -12 -9 21 -9 35 -30 8 -7 -38 -30 33 6 4 -15 45 -39 -43 -29 -44 0 -10 -31 0 23 -15 9 -22 -40 -7 -31 46 -13 -44 28])

16:59 clojurebot: ([-10] [27 22 7 6 9] [-1 -43] [1] [-12 -9] ...)

16:59 puredanger: hrm

16:59 the difference is at the end

16:59 ,(last (sequence (comp (take 33) (partition-by pos?)) [-10 27 22 7 6 9 -1 -43 1 -12 -9 21 -9 35 -30 8 -7 -38 -30 33 6 4 -15 45 -39 -43 -29 -44 0 -10 -31 0 23 -15 9 -22 -40 -7 -31 46 -13 -44 28]))

16:59 clojurebot: [-39 -43 -29 -44 0 ...]

16:59 puredanger: ,(last (partition-by pos? (take 33 [-10 27 22 7 6 9 -1 -43 1 -12 -9 21 -9 35 -30 8 -7 -38 -30 33 6 4 -15 45 -39 -43 -29 -44 0 -10 -31 0 23 -15 9 -22 -40 -7 -31 46 -13 -44 28])))

16:59 clojurebot: (23)

17:00 justin_smith: puredanger: lazybot gives a refheap link with the full output (but sadly is not using clojure 1.7)

17:00 mengu: hi all. how can i pass elements of a list or seq like '("git" "push" "origin" "master") as arguments to sh func defined in clojure.java.shell? i've been pulling my hair off but couldn't come up with anything so far.

17:01 justin_smith: mengu: apply

17:01 Bronsa: (sequence (comp (take 2) (partition-by pos?)) [-1 1])

17:01 ,(sequence (comp (take 2) (partition-by pos?)) [-1 1])

17:01 hiredman: ,(doc partition-by)

17:01 clojurebot: ([-1])

17:01 "([f] [f coll]); Applies f to each value in coll, splitting it each time f returns a new value. Returns a lazy seq of partitions. Returns a stateful transducer when no collection is provided."

17:01 Bronsa: puredanger: ^ minimal case :)

17:01 puredanger: thx :) I grabbed that straight off the screen. that was the best test.check shrink could do with it :)

17:02 justin_smith: ,(apply str ["this" "builds" "a" "string"]) ; mengu - of course you want the sh function instead of str in your case

17:02 clojurebot: "thisbuildsastring"

17:02 mengu: oh me, stupid me

17:03 Bronsa: puredanger: I just noticed there's no partition transducer, any reason?

17:03 puredanger: I don't know why

17:03 reiddraper: puredanger: sounds like fun :)

17:03 arohner: are there any clojure parsing libraries that tokenize via regex, rather than parser combinators?

17:03 Bronsa: uhm, looks like a complete partition transducer can't be done with the current arities

17:03 puredanger: reiddraper: yep, we'll be adding test.check to core for 1.7 to enable writing tests with it

17:03 hiredman: arohner: instaparse

17:04 Bronsa: nice!

17:04 reiddraper: puredanger: yay

17:04 puredanger: reiddraper: I don't mean adding *into* core, but using as a dependency like we do with test.generative

17:04 mengu: justin_smith: thank you. couldn't wrap my head around it. i've been trying to change the arg and send them to sh, instead of just trying apply sh.

17:04 reiddraper: puredanger: that's what i figured you meant

17:05 justin_smith: mengu: yeah, apply is a game changer to be sure

17:05 reiddraper: puredanger: looks like the example you're having is a fun case for improving shrinking, and i have a guess as to what the issue is, something gfredericks pointeded out to me

17:05 arohner: hiredman: thanks

17:06 Bronsa: puredanger: interestingly, it looks like cgrand/laurentpetit's transducers reimpl doesn't suffer from this bug (https://gist.github.com/laurentpetit/403bb61bd69765482e6a)

17:08 ah but they don't use LazyTransformer, and it looks like that's where the bug originates..

17:25 vIkSiT: hello all

17:26 when doing iterative dev, rather than use the repl within emacs, is there a recommended way to have fast execution with lein run? I see that a lein run ... takes upto 8-15 seconds to run a imple hellow world with a bunch of requires

17:26 technomancy: vIkSiT: use the repl outside emacs

17:27 vIkSiT: technomancy, ah.

17:27 danielszmulewicz: Can transit+json serialize/deserialize nested maps like the following out of the box or is there additional work to be done? {:twitter {:access-token-response {:user_id "123577893"}}}

17:27 vIkSiT: I guess lein repl is one option

17:28 technomancy, does lein repl load all clj files in it when run simply from the project root dir?

17:29 eg, i have a ns called a.b and -main within it

17:29 on running lein repl, (a.b/-main 2) doesn't work.

17:29 justin_smith: vIkSiT: require the ns

17:29 (require '[a.b :as b])

17:29 vIkSiT: oh right. duh.

17:30 ty

17:30 justin_smith: I think there is an option to do that automatically by setting the main repl ns, but it's easy enough to do that

17:30 np

17:30 technomancy: don't use :main

17:30 vIkSiT: actually

17:30 technomancy: since there's a bug where it implies AOT

17:30 vIkSiT: is there a good way to do the auto-ns load?

17:30 technomancy, oh?

17:30 ah

17:30 so far, all my ns's have :gen-class and -mains

17:30 technomancy: I tried to get rid of it for the 2.0 release and someone un-got-rid of it

17:30 vIkSiT: I see

17:30 whats your recommendation as an alternative?

17:31 technomancy: use :repl-options {:init my.ns} I think

17:31 vIkSiT: (I want to distribute this to others for use in bash scripts as well..)

17:31 technomancy: if you just want it for the repl

17:31 if you care about startup time, put :main in your uberjar profile

17:31 otherwise use java -cp myporject.jar clojure.main -m my.ns

17:32 vIkSiT: is that the same as lein run -m my.ns/-main?

17:32 and for the others, I presume you mean putting those options into project.clj..

17:32 technomancy: very close

17:32 yeah

17:32 vIkSiT: gotcha

17:46 SagiCZ1: ,(min (map #(% 1) [[4 5] [3 6]]))

17:46 clojurebot: (5 6)

17:46 SagiCZ1: why doesnt this return just 5 ?

17:47 turbofail: ,(apply min (map #(% 1) [[4 5] [3 6]]))

17:47 clojurebot: 5

17:47 turbofail: min doesn't work on a single input sequence, it works on multiple arguments

17:48 SagiCZ1: of course.. thank you

17:48 how would i combine apply with juxt? i wanted something like (juxt min max coll)

17:49 i probably didnt want that, discard that

17:51 justin_smith: ,(apply (juxt min max) (range 10))

17:51 clojurebot: [0 9]

17:55 gfredericks: ,(fn [nums] (reduce (fn [m x] (-> m (update :min min x) (update :max max x))) {:min (first nums) :max (first nums)} (rest nums)))

17:55 clojurebot: #<sandbox$eval103$fn__104 sandbox$eval103$fn__104@11aa87e>

17:55 gfredericks: ,((fn [nums] (reduce (fn [m x] (-> m (update :min min x) (update :max max x))) {:min (first nums) :max (first nums)} (rest nums))) (range 10))

17:55 clojurebot: {:min 0, :max 9}

17:56 gfredericks: ^ that doesn't get any easier does it? :/

17:56 I guess you could abstract it into some sort of parallel-reduce

17:56 turbofail: juxt-transducer

17:57 justin_smith: juxtuser

17:57 juxtuicer

17:57 AeroNotix: juicer

17:57 juxt and transducers on steroids

17:57 juicer

17:57 mdeboard: nice

17:57 I like it

17:58 gfredericks: I was thinking reduced would be problematic but it wouldn't actually

18:02 juxtduce: https://www.refheap.com/92072

18:02 mdeboard: justdance*

18:04 gfredericks: oh I forgot to think about reduced

18:04 the punchline was going to be running it on an infinite seq where each fn reducedes at a different point

18:04 justin_smith: gfredericks: of course with [min max] it's no different from (apply juxt ...) - interesting for other uses to be sure

18:04 hiredman: gfredericks: you should make it a transformer of reducing functions, instead of a special reduce

18:05 gfredericks: justin_smith: it's different for memory

18:05 justin_smith: yes

18:05 hiredman: (reduce (juxtduce {:min min :max max}) ...)

18:05 justin_smith: hiredman: ahh, that would be a very useful function

18:05 (inc hiredman)

18:05 lazybot: ⇒ 59

18:06 gfredericks: instead of doing that I am going to go home. but yes that is a gooder idea

18:06 bonus points for handling reduced correctly :)

18:06 mdeboard: &(doc juxt)

18:06 lazybot: ⇒ "([f] [f g] [f g h] [f g h & fs]); Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"

18:41 EvanR: what is this function .-length

18:42 TEttinger: EvanR: in clojurescript?

18:42 EvanR: and why cant reference to field length be resolved when i turn reflection warnings on

18:42 justin_smith: EvanR: the length property of an object

18:42 EvanR: whats the - ?

18:42 justin_smith: it disambiguates properties from methods

18:42 EvanR: oh

18:42 justin_smith: .-x is property x, .x is method x

18:42 (or property x)

18:42 EvanR: java has properties separate from methods

18:43 or is this also for clojure objects

18:43 justin_smith: clojure objects are java object (or javascript, or clr...)

18:43 in cljs it can be ambiguous, so .- was introduced

18:44 in java it can't be ambiguous

18:44 EvanR: should (.-length ^String foo) stop a reflection warning?

18:45 justin_smith: it's not a field though, it's a method

18:45 ,(.-length "hello")

18:45 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: length for class java.lang.String>

18:45 justin_smith: ,(.length "hello")

18:45 clojurebot: 5

18:45 * EvanR wonders whether this code was even working

18:45 EvanR: ill try that thanks

18:46 justin_smith: yeah, the javadoc shows clearly that length on a string is a method and not a field

18:46 (I just double checked)

18:46 amalloy: arrays are more exciting

18:46 EvanR: no dash worked on the variable that i know is a string, but if i dont put the type hint i still get a warning

18:46 you have to go through this in clojure to get the length of a string?

18:47 ,(strlen "foo")

18:47 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: strlen in this context, compiling:(NO_SOURCE_PATH:0:0)>

18:47 justin_smith: EvanR: count

18:47 ,(count "hello")

18:47 clojurebot: 5

18:47 justin_smith: ,(count "Dracula")

18:47 clojurebot: 7

18:47 * EvanR uses count

18:48 EvanR: on this other variable, removing the dash and adding ^String silences the warning, but the thing is, i doubt that this is actually a String

18:48 will the program crash?

18:49 like a bad C cast

18:49 TEttinger: you can check with (class my-var)

18:49 ,(class "a string")

18:49 clojurebot: java.lang.String

18:50 EvanR: yes i think this one will be various different classes

18:51 actually its a String

18:51 do bad type hints cause a crash with no indication from the compiler?

18:51 justin_smith: EvanR: a type hint is not a cast

18:52 EvanR: it helps streamline method lookup, and if correct it prevents reflection (but if it is wrong the code won't totally break)

18:52 EvanR: totally?

18:53 justin_smith: ,(map (fn [^Double x] (+ x x)) [1.0 1 1/2])

18:53 clojurebot: (2.0 2 1N)

18:53 justin_smith: iirc an inaccurate hint hurts performance though

18:54 amalloy: well, that's not a super-great example, justin_smith

18:54 justin_smith: amalloy: OK, what's a good one?

18:54 amalloy: (fn [^String x] (+ x x)) behaves the same way: the compiler sees no use for a type hint of any sort there

18:54 justin_smith: oh, OK

18:55 amalloy: (fn [^double x] (+ x x)) might act a little weird, i dunno, but probably all your stuff can be coerced successfully to doubles so it should be fine

18:55 justin_smith: ,(map (fn [^double x] (+ x x)) [1.0 1 1/2])

18:55 clojurebot: (2.0 2.0 1.0)

18:55 justin_smith: ahh, interesting

18:55 clearly there is still stuff I don't get here

18:56 EvanR: (successfully-coerce ^double 1/3)

18:56 amalloy: a bad typehint *can* cause performance degradation, in the case of primitives, but that's sorta hard to do; on reference types it either does nothing at all or just changes the error message you get

18:57 EvanR: good to know

18:57 a string is a reference type?

18:57 TEttinger: yes

18:57 they're immutable but yes

18:57 amalloy: all types that start with capital letters are (by convention, not by technical necessity)

18:57 technomancy: "reference type" has two different meanings in clojure FWIW

19:00 EvanR: and thats all for today

19:00 justin_smith: "all done, brain full" - I can relate

19:02 TEttinger: ,(#(`[~@%] (`[~@%&] (+))) [:? :| :> :<] (+ (*) (*)))

19:02 clojurebot: :>

19:04 dbasch: this is uuuuugly http://benchmarksgame.alioth.debian.org/u64q/program.php?test=pidigits&lang=clojure&id=5

19:04 arrdem: lol yeah most of the clojure submissions are Java in sexprs

19:05 amalloy: arrdem: not even that; they're gmp-in-java-in-sexprs

19:05 arrdem: amalloy: lol

19:06 amalloy: it's just evidence that alioth tests the wrong stuff. under the current rules, most problems reduce to "what FFI code do you need to run to get this stuff done by a C library"

19:06 arrdem: it would be interesting to see how much you could clean that up with a macro dsl..

19:07 I would agree with that... the issue is that you then run into the tarpit of ensuring that "solutions" are "idiomatic" or "normal"

19:07 amalloy: sure. testing the right thing isn't easy

19:08 arrdem: I think there's an interesting case to be made that benchmarking Clojure kinda misses the point as well, since really what you want to benchmark is dev/patch time not runtime in many cases.

19:08 see use of Clojure/Python in webapps dominated not by CPU but by network latency

19:09 amalloy: i don't understand all the reassembled opcodes stuff in that particular example, though

19:12 TEttinger: amalloy: they disassembled a gmp lib that they can't use directly, it seems

19:12 there are actually some comments, oddly

19:13 amalloy: but look, the bytecodes they generate just call out to some other library

19:13 TEttinger: I think it's because C is allowed other libs, but jgmplib is a 3rd party binding in java land

19:17 amalloy, or because they save some time by doing it this way, maybe it's a partial implementation of jgmplib

19:34 mdeboard: Anyone know when bbatsov et al are releasing a new version of CIDER to Melpa?

19:34 Melpa stable*

19:34 justin_smith: TEttinger: amalloy: big parts of gmp aren't written in C https://gmplib.org/repo/gmp/file/bfc8adc7cdfe/mpn/x86_64

19:34 or at least significant parts

19:35 TEttinger: justin_smith, yeah I mentioned it in another channel and someone said the same

19:36 justin_smith: mdeboard: #clojure-emacs would be a good place to ask that

19:36 mdeboard: oh

19:36 That's a thing? Cool

19:37 justin_smith: mdeboard: yeah, I think batsov follows that channel but not this one

20:12 andyf_: Opinion: too many people dismiss all of the shootout benchmarks because of the existence of pidigits. Ignore that one, and things are somewhat less wacky

20:14 justin_smith: andyf_: is this cross language, or just in Clojure's case?

20:14 arrdem: andyf_: would you be interested in trying to pick a notes data format so that we can share data between thalia and Grimoire? Right now there's not a great way for me to push stuff back to you.

20:15 andyf_: Pretty much cross language pidigits is an outlier, even for the shootout. Every language advocate doesn't want an unfair shake on that one, so they all try to use libgmp to get similar performance

20:16 justin_smith: fascinating

20:17 andyf_: arrdem: You mean a different markup syntax than github flavored markdown ? Sure, suggest something else and I'll look at it

20:17 arrdem: andyf_: nvm I was thinking about https://github.com/jafingerhut/thalia/blob/master/resource/en_US.clj which I can totally generate from the work I did this weekend.

20:18 technomancy: the problem is that the percentage of people who will end up writing code that pushes that hard against the perf boundaries of a language is miniscule, but the percentage of prospective users making decisions based on the benchmarks is much higher

20:18 justin_smith: excellent point

20:19 andyf_: I say all, but there are I think even an exception or three to that statement. Last I checked, Perl pidigits didn't bother to use libgmp

20:20 technomancy: Much information can be misused. Not the fault of the information

20:20 technomancy: andyf_: naturally; facts are facts.

20:21 TEttinger: I would say that idiomatic clojure is not fast to run compared to "java in sexps" clojure, but it is much easier to reason about and faster to write

20:22 technomancy: you can't stop people from making technology decisions based on flawed criteria because making informed choices is legitimately very difficult

20:23 TEttinger: still, you can point to "program written in java" and "same program rewritten in clojure" and show that clojure's version is much much smaller

20:26 dbasch: TEttinger: also that code is like a submarine made of paper, just to show that it can be done

20:27 TEttinger: dbasch: you mean the benchmark code?

20:27 dbasch: yes

20:27 arrdem: how much wax can you use to waterproof a paper submarine and still have a paper submarine not a wax submarine..

20:27 gfredericks: arrdem: seven waxes

20:27 amalloy: arrdem: as long as you replace the paper with wax in very small increments it stays the same ship all along

20:28 arrdem: well played amalloy

20:28 amalloy: pretty sure theseus proved that

20:28 arrdem: gfredericks: so I get seven javas to benchmark with?

20:28 gfredericks: java versions 1 => 7

20:28 amalloy: wait, there's a *movie* named Ship of Theseus?

20:28 dbasch: arrdem: seven javas for seven brothers

20:29 although with java 1.0 you may get old before the benchmark ends

20:29 TEttinger: turn into an Oak

20:29 gfredericks: java 9 should rebrand as java 10

20:29 TEttinger: apparently java is why they couldn't use Windows 9

20:30 amalloy: gfredericks: in java's case it'd make more sense for 10 to rebrand as 20

20:30 dbasch: amalloy: that movie was originally named Titanic, but you wouldn't recognize it

20:30 amalloy: ~rimshot

20:30 clojurebot: Badum, *tish*

20:30 justin_smith: gfredericks: funny enough, one of the main examples I saw of programs that checked if the Windows version string started with "Windows 9" was openjdk

20:30 TEttinger: a number of major programs, including java, apparently check for a string containing "windows 9" to detect windows 95 or 98

20:30 justin_smith: (thus leading to windows 9x related workarounds being applied)

20:31 ME reported as "Windows 9x" for this reason

20:31 I am sorry to bring up the memory of that shitshow of a version

20:32 gfredericks: computers are exciting

20:32 macackack: What does the underscore mean in this? (fn [_ _] (clear-expired-sessions))

20:32 TEttinger: macackack: it is a customary name for an unused variable

20:32 justin_smith: gfredericks: by the amount of ranting and anger I have witnessed, that is 100% correct

20:32 macackack: oic

20:32 TEttinger: so that fn takes two args, but doesn't use either

20:33 you could still actually use _ and it would refer to the second arg

20:33 ,((fn [_ _] (println _)) 1 2)

20:33 clojurebot: 2\n

20:33 TEttinger: ,((fn [a a] (println a)) 1 2)

20:33 clojurebot: 2\n

20:34 macackack: ok got it

20:34 thanks

20:34 TEttinger: np

20:34 there is a different thing to note though!

20:34 macackack: ya

20:34 TEttinger: #_ is an ignore form reader macro. it makes the next thing, say, #_(+ 1 2) , not get evaluated at all

20:35 justin_smith: ,(+ #_ "boo" 1 1)

20:35 clojurebot: 2

20:35 TEttinger: it's like (comment (+ 1 2)), but it doesn't return nil

20:35 macackack: huh interesting

20:35 #_ is a different thing although

20:35 it just looks similar

20:35 TEttinger: ,(+ (comment "boo") 1 1)

20:35 clojurebot: #<NullPointerException java.lang.NullPointerException>

20:35 TEttinger: yep

20:35 just another use of underscore

20:35 macackack: thanks :)

20:36 TEttinger: no prob, it's a cool feature

20:36 gfredericks: ,[#_#_1 2 3 #_ #_ 4 #_ 5 6 7]

20:36 clojurebot: [3 7]

20:37 amalloy: challenge for TEttinger, since you brought it up: construct an expression which evaluates to 5, but which instead throws an exception if you add a #_ form into it without changing anything else

20:38 TEttinger: ,(/ 5 (- 5 5 2))

20:38 clojurebot: -5/2

20:38 TEttinger: ,(/ 5 (- 5 5 #_2))

20:38 clojurebot: #<ArithmeticException java.lang.ArithmeticException: Divide by zero>

20:38 justin_smith: ,5

20:38 clojurebot: 5

20:38 justin_smith: ,#_5

20:38 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

20:38 TEttinger: err, evaluates to 5?

20:38 amalloy: TEttinger: no no, add something that looks like #_x

20:38 don't just add the #_

20:39 TEttinger: oh geez

20:39 justin_smith: ahh - that's a more interesting problem

20:40 dbasch: like this?

20:40 ,(quot 15 #_ 3)

20:40 clojurebot: #<CompilerException clojure.lang.ArityException: Wrong number of args (1) passed to: core/quot--inliner, compiling:(NO_SOURCE_PATH:0:0)>

20:40 justin_smith: dbasch: you need the x

20:40 gfredericks: ,(doto (count "heyho") (-> (= 5) (assert)))

20:40 clojurebot: 5

20:40 gfredericks: ,(doto (count "#_cheating heyho") (-> (= 5) (assert)))

20:40 clojurebot: #<AssertionError java.lang.AssertionError: Assert failed: (= G__289 5)>

20:41 justin_smith: haha

20:41 amalloy: okay, i will try to state the puzzle more formally. you have a form f that evaluates to 5, and an additional syntactically-valid form g. you add #_g somewhere inside of f, and now you get an exception

20:41 TEttinger: ,(eval (read-string (str '(5 #_x))))

20:41 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

20:42 TEttinger: ,(eval (read-string (str '(+ 5 #_x 5))))

20:42 clojurebot: 10

20:42 TEttinger: ,(eval (read-string (str (apply quot (+ 5 #_x 5)))))

20:42 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>

20:42 TEttinger: ,(eval (read-string (str (map quot (+ 5 #_x 5)))))

20:42 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>

20:42 TEttinger: gah

20:42 amalloy: TEttinger: try in your repl?

20:42 TEttinger: yes

20:50 ,(/ 100 (-> 0 inc) 4 5)

20:50 clojurebot: 5

20:50 TEttinger: ,(/ 100 (-> 0 #_#_dec inc) 4 5)

20:50 clojurebot: #<ArithmeticException java.lang.ArithmeticException: Divide by zero>

20:50 justin_smith: you added an extra #_

20:50 TEttinger: amalloy: is that a syntactically valid form?

20:50 yes

20:52 amalloy: TEttinger: the form you're claiming to have added after "#_" is...#_dec? that's not a form at all, it's a no-op

20:52 TEttinger: aww

20:52 dinner time

20:54 gfredericks: TEttinger: amalloy and I have come up with four different dodgy answers to this

20:54 amalloy: two legit answers, two dodgy ones

20:55 gfredericks: now everybody is going to drop this and forget about it and 150 years from now mathematicians will start working on Amalloy's Last Theorem

20:55 they'll have 3 answers and won't be able to find a 4th

20:56 amalloy: if i'm getting that much historical attention i should make some more exciting claims

20:57 gfredericks: "the largest pair of twin primes are really big"

20:57 macackack: hahaa

20:58 justin_smith: the math world spends the next century arguing the definition of fredericksonian bigitude

21:00 amalloy: i have to leave fairly soon, so here is a SPOILER PASTE containing the four answers to this puzzle that gfredericks and i thought of: https://www.refheap.com/d74b6a3269a7de61d78b01e5d

21:00 gfredericks: oh noes think of the future mathematicians

21:00 they'll be so bored now

21:01 arrdem: lol

21:02 apparently irc has sufficiently large margins for amalloy

21:02 gfredericks: clojurebot: refheap is a sufficiently large margin

21:02 clojurebot: c'est bon!

21:02 amalloy: refheap's margins are razor-thin

21:02 one might even call them zero

21:02 justin_smith: ahh, I knew it had to be reader related

21:03 gfredericks: oh hey I thought of another

21:03 difficult to demo though

21:03 [[[[....[[[ #_[]]]]....]]]]

21:03 ^ the straw that broke the stack's back

21:04 also make it eval to 5 somehow :P

21:05 justin_smith: ((constantly 5) [[[...[#_[]]...]]])

21:05 gfredericks: only one of these actually gets a runtime exception eh?

21:05 justin_smith: cheats upon cheats

21:05 amalloy: hah

21:06 gfredericks: that's even worse than the ````` solution, since it depends a lot more on your runtime environment

21:06 gfredericks: hey hey I win "worst answer so far"

21:08 * gfredericks unarrives

21:25 cddr: Do you think you'd get in trouble for naming your OSS project after a dilbert character?

21:26 justin_smith: cddr: scott adams is a balloon headed jackass

21:27 (he showed up in a forum I frequent, it was painfully hilarious)

21:27 jakecraige: How do you import a client side from a clojar? I'm specifically trying to use this with ClojureScript: https://github.com/whodidthis/pouchdb-cljs

21:28 I added it to the cljs build steps in preamble and externs but the global still isn't available

21:29 cddr: Maybe so but "ratbert" seems like a good name for a testing library

21:34 justin_smith: cddr: I think so too, but just warning you. Someone linked to an article criticizing his comics and he came in with a sockpuppet account pretending to just be a random fan being like "don't second guess Scott, he's a certified genius and he's doing stuff in his comics you don't get" yadda yadda

21:35 and then a moderator revealed that he payed for the account using a credit card belonging to Scott Adams...

21:35 cddr: huh interesting

21:35 justin_smith: it was kind of hilarious in a car-wreck kind of way...

22:12 travisrodman: i am working with compiling clojure code under maven, but under test the code needs access to the underlying platform, there was a fork of the theoryinpractise mojo by stewart sierra introducing the control of sub-forks during compilation, but that is ~5 years old. has anyone any recent experience with needing to control compilation in this way? the current code for the plugin doesn't seem to support the configuration

22:14 *stuart

22:14 * talios looks up

22:14 talios: define underlying platform ( btw: clojure-maven-plugin is mine )

22:15 I didn't hear about stuart making that fork? at least - I never saw any pull requests wanting to merge it back ( at least, not that I recall ? )

22:15 travisrodman: hi talios, thanks for fielding the question, I appreciate it.

22:15 talios: hrm - how bad - i have 7 open pull requests there - I should look at them :)

22:16 what is it that you need to do?

22:16 travisrodman: i don't think there was ever a request set up for it.

22:16 i have tests depending on configuration avaialble in the maven build, but when the plugin runs the tests, it is forking into its own space, making the initial information unavailable and causing the tests to fail...

22:17 these work fine in repl, since the required class instantiations are initialized with the construction of the repl

22:17 thanks for the plugin btw, it really is incredibly useful

22:18 i think if i can constrain the forking, as you would with the normal maven build it would force it into the same jvm, preserving the configuration

22:19 essentially that is what stuart's modification was to do. it is here: https://github.com/stuartsierra/clojure-maven-plugin

22:19 talios: mmm, what sort of configuration are we talking about?

22:20 travisrodman: well, it isn't the information per-se that needs to be passed, but the fact that we have the platform instantiated in an embedded instance in the course of the normal maven testing

22:20 it appears the forks do not have acces to that construction

22:21 so, when they make calls on class instances, they are not properly avaialble, throwing erorrs

22:21 i can't go the alternative route, and have multiple instances of the platform, as they would conflict with one another

22:21 talios: ahh - so you have some other mojo that's running in-process

22:22 travisrodman: so, i need to access the originally constructed instance

22:22 yes.

22:22 i think, if i could control the forking, the instance would be properly accessible to the tests

22:23 this is the hash from stuart's changes: c651dc1

22:23 but it is really old..

22:24 i don't mind updating it, and if necessary we would have to maintain a fork for ourselves, unless you were willing to take the patch back, given it meets your approval

22:24 talios: Looks like stuart made only the one commit - which doesn't look too epic. I vaguely remember him mention in here he made it, but had some problems of something

22:25 travisrodman: okay.. then i guess what i am reading is correct, that it is not something current, nor available...

22:25 talios: no worries - I was going to suggest I'd take a look at it tonight when I get home - but you're more than welcome to contribute :)

22:25 travisrodman: okay, i am good with that.

22:26 thanks for being open to it, i really appreciate it.

22:27 @talios you have a branch called processforking, i haven't read it yet, but is this related to this topic, or is that something else?

22:28 talios: travisrodman - hrm, your right - that's stuarts commit!

22:29 * talios does a local rebase

22:29 travisrodman: yeah.. 2010

22:30 * talios tries building it as it is first. Wonder why I never merged that...

22:30 travisrodman: thanks for looking at that

22:31 talios: euu - it has committed merge <<<<<< lines ;p

22:31 travisrodman: haha

22:31 maybe that is why...

22:32 talios: wow - that branch is back in clojure 1.2.0 days!

22:32 travisrodman: well, i don't mind taking a look at it and getting it functional on the current code, it is a problem we need to solve..

22:32 amalloy: i wrote myself an emacs function that checks for unbalanced parens and merge-conflict markers before calling git-add

22:32 travisrodman: seriously back in the day...

22:33 @amalloy nice...

22:33 okay, so, i'll take a look at it and get back to you in a bit then... if that is alright with you.

22:35 talios: ok, some of the IT tests failed there.

22:35 travisrodman: yeah, being that old, it doesn't surprise me.

22:36 well, actually, you are testing off what was current at the time... so it needs some attention, apparently

22:39 @talios thanks again... i will catch up with you.

22:40 talios: ok, thats a nasty rebase :)

22:40 will look later tonight.

23:03 myguidingstar: hi all, I have two in-progress lein projects, one of which is a generic library and the other depends on it

23:03 every time I make changes to the library, i have to `lein install`

23:04 so the dependent app gets the latest snapshot

23:04 is there any better way?

23:05 so the dependent app have the library source in its paths

23:14 technomancy: myguidingstar: oh boy, it's your lucky day

23:14 myguidingstar: `lein help faq` <- look under "checkouts"

23:15 myguidingstar: okay, let's see

23:18 (inc technomancy)

23:18 lazybot: ⇒ 149

23:19 arrdem: &(/ 5.5 2)

23:19 lazybot: ⇒ 2.75

Logging service provided by n01se.net