#clojure logs

2015-02-18

00:55kaplanjustin_smith, still there?
01:04lvhHi! Is there a specific tool I can use to help me build fake ring request maps, for testing?
01:04lvhI think https://github.com/ring-clojure/ring-mock is the most suitable one, but wanted to ask.
01:08namralvh: yea rink-mock works fine
01:08namrabut depends on your demand for queries
01:08namraif they are pretty simple that'll do
01:11lvhnamra: Thanks!
01:12lvhon 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?
01:15michaelr`so anyone knows if I can use any React component from Om? are there some gotchas?
01:34ewemoalvh: how does this look? https://github.com/clojure-emacs/clj-refactor.el#user-content-automatic-insertion-of-namespace-declaration
01:34lvhyessss
01:34lvhthanks!!!
01:36ewemoa:)
04:17swiHello. 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).
04:24mindbender1clojure.java.io/as-file is having trouble with #<URL file:/home/me/projects/clojure/%s/classes>
04:24mindbender1How can I work around this?
04:25mindbender1The exception message is : IllegalArgumentException URLDecoder: Illegal hex characters in escape (%) pattern - For input string: "s/" java.net.URLDecoder.decod
04:27winkmindbender1: 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
04:28mindbender1wink: Actually it's dynapath that returns that URL among others. I had to trace it out. don't even know how it generates that.
04:29winkmindbender1: yeah, no clue. just saying.if you're parsing it as an url, it needs to be an url :P
04:29mindbender1I have filed the issue with them on github. I think it's a problem of improper percent encoding as reported on stackoverflow.
04:31mindbender1wink: Sure but the context doesn't allow that granularity of control.
05:30swihmm.. can't force aleph to be a good udp receiver, but java.net can...
05:37Arie741anybody uses heroku?
06:08crash_epAre there any known problems with getting cljsjs-dependent libraries to load in a weasel/piggieback REPL?
06:08Guest82617crash_ep: yes
06:08Guest82617crash_ep: search the weasel repo for "cljsjs.react"
06:08crash_epGuest82617: thanks for the pointer, I will do that now
06:08Guest82617crash_ep: I believe it's at least partly fixed in newer versions
06:13crash_epGuest14243: thanks for that, looks like I would need to use weasel 0.6.0-SNAPSHOT to work around it.
06:13crash_epwhoops
06:13crash_epGuest82617: thanks for that, looks like I would need to use weasel 0.6.0-SNAPSHOT to work around it.
06:13crash_epwhoops
06:14crash_epmartinklepsch: thanks for that, looks like I would need to use weasel 0.6.0-SNAPSHOT to work around it.
06:14martinklepschcrash_ep: yes
06:15martinklepschI want something like `every?` but for multiple predicates on one value with proper short circuiting. Is there such thing?
06:16martinklepsch,(every? true? ((juxt even? neg?) -2))
06:16clojurebottrue
06:16martinklepsch,(every? true? ((juxt even? neg?) -3))
06:16clojurebotfalse
06:17martinklepschkind a like this juxt isn't lazy so it's evaluates all predicates before coming to a conclusion
06:17martinklepsch*but juxt isn't ...
06:37hyPiRionsome-pred
06:37hyPiRionerr, every-pred
06:38hyPiRionmartinklepsch: ##((every-pred even? neg?) -3)
06:38lazybot⇒ false
06:39martinklepschhyPiRion: duh. :D thank you :)
06:39TEttinger(inc hyPiRion)
06:39lazybot⇒ 70
07:00adgtlWhat is alternative like omniauth in Clojure
07:00adgtllike oauth strategies?
07:02michaelr`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 ?
07:03michaelr`how I could..
07:04michaelr`ah.. maybe specify!
07:05TEttingeradgtl: friend?
07:05TEttingeradgtl: https://github.com/cemerick/friend
07:05adgtlah okay
07:05adgtlTEttinger: thanks
07:05TEttingernp
08:02matthavenerare 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?)
08:02matthavener[0] https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/timers.clj#L51
08:27jamieiDoes 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.
08:30vasjamiei: have you seen this? http://comments.gmane.org/gmane.comp.java.clojure.aleph/717
08:31mbaci have to translate some matlab code into clojure. what's the closest thing to matlab's arrays? is it mikera's matrix lib?
08:31justin_smithjamiei: 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
08:32justin_smithjamiei: which is also reflected in that mailing list post, so yeah, looks simple enough
08:34jamieiooh, thanks vas and justin_smith, will take a look at those links.
08:43jamieivas: justin_smith: Thanks for the pointers, all sorted.
08:48vasjamiei: awesome. ^_^ may the parens be with you
08:48justin_smithcool
08:54jamiei:)
09:23julianlevistonI 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
09:24julianlevistonI 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
09:24julianlevistonI 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
09:24perplexa¬_¬
09:24julianlevistonI 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
09:24julianlevistonitem-to-be-cached.
09:24julianlevistonIs 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?
09:24perplexaplease don't spam
09:25julianlevistonErm… what do you mean?
09:25Empperiespecially since part of your text was cut off
09:25Empperiwell you sent the exact same text 4 times
09:25julianlevistonI did?
09:25perplexai mean that you just pasted an incomplete wall of text 4 times
09:25Empperibut it was cut off at "debouncing, but per"
09:25TEttingeryeah, 2 seconds apart
09:25julianlevistonSorry, 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
09:25TEttingernetwork issue?
09:25TEttingerah
09:26julianlevistonapologies.
09:26perplexayou might want to use a pastebin
09:26julianlevistonfair
09:26Empperirefheap! It's #clojure after all :)
09:26perplexahehe
09:26TEttingeror just send multiple messages, since there were logical sentence splits in there
09:26julianlevistonYeah, I tried to do that.
09:28julianlevistonThis is my question : https://www.refheap.com/97487
09:31julianlevistonI’m wondering if there might be a simpler way to achieve what I’m going for… hmmm :)
09:33gfredericksamalloy_: oh hey I figured out how to rewrite the nasty macro from yesterday without using external state
09:33gfredericksamalloy_: 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
09:34gfrederickscould also be any dummy arg that takes metadata
09:39TimMc_julianleviston: What IRC client are you using?
09:39julianlevistonColloquy
09:39julianlevistonTimMc_: for mac.
09:39TimMc_Have you looked at core.cache? I don't think that will handle the debouncing, though.
09:40julianlevistonTimMc_: I’ve got a cache already. I also have a debounce function. They’re fine.
09:40julianlevistonTimMc_: mostly I’m just after advice about whether that’s an insane way to do it - one chan per entity...
09:41TimMc_Ah, I see.
09:42julianlevistonand 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?
09:42TimMcI'm none too familiar with core.async, unfortunately.
09:43TimMcDoesn't core.cache have expiration? You could have an expiring cache of channels.
09:43julianlevistonTimMc: this is cljs
09:43TimMcOh!
09:43julianlevistonTimMc: and I don’t want the cache to expire, I want the chans to expire
09:43julianlevistonTimMc: the debounce chans…
09:43TimMcWell, now this is totally out of my area.
09:44julianlevistonTimMc: hehe :) sorry! and thanks for the helpful thoughts
10:07michaelr`just burned a few good hours and my brain, trying to fit a react drag and drop mixin component with Om.
10:08michaelr`anyone knows anything about this stuff?
10:11julianlevistonmichaelr`: 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:12julianlevistonmichaelr`: sorry, I mean I use Om all the time… (and obviously react too)
10:19michaelr`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:19michaelr`and my om mixin example reference is this one: https://github.com/omcljs/om/blob/b549554964fe5b53189222e97e77fc2db34aebd6/examples/mixins/src/core.cljs
10:20julianlevistonmichaelr`: I’m assuming you’ve compared and contrasted the drag n drop example that the om site links to?
10:21michaelr`this component looked more complete and mature to me..
10:22michaelr`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:23michaelr`the mixin component seems to handle all the heavy lifting.
10:23julianlevistonAh ok
10:23julianlevistonwhat’s dnd?
10:24julianlevistonoh god… lol drag n drop. sorry…
10:26julianlevistonmichaelr`: I assume you’ve looked at the sortable example? https://github.com/omcljs/om/blob/b549554964fe5b53189222e97e77fc2db34aebd6/examples/sortable/src/core.cljs
10:26julianlevistonmichaelr`: has a “generic draggable” in there...
10:26julianlevistonmichaelr`: might be a good start?
10:27julianlevistonmichaelr`: I don’t suppose you’re a pro at core.async by any chance, are you? :)
10:28michaelr`julianleviston: not a pro :)
10:29julianlevistonmichaelr`: here’s my question: https://www.refheap.com/97487
10:29michaelr`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:29llasramb
10:29llasramheh, wrong buffer
10:31julianlevistonmichaelr`: so what isn’t working about it?
10:32michaelr`regarding your question, i didn't really understand it :) can you maybe make it more simple?
10:32michaelr`it seems that you are asking many questions there
10:33julianlevistonmichaelr`: yeah… I kind of am.
10:34julianlevistonmichaelr`: 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:34michaelr`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:35julianlevistonmichaelr`: 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:36julianlevistonmichaelr`: man that sounds complex
10:36michaelr`what do you mean by debouncing?
10:36sveriHow do I call a function x times and put the functions result into a vec?
10:37michaelr`,(doc repeat)
10:37clojurebot"([x] [n x]); Returns a lazy (infinite!, or length n if supplied) sequence of xs."
10:37michaelr`no
10:37justin_smithmichaelr`: to call a function n times you want repeatedly
10:37julianlevistonsveri: the pass that into “into []”
10:37michaelr`,(doc times)
10:37clojurebotCool story bro.
10:37justin_smithand into to put it in a vec
10:37justin_smithmichaelr`: repeatedly
10:37michaelr`sveri: what justin_smith
10:37michaelr`said
10:38justin_smith,(into [] (repeatedly 10 rand))
10:38clojurebot[0.1591637445756442 0.7522457558793089 0.4153232341251093 0.1170311821530805 0.4616383407167318 ...]
10:38sverithank you all :-)
10:38justin_smithsveri: why a vec?
10:38julianlevistonmichaelr`: 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:40sverijustin_smith: well, a list would be ok too
10:40clojurebotPardon?
10:40justin_smithsveri: that's why I asked, in that case you don't need the into part
10:40michaelr`julianleviston: like a buffer which items you make distinct and flush once in a while?
10:41sverijust a seq of a functions results
10:41justin_smithjulianleviston: what about something from core.cached? I think they have a mechanism where a calculation currently in the works is not restarted
10:41AeroNotixjulianleviston: simplest way is to use a RWLock
10:41AeroNotixa map of {:key {:value Var :lock Lock}}
10:42justin_smithjulianleviston: core.cached also has mechanisms for dropping old contents
10:42AeroNotixhttp://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/ReadWriteLock.html
10:42julianlevistonmichaelr`: 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:42julianlevistonI’m on cljs guys...
10:42AeroNotixdang
10:42julianlevistonjustin_smith: so no core.cached
10:42julianlevistonAeroNotix: and no java
10:42AeroNotixSheeeit
10:43Jaood;)
10:43julianlevistonbut the debouncing isn’t a problem. i’ve already got that.
10:43AeroNotixWhat are you referring to as "debouncing"?
10:43tbaldridgeshould be pretty easy to port the needed bits from core.cached
10:43julianlevistonAeroNotix: this: https://gist.github.com/scttnlsn/9744501
10:44julianlevistontbaldridge: 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:45tbaldridgejulianleviston: how many entities will you have?
10:46julianlevistontbaldridge: it’s not known.
10:46tbaldridgeand how much churn will there be
10:46julianlevistontbaldridge: anywhere from 10 to 400
10:46tbaldridgeAnd the churn? Will they last 1 sec, 1ms?
10:47AeroNotixthis debounce seems to put some value on the channel when there hasn't been any activity for the timeout, right?
10:47julianlevistontbaldridge: do you mean how many times will they be debounced per time? or how long before I want the chans to expire?
10:47tbaldridgehow long before the chans expire
10:47julianlevistonAeroNotix: yup!
10:47AeroNotixhow will you be using that?
10:47julianlevistontbaldridge: oh… um… 5 secs, I guess?
10:47tbaldridgeyeah, that should work then
10:47julianlevistontbaldridge: what should work?
10:47tbaldridgeone chan per entity.
10:48AeroNotixDon't guess. Measure.
10:48julianlevistontbaldridge: ohhhhhh awesome… thanks
10:48julianlevistonAeroNotix: didn’t tbaldridge write the core.async go block code?
10:48tbaldridgeThink 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:48julianlevistontbaldridge: you did, right?
10:48AeroNotixI don't care, and I know tbaldridge wrote the code
10:49AeroNotixbut just saying "that should be fine" is a guess. Implement. Measure. Iterate.
10:49tbaldridgeyes, always measure, that too ;-)
10:50julianlevistonAeroNotix: Well I was after advice about whether it was a good way to do it…
10:50tbaldridgeI mean questions like "is this sane" is a very open-ended question, AeroNotix, how to you measure sanity of code
10:50AeroNotixtbaldridge: there's a lot of needed context before you answer a question like that, though.
10:50julianlevistonAeroNotix: because quite often, someone says “oh, just do this”…. (inrest some very elegant way)
10:51julianlevistoninsert*
10:52julianlevistonNow I have to think of a way to “expire” then chans...
10:53julianlevistontbaldridge: 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:55julianlevistontbaldridge: 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:55tbaldridgegos 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:55tbaldridge(assuming the go block is waiting on that channel)
10:55julianlevistontbaldridge: oh man… THAT would have been excellent to know a while ago…
10:56julianlevistontbaldridge: yeah it’ll be waiting on the in chan… so if I garbage collect that, all should be good…
10:57julianlevistontbaldridge: thanks for that bit of knowledge!
10:57julianlevistonwiring all this up is going to take some thought ;-)
11:07TimMc,#.{}
11:07clojurebot#<RuntimeException java.lang.RuntimeException: Record construction syntax can only be used when *read-eval* == true>
11:08llasramnice
11:08TimMclocally I get: ClassNotFoundException / java.lang.Class.forName0 (Class.java:-2)
11:11Bronsa,#.
11:12clojurebot#<RuntimeException java.lang.RuntimeException: Record construction syntax can only be used when *read-eval* == true>
11:12hyPiRion&#.foo{}
11:12lazybotjava.lang.RuntimeException: Record construction syntax can only be used when *read-eval* == true
11:13Bronsalooks like it's not even reading the ctor args
11:13Bronsathat's somewhat surprising
11:14julianlevistonI don’t follow why this is weird
11:15justin_smithjulianleviston: #. is a weird ass invalid record constructor
11:15julianlevistonjustin_smith: I still don’t get it, but ok. :S
11:16justin_smithjulianleviston: if you saw #. in code, what would you expect it to be?
11:16justin_smitha blatant error?
11:16julianlevistonjustin_smith: an error
11:16Bronsajustin_smith: what surprises me is that #foo.bar [1] errors out on foo.bar but after that it evaluates [1]
11:16justin_smithexactly
11:16Bronsajustin_smith: as opposed to what happens for #foo [1]
11:16justin_smithBronsa: oh, that's a separate thing, OK
11:16julianlevistonbut it’s not an error like that… it’s a blank record constructor
11:17julianlevistonwith no namespace… right?
11:17Bronsayeah, ctor syntax doesn't consume the argvec in case of error
11:20julianlevistonI 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:20julianlevistonI must be missing something.
11:21justin_smithjulianleviston: if you have an arg, it will return the arg
11:21justin_smithas if it weren't an arg, but just supplied on its own
11:22julianlevistonjustin_smith: it seems to spit out a map
11:23julianlevistonbut I don’t think that’s what it’s doing… (type #.{}) ; -> RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:221)
11:23julianlevistonOk I get you. It’s all borked up.
11:23julianlevistonsorry for being so dense!
11:26ajmagnificoanyone: I have a namespace A, into which I am using (ns :use) to bring in functions from namespace X and namespace Y.
11:26ajmagnificoNamespace X belongs to a 3rd party library.
11:26ajmagnificoI wrote Namespace Y.
11:26ajmagnificoNamespace Y has a function that I deliberately named in order to cover up a function with the same name in Namespace X.
11:27ajmagnificoClojure gives me this exception:
11:27Bronsaajmagnifico: don't use :use, use :require with :refer or :as
11:27ajmagnifico$join already refers to: #'incanter.core/$join in namespace:
11:27lazybotajmagnifico: It is not the case that you don't not unhave insufficient privileges to do this.
11:28justin_smithajmagnifico: as Bronsa says, :use is considered poor style
11:29TimMchyPiRion: Ugh, so close to being valid syntax: (. #"" '"=")
11:29ajmagnificoJust specify only those things that I actually need, right?
11:29TimMc,(. #"" '"=")
11:29clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: quote for class java.util.regex.Pattern>
11:29ajmagnificoFair enough.
11:29ajmagnificothanks justin_smith and bronsa
11:29justin_smithajmagnifico: if you ever refactor your namespaces you'll be glad you did it that way
11:33hyPiRionTimMc: ooh
11:33BronsaTimMc: that technically is valid syntax
11:34julianlevistonajmagnifico: or even if you just go back and want to understand your code later!
11:34ajmagnificoI'm using incanter,
11:34ajmagnificofor statistical analysis
11:34ajmagnificoso there are many functions in incanter.core
11:34TimMchyPiRion: (meta ^#=(keyword "test") []) ;;= {:test true}
11:34ajmagnificoAnd the lazy side of me was just tempted to use (:use incanter.core)
11:35ajmagnificoDiscipline!
11:35hyPiRionTimMc: what about it?
11:35hyPiRionthat one I know
11:35TimMcNothing, really. I don't think I'd seen that abuse before.
11:35hyPiRionoh
11:39julianlevistonAt what point does a record start to have perf benefits over a map? in the hundreds, or thousands of items?
11:40julianlevistonactually it’s probably more like space benefits isn’t it? I can’t remember.
11:40TimMcI think it's access perf.
11:40kaplanjustin_smith, thank for being so helpful
11:41kaplan(inc justin_smith )
11:41lazybot⇒ 5
11:42julianleviston(inc tbaldridge)
11:42lazybot⇒ 18
11:44julianlevistonTimMc: Cool, thanks: http://stackoverflow.com/questions/4575170/where-should-i-use-defrecord-in-clojure
11:44julianleviston(inc TimMc)
11:44lazybot⇒ 93
11:51EremoxAnyone has any experience with quil?
11:53Eremox hello?
11:56dweaveanyone read this? http://www.vpri.org/pdf/tr2011001_final_worlds.pdf . is there anything in clojure that reifies this
11:57dweaveare cursors / lens similar?
11:58SegFaultAXdweave: There are a few different notions of cursors, so I'm not sure which you're specifically referring to.
11:58dweavei guess Om’s
11:58SegFaultAXBut I will say that lenses are extremely generic.
11:59SegFaultAXOh, then no. Those cursors represent a tiny fraction of what lenses can do.
12:00dweaveso what are these “worlds” then really?
12:00dweaveis clojures stm like this?
12:02dweaveah section 8 is a pretty good description.. I’m just rereading a second time
12:05gfrederickshas anybody started/finished working on integrating cljfmt with emacs?
12:12anildigitalHas anyone worked with friend-oauth2?
12:13anildigitalI am trying to do foursquare oauth with it
12:13anildigitalbut getting redirected to http://localhost:3000/auth/callback .. instead of it doing flow of fetching access_token
12:13adgtlHere is code example https://github.com/anildigital/foursquare-1self/blob/master/src/foursquare_1self/handler.clj
12:19TimMchyPiRion: Do you have thoughts on whether -> and ->> can achieve any final arrangement of non-macro expressions?
12:21hyPiRionTimMc: 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:22hyPiRionBut I'm pretty sure you can reorder atoms in whatever way you want
12:22hyPiRion(i.e. non-collections)
12:24gfredericksthe cljfmt readme says that cider 0.9+ supports cljfmt but the cider repo shows no signs of 0.9 being a thing
12:24Bronsa,(macroexpand-1 '(-> 1 2 3 4))
12:24clojurebot(4 (3 (2 1)))
12:24Bronsa,(-> 1 2 3 4 quote)
12:24clojurebot(4 (3 (2 1)))
12:24Bronsamy mind is blown right now
12:25hyPiRionBronsa: oh, you've seen nothing
12:25schmirgfredericks: I'm using cider 0.9.0snapshot
12:26hyPiRion,((-> [n] #(if (zero? n) 1 (* n (fact (- n 1)))) (->> (-> fact))) 10)
12:26clojurebot3628800
12:26BronsahyPiRion: I'm not even going to try and parse that
12:27hyPiRion,(require '[clojure.walk :refer [macroexpand-all]])
12:27clojurebotnil
12:27hyPiRion,(macroexpand-all '(-> [n] #(if (zero? n) 1 (* n (fact (- n 1)))) (->> (-> fact))))
12:27clojurebot(fn* fact [n] [] (if (zero? n) 1 (* n (fact (- n 1)))))
12:27Bronsathat's fun
12:27kaplanWait
12:27kaplanUnquote is the opposite of quote
12:27kaplanMy mind is blown
12:28kaplanpoof
12:30vasO_O
12:30vasCODE IS DATA
12:32gfredericksschmir: okay cool thanks
12:32schmirgfredericks: I'm installing from melpa
12:36gfredericksI mostly got confused expecting the cider repo to mention cljfmt somehow or another but it's actually the cider-nrepl repo that does
13:07kras,(let [[n l r & st] '(:a :b nil)] st)
13:08clojurebotnil
13:09kraswhy does the above code give the below error on tryclj.com
13:09krasjava.lang.IllegalArgumentException: let requires an even number of forms in binding vector in clojure.core:
13:10socksykras: works for me
13:10socksytypo?
13:12krassocksy: you tried on tryclj.com?
13:12TimMcWorks for me too.
13:12TimMcAnnoying that I can't paste into that page.
13:12TEttingeryou can totally make it send that error
13:12TEttinger,(let [[n l r & st] '(:a :b nil)] st)
13:12clojurebot#<CompilerException java.lang.IllegalArgumentException: let requires an even number of forms in binding vector in sandbox:, compiling:(NO_SOURCE_FILE:0:0)>
13:13TEttingerI stuck a unicode invisible char in there
13:13TimMc:-)
13:14TEttingerit could be that your input is switching between RTL and LTR modes, which causes that same invisible char
13:15socksykras, yes, did
13:17TEttinger,(count "(let [[n l r & st] '(:a :b nil)] st)")
13:17clojurebot36
13:17TEttingercan you verify that that form (without the opening comma) is also 36 chars?
13:18lxsameerhey folks, I'm looking for an IMAP or pop3 library to create a proxy mail server, do you know any?
13:19TEttingerlxsameer: most home-run mail servers get flagged as spam
13:20lxsameerTEttinger: I see, I want to create a proxy mail server to serve mailgun api via IMAP
13:21krasI typed the expression again and it works fine now
13:21krasit is 36 chars
13:21TEttingerweird stuff, kras.
13:21TEttingermaybe their server had a hiccup and only received some of your chars
13:22TEttinger(the first time i mean)
13:22TEttingermissing a ] would do that I think
13:22TEttinger,(let [[n l r & st '(:a :b nil)] st)
13:22clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
13:22TEttingerhm nope
13:24krasGive me some Clojure:
13:24kras> > (let [[n l r & st] '(:a :b nil)] st)
13:24krasjava.lang.IllegalArgumentException: let requires an even number of forms in binding vector in clojure.core:
13:24kras#<core$_GT_ clojure.core$_GT_@67a3677b>
13:24kras> (count "> (let [[n l r & st] '(:a :b nil)] st)
13:24krasjava.lang.IllegalArgumentException: let requires an even number of forms
13:24krasjava.lang.RuntimeException: EOF while reading string
13:24kras> (count "(let [[n l r & st] '(:a :b nil)] st)")
13:24kras36
13:24kras> (let [[n l r & st] '(:a :b nil)] st)
13:24krasnil
13:25krasHere is the sequence pasted from tryclj.com
13:26krasmight be a glitch or something, very confusing for a beginner
13:26krasnevermind I have CIDER plugin for my emacs now, so trying out at the local REPL
13:27TEttingerah!
13:27TEttingerthe first one had two >
13:28TEttinger,(let [[n l r & st] '(:a :b nil)] st)
13:28clojurebotnil
13:28TEttinger,> (let [[n l r & st] '(:a :b nil)] st)
13:28clojurebot#<core$_GT_ clojure.core$_GT_@6fdf5e5>
13:33RaynesI 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:33RaynesIf they knew what went on in there, they'd not be surprised at glitches. :p
13:33TEttingerhehe
13:42kras:-)
13:52TimMc,(:special-form (meta #'fn))
13:52clojurebottrue
13:55justin_smithLIES
13:57TimMcInteresting.
13:57TimMc,(macroexpand-1 '(fn [aaa [bbb]] 5))
13:57clojurebot(fn* ([aaa p__51] (clojure.core/let [[bbb] p__51] 5)))
13:58TimMcThat's a reasonable way of doing it, of course.
13:58AeroNotixTimMc: how else would you do it?
13:58TimMcI'd never considered it before.
13:59AeroNotixI'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:00gtravtrying 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:02justin_smithgtrav: read just parses
14:02justin_smithgtrav: read does not eval (usually)
14:02justin_smithyou want load, or require
14:02gtravrequire since the functions will later be run
14:04hiredmanif 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:04hiredmanRT.var("require").invoke(RT.var("clojure.core", "symbol").invoke("some.ns")) modula some casts maybe
14:05AeroNotixso what's the best way to write a clojure library that looks "normal" from Java. Because that interop is gross^
14:05AeroNotix(:gen-class) with all the bells and whistles?
14:06justin_smithAeroNotix: 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:06gtravthanks 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:06AeroNotixjustin_smith: I just want to write a clojure library that some java colleagues can use seamlessly.
14:06AeroNotixand I want them to not have to deal with any cognitive overhead
14:07amalloyAeroNotix: i have a perfect example for you, if i do say so myself
14:07AeroNotixamalloy: shoot it my way!
14:07amalloyhttps://github.com/amalloy/thrift-gen
14:08amalloyit's a clojure library with a java front-end adapter included
14:08AeroNotixso I'll need to write java?
14:09amalloyit'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:10AeroNotixamalloy: thanks for the example. This java file looks like I could deal with that fine. Thanks!
14:10hiredmangtrav: *shrug* use whatever you want
14:11amalloyAeroNotix: 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:12AeroNotixamalloy: indeed, sounds good to me.
14:14lxsameerguys, is there any networking library for clojure ? something like twisted for python or event machine for ruby ?
14:15AeroNotixlxsameer: what are you trying to solve?
14:15justin_smithlxsameer: we have SO MANY NETWORKING LIBRARIES
14:15lxsameerI want to create a dummy Imap server to act as proxy for mailgun
14:16lxsameerjustin_smith: which one supports IMAP and is suitable for a clojure newbie ?
14:16justin_smithlxsameer: I don't know about imap specifically, but aleph can do general tcp very nicely
14:17lxsameerjustin_smith: cool
14:17justin_smithlxsameer: though if there is an imap lib, even better of course (never had to do that myself)
14:17lxsameerjustin_smith: thanks buddy
14:18justin_smithso far it looks like nobody has a premade clojure imap lib - I wonder how hard the protocol would be to implement with aleph
14:20hiredmanmy 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:20justin_smithlxsameer: you could use Hedwig via interop maybe (it is a java imap implementation)
14:21lxsameerjustin_smith: nice, let me check it out
14:23kungiI 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:23kungis/am/have/
14:23lxsameerjustin_smith: Hedwig is a server application, not a library am i right ?
14:24hiredmanI wrote a dummy imap server for some tests, it is a really gross 137 line function spinning up threads for each request
14:24justin_smithlxsameer: 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:25hiredman129 lines (not counting the ns form)
14:25lxsameerjustin_smith: thanks for your guidance man
15:26devll(use 'clojure.java.io)
15:26devll(-> "/tmp" file .listFiles)
15:26devllHi
15:26devllI cant list files.
15:27devll/tmp> ls | wc -l
15:27devll195
15:27devllactually there are 195 files.
15:28gfredericksdevll: and what do you get when you call .listFiles?
15:28devllI am running "lein repl" and "ls" with the same user.
15:29TEttingerI'm on windows, but (-> "C:/" file .listFiles vec count) gives me the number
15:29TEttingererr, (-> "C:/" file .listFiles count) should work
15:30justin_smithdevll: what does that actually return?
15:30devllmy bad.
15:31devll#<File[] [Ljava.io.File;@62eeee05>
15:31devllfile array
15:31justin_smiththat's exactly what it should return, yeah
15:31justin_smithyou can use seq or into or map to get what you want from that
15:31devllPL-y 0.3.2, nREPL 0.2.0-beta5NoSuchMethodError clojure.tools.nrepl.StdOutBuffer.length()I
15:31TEttingerdo you want the same effect as ls?
15:32AeroNotixfile-seq on a directory is interesting too
15:32devllOK.
15:32AeroNotix(-> "/" clojure.java.io/file file-seq)
15:32AeroNotix,(-> "/" clojure.java.io/file file-seq)
15:32clojurebot#<SecurityException java.lang.SecurityException: denied>
15:32AeroNotixyay
15:32justin_smithls
15:32lazybotetc home lib64 mnt run
15:33justin_smith(it's a shortcut)
15:33hadronzooCan anyone recommend a database migration library?
15:34zeeshanlakhanihadronzoo: there's ragtime -> https://github.com/weavejester/ragtime
15:34devllthanks all. I got things messed up.I guess I have to sleep.
15:35devll(inc AeroNotix )
15:35lazybot⇒ 1
15:35devll(inc AeroNotix)
15:35lazybot⇒ 6
15:35AeroNotixyay
15:35AeroNotixa whole 6
15:36devll:D
15:36hadronzoozeeshanlakhani: I see several. I was wondering if anyone had any recommendations.
15:36TEttinger(inc AeroNotix)
15:36lazybot⇒ 7
15:36zeeshanlakhaniragtime 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:36TEttingerlucky number slevin
15:39hadronzoozeeshanlakhani: Can migrations with ragtime be clojure functions?
15:42zeeshanlakhanihadronzoo: 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:45hadronzoozeeshanlakhani: OK, I'll take a look. Thanks.
15:45zeeshanlakhaninp
16:02hadronzoozeeshanlakhani: 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:02hadronzoozeeshanlakhani: I also added a :ragtime key in project.clj with the database connect string
16:03zeeshanlakhanihadronzoo: did you see this: https://github.com/weavejester/ragtime/wiki/Getting-Started? it's good to be specific abt the key names
16:03hadronzooyes, but it doesn't have anything about the lein command usage
16:05zeeshanlakhanihadronzoo: we used a ragtime profile and called out ragtime like `lein with-profile ragtime ragtime migrate -d "jdbc:postgresql:beatport_api"`
16:06zeeshanlakhani:ragtime
16:06zeeshanlakhani {:dependencies [[ragtime/ragtime.sql.files "0.3.6"]]
16:06zeeshanlakhani :plugins [[ragtime/ragtime.lein "0.3.6"]]
16:06zeeshanlakhani :ragtime {:migrations ragtime.sql.files/migrations}}
16:06zeeshanlakhanias an example
16:08hadronzoozeeshanlakhani: thanks. Is there a way to list migrations?
16:08zeeshanlakhanihttps://github.com/weavejester/ragtime/blob/8e782834881164eb530ddd00bb52c01b56fb0026/ragtime.core/src/ragtime/main.clj#L57
16:10hadronzoozeeshanlakhani: `thub.com/weavejester/ragtime/blob/8e782834881164eb530ddd00bb52c01b56fb0026/ragtime.core/src/ragtime/main.clj#L57
16:10hadronzoo*** tbaldridge (~tim@216.207.42.140) has quit: Ping timeout: 265 seconds
16:10hadronzoo*** yogthos|away (~yogthos@li231-96.members.linode.com) is now known as
16:10hadronzoo yogthos
16:10hadronzoo*** SirRobin (~wjc@2a01:e35:2e74:a2c0:6267:20ff:fef0:4a0) has quit: Quit:
16:10hadronzoo Konversation terminated!
16:10hadronzoo*** dmi3y (~dmi3y@193.110.76.165) has joined channel #clojure [15:09]
16:10hadronzooERC> zeeshanlakhani: `lein ragtime migrate -m`? It throws a NullPointerException.
16:10hadronzoosorry about that
16:13zeeshanlakhanihadronzoo: 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:13hadronzooah, that makes sense. thanks
16:25TEttingerhere's a teaser for you, justin_smith
16:26TEttingergive 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:29TEttingergfredericks, you might also enjoy this
16:31annapawlickaHello world! Where does one put a docstring in defmethod? Or is adding it to defmulti the only option?
16:32justin_smithannapawlicka: may or may not be relevant, defmethod has an optional name argument
16:32arrdemannapawlicka: defmulti is the only option. extending docstrings from implementations doesn't make a whole bunch of sense.
16:33justin_smithannapawlicka: specifically putting a name on a specific defmethod is useful for stack trace readability
16:33annapawlickajustin_smith: yup, useful in stack traces
16:34annapawlickajustin_smith: :) i just wanted to document behaviour but i guess i’ll do that in defmulti
16:34TEttinger,(let [agh (identity Double/NaN) hm Double/NaN] [(= agh agh) (= hm hm)])
16:34clojurebot[true false]
16:34gtravtrying 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:34annapawlickaarrdem: thanks. that’s what i thought
16:38gfredericksTEttinger: so a macro that can look at the binding form is not the sort of thing you're asking about?
16:39TEttingerhm, probably that would count
16:39TEttingerI just discovered...
16:39TEttinger,(let [agh (identity Double/NaN) hm Double/NaN] [(= agh agh) (= hm hm)])
16:39clojurebot[true false]
16:39amalloyTEttinger: i don't think you need the identity call at all
16:39amalloy,(= Double/NaN Double/NaN)
16:39clojurebotfalse
16:40TEttingerthe identity makes it true
16:40amalloymmmmm. well, i can see why
16:40tbaldrid_"the identity makes it true" that needs to be a clojurebot quote
16:40amalloybut i admit it surprised me a little
16:40arrdemwait what how
16:41amalloywhen 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:41arrdem(inc amalloy)
16:41lazybot⇒ 229
16:41amalloybut when you use Double/NaN directly, the compiler can leave it unboxed
16:41arrdemand you get the "real" not = result. gotcha.
16:43amalloyfor anyone who is curious, the disassembly confirms my explanation: https://www.refheap.com/e1977e9796169076c58fb7295
16:44gfredericksreally? a boxed NaN can be equal to itself?
16:44arrdemobject equality.
16:45gfredericksseems like a borderline correctness problem
16:47amalloygfredericks: agreed, but are you really going to add that overhead to RT/equiv for all objects?
16:48arrdemyes because correctness, no because if you're working with NaNs you've earned it.
16:49gfrederickswhat does java do here? boolean amalloy(Double x, Double y){return x.equals(y)}?
16:49amalloygfredericks: it doesn't use a static equiv method
16:49gfredericksor um
16:49gfrederickswhat does java do for x == y?
16:50amalloyobject identity
16:50amalloyfor x.equals(y) it does a dynamic dispatch on x's class, of course
16:50amalloyand then you can pay the price for correctness only in Double/equals
16:50gfredericksso x == x is true for boxed doubles in java?
16:50amalloysure
16:50gfredericksokay then it's fine
16:50gfrederickseverything's crazy, not just clojure
16:51arrdem"If Java jumped off a bridge what would you do?" ~ Paul Phillips, PacNW 2013
16:51amalloywell, == in java is identical? in clojure, and everyone knows that, so they dont' expect it to act like =
16:51amalloyit's a lot crazier for clojure's = to do this than for java's ==
16:51gfredericksI'm saying in both cases equality on NaN's is inconsistent
16:52xPhilowhere does disassemble-str come from?
16:52amalloyxPhilo: no.disassemble
16:52xPhiloah, thank you.
16:52amalloyi have it in my .lein/profiles.clj to include no.disassemble in my local repls at the time
16:52amalloycause you never know when i'll want to disassemble something
16:52hiredman,(identical? (Double. 10.0) (Double. 10.0))
16:52clojurebotfalse
16:56xPhiloI'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:56amalloyxPhilo: yeah i did it by hand with javap and aot compilation for a long time. what a drag
16:57amalloynow instead of setting aside 20 minutes to disassemble something i can do it in 20 seconds
16:57xPhiloThen you understand my excitement right now.
16:58amalloyxPhilo: the other thing i have in my .lein/profiles is criterium
16:58xPhiloI have that one already. Thanks for the pointer though!
16:59amalloysee https://www.refheap.com/f4ca2b6cd16e10d3ae80b90cc for how to include no.disassemble. you want the lein plugin, not just the dependency
16:59xPhiloThank you.
16:59amalloyand use whatever profile you want, not :swank which is for grumpy old men like me
17:06xPhiloDon't be apologetic for your operating system ;) It does have a pretty decent text editor after all.
17:07justin_smithxPhilo: :swank is the antique clojure integration for emacs
17:08amalloyright, for years the cool emacs kids have been using nrepl, not swank
17:08justin_smithamalloy: *cider
17:08amalloymehhh
17:08justin_smithok, "cool" leaves some room for definitions, sure
17:11xPhilojustin_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:21matthavenerwhy doesn't (>! c :foo) unpark when c is (closed! c)
17:21matthavener?
17:22xPhiloWould 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:22justin_smithmatthavener: when would parking on a closed channel that can't be re-opened be useful?
17:22amalloyxPhilo: because that's what :as does. it gives a name for the original object
17:23xPhiloI read through (destructure) and read on the what, I was wondering if there was a why.
17:23matthavenerjustin_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:23matthavenerguess just need alts! with a 'tear down' channel?
17:23xPhiloIt seems it'd be just as easy to merge.
17:25tvanhensare 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:26bloop_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:27bloop_I'm already aware of Compojure, more interested in the DB side of things
17:28bjado you want to use a sql db?
17:28bjaand how dynamic do you need the queries to be?
17:29bloop_no preference for SQL but Korma looks nice
17:29bjai.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:30bjaif 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:31bloop_bja: I'll check out honeysql! sounds cool.
17:31bjaI use honeysql and yesql for postgres, carmine for redis, and elastisch for elastic search quite a bit
17:32bloop_redis has always intrigued me. I'll look at carmine too.
17:33bja(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:33dahhoneysql++
17:34justin_smithdah: around here we use inc
17:34bloop_ ha! datomic seems like really excellent technology. I so wish it was open source though.
17:34justin_smith(inc yesql)
17:34lazybot⇒ 1
17:35bloop_lol
17:35bja,(do (defalias +1 inc) (+1 yesql))
17:35clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: defalias in this context, compiling:(NO_SOURCE_PATH:0:0)>
17:36TEttinger,(doc alias)
17:36clojurebot"([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:36TEttinger,(do (def +1 inc) (+1 yesql))
17:36clojurebot#<CompilerException java.lang.RuntimeException: First argument to def must be a Symbol, compiling:(NO_SOURCE_PATH:0:0)>
17:36TEttinger,+1
17:36clojurebot1
17:36TEttingeroh!
17:37TEttinger+1 is a valid numeric literal, like -1
17:37gfredericks,+1+
17:37clojurebot#<NumberFormatException java.lang.NumberFormatException: Invalid number: +1+>
17:37TEttinger,++1
17:37clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ++1 in this context, compiling:(NO_SOURCE_PATH:0:0)>
17:37TEttinger,(do (def ++1 inc) (++1 yesql))
17:37clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: yesql in this context, compiling:(NO_SOURCE_PATH:0:0)>
17:37TEttinger,(def yesql 1)
17:37clojurebot#'sandbox/yesql
17:37TEttinger,(do (def ++1 inc) (++1 yesql))
17:37clojurebot2
17:38bjaguess I'd have to define ++
17:38bja,(do (def ++ inc) (++ yesql))
17:38clojurebot2
17:39bjasadly, ++ is ++ is the same effort to write as inc
17:42dahjustin_smith: whoops, old mutation habits die hard
17:42dah(inc honeysql)
17:42lazybot⇒ 2
17:43TEttinger,(def =D inc)
17:43clojurebot#'sandbox/=D
17:43TEttinger,(=D 9000)
17:43clojurebot9001
17:45justin_smithdah: the silly thing is that inc shouldn't even mutate, but whatever, it's just a bot trigger not real clojure
17:46justin_smithnow, on the other hand, if we had (send honesql inc)
17:46justin_smithmuch more reasonable
17:46justin_smithor even swap!
17:46AeroNotixyeah swap makes more sense
17:46AeroNotix(swap! justin_smith inc)
17:46AeroNotixwe are all just atoms
17:47AeroNotixseems deep as well
17:47AeroNotixesp. after 3 glasses of Zinf
17:49AeroNotixhttp://25.media.tumblr.com/tumblr_m8inbwUJFB1rounybo1_500.png I feel like this kid. Except not chicken nuggets, but Clojure.
18:18dahor maybe (inc!) heh
18:20TimMc,(condp :>> :>> :>> :>>)
18:20clojurebot:>>
18:20TimMcI hate that macro.
18:21TimMc,(condp :>> :>> :>>)
18:21clojurebot:>>
18:23TimMc,(eval (#'condp = :>> :>> :>> = #'condp))
18:23clojurebot#<ExceptionInInitializerError java.lang.ExceptionInInitializerError>
18:23TimMcoh shush
18:24hadronzooIn 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:37amalloy$dict Apophenia
18:37lazybotamalloy: Word not found.
18:38justin_smith$google define:apophenia
18:38lazybot[Apophenia - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Apophenia
19:10numbertenare there (r)subseq functions that work with arbitrary comparison functions? as opposed to just numeric ones?
19:10numbertenit seems like they should be more general than that
19:12amalloynumberten: they all actually work with whatever comparator you gave to the sorted map/set
19:12amalloy&(subseq (sorted-map :a 1 :c 2) > :b)
19:12lazybot⇒ ([:c 2])
19:12clojurebotCool story bro.
19:14numberteninteresting
19:15numberteni have a program where (comp reverse rsubseq) does not equal (subseq) when given the same arguments
19:16numberteni assumed it was my comparison function, but maybe not
19:52dcunit3dhey whats up everyone?
20:01amalloy(let [{x :x, {x :x} :m} {:x 1 :m {:x 2}}] x). any bets on what will happen?
20:06AeroNotixhm
20:06TimMcSeen this, it binds in arbitrary order I think?
20:06AeroNotixI would like to say the compiler just says "LOLNiceTryException"
20:06TimMcbased on hashes of keys
20:07AeroNotix,(let [{x :x, {x :x} :m} {:x 1 :m {:x 2}}] x)
20:07clojurebot2
20:07AeroNotix,(macroexpand '(let [{x :x, {x :x} :m} {:x 1 :m {:x 2}}] x))
20:07clojurebot(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:07AeroNotixyeah well
20:09TimMcIs it strictly reverse order, or hash-based?
20:16amalloyTimMc: it's the array map, there shouldn't be any hashes. but of course that's not guaranteed
20:18xPhiloI see. . . I think.
20:19xPhilo(let [{x :x, {y :x} :m} {:x 1 :m {:x 2}}] [x y])
20:40numbertenis there a concat-esque function for sorted collections (sets)?
20:40numberteni guess that would be union (assuming you maintain the sortedness)
20:40amalloyinto
20:40numberten,(let [s1 (sorted-set "foo") s2 (sorted-set "bar" "foo")] (type (clojure.set/union s1 s2)))
20:40clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:0:0)>
20:42numbertenvery nice
21:14justin_smith,(require '[clojure.set :as set])
21:14clojurebotnil
21:14justin_smithit's not automatic
21:14justin_smith,(let [s1 (sorted-set "foo") s2 (sorted-set "bar" "foo")] (type (set/union s1 s2)))
21:14clojurebotclojure.lang.PersistentTreeSet
21:15justin_smith,(type (sorted-set "foo" "bar"))
21:15clojurebotclojure.lang.PersistentTreeSet
21:15justin_smithset/union should just be conj
21:17justin_smithahh, of course, there are some optimizations
21:17justin_smithbubble-max-key
22:27justin_smithhey 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:35TEttingerI'm having fun
23:35TEttinger,(let [mystery (identity Double/NaN), mystery (. Double NaN)] [(= mystery, mystery) (= mystery, mystery)])
23:35clojurebot[true false]
23:38justin_smithTEttinger: https://hossofsauce.files.wordpress.com/2012/04/teacher-scolding1.jpg
23:39TEttinger,(let [mystery (identity Double/PI), mystery (. Double PI)] [(= mystery, mystery) (= mystery, mystery)])
23:39clojurebot#<CompilerException java.lang.RuntimeException: Unable to find static field: PI in class java.lang.Double, compiling:(NO_SOURCE_PATH:0:0)>
23:40TEttinger,(let [mystery (identity Math/PI), mystery (. Math PI)] [(= mystery, mystery) (= mystery, mystery)])
23:40clojurebot[true true]
23:46sm0kehello need little help with a macro, or function whatever can do
23:46TEttingerhey sm0ke, what's the problem?
23:47TEttingerjustin_smith, our resident help-and-karma-machine, is available last I checked
23:47TEttinger,(let [mystery (identity Double/NaN), mystery2 (. Double NaN), mystery3 Double/NaN] [(= mystery, mystery) (= mystery2, mystery2) (= mystery3, mystery3)])
23:47clojurebot[true false false]
23:47justin_smithhaha
23:47TEttingerno BOMs in that one, and it's still wonky
23:47sm0keso 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:47sm0kehello TEttinger
23:48TEttingerI thought class/member was sugar for (. class member), but it ain't
23:49justin_smithanyway, should it be like - any function in clojure? or do you want only certain ones to be accepted?
23:49TEttinger,(fn [fname & args] (eval (conj (list args) (read-string fname))))
23:49clojurebot#<sandbox$eval49$fn__50 sandbox$eval49$fn__50@364895a>
23:49TEttingeroops
23:50TEttinger,((fn [fname & args] (eval (conj (list args) (read-string fname)))) "inc" 2)
23:50clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
23:50justin_smithTEttinger: it should be 2 "inc"
23:50TEttingerI thought conj on lists prepended
23:50justin_smithit does
23:50justin_smithbut the inc got prepended first
23:50justin_smiththen the 2
23:50justin_smith,(conj () 1 2)
23:51clojurebot(2 1)
23:51sm0kesorry got disconnected
23:51sm0kethis is what i have comeup with till now https://www.refheap.com/97515
23:51justin_smithTEttinger: (def reverse (partial apply conj ()))
23:51TEttinger,((fn [fname & args] (eval (conj () args (read-string fname) 'apply))) "inc" 2)
23:51clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
23:51sm0kethe problem is it works with contants but not vars
23:52justin_smithTEttinger: the inc got conjed on first, so is after the 2
23:52justin_smithswitch their order
23:52TEttinger,((fn [fname & args] (eval (conj () 'apply (read-string fname) args))) "inc" 2)
23:52clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
23:52justin_smithsm0ke: outside of loading source code, you have to explicitly resolve or look up symbols to get their var/binding
23:53sm0ke,((eval (read-string "inc")) 1)
23:53clojurebot2
23:53justin_smithTEttinger: you still didn't reverse the order of the "inc" and the 2
23:53TEttingerin the... arguments?
23:53justin_smithsm0ke: resolve would have worked too
23:53TEttingerI passed fname and args
23:53sm0ke,(let [a "inc"] ((eval (read-string a)) 1))
23:53clojurebot2
23:53justin_smithTEttinger: right, and they get conjed
23:53sm0keyea this should do
23:53justin_smith,((resolve (symbol "inc")) 1)
23:53clojurebot2
23:53sm0kewhy do you need all that just eval of read-string should be good?
23:54justin_smithsm0ke: don't use eval unless you need all of its features
23:54justin_smithit's expensive, and can do pretty much anything
23:54TEttingerjustin_smith, can you make that take varargs with the string first?
23:54rhg135,(if-let [v (resolve "+")) @v)
23:54clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
23:54rhg135,(if-let [v (resolve "+")] @v)
23:54clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.Symbol>
23:54rhg135meh
23:54sm0ke,(let [a "inc"] ((resolve (read-string a)) 1))
23:54clojurebot2
23:54TEttinger,(if-let [v (resolve '+)] @v)
23:54justin_smithrhg135: you need a symbol
23:54clojurebot#<core$_PLUS_ clojure.core$_PLUS_@79dea99>
23:54rhg135ah
23:54sm0ke,(let [a "#(inc %)"] ((resolve (read-string a)) 1))
23:54clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol>
23:55sm0ke,(let [a "#(inc %)"] ((eval (read-string a)) 1))
23:55clojurebot2
23:55rhg135justgreg, i realized it right after i typed it
23:55sm0kei need eval for this
23:55justin_smithsm0ke: you can't resolve a whole form, just symbols
23:55rhg135im done typing
23:55sm0kejustin_smith: got it,
23:55sm0kethanks justin_smith and TEttinger
23:55rhg135apologies for the ping
23:55sm0kei am forgetting basic things nowdays
23:55TEttinger(inc justin_smith)
23:55lazybot⇒ 189
23:55justin_smith,((fn [fname & args] (eval (conj () 'apply (read-string fname) 2 "inc")
23:55clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
23:55sm0ke(inc [ TEttinger justin_smith ])
23:55lazybot⇒ 1
23:56sm0kelol
23:56justin_smith,((fn [fname & args] (eval (conj () 'apply (read-string fname) args))) 2 "inc")
23:56clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String>
23:56justin_smitherm
23:56justin_smithOK
23:56sm0kewhat is it with the conj thingy??
23:56lazybotsm0ke: Definitely not.
23:57justin_smithsm0ke: nothing really
23:57TEttingersm0ke, trying to get it to take more than 1 argument
23:57justin_smith,(conj () 1 2 3 4 5)
23:57clojurebot(5 4 3 2 1)
23:57justin_smithaha
23:57justin_smith,((fn [fname & args] (eval (conj () (read-string fname) args 'apply))) "inc" 2)
23:57sm0ke,(let [a "#(+ %1 %2)"] (apply (eval (read-string a)) [1 2]))
23:58clojurebot3
23:58clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
23:58TEttingerwhich was which???
23:58lazybotTEttinger: How could that be wrong?
23:58justin_smithTEttinger: you just had apply on the wrong end :) ^
23:58justin_smith,((fn [fname & args] (eval (conj () (read-string fname) args 'apply))) "inc" 2)
23:58clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
23:58TEttingerhahaha
23:58justin_smitherr....
23:58sm0kejust apply args to eval
23:58justin_smith,((fn [fname & args] (eval (conj () args (read-string fname) 'apply))) "inc" 2)
23:58clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
23:59TEttinger,((fn [fname & args] (apply eval (read-string fname) args)) "inc" 2)
23:59clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/eval>
23:59justin_smith,((fn [fname & args] (conj () args (read-string fname) 'apply)) "inc" 2)
23:59clojurebot(apply inc (2))