#clojure log - Aug 03 2015

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

2:07 ebzzry: what is the equivalent of printing to /dev/stdout in windows, if there is any?

2:59 MasseR: Isn't System.out akin to /dev/stdout?

3:00 So just println would do the trick

3:00 (and print)

3:26 tmtwd: if I wanted a random number in cljs would I use the clojure random number gen or the javascript random number generator?

3:30 oddcully: tmtwd: if there is nothing the interop one has over the "clojure" one, then i'd use the clojure one

3:30 tmtwd: like (rand-int 30)?

3:31 So I can use clojure libraries in cljs?

3:31 oddcully: well rand(-int) is implemented using JS interop

3:31 ,(source rand)

3:31 clojurebot: Source not found\n

3:32 oddcully: compare this with the one in your js repl

4:31 pydave6367: Hey all. Beginner at Clojure and after any pointers I can get at making the following one-liner more idiomatic: https://gist.github.com/davekcd/f6f12bee7de11e5acad5 Any help greatly appreciated!

4:48 vijaykiran: pydave6367: (map hash-map (flatten %) [4 3 8 9 5 1 2 7 6]))) << '%' works in anon-functions, typo ?

4:53 pydave6367: vijaykiran: Ah: that was me using it as an anonymous function for the 4clojure solution. Here is what it looked like in the repl before I made it an anonymous function:

4:53 (get (clojure.set/map-invert (apply merge-with + (map hash-map (flatten [[:x :e :o] [:x :e :e] [:x :e :o]]) [4 3 8 9 5 1 2 7 6]))) 15)

4:53 vijaykiran: (also, thanks so much for looking!)

6:49 sheldonh: is count O(1) for a vector?

6:49 hyPiRion: sheldonh: yes

6:50 sheldonh: hyPiRion: ta. is there a document for this? i get a lot of stack overflow when i google, and the documentation of the functions clearly isn't the right place to look

6:57 EuS8yeiF: sheldonh: actually it's exactly the docstrings where complexity of functions is usually written

6:58 sheldonh: EuS8yeiF: often, yes

7:02 Aha! http://clojure.org/data_structures

7:03 oddcully: sheldonh: should be this one: https://github.com/clojure/clojure/blob/838302612551ef6a50a8adbdb9708cb1362b0898/src/jvm/clojure/lang/PersistentVector.java#L204

7:04 sheldonh: oddcully: thanks. hard to argue with that ;)

7:57 gfredericks: TEttinger: so that's an idea for implementing a splittable RNG?

7:58 I think the problem will be how you split the already-split generators

8:28 crocket: I think LEIN_FAST_TRAMPOLINE environment variable doesn't enable trampoline in leiningen.

8:30 Probably, I should look for grenchmen.

8:30 Oh, grenchman is dead.

8:34 Leonidas: crocket: is it officially?

8:35 I could actually work on it, come to think of it.

8:35 crocket: I think grenchman is dead because it is written in OCaml and intends to serve clojureists.

8:35 clojurists

8:36 Leonidas: crocket: it cannot be written in clojure, that would defeat it's purpose.

8:36 in ClojureScript, maybe.

8:36 And OCaml is actually a pretty awesome language

8:37 crocket: But, you can't assume that many clojurists know how to write in OCaml

8:37 Leonidas: crocket: not all clojurists contribute to Leiningen, that doesn't mean it's dead either.

8:38 crocket: https://github.com/technomancy/leiningen/commits/master tells me there are enough clojurists who contribute to leiningen.

8:38 For grenchman, there is none.

8:39 For a given open source project to obtain contributors, it needs to have an enough number of users who know the language of the project.

8:40 I think grenchman failed because of the language barrier.

8:40 https://github.com/technomancy/leiningen/graphs/contributors tells me there have been 267 contributrs to leiningen.

8:41 For two years, there has been no activity in grenchman.

8:41 So, it's safe to assume that it's probably dead.

8:41 Leonidas: sure, but being successful is something different from being dead

8:41 *being not successful

8:42 crocket: Ok, my perception was a little bit off.

8:42 It's almost dead.

8:42 6 commits over 2 years

8:43 And, technomancy has ignored 3 pull requests for 2 years.

8:43 Leonidas: ok, that is a good point

8:47 crocket: I hope clojure could be used to write kernels.

8:50 wasamasa: trololol

8:52 some day people will value old code more than new code

9:15 ambrosebs: Bronsa: do you think it's possible to convert jvm.tools.analyzer output to conform to tools.analyzer.jvm?

9:16 doing some performance testing, it seems worth investigating.

9:20 Bronsa: ambrosebs: not sure I'll have to look at it, might be possile

9:21 ambrosebs: Bronsa: what exactly does :env need to look like?

9:21 and how important is :form?

9:21 it seems possible to recreate :form.

9:22 Bronsa: ambrosebs: I seem to recall that Compiler.java does save the form somewhere, might be wrong

9:22 ambrosebs: t.a.jvm uses it to retrieve tag info

9:23 but if it's already annotated by Compiler.java it's not really needed AFAICT

9:23 ambrosebs: ah ok.

9:25 Bronsa: ambrosebs: wrt :env, it should just have :context, :locals, :ns and the source info

9:25 ambrosebs: ok that sounds reasonable.

9:25 Bronsa: ambrosebs: hardest stuff might be converting the locals represetntation of Compiler.java to the locals map used by t.a.jvm in :env

9:26 ambrosebs: what's the rep?

9:26 oh

9:26 I was thinking to just make a new one.

9:26 Bronsa: I don't think Compiler.java saves the locals info anywhere, it's just an internal Var that doesn't contain anything when Compiler.analyze returns

9:27 ambrosebs: we could probably recreate :locals with an extra t.a-style pass

9:28 Bronsa: yeah

9:28 ambrosebs: would this have a place in tools.analyzer.jvm if it works out?

9:28 Bronsa: sure

9:29 ambrosebs: ok great. I'll create an issue and chug away.

10:35 justin_smith: sheldonh: regarding complexity of running count, there is the predicate, counted?

10:35 ,(counted {})

10:35 err

10:35 clojurebot: #error {\n :cause "Unable to resolve symbol: counted in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: counted in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6611]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: counted i...

10:35 justin_smith: ,(counted? {})

10:35 clojurebot: true

10:35 justin_smith: ,(counted? (lazy-seq nil))

10:35 clojurebot: false

10:36 justin_smith: ,(counted? (list 1 2 3))

10:36 clojurebot: true

10:36 justin_smith: ,(counted? (range))

10:36 clojurebot: false

10:36 justin_smith: if counted? returns true, then the count is stored, and has O(1) lookup for that data

10:37 sheldonh: justin_smith: awesome, thanks

10:37 justin_smith: ,(mapv (juxt #(do %) counted?) [nil () [] {}

10:37 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

10:38 justin_smith: ,(mapv (juxt #(do %) counted?) [nil () [] {} "" (range) (lazy-seq nil) (list 1)])

10:38 clojurebot: [[nil false] [() true] [[] true] [{} true] ["" false] ...]

10:38 justin_smith: woah, I am surprised that "" is not counted

10:40 I wonder if that's just because nobody extended clojure.lang.Counted to string - because if jvm strings are immutable it would be really silly not to store their size...

10:40 hyPiRion: justin_smith: Counted is an interface, so can't do any magic there.

10:41 They are constant time however, https://github.com/clojure/clojure/blob/d534894c3006474068e46b67e4b838bf3727722d/src/jvm/clojure/lang/RT.java#L614

10:41 justin_smith: hyPiRion: ah, got it - if it was a protocol it would be another story I guess

10:41 hyPiRion: right, I was assuming that :)

10:41 hyPiRion: Yeah. We should protocol everything

10:42 sheldonh: seems like it deserves a special case in (counted?)

10:43 justin_smith: yeah, it seems like when you call counted? what you really want to know is if I can call count and get a fast result - or I wish that was what counted? was useful for at least

10:43 similar to seqable

10:43 which isn't actually a function either but should be

10:44 hyPiRion: yeah

10:45 justin_smith: I've just written sequable? based on the source for seq - but that feels a bit off, and potentially needs updating with newer clojure versions

11:01 puredanger: there is one in incubator if you want to compare

11:01 justin_smith: puredanger: oh, cool

11:01 puredanger: https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/incubator.clj#L83

11:01 I think there is a ticket to add this to core. if not, there should be.

11:02 http://dev.clojure.org/jira/browse/CLJ-401

11:02 justin_smith: puredanger: yeah, that's really close to what I had

11:02 (inc puredanger)

11:02 lazybot: ⇒ 61

11:09 puredanger: Bronsa: oops, looks like I stomped your changes on 401 :)

11:09 jira fail

11:10 Bronsa: puredanger: did you mean to remove the example? if so my change doesn't matter :)

11:10 I just wrapped the last example in a {code} block since jira rendered it badly without it

11:10 puredanger: yeah, I didn't think most of the existing description was relevant

11:11 I just rescued the example into a comment

11:12 Bronsa: puredanger: while you're here, could you give me your opinion on CLJ-1093? Stuart declined it but I don't think it should be closed

11:12 I know it's an edge case but I can't understand how the fact that (defrecord X []) #user.X[] returns {} shouldn't be considered a bug

11:12 puredanger: Rich considers that the expected behavior

11:13 per the same reason as that other ticket

11:13 Bronsa: it's different to the other ticket though

11:13 this one behaviour is not in agreement with what's in the docs

11:15 either that or all record reader-literals should return maps rather than records, not just empty ones

11:17 puredanger: rich's explanation was that records are maps, then see the evaluation page

11:17 Bronsa: puredanger: right, but (defrecord Y [a]) #user.Y[a] returns a record, not a map

11:17 http://sprunge.us/Cjhd?clj

11:18 puredanger: I can bring it up again; I was on a consulting gig last week so wasn't in the conversation

11:19 Bronsa: thanks, that would be appreciated

11:20 puredanger: added it to my notes for next touch point

12:08 kwladyka: which function should i use to update meta? with-meta?

12:09 to update meta based on meta value, so something like for example inc

12:10 depro: Hi, I am trying to make ring.jetty/http-kit non-blocking on long-running requests, but seems like only one request is served at any one time

12:11 https://gist.github.com/anonymous/2277a027cfe27a89a5df

12:11 In jetty, the code above only serves one request at a time

12:12 Similarly I’ve tried looking at http-kit, with-message but it doesn’t work either

12:14 kwladyka: hmm or vary-meta...

12:19 depro: Any ideas how to make ring jetty / http-kit non-blocking?

12:21 It doesn’t need to be non-blocking, as long as it can serve concurrent requests

12:22 justin_smith: depro: jetty should be giving a thread to each request

12:26 kwladyka: ,(meta (vary-meta {:safe-squares '([0 0] [1 1] [1 2])} #({:safe-squares (remove #{[0 0]} (:safe-squares %))})))

12:26 clojurebot: #error {\n :cause "Wrong number of args (0) passed to: PersistentArrayMap"\n :via\n [{:type clojure.lang.ArityException\n :message "Wrong number of args (0) passed to: PersistentArrayMap"\n :at [clojure.lang.AFn throwArity "AFn.java" 429]}]\n :trace\n [[clojure.lang.AFn throwArity "AFn.java" 429]\n [clojure.lang.AFn invoke "AFn.java" 28]\n [sandbox$eval26$fn__27 invoke "NO_SOURCE_FILE" 0]\n ...

12:26 kwladyka: how it should be write correct?

12:26 i want remove from meta :safe-squares [0 0]

12:26 or maybe i just just use with-meta?

12:27 justin_smith: kwladyka: #({}) will always give that error

12:28 kwladyka: because that's a call to {} with zero args

12:28 ,'#({})

12:28 clojurebot: (fn* [] ({}))

12:28 kwladyka: so it doesn't see % inside {} ?

12:28 justin_smith: kwladyka: whether % is inside has nothing to do with it

12:28 kwladyka: thx

12:28 justin_smith: look at the expansion above

12:29 ({}) is not valid

12:29 use fn instead of the #() shorthand to construct a hash-map

12:30 kwladyka: justin_smith, if you will be whenever in Poland or near tell me, i have to buy a bear for you :)

12:30 justin_smith: (meta (vary-meta {:safe-squares '([0 0] [1 1] [1 2])} (fn [e] {:safe-squares (remove #{[0 0]} (:safe-squares %))})

12:30 ,(meta (vary-meta {:safe-squares '([0 0] [1 1] [1 2])} (fn [e] {:safe-squares (remove #{[0 0]} (:safe-squares %))})

12:30 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

12:30 justin_smith: something like that anyway

12:37 devn: Let me describe to you a problem: I create a topic using adminutils, and then immediately create a consumer group to read from that topic at "largest".

12:37 I then produce to it, awaiting the message

12:37 but it never comes.

12:37 It hangs

12:38 If I run it again, and the topic is there, then huzzah, it works

12:38 otherwise, hang hang hang

12:39 kwladyka: justin_smith, i did this as (meta (vary-meta (with-meta {[1 1] :queen} {:safe-squares '([0 0] [1 1] [1 2])}) #(update % :safe-squares (partial remove #{[0 0]}))))

12:42 is any difference in time execution in REPL vs jar file?

12:51 BorePlusPlus: Hello good folks. Probably a very noobish question, but how does one multiple tasks with a single command?

12:51 I can't seem to find documentation on that...

12:51 I am speaking about leiningen ^^^

12:51 noticed I forgot to mention this "little detail"

12:52 kwladyka: BorePlusPlus, i am not sure i understand your question

12:53 BorePlusPlus, i can only guess maybe you are asking about "do" command

12:53 BorePlusPlus: kwladyka: I would like to run somehing like "lein clean uberjar"

12:54 kwladyka: let me lookup do

12:54 kwladyka: oh in lein

12:55 BorePlusPlus: kwladyka: hehe there is a lein do as well - so thanks even if you might have been answering a different question

12:55 kwladyka: BorePlusPlus, you can use :aliases

12:55 BorePlusPlus: kwladyka: :)

12:56 kwladyka: BorePlusPlus, https://github.com/technomancy/leiningen/blob/master/sample.project.clj#l204

12:57 BorePlusPlus: kwladyka: yep, but you still need to use "do" https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L216

12:57 kwladyka: which you "pointed out" to me - thanks

13:02 kwladyka: np

13:04 Is it possible to see what is inside #object[clojure.core$partial$fn__4529 0x1b7e8fc9 clojure.core$partial$fn__4529@1b7e8fc9] ? i created function and i am not sure what monster i created :)

13:04 is it possible to see this function as code?

13:10 justin_smith: depro: kafka issue?

13:10 err

13:10 devn: kafka issue?

13:11 kwladyka: it is a function generated by partial

13:12 kwladyka: sadly, it doesn't really have a human readable form, but it shouldn't be hard to find where the data came from

13:31 georgeg: has anyone done cider jack-in, have everything load just fine, but then have the repl refuse to evaluate anything? When I hit enter I get a newline.

13:32 I've tried updating cider, but besides that nothing has changed since it worked on Friday.

13:39 kwladyka: Do you see how this function can be write more readable? https://www.refheap.com/f19c227dc0b9669eb935a2ebd

13:47 rigji: Hi! I'm making a CRUD webapp, with user accounts. I use postgres, jdbc & friend (for auth). Friend expects a db column :roles, which is a #{set} or :keywords. How can I in a SQL database schema represent a clojure set? Should it be a 'text' column and I serialize every time?

13:48 futuro: isn't there a list type in pgsql?

13:48 justin_smith: rigji: you could form an enum from the valid keywords, then use a collection of that enum

13:49 rigji: unless arbitrary keywords are allowed (which seems odd with a :roles system)

13:50 rigji: justin_smith: I honestly don't know what enum is, but will read up on it. Maybe that is the best solution.

13:50 futuro: hmm yeah maybe... I didn't know that

13:50 Having a list seems simple, even it it doesnt map 1:1 with Clojure sets

13:51 futuro: rigji: I'd look into the various types in pg; my first thought is to use a list, but there are a lot of types and I don't know them all

13:53 rigji: futuro: I'm not sure I can find 'list' in pg docs http://www.postgresql.org/docs/9.4/static/datatype.html

13:53 Maybe I make another table for roles, and then reference that from the Users table

13:57 futuro: what about an array of strings?

13:58 rigji: futuro: that is nice, yeah... Sounds like the most simple solution. I'm trying it out now. Thank you nice people for helping a fella out!

13:59 pepijndevos: Can clojure.java.jdbc do named or indexed parameters?

13:59 futuro: np

13:59 pepijndevos: Or do I have to repeat all inputs in the correct order every time I use them?

14:05 futuro: pepijndevos: have you looked into honeysql or yesql?

14:05 pepijndevos: no

14:06 futuro: it's not quite your question, but I think that's what you want

14:30 justin_smith: gfredericks: so we've discussed structured logging before. I've been setting up a kafka messaging system for our app at work to do some distributed tasks, and I realized that given the fact that I am using transit to encode all my messages, this whole system is simply a very efficient shared logging system, with the bonus features of being fast and allowing flexible client consumption of the data in order.

14:32 gfredericks: after watching some vids from the folks who made kafka, I realized it was a logging system with a few upgrades.

14:32 lambda-smith: Hmmm... slightly off topic here, but what's wrong with Lisp subreddit lately; all these people downvoting any discussion on anything that's not Common Lisp

14:33 justin_smith: lambda-smith: the common lisp community has claimed lisp as their own since at least some time in the '80s

14:33 wasamasa: silly CL mossbacks

14:34 justin_smith: lambda-smith: it kind of makes sense if you look at the history - there were a multitude of lisps, people were constantly porting their favorite parts, and eventually a whole lot of people settled on common lisp and gave up the weird predecessors

14:34 hiredman: there is a certain view, somewhat common to some that use common lisp, that lisp, as a noun, means common lisp

14:34 wasamasa: they've even succeeded on freenode, so there's ##lisp for general discussion

14:34 justin_smith: so to them we are just doing the same re-fragmenting that they already "solved" by making common-lisp

14:34 lambda-smith: but building on older language is how progress are made!

14:35 hiredman: so scheme is not lisp, it is scheme, and clojure is not lisp, it is clojure, but common lisp is lisp

14:35 lambda-smith: there are nothing wrong with experimenting & creating new lisps!

14:35 hiredman: from that view point, content in r/lisp that is not common lisp could be considered off topic

14:35 wasamasa: they also don't believe clojure to be modern or scheme to be elegant

14:35 lambda-smith: In fact, can't they see that having "newer" dialects around also indirectly help common lisp too?

14:35 wasamasa: tsk tsk

14:35 lambda-smith: Maybe I'm just naive.

14:35 hiredman: that sort of misses the point of view

14:36 the view point is not that new things are silly and bad (that view may exist too)

14:37 lambda-smith: hiredman: I don't even

14:37 hiredman: the view point is, lisp is an exact label for the language common lisp

14:37 lambda-smith: now that's just narrow mind

14:38 wasamasa: impossibru

14:38 lambda-smith: wasamasa: I guess I will be stoned if I discussed other "lisp" on #lisp too, huh?

14:38 wasamasa: lambda-smith: correct

14:38 * lambda-smith glad he only talked about cl on #lisp so far

14:38 wasamasa: lambda-smith: that's one of the reasons I'm not there anymore

14:38 lambda-smith: but I'm still on ##lisp, #scheme, #chicken and #clojure of course, so it's fine

14:38 lambda-smith: damn, what a shame. CL is a nice language, but with these kind of mindsets

14:39 a damn shame

14:39 hiredman: people carry all kinds of divergent ontologies in their heads

14:40 lambda-smith: well, thanks guys. at least now I know I'm not crazy.

14:40 kwladyka: i will be very glad if you can see https://www.refheap.com/1e743aa3e59c1f1882e5b5333 and https://www.refheap.com/c40523ad6d7839f91afe1349c <- do you see what can i improve to increase performance? I found the same algorithm in scala and i am sure is the same, but works on different structure and use different, because it is another language :) for the same input my clojure algorithm works 43 sec., and scala algorithm 1 sec.

14:40 wasamasa: of course you are, you don't see how they could dare naming CL lisp

14:40 ushabti: <http://x0.no/mcjt> (at www.refheap.com)

14:41 arrdem: Yeah I can also confirm that /r/lisp takes the official stance that "Lisp :: Common Lisp", Schemes and Clojure not welcome

14:41 kwladyka: What can i improve in my functions?

14:41 wasamasa: ushabti: ping

14:41 ushabti: pong

14:41 wasamasa: that one's new

14:41 kwladyka: and did big step for a last time, but still i need to improve something more

14:41 lambda-smith: arrdem: got any suggestion for a better discussion forum where lisp of all dialects are welcome?

14:42 wasamasa: lambda-smith: ##lisp

14:42 lambda-smith: not much going on there though

14:42 lambda-smith: wasamasa: oh, thanks, I didn't notice the double ##

14:42 joining right now

14:42 arrdem: lambda-smith: here, lobste.rs, /r/clojure is quiet but welcoming

14:42 wasamasa: lambda-smith: I'd love screwing these guys and doing a ban-redirect to put them on #common-lisp

14:42 lambda-smith: but that won't happen, at least not for now

14:43 lambda-smith: wasamasa: :D

14:43 wasamasa: freenode got better things to do than sorting out groups

14:43 lambda-smith: thanks arrdem

14:44 wasamasa: ## is for inofficial channels, # is reserved for official projects

14:44 and since lisp is a concept...

14:44 justin_smith: lisp is a state of mind, maaaan

14:44 lambda-smith: wasamasa: oh man, common lisp people are so going to stone you for saying that :D

14:44 justin_smith: ever look at your hand, on lisp?

14:44 * wasamasa hasn't dreamed of parentheses yet

14:45 wasamasa: only falling tetris blocks, IRC and debugging emacs

14:45 devn: stop playing tetris and write some code!

14:45 wasamasa: actually, I'm writing code for another tetris...

14:46 * arrdem watches more dota

14:46 devn: oh, :)

14:46 arrdem: Yet Another Tetris

14:46 wasamasa: t3tr0s is pretty nice if you want to look at how it could be done properly

14:46 though, it's clojurescript

15:07 kwladyka: Do you recommend any good article about how decrease memory usage in Clojure? I problem of my code is, it consume too much memory https://www.refheap.com/c40523ad6d7839f91afe1349c https://www.refheap.com/1e743aa3e59c1f1882e5b5333

15:08 ushabti: <http://x0.no/mck9> (at www.refheap.com)

15:13 amalloy: whose bot is ushabti? we don't need a url-shortening bot in here for any reason i can see

15:20 if nobody wants to claim ushabti and explain why it's useful here i will just ban it

15:20 kwladyka: how check in Clojure how many memory consume data?

15:20 futuro: If I don't have the ability to copy paste or click a link, having a smaller link makes it easier to type by hand

15:21 Or, alternatively, if the url is incredibly long, a shortener makes it easier to follow

15:21 kwladyka: futuro, but anybody use that in situation when can't use the Internet normally? :)

15:21 futuro: maybe, honestly

15:22 you might have a very small window for your irc client

15:22 kwladyka: futuro, still i can click this link using mouse ;)

15:22 futuro: perhaps selecting text is cumbersome or slow

15:22 you can, but that doesn't mean everyone can

15:22 or even, perhaps, that you will always be able to do so

15:22 kwladyka: futuro, and then is the questin if you can't even click on click do you really want follow this link?

15:23 i don't know, i am using desktop :)

15:23 futuro: I might, to be honest. The link could go to something that sounds pertinent to my interests, or everyone in the channel is talking about it

15:23 but because of it's length, or my inability to have clicking it follow the link in my browser, or because I can't copy-paste

15:24 I'd have to type out a long, semi-random/random string to know what everyone is talking about

15:26 or maybe there's no good option for a web browser on the machine I'm using to connect to irc

15:26 oddcully: well there is also to say, that it does not work properly. the line before had two links. but only one got converted (the first one)

15:26 futuro: oddcully: that's true, though a different issue from banning/removing the bot

15:27 finding it's owner isn't a bad idea, I just wanted to point out the potential benefits of having a url shortener

15:27 oddcully: next x0 could be Evil™ and try to do vile things to clickers

15:27 futuro: maybe, but the same could be said of the original link

15:28 shaym: Deraen which channel is a good place for compojure-api questions?

15:28 oddcully: refheap is our dear old good friend

15:28 no harm could ever come from there

15:29 futuro: what better place to betray someone from than a position of "friendship"

15:29 </paranoia>

15:31 Deraen: shaym: There is #ring-swagger slack channel and on Irc you can ask questions here

15:32 gfredericks: justin_smith: what do you do if the logging system is unavailable?

15:32 kwladyka: ech... i can't find that... is something like how-many-memory-it-consume([1 1])?

15:32 shaym: Deraen, i see your also on cljs freenode channel , ill ask there

15:32 gfredericks: kwladyka: there's no simple answer

15:33 partly because of structure sharing

15:33 kwladyka: gfredericks, mmm my app consume too much memory, i want check different structures in REPL and check difference

15:34 gfredericks, it can be complex answer, it is better then nothing! :)

15:36 there is nothing like in C++ to check memory? ;)

15:36 opqdonut: you can use jvisualvm's heap profiling

15:39 kwladyka: opqdonut, will i be able to simple compare for example [[0 1 2 3] [0 1 2 3]] with [[0 0] [1 1] [2 2] [3 3]] etc.?

15:41 justin_smith: gfredericks: log a message about it, of course :P

15:42 gfredericks: in all seriousness, one of the features of kafka is its high availability, though of course not as available as local disk

15:42 futuro: One thing I've missed from common lisp programming is that slime/swank allows me to see the state/local vars at every stack in a stack trace; is this possible with the current tooling in clojure?

15:43 I've looked around a bit, but cider doesn't seem to have this ability, and I haven't seen anything else that has it either

15:43 justin_smith: futuro: to some degree - lazy-seqs make this more complicated than might be immediately obvious (in terms of holding onto very large items, or excessively realizing items)

15:44 futuro: cursive probably has the best tooling for introspective debugging, but newer cider versions have pretty good integration too

15:45 futuro: justin_smith: I'll check out cursive

15:45 gfredericks: justin_smith: yeah I'd think maybe some kind of local disk mediator would be necessary

15:45 justin_smith: gfredericks: right, basically "tee"

15:45 clojurebot: Pardon?

15:45 opqdonut: kwladyka: o, you're not looking for a profiler but a diff tool. how about https://clojuredocs.org/clojure.data/diff ?

15:45 ushabti: Title: diff - clojure.data | ClojureDocs - Community-Powered Clojure Documentation and Examples (at clojuredocs.org)

15:45 justin_smith: gfredericks: but sine kafka just transmits bytes, and lets you attach whatever converters you like, the combo of that with transit has been realy sweet

15:46 *since

15:46 futuro: I think I'd appreciate a state inspector with stacks, even if it elides some information, like the content of lazy seqs

15:47 justin_smith: gfredericks: basically, I was using it as a queue, but since it outlives an app instance, and it captures all the traffic, it ends up being a log of the last N days of intra-app communication as well

15:49 futuro: yeah - the feature is there (mostly) - though you might have to rely on explicitly turning off locals clearing while debugging iirc

15:49 kwladyka: opqdonut, no, i want compare memory used by this structures :)

15:50 opqdonut, i am using them in i guess millions

15:50 opqdonut, and i am sure i can do that better

15:52 gfredericks: justin_smith: yeah I'd like to be able to play with those tools more

17:00 {blake}: Pulling out the keys from a large list of documents, I'm thinking "(reduce #(into %1 (keys %2)) #{} all)" is better than "(distinct (mapcat keys all))", especially if "all" is a lazy sequence, because in the latter example, the list is fully realized, then iterated over at least twice.

17:03 amalloy: i think everything after your "because" is false, {blake}

17:03 {blake}: What about before? =P

17:03 So, the list isn't fully realized and iterated over twice?

17:04 futuro: {blake}: "better" depends on what you're looking for. The second version is shorter and more easily reasoned about, which is one version of "better".

17:06 {blake}: futuro: I'm thinking strictly performance: "all" is a database cursor.

17:06 justin_smith: {blake}: have you tried criterium yet?

17:06 {blake}: So, being wrong could matter.

17:06 justin_smith: I have not. Is it a breakfast cereal?

17:07 justin_smith: $google clojure criterium

17:07 lazybot: [hugoduncan/criterium · GitHub] https://github.com/hugoduncan/criterium

17:07 {blake}: Oh, benchmarking. No, I haven't done that yet. I'm on the verge of doing a bunch of it but haven't started quite yet.

17:07 ushabti: Title: hugoduncan/criterium · GitHub (at github.com)

17:07 justin_smith: (dec ushabti)

17:07 lazybot: ⇒ -1

17:11 {blake}: But...am I wrong? It seems like "keys" has to realize the sequence. KeySeq is not lazy, right?

17:11 amalloy: {blake}: sure it is. why not?

17:11 justin_smith: {blake}: hash-maps are never lazy, and they are the underlying data for keys

17:11 amalloy: the map underneath is fully realized anyway, as justin_smith says, so it's not terribly important whether keys itself is lazy

17:14 {blake}: OK, I see what I've got wrong. It's a lazy sequence of maps, so it's not the "keys" but the "mapcat" which isn't really different if you're using reduce. Hmmph.

17:21 gratimax: does ring have any spec for websockets?

17:22 {blake}: But...with "(distinct (mapcat keys all))", you get the full sequence of keys, including all the repeated keys, whereas with the reduce, you build your set one record at a time.

17:26 justin_smith: {blake}: you'll get an answer quicker with criterium, if I had your input data I could have run it by now and given you the answer myself

17:27 {blake}: justin_smith: Well, knowing the answer would be fine, and I'll get to that. But I want to be thinking about it correctly (which I wasn't).

17:32 One of the interesting things about Clojure to me is that it's both very high level and somewhat low level, too.

17:32 Or low-level in places, I guess.

17:37 TEttinger: {blake}, it can be, but that's not common. stuff like amap is there, stuff like transients are there, but they aren't preferred when first developing usually, they're primarily what you refactor code that needs to perform better into using

17:38 lazy seqs aren't super-high-performance, but they're a sensible default most of the time

17:39 {blake}: TEttinger: It's not common, I agree, but I think it's important. And I think that's right.

18:00 sdegutis: What's a good way to transform a tree to be flat but keep references to things inside it?

18:01 Like, if you have {:foo {:bar :quux}}, you would have {1 {:bar :quux}, 2 {:foo 1}]}

18:04 justin_smith: sdegutis: sounds like you want something like an adjacency list?

18:05 sdegutis: Maybe. Is that already in clojure.core or maybe clojure.zip?

18:05 justin_smith: I don't know / don't think so. It would be in one of the graph libs.

18:05 because adj-lists are great for generalized (ie. potentially circular) graphs

18:06 {blake}: sdegutis: That's exactly what I'm doing!

18:10 sdegutis: {blake}: why for?

18:10 {blake}: Mongo->MSSQL

18:10 sdegutis: justin_smith: I'm trying to make a nicer interface to Datomic is why

18:10 {blake}: haha similar reason!

18:12 {blake}: sdegutis: This'll be my second go around. What happens is they drive me nuts talking about trying to make Pentaho do it, and I'm all, "Just give it to me and I'll write the code and nobody has to care what's in the MongoDB".

18:27 nberger: gfredericks: I just opened a PR in test.chuck with a port to cljs: https://github.com/gfredericks/test.chuck/pull/14. I hope it makes sense to you, in that case let me know of anything that needs to me improved

18:32 sdegutis: {blake}: haha

18:36 Transforming trees is terrible.

18:52 justin_smith: maybe this is a good use for zippers?

18:54 {blake}: sdegutis: It puts the "curse" in "recursive".

18:59 sdegutis: What's the best way to parse an INI-like file? Right now I'm using regexp's.

18:59 It's got to be pretty forgiving and flexible about whitespace, and there's very little syntax, most of the file is just arbitrary user-text separated by various types of whitespace and sometimes special characters.

19:00 (like [, ], {, }, etc)

19:00 I tried Instaparse but that seems better suited for more formal grammars right?

19:01 justin_smith: sdegutis: did you check this out? https://github.com/jonase/clojure-ini

19:02 sdegutis: Oh cool, it uses hand-rolled regex-style searching.

19:02 Hmm that sounds like a smarter method than regexp's.

19:02 justin_smith: sdegutis: I don't even see any regexs in the code

19:02 oh, now I get what you mean

19:02 sdegutis: That's what I mean. It searches for the characters manually.

19:02 justin_smith: right

19:02 sdegutis: But really that's all regexp's are.

19:03 justin_smith: regexes are weird hairy little little state machines

19:03 sdegutis: Yep.

19:08 schmir: sdegutis: there's also https://github.com/brainbot-com/clj-iniconfig

19:09 sdegutis: schmir: Very good, thank you.

19:09 schmir: That one uses regexp's :D

19:27 I'm back.

19:47 splunk: anybody using internode messaging like ZMQ rather than HTTP? Found a preferred lib?

19:47 Trying to build a masterless cluster, Erlang-style.

19:48 justin_smith: splunk: I've started using sente for communication to the browser, and kafka for communicating with the compute backend, and both are working nicely (though kafka was a bit of work to set up and integrate)

19:48 splunk: justin_smith: yeah we are looking at using AWS Kinesis

19:49 justin_smith: I've been liking kafka's design now that I get it - it's like an executable log

19:50 splunk: totally. It seems pretty decomplected from producing and consuming, which is nice

19:51 seems like it could fit well with some kind of seq or core.async abstraction

19:51 justin_smith: splunk: during dev I can default to picking up only new messages since init, but I can optionally open up and use old messages (to narrow down the cause of an error, for example) which is really sweet

19:51 and yeah, when I read from the app, I immediately put it in a core.async channel

20:47 sdegutis: I ended up with a monster chunk of code, that uses [for, select-keys, assoc, sort-by] in a nested way to "normalize" a tree of maps for testing quality via =

21:13 kavkaz: If i have a binding that I made with the special form "let", is there a way to update it?

21:13 amalloy: no. values are immutable, bindings are immutable

21:14 sdegutis: High-ya!

21:15 kavkaz: amalloy: I see, I guess I haven't gotten the hang of it yet.

21:15 amalloy: I'll keep trying another way.

21:16 amalloy: kavkaz: the answer is generally recursion, whether explicitly written by you, or implicit via a use of some built-in like reduce

21:17 kavkaz: amalloy: I'll try that. I think it just involves more thinking, and checking out the docs a little more too

21:17 thanks

21:25 domokato: is there a way to send some text output to an nrepl client from the nrepl server?

21:26 like a log

23:04 rola: yo

23:05 does clojure have ad-hoc polymorphism and/or higher-kinder polymorphism

23:06 justin_smith: rola: we don't have higher kinds because clojure isn't strickly typed so those are less useful for us. It does have ad-hoc polymorphism with the help of multimethods and protocols.

23:06 rola: cool, cool

23:07 justin_smith: rola: multimethods for example are capable of dispatching on any arg (usually the first / only arg, but technically you can make it dispatch based on an arbitrary function that takes all the arguments)

23:08 protocols are faster though, because they directly use the ad-hoc method polymorphism of the jvm (so it follows java rules, dispatching on the first arg (the "object"))

23:12 puredanger: protocols are ~5x faster to invoke than a multimethod dispatching on class

Logging service provided by n01se.net