#clojure logs

2014-04-13

01:24jph-so i have an 'entry' function 1 (get-ticker) that then calls function 2 (public-api-call), which calls function 3 (api-action)
01:24jph-from a testing point of view, i should be writing tests for each call, not just function 1
01:25jph-are there any libraries that have that type of function chaining with good tests to read through?
02:307F1AAALOSgfredericks: that's cool, but my problem with that is that the wall-clock test duration is not necessarily linear in the number of times you run the test
02:307F1AAALOSwtf
04:42derek_cWhen specifying dependency versions, what's the canonical way to tell lein "any version greater than X.Y.Z will do?"
04:46derek_ci.e. how do you specify a minimum version number?
06:50rowthso, I've been looking at a permgen issue which I thought might be related to http://dev.clojure.org/jira/browse/CLJ-1152 but I'm not so sure anymore. Basically I'm using the reloaded workflow pattern (via stuart sierra's component library), and after N reloads (depending on max perm size) the lein repl session runs out of perm gen space. I thought I'd traced it to the protocol leak (heap dump showed _methodImplCache holding references t
06:53wagjorowth: I run out of permgen too sometimes, when reloading namespace a lot. Haven't looked into the cause yet.
06:54john2xhelp, I ran (midje.repl/autotest) in my repl, and now I can't stop it. How can I stop it without restarting my repl?
06:54john2xCtrl-C doesn't do anything (it's a cider repl)
06:55wagjorowth: maybe after protocol is redefined od protocol and its methods are leaked.
06:55rowthwagjo: ahar, ty - I've been working around the issue by using a large max perm size in development, but our devs are gradually getting familiar enough with clojure to be comfortable running extremely long lived repl sessions, so I'm getting more and more questions about why we're dying from permgen leaks
06:55wagjo*old
06:57rowthwagjo: well, in my early tests I found that the component/Lifecycle protocol was holding on to many instances of my classes (my namespaces were being reloaded), so I applied the -reset-methods workaround, which clears the __methodImplCache, and indeed the heap dump changed dramatically, but only to reveal another path to a gc root
06:57wagjorowth: from my experiance you should not reload namespaces with defprotocol in it. It breaks things, as existing deftypes will point to the old protocol and such. methodimplcache is used in protocol methods.
07:00rowthwagjo: yep - we brought in the reloaded workflow for that reason; tools.namespace handles reloading the correct namespaces. the impl leak seemed to be in namespaces that we weren't reloading (i.e. defprotocol wasn't being reloaded, but the extend-protocol calls were), but as I say, even clearing the methodImplCache simply reveals a new path. What confuses me about the pastebin I linked is that eanlp$reset is "just" a function (not on a
07:01rowthwagjo: I'd read that, in a repl, each top level form gets it's own classloader
07:01rowthwagjo: but in this case, it's _almost_ as if each top level form gets its own classloader which is a child of the previous forms classloader, or something like that, since I assume that the multiple instances of eanlp$reset that I'm seeing are being created on each namespace reload
07:02hugoduncanrowth: you might try adding "-XX:+UseConcMarkSweepGC" "-XX:+CMSClassUnloadingEnabled" to your :jvm-opts
07:03rowthhugoduncan: already done I fear...
07:03rowthI _do_ see classes being unloaded
07:03rowthbut not all of them
07:03rowthanything that's part of the system-map seems to end up being kept
07:04rowthand I don't think it's neccessarily the component library itself, so much as something about the way I've hooked it up or some such - component doesn't have anything involving classloading etc. in it
07:06john2xis there a function to create a hash-map from a record?
07:07hugoduncanrowth: I don't see your pastebin
07:08rowthhrm, it works from both my machines, even if I'm not logged in: http://pastebin.com/ThddJ6J4 (in case I fluffed it above)
07:09rowthI signed up 20 minutes ago to create it though, so I confess I know very little about pastebin. Definitely seems public though
07:12rowthhugoduncan: what about https://www.refheap.com/75710
07:15hugoduncanrowth: thanks, I can see both of those
07:27hugoduncanrowth: I don't know much about component, but clojure does use new classloaders to evaluate things. See around line 6673 of Compiler.java
07:30rowthhugoduncan: thanks! I'll have a look
07:34hugoduncanrowth: note also that DynamicClassLoader uses SoftReference to hold its members
07:35rowthya - I've been using eclipse MAT to exclude those
07:35rowthin the chain I pasted earlier, it seems that some classes are making it to the base URLClassLoader impl
07:35rowth(going by the property names)
07:35rowthwhich seems to use a hard reference
07:36rowth(base in the sense that dynamic classloader extends it, not the system / app classloader)
07:49Bronsaambrosebs: ping
07:49ambrosebsBronsa: sup
07:50Bronsaambrosebs: just FYI the same guy who reported the :host-interop bug, said he got a similar error wrt :reify
07:52ambrosebsBronsa: yea just saw. Pondering reify again.
07:52dbushenkohi all!
07:52dbushenkohow to restrict access to some routes in Ring application?
08:02scape_you need authentication, take a look at "friend" perhaps
08:02scape_authorization, rather
08:02dbushenkono, I need only authorization. I already have authentication
08:02dbushenkois there any standard way for routes restricting?
08:03scape_not that i know of, but it wouldn't be too hard to roll your own
08:04scape_hve you looked at friend?
08:04scape_https://github.com/cemerick/friend
08:05scape_it may give you some ideas
08:06dbushenkoyeah, I had a look at it but I don't like it actually
08:06dbushenkoits too fast, has looooots of dependencies which conflict with mine
08:07dbushenkoyou know, the version hell in a maven project
08:07dbushenkonot so easy to manage all those conflicts
08:07dbushenkoI just wanted to know if there is any standard way of restricting, may be a ring feature or middleware
08:08dbushenko* too fat
08:08scape_not that ive seen
08:08scape_https://github.com/niwibe/buddy
08:09scape_that may be something, it just popped up on search
08:09scape_good luck
08:09dbushenkonice example, thanks!
09:19paulswilliamsesqHiya, anyone avaiable to offer a little advice about number representations in clojure?
09:27jkjpaulswilliamsesq: shoot away. not that i necessarily know anything, but i'm also interested :)
09:28paulswilliamsesqjkj: sorted it now.
09:30paulswilliamsesqI had a series of numbers, sometimes decimals, some times ints, and I wanted to convert them all to ints. I started by using the floor function which sometimes returns an int, sometimes a decimal, and then format to ensure all decimal points were not shown. However, I felt uneasy about using string formatting to do math - but found that actually the (int (floor blah)) is all that's needed
09:42wagjopaulswilliamsesq: AFAIK floor gives you a floating point, not decimal number.
10:39perseshello
10:39persesi got lein run
10:39persesNo :main namespace specified in project.clj.
10:40perseswhat maybe cause this problem?, it's just a simple hello world
10:51paulswilliamsesqHiya, anyone done any GIS / OSM stuff in Clojure before?
11:03samratperses: you need to add a :main to your project.clj: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L182
11:04samratoh, just realised that he's already left the channel.
11:15persessamrat: mean me?
11:16samratperses: yeah. did your problem get resolved?
11:17ptcekAny recommendations for lightweight plotting library? I am using incanter and thus jfreechart, but it's a bit too much for getting one line plot...
11:18persessamrat: nope
11:18samratperses: did you see this: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L182
11:18samrat?
11:19ToBeReplacedptcek: highly dependent on use case... i think JFreeChart direct is probably what you're looking for thoguh
11:19ptcekuse case - get data from DB, make simple XY/line chart and send in bitmap via email
11:20ToBeReplacedptcek: JFreeChart sounds like a good fit
11:20ptcekI am looking into jfreechart but I do not like the fact I need Xvfb or something similar running on the server
11:21ptcekbut maybe if I invest some time into it it will be ok at the end :)
11:22ToBeReplacedptcek: understood, i can't be helpful there... i know that with matplotlib (python) there's a way to disable the x server requirement, so i wouldn't be surprised if there's something similar for jfreechart
11:23ToBeReplacedptcek: i'd be interested in what you end up using though; i stay away from tasks like that on JVM just because of familiarity on the python side... would be good to know if you found clojure/jvm tooling effective
11:24ptcekI think clojure is overkill for the task
11:25ToBeReplacedhobby project question -- anyone know a lib that parses the "Accept" header? ex. (content-type my-allowed-types (get-in request [:headers "Accept"])) returns "text/html" ?
11:52seangroveJust going to leave this here as a note about the challenge of marketing tech at entry-level js developers https://news.ycombinator.com/item?id=7581385
12:07icarotI honestly couldn't understand the ad-hoc contortion of English in that post.
12:08icarotThe reasoning was just wrong, yet expressed so lazily that I couldn't construe why.
12:36vermausing om/set-state! how do I set multiple values? the functions accepts korks, but only one value (which could be a sequence?) (om/set-state! [:name :age] ["Dave" 23]) ?
12:37vermahmm, doesn't work
12:40verma,(assoc-in {} [:hello :world] 1)
12:40clojurebot{:hello {:world 1}}
12:40vermaoh
12:41vermawhen om/set-state accepts multiple keys its basically a path into nested structure
12:41verma,(:hello/world {:hello {:world 1}})
12:41clojurebotnil
12:42verma,(:hello/:world {:hello {:world 1}})
12:42clojurebotnil
12:42verma:P
12:59seangroveverma: Yup, you got it
12:59seangroveYou'll need to make multiple calls
13:07icarotI think that's bizarre default behavior. As if the number of keys should imply the depth of the structure; just odd.
13:09seangroveicarot: ? It's a wonderful and beautiful thing, not exploited to its full potential yet
13:09icarotHmm.. I suppose in my naiveté of Clojure idioms I'll take your word on it.
13:10mi6x3mhey clojure, why is ::x called an auto-resolved keyword?
13:10mi6x3mI understand the use in destructuring
13:10mi6x3mbut is this the only thing?
13:10Bronsa,::foo
13:10clojurebot:sandbox/foo
13:10Bronsami6x3m: it resolves the namespace part as the current namespace
13:11seangrovemi6x3m: It's nice for 'private' keys in a map that you might not want to expose outside of a namespace and are (almost) guaranteed to avoid accidental collisions with existing keys
13:11mi6x3mBronsa: got it, thanks
13:11mi6x3msomething completely different
13:34arrdembbloom: so are you joking about eval with bindings or not.. I can't tell
13:34arrdembbloom: context, NREPL-50
13:39bbloomarrdem: why would i be joking?
13:40bbloomarrdem: i need a per-message setting that doesn't require evaluating user-provided code
13:40arrdembbloom: that's entirely reasonable to me, I'm frankly surprised that we don't have an eval with bindings.
13:41bbloomarrdem: well, it's pretty easy to to eval `(bindings [~@bindings] ~expr)) from the client, but i need the bindings to take effect BEFORE evaluation
13:42bbloomb/c i'm binding the evaluator :-)
13:42arrdemhehe
13:42bbloombut even then, it seems like you might want to set bindings for messages other than eval
13:43arrdemjust read your patch... cute. yeah... I think that more generalized bindings is potentially reasonable
13:44bbloomyeah, i'll leave a more general mechanism to cemerick, he knows best & has the context of piggieback to validate with
13:45ToBeReplacedchecking again since more around -- is there a lib to parse Accept, Accept-Charset, and Accept-Encoding? ex. (select-charset allowed-charsets preferred-charset accept-charset) => "ISO-8859-1" ?
13:46arrdemis there a clojure-dev policy on closing abandoned tickets? I'm seeing Jira issues from 2010 still sitting around untouched...
13:47hyPiRionarrdem: is the issue fixed?
13:48arrdemhyPiRion: doubt it... but everything related thereto is 404 http://dev.clojure.org/jira/browse/CONTRIB-19
13:49Bronsaarrdem: I wouldn't care much about CONTRIB
13:49arrdemBronsa: but... open issues man... :P
13:50arrdemI was just skimming the open issues list and noticed it. Haven't been really active on Jira so I thought I'd ask.
13:50hiredman /win 23
13:52Bronsaarrdem: meh. Just mail Alex and ask him to delete the JIRA project altogether
13:52brainkimAnyone use test.check? I'm having a lot of trouble figuring out the difference between gen/fmap vs gen/bind. Maybe it's cuz I'm missing my type signatures or something :p.
13:52arrdemBronsa: 'kay. (cons #'arrdem/todo)
13:53arrdemclojurebot: test.check is test.chuck
13:53Bronsalol
13:54arrdemBronsa: https://github.com/fredericksgary/test.chuck
13:54Bronsalol@Usage
13:54Bronsa(inc gfredericks)
13:54lazybot⇒ 49
13:54arrdemkinda wish I was making that up...
13:54hyPiRion(inc gfredericks)
13:54lazybot⇒ 50
13:55gfredericksarrdem: stop wishing my vaporware away
13:55arrdemgfredericks: hahaha
13:55arrdem(inc gfredericks)
13:55lazybot⇒ 51
13:56gfredericksI'm gonna make test.chuck a real thing once reiddraper sees the light wrt gen/for
13:56arrdemI have a wrench named the pursuader if you need to borrow it... /s
13:59reiddraperbrainkim: use fmap when you want to return a _value_ from the supplied function. Use bind when you want to return a new _generator_
14:02brainkimAHHH
14:03brainkimreiddraper: I felt like I was going insane for a sec.
14:03brainkimso like map vs flatmap in scala
14:03brainkimthanks!
14:04reiddraperbrainkim: identical
14:04gfredericksdid we just discretely mention the list monad?
14:05brainkimThis is so much easier when I can just follow the type signatures of function parameters.
14:05arrdemgfredericks: types... monads... yep.
14:05brainkimIsn't clojure's equivalent of flatmap actually.. like.. mapcat or something?
14:05gfredericksyep
14:05arrdemmapcat is a thing...
14:06bbloombrainkim: and clojure's for macro is essentially the same as scala's for syntax, but clojure's only works on sequences, not arbitrary implementations of map/mapcat
14:07brainkimthat really annoyed me when I started working with clojure. I thought scala's for comprehensions were more elegant. I'm not so sure anymore.
14:08bbloombrainkim: personally, i'd rather force all monadic usages of the for sytnax through the list monad so that i can debug the internal state of the traversal
14:08hyPiRiondifferent design decisions
14:09gfredericksbbloom: I'm curious what you think of for for generators in test.check then
14:10bbloomgfredericks: i talked about this with reiddraper :-) i think that the monadic code is a reasonable substitute for the lack of proper delimited continuations & an effect system
14:10bblooma situation i am actively working to remedy ;-)
14:10gfredericksbbloom: is a for macro a good fit there then?
14:11bbloomgfredericks: the for macro is basically just the do syntax
14:11gfredericksyes I know
14:11bbloomgfredericks: i dunno for sure, but i imagine test.check makes lots of use of lifting & fmap and other higher-order non-syntactical monadic operations
14:11bbloomwhere for isn't all that useful
14:11brainkimbbloom: I think the really cool thing about for comprehensions in scala is that we use the same api for sync and async, i.e. you get to map/flatMap stuff over rx observables and futures, using the same for comprehension.
14:11gfredericksfor can be used for fmap
14:12bbloomif i were writing it in clojure, i'd probably just use map and mapcat instead of fmap & friends
14:12bbloomactually, i'd probably use my transduce library w/ map-state and mapcat-state
14:12bbloombut i'm a crazy person
14:13bbloombrainkim: that's theoretically neat, but you're lucky in scala land that you have the cps compiler transform. use that instead of forcing your code in to monadic style :-P
14:14brainkimwhy not both? :-}
14:15bbloomb/c if the language designer intended for you to write all your damn code inside monadic comprehension syntax, then he wouldn't have given you the val keyword or the let form :-P
14:15brainkim:-}
14:21mi6x3mBronsa: can you also helped me with prefixed keywords?
14:21mi6x3mwhat is their significance?
14:22arrdemmi6x3m: namespaced keywords?
14:22mi6x3marrdem: :x/a
14:22mi6x3mthe let docs say it's "prefixed keyword"
14:22mi6x3mbut it looks like a namespaced keyword yeah
14:23gfredericksfuzzy terminology
14:23arrdemmi6x3m: yeah. namespaced or prefixed keywords. No special significance... just use of clojure namespace syntax in a keyword.
14:23mi6x3marrdem: for some special reason?
14:23arrdemmi6x3m: note that ::foo prefixes to :*ns*/foo
14:23gfredericksmi6x3m: http://hacklog.gfredericks.com/2013/08/10/clojure-overloads-the-term-namespace.html
14:23arrdemgfredericks: hacklog... I like that.
14:25mi6x3mgfredericks: ah, this clarifies it. the one is just a symbol name prefix up to the '/' the other one is the physical namespace
14:25mi6x3mtnx
14:25gfredericksmi6x3m: np
14:32gfredericksI wonder how useful clojure monads would be if the impl was to generate functions, bind/fmap/etc, specific to a single monad
14:33gfredericksi.e., the monad library would take your two key functions (bind/return?) and let you populate a namespace with a bunch of derived functionality
14:33gfredericksthe main downside presumably is that outside that library you couldn't really write functions that work on any monad
14:34gfredericksthough maybe you could with a bit of overhead
14:34bbloomin GHC monads are internally implemented by threading an object through
14:34bbloomyou need a dictionary of methods & it's effectively dynamic
14:34bbloomhence some clj monad libraries use protocols
14:34bbloomand have the "current monad" argument you need to supply
14:35gfredericksright, this would get around the need for the current monad argument
14:35bbloomwhich is a bit of a bitch b/c you need to figure out how to thread that argument through, and you don't have return type polymorphism to infer it
14:36gfredericksI have a library that does this kind of stuff with abstract algebra (groups/rings/fields)
14:36bbloomwhat you're describing is essentially modules
14:36gfredericksbut it would work just as well for monads I think
14:36bbloomor racket calls them units
14:36bbloomwhich is something that would also be a nice to have feature i've wanted before
14:37bbloomgfredericks: http://docs.racket-lang.org/guide/units.html
14:38bbloomthat solution works fine for a single monad, but doesn't work when you have multiple monads at once
14:38bbloomand any higher-order monadic code would need to be parameterized by a module/unit
14:38gfredericksis this what people mean by instantiable namespaces?
14:38bbloomyes
14:39gfredericksbbloom: well if each monad is its own namespace
14:39gfredericksthen you can use list/bind and maybe/bind without any ambiguity
14:39bbloomgfredericks: then you'd have monads.list/fmap and monads.state/fmap
14:39gfredericksright that's exactly what I'm proposing
14:39bbloomso you might as well just have map and map-state
14:39bbloomyou're proposal defeats the entire purpose of higher order monad operations
14:39bbloomi mean, you *can* write generic code, but you need to compile it once for each monad
14:40bbloomso you'd have to differentiate w/ names, which makes it pointless b/c that's what we do now
14:40gfredericksit could at least remove some of the repeated boilerplate
14:40gfrederickse.g., that I have to write my own for macro for test.check
14:42bbloomi think instantiatable namespaces are a good idea for other reasons, but they're a half-solution here w/ it's own problems
14:44hiredmanparametric namespaces seems like a better name than instantiable namespaces
14:45bbloomhiredman: yes
14:56arrdemBronsa: puredanger's looking into killing off CONTRIB.
14:56Bronsa:)
15:09gfrederickshuh? what's CONTRIB?
15:10arrdemclojurebot: contrib |is| a wasteland of abandoned dreams
15:13gfrederickshiredman: would it be easy for you to post a dump of the clojurebot database?
15:13arrdemor if we could get read only REST interfaces to Clojurebot and Lazybot...
15:13arrdemthat'd be sweet..
15:14hiredmangfredericks: uh, maybe, I'd have to remember how to use postgres
15:15jkjhiredman: pg_dump -h localhost -U myuser databasename > file.sql
15:15gfrederickspgdump
15:17hiredmanI would maybe use copy to dump to a csv
15:22hiredmangfredericks: http://thelibraryofcongress.s3.amazonaws.com/clojurebot.csv
15:23gfredericksohboyohboyohboyohboyohboy
15:23arrdem(inc hiredman)
15:23lazybot⇒ 42
15:23hiredmanoh, did I forget to exclude the passwords?
15:23arrdemI'm gonna have entirely too much fun reading that...
15:23gfredericks(inc hiredman)
15:23lazybot⇒ 43
15:23gfredericks~everyday
15:23clojureboteveryday is Rich Hickey Appreciation Day
15:24arrdem~clojureboty
15:24arrdem~clojurebot
15:24arrdemT_T is clojurebot ignoring me? :P
15:25gfrederickshuh; why's there a separate column for the subject in uppercase?
15:26arrdem~advice
15:26justin_smith,:ping
15:26clojurebot:ping
15:26Bronsa~advice
15:26clojurebotlive every week, like it is shark week!
15:26Bronsaarrdem: clojurebot doesn't like you
15:26hiredmangfredericks: because I generally forget sql has string operators
15:27arrdemBronsa: I noticed :c
15:27arrdemBronsa: better roll my own bot....
15:27arrdemBronsa: added benifit, having three bots in chan we can finally botstack!
15:28gfrederickshiredman: is that there just for the inference?
15:28gfredericksor matching...
15:28gfredericks~EVErydAY
15:28clojurebotCool story bro.
15:29hiredmangfredericks: I don't recall off hand
15:47brainkimI must be doing something wrong with test.check. I'm doing things like gen two strings of the same length and that takes way too long.
15:47brainkim(def twin-strings
15:47brainkim(such-that
15:47brainkimshit
15:48brainkimI'm just creating a tuple of strings and fitering for tuples with strings of teh same length, and that takes way too long
15:48reiddraperbrainkim: only use such-that if there's a very high likelihood the predicate will pass
15:49amalloyyeah, you don't want to create two random strings and keep trying till you find some with the same length
15:49justin_smithwhy not filter strings, and take the first two of the same length?
15:49reiddraperIn your case, you almost certainly _won't_ generate strings of the sand length
15:49amalloyyou want to create one random string, and then make another of the same length, probably with fmap?
15:49gfredericksnot fmap
15:49gfredericksyou could use bind with a length
15:50gfredericksor bind with two strings similar to amalloy's suggestion
15:50gfredericksmake one string and cut it into two pieces! :D
15:50brainkimgfredericks: brilliant :D
15:50gfredericksthat might shrink poorly
15:51gfredericksthough perhaps not...
15:51gfredericksthe weird odd character out could interact strangely with shrinking
15:52brainkimthanks all will report back.
15:52gfredericksif you want to be really wasteful, generate two strings and use fmap to truncate the larger one
15:54reiddraperI would recommend starting with just chopping a string in two like gfredericks suggests
16:01Rosnecwhen the doc for send-off says "a potentially blocking action", does it mean the call to send-off might block as well?
16:01Rosnecfor some reason my program is blocking indefinitely when I call send-off one time
16:02RosnecI thought it just meant the action you send might block, not the call to send-off as well
16:02hiredmanRosnec: once the threadpools (send and send-off use different threadpools) are spun up the jvm won't shutdown when the "main" thread exists because of those threads
16:03Rosnechiredman, it's not that the whole jvm not shutting down is a problem, the very next function call never gets made
16:04RosnecI put a print call right after it, and it's never printing it
16:04Rosnecthe one right before, however, is
16:04hiredmanRosnec: is send-off throwing an exception?
16:04justin_smithRosnec: can you paste the relevant code?
16:04Rosnecjustin_smith, it's kind of hard to give a meaningful example
16:05Rosnecbasically I do (send-off the-agent a-function-that-blocks arg1 arg2) (println "this never gets printed")
16:05Rosnecactually
16:06Rosnecit's inside a let
16:06hiredmanRosnec: is your call to send-off throwing an exception?
16:06Rosnecno, hiredman
16:06Rosnecat least not one that I'm seeing
16:06hiredmanRosnec: how do you know?
16:06steckerhalterso evil seems to bring more users to emacs than the cl- prefix even
16:06Rosnechiredman, I guess I don't know
16:06hiredmanRosnec: well make sure
16:06Rosnecdo the exceptions not get shown?
16:06steckerhalterwrong channel :)
16:07hiredmanRosnec: it depends on lots of things
16:07RosnecI'm not catching any exception. Do exceptions not trickle all the way down when they're sent off?
16:07hiredmanRosnec: I mean the call to the send-off function
16:07brainkimFigured out the gen strings of equal length problem :) https://gist.github.com/anonymous/d554db2e88f2b733b26a
16:08Rosnecif the send-off function throws an exception, will it actually get thrown in the block of code that called send-off?
16:09RosnecI mean, it's entirely possible that it will thrown an IOException, I just don't see it in my terminal output
16:09Rosnecand I'm not catching an IOException
16:09Rosnecdoes the exception stay within the agent?
16:10Rosnecah, I guess they do
16:10Rosnecwait, so if an agent blocks the calling thread when it throws an exception, how am I supposed to handle it?
16:11brainkimnm still a bit too slow.
16:11mk12Does anyone here use Typed Clojure? I tried, but the "gradual" part doesn't seem to work at all: I would never notice a real error buried between dozens of "unannotated var" errors.
16:12amalloyRosnec: an agent doesn't block the thread calling send, except if you're trying to send from inside a transaction maybe?
16:12amalloyreally not even then, but there's some weird stuff you can do that might make you think it's blocking
16:12Rosnecamalloy, nope not in any transaction
16:12RosnecIt's inside a let actually, maybe that's the cause?
16:13RosnecI'm just binding the result to _
16:13Rosnecwill that cause it to block?
16:13amalloyno
16:13amalloyunder no circumstances does send-off block, if you're not in a transaction
16:13Rosnecok
16:13Rosnecthis is really weird then
16:14justin_smithtry finding the briefest code that will make the error happen
16:14Rosnecwait
16:14Rosnecit's actually an agent that's calling send-off on a different agent
16:15Rosneccould that be the issue?
16:15Rosnecsince they share a thread pool?
16:15Rosnecmaybe if I put them in separate pools it would fix it?
16:16mi6x3mclojure, am I right that 'bindings' is the only way to establish dynamic bindings
16:16mi6x3mand the vars have to have :dynamic meta?
16:16amalloyRosnec: that should be okay, as long as you're not relying on any timing related to the send-off happening
16:17Rosnecamalloy: no, I'm not relying on any timing
16:17Rosnecactually
16:17gfredericksmk12: you're expected to annotate those vars with :no-check metadata
16:17Rosnecis it possible that calling send-off could throw an exception in the calling thread?
16:17Rosnecperhaps the agent that's calling it is dying
16:17amalloyyes, if you were calling send-off on something that's not an agent
16:18Rosnecand that's why it never prints after
16:18Rosnechmm
16:18amalloyor maybe if you passed it a function that's not a function, but i don't think so
16:18Rosnecthat's actually possible I did that by mistake
16:18RosnecI'll double check
16:19mk12gfredericks: What do I put for the type, though? (ann ^:no-check myfunc) doesn't work
16:20mk12gfredericks: If I wanted to spend 30 minutes figuring out the signature that would satisfy the type checker then I wouldn't be doing :no-check
16:20gfredericksmk12: you can start with [Any -> Any] etc
16:21gfredericksmk12: I agree it's a little bit tedious up front
16:21gfredericks(def-alias AnyFunc [Any * -> Any]) ; might work?
16:24Rosnecooh, looks like one of the agents failed
16:24mk12gfredericks: the problem is, I get more errors when I do that. I say that pred must be [Int Any -> Any], and then when I pass something that takes something more specific than Any, it complains.
16:26cbphas anyone compiled protobufs with lein protobuf recently?
16:26mk12gfredericks: also, it seems very strange that it can't infer what #(myfunc a % b) will do, even when myfunc, a, and b have known types. But :no-check'ing every function that uses anonymous functions like that makes the whole thing seem rather pointless
16:26cbpIt doesn't seem to work anymore at least on OS X
16:26gfredericksmk12: it definitely takes a lot of work to get your codebase _partially_ typed and passing the type checker
16:26cbpeven the old version that always seemed to work
16:27gfredericksI think the real value in the no-check stuff is not being able to start passing the type-checker in your first 5 minutes, but being able to write uncheckable code *at all*, including using unchecked libraries
16:28Rosnecok, I think I know what's happening
16:28gfredericksmk12: there are certain idiomatic clojure styles that don't go well with core.typed, and #(myfunc a % b) is one of them
16:28cbpFails with some "unable to find program" error
16:28Rosnecif you send something to an agent that's already failed, you get an exception, right?
16:28gfredericksRosnec: yep
16:28Rosnecthen that's it
16:28gfredericksRosnec: that's bitten me a couple times this week
16:28Rosnecthe one agent is sending something to a failed agent
16:28gfredericksRosnec: the docs for agent give alternative ways of dealing with failures
16:28Rosnecand then the main thread is awaiting that agent
16:29gfredericksyeah the docs for await says it blocks forever on failed agents I think
16:29Rosnecyeah
16:29gfrederickskind of a weird feature
16:29RosnecI was just confused why the agent's function was stopping when it sent something to the other agent
16:29Rosnecthat's why
16:29mk12gfredericks: I decided to try it out because it said 'production ready'. But what am I supposed to do when common functions like 'partition' aren't annotated? And oh, I see.
16:30gfredericksmk12: you can annotate them yourself
16:30gfredericksthe same as you would a library function
16:30mk12I saw in the google group a while ago Ambrose said "My interpretation of gradual typing is [...] there is some mediator that handles the interface between the two. (Typed Clojure lacks the mediator atm)". Maybe that's part of the problem here
16:31mk12gfredericks: I was going to try that, but it didn't look easy when I checked the signatures of similar functions. It seems there is a dozen slightly different ways of specifying a collection, for one thing
16:32gfredericksmk12: yes, but you only have to type it well enough for your own purposes
16:32gfrederickswhich is often a lot simpler
16:33holohi
16:33gfredericksholo: hi
16:35holoI read several times people say "require clojurescript explicitely" does that mean in libraries one should include it as a :dev dependency?
16:36egork8nHi, everyone!
16:36holohi egork8n
16:36egork8nI'm pretty new to clojure. I'm trying to build a simple compojure app and everything goes smoothly so far. Now I want to execute some code right before my app shuts down, but can't find how to do this.
16:37egork8nAny pointers?
16:37gfredericksegork8n: how are you running it?
16:37egork8nI'm building a WAR file with lein ring uberwar
16:37gfredericksholo: yeah prollably
16:38gfredericksegork8n: and how are you running the war file?
16:39hologfredericks I'm downgrading clojurescript, just for a human reference on the minimum requirement, since it's not going to be used anyway
16:40amalloyegork8n: when you make a WAR file, don't you have to provide init/destroy functions?
17:00justin_smithamalloy: I have never seen a destroy, but yeah, you provide your intit to ring with lein ring
17:00amalloyhttps://github.com/weavejester/lein-ring#general-options
17:01justin_smithI just found that and was about to link the same
17:01technomancythe JVM has a generalized shutdownhook iirc
17:01justin_smithbut with a WAR the jvm is still sticking around
17:01technomancyhttp://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread)
17:02technomancyjustin_smith: oh, huh
17:02technomancyyet another arbitrary difference between war files and Regular clojure programs I guess
17:02justin_smiththe jvm runs tomcat or whatever, and then it can start or stop various wars, without shutting down the jvm
17:03justin_smithyeah, some people see it as a benefit
17:04justin_smithhttp://en.wikipedia.org/wiki/Java_Servlet
17:05gfrederickstechnomancy: war files aren't inherently that way, that's just how they're normally used
17:05gfredericksas something you deploy to a container
17:05justin_smithgfredericks: oh, a war can be used other than as a servlet?
17:06justin_smithhttp://en.wikipedia.org/wiki/WAR_file_format_(Sun)
17:06justin_smiththe wiki seems to imply a war is always a servlet (plus resources etc.)
17:07Jaoodis a war just some type of jar customized for application servers?
17:07justin_smithit is a jar, yeah
17:07iXenoJaood: it's a format made for deploying to app servers
17:08gfredericksjustin_smith: right but nothing stops somebody from writing a container that just starts up with a single war and quits when you want to shut it down
17:08justin_smithahh, right
17:08iXenoit's a zipped down web application format
17:08justin_smiththe fact that the jvm does not shut down then the servlet does is just an implimentation detail, not a requirement, of course
17:09justin_smithiXeno: all jars are zips, and a war is a jar
17:09iXenoyeah
17:10gfredericksand a war.zip is a
17:19Rosnecis there any reason a PersistentVector passed through send-off would be cast to a BufferedOutputStream?
17:19Rosnecit's the argument to the dispatch fn
17:21Rosnecbefore I pass it in, I have a LazySeq of PersistentVectors. Once passed in, I have a Cons of BufferedOutputStreams
17:21Rosnecthe cons part makes sense, but not the BufferedOutputStream
17:23gfredericksRosnec: why would something change its type at all?
17:23justin_smithRosnec: that's weird, send-off should be sent a function, not a cons
17:23Rosnecthe cons is the final arg
17:23justin_smithahh, ok
17:23Rosnecgfredericks, I don't know why it would change type
17:23justin_smithand yeah, what gfredericks said
17:23Rosnecwhich is why it's baffling me
17:24RosnecI'm printing out the type from the calling fn
17:24Rosnecand printing it again from within the dispatch fn
17:24Rosnecand the types are different
17:24Rosnecit's bizarre
17:24gfrederickswhat does dispatch fn mean in the context of agents?
17:24Rosnec(send-off agent dispatch-fn & args)
17:25justin_smiththat's a weird name for f
17:25Rosnecis that not proper use of the term?
17:25justin_smiththat implies a multimethod to me
17:25Rosnecah
17:25justin_smiththough the f of send-off could be a multimethod I guess
17:26Rosnecwell I'm just going by the use of the word "Dispatch" in the send doc
17:26Rosnec"Dispatch a potentially blocking action to an agent."
17:26RosnecI guess it's not quite accurate to call it a "dispatch-fn"
17:26Rosnecbut that's the fn I'm referring to
17:26justin_smithyeah, a "dispatch function" is the function that decides what impl of a multimethod gets called
17:26Rosnecok
17:26justin_smiththat is a function dispatched to an agent
17:27Rosnecright
17:27justin_smithas opposed to the function that dispatches a call to a multimethod impl
17:27RosnecI was just calling it a dispatch-fn because it is a function that is dispatched
17:27Rosnecseems logical
17:27Rosnecforgot dispatch-fn had a specific meaning
17:27justin_smithdispatched-fn would be more accurate
17:27Rosnecok
17:28Rosnecguess that makes sense
17:29Rosnecso basically what's happening is this
17:29RosnecI have a sequence of sequences of bytes, which I'll call x
17:29Rosnecbefore dispatching to the agent, I print (type x) and (-> x first type)
17:30justin_smithhow are you determining that your function gets BufferedOutputStream instances when you give it vectors?
17:30RosnecI'm determining that by printing the following from within the dispatched fn
17:30Rosnec(type x) (-> x first type)
17:30Rosnecsame thing
17:30Rosnecthe output is different, though
17:31justin_smiththere is some other error
17:31Rosnecat first I get: clojure.lang.LazySeq clojure.lang.PersistentVector
17:31Rosnecthen from within the dispatched fn I get: clojure.lang.Cons java.io.BufferedOutputStream
17:31RosnecI figured there's some other error
17:31RosnecI just don't see where it could possibly occur
17:31justin_smiththe first arg to the agent is the previous state of the agent
17:31justin_smithnot the last arg to send-off
17:32Rosnecyes
17:32Rosnechmm
17:32Rosnecwait a minute
17:32justin_smithso the previous state did not create BufferedOutputStreams?
17:32Rosnecactually
17:32justin_smith*was not BufferedOutputStreams I mean?
17:32Rosnecwell I'm not actually using the agent to hold any state, so I just put 0 in it
17:33Rosnecbut I wonder if one of the functions I send it is changing that to a BufferedOutputStream
17:33Rosnecand actually
17:33Rosnecthe function I'm sending it doesn't take the state of the agent, like it should
17:33Rosnecthat might be the whole problem
17:34justin_smiththe first arg will be the staet
17:34justin_smith*state
17:34Rosnecright, I think I overlooked that fact
17:34Rosnecok, rerunning it with that fixed
17:34Rosnec*crosses fingers*
17:35Rosnechaha
17:35Rosnecfixed that type change issue
17:35Rosnecohhhh
17:35RosnecI see how it got a BufferedOutputStream
17:35insamniacAnyone google code jamming?
17:35Rosnecthe dispatched fn had arguments (output-stream & bytes-to-write)
17:36Rosnecbecause I didn't put a dummy argument in front of output-stream
17:36Rosnecit was getting put inside of the & bytes-to-write
17:36Rosnecso when I called (first bytes-to-write)
17:36RosnecI was getting what should have been in output-stream
17:37tuftany reason not to put the examples from the web documentation into what you see when you run (doc)?
17:38Rosnechaha, looks like that was the biggest issue with my code
17:38Rosnecgot a lot further before crashing this time :)
17:38Rosnecit's crashing where I almost expected it to
17:38Rosnecbut hoped it wouldn't
17:38Rosnecprogress!
17:42tuftis there a cond style form that does binding?
17:42tuftkinda like a multi if-let i guess
17:43bbloom(doc cond)
17:43clojurebot"([& clauses]); Takes a set of test/expr pairs. It evaluates each test one at a time. If a test returns logical true, cond evaluates and returns the value of the corresponding expr and doesn't evaluate any of the other tests or exprs. (cond) returns nil."
17:43bbloomer, rather:
17:43bbloom(doc condp)
17:43clojurebot"([pred expr & clauses]); Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr result-expr test-expr :>> result-fn Note :>> is an ordinary keyword. For each clause, (pred test-expr expr) is evaluated. If it returns logical true, the clause is a match. If a binary clause matches, the result-expr is returned, if a ternary clause matches, its result-fn, which must be a unary function, is called w
17:43bbloomtuft: does the :>> thing help you?
17:44RosnecI've never seen that before
17:44Rosnecnot that I'm tuft
17:44bbloomi've only used it once, but it exactly what i needed :-)
17:46JaoodiXeno: k
17:46Jaoodwhat's the difference between drop-while and remove?
17:49seanaway,(drop-while even? [2 4 6 7 8 9 10])
17:49clojurebot(7 8 9 10)
17:49seanaway,(remove even? [2 4 6 7 8 9 10])
17:49clojurebot(7 9)
17:50seanawayremove takes away all elements that match the predicate, drop-while only removes the leading subsequence of such elements
17:51seanawaysimilarly take-while and filter:
17:51seanaway,(take-while even? [2 4 6 7 8 9 10])
17:51clojurebot(2 4 6)
17:51seanaway(filter even? [2 4 6 7 8 9 10])
17:51Jaood,(remove neg? (range -10 10))
17:51clojurebot(0 1 2 3 4 ...)
17:51Jaood,(drop-while neg? (range -10 10))
17:51clojurebot(0 1 2 3 4 ...)
17:52seanaway,(filter even? [2 4 6 7 8 9 10])
17:52clojurebot(2 4 6 8 10)
17:52seanawayif the only elements matching the predicate are at the beginning, drop-while and remove will behave the same way
17:52Jaoodseanaway: thanks
18:37bbloomThe github.com/brandonbloom/eclj interpreter is now officially self-applicable! :-D
18:39justin_smithcool - how far from bootstrapping is it?
18:39bbloomjustin_smith: depends on how you define "bootstrapping"
18:40gfredericksreiddraper: oh crap I forgot to rename rose-bind
18:41reiddrapergfredericks: i can fix that real quick
18:41gfredericks+1
18:42gfredericksreiddraper: I'm curious how much time it takes to apply a patch from jira compared to github's one-click PR merge
18:43reiddrapergfredericks: not much more once you know what to do: i just wget the patch and 'git am' to apply it. so not too bad
18:43jeremyheilerbbloom: nice!
18:43reiddraperi would prefer using pull-requests, but, c'est la vie
18:44reiddrapergfredericks: hm, doesn't even look like rose/bind is used anywhere
18:44gfredericksoh weird
18:44gfredericksyou just wrote it because haskell made you do it? :)
18:45technomancyone time I submitted a pull request on tools.nrepl and chas merged it
18:45technomancythe thing about policies is sometimes you just forget, you know?
18:45tuftbbloom: indeed! thanks
18:45bbloomjustin_smith: the only feature it doesn't have yet is reify, which is a bit tricky, but i'll do it soon enough. it has really smooth interop w/ clojure/jvm, so it doesn't actually need a full std lib or anything like that to be usable, but eventually it will have a fully symbolic copy of clojure.core so that it can be cross compiled to js etc
18:45gfrederickstechnomancy: oh man I bet he still gets super embarrassed whenever he remembers it
18:46technomancygfredericks: one of those regrets that will follow him to the grave
18:46justin_smithbbloom: very cool
18:47bbloomjustin_smith: thanks
18:47gfredericksmister fingerhut made a joke jira ticket on tools.nrepl after a drink or two
18:47bbloomjeremyheiler: thanks to you too
18:48reiddrapergfredericks: must've been, haha. i think i'll keep it for consistency though
18:52jeremyheilerbbloom: oh, how come?
18:53jeremyheileroh. blah. context.
18:53reiddrapergfredericks: fixed and pushed
18:54gfredericksreiddraper: sweet thanks
18:54kenrestivo~context is burger king
18:54clojurebotc'est bon!
18:54reiddrapergfredericks: np
18:59gfredericks~~context
18:59clojurebotI don't understand.
18:59gfredericks~context
18:59clojurebotcontext is burger king
18:59gfrederickshuh
18:59ToBeReplacedsince i couldn't find anything from looking around to parse accept headers: opening up https://github.com/ToBeReplaced/http-accept-headers, would love feedback, etc
19:00bob2bbloom, it's clojure implemented in clojure?
19:03Jaoodbob2: the building blocks is written in Java
19:07amalloygfredericks: recall that clojurebot considers "~x" equivalent to "clojurebot: x", for all x. so it's clear why he defined context, and not ~context, with that instruction
19:08gfredericksamalloy: I cannot recall that for I did not know it originally; but that clears it all up
19:08Jaoodtalking of ignorance here, but what's the challenge of building the compiler in Clojure? since there already exists a compiler to bootstrap it?
19:08amalloygfredericks: well, you know how "recall that ___" works in textbooks. it's polite for "you should know ___, and if you don't go read a refresher on that material"
19:10justin_smithrecall how "recall that ___" works in textbooks...
19:10amalloyjustin_smith: yeah, i avoided that phrasing, but i think you're right that it's more fun that way
19:15bbloombob2: it's a clojure interpreter in clojure, but i'm planning to do a proper compiler too
19:16bbloombob2: it (currently) reuses almost all of the official runtime library
19:20bbloomkenrestivo: haha just spotted the burger king bit
19:20bbloomif you remember that, that means my nemonic was successful :-)
19:35amalloybbloom: sadly i haven't yet had a conversation in which the context was right to bring up the burger-king slide
19:36bbloomamalloy: you just haven't smoked enough trees yet
19:59nopromptwhat's a good way to communicate information to parents from children with om?
20:02noprompte.g. i'm an element in a vector, remove me w/o performing two transactions.
20:03nopromptalso i don't know i'm in a vector
20:12brainkimnoprompt: Does this help? https://github.com/swannodette/todomvc/blob/gh-pages/labs/architecture-examples/om/src/todomvc/app.cljs#L103-L106
20:16nopromptlemme dig around, i was thinking i'd probably have to do something a long the lines of using some kind of comm channel.
20:25gfredericksamalloy: you should have explained that via "Recall how recall works in textbooks: ..."
20:25amalloygfredericks: recall that justin_smith already suggested that
20:25amalloyi considered it, but erroneously rejected it as sounding a bit too smug
20:25gfredericksoh snap
20:26gfredericksrecall that I did not read the backlog in that much detail
20:26gfredericks~recall |that| clojurebot interprets "~foo" as "clojurebot: foo"
20:26clojurebotIk begrijp
20:29amalloygfredericks: sentences like that make me think about quoting and unquoting in english. it's pretty hard to convey that foo, despite being quoted, actually should be "evaluated" to its referent
20:29amalloy,`(~'(~foo) (~'clojurebot ~'foo)) ;; looks like a mess
20:29clojurebot(((clojure.core/unquote foo)) (clojurebot foo))
20:31gfredericksamalloy: yeah; you kind of have to have some sort of meta-language for talking about these kind of things; and escaping.
20:32gfredericksI have no idea what that clojure code was supposed to convey
20:32gfredericksbut I have had like three glasses of wine which is like 17 normal-person-glasses
20:34amalloymakes sense. three is about the upper limit for me saying things that make any sense
20:58tuftbbloom: actually, what i need is more like if-let than cond
20:59tuft(if-letp [foo (maybe-foo)] (something foo) [bar (maybe-bar)] (something-else bar))
21:01gfredericks(defmacro ifletp [pair expr & more] `(iflet ~pair ~(when more `(ifletp ~@more))))
21:03gfredericksalso s/iflet/if-let/
21:03gfredericks#drunkmacros
21:04justin_smithwell it depends if they should have "and" semantics, or "or" semantics - the above is and
21:11gfredericksI have no context
21:11martinklepschIs there a way to specify a different relative root directory when using xml/parse ?
21:11martinklepschparsing requires a dtd file but I'd like to put files to parse in subdirectories
21:12martinklepsch(and that dtd file needs to be in the same location as the file to parse by default)
21:26Rosnecso I have a sorted map, where the keys are numbers, and I want to take the values whose keys are in some range
21:26Rosnecwhat's the fastest way to do that, while maintaining the order?
21:26Rosnecif I use reduce, it will go further than it needs to
21:26gfredericksthere's a function for that sort of thing
21:26RosnecI could use take-while with the maximum key, and then reduce afterwards
21:26Rosnecgfredericks, I thought there might be
21:27gfredericksbut what on earth was it called...
21:27Rosnecselect-keys seems to be breaking the ordering
21:27gfredericksto the cheatsheet!
21:27justin_smithRosnec: with reduce you can shortcircuit with reduced
21:27gfredericksno there's something specialized to sorted collections
21:27Rosnecjustin_smith: o rly?
21:28gfredericks,(doc rsubseq)
21:28justin_smith,(reduce (fn [t i] (if (> i 10) (reduced t) (+ i t))) (range))
21:28clojurebot"([sc test key] [sc start-test start-key end-test end-key]); sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a reverse seq of those entries with keys ek for which (test (.. sc comparator (compare ek key)) 0) is true"
21:28clojurebot55
21:28justin_smithnotice the input to that reduce was infinite in length
21:28gfredericks,(doc subseq)
21:28clojurebot"([sc test key] [sc start-test start-key end-test end-key]); sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a seq of those entries with keys ek for which (test (.. sc comparator (compare ek key)) 0) is true"
21:28Rosnecohh, so that's what reduced is for
21:28gfredericksRosnec: subseq is what you want
21:29Rosnecgfredericks: perfect!
21:29Rosnecwow, that's even better than I could have imagined
21:29RosnecI even get to differentiate between using < and <=
21:30RosnecI thought I'd have to throw an (inc) in there somewhere
21:31Rosnecwell Rosnec is about to
21:31justin_smithyeah, I pretty much never use the sorted collections even, but that is perfect for that situation
21:31gfredericks,(def my-nums (apply sorted-set (take 15 (iterate #(* 2 %) 3))))
21:31clojurebot#'sandbox/my-nums
21:31gfredericksmy-nums
21:31gfredericks,my-nums
21:31clojurebot#{3 6 12 24 48 ...}
21:31Rosneclooks like it might have worked
21:31gfredericks,(subseq my-nums < 48)
21:31clojurebot(3 6 12 24)
21:31gfredericks,(subseq my-nums > 8 < 1000)
21:31clojurebot(12 24 48 96 192 ...)
21:31gfredericks,(subseq my-nums > 8 < 100)
21:31clojurebot(12 24 48 96)
21:32gfredericksnice.
21:32Rosnec:O it worked!!
21:32gfredericksit's probably log time too
21:32martinklepsch(split-at #(= 2 %) [1 2 3 2 4]) => [(1) (2 3) (2 4)]
21:33martinklepschis something like this possible?
21:33gfredericksyou could certainly write it
21:33martinklepschor better, is there some built in or simple fn to use?
21:33gfrederickssplit-with is similar but might not be able to do what you need
21:33gfredericksit takes a fn and makes a new group when the return value changes
21:34martinklepschsplit-with only works to split in two parts
21:34gfredericks,(split-with #(quot % 3) (range 10))
21:34clojurebot[(0 1 2 3 4 ...) ()]
21:34gfrederickswait
21:34gfredericksI meant
21:34gfrederickspartition-by I Think
21:34gfredericks,(partition-by #(quot % 3) (range 10))
21:34clojurebot((0 1 2) (3 4 5) (6 7 8) (9))
21:39martinklepschok, now I have some thing like [(1) (2 3 4 5) (1) (2 5 3 6)] when partioning by #(= 1 %)
21:39martinklepschit's a good start
21:40martinklepschnow I want to combine this to something like [(1 2 3 4 5) (1 2 5 3 6)]
21:40martinklepsch... think I have an idea
21:40martinklepschthanks for now
21:50gfredericksmartinklepsch: I think a recursive thing that uses split-with would be pretty simple
21:51martinklepschgfredericks yeah, but I'd end up with the splitting element in a seperate sequence as well
21:52martinklepschright now I'm trying to figure out how to make ((1) (5 6 7)) to (1 5 6 7)
21:52martinklepschprobably should go to bed :D
21:53gfredericksmartinklepsch: okay now I have to write it
21:53martinklepschgfredericks hehe
21:54gfredericksthe tricky part is that the sequence may or may not start with a matching element
21:57martinklepschgfredericks, in my case that probably would be useful in my case I can assume that though
21:57martinklepsch(trying to parse a file w/ multiple <?xml version="1.0" encoding="UTF-8"?> statements...)
21:59martinklepschbut I assume xml/parse with more complex xml files only works with supplying a uri
22:01gfredericksmartinklepsch: uglier than I was hoping: https://www.refheap.com/75826
22:02gfredericksbut it seems to work
22:04martinklepschstill cool to see :)
22:07martinklepschgfredericks, any experience w/ xml parsing? can't come up with a better way then splitting the files before parsing using awk
22:08martinklepsch(so that I can hand a URI to xml/parse and not a string)
22:09gfredericksmartinklepsch: I've done a bit with data.xml; but I don't know much advanced stuff about xml and none of the problems you're describing sound familiar
22:09gfredericksI mostly just had to wrangle the zipper libs and stuff to find what I was looking for
22:11martinklepschno problem :)
22:42myguidingstardoes Clojure compiler gen-class for namespaces with (:gen-class) when leining profile doesn't contain :aot something?
23:04Platzsince take-while doesn't use recur (not in tail position), why doesn't it overflow the stack?
23:06devthPlatz: i suspect it has to do with the lazy-seq but don't know beyond that
23:10Platzdevth: docs for lazy-seq seem to indicate that it's because it just returns a closure as opposed to invoking the body
23:10Platzso that explains it, interesting
23:10devthright
23:11TravisDPlatz: devth is right. The lazy-seq macro takes some code to execute, and returns something that will execute that code when you call seq on it
23:12TravisDThe reason this doesn't blow the stack frame is that every when you return the lazy-seq, the stack unwinds one function call (since you returned!)
23:13Platzkind of like just returning a lambda
23:13Platzthunk, whatever
23:14akurilinquick question: what's the simplest and quickest way of forking a github repo of a library and swapping that for an existing one used by a lein project?
23:14TravisDYeah, very similar. Trampoline accomplishes essentially the same thing, and requires you to return functions
23:15akurilin"existing one" being one from clojars
23:16TravisDPlatz: Er, trampoline is another way to write recursive functions that don't blow the stack. In other respects it is not very similar to lazy-seq
23:16TravisDmainly because it's not lazy :)
23:17Platzhah, good point
23:48martinklepschusing futures can I easily see how long it ran?
23:49martinklepsch(time @f) doesn't really return anything usefuk
23:49martinklepschexcept the future result
23:57turbofailmartinklepsch: no, there's no built-in way to do that
23:58martinklepschturbofail, ah ok
23:58turbofailshouldn't be that hard to hack something that will do it though