#clojure logs

2015-08-03

02:07ebzzrywhat is the equivalent of printing to /dev/stdout in windows, if there is any?
02:59MasseRIsn't System.out akin to /dev/stdout?
03:00MasseRSo just println would do the trick
03:00MasseR(and print)
03:26tmtwdif I wanted a random number in cljs would I use the clojure random number gen or the javascript random number generator?
03:30oddcullytmtwd: if there is nothing the interop one has over the "clojure" one, then i'd use the clojure one
03:30tmtwdlike (rand-int 30)?
03:31tmtwdSo I can use clojure libraries in cljs?
03:31oddcullywell rand(-int) is implemented using JS interop
03:31oddcully,(source rand)
03:31clojurebotSource not found\n
03:32oddcullycompare this with the one in your js repl
04:31pydave6367Hey 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!
04:48vijaykiranpydave6367: (map hash-map (flatten %) [4 3 8 9 5 1 2 7 6]))) << '%' works in anon-functions, typo ?
04:53pydave6367vijaykiran: 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:
04:53pydave6367(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)
04:53pydave6367vijaykiran: (also, thanks so much for looking!)
06:49sheldonhis count O(1) for a vector?
06:49hyPiRionsheldonh: yes
06:50sheldonhhyPiRion: 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
06:57EuS8yeiFsheldonh: actually it's exactly the docstrings where complexity of functions is usually written
06:58sheldonhEuS8yeiF: often, yes
07:02sheldonhAha! http://clojure.org/data_structures
07:03oddcullysheldonh: should be this one: https://github.com/clojure/clojure/blob/838302612551ef6a50a8adbdb9708cb1362b0898/src/jvm/clojure/lang/PersistentVector.java#L204
07:04sheldonhoddcully: thanks. hard to argue with that ;)
07:57gfredericksTEttinger: so that's an idea for implementing a splittable RNG?
07:58gfredericksI think the problem will be how you split the already-split generators
08:28crocketI think LEIN_FAST_TRAMPOLINE environment variable doesn't enable trampoline in leiningen.
08:30crocketProbably, I should look for grenchmen.
08:30crocketOh, grenchman is dead.
08:34Leonidascrocket: is it officially?
08:35LeonidasI could actually work on it, come to think of it.
08:35crocketI think grenchman is dead because it is written in OCaml and intends to serve clojureists.
08:35crocketclojurists
08:36Leonidascrocket: it cannot be written in clojure, that would defeat it's purpose.
08:36Leonidasin ClojureScript, maybe.
08:36LeonidasAnd OCaml is actually a pretty awesome language
08:37crocketBut, you can't assume that many clojurists know how to write in OCaml
08:37Leonidascrocket: not all clojurists contribute to Leiningen, that doesn't mean it's dead either.
08:38crockethttps://github.com/technomancy/leiningen/commits/master tells me there are enough clojurists who contribute to leiningen.
08:38crocketFor grenchman, there is none.
08:39crocketFor a given open source project to obtain contributors, it needs to have an enough number of users who know the language of the project.
08:40crocketI think grenchman failed because of the language barrier.
08:40crockethttps://github.com/technomancy/leiningen/graphs/contributors tells me there have been 267 contributrs to leiningen.
08:41crocketFor two years, there has been no activity in grenchman.
08:41crocketSo, it's safe to assume that it's probably dead.
08:41Leonidassure, but being successful is something different from being dead
08:41Leonidas*being not successful
08:42crocketOk, my perception was a little bit off.
08:42crocketIt's almost dead.
08:42crocket6 commits over 2 years
08:43crocketAnd, technomancy has ignored 3 pull requests for 2 years.
08:43Leonidasok, that is a good point
08:47crocketI hope clojure could be used to write kernels.
08:50wasamasatrololol
08:52wasamasasome day people will value old code more than new code
09:15ambrosebsBronsa: do you think it's possible to convert jvm.tools.analyzer output to conform to tools.analyzer.jvm?
09:16ambrosebsdoing some performance testing, it seems worth investigating.
09:20Bronsaambrosebs: not sure I'll have to look at it, might be possile
09:21ambrosebsBronsa: what exactly does :env need to look like?
09:21ambrosebsand how important is :form?
09:21ambrosebsit seems possible to recreate :form.
09:22Bronsaambrosebs: I seem to recall that Compiler.java does save the form somewhere, might be wrong
09:22Bronsaambrosebs: t.a.jvm uses it to retrieve tag info
09:23Bronsabut if it's already annotated by Compiler.java it's not really needed AFAICT
09:23ambrosebsah ok.
09:25Bronsaambrosebs: wrt :env, it should just have :context, :locals, :ns and the source info
09:25ambrosebsok that sounds reasonable.
09:25Bronsaambrosebs: hardest stuff might be converting the locals represetntation of Compiler.java to the locals map used by t.a.jvm in :env
09:26ambrosebswhat's the rep?
09:26ambrosebsoh
09:26ambrosebsI was thinking to just make a new one.
09:26BronsaI 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
09:27ambrosebswe could probably recreate :locals with an extra t.a-style pass
09:28Bronsayeah
09:28ambrosebswould this have a place in tools.analyzer.jvm if it works out?
09:28Bronsasure
09:29ambrosebsok great. I'll create an issue and chug away.
10:35justin_smithsheldonh: regarding complexity of running count, there is the predicate, counted?
10:35justin_smith,(counted {})
10:35justin_smitherr
10:35clojurebot#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:35justin_smith,(counted? {})
10:35clojurebottrue
10:35justin_smith,(counted? (lazy-seq nil))
10:35clojurebotfalse
10:36justin_smith,(counted? (list 1 2 3))
10:36clojurebottrue
10:36justin_smith,(counted? (range))
10:36clojurebotfalse
10:36justin_smithif counted? returns true, then the count is stored, and has O(1) lookup for that data
10:37sheldonhjustin_smith: awesome, thanks
10:37justin_smith,(mapv (juxt #(do %) counted?) [nil () [] {}
10:37clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
10:38justin_smith,(mapv (juxt #(do %) counted?) [nil () [] {} "" (range) (lazy-seq nil) (list 1)])
10:38clojurebot[[nil false] [() true] [[] true] [{} true] ["" false] ...]
10:38justin_smithwoah, I am surprised that "" is not counted
10:40justin_smithI 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:40hyPiRionjustin_smith: Counted is an interface, so can't do any magic there.
10:41hyPiRionThey are constant time however, https://github.com/clojure/clojure/blob/d534894c3006474068e46b67e4b838bf3727722d/src/jvm/clojure/lang/RT.java#L614
10:41justin_smithhyPiRion: ah, got it - if it was a protocol it would be another story I guess
10:41justin_smithhyPiRion: right, I was assuming that :)
10:41hyPiRionYeah. We should protocol everything
10:42sheldonhseems like it deserves a special case in (counted?)
10:43justin_smithyeah, 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:43justin_smithsimilar to seqable
10:43justin_smithwhich isn't actually a function either but should be
10:44hyPiRionyeah
10:45justin_smithI'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:01puredangerthere is one in incubator if you want to compare
11:01justin_smithpuredanger: oh, cool
11:01puredangerhttps://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/incubator.clj#L83
11:01puredangerI think there is a ticket to add this to core. if not, there should be.
11:02puredangerhttp://dev.clojure.org/jira/browse/CLJ-401
11:02justin_smithpuredanger: yeah, that's really close to what I had
11:02justin_smith(inc puredanger)
11:02lazybot⇒ 61
11:09puredangerBronsa: oops, looks like I stomped your changes on 401 :)
11:09puredangerjira fail
11:10Bronsapuredanger: did you mean to remove the example? if so my change doesn't matter :)
11:10BronsaI just wrapped the last example in a {code} block since jira rendered it badly without it
11:10puredangeryeah, I didn't think most of the existing description was relevant
11:11puredangerI just rescued the example into a comment
11:12Bronsapuredanger: 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:12BronsaI 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:12puredangerRich considers that the expected behavior
11:13puredangerper the same reason as that other ticket
11:13Bronsait's different to the other ticket though
11:13Bronsathis one behaviour is not in agreement with what's in the docs
11:15Bronsaeither that or all record reader-literals should return maps rather than records, not just empty ones
11:17puredangerrich's explanation was that records are maps, then see the evaluation page
11:17Bronsapuredanger: right, but (defrecord Y [a]) #user.Y[a] returns a record, not a map
11:17Bronsahttp://sprunge.us/Cjhd?clj
11:18puredangerI can bring it up again; I was on a consulting gig last week so wasn't in the conversation
11:19Bronsathanks, that would be appreciated
11:20puredangeradded it to my notes for next touch point
12:08kwladykawhich function should i use to update meta? with-meta?
12:09kwladykato update meta based on meta value, so something like for example inc
12:10deproHi, 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:11deprohttps://gist.github.com/anonymous/2277a027cfe27a89a5df
12:11deproIn jetty, the code above only serves one request at a time
12:12deproSimilarly I’ve tried looking at http-kit, with-message but it doesn’t work either
12:14kwladykahmm or vary-meta...
12:19deproAny ideas how to make ring jetty / http-kit non-blocking?
12:21deproIt doesn’t need to be non-blocking, as long as it can serve concurrent requests
12:22justin_smithdepro: jetty should be giving a thread to each request
12:26kwladyka,(meta (vary-meta {:safe-squares '([0 0] [1 1] [1 2])} #({:safe-squares (remove #{[0 0]} (:safe-squares %))})))
12:26clojurebot#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:26kwladykahow it should be write correct?
12:26kwladykai want remove from meta :safe-squares [0 0]
12:26kwladykaor maybe i just just use with-meta?
12:27justin_smithkwladyka: #({}) will always give that error
12:28justin_smithkwladyka: because that's a call to {} with zero args
12:28justin_smith,'#({})
12:28clojurebot(fn* [] ({}))
12:28kwladykaso it doesn't see % inside {} ?
12:28justin_smithkwladyka: whether % is inside has nothing to do with it
12:28kwladykathx
12:28justin_smithlook at the expansion above
12:29justin_smith({}) is not valid
12:29justin_smithuse fn instead of the #() shorthand to construct a hash-map
12:30kwladykajustin_smith, if you will be whenever in Poland or near tell me, i have to buy a bear for you :)
12:30justin_smith(meta (vary-meta {:safe-squares '([0 0] [1 1] [1 2])} (fn [e] {:safe-squares (remove #{[0 0]} (:safe-squares %))})
12:30justin_smith,(meta (vary-meta {:safe-squares '([0 0] [1 1] [1 2])} (fn [e] {:safe-squares (remove #{[0 0]} (:safe-squares %))})
12:30clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
12:30justin_smithsomething like that anyway
12:37devnLet 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:37devnI then produce to it, awaiting the message
12:37devnbut it never comes.
12:37devnIt hangs
12:38devnIf I run it again, and the topic is there, then huzzah, it works
12:38devnotherwise, hang hang hang
12:39kwladykajustin_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:42kwladykais any difference in time execution in REPL vs jar file?
12:51BorePlusPlusHello good folks. Probably a very noobish question, but how does one multiple tasks with a single command?
12:51BorePlusPlusI can't seem to find documentation on that...
12:51BorePlusPlusI am speaking about leiningen ^^^
12:51BorePlusPlusnoticed I forgot to mention this "little detail"
12:52kwladykaBorePlusPlus, i am not sure i understand your question
12:53kwladykaBorePlusPlus, i can only guess maybe you are asking about "do" command
12:53BorePlusPluskwladyka: I would like to run somehing like "lein clean uberjar"
12:54BorePlusPluskwladyka: let me lookup do
12:54kwladykaoh in lein
12:55BorePlusPluskwladyka: hehe there is a lein do as well - so thanks even if you might have been answering a different question
12:55kwladykaBorePlusPlus, you can use :aliases
12:55BorePlusPluskwladyka: :)
12:56kwladykaBorePlusPlus, https://github.com/technomancy/leiningen/blob/master/sample.project.clj#l204
12:57BorePlusPluskwladyka: yep, but you still need to use "do" https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L216
12:57BorePlusPluskwladyka: which you "pointed out" to me - thanks
13:02kwladykanp
13:04kwladykaIs 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:04kwladykais it possible to see this function as code?
13:10justin_smithdepro: kafka issue?
13:10justin_smitherr
13:10justin_smithdevn: kafka issue?
13:11justin_smithkwladyka: it is a function generated by partial
13:12justin_smithkwladyka: sadly, it doesn't really have a human readable form, but it shouldn't be hard to find where the data came from
13:31georgeghas 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:32georgegI've tried updating cider, but besides that nothing has changed since it worked on Friday.
13:39kwladykaDo you see how this function can be write more readable? https://www.refheap.com/f19c227dc0b9669eb935a2ebd
13:47rigjiHi! 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:48futuroisn't there a list type in pgsql?
13:48justin_smithrigji: you could form an enum from the valid keywords, then use a collection of that enum
13:49justin_smithrigji: unless arbitrary keywords are allowed (which seems odd with a :roles system)
13:50rigjijustin_smith: I honestly don't know what enum is, but will read up on it. Maybe that is the best solution.
13:50rigjifuturo: hmm yeah maybe... I didn't know that
13:50rigjiHaving a list seems simple, even it it doesnt map 1:1 with Clojure sets
13:51futurorigji: 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:53rigjifuturo: I'm not sure I can find 'list' in pg docs http://www.postgresql.org/docs/9.4/static/datatype.html
13:53rigjiMaybe I make another table for roles, and then reference that from the Users table
13:57futurowhat about an array of strings?
13:58rigjifuturo: 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:59pepijndevosCan clojure.java.jdbc do named or indexed parameters?
13:59futuronp
13:59pepijndevosOr do I have to repeat all inputs in the correct order every time I use them?
14:05futuropepijndevos: have you looked into honeysql or yesql?
14:05pepijndevosno
14:06futuroit's not quite your question, but I think that's what you want
14:30justin_smithgfredericks: 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:32justin_smithgfredericks: after watching some vids from the folks who made kafka, I realized it was a logging system with a few upgrades.
14:32lambda-smithHmmm... 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:33justin_smithlambda-smith: the common lisp community has claimed lisp as their own since at least some time in the '80s
14:33wasamasasilly CL mossbacks
14:34justin_smithlambda-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:34hiredmanthere is a certain view, somewhat common to some that use common lisp, that lisp, as a noun, means common lisp
14:34wasamasathey've even succeeded on freenode, so there's ##lisp for general discussion
14:34justin_smithso to them we are just doing the same re-fragmenting that they already "solved" by making common-lisp
14:34lambda-smithbut building on older language is how progress are made!
14:35hiredmanso scheme is not lisp, it is scheme, and clojure is not lisp, it is clojure, but common lisp is lisp
14:35lambda-smiththere are nothing wrong with experimenting & creating new lisps!
14:35hiredmanfrom that view point, content in r/lisp that is not common lisp could be considered off topic
14:35wasamasathey also don't believe clojure to be modern or scheme to be elegant
14:35lambda-smithIn fact, can't they see that having "newer" dialects around also indirectly help common lisp too?
14:35wasamasatsk tsk
14:35lambda-smithMaybe I'm just naive.
14:35hiredmanthat sort of misses the point of view
14:36hiredmanthe view point is not that new things are silly and bad (that view may exist too)
14:37lambda-smithhiredman: I don't even
14:37hiredmanthe view point is, lisp is an exact label for the language common lisp
14:37lambda-smithnow that's just narrow mind
14:38wasamasaimpossibru
14:38lambda-smithwasamasa: I guess I will be stoned if I discussed other "lisp" on #lisp too, huh?
14:38wasamasalambda-smith: correct
14:38wasamasalambda-smith: that's one of the reasons I'm not there anymore
14:38wasamasalambda-smith: but I'm still on ##lisp, #scheme, #chicken and #clojure of course, so it's fine
14:38lambda-smithdamn, what a shame. CL is a nice language, but with these kind of mindsets
14:39lambda-smitha damn shame
14:39hiredmanpeople carry all kinds of divergent ontologies in their heads
14:40lambda-smithwell, thanks guys. at least now I know I'm not crazy.
14:40kwladykai 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:40wasamasaof course you are, you don't see how they could dare naming CL lisp
14:40ushabti<http://x0.no/mcjt&gt; (at www.refheap.com)
14:41arrdemYeah I can also confirm that /r/lisp takes the official stance that "Lisp :: Common Lisp", Schemes and Clojure not welcome
14:41kwladykaWhat can i improve in my functions?
14:41wasamasaushabti: ping
14:41ushabtipong
14:41wasamasathat one's new
14:41kwladykaand did big step for a last time, but still i need to improve something more
14:41lambda-smitharrdem: got any suggestion for a better discussion forum where lisp of all dialects are welcome?
14:42wasamasalambda-smith: ##lisp
14:42wasamasalambda-smith: not much going on there though
14:42lambda-smithwasamasa: oh, thanks, I didn't notice the double ##
14:42lambda-smithjoining right now
14:42arrdemlambda-smith: here, lobste.rs, /r/clojure is quiet but welcoming
14:42wasamasalambda-smith: I'd love screwing these guys and doing a ban-redirect to put them on #common-lisp
14:42wasamasalambda-smith: but that won't happen, at least not for now
14:43lambda-smithwasamasa: :D
14:43wasamasafreenode got better things to do than sorting out groups
14:43lambda-smiththanks arrdem
14:44wasamasa## is for inofficial channels, # is reserved for official projects
14:44wasamasaand since lisp is a concept...
14:44justin_smithlisp is a state of mind, maaaan
14:44lambda-smithwasamasa: oh man, common lisp people are so going to stone you for saying that :D
14:44justin_smithever look at your hand, on lisp?
14:45wasamasaonly falling tetris blocks, IRC and debugging emacs
14:45devnstop playing tetris and write some code!
14:45wasamasaactually, I'm writing code for another tetris...
14:46devnoh, :)
14:46arrdemYet Another Tetris
14:46wasamasat3tr0s is pretty nice if you want to look at how it could be done properly
14:46wasamasathough, it's clojurescript
15:07kwladykaDo 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:08ushabti<http://x0.no/mck9&gt; (at www.refheap.com)
15:13amalloywhose bot is ushabti? we don't need a url-shortening bot in here for any reason i can see
15:20amalloyif nobody wants to claim ushabti and explain why it's useful here i will just ban it
15:20kwladykahow check in Clojure how many memory consume data?
15:20futuroIf 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:21futuroOr, alternatively, if the url is incredibly long, a shortener makes it easier to follow
15:21kwladykafuturo, but anybody use that in situation when can't use the Internet normally? :)
15:21futuromaybe, honestly
15:22futuroyou might have a very small window for your irc client
15:22kwladykafuturo, still i can click this link using mouse ;)
15:22futuroperhaps selecting text is cumbersome or slow
15:22futuroyou can, but that doesn't mean everyone can
15:22futuroor even, perhaps, that you will always be able to do so
15:22kwladykafuturo, and then is the questin if you can't even click on click do you really want follow this link?
15:23kwladykai don't know, i am using desktop :)
15:23futuroI 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:23futurobut 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:24futuroI'd have to type out a long, semi-random/random string to know what everyone is talking about
15:26futuroor maybe there's no good option for a web browser on the machine I'm using to connect to irc
15:26oddcullywell 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:26futurooddcully: that's true, though a different issue from banning/removing the bot
15:27futurofinding it's owner isn't a bad idea, I just wanted to point out the potential benefits of having a url shortener
15:27oddcullynext x0 could be Evil™ and try to do vile things to clickers
15:27futuromaybe, but the same could be said of the original link
15:28shaymDeraen which channel is a good place for compojure-api questions?
15:28oddcullyrefheap is our dear old good friend
15:28oddcullyno harm could ever come from there
15:29futurowhat better place to betray someone from than a position of "friendship"
15:29futuro</paranoia>
15:31Deraenshaym: There is #ring-swagger slack channel and on Irc you can ask questions here
15:32gfredericksjustin_smith: what do you do if the logging system is unavailable?
15:32kwladykaech... i can't find that... is something like how-many-memory-it-consume([1 1])?
15:32shaymDeraen, i see your also on cljs freenode channel , ill ask there
15:32gfrederickskwladyka: there's no simple answer
15:33gfrederickspartly because of structure sharing
15:33kwladykagfredericks, mmm my app consume too much memory, i want check different structures in REPL and check difference
15:34kwladykagfredericks, it can be complex answer, it is better then nothing! :)
15:36kwladykathere is nothing like in C++ to check memory? ;)
15:36opqdonutyou can use jvisualvm's heap profiling
15:39kwladykaopqdonut, 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:41justin_smithgfredericks: log a message about it, of course :P
15:42justin_smithgfredericks: in all seriousness, one of the features of kafka is its high availability, though of course not as available as local disk
15:42futuroOne 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:43futuroI'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:43justin_smithfuturo: 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:44justin_smithfuturo: cursive probably has the best tooling for introspective debugging, but newer cider versions have pretty good integration too
15:45futurojustin_smith: I'll check out cursive
15:45gfredericksjustin_smith: yeah I'd think maybe some kind of local disk mediator would be necessary
15:45justin_smithgfredericks: right, basically "tee"
15:45clojurebotPardon?
15:45opqdonutkwladyka: o, you're not looking for a profiler but a diff tool. how about https://clojuredocs.org/clojure.data/diff ?
15:45ushabtiTitle: diff - clojure.data | ClojureDocs - Community-Powered Clojure Documentation and Examples (at clojuredocs.org)
15:45justin_smithgfredericks: 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:46justin_smith*since
15:46futuroI think I'd appreciate a state inspector with stacks, even if it elides some information, like the content of lazy seqs
15:47justin_smithgfredericks: 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:49justin_smithfuturo: yeah - the feature is there (mostly) - though you might have to rely on explicitly turning off locals clearing while debugging iirc
15:49kwladykaopqdonut, no, i want compare memory used by this structures :)
15:50kwladykaopqdonut, i am using them in i guess millions
15:50kwladykaopqdonut, and i am sure i can do that better
15:52gfredericksjustin_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:03amalloyi think everything after your "because" is false, {blake}
17:03{blake}What about before? =P
17:03{blake}So, the list isn't fully realized and iterated over twice?
17:04futuro{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:06justin_smith{blake}: have you tried criterium yet?
17:06{blake}So, being wrong could matter.
17:06{blake}justin_smith: I have not. Is it a breakfast cereal?
17:07justin_smith$google clojure criterium
17:07lazybot[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:07ushabtiTitle: hugoduncan/criterium · GitHub (at github.com)
17:07justin_smith(dec ushabti)
17:07lazybot⇒ -1
17:11{blake}But...am I wrong? It seems like "keys" has to realize the sequence. KeySeq is not lazy, right?
17:11amalloy{blake}: sure it is. why not?
17:11justin_smith{blake}: hash-maps are never lazy, and they are the underlying data for keys
17:11amalloythe 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:21gratimaxdoes 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:26justin_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{blake}One of the interesting things about Clojure to me is that it's both very high level and somewhat low level, too.
17:32{blake}Or low-level in places, I guess.
17:37TEttinger{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:38TEttingerlazy 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:00sdegutisWhat's a good way to transform a tree to be flat but keep references to things inside it?
18:01sdegutisLike, if you have {:foo {:bar :quux}}, you would have {1 {:bar :quux}, 2 {:foo 1}]}
18:04justin_smithsdegutis: sounds like you want something like an adjacency list?
18:05sdegutisMaybe. Is that already in clojure.core or maybe clojure.zip?
18:05justin_smithI don't know / don't think so. It would be in one of the graph libs.
18:05justin_smithbecause adj-lists are great for generalized (ie. potentially circular) graphs
18:06{blake}sdegutis: That's exactly what I'm doing!
18:10sdegutis{blake}: why for?
18:10{blake}Mongo->MSSQL
18:10sdegutisjustin_smith: I'm trying to make a nicer interface to Datomic is why
18:10sdegutis{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:27nbergergfredericks: 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:32sdegutis{blake}: haha
18:36sdegutisTransforming trees is terrible.
18:52justin_smithmaybe this is a good use for zippers?
18:54{blake}sdegutis: It puts the "curse" in "recursive".
18:59sdegutisWhat's the best way to parse an INI-like file? Right now I'm using regexp's.
18:59sdegutisIt'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:00sdegutis(like [, ], {, }, etc)
19:00sdegutisI tried Instaparse but that seems better suited for more formal grammars right?
19:01justin_smithsdegutis: did you check this out? https://github.com/jonase/clojure-ini
19:02sdegutisOh cool, it uses hand-rolled regex-style searching.
19:02sdegutisHmm that sounds like a smarter method than regexp's.
19:02justin_smithsdegutis: I don't even see any regexs in the code
19:02justin_smithoh, now I get what you mean
19:02sdegutisThat's what I mean. It searches for the characters manually.
19:02justin_smithright
19:02sdegutisBut really that's all regexp's are.
19:03justin_smithregexes are weird hairy little little state machines
19:03sdegutisYep.
19:08schmirsdegutis: there's also https://github.com/brainbot-com/clj-iniconfig
19:09sdegutisschmir: Very good, thank you.
19:09sdegutisschmir: That one uses regexp's :D
19:27sdegutisI'm back.
19:47splunkanybody using internode messaging like ZMQ rather than HTTP? Found a preferred lib?
19:47splunkTrying to build a masterless cluster, Erlang-style.
19:48justin_smithsplunk: 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:48splunkjustin_smith: yeah we are looking at using AWS Kinesis
19:49justin_smithI've been liking kafka's design now that I get it - it's like an executable log
19:50splunktotally. It seems pretty decomplected from producing and consuming, which is nice
19:51splunkseems like it could fit well with some kind of seq or core.async abstraction
19:51justin_smithsplunk: 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:51justin_smithand yeah, when I read from the app, I immediately put it in a core.async channel
20:47sdegutisI 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:13kavkazIf i have a binding that I made with the special form "let", is there a way to update it?
21:13amalloyno. values are immutable, bindings are immutable
21:14sdegutisHigh-ya!
21:15kavkazamalloy: I see, I guess I haven't gotten the hang of it yet.
21:15kavkazamalloy: I'll keep trying another way.
21:16amalloykavkaz: the answer is generally recursion, whether explicitly written by you, or implicit via a use of some built-in like reduce
21:17kavkazamalloy: I'll try that. I think it just involves more thinking, and checking out the docs a little more too
21:17kavkazthanks
21:25domokatois there a way to send some text output to an nrepl client from the nrepl server?
21:26domokatolike a log
23:04rolayo
23:05roladoes clojure have ad-hoc polymorphism and/or higher-kinder polymorphism
23:06justin_smithrola: 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:06rolacool, cool
23:07justin_smithrola: 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:08justin_smithprotocols 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:12puredangerprotocols are ~5x faster to invoke than a multimethod dispatching on class