#clojure logs

2013-05-28

01:18expti have a set of lines, read from a file, where some lines are parents (with an id) and other lines are children (with no ids)
01:18callenamalloy: ping
01:18expthow would i, on a line-by-line basis update the children to have the id of the parent.
01:19exptimperatively, this would be pretty easy, but I am looking for an idiomatic way in clojure to handle this
01:19callenamalloy: if I've got a thread-scoped global var wrapped in an atom getting reset by a ring middleware, would that stop functioning properly outside of a thread per request model? (Netty/Aleph vs. Jetty)
01:19callenexpt: assoc the id to be whatever the id of the parent is?
01:20callenexpt: oh wait, this is a file?
01:20exptyes
01:20expt@callen
01:20callenexpt: can you describe the format at all? are we talking tab delimited?
01:20callenexpt: how do you know what a child's parent is?
01:20callenare they consecutive?
01:21exptcallen: it is a mvel file, for a drools engine, that I am parsing. the first description line has the rule and an id associated with it
01:21amalloycallen: i don't understand the structure, but "thread-scoped...outside thread per request" sounds bad
01:21brehaut,(let [ps (partition-by :id [{:id 1 :t "a"} {:t "b"} {:t "c"} {:id 2 :t "d"} {:id 3 :t "e"}])] (map (fn [parent, children] [parent, children]) ps (rest ps)))
01:21clojurebot([({:t "a", :id 1}) ({:t "b"} {:t "c"})] [({:t "b"} {:t "c"}) ({:t "d", :id 2})] [({:t "d", :id 2}) ({:t "e", :id 3})])
01:21brehaut+ errors when the first record does not include an id, and no actual stitching included
01:21exptand the following lines, belong to the body.
01:22callenamalloy: it works fine, I'll keep running naked.
01:24hiredmanif only there was a sweet reducers partition-by for doing reducers based io with...
01:26exptcallen: it is essentially like a function block in java, but instead of a function declaration and name, it has a 'rule' statement and an id. the rest of the lines are essentially a scope, opened and closed by braces. since the first line is the rule, I can easly get the id, and pass that value to the subsequent lines.
01:27exptcallen: hopefully without some type of outside variable i would need to reset on every group, though it would be a solution.
01:28exptcallen: i have structured each line as a map, with a ordinal, key, id, and string.
01:28callenexpt: is this some adhoc file format? :\ My approach, based on a limited understanding of the specifics, would be to parse each row into a map representation with a references between the children and parents.
01:28callenokay, yes, uhm. That.
01:28callennow assoc the ids from the parents into the children.
01:28callendirect object references would be more efficient than keys that you have to scan for.
01:29exptcallen: so you are advocating a tree stucture then for each rule? am i understanding that correctly? or at the very least, a list associated to the parent?
01:30callenexpt: closer to the latter, don't take anything I say too seriously, I'm working off a limited understanding of the format.
01:30callenbut yeah, the closer your work is to just assoc/dissoc'ing maps the happier you'll be.
01:31exptcallen: okay, thanks for the tip on that
01:31callenexpt: I've only used mvel with a search engine, I've avoided drools at all costs.
01:31exptcallen: alright, i will take look at it from that perspective.
01:32exptcallen: @drools... yeah, well, that is why this project came about, as the client wanted to get rid of the engine, but have several thousand rules they need parsed.
01:32callenexpt: solid. Good luck.
01:33exptcallen: at any rate, thanks for the alternate perspective
01:33callenexpt: if I had coffee available to me and a refheap of the format I could be more useful.
01:33callenYou can help with the latter, the former is up to me.
01:33callenbut the coffee is seriously critical.
01:33exptcallen: haha, if you were around, i would buy you the coffee ;)
01:35exptcallen: thanks, I will see what I can work up that is not confidential, and ping you back perhaps if your previous idea stymies me, but I do appreciate the perspective, it already seems to be a better take than a flat line, re-association approach.
01:35exptcallen: thanks
01:36frankenBitsHi Clojurians
01:36frankenBitsAny clojurescript guru in the room?
01:38brehaut~anyone
01:38exptfrankenBits: yes, there are. i don't claim it (guru status), but if you ask the question, someone will respond, generally
01:38clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
01:38callenexpt: cheers.
01:38exptcallen: right back at you. thanks.
01:38frankenBitsthanks expt, i think the question i have is pretty basic..
01:39frankenBitsrunning clojurescript for the first time off my machine
01:39frankenBits(dotimes [x 10]
01:39frankenBits (.write js/document (str
01:39callenfrankenBits: IRC is a little more asynchronous. and a bit like fishing.
01:39frankenBits "<p>Hello, world! For the "
01:39frankenBits (+ x 1)
01:39frankenBits " time!</p>")))
01:39callenfrankenBits: use refheap to post code please, don't paste into the channel.
01:39callenfrankenBits: and when asking question, just you know, toss stuff out there and see who bites.
01:39callenquestions*. Don't need to ask to ask, ya know?
01:39frankenBitsgotcha
01:39calleneither somebody is around or they ain't. :)
01:40frankenBitshaha rite :) newbie to irc as well
01:40frankenBitsone sec let me get this posted so it makes more sense
01:40exptwell, frankenBits, welcome to clojure, AND irc
01:41frankenBitsthanks Clojure opening new doors ;)
01:42callenfrankenBits: https://www.refheap.com/
01:46frankenBitsHere is the writeup
01:46frankenBitshttps://www.refheap.com/15084
01:47frankenBitsalmost seems like a bug in clojurescript
01:48brehaut,((fn [& r] (prn r)) 1 "two" :three)
01:48clojurebot(1 "two" :three)\n
01:49brehautyou are collecting the variadic arguments as a seq, and then passing that seq to the .write method.
01:50brehautif .write were a funciton i would say you should be applying it, but i dont know how that translates to clojurescript method stuff
01:50brehautand javascripts Function.prototype.apply shenanigans
01:52frankenBitshmm…i see what you are saying
01:52frankenBitsso if i do something like (str input)
01:52frankenBitswould that do the trick?
01:52brehautyeah it will
01:54brehautso, (.apply (.-log js/console) js/console (array 1 2 3))
01:55brehautthat is an ugly way to get a method and apply it
01:55brehauti presume there is a smarter way somewhere in the lib
01:55brehaut(it needs an array, not a collection too)
01:56frankenBitseven wrapping it in (str ) doesn't work
01:56brehaut,(str "a" 1 "two")
01:56clojurebot"a1two"
01:56brehautoh, you want (apply str input)
01:56brehautagain, because you want to pass the sequence as variadic arguments, not as a collection
01:57frankenBitsahh!
01:57brehautbtw, writeBody, and camelCase in general is poor style in a lisp. it should be write-body
01:57frankenBitsThanks for the tip
01:58frankenBitsnewish to lisp..did my own emacs lisp hacking but never followed conventions per say..good to know
01:59callenfrankenBits: per se
01:59callenfrankenBits: latin for, "in itself"
01:59brehauthttp://mumble.net/~campbell/scheme/style.txt is a good style guide
01:59callenor "through itself"
02:00callenfrankenBits: it's a way of isolating a subject or disconnecting it with the typically attendant qualifiers.
02:00callen"I was a banker per se, but not a wall street fat cat."
02:00frankenBitsbrehaut u rock! it worked
02:01frankenBitscalled, thnx, it's late here in the states..late night grammar isn't great
02:01frankenBitscallen*
02:01frankenBitsmy late night grammar isn't great*
02:03callenfrankenBits: it's late here too (LA)
02:03callendsantiago: I'm in LA now btw.
02:03callenamalloy: I draw near! Bwahahahaha
02:04frankenBitsHow are you awake…I'm in Chicago and its 1am here
02:04amalloyi know. Raynes was so excited to have you in his apartment i had to avert my eyes
02:05stirfooI wonder how much scheme r. hickey has written. He adopted ? for predicates instead of -p.
02:05callenThis is Raynes on callen's laptop. Weee
02:10callenfrankenBits: it's 2302 atm. I'm currently deciding if I want to try to do anything else tonight or not :P
02:10callenfrankenBits: I'm usually up late. Like 2 or 3.
02:10callenamalloy: I walked down the pier. Really cool *_*
02:10amalloy2302?! i overslept by two centuries!
02:11amalloythree, i guess
02:11amalloywhatever, math
02:11callenamalloy: ahoy rip van winkle
02:15frankenBitscallen: nice i stay up late sometimes..can't do it as often anymore not thattt young anymore haha
02:15frankenBitssirfoo can you elaborate? on -p?
02:16stirfoofrankenBits: common lisp's way to denote a predicate
02:18frankenBitsstirfoo: interesting i've been reading on lisp by paul graham, common lisp looks interesting..a little cumbersome compared to clojure syntax at least that's
02:18frankenBitshow it feels going from Clojure to CL
02:19frankenBitsis the predicate system more robust in CL?
02:20stirfooon lisp is a great book, but a lot of it would be difficult to transpose to clojure becuase of the immutability inherant in the language. (I've tried a few things). You really have to change the way you think with clojure.
02:20stirfoofrankenBits: it's just a '?' suffix vs a '-p' suffix, nothing more
02:23frankenBitsi definitely agree, it's a mixed bag because of CL mutability. I read good things about on lisp's approach to teaching macro's
02:23frankenBitshaven't gotten to that point yet
02:23frankenBitsprimarily reading it for that
02:24frankenBitsWho says LISP has bad marketing? I bit Paul Graham's marketing pitch on lisp
02:24stirfoofrankenBits: come to think of it, I learned more about cl macros from that book than anywhere else =)
02:26frankenBits:D awesome, that's the killer feature i need to really learn. I've read the Clojure macro tutorials felt a little lacking
02:27stirfooI have cl the language, 2nd edition around here some where. I wore the pages out on that one but it's been a couple of years since I wrote any cl. clojure is just too much fun.
02:29frankenBitsstirfoo: did you have a day job doing CL?
02:29stirfoofrankenBits: no, I'm a stricly-for-fun programmer
02:30stirfoowriting code is like trying to solve a puzzle with a gazillion solutions =)
02:31frankenBitsstirfoo: agreed coding is too much fun, i learned so much about a variety of fields just by studying programming out my own interest
02:31frankenBitssometimes it feels like I'm debugging in real life like i would in a program
03:09lynaghkI need a queue (with multiple consumers) containing the topologically ordered vertexes of a (changing) graph
03:09lynaghkany suggestions on how to implement? I have the topological sorting already worked out, but I'm not sure the best way to setup a queue
03:10tomjackyou mean it's like a mutable priority queue where priority is determined topologically, and you enqueue a node every time it changes?
03:10lynaghkI considered throwing a java.util.concurrent queue behind an atom, but that just seems gnarly.
03:11lynaghktomjack: not every time it changes. Say I have two worker threads pulling things off the queue and a third thread that sometimes adds new nodes/edges to the graph (and thus needs to add things and sort the entire queue)
03:12tomjack'things' == nodes?
03:12tomjackvertexes
03:12lynaghktomjack: yeah
03:12tomjackhow do the edges fit in
03:12tomjackoh
03:13lynaghkto determine the sorting order
03:13tomjackright
03:13lynaghkI did look at the java.util.concurrent priority queue (which accepts a comparator), but I don't think that will work because the docs didn't mention that it would resort entirely on each add to the queue.
03:14tomjackcan you add a node already in the graph to the queue?
03:15tomjackor 'each add' is a new node being added to both graph and queue?
03:15lynaghkI can add an existing node to the back of the queue
03:15lynaghkthe use case is a build process where during the build a target may specify additional dependencies
03:16lynaghkin which case the current build is killed (since the new deps haven't been built yet), the deps are added to graph, and the work queue needs to atomically become the topological sort of the graph.
03:17lynaghkthe new graph, that is.
03:18tomjackdo you really need j.u.c or a mutable queue?
03:18lynaghktomjack: I'm open to other options. I need something that can be consumed by multiple threads
03:20tomjackif the current build is killed, why do you care about an existing queue?
03:20tomjackI mean, you kill the current build but then you want to only redo what didn't already get done last time?
03:21tomjackif you start over from scratch I don't see why you'd need a mutable queue that atomically changes sort order - just restart the whole process from the new graph
03:21lynaghkthe queue has, say, [A B C]. In building A we discover that it depends on D E, so we kill the build for A and the queue should now be [B C D E A]
03:23tomjackI see, just kill the target whose deps changed?
03:23lynaghktomjack: yeah
03:25tomjackinteresting problem :)
03:25tomjacka priority-like queue is not quite right, right?
03:26tomjackI mean say [A B C] and B depends on A
03:26tomjackif some worker pops off A and the queue is [B C], B cannot be popped
03:26tomjackuntil A is done. yes?
03:26lynaghktomjack: I'm not sure about the formal definition of a priority queue, but the implementation in java.util.concurrent won't work because the comparator can change.
03:27tomjackassume for simplicity the topology is fixed
03:27lynaghktomjack: yes, but if that were the case then the sort would have been [C A B]
03:28yunfananyone could give me an example of using sqlkorma doing (-> create-db build-tables insert-records selecting-stuff ... )
03:28tomjackthen C is popped, A, and now the queue is [B], how does a worker know that they need to wait for A to do B?
03:29yunfanam i in the blacklist?
03:29tomjacka queue doesn't care about completion
03:29lynaghktomjack: good point. I haven't considered that case yet.
03:30lynaghktomjack: I will need to add per-target locking in any case, so here the worker will look at the graph, see that B depends on A and that someone is already working on A, so he'll go to the next item.
03:31tomjackouch
03:31lynaghker, it. I need to stop anthromorphising threads
03:34mthvedtdoes discovery of dependencies have to be lazy?
03:34mthvedtit looks pretty easy if you get the whole tree at once
03:36lynaghkmthvedt: yep, that's what makes it fun =P
03:36lynaghka lot of things would be easier if we knew everything at once.
03:38mthvedtlyanghk: how about doing it recursively with workers pausing and adding child tasks, then waiting for them before they continue
03:38mthvedtyou could have some mechanism to make sure the # of 'active' workers is constant, and work doesn't overlap
03:39lynaghkmthvedt: that was my first approach, but the number of threads you need to prevent deadlock is unbounded.
03:40mthvedtlyanghk: i'm missing how it can deadlock so long as it's partially ordered
03:42lynaghkmthvedt: it could deadlock if you limit the number of threads. E.g., You have A -> B -> C -> D -> ...
03:42lynaghkwhere "->" means "depends on".
03:43lynaghkso you will lock if your graph has a depth greater than the number of threads you have
03:44mthvedtlyanghk: well if you have deps A B and C, you can spawn threads for B and C and recurse on A
03:46lynaghkI may just have to finally write myself a dosync. In any event, I should sleep on it first. Thanks tomjack and mthvedt.
03:53callentomjack: now I want to play beer pong o_O
03:53amalloylynaghk: is this really going to be handling workflows so deep that you can't afford a thread for each depth? i mean, a more elegant solution would be fun, but for most reasonable inputs it sounds like a thread would work, and that would be easier
03:53tomjackbeer pong is bad
03:53callentomjack: I recall winning the last time I played, and that's all that really matters.
03:54callenI like #winning. #tigerblood #warlock
03:54tomjackalcohol is a terrible sacrament imo
03:54callentomjack: sacrament? It's beer pong not passover ;)
03:54tomjackI enjoy thinking about most social groups as cults and behaviors as rituals
03:55callentomjack: fraternities must be horrific for you.
03:56tomjackyes, but also disappointingly boring
03:56tomjackthe religion at some college parties is awesome though
03:56callentomjack: Bacchus?
03:58tomjackI dunno what it is, but it's weird :)
04:02mthvedtis it not written that on the night when he was betrayed, our lord produced ping pong balls and threw them into red solo cups, saying this is the sacrement of beer pong given unto you
04:04callenmthvedt: I have a new idea for startup poker nights now.
04:24ddellacostahow do you reload a namespace from a file (say if you've edited the file) in a cljs repl? I'm using piggieback.
04:27ddellacostanever mind, I guess load-file does it.
04:31ddellacostahmm, except it seems to add extra instances of the same functions…
04:47noncomwhat is better for fast mutable state: a map of 5 atoms or an atom of a map with 5 kvs?
04:48noncomin 1st case i do individual derefs and swaps, in the second case i swap the whole map after assoc
04:48moonchromenoncom, I think that has more to do with how you want to access them then performance
04:49noncommoonchrome: putting an interface function on it hides details anyway so i thought maybe there is some existing bias in the community
04:50mthvedtnoncom: depends on access patterns, but consider that the cost of concurrency is orders of magnitude higher than chasing a few extra refs
04:50noncomwell i guess i'll just have to (time) and measure my usecase
04:51noncomwith both types of access
04:51moonchromenoncom, atoms are just CAS operations and pointers - not much overhead there - it really depends on if the data is coupled / needs to be updated simultaniously or is it separate
04:52mthvedtmoonchrome: CAS is not fast when contended. it's faster than synchronization, but that's not saying much :P
04:53moonchromemthvedt, well technically CAS is a atomic operation :P
04:53moonchromeit's just the retries that screw you :P
04:54mthvedtmoonchrome: yup, but if you have to ask about concurrent performance, it's probably because the retries are screwing you :P
04:55moonchromeI feel like noncom is doing premature optimization otherwise he would have posted some test case and profiling info for his problem
04:56noncomyeah, i think it is more of premature optimisation actually
04:56mthvedtwell, it was an optimization question. the answer is either don't optimize or optimize for the typical case
05:00callennoncom: atom of a single map with 5 kvs. See how it shakes out.
05:17noncomi think that yes, for my case, and considering the required concurrency model, i go with one atom map
05:19tomjackcool, sorta kinda looks like I got alt(s)! in go working https://www.refheap.com/3188f10dde7b99b924c2bd299
06:00augustldoes infoq have a way to list all presentations for a specific conference? Clojure/west presentations seems to have started popping up
06:01katratxoaugustl: http://www.infoq.com/clojure-west-2013/ ?
06:01augustlkatratxo: woo! How did you find that link? :P
06:02augustltried clicking on everything that said "Clojure/west" on a presentation I found, no dice..
06:03katratxoaugustl: below the video you have some "tags"
06:03augustlkatratxo: ah, thanks
06:04katratxoaugustl: np
06:37asalehI am trying to do rpc in clojure and I am wandering ... I have a function (defn call [url username password command args] ...), but most of the time the url, username and password stay the same ... is there a way how would I elegantly implement this?
06:39asalehI am thinking about something like (with-rpc url username password (call :command1 []) (call :command2 []))
06:42augustlasaleh: I'd prefer to create some sort of "context" you could pass in
06:42augustlbut as long as with-rpc is a macro that allows you to call "call" by passing in arguments I'd be happy :)
06:43ucbasaleh: I'd use partial
06:43augustlpartial would only solve it for one function call though?
06:43ucbasaleh: e.g. (def rpc-call (partial call some-url user passwd))
06:43ucbaugustl: well, then you could just call (rpc-call command args)
06:44augustlah, good point.
06:44ucbunless I'm missing something
06:44augustl(let [rpc (partial do-rpc "username" "password" "url")] (rpc "foo") (rpc "bar"))
06:44ucbyup
06:45asalehaugustl, ucb well, that looks great, thanks! :)
06:56tomjackcljs port seems to be working :) https://www.refheap.com/2d26edb26ee3b299a92a02a32
06:58tomjackwith poor man's binding conveyance
07:04dbushenkohi all!
07:12tomjackbbloom: dnolen: https://github.com/tomjack/core.async/commits/cljs-port
07:26clgvwhat is the current library to use for JNA?
07:26clgvor JNI
07:26clgvI mean clojure library
07:30augustlclgv: I suppose interop would work well for this.
07:30clgvaugustl: well a minimal language for the native call would be preferable.
07:31clgvI found https://github.com/bagucode/clj-native and https://github.com/Chouser/clojure-jna/network
07:33edtsechhey guys, what is the best solution for partial content support? I've found https://github.com/remvee/ring-partial-content but it's pretty old.
07:36jtoyhi
08:00jtoydoes anyone see what I'm doing wrong here? I'm trying to get back a list of single items but i get back a list of lists with 1 item each: (map (fn[xs] (last (sort-by #(-> % :at) xs))) (group-by #(-> % :user :id) candidates))
08:11jtoyI found it
08:12jtoythis is pretty ugly code: (map (fn[xs] (last (last (sort-by #(last (last (-> % :at))) xs)))) (group-by #(-> % :user :id) candidates))
08:13hyPiRionjtoy: what. Can you give me a small example of what candidates is, and what you want as output?
08:19clgvok clj-native works. but where do I have to put the library so that it can be loaded?
08:22jtoyhyPiRion: my example is not working, but im trying to do something like this: https://www.refheap.com/15098
08:25hyPiRionjtoy: could you explain it in English? (i.e. "I want a list of users sorted on the length of the user name, ascending")
08:27jtoyhyPiRion: for each b group, I only want the one with the longest a, so i have a unique list of b's with the one with the longest a
08:27jtoyisee what i did wrong
09:23jtoyis there a method where i can do something and then return itself?
09:24ohpauleezjtoy: You want to do something to a thing, and then return that thing?
09:24mefesto(doto obj (thing))
09:24ohpauleezor a function that does some work and returns the function itself
09:25ohpauleezthe former is `doto`
09:25ohpauleezthe latter seems like a destructive function
09:25ohpauleezwhich may be ok, but yes, you can do that too
09:26ohpauleez(fn f [] (inc 1) f)
09:26mefestoohpauleez: did you give a talk at the last conj?
09:26jtoyah doto, cool
09:26jtoyi just want to println it
09:26jtoyhyPiRion: btw, i just got it working correclty i believe: (map (fn[xs] (last (sort-by #(-> % :at) xs))) (map last (group-by #(-> % :user :id) candidates)))
09:26ohpauleezmefesto: I did - on CLJS and general design
09:26mefestoohpauleez: i recently saw a video of that. really great stuff!
09:27ohpauleezjtoy: (doto thing (prn))
09:27ohpauleezmefesto: Thanks! I'm glad you enjoyed it!
09:27mefestoohpauleez: got another talk coming for the next conj?
09:28ohpauleezI have not submitted anything - I gave a talk at ClojureWest and I've been continuing that work a bit
09:28ohpauleezI've also been working on a lot of "enterprise Clojure" and would love to share about those experiences - the general stack
09:29ohpauleezBut I might take a break (I'll be moving across the country right around the same time)
09:29jcrossley3ohpauleez: i'd like to hear that talk :)
09:29mefestowhere abouts you moving?
09:29ohpauleezjcrossley3: I'm sure you would :)
09:29mefestowest -> east coast?
09:30ohpauleezFrom Portland, OR back to Boston area
09:30ohpauleezyeah
09:30ohpauleezI've switched coasts every year for the past three
09:30ohpauleezso I'm settling in back east
09:30mefestowow
09:31mefestoyeah that sounds like a crazy pace of moving.
09:31mefestoanyhow, just wanted to give you some props on that talk. :)
09:33mefestofor anyone interested: http://www.youtube.com/watch?v=1zdzivUmL4s
10:25TimMcohpauleez: Ah, where in teh Boston area?
10:25ohpauleezTimMc: Hey man! Unsure yet
10:30danlarkinohpauleez: you bastard
10:31ohpauleezdanlarkin: haha - not until October
10:31ohpauleezI'm a heartbreaker
10:31danlarkinyou tease me and then you leave me
10:37bbloomohpauleez: make up your mind dammit
10:38ohpauleezbbloom: I loathe moving more than anything
10:38ohpauleezbut I end up doing it all the time
10:38bbloomohpauleez: as somebody else who did the bicoastal 6 month flip flop for 4 years a while back… yes fuck moving
10:38ohpauleezI think this time, for real, I'll stay put for a bit
10:39bbloomin boston? booooo ;-)
10:48rbxbxohpauleez: pre-emptive welcome back east :D
10:48rbxbxohpauleez: couldn't hack the portland winter either? :p
10:49llasramI do wish we'd go ahead and finish linking BAMA all together
10:50llasramWould make the East more attractive/terrifying
10:52gfredericks$google BAMA
10:52lazybot[Bama Boatanchor Manuals Archive] http://bama.edebris.com/
10:53llasramgfredericks: http://en.wikipedia.org/wiki/The_Sprawl
10:55jcrossley3gfredericks: thanks to you, TIL what "heuristic outcomes" are :)
10:55gfredericksjcrossley3: it feels like a euphemism
10:55gfredericksdon't worry boss, it was just a heuristic outcome. we'll have it cleaned up momentarily.
10:55jcrossley3:)
10:59ohpauleezrbxbx: I think Portland is a gorgeous city - I really enjoy it here. I'm definitely an east coast kid at heart, as is the Mrs. New England is better for both of us professionally as well
10:59gfredericksjcrossley3: I read the 3PC article for a while but there still seemed to be obvious failure scenarios they weren't accounting for
10:59gfredericksmaybe it's just wikipedia not being an ideal tutorial
10:59ohpauleezrbxbx: but yes the "winter" here is the serious price you pay for the summer
11:00gfrederickswhat are portland winters like?
11:00bbloomextrapolating from seattle: gray.
11:01ohpauleezIt rains almost non-stop, usually not hard, but at least always a constant mist
11:01jcrossley3gfredericks: very possible. fwiw, mark is darn responsive for a CTO of a billion dollar company (he's an academic at heart), so feel free to ping him for links/references.
11:01ohpauleezit rarely drops below 33F degrees, but because it's so damp, it hurts your bones
11:01gfredericksyeah that doesn't sound like it deserves the term "winter"; maybe "seattle" would be a good name :)
11:02gfredericksjcrossley3: will do -- thanks
11:02ohpauleezbut there is no place in the US with a more beautiful summer than PNW
11:03bbloomohpauleez: oh yeah. but don't tell anyone that. you're going to drive up the price of my future summer home
11:03hyPiRionOh, you want to discuss summers?
11:03ohpauleezbbloom: HA!
11:03hyPiRionThe Norwegian summer was beautiful this year.
11:04hyPiRionemphasis on "was" =/
11:04rbxbxohpauleez: I agree pretty much 100%.
11:04rbxbxohpauleez: I found myself a bit too caustic for the west coast :p
11:04gfrederickshyPiRion: summer ends in late may?
11:06gfredericksobligatory oatmeal reference? http://theoatmeal.com/pl/minor_differences5/suit
11:07arkxAnyone else seen issues with :output-wrapper true & :optimizations :whitespace?
11:07hyPiRiongfredericks: we had like 3 days with 80 F up here, then a flood and tons of water came and destroyed it all
11:07hyPiRionnow it's like 45 F
11:08gfredericksit was 45 here a few days ago and now 80
11:08nDuffgfredericks: ...that's one of the points on which I'm a bit disconcerted about moving to the East Coast. If wearing a kilt to work doesn't fit in so well... meh.
11:08ucbnDuff: proper tartan and all?
11:09rbxbxgfredericks: nice.
11:09nDuffucb: Family tartan's pretty ugly, so I usually go the Utilikilt route.
11:09ucbheh
11:09llasramTwo of the guys at my company briefly tried to get "pantsless friday" going, but AFAIK only they ever showed up be-kilted
11:09hyPiRionI think I would fit perfectly into the American workplace. I have the right circadian rythm for american timezones at least.
11:10rbxbxhyPiRion: your body will readjust to fucked up times again.
11:10gfredericks"nDuff McArtur"
11:10rbxbxor so that has been my experience
11:10hyPiRionrbxbx: yeah, I'd guess so
11:11Okasuhttps://gs1.wac.edgecastcdn.net/8019B6/data.tumblr.com/f93397ba62d722abb4319f4adcea46d1/tumblr_mmkwc5QYE31qzsjkco1_500.png Regardless strange weather and all that kind of stuff. We're pretty much doomed.
11:15TimMcOkasu: It's pretty clear that saying "we must not go above X ppm" is not an effective approach; we've crossed a few such thresholds already.
11:18hyPiRionOkasu: http://i.imgur.com/HN1fMxT.jpg
11:19samratis there any way I can setup nrepl to (use 'clojure,repl) when I do (in-ns ..)?
11:19samratautomatically, I mean
11:20gfrederickssamrat: I'm 99% sure there is, and I have no idea what it is.
11:21gfredericksmiddleware at worst?
11:22gfredericksam I wrong for wanting to replace compojure with something more data-oriented?
11:23weavejestergfredericks: Nope. Compojure has it's strengths, but transparency isn't one of them.
11:24gfredericksweavejester: has this been tried before?
11:24weavejestergfredericks: Pedestal has data-driven routing, but it's locked up with a bunch of other things.
11:25gfrederickshrm
11:27gfrederickswhat if routing was separated into two phases -- identification and handling -- such that you could add your "routing middleware" early in the pipeline and it would just add some data to the req about which route matched and the params inside it; then you could even have your underlying handler be a multimethod that dispatches on the data in the req
11:28gfredericksI've been wanting to add data to my logging about which route is being handled, but none of my middlewares have access to that information :/
11:28ucbgfredericks: I like that idea
11:29ucb(fwiw)
11:30gfrederickswould also let you do things like associate arbitrary metadata with individual routes that later middlewares could look for
11:31gfrederickse.g., "these routes require a JSON content type", then a later middleware that returns a 400 when appropriate
11:31ucbgfredericks: what if 1+ routes could handle the request? Or at least initially matched the URL? would you have each handler either produce a response or remove the tag?
11:31ucb(perhaps I'm missing the point completely here)
11:32gfredericksthe matching could still be ordered like it is in compojure
11:32gfredericksso I'm not sure where that ambiguity would come from
11:33ucbgfredericks: /user/:id and you have both XML and JSON endpoints?
11:35gfrederickssuch that request look like /user/123.xml and /user/123.json, or distinguished by the headers?
11:37ucbgfredericks: yeah, I was sort of hinting at matching on headers as well. Your handler, based on URL only (assuming no .xml or .json ending) would then be ambiguous otherwise.
11:38gfrederickshmmm...now I'm wondering if the "matching" middleware could be totally generic, and just add path data to the req, and all the work could be done in a multimethod
11:39gfredericksprobably would want more semantics than that
11:40gfredericksucb: but in any case if it's a multimethod it can be based on anything in the req at all
11:40gfredericksor the traditional predicate dispatch-like approach if multimethods are too rigid
11:41ucbgfredericks: yes. I like the general idea. I was just seeing if I could poke you to tease out more details and then go write it myself ;)
11:41gfredericksoh you can definitely write it yourself I don't have time for this nonsense
11:41ucbheh
11:41ucbme neither sadly
11:41ucbwell, actually, you never know
11:44alandipertdnolen: does advanced mode rely on :static-fns true?
11:45gfredericksucb: I'm imagining a first pass could be something similar to defroutes that instead returns two functions -- the middleware and the base handler
11:46ucbgfredericks: I may have some free time on Thu/Fri
11:46dnolenalandipert: it does
11:46dnolenalandipert: it defaults to true in advanced mode
11:48alandipertdnolen: ok cool
11:48alandipertdnolen: we have found a bug with static-fns that causes gclosure to compile indefinitely, will collect more info and report back
11:49alandipertdnolen: s/bug with/bug related to
11:50dnolenalandipert: strange, look forward to details
11:50ucbgfredericks: hum, if there was something like defroutes that returned the handler and the middleware (perfectly reasonable for a first pass) then it'd have to take the bodies of all handlers. Correct?
11:51dnolenxkcd HN problem in core.logic http://news.ycombinator.com/item?id=5780663
11:51gfredericksucb: yeah, like it curretnly does
11:51ucbgfredericks: sure, I was pondering on the size of that beast once it gets fairly complex. I suppose you could have as body a function and nothing else.
11:52ucbgfredericks: body for the route handler that is
11:53gfrederickssize shouldn't be any worse than current defroutes, right?
11:53ucbsure, as I said, I was just pondering whether this approach would allow for extra niceties
11:57gfrederickshmmmmm
11:57gfredericksmaybe better to start with designing a data-description of a route?
11:58gfrederickswhich is probably tricky but worth doing if it can be done
11:58ucb*nod*
11:59gfredericksshould be easy for the most common kinds of routes. Once you allow regexes though...
12:02ucbhum, can you do without regexes?
12:02gfredericksI've never used them :)
12:02gfredericksI don't do much webby stuff though; usually just rest/json stuff
12:02ucbexactly
12:02ucbwell, me too, so that's why I'm wondering when/where you'd use regexes
12:03gfredericksprobably as a restriction on any of the path components
12:04gfredericksregexes can be data. either as a raw string or a proper regex. not sure which is better.
12:05ucbhum
12:06gfredericks,(str #"\d{4}")
12:06clojurebot"\\d{4}"
12:06ucbperhaps as regexes with #"" since they're compiled already?
12:07gfrederickswould be fun to be able to serve this stuff as edn
12:09ucbheh
12:10ohpauleezdnolen: Your core.logic sword is mighty and sharp
12:10ohpauleezthat's awesome stuff
12:10supersymohpauleez: agreed! I was playing around with it yesterday as well :)
13:28bmentgesI wish it had a clojure/functional programming pill, you take it and learn it all.
13:29supersymusing Refs, how would I delete a key? feed it nil or?
13:31hyPiRion,(let [foo (ref {:key 15})] (prn foo) (dosync (alter foo dissoc :key)) (prn foo)) ;?
13:31clojurebot#<Ref@de9e85: {:key 15}>\n#<Ref@de9e85: {}>\n
13:31supersymdissoc.. thanks :)
13:31hyPiRion:D
13:32supersymthats easy to remember :P
13:41klrrdoes "ns" define a module?
13:42tomjack"edn"/"readin'" - coincidence?
13:45bbloomklrr: it defines a _N_ame__S_pace, which you might call a module depending on how technical you want to be about what a module is
13:47klrrbbloom: okey, im not wanna be techical since im not really learning clojure :P thanks though! :)
13:56supersymhyPiRion: dissoc-in is removed?
13:57TimMcklrr: I suppose that depends on what "module" means to you.
13:59tomjack(instance? clojure.lang.IMapEntry form) (outer (vec (map inner form)))
13:59tomjack:(
14:01supersymoh nm...found it
14:02hyPiRionsupersym: it is?
14:02hyPiRion,(dissoc-in {:a {:b 1}} [:a :b])
14:02clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: dissoc-in in this context, compiling:(NO_SOURCE_PATH:0:0)>
14:02sevviehi everyone. I've been working through _Clojure Programming_, slowly, and ran into an issue with some code from the book; I can't tell if it's something I messed up or not?
14:02sevviehttps://gist.github.com/sevvie/5664676
14:03hyPiRionwell, update-in with dissoc is probably the correct approach then
14:03sevvieIt's "Wilson's Maze" from the book, but it doesn't actually draw the maze. It creates the window, draws the border for the maze, but... is otherwise empty.
14:03Foxboronsevvie: you can fix those ends paranthesis D:
14:03Foxboronend*
14:04sevvieFoxboron, I know I know XD It just helps me see things. I'll take the training wheels off for myself eventually.
14:11tieTYT2what I find weird about clojure is that if I def something, it can be accessed from anywhere (unless it's private). If that def is a java object with setters, is this similar to a global object?
14:12sevvieFoxboron, I updated the gist with tucked-in parens.
14:13bbloomtieTYT2: that's not similar. that IS a global object :-P
14:13tieTYT2bbloom: ok, and IME that's bad
14:14tieTYT2now if I def an atom instead, why isn't that bad?
14:14bbloomtieTYT2: that's bad too. it's just convenient as hell during development
14:14bbloomin general: avoid doing that
14:14tieTYT2how do you avoid it? Pass it around?
14:14nDuff...well, not _strictly_ avoid. If you're creating dynamic vars, for instance, their non-root contents are thread-locally scoped.
14:14bbloomwrite pure functions & move the mutable state outside
14:14supersymhyPiRion: I need to learn myself to watch the namespace, assoc-in, dissoc etc are in other libraries
14:15tieTYT2in my limited experience, it seems so much easier in haskell to do that
14:15supersymdissoc-in is in contrib... also is it me or do nested hash-maps bring pain
14:15hyPiRionwhat
14:15tieTYT2because you have to. In clojure it's not obvious to me how to accomplish that
14:15supersymI never seem to get them right
14:16hyPiRion,(assoc-in {:a {}} [:a :b] :c)
14:16clojurebot{:a {:b :c}}
14:16hyPiRionoh right, dissoc-in is not evident/simple, so it was left out
14:16tieTYT2now if your def is just a value (vs a variable) is there anything wrong with that?
14:16supersymah ok
14:18tieTYT2To me that feels like a public static final variable in java
14:19tieTYT2and those don't usually get me in trouble, but it's not idiomatic to use them as much as I do in clojure, so maybe I just don't have the experience to see the problem with that
14:19bbloomtieTYT2: swap! basically lets you just transform a pure function into a state changing one, so just write pure functions & then throw a few bang! functions around the top level & you're good
14:19bbloomhaving immutable global is no big deal really
14:19bbloomconstants are good for you :-)
14:22tieTYT2ok then, what about def that's dynamic so that one top level function sets a binding?
14:23tieTYT2for testing purposes, that seems perfectly fine. You can define the binding at whatever scope you want
14:23bbloomtieTYT2: stuartsierra has a great talk on this stuff from clojure/west, i dunno if/when it will be available
14:24bbloomtieTYT2: the downside of the dynamic var is that you can only have one of them at a time. you're better off having a map as the first argument to your fns with everything the fn might need
14:24bbloomi use `-> to thread whole systems though pure functions with update-in, assoc-in, etc doing all the real work
14:26hyPiRionbbloom: https://mobile.twitter.com/ClojureWest/status/339380818684289026 <- so there will be a release schedule upcoming as far as I understand
14:29sevvieI figured out my mistake. My mistake was pure idiocy.
14:30nopromptbbloom: i've been finding a lot of joy in doing the same thing recently
14:37zerokarmalefttieTYT2: I think bbloom is referring to http://www.infoq.com/presentations/Thinking-in-Data around the 28:30 mark
14:37bbloomzerokarmaleft: also a good talk, but not the 1 i was talking about
14:38tbaldridgezerokarmaleft: yeah, the Clojure/West talk centered more about avoid the use of dynamic vars, and how to deal with global state correctly. It was a good talk.
14:39zerokarmaleftah, looking forward to the clojure/west vids getting released then :D
14:39tieTYT2bbloom: what do you mean I can only have one of them at a time?
14:40tbaldridgetieTYT2: if I have a global var called DB, now my app is locked into only talking to one DB at a time
14:40tieTYT2zerokarmaleft: thanks man
14:40tieTYT2yeah but if you have a global var called dbs, now you don't have that restriction
14:41tieTYT2you can have a dynamic var that IS a map
14:41tbaldridgeSo how does a function know what DB to use from the global var?
14:41tieTYT2how does it with your solution?
14:45klrris a map similar to haskell's list of pairs( "[(a,b)]") datastructure?
14:46tieTYT2doesn't haskell have a map type?
14:50justin_smithtieTYT2: the difference is the typing I think? I mean what would haskell even do with an object that returned or took arbitrary types at runtime (I am sure there is actually an interesting answer to that question that I am ignorant of)
14:51tieTYT2the question is very vague. Conceptually it's the same as haskell's map type I'd think
14:52tieTYT2there's more ways to look at it than "conceptually" though
14:52tieTYT2but it's not the same as [(a,b)]. I think that type would allow duplicate keys
14:54bbloomtieTYT2: http://www.haskell.org/ghc/docs/6.12.1/html/libraries/containers-0.3.0.0/Data-Map.html
14:54justin_smithlooking at the definition of Data.HashMap, it looks like hashmaps in haskell are strongly typed on both key and value (taking arguments that determine the key type and value type). I could be misreading though, and this is all off topic for this channel.
14:55justin_smiths/definition of/docs for/
14:55tieTYT2justin_smith: that is correct, but I didn't consider that a conceptual difference
14:58bbloomconceptually, it's probably better to think of a map as a function than as a sequence of pairs
14:59TEttingeramalloy: you maintain a fork of lazybot right? do you know how to get the bot to reconnect later if it gets disconnected?
14:59amalloyTEttinger: i maintain the real lazybot :P
14:59TEttingeroh good
14:59amalloyand no, i don't know; ask Raynes :P
14:59amalloygoodness, what kind of mood am i in? :P twice in a row?
15:00TEttingerheh I thought Raynes wrote it
15:00amalloyhe wrote more of it than i did
15:00RaynesTEttinger: Raynes did write it, and amalloy helped later on, so amalloy and Raynes keep it in flatland so both of them can work on it.
15:01TEttingercool
15:01TEttingerClojure seems to have a really supportive community
15:01RaynesTEttinger: And unfortunately there isn't a reliable way to get the bot to reconnect. It needs to be implemented at the level of irclj, which is partially through a rewrite (and has been for a long time), but will likely go through another because I'd like to try rewriting it with lamina.
15:02TEttingercould it keep track of pings without pongs?
15:02TEttingeron mine, I tend to get nothing but pings at odd intervals and it doesn't ever get a pong
15:02RaynesThere are a couple of ways it could work.
15:03TEttingerthen I restart the bot and it's fine for days
15:03TEttingermaybe weeks
15:09klrr'(good night)
15:14lynaghkamalloy: re: your question from 12 hours ago; yes, it's conceivable that the build dependency stack will be so deep that spinning up a thread for each layer will be trouble.
15:15lynaghkamalloy: that was my first approach, though---futures blocking on futures blocking on futures
15:15amalloyokay. just wanted to make sure you weren't skipping the easy solution out of some sense of aesthetics
15:15lynaghkamalloy: I'm not going to lie, it's definitely also aesthetics. This is a personal bikeshed, so I've got the luxury/curse of demanding aesthetic perfection
15:16lynaghk= )
15:21noprompt+1 aesthetics
15:41brainproxydnolen: like the recent revs to mori :) how do you feel about exposing some of the ..? functions, i.e. so plain vanilla js functions can say detect whether an argument is a vector or an array
15:42brainproxye.g. `if (mori.is_vector(x)) { ... } else { /* it's an array */ ... }`
15:44brainproxyiow, to facilitate polymorphism in js functions that may be called with mori values -or- plain js values
15:48bobbrahms1using clojure-maven-plugin clojure:nrepl, how can I set up the classpath so that I can use the classes in my (huge, java) project?
15:49bobbrahms1I fire it up and can't import anything
15:50bobbrahms1I realize this is a total noob question by the way, and I apologize in advance.
15:51mefestobobbrahms1: is this one large project with both clojure and java sources or is the java project separate?
15:51bobbrahms1one big project
15:52bobbrahms1but I dont' seem to be able to import anything:
15:52bobbrahms1user> (import 'java.net URLClassLoader)
15:52bobbrahms1ClassNotFoundException java.net java.net.URLClassLoader$1.run (URLClassLoader.java:366)
15:52mefestooh that's odd
15:52mefestosorry, i got nothing :)
15:52bobbrahms1bummer...
15:53bobbrahms1thanks anyhow…
15:53bobbrahms1anyone else?
15:53dnolenbrainproxy: patch for that welcome
15:53brainproxydnolen: okay will do
15:53dnolenbrainproxy: I think we should provide all the standard collection predicates, is_vector, is_map, is_set etc.
15:54brainproxydnolen: yeah, I think it will be pretty useful
15:54brainproxyI know I have a use for it
15:54mefestoanyone use enlive that wants reloadable templates?
15:54nopromptbobbrahms1: i think you mean (import 'java.net.URLClassLoader)
15:54nopromptor (import '[java.net URLClassLoader])
15:54brainproxydnolen: don't have time right at this moment, but it's going on the todo list, you'll see a pull req soon
15:54dnolenbrainproxy: great thanks
15:54bobbrahms1thanks noprompt!
15:55nopromptnp
15:55mefestoahhh didn't see that in the import form
16:05nopromptif anyone wants to send PRs or help with Garden i'd sure appreciate it.
16:06noprompti've been very busy lately and contributions/suggestions would be welcome. :)
16:07tomjackeven with no binding conveyance and a funky dynamic *done* callback, async clojurescript.test seems much more appealing than e.g. the promise fork of mocha
16:07nopromptRaynes: the fs utilities have been mega helpful the past week. <3
16:08Raynesnoprompt: Happy to hear. Appreciate the <3, but I of course have to give most of the credit to the original author from whom I took over maintainership. And I give credit because there are lots of completely broken shit in fs that I haven't fixed yet that I don't want to be blamed for. :D
16:09nopromptRaynes: ohrly? which parts?
16:09noprompt(to be honest i've probably only used a handful of the fn's)
16:10dnolentomjack: are you writing an async version of cljs.test ?
16:10mefestoif you ever get tired of coding those skills will translate into politics nicely :)
16:15bbloomdnolen: rhickey said that tim baldridge was gonna do one, but i think tomjack took a stab at it for grins
16:19nopromptlynaghk: do you still work with angularjs and clojurescript or have you moved on to something better?
16:19nopromptlynaghk: i heard there was a talk given at clojure west (which i missed sadly) that spoke on making that sort of thing easier with a few tricks but i don't think the talk has been posted yet.
16:26mefestoif i have different feature branches of a project being worked on and would like to test them out in another project; is there a version naming scheme that anyone recommends? I was thinking 1.0.0-SNAPSHOT-feature-name
16:26gfredericksRaynes for california state senate
16:27mefestohe'd have my vote. if i lived out there
16:27djwonkany Washington DC area folks in here? I'm about to head to the user group meeting
16:27Raynesgfredericks: That was pretty random. :o
16:28gfredericksRaynes: mefesto brought it up
16:28RaynesOh, I didn't read that far back.
16:28RaynesI accept your nomination, gfredericks.
16:28RaynesI shall begin campaigning tomorrow.
16:29nkozathere is some function in the standard libs equivalent to #(fn [x] true) ? (always returns true, can be useful to replace a predicate)
16:29Raynes(constantly true)
16:29nopromptRaynes: and i shall help you with flyers, banners, stickers, buttons, and a personal website!
16:29hiredman(doc constantly)
16:29clojurebot"([x]); Returns a function that takes any number of arguments and returns x."
16:29RaynesWhich is amusingly longer, nkoza, but a nicer solution in general.
16:29RaynesMan, hiredman still has me on /ignore? :(
16:30noprompt(doc occasionally)
16:30clojurebotExcuse me?
16:30RaynesIt has been like 3 years now.
16:30nopromptlol
16:30nkozaRaynes: thanks
16:30bbloomnoprompt: (def occasionally constantly) ; All occasions
16:31bbloomsomething something something fair dice roll
16:31nopromptlol
16:31pjstadigsomewhat-less-than-usual
16:31amalloywell, #(fn [x] true) is more like (fn [] (constantly true)). i assume nkoze actually wanted (constantly true) but included the # in his request just to confuse matters
16:32nkozathe # was a typo, sorry :)
16:32nopromptwhenever would be a fun one.
16:32hiredman3d6+5
16:32clojurebot15
16:33noprompt(whenenver some-fn) ;; At some point in the future call some-fn.
16:33gfredericksnoprompt: why just the future? couldn't calling it in the past be allowed?
16:33mefesto(every-now-and-then x)
16:34noprompt(every-now-and-then get-a-little-bit-lonely)
16:34nopromptgfredericks: how would that work?
16:34metellusgfredericks: not by causality
16:34noprompt(at-a-later-date ...)
16:35pjstadiggfredericks: don't be disrespecting the arrow of time!
16:35gfredericksit's all an illusion!
16:35metellusif it was a compile-time thing that could work though
16:35metellusthe compiler finds that and just throws some-fn somewhere
16:36ToxicFrogRaynes: I have someone on ignore from like 2008...although to be fair they were an incredibly persistent troll and probably aren't around anymore.
16:36ToxicFrogClient should probably clean up ignores after a year or something.
16:36mefesto(defmacro surprise-me [& body])
16:36pjstadiggfredericks: that's right, i forgot that Einstein's Theory of Relativity establishes the non-existence of time
16:37RaynesToxicFrog: Totally fair, but to this day I have no idea what prompted the ignoring. Nobody would ever tell me, and he and I have even exchanged smiles on elevators. I sometimes wonder if he is simply forgotten.
16:37Rayneshe has*
16:38RaynesI can't help but think of how much we could have accomplished over the years had it been possible to put our snarks together while answering questions.
16:38hiredmanI saw a nova special once, I'm pretty sure it did
16:39pjstadighiredman: http://amzn.com/B0095XKMS8
16:39tomjackdnolen: I've made a couple starts on adding async to clojurescript.test, no success yet
16:40nopromptbbloom: well i guess you could have the function do something and then at some random point in time later tell you.
16:40tomjackmore motivation now that my core.async cljs port gives me a way to convey dynamic bindings
16:40tomjackI got stuck trying to think about what to do about that instead of just hacking it somehow
16:40noprompt(defmacro whenever [fn ohey-msg])
16:41tomjacknow we can hack it somehow (i.e. tester's responsibility to convey clojurescript.test's dynamic vars) and have core.async make it work for us
16:41hiredmannoprompt: I'm pretty sure there is a ruby library that does that
16:41ToxicFrogRaynes: huh. I'd tell you if I knew, but I'm pretty sure that was before my time here.
16:41noprompthiredman: nice.
16:42RaynesToxicFrog: It's very possible and even likely that I was annoying as hell though. I was like 15 at the time.
16:42ToxicFrogOh
16:42ToxicFrogThat might do it
16:45gzmask /leave #clojure
17:08djwonkbbloom: (def random 42) ; 42 chosen at random
17:08bbloomdjwonk: that was the joke, yes
17:09djwonkwhere is the community-accepted place to say "i'd like to hire a Clojure freelancer for some work?"
17:11djwonkwill try the mailing list
17:13Foxboronbbloom, djwonk needs more XKCD
17:13justin_smithonce you adapt to the elevated smugness levels it is nice
17:14mabes_lol
17:14Foxboronnoprompt, negativity never helps a dream :D
17:15noprompt:P
17:15noprompti'm actually a pretty positive guy.
17:15gfredericksthe correct group-noun for clojurians is "an IPersistentCollection"
17:15noprompti work with clojure pretty much everyday now at work, just not on a team. :/
17:16nopromptgfredericks: :)
17:31gfredericksnoprompt: being on a team of people writing clojure pretty much degenerates into macro wars. You have to write macros that somehow trick your opponents' macros into behaving unexpectedly.
17:33hiredmanfeh
17:33gfrederickshiredman is apparently not winning
17:33hiredmanif your team has a 2 inc policy, there is no way you can do that
17:34hiredman(only code reviewed and given two plus ones can be merged)
17:34gfredericksthat just makes it more challenging
17:36hiredmanit means at least two other people have seen your macros already, very hard to sneak things in
17:36hyPiRionnono, you just team up with other people
17:37hiredmanhorse trading
17:37hiredmanof course everyone also has a dec veto
17:44gfredericksis there any reason not to create a jira ticket about clojure.walk metadata loss?
17:45nopromptso in clojure, team member is just an alias for opponent?
17:45nopromptinteresting.
17:45noprompt:P
17:45hiredman"review committee member"
17:46patchworkThis is why we don't use macros : P
17:46gfredericks"the other elements of my IPersistentCollection"
17:47gfredericksmaybe it should be a transient
17:49noprompti want a macro that overwrites a random function in another namespace, then when the function is called randomly executes the body of code given to the macro, suppresses all execptions, and returns nil.
17:50gfredericksat macro-expand-time or runtime?
17:50noprompthiredman: that is ruby.
17:50nopromptgfredericks: which would be worse?
17:51gfredericksnoprompt: I have no idea
17:51nopromptworse as in better, as in more evil.
17:51noprompthmm... in this case probably at run time
17:53hiredman(defmacro bad [& body] (in-ns 'foo) `(do ~@body))
17:56noprompt(defmacro very-bad [& body] `(do (try (bad ~@body) (catch Exception e#)) nil))
17:59gfredericksyou don't really need macros for this kind of evil
17:59gfredericksjust have some top level code that sleeps for 3 hours and then wraps every var in the system to return nil 0.01% of the time
17:59gfredericks(in a future perhaps)
17:59noprompthaha
18:00hiredmangfredericks: the thing with macros is the code in them gets executed when code is compiled, so they don't actually need to be top-level
18:01hiredmanso you can hide (bad ...) inside a function, and suddenly the following code is being compiled in a namespace without clojure.core
18:02tieTYT2i'm thinking of writing a game's server in clojure. Netty seems like a cool api, but won't I have to intimately understand it in order to use it in clojure since it may have different concurrency concepts?
18:05hiredmantieTYT2: how can you have different concurrency concepts? do you mean identity/state management?
18:05hiredmannetty (I am pretty sure) doesn't have any of that
18:05tieTYT2i'm not sure because I don't know either very well. My impression is clojure is very opinionated on concurrency and state. Netty may violate those opinions
18:06tieTYT2and I'm afraid if I use netty in a clojure app, it may have unexpected results
18:06hiredmanso?
18:06patchworkhttps://github.com/ztellman/aleph uses netty
18:06patchworkand is clojure
18:07tieTYT2that's reassuring
18:07hiredmanI don't really understand what you are getting at, if you use one thing you don't understand you are likely to get unexpected results
18:07hiredmanlet alone two things
18:07amalloyhugod: i'm pleased to report that the ritz instructions are now so obvious that i was able to get ritz and nrepl going in just a few minutes, after years of using swank/slime
18:07tieTYT2yeah that's true
18:08tieTYT2but I figure it could take weeks to discover they're incompatible with each other so I thought I'd save some time by asking the question
18:08tieTYT2looks like they're safe to use together
18:09hiredmantieTYT2: clojure is a generally purpose language, it integrates with the jvm, you can use anything else on the jvm with it
18:15tieTYT2well I get the sense that if you use a mutable java object with refs, you'll get unexpected results. But you can't really get yourself in trouble if you build a pure clojure app
18:16hiredmanthat is not true
18:16tieTYT2which part?
18:17hiredmanyou can easily shoot yourselft in the foot using just clojure
18:17tieTYT2oh i see
18:18hiredmanthe only safety is understanding, which is difficult
18:18nDufftieTYT2: ...and Clojure _does_ provide tools that help with management of mutable objects, though just how useful those tools are depend on just how unpredictable the objects' behavior is.
18:19nDufftieTYT2: ...making access go through agents, for instance, does a fair bit of good for predictability when something isn't changing its state except when poked.
18:19tieTYT2ok well i'll learn more about this when i get started, thanks
18:33tomjackcemerick: I'm trying to patch clojurescript.test for async test support. I see a few options: 1) rewrite all the dynamic vars into atoms
18:34tomjack2) provide cemerick.cljs.test/bound-fn like this https://www.refheap.com/320114f8f611dbe10d04b8df5 and require people to wrap their async callbacks with it, 3) provide a bit more general bound-fn workaround which allows specifying a list of vars to convey in addition to cemerick.cljs.test's
18:34tomjackor 4) make it the tester's responsibility to convey cemerick.cljs.test's vars in the manner of their choosing
18:34tomjack.. or 5) wait till clojurescript supports binding conveyance
18:34tomjackany thoughts?
18:35tomjackoption 1 could be not so bad by writing a custom binding macro that just uses atoms
18:36tomjack6) rewrite clojure.test so that it doesn't use dynamic scope
18:36tomjack :D
18:38tomjackoption 3 doesn't make sense, they won't have clojurescript.test's bound-fn workaround in prod to convey vars, so shouldn't do that in tests
18:42dnolenit occurs to me that advanced compilation frees us to do some perf tricks around bound-fn
18:43dnolensince we know all the dynamic vars in a program we can just do array lookup
18:44tomjackwhy only advanced?
18:44bbloomtomjack: because you can't def new vars in advanced
18:45bbloomtomjack: you know them all apriori
18:45tomjackfrom the cljs compiler's perspective the situation is the same, though, right? you just know that the state you're building up will not be reused later?
18:46dnolenbbloom: did you just use a mutable array in your implementation for the var stack?
18:46bbloomdnolen: do we care much about non-advanced perf? b/c the real problem is that if dynamic vars are special, redefing from static to dynamic or vise versa will break previously compiled call sites
18:46bbloomdnolen: my implementation was a long time ago and i was much dumber then :-P i don't recall what i did, i think i just ported the JVM code more or less line for line
18:46dnolenbbloom: yeah we don't, I'm just thinking about the cheapest operation possible so it won't affect normal usage of dynamic binding
18:48bbloomdnolen: is NEVER GETS ANY SLOWER a realistic perf goal? i think that the full persistent maps version of var non-root-values is reasonably fast for a small number of dynamic variables, which is the norm
18:48bbloomrather than getting particularly clever
18:48bbloomthe concern (for me) has always been slowing down normal fn calls & constants and the like (aka non dynamics)
18:48tomjackpersonally I'm guessing I'd like to have the same access as now
18:49tomjackI don't know if cljque's use of dynamic vars is a good one, but it's a good example I think
18:49tomjackyou probably don't want a PHM lookup every single time you register a callback on a promise?
18:49tomjackeh, who knows, maybe it wouldn't matter
18:49bbloomdnolen: see also http://dev.clojure.org/pages/viewpage.action?pageId=950293 which shows that clojure has similar problems to those that we're thinking about in cljs
18:49dnolenactually I don't even think we need a stack
18:50dnolenjust an array w/ slots for each dynamic var
18:50dnolenbound-fn would clone it
18:50bbloomi'm sure i've asked this before, but would prototype lookup chains be good enough?
18:51bbloomthis way you could treat the "stack" as js objects you just never modify after create
18:51bbloomlookup would be linear with depth of stack
18:51bbloomgenerally, bindings are pretty shallow
18:51bbloomunless you're doing `binding on every iteration of a recursion, which isn't shallow, but is also kinda a bad idea :-P
18:52tomjackwhy have the stack?
18:52bbloomthen bound-fn just needs to alias the current obj pointer
18:52bbloomso object clone cost
18:52hiredmanyou're not allowed to recur across a binding
18:52bblooms/so/no/
18:52hiredmanactally is that true?
18:52hiredmanmaybe you shouldn't be, but are
18:53gfredericksbinding involves a try/finally, so presumably not at the moment?
18:53dnolenbbloom: prototype chain idea is clever
18:53hiredmangfredericks: ah, good
18:53gfredericksbut I thought rich was trying to "fix" that
18:53hiredmanexcellent
18:53tomjackI see my last attempt actually does have the stack
18:53hiredmangfredericks: the fix was to the code that disallowed it, it would do stuff like stop you from loop/recuring inside a finally
18:53dnolenbbloom: cheaper for bound-fn since we don't have to clone ... just create new object and set prototype
18:53lynaghknoprompt: yes, doing a lot of angular.js + cljs over here; no plans to change, either. I'll be dropping quite a bit of open source stuff in the next month or so to coincide with the release of an iOS angular.js+cljs weather app.
18:54bbloomdnolen: i've been saying this for a year now :-)
18:54hiredmangfredericks: allowing reucring across bindings and try/catch/finally (with there dynamic extent) is a bad idea
18:54dnolenbbloom: heh yeah, but core.async didn't exist then ;)
18:54bbloomdnolen: however, forgive me for sucking at communicating for the first 8 months or so of that
18:54hiredmanso I doubt rich is changing that
18:55gfrederickshiredman: oh you mean (try (finally (loop ... (recur))) was disallowed?
18:55hiredmanyeah
18:55gfredericksthat's a weird thing to want to do though isn't it?
18:55hiredmanso the compiler would complain if you put a doseq in a finally
18:55gfredericksooh
18:55gfrederickshm
18:55hiredmangfredericks: happens all the time for cleaning up a list of resources
18:55gfredericksyeah I guess so
18:56gfredericksokay cool
18:56nopromptlynaghk: awesome. i'll definitely be looking forward to that. hopefully it's right around the time i get back in the angularjs + clojurescript game.
18:57nopromptlynaghk: the big thing that bothered me was all the clj->js madness and basically ended up writing a lot of wrapper code.
18:57lynaghknoprompt: there's not a ton of new stuff, to be honest. Basically, just using native JS data structures from CLJS by implementing a handful of protocols
18:57hiredmanJuha Arpiainen finally fixed it
18:58nopromptlynaghk: which protocols?
18:58lynaghkILookup, ISeq, that kind of thing
18:58bbloomdnolen: so in clojure there is only clojure.lang.Var, which is mutably static or dynamic
18:58lynaghkso you can say, e.g., (let [{:keys [a b]} your-js-object] ...) and have it just work
18:59nopromptso are you using extend-type Object for that sort of thing?
18:59lynaghknoprompt: yep.
18:59bbloomdnolen: my proposal is an IVar with 3 implementations: 1) the same as clojure for non advanced compilation. 2) DynamicVar for use in advanced compilation where static vars are optimized away via a full-program pass and 3) StaticVar, for still allowing #'foo syntax even after static vars are compiled away
18:59tomjacklynaghk: that is evil :P
18:59hiredmanbbloom: clojure vars can be :static, :dynamic, :const, or a regular var
19:00noprompttomjack: i was just about to say that is what i heard but surely there is a clean way to handle that.
19:00dnolenbbloom: yeah I still not interested in bringing in any var semantics - just language support to convey bindings
19:00lynaghktomjack noprompt: what in particular strikes you as evil?
19:00nopromptyeah i'd love an explanation on that one.
19:01tomjackobjects aren't values, values "refuse to help you program imperatively ... that's a feature"
19:01bbloomdnolen: even if you ignore #3, you still need a full var impl to support incremental development without having to recompile stale call sites: you need the extra level of indirection that vars provide
19:01tomjackimo clojure(script)'s core protocols should also refuse to help you program imperatively
19:02dnolenbbloom: ah right
19:02tomjackthough, I dunno
19:02dnolenbbloom: still, likely to just hide that as implementation detail
19:02tomjackyou can destructure arrays in clojure
19:02tomjackbut arrays don't implement IIndexed
19:03dnolentomjack: technically you destructure IndexedSeq
19:03bbloomdnolen: happy to implement it without exposing the var functions other than via a hypen prefixed "private" protocol method
19:03nopromptlynaghk: well, whenever you make that stuff public let me know. i'm going to be making heavy use of angular here w/in a month.
19:04tomjackdnolen: in clojurescript? nth on java arrays does not use IndexedSeq afaik
19:04nopromptand, no, i refuse to write raw js.
19:04noprompt:)
19:04dnolenbbloom: if you have time, cleanup the patch and I'll take a look!
19:04dnolentomjack: yes sorry CLJS
19:04dnolentomjack: thought you were talking about protocols
19:04lynaghknoprompt: (shameless plug) there will be an announcement on the Keming Labs mailing list, and probably also the cljs mailing list.
19:05bbloomdnolen: i might just bang that out tonight, since i'm sick of having this conversation on loop :-)
19:05tomjackI see, there's a special case in seq for js arrays
19:05dnolenbbloom: haha, cool
19:05nopromptlynaghk: good deal. i'll keep my eye out for it.
19:05tomjackwell there's a special case in nth too
19:06dnolentomjack: yeah we used to do this stuff via protocols but it's faster to just do it in seq and it also it makes reasoning about dead code elimination simpler
19:07tomjackso neither clojure and clojurescript provide any evidence as to whether arrays 'should' implement Indexed
19:07bbloomdnolen: heh, my patch is OLD. i can probably redo it faster from scratch
19:08bbloomdnolen: only took me 2ish days the first time & i had no idea what i was doing then
19:08tomjackI guess if it doesn't implement IPersistentCollection, it might not be evil
19:09dnolentomjack: in CLJS arrays used implement Indexed, again changed for perf
19:09tomjackoh right the fact that they did before is some evidence that they 'should'
19:10dnolenthe important thing is that nth work on arrays
19:10hiredmanhow is an appeal to authority any kind of evidence?
19:11tomjackdepends on the authority
19:11tomjackI'm guessing dnolen wrote it so it counts as evidence to me :)
19:11dnolentomjack: heh no, all the protocol stuff was in place long before I did anything
19:12dnolenI've most removed the protocols on natives for code size and perf reasons
19:12dnolenmostly
19:13tomjacklynaghk: I retract my claim, as long as equiv and cons throw
19:14brehautdnolen: unrelated cljs q: is there a method apply function / macro in cljs? eg to make (.apply (.-method o) o (to-array seq)) simpler?
19:14tomjackor equiv could be identity equality maybe like datomic entities.. :/
19:16hiredmantomjack: if equiv is egal, egal for mutable things is identity
19:16tomjackis = egal?
19:16hiredmanrich has said clojure's = (based on equiv, but not when he said that) is an implementation of egal
19:16technomancytomjack: not really
19:16hiredmanbut technomancy disagrees
19:17technomancyit's close, but it makes some concessions to convenience
19:17tomjacklike pcequiv? or what
19:17tomjack..I need to read that paper
19:17hiredmanclojure's equality has also under gone some changes since rich said that (it was in one of the blip tv videos)
19:18technomancytomjack: the most obvious is equivalence between vectors and seqs despite them having very different operational behaviour
19:18tomjackright, that's what I was thinking of. I think that's due to pcequiv
19:18technomancyoh, gotcha
19:18technomancyI'm not familiar with the implementation much
19:19dnolenbrehaut: is this some interop you're doing?
19:19hiredmanof course pjstadig disagrees with technomancy to some extent, but he isn't as vocal in #clojure
19:19technomancytomjack: if you are super-pedantic you could say that the presence of the identical? function also disqualifies it
19:19brehautdnolen: someone was wanting it yesterday, and i dont actually use cljs at all, but yes, for interop
19:19technomancyerr--actually I think the paper specifically makes allowances for "primitive" identity functions, so maybe scratch that
19:19technomancybut things can print differently and still be equal
19:20dnolenbrehaut: (apply (.-method obj) o seq) should work
19:21brehautdnolen: oh right. cool
19:21technomancyI think we can make exceptions for things that are explicitly defined as implementation detail, like the order in which elements of unordered collections print
19:21technomancybut there are other cases where equal things print differently
19:22dnolenbrehaut: apply is designed to interop w/ regular JS fns
19:22tomjackso take datomic entities. consider an operation which takes two datomic entities and returns a predicate of datomic times. ((=?= e1 e2) t) is true if, at datomic time t, the datoms in the extent of the e1 are equivalent to the datoms in the extent of e2 (substituting their entity ids appropriately). if datomic time t has not yet occurred, I suppose it throws or blocks
19:22brehautdnolen: its a little unfortunate that you still have to mention the object twice
19:23tomjackso e.g. ((=?= e1 e2) 0) is always true (for non-bootstrap entities) because the extent of any two (non-bootstrap) entities at t=0 is empty
19:23dnolenbrehaut: well it's not any cleaner in JS :)
19:23brehaut(but its also unfortunate that you'd have to do the same thing in js)
19:23tomjackwhat is that? I can't call it 'equality'..
19:25poindontcarequestion, is evaling sufficient for creating classes with gen-class or does one need to do something special?
19:25tomjackhmm that has been brewing in the back of my head for a while but now that I say it I realize is all wrong
19:26bbloomdnolen: what's the cljs-ism for the JS "in" operator?
19:30tomjack'equal' entities must have the exact same histories/futures, which makes that 'equality' useless
19:31tomjackbecause almost certainly only identical entities are going to be 'equal'
19:37Morgawras far as running Clojure without a JVM, what viable options do I have? I know of Clojure on CLR (nope) and ClojureScript (great, I use it). I've heard about compiling clojure to scheme and then scheme to C but that sounds very farfectched. There's also clojure-py but the project hasn't gotten any contribution for a while
19:37Morgawrwhat other options are there?
19:56brehautMorgawr: thats an implementation for the three big platforms, two more esoteric / niche platforms, and indirectly one old big platform. there arent really many non-niche / esoteric platforms remaining (objC/cocoa being the obvious one not listed)
19:57brehauti recall seeing toy implementations for haskell, and c in the past, maybe also objective c, but nothing you'd want to build on
19:57brehautbut your google is as good as mine
19:57MorgawrI see, thanks
19:58hiredmanfine is far better, because it is mine
19:58hiredmanmine
19:58MorgawrI guess I don't even know what I want myself... it's just that I despise the JVM
19:58hiredmanyou shouldn't
19:58technomancyit's great for most things and terrible at a few
19:58brehautdespising the JVM is an extremists position that isnt supported by evidence
19:58Morgawrit's a cumbersome beast, eats a lot of memory, lots of dependencies, doesn't play well on some Linux systems, etc etc
19:58hiredmanMorgawr: none of that is true
19:59hiredmanMorgawr: what you mean is "I am unfamilier with the jvm"
19:59Morgawrmaybe
20:00technomancy"doesn't play well on some linux systems"?
20:00Morgawrthe differences between proprietary and non-proprietary jvm implementations are tricky
20:00Morgawrat least in my experience when developing Java
20:00technomancydon't use anything but openjdk
20:00brehautthe eats memory one amuses always me; python backed sites i develop frequently consume more ram than my clojure powered sites
20:00technomancyproblem solved
20:01technomancyif you got tricked into thinking gcj was an actual thing then you have my sympathy though
20:01hiredmanthe reference jvm impl is openjdk at the moment
20:01Morgawrbrehaut: I tried to see if I could install the jvm to play with clojure on my headless server and I had to download 300+MB of dependencies with X server and all of that stuff (I don't use X server on a headless server, kthx)
20:01hiredmanMorgawr: that is a packaging issue
20:01technomancyMorgawr: either your package manager sucks, or you weren't paying attention to the x-free variants
20:02hiredmanon debian based systems there are usually -headless package variants of the jvm
20:02Morgawroh, so Clojure is built with openjdk as reference? That's good to hear, I've always used openjdk and I was speaking only from my Java experience (I love clojure and never had problems with openjdk), so I guess I was wrong with that
20:02MorgawrI guess I can give another go at the whole packaging/jvm stuff
20:02hiredmanyou can also go to the oracle website and download hotspot and run it right of the tarball they give you, without installing anything
20:03nightflyin debian/ubuntu openjdk-7-jre-headless is probably what you want
20:03dnolenbbloom: for .. in ?
20:03technomancythere are some issues with the IBM JDK that come up occasionally, but there's no reason to use that unless you work for IBM
20:03hiredmanMorgawr: no, I mean the jvm reference implementation
20:03n_bThe only place I have ever had JVM issues is on an RPi
20:03brehautdnolen: key in associativeObj
20:03MorgawrI really do love Clojure, I really want it to work out well for me but I'm just a bit taken aback by the whole jvm business, I'm sorry (I'll do more extensive research on the matter)
20:03bbloomdnolen: yeah what brehaut said
20:03bbloomanyway, i'm just hacking up a proof of concept of one approach
20:03bbloomso i just js* hacked it for now
20:04brehautparticularly useful for key in sparseArray
20:04hiredmann_b: most likely due to hard/soft float differences in arm abis
20:04brehauts/for/in context of/
20:04dnolenbbloom: hmm I don't think we have anything for that
20:04bbloomcould probably just be js-contains?
20:05hiredmanI use oracle's hotspot jvm on my beaglebone (soft float)
20:05n_bhiredman: That's precisely it; it's not a platform I'd ever expect to be well supported, so that it works at all is a testament to its versatility
20:05livingstonI have some ring middle-ware (a friend wrapper specifically) I'd like to have it get some of the config values from a file on the server, except the standard way to build up apps is always with def this and def that, which will cause my compiler will want to read the file at compile time -- what's the best way to not do that?
20:05dnolenbbloom: oh right, goog has it
20:05bbloomdnolen: oh? what is it?
20:05dnolengoog.object.containsKey
20:06bbloomah, ok
20:06bbloomi'll file that away for the future
20:06bbloomin the meantime, hack hack hack
20:07brehautlivingston: if you are using compojure, defroutes just wraps routes in a def
20:08hiredmanlivingston: there are a number of libraries for reading configs, carica (from the clojure team at sonian) and environ are two
20:09livingstonbrehaut: those are fine it's the part to wrap the middleware around those that was an issue,... the example I had put all that in a def and then called defservice on that...
20:09hiredmanI think environ does something config related, I've only ever used carica
20:10livingston.. if I avoid keeping the intermediate value and just wrap the code in defservice I'm fine -- I think..
20:10brehautim not familiar with defservice
20:10livingstonhiredman: oh. great. I haven't seen those, always better than reinventing the wheel - I'll take a look.
20:11hiredmancarica basically reads clojure maps from files on the classpath and merges them, so you can have an empty map that used for dev testing or whatever, or a map with some default values, and you put the file with the map with the real values on the classpath in production and it uses that
20:12hiredmanhttps://github.com/sonian/carica
20:12gfrederickshiredman: you normally have a build step that copies an env-specific "config.clj" onto the classpath?
20:13hiredmanlivingston: but generally having a top level form that does i/o like that is a bad idea
20:13livingstonyeah I know -- that's why I was trying to avoid it - more importantly I can't even compile it
20:14hiredmangfredericks: no, the environment specific config (that overrides the defaults) is written by chef to a known place, and the launcher script always puts that known place in the right place on the classpath
20:14hiredman(for our setup)
20:14livingstonbrehaut: defservice is for ring to create a servelet that will play nicely in tomcat
20:14hiredmanyou certainly could do some kind of build step to pre-brake everything in
20:15hiredmantechnomancy: hey now http://openjdk.java.net/jeps/118
20:16technomancyhiredman: whoa daaaaang
20:16technomancynice
20:17hiredmanslated for java 8
20:18hiredmanhttp://mail.openjdk.java.net/pipermail/jdk8-dev/2013-May/002575.html
20:20tomjackwhich is slated for 2014 sometime?
20:21brainproxyhiredman: would the implication be that you could introspect a compiled functions parameters list?
20:21hiredmanbrainproxy: if the clojure compiler was extended to emit the attributes
20:22brainproxyhiredman: that would be nice
20:22brainproxyI was just thinking of that today actually
20:22brainproxyI learned a trick for doing effectively that in javascript (at runtime!) the other day
20:22hiredmanyou can currently look at the debugging information (which isn't really exposed through the java reflection api) which tells you the name of locals (and args) and their scope
20:23brainproxyhttps://github.com/michaelsbradleyjr/jonas/blob/master/jonas.js#L1519
20:23hiredmanso if a local has a scoping starting at 0, then it is likely an arg
20:23brainproxy^ you can use that technique to smartly build "environments" that are not dependent on the position of parameters, but only on their name
20:24hiredmangross
20:25brainproxytrue, but it works like a hose :D
20:25hiredmanby "environment" you mean a map
20:26brainproxyhiredman: sure, or a mori hash-map :)
20:33SgeoSo, Clojure/West videos are going online
20:34Morgawrwow, takes around a couple of minutes to start a simple repl on my raspberry pi, haha
20:34Morgawrand lein takes 5-10 minutes without output when trying to run the repl, not sure if it hangs or if it just takes forever
20:35hiredmanwhich jvm?
20:35dnolenbrainproxy: heh if only JS had real reflection
20:35Morgawrhiredman: I think I got the openjvm-headless
20:35hiredmanthe pi is hard float, and last I checked there wasn't a real jvm released for it
20:36MorgawrI'm using raspbian, it has hard float packages but I'm not sure if the jvm has been ported to that (probably not)
20:36tomjackSgeo: at infoq?
20:36brainproxydnolen: true that
20:36Sgeotomjack, I assume so, not sure. Saw it on Twitter
20:36n_bit's so slow as to not really be worth it Morgawr
20:36SgeoI just want to see the Racket talk >.>
20:37hiredmanthe beaglebone has a bit of an edge, older hardware, better support
20:37Sgeotomjack, https://twitter.com/ClojureWest/status/339344089940099074
20:37Morgawrn_b: yeah, probably... what a shame
20:37tomjackah right, trickling out :)
20:38bbloomdnolen: ok so there is a blocking sub-issue: the AST doesn't provide any info for differentiating :var from :the-var from :some-thing-that-looks-sorta-like-a-var-and-hijacks-a-common-emit-code-path
20:38SgeoI wonder if #lang clojure would work well on Raspberry Pi
20:38n_bI'd love to write my home automation stuff in clj and run it on the Pi, but I think between the limited RAM and my unfamiliarity with JVM it would be a recipe for disaster.
20:38bbloomdnolen: for example, (set! some-var 123)
20:38SgeoAlthough I guess that's not real Clojure
20:38hiredmanapparently you can install a sof float linux distro on the pi and use the soft float jvm
20:38hiredmanhttp://www.oracle.com/technetwork/articles/java/raspberrypi-1704896.html#Java
20:38Morgawrhiredman: yeah, I had normal debian (soft float) before but it's not going to make any difference afaik
20:38hiredmanhmm
20:39dnolenbbloom: ok, separate ticket+patch for that please
20:39n_bMight be slightly better on a ModelBv2 with the 512 RAM
20:39tomjackwhat are things that sort of look like vars?
20:39Morgawrand yeah, my model has 256MB of ram so that's also a bother
20:39bbloomdnolen: after i finish this hack hack hack proof of concept
20:39dnolenbbloom: k
20:40hiredmanah, my beaglebone has 512mb
20:40dnolentomjack: bbloom is talking about CLJS compiler internals, vars are any symbol that appears in source in that respect
20:40n_bsomething like a Beaglebone Black as the "core" of the system with RPI endpoints might make more sense
20:40tomjackso like a mutable deftype field?
20:41n_bor really Arduinos with an ethernet shield for prototyping and some custom boards once everything is solidified
20:41dnolenMorgawr: you could always run a CLJS program - V8/Node.js is fast on RPi from what I've heard
20:41hiredmanhttps://www.youtube.com/watch?v=QPN2DFrlrYo#t=50s I have a little rover running clojure
20:41bbloomorg.mozilla.javascript.EvaluatorException: Encountered code generation error while compiling function "39": Program too complex: too big jump offset (cljs/core.cljs#2402)
20:41Morgawryeah, I guess.. although I don't really dig node.js
20:41bbloomlol weeee
20:41bbloom:-)
20:42Morgawrmine was mostly just some personal interest, normally I use clojurescript for game development (or at least try to) on the browser
20:42dnolenheh
20:43dnolenbrainproxy: thanks again for reviving mori, seems like a few people are interested :)
20:43Sgeomori?
20:43brainproxydnolen: sure thing, and I'm glad to hear that
20:43brainproxyI saw the post on HN as well
20:43dnolenSgeo: CLJS persistent data structures as a JS library
20:43Sgeodnolen, ah, neat
20:44dnolenSgeo: mostly targeting Node.js since it's not a small dependency.
20:44brainproxySgeo: http://swannodette.github.io/mori/
20:44SgeoOh, node.js... wake me up when it gets first-class continuations >.>
20:44brainproxySgeo: it's all pre-compiled so you can just require it or load it with a script tag
20:44brainproxySgeo: my Cont impl is working
20:44brainproxyas is callCC
20:45brainproxyand there is a promises-backed variant of both
20:45brainproxypCont, pCont.callCC
20:45tomjackbrainproxy: clj, cljs, or what?
20:45brainproxytomjack: vanilla javascript
20:45bbloomdnolen: ok, so apparently :var has gotten much more tangled up since i last attempted this… :-/
20:45Sgeobrainproxy, hmm
20:45bbloomdnolen: my hack hack hack solution won't really work without untangling that
20:45brainproxySgeo: https://gist.github.com/michaelsbradleyjr/5655300
20:45brainproxy^ that is to be refined further in the next day or so
20:46brainproxybut it works as is now
20:46brainproxyI'm looking now to take a cue from haskell and implement most of the monads as transformers on the Identity monad
20:46brainproxywhich will help w/ code reuse
20:47brainproxyCont and pCont will thus be ContT applied to Identity and pIdentity, respectively
20:48tomjackhah 'pIdentity' I love it
20:49brainproxytomjack: the idea is that the p.. variants are "promises backed", so each step in a monadic computation involves a step across the event loop
20:49brainproxywhereas the non p.. are synchronous
20:50tomjackI usually call it 'Deref' or 'Future' or something which obscures its similarity to Identity
20:50Sgeobrainproxy, have you had any exposure to lenses?
20:50brainproxySgeo: just a little, I need to study delimited conts a bit more
20:51brainproxyI'm fairly certain I can build a reactive layer and lenses layer using shift/reset
20:51tomjackbut pIdentity is kind of weird, huh, it's an applicative from a monad by baking in a deep join?
20:51Sgeobrainproxy, on the topic of delimited conts, have you seen the work by Oleg stating that undelimited conts are bad?
20:51brainproxySgeo: yep
20:51tomjackor is your pIdentity a monad which violates the laws :)
20:52brainproxytomjack: I think it will not violate them
20:52brainproxybut the next day or so will tell
20:52brainproxythe monad laws are passing fine for State, pstate, Cont, pCont
20:53brainproxytomjack: see for example https://github.com/michaelsbradleyjr/jonas/blob/master/spec/jonas.spec.js#L453
20:54tomjackwhere's pIdentity?
20:54brainproxyhaven't written it yet
20:54brainproxy:p
20:54brainproxyi'm doing some refactoring
20:55brainproxyright now I just have some monads in p and non-p flavors
20:55brainproxyneed to move to transformers that use p and non-p identity
20:55brehautbrainproxy: we need to know when you have P and NP being equivalent
20:55brainproxybrehaut: different p and np
20:55brainproxy:D
20:58ohpauleezIs there a way to reflect on the nREPL server?
20:58ohpauleezto probe it for its middleware or commands it responds to?
20:59Morgawrguys.. what's the fundamental difference between apply and reduce? I mean, I get that apply is called on a list of parameters + a collection and reduce is called on val + collection (or just a collection) but I don't get the fundamental difference
21:00gfrederickswelp
21:00gfredericksthis came up a couple days ago
21:00amalloy&(reduce (partial list '+) [1 2 3 4 5])
21:00lazybot⇒ (+ (+ (+ (+ 1 2) 3) 4) 5)
21:00amalloy&(apply (partial list '+) [1 2 3 4 5])
21:00lazybot⇒ (+ 1 2 3 4 5)
21:00ohpauleezMorgawr: Apply takes a sequence of items (like a vector, seq, or list) and calls the function as if those args were passed into it
21:00ohpauleezit's used a lot with functions that take varargs
21:01ohpauleezreduce is used to build values up, or reduce them down
21:01MorgawrI see, thanks, that actually makes sense
21:01ohpauleezYou see reduce a lot to build up a new map or vector, or to extract a single result (like reducing addition)
21:02gfredericks(apply foo coll) vs (reduce foo coll) -- in the former foo is called one, in the latter many times
21:02gfredericksin the former it's called with many args; in the latter with 2
21:02ohpauleez&(reduce conj [] '(1 2 3 4 5))
21:02lazybot⇒ [1 2 3 4 5]
21:03Sgeo&(apply conj '(1 2 3 4 5))
21:03lazybotjava.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentCollection
21:03SgeoThat... wasn't quite the error I was hoping for
21:03Morgawrso, I should be using apply when dealing with a function that takes all the parameteres from the collection, and reduce when I want to call the function "iteratively" on pairs of parameters?
21:03ohpauleez&(apply conj [] '(1 2 3 4 5))
21:03lazybot⇒ [1 2 3 4 5]
21:04ohpauleez(shhhh it works because of conj magic)
21:04gfredericksMorgawr: not really on pairs -- with reduce, the first argument is going to be the return value of the last call
21:04livingstonI know in some variants of lisp reduce + is far faster than apply + especially for long lists
21:05MorgawrI see, it makes sense now, thanks
21:05Sgeo&(reduce + [1 2 3]) is the same as (+ (+ 1 2) 3) I ... think
21:05lazybot⇒ 6
21:05amalloylivingston: in clojure i think it's quite likely that apply + is faster
21:05amalloywell
21:05ohpauleez&(reduce (fn [[accum new-value]] (str accum " :: " new)) "START" ["one" "two" "END"])
21:05lazybotjava.lang.RuntimeException: Unable to resolve symbol: new in this context
21:05ohpauleez&(reduce (fn [[accum new-value]] (str accum " :: " new-value)) "START" ["one" "two" "END"])
21:05lazybotclojure.lang.ArityException: Wrong number of args (2) passed to: sandbox10042$eval13881$fn
21:05ohpauleezwomp
21:06ohpauleezAlso, that's a bad example haha
21:06amalloyhm. no, that's not true. i spoke hastily
21:06gfrederickscoming up with good examples for this is hard
21:06amalloythat's why i just use my (partial list '+) example
21:06amalloyi think it's a pretty good visualization of the alternatives
21:06tomjackbrainproxy: looks pretty cool, with mori+wisp+that would be interesting
21:06ohpauleezamalloy: At one point in Clojure's history, apply was faster
21:06brainproxytomjack: wisp?
21:06ohpauleezI'm not sure if it's still the case
21:06gfredericks(reduce #(hash-map :first %1 :second %2) [1 2 3 4])
21:06gfredericks,(reduce #(hash-map :first %1 :second %2) [1 2 3 4])
21:06clojurebot{:first {:first {:first 1, :second 2}, :second 3}, :second 4}
21:06brainproxytomjack: oh right
21:07amalloyohpauleez: are you sure? i think apply has always just delegated to reduce
21:07tomjackbut only if I can't convince someone to switch from js to cljs, which happens to be true :)
21:07brainproxytomjack: I'm trying to get the core parts to a place where I can write a really killer mDo
21:07livingstonyeah usually the apply form has more list foolery to do and ends up using the variadic (sp?) form of the function - the compiler can't be much help there, but with + for example you get the more effecient two argument form
21:07amalloyfor sure, (+ a b c d e) is faster than (reduce + [a b c d e]), because it inlines well, but using apply loses that
21:08brainproxytomjack: I dont' have macros, but by dogfooding some "power tools" within the lib, I can a very slick monadic "do" like thing working, I'm fairly confident
21:08brainproxycan *get a...
21:08SgeoMonadic do in Javascript?
21:08SgeoIf it looks nice, that would make me happy.
21:08brainproxySgeo: yes, basically
21:08brainproxyit will look okay
21:09brainproxynot "make you dance for joy" quality, but pretty decent
21:09Sgeooh
21:10brainproxyand for the "left-hand side" stuff, a coworker is writing a parser so can you use clojure-standard destructuring syntax
21:11brainproxy"{y z :as m}", function (x) { mReturn { y: 7, z: "eight" } }
21:12brainproxythat will 'just work', in the context of a "program" you pass to say pState.mDo
21:12amalloythat must require eval, right brainproxy?
21:12brainproxyamalloy: nope, zero use of eval
21:13brainproxythe initial version is compiled using PEG.js; to be replaced in the near-ish future by a parser that's built up using the jonas API itself
21:13brainproxyi mean initial version of the destructuring syntax parser
21:14brainproxythe "problem" with the PEG.js version is that it consists of a *lot* of braindead js code
21:14brainproxyno eval, but bloats the lib
21:15brainproxyabove I should have `... return mReturn ...`
21:15brainproxyforgot the js return
21:15amalloyand also parens around {y:7,z:"eight"}, i imagine
21:16brainproxyamalloy: lolz, yep
21:16brainproxytyped it out too quickly in irc
21:18brainproxythe thing that will actually make jonas particularly wortwhile is combining it with mori
21:18brainproxytomjack is right about that
21:21brainproxyI would love to use clojurescript on the web client side of things, but for various reasons that's not going to happen... so... I'm aiming to create something that will make dev'ing highly concurrent vanilla js programs more pleasant
21:30tomjackbrainproxy: yeah, looks very cool
21:33brainproxytomjack: thanks, lots to do, hopefully in the very near future it will be mostly useable with some examples, etc.
21:43tomjackhmm, async test https://www.refheap.com/b83fa0862b53ae255094a92ee
21:45tomjackwith an interface like this, even with a good bound-fn in cljs, users will have to remember to use it in order for their tests not to break
21:45tomjackeven if they don't use dynamic vars in their async code at all
21:50tomjacknew project: rewrite clojure.test
21:51tomjack..though if you stick to core.async you won't have to remember, just if you do a manual setTimeout or drop a fn into angular or something
21:54livingstonI'm trying to use friend-oauth2 with google, and it shows the "allow access" button and takes me to the call back page which bounces me to auth page over and over anyone seen anything like that before?
21:55livingstonit's like friend doesn't recognize the authentication
22:14tshauckHi, how could I put multiple requires into one statement in a file... I keep getting an error that lists inside prefix names must not contain periods
22:14gfredericks(:require [foo.bar :as baz] [bang.bazoozle :as flamboyant])
22:16gfredericksusually not enough or too many square brackets is what trips people up
22:16tshauckgfredericks: cool, thanks, I was doing (:require [[foo.bar :as bar][bang.boo :as boo]]) so ya... too many
22:29livingstonanyone know friend / friend-oath2? I seem to get the callback after authenticating but then my server (presumably friend) kicks the request back out with a 302? right back to reauthenticate
22:37bbloomhmmmm how exactly do tagged literals & metadata interact? i wonder...
22:39bbloom(meta (binding [*data-readers* {'foo identity}] (read-string "^:bar #foo []")))
22:39tomjackthey interact as you'd expect I think
22:39bbloom,(meta (binding [*data-readers* {'foo identity}] (read-string "^:bar #foo []")))
22:39clojurebot{:bar true}
22:39bbloom,(meta (binding [*data-readers* {'foo identity}] (read-string "^:bar #foo 123")))
22:39clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Metadata can only be applied to IMetas>
22:39tomjackoh, I was thinking of ##foo bar
22:39tomjacker, ##foo bar baz
22:39bbloom,(meta (binding [*data-readers* {'foo identity}] (read-string "#foo ^:bar 123")))
22:39clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Metadata can only be applied to IMetas>
22:39bbloom,(meta (binding [*data-readers* {'foo identity}] (read-string "#foo ^:bar []")))
22:39clojurebot{:bar true}
22:39bbloomseems to work either way
22:40tomjackwith identity, yeah
22:41bbloomoh yeah… hmm
22:41tomjackdb/fn for example will likely destroy inner meta, and maybe explode on outer meta ?
22:42bbloom,(meta (let [discard #(with-meta % nil)] (binding [*data-readers* {'foo discard}] (read-string "#foo ^:baz []"))))
22:42clojurebotnil
22:42bbloom,(meta (let [discard #(with-meta % nil)] (binding [*data-readers* {'foo discard}] (read-string "^:bar #foo []"))))
22:42clojurebot{:bar true}
22:42bbloomneat.
22:46tomjackcemerick: https://github.com/tomjack/clojurescript.test/compare/draft-async
22:46tomjackbbloom: so you're stuck on that sub-issue?
22:46cemericktomjack: I'm hyper-occupied; maybe open an issue or start a thread on the cljs list?
22:47bbloomtomjack: just don't have the mental capacity today
22:47cemericktomjack: thanks, though, the URL sounds interesting :-)
22:47bbloomnaming help please: what's the opposite of a "composite" datatype in clojure? my best right now is "scalar", since "atomic" is so overloaded. but it seems to me like the opposite of "scalar" is "vector" which is also overloaded….
22:47tomjackcemerick: no prob, just thought you'd be interested. I'll post maybe later, needs more thought/work
22:47bbloomeither way, if you had {:foo :scalar} and {:foo :vector}, what would :foo be better as?
22:47bbloom:type-type :-)
22:48bbloomor rather {:foo :composite}
22:48gfredericksbbloom: I've heard of scalar used to mean this quite a lot
22:49bbloomgfredericks: ok cool. so then do you also have a name for the "enum" so to speak?
22:49gfredericksthough I guess now that I think about math vectors it doesn't really capture the same concept :/
22:49gfredericksin linear algebra scalars are not just components of vectors but quantities by which you can "scale" them
22:50gfrederickswhich makes me like atoms a lot more but it is too overloaded like you say
22:50bbloomyeah, my linear algebra was at one point pretty good, hence the discomfort with the name collision
22:50bbloomi'm much more concerned with what you would call the set #{:scalar :composite}
22:50bbloomb/c i have no idea lol
22:51gfredericksthe universe?
22:51bbloomno, not the set of objects whos types are in the set of scalars and composites
22:51bbloomthe literal set of :scalar and :composite, haha
22:51bbloomclassic indirection error ;-)
22:54TimMcOh, it is clearly a :composite.
22:54TimMcDuh.
22:55bbloomenum SomethingHere { SCALAR = 1, COMPOSITE = 2 }; // help me :-)
22:55tomjackstructure?
22:56bbloom{:structure :scalar …} and {:structure :composite …} hmm maybe
22:56gfrederickstype categories?
22:56tomjack(is (false? (structure? scalar))) (is (true? (structure? composite)))
22:56gfredericksthere's some meta thing going on here is there not?
22:57bbloomif you called them "categories" then you'd have the same problem when you chose another dimension by which to partition. really it's the name for one category of categories
22:58bbloomtomjack wins for now, since my asking this question is really just because i am avoiding the work of actually writing code, but let me know if anybody has any better ideas :-)
22:59tomjackor the complement, simple?
22:59tomjackis it basically one/many or no?
23:08cmajor71bbloom: {:structure :discrete …} and {:structure :composite …} ?
23:09bbloomcmajor71: hmm maybe
23:09TimMc&(apply str "structure-" (repeatedly 4 #(rand-int 10))) ;; bbloom
23:09lazybot⇒ "structure-4983"
23:10tomjackis a vector not discrete?
23:11bbloomi think i'm gonna get around the problem by cheating: I only really need to know :list, :vector, :map, :set, or not one of those… so nil is a perfectly fine value for :composite :-P
23:12cmajor71tomjack: I was going from discrete in "individual" sense
23:13bbloomwords: there are simultaneously too many and too few of them.
23:13gfredericksalso characters?
23:17tomjackshould core.async/{put!,take!} in cljs automatically bound-fn the handler?
23:17tomjackhmm, well, the clojure versions don't, so I guess not..
23:18TimMcbbloom: Atomicity
23:19TimMcHowManyPrimitivesThisThingCanBeMadeOf
23:19bbloom....Factory
23:19gfredericksif you want to make it look enterprisey, camel-case it
23:20bbloomThatIsWhyIWriteAllMyContractsLikeThisAndSimplyIncreaseMyRates
23:20gfredericksit's like speaking in a particular accent
23:21TimMc⟜-hipsters-use-kebab-case-
23:31sinistersnaremight sound stupid, but how do i run a clojure file from the command line? i have this code http://bpaste.net/show/IgFjcHOzkKWt3R72Kx6Y/ how do i run it from the command line?
23:35amalloy$google clojure shebang
23:35lazybot[Clojure Programming/Tutorials and Tips - Wikibooks, open books for ...] http://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips
23:35n_bsinistersnare: Does `clj filename.clj` not work?
23:36bbloomsinistersnare: if you don't need a shell script for some other reason, you're better off opening `lein repl` and using load-file or whatever keyboard shortcut your editor provides for that :-)
23:37sinistersnarei dont think a shebang works in windows? and clj is not recognized as a command
23:37sinistersnarei have the clojure folder on my path
23:37sinistersnarehow do i install that command?
23:37bbloomsinistersnare: https://github.com/technomancy/leiningen
23:38sinistersnarei use leiningen, but i want to try out ahead of time compilation, not through an interpreter
23:38bbloomlein can produce a jar for you with a main function that you can run with the java -jar command
23:39sinistersnarebut what if i dont have a main funtion? like with the code i put up
23:40bbloomsinistersnare: wrap lins 30 to 39 in a main fn
23:40sinistersnarebbloom: ok
23:40bbloomsee the lein docs for how that works
23:41sinistersnarebbloom: i know indentation is bad, but this? http://bpaste.net/show/y1vrG8RAvqy1bTsTma3z/ ok ill check the docs