#clojure log - Nov 04 2014

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

0:01 sm0ke: nestastubbs: it is a very interesting idea though

0:02 i think you need a parser which parses each key lazily

0:02 nestastubbs: you ever seen Ragel?

0:02 sm0ke: nope

0:03 but regex are also kind of state machines right?

0:03 nestastubbs: http://en.wikipedia.org/wiki/Ragel

0:04 sm0ke: i dont see how it will help except from may be a very fast lexer

0:06 nestastubbs: it's overkill for this task

0:06 sm0ke: how about is cheshire return you a lazy map, and each key is parsed only upon first access

0:07 nestastubbs: nope

0:07 sm0ke: :)

0:07 nestastubbs: too complicated

0:08 sm0ke: yep too complicate for {"a": 1}

0:08 but for a json in gigbytes?

0:09 like the one you have

0:09 :P

0:09 nestastubbs: not gigabytes

0:09 megabytes tho

0:09 ok, I gota go to bed

0:09 latah!

0:09 sm0ke: ok sleep on it

0:09 nestastubbs: thanks for noodling

0:33 ddellacosta: anyone in here used riemann? I'm having trouble getting it to pick up events. Using the 2.6 server and the clojure client

0:33 just running it on

1:03 vIkSiT: hello all

1:03 I forked a github project, and i want to use it with some changes using lein.

1:03 so far, i use the [lib-v.0.0] in my project.clj

1:04 how do I build this and use it using lein so that my user project points to the local version and not the one on clojars?

1:05 dgellow: today I learned: after having modified a defrecord, always run `lein clean` !

1:05 luxbock: vIkSiT: you can do `lein install' in the forked project directory and then use it normally through Leiningen

1:06 vIkSiT: luxbock, but lets say my project.clj contains [mylib-1.0.0-snapshot]

1:06 if i do a lein install

1:07 how does it know to pick up my version rather than the one in clojars?

1:07 luxbock: the dependencies are stored locally in ~/.m2

1:08 so once you have it there then it leiningen won't need to find it from Clojars anymore

1:12 vIkSiT: ahh

1:12 got it

1:12 thanks luxbock

1:54 ddellacosta: argh, setting up riemann's dashboard is making me want to cry

1:54 the docs are non-existent and/or wrong

1:55 kenrestivo: well, there's palet, puppet, jclouds...

1:56 bjeanes: Is there a way to do do a sort of "blocking pop" on a PersistentQueue? I'm can only see looping on a deref to wait for it to be non-empty but without doing that in a transaction it could still try to pop an empty queue. Either way, it kills the CPU. Should I just be using a java.util.concurrent.BlockingQueue instead?

1:56 amalloy: ddellacosta: try asking aphyr? he's not in here, but i think he's pretty responsive on twitter

1:56 bjeanes: I feel like... yes but want to make sure it's not just that I don't know how to think in PersistentQueues (as I've not used them properly)

1:56 ddellacosta: amalloy: yeah, I'll try that, thanks

1:57 amalloy: bjeanes: if you want a concurrent blocking mutable queue, j.u.c is pretty good for that. you can implement it in clojure as an atom around a queue in a much better way than you're suggesting, but there's no real need to

1:57 ddellacosta: kenrestivo: as far as I know riemann is doing different stuff than those

1:57 bjeanes: amalloy: cool, I'll go with the j.u.c but for my own curiosity/learning what should I read about or think about to do it with persistent queues?

1:59 ddellacosta: aha, breakthrough, apparently a "view" is the thing the instructions are written on

1:59 amalloy: bjeanes: well, you can avoid popping an empty queue by following the one rule of thread safety: make all important decisions inside of a swap! or a dosync. like, never ever write (if (seq @a) (pop @a)), because those aren't connected

2:00 instead, swap! it with a function that checks if it's empty, and then if not pops it

2:00 * ddellacosta sees the clouds part, the query editor appears from above

2:00 amalloy: additionally, to avoid the spinlock, you can use watchers, such as with https://github.com/amalloy/useful/blob/develop/src/flatland/useful/state.clj#L54

2:02 that wait-until doesn't enable you to modify it when a condition is met, but does let you block until that condition is met, at which point you can open a transaction (or a swap!) and double-check that it's still set, following the same suggestion about doing all the work inside a transaction

2:02 bjeanes: amalloy: thanks that helps. I am doing the pop inside the dosync but not the while loop. I forgot that transactions will all be attempted more or less simultaneously and was in my DB mind of "don't hold the transaction open".

2:02 amalloy: bjeanes: transactions are "free"

2:02 bjeanes: amalloy: ah perfect. I'll look at that a bit. I knew I was missing an ingredient (first time back in clojure for more than a year

2:03 amalloy: indeed. I recognized my mistaken thinking after my initial question

2:03 I haven't used watchers before so I think that was the missing piece in my approach

2:03 thanks!

2:06 amalloy: ah looked at your wait-until. The watch + promise delivery paints a complete picture now. Thank you

2:06 amalloy: bjeanes: you're welcome

2:32 ddellacosta: is there a better way to perform an action on a regular basis than to simply start a thread, and loop with Thread/sleep for the duration of time I want to wait?

2:34 Kneiva: ddellacosta: there is a scheduling library: https://github.com/clojurewerkz/quartzite.docs but that might be a bit heavy handed if your use case is that simple

2:35 ddellacosta: Kneiva: ah, yeah, I'm talking more about some simple monitoring activities. Actually we are already using quartzite for task scheduling (but stuff more like backups/regular data imports/etc.)

3:01 fairuz: Any Titan db users? I need some advice connecting to a remote titan db instance.

3:28 visof: hi guys

3:29 what is the fastest way to get the last word from URL like http://hello-world.com/welcome/foo , i need to get foo?

3:29 split and get last are going to be fast?

3:30 rweir: using an actual urlparser sounds like a better idea

3:32 visof: rweir: is there any suggestions for urlparser ?

3:40 amalloy: $google java.net.url

3:40 lazybot: [URL - Oracle Software Downloads] http://download.oracle.com/javase/6/docs/api/java/net/URL.html

3:41 amalloy: actually, didn't i write a $javadoc command? i no longer remember how to use it

3:41 Glenjamin: $help javadoc

3:41 lazybot: Glenjamin: Lookup Oracle's javadocs for a class. Input can be a fully qualified class name, a class name and a method/field, or a non-qualified class name.

3:41 amalloy: $javadoc java.net.URL

3:41 lazybot: http://docs.oracle.com/javase/6/docs/api/java/net/URL.html

4:01 Glenjamin: anyone else find they always try and put the docstring after the arglist?

4:09 SagiCZ1: Glenjamin: i totally always do, and then get super confused

4:09 Glenjamin: it also feels weird i cant have separate docs for overloaded functions

4:10 cfleming: Glenjamin: Yeah, Eastwood has a warning about that, I'm going to add one to Cursive too.

4:10 Glenjamin: I think it's pretty common.

4:10 SagiCZ1: cfleming: sweet!

4:11 btw cursive managed to kill my aero today, something that might be worth looking into

4:11 cfleming: Your aero?

4:11 SagiCZ1: cfleming: i will pm you

4:37 chatterbox: r

4:38 Oh! Sorry, for the mistaken "return" key in this window :)

4:39 sm0ke: i am looking for a simple embeddable java interop language where you can define a simple method, compile/interpret it, pass arguments and execute, get some meta like no. of arguments and return type. Any suggestions?

4:47 zot: where can i publicly lament that (imho) string/split arguments are incorrectly ordered? :)

4:47 mavbozo: zot: what should the order be?

4:48 zot: the pattern feels like it is an action function, a la f in map, filter :) and semantically, then you can do things like (partial string/split #"\n") to get a line splitter

4:49 (instead of having to use an anon func or something else)

4:49 i just want a ballot box to say it out loud, with full awareness that it's been this way for 5 years, and won't be changing any time soon :)

4:54 clgv: zot: well obviously the devs do not thing a string is a sequence or collection - that's very likely the reason for the order

4:55 zot: since this is a breaking change with almost no benefit your chances to get it changed approach zero

4:55 *think

4:56 zot: clgv: fair point, re seq - although (count) works against it. and i know it won't change, as said above.

4:56 clgv: zot: count works since string can be considered as seqable similar to maps

4:58 zot: is there an important semantic difference between seqable and sequence? this sounds different than what you mentioned above…

4:59 clgv: zot: yeah, seqable means that you can use `seq` to convert the thing into a sequence

4:59 but it is not a clojure sequence in the first place

5:00 ,(seq "Hello")

5:00 clojurebot: (\H \e \l \l \o)

5:00 clgv: ,(seq? "Hello")

5:00 clojurebot: false

5:00 hyPiRion: ,(sequential? "foo")

5:00 clojurebot: false

5:00 hyPiRion: oh gurr.

5:01 zot: clgv: cool, thanks. learned my new thing for the day :)

5:01 hyPiRion: You want seqable?, which isn't in core afaik

5:01 clgv: hyPiRion: we do not need to query it? he just wanted to know the difference

5:01 -?

5:13 phillord: hmmm

5:13 (.isAssignableFrom java.util.Set clojure.lang.PersistentHashSet)

5:13 ,(.isAssignableFrom java.util.Set clojure.lang.PersistentHashSet)

5:13 clojurebot: true

5:13 phillord: ,(.isAssignableFrom java.util.Set clojure.lang.IPersistentSet)

5:13 clojurebot: false

5:14 phillord: which is strange -- the implementation class implements the interface

5:14 but the two interfaces do not extend each other

5:14 is this not strange?

5:15 or is it just me?

5:15 martinklepsch: what do people think of boot? I was sceptic the first time I saw it but I begin to see a use for it when it comes to application development

5:26 ssideris: martinklepsch: what is boot?

5:26 martinklepsch: ssideris: ah sorry — boot: Build tooling for Clojure. — https://github.com/boot-clj/boot

5:31 clgv: martinklepsch: good question. its announcement suggested that the leiningen way for CLJS is problematic - is that really the case?

5:31 ssideris: martinklepsch: looks interesting, thanks

5:33 perplexa: hmm use people vim-slime or vim-fireplace? ;x

5:34 * perplexa wants a repl inside of vim

5:35 perplexa: also, nikuse is a spambot :P

5:59 zarkone: hello all! I want to try the clojure language (just curious and to compare with cl). ButI havesome doubts.. It works on top of JVM and i'm afraid I have to understand what's inside of it. Is it true, and give


5:59 me someadvicesabout how tobegin

5:59 thanks

6:00 *to begin with JVM, i mean. May be some books or articles..

6:01 cbryan: joyofclojure.com/ is a very good book

6:05 zarkone: cbryan: thank you!

6:16 donbonifacio: talking about books, I've read the programming clojure. Any suggestions on more advanced books?

6:17 clgv: donbonifacio: joy of clojure

6:18 donbonifacio: nice :) thanks clgv

6:18 mmeix: short question: the use case for "delay" is for a (expensive) computation, which I'm not sure I'll need - correct?

6:20 (only computed if needed by derefing)

6:20 clgv: mmeix: or deferred calculation, you have multiple threads potentially needing the result of a particular calculation but it shall be calculated only once and you do not care who calculates it

6:21 mmeix: it is used in core.cache afair

6:21 mmeix: ah! didn't consider multiple threads - thanks!

6:21 so it really makes sense only for longer calculations

6:22 I guess

6:22 in the case of single thread

6:22 got it

6:23 clgv: mmeix: not necessarily, in case of core.cache aka advanced memoize some computations might be quick as well

6:24 mmeix: ok

6:24 thanks!

6:25 clgv: mmeix: resource loading into a map of resources might be a use case as well, you want to load that resource only once

7:24 visof: hi

7:24 i'm running my app using lein ring server, but it's running forever at specific ns, how can i deal with this?

7:24 and what is best fastest way to debug this?

7:25 weavejester: You mean the ns isn’t loading?

7:27 visof: weavejester: i got compiling foo.clj

7:27 but don't terminated

7:27 and when i try to load in repl i got repl timeout

7:28 weavejester: what do you think ?

7:28 weavejester: visof: It sounds like you have an infinite loop in your namespace, or something else that’s blocking

7:29 visof: The easiest way to debug it is to remove everything from the ns, then add things back in until you hit the error again

7:29 visof: Or look for anything that isn’t a “def” or “defn”

7:29 Or anything potentially side-effectful

7:39 clgv: weavejester: visof: "(def ...)" is problematic as well

7:41 weavejester: clgv: Yeah, if it’s connected to something that could block.

7:50 kungi: I have the symbol of a namespace in a variable. Can I somehow call a function in this namespace through the variable?

7:54 clgv: kungi: yeah require the namespace with the symbol, build a symbol of the function, resolve the function symbol, get the function via var-get and call it

7:55 ,clojure.string/join

7:55 clojurebot: #<string$join clojure.string$join@1a7d91c>

7:56 clgv: damn it is required.

7:56 ,clojure.java.io/file

7:56 clojurebot: #<io$file clojure.java.io$file@1daf1cd>

7:56 clgv: :(

7:56 ok no demonstration here ,)

7:56 ,(-> 'clojure.java.io resolve var-get)

7:56 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.java.io>

7:56 clgv: ,(-> 'clojure.java.io/file resolve var-get)

7:56 clojurebot: #<io$file clojure.java.io$file@1daf1cd>

7:57 clgv: kungi: ^^

7:57 neena: ((eval (symbol (.getNamespace the-symbol) "myfunction")) arguments)

7:57 clgv: neena: no please dont. thats absolutely not necessary

7:58 kungi: clgv: like this: (defn fn-in-ns [ns function]

7:58 (var-get (resolve (symbol (str ns "/" function)))))

7:58 clgv: ,((-> 'clojure.java.io/file resolve var-get) "foo.txt)

7:58 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading string>

7:58 clgv: ,((-> 'clojure.java.io/file resolve var-get) "foo.txt")

7:58 clojurebot: #<File foo.txt>

7:58 clgv: ,(symbol "clojure.java.io" "file")

7:58 clojurebot: clojure.java.io/file

7:59 clgv: kungi: ^^

8:00 neena: clgv: i guess you can replace eval with (comp var-get resolve)

8:01 clgv: neena: you definitel should

8:09 visof: how can i replace all "\"\'" in a string with nothing?

8:09 ,(clojure.string/replace "\"\'" "\"" "")

8:09 clojurebot: #<RuntimeException java.lang.RuntimeException: Unsupported escape character: \'>

8:09 visof: ,(clojure.string/replace "\"\'" #"\"" "")

8:09 clojurebot: #<RuntimeException java.lang.RuntimeException: Unsupported escape character: \'>

8:09 visof: ,(clojure.string/replace "\"\" #"\"" "")

8:09 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading string>

8:09 visof: ,(clojure.string/replace "\"\" "\"" "")

8:09 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading string>

8:09 visof: ,(clojure.string/replace "\"\'" "\"" "")

8:09 clojurebot: #<RuntimeException java.lang.RuntimeException: Unsupported escape character: \'>

8:10 visof: ,(clojure.string/replace "\"'" "\"" "")

8:10 clojurebot: "'"

8:12 clgv: visof: don't you own a private repl? :P

8:12 visof: clgv: sorry

8:13 clgv: ,(re-pattern "\\\"")

8:13 clojurebot: #"\""

8:13 clgv: visof: that's the reason ^^

8:14 clojure's reg exps have a shortcut for less escaping then you'd need with strings

8:17 mavbozo: why when dealing with java, i encounter lots of byte, byte array, byte stream? seems too low level for a language such as java

8:20 clgv: mavbozo: that strongly depends what kind of projects you are looking at

8:22 visof: what is the best way to deal with text data which has unsupported chars in clojure?

8:22 if i do somethign like (str "\xea") i got RuntimeException Unsupported character:

8:23 clgv: visof: no you get an error because that escape "\e" is unknown

8:24 ,(str (char 0xEA))

8:24 visof: clgv: yeah but suppose i'm reading a strange content of webpage and want to escape all the \ to convert it to a string to can deal with in clojure

8:24 clojurebot: "ê"

8:24 clgv: visof: ^^

8:24 visof: clgv: i mean the data from the webpage already has unknown things like \xaea \cvf \adfdf so how can i escape them?

8:24 clgv: you could replace all "\eXX" with result of the function above ;)

8:25 ah not repair them?

8:25 visof: clgv: i don't even know what are the chars should i escape ?

8:25 clgv: visof: if you them as text why do you need to escape them?

8:25 visof: clgv: i don't repair just escape them to handle them after that

8:26 clgv: because it's not a valid string

8:26 i need to read them as valid string

8:26 dysfun: hi all. is there any good library for building indexes into data? i've got some data that fits in memory, so it makes sense to keep it there

8:26 clgv: if I read in "\xea" from some external source I get "\\xea"

8:26 internally

8:27 you are something that causes the need to escape those

8:27 +doing

8:28 dysfun: for one attribute?

8:28 dysfun: ideally supporting more complex operations

8:29 i would like to build computed indices that may operate over multiple attributes

8:30 clgv: ok. well no idea

8:30 dysfun: heh

8:30 clgv: dysfun: might be you end up with a databased solution anyway...

8:30 does sqlite offer sophisticated indices?

8:31 dysfun: since it all fits in memory and i don't have budget for datomic, it seems daft to use a database

8:31 clgv: I would never recommend datomic to you ;)

8:31 dysfun: heh. it's nice, but i will never have budget for datomic :)

8:31 clgv: sqlite is a in-memory db, so if you dont find anything else it might be the easiest way

8:32 dysfun: *nod*

8:32 thanks

8:52 is there a datatype that looks like a promise, but might cover something that goes away and attempting to use it will trigger eg. a socket connection? i think promises can only be delivered once?

8:52 an atom and a promise would do it, but it seems like a simple thing

8:53 well, maybe not the autoconnecting when accessing, happy for that to be done elsewhere

8:53 hyPiRion: You can implement a record which implements IDeref for stuff like that

8:54 dysfun: hrm, interesting idea

8:55 hyPiRion: ,'(@hello)

8:55 clojurebot: ((clojure.core/deref hello))

8:55 hyPiRion: @ is just sugar for deref

8:55 dysfun: yeah, i use it

9:07 clgv: +1 for IDeref

9:56 ,(read-string "@hello")

9:56 clojurebot: (clojure.core/deref hello)

9:56 clgv: hyPiRion: to demonstrate the reader macro expansion ^^

9:56 hyPiRion: yeah

10:04 gfredericks: ,'@hello

10:04 clojurebot: (clojure.core/deref hello)

10:05 gfredericks: ,'@@@@@@@@@hello

10:05 clojurebot: (clojure.core/deref (clojure.core/deref (clojure.core/deref (clojure.core/deref (clojure.core/deref (clojure.core/deref (clojure.core/deref (clojure.core/deref (clojure.core/deref hello)))))))))

10:06 hyPiRion: ,````hi

10:06 clojurebot: (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/seq)) (clojure.core/list (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/concat)) (clojure.core/list (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/list)) (clojure.core/list (clojure.core/seq #))))) (clojure.core/list (clojure.core/seq (clojure.core/concat (clo...

10:08 csd_: what level of of proficiency would someone need to demonstrate to get a junior dev job in clojure (assuming you can find a company using clojure ;) )

10:12 dysfun: that very much depends on the company

10:17 craigglennie: Anyone have a problem with Cursive not letting you put parens where you want to?

10:17 I’m trying to close a function and it either just won’t insert the paren, or it jumps into a comment block

10:18 justin_smith: craigglennie: is cursive's version of paredit turned on?

10:19 clgv: craigglennie: try hitting ESC and then the paren to insert it out of scrope of paredit?

10:19 or maybe that is bound to a different key

10:19 karls: hey guys, a slightly hand-wavy question. i'm trying to write a sort of helper library that covers plumbing and some common patterns for our worker system at work. i'm finding it hard to not fall into the inheritance-style OO thinking. are there any rules of thumb for how to structure such a library?

10:19 jackjames: craigglennie: it's in the lower right corner, where it says "Stuctural: On". you can click that to toggle it off

10:20 craigglennie: jackjames: That did it, thanks

10:20 karls: i'm experimenting with component atm, but just want to see if there are alternative approaches before i dive too deeply into one it

10:20 clgv: karls: hand-wavy answer: think in data and functions manipulating the data

10:20 justin_smith: karls: instead of inheriting, define a protocol or multimethod and have things implement that

10:20 craigglennie: Structural == paredit in Cursive?

10:21 clgv: karls: humm do you really need "component" if that is a library for some task? afaik "component" is built to organize systems and the dependencies between their components

10:21 craigglennie: probably yes

10:21 karls: clgv: justin_smith, that's what i'm trying to do, just finding it difficult. the particular use case is to have rabbitmq and postgres connections set up, logging, and other such "plumbing".

10:22 clgv: yeah, that was my original thinking. the readme does have a section on this as well

10:22 justin_smith: karls: in my experience that isn't something complex in clojure

10:22 unless you are doing something weird

10:22 clgv: karls: well your last description sounds as if you could use components for rabbitmq and postgres each

10:23 karls: i'm a bit confused as to whether or not setting everything up "behind the scenes" is the clojure way.

10:23 indeed, and i have an example component for rabbitmq, and that seems to work fine

10:23 clgv: karls: no you set up things in clojure explicitely, not behind the scenes

10:24 justin_smith: karls: with immutibility you don't really need data hiding

10:24 karls: the essential reason for this is that i ideally wouldn't like to keep track of config opts, "instantiation" of connections etc for every single worker individually..

10:25 hence trying to think about how to make it a bit more straightforward to write workers that connect to rabbitmq and postgres/redis/whathaveyou

10:25 (avoiding copy-pasting)

10:26 clgv: huh? where should the config opts come from?

10:27 karls: for dev - project.clj atm, for prod - env variables or a config file? i'm not too sure yet

10:27 but just writing it down it already feels like an overkill...

10:27 justin_smith: karls: a nice approach is to have a different config.edn file to load for each environment (guided by a system property telling you which one to load)

10:27 clgv: In one of my projects I use config files but they are generated from GUI input.

10:29 for example for a distributed communication I have (create-client config-url) which returns a "client" deftype which can be passed around where communication is needed

10:29 karls: justin_smith, clgv okay

10:30 clgv: and it sits in a var at the top level?

10:30 justin_smith, clgv, thanks for your input. i think i was waayy overthinking this.

10:30 justin_smith: karls: in practice all vars are top level, def can only make globals

10:30 clgv: karls: no, it is called in the "-main" function and then passed to the functions that need it

10:31 mmeix_: just found Gorilla REPL, which could serve as a music notebook with clojure, if I manage to write a custom renderer for music snippets for it - doesn't seem to hard on first sight ... someone here tried Gorilla REPL? http://gorilla-repl.org/index.html

10:31 karls: clgv: got it.

10:32 justin_smith, clgv, cheers!

10:32 justin_smith: mmeix_: gorilla can use LaTeX right?

10:32 mmeix_: yes

10:32 justin_smith: mmeix_: if so, lilypond is amazing

10:32 and it has scheme bindings to all its internals

10:33 mmeix_: yes, I know lilypond quite well

10:33 justin_smith: cool :)

10:33 mmeix_: went trough a couple of music typesetting systems

10:33 lilypond is one of the best

10:34 problem is: it's not possible to run on a server

10:34 which is the usage I'm looking after

10:34 looking for

10:34 (sorry for non-native English)

10:35 I'm planning a web service in the long run

10:35 justin_smith: why not install lilypond on the server? most servers run linux

10:35 mmeix_: for our Music University

10:35 justin_smith: oh, they have a specific setup

10:35 mmeix_: I need user interactivity

10:35 and that is not something easily to get in lilypond

10:35 justin_smith: mmeix_: I was imagining lilypond as a rendering backend

10:36 mmeix_: people tried that

10:36 justin_smith: so interact with gorilla repl, call some scheme code or generate lilypond input...

10:36 mmeix_: but obviously this didn't work out well

10:36 justin_smith: maybe that's too complex

10:36 mmeix_: yes, I think so

10:37 I tried some simple things myself with SVG, which is easy to manage with hiccup or so

10:37 I would inly have to write my own notation engine

10:37 :-)

10:37 justin_smith: analemma is nice for generating svg

10:38 mmeix_: (googling analemma)

10:38 justin_smith: mmeix_: that doesn't sound simpler than using lilypond to me, but it's your call

10:38 mmeix_: I don't see a way to get lilypond interactive easily: it's heavily text based

10:39 so one would need to write a whole handling library

10:39 justin_smith: my point is that your code can generate data that is fed to lilypond

10:39 mmeix_: I see

10:39 justin_smith: it has a lisp in the background, you can use data structures to generate its input

10:40 for example I know rosegarden does this (linux composition program)

10:40 mmeix_: I need an interface, where the user can drag a note directly, and I'm not sure how this would work with e server backend

10:40 justin_smith: ahh yeah - that's another thing entirely, you are right

10:40 mmeix_: I had tha idea to use Noteflight for this

10:41 justin_smith: maybe once everything in place make a pretty lilypond version - but for user interaction something uglier but more drag and drop friendly

10:41 there is vexflow http://www.vexflow.com/

10:41 mmeix_: ja, know that: in my opinion it's too naive in some aspects, musically

10:42 justin_smith: OK

10:42 mmeix_: I have very long and extensive experience with music setting applications

10:43 it's not an easy task, yes

10:44 but I guess, for my Eartraining app it doesn't need to be of the highest sophistication (only 1-2 lines of music, reduced polyphony)

10:44 so maybe I can SVG something myself

10:45 and just found, that Gorilla REPL allows integration of DIY renderers

10:45 so I'll try that

10:46 could be a nice workflow: building music structures in clojure with a growing renderer function

10:47 highly optimistic, of course ;-)

10:47 but Clojure lends itself to music (like its creator...)

10:48 (looking at Analemma...)

10:50 ah, that's great: they divided it into three layers, xml, svg, charting

10:50 something to learn from

10:51 thanks for the hint!

10:52 lazylambda: folks, is there a way to treat the comma as a symbol instead of whitespace?

10:52 hiredman: nope

10:53 mmeix_: what for?

10:55 lazylambda: it's not a big deal. I was working on django project for work and I wanted to sort some imported constants to shut up flake8. I sorted them in the clojure repl, and after that I wanted to interleave the sorted list with (repeat ',) so I could just copy and paste the output into my python code without having to manually insert commas

10:55 that's why I was wondering if it's possible to quote comma

10:56 mmeix_: wouldn't interpose work for that?

10:56 (if a string output would work)

10:57 clgv: lazylambda: why not print what you want to export? e.g. (println "[" (str/join ", " coll) "]")

10:57 cbryan: ,(symbol ",")

10:57 clojurebot: ,

10:58 cbryan: ,(take 10 (repeat (symbol ",")))

10:58 clojurebot: (, , , , , ...)

10:58 cbryan: yeah?

10:58 mmeix_: ,(interpose "," (range 9))

10:58 clojurebot: (0 "," 1 "," 2 ...)

10:58 clgv: ,(require '[clojure.string :as str])

10:58 clojurebot: nil

10:59 lazylambda: cbryan: YES.. that's it.

10:59 clgv: ,(println "[" (str/join ", " (range 10) "]")

10:59 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

10:59 cbryan: ,(interpose (symbol ",") (range 9))

10:59 clojurebot: (0 , 1 , 2 ...)

10:59 cbryan: ;)

10:59 lazylambda: clgv: printing would have been a good option as well

10:59 mmeix_: ,(apply str (interpose "," (range 9)))

10:59 clojurebot: "0,1,2,3,4,5,6,7,8"

10:59 clgv: ,(println "[" (str/join ", " (range 10)) "]")

10:59 clojurebot: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]\n

11:00 mmeix_: (mmeix just learned to use the clojurebot :)

11:00 clgv: mmeix_: thats exactly str/join :P

11:00 but less efficient ;)

11:00 mmeix_: ah, ok

11:00 cbryan: psh. clever code above clear code!

11:00 mmeix_: (back to learner's seat ;)

11:00 justin_smith: $source clojure.string/join

11:00 lazybot: clojure.string/join is http://is.gd/aOFm5m

11:01 justin_smith: cbryan: well as that link from lazybot will show, in clojure core it is fast code above clear code :)

11:01 clgv: justin_smith: not always ;)

11:02 justin_smith: fair enough - but it's a definite pattern

11:02 lazylambda: ,"test the bot"

11:02 clojurebot: "test the bot"

11:03 lazylambda: ,(+ 1 2 3)

11:03 clojurebot: 6

11:03 justin_smith: don't forget to ##(str "test the other bot")

11:03 lazybot: ⇒ "test the other bot"

11:03 clgv: justin_smith: uh he is around.

11:03 lazylambda: lol, who's the other bot?

11:03 kenrestivo: is there a way to force transitive aot, like, all of clojure.core ?

11:04 cbryan: ,(print (str "hmmm" '##(str "test the other bot")))

11:04 lazybot: ⇒ "test the other bot"

11:04 clojurebot: #<RuntimeException java.lang.RuntimeException: Reader tag must be a symbol>

11:04 cbryan: oops

11:04 clgv: kenrestivo: isnt that AOTed already?

11:04 cbryan: does lazybot respond to clojurebot? >:)

11:04 and vice versa?

11:04 justin_smith: cbryan: there was, in times of legend, a bot-quine

11:04 clgv: kenrestivo: otherwise just specify #"clojure\.core.*" in your project.clj

11:04 kenrestivo: clgv: nope

11:04 cbryan: oh, but the arrow would stop that

11:04 justin_smith: haha

11:05 justin_smith: cbryan: this forced some changes, as you could imagine

11:05 kenrestivo: hmm, doesn't :aot :all do that?

11:05 clgv: cbryan: not blacklisting. they did in the past ;)

11:05 kenrestivo: because, it isn't. i guess i could try :aot #"*.*" ?

11:05 clgv: s/not/no./

11:06 kenrestivo: see above ;)

11:06 kenrestivo: this a not a valid pattern ###"*.*

11:06 kenrestivo: this a not a valid pattern ##(identity #"*.*)

11:06 ,#"*.*"

11:06 clojurebot: #<NoClassDefFoundError java.lang.NoClassDefFoundError: Could not initialize class java.util.regex.PatternSyntaxException>

11:06 cbryan: ,#"*\.*"

11:06 clojurebot: #<NoClassDefFoundError java.lang.NoClassDefFoundError: Could not initialize class java.util.regex.PatternSyntaxException>

11:06 kenrestivo: ,(re-find #"*\.*" "foo.bar")

11:06 clojurebot: #<NoClassDefFoundError java.lang.NoClassDefFoundError: Could not initialize class java.util.regex.PatternSyntaxException>

11:07 clgv: no. the star in the beginning is wrong ;)

11:07 cbryan: oh, oops

11:07 kenrestivo: ,(re-find #"\.*" "foo")

11:07 clojurebot: ""

11:07 clgv: ,(re-find #"clojure\.core.*" "clojure.core.reducers")

11:07 clojurebot: "clojure.core.reducers"

11:08 clgv: ,(loaded-libs)

11:08 clojurebot: #{clojure.core.protocols clojure.instant clojure.java.io clojure.repl clojure.string ...}

11:08 mmeix_: BTW, I need to translate a XML-file into a csv - only once - somebody has a quick tip for that?

11:08 clgv: ,(->> (loaded-libs) (map name) (filter #(re-find #"clojure\.core.*" %)))

11:08 clojurebot: ("clojure.core.protocols")

11:08 kenrestivo: ,(re-find #"\." "any.damn.namespace")

11:08 clojurebot: "."

11:09 cbryan: ,(re-find #".*\..*" "any.damn.namespace")

11:09 clojurebot: "any.damn.namespace"

11:09 clgv: mmeix_: XSLT?

11:09 justin_smith: mmeix_: clojure.data.xml and clojure.data.csv both exist

11:09 mmeix_: justin_smith thanks

11:10 (inc clgv)

11:10 lazybot: ⇒ 34

11:10 mmeix_: (inc justin_smith)

11:10 lazybot: ⇒ 115

11:10 mmeix_: for continued help :)

11:13 dysfun: does anyone know how clojure performance is on android?

11:13 tbaldridge: clojurebot: clojure performance android?

11:13 clojurebot: Huh?

11:13 tbaldridge: exactly....

11:13 dysfun: remarkably helpful...

11:14 tbaldridge: dysfun: from what I understand, it works, and isn't bad once it's loaded, but it does take some time to load

11:14 dysfun: hrm, that could be acceptable

11:15 nathanic: i would think that the extra GC pressure from clojure's (otherwise wonderful) persistent data structures would be pretty noticable on android

11:15 csd_: does riddley walk from inside out or from outside in?

11:16 nathanic: but i've so far been scared off by reports of many-second loading times

11:16 tbaldridge: dysfun: http://nicholaskariniemi.github.io/2014/03/12/clojure-android-startup-benchmarks.html

11:16 clgv: dysfun: you could go the clojurescript way for android though. there are js containers to write apps with js

11:16 ToxicFrog: I've been kicking around the idea of using Chrome Apps on Android and cljs to deploy that way, but haven't actually tested it yet.

11:16 dysfun: umm, why is ART startup so long? I thought it AOT-compiled everything?

11:17 tbaldridge: dysfun: yeah, I've done that several times and CLJS works really well...

11:17 dysfun: actually this way to get around having to do something that works on javascript

11:17 tbaldridge: dysfun: it does, but you still have to init clojure/lang/rt.java and that takes time

11:17 dysfun: yeah, but it takes *more* time :)

11:18 clgv: the nexus 7 is slower than the 5?

11:18 kenrestivo: i found performance of clojure on android to be not much different than performance of android on android

11:18 tbaldridge: dysfun: there's been some work done around startup time that was slated for 1.7, not sure if it's going to get into 1.7 though due to transducers.

11:18 clgv: interesting product strategy ;)

11:19 kenrestivo: then again i'm not doing anything terribly tight-loopy, it's all just gui stuff and calling android services

11:20 and... it is *worlds* more fun than trying to deal with the android toolkit in native java. also too, repl.

11:20 dysfun: i don't mind waiting for cool stuff :)

11:21 cbryan: "i'm not doing anything terribly tight-loopy" famous last words

11:21 ;)

11:21 dysfun: also "my dataset is quite small"

11:21 eric_normand: good morning folks!

11:21 kenrestivo: hah, well not on that platform. i will soon be doing tight-loopy stuff on a different embeedded arm platform, and i'm ready to offloa it to c if needed

11:22 cbryan: (inc dysfun)

11:22 lazybot: ⇒ 1

11:22 eric_normand: anybody get tikkba to work on heroku?

11:22 I think it's an openjdk issue

11:22 dysfun: i'm intrigued by the idea of a repl running on my device as part of the app during dev though

11:23 eric_normand: says that this class is not found: com.sun.image.codec.jpeg.TruncatedFileException

11:24 kenrestivo: dysfun: http://github.com/kenrestivo/spazradioapp first and only (so far) clojure android thing i've done, it was fun

11:24 justin_smith: eric_normand: I have used tikka with openjdk

11:24 eric_normand: justin_smith: with no problem?

11:24 dysfun: kenrestivo: sweet, thanks :)

11:24 justin_smith: eric_normand: but the jvm is silly and thinks that headless = nothing that uses images

11:25 eric_normand: so if they have the "headless" jdk and that can be a problem

11:25 eric_normand: the idea that the ability to composite an image and the ability to show one in a GUI are tied is absurd, but it is the case :(

11:25 eric_normand: justin_smith: so what to do?

11:25 engblom: On Linux, what is the best way for reading a mouse device? Assume you have several mice and each one of them will control things (and not the cursor on screen). /dev/input/MouseN is producing a C-struct.

11:26 eric_normand: justin_smith: google is not giving me a good solution

11:26 justin_smith: eric_normand: make sure you are not using a headless jvm - I don't know how this is done on heroku

11:26 eric_normand: technomancy may have some inner heroku insight though

11:26 cbryan: engblom: you mean read it in clojure? or just in general?

11:27 justin_smith: engblom: use the .h file to make a parser, it is a simple and stable data

11:27 engblom: it sucks to do it by hand, but it isn't a large thing (I have done it before) and you only need to do it once

11:27 engblom: cbryan: Reading it in Clojure... This is a clojure channel after all :)

11:28 justin_smith: engblom: we have great tools for parsing binary data packets by the way - like that one from ztellman

11:28 https://github.com/ztellman/gloss

11:29 csd_: Is there an equivalent of `lein clean` for cider-nrepl?

11:29 Its getting borkedup by an old package it seems

11:29 engblom: justin_smith: Sounds interresting

11:30 justin_smith: engblom: there is also the possibility of using java.awt of course

11:30 but in my experience the linux mouse device is very easy to access and use

11:31 and bonus, when you use the device and not awt, you don't need a window open, and you get all events (well for me this was a bonus...)

11:37 technomancy: eric_normand: I don't know the solution for this, but we just hired someone specifically to own JVM issues; if you open a support ticket he could probably point you in the right direction

11:38 eric_normand: technomancy: thanks

11:39 mnngfltg: Can I somehow refer to the name of a `let` binding from inside the same `let`? This won't work: https://www.refheap.com/92702 (Unable to resolve symbol: power-set* in this context)

11:39 tbaldridge: mnngfltg: name the function

11:39 mnngfltg: (fn power-set* [xs] ...)

11:39 csd_: not within the same binding. only a different binding, below the first

11:39 justin_smith: mnngfltg: or letfn

11:39 mnngfltg: tbaldridge, then the function calls are not cached

11:39 Bronsa: tbaldridge: that would not pass through the memoize

11:40 mnngfltg: as letfn should work

11:40 tbaldridge: ah right, missed the memoize. yeah, use letfn

11:40 Bronsa: *as justin_smith said

11:41 phillord: Is there a good way to see what Clojure things the type is of a particular entity

11:41 justin_smith: type

11:41 ,(type nil)

11:41 clojurebot: nil

11:41 justin_smith: ,(type {:a 0})

11:41 clojurebot: clojure.lang.PersistentArrayMap

11:41 phillord: sorry, meant at compile time

11:41 mnngfltg: I thought of letfn, but it doesn't take a function as a value (as `let`) but a function definition

11:42 phillord: I am getting a reflection warning from a call which looks like (.method (set properties))

11:42 justin_smith: ,(type (with-meta {:a 0} {:type "foo"}))

11:42 clojurebot: "foo"

11:42 phillord: and it complains that it doesn't know the type of the call

11:42 justin_smith: phillord: (.method ^the.Class (set properties))

11:42 kenrestivo: for the record, :uberjar {:aot [#"\."] :omit-source true}} did what i wanted

11:43 Bronsa: mnngfltg: ah right, uhm there might be someting in useful for this, let me check

11:43 justin_smith: mnngfltg: ahh, right

11:43 phillord: the method signature is .method(java.util.Set)

11:43 it should just work

11:43 mnngfltg: by the way, I can't use `def` because 4clojure won't let me :)

11:44 justin_smith: (fn memoized [args] ((fn inner [x] ... (memoized y)) args))

11:44 Bronsa: mnngfltg: well the hacky way is to use a promise

11:44 justin_smith: (fn memoized [args] ((memoize (fn inner [x] ... (memoized y))) args))

11:44 that is

11:45 or wait, that creates a new memo on each call doesn't it? no good

11:45 mnngfltg: justin_smith, but that will create a new cache every time, which defeates the purpose

11:45 justin_smith: right

11:45 tbaldridge: forget this stupid immutability, it only causes problems...I'm going back to Python

11:46 noonian: lol

11:46 mnngfltg: tbaldridge, heh

11:46 Bronsa: mnngfltg: (let [f (promise) your-f (memoize (fn [] .. (@f ..))) _ (deliver f your-f)] ..) not pretty but should work

11:46 tbaldridge: (inc Bronsa)

11:46 lazybot: ⇒ 67

11:48 mnngfltg: Bronsa, very nice :)

11:48 justin_smith: (inc Bronsa)

11:48 lazybot: ⇒ 68

11:48 justin_smith: I find myself solving more and more things with promises

11:49 ,(deliver (promise) ()) ; an empty promise

11:49 clojurebot: #<core$promise$reify__6499@1766b1e: ()>

11:49 cbryan: ba-dum-tsh :p

11:51 mnngfltg: I'll sleep on it.

11:52 There's gotta be a better algorithm for calculating the powerset which doesn't require memoization :)

11:52 justin_smith: yeah, memoizing a powerset is going to use a lot of heap

11:58 Bronsa: phillord: I just replied to your thread on the ML, the answer to your question is that clojure.core/set is not type hinted

11:59 csd_: I'm trying my hand at writing my first macro and am running into trouble.. I just want a macro that expands into Compojure's destructuring syntax. So the macro is just (defmacro foo {{x :x} :y}); and I'm trying to insert it into {{existing :binding} :baz} ~@foo}. I'm running into errors though so I'm curious if I'm doing something that's not possible since I know that the syntax I'm working with is itself nonstandard

11:59 gfredericks: macros need an arg list

11:59 csd_: ah

11:59 gfredericks: so (defmacro foo {{x :x} :y}) doesn't make any more sense than (defn foo {{x :x} :y})

11:59 technomancy: maybe *your* macros do gee fredericks

12:00 * gfredericks writes a special blend of macro that needs an arglist

12:00 cbryan: write a macro that defines a macro without an arglist

12:00 duh

12:00 weavejester: macros are just functions which have their return values evaled instead of their arguments.

12:00 Bronsa: weavejester: that's a nice way to explain it

12:01 cbryan: technomancy: eric_normand had a heroku question (he might have solved it)

12:01 well, clojure question relevant to heroku ;)

12:01 technomancy: cbryan: yeah, I handed him off to our jvm guy

12:02 cbryan: cool cool

12:02 phillord: @Bronsa okay

12:02 that's confusing

12:04 csd_: gfredericks: It looks like hash-map checks for even number of forms before macro expansion occurs

12:05 Bronsa: csd_: that happens at read-time

12:05 dc_: how do i configure clojure to use more cores? it's only like using 12% of my processor

12:05 phillord: @Bronsa I will reply on the mailing list -- I still don't think this makes sense

12:05 Bronsa: csd_: the hacky way to make it work is to put a ~@()

12:06 rweir: in what sense do you want clojure to use more cores

12:07 dc_: i've got some parallelized functions using r/fold and r/mapcat and reduce

12:07 justin_smith: dc_: you probably need to rewrite code so it can execute in more threads

12:07 oh

12:07 dc_: but the java process doesn't seem to be utilizing the cores

12:08 justin_smith: it will use all the cores it can, unless you force it not to

12:09 dc_: justin_smith: does that include processes spawned inside a repl?

12:09 or from inside intellij's repl?

12:09 justin_smith: yes

12:10 unless you went out of the way to place some limit on the CPUs it could use

12:10 dc_: i'm looking at activity monitor and the java process says 100%, but my CPU load is like 12%

12:11 cbryan: try a profiler?

12:11 dc_: might be osx

12:11 clgv: 8 logical cores?

12:11 justin_smith: dc_: it could be that the CPU intensive part of what you are doing is all in one thread

12:12 clgv: maybe different relation ;)

12:12 100/800 vs 12.5/100 ...

12:12 dc_: if i'm using persistent/transient is this going to force certain ops to use one thread?

12:13 justin_smith: transients need to stay in one thread

12:13 clgv: dc_ currently (<= 1.6) you can't use trnaisent in other threads than the owner thread

12:14 gfredericks: what was the motivation for changing it?

12:14 Bronsa: gfredericks: supporting core.async

12:14 dc_: so a reduce using a transient structure wouldn't be parallelized?

12:14 clgv: dc_: also there is no implicit spawning of threads for clojure collections without using something that explicitely uses a different thread

12:14 Bronsa: technomancy: ban nikuse please

12:14 technomancy: it's a spammer

12:14 Glenjamin: dc_: reduce is never parallelized

12:14 justin_smith: dc_: the jdk comes with jvisualvm, and you can see a nice graph of all your threads and how hard each is working in a graph there

12:14 Glenjamin: core.reducers/fold can be though

12:14 dc_: Glenjamin: i thought reduce now uses r/reduce

12:15 justin_smith: dc_: you can just start jvisualvm, and choose your process and click around

12:15 clgv: but if you have many large enough collections the GC will spin up some threads ;)

12:15 Bronsa: dc_: reduce and r/reduce are different things

12:15 Glenjamin: not sure, but r/reduce is still single threaded

12:15 Bronsa: technomancy: thanks

12:15 technomancy: Bronsa: I got 'im earlier but forgot to use * as the hostmask

12:16 dc_: can i force reduce to use threads?

12:16 Glenjamin: only with r/fold

12:16 Bronsa: dc_: you can't. currently only r/fold can

12:17 dc_: ok cool, thanks guys

12:42 razum2um1: is there any way to inspect objects safely? (say for infinite seq print only <LazySeq@dfsdf>

12:43 justin_smith: ,(str (range))

12:43 clojurebot: #<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>

12:43 justin_smith: ,(print (range))

12:43 clojurebot: (0 1 2 3 4 ...)

12:44 razum2um1: justin_smith: strange, but in repl it prints infinite (probably it's smart bot)

12:46 cbryan: ,(print (range 10))

12:46 clojurebot: (0 1 2 3 4 ...)

12:46 cbryan: it just sets a threshold

12:47 gfredericks: ,(doc *print-length*)

12:47 clojurebot: "; *print-length* controls how many items of each collection the printer will print. If it is bound to logical false, there is no limit. Otherwise, it must be bound to an integer indicating the maximum number of items of each collection to print. If a collection contains more items, the printer will print items up to the limit followed by '...' to represent the remaining items. The root binding is...

12:48 clgv: the bot that could decide the halting problem ;)

12:50 ,(binding [*print-length* 500] (str (range)))

12:50 clojurebot: #<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>

12:51 clgv: let's guess its memory ^^

12:52 razum2um1: ,(binding [*print-length* 2] (str (range)))

12:52 clojurebot: #<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>

12:52 cbryan: ,(.maxMemory (Runtime/getRuntime))

12:52 clojurebot: #<CompilerException java.lang.SecurityException: Reference To Runtime is not allowed, compiling:(NO_SOURCE_PATH:0:0)>

12:52 cbryan: darn :p

12:53 clgv: ah lol have to use print ;)

12:53 ,(binding [*print-length* 500] (print (range)))

12:53 clojurebot: (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 1...

12:53 razum2um1: clgv: thanks!

13:13 success: Anyone know a simple explanation of STM?

13:13 getting rid of locks seems great but what is the downside?

13:13 CookedGryphon: success: you might do some work twice

13:13 rweir: complicated, poor performance with lots of collisions, operations need to be idempotent

13:14 clgv: rweir: you sounds pretty convinced of the benefits of STM :P

13:15 success: you can read up on pessimist vs optimistic transaction handling

13:15 rweir: no, ti's handy

13:15 but it's not a silver bullet

13:15 clgv: success: in worst case scenarios your calculation within the transaction might run a lot of times instead of once

13:16 rweir: usually I don't hunt werewolves while coding ;)

13:17 alexherbo2: Hi

13:17 How start a repl headless?

13:18 How send code to a repl?

13:18 justin_smith: alexherbo2: you can start a headless repl with lein repl :headless

13:19 then you would need to run lein repl :connect, or connect to it with some other client

13:19 alexherbo2: hum

13:19 i actually need head

13:20 how list repl ?

13:21 in my editor i want send code to repl connected in current dir.

13:21 clgv: which editor do you use?

13:21 alexherbo2: kakoune

13:21 clgv: never heard of it. is there any clojure support for that one?

13:22 alexherbo2: a write syntax highlighting

13:22 s/a/i/

13:22 clgv: yeah well, if that is all, you wont be able to send code from editor to repl

13:23 you probably need to switch to an editor with clojure support

13:24 cbryan: https://github.com/mawww/kakoune seems you can use :eval or something

13:24 alexherbo2: in a term i start kakoune from ~/foo/bar and edit baz.clj

13:24 in another term i start lein repl from ~/foo/bar

13:24 i want list connected repl

13:24 clgv: I want dinner!

13:25 scnr

13:25 alexherbo2: and connect from the editor to first repl

13:25 in current dir

13:25 cbryan: alexherbo2: either use a different editor or write a plugin for kakaoune

13:25 alexherbo2: i will write a plugin

13:26 clgv: that is not the easiest task if you are new to clojure and leiningen

13:26 alexherbo2: it should not be hard.

13:27 technomancy: alexherbo2: you should be able to look for a .nrepl-port file in the project root

13:27 theoretically that file gets deleted when the repl process exits, so if it's present it should be an indicator that there's a running repl

13:27 alexherbo2: what i need is find a repl and connect to it. send send selection to the repl.

13:28 technomancy: are you aware that the nrepl protocol is a bit more complicated than stdin/stdout?

13:29 alexherbo2: no

13:30 technomancy: https://github.com/clojure/tools.nrepl#design

13:30 the simplest thing to do is to start a `lein repl` subprocess

13:30 connecting to a running repl server means implementing the nrepl protocol

13:30 success: clgv: ok, indefineately many?

13:31 noonian: alexherbo2: if you are just starting with clojure i would recommend just using lein repl and reloading your code when you change it in your editor

13:31 clgv: success: you probably can construct such a scenario

13:32 technomancy: alexherbo2: I've done a standalone nrepl client, and it was ~500 lines of ocaml

13:32 success: compared to haskell, clojure feels pretty far behind, is this language really worth getting into?

13:32 technomancy: 150 was the bencode implementation, you might be able to get that for free from a library, and ~50 was lein-specific stuff you would leave out

13:32 success: it seems mostly a webapp lang...?

13:32 tbaldridge: success: how are comparing?

13:32 cbryan: haskell was created in 1990

13:32 clgv: success: how do you judge both of these statements?

13:32 technomancy: success: it's over a decade behind, sure

13:32 cbryan: clojure in 2007

13:33 clgv: success: no you can write optimization algorithms with JVM performance in Clojure as well

13:33 technomancy: tbaldridge: number of years, I would guess =)

13:33 dbasch: success: we’re successfully using clojure at companies that do infrastructure, to process large amounts of data

13:33 success: i didnt mean when the projects were started, i meant where they are. haskell feels incredibly fresh and solid, so much more rigorous than anything I ever tried befoe

13:34 tbaldridge: success: feelings are never a good way to do tech evaluations ;-)

13:34 clgv: success: I wouldnt describe that syntax as "fresh" :P

13:34 technomancy: hmm, what unit of measurement is used for fresh/solid?

13:34 clgv: technomancy: in terms of fish smell ;)

13:34 technomancy: millimentos?

13:34 dbasch: success: the comparison only makes sense within a context. Otherwise you might as well be asking: should I ride a bike or fly a helicopter?

13:34 clgv: at least the fresh part ^^

13:35 success: actors use locks underneath right? or am i wrong? you push and pop from its mailbox so that access must be synchronized.

13:35 noonian: clojure *feels* pretty solid to me at least

13:35 tbaldridge: success: Clojure really doesn't have actors...

13:35 cbryan: i've never felt clojure :( i'

13:36 tbaldridge: success: you mean agents?

13:36 cbryan: dammit, hit enter before i finished my awesome joke

13:36 tbaldridge: success: but if you want a list of people who use clojure, this is a good starting point: https://news.ycombinator.com/item?id=8549823

13:36 success: agents != actors?

13:36 tbaldridge: success: yep, you send msgs to actors, you send functions to agents

13:36 success: actors require a message to deref, agents have instant deref

13:38 success: either way, you send something, it has to go via something, access to that something must be synchronized

13:39 tbaldridge: success: yes, agents are backed by a thread pool, but they can't deadlock since sending is async

13:39 dbasch: also agents are in-process

13:40 success: but how can sending be async? you cant push to the mailbox/Q/whatever without checking if someone is reading

13:40 laliluna: @success Of course you can

13:40 tbaldridge: there's many ways to do that, one of them is via a queue and a CAS.

13:41 laliluna: You can use compensation to validate if data reached its target

13:41 dbasch: success: that’s like saying that you cannot send an email if there’s nobody to read it

13:42 laliluna: If you sent money from US to Europe, this does not happen in one hop. Basically, the system validate at the end of the day, if all accounts are as expected.

13:42 cbryan: dbasch: MAILER-DAEMON begs to differ ;)

13:43 dbasch: cbryan: I can send an email to my father even though he’s been dead for 2 1/2 years. The account still exists.

13:44 success: no im saying if reading means deleting as well, then you cannot be sure that someone isnt deleting while you write. im thinking of data structures underneath, you could be manipulating the same pointers if you write and delete at the same time

13:44 tbaldridge: success: btw, sorry for all the snark. It's just a bit funny to go to a forum and say "your stuff seems to be less mature than this other stuff guys...". Say that and you're going to get some snark ;-)

13:44 success: that's what CAS is for...

13:44 technomancy: heh, this is not exactly uncharted territory

13:45 cbryan: dbasch: true, true. depends on if "no one there" means "non existant" or "not available". but i was being pedantic!

13:45 laliluna: Unrelated question: do you avoid to use function names used by clojure in library APIs?

13:45 tbaldridge: success: if you have immutable data structures, and CAS that's about 3 lines of code

13:46 technomancy: I guess if you were unaware that CAS existed, clojure reference types would feel super shaky and untrustworthy =)

13:46 cbryan: laliluna: like create a function named map or something? i would avoid it if you can

13:47 laliluna: comment, sort-by, find are other candidates. It is not easy to find other names every time.

13:47 dbasch: laliluna: http://clojure.org/cheatsheet

13:47 when in doubt

13:48 cbryan: dbasch: laliluna is wondering if its okay to name a function with the same name as one in clojure.core

13:49 dbasch: laliluna: it depends on the context. It’s fine to have a function with the same name if it does the same conceptual thing in a different context

13:49 cbryan: tbaldridge: what does CAS stand for here?

13:49 Bronsa: cbryan: compare and swap

13:49 cbryan: ah

13:50 tbaldridge: it's like STM for a single integer/pointer

13:51 martinklepsch: I asked that question before but since there's a bit more activity right now:

13:51 what do people think of boot? I was sceptic the first time I saw it but I begin to see a use for it when it comes to application development

13:51 cbryan: martinklepsch: it looks cool but i haven't used it

13:51 martinklepsch: boot provides build tooling for Clojure. — https://github.com/boot-clj/boot

13:52 tbaldridge: martinklepsch: diversity is good, lein hasn't ticked me off enough to want to switch, but many of my co-workers already use other stuff besides lein.

13:52 So the more options the better.

13:52 martinklepsch: tbaldridge: what else is there what your coworkers use?

13:52 cbryan: seems kind of like lein : boot :: maven : gradle

13:52 i mean maven is hell on earth and i love lein, but in the sense of config vs code

13:53 tbaldridge: martinklepsch: some use custom bash scripts, others have built make based tools, or simply use maven in one way or another.

13:53 success: CAS=Content-addressable storage ?

13:53 cbryan: compare-and-swap, as Bronsa said

13:53 tbaldridge: success: compare and set.

13:54 mmeix: very newbish question again (sorry 'bout that): when using (clojure.data.csv/write-csv writer data & options) - which would be the correct writer to write to a file on disk? (And where do I educate myself about writers?)

13:54 martinklepsch: cbryan: not familiar with gradle/maven but that sound like a good analogy

13:54 mmeix: (and readers)

13:54 tbaldridge: success: http://en.wikipedia.org/wiki/Compare-and-swap

13:54 ToBeReplaced: mmeix: look at clojure.java.io/writer

13:54 laliluna: The JavaScript has a very good separation of task runners and tasks: grunt, gulp, brunch are solutions there. I am not sure, if this is the direction of boot

13:54 cbryan: (writer "my-file")

13:54 justin_smith: mmeix: I think (java.io.File. "your-file-name") works in that context

13:54 tbaldridge: success: almost all locks/mutexes are built off of CAS, but CAS itself is non-blocking.

13:54 mmeix: thanks

13:55 danneu: mmeix: check out clojure.java.io's fns/helpers at least as a place to start

13:55 cbryan: yeah, lein : boot :: grunt : gulp also works

13:55 laliluna: lein is nice for packaging and a hell, if you want to hook into one step. There it becomes as elegant as maven plugins

13:56 ToBeReplaced: huh... boot-clj is interesting

13:56 justin_smith: so make : autotools :: lein : ??

13:56 lazybot: justin_smith: What are you, crazy? Of course not!

13:56 honza: I have yet to see how Emacs + cider is any more interactive than vim + fireplace for Clojure development. Any mad enough to convince me? :)

13:56 justin_smith: $botsmack

13:56 alexherbo2: technomancy: http://leiningen.org/grench.html ? :)

13:56 danneu: honza: no vimscript

13:57 ToBeReplaced: if nothing else, i'm glad someone(s) are trying another approach

13:57 success: Android is multithreaded, you cant get away from it, would be interesting to have clojure working really good on android

13:57 justin_smith: honza: I don't think it's more interactive. But emacs has elisp and org mode, so use emacs if you want that sort of thing.

13:57 honza: danneu: meaning? easier to customize?

13:57 technomancy: alexherbo2: that's the one

13:58 justin_smith: honza: elisp is a mediocre programming language, but it's an actual language you can write things in

13:58 technomancy: justin_smith: make : autotools :: lein : cljsbuild maybe

13:58 danneu: honza: ever try evil-mode in emacs?

13:58 justin_smith: for vi's many benefits I don't think you could say writing an app in vimscript is reasonable

13:59 technomancy: honza: you can invoke commands implemented in clojure using nrepl-discover and have them auto-generated as first-class M-x commands in emacs, bound to keystrokes, etc

13:59 cross-runtime metaprogramming

13:59 honza: justin_smith: how does that affect clojure development? vim-fireplace gives you tons of interactive code eval mappings that are supposedly only possible in emacs

13:59 alexherbo2: technomancy: not tested yet but works like this ?, grench eval "(+ 2 3)" and it sends code to running repl in current dir. i should see result in grench repl.

14:00 honza: danneu: yes - why?

14:00 technomancy: alexherbo2: result would be in stdout, not in a separate repl session

14:00 success: where would you recommend launching your clojure webapp?

14:00 heroku?

14:00 danneu: success: yeah

14:00 honza: technomancy: welp, that's a good one

14:00 alexherbo2: technomancy: i want see result in the repl

14:00 technomancy: alexherbo2: well, you can't use grench for that then

14:00 alexherbo2: i just want use editor to send selected code, and have a repl where i see result

14:01 not see result inside the editor

14:01 clgv: alexherbo2: there are a lot of editor+plugin combination that are capable to do that

14:01 technomancy: alexherbo2: it sounds like you'd end up reimplementing grench in whatever language your editor uses for extensions

14:02 justin_smith: honza: I hae never seen that "only available in emacs" claim

14:02 danneu: success: have you seen https://devcenter.heroku.com/articles/getting-started-with-clojure#introduction

14:03 success: there are a couple gotchas with deploying to heroku. like you should specify :min-lein-version (or whatever) in projet.clj or else heroku uses an old 1.x version of lein that usually fails to deploy

14:03 technomancy: danneu: you get that for free with `lein new heroku myapp` fwiw

14:03 but yes, good point

14:04 success: so it is a pain

14:04 maybe I should just run my own server!

14:04 danneu: if you've been programming clojure you should be used to idiosyncrasies

14:04 success: is it easy to deploy on my comp?

14:05 danneu: technomancy: is there a list of templates?

14:05 justin_smith: success: it's not a pain if you use lein new heroku, like technomancy said

14:05 technomancy: danneu: I think searching clojars for lein-template works?

14:05 danneu: cool

14:05 justin_smith: success: also, deploying to a vanilla unix env consists of "lein uberjar"; scp that to the server; run java -jar my.jar on the server

14:06 success: you can get fancier but often don't need to, that's how I do it for some production sites

14:06 danneu: success: doing the couple things you need to do for heroku is less painful than doing your own deploys

14:06 git push heroku vs ?

14:06 rsync?

14:06 justin_smith: danneu: scp / ssh -c restart (where restart is a five line script)

14:07 well lein uberjar first, of course

14:07 danneu: the only thing I install on the server is nginx and a jvm

14:07 danneu: i unfortunately still ssh into my linode, attach to my tmux session, and reboot the app

14:07 "one day i'll streamline/automate this"

14:08 it's been 1 year

14:08 technomancy: what's the app?

14:08 justin_smith: danneu: I find nohup more reliable (and scriptable) than running inside tmux

14:08 danneu: it's a forum

14:09 justin_smith: yeah, i'm a sysadmin noob. if a process isn't in the foreground, it doesnt exist to me

14:10 justin_smith: danneu: yeah, I think I am ignoring a big background of linux usage that makes things seem "simple" that actually took me a while to learn

14:10 but hey, once you know it it's like riding a bike!

14:10 and heroku definitely eliminates a bunch of that (in trade for some monetary cost and more limited options, of course)

14:13 danneu: heroku also forces you to get your act together. can't be as lazy

14:13 i somehow let my linode app get so nasty that it doesnt even work once it's an uberjar

14:15 success: technomancy, ty! working now

14:16 technomancy: cool

14:19 justin_smith: danneu: here are three scripts I have used in deployment, I intend to make them a bit more modular and make a real package out of them some day https://www.refheap.com/92704

14:19 success: what about running on a raspberry? clojure has a pretty big footprint compared to python right?

14:20 justin_smith: success: it does, but I have heard tell of it running OK on a pi (as long as you aren't doing something realtime like audio)

14:20 mmeix: (or a Beaglebone or on the new Intel Edison, interested in that too)

14:22 danneu: justin_smith: you use grunt? you didn't yakshave your own asset pipeline like the rest of us?

14:22 justin_smith: danneu: I have frontend guys on the team, they don't want to use clojure and I don't make them use it

14:22 (well, the boss doesn't make them use it, it isn't even up to me)

14:24 danneu: plant the seed, man. start slow. grow your hair out like hickey's

14:24 justin_smith: danneu: getting too old for that (or too balding to be precise)

14:24 mgaare: this is ugly... better way to do this? (some-> nil-or-fn (#(%)))

14:25 success: meh, this language just doesnt bring anything to the table.

14:25 justin_smith: I'm sorry to hear you feel that way. It's worked great for me.

14:25 noonian: success: haha

14:25 mgaare: ok I guess (when nil-or-fn (nil-or-fn)) is nicer

14:26 noonian: i think you just need to spend more time with it

14:26 justin_smith: mgaare: (and (ifn? nil-or-fn) (nil-or-fn))

14:26 it makes it more explicit what you are checking

14:26 what if someone accidentally passed "true" in

14:27 noonian: success: what piqued your interest in clojure in the first place if you don't mind me asking?

14:28 mgaare: to give a little more context, it's actually this: (some-> (get-in functions-map [:maybe :fn]) (#(%))))

14:28 I just re-wrote as a when-let and I feel better about myself

14:30 success: noonian, the possibility of using it instead of java (on android) but it is not practical at all there

14:30 danneu: noonian: embedded programming

14:31 noonian: success: ah, yeah i think clojure has some problems on android

14:31 mgaare: sometimes the embarassment of showing something crappy to the channel is enough motivation to come up with something better. so, thanks all :D

14:31 danneu: success: youre talking about barely charted territory http://clojure-android.info/

14:32 mgaare: for even more fun, you can go clojurescript -> phonegap -> android

14:32 danneu: oh man

14:33 it took me long enough to even get the bundled-for-android eclipse package to run the example program without error.

14:34 razum2um1: is there any way to include some jar into one build by lein jar? how can I depend on some arbitrary jar file?

14:35 mgaare: razum2um1: it's not very fun to do that. The easiest way is to get the jar you want into a maven repository. The other way is to use a lein plugin

14:35 no, "easiest" was not the word I wanted there. "most recommended"

14:36 razum2um1: mgaare: where is no pom.xml file, but jar has no deps, is there an easy way like lein deploy maven?

14:37 mgaare: razum2um1: you can just make a skeleton pom file in that case.

14:38 razum2um1: mgaare: ok, thx ;)

14:38 justin_smith: mgaare: isn't there a lein command that does that?

14:38 mgaare: justin_smith: there certainly might be

14:39 justin_smith: lein-localrepo

14:39 it does various stuff with the local maven cache

14:39 technomancy: you can just use the second arity of lein deploy

14:39 justin_smith: oh, that too

14:40 success: sorry if I was rude, no offense meant!

14:41 mgaare: you can't offend clojure people. we have abstracted away our emotional response mechanisms

14:41 success: just trying to figure out if this was for me and the conclusion is it is not. it does not offer me anything at all.

14:41 dbasch: if I were doing android development, I’d probably stick with Java.

14:42 mostly because of the tooling

14:42 technomancy: I read that as "because of the trolling" at first and thought "it certainly would provide many rich opportunities"

14:43 danneu: is it rare for a given JS library to be closure-compatible?

14:43 i.e. get to move it into the build process instead of :libs + externs?

14:43 noonian: danneu: definitely, its mostly only googles libraries afaik

14:44 dbasch: trolling in java is easier too, but the clojure support for trolling keeps getting better

14:44 technomancy: http://technomancy.us/165

14:45 amalloy: dbasch: the downside is it takes so many words to build up to a proper troll in java that your audience leaves in the middle

14:45 dbasch: I was listening to the stack exchange podcast, apparently one of the indicators of poor quality of a question in SO is having “java” as its only tag

14:46 mgaare: I'd imagine a non-trivial percentage of java SO questions are related to CS101 homework assignments

14:47 dbasch: mgaare: they speculated quite a bit about the reasons, one possibility is that a vast majority of the java questions are trivially googleable

14:49 danneu: which of course leads to a nice succinct SO answer

14:49 SO is about playing the answer arbitrage market

14:52 csd_: Has anyone experienced a problem where *cider-error*'s stacktrace's colors are wrong. It's giving me dark on dark and its nearly impossible to read.

14:52 justin_smith: csd_: put your cursor on the text, and M-x describe-face

14:53 csd_: I did, it's telling me default, and it's incorrect

14:53 justin_smith: you will end up with a hyperlink you can go to to set the new color for future usage

14:53 are you really on the colorized text? if so that is really weird

14:53 csd_: It's not reporting the correct face for some reason

14:53 Yes. I am on the stacktrace portion of the buffer

14:53 justin_smith: csd_: it could be a face that "bled", you may need to go up to where the color setting started

14:54 csd_: you mean a problem with another package?

14:54 justin_smith: csd_: also, it could be an overlay instead of a face (m-x describe-text-properties iirc)

14:54 no, not another package

14:54 for any given text, emacs knows why it has the color it has

14:55 it usually comes down to font-lock, overlays, or bugs

14:55 csd_: that last command seems like it is the right one

14:55 looks like the face is cider-stacktrack-face, and every property of it is undefined

14:56 justin_smith: csd_: you can follow that as a link and set the colors

14:56 alexherbo2: technomancy: the editor i use, kakoune, is langage agnostic.

14:56 justin_smith: it is probably inheriting a bad default

14:56 csd_: inherits default so that explains that

14:56 thx

14:56 justin_smith: np, sorry it took me a few to remember the real solution there :)

14:56 technomancy: alexherbo2: if it doesn't let you write extensions in-process then that just means it supports all languages equally badly =\

14:57 justin_smith: technomancy: ed is language agnostic

14:57 alexherbo2: technomancy: yes

15:00 csd_: is it worthwhile reading let over lambda for someone who isn't doing CL?

15:00 amalloy: csd_: it won't actively harm you, so "worthwhile" depends how much you value your time. there's some value there

15:01 there are some interesting ideas and techniques, which mostly don't apply to clojure but might get you thinking

15:01 csd_: i read that the macro portion of it is supposed to be pretty good

15:01 clojurebot: Ik begrijp

15:02 justin_smith: ~i read that the macro portion of it

15:02 clojurebot: i read that the macro portion of it is supposed to be pretty good

15:11 SegFaultAX: justin_smith: Obligatory https://www.gnu.org/fun/jokes/ed-msg.html

15:13 justin_smith: SegFaultAX: I should make a line editor for clojure

15:13 all the old lisps had one

15:13 do all your work in the repl!

15:16 SegFaultAX: Hah, do it! :)

15:32 justin_smith: and then I can have a setup where you can define editor plugins in clojure - and someone can integrate it with curses or awt - and then we have clomacs!

15:33 amalloy: bbloom: my recollection of your stance on monads is that you think specific monad instances are useful (eg mapcat for List), but that there's no real value in having the generic notion of a Monad. (a) is this about right, and (b) i was curious how you feel about monoids

15:33 bbloom: amalloy: that's close to how i feel

15:33 amalloy: there obviously is value to the generic notion of a monad when you have something that operates on it, like do syntax in haskell

15:34 but if you don't have return type polymorphism (as you can't really in a latent typed language) then you have to specify the monad specifically, so you might as well specify that via the syntax you choose

15:35 ie when you use clojure.core/for, you're specifying that you want the list monad and it's syntactic form

15:35 list comprehension is the monadic interface, but it's a richer interface than just bind/return

15:35 so it gets special syntax, like :let, :when, etc

15:36 amalloy: that make sense?

15:36 amalloy: wellll, :let is just more sugar over bind/return. :when is a bit richer, though

15:37 bbloom: amalloy: no let is sugar over lets expressions in between binds

15:37 amalloy: sure

15:37 i guess i meant, it's sugar over things that don't need any more "power" than bind/return

15:37 bbloom: yes, true

15:37 but worth nothing that haskell's AST explicitly supports late statements in do notation

15:38 amalloy: s/late/let, right?

15:38 bbloom: yeah

15:38 (doc for)

15:38 clojurebot: "([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost fastest, and nested coll-exprs can refer to bindings created in prior binding-forms. Supported modifiers are: :let [binding-form expr ...], :while test, :when te

15:38 bbloom: oh yeah, while too

15:39 haskell has list comprehensions for when/while

15:39 amalloy: and i definitely see what you mean in a loosely-typed language like clojure: there's not a ton of value in generic monad functions, because even though you can write them they're not really as easy to use than specialized versions

15:39 bbloom: well, when is just a function; you can include that in do notation too

15:39 though i think `guard` is the function more like clojure's :when

15:39 bbloom: http://en.wikibooks.org/wiki/Haskell/Syntactic_sugar

15:40 yeah, guard is a monadic operation

15:40 the list monad's interface is larger than the generic monad's interface

15:40 that's the point

15:40 if you want special monadic syntax, you lose that for things outside the generic interface

15:40 modulo let

15:40 as far as i can tell

15:41 although the "-- or equivalently" block looks relatively nice

15:43 amalloy: do you know how to do :while in haskell?

15:43 amalloy: bbloom: i was just about to say that :while is the interesting one and i don't know what's like it in haskell

15:43 i have a SO comment somewhere, where i asked a haskell guy with some clojure experience and his response was similar

15:44 bbloom: *shrug* either which way, for syntax, haskell people generally use list comrhensions instead of do notation

15:44 i wonder what other extra-monadic operations are interesting on which underlying monads

15:45 surely there are many, but which benefit from syntax support?

15:46 scala's for comprehensions include yoda-style trailing `if`

15:46 amalloy: speaking of using do-notation for list comprehensions, i saw this beginner haskell question recently, and an answer which was completely incomprehensible, even to someone like me who already knows the answer: http://stackoverflow.com/q/26659648/625403 (this is unusual for haskell SO, despite the stereotype that haskellers just answer everything with graduate-level mathematics)

15:47 bbloom: heh

15:47 http://docs.scala-lang.org/tutorials/FAQ/yield.html

15:47 .withFilter

15:49 amalloy: that's basically the same as :when, right? (for [x xs :when cond] (f x)) => for (x <- xs; if cond) {yield f x}

15:49 ours is just as trailing/yoda

15:49 bbloom: yes

15:50 https://www.haskell.org/haskellwiki/MonadPlus

15:50 amalloy: right, that's where guard lives

15:50 bbloom: yeah

15:50 amalloy: needs mzero, iirc

15:51 bbloom: hilarious that it's called "MonadPlus"

15:51 is that a technical term or "shit, this is useful, let's put it in"

15:51 amalloy: bbloom: plus as in addition, i think

15:51 zero and plus

15:51 bbloom: yeah, i know, but surely there is a word from abstract algebra

15:52 anyway

15:52 i'm not saying do notation is useless

15:52 or that having a monad-abstraction is useless

15:52 i'm just saying it's not that useful :-P

15:55 aztak: good morning!

15:56 nathan7: bbloom: AdditiveMonad?

15:57 bbloom: nathan7: https://en.wikipedia.org/wiki/Group_(mathematics) maybe? i suck at abstract algebra

15:57 nathan7: bbloom: No

15:57 bbloom: or, hmm, yes

15:58 bbloom: mzero is the identity element

15:58 bbloom: and mplus is the group operation

15:58 bbloom: ah, no

15:58 bbloom: a group is a monoid

15:59 bbloom: monoids have associativity and an identity element

15:59 bbloom: we need to lock the abstract algebra and category theory people in a room and convince them to chop the vocabulary in half

15:59 nathan7: bbloom: "The precise set of rules that MonadPlus should obey is not agreed upon."

15:59 on the plus side, I now know what a monoid is

16:00 bbloom: if the rules are hard to decide, that means you don't understand it :-P

16:00 dbasch: bbloom: if you chop the vocabulary in half, then talking about all those things becomes really verbose

16:00 bbloom: which is also why i don't concern myself too much w/ the precise mathematical structure and instead worry about making shit that works and *feels* right

16:01 dbasch: i was mostly kidding

16:01 dbasch: bbloom: let’s do away with decimal, I don’t want to remember all those symbols when 0 and 1 suffice :P

16:05 nathan7: bbloom: you should learn J or K

16:06 bbloom: it has like maybe 40 functions? many of them with the same symbol but different arities

16:06 bbloom: +/%# being an averaging function, for example (+/ is kinda like map, % is division, # is count)

16:07 dbasch: and then you can find out if non-abelian supercalifragilistic groups are supersolvable

16:11 lodin: bbloom: Can you elaborate on why do notation is not that useful (in Clojure?)? I've heard this statement before, but never got the rationale.

16:11 bbloom: lodin: amalloy and i discussed it above

16:15 lodin: bbloom: Ah, the lack of return type inference. Indeed.

16:18 amalloy: lodin: which is the same thing that makes functions like (Monad m) => (...) not very useful: it's super-hard to say which specialization you want

16:19 i noticed it because yesterday i was writing (sequence :: (Monad m) => [m a] -> m [a]), since i wanted it for test.check generators, and i realized/remembered: oh yeah, if you apply this to the list monad instead of the generator monad, it's cartesian-product

16:19 and like...too bad: i kinda just have to write it twice, with different binds and returns

16:22 lodin: Yeah. I've faced the same issue. Specifically, you can't put return in a protocol, which you would do for fmap in a Functor protocol and bind in a Monad protocol.

16:24 amalloy: right. the various attempts at generic clojure monad libraries have tried to address this in various ways; none are super-impressive

16:26 jimduey's protocol-monads does an interesting thing which makes do-notation work surprisingly well but doesn't seem to address the question of functions like sequence

16:26 dbasch: here’s an example of a bad “java” question on SO: http://stackoverflow.com/questions/26745316/how-to-interpolate-point-in-time-in-java

16:27 lodin: amalloy: Ultimately I guess you end up writing your sequence function with two arguments: the monad description, and the [m a] value.

16:28 amalloy: right. you have to do all the type-witness passing by hand and at runtime, where it's "ordinarily" done at compile time by ghc

16:28 well, actually, i guess sometimes it does leak up to runtime in ghc too. either way doing it by hand sucks

16:31 arrdem: is there a good "infinite integer" value hack that people use or is it just Double/POSITIVE_INFINITY?

16:35 lodin: amalloy: Is https://github.com/bwo/monads/blob/master/src/monads/util.clj#L68 satisfactory?

16:41 amalloy: lodin: i can't tell how the knowledge about the current monad gets from place to place, there. it looks vaguely like he's using something like the Free monad to determine the structure of the computation without running it, and then at the top level running that Free instance through the monad you want?

16:41 a neat approach if he actually made it work

16:44 EvanR: monads in clojure?

16:44 does that imply types in clojure?

16:45 talios: clojure has types - what do you think list, set, map are? is there a difference between data structure and type?

16:45 EvanR: i mean, non dynamic types of the simple java flavor

16:46 talios: you can type hint. and protocols/records compile to static java classes so..

16:46 dbasch: arrdem: every number should be < Infinity in the jvm

16:47 EvanR: my question was whether monad libs come with the expectation of parametric types, or are they just freeform

16:47 justin_smith: arrdem: Integer specifically?

16:47 EvanR: cuz freeform would be interesting

16:47 arrdem: nevermind I'm being silly about how I'm approaching this

16:47 amalloy: dbasch: except NaN

16:47 justin_smith: ,Integer/MAX_VALUE

16:47 clojurebot: 2147483647

16:47 justin_smith: ,Long/MAX_VALUE

16:47 clojurebot: 9223372036854775807

16:48 arrdem: \forall X x \lteq \Ifty is good enough

16:48 dbasch: amalloy: but NaN is not a number :)

16:48 amalloy: ,(number? Double/NaN)

16:48 clojurebot: true

16:48 arrdem: NaN can go cry in the corner with NaR neither of whom belong in real data :P

16:48 EvanR: ,(< Double/Infinity Double/Infinity)

16:48 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to find static field: Infinity in class java.lang.Double, compiling:(NO_SOURCE_PATH:0:0)>

16:48 amalloy: NaR?

16:48 dbasch: I didn’t say any #(number? %) :P

16:48 arrdem: amalloy: Not a Result. used in some speculative hardware.

16:49 * EvanR replaces all arrdem's NaNs with signaling NaNs ;)

16:49 dbasch: btw, wat

16:49 arrdem: lol EvanR

16:50 EvanR: theres two kinds of NaNs

16:50 * arrdem fucks with his interrupt table some

16:50 dbasch: it is true that not a number is a number… therefore everything in clojure is true

16:50 justin_smith: dbasch: with two notable exceptions, yes

16:51 EvanR: ,(if nil 1 0)

16:51 clojurebot: 0

16:51 EvanR: ,(if NaN 1 0)

16:51 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: NaN in this context, compiling:(NO_SOURCE_PATH:0:0)>

16:51 EvanR: ,(if Double/NaN 1 0)

16:51 clojurebot: 1

16:51 arrdem: EvanR: it's ##Double/POSITIVE_NAN

16:51 amalloy: (inc justin_smith)

16:51 lazybot: ⇒ 116

16:52 justin_smith: arrdem: it's ##(Double/NaN)

16:52 lazybot: ⇒ NaN

16:52 EvanR: positive nan o_O

16:52 arrdem: or does NaN not have a sign bit.. I thought it did..

16:52 EvanR: nooo

16:52 amalloy: arrdem: were you positive?

16:52 arrdem: amalloy: gtfo

16:52 technomancy: some architectures give zero a sign bit

16:52 * arrdem flips a bit

16:52 dbasch: (doc number?)

16:52 clojurebot: "([x]); Returns true if x is a Number"

16:53 EvanR: ,(= Double/NaN Double/NaN)

16:53 clojurebot: false

16:53 amalloy: /topic Clojure, and puns thereon.

16:53 justin_smith: ,-0.0 ; technomancy like the jvm, sometimes

16:53 clojurebot: -0.0

16:53 amalloy: justin_smith: well, for floats that's required

16:53 dbasch: ,(instance? Number Double/NaN)

16:53 clojurebot: true

16:53 ambrosebs: ,(= Double/NaN)

16:53 clojurebot: true

16:53 justin_smith: a classic

16:53 EvanR: wtf

16:53 arrdem: EvanR: HAH yes you can have +/- NaN, but it's ignored on most architectures

16:54 NaN is 0bX1111111axxxxxxxxxxxxxxxxxxxxxx

16:54 where a

16:54 justin_smith: ,(.longValue Double/NaN)

16:54 clojurebot: 0

16:54 arrdem: is the signaling bit

16:55 technomancy: (negative? -0.0)

16:55 ,(negative? -0.0)

16:56 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: negative? in this context, compiling:(NO_SOURCE_PATH:0:0)>

16:56 lodin: amalloy: Don't know about the free monad, but yeah. That's basically it I think. I ended up with such a solution and then found that library.

16:56 technomancy: ,(neg? -0.0)

16:56 clojurebot: false

16:56 technomancy: justin_smith: that doesn't count

16:56 EvanR: ,(negative? Double/NaN)

16:56 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: negative? in this context, compiling:(NO_SOURCE_PATH:0:0)>

16:56 EvanR: ,(neg? Double/NaN)

16:56 clojurebot: false

16:56 EvanR: ,(pos? Double/NaN)

16:56 clojurebot: false

16:56 justin_smith: technomancy: the only number that prints with a leading - that isn't negative, I guess

16:56 (zero? Double/NaN)

16:56 ,(zero? Double/NaN)

16:56 clojurebot: false

16:57 EvanR: i hate NaN

16:57 amalloy: ,((juxt neg? pr-str) (- Double/NaN))

16:57 clojurebot: [false "NaN"]

16:57 amalloy: well, so much for that being a counterexample

16:57 EvanR: how do you feel about naan?

16:58 EvanR: its ok

16:58 pmonks: EvanR: my nan is the best. She makes me stewed apple.

16:58 technomancy: amalloy: are you asking for a naan disclosure agreement?

16:58 amalloy: technomancy: only clojure-related puns, sorry

16:58 nathan7: o.o

16:58 amalloy: this is more of an engineering wordplay

16:58 nathan7: (naan highlights me for hysterical raisins)

16:59 dbasch: I only like naan that lends itself to currying

16:59 nathan7: shoo, off to Haskell you go q=

17:00 * arrdem ponders q=

17:01 lodin: amalloy: in monads.core you find (defn run-monad [m computation] ...) and (defn return [x] (Return. x)), and I believe (Return. x) is a computation.

17:03 gfredericks: amalloy: something something naan disclojure agreement

17:04 {blake}: Why would "lein test" show a FAIL and then end with "Ran 2 tests containing 2 assertions. 0 failures, 0 errors."?

17:04 dbasch: gfredericks: you have to sign one before they let you eat here http://www.yelp.com/biz/naan-n-curry-san-francisco-4

17:09 justin_smith: {blake}: that's weird, how many tests do you actually have defined?

17:10 sdegutis: Is rsync a reasonable way to deploy a Clojure web app in uberjar form along with its resources dir?

17:10 technomancy: (deftest ohai (println "FAIL") (is true) (is true))

17:10 amalloy: sdegutis: why would you deploy its resources directory separately? it should be included in the uberjar

17:10 sdegutis: amalloy: I meant resources/public, for Nginx.

17:11 {blake}: justin_smith, Two. I'm just starting to write tests. Two were in the auto-generated test file, but I removed one. Then I added one.

17:11 dbasch: sdegutis: why does nginx need the resources/public dir?

17:12 {blake}: If I run it from the REPL in Cursive, it doesn't even show the error. (Making running testing from the REPL useless.)

17:12 amalloy: dbasch: i presume sdegutis wants to let nginx serve his public resources instead of doing it with ring

17:13 dbasch: amalloy: yes, but why?

17:13 ticking: Quick poll :), what is the most idiomatic way to split a sequence of booleans on a true false flank?

17:13 amalloy: ticking: flank??????

17:13 it's not an incoherent choice. nginx surely does a better job of it. better caching, performance, whatever

17:14 dbasch: amalloy: sure, if you’re google, or heroku, or whatever

17:14 otherwise it’s a very premature optimization

17:14 ticking: amalloy: edge, sorry it's late here

17:14 justin_smith: {blake}: using clojure.test, right?

17:15 {blake}: justin_smith, Yep.

17:15 amalloy: ticking: do you have a sample input with expected output? it's a pretty vague question

17:15 justin_smith: {blake}: if you load the namespaces that define the tests, (clojure.test/run-all-tests) will run the tests and give a summary

17:15 arrdem: ticking: amalloy: [true true false true] -> [[true true] [false] [true]] if I understand...

17:16 ticking: amalloy arrdem: [true true true false true true false true] => [[true true true false] [true true false] [true]]

17:16 amalloy: so whenever a is false and b is true, put a split between a and b

17:16 (in that order)

17:16 ticking: yeah

17:17 sdegutis: dbasch: For when the site is restarting.

17:17 amalloy: if you don't mind pulling in flatland/useful (https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L224), you could: (defn splits [xs] (partition-between (fn [[a b]] (and b (not a))) xs))

17:17 sdegutis: amalloy: Most of my resources are on CloudFront. I just want to serve some while the Clojure web app is restarting.

17:18 ticking: amalloy: yeah, but this has to be doable in clojure.core :D

17:18 amalloy: ticking: huh? you're hoping to include this function in clojure.core?

17:18 dbasch: sdegutis: sure, you can rsync. I’d rather deal with the few seconds of downtime

17:18 gfredericks: &(pr-str (map #(doto % println) '(1 2 3)))

17:18 lazybot: ⇒ "(1\n2\n1 3\n2 3)"

17:18 sdegutis: Than what?

17:19 dbasch: sdegutis: than with the error-prone nature of deploying a jar and a directory of resources separately

17:19 sdegutis: Why is that error-prone?

17:19 dbasch: unless I had to optimize for uptime because I have tons of users and I lost money when they couldn’t see the site

17:19 ticking: amalloy: it's driving me nuts, splitting seqs between values is such a basic operation, and in comparison partition-by is super useless, especially considering that partition-by is a special case of partition-between

17:19 dbasch: sdegutis: because you have to write a custom script to deploy both at once, and you could forget to run it

17:20 {blake}: justin_smith, Yeah. There it shows 1 test containing 1 assertion. :-/

17:20 sdegutis: dbasch: It's the only way to deploy though.

17:20 amalloy: ticking: i mean, i agree; that's why i wrote partition-between. what does this have to do with not wanting to use useful?

17:20 justin_smith: {blake}: is there some other namespace that has test definitions in it that did not get loaded?

17:20 arrdem: &(bit-shift-left 5 2)

17:20 lazybot: ⇒ 20

17:20 ticking: amalloy: I'll happily use it, but it should be in core ;)

17:21 arrdem: &(bit-shift-left 5 5)

17:21 lazybot: ⇒ 160

17:21 amalloy: oh, by "has to", you mean "there should be a way to do it with just functions in clojure.core"?

17:21 ticking: amalloy: yeah

17:22 amalloy: obviously there is one; reimplement all the functions in useful, which depend on stuff not in clojure.core, and use the reimplemented versions as helpers

17:22 ticking: in less than 5 lines ;)

17:22 amalloy: it's not super-hard to write this boolean-splitting function by hand

17:22 {blake}: justin_smith, When I do a run-all-tests in the REPL, it doesn't load my "main" tester. When I "lein auto test" (using the "auto" plugin), it loads both files.

17:22 amalloy: but it's so specific i can't imagine why you would; instead, implement partition-between

17:23 m1dnight_: If I want to make a quick program (solve a puzzle, belphegor numbers, for who cares), how do I import a namespace?

17:23 ticking: yeah I wrote one that is faster than partition-by when supplied with not=

17:23 technomancy: m1dnight_: "use" is fine for throwaway code

17:24 m1dnight_: but then i get classnotfound exception

17:24 It's not in a leiningen project, to be clear

17:24 just a buffer in cider

17:24 sdegutis: I like the idea of deploying via Git, though.

17:24 That way I can push a tag to remote.

17:24 technomancy: well ... the namespace has to be present

17:25 amalloy: i don't think you can write it *well* with clojure.core in less than five lines

17:26 dbasch: amalloy: you could do it easily with a greedy loop and an accumulator

17:26 amalloy: dbasch: so far that doesn't sound like a counterargument

17:26 lazy seqs for life

17:27 arrdem: transducer style partial lazyness :P

17:29 amalloy: ticking: if i had to write it from scratch and wasn't allowed to build any reusable helpers, https://www.refheap.com/caf4ede90f5fd21a2fa1d47e8 is what i would do

17:33 arrdem: http://macbeth.cs.ucdavis.edu/lang_study.pdf

17:34 dbasch: “a very large data set from GitHub (729 projects)” … ok

17:35 arrdem: by the standards of software defect papers that's actually not bad :P

17:35 most of the software engineering literature I've seen is grateful for 2 or 3 projects as samples

17:36 dbasch: “Some languages induce fewer defects than other languages.” ok, let’s make everyone code in Scala and see how that remains true

17:37 m1dnight_: hmm, I've been using exp function in clojure by accident (meant to write expT) and it yields false results, is that possible?

17:39 Bronsa: m1dnight_: there's no exp function in clojure

17:39 m1dnight_: huh

17:39 what on earth have I been using then..

17:39 Bronsa: ,exp

17:39 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: exp in this context, compiling:(NO_SOURCE_PATH:0:0)>

17:39 noonian: there is java's Math/exp

17:39 m1dnight_: I have no use, import nothing

17:40 noonian: ,(Math/exp 2 4)

17:40 clojurebot: #<CompilerException java.lang.IllegalArgumentException: No matching method: exp, compiling:(NO_SOURCE_PATH:0:0)>

17:40 m1dnight_: and yet, (exp x y) worked :p

17:40 oddly enough

17:40 user> (exp 2 3)

17:40 8

17:40 .. :p

17:40 Bronsa: m1dnight_: how are you running clojure?

17:40 m1dnight_: Cider

17:40 hmm, user defined function according to repl

17:40 i must have done.. euhm.. nvm :p

17:42 {blake}: Wow...inspired by Eiffel!

17:44 dbasch: arrdem: “the defect proneness of languages in general is not associated with software domains.” <- they cannot assert that if their universe of domains is restricted to a few open-source projects on github

17:46 arrdem: dbasch: gimme a minute hand-assembling some code..

17:47 cfleming: {blake}: Are you having problems testing in Cursive?

17:47 {blake}: cfleming, I'm having specific issues testing in Cursive, but I'm having problems NOT in Cursive as well. =)

17:48 cfleming: {blake}: Hehe, well I can at least help with the Cursive bit

17:48 {blake}: Have you seen this? https://cursiveclojure.com/userguide/testing.html

17:48 {blake}: cfleming, I have, but not in a while. Let me revisit...

17:48 cfleming: {blake}: It's slightly out of date (the tooltips are now on the error message in the editor itself) but it'll give you the idea.

17:49 {blake}: If you're still having problems let me know

17:49 m1dnight_: Hmm, so I can't use namespaces like math.numeric-tower in a not-leining project?

17:49 I have the clojure jar in the same foler, but I have no idea if I have to load it by hand or so?

17:50 dbasch: m1dnight_: you need the jar in the classpath

17:50 m1dnight_: I'm guessing that is in the classpath of CIDER?

17:51 {blake}: cfleming, Well, it runs the tests, so there's that. The counts are wrong, just as they at the CLI.

17:51 amalloy: m1dnight_: doing anything *not* in a leiningen project is quite a handicap. everything is easier with lein

17:51 cfleming: {blake}: So your counts are wrong using lein test, or whatever you're using to run your tests?

17:52 m1dnight_: but I just want to solve a simple puzzle, I dont want to create a leining project for that

17:52 {blake}: cfleming, Yeah, it seems to count each namespace as 1, regardless of the number of tests and assertions.

17:52 m1dnight_: not being able to quickly mash up some code for a 10 line puzzle is a handicap imo

17:52 dbasch: m1dnight_: but it takes like 1 second to create a leiningen project, and you can keep it for future puzzles

17:53 m1dnight_: point well made

17:53 argh ;p ill do it that way then

17:53 {blake}: dbasch, m1dnight_ That's what I do.

17:56 arrdem: bah bugs

17:57 ToBeReplaced: m1dnight_: "lein one-off" might be of interest

17:57 arrdem: dbasch: you're right. yay research criticism

17:57 xonev1: m1dnight_: I use the lein-exec plugin for simple scripts: https://github.com/kumarshantanu/lein-exec

17:57 m1dnight_: aaah, that might be something that might aleviate :)

17:57 thank you guys

17:59 dbasch: arrdem: yeah, I’m sure the approach is ok for github, but for example C is used in tons of industrial domains with long development cycles (e.g. embedded devices). They need to take that into account when they make broad statements like that one.

17:59 arrdem: dbasch: for sure, but measuring defect rates and classes for closed source stuff like that is le hard :/

18:00 dbasch: arrdem: that’s the kind of data that the SEI has, mostly with defense contractors

18:01 arrdem: dbasch: which SEI? :P

18:02 dbasch: arrdem: software engineering institute http://en.wikipedia.org/wiki/Capability_Maturity_Model

18:02 cfleming: {blake}: Hmm, that's strange. Cursive will probably report the same as clojure.test does there, it just delegates to clojure.test for all that info.

18:04 andyf: Bronsa: Ok, Clojure and taj trivia question. Clojure seems to allow foo/bar as args to methods in reify, but taj throws exception. That looks reasonable to me on taj side, but wanted to verify

18:05 amalloy: ,(reify Object (toString [user/this] "x"))

18:05 clojurebot: #<sandbox$eval25$reify__26 x>

18:05 amalloy: huh, i didn't expect that

18:05 Bronsa: andyf: ugh.

18:05 andyf: yeah I'll have to support that

18:05 technomancy: I vaguely recall opening a bug about reify accepting nonsense args

18:06 Bronsa: ,(reify Obejct (foo/toString [foo/this] "foo"))

18:06 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: Obejct in this context, compiling:(NO_SOURCE_PATH:0:0)>

18:06 Bronsa: ,(reify Object (foo/toString [foo/this] "foo"))

18:06 clojurebot: #<sandbox$eval75$reify__76 foo>

18:06 andyf: Bronsa: Why would you have to support it? Isn't it an accident that Clojure accepts it?

18:06 amalloy: Bronsa clearly doesn't trust my tests

18:07 andyf: lacking a spec that's independent from the existing implementation, it doesn't really matter what's an accident: anything that works in clojure is as close to defined behavior as we get

18:07 Bronsa: andyf: some code might rely on this, clojure.core relies on (foo/toString ..) to work

18:07 ,(deftype x [] Object (toString [foo/bar] ""))

18:07 clojurebot: sandbox.x

18:07 Bronsa: gah

18:07 andyf: Even when I say Clojure accepts it, I just mean it doesn't give error. You can't refer to those args in the body (at least I don't know how)

18:07 Bronsa: andyf: ah really?

18:08 ,(defprotocol p (f [_ _]))

18:08 clojurebot: p

18:08 Bronsa: ,(f (reify p (f [_ foo/bar] bar)))

18:08 clojurebot: #<CompilerException java.lang.IllegalArgumentException: No single method: f of interface: sandbox.p found for function: f of protocol: p, compiling:(NO_SOURCE_PATH:0:0)>

18:08 justin_smith: {blake}: coming back after a nap: clojure.test does not do anything to look for namespaces with tests in them, all it does is run the tests in namespaces that have been loaded

18:09 {blake}: lein test has some rules for looking for namepsaces that have tests in them

18:09 technomancy: I wish that were part of clojure.test

18:09 really lame to have to put them in the task

18:09 Bronsa: ,(f (reify p (f [_ foo/bar] bar)) 1)

18:09 clojurebot: 1

18:10 Bronsa: andyf: ^ looks like it work

18:10 works*

18:10 andyf: Look at gist.github.com/jafingerhut/9323268424eca54293f5

18:10 technomancy: Bronsa: it's not the same identifier though

18:10 I mean ... FSVO "works"

18:12 Bronsa: andyf: how did you find out about this?

18:12 andyf: Got exception when trying to lint aleph lib, got that taj exception, and started experimenting.

18:12 Let me find aleph code.

18:13 Bronsa: ah so there *is* real code that depends on this :(

18:13 technomancy: andyf: fixing this in a way that throws at compile time would be a lot better than some behaviour changes that just affect codebases silently though

18:14 andyf: I think it just happens to work with Clojure because aleph has this issue for args named _, so never used in method

18:14 technomancy: anyone who sees an exception would immediately say "oh wow, we were doing what??" and feel embarrassed.

18:14 like how Clojure used to discard nonsense type hints and then started throwing compile errors

18:14 andyf: technomancy: Agreed that the error is preferable if this can't be used in reasonable way

18:15 Bronsa: technomancy: people write `(deftype x [] Interface (method [..] ..) all the time never realizing that's going to expand to (ns/method [..] ..)

18:15 technomancy: there is nothing reasonable about namespaced locals

18:15 locals by definition need no namespace

18:15 Bronsa: is this about the method name or the arglist?

18:15 Bronsa: technomancy: method name

18:15 ztellman: andyf: thanks for the heads up on that

18:15 crazy that it's such an invisible bug

18:16 Bronsa: technomancy: clojure still silently ignores wrong type-hints btw

18:16 technomancy: Bronsa: I meant for classes that simply don't exist

18:16 Bronsa: technomancy: .. yeah

18:17 technomancy: it's highly inconsistent, it might throw or just ignore it depending on where you put the type hint

18:17 cfleming: andyf Bronsa: I noticed while working on my macroexpander that macroexpansions of deftype/reify/etc forms have clojure.core-qualified method names.

18:17 technomancy: Bronsa: it changed somewhere in 1.1 -> 1.3 to be more strict

18:17 andyf: Github.com/ztellman/aleph/blob/0.4.0/src/aleph/netty.clj#L277

18:18 Bronsa: technomancy: well I can't imagine how bad it was earlier then, lol

18:18 dbasch: Bronsa: and when it throws it’s not always the same exception

18:18 technomancy: anyway, I wrote code that accidentally relied on the old behaviour and was glad for the new behaviour even though it was a breaking change, because it was compile-time

18:18 Bronsa: andyf: I've felt your pain typing that url

18:20 andyf: I guess I should have said before that at least in this case, an error from taj seems preferable to Clojure's accepting it

18:20 Bronsa: cfleming: yeah defrecord has all its method impls qualified

18:20 andyf: It is quick copy and paste when not on my iPhobe (left that typo in for fun :-)

18:21 cfleming: technomancy: The one case where locals are reasonably ns-qualified is in the new :keys destructuring

18:22 technomancy: Otherwise, right, no argument there.

18:22 amalloy: cfleming: well, that's because you're using `: macroexpansion isn't qualifying those names, you are

18:22 ,`(reify Object (toString [this] "s"))

18:22 clojurebot: (clojure.core/reify java.lang.Object (sandbox/toString [sandbox/this] "s"))

18:23 Bronsa: ,(macroexpand-1 '(defrecord x []))

18:23 clojurebot: (clojure.core/let [] (clojure.core/declare ->x) (clojure.core/declare map->x) (deftype* x sandbox.x [__meta __extmap] :implements ...) ...)

18:23 Bronsa: well.

18:23 amalloy: &(macroexpand-1 '(defrecord x []))

18:23 lazybot: ⇒ (clojure.core/let [] (clojure.core/declare ->x) (clojure.core/declare map->x) (deftype* x sandbox12103.x [__meta __extmap] :implements [clojure.lang.IRecord clojure.lang.IObj clojure.lang.ILookup clojure.lang.IKeywordLookup clojure.lang.IPersistentMap java.util.Map j... https://www.refheap.com/92715

18:23 amalloy: okay, i guess that's true. if you expand past defrecord to the deftype* phase, there are more clojure.core-qualified names

18:24 Bronsa: cfleming: in cljs it's even worse btw protocols too get cljs.core qualified and ctors too in some cases

18:24 cfleming: Right, as a user I can't avoid that happening AFAICT - not that I probably care as long as Clojure accepts it

18:25 Just thought it was curious

18:25 andyf: Anyone have example if new namespace qualified key destructuring for me to test with?

18:25 Bronsa: ,(let [{:keys [foo/bar]} {:foo/bar 1}] bar)

18:25 clojurebot: 1

18:25 cfleming: andyf: I think the JIRA had examples, but I don't have it to hand.

18:25 Or Bronsa has your back :-)

18:26 amalloy: actually, i take it back. defrecord expands into (deftype* Object (clojure.core/toString [this__auto] "whatever")), which is not an instance of this undesirable qualified names

18:26 andyf: Yes. Yes he does

18:26 cfleming: Bronsa andyf: The new Eastwood looks great BTW - I need to get those type-hint warnings into Cursive too.

18:27 Bronsa: amalloy: cfleming was talking about qualified method names not locals

18:27 amalloy: Bronsa: yes, i missed that

18:27 cfleming: Right, the clojure.core/toString in your example

18:27 andyf: cfleming: The new version is easier to call from a repl or other app, if you want to go that route

18:27 amalloy: which is sorta "old news". weird that the compiler accepts it, but once you think about it it's much preferable to the alternative

18:28 Bronsa: amalloy: agreed

18:28 cfleming: andyf: I'll have to rewrite them to work within Cursive, unfortunately - the infrastructure works in quite a different way.

18:28 amalloy: accepting qualified method arguments is the wild thing andyf noticed

18:28 cfleming: andyf: BTW this would be good to warn about too, if you can: http://dev.clojure.org/jira/browse/CLJ-865

18:29 andyf: This bit me the other day.

18:29 amalloy: oh hey, that would be a good thing to put in a linter, i suppose

18:29 cfleming: No doubt, I'll be warning about that in Cursive when I get some time

18:30 Bronsa: cfleming: if you need hints on what to look for when warning about type hints feel free to email me

18:30 andyf: Meaning if a macro invocation has a type hint, warn that compiler will/might remove it depending on macro defn?

18:31 cfleming: Bronsa: Thanks, I will do when I get to it, definitely.

18:31 {blake}: justin_smith, It's running the tests. I can make them fail and they'll all show up. It just doesn't count them.

18:31 Bronsa: btw I've run into a super weird issue with tools.reader the other day

18:31 cfleming: andyf: Right. I think "will almost certainly remove it" is a more accurate characterisation

18:31 Bronsa: changing ` to emit c.c/sequence instead of c.c/seq caused some metadata to be lost

18:32 I tracked it down to sequence possibly returning a LazySeq rather than an ASeq but couldn't figure out why lazyseq were problematic

18:32 {blake}: justin_smith, So, I'll get five fail messages, but then "2 tests containing 2 assertions, 0 failures, 0 errors."

18:34 andyf: So sounds like it may be best to keep exception in t.a.j for method arguments with namespace qualifiers?

18:35 justin_smith: {blake}: weird, I've never seen anything like that

18:35 cfleming: {blake}: That does sound like the ns is not being correctly loaded somehow.

18:35 {blake}: There are no exceptions while loading?

18:36 Bronsa: andyf: I just unstaged the changes to relax the check, amalloy and technomancy have convinced me it's not worth it

18:37 andyf: Cool. One more kind of likely-a-bug thing it can catch, then

18:43 {blake}: cfleming, While loading what? From the command lein it's just "lein auto test". No exceptions there.

18:43 cfleming: {blake}: While loading the namespace - to me it looks like your test vars are not being created correctly for some reason. If you manually require your test ns, do you get any exceptions?

18:44 {blake}: From a new REPL in cursive, I just do "(clojure.test/run-all-tests)".

18:44 Let me try that.

18:44 cfleming: {blake}: You could also look for your test vars to make sure they're there as you expect, and that they have the clojure.test metadata attached to them.

18:45 {blake}: i.e. (meta my-ns/my-test-var) should have some test-related entries, although I'm travelling right now and can't remember what it looks like

18:45 {blake}: cfleming, Requiring the namespace causes the tests to be run, and the errors to be shown, but no count.

18:45 cfleming: {blake}: Then that is very weird.

18:45 {blake}: cfleming, So far I've got no test vars, just running functions.

18:46 cfleming: {blake}: So you're not using deftest?

18:47 {blake}: cfleming, That could be it. I started with deftest then switched to testing.

18:47 amalloy: {blake}: if your test assertions aren't inside of a deftest form (ie, are just at the top level of your namespace), then of course lein test won't know they failed

18:47 justin_smith: yeah, that's not what testing is for

18:48 {blake}: Well, mystery solved, then.

18:48 amalloy: all tests should be inside of a deftest; testing is for finer shades of meaning within that

18:49 justin_smith: {blake}: testing is for getting more meaningful failure messages, and for grouping assertions within a test

18:50 {blake}: justin_smith, Sure. I see the admonition to use deftest on the api page, but I'm used to using RSpec (which I see this is Not Like).

18:50 Anyway, thanks all.

18:51 cfleming, And nice job on underlining the failed test in Cursive!

18:54 cfleming: {blake}: Thanks! Glad the mystery is solved.

18:54 {blake}: I'd recommend checking out the clojure.test source sometime to see how it works, it's a single longish ns, and relatively easy to understand.

18:55 justin_smith: cfleming: {blake}: I am a big fan of how clojure.test leverages standard clojure features instead of trying to be a mini language for testing

18:56 {blake}: cfleming, Thanks, I'll do that. That seems to be a very effective tactic in Clojure.

18:56 cfleming: justin_smith: Agreed. I like expectations for that, too.

19:00 bbloom: help me convince don syme that value recursion is a bad idea :-)

19:00 https://twitter.com/BrandonBloom/status/529700895765049344

19:12 {blake}: justin_smith, Oh, no argument from me. I'm coming from a language where EVERYTHING is done as a mini-language. And there are six constantly changing mini-languages for any domain. And you can't learn one of the mini-languages without learning 3 or 4 others the mini-language creator was currently enamored of at the time.

19:12 justin_smith: heh

19:13 noonian: {blake}: which language is that?

19:14 postpunkjustin: racket?

19:16 * tuft 's Python is becoming more and more Clojure influenced.

19:16 tuft: just wrote the best equivalent to the threading macro possible =)

19:17 amalloy: noonian: ruby, presumably, since he said rspec

19:17 {blake}: noonian, Ruby. Which I like a lot, don't get me wrong. But the premiere Ruby on Rails book has (IIRC) over ten technologies you have to tackle before you get to a "Hello, World."

19:17 noonian: ah

19:18 {blake}: Ooh, I outed myself. I'm actually a Smalltalk guy. And Delphi. Heh.

19:25 (Or used to be, anyway.)

19:33 rweir: tuft, hah, mine too

19:49 {blake}: Deploying with JBOSS? Rad? Or gnarly?

19:51 jcrossley3-away: {blake}: define "JBOSS"

19:53 {blake}: jcrossley3-away, JBOSS can be whatever you want it to be! (Our devops guy said "Let's use JBOSS to deploy it". Whatever it is, it'll be a brand new box just hosting this one app.)

19:53 justin_smith: there is immutant

19:54 for a clojury jboss exerience

19:55 {blake}: justin_smith, I'm trying to talk him into it.

19:55 tuft: clustering in immutant seems interesting

19:55 otherwise i'd rather roll my own with libs

19:56 jcrossley3-away: {blake}: it all depends on why he wants jboss. if it's because he wants you to hand your app to him in the form of a war file, then the onus is on him to deal with jboss

19:56 {blake}: tuft, Your own deployment platform?

19:56 jcrossley3-away: immutant can make your dev experience a little nicer until you have to hand him a war file

19:56 {blake}: jcrossley3-away, Yeah, that was my argument.

19:57 tuft: {blake}: oh, i wasn't thinking about it from a deployment perspective i guess. yeah if you're stuck having to spit out a war then i guess you need the j2ee app server stuff

19:57 jcrossley3-away: {blake}: fwiw, immutant's clustering requires wildfly, so that rules out older jboss versions.

19:58 {blake}: What's the most common approach for deploying Clojure?

19:58 tuft: {blake}: i was thinking more about immutant's capabilities as an application server vs just booting up some library components and managing your own "main"

19:58 {blake}: I can probably sell whatever.

19:58 * tuft is a big fan of the runnable jar.

19:58 tuft: with nginx in front =)

19:59 technomancy: the most common approach is jetty uberjar

19:59 {blake}: technomancy, So...standalone?

20:00 technomancy: yeah

20:00 jcrossley3-away: tuft: {blake}: immutant 2 can do either standalone/runnable/uberjar or app server (wildfly)

20:01 tuft: jcrossley3-away: cool yeah, i saw it's more componentized

20:01 jcrossley3-away: and immutant.web's embedded undertow should be a skosh faster than jetty

20:01 {blake}: jcrossley3-away, So maybe I use jetty uberjar while I figure out Immutant?

20:01 tuft: immutant 2 isn't released yet i don't think

20:02 {blake}: OK, thanks, all. Off to experiment.

20:02 jcrossley3-away: tuft: correct, hopefully in a month or so

20:03 and 2.0.0-alpha2 is out, certainly experiment-worthy

20:05 sdegutis: The main benefit of Clojure over Ruby so far appears to be the complete lack of worrying about method name collisions.

20:05 tuft: heh

20:14 amalloy: the main downside? a complete lack of worrying about artifact-id collisions

20:15 sdegutis: wat

20:17 dbasch: I’d say the main benefit of Clojure over Ruby is that you can look at a few lines of code and know that no horrendous monkeypatching mutation will be sending you into a random circle of debugging hell

20:17 csd_: amalloy: have you ever thought about extending 4clojure to have questions that require macros to solve?

20:19 amalloy: csd_: i have. it was a hard problem, both technically (missing features in the sandbox) and pedagogically (how do you define such a problem anyway?)

20:19 that was years and years ago; these days i don't really do much with 4clojure besides keep it running

20:20 dbasch: amalloy: the arrow macros would be interesting pedagogically

20:21 amalloy: dbasch: we have a problem or two showing how the arrow macros are used, but none about how to write them

20:22 dbasch: I wouldn’t want to deal with getting the sandbox to allow macros securely though

20:23 amalloy: reiddraper: is (apply gen/tuple gens) functionally the same as (sequence gens)? i spent some time yesterday looking for sequence, and then stopped when i found it as a private helper function, but i now see that tuple looks like the user-facing version of that

20:25 gfredericks: amalloy: sequence is a 3-arg function, so I'm having trouble parsing your meaning

20:26 amalloy: gfredericks: i mean sequence like the haskell function whose type is given in the docstring. it's what gen/sequence would be, except it takes bind and return as args too

20:26 sdegutis: dbasch: Not true at all.

20:26 dbasch: sdegutis: which part?

20:27 gfredericks: amalloy: ah okay; it looks to me that sequence *could* be a bit more raw and not handle shrinking, perhaps?

20:29 amalloy: gfredericks: mabye. i don't actually plan to use gen/sequence; the fact that it's private is warning enough. but after writing my own (sequence :: [m a] -> m [a]) i realized maybe i just want tuple

20:29 i don't know anything about how the shrinking is implemented

20:30 gfredericks: yeah I think that's what tuple is for; I've used tuple on long runtime seqs of generators with no obvious downside

20:31 in fact that's how vector is implemented

20:31 (apply tuple (repeat num-elements generator))

20:33 mdeboard: What's the purpose of the "I" convention for protocols

20:34 csd_: i'm sure this question has no good answer, but what do you guys think of rails vs node

20:34 mdeboard: csd_: They're not equivalent

20:34 You can't compare them. You'd need to compare like Angular or Ember to Rails

20:36 csd_: mdeboard: do you see node as sticking around?

20:37 justin_smith: $examples juxt

20:37 lazybot: http://clojuredocs.org/v/2058

20:38 justin_smith: arrdem: any interest in adding grimoir to the examples plugin while I am working on lazybot? almost done over here

20:40 sritchie: has anyone here tried to render React / Om code on the server side?

20:40 I’m trying to use Kioo,

20:41 and it’s failing because Nashorn has no DOMParser implementation

20:42 mindbender1: Is there a standard algorithm for inserting things anywhere in a sequential?

20:43 amalloy: mindbender1: that's a corollary to a question asked in here yesterday: go back in time to when you decided what data structure to use, and use something that supports the operations you want to perform

20:44 guest59: sritchie: I've render on the server side using nashorn

20:45 sritchie: guest59: do you have any code that tries to parse HTML?

20:46 guest59: Let me try to find the code ...

20:48 mindbender1: amalloy: that's tricky because i have had this issue on my mind for a long time and ever since playing with sequentials? I have never come across such a function in clojure unless of course I have bad re-collective memory and would rather indulge your assistance here.

20:49 amalloy: mindbender1: i mean, it doesn't exist. you can write it yourself, but if your algorithm involves inserting in the middle of an arbitrary seq that almost always means it is a bad algorithm

20:49 dbasch: mindbender1: there can’t be a standard algorithm because you don’t know the structure, but you can code a simple, generic O(n) solution

20:49 which is probably not what you want unless you need to modify someone else’s code in a pinch

20:51 mindbender1: amalloy: exactly. I was thinking if it's not that standard then it probably means I'm not thinking right about the problem and it's solution.

20:52 dbasch: mindbender1: think about it, inserting things anywhere in a sequential structure means either shifting things, changing pointers or having empty space to begin with

20:52 amalloy: mindbender1: right. so instead of "how do i insert into the middle of a seq", the question to ask is "here's why i think i need to insert into the middle of a seq; what am i wrong about?"

20:53 arrdem: justin_smith: sure, but I think that example selection & formatting will prove problematic

20:53 justin_smith: if anything I would want a way to say $grim <symbol> and get a link

20:54 justin_smith: that would be kickass

20:54 amalloy: $grim fandango

20:55 guest59: sritchie: Looks like I was just testing it out. Here's the code I used - https://www.refheap.com/92723

20:55 mindbender1: But in this case I'm not sure I'll be dealing with that much elements to really affect performance. It's really vectors that I want to use and hold a number of non-rendered dom elements when something needs to change position I do that off the dom and re-render. I really don't know how to make this happen without pushing and pulling.

20:55 justin_smith: arrdem: yeah, that is what I had in mind, if you can give me the code that does that for a given symbol, I can throw it into a lazybot plugin no prob

20:55 mindbender1: I wrote an insert-at as far back as last year

20:56 but I'm really concerned if I'm doing it wrong

20:56 dbasch: mindbender1: the obvious O(n) way would be (concat (take n xs) [x] (drop n xs))

20:57 mindbender1: dbasch: that's exactly what i did

20:57 arrdem: justin_smith: so the munging is easy that's all in lib-grimoire

20:57 justin_smith: you can just require that stuff

20:57 dbasch: which would not be bad if you have a small number of elements that you’re going to render (say < 100)

20:58 arrdem: justin_smith: the real issue is that for anything not in clojure.core it gets way more complex

20:58 justin_smith: arrdem: if only you had a query api

20:58 mindbender1: dbasch: yes. That much would be just about it. You think the algorithm you put up above serves well?

20:58 arrdem: justin_smith: there's a listing API in 0.4.0, but that's not done yet

20:58 justin_smith: oh, cool

20:58 arrdem: justin_smith: throw me a ticket and I'll think about a real search API

20:59 justin_smith: may make more sense to just wait and make something that uses that

20:59 mdeboard: I've seen a few decision trees/matrices about when to use types, records, protocols, etc. Anyone know where those can be found

20:59 amalloy: $google cemerick types flowchart

20:59 lazybot: [Flowchart for choosing the right Clojure type definition form | cemerick] http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/

20:59 justin_smith: arrdem: a fallback would be to ask for a full name / url index one time, and then just look things up in that

20:59 mdeboard: aha

20:59 thanks

20:59 amalloy: mindbender1: i mean, why do these things need to be in a particular order? is there some way you can make it a tree with a reasonable sort, instead of a list?

21:00 justin_smith: yeah, a sorted-set-by for example

21:00 arrdem: justin_smith: have you seen my var-link stuff?

21:00 amalloy: presumably there is some property of the data items themselves that makes you say "this one has to go after that one"

21:00 encode that in the data structure, instead of in your application's list-manipulation code

21:01 mindbender1: amalloy: I think I get it. Or we can say why does it even have to be re-ordered in the first instance?

21:01 justin_smith: ,(sorted-set-by #(compare (:a %) (:a %2)) {:a 0 :b 1} {:a 1 :b 3} {:a -1 :b 2})

21:01 clojurebot: #{{:b 2, :a -1} {:b 1, :a 0} {:b 3, :a 1}}

21:01 justin_smith: arrdem: no I have not

21:01 amalloy: sure, if order doesn't matter at all the question is even easier

21:02 justin_smith: super-dangerous there, to use a compare function that doesn't agree with equals

21:03 justin_smith: amalloy: oh, good point

21:03 ,(sorted-set-by #(compare [(:a %) %] [(:a %2) %2]) {:a 0 :b 1} {:a 1 :b 3} {:a -1 :b 2})

21:03 clojurebot: #{{:b 2, :a -1} {:b 1, :a 0} {:b 3, :a 1}}

21:03 amalloy: usually such things are better as a multimap than as a set

21:03 or that

21:04 gfredericks: clojurebot: using a compare function that doesn't agree with equals is super-dangerous

21:04 clojurebot: 'Sea, mhuise.

21:05 amalloy: clojurebot: justin_smith |lives| side by side with danger

21:05 clojurebot: Ik begrijp

21:05 justin_smith: ~using a compare function that doesn't agree with equals

21:05 clojurebot: using a compare function that doesn't agree with equals is super-dangerous

21:06 justin_smith: ~super-dangerous

21:06 gfredericks: ,(into (sorted-set-by #(compare (rem %1 2) (rem %2 2))) (range 6))

21:06 clojurebot: excusez-moi

21:06 #{0 1}

21:06 gfredericks: HUH.

21:06 I did not expect that

21:06 justin_smith: yeah, that was a goof for sure

21:06 amalloy: gfredericks: you expected #{5 6}?

21:06 gfredericks: amalloy: no, logically it's possible for it to keep everything

21:06 isn't it?

21:07 amalloy: gfredericks: not if it uses the compare function you gave it

21:07 gfredericks: it could also check =

21:07 amalloy: gfredericks: it's required not to do that

21:07 gfredericks: who required that?

21:07 amalloy: the Set interface

21:07 dbasch: mindbender1: all you need is for your component to know how to render your elements in order

21:07 amalloy: also Comparator, which says it must impose a total ordering

21:07 dbasch: they don’t need to be in an ordered structure necessarily

21:08 of course it’s more efficient if it’s ordered

21:08 amalloy: there's no way for a total ordering to say "i don't care": it has to say less, greater, or equal

21:08 and if they're equal, then duplicates must be rejected from the set

21:08 gfredericks: ,(parents (class (sorted-set)))

21:08 clojurebot: #{clojure.lang.APersistentSet clojure.lang.Sorted clojure.lang.IObj clojure.lang.Reversible}

21:08 amalloy: ,(supers (class (sorted-set)))

21:08 clojurebot: #{clojure.lang.APersistentSet java.lang.Runnable clojure.lang.IPersistentCollection clojure.lang.Sorted clojure.lang.IObj ...}

21:08 amalloy: &(supers (class (sorted-set)))

21:08 lazybot: ⇒ #{java.util.concurrent.Callable java.util.Collection clojure.lang.IHashEq clojure.lang.IPersistentCollection java.lang.Runnable java.io.Serializable clojure.lang.Reversible clojure.lang.AFn clojure.lang.Seqable clojure.lang.IPersistentSet clojure.lang.IObj clojure.la... https://www.refheap.com/92724

21:09 gfredericks: ,(reduce list (supers (class (sorted-set))))

21:09 clojurebot: ((((((((((# java.util.Set) java.util.Collection) clojure.lang.Counted) clojure.lang.AFn) java.lang.Object) clojure.lang.IMeta) clojure.lang.Seqable) clojure.lang.Reversible) java.util.concurrent.Callable) java.lang.Iterable)

21:09 gfredericks: oh poop

21:09 almost tricked it

21:09 ,(some #{java.util.SortedSet} (supers (class (sorted-set))))

21:09 clojurebot: nil

21:10 gfredericks: does the Set interface say anything about orders or comparators?

21:10 amalloy: gfredericks: i think i was wrong about that

21:10 $javadoc Comparator

21:10 lazybot: Javadoc not found. Try http://docs.oracle.com/javase/6/docs/api/

21:10 amalloy: $javadoc java.lang.Comparator

21:10 c'mon, man

21:11 gfredericks: okay I guess Comparator contract is a good enough reason

21:11 dbasch: gfredericks: no, Set is about no two things being equal

21:11 they don’t need to be comparable

21:11 mindbender1: dbasch: yeah. The insert use case was if a user wanted to drag a component from it's position to another position in it's container or another container entirely. but like amalloy pointed out one has to think critically where the real sense in that lies.

21:12 gfredericks: 'It is generally the case, but not strictly required that (compare(x, y)==0) == (x.equals(y)). Generally speaking, any comparator that violates this condition should clearly indicate this fact. The recommended language is "Note: this comparator imposes orderings that are inconsistent with equals."'

21:12 amalloy: ^

21:12 amalloy: right, but 'If the ordering imposed by c on S is inconsistent with equals, the sorted set (or sorted map) will behave "strangely." In particular the sorted set (or sorted map) will violate the general contract for set (or map), which is defined in terms of equals.'

21:12 so it's not an illegal comparator, but using it causes you to get an illegal set

21:13 or at least one that will surprise you

21:13 dbasch: of course you could also have an illegal set by mutating things after inserting them

21:13 gfredericks: that's strange for the Comparator docs to make claims about what sets do

21:14 dbasch: but a set of mutable things is a really bad idea

21:14 gfredericks: it also claimed a set couldn't contain itself so now I have to try

21:14 ,(let [s (java.util.HashSet.)] (.add s s) s)

21:14 clojurebot: #{#{#{#{#{#{#{#{#{#{#}}}}}}}}}}

21:14 amalloy: hah, did it really?

21:14 gfredericks: "A special case of this prohibition is that it is not permissible for a set to contain itself as an element. "

21:15 TEttinger: ##(let [s (java.util.HashSet.)] (.add s s) s)

21:15 lazybot: ⇒ #<HashSet [(this Collection)]>

21:15 gfredericks: haha

21:15 kenrestivo: everything is permissible

21:15 nathan7: gfredericks: damnit

21:15 gfredericks: &(let [s1 (java.util.HashSet.) s2 (java.util.HashSet.)] (.add s1 s2) (.add s2 s1) s1)

21:15 lazybot: java.lang.StackOverflowError

21:16 gfredericks: ,(let [s1 (java.util.HashSet.) s2 (java.util.HashSet.)] (.add s1 s2) (.add s2 s1) s1)

21:16 clojurebot: #{#{#{#{#{#{#{#{#{#{#}}}}}}}}}}

21:16 gfredericks: ,(let [s1 (java.util.HashSet.) s2 (java.util.HashSet.)] (doto s1 (.add s2) (.add :foo)) (doto s2 (.add s1) (.add :bar)) s1)

21:16 clojurebot: #{#{:bar #{#{:bar #{#{:bar #{#{:bar #{#{:bar #} :foo}} :foo}} :foo}} :foo}} :foo}

21:17 dbasch: by “not permissible” they mean “please dont’ do it"

21:17 don't

21:18 gfredericks: oh no...what happens if they find out?

21:18 dbasch: Oracle might sue you

21:20 gfredericks: ,(into (sorted-set-by (fn [_ _] (- 100 (rand-int 200)))) (range 10))

21:20 clojurebot: #{3 8 9 6 7 ...}

21:20 kenrestivo: i would like oracle to go sue themselves.

21:21 amalloy: it will probably happen accidentally eventually, kenrestivo, if it hasn't already

21:22 kenrestivo: ,(let [oracle-lawsuit (java.util.HashSet.)] (.add oracle-lawsuit oracle-lawsuit) oracle-lawsuit)

21:22 clojurebot: #{#{#{#{#{#{#{#{#{#{#}}}}}}}}}}

21:23 dbasch: in clojure we obey the laws of thermodynamics

21:24 arrdem: oh dear

21:25 * TimMc looks with suspicion at < lazybot> ⇒ #<HashSet [(this Collection)]>

21:25 gfredericks: I also looked suspiciously at it

21:25 I'm betting it's a weird HashSet feature

21:26 arrdem: "feature"

21:27 amalloy: well, having a .toString representation that takes up all available RAM is pretty crap for debuggers and so on

21:28 particularly in a language where there's no better way to look at things than .toString

21:28 so it's nice that HashSet puts in a little effort to avoid that problem

21:28 gfredericks: (inc HashSet) ;; for effort

21:28 lazybot: ⇒ 1

21:32 gfredericks: oh man cljs

21:32 I typo'd "%" as % and all I got was a warning

21:33 nonuby: is there something like -> that bails the first non truthy value it encounters like (or (-> (first args) (Integer/parseInt)) 8080)

21:33 gfredericks: I know that's consistent with everything else it does I just feel unusually let down

21:33 nonuby some->

21:33 arrdem: http://grimoire.arrdem.com/1.6.0/clojure.core/some-%3E

21:33 gfredericks: though that's non-nil I think

21:33 nonuby: sweet! thanks

21:40 arrdem: &(re-matches #"clojure\.((core)|(data)|(edn)|(inspector)|(java)|(main)|(pprint)|(repl)|(set)|(stacktrace)|(template)|(test)|(uuid)|(walk)|(xml)|(zip)).*" "clojure.core/concat")

21:40 lazybot: ⇒ ["clojure.core/concat" "core" "core" nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil]

21:42 arrdem: justin_smith: oneoff https://www.refheap.com/92725

21:42 not my best regex but it'll do

21:45 lazylambda_: folks, is it possible to print a bigint without having that N tagged at the end?. Anyway that doesn't require changing the value to a string first?

21:46 TEttinger: ,(.toString 10N)

21:46 justin_smith: arrdem: cool

21:46 clojurebot: "10"

21:46 TEttinger: ,(.toString 1000000000000000000000000000000N)

21:46 clojurebot: "1000000000000000000000000000000"

21:46 arrdem: justin_smith: better version incomming..

21:46 TEttinger: how's that, lazylambda_?

21:47 arrdem: justin_smith: https://www.refheap.com/92727

21:48 lazylambda_: Tettinger: good enough, thanks

21:48 ,(str "1000000000000000000000000000000000000N")

21:48 clojurebot: "1000000000000000000000000000000000000N"

21:48 lazylambda_: hmm, I thought str calls toString

21:48 arrdem: justin_smith: note that you need to add [org.clojure-gimoire/lib-grimoire "0.2.0"] to your deps for that

21:48 Raynes: $last

21:48 lazybot: Raynes is listening to: Kanye West - Stronger (Explicit) []

21:48 Raynes: justin_smith: You're a special person.

21:48 arrdem: Raynes: 10/10 GUD SONG

21:48 Raynes: You've spent days

21:48 DAYS

21:48 Working on this bot.

21:49 lazylambda_: Raynes: go to bed, Grimey

21:49 Raynes: For no good reason other than the goodness of your heart.

21:49 Mostafa!

21:49 TEttinger: lol

21:49 lazylambda_: :D

21:49 Raynes: We meet again.

21:49 TEttinger: I have done the same, but for other reasons

21:49 mostly people nagging me

21:49 lazylambda_: yes

21:50 arrdem: justin_smith: can you throw that up in here or in -offtopic? I want to kick it for a minute

21:50 TEttinger: lazylambda_, it's not even 7:00 PM here in Raynes' and my timezone

21:50 -social was it?

21:51 arrdem: I've kicked it plenty in ##anyone

21:51 arrdem: TEttinger: there's -social which I no longer lurk, and there's -offtopic which is me, Bronsa, justin and ambrose

21:51 justin_smith: Raynes: aww, shucks

21:51 arrdem: for the most part

21:52 justin_smith: Raynes: it was fun, and we all benefit

21:52 lazylambda_: TEttinger: I know, I was just being retarded

22:07 arrdem: @grim clojure.core/some->

22:12 technomancy: wow. beanshell.org uses comic sans *with* a drop shadow.

22:14 TEttinger: technomancy, that's incredible.

22:15 technomancy: TEttinger: it gets better http://beanshell.org/beany.html

22:16 TEttinger: heavily compressed gifs? http://beanshell.org/images/bshsplash3.gif the background repeats if your monitor is too wide? wow.

22:26 justin_smith: that site has the most awesome design

23:12 j0nii`: I'm trying to figure out the correct way to call protocol

23:12 functions which are defined inline in defrecord forms

23:12 justin_smith: j0nii`: how are you calling them now?

23:13 j0nii`: It seems like (.func record) works but is wrong since it's an

23:13 implementation detail

23:13 well I was doing it like that, then just recently switched to

23:13 using the namespace qualified version

23:13 (ns/func record)

23:13 justin_smith: (proto-ns/proto-method record) should work, where proto-ns is the namespace where the protocol is defined

23:14 j0nii`: ah, that sounds good, because it preserves the polymorphic propertes

23:14 ies

23:14 I guess I've only been thinking of using the record namespace

23:14 justin_smith: right, that way, any implementation of the protocol is called identically

23:14 j0nii`: since the protocol and records are sharing a namespace right now

23:14 justin_smith: got it

23:14 j0nii`: so I shoud fix that :)

23:15 justin_smith: they can be in the same ns, that's fine

23:15 but eventually some instances may not be

23:16 j0nii`: right - so is the defrecord implementation of the proto-fn not exported?

23:16 to clarify, if my record is in a separate ns, will

23:16 record-ns/proto-fn work?

23:16 justin_smith: the proto-fn belongs to the proto

23:16 the record gets a method

23:17 j0nii`: right

23:17 the method isn't exposed as a fn in the record namespace?

23:17 justin_smith: the (.method record) form

23:17 not as I recall, it shouldn't be

23:17 j0nii`: ok, that makes things a lot clearer, thanks

23:17 justin_smith: I'd have to make a few namespaces and check that I guess

23:18 j0nii`: well I can do that myself, and will - I don't mean to task you :)

23:19 j0ni: thanks justin_smith for your help!

23:20 justin_smith: np

23:21 nonuby: slightly OT, when search google for clojure docs on some-> and some->> it seems google strip the -> part, even when quoted, is there a way of googling these things?

23:21 justin_smith: $examples some->

23:21 hmm, oh, yeah, lazybot is too old for that function

23:22 http://grimoire.arrdem.com/ is kept up to date

23:22 http://grimoire.arrdem.com/1.6.0/clojure.core/some-%3E/

23:22 nonuby: justin_smith thanks

23:23 justin_smith: arrdem did all the work :)

23:23 arrdem: justin_smith: doing more work now :P

23:24 nonuby: arrdem, thanks, btw the offline version link is dead, are you aware?

23:24 arrdem: https://github.com/clojure-grimoire/grimoire/issues/131

23:24 feel free to comment if it's something you'd like

23:24 Grimoire 0.3.9 can be cloned and run locally

23:25 all versions of Grimoire can be run locally

23:25 0.4.0 will go one better, but that's not done yet :P

23:25 the "static HTML snapshot" thing was slow to build and seldom used accoring to my logs so it's been dropped

23:25 feel free to comment on that issue if you want it tho

23:26 nonuby: thanks, ill try running it locally first

23:30 jcsims: any idea why environ might be failing to pick up either of the recommended var forms in an uberjar?

23:31 i.e either an env variable or a java system property

23:47 bbloom: hyPiRion: you should put dates on your blog posts :-)

23:52 sm0ke: need a little with a macro i am trying to write which given a integer returns a function with same arity

23:52 i have come up with the following but it doesn not work for no constants

23:52 https://www.refheap.com/92734

23:52 little help*

23:55 arrdem: dear clojure.parallel go away nobody likes you

23:55 justin_smith: got it for real this time :D

23:56 justin_smith: lein grim can now document arbitrary artifacts off of the classpath

23:56 justin_smith: nice

23:57 sm0ke: I am not sure, I think this has to do with some interaction between the let macro and your own definition

23:58 sm0ke: justin_smith: actually if you expand it you will get num cannot be cast from symbol

23:58 which makes sense

23:59 but i am not sure how to resolve it

23:59 justin_smith: sm0ke: that is because a is a symbol

23:59 arrdem: thehell...

23:59 justin_smith: and that happens because of the let macro, I think

23:59 arrdem: why is clojure.parallel not listed here

23:59 http://clojure.github.io/clojure/

23:59 totally part of "stock" clojure

Logging service provided by n01se.net