#clojure logs

2013-10-03

00:08akurilinbitemyapp, ping. What's a good way of temporarily suppressing blackwater logging? Say you know you have a piece of logic that's going to be tremendously spammy and you want to avoid logging it.
00:09akurilinbitemyapp, would be neat if you could kind of "with-redefs" it for that one call
00:19indigoakurilin: You could do it the MongoDB way
00:19indigoUse a random number and only log it 0.1% of the time ;)
00:20akurilinindigo, is that for real?
00:20akurilinI'm very gullible.
00:20bitemyappddellacosta: hrm.
00:20bitemyappddellacosta: wrong clj-time version it sounds like.
00:20bitemyappddellacosta: I'm probably using a newer version of clj-time than you in the library.
00:20coventryakurilin: http://www.youtube.com/watch?v=b2F-DItXtZs
00:21bitemyappakurilin: good question.
00:21indigoakurilin: https://github.com/mongodb/mongo-java-driver/blob/1d2e6faa80aeb5287a26d0348f18f4b51d566759/src/main/com/mongodb/ConnectionStatus.java#L213
00:21bitemyappakurilin: robert.hooke has a function for running a function without its decorators.
00:21bitemyappakurilin: you would use that and it will suppress the logging behavior.
00:21akurilincoventry, oh yeah that one is great :)
00:21indigoLooks like they fixed it in a later commit though
00:21akurilinbitemyapp, does the name come to mind?
00:22akurilinindigo, was that a prank?
00:22bitemyappakurilin: (with-hooks-disabled exec-raw
00:22bitemyappakurilin: no that mongo code was for real.
00:22bitemyappakurilin: this sounds like another thing to add to Blackwater :)
00:22bitemyappddellacosta: sorry I couldn't respond in a more timely fashion, I'm at Clojure Community Night
00:23indigoakurilin: Nope, for real
00:23indigoAlthough it seems like they changed it after they got a lot of heat for it ;)
00:23akurilinindigo, what is the scenario that would be useful?
00:24indigoakurilin: If you had to handle errors on web scale
00:24akurilinbitemyapp, man, I gotta make it to one of these events at some point, they're pretty close to where we are :(
00:24akurilinindigo, I see, makes sense then :)
00:24indigo:D
00:24akurilinInterestingly enough, is Mongo still huge these days, or is the infatuation finally over?
00:25akurilinEntire companies are still built on it to this day (*ahem* Parse *ahem*)
00:25bitemyappakurilin: it's still around. I think some of the enthusiasm has calmed down.
00:25indigoI think it's not "as cool" anymore
00:25bitemyappClownshoes data store.
00:25indigoStill better than writing a custom ORM to convert MySQL into an EAV data store
00:25akurilinI think at the 20th "Why we moved from Mongo to PG" HN post, people got the hint.
00:25bitemyapphttp://preview.getprismatic.com/story/1380766936960?share=true
00:25bitemyappakurilin: lol, I hope so.
00:26frozenlockakurilin: Just realized this week that my mongo instance was just taking more and more space, without ever giving it back, even when I delete the data :(
00:26bitemyappindigo: I use Datomic, thus side-stepping the EAV problem :)
00:26indigobitemyapp: I use PHP, thus side-stepping the sane programming environment problem
00:26akurilinbitemyapp, heh that's a good point.
00:26indigo(only at work though)
00:26akurilinNeed a PG plugin for edn.
00:27bitemyappIntegrating things into PG is...not a job I want.
00:28akurilinYeah, whatever they're doing seems to be working for the product, I'm happy letting them do their thing without too much wordly influence.
00:28akurilinAlthough 9.3 did sorta support json
00:28akurilinhalf a decade after the format became ubiquitous
00:30akurilinWait so Robert Hooke isn't a person?
00:30akurilinI thought it was a dude on Github who named libraries after himself.
00:30akurilinNvm :)
00:32akurilinbitemyapp, I'll try what you suggested, thanks!
00:32TEttingerbitemyapp, do you work at prismatic?
00:33TEttingerand what is PG?
00:35bitemyappTEttinger: gods no. There's a community night here and I'm presenting soon.
00:35TEttingeryay
00:35bitemyappalexbaranosky and ztellman are presenting too
00:35TEttingeryay
00:35bitemyapplightning talks, buncha people.
00:35TEttingeris it being filmed?
00:35bitemyappwere it not for that, they wouldn't let riff-raff like me talk.
00:36bitemyappTEttinger: yes.
00:51muhoo~pg
00:51clojurebotPardon?
00:51muhoowhat is pg? postgres?
00:51indigoPostgres
00:51indigoNot Paul Graham :P
00:52indigoAlso good luck on your talk, bitemyapp
00:52akurilingl. Links to talk afterwards plz :)
01:05muhoo~pg is postgres, an sql database
01:05clojurebotIn Ordnung
01:05muhoo~pg
01:05clojurebotpg is postgres, an sql database
01:06muhoo~robert hooke
01:06clojurebotExcuse me?
01:06ddellacostahaha
01:06muhoo~robert hooke is a library for adding hooks to functions
01:06clojurebotAck. Ack.
01:06muhoo~robert hooke
01:06clojurebotrobert hooke is a library for adding hooks to functions
01:07muhoonice, it handles spaces
01:07ddellacostabitemyapp: good luck on talk!
01:07muhoo~life
01:07clojurebotlife is life ... nanananana
01:08muhoo~life is very short, and there's no time, for fussing and fighting, my friend.
01:08clojurebotIn Ordnung
01:08ddellacosta"Life? Don't talk to me about life!"
01:12centaurLife sucks. Code more.
01:25andyfingerhutIf you use :pre or :post conditions in your Clojure functions, and use them to test type conditions like (set? arg), is there any variant or configuration of that such that you can see the value of 'arg' that failed the assertion, or is that just gone unless you re-run?
01:34chareI'M BACK
01:34charealive
01:34charetalking
01:34chareyou can't stop me
01:43nightflychord I'm assuming?
01:48coventryandyfingerhut: There is no built-in facility for that. You just get an assert. https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4130
01:50andyfingerhutcoventry: That is what I guessed, but hoping I was wrong. I suppose it is straightforward to do a precondition with a custom throw containing data if one wants. Postcondition maybe not so easily, but preconditions are.
02:07ivanright1: bin/lein uses -XX:+TieredCompilation -XX:TieredStopAtLevel=1 while bin/lein.bat does not
02:34akurilinI'm not familiar with the subject at all, maybe you guys know. Is it possible to send out multiple separate select queries as one single batch from JDBC?
02:35akurilinI could spam the DB with a bunch of futures, but that involves opening a bunch of connections rather than 1
02:43akurilinOk apparently you can't do that. TIL. The way to go would be futures or stored procedure, depending on CPU optimization strategy.
02:44ddellacostaakurilin: why do you need to close the connection?
02:44ddellacostaakurilin: also, what about a connection pool?
02:45akurilin*using rather than opening, I should have said
02:45ddellacostaah
02:45akurilinmy only concern was hitting the connection cap
02:46akurilinthe problem is obviously that sending out a hundred requests to a DB will probably lead to some serious thrashing before I even get to worry about connection $
02:46akurilin#
02:46akurilinsupposedly 2x connections per core
02:46akurilinis the sweet spot
02:46ddellacostayeah, looks like this may be dependent on which DB you are using: http://www.postgresql.org/message-id/411615F9.1040904@opencloud.com
02:46akurilinPG in my case
02:52ddellacostaYES I HAVE CONQUERED COMPLEX ltree QUERIES IN POSTGRESQL! That is all
02:53dcunit3danyone used much incanter?
02:53ddellacostanow I have to make it all work in Clojure w/clojure.java.jdbc.
02:54dcunit3di'm trying to implement a neural network, but crashing out because of heap size.
03:32pepijndevosrefheap 500's
03:33pepijndevosnow I need another pastebin
03:34augustlpepijndevos: there's this thing called gitbook or something like that :)
03:38bitemyappRaynes: ^^ look dude, I'm not the only one.
03:38bitemyappRaynes: it's 505'ing for pepijndevos too.
03:38bitemyapp500'ing I mean, sorry.
03:40Raynesbitemyapp: You weren't the only one in the first place. There was someone this morning.
03:40Raynesbitemyapp, pepijndevos: I've restarted the server.
03:40bitemyappRaynes: danke schon.
03:41pepijndevosty
03:41Raynesbitemyapp: I'd be pretty surprised if it fixes anything.
03:41bitemyappRaynes: that fixed it for me.
03:41bitemyapppepijndevos: ?
03:42pepijndevosyup, works
03:44TEttinger##(apply str (repeat 2000 " "))
03:44lazybot⇒ " ...
03:45TEttingerhm, shouldn't that have gone to refheap?
03:46hyPiRion,(apply str (repeat 2000 " "))
03:46clojurebot" ...
03:46hyPiRion&(apply str (repeat 2000 " "))
03:46lazybot⇒ " ...
03:46TEttingerit's doing it on quakenet-hosted bots too
03:47TEttingermy roguebot has been up for a few days, maybe I should restart it?
03:48TEttingerhttps://www.refheap.com/16011 fake greek generator load for everyone?
03:58dcunit3dso i'm running into some problems with binding vars - gist here - https://gist.github.com/6806317
03:58dcunit3dtrying to run incanter.charts/heat-map, which prompts for a function that takes [x y]
03:59ro_stuse different arg names in draw-digits
03:59dcunit3dro_st: k, let me try that
03:59ro_st(binding [sizex in-sizex] …)
03:59dcunit3dro_st: also, i'm trying to compile this with lein uberjar
04:00TEttingerdcunit3d: (:gen-class) in the ns?
04:00TEttinger:aot and :main given the ns of the file?
04:02dcunit3dTEttinger: not in handwritten-digits.draw, but in handwritten-digits.core, which requires the draw namespace
04:05zeroemso, if I'm understanding the docs right, there's currently no way to add public members to a class (via gen-class) in clojure?
04:05sm0kezeroem: what about state ?
04:06zeroemit's not clear that the contents of state are exposed as public members
04:06klrrcan someone link me to an explanation of "reduce", i did not understand the docs neither could i read the source?
04:08dcunit3dit's still not binding the vars appropriately
04:08TEttingerklrr, it's a doozy. it's very important, I'll try to find a good explanation
04:08klrrthanks!
04:08dcunit3dforgot to declare data as dynamic
04:09TEttingerklrr: http://www.learningclojure.com/2010/08/reduce-not-scary.html
04:09sm0keklrr: ,(reduce (partial + 0) [1 2 3 4])
04:09TEttinger,(reduce + [1 2 3 4])
04:09clojurebot10
04:09sm0kewhats wrong with the bot
04:10TEttingeryou need ##(str "## to eval inline")
04:10sm0kei suck
04:10TEttingeruh oh
04:10TEttingersm0ke, it's a key part of swearjure, that's the only reason I know + defaults to + 0
04:11klrri presume partial makes a function like the ones in haskell?
04:11sm0kehmm does reduce also takes a starting argument?
04:11TEttingerindeed. it often needs one
04:11zeroemsm0ke: optionally
04:11zeroem,(doc reduce)
04:11clojurebot"([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val i...
04:11sm0keaha ##(reduce + 4 [1 2 3 4])
04:11lazybot⇒ 14
04:12sm0kewhat about left vs right?
04:12TEttingersm0ke: ?
04:12zeroemsm0ke: after the first run, the first argument is the collector
04:12sm0keTEttinger: you often have reducel reducer in other functional langs
04:13TEttingeroh yes
04:13TEttingerfoldl and foldr in haskell
04:13sm0kesome times a function isnt idempotent
04:13sm0keand idempotency is not somethng for which you take a pill
04:13TEttingerif your idempotency lasts more than 4 hours...
04:13zeroem,(reduce (fn [a b] (prn a b) (+ a b)) [1 2 3 4])
04:13clojurebot1 2\n3 3\n6 4\n10
04:14sm0keso does clojure have righ and left reduce concepts as well?
04:14TEttingerI think it just has reduce in core, but there may be other contrib libs
04:15TEttingernormally you don't reduce over infinite lazy things, so you only need the one that does finite IIRC
04:15bitemyappddellacosta: added a down top-layer to my futon. <3
04:16sm0kehmm i dont buy that
04:16ddellacostabitemyapp: nice. :-)
04:16TEttingereither foldl or foldr is meant to be used on infinite seqs IIRC
04:16bitemyappI want to slumber for weeks in this bed
04:16bitemyapprip van clojure.
04:16ddellacostabitemyapp: do you actually do the thing where you put it away every day?
04:16bitemyappddellacosta: no, but I give 'er a good shake-n-beat every weekend.
04:17sm0kei found this http://stackoverflow.com/questions/16800255/how-do-we-do-both-left-and-right-folds-in-clojure
04:17ddellacostabitemyapp: probably just as good. Not that I have any clue…heh
04:17ddellacostathe funny thing is, I don't have any Japanese-style furniture anywhere here. Kinda wish I did actually.
04:18ddellacostabitemyapp: except for my toilet.
04:20bitemyappddellacosta: I've heard those are legendary.
04:20TEttingerdon't japanese toilets have tons of bells and whistles?
04:22andyfingerhutI hope not. I prefer a little peace and quiet around that time :-)
04:22ddellacostaMine doesn't do this, but I was chatting with a friend today about the toilet I used in a fancy scotch bar last weekend--when you approached it, the lid raised automatically and British marches or something started playing at you
04:22sm0kefu**ing zeromq arggh
04:23ddellacostamine merely has nice nether-regions cleaning features. That's all I need, but it will be hard to leave that behind if I ever leave...
04:23sm0kewhat is this toiletjure?
04:23sm0ke:D
04:24ddellacostasm0ke: sorry, back to your regularly scheduled programming-language-related discussion. ;-)
04:24ddellacostaI should try to build a Japanese-toilet Clojure API, I've heard there are a lot people waiting to use it
04:24sm0keddellacosta: i am learning clojure thats why i ask regularly
04:25sm0keonce i know my shit..i dont talk much
04:25sm0ke:D
04:25ddellacostasm0ke: badum-bum *symbol crash*
04:27vmarcinkonoob question - has any library surfaced over time as de-facto standard way to do logging in clojure, or that's still in the air - maybe some use java api directly to access slf4j, some log4j etc?
04:28TEttingervmarcinko, an excellent question, and one that comes up a lot
04:28TEttingerI have no idea, I don't do logging
04:28vmarcinko??
04:28lazybotvmarcinko: What are you, crazy? Of course not!
04:28s4muelvmarcinko: https://github.com/ptaoussanis/timbre has worked well for me
04:30sm0keand i though tools.logging was the de facto
04:31ddellacostavmarcinko: yeah, I've used timbre in one project and it's pretty good, but in my day-to-day job we simply have a logback.xml file + clojure/tools.logging
04:32ddellacostaI've had some trouble in the past using timbre to configure logging. Part of the problem seems to be what a holy mess a lot of Java logging is, so if you are doing a lot of Java interop (or using libs which do a lot of Java interop) then it can be a pain.
04:33ddellacostabut, that could also just be my ignorance--I'm a relatively n00b when it comes to Java logging
04:33bitemyappvmarcinko: timbre is common, a lot of people will just kick stuff directly to a thin wrapper around a java logger.
04:33vmarcinkoi just came from java land, and it's true, there is a mess there, but it seems slf4j (and logback udnerneath) is mostly used nowadays
04:34bitemyappvmarcinko: I mostly either use timbre, stdout, or a distributed logging service.
04:34vmarcinkoi mostly wanted to hear opinisons about tools.logging, but not much mentioning it here?
04:34pyrtsasm0ke: About right folds in Clojure, the StackOverflow commenter vemv stated correctly that you can achieve the laziness of right folds with `reduced`.
04:35pyrtsa,(reduce #(if-not %2 (reduced %2) %2) true (concat [false] (repeat true)))
04:35clojurebotfalse
04:35pyrtsa,(reduce #(and %1 %2) true (concat [false] (repeat true)))
04:35pyrtsa(times out)
04:35clojurebotExecution Timed Out
04:35ddellacostavmarcinko: I mean, like I said, we use that plus xml config, and it does us alright--I don't have complaints. If you want something more sophisticated (sending to a logging server) I would look into what bitemyapp was suggesting.
04:35ddellacostatimbre has nice extendability for that kind of stuff, if I recall correctly
04:37ddellacostaI mean, it's kinda like, do you want to go "the Java way" or do it in Clojure. tools.logging is a bit more the Java way"
04:37ddellacosta*"the Java way"
04:37vmarcinkoddellacosta: ah Ok, thanx..
04:38bitemyappddellacosta: I'm actually considering making a very simple core.async based logging library for Clojure
04:38bitemyappddellacosta: with backends for ElasticSearch, flat files, stdout, Scribe, etc.
04:39sm0kepyrtsa: wtf how come this doesnt shot circuits? (reduce #(and %1 %2) true (concat [false] (repeat true)))
04:39pyrtsasm0ke: It does, but only within that anonymous function. It doesn't short circuit the reduction itself.
04:40bitemyappddellacosta: I think my talk went well. At least 2 or 3 people said their companies needed Simonides :)
04:40pyrtsa(And the short circuiting within #(and %1 %2) is kind of dull, there's zero savings from the evaluation of `%2`.) :)
04:40ddellacostabitemyapp: nice! That's super cool.
04:40ddellacostajust starting to get some breathing room now, will check it out ASAP.
04:41bitemyappddellacosta: not much to look at yet. the hackathon was fucking crazy.
04:41bitemyappddellacosta: it'll be more complete and open sourced in a week or two
04:41ddellacostahow did it all go, btw.? The last week was insane for me, so I was basically not even looking at my IRC window
04:41ddellacostabitemyapp: ah, okay
04:41bitemyappI'm taking a bit of a breather, things have been intense lately and I have some work I'd like to do with blackwater and bulwark.
04:42bitemyappddellacosta: did you see what I said earlier about clj-time versions in blackwater?
04:43ddellacostaah, yeah, thanks. Unfortunately, there is something else going on, as I am only including the same version of clj-time that you are in blackwater (0.6.0?) and I've checked my deps tree already…it's confusing
04:43bitemyappddellacosta: can you please file an issue with a small repro within or described?
04:44bitemyappI need to write documentation for akurilin's thing too
04:44ddellacostabitemyapp: I will have to go back and try to debug it again. I just ended up powering through it without logging, but I wish I could have gotten it working.
04:44bitemyappand note that you can shut off the hooks within a scope for blackwater.
04:44ddellacostabitemyapp: will do--but let me make sure I don't have something strange going on with my app first. I suspect it is something weird in my project.clj file. Does it matter that I'd be including it in a dev profile only? Shouldn't right?
04:44bitemyappddellacosta: oh that's no good. I'm sorry you ran into something. Please get an issue back to me. :)
04:45ddellacostabitemyapp: I'll definitely let you know what I figure out. :-)
04:45bitemyappMuch 'preciated.
04:49CommandBotGreetings! Send me a PM and I'll echo it back to you. If it contains the word 'die', I'll die as a bonus!
05:04ddellacostawhat is a CommandBot
05:07bitemyappddellacosta: dunno, some bot that goes around
05:09ddellacostahuh
05:14chareI started reading this http://www.arcsynthesis.org/gltut/Basics/Tut01%20Making%20Shaders.html
05:14chareyou guys mad at me for that?
05:28Apage43oh gods
05:28Apage43you're back
05:31chareApage43 did you make progress in learning how starcraft 2 does pathfinding
05:45borkdudelast monday I discovered that for support when and lets per binding, super useful
05:45borkdudedidn't need it before, but when I did, was happy to find it supported it
05:46mpenetchare: look for A* probably, then do your homework on that.
05:47charempenet: already knew that part
06:18dcunit3dexit
06:18borkdudeProgrammers know the benefits of everything and the tradeoffs of nothing. -Rich Hickey
06:47glosolihey, I have a string form db which holds filename, I somehow need to properly get it's extension so I would know if it can be handled with embed tag (pdf) or not any ideas ?
06:55sm0keare there any ml libraries for clojure?
06:55sm0kei couldnt find anything by googling "Machine Learning Clojure"
07:16sm0kei can find a function to check if a channel is open in core.async?
07:16sm0kecant*
07:28mpenetthere isn't one as far as I know, you can either check for nil when you take, or try/catch when putting.
07:33sm0kempenet: yes got it thanks
07:33silasdavisi have the function (comp key first :data). Sometimes (:data foo) is nil
07:33silasdaviswhat's the neatest way to have the whole function return nil in that case?
07:43mpenet,(doc some->)
07:43clojurebot"([expr & forms]); When expr is not nil, threads it into the first form (via ->), and when that result is not nil, through the next etc"
07:43mpenetsomething like #(some-> % :data first key)
08:13silasdavisah yeah i'd forgotten about that
08:14silasdavisopted for (comp first first :data)
08:14silasdavisbut less intelligible
08:36Morgawris it possible to create some kind of deadlock (or livelock) by nesting a swap! call inside another swap! ?
08:49sm0keMorgawr: Buhahahaha..exactly what i was asking a few days ago
08:49sm0keMorgawr: but you are doing swap! for the same atom again or deifferent one?
08:50Morgawrsm0ke: it's more like a theoretical question, I haven't had this happen yet but I want to understand how it works
08:50Morgawras far as I know swap! is a test-and-set! repeated until it succeeds
08:51Morgawrand I was thinking, if I swap! atom a and inside I swap! atom b
08:51Morgawrand then something else swaps b and then inside swaps a
08:53sm0kei guess that could happen swap if nothing more than a function call first
09:06glosoliwhen would it be better to use re-seq over re-find ?
09:12`cbpyou can just use re-seq always since re-seq is pretty much a lazy seq of re-finds
09:13`cbpor use re-find instead of (first (re-seq..
10:11lgs32ai have written a library, feedback would be very welcome: https://github.com/lgrapenthin/state-node
10:27SrPxHey, what is the complexity of equality test? Is it O(n) or O(1)?
10:31opqdonutSrPx: clojure's = is a deep true equality, unlike java's =
10:31opqdonut,(= (list 1 2 3) (map inc (list 0 1 2)))
10:31clojurebottrue
10:31opqdonutso I guess that would be "O(n)" in your parlance
10:32mpenethmm it probably uses hashCode for collections
10:32opqdonutplease also note that = ignores differences between sequence types
10:32opqdonut,(= [1 2 3] (list 1 2 3))
10:32clojurebottrue
10:33opqdonutmpenet: I wouldn't be so sure
10:33mpenet,(.hashCode (list 1 2 3))
10:33clojurebot30817
10:33mpenet,(.hashCode [1 2 3])
10:33clojurebot30817
10:33opqdonutlet's see. = is just a wrapper for clojure.lang.Util/equiv
10:33SrPxopqdonut: so it is not O(1)?
10:34opqdonutand equiv just calls pcequiv for collections
10:34opqdonutwhich calls the equiv method in IPersistentCollection
10:34SrPxmpenet: oh, cool! Really cool. That was my wonder, if it keep a tag with a hash in order to be O(1). Nice!
10:36opqdonutwhich in turn calls ASeq.equiv, which does not look at hashCode
10:36opqdonuthttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/ASeq.java
10:36mpenetsad :/
10:36stuartsierraSrPx: Hashes are just an optimization to quickly determine that 2 things are *not* equal.
10:36SrPxstayes and you can be almost sure they are not equal when the test fails so actually deep testing should almost never happen anyway
10:36opqdonutand maintaining the hashCode inside every clojure data structure would make things more complicated and possibly less efficient
10:36SrPxstuartsierra: *
10:37opqdonutoh, ASeq actually does memoize the hashCode
10:37opqdonutbut doesn't compute it incrementally
10:37SrPxopqdonut: why? I incremental hashing could be a fast operation
10:37opqdonutincremental hashing for e.g. a treemap is harder
10:37SrPxopqdonut: wow
10:38opqdonutalso for a sequence with access to both ends
10:38opqdonut(e.g. vector)
10:38stuartsierraYou also get help from persistent data structures, e.g. (let [a (list 1 2 3), b (cons 4 a)] (identical? a (rest b)))
10:39stuartsierra,(let [a (list 1 2 3), b (cons 4 a)] (identical? a (rest b)))
10:39clojurebottrue
10:39opqdonutonly for lists, really, the characteristics of vectors and maps are more subtle
10:41opqdonut,(let [a (zipmap (range 100) (range 100)) b (assoc a :c 1) c (dissoc b :c)] [(= a c) (identical? a c)])
10:41clojurebot[true false]
10:41stuartsierrasure
10:56wakeuphi
10:57wakeupI am getting a NullPointerException when compiling a file. Any ideas how I could pin point closer to the problem, E.g. manually compile a specific file?
11:03Foxboronwakeup: try read the stack-trace
11:03Foxboronyou usually gets something that could resemble a line number and a file name that should help you pinpoint the error
11:04wakeupFoxboron: Like a said, a NullPointerException, right at the top of an arbitrary file...
11:04wakeupit's rather unhelpful
11:05Foxboronwakeup: yeah, welcome to the world of clojrue debugging :)
11:05wakeupand I should note that all these files do evaluate correctly, and work.
11:05Foxboronclojure*
11:05Pupnikwakeup: you could load a particular file in the repl?
11:05oholiabis it possible to toggle off printing or return values in the repl?
11:06wakeupPupnik: using what operator specifically?
11:07Pupnikwakeup: I normally use ctrl-alt-s in eclipse, I don't know how to do it normally
11:08wakeupnrepl-eval-buffer?
11:08Pupnikhttp://clojuredocs.org/clojure_core/clojure.core/compile will this do what you want?
11:08wakeupI tried using load but I don't know where it's searching for files, it doesnt find any
11:09wakeupah I think I got it
11:10wakeupok I can load and compile the file in questions
11:11wakeupbut lein barfs
11:11wakeupnot
11:11wakeupwhat the fk
11:11wakeupto hell..
11:11wakeupprobably some bad bytecode caches
11:11wakeuptis a hard problem we had this in CL for a long time too
11:13asabilHi
11:19mdrogalisasabil: Hello.
11:28wakeupis there a way to get the project directory?
11:28wakeupe.g. using some leinigen magic?
11:29wakeupI have a file in the root of my project directory that I want to slurp at compile time.
11:29wakeupThis only works partially since leinigen can't find it (nrepl can)
11:29llasramwakeup: Put it in resources/ and use `io/resources`
11:30wakeupThanks llasram
11:30llasramer, `io/resource`
11:30llasramAlthough, what do you mean by "at compile time"?
11:31wakeupllasram: The file has to be read once, when the project is compiled.
11:32wakeupE.g. I have (let [foo (slurp file)] (defmacro ...
11:33llasramwakeup: Is this something where you expect to ship the input file in your distribution JARs and re-process it on each application startup?
11:33wakeupno
11:33llasramOr something you'd like to do once when building a distribution archive?
11:33wakeupyes kind of
11:34llasramThe former is more common, and is what you'll get with the code you've described so-far
11:34wakeupNo it's like I said: I need to read a file at compile time.
11:35llasramYes, but there's no real separate compile-time in Clojure
11:35wakeupof course there is.
11:35llasramIf you AOT the code you've describe above, it'll AOT code the code to read the file, not the results of reading thefile
11:35wakeupWhat's AOT?
11:36vijaykiranAhead of Time compilation - http://clojure.org/compilation
11:36llasramEach form is read, macro-expanded, compiled, then run. But (a) those steps happen to each individual top-level form in sequence, and (b) typically happen from source each time you start your application
11:37wakeupWhat I have learned so far: CLojure tries to be a lisp, so it has LOAD and COMPILE, and they kind of work like expected. Which is that you can compile a macro or function before calling it. Ergo, stuff you do during compilation is "compile-time".
11:37wakeupAWhen I do java -jar MYAPP it will not recompile the source will it?
11:37llasramUnless you enable AOT compilation, it will
11:38llasramAnd even if you do enable AOT compliation, the generated code will just contain pre-compiled versions of static initializers to run your top-level forms. Not compiled results of evaluating those forms.
11:39wakeupLet me try to disprove that statement.
11:39llasramok
11:40wakeupOk you are right, that is insane...
11:41wakeuphow do I enable this AOT compilation thing?
11:41wakeupDoes clojure has something like EVAL-WHEN?
11:42ToxicFrogWhat does "EVAL-WHEN" do?
11:42wakeupIt's a special form which lets you control the times at which forms will be evaluated.
11:42wakeup(in CL)
11:43wakeupeg load/top-level/compile
11:43wakeupBut back to my problem: I need a way to slurp a file ONCE at build time.
11:44llasramwakeup: If you slurp it during macroexpansion and AOT-compile, you'll get something like the results you want
11:46llasramThere's no EVAL-WHEN. I really have no idea what it would look like for Clojure
11:46llasramwakeup: Are you building an application or a library?
11:46wakeupaplication
11:47llasramOk. I was checking because AOT is generally inappropriate for libraries, but is reasonable as a deployment optimization for applications
11:47llasramSo yeah -- slurp your file during macro-expansion and enable AOT. That should get the effect you're trying to achieve
11:50vmarcinkohi, noob here who just started using "tools.logging"... I can see that by default (logging/info "My text" myArg1 "followed by" arg2) injects space between arguments, which i don't find wanted sometimes.. Is this default behaviour or some setting somewhere is set that way? Actually, i think println behaves same way...
11:50wakeupllasram: seems to work for my current intents and purposes, thanks for your help
11:50llasramwakeup: np
11:51llasramvmarcinko: Yeah, it works that way because that's how `println` does. You can either wrap the message in a call to `str` to first do un-spaced string concatenation, or use the `infof` `format`-style versions
11:52vmarcinkollasram: thanx a bunch
11:52vmarcinkolike (infof "This is my argument: %s" arg) ?
11:53wakeupbut I am still getting that weird nullpointer exception when doing lein run
11:53llasramvmarcinko: If it works, then yes :-)
11:53wakeupI can circumvent it by doinf load + compile on that file...
11:54wakeupso I am still stcuck with the problem that lein can not find my project root?
11:54llasramwakeup: Can you produce a minimum reproducing project example?
11:56wakeuphmm might be entirely unrelated...#
11:59wakeupllasram: not really, I don't know what causes it.
11:59wakeupI though it to be the slurp, but that's not it...
11:59wakeupand as compile load work just fine I don't even know how to pinpoint it
12:00llasramwakeup: Is the Compiler losing the line information? I thought most of those bugs had been fixed, but might still happen sometimes...
12:00llasramBecause each top-level form happens separately,
12:01llasram"happens" -> is macro-expanded, compiled, and evaluated
12:01wakeupllasram: The line is the (ns ...) form.
12:01wakeupNot very telling.
12:01llasramYou can try adding top-level `println`s to see how far it gets in the file before bailing out
12:03seangrov`,(doc ffirst)
12:03clojurebot"([x]); Same as (first (first x))"
12:03wakeuplol!
12:03seangrov`silasdavis: ^^
12:03wakeupYou guys got caar :)
12:03wakeup,(doc frest)
12:03clojurebotCool story bro.
12:03wakeupI didn't think so.
12:04llasram,(doc fnext)
12:04clojurebot"([x]); Same as (first (next x))"
12:04wakeup,(doc next)
12:04clojurebot"([coll]); Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil."
12:04llasramSo we've got `cadr` too :-p
12:05seangrov`Sadly, no caaaddadddr :(
12:05llasramhaha
12:05llasramJust use tools.macros and a Clojure version of the LoL dynamic ca*d*r macro
12:06vmarcinkoi doubt this is possible, but no hurt in asking... Is there some way to specify for some value to print itself differently then as per default...In my case I have a function that returns a map, and don't ask me why, but I would like this map to be printed by default only at first nesting level, and not deeper.
12:06seangrov`llasram: You're right, it must be done
12:07llasramvmarcinko: Well, you have two options
12:07llasram(1) If you just need it printed that way here, just write a function to print the map that way and explicitly call it
12:07wakeupllasram: I wonder what Mr. Hoyte would have to say about clojure =)
12:08dgrnbrg_Does anyone have a link to some complete example code using core.cache with atoms or refs?
12:08wakeupas for me, I am a big critic when it comes to clj, but I have to admit, I can get stuff done.
12:09llasramvmarcinko: (2) If the map has some separate type identity, then you add metadata for the :type key, then implement the `print-method` multimethod for the chosen :type value (usually a symbol or keyword)
12:10llasramwakeup: We only have 1 namespace, so it must be only half as powerful as CL
12:10vmarcinkollasram: thanx, i think I'll choose second option
12:15utkarshWhy does this match fail "(match "hi" (x :guard :string?) x" fail with "IllegalArgumentException No matching clause: h"?
12:15wakeupHow do I get the IOException class interned? I thought that was included in clojure.java.io ?
12:15utkarsh"IllegalArgumentException No matching clause: hi"*
12:15wakeupllasram: I do agree whith his (entirely practical) argument for the Lisp-2 design.
12:16utkarsh(I'm using core.match)
12:16ToxicFrogwakeup: what argument is that?
12:17llasramutkarsh: I'm no expert on core.match, but it looks like it's always trying to match the match argument as sequence
12:18wakeupToxicFrog: Are you familiar with variable capture?
12:18utkarshllasram: found the problem, was supposed to be "string?" instead of ":string?" :)
12:18technomancyvariable capture doesn't happen in clojure
12:18llasramwakeup: IOException is a Java class in the `java.io` package, so you'll need to :import/import it if you need to directly reference it
12:19technomancywell, unintentional CL-style symbol capture
12:19sm0kehey good fellas, can a core.async channel also overflow and drop messages?
12:20ToxicFrogwakeup: not by that name
12:20xeqism0ke: if you use a dropping-buffer or sliding-buffer
12:21sm0kexeqi:so a (chan) doesnt crash until the ram id filled?
12:21wakeuptechnomancy: I noticed that it throws an errer when you try do expand to a defn with a plain symbol as parameter.
12:22technomancywakeup: right; forcing use of auto-gensym prevents unintentional symbol capture without making it completely impossible.
12:22wakeupToxicFrog: Basically in a Lisp-2 we can do (when foo is a function): (let ((foo :bar)) (foo foo))
12:23xeqism0ke: when the chan is full it "blocks" the producer
12:23nathanicsm0ke: a normal (chan) will block the writer until a reader consumes the value, so you can't overflow it
12:23technomancynone of the wacky scheme-isms where you need two macro systems (an easy-to-use one and a powerful one) but none of the pitfalls of CL's error-prone system
12:23wakeupToxicFrog: So there are two seperate namesaces for two seperate appliances of symbols (functions/macros and values)
12:24wakeuptechnomancy: It's ok you don't have to persuade me.
12:24seangrov`Anyone using hiccup-alike syntax know how I can reproduce <script defer src="..."></script> ?
12:24sm0kexeqi: nathanic: so does that mean that for thousand unconsumed messages i will habe 1000 goroutines hanging around?
12:24wakeupToxicFrog: The downside of that seperation is the #'function syntax, the upside is that you can to think only 50% as hard whenever you bind a symbol.
12:24seangrov`I'm not sure how to include the defer attribute that doesn't have and value
12:24sm0keif i am doing (go (>! c 1)) that is
12:25wakeupToxicFrog: Which happens especially often when writing macros.
12:25nathanicsm0ke: you won't get to 1000 messages, because after message 1 the writer process will be blocked
12:25ToxicFrogwakeup: (let ((foo :bar)) (foo foo)) -- personally, I don't consider that a feature; it is vile.
12:26nathanicsm0ke: then (ideally) a reading process will consume the value, and then the writer will wake up, able to proceed and write another value
12:26wakeupToxicFrog: doesn't matter, thousands of programs have shown that it is very preferable in practice
12:27sm0kenathanic: for all that you are assuming i have a sigle producer
12:27sm0kenathanic: i was asking what is i issue writes on channel inside a go block?
12:28wakeupToxicFrog: That's the beauty of this issue: Anyone would instinctly despise that approach (why would a lisp seperate data and code, after all the key concept is data = code).
12:28sm0kethen i will have that many number of go routines waiting right?
12:28mpenetseangrov`: isnt' defer=true equivalent?
12:28wakeupToxicFrog: Programming practice has shown the opposite though, so that is a proff that aesthetics isn't everything.
12:29technomancycareful with all that hand-waving; you'll sprain your wrist
12:30seangrov`mpenet: It looks like it might be? Hard to tell :P
12:30seangrov`I'll give that a try, we'll see if the site blows up later I suppose
12:30technomancyI mean if we're going to go with anectodal evidence, lisp-2 makes higher-order functions in elisp so cumbersome that basically no one even bothers
12:30klrr_may i ask a queston regarding the (nth) function?
12:30klrr_regarding its design
12:31xeqism0ke: yes
12:31sm0kethanks! xeqi
12:31wakeuptechnomancy: can you give an example? I am not upo to date with elisp.
12:32sm0kexeqi: i am finding my self replacing a lot of atoms in my code with channels, do you think this is a more concrete design ?
12:33llasramklrr_: Easier to just ask :-)
12:33technomancywakeup: the fact that you can't operate on functions "immediately" but have to translate them to and from values means you won't bother for something simple
12:34klrr_well, i got very limited experience in lisp, and non clojure experience , but why does clojure make same problem as racket? when you read "(nth '(...) n)" you dont care a single bit of the list itself, you care firstly about which element you want to take right? i think this is missdesign tbh, but there may be a explanation
12:34technomancylike (transform (apply-partially #'some-thingy) x y) <- it's not just the #' syntax; transform has to call funcall to actually use its argument
12:34wakeuptechnomancy: I assume you mean (function sym) or #'sym?
12:34sm0kei guess i was actually emulating a channel with an (def a (atom [])) and (swap! a rest)..
12:35llasramklrr_: Hmm, I don't follow. Could you give a more detailed example of what you mean?
12:35xeqism0ke: I'm split on the share nothing architecture easily done with channels vs smart shared state done with atoms
12:35technomancyso typically transform ends up as a macro
12:35klrr_llasram: sure give me a sec
12:35technomancywhich means you can't use *it* in a higher-order way either
12:36wakeuptechnomancy: That doesn't make any sense. If there is any diference between (foo bar) and (funcall foo bar) it is explicity.
12:36technomancyit's boilerplate
12:36wakeuptechnomancy: no it's not, it's a distinction
12:36nDuffklrr_: is it the order of arguments you're referring to?
12:37klrr_yes
12:37nDuffklrr_: there's convention around collection functions' argument ordering, relied on by macros like ->>
12:37llasram,(doc nth)
12:37clojurebot"([coll index] [coll index not-found]); Returns the value at the index. get returns nil if index out of bounds, nth throws an exception unless not-found is supplied. nth also works for strings, Java arrays, regex Matchers and Lists, and, in O(n) time, for sequences."
12:37nDuffklrr_: nth follows that convention by putting the collection first.
12:37klrr_what is easiest to read. this: "(nth '(1 2 23 2 3 123 12 4 124 324 234 2) 3)" or this "(nth 3 '(1 21 312 31 13 321 123))"?
12:37klrr_putting collection first seems like missdesign, or is there any compelling argument for it?
12:37nDuffklrr_: (->> coll ... (filter ...) (nth 3))
12:37technomancywakeup: it means functions aren't really first-class. you can't treat them like regular values; you always need to shift them to and from the functional ghetto.
12:38Pupniki thought collection was first because clojure needs it to be first so it can dispatch on type correctly
12:38wakeuptechnomancy: It sound's like you don't see any of the upsides of function/value seperated namespaces. If that is the case, then of course there is no sense in arguing about the trade-off.
12:38llasramnDuff: Wouldn't that be more that `nth` breaks that convention by being a collection function which puts the collection first? :-)
12:38nDuff...oooh.
12:38llasramklrr_: No idea. It's bugged me too. It does seem like the argument order should be reversed
12:38nDuffThat's actually right.
12:38technomancywakeup: sure
12:38wakeuptechnomancy: buzzword hyperbole. you have no idea what you are talking about.
12:38llasramboo
12:39llasram~gentleman
12:39clojurebotHuh?
12:39llasramman, I do that every time
12:39klrr_well, gtg :P sry to ask questions that should be asked when yhou are experienced with the language
12:39llasram~gentlemen
12:39clojurebotYou can't fight in here. This is the war room.
12:40wakeupI don't have to add anything. technomancy just invalidated him/her/self
12:40technomancyI've written a lot of elisp. it isn't pretty.
12:40technomancybut I'll drop it.
12:40wakeupI agree, elisp isn't pretty
12:40llasram(inc technomancy)
12:40lazybot⇒ 80
12:40llasramFor both being right and being the better human :-)
12:44sm0keis walking dead an oxymoron?
12:46nDuffwakeup: you make a point that (let ((foo :bar)) (foo foo)) (with a foo fn in its own namespace) is a thing you *can* write in a LISP-2, but I can't imagine under what circumstances it would be a good idea.
12:47ToBeReplacednDuff: me too
12:48amalloynDuff: i dunno about you, but i sometimes name locals "name", and then later try to call name on something else
12:49amalloyi don't think lisp-2 is the solution, but it's a class of hard-to-notice bugs i wouldn't have to deal with
12:50technomancyyou wouldn't need much beyond local inference to catch that
12:50ToBeReplacedamalloy: for better or worse, i just don't allow shadowing... seems better to just use name-str or tag
12:51TimMcSeems like a tooling problem. :-)
12:51amalloyToBeReplaced: i'm not telling you about this because i find it impossible to write good code and need solutions. i'm bringing it up as a problem lisp-1 has that lisp-2 doesn't
12:51TimMc"Watch out dude, you just shadowed a var with a local."
12:51amalloythat there are solutions to it within lisp-2 isn't really germane
12:51technomancyTimMc: the other problem is that you'd catch the error in the repl before you bothered to run a full type-check
12:52ToBeReplacedyeah, i know, i'm suggesting that "this is a problem you have to deal with in lisp 1" is a bad argument because even if you are in lisp 2, you probably shouldn't write code that way
12:52amalloyi don't think that's true
12:53amalloybut it's a reasonable point of view
12:54xeqitechnomancy: did you like types before your ocaml stuff?
12:54rhg135I was wrong, you can write horrid clojure without macros
12:55Morgawrnow that the channel is more active... I'll ask again, is it possible to get into a deadlock/livelock/whatever when using nested swap! functions (of different atoms)
12:55Morgawrlike nesting them in concurrent statements in the inverted order (similar to classic deadlocks when dealing with multiple nested locks in other languages)
12:55technomancyxeqi: I didn't really like it in Mirah because inference only worked on locals, which meant the longer your methods were, the more bang-for-buck you got from the inference, which lead to bad code
12:56technomancyxeqi: there are a few places it's awkward in ocaml; mostly around serialization so far. but I've written less than 1kloc still.
12:57xeqitechnomancy: have you checked out property based checking yet?
12:57technomancyno, I haven't
12:57dublindanI'm playing with pedestal, Does anybody know how I would convert a single-function ring middleware (eg wrap-foo) to pedestals interceptors?
12:58`cbpdublindan: there is a #pedestal channel in case you haven't asked there yet :-)
12:59ToBeReplaceddublindan: i think there's a `handler` interceptor in io.pedestal.service.interceptor
12:59seangrov`Is friend the standard way to integrate with *external* oauth endpoints? For example, if I want to implement gmail authentication in my app
12:59TimMcMorgawr: I'd ask you to provide an example of what you're talking about, but I guess that would be the point, wouldn't it...
13:00dublindan`cbp: thanks, I'll check there :)
13:00indigoMorgawr: I was debugging a weird race condition with clauth; it involved two atoms
13:00TimMcMorgawr: Deadlock should be impossible (since there are no locks) but livelock...
13:00indigoI don't know whether that is the fault of the two atoms though
13:00seangrov`It looks like it might be...
13:01indigoStill can't make heads or tails of it
13:01TimMcseangrov`: Bear in mind that using OAuth for authentication (instead of authorization) is tricky business.
13:01TimMcAnywhere the spec says SHOULD or RECOMMENDED, read it as MUST.
13:02MorgawrTimMc & indigo: I don't have an actual example (because I can't quite come up with one), it's more of a theoretical question... I'm always concerned when using atoms (as one should always be when dealing with concurrency) and try to make sure I don't cause race conditions and issues
13:02Morgawrfrom what I can tell, swap! is implemented as a repeated test-and-set!
13:02seangrov`TimMc: heh, I'm porting the final bit of our rails app to clojure today, and that involved about ~20 Oauth integrations we've done over the past year
13:02Morgawrhowever I was wondering if the outer swap on atom a repeats until swap on atom b (inner) succeeds.. and then the same happens when another thread works on swap! atom b and swap! atom a (inner)
13:02TimMc&(let [a (atom 0)] (swap! a (fn [_] (swap! a inc))))
13:03lazybotExecution Timed Out!
13:03TimMcWelp.
13:03seangrov`The rails code is pretty messy, but works more or less. Nervous about porting it, but everything else has ported so smoothyl, I'm optimistic
13:03TimMcBut yeah, I think friend is what people use.
13:04jonasendnolen: ping
13:04TimMcMorgawr: I think you could get into deadlock, yes.
13:04seangrov`Looks like it does quite a bit more than what I need, but I'll give it a god
13:04ToBeReplacedi think the community is ready for friend to get ripped apart
13:05seangrov`jonasen: Would love to see a button on refheap, "Run in cljsfiddle" :)
13:05MorgawrTimMc: I guess I should come up with more testing and see if I can provide a real example.. it just worries me a bit that I haven't seen this mentioned before
13:05jonasenseangrov`: heh
13:05Morgawr(or maybe I haven't checked deep enough on the internet)
13:05ToBeReplacedi'd like to see parallel dev moving on pedestal interceptors to get away from exceptions as control flow and the like
13:06rasmusto,(and 't nil)
13:06clojurebotnil
13:06jonasenseangrov`: you have been working on the cljs compiler, maybe can shed some light on this: https://www.refheap.com/19212
13:07gfrederickshas anybody made a clojure lib for immutable PRNGs?
13:07jonasencljs/-compile is stateful, is that necessary?
13:07carkQ: i can't print to the nrepl repl from a thread, I tried rebinding *out* but it still doesn't work, is there a solution to that ? (used to work fine with slime)
13:08carktests are working from the repl, but not from compiled files
13:08gfrederickscark: try bound-fn?
13:08carkgfredericks: mhh how let me check that one =)
13:08cark-how
13:09ToBeReplacedTIL: bound-fn
13:09seangrov`jonasen: Looking for where the state is modified now...
13:10gfredericks(.start (Thread. (bound-fn [] (println 42))))
13:10seangrov`What's in ana/*cljs-ns* at that point?
13:10seangrov`I'll load up a repl and try this out too
13:10carkgfredericks: it works, tho it doesn't make sense at all, shoul be the same as (let [o *out*] (Thread. (binding [*out
13:11cark* o] ...
13:11gfrederickscark: I think nrepl uses other vars too
13:11carkoh I see
13:11gfredericksso bound-fn covers everything
13:11carkgfredericks: thanks !
13:11gfredericksno idea what the rest is though
13:12carknow let's hope this won't mess my ring thingie
13:12llasramcark: Also, in your example you're only re-binding *out* for the scope of creating the runable you pass to Thread. E.g., not for the scope of actually *running* in the thread
13:13llasrams,E.g.,I.e., ;; Latin!
13:13carkllasram: actually i forgot the # in front of binding
13:13llasramOh, ok :-)
13:13carkthat's the trouble when typing stuf in irc real fast =)
13:14seangrov`Damn, still can't paste to refheap
13:14seangrov`jonasen: https://gist.github.com/sgrove/63a57d2056d0b444cd5d
13:14seangrov`Working off of master
13:15jonasenseangrov`: note that in the second case I require clojure.set :as s and not clojure.string :as s
13:15seangrov`Ah, sorry
13:15seangrov`Ok, yes, I can reproduce that
13:16Morgawrhttp://www.morgawr.eu/p/1380818608.png okay, interesting, I'm not getting any deadlocks/livelocks or issues with this case of nested swaps... might be a very naive test that doesn't mean much (more complex stuff might be troublesome, idk)
13:16Morgawrbut yeah, at least this works
13:17dark_elementIs there any way to clojure.test tests in parallel ?
13:18jonasenseangrov`: the stacktrace points to https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/analyzer.clj#L717
13:18dark_elementto run*
13:19carkgfredericks: hah won't work for a ring hanler, i guess it's due to jetty creating more threads
13:23wakeupThis compilation NullPointerException is really bugging me.
13:24wakeupIt happens when I require a specific namespace, but the namespace in questions isn't different to other namespaces in any way.
13:24wakeupand like I said, loading and compiling manually works just fine.
13:24seangrov`jonasen: Yeah, looking at the state after running the analyze step, a 'foo namespace is created in clojure-land, and (ns-aliases 'foo) => {s #<Namespace clojure.string>}
13:25wakeupI'd love to post a minmal reproduction, but I don't see what's peculiar about this case...
13:26jonasenmaybe a call to http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/ns-unalias right before would fix the issue
13:26seangrov`jonasen: I wonder if there's an alternative, or if the analyzer should destroy the namespaces its created
13:26Morgawrhttps://twitter.com/Daverecruit/status/385784111098363905 :D
13:27jonasenseangrov`: I think the only reason for that piece of code is to allow ::foo/bar forms
13:27seangrov`Yeah
13:29nDuffMorgawr: Nice.
13:29indigowakeup: Maybe you're mixing in runtime information somewhere
13:29Morgawrjust found it on my tweet feed, thought somebody might be interested
13:29wakeupindigo: Found it
13:29indigowakeup: What was the issue
13:29wakeupindigo: I was redefining send, apparently lein didn't like that.
13:29indigoAh
13:30silasdavisis there an function (f nil) = ()
13:30wakeupindigo: But still imho this is a bug, if now only for the nullpointer exeption
13:30nDuff...which reminds me -- anyone in the Chicago area recommend a local recruiter to talk to? I've got good contacts here in Austin, but planning a move in April.
13:30silasdavisbut (f x) = x
13:30technomancysilasdavis: (let [f (partial apply list)] (f nil))
13:30indigowakeup: Time to file a lein issue I guess
13:30technomancyoh
13:31rasmustosilasdavis: see fnil
13:31xeqi(map (fnil identity '()) [nil 1 2])
13:31xeqi&(map (fnil identity '()) [nil 1 2])
13:31lazybot⇒ (() 1 2)
13:31wakeupindigo: can you point me to some place I can easily file one? I am not too involved with the clojure community.
13:32llasramwakeup: Do you have a reproducing example? I'm having trouble envisioning how this would be a Leiningen bug
13:32wakeupllasram: I will try to produce one right now.
13:32llasramok
13:32llasramcool
13:33gfrederickssend help, I am about to implement the mersenne twister in clojure
13:36wakeupllasram: apparently not as easy as I thought.
13:38wakeupah got it
13:39wakeupllasram: if you want I'll zip up the project and up it somewhere.
13:39wakeupfor some reason I have to do lein uberjar to trigger the error on the minimal repro, but it is the error.
13:40llasramwakeup: Yeah, go ahead and toss it up somewhere
13:40indigowakeup: If it's a leiningen bug, file it on GitHub at https://github.com/technomancy/leiningen
13:42slpsyshey, potentially dumb question: is there a clojure-idiomatic way to get the namespace of the calling function, or would i have to drop into java reflection?
13:42wakeupllasram: http://www.math.uni-bonn.de/people/max/foo.zip
13:42llasramfoo!
13:42wakeupfoo :)
13:42wakeuplein uberjar triggers the error for me
13:43wakeup"Warning: specified :main without including it in :aot. "
13:44wakeupI think that's the reason why it doesn't on lein run with the example
13:44`cbpslpsys: if the function comes from a bar you can get the ns from the meta, like ##(-> #'conj meta :ns)
13:44lazybot⇒ #<Namespace clojure.core>
13:45`cbps/bar/var
13:47llasramwakeup: Depending on your leiningen version, it may not be doing AOT for :main -- there was a bug for one release where it not only warned it was deprecated, but actually didn't do it :-)
13:47wakeupDoesn't matter in this case afaik
13:48llasramBut when you uberjar, it does AOT for everything, because that's in the :uberjar profile
13:48wakeupanyways I just upgraded my lein to rle out some old bug
13:48llasramOh, ok
13:48wakeuphave you tried the example? It really is minimal (4 Loc or so)
13:49llasramI have, and I vaguely recall seeing it before actually
13:49coventrywakeup: How do you generate the NPE from that? (require 'foo.namespace) works fine for me in nrepl and "lein repl".
13:49llasramTrying to dredge up from swap...
13:49wakeupcoventry: try lein uberjar
13:49indigoLots of warnings
13:49indigoAnd then a NPE
13:49wakeupllasram: me too, right when I started messing around with clojure. Was quite frustrating ;)
13:50coventryYep, that works
13:50coventry(i.e., generates a NPE.)
13:50wakeup;)
13:50wakeupsuccess :P
13:51coventryFWIW, (ns foo.namespace (:refer-clojure :exclude [send])) fixes the problem.
13:53indigoClojure debugging is definitely a weak point
13:53indigoBut I'm sure that there's work being done on improving it
13:53wakeupagree, but also agree that it can be approved
13:53technomancysounds like http://dev.clojure.org/jira/browse/CLJ-1241
13:54wakeupsince Java has exceptions, you guys can at least get rid of the java stack traces,´
13:54technomancylove the last comment on that one btw. really makes me want to report more bugs.
13:54bitemyappseangrov`: were you at the meetup last night? I missed you.
13:54llasramAh, yes, that's exactly it
13:55bitemyappSaw a bunch of others though. Rohner, Tellman, etc. :)
13:55indigotechnomancy: Sarcasm? ;P
13:55wakeupyeah thats it
13:55technomancyindigo: sarcasm about Jira? inconceivable!
13:55wakeupwhat does hickey mean by triage guidelines?
13:56technomancywakeup: ugh who knows
13:56coventrytechnomancy: Where are the triage guidelines documented? I would really like to get this bug fixed, but I see similar bugs having languished for years. http://dev.clojure.org/jira/browse/CLJ-1275
13:56technomancythere are very specific steps for contirbuting to clojure which are understood by like two and a half people total
13:56coventryWell, at least a yea.
13:57wakeup:)
13:57indigoWe need some Clojure JIRA janitors
13:57xeqiindigo: alex miller has been doing stuff in that area recently
13:57technomancymaybe it's gotten better since I tried last, but I've basically given up on pushing upstream
13:57xeqiI kinda read the last comment as directed at him
13:57indigotechnomancy: Yikes.
13:58rasmustoevery month or so I run into a problem at work that I want to apply core.logic on, is this normal?
13:58wakeupif it makes you feel better, we have these issues too in the CL community...
13:58wakeuptry to get the implementors agree on something! :)
13:58technomancyheh
13:58wakeupthey are all nice and awesome people, but this stuff is just hard
13:59wakeupHave any of you guys tried ABCL?
13:59wakeupI wonder how it performs
14:00wakeupBecause that is the thing I'd have recommended to my client instead of clojure if anything.
14:02wakeupBy the way, before I forget, I have a question about clojure concurrency
14:02wakeup(very foreighn to me, I am used to locks and stuff)
14:03wakeupWhen I have two concurrent (dosync (something-impure) (ref-set x)) blocks, will I be in trouble?
14:04technomancywakeup: the impure thing needs to be idempotent
14:04bitemyappidempotence is a really nice property to understand and embrace when it's available
14:05bitemyappI try to make my message propagation stuff idempotent as often as possible. Makes life so much better.
14:05technomancyI think the docs say dosync can't contain any side-effects apart from alter/commute/ref-set, but idempotent ones are OK.
14:05wakeuphmm I would love not to worry about what impure-stuff does
14:05wakeupas it opens an sqlite database and writes to it.
14:05bitemyappdon't do that.
14:06technomancythe important thing to remember is that transactions will retry
14:06wakeupHow would I go about evaluating (impure-stuff) atomically?
14:06danlentztechnomancy: regarding the use of +style+ naming… I understand that the norm is for values to be immutable and the CL style naming convention does not jive in that respect, but I think that it is still a helpful convention in the sense that it clearly distinguishes the var as not a _function_. This is in particular useful given closure's lisp-1 namespace. Are there other reasons why you'd consider it to be bad style?
14:06technomancywakeup: sorta-hacky thing to do is to queue the write up in an agent; it will only fire if the transaction succeeds
14:06technomancybut it's still not atomic; the transaction won't fail if the db write fails
14:07wakeupE.g. I don't care in which order multiple calls to impure-stuff are evaluated, but they may not overlap.
14:07bitemyappdanlentz: it's bad style.
14:07wakeupSo as far as I can tell, I am looking for a lock
14:07bitemyappwakeup: no, you're looking for better code.
14:07technomancydanlentz: at the very least people will look at you funny like you put your parens on their own line
14:08bitemyappif somebody submitted me a PR with +nomenclature+ I would reject it out of hand.
14:08seangrov`bitemyapp: Yeah, saw your talk, was well done - looking forward to you fleshing it out more
14:08technomancydanlentz: usually a var having a name that is not a verb/property is enough
14:09seangrov`I left probably around 10 or so, didn't get to mingle too much
14:09bitemyappseangrov`: ahh, that's why. I'm glad the talk wasn't terrible. :)
14:09wakeupbitemyapp: Then how do I make (jdbc/execute! spec [query key value]) thread-safe?
14:09coventryIt appears that the official triage guidelines are here: http://dev.clojure.org/display/design/JIRA+workflow+update just after the huge flow diagram.
14:10bitemyappwakeup: back it up. What are you trying to do?
14:10danlentzis there some other convention more appropriate to visally distinguish special symbols that are intended to be essentially well known global values so as to distinguish from the rest of the flotsam and jetsam?
14:10bitemyappwakeup: just in an abstract sense.
14:10bitemyappdanlentz: all named vars are global in Clojure. Only local bindings are local.
14:11wakeupbitemyapp: Some code writes to a file, it gets called concurrently, I want the file-writes to happen atomically
14:11bitemyappdanlentz: there's *nomenclature* for dynamic vars, which is intended to be a warning.
14:11wakeupbitemyapp: e.g. usually I'd have a lock which must be held to do the file writing.
14:11bitemyappwakeup: how serious is this code?
14:11wakeupit's a simplified example.
14:12bitemyappwakeup: also, the earlier suggestion to use an agent was apropos: http://lethain.com/a-couple-of-clojure-agent-examples/
14:12wakeupsince you asked for once.
14:12technomancywakeup: you can through an agent or j.u.c queue
14:12technomancy*you can serialize
14:12technomancybut not in a way that causes the transactions to fail
14:12bitemyappwakeup: I think it would be educational to write code that breaks first (races), and then fix it. But for this sort of thing, use an agent or a queue.
14:12bitemyappwakeup: stop resorting to locks. You can do better than that.
14:13technomancytrying to make the STM atomic with things that aren't refs is really, really hard
14:13wakeupbitemyapp: how can I resort to locks, clojure doesn't have any
14:13danlentzof course. but some values are distinguished in that they are special static constants. e.g., a node-id of the machine. Or in my case a group of associated bit mask values +ub4+. +ub8+, +ub16+ +ub32+, +ub648+
14:13TimMcwakeup: clojure.core/locking
14:13wakeupnooo!
14:13wakeup;)
14:13bitemyappwakeup: lol, that's patently not true. I'm just trying to get you to work smarter.
14:13technomancywakeup: https://groups.google.com/forum/#!topic/clojure/VhIwdJvgLyg <- possibly relevant
14:14TimMcJust saying that it *does* have locks.
14:14TimMc(NOt saying that you should use them.)
14:14danlentzthese are definitely not intended to be construed as dynamoc vars
14:14wakeupTimMc: Yes thank you. My bad.
14:14technomancydanlentz: so you're worried about people mistaking ub4 for a function?
14:14technomancythat seems very unlikely
14:15bitemyappdanlentz: you realize that when people switch from a lisp-2 to a lisp-1, they don't suddenly attempt to (blah) everything right?
14:15bitemyappdanlentz: you're looking for guard rails that you don't need.
14:15bitemyappchill out.
14:15bitemyappuse typed clojure if you're that worried about having a dumb.
14:15wakeupI think agents are what I am looking for.
14:16technomancydanlentz: besides, if you type "(ub4 " in your clojure source file, emacs won't display arglists in the minibuffer, which makes it pretty clear =)
14:16danlentzi dunno. It seems expressive and clear in its intent to me. I'm not sue how one can endorse *earmufs* while flat out rejectiong this type of naming
14:16indigoYay, ordered a Clojure mug
14:16wakeupagents are just automagic locks arent they?
14:16technomancyearmuffs are about sending a clear message that your normal scoping rules don't apply. dynamic scope is a lot more error-prone than lexical scope.
14:17bitemyappwakeup: no they aren't, but they're useful for serializing writes to a resource.
14:17technomancywakeup: agents are at their core a reference type like refs. but because they're convenient they get used for a bunch of other things too.
14:17danlentzno i'm looking to have them easily accessible by +-TAB key sequence for autocomplete
14:17bitemyappdanlentz: you're not some kind of antediluvian lisper are you? you're down with lexical scope too right?
14:17danlentzand visually distinguished when used in the body of some code
14:18danlentz:)
14:18bitemyappdanlentz: stop trying to be a special snowflake and just write some Clojure code.
14:18bitemyappdanlentz: Clojure Clojure, not danlentz Clojure.
14:18llasrambitemyapp: breathe?
14:18bitemyappllasram: I am breathing. this is zen instruction.
14:19rasmusto*snowflake*
14:19coventryhttp://dhammatalks.org/Archive/y2013/130426_The_Wrong_Uses_of_Right.mp3 :-)
14:19danlentzthanks for that. I'm enjoying clojure. my background is in common-lisp, where we also have conventions, but in general i've found that the reasonng behind them to be more lucid than fear of snowflakees
14:20bitemyappdanlentz: I'm one of the other Common Lispers here.
14:21bitemyappdanlentz: I learned faster and became a better Clojure programmer when I forgot what I knew and just learned Clojure.
14:21llasramdanlentz: If I'm following what you're trying to do, I think a more typical approach in Clojure would be to put all of these values in their own namespace which you then :require :as some single-letter alias. Then you get `u/b4` etc
14:21danlentzCommon-Lisp tends to foster independent minded thinking as a whole…. Clojure is a very different approach to language design.
14:21bitemyapp^^ what llasram says is solid, but again, you can learn this stuff if you just write Clojure.
14:21mtpyou can only learn how to use a tool by picking it up and playing with it
14:21mtpbook learning only goes so far
14:22danlentzllasram: ah. good idea. that is a reasonble solution.
14:22llasrammtp: For programming languages I find reading lots of code written the language helps at least as much. And reading the language implementation
14:22mtpllasram that would be "immersion"
14:22mtpwhich is part of picking the tool up
14:22llasramagreement -- achieved! :-)
14:23zoldaras soon as I switch to clojure-mode in emacs, shift-c is treated as ctrl. In every other major mode it just outputs a capital c. I've tried disabling all the minor modes but it didn't change anything. That may be the cause of that binding change?
14:23zoldarwhat*
14:23TimMcmtp: That includes bandsaws. :-D
14:23mtpTimMc don't touch the bandsaw until you've gotten the hang of the screwdriver!
14:24zeroemzoldar: do you have any other packages installed? I just fired up emacs+paredit+clojure-mode and shift-c works fine
14:24TimMcs/ until you've gotten the hang of the screwdriver!//
14:24danlentzyes I am not having too hard of a time for the most part. It took a bunch of years before i could work in CL productively. I'm getting things done in clojure after a few weeks.
14:25zoldarzeroem: yes I have, but I've also tried disabling paredit-mode as well as other minor modes to narrow the issue down to clojure-mode being enabled
14:25danlentzllasram: solid advice.
14:26`cbpasync code is hard!
14:26indigo.. let's go shopping!
14:26ToxicFrogwakeup: that doesn't follow; there are other ways to avoid symbol capture (autogensym) and one could just as easily argue that thousands of programs have shown the value of convenient higher-order functions ergo lisp-2 is a dead end.
14:28ToxicFrogwakeup: also, to clarify, the bit I think is vile is not avoiding symbol capture, it's code where you use the same name to mean different things in the same scope depending on whether it's in car or cdr position. That's going to be confusing whether you're a lisp-2 or not.
14:28danlentzI also like <name> convention for certain situations… I guess that might potentially provokee a lynch mob… :)
14:29ToxicFrogOr, as nDuff said, "it is a thing you *can* write but I can't imagine under what circumstances it would be a good idea"
14:30zoldarhere's my .emacs file contents: https://gist.github.com/zoldar/6814115
14:30wakeupToxicFrog: 1) which complicates the macro system, 2) higher order functons are not inconvenient in CL, 3) trust me its not confusing.
14:30technomancyzoldar: try bisecting it, I guess
14:30wakeupToxicFrog: Think about why clojure needs autogensyms in the first place
14:34seangrov`zoldar: How does the js indentation look with your settings? The default emacs indentation for js is horrific
14:35klrr_is it possible to have private functions in a namespace?
14:35TimMcgfredericks: (def rand (constantly 17))
14:35seangrov`Looks like it might not support comma-first var listings...
14:35hiredmanklrr_: yes, but private is silly
14:35TimMcklrr_: Sure, just put ^:private in front of the name.
14:35klrr_okey
14:35klrr_thanks :)
14:35TimMcPeople can still get to it easily, though.
14:35wakeupMaybe I can save some thinking/work, Question: is jdbc/execute! thread safe?
14:35danlentzwakeup: absolutely. lisp1 is my least favorite aspect of clojure. Anyone i've known who works in lisp2 for a reasonable period of time tends to become fond of it.
14:35klrr_TimMc: how you mean?
14:35klrr_hiredman: why is it silly?
14:35TimMcklrr_: It's better to make everything public and then just document what's part of the API.
14:36technomancyI've worked in lisp-2 for a long time; I thought it was fine until I tried a lisp-1.
14:36danlentzthere are many things I lile quite a bit though so its not a complaint.
14:36technomancymostly because I didn't understand non-trivial HOFs
14:36klrr_okey, i dont see why it's silly to hide unecessary bindings, it seems logical to me in fact since then there is more likely to be less name-clashing
14:36wakeupdanlentz: I have to admit though, that my clojure style takes big advantage of Lisp1. I do a lot of let&lambda oop ;)
14:37TimMcklrr_: Since most users of your namespace will use :require, not :use, there won't be clashing.
14:37technomancyklrr_: it's very valuable to signal which parts of a namespace are implementation details. definitely not silly.
14:37technomancyavoiding name-clashing is not a good reason though
14:37TimMc(:require [clojure.string :as str]) then str/join etc.
14:38klrr_technomancy: i didnt say it was silly i asked why it was silly
14:38danlentzyou are free to bind functions to symbol-values as well as symbol-function in CL, giving you Effective lisp-1 whenever and wherever you want it.
14:38TimMctechnomancy, do you still ues ^:internal?
14:38klrr_TimMc: okey sounds lgoical
14:38technomancyklrr_: yeah, I was responding to hiredman's assertion
14:38wakeupdanlentz: hehe good point
14:38klrr_ok
14:38technomancyTimMc: yes, if for some reason I can't make it private
14:39TimMcAh, so you use both.
14:39wakeuphttps://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc.clj#L651
14:39wakeupthread safe or not?
14:39carkanybody managed to print to the nrepl repl from a ring handler ?
14:40technomancyTimMc: you can have functions which are internal to a lib but still need to be used outside a given namespace
14:40danlentzCL is big on giving the programmer freedom, almost to the point of a logicl extrame. Its perhaps the bratest beauty of CL and aleo a major factor of its demise
14:40ToxicFrogwakeup: I'm willing to accept the existence of a small amount of complication in the macro system if the tradeoff is significantly reduced complication in the language proper.
14:40technomancyfreedom to choose between seventeen equality predicates =)
14:41danlentzCL is whatever you envision it to be.
14:41wakeupToxicFrog: CL is the #1 programmable programming language
14:41TimMcWhereas Clojure is opinionated.
14:41wakeuptechnomancy: Oh yeah? Hwere is EQ in clojure?
14:41technomancywakeup: clojure.core/identical? basically
14:42wakeupbasically?
14:42danlentzyeah, not the prettiest part of the language, that.
14:42danlentzClojure skates the issue b/c everything is a value
14:42technomancywakeup: I'm not sure if the semantics are the same for numerics
14:42wakeupThis = operator is VERY fishy.
14:42technomancywakeup: clojure.core/= is basically baker's EGAL with some corner-cutting to make laziness less cumbersome
14:43wakeupand I fear for the day when I will need EQ and don't have it
14:43tbaldrid_wakeup: why won't identical? work for you?
14:43wakeupand I think I will use a lock, until somebody explains to me, why waiting on each other is worse then fighting for a resource.
14:43tbaldrid_wakeup: that being said, I've used Clojure for years, never needed anything but = except for performance (very rare)
14:43danlentzIf it were necessary to handle the same use cases, you'd find that there is an extremely good reason to acknowledge the subtle gradations of equality and appreciated the ability to express precisely the one appropriate to a given scenario.
14:44wakeupdanlentz: I like you. You manage to express my thoughts properly ;)
14:44gfredericksTimMc: my first try at naming it is 'four'
14:45TimMcsnrk
14:45danlentzof course, immutable values do not pose difficulty. Henry baker wrote a few pears on all of this. I think one was called "equal-riights for mutable valuees" or some such
14:45technomancyclojurebot: egal?
14:45clojurebotegal is http://home.pipeline.com/~hbaker1/ObjectIdentity.html
14:45technomancyclojurebot: botsnack
14:45clojurebotthanks; that was delicious. (nom nom nom)
14:45danlentzheh :)
14:45TimMcOf course, = and memoize and conj do not play well together.
14:46danlentzclojurebot is friendlier than minion :)
14:46tbaldridgewakeup: locks are fine....until you need more than one to be locked at a time. That's when all hell breaks loose.
14:46technomancydanlentz: you caught him on a good day. usually he says he'd rather have chocolate.
14:46simon__hi
14:46simon__is there some project on the way to make ring work for asynchronous serving of requests, e.g. with core.async?
14:47tbaldridgeone of these days I want to write something like Rich's ant test, and then run analysis about how often work is retried. My guess is that is's very, very low.
14:47wakeuptbaldridge: I know this sounds cocky, but I am genuinely good with locks. Mainly because I try to avoid them.
14:47bitemyapptbaldridge: cgrand has done some work on this.
14:47bitemyapptbaldridge: did you see the MegaRef library he wrote?
14:47wakeupbut thsi agent/ref stuff doesn't make sense to me, none of those seem to do what I need.
14:47tbaldridgesimon__: can't be done with ring. Look into Pedestal, or http-kit for something else.
14:47danlentzi'm good with locks as long as they are accompanied by cream-cheese
14:47bitemyappsimon__: Ring is an interface, not an implementation.
14:48bitemyappsimon__: Jetty is synchronous thread per request and is the default in most Ring apps, but you can use http-kit with ring to make it asynchronous.
14:48bitemyapptbaldridge: wtf are you talking about.
14:48wakeupWhat I know 100%: I don't want anything to compete for anything right now. So STM seems off.
14:48danlentzand possibly pumpernickel bagels
14:49bitemyappsimon__: without changing your app much if at all, I might add.
14:49simon__bitemyapp: well but it won't invoke the ring handler on send! as the documentation says.. .which as tbaldridge points out is inherit in the ring model of handler functions
14:49bitemyapptbaldridge: what you just said is very incorrect and misleading. Please don't do that.
14:49TimMc&(let [m (memoize conj)] [(m [1 2 3] 4), (m (list 1 2 3) 4)])
14:49lazybot⇒ [[1 2 3 4] [1 2 3 4]]
14:49tbaldridgewakeup: things will always compete, and at the core, locks are just CAS ops, so...why not go lower leven and just use CAS?
14:49bitemyappsimon__: if you want async Ring, use http-kit.
14:50simon__bitemyapp: look into the documentation of http-kit it says ring handlers won't be invoked on async send!
14:50technomancytbaldridge: also, referring to it as just "pedestal" is kinda misleading too since most of pedestal is completely unrelated.
14:50tbaldridgebitemyapp: how does http-kit get around tieing up a thread for each request? How does it work with existing ring handlers?
14:50rasmustoTimMc: :o, sneqy sneqy
14:50tbaldridge(inc simon__)
14:50lazybot⇒ 1
14:50wakeuptbaldridge: how is a lock competing?
14:50ToxicFrogDeath to locks, message passing supremacy~
14:51bitemyappwakeup: you're not that good with locks. Stop using locks.
14:51bitemyappwakeup: locks don't compose either.
14:51simon__ain't there some way to make the ring "idea" work with a channel model?
14:51tbaldridgewakeup: two things lock, one will wait. Competing for the same shared resource.
14:51ToxicFrogwakeup: if you have multiple threads trying to access the same lock-protected resource, this is called lock contention and consists of all the threads in competition to see who gets the lock next.
14:51bitemyappsimon__: what is it you want actually?
14:51danlentzlocks swim upstream in the channel when they go to spawn…. ok i'll sotp.
14:52bitemyapptbaldridge: it works with existing Ring handlers. Ring request handlers are just functions that receive a request and return a response.
14:52tbaldridgesimon__: look into Pedestal's "interceptor" library. It's designed to work in async situations.
14:52tbaldridgebitemyapp: so if I want to pause execution in the middle of a handler?
14:52bitemyappsimon__: you don't need Pedestal or its interceptor library if you just want async.
14:52simon__bitemyapp: I want to program a rest api that will ask a remote db and maybe some service and then answer a request, and I thought maybe there is something on the way that might help me avoid tying a thread to each connection
14:52bitemyappsimon__: in that case, you just need async.
14:53bitemyappsimon__: try http-kit.
14:53wakeupHow do I "make a lock"? (Besides (java.util.ArrayList.))
14:53bitemyapptbaldridge: Things that don't matter in actual web apps #49503
14:54bitemyapptbaldridge: async in web apps is generally about resource contention and not backing up threads on I/O while handling many concurrent requests. http-kit serves that need and doesn't require rewriting your entire app in terms of a batshit web framework disconnected from reality.
14:54tbaldridgebitemyapp: but that's not what I asked. My original statement was that ring (and by that I meant the ring model) does not support async. You must keep a thread tied to the request call stack during the length of the request.
14:54technomancywakeup: if you don't have an existing object to lock on, sometimes people just do (def lock (Object.))
14:54bitemyapptbaldridge: I would also appreciate it if you didn't mischaracterize the nature of Ring and how it works as if it was somehow fundamentally synchronous when it is *NOT*.
14:54technomancy(locking lock ...)
14:55tbaldridgebitemyapp: lol, what about comp isn't synchronous?
14:55wakeuptechnomancy: thank you
14:55tbaldridgebitemyapp: the entire ring system is based on the idea of chained functions. That by definition is synchronous.
14:55technomancywakeup: np
14:55llasramwakeup: To further clarify, on the JVM, all objects have their own "intrinsic" or "monitor" lock
14:56llasram /Java Concurrency in Practice/ notes that "In retrospect, this design decision was probably a bad one."
14:56wakeupllasram: Yeah I just read that, I just wondered what the idomatic way to make a lock was.
14:56llasramAh, ok
14:56llasramcool
14:57wakeupsince I don't really have a shared statastructure
14:57gfredericksunchecked-multiply doesn't work on boxed numbers
14:58TimMcbitemyapp: We recently introduced (locking ...) into a project at work, but it's only there to make sure that two threads on the same node don't try to grab the same expensive network lock.
14:58bitemyappTimMc: I'm not saying never use locks, just that they just should be used far less often than people typically think. That's an interesting use-case.
14:59tbaldridge(inc bitemyapp)
14:59lazybot⇒ 2
15:01bitemyappThe problem with locks is cultural, not technical. There's a "when all you have is a hammer" problem in managing coordination and concurrency in most other language communities so they usually don't really know any better.
15:04wakeupbitemyapp: I agree to some extent, but with clojure it's the opposite problem. I am now using refs where it doesn't make sense, just becuase otherwise would be non-idomatic.
15:06wakeupE.g. I am big fan of thread safe queues. But they can't be applied to most concurrency problems efficiently.
15:06technomancyllasram: huh; what's the rationale for the regrets? just the overhead/clutteredness?
15:08llasramtechnomancy: Oh, it apparently puts constraints on JVM implementation object layout. You always need to be prepared to summon up a new lock for any object
15:08technomancymakes sense
15:09technomancydon't mind it from a user perspective, but it feels a bit wasteful
15:10zoldarthe offending part seems to be this: https://gist.github.com/zoldar/6814745 . I've tried commenting one local-set-key call or the other but it seems that any use of that form causes change of shift+c behavior... why?
15:10technomancyzoldar: you want (kbd "C-,")
15:11mdrogalistbaldridge: You still cooking up the next macros video?
15:11tbaldridgemdrogalis: yeah, hopefully sometime this week, I keep getting sidetracked by life/side projects
15:12mdrogalistbaldridge: No rush. Life happens. :)
15:12zoldartechnomancy: thanks. Suppose I'll have to read up on what local-set-key does actually
15:13technomancyzoldar: the binding syntax is kinda historical cruft
15:13ucbis there an nrepl middleware to compile the buffer you're working on automatically?
15:13ucbif not, is it a terrible idea?
15:14technomancyucb: it's a bad idea to do it in a way that doesn't involve your editor IMO
15:14technomancyif you put it in an after-save-hook in emacs you'll at least get to see compilation errors immediately
15:14technomancyand have hyperlinked error messages you can jump to
15:14ucbright
15:15ucbI'm sort of thinking of it to aid some form of autofix ala eclipse
15:15ucbI wrote a simple thing that relies on flymake (https://github.com/ulises/quickfix-mode) but it's not great
15:16technomancyhuh; cool
15:16ucbI thought that if you had an nrepl middleware telling you things like "function foo can't be found"
15:16ucbthen you can hook into that and provide quickfixes
15:16ucbbut maybe it's all just a bad joke
15:16ucbalso, that quickfix "mode" is super-incomplete and you can probably see
15:17technomancyyou mean you want to simplify error messages server-side so you have less work to do on the elisp side?
15:17ucbindeed
15:17ucbideally the hard work would be done server-side and the elisp bit would be just look up of things
15:18technomancyucb: curious if you've seen https://github.com/technomancy/nrepl-discover ?
15:18technomancyit is somewhat related
15:18ucbhuh, I've obviously not thought it through very well
15:18technomancya more general approach, but I think you could fit your quickfix idea into it
15:20ucbthanks for that technomancy
15:21technomancyucb: it's just an idea I had. I think it's pretty promising, but so far no one else does, for reasons I have been unable to determine.
15:22technomancymaybe I'm just bad at splaining
15:23ucbhmm
15:23ucbI think I'm failing to grok this
15:27technomancyit's just a way to implement more logic server-side so that clients (which need to be re-implemented for each editor) can remain small and dumb
15:28technomancybecause I don't like writing elisp
15:29ucboh, right
15:29seangrov`Love that there's oauth-clj and also clj-oauth :P
15:29llasramIf they show up to the same party they're going to be so embarrassed
15:29ucbso you effectively write tiny code on your editor, just entry points on the server to be executed?
15:30bitemyappseangrov`: there's clauth and a fork of clauth too.
15:31technomancyucb: basically; you agree upon some minimal set of operations to support client side. as long as you can implement what you need in terms of those operations, the logic can be all in one place.
15:31seangrov`bitemyapp: Nah, I think I'll go with clj-oauth-clj
15:31bitemyappseangrov`: clj-authjure is a much better name.
15:31mdrogalisoauth-clj-oauth
15:31mdrogalisJust to complete it. D:
15:32llasram[clj-oauth-clj/clj-oauth-clj "0.1.0-SNAPSHOT"]
15:32bitemyappmdrogalis: so. AOP.
15:32seangrov`Break all the conventions!
15:32mdrogalisbitemyapp: Yes?
15:32ucbtechnomancy: makes sense
15:32bitemyappmdrogalis: you know slingshot right?
15:32bitemyappmdrogalis: what about "aspect selectors" with a binding scope?
15:32ucbtechnomancy: what I'm wondering is how much support from nrepl do I really need for quickfix
15:32mdrogalisbitemyapp: I do.
15:32technomancyjust be thankful that the combinatorics of this question don't include "*jure"
15:32mdrogalisI'm not sure what that means.
15:33zoldarseangrov`: did you mean something like "var foo = bar\n, baz = baf;" ?
15:33bitemyappmdrogalis: so, you have named aspects wrapping an fn
15:33ucbtechnomancy: in principle I could just have flycheck/flymake checkers for clojure and latch on to that
15:33seangrov`Ah, for christ's sake... there's also clj-oauth2
15:33mdrogalisIn Slingshot?
15:33bitemyappmdrogalis: some are pre, some are post. Whatever. But they all have names.
15:33bitemyappmdrogalis: no, Slingshot was intended to merely be an example.
15:33bitemyappmdrogalis: I mean with hooke and Dire.
15:33seangrov`zoldar: Yeah
15:33mdrogalisOh, alright. Yeah, I follow.
15:33bitemyappmdrogalis: so you could have an aspect that is :log-fn :pre right?
15:34technomancyucb: practically speaking ... I don't know. if no one else uses nrepl-discover then it's probably a dead end.
15:34mdrogalisbitemyapp: Sure.
15:34bitemyappmdrogalis: so you slap all the aspects on the fn, but you want to be able to have a binding scope that selects arbitrary subsets of them.
15:34ucbtechnomancy: after all, the simplest case of "function foo is undefined" is sorted with a template ala (defn foo […] …)
15:34bitemyappmdrogalis: that's all. Just something I'm thinking about. robert.hooke has a basic version of this with the disabling thingy.
15:34zoldarseangrov`: Indeed it doesn't support this but I didn't see it yet to be honest. Not that I'm a hardcore js dev... but what's reasoning behing putting comma first ?
15:34mdrogalisbitemyapp: I think that'd be swell.
15:34ucbtechnomancy: right. I probably need to think about this a little bit more because what I thought would be "easy" turns out to be not that easy (on first inspection)
15:35technomancyucb: right; if you can frame it in terms of edits to be made, that could work. not sure.
15:35seangrov`zoldar: It'll make you less likely to go insane in the long run, you instantly see where you've forgotten a comma.
15:35mdrogalisbitemyapp: It would be nice to have a scope where none of the aspects are active.
15:35mdrogalisI've needed that on occassion.
15:36ucbtechnomancy: that's the thing. Missing declarations are likely solved by adding their definitions to the file even with some form of yasnippet type of action
15:36llasramseangrov`, zoldar: or added an extra, since JS doesn't allow terminal commas after the last entry in arrays or objects
15:36zoldarseangrov`: ah, ok
15:36ucbtechnomancy: the other question, more quickfix specific, is whether there are any other kinds of issues that can be solved with the aid of quickfix
15:36ucbtechnomancy: and the ultimate hidden agenda is to get some form of quick shortcuts to usual operations ala eclipse in emacs … for clojure
15:37technomancyucb: yeah, that's probably the more interesting question. what kinds of problems can it solve
15:37ucb /because I'm lazy like that/
15:37ucbtechnomancy: indeed. Although I suspect there's merit in convenience shortcuts.
15:38technomancyucb: nrepl-discover.el actually creates proper M-x commands you can rebind
15:38ucbtechnomancy: however I'm starting to feel like the most common type of fix will be edit operations, e.g. if you require a ns that doesn't exist, you'd add the file with just an ns directive
15:38ucbtechnomancy: now I'll have to take a look at nrepl-discover :)
15:38technomancyucb: it's pretty short at least =)
15:39ucbtechnomancy: awesome
15:39technomancythe hard part is defining the operations you want everyone to support
15:39mdrogalisbitemyapp: The thing to really make Dire complete, IMO, is to have a spot in the project.clj file that turns sets of hooks on and off on a per-profile basis.
15:39mdrogalisI'll get to it someday.
15:39ucbtechnomancy: this is where I'm failing to grok how nrepl-discover would help
15:39technomancymdrogalis: just :hooks in a profile?
15:40technomancymdrogalis: oh, nm; in-project hooks
15:40ucbtechnomancy: in my head, your editor would be trying to compile the file/buffer you're working on with a certain frequency. Then your editor would be informed of the errors, if any, and it's your editor's responsibility to make the fix
15:40bitemyappmdrogalis: that would be nice too, but I kinda want to feed my inner Common Lisper with runtime scoping of the aspects. :P
15:40bitemyappie, MOAR POWER
15:41mdrogalistechnomancy: It tried, it ended up not being the solution because for some tricky loading reason.
15:41technomancyucb: decouple the "when" from the "fixing"
15:41technomancyucb: they're totally different concerns
15:41mdrogalisbitemyapp: I don't see why you can't have both.
15:41technomancyI don't want to send code over until I save, personally.
15:41technomancywhich is easy with a hook. but I still want the fixy stuff
15:41ucbtechnomancy: indeed. My comment was more like there's little server-side work to do. I mean, other than "try to compile foo.clj" and "return the result of the attempt"
15:42bitemyappmdrogalis: you most certainly can, just saying where my head-space is.
15:42ucbtechnomancy: yes. The compile-on-save is probably the sanest option
15:42mdrogalisbitemyapp: I'd take it as a PR. :P
15:42technomancyucb: the translation of compilation error -> set of edits to perform is what I was thinking
15:43ucbtechnomancy: I see. I thought nrepl-discover was more useful the other way
15:43mdrogalisI've been wanting to request it as core.conditions for a long time, but I'm not sure if it's a universally good idea anyhow.
15:43ucbtechnomancy: like editor sends message "foo" and the server does some computation for "foo"
15:44technomancyucb: oh, right. yes, it can provide that too, already.
15:44technomancythe translation is the server-side work you'd have to implement by writing a defn with :nrepl/op metadata.
15:44ucbtechnomancy: my comment was related to my confusion. I thought nrepl-discover only did editor -> server side work sort of traffic
15:45technomancyhuh, maybe that's why no one else is using it =)
15:46ucbheh
15:46technomancyhttps://github.com/technomancy/nrepl-discover/blob/master/Proposal.md <- "Argument types" describes how nrepl-discover clients would construct in-editor commands; "Responses" describes the actions which would be returned to the client when the command is invoked.
15:47llasramtechnomancy: I want to use it! Just so many projects, so little time, etc
15:49ucbtechnomancy: thanks for the conversation, it's been helpful
15:50technomancyucb: np. it might not be quite what you need, but maybe it'll at least get you thinking in new and interesting directions =)
15:50ucbtechnomancy: definitely
15:53akurilinIs there anything in the ring toolset for dealing with different Accept values? Do most people just handle branching by hand in each handler, perhaps defaulting to one MIME type?
15:54bitemyappakurilin: http://yogthos.net/blog/30-Making+services+with+Liberator
15:55akurilinHm, let's say you're happy without Liberator?
15:56bitemyappakurilin: write a middleware or wrapper for your handler fns.
15:56bitemyappakurilin: I think Prismatic did something like this, not that it's open source.
15:57akurilinbitemyapp, okie dokie
15:57bitemyappakurilin: if it were me, I'd make my handlers multimethods. :)
15:57bitemyappbut I'm crazy.
15:57akurilinis the best way to use multimethods to avoid using multimethods, or is that macros only? :P
15:58bitemyappthat's just macros.
15:58bitemyappmultimethods are simpler than protocols.
15:58ucb<3 multimethods
15:59bitemyappucb: We can be friends.
15:59bitemyapptbaldridge: multimethods are awesome.
16:00tbaldridgebitemyapp: I prefer OOP personally, easier to write patterns with them. Have you tried writing GOF patterns with multimethods?
16:01tbaldridge</troll>
16:02bitemyapptbaldridge: I've put my behavior with my state and identity, and clearly I need to mash more behavior on top of the state and identity to fix my broken code.
16:02bitemyapplets inherit from a bunch of classes that have nothing to do with what I'm doing so my code can subtly break later.
16:03ucbeverybody likes a good inheritance
16:03ucbesp. from a rich uncle
16:04akurilinDo most people stick to underscores in file name in lein projects? I think you can get away with dashes for static resources, but it sounds reasonable to normalize everything to just one way of doing it
16:05gfredericksTimMc: https://github.com/fredericksgary/four
16:05akurilinHm I guess it doesn't matter too much for statics
16:08bitemyappakurilin: file names use underscores.
16:08bitemyappgfredericks: wait what
16:09bitemyappgfredericks: is this to work around the synchronized methods in java.util.Random?
16:10gfredericksno it doesn't use java.util.Random at all
16:10gfredericksat least none of that code does
16:11gfredericksit's a haskell-style stateless PRNG
16:11gfredericksit generates longs about as fast as rand-int generates integers
16:11bitemyappthat's my point -_-'
16:12bitemyappgfredericks: anyway, thanks for making that. How certain are you of the implementation?
16:12gfredericksoh but I mean the point is not performance
16:12gfredericksI'm 30% certain that I tried to mimic the java.util.Random code
16:13gfredericksit doesn't do what my JVM's Random does, but I don't know that my JVM's Random is the same as the java code I went off of
16:13gfredericksin any case, the point is immutability
16:14gfredericksand I haven't seen that in clojure yet
16:14bitemyappgfredericks: very cool. Thanks for making this :)
16:14bitemyappgfredericks: this could potentially solve some thread contention issues I've seen in the past.
16:14danlentzat the risk of belaboring the point, and not likely I think to be a popular idea, but wouldn't it be useful to have an earmuff-style naming convention for bindings (sorry vars) that represent shared state? i.e. <ref> or =atom= for example?
16:15gfredericksdanlentz: I don't hate the idea, but I think reference types are often called out by the use of @, deref, or the various mutating functions
16:15bitemyappdanlentz: if you write Clojure, you'll find out when and why things are the way are.
16:15gfredericksI would do it if ten other people did.
16:16bitemyappearmuffs are reserved for dynamic vars ;_;
16:16bitemyappthere's even warnings if you give a var earmuffs and it's not dynamic.
16:16danlentzor -local- for lexical bindings 'injected' via macros ("anaphoric" varyables in the terminology of paul grahamm)
16:16danlentzyes, earmuffs are
16:17danlentz*earmufs*
16:17bitemyappdanlentz: would it be a lot to ask that you just write some Clojure code?
16:17gfredericksdanlentz: I like &foo for anaphoric variables
16:18danlentzbitemyapp: not at all. If there's something specific you need me to write I'll take a look at it.
16:19bitemyappdanlentz: my point is that proposals are best informed by experience.
16:19bitemyappespecially if you can swing leaving the CL at the door.
16:23danlentzi'm really sorry there is some clear intolerance for my questions. It is not intended to cause this. I am simpley interested in, at minimum, learning more about the thought process that underlies closures conventions. I can clearly see what they are I am just exploring the degree of flexibility one might have in one's own practices without being at risk of bad stylee.
16:23bitemyappdanlentz: it's not, it's just that it's a better use of your time if you just learn Clojure
16:23bitemyappdanlentz: you can learn Clojure's conventions by writing Clojure.
16:24bitemyappdanlentz: and reading peoples' code.
16:24tbaldridgedanlentz: np, some people (including myself) just get snippy sometimes. That being said, I see the argument against this to be the same argument against hungarian notation. And in general the response is probably YAGNI
16:25bitemyappdanlentz: I'm with tbaldridge. YAGNI.
16:25danlentzand in the course of doing so it is unreasonable to develop questions related to subjects as intangible as naming conventions?
16:26bitemyappit's not productive when you're new.
16:26coventryThere are so many more challenging things to explore.
16:26bitemyappyou don't walk into a Kung Fu dojo for your first time ever and start making suggestions on their training protocol.
16:30danlentzi see. I will refrain from discussing the matter further and hope it hash not been overly disruptive to this forum.
16:32meliponehello! In which package can I find the signum function to get the sign of a number?
16:33hyPiRionMath
16:33llasrammelipone: ##(map #(Math/signum %) [-1 0 1])
16:33lazybotjava.lang.IllegalArgumentException: No matching method found: signum
16:33llasramheh
16:33hyPiRionjava.lang.Math, sir
16:33hyPiRionwell
16:34hyPiRion,(map #(Math/sign %) [-1.0 0.0 1.0])
16:34clojurebot#<CompilerException java.lang.IllegalArgumentException: No matching method: sign, compiling:(NO_SOURCE_PATH:0:0)>
16:34meliponeI have to import it?
16:34hyPiRion,(map #(Math/signum %) [-1.0 0.0 1.0])
16:34clojurebot(-1.0 0.0 1.0)
16:34hyPiRionOnly accept doubles.
16:34gfredericksusing my rand-long versus clojure.core/rand-int from 20 different threads at the same time is over 4 times faster
16:34llasramhyPiRion: No substitutes!
16:35llasramThe boxing must be preventing autoconversion
16:35llasramOr... something
16:35coventry,(map #(Long/signum %) [-1 0 1])
16:35clojurebot(-1 0 1)
16:35llasramWeird. I feel like I don't usually have that much trouble w/ Math static methods
16:36llasram(inc coventry)
16:36lazybot⇒ 1
16:39akurilinDo people generally avoid setting defaults for functions in the destructuring and opt to do that with (or) in an internal let form, or does that make no real differencer?
16:39akurilin*function params
16:40bitemyappakurilin: up to preference, I would assume.
16:40ucbakurilin: I normally set the defaults while restructuring; that way the nrepl completion thing shows me the default values without having to inspect the source
16:41bitemyappucb: that's a good reason.
16:41akurilinucb, as in, the nrepl completion thing looks at function params including the destructuring syntax?
16:42ucbakurilin: normally yes
16:42akurilinhmm I wonder if I get any of this in fireplace
16:42bbloom(inc destructuring)
16:42lazybot⇒ 1
16:42ucbheh
16:43akurilinMan I need to make a small wiki for all these questions because they must have been asked about x1000 before.
16:43nathanicakurilin: I believe you can get it in the shift-K docstring thing in fireplace, but not as-you-type in the status bar like in SLIMV
16:43bitemyapp(inc destructuring)
16:43lazybot⇒ 2
16:44bitemyappakurilin: a Clojure wiki is one of my to-do list projects :P
16:44rhg135hey ppl, i have a dynamically generated dom, is the ideal format a read only zipper whi feels like a hack?
16:44ucbsomebody please take away this keyboard from me
16:44ucbI just wrote this predicate to filter a collection of things: (comp not deref :valid)
16:45yeoj___Hi, I'm just getting started
16:45rhg135i mean in effect i'm passing a function that throws an exception as make-node arg
16:45akurilinbitemyapp, I'd like this to be kind of FAQ style, but it's also really hard to make that easily accessible for a very large amount of entries. Maybe simple fuzzy searching is good enough to find what you're looking for?
16:45akurilinbitemyapp, you're the elastic search dude here.
16:45ucbakurilin: are you going to host/run the service?
16:46yeoj___trying toget a better workflow, when i get a error such as "wrong number of args to persistent array map" on a reload form... how do i know what lines to look towards? I'm new to REPL based development.
16:46yeoj___(maybe it's a vim fireplace thing)
16:46akurilinucb, well yeah, I guess it'd have to be on github somewhere for hosting simplicity
16:46bitemyappakurilin: yeah I'd planned on using ES.
16:46ucbakurilin: I don't think GH has search for wikis?
16:46bitemyappakurilin: nah, I planned on writing the wiki in Clojure + ElasticSearch.
16:47akurilinwe'll have bitemyapp pony up 5 bucks/mo on a DO box
16:47bitemyappno github.
16:47bitemyappYep @ DO box, lol.
16:47coventryyeoj___: I generally (use 'clojure.repl) in the repl, and look at the traceback with (pst). The stack frames which refer to my code are probably where the error lies.
16:47akurilincompete with minecraft servers for CPU
16:47akurilin:P
16:47bitemyappakurilin: I think minecraft servers are usually on dedis.
16:48bitemyappor at least, they're s'posed to be.
16:48akurilinbitemyapp, is the perf/buck just not there in the cloud?
16:48bitemyappakurilin: not really, no.
16:48bitemyappI've tried to run MC servers on VPSes before. Ends in tears.
16:48akurilinI don't know if DO is "cloud" or "VPS", always confused about the difference.
16:48yeoj___coventry: ah, ok. so i just evaluated (pst) and i have some more interesting information. I'll study this more.
16:48yeoj___coventry: thanks for the tip.
16:48bitemyappakurilin: there's not a meaningful distinction between cloud and VPS unless you're thinking of amazon-style services like S3.
16:49bitemyappucb: I already know ES really well.
16:49bitemyappucb: and ES has search, is there a search plugin for cloudant?
16:49ucbbitemyapp: absolutely, that's why I suggested it :)
16:49ucbbitemyapp: but if you know ES very well, etc. might as well stick to that
16:50ucbbitemyapp: I was just suggesting so that you don't have to run the service, etc.
16:50bitemyappucb: it's not that big of a win though. I'm pretty close to writing my own ES client.
16:51coventryyeoj___: Once you have a hypothesis for which form is causing the error, wrap it or its constituents in clojure.tools.trace/trace. There's a brief tutorial on the usage of trace which I can't find at the moment, but which is worth going through.
16:51ucbwhat's the best way of testing a private fn?
16:51akurilinbitemyapp, do you store selmer templates inside or outside the .jar?
16:51bitemyappucb: hack the forcefield and test it.
16:52ucbbitemyapp: heh and how?
16:52bitemyappakurilin: ./resources/templates or ./src/ns/templates/
16:52akurilinbitemyapp, so you need to repackage the uberjar every time, yes?
16:52bitemyappucb: http://stackoverflow.com/questions/9113387/explanation-about-symbols-and-vars-and-their-differences-in-clojure
16:53bitemyappakurilin: yeah but I push the static assets like css/js/images separately.
16:53bitemyappinto a static directory that nginx fronts.
16:53akurilinbitemyapp, ah so you have a higher-priority location directive for those?
16:54akurilinbitemyapp, or I guess you just need a more specific location than what you're using to proxy the request
16:54ucbbitemyapp: naughty
16:54bitemyappucb: I'm all about naughty Clojure.
16:55bitemyappakurilin: nginx location directive.
16:55ucbINORITE
16:56akurilinbitemyapp, that's a good idea, I'll do that
16:56yeoj___coventry: awesome, thanks so much.
16:56yeoj___coventry: i'll try to find the tutorial. I have so much to learn...
16:56akurilinprobably no point in moving selmer templates outside of the project, they don't necessarily make much sense on their own
16:57bitemyappakurilin: right.
16:57bitemyappI feel like I should be charging consulting rates or extracting a labor-value in exchange for this.
16:58bitemyappucb: to speak to the general pattern, private is metadata on a var. Anything that wipes/forgets the metadata bypasses that.
16:59ucbbitemyapp: yeah, I now know that thanks to you and that SO post. Thanks!
16:59coventryyeoj___: Here it is: https://github.com/timvisher/what-does-tools-trace-do/blob/master/src/what_does_tools_trace_do/core.clj
17:00technomancydanlentz: FWIW I use http://marmalade-repo.org/packages/idle-highlight-mode to easily spot locals
17:01technomancythat's a good fit for local tooling that everyone can opt into on an individual basis
17:01seangrov`Oauth is always so unpleasant
17:02bitemyappseangrov`: I recently did a bunch of OAuth stuff in Python. I was considering writing a provider for Ring apps.
17:02bitemyappIt would end up being pretty similar to Bulwark really.
17:03bitemyappsame concept of passing fns to the middleware.
17:03seangrov`bitemyapp: I authenticate with google/gmail's oauth, but all the others I just need to go through the oauth dance to get their tokens so I can make api calls
17:03bitemyappso you need a client, not a provider.
17:03seangrov`Yeah
17:04seangrov`Looking through the libraries, trying to figure out how to get them to work, it hasn't been plesaant
17:04seangrov`Our rails app does a good job of it, but it's literally four sub-classes deep of specific integrations overriding methods, etc.
17:05seangrov`It'll feel good to get it into straight-forward clojure, but the start has been slow
17:08sandwichmakerseangrov`: do you just need to get to the point of calling the GoogleAPI for docs or something like that?
17:09bitemyappwisdom from nrepl --- You're bound to be unhappy if you optimize everything. -Donald Knuth
17:13technomancybitemyapp: dude, you haven't replaced the default nrepl connect messages yet?
17:14technomancybitemyapp: get on this level: http://p.hagelb.org/nrepl-words.el.html
17:15bitemyapptechnomancy: hahahaha. No not yet. I'm considering setting nrepl-words-of-inspiration to a dump of Zen quotes.
17:15technomancyI really don't like the defaults
17:15technomancythey're supposed to be actually inspirational
17:16technomancyat least they added back in "take this repl brother, may it serve you well"
17:16technomancyhm; I guess that's sexist
17:16bitemyappwhy did it get remov---oh.
17:16vmarcinkohi all. i have a case where i want objects of various types to get printed equaly if they contain my custom meta data. I succeded with print-emthod dispatch which works on :type metadata, but I need pprint to behave the same. How can i dispatch pprint printing to my custom printer that will recognize the object by that special meta-data stored. Is that possible for pprint?
17:16seangrov`sandwichmaker: More or less, but for quite a few services, and for lots of users, so the whole web flow needs to be there
17:16bitemyapptechnomancy: make it trotskyite and change brother to comrade.
17:17rasmusto"now when did you last let [your heart decide?]"
17:17seangrov`I like comrade, sounds good to me
17:17TEttinger##(repeatedly 2000 #(rand-nth [1 2 3 4 5 \space])) ;; anyone know why lazybots are still not able to use refheap?
17:17lazybot⇒ (4 2 \space 2 5 4 2 4 2 \space 5 4 5 3 5 1 3 3 4 5 3 5 2 \space 2 \space 3 \space 5 1 1 5 5 4 4 2 1 \space 2 5 \space 5 5 \space 1 3 \space 1 1 3 2 5 5 \space \space 2 1 \space 3 3 \space 2 4 \space \space \space \space 1 2 2 \space \space 2 4 5 5 5 \space 5 3 2 \space 4 \space 5 2 \space \space...
17:17technomancybitemyapp: not so much "adde back" as "made nrepl.el" match slime
17:18sandwichmakerseangrov`: I am still babbling in Clojure but I have code running reading spreadsheets cells from GoogleDocs in Clojure if you need a starting point
17:18technomancyrasmusto: IllegalArgumentException let requires an even number of forms in binding vector
17:18rasmustotechnomancy: ,(< 3)
17:18vmarcinkoin other words, is there some example of overriding default pprint behaviour for some objects (in my case dispatch should be based upon my meta data)?
17:19TEttingervmarcinko, I'm sure they all use .toString
17:19TEttingerhm maybe pprint doesn't
17:20amalloyTEttinger: lazybot does refheap overlong responses. i'm not sure why he didn't in this case
17:20seangrov`sandwichmaker: Yeah, that might be nice, would love to see how you setup the initial oauth authentication
17:20vmarcinkoquick googling doesn't give me some custom pprint dispatch example
17:20TEttingeramalloy, I know, I maintain a lazybot. I have a plugin that dumps quotes to refheap
17:20TEttingerright now it dumps ... instead of the refheap link
17:21amalloyask Raynes; maybe the refheap api has changed since the lazybot client was written?
17:21amalloyTEttinger: perhaps by "still" you meant "no longer"? your original question was confusing
17:22RaynesHm.
17:22TEttingeramalloy, it still doesn't work because it didn't last night
17:22RaynesThat's certainly strange.
17:22TEttingerindeed, Raynes!
17:22Raynesbitemyapp and some others were having issues with refheap last night so I restarted the server.
17:22TEttingerI kinda thought once the 500 errors stoppped it would be fixed
17:23TEttingerwant me to restart my lazybot?
17:23RaynesOh dear, looks like there are some mongo-related issues.
17:23RaynesNo, this is a refheap issue.
17:23TEttingerclojure needs its own database, rich should get on that :P
17:24tbaldridgeTEttinger: he did, it's call datomic.
17:24seangrov`snap
17:24TEttingertbaldridge, hence the :P
17:24tbaldridgeah
17:25rasmusto,:P
17:25clojurebot:P
17:25seangrov`hah
17:27TEttinger,(let [ಠ_ರೃ #(println "Oh my.")] (ಠ_ರೃ))
17:27clojurebotOh my.\n
17:28seangrov`Gotta love the range of valid var names
17:29ro_stanyone used cemerick/austin ?
17:31bitemyappro_st: tons o' people.
17:31ro_sta brepl is certainly not the same as a jvm repl
17:31ro_stit's pretty good though. it's in that uncanny valley area
17:32akurilinSomeone mentioned that there's middleware out there that will guess content type based on the ring response type + whether mime type is set already. Is that correct? If not I'll just write one.
17:33TEttingerRaynes, it's back
17:33TEttinger,(clojure.string/join " "(repeatedly 200(fn [](apply str(concat [(rand-nth ["rh""s""z""t""k""ch""n""th""m""p""b""l""g""phth"])](take(+ 2(* 2(rand-int 2)))(interleave(repeatedly #(rand-nth ["a""a""o""e""i""o""au""oi""ou""eo"]))(repeatedly #(rand-nth ["s""p""t""ch""n""m""b""g""st""rst""rt""sp""rk""f""x""sh""ng"]))))[(rand-nth ["os""is""us""um""eum""ium""iam""us""um""es""anes""eros""or""ophon""on""otron"])])))))
17:33clojurebot"nangum rhishus neomanes bobotron chasinos zertesanes thiberos morstus benameros letes gisaurtus chauxophon tosus teomor mourstepon kaurkus pourstos serkus zeomertes noporkium rhasteros koisharstiam loistipium kastus laxeoshis lipaustotron sanorkium phtherkus kirtipos saurtanes goses sonobus rhortimum pemauxos gemum noniam nesaungus zomaungor rharkeongus noinon rhougophon gasengiam beomarkiam posp...
17:33TEttingernope
17:33TEttingerthat was clojurebot...
17:33mtpwhoa
17:33mtpthat's awesome
17:33ro_stbitemyapp: have you used it?
17:33TEttinger##(clojure.string/join " "(repeatedly 200(fn [](apply str(concat [(rand-nth ["rh""s""z""t""k""ch""n""th""m""p""b""l""g""phth"])](take(+ 2(* 2(rand-int 2)))(interleave(repeatedly #(rand-nth ["a""a""o""e""i""o""au""oi""ou""eo"]))(repeatedly #(rand-nth ["s""p""t""ch""n""m""b""g""st""rst""rt""sp""rk""f""x""sh""ng"]))))[(rand-nth ["os""is""us""um""eum""ium""iam""us""um""es""anes""eros""or""ophon""on""otron"])])))))
17:33lazybot⇒ "thigixeum nospostes moubus baurstor techon zogoingum thateum lengeros rhourkobotron zanefeum sorkobiam bishausperos thasheosus narkoupus mostoirkeum pongopophon kaushatum netum lougon phthoibeocheros phthoufus phthipoiseum tartos phtheostium nimos nospeofor taurtoph... https://www.refheap.com/19371
17:34TEttingerrefheap is back it seems
17:34RaynesTEttinger: amalloy and I just fixed it.
17:34TEttingerthanks
17:34RaynesIt was weird mongodb crap.
17:34ro_sti seem to have come right
17:34Raynes4Clojure is down at the moment though. He's working on bringing that back up now.
17:34llasramTEttinger: creating a botnet w/ DGA-based C&C?
17:35TEttingerdon't know what those are!
17:35llasramNice cover
17:35llasramNiiice cover
17:35TEttingerI only have one bot, plus another one that calls the other one, plus another one that outputs multiple lines per message
17:35TEttingerso maybe
17:36sandwichmakerseangrov`: It is a quick cut&paste of partial code, so there maybe non-relevant imports or dependencies for an example case and even simpler ways to do it (this was my first encounter with OAuth), it was a lot of documents open with partial information that I was trying to understand, hope it helps a little: https://gist.github.com/andresvalenciano/6817014
17:39seangrov`sandwichmaker: Got it, thank you very much
17:40yeoj___if i change my :dependencies in my project.clj does that warrent a repl restart? Is there any quicker way to do it?
17:41llasramyeoj___: https://github.com/pallet/alembic
17:42yeoj___llasram: thanks
17:50bbloom:-( http://www.nist.gov/dads/?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+jesse-lifestream+(Jesse+Ruffin's+LifeStream)
17:50bbloomanyone got a mirror of the Dictionary of Algorithms and Data Structures ?
17:51bbloomi guess this is the real URL: http://www.nist.gov/dads/
17:53RaynesTEttinger: Refheap is down purposely at the moment./
17:53xeqiRaynes: :(
17:56TEttingerbbloom: http://web.archive.org/web/20130922223431/http://xlinux.nist.gov/dads//
17:56bbloomthanks!
17:56seangrov`DerGuteMoritz: Is clj-oauth2 still supported/alive?
17:57rasmustobbloom: looks like its here permanently? http://fastar.org/dads/
17:58DerGuteMoritzseangrov`: not quite, I'm back in Scheme land right now
17:58seangrov`DerGuteMoritz: Do you recommend I avoid it?
17:59DerGuteMoritzseangrov`: it was also the first thing I ever did in Clojure so it's not the most idiomatic code in the world :-)
17:59DerGuteMoritzseangrov`: dunno, it should work at least with Facebook's flavor of oauth2
17:59seangrov`Looks like there isn't really a general oauth1.0a/2.0 client in clojure then
17:59DerGuteMoritzOAuth 2.0 is way too fuzzy to implement in a general fashion
17:59seangrov`DerGuteMoritz: Thanks for being straightforward about it, very much appreciate it
18:00DerGuteMoritzand there are way too many drafts implemented in the wild
18:00DerGuteMoritzseangrov`: no prob!
18:00seangrov`DerGuteMoritz: Yeah, we've integrated with ~15 or so
18:00DerGuteMoritzit's crazy
18:00seangrov`But all in ruby land, not clojure yet
18:01DerGuteMoritzwow, not bad
18:01jjidoah, is that why I couldn't wrap my head around it
18:01DerGuteMoritzI bet it's not pretty
18:01seangrov`DerGuteMoritz: Not even slightly.
18:01DerGuteMoritzheh
18:02DerGuteMoritzseangrov`: your nick rings a bell, did we meet in #chicken before?
18:02seangrov`DerGuteMoritz: Yeah, I wrote the opengl wrapper/engine-ish thing a few years back
18:02DerGuteMoritzah right!
18:04DerGuteMoritzfrom OpenGL to OAuth 2.0
18:04seangrov`Yeah, neither are very pretty, thinking about it
18:04DerGuteMoritzheh, gotta avoid things with an O
18:04seangrov`Haha, that could be the lesson here, possibly
18:05seangrov`Are you working on production stuff with Chicken?
18:05DerGuteMoritzOracle, OOP, Ostriches
18:05DerGuteMoritzyeah
18:05DerGuteMoritzwe're using it on mobile platforms
18:06seangrov`DerGuteMoritz: Natively? That was originally my goal with Chicken, actually
18:06DerGuteMoritzthat way we can use the same business and network protocol logic on both Android and iOS
18:07DerGuteMoritzyep, natively
18:07seangrov`Impressive!
18:07DerGuteMoritzwe actually hired Felix Winkelmann :-)
18:08DerGuteMoritzit's pretty cool indeed
18:08jjidodoes it compile to C?
18:08DerGuteMoritzwe'll release the toolchain we built when we're done with the project
18:08DerGuteMoritzjjido: yes
18:08DerGuteMoritzbut it also has an interpreter
18:09DerGuteMoritzso we can have a repl on the device, too
18:09DerGuteMoritzremote repl, that is
18:10jjidoyou mean the server commands the device?
18:10DerGuteMoritzno I mean we can connect a repl to the app in development while it is running on the device and change sthings on the fly
18:11jjidoisn't that the same? Only you limit it to dev time
18:11seangrov`jjido: Kind of, but sounds like the intent is a little bit different
18:12DerGuteMoritzoh yeah I thought by "server" you implied automated remote control or something
18:12seangrov`More like using slime to update code from the repl and explore the state interactively
18:12DerGuteMoritzright, what seangrov` says
18:13jjidoDerGuteMoritz: ok
18:13DerGuteMoritzseangrov`: will you be at EuroClojure?
18:14technomancyDerGuteMoritz: what size distributables can you get down to?
18:14DerGuteMoritztechnomancy: depends on what you link in, of course
18:14technomancysure, but what's the minimum chicken overhead?
18:14mtpit's lower with eggbeaters!
18:15DerGuteMoritztechnomancy: we haven't expored the limits, yet. I guess you can get down to about 3M
18:16technomancycool
18:16DerGuteMoritzbut for production you could also kick out the interpreter and stuff
18:16seangrov`DerGuteMoritz: Nah, just got back from Europe, went for JSconf
18:16DerGuteMoritzseangrov`: ah too bad, could have met up then :-)
18:16seangrov`Won't be doing that again... definitely EuroClojure next time, it looks much, much better
18:16seangrov`Ah, you're in Berlin?
18:17DerGuteMoritzno, but in Germany
18:17DerGuteMoritzand I will be at EuroClojure, yeah
18:17seangrov`Next year then :)
18:18DerGuteMoritzcool!
18:18DerGuteMoritzwhere was jsconf?
18:18seangrov`Berlin
18:20DerGuteMoritzof course, of course
18:34RaynesRefheap is back now. We had some pretty big mongodb issues (these things run on a 32 bit system, and it appears we outgrew our single mongodb instance which serviced both refheap and 4clojure). Please let me know if refheap misbehaves. <- bitemyapp TEttinger.
18:34seangrov`Thanks Raynes
18:45Apage43ugh databases
18:46bitemyappApage43: 'tis yer jerb :P
18:51tbaldridgeRaynes: I always loved that aspect of mongo. It runs great if you run it on the right hardware and with the right config. If not...well then screw you.
18:52RaynesI have no complaints about mongo int his case.
18:52nooniantbaldridge: lol, I'm pretty sure I'm dealing with the latter scenario
18:52Raynesint his*
18:52Raynes...
18:52`cbpmongo on 32 bit is silly
18:52Raynesin this*
18:52ruzuyou wouldn't respect it if it were so easy
18:52RaynesThe problem is that we've got a 32 bit machine that we don't really have time to upgrade to 64 bit.
18:52TEttingerthanks Raynes
18:53RaynesWe have so much stuff running on this machine that I'd frankly rather hop in front of a moving bus than deal with migrating it all.
18:53Raynes:P
18:55arrdemRaynes: HAH I WAS RIGHT
18:55RaynesWell, Kyle Kingsbury is right. Databases suck.
19:01devnha
19:03bitemyappucb: your company is hosting Seajure tonight :)
19:04ucbbitemyapp: yeah, I think that's a regular thing? maybe?
19:04ucbshame I'm not there
19:04bitemyappucb: I'm not in Seattle, wouldn't know. Going to the SF meetup tonight.
19:04ucbcool
19:06ucbI might go to the FOREVER ALONE one tonight
19:07technomancyucb: it's here every other month
19:07ucbtechnomancy: :)
19:08chareI hate you all so much
19:09`cbpmake <3 not starcraft
19:09charehttp://www.arcsynthesis.org/gltut/Basics/Tutorial%2002.html
19:09chareI am reading that
19:09arrdem(inc `cbp)
19:09lazybot⇒ 1
19:09chareyou can't stop me
19:11charewhat projects are you working on `cbp
19:11`cbpneed to know only
19:12mtpoh did chord come back
19:12charei'm not chord
19:12arrdemmtp: yep he did
19:12mtpi can tell because someone visible on my screen is talking about starcraft
19:12charemtp I started reading http://www.arcsynthesis.org/gltut/Basics/Tutorial%2002.html
19:12chareso i'm not dedicated to only starcraft
19:13charetherefore i'm not chord
19:13mtpso how about that government shutdown
19:13arrdemmtp: the part where murder is legal now?
19:14charehow do we stop asshole nsa
19:14TEttingerpretty sure hank won't be able to catch heisenberg now, since the DEA is shut down
19:14mtpidk, i hear they're still operating well enough to arrest people and start federal criminal proceedings
19:15nDuffmtp: http://www.popehat.com/2013/10/01/tales-from-another-shutdown/ may be of interest to you (day in the life of a federal prosecution during the last shutdown)
19:15nDuffs/prosecution/prosecutor/
19:15mtpnDuff thanks
19:22wakeup`ok guys
19:22charewho here is super cool
19:22wakeup`I have tested it: java.jdbc/execute! is NOT thread safe.
19:23tbaldridgewakeup`: how so?
19:24wakeup`tbaldridge: Threw a lot of concurrent execute!'s at the same
19:24wakeup`database and it threw "database locked"" exceptions.
19:24technomancywakeup`: probably depends on the underlying DB driver
19:24tbaldridgethat's a DB or SQL driver issue, java.jdbc
19:24tbaldridge*not java.jdbc
19:25tbaldridgeSQL servers are full of locks throw too much at it and that sort of stuff happens.
19:26charedon't use mysql
19:26chareuse postgresql
19:26wakeup`I use a lock to make it thread-safe ;)
19:26chareproblem solved
19:26wakeup`I am using sqlite :D
19:26technomancysqlite's jdbc adapter is junk =\
19:26wakeup`it is
19:27wakeup`but it seems to work
19:27wakeup`I only ran into debugging difficulties because it caused segfaults on bad usage
19:27wakeup`pretty good start in the day when your jvm segfaults.
19:29charewhy would you be using sqlite
19:29wakeup`I don't decide those things
19:29wakeup`I just implement
19:29seangrov`Damnit, I killed by *nrepl* buffer on accident - can I get it back without re-running nrepl-jack-in?
19:30technomancyseangrov`: M-x nrepl
19:30technomancyyou can find the port in target/repl-port
19:30wakeup`chare: why do you think I am programming clojure?
19:30wakeup`;)
19:30charegirlfriend cheated on you is that why?
19:31wakeup`(I am unfamiliar with clojure, that's all guys)
19:31bitemyappwakeup`: chare is a troll, ignore him.
19:31bitemyapptechnomancy: ahem ^^
19:32seangrov`technomancy: I have to agree with bitemyapp
19:32technomancychare: I don't want to mute you again; maybe you could give me a reason not to?
19:32mtphe isn't even a particularly good troll
19:32chareunmute my original account like i asked
19:33mtpshut up
19:33seangrov`technomancy: That worked, thank you!
19:33mtpthat's not how you get unbanned
19:33wakeup`oh lol
19:33seangrov`Didn't know about the target/repl-port
19:33technomancychare: I don't understand; why would I do that?
19:33wakeup`I thought I was framed as a troll again
19:33mtptechnomancy he asked so obviously you have to do it
19:33seangrov`(inc technomancy)
19:33lazybot⇒ 81
19:34AimHereIf you unmute his other nick, then you won't have to unmute this one. Bargain!
19:34AimHereNo wait, other thing
19:34mtpi say we unmute his other nick and set a /different/ mode
19:34mtpbut i'm not a good enough troll to have gotten ops yet
19:35wakeup`you just gotta be locked into renegade radio right now
19:36wakeup`icide in the mix
19:38charelets talk about making a clojure project together
19:38wakeup`chare: how much do you pay?
19:39@technomancyno funny business
19:40seangrov`hahaha
19:40chareno mute me please
19:40mtplet's all rewrite clojure in python
19:40mtpand then port the stack to luajit
19:40@technomancydon't say anything stupid and I won't have to
19:41wakeup`chare: may I suggest you a really good OT irc channel?
19:41ruzu[18:08] <mtp> also, i like pie
19:42mtpruzu that is a false allegation
19:42mtpi prefer scones
19:46charequestion what does glGenVertexArrays do in this program: https://bitbucket.org/alfonse/gltut/src/1d1479cc7027f1e32c5adff748f3b296f1931d84/Tut%2001%20Hello%20Triangle/tut1.cpp?at=default
19:47bitemyappSF meetup got canceled :(
19:48bitemyappWas anybody here planning on going?
20:18logic_progdnolen: is core.logic basically an optimization of http://www.cs.trincoll.edu/~ram/cpsc352/notes/unification.html ? What is there to core.logic besids unification?
20:24Raynesbitemyapp: Did nvd3 end up helping you guys?
20:31charehow do I explain to people the big difference between lisp, scheme, clojure, racket, etc...
20:32bbloomyou mean like how do you convince people that they aren't all just the same language with a lot of parentehsis?
20:32bbloom"if scheme and common lisp are the same language, then so are C and javascript"
20:37charebbloom: what exactly are the critical differences between lisp, scheme, clojure, racket
20:40bbloomchare: that's a big question
20:40bbloomchare: http://c2.com/cgi/wiki?LispSchemeDifferences
20:41bbloomhttp://clojure.org/rationale
20:41bbloomthat should get you started
21:01hiredmanI think you read that wrong
21:01seangrov`hiredman: Oh, sure, but I was wondering if I could make it work
21:02hiredman"if (two very different languages like) scheme and common lisp are the same language, then so are (two other very different languages) C and javascript"
21:03hiredmanI would say c and js are very different at every level, where scheme and cl are very similar on a number of levels
21:03hiredmanso I doubt you can make that work
21:04hyPiRionWell, C and Javacript have quite different paradigms compared to scheme and cl
21:04hiredmanthe main thing c and js have in common are curly braces
21:04hyPiRionand their lack of namespaces
21:05hiredmanthose must be the two features a language requires to become ubiquitous
21:06coventrybrainfuck is fairly ubiquitous, I guess.
21:07hyPiRionSwearjure too
21:19frozenlockCould someone explain to me what I'm doing wrong here? ....
21:19frozenlock(try (/ 1 0) (catch Exception e (str e))) ----> catch the exception
21:19frozenlock(try (throw (Exception. "some funny exception") (catch Exception e (str e)))) ----> doesn't catch it
21:19frozenlockErrrr
21:19frozenlocknvm
21:20`cbp:-)
21:23charehello
21:24rhg135goodbye
21:46bitemyappRaynes: gf3 could answer better than I, I think we were too frustrated and harried to use nvd3 properly. Might be able to better appreciate it with the luxury of having more than ~48 hours to go through things.
22:37chare_I am back
22:49muhooi am front
23:15frozenlockIs there a way to use a field method on the result of (.getField some-class "some-field") ?
23:16frozenlockFor example, (.toString some-class/some-field)
23:20`cbpfrozenlock: is that not working for you? :P
23:21`cbp,(.toString Boolean/TRUE)
23:21clojurebot"true"
23:21`cbpIm not sure what you're asking :P
23:22frozenlockOk, so if I do the .getField, I get somehting like this in my REPL: #<Field public static final ....
23:22frozenlockBut if I type some-class/some-field, I get.. well, the field :p
23:23chare_`cbp work on starcraft clone game please
23:24frozenlock,(.getField Boolean "TRUE")
23:24clojurebot#<Field public static final java.lang.Boolean java.lang.Boolean.TRUE>
23:24frozenlock,Boolean/true
23:24clojurebot#<CompilerException java.lang.RuntimeException: Unable to find static field: true in class java.lang.Boolean, compiling:(NO_SOURCE_PATH:0:0)>
23:24frozenlock,Boolean/TRUE
23:24clojurebottrue
23:25`cbpfrozenlock: that's because getField returns a Field object
23:25`cbphttp://docs.oracle.com/javase/1.4.2/docs/api/java/lang/Class.html#getField(java.lang.String)
23:26xeqi,(.get (.getField Boolean "TRUE") Boolean)
23:26clojurebottrue
23:26frozenlockOh
23:26frozenlockLet me try that...
23:27frozenlockWell, sonofabitch :p
23:27frozenlockIt works! Thanks :D
23:41dobry-denHow can you export a ClojureScript function so that you just call it by its function name in the browser?
23:41dobry-denhello() instead of myns.hello()
23:43amalloyxeqi: also ##(.get (.getField Boolean "TRUE") nil)
23:43lazybotjava.lang.SecurityException: You tripped the alarm! clojail.testers.ClojailWrapper@17f0667 is bad!
23:43amalloywhut
23:43amalloyreflection, i guess? yeah, lazybot disallows that, but the error message kinda sucks
23:43amalloy,(.get (.getField Boolean "TRUE") nil)
23:43clojurebottrue
23:44mullrdorby-den: can you do something like (set! (.-hello window) myns.hello) ?
23:45mullryou might need to add myns.hello to a list of exports so it doesn't get mangled / removed by the closure optimizer
23:46frozenlockamalloy: I'm confused by 'nil'... aren't we trying to get a field from nil in this case?
23:46amalloyfrozenlock: a static field
23:47amalloyit doesn't live on an object, it lives in the class
23:47amalloyso there's no instance needed for the .get, once you have the handle already
23:48frozenlockInteresting. Is the .get still the most economical way to get it?
23:48xeqi"economical" ?
23:48frozenlockwell, the simpliest
23:49frozenlocksimplest
23:49amalloyi mean, obviously not, (Boolean/TRUE) is
23:50frozenlockErr, yeah, but once you have the field using getField :p
23:55ddellacostadobry-den: you use export, like (defn ^:export my-fn [] …) then you call it like name.space.my_fn()
23:56ddellacostadobry-den: oh sorry, you were asking without namespace? It's not possible I don't think, although I guess you could attach it to the window like mullr suggests…but I don't think it needs to be in exports does it?
23:58ddellacostaif it is set as a property on the window then will it still get mangled by the clojure compiler? Guess it's something to test