#clojure log - Feb 18 2015

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

0:55 kaplan: justin_smith, still there?

1:04 lvh: Hi! Is there a specific tool I can use to help me build fake ring request maps, for testing?

1:04 I think https://github.com/ring-clojure/ring-mock is the most suitable one, but wanted to ask.

1:08 namra: lvh: yea rink-mock works fine

1:08 but depends on your demand for queries

1:08 if they are pretty simple that'll do

1:11 lvh: namra: Thanks!

1:12 on my old emacs setup, whenever I created a new clj file it'd insert the ns decl automatically. If it was a test file, it'd also automatically :require clojure.core.test :refer :all, which was quite nice. My current setup doesn't do this anymore. I don't remember having anything specific for that; I thought it wasj ust clojure-mode. Any idea how to get that behavior back?

1:15 michaelr`: so anyone knows if I can use any React component from Om? are there some gotchas?

1:34 ewemoa: lvh: how does this look? https://github.com/clojure-emacs/clj-refactor.el#user-content-automatic-insertion-of-namespace-declaration

1:34 lvh: yessss

1:34 thanks!!!

1:36 ewemoa: :)

4:17 swi: Hello. I'm try to get messages from udp. I have some udp sender that send message every second. I use aleph to create udp client. But it's just wait forever and no data received, but the appropriate socket address is bind-ed in system (i see it netstat -upn output).

4:24 mindbender1: clojure.java.io/as-file is having trouble with #<URL file:/home/me/projects/clojure/%s/classes>

4:24 How can I work around this?

4:25 The exception message is : IllegalArgumentException URLDecoder: Illegal hex characters in escape (%) pattern - For input string: "s/" java.net.URLDecoder.decod

4:27 wink: mindbender1: sounds like you're missing the printf-like substitution before using it as an url. %s is not a valid hexcode indeed in url encoding

4:28 mindbender1: wink: Actually it's dynapath that returns that URL among others. I had to trace it out. don't even know how it generates that.

4:29 wink: mindbender1: yeah, no clue. just saying.if you're parsing it as an url, it needs to be an url :P

4:29 mindbender1: I have filed the issue with them on github. I think it's a problem of improper percent encoding as reported on stackoverflow.

4:31 wink: Sure but the context doesn't allow that granularity of control.

5:30 swi: hmm.. can't force aleph to be a good udp receiver, but java.net can...

5:37 Arie741: anybody uses heroku?

6:08 crash_ep: Are there any known problems with getting cljsjs-dependent libraries to load in a weasel/piggieback REPL?

6:08 Guest82617: crash_ep: yes

6:08 crash_ep: search the weasel repo for "cljsjs.react"

6:08 crash_ep: Guest82617: thanks for the pointer, I will do that now

6:08 Guest82617: crash_ep: I believe it's at least partly fixed in newer versions

6:13 crash_ep: Guest14243: thanks for that, looks like I would need to use weasel 0.6.0-SNAPSHOT to work around it.

6:13 whoops

6:13 Guest82617: thanks for that, looks like I would need to use weasel 0.6.0-SNAPSHOT to work around it.

6:13 whoops

6:14 martinklepsch: thanks for that, looks like I would need to use weasel 0.6.0-SNAPSHOT to work around it.

6:14 martinklepsch: crash_ep: yes

6:15 I want something like `every?` but for multiple predicates on one value with proper short circuiting. Is there such thing?

6:16 ,(every? true? ((juxt even? neg?) -2))

6:16 clojurebot: true

6:16 martinklepsch: ,(every? true? ((juxt even? neg?) -3))

6:16 clojurebot: false

6:17 martinklepsch: kind a like this juxt isn't lazy so it's evaluates all predicates before coming to a conclusion

6:17 *but juxt isn't ...

6:37 hyPiRion: some-pred

6:37 err, every-pred

6:38 martinklepsch: ##((every-pred even? neg?) -3)

6:38 lazybot: ⇒ false

6:39 martinklepsch: hyPiRion: duh. :D thank you :)

6:39 TEttinger: (inc hyPiRion)

6:39 lazybot: ⇒ 70

7:00 adgtl: What is alternative like omniauth in Clojure

7:00 like oauth strategies?

7:02 michaelr`: anyone who get's Om and React can tell me I could implement the render method for the component created here: https://github.com/omcljs/om/blob/b549554964fe5b53189222e97e77fc2db34aebd6/examples/mixins/src/core.cljs ?

7:03 how I could..

7:04 ah.. maybe specify!

7:05 TEttinger: adgtl: friend?

7:05 adgtl: https://github.com/cemerick/friend

7:05 adgtl: ah okay

7:05 TEttinger: thanks

7:05 TEttinger: np

8:02 matthavener: are core.async timeout channels affected by leap seconds? if a leap second occured during the delay calc here [0], is it possible to get a channel that waited an extra second (or didn't wait?)

8:02 [0] https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/timers.clj#L51

8:27 jamiei: Does anyone happen have an example of consuming from an Aleph manifold stream via core.async? I've found various mentions that it can be done, but seemingly not providing any examples.

8:30 vas: jamiei: have you seen this? http://comments.gmane.org/gmane.comp.java.clojure.aleph/717

8:31 mbac: i have to translate some matlab code into clojure. what's the closest thing to matlab's arrays? is it mikera's matrix lib?

8:31 justin_smith: jamiei: based on this source, it looks like channels are extended so that manifold can treat them as a source https://github.com/ztellman/manifold/blob/master/src/manifold/stream/async.clj

8:32 jamiei: which is also reflected in that mailing list post, so yeah, looks simple enough

8:34 jamiei: ooh, thanks vas and justin_smith, will take a look at those links.

8:43 vas: justin_smith: Thanks for the pointers, all sorted.

8:48 vas: jamiei: awesome. ^_^ may the parens be with you

8:48 justin_smith: cool

8:54 jamiei: :)

9:23 julianleviston: I have many calls in to a recaching function ('recache'). This function can recache any number of a large set of data that is not known at compile time. It works off a number key. These calls come in via a core async put! message. I have a 'go while true' block that simply makes the call to the recache-worker function that actually does the recaching. My problem is that I'd like to introduce debouncing, but per

9:24 I have many calls in to a recaching function ('recache'). This function can recache any number of a large set of data that is not known at compile time. It works off a number key. These calls come in via a core async put! message. I have a 'go while true' block that simply makes the call to the recache-worker function that actually does the recaching. My problem is that I'd like to introduce debouncing, but per

9:24 I have many calls in to a recaching function ('recache'). This function can recache any number of a large set of data that is not known at compile time. It works off a number key. These calls come in via a core async put! message. I have a 'go while true' block that simply makes the call to the recache-worker function that actually does the recaching. My problem is that I'd like to introduce debouncing, but per

9:24 perplexa: ¬_¬

9:24 julianleviston: I have many calls in to a recaching function ('recache'). This function can recache any number of a large set of data that is not known at compile time. It works off a number key. These calls come in via a core async put! message. I have a 'go while true' block that simply makes the call to the recache-worker function that actually does the recaching. My problem is that I'd like to introduce debouncing, but per

9:24 item-to-be-cached.

9:24 Is this reasonable? I'd actually like these chans to be garbage collected after they fall into disuse, as well, (say 10 seconds without use), so that they're not clogging memory and not being used. How would I go about programmatically allocating these channels and then keeping them around. Should I use a loop that keeps a map that has the cacheable-entities' keys as its keys? How about the expiry?

9:24 perplexa: please don't spam

9:25 julianleviston: Erm… what do you mean?

9:25 Empperi: especially since part of your text was cut off

9:25 well you sent the exact same text 4 times

9:25 julianleviston: I did?

9:25 perplexa: i mean that you just pasted an incomplete wall of text 4 times

9:25 Empperi: but it was cut off at "debouncing, but per"

9:25 TEttinger: yeah, 2 seconds apart

9:25 julianleviston: Sorry, I didn’t realise… I didn’t see that, I just pasted into my IRC client and nothing came up in the channel, so I assumed it was disallowing my input

9:25 TEttinger: network issue?

9:25 ah

9:26 julianleviston: apologies.

9:26 perplexa: you might want to use a pastebin

9:26 julianleviston: fair

9:26 Empperi: refheap! It's #clojure after all :)

9:26 perplexa: hehe

9:26 TEttinger: or just send multiple messages, since there were logical sentence splits in there

9:26 julianleviston: Yeah, I tried to do that.

9:28 This is my question : https://www.refheap.com/97487

9:31 I’m wondering if there might be a simpler way to achieve what I’m going for… hmmm :)

9:33 gfredericks: amalloy_: oh hey I figured out how to rewrite the nasty macro from yesterday without using external state

9:33 amalloy_: the outer macro would pass information to the inner macro by throwing it on the metadata for the inner macro call, which could use &form to pull it back out

9:34 could also be any dummy arg that takes metadata

9:39 TimMc_: julianleviston: What IRC client are you using?

9:39 julianleviston: Colloquy

9:39 TimMc_: for mac.

9:39 TimMc_: Have you looked at core.cache? I don't think that will handle the debouncing, though.

9:40 julianleviston: TimMc_: I’ve got a cache already. I also have a debounce function. They’re fine.

9:40 TimMc_: mostly I’m just after advice about whether that’s an insane way to do it - one chan per entity...

9:41 TimMc_: Ah, I see.

9:42 julianleviston: and also maybe some hints about how to go about expiring the chans after x ms… not really sure how to do that if I’m looping with a map of chans as my pass through value on the loop… I guess I could have a timestamp on them or something?

9:42 TimMc: I'm none too familiar with core.async, unfortunately.

9:43 Doesn't core.cache have expiration? You could have an expiring cache of channels.

9:43 julianleviston: TimMc: this is cljs

9:43 TimMc: Oh!

9:43 julianleviston: TimMc: and I don’t want the cache to expire, I want the chans to expire

9:43 TimMc: the debounce chans…

9:43 TimMc: Well, now this is totally out of my area.

9:44 julianleviston: TimMc: hehe :) sorry! and thanks for the helpful thoughts

10:07 michaelr`: just burned a few good hours and my brain, trying to fit a react drag and drop mixin component with Om.

10:08 anyone knows anything about this stuff?

10:11 julianleviston: michaelr`: I use react all the time, but I’ve never done mixins, and haven’t done a drag n drop with them yet. I have to do one in the not too distant future tho...

10:12 michaelr`: sorry, I mean I use Om all the time… (and obviously react too)

10:19 michaelr`: julianleviston: i'm trying something along the lines of this example of the dnd component: https://github.com/gaearon/react-dnd/blob/343541974aa7a83eb5679daea40ca9d2f10eda7a/examples/_dustbin-simple/Item.js

10:19 and my om mixin example reference is this one: https://github.com/omcljs/om/blob/b549554964fe5b53189222e97e77fc2db34aebd6/examples/mixins/src/core.cljs

10:20 julianleviston: michaelr`: I’m assuming you’ve compared and contrasted the drag n drop example that the om site links to?

10:21 michaelr`: this component looked more complete and mature to me..

10:22 it seems to me that if i'd like to use the dnd example from om's site i'd have to really dive into this dnd stuff..

10:23 the mixin component seems to handle all the heavy lifting.

10:23 julianleviston: Ah ok

10:23 what’s dnd?

10:24 oh god… lol drag n drop. sorry…

10:26 michaelr`: I assume you’ve looked at the sortable example? https://github.com/omcljs/om/blob/b549554964fe5b53189222e97e77fc2db34aebd6/examples/sortable/src/core.cljs

10:26 michaelr`: has a “generic draggable” in there...

10:26 michaelr`: might be a good start?

10:27 michaelr`: I don’t suppose you’re a pro at core.async by any chance, are you? :)

10:28 michaelr`: julianleviston: not a pro :)

10:29 julianleviston: michaelr`: here’s my question: https://www.refheap.com/97487

10:29 michaelr`: i guess I could use that sortable example, but since I already spent some good hours trying to figure out the mixin stuff I'd rather try and get it to work..

10:29 llasram: b

10:29 heh, wrong buffer

10:31 julianleviston: michaelr`: so what isn’t working about it?

10:32 michaelr`: regarding your question, i didn't really understand it :) can you maybe make it more simple?

10:32 it seems that you are asking many questions there

10:33 julianleviston: michaelr`: yeah… I kind of am.

10:34 michaelr`: I want to introduce per-item debouncing and I was wondering if a chan-per-item is a bit of an insane way to do it?

10:34 michaelr`: what isn't working is that the component with the mixin becomes the parent component of the one which does the rendering, and I can't call a function which comes with the mixin from my (render) handler - it seems that it is on the parent component or something..

10:35 julianleviston: michaelr`: and if I *do* implement it with one chan per item (in a map), then I wonder how I’d go about “retiring” the go chans (& their go blocks) to be garbage collected when they had expired.

10:36 michaelr`: man that sounds complex

10:36 michaelr`: what do you mean by debouncing?

10:36 sveri: How do I call a function x times and put the functions result into a vec?

10:37 michaelr`: ,(doc repeat)

10:37 clojurebot: "([x] [n x]); Returns a lazy (infinite!, or length n if supplied) sequence of xs."

10:37 michaelr`: no

10:37 justin_smith: michaelr`: to call a function n times you want repeatedly

10:37 julianleviston: sveri: the pass that into “into []”

10:37 michaelr`: ,(doc times)

10:37 clojurebot: Cool story bro.

10:37 justin_smith: and into to put it in a vec

10:37 michaelr`: repeatedly

10:37 michaelr`: sveri: what justin_smith

10:37 said

10:38 justin_smith: ,(into [] (repeatedly 10 rand))

10:38 clojurebot: [0.1591637445756442 0.7522457558793089 0.4153232341251093 0.1170311821530805 0.4616383407167318 ...]

10:38 sveri: thank you all :-)

10:38 justin_smith: sveri: why a vec?

10:38 julianleviston: michaelr`: the debouncing means that the cache requests get called multiple times, and I want a timeout of no requests to ensue before the actual work is done… so i’m not doubling up.

10:40 sveri: justin_smith: well, a list would be ok too

10:40 clojurebot: Pardon?

10:40 justin_smith: sveri: that's why I asked, in that case you don't need the into part

10:40 michaelr`: julianleviston: like a buffer which items you make distinct and flush once in a while?

10:41 sveri: just a seq of a functions results

10:41 justin_smith: julianleviston: what about something from core.cached? I think they have a mechanism where a calculation currently in the works is not restarted

10:41 AeroNotix: julianleviston: simplest way is to use a RWLock

10:41 a map of {:key {:value Var :lock Lock}}

10:42 justin_smith: julianleviston: core.cached also has mechanisms for dropping old contents

10:42 AeroNotix: http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/ReadWriteLock.html

10:42 julianleviston: michaelr`: um…. no… like… if you were debouncing inputs from me, every time I gave you something, you’d reset your clock… and throw away any you had… until a the clock alarm rang… and then you’d use that one.

10:42 I’m on cljs guys...

10:42 AeroNotix: dang

10:42 julianleviston: justin_smith: so no core.cached

10:42 AeroNotix: and no java

10:42 AeroNotix: Sheeeit

10:43 Jaood: ;)

10:43 julianleviston: but the debouncing isn’t a problem. i’ve already got that.

10:43 AeroNotix: What are you referring to as "debouncing"?

10:43 tbaldridge: should be pretty easy to port the needed bits from core.cached

10:43 julianleviston: AeroNotix: this: https://gist.github.com/scttnlsn/9744501

10:44 tbaldridge: but I don’t need it. I just want to know if one chan per entity is a sane way of doing this… I don’t need a cache…I’ve already built myself a cache, and I have the debouncing code…

10:45 tbaldridge: julianleviston: how many entities will you have?

10:46 julianleviston: tbaldridge: it’s not known.

10:46 tbaldridge: and how much churn will there be

10:46 julianleviston: tbaldridge: anywhere from 10 to 400

10:46 tbaldridge: And the churn? Will they last 1 sec, 1ms?

10:47 AeroNotix: this debounce seems to put some value on the channel when there hasn't been any activity for the timeout, right?

10:47 julianleviston: tbaldridge: do you mean how many times will they be debounced per time? or how long before I want the chans to expire?

10:47 tbaldridge: how long before the chans expire

10:47 julianleviston: AeroNotix: yup!

10:47 AeroNotix: how will you be using that?

10:47 julianleviston: tbaldridge: oh… um… 5 secs, I guess?

10:47 tbaldridge: yeah, that should work then

10:47 julianleviston: tbaldridge: what should work?

10:47 tbaldridge: one chan per entity.

10:48 AeroNotix: Don't guess. Measure.

10:48 julianleviston: tbaldridge: ohhhhhh awesome… thanks

10:48 AeroNotix: didn’t tbaldridge write the core.async go block code?

10:48 tbaldridge: Think of channels as about the size of an object + 5 arrays (or so). So they aren't super expensive, but they aren't as small as a cons cell either

10:48 julianleviston: tbaldridge: you did, right?

10:48 AeroNotix: I don't care, and I know tbaldridge wrote the code

10:49 but just saying "that should be fine" is a guess. Implement. Measure. Iterate.

10:49 tbaldridge: yes, always measure, that too ;-)

10:50 julianleviston: AeroNotix: Well I was after advice about whether it was a good way to do it…

10:50 tbaldridge: I mean questions like "is this sane" is a very open-ended question, AeroNotix, how to you measure sanity of code

10:50 AeroNotix: tbaldridge: there's a lot of needed context before you answer a question like that, though.

10:50 julianleviston: AeroNotix: because quite often, someone says “oh, just do this”…. (inrest some very elegant way)

10:51 insert*

10:52 Now I have to think of a way to “expire” then chans...

10:53 tbaldridge: in that debounce code, will the chan stay around as long as there is a ref to the out chan? or will I have to somehow signal it to die? https://gist.github.com/scttnlsn/9744501

10:55 tbaldridge: coz there’s like an infinite go block in there, right? if I just used that debounce code as is, wouldn’t the number of go blocks slowly accumulate over time?

10:55 tbaldridge: gos turn themselves into callbacks that are attached to channels. So channels reference go blocks, once the channel is GC'd so is the go block

10:55 (assuming the go block is waiting on that channel)

10:55 julianleviston: tbaldridge: oh man… THAT would have been excellent to know a while ago…

10:56 tbaldridge: yeah it’ll be waiting on the in chan… so if I garbage collect that, all should be good…

10:57 tbaldridge: thanks for that bit of knowledge!

10:57 wiring all this up is going to take some thought ;-)

11:07 TimMc: ,#.{}

11:07 clojurebot: #<RuntimeException java.lang.RuntimeException: Record construction syntax can only be used when *read-eval* == true>

11:08 llasram: nice

11:08 TimMc: locally I get: ClassNotFoundException / java.lang.Class.forName0 (Class.java:-2)

11:11 Bronsa: ,#.

11:12 clojurebot: #<RuntimeException java.lang.RuntimeException: Record construction syntax can only be used when *read-eval* == true>

11:12 hyPiRion: &#.foo{}

11:12 lazybot: java.lang.RuntimeException: Record construction syntax can only be used when *read-eval* == true

11:13 Bronsa: looks like it's not even reading the ctor args

11:13 that's somewhat surprising

11:14 julianleviston: I don’t follow why this is weird

11:15 justin_smith: julianleviston: #. is a weird ass invalid record constructor

11:15 julianleviston: justin_smith: I still don’t get it, but ok. :S

11:16 justin_smith: julianleviston: if you saw #. in code, what would you expect it to be?

11:16 a blatant error?

11:16 julianleviston: justin_smith: an error

11:16 Bronsa: justin_smith: what surprises me is that #foo.bar [1] errors out on foo.bar but after that it evaluates [1]

11:16 justin_smith: exactly

11:16 Bronsa: justin_smith: as opposed to what happens for #foo [1]

11:16 justin_smith: Bronsa: oh, that's a separate thing, OK

11:16 julianleviston: but it’s not an error like that… it’s a blank record constructor

11:17 with no namespace… right?

11:17 Bronsa: yeah, ctor syntax doesn't consume the argvec in case of error

11:20 julianleviston: I still don’t get why you think it’s weird. This is the output from my REPL: ClassNotFoundException / java.lang.Class.forName0 (Class.java:-2)

11:20 I must be missing something.

11:21 justin_smith: julianleviston: if you have an arg, it will return the arg

11:21 as if it weren't an arg, but just supplied on its own

11:22 julianleviston: justin_smith: it seems to spit out a map

11:23 but I don’t think that’s what it’s doing… (type #.{}) ; -> RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:221)

11:23 Ok I get you. It’s all borked up.

11:23 sorry for being so dense!

11:26 ajmagnifico: anyone: I have a namespace A, into which I am using (ns :use) to bring in functions from namespace X and namespace Y.

11:26 Namespace X belongs to a 3rd party library.

11:26 I wrote Namespace Y.

11:26 Namespace Y has a function that I deliberately named in order to cover up a function with the same name in Namespace X.

11:27 Clojure gives me this exception:

11:27 Bronsa: ajmagnifico: don't use :use, use :require with :refer or :as

11:27 ajmagnifico: $join already refers to: #'incanter.core/$join in namespace:

11:27 lazybot: ajmagnifico: It is not the case that you don't not unhave insufficient privileges to do this.

11:28 justin_smith: ajmagnifico: as Bronsa says, :use is considered poor style

11:29 TimMc: hyPiRion: Ugh, so close to being valid syntax: (. #"" '"=")

11:29 ajmagnifico: Just specify only those things that I actually need, right?

11:29 TimMc: ,(. #"" '"=")

11:29 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: quote for class java.util.regex.Pattern>

11:29 ajmagnifico: Fair enough.

11:29 thanks justin_smith and bronsa

11:29 justin_smith: ajmagnifico: if you ever refactor your namespaces you'll be glad you did it that way

11:33 hyPiRion: TimMc: ooh

11:33 Bronsa: TimMc: that technically is valid syntax

11:34 julianleviston: ajmagnifico: or even if you just go back and want to understand your code later!

11:34 ajmagnifico: I'm using incanter,

11:34 for statistical analysis

11:34 so there are many functions in incanter.core

11:34 TimMc: hyPiRion: (meta ^#=(keyword "test") []) ;;= {:test true}

11:34 ajmagnifico: And the lazy side of me was just tempted to use (:use incanter.core)

11:35 Discipline!

11:35 hyPiRion: TimMc: what about it?

11:35 that one I know

11:35 TimMc: Nothing, really. I don't think I'd seen that abuse before.

11:35 hyPiRion: oh

11:39 julianleviston: At what point does a record start to have perf benefits over a map? in the hundreds, or thousands of items?

11:40 actually it’s probably more like space benefits isn’t it? I can’t remember.

11:40 TimMc: I think it's access perf.

11:40 kaplan: justin_smith, thank for being so helpful

11:41 (inc justin_smith )

11:41 lazybot: ⇒ 5

11:42 julianleviston: (inc tbaldridge)

11:42 lazybot: ⇒ 18

11:44 julianleviston: TimMc: Cool, thanks: http://stackoverflow.com/questions/4575170/where-should-i-use-defrecord-in-clojure

11:44 (inc TimMc)

11:44 lazybot: ⇒ 93

11:51 Eremox: Anyone has any experience with quil?

11:53 hello?

11:56 dweave: anyone read this? http://www.vpri.org/pdf/tr2011001_final_worlds.pdf . is there anything in clojure that reifies this

11:57 are cursors / lens similar?

11:58 SegFaultAX: dweave: There are a few different notions of cursors, so I'm not sure which you're specifically referring to.

11:58 dweave: i guess Om’s

11:58 SegFaultAX: But I will say that lenses are extremely generic.

11:59 Oh, then no. Those cursors represent a tiny fraction of what lenses can do.

12:00 dweave: so what are these “worlds” then really?

12:00 is clojures stm like this?

12:02 ah section 8 is a pretty good description.. I’m just rereading a second time

12:05 gfredericks: has anybody started/finished working on integrating cljfmt with emacs?

12:12 anildigital: Has anyone worked with friend-oauth2?

12:13 I am trying to do foursquare oauth with it

12:13 but getting redirected to http://localhost:3000/auth/callback .. instead of it doing flow of fetching access_token

12:13 adgtl: Here is code example https://github.com/anildigital/foursquare-1self/blob/master/src/foursquare_1self/handler.clj

12:19 TimMc: hyPiRion: Do you have thoughts on whether -> and ->> can achieve any final arrangement of non-macro expressions?

12:21 hyPiRion: TimMc: I've tried to take the form (foo b c) and convert it to (foo (b c)) without luck. So I presume it's not possible in general

12:22 But I'm pretty sure you can reorder atoms in whatever way you want

12:22 (i.e. non-collections)

12:24 gfredericks: the cljfmt readme says that cider 0.9+ supports cljfmt but the cider repo shows no signs of 0.9 being a thing

12:24 Bronsa: ,(macroexpand-1 '(-> 1 2 3 4))

12:24 clojurebot: (4 (3 (2 1)))

12:24 Bronsa: ,(-> 1 2 3 4 quote)

12:24 clojurebot: (4 (3 (2 1)))

12:24 Bronsa: my mind is blown right now

12:25 hyPiRion: Bronsa: oh, you've seen nothing

12:25 schmir: gfredericks: I'm using cider 0.9.0snapshot

12:26 hyPiRion: ,((-> [n] #(if (zero? n) 1 (* n (fact (- n 1)))) (->> (-> fact))) 10)

12:26 clojurebot: 3628800

12:26 Bronsa: hyPiRion: I'm not even going to try and parse that

12:27 hyPiRion: ,(require '[clojure.walk :refer [macroexpand-all]])

12:27 clojurebot: nil

12:27 hyPiRion: ,(macroexpand-all '(-> [n] #(if (zero? n) 1 (* n (fact (- n 1)))) (->> (-> fact))))

12:27 clojurebot: (fn* fact [n] [] (if (zero? n) 1 (* n (fact (- n 1)))))

12:27 Bronsa: that's fun

12:27 kaplan: Wait

12:27 Unquote is the opposite of quote

12:27 My mind is blown

12:28 poof

12:30 vas: O_O

12:30 CODE IS DATA

12:32 gfredericks: schmir: okay cool thanks

12:32 schmir: gfredericks: I'm installing from melpa

12:36 gfredericks: I mostly got confused expecting the cider repo to mention cljfmt somehow or another but it's actually the cider-nrepl repo that does

13:07 kras: ,(let [[n l r & st] '(:a :b nil)] st)

13:08 clojurebot: nil

13:09 kras: why does the above code give the below error on tryclj.com

13:09 java.lang.IllegalArgumentException: let requires an even number of forms in binding vector in clojure.core:

13:10 socksy: kras: works for me

13:10 typo?

13:12 kras: socksy: you tried on tryclj.com?

13:12 TimMc: Works for me too.

13:12 Annoying that I can't paste into that page.

13:12 TEttinger: you can totally make it send that error

13:12 ,(let [[n l r & st] '(:a :b nil)] st)

13:12 clojurebot: #<CompilerException java.lang.IllegalArgumentException: let requires an even number of forms in binding vector in sandbox:, compiling:(NO_SOURCE_FILE:0:0)>

13:13 TEttinger: I stuck a unicode invisible char in there

13:13 TimMc: :-)

13:14 TEttinger: it could be that your input is switching between RTL and LTR modes, which causes that same invisible char

13:15 socksy: kras, yes, did

13:17 TEttinger: ,(count "(let [[n l r & st] '(:a :b nil)] st)")

13:17 clojurebot: 36

13:17 TEttinger: can you verify that that form (without the opening comma) is also 36 chars?

13:18 lxsameer: hey folks, I'm looking for an IMAP or pop3 library to create a proxy mail server, do you know any?

13:19 TEttinger: lxsameer: most home-run mail servers get flagged as spam

13:20 lxsameer: TEttinger: I see, I want to create a proxy mail server to serve mailgun api via IMAP

13:21 kras: I typed the expression again and it works fine now

13:21 it is 36 chars

13:21 TEttinger: weird stuff, kras.

13:21 maybe their server had a hiccup and only received some of your chars

13:22 (the first time i mean)

13:22 missing a ] would do that I think

13:22 ,(let [[n l r & st '(:a :b nil)] st)

13:22 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>

13:22 TEttinger: hm nope

13:24 kras: Give me some Clojure:

13:24 > > (let [[n l r & st] '(:a :b nil)] st)

13:24 java.lang.IllegalArgumentException: let requires an even number of forms in binding vector in clojure.core:

13:24 #<core$_GT_ clojure.core$_GT_@67a3677b>

13:24 > (count "> (let [[n l r & st] '(:a :b nil)] st)

13:24 java.lang.IllegalArgumentException: let requires an even number of forms

13:24 java.lang.RuntimeException: EOF while reading string

13:24 > (count "(let [[n l r & st] '(:a :b nil)] st)")

13:24 36

13:24 > (let [[n l r & st] '(:a :b nil)] st)

13:24 nil

13:25 Here is the sequence pasted from tryclj.com

13:26 might be a glitch or something, very confusing for a beginner

13:26 nevermind I have CIDER plugin for my emacs now, so trying out at the local REPL

13:27 TEttinger: ah!

13:27 the first one had two >

13:28 ,(let [[n l r & st] '(:a :b nil)] st)

13:28 clojurebot: nil

13:28 TEttinger: ,> (let [[n l r & st] '(:a :b nil)] st)

13:28 clojurebot: #<core$_GT_ clojure.core$_GT_@6fdf5e5>

13:33 Raynes: I think people don't often understand how much crazy shit tryclj/clojail does in order to allow safe execution of code in a shared environment.

13:33 If they knew what went on in there, they'd not be surprised at glitches. :p

13:33 TEttinger: hehe

13:42 kras: :-)

13:52 TimMc: ,(:special-form (meta #'fn))

13:52 clojurebot: true

13:55 justin_smith: LIES

13:57 TimMc: Interesting.

13:57 ,(macroexpand-1 '(fn [aaa [bbb]] 5))

13:57 clojurebot: (fn* ([aaa p__51] (clojure.core/let [[bbb] p__51] 5)))

13:58 TimMc: That's a reasonable way of doing it, of course.

13:58 AeroNotix: TimMc: how else would you do it?

13:58 TimMc: I'd never considered it before.

13:59 AeroNotix: I'm wanting to ship an (internal) clojure library for consumption for Java developers. What can I do to make this really nice for them? I.e. I want to make it totally incidental that it's implemented in Clojure and not Java.

14:00 gtrav: trying to load all the function definitions within an external .clj file from within java code. using jdk 1.7 and clojure 1.6 jar. Clojure.read(/path/to/file) doesn't work, how do I do the equivalent of (load-file /path/to.file) within java code?

14:02 justin_smith: gtrav: read just parses

14:02 gtrav: read does not eval (usually)

14:02 you want load, or require

14:02 gtrav: require since the functions will later be run

14:04 hiredman: if the clojure code is in a namespace, and that file is situated on the on the classpath properly, you should just require it from the java code

14:04 RT.var("require").invoke(RT.var("clojure.core", "symbol").invoke("some.ns")) modula some casts maybe

14:05 AeroNotix: so what's the best way to write a clojure library that looks "normal" from Java. Because that interop is gross^

14:05 (:gen-class) with all the bells and whistles?

14:06 justin_smith: AeroNotix: well, you still need to make sure that gets loaded somewhere - or do you mean gen-class with AOT on the clojure side when packaging?

14:06 gtrav: thanks hiredman, will try it, but as of clojure 1.6 the RT is not part of the public IF. from the clojure javadoc only IFn and Clojure are supposed to be used, or am I reading that wrong?

14:06 AeroNotix: justin_smith: I just want to write a clojure library that some java colleagues can use seamlessly.

14:06 and I want them to not have to deal with any cognitive overhead

14:07 amalloy: AeroNotix: i have a perfect example for you, if i do say so myself

14:07 AeroNotix: amalloy: shoot it my way!

14:07 amalloy: https://github.com/amalloy/thrift-gen

14:08 it's a clojure library with a java front-end adapter included

14:08 AeroNotix: so I'll need to write java?

14:09 amalloy: it's one class, one interface, a few methods. not a huge deal. you *can* generate equivalent bytecode from clojure, but (a) it's harder, and (b) it will give your colleagues cognitive overhead

14:10 AeroNotix: amalloy: thanks for the example. This java file looks like I could deal with that fine. Thanks!

14:10 hiredman: gtrav: *shrug* use whatever you want

14:11 amalloy: AeroNotix: it used to be just the first 32 lines; really if you just want to expose clojure functions, you need ilke 5 lines of java per function. i went the extra mile on this one and presented a class-based wrapper, rather than just a bunch of static methods, which would probably be fine for most cases

14:12 AeroNotix: amalloy: indeed, sounds good to me.

14:14 lxsameer: guys, is there any networking library for clojure ? something like twisted for python or event machine for ruby ?

14:15 AeroNotix: lxsameer: what are you trying to solve?

14:15 justin_smith: lxsameer: we have SO MANY NETWORKING LIBRARIES

14:15 lxsameer: I want to create a dummy Imap server to act as proxy for mailgun

14:16 justin_smith: which one supports IMAP and is suitable for a clojure newbie ?

14:16 justin_smith: lxsameer: I don't know about imap specifically, but aleph can do general tcp very nicely

14:17 lxsameer: justin_smith: cool

14:17 justin_smith: lxsameer: though if there is an imap lib, even better of course (never had to do that myself)

14:17 lxsameer: justin_smith: thanks buddy

14:18 justin_smith: so far it looks like nobody has a premade clojure imap lib - I wonder how hard the protocol would be to implement with aleph

14:20 hiredman: my understanding is twisted and event machine are largely working around python and ruby's lack of concurrency, the jvm has real threads so why bother?

14:20 justin_smith: lxsameer: you could use Hedwig via interop maybe (it is a java imap implementation)

14:21 lxsameer: justin_smith: nice, let me check it out

14:23 kungi: I am implemented my own "multiple context path" handling middleware in my webapp. This sadly broke friend such that only every second "login" gets redirected to the proper location. The problem seems to reside in the "retry-request" function in friend. My context path handling is here: https://gist.github.com/Kungi/9bb1cdb88df9ea889300. Can someone help me debug this?

14:23 s/am/have/

14:23 lxsameer: justin_smith: Hedwig is a server application, not a library am i right ?

14:24 hiredman: I wrote a dummy imap server for some tests, it is a really gross 137 line function spinning up threads for each request

14:24 justin_smith: lxsameer: it's java, so it will have a jar, containing classes you can use. Or maybe in the rare case it's only usable as an app, but that isn't my experience typically.

14:25 hiredman: 129 lines (not counting the ns form)

14:25 lxsameer: justin_smith: thanks for your guidance man

15:26 devll: (use 'clojure.java.io)

15:26 (-> "/tmp" file .listFiles)

15:26 Hi

15:26 I cant list files.

15:27 /tmp> ls | wc -l

15:27 195

15:27 actually there are 195 files.

15:28 gfredericks: devll: and what do you get when you call .listFiles?

15:28 devll: I am running "lein repl" and "ls" with the same user.

15:29 TEttinger: I'm on windows, but (-> "C:/" file .listFiles vec count) gives me the number

15:29 err, (-> "C:/" file .listFiles count) should work

15:30 justin_smith: devll: what does that actually return?

15:30 devll: my bad.

15:31 #<File[] [Ljava.io.File;@62eeee05>

15:31 file array

15:31 justin_smith: that's exactly what it should return, yeah

15:31 you can use seq or into or map to get what you want from that

15:31 devll: PL-y 0.3.2, nREPL 0.2.0-beta5NoSuchMethodError clojure.tools.nrepl.StdOutBuffer.length()I

15:31 TEttinger: do you want the same effect as ls?

15:32 AeroNotix: file-seq on a directory is interesting too

15:32 devll: OK.

15:32 AeroNotix: (-> "/" clojure.java.io/file file-seq)

15:32 ,(-> "/" clojure.java.io/file file-seq)

15:32 clojurebot: #<SecurityException java.lang.SecurityException: denied>

15:32 AeroNotix: yay

15:32 justin_smith: ls

15:32 lazybot: etc home lib64 mnt run

15:33 justin_smith: (it's a shortcut)

15:33 hadronzoo: Can anyone recommend a database migration library?

15:34 zeeshanlakhani: hadronzoo: there's ragtime -> https://github.com/weavejester/ragtime

15:34 devll: thanks all. I got things messed up.I guess I have to sleep.

15:35 (inc AeroNotix )

15:35 lazybot: ⇒ 1

15:35 devll: (inc AeroNotix)

15:35 lazybot: ⇒ 6

15:35 AeroNotix: yay

15:35 a whole 6

15:36 devll: :D

15:36 hadronzoo: zeeshanlakhani: I see several. I was wondering if anyone had any recommendations.

15:36 TEttinger: (inc AeroNotix)

15:36 lazybot: ⇒ 7

15:36 zeeshanlakhani: ragtime is the one we used on a project awhile back and it worked well and was easy to adapt plugins for (e.g. https://github.com/sfx/ragtime.elasticsearch)

15:36 TEttinger: lucky number slevin

15:39 hadronzoo: zeeshanlakhani: Can migrations with ragtime be clojure functions?

15:42 zeeshanlakhani: hadronzoo: we used it for posgres... w/ the sql plugin, which was all up/down sql files. However, for our ES plugin, we defined migrations w/ funs -> https://github.com/sfx/ragtime.elasticsearch#defining-a-migration

15:45 hadronzoo: zeeshanlakhani: OK, I'll take a look. Thanks.

15:45 zeeshanlakhani: np

16:02 hadronzoo: zeeshanlakhani: When attempting to run "lein ragtime -m", I get a "no matching clause" exception. Is there additional config other than adding the directory and the dependency to the project.clj?

16:02 zeeshanlakhani: I also added a :ragtime key in project.clj with the database connect string

16:03 zeeshanlakhani: hadronzoo: did you see this: https://github.com/weavejester/ragtime/wiki/Getting-Started? it's good to be specific abt the key names

16:03 hadronzoo: yes, but it doesn't have anything about the lein command usage

16:05 zeeshanlakhani: hadronzoo: we used a ragtime profile and called out ragtime like `lein with-profile ragtime ragtime migrate -d "jdbc:postgresql:beatport_api"`

16:06 :ragtime

16:06 {:dependencies [[ragtime/ragtime.sql.files "0.3.6"]]

16:06 :plugins [[ragtime/ragtime.lein "0.3.6"]]

16:06 :ragtime {:migrations ragtime.sql.files/migrations}}

16:06 as an example

16:08 hadronzoo: zeeshanlakhani: thanks. Is there a way to list migrations?

16:08 zeeshanlakhani: https://github.com/weavejester/ragtime/blob/8e782834881164eb530ddd00bb52c01b56fb0026/ragtime.core/src/ragtime/main.clj#L57

16:10 hadronzoo: zeeshanlakhani: `thub.com/weavejester/ragtime/blob/8e782834881164eb530ddd00bb52c01b56fb0026/ragtime.core/src/ragtime/main.clj#L57

16:10 *** tbaldridge (~tim@216.207.42.140) has quit: Ping timeout: 265 seconds

16:10 *** yogthos|away (~yogthos@li231-96.members.linode.com) is now known as

16:10 yogthos

16:10 *** SirRobin (~wjc@2a01:e35:2e74:a2c0:6267:20ff:fef0:4a0) has quit: Quit:

16:10 Konversation terminated!

16:10 *** dmi3y (~dmi3y@193.110.76.165) has joined channel #clojure [15:09]

16:10 ERC> zeeshanlakhani: `lein ragtime migrate -m`? It throws a NullPointerException.

16:10 sorry about that

16:13 zeeshanlakhani: hadronzoo: ah, was confused by what you wanted... -m relates to a function you want to return the migrations to run. don't think there's a list out of the box

16:13 hadronzoo: ah, that makes sense. thanks

16:25 TEttinger: here's a teaser for you, justin_smith

16:26 give an example piece of code that returns different values based on whether or not you bound something with X or (identity X), for some value of X

16:29 gfredericks, you might also enjoy this

16:31 annapawlicka: Hello world! Where does one put a docstring in defmethod? Or is adding it to defmulti the only option?

16:32 justin_smith: annapawlicka: may or may not be relevant, defmethod has an optional name argument

16:32 arrdem: annapawlicka: defmulti is the only option. extending docstrings from implementations doesn't make a whole bunch of sense.

16:33 justin_smith: annapawlicka: specifically putting a name on a specific defmethod is useful for stack trace readability

16:33 annapawlicka: justin_smith: yup, useful in stack traces

16:34 justin_smith: :) i just wanted to document behaviour but i guess i’ll do that in defmulti

16:34 TEttinger: ,(let [agh (identity Double/NaN) hm Double/NaN] [(= agh agh) (= hm hm)])

16:34 clojurebot: [true false]

16:34 gtrav: trying to load clojure code at runtime from within java code. got it working just by calling: "RT.loadResourceScript("clojure-file-name.clj");" is there a better alternative or is this ok?

16:34 annapawlicka: arrdem: thanks. that’s what i thought

16:38 gfredericks: TEttinger: so a macro that can look at the binding form is not the sort of thing you're asking about?

16:39 TEttinger: hm, probably that would count

16:39 I just discovered...

16:39 ,(let [agh (identity Double/NaN) hm Double/NaN] [(= agh agh) (= hm hm)])

16:39 clojurebot: [true false]

16:39 amalloy: TEttinger: i don't think you need the identity call at all

16:39 ,(= Double/NaN Double/NaN)

16:39 clojurebot: false

16:40 TEttinger: the identity makes it true

16:40 amalloy: mmmmm. well, i can see why

16:40 tbaldrid_: "the identity makes it true" that needs to be a clojurebot quote

16:40 amalloy: but i admit it surprised me a little

16:40 arrdem: wait what how

16:41 amalloy: when you call identity, you box up the primitive double into a Double, and = checks for object identity, so comparing an object to itself is equal

16:41 arrdem: (inc amalloy)

16:41 lazybot: ⇒ 229

16:41 amalloy: but when you use Double/NaN directly, the compiler can leave it unboxed

16:41 arrdem: and you get the "real" not = result. gotcha.

16:43 amalloy: for anyone who is curious, the disassembly confirms my explanation: https://www.refheap.com/e1977e9796169076c58fb7295

16:44 gfredericks: really? a boxed NaN can be equal to itself?

16:44 arrdem: object equality.

16:45 gfredericks: seems like a borderline correctness problem

16:47 amalloy: gfredericks: agreed, but are you really going to add that overhead to RT/equiv for all objects?

16:48 arrdem: yes because correctness, no because if you're working with NaNs you've earned it.

16:49 gfredericks: what does java do here? boolean amalloy(Double x, Double y){return x.equals(y)}?

16:49 amalloy: gfredericks: it doesn't use a static equiv method

16:49 gfredericks: or um

16:49 what does java do for x == y?

16:50 amalloy: object identity

16:50 for x.equals(y) it does a dynamic dispatch on x's class, of course

16:50 and then you can pay the price for correctness only in Double/equals

16:50 gfredericks: so x == x is true for boxed doubles in java?

16:50 amalloy: sure

16:50 gfredericks: okay then it's fine

16:50 everything's crazy, not just clojure

16:51 arrdem: "If Java jumped off a bridge what would you do?" ~ Paul Phillips, PacNW 2013

16:51 amalloy: well, == in java is identical? in clojure, and everyone knows that, so they dont' expect it to act like =

16:51 it's a lot crazier for clojure's = to do this than for java's ==

16:51 gfredericks: I'm saying in both cases equality on NaN's is inconsistent

16:52 xPhilo: where does disassemble-str come from?

16:52 amalloy: xPhilo: no.disassemble

16:52 xPhilo: ah, thank you.

16:52 amalloy: i have it in my .lein/profiles.clj to include no.disassemble in my local repls at the time

16:52 cause you never know when i'll want to disassemble something

16:52 hiredman: ,(identical? (Double. 10.0) (Double. 10.0))

16:52 clojurebot: false

16:56 xPhilo: I'm sure it will prove fantastically useful! Certainly much easier than how I was doing it. I'm sorry I hadn't seen that library sooner!

16:56 amalloy: xPhilo: yeah i did it by hand with javap and aot compilation for a long time. what a drag

16:57 now instead of setting aside 20 minutes to disassemble something i can do it in 20 seconds

16:57 xPhilo: Then you understand my excitement right now.

16:58 amalloy: xPhilo: the other thing i have in my .lein/profiles is criterium

16:58 xPhilo: I have that one already. Thanks for the pointer though!

16:59 amalloy: see https://www.refheap.com/f4ca2b6cd16e10d3ae80b90cc for how to include no.disassemble. you want the lein plugin, not just the dependency

16:59 xPhilo: Thank you.

16:59 amalloy: and use whatever profile you want, not :swank which is for grumpy old men like me

17:06 xPhilo: Don't be apologetic for your operating system ;) It does have a pretty decent text editor after all.

17:07 justin_smith: xPhilo: :swank is the antique clojure integration for emacs

17:08 amalloy: right, for years the cool emacs kids have been using nrepl, not swank

17:08 justin_smith: amalloy: *cider

17:08 amalloy: mehhh

17:08 justin_smith: ok, "cool" leaves some room for definitions, sure

17:11 xPhilo: justin_smith: I know. Of course, I only know becuase I had just looked it up. Still, no reason to dodge a jab at emacs since I am currently in the hate part of our love/hate relationship.

17:21 matthavener: why doesn't (>! c :foo) unpark when c is (closed! c)

17:21 ?

17:22 xPhilo: Would someone here be able to tell me why in destructuring the :as key causes its symbol to be bound to the init-expr? I was surprised to find that it wasn't updated to reflect the :or when there is one.

17:22 justin_smith: matthavener: when would parking on a closed channel that can't be re-opened be useful?

17:22 amalloy: xPhilo: because that's what :as does. it gives a name for the original object

17:23 xPhilo: I read through (destructure) and read on the what, I was wondering if there was a why.

17:23 matthavener: justin_smith: my use case is some go-block producer that i want to 'tear down', and its current blocked on writing a result to 'c'

17:23 guess just need alts! with a 'tear down' channel?

17:23 xPhilo: It seems it'd be just as easy to merge.

17:25 tvanhens: are there any ring middlewares for pulling the query-params from the uri? It seems like wrap-params only pulls from the query-string so do you have to manually parse the uri in order to use wrap-params?

17:26 bloop_: I'm looking to make a Clojure server backed by a DB. I want to keep it all open source so no Datomic. What are the best options?

17:27 I'm already aware of Compojure, more interested in the DB side of things

17:28 bja: do you want to use a sql db?

17:28 and how dynamic do you need the queries to be?

17:29 bloop_: no preference for SQL but Korma looks nice

17:29 bja: i.e. if you want to build django admin, you probably can't use what I would recommend first for sql, which is yesql. If your queries are too dynamic for yesql, I'd personally recommend HoneySQL

17:30 if you don't want to use a SQL database, then you have a bunch of options, but most databases seem to have a honeysql-like library for clojure which lets you compose queries using data structures

17:31 bloop_: bja: I'll check out honeysql! sounds cool.

17:31 bja: I use honeysql and yesql for postgres, carmine for redis, and elastisch for elastic search quite a bit

17:32 bloop_: redis has always intrigued me. I'll look at carmine too.

17:33 bja: (I also fantasize daily about convincing management to let me use datomic so I don't have to continue implementing my own history system in postgres)

17:33 dah: honeysql++

17:34 justin_smith: dah: around here we use inc

17:34 bloop_: ha! datomic seems like really excellent technology. I so wish it was open source though.

17:34 justin_smith: (inc yesql)

17:34 lazybot: ⇒ 1

17:35 bloop_: lol

17:35 bja: ,(do (defalias +1 inc) (+1 yesql))

17:35 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: defalias in this context, compiling:(NO_SOURCE_PATH:0:0)>

17:36 TEttinger: ,(doc alias)

17:36 clojurebot: "([alias namespace-sym]); Add an alias in the current namespace to another namespace. Arguments are two symbols: the alias to be used, and the symbolic name of the target namespace. Use :as in the ns macro in preference to calling this directly."

17:36 TEttinger: ,(do (def +1 inc) (+1 yesql))

17:36 clojurebot: #<CompilerException java.lang.RuntimeException: First argument to def must be a Symbol, compiling:(NO_SOURCE_PATH:0:0)>

17:36 TEttinger: ,+1

17:36 clojurebot: 1

17:36 TEttinger: oh!

17:37 +1 is a valid numeric literal, like -1

17:37 gfredericks: ,+1+

17:37 clojurebot: #<NumberFormatException java.lang.NumberFormatException: Invalid number: +1+>

17:37 TEttinger: ,++1

17:37 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ++1 in this context, compiling:(NO_SOURCE_PATH:0:0)>

17:37 TEttinger: ,(do (def ++1 inc) (++1 yesql))

17:37 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: yesql in this context, compiling:(NO_SOURCE_PATH:0:0)>

17:37 TEttinger: ,(def yesql 1)

17:37 clojurebot: #'sandbox/yesql

17:37 TEttinger: ,(do (def ++1 inc) (++1 yesql))

17:37 clojurebot: 2

17:38 bja: guess I'd have to define ++

17:38 ,(do (def ++ inc) (++ yesql))

17:38 clojurebot: 2

17:39 bja: sadly, ++ is ++ is the same effort to write as inc

17:42 dah: justin_smith: whoops, old mutation habits die hard

17:42 (inc honeysql)

17:42 lazybot: ⇒ 2

17:43 TEttinger: ,(def =D inc)

17:43 clojurebot: #'sandbox/=D

17:43 TEttinger: ,(=D 9000)

17:43 clojurebot: 9001

17:45 justin_smith: dah: the silly thing is that inc shouldn't even mutate, but whatever, it's just a bot trigger not real clojure

17:46 now, on the other hand, if we had (send honesql inc)

17:46 much more reasonable

17:46 or even swap!

17:46 AeroNotix: yeah swap makes more sense

17:46 (swap! justin_smith inc)

17:46 we are all just atoms

17:47 seems deep as well

17:47 esp. after 3 glasses of Zinf

17:49 http://25.media.tumblr.com/tumblr_m8inbwUJFB1rounybo1_500.png I feel like this kid. Except not chicken nuggets, but Clojure.

18:18 dah: or maybe (inc!) heh

18:20 TimMc: ,(condp :>> :>> :>> :>>)

18:20 clojurebot: :>>

18:20 TimMc: I hate that macro.

18:21 ,(condp :>> :>> :>>)

18:21 clojurebot: :>>

18:23 TimMc: ,(eval (#'condp = :>> :>> :>> = #'condp))

18:23 clojurebot: #<ExceptionInInitializerError java.lang.ExceptionInInitializerError>

18:23 TimMc: oh shush

18:24 hadronzoo: In clojure.java.jdbc, create-table has been depreciated. Should one use create-table-ddl to create a ddl string and then execute that string?

18:37 amalloy: $dict Apophenia

18:37 lazybot: amalloy: Word not found.

18:38 justin_smith: $google define:apophenia

18:38 lazybot: [Apophenia - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Apophenia

19:10 numberten: are there (r)subseq functions that work with arbitrary comparison functions? as opposed to just numeric ones?

19:10 it seems like they should be more general than that

19:12 amalloy: numberten: they all actually work with whatever comparator you gave to the sorted map/set

19:12 &(subseq (sorted-map :a 1 :c 2) > :b)

19:12 lazybot: ⇒ ([:c 2])

19:12 clojurebot: Cool story bro.

19:14 numberten: interesting

19:15 i have a program where (comp reverse rsubseq) does not equal (subseq) when given the same arguments

19:16 i assumed it was my comparison function, but maybe not

19:52 dcunit3d: hey whats up everyone?

20:01 amalloy: (let [{x :x, {x :x} :m} {:x 1 :m {:x 2}}] x). any bets on what will happen?

20:06 AeroNotix: hm

20:06 TimMc: Seen this, it binds in arbitrary order I think?

20:06 AeroNotix: I would like to say the compiler just says "LOLNiceTryException"

20:06 TimMc: based on hashes of keys

20:07 AeroNotix: ,(let [{x :x, {x :x} :m} {:x 1 :m {:x 2}}] x)

20:07 clojurebot: 2

20:07 AeroNotix: ,(macroexpand '(let [{x :x, {x :x} :m} {:x 1 :m {:x 2}}] x))

20:07 clojurebot: (let* [map__53 {:x 1, :m {:x 2}} map__53 (if (clojure.core/seq? map__53) (clojure.lang.PersistentHashMap/create (clojure.core/seq map__53)) map__53) x ...] x)

20:07 AeroNotix: yeah well

20:09 TimMc: Is it strictly reverse order, or hash-based?

20:16 amalloy: TimMc: it's the array map, there shouldn't be any hashes. but of course that's not guaranteed

20:18 xPhilo: I see. . . I think.

20:19 (let [{x :x, {y :x} :m} {:x 1 :m {:x 2}}] [x y])

20:40 numberten: is there a concat-esque function for sorted collections (sets)?

20:40 i guess that would be union (assuming you maintain the sortedness)

20:40 amalloy: into

20:40 numberten: ,(let [s1 (sorted-set "foo") s2 (sorted-set "bar" "foo")] (type (clojure.set/union s1 s2)))

20:40 clojurebot: #<CompilerException java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:0:0)>

20:42 numberten: very nice

21:14 justin_smith: ,(require '[clojure.set :as set])

21:14 clojurebot: nil

21:14 justin_smith: it's not automatic

21:14 ,(let [s1 (sorted-set "foo") s2 (sorted-set "bar" "foo")] (type (set/union s1 s2)))

21:14 clojurebot: clojure.lang.PersistentTreeSet

21:15 justin_smith: ,(type (sorted-set "foo" "bar"))

21:15 clojurebot: clojure.lang.PersistentTreeSet

21:15 justin_smith: set/union should just be conj

21:17 ahh, of course, there are some optimizations

21:17 bubble-max-key

22:27 hey guys, http2.0 support should be out in browsers in a few weeks - how long before we can support it from a ring server I wonder?

23:35 TEttinger: I'm having fun

23:35 ,(let [mystery (identity Double/NaN), mystery (. Double NaN)] [(= mystery, mystery) (= mystery, mystery)])

23:35 clojurebot: [true false]

23:38 justin_smith: TEttinger: https://hossofsauce.files.wordpress.com/2012/04/teacher-scolding1.jpg

23:39 TEttinger: ,(let [mystery (identity Double/PI), mystery (. Double PI)] [(= mystery, mystery) (= mystery, mystery)])

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

23:40 TEttinger: ,(let [mystery (identity Math/PI), mystery (. Math PI)] [(= mystery, mystery) (= mystery, mystery)])

23:40 clojurebot: [true true]

23:46 sm0ke: hello need little help with a macro, or function whatever can do

23:46 TEttinger: hey sm0ke, what's the problem?

23:47 justin_smith, our resident help-and-karma-machine, is available last I checked

23:47 ,(let [mystery (identity Double/NaN), mystery2 (. Double NaN), mystery3 Double/NaN] [(= mystery, mystery) (= mystery2, mystery2) (= mystery3, mystery3)])

23:47 clojurebot: [true false false]

23:47 justin_smith: haha

23:47 TEttinger: no BOMs in that one, and it's still wonky

23:47 sm0ke: so i need to pass a string which would be a function e.g. "inc" and a arg e.g. 1, the func/macro should compile string and pass it arg

23:47 hello TEttinger

23:48 TEttinger: I thought class/member was sugar for (. class member), but it ain't

23:49 justin_smith: anyway, should it be like - any function in clojure? or do you want only certain ones to be accepted?

23:49 TEttinger: ,(fn [fname & args] (eval (conj (list args) (read-string fname))))

23:49 clojurebot: #<sandbox$eval49$fn__50 sandbox$eval49$fn__50@364895a>

23:49 TEttinger: oops

23:50 ,((fn [fname & args] (eval (conj (list args) (read-string fname)))) "inc" 2)

23:50 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

23:50 justin_smith: TEttinger: it should be 2 "inc"

23:50 TEttinger: I thought conj on lists prepended

23:50 justin_smith: it does

23:50 but the inc got prepended first

23:50 then the 2

23:50 ,(conj () 1 2)

23:51 clojurebot: (2 1)

23:51 sm0ke: sorry got disconnected

23:51 this is what i have comeup with till now https://www.refheap.com/97515

23:51 justin_smith: TEttinger: (def reverse (partial apply conj ()))

23:51 TEttinger: ,((fn [fname & args] (eval (conj () args (read-string fname) 'apply))) "inc" 2)

23:51 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

23:51 sm0ke: the problem is it works with contants but not vars

23:52 justin_smith: TEttinger: the inc got conjed on first, so is after the 2

23:52 switch their order

23:52 TEttinger: ,((fn [fname & args] (eval (conj () 'apply (read-string fname) args))) "inc" 2)

23:52 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

23:52 justin_smith: sm0ke: outside of loading source code, you have to explicitly resolve or look up symbols to get their var/binding

23:53 sm0ke: ,((eval (read-string "inc")) 1)

23:53 clojurebot: 2

23:53 justin_smith: TEttinger: you still didn't reverse the order of the "inc" and the 2

23:53 TEttinger: in the... arguments?

23:53 justin_smith: sm0ke: resolve would have worked too

23:53 TEttinger: I passed fname and args

23:53 sm0ke: ,(let [a "inc"] ((eval (read-string a)) 1))

23:53 clojurebot: 2

23:53 justin_smith: TEttinger: right, and they get conjed

23:53 sm0ke: yea this should do

23:53 justin_smith: ,((resolve (symbol "inc")) 1)

23:53 clojurebot: 2

23:53 sm0ke: why do you need all that just eval of read-string should be good?

23:54 justin_smith: sm0ke: don't use eval unless you need all of its features

23:54 it's expensive, and can do pretty much anything

23:54 TEttinger: justin_smith, can you make that take varargs with the string first?

23:54 rhg135: ,(if-let [v (resolve "+")) @v)

23:54 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>

23:54 rhg135: ,(if-let [v (resolve "+")] @v)

23:54 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.Symbol>

23:54 rhg135: meh

23:54 sm0ke: ,(let [a "inc"] ((resolve (read-string a)) 1))

23:54 clojurebot: 2

23:54 TEttinger: ,(if-let [v (resolve '+)] @v)

23:54 justin_smith: rhg135: you need a symbol

23:54 clojurebot: #<core$_PLUS_ clojure.core$_PLUS_@79dea99>

23:54 rhg135: ah

23:54 sm0ke: ,(let [a "#(inc %)"] ((resolve (read-string a)) 1))

23:54 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol>

23:55 sm0ke: ,(let [a "#(inc %)"] ((eval (read-string a)) 1))

23:55 clojurebot: 2

23:55 rhg135: justgreg, i realized it right after i typed it

23:55 sm0ke: i need eval for this

23:55 justin_smith: sm0ke: you can't resolve a whole form, just symbols

23:55 rhg135: im done typing

23:55 sm0ke: justin_smith: got it,

23:55 thanks justin_smith and TEttinger

23:55 rhg135: apologies for the ping

23:55 sm0ke: i am forgetting basic things nowdays

23:55 TEttinger: (inc justin_smith)

23:55 lazybot: ⇒ 189

23:55 justin_smith: ,((fn [fname & args] (eval (conj () 'apply (read-string fname) 2 "inc")

23:55 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

23:55 sm0ke: (inc [ TEttinger justin_smith ])

23:55 lazybot: ⇒ 1

23:56 sm0ke: lol

23:56 justin_smith: ,((fn [fname & args] (eval (conj () 'apply (read-string fname) args))) 2 "inc")

23:56 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String>

23:56 justin_smith: erm

23:56 OK

23:56 sm0ke: what is it with the conj thingy??

23:56 lazybot: sm0ke: Definitely not.

23:57 justin_smith: sm0ke: nothing really

23:57 TEttinger: sm0ke, trying to get it to take more than 1 argument

23:57 justin_smith: ,(conj () 1 2 3 4 5)

23:57 clojurebot: (5 4 3 2 1)

23:57 justin_smith: aha

23:57 ,((fn [fname & args] (eval (conj () (read-string fname) args 'apply))) "inc" 2)

23:57 sm0ke: ,(let [a "#(+ %1 %2)"] (apply (eval (read-string a)) [1 2]))

23:58 clojurebot: 3

23:58 #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

23:58 TEttinger: which was which???

23:58 lazybot: TEttinger: How could that be wrong?

23:58 justin_smith: TEttinger: you just had apply on the wrong end :) ^

23:58 ,((fn [fname & args] (eval (conj () (read-string fname) args 'apply))) "inc" 2)

23:58 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

23:58 TEttinger: hahaha

23:58 justin_smith: err....

23:58 sm0ke: just apply args to eval

23:58 justin_smith: ,((fn [fname & args] (eval (conj () args (read-string fname) 'apply))) "inc" 2)

23:58 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

23:59 TEttinger: ,((fn [fname & args] (apply eval (read-string fname) args)) "inc" 2)

23:59 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/eval>

23:59 justin_smith: ,((fn [fname & args] (conj () args (read-string fname) 'apply)) "inc" 2)

23:59 clojurebot: (apply inc (2))

Logging service provided by n01se.net