#clojure logs

2014-03-12

00:02ryantmdissipate, Do you have a gist of code that shows shuffle not working correctly?
00:04dissipateryantm, not off hand. a sufficiently large collection passed to shuffle will cause the problem though. i actually, originally discovered 'shuffle' was improperly implemented in python. then i found out clojure's implementation was just as bad.
00:05dissipateryantm, you can't write a unit test to reveal the problem because of the size of the permutation space involved. for instance, a deck of cards has 52! permutations.
00:06ryantmdissipate, an experiment should do fine
00:07dissipateryantm, you can't set up an experiment to reveal the problem either. you have to just deduce the problem from known limits in the current implementation.
00:08ryantmdissipate, why can't you run an experiment?
00:11awalker_would rand-nth have the same problem? i can't see a reason to use shuffle.
00:11dissipateryantm, there are 80658175170943878571660636856403766975289505440883277824000000000000 possible permutations in a 52 card deck
00:11awalker_nvm, ignore me
00:12dissipateryantm, in order to properly run the experiment you would have to generate a great deal more than that number of permutations to show that statistically speaking certain permutations were not showing up
00:15ryantmdissipate, hmm yeah that makes sense.
00:20ryantmdissipate, http://stackoverflow.com/questions/2715423/is-collections-shuffle-suitable-for-a-poker-algorithm
00:23dissipateryantm, one guy made the good point in that discussion. if your seed for your PRNG is only 32 bits, you can't possibly generate all of the possible hands because 2^32 < 52!
00:27dissipateryantm, omg, it is worse than i thought
00:28dissipateryantm, Java's 'shuffle' uses a 'Random' object for its seed. it is only seeded once before it is used by 'shuffle'. the seed is only a 64 bit long.
00:29dissipateryantm, that means java's shuffle can only generate up to 2^64 permutations before it wraps back around. and 2^64 is way way way way less than say 52!
00:30dissipateryantm, actually, to be more accurate, Java's 'shuffle' uses a 'Random' object to get its random integers to select the random spot in the shuffle algorithm
00:37ryantmdissipate, did you read http://www.cigital.com/papers/download/developer_gambling.php ?
00:38ryantmdissipate, the conclusion seems to be that 64bit seeds are good enough
00:38ryantmdissipate, I guess they have different requirements than you appear to have.
00:40dissipateryantm, wow, that is an epic fail. :(
00:41dissipateryantm, i had read this article: http://www.i-programmer.info/programming/theory/2744-how-not-to-shuffle-the-kunth-fisher-yates-algorithm.html
00:41dissipateryantm, it has an argument used in that paper. a naive swap algorithm does not generate a proper distribution of permutations
00:42dissipateryantm, the conclusion from where?
00:42ryantmdissipate, That paper at the link I posted
00:43ryantmdissipate, they are only trying to make it so people can't guess the cards with computer help, not make sure every permutation is possible.
00:44dissipateryantm, i see. well, that is just ridiculous because 2^64 is way way way less than 52!. so a huge number of permutations will never occur!
00:46TravisDdissipate: Does it really matter? You'll never have enough time to see 2^64 different shuffles... let alone 52!
00:48amalloyi don't understand why you're still campaigning on this, dissipate. java.util.Collections/shuffle lets you pass your own Random object, and you can use/make one that has the characteristics you want
00:48dissipateTravisD, yep, it does matter.
00:49dissipateamalloy, it does not reseed the Random object. so my argument still stands. it is limited to 2^64 permutations.
00:49TravisDdissipate: I would be happy if the 2^64 permutations it generates are more or less evenly distributed among the 52!
00:49ryantmdissipate, well, that article was written in 1999. It should be more practical to make a 226 bit PRNG now.
00:50amalloyreseeding the Random object would be a disastrously poor choice
00:51amalloybut like, you can use http://docs.oracle.com/javase/6/docs/api/java/security/SecureRandom.html, which is a subclass of Random, or you can subclass Random yourself and use something that only takes free-range grass-fed entropy
00:53dissipateamalloy, fair enough. and what about Clojure's 'shuffle'?
00:53amalloydon't use it if it's not suitable for your application
00:54amalloyit's suitable for almost everything done by almost everyone
00:55ryantmdissipate, also, you could submit a bug report on Clojure JIRA to improve the documentation on shuffle.
00:55ryantmhttp://dev.clojure.org/jira/browse/CLJ
00:55dissipateamalloy, i'm going to make an alternative that blocks on /dev/random
00:57ryantmdissipate, http://www.2uo.de/myths-about-urandom/
00:57dissipateryantm, i think there should at least be a warning
00:58ryantmdissipate, sounds great
00:59ryantmdissipate, make it happen
01:40MattAbbottSo within a project, I want to represent pluggable modules (think supplementary books like in D&D or expansion sets for dominion)
01:41MattAbbottThere are several core concepts that each expansion builds upon. Does it make more sense for the namespace to be, e.g., dominion.intrigue.cards/dominion.intrigue.actions or dominion.cards.intrigue/dominion.actions.intrigue?
01:42MattAbbott(well, cards and actions are very closely related in dominion i suppose; I guess dnd.phb3.class, dnd.phb.race vs dnd.race.phb, dnd.class.phb is a better comparison)
01:44MattAbbottMy personal inclination is that the categories are more fundamental concepts, so they should be at the higher level, with each expansion installing a file in each concept's directory when added
01:46MattAbbottbut from the user side, you're more likely to specify that you want to use expansion3.* than rules.* but only weapons.[base expansion2]
02:04MattAbbottAny thoughts?
02:48isaacbwhas anyone here implemented something like wolfram alpha? I'm wondering if there's any good reference material (papers and such) which at least discuss *parts* of the problem
02:49isaacbwthe NLP for picking out important query terms from a sentence, perhaps
02:49SegFaultAXisaacbw: You might be interested in NLTK
02:51dsrxor opennlp, which has some clojure bindings
03:30steckerhalterso, I figured that the stackoverlow happens in "update-proxies": http://steckerhalter.co.vu/paste/stackoverflow.html
03:30steckerhalterany ideas why?
03:30steckerhaltermaybe I'm doing atoms wrong :)
03:50ambrosebssteckerhalter: stacktrace?
03:55steckerhalterambrosebs: I need to figure out first how I can get that
03:56ambrosebssteckerhalter: (clojure.repl/pst)
03:58steckerhalterambrosebs: http://steckerhalter.co.vu/stuff/paste/trace.html
03:59ambrosebs404
03:59steckerhalterdang
04:00rbattulareading through 'Clojure Programming' having a little trouble with this little bit https://gist.github.com/rajivbattula/9502649
04:02rbattulaspecifically line 17, the function takes a (CamelCase) string and a number, but why is the string an argument to odd?, and the whole thing works
04:02steckerhalterambrosebs: http://steckerhalter.co.vu/paste/trace.html
04:02ambrosebssteckerhalter: try (clojure.repl/pst *e 100000)
04:02ambrosebs,e*
04:02clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: e* in this context, compiling:(NO_SOURCE_PATH:0:0)>
04:02ambrosebs,*e
04:02clojurebot#<Unbound Unbound: #'clojure.core/*e>
04:06steckerhalterambrosebs: ok, sorry, I just messed the trace up. need to generate a new one
04:07ambrosebs,(map-indexed (fn [i x] [i x]) ["CamelCase" 5 "lowerCamelCase" 3])
04:07clojurebot([0 "CamelCase"] [1 5] [2 "lowerCamelCase"] [3 3])
04:07ambrosebsrbattula: does that help? ^
04:11rbattulaambrosebs: at first I was confused by where the 0 1 2 3 came from, I understand now
04:11rbattula,(map-indexed (fn [i x]) ["CamelCase" 5])
04:11clojurebot(nil nil)
04:12rbattulaambrosebs: how come this ^ was (nil nil)?
04:12ambrosebs,((fn [i x]) 0 "CamelCase")
04:12clojurebotnil
04:13rbattulaok that make sense, nothing is being done with the arugments
04:13rbattulaOH!
04:14rbattulaambrosebs: the 'i' in the function is the position of the list! thank you soo much!
04:15ambrosebs,(doc map-indexed)
04:15clojurebot"([f coll]); Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item."
04:15ambrosebsyea that's one cryptic docstring
04:15ambrosebsalmost as bad as ##(doc reduce)
04:15lazybot⇒ "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well... https://www.refheap.com/56961
05:54dsrxthe map-indexed docstring almost looks like a botched copy-paste job
05:54dsrxerr, never mind, no it doesn't
06:27marek__Hi guys
06:36winkoh wow, someone did it 8) http://clojure.sexy/
06:37beamsothere is also http://emacs.sexy/
06:37beamsothe clojure one simply redirects to planet clojure
06:38winkbeamso: that's the cool thing - not some random stuff
06:39winklike vim.sexy
06:53steckerhalterso I found the stackoverflow happens in "update-proxies" in the sexp (if proxies-rest ...) , see http://steckerhalter.co.vu/paste/stackoverflow.html
06:55steckerhalterit fails either in the (empty? ...) or when returning @all-proxies because it does not do the reset! in that case
06:56beamsowhy are all-proxies and proxies declared differently?
06:58steckerhalterproxies is used to walk through all-proxies, and refilled with all-proxies
06:58pepijndevosRaynos, refheap seem down http://www.downforeveryoneorjustme.com/www.refheap.com/
06:59steckerhalterwhat do you mean differently?
06:59beamsoif they are the same starting point i'd have declared them identically
06:59pepijndevosuhm, meant Raynes I suppose?
07:00pepijndevos$mail Raynes is refheap down?
07:10beamsoalso, any reason why you don't just conj to the set?
07:18steckerhalterbeamso: conj where?
07:18beamsoadd-proxies
07:23steckerhalterit would do the same? keep the unique ones?
07:34beamsoit should.
07:39eroomdegreetings, in trying to be an academic who makes some effort with code, rather than keep churning out matlab, I have been working through SICP, and wonder why I didn't do it years ago (suspect this happens a lot). Newly excited and confident, I'd like to use something lispy in anger, and Clojure seems like a good choice. I wonder if there's a summary anywhere on clojure for people who know Scheme, specifically any gotchas? Or should I just dive in and see w
07:41beamsohttp://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips#Clojure_for_Scheme_Programmers
07:41beamsoi haven't watched the video, but this guy is pretty cool : https://www.google.com.au/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=2&amp;cad=rja&amp;uact=8&amp;ved=0CDEQtwIwAQ&amp;url=http%3A%2F%2Fvimeo.com%2F22675078&amp;ei=REcgU9K7LIOpkAWfroDoDQ&amp;usg=AFQjCNGIiRYadAKd9-puQn3JDirHYlrC1A&amp;sig2=UTkxFNV6YUIH1YZ95B4uug&amp;bvm=bv.62788935,d.dGI
07:41beamsooh, crap.
07:41beamsohttp://vimeo.com/22675078 <-- that was what i meant to link
07:42eroomdebeamso: wonderful, thanks. I/google missed both of those earlier.
07:44ruzu2http://sicpinclojure.com/
07:45eroomdeI saw that, though I was a bit scared off by the health warnings
08:00gfredericksamalloy: `returning` is the same as (comp first list) if you assume orderly execution of arguments
08:57chris-freeDoes anyone whether a list of Leiningen templates exists?
08:58felherHello again, folks. Is there a default way to cope with IO-Errors in clojure? Does one just let the IO-Exceptions be thrown or catch it and return multiple values, kindo Go-like?
09:00beamsoi don't explicitly catch io exceptions in my code
09:00beamsoi do try and use with-open so that resources are opened and closed properly though
09:01k3nytest..
09:02felherbeamso: I see, thanks. :)
09:03beamsoi'm not advocating what i do as best practice, but in my code an io exception isn't really a recoverable exception
09:04clgvfelher: if you want to debug it in a long running application you should probably catch it and log the message + stacktrace and maybe additional context
09:06felherYeah. I won't be able to recover from it. I sure like to display an error message, though. So I'll got with some top-level-catch, displaying an error message and logging + stacktrace
09:06felherThanks, folks :)
09:15iwilcoxeroomde: If you already know Scheme I'd be interested (purely out of curiosity) to know whether http://clojure.org/lisps makes easy sense to you. I never knew any other Lisp variant (before the still vanishingly small amount of Clojure I know right now) so it's a curiosity to me.
09:16john123What number of pages are ideal for a GSoc proposal?
09:22k3nytest..
09:24clgviwilcox: I learnt another Lisp after Clojure, so it's the other way round. but that page makes sense when comparing both Lisps I know
09:25iwilcoxIs it easy to read? Are the differences in commonly used, easily understood things, or are they subtle?
09:26clgviwilcox: except from "Clojure is a Lisp-1" most statements are clear.
09:27clgvfor that one you need to do some reading ^^
09:27iwilcoxYeah, I spent a while looking into that one ;)
10:01bbloomambrosebs: does core.typed (or something else you know of) have a list of fns that are pure?
10:01ambrosebsbbloom: not that I'm aware of
10:01ambrosebsbbloom: there's no way to express/use that property in core.typed
10:02bbloomambrosebs: hmmm, ok thanks. i guess i'll have to build such a list myself at some point
10:07gfredericksambrosebs: that's a conceivable extension though isn't it?
10:07ambrosebsgfredericks: honest haven't thought about it
10:07ambrosebs*honestly
10:07ebaxtAnyone using http-kit with WebSockets together with IE11/IE10?
10:07teslanickebaxt: I don't, but I'm also interested to know how well they work together.
10:10ambrosebsgfredericks, bbloom: is a boolean flag required or something more sophisticated?
10:10bbloomambrosebs: higher order functions are pure if their argument functions are pure
10:11bbloomambrosebs: that's the main complication i can think of
10:11bbloomambrosebs: and then there is a whole discussion about whether or not laziness counts as purity
10:11ebaxtteslanick: I'm testing it now and found an issue where IE10/11 sends pong frames that http-kit don't support. Unless I've overlooked something this is a blocker to use it with IE11/10 and makes me wonder if anyone is using this combination.
10:11ambrosebsright
10:11ebaxtteslanick: https://github.com/http-kit/http-kit/pull/134
10:12jcromartieI think laziness can count as pure
10:12llasramAs long as the lazy sequence thunk is pure?
10:13jcromartiee.g. for (map f x) as long as f is pure
10:13teslanickInteresting; It's annoying that it will be at least a year before the dust settles around websockets.
10:15ebaxtteslanick: Agree. We're testing http-kit with clj-wamp and autobahn.js, it's working like a charm except for this issue with IE10/11. You can also get IE8/9 support using https://github.com/gimite/web-socket-js
10:15teslanickGross. Flash.
10:16ebaxt:)
10:16devnTim Berners Lee /hates him/. Find out how to hack the internet with this "one weird trick". http://downloadmoreram.com/
10:16devnsorry, couldn't resist.
10:17teslanickUsing flash is like leaving your kitchen door open with a sign that says: "Cake inside. Please only take one slice."
10:17teslanick:)
10:19benmossheaven forbid
10:21clgvteslanick: well that strategy works in our institute when someone brings cake for his/her birthday ;)
10:22teslanickUnless you're Milton, and mumble about never getting any cake.
10:28jjl`is there a macro cookbook anywhere? I find debugging macros a bit tedious and i'm sure people have written similar things before
10:33devnjjl`: I suggest light table for debugging. If you use the instarepl you can have your (defmacro ...) (macroexpand-1 '(my-macro ...)) on separate lines, and watch it update as you make changes
10:33devnit's pretty nice for macro writing IMO
10:33jjl`ooh, that's a good idea
10:33jjl`thanks
10:34devnjjl`: as for a cookbook, im not sure i know of one. i know there are specific tutorials, like an old one about writing a debug macro. the joy of clojure (1st edition) had a more advanced version that let you inspect locals and gave you a REPL in your REPL kind of thing, which also utilized &env and &form IIRC.
10:34pyrtsajjl`: It's also a good idea to implement macros as much as possible as plain functions that just happen to return lists of symbols and the like.
10:35jjl`*nod*
10:35pyrtsaThen, you could have a function (defn foo* [...] ...) and a macro (defmacro foo [...] `(...)) calling that function.
10:36jjl`yeah, moving the complexity out as much as possible is always good. sadly not entirely possible in this case
10:56clgvjjl`: macroexpand-1 in a normal repl scenario helps a lot as well. use it with pprint
10:57jjl`lighttable made debugging that easier than usual just now though
11:24bbloomdnolen_: https://github.com/brandonbloom/eclj/commit/c1f0081aa34991d2a2ceea4735513e9c116deeed <- much nicer than all that "Disallowing Recur" business :-)
11:24dnolen_bbloom: heh nice
11:25bbloomi've got enough stuff working at the repl, i think i'm ready to try to bootstrap cljs core
11:31cbp(doc pr-str(
11:31clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
11:31cbp(doc pr-str)
11:31clojurebot"([& xs]); pr to a string, returning it"
11:31cbphmm
11:33cbp(doc pr)
11:33clojurebot"([] [x] [x & more]); Prints the object(s) to the output stream that is the current value of *out*. Prints the object(s), separated by spaces if there is more than one. By default, pr and prn print in a way that objects can be read by the reader"
11:58bbloomok unit-testing people... help me out here... i want a test "framework" that literally only exposes success/failure reporting functions. i don't want all sorts of assertions or anything like that. i just want to get a nice count of successes/failures at the end and i'll do the rest
11:58bbloomanything like that?
12:02gfredericksclojure.core/atom :P
12:02bbloomgfredericks: that's basically what i'm doing now :-P but lein integration printing the failures etc would be nice too
12:03gfredericksSCOPE CREEP
12:03koalallamais there a json writer in clojure stdlib? I found clojure.data.json, but appears to be a separate project
12:03bbloomgfredericks: true story.
12:04bbloomgfredericks: fine, you're right. if my test suite takes long enough that on-error-continue is a necessary feature, then my test suite is too big or my app is too slow
12:04bbloomnevermind, i retract my question and i am removing the atom & using assert
12:04bbloomwhew, minimalistic over-engineering adverted, thanks
12:04bbloom(inc gfredericks)
12:04bbloom:-)
12:04gfrederickshaha
12:04devnlol
12:10bbloomkoalallama: if it's on the clojure github account, it's "supported" (basically) and is preferable to bloating the stdlib
12:13InvidFlowerHey… is there some way I can take a string of a local variable and run it through something to act as if typed the variable in instead without the quotes? I can do create a map like (def mapping {"foo" foo, "bar" bar} and use (mapping "foo") but would be nice to automate it more..
12:14InvidFlowerI tried (resolve (symbol "foo")) but complains about var not being able to cast to named
12:14llasramInvidFlower: You can write a macro to do that, but honestly it's not that useful
12:15llasramI've got a version kick around, which I used once or twice, then generally found my code clearer w/o it
12:15llasramI'll dig it up gist it, for pedagogical effect...
12:15InvidFlowerllasram: Thanks. It is definitely a bit of a hacky thing. Probably good not to do it even for security implications but now I'm curious..
12:16llasramWell, no security implications, because it happens at macro-expansion time, not runtime
12:17llasramhttps://gist.github.com/llasram/9510281
12:17llasramThis version actually produces keyword-key maps, but easy enough to s,keyword,str, if that's what you really wanted
12:18InvidFlowerok thanks
12:18llasramOh man, I know it's old code -- an obvious missed opportunity to use `juxt` :-)
12:18TravisDllasram: Heh
12:19llasramMuch improved
12:25CookedGryphondoes anybody know if there's a handy thing for automatically resolving java imports like eclipse does?
12:25CookedGryphonI'm doing a fair bit of interop and it's really annoying having to look up all the packages
12:26CookedGryphonsurely someone's written something to just search the classpath for java class names matching?
12:26gfredericksI don't *think* slamhound does java imports but maybe it does
12:28CookedGryphonooh, looks like it *does*
12:28CookedGryphonaccording to this screencast anyway
12:29CookedGryphongiving it a go, thanks for the pointer!
12:29gfredericksnp
12:29gfredericksscreencast-oriented documentation (SOD)
12:29CookedGryphonand a lot more besides...
12:29CookedGryphon:P
12:34justin_smithCookedGryphon: (javadoc String)
12:34justin_smithmaybe?
12:34justin_smiththough slamhound is probably more convenient
12:35CookedGryphonjustin_smith: that wouldn't work would it? The whole point is that i don't have it imported yet
12:36CookedGryphonah, slamhound doesn't seem to play nice with midje....
12:36CookedGryphonI ran it and got a load of test results inserted into my ns form :P
12:36CookedGryphon*but* it did find most of the packages for my imports, got one wrong, but it was ambiguous anyway
12:37llasramCookedGryphon: Wrap all your midje tests in deftest forms :-)
12:38CookedGryphonah, good tip, pity it's a problem in the first place, but still...
12:39InvidFlowerllasram: It turns out I didn't even need a macro. Was testing it the wrong way at first I think. All I needed was this: (defn get-table [tname] (eval (symbol tname)))
12:40llasramInvidFlower: macro >>>>>> eval
12:40llasramIf you can use a macro, you should use a macro
12:40InvidFlowerllasram: True.. let me see if I can modify it for that
12:42InvidFlowerHah.. so small: (defmacro get-table [tname] (symbol tname))
12:44InvidFlowerWhich is really generic now… probably should rename it. "as-symbol" ?
12:44llasramOr try to figure out why you need that...? I honestly can't think of when you would
12:45AnderkentInvidFlower: I struggle to see why this is useful at all. Why not just type table-name instead of (get-table "table-name") ?
12:45TravisDInvidFlower: Is there any advantage to (get-table "foobar") over (symbol "foobar")?
12:45Anderkentremember that a macro will not evaluate its arg, so it will only work with literal strings
12:45gfredericksTravisD: it's just foobar
12:45TravisDTrue
12:46sdegutiso lazybot where art thou
12:46InvidFlowerAnderkent, TravisD: The reason is that it needs to be dynamic. It is getting the name from another source and then passing to a library that expects the symbol..
12:47TravisDgfredericks: Ah, right, it's not a function, so the symbol would be resolved. I was thinking maybe you would need to say 'foobar
12:47Anderkentthat won't work with a macro than
12:47Anderkentor rather, it won't work with the macro you used above
12:48gfredericksInvidFlower: might be good to describe what this library is doing; there might be a much simpler solution
12:49InvidFlowerAnderkent: Yeah you're right. I hadn't tested it with a variable again after changing from a function to a macro
12:49Anderkentdoesn't (symbol "foobar") do what you want?
12:50llasramAnderkent: I think they then want the value the symbol `foobar` evaluates to in the current context
12:50llasramInvidFlower: Which is not normal, and means there is probably a better way to do whatever you're trying to accomplish
12:52InvidFlowerllasram: Yeah. Honestly I think I should just make a map of string names to entities anyway since that restricts the items that could be used from the name. Big security issue of being able to just reference any variable in scope by name..
12:53InvidFlowerJust was trying to understand how things work a bit better too since I'm super-clojure newbie
12:54gfredericksrule of thumb: super-clojure newbie => don't write macros
12:54TravisDrule of thumb: Don't write macros
12:54TravisDwith some exceptions :)
12:55llasramrule of thumb: experiment with language features to figure out when they are useful and appropriate :-p
12:55TravisDHehe, I guess learning is a different thing all together
12:55llasramYah
12:56InvidFlowerYeah..
12:56llasramThat said, I do tend to write a fair number of namespace-local macros to DRY up repetition
12:56TravisDDRY?
12:56llasramDon't Repeat Yourself
12:57llasramIt's a thing from... pragprog? Maybe older, but I believe where I first saw it myself
12:57llasram(the term DRY -- not the idea obvs)
12:57InvidFlowerAnd one thing I could do eventually to make my life easier is to add on to the "defentity" macro that Korma uses so if I include an extra flag to it, it adds the name and data to a map for dynamic access. That way I don't have to write the separate map manually and it also restricts which tables can be queried by the dynamic engine..
12:58TravisDThat's pretty cool. Like how you can also use it as a verb
12:58TravisDI like that. I mean.
12:58InvidFlowerDRY is pretty old I think…
12:59llasramOh wow, is "notable": http://en.wikipedia.org/wiki/Don%27t_repeat_yourself
12:59llasramSo yeah, pragprog
12:59InvidFlowerHmm.. they do claim the prag prog book
12:59llasramThat book is 15 years old at this point, so may qualify as "pretty old" :-)
12:59TravisDHeh, WET is also pretty funny
13:00TravisDI've never read pragprog
13:01llasramI thought it was pretty good when I read it just out of college -- haven't read it recently so can't comment either way much on it now :-)
13:01llasramBut it definitely significantly influence unexperience-me
13:01InvidFlowerArgh… the whole "1990 was 10 years ago wasn't it?" thing always hits me
13:02llasramAlmost a quarter-century ago, you mean?
13:02InvidFlowerllasram: exactly.
13:03TravisDpragprog is the book by Hunt and Thomas?
13:03InvidFlowerDoesn't seem that long ago.. hard to make my brain think across the century boundary.
13:03berdarioHi, I wrote this piece of code, but I'm not sure that I'm doing things correctly. Especially, I'm unsure about adding a bang (!) to functions like "dispatch" and if wrapping a call to send like that might be a good choice https://www.refheap.com/57118
13:03InvidFlowerThis has to be one of the oldest things still in use from a programming book though: http://en.wikipedia.org/wiki/C_(programming_language)#.22Hello.2C_world.22_example
13:03llasramTravisD: Yeah, /The Pragmatic Programmer/, by Hunt and Thomas
13:03berdario(not showed there is the definition for add-visit and group-visits)
13:04TravisDllasram: Thanks, I may check it out if the library has it
13:04TravisDberdario: Usually you use ! to indicate that a function has side effects. I didn't really look at the code, though
13:05berdarioTravisD: flush-queue! stores data in redis, but I'm not so sure about dispatch! since it'll call flush-queue! only once out of 5000 times
13:06berdarioalso I'm not sure about having the outer functions without the bang, but I don't know of a better way to set it up
13:06TravisDberdario: That function is still impure. Although, I find that people are not so committed to it
13:06TravisDlike, the random number generating functions are not marked with !
13:06berdarioI don't know if there's a naming convention for functions that are supposed to be sent to agents
13:07llasramnope
13:07berdario(I wanted to create an argument-less function that wraps the send to be able to associate it to ring's destroy)
13:07llasramI'd mostly go by the "surprise" of a function turning out to have side-effects
13:07muhoowow! org-mode export to html does source highlighting! all my inline #+BEGIN_SRC clojure is colorizeded
13:08llasramberdario: For the send-to-agent version, you can always make those local fns w/in the public versions
13:08hyPiRionyeah, it's lush like that
13:08llasramberdario: Unless you have some reason to expose them globally
13:09berdariollasram: I don't, but I have to expose flush-queue! to dispatch!
13:09berdario(I mean: I don't _have_ to, but otherwise I'd be duplicating code)
13:10berdarioalso, my rationale for not having a bang on the functions that wrap the banged ones, is that in-that-thread there're no side effect, the side effects will be executed in/by an agent... but this seems a flaky excuse for a naming choice
13:12llasramYou may be over-thinking this :-)
13:13john123Hiii!
13:14john123Would someone please tell me who is responsible for accepting gsoc proposals?
13:14TravisDjohn123: Maybe ask in #gsoc?
13:15john123I meant the one from this community TravisD
13:16TravisDjohn123: This strikes me as the sort of thing that is available somewhere online and, if not, it's intentionally private. But I don't know anything about it, so feel free to ask away
13:17berdariollasram: you're not the first one to tell me that :)
13:17john123Ok, thanks!
13:22k3nytest..
13:22rasmusto~test
13:22clojurebotI don't understand.
13:34edwI'm trying to inspect an expression in CIDER using C-c M-i and I'm being told I need to install the cider-nrepl plugin, but I've already added it to my :user profile. Anyone run into this?
13:34CookedGryphonin async, does untap take the result of tap, or the channel fed into tap?
13:35muhoohow is cider compared to nrepl.el these days? last i looked, it seemed like there was lots of churn, and nrepl.el was safer
13:36CookedGryphonmuhoo: that's not been teh case for some time now, cider is definitely the way to go
13:38ystaelCookedGryphon: I find that edge cider crashes my emacs predictably whenever eldoc tries to render a hint in the minibuffer, so I have to disable it
13:39ystaelsomebody told me the most common cause of emacs freezes with nrepl/cider was auto-complete.el, so that's not even loaded
13:39ystaelbut eldoc kills the animal too
13:40edwC-g C-g C-g is your friend with recent CIDER releases, it seems.
13:46edwI'm guessing that my SNAPSHOT of cider-nrepl is out of date and deleting it from the cache will do the trick.
13:48augustlany better ways of doing this? https://gist.github.com/augustl/9512228
13:49Anderkentaugustl: isn't that just re-seq?
13:49augustlAnderkent: ah, cool, testing
13:49hyPiRionAnderkent: no, it doesn't contain line pos
13:49Anderkenthm I guess not quite
13:49Anderkentright
13:49augustlmy endgame is to use this data to replace the occurrences of the regexp with a parsed version
13:49augustlwhich is why I need the position :)
13:49augustlotherwise re-seq is exactly the same it seems
13:50llasramaugustl: You could make it lazy if you expect lots of matches...
13:50augustls/parsed/processed
13:50llasramAnd having an *earmuffed* local is unusual
13:50hyPiRionaugustl: Have you checked out clojure.string/replace?
13:50Anderkentaugustl: I'd look at the source of re-seq then and just adjust the result
13:50llasramOnly things I see to comment on :-)
13:50augustlllasram: yeah I don't remember where I saw that, but since the matcher is mutable it sort of makes sense
13:50llasramWell, except earmuffs usually mean "dynamic scope", not "mutable"
13:51augustlllasram: also, lazy ftw, that's a good idea
13:51augustlllasram: yeah I thought the same thing.. But I also liked the idea of making it clear that *matcher* is mutable
13:51augustlbut breaking convention is also bad..
13:51augustlhyPiRion: hmm, will check that out
13:51pyrtsaAnderkent: I've done the same. A lazy re-seq variant that also includes the position information of matches.
13:52augustlhyPiRion: seems like pretty much I want, since I can pass in a function. Nice!
13:52hyPiRionaugustl: yeah, it's very convenient that way :)
13:52augustlonly downside is that I don't control execution.. Was thinking of doing the processing in parallel
13:52CookedGryphonI'm stuck in core async with the error message "Pop without matching push" for some innocuous looking code
13:52hyPiRion,(clojure.string/replace "10 2 3 9" #"\d+" (fn [v] (apply str (repeat (Long. v) "-"))))
13:52CookedGryphonanybody got any ideas how to debug that?
13:52clojurebot"---------- -- --- ---------"
13:52augustlbut perhaps clojure.string/replace already auto parallelizes?
13:53hyPiRionaugustl: I don't think so, no.
13:54augustlclojure.string/replace does too many things.. But it's awfully convenient too.
13:54TravisDaugustl: It seems a bit hard to parallelize it. If you chunk up the string and hand the pieces to different processes, you might split one of the matches in half. If the processing takes time, I guess one process could find matches and then you could do the processing in parallel
13:54hyPiRionTravisD: I think he means the function calls, not the parsing itself
13:55augustlTravisD: yeah that's why I thought I'd create a data structure that represents the change so I can process that list in as many threads as I want, and then later join it all together
13:55TravisDaugustl: Ah, I see
13:55augustleach replace operation will be one separate call to pygments which makes sense to parallelize imo
13:56hyPiRionoh yeah, that makes sense
13:56TravisDaugustl: Pygments is that python thing that colourizes code?
13:56hyPiRionTravisD: yes
13:56augustlTravisD: yeah, so it'll create separate processes etc
13:56TravisDcool
13:56augustlthis is completely not performance critical, but I want to get used to parallelize when I can :)
13:56augustlor, I don't want to do something explicitly in sequence unless I have to :)
13:56TravisDhehe
13:57TravisDSo is pygments pretty expensive to run?
13:57edwYeah, clearing out the Maven cache didn't work...
13:58augustlTravisD: not really, but I do have 4 cores and I intend to use them :)
13:58TravisDaugustl: Hehe, no harm in that :)
13:59augustland I'm not pragmatic ;)
14:03hyPiRion,(defn get-matches [re s] (map (fn [s m] {:start s :match m}) (re-seq re s) (for [m (repeat (re-matcher re s)) :while (.find m)] (.start m))))
14:03clojurebot#'sandbox/get-matches
14:03hyPiRion,(get-matches #"\d+" "10 2 3 9")
14:03clojurebot({:start "10", :match 0} {:start "2", :match 3} {:start "3", :match 5} {:start "9", :match 7})
14:04hyPiRionwhoops, messed up the order, but that should work otherwise
14:04AnderkentCookedGryphon: do you have an example you could post? pop without matching push *shouldn't* happen, but you know how it is
14:06Anderkentwait, https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/ioc_macros.clj#L722 looks like the likely culprit?
14:07Anderkentshoulnd't the push be outside the try there
14:08edwIs there a way to see what middleware is a part of the current nrepl connection?
14:09amalloyAnderkent: yeah, that suggestion does look good to me
14:09amalloyand indeed that's exactly how the example usage in the docstring for push-thread-bindings uses it
14:09AnderkentI still struggle to imagine how push-thread-bindings could fail though
14:09CookedGryphonAnderkent: I think I worked out what the issue was - there was some code throwing an exception inside a dynamic var binding, the push exception was obscuring the actual issue
14:09amalloyAnderkent: the call to merge can fail
14:10amalloyor dereffing the var
14:10CookedGryphonI moved the binding outside my go block and could see the root cause, fixed that and everything's happy
14:10CookedGryphonAnderkent: which looks like it might be caused by what you just linked to
14:10CookedGryphonwait, why would that be an issue?
14:11Anderkentamalloy: push-thread-bindings only ever fails if it tries to change value of a non-dynamic var; LOCAL_ENV should always be dynamic
14:11Anderkentunless it NPE's, I guess
14:12CookedGryphoni had an npe inside the rebinding
14:12AnderkentI guess if the macroexpansion does assymetric pop-push it might not cause the error until the finally is hit ? Ugh.
14:12AnderkentCookedGryphon: could you post your code somewhere?
14:13CookedGryphonone sec, I'll un-fix it
14:13amalloyAnderkent: the point is that push-thread-bindings doesn't have to fail
14:14amalloyif something inside of it fails, like the call to merge, then push-thread-bindings is never called at all
14:14amalloyor, at any rate, never attempts to push anything
14:14amalloyyeah, i guess never called. i wasn't sure if it was a macro or a function
14:15Anderkentno but my point is in this case I struggle to imagine a case where merge or defer would fail. The defer is for an internal compiler binding, should always succeed; i don't think merge ever throws
14:16AnderkentI mean maybe in some bizzare situation like OOM; but that's not really what is being hit here
14:16CookedGryphonAnderkent: so this is the original code, unfortunately it's not easy to reproduce, has library deps, but I can try and make a trivial example https://www.refheap.com/59a163d6549600da8893257b4
14:18AnderkentCookedGryphon: could you also put the stacktrace there?
14:20CookedGryphonAnderkent: done
14:21CookedGryphonand i added a little info about what happens if I move the binding
14:22amalloyAnderkent: i think you're right, it's hard to imagine how that can fail. of course you can *make* merge throw an exception by giving it something which isn't a map, or is a map that behaves badly in some way, but i doubt if that happens in here
14:24AnderkentYeah I think it must be messing up the binding that is in his sources instead
14:29sdegutis~guards
14:29clojurebotSEIZE HIM!
14:29sdegutisclojurebot: who owns you?
14:29clojurebotexcusez-moi
14:30technomancyclojurebot: what is your secret superhero origin story?
14:30clojurebotCool story bro.
14:30technomancydang it
14:30sdegutisHeh that one actually worked out.
14:30amalloyoh, yeah. i'd be a little surprised to find that binding actually works inside of go
14:30ToxicFrogclojurebot: what?
14:30clojurebotwhat is short for ,(doc ...)
14:31sdegutisSometimes I don't appreciate Clojure enough.. yeah, there are some inconsistencies and some features I'm not a fan of.. but when writing Clojure, I probably sigh a tiny fraction of the amount I used to sigh when writing Ruby.
14:32sdegutisSure, the honeymoon phase is gone, but I'm much more productive and less stressed now than I was when I used Rails. I should remind myself of that more often.
14:35technomancythe honeymoon phase is dangerous
14:35amalloyclojurebot: the honeymoon phase is dangerous
14:35clojurebotc'est bon!
14:35technomancyimpairs critical thinking
14:38hyPiRionand you tend to overuse new concepts too
14:39devnhttp://ticosa.org/
14:39devnThat looks interesting.
14:39edwOdd: (nrepl-op-supported-p "inspect-start") returns nil in Emacs yet the inspector works when manually invoked.
14:40technomancydevn: love it
14:42kencauseydevn: Yeah thanks
14:42llasramOh that's awesome
14:43sdegutisdevn: I've given up on Julia, can't work on Romeo anymore, sorry.
14:43sdegutisdevn: it's a fine language, but its stdlib is too focused on scientific computing and not general purpose enough to be pleasant to work with
14:44kencauseysdegutis: Hmm, that was one of my concerns in a cursory examination.
14:44devnsdegutis: i feel similarly
14:44devni got bored quickly
14:44sdegutisand seriously, 1-based indices?
14:44devni think it's neat and all, and i like that it has some lisp roots
14:44devnbut it's kind of a bummer to work with
14:44kencauseysdegutis: Can't agree with you there ;)
14:45sdegutiskencausey: (def 0 1)
14:45devnhaha
14:45kencauseyI can deal with either choice
14:45devnit's a tiny thing, but it was kind of like: wtf? why?
14:45sdegutis:)
14:46sdegutisdevn: yeah, we should obliterate that repo
14:46technomancyis it because it's targeted primarily at scientists rather than coders?
14:46devndone.
14:46sdegutistechnomancy: methinks
14:46technomancyworking only with 1-indexed languages might be ok, but switching between 1 and 0 sounds like a nightmare
14:47kencauseyperhaps time in Smalltalk inured me to it.
14:47devni dont think that's actually a good argument for why it is 1-indexed (the scientists vs coders thing)
14:47technomancydevn: you don't think that's the reasoning behind the decision, or you don't think it's justified?
14:47devnboth
14:48devnif you're smart enough to learn julia, you can handle 0 as 1
14:48kencauseyI think being FROM scientists/mathematicians has some bearing
14:48gfredericksthe arabic number system is 0-indexed :P
14:48devnyeah, that might be closer to the truth
14:48devnsdegutis: well, we did get one thing right with that julia project.
14:48devnsdegutis: the name.
14:48technomancydevn: course you *can*, but every weird quirk is one more bit of mental overhead that's likely to cause mistakes
14:48sdegutisdevn: :D
14:49sdegutisi figure, enough langs use 0-based, that 1-based is kinda pointless now no matter how correct
14:49technomancysdegutis: it only makes sense if the users of the language don't use any other languages imo
14:50koalallamasdegutis: it's not so bad if you use it for sabatoge. I tell all my enemy's to learn it
14:50technomancywhich is more likely to happen in academia than anywhere else
14:50sdegutiskoalallama: bwahahaha
14:50sdegutistechnomancy: trueché
14:50technomancykoalallama: you mean once your attempt to get them to learn node fails?
14:50devntechnomancy: well, julia has an interface to work with python code
14:50devnwhich makes the 1-indexed thing more ridiculous IMO
14:50llasramWell, or only use other 1-indexed languages, like R
14:51devni think llasram just nailed it
14:51devnit's for users of R
14:51llasramOr Fortran
14:51technomancydevn: sure; I don't agree with it either
14:51technomancyjust trying to understand the justification
14:52llasramAnd a few other odd-balls
14:52llasramLua, apparently
14:52llasramhttp://en.wikipedia.org/wiki/Comparison%5Fof%5Fprogramming%5Flanguages%5F%28array%29#Array%5Fsystem%5Fcross-reference%5Flist
14:52gfredericksodd-balls! get it??!!?!?!!
14:52technomancylawl
14:52llasramI win at puns even without trying!
14:52gfredericksalso multiplicative-identity-balls!
14:52technomancylua was actually the only one I knew
14:53llasramlol
14:53sdegutisGiven a set of [name email] tuples, what's a great way to get a list of just names and list of just emails?
14:53kencauseyThe fact that array bounds in Simula could be chosen may have influenced the choice in Smalltalk
14:53sdegutis('just' meaning 'only' in this case, not 'fair')
14:53technomancyjuxt?
14:53clojurebotjuxt is usually the right answer
14:54technomancy~botsnack
14:54clojurebotThanks, but I prefer chocolate
14:54llasram~chocolate
14:54clojurebotactually I decided I prefer botsnacks after all.
14:54llasramnice
14:54llasram~botsnacks
14:54clojurebotNo entiendo
14:54llasramaww
14:55amalloysdegutis: that's just transpose, right? (apply map list names-and-emails)
14:55technomancysdegutis: yeah I don't think clojure has a notion of filtering by justice
14:55amalloyreturns two lists
14:55devn(filter just? ...)
14:55technomancyclojurebot: what is justice?
14:55clojurebotPardon?
14:55llasramIt needs to be a protocol
14:55technomancyclojurebot: justice is like a city
14:55sdegutisamalloy: ah yes, it is!
14:55clojurebotIk begrijp
14:56amalloy&(apply map list '((name email) (name email) (name email) (name email)))
14:56llasramSo we can support both Platonic and Rawlsian justice
14:56amalloy,(apply map list '((name email) (name email) (name email) (name email)))
14:56devn(extend-protocol Justice ...)
14:56clojurebot((name name name name) (email email email email))
14:56amalloyRaynes: lazybot is shirking duty again
14:56sdegutisamalloy: you win, kind sir
14:56amalloyi'd restart him myself, but i need to go teach a clojure class <3
14:56sdegutisamalloy: you have my thanks (go ahead, you can keep them)
14:57sdegutisI am slightly but only slightly worried about the performance of apply in this case.
14:57amalloysdegutis: don't be
14:57amalloywell
14:57amalloyi guess you are, necessarily, eagerly realizing the whole thing
14:58amalloybut you can't really help it. you have to either do that or walk the list twice (which also realizes it all)
14:58sdegutisOh, one more part of this question that makes it more fun (but don't answer it amalloy, I don't want you to be late to teaching that class):
14:58sdegutisI'd also like to be able to map them to some values via some functions, can that be combined with the transposition to make it shorter than doing bolth separately?
14:59technomancysdegutis: just comp it to list
14:59technomancycomp your transformation I mean
14:59sdegutisah yes
15:01sdegutisI wonder, if I interpose them, then do the transformation on each item (they're homogeneous) and then partition them back out into two lists, is that sane?
15:02augustlare there any solutions out there for parsing only the attrs of an xml/html tag? Example: " foo", " foo=bar", " foo='bar'" etc
15:02technomancysdegutis: interpose name/email into one list?
15:03sdegutistechnomancy: Yeah, say I just wanted to lowercase all these suckers.. is this technique pure insanity?
15:03TravisDsdegutis: It seems potentially hard to maintain. If, for example, you change the representation of emails or something later on
15:03technomancysdegutis: I would just (comp list (juxt lcase lcase))
15:04sdegutisAh yes, good points.
15:04sdegutisThank you, each and all.
15:08gfredericks(defn tjuxt [& fns] (fn [args] (mapv #(%1 %2) fns args)))
15:09sdegutisThis apply map comp list juxt thing is hard to fully grok.
15:12muhoothen use for list comps instead :-P
15:13muhooi found it easier to start with (for [] (-> ....)) type of comprehensions, then go with map/comp/juxt/apply stuff to show off, later.
15:14muhooand even still will find myself rewriting comp/map/apply stuff to use list comprehensions just to limit the wtf factor for anyone forced to read it later.
15:17sdegutisHmm, can this transpositioning even be done with (for)?
15:17sdegutis(Transposing I should say.)
15:17SegFaultAXsdegutis: I love using apply map comp list and juxt all in the same expression. :)
15:23TravisDsdegutis: You can get something similar like this: (defn tp-with-for [l] [(for [[x _] l] x) (for [[_ y] l] y)]). But this isn't very exciting
15:33trap_exitdoes :optimizations :advanced break "ns-lookup" ?
15:34trap_exitsince all the namespaces + defs are renamed
15:37llasramtrap_exit: You can't use namespaces at run-time in CLJS. They aren't reified
15:37TravisDCLJS is the clojure to javascript compiler?
15:37llasramThe good news is that only development tools should be dealing with that at run-time even on JVM Clojure, so there's probably a better way to do whatever you're trying to accomplish
15:37trap_exitllasram: yes, sounds like I have the XY problem
15:37trap_exitand should think more
15:38llasramTravisD: Well, by CLJS I just meant ClojureScript
15:38TravisDI love the XY problem
15:38TravisDllasram: Ah
15:39augustlhere's the finisher result, ref the regex group matching and replacing from earlier https://gist.github.com/augustl/9512228
15:40trap_exitreal problem: I'm developing a single page application in CLJS. current approach: I want to use one namespace per "page", i.e. a login-page, a help-page, a chat-page, a svg-editor page. These pages need to know about each other [so they can jump between apps] (and I can't have circular dependencies across namespaces). <-- how shoudl I be approaching thi sproblem instead?
15:40trap_exitllasram: ^
15:40dnolen_trap_exit: just don't organize your program that way
15:40trap_exitdnolen_: how should I organize single-page apps?
15:41dnolen_trap_exit: use a router
15:41trap_exitdnolen_: can you point me to a blog post / tutorial ?
15:41trap_exitI'd like to read something in detail
15:41trap_exitor even a chapter of a book
15:41edbondtrap_exit, see https://github.com/gf3/secretary
15:42dnolen_trap_exit: I don't have anything specific for you to look at beyond - https://github.com/gf3/secretary. Routing is a pretty well understood problem in client side applications - conventions in the JS world apply.
15:42trap_exitI don't understand.
15:42trap_exitIs this till a single page app?
15:42trap_exitit looks like multiple urls are being used
15:43dnolen_trap_exit: after the hash
15:43dnolen_trap_exit: the router is based on hash changes
15:44trap_exitdnolen_ , edbond , llasram : noted, thanks, I will study this.
15:45TravisDIs ClojureScript mature enough to use in production?
15:46trap_exitdnolen_ , edbond: is there a link where secretary is used ?
15:46trap_exitI see the documentation but no demo
15:47edbondtrap_exit, googling "clojurescript secretary" and found http://tomconnors.github.io/blog/2013/12/03/how-i-structured-a-clojure-plus-script-web-app/
15:48edbondtrap_exit, there is an example in readme - https://github.com/gf3/secretary#example-with-googhistory
15:49dnolen_edbond: huh never seen that post before, that's actually a pretty good writeup
15:49trap_exitsorry, I was lazy
15:49trap_exitand was looking for a live demo
15:49trap_exitbut I guess I should be less lazy and set it up myself :-)
15:49edbondhah, I never saw it too, google wins
16:07danlentzhello clojurians i have a question about creating a "def-like" macro
16:08danlentzdef is a special form so i cant source it to see how it parses its lambda list
16:08danlentzbut i'd like to create a simple defdynamic macro to wrap it
16:09danlentzwithout breaking the normal semantics of def
16:09danlentzie, all i need is to add ^:dynamic to its meta
16:09danlentzmaybe i should just do the def and then alter-meta! i think
16:10danlentzis that the general practice?
16:13gfredericksdanlentz: actually I'm not confident that would work
16:13gfredericks,(def foo 12)
16:13clojurebot#'sandbox/foo
16:13gfredericks,(.isDynamic #'foo)
16:13clojurebotfalse
16:13gfredericks,(alter-meta! #'foo assoc :dynamic true)
16:13clojurebot{:ns #<Namespace sandbox>, :name foo, :dynamic true, :column 0, :line 0, ...}
16:13gfredericks,(.isDynamic #'foo)
16:13clojurebotfalse
16:14gfredericksdanlentz: in any case what's wrong with (def ^:dynamic ...)?
16:14danlentzwell nothing i guess. i just thought it was ugly and it would be a straightforward macro
16:15danlentzin common-lisp the def* forms are all macros and it is trivial to enhance them
16:15danlentzthe business of def being a special form is a bit new to me
16:20danlentzand i kind of wanted a decent docstring too
16:20joelash(let [test "test"]
16:20joelash (cond
16:20joelash (re-matches #"*" test) true
16:20joelash :else false))
16:20joelashis there a reason why this doesn't work in clojurescript?
16:20katratxoninjudd: ping?
16:21gfredericks,(doc def)
16:21clojurebotI don't understand.
16:21bbloomdanlentz: how is a general purpose metadata mechanism uglier than a proliferation of extra def macros?
16:21gfredericksdanlentz: (clojure.repl/doc def) prints documentation
16:22katratxoi'm trying to use the lein-protobuf plugin without success, any hint will be apreciated https://dpaste.de/VV07/raw
16:22olegonHello! I need help with LISP (Scheme). Someone? It's about continuations.
16:22TravisDSeems like #scheme would be the more natural place to ask?
16:22kencauseyYes, and don't ask to ask, just ask the question
16:23olegonI need to create a GIST. Wait!
16:24justin_smithif people would just ask to ask to ask, they would know not to ask to ask
16:24olegonhttps://gist.github.com/olegon/c27e4692aed1f3dcef99
16:25olegonI'm confused. Why the second versions of "mmember?" calls "print"?
16:25kencauseyolegon: Good, not why aren't you asking in #scheme?
16:25kencauseys/not/now/
16:26joelashcan someone explain this behavior? https://gist.github.com/joelash/9515550
16:26olegonI'll join scheme. I learning Scheme thought "The Little Schemer" series to learn LISP, and then Clojure.
16:27llasramolegon: My analogy: that's kind of like learning Latin then Spanish because you'd like to learn French
16:29camelCaseIsUglyllasram: it would be a better analogy if there were unbelievably fantastic learning materials for latin, but somewhat mediocre materials for learning French
16:30danlentzbbloom: well as a general design pattern i have found it useful in other lisps to work toward higher level api and greater abstractions by creating ever more powerful and customized defining forms
16:30justin_smithIMHO scheme is more like esperanto
16:30edbondjoelash, tooMuchTestException?
16:30bbloomdanlentz: clojure is not other lisps :-P
16:30danlentzstart with defclass and gradually work toward defdatabase for example
16:30danlentzdefdatabase would be an api exposed to the user
16:30joelashedbond: haha, the answer .*
16:30bbloomdanlentz: generally, us clojure folks prefer to use data and functions over macros
16:31danlentzi see
16:31bbloomdanlentz: it's generally not common to see apps generating vars on your behalf
16:31danlentzits hard to believe that such a thing is impossible though
16:31danlentzevewn if not ideomatic
16:32bbloomdanlentz: it's not impossible at all
16:32bbloomit's just unsupported, b/c there is no reason to do it
16:32justin_smithin programming everything is "possible" in every language, and usually isn't idiomatic
16:32bbloom,(def asdf 1)
16:32clojurebot#'sandbox/asdf
16:32bbloom,(.setDynamic #'asdf true)
16:32clojurebot#'sandbox/asdf
16:32danlentzof course
16:32bbloom,(do (binding [asdf 2] (prn asdf)) asdf)
16:32clojurebot2\n1
16:33bbloomdanlentz: there, just did it ^^
16:33amalloy(inc justin_smith)
16:33amalloydangit lazybot
16:33danlentz.setDynamic?
16:33bbloomdanlentz: yeah, that's java interop.... mucking with the internals of vars
16:33bbloomwhich is a good sign you're not doing it right :-P
16:34danlentznice, though I appreciate the insight as well as the answer
16:34llasramdanlentz: The ^:dynamic metadata is an indication to the compiler to make the var dynamic when it creates the var. You can make it work in a macro, but adding it after the fact won't change anything
16:34gfredericks(inc llasram)
16:34danlentzah
16:34danlentzhow about the variables type?
16:34danlentzsame thing?
16:34bbloomdanlentz: what's a "variables type"?
16:35justin_smithvar does not have a type
16:35justin_smithdata has types
16:35llasramdanlentz: Type hints?
16:35danlentzyes
16:35amalloy(inc justin_smith)
16:35lazybot⇒ 28
16:35amalloy(inc llasram)
16:35lazybot⇒ 19
16:35bbloomdanlentz: type hints are just more metadata
16:35llasramHey, lazybot!
16:35llasramWell,
16:35llasramThey kind of mean different things in different places
16:35danlentzbut is there an analogous .setType interop method?
16:35llasramOh, no
16:35bbloomdanlentz: may i suggest looking at some existing clojure code to get a feel for how it differs from common lisp?
16:37danlentzunderstood. I consider that an essential practice. and i certainly embrace ideomatic coding in the language i intend to use
16:38danlentzbut not all practices need to be abandoned in one instant especially as i incrememntally build new ones
16:38bbloomdanlentz: there are lots of valid reasons for "defwhatever" style macros, and indeed, they are among the most common macros in real projects. however, it's dramatically less common than in common lisp
16:38danlentzok, we agree then
16:38danlentzi thought you were hardcore against it
16:39danlentz:)
16:39technomancyI wonder if defwhatever is more common than with-whatever
16:39bbloomdanlentz: i'm hardcore against defdynamic
16:39danlentzthe3y are much easier to implement (with macros)
16:39danlentz-wth-macros
16:39bbloomb/c if you're defining some many dynamics that you need a macro for it... you're defining N-1 too many dynamics :-P
16:39technomancyI like with-whatever because it's usually clearer what they expand to
16:40technomancywell
16:40technomancythey're clearer and they actually clean things up
16:41technomancydefroutes just being def+routes is clear enough, but it doesn't add any value
16:41danlentzwell it was really just supposed to be a simple prototype as i plan on implementing some more useful defining macros later
16:42danlentzi thought this would be a reasonably easy one to start with
16:42danlentznot that i desperately need a defdynamic macro
16:42technomancysure, as long as you don't subject other people to it =)
16:43danlentzactually my main project involves implementation of a context-oriented extension to clojure
16:43danlentzwhich incorporates a number of new concepts
16:43danlentzdeflayer
16:43danlentzlayered functions
16:44danlentzsome interesting things.
16:44danlentzim actually working on a high performance mechanism for ad-hoc composition of dynamic scopes based on the Patricia Tree
16:45danlentzwhich has considerable advantages over the way context orienteation is currentluy implemented
16:45danlentzin any langauge
16:45sdegutisOfftopic: What OpenID provider do you prefer to sign in with? I've only heard of people using Google, Yahoo, and StackExchange.
16:46iwilcoxI'm least reluctant to use SE but I'll just always jump to whichever seems smallest and least capable of collating info about me ;)
16:49danlentzRich Hickey was actually aware of Context Orientation when he designed the first versions of Clojure, and it was a motivation for him to add dynamic scoping to Clojure. See for example the transcript of a talk given in 2008 at http://jafingerhut.github.io/clojure-info/clojure-for-lispers-transcript.txt
16:49danlentzSo, in dreaming up possible ways to model contextual "layers" in Clojure, I've been considering a Patricia trie, which is an efficiently mergeable integer map that would provide a means of low-cost, on-demand composition of layers into a composite dynamic "context". This is potentially a significant improvement over the other existing implementations of context-orientation, the best of which, ContextL, uses class inheritance and dyn
16:49danlentzgeneration of class metaobjects to achieve the same purpose. Naturally, that technique carries quite a significant expense as compared to merging Patricia tries, not to mention being extremely multiprocessing unfriendly -- major portions of the metaobject protocol are linearized using giant, global locks. To be fair, ContextL does do a credible job of caching contexts once computed, so the penalty is only paid on the first access o
16:49danlentzgiven composite context. But even so, with caching being an imperfect art and the very expensive cost of any cache miss, there is some really great potential that developing this improved technique can make a useful contribution to the manner in which very efficient context oriented extensions can be modeled and integrated into clojure and dynamic languages in general. I have been discussing the matter with Pascal and he seems quit
16:49danlentzenthusiastic.
16:50TimMcThat was... excessive.
16:50llasramhuh
16:51danlentzmy apologies, then.
16:51technomancyI wonder if that predates his exposure to writing large-scale applications using lazy seqs.
16:52danlentzI have been consistently surprised by the versatility, power, expressiveness, and structure that context orientation lends to the programming model, which (for me) typically includes functional and object orientations. Context orientation is quite orthogonal to either of those, almost giving one the feeling of freedom in some "third dimension" if that makes any sense.
16:52danlentzContext orientation provides a first-class representation that one can use in a structured way to model different circumstances and behavior within that hierarchical framework that may vary based on them.
16:53technomancyI can barely keep two-dimensional programs in my head as it is
16:53danlentzand i thought leiningen was a hypercubical model :)
16:53technomancyit's all just maps and functions
16:54llasramI prefer to model all my programs as n-dimensional hyperplanes. I then constrain n to 1
16:54technomancyone single macro defined in the whole codebase, and it isn't even called internally
16:54technomancyno protocols or records
16:55danlentzSo the idea is to 1) express these contexts as a first class entity so we can manage, operate, and represent these contexts programmatically. 2) provide for flexibility to adjust the behavior or display based on the dynamic composition of contexts which may be active at a given point in time 3) maintain the structural and lexicographic correlation of code related to the specific app functionality and provide the means to organize th
16:55danlentzimplementation according to the logical correlation with the context for which it is needed, rather than scattered around in various places that the execution of the behaviourhappens to occur.
16:56justin_smithtechnomancy: I think clojure code is one dimensional, since the compilation unit is the top level form? not totally sure of that though
16:56danlentzan excellent an light reading description "Language Constructs for Context Oriented Programming"
16:56danlentz- http://www.p-cos.net/documents/contextl-overview.pdf
16:56justin_smiththough two dimensional layout of the one dimensional data is definitely helpful for organization
16:56TimMcdanlentz: Your messages are getting cut off. Each link in the IRC spanning tree reduces the max message size.
16:56technomancyjustin_smith: what if compile-time is one dimension and runtime is another?
16:57danlentzdo
16:57danlentzdoh
16:57TimMc"to organize th [] implementation"
16:57justin_smithtechnomancy: OK. Hmm. Let me go check my topos theory book and get back to you :P
16:58danlentztimmc: organize the implementation according to the logical correlation with the context for which it is needed, rather than scattered around in various places that the execution of the behaviourhappens to occur.
16:58danlentzsorry
16:58danlentzno wonder so few dissertations are authored using irc
16:58danlentz:)
16:59TimMcOK, I think it was just the "e" in "the".
17:00justin_smithhttp://esolangs.org/wiki/Befunge <- I am certain this language is two dimensional
17:00bbloomdanlentz: that was quite the rant, but i'm not in a position to complain about random irc rants.... anyway... i think that's a seriously backwards approach when compared to work on effect systems
17:00brehautjustin_smith: yes. its a 2d funge
17:01brehautjustin_smith: i dont know if anyone has made a usable 1d funge or a practical 3d funge
17:01sdegutis(inc llasram)
17:01lazybot⇒ 20
17:01justin_smithright, but that is not the usage of "dimension" that I assume others were using
17:01danlentzperhaps, although i suggest that judgement is somewhat cursory
17:01bbloomdanlentz: compare with "COLA Kernel Abstraction" on here http://www.viewpointsresearch.org/html/writings.php
17:01bbloomdanlentz: and also compare to http://math.andrej.com/eff/
17:01brehautjustin_smith: i think it kind of is, its jsut that funges are mind numbingly low level
17:01bbloomdanlentz: lastly, compare to http://okmij.org/ftp/Haskell/extensible/
17:02ztellmandanlentz: unrelated to all but the first bit, but for the patricia trie: https://github.com/ztellman/clj-radix
17:02bbloomdanlentz: might want to read those and reflect a bit before falling down a CLOS inspired rabbit hole
17:03danlentzi think you misunderstand the concept, but it is no matter as yet anyway
17:03danlentzztellman: hey zach. saw it
17:03justin_smithbrehaut: I feel dum. searching for phrases connecting to "dimensions" and programming languages / models is getting me nothing that looks like this conversation
17:03danlentzdid you do any further woprk on it?
17:03bbloomdanlentz: no, i understand it just fine. i've read that paper
17:03danlentzit was a bit spartain the last i looked
17:04ztellmandanlentz: it's completely functional now, I need to add some sugar to have both a clojure hash-compatible and non-compatible version
17:04danlentzoh, ok then
17:04ztellmanbecause non-compatible ends up being twice as fast
17:05danlentzztellman: i will take another look. i remember there was something that botherted me but now i cant recall for sure
17:05sdegutisIsn't Emacs a bit proponent of context-orientation?
17:05ztellmanhappy for feedback
17:05danlentzsdegutils in a very unstructured way
17:05ztellmanbbloom: will you be at clojure/west?
17:05bbloomztellman: yes
17:05sdegutisdanlentz: are you also TravisD by any chance?
17:05technomancysdegutis: sure, if you count buffer-locals. arbitrarily-defined contexts are more difficult to track in your head though.
17:06danlentzthe idea is to create a strctured first class representation that can be programmatically manipulated and composed
17:06danlentzthe structured model is he crucial bit
17:06sdegutistechnomancy: maybe I misunderstood context-orientation then, I thought it was basically using dynamic vars to change the meaning of functions (similar to how vim has "iw" or "a{" decide what "d" acts on).
17:07bbloomsdegutis: the idea is to do something smarter than dynamic scoping
17:07technomancysdegutis: oh, well... that's a bit different imo. dynamic defuns are very rare in elisp.
17:07danlentzno, it goes considerably deeper, but the essence is implemented based on the use of dynamicallyn scoped functions
17:08danlentzbut that is a lower level detail abstracted from the user
17:08mheldhey y'all
17:08mheldI have a TCP connection to a server that's spitting messages at me -- how would I use aleph to handle those messages?
17:08bbloomdanlentz: read the materials i linked you to. they are based on far sounder theoretical footing and yield dramatically simpler solutions to all the same problems as "context oriented programming"
17:08danlentzsdegutils: um no?
17:08technomancysdegutis: there are lots of behavioural changes that happen on a per-mode basis
17:09sdegutisdanlentz: ok just wondering
17:09ztellmanmheld: what does "handling" look like in your use case?
17:09danlentzbbloom: will; do, thanks for the l;ink!
17:09mheldwould I be creating a tcp-client, connecting to the server, then reading the messages off the channel that aleph creates
17:09technomancybut it's all pretty well-defined and well-scoped; once you set a mode upon buffer creation it's very rare to change it at runtime
17:09mheldztellman: I get a stream of messages that look like "!AIVDM,1,1,,A,83`e?lhj2d<d<=MvM@@hChLUp@00,0*6A"
17:09ztellmanmheld: first you need some way to split the messages
17:09mheldztellman: I need to transform that string into something I can work with
17:09ztellmangloss is one way to accomplish that
17:10ztellmanremember that TCP is stream-oriented, not message-oriented
17:10mheldztellman: I can do UDP messages, too
17:10ztellmanthat might be easier
17:10ztellmanthen you can just use receive-all on the channel you get
17:10ztellmanand do whatever you need with it
17:10ztellmanI can't infer what the format is based one what you pasted there
17:10mheldand it'd continue to work as more messages got sent to the socket?
17:10ztellmanyes
17:11mheldbeautiful
17:11ztellmanit's a callback that will get invoked every time a new message shows up
17:14mheldztellman: ha, awesome -- it works!
17:14ztellmanmheld: great, let me know if you have any other questions
17:14mheldwhat happens if I mis-parse something? would the exception kill the channel?
17:15ztellmanmheld: no, but it will log the error if you don't catch it
17:15seg_utilsdanlentz: such a computation model seems like it would be hard to hold in your head as you write code
17:15iwilcoxHmm, gloss looks handy. Was just looking at dissolve/concentrate for js earlier and thinking a Clojure equivalent would be lovely :)
17:16seg_utilsgloss?
17:16ztellmanseg_utils: https://github.com/ztellman/gloss
17:17gfredericksJohn Hughes
17:18gfredericksis his talk scheduled during the time slot where haskell evangelism is allowed?
17:18seg_utilsIs this nick easier to read btw?
17:18iwilcoxztellman: Hmm, and rhizome looks like it'll help with something else. I must pay attention here more often :)
17:19bbloomhughes keynoting? that's cool!
17:19seg_utilsztellman: that looks quite handy
17:19ztellmanw.r.t. gloss, the code itself is a bit creaky, though correct
17:19ztellmanthere's a rewrite brewing
17:20dnolen_gfredericks: Erlang QuickCheck evangelism more like it :)
17:22gfredericksyeah?
17:26danlentzwhat was the interrop to see if a var is dynam,ic?
17:26danlentzirc clienmt crashed
17:26danlentzdammit
17:26dnolen_gfredericks: all the talks I saw him do last year were bout Erlang QC, amazing stuff, want
17:27danlentzto verify .setDynamic worked
17:27ztellmanhe's pretty much a professional speaker/teacher about Erlang QC
17:27ztellmanor so the Basho guys tell me
17:28bbloomBronsa: or ztellman: or some other clojure-mad-scientist...
17:28ztellman?
17:28bbloomany idea how to implement deftype* and reify in my little interpreter thinggie?
17:29ztellmandunno what your interpreter thingy is
17:29bbloomi've done pretty much every other special form, but punted on those b/c they seem quite hairy
17:29bbloomztellman: https://github.com/brandonbloom/eclj
17:29ztellmanbbloom: oh, right, I was going to ask your opinion on https://github.com/ztellman/potemkin/blob/master/src/potemkin/template.clj
17:29ztellmanit's a compile-time syntax quote, more or less
17:29ztellmanas opposed to read-time
17:29ztellmanallows you to eschew gensyms, quoting, etc
17:30ztellmanapologies for the lack of doc-strings, wrote it up last night
17:30bbloomztellman: surely you looked at https://github.com/brandonbloom/backtick/blob/master/src/backtick.clj :-)
17:30ztellmanyes
17:30ztellmanthis is different, in that it uses the compiler's local context to validate the form
17:30bbloomztellman: compile time? so is this for lack of reader expressions?
17:30bbloomer i mean "feature expressions"
17:31danlentzah never mind. i needed to use (var symbol)
17:31ztellmanbbloom: this is because I'm tired of writing crap like https://github.com/ztellman/clj-radix/blob/master/src/clj_radix.clj#L175-L197
17:31ztellmanit's tedious, and easy to screw up, and difficult to read
17:31bbloomztellman: yeaaah, i hate that
17:32ztellmanthis allows you to use unquote and splicing-unquote, and verifies that declared external variables and arguments aren't shadowed
17:32ztellmanso no gensyms, no ~' to do anaphoric stuff
17:32bbloominteresting
17:33ztellmanyou can even templatize type hints
17:33ztellmanit's going to make my brand of code a lot cleaner
17:33bbloomdo you have an example usage somewhere?
17:33ztellmanI will by the time Clojure/West comes around :)
17:33bbloomwould you describe your brand of code as "HOLY META PROGRAMMING BATMAN"
17:33bbloom?
17:34ztellmaneh
17:34ztellmanoh, simple example: https://github.com/ztellman/potemkin/blob/041d4bf82850c27ff792468fb1f9ece3b10de6fa/src/potemkin/template.clj#L94
17:34ztellmanignore the misleading name
17:34dnolen_ztellman: heh, does that type hint in clj-radix actually work?
17:34dnolen_line 188
17:35ztellmandnolen: yeah
17:35bbloomztellman: i like the idea of explicitly declaring available names for such hackery
17:35danlentzbbloom: thanks for the assist
17:36danlentz(defmacro defdynamic [& [meta? name & value? :as args]]
17:36ztellmanbbloom in that example, (plus-one 1 2) would fail because there's no 'y' in the lexical scope
17:36ztellman(let [y 3] (plus-one 1 2)) would succeed
17:36bbloomyeah, i gotcha
17:36dnolen_ztellman: right, futzing around w/ primitives/arrays made me just avoid type-hinting like that.
17:36amalloydnolen_: working with macros makes me avoid type-hinting in any other way :P
17:36ztellmandnolen_ it's an utter pain
17:37bbloomztellman: i've only really ever run in to this sort of problem with java interop and (related) wanting to implement core interfaces that i realy wish were protocols
17:37bbloomif they were protocols, extend would be much preferable
17:38amalloyhinting values rather than names is just fraught with peril, because of http://dev.clojure.org/jira/browse/CLJ-865
17:38bbloomztellman: in the past, i've just done plain old non-syntax quote b/c i didn't need any lexical context
17:39ztellmanbbloom: right, but I write stuff like https://github.com/ztellman/clj-tuple/blob/master/src/clj_tuple.clj, which has three levels of unquoting and requires hackery like "unify-gensyms"
17:39bbloomie i wanted to not copy paste an impl for Associative or something, so i'd just write it once, quote it, stick it in a var, then write another macro to splice it in
17:39bbloomztellman: yeah, you're a mad scientist
17:40ztellmanbbloom: def-abstract-type can do that: https://github.com/ztellman/potemkin/blob/master/src/potemkin/collections.clj#L54
17:40bbloomwhich is why i asked if you have a good suggestion for dynamically creating a java class w/o having to do all the crazy shit that goes in compiler.java for deftype*
17:40bbloom:-)
17:40ztellmanfor the low, low price of using my code everywhere
17:40bbloomhaha
17:40ztellmanyeah, I dunno about the byte-code level of the whole thing
17:41ztellmanI tend to stay clear of that level of the machine
17:41bbloomi don't need bytecode level beyond emitting an "invoke" instruction to call in to my interpreter heh
17:41ztellmanhmm
17:41bbloomi just need to generate the class, add methods, etc
17:41bbloomshouldn't be too hard, but doing it by hand might be a pain
17:42bbloomit's the hairest part of the compiler from what i can tell
17:42ztellmanwhich is saying something
17:42ztellmanbbloom: why not just use a macro+eval for this? https://github.com/ztellman/potemkin/blob/master/src/potemkin/collections.clj#L54
17:42ztellmanwhoops
17:42seangroveztellman: Sure is. I've no idea what it's saying though.
17:43ztellmanthis: https://github.com/brandonbloom/eclj/blob/master/src/eclj/core.clj#L604-L648
17:43bbloomztellman: two reasons: 1) b/c a vim macro did the trick quite fast
17:44bbloomztellman: and 2) i'm going to be running that file using the interpreter inside that file :-P so i was trying not to do anything tricky
17:44ztellmangotcha
17:44bbloomand that's my eval, not clojure's
17:45bbloomi've got all this (and more) working: https://github.com/brandonbloom/eclj/blob/master/test/eclj/core_test.clj
17:45seangroveztellman: Was bummed not to see you at the last cljs meetup. You want to bring some of that batman-metaprogramming wizardry to the cljs world sometime and give a talk on it?
17:45ztellmanwell, dunno what the answer for deftype is, but it's a cool project
17:45ztellmanseangrove: clj proper keeps me busy enough as it is
17:46bbloomztellman: i suspect BronsAway is the man to ask
17:46bbloomi assume that's Bronsa's away handle
17:46seangroveztellman: Fair enough, the js world probably isn't ready for you anyway
17:46ztellmanseangrove: maybe once I get through the roughly six projects I have queued up, I can take a look
17:47ztellmanI'd like to delve into it, but I'd be starting from close to zero, my frontend knowledge is close to nil
17:47ptcekDoes anyone have an elegant solution to remove all siblings in zipper?
17:47bbloomptcek: step up to the parent and replace the children
17:48mdeboardwhat did I walk in on
17:51ptcekbbloom: thanks, simple enough :)
17:55bbloomztellman: ha! https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/jvm.clj#L250-L259
17:55bbloomseems Bronsa punted :-P
17:56ztellmanhaha
17:56ztellmanain't no one got time for deftype
18:03cbpI wonder what's a better way to write this: https://www.refheap.com/57247
18:04cbpIt's basically a function that doesn't let the user translate a window past the boundaries of an image
18:04amalloycbp: isn't that what cond-> is for?
18:05seangroveI was thinking as-> in case the conditions weren't mutually-exclusive
18:05cbpI have never used cond-> in my life regretabbly :S
18:05seangrovecond-> seems better though
18:05hyPiRionamalloy: yeah, that's the very reason cond-> exists in the first place
18:05cbpah
18:05cbpwell i feel silly now :P
18:06amalloyi've never used cond-> either; i don't need it since useful already has a version i like better
18:06amalloybut this is the poster-child for cond->
18:07pdkthat is so cond->escending
18:08stcredzerocond->ascending?
18:08pdktouche
18:09amalloywhat's it called when you send someone an email snidely suggesting they use cond->? cond-> sending
18:10justin_smithworks even better with core.logic/conde
18:10amalloynice
18:13sed-utilsI don't think custom user-macros are a good selling point for Clojure. Functions should generally be used instead unless they're really needed.
18:24bob2sure
18:25bob2taste is important in all aspects of programming :)
18:28dbaschring/compojure question: I'm redirecting the user to / after submitting a form. I'd like to send some status information in the request, but response/redirect doesn't take any parameters other than the path. What's the right way to do this?
18:30justin_smithdbasch: if data is meaningful for a longer duration than the current request, it should probably go in the session store
18:31dbaschjustin_smith: it isn't, it's just a confirmation that the form was processed correctly
18:31justin_smithif it is relevant to the current request, the target page should recognize the data as a request parameter
18:31justin_smithso you use that data in creating your redirect URL
18:32dbaschjustin_smith: good point, that makes sense
18:32justin_smith(redirect "target/page?form=complete")
18:32justin_smithor whatever
18:33dbaschgotcha, thanks
18:34justin_smithsometimes just checking the referer may be sufficient though
18:48sed-utilsAlthough I don't often miss it, it does feel like more convenient functionality is missing from ring/compojure to build up URLs like that.
18:48sed-utilsEither missing or well-hidden.
18:53justin_smithsed-utils: ring.util.codec/form-encode
18:53justin_smithturns a map into a query string
18:53chareDo you guys use Apache Kafka or RabbitMQ?
18:55sed-utilsjustin_smith: aha
18:55sed-utilschare: neither.. should I be?
18:55bob2kafka is very good
18:55cbpclojure agents eheheheh
19:01akurilinHey guys, does anybody know if it's possible to have Korma's compose (where) with OR rather than AND?
19:29Bronsabbloom: was just reading the backlog, I don't think it's going to be any fun trying to interpret deftype* :/
19:41gfrederickswhat on earth is bbloom up to?
19:43gfredericksclojurebot: what on earth is bbloom up to?
19:43clojurebotI don't understand.
19:43gfredericksclojurebot: what on earth is bbloom up to?!
19:43clojurebot'Sea, mhuise.
19:51cbp~what on earth
19:51clojurebotwhat on earth is bbloom up to
19:51cbp:-o
19:58gfrederickshuh
20:06isaacbwanyone played with GATE for NLP using clojure?
20:08dsrxisaacbw: i've played around with opennlp a bit, there are some pretty okay clojure bindings for it
20:12isaacbwdsrx: people seem to be suggesting that GATE is more "modern" than opennlp
20:18akhudekGATE is a very different thing
20:18akhudekmore of a framework with pluggable modules
20:19isaacbwakhudek: and I'm a bit confused about that. People (on StackOverflow, etc.) are suggesting it as an alternative to Stanford's Core NLP, OpenNLP, and NLTK
20:21shep-homeIs there a LIFO channel for core.async ?
20:22akhudekisaacbw: as far as I've been able to tell, it's a very different thing. It's primarily rules based rather than ML based, but does allow you to somehow plug ML modules in
20:22akhudekisaacbw: also includes a lot of workflow types stuff
20:23akhudekisaacbw: for nlp ML libraries, stanford's is probably the best (though GPL with paid commercial license), followed by ClearNLP and OpenNLP
20:24isaacbwwow, that license business really surprises me
20:25isaacbwbut yea, I think I'll just spend time with CoreNLP for now
20:25isaacbwthanks akhudek
20:49isaacbwis there a way to reset the repl environment?
20:49nightflystop it and start it again
20:50isaacbwthat it?
20:50seangroveisaacbw: There are some patterns that keep it clean, but that's the basic way, yeah
20:50isaacbwalright, thanks
20:50seangrove~reloaded
20:50clojurebotIt's greek to me.
20:51seangroveisaacbw: Check out http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded if you want to go further
20:51seangroveclojurebot: reloaded is http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded
20:51clojurebotRoger.
20:51seangrove~reloaded
20:51clojurebotreloaded is http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded
20:52beamsoi need to look at that
20:52seangroveThat's the problem with these bots. They're listening to everyone, and they still don't learn anything other than what you explicitly teach them :P
20:52beamsoreloading a repl that has database pooling in a namespace eventually expires all database connections
20:52akhudekbeamso: defonce on the connection object
20:53akhudekor pool rather
20:53akhudekthough it's not clear to me why the old pool wouldn't be garbage collected
20:53beamsoi define the database pool once and use it everywhere :/
20:54akhudekstill, if you bind something else to the symbol via a reload, one would think that the old pool would be garbage collected
20:56beamsohow would i bust the numbers out of a list if i was doing (max '(1 2 3 4 5)) ?
20:56amalloyakhudek: that's wrong in a number of ways. http://blogs.msdn.com/b/oldnewthing/archive/2010/08/09/10047586.aspx is one good perspective on why
20:57bob2beamso, bust?
20:57isaacbwwhy do I need to do this (require '(ring.mock (request :as request))) instead of this (require '(ring.mock.request :as request))
20:57akhudekright, of course delayed garbage collection can be very much delayed
20:57beamsobob2: reduce (max '(1 2 3 4 5)) to (max 1 2 3 4 5)
20:57amalloyisaacbw: because of prefix lists. you want [] rather tahn () for the innermost list
20:57beamsoso that i can get 5
20:57amalloybeamso: apply
20:58beamsoamalloy: thanks!
20:58amalloyor reduce! a word you even used in your question!
20:59beamsod'oh
21:00isaacbwamalloy: oh! So require handles a [] and () differently?
21:00amalloyyes
21:00isaacbwcool beans, thanks
21:01isaacbwwhile I was doing that, I discovered that M-[ is undefined. Shouldn't it wrap with [] using Paredit?
21:02amalloyisaacbw: you can bind it to do that, of course, but i think the reason it's not bound by default is it's really hard to send a M-[ combination over ssh. ansi escape codes or something
21:02bob2other option is M-S-@ to select the sexp then [ to wrap it
21:02amalloyi bind C-c [ to paredit-wrap-square
21:02bob2ah nice
21:03amalloyM-S-@ isn't a keybinding that exists, right? S is shift, so you're just talking about M-@
21:03amalloyand in my emacs setup M-@ is bound to mark-word, not mark-sexp or anything useful
21:04amalloy(whereas C-M-SPC is bound to mark-sexp, so you could use that)
21:04bob2erk, M-C-@, you're right
21:04bob2didn't realise C-M-space was bound to the same thing
21:05amalloyC-M-@ sounds like it would be pretty hard to type!
21:06bob2with caps-as-ctrl it's not too bad :)
21:06bob2but suspect I'll be -space ing from now on
21:06amalloyit's still three modifiers
21:07amalloybob2: i'm glad to know about C-M-@ too, though. C-M-SPC doesn't really work over ssh, just like M-[ doesn't
21:07amalloyand since i have my number and symbol keys swapped, C-M-@ is actually only two modifiers for me
21:07amalloyso maybe i'll switch to that
21:08bob2ooooh, interesting
21:16beamsoeveryone is using emacs?
21:16stcredzeroDoesn't count unless you also use crayons
21:17beamsojust mechanical pencils...
21:17amalloyemacs is most popular, but #clojure has room for even the wackiest of editors
21:18iwilcoxI'm a long-time vim user, but only enough to be functional, not good (they say the first ten years are the hardest; I'm past ten) and Clojure from vim seems painful. Was just mustering the motivation to install and configure all the emacs stuff and start over, when I start paying attention here and someone mentions LightTable.
21:19beamsooh dear
21:19akhudekI am uncool and use cursive too
21:19beamsoi have used emacs for clojure
21:19stcredzeroDoesn't count unless you start an editor apocalypse that spans multiverses
21:20iwilcoxbeamso: Very occasionally, in the right room, with the right participants and the moon in the right phase, these discussions *don't* devolve to wars :)
21:20zspencerIn the beginning was the term, and it was without form and void
21:20mlb-iwilcox: there's the fireplace plugin for clojure. It works pretty well for me
21:21mlb-err, for vim, I mean
21:21stcredzeroiwilcox: actually reality breaks down at the quantum levels, and everyone's consciousness is cast into utter pain and despair for aeons. It's just that in deep time, all realities get reconstituted by trolling Boltzmann brains.
21:21iwilcoxI took part in a totally war-free, constructive discussion of languages on #bitcoin for about 45m the other day. It does happen.
21:22stcredzerozspencer: lies. I've programmed by flipping 8 switches and hitting a commit button
21:23beamsoi'm assuming stcredzero meant http://en.wikipedia.org/wiki/Altair_8800
21:23iwilcoxmlb-: I'll add it to my list of Interesting Things to Look Into, thanks. (Although I don't think I'd really miss vim all that much, truth be told.)
21:25zspencerstcredzo truly you are the greatest programmer
21:26isaacbwakhudek: do you have any idea how much a commercial license is for CoreNLP?
21:27akhudekisaacbw: I seem to recall that just one of the components was 6k a year, but wasn't able to find that number when I looked a second time
21:27akhudekclearnlp is a very good alternative for what it covers btw
21:27akhudekand has a good license
21:28isaacbwalright, I'll look into it!
21:29muhooyou used switches? feh, back when i was a kid we had to use all 0's, didn't even have 1's.
21:29TravisDTwo consecutive zeros meant a one. heh
21:29isaacbwonly trouble is you can have nothing but consecutive zeros
21:29TravisD:D
21:29isaacbwthat's where you have to be clever
21:29muhooyou can phase encode the 0's
21:30TravisDAn ordering is fixed on the set of all turing machines, and the number of zeros picks out one of the machines!
21:30muhoothat's a thing of beauty
21:31isaacbwall possible programs exist and are identified by a number
21:31muhoowhat is this, godel, escher, bach?
21:31TravisDNah, more of an eternal braid. Perhaps made of gold.
21:32newhackI think they refer to book http://en.wikipedia.org/wiki/G%C3%B6del,_Escher,_Bach
21:32isaacbwwhich I've still yet to read, despite it being on my shelf for years
21:33newhackWell it's been on my 'to read' list for decades so I don't know if that is better or worse
21:35tomjackit's probably the reason I am here
21:35TravisDLike, here in this channel? Or here in this world?
21:47dsrxhe means the dynamically bound "I", the one set by the person reading it
21:47gfredericksmaybe he's at a G.E.B. discussion group
21:48amalloygfredericks: or his parents met at a G.E.B. discussion group
21:50gfredericksmaybe somebody at the G.E.B. discussion group told him about freenode
21:50mr-foobartwo om questions (truly a genre bending framework) .... Q1. Can I set :initial-state for the component that I am rendering in om/root ?
21:51tomjackno, but my middle school girlfriend's parents met in a GEB college class..
21:51hiredmanmaybe hofstadter finally did it
21:51hiredmantomjack: so you are not an ai built by hofstadter?
21:51tomjackI don't think so :(
21:54gfredericksit's a tricky one to rule out
21:54pjstadigtomjack: that's exactly what an AI built by hofstadter would say!
21:55hiredmangfredericks: indeed, how could he prove the negative?
21:56gfrederickspjstadig: I dunno I'd expect a lot more puns
21:56gfrederickshow can you say "I don't think so" using three words that start with G, E, and B?
22:01bbloomBronsa: so it seems
22:01bbloomi may or may not attempt it
22:26TravisDDoes anyone have comments on my sparse vector implementation? I'm looking for comments on both style and efficiency
22:31isaacbwwould anyone be interested in mentoring a project to write a clojure for clearnlp?
22:31isaacbw*library
22:31isaacbwgsoc
22:38akhudekisaacbw: what did you have in mind for a library?
22:39isaacbwI'm pretty self-sufficient, so most of what I would need from a mentor is API design feedback, as I'm still pretty new to Clojure
22:39akhudekI already have some light bindings to clearnlp that I could release as open source
22:40isaacbwakhudek: something that exploses nltk-like simplicity for clearnlp
22:40akhudekisaacbw: the hardest parts of clearnlp to me are working with the generated trees
22:41akhudekin any case, I might be up for being a mentor
22:41akhudekdepending on how much time it would take up
22:41isaacbwso maybe part of the project could be coming up with a tree structure that's more clojure-friendly
22:42tomjackI wrote something like that for corenlp, which was horrible
22:42tomjackhopefully clearnlp is better..
22:43akhudekI haven't worked with corenlp, but clearnlp is "ok" to work with
22:43akhudekthe biggest problem I have with it is that the tokenizer doesn't give span information
22:43akhudekso you don't know here in the original string a token comes from
22:44akhudekesp. because the tokenizer sometimes expands tokens or contracts them, e.g it converts the greater-than-or-equal unicode into =>
22:44akhudekor >= rather
22:45tomjackhttp://nlp.stanford.edu/nlp/javadoc/javanlp/edu/stanford/nlp/util/TypesafeMap.Key.html
22:45akhudekok clearnlp is better :D
22:45tomjackI used to think this was absurd, now I realize I've considered doing similar stuff lately :(
23:11amalloyTravisD: i don't know where i would find that implementation to comment on it
23:18TravisDamalloy: Aha! oops :) https://www.refheap.com/57522
23:19danielszmulewiczseangrove: ping
23:19amalloy(if x nil y) is pretty gross. you should be able to flip the relational operator and get (when not-x y)
23:19seangrovedanielszmulewicz: Asking about ReactWithAddons? :)
23:20danielszmulewiczno!
23:20danielszmulewiczseangrove: am i disturbing?
23:20amalloyv-apply-cwise-indexed strikes me as a terrible name
23:20seangrovedanielszmulewicz: No, working on an interesting project right now. What's up?
23:20amalloyit's both long *and* uses inscrutable abbreviations
23:21seangroveamalloy: If it was misleading, it'd be a trifecta
23:21danielszmulewiczseangrove: Just a quick something...
23:21TravisDhehe :D
23:22danielszmulewiczseangrove: I was wondering if I should use an Om component for something like a HTML5 button, or if that would be overkill.
23:22seangrovedanielszmulewicz: It depends on what you're doing. I can see some use cases for it
23:22rational`I'm trying to record some sounds to a WAV file, could someone
23:22rational` help with with what i'm doing wrong:
23:22rational`I'm trying to record some sounds to a WAV file, could someone
23:22rational` help with with what i'm doing wrong:
23:22rational` https://gist.github.com/rationalrevolt/9521087
23:23amalloyotherwise i'd say, seems like a reasonable attempt to write generic math ops for vector types
23:23seangrovedanielszmulewicz: If you're just doing a basic app with standard css etc., I wouldn't make it a component
23:23danielszmulewiczseangrove: I mean, there are parts of my application that could be implemented with OM, but a couple of dommy/jquery type of thingies would do the trick.
23:23rational`I'm trying to record some sounds to a WAV file, could someone help with with what i'm doing wrong: https://gist.github.com/rationalrevolt/9521087
23:23TravisDamalloy: Thanks for the recommendations
23:23danielszmulewiczI'm not sure about the cost of having om components everywhere...
23:24seangrovedanielszmulewicz: Sure. What're you thinking about doing with Om vs dommy/jquery, and is this in an existing app?
23:24amalloythe multimethod approach doesn't seem super-extensible, in that if you introduce N ways of representing a vector, you have to write N^2 add operators...
23:24amalloythat's fine if extensibility isn't a goal
23:25danielszmulewiczseangrove: well, I have an initial page that loads when the user is not logged in, there I have links to log-in and authorize, both require an event listener and a handler.That's it. Would an Om component be justified in this case?
23:26seangrovedanielszmulewicz: Oh I think so, definitely
23:26TravisDamalloy: I chose the multimethod thing because many of the algoriths should actually depend on both types
23:27danielszmulewiczseangrove: Cool. I was worrying about the cost of introducing Om for this, but I have not checked this. Thanks. I think I'll go with it.
23:27seangrovedanielszmulewicz: It forces a little bit of a pattern on you, but it's otherwise tiny enough that it's not much overhead. And it's a good start to a SPA especially (the login form becomes a component eventually, etc.)
23:27seangrovedanielszmulewicz: Sure, let me know if you have any questions
23:28danielszmulewiczseangrove: Yeah, that makes sense. Cool. Thanks again. Sorry for the bother.
23:28seangroveNo bother at all
23:28mr-foobarseangrove: hey can I ask you an om specific question ?
23:28seangrovemr-foobar: Sure, but just ask in general
23:30mr-foobarseangrove: actually two questions :) 1. Can I set :initial-state for the component that I am rendering in om/root ?
23:31danielszmulewiczmr-foobar: according to the documentation, no: https://github.com/swannodette/om/wiki/Documentation#wiki-root
23:32seangrovemr-foobar: What are you trying to do with the root component?
23:34mr-foobaroh. well I'm trying to secretary routes and I just have two routes that could use the same root component in different states
23:34seangrovemr-foobar: In general, the root component should be the same
23:35seangroveOr at least, that's one pattern that works for us
23:35seangroveIt should determine which "dominant component" to render - a login screen, settings screen, the app itself
23:35seangroveAnd secretary routes just send messages to the controller, which updates state, which tells the root component which dominant component to render
23:38mr-foobarseangrove: are you suggesting I use a channel to communicate with secretary ? that does sound like it would solve the problem !
23:38seangrovemr-foobar: https://github.com/sgrove/omchaya/blob/master/src/omchaya/routes.cljs
23:39danielszmulewiczmr-foobar: yes, let your Om component be able to deal with any routes.
23:39danielszmulewiczmr-foobar: https://www.refheap.com/56178
23:42mr-foobar*_* awesome !! you have code for backbutton too, i was wondering about that.
23:42mr-foobarhow do I give irc karma here :)
23:44mr-foobar( map inc seangroove danielszmulewicz)
23:44danielszmulewiczmr-foobar: your back button is served: https://gist.github.com/danielsz/8086074
23:45danielszmulewiczmr-foobar: enjoy :-)
23:49mr-foobar:D Q2) From what I understood from om/wiki/Basic Tutorial and the way I am putting that to code is, I am treating the (go ... recur) in the main-component' IWillMount as the central place for all event handling.
23:51mr-foobarsound fair enough right ? I have about 8 events that I generate, so far and I'm using a cond in the go block to do the processing
23:51danielszmulewiczmr-foobar: sounds good to me.
23:54mr-foobardanielszmulewicz seangrove thanks ! om+core.async is definitely giving a new way to reason code. I jquery my code would have already been a noodle bar now.
23:55seangrovemr-foobar: I would recommend giving Omchaya a look to see how event routing is handled there. We do it quite differently, and it scales (in terms of code complexity) very well
23:55seangrovemr-foobar: Take a look at the flow diagram https://github.com/sgrove/omchaya#omchaya-design
23:55seangrovemr-foobar: And then what a controller ends up looking like https://github.com/sgrove/omchaya/blob/master/src/omchaya/controllers/controls.cljs
23:57danielszmulewiczmr-foobar: always prefer seangrove's recommendation over mine. Omchaya is much more thorough than what I suggest.
23:58seangroveI just suggest what's worked for us, it's certainly not gospel :)
23:59mr-foobarseangrove *_* seems like a whole new (shift paradigm) you are doing there ...