#clojure log - Apr 13 2014

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

1:24 jph-: so i have an 'entry' function 1 (get-ticker) that then calls function 2 (public-api-call), which calls function 3 (api-action)

1:24 from a testing point of view, i should be writing tests for each call, not just function 1

1:25 are there any libraries that have that type of function chaining with good tests to read through?

2:30 7F1AAALOS: gfredericks: 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

2:30 wtf

4:42 derek_c: When specifying dependency versions, what's the canonical way to tell lein "any version greater than X.Y.Z will do?"

4:46 i.e. how do you specify a minimum version number?

6:50 rowth: so, 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

6:53 wagjo: rowth: I run out of permgen too sometimes, when reloading namespace a lot. Haven't looked into the cause yet.

6:54 john2x: help, I ran (midje.repl/autotest) in my repl, and now I can't stop it. How can I stop it without restarting my repl?

6:54 Ctrl-C doesn't do anything (it's a cider repl)

6:55 wagjo: rowth: maybe after protocol is redefined od protocol and its methods are leaked.

6:55 rowth: wagjo: 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

6:55 wagjo: *old

6:57 rowth: wagjo: 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

6:57 wagjo: rowth: 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.

7:00 rowth: wagjo: 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

7:01 wagjo: I'd read that, in a repl, each top level form gets it's own classloader

7:01 wagjo: 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

7:02 hugoduncan: rowth: you might try adding "-XX:+UseConcMarkSweepGC" "-XX:+CMSClassUnloadingEnabled" to your :jvm-opts

7:03 rowth: hugoduncan: already done I fear...

7:03 I _do_ see classes being unloaded

7:03 but not all of them

7:03 anything that's part of the system-map seems to end up being kept

7:04 and 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

7:06 john2x: is there a function to create a hash-map from a record?

7:07 hugoduncan: rowth: I don't see your pastebin

7:08 rowth: hrm, it works from both my machines, even if I'm not logged in: http://pastebin.com/ThddJ6J4 (in case I fluffed it above)

7:09 I signed up 20 minutes ago to create it though, so I confess I know very little about pastebin. Definitely seems public though

7:12 hugoduncan: what about https://www.refheap.com/75710

7:15 hugoduncan: rowth: thanks, I can see both of those

7:27 rowth: I don't know much about component, but clojure does use new classloaders to evaluate things. See around line 6673 of Compiler.java

7:30 rowth: hugoduncan: thanks! I'll have a look

7:34 hugoduncan: rowth: note also that DynamicClassLoader uses SoftReference to hold its members

7:35 rowth: ya - I've been using eclipse MAT to exclude those

7:35 in the chain I pasted earlier, it seems that some classes are making it to the base URLClassLoader impl

7:35 (going by the property names)

7:35 which seems to use a hard reference

7:36 (base in the sense that dynamic classloader extends it, not the system / app classloader)

7:49 Bronsa: ambrosebs: ping

7:49 ambrosebs: Bronsa: sup

7:50 Bronsa: ambrosebs: just FYI the same guy who reported the :host-interop bug, said he got a similar error wrt :reify

7:52 ambrosebs: Bronsa: yea just saw. Pondering reify again.

7:52 dbushenko: hi all!

7:52 how to restrict access to some routes in Ring application?

8:02 scape_: you need authentication, take a look at "friend" perhaps

8:02 authorization, rather

8:02 dbushenko: no, I need only authorization. I already have authentication

8:02 is there any standard way for routes restricting?

8:03 scape_: not that i know of, but it wouldn't be too hard to roll your own

8:04 hve you looked at friend?

8:04 https://github.com/cemerick/friend

8:05 it may give you some ideas

8:06 dbushenko: yeah, I had a look at it but I don't like it actually

8:06 its too fast, has looooots of dependencies which conflict with mine

8:07 you know, the version hell in a maven project

8:07 not so easy to manage all those conflicts

8:07 I just wanted to know if there is any standard way of restricting, may be a ring feature or middleware

8:08 * too fat

8:08 scape_: not that ive seen

8:08 https://github.com/niwibe/buddy

8:09 that may be something, it just popped up on search

8:09 good luck

8:09 dbushenko: nice example, thanks!

9:19 paulswilliamsesq: Hiya, anyone avaiable to offer a little advice about number representations in clojure?

9:27 jkj: paulswilliamsesq: shoot away. not that i necessarily know anything, but i'm also interested :)

9:28 paulswilliamsesq: jkj: sorted it now.

9:30 I 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

9:42 wagjo: paulswilliamsesq: AFAIK floor gives you a floating point, not decimal number.

10:39 perses: hello

10:39 i got lein run

10:39 No :main namespace specified in project.clj.

10:40 what maybe cause this problem?, it's just a simple hello world

10:51 paulswilliamsesq: Hiya, anyone done any GIS / OSM stuff in Clojure before?

11:03 samrat: perses: you need to add a :main to your project.clj: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L182

11:04 oh, just realised that he's already left the channel.

11:15 perses: samrat: mean me?

11:16 samrat: perses: yeah. did your problem get resolved?

11:17 ptcek: Any 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:18 perses: samrat: nope

11:18 samrat: perses: did you see this: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L182

11:18 ?

11:19 ToBeReplaced: ptcek: highly dependent on use case... i think JFreeChart direct is probably what you're looking for thoguh

11:19 ptcek: use case - get data from DB, make simple XY/line chart and send in bitmap via email

11:20 ToBeReplaced: ptcek: JFreeChart sounds like a good fit

11:20 ptcek: I am looking into jfreechart but I do not like the fact I need Xvfb or something similar running on the server

11:21 but maybe if I invest some time into it it will be ok at the end :)

11:22 ToBeReplaced: ptcek: 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:23 ptcek: 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:24 ptcek: I think clojure is overkill for the task

11:25 ToBeReplaced: hobby 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:52 seangrove: Just 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:07 icarot: I honestly couldn't understand the ad-hoc contortion of English in that post.

12:08 The reasoning was just wrong, yet expressed so lazily that I couldn't construe why.

12:36 verma: using 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:37 hmm, doesn't work

12:40 ,(assoc-in {} [:hello :world] 1)

12:40 clojurebot: {:hello {:world 1}}

12:40 verma: oh

12:41 when om/set-state accepts multiple keys its basically a path into nested structure

12:41 ,(:hello/world {:hello {:world 1}})

12:41 clojurebot: nil

12:42 verma: ,(:hello/:world {:hello {:world 1}})

12:42 clojurebot: nil

12:42 verma: :P

12:59 seangrove: verma: Yup, you got it

12:59 You'll need to make multiple calls

13:07 icarot: I think that's bizarre default behavior. As if the number of keys should imply the depth of the structure; just odd.

13:09 seangrove: icarot: ? It's a wonderful and beautiful thing, not exploited to its full potential yet

13:09 icarot: Hmm.. I suppose in my naiveté of Clojure idioms I'll take your word on it.

13:10 mi6x3m: hey clojure, why is ::x called an auto-resolved keyword?

13:10 I understand the use in destructuring

13:10 but is this the only thing?

13:10 Bronsa: ,::foo

13:10 clojurebot: :sandbox/foo

13:10 Bronsa: mi6x3m: it resolves the namespace part as the current namespace

13:11 seangrove: mi6x3m: 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:11 mi6x3m: Bronsa: got it, thanks

13:11 something completely different

13:34 arrdem: bbloom: so are you joking about eval with bindings or not.. I can't tell

13:34 bbloom: context, NREPL-50

13:39 bbloom: arrdem: why would i be joking?

13:40 arrdem: i need a per-message setting that doesn't require evaluating user-provided code

13:40 arrdem: bbloom: that's entirely reasonable to me, I'm frankly surprised that we don't have an eval with bindings.

13:41 bbloom: arrdem: 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:42 b/c i'm binding the evaluator :-)

13:42 arrdem: hehe

13:42 bbloom: but even then, it seems like you might want to set bindings for messages other than eval

13:43 arrdem: just read your patch... cute. yeah... I think that more generalized bindings is potentially reasonable

13:44 bbloom: yeah, i'll leave a more general mechanism to cemerick, he knows best & has the context of piggieback to validate with

13:45 ToBeReplaced: checking 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:46 arrdem: is there a clojure-dev policy on closing abandoned tickets? I'm seeing Jira issues from 2010 still sitting around untouched...

13:47 hyPiRion: arrdem: is the issue fixed?

13:48 arrdem: hyPiRion: doubt it... but everything related thereto is 404 http://dev.clojure.org/jira/browse/CONTRIB-19

13:49 Bronsa: arrdem: I wouldn't care much about CONTRIB

13:49 arrdem: Bronsa: but... open issues man... :P

13:50 I was just skimming the open issues list and noticed it. Haven't been really active on Jira so I thought I'd ask.

13:50 hiredman: /win 23

13:52 Bronsa: arrdem: meh. Just mail Alex and ask him to delete the JIRA project altogether

13:52 brainkim: Anyone 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:52 arrdem: Bronsa: 'kay. (cons #'arrdem/todo)

13:53 clojurebot: test.check is test.chuck

13:53 Bronsa: lol

13:54 arrdem: Bronsa: https://github.com/fredericksgary/test.chuck

13:54 Bronsa: lol@Usage

13:54 (inc gfredericks)

13:54 lazybot: ⇒ 49

13:54 arrdem: kinda wish I was making that up...

13:54 hyPiRion: (inc gfredericks)

13:54 lazybot: ⇒ 50

13:55 gfredericks: arrdem: stop wishing my vaporware away

13:55 arrdem: gfredericks: hahaha

13:55 (inc gfredericks)

13:55 lazybot: ⇒ 51

13:55 * gfredericks goes back to see what he wrote under Usage

13:56 gfredericks: I'm gonna make test.chuck a real thing once reiddraper sees the light wrt gen/for

13:56 arrdem: I have a wrench named the pursuader if you need to borrow it... /s

13:59 reiddraper: brainkim: use fmap when you want to return a _value_ from the supplied function. Use bind when you want to return a new _generator_

14:02 brainkim: AHHH

14:03 reiddraper: I felt like I was going insane for a sec.

14:03 so like map vs flatmap in scala

14:03 thanks!

14:04 reiddraper: brainkim: identical

14:04 gfredericks: did we just discretely mention the list monad?

14:05 brainkim: This is so much easier when I can just follow the type signatures of function parameters.

14:05 arrdem: gfredericks: types... monads... yep.

14:05 brainkim: Isn't clojure's equivalent of flatmap actually.. like.. mapcat or something?

14:05 gfredericks: yep

14:05 arrdem: mapcat is a thing...

14:06 bbloom: brainkim: 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:07 brainkim: that 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:08 bbloom: brainkim: 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:08 hyPiRion: different design decisions

14:09 gfredericks: bbloom: I'm curious what you think of for for generators in test.check then

14:10 bbloom: gfredericks: 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:10 a situation i am actively working to remedy ;-)

14:10 gfredericks: bbloom: is a for macro a good fit there then?

14:11 bbloom: gfredericks: the for macro is basically just the do syntax

14:11 gfredericks: yes I know

14:11 bbloom: gfredericks: 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:11 where for isn't all that useful

14:11 brainkim: bbloom: 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:11 gfredericks: for can be used for fmap

14:12 bbloom: if i were writing it in clojure, i'd probably just use map and mapcat instead of fmap & friends

14:12 actually, i'd probably use my transduce library w/ map-state and mapcat-state

14:12 but i'm a crazy person

14:13 brainkim: 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:14 brainkim: why not both? :-}

14:15 bbloom: b/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:15 brainkim: :-}

14:21 mi6x3m: Bronsa: can you also helped me with prefixed keywords?

14:21 what is their significance?

14:22 arrdem: mi6x3m: namespaced keywords?

14:22 mi6x3m: arrdem: :x/a

14:22 the let docs say it's "prefixed keyword"

14:22 but it looks like a namespaced keyword yeah

14:23 gfredericks: fuzzy terminology

14:23 arrdem: mi6x3m: yeah. namespaced or prefixed keywords. No special significance... just use of clojure namespace syntax in a keyword.

14:23 mi6x3m: arrdem: for some special reason?

14:23 arrdem: mi6x3m: note that ::foo prefixes to :*ns*/foo

14:23 gfredericks: mi6x3m: http://hacklog.gfredericks.com/2013/08/10/clojure-overloads-the-term-namespace.html

14:23 arrdem: gfredericks: hacklog... I like that.

14:25 mi6x3m: gfredericks: ah, this clarifies it. the one is just a symbol name prefix up to the '/' the other one is the physical namespace

14:25 tnx

14:25 gfredericks: mi6x3m: np

14:32 I wonder how useful clojure monads would be if the impl was to generate functions, bind/fmap/etc, specific to a single monad

14:33 i.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:33 the main downside presumably is that outside that library you couldn't really write functions that work on any monad

14:34 though maybe you could with a bit of overhead

14:34 bbloom: in GHC monads are internally implemented by threading an object through

14:34 you need a dictionary of methods & it's effectively dynamic

14:34 hence some clj monad libraries use protocols

14:34 and have the "current monad" argument you need to supply

14:35 gfredericks: right, this would get around the need for the current monad argument

14:35 bbloom: which 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:36 gfredericks: I have a library that does this kind of stuff with abstract algebra (groups/rings/fields)

14:36 bbloom: what you're describing is essentially modules

14:36 gfredericks: but it would work just as well for monads I think

14:36 bbloom: or racket calls them units

14:36 which is something that would also be a nice to have feature i've wanted before

14:37 gfredericks: http://docs.racket-lang.org/guide/units.html

14:38 that solution works fine for a single monad, but doesn't work when you have multiple monads at once

14:38 and any higher-order monadic code would need to be parameterized by a module/unit

14:38 gfredericks: is this what people mean by instantiable namespaces?

14:38 bbloom: yes

14:39 gfredericks: bbloom: well if each monad is its own namespace

14:39 then you can use list/bind and maybe/bind without any ambiguity

14:39 bbloom: gfredericks: then you'd have monads.list/fmap and monads.state/fmap

14:39 gfredericks: right that's exactly what I'm proposing

14:39 bbloom: so you might as well just have map and map-state

14:39 you're proposal defeats the entire purpose of higher order monad operations

14:39 i mean, you *can* write generic code, but you need to compile it once for each monad

14:40 so you'd have to differentiate w/ names, which makes it pointless b/c that's what we do now

14:40 gfredericks: it could at least remove some of the repeated boilerplate

14:40 e.g., that I have to write my own for macro for test.check

14:42 bbloom: i think instantiatable namespaces are a good idea for other reasons, but they're a half-solution here w/ it's own problems

14:44 hiredman: parametric namespaces seems like a better name than instantiable namespaces

14:45 bbloom: hiredman: yes

14:56 arrdem: Bronsa: puredanger's looking into killing off CONTRIB.

14:56 Bronsa: :)

15:09 gfredericks: huh? what's CONTRIB?

15:10 arrdem: clojurebot: contrib |is| a wasteland of abandoned dreams

15:13 gfredericks: hiredman: would it be easy for you to post a dump of the clojurebot database?

15:13 arrdem: or if we could get read only REST interfaces to Clojurebot and Lazybot...

15:13 that'd be sweet..

15:14 hiredman: gfredericks: uh, maybe, I'd have to remember how to use postgres

15:15 jkj: hiredman: pg_dump -h localhost -U myuser databasename > file.sql

15:15 gfredericks: pgdump

15:17 hiredman: I would maybe use copy to dump to a csv

15:22 gfredericks: http://thelibraryofcongress.s3.amazonaws.com/clojurebot.csv

15:23 gfredericks: ohboyohboyohboyohboyohboy

15:23 arrdem: (inc hiredman)

15:23 lazybot: ⇒ 42

15:23 hiredman: oh, did I forget to exclude the passwords?

15:23 arrdem: I'm gonna have entirely too much fun reading that...

15:23 gfredericks: (inc hiredman)

15:23 lazybot: ⇒ 43

15:23 gfredericks: ~everyday

15:23 clojurebot: everyday is Rich Hickey Appreciation Day

15:24 arrdem: ~clojureboty

15:24 ~clojurebot

15:24 T_T is clojurebot ignoring me? :P

15:25 gfredericks: huh; why's there a separate column for the subject in uppercase?

15:26 arrdem: ~advice

15:26 justin_smith: ,:ping

15:26 clojurebot: :ping

15:26 Bronsa: ~advice

15:26 clojurebot: live every week, like it is shark week!

15:26 Bronsa: arrdem: clojurebot doesn't like you

15:26 hiredman: gfredericks: because I generally forget sql has string operators

15:27 arrdem: Bronsa: I noticed :c

15:27 Bronsa: better roll my own bot....

15:27 Bronsa: added benifit, having three bots in chan we can finally botstack!

15:28 gfredericks: hiredman: is that there just for the inference?

15:28 or matching...

15:28 ~EVErydAY

15:28 clojurebot: Cool story bro.

15:29 hiredman: gfredericks: I don't recall off hand

15:47 brainkim: I 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:47 (def twin-strings

15:47 (such-that

15:47 shit

15:48 I'm just creating a tuple of strings and fitering for tuples with strings of teh same length, and that takes way too long

15:48 reiddraper: brainkim: only use such-that if there's a very high likelihood the predicate will pass

15:49 amalloy: yeah, you don't want to create two random strings and keep trying till you find some with the same length

15:49 justin_smith: why not filter strings, and take the first two of the same length?

15:49 reiddraper: In your case, you almost certainly _won't_ generate strings of the sand length

15:49 amalloy: you want to create one random string, and then make another of the same length, probably with fmap?

15:49 gfredericks: not fmap

15:49 you could use bind with a length

15:50 or bind with two strings similar to amalloy's suggestion

15:50 make one string and cut it into two pieces! :D

15:50 brainkim: gfredericks: brilliant :D

15:50 gfredericks: that might shrink poorly

15:51 though perhaps not...

15:51 the weird odd character out could interact strangely with shrinking

15:52 brainkim: thanks all will report back.

15:52 gfredericks: if you want to be really wasteful, generate two strings and use fmap to truncate the larger one

15:54 reiddraper: I would recommend starting with just chopping a string in two like gfredericks suggests

16:01 Rosnec: when the doc for send-off says "a potentially blocking action", does it mean the call to send-off might block as well?

16:01 for some reason my program is blocking indefinitely when I call send-off one time

16:02 I thought it just meant the action you send might block, not the call to send-off as well

16:02 hiredman: Rosnec: 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:03 Rosnec: hiredman, it's not that the whole jvm not shutting down is a problem, the very next function call never gets made

16:04 I put a print call right after it, and it's never printing it

16:04 the one right before, however, is

16:04 hiredman: Rosnec: is send-off throwing an exception?

16:04 justin_smith: Rosnec: can you paste the relevant code?

16:04 Rosnec: justin_smith, it's kind of hard to give a meaningful example

16:05 basically I do (send-off the-agent a-function-that-blocks arg1 arg2) (println "this never gets printed")

16:05 actually

16:06 it's inside a let

16:06 hiredman: Rosnec: is your call to send-off throwing an exception?

16:06 Rosnec: no, hiredman

16:06 at least not one that I'm seeing

16:06 hiredman: Rosnec: how do you know?

16:06 steckerhalter: so evil seems to bring more users to emacs than the cl- prefix even

16:06 Rosnec: hiredman, I guess I don't know

16:06 hiredman: Rosnec: well make sure

16:06 Rosnec: do the exceptions not get shown?

16:06 steckerhalter: wrong channel :)

16:07 hiredman: Rosnec: it depends on lots of things

16:07 Rosnec: I'm not catching any exception. Do exceptions not trickle all the way down when they're sent off?

16:07 hiredman: Rosnec: I mean the call to the send-off function

16:07 brainkim: Figured out the gen strings of equal length problem :) https://gist.github.com/anonymous/d554db2e88f2b733b26a

16:08 Rosnec: if the send-off function throws an exception, will it actually get thrown in the block of code that called send-off?

16:09 I mean, it's entirely possible that it will thrown an IOException, I just don't see it in my terminal output

16:09 and I'm not catching an IOException

16:09 does the exception stay within the agent?

16:10 ah, I guess they do

16:10 wait, so if an agent blocks the calling thread when it throws an exception, how am I supposed to handle it?

16:11 brainkim: nm still a bit too slow.

16:11 mk12: Does 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:12 amalloy: Rosnec: an agent doesn't block the thread calling send, except if you're trying to send from inside a transaction maybe?

16:12 really not even then, but there's some weird stuff you can do that might make you think it's blocking

16:12 Rosnec: amalloy, nope not in any transaction

16:12 It's inside a let actually, maybe that's the cause?

16:13 I'm just binding the result to _

16:13 will that cause it to block?

16:13 amalloy: no

16:13 under no circumstances does send-off block, if you're not in a transaction

16:13 Rosnec: ok

16:13 this is really weird then

16:14 justin_smith: try finding the briefest code that will make the error happen

16:14 Rosnec: wait

16:14 it's actually an agent that's calling send-off on a different agent

16:15 could that be the issue?

16:15 since they share a thread pool?

16:15 maybe if I put them in separate pools it would fix it?

16:16 mi6x3m: clojure, am I right that 'bindings' is the only way to establish dynamic bindings

16:16 and the vars have to have :dynamic meta?

16:16 amalloy: Rosnec: that should be okay, as long as you're not relying on any timing related to the send-off happening

16:17 Rosnec: amalloy: no, I'm not relying on any timing

16:17 actually

16:17 gfredericks: mk12: you're expected to annotate those vars with :no-check metadata

16:17 Rosnec: is it possible that calling send-off could throw an exception in the calling thread?

16:17 perhaps the agent that's calling it is dying

16:17 amalloy: yes, if you were calling send-off on something that's not an agent

16:18 Rosnec: and that's why it never prints after

16:18 hmm

16:18 amalloy: or maybe if you passed it a function that's not a function, but i don't think so

16:18 Rosnec: that's actually possible I did that by mistake

16:18 I'll double check

16:19 mk12: gfredericks: What do I put for the type, though? (ann ^:no-check myfunc) doesn't work

16:20 gfredericks: 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:20 gfredericks: mk12: you can start with [Any -> Any] etc

16:21 mk12: I agree it's a little bit tedious up front

16:21 (def-alias AnyFunc [Any * -> Any]) ; might work?

16:24 Rosnec: ooh, looks like one of the agents failed

16:24 mk12: gfredericks: 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:26 cbp: has anyone compiled protobufs with lein protobuf recently?

16:26 mk12: gfredericks: 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:26 cbp: It doesn't seem to work anymore at least on OS X

16:26 gfredericks: mk12: it definitely takes a lot of work to get your codebase _partially_ typed and passing the type checker

16:26 cbp: even the old version that always seemed to work

16:27 gfredericks: I 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:28 Rosnec: ok, I think I know what's happening

16:28 gfredericks: mk12: there are certain idiomatic clojure styles that don't go well with core.typed, and #(myfunc a % b) is one of them

16:28 cbp: Fails with some "unable to find program" error

16:28 Rosnec: if you send something to an agent that's already failed, you get an exception, right?

16:28 gfredericks: Rosnec: yep

16:28 Rosnec: then that's it

16:28 gfredericks: Rosnec: that's bitten me a couple times this week

16:28 Rosnec: the one agent is sending something to a failed agent

16:28 gfredericks: Rosnec: the docs for agent give alternative ways of dealing with failures

16:28 Rosnec: and then the main thread is awaiting that agent

16:29 gfredericks: yeah the docs for await says it blocks forever on failed agents I think

16:29 Rosnec: yeah

16:29 gfredericks: kind of a weird feature

16:29 Rosnec: I was just confused why the agent's function was stopping when it sent something to the other agent

16:29 that's why

16:29 mk12: gfredericks: 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:30 gfredericks: mk12: you can annotate them yourself

16:30 the same as you would a library function

16:30 mk12: I 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:31 gfredericks: 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:32 gfredericks: mk12: yes, but you only have to type it well enough for your own purposes

16:32 which is often a lot simpler

16:33 * gfredericks pulls out a stylelized photo of ambrose with the caption "You don't have to do what he did"

16:33 holo: hi

16:33 gfredericks: holo: hi

16:35 holo: I read several times people say "require clojurescript explicitely" does that mean in libraries one should include it as a :dev dependency?

16:36 egork8n: Hi, everyone!

16:36 holo: hi egork8n

16:36 egork8n: I'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:37 Any pointers?

16:37 gfredericks: egork8n: how are you running it?

16:37 egork8n: I'm building a WAR file with lein ring uberwar

16:37 gfredericks: holo: yeah prollably

16:38 egork8n: and how are you running the war file?

16:39 holo: gfredericks I'm downgrading clojurescript, just for a human reference on the minimum requirement, since it's not going to be used anyway

16:40 amalloy: egork8n: when you make a WAR file, don't you have to provide init/destroy functions?

17:00 justin_smith: amalloy: I have never seen a destroy, but yeah, you provide your intit to ring with lein ring

17:00 amalloy: https://github.com/weavejester/lein-ring#general-options

17:01 justin_smith: I just found that and was about to link the same

17:01 technomancy: the JVM has a generalized shutdownhook iirc

17:01 justin_smith: but with a WAR the jvm is still sticking around

17:01 technomancy: http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread)

17:02 justin_smith: oh, huh

17:02 yet another arbitrary difference between war files and Regular clojure programs I guess

17:02 justin_smith: the jvm runs tomcat or whatever, and then it can start or stop various wars, without shutting down the jvm

17:03 yeah, some people see it as a benefit

17:04 http://en.wikipedia.org/wiki/Java_Servlet

17:05 gfredericks: technomancy: war files aren't inherently that way, that's just how they're normally used

17:05 as something you deploy to a container

17:05 justin_smith: gfredericks: oh, a war can be used other than as a servlet?

17:06 http://en.wikipedia.org/wiki/WAR_file_format_(Sun)

17:06 the wiki seems to imply a war is always a servlet (plus resources etc.)

17:07 Jaood: is a war just some type of jar customized for application servers?

17:07 justin_smith: it is a jar, yeah

17:07 iXeno: Jaood: it's a format made for deploying to app servers

17:08 gfredericks: justin_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:08 justin_smith: ahh, right

17:08 iXeno: it's a zipped down web application format

17:08 justin_smith: the fact that the jvm does not shut down then the servlet does is just an implimentation detail, not a requirement, of course

17:09 iXeno: all jars are zips, and a war is a jar

17:09 iXeno: yeah

17:10 gfredericks: and a war.zip is a

17:19 Rosnec: is there any reason a PersistentVector passed through send-off would be cast to a BufferedOutputStream?

17:19 it's the argument to the dispatch fn

17:21 before I pass it in, I have a LazySeq of PersistentVectors. Once passed in, I have a Cons of BufferedOutputStreams

17:21 the cons part makes sense, but not the BufferedOutputStream

17:23 gfredericks: Rosnec: why would something change its type at all?

17:23 justin_smith: Rosnec: that's weird, send-off should be sent a function, not a cons

17:23 Rosnec: the cons is the final arg

17:23 justin_smith: ahh, ok

17:23 Rosnec: gfredericks, I don't know why it would change type

17:23 justin_smith: and yeah, what gfredericks said

17:23 Rosnec: which is why it's baffling me

17:24 I'm printing out the type from the calling fn

17:24 and printing it again from within the dispatch fn

17:24 and the types are different

17:24 it's bizarre

17:24 gfredericks: what does dispatch fn mean in the context of agents?

17:24 Rosnec: (send-off agent dispatch-fn & args)

17:25 justin_smith: that's a weird name for f

17:25 Rosnec: is that not proper use of the term?

17:25 justin_smith: that implies a multimethod to me

17:25 Rosnec: ah

17:25 justin_smith: though the f of send-off could be a multimethod I guess

17:26 Rosnec: well I'm just going by the use of the word "Dispatch" in the send doc

17:26 "Dispatch a potentially blocking action to an agent."

17:26 I guess it's not quite accurate to call it a "dispatch-fn"

17:26 but that's the fn I'm referring to

17:26 justin_smith: yeah, a "dispatch function" is the function that decides what impl of a multimethod gets called

17:26 Rosnec: ok

17:26 justin_smith: that is a function dispatched to an agent

17:27 Rosnec: right

17:27 justin_smith: as opposed to the function that dispatches a call to a multimethod impl

17:27 Rosnec: I was just calling it a dispatch-fn because it is a function that is dispatched

17:27 seems logical

17:27 forgot dispatch-fn had a specific meaning

17:27 justin_smith: dispatched-fn would be more accurate

17:27 Rosnec: ok

17:28 guess that makes sense

17:29 so basically what's happening is this

17:29 I have a sequence of sequences of bytes, which I'll call x

17:29 before dispatching to the agent, I print (type x) and (-> x first type)

17:30 justin_smith: how are you determining that your function gets BufferedOutputStream instances when you give it vectors?

17:30 Rosnec: I'm determining that by printing the following from within the dispatched fn

17:30 (type x) (-> x first type)

17:30 same thing

17:30 the output is different, though

17:31 justin_smith: there is some other error

17:31 Rosnec: at first I get: clojure.lang.LazySeq clojure.lang.PersistentVector

17:31 then from within the dispatched fn I get: clojure.lang.Cons java.io.BufferedOutputStream

17:31 I figured there's some other error

17:31 I just don't see where it could possibly occur

17:31 justin_smith: the first arg to the agent is the previous state of the agent

17:31 not the last arg to send-off

17:32 Rosnec: yes

17:32 hmm

17:32 wait a minute

17:32 justin_smith: so the previous state did not create BufferedOutputStreams?

17:32 Rosnec: actually

17:32 justin_smith: *was not BufferedOutputStreams I mean?

17:32 Rosnec: well I'm not actually using the agent to hold any state, so I just put 0 in it

17:33 but I wonder if one of the functions I send it is changing that to a BufferedOutputStream

17:33 and actually

17:33 the function I'm sending it doesn't take the state of the agent, like it should

17:33 that might be the whole problem

17:34 justin_smith: the first arg will be the staet

17:34 *state

17:34 Rosnec: right, I think I overlooked that fact

17:34 ok, rerunning it with that fixed

17:34 *crosses fingers*

17:35 haha

17:35 fixed that type change issue

17:35 ohhhh

17:35 I see how it got a BufferedOutputStream

17:35 insamniac: Anyone google code jamming?

17:35 Rosnec: the dispatched fn had arguments (output-stream & bytes-to-write)

17:36 because I didn't put a dummy argument in front of output-stream

17:36 it was getting put inside of the & bytes-to-write

17:36 so when I called (first bytes-to-write)

17:36 I was getting what should have been in output-stream

17:37 tuft: any reason not to put the examples from the web documentation into what you see when you run (doc)?

17:38 Rosnec: haha, looks like that was the biggest issue with my code

17:38 got a lot further before crashing this time :)

17:38 it's crashing where I almost expected it to

17:38 but hoped it wouldn't

17:38 progress!

17:42 tuft: is there a cond style form that does binding?

17:42 kinda like a multi if-let i guess

17:43 bbloom: (doc cond)

17:43 clojurebot: "([& 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:43 bbloom: er, rather:

17:43 (doc condp)

17:43 clojurebot: "([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:43 bbloom: tuft: does the :>> thing help you?

17:44 Rosnec: I've never seen that before

17:44 not that I'm tuft

17:44 bbloom: i've only used it once, but it exactly what i needed :-)

17:46 Jaood: iXeno: k

17:46 what's the difference between drop-while and remove?

17:49 seanaway: ,(drop-while even? [2 4 6 7 8 9 10])

17:49 clojurebot: (7 8 9 10)

17:49 seanaway: ,(remove even? [2 4 6 7 8 9 10])

17:49 clojurebot: (7 9)

17:50 seanaway: remove takes away all elements that match the predicate, drop-while only removes the leading subsequence of such elements

17:51 similarly take-while and filter:

17:51 ,(take-while even? [2 4 6 7 8 9 10])

17:51 clojurebot: (2 4 6)

17:51 seanaway: (filter even? [2 4 6 7 8 9 10])

17:51 Jaood: ,(remove neg? (range -10 10))

17:51 clojurebot: (0 1 2 3 4 ...)

17:51 Jaood: ,(drop-while neg? (range -10 10))

17:51 clojurebot: (0 1 2 3 4 ...)

17:52 seanaway: ,(filter even? [2 4 6 7 8 9 10])

17:52 clojurebot: (2 4 6 8 10)

17:52 seanaway: if the only elements matching the predicate are at the beginning, drop-while and remove will behave the same way

17:52 Jaood: seanaway: thanks

18:37 bbloom: The github.com/brandonbloom/eclj interpreter is now officially self-applicable! :-D

18:39 justin_smith: cool - how far from bootstrapping is it?

18:39 bbloom: justin_smith: depends on how you define "bootstrapping"

18:40 gfredericks: reiddraper: oh crap I forgot to rename rose-bind

18:41 reiddraper: gfredericks: i can fix that real quick

18:41 gfredericks: +1

18:42 reiddraper: I'm curious how much time it takes to apply a patch from jira compared to github's one-click PR merge

18:43 reiddraper: gfredericks: 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:43 jeremyheiler: bbloom: nice!

18:43 reiddraper: i would prefer using pull-requests, but, c'est la vie

18:44 gfredericks: hm, doesn't even look like rose/bind is used anywhere

18:44 gfredericks: oh weird

18:44 you just wrote it because haskell made you do it? :)

18:45 technomancy: one time I submitted a pull request on tools.nrepl and chas merged it

18:45 the thing about policies is sometimes you just forget, you know?

18:45 tuft: bbloom: indeed! thanks

18:45 bbloom: justin_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:45 gfredericks: technomancy: oh man I bet he still gets super embarrassed whenever he remembers it

18:46 technomancy: gfredericks: one of those regrets that will follow him to the grave

18:46 justin_smith: bbloom: very cool

18:47 bbloom: justin_smith: thanks

18:47 gfredericks: mister fingerhut made a joke jira ticket on tools.nrepl after a drink or two

18:47 bbloom: jeremyheiler: thanks to you too

18:48 reiddraper: gfredericks: must've been, haha. i think i'll keep it for consistency though

18:52 jeremyheiler: bbloom: oh, how come?

18:53 oh. blah. context.

18:53 reiddraper: gfredericks: fixed and pushed

18:54 gfredericks: reiddraper: sweet thanks

18:54 kenrestivo: ~context is burger king

18:54 clojurebot: c'est bon!

18:54 reiddraper: gfredericks: np

18:59 gfredericks: ~~context

18:59 clojurebot: I don't understand.

18:59 gfredericks: ~context

18:59 clojurebot: context is burger king

18:59 gfredericks: huh

18:59 ToBeReplaced: since 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:00 bob2: bbloom, it's clojure implemented in clojure?

19:03 Jaood: bob2: the building blocks is written in Java

19:07 amalloy: gfredericks: 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:08 gfredericks: amalloy: I cannot recall that for I did not know it originally; but that clears it all up

19:08 Jaood: talking of ignorance here, but what's the challenge of building the compiler in Clojure? since there already exists a compiler to bootstrap it?

19:08 amalloy: gfredericks: 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:10 justin_smith: recall how "recall that ___" works in textbooks...

19:10 amalloy: justin_smith: yeah, i avoided that phrasing, but i think you're right that it's more fun that way

19:15 bbloom: bob2: it's a clojure interpreter in clojure, but i'm planning to do a proper compiler too

19:16 bob2: it (currently) reuses almost all of the official runtime library

19:20 kenrestivo: haha just spotted the burger king bit

19:20 if you remember that, that means my nemonic was successful :-)

19:35 amalloy: bbloom: sadly i haven't yet had a conversation in which the context was right to bring up the burger-king slide

19:36 bbloom: amalloy: you just haven't smoked enough trees yet

19:59 noprompt: what's a good way to communicate information to parents from children with om?

20:02 e.g. i'm an element in a vector, remove me w/o performing two transactions.

20:03 also i don't know i'm in a vector

20:12 brainkim: noprompt: Does this help? https://github.com/swannodette/todomvc/blob/gh-pages/labs/architecture-examples/om/src/todomvc/app.cljs#L103-L106

20:16 noprompt: lemme dig around, i was thinking i'd probably have to do something a long the lines of using some kind of comm channel.

20:25 gfredericks: amalloy: you should have explained that via "Recall how recall works in textbooks: ..."

20:25 amalloy: gfredericks: recall that justin_smith already suggested that

20:25 i considered it, but erroneously rejected it as sounding a bit too smug

20:25 gfredericks: oh snap

20:26 recall that I did not read the backlog in that much detail

20:26 ~recall |that| clojurebot interprets "~foo" as "clojurebot: foo"

20:26 clojurebot: Ik begrijp

20:29 amalloy: gfredericks: 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:29 ,`(~'(~foo) (~'clojurebot ~'foo)) ;; looks like a mess

20:29 clojurebot: (((clojure.core/unquote foo)) (clojurebot foo))

20:31 gfredericks: amalloy: yeah; you kind of have to have some sort of meta-language for talking about these kind of things; and escaping.

20:32 I have no idea what that clojure code was supposed to convey

20:32 but I have had like three glasses of wine which is like 17 normal-person-glasses

20:34 amalloy: makes sense. three is about the upper limit for me saying things that make any sense

20:58 tuft: bbloom: actually, what i need is more like if-let than cond

20:59 (if-letp [foo (maybe-foo)] (something foo) [bar (maybe-bar)] (something-else bar))

21:01 gfredericks: (defmacro ifletp [pair expr & more] `(iflet ~pair ~(when more `(ifletp ~@more))))

21:02 * gfredericks forgot the ~expr

21:03 gfredericks: also s/iflet/if-let/

21:03 #drunkmacros

21:04 justin_smith: well it depends if they should have "and" semantics, or "or" semantics - the above is and

21:11 gfredericks: I have no context

21:11 martinklepsch: Is there a way to specify a different relative root directory when using xml/parse ?

21:11 parsing requires a dtd file but I'd like to put files to parse in subdirectories

21:12 (and that dtd file needs to be in the same location as the file to parse by default)

21:26 Rosnec: so I have a sorted map, where the keys are numbers, and I want to take the values whose keys are in some range

21:26 what's the fastest way to do that, while maintaining the order?

21:26 if I use reduce, it will go further than it needs to

21:26 gfredericks: there's a function for that sort of thing

21:26 Rosnec: I could use take-while with the maximum key, and then reduce afterwards

21:26 gfredericks, I thought there might be

21:27 gfredericks: but what on earth was it called...

21:27 Rosnec: select-keys seems to be breaking the ordering

21:27 gfredericks: to the cheatsheet!

21:27 justin_smith: Rosnec: with reduce you can shortcircuit with reduced

21:27 gfredericks: no there's something specialized to sorted collections

21:27 Rosnec: justin_smith: o rly?

21:28 gfredericks: ,(doc rsubseq)

21:28 justin_smith: ,(reduce (fn [t i] (if (> i 10) (reduced t) (+ i t))) (range))

21:28 clojurebot: "([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:28 55

21:28 justin_smith: notice the input to that reduce was infinite in length

21:28 gfredericks: ,(doc subseq)

21:28 clojurebot: "([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:28 Rosnec: ohh, so that's what reduced is for

21:28 gfredericks: Rosnec: subseq is what you want

21:29 Rosnec: gfredericks: perfect!

21:29 wow, that's even better than I could have imagined

21:29 I even get to differentiate between using < and <=

21:30 I thought I'd have to throw an (inc) in there somewhere

21:30 * gfredericks has never used this function his entire life ever

21:31 Rosnec: well Rosnec is about to

21:31 justin_smith: yeah, I pretty much never use the sorted collections even, but that is perfect for that situation

21:31 gfredericks: ,(def my-nums (apply sorted-set (take 15 (iterate #(* 2 %) 3))))

21:31 clojurebot: #'sandbox/my-nums

21:31 gfredericks: my-nums

21:31 ,my-nums

21:31 clojurebot: #{3 6 12 24 48 ...}

21:31 Rosnec: looks like it might have worked

21:31 gfredericks: ,(subseq my-nums < 48)

21:31 clojurebot: (3 6 12 24)

21:31 gfredericks: ,(subseq my-nums > 8 < 1000)

21:31 clojurebot: (12 24 48 96 192 ...)

21:31 gfredericks: ,(subseq my-nums > 8 < 100)

21:31 clojurebot: (12 24 48 96)

21:32 gfredericks: nice.

21:32 Rosnec: :O it worked!!

21:32 gfredericks: it's probably log time too

21:32 martinklepsch: (split-at #(= 2 %) [1 2 3 2 4]) => [(1) (2 3) (2 4)]

21:33 is something like this possible?

21:33 gfredericks: you could certainly write it

21:33 martinklepsch: or better, is there some built in or simple fn to use?

21:33 gfredericks: split-with is similar but might not be able to do what you need

21:33 it takes a fn and makes a new group when the return value changes

21:34 martinklepsch: split-with only works to split in two parts

21:34 gfredericks: ,(split-with #(quot % 3) (range 10))

21:34 clojurebot: [(0 1 2 3 4 ...) ()]

21:34 gfredericks: wait

21:34 I meant

21:34 partition-by I Think

21:34 ,(partition-by #(quot % 3) (range 10))

21:34 clojurebot: ((0 1 2) (3 4 5) (6 7 8) (9))

21:39 martinklepsch: ok, now I have some thing like [(1) (2 3 4 5) (1) (2 5 3 6)] when partioning by #(= 1 %)

21:39 it's a good start

21:40 now I want to combine this to something like [(1 2 3 4 5) (1 2 5 3 6)]

21:40 ... think I have an idea

21:40 thanks for now

21:50 gfredericks: martinklepsch: I think a recursive thing that uses split-with would be pretty simple

21:51 martinklepsch: gfredericks yeah, but I'd end up with the splitting element in a seperate sequence as well

21:52 right now I'm trying to figure out how to make ((1) (5 6 7)) to (1 5 6 7)

21:52 probably should go to bed :D

21:53 gfredericks: martinklepsch: okay now I have to write it

21:53 martinklepsch: gfredericks hehe

21:54 gfredericks: the tricky part is that the sequence may or may not start with a matching element

21:57 martinklepsch: gfredericks, in my case that probably would be useful in my case I can assume that though

21:57 (trying to parse a file w/ multiple <?xml version="1.0" encoding="UTF-8"?> statements...)

21:59 but I assume xml/parse with more complex xml files only works with supplying a uri

22:01 gfredericks: martinklepsch: uglier than I was hoping: https://www.refheap.com/75826

22:02 but it seems to work

22:04 martinklepsch: still cool to see :)

22:07 gfredericks, any experience w/ xml parsing? can't come up with a better way then splitting the files before parsing using awk

22:08 (so that I can hand a URI to xml/parse and not a string)

22:09 gfredericks: martinklepsch: 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:09 I mostly just had to wrangle the zipper libs and stuff to find what I was looking for

22:11 martinklepsch: no problem :)

22:42 myguidingstar: does Clojure compiler gen-class for namespaces with (:gen-class) when leining profile doesn't contain :aot something?

23:04 Platz: since take-while doesn't use recur (not in tail position), why doesn't it overflow the stack?

23:06 devth: Platz: i suspect it has to do with the lazy-seq but don't know beyond that

23:10 Platz: devth: docs for lazy-seq seem to indicate that it's because it just returns a closure as opposed to invoking the body

23:10 so that explains it, interesting

23:10 devth: right

23:11 TravisD: Platz: 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:12 The 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:13 Platz: kind of like just returning a lambda

23:13 thunk, whatever

23:14 akurilin: quick 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:14 TravisD: Yeah, very similar. Trampoline accomplishes essentially the same thing, and requires you to return functions

23:15 akurilin: "existing one" being one from clojars

23:16 TravisD: Platz: 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:16 mainly because it's not lazy :)

23:17 Platz: hah, good point

23:48 martinklepsch: using futures can I easily see how long it ran?

23:49 (time @f) doesn't really return anything usefuk

23:49 except the future result

23:57 turbofail: martinklepsch: no, there's no built-in way to do that

23:58 martinklepsch: turbofail, ah ok

23:58 turbofail: shouldn't be that hard to hack something that will do it though

Logging service provided by n01se.net