#clojure log - Nov 18 2014

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

0:03 fairuz1: Ok, seems I'm getting a hang of the piece of code you gave just now :)

0:09 justin_smith: this is difficult stuff :)

4:01 zarkone: hello all! Please, give me aquick explanation or link why " cond requires an even number of forms"

4:02 andyf: zarkone: Because it is always (cond <test1> <result1> <test2> <result2> ...)

4:02 every test must have a corresponding result

4:02 zarkone: andyf: oh, seeems like i write clauses wrong, thanks!

4:02 justin_smith: zarkone: for a default form, you can provide a truthy test

4:03 ,(cond false 0 nil 1 :default 2)

4:03 clojurebot: 2

4:03 justin_smith: ,(cond false 0 nil 1 :foo 2)

4:03 clojurebot: 2

4:03 justin_smith: anything works there, but :default is considered standard

4:04 zarkone: thanks all, im stupid, should look at docs next time. I just wrote it like in CL

4:04 andyf: justin_smith: I think :else is somewhat more common than :default, but I've seen both used, and even true

4:04 justin_smith: zarkone: it took me a long time to stop trying to write CL style let :)

4:04 andyf: definitely

4:05 andyf: zarkone: clojuredocs.org is pretty decent for examples, in addition to the built-in doc strings.

4:05 justin_smith: ,(cond false 0 nil 1 0 2) ; if you want to mess with the C programmers

4:05 clojurebot: 2

4:06 zarkone: andyf: thanks, i use docstring in emacs like C-c C-d d, very convinient. Like other things in CIDER

4:16 justin_smith: ,(cond false 0 nil 1 () 2) ; if you want to mess with the lispers

4:16 clojurebot: 2

4:32 rurumate: ,(quote 'a)

4:32 clojurebot: (quote a)

4:32 rurumate: ,(#(quote %) 'a)

4:32 clojurebot: p1__49#

4:33 rurumate: ,(quote 'a)

4:33 clojurebot: (quote a)

4:34 rurumate: uhm

4:34 what seems to be the problem here?

4:34 ,(quote 'a)

4:34 clojurebot: (quote a)

4:34 justin_smith: what's the problem? that's what quote does

4:34 ,''a

4:34 clojurebot: (quote a)

4:34 rurumate: that returns a in my repl, not (quote a)

4:34 andyf: quote is a special form, not a function

4:35 justin_smith: ,(quote a)

4:35 clojurebot: a

4:35 hyPiRion: ,'#(quote %)

4:35 clojurebot: (fn* [p1__172#] (quote p1__172#))

4:40 rurumate: ,''a

4:40 clojurebot: (quote a)

4:41 clgv: rurumate: one quote is "completed" during `eval`

4:42 rurumate: ,'''a

4:42 clojurebot: (quote (quote a))

4:42 clgv: (eval (quote x)) -> x

4:43 for all x ;)

4:44 rurumate: do you want a function that returns quoted forms?

4:44 ,((fn [x] `(quote ~x)) 'b)

4:44 clojurebot: (quote b)

4:46 fairuz1: hey justin_smith. Just want to say thanks. I think I make it work. :)

4:46 justin_smith: very cool

4:51 fairuz1: indeed

4:53 rurumate: clgv: splendid, thanks!

4:54 clgv: rurumate: that one is tricky. I think I rediscovered it at least twice in the last two years ;)

5:02 dysfun: i'm having a very bizarre error. wrap-session is causing a nullpointerexception to be thrown. commenting it out works fine, trying it in the repl, it appears to do the right thing. any ideas?

5:03 justin_smith: dysfun: do you have a cookie from the same host, but a different app, such that different keys are stored in the cookie?

5:03 dysfun: no

5:04 justin_smith: I have run into that one before... really weird bug

5:04 (ie. the app only breaks on one guy's browser...)

5:05 dysfun: only cookies are ones i'm expecting to see

5:05 justin_smith: with the expected contents?

5:05 dysfun: there's only one related to ring, csrftoken

5:06 the session isn't being set, so there's no session cookie at all

5:06 justin_smith: what specific call or operation in wrap-session is getting the npe?

5:07 dysfun: heh, you don't think it gave me any such useful information do you?

5:07 justin_smith: so the stack stopped at wrap-session?

5:08 dysfun: it appears to come from the preceding middleware, keyword-params

5:09 wrap-session is invoked thus : (wrap-session f {:store (cookie-store)})

5:11 from the missing stacktrace line, it sounds like wrap-session is returning nil, effectively

5:11 justin_smith: dysfun: there are libs (including groundhog, which I wrote) that can serialize a ring request to a data literal, such that you can load or inline the data literal in a unit test, and narrow down which middleware is breaking (and sometimes, which parts of the request make it break)

5:12 dysfun: ooh, groundhog looks nice

5:13 i have some interesting ideas for using that for some other things

5:13 justin_smith: I've found it useful for narrowing down issues in ring handlers / middleware

5:31 dysfun: justin_smith: so i've wrapped groundhog, and i still get my NPE. and no useful output?

5:32 those have presumably been stored somewhere?

5:32 justin_smith: dysfun: the idea is that with the serialized request you have a few options: write unit tests that run that request against your handler (the ring server need not be running) or modify and replay until you figure out the minimal cause of the error

5:33 * dysfun hooks it into timbre

5:33 rurumate: ,(type (quote []))

5:33 clojurebot: clojure.lang.PersistentVector

5:34 rurumate: ,(type (quote '[]))

5:34 clojurebot: clojure.lang.PersistentList

5:34 rurumate: how does that become a list?

5:34 justin_smith: ,(quote '[])

5:34 clojurebot: (quote [])

5:34 justin_smith: that's a list

5:35 hyPiRion: list with the symbol quote and the vector []

5:35 rurumate: ,(first (quote '[]))

5:35 clojurebot: quote

5:35 rurumate: ,(first (quote []))

5:35 clojurebot: nil

5:36 dysfun: ,(= ''[] '(quote []))

5:36 clojurebot: true

5:37 rurumate: (= '(quote []) (quote '[]))

5:37 ,(= '(quote []) (quote '[]))

5:37 clojurebot: true

5:37 dysfun: ' is a reader macro that is expanded into (quote )

5:38 clgv: ,(read-string "'[]")

5:38 clojurebot: (quote [])

5:38 dysfun: i'd like to see some sort of source mapping in metadata for the reader one day

5:46 clgv: dysfun: what is that supposed to mean?

5:46 dysfun: there is :line and :col metadata for lists in clojure

5:47 sadly not for the other literals...

5:48 dysfun: no, i'd like to map reader macro expansion back to original syntax

5:49 so you'd be able to distinguish for example between (quote ...) and '

5:49 i'd also like to track it for "real" macro expansion

5:49 but it's nontrivial and i haven't thought of a good enough use case for it yet to tempt me

5:51 clgv: dysfun: ah ok. sounds interesting for macro expansion

5:51 dysfun: I have an algorithm DSL were it would be really handy

5:52 dysfun: *nod*

5:52 there are some interesting things i think you can do, but not interesting enough to warrant the time investment. yet.

5:54 clgv: dysfun: yeah, if you do not need it often, it's probably not worth investing time in it

5:55 dysfun: but i might come up with a really cool use case and do it at some point

5:55 i also need to go play with that llvm clojure-alike i saw on twitter yesterday

6:00 RobT-: Have you seen these resources yet? clojure.zeef.com

6:05 engblom: I'm able to write macros but not able to detect situations where a macro would do things easier than writing several functions. What material do you recommend for me to read?

6:06 justin_smith: engblom: macros are for syntax

6:07 use them when you need to create a syntax

6:07 for example if there is something you frequently do in your code, that is clumsy to express

6:08 look at what the major macros in clojure are: defn, let, for, loop

6:08 engblom: justin_smith: Thanks

6:28 dysfun: justin_smith: the ring-session thingy was actually my mistake. amusingly i'd forgotten a paren and so it was doing a hash lookup -> nil -> NPE

6:28 justin_smith: nice

6:30 dysfun: times like these i wonder if paredit might help

6:34 justin_smith: it does

6:34 as do rainbo parens

6:34 *rainbow

6:36 dysfun: i use rainbow-parens

6:36 Bronsa: I could never use rainbow parens

6:36 dysfun: $flatmate has suggested whitespace-mode might help if configured better

6:37 er show-paren-mode even, you can change backgrounds of sexps apparently

6:37 Bronsa: OTOH I love show-paren

6:37 jinx

6:40 clgv: dysfun: which?

6:41 engblom: when you want efficient calculations with longs and floats in a reduce-like syntax, you'll need a macro

6:41 engblom: efficient in the sense that you need to keep unboxed floats and longs

6:44 s/floats/doubles ;)

6:44 engblom: clgv: Could you give a short example of what you mean?

6:46 clgv: engblom: there is no way to use reduce to calculate more than one long/double result value without boxing

6:47 engblom: a general example are statistic values aggregate over a collection of entities

6:49 dysfun: clgv: the idea is that you can change the background colour of the entire paren-delimited sexp based on nesting level

6:50 clgv: dysfun: damn, I should have added context - I meant the llvm clojure-alike (didnt see that you wrote sth else after that)

7:00 dysfun: clgv: there's more than one?

7:01 i just saw it go by on twitter, had a look at the github page. let me see if i can find it

7:02 clgv: no, but I am not on twitter - I don't know how easy it is to find the correct one ;)

7:02 dysfun: rhine

7:02 https://github.com/artagnon/rhine

7:02 clgv: hmm "clojure-inspired" - let's remove the "-inspired" ;)

7:03 dysfun: on the face of it, it looks like clojure

7:03 but the reason it piqued my interest is i have an interest in getting clojure working on llvm

7:03 and frankly vmkit is unlikely to happen now. would be awesome if it did though

7:04 clgv: "vmkit" is the oracle project?

7:04 dysfun: no, vmkit is the jvm/clr-on-llvm project

7:04 i did think about taking it over, but it's starting to look like real work

7:04 clgv: is that just a nickname you gave it?

7:04 dysfun: no, it's called vmkit

7:05 http://llvm.org/viewvc/llvm-project/vmkit/

7:05 http://vmkit.llvm.org/

7:06 it's abandoned (hence my talk of possibly resurrecting it)

7:06 clgv: those other language/vm projects (not jvm, clr and js) always lost their devs. would be awesome if one of the llvm approaches is continually developed

7:06 dysfun: but i have way too much stuff on to do something like that. i think clojure on llvm might be much easier

7:06 haha. i tried to port perl to the jvm back in the day

7:06 that was fun for a while

7:07 clgv: with efficient C/C++ interop there'd be no reason to start a project in C/C++ anymore ;)

7:08 dysfun: quite

7:08 and it's an interesting project. if it's not too tedious it might even keep my attention

7:08 justin_smith: clgv: with efficient C/C++ interop we'd lose a bunch of the guarantees that make clojure nice to use, wouldn't we?

7:09 dysfun: justin_smith: not necessarily. you can model a lot of it in terms of clojure things, like a derefable

7:09 clgv: justin_smith: well you use a lot of guarantees with java interop as well ;)

7:09 justin_smith: clgv: fair point on that if by use you mean lose

7:10 clgv: justin_smith: oops right

7:10 justin_smith: rhyming typos are a bane for me as well

7:10 clgv: is that a general thing for non-native speakers?

7:10 justin_smith: I'm a native speaker, and I do it all the time

7:10 dysfun: words that noone is quite sure how to spell are a good one

7:11 clgv: oh ok. well then probably not ;)

7:11 justin_smith: I did not notice that in my mother tongue so far...

7:11 dysfun: $previous_client had a 'remuneration' table that annoyed a few of the developers rather too much

7:11 clgv: :D

7:11 justin_smith: haha

7:12 dysfun: er, 'renumeration'. see, my brain automatically corrected it

7:12 clgv: ?

7:12 justin_smith: oh, I thought you meant the problem was that the var was misspelled - that's even worse

7:12 when a misspelling becomes canonical in the codebase...

7:12 dysfun: yeah

7:12 and it was, because database classes were generated from the db schema

7:13 and you'd constantly mistype them. handily the codebase was in perl so you'd at least get a compile time error because strict;

7:14 clgv: "real perl hackers don't use strict" :P

7:14 dysfun: in that case, i've worked with a few "real perl hackers"

7:14 (sadly)

7:15 but less perl hate please.

7:15 clgv: I have seen those hashsums which were supposed to be programs from fellow students ;)

7:16 dysfun: yes. it's never taught properly. on the other hand, i've had quite a lot of joy programming modern perl in the last few years and have produced clean and elegant code

7:16 the reputation is ill-deserved and it's because back in the day it was the only option unless you were insane and so it caught the idiots that now plague php because php wasn't popular

7:17 clgv: it wasn't taught at all at university. they just learned it on there own and found "non-strict" perl that good to use it in most of the exercises ;)

7:17 dysfun: Matt's Script Archive was a bugger for that. to the point that one of the london perl mongers rewrote all of them in cleaner perl that actually understood basic security

7:18 it was still ugly old style perl, but at least they weren't hurrendously insecure

7:22 clgv: dysfun: I only used perl once since they had a nice webpage crawler library

7:29 dysfun: WWW::Mechanize? Yes, I'm very fond of it

7:29 but i found it really hard after programming mostly clojure for 3 months to go back to dealing with mutable data

7:30 even though my perl is tinged with lots of functional idiom anyway

7:31 i'd love to see what advice rich hickey would give the perl 5 porters if asked about how to improve perl as a language

7:31 Ember-: I know the answer

7:32 "dump mutability, embrace immutability"

7:32 dysfun: you'd be surprised how little you actually use mutability in perl

7:32 quite a lot of things tend to be chaining of lists through function calls

7:33 Ember-: you can do that in every language :)

7:33 more or less

7:33 dysfun: and yes, we did sort of implement a macro system for perl. and yes i know it's a silly complicated language

7:33 Ember-: hehe

7:34 dysfun: there are even battle tested libraries using it to transform code into something resembling more familiar syntax

7:34 implementing try/catch for example

7:34 (although Try::Tiny fakes it well enough, except that return() behaves wrongly

7:35 clgv: yes mechanize sounds about right. nowadays, I'd just use Clojure for that task

7:35 dysfun: i haven't found a DOM manipulation library that i like

7:35 and there's a Mechanize wrapper that uses HTML::Tree which has a quite nice interface, so i'd use perl

7:40 i'm a little confused about how compojure works. I see in all the examples (which i've been liberally copying and pasting from) that they setup routes like so: http://paste.scsys.co.uk/443138 . But i'm not sure of the flow order

7:40 i see that route/not-found is just a simple function call?

7:40 how does that work? does the previous entry return nil if it doesn't match or something?

7:41 or is it doing wrapping magic?

7:41 weavejester: dysfun: There should be an explanation on the Compojure wiki

7:41 dysfun: if there is, i haven't found it :(

7:43 weavejester: dysfun: The “routes in detail” section should explain it, but perhaps it isn’t clear enough…

7:43 dysfun: Essentially routes are handler functions that can return nil

7:43 dysfun: The `routes` function tries each handler function in order until it gets a non-nil response

7:44 dysfun: aha. brilliant, thanks.

7:44 Ember-: simple and brilliant

7:44 dysfun: shall i update the wiki?

7:44 Ember-: makes many things so easy

7:47 weavejester: dysfun: If you like. The “routes in detail” page does mention that routes return nil or a response, but the information is spread across the page, and there’s no mention of what the compojure.core/routes function does.

7:47 dysfun: So maybe an extra paragraph at the beginning would work

7:47 dysfun: yeah, i didn't link them when i read it

7:49 weavejester: Re-reading that page again, it could be a lot clearer on the overview about how Compojure uses routes.

7:50 dysfun: i'm editing now

7:51 clgv: reduce-kv works on arbitrary maps not only clojure hashmaps, right?

7:51 weavejester: dysfun: I also wrote a blog entry on the design of routes: http://www.booleanknot.com/blog/2012/09/18/routing-in-compojure.html

7:53 clgv: hm no, it does not ...

7:53 you have to extend the corresponding protocol

7:53 edw: ping

8:03 dysfun: weavejester: https://github.com/weavejester/compojure/wiki/Routes-In-Detail ta-da!

8:04 weavejester: dysfun: Thanks! I’ll tweak it a little though, as I’d prefer `routes` to be introduced first.

8:04 dysfun: of course. documentation is hard :)

8:05 of course now i understand what's going on, i find i like compojure just that little bit more

8:09 weavejester: dysfun: That’s a good sign :)

8:09 dysfun: :)

8:12 H4ns: is anyone aware of a clojure ftp+ssl client library? i have found miner.ftp, but that does not seem to support ssl right away.

8:18 clgv: H4ns: maybe you can inject javas SSLSockets via a factory

8:20 H4ns: clgv: sounds like something that is beyond my level of java expertise. i'll try using org.apache.commons.net.ftp.FTPSClient directly

8:24 clgv: H4ns: sounds reasonable as well. I have no idea how much that miner.ftp provides you anyway

8:25 H4ns: a pattern in java network programming is to have socket factory classes that construct the sockets to use - this way you can exchange a plain socket with ssl sockets for example

8:25 H4ns: clgv: it seems to rely on the java infrastructure to parse the url and then instantiates an FTPClient. It may not be too hard to change that so it can deal with ftps:// in addition to ftp://

8:26 clgv: i'll have to understand how protocols are registered so that clojure.java.io/as-url understands them.

8:28 justin_smith: ,(.getScheme (java.net.URI. "ftps://foo"))

8:28 clojurebot: "ftps"

8:29 justin_smith: dunno if that means much actually...

8:29 ,(.getScheme (java.net.URI. "foo://foo"))

8:29 clojurebot: "foo"

8:29 justin_smith: yeah, probably doesn't mean much

8:29 H4ns: "MalformedURLException unknown protocol: ftps"

8:29 clgv: ,(require '[clojure.java.io :as io])

8:29 clojurebot: nil

8:30 clgv: ,(io/as-url "ftps://www.bla.com/lala.pdf")

8:30 clojurebot: #<MalformedURLException java.net.MalformedURLException: denied>

8:30 justin_smith: $source clojure.java.io/as-url

8:30 lazybot: Source not found.

8:30 justin_smith: :P

8:30 clgv: interesting

8:30 ,(io/as-url "ftp://www.bla.com/lala.pdf")

8:30 clojurebot: #<MalformedURLException java.net.MalformedURLException: denied>

8:30 * clgv can't specify proper URLs

8:31 justin_smith: https://github.com/clojure/clojure/blob/master/src/clj/clojure/java/io.clj#L35

8:31 clgv: so on to the javadocs of URL ;)

8:32 justin_smith: &(URL. "ftp://www.bla.com/lala.pdf")

8:32 lazybot: java.lang.IllegalArgumentException: Unable to resolve classname: URL

8:32 llasram: Java URLs are explicitly resource "locators", which means there needs to be a (Java-)registered handler for the scheme which supports retrieval of a representation of the resource

8:32 justin_smith: &(java.net.URL. "ftp://www.bla.com/lala.pdf")

8:32 lazybot: ⇒ #<URL ftp://www.bla.com/lala.pdf>

8:32 llasram: I thought

8:32 TimMc: j.n.URL and j.n.URI are the worst

8:32 llasram: URI is fine

8:32 TimMc: eh

8:33 soulman_: hi

8:33 justin_smith: is it URL which can be side-effecting and unexpectedly load some network resource just in being created?

8:33 llasram: yes

8:34 justin_smith: I remember something like this that surprised and annoyed me

8:34 so why and what does it load exactly?

8:34 TimMc: llasram: OK, j.n.URL is clearly the worst; j.n.URI has some serious problems.

8:34 llasram: They resolve the hostname to an IP address

8:34 (j.n.URLs do)

8:34 justin_smith: AHH

8:34 llasram: And use the IP address in the hash

8:34 justin_smith: that's messed up

8:34 llasram: Yeeees

8:35 TimMc: If anyone wants to help hack on a URL library: https://github.com/brightcove/johnny

8:38 justin_smith: ##(= (java.net.URL. "http://www.example.net/&quot;) (java.net.URL. "http://www.example.com/&quot;))

8:38 lazybot: ⇒ false

8:38 tmarsh: any lighttable users know how to disable “remove trailing whitespace” on save?

8:38 TimMc: hmmm

8:38 &(= (java.net.URL. "http://example.net/&quot;) (java.net.URL. "http://example.com/&quot;))

8:38 lazybot: ⇒ false

8:39 llasram: TimMc: Are those equal for you locally?

8:39 jonathanj: how do things like Korma or Hyperion perform their queries? are they synchronous?

8:39 if i'm performing queries in a ring handler do i have to worry about blocking?

8:39 justin_smith: TimMc: returns true locally, oracle jdk 8

8:39 ,(clojure-version)

8:39 clojurebot: "1.7.0-master-SNAPSHOT"

8:39 TimMc: llasram: I've had that (or .equals) return true.

8:40 justin_smith: llasram: can verify

8:40 TimMc: Oh! lazybot is blocking the network lookup, I bet.

8:40 justin_smith: oh, yeah, sandbax magik

8:40 TimMc: ,(.equals (java.net.URL. "http://example.net/&quot;) (java.net.URL. "http://example.com/&quot;))

8:40 clojurebot: #<MalformedURLException java.net.MalformedURLException: denied>

8:40 llasram: Heh

8:40 kungi: Can I prevent leiningen from running my test fixtures when I spcify a specific test-selector?

8:40 TimMc: ,(.printStackTrace *e)

8:40 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: printStackTrace for class clojure.lang.Var$Unbound>

8:40 TimMc: :-P

8:40 kungi: When I run lein test :unit it still runs the :once fixture from my integration tests

8:40 justin_smith: kungi: I bet you could, but I don't think it would be worth the effort it would take

8:41 clgv: TimMc: clojurebot is not a repl ;)

8:41 TimMc: nonsense :-)

8:41 wiruzx: (+ 2 2)

8:41 clojurebot: 4

8:41 wiruzx: heh

8:42 llasram: `true` here too. That's actually even crazier behavior than I thought it had

8:42 kungi: justin_smith: my integration tests take a long time to start because they start a firefox with selenium stuff. So It would really make sense to exclude this fixture.

8:42 justin_smith: kungi: put them in a different namespace

8:43 clgv: kungi: isnt there selection by metadata?

8:43 justin_smith: clgv: that does not effect a :once fixture

8:43 kungi: clgv: Yes but only for the tests

8:43 justin_smith: clgv: that is just a fixture that decides which tests get called iirc

8:43 clgv: skip using the fixture and just explicitely wrap those test with robert.hooke?

8:44 justin_smith: I think putting unit tests and integration tests in different namespaces is the right thing to do anyway

8:44 clgv: justin_smith: true

8:44 justin_smith: if they aren't in the same namespace, the fixture isn't an issue

8:45 notofi: Hi, what is the idiomatic way to assoc something to a core.cache ? https://github.com/clojure/core.cache/wiki/Using says that the has?/hit/miss pattern should be used, what If I just want to call assoc on a cache ?

8:45 kungi: justin_smith: so I should use project-name.unit.test-1 and project-name.integration.test-1 as namespaces

8:46 justin_smith: kungi: yeah, that would be how I would do it, or maybe project-name.my-ns-unit and project-name.my-ns-integration

8:46 clgv: kungi: and the lein aliases :D

8:48 mavbozo: jonathanj: yes, the query blocks the thread

8:51 justin_smith: well, they will block the thread handling that request, which slows down your response, but it won't block other response threads

8:51 jonathanj: presumably casually creating a thread for every request is not a terribly good design

8:52 justin_smith: jonathanj: it's a thread pool

8:52 jonathanj: the lib is doing it for you

8:52 jonathanj: how do i create a thread? (thread)?

8:52 justin_smith: yeah, or (future)

8:52 but you don't need to in this case

8:52 jonathanj: i found this: https://groups.google.com/d/msg/clojure/Aj2njGQtPN0/PMVOigU2fDAJ

8:53 justin_smith: how so?

8:53 justin_smith: jonathanj: your server creates a thread pool, and your handler is run in one of the threads

8:54 go blocks are another beast entirely

8:54 rurumate: How do I map with a macro? Can't take value of a macro. Is there a way around it?

8:54 justin_smith: rurumate: call the macro inside a function

8:54 dysfun: #()

8:54 rurumate: hmm

8:55 TimMc: rurumate: In the general case, no.

8:55 justin_smith: ,(map #(and % %2) [1 2 nil] [3 4 5])

8:55 clojurebot: (3 4 nil)

8:55 justin_smith: and is a macro

8:56 TimMc: and/or are interesting because they can be used for control flow or for logical-boolean computations (or both).

8:56 kungi: clgv: Lein aliases?

8:57 clgv: kungi: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L204

9:02 justin_smith: jonathanj: to elaborate, notice he says "io should not be done inside a go block" - a requestion handler is the middle piece between two IO operations, that's what this particular thread pool is meant for

9:02 TimMc: rurumate: This is why macros are to be avoided unless necessary.

9:12 clgv: how do you define overloads in `definterface`

9:12 all arities in one method declaration?

9:14 seems to be one by one

9:17 different topic: are inliner with different arities possible? e.g. {:inline (fn ([x] ...) ([x y] ...))}

9:17 Bronsa: yup

9:18 +/-/* etc do that for example

9:21 clgv: Bronsa: ok, it was not the inliner arity but a strange reflection warning. it disappeared after lein clean and repl restart ... O_o

9:22 Bronsa: does `definterface` have `defonce` semantic?

9:24 Bronsa: don't think so

9:26 clgv: *.class files prevail over dynamic definterface on repl?

9:27 irctc: if I have a lein profile :my-profile which defines resource-paths and I run "lein with-profile my-profile uberjar", shouldn't the resources be included in the jar, even if I also have a :uberjar profile

9:28 for some reason the resources are not included

9:28 mmitchell: day 2 of trying to get a simple gen-class annotation to work :/ The clojure docs say annotations work, so I believe it! But I need to add a simple (@Stage), non-java.lang annotation, and that doesn't seem to work. Any Java + Clojure gurus here that could help shed some light on this?

9:29 clgv: mmitchell: which docs say that this will work? and why didnt you just write the class in java as adviced? ;)

9:30 mmitchell: clgv: I knew you were going to bust me on that :)

9:30 OK not "docs", but here in the clojure source/example: https://github.com/clojure/clojure/blob/master/test/clojure/test_clojure/genclass/examples.clj#L34

9:30 justin_smith: mmitchell: "simple", "gen-class" - does not compute

9:31 mmitchell: yeah, seriously

9:31 clgv: mmitchell: is there any test querying that class and the supposed annotations?

9:32 ah that test is in a comment

9:32 mmitchell: did you try whether that test can pass ?

9:32 justin_smith: mmitchell: did you see this? https://gist.github.com/richhickey/377213

9:32 comes from a reputable source :)

9:32 mmitchell: clgv: no I haven't tried that yet

9:32 clgv: mmitchell: but hey, about how many classes are we talking?

9:32 mmitchell: justin_smith: cool will read

9:32 clgv: just 1

9:33 justin_smith: looks like annotations in clojure don't use @

9:33 clgv: mmitchell: well then just write it in plain java, everything else is wasting time ;)

9:34 except for a learning exercise, but even then... well you learned to love gen-class right?

9:34 mmitchell: yes :)

9:35 justin_smith: clgv: we should petition to rename gen-class to generate-class-in-the-most-difficult-and-complex-manner

9:35 black_13: can clojure be used with eclipse

9:35 clgv: justin_smith: haha :P

9:35 mmitchell: it was partially learning (it's a side project) but also was hoping to show a few java colleagues that clojure is an alternative, but better to just get things moving forward

9:35 black_13: from what google says "yes"

9:35 justin_smith: black_13: yes, there is the counterclockwise plugin

9:35 clgv: justin_smith: we just need reify-class and be done with it ;)

9:35 justin_smith: haha

9:36 clgv: there is actually a ticket for it

9:36 justin_smith: mmitchell: as you see in that gist, you can do annotations, and class creation (via deftype) without gen-class

9:36 mmitchell: justin_smith: yeah reading that now, i'll give that a shot

9:36 justin_smith: gen-class is typically the hard way, and only worth trying if other options fail

9:37 clgv: justin_smith: undocumented feature, yay. going to break without announcement

9:38 justin_smith: clgv: so do you think that gist indicates that annotations are inferred from metadata, or that metadata is implemented via the annotation mechanism?

9:38 clgv: justin_smith: the compiler infers it from metadata

9:39 justin_smith: cool

9:39 clgv: justin_smith: if it does, I have not tested any of it

9:39 metadata itself is directly implemented in clojures java implementation

9:39 justin_smith: clgv: OK, so it's definitely not using annotation

9:40 clgv: justin_smith: primitive types long and double are also possible for deftype fields

9:40 same principle

9:41 mmitchell: justin_smith: ahh, but my class must extend from another (java class) so I don't think deftype will work?

9:41 justin_smith: mmitchell: than maybe proxy would work

9:41 *then

9:42 mmitchell: justin_smith: can you use proxy and export a named class somehow?

9:43 justin_smith: hmm...

9:43 now you may be in gen-class territory, sadly

9:43 mmitchell: rats

9:43 justin_smith: this interop code for putting annotations on things does not look to bad https://github.com/richhickey/clojure/commit/fa899d22dceb531d9f5af833ac6af0d956e6bdc7#diff-d951a5cd799ae841ffcc6b45598180dbR3846

9:48 llasram: mmitchell: My experience is that Java is a pretty decent DSL for defining Java classes

9:48 mmitchell: llasram: and do you then call clojure from your java classes? Or just go with java all the way?

9:48 llasram: And that the path of least resistence if you you need concrete classes esp with annotions is to create a small Java class which can trampoline into abritrary Clojure code via a passed-in IFn

9:48 The former

9:49 mmitchell: interesting

9:50 llasram: so your java class imports clojure-based classes, then calls methods on instances of the clojure class? Or something different?

9:50 clgv: mmitchell: so back again - write it in java ;)

9:50 mmitchell: ha yes :)

9:50 clgv: you can use the official clojure api to get hold of your functions

9:50 mmitchell: definitely learning something from this@

9:50 llasram: mmitchell: The former, exactly. Clojure 1.6 even introduced an official public Java API

9:50 https://github.com/clojure/clojure/blob/master/changes.md#21-java-api

9:50 mmitchell: oh?

9:50 clgv: is that what you mean ^^ ?

9:51 clgv: mmitchell: yes.

9:51 mmitchell: awesome, reading now

9:52 justin_smith: this is what people refer to as "making a shim class", right?

9:52 llasram: An instance of it, certainly

9:52 clgv: justin_smith: heard it in that context yes

9:52 justin_smith: where the class is only just enough to have the properties the java code demands of it, and everything else is just calls to clojure stuff

9:52 clgv: in some datomic talk that was a topic, afair

9:53 justin_smith: we could call it "inverse proxy" in contrast to clojure's "proxy" ;)

9:53 llasram: Yeah, rhickey had a short impromptu lightning talk where he talked about that approach in terms of Datomic for the Java API it exposes

9:54 mmitchell: This class was supporting Clojure 1.5.1 so doesn't use the explicit 1.6+ API yet, but is an example of the basic approach: https://github.com/damballa/parkour/blob/master/src/java/parkour/hadoop/Partitioner.java

9:55 mmitchell: llasram: nice, that makes sense. Going to give it a go now

9:57 llasram: One thing which may be non-obvious there is pushing the vars into a static nested class which are `require`d in a static initializer. I think it's going to be fixed in Clojure 1.7, but right now Clojure can be overly aggressive about initializing referenced classes

9:57 clgv: llasram: writing such a class feels like playing clojure compiler ;)

9:58 llasram: Pushing the vars into a separate class defers the `require` until they are actually needed, which can simplify cases where you'd otherwise have a recursive dependency

9:58 clgv: llasram: ah you mean when clojure imports that class as well?

10:00 llasram: clgv: A tiny bit. This case would probably work mostly-okay with `gen-class` and AOT, but AOT isn't an option for libraries

10:01 Yep, to configure Hadoop jobs to use the class, need to mention it in Clojure code doing the configuration

10:02 clgv: llasram: so in principle the problem is some kind of circular dependency between the Clojure ns using the class and implementing the used functions and the class itself

10:11 llasram: clgv: Exactly. And in principle you could avoid that by never mentioning the class in the namespace implementing its functionality, but I've found that to be that a pretty hand-tying contstraint in practice

10:17 clgv: llasram: ok. I haven't done that kind of interop so far

10:34 EvanR: so, jargon question. wtf is "decomplected"

10:35 sounds cromulent

10:36 mgaare: EvanR: Rich Hickey talks about it here http://www.infoq.com/presentations/Simple-Made-Easy

10:37 EvanR: "complect" means to tie or braid together. decomplect means to pull apart. It's part of a design philosophy which aims to take the different elements and concerns in a system and not intertwine them

10:39 EvanR: noted

10:44 black_13: justin_smith: i have installed the conterclockwise plugin however every time i create a new project i get the error "connection reset Reason: Exception while creating new project"

10:46 mishok13: hey

10:47 having a bit of a trouble with writing a macro that should generate functions

10:47 https://gist.github.com/mishok13/d66156a6bf45f83c7247

10:48 basically, I'ld like fnk-creator to behave the same way regardless of whether it was a map literal passed to it or a var

10:49 stuartsierra: mishok13: You can't do that without evaluating the Var.

10:50 `eval` would work, or `(var-get (resolve symbol))`

10:51 Bronsa: is there any difference between var-get and deref on a Var I'm not aware of?

10:52 mishok13: stuartsierra: i'm confused as to where would I eval?

10:52 stuartsierra: Bronsa: Oh, I think I meant var-get.

10:52 I mean deref.

10:52 sheesh

10:53 mishok13: Your macro would have to eval `args`

10:53 Bronsa: it seems like var-get might be slightly faster than deref for non dynamic vars?

10:53 stuartsierra: I think var-get was intended for use in `with-local-vars`

10:54 `deref` is the standard way to get the value bound to a Var.

10:56 Bronsa: they seem to behave exactly the same

10:56 mishok13: stuartsierra: seems to have done the trick

10:56 cheers

10:56 Bronsa: meh, I'll just keep ignoring var-get/var-set then

10:59 RobT-: Nice clojure resources https://clojure.zeef.com/vlad.bokov

11:01 Bronsa: technomancy: it's the second time today that RobT- joins, spams that site and leaves

11:02 technomancy: I'd say if he does it a third time he shouldn't get to do it a fourth

11:09 bja: who are these top analyts? what are their credentials?

11:10 s/analyts/analysts/

11:10 clgv: bja: ask technomancy he seems to be their pr guy ;)

11:13 technomancy: Bronsa: just let me know; in a pm if need be

11:13 the_frey: does anybody else have the issue that cider often starts and then dies with an end of process buffer error, but always works the second time you start it?

11:13 technomancy: also: someone who talks with rich should get him to appoint another op

11:13 the_frey: I'm pretty new to emacs so assuming I've set something up wrong...

11:14 technomancy: tbaldridge, stuartsierra: ^ east coast ops would be a good idea, just sayin'

11:14 stuartsierra: technomancy: yeah. Are you the only op?

11:15 the_frey: yes, frequently

11:15 technomancy: stuartsierra: apart from rich and chouser, who I haven't seen on in over a year

11:16 stuartsierra: technomancy: Yeah, I'll try to remember for after the Conj. I could do it, maybe puredanger.

11:18 the_frey: stuartsierra ah okay, is it just one of those things that happens from time to time then?

11:20 stuartsierra: the_frey: Beats me. I don't expect consistent behavior from CIDER anymore.

11:21 TimMc: stuartsierra: Even without updating it?

11:22 stuartsierra: TimMc: yes, I'm still on 0.7

11:28 technomancy: 0.6 was the best

11:28 "cider classic"

11:32 sdegutis: Did you hear about this new Pixie language?

11:32 It's a new kind of Clojure dialect.

11:33 TimMc: Not just a new dialect, but a whole new *kind* of dialect? Wow!

11:33 sdegutis: Right!

11:33 It's magicalish.

11:33 tbaldridge: and very, very alpha

11:33 technomancy: a new kind of science

11:34 sdegutis: tbaldridge: citation needed

11:34 tbaldridge: I wrote it

11:34 sdegutis: tbaldridge: I don't see that anywhere on the readme.

11:34 That it's very very alpha.

11:34 It says "pre-alpha" but I don't know what that means.

11:35 tbaldridge: that means it's not even alpha yet. As in some things work really well, other things will segfault.

11:35 sdegutis: Oh :)

11:36 tbaldridge: and other stuff, like the ability to open and read files isn't implemented yet. But hey, I can count numbers and sum the contents of vectors really fast :-)

11:36 sdegutis: Well there you go, that's already half the battle.

11:36 And in only 6 instructions, too!

11:37 technomancy: how fast is fibbonacci, that's what I want to know

11:37 * technomancy isn't afraid to ask the relevant, hard-hitting questions

11:38 csd_: Is there any way to dynamically load new dependencies from the REPL? ie without having to create a project.clj?

11:38 sdegutis: csd_: lein-try

11:39 csd_: what if I'm inside cider though?

11:39 cursork: csd_: alembic.still

11:39 sdegutis: csd_: I don't know what cider is sorry.

11:39 csd_: emacs repl for clojuree

11:40 clgv: so clojure on python gets revived with a different name?

11:41 or is it clojure on pypy?

11:41 tbaldridge: clgv: no, it's not on python, it's rpython. Picture a lisp written in C with a GC/JIT

11:42 clgv: tbaldridge: ok, seems I need to find out what RPython is ;)

11:42 csd_: cursork: so i just add that to my profiles.clj and can then load whatever i want? sounds too great to be true

11:42 cursork: csd_: Yep. I haven't had any issues with it

11:42 csd_: wow

11:42 leiningen should just merge it

11:44 sdegutis: csd_: So it's like nrepl.el?

11:44 tbaldridge: what do you think of femtolisp?

11:45 csd_: i would guess so, although i'm not familiar with that

11:48 stuartsierra: csd_: lein-try is for launching a new REPL with specific dependencies without a project.clj

11:49 If you're already running a REPL process, you can't change the dependencies without restarting.

11:49 There are tools that try (https://github.com/cemerick/pomegranate) but I'm not sure how well it works in practice.

11:50 technomancy: you can add new deps without too much trouble, but upgrading usually won't work

11:50 stuartsierra: ah, makes sense

11:50 csd_: I just want an easy way to experiment with a new library, thats all

11:50 H4ns: i'm such a java noob, sorry: if i use (gen-class foo), should i not be able to instantiate a foo instance using (foo.)? i see "Unable to resolve classname: foo" instead.

11:50 stuartsierra: csd_: lein-try if you want to launch a new REPL with the library included, that's what it's for.

11:51 csd_: stuartsierra: i cant use that with cider though

11:51 stuartsierra: csd_: once you've launched the REPL you can connect to it with cider

11:51 csd_: so start the repl server externally?

11:51 stuartsierra: csd_: yes

11:51 csd_: interesting

11:52 stuartsierra: H4ns: gen-class isn't interactive; it only works when Ahead-of-Time (AOT) compiling.

11:53 H4ns: stuartsierra: ah, ok. would compiling the buffer in cider do what i expect? or is there some other way?

11:53 stuartsierra: H4ns: No.

11:53 technomancy: you can run clojure.core/compile from the repl

11:53 but the gen-class has to be on disk

11:54 H4ns: ah, okay, thank you both!

11:59 cromwell: Hi. I have programming clojure by Stuart Holloway first edition. Has the language changed too much to make it not useful

12:00 csd_: stuartsierra: There's an hack evidently to use lein try with emacs.

12:00 (setq inferior-lisp-program "lein try <lib>") and then M-x inferior-lisp

12:00 technomancy: you can do that without a plugin

12:00 mavbozo: cromwell: it is still a useful book

12:01 technomancy: just set it to lein update-in :dependencies conj '[whatever "version"]' -- repl

12:02 csd_: what's the last part, -- repl do?

12:02 technomancy: csd_: launches a repl with a modified project map

12:02 update-in is a higher-order task; it takes a task as an arg

12:02 cromwell: Mavbozo: ok good it is the core concepts I am keen to learn. New stuff like core.async etc I can learn elsewhere

12:03 m1dnight_: hrm, a (binding) seems to introduce an error "can not regur across try"

12:03 cromwell: Are there any useful core language features that have changed since 2009

12:03 m1dnight_: does it use that somewheree?

12:03 I'm wanting to wrap a body of a function in a binding

12:04 TimMc: and you're using loop or recur or lazy-seq or something?

12:04 m1dnight_: Yeah, in the function body there is a recur

12:05 h, so the binding should wrap the scope containing the recur?

12:05 TimMc: You may need to extract a helper fn that just does the bindings.

12:05 *wrapper fn

12:06 justin_smith: black_13: do you have leiningen installed?

12:06 hyPiRion: cromwell: I think there are some new features, but I wouldn't say it's critical to get you up and running.

12:07 cromwell: Ok thanks I will give it a go

12:07 hyPiRion: cromwell: The only thing I can think of is Leiningen, probably.

12:07 cromwell: I was given it so :)

12:16 kzar: I added "{:user {:plugins [[cider/cider-nrepl "0.8.0-SNAPSHOT"]]}}" to my ~/.lein/profiles.clj as instructed but when I M-x cider-jack-in I am told that cider-nrepl isn't installed. Is there another step to trigger the installation after adding the plugin to my profiles.clj?

12:18 csd_: kzar: Did you install the emacs package today?

12:18 sm0ke: any duckling developers here?

12:18 kzar: csd_: Well I already had it installed, unfortunately I also had a really old version of the pre-rename nrepl installed as well so I just removed that

12:19 csd_: upgrade and delete the old package

12:19 i had a similar problem and this fixed it

12:19 kzar: csd_: Already deleted the old package, will see if I can upgrade the new one

12:19 m1dnight_: This got me up and running, if it can be of any help: http://www.braveclojure.com/using-emacs-with-clojure/

12:19 csd_: kzar: MELPA gets a new build basically every time there is an update on github

12:20 kzar: m1dnight_ csd_: My question really is do I need to do something to trigger cider-nrepl installing after I've added the relevant bits to my profiles.clj?

12:20 csd_: no it should happen automatically

12:22 * kzar upgrading

12:24 m1dnight_: kzar: What i'm saying is that I haven't done it that way. I installed the cider package. If that works, great

12:24 but I have only tried this way, and nothing else

12:25 csd_: kzar: my laptop battery is about to die very soon. one other thing you can try if this doesn't work though is to delete all the CIDER libs under ~/.m2

12:25 kenrestivo: lookupName(pfds[i].fd), pfds[i].fd);

12:25 csd_: i've also had weird problems caused by those before

12:25 kzar: csd_ m1dnight_: OK thanks. Hmm upgrading didn't help but I'll restart emacs and then try that

12:25 kenrestivo: meh paste fail.

12:28 kzar: \o/ that worked :)

12:29 csd_: awesome

12:29 kzar: ty for the help

12:29 csd_: which did, upgrading the package, or deleting the libs?

12:29 kzar: csd_: So I had nrepl 0.2 or something installed, a random version of cider from I guess a few weeks / months ago. I uninstalled nrepl, upgraded cider, restarted emacs and then it started working

12:30 csd_: (I also tried restarting cider before restarting emacs and that didn't work)

12:30 kungi: How do I use cider-grimoire properly? I only get the html of the page?

12:30 kzar: csd_: Not messed with the stuff in ~/.m2

12:30 csd_: kungi: if you're only getting html double check that you're actually doing it on top of a symbol

12:31 kungi: csd_ I am. C-c C-d h opens the proper symbol in my browser.

12:31 maybe my cider is too old ...

12:31 arrdem: kungi: waaaait before you update there's a ticket open for this

12:32 https://github.com/clojure-emacs/cider/issues/867

12:32 kungi: arrdem: I always have a snapshot version number ready where everything works and copy my whole emacs config on a cider update

12:32 cider broke too often in the past

12:33 arrdem: ikr

12:33 kungi: ikr?

12:33 arrdem: I know right

12:34 kungi: so if that ticket is right, I'd try clearing the .elcs in your cider package dir and restarting emacs

12:35 kungi: arrdem: I will try this

12:38 * arrdem watches the Grimoire logs like a hawk

12:40 black_13: justin_smith: i thought leinigen was installed with the eclipse plugin

12:40 kzar: Anyone use kioo here? I get a bunch of warnings when using it, that normal?

12:46 kungi: arrdem: \o/ removing the .elcs did the trick

12:46 arrdem: kungi: -_- okay please comment on that thread saying so.

12:46 kungi: arrdem: will do

12:47 arrdem: kungi: cheers. enjoy plaintext mode :D

12:47 glad to know I'm not the only person using it :D

12:49 kungi: commented

12:51 arrdem: thanks.

12:52 kungi: I really have to learn emacs lisp properly.

12:55 irctc: Does Clojure offer any significant benefits over Node.js for web developement. I'm a Node developer and Clojure looks quite interesting language wise, but how is the eco system for web developers? Thanks!

12:55 arrdem: kungi: if you have comments on the text/plain formatting I'd like to hear them.

12:55 https://github.com/clojure-grimoire/grimoire/issues/68

12:56 tuft: irctc: one of the biggest advantages is the language itself. here's a good talk i watched the other day: https://vimeo.com/111214648

12:57 irctc: .. and yes, there's a pretty solid web development ecosystem AFAICT

12:57 both client and server side

12:58 irctc: ClojureScript can run on Node.js, too, so you have a nice pathway for dabbling

12:59 irctc: tuft, thanks. Have you used Clojure in production?

13:00 tuft: irctc: for my own projects, yes, but not commercially yet

13:00 CljNoob: how would I call a function f with its argument x repeated n times? so f x x ... x where the number of x's is n

13:00 arrdem: CljNoob: (apply f (repeat n x))

13:01 CljNoob: arrdem: awesome, let me try that

13:02 arrdem: lovely, exactly what i needed. thanks

13:02 irctc: tuft: alright. Have you faced any major hurdles when using Clojure on your projects?

13:04 tuft: irctc: *shrug* not really. it's something new to learn like anything else. tooling seems like it'd be on par with nodejs, but i have no experience with nodejs

13:06 clrnd: clojrue has great constructs for functional programming, which node lacks (in general)

13:06 tuft: yeah no need to bolt on something like underscore.js to get a partial solution for FP

13:08 irctc: tuft: I was considering using Clojure to build a commercial production grade system. Node.js is the safe bet for me since I know that best. But, Node projects have creative ways of failing in production :/. Well to be honest, it's more of a JS probelm than a Node problem.

13:08 tuft: irctc: yeah check out that talk i pasted -- it's super relevant to those concerns i think

13:09 irctc: it's hard to disagree with clojure being the better designed language i think

13:10 irctc: given JS was basically designed hurriedly over a few weeks, heh

13:11 irctc: tuft: Indeed, but with Node.js its very easy to get things done fast, since the ecosystem is really good and npm is extremely straightforward to use.

13:11 TimMc: irctc: Don't worry, Clojure projects also have creative ways of failing in production! Yay software.

13:11 tuft: irctc: try lein and see what you think. i find it quite excellent. does npm install things system-wide?

13:11 clrnd: in clojure it's very easy to get things done correctly

13:12 tuft: (inc clrnd)

13:12 lazybot: ⇒ 1

13:12 TimMc: It would be easier with some static typing but I'm happy with the compromise.

13:12 technomancy: TimMc: did you deploy another Enterprise Swearjure app again?

13:12 tuft: yeah fast isn't really fast when it breaks and you lose lots of time to debugging, heh

13:12 technomancy: I keep telling ya that's gotta stop

13:13 TimMc: technomancy: Yes, but this time it uses SOAP so I'm sure it will all be fine.

13:13 irctc: TimMc: Of course :D. But JS is a complete hack.

13:13 tuft: TimMc: core.typed?

13:14 TimMc: I guess I haven't seen any surprises in production that are actually attributable to Clojure itself.

13:14 tuft: I'll look into it eventually. :-)

13:16 clgv: TimMc: what do you produce?

13:19 irctc_: tuft: yes, npm allows you to install system wide or only within the project

13:19 TimMc: clgv: I work for Brightcove, which sells online video as a service. Right now we're working on a new playback server (the thing that serves video metadata when a player loads.)

13:19 So, web servers.

13:20 clgv: TimMc: web servers and clojure then?

13:20 TimMc: yup

13:20 tuft: yay webservers

13:20 TimMc: which location are you at?

13:21 TimMc: There are a couple of other public-facing Clojure projects here and I've worked on a couple of those as well.

13:21 tuft: Boston, the main office.

13:21 tuft: TimMc: cool. i'm near your seattle location

13:22 TimMc: Oh, the Zencoder folks.

13:22 (I actually don't know if they're all Zencoder or if there's more mixing than that.)

13:22 bja: technomancy: any tutorials on architecting a scalable enterprise swearjure javabean?

13:23 technomancy: bja: it's running into some publication issues with censorship

13:23 TimMc: bja: Swearjure isn't so much architected as... extruded.

13:24 bja: :(

13:24 clgv: TimMc: brightcoves german translation for engineer is strange ;)

13:24 TimMc: Oh yeah?

13:25 clgv: translated back it means technician ;)

13:25 but the image corrects that by showing a guy in front of code ide ;)

13:25 TimMc: Is this on our jobs pages? Maybe I should poke someone.

13:26 clgv: yes

13:27 TimMc: Thanks, I'll try to figure out who that would even be. :-P

13:30 clgv: Someone pointed out that because we don't translate brand names, our "Once" product (acquired from another company) gets listed on the Spanish site as (effectively) "Brightcove Eleven".

13:31 hlship: Does "lein repl" compile Java classes before running the REPL?

13:31 technomancy: hlship: yeah

13:31 provided :java-source-paths is set

13:32 hlship: I'm on 2.4.3 and I'm not seeing this.

13:33 :java-source-paths ["java-src"]

13:33 $ tree java-src/

13:33 java-src/

13:33 └── fan

13:33 └── logging

13:33 └── CorrelationIdConverter.java

13:33 2 directories, 1 file

13:34 But I'm getting a ClassNotFoundException on fan.logging.CorrelationIdConverter

13:34 things are working in the Cursive REPL

13:34 I also don't see any *.class files

13:35 technomancy: hm; ok, well if you have a repro case please open an issue

13:35 TimMc: $ tree

13:35 🌲

13:36 hlship: It's going to be a pain to extract out, is there any lein debugging I can enable to get some insight?

13:37 bja: IIRC, you can set DEBUG=1 in your environment, and lein gets a lot more chatty

13:38 hlship: lein jar does compile the Java class

14:01 hyPiRion: hlship: does CorrelationIdConverter.java start with `package fan.logging;`?

14:01 hlship: yes

14:02 hyPiRion: hrm, then it should work fine

14:03 (theoretically)

14:04 hlship: Ok, found it.

14:04 I have a dev-resources/user.clj

14:04 that sets things up for testing

14:05 whodidthis: whats a cool way to write string? but one that returns the string when true instead of just true

14:06 hlship: and it was indirectly trying to load the Java class

14:07 so I'm not happy that the javac step puts dev-resources on the classpath

14:10 sdegutis: ,[{()()}]

14:10 clojurebot: [{() ()}]

14:11 clgv: TimMc: haha :D

14:11 sdegutis: ,#{[{() ()}]}

14:11 clojurebot: #{[{() ()}]}

14:11 sdegutis: :D

14:12 zanes: Are profilers like YourKit capable of determining which reference(s) might be hogging memory?

14:13 clgv: zanes: not that easily, but yourkit contains tools for analyzing that - but it is more than hit a button and get the code lines

14:14 zanes: clgv: I’m struggling to figure it out. Any specific pointers for where to look?

14:14 hlship: or trys to load namespace 'user

14:14 quit

14:14 clgv: zanes: in your program or the profiler?

14:15 zanes: Profiler.

14:15 I’m pretty sure I’m hanging on to the head of one of several infinite lazy sequences somewhere.

14:16 clgv: zanes: "start object allocation recording" and "advance object generration number" - they have some more infos in their online docs

14:18 sdegutis: How do I use the function that a macro is calling without using the macro itself?

14:18 clgv: sdegutis: what?

14:19 Bronsa: sdegutis: ... invoking the function?

14:19 sdegutis: The macro is defined like this: (defmacro foo [some args] (some-fn-call some args))

14:19 No lie.

14:19 clgv: sdegutis: just call the functio

14:19 sdegutis: Do you see?

14:19 clojurebot: Pardon?

14:19 sdegutis: It omits the `

14:19 clgv: but it probably just returns code ;)

14:19 sdegutis: There's no semi-quote.

14:19 clgv: sdegutis: what do you want to achieve?

14:19 Bronsa: sdegutis: so what? it means that some-fn-call returns the code for the macro

14:20 (defmacro x [] `(foo)) is the same as (defn bar [] `(foo)) (defmacro x [] (bar))

14:20 sdegutis: Bronsa: Right, so how do I call the code returned by calling (some-fn-call some args) myself?

14:20 Bronsa: eval

14:20 sdegutis: clgv: I am trying to avoid someone else's DSL since it does not fit my use-case.

14:20 Bronsa: That happens at runtime though, I want to have this happen at compile-time.

14:20 justin_smith: sdegutis: yeah, that sucks

14:20 clgv: as Bronsa said ;)

14:20 sdegutis: justin_smith: which part?

14:20 justin_smith: having to use someone's DSL

14:20 sdegutis: Ah.

14:21 Bronsa: sdegutis: then use a macro

14:21 sdegutis: Oh I know, I'll just write a macro will just call their fn dir-- yeah that.

14:21 clgv: huh? you literally just want to avoid the macro but you want exactly what it does?

14:21 sdegutis: clgv: I want its implementation, but not its interface.

14:22 clgv: Surely you can understand.

14:22 I really feel like I'm speaking Greek here or something.

14:22 clgv: sdegutis: define your own macro with different parameters and call their function apropriately

14:22 sdegutis: Right, that's the solution I ended up with.

14:22 Bronsa: sdegutis: you haven't expressed your problem clearly. Anyway you got your answer now

14:22 sdegutis: Thanks anyway for trying.

14:23 I'm writing an alternative DSL to compojure.core/GET and friends.

14:23 (For my own personal use -- so don't worry.)

14:25 It's turning into quite a difficult ordeal.

14:25 I suppose I can just try to omit '(GET ...) etc. instead.

14:25 {blake}: I've got a form created with hiccup and now I want to format the inputs and outputs. (Masks, dollar signs, percentage signs, etc.) Suggestions?

14:26 weavejester: sdegutis: Are you talking about calling compojure.core/compile-route ?

14:26 sdegutis: weavejester: Yes.

14:26 weavejester: sdegutis: You know it’s a public function?

14:27 sdegutis: weavejester: Yes, I'm calling it.

14:27 weavejester: sdegutis: Hm, so what’s the problem?

14:27 justin_smith: {blake}: ##(java.net.URLEncoder. "hello&world!%" "UTF-8")

14:27 lazybot: java.lang.IllegalArgumentException: No matching ctor found for class java.net.URLEncoder

14:27 justin_smith: err

14:27 sdegutis: weavejester: The difficulty is in trying to create a new `body` that wraps the one given to my new function, and giving that to compile-route.

14:27 justin_smith: {blake}: ##(java.net.URLEncoder/encode "hello&world!%" "UTF-8")

14:27 lazybot: ⇒ "hello%26world%21%25"

14:27 sdegutis: *to my new macro

14:28 justin_smith: {blake}: ##(java.net.URLEncoder/decode (java.net.URLEncoder/encode "hello&world!%" "UTF-8"))

14:28 lazybot: java.lang.IllegalArgumentException: No matching method: decode

14:28 {blake}: justin_smith: URLEncoder?

14:29 justin_smith: {blake}: yeah, it escapes things that aren't safe in a URL

14:29 may not be an exact match for what you want, I guess

14:29 weavejester: sdegutis: What do you have so far? I don’t really follow what you’re doing.

14:32 {blake}: justin_smith: Yeah, doesn't seem like it'd work. Thanks, though.

14:33 munderwo: Does anybody know how to kill nrepl-server processed in emacs?

14:33 sdegutis: weavejester: I'm trying to wrap the body of a (GET "/:foo" [foo] ...) call so that "..." is turned into "(do some more stuff ...)" but because compile-routes takes a seq for the `body` arg, I'm kind of lost on how to do this short of building up a list myself.

14:33 stuartsierra: ,(java.net.URLDecoder/decode (java.net.URLEncoder/encode "hello&world!%" "UTF-8"))

14:33 sdegutis: Oh, I suppose I can just pass `(do some more stuff ~@body) to the body arg.

14:33 clojurebot: "hello&world!%"

14:34 sdegutis: munderwo: Why not use cider?

14:34 munderwo: well im using cider and nrepl for clojure script…

14:35 And i’ve killed the cider buffer, but the nrepl-servers are still around. and I can get my browser because they still have the port bound.

14:35 I understand that to connect cider with a browser for clojurescript you need nrepl?

14:35 weavejester: sdegutis: Well, compile-route is just a wrapper to around make-route, so you could always drop down to that if you want to deal with functions instead of unevaluated lists of code.

14:35 sdegutis: Thanks.

14:36 weavejester: sdegutis: But it sounds like you’re doing something like wrap-routes ?

14:36 sdegutis: What’s the end goal?

14:37 sdegutis: weavejester: Part of the goal is to just bind some more variables to the body of each function.

14:38 weavejester: sdegutis: So… why not something like `(let [x 1] ~@body) ?

14:38 sdegutis: Thanks.

14:38 weavejester: sdegutis: Even though you have unevaluated code, it’s not hard to wrap that in a let.

14:39 sdegutis: weavejester: It's slightly more complicated than that, since I want to use the values from some of the bound variables that will be bound in the 'args' arg. But either way, thanks for your help.

14:42 whodidthis: can i clojure.string/trim in a prismatic's schema

14:42 justin_smith: {blake}: there is clojure.string/escape if you have a definitive list of what needs escaping https://clojuredocs.org/clojure.string/escape or some utilities from apache/spring http://stackoverflow.com/questions/1265282/recommended-method-for-escaping-html-in-java but the right thing is a proper encoder, because escape based techniques tend to be bad hacks...

14:44 {blake}: justin_smith: I'm not really looking for how to get a formatted string on the page. I'm looking for how to format the stuff to begin with. Like, given a mask of "$###,###" take "123456" and make "$123,456". I'm trying to avoid shoehorning a bunch of javascript in there.

14:45 May be inevitable.

14:45 justin_smith: oh, I misunderstood what you meant by "formatting", sorry

14:46 {blake}: justin_smith: No problem. The escaping thing is bound to come up.

14:46 justin_smith: cl-format has a bunch of things along those lines baked in (the above is one of the printing formats for numbers)

14:47 https://clojuredocs.org/clojure.pprint/cl-format

14:47 {blake}: justin_smith: Cool. I'll have to do some translating (these formats come from Excel =8-0) but it shouldn't be too bad.

14:48 I think the real issue is going to be formatting input. Maybe I'll see about cheating that.

14:48 justin_smith: looks like ~d does the , thing

14:48 oh user input...

14:48 {blake}: justin_smith: Heh. Yeah.

14:50 amalloy: {blake}: java.text has methods for formatting strings and numbers

14:50 eg, https://docs.oracle.com/javase/7/docs/api/java/text/NumberFormat.html

14:50 justin_smith: &(require 'clojure.pprint)

14:50 lazybot: ⇒ nil

14:50 justin_smith: &(clojure.pprint/cl-format nil "~:d" 123456)

14:50 lazybot: ⇒ "123,456"

14:50 {blake}: amalloy: Also cool, thanks.

14:51 amalloy: i don't think i would use cl-format; i'm sure it produces lovely output in a minimum of source-code characters in english, but java.text stuff is all nicely localized

14:51 eg, the same formatstring will produce 123,456 here or 123.456 in countries that use a different decimal separator

14:52 it also contains methods for parsing inputs with similar format specifiers

14:53 {blake}: amalloy: Any thoughts on the user-interface front?

14:53 amalloy: users lie

14:53 {blake}: Chronically, habitually, unconsciously, yes.

14:55 justin_smith: amalloy: so with that approach, you would set the locale to match the user making the request?

14:56 amalloy: justin_smith: i haven't paid much attention to what {blake}'s program actually is. localization is easier for a program that a user will actually run, but of course you can set the locale for webservers too

14:57 {blake}: It's pretty straightforward: A web page with data input fields on the left and results on the right.

14:57 amalloy: i'm just recommending it by default because it's something that java gets a lot more right than most languages, and it would be a shame to go back to the dark days of ascii-everywhere with cl-format

14:58 justin_smith: amalloy: fair point on that, yeah

14:59 TimMc: explosion in the keyboard factory

15:00 {blake}: No QWERTYs were injured, however.

15:00 technomancy: PSA: having a small issue restoring clojars DB that's resulting in duplicate group memberships.

15:01 should not affect functionality but might look weird for a while

15:02 * amalloy attempts to join many groups

15:03 TimMc: Did Clojars explode?

15:03 justin_smith: TimMc: UHOH who'se gonna re-package all those bytes back into jars?

15:03 amalloy: it was caught in the qwertypocalypse

15:04 technomancy: TimMc: I accidentally deleted a whole table because korma syntax is weeeeird

15:04 TimMc: oy

15:04 honza: y u no yesql

15:04 technomancy: (korma.core/delete groups (values {:name "com.somesuch" :user "whoever"})) ; <- doesn't do what it looks like it does

15:04 honza: didn't exist at the time =P

15:05 amalloy: technomancy: i guess clojars was using korma when you started maintaining it? i don't remember you being a fan of korma

15:06 technomancy: amalloy: yeah, it wasn't my choice

15:06 amalloy: luckily I added an immutable event log that it wrote to redundantly

15:06 and I was able to restore from that, though it's peppered with dupes

15:06 the plan was to get off the DB and onto the event log, but that never happened

15:07 but it's been very valuable for the restore

15:08 bash-in-place data stores: terrible idea or worst idea?

15:09 mdrogalis: technomancy: Best terrible idea.

15:09 amalloy: technomancy: but these days we have fancypants BIP data stores like hbase, which will store *several* past revisions of an entry, unless you configure it not to!

15:10 mdrogalis: amalloy: BIP?

15:10 technomancy: amalloy: or like ... a single .clj file

15:10 sdegutis: How do you prevent a symbol from being fully resolved at such time as marco expansion?

15:10 llasram: sdegutis: do you mean like:

15:10 ,`(this :vs ~'this)

15:10 clojurebot: (sandbox/this :vs this)

15:10 amalloy: mdrogalis: Bash In Place

15:11 sdegutis: I mean 'foo vs 'user/foo

15:11 mdrogalis: amalloy: Ah :)

15:11 justin_smith: sdegutis: rewrite the macro

15:11 sdegutis: I am trying.

15:11 mi6x3m: was 'positions' actually migrated to somewhere?

15:11 dc_: do agents in clojure have anything to do with agent-based design, over the network?

15:11 sdegutis: I type 'foo in the macro's definition, but at runtime its 'user/foo

15:11 llasram: sdegutis: see what clojurbot did with my example

15:11 justin_smith: sdegutis: that's what ` does

15:12 llasram: clojurebot even

15:12 amalloy: the expansion from foo to user/foo is not a macroexpansion feature

15:12 sdegutis: Oh.

15:12 dc_: in other words, whats the best way in clojure to send a command over the network to have it executed by an agent

15:12 sdegutis: Taht worked.

15:12 amalloy: dc_: i don't think they're related, no

15:12 sdegutis: llasram: You win.

15:12 amalloy: What would you call it?

15:12 justin_smith: dc_: well, it can be misleading, agents hold values and you pass them functions

15:13 amalloy: sdegutis: syntax-quote does it

15:13 as you can tell from llasram demonstrating it without writing a macro

15:13 justin_smith: dc_: usually agant-based design assumes a function, that you pass a value

15:13 sdegutis: amalloy: Oh. Thanks gentleman/scholar.

15:13 dc_: i've got a dependancy that forces me to use AoT compilation and makes it hard to use the repl. i'd rather have that dependency in a separate program that i can easily communicate with and possibly have multiple processes running it. is there an established way to do this inclojure?

15:13 llasram: dc_: What's the dep requiring AOT?

15:14 dc_: amalloy justin_smith: cool, so i may be able to use agents to accomplish this in some way

15:14 llasram: aparapi-matrix

15:14 justin_smith: dc_: you can launch an nrepl server from inside an aot'd program

15:14 amalloy: justin_smith: i think dc_ has a completely different idea of what agent-based design means from yours

15:15 justin_smith: amalloy: fair enough!

15:15 amalloy: i don't really know what either of you means, though, so who knows

15:15 justin_smith: hah

15:15 dc_: llasram: aparapi-matrix lets you run matrix multiplication and a few other algorithms on the GPU, using aparapi and OpenCL. there's a few other algorithms i want to encode on the GPU myself, but i don't really want the dependancy in my main program

15:15 llasram: huh

15:15 kungi: I am trying to use the component workflow while developing a web app in clojure and constructed the following minimal example. When I change the content of my only get handler and (reset) in the repl I still get tho old results. Can someone please have a look at my example and tell me where I got it wrong (https://github.com/Kungi/example-component-ring)

15:15 llasram: ok

15:15 justin_smith: dc_: oh, yeah, don't run a repl from the GPU, that would be silly

15:16 dc_: justin_smith: ahh, so one program can connect to others via nrepl and pass code as data?

15:16 justin_smith: dc_: that's what nrepl is for, yeah

15:16 it's a socket based repl server

15:16 dc_: justin_smith: so far i've only used it as a repl :)

15:16 justin_smith: it's what lein repl uses

15:17 dc_: little did you know lein was launching both a client and a server

15:17 dc_: sometimes it is useful to run a compiled project, and then host an nrepl server inside it

15:17 bobbywilson0: What is the trick for getting a play-clj project to run with updates in cider? I keep getting "IllegalStateException Only one OpenAL context may be instantiated at any one time." when I try to eval (-main) again.

15:17 dc_: justin_smith: i realized i could connect to it over the network, but i guess i just didn't think about it like that

15:17 justin_smith: dc_: inside out from the usual launch-your-code-from-a-repl

15:18 dc_: justin_smith: ok that's awesome! that makes interacting with other programs very easy

15:18 justin_smith: dc_: as long as you fully trust them with all the capabilities of your own process, yes

15:18 dc_: basically i just need a clojure wrapper across a library or interfacing with an external program, then i can interact with it across the network.

15:18 ahh i see what you're saying

15:19 weavejester: kungi: You have a fair bit of odd code in your example project, like macros that create records. You’re also writing a lot of your own code when there are libraries that give you things like Jetty components and user REPL functions.

15:19 dc_: justin_smith: so what should i look into to restrict the nrepl interface, so that only approved code can run?

15:19 justin_smith: dc_: I am not totally sure what you are doing, but there are also various inter-process queue setups

15:20 dc_: because it is easier to read from a queue, and use that value to execute a task, rather than try to run a sandboxed interpreter

15:20 rabbitmq, hornetmq etc.

15:20 *hornetq

15:20 weavejester: kungi: I can’t see anything that would cause the error, but it’s very complex for what it does.

15:20 dc_: justin_smith: i'm working on a bioinformatics algorithms class on coursera. i want to accelerate some of the low-level algorithms with the GPU, but i don't really want to introduce certain dependencies to my main project.

15:21 justin_smith: dc_: what about doing it caveman style and launching its vm via ProcessBuilder, and then feeding it input via (.write (.getInputStream proc) bytes)

15:22 maybe not your best option actually

15:22 dc_: justin_smith: ah ok. that makes sense. that's how i would have solved the problem in ruby. what i'm worried about now, is that implementing this will result in too much overhead passing data across the network, making it just as slow as it would be without using the GPU

15:22 kungi: weavejester: let me try to tidy it up a bit. I ripped this out of production code where the problem occurs. I did google a bit and did not find a library for a jetty component?

15:23 weavejester: kungi: https://github.com/weavejester/ring-jetty-component

15:23 dc_: justin_smith: i wasn't aware of that option, i'll have to look into ProcessBuilder

15:23 kungi: O.o how have I missed this?

15:23 justin_smith: dc_: then maybe that ProcessBuilder option is usable then.

15:23 weavejester: kungi: Also: https://github.com/weavejester/reloaded.repl

15:23 amalloy: dc_: i have trouble believing you can move data across even the localhost network interface fast enough to make using the gpu profitable

15:24 weavejester: kungi: I’ve been writing a fair few components recently, because I’ve been working on an opinionated template for component-based web apps. https://github.com/weavejester/duct

15:24 zanes: Is it possible to get object allocation profiling data from YourKit when in attach mode?

15:25 justin_smith: amalloy: what about things like unix domain sockets or stdio?

15:25 weavejester: kungi: Rather than use a macro to create a record, I use a function with reify, which I think works a little better

15:26 dc_: amalloy: that's what i was worried about. i'll probably keep the gpu project separate then. i'm looking at this bioinformatics algorithms paper by Tuan Tu Tran, where he uses GPU acceleration on all kinds of algorithms: hamming-distance, motifs and string neighborhood.

15:26 amalloy: justin_smith: it's still a lot of syscalls and buffer copying. but it's not really my area of expertise, even though i like to sound informed. maybe it really will be faster

15:26 weavejester: kungi: So I have a function that takes in a config map and spits out a routing function: https://github.com/weavejester/duct/blob/master/lein-template/resources/leiningen/new/duct/example.clj#L8

15:26 kungi: And then I transform this into an endpoint using a function: https://github.com/weavejester/duct/blob/master/duct/src/duct/component/endpoint.clj

15:26 justin_smith: amalloy: if it's a truly parallelizable algo, it shouldn't be too dependent on the rate of input to the process anyway

15:27 weavejester: kungi: Which I now realize doesn’t use reify as I said before. I think that was an earlier version I was thinking on.

15:27 dc_: justin_smith amalloy: i'm definitely in way over my head with this stuff, but the bioinformatics class has been a lot of fun so far. i just want to take some of these algorithms and see how ridiculously fast i can implement them.

15:28 kungi: weavejester wow thanks for the input! I will start refactoring right away :-)

15:28 justin_smith: dc_: it's pretty straightforward to just feed your data as bytes to a Process instance created via ProcessBuilder. It's not super flexible, because unlike with a network based input you can't send / receive data with arbitrary programs - you own its input and output within your own process

15:28 dc_: justin_smith amalloy: hamming-distance can be pretty much done in constant time already, but i'm pretty sure it can be accelerated across an array of bytes, so that it doesn't have to process one at a time.

15:30 TimMc: (defmarco polo)

15:30 justin_smith: TimMc: I almost went there but backed off

15:30 TimMc: Someone needed to say it.

15:30 dc_: network as a bus, mannn... netowork as a bus. it's coming

15:31 justin_smith: well, the network thing is much slower

15:31 but unix domain sockets are a compromise

15:31 they are faster, but localhost only

15:32 dc_: probably still be slow to read/write from network interfaces, regardless of how fast they are

15:32 justin_smith: but sadly java can't use them without jni :(

15:32 dc_: unix domain sockets are not network interfaces

15:32 they are interfaces for fast local IO between multiple programs

15:36 annelies: I started working on clawk today.

15:36 sdegutis: What's that?

15:36 justin_smith: sweet

15:36 arrdem: w00t

15:36 sdegutis: https://github.com/daveray/clawk ?

15:36 annelies: shitwtf it already exists dammit

15:36 with the same name

15:36 :V

15:36 sdegutis: annelies: what is your clawk?

15:36 arrdem: :C

15:37 dc___: oh no, now i haz three underscores. i really need to configure my nick

15:37 justin_smith: annelies: great minds think alike I guess - but I bet if you read the code you find like 50 ways to improve it

15:37 sdegutis: dc___: LLOL

15:37 annelies: justin_smith: yeah but I'll have to think up a different name :P

15:38 awkjure

15:38 I disabled that moronic lein restriction anyway.

15:38 sdegutis: awkjward

15:38 dc___: i've got a good irssi config, but i don't like that i have to use it from within terminal. makes it hard to switch back in forth. though i really do prefer irssi

15:38 justin_smith: sdegutis: I love that that word describes itself

15:38 dc___: lol

15:39 sdegutis: justin_smith: well awkjward isn't a word thus it describes nothing

15:39 but it describes nothing with exquisite accuracy and superb elegance

15:39 annelies: sdegutis: something like (defawk weather pattern rule, pattern rule, pattern rule) where pattern can be anything that implements Pattern protocol and rule can be anything that returns a sequence

15:39 justin_smith: dc___: registering your nick is not super hard to do, and /msg nickserv ghost ... works nicely once you've done that

15:39 annelies: I want to implement Pattern for regex and boolean to start with

15:39 justin_smith: sdegutis: it describes trying to parse or pronounce itself

15:40 annelies: and :begin and :end are special like in AWK

15:40 But I have to think of how to have it keep state.

15:40 AWK without state isn't _very_ useful.

15:41 sdegutis: justin_smith: :)

15:41 "awkuhjuhword"

15:41 I am writing macros.

15:41 In real life.

15:41 annelies: ,(shuffle "clojure awk")

15:41 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Collection>

15:41 annelies: wat

15:42 dysfun: is there any library that deals with sequences of functions? i.e. doing clever function things at runtime?

15:42 annelies: ,(apply str (shuffle (seq "clojure awk")))

15:42 clojurebot: " cljarouekw"

15:42 annelies: That will be the name of my library.

15:42 TimMc: Like... composing them?

15:42 &(format "lib-%04d" (rand-int 1e4))

15:42 lazybot: ⇒ "lib-2945"

15:42 justin_smith: dysfun: lots, which kinds of clever things?

15:42 TimMc: annelies: ^ a suggestion from gfredericks

15:43 llasram: Probably monads

15:43 dysfun: composing them conditionally, perhaps

15:43 annelies: TimMc: hm?

15:43 dysfun: i can see how i could have some fun with lazy-seq

15:43 TimMc: annelies: ##(format "lib-%04d" (rand-int 1e4))

15:43 lazybot: ⇒ "lib-7208"

15:44 TimMc: There's another one.

15:44 I'm just giving him credit.

15:44 annelies: oohh :P

15:44 * gfredericks files a patent

15:44 annelies: nice

15:45 justin_smith: ,(str "cl" (java.util.UUID/randomUUID) "jure")

15:45 clojurebot: "cl0d50d7ba-1752-4e09-b6d5-5369a221a596jure"

15:45 llasram: (inc justin_smith)

15:45 lazybot: ⇒ 132

15:45 TimMc: (inc justin_smith)

15:45 lazybot: ⇒ 133

15:45 TimMc: That one even starts with "cl0".

15:46 justin_smith: 1 in 16 chance, so I basically just killed the orc in one hit

15:46 arrdem: Grimoire now officially moved to conj.io. No URL rewriting required, 301 redirect in place.

15:47 not_arrdem: ,(let [characters (->> (range 48 58) (concat (range 65 89)) (concat (range 97 123)))] (defn generate-id [] (->> #(rand-nth characters) repeatedly (take 4) (map char) (apply str))))

15:47 clojurebot: #'sandbox/generate-id

15:47 not_arrdem: ,(generate-id)

15:47 clojurebot: "jEz4"

15:47 annelies: debugging concurrent code is so much fun

15:47 mavbozo: org.clojure/tools.awk ?

15:47 arrdem: mavbozo: org.clojure is by invite only :P

15:48 mavbozo: community.clojure/tools.awk ?

15:48 arrdem: huh. wonder if anyone is using that group..

15:48 nope

15:49 TimMc: "community" is long

15:49 Let's abbreviate it "com".

15:49 amalloy: justin_smith: words that describe themselves: "homological". today's fun trivia fact

15:50 TimMc: Is homological homological?

15:50 justin_smith: amalloy: thanks! I've wanted that word for a while.

15:50 dysfun: okay, the sequences of functions thing, the reason was i wanted to figure out how i could better model this function. the handlers take a ring request map and return a 2-tuple

15:51 https://www.refheap.com/bea95b312aef4fbf0a190a037

15:51 justin_smith: TimMc: the editor edits all texts by people who do not edit their own texts, does he edit his own text?

15:51 arrdem: justin_smith: yes

15:52 weavejester: dysfun: What’s that meant to be doing?

15:52 justin_smith: arrdem: congrats, solved Russel's Paradox, claim your prize

15:52 arrdem: owl allow it

15:52 dysfun: i'm experimenting with abstracting web workflows on a RESTful-ish website

15:53 TimMc: justin_smith: Yes.

15:53 kungi: weavejester: Thank you! I was able to make my code much easier. :-) https://github.com/Kungi/example-component-ring

15:53 mavbozo: TimMc: clojure.com domain name is owned by cognitect, so we go back to community.clojure group

15:53 TimMc: You didn't say "and only".

15:53 justin_smith: oh, crap

15:53 :)

15:53 dysfun: in this case, my thesis is that on most sites, POST actions basically are a simple composition of logic that includes validation, canonicalisation, storage, testing and template/response rendering

15:53 TimMc: I'm also not clear on whether this editor has any of his own texts to edit.

15:53 justin_smith: TimMc: natural language is hard

15:54 dysfun: and i'm experimenting with making functins take ring request maps to try and ease composition

15:54 i was inspired by your routes function, actually, weavejester

15:54 weavejester: kungi: No problem.

15:56 dysfun: So… The “handlers” in the example return either [:success] [:failure] or [:request another-request] ?

15:56 justin_smith: amalloy: TimMc: arrdem: apropos http://en.wikipedia.org/wiki/Grelling%E2%80%93Nelson_paradox

15:56 TimMc: justin_smith: In the case of homological there are at least two possible consistent states.

15:56 dysfun: weavejester: yes. it looks like a state monad if you squint a bit

15:57 TimMc: yeah

15:57 weavejester: dysfun: What’s the purpose of returning a request? And what’s “i”?

15:58 justin_smith: of course, in all this talk of homological, and heterological, we are forgetting to include the very important members of our community, the bilogical, the alogical, and translogical

15:58 TimMc: weavejester: Philosophers have been asking that last question since time immemorial.

15:59 weavejester: TimMc: What’s the command to downvote again…? :P

15:59 annelies: TimMc: POSIX has a utility to find the answer.

15:59 dysfun: the list of handlers going in is of function from request-map to instruction-tuple. :success and :failure cause the the instruction tuple to be returned as-is (that 'i' is a typo, should be 'ret') and :request continues down the chain, but with a modified request map

15:59 so it provides a means of mutating the request map for things further down the chain

16:01 weavejester: dysfun: Hm, okay. So your handler function can either modify the request or return a response.

16:01 dysfun: yes

16:01 llasram: dysfun: You can accomplish the same result with the middleware pattern

16:01 amalloy: TimMc: good; i had concluded the same thing: that homological could consistently be homological or not

16:02 llasram: dysfun: Each middleware function can either handle the request itself or pass (a potentially modified request) on to the next function in the chain

16:02 justin_smith: dysfun: with what you say about composition of logic to make a POST route, it sounds like you are getting close to the idea of what liberator tries to do

16:03 dysfun: i had a look at liberator way back when but i wasn't terribly impressed

16:03 i'll take another look

16:03 justin_smith: dysfun: on a more theoretical level, I could imagine an alternate version of a middleware stack, where each step sees not just the next middleware in the cahin, but a data structure containing all the next steps, and has the option to modify, wrap, or destructure arbitrary elements in the chain. Down that road likely lies complete madness though.

16:04 *s/cahin/chain

16:04 dysfun: i went mad years ago, you can't scare me.

16:05 arrdem: (inc dysfun)

16:05 lazybot: ⇒ 2

16:05 arrdem: someone pass the tea...

16:05 llasram: No tea here. Just ravens and writing desks

16:05 arrdem: but are there burritos in the writing desk?

16:05 dysfun: llasram: it seems a bit stack-messy to go for the middleware pattern

16:06 {blake}: We all go a little mad sometimes.

16:06 mavbozo: dysfun: your idea just looks like pedestal-service's service-routing and interceptors https://github.com/pedestal/pedestal/blob/master/guides/documentation/service-routing.md

16:07 dysfun: mavbozo: i shall read, thanks

16:10 TimMc: weavejester: (dec TimMc) :-)

16:11 mavbozo: justin_smith: "each step sees not just the next middleware in the cahin, but a data structure containing all the next steps" is one of pedestal-service interceptors idea

16:11 TimMc: I almost certainly deserve it at any given time for *some* reason.

16:11 weavejester: TimMc: I was kidding :)

16:11 justin_smith: mavbozo: I had no idea they were so mad!

16:11 ffwacom: is it a Bad Idea to learn clojure without knowing java?

16:12 justin_smith: ffwacom: clojure is a great way to use the java apis

16:12 dysfun: ffwacom: definitely not!

16:12 justin_smith: and you don't need to know java itself for that

16:12 ffwacom: ok cool

16:12 justin_smith: ffwacom: I only learned java recently, as a long time clojure user. I prefer using java libs from clojure.

16:12 {blake}: ffwacom: Nope, but it helps not to be intimidated by Java when learning Clojure.

16:13 ffwacom: {blake}: would a familiarity with java help dealing with the java libs?

16:13 justin_smith: ffwacom: {blake}: yeah - don't need to learn java, but should definitely learn to read javadoc and apply it to clojure interop

16:14 ffwacom: ok cool

16:14 any recommended tutorials and books to start with?

16:14 mavbozo: justin_smith: see the madness for yourself https://github.com/pedestal/pedestal/blob/master/guides/documentation/service-interceptors.md

16:14 justin_smith: ffwacom: javadoc search pane is a cool addon for firefox / chrome that makes javadoc easier to use

16:15 kiwitobes: Anyone here using Intellij / Cursive? I like LightTable but I don't think people are really working on it any more

16:15 justin_smith: ffwacom: then, use the interop api as described at http://clojure.org/java_interop to access those apis

16:15 {blake}: ffwacom: Honestly, Java seems really well documented. I haven't used in a decade or so prior to picking up Clojure.

16:16 justin_smith: ffwacom: I think, rather than needing a tutorial, you can start with the examples on that clojure.org page, and then try applying it to some simple java apis

16:16 {blake}: ffwacom: I just wrote an app that relied heavily on a Java library I wasn't even aware prior to starting the app. It was fine. No troubles just looking at the doc and going "OK, so, in Clojure..."

16:17 justin_smith: ffwacom: simple ones to play with inclojure java.io.File, java.lang.String, java.net.URI

16:17 ffwacom: nice, that's good news

16:17 {blake}: ffwacom: Yeah, as someone who never really dug Java, I find Clojure makes it a lot more interesting.

16:18 justin_smith: ,(.getCanonicalPath (java.io.File. "."))

16:18 clojurebot: #<SecurityException java.lang.SecurityException: denied>

16:18 justin_smith: :P

16:18 that was supposed to be a simple example, heh

16:18 ffwacom: haha no worries

16:19 ,(+ 1 1)

16:19 clojurebot: 2

16:19 justin_smith: another convenient thing, for figuring out java objects quickly, is bean

16:19 ffwacom: :)

16:19 justin_smith: ,(bean (java.io.File. "."))

16:19 clojurebot: #<AccessControlException java.security.AccessControlException: access denied (java.lang.RuntimePermission getFileSystemAttributes)>

16:19 justin_smith: bleh

16:20 anyway, if you run that locally, you get a nice hash map with a bunch of info reflecting the data the object can provide via getter methods

16:20 tuft: ,(bean (java.util.HashMap.))

16:20 clojurebot: {:empty true, :class java.util.HashMap}

16:20 ffwacom: oh nice, good to know

16:20 justin_smith: it's not going to be complete mind you

16:20 technomancy: running group de-dupe

16:20 for clojars

16:20 justin_smith: but sometimes it gives an interesting lead

16:21 mavbozo: (inc justin_smith)

16:21 lazybot: ⇒ 134

16:22 {blake}: Reminds me, I owe a couple incs.

16:22 (inc justin_smith)

16:22 lazybot: ⇒ 135

16:22 {blake}: (inc amalloy)

16:22 lazybot: ⇒ 194

16:22 * mdrogalis bats eyelashes at {blake}

16:22 mdrogalis: Pretty sure I deserve a dec for that one.

16:23 {blake}: lol

16:23 TimMc: (identity mdrogalis)

16:23 lazybot: mdrogalis has karma 7.

16:23 {blake}: Do I owe you? 'cause, yeah, that cancels it out.

16:23 mdrogalis: P much

16:23 TimMc: Hah, how long have we had that?

16:24 * akkad hunts for a scripting solution in a clojure shop that does not require the jvm in the edit/run cycle

16:24 technomancy: raaaaaacket

16:25 justin_smith: ocaml is pretty nice too - it makes small, quick running, quick compiling binaries

16:25 technomancy: if you're going to have clojure hackers modifiying them, racket is a lot quicker to pick up

16:25 but you can't go wrong with either one

16:25 justin_smith: that's very true

16:26 mdrogalis: technomancy: You sure can go wrong. Just *look* at that GitHub syntax highlighting! Strike against Racket.

16:26 technomancy: ._.

16:26 sdegutis: Can you put something like (symbol (str "clojure.string/" "lower-case"))) (not quoted) inside a Clojure macro and trust it'll evaluate as you intend?

16:26 arrdem: ._.

16:26 technomancy: mdrogalis: another couple weeks and clojure hackers will be numb to it though

16:27 either that or there'll be a mass github exodous

16:27 akkad: technomancy: yeah the racket-clojure and rackjure projects come close.

16:27 mdrogalis: Surely it can't be on purpose, right?

16:27 technomancy: akkad: rackjure is great, but raw racket is very passable too

16:28 especially for quick throwaway scripts

16:29 akkad: k

16:29 sdegutis: Does Racket have a way to glue the interpreter into the script?

16:30 technomancy: yeah; you can have it spit out standalone executables

16:30 gfredericks: anybody know why I would have trouble with `lein deploy clojars` when my lib is on a snapshot but not when it's on a release?

16:30 aperiodic: sdegutis: why would you do that instead of 'clojure.string/lower-case?

16:30 technomancy: gfredericks: that might be me; I'm performing intensive DB surgery and sqlite sucks at concurrency

16:30 sdegutis: That is one of my favorite features of Lua is that there's a library that includes a Lua interpreter which loads the script attached to the end of its own binary and runs it.

16:31 technomancy: gfredericks: can you hold off like 10m

16:31 sdegutis: aperiodic: I don't have the string at compile-time, I generate it at macro-expansion time based on macro args.

16:31 technomancy: sdegutis: `raco exe` -> ~700kb standalone thingy

16:31 sdegutis: http://lua-users.org/lists/lua-l/2004-08/msg00489.html

16:31 gfredericks: technomancy: I guess that explains timeouts in particular; I just gave up and did a full release which worked fine

16:31 technomancy: gfredericks: you must have gotten lucky =)

16:32 I should probably switch off uploads for a bit

16:32 I would just like to point out that this is a great reason we should have a paid clojars admin

16:32 justin_smith: sdegutis: one of my favorite things about ocaml is that it compiles to a very small executable that only includes those parts of the lang you use in your code; and the compiler runs fast too

16:33 sdegutis: That's cool.

16:33 technomancy: justin_smith: welllll

16:33 justin_smith: ?

16:33 technomancy: justin_smith: the tree-shaking works to varying degrees

16:33 justin_smith: it doesn't work with jane street core

16:33 sdegutis: I like that about Google Clojure Library too, in theory.

16:33 justin_smith: technomancy: I've had good luck, but then I have never used jane street

16:33 technomancy: it's not very fine-grained, is all

16:33 sdegutis: Er sorry, Google Clojure Compiler.

16:33 technomancy: justin_smith: yeah... grenchman is 10m =\

16:33 supposedly they're working on that though

16:34 justin_smith: technomancy: right, big monolithic libs are going to be an issue

16:34 arrdem: technomancy: the problem is "we" :c I'd be happy to gittip or whatever fund clojars

16:34 justin_smith: technomancy: its still only including the libs you use! it's just that one lib is really big :P

16:34 technomancy: hehe

16:34 TimMc: sdegutis: Closure :-)

16:34 justin_smith: (dec frameworks)

16:34 lazybot: ⇒ -1

16:34 technomancy: arrdem: xeqi tried to start a campaign targeting big corps, but with limited success. maybe something more grassroots would work better

16:34 aperiodic: sdegutis: this sounds crazy. if you don't want to let the user refer to the function directly, why not have, say, a map from expected macro args to the symbol to use when given that arg?

16:35 TimMc: technomancy: I work at a company that uses Clojure. xeqi should poke me.

16:35 sdegutis: aperiodic: I originally had {"GET" 'compojure.core/GET "POST" 'compojure.core/POST}.

16:35 TimMc: (I have no idea if it would be a fruitful effort, but it's worth a shot...)

16:35 sdegutis: aperiodic: I was hoping to remove the redundancy by dynamically generating that symbol instead of using a lookup table.

16:36 And that's why I'm here! :)

16:36 technomancy: for background, this restore is happening because I was asked to remove someone from a group and due to a combination of sloppy argument handling and infamiliarity with korma, I ended up removing EVERYONE from EVERY group

16:36 which wouldn't have happened if clojars were under active development

16:36 sdegutis: Also because I'm super sleepy and my little daughter vomited on a lot of us last night and this morning so we lost some sleep and it's easy to get side-tracked.

16:36 technomancy: so next time someone asks me to perform manual DB ops, I'm just going to tell them to upgrade to clojars pro =)

16:36 arrdem: lol

16:36 https://gratipay.com/on/github/xeqi/

16:36 huh

16:36 sdegutis: But mainly because I'm trying to create a symbol.

16:37 Oh wait! I think this is the wrong way to build a namespaced symbol.

16:37 (doc symbol)

16:37 clojurebot: "([name] [ns name]); Returns a Symbol with the given namespace and name."

16:38 justin_smith: technomancy: haha - you should just list consulting rates: remove someone from a group, $5, add someone $10, remove a jar your posted by mistake $100, fix something in the db for you $500

16:38 sdegutis: technomancy: LLOL (re: the SQL op you ended up with)

16:38 arrdem: I've been fortunate that my $3/wk is enough to keep Grimoire online would be happy to throw money at clojars to keep things alove

16:38 sdegutis: oh wait no, not LLOL, just LOL

16:38 arrdem: *alive

16:39 sdegutis: aloof?

16:39 weavejester: technomancy: What about adding on a “donate” page to Clojars?

16:39 TimMc: There really should be corporate users funding clojars.

16:40 technomancy: weavejester: well, I'm not in a position to accept monies in return for maintenance personally, but I think it would be wise for xeqi

16:40 weavejester: Well, that’s kinda what I mean

16:40 If there’s a donate page on Clojars

16:40 And we give people the option to make their donations public

16:40 justin_smith: technomancy: you know how people always have issues with setting up private maven repos for closed source / internal stuff? secure private repo as a service (spraas)

16:40 weavejester: Then that would give Clojure-orientated companies an incentive to donate.

16:41 technomancy: there's lots of ways it could go, yeah. I think it was wise to start by approaching high-profile clojure-using companies first because it's less messy than a grassroots approach.

16:41 not that they're mutually-exclusive

16:42 weavejester: If I’m giving, say, $100 a month to Clojars and I was listed as the only donator, then larger companies like Cognitect might say, “why aren’t we listed”?

16:42 technomancy: justin_smith: yeah... liability is a big one with that though

16:42 weavejester: So kinda a shaming approach :)

16:42 technomancy: weavejester: sounds good to me =)

16:42 but these kinds of subjects can be sensitive

16:43 bringing in money when you're used to it being a big hippie love-fest etc =)

16:43 arrdem: eh servers and time aren't free

16:43 weavejester: technomancy: Something like the EFF page maybe: https://www.eff.org/thanks

16:44 technomancy: TBH it's astonishing it's been as problem-free as it has

16:45 talios: justin_smith - how hard is it to unzip and run nexus? I don't see why people have a hard time with that..

16:45 technomancy: talios: it's more keeping a server running in general

16:45 weavejester: Though I guess the hard part might be managing taxes and so forth.

16:45 talios: true

16:45 technomancy: applying security patches, keeping user accounts up to date

16:46 arrdem: emergency contracting on accidental pushes :P

16:46 weavejester: Ideally we’d have a company responsible for managing Clojars

16:47 Maybe non-profit.

16:47 technomancy: somebody tell Marc Andressen

16:47 (please don't actually do that)

16:48 * arrdem had to google that reference

16:48 technomancy: he invested in npm, inc

16:48 llasram: Maybe some sort of non-profit Clojure foundation

16:48 arrdem: It'd be nice if we did have a single entity wrapping the various clojure infrastructure projects

16:48 sdegutis: brb googling "Unsupported binding form: clojure.lang.LazySeq@a97d5d6c"

16:48 weavejester: xeqi has a consulting company, so donations could presumably be routed through that initially.

16:49 arrdem: but then that'll introduce a boatload of now absent politics..

16:49 technomancy: arrdem: exactly

16:49 weavejester: I think a Clojure foundation is a little too broad.

16:49 * arrdem ponders the case of CLJFF taking over Grimoire and ClojureDocs, ensuing shitfest

16:50 technomancy: in general being distributed is great; fewer points of failure.

16:50 justin_smith: sdegutis: that means you are using the string representation of a lazy seq where a symbol or destructure is expected, I think

16:50 sdegutis: translation: your macro is too clever

16:50 technomancy: maybe someone brilliant will come up with a distributed clojars replacement and we won't have a spof

16:50 sdegutis: Phew! The only other person Google claims has encountered the error I'm seeing in writing my macro is the guy who wrote Mastering Clojure Macros.

16:51 arrdem: clojure over gittorent..

16:51 nullptr: sdegutis: achievement unlocked!

16:51 sdegutis: (ninc nullptr)

16:51 weavejester: sdegutis: The error says you’re trying to bind something to a seq, which won’t work.

16:51 technomancy: arrdem: it's hard for me to imagine it working without a block chain; you need consensus for how to apply updates

16:52 weavejester: sdegutis: Try using macroexpand to see what the code looks like you’re generating.

16:52 justin_smith: weavejester: ahh, of course. Not the string rep, just putting a seq rather than vector on the lhs

16:52 sdegutis: Good idea. I was only using (macroexpand) to test, but I should be using it to print it out too.

16:52 llasram: ,(eval `(let [~(seq ['a]) [1]] a))

16:52 clojurebot: #<CompilerException java.lang.Exception: Unsupported binding form: (a), compiling:(NO_SOURCE_FILE:0:0)>

16:52 weavejester: justin_smith: Right

16:52 * arrdem raises hackles at the blockchain

16:52 arrdem: technomancy: I think you could get surprisingly far by just distributing artifacts over bittorent as-is with signatures

16:53 technomancy: that just leaves the artifact discovery problem open

16:53 sdegutis: Also, how dumb of an idea is it to assert that (= (macroexpand '(my macro)) (macroexpand '(someone elses macro)))

16:53 technomancy: arrdem: well, how the heck else do you get decentralized consensus on a series of events

16:53 weavejester: technomancy: The latest version is controlled by the author of the app. There’s no double-spending problem to be solved because if I release 1.0.2 then by definition it’s later than 1.0.1.

16:54 justin_smith: sdegutis: false positives because ##(= '(1) [1]) but as we have seen, the former doesn't work in a destructure

16:54 lazybot: ⇒ true

16:54 arrdem: technomancy: I'm with weavejester I don't think this is really a distributed problem at all. Really this is a global, signed, write-once datastore.

16:54 sdegutis: Oooooh.

16:55 That explains everything maybe!

16:55 justin_smith: sdegutis: like a more skeptical Archimedes

16:55 weavejester: arrdem: Yeah. You can write a new version out to the datastore, or write a deprecation/retraction notice for that version.

16:56 technomancy: arrdem: what about two users attempting to claim a new group-id?

16:56 justin_smith: technomancy: race condition, first one there wins

16:56 weavejester: technomancy: That’s a good point :)

16:56 justin_smith: Distributed race conditions = double spending problem

16:56 justin_smith: right

16:56 sdegutis: Found it I think? https://gist.github.com/trptcolin/418759

16:56 hyPiRion: justin_smith: what happens if I somehow manage to get org.clojure first?

16:56 arrdem: weavejester beat me to it :P

16:56 hyPiRion: GG no re

16:57 justin_smith: weavejester: I was just thinking about how literally that was a data race (they are racing for that identifier)

16:57 technomancy: anyway, there are jvm blockchain implementations, right?

16:57 someone do this plz

16:57 weavejester: Yeah, like BitcoinJ

16:57 However

16:57 arrdem: cljcoin

16:57 sdegutis: So, (vec) saved the day.

16:57 arrdem: GUYS WE CAN USE DOGECOIN

16:57 weavejester: Maven isn’t really blockchain friendly :)

16:57 * arrdem will sit down now

16:57 sdegutis: Oops I'm on the wrong channel.

16:57 OceanBlues: hi all

16:57 justin_smith: arrdem: CLOJECOIN

16:57 sdegutis: Oh wait no this is right.

16:58 weavejester: Sometime we really have to move away from Maven. Their versioning makes me angry.

16:58 arrdem: kludgecoin...

16:58 gfredericks: arrdem: technomancy: so currently if somebody is obviously group-id squatting that's fixable

16:58 hyPiRion: OceanBlues: hello there

16:58 weavejester: It’s just. so. bad.

16:58 technomancy: gfredericks: FSVO obvious

16:58 OceanBlues: someone know were can I find clarix, it's not into clojars

16:58 technomancy: gfredericks: it requires a judgement call, which means centralized authority

16:59 llasram: weavejester: IMHO everything else is slightly worse, but obviously YMMV

16:59 weavejester: technomancy: If I was going to email xeqi regarding Clojars, who do you think I should CC?

16:59 ffwacom: are all clojure types java types?

16:59 technomancy: weavejester: ato@meshy.org and myself, I guess

16:59 gfredericks: technomancy: I know, I'm pointing out that once you decentralize people could squat arbitrarily

16:59 technomancy: we are the current triumvirate

16:59 weavejester: llasram: I haven’t seen versioning quite as crazy as Maven’s.

16:59 gfredericks: would I guess would be a sort of DOS on the system

16:59 technomancy: gfredericks: /me nods

16:59 pandeiro: what's the smart way to check if an element exists in a vector by identity?

16:59 sdegutis: brb gonna go roast some garlic and spread it on bread

16:59 talios: weavejester - you've not seen Java's new versioning scheme then yet have you?

17:00 arrdem: weavejester: technomancy: gfredericks: we don't need a new coin.. namecoin exists

17:00 {blake}: ffwacom: No.

17:00 justin_smith: OceanBlues: do you know where to get the jar?

17:00 ffwacom: {blake}: cheers

17:00 weavejester: talios: I’d be impressed if it was worse.

17:00 talios: How bad is it?

17:00 OceanBlues: no, I don't justin_smith

17:00 llasram: pandeiro: you mean like? (some (partial identical? x) v)

17:00 justin_smith: OceanBlues: if so, there is a way to put it into your local cache via lein

17:01 OceanBlues: so first step, is to find some source of that lib then

17:01 OceanBlues: I'm trying to get via lein

17:01 gfredericks: arrdem: http://bitcoin.stackexchange.com/questions/3644/namecoin-is-there-any-rationale-behind-the-apparently-foolish-choice-of-havin

17:01 talios: weavejester - http://openjdk.java.net/jeps/223 - major.minor.security

17:01 pandeiro: llasram: yeah that works

17:01 llasram: weavejester: Yeah, maybe specifically the versioning. But the way the overall package-management system works, I do prefer Maven

17:01 (via Leiningen, of course)

17:02 justin_smith: OceanBlues: like I said, if you can find the jar anywhere, you can use lein to install it locally once you have it

17:02 OceanBlues: but tell me don't find

17:02 weavejester: talios: Oh, I meant more Maven’s weird dependency resolution

17:02 justin_smith: OceanBlues: right, because nobody uploaded it to maven central or clojars, it seems

17:02 technomancy: how convenient that this problem happened to be raised the week of the conj

17:02 OceanBlues: I problem is that I don't know where to find the jar

17:03 technomancy: anyway you guys go figure everything out at a pub after the sessions or whatever and let us know what you decide

17:03 weavejester: talios: Like if package X requires Z 1.0-1.2, and package Y requires Z 1.1, what version number of Z do you think Maven will pick?

17:03 llasram: technomancy: Oh, are you not going this year?

17:03 technomancy: llasram: unfortunately I can't make it

17:04 llasram: *sad face*

17:04 OceanBlues: to install is not my trouble

17:04 llasram: Well now it hardly seems worth having the Conj at all

17:04 * llasram calls the whole thing off

17:04 TimMc: technomancy: I demand a bas relief of you, ato, and xeqi as the Fates

17:04 arrdem: (inc TimMc)

17:05 lazybot: ⇒ 82

17:05 technomancy: cardboard cutouts maybe?

17:05 mavbozo: joe armstrong has a crazy idea of using sha1 of source code as name & version and using service like kadimla as service-discovery

17:05 justin_smith: OceanBlues: how do you know this library exists?

17:05 OceanBlues: what I neet it to get the lib

17:05 TimMc: technomancy: This is acceptable.

17:05 technomancy: mavbozo: yeah, IMO the technical questions are less interesting than the social ones though

17:05 OceanBlues: because comes as reference into a book

17:05 hyPiRion: llasram: let's be sad together

17:06 OceanBlues: maybe it's wrong, maybe not

17:06 arrdem: well if we're gonna build a custom package manager for Clojure, we may as well take the opportunity to make sure that it enforces SemVer

17:06 technomancy: arrdem: haha, good luck

17:06 llasram: hyPiRion: I agree to this plan. I did buy non-refundable plane tickets

17:06 arrdem: technomancy: hey we can totally prove that you do or do not superset the existing API :D

17:07 technomancy: arrdem: technically every bug fix is an incompatible change

17:07 hyPiRion: llasram: I have 6 plates of chocolate I'll bring to (attempt to) remedy the absence of technomancy

17:07 technomancy: have fun with that one =)

17:07 arrdem: (dec state)

17:07 lazybot: ⇒ -1

17:07 arrdem: wow only -1? come on people what are we doing

17:07 hyPiRion: if someone bring the ice cream we're set

17:08 llasram: someone: got that?

17:08 justin_smith: OceanBlues: the reason I ask, is if I google search for clarix I find nothing that looks like a java or clojure library

17:08 hyPiRion: oh, that's an actual person.

17:08 llasram: Well, it's a real (poorly-chosen) handle :-)

17:08 nullptr: state was -Infinity but it seems to have been reset ... just can't figure out where ... curse you, state!

17:09 llasram: Aaaanyway, speaking of the Conj -- time to go home and pack

17:09 OceanBlues: justin_smith I know I've asked to google so :D

17:09 sdegutis: Is there a Clojure pre-compiler that uses significant whitespace in place of parentheses?

17:10 talios: weavejester - 1.2 - as specified. highest wins. "1.1" is a suggestion. If you want exact - "[1.1]". well known fact.

17:11 weavejester: talios: Right, except that’s almost never what you want.

17:11 alandipert: sdegutis: https://github.com/one-more-minute/chiara is pretty excellent

17:11 talios: weavejester - you want the build to fail? or constrain down to 1.1?

17:12 weavejester: talios: One package is saying, “I’ll be happy with anything from 1.0 to 1.2”, and the other package is saying, “I kinda like 1.1”, then the obvious solution is to use “1.1”.

17:12 talios: Maven is really strict about version ranges. IIRC there’s no way to override them.

17:12 talios: weavejester - maybe. "i kinda like 1.1, but I'll take anything higher".

17:13 weavejester: talios: And open version ranges tend to suck up snapshots

17:13 whodidthis: can i clojure.string/trim in a prismatic schema

17:13 TimMc: weavejester: You also have to handle alphas and such intelligently. (Which Maven does not.)

17:13 sdegutis: alandipert: That's.... interesting.

17:13 talios: weavejester - well there is, dependency exclusions - but that gets really nasty. the core problem is that compile-time dependencies are transitive,

17:13 which they shouldn't be

17:13 weavejester: TimMc: Right, which is another problem with Maven

17:14 Ideally version ranges should be suggestions.

17:14 The project owner should be able to override.

17:14 OceanBlues: justin_smith thank you. I begin to think it could be an old library

17:15 I've found some reference into github, but not a link

17:15 weavejester: So I release a library with a version range of 1.4-1.6, that just means I’ve tested this library on those versions. It’s not a hard lock.

17:15 talios: weavejester - that's one of the ongoing discussions for the new POM format - global exclusions

17:16 among others - sadly those changes can only really be done for the 'build pom', not the consumer pom

17:16 sdegutis: The tests all pass when using the auto-runner but not when using the plain runner.

17:17 This is a riddle btw.

17:18 xeqi: weavejester, arrdem, TimMc: theres a number of legal issues surrounding a service that allows users to upload almost anything that become more important once $$ is involved

17:18 weavejester: IMO a dependency should look like: [name #{versions}]

17:18 OceanBlues: mistake resolved, library is not clarix, is clatrix, last version 0.4.0 into clojars

17:18 arrdem: xeqi: have you gotten a DMCAwesome complaint yet?

17:19 xeqi: arrdem: that requires having a DMCA registered agent

17:19 technomancy: I would actually seriously consider moving it out of the US

17:19 xeqi: but thats #1 or #2 on my list

17:20 most of this is easy to solve

17:20 I've just been stuck while reaching out to _ato, as I haven't heard anything from him in the past 2 months

17:21 (since I got enough free time to start trying to maintain it)

17:21 sdegutis: weavejester: What was the motivation behind having (GET/POST/etc) be macros, rather than having (defroutes) accept pure data, such as [:get "/bla" ...]?

17:22 weavejester: sdegutis: It allows for flexible composition of routes.

17:22 sdegutis: Oh.

17:22 weavejester: sdegutis: Routes can decide to accept or reject based on arbitrary criteria.

17:22 xeqi: I'd end up pulling everyhing clojars under my consulting company for the corporate sheild

17:22 sdegutis: weavejester: Oh, you mean how a route fn can return nil and pass the request on?

17:22 amalloy: sdegutis: routes are functions, and you can combine two functions to get a function

17:22 weavejester: sdegutis: Right. There are alternatives to Compojure that use a static data structure. i.e. trade flexibility for transparency.

17:23 technomancy: arrdem: https://github.com/project-douglas/the-tao-of-dao/blob/master/_posts/2014-03-06-introducing-ethereum-package-manager.md

17:23 sdegutis: amalloy: thank you sir/gentleman/scholar

17:23 weavejester: xeqi: That’s what I figured you’d do :)

17:23 amalloy: you can't easily combine two of these data structure things and get out another one that makes sense

17:23 sdegutis: weavejester: interesting

17:23 arrdem: technomancy: huh that may actually get me to look seriously into ethereum

17:23 xeqi: but for anyone interested in the the more general discussion of a clojure foundation, you might talk to bridget hillyer and/or daniel solano gomez

17:24 technomancy: arrdem: don't take it too seriously; a few links are 404ing

17:24 arrdem: technomancy: sure but the idea is interesting

17:24 xeqi: we've passed a few emails around along with puredanger about it, and I know they were seriously interested

17:24 arrdem: technomancy: and from what I understand ethereum does provide a bunch of the infrastructure that you'd need for this sort of thing

17:25 weavejester: xeqi: If you need a corporate donator to encourage others to join in, I’d be happy to step up and contribute a modest amount each month to Clojars.

17:26 xeqi: So for a brief time I can be Clojar’s top sponsor ;)

17:26 technomancy: https://clojars.org/leaderboard

17:27 arrdem: lol

17:27 xeqi: weavejester: heh, thanks

17:27 kzar: (doto h (.setEnabled true)) could be written as (.setEnabled h true) right?

17:27 xeqi: I did get one serious offer that I've had to table while waiting

17:28 arrdem: I'd be happy to throw some money at clojars as well. that Cider gets $23/wk in tips and you don't is... silly to say the least

17:28 technomancy: the leaderboard would have both "code released" and "money contributed" axes

17:28 arrdem: s/cider/bbatsov/g

17:28 xeqi: bah, bbatsov should get more then that

17:28 weavejester: kzar: The side effects would be the same, but the return value would be different.

17:29 kzar: weavejester: Right, thought so. I don't care about return value in this instance

17:29 weavejester: technomancy: I like that idea :)

17:29 xeqi: also, I guess I should publically lambast technomancy for trying to run untested code on a repl in a live server

17:29 * xeqi fistshakes

17:30 cprice404: +1, would contribute some $$ to clojars

17:30 technomancy: I'll be the fall guy.

17:30 justin_smith: ,(doto 'technomancy :lambast)

17:30 clojurebot: technomancy

17:31 arrdem: (inc justin_smith)

17:31 lazybot: ⇒ 136

17:31 technomancy: "Contribute to clojars, or technomancy will have to keep running random defns in a live repl using libraries he hasn't touched in three years"

17:31 nickik: Maybe im just stupid, but does anybody know how to get the data that I past into pedestal (its a POST request)?

17:32 dbasch: technomancy: you could have a “featured artifact” slot that refreshes every 24 hours and goes to whoever pledges the most BTC or something

17:33 arrdem: google ads for clojars packages!

17:33 xeqi: so I guess you guys are for me totally selling out

17:35 badges for users, special skins for packages

17:35 oooh oohh

17:35 arrdem: inb4 hats

17:35 justin_smith: xeqi: hats for package avatars

17:35 lol

17:35 hfaafb: badgers for users

17:35 xeqi: you have used X/1 upload energy this month. Buy crystals for recharging!

17:35 arrdem: justin_smith: CALLED IT

17:35 justin_smith: you did

17:35 sdegutis: weavejester: I like a ton of what Compojure does, I wouldn't want to switch to a different library just to get a DSL that takes data instead of functions, because then I'd be missing out on all the other stuff your library does.

17:35 amalloy: xeqi: in-app purchases

17:36 OceanBlues: see you

17:36 dbasch: clojars gold, just like reddit gold but less useful

17:36 xeqi: dbasch: reddit gold is useful?

17:36 amalloy: dbasch: how is this possible?

17:36 dbasch: xeqi: no

17:36 mavbozo: nickik: what's the code look like?

17:36 dbasch: amalloy: usefulness can be negative

17:37 amalloy: ah. so clojars gold comes with a free rabid beaver delivered to your apartment when you're not expecting it?

17:37 mavbozo: nickik: your interceptor code?

17:38 dbasch: amalloy: I like that, but it has some probability of being useful depending on who visits you

17:38 hiredman: alternatively someone should figure out how to graft maven on to bittorrent in a way that preserves some amount of trust

17:39 amalloy: hiredman: "i trust that maven grafted onto bittorrent will still result in downloading the whole internet"

17:39 dbasch: Ubuntu Rabid Rodent, how did they miss that

17:39 talios: hiredman - bittorrentsync based wagon provider should solve that.

17:40 hiredman: talios: I don't think it is that easy

17:41 talios: I don't think clients doing downloads run long enough to help serve other clients, so you would need something beyond just the wagon

17:42 sdegutis: speaking of reddit http://www.reddit.com/r/shittyaskscience/comments/2mhbth/if_heat_rises_why_isnt_the_sky_on_fire/

17:42 hiredman: you would also need to either get really serious about artifact signing, or come up with something else

17:42 TimMc: dbasch: Maybe in 12 years when they come back around to R...

17:42 technomancy: hiredman: there's still the question of claiming group-ids.

17:42 hiredman: right

17:43 dbasch: technomancy: you could claim one per bitcoin block?

17:43 gfredericks: hiredman: artifact just-leaving-it-on-the-front-step-and-crossing-your-fingers

17:43 nickik: mavbozo, hi, like this ["/:index" {:get get-index

17:43 :put make-move}]

17:44 sdegutis: Is (ns) officially the way to create Clojure files, or is it just a convention that happened to be adopted universally?

17:44 nickik: I do PUT /5 {:connect 5}

17:44 How can I get the {:connect 5} body

17:45 hiredman: we just had a little bit of a hiccup at work were due to mucking with the kernel for $REASONS we lost the node that was running our archiva node, which lead to the discovery of not good enough backups, which lead to a recovery of our artifacts out of various persons ~/.m2 directories

17:45 which, well, if you formalized would be sort of like bittorrent

17:45 TimMc: technomancy: Namecoin is a thing, although I haven't researched it.

17:45 nickik: mavbozo, see the hole routes table http://paste.lisp.org/display/144407

17:46 TimMc: hiredman: We had a serious internet outage at the office some months back and I was *seriously* considering going around with a thumb-drive and having people rsync stuff onto it.

17:46 (I guess it was very serious. Seriously.)

17:46 arrdem: namecoin for groupids would probably work just because it'd be a shake and bake implementation of the blockchain "first registrant wins"

17:47 I was kicking around the idea of Web of Trust, since apparently we trust xeqi and technomancy with our packages :P

17:47 most trusted package wins given a name conflict..

17:48 mavbozo: nickik: assuming your make-move handler like this (defn make-move [req] ...)

17:48 sdegutis: Like, can you have a Clojure file that doesn't have an (ns) form at the beginning?

17:48 AimHere: Surely the most trusted package is the package manager

17:49 arrdem: naturally

17:51 nickik: mavbozo, yes

17:52 I tried things like (:body request) and othres

17:52 I cant find documentation on this

17:52 TimMc: sdegutis: You could, but you'd have to manually set up the namespace in external code and then load the file in the context of that ns.

17:52 sdegutis: Anyone have thoughts on Joodo? http://joodoweb.com/

17:52 TimMc: So.... why?

17:53 justin_smith: nickik: something I find useful is (def debug (atom nil)) and then inside the handler (reset! debug request), then in the shell (keys @debug) and whatever else I want to try until I see what data is where

17:53 nickik: assuming you have a shell inside the same process as the pedastal server

17:54 TimMc: clojure.core does it. Not to say that proves it is a good idea.

17:54 hyPiRion: TimMc: Couldn't you just connect via the intranet? I mean, you should be able to reach people even if the connection to the outside world fails.

17:55 TimMc: hyPiRion: I think intranet was down, come to think of it.

17:55 hyPiRion: ah

17:55 TimMc: squirrels in the telecom room or something

17:55 nickik: interesting idea in general, but how is that diffrent then just looking at the request param

17:56 justin_smith: nickik: it is interactively using it, which can be much more expedient than trying to read a large structure

17:56 hyPiRion: TimMc: wat

17:56 TimMc: Just guessing.

17:56 It was down and then it was back up. I never found out what the issue was.

17:56 justin_smith: nickik: also, lets you write code that accesses the exact request data in the repl, which can speed up development

17:57 * hyPiRion is bad at detecting jokes today

17:57 TimMc: justin_smith: clojure.core splits an ns into multiple files; I think sdegutis was suggesting not even having an ns block.

17:57 hyPiRion: We had a broken water pipe right over our server room 2 weeks ago actually. That was a rather interesting experience.

17:57 justin_smith: TimMc: a classic is when someone plugs an ethernet cable, both ends into one box

17:58 TimMc: then he is just in ns user the whole time, but I thought he would be doing it from another file that does have an ns block

17:58 sdegutis: I've beg{a,u}n to disagree with the way mainstream Clojure is written as being the best way, and I'm experimenting with new techniques.

17:58 I like Clojure a lot, but I don't like the structure of our app at all. It's a stereotypical Clojure web app too.

17:59 hyPiRion: You could always try swearjure

17:59 nickik: The body is #<HttpInputOverHTTP HttpInputOverHTTP@38d2dd9b> im not sure what that means

17:59 justin_smith: sdegutis: well, that yak aint gonna shave itself

17:59 nickik: it's an input stream

18:00 you can call slurp on it

18:00 sdegutis: Are ##(ns foo) and ##(in-ns 'foo) exactly identical?

18:00 lazybot: (ns foo) java.lang.SecurityException: You tripped the alarm! in-ns is bad!

18:00 (in-ns (quote foo)) java.lang.SecurityException: You tripped the alarm! in-ns is bad!

18:00 justin_smith: nickik: or whatever else you would do with a java.io.InputStream

18:00 sdegutis: Ah.

18:00 Thanks lazybot for telling me that's a macro and expanding it for me.

18:00 justin_smith: sdegutis: in-ns does not create the default clojure.core mappings

18:00 sdegutis: Ahh.

18:01 nickik: should it not be easier then doing this by hand, can I not just tell pedestal that I expect edn?

18:01 sdegutis: Sweet!

18:01 I have some very real ideas.

18:02 justin_smith: nickik: well, thanks to doing this much by hand, we have established that nothing is consuming / interpreting the request body. Yeah, the sane next step is to tell pedastal how to interpret the request body so you can access it more conveniently.

18:02 nickik: slurp seams to have crashed ...

18:03 So there are no body parsing intersepters provided?

18:03 justin_smith: nickik: I would be very surprised if they are not available

18:03 but you have evidence that they have not been applied

18:05 mavbozo: nickik: put "Content-type: application/edn" in your request header

18:05 nickik: like curl -H "Content-type: application/edn"

18:06 nickik: ah, so if the header is correct it does it automaticlly

18:06 sdegutis: Wait a second, why does (prn *ns*) say #<Namespace user> in a file that starts with (ns foobar.core) ?

18:06 justin_smith: sdegutis: is the prn happening inside a function or at the top level?

18:06 mavbozo: nickik: {:connect 5} is in :edn-params key

18:06 sdegutis: Oh, apparently it's set to 'user during -main

18:06 justin_smith: during -main

18:06 justin_smith: *ns* is only foobar.core while that is being compiled

18:07 sdegutis: Where is it documented to be 'user during -main?

18:07 justin_smith: 'user is always the default ns

18:07 amalloy: sdegutis: *ns* is only set to anything useful at compile time

18:07 sdegutis: Oh. Thanks :)

18:07 amalloy: justin_smith: tbh i would have guessed that clojure.core was the default

18:07 arrdem: it's application/json, right?

18:07 justin_smith: amalloy: but the repl

18:08 amalloy: $google json mime type

18:08 lazybot: [What is the correct JSON content type? - Stack Overflow] http://stackoverflow.com/questions/477816/what-is-the-correct-json-content-type

18:08 sdegutis: amalloy: wouldn't that make all defs be visible to all new namespaces?

18:08 justin_smith: sdegutis: defs are global, but namespaced

18:09 amalloy: sdegutis: that's a good point, although not quite right: we're talking about what it is at runtime, and you aren't def'ing anything at runtime

18:09 sdegutis: o

18:09 Okay thanks.

18:10 mavbozo: nickik: the body-params interceptor handle that automatically based on known content-type

18:12 nickik: I see, cool

18:12 brucehauman: this is soo late in the game but I’m checking to see if any of ya’ll want a Clojure conj ticket.

18:12 film42424: Question for anyone around: I'm trying to implement an interface, but I need several default state variables. Is it better to use reify and a let-block, or should I use deftype and create a function to make sure default state vars are assigned? code: https://github.com/film42/hn-follow/blob/gt/poller/src/hn_follow/core/poller.clj#L13-L16

18:14 justin_smith: film42424: reify+defaults doesn't make since, because reify creates one offs - or do you want a generator function for one-off classes that has defaults?

18:14 s/since/sense

18:14 but either way, the most sensible thing is a function that creates an instance of the right thing, and that function can merge in defaults

18:15 film42424: justin_smith: ok. It just feels weird to open default params that shouldn't be exposed like that

18:15 mavbozo: nickik: looking at the source code the default supported content-type are application/edn, application/json, application/x-www-form-urlencoded, application/transit+json, application/transit+msgpack

18:15 justin_smith: film42424: why would applying defaults inside a function be "opening" them?

18:16 film42424: Just because the type is still in the namespace

18:16 amalloy: film42424: reify in a let-block is a pretty normal way to get a stateful implementation of an interface

18:16 {blake}: brucehauman: For how much?

18:16 brucehauman: I’m willing to work with ya at this point.

18:17 [blake] let me know what you are thinking

18:18 {blake}: brucehauman: Just wondering if I could swing it (ticket, flight, room).

18:18 film42424: Ok, thanks amalloy and justin_smith

18:18 brucehauman: [blake] i’d rather have someone who would benefit use it than let it go to waste

18:19 m1dnight_: is there a way to take a function (a set of expressions wrapped in a parameterless lambda) and execute it, but cancel it if needed?

18:19 justin_smith: m1dnight_: ##(doc future-cancel)

18:19 lazybot: ⇒ "([f]); Cancels the future, if possible."

18:19 m1dnight_: I know in java you have for example isInterrupted() but that requires an explicit check

18:19 justin_smith: my favorite doc string evar

18:20 m1dnight_: hrm, it's the "if possible" that bugs me

18:20 nickik: mavbozo justin_smith thanks for your help

18:20 m1dnight_: but I might be able to do something with that

18:20 dbasch: justin_smith: lazybot was sent to find John Connor. Are you John Connor?

18:21 arrdem: lazybot is our only hope

18:21 dbasch: justin_smith: but you can reprogram lazybot. Or have you already?

18:22 justin_smith: m1dnight_: https://www.refheap.com/93603 future-cancel works

18:23 m1dnight_: hrm, I might look into that

18:23 I think I can use it as a tool in this scenario

18:23 Ideally a call/cc wouldve been more elegant

18:23 justin_smith: m1dnight_: the output is a bit weird of course, but hopefully what happened there makes sense

18:23 m1dnight_: but you can't always get what you want

18:23 yeah it sure does :) thnx

18:24 I had a thesis meeeting today :p "i'm finding it a bit more difficult than anticipated"

18:24 reply: "well.. of course.."

18:24 justin_smith: m1dnight_: I would be hesitant to do that without a sleep in the loop, even a fairly short one

18:24 m1dnight_: I realize that

18:24 justin_smith: cool

18:24 m1dnight_: But I think I don't really need granularity in cancellation

18:25 but I do need assurance of cancellation

18:25 I think trying it out would be best

18:25 justin_smith: m1dnight_: note the realized? function (and the return value of future-cancel)

18:29 m1dnight_: A few minutes on the whiteboard and I think it's perfect

18:29 combined with an add-watch

18:29 et voila :p

18:29 I love it when a plan comes together! :p

18:29 clojurebot: Pardon?

18:30 justin_smith: glad I could help

18:30 m1dnight_: well clojurebot, I mean that my brain excreted endorphines when a certain outcome of a scenario is what I want it to be. Is that clearer?

18:31 kzar: Trying to get a Clojurescript repl work, started the server with `lein trampoline cljsbuild repl-listen` and trying to connect to it using clojure.browser.repl/connect. When server is running and I load the page it never completes, but never connects. When the server isn't running I instantly get back a connection refused error

18:38 csd_: Really enjoying Clojure Cookbook

19:09 justin_smith: $ping

19:09 lazybot: justin_smith: Ping completed in 0 seconds.

19:09 justin_smith: technomancy: fustirge is spamming

19:17 amalloy: justin_smith: the ping command is really weird. it doesn't really seem to do what it says it does

19:18 justin_smith: $ping example.com

19:18 lazybot: justin_smith: FAILURE!

19:18 justin_smith: $ping refheap.com

19:18 lazybot: justin_smith: Ping completed in 0 seconds.

19:24 andyf: amalloy: https://github.com/jonase/eastwood#unused-meta-on-macro. I think you suggested this idea. Thx

19:25 amalloy: andyf: i didn't suggest the eastwood linter, just opened the jira ticket. someone else suggested a linter. glad to see it, though

19:26 andyf: using def in that first example is a little weird, since the metadata there has no impact as far as i'm aware

19:27 andyf: amalloy: Yeah, example should be better

19:27 amalloy: the rest of the description is well-written, as i said about one of your earlier drafts

19:28 andyf: I should wrap them inside .close calls like later examples

19:30 csd_: Is it possible to reset *out* without opening a new REPL session? I somehow broke something while fooling around with `with-open`, and now I can't print to it.

19:31 justin_smith: csd_: you can reconnect to the same nrepl server, and get a working *out* binding in that session

19:31 if you are running nrepl (which is likely if you are using lein)

19:31 csd_: ok

19:31 justin_smith: technically it is a different session, but it's the same clojure instance

19:32 csd_: do you know what happens when *in* and *out* break? i get a similar problem if I halt execution while (read-line) is looking for input

19:32 justin_smith: so everything you were defining is still there, but things like *out* and *in* and *1 and *e are all rebound

19:32 csd_: not really, but I don't use (read-line) in the repl very often

19:34 csd_: that trick worked, thanks

19:34 akkad: clojure-py it is

19:35 arrdem: akkad: check out pixie :D

19:35 AeroNotix: What do people use for their graphite metric exporters?

19:35 I'm not satisfied with the current stuff

19:36 csd_: justin_smith: how would you personally send a complicated string to stdout. right now it seems to me the best option is just to create a StringBuilder and append to it as necessary. i'm wondering whether there might be a better approach

19:36 AeroNotix: current being codahale, dropwizard java libraries

19:36 justin_smith: csd_: str uses a StringBuilder btw

19:36 akkad: pre-alpha./

19:36 justin_smith: but some things are easier if you explicitly use a StringBuilder, yeah

19:37 but definitely construct the whole thing before printing

19:37 amalloy: csd_: also, printf and format

19:37 csd_: i'd love to find some resource that makes me more comfortable on when to use mutability

19:38 justin_smith: csd_: if there is no code-path that leaves the current thread, and you don't return the mutable value, it is probably OK - but still only opt into mutability when it is needed

19:38 sometimes returning a mutable thing can be OK, if it is only passed forward and not mutated concurrently, and using an immutible value is excessive overhead. But profile first.

19:38 csd_: what about atoms used infrequently to track state at a namespace level?

19:39 amalloy: csd_: an antipattern

19:39 because it makes your whole program a singleton

19:39 justin_smith: csd_: I am OK with that if the atom is named "debug" and isn't in any code that ships

19:39 if any logic depends on the atom contents, probably a sign of poor design

19:40 amalloy: it's also okay-ish for an application, where you know that being a singleton is okay, although usually it turns out a lot cleaner if you design as if multiple instances are possible anyway

19:40 justin_smith: right

19:40 csd_: by singleton do you just mean that it prevents code reuse?

19:40 justin_smith: csd_: it means two different parts of the same code base can't use the same lib

19:40 because it holds state

19:41 what if you write lib a, that uses a global atom, and I want to use libs b and c that both want to use lib a

19:41 I'm probably stuck

19:41 csd_: i was thinking though that the alternative to using globals for state is to cram them all into a map that gets passed from function to function, and that doesn't seem particularly elegant to me either

19:41 justin_smith: csd_: it works

19:42 sdegutis: Do you absolutely need to use :gen-class when deploying a pure Clojure stand-alone .jar?

19:42 justin_smith: sdegutis: absolutely not

19:42 java -cp some.uber.jar -m some.uber.main

19:43 errr

19:43 java -cp some.uber.jar -m clojure.main some.uber.main

19:43 sdegutis: Thanks!

19:43 justin_smith: something like that

19:43 you can make clojure load that ns/ run that main

19:43 sdegutis: fustirge: spambot

19:49 Where did load-script go?

19:49 ,load-script

19:49 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: load-script in this context, compiling:(NO_SOURCE_PATH:0:0)>

19:49 dbasch: sdegutis: clojure.main

19:50 sdegutis: Also, is there a better way of doing this? (load (slurp (io/resource "bla.clj")))

19:50 Or maybe I meant s/load/eval/

19:50 andyf: load-file maybe ?

19:51 sdegutis: That seems to not find stuff in my jar's resources.

19:53 andyf: sdegutis: Do you have :resource-paths in your project.clj ?

19:54 sdegutis: andyf: Ah no, but it's just ./resources/

19:54 andyf: Verified that bla.clj is really in your jar ?

19:54 sdegutis: Nope :)

19:55 andyf: I don't know if there is a default for resource path or not

19:55 justin_smith: andyf: load-file wouldn't load from the classpath would it?

19:55 andyf: I haven't tried, but don't know a reason why not off hand

19:56 sdegutis: Right now I'm just doing (eval (read-string (slurp (io/resource "bla.clj"))))

19:56 justin_smith: sdegutis: perhaps you want load-string

19:56 sdegutis: Yep!

19:56 justin_smith: (load-string (slurp (io/resource ...)))

19:56 sdegutis: That's way better.

19:56 justin_smith: oooh

19:57 try (load-reader (io/resource ...))

19:57 that should work

19:57 sdegutis: java.net.URL cannot be cast to java.io.Reader

19:57 justin_smith: OK

19:57 so load-string it is

19:59 (load-reader (io/input-stream (io/reader ...))) works

19:59 three calls, either way

19:59 sdegutis: I'm still trying to find a way to make it work with load-file

20:00 Or maybe even (load).

20:00 https://clojuredocs.org/clojure.core/load -- seems to suggest it looks in jar's resources.

20:00 Except that I want it in the stand-alone uberjar.

20:08 amalloy: sdegutis: resources are included in the uberjar

20:15 justin_smith: amalloy: (load (io/resource "name.clj")) gives "URL cannot be cast to String"

20:16 amalloy: justin_smith: okay?

20:16 justin_smith: amalloy: sorry, misread some backscroll

20:24 sdegutis: oh, (load "/foo/bar") will find src/foo/bar.clj

20:25 the trick is to leave off the .clj part

20:25 (and put in a / to make it classpath relative)

20:28 sdegutis: justin_smith: But that won't find src/foo/bar.clj in the uberjar.

20:28 justin_smith: yes, it will

20:28 sdegutis: !!

20:28 justin_smith: the leading / means look int the classpath

20:28 sdegutis: My earlier test must have then been faulty.

20:28 justin_smith: did you have a leading / ?

20:28 sdegutis: Ahh, nope.

20:28 justin_smith = gentleman + scholar

20:31 justin_smith: that even works without io/resource

20:31 justin_smith: sdegutis: right

20:31 sdegutis: (load "/foo/bar") will find src/foo/bar.clj

20:31 Awesome!

20:31 justin_smith: indeed

20:32 sdegutis: This is going to make my view files a lot slimmer.

20:33 justin_smith: sdegutis: I like the greater referential transperency of require, and putting the whole ns definition in one file

20:33 sdegutis: in the very least, put a comment in the file you are loading indicating who loads it...

20:33 sdegutis: I'm doing a convention-over-configuration thing here.

20:33 So it'll be clear who uses it by its path.

20:34 Oh no! The return value from (load) seems to be nil now!

20:34 justin_smith: yeah, load-reader returns the last thing in the file, load returns nil

20:34 for whatever reason...

20:34 sdegutis: Weird.

20:35 Dang, it was just (load "/foo") for a second.

20:35 Now it's gotta be that 3-call long thing again :(

20:35 arrdem: makes sense to me... we need a way to load reading a value for files like data-readers

20:35 justin_smith: or, you may even have to write a function that calls three functions!

20:35 arrdem: but in general load for side-effects is bad..

20:39 sdegutis: arrdem: Yeah I was hoping to get a return value from it, nothing else.

20:39 Dang.

20:43 Ahhh.

20:43 (load) runs a doseq on all the paths, thus it returns nil.

20:43 Whatever, I'll just use clojure.lang.RT/load

20:44 That's public so why not, right?

20:44 arrdem: because it's an undocumented implementation detail that's not portable?

20:44 sdegutis: Portable to what?

20:45 arrdem: Do you mean I won't be able to run my code in a JavaScript environment or the CLR?

20:46 arrdem: I'm already making use of JVM-specific features so this isn't really a show-stopper.

20:46 justin_smith: the load-reader one seems to not work if it's in src/

20:46 justin_smith: even if it is on the classpath?

20:47 wait, are you specifying the path classpath relative, or relative to current dir, or?

20:52 sdegutis: justin_smith: I don't even know how to make the load-reader version work.

20:52 justin_smith: I tried variations on your incantation from above and all threw exceptions.

20:53 justin_smith: (load-reader (clojure.java.io/reader (clojure.java.io/resource "foo/bar.clj")))

20:53 sdegutis: Won't that only work if the file is ./resources/foo/bar.clj ?

20:53 And not ./src/...?

20:54 justin_smith: src/ is on the classpath

20:54 sdegutis: I was hoping to avoid putting these files in ./src -- oh.

20:54 justin_smith: resource just means "look in the class path"

20:54 sdegutis: Oh!

20:54 justin_smith: so you could add an extra "loadable/" dir, and put it on the classpath

20:54 and it would work

20:54 sdegutis: IT WORKED!

20:55 I am so excited.

20:55 I love how small a Clojure hello-world is.

20:56 31 lines total, counting all 4 files, for my little experiment.

20:56 And 9 of them are just a .gitignore!

20:56 justin_smith: heh

20:56 sdegutis: Thanks justin_smith for saving the day.

20:56 justin_smith: np

20:57 amalloy: sdegutis: a clojure hello-world is 13 characters

20:57 "hello world"

20:57 justin_smith: you should add a bunch of crap to gitignore so you can say the majority of the lines in your codebase are .gitignore

20:57 sdegutis: amalloy: https://www.dropbox.com/s/mwl5o8tyb88np3k/Screen%20Shot%202014-11-18%20at%207.56.34%20PM.png?dl=0

20:58 (It was a pretty thorough experiment.)

20:58 justin_smith: lol

20:59 justin_smith: sdegutis: what do you think of (-> "rtest/views/one.clj" io/resource io/reader load-reader)

21:01 sdegutis: justin_smith: much sexier

21:02 gfredericks: I was trying to write a script to notify me when clojars came back up and it was back up before I could finish

21:02 sdegutis: justin_smith: ultimately it'll be hidden away in a small function somewhere though anyway

21:02 amalloy: justin_smith: i don't like it. if you i'd prefer something like (load-reader (-> "rtest/views/one.clj" (io/resource) (io/reader))), if you are going to use ->

21:02 sdegutis: gfredericks: ha

21:02 amalloy = gentleman / scholar

21:02 amalloy: the fully-arrowed version makes it hard to find the important part, ie that you are reading something

21:02 non-arrowed makes it hard to find what you are reading

21:02 gfredericks: (inc technomancy) ;; keepin the clojars fire alive

21:02 lazybot: ⇒ 158

21:03 amalloy: partial arrowing brings those both to the forefront and hides the boring details

21:03 justin_smith: amalloy: nice, I like that

21:03 amalloy: but i think fully arrowed is harder to read than no arrow at all, here

21:07 TEttinger: well, it looks like many of the pros are here, except technomancy. I'm having a hard time understanding why this JRE bundler (Packr) works with a "Hello World" runnable jar made by java tools (eclipse and a java source file), but fails on any play-clj projects with lein uberjar. I suspect it maybe related to a macro in play-clj

21:08 the macro in question: http://oakes.github.io/play-clj/core.defgame.html

21:08 I'm not sure if this does something that makes the uberjar's main class invalid somehow

21:09 this issue is here on Packr, it might need posting on play-clj's issue tracker https://github.com/libgdx/packr/issues/33

21:10 notably, someone got it working with a java main class loading a clojure class, but I couldn't figure out how to do that in lein

21:12 amalloy: TEttinger: it's pretty easy to write a java shim that just loads the clojure runtime and then calls some var of yours

21:12 clojurebot: excusez-moi

21:12 TEttinger: right, but can that be done from inside one mixed java-clojure project?

21:12 justin_smith: amalloy: is there a walk through or blog post about doing that anywhere?

21:12 amalloy: of course. i do it all the time

21:12 uhhhhhhh

21:13 TEttinger: and the end goal of this is to run packr on arbitrary clojure projects

21:13 amalloy: here, use https://github.com/amalloy/thrift-gen as your example

21:13 TEttinger: as a lein plugin

21:13 cool thanks

21:13 justin_smith: (inc amalloy)

21:13 lazybot: ⇒ 195

21:13 justin_smith: thanks

21:13 gfredericks: what's the standard leiningen setup for when you want to run tests with lots of clojure versions? I started with aliasing "test" to a bunch of calls to with-profile/test, but that feels weird

21:14 but I worry if I call it "test-all" I'll just forget to run it

21:14 amalloy: it has a bunch of junk you don't care about for making stuff java-friendly; the core is just the static {} block at the top, the one-arg constructor, and buildSamples(int)

21:14 TEttinger: amalloy: there's no :main in there -- it won't work as an uberjar, will it?

21:14 amalloy: TEttinger: just add :main my.java.Class to project.clj

21:14 i think

21:15 and no, this is a library, not an application, so it has no main

21:15 but this is how you write a java bridge to your clojure code all in one project

21:15 xeqi: gfredericks: something like `lein all test` w/ https://github.com/xeqi/peridot/blob/master/project.clj#L28 ?

21:15 amalloy: or how i do it, anyway

21:15 TEttinger: k, the issue I had was that the java couldn't see the clojure files

21:15 class files i mean

21:15 gfredericks: xeqi: woah look at those colons

21:15 amalloy: well yeah, it shouldn't have to

21:16 depending on what kind of interop you're doing, i suppose

21:16 my sample project only uses vars, doesn't create any classes from clojure; if you want to do that it's substantially harder

21:16 TEttinger: java calling clojure code with a call to proxy in it

21:16 amalloy: that's fine

21:16 just call the function through its var

21:17 you don't need to see any classfiles

21:17 justin_smith: TEttinger: maybe you want to just use clojure.lang.RT to require and run the main namespace?

21:17 xeqi: gfredericks: did you see technomancy's tweet about the new highlighting with racket? https://github.com/technomancy/atreus/blob/master/atreus.rkt#L222

21:17 gfredericks: I did see that :)

21:18 justin_smith: xeqi: it's a good thing that's highlighted, or he may not have noticed he was accidentally using vectors

21:18 xeqi: common mistake

21:18 gfredericks: xeqi: this is a cool lein trick thanks

21:19 arrdem: is there a good name for symbols like finally, catch and the core.async channel operators that are actually just tokens other macros look for?

21:20 gfredericks: headaches

21:20 brehaut: sentinals

21:20 gfredericks: clojure even uses keywords like that in one or two places

21:20 amalloy: arrdem: they are, in a way, anaphora

21:21 justin_smith: amalloy: what thing is "catch" a pronoun for?

21:21 gfredericks: maybe that's slightly weirder

21:21 amalloy: gfredericks: thinking of cond :->, or whatever the token is?

21:21 technomancy: aren't they just special forms?

21:21 gfredericks: amalloy: yeah

21:21 amalloy: technomancy: no

21:21 arrdem: technomancy: but special form implies compiler rather than macro support

21:21 technomancy: the compiler* looks for them

21:21 * - fsvo complire

21:21 arrdem: macros are just compiler directives

21:22 amalloy: technomancy: try is a special form, which handles nested catches specially, but catch is not itself a special form

21:22 * arrdem likes brehaut's sentinals proposal

21:22 arrdem: basically I'm looking for a name for a documentation entity that redirects to something else :P

21:22 amalloy: justin_smith: i think you're right that anaphor is wrong

21:22 arrdem: as catch and finally punt to try right now

21:22 brehaut: arrdem: i think its normally used as a terminator in lists and trees, but its kind of fullfilling the same role

21:23 arrdem: brehaut: sure

21:23 TEttinger: amalloy: what does this do: generator = Clojure.var("thrift.gen", "struct-gen");

21:23 is it calling struct-gen ?

21:23 amalloy: guys if you actually call it sentinal instead of sentinel i will die

21:23 TEttinger: or is that defined in thrift,gen

21:24 amalloy: TEttinger: it's (let [generator #'thrift.gen/struct-gen]). have you read any of the code or docs for clojure.java.api.Clojure?

21:24 TEttinger: no

21:25 amalloy: well, i recommend you do so. its javadoc contains an annotated example of how to call clojure code from java

21:25 it's like the only class in all of the clojure source that has decent javadoc

21:25 TEttinger: so it's just getting a var from that ns, and assigning to one in this one?

21:25 cool

21:25 justin_smith: that's like a version of "bro, do you even lift?" for #clojure

21:25 TEttinger: I'll take a look, thanks

21:25 (inc amalloy)

21:25 lazybot: ⇒ 196

21:39 arrdem: danielcompton: OSS is totally a hardware store if you have enough karma to get other people to do work for you :P

21:39 danielcompton: ghadishayban: interesting https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentHashMap.java#L752

21:39 oops

21:40 arrdem: someone's got to sweep the floors still :)

21:40 (dec someone)

21:40 lazybot: ⇒ 1

21:40 wei: is there an argument I can pass to take-last that will take the entire collection?

21:41 danielcompton: wei: why do you need to take-last at all if you want the whole thing?

21:43 wei: in my function, you can specify a limit through an options map. if it’s nil, i want to return the whole thing. so I need a function that works like take-last, but (take-last nil (range 3)) => (0 1 2)

21:43 danielcompton: wei: I'd probably just avoid the take-last call entirely in an if branch

21:43 wei: if I understand you correctly

21:44 $karma aardem

21:44 lazybot: aardem has karma 0.

21:44 danielcompton: $karma arrdem

21:44 lazybot: arrdem has karma 39.

21:44 danielcompton: aaardem the pirate

21:44 arrdem: nobody likes my jokes and the newbies don't know to inc :P

21:45 metellus: wei: you could maybe use fnil

21:46 danielcompton: arrdem: you gotta sneak in at night and inc yourself when no-ones here

21:46 arrdem: hehe

21:46 metellus: i don't think lazybot allows that

21:46 arrdem: at night andyf and TEttinger come out to keep the peace

21:47 clearly my only question is to ask myself questions

21:47 *s/question/option/g

21:47 danielcompton: (inc danielcompton)

21:47 lazybot: You can't adjust your own karma.

21:47 danielcompton: kicks lazybot

21:49 TEttinger: amalloy, ok this is odd, certainly. I keep getting type errors when I try to take the var I get out of clojure and use its value (it's been def'd) in java

21:49 danielcompton: Is ##java the right place to ask questions about Java stuff?

21:50 TEttinger: danielcompton: someone once tried to pay me to do his homework in ##java

21:50 I think I convinced him to go into a business major instead

21:50 andyf: danielcompton: Was that phm source link intended to point to something you believe is a bug?

21:50 marshall: hey clojure

21:50 danielcompton: TEttinger: I hope you asked for his uni email address then reported him to his lecturer

21:50 TEttinger: "you certaily have the moral flexibility needed for business"

21:50 danielcompton: andyf: nope, I was going through my previous replies and accidentally pressed enter

21:51 marshall: I have a ring server that sometimes 404s when I try to POST to /. like, it'll 404 when i try to do it using Postman (chrome app for making requests) and it'll work fine when I use cURL

21:54 danielcompton: TEttinger: solved my problem, learned more about unicode, didn't need to delve into ##java

21:54 TEttinger: nice

21:55 amalloy: marshall: sounds like you need to find out what's different between the two different kinds of requests

21:59 * danielcompton prunes all my dependencies before he gets accused as a hypocrite

22:01 gfredericks: marshall: `nc -l 9000` is helpful for debugging the difference between two http clients

22:01 marshall: ok

22:02 that'll show me everything going across port 9000, yeah?

22:02 jgdavey: marshall: You would make a request using both clients to that listener

22:04 i.e., run netcat (nc) in one pane, then curl in another. Repeat for Chrome.

22:04 mindbender1: pallet's api names are a disturbance to my thought process.

22:04 marshall: ok, thanks

22:07 andyf: Does anyone else wish Clojure compiler messages gave full paths and/or URIs instead of the path relative to where the file is in an unspecified one of your classpath items?

22:08 danielcompton: andyf: after looking at python stack traces, not particularly

22:09 andyf: Do any existing dev environments figure out where those things are? If so, how? I guess they could just do io/resource on them?

22:10 Jesterman81: hey ladies/gents, how are you configuring your clojure apps?

22:10 hiredman: we had a patched clojure at work back around 1.2 I think that added full path names to compiler excetions

22:10 arrdem: andyf: io/resource is the smartest thing I'm aware of besides classpath introspection via tools.classpath

22:10 marshall: what's the most popular clojure web framework?

22:11 clojure and java are completely foreign to me, and i'm trying to create a simple api that uses duckling to parse date ranges in natural language

22:11 i'm having a lot of trouble with this compojure framework

22:12 danielcompton: marshall: is there a specific issue we can help with?

22:13 marshall: this is my clojure app: http://pastebin.com/EyjSVcu9

22:15 danielszmulewicz: howdy, is there anything new regarding generating externs for cljs advanced compilation. Anything else besides Chris Houser's gist?

22:16 dnolen_ said something about integrating that functionality in the clojurescript compiler. Has it been done?

22:16 alandipert: danielszmulewicz: https://github.com/myguidingstar/fence is pretty cool

22:16 danielszmulewicz: alandipert: Oh, thank you indeed, sir.

22:16 marshall: posting to the one route with cURL: http://pastebin.com/Rcf8VXex

22:19 danielcompton: fence (verb) - to put a̶ ̶f̶e̶n̶c̶e̶ parentheses around something

22:26 danielszmulewicz: alandipert: Is fence only for js property access or for all js interop?

22:27 alandipert: danielszmulewicz: i think it does everything, since everything desugars into dot. i haven’t used it myself tho, could be wrong

22:27 danielszmulewicz: alandipert: OK, I'll give it a try. Thanks.

22:28 alandipert: it overloads .., and has no api, so it doesn't make sense in all forms.

22:28 alandipert: But I might be wrong. I'll try.

22:29 alandipert: danielszmulewicz: check out the readme, it has things :-)

22:29 danielszmulewicz: alandipert: Yes, but that's the thing. The README is what confuses me. I'm looking at source code now.

22:31 alandipert: i think myguidingstar is even among us, perhaps he can illuminate

22:33 danielcompton: Where are you myguidingstar? Did you just vanish from sight, a comet passing in flight?

22:39 sdegutis: Why is it that ##(let [foo 3] (load-string "foo")) doesn't work?

22:39 lazybot: java.lang.SecurityException: You tripped the alarm! load-string is bad!

22:40 sdegutis: Doesn't load-string evaluate it in the context of the calling function?

22:40 If not, is there a way to accomplish this?

22:41 TimMc: sdegutis: Locals are a lie.

22:41 danielcompton: ,(def foo 3)

22:41 clojurebot: #'sandbox/foo

22:41 TimMc: The compiler checks where each local is going to be used and clears it after the last use.

22:42 danielcompton: ,(load-string "foo")

22:42 clojurebot: 3

22:42 sdegutis: Surely there has to be a way to do this without using def or with-redefs?

22:42 TimMc: You can inspect the lexical environment from inside a macro, but once your code is *executing* it's too late to dynamically refer to locals.

22:43 danielcompton: ,(println "(inc danielcompton)")

22:43 clojurebot: (inc danielcompton)\n

22:43 danielcompton: foiled

22:43 TimMc: &(defmacro locals [] (keys &env))

22:43 lazybot: java.lang.SecurityException: You tripped the alarm! def is bad!

22:43 TimMc: ,(defmacro locals [] (keys &env))

22:43 clojurebot: #'sandbox/locals

22:43 sdegutis: danielcompton: lazybot ignores clojurebot

22:43 TimMc: ,(let [a 1 b 2] (locals))

22:43 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

22:44 TimMc: eh, I don't remember

22:45 ,(defmacro locals [] (vec (keys &env)))

22:45 clojurebot: #'sandbox/locals

22:45 sdegutis: ,locals

22:45 clojurebot: #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'sandbox/locals, compiling:(NO_SOURCE_PATH:0:0)>

22:45 sdegutis: ,(locals)

22:45 clojurebot: []

22:45 sdegutis: ,(let [a 1 b 2] (locals))

22:45 clojurebot: nil

22:45 sdegutis: Haha

22:46 TimMc: ,(defmacro locals [] (count (keys &env)))

22:46 clojurebot: #'sandbox/locals

22:46 TimMc: ,(let [a 1 b 2] (locals))

22:46 clojurebot: 2

22:47 TimMc: ,(defmacro locals [] (vec (map keyword (keys &env))))

22:47 clojurebot: #'sandbox/locals

22:47 TimMc: ,(let [a 1 b 2] (locals))

22:47 clojurebot: [:b :a]

22:47 TimMc: There, now I'm not trying to call (2 1) or (:b :a) :-P

22:48 sdegutis: Anyway, this still doesn't give load-string any access to them :/

22:48 TimMc: right, you'd need a macro to grab the locals ahead of time

22:48 sdegutis: Well I'm not even talking about from that side of the picture.

22:48 I want to have a way to "create" locals inside the environment being run by load-string.

22:50 TimMc: I don't know what that means and I'm going to bed.

22:50 (I'm curious, but up late.)

22:50 sdegutis: :)

22:51 (with-vars-somehow {:foo 3} (load-string "foo"))

22:51 I want 3.

22:51 That's all :)

22:52 * danielcompton ,(defn with-vars-somehow [] 3)

22:52 * danielcompton (with-vars-somehow)

22:53 danielcompton: sdegutis: what if you built up your let as a string inside your load-string

22:53 * danielcompton shudders

22:53 sdegutis: danielcompton: What is this, SQL?

22:53 danielcompton: data is code, code is strings

22:54 sdegutis: What is this, Korma?

22:54 arrdem: danielcompton: pls don't go around telling people to eval strings. pls.

22:54 danielcompton: (inc sdegutis )

22:54 lazybot: ⇒ 1

22:54 danielcompton: arrdem: I figured he was already at load-string by himself

22:55 sdegutis: in case my shudder wasn't clear, I don't think building up a let string is a good idea

22:56 myguidingstar: danielszmulewicz, danielcompton sorry, I'm back now

22:57 danielszmulewicz: myguidingstar: oh, the star we've been waiting for :-)

22:57 myguidingstar: nice work on fence.

22:58 myguidingstar: can you restate the question?

22:58 sdegutis: Hmm, I can see building up a form with a combination of read-string and some semi-quotes, and then evaling it.

22:59 ,(eval `(let [foo 3] ~(read-string "foo")))

22:59 clojurebot: #<CompilerException java.lang.RuntimeException: Can't let qualified name: sandbox/foo, compiling:(NO_SOURCE_PATH:0:0)>

22:59 myguidingstar: fence is a hack against Google closure compiler

22:59 sdegutis: ,(eval `(let [foo# 3] ~(read-string "foo")))

22:59 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context, compiling:(NO_SOURCE_PATH:0:0)>

22:59 danielszmulewicz: myguidingstar: sure. Is it meant to be used for js property access only or all forms of js interop?

23:00 myguidingstar: danielszmulewicz, the example in README shows both property and method calls

23:00 sdegutis: ,(eval `(let [foo# 3] ~(read-string "foo__793__auto__")))

23:00 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo__793__auto__ in this context, compiling:(NO_SOURCE_PATH:0:0)>

23:00 sdegutis: lol

23:00 There /must/ be a way!

23:01 danielszmulewicz: myguidingstar: I don't understand the examples in the README.

23:01 sdegutis: z

23:02 myguidingstar: I'll update the README with technical details about the way Google Closure compiler renames symbols in advance optimization mode

23:02 danielszmulewicz: myguidingstar: the line "(->> (.. js/something -someAttributes aMethod (anotherMethod "arg1" "arg2"))

23:02 (.log js/console))" has too much in it. It would be good if you can break it down, and explain how to go about the different type of js interop cases.

23:03 myguidingstar: without extern files, a.longName will be renamed

23:03 while a['longName'] won't

23:03 danielszmulewicz: myguidingstar: I understand what it does.

23:03 myguidingstar: I don't understand how to use it.

23:04 myguidingstar: For example, I have (.bind js/Ladda) that I would like to use without externs.

23:04 myguidingstar: what would be the syntaxt for this scenario?

23:04 with fence, I mean.

23:04 myguidingstar: danielszmulewicz, two steps:

23:04 1. refer to fence.core/.. in your ns form

23:05 2. replace (.bind js/Ladda) with (.. js/Ladda bind)

23:05 danielszmulewicz: myguidingstar: Ah, now I get it.

23:06 myguidingstar: okay. Any suggestion for a better README? danielszmulewicz

23:07 danielszmulewicz: myguidingstar: Yes, but just to make it clear: when I do somewhere else (.. js/window -location -hostname), since .. is overladed, what happens?

23:07 myguidingstar: it works, of course ;)

23:08 danielszmulewicz: myguidingstar: OK, but symbols get renamed or not in this case?

23:09 myguidingstar: as long as you use fence.core/.., NO symbols get renamed ;)

23:10 fence.core/.. use `aget` which produces javascript like window['location']['hostname']

23:10 danielszmulewicz: myguidingstar: Ah, so that's what I wanted to know.

23:11 myguidingstar: and Closure will optimize it to window.location.hostname, not window.a.b etc

23:11 danielszmulewicz: myguidingstar: OK, but then just let me clarify the next thing if you will.

23:11 myguidingstar: you're welcome

23:12 danielszmulewicz: myguidingstar: The "promise" of fence is that when the cljs compiler will provide the functionality required, you could remove the reference to fence and everything should work without modification, right?

23:13 myguidingstar: yes

23:13 danielcompton: welp http://azure.microsoft.com/en-us/status/#current

23:13 sdegutis: How do you do (load-reader) but don't evaluate it, just get a form back from it?

23:13 danielszmulewicz: myguidingstar: However (.. js/Ladda bind) should actually be (. js/Ladda bind) without fence. So how do you keep that "promise" as it were?

23:15 myguidingstar: danielszmulewicz, it's the cljs compiler responsibility now

23:17 danielszmulewicz: myguidingstar: I don't understand.

23:17 myguidingstar: js interop for method invocation is one dot. With fence is two dots. How will you reconcile that?

23:19 myguidingstar: but .. just works, right? danielszmulewicz

23:20 I tried to override ".", too but the cljs compiler doesn't allow that

23:20 danielszmulewicz: myguidingstar: .. is meant for nested property acccess. (.. js/object -prop1 -prop2 -prop3) ;; JS output: object.prop1.prop2.prop3;

23:21 myguidingstar: it's not the same as one dot.

23:21 myguidingstar: and Clojure doesn't allow reader macros (which is good imo) so I can't change the way (.-something ...) behaves

23:21 danielszmulewicz, but they're equivalent. Don't worry

23:23 danielszmulewicz, I wish I could do that. See FAQ#3

23:26 danielszmulewicz: myguidingstar: OK. So I guess I need to test it and see it for myself.

23:27 myguidingstar: I think you could break down the exaples in the README to clarify usage.

23:27 myguidingstar: yeah, I'm thinking of throwing away the console.log

23:27 thanks

23:28 danielszmulewicz: myguidingstar: That (.method js/object) should be written (.. js/object method), and stuff like that.

23:28 myguidingstar: got it ^^

23:32 danielcompton: ,(doc aget)

23:32 clojurebot: "([array idx] [array idx & idxs]); Returns the value at the index/indices. Works on Java arrays of all types."

23:33 danielszmulewicz: myguidingstar: In the README I would make extra clear that any usage with .. means no renaming, and also remind the option of using `aget to eschew fence in those cases.

23:33 danielcompton: Reading the docstring, I thought I could get it to return multiple values if I passed multiple indices.But it's actually for accessing sub-arrays. That was confusing to me, am I an outlier here?

23:35 myguidingstar: danielcompton, aget is a bit platform specific

23:35 danielcompton: myguidingstar: what does it do in cljs?

23:36 myguidingstar: in javascript, it just compiles to obj['prop-or-meth']

23:36 bbloom: myguidingstar: well it compiles to obj[...]

23:36 it's not necessarily a string key

23:37 myguidingstar: yeah, string is in fence's case

23:47 arrdem: technomancy: late but ping

23:49 tsantero: pretty sure that ping timed out

23:49 arrdem: 's fine

Logging service provided by n01se.net