#clojure logs

2014-04-22

00:41patrickodI'm trying to use cemerick/friend for the first time to protect a small set of resources, specifically using it's interactive-form workflow
00:43patrickodI have a map of users in the form that friend expects, but when friend/authenticated runs it gives an error: clojure.lang.PersistentVector cannot be cast to java.lang.String
00:43patrickodin the interactive-form-redirect method
00:44patrickods/interactive-form/interactive-login
00:46dbaschpatrickod: can you refheap your code?
00:47patrickodrefheap? new to clojure so unsure what this means.
00:47dbaschhttps://www.refheap.com/
00:49patrickodcool. I'll get that in a second
00:56patrickodhttps://gist.github.com/anonymous/c68214623cb1ae122f1c
00:59dbaschI meant the code, otherwise who knows what’s going on :)
01:01beamsohsa the login-uri been configured as a vector rather than a string?
01:01beamso*has
01:02patrickodlogin-uri is a string.
01:07patrickodhttps://gist.github.com/anonymous/aa3cd2c198200d6e79e9
01:08patrickodadmins-for-login gives back a map of {"username" {:username "username" :password "bcrypted-password"}}
01:11dbaschwhy are you passing (admins-for-login) instead of admins-for-login ?
01:11dbaschnever mind
01:20dbaschI would wrap everything in a handler that prints the requests and responses for debugging
01:38john_sdoes anyone else find the behavior of core.async channel filters counterintuitive? every time i create a filtered channel, it consumes everything up to and including the first item for which the predicate is true.
01:40john_se.g. https://gist.github.com/johnswanson/11166363
01:42john_si guess that is just the way channels work, you can't see if a value passes without pulling it off.
01:43trap_exitwhat's a good profiler for javascript code generated by cljs?
01:59haoleis there an easy way to compare two lists discarding a few items? like:
02:00haoleone list has '(1 1 0 1) and the other '(1 1 1 1)
02:00haoleI want them to be considered the same, as if I could have a wildcard in the = function
02:00haole'(1 1 _ 1)
02:01dbaschhaole: how do you decide what items to discard?
02:01dbaschhaole: or how many?
02:03haoledbasch: that's what I'm trying to figure out... using a format string, maybe, or some other way
02:03luxbockis there any way to get a string value out of a java.io.PrintWriter without first writing it to a file?
02:04beamsoStringWriter?
02:05luxbocksorry I'm not very good with Java, how would I use that?
02:06beamsoactually, it was a bit of a silly suggestion. you don't instantiate the printwriter, correct?
02:06luxbockyeah
02:06luxbockI have a Java class that's meant to be used as a CLI app, so the public method it offers (main), outputs to PrintWriter(System.out) and then exits, and I'd like to use its output without having my program exit
02:07luxbockwhich I guess I could do by using java.sh, but I discovered ironh for Clojure which allows me to call private methods/constructors via reflection
02:07beamsocan you change the java class?
02:08luxbockbut the method I need to call still uses PrintWriter
02:08luxbockhmm, I suppose I could, it's a class file in a .jar
02:08luxbockthat I'm peeking into through a decompiler
02:09luxbockso yeah I think it would be possible but probably not the easiest thing to do
02:09beamsoyou can use system.out to set a printstream
02:10beamsobut that sets it for everything, which may or may not be nasty
02:11luxbockI could just give it a PrintWriter and a temp file that I then read and destroy, since this is just a personal project
02:12beamsoyou can instantiate the printwriter with a bytearrayoutputstream, then call tostring on the bytearrayoutputstream
02:13luxbockah, that sounds great, I'll try it out
02:17dbaschhaole: if you care about the number of equal values but not the position, it’s trivial
02:17dbaschhaole: and if not, it’s still pretty easy
02:17dbasch,(map = [1 2 3 4] [1 2 3 5])
02:17clojurebot(true true true false)
02:18dbaschhaole: you’d need a “mask” list to compare that output
02:18luxbockbeamso: works fine, thanks :)
02:18beamsonot a problem
02:48bitemyappzerokarmaleft: yo
02:48bitemyappnevermind, tracked you down
02:50devnanyone have an example of using map<, map>, etc. in core.async?
02:50devnI can't seem to find anything outside of the docs
02:55danlamannafor some reason my compiled jar (lein uberjar) doesn't recognize command line arguments (using tools.cli) as lein run does.
03:49nonubyif there a way to (easily) test if such namespace exists when doing something like (doseq [plugin plugins] (require (symbol plugin)))? rather than a filenotfoundexception
03:52gunsnonuby: It's not a bad way to do it; you'd have to search the classpath yourself otherwise. Just wrap in a try/catch
04:02dbasch,(all-ns)
04:02clojurebot(#<Namespace clojure.uuid> #<Namespace user> #<Namespace clojure.core> #<Namespace sandbox> #<Namespace clojure.repl> ...)
04:02dbasch,(count (all-ns))
04:02clojurebot9
04:45nonubyis there anyway to emulate http://nodejs.org/api/domain.html when using clojure 1.6/core.async/http-kit rather than explicitly passing the context along
04:51ddellacostanonuby: I'm having a hard time understanding what that does--does it directly map to the url domain?
04:52ddellacostanonuby: if a problem occurs in any given route matching a domain, you can perform the same action, is that it?
04:54nonubyno. essentially it allows you to pass context along a chain of async operations (without explicitly passing it into a callback each time), kind of like a thread-locals that work across multiple threads - so if you have a web request that calls a database that then calls a url you have a the original details of the request (if you stuffed it in a domain on entry)
04:55ddellacostanonuby: huh, and are you using ring in Clojure?
04:56nonubyjust thinking out loud at the moment, but probably not ring as will have a thread hanging about whilst any other dependent async operations complete, http-kit server maybe
04:57ddellacostanonuby: I see, so tell me if this is wrong: you're building something that has asynchronous processing based on a request, but you need to hold onto the original request for various reasons
04:58ddellacostanonuby: ...and get it back at some point during the asynchronous processing thread's lifespan
04:58nonubyddellacosta, very close, i want to hold a map of the original request, because as part of high level error handler and logging middleware (json logging), I want to pluck the request context out as that what makes any errors/warning relevant
05:00ddellacostanonuby: so, is the request going to get handled asynchronously, or do you just want your high-level error handler/logger to be asynchronous? I don't quite follow
05:00AeroNotixring-middleware?
05:01nonubyif using thread per request I would just write (myapi/set-context! { :req ring req }) at the entry point of the request and then shove it into a thread local var, do my database stuff and other IO, and then in the error handler / logging middleware I could do (my-api/get-context) but if I say scrape a URL on a request using http-kit and the exception occur in the http-kit client callback this on a different thread thus get-context would be nil
05:03ddellacostaah, sorry, I thought you were using http-kit server, not client, my mistake
06:13antelocmhi
06:14antelocmI'm looking for help developing Clojure GUIs
06:15antelocmanything like React/Om, but with JavaFX components
06:15clgvantelocm: in swing? do you know "seesaw"?
06:15antelocmany ideas?
06:15clgvoh ok
06:15antelocmbased on FRP, if possible
06:15clgvI think some people started clojure libs for javafx but I dont recall the named.
06:16clgv*names
06:16antelocmyeah, had a look at them
06:16antelocmbut they are not very idiomatic
06:18clgvyou need javafx for legacy reasons or since there are existing components for specialized tasks?
06:20antelocmactually, I'm learning Clojure, so I thought JavaFX is the best for trying a modern UI
06:22antelocmbut I'd like to try FRP too
06:23antelocmand there's clojurescript's Om
06:24antelocmso I'm looking for something Om-like, but with JavaFX components
06:25clgvok. I didnt here of any library trying that combination on the mailing list so far...
06:30locksmaybe start with Om ;P
06:30clgv*hear
06:32antelocmok, will try that, thx ;)
06:33antelocmbye :)
06:36khushildepHey chaps - I’m trying to follow the guide at http://marmalade-repo.org but when I package-list-packages it can’t seem to find the repo? I can browse to it normally...
06:47phillord@khushildep what are you expecting to see? You should just got a longer list of packages
06:48khushildepYeah I did but the it doesn’t seem to want to connec to marmalade
06:50phillorddid you do M-x package-refresh-package
06:51phillordM-x package-refresh-package-contents sorry
06:51phillordwhat does C-hv package-archives show you?
06:58khushildep[No Match]
06:58khushildepI’m sorry I’m an emacs noob - what does C mean?
06:59Bronsakhushildep: ctrl
06:59phillordCtrl
07:00clgvdoes "quil" support scrollbars for drawings that do not fit the screen?
07:00phillordYou can do "help->Describe->Describe Variable" instead if you prefer
07:01khushildeppackage-archives is a variable defined in `package.el'.
07:01khushildepIts value is (("marmalade" . "http://marmalade-repo.org/packages/&quot;)
07:01khushildep ("gnu" . "http://elpa.gnu.org/packages/&quot;))
07:03phillordOkay, now Options->Manage Emacs Packages
07:03phillorddo you see a list of packages?
07:04phillordif so, then Package -> refresh package list
07:05phillordIf you see things like "abl-mode, ac-geiser, ac-slime" then you have added marmalade and it's all working!
07:06phillordIf it's not all working then you should have got a crash somewhere!
07:06nbeloglazovclgv: no, it doesn't
07:07khushildephow would I debug that crash?
07:09clgvnbeloglazov: :(
07:16phillordwell, you need to describe it
07:16phillorddo you have any thing inyour *messages* buffer -- that normally helps
07:17nbeloglazovclgv: you can implement your own "scrolling" by dragging mouse using translate function, I think.
07:18clojurenoobhey guys, I'm using assoc to add a value from one map to another map... when I do so, my keys/values lose their double quotes and I get 'Map literal must contain an even number of forms Util.java:221... any ideas ?
07:19AimHereclojurebot, you got a minimal code example exhibiting the bug?
07:19clojurebotTitim gan éirí ort.
07:20AimHeresorry, clojurenoob I mean
07:20AimHereclojurenoob, Also, merge-with is a handy function for these kinds of problems
07:20clojurenoobAimHere: I will put something together and lookup your suggestion thx
07:20AimHere,(merge-with + {:a 3 :b 4} {:a 10 :c 15})
07:20clojurebot{:c 15, :b 4, :a 13}
07:22clgvnbeloglazov: sure, but thats a lot of overhead to manage viewports myself. I wouldnt reimplement it in swing neither ;)
07:22clojurenoobcompletely different topic.. how do I add an item to the end of a list ? (it needs to be a list in this case)
07:24AimHereThing about lists is that adding things to the end is not optimal. You could put it in a list and use concat
07:25clojurenooboh right... so add either a list or vector using concat
07:26AimHereYeah. If you're appending to the wrong end of a list a lot, then reconsider the data structures you're using
07:26clojurenoobAimHere: thanks, I've got to use list in this case as its a kind of code generation thing
07:32clgvclojurenoob: you can use a vector to create the code and call `seq` on it afterwards
07:32clgv,(defmacro foo [] (seq [inc 1]))
07:32clojurebot#'sandbox/foo
07:32clgv,(foo)
07:32clojurebot#<ExceptionInInitializerError java.lang.ExceptionInInitializerError>
07:32clgvdamn bot. worked overhere...
07:33clojurenoobclgv: thanks, that may solve both problems will try it... was doing some code generation using '() etc all pver the place
07:33gfredericks,foo
07:33clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'sandbox/foo, compiling:(NO_SOURCE_PATH:0:0)>
07:33gfredericks,(foo)
07:33clojurebot#<ExceptionInInitializerError java.lang.ExceptionInInitializerError>
07:34gfredericks,(defmacro bar [] (seq '[bar 1]))
07:34clojurebot#'sandbox/bar
07:34gfredericks,(bar)
07:34clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox/bar>
07:34gfredericks,(doc bar)
07:34clojurebot"([]); "
07:34gfredericksoh of course
07:34gfredericks,(defmacro bar [] (seq '[inc 1]))
07:34clojurebot#'sandbox/bar
07:34gfredericks,(bar)
07:34clojurebot2
07:35gfredericksclgv: you were emitting a function instead of a symbol
07:35gfredericksthat usually works though
07:36clgvgfredericks: oh right sorry ^^
07:37clgv,(list? (seq []))
07:37clojurebotfalse
07:37clgv,(list? (seq ['inc]))
07:37clojurebotfalse
07:39clojurenoobhmmm. its nicer now I'm using vectors and 'seq' at the end... but keys/values I pull out of maps are still losing the quotes ... unsure why
07:41clgvclojurenoob: provide a small example on refheap.com
07:41clojurenoobclgv: ok thanks I will try to make one
07:51clojurenoobclgv: weird... finding it hard to re-create when working in REPL with data I specify manually... but using the output of prior calculations in my program I am getting this problem...
07:51clojurenoobperhaps I am assuming the type of the output incorrectly... should be a sequence of maps
07:53clojurenoobhmmm... its a LazySeq I am mapping over
08:00Pate_waht is the difference between doall, dorun and doseq?
08:02clgvPate_: the first two are very similar. doall forces evaluation on the lazy seq and returns that evaluated seq. dorun is intended for sideeffects since it foreces the lazy seq but does not return the seq havin the advantage that it does not keep a reference to the head of the sequence.
08:02clgvPate_: "doseq" is "for" for side-effects
08:04Pate_thanks. I'm finishing up Google Code Jam 2014 and I'm using "doall" to ->> solutions (map println) to write to stdout, otherwise I don't get output. Should I be using doseq instead so I don't hold on to the seq?
08:05Pate_hmm no, looks like I should be using dorun.
08:06clgvPate_: yes for minimal changes to your current impl you should use dorun. but usually it's more idiomatic to use doseq here
08:06clgvPate_: (doseq [sol solutions] (println sol))
08:06Pate_excellent
08:06clgvPate_: or (doseq [sol (->> what ever you need to do to create solutions)] (println sol))
08:07Pate_thx, clgv.
08:07clgvnp
08:07Pate_parsing stdin with clojure took me a long time to get right in clojure
08:08clgvPate_: are you doing the practice problems as preparation?
08:09Pate_yeah. was travelling during qualification round, so didn't get a chance to compete.
08:09Pate_busy with minesweeper problem (C) now
08:09Pate_will put on GitHub when done and paste link here for those interested
08:10clgvyou got a link to that problem?
08:22sm0kehmm weird om doesnt seem to work on ubuntu in chrome
08:22sm0kethis binary clock demo at least does not work
08:22sm0kehttp://www.lexicallyscoped.com/demo/binclock/
08:27Pate_clgv, https://code.google.com/codejam/contest/2974486/dashboard#s=p2
08:44certaintyhello everyone. I don't know much about Java but apparently I need to use a library that is in org.apache.commons.net. What does a dependency declaration for that look like in project.clj? How do I generally know what it looks like?
08:45beamsoadd [commons-net "3.3"] to your list of dependencies
08:46certaintybeamso: thanks. How do I know that?
08:46beamsoto quickly test it, use lein deps to download it
08:46beamsoedit the project.clj
08:46certaintyyepp i just did :)
08:47beamsoso it worked?
08:47certaintyat least it downloaded the dependencies. I'm currently trying it out at the repl.
08:48certaintyalright, I can (import) the class I need. Thanks again :)
08:49turbopapeI worked w java from clojure. Quite straight forward, but you have to master the different interop forms, etc....
08:49turbopapebut one you get it, it is rewarding:)
08:50turbopapeAnd setting a polyglot project with lein is quite easy too, you specify a java-source path and you can write your own java classes, quite cool !
08:52certaintyturbopape: i try to avoid java as i don't know it well. At some point however it seems as if i will have to learn some more
08:53turbopapeActually I try to avoid it too certainty, but sometimes, you unfortunately must use some libraries...
08:53turbopapefor me, I wrote a couple simple binary file writers/readers, just for the sake of speed...
08:54turbopapeI'm not even sure that it makes sens with 1.6 using java.nio ?
08:54certaintyhmm, if i only knew how to convert an ipaddress from dotted quad string representation to a long value in java
08:55certaintythen I could ditch the dependency which would be great :)
08:56turbopapeWell certainty, If there's already one efficient java class to do it, why bothering ?
08:56certaintybecause of the dependencies :)
08:56DerGuteMoritzcertainty: see #chicken :-)
08:56turbopapeI understand, but time to deliver outweight the deps right ?
08:57turbopapebesides, lein manages this for you , for free !
08:57turbopapeah by the way, I didn't do any java before :)
08:57turbopapeI did it thanks to Clojure (strangely enough) ...
10:09octeis it possible to get a reference to the constructor of a class as a function?
10:09octeto be able to do for example (apply Date. 1234)
10:11octeapparently not
10:11clgvPate_: nice problem. I heard that some variant of minesweeper is NP-hard but I am not 100% sure it is that one ;)
10:12clgvocte: wrap it in a function
10:12octeyes
10:12clgvocte: you could also have a function that returns such a constructor wrapper function via reflection
10:12Pate_I did not understand the problem at first (that the recursive revalation stops at a cell when it neighbours a mine), but finally realized it after careful reading.
10:13octei wanted to make a function that could call a constructor of a class with any number of arguments
10:13octebut that seems to require reflection
10:14Pate_when you think of some examples that work or not, it is easy to see that the solution must consist of overlaid rectangles of clear areas that are at least 2 high and 2 wide.
10:14jwmare there any mutable data libraries?
10:15jwmI find it hard working with maps/vectors
10:15octethough clojure should be doing this internally somewhere?
10:15octefinding the correct constructor to call
10:15jwmseriously miss = sometimes
10:15octebased upon the type of parameters
10:15jwmhehe
10:16clgvocte: yes it is using reflection to determine that
10:17clgvocte: if it can not determine the matching constructor and you enabled relection warnings you'll get a warning
10:17jwmcan you pass two alters to one dosync?
10:17jwmI thought dosync implies (do)
10:17octeclgv, is there any way to reuse that logic in my code?
10:18clgvocte: not without implementing several functions/macros to do that.
10:18clgvocte: what exactly is you use case?
10:19octeclgv, in the same class i'm juggling 4 different date-classes (ugh)
10:20octeso i wanted to make cvonvience functions for creating instances of them
10:21octebut if it's that painful i'll just do this instead:
10:21octehttp://pastebin.com/npz74GMN
10:21octefor each class
10:21octeunless you can alias java imports?
10:22octebecause the issue is having to write (net.fortuna.ical4j.model.Date.) due to namespace collisions
10:22clgvyou cant
10:22octethen i'll settle for the simple solution i pasted :)
10:22clgvbut you could write a macro to generate the functions so that you only need a macro call per class
10:23llasramYou might also find symbol-macrolet useful https://github.com/clojure/tools.macro
10:23clgvocte: you then need that form: (new the-class param1 param2 ...)
10:23llasramNB that the example in the project README is pretty weird -- it shows of specially handling of special forms, not what symbol-macrolet generally does
10:24llasrams,shows of,shows off,
10:25octehmm, thanks :)
10:27gfredericksis there really not a core.async function to create a lazy seq over a channel?
10:27clgvnbeloglazov: ping
10:27nbeloglazovclgv: pong
10:28clgvnbeloglazov: is there an easy way in quil to get an image of a sketch that I can use as return value of a ring request?
10:28clgvsome imagestream or similar
10:28mdrogalisgfredericks: I think the problem with that is that you'd have to know the entirety of the contents of the channel.
10:28mdrogalisThere's not much a built-in concept of "end".
10:29gfredericksmdrogalis: what? the channel closes and it's done
10:29gfredericksonce you get nil
10:29gfredericks(defn ch->lazy-seq [ch] (lazy-seq (when-let [x (a/<!! ch)] (cons x (ch->lazy-seq ch)))))
10:29hlshipYes, but it implies that the code reading the channel wants to block while the values are pushed into the channel.
10:30mdrogalisgfredericks: Yeah, I guess what I mean is, without closing it, you don't get that kind of behavior
10:30gfrederickshlship: yes, that's exactly what I want to use it for
10:30mdrogalisgfredericks: Nevermind, I thought you wanted a different use case.
10:30nbeloglazovclgv: not directly, but you can save image to a file via (save "myFile.png") function and then read it. Clunky, but should work.
10:31clgvnbeloglazov: thanks. not optimal. :/
10:31clgvgotta checkout the processing api
10:31nbeloglazovclgv: also you can get pixel array and turn it to an image, I suppose
10:37kralnamaste
10:41mmitchelli'm working on a clojure web app, currently running "lein ring" in dev. Anyone know how I can get access to the :servlet-request key?
10:42mmitchellI've seen references to this key, but my request maps don't have it
10:59nonubyhttps://github.com/ptaoussanis/timbre/blob/master/src/taoensso/timbre.clj#L14 can someone explain why (filter identity xs) is necessary, wouldn't filter just return a lazy seq too, so what difference does it make vs just xs?
11:01llasramnonuby: Returns a new sequence containing only the truthy values from `xs`
11:02gfredericksnonuby: you might have been confusing that expr with (filter (constantly true) xs)?
11:07nonubyah okay that makes sense..
11:09nonubyhttps://github.com/ptaoussanis/timbre/blob/master/src/taoensso/timbre.clj#L250 okay what about this.. this goes on to a future but yet the thread blocks @p? until the value is delivered, what would be reason for taking this approach?
11:09nonubyahhh wait the comment is referring to the lookup not the future, so self documenting.. duh
11:28jwm(doall (remove)) is still returning a lazy seq is that normal>
11:29bbloomjwm: the type won't change, it will simply be cached internally
11:29jwmohh ok
11:30jwmso I can't test on the type for nil.. just the content
11:38FrozenlockIs it just me, or cider-nrepl is broken? (No more autocomplete or eldoc)
11:43hlprmnkyI’ve seen that on one project recently, but I assumed I had just done something wrong
11:43mikerodFrozenlock: it may have something to do with your mode hooks
11:44mikerodI originally had some `add-hook` specified on `cider-mode-hook`
11:44mikerodit seems that something here has changed, and you need to use `cider-repl-mode-hook` now
11:44mikerodif this is a problem you are seeing with autocomplete/eldoc not working in the Cider REPL
11:45mikerodI'm not sure Frozenlock is still in the IRC :P
11:45FrozenlockI'm back
11:45FrozenlockI needed to restart to remove Cider and go back to nrepl :-p
11:45mikerodFrozenlock: did you see my response?
11:45FrozenlockNo :-(
11:45mikerod:D
11:45clgvwhat is the easiest way to use a private java method of an object in clojure?
11:46mikerodFrozenlock: it may have something to do with your mode hooks
11:46mikerod I originally had some `add-hook` specified on `cider-mode-hook`
11:46mikerodit seems that something here has changed, and you need to use `cider-repl-mode-hook` now
11:46mikerodif this is a problem you are seeing with autocomplete/eldoc not working in the Cider REPL
11:46mikerodjust a guess though
11:46FrozenlockHmm.... I do have (add-hook 'cider-mode-hook 'cider-turn-on-eldoc-mode) in my .emacs
11:46FrozenlockI'll leave a note
11:47mikerodFrozenlock: yes, that's likely the culprit
11:47mikerodI think Cider changed that var name
11:48mikerodIn Emacs : `C-h v cider-mode-hook` doesn't seem to have it defined somewhere
11:48mikerod`C-h v cider-repl-mode-hook`is however
11:49FrozenlockThanks, I wrote it in my .emacs
11:49nbeloglazovclgv: I think it's not different from java way - get class, get method from the class object, set accessible to true and then invoke it.
11:50clgvnbeloglazov: yeah, I remember a particular succinct code snippet being posted either here or on the ML
11:57jwmis (dosync (somefunneedssynch) (doall (for [] (somefunneedssynch) ))) acceptable?
11:58jwmI want the first somefunneedsynch not to be executed in the for loop
11:59dvasquezIs there any magic to getting tools.logging going? I've got a log4j.properties in classpath 'src/' with a ConsoleAppender but I don't get anything...
11:59clojurebotNo entiendo
12:13Frozenlock'Warning: specified :main without including it in :aot.'
12:13FrozenlockMay I ask what it means?
12:13Frozenlock(what are the implications?)
12:13technomancyFrozenlock: you should either add the namespace to :aot or add ^:skip-aot
12:14technomancyfuture versions of lein won't aot :main automatically
12:14FrozenlockDo I need aot for uberjar to work?
12:15jcromartiewhat's the best way to get route URLs for my Compojure application?
12:15jcromartiethere's nothing like Rails' url_for
12:15jcromartieI guess I need to get the base URL from the request
12:15jcromartieand I could have controllers
12:15technomancyFrozenlock: no, but it can be more convenient
12:15jcromartiethat are just structures with child routes
12:16technomancyFrozenlock: I would recommend never putting :aot outside the :uberjar profile if that's all you need it for
12:16Bronsais it just me or does the sonatype web UI not load?
12:17Frozenlocktechnomancy: Ok. Is there a quick summary of what the AOT does? like 'makes things faster'?
12:18technomancyFrozenlock: the main thing AOT does is cause difficult-to-debug problems during development, but it also improves boot time and allows you to generate a named java class
12:18technomancythe latter of which is required for `java -jar ...`
12:19technomancyrule of thumb: never AOT during development if you can avoid it, only do it during release.
12:19Frozenlockgotcha
12:22arrdemtechnomancy: lein clean && lein test
12:22technomancy=(
12:29coventrygfredericks: Have you gone any further with your schema -> test.check generator since https://gist.github.com/fredericksgary/9787803 ?
12:30gfrederickscoventry: somebody started a proper project out of it at clojure/west
12:31gfrederickscoventry: https://github.com/MichaelBlume/schema-gen
12:32coventryCool, thanks.
12:34jcromartiethe solution is always JFDI (at least at first)
12:44devnis there a good (closer to comprehensive) set of documentation for core.async?
12:52bbloomdevn: the core.async.clj is 90% doc strings... what exactly are you looking for?
13:14gfredericksdocumentation doesn't count unless it's a website with its own domain name and lots of CSS
13:15arrdemfalse....
13:15jwmI just want examples
13:15jwmthat is all I want from "docs"
13:15jwmthen I can live with docs on just the api printed from the code
13:16jwmheck clojure is the first system I actually have gone to the code to see how something is done
13:16llasramgfredericks: ha!
13:16jwmseriously
13:16gfrederickshyPiRion: aren't all clojure's data structure classes final and thus unextendable?
13:16hyPiRiongfredericks: what no
13:16justin_smithjustinholguin: I am using clj-rss, what are the chances you guys would accept a patch so that I could give a proper atom namespace in the feed? http://validator.w3.org/feed/docs/warning/MissingAtomSelfLink.html
13:17hyPiRiongfredericks: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentVector.java#L20 do you see a final there? :(
13:17justin_smith(plus the atom:link in the channel section)
13:17hyPiRionIt should be
13:18gfrederickshyPiRion: every dang other clojure class is final
13:18gfrederickshyPiRion: in any case a check for (= (class ob) ...) should work right?
13:20hyPiRiongfredericks: I'd use identical? actually, but yes. Just wanted to indirectly warn them to not do `instance?`
13:20hyPiRionBecause that was my first thought
13:21gfredericksrighto
13:27coventryjwm: Have you seen https://github.com/clojure/core.async/blob/master/examples/walkthrough.clj ?
13:31hiredmanKeyword dropped the final at some point
13:31hiredmanfor unknown reasons
13:34pjstadighiredman: really? huh
13:37pjstadigoh right that was a while ago
13:41llasramOooh -- now you can make keywords which are also maps, which when called as a 0-argument function look themselves up in themselves
13:42hyPiRionyou can also make persistent vectors containing themslves
13:42justin_smithweirdness
13:43arrdemmadness...
13:45llasramhyPiRion: Was that? -- ##(doto [0] (as-> x (-> x .-tail (aset 0 x))))
13:45lazybotjava.lang.RuntimeException: Unable to resolve symbol: as-> in this context
13:45llasramHa!
13:45llasram,(doto [0] (as-> x (-> x .-tail (aset 0 x))))
13:45clojurebot[[[[[[[[[[#]]]]]]]]]]
13:45llasramThe we go
13:45hyPiRionllasram: yeah
13:45llasram~botsnack
13:45clojurebotthanks; that was delicious. (nom nom nom)
13:46arrdemwat
13:46llasramarrdem: Vectors are mutable. But it's a secret! -- don't tell anyone
13:47hyPiRionWell actually, it's just that java arrays cannot be immutable
13:47arrdemhttp://arrdem.com/i/maddog.gif
13:47arrdemdang
13:47hyPiRionarrdem: that 404s
13:47gfredericksarrdem: that 404s
13:47arrdemhyPiRion: yeah. I forgot the trailing e.
13:47arrdemhttp://arrdem.com/i/maddoge.gif
13:48gfredericksarrdem: I assumed it must be about http://en.wikipedia.org/wiki/Jon_Hall_%28programmer%29
13:48arrdemgfredericks: haha
13:48bbloomsummary: rich hickey does not believe in encapsulation... at all
13:48bbloom~encapsulation
13:48clojurebotI don't understand.
13:49llasramExactly
13:49hyPiRionhaha
13:49bbloomclojurebot: encapsulation is "Doctor it hurts when I do this."
13:49clojurebotIk begrijp
13:49shdwprinceHi there! Can't remember how properly drop nth element from sequence, can you help me?
13:49bbloom~encapsulation
13:49clojurebotencapsulation is "Doctor it hurts when I do this."
13:49arrdem~cheatsheet
13:50llasramA friend of mine recently confessed that he is "skeptical of the JVM." I assured him that it exists
13:50gfredericksbbloom: does that phrase simply mean "encapsulation is bad" or something more specific?
13:50gfredericksllasram: what does "exists" mean wrt software?
13:50shdwprincesearched for drop or remove, but found nothing about that
13:50bbloomgfredericks: it means that if you depend on internals or violate public contracts, that's your own damn fault
13:51llasramgfredericks: Just a play on multiple meanings of being "skeptical of" something, intended to parallel different meanings of "believing in" something
13:51gfredericksllasram: right, I just thought the idea of a configuration bits "existing" was a bit amusing
13:51gfrederickss/bits/of bits/
13:51llasramOh, fair enough :-)
13:51agarmandata encapsulation is pointless when you're working with data structures that are immutable
13:51shdwprinceI mean I can (concat (take ..) (take-last ..)) but it seems that there is a better way
13:52shdwprinceIs it?
13:52gfredericksbbloom: clojure isn't exactly known for having a well defined separation between public contracts and internals
13:52bbloomagarman: not entirely pointless, just of such low utility that it does more harm than good
13:52hyPiRionshdwprince: There's nothing existing in the core library, but you could implement a drop-nth function yourself. Give me a sec
13:52llasramDo all finite sequences bits "exist" in the sense that they are all equally possible?
13:52llasramA question to ponder
13:52bbloomgfredericks: sure it does. if lots of ppl depend on it, rich probably won't change it :-P
13:53bbloomgfredericks: hurray defacto definitions!
13:53arrdembbloom: plz can has spec thnxbai
13:53arrdemANSI Clojure 1.0.0...
13:53bbloomarrdem: here you go: github.com/clojure/clojure
13:54gfredericksbbloom: "lots"
13:54agarmanthe only benefit of encapsulating immutable data is to simplify a consumers world view
13:54hiredmanbbloom: I assume final classes assist the jit though, but maybe that is wrong
13:55hyPiRionshdwprince: https://www.refheap.com/78796 -- I think that's roughly it
13:55AimHereIsn't 'simplifying a world view' pretty much what all high level computer languages are designed to do. Also low level ones.
13:55bbloomhiredman: final members & locals, *definitely*... classes? i dunno...
13:55shdwprincehyPiRion: thanks, I got it. Its sad, becose I dont like implementing basic functions, I mean, yeah, you can implement it, but after you need to require it all the times. But for that cause, it seems, there is no better way
13:55hiredmanbbloom: seems like they would simplify the class hierarchy analysis
13:55agarmanthere are better ways to simplify...
13:56bbloomhiredman: but you've either got some *object* of exactly type T or some virtual hierarchy rooted at T
13:56hyPiRionshdwprince: In many cases, those functions aren't there because they are very inefficient. In many cases, it's sort-of a hint that one should consider structuring the data in a different way
13:56bbloomhiredman: i'd imagine in 99% of the cases you've got a final class, then it's usages are either through an interface or directly concrete
13:56hiredmanbbloom: actually cliff click has a series of blog posts about trying to optimize final memembers, and it being a pain because no one repects final fields
13:56hyPiRionOh dang, started both sentences with "In many cases".
13:57bbloomhiredman: you mean ppl use reflection to change final fields?
13:57hiredmanbbloom: I forget the details, it may have been stuff like that
13:58hiredmanhttp://www.azulsystems.com/blog/cliff/2011-10-17-writing-to-final-fields-via-reflection http://www.azulsystems.com/blog/cliff/2011-10-27-final-fields-part-2
13:58clojurebotNo entiendo
13:58bbloomhiredman: heh, generated byte codes
13:59bbloomprogrammers can't be trusted not to hurt themselves...
13:59llasramI thought part of the effect of `final` was that the JVM was free to optimize away accesses to `final` fields
13:59gtrakllasram: think serialization libs
14:00hiredmanyou would have hoped
14:00gtraksun.misc.unsafe can create objects without calling constructors
14:00tbaldridgefinal is pretty much useless these days IIRC
14:00bbloomconstructors are kinda a bogus idea to begin with
14:00gtrakthis is a really good article though: http://www.azulsystems.com/blog/cliff/2011-10-17-writing-to-final-fields-via-reflection
14:00llasramugh
14:01tbaldridgefinal is removed or added by the JIT as needed
14:01dbaschugh, commented code in a source. https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentVector.java#L348
14:01gfredericksclojure has a lot of commented code
14:02hyPiRiondbasch: you must be new to clojure.core
14:02bbloomdbasch: scroll down to the static public void main :-P
14:02dbaschand worse: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentVector.java#L723
14:03arrdemwell at least we _have_ a benchmark in there somewhere...
14:03tbaldridgeI found it interesting to find out that most of the people that hack on Clojure's guts use IDEs and just ignore most of that stuff.
14:03tbaldridgeif you have a sorted method list, do large comment blocks matter?
14:03dbaschbbloom: yes, that’s the second link
14:04arrdemtbaldridge: neither does our uniquely inconsistent whitespace convention...
14:09gfredericks,(defmethod print-method :user/foo [x pw] (print-method "FOO" pw))
14:09clojurebot#<MultiFn clojure.lang.MultiFn@554210>
14:09gfredericks,(alter-meta! #'first assoc :type :user/foo)
14:09clojurebot{:added "1.0", :ns #<Namespace clojure.core>, :name first, :file "clojure/core.clj", :static true, ...}
14:09gfredericks#'first
14:09gfredericks,#'first
14:09clojurebot"FOO"
14:10gfredericksdoes anybody think the multimethod + clojure.core/type mechanism for customization of print-method etc. is regretable?
14:11gfredericksI ask because I think it's cool but never see anybody use this mechanism for anything else ever
14:11arrdemit's kinda hard to have meaningful domain specific prints...
14:11tbaldridgegfredericks: I think it simply predates protocols
14:12gfrederickstbaldridge: it's a lot more flexible than protocols though since I can change individual objects that are IMeta
14:13gfredericksarrdem: I think it's cool for interactive development to e.g. have atoms that print interesting stuff
14:13bbloomgfredericks: i prefer multimethods over protocols for every reason except perf & "markers"
14:13hiredmanit might have been better to dispatch on :print/type, but I dunno, it rarely if ever gets used, so it is hard to regret
14:13tbaldridgegfredericks: interesting, I didn't know that about type....
14:14technomancygfredericks: it may not surprise you to find that I think it's cool
14:14gfrederickstechnomancy: It's almost surprising how surprised I'm not
14:14gfredericksbbloom: markers?
14:14tbaldridgebut yes, I find it odd that print-method isn't a protocol. It should be IMO.
14:14bbloomgfredericks: for use with satisfies?
14:14gfredericksbbloom: oh gotcha
14:15gfrederickshiredman: that makes me think a 2-arg version of clojure.core/type would be useful
14:15gfredericks(type :print/type obj)
14:16gfredericksyeah I think the whole multimethod + metadata + custom-hierarchies feature set is one of the most interesting ones that never gets used
14:16AeroNotixHow about this for a feature? https://gist.github.com/AeroNotix/dcb26df5e85eb6c1ec40
14:17AeroNotixkind of like Erlang's when guards
14:17gfredericksAeroNotix: predicate dispatch is the term you want I think
14:17gfredericksbbloom probably thinks something about that
14:17tbaldridgebbloom: things things about a lot of things
14:17tbaldridge*thinks things
14:18llasramHe also thinks thinks about a lot of thinks
14:18gfredericksclojurebot: bbloom |thought| a thunk once
14:18clojurebotIn Ordnung
14:18bbloompredicate dispatch is tricky b/c it's potentially ambiguous
14:18gfredericksbbloom: that's open predicate dispatch in particular, right? where ordering is ambiguous?
14:19bbloomgfredericks: right
14:19bbloomgfredericks: but what good is closed predicate dispatch? booo
14:19bbloommight as well just fucking use cond at that point :-P
14:19gfredericksClosed Predicate Dispatch: at least it exists
14:19AeroNotixtake a look at this: https://gist.github.com/AeroNotix/e4b0f4382397e518fcb1
14:19AeroNotixthe alternative is a lot more verbose
14:20bbloomerlang's when guards (and haskell's views, scala's extractors, and a few other things)
14:20AeroNotixusing predicates seems more declarative
14:20bbloom... are interesting
14:20bbloomBUT they operate in the context of ordered choice
14:20bbloomeven when closed, ordered choice is a bitch b/c it means that you have implicit dependencies between clauses that are not explicit
14:21gfredericksbbloom: let's just use ratios on every clause to indicate order
14:21gfredericksthat way you can always wedge one thing between another two
14:21AeroNotixbbloom: Erlang helps this by allowing only a specific set of guard functions
14:21technomancybbloom: I get what you're saying, but it's a terrible reason to leave pattern matching out of a language
14:21technomancyit's like ... cond also has this problem
14:21technomancyand yet somehow we survive
14:21bbloomtechnomancy: yeah, i'm not opposed to pattern matching. i'm opposed to ordered choice encoded in to the pattern matcher
14:22bbloomtake a look at mathematica for another interesting compromise
14:22AeroNotixbbloom: what's the alternative
14:22gfrederickstechnomancy: most of my production bugs are due to me running my cond-shuffling code transformation script accidentally
14:22bbloommathematica has open predicate dispatch with pattern matching
14:22tbaldridgesomething dnolen mentioned years ago was that if something like core.match ever made it in as a "language feature" it would need to be order agnostic and extensible.
14:22AeroNotixgfredericks: you really have a script which does that?
14:22gfredericksAeroNotix: not at all
14:22bbloomit *falls back to* ordered choice when it can't automatically determine predicate implication
14:22gfredericksAeroNotix: at least I hope I don't
14:22tbaldridgecore.match is order agnostic, IIRC. but not extensible.
14:23bbloomtechnomancy: it's neither of those things
14:23hiredmanbefore I learned about unification I was using this system based on hierarchies to try and encode clojure's Numbers.java as a set of rules about types, but then I jsut rewrote it using core.logic
14:23bbloomtechnomancy: core.match tightly couples the optimizer to ordered choice
14:23technomancyit sucks to not have access to awesome stuff because something theoretically more awesome could exist
14:23AeroNotix"Worse is better"
14:23hiredmantechnomancy: but you have access, right?
14:24gfrederickstechnomancy: access is different from enshrining in core.clj
14:24technomancyhiredman: not really. I can't include core.match in lein, which is the only clojure I write. back when I wrote clojure daily, core.match wasn't suitable for use.
14:25technomancyhiredman: but FSVO "you", then yes =)
14:25tbaldridgetechnomancy: why can't you include it in lein?
14:25gfredericksclojurebot: core.match is a pattern-matching library available for use by anybody but technomancy
14:25clojurebotRoger.
14:25tbaldridgerofl
14:26technomancytbaldridge: it would mean no one could use a newer version in any lein plugins
14:26hiredmanthere was a website where you could have it generate a license "this project is usable by anyone but <named party>"
14:26technomancythis has been a problem with several other libs; just ask Bronsa
14:26bbloomtechnomancy: surely you need OSGI
14:27hyPiRionhiredman: https://github.com/landondyer/kasm/blob/master/LICENSE
14:27tbaldridgeactually, someone just needs to invent a decent plugin system for Clojure.
14:27gfrederickswe should start using lib-cloning utilities until somebody solves dependency management
14:27technomancybbloom: I was actually considering the idea of a compile-only dependency that could disappear at runtime
14:27bbloomtechnomancy: i'm actually thinking about exactly that right now
14:27arrdemI'm with TB here... a real plugin system for Clojure would be awesome
14:27bbloomtechnomancy: trying to bootstrap eclj.core
14:27bbloomtechnomancy: i want to be able to define clojure constructs in terms of clojrue constructs, but re-defing vars is a bitch b/c it affects old defintions
14:28hyPiRiongfredericks: one which allows multiple versions of dependencies to live side by side I guess?
14:28arrdemhyPiRion: that's great
14:28bbloomtechnomancy: since i own both the evaluator and the first-class environment implementation, i'm considering creating a virtualized namespace w/ static vars
14:28technomancyhaving namespaces more first-class would help, but without being able to re-root java classes it feels like a lost cause
14:28hyPiRionarrdem: yeah, I love it
14:28gfrederickshyPiRion: I guess I would have thought of that as a general dependency goal
14:29bbloomtechnomancy: might be doable to re-root deftype and friends, but not java code directly
14:29gfrederickstechnomancy: to use core.match you have to first write a jvm in clojure
14:29justin_smithgfredericks: the difference between a plugin vs. a normal lib, to me, is that it is more modular (can live alongside multiple versions of itself) and its point of interface with the rest of what you build is very narrow and well defined
14:29tbaldridgeI'd be tempted to try the Erlang model. You don't couple dependencies, you spin up a JVM and communicate via sockets and pipes.
14:29hiredmantbaldridge: too slow
14:30justin_smithso any feature it would provide would be returned from its initialization function, and the consumer could decide where and how to bind that functionality / those definitions
14:30technomancyrelative require would be cool
14:30shdwprinceIs there is something like (apply -> argument forms) ?
14:30tbaldridgehiredman: start up time or general performance?
14:30hiredmantbaldridge: having lein spin up two jvms is already slow
14:30arrdemtechnomancy: what.. (:require ..foo)?
14:30tbaldridgehiredman: well that's the problem, it starts them then kills them
14:30gfredericksI've been trying to figure out how to get around the problem of protocols/multimethods having global customization scope
14:30gfredericksand something like that would fix it I think
14:30technomancyarrdem: sure, and ./foo
14:30tbaldridgehiredman: cljsbuild auto is a great example of what plugins should begin to look like, imo.
14:31hiredmantbaldridge: cljsbuild is kind of terrible in my, admittedly, limited experience with it
14:32arrdemtbaldridge: oh while you're here. I note that two lean clojure projects were accepted by GSoC. Is there a coordination plan?
14:32tbaldridgearrdem: IIRC the plan was that one will handle Rich's views on lean runtimes, while the other (your's I think) will hit the "full program optimization" route
14:33hiredmangfredericks: https://twitter.com/richhickey/status/249560631164932096
14:33arrdemtbaldridge: =D
14:33ToxicFrog"lean runtimes"?
14:33hyPiRionToxicFrog: faster startup
14:34ToxicFrogyesssssssss
14:34hyPiRionthat's what I alias it to
14:34tbaldridgeToxicFrog: basically advanced compilation for CLJ on the JVM
14:34ToxicFrogstartup time is my #2 complaint about clojure
14:34ToxicFrogAnd the reason I basically only use it for daemons
14:34shdwprinceToxicFrog: and the first?
14:35ToxicFrog(well, daemons or programs where IO will dominate the runtime so severely that no-one will care if it takes a while to start up)
14:35ToxicFrogshdwprince: error reporting
14:35ToxicFrogParticularly, in the compiler.
14:35AeroNotixoh yes
14:35AeroNotixutterlly incomprehensible
14:35gfrederickshiredman: this is a classic example of a statement that presumably contains a value judgment but I can't for the life of me figure out what it is
14:35gfredericksnor can I figure out if it was intended to be obvious or not
14:36hiredmanwhich statement?
14:36gfrederickshiredman: the toot you linked to
14:36hiredmangfredericks: well, multimethods are "global" to a clojure runtime, so if you want multiple runtimes...
14:37gfrederickshiredman: how easy do you think it would be to load a separate copy of cheshire with a classloader?
14:37hiredmangfredericks: the tricky part is communicating across classloader boundaries
14:37arrdemoooh boy guile+emacs got accepted to GSoC
14:38gfrederickshiredman: there'd be different instances of the RT class etc? or just the cheshire namespace objects and var objects?
14:38technomancyarrdem: they were accepted last year iirc
14:38hiredmanat one point I had clojurebot loading clojure 1.2 in an insolated classloader to run fnparse, before I said screw it and spawed it out as a different process
14:39bbloomhyPiRion: i'm a bit late (opened the tab & got distracted) but ROFL @ the ABRMS license
14:39hiredmangfredericks: you really need everything to be isolated
14:39arrdemhiredman: you haven't upgraded to instaparse?!
14:39bbloomhyPiRion: that's fucking hilarious
14:39gfrederickshiredman: I'll call it impossible then
14:39llasramhiredman, gfredericks: I don't know if it does it the best way, but Alembic loads a Leiningen in a separate classloader and communicates with it
14:39gfredericksI wouldn't want to be cloning objects or anything wasteful like that
14:40llasramAh
14:40ToxicFrogAeroNotix: once you get used to them, they aren't completely incomprehensible -- well, usually -- but that still does not excuse them.
14:40ToxicFrogThe actual error is buried somewhere in the middle of the multiple pages of compiler stack trace vomit.
14:40AeroNotixI've been working with them for a while.
14:40AeroNotixI know what to look for
14:40hiredmanwell, that is just a trade off of isolation
14:40llasramgfredericks: I'm not really sure how you'd avoid that, since they'd have distinct implementations of all the core classes
14:40AeroNotixI guess I meant: "Incomprehensible to the beginner"
14:41hiredmansimilar to sharing things between erlang processes
14:41gfredericksllasram: right, that's why I'm giving up
14:41bbloomllasram: gfredericks: need to have common interfaces at some point to communicate between class loader domains
14:41bbloomit's basically impossible to modularize code from the outside
14:42gfredericksI'm just gonna fork cheshire & others and make them localizable
14:42ToxicFrogAeroNotix: oh, definitely.
14:43AeroNotixhaving the compiler spew internals at you when you misplaced a parens is just a tad unfriendly
14:44gfrederickshaving the compiler figure out that your only problem is you misplaced a paren is just a tad advanced
14:44AeroNotixgah I fucking hate the erlang riak client
14:45AeroNotixah wrong channel
14:45AeroNotixsorry^
14:45tbaldridgeAeroNotix: yeah, we only allow you to talk about Clojure and Haskell here...
14:45AeroNotixgfredericks: other languages seem to do a "good enough" job
14:45gfredericksAeroNotix: other lisps?
14:46AeroNotixgfredericks: clisp, sbcl seem to work fine enough
14:46xpte<arrdem> oooh boy guile+emacs got accepted to GSoC <-- again?
14:46dakronegfredericks: what's the motive behind making it localizable?
14:46gfredericksAeroNotix: good to hear
14:46xptei feel like it's gotten in at least three times, but there doesnt seem to be much to show for it
14:58jwm(-> :alerts (dateBasedKey))
14:58jwmthe dateBasedKey is a function that returns (keyword date..)
14:58jwmdoesnt loook like the key is getting expanded as a keyword in the macro though
14:59gfredericksjwm: that expression is identical to (dateBasedKey :alerts)
15:00gfredericksI'm not sure what your last statement means
15:01jwmI'm using a numerical string I wonder if that is what is making it not work
15:01jwmI just get the date string back
15:02gfredericksI'm still not understanding; but it sounds like the sort of thing where if you had a minimum example reproducing the problem we could figure it out quickly
15:02jwm((dateBasedKey) (-> *data* :alerts)) works
15:02gfredericksoooeh
15:02gfrederickstry (-> *data* :alerts ((dateBasedKey)))?
15:03justin_smithyeah, that looks right
15:03justin_smithin -> (foo) is the same as foo
15:03jwmwell that just started working
15:03jwmcrazy!
15:03jwmmayhbe it was lighttable
15:03gfredericksjwm: try (macroexpand-1 '(-> ...)) to see the difference
15:03justin_smithyou need ((foo)) to get wrapping
15:03jwmI was doing () in the -> statement
15:04justin_smithyeah, that is the same as no parens
15:04jwmit just kept giving me back the actual keyword string
15:04dbaschjwm: (-> bar (foo)) is the same as (-> bar foo)
15:04justin_smithyou need double to get one
15:04justin_smithsugar is weird
15:04jwmwell now it works with just a single one
15:04justin_smithit shouldn't
15:05jwm(sqdata :alerts (FMdatekey))
15:05gfredericksthat's different
15:05jwmsqdata is a macro that expands to do -> + args
15:05gfredericksthe -> is the important difference
15:07dbasch,(doc ->)
15:07clojurebot"([x & forms]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."
15:08jwmyeah
15:08jwmI made macros for all of my ref data to alter
15:08jwm(defmacro sqdata ([& args] `(-> @*sqdata* ~@args)))
15:08jwmso I could just do some tiny shorthand such as (sqdata :alerts :20140401)
15:09jwmI added the same form to my test code function and it also brought back the date but then I put it in double enclosures and it worked hehe
15:10gfredericksjwm: if you're just passing keys to lookup you don't need a macro for that
15:10jwmhowever the original statement now works even with single parenthesis
15:10gfredericks(defn sqdata [& keys] (get-in @*sqdata* keys))
15:10jwmwhich one would be faster to run
15:11justin_smiththey should be nearly identical
15:11justin_smithcriterium has the real answer though
15:12jwmthe biggest thing that has slowed me down so far with clojure is learning the different forms of update-in
15:12jwmmerge, into, assoc, conj with [], {}, () .. etc
15:13justin_smithbut those things don't even exist in another language - it's a speedup!
15:13gfredericksjava.jdbc's api that lets you put some options at the front of your statement vector is super gross
15:13justin_smith(once you know them)
15:13llasramjwm: You say it like `update-in` doesn't just take an arbitrary function
15:14jcromartiethere's only one form of update-in
15:14jwmno, my problem isnt clojures
15:14jwmits the fact I go willy nilly when I pick my data structures
15:14jcromartieit's totally open ended
15:14jcromartieah, yes, that can be an issue :P
15:14jwmI never use to even pay attention to it I'd just pick {} and be done with it :)
15:14jcromartie(it's totally open ended)
15:14jwmnow I've got 31 flavors with my data
15:14jwmI spent 8 hours on a 6 line routine because of it lol
15:15jcromartierouting?
15:15jcromartieoh routine
15:15jcromartiesorry
15:15jcromartie(tiny fonts)
15:15jwmsorry should've said function anyway :)
15:15jcromartieI know the feeling
15:15justin_smithclojure is more concise so you need to re-evaluate your time per line of code heuristics
15:16jcromartieclojure is like a 4-cylinder race engine
15:16mmitchellhas anyone ever used this for security in a clojure web app? http://www.picketlink.org/
15:16jwmyeah I noticed clojure makes me think while I program
15:16justin_smithjwm: regarding your above time question, -> is faster. https://www.refheap.com/78799
15:16jwmdunno if I like that part about it yet :)
15:16arrdemjustin_smith: -> can use transients :D
15:16arrdemor should..
15:16jcromartiesophisticated, compact, powerful, and insanely difficult/expensive to diagnose when something goes wrong
15:17justin_smitharrdem: that would explain it, if that were the case
15:17jwmI started writing test cases which is the first time in my life because of clojure
15:17gtrakjwm: it gets better
15:17gfredericksarrdem: waat?
15:17jwmand my test cases were altering data in a way that made my normal code go bad hah
15:17gtraka hardship worth pursuing :-)
15:18arrdemtest generative next up...
15:18justin_smithjwm: when you have pure functions and immutible data, tests become much more useful and informative
15:18jwmyeah I know I am progressing as a developer
15:18TimMcjustin_smith: I'll admit, I stopped reading at "Java EE".
15:18gtrakI've noticed that my java code-reading skills have improved immensely just by this process.
15:18TimMcright or wrong
15:18gfredericksarrdem: what on earth does "-> can use transients" mean?
15:18justin_smithTimMc: ?
15:19jwmjustin_smith: I'll get there but this project has a deadline which I already sort of missed :)
15:19jcromartieyou can use -> with transient mutator functions
15:19jwmat least I am separating my side effect functions from my non
15:19arrdemgfredericks: I'm derping at the moment... jira ticket I read yesterday and didn't recall correctly.
15:19arrdemgfredericks: but jcromartie got it right
15:19jwmI use to use functions like they were namespaces
15:19justin_smithTimMc: wait where did you read Java EE?
15:20stuartsierraHow is `cljr-add-require-to-ns` supposed to work? I get stuck in the snippet.
15:20gfredericksarrdem: jcromartie: we were just comparing -> to get-in, which doesn't update anything
15:20gfredericksdid I miss a separate topic?
15:20arrdemgfredericks: nope.
15:20arrdemgfredericks: this is unrelated
15:20gfredericksoh phew
15:22TimMcjustin_smith: Oh whoops, that was mmitchell.
15:23jcromartiejwm: IMHO Clojure is a language for the long run. I think there are plenty of languages better suited for many purposes, but Clojure brings a better return on investment in the long run.
15:23jcromartiejwm: I would hate to learn it while on a project with a deadline, though.
15:24jwmthat is the only way I learn stuff
15:24jwmif I have some fire to put out
15:24justin_smithespecially if it is one's first lisp (or worse yet, first non procedural/oo language)
15:24jwmI'm already 5 times more productive in clojure than nodejs heh
15:24jwmI studied lisp (10!) years ago
15:24justin_smithjwm: in self education I have become a semi-expert in starting small fires on a daily basis :)
15:25jwmI went from asm coding and osdev straight to webdev possibly after repainting my jeep without a face mask on
15:25justin_smithinhalents are a hell of a drug
15:25jcromartieif I didn't know Lisp or JavaScript, I'd prefer to learn Clojure over Node.js
15:26jcromartieClojure has quirks, but nothing like the whoppers in JS
15:26jwmnode-webkit is a nice model
15:26devntips for reporting and handling exceptions in core.async?
15:26dbaschjcromartie: you made me remember https://www.destroyallsoftware.com/talks/wat
15:26gtrak"Effective Javascript" was a really fun and quick read, cascading horrors made me lol.
15:27jwmits kind of ironic I am using a nodejs based system to get off of nodejs (lighttable)
15:27jcromartie<3 Gary Bernhardt
15:28akhudekdevn: make sure you dont’ pass lazy sequences into put!
15:28arrdemah the "wat" talk..
15:28justin_smithmmitchell: regarding your question above, immutant is a clojure utility based on jboss, and it may be helpful if you want to use picketlink with clojure?
15:28akhudekthat way exceptions will not occur inside the put!
15:29akhudekprobably want to catch them within a go block too, not outside of it
15:32jwmanyone else use (cond) to make themselves a nice/po man test runner
15:33jwm(defn FMtests [tsttype tst] (cond
15:33llasramwhat? no
15:33llasramJust use clojure.test
15:33jwmI still use that its just this way I can pass a nice long string
15:34BobSchackdevn http://swannodette.github.io/2013/08/31/asynchronous-error-handling/
15:34jcromartiejwm: I think everybody is confused
15:34jwm(FMtests "alerts" "merge test email and destroy report spool")
15:34llasramstatus unchanged :-)
15:35jwmI just check for condition tsttype = alerts and then check what tst= wants to run and then do my test code
15:36jwmI was wondering what patterns pros use
15:36tcrawleymmitchell: don't use picketlink unless you absolutely have to. like, someone is going to shoot you in the head if you don't use it
15:36gfredericksclojure.test
15:37mmitchelltcrawley: lol - advice, straight up! I have no requirements, just looking for a good lib that handles authentication/authorization and pluggable backends (ldap, custom etc.)
15:43dbaschmmitchell: technically you can plug your backend into friend
15:43dbaschmmitchell: in fact you really have no choice
15:45mmitchelldbasch: yes, been playing with friend today also. Slowly starting to understand how it works.
15:52mmitchelldbasch: what do you mean "no choice"?
15:53dbaschmmitchell: well, you do have a choice in that you can use openid, otherwise you have to plug in your own authentication mechanism
15:54mmitchelldbasch: ahh, right. I understand!
15:55mikerodI had an interesting discovery on clj 1.6 today. The newer version of ASM lib being brought it now fails faster when a method size is too large
15:55mikerodPreviously, I didn't see "too large" method size errors until the ClassLoader failed when loading the byte code
15:55mikerodhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/asm/MethodWriter.java#L1871
15:55mikerodlooks like they added some explicit checking during bytecode generation now
15:56jcromartiethat's a nice improvement
15:56mikerodSo previously, I could run something like clojure-maven-plugin compile phase "compile to temp" output to ensure that the compiler didn't throw errors. We knew some methods were too large, but it didn't matter since we weren't loading up from the AOT __init files. Now it fails during the compilation though.
15:57mikerodjcromartie: I agree that it is a good improvement to fail-fast on this, as ASM does now
15:57mikerodJust snuck up on me.
15:59mmitchelltcrawley: curious... what was your experience with picketlink, and do you have any recommendations?
16:01tcrawleymmitchell: I don't have any recommendations, and I've never used picketlink. I have friends that have had to integrate with picketlink (via java), and had a very difficult time.
16:01tcrawleyso, I'm basically talking out of my ass
16:01akhudekooh, picketlink has SAML
16:01mmitchellha well that's ok.
16:01tcrawleybut it does embrace the complexity of JavaEE, which can be daunting
16:02mmitchellright, it looks HUGE too
16:02mmitchellI've also been looking at Apache/Shiro
16:02akhudekmmitchell: I’ve used shiro
16:02akhudekit’s “ok"
16:02mmitchelloh really? any feedback?
16:02mmitchellok
16:02mmitchellakhudek: have you used friend?
16:03akhudekmmitchell: only on a small utility project, it didn’t exist when we started so we have our own authentication system
16:03akhudekwe use shiro for authorization
16:04mmitchellakhudek: do you have various/different methods for auth or just use 1?
16:05akhudekmmitchell: just one, but one day I’d like to support saml too
16:07mmitchellakhudek: ok cool, thanks for your feedback. I'll have another look at shiro too
16:08akhudekmmitchell: the nice thing about it is that you can fairly easily customize the storage for your authorization roles
16:09mmitchellthat's definitely important for what we're building
16:10mmitchellakhudek: does it require that your app be a proper servlet app? I think I saw some clojure code using Shiro that said you can't (for example) use something like http-kit's server
16:12akhudekmmitchell: It may depend on how much of it you use. But if you just want to use authorization then you can simply intantiate the right objects and store them in the user’s session.
16:13mmitchellinteresting ok
16:14amalloyforge before jack to shuffle stuff in?
16:14amalloywhoops, wrong window
16:15tvanhensis there a way to execute "load-string" in a namespace other than the one you are currently in? I am trying to dynamically load functions from specific files through a defn function that wraps load-string. The funciton works when I call it from the namespace I am in, however when I try to call that function from other namespaces that I have required it into, I get unable to resolve symbol errors
16:15gtrakyou can bind *ns*
16:15gtrakthough that's for eval, not read-string
16:16hiredmannamespaces are not things that things happen in
16:16gtrakexcept eval :-)
16:17tvanhensI thought that load string was a combination of eval and read-string
16:17gtrakhttp://stackoverflow.com/questions/7684656/clojure-eval-code-in-different-namespace
16:17gtrakI don't know load-string
16:17hiredmansure, but a namespace isn't a think that things happen in, a namespace is a big map you look up values from
16:18hiredmanthe compiler uses *ns* by default to look things up
16:18gtrakwhat's it mean to have a thing happen in a thing?
16:18hiredmanbut at execution time, *ns* can be bound to any random thing
16:18tvanhensgotcha
16:18gtrakthat's kind of a pedantic distinction.. does something actually happen in a thread?
16:19gtrakas a straw man, I guess
16:19tvanhensso eval by default uses whatever namespace is most recently called?
16:19hiredmannamespaces are a compile time environment, the only time *ns* is for sure the namespace your function is defined is, is when it is being compiled
16:19hiredmannamespaces are not called
16:19tvanhensI don't know the correct terminology I just mean the context its in
16:20hiredmaneval uses *ns*
16:20gtrakI'm guessing load-string would use the same stuff, from a cursory look
16:24gtraktvanhens: it's possible (but-nasty) to change the ns mid-flight to redefine stuff
16:24gtrakI forget what library had that :-)
16:26tvanhensso say I want to dynamically run functions contained in strings from a database. And the functions that call load-string to evaluate them are all contained in the same namespace. But I want to be able to call those functions from a different namespace. How would I prevent eval from using the latter?
16:27gtrakwhy not just fully-qualify the functions?
16:27gtrakthis sounds like X-Y problem
16:28gtrakalso, eval's a massive security hole when used like that, maybe a multi-method DSL would be better.
16:29tvanhensthe database is behind a firewall and only used internally so I'm not too worried about that too much
16:30justin_smithtvanhens: is this some kind of expert system or genetic algo?
16:31tvanhensnot at the present point in time, just a spaghetti of code. But thats what I'm working on trying to put together
16:32gtraktvanhens: anyway you can mess with *ns*, it's a dynamic var, so it's thread-local.
16:33tvanhensthanks I'll give that a go
16:33justin_smithtvanhens: storing code in a db is not a way to avoid spaghetti...
16:33gtrakcandidate for inclusion into footgun :-)
16:34tvanhensWell aware of that :) trying to figure out a smart way of doing that
16:34justin_smithtvanhens: I'm trying to picture a scenario where that would improve on the normal fs mapping of namespaces, and if you aren't doing genetic algos I don't know how it would help
16:34justin_smithis there some pragmatic need for not having normal files of code?
16:36tvanhensbusiness requirement. Not the biggest fan of it, but trying to figure out a way to make it work. They want to put most of the codebase into datomic in small applet forms that are executed in the time context they were created in
16:37gtrakquite the trippy manager
16:37tvanhensYeah, its definitely an interesting challenge
16:39tvanhenswell thanks for the input. Going to try some things out
16:48devntbaldridge: Could you or anyone else give me the gist of what ioc-alts! does?
16:49tbaldridgedevn: sure
16:51tbaldridgedo-alts handles the mechanics of alts!. It takes a callback (to be handed to the dispatcher if the alt is parked), and a set of channels. It returns nil if the action is parked, or a value box if the operation succeeded without needing a dispatch
16:51tbaldridgethe function ioc/run-state-machine-wrapped is what ends up calling this function, and it expects :recur if execution should continue, or nil if the execution of the state machine should pause
16:52tbaldridgeso you can probably see that if do-alts returns nil, then the inner callback will handle the continuation of execution, otherwise execution continues inside the caller of ioc-alts!
16:52tbaldridgethe ioc/aset-all! stuff is record keeping for the next state to jump to and tracking the value returned by alts!
16:52tbaldridgehttps://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async.clj#L344
16:55devnahhh
16:55devnthank you tbaldridge
16:57devnive been reading and re-reading the API docs to get leveled on core.async-fu. do-alt and ioc-alts! stuck out to me because they didn't have docstrings. i was searching in the file for ioc-alts! and didn't see any callers in clojure.core.async, so thought I'd reach out and ask since I saw you were active
16:58devntbaldridge: maybe this is contrary to the whole point of core.async, but I was wondering: Is there a way to count the number of items currently put onto a channel?
17:03tbaldridgedevn: not really, one could write a custom buffer with count mechanics, but that leads to all sorts of race conditions.
17:05devntbaldridge: yeah, i figured as much, this was more for me to just tinker with some ideas -- to ask some questions about a particular channel.
17:06tbaldridgeyou could also write something like async/pipe that stores the current count in an atom
17:06tbaldridgeit takes as many items as it can and stores them somewhere and keeps track of the count
17:06tbaldridgeputting them into the output as it can
17:07ToBeReplacedi wonder if you could write a function to accept a channel and then reify something implementing ReadPort, WritePort, Channel... on write/read swap! an atom
17:10devnhere's a giant, loaded question for you :) -- i am working on something where i have a set of URLS in a CSV file with some other metadata about them. Once it is fetched, it has a few CPU-bound transforms applied to it. These transforms also eat up a bunch of memory. Finally, they are uploaded to S3. Failed items at each step need to be logged to a CSV file. Successful items which are uploaded also need to be logged.
17:13devnThe question(s) is/are: 1) Any ideas for dynamically arriving at the max connections a particular host can take? 2) How would you handle the logging? 3) Any other general observations or thoughts?
17:13devntbaldridge: ^
17:14jwmsounds like a good introspective app
17:14jwmI plan to incorporate that kind of coding into my dev process
17:15tbaldridgedevn: I really recommend a pipeline approach for this, each task is a go and takes from one channel and writes to another. Make a constructor for each task that takes a param for the number of gos for each app.
17:15tbaldridgethen configure the entire thing off a large hashmap that takes the sizes of each buffer and the number of gos, tweak until you're happy
17:15tbaldridge*gos for each task.
17:16tbaldridgeI mean, you could also implement an auto balancing system for this, but I've found those things hard to get right
17:16devnheh, yes
17:16hiredmanhttps://gist.github.com/hiredman/11194485
17:16tbaldridgeit can often just be easier to give yourself an easy way to configure it by hand or via a config file.
17:17hiredman(it uses futures, because you can future-cancel, and it assumes you'll be doing side effects)
17:18devntbaldridge: yeah, the only thing is, in some cases the set of hosts I have to get things from varies. some hosts might allow 100 connections, others 25, maybe another will only allow 2. knowing this up front is hard.
17:18devnhiredman: thanks i'll give it a long
17:18devnlook*
17:18tbaldridgeyou can shutdown this pipeline as well via closing the input/output channels, this has the added plus of only shutting down once a given item is processed
17:19tbaldridgefuture-cancel can kill in the middle of something important.
17:19hiredmantbaldridge: sure, but some times you don't care
17:19tbaldridgeagree
17:19tbaldridge*agreed
17:19tbaldridgedevn: how do you know how many connections is "too many"?
17:19hiredmanthe pipeline function returns a data structure containing all the input and output channels which is nice too
17:20devntbaldridge: things start failing. unfortunately, it can also fail because the resource simply is not there.
17:20devni've inadvertantly taken down one of these hosts
17:20devnso it makes me want to be extra careful, because if it goes down, I'm hosed until someone gets around to flipping the lights back on
17:21tbaldridgedevn: my point being, if you don't have a reliable feedback system, having a self tuning system doesn't help much
17:22devntbaldridge: i imagine something like accelerating per-host -- the reliability of the feedback system is bad, yes, but over 1,000,000 items for a particular host, it seems doable to arrive at a reasonable "speed limit" for that host
17:22devnbut with over 1,000,000 items*
17:23devntbaldridge: in any case, i think you're right, but it does pain me a bit to have to settle. I'd love to build this so it can try to tune itself.
17:24devnhiredman: this is pretty cool
17:32devnhiredman: how would i pass this something like source-csv -> fn-which-processes-a-single-row -> next-step-fn?
17:33tbaldridgedevn: and something else to mention for hiredman's approach, I think we're too quick sometimes to reach for 'go'. If you're creating a static pipeline, use thread or future
17:40devnhiredman: also, where do you pull results off? I tried to (<!! (:out (pipeline [10 (comp list inc) ...]))) for instance
17:44mmitchellok i have a (kind of) working friend workflow. The problem is, I don't want to redirect after a successful login, I just want to render a 201 (session created) - anyone know how to disable that redirect? hmm.
17:50rasmustodevn: (<!! out) seemed to work for me, did you write to in?
17:52devnrasmusto: like (go (>! (:in (pipeline [...])) 1) ?
17:52coventryIn sablono, how do you get an attribute without a value (like autofocus) into a tag?
17:55devnrasmusto: ah, nevermind, i mixed something up
17:55dbasch_hyPiRion: why?
17:55hyPiRiondbasch_: why what?
17:55dbasch_hyPiRion: why do you think it should be final
17:56zeeshanlakhanireiddraper: around for a quick, but dumb question on test.check?
17:57rasmustodevn: oh, I did it with a single blocking write (trying to learn async stuff myself)
17:57reiddraperzeeshanlakhani: shoot
17:57jcromartiewhat's the better type to dispatch on: clojure.lang.IPersistentMap or clojure.lang.APersistentMap
17:57devnrasmusto: as in (>!! (:in (pipeline [...])))?
17:57jcromartiesame question for sets and vectors, too
17:57zeeshanlakhanihow can i tap into :max-size for running a tc/qc test via clojure.test (defspec)?
17:58rasmustodevn: yeah, though make sure you have a reference to out available to read from
17:58reiddraperzeeshanlakhani: unfrotunately thats' an outsanding issue at the moment: you can't with defspec
17:59zeeshanlakhanireiddraper: ah, ok. is there a link to the issue? just to keep tabs or possibly contribute?
18:00hyPiRiondbasch_: because if you want to conform to the Persistent Vector implementation, it is better to extend APersistentVector instead
18:01reiddraperzeeshanlakhani: lemme check
18:01reiddraperzeeshanlakhani: http://dev.clojure.org/jira/browse/TCHECK-10
18:03zeeshanlakhanireiddraper: thanks!
18:03reiddraperzeeshanlakhani: np
18:03dbasch_hyPiRion: that’s not reason enough to make it final
18:06amalloydbasch_: what are you arguing should not be final? c.l.Persistentvector?
18:07hyPiRionamalloy: yeah
18:07amalloythat'd be really bad; for the same reason String has to be final
18:07amalloyie, if you give someone a String, they know it can't ever mutate
18:08amalloyif i extend String to SneakyMutableString, you have a String which suddenly can change out from under you
18:08devnrasmusto: why do you say to "make sure"
18:08devnrasmusto: does it change underneath you or something?
18:09rasmustowell, it'll make a new network each time you call (pipeline), right?
18:10dbasch_amalloy: it’s not final right now
18:13devnrasmusto: heh, im trying to figure it out
18:13devnrasmusto: I tried pushing a hash-map onto it, and i got it out as a collection of map entries
18:15devnwell, it did say it took "things" and not "thing" :)
18:17rasmustowell, it'll partition the pieces if they're passed in a different way
18:18devnrasmusto: heh, if you're running in the repl beware
18:18devni found out i had 2,000 threads running
18:18rasmustoI know, had to restart it a few times
18:19rasmustocreated a network of 100 threads and held down ctrl+enter in lighttable
18:25amalloyjcromartie: you should never dispatch on APersistentWhatever
18:25amalloyinterfaces, not implementations based on abstract classes, are what you care about
18:42sirWhat's that Clojure trick?
18:42gfredericksclojurebot: you |should never dispatch on| APersistentWhatever
18:42clojurebotAck. Ack.
18:42sirLike, ((juxt remove get) {:foo 2} :foo) or something.
18:47justin_smith,((juxt dissoc get) {:a 0 :b 1 :c 2} :b)
18:47clojurebot[{:c 2, :a 0} 1]
18:47TEttinger~you
18:47clojurebotyou should never dispatch on APersistentWhatever
18:47TEttingersee what you did gfredericks
18:49sirAh yes, dissoc! Thanks.
18:54gfredericksTEttinger: yes indeed I do
18:55gfredericksATransientSubHashTree$EMPTY$Seq
18:56TEttingerclojurebot: you |are| in the Clojure IRC channel. Good work.
18:56clojurebotYou don't have to tell me twice.
18:56gfredericksclojurebot: you |don't have to tell| me twice
18:56clojurebotRoger.
18:57gfredericksI should find hiredman's csv file and uniq the verbs to see what the weirdest ones are
18:57amalloygfredericks is a menace to bots everywhere
18:58TEttingerclojurebot: gfredericks |is| a menace to bots everywhere
18:58clojurebotIn Ordnung
18:58gfredericksbotmenace is gonna be my new internet handle once I turn 15
19:07justin_smithhe's not the user input they were designed for, but he is the user input they need
19:13rasmusto~menace
19:13clojurebotI don't understand.
19:13rasmustodoesn't clojurebot have some sort of search/pattern matching stuff?
19:21justin_smith,(re-seq #"ab.a" "abracadabracadabra")
19:21clojurebot("abra" "abra" "abra")
19:27gfredericks,(re-seq #"(cad)?abra" "this string has abracadabra in it")
19:27clojurebot(["abra" nil] ["cadabra" "cad"])
19:28gfredericks,(re-seq #"(?:cad)?abra" "this string has abracadabra in it")
19:28clojurebot("abra" "cadabra")
19:37rasmusto,(doc cadabra)
19:37clojurebotNo entiendo
19:40devnrasmusto: get it figured out?
19:40rasmustowhich part specifically?
19:40devnidk, just curious if you got it working to your satisfaction
19:41devnI have a couple of functions which expect a map as input
19:41rasmustodevn: ah, I was really just messing about, didn't have an end goal really
19:41rasmustodid you get some maps to flow through it?
19:43devni am going to play with it in a bit. i just got home
19:45devnrasmusto: it doesn't seem to be runnning my functions
19:46GlenjaminHi guys, is there a difference between alter-var-root and def ?
19:46Glenjaminspecifically if I'm not using the previous value
19:46rasmustodevn: did you (comp list yourfunc) ?
19:46devnrasmusto: no, is that really required?
19:46rasmustodevn: I think so, my brain didn't wrap around those inner loops though
19:47devnyeah, all that does is give me [{...}] as my out
19:47devnwhere {...} has not had my fns applied to it
19:47rasmustodevn: got a paste? or an example of one of the fns + input
19:49devnrasmusto: ill have to do some cleaning, but sure
19:50rasmustodevn: (comp list #(assoc % :foo (rand-int 10))) was what I tested it with
19:50devnoh, maybe i just need another wrapper around my fn
19:52devnnow im just getting all nils -- weird
19:54devnrasmusto: eval'ing in the file gives me nil as a result
19:54rasmustodevn: https://www.refheap.com/78833
19:54devneval'ing in the repl gives me a different result
19:54rasmustohm, that's weird
20:01devnrasmusto: got it working now -- not sure totally what is going on
20:01stormeHello, is there a way to specify (inc) to incream by two rather than one? i.e (inc(2) 1) = 3?
20:01stormeincrease*
20:02Bronsastorme: just use +
20:02hyPiRionstorme: (#(+ % 2) 1) ?
20:03justin_smithor partial can work
20:03amalloy,(let [incrementor (fn [x] (fn [y] (+ x y))), inc2 (incrementor 2)] (inc2 1))
20:03clojurebot3
20:03stormeBronsa: was hoping there was a more clojurey idiomatic way
20:03amalloystorme: addition is pretty idiomatic
20:03stormelol
20:03amalloywhen you want to add two numbers, it's hard to be more idiomatic than +
20:04stormeamolloy++
20:04storme:)
20:04justin_smith,(let [frob (partial + 42)] (map frob (range 4)))
20:04clojurebot(42 43 44 45)
20:04amalloystorme: your IRC client probably lets you tab-complete usernames
20:06devnrasmusto: bah, this is weird
20:06rasmustodevn: whats that
20:07devnit was calling my fn, now it's not
20:07devni have logging in it, so i should see it
20:10gfredericksamalloy: NumberManagerAwarenessBean.getAdditionMaker()
20:11devnrasmusto: if i remove the second function in the pipeline it works
20:11devnor rather, it appears to actually call my fn
20:12gfredericksamalloy: I know enterprise OO jokes have been around awhile but mine is a creative reimagining of a classic
20:12amalloygfredericks: http://java.metagno.me/ is a recent one
20:12gfredericksamalloy: oh this is a great idea
20:13amalloyi did slightly worse than chance
20:13hyPiRiongfredericks: ConcreteStatelessNumberMethodFactory.getAdditionMethod(3) ?
20:13beamsojava.metagno.me is both brilliant and scary
20:14justin_smiththey don't check whether the algorithm accidentally makes real class names
20:14gfrederickshyPiRion: it should probably be getAdditionCallable
20:14hyPiRiongfredericks: yeah, sorry. I'll show myself out.
20:14justin_smithso sometimes you know one of the classes is real, but it is not marked by the game as "real"
20:15rasmustodevn: hm, seems to work for me with a second function in there
20:15devnreally?
20:15devncan you paste for me?
20:15justin_smithMathematics.Numbers.Operations.Linear.Commutative.AdditionBy(4)
20:16gfredericksorg.springframework.web.servlet.handler.AbstractHandlerMethodExceptionResolver
20:16gfredericks^ real
20:16rasmustodevn: https://www.refheap.com/78833
20:16gfredericksit has a subclass called ExceptionHandlerExceptionResolver (??)
20:18GlenjaminHi guys, is there a difference between alter-var-root and def ?
20:18gfredericksyes
20:18Glenjaminif i'm not using the previous value, that is
20:19bbloomrasmusto: i am very bad at this game.
20:19rasmustobbloom: sup?
20:19justin_smithI do worse than chance at the java.metagno.me game
20:19hyPiRionjustin_smith: me too.
20:19bbloomrasmusto: whoops, i meant beamso
20:20Si_anyone here have any experience with caribou?
20:20gfredericksthat means < 1/3 correct?
20:20justin_smithyes, I am at 0/6 at the moment
20:20rasmustobbloom: :)
20:20bbloomrasmusto: i scrolled up & saw beamso's java class name game, then i saw you posted a refheap link and my brain barfed out your name on the tab complete
20:20justin_smith1/8
20:20rasmustobbloom: tab complete from the nick ending or something
20:20rasmustofuzzy-find-nick
20:21bbloomrasmusto: nah just brain failure
20:21rasmustofuzzy-brain-failure
20:21bbloomvery.
20:23devnrasmusto: omg
20:23rasmustodevn: <! me
20:23devnrasmusto: somehow I rewrote the pipeline output map {:in (:in (first x)) ...} to be (last x)
20:23devnrasmusto: >! your pants on
20:23devn>!!*
20:24devnrasmusto: okay, this works beautifully now. *sigh*
20:24devnthis is a sign i'm supposed to take a break
20:24rasmustoah, that would explain it, were you trying to read and write from the same channel or something?
20:31krasHI, how do I get the quotient part of a division?
20:31gfredericks,(quot 7 5)
20:31clojurebot1
20:31kras,(/ 856 100)
20:31clojurebot214/25
20:31justin_smiththe jvm does not let you do the division and quotient in one op sadly
20:32justin_smithif that is what you mean
20:32devn,((juxt numerator denominator) 1/12)
20:32clojurebot[1 12]
20:32justin_smithI guess someone could make a machine level binding that makes the appropriate call to the underlying cpu
20:32devnis that what you mean?
20:32bbloomi wouldn't be surprised if there was a div/mod peephole optimization for x86 at least
20:32bbloomin hotspot, anyway
20:32justin_smithbbloom: how would you bind to it? would the jit just do it?
20:33krasquot would do just fine for my case
20:33bbloomjustin_smith: you'd probably just have to do division & quotation right next to each other with the same variables as inputs & have them be primitives
20:33bbloomjustin_smith: but i'm just guessing
20:34bbloomjustin_smith: still, probably unlikely to be accomplished via a var in clojure. would need a java method
20:34krasthanks guys
20:34gfredericksbbloom: quotation? is this a word?
20:34bbloomgfredericks: er, quotient
20:34bbloomquotations on the brain :-P
20:34amalloyquotientation
20:34bbloomif you haven't noticed by now, my brain is totally not a brain at the moment
20:34justin_smithgfredericks: it is a word, but wrong domain
20:35justin_smith,''''''quote
20:35clojurebot(quote (quote (quote (quote (quote quote)))))
20:35devnrasmusto: damn, this is really nice now that it's working.
20:35devnhiredman: thanks again for that gist. very cool.
20:36arrdem,''
20:36clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
20:36devn,`':>
20:36clojurebot(quote :>)
20:36justin_smith,''''''(unquote "brain")
20:36clojurebot(quote (quote (quote (quote (quote (unquote "brain"))))))
20:36gfredericks,'etouq
20:36clojurebotetouq
20:36devn,`'~:>
20:36clojurebot(quote :>)
20:36gfredericks,''etouq
20:36clojurebot(quote etouq)
20:36bbloom,(defrecord Hold [x])
20:36clojurebotsandbox.Hold
20:36devn,(Hold. x)
20:36clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>
20:36devn,(Hold. 1)
20:36clojurebot#sandbox.Hold{:x 1}
20:36bbloom,#sandbox.Hold (inc 5)
20:36clojurebot#<RuntimeException java.lang.RuntimeException: Record construction syntax can only be used when *read-eval* == true>
20:37bbloom,#sandbox.Hold {:x (inc 5)}
20:37clojurebot#<RuntimeException java.lang.RuntimeException: Record construction syntax can only be used when *read-eval* == true>
20:37bbloomblah
20:37arrdembbloom: oh god why
20:37devn,(binding [*real-eval* true] #sandbox.Hold {:x (inc 5)})
20:37clojurebot#<RuntimeException java.lang.RuntimeException: Record construction syntax can only be used when *read-eval* == true>
20:37devnworth a try
20:37bbloom,(eval (Hold. '(inc 5)))
20:37clojurebot#sandbox.Hold{:x (inc 5)}
20:37arrdem(inc devn)
20:37lazybot⇒ 17
20:37gfredericks,#=(set! *read-eval* true)
20:37clojurebot#<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.>
20:38devnheh, Ye Olde #=
20:38devnFor some reason this reminds me of when #^ was the metadata syntax
20:38gfrederickswhat should #~ do
20:38devnand i have no idea why
20:39devngfredericks: do a load-string
20:39lemonodor,(binding [clojure.core/*real-eval* true] #sandbox.Hold {:x (inc 5)})
20:39clojurebot#<RuntimeException java.lang.RuntimeException: Record construction syntax can only be used when *read-eval* == true>
20:39devn,*read-eval*
20:39clojurebotfalse
20:40gfredericksguys you gotta actually call the reader if you want that sort of thing to work
20:40justin_smith,(= 'real 'read)
20:40clojurebotfalse
20:40devn,(read-string "(binding [clojure.core/*read-eval* true] #sandbox.Hold {:x (inc 5)})")
20:40clojurebot#<RuntimeException java.lang.RuntimeException: Record construction syntax can only be used when *read-eval* == true>
20:40gfredericksnot like that either
20:40gfredericksyou do the binding outside the read
20:41devnshow me
20:41devntough guy
20:41gfredericksit's not going to work of course
20:41gfredericksbut it's the only way that even *could* work
20:41gfredericks,(binding [*read-eval* true] (read-string "#sandbox.Hold {:x (inc 5)}"))
20:41clojurebot#sandbox.Hold{:x (inc 5)}
20:41gfredericksomg omg omg omg omg omg
20:41devnbahahahahahahahahahahaha
20:42bbloomawesome
20:42justin_smithwait what?
20:42devn,(binding [*read-eval* true] (read-string "(defn foo [x] (inc x))"))
20:42clojurebot(defn foo [x] (inc x))
20:42devn,(binding [*read-eval* true] (eval (read-string "(defn foo [x] (inc x))")))
20:42clojurebot#'sandbox/foo
20:43gfredericks,(set! *read-eval* true)
20:43clojurebottrue
20:43gfredericks,#=(inc 54)
20:43clojurebot#<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.>
20:43gfredericks,(read-string "#=(inc 54)")
20:43devn,*read-eval*
20:43clojurebot#<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.>
20:43clojurebotfalse
20:43devn,(binding [*read-eval* true] (eval (read-string "#=(inc 54)")))
20:43clojurebot55
20:43justin_smithgfredericks: I think it has to do with the fact clojurebot puts eat eval in a new thread
20:44gfredericksdevn: you didn't need the eval there
20:44devnright, 'cause hash equals
20:44devn,(binding [*read-eval* true] (read-string "#=(inc 54)"))
20:44clojurebot55
20:44gfredericksnow let's try to do something forbidden
20:44gfredericks,(try 42)
20:44clojurebot42
20:44devn:X
20:44amalloysince when does clojurebot allow eval? i thought it didn't used to do that
20:44gfredericks,(try 42 (catch Throwable t t))
20:44clojurebotgfredericks: Gabh mo leithscéal?
20:44gfredericks,(identity "catch")
20:44clojurebotgfredericks: Pardon?
20:45gfrederickswell that'll be tough
20:45devn,(binding [*read-eval* true] (read-string "#=(try 42 (catch Throwable t t))"))
20:45clojurebotdevn: Gabh mo leithscéal?
20:45devn:(
20:45devn,(inc 1)
20:45clojurebot2
20:45gfredericksamalloy: maybe my nagging about bots & eval from a year ago paid off
20:46kras,(partition 1 (str 999))
20:46clojurebot((\9) (\9) (\9))
20:46krasdoes \9 here mean a char?
20:46gfredericksyep
20:46bbloom,(intern 'clojure.core 'push-thread-bindings (fn [bindings] (clojure.lang.Var/pushThreadBindings (assoc bindings #'clojure.core/*read-eval* true))))
20:46clojurebot#'clojure.core/push-thread-bindings
20:46gfredericks,(type \9)
20:46clojurebotjava.lang.Character
20:46gfrederickskras ^
20:46bbloom, #=(inc 54)
20:46clojurebot55
20:46bbloomboom.
20:47bbloom,(intern 'clojure.core 'push-thread-bindings (fn [bindings] (clojure.lang.Var/pushThreadBindings (assoc bindings #'clojure.core/*read-eval* false))))
20:47clojurebot#'clojure.core/push-thread-bindings
20:47bbloom, #=(inc 54)
20:47clojurebot#<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.>
20:47bbloom,(intern 'clojure.core 'push-thread-bindings (fn [bindings] (clojure.lang.Var/pushThreadBindings (assoc bindings #'clojure.core/*read-eval* true))))
20:47clojurebot#'clojure.core/push-thread-bindings
20:47bbloom, #=(inc 54)
20:47clojurebot55
20:47bbloomi win.
20:47bbloomsecurity. how does it work?
20:47krasgfredericks: thanks, I keep forgetting about type
20:47gfredericksclojurebot: bbloom is a read evaluator
20:47clojurebot'Sea, mhuise.
20:48devn,(binding [*read-eval* true] (read-string "#=(.listFiles (java.io.File. \"/\"))"))
20:48clojurebot#<RuntimeException java.lang.RuntimeException: Can't resolve .listFiles>
20:49gfredericksI don't think #= supports most expressions
20:49gfredericks,#=(+ 1 2)
20:49clojurebot3
20:49gfredericks,#=((identity +) 1 2)
20:49clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol>
20:49gfredericks^ see
20:50bbloom,#=(apply (identity +) [1 2])
20:50clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn>
20:50bbloom,#=(apply + [1 2])
20:50clojurebot2
20:50bbloomheh
20:50gfredericksprollably just literals for argsies
20:51kras,(map Integer. ("9" "9" "9"))
20:51clojurebot#<CompilerException java.lang.ClassNotFoundException: Integer., compiling:(NO_SOURCE_PATH:0:0)>
20:51krasI guess I can;t do this
20:51gfredericks,(map #(Integer. %) ["9" "9" "9"])
20:51clojurebot(9 9 9)
20:52kras,(type #(Integer. %))
20:53clojurebotsandbox$eval26$fn__27
20:53kraswhat is the type of Integer.
20:53gfredericks,(map (fn [s] (Integer. s)) ["9" "9" "9"])
20:53clojurebot(9 9 9)
20:53krasit is a constructor
20:53gfredericksyes constructors aren't proper objects
20:53amalloykras: it has no type, because it's not a value
20:53devni wonder if we could get clojurebot to read in the code for serializable fns
20:54devnand then serialize a fn it wouldn't normally allow
20:54devnand read it
20:55krasso what can we classify this as, this is definitely a specail form since it understands (Integer. "9')
20:56gfredericksyes it's a special form
20:56krasspecial form for Java interop
20:56gfredericksright
20:57krasOkay got it, thanks a lot
21:11jwmcan you use use at runtime after compiling?
21:11jwmhehe -after compiling since it is runtime :)
21:12justin_smithjwm: can you use what at runtime? interop?
21:13justin_smithyes, you can do interop at runtime
21:14jwmwell I am trying to use "use" from a function I am calling from -main
21:14jwmits not going so well when I run it with lein run
21:17jwmis there something different about -main
21:17jwmlike, can I not use do?
21:17jwmI forget what the docs mentioned about -main
21:23gfredericksyou're running use inside a function?
21:26jwmyeah
21:28gfrederickswhy would you need to do that?
21:29jwmconfigurable code/module loading
21:29gfredericksso what do you mean by "it's not going so well"?
21:32jwmthe function call completes and so do the use statements but they dont get sucked into my current namespace
21:33gfrederickshow can you tell they don't?
21:33gfredericksthe actual structure of your code is important here because use is only going to affect code compiled in the future
21:34gfrederickse.g. (defn f [] (use 'clojure.string) (split ...)) does not work
21:35jwmwhen I do lein run it runs the println statements in main and makes the function calls but nothing is actually run (I have a few init functions called also in the same functions)
21:36gfredericksyou don't get any exceptions? are you sure the problem is with use?
21:36jwmI dont get any exceptions
21:36jwmwell I call the function directly outside of -main from the repl and it works
21:36gfredericksmight be a red herring; are you running something that returns a lazy seq?
21:37jwmyeah, I run for loop
21:37beamsoit's something lazy that is being run in the repl but not at the command line
21:37beamsoi think you have to use doseq instead of run
21:37beamso*for
21:37gfredericksjwm: for is not for looping
21:38gfredericksit's for list comprehension and it's lazy
21:40jwmI stradle everything with dos
21:41jwmI'm making another language called do ;)
21:44Frozenlo`that `for' problem has bitten me more than it should
21:45jwmyeah, I knew it was lazy too
21:45Frozenlo`I always test in the repl first, so I don't notice it until I've coded quite a few functions on top;
21:45jwmI moved my (do earlier
21:45jwmyeah I am 100% repl coding
21:46gfrederickssomehow I got to a point where putting side effects in a for just feels completely unnatural
21:46gfredericksI think I'm just usually aware of whether I'm writing side-effect code or functional code
21:47FrozenlockOh I'm aware of that. I just can't get in my head that `for' won't cut it.
21:49jwmwe should have a lor and a normal for
21:49jwmlor, lazy, for, not lazy :)
21:53jwmthat fixed it
21:53jwmnice to see doseq has :let also :)
21:53gfredericksyeah they're pretty much the same
21:54jwmI hadn't used doseq because it looked shitty to me based on the examples
21:54seangrovebbloom: How would your layout system handle dynamic resizing? i can see changing the top-level slot width, but how do nested components calculate their sizes?
21:59gfredericksnrepl middleware must be the one thing that's easier to test via `lein test` than at the repl
22:00gfrederickswell probably also anything to do with repls at all
22:19krasIs String/join same as java.lang.String/join?
22:20arrdem,(use 'clojure.string)
22:20clojurebot#<SecurityException java.lang.SecurityException: denied>
22:20arrdem,(require 'clojure.string)
22:20clojurebotnil
22:20arrdem,(source clojure.string/join)
22:20clojurebot#<SecurityException java.lang.SecurityException: denied>
22:21right1,((defn a [] (a)))
22:21clojurebot#<StackOverflowError java.lang.StackOverflowError>
22:23kraslooks like all the java.lang.* are available in the default namespace 'user'
22:31zcaudateDoes anyone know any good meta programming books for lisp?
22:32lurkerzcaudate: Let Over Lambda, many chapters available online
22:33zcaudate@lurker... Something a bit easier??
22:33lazybotzcaudate: What are you, crazy? Of course not!
22:36arrdemthat.... was freakishly appropriate
22:36Frozenlockzcaudate: https://www.youtube.com/watch?v=2Op3QLzMgSY
22:36zcaudateI'm looking at doing some type coercing stuff with reflection
22:38arrdemFrozenlock: oooh. Read SCIP, loved it, didn't know there were lectures :D
22:38arrdem(inc Frozenlock)
22:38lazybot⇒ 4
22:38FrozenlockYeah, by the masters themselves :p
22:38Frozenlock(starts a little slow... but good nonetheless)
22:40lurkerzcaudate: more specifically?
22:43arrdem"we are going to conjure our spirits in a magical language called LISP".
22:43arrdempriceless
22:46zcaudateHaha. Yeah I love that series
23:03bbloomseangrove: you looking at the old or new code?
23:04bbloomseangrove: both are old / hacked up, but i mean the one file or the repo i shared?
23:23amalloylet over lambda isn't really great for clojure anyway
23:25arrdemnot for idiomatic clojure certainly... the techique of using closure'd mutable state to impact successive function invocations is kinda cute and the tricks played with macros are interesting.
23:25arrdembut I've never seen anyone else write or condone code written that way..
23:27tbaldridgearrdem: sadly I've seen codebases like that
23:27tbaldridgewhere every static value inside the defn is defined in a outer let
23:27arrdemthat's unfortunate....
23:27tbaldridge(let [x {:a :foo}] (defn myfunc [m] (merge m x)))
23:27tbaldridgethat sort of stuff ^^
23:28arrdemwas there a reason for this style? from a code gen point of view it doesn't buy you anything..
23:28tbaldridgefrom what I understand there was some thoughts that it might be faster. IDK, I'd rather write "normal" code and then hire some guy to devote his summer to making the compiler emit better code.
23:29arrdem=
23:29tbaldridge:-P
23:29arrdem=D
23:29arrdemtalked to some grad students today about my plots for making clojure run fast, and it sounds like I've got enough interesting ideas that I can get my undergrad thesis out of this project. soooo.....
23:30tbaldridgenice
23:30tbaldridgeYeah, I'll be interested in seeing where this all goes. I mean HotSpot is pretty darn good, but that doesn't mean we have to lean on it quite as much as we do.
23:32cddrzcaudate: The Art of the Metaobject Protocol is another classic
23:32arrdemAfter talking about ideas with my TA for about an hour today I've got kind a 6 point list of "obvious" whole program operations and tweaks to bytecode generation that should make an appreciable difference. Of course how much is gonna be half the object of the ideal final paper 'cause I have to justify that this work is unique compared to other JVM DCE and compression tools.
23:35cddrHas anyone thought of applying stuartsierra's component lifecycle model to docker containers?
23:35cddrhttps://github.com/stuartsierra/component
23:37zcaudateOh thats really cool... thats kinda the ultimate for optimization... but i just want to be able to treat objects as maps... And to be able to coerce data between them.
23:38zcaudateThanks @cddr.. are there any with clojure source code as examples?
23:40zcaudate@cddr.. Are you using docker with pallet?
23:40cddrI was thinking of something more like flynn
23:44lurkerzcaudate: Treat objects like maps? A bit like http://stackoverflow.com/questions/23110132/factor-clojure-code-setting-many-different-fields-in-a-java-object-using-a-param ?
23:54zcaudateOh okay.. https://flynn.io/ but wouldn't you use docker as a container for clojure rather than the other way around?
23:55beamsoflynn lives!
23:56cddrI was thinking of building something like flynn but controlled by clojure (though in reality, that's probably too ambitious for the likes of me)
23:58beamsoforgive my ignorance but what is the point of flynn?