#clojure log - Jun 20 2015

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

3:27 yedi: hey guys im having an issue using this: https://gist.github.com/swannodette/5888989#file-debounce-clj-L1

3:27 initially I was doing (debounce chan 600) to create my debounce channel, and despite getting an ERROR in the chrome console, i was getting the debouncing behavior i expected

3:28 i realized I was creating a chan incorrectly and switched to (debounce (chan) 600) and the error is no longer there, but im no longer getting the debouncing behavior

3:28 does anyone know what might be up

3:49 nvm i was using it wrong

3:49 i should be taking from the debounced channel and putting to the normal channel

4:01 TEttinger: ,:6

4:01 clojurebot: :6

4:23 j-pb: ambrosebs: Id on't think the clojure community needs a COC, because it's the nicest one I've ever met, but if you want to make it explicit thats cool too. It's really just that sexual language bit I find concerning, do we have to stop to talk about the "domina" library now? What about "fuck this" or "I made love to that code all night long"?

4:24 ambrosebs: j-pb: hey

4:25 j-pb: ambrosebs: hey :)

4:25 ambrosebs: j-pb: as you can tell I'm new to this and thinking about it

4:25 :)

4:25 j-pb: I know its bikeshedding, but do you remember that "CouchDB + Ruby: Perform Like a Pr0n Star." talk were everybody lost their shit about some abs and butts.

4:25 ambrosebs: thanks for your patience :)

4:26 I don't remember, but I don't think that's cool

4:26 j-pb: it was a reference to the casting couch meme

4:27 ambrosebs: to answer your first question, I found that CoC while folling the Opal fiasco yesterday

4:27 following

4:28 nothing in the Clojure community triggered it, other than our lack of diversity

4:28 j-pb: went past me, I'll look for what happened

4:28 ambrosebs: some transphobia that was terribly handled by a maintainer

4:28 j-pb: ah

4:29 ambrosebs: I looked at the CoC and it's basically what I want to foster for typed clojure

4:29 note typed clojure is not clojure

4:29 core.typed shares its licence with rich hickey

4:29 that's where the similarities end

4:30 j-pb: I know, I'm concered about that not clojure itself

4:30 ambrosebs: right, I know there's grey areas, but as I said in the post, I would rather deal with that in public than have someone leave

4:31 I don't pretend that the CoC is unambiguous

4:31 j-pb: I just think that people should be able to express themselves freely as long as they don't intend to harm somebody else

4:32 ambrosebs: yes, I agree. sometimes intentions don't always work, sometimes they do

4:32 I'm a human

4:32 I interpret every situation like a human

4:32 *will

4:32 j-pb: yeah, like I said, a COC isn't nessecarily bad, but I think it can easily curb freedom of expression

4:32 ambrosebs: this is not saying I will ban you if your start making love with your code

4:33 but if people are uncomfortable, then it's something that needs to be addressed

4:34 j-pb: yes, but it's easy to get offended by all sorts of things

4:34 is one got offended by gays, we would tell them to fuck themselves

4:35 if one get offended by sexual extroverts, we side with them

4:36 (sexual extrovert as in, doesn't have a problem with talking about sex publicly or including sexual references in slides without showing anythig explicit (like a dildo))

4:38 and I don't think a "don't show don't tell" approach will help there

4:40 ambrosebs: j-pb: right. my main intention was mostly my point about opening a dialog if there's a social issue.

4:40 if people are offended at the quality of core.typed, well that's not my problem

4:40 j-pb: yeah, no critique there :), just wanted to hint at the potential problems

4:41 TEttinger: I find codes of conduct offensive. shame on you for considering one, ambrosebs, you need to step down as maintainer of typed clojure so a more qualified... uh... wait how are we going to find someone who knows the code better. CARRY ON

4:41 j-pb: TEttinger: haha, thats actually the point of the maintainer of opal, (the fiasko that ambrosebs) mentioned

4:42 TEttinger: yeah I kinda think adding a CoC without a need for one is kinda assuming the worst of your contributors

4:43 ambrosebs: TEttinger: I am extremely proud of my contributors so that certainly wasn't the intention.

4:43 j-pb: ambrosebs: tbh I just read on it and even though he handled it extremely badly, I think he's right. What you do outside the project, should have no impact on what you do inside the project.

4:43 ambrosebs: j-pb: I disagree that ignoring the issue is an option

4:44 elvis4526: I think I don't get what the ->> macro does

4:44 j-pb: If he behaved badly on "project grounds" (channel, issues, code) then fuck him, but what he does on his private twitter account is his thing.

4:44 elvis4526: do you get the -> macro :)?

4:44 elvis4526: Yes, I thought this was the same thing, only at the end

4:44 TEttinger: elvis4526: takes an argument that will be sent in as the last argument to each of the forms after it

4:44 j-pb: elvis4526: exactly

4:44 elvis4526: uh...

4:44 TEttinger: ,(->> [1 2 3] (map inc) (map (partial * 2)))

4:44 clojurebot: (4 6 8)

4:45 TEttinger: becomes (map inc [1 2 3]) first, which sends [2 3 4] to the next form

4:45 (map (partial * 2) [2 3 4])

4:46 j-pb: ambrosebs: how is it ignoring the issue though? I can acnowledge that somebody is an ass that I don't want to meet in person, but I can still accept that he/she writes good code.

4:46 TEttinger: which becomes [4 6 8]

4:46 j-pb: ambrosebs: the first thing I learned in OSS is, that there are assholes, but you don't have to like the people to work with them

4:47 TEttinger: also, thick skin is internet 101

4:48 ambrosebs: I also don't have to work with them either.

4:48 TEttinger: yeah, I've on and off collaborated with a guy who doesn't believe in the moon landing and used to be rather antisemitic (it was a phase he got out of)

4:48 elvis4526: alright I get it - my problem was somewhere anyway.

4:49 thanks guys !

4:49 j-pb: ambrosebs: yes, but why would you not? It won't change the person probably, and your project potentially got a lot worse

4:49 TEttinger: I think the main turning point for him was getting a "real job"

4:49 j-pb: elvis4526: always welcome :)

4:49 ambrosebs: j-pb: because I don't like working with assholes

4:50 TEttinger: having responsibilities tends to drive away immature people anyway

4:50 j-pb: ambrosebs: if he/she doesn't act like that on the project though?

4:50 ambrosebs: right, that's a good question.

4:51 j-pb: if somebody is an arse on twitter then it's twitters job to ban them

4:52 not his/her's peers job to socially isolate, him/ger

4:52 because thats actually pretty cruel

4:53 TEttinger: I kinda think the Opal fiasco attracted more negative attention than positive attention to the Opal project, both from the immediate response to a tweet on github, and the response to the actions that were demanded in the github issue....

4:53 ambrosebs: TEttinger: of course it was more negative

4:53 TEttinger: well even adding a CoC didn't help

4:54 ambrosebs: I agree

4:54 j-pb: tbh though

4:54 ambrosebs: damage was done

4:54 j-pb: am I the only one who thinks that there is a group of poeple who's job it is to be offended?

4:54 TEttinger: j-pb, not at all

4:55 j-pb: I mean what kind of person, goes to somebody elses hobby project and tells the people there what a bastard he is and that they should exclude him

4:55 that's pretty damn mean

4:55 TEttinger: it is astonishing how people go to such lengths to track down things that offend them

4:55 j-pb: the author even made the argument I made above "is free to have his opinions, in the case he'll bring his views against anyone contributing based on any of their mental or physical attributes, then it would be reason to tell him not to do that."

4:56 TEttinger: (especially when you could walk out your front door in any place of the world that has real problems, like a Brazilian favela, and not have to look at all to find something horribly wrong)

4:56 j-pb: and tbh CoralineAda comes across as the bigger jerk than meh in the discussion

4:57 ambrosebs: I don't think that's possible

4:57 TEttinger: I think they both acted like children

4:57 "oh no, I just offended a 9-year-old"

4:58 ambrosebs: j-pb: anyway, thanks for your concerns. I'm prepared to take each challenge as it comes.

4:58 j-pb: ambrosebs: shure :), thanks for the discussion

4:59 TEttinger: I think an in general request not to advertise yourself as part of Project X when in private conversations is really all you need

4:59 j-pb: TEttinger: thats actually a pretty good solution

5:00 TEttinger: you can say what you want if it's clear you don't represent Typed Clojure and that your barbaric views on, say, slavery, are entirely your own

5:00 (especially since those are likely to be sarcastic, which is hard to express in text)

5:01 j-pb: ambrosebs: pretty easily possible "Pro tip: you won't read it because you don't care."

5:01 ambrosebs: I think it's a judgement call. I spend every day working on Typed Clojure. If something is not right in my community then that's a big deal.

5:01 at best it was a false alarm.

5:01 I'm prepared to take the false positives on the chin.

5:02 j-pb: god I can't believe how much of an ass meh was making of himself

5:02 TEttinger: I think the most important thing is to separate Typed Clojure communication from private communication

5:02 j-pb: ambrosebs: also true

5:02 TEttinger: if you're going to be a jerk, you don't ever do it in a Typed Clojure forum or the like

5:03 ambrosebs: sometimes those are inseparable.

5:03 TEttinger: well then it is a typed clojure forum

5:03 so the advice stands

5:03 j-pb: well you can read on the views of her here https://modelviewculture.com/pieces/the-dehumanizing-myth-of-the-meritocracy

5:03 I don't think here views are combinable with classical hacker ethic

5:04 ambrosebs: to be honest though, I wouldn't want to contribute to something where I might get excluded from because of something completely unrelated

5:04 ambrosebs: j-pb: right, that's a good point.

5:05 j-pb: personally I'm not sanding down my ban hammer. more like my private email skills

5:05 TEttinger: "misogynoiristic expectancy on social media"

5:06 ok is that a real word

5:06 j-pb: haha

5:06 its funny how developers are literally like children

5:06 TEttinger: well we make up words for a living

5:07 transducers come close, though I believe it was a real word before

5:08 j-pb: my old headmaster always head a saying when kids got into a fight. "You know, in ancient germany there was a rule, called Burgfrieden. If two nights had a quarrel they were free to fight it out, but no not on the premisses of the lord they were guest at. Because that would be impolite and disturb the peace. This school is my castle, so get it together."

5:08 https://en.wikipedia.org/wiki/Burgfrieden

5:09 I think open source projects should have a burgfrieden policy

5:09 TEttinger: I'm not sure social justice people would appreciate a call back to medieval germany, especially when that worked out so "well" before for modern germany!

5:09 j-pb: how did it not?

5:10 we had 2500 independend kingdoms, living in peace with only minor quarrels between locals

5:10 TEttinger: well not for the jewish inhabitants of what was to become liebsraum under hitler...

5:10 j-pb: hitler is not ancient germany

5:10 but very recent events

5:10 TEttinger: read what I said

5:10 j-pb: *relatively speakeing

5:11 TEttinger: anyway, nazi germany tried to justify a lot of things as old german custom, even when it made no sense

5:11 j-pb: aahhh, thats what you're getting at

5:11 wagjo: Godwin's law FTW

5:11 TEttinger: (the swastika is a sacred symbol in hinduism, what does it have to do with germany...)

5:11 j-pb: lol yeah

5:12 because it looks admittably cool

5:12 TEttinger: it's certainly easy to make em, anything with right angles tends to be iconic

5:12 j-pb: https://www.youtube.com/watch?v=hn1VxaMEjRU

5:13 TEttinger: (compare the actual cross historians believe Jesus and/or his contemporaries would have been crucified on, to the one that is iconic today. a single pole wouldn't support the weight of a man, it likely had a crossbar like the Eastern Orthodox churches' cross uses)

5:14 but, two pieces of wood are easier to produce and to draw, so a simplfied symbol became the iconic one

5:16 j-pb: interesting

5:17 TEttinger: it also likely had to do with retroactively making the old romans look primitive when the new roman catholic church took over

5:20 j-pb: lol

5:23 TEttinger: really! supporting a person on a crucifix takes a surprising and terrifying amount of interest in causing the most pain to an enemy as possible, and if you're trying to show that the old roman ways were bad, you don't show that they had a methodology for torturing people, that just makes them more terrifying. you make them virtual cavemen, unenlightened in every sense.

6:36 j-pb: ambrosebs: The story goes like this. 2 male attendes of pycon talk in private and make jokes like "I'd fork that repo" or "something something big dongle". Female attendee finds this offensive sexual language, says it's explicitly forbiden by the COC, and posts a photo of them online. Twitter shitstorm ensures. The guys get fired. EVEN MORE shitstorm ensures. Girl gets fired.

6:41 gonz_: One guy got fired, Adria Ricards proudly proclaimed victory, the Internet got mad, Adria Richards got fired from her 'evangelist' job.

6:41 j-pb: yeah, quite popcorn worthy to be honest

6:41 sad for everybody directly involved though

6:41 gonz_: The guy found new work

6:43 As for Adria Richards, I have no idea if she found a new 'evangelist' position, but it's pretty much a non-job anyway. She was a glorified Twitter spammer.

6:54 J_Arcane: wtf. this isn't #hackernews. what the hell is this shit?

6:54 take the 'ebul girls' shit to reddit, please.

6:55 ffwacom: klogure

6:55 #hackernews is full of fuccbois

6:57 j-pb: J_Arcane: sorry, the background is that core.typed added a COC because of the opal incident yesterday and we were talking about the wording of it

6:57 J_Arcane: we shifted discussion to another room by now

6:59 J_Arcane: Cool. Another reason to get round to checking out core.typed.

7:03 gonz_: J_Arcane: There was no 'ebul girls' talk

7:04 You might want to put on some glasses, or work on your reading comprehension.

7:04 As for offtopic chatter, fair enough

7:08 elvis4526: What does this exception even means? " Caused by: java.lang.IllegalArgumentException: "Unparsable namespace form:" nil "

7:08 all my ns declarations exist.

7:09 scottj: elvis4526: web paste the code

7:09 mrcheeks: elvis4526:how do you declare your namespaces? indeed paste it

7:10 elvis4526: This css: https://gist.github.com/je-allard/38ff22146c52e07c3d4a

7:10 (wait there is more)

7:12 with garden configured like this: https://gist.github.com/je-allard/184812c2edfb7352bb70

7:12 mrcheeks: elvis4526:I think that the full stacktrace would be interesting.

7:12 elvis4526: It only happens when I run lein garden auto - when loading the code myself in a repl it load just fine.

7:13 mrcheeks: https://gist.github.com/je-allard/28848ea3bd3d68f7152f

7:13 /tmp/form-init779624767614268047.clj:1:71 - so helpful :) :) :)

7:19 mrcheeks: elvis4526: It seems to be related to whatever code auto-reloading it's doing. Also check your dependencies, I've never use that ns-tracker, but your errors seems related to the checks here : https://github.com/weavejester/ns-tracker/blob/master/src/ns_tracker/nsdeps.clj

7:20 s/errors/error/g

9:00 vivekramaswamy: Hello All, a quick question (reduce + (conj [] (repeat 1(rand-int 100000)))) I am not able to understand how that reduce is working, any help will be appreciated

9:01 justin_smith: ,(reduce + (conj [] (repeat 1 (rand-int 100000))))

9:01 clojurebot: (47228)

9:01 justin_smith: ,(reduce + [:whatever])

9:01 clojurebot: :whatever

9:02 justin_smith: when there is only one item in the collection, and no initial value of the reduce, the reducing function never gets called

9:03 ,(reduce (fn [] (assert false)) [:OK])

9:03 clojurebot: :OK

9:05 vivekramaswamy: but what I can't undestand is that reduce + requires 2 arguments, and also how id that final result derived, meaning once you get a random number and put it in a vector, what is the reduce actually doing I am unable to see any additions here

9:05 justin_smith: vivekramaswamy: the function + is never called

9:05 because you don't supply enough args (or a large enough collection) for the reducing function to be called

9:06 vivekramaswamy: specifically, when you do not give reduce an initial value for the reduction, it takes the first item out of the collection and uses that

9:06 vivekramaswamy: it is getting called justin, cause try executing (conj [] (repeat 1 (rand-int 100000))) the form you get is diffrent from (reduce + (conj [] (repeat 1 (rand-int 100000))))

9:06 justin_smith: no, it does not get called

9:07 if taking the first item out of the collection results in an empty colleciton, the reducing function is never called

9:07 it just returns the first item

9:07 look at the source of reduce

9:07 vivekramaswamy: ok

9:07 justin_smith: $source reduce

9:07 lazybot: reduce is http://is.gd/KClthS

9:08 justin_smith: vivekramaswamy: we can know + is not called, because it would throw an error, you can't call + on collections

9:08 that was the point of my (fn [] (assert false)) example - that would blow up, it doesn't take enough args, and even if called successfully it would blow up

9:10 vivekramaswamy: ok, but please help me with this https://gist.github.com/anonymous/483ab2cf6a1c80a74580 how come the forms are diffrent

9:11 justin_smith: vivekramaswamy: as I said before, it takes the first item out of the collection

9:11 ,(reduce nil [:FOO])

9:11 clojurebot: :FOO

9:11 justin_smith: because you did not give reduce an initial value

9:11 vivekramaswamy: so in place of reduce I could have just used first

9:12 justin_smith: in this specific example, sure - but you would get an error if there were two items in the collection

9:12 note above, it also works with nil, which isn't even a function

9:13 vivekramaswamy: got it, cause this example is from a book I am reading, and I could not understand as to why the author used reduce + in the example, if all she wanted was the first element

9:13 justin_smith: yes, that is a bit weird, maybe it's a lesson about what reduce does in the degenerate case

9:14 vivekramaswamy: maybe, as always thank you very much

10:42 kaffeeboehnchen: ok, so I have ring-json and (:body request) is giving me the string without a problem, but (get-in req …) is not working and json/read-str fails because org.httpkit.BytesInputStream can not be casted to String :(

10:57 justin_smith: kaffeeboehnchen: the body is an inputstream, not a string in that case

10:57 you can slurp an inputstream to get a string

11:01 DEA7TH: I have a macro defined in terms of itself (recursively). Now I want to do a single step of preprocessing every time before calling it and my solution is to turn it into a function, and do the preprocessing in a macro which then calls that function. So in my case the only difference between a macro and a function is how it takes its input, what it does with it. Which brings the question, why do we need macros at all? Can’t I use instead ‘ and eval i

11:01 function? This is my first macro btw, so I might be missing obvious background information.

11:01 justin_smith: DEA7TH: macros only run when the source code is loaded, never at runtime

11:01 kaffeeboehnchen: justin_smith: "slurp"? :D And I thought the ring middleware will do that for me?

11:02 DEA7TH: justin_smith: I know, but in my case it doesn’t matter.

11:02 in the sense that both work for me.

11:02 justin_smith: kaffeeboehnchen: could be the headers (content type?) wasn't right to get the automatic processing

11:02 kaffeeboehnchen: justin_smith: That could be it, right, I will look into it.

11:03 justin_smith: DEA7TH: in that case, a macro is better because it does the work at compile time instead of runtime, and worse because macros are fragile and you can't readily use them as first class values

11:04 DEA7TH: justin_smith: Performance won’t become an issue, so only the downside about fragility applies, therefore I should use ‘ and eval? But I’ve read somewhere that I should always prefer macros to eval.

11:04 justin_smith: oh, if the alternative is eval, use a macro

11:04 I missed the eval part

11:05 DEA7TH: but what is wrong with eval?

11:07 justin_smith: it's slow, it's an easy source of security holes, it's one of the most powerful tools you can use, and it's always best to use the weakest sufficient tool

11:08 ararog: why this division isn't evaluated on repl? (/ 18288515683 1043177)

11:08 justin_smith: ararog: it is, it returns a ratio

11:08 DEA7TH: But it can be used in such a way that none of these apply. Oh well, I understand now anyway.

11:08 justin_smith: ,(type (/ 18288515683 1043177))

11:08 clojurebot: clojure.lang.Ratio

11:09 ararog: justin_smith, got it, let me understand Ration a little better, thanks!

11:09 justin_smith: ,(double (/ 18288515683 1043177))

11:09 clojurebot: 17531.55570243592

11:09 kaffeeboehnchen: justin_smith: Thank you very much, it was the missing content type -.-

11:11 justin_smith: DEA7TH: I don't know about the rest, but eval always has a performance penalty compared to an equivalent macro

11:12 ararog: justin_smith, thanks again!

11:13 DEA7TH: Yeah, it makes sense now.

11:18 Glenjamin: Hi all, has anyone had issues with timbre interleaving log output?

11:43 Confusion: What would be a nice way to transform only elements of a vector matching a certain criterion? I can e.g. do (mapv #(if (even? %) (* % %) %) [1 2 3 4 5]) to square only the even members, but of course that is rather ugly

11:45 I can define a separate function for the predicate-transformer combination, but perhaps there's a nice construction that allows me to split the predicate function and the transformation function?

11:46 classcast: zach tellman's library "gloss" has this handy function "decode-stream" which I want to use in "aleph". Now I need a codec for a variable size byte-array which also results in a byte-array on the receiving side and not in a vector or list of bytes as it does when I use (repeated :byte)

11:47 can someone help with that?

11:48 it must be a byte array for further processing with a third-party library. additional conversion from vector of bytes to an array is suboptimal...

11:52 j-pb_: classcast: does this somehow help? https://github.com/ztellman/byte-streams

11:52 are the two questions related btw :)?

11:53 classcast: j-pb_: how would that be? guess no

11:54 j-pb_: if you take that example: http://ideolalia.com/aleph/literate.html#aleph.examples.tcp but I just want to sent plain byte arrays

11:55 j-pb_: ah I see what you mean

11:55 there is something like that leck me check, long time since I wrote code with it

11:56 classcast: :)

11:57 j-pb_: classcast: finite-block might do what you want

11:57 https://github.com/ztellman/gloss/wiki/Introduction

11:57 I'm sorry

11:57 https://github.com/ztellman/gloss/wiki/Introduction#finite-block

11:57 classcast: humm intersting

11:57 j-pb_: thanks. let's see where that gets me

12:03 j-pb_: simple repl tests look promising. thank you

12:05 j-pb_: classcast: I'm not sure if I got what you wanted correctly, :) do you want the input of the tcp stream as a bunch of bytebuffers? or do you want to send a bunch of bytebuffers with framing information?

12:05 because the above will create a header that encodes the length of each frame

12:06 classcast: j-pb_: I control both client and server and just want to get the arrays across. since they can be split on multiple tcp messages I wanted to use decode-stream to not reinvent the wheel ;)

12:07 j-pb_: ah yes, I though that you might want to do some parsing of raw bytes you don't controll, but it looks like finite-block is exactly what you're looking for :)

12:07 I though about your first problem a bit more, and haven't come up with a better solution

12:07 I think it would be nice if clojure had a "identity if predicate false, else transform" funciton

12:08 classcast: j-pb_: which first problem are you talking about?

12:08 j-pb_: oh I'm sorry, it was Confusion who asked that

12:09 both names are the same length and start with a c, my brain mangled you up :)

12:10 classcast: ok ;)

12:12 Confusion: j-pb_, OK, so no such function exists. Nevertheless you've given me a good idea: move the transformation code to a separate function and make the predicate function return either id or that new function. That's already a bit nicer and if I make the 'if-true' function an argument, it's even reusable

12:17 donbonifacio: anyone using lein and cljc?

12:26 classcast: j-pb: hu thats weird. the array I get back from gloss still contains the length at the beginning

12:27 j-pb: hrm, that is weird

12:31 classcast: not sure if this works, but (finite-frame :int32 (finite-block :none migh

12:32 classcast: j-pb: I currently got (def protocol (gloss/finite-block :int32))

12:33 j-pb: could you try

12:33 (def protocol (gloss/finite-frame :int32 (gloss/finite-block :none)))

12:35 classcast: j-pb: seems to have problems with that :none

12:35 j-pb: ah I feared that

12:35 classcast: j-pb: IllegalArgumentException: No implementation of method: :write-bytes of protocol: #'gloss.core.protocols/Writer found for class: clojure.lang.Keyword

12:37 j-pb: if you change :none to :int32 you get 2 lengths as expected ;)

12:37 j-pb: yeah

12:38 classcast: j-pb: I am not sure why the length does not get removed by decoding...

12:46 j-pb: I have the suspicion that I am accessing the HeapByteBuffer wrongly ;)

12:46 there is probably a position marker somewhere behind that length

12:46 j-pb: could be

12:50 classcast: j-pb: got it working :D

12:50 j-pb: nice :)

12:51 did you accidentaly "rewind" the bytebuffer?

12:51 classcast: j-pb: nope. I am extracting the actual array as: (let [hbb ^HeapByteBuffer (first %), ba (byte-array (.remaining hbb))] (.get hbb ba) ba)

12:52 I'd prefer a better decoding that results in the actual array

12:53 j-pb: so you manually cut of the header?

12:56 if you do I'll open an issue on gloss, and ask what ztellman thinks of adding a remove-header flag

12:56 there should be a way to get the data out that you put in easily

12:57 classcast: j-pb: no, the state of the buffer is correct as you can see in the above code. the length is already consumed

12:57 j-pb: ah ok, I don't know the bytebuffer api to may shame :) only used gloss

12:58 classcast: j-pb: the feature-wise question is: why do I have to deal with that buffer at all

12:58 j-pb: classcast: instead of a byte-array?

12:59 classcast: yes

13:00 j-pb: you also put a bytebuffer in right?

13:00 so it's bytebuffer in bytebuffer out

13:00 classcast: nope. a byte array

13:00 j-pb: interesting

13:00 the documentation states that you put bytebuffers in

13:01 that might be a convenience conversion, but as it uses bytebuffers internally I assume no reconversion is done for performance reasons

13:01 classcast: well maybe it converts the array to a buffer internally

13:01 j-pb: yeah

13:02 classcast: I guess no one wanted that so far. since usual gloss users want their data frames to be decoded ;)

13:02 j-pb: yeah :D

13:02 actually, could it be that aleph is already capable of sending raw bytebuffers?

13:03 not sure if it can do the framing for you

13:03 I only used gloss, and skimmed over aleph :)

13:03 classcast: well I end up with 244 bytebuffers of one message now ;)

13:04 gotta adjust that previous code

13:14 whodidthis: not sure if this is a bit stoopid, but would it be possible to use core.match in tests in a way that the failed value could be read from test results kind of like with (is (= a b)) https://www.refheap.com/104291

13:28 dnolen: Bronsa: ping

13:28 Bronsa: dnolen: pong

13:29 dnolen: Bronsa: so I'm realizing that there's a big step that needs to happen on the Clojure side of tools.reader before I can really proceed any further wrt. bootstrapping.

13:29 Bronsa: do tell

13:29 dnolen: even in ClojureScript today `(< x 1) doesn't do what you expect

13:29 < will get resolved to whatever namespace you are in

13:29 Bronsa: right

13:29 so you need platform agnostic symbol resolutio

13:30 dnolen: yeah, it's never really come up before as a big deal because hardly anyone uses `(...) in CLJS since we don't have macros

13:30 Bronsa: dnolen: clojure.tools.reader/resolve-symbol is a dynamic var

13:31 rebinding that to something that understands cljs namespaces should be enough I think

13:32 dnolen: Bronsa: that exists in 0.9.2?

13:32 Bronsa: yeah

13:33 I made it a dynamic var a while ago foreseeing this moment. Since 0.8.x at least IIRC

13:35 dnolen: on a similar note, I don't think cljs supports ctor literals e.g. (deftype foo [a]) #user.foo[1]. To add support to them just treat them as tagged literals

13:36 no nevermind, ctor literals don't make sense in cljs.

13:36 dnolen: yeah not under advanced compilation

13:36 Bronsa: not even under normal compilation

13:37 #user.foo[] produces an object at read-time

13:37 but at read-time you're using the jvm not the js vm

13:37 dnolen: hrm could probably work if deftype / defrecord is in .cljc?

13:38 Bronsa: dnolen: could work but that'd be problematic. you'd have to create a jvm version of the record for each cljs record defined

13:39 you'd need to take into account collisions. what if some.ns.Record already exists in the jvm?

13:39 dnolen: well assuming you did this on purpose via .cljc I don't actually see the issue

13:39 Bronsa: ah

13:39 dnolen: but in anycase, it doesn't seem that useful due to the advanced compilation bit

13:40 trying out the resolve-symbol thing now

13:58 Bronsa: well that was easy https://github.com/clojure/clojurescript/commit/f240826034bb5f9ddd53e68a6c3be4e740070470, thanks

14:02 Bronsa: dnolen: cool, I don't remember how resolve-existing-var works but resolve-symbol assumes the symbol itself is returned if it's not possible to resolve it

14:03 dnolen: and if it's not qualified, it should qualify it according to the current ns to prevent capture

14:03 ,`foo

14:04 clojurebot: sandbox/foo

14:05 dnolen: it works the same far as I can tell

14:23 whodidthis: not sure how to describe but whats a fun way to do this in emacs https://www.refheap.com/104295, other than backspacing

14:24 dnolen: whodidthis: there's a join line command

14:24 whodidthis: sweet, thanks

14:25 TimMc: nice!

14:28 dnolen: whodidthis: http://pragmaticemacs.com/emacs/join-line-to-previous-line/

14:30 whodidthis: perfect

14:32 TimMc: It's just M-x join-line for me.

14:34 whodidthis: bound it for M-k since theres something not-too-clojurey in there as default

14:41 dnolen: TimMc: I think it depends on cursor placement?

14:42 join-line works on current line, M-^ works on previous one

15:16 DEA7TH: So, this is how I handled my macros: (defmacro algebra-eval [expr] (algebra-eval-f expr)) ———- algebra-eval-f is a function which takes a list of expressions and returns an expression. This is the only macro I use. I basically put my everything in functions, and used a macro as a wrapper. Is this good practice?

15:16 justin_smith: it's generally what's recommended

15:16 DEA7TH: I needed to do that because I call (map algebra-eval-f collection), and map didn’t work so well with a macro, even with #(macro %)

15:17 I mean #(my-macro %)

15:18 I see. Hm, oh well.

15:43 TimMc: dnolen: Appears to be same thing.

15:43 dnolen: TimMc: ah k

15:44 TimMc: (behaviorally)

17:15 kaffeeboehnchen: do I need a macro to accomplish that? I want a function "me-first" which takes two parameters, a string and the name of the function. If some conditions are true I want to call the function name of the parameter with the other parameter. E.g. (me-first "hi" this-maybe).

17:37 celwell: Hi, in "loop" is it possible to "recur" by rerunning the original bindings?

17:37 e.g., (loop [code (util/rand-str-alpha-num-only-upper 5)]

17:37 (if (is-code-available? db-conn code)

17:37 (println "done" code)

17:37 (recur (util/rand-str-alpha-num-only-upper 5))))

17:38 See how the recur is the same as the original binding?

17:38 Bronsa: celwell: (loop [] (let [code ..] .. (recur)))

17:39 celwell: i guess that is slightly cleaner

20:22 billymeter_: Hi

20:24 billymeter: What's the best/de facto standard book for learning Clojure?

20:24 I'm somewhat familiar with Common Lisp

20:51 scottj: billymeter: clojurebook.com

21:55 billymeter: scottj: thanks

22:33 justin_smith: billymeter: if you have a good unsertanding of common lisp, joy of clojure can be good

Logging service provided by n01se.net