#clojure logs

2012-11-19

00:09ForSparePartsarrdem, It's a good thought, though I'd like to be able to do a play/pause/rewind sort of thing -- I'd need some kind of caching trickery to remember recently-used versions in order to get efficient enough behavior.
00:13arrdemForSpareParts: my concern is that in making such a cache of usable size you would either blow out your memory limit or end up serializing entire states by saving a full snapshot as opposed to the changes.
00:15adiabatic(cross-posted from #noir) green-as-grass newbie question: I put (defpage "/my-page" …) into my views/welcome.clj like the default website said to, but I get an error in the server console of "Caused by: java.lang.RuntimeException: Unable to resolve symbol: html in this context". Where is `html` supposed to come from?
00:15ForSparePartsarrdem, That's what's been on my mind, yeah. I'd have to allow the user to set some kind of limit and let data beyond the limit fall out of the history, I think.
00:17arrdemForSpareParts: one thing you could look into is retaining "cursors" or reset points at some interval in the history. That way if you want to back up you don't have to integrate from t=0 but you don't continually dump either.
00:17arrdemso if you say I will retain three snapshots at 100, 200 and 300 changes back, reverting in that range should be pretty fast.
00:17arrdembeyond that, the user is on their own.
00:25det4lDoes anyone have any good resources for someone who understands the lisp stuff but wants to understand the java stuff like the classpath, serverlets, javabeans, etc?
00:28Sgeodet4l, nice to meet someone in the same boat as me
00:29SgeoI'm a Haskellish Lispish person
00:29SgeoNot much of a Java person
00:29SgeoActually, I think there are others here in that boat
00:29SgeoIt's not a very rare boat
00:46unnaliSgeo: I'd say it's quite common. :)
00:46unnaliJava's definitely not my thing.
00:47yedihow important is java knowledge when coding?
00:47Foxboronyedi, not very.
00:47FoxboronYou will end up needing some knowledge about JDK and java compiling and what not
00:48Foxboronbasically, you dont need anything before you start as you get what you need along the way :3
01:05muhooyou'll learn more java than you ever wanted to
01:05unnalihahaha
01:31wbs_hi to all!
01:31wbs_i'm using compojure and ring
01:32wbs_how i can use booth: wrap-session and wrap-json-params ?
01:33arrdemwbs_: I suspect that both are macros that provide some preprocessing... check out the source and see if you can create something equivalent to composing them?
01:51aperiodicyou use the arrow macro
01:52aperiodic(-> routes wrap-x wrap-y)
01:59arrdemwbs_: aperiodic's got you, sorry for sending you off on a rabbit trail.
02:00SgeoWhy do I think of (Object.) as being so heavyweight when it's probably the lightest-weight thing I could make?
02:01SgeoIt suddenly occurs to me that primitives are lighter
02:02wbs_aperiodic yes, but in parsed json map i can't find session...
02:33aperiodicwbs_: odd, wrap-session works fine for me
02:33aperiodicwbs_: what do you mean by "parsed json map"?
02:39Apage43Sgeo: probably the scary . that means you're in "interop land". How does (keyword (gensym)) feel in comparison?
02:41Sgeo(keyword (gensym)) looks like it should be so much more lightweight, even though I know it isn't
02:41SgeoI think it's the interop thing, yeah
02:41SgeoAnd also the capital O for some reason
02:43Apage43(defn obj [] (Object.)) ;)
03:28wbs_aperiodic if wrap-session is single macros it's ok. but if i want use wrap-session with wrap-json-params it doesn't work
03:45Sgeo,(and)
03:46clojurebottrue
03:46Sgeo,(or)
03:46clojurebotnil
04:10bbloomany word on when/if the conj videos will be available?
04:23tomojso say you want a macro which walks a body passed to it, replacing invocations of some var with invocations of another
04:24tomojif the macro is called in a scope where the name of the var is clobbered by a local binding, and you pass the env to resolve, you're good
04:25tomojbut what if the clobbering occurs inside the body passed to the macro?
04:42scottjbbloom: have heard they will be made available, but I'd guess on a rolling release starting in a couple weeks and lasting several months
04:42bbloomscottj: thanks. too bad i couldn't have made it there in person :-/
04:42scottjbbloom: I think confreaks did the recording, so maybe they'll be on their site instead of blip
04:43bbloomscottj: k, i'lll keep an eye out
04:45scottjbbloom: confreaks did rubyconf which happened ~nov2 and they just posted all the videos, so maybe you'll get them in 3 weeks
04:45bbloomscottj: heh nice :-)
04:46bbloomscottj: hopefully just in time for holiday travel
04:46scottjI think rolling release like infoq does is smartest (most exposure/more views), but I sure like getting em all at once
05:06merodachcan you explain me what exacty the difference is between commute and alter?
05:07merodachas i understood sofar, if there is a modification on ref while transactions started with alter, the transaction will be rolled backed and will be retried with the updated value ?
05:09merodachand with commute, we got always updated value while running in a transaction?
05:11bbloommerodach: the difference has to do with retries and failures
05:11bbloomalter does a compare and, if the value has changed, will cause a retry
05:11bbloomcommute, however, will apply the operation regardless
05:11bbloommerodach: explaination here http://comments.gmane.org/gmane.comp.java.clojure.user/27176
05:12bbloomhowever, my experience has been that atoms are more pleasant to work with. if you need multiple values updated together, you can just stick a map in your atom
05:12bbloomswap! and reset! are pretty easy to understand compared to refs
05:13bbloomi'm not even sure when i'd ever use a ref instead of an atom
05:15bbloomalso interesting: http://blog.jayfields.com/2011/04/clojure-state-management.html
05:15tomojants seems like a pathological example
05:15bbloomtomoj: ?
05:15kralnamaste
05:16tomojants.clj
05:23bbloomtomoj: merodach hm yeah, i guess it makes sense when you have like 1 ref per thread and want some threads to communicate together
05:23bbloomhadn't considered that…. i'm so used to having just one IO thread in my apps
05:24bbloomtomoj: heh, thanks. some shit just clicked in my head from skimming that code. hadn't seen it before
05:24bbloomhttps://github.com/johnlawrenceaspden/hobby-code/blob/master/ants.clj is the version i found
05:25merodachit means that the commute allows non-repeatable reads, and can cause with update failures ... etc.
05:27bbloommerodach: the name (and doc string) suggests the intended behavior of commute: the function you give it should be either commutative, or you accept last-one-in-wins. the idea being that the order between threads is less strictly enforced
05:27merodachfor example we've got 2 transactions, A and B. A starts with a tranaaction and reads the counter = 2, whereas the B increments the counter to 3. but the A doesn't know that the counter has a new value
05:28pyrhi
05:28merodachand A increments also the counter to 3
05:28merodachand commits
05:29bbloomif i follow you, then alter will cause a retry, but commute should increment the counter to 4
05:30merodachhm *confusing*
05:30merodachhere found a pretty good article about this
05:30merodachwhich confirms my assumptions
05:30merodachhttp://squirrel.pl/blog/2010/07/13/clojure-alter-vs-commute/
06:22groundHello how can i get to th dll lib on win32 via clojure script?
06:23groundI dont really an expert in this stuff so i need solution as simple as possible
06:25maleghastground: I'm sorry I don't even understand what you are asking… What are you trying to achieve?
06:25clgvground: describe you problem in more detail, maybe by example
06:28groundIve got a script in vba that is able to work with for example ie or lotus notes (i understand it works with com objects) and i am intersting in how its looks like from the "clojure point of view" ?
06:28groundAnd shall i need some java knowledge?
06:29ucbground: if you're going to do pure clojure you don't need to know much java (I don't know more than the basics really)
06:30groundMore less i know how it works on vb c# and ruby (win32ole)
06:30tomoj&(clojure.pprint/pprint '(clojure.core/deref foo))
06:30lazybot⇒ @foo nil
06:30maleghastground: I've got to be honest, I've not written any VBA for years, but I am not particularly optimistic that you'll be able to easily write Clojure to interface with COM Objects...
06:30ucbground: you may want to check the CLR compiler/interpreter for clojure if you want to do OLE
06:36RaynesWHY HAVE FLASH SESSIONS FORSAKEN MEEEEEEE
06:37maleghasts/raides/raises
06:37RaynesDon't raid my eyebrow, man.
06:37RaynesI've been through enough.
06:37maleghastRaynes: Hey, I figure, but it was a typo
06:53ivenkysgents - looking for suggestions on small Clojure projects - for newbs
06:54maleghastivenkys: Are you looking for "stuff to do" or __actual__ cookbook-esque projects?
06:55ivenkysmaleghast: either i think -
06:56alexnixon&[(take 2 []) (drop 2 []) (take-last 2 []) (drop-last 2 [])]
06:56lazybot⇒ [() () nil ()]
06:56alexnixonwhy does take-last return nil?
06:56ivenkysmaleghast: fwiw - i have been through the Koans - (which i love) - and have done pieces of code converting from Java to Clojure - what would be good is if i can do a something small , as in manageable that would increase confidence and also allow me learn more
06:57maleghastivenkys: Well, for the former I would tend to recommend Project Euler (http://www.projecteuler.net/) and 4Clojure (http://www.4clojure.com) and then there are some commonly discussed standards like Towers of Hanoi, Game of Life etc. You could also look at getting the newbs in question into fun libraries like Quil and Overtone
06:57tomojalexnixon: looks like an implementation detail, take-last doesn't return a lazy seq
06:58tgoossensi'm searchig some examples of games writtten in clojure that don't use any identity
06:58maleghastAs for actual projects… I'm a middleware developer and sometime web-dev, so my natural bias is toward suggesting something like porting an existing app into Clojure, using compojure (for example), but there a million different things that you could do
06:58tkoskineivenkys: I am writing a compiler (for a very simply language) to learn Clojure. :)
06:58alexnixontomoj: not being lazy makes sense, given it needs to count (and so realise) the entire seq
06:58tkoskines/simply/simple/
06:59alexnixontomoj: still, why does it return nil and not an empty list?
06:59ivenkysmaleghast: good suggestions - had forgotten about Euler
06:59tomojthose aren't empty lists, they're empty lazy seqs
06:59ucbivenkys: I'd also recommend you read http://prog21.dadgum.com/80.html
06:59tomojtake-last's definition could seemingly have been wrapped in (lazy-seq ...) like the others
06:59ucbivenkys: it's so far the best advice I've found for your question
07:00ivenkystkoskine: ah -.. - always the best way
07:00ivenkysucb: let me take a look at that -
07:01ivenkysucb: fwiw - i love James Hague's writing - no-bs and it fits on 1 screen :-)
07:01maleghastucb: That is good advice, as long as it allows for the idea that sometimes people just need a little inspiration as well
07:01ucbivenkys: yes :)
07:01ucbmaleghast: yes too :)
07:01maleghast:-)
07:01ucbin any case, I used to not take that advice to heart, now I do
07:02ivenkysmaleghast: ucb : tkoskine : gents , thanks for this - lots of food for thought there - i am taking it a week at a time and see how far i go in 4 -
07:02ucbivenkys: g'luck
07:02maleghastucb: Oh I completely agree - that advice / mindset is why I don't have any haskell, scala or io source code on my laptop right now… I'm fascinated by all 3 of them but I have no use for them whatsoever :-)
07:02tkoskineivenkys: No problem. Actually, I am killing 2..3 birds with one stone. I am also learning Antlr4 (beta) and making parser with it, and then studying all different compiler optimizations at the same time.
07:02ucbmaleghast: heh, good stuff
07:02ivenkysucb: danke schon
07:04ivenkystkoskine: fantastic - any specific "type" of simple language / parser
07:04alexnixontomoj: given the truthiness of (lazy-seq nil) and nil are different, do you think there's an argument for take-last to return a lazy sequence for consistency (despite it not actually being lazy)?
07:04tkoskineivenkys: Code is at https://bitbucket.org/tkoskine/antlr-ir/src - The syntax of the language is similar to Pascal/Ada/Oberon.
07:06tomojalexnixon: I dunno, maybe
07:06tomojif you're testing truthiness of seqs you almost surely should be calling seq on them anyway
07:06tgoossensin java when making a boardgame with "Piece" objects. I could give the piece a method ".canSharePositionWIth(Piece piece)". Which i think is a good way of encapsulating that logic. How would you achieve the same in clojure?
07:06tgoossens* a function in the map?
07:07tgoossensthe advantage of .cansharePosition is that I could "double dispatch"
07:07ivenkystkoskine: thanks for that - i am going to take a look at it -
07:07tomojwhich makes me realize, clojure makes a mistake analogous to the havoc I imagined wreaking on Reactive's Event monad
07:07tgoossenswhat is the idomatic way of doing a similar thing in clojure?
07:07tomoj(er, but maybe it's not a mistake)
07:10tomojtgoossens: it is hard to see how double dispatch would be advantageous there
07:11tgoossenswell
07:11tgoossensfor example
07:11tgoossensrobot.cansharepositionwith(wall)
07:12tgoossensit is possible that robot has only information that it cannot share position with another robot. And then asks the caller what he thinks about it
07:12tgoossensthe wall knows it cannot share position with anything
07:12tgoossensan item
07:12tgoossenscan share positiion with anything but a wall
07:12tgoossenswhich will become clear out of the double dispatch
07:14tgoossensor am i complecting stuff here?
07:14tgoossensif so. what would be a simpler way of doing this?
07:15RaynesYou just used the word 'complecting'. You're already a master Clojure programmer.
07:16tgoossensi've been doing 2 months investigating and learning from talks. I'm trying to become aware of those things.
07:16tgoossensAnd as an exercise
07:17tgoossenslast year i had a project (board game) in java (for university). And want to see how i would achieve the same
07:17tgoossensin a functional, idiomatic clojure way
07:17maleghastRaynes: *applause*
07:17tgoossenslol
07:18tomojhow do you know not to do triple dispatch?
07:18tomojand quadruple, and ...
07:18tomojI mean, what if both objects say "I dunno, ask the other guy"?
07:18tgoossensmmyes
07:19tgoossensa piece is just a "map" in my code
07:19clojurebotRoger.
07:19tgoossenswould it be a better idea to
07:19tgoossensadd a key
07:19tgoossens:canshare (fn [piece] ....)
07:20tomojI mean, in your java double dispatch, how does it stop at 2?
07:20tgoossensbecause only two objects are involved?
07:21tomojconsider: (defmulti can-share? (fn [a b] (type a)))
07:21tgoossensmmm
07:21tgoossensmultimethods
07:21tgoossensand perhaps using taxonomies?
07:21tgoossensbecause i don't want to edit
07:22tgoossensevery method everytime that i introduce a new sort of piece
07:22tgoossensnor edit
07:22tomoj(defmethod can-share? [:robot] [a b] (and (not= :wall b) (can-share? b a)))
07:22tgoossenstomoj: now you are using double dispatch arent you?
07:22tomojI'm trying to figure out what you meant
07:22tgoossensyes
07:23tgoossensnow i'm starting to think about it
07:23tomojif we did stuff like that, how would it not recur indefinitely blow the stack?
07:23tomojs/blow/and blow/
07:23tgoossensits actually pretty complex. To figure out how, why and when the dispatching will stop
07:23tomoj(also it probably shouldn't be #'type in the defmulti..)
07:24tgoossenstomoj: what do you think of my idea of using a function in the map? and using taxonomies
07:25tomojwell
07:25tomojI don't really understand the domain
07:25tomojputting the functions in the maps seems strange
07:26tgoossensmmm
07:26tomojbut I'm not sure what can-share? should mean
07:26tgoossenswait
07:26tgoossensi'll put it on pastebin
07:27tomojmultimethods might make sense
07:27tgoossensprobably
07:28tgoossenswhat must change when i introduce a new type of piece
07:29tomojI can't see past the double dispatch issue
07:29tomojbut if you have a default implementation, then nothing necessarily at all must change
07:30tgoossenstomoj: http://pastebin.com/brrRtqsS
07:31tomojI'm guessing those are three separate files?
07:31tgoossensyes
07:32tgoossensjust extracted the relevant methods out of them
07:32tomojso in order to determine that the stack will never blow, you have to look at all three files and keep them all in your head at once?
07:32tgoossensyes that's crazy
07:32tgoossenshence i task. whats an easier way?
07:32tomojI imagine instead representing all that information in one def
07:32tomojbut not sure how..
07:32tgoossensBecause i think it is reallly difficult to figure out. And be sure that there won't be an infinite
07:33tgoossensdispatching
07:33tgoossensalso doubting whether "complex" or "hard" is more relevant here
07:35tomojjust thinking: (defmulti can-overlap? (fn [a b] (set (:type a) (:type b)))) (defmethod can-overlap #{:robot :robot} [a b] (= a b))
07:35tomojeh :(
07:36tomojthat doesn't work out
07:37tgoossensthat will get really bloated after some time
07:37tgoossensand really difficult to keep track
07:38tgoossenswhether you have all cases
07:38RaynesGames are hard.
07:38RaynesStop programming and just be sarcastic like me.
07:38tomojwell
07:39tgoossensraynes: that was really useful advice ;)
07:39tgoossens:p
07:40tomojdoes it make sense to ask if a robot can share position with itself?
07:40tgoossensthat's what happens now
07:40tgoossensand that what's makes the dispatching stop
07:40tgoossensfrom going infinite
07:40tgoossenspiece1.canshare(piece2)
07:40tomojif the domain is really about the different types of things, you can represent the allowed configurations without worrying about identities
07:41tgoossensif piece1 doesn't know it
07:41tgoossensit will call
07:41tgoossenspiece2.canshare(piece1)
07:41tgoossensif piece2 doesn't know it
07:41tgoossenshmm no
07:41tgoossensno sorry
07:41tgoossensi'm wrong
07:42tomojI mean, obviously an individual piece can share position with itself, always
07:43tgoossensyes of course
07:43tgoossensthats trivial :p
07:43tomojthe simplest representation I can think of of the information in your paste is #{#{:robot :item}}
07:44tomojwhich could be interpreted to mean that there is one allowed configuration of piece types for a given location, any number of robots and items
07:45tomojwell.. #{#{:robot :item} #{:wall}} ?
07:46tgoossensgot to go. i made a post in the clojure google group
07:46tgoossensstill got to be approved
07:47tgoossensso thanks already
07:47tgoossensand maybe we speak again
07:48tomoj(every? (partial subset? pieces) #{#{:robot :item} #{:wall}})
07:48tomojoslt?
07:48tomoj5am :<
07:48tgoossenswow :p
07:49ucbanybody experiences with aleph/gloss in here? :)
07:49tgoossensalmost 2pm here :)
07:49ucb*experienced
07:49tgoossensbye
07:49tomojanyone?
07:49clojurebotJust 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 ..."
07:49tomojincidentally, yes, some..
07:50ucbheh
07:50ucbwell, I'm wondering how I can represent the following protocol in gloss
07:50tomojbut that doesn't mean I can help you, so better to just ask the question :)
07:51ucbthe client sends a single byte with 110, and the server responds with multiple messages shaped like :int64 (string :utf-8)
07:51ucbthat's fine, but the thing is this is all TCP and afaik, you can't really just decode messages in an aleph tcp-client since it's all streaing, etc. so you have to have your client have the frame at hand
07:52ucbthat's fine if you use headers, but in this case the frame should be able to infer from the 1st byte whether it's a single byte frame or a 4-byte+string frame
07:52ucband I just can't figure out how to do it :(
07:53tomojwhy infer that?
07:54tomojserver only ever sees the one-byte frame, and client only ever sees the 4-byte+string frame?
07:57ucbtomoj: sure, but afaik (keep in mind I'm not too knowledgeable in all things gloss/aleph) since it's TCP (I read this in the aleph google group) you can't just read a message from the channel and manually decode it
07:57ucbtomoj: so you have to create the tcp-client with :frame the-frame
07:57ucbtomoj: and then just (encode @client {:some "data"})
07:58ucbtomoj: assuming the frame has a header and can decode back and forth between server and client messages
07:58ucbtomoj: to be honest, I'd rather do the manual decoding, and that's how I started. But this cant-really-decode-tcp thing rained on my parade :(
08:00tomojoh, of course
08:01ucbso, most other messages in the protocol have a reserved byte for req/resp detection; that's the easy bit, but this other one really sucks :(
08:01ucbunless I break the 4 bytes in the response in :byte :byte :int16 and then glue them together myself?
08:02tomojI think you can pass separate frames for :encoder and :decoder
08:02ucboh? that'd be ideal!
08:03tomojlike (tcp-client {:host "localhost", :port 10000, :encoder (compile-frame :byte) :decoder (compile-frame [:int64 (string :utf-8)])}) ?
08:03ucbtomoj: I truly hope that works; let me try
08:04tomojhmm
08:05tomojI don't think I actually understand the code I was looking at, but maybe it works ...
08:06tomojsee doc for start-tcp-server
08:21AnderkentAnyone used clj-http? I'm having issues getting it to work with multipart requests
08:21ucbtomoj: sorry, real life got in the way, I'm going to try your suggestion now
08:23ucbtomoj: where in the src did you see what you saw? https://github.com/ztellman/aleph/blob/perf/src/aleph/tcp.clj
08:28ucbtomoj: perhaps you meant https://github.com/ztellman/aleph/blob/perf/src/aleph/formats.clj#L464
08:31deu5Hi. Do you know any bigger and more mature clojure framework then Noir ?
08:34ucbtomoj: that did it; thanks!
09:26rodnaphhi - i'm trying to use cljs-watch but getting NoClassDefFoundError clojure/main (have clojurescript and cljs-watch on my path already) - anyone know this tool, something obvious i'm missing? thanks
09:26rodnaphping ibdknox if ur online ;)
09:29rodnaphoh actually... i'm trying to use cljs-watch from a non-leiningen project - is this why it's not finding clojure?
09:30rodnaphhmm... no, cljs-watch seems to set the cp to use clojure from the clojurescript_home folder...
09:34gauravagHey any suggestions for testing?
09:48madsyIs there a tried-and-tested database library for Clojure?
09:48madsyI'd prefer a SQL backend, but anything goes really
09:48znDuffmadsy: Lots of 'em. I suggest SQLAlchemy if you're not sure what you want.
09:49madsyznDuff: Thanks
10:05antares_madsy: clojure.java.jdbc, database clients on http://clojurewerkz.org all count as battle tested
10:09oskarI'm doing some Java interop, the Java constructor is defined Fields(Comparable... fields), so I need to pass an array of Comparables, right? How can I construct one of those from a seq for example?
10:15ucb,(doc into-array)
10:15clojurebot"([aseq] [type aseq]); Returns an array with components set to the values in aseq. The array's component type is type if provided, or the type of the first value in aseq if present, or Object. All values in aseq must be compatible with the component type. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE."
10:16ucboskar: ˆˆˆˆˆˆˆ
10:21oskarucb thanks
10:21ucbnp
10:48jheandergood morning!
10:49rodnaphlate afternoon here ;)
10:50jheandernice :)
10:50ro_stsame. south africa?
10:50rodnaphuk
10:51rodnaphgood morning to you anyway jheander
10:52jheanderIf I have a piece of code that makes calls to a different module and I want to break this out to a separate library and be able to replace the module with a bunch of modules that all contains the same function signatures. How can I do this idiomatically in clojure? Protocols or multi methods?
10:53jheanderor maybe some dynamic namespace loading?
10:53rodnaphvijaykiran: :O ...
10:54znDuffjheander: That's not really enough information to decide on the appropriate construct
10:55znDuffjheander: If one has multiple modules implementing versions of those functions, how should the correct one be selected? If the answer is "type of the first argument", protocols are the right thing.
10:55FoxboronSomeone tell me if the Clojure community is overall very "Emacs > everything"?
10:56ro_stwe like emacs because of the excellent repl support
10:56ro_stand, we're writing lisp. emacs is a lisp. it's a natural fit
10:56ro_sti'd use sublime text 2 in a heartbeat if it had as good repl support and paredit
10:57ro_stbut, it doesn't. so, emacs :-)
10:57jheanderhmm..right. No, today I have a project where I have a layer that deals with a database, and then a processing layer with different kinds of functions that merge and do computations based on information from the DB layer. The app has grown quite a bit and I now want to break out the processing layer and have it work with any db module that contains the same function signatures. So basically there will (so far) only be one module implementing these functions
10:57jheanderany given context although they are probably always different.
10:57HodappFoxboron: #clojure has plenty of people on Eclipse, on IntelliJ, on Sublime Text (I think), on vim, and on Emacs. But it's my understanding that most Clojure devs use Emacs.
10:57znDuffFoxboron: the annual community survey covers editor choices.
10:58znDuff~survey
10:58clojurebotsurvey is http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/
10:58znDuffFoxboron: ^^^
10:58jheanderRight now I'm trying protocols together with alter-var-root and a dynamic var but it seems kind of cumbersome
10:58jheanderdon't really want to manually register my module that way, would be nice if loading it was enough...
10:59Foxboronhahahaha
10:59FoxboronSublime Text is not even on the list :P
11:00ro_sti use ST to search and browse, and emacs to edit and repl
11:00ro_stbut that's because i haven't dedicated a couple days to configuring helm yet
11:00jheanderplus I kind of have to define my functions twice, once with the real code in the module and once as a kind proxy-definition inside a reify of the protocol
11:08jheandermaybe multimethods would fit?
11:10AnderkentAny utility function to read bytes from input stream / file?
11:12Negdayenjheander: I might dynamically load the code in using (load _) if the modules all define the same namespace functions and are contained in their own file. i am curious as to the idiomatic solution, too, however.
11:16jheanderHow would you know which file to load inside the lib? Or would you dynamically load the lib-file inside the implementing module?
11:17Negdayenthe latter, yeah.
11:18pyrso what do people use when doing clojurescript for "apps" wrt routing ?
11:18pyris snout the de-facto standard ?
11:20jheanderI guess robert.hooke would work fine too :) Probably not very idiomatic though :)
11:26DaReaper5Hi, I am having trouble understanding exactly what deref/@ is/does
11:26S11001001,(doc deref) ; DaReaper5, in which sense?
11:26clojurebot"([ref] [ref timeout-ms timeout-val]); Also reader macro: @ref/@agent/@var/@atom/@delay/@future/@promise. Within a transaction, returns the in-transaction-value of ref, else returns the most-recently-committed value of ref. When applied to a var, agent or atom, returns its current state. When applied to a delay, forces it if not already forced. When applied to a future, will block if computation n...
11:27DaReaper5Nosrat, say what?
11:27S11001001DaReaper5: spammy
11:28DaReaper5? Nosrat is spamming?
11:28S11001001apparently.
11:28DaReaper5Wierd
11:28DaReaper5Maybe he does not like my name
11:28DaReaper5Or broken
11:28CaptainDerpTest
11:29CaptainDerphmm
11:29uvtcDaReaper5 , CaptainDerp : Do you know Python?
11:29S11001001Not getting your automessaging scripts right counts as spam.
11:29CaptainDerpuvtc no
11:29CaptainDerpS11001001 sorry i dont know what you mean
11:29uvtcWhat is "-Nosrat-"?
11:30S11001001uvtc, CaptainDerp: someone who set up a script wrong, or a terrible bot; either way, mass pointless messaging on every msg counts as spam.
11:30CaptainDerpOk, so why i am confused with deref is that I do not find their examples usful. It is just returning the number defined. If i could have an example of deref compared to something else that would be helpful
11:30S11001001uvtc: the - indicates the message type was NOTICE instead of PRIVMSG in the irc protocol
11:32uvtcCaptainDerp: Well, in Clojure, names refer directly to things, and are automatically "dereferenced". You write `(def a 3)`, then `a` and you get back `3` automatically. But Clojure *also* has "reference types", which are explicit references that you manually dereference when you want to access their values.
11:32uvtcS11001001: thanks for the info. :)
11:32S11001001CaptainDerp: ##(let [x (atom 42)] (+ x 3))
11:32lazybotjava.lang.ClassCastException: clojure.lang.Atom cannot be cast to java.lang.Number
11:32S11001001CaptainDerp: ##(let [x (atom 42)] (+ @x 3))
11:32lazybot⇒ 45
11:33CaptainDerpOk makes sence now, that helps alot
11:33CaptainDerpQuiet Nosrat :P
11:33CaptainDerpThat one example and explanation helped more than the offical doc or stackoverflow haha
11:34uvtc:)
11:35CaptainDerpAnother question, is it extreamly bad practice to have a global def in clojure which multiple threads may be accessing?
11:36S11001001CaptainDerp: side effects should be avoided
11:37CaptainDerpIs it best to wrap the global def in an atom?
11:37S11001001CaptainDerp: if you aren't performing side-effects on it, there is no reason to do so.
11:37uvtcCaptainDerp: My understanding is that you should try to restrict your use of global mutable state as much as possible, but you still need it sometimes.
11:39ejacksonCaptainDerp: if it doesn't change then no
11:39ejacksonif it does then it needs to be a def to a reference type
11:39CaptainDerpS11001001 basically I need a map that is accessable my multiple threads which contain a blocking queue where the key is tied to the user session (maybe tmi?)
11:40S11001001CaptainDerp: depends on whether you change the map.
11:40CaptainDerpS11001001 yes i do
11:40S11001001CaptainDerp: then follow ejackson's advice
11:40CaptainDerpthat is why i was thinking that atom might be a good idea
11:41CaptainDerpwow nosrat is anoying, should i rejoin?
11:42S11001001CaptainDerp: be warned that atom works in fewer situations than ref
11:43uvtcCaptainDerp: I've never seen these "-Nosrat-" notices before.
11:44ejacksonwhat are they ?
11:45ejacksonwho did I annoy ?
11:45CaptainDerpi think the question is who did i annoy
11:46CaptainDerpok i think im getting a better handle on reference types, but what is the difference between a "ref" and an "atom". I am specifically confused about "coordinated" vs "independent"
11:46uvtcejackson: every time I post a message, I get a message ( S11001001 points out that they are NOTICE s) from "-Nosrat-" oddly telling me not to use profanity.
11:46znDuffCaptainDerp: refs can participate in transactions
11:46uvtcejackson: why do you ask "who did I annoy?". Is it your bot?
11:46znDuffCaptainDerp: ...so you can have a bunch of refs which, to the world outside a transaction, appear to change their values all at once or not at all.
11:47znDuffCaptainDerp: whereas each atom is independent of every other; they aren't transactional in nature.
11:47ejacksonI have no bots - but every time I say anything it has sage advice for me
11:47ejacksonperhaps as they're notices you're not seeing them all
11:47CaptainDerpejackson ... so are you saying we are the only ones seeing nosrat and not other people?
11:47uvtcejackson: I only see the ones in reply to messages I type.
11:47duck1123CaptainDerp: The analogy I've gotten is if you've received two events at the same time, do you care that they both happen in the order they're recieved, or just that they both happen properly
11:48unic0rn(just a test - ignore this message)
11:48ejacksonyes me too - I only see nosrat whenever I say anything
11:48unic0rnno notice here.
11:48ejacksoni'm guessing its the same for everybody else ?
11:48duck1123I'm not seeing these notices
11:48CaptainDerpduck1123 ok i think i understand now
11:48unic0rnoh here it is.
11:48metellus(test)
11:48CaptainDerpRefs coordinate among eachother
11:48CaptainDerpatoms do not
11:48CaptainDerpwhich means an atom is what i need
11:48ejacksonCaptainDerp: that's the correct understanding
11:49ejacksonbit its those scala kids having a laugh at our expense :)
11:49duck1123CaptainDerp: So, say you're incrementing a counter. You don't really care that one increments before the other, just that they both do the right thing when they get to go through
11:50TimMcIf you need a coordinated counter, you can use `commute` on refs.
11:50CaptainDerpOk, that is a really cool feature. Good to know
11:51jbroomeping
11:52SgeoIs there any way to restart a dosync transaction if an arbitrary condition is not met?
11:54Guest98876 Sgeo: refs can be created with a validate-fn
11:55TimMcSgeo: Sounds hinky, what's the use-case?
11:55uvtctest
11:55uvtcUgh. Tried `/ignore -Nosrat- NOTI` but that didn't do it.
11:56SgeoHave a hash-map I want to update as I scan the world for objects. But as I do that, I may also receive events of objects being added/deleted. So I want to hold off acting on those until my scan is done
11:56uvtcanother test (sorry)
11:56znDuff~ops
11:56clojurebotHuh?
11:56znDuffBah. Was hoping there would be someone handy to kick the bot.
11:57AnderkentSgeo: why not have the entire scan in one transaction? Then no one but the scanner can change the world until it's done.
11:57uvtcUsing `ALL` didn't work either. If anyone can tell me how to ignore -Nosrat- on xchat, I'm all ears. :)
11:57znDuffuvtc: it's just Nosrat, without the dashes.
11:57SgeoAnderkent, because the scan is of an external environment
11:57uvtctest
11:58SgeoAnd to do the scan I would set a callback, which sees each individual item as it is scanned
11:58SgeoI don't think I could hold a transaction over that period of time. Also, bad idea to do I/O in a transaction
11:58TimMcuvtc: Drop the hyphens.
11:58uvtcznDuff: Thanks! After doing `/ignore Nosrat NOTI`, it reported "Nosrat!*@* added to ignore list." (Dunno what the !*@* was for.
11:58TimMcnick!ident@host
12:00SgeoI guess I could have the added/deleted object callbacks store stuff into a ref or maybe an agent if the scan isn't done
12:00AnderkentSgeo: So you want to restart the scan after every event?
12:00uvtcTimMc: +1 Informative! :)
12:00jbroomeSee how long that lasts
12:00SgeoThere are three events: Object scanned, object added, object deleted
12:00S11001001(inc TimMc)
12:00lazybot⇒ 21
12:00S11001001uvtc I think you mean :)
12:01uvtcActually, I was looking for the "the more you know" ascii/emoticon, but just went with +1 instead. :)
12:02S11001001(inc jbroome)
12:02lazybot⇒ 1
12:04flying_rhinohello
12:04uvtcflying_rhino: hi.
12:05flying_rhinodoes clojure has something like c 'struct' type? (Java equivalent would be class with no methods and all elements public)
12:06Bronsadefrecort
12:06Bronsadefrecord*
12:06TimMcflying_rhino: maps are pretty similar.
12:06flying_rhinoTimMc: but dnamic
12:06flying_rhinowhich means performace loss.
12:06flying_rhino*dynamic
12:06S11001001flying_rhino: premature optimization is...
12:07uvtcflying_rhino: Note, I think that in olden tymes there was a defstruct too, but I believe that's pretty much deprecated now.
12:08flying_rhinoS11001001: ... punishable by crucifixion. Yeah I know but even if I want late optimization, if clojure doesn't have something then how am I gonna optimize even later?
12:08Bronsaflying_rhino: deftype/defrecord are what you want.
12:08S11001001flying_rhino: then later, ^^ Bronsa
12:09flying_rhinookay
12:10abevquit
12:10abevbye
12:10abevexit
12:10flying_rhinobye
12:10abevbye
12:16antoineBhello, i would use "||" operator of javascript, i suspect "or" don't behave the same
12:17S11001001antoineB: you'd be right
12:17S11001001antoineB: there are only two false values in Clojure.
12:21mycelloandiif i have [(read-int s) (read-int s) (read-int s)] will the order of evaluating the read-ints be guaranteed to be from left to right or should i read them separately within a let?
12:22wingyibdknox: what the reason for removing the LIVE button in instarepl?
12:39seangroveHey all, I'm trying to switch from swank-clojure to nrepl, and it's more or less fine, except I can't use C-x C-e, or really anything that evals the current buffer into the repl
12:39technomancyseangrove: yeah for some reason nrepl.el requires you do a full load of the entire file (C-c C-k) before anything works =\
12:40technomancyI tried to talk him out of it, but apparently it's intentional
12:40ChongLiseangrove: you can set up a hook to solve that
12:40seangroveAh, that sounds nice
12:40Sgeotechnomancy, shouldn't that be documented somewhere?
12:40seangroveThat may not be the problem though, I'm getting these errors:
12:40seangrove"Symbol's function definition is void: lisp-eval-last-sexp" and "lisp-eval-defun: Process lisp does not exist"
12:41ChongLithe question I have is how to get colorized stacktraces in nrepl.el's error window
12:41technomancySgeo: maybe. I don't really know how to explain it because the behaviour is so batty.
12:41mycelloandiseangrove: i noticed that too
12:41seangroveSure those aren't caused by not loading the file first?
12:41ChongLithey work fine on loose files but not on files inside a leiningen project's src directory
12:41technomancyif I documented it, it would just say "here is the way in which it's broken" which I don't think the maintainer would appreciate =)
12:41technomancyseangrove: you don't have nrepl active
12:42ChongLitechnomancy: any ideas about that?
12:42technomancyChongLi: I haven't gotten that figured out yet
12:42seangrovetechnomancy: What does 'active' mean in this case? The repl is open and running in another buffer, started via nrepl-jack-in
12:43technomancyseangrove: nrepl-interactive-mode isn't enabled in the current buffer
12:43seangrovetechnomancy: Ah, yes, that seems to be it
12:47dnolentechnomancy: so does checkouts actually get any real special handling in lein 1/2? I'm trying to figure out if people can test patches just by checking out clojurescript into their project and using :extra-classpaths-dirs w/o bothering to create the checkouts dir.
12:49technomancydnolen: I don't know what the requirements for clojurescript are, but checkouts are just one way to get things on the classpath following the most common pattern. you can do it other ways, though checking in changes to the project.clj file for a checkout that only exists on your machine is an antipattern
12:49technomancythat's why I've always emphasized that checkouts are opt-in; someone on a team may be interested in using them without making everyone else go through the same steps. so it's invisible to version control.
12:52dnolentechnomancy: yeah this isn't about permanently changing project.clj - just a way to easily patch a version of CLJS and test against an existing project.
12:53dnolentechnomancy: if I try to use checkouts w/ Lein 2, it doesn't work with ClojureScript because it doesn't have a project.clj
12:53dnolentechnomancy: all I care about is a step of steps to override whatever version of ClojureScript the user has w/ a master checkout that they can patch and test w/.
12:53dnolenset of steps.
12:54technomancydnolen: if it's just to test then the simplest way would be to get a snapshot into the local repo
12:54technomancycheckouts are for when you want to make continual changes to the dependency project
12:54technomancysounds like that's overkill here
12:54dnolentechnomancy: yeah that's way more complicated than what checkouts lets you do, git clone, git am go.
12:55antoineBhow to create a javascript object in cljs? (js-obj give me something like that {":abc": 12} where i expect {abc: 12})
12:55technomancyyou could provide a dummy project.clj file for people to drop in
12:56dnolentechnomancy: so my question is, for lein 2, is :extra-classpaths-dir sufficient to override what the the CLJS the user has installed?
12:56technomancyno, :extra-classpaths-dir is deprecated
12:57technomancyyou can abuse :resource-paths to do the same thing in lein2
12:58technomancys/deprecated/removed/
12:58dnolentechnomancy: k, this kinda seems tedious for anyone wanting to test patches of libs against their projects tho. I guess people just put up w/ it?
12:59technomancyhaven't heard much complaints. it's not very common that you want to do this for a project that doesn't have a project.clj
13:00dnolentechnomancy: anyone trying to test patches w/ ClojureScript will encounter this and the list of contributors is growing
13:02dnolentechnomancy: but :resource-paths is a sufficient hack for now, thx
13:02technomancysure
13:10mpenetantoineB: It seems right, js-obj expects a stringy key, it will just apply .toString to the key I guess
13:12ivanis there some evil hack to make pst (and other repl functions) available in nREPL even when you're not in the user namespace?
13:12ivanpreferably not by actually adding them to every namespace
13:12dnolenmpenet: all tests pass pushing up your patch now.
13:12mpenetantoineB: clj->js will do what you want (it's available on jayq and almost every other cljs lib out there, and hopefully in core soon)
13:12mpenetdnolen: sweet! thanks
13:13technomancyivan: you can intern it in clojure.core, but that's horrible. best to just expose it in your client
13:13antoineBmpenet: i use js* until now
13:14dnolenhttp://github.com/clojure/clojurescript/commit/cd66e6b9e63ad5ef1896a9c7a117148beb04301d
13:14ivantechnomancy: expose it how? some form rewriting in the nREPL server?
13:14mpenetthe short version of clj->js in jayq is only a couple of lines and it's more powerfull
13:14mpenetantoineB: well, it does this recursively
13:15dnolenmpenet: thx much!
13:15technomancyivan: a new command in nrepl.el; eg M-x nrepl-pst or some such
13:15mpenetdnolen: Thanks for your help/guidance, lots of new stuff for me
13:15ivantechnomancy: oh, right, I guess that would work, thanks
13:16technomancyivan: IIRC reply does something similar with doc and cdoc
13:16ivanah
13:16technomancyintercepts them and fully qualifies them client-side
13:16antoineBmpenet: no
13:16technomancymuch less likely to cause collision that way since it only applies to directly-entered code
13:16ivanright
13:17mpenetantoineB: I meant clj->js does, not js-obj
13:18antoineBi understand
13:20dnolenif anyone cares about moving CLJS source map support forward you could help me out by confirming that the following patch works w/ Lein 2 (read all the comments): http://dev.clojure.org/jira/browse/CLJS-282
13:24cemerickivan: This is an open question. At the moment, I'm leaning towards not offering anything in nREPL itself for it. http://groups.google.com/group/clojuredev-users/t/8f9709be5d8ab041
13:25seangrovednolen: You mean just checkout cljs and use it on an existing project, and see if this problem crops up? I'm hacking in cljs all day today, would be happy to give it a try
13:25ivansounds reasonable, making clients do the expansion makes sense to me
13:26ivanthough I'd have to think about it for hours to make sure
13:26dnolenseangrove: I actually want someone to confirm that it works for them using the minimal test case project linked to in the comment thread. the project doesn't do anything, it just has some dependencies setup in a way that the issue can be recreated.
13:26cemerickivan: it's not expansion; just prepending `(use '[lib.name.here :only (var-a var-b)])` to each eval is sufficient
13:27technomancycemerick: eh... is that what reply does?
13:27dnolenseangrove: the project has instructions to recreate that have to be followed closely, I've already confirmed that it works for me, but I'd like to hear from at least one other person on Lein 2.
13:27technomancyinput expansion has much more limited potential for conflict
13:27technomancyand should be preferred when possible IMO
13:27seangroveSure, I'll give it a try. Been on Lein 2 for a few days now
13:28ivanif I do (in-ns 'otherns) and paste in some block of code that uses `doc` I expect it to not work
13:28cemericktechnomancy: no, reply doesn't do anything in this area AFAIK. Maybe I missed the beginning of the conversation; not up on what input expansion implies here.
13:28technomancycemerick: I mean fully-qualifying calls to doc, cdoc, etc in a way that only applies to repl input
13:28cemerickah, ok
13:30technomancytrptcolin: is that how reply works or does it refer stuff everywhere?
13:31cemericksure, that'd work as well. Though that requires reading input before sending it, which not all clients do.
13:31trptcolinsorry, catching up
13:31cemericktechnomancy: the implicit refers you're seeing are an interaction between nREPL and Clojure <= 1.4.0.
13:32technomancyjust wondering how convenience fns are made available
13:32trptcolintechnomancy: right, unfortunately (doc thing) doesn't have the ability to work outside of the usual explicit refers
13:32technomancyoh, gotcha.
13:32cemericktechnomancy: http://dev.clojure.org/jira/browse/NREPL-31
13:32technomancytrptcolin: do you think it's a good idea to refer it at read-time?
13:32trptcolinthe only current magic outside of the user (or perhaps :main?) ns is for exit/quit
13:33technomancygotcha
13:34trptcolini think it would be *awesome* to have that available from a user's perspective. i'm a little worried about the implications of trying to replace 'doc with the fully-qualified version.
13:34trptcoline.g. does it happen only in function call position? or anywhere it's a symbol?
13:34technomancyright; it could lead to unpredictable weirdness I guess
13:34trptcolinalthough i guess nobody really uses those as input to a HOF...
13:34cemerickI really need to get my cljx middleware out there.
13:35ivan(doc doc) not working would be a little weird, yeah
13:35clojurebot"([name]); Prints documentation for a var or special form given its name"
13:35trptcolinthe good news its it'd be almost trivial implementation-wise with sjacket, provided there's a clear set of rules
13:35ChongLihmm
13:35cemericktrptcolin: if only there was a logic-programming-driven code transformation library out there.
13:35cemerick;-)
13:36ChongLitrying to debug this is tricky
13:36ChongLisince the callback is a lambda and the arguments are a lot of binary garbage
13:36trptcolincemerick: hehe. sure, just dump it in kibit and it'll figure out the dirty bits :)
13:37seangrovednolen: I see the problematic behavior
13:38ivanmaybe REPL clients should always be wrapping with some kind of (from-repl ...) form that can be broken out of if needed
13:38seangroveI'll gist it...
13:38ivanbut then we might see weirdness like no working tab completion
13:38bryanlCan someone help explain why I am getting the cannot cast long to to ifn message I'm getting? https://gist.github.com/4112597
13:39dnolenseangrove: using Lein 2 + :resource-paths?
13:39seangroveAh, no, sorry, didn't use the resource paths
13:39seangroveConfirmed the problematic current behavior :)
13:40seangroveTrying again with resource-paths
13:40Anderkentbryanl: you define next-person-id as the result of (alter count inc), which evaluates to 1. Then you call it in (next-person-id).
13:40Anderkentoh nvm
13:40Anderkenti missed the # :P
13:40dnolenseangrove: cool, when testing the patch you need to use :resource-paths to override whatever version of ClojureScript you have installed. Thanks much again for trying this out.
13:41lynaghkdnolen: Paul and I did some serious core.logic hacking on the way back from the conj. Two questions: 1) what was that default value syntax that will be overriden if unified against but otherwise act as a usual value?
13:41cemericktrptcolin: some WIP cljx (kibit) nREPL middleware https://gist.github.com/4112677 /cc lynaghk jonasen technomancy
13:41amalloybryanl: X cannot be cast to IFn always means, you are calling an X as if it were a function
13:42Anderkentbryanl: in your threading macro you try to apply 0 to result of next-person-id
13:42lynaghkdnolen: and 2) the new walk protocol doesn't recurse, which feels like a bug. E.g., (prep {:a {:b ?c} :d ?d}) preps ?d but does not prep ?c.
13:42dnolenlynaghk: I haven't added that (defaults) yet, I easily can.
13:42Anderkent(macroexpand `(-> BirthEvent (next-person-id) 0))
13:42Anderkent,(macroexpand `(-> BirthEvent (next-person-id) 0))
13:42clojurebot(0 (clojure.core/-> sandbox/BirthEvent (sandbox/next-person-id)))
13:42amalloyin this case your existing code basically makes no sense, and so i can't tell you how to fix it. just keep in mind that your -> form expands to (0 (next-person-id BirthEvent))
13:43lynaghkdnolen: ahh! awesome. I recall you mentioned it at 2:30 a.m. and I just assumed that I'd forgotten it and couldn't find it in the source.
13:43dnolenlynaghk: hmm, recurse - seems like a simple oversight. surprised that wasn't caught by the tests.
13:43dnolen"by a test" I mean.
13:43bryanlamalloy: thank you. that's helpful
13:43lynaghkdnolen: yeah, I was too. I can submit a patch with test in the next day or two.
13:43bryanlAnderkent: and thank you as well
13:44lynaghkdnolen: and, just to be clear, the walk should be over everything---correct? e.g., it should walk into map keys as well as their values
13:45dnolenlynaghk: oh right, yeah it probably doesn't do that.
13:45dnolenlynaghk: is that a different issue you encountered? ticket created for the other one - http://dev.clojure.org/jira/browse/LOGIC-69
13:46lynaghkdnolen: no, same issue. I just wanted to ask you about the scope before I submitted a patch---i.e., if there is any reason you wouldn't want the walk to act on a map's complex keys
13:48dnolenlynaghk: k ticket updated, will probably get to it later today - pretty simple one.
13:48dnolencemerick: it always saddens me to see people dev things like cljx :)
13:48lynaghkdnolen: if you want to handle it, that's cool with me too =P
13:49lynaghkdnolen: me too!
13:49dnolenlynaghk: yeah easy one - that and defaults. I actually want to wrap up 0.8.0. anything else you want to get on the list? if so make tickets please.
13:50dnolensolidfying the lower level constraint details will have to wait for a later release.
13:51lynaghkdnolen: those are the only two I'm aware of at the moment. The record unifications are all working awesome.
13:51dnolenlynaghk: SWEET
13:51cemerickdnolen: oh?
13:51cemerickw.r.t. portability, you mean?
13:51dnolenlynaghk: still interested in or?
13:51lynaghkdnolen: the current constraint annotations work fine for me. I am doing a bit of contorting for one specific constraint that I will gist up later for you, but I don't think there's anything that could go into core.logic that'd make it cleaner.
13:52lynaghkdnolen: no, I don't need it now that the record stuff is all workin'
13:52dnolencemerick: would prefer feature expression support once and for all.
13:52cemerickyeah
13:52dnolenlynaghk: any thoughts about the namespace keywords, I was inclined to do ^numeric - but that's asking for clashes.
13:53cemerickBut there are good reasons to want to implicitly rewrite code.
13:53cemericks/good/occasionally good
13:54lynaghkdnolen: yeah, Paul and I discussed that for quite a bit. some of the fiddly bits I'm doing is to support things like ^:data-numeric, but that's only because I control the input. Not sure how you could do something short like that without the risk of clashes.
13:54ChongLitechnomancy: ah, I solved my problem; just had to install clj-stacktrace
13:55seangrovednolen: And should I apply http://dev.clojure.org/jira/secure/attachment/11686/cljs_282.patch before testing it?
13:55seangroveI've done it both ways, still getting the same erroneous behavior, but want to double check
13:55dnolenlynaghk: yeah it's a little bit tedious I think right now - but I don't see anything better except perhaps passing a map of constraints to the unifier?
13:56dnolenlynaghk: that would be in addition to metadata support
13:56dnolenseangrove: yeah you need to apply the patch - then test.
13:56cemerickpp
13:56lynaghkdnolen: that would be awesome, actually. In doing that you would be able to put constraints between lvars, correct?
13:56dnolenlynaghk: sure
13:57lynaghkdnolen: yeah, that would cover the nasty case I'm currently thinking about (which involves a relationship between ?data and ?x in an expression like {:data ?data :mapping {:x ?x}})
13:57dnolenlynaghk: I don't have the bandwidth to ponder syntax from scratch - would like some idea contributions on that front - gist of something that works for you would be helpful and I can chime in.
13:57seangroveAnd seeing "WARN ignoring checkouts directory clojurescript as it does not contain a project.clj file." should be fine?
13:57lynaghkdnolen: you'll have it by this time tomorrow.
13:57dnolenlynaghk: thx
13:58lynaghkdnolen: thank you dude, you're a machine = )
13:58dnolenseangrove: sorry, last comment in the ticket says - don't create checkouts directory, just checkout CLJS into your project. use :resource-paths
13:58dnolenseangrove: if you're seeing that error from Lein, it's not setup correctly.
13:59lynaghkdnolen: one other issue I wanted to ask you about: would you would be open to me exposing some Google Closure options within ClojureScript? In particular, I need to use the --output_wrapper flag to prevent clashes between adv. optimized cljs and other on-page minified JS.
13:59dnolenseangrove: and applying the patch won't matter - it's ignoring your local checkout of CLJS
13:59dnolenlynaghk: there's already an output-wrapper option
13:59lynaghkaccessible from something like lein-cljsbuild?
14:00dnolenlynaghk: if lein-cljsbuild passes everything along it should just work. :output-wrapper true
14:00lynaghkdnolen: I dug through the clojurescript compiler code and I didn't see a way to get to that flag
14:00dnolenlynaghk: line 913 closure.clj in master
14:00dnolenhttp://dev.clojure.org/jira/browse/CLJS-388
14:01lynaghkdnolen: well damn. that's what I get for sitting on an issue for a month.
14:01lynaghkdnolen: thanks!
14:01dnolenlynaghk: np
14:01seangrovednolen: ok, setup properly, trying again
14:02tomoj(deftype Foo [^:unsynchronized-mutable foo] IFoo (swap-foo [this f] (locking this (set! foo (f foo))))) -- pretend locking works here. isn't there still a concurrency bug since the field is unsynchronized?
14:03tomoji.e. swap-foo may get a cached value of foo in one thread which has already been swapped past in another?
14:04amalloytomoj: i think so, yeah
14:05tomojcan't seem to cause it to happen
14:05amalloythat's pretty much how race conditions work
14:05tomoj:(
14:05tomojI bought that big java concurrency book but haven't gotten around to reading it yet, oi
14:05seangrovednolen: Still see the bad behavior https://gist.github.com/4112913
14:06tomojmy guess is volatile would solve that problem?
14:06amalloytomoj: yes, it would
14:06amalloyhttp://www.ibm.com/developerworks/java/library/j-jtp06197/index.html is a good article on the topic
14:06gfrederickstomoj: amalloy: as someone not very familiar with these issues, I'm curious why (locking this ...) doesn't mitigate the problem you're describing
14:07gfredericks(i.e., if it doesn't what _does_ it do?)
14:07tomojthat makes sure the swaps are serialized
14:07tomojbut it doesn't (I think) guarantee that any particular swapping thread will have seen the effects of the previously serialized swaps
14:08dnolenseangrove: so we need to verify that your local checkout is actually being used - modify your local copy to print something in parse-ns
14:08gfredericksthere must be complexifying details there I'm unaware of because that doesn't sound possible in my mental model
14:08seangrovednolen: Sure
14:09amalloygfredericks: java variables that aren't declared volatile may be cached for any length of time by any thread, afaik
14:09cemerickgfredericks: reads and writes to unsyncrhonized fields aren't atomic
14:11gfrederickscemerick: atomicity shouldn't be an issue since it's all serialized; but amalloy's caching description makes sense of it
14:11cemerickvolatile effectively linearizes potentially-concurrent reads and writes
14:11seangrovednolen: To confirm though, this project.clj looks right? https://gist.github.com/4112913#file_project.clj
14:11amalloyto be fair, i just rephrased what tomoj said
14:11gfredericksamalloy: "caching" applies to CPU registers specifically? otherwise may as well just let the memory caches do their thing, right?
14:12amalloyi dunno, man. ask tomoj, or read the article i linked
14:12cemerickgfredericks: just because only one thread is within a context at a time doesn't mean that it is seeing the most recent values of unsynchronized fields.
14:12gfredericksamalloy: I am reading it; thanks
14:12trptcolinright, so reads would have to lock as well on an unsynchronized-mutable. though i wonder if in some situations an int/byte might be safe?
14:13trptcolin(provided the field is typed that way)
14:13cemericktrptcolin: no, you can't solve the problem with more locks. The introduction of volatile in Java 5 is the only way out.
14:13gfrederickscemerick: it should if they deref the field into the CPU register while inside the locked context, no?
14:14cemericks/is/provides
14:14dnolenseangrove: project.clj looks ok to me.
14:15cemerickgfredericks: don't ask me to understand what's happening at the register level w.r.t. the java memory model. :-)
14:15cemerickLost in the mists of time, etc.
14:15trptcolincemerick: no? it'd be less performant, but i guess i was under the impression that locking provided the same visibility guarantees
14:16seangrovednolen: Doesn't seem like it's using the ./clojurescript in the directory though. I add a println and `(assert false) to parse-ns in cljs-sscce/clojurescript/src/clj/cljs/compiler.clj, lein cljsbuild auto still ran like normal
14:16trptcolinthough at that point there's no win in using unsynchronized-mutable :)
14:16gfredericksI'm just trying to figure out "where" these cached values are. Unless java caches stuff in memory, which seems to duplicate what hardware caches already do, the only scenario I can think of is "cached in a register"
14:17dnolenseangrove: yeah so it's not picking up your local clojurescript. technomancy anything seem off about that project.clj? http://gist.github.com/4112913#file_project.clj
14:18cemericktrptcolin: object monitors are unrelated to the linearization (or not) of operations over a field
14:18sw1nngfredericks: volatile ensures flushed to/from main memory in the order you see in the source code. if not volatile reads and write can happens in any order.
14:18tomojbut if it's volatile, we can't do (locking this (when foo (set! foo (f foo)))) ?
14:19gfrederickssw1nn: why can they happen in any order if we have the guarantees of a lock?
14:19cemerickno one does :-P
14:20FrozenlockComputers are like, you know, black magic stuff.
14:20sw1nnonly threads interested in the lock get the guarantees. in fact if the jit can determine that there is no contention on the lock then the lock will be elided.
14:20cemerickgfredericks: a lock linearizes the entry/exit of threads within a scope; volatile linearizes memory reads and writes so that they are all visible to all threads equivalently.
14:21sw1nnthis: http://stackoverflow.com/questions/1787450/how-do-i-understand-read-memory-barriers-and-volatile
14:21sw1nnseems like a good overview on cursory inspection
14:23gfrederickscemerick: so what I'm trying to figure out is, if all memory reads/writes happen in the locked block, why does that not give you linearized reads/writes?
14:24gfredericksor is the issue that readers probably aren't using the lock?
14:24cemerickBecause the JIT or the CPU can reorder reads and writes whenever and however they like.
14:25cemerick(for unsynchronized mutable fields)
14:27trptcoliniirc, they are not allowed to do that with, for example, 2 synchronized blocks in java-land. there has to be a before/after ordering of the blocks as a group.
14:27gfredericksI can't think of any example of "reordering reads and writes" that doesn't violate all sorts of sanity expectations
14:27trptcolinbut perhaps monitor-enter/monitor-exit is less of a guarantee than synchronized?
14:28gfredericksi.e., I don't know how to interpret that sentence without also concluding that I can't reason about single-threaded code anymore
14:29dnolenseangrove: another option would be to use checkouts, use :extra-classpath-dirs and create a dummy project.clj just to appease Lein 2.
14:29flying_rhinomy connection froze. Anyway can you have typed vector that only accepts records of certain type?
14:29seangroveHappy to do that if it makes sense
14:30dnolenseangrove: I think that will work, checkouts was just complaining that it couldn't find a project.clj file. :extra-classpath-dirs is deprecated but I think will still take effect in Lein 2 previews.
14:30sw1nnthe re-ordering appears consistent within a thread, so you don't ever have to worry single-threaded. the re-ordering can be done by the jit or as a artifact of the memory hierarchy.
14:30dnolenseangrove: all of this is very tedious to just test patches
14:31sw1nnHere are some 'surprising examples' in the java language spec: http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.4
14:31seangroveWell, we've been relying on cljs pretty heavily, and moving all of our in-house frontend code over to it, so happy to help out where I can
14:31seangroveHopefully more substantially in the future, but for now, fine to be a tester
14:31trptcolinsw1nn: nice
14:32tomojI use :source-paths and don't put it in checkouts
14:32tomojI think the warning about project.clj is harmless though
14:32dnolenseangrove: ^
14:32tomojsince it just means the checkout bit of leiningen is ignoring it
14:32dnolentomoj: but lein ignoring is a problem - it won't get put on the classpath.
14:33gfrederickssw1nn: thanks; now I have three tabs devoted to the issue :)
14:33Foxboronohh, while we talk about java, 2 sec.
14:33FoxboronSOme java source:
14:33Foxboronhttp://kickjava.com/src/com/sun/java/swing/plaf/nimbus/InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonPainter.java.htm
14:33sw1nngfredericks: make sure you keep all tabs in sync :-/
14:34seangrovetomoj: Ok, looks like that worked, at least the assert cause lein cljsbuild to fail
14:34tomojdnolen: it still will since you add it explicitly
14:34tomojjust the checkout bit of lein won't add it
14:34seangroveOk, finally, testing with the patched clojurescript...
14:35dnolentomoj: it did not work for me even w/ explicitly adding it - tested this quite a bit yesterday.
14:36tomojhmm
14:36tomojwell, I just followed the steps and everything seems OK to me
14:37tomojI see the same thing from the grep with a clean auto and after touch'ing b.cljs
14:37tomojusing the clojurescript submodule in that repo
14:37seangrovednolen tomoj: Looks like the patch does work https://gist.github.com/c880c958adf7ba5f4a0d
14:37dnolenseangrove: excellent! thanks
14:38seangrovetomoj: I cloned clojurescript from the repo, applied the patch, used :source-paths, and seems like it's working
14:38tomojI'm always nervous about what version of cljs I've actually got :/
14:38seangroveOn that note, who decides what gets put into cljs' goog-closure.jar?
14:39seangroveI ask because I needed to use the Md5 function, and it wasn't included in the cljsbuild goog-closure.jar I was using, but it's been in the Closure library for over a year
14:39seangroveI then spent a day trying to figure out how to replace/manually update the goog-closure.jar, but seems like that's still a bit over my head right now
14:40dnolenseangrove: thx CLJS-282 resolved. so the solution was :source-paths and no checkouts dir right?
14:40seangrovednolen: Correct
14:40tomoj(fwiw, leaving clojurescript in checkouts seemed to work here)
14:41dnolentomoj: which preview of Lein 2, 10?
14:41tomojyes
14:41dnolentomoj: what OS?
14:41tomojubuntu
14:42dnolentomoj: that might be it then dunno - unnali & I are OS X 10.7.5
14:42dnolenseangrove: you?
14:42tomoj`lein classpath` when you have :source-paths ["checkouts/clojurescript/clj" "checkouts/clojurescript/cljs"] doesn't include them?
14:42dnolentomoj: I think we're talking past each other :) we weren't using :source-paths + checkouts
14:42seangrovelein 2 prev 10, osx 10.7.2
14:43tomojoh, right
14:43tomojI meant only that if you have cljs in source-paths explicitly, the fact that you put it in checkouts/ and lein complains doesn't matter, it still gets on the classpath
14:43dnolentomoj: yes, this is good to know.
14:47tomojso (swap-foo [this f] (locking this (when foo (set! foo (f foo))))) - would ^:volatile-mutable for foo be problematic here because we read-then-write? or does the locking make this not a concern?
14:48tomojseems most of the stuff online talking about volatile assumes you're not also locking
14:49dnolentomoj: seangrove: http://github.com/clojure/clojurescript/wiki/Testing-patches, hopefully this looks ok?
14:50seangrovednolen: Looks pretty easy, yeah
14:51tomojyeah, except "git clone clojurescript into your project directory" (vs "into a directory in your project called checkouts" above) suggests what I actually do, which is :source-paths [... "clojurescript/src/clj" ...]. but that just avoids the warning
14:51seangrovednolen: Mind helping me understand about the goog-closure.jar, where it comes from, and who decides which Closure functions get put in?
14:53aperiodic@
14:53dnolentomoj: http://github.com/clojure/clojurescript/wiki/Patches
14:53dnolenseangrove: goog-closure.jar is whatever the latest build of goog-closure.jar gets included w/ CLJS
14:55FrozenlockI have a uberjared webserver. Is there a typical way to let the user make and add its own plugins?
14:55tomojdnolen: -yeah looks perfect
14:55sw1nntomoj: the lock gets flushed to main memory, so if you are accessing the actual lock you don't need to worry about read/write, but if you are accessing anything else then you only have guarantees if those other things are protected by the same lock. In your swap-foo example, foo can presumably be updated outside a critical section, so not guaranteed to get the value when the lock was acquired
14:56seangrovednolen: Just wondering why it would have some functions included, and others left out - is there any discussion of that?
14:56tomojif you only set! foo inside locking, then "foo can presumably be updated outside a critical section" is false, yes?
14:57FrozenlockFor lack of a better example, kind of like 'redmine'. There's the main app, but contributors can code new plugins and the users can choose to use them.
14:57dnolenseangrove: if things are left out that's a problem w/ goog-closure.jar, we don't leave things out
14:57technomancyFrozenlock: require+resolve with a convention around naming namespaces goes a long way.
14:57dnolenseangrove: goog-closure.jar seems to change quite a bit
14:58technomancyFrozenlock: I don't think it's possible to describe a convention for entry points in an application-agnostic way though; every application is going to be different
14:58seangrovednolen: Is it what's released by google?
14:59ChironHi, I have a vector and a lazy seq . what is the output of (concat vector lazy-seq) ?
15:00technomancyI bet clojurebot knows!
15:00Frozenlocktechnomancy: Thanks!
15:01FrozenlockWouldn't there be an issue finding the jars if they are not in the uberjared resources?
15:01Chironstill, it is hard to beat the human factor :)
15:01dnolenseangrove: yes
15:01Bronsa,(concat [1 2] (map inc (range 2)))
15:01clojurebot(1 2 1 2)
15:02Bronsaderp.
15:02Bronsa,(concat [1 2] (map dec (range 2)))
15:02clojurebot(1 2 -1 0)
15:02alexykany La Clojure users here?
15:03alexyktoday, this moment?
15:05Chironalexyk: me but not a kung fu user
15:06ChironI migrated to sublime text II
15:08alexykChiron: I actually am trying that too
15:08alexykbut nrepl breaks syntax highlighting, obviously string escaping is broken
15:08seangrovednolen: Thanks
15:09alexykRaynes poo-pooed it enough in his blog for me to get doubts
15:09Raynesalexyk: What did I poopoo?
15:09RaynesOh, La Clojure?
15:09alexykChiron: what I need in IDE like IDEA is to be able to find a symbol by name
15:09RaynesDid I explicitly mention I didn't like it? I thought I just… disregarded it.
15:10alexykRaynes: I mean it in a good way
15:10alexyk:)
15:10ChironEclipse CCW ?
15:10RaynesI only used La Clojure when it first came out.
15:10RaynesI don't know what shape it is currently in.
15:10RaynesOh.
15:10RaynesSublime Text!
15:10RaynesThere we go, context.
15:10RaynesYes, ST2 is pathetic for Clojure.
15:10alexykSublime Text II got doubts from Raynes
15:11alexykthe real question for IDEs is, I got a humongous project, I want all names indexed and I want to go to their definitions.
15:11alexykWho can do that well?
15:11RaynesIt's a good editor, just sucks for Clojure because the author obviously doesn't care much about Clojure support vs Ruby and such. Which is fine, since he isn't a Clojure guy.
15:12alexykIDEA will break into jars and your mother's cupboard. It will decompile library jars if it needs to.
15:12alexykI didn't see that doggedness from anything else.
15:13znDuffalexyk: Yes, IDEA does that, but the paredit mode available for it is a shadow of what's there on emacs
15:13technomancyjumping to definition is trivial to implement in any editor
15:13technomancyas is listing all loaded namespaces/vars
15:14tgoossensWhat would be a useful representation for 3x3 puzzle. Currently i'm thinking of [[1 2 3] [4 5 6] [7 8 9]] (most obvious i think)
15:14tgoossensbut haven't figured out
15:14tgoossenshow to write a function that does this:
15:14tgoossenshttp://pastebin.com/KnXsmzAw
15:14znDufftgoossens: would you mind using a pastebin without all the ads? gist.github.com and refheap are both much better.
15:15tgoossensno probs!
15:15tgoossensdidn't know github has that
15:16tgoossensgist seems ok to me :)
15:16clojurebotClojureBooks is http://clojure.org/books
15:17tgoossensznDuff: for you ;) https://gist.github.com/4113588
15:17Wild_Cattgoossens: your function would be easier to write given a map representation of your puzzle
15:17tgoossenshmmm
15:17tgoossensyou mean
15:17tgoossens:0 1 :1 2 :3 3
15:17Wild_Cattgoossens: e.g. {[0 0] 1, [0 1] 2, [0 2] 3, [1 0] 4, ... }
15:18tgoossens:x (number of the cell)
15:18tgoossensah
15:18tgoossensmm
15:18tgoossensbut the thing is now i'm using a less obvious representation. Just because 1 function is hard to write
15:18tgoossenstranslations
15:18tgoossensare very easy
15:19tgoossensin my original representation
15:19alexykznDuff: canclojure-mode in emacs index everything with ctags or something?
15:19sw1nntomoj: yes, if only accessed within locking it will be fine. jvm *can* re-order within a synchronized block, but not if it changes logic materially.
15:20technomancyalexyk: ctags is silly for languages that have a repl
15:20technomancyit's so much easier to just query the running process
15:21alexyktechnomancy: I meant through some magic! :) I need to jump from a usage of a symbol to its def/defn, in emacs?
15:21alexykhow do we do that?
15:21technomancysure; nrepl.el supports that
15:21technomancytook under an hour to write
15:22alexyktechnomancy: how do I invoke it?
15:23amalloyM-. unless the nrepl guys were crazy
15:23tgoossensWild_cat: i see how rotation gets easier. hmm
15:23alexykwhat if I didn't yet load everything into repl?
15:24Wild_Cattgoossens: translation isn't particularly hard in my representation either
15:24tgoossensWild_cat: and maybe i just have to create a simple function that transforms that map into vector representation for human-readable printing
15:24technomancyalexyk: M-. for the symbol under point, C-u M-. to browse through the full namespace tree
15:24Wild_Cattgoossens: yup.
15:24technomancyif it's not loaded it doesn't exist
15:24tgoossensWild_cat: you're right it isn't hard
15:24technomancyloading everything is much easier than keeping a tags table up to date
15:25alexyktechnomancy: so I have a src/ full of subduers full of *.clj; how do I feed it to nrepl to explore with M-. ?
15:25alexyksubfolders
15:25technomancyjust make a loader namespace and do (require 'myproject.all)
15:25Wild_Cattgoossens: it's often a good idea to consider alternate representations of your data set. Important lesson learned from the Game of Life example in the Clojure book.
15:26Wild_Cat(which, by the way, I'm enjoying so far -- congrats to cemerick et al.)
15:26tgoossenswhen i have the time i'll take a look at it :)
15:26tgoossensso far I have read "programming clojure"
15:26tgoossensWild_cat: sometimes it is difficult to choose the right datastructure. Maybe because i try too much to represent to problem in a human readable data structure. Instead of more
15:26Mr_BondI'm quite pleased with this one: #(last (take 2 (reverse %)))
15:26jamiiRE: https://groups.google.com/forum/?fromgroups=#!topic/clojure/AsPs9ZonRPQ
15:27Mr_Bond4clojure problem 20
15:27Wild_Cattgoossens: the trick there is that a vector of vectors isn't *that* readable to begin with. The perfect data structure would have been an actual 2D array, but Clojure (or Java) doesn't have that
15:27jamiiI'm getting the same error (Failed to deploy artifacts: Could not transfer artifact strucjure:strucjure:pom:0.3.2 from/to clojars ... ReasonPhrase:Forbidden.)
15:27jamiiIt's not clear from that conversation what the fix is. Anyone know the answer?
15:28brehautMr_Bond: (comp last butlast)
15:28Mr_Bondbrehaut: nice
15:28Mr_Bondnicer
15:28jamiiI do have a gpg key set up in my profile and am prompted for the passphrase when pushing. I have been to the my clojars profile page and re-entered the key.
15:29jamiiNot sure what to do now.
15:29brehautMr_Bond: free all the points!
15:29amalloysometimes i wonder if brehaut has a clojure version of `pointless` hidden in his back pocket
15:29tgoossensWild_Cat: mmyes
15:29Wild_Cat...I will concede, however, that for human readability a map is worse ;)
15:30brehautlol
15:32tgoossensWild_cat: it takes some effort to get used to thinking in data. 2 months ago my only experience was OO in java (and some php)
15:33tgoossensbut i got tired of only learning OOP and JAVA at university that I searched for something fresh, new and totally different
15:33tgoossensclojure has got them all :p
15:33Wild_Cattgoossens: Java's main inadequacy here is that it has no syntax for vectors or maps.
15:34tgoossensWild_cat: maps syntax in guava makes life more bareable!
15:34Wild_Catmap literals are awesome.
15:34madsyWild_Cat: What's just a syntax issue. What's important is the language semantics.
15:34Wild_Catmadsy: sure, but IMO, "just a syntax issue" issues quickly add up together.
15:34madsy+T-W
15:35Wild_CatJava's semantics are unremarkable but not hostile. But its lack of literals for anything but arrays (which almost nobody uses in user code, with good reason) and strings hurts it a lot.
15:36madsyWild_Cat: I think the single biggest flaw of Java is the dependency on class/interface hierarchies, with no way to partially override.
15:36TimMcWild_Cat: I'd like to quibble with the statement "main" inadequacy.
15:36madsyWant to partially override an interface? You have to define every method.
15:36Wild_Catlikewise, == versus .equals. There's a lot of places where Java sacrificed its syntax by dedicating it to features nobody uses.
15:36tgoossensin java i just sometimes have de need for some kind of "function" and I have nowhere to put it really.
15:36TimMcmadsy: Only if you want a concrete class.
15:37Wild_CatTimMc: main but far from only ;)
15:38TimMcThe type system is completely fucked, for one.
15:38Wild_Catyeah, fair enough.
15:38TimMc"Let's spend all this effort getting a safe typechecker and completely ignore nulls and our insane checked exception nonsense."
15:39Wild_Catoh, man, I forgot about checked exceptions.
15:39Wild_Catthere's also the generics that are horribly implemented.
15:39tgoossensyes
15:39tgoossensf*cking type erasure
15:40brehauttgoossens: type erasure lets clojure be the language it is
15:40TimMcJames Iry wrote a nice little bit of code that allows you to throw checked exceptions in Java as if they are unchecked.
15:41pjstadigTimMc: and the only reason James' code worked is because of generics erasure
15:41tgoossensbrehaut: i'm talking about idiomatic java code. Not clojure
15:41TimMcA coworker and I stared at it for a while and finally figured out that it works because of the Throwable hierarchy.
15:42Wild_Catalso, I hate a lot of the stdlib's design. Just like C++'s was "hey, I have that new toy called operator overloading, let's use it everywhere!", Java's stdlib is "overdose of the Decorator pattern."
15:42TimMcpjstadig: Actually, he pointed out that if you had *two* Throwable roots (CheckedException, UncheckedException) then it would be typesafe.
15:42pjstadigbrehaut: right, if generics were reified, then clojure would have a bad time
15:42Wild_Catwhy a high-level language running on a VM requires the user to manually buffer everything, I may never know.
15:42brehautpjstadig: exactly
15:43tgoossensbrehaut: oh. you mean how clojure is created?
15:43TimMcbrehaut: Can you expand on that?
15:43Wild_Catinteresting -- why is that?
15:45tgoossensWild_cat: "why a high-level language running on a VM requires the user to manually buffer everything" what do you mean with that?
15:46Wild_Cattgoossens: the fact that FileWriter/FileReader is unbuffered and has to be explicitly wrapped in a BufferedWriter/BufferedReader.
15:46Wild_Cat(which, depending on what you do with your code, may result in a single reader/writer being wrapped in *several* nested buffers)
15:47tgoossensoh. that seems a bit strange
15:47Wild_Catevery other language I know, when it gives you the choice between buffered/unbuffered (some don't, and those force buffering on you), does it with a flag in the open call, and *always* default to buffered when available.
15:48tgoossensso what woudl have been better is : an interface IFileWriter. and a class FileWriter and a class BufferFileWriter
15:48tgoossensinstead of wrapping
15:48tgoossensis that what you are saying?
15:48TimMcand then you hand that (Buffered)Writer to someone else and *they* wrap it in a BufferedWriter...
15:49Wild_CatTimMc: exactly.
15:49tgoossensTimMc: that seems f*cked up :p
15:49Wild_Cattgoossens: no, just have FileWriter's constructor take a "buffered" argument that defaults to true, and get rid of an extra and unnecessary level of interface inheritance.
15:49Wild_CatLemmy knows Java's class/interface hierarchy is already more than deep enough
15:49amalloyWild_Cat: and SocketWriter? and ZipFileWriter? and...?
15:50amalloyputting the buffering functionality in a single place is better than in N places. java.io is a mess, but what you propose is not better
15:50tgoossensi still think that in java -idiomatically- it is the good to do interface inheritance
15:50tgoossens(without "the")
15:51Wild_Catamalloy: frankly, I'd just get rid of the flag and leave buffering to whatever the underlying OS does (enabled almost everywhere).
15:51Wild_Catamalloy: besides, ZipFileWriter probably delegates most of its raw reading functionality to FileWriter anyway.
15:52Wild_Cat(leading to the interesting question, does it instantiate a BufferedWriter to write to the actual file? And can you even control that?)
15:55amalloyi don't know, i just made up zipfilewriter
15:56amalloyin reality it doesn't exist; there's some ZipStream that wraps an existing stream
15:56TimMcIt wouldn't be a Writer.
16:03brehautTimMc: i cant find the article sorry.
16:10TimMcbrehaut: This doesn't help: http://stackoverflow.com/questions/3812644/how-does-types-erasure-help-clojure-exist
16:10TimMcA strange question.
16:11brehautwow yeah
16:13TimMcaaaaagh fuck you google
16:13TimMcI meant "erasure", not "erasing".
16:14brehautTimMc: my understand is that reified generics become quite pervasive, and anywhere clojure builds ontop of a java level abstract (frinstance, collections API, runnable, etc), there would need to be explicit type parameters provided
16:14brehautif clojure were less interested in interop, it wouldnt be such a problem
16:14TimMcI see.
16:14TimMcSo Clojure would be perfectly compatible with Java v1.4.
16:15TimMcit's just that Java v1.5 would look entirely different
16:15brehautyeah i guess so
16:16TimMcas opposed to Clojure taking special advantage of type erasure.
16:17brehautwell, it uses Object everywhere
16:17brehautwhich kinda is
16:17TimMcThat's like saying that Java v1.4 makes use of type erasure. :-P
16:17brehautha
16:20brehautTimMc: unfortunately my memory is woolly on specifics
16:21brehautso ive only got the handwavey explainations available
16:32ivananyone like some SLOC counter that doesn't ignore .clj files? tempted to write my own
16:34amalloyjust use cloc
16:40bbloomyeah, i add languages to my cloc.def all the time
16:40danielnealHello! I'm new to IRC. Just wondering - is there a way of listing the callers of a function when using nrepl/emacs/clojure?
16:45vijaykirandanielneal: if you are using swank - "C-c C-w c: List all callers of a given function"
16:45vijaykirannot sure if it works with nrepl though
16:47amalloydoes it even work with swank? i didn't think anyone had implemented the who-* family
16:51ivanamalloy: thanks. though my centos refuses to install it. I'll take up with them.
16:53danielnealinteresting - I just moved away from swank to nrepl as it looked like that's the way things were going
16:53ambrosebsIs there a recommended way to extend the special forms in CLJS? This is my current hack https://github.com/frenchy64/typed-clojure/blob/master/src/typed/check_cljs.clj#L9
16:57hiredmanambrosebs: I would be surpised if there ever was a "recommended" way to do that
16:57hiredmanbut that approach seems fine, I might suggest alter-var-root + union
17:02ivanso an untyped language usually running on a typed VM is upgraded to be a typed language, compiled to untyped JS, run through a compiler that mixes typed code with untyped CLJS to become untyped JS, and run through V8 which creates hidden classes
17:06danielnealthanks vijaykiran
17:07danielnealhopefully someone clever will implement a who-calls for nrepl then
17:07danielnealjust wanted to check whether it existed somewhere already
17:08dysingerwhere does one go for the how-to on nrepl replacement of slime/swank in emacs?
17:13danielnealdysinger: I just installed nrepl.el, and made sure I was using lein 2
17:14dysingerk
17:14danielnealthen nrepl-jack-in from a clojure buffer to get it going
17:15danielnealI'd been putting it off for months...
17:15dysingerso it doesn't conflict or compete with swank it sounds like
17:15danielnealit didn't seem to in my case
17:15dysingerawesome
17:15danielnealit was the upgrade to lein2 that was the most important bit
17:15danielnealthe one thing I haven't got completely configured yet is ac-nrepl
17:17hiredmannrepl.el is a completely new code base
17:17hiredmanso any slime customizations and key bindings may or may not work
17:18hiredmannrepl.el turns on nrepl-interaction-mode for clojure-mode buffers, which does break some slime keybindings (if you are using slime for some projects, and nrepl for others)
17:24dysingerI can't even get my emacs to load after adding it
17:24dysingerpopup.rcp: (error "Variable binding depth exceeds max-specpdl-size")
17:24dysinger(using el-get)
17:28mammothhow fast is accessing vectors and hash tables
17:28mammoth?
17:29znDuffmammoth: vectors are log32n for lookup
17:30mammothdanke
17:30gfredericksvectors are "good" for lookup
17:30znDuffmammoth: ...if you're curious, you should be able to find a video of one of Bagwell's conj talks (or his paper).
17:30mammoththanks
17:45dysingerderp. I had a loop in my emacs dependencies. all fixed.
17:45devngo aperiodic
17:45devnoops... :\
17:46flying_rhinois it possible to to give type to vector so it can only take one type of object?
17:46devnflying_rhino: you could use pre or post, or validate with atoms
17:47flying_rhinoI was thinking more about speed (I assumed that yped vectors could be faster)
17:47flying_rhino*typed
17:47aperiodici'm going as fast as i can! ;)
17:48gtrakflying_rhino: arrays?
17:48flying_rhinogtrak: i guess that's an option too
17:48gtrakthere is no slowness based on type, since the vector only stores a reference
17:49flying_rhinoso it doesn't really matter?
17:49flying_rhinogood to know
17:50dnolenflying_rhino: vectors are pretty fast. you have gvecs which can be more memory efficient since you can specify their contents, but there's no support *yet* to work w/ their contents w/o boxing.
17:50flying_rhinookay
17:58FoxboronReading "The joy of clojure". While reading i got the image of me talking to a monk about why he choosed his way of life, how he communicates with the world and life
17:58Foxboronthen i started thinking back on python, and i saw it like the nazi regime O.o
17:58mammothSteve Yegge seems grumpy about Clojure for some reason.
17:58tomojdoes clojure-mode indent "(assoc m\n k v\n k v)" in a manner in violation of http://mumble.net/~campbell/scheme/style.txt ?
17:58amalloyi doubt if python is disproportionately popular with nazis
17:59Foxboronhahaha
17:59znDuffFoxboron: Heh. I can certainly see Python as a backlash against TIMTOWTDI, but then, I don't think that was a bad approach.
17:59amalloytomoj: yes, it's a bizarre choice for clojure-mode to make
17:59mammothI wonder if his reason are any good
17:59FoxboronI started a threat on reddit once. The topic was to see who used different "hacks"
17:59znDuffmammoth: You're a few months late to that flamewar.
17:59FoxboronIt was downvotes to hell and up again
17:59znDuffmammoth: short form: The consensus is that his reasons are not, in fact, good ones.
17:59mammothznDuff: I am not interested in flame
18:00FoxboronThe overall conservatism of the python community is disturbing tbh
18:00gtraki think yegge likes python though
18:00mammothznDuff: but I can't help but wonder if there is a grain of truth in what he says
18:00gtrak"Python, Common Lisp, Smalltalk/Squeak: Liberal"
18:01Foxborongtrak, liberal as in?
18:01FoxboronThe community?
18:01znDuffFoxboron: You'd have to read Yegge's essay -- it provides the context for that.
18:01Foxboronah, ill look it up then.
18:01gtrakFoxboron: he has a really silly value-judgment thing... it's inflammatory and makes no sense
18:01technomancyliberal as in "able to get people in a seething rage"
18:01gtrakhttps://plus.google.com/u/0/110981030061712822816/posts/KaSKeg4vQtz
18:02gtrakpython's has duck-typing, but people look at you funny and say "that's not pythonic"
18:02znDuffmammoth: ...classifying the Clojure community as staunchly conservative because we advise against using macros more than necessary struck me as more than a bit silly -- the pitfalls of macro overuse are pretty darned easy to run into in practice; it's not some ideological purity thing.
18:03FoxboronWait
18:03Sgeo"necessary" seems a bit harsh
18:03FoxboronHow can he atall say Python is liberal?
18:03technomancyFoxboron: by having a completely useless definition of his terms?
18:03SgeoIf macros are strictly speaking never necessary...
18:03gtrakto his definition...
18:04Foxborontechnomancy, i choose to believe he have an ounch of brain
18:04gtrakit's more liberal than java..
18:04mammothbut fanaticism of clojure people is a little distrubing sometimes. What's so wrong about some state? While I love focus on multicore and stuff, I don't think clojure should deliberately put roadblocks on procedural. Macros are never necesary but they are great way to reduce bloat and bloat is bad.
18:04technomancyFoxboron: sure, you have to be clever to troll that hard
18:04technomancyhe's definitely a good writer, and he knows it
18:04technomancyand he's using it to mess with people he doesn't like
18:04Foxboronhm
18:04SgeoWhat does he classify Tcl as?
18:05FoxboronIts not listed
18:05mammothbottom line there is some truth in what he says and clojure would benefit for some criticism
18:05SgeoClojure would benefit from sensible criticism.
18:05brehautcomplete set of things that do not benefit from some criticism: #{}
18:05gtrakmammoth: state is a necessary evil, because we don't have infinite memory. It's easier to reason about your program if you can step through every state change.
18:06gtrakit should be minimized or scoped well
18:06gtrakno one's really up in arms about that
18:07gtrakit just feels wrong to people that haven't used clojure before
18:07gtrakfor like a week
18:07gtraklike python's indentation
18:08gtrakor java's 'all member functions are virtual'
18:08flying_rhino.
18:08gtrakto C++ guys
18:08gfredericksbrehaut: I don't know how the empty set could benefit from criticism so maybe you ought to say #{#{}}?
18:08Sgeo"there was a key presenter doing a talk on how Macros were basically harmful and should be avoided in modern Clojure code."
18:08SgeoDid that actually happen, or was it "keep use of macros tasteful"
18:09gfredericksthat wasn't the point really
18:09flying_rhinoI switched username becuase my connection died, I am mammoth.
18:09gtrakit didn't actually happen, and the guy in question writes a ton of macros
18:09technomancyhe didn't actually watch the video
18:09gfredericksit was about macros not being composable and etc
18:09gfredericksso yes it was just "keep use of macros tasteful"
18:09ivanhe's talking about https://startpage.com/do/search?q=dsls%20not%20macros
18:09flying_rhinolook I don't think Clojure is all that conservative. But there is one thing
18:10Foxboronwait
18:10SgeoWe should make a language with a macro-like mechanism that's composable
18:10FoxboronYegge actually rates them conservative to liberal based on what the lang actually got
18:10Foxboronthats retarded D:
18:11gfredericksSgeo: how would that work?
18:11TimMcOn a rating scale and valuation he invented.
18:11brehautSgeo: pure functions and rewrite rules!
18:11flying_rhinoI believe Clojure should maybe support old fashioned procedural programming and some old fashioned mutable vars. Because the thing is, all those power tools it has are nice and sometimes necessary, but but what if something you are making DOESN'T require multicore?
18:12gtrakflying_rhino: it does that stuff just fine
18:12Sgeogfredericks, maybe something like what Kernel does, although I don't know if that's composable. Or like Tcl does, but same.
18:12znDuffflying_rhino: first, the functionality is already there.
18:12mroweflying_rhino: then don't use clojure
18:12flying_rhinoglibly stating that state=evil is what can be interpreted as fanaticism
18:12Sgeoflying_rhino, it has support for mutable vars
18:12Foxboron"However, I eventually learned that the Clojure community is extremely conservative. That is is pretty unusual for a Lisp dialect."
18:12FoxboronLike really
18:12FoxboronYou can't base a language as "conservative" just because it choose to have x y and z features
18:13gfredericksGOTO has its place too right
18:13Sgeo,(with-local-vars [a 1 b 2] (var-set a 3) (var-get a))
18:13clojurebot3
18:13znDuffflying_rhino: second, it's not all about multicore development -- a good chunk of the benefits come from having better tools to use in reasoning about state.
18:13Foxboronyou gotta base that on philosophy and the state of the community ._.
18:13gfredericksall languages should have GOTO just in case
18:13gtrakmrowe: I'm not sure I like the idea of 'don't use clojure if you're wrong about it'. I prefer people to stop thinking wrong things.
18:13Foxborongfredericks: i don't like raptors
18:13brehautgfredericks: you kids and your degenerate continuations
18:13dnolenI hate switching Clojure tools
18:14mrowegtrak: I was meaning that if you want a procedural language with easily mutable data structures, maybe another language would be more suited to your task
18:14dnolenanybody else encountered the nrepl C-c C-K ClassFormatError?
18:14mrowegtrak: but yes, one of the big advantages of using clojure is learning to think in new ways
18:14flying_rhinoznDuff: is it? Is there example of small p[rogram made in clojure in procedural way? At least as an example of what not to do?
18:14gtrakmrowe: yea, I guess so. java-like stuff in clojure for me isn't hard because of mutability, it's hard because of tooling, imo.
18:14FoxboronApparently Yegges says most of the Clojure community comes from Haskell
18:15mrowebut if people are going to keep wishing "if only clojure had $convential_language_feature_x"...
18:15amalloywhy are we still talking about yegge?
18:15Foxboronamalloy, lol sorry.
18:15znDuffflying_rhino: What do you need an example for? What part isn't obivous?
18:15FoxboronI am commenting as i read along :P
18:17znDuffflying_rhino: ...I mean, everything you need is right there on the clojure cheatsheet, and most of it is used quite frequently when doing interop code.
18:17flying_rhinoznDuff: well, where are those mutable vars for one? Please don't be annoyed with me. I do like advanced features of clojure, it just feels like overengeenering for some stuff.
18:17znDuffflying_rhino: atoms, and/or dynamic Vars.
18:17znDuffflying_rhino: next question?
18:17znDuff(preferably, atoms)
18:18flying_rhinoso you can basically create python like code with atoms (if you wanted to) ?
18:18znDuffflying_rhino: It'd be silly, but you could.
18:18FoxboronQuestion, i read a place that "loop-recur" is a newbie trap, what would the other option be?
18:19mroweflying_rhino: or you could just use python :)
18:19brehautFoxboron: well, for primative recursion, 'reduce'
18:19flying_rhinoznDuff: you just made this rhinoceros happy :)
18:19Foxboronbrehaut, so i got a feeling i should sit down with map,filter and reduce and get a good grasp of that?
18:20brehautFoxboron: yes
18:20amalloyIMO usually lazy sequences, not reduce, are usually a better thing to translate a new clojurer's loop/recur to
18:20flying_rhinomrowe: what if part of your app needs that aproach but you need multicore somewhere else, and you want to keep everything under JVM?
18:20mefistoznDuff: hey, where is that cheatsheet?
18:20znDuffmefisto: http://clojure.org/cheatsheet
18:20flying_rhinomrowe: my point is that deliberately locking lisp dialect to one scheme isn't wise.
18:21flying_rhinodoes ANYONE get my point ??
18:21lazybotflying_rhino: What are you, crazy? Of course not!
18:21amalloy(inc lazybot)
18:21lazybot⇒ 9
18:21dnolenflying_rhino: I don't think you've used Clojure long enough to have an informed opinion about the matter.
18:22mroweflying_rhino: there are already other jvm languages that are mutable by default and have good threading support (e.g. er, java)
18:22amalloydnolen: i haven't tried nrepl, but i've been on lein2 for ages. preview10 works well, although latest master doesn't
18:23flying_rhinomrowe: yeah but lack of bloat due to macros is another nice feature of clojure that java (and other jvm langs) lacks. And imho big selling point of lisp is that it is flexible.
18:23Foxboroni also had luck with the preview10 where everything else failed
18:24flying_rhinomrowe: all in all procedural should not be mocked
18:24brehautflying_rhino: haskellers (in particular) have long since shown that procedural is a special case of function calls
18:25mefistothanks!
18:25brehautalso scheme i guess, though less obviously
18:25mroweflying_rhino: have you read SICP? stepping back and thinking about other models of computation than procedural may give you some insight
18:26mammothbrehaut: look we are all turing complete here. My point is that one should always pick most straightforward practical approach.
18:26mammothI hate my ISP
18:27mammotheverything not straightforward is masturbation in my opinion. Clojure is straightforward for multicore.
18:27Sgeoflying_rhino, have you considered trying Common Lisp?
18:28gtrakmammoth: ... that's very short-sighted
18:28brehautmammoth: go read http://dave.fayr.am/posts/2012-10-4-finding-fizzbuzz.html and come back
18:28gtrakjust because it's designed for multicore doesn't mean it's worse at other things
18:28FoxboronWhen it comes to language discussion, i enjoy what the father of Ruby said
18:28Foxboron"Ruby is the perfect language for me, not everyone else."
18:28SgeoI have a bit of a Haskell background, I really like the immutability, even if I'm not doing multithreading
18:29Sgeo(inc aperiodic)
18:29lazybot⇒ 5
18:29brehauthells yes
18:29mammothSgeo: I figured it would be easier to improve procedural in Clojure than immutable in Common Lisp.
18:29SgeoYou could easily make a Common Lisp macro to make an immutable CLOS class...
18:29SgeoI've done it
18:29gtrakmammoth: I wrote something over the weekend, kind of a troll, but relevant :-): https://github.com/gtrak/knr/blob/master/src/knr/core.clj
18:30alindemanTuring complete is not hard to achieve ;) It's kinda the point
18:30alindemangtrak: Niiiice
18:30gtrakyou can see where I'm going with this: (let-free [myarray (-> :complex sizeof (* 16) malloc)]....
18:30scriptoralindeman: it's more that people insist just because two languages are turing complete they're essentially the same
18:31Foxboronbaw.....gtrak looking at that code makes me wanna understand it :c
18:31alindemanscriptor: Ah
18:31gtrakit's the most mutable of codes
18:31SgeoYou can do everything with COBOL that you can do in Clojure!
18:32bjorkintoshuh oh.
18:32FoxboronYou can do everything CLojure do in Assembler
18:32FoxboronBut i don't think anyone wanna do that?
18:32bjorkintoshdid i accidentally join #trollol?
18:33scriptorFoxboron: volunteering to build us a ClojureMachine?
18:33Sgeobjorkintosh, people were mentioning the silliness of saying "Well, all these languages are TC, therefore they're all alike"
18:33gtrakmy argument's that lisps ease of up/down abstraction makes it more moot than it would for other languages
18:34Foxboronscriptor, it was a response to sgeo :)
18:34scriptorI know, but I still think you should :p
18:34FoxboronWell
18:34flying_rhinoscriptor: I do not insist that all languages are the same. All I am saying that since turing completeness makes everythiong possible in every language, practicality should win out. And immutability, although great at many places, is not ALWAYS the most practical thing
18:34gtrakthink of what that low-level code would look like in java
18:34Foxboronscriptor, my experience of "low-level" programming goes as far down as "high-level" languages go.
18:35FoxboronAka, none.
18:35Foxboron^^
18:35bjorkintoshyou guys are stuck in a frigging ivory tower. let's hear you make these arguments on a shop floor... what wins out? the right tool for the right job. period.
18:35bjorkintoshnothing else matters.
18:35scriptorflying_rhino: you could reverse that statement somewhat, couldn't you? While mutability may be practical sometimes, it's not *always* the most practical thing
18:35scriptorit's just a matter of what you're working on
18:35flying_rhinoscriptor: ofcourse
18:35flying_rhinoscriptor: that's why Clojure should have both
18:36mefistoclojure has mutability... what's the issue?
18:36znDuffflying_rhino: if you want a language that does everything, go have fun with Scala
18:36znDuffflying_rhino: ...you'll find it to be an utter mess.
18:36znDuffflying_rhino: trying to be too many things to too many people leads to a disorganized mess.
18:36gtrakit has *more* support for mutability than java. You can code event handlers and things to state change.
18:38flying_rhinomefisto: then why am I laughed at when I ask people to show me an example of mutable code in clojure?
18:38gtrakthey like = more than reset! ?
18:38flying_rhinoznDuff: well python isn't utter mess. Scala is but I don't think it is due to existance of mutability
18:39znDuffflying_rhino: Python isn't a mess because it's written by one person at the helm with a consistent design vision and purpose... much like Clojure.
18:40brehautflying_rhino: nobody is laughing at you. they are telling you that its not the idiomatic way in clojure
18:40znDuffflying_rhino: Python explicitly _rejects_ trying to support all workflows and styles -- deciding that Perl was completely wrong in following TIMTOWTDI was really the Big Idea behind it, in my eyes.
18:40mefistoflying_rhino: it's not idiomatic
18:41flying_rhinomefisto: I would still like to see that not-idiomatic code.
18:41flying_rhinofor the lulz
18:41FoxboronPeople should have a more relaxed relationship with "non-idiomatic" code
18:41mefistoflying_rhino: you can abuse things like atoms or do it with java classes. I don't have a code example handy
18:42gtrakflying_rhino: https://gist.github.com/ec9043e47789bc11d662
18:42Foxboron"Its not idiomatic! i refuse to code!"
18:42bbloomthere is also the set! form
18:42flying_rhinogtrak: thanks! What was so hard about this?
18:43gtraknothing?
18:43clojurebot@ has nothing to do with whether sth is evaluated or not
18:43bbloomand i think you'd be surprised at how far you can push immutability
18:43bbloom:-)
18:43brehautFoxboron: writing non-idiomatic code is fine, if you already create idiomatic normally. writing sensible python in clojure is a silly
18:43Foxboronbrehaut, sounds like what i am doing now, but i am however a newb, so i feel i can be excused on that ^^
18:44gtrakflying_rhino: obviously we want to discourage unidiomatic code to people who are learning the language.
18:44flying_rhinobrehaut: nothing is silly if it solves certain problem the best.
18:44bbloomthe more clojure i write, the harder i find it to think in the presence of mutation in other languages… it's made me deeply aware of all the complexities of state. now it's like hearing a voice that i can't silence that says "somebody is gonna mutate that and fuck you up"
18:44mefistoFoxboron: I think clojure's approach to idiomatic code is somewhat similar to the notion of fate in the webcomic erfworld... you can fight against it, but you will just end up taking a more painful path to the same place
18:45gtrakif you know better, go ahead, but you should make sure you know it all the way before doing it wrong out of habit
18:45Foxboronmefisto, what if drop the fighting and live in harmony?
18:45Foxboronif we drop*
18:46mefistothere's no "we"... the idea is, you will just end up fighting against the language and yourself ;)
18:47brehautflying_rhino: writing python code in clojure is silly.
18:47brehautflying_rhino: by definition, its not solving the problem best
18:47Foxboronoh btw, while i still remember it
18:47FoxboronAnyone got any books/sources about thinking in a functional language?
18:47bbloomif you really want to do a lot of mutation, maybe for perf or what not, write some java
18:48bbloomand that's not a joke
18:48Foxboronkinda stuck with the OO kind of doing stuff, and its a bit anyoing.
18:48bbloomi mean seriously: write some java! that's what it's there for. you can call it easily from clojure
18:48mroweFoxboron: http://mitpress.mit.edu/sicp/
18:48dnolencemerick: so does nrepl still blow up if given a large set of contents?
18:48mefistoFoxboron: clojure in action from manning, or for the purest of pure functional heroin take a look at http://learnyouahaskell.com/
18:49gtrakbbloom: I've worked longer in java, but I find it to be more of a hassle to write a bit of java than to fight through java interop in clojure.
18:49mroweFoxboron: also, Brian Marick's "FP for OOP programmers" is not bad: https://leanpub.com/fp-oo
18:49bbloomFoxboron: I'll second SICP. good stuff!
18:49Foxboronmefisto, not looking for a new lang ;P
18:49mammothbrehaut: I was using it as an example of simple pragmatic language.
18:50SgeoCan that FP for OOP programmers thing teach an FP programmer OOP?
18:50SgeoBy showing examples in the reverse?
18:50ChongLiSgeo: SICP includes some stuff on OOP
18:50FoxboronSgeo, OOP is cake....
18:50mefistoFoxboron: I learned some haskell first and found it easier to move to clojure from there. to really immerse yourself in functional stuff I think haskell is more direct
18:50SgeoAlthough I think I still rely on state too much
18:50ChongLibut they start from first principles
18:51ChongLiwhich may actually teach you more about OOP
18:51ChongLi(from a different angle)
18:51SgeoI've read a bit of Let over Lambda
18:51Foxboronmefisto, hahahahaa. I got a friend doing a CMS in Haskell atm :) But i'll do it if i get some time!
18:51ChongLiI really love how SICP does it
18:51mefistoa CMS in haskell? this I'd like to see
18:51ChongLithey start off with pure functions and teach you the great beauty of the substitution model
18:51Foxboronmefisto, 2 sec then.
18:51SgeoI started on SICP a while ago, but sort of paused for a long while
18:51ChongLiand then they tear that down when they introduce assignment
18:52ChongLiit's actually quite traumatic
18:52Foxboronmefisto: https://github.com/Tehnix/HsCMS
18:52Foxboronmefisto: running on codetalk.io atm
18:52mefistothanks!
18:52FoxboronNP :)
18:52tufflaxIs Let Over Lambda good?
18:54hcumberdalehi
18:54tufflaxhi there
18:57hcumberdalehow can I access a atom from another thread?
18:59creasehcumberdale: as you normally would, I think
18:59amalloytufflax: it's all right
19:00mammothbrehaut: are you dave fayr ?
19:00brehautmammoth: no
19:01amalloynothing like as good as sicp
19:01mammothwell it was nice read
19:01mammoththanks
19:01tufflaxAs far as I've understood (without reading LOL) they have different goals :p
19:01mammoththanks for pointing me to it, I mean
19:01tufflaxSICP and LOL that is
19:02amalloyindeed. i think LOL's goal is to tell you that common lisp is the only lisp worth using
19:02tufflaxhehe
19:02amalloyalong the way he definitely says some interesting things
19:03brehautmammoth: no problem. i think its a really good article
19:03brehautmammoth: a great examination of why an initially straightforward looking solution is sub optimal, and how a 'more complex' solution is actually easier to understand
19:04mammothbrehaut: I just don't think it changed my point much. Look, I like functional. If I didn't I wouldn't be here. I just think exclusion of other styles is bad. I don't want to start flame again but that was my point.
19:04abphell-o
19:05technomancysteve? is that you?
19:05technomancythe whole point of FP is to prevent you from doing harmful things
19:05technomancyjust like the point of garbage collection is to prevent you from making memory allocation mistakes
19:06mammothbrehaut: take a look at his ruby example. It uses functions in vectors (which I like, very much) but is still mutable. In other words it is potent mix of functional and procedural.
19:07brehautmammoth: thats what i consider a potent mix of shooting myself in the foot in 6 months time ;)
19:07abpWhat is the best approach to build functional graphs? I use clojure.tools.namespace.dependency presently, which gives me a structure like #Graph{:dependencies {:b #{:a}}, :dependents {:a #{:b}}} Would using something zippable be "better"?
19:09brehautmammoth: i (like i suspect a lot of clojure programmers) am fine with small, carefully applied piece of mutability as long as carefully demarcated and has clear access semantics
19:09abpI'm ultra afraid of mutable things now. :x
19:10brehautapb: i wouldnt watch John Carpenters The Thing then
19:10flying_rhinoI like when main thread in program uses mostly mutable data (but still uses other functional stuff like functions as arguments), but it spawns side threads that work on immutable data.
19:11abpbrehaut: I have watch it. It's our society in terms of objects. :D
19:11Foxboronand there i thank Clojure for another night with...... 5 hours of sleep.
19:11FoxboronNight peeps :) Remember to sleep and save yer beards ^^
19:11abpbrehaut: Thanks for help shaping this metaphor.
19:13abpOOP, you know, it's like everbody running around, heavily shifting looks and skin, everything! Wait, have you watched Carpenters The Thing?
19:15brehautThis summer, coming to a cinema near you: John von Neumann's The Thing
19:15tufflax:)
19:19ChongLihow about escher's metacircular evaluator?
19:56devnIs there a way to limit the buffer length of a slime repl in emacs so it doesn't choke if it wants to print, say, 10,000 lines?
19:57devni know about (set! *print-length* ...) and so on, but I have an open buffer and I'm doing some poor man's debugging and want to stop it from choking.
19:57CaptainDerpHi, how do i cleanly swap an atom within a map that is not an atom?
19:57tomojthe only think I know is to be careful what I print :(. I think nrepl mostly fixes the problem
19:58devntomoj: that's not a luxury I have in this case
19:58CaptainDerp(swap! theMap assoc key val) swaps the val within a map that IS an atom
19:58devnI know what's going to print. It's 280,000 strings.
19:58CaptainDerpbut i do not want restriction on the map itself (so i do not want to make it an atom)
19:59brehautCaptainDerp: so you have (let [the-map {:atom (atom 1)}] … )
19:59brehaut?
20:00brehaut,(let [the-map {:atom (atom 1)}] (swap! (:atom the-map) inc))
20:00clojurebot2
20:00devntomoj: right now I just am hitting C-c M-o every 2000 lines or so, but that is getting...ridiculous.
20:00CaptainDerpmore like (let [the-map {"123" (atom 1)}]
20:01CaptainDerp(swap! ("123" the-map) inc)) like that?
20:01brehaut,(let [the-map {"abc" (atom 1)}] (swap! (the-map "abc") inc))
20:01clojurebot2
20:02brehautkeywords are functions of maps, but strings are not. but maps are functions of their keys
20:02CaptainDerpok awesome
20:02CaptainDerpthanks
20:03CaptainDerp... also I do not want the map to be an atom because I am afriad that this will restrict access to mapped values.
20:03CaptainDerpAm i right in this justification and by never changing the map itself and only the atoms refereneced i should be fine right?
20:04brehauti guess. you are the only person who knows your programs requirements though
20:04znDuffCaptainDerp: waitamoment, why are you trying to do it that way? You talk about not wanting some restriction, but I'm very unclear on what exactly that restriction _is_.
20:05seangroveHey all, I've done something stupid with my project, and now I get: Exception in thread "main" java.lang.ClassNotFoundException:
20:05seangrove
20:05CaptainDerpI did not want to overload with tmi. But basically i will have client front ends polling from blocking queues referenced by the maps.
20:05clojurebotmaps are *AWESOME*
20:05seangroveThis has got to be super basic... I'm using (:gen-class :main true), lein 2..
20:05CaptainDerpThanks clojurebot!
20:06CaptainDerpAnd i need other threads to add to the queues referenced by the map
20:06CaptainDerpby making the whole map an atom, it works
20:06CaptainDerpbut wouldn't this be a bottleneck if muliple client front ends are trying to access the mapped values (if another client is already accessing the mapped values)
20:07znDuffCaptainDerp: atom derefs are non-blocking.
20:07CaptainDerpbasically: can muliple threads access an atom at once without slowdown/issues
20:07CaptainDerpah
20:07brehautCaptainDerp: why are you putting queues in atoms?
20:07CaptainDerpit just blocks if a change is being made
20:07znDuffCaptainDerp: ...no, I didn't say that either. :)
20:07CaptainDerpok
20:07seangroveMaybe lein 2pre10 is borked...
20:08CaptainDerpan atom facilitates multiple thread access right?
20:08znDuffCaptainDerp: swap! can repeat the operation if a check-and-set indicates that someone else changed it at the same time
20:08CaptainDerpan it is synchronous not asych
20:08znDuffCaptainDerp: so -- it doesn't block, it just retries.
20:08znDuffCaptainDerp: (which is why you want the operation you pass to swap! to be something fast and free of side effects)
20:09znDuffCaptainDerp: ...so -- the check-and-set / retry thing is very much inherently async.
20:09brehautCaptainDerp: are you using clojure.lang.PersistentQueue or java.util.concurrent.LinkedBlockingQueue ?
20:09CaptainDerpok but if the map itself is an atom and not all the mapped objects then will check-and-set fail if the specified mapped object is not being accessed but another mapped object is?
20:09amalloythat's the opposite of async, znDuff
20:10CaptainDerpjava.util.concurrent.LinkedBlockingQueue
20:10flying_rhinobrehaut: maybe the thing Yeggie was ranting about can be summed up as "What's more, if you write your liberal-language code in a conservative way, people will just look at it and say: 'Well, it's kinda boring, and you could have saved a lot of coding by using some dynamic features. But I guess it gets the job done. LGTM.' " While in conservative language everyone is upset when you do things libera
20:10brehautCaptainDerp: then you dont need to put them into atoms to handle mutation or access
20:10znDuff...you're ordering completion, yes, but you're not using a lock to pre-serialize.
20:11flying_rhinobrehaut: when I suggest python-ish way in clojure no one liked it
20:11amalloytry suggesting a clojure-ish solution in python. nobody will like that either
20:11flying_rhinobrehaut: this might be what yegge was talking about.
20:11znDuffflying_rhino: I have to agree w/ amalloy and friends -- "#python is for good ideas only", to quote their policy.
20:12znDuffflying_rhino: ...if you talk about doing things in a non-Pythonic way there, you _do_ get shut down.
20:12amalloyhah, really? that's a great policy
20:12flying_rhinoznDuff: all I am saying is that stuff like this make clojure conservative as yegge said.
20:12CaptainDerpok i am still not 100% clear. I need a map where i have async access to its mapped values but sych access to each specific mapped value.
20:12znDuff(more politely than in #bash, but that's a different discussion)
20:12flying_rhinoit is not all bad znDuff
20:13znDuffflying_rhino: ...but Yegge claims that Python is liberal, while it has the same culture.
20:13CaptainDerp(multiple threads can access different mapped values, but not the same mapped value)
20:13flying_rhinoznDuff: he didn't say python is particulary liberal, that's ruby
20:13CaptainDerpsorry, access and manipulate
20:13brehautflying_rhino: is it conservative to tell someone not to drive their car on the wrong side of the road? or is that just common sense?
20:14abpflying_rhino: What things from python do you mean?
20:14znDuffflying_rhino: ...and Ruby is also an utter bloody mess.
20:14flying_rhinobrehaut: yeah but you guys clasify a lot of stuff as wrong, while liberals clasify frwer stuff as wrong.
20:14flying_rhino*fewer
20:14CaptainDerpEh? ... in the flood of messages should i restate what i asked?
20:14brehautflying_rhino: python classifies just as much stuff as wrong
20:15brehautflying_rhino: writing function code in python is largely considered not pythonic
20:15seangroveUhg just started a new project with lein, and still get this with `lein run`: "Exception in thread "main" java.lang.ClassNotFoundException: zenbox.core"
20:16CaptainDerpok i am still not 100% clear. I need a map where i have async access to its mapped values but sych access to each specific mapped value.
20:16CaptainDerp(multiple threads can access different mapped values, but not the same mapped value)
20:16CaptainDerp(atom {}) does not provide this right?
20:16CaptainDerpbut {"abc" (atom 1)} does?
20:16seangroveWhat am I missing here?
20:17flying_rhinobrehaut: I guess we will have to agree to disagree about some stuff (not as much stuff as you might think). I'll continue with clojure even if I am not as fired up as I might have been.
20:17technomancyclojure will not turn bad ideas into good ones
20:17technomancysad but true
20:17brehautflying_rhino: try programming clojure with the grain, rahter than trying to fight it. you might find it more enjoyable
20:17brehaut(inc technomancy)
20:17lazybot⇒ 40
20:18brehautfar out man. spend some of that karma somehow
20:18technomancyclojurebot: drinks are on meeeeeee!
20:18clojurebotNo entiendo
20:18flying_rhinobrehaut: will do
20:19znDuffCaptainDerp: When you say "async access", you really mean non-blocking access, right?
20:19znDuffCaptainDerp: ...and when you say "sync access" for writes, you mean you want them to be coordinated?
20:20znDuffCaptainDerp: because if that's the case, I don't see why you can't just put the whole thing into an atom... _maybe_ a ref, if you have more complex logic going on around updates than you're telling us.
20:20CaptainDerpznDuff async as in non-blocking yes (aka not an atom), and sync as in blocking (aka atom)
20:20znDuffCaptainDerp: ...ehh.
20:21znDuffCaptainDerp: atoms are always non-blocking on reads.
20:21znDuffCaptainDerp: ...they can spin a little on writes, but it sounds like that's what you want.
20:21CaptainDerpznDuff but if i have (atom {}) and try to swap! a value (val1) within it, will it block if val2 if being accessed?
20:21znDuffCaptainDerp: if it's a read access? No.
20:21CaptainDerpznDuff yes i know for reads, but i am concerned about writes
20:22CaptainDerpi will never be swapping the map or removing the map, just the mapped values
20:22znDuffCaptainDerp: I'd suggest doing it the natural way, and changing it only if benchmarks show you have a problem.
20:22brehautCaptainDerp: LinkedBlockingQueues are already mutable; No Requiere Atom
20:23CaptainDerpbrehaut: so if i have ({"123" LinkedBlockingQueues} then i do not have to care about any of this?
20:23brehautCaptainDerp: they have their own access semantics
20:23CaptainDerphmm ok makes sence
20:23CaptainDerpsense *
20:23brehautCaptainDerp: well, you dont have to care about atom semantics. you have to care about the queue semantics
20:23CaptainDerpi can throw atoms out the window for now then :P
20:24brehaut(the queues allow nonblocking writes, and blocking reads (with optional timeoutes) from memory)
20:24CaptainDerpbrehaut true
20:24CaptainDerpbut that is easy imo
20:26CaptainDerpgod, replacing a map value is anoying as well it looks like i should do this: (update-in entity [:position] #(add % (:velocity entity)))
20:26CaptainDerp... but i find that a bit confusing
20:27CaptainDerpswap! has easy samantics lol
20:27brehautCaptainDerp: fnil is your friend
20:28brehaut,(update-in {:a {}} [:a :b] (fnil inc 0))
20:28clojurebot{:a {:b 1}}
20:29amalloyhow does his problem have to do with fnil?
20:29CaptainDerpok thats cool i guess, provides a default value if passed 0
20:29CaptainDerpbut ya what amalloy said
20:30brehautamalloy: it has a lot to do with it if you violently misread things
20:30brehautotherwise: not much
20:30amalloythe advice he needs is more like (update-in entity [:position] add (:velocity entity))
20:30CaptainDerphmm all i need is an example
20:30CaptainDerp{"abc" 1}
20:31CaptainDerpreplace abc with 2
20:31CaptainDerp:)
20:31amalloylook up, one line above your name, for an example :P
20:31dnolen,(update-in {:abc 1} [:abc] inc)
20:31clojurebot{:abc 2}
20:31dnolen,(update-in {:abc 1} [:abc] + 4)
20:31clojurebot{:abc 5}
20:31CaptainDerpok thanks a lot dnolen
20:31dnolen,(update-in {:abc {:x 1.0 :y 5.0}} [:abc :x] * 0.5)
20:31clojurebot{:abc {:y 5.0, :x 0.5}}
20:33CaptainDerp(defn update-map [key val] (update-in theGlobalMap [key] val) )
20:33CaptainDerp.. correct?!?
20:35dnolenCaptainDerp: why not pass the state as explicit argument? I'm assuming you're making some kind of game here.
20:35brehaut(comp update-in global-map)
20:36brehautcomp‽
20:36brehautno, partial
20:38brehautCaptainDerp: minor point: camelCase is ugly in lisp. http://mumble.net/~campbell/scheme/style.txt
20:38brehautsection ** Names
20:39brehautwith the exception that camel case is still used for things that generate java classes or interfaces
20:47dnolenbbloom: ping
20:49bbloomdnolen: pong
20:50dnolenbbloom: working on source mapping again - I see you didn't bother to add column info to symbols only seqs?
20:50bbloomdnolen: you mean in the jvm's reader?
20:50dnolenbbloom: yep
20:50bbloomdnolen: hmm. i'm not sure. i basically did a search for all occurrences of "LINE" and added a parallel COLUMN
20:51bbloomdnolen: also, my patch was pretty stale by the time somebody applied it
20:51dnolenbbloom: http://github.com/clojure/clojurescript/commit/07e5516aa3cbb022ccf1659e3bf66d270ede049e
20:51bbloomdnolen: oh! you mean in the clojureSCRIPT compiler
20:51dnolenbbloom: it's better than nothing, but errors now get line & column information
20:51bbloomdnolen: sorry, i misunderstood
20:51dnolenbbloom: no I mean your patches to the Java reader
20:51dnolenbbloom: those patches affect what we see in CLJS
20:51bbloomdnolen: oh, heh ok then i did understand :-)
20:52bbloomdnolen: well 1.5 isn't out yet, it's not too late to sneak in a patch, is it? :-)
20:52dnolenbbloom: still, like I said, this is a big improvement even for errors - starting to look into the merge process
20:53dnolenbbloom: we can fully decode Closure source maps, now just need to take that info and merge with compiler mapping and generate the final source map.
20:53bbloomdnolen: awesome
20:54dnolenbbloom: it would be nice to get into 1.5.0 but I'm not holding my breath
20:54bbloomdnolen: I'm peaking at Compiler.java to see what i missed
20:54bbloompeeking*
20:55dnolenbbloom: you can't put metadata on arbitary things of course, really I just want them on var symbols (including locals)
20:55bbloomdnolen: but you can put them on symbols, right?
20:55bbloomdnolen: if they have line data, they should have col too
20:55dnolenbbloom: yes that's what I meant ^
20:55bbloomdnolen: keywords can't have them tho
20:56bbloomor am i remembering wrong...
20:56bbloom&^:x 'y
20:56lazybot⇒ y
20:56bbloom&(with-meta (symbol "x") {:y 1})
20:56lazybot⇒ x
20:56bbloom&(with-meta (keyword "x") {:y 1})
20:56lazybotjava.lang.ClassCastException: clojure.lang.Keyword cannot be cast to clojure.lang.IObj
20:56bbloomyeah
20:57dnolenbbloom: yeah I'm not even sure column info on keywords is that useful - vars & locals are what you're interested in when debugging.
20:57TimMc&(read-string "^:x 'y")
20:57lazybot⇒ (quote y)
20:57TimMc&(read-string "^:x y")
20:57lazybot⇒ y
20:58bbloomdnolen: yup. just thinking aloud
20:59bbloomdnolen: ok so you said seqs have columns, but not symbols? what about vars?
20:59abp_dnolen: Is this: https://gist.github.com/4115467 a legitimate solution to not being able to use qualified symbols in a macro?
21:01cemerickdnolen: "blow up given a large set of contents"?
21:01bbloomheh, everyone trying to talk to dnolen at once :-P
21:02dnolenabp_: what you mean is qualified symbols in fn args?
21:02dnolencemerick: resolved, old issue in nrepl that affects beta but not RC1
21:02abp_dnolen: That's a tiny part of my take on prismatics graph. I want to build reactive systems fully declared in terms of fnk-graphs. But i want to use qualified keywords in maps and need to destructure them into qualified symbols.
21:02cemerickoh, probably related to load-file
21:02abp_dnolen: Yep, let's too, I think.
21:02bbloomdnolen: VarExpr and TheVarExpr don't seem to take source, line, or column values in their constructors. that's likely the source of the trouble
21:02cemerickNot super-happy about the resolution there, but it'll do for now.
21:03dnolenabp_: anything like will involve some hack - no opinions on that from me :)
21:03dnolencemerick: yes load-file was broke
21:03abp_dnolen: When one get's the source of such an fn.. Now, it's not what it pretends to be. That's my only concern.
21:03dnolenbbloom: yeah that sucks, tooling wants that info.
21:04bbloomdnolen: I don't really have time to hack on this now, but I think it's a straightforward patch to add that stuff
21:04dnolenbbloom: heh, wasn't asking for a patch - just insight
21:05bbloomdnolen: well here's my insight: the base Expr interface should have column and line info
21:05bbloomdnolen: right now, that info only exists where strictly necessary for particular categories of errors
21:06abp_dnolen: What is the best approach to build functional graphs? I use clojure.tools.namespace.dependency presently, which gives me a structure like #Graph{:dependencies {:b #{:a}}, :dependents {:a #{:b}}} Would using something zippable be "better"?
21:07bbloomabp_: what do you mean by zippable?
21:08bbloomabp_: the best approach to representing graphs is gonna vary based on the use case
21:08dnolenabp_: I really don't know what's best, I haven't considered that particular problem before. others might have thoughts on that - might want ask on the mailing list as well.
21:08abp_dnolen: Yes.
21:09CaptainDerpis there any way to replace/add values in a map without having to replace the original map?
21:09ChongLiCaptainDerp: put the map in an atom
21:09ChongLiand update it with swap!
21:09CaptainDerpoh my fucking god
21:09abp_bbloom: By zippable I mean hierarchical, glad you asked. ;) The use case is building topological chains and wrapping nodes.
21:09CaptainDerphere i was one hour ago and people in here convinced me not to use atom
21:09ChongLi?
21:10dnolenCaptainDerp: that seems like missing the point - functional updates.
21:10CaptainDerpsorry
21:10CaptainDerphaha
21:10ChongLiwhat were their arguments?
21:10ChongLiI'm not exactly a pro clojure hacker
21:10bbloomabp_: it seems that zippers are only really useful for trees with containment. they don't really seem to have any support for some top-level notion of an index
21:11bbloomabp_: by that I mean if you had some map of node-id to a vector of child node ids, there isn't really a clean way to use a zipper on that
21:11dnolenCaptainDerp: if perf is an issue there are ways to achieve Java perf mutation - but I would try to understand the Clojure way for the time being.
21:11bbloomabp_: immutible graphs almost necessitate that type of node or edge (or both) index
21:12bbloomabp_: but there may be a functional analog of a zipper… although i don't know of one
21:12bbloomanalog, for graphs, i mean
21:12ChongLiI guess it really depends on what you're doing
21:12ChongLiif you end up making the map an argument to every function
21:12ChongLiyou're probably doing something weird
21:14abp_bbloom: Isn't clojure.zip functional? It's able to zip into nested vectors.
21:15bbloomabp_: zippers only work on trees, not graphs
21:15CaptainDerpok i am trying to swap an atom within a map but it only accepts a function: (swap! (theMap key) val) fails
21:15bbloomabp_: you can project a graph onto a tree via a walk, but zippers provide editing and the interface to clojure's zipper library isn't robust enough to support graph-backed trees
21:15ChongLithe map should be in the atom
21:15CaptainDerpit is
21:16CaptainDerpoh wait
21:16CaptainDerpsorry no
21:16CaptainDerpi cant have the map as an atom
21:16ChongLiwhy not?
21:16CaptainDerpotherwise i would use assoc
21:16CaptainDerpi need it to be non-blocking on writes
21:16abp_bbloom: Good to know, then i'll stick with clojure.tools.namespace.dependency for a while. It's basically just the index representing the graph.
21:16ChongLioh
21:17ChongLian agent is probably what you want then, right guys?
21:17CaptainDerphmm
21:17bbloomabp_: yeah, that's the simplest and most common graph representation: some index of nodes and some index of edges, plus optionally a reverse index of edges
21:17ChongLia clojure agent provides shared access to mutable state
21:17ChongLiand does so in an indepdent, asynchronous manner
21:18ChongLiindependent
21:18bbloomabp_: if you read Huet's original paper on zippers, you might discover a way to apply the principals to graphs :-) or maybe somebody else already has, but i don't know if it
21:19CaptainDerpso i have to wrap my map?
21:19ChongLiif you want to store it in an agent, yeah
21:19CaptainDerpbut is that a necessity ?
21:20ChongLiwould it be a problem?
21:20ChongLiyou want multiple threads to hammer on this map in an asynchronous, non-blocking fashion?
21:21CaptainDerpso are you saying that there is no way i can update a map's values?
21:21CaptainDerpi have to replace the map always
21:21bbloomCaptainDerp: yes. and that is a feature
21:21CaptainDerpbbloom thank you
21:21bbloomCaptainDerp: in fact, that's one of the BEST features of clojure :-)
21:22ChongLiCaptainDerp: you're not "replacing the map"
21:22ChongLiyou're associng new key value pairs with the map
21:22CaptainDerpso in order to update a map's values i have to wrap it in an agent
21:22bbloomCaptainDerp: no
21:22bbloomCaptainDerp: forget agents
21:22bbloomCaptainDerp: forget atoms
21:22ChongLiCaptainDerp: no, you can pass it around all you want
21:22bbloomCaptainDerp: take a break from all that stuff for a bit
21:23bbloomCaptainDerp: that stuff exists for concurrency
21:23loliveira,(let [{:keys [c d] :or {:c 0 :d 0}} {:d 5}] [c d])
21:23clojurebot[nil 5]
21:23bbloomyou need to get a handle on the core concepts before you touch the more advanced ones
21:23loliveirashouldn't eval to [0 5]?
21:23bbloomi recommend 4clojure.com
21:23CaptainDerpbbloom: it is the key issue i working through at the moment
21:23CaptainDerpi got it working as an atom but that is innefficent
21:23ChongLiCaptainDerp: can you tell us more about what you're actually trying to do?
21:23bbloomCaptainDerp: http://www.4clojure.com/users follow 10 or 20 of the top users there
21:24CaptainDerpi may not know all the concepts but this best how i learn
21:24aperiodicloliveira: ##(let [{:keys [c d] :or {c 0 d 0}} {:d 5}] [c d])
21:24lazybot⇒ [0 5]
21:24bbloomtry the puzzles on 4clojure and then learn from the other people who solved them
21:24aperiodicloliveira: you're providing defaults for the symbols, not the keywords
21:24loliveirathank you
21:25aperiodicyou're welcome
21:25bbloomCaptainDerp: you might want a "transient" if you're "birthing" a value. however, everyone in this channel is just guessing what you're trying to do, so the advice is watered down
21:25CaptainDerpi just neeed a map with asych access (def will do that), sych reads and writes to the values (no issue there im using a blocking queue), but i need to add/replace key/values in the map without replacing the map
21:25ChongLiCaptainDerp: clojure uses structural sharing
21:25bbloomCaptainDerp: do *NOT* use def for modifying variables. ARGH that's not even close to right :-P
21:25ChongLiit never "replaces the map"
21:25CaptainDerpthe key issue at the moment is aysch writes
21:26bbloomCaptainDerp: no, the key issue is that you aren't comfortable with immutability :-P
21:26CaptainDerpbbloom i am not using it for modigying i am using it only for initial creation
21:27CaptainDerpbbloom frankly i think you are being a bit rude. I have no issue with concurrancy or immutability i am learning the clojure process of dealing with them.
21:27bbloomCaptainDerp: my apologies
21:27bbloomCaptainDerp: You're right. my comment was out of line
21:27ChongLithere's a big difference between typical immutable values in a language like java (where full copies are performed) and the persistent data structures used in clojure
21:27bbloomCaptainDerp: I'll go back to work :-P
21:28CaptainDerpno problem, 12 hours in at work here and shit can go crazy too
21:28ChongLiCaptainDerp: agents are what you want to manage asynchronous change
21:28ChongLi(def blah (agent {}))
21:28CaptainDerpi almost am done, i already have it working. But i know that efficency is going to be an issue if the whole map is an atom
21:28ChongLi(send blah assoc :a "hi")
21:28ChongLi(send blah assoc :b "hello")
21:29ChongLiatoms and agents are just reference types
21:29CaptainDerpChongLi thanks i will look into it again. I was just hoping to avoid them but after that hepful information by bbloom i understand i cant modify datastructures without replacing
21:29ChongLiyou aren't "replacing"
21:30ChongLiif a map contains 10000 key value pairs
21:30ChongLiand you make one change
21:30dnolenCaptainDerp: bbloom was trying to suggest that you thread your state as an immutable value through your program
21:30ChongLiit will not copy all 10000 pairs
21:30dnolenCaptainDerp: I would try to do that first before messing with atoms or agents.
21:30ChongLiit'll make a new branch of the tree and copy like 32 values at most
21:30ChongLidnolen: he wants asynchronous updates
21:31ChongLigenerally the way you want to design your program
21:31ChongLiis as a box of pure functions
21:31dnolenChongLi: right, then sure agents could work. that wasn't clear earlier.
21:32ChongLiand a small collection side-effecting functions forming a "shell" around the pure core
21:34CaptainDerpapologize if i was not clear, often it is hard to be in an irc where a message may have been missed or overlooked or 12 hours in im starting to something... something
21:34CaptainDerpok i think i know how now:
21:34CaptainDerp(theMap (agent {}))
21:34CaptainDerp(send theMap assoc key val)
21:34ChongLiyou need def if you want to do that
21:35CaptainDerpyes i left that out
21:35CaptainDerpbut i am
21:35ChongLiit all depends on what exactly you're doing with this map
21:36ChongLibut generally what you want is a function that takes a map, some other values and returns a map
21:36ChongLiand then use send with that
21:36ChongLidon't use send all over the place in your code
21:36ChongLitry to use it in only one location
21:37CaptainDerpi might not be doing this the best way but i am using this global map as a buffer for "tickets" that will be recieved by a front end
21:37CaptainDerpi am programming a clojure web server
21:37CaptainDerp... it may be a bit too long to explain in this irc
21:38ChongLihave you looked at the existing ecosystem?
21:38CaptainDerpI would love to explain it and get your opinion if it is a good structural idea but i dont want to bore you :P
21:38ChongLior are you just rolling your own to learn?
21:39CaptainDerpwhat do you mean by the existing ecosystem?
21:39ChongLinoir, compojure, ring etc.
21:40ChongLianother lib is aleph
21:40CaptainDerpyes not in depth. But my coworker has (who is actually doing most of the web server work)
21:40ChongLiI don't have any experience with this stuff
21:40CaptainDerpi am just builing a couple components
21:40ChongLijust throwing out stuff I know about
21:40CaptainDerpi had to learn ring and a couple other things to understand how to respond to messages
21:41seangroveDo I have to do anything special to get noir to serve static assets?
21:41CaptainDerpthis whole thing is to facilitate long polling as well
21:41seangroveI've googled quite a bit, can't seem to find it. I have a resources/public folder, but noir isn't service anything from there
21:42ChongLiseangrove: hmmm
21:42seangroveheh, s/service/serving
21:42ChongLinoir may not be optimized for that
21:43ChongLiis it not desirable to use something like apache/nginx for those?
21:43seangroveOh, just for development right now
21:43cshellhow are you referencing the static files?
21:44ChongLioh
21:44ChongLiyou need to add a route for them
21:44ChongLi(route/resources "/")
21:46ChongLioh nvm
21:46ChongLithat's compojure
21:46ChongLihaha
21:46seangroveYeah, that's what I thought, heh
21:46seangroveLooking through the noir docs again...
21:48cshelldid you try referencing it without the public?
21:48seangrovecshell: Yeah, I've tried all permutations, but I believe it should be at http://localhost:8080/css/styles.css
21:49CaptainDerpHmm isnt send and swap the same kind of thing but the first is for agents and the second is for atoms?
21:49ChongLilooks like noir doesn't have any special handling for this
21:49ChongLithey want you to use slurp
21:50ChongLiCaptainDerp: it's the same general kind of thing
21:50cshellwhat does the browser return?
21:50ChongLibut the semantics of the operation is totally different
21:50ChongLiswap! is just comparing the value and swapping it if it wasn't modified
21:50seangrovecshell: The server just returns 404, standard noir "we can't find that one" page
21:51cshellhmmm, i am able to get my css page at that same address
21:51ChongLisend queues your action on a thread pool
21:51CaptainDerpok so what would be the equivilant of (swap! theMap assoc key val)?
21:51cshelllet me see if I did anything to configure it
21:51CaptainDerpoh wait i think i know
21:51CaptainDerpderp
21:51cshellseangrove: do you call load-views?
21:52CaptainDerpactually nevermind my inital thought was still right
21:52seangrovecshell: I did (load-views-ns ...)
21:52CaptainDerpChongLi: what is the equivilant?
21:52seangroveOne moment, I might have had something else causing a problem..
21:52seangroveAh, ok
21:52seangroveI was running lein run, and there was some problem with the code, and it wasn't getting reloaded
21:52seangroveSo my changes were being ignored
21:53cshellYeah, that can do it
21:53seangroveSorry about that... but thanks cshell and ChongLi
21:53cshellI do'nt think there's anythin special you do
21:53cshellI can't find anything I did
21:54seangroveSeems to be working now. Maybe I should hook up lein run/cljsbuild errors to growl somehow
21:54CaptainDerpChongLi: what is the equivilant?
21:55CaptainDerpwhat would be the equivilant of (swap! theMap assoc key val)?
21:56CaptainDerpi do (send theMap assoc key val) but i get an error if i try an access key later in the same thread
21:56CaptainDerpwait... would send be doing the action asych and i am trying to access the val before it is sent/done?
21:56CaptainDerp /added
21:56CaptainDerp:P
21:56dnolenbbloom: ping
21:57bbloomdnolen: still here
21:57dnolenbbloom: you might know this since you worked on the lexical stuff.
21:57CaptainDerphmm i think i am correct
21:57brehautCaptainDerp: still camelCasing? hyphen-names is preferred
21:57dnolenbbloom: did you notice that vars created by def don't actually pass along the var map?
21:57CaptainDerpbrehaut bad habbit :s
21:57thmzlthas anyone tried lein2 with drip?
21:58ChongLiI'm back
21:58bbloomdnolen: clarifying: is this in the JVM reader/compiler again? and by "var map" do you mean metadata on a particular var?
21:58ChongLiCaptainDerp: how are you trying to access the key later?
21:59dnolenbbloom: no CLJS compiler stuff - def creates an AST w/ :name field but this :name field isn't a var AST, just a symbol.
21:59CaptainDerpChongLi (@the-map key)
21:59CaptainDerpi think i may need send-off instead?
21:59dnolenbbloom: emit :def just munges the symbol - so this skips the mapping info step I think.
21:59ChongLitry send-off
21:59dnolenbbloom: just wanted to confirm since you might have looked at that.
22:00bbloomdnolen: ah, i see. yeah, you have to look up the var in @namespaces
22:00ChongLidoes the function that updates your map do some IO?
22:00ChongLiif so, you want send-off
22:00ChongLisend is for functions that are CPU limited
22:01ChongLithe thing is; no matter what you do you should always be able to dereference the agent to get at the map
22:02ChongLisince the map inside the agent is a persistent collection
22:03ChongLiand because of how agents are implemented (as a mutable reference type)
22:03CaptainDerpi can @ the map but i think i cant get the val for the key
22:03CaptainDerpi am testing at the moment with the simplier setup
22:03ChongLijust @ the map
22:04CaptainDerp@ map is not the issue
22:04ChongLiand see if the key val pair is even in there
22:04CaptainDerpthat is what i am going to do :)
22:04CaptainDerpjust seting up a new test incase it was some other bs
22:04ChongLisince agents are asynch you can't expect the value to be in there right after calling send
22:05CaptainDerpya i think that is my issue
22:05CaptainDerpbut my 2 second knowledge of send-off made me think it was a possible solution
22:05CaptainDerpi need to block until it is in there
22:06ChongLithe difference between send and send-off is how the thread pool is managed
22:06CaptainDerpya
22:06CaptainDerpim getting that now
22:06ChongLito block on an agent
22:06ChongLiuse await
22:06CaptainDerphaha u said it as i found it
22:07CaptainDerphttp://clojuredocs.org/clojure_core/1.2.0/clojure.core/await
22:07CaptainDerpthanks again for your help ChongLi
22:08CaptainDerpits fun to be working with threads again
22:08ChongLijust doing what I can
22:08CaptainDerpjavascript can be boring :P
22:08CaptainDerp(but callbacks can be fun)
22:09CaptainDerpok its all working now
22:09CaptainDerpand should be efficent to some degree
22:10ChongLiit's likely not going to compare favourably to something like warp (written in haskell)
22:10CaptainDerpi *think* this is a faster/cleaner solution than using a DB for this one thing
22:10ChongLithat family of servers is pretty crazy
22:10CaptainDerpwe are using a clojure web server with a postgres db and a pure js front end
22:11CaptainDerpso far no issue. but we are not concerned about speed too too much
22:11ChongLiI hope the data in this map is not important
22:11CaptainDerpat the moment
22:11ChongLihave you checked out datomic?
22:11CaptainDerpChongLi not super important just should be available <1 second
22:12CaptainDerphmm no but i like that it supports time-based facts
22:12ChongLihttp://www.datomic.com/videos.html
22:12ChongLidatomic is brilliant
22:12CaptainDerpwe hate sql at the moment because of its lack of support for time and age based issues
22:12CaptainDerphow old is it
22:13CaptainDerpis it industry ready?
22:13CaptainDerphaha but then again i am saying that in a clojure irc
22:13CaptainDerp:P
22:13ChongLidatomic leaves the data storage part to another provider
22:13CaptainDerpI will sent the link to my poss
22:13CaptainDerpboss*
22:14ChongLisuch as a traditional db or something like amazon dynamodb
22:14wingyi have a string and want to use it as part of a keyword eg. (def string "foo") and make a keyword out of it eg. :foo/bar
22:14wingyhow is it done?
22:15ChongLi#(keyword "foo/bar")
22:15ChongLierr
22:15ChongLi&(keyword "foo/bar")
22:15lazybot⇒ :foo/bar
22:15ChongLithere you go
22:15ChongLioh, sorry
22:15wingyChongLi: hmm i should smash them together first
22:15ChongLiyeah probably
22:16wingy&(keyword (format "%s/bar" "foo"))
22:16lazybot⇒ :foo/bar
22:16wingyyepp thx
22:16ChongLiyeah there you go
22:16mattmossclojure is ruining my ability to write C++ code... I keep doing (printf "blah blah")
22:16ChongLihaha
22:17ChongLiI'm not sure if I'd be able to cope with C++ at this point
22:17wingyas long as it's a lisp
22:18ChongLiyeah I love scheme and elisp
22:18ChongLihave not used CL though
22:18brehautwait what‽ love elisp!
22:18ChongLihaha
22:18ChongLiwhat's wrong with elisp?
22:18ChongLiit's totally crazy
22:18Sgeo,(symbol "foo" "bar")
22:18clojurebotfoo/bar
22:19Sgeo,((comp keyword symbol) "foo" "bar")
22:19clojurebot:foo/bar
22:19ChongLidynamic scoping!
22:19ChongLiI like how gerry sussman considers dynamic scoping to be a bug
22:21CaptainDerpHopfully i will never degrade in my other "good" languages
22:21CaptainDerpgod i know so many now
22:21CaptainDerplearned 3 this year alone
22:22ChongLithe best part about learning new languages is learning new ways to think about problem solving
22:22ChongLinew ways to decompose a problem
22:22ChongLihave you gone through SICP?
22:23CaptainDerpthe text book? no
22:23ChongLiI'd recommend going through it (and the lectures) if you can find time
22:24CaptainDerpbut i do agree with the whole new perspective thing
22:24ChongLiit's a real eye-opener
22:24CaptainDerpAI languages are awesome that way
22:24CaptainDerpjs can be cool with call backs
22:24CaptainDerpbut that is it imo
22:24seangroveHmm, I've setup a new cljs app, and it seems to be mostly working, except that the google closure library isn't being compiled into the output javascript
22:24CaptainDerpclojure is nice ... mainly because of interop with java (i am still 1 month into clojure)
22:25seangrovethe compiled cljs starts with 'goog.provide('myns.main')', but of course goog isn't defined yet
22:25ChongLiand the persistent data structures and mutable reference types
22:25ChongLithe way they're all cleanly handled in a uniform manner
22:26ChongLimakes clojure feel like an extremely modern language
22:27dnolenbbloom: another thing - there is no difference between resolve-var vs. resolve-existing-var besides the warning side-effect?
22:27yediyou know those blog posts "steps to <programming language> enlightment" or "<programming language> learning curve"
22:27yedianyone know of any similar ones for clojure?
22:27dnolenbbloom: I'm about to consolidate that code, it's driving me insane looking at it.
22:28bbloomdnolen: hurray! that's been annoying me too. honestly, i'd prefer the warning be eliminated entirely as a side effect and attached to the AST :-P
22:29bbloomdnolen: there are also several different lookup mechanisms in there, but i'm not convinced they are all necessary
22:29dnolenbbloom: http://github.com/clojure/clojurescript/commit/3b0f5355e9631adedbf8ceeef542200c76850616
22:29bbloombut that's just a recollection, i don't recall why i thought that
22:30ChongLiyedi: I'm not sure
22:30dnolenbbloom: yeah, the compiler needs some serious refactoring throughout - I've forgotten what most of this code does ...
22:30ChongLiyedi: you can take most of what is said in a blog post about lisp in general
22:30bbloomdnolen: there's a little bit too much stuff happening in the single analysis phase
22:31dnolenbbloom: maybe if we both make it to Clojure/West we can have a CLJS compiler hackathon.
22:31bbloomdnolen: now that analysis doesn't do the gensym stuff, it should be much much much easier to split it into multiple phases
22:31bbloomdnolen: well, like i said, I'm 95% sure i'm moving to NYC in a few months, so we can do it there too, heh
22:32dnolenbbloom: oh right! that too :)
22:33seangroveAny reason the google closure lib wouldn't be compiled and included at the top of the compiled js files?
22:34dnolenseangrove: that seems pretty weird
22:40ChongLithis is such an outright slaughter
22:40ChongLipoor bears
22:41ChongLiahh there it is
22:41ChongLithey're on the board now
22:41seangroveThis might be a hint - first time I run cljsbuid once, I get a error with a stack trace, but the second time it thinks everything is fine
22:41seangroveMakes sense, nothing's changed, but it can look like it built fine
22:44seangroveOk, could actually be the domina library
23:20dnolenseangrove: if you can reproduce, worth opening up a ticket w/ steps - weird stuff like that should be tracked.
23:32bbloomis there a concatonative programming paradigm available in the clojure universe yet? I'm curious to see if somebody came up with something Factor inspired