#clojure logs

2014-05-29

00:09dsadapaI'm not understanding the order in with macros evaluate. I'm trying to write some macros that output html just for learning. They are supposed to nest, so you have one macro inside another one. But the output of the inner macro is not evaluated, instead I just see the sexpr with it's name? http://pastebin.com/J8Lpj7uJ This is surely a rookie mistake, but I just don't get it!
00:10bbloomdsadapa: are you just guessing how they work, or are you going off some tutorial or something?
00:10dsadapaTrying to understand it from reading docs and trying different ways
00:10bbloomdsadapa: i suggest you play with the macroexpand function
00:10bbloomfor example:
00:11bbloom,(macroexpand '(-> x f))
00:11clojurebot(f x)
00:11bbloomnotice that didn't do anything, it just showed the result of expanding the macro
00:11bbloomthe macroexpand function only happens on the front of the list, it's not recursive. but it lets you kinda step-debug macro expansion
00:11bbloomanother example:
00:12bbloom,(macroexpand '(let [[x y] (range 2)] [y x]))
00:12clojurebot(let* [vec__51 (range 2) x (clojure.core/nth vec__51 0 nil) y ...] [y x])
00:12bbloomthe ... is part of the irc printout, you can try it local in your repl
00:13dsadapabbloom: wow, that's pretty nifty. Thanks, I'll do my debugging!
00:13bbloomdsadapa: experiment with different examples, make sure you understand quoting before playing with defmacro
00:14bbloomyou can use ' and ` outside of a macro, so experiment with them in your repl too
00:14bbloomand http://www.paulgraham.com/onlisptext.html is basically the bible of intros to macros, even though it's common lisp, not clojure, it's worth checking out
00:14bbloomgood luck!
00:15dsadapabbloom: thanks for helping a confused lisp newbie! This is great stuff :)
00:16bbloomdsadapa: i may also add, if you're totally new to lisp... you should consider: avoiding writing macros at all! especially when you're still learning the core library
00:16bbloommost clojure programs have very very few macros
00:17dsadapabbloom: yeah? is it better to use functions over macros, or do you mean that somebody already wrote most things you'll ever need in macros?
00:17amalloydsadapa: indeed, while it's great to learn how macros work, most of the time functions are sufficient. certainly for your html thing a macro is the wrong choice
00:17dsadapaamalloy: why is macros the wrong thing for outputting markup?
00:18bbloomdsadapa: 1) it's harder to write macros 2) they are less composable than functions 3) even when you do genuinely want/need a macro, it should be limited to a thin layer on top of a function-based core
00:18amalloybecause functions can do the job. and, as you're discovering in your example, it's a lot more work to think properly about how to do it with macros
00:19dsadapaI see. I chose it as an exercise because I thought it was the simplest form of a code-that-writes-code, what people tell me macros are for, but yeah I guess things like that are simpler in functions
00:20bbloomdsadapa: macros aren't themselves code that writes code. they are a particular style of usage of code that writes code
00:20bbloom,(eval (list + 5 10))
00:20clojurebot#<ExceptionInInitializerError java.lang.ExceptionInInitializerError>
00:20bbloom&(eval (list + 5 10))
00:20lazybotjava.lang.SecurityException: You tripped the alarm! eval is bad!
00:20bbloomeh, screw you bots
00:20bbloomanyway
00:20bbloomthat's an example of me making code and running in it
00:20bbloomno macros involved!
00:20bbloom,(list + 5 10)
00:20clojurebot(#<core$_PLUS_ clojure.core$_PLUS_@555e61> 5 10)
00:20bbloom,`(+ ~@(range 5)
00:20clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
00:20bbloom,`(+ ~@(range 5))
00:20clojurebot(clojure.core/+ 0 1 2 3 ...)
00:20bbloomnotice that's code making other code!
00:21bbloommacros are about how code-that-writes-code gets evaluated
00:21dsadapacompile time versus run time?
00:21dsadapaor reader vs eval
00:21bbloomto a first approximation, yes
00:22bbloom,(let [x 1] [x 'y `z])
00:22clojurebot[1 y sandbox/z]
00:22bbloomquoting is an important thing to learn
00:22bbloomand even tho the eval function is uncommon in clojure programs, it's super useful for learning about how evaluation works
00:23dsadapaIn the html example I guess some way of un-quoting the argument of the macros, to evaluate them instead
00:26bbloom,(defmacro foo [expr & body] `(do (prn ~expr) ~@body (prn ~expr)))
00:26clojurebot#'sandbox/foo
00:26bbloom,(foo (java.util.Date.) (prn 1) (prn 2))
00:26clojurebot#inst "2014-05-29T04:20:27.633-00:00"\n1\n2\n#inst "2014-05-29T04:20:27.637-00:00"\n
00:26bbloom~reader
00:26clojurebotreader is http://clojure.org/reader
00:26bbloomsee there ^^ for some syntax
00:26bbloomi'm off, good luck
00:29dsadapabbloom: thanks a lot! Very helpful! I wish I could send a medal for great noob-helping skills. Thanks! amalloy too!
00:38gastoveHello. This is an embarassingly newbie question, but here we go all the same: I have a lein project that defines `:dependencies [[incanter "1.5.4"]]`. Project compiles just fine, dependency is there. But when I start a lein repl in the project directory and call `(require 'incanter)`, I get a lot of "could not find incanter on classpath`.
00:39gastoveWhat the blazes am I not groking about this?
00:39tolstoyIf only there was a way to tickle an om re-render from a cljs repl.....
00:39tolstoy(require '[incanter])?
00:39mangegastove: (require 'incanter.core) ?
00:39tolstoyPutting the name in a quoted vector?
00:40tolstoyAnd that. ;)
00:40gastoveQuoted vector gets the same thing -- haven't tried specifying which part of incanter, sec...
00:40gastoveoh ffs
00:40gastove,mange++
00:40clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: mange++ in this context, compiling:(NO_SOURCE_PATH:0:0)>
00:40gastoveHA.
00:41gastoveGood. In the room for twenty seconds and already making clojurebot throw runtime exceptions.
00:41gastoveThis is working splendidly.
00:41gastoveThanks for the suggestion, mange. Appreciated!
00:42mangeNo worries! If you still want to use symbols like incanter/blah then you can do (require '[incanter.core :as incanter]) to alias it in your namespace.
00:43gastove*nods* Good to know!
00:52tolstoyHuh. Git 2.
00:53Raynes?
00:53FareI am thinking of yet another parser (or maybe it already exists?) where the input is a lazy stream of (values, context) where initially, values is characters and context is file location, but passes transform that, so that e.g. lexing makes values into tokens and context into file location, and various phases of parsing make that into sexpressions where the context contains also binding information, and where macros can be literally expanded int
00:53Fareo stuff prepended to the stream.
00:53alisdairthis time, it's personal
00:53tolstoyGit has reached 2.0. Not sure if that's significant.
00:55Raynesamalloy: https://dl.dropboxusercontent.com/s/2x3lf432djw4py6/2014-05-28%20at%209.49%20PM%202x.png Didn't we have a weeklong discussion about this at Geni?
00:57amalloymike and justin came back to it every so often
01:06Raynes$ git --version
01:06Raynesgit version 2.0.0
01:06RaynesWelcome to the future, kids.
01:32danielcomptonI'm using test.check to generate random ip addresses. Is there a more elegant way to do it than
01:32danielcompton(def inet-gen (gen/fmap #(clojure.string/join "." %) (gen/tuple (gen/choose 0 255) (gen/choose 0 255) (gen/choose 0 255) (gen/choose 0 255))))
01:32danielcomptonHow can I get 4 of the same generator in a tuple?
01:43platzis git 2 rtm or rc ?
01:43Rhymor,(take 3 (repeatedly #(rand-int 256)))
01:43clojurebot(237 61 45)
01:44platzahh the ppa is up now, nvm
02:14stormeIs loop/recur recursion?
02:14stormehttp://clojure.org/special_forms#recur
02:15storme*technically speaking*
02:15beamsoyeah, recursion
02:17stormeThat's what I thought, someone just told me loop/recur does not recurse
02:19platzeverything is an abstraction at some level. who knows what special definition of recursion someone has
02:19beamsothat someone was probably mentioning what is discussed in http://clojure.org/functional_programming#Functional%20Programming--Recursive%20Looping
02:20beamsoi can't believe i'm going to quote sicp too, but it's probably also linked to http://mitpress.mit.edu/sicp/full-text/sicp/book/node15.html as well
02:24stormebeamso, Thanks!
02:24zeroemI'm seeing some unexpected behavior in a macro, https://gist.github.com/zeroem/8aaf26fb33a657072d73
02:24platzI guess if you require recursion to create a new stack frame it's not recursion, but then that rules out languages with TCO
02:24zeroemcan anyone explain why two references to what I understand should be the same gensym are actually getting two different symbols generated
02:25stormeplatz, So it's purely a difference in the definition of what recursion is?
02:26platzloop/recur does the same thing 'recursion' does, just implemented differently under the hood
02:27platzand it all looks the same at the assembly level anyway
02:28dbaschstorme: loop/recur does not generate stack frames, it’s like a for loop in java
02:28stormedbasch, Got it
02:28stormeplatz, I see
02:32dbaschzeroem: http://stackoverflow.com/questions/2840119/controlling-symbol-generation-in-clojure-macros
02:33storme,(source loop)
02:33clojurebotSource not found\n
02:33zeroemdbasch: thanks for the google-fu, what did you search for?
02:33storme,(source take)
02:33clojurebotSource not found\n
02:33storme,(doc loop)
02:33clojurebot"([bindings & body]); Evaluates the exprs in a lexical context in which the symbols in the binding-forms are bound to their respective init-exprs or parts therein. Acts as a recur target."
02:34dbasch$google clojure macro gensym
02:34lazybot[Controlling symbol generation in Clojure macros - Stack Overflow] http://stackoverflow.com/questions/2840119/controlling-symbol-generation-in-clojure-macros
02:34dbaschI’d seen it before
02:34stormeInteresting, typing "(source recur)" into the repl give ;= Source not found
02:36zeroemdbasch: ah, thanks still :)
02:36dbaschnp
02:52dbasch(doc source) ;; storme
02:52clojurebot"([n]); Prints the source code for the given symbol, if it can find it. This requires that the symbol resolve to a Var defined in a namespace for which the .clj is in the classpath. Example: (source filter)"
02:53stormedbasch, So it cannot find the source I'm assuming
02:54dbaschstorme: it’s not in a .clj file
02:55mangestorme: recur won't be found by "source" because it's a special form. There isn't even a var for recur.
02:55mange,recur
02:55clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: recur in this context, compiling:(NO_SOURCE_PATH:0:0)>
02:55stormeSo where can I find it?
02:56mpenetgithub search :)
02:56stormempenet, :)
02:57mangehttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L42
02:57mangeI know that's not really helpful, but the compiler deals with recur internally.
02:59dbaschstorme: a significant part of clojure is written in clojure, but obviously the foundation has to be in java
02:59dbaschstorme: or javascript, for cljs
03:00stormemange, Thank you for the link
03:00stormedbasch, Thank you for the information
03:01dbaschactually there’s very little cljs in js, it’s mostly in clj
03:19hellofunkwhat is ICloneable? i'm having some difficulty tracking it down; is it part of the clojure base or clojurescript?
03:25beamsoicloneable looks to be from om
03:29whodidthisclojurescript
03:30hellofunkbeamso i don't think it is part of Om
03:30hellofunkit came up in an Om tutorial but it's namespace along with other Om protocols
03:30hellofunk*not namespace
03:30beamsoi do see the protocol mentioned in om code
03:31hellofunkbeamso yes but I think it is referencing something that is part of clojurescript as far as I can tell. It's not one of the Om protocols I don't think
03:31beamsobut whodidthis may be more familiar with clojurescript than i
03:32whodidthisi'm not familiar but i use specify! with om components https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/core.clj
03:34mangeIt looks like ICloneable is internal to clojurescript, based on my reading of this: https://github.com/clojure/clojurescript/blob/c63db9544738fc094cc04680bbee1534cf436204/src/clj/cljs/core.clj
03:34mange... Which is the exact same file that whodidthis just linked to.
03:36beamsooops. my bad, then.
03:36clojurebotCool story bro.
03:37beamsothanks bro.
03:37beamso:p
03:58hellofunkthanks guys
04:22hellofunkanyone here using Datomic in the wild?
04:39szymanowskiHi, what is the idiomatic way to test if something is a protocol?
04:47ddellacostaszymanowski: you could use satisifies? if it is a specific protocol
04:48ddellacostaszymanowski: assuming you have a type/record
04:48ddellacostaszymanowski: what exactly are you trying to do?
04:48szymanowskijust want to know if something is a protocol
04:48szymanowskino records/types involved
04:49szymanowskifor doing something in schema
04:49ddellacostaszymanowski: prismatic's schema?
04:49szymanowskiyes
04:50szymanowskibasically i would like to extend schema protocol to protocols
04:51ddellacostaszymanowski: so, for example, as the second argument to validate?
04:52szymanowskiI know there already a Protocol record in schema
04:52wagjoszymanowski: no idiomatic way. Protocol is just a map
04:52szymanowskibut it need to be created via the protocol function defined in schema
04:52wagjowagjo: you can check for the keys to determine whether given map looks like a protocol, but nothing absolute
04:53szymanowskiyes this is what I do so far
04:54szymanowskiok thank you ddellacosta and wagjo
04:54ddellacostaszymanowski: that was all wagjo, but sure thing. :-)
05:03erghi want to make a game and i thought i'd make my entities maps, but then i wondered what i would do if i wanted to turn one of the values into a function that needs to be called to retrieve the value later. for example:
05:05erghif i had an :img entry for whatever image is supposed to be drawn for an entity, but i later want to make it depend on the amount of health the entitty has so it would have to be (get-img (:img entity)), but i would want that to be an implementation detail.
05:05erghhow would i best design that?
05:06erghhm, i guess i could just leave it as a simple entry and change the image whenever the health is being changed
05:07beamsoor you could pass the map into a function and have the function return the appropriate image for the map
05:09erghthat would kinda put all the image logic for all entity types in one place. so if i wanted to add a new type, i would have to add things all over the place. hm
05:14beamsoif you have multiple entity types you could create a protocol and an implementation for each entity type.
05:14beamsoor a multimethod.
06:00kurofuneI am using LightTable with Clojurescript and everytime I try to evaluate a name-space I get errors saying, either "goog not defined" or "no file app.core found" I am able to compile the project and am following the tutorial here: http://swannodette.github.io/2013/11/07/clojurescript-101/
06:01kurofuneCould sombody please troubleshoot this with me?
06:05kurofuneCan anybody see this?
06:12wagjokurofune: you might have a better luck at https://groups.google.com/forum/#!forum/light-table-discussion
06:12kurofunethanks wagjo I'm not sure if it's an IDE thing or what.
06:28Guest_lost my connection a moment ago
06:28Guest_was looking for some help with a dumb CNFE
06:29Guest_I am trying to use http-kit
06:29Guest_here is my project.clj
06:29Guest_(defproject heroku-data "0.1.0-SNAPSHOT"
06:29Guest_ :dependencies [[org.clojure/clojure "1.5.1"]
06:29Guest_ [http-kit "2.1.18"]]
06:29Guest_ :main heroku-data.core)
06:30Guest_ran lein deps and http-kit is downloaded
06:30Guest_try to lein compile this minimal code
06:30Guest_(ns heroku-data.core)
06:30Guest_(:require [org.httpkit.client :as http])
06:30Guest_and it blows up with a CNFE
06:31Guest_any ideas ? seems so dumb
06:31Guest_same if I say lein repl
06:40mattfieldGuest_: is your require expression inside the ns declaration?
06:40Guest_no
06:41mattfieldGuest_: It needs to be if it's in a CLJ file
06:41Guest_doh!
06:41Guest_I knew it was something idiotic
06:41Guest_thanks matt
06:41mattfield^_^
06:41mattfieldNo probs!
06:42mattfieldEasy to look straight past that sort of thing
06:42Guest_boom - working again..
06:42mattfieldace
07:49mi6x3mhey clojure, when do we put a * at the end of a function name?
07:53h0bbitmi6x3m, I follow the convention of adding * to the end of a function name when I'm going to memoize the function.
07:53h0bbitthe memoized function has the same name, (without the *) and is exposed to the world
07:53mi6x3mh0bbit: but the function knows nothing of it being memoized?
07:53h0bbitnope.
07:54mi6x3mah, okay, so foo* is a cached foo
07:54h0bbitsomething like
07:54mi6x3mI see
07:54h0bbityup
07:54h0bbit(defn- foo* [x] ...)
07:54h0bbit(def foo (memoize foo*))
07:54mi6x3mok, this makes sense :)
08:04ddellacostami6x3m: I use it more generally when I need a function that does the "actual" work that foo is supposed to do
08:04mi6x3mddellacosta: give an example please :)
08:04ddellacostami6x3m: I good example may be if I have a loop that has to start with initial parameters, and it makes more sense to isolate that loop
08:04ddellacosta*a good example
08:05ddellacostami6x3m: I've also seen the ' notation for similar functions/variable naming: foo foo'
08:06ddellacostami6x3m: I haven't heard of h0bbit's convention of using it for a memoized function, but it seems kind of generally consistent with what I'm talking about
08:06mi6x3mokay I see
08:07mi6x3mso generally it's some kind of designation for a workhorse
08:08ddellacostami6x3m: I guess so. Honestly, I'm not sure what the general clojure community convention is wrt this, I'm just telling you how I use it
08:08ddellacostami6x3m: here's a stack overflow question on it: http://stackoverflow.com/questions/5082850/whats-the-convention-for-using-an-asterisk-at-the-end-of-a-function-name-in-clo
08:09ddellacostami6x3m: technomancy I think explains it well, and I feel like he can be considered authoritative, in the context of the Clojure community
08:10ddellacostami6x3m: and Paul Legato's comment there is related to what I was trying to say
08:11mi6x3mah, I see, thanks a bunch
08:11mi6x3mthis clarifies it
08:11ddellacostami6x3m: sure thing
08:12GlenjaminIn Clojure it basically means "foo* is like foo, but somehow different, and you probably want foo".
08:12Glenjamini like that
08:12noncomhow do i force a port of a CCW repl?
08:13ddellacostaGlenjamin: yeah, it emphasizes the point that it is probably private or should be private, which I neglected to mention
08:13Glenjamini guess its a bit like _func in python
08:13ddellacostaGlenjamin: do you usually have func also, in that context?
08:13Glenjaminsorta private, but you can call it if you really want to
08:14ddellacostaGlenjamin: ah, the _ is a "this is private" convention?
08:14Glenjaminprobably not, to be fair - but the privacy aspect is similar
08:14Glenjaminyes
08:14ddellacostagotcha
08:41trap_exithttp://grokbase.com/p/gg/clojure/13bp2s9s81/ann-clojurescript-0-0-2060
08:41trap_exitI ran into this same error
08:41trap_exithow do I fix it?
08:41trap_exitthere's some dumbass cljs.core error
08:41trap_exitthat apears in ":optimizations :none" but not in ":optimiations :advanced"
08:56noncomdoes anyone here use CCW? how do i force some permanent port to the repl?
08:58ambrosebsnoncom: no idea, tried this in your pom? :profiles {:dev {:repl-options {:port <num>}}}
08:58ambrosebsproject.clj rather
08:58ambrosebsif you have one
09:01noncomambrosebs: thanks! adding this to project.clj worked!
09:01ambrosebsnoncom: np
09:07noncomuh, now i setup a repl on a fixed port on a remote macine and trying to connect to it via the IP address from te internet and it does not connect
09:07noncomother programs work fine, so it is someting specific to nrepl...
09:11noncomdoes amyone have any ideas on this?
09:11noncom*anyone
09:12beamsomy only idea is : have you tried telnetting to the port?
09:22pcnnoncom: On the host, check netstat -an and look for that port. Make sure it's listening, and listining on ipv4 maybe?
09:24noncompcn: strange, but it gives this readout for the port 55555 which i'm using: https://www.refheap.com/86060
09:25noncomhow do i interpret it?
09:25beamsodid 55555 appear more times than that?
09:26beamsoit reads like it's only listening on localhost
09:26noncomno, these three occurencies are the only..
09:27beamsoso, it's only listening for connections on localhost
09:27noncomwell, usually i do not have a problem with connecting from internet. i just setup a server and open the port on the router..
09:27noncomwhat do i have to do in this situation?
09:27noncomhow can it be restricted to receiving connections from localhost only?
09:28noncomhow is that possible?
09:28beamsoi don't use a repl, so maybe the repl has to be configured to listen from all hosts?
09:29beamsoyou may wish to check that the port isn't firewalled off, as well.
09:33noncomhuh, i added :host "0.0.0.0" parameter to the repl-options and now the result is somewat different - CCW hangs up when conneting. this is definitely a progress. possibly there is some bug inside
09:36noncomso now there is one another ccw bug
09:36noncomit freezes
09:41pcnnoncom: yeah, it looks like your :repl option defaults to localhost (which is a sane precaution. Having a backdoor into a running jvm on your server is handing the keys to j.random cracker)
09:41pcnErrr... :host not :repl
09:42noncomyeah
09:42noncombut now i wonder wy ccw has troubles with it
09:42pcnIf it's not using ssl, use ngrep or wireshark to see what's going on.
09:42beamsoyou could ssh from your machine to that machine, forwarding the connection on your local machine to port 55555 on the remote machine
09:43pcnngrep -Wbyline . port 55555
09:43beamsohttps://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding
09:45pcnYeah, use ssh forwarding for sure.
09:45pcnbut... figure out the freeze. If it's not simply a bug, it could mean networking problems that are harder to diagnose when ssh is involved
09:48noncomok, i will try ssh and debuggging ccw later... now can you tell how i connect with emacs live?
09:48noncomthere is no repl-connect or cider-connect command...
10:03pcnnoncom: have you tried just "M-x cider" ?
10:05noncompcn: haha :)
10:05noncomcool
10:06noncomactually i have found out that the problem is that the server nrepl falls with an exception!
10:06pcnThe documentation for that is... :facepalm:
10:06noncomi just did not think it'd be that easy
10:07noncomte message is this: https://www.refheap.com/86061
10:07noncomany idea on this? :)
10:13pcnGoogling the top of the stack shows a 2012 post by cemerick but it's from 2012 about some incompatibilty with ccw and nrepl...
10:14pcnbut otherwise I am not a deep resource. Maybe pinging cemerick as I am will bring enlightenment?
10:16cemericknoncom: You have mismatched versions of nREPL, one or more of which have been AOT-compiled. FnTransport is definitionally a Transport: https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/transport.clj#L25
10:36philandstuffcemerick: hi there, I've been looking at this commented-out line in test.check: https://github.com/clojure/test.check/blob/master/src/main/clojure/clojure/test/check/clojure_test.clj#L134
10:37philandstuffcemerick: I think this is a fix but I'm not certain enough to go to JIRA and raise an issue: https://github.com/philandstuff/test.check/commit/2714f325f72abfe47c6b128512494d6b26f60768 does it look good to you?
10:38reiddraperphilandstuff: fwiw, no shame in filing an issue as a question, either
10:39cemerickphilandstuff: I can't say I remember the context around that comment; I'd have sink into it for a bit to grok it again. Like reiddraper said, do file an issue, either he or I will look at it. :-)
10:40cemerickphilandstuff: if you have a use case that it affects, that would be super-helpful as well (since apparently I didn't bother documenting the objective of the TODO very well :-/)
10:40hyPiRionphilandstuff: just a question -- would `doto` be needed in the fix? It seems like you just call ct/report on the element
10:40hyPiRionoh nevermind, you want to return it too.
10:40philandstuffreiddraper, cemerick: thanks, I'll file a ticket
11:06noncomcemerick: thank you, will look into synching the versions!
11:26noncomare there any version control systems that allow explicit centralized blocking of files that one is working on? or at least, giving realtime messages on what files are being edited by others?
11:30michaelr525hi
11:31michaelr525hi what do you use in emacs for switching buffers quickly?
11:31michaelr525ctrl-tab/ctrl-shift-tab maybe?
11:31mdeboardnoncom: Centralized blocking? None that I know of
11:31llasramnoncom: Sure. That's how most of the really awful old proprietary ones work
11:31mdeboardmichaelr525: Switching buffers I use C-x b then type the name of the buffer (I have auto-completion)
11:32mdeboardif I'm using multiple panes yeah I use Ctrl-Tab to switch back and forth
11:32cbpmichaelr525: if you mean switching windows i use window-number mode
11:32mdeboardI sometimes trip over myself when I'm switching between tmux and emacs a lot tho
11:32cbpyou can also make it so that shift + keys or something moves between windows
11:32cbpswitching buffers it's C-x b + ido-mode
11:33noncomllasram: what was the drawback on that?
11:33llasramnoncom: On which?
11:33mdeboardYeah ido, that's the thing
11:33michaelr525cbp: yeah, that's what I use, but I'd like to use ctrl-tab style like in all other editors in the world :)
11:33noncomllasram: why is centralized blocking/notification is bad?
11:34cbpmichaelr525: you can do anything in emacs
11:34michaelr525cbp: ctrl-x b requires two hands, i'd like to switch buffers quickly using only the left hand
11:34llasramnoncom: Its possibly not bad in itself, but in my experience all the systems which support it fatally complect workflow and mechanism
11:35noncomi see.. if you could recall some names, i would look them up in google, for a research
11:37llasramnoncom: http://en.wikipedia.org/wiki/Comparison_of_revision_control_software and "Concurrency model" includes "lock"
11:38dkinzernoncom: when you are working on a file, can others edit that file while you working on it? Usually you can set up your environment so that only you access your own repository.
11:38noncomllasram: cool, thanks!
11:38dkinzerllasram: nice use of "complect" :)
11:39noncomdkinzer: well, actually conflicts among pushes are a trivial thing in this place
11:39noncomi am interested in knowing whats and whys of all this stuff
11:39noncomoh, and since it is a clojure cannel, i also think about doing something with the situation, employing clojure
11:40noncommaybe
11:41dkinzernoncom: I guess I didn't understand your question, then.
11:41noncomyeah, there are many possible situations wit concurrent data read/writes
12:35Glenjaminthe usual "real" causes of that in my experience are: large files, poorly factored code and long lived branches
13:03the-kenny(when-let [[a b] []] 42) => 42. Is this expected? Feels counter-intuitive to me.
13:04Bronsathe-kenny: destructuring is not pattern matching
13:04the-kennyBronsa: I know, still feels a bit strange. And has caused a bug in secretary
13:04gtrakthe-kenny: all that matters is if [] is truthy.
13:05gtrakI tend to not to do destructuring in if/when-lets for clarity
13:05agarman,(some-let [[a b] []] 42)
13:05gtrakonly really been bitten by this once.
13:05clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: some-let in this context, compiling:(NO_SOURCE_PATH:0:0)>
13:05Bronsathe-kenny: consider (when-let [[a b :as form] []] form)
13:05Bronsathe-kenny: would you be ok with that returning nil rather than [] ?
13:06the-kennyBronsa: that's a good example, haven't thought about :as
13:06gtrakthere's no coherent set of rules besides the current behavior.
13:07gtrakmaybe you could make a '(let-if a [[a b] []] a)'
13:07the-kennyAdding a seq should work
13:08the-kenny,(when-let [[a b] (seq [])] 42)
13:08clojurebotnil
13:08the-kenny,(when-let [[a b] (seq [1 2])] b)
13:08clojurebot2
13:08gtrakah, yea.
13:08gtrakthat covers most real use-cases :-)
13:09kenrestivounless you want both a and b to be truthy for the if to succeed
13:09gtrak(let-if (and a b) ...
13:10gtrakbut it looks backwards
13:10gtrakstill possible
13:10kenrestivocool
13:11gtrakor you could use the 'for' style.
13:11gtrak(let+ [[a b] [] :when a]..)
13:12gtrakalso awkward unless you only need one branch.
13:12preporlet-if? like this http://www.crossclj.info/clojure/let-if.html ?
13:13gtrakkind of, except the condition would be dependent on bindings.
13:13kenrestivois there an implementation somewhere?
13:14gtrakI could trivially make one.
13:15gtrakbut then I would have to do a thing.
13:15cbpoh noes
13:17preporgtrak it dependent on bindings https://github.com/flatland/useful/blob/develop/src/flatland/useful/experimental.clj#L48
13:17preporgtrak oh no, sorry
13:17kenrestivothat crossclj is interesting. is it a codeq/datomic thing?
13:19preporkenrestivo "We will do a proper announcement with details" on 15 May 2014
13:20kenrestivoahm
13:40herman_hi
13:40herman_can i ask about a counterclockwise problem here?
13:41herman_im getting: FileNotFoundException Could not locate clj_http/client__init.class or clj_http/client.clj on classpath: clojure.lang.RT.load (RT.java:443)
13:41herman_when i try to load a file using clj-http
13:42herman_lein repl + (require '[clj-http.client :as client]) works fine though
13:42herman_but eclipse can't seem to find it in the classpath
13:59amalloygtrak: there's egamble's let-else: https://github.com/egamble/let-else
14:04dbaschquick, guess what this evaluates to: (reduce map reduce [])
14:05justin_smith(defn stupid-identity [thing] (reduce map thing []))
14:06dbasch(inc justin_smith)
14:06lazybot⇒ 44
14:06justin_smithhell, you could even make it (reduce thing thing [])
14:06dbasch,(reduce 1 1 [])
14:06clojurebot1
14:07justin_smiththe whole "1 isn't a function" thing never comes up
14:07justin_smithlol
14:07dbaschI see an obfuscated clojure contest
14:07justin_smithit is way to easy to do evil clojure code
14:08dbaschbut c is easier, what with multiple pointer indirection and all
14:08justin_smithand the relatively weak type system and implicit casts
14:09gtrakamalloy: nice
14:09cafC7ll_hey
14:09dbasch“with enough eyeballs all bugs are shallow” <- yeah right heartbleed
14:11KeithPMjustin_smith: Sorry guys I walked in at an 2 pm (reduce 1 1 []). I am doing some exercises on reduce in teh Helsinki clojure MOOC. What were you guys discussing?
14:11amalloydbasch: pretty sure at least a thousand people said that on like day zero. why bring it up now?
14:11amalloyKeithPM: tomfoolery
14:11KeithPMOK
14:12dbaschamalloy: are you following the truecrypt debacle?
14:12amalloy$google truecrypt debacle
14:12lazybot[TrueCrypt warns that it is not secure, advises users to switch] http://grahamcluley.com/2014/05/truecrypt-insecure/
14:12dbaschKeithPM: in (reduce 1 1 []), the last line of the documentation of reduce applies
14:13dbasch(doc reduce)
14:13clojurebot"([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val is supplied, returns t
14:13KeithPMdbasch: Thanks… I was just about to ask how did that work..
14:13dbaschIf coll contains no items, returns val and f is not called.
14:13amalloy&(doc reduce)
14:13lazybot⇒ "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well... https://www.refheap.com/86066
14:13amalloypastes what was cut off! a glorious invention
14:14KeithPMOK… Great… I read that somewhere, but it didn't compute at the time :)
14:14amalloydbasch: that's really weird. what does stopping xp support have to do with truecrypt?
14:15dbaschamalloy: anybody’s guess
14:15technomancyamalloy: the official story is it's because newer versions have built-in crypto, but it's probably a cover story for a gag order.
14:16ToxicFrogamalloy: the best guess I've seen is that post-XP, windows comes with built in encryption support
14:16dbaschbut people are up in a frenzy about whether truecrypt is secure or not, and the source is all there for anyone to “inspect"
14:16ToxicFrogAssuming it's legit.
14:20KeithPMWhile we're (or were) on reduce. I was working with reducing into something like a map for example. Is there some rule governing how one arranges the parameters to the function? e.g (fn [myMap elem] (assoc myMap elem (* elem elem)))
14:23erghuh, i trying to start my first clojurescript project with leiningen, but im not quite sure how to set it up and there are many tutorials on how to do that and im not quite sure which one to use. is there a best/most current way to start a clojurescript project? (it will only be client sided)
14:24_alejandroKeithPM: the function passed to reduce signature looks like [last-result next-item]
14:24_alejandroKeithPM: In the case where you don't pass an initial value (e.g. {}), last-result will be the first item in the collection, and next-item the second
14:25KeithPM_alejandro: OK thanks. That clarifies it.
14:25dbaschergh: I like this template https://github.com/swannodette/mies
14:25_alejandroergh: I used http://swannodette.github.io/2013/11/07/clojurescript-101/ to start
14:26erghthanks
14:28erghdoesn't seem to be using the newest versions of things, though. no idea if that's important
14:28cbpergh: If you need a repl, easiest is lighttable
14:29cbpif you're using emacs you can try https://github.com/cesarbp/pudge#usage which is equivalent to mies-om
14:30cbp+ an austin repl
14:32erghi'm using light table
14:40sandbagsi'm getting an error (attempted duplicate class definition) which is pretty inexplicable to me. full details https://www.refheap.com/9bf9763daf7ab05301148a124 wondering if this is something to do with Compojure and aot:all in project.clj?
14:41arrdemlein clean is your friend
14:41amalloyno, it's not lein clean
14:42amalloysandbags: you shouldn't have two defns with the same name: they both resolve to the same var and the same classname. since you're AOT-compiling, they both get compiled
14:42amalloyat runtime you'd only pick one of them to be the value, probably, but you can't save them both with the same filename
14:42sandbagsoh hello, where am i defn'ing the same symbol twice?
14:42amalloylines 18-22
14:43sandbagsoh, i assume the if would result in only one defn
14:43sandbagsso i've misunderstood something
14:43sandbagsam i misunderstanding when that "if" is operating? I'm still grokking macros
14:44amalloyall defs are hoisted to the top level, so the functions both get compiled, with the same name. then the if clause chooses which one to set as the actual value held by the var
14:44sandbagsahh.. i don't really understand but i do sort of grasp what you're saying
14:44amalloyyou should really be writing something like ~(if (= 1 (count slots)) `(defn ...) `(defn ...))
14:45sandbagsokay i got you... my train is just coming in but i will have a play with that
14:45sandbagsthank you
14:45amalloyor, shorter: (defn ~(symbol ...) ~@(if (= 1 (count slots)) `[[arg#] (~ctor ...)] `[[& args#] (let ...)]))
14:46Pourletainamalloy, anyway
14:46sandbagsah yes, neater still
14:46Pourletainwhat's your opinion on people who use the objective-who?
14:46amalloywhat. whom are you and why are you starting this discussion with me as if we were already in the middle of it?
14:47llasramPourletain: Didn't you already pull this yesterday?
14:47technomancywait they ported Doctor Who to objective C
14:47arrdemamalloy: he's a troll that used this same opener yesterday.
14:47technomancyand no one told me?
14:47sandbagsamalloy: very neat ... thanks again
14:47amalloytechnomancy: it's subjective whether the port was successful
14:48technomancyamalloy: either that or it's randian tardis fanfic
14:48Pourletainllasram, I asked someone else.
14:48Pourletainamalloy, I have no idea.
14:49PourletainProbably because I am retarded.
14:49technomancyremember when we used to have trolls with creativity?
14:49technomancy(neither do I actually)
14:49PourletainThat was a good time indeed.
14:49arrdemtechnomancy: no... we've had chare and this guy... and arguably bitemyapp.
14:49amalloytechnomancy: help me with my starcraft clone
14:49clojurebotExcuse me?
14:49PourletainWhere is Chousuke at anyway?
14:49Pourletainamalloy, you play?
14:49technomancysdegutis was pretty subtle about it
14:50technomancyI think he has the gift
14:50amalloyshould be able to whip something up in clojure in just a couple days
15:04tuftheh, sc in clojure, cool
15:05amalloyi've apparently made too obscure a reference
15:05amalloyguys, the joke was: technomancy was pining for the days of creative trolls
15:05amalloyand there's this guy who used to come in here and demand people help him write a starcraft clone
15:06amalloyas if that were something you could do in a week with two guys
15:06Frozenlockamalloy: You think he was trolling? I thought he was just VERY bad at estimating.
15:06amalloywell he was a rude jerk either way
15:07arrdemamalloy: idk man isometric graphics engines are pretty easy these days..
15:07amalloyi'm pretty sure he was writing sc2
15:07amalloyno isometrics for you!
15:07tbaldridgearrdem: you're thinking Starcraft 1, Starcraft 2 is a bit more complex
15:08hiredmanmy ignore list is at 283, bascically entirely from #clojure because I don't pay attention to other channels as much
15:08arrdemtbaldridge: sc2.2 is unbalanced and boring tho..
15:08FrozenlockWho would want to make a SC2 clone? There's no skills with stacking muta...
15:08amalloyarrdem: i don't play, but i'm pretty sure the people who cry "imba" are just mad they're bad at the game
15:09cbp:-O
15:09FrozenlockYou should just watch Supreme Commander FAF. Now that's a good RTS. :-p
15:10dbasch#clojure-gaming
15:10arrdemamalloy: shrug. I don't have the time to practice "esports". I'd rather be hacking or playing drunk dota with people casually. the SC2 pro scene is pretty boring tho because the different races are taking turns at being OP rather than converging to a balance point like SC1 did.
15:10FrozenlockAnyhow... How would you guys call the stuff *around* launching a product/website? All the 'buy a domain', 'host your program', 'built account architecture for the users', 'setup a databse'... Things that aren't necessarily directly related to the main product, but that must be done anyway?
15:10dbaschFrozenlock: work :)
15:10tbaldridgeFrozenlock: ops
15:10tuftdbasch++
15:11arrdemI'll just be over in offtopic..
15:11amalloyis it offtopic now? or social?
15:11arrdemsocial exploded when I po'd sdegutis.
15:11arrdemso we're all in offtopic.
15:12FrozenlockI'll bring it back on topic. Look: "Anyhow... How would you guys call the stuff *around* launching a -clojure- product/website?"
15:12tuftFrozenlock: slightly more enjoyable work =)
15:12JaoodI think I saw sdegutis rambling somewhere about how Go is better than Clojure ;)
15:12Frozenlocktuft: Good point
15:12arrdemtbaldridge: scope question if you've got a minute
15:13tbaldridgesure
15:13gtrakJaood: we should introduce him to bitemyapp.
15:13arrdemgtrak: they've met.
15:13FrozenlockI was thinking peripheral or administrative, but none of them really capture it. :-/
15:13cbpgtrak: way ahead of you
15:13FrozenlockI lack vocabularyz
15:13arrdem(inc cbp)
15:13lazybot⇒ 7
15:13dbaschFrozenlock: whether it’s clojure or not doesn’t change it much really
15:14Jaoodgtrak: at leas bitemyapp did it against haskell ;)
15:14arrdemtbaldridge: this isn't something that's blocking, but I'm pondering how much if any support oxcart should seek to provide for multimethods.
15:15arrdemtbaldridge: I could see statically collecting all defmethods and trying to do static dispatch, but the implementation thereof may not be trivial due to the code that defmethod macroexpands into, being a top level def with an alter.
15:16arrdems/top level def/conditional def/g
15:16tbaldridgearrdem: agreed. So perhaps it's better to start simpler and add that at some point?
15:17arrdemtbaldridge: that's what I was thinking. I've almost got lambda lifting and letfn lifting working, and I figured that the best place to start was to be able to demonstrate a scheme-like subset of Clojure that's entirely static.
15:18arrdemgetting right to the compacting emitter and tree shaking.
15:20tbaldridgearrdem: I think that's a good approach. If you have support for basic data structure manipulation + all the control flow stuff (fn, let, if, etc.) then additional optimizations/features can be added in as there is time.
15:21socksywhat does independent vs co-ordinated mean re: STM types?
15:21socksycan't find a good description via google/docs
15:22tbaldridgesocksy: co-ordinated means that two refs can be updated atomically.
15:22tbaldridgeevery atom is separate, you can't update two atoms in a single transaction.
15:22socksyah, and independent means that only one thing can happen at once?
15:23tbaldridgesocksy: independent means that you can't sync two atoms so that everyone sees them change at exactly the same time
15:23socksyco-ordinated is only a "can" relationship, right — they don't *have* to happen at once?
15:23tbaldridgeyou can do that with refs
15:24tbaldridgeright, with refs you start a transaction, do some work on refs and then commit it, all the work on those refs is done atomically.
15:24Jaoodtbaldridge: not even on different threads?
15:24jumblergtechnomancy: i'm looking at a .jar generated by lein; i see two different project.clj files in the hierarchy. any chance you should shed some light on what purpose they serve?
15:24tbaldridgeJaood: ?
15:24Jaoodtbaldridge: about syncing two atoms
15:25arrdemJaood: using n threads to attempt simultaneous updates of n atoms is a race condition :P
15:25tbaldridgeJaood: right, there's no way to make sure that two atoms are updated at exactly the same time.
15:25socksywould it make sense to have co-ordinated and asynchronous? (regardless of any judgement put in the value of such a language feature)
15:25Jaoodok
15:26tbaldridgesocksy: perhaps, but I've never needed it, and actually people very rarely use STM in clojure. It's often better to just put all your state in a single place (an atom)
15:26tbaldridgeFrom what I understand this is even what Datomic does, not a single use of STM in the transactor, just a few atoms.
15:26Jaoodso refs are not used much in clojure?
15:27socksyhmm. I have everything in an agent around a map, and am trying to justify why on earth i'm doing this in the write up :)
15:27socksy(i may well not be justified in doing this)
15:27tbaldridgeJaood: not that I've seen. They are a cool feature, but often there's better ways of doing the same thing.
15:29socksyso atom isn't STM? I guess that makes sense since you're doing the compare and set operation. Are agents and refs are STM though?
15:30cbprefs are stm, nothing else
15:30socksys/are//
15:30socksyah right
15:31technomancyjumblerg: one of them might be for backwards-compatibility
15:31technomancyjumblerg: the fully-qualified one is new-ish
15:32jumblergtechnomancy: ah, good to know. any idea which one? :)
15:32jumblergok!
15:33jumblergtechnomancy: one more while we're at it, may i ask the same about the pom.properties and pom.xml files?
15:33agarmantbaldridge: does a single atom for state get cumbersome when an app has a lot of state?
15:34tbaldridgeagarman: that's kindof the point, have less state :-P
15:34socksy"Agents are integrated with the STM - any dispatches made in a transaction are held until it commits, and are discarded if it is retried or aborted." So they're implemented around STMs? I am getting a little confused
15:35agarmantbaldridge: I agree wholeheartedly, but for something like an multiplayer game, you're pretty much juggling state
15:35tbaldridgesocksy: they aren't STM, they simply communicate with the transactions in STM. a transaction may be re-run several times. This communication keeps events sent to agents from getting duplicated.
15:36dbaschagarman: state is cumbersome regardless, why is an atom worse than having a bunch of objects all over the place?
15:36socksyI was under the impression that STM meant: changing shared memory using transactions, that can fail and be backtracked. Am I wrong? Is it more specific than that?
15:36tbaldridgeagarman: you're also often in a situation where the game engine is managing turns (quite quickly, but still turn based). So it may make sense to deref the state atom once at the start of each engine update then reset! it after the engine returns a new game state.
15:37arrdemdbasch: s/worse/better/g
15:37technomancyjumblerg: pom.properties just gives you a subset of the data in easier-to-parse format
15:38agarmandbasch: tbaldridge: partly I was trying to find a place where coordinating refs may be a good solution vs a large central atom
15:39jumblergtechnomancy: understand, is that part of the spec for a jar file? i was looking at a few jars generated by maven and they didn't have one.
15:39dbaschagarman: if you were doing a trading system with thousands of independent users, you wouldn’t want to keep all the state in an atom
15:40tbaldridgeagarman: I'd say places where you have a high level of contention. in the case of a game engine though it's probably possible to farm out the processing to multiple threads then write back to the atom a single time. If you can't do that, then yeah it might be better to have 10 threads pounding on 100 refs instead of 10 threads pounding on one ref.
15:41agarmantbaldridge: dbasch: I've yet to have a need for refs in any of my apps...a few atoms, a few agents.
15:41dbaschagarman: imagine implementing Google, how would you do it?
15:42dbaschagarman: as a thought exercise of course, not that you’d do it in clojure
15:42jumblergtechnomancy: just found some reading material on the subject after a bit of googling: http://maven.apache.org/shared/maven-archiver/#pom-properties-content, can figure it out from here. many thanks!
15:42dbaschagarman: maybe google is not the best example, let’s say ETrade
15:43noncom|2are there any code generation libraries for clojure? for example, if i want to generate C code from clojure?
15:43agarmandbasch: I was mostly trying to find an example for folks asking about STMs above
15:44dbaschagarman: say you have thousands of independent trading orders open at any point in time
15:44agarman(inc tbaldridge)
15:44lazybot⇒ 7
15:44dbaschagarman: each one must execute independently, and you must pair a buy and a sell
15:45dbaschagarman: so if joe buys 100 AAPL from bob, bob sells 100 AAPL to joe
15:45dbaschagarman: those two must update atomically, but the rest of the orders don’t care
15:45yotsovI have heard of the existence of a tool which checks your code and finds places where you could have used existing clojure expression instead of something longer you wrote. Anybody knows if such really exists, and its name?
15:45bwreilly_yotsov: kitbit
15:45yotsovbwreilly_: thanks!
15:49agarmanyotsov: eastwood is also useful
15:49tbaldridgedbasch: that's the classic example, but has anyone ever really built a system like that?
15:51tbaldridgedbasch: another method is to simply store all owners of AAPL in a single agent, and the queue all orders regarding AAPL to that agent. group agents onto multiple boxes for a distributed system.
15:52dbaschtbaldridge: I know STM is used in high frequency trading (not in clojure, I imagine) but I don’t personally know any implementations
16:03lemonodoryotsov bwreilly: to help with your searches, it’s “kibit”
16:05yotsovagarman: thanks, I know about eastwood, but kibit seems to be doing something quite different, by suggesting you shorter forms if I understand correctly
16:05yotsovlemonodor: yes, thanks
16:10AeroNotixKibit is pretty good
16:11AeroNotixBut there's no reason to choose one over the other. Use both
16:11AeroNotixwith a dynamic language you need all the help you can get
16:19yotsovAeroNotix: sure. I am already using eastwood and core.typed. kibit is something I definitely want to try though because I am sure I often use too long forms out of laziness to learn alternatives to them
16:22drojasHello: anybody knows a form (using alter-var-root) that restores the original value of the altered var??
16:22lazybotdrojas: What are you, crazy? Of course not!
16:27technomancydrojas: maybe you mean with-redefs?
16:27gtrakdrojas: are you sure you don't want binding's threadlocal semantics?
16:28arrdemBronsa: is there an operation for merging two envs?
16:29Bronsaarrdem: no but wouldn't merging :locals suffice?
16:30sandbags0amalloy: not that i think you thought it wouldn't, but your neat replacement drop-in worked very nicely. thanks. my clojure has definitely improved since doing some 4clj problems but still a very long way to go :)
16:30arrdemBronsa: not unless :locals contains vars...
16:33sandbags0amalloy: i would like to ask you about something you said that i still don't understand though, about the defs being evaluated at the top level
16:37noncom|2are there any code-generation libraries for clojure, like for example if i want to generate c code?
16:37gtrak, (let [] (println a) (def a)) ;;sandbags0
16:37clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)>
16:38gtrakhrmm... bad example.
16:38Bronsaarrdem: I don't understand what you mean
16:38sandbags0gtrak: the context was within a macro, trying to define a function one of two ways
16:38socksyBriefly flirting with what we were talking about earlier — can I clarify something about agents? If I have an agent on say, a map, and two operations are sent to the agent, is it possible for two threads accessing that agent at the same time to see different states?
16:38Jaoodnoncom|2: only in our dreams
16:38gtrak,(do (defn a [] (def b)) b) ;;sandbags0
16:38clojurebot#<Unbound Unbound: #'sandbox/b>
16:39noncom|2:)
16:39gtraknormally what you get is
16:39gtrak,d
16:39clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: d in this context, compiling:(NO_SOURCE_PATH:0:0)>
16:39socksynoncom|2: maybe to LLVM IR?
16:40amalloyit's always nice to know the random junk i type into irc actually works, sandbags0. just ask your question; no need to ask to ask
16:40noncom|2socksy: llvm ir is cool to have too, but i have a specific task of generating c# code, i thought there might be some base for at least c
16:41sandbags0apparently a lot of people put stuff in refheap
16:41socksynoncom|2: something like https://github.com/halgari/mjolnir
16:42arrdemBronsa: I'm not sure I do either. Trying to clean up what I've got.
16:42gtraknoncom|2: generate ASM, then generate C# from that?
16:42noncom|2heh, that's an overkill i guess :)
16:43gtrakthis might be of interest: http://xmlvm.org/overview/
16:43sandbags0amalloy: i'm confused about how both defn's got executed
16:43amalloythey don't, really. but a class is generated for each of them, for use if they *do* get executed
16:44amalloyand you gave them the same name, so those classes conflict
16:44sandbags0ah so the compiler is basically grabbing all defn's
16:44sandbags0and making a class out of them
16:44amalloywell, all fns, really
16:44sandbags0but the var assignment is only made by the codepath
16:44amalloyyes
16:44sandbags0however the class is there
16:44sandbags0hence the weird error
16:44sandbags0well, not weird now
16:45sandbags0okay, now i understand, thanks again
16:45sandbags0useful thing to know
16:45amalloyas a general rule, macros shouldn't emit code that they don't expect to be run
16:45amalloy(if false x y) is not the same as y, for some x
16:45sandbags0that seems like a sound rule
16:46sandbags0i'll try and keep in mind to look for better ways of writing such things if there's a next time
16:47Jaoodwill deref block while an atom is being modified whith swap! ?
16:47amalloyno, deref is free
16:48amalloythat is, you get the current value; if someone's busy figuring out a new value, who cares
16:49noncom|2socksy, gtrak: thank you for the references, i'm taking a look. although i was more looking into manipulating text source files of C#, these technologies are worth knowing
16:49Jaoodamalloy: ok, the swap! operation does block the current thread right?
16:49gtrakJaood: as much as doing anything blocks the current thread.
16:50arrdemBronsa: Okay. this is what I'm working with. https://www.refheap.com/86087#L-73
16:50gtrakit runs the function, it might re-run it, it's synchronous.
16:50gtrakagents are asynchronous if you need that.
16:50aperiodicJaood: there's no lock to acquire so it won't wait for something to free up or deadlock
16:51gtrakthat's like saying a function call blocks the current thread.
16:51gtrakwhich is _true_ albeit useless.
16:52Jaoodgot it
16:53mikerod,(symbol "a/b" "c")
16:53arrdemBronsa: what's going on here is that I already have working code that can take the inline fns of the letfn and rewrite them as fully parameterized top level defs. However with a letfn as the bindings are mutually recursive it isn't enough to simply lift all the fns to the top level I have to emit a (declare) and rewrite each fn to use its letfn mates via the (declare)'d names. This is the sticking point. I know what the top level vars will be since I'm just
16:53clojurebota/b/c
16:53gtrakI don't think you'd ever do a (future (swap! )) in other words. You're not supposed to put long-running functions in there.
16:53tbaldridgeJaood: atoms just use CAS under-the-hood http://en.wikipedia.org/wiki/Compare-and-swap
16:53mikerod,(name (symbol "a/b" "c"))
16:53clojurebot"c"
16:53mikerod,(name (symbol "a" "b/c"))
16:53clojurebot"b/c"
16:54mikerodWhat is the deal with symbols that have more than 1 forward /
16:54mikerodit is allowed, but I find it really inconsistent to deal with
16:54mikerodthe "/" is interpreted differently depending on the way the symbol was constructed
16:54gtrakthat would increase the likelihood of contention no matter what thread the work is actually running on.
16:55mikerodI'm guessing the thought is just, "no symbol should have multiple forward slash "/" in it.
16:55mikerod,((just namespace name) (symbol "a/b" "c"))
16:55clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: just in this context, compiling:(NO_SOURCE_PATH:0:0)>
16:55mikerod,((juxt namespace name) (symbol "a/b" "c"))
16:55clojurebot["a/b" "c"]
16:56mikerod,((juxt namespace name) (symbol "a" "b/c"))
16:56clojurebot["a" "b/c"]
16:56mikerodI just ran into a scenario where we were "accidentally" turning some strings into symbols. Later `name` was being used and it was leading to this due to multiple "/"'s.
16:56Jaoodtbaldridge: useful, thanks
16:57amalloymikerod: i mean, the reader would never construct those symbols. if you do it yourself, by specifying a namespace part and a name part, then what you get out is what you put in
16:57Jaoodgtrak: yeah, that is what I was thinking, running the swap! operation on a future
16:57amalloyie, (name (symbol a b)) is b, regardless of what silly nonsense you put in for a or b
16:58amalloy(as long as they're strings)
16:58mikerodamalloy: why are multiple "/"s supported? just so you can make really crazy symbol names? I know the reader wouldn't support it. I think any symbol with multiple "/"s is just going to be messy.
16:58mikerodthe reader wouldn't *produce it I mean.
16:58amalloyno, it's because the alternative is to do expensive string-inspection checks every time someone makes a symbol
16:58mikerodIt just seems to me that a "/" in a symbol name is special and should not just be thrown in wherever
16:59amalloyyou can have any string at all be the name or the namespace of a symbol. if you have good taste, you should refrain from poorly chosen names
16:59mikerodamalloy: that makes sense I suppose. just have to be careful :P
16:59amalloy"multiple /s" is not the issue, it's "any string at all"
16:59amalloy&(symbol "foo bar baz" "whoa this is just one ////symbol")
16:59lazybot⇒ foo bar baz/whoa this is just one ////symbol
17:00mikerodamalloy: hah, yes I stumbled on this one before too. it shocked me a bit, but makes sense.
17:00Bronsaarrdem: I'm reading now, btw your last message cut off at "since I'm just"
17:00gtrakJaood: you might just want an agent then.
17:00mikerod,(pr-str (symbol "a b c///" " hello "))
17:00clojurebot"a b c//// hello "
17:00mikerod,(read-string (pr-str (symbol "a b c///" " hello ")))
17:00clojurebota
17:00arrdemBronsa: the comment block on 73 says the same thing
17:00mikerodamalloy: the implication there is that the symbol is no longer "reader" friendly
17:01gtrakJaood: it would have the advantage of giving you a queue to throw stuff on and not doing extra work.
17:01bbloomtpope: after I run the piggieback command, attempting to eval a form just hangs
17:01amalloysure
17:01Jaoodgtrak: are their only differences is synchoronous vs async (atom vs agent) ?
17:01bbloomtpope: any way to determine what's failing?
17:02gtrakJaood: essentially, yes, also the tasks run on a threadpool, which is managed for you.
17:02gtraka single agent is just going to serialize the actions, it won't be running concurrently.
17:02gtrakbut the threadpools are shared across the agents.
17:04gtrakif you need to go even further, then that's core.async territory.
17:05gtrakif your coordination needs get complex enough.
17:06Jaoodgtrak: thanks, I'm still on reference types, looking to learn core.async later, I hear is very usefull in cljs
17:06gtrakyes, UI coordination gets complex fast. I'm having a lot of fun with that.
17:07gtrakexcept I have no idea how to test it.
17:07Bronsaarrdem: I understand what you're doing but I don't understand what issue you're having :/
17:07Jaoodgtrak: are you doing a web UI?
17:08gtrakyea, some informational node-webkit stuff, using it as an excuse to learn Om and core.async.
17:09Jaoodcool
17:10arrdemBronsa: The issue I'm having is that I can't seem to build a working rewrite from locals to the newly declared vars in part because when I analyze the renamed symbols the analyzer doesn't know they exist because the declare and the individual symbol uses are analyzed separately.
17:13felherHey folks. Does clojure.data.generators/weighted have a problem with non-integer weights? I looked at the api doc, but it doesn't state anything about that. I tried using numbers between 0 and 1 as weights, which didn't seem to work, but it didn't complain either, so maybe I'm just using it wrong.
17:13Bronsaarrdem: mh, analyzing a declare makes the var get interned in the namespace so I really don't see how that could be a problem
17:15arrdemBronsa: understood, and that's what I was counting on. Lemme cut an in progress commit of this and try to get you a concrete error to work from.
17:15Bronsaarrdem: long shot but maybe you're analyzing the bindings with their original env? that has the letfn bindings in the env :locals, you need to dissoc those to make the analyzer use the vars instead
17:16arrdemBronsa: that may well be what I'm seeing, but I wouldn't expect that to be the case because I'm trying to do this local -> var replacement where the vars have radically different names than the remaining garbage :locals
17:17TEttingerinteresting trick: ##(repeatedly 40 #(rand-int 7/6))
17:17lazybot⇒ (0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0)
17:18mikerodWhat is the *best* Clojure testing tool available to give good failure messages when deeply nested maps are being compared.
17:18mikerodIt'd be nice to know which key-val was found to not be =
17:19mikerodthat sort of thing
17:19amalloyTEttinger: cute, i guess, but isn't it the same as ##(repeatedly 40 #(int (* 7/6 (rand))))?
17:19lazybot⇒ (1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
17:19TEttingerit's just odd that rand-int doesn't need to be passed an int to make them
17:20amalloyclojure.core is not exactly famous for validating inputs
17:20sandbags0mikerod: i can't speak to it being the *best* but expectations definitely does produce intelligent diffs when a test fails
17:22seancorfieldmikerod: I'll second sandbags0 comment - Expectations generally does a really good job of highlighting exactly what part of the result differed
17:22sandbags0mikerod: here's an example https://www.refheap.com/86090
17:23lockshttp://blog.nitrous.io/2014/05/06/learn-clojure.html
17:23lockspretty cool
17:23mikerodsandbags0: seancorfield Yeah, I've heard a little on expectations before. The example looks promising. Failure message can be rough when dealing with deeper maps.
17:24mikerodI'll have to try out expectations.
17:24sandbags0i really like it, but i've zero experience of the alternatives
17:25aperiodicmikerod: you can also use lein-difftest if your tests are already written and use clojure.test
17:26seancorfieldmikerod: we used to use clojure.test but we switched to Expectations after Clojure/West a year or two ago... we love the way they read and how easy the library is to use...
17:26aperiodicit's sort of weird (it uses string-based comparisons so sometimes the diffs are more fine-grained than you really want) but it's certainly worlds better than the stock experience
17:28aperiodicseancorfield: what motivated you to switch?
17:30mikerodaperiodic: I'll check this out as well.
17:31seancorfieldaperiodic: clojure.test seemed very imperative by comparison: do stuff, assert this, assert that
17:31mikerodseancorfield: I wanted to avoid jumping into some "testing framework", but the failures can be painful to figure out (mostly in the case of nested maps). So I think it is worth exploring.
17:31seancorfieldaperiodic: and I like the BDD style language of Expectations
17:33seancorfieldmikerod: Expectations is deliberately minimal - and easy to use with Leiningen, Emacs, LightTable...
17:34sandbags0yep... when i was looking for a testing library it seemed a simple & elegant choice
17:34sandbags0nothing really to learn
17:34drojastechnomancy: with-redefs don't play well with concurrency
17:35drojastechnomancy: with-redefs do not play well with concurrency
17:36drojasgtrak: in order to use binding I need to set the function dynamic, and I do not want to do that
17:38arrdemBronsa: failing test case, https://www.refheap.com/86091
17:39arrdemBronsa: codebase https://github.com/arrdem/oxcart/blob/develop/src/oxcart/passes/lambda_lift.clj
17:40arrdemBronsa: it looks like what's happening is that after I rewrite the locals to vars they continue to be resolved to locals indicating that something funky is afoot or no rewriting took place.
17:42arrdemlooks like the answer is that no locals are rewritten.
17:44Bronsaarrdem: shouldn't it be (let [baz (partial baz$baz__.. bar$bar__..) ..) ?
17:45drojasanybody knows a form (using alter-var-root) that restores the original value of the altered var (with-redefs does not work with concurrency and binding needs the var to be dynamic)??
17:45lazybotdrojas: Uh, no. Why would you even ask?
17:46technomancydrojas: you can't change the root *and* play well with concurrenty
17:46technomancyconcurrency
17:46technomancythey're mutually exclusive
17:47arrdemBronsa: this is the desired output https://www.refheap.com/86092
17:47mikerodseancorfield: well, sounds promising. minimal = win.
17:47mikerodI appreciate the feedback on this.
17:48arrdemBronsa: I claim that output is reasonable because within the original letfn forms, "bar" and "baz" are locals and thus should be rewritten to their lifted names.
17:48Bronsaarrdem: you probably just need to dissoc the letfn locals from https://github.com/arrdem/oxcart/blob/develop/src/oxcart/passes/lambda_lift.clj#L63
17:48arrdemBronsa: re-running collect-closed-overs then will not show them as closed over and they do not need to be partials.
17:49arrdemBronsa: will the re-run of collect-closed-overs that I do here https://github.com/arrdem/oxcart/blob/develop/src/oxcart/passes/lambda_lift.clj#L126 not achieve that?
17:50arrdemBronsa: because I'm completely killing the {:op :local}s for {:op :var}s which I don't expect can resolve to :local bindings
17:50amalloytechnomancy: note that lazybot's ?? plugin was right again. the accuracy of that one single predictor is remarkable
17:50arrdembut this is your toolchain and not yet mine so I may be mistaken.
17:50drojastechnomancy: what I need to do can't be done with binding or with-redefs but it can with alter-var-root. I just can't make it in one single form, if I don't get that macro done soon I'll use ^:dynamic and binding.
17:51amalloywhat you asked for is not possible, drojas, as technomancy said. alter-var-root is the antithesis of safe concurrency
17:51drojastechnomancy: ... it can be done with binding but I do not want to define dynamic functions
17:56hiredmandrojas: have you looked at the implementation of with-redefs?
17:56Bronsaarrdem: let me play a bit with your code
17:57arrdemBronsa: please do. I'm digging in to the unmodified AST to confirm that it's structure the way I think it is.
17:57arrdemBronsa: thanks for taking a look at this
17:58drojashiredman: nope, since with-redefs changes can be persistent when executed in concurrency...
17:58hiredmandrojas: the same is true for alter-var-root
17:59hiredmandrojas: a var is a mutable memory cell, if you alter the contents, every sees the different contents, unless you use dynamic vars
17:59drojashiredman: never tried but I believe in that now... I'll use dynamic vars and binding
18:00technomancyamalloy: it's a pretty great heurstic
18:01arrdemBronsa: yeah that (baz [z] (dec (bar z))) does come down to a {:op :invoke :fn {:op :local :name bar__#0}}, which I am seeing replaced with a {:op :var}.
18:02arrdemand then I get that local right back again.... oh.
18:06{blake}OK, I need help braining... Given the nested structures here: https://www.refheap.com/86093
18:06{blake}I want to get the data out as shown by the nested mapcats, without nesting the mapcats manually, obviously.
18:07arrdemnope if I do a (ast/prewalk #(assoc %1 ::no-replace true)) and conditionalize lambda lifting on (not (::pre-walk ast)) I see that the local to var replacement happens and that {:op :local} bar -> {:op :var} bar$bar__...
18:07{blake}Or if there's another way without using mapcat. My previous attempts all ended up with deep nesting that felt forced to try to flatten.
18:08gfredericksthe factory method for the j.u.c ScheduledExecutorService is surprisingly ambiguous about what its thread-count arg means
18:08drojastechnomancy: which tdd library would you recommend (I'm using clojure.test but I'm a little bit confused about switching to midje for the stubbing features)?
18:08technomancyI would not recommend midje
18:09gfredericksusing component for mocking instead of with-redefs means you have concurrency-friendly tests
18:09nooniantechnomancy: why not midje? just curious
18:09amalloysounds like you want a function (read-tag stuff :L3), such that you can write (-> sample3 (read-tag :L1) (read-tag :L2) (read-tag :L3)), {blake}
18:09amalloywhere read-tag is just that mapcat/when function you wrote a hundred times
18:10{blake}amalloy: Well, yesterday I got this to where I could say "(by-tags data [:L1 :L2 :L3])" and I liked that, just not the results. =P
18:10amalloyand maybe a better name than read-tag is like...descend-into
18:10{blake}amalloy: Yeah, all names are a work-in-progress...
18:10technomancynoonian: it has a bunch of macros that are too clever; they look good on the surface but obscure what's really going on
18:10amalloythe...results?
18:11technomancyalso it encourages side-effects at the top-level, though supposedly that's optional
18:11hiredmanmidje is basically written by rubyists while they are learning clojure, it tends to do things the ruby way vs the clojure way until some one points out how broken it is
18:11nooniantechnomancy: thanks
18:11{blake}amalloy: The results of my previous attempts. I had a for-loop with a when filter that recursively called itself.
18:12{blake}amalloy: It got the right data, just nested deeply, and with empties when there was a branch that didn't qualify.
18:12{blake}amalloy: This was the first shot: https://www.refheap.com/86027
18:12amalloy{blake}: that's just missing a level of flattening. i liked your previous approach better than the one with mapcat. re-paste that and i'll show you how to flatten it
18:13{blake}amalloy, OK, hang on, let me put up the latest.
18:13{blake}amalloy, https://www.refheap.com/86094
18:14{blake}If I "(by-tags sample2 [:L1 :L2 :L3])" I get " ((() ([{:stuff :otherdata}])) (() ([{:stuff :otherdata}])))" which is yucky. And doesn't allow me to chop off a branch and pass it back in.
18:15hiredman you need to hoist the if up in to the for
18:15gfredericksprogrammers say the weirdest things
18:15justin_smith(inc gfredericks)
18:15lazybot⇒ 65
18:15gfredericksI wonder how many layfolk can parse that sentence correctly
18:15hiredmanis it odd that I never get to use the word hoist outside of s-expression manipulation?
18:16gfredericksbring back the hoisting
18:16{blake}Steer clear of any petards, then.
18:16arrdemhiredman: it's rarely sematically valid outside of sexprs..
18:16hiredmanthe first thing that needs to happen is both branches of the the if need to return the same shape of data
18:17justin_smitharrdem: that's just because it's been too long since we had a proper bloody revolution
18:17hiredmanthe first branch returns a thing, the second a list of things, so box the first in []
18:17{blake}hiredman: but ":content r" is a vector...
18:17justin_smitharrdem: (or maybe you just don't spend much time in warehouses)
18:18amalloy{blake}: the simplest fix is https://www.refheap.com/b76736928aca08236316971a9, which is sorta the opposite of what hiredman is saying
18:18hiredmanif I ever get a regular kayak that I need a car rack to carry around I'll be able to talk about hoisting the kayak on to the car
18:18amalloyhis way should be fine too, depending on exactly the shape of data you have/want
18:18{blake}Vectors of hashes containing vectors of hashes.
18:18gfrederickshoistable
18:19cbp/[
18:19arrdemjustin_smith: DOST THOU EVEN HOIST
18:19cbper oops
18:19justin_smithlol
18:19gfrederickscbp: I was trying to interpret that as an emoticon about hoisting
18:19amalloyyou're not alone, gfredericks
18:19hiredmanmy lisp targeting go had a special form that would cause the compiler to hoist a given expression to the outer most scope
18:19gfredericksit kind of looked like hiredmand & a kayak
18:19arrdemthis channel says the damndest things..
18:20gfrederickss/hiredmand/hiredman/
18:20gfredericks(hiredmand is hiredman persistently in the background)
18:21gfrederickscould a lisp have a comacro that gets to replace the code it's embedded in?
18:22arrdemyou could invent such a construct but I've never heard of one before..
18:22hiredmangfredericks: continuations for macros
18:22{blake}amalloy, hiredman: thanks
18:22{blake}(inc amalloy)
18:22lazybot⇒ 114
18:22{blake}(inc hiredman)
18:22lazybot⇒ 46
18:23hiredmansort of logically the continuation of a macro is the code in to which it is being expanded
18:23hiredmanI have no idea how that kind of thing would work
18:24gfredericksit seems like there'd be some definitions to work out wrt how they interact with normal macros
18:25hiredmanand what would the boundaries be, would the continuation be the entire compilation unit?
18:25gfredericksthe WHOLE PROJECT
18:25gfredericksand its libraries
18:26gfredericksand...clojars
18:28hiredmandelimited macro continuations
18:29gfredericksthis reminds me of that character in Hitchhiker's who built a shack on the beach and defined the area outside it to be the inside
18:29gtrakgfredericks: I think that's called dynamic scoping.
18:29hiredmanI am waiting of bbloom to explain that an effects system would handle this
18:30gfredericks"Watson, distressed and fearing for the world's sanity, built 'The Asylum' to put it in and help it get better."
18:30tolstoy-(Asking for a colleague): Is the Clojure in Action book pretty reasonable?
18:31gtraktolstoy-: I'm reviewing the second edition, I'd recommend to not get the first.
18:31tolstoy-gtrak: Is the 2nd edition out?
18:31gtrakno :-)
18:31arrdemgtrak: I thought the PDF was out
18:31tolstoy-Ah, I see it's 2011.
18:31Bronsaarrdem: http://sprunge.us/gWeN?diff
18:31gtrakbut I think it'll be better, haven't read the first, but I didn't like the first transcript they sent me, the recent one was much better.
18:32gfredericksback when vars were vars and arithmetic couldn't overflow
18:32Bronsaarrdem: you had a really dumb bug and two non obvious ones :)
18:32noonianare vars not vars anymore?
18:32arrdemBronsa: do tell.
18:33gfredericks~vars
18:33clojurebotvars are a linking construct
18:33gtraktolstoy-: early access: http://www.manning.com/rathore2/
18:33Bronsaarrdem: 1- you were using a transient to do mutability in place + you were calling get on the transient rather than on (persistent! the-transient)
18:33Bronsaarrdem: changed that to an atom
18:33arrdemBronsa: yep got that.
18:33Bronsaarrdem: also you were calling patter/binding->symbol on a local
18:33tolstoy-gtrak: Personally, I like Joy of Clojure, but it's abstract. Any recommendation for a first book for an experienced Java dev (who's not too thrilled about folks using Clojure in the company)?
18:34amalloyBronsa: er, don't transients support get? they should
18:34gtrakI've heard good things about Clojure Programming
18:34arrdemBronsa: lolz yeah that I fixed not long after cut that commit for you
18:34amalloy&(get (transient {:x 1}) x)
18:34lazybotjava.lang.RuntimeException: Unable to resolve symbol: x in this context
18:34tolstoy-gtrak: Chas Emerick?
18:34amalloy&(get (transient {:x 1}) :x)
18:34arrdemamalloy: they do
18:34lazybot⇒ 1
18:34gtrakyea
18:34Bronsaarrdem: oh well I didn't know that.
18:34arrdemBronsa: yep, that was my fault. what's the update-ns-map!?
18:34cbptolstoy-: maybe the clojure cookbook
18:35gtraktolstoy-: I also really loved Joy of Clojure.
18:35bbloomhiredman: gfredericks: read http://lampwww.epfl.ch/~rompf/pldi2014.pdf
18:35bbloomhiredman: gfredericks: shows an example of this sort of thing
18:35gtrakis the second edition worth getting if you've already gotten the first?
18:35Bronsaarrdem: you don't specify the env when you analyze (declare foo) so a new empty one gets created automatically, the :namespaces atom of that env gets updated with the newly interned var but not the original one
18:36bbloombut in short, yeah, "on the stack replacement" of the continuation is pretty natural with an effect system
18:36cbpgtrak: 2nd edition of joy of clojure?
18:36gtrakyea
18:36arrdemBronsa: gotcha. that was one thing I was worried about for a while.
18:36Bronsaarrdem: ideally you should always use the same env that builds up incrementally, if you don't you'll have to manually update the env to reflect the changes
18:37noonianClojure Programming is good for an intro to the language, i know people who tried Joy of Clojure first and thought it was 'preachy'
18:37arrdemBronsa: okay I was wondering about that.
18:37gtraknoonian: which was preachy?
18:37Bronsaarrdem: and finally, you were calling (:form ast) rather than regenerating the form with emit-form, so it was emitting (fn [] bar) rather than (fn [] bar$whatever)
18:37noonianJoy of Clojure, those aren't my words though, i very much enjoyed it
18:39gtrakI wouldn't recommend JoC to someone who's just trying to get something done.
18:39cbpgtrak: Well I know it has a bit on reducers which is new
18:39cbphavent read it completely yet though
18:39Bronsaamalloy: do you know if transients always supported get? or is that a recent addition?
18:40gfredericksBronsa: frequencies couldn't work without it, no?
18:40arrdemBronsa: mm..... I don't think the last one was right, but the others definitely are. thanks for the help.
18:40gfredericksfrequencies is my goto example for transients
18:41amalloyBronsa: it's not recent
18:41Bronsagfredericks: I don't recall all of clojure.core by heart but I trust you :P
18:41amalloyit's been that way since at least 1.2, and i don't know if transients even existed before that
18:41gtrakgfredericks: zipmap is my goto example for 'why not transients?'
18:41gfredericksclojurebot: Bronsa |trusts| me to recall all of clojure.core by heart
18:41clojurebotAlles klar
18:41gfredericksgtrak: mine is set
18:42gtrakthat just calls into java
18:42gfredericksgtrak: vec does as well, but uses transients in java
18:42amalloygtrak: yes, but it's *slower* calling straight into java than if it had used transients
18:42gtrakheh
18:42Bronsaarrdem: you mean about emit-form?
18:42gtrakdidn't know that one.
18:43gtrakBut I've definitely favored seq filter/remove over clojure.set functions for perf reasons.
18:43gtrakmassive difference.
18:43arrdemBronsa: emit-clojure. I have my own AST structure built atop yours that it processes.
18:43gfredericksoh all of clojure.set is non-transient isn't it
18:44gtrakbut people that know math intuitively reach for clojure.set.
18:44gfrederickshaha set.clj has a (comment) at the bottom
18:44amalloygfredericks: a lot of the old files do
18:44Bronsaarrdem: oh well, I didn't read all your code so you're probably right
18:44amalloysee xml.clj
18:44gfredericksgtrak: have you seen a ticket for this?
18:44gtrakdon't think so.
18:45gfredericksseems kinda low-hanging
18:45gfredericksor high-growing in the case of vegetables
18:45gtrakgfredericks: well, in my case simply not running inputs through (set ..) made a big difference.
18:45gtrakbut it could use transients there.
18:46gtrakrather, I ran the smaller input through set, then used that as a predicate.
18:46BronsaI just discovered clojure.template is a thing.
18:47gfredericks"You won't believe this weird namespace that Bronsa found in the clojure source code."
18:47gtrakgfredericks: we'll just keep whipping arrdem to produce a whole program optimizer.
18:47arrdemgtrak: I'm self-whipping, for whipping defined as coffee overloading
18:48gtrakeven better.
18:48amalloyoh, that's weird, Bronsa. i knew stuart sierra had written it, but i guess i forgot it was part of clojure.core. thought it was some contrib
18:49arrdemBronsa: hum.... something's fishy. if I reset, restart my REPL and apply your patch the case is still b0rken.
18:49technomancyBronsa: it was included in clojure simply because clojure.test/are uses it iirc
18:49technomancyfrom what I've heard it never would have landed on its own merits
18:49dbaschtransients is from 1.1
18:51amalloyman, that's terrible, technomancy. it would be so easy to just inline the template code into clojure.test/are
18:51Bronsaarrdem: durr I forgot to include the emit-form thing in the diff http://sprunge.us/GZjW
18:51gtrakdbasch: didn't stop him from changing stuff around for reducers.
18:52amalloybut you're right, that's the only place it's used at all
18:52arrdemBronsa: Ah. Okay yeah that's very significant :P
18:52arrdemherp a derp
18:52technomancyamalloy: at the time my only thought was "man, it'd sure be great to be able to write tests without contrib"
18:52arrdemdat (:form)....
18:52amalloyi wish they'd instead implemented macrolet, and used *that* for are
18:52Bronsayeah that's what I was talking about
18:53amalloyor i guess it's more like symbol-macrolet, but whatever
18:53arrdem(inc Bronsa) ;; and everything works
18:53lazybot⇒ 21
18:54amalloy(are [a b c] (= a (+ b c)), 3 2 1, 6 4 2) could have been (do (symbol-macrolet [a 3 b 2 c 1] (is (= a (+ b c)))) (symbol-macrolet [a 6 b 4 c 2] (is (= a (+ b c)))))
18:54amalloyand then we'd have symbol-macrolet!
18:54hiredmanyep
19:00hiredman"pines" could go so many ways "you should use mutt instead, or maybe gnus", "sure you pine for it, but what do you yew for?" etc
19:00amalloyhiredman: i just have finger dyslexia. i meant spine
19:00hiredmanand then you can start in on yew and you
19:02amalloyi noticed something weird on stackoverflow. of the users with the gold "clojure" badge, one of them got it in 2010, and then in 2012 three users got it within three months of each other, and then nobody has gotten it since then. does that mean anything interesting?
19:02amalloy(list at http://stackoverflow.com/help/badges/250/clojure but i don't think it matters much)
19:03gfredericksamalloy: nobody uses clojure anymore
19:03amalloydisaster! how do i un-learn this useless language, gfredericks?
19:03gfredericksclojure has mostly been supplanted by node, which has similar features but can scale
19:03gfredericksamalloy: embrace the async
19:04arrdem`tbaldridge likely has something to say on the matter of async and Clojure's obsolescence...
19:04amalloyyou'll be the death of me one day, gfredericks
19:04hiredmanpeak stackoverflow
19:04dbaschnode is web scale, unlike clojure
19:04arrdemas is mongodb...
19:05amalloydbasch: you're too late, gfredericks already made that joke
19:05tbaldridgedoes anyone use stackoverflow anymore?
19:05dbaschbut I sent the request 3 minutes ago through my node app!
19:06gfredericksstackoverflow is a website that google sends you to when you have programming questions
19:06arrdemtbaldridge: why would you make async requests for support when you can synchronously bug the library maintainers on IRC?
19:06tbaldridge:-)
19:06dbasch$google ask a programming question
19:06lazybot[Stack Overflow] http://stackoverflow.com/
19:07technomancystack overflew
19:07gfrederickshuh -- sync vs async is exactly why people use text messages instead of calling
19:07gfredericksgo tell your grandmother
19:07dbascharrdem: because they have badges
19:08arrdemdbasch: badges? badges? we don' need no steenkeeng badges..
19:08arrdembesides we have bot karma!
19:10gfredericks$karma lazybot
19:10lazybotlazybot has karma 26.
19:11gfrederickshis karma is so high because most of his dec's are a result of being offline
19:12{blake}$karma chameleon
19:12lazybotchameleon has karma 0.
19:12{blake}aww
19:12gfredericks$karma rhickey
19:12lazybotrhickey has karma 2.
19:12gfrederickswelp.
19:13noonianlol
19:14dbasch(inc chameleon)
19:14lazybot⇒ 1
19:14dbaschthat wasn’t right
19:46arrdemBronsa: (let [x 2] (letfn [(bar [z] (* z x)) (baz [y] (bar (inc y)))] ...)) should x not be a closed-over of baz as well as bar?
19:52hyPiRionarrdem: why should x be closed over baz? Unless you're doing inlining
19:53storme$karma storme
19:53lazybotstorme has karma 0.
19:53arrdemhyPiRion: that's close to what I'm doing :P
19:53storme$karma seancorfield
19:53lazybotseancorfield has karma 12.
19:54hyPiRionarrdem: oh, hrm
19:54arrdemhyPiRion: yeah :|
19:54kenrestivo$karma karma
19:54lazybotkarma has karma 0.
19:54kenrestivo$karma karma karma chamelon
19:54lazybotkarma has karma 0.
19:55kenrestivooic, someone already went there.
19:55gtrak$karma lk;asjdfal;ksjdf;alksdjfa;slkdfjasl;kdjf
19:55lazybotlk;asjdfal;ksjdf;alksdjfa;slkdfjasl;kdjf has karma 0.
19:55gtrakit's a big database :-)
19:55hyPiRionarrdem: Well, Bronsa is probably sleeping right now, FYI
19:55kenrestivo$karma korma ;; drop table users
19:55lazybotkorma has karma 0.
19:56amalloyarrdem: baz doesn't close over x
19:56hyPiRion(identity hyPiRion)
19:56lazybothyPiRion has karma 36.
19:56arrdemhyPiRion: yeah I need a "T-12" clock on my desk.
19:56dbaschgtrak: not as big as the one with all the bitcoin keys :) http://directory.io/
19:56amalloyif you want the closure of the "closure relation", then you can compute that based on the depth-one relation that's presumably what Bronsa is actually using
19:56gtrakwow
19:57amalloy(here closure means two different things in one sentence! very exciting)
19:57arrdemsuch terminology wow what does mean very confuse
19:58gtrakdbasch: it only goes up to 20
19:58arrdemamalloy: jokes aside you're right, and what I need to do is figure out a nice way to compute exactly that result.
19:58arrdems/nice/working/h
19:59dbaschgtrak: I guess it broke :(
19:59gtrakprobably a php thing
19:59amalloyit's going up and down
20:00gtraksomeone used single quotes when they should have used double ones.
20:02arrdemgah it's 1:55 AM there. I feel bad now. good call hyPiRion.
20:03amalloydbasch: if you request http://directory.io/904625697166532776746648320380374280100293470930272690489102837043110636675 their server crashes
20:03hyPiRionamalloy: or http://directory.io/13
20:03amalloyno, that works fine, hyPiRion
20:03hyPiRionamalloy: what, doesn't work here
20:03arrdemthat crashes for me..
20:04dbaschamalloy: the site is offline, cloudflare caches some pages for them apparently https://www.dropbox.com/s/mq3mig0zy1ttw7m/Screenshot%202014-05-29%2016.57.41.png
20:04gtrakI get a banner, 'this page is current offline'
20:04amalloydbasch: the site auto-restarts itself, and appears to be fine for a while, until you request a high-numbered page like http://directory.io/904625697166532776746648320380374280100293470930272690489102837043110636675 - then every page gets that offline banner, until the server restarts
20:04gtrakhehe
20:05amalloyof course now that i've said it out loud, it will be hard to repro as everyone is hammering it
20:05amalloybut that was my experience playing around. could load low-numbered pages easily; attempted to load high-numbered page; now all pages are temporarily offline. wait for server to come back up: same behavior
20:06dbaschthey should have implemented the address derivation client-side :)
20:06amalloyhahahaha http://www.reddit.com/r/Bitcoin/comments/1ruk0z/dont_panic_directoryio_thing_is_fake/ - completely missed the joke
20:07dbaschand technically it’s not fake, it’s an approximation of The Book of Sand by Borges
20:08dbasch(a book with an infinite number of pages, infinitely thin)
20:09dbaschbut computing tons of bitcoin addresses server-side can get expensive
20:10hyPiRionThe Book of Sand sounds sorta like dirac delta?
20:10dbaschhyPiRion: yes, the integral is such that it’s a regular tome
20:11hyPiRionhahah, nice.
20:11arrdem(count sand)
20:11Bronsaarrdem: x is not a free variable of baz there, I guess if you need it to be there you'd have to figure out which other letfn bindings are used inside a binding body and merge their :closed-overs
20:12arrdemBronsa: yep that's what I'm working on. sorry to bug you this late.
20:12hyPiRionhurray for European CS students not yet sleeping
20:12arrdemhyPiRion: insomnia seems to go with the major...
20:13Bronsahaving classes in the afternoon helps
20:13hyPiRionWhen you're working on a master's thesis, you don't even have classes
20:14arrdems/helps/hurts/g I'm gonna have to turn in early today this waking up at noon and then GSoCing till 8 thing is nice but it makes for grinding starts.
20:17Bronsaarrdem: btw you might want to use analyze' rather than analyze and use the lastest t.a snapshot. it removes all the :namespaces entries for env so it makes it nicer to pprint the AST
20:18arrdemBronsa: ok. I've just been running my own "throw out :env" pass before I pprint to start digging around.
20:21erlisemacs question: I have a project and everytime I want to use the REPL (cider) I have to C-c C-k file by file
20:21erlisis it possible to do that for all the files in my project
20:22erlisis there a C-c C-k en emacs that load the entire project at once?
20:22gtrakC-c C-k an entry point
20:23gtrakI dunno, never bothered me in practice :-)
20:23gtraki think you can hack something together with tools.namespace
20:24erlisis bothering me now, I have several files and if I want to evaluate something I have to load one by one ...
20:25gtrakif it's bothering you, it's possible you haven't structured your app correctly.
20:25technomancyerlis: almost every clojure codebase has a single namespace that requires all the others to get compiled when it's compiled
20:25erlistechnomancy: let me try that
20:26gtrakerlis: you're likely also using fully-qualified names instead of 'require' like you're supposed to.
20:26arrdemerlis: baring aught else you could always write a `find` equivalent emacs function that searches recursively for clojure files and evals them..
20:26gtrakyou shouldn't rely on load ordering.
20:27erlisin my core.clj I'm referencing all other namespaces
20:27arrdemload ordering and load time evaluation are evil and things I look forwards to killing off in oxcart.
20:28gtrakerlis: the key is what you mean by referencing
20:28erlisI do a change on one of the files, C-c C-k in core.clj and I got an error
20:28erliscan I paste here my (ns) declaration, it's short
20:28gtrakit won't reload namespace unless you do require reload :true
20:28technomancyarrdem: "load time evaluation" being side-effects specifically or what
20:28arrdem^
20:29gtrakbut you're already in the file, just hit C-c C-k and it'll ask you to save first.
20:29gtrakwhat's the problem?
20:29technomancyisn't there a C-c C-k alternative that does reloads?
20:29arrdemtechnomancy: load for side effects is one, the other that's messy is (def foo (System/getEnv "$PWD"))
20:29technomancyarrdem: yeah, that's something I see customers get wrong on heroku =\
20:29gtrakthen you hit 'y' and all is well.
20:30arrdemtechnomancy: the if that a defmulti compiles down into as well..
20:30technomancyouch
20:30arrdemtechnically it's a (when (bound? <method>) (alter <method>)) which makes sense but yeah.
20:31arrdemcollecting those would be nice if I ever get that far.
20:31technomancyarrdem: someone who used clojure.core/load was telling me how it was so lame that slamhound doesn't work with it
20:32amalloyspeaking of which, technomancy, could you get slamhound to work on my codebase? it is scribbled on the backs of thirty napkins, written in barbecue sauce
20:32technomancybecause clojure.core/load is so cool
20:32technomancyhttp://p.hagelb.org/oh-yeah.gif
20:33arrdemamalloy: well at least you got the right ink..
20:36mr-foobaralandipert here ? haplon doubt
20:37alandipertmr-foobar, what's up?
20:38mr-foobaralandipert: hey ... have a bit of trouble understanding the documentation. by html compiler, do you mean a pre-renderer ?
20:40alandipertmr-foobar, the kinds of compilation are prerender and html syntax -> cljs syntax
20:41alandipertthe html syntax -> clojurescript syntax is probably closer to translation than compilation
20:41mr-foobaralandipert: neat. also, how does the sync happen to the browser ? is it complete client side rendering ? or server side + websocket updates ?
20:42alandipertmr-foobar, many of us are in #hoplon btw if you want Enterprise Support :-)
20:42alandipertmr-foobar, server isn't a requirement, we use the 'castra' library to do RPC. people have used liberator & http-kit backends & experimented with websocket
20:44mr-foobar alandipert: will checkout castra and also join #haplon :) Are you planning on a clojure port of javelin ?
20:44alandipertmr-foobar, complete client-side rendering is most supported, but dynamic server-side prerender has been experimented with
20:45alandipertmr-foobar, there is a clj port but it's not as featureful or documented, check out https://github.com/tailrecursion/javelin/blob/master/src/tailrecursion/javelin_clj.clj
20:49mr-foobaralandipert: neat. making a fork. I'm trying to build a javelin based app. not sure whether to go with om, which I sorta understand, or hoplon which seems more close to what I want.
20:50alandipertmr-foobar, cool, be sure to check out https://github.com/tailrecursion/hoplon-demos/ - we may already have what you want :-) also we're very active on http://hoplon.discoursehosting.net/, our forum, if you want advice/help
20:52mr-foobaralandipert: yup. for testing purposes I should be able to :require tailrecursion.javelin_clj from clojure right ?
20:54alandipertmr-foobar, javelin-clj instead of javelin_clj in your require, but yup. full: (ns test (:require [tailrecursion.javelin-clj :refer [defc defc= cell cell=])) gets you the stuff
20:55mr-foobaralandipert: thx !
20:56mr-foobaralandipert: http://t.co/rqFo4zoweO :)
20:57alandipertmr-foobar, love it! devn was working on a javelin tracker at one point
20:59mr-foobaralandipert: i have one in the works too ! ask him to github it :)
21:00alandipertmr-foobar, really awesome. we need it to make music to program to
21:00alandipertmr-foobar, a good tracker would be a key piece of my dev tooling
21:02mr-foobaralandipert: buy renoise ! I highly recommend it .. it has OSC and Lua API. I learnt a lot from it, like RTFM .. also there are tons of drum samples
21:03mr-foobaras the techno producers say, loop the 909 kick for 4 hours and you have a party
21:05m00nlightHow can I lazily read 200 lines each time from a file?
21:11blur3dI’m trying to use the Prismatic Schema clojure library, and an writing a custom coercion function, but I’m blanking on how to more easily write it
21:12blur3dbasically, I have a map, and I need to update certain keys (only if they exist), using a transform function
21:13alandipertblur3d, sounds reduce-y - initial value is the map, sequence is the keys you want to transform, reducing function is the update-in + transform
21:14alandipert,(reduce (fn [xs y] (update-in xs [y] str)) {:number 123} [:number])
21:14clojurebot{:number "123"}
21:14blur3dwould that work for a few different functions (depends on the keys)
21:14blur3dsome I want to convert to UUID and TIMESTAMP
21:15blur3dThis is terrible code.. but what I have working http://pastebin.com/dW9innnu
21:16blur3d(it also doesn’t check if key exists, before performing function)
21:18blur3dthey give this example http://pastebin.com/yxZp2K1i - but i’m not sure how best to adapt it
21:19danneuarrdem: my conf was meant to be public, but thanks for letting me know
21:22dbaschblur3d: the one thing that stands about about your code is that you don’t need to create anonymous functions, that’s what the threading macro is for
21:23dbaschblur3d: i.e. remove the (# ) and the %
21:23blur3dyeah, I added them when I was playing around with the if contains? check
21:27dbaschyou could do what alandipert said with a cond for different keys
21:27blur3dI’ll give that a go
21:35akhudekis the ring 1.2 documentation still around anywhere?
21:38Jaoodgit never forgets
21:40blur3ddbasch alandipert: I got it working fairly nicely with reduce and condp http://pastebin.com/y0dRjZuq - Thanks for your help
21:59rhg135_can I get a quick opinion on some code I wrote? https://github.com/rhg/cljnio
22:01work_opis it possible to make an atom that evaluates a function whenever its dereferenced?
22:01rhg135_work_op, yes, using watchers
22:01rhg135_but i haven't tried
22:02work_ophm
22:02benkayis there a function like (do ...) that fires off its expressions immediately?
22:02hellofunkwork_op you might also consider a more functional approach, such as storing the atom as a closure in a function, accessing the atom through the function, in which case the function can do other things as well during that access
22:02rhg135_work_op, oops that's on updates
22:03rhg135_work_op, maybe wrap it in another IDeref
22:03hellofunkbenkay what do you mean? do is synchronous, it fires off its enclosed functions
22:03benkayinstead of in the case of (do) which evaluates the expressions in order?
22:03benkayhellofunk: i guess asynchronously fires off the enclosed functions.
22:03hellofunkwell, look at core.async of course
22:03work_ophellofunk, in the context of a small game, i have a settings file, and what i want is for the atom to use the latest version of that file. so if i have red tiles, and i save the settings file with blue, the tiles would change on each draw
22:03rhg135_like async's go?
22:04rhg135_auto-update "magic" seems wrong here
22:04hellofunkwork_op why would you *need* to incorporate the model you are suggesting where you have an automatic link beween a deref and a function call? seems better to keep those separate, more flexible
22:04benkay"Asynchronously executes the body" >.<
22:04work_opwhat do you mean separate?
22:05benkayand here I was thinking it just turned on the non/blocking takes/puts.
22:05benkaythanks, hellofunk .
22:05rhg135_we all have those 'I'm stupid' moments, benkay
22:05hellofunkbenkay core.async is pretty amazing stuff. watch the various presentation on youtube, play with it
22:05work_opidk if you are familiar with light table's settings architecture, but thats what im trying to implement, hellofunk
22:05rhg135_read lt's code
22:06rhg135_it probably is more concise :P
22:06hellofunkwork_op not sure I don't see why you couldn't just have a function that derefs an atom internally and does other stuff as needed too
22:06benkayhellofunk: i descended into dependency hell trying to require core.async in one of my own namespaces today.
22:06hellofunkwatchers or other complexities don't seem that necessary here
22:07JaoodI wonder if LT would have been design any differently it react had existed then
22:07rhg135_somn like a readd-config! fn wrapping a atom
22:07work_opyeah but the atom itself
22:07rhg135_Jaood, i don't doubt it
22:07rhg135_i long for om in lt plugins
22:09benkayhas anyone else here run into "No such var: clojure.core.cache/through" when requiring clojure.core.async?
22:09rhg135_not really
22:09rhg135_but several others yes
22:10work_opa little macro would do fine for this hellofunk, now that u said that. if i just swap it whenever its needed and then dereference it inside the function it would be fine
22:38benkaywhat's the idiomatic way to pull from a channel until it's closed?
22:38benkayor closed + drained?
22:39benkayah stuartsierra with the hotsauce: http://stuartsierra.com/2013/12/08/parallel-processing-with-core-async
22:43hellofunkwork_op though probably even a macro wouldn't be needed, a regular function will usually work for most things you might think a macro is needed for