#clojure log - Sep 03 2015

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

0:28 mordocai: So I've got a hashmap with characters as keys as such {\S :seen}. But (get \S {\S :seen}) returns nil. What stupid thing am I doing here?

0:29 amalloy: passign arguments to get in the wrong order

0:30 mordocai: Lol, found that just as you said that. Thanks, duh

1:04 This seems like something that should be easy, so I'm probably missing it. Is there an easy way to return just the keys whose value is true from a record? I may be doing something not very idiomatic, but I have a record with a series of flags that will be true or false and i'd like all the keys that are true. Currently i've come up with (map first (filter last record)) which is pretty bad I think.

1:05 amalloy: why do you have a record with a bunch of flag fields to begin with? is there some reason this can't just be a set of keywords?

1:07 mordocai: That should work. The actual data model is true/false flags (Email flags like read/unread forwarded/not etc) which is why I found that solution first. I think that was blocking me from seeing that solution for some reason. Maybe I just need sleep lol.

1:13 amalloy: a good rule fo thumb for records is

1:13 if you are designing a new thing, and you think it should be a record

1:13 then it probably shouldn't and you should just use a map or a set or a list or whatever

1:14 mordocai: Seems like it provides a nice structure though. "I have a map and it always has these keys!". I suppose schemas can provide the same and are easier to modify though.

1:15 amalloy: you can put that in a docstring: "returns a map and it always has these keys!"

1:17 skeuomorf: Is there a paper describing clojure? I couldn't find anything on the website and googling for "Rich Hickey clojure paper" didn't give me useful results

1:31 Bronsa: skeuomorf: no

1:32 aaron_ds: Hi

1:33 jeaye: In a theoretical lisp outside of clojure, how needed is unquoting in macros? Can it be avoided?

1:34 amalloy: jeaye: backquote and unquote are just shorthand for writing a bunch of calls to list and quote and cons and stuff like that. you can write them out longhand if you want

1:35 jeaye: I'm not talking about the syntax sugar. More so the unquoting itself.

1:36 Bronsa: jeaye: the unquoting itself is part of the syntax sugar

1:36 jeaye: What does ~arg expand to?

1:36 Bronsa: unquote doesn't exist outside the context of syntax-quote

1:37 ,'`(~a)

1:37 clojurebot: (clojure.core/seq (clojure.core/concat (clojure.core/list a)))

1:38 Bronsa: jeaye: the reader implementation for ` walks the syntax-quoted form and converts instances of ~ and ~@ into invocations of list/concat/quote etc

1:39 jeaye: ah

1:49 skeuomorf: Bronsa: Interesting

2:08 crocket: What is the most advanced approach to web application deployment on clojure land? servlet? independent web apps?

2:12 skeuomorf: crocket: I am new to clojure, but I think that the prevailing approach is using `ring` for HTTP, `compojure` for routing and a bunch of helpful libs from the `ring` repo, like `ring-json` and `ring-defaults`

2:12 crocket: I came to hate app servers that host multiple servlets.

2:13 I like independent deployments.

2:13 skeuomorf: crocket: The frontend, I think most people use clojurescript and use either Reagent or Om with it, they're both an implementation of Facebook's react in clojurescript

2:14 crocket: And of course leiningen to manage all this

2:16 crocket: skeuomorf, That's tangential to my question.

2:16 standalone deployment vs app server

2:17 skeuomorf: crocket: Ah, sorry, I read deployment as development

2:17 crocket: I am not familiar with how they do deployment in clojure land just yet

2:17 crocket: http://www.beyondjava.net/blog/application-servers-sort-of-dead/

2:19 Empperi: heh, wrote about the exact same thing back in 2013 http://blogs.collin.fi/npe/2013/09/01/death+of+application+servers

2:19 roelof: Can this be done at a better way : http://lpaste.net/140150

2:21 crocket: I think application servers bring forth a worse version of DLL hell on windows.

2:24 mordocai: roelof: (boolean x)

2:24 Already exists in core

2:26 roelof: So apparently https://github.com/clojure/clojure/blob/4bb1dbd596f032621c00a670b1609a94acfcfcab/src/clj/clojure/core.clj#L3386-L3392

2:26 And on that note, i'm off to bed.

2:27 roelof: mordocia : Im not allowed to use boolean. I have to implement this one myself

2:29 crocket: Bah

2:29 Can anyone tell me about pedestal web framework?

2:32 roelof: crocket: sorry im looking myself at the luminus framework

2:40 Can this be done at a better way : http://lpaste.net/140150 without using boolean, that one is not allowed

2:43 amalloy: what do you imagine a better solution would look like?

2:44 roelof: amalloy: one who does not need to return true or false maybe ?

2:45 amalloy: your function's requirements are apprently to return true or false. it is hard to imagine a more straightforward and obvious solution

2:46 roelof: amalloy: oke, then im going further down the road with the exercises of this MOOC

2:52 So this one (http://lpaste.net/140158) can not be done like this one : (defn teen? [age] (<= 13 age 19))

3:00 oddcully: roelof: sure it can be done like this, but its longer and harder to read than if

3:02 roelof: oke, for me it's wierd that I have to type true or false when the nil and false are already false.

3:03 oddcully: there you write your "boolean" function for. you want to have false instead of nil

3:03 if you just want to have truthy/falsey, then don't use boolean in the first place

3:03 justin_smith: ,(map #(or (not %) (not (not %))) [nil false true :blah])

3:03 clojurebot: (true true true true)

3:03 justin_smith: err, never mind

3:03 oddcully: ,(map #(not (or (nil? %) (false? %))) [nil false :a (atom [])])

3:03 clojurebot: (false false true true)

3:04 justin_smith: that's the one

3:04 oh I know

3:05 ,(map #(not (not %)) [nil false true :blah]) ; the ruby way

3:05 clojurebot: (false false true true)

3:05 oddcully: also javascript ;P

3:05 Bronsa: ,(map (complement not) [nil false true :blah])

3:05 clojurebot: (false false true true)

3:05 justin_smith: classy

3:05 roelof: Then thanks, I will let it that way

3:06 justin_smith: ,(map (comp not not) [nil false true :blah])

3:06 clojurebot: (false false true true)

3:09 crocket: Is it wise to write MySQL in clojure?

3:09 or postgresql

3:10 Would an RDBMS written in clojure consume too much memory?

3:10 oddcully: roelof: the keypoint to learn here is, that only `nil` and `false` are falsey in clojure

3:10 roelof: so you are not startled by things like

3:10 ,(boolean 0)

3:10 clojurebot: true

3:11 justin_smith: (boolean ())

3:11 muhuk: crocket: as an exercise it is wise.

3:11 justin_smith: ,(boolean ())

3:11 clojurebot: true

3:11 muhuk: crocket: as a final product; it depends, but prolly it won't have the same performance.

3:12 crocket: "Depends"

3:13 roelof: oddcully: I think the purpose of the exercise is learn that nil and false are false and practice with if then.

3:13 if then is mentioned and explained right above this exercise

3:22 crocket: Would it be wise to write a general purpose AI in clojure?

3:22 TEttinger: s/clojure/anything/

3:22 probably not

3:23 crocket: TEttinger, tell me your reasons

3:23 TEttinger: strong AI is a common windmill to joust and has been since the 1980s

3:23 crocket: JVM's shitty memory management worries me.

3:24 TEttinger: the human brain isn't well enough understood to even approach the amount of detail we'd need to make a computer model of one

3:24 crocket: I have some confidence that we are already close to general purpose AIs.

3:24 If not strong AIs.

3:24 TEttinger: the computers that would be capable of it would not run the JVM, or probably C for that matter, since you're talking about qubits not bits

3:25 crocket: It doesn't require a quantum computer.

3:25 General purpose AIs can run on low-end machines depending on needs.

3:25 like my desktop

3:25 TEttinger: I guess general purpose and strong AI are different

3:26 justin_smith: in fact, I have a general purpose AI installed on my abacus

3:26 Bronsa: (inc justin_smith)

3:26 lazybot: ⇒ 293

3:26 skeuomorf: (inc Bronsa)

3:26 lazybot: ⇒ 122

3:26 TEttinger: and yeah it's going to be far more cost effective for many years to just hire people to be your "general purpose intelligence"

3:27 Bronsa: I'll make a note to inc justin_smith more if that means more internet points for me too

3:27 skeuomorf: I incremented Bronsa for both, showing me the ways of lazybot and for incrementing justin_smith

3:29 * skeuomorf allocates the next time slot for the purpose of absorbing vitamin D

4:49 Guest90277: 09:41 *** NAMES @ChanServ [Neurotic] _ato `brian aaron7 aav abh adamhill adammh addisonj adereth AeroNotix ag0rex ahoegh_ akabander akilism akkad alcazoid alchemis7 alexbaranosky alexherbo2 algernon Alina-malina alisdair alloyed amalloy amano-- ambrosebs Amun_Ra ananthakumaran2 andereld andrei__ andrewstewart andreypopp_ anekos anon-1096 Answrguy aperiodic apetresc arenz arkh armyriad arnihermann arpunk arrdem asale

4:49 h ashiq ashnur Atlanis atomi auganov augustl avdi averell AWizzArd awwaiid babilen bakedb ballingt banjiewen bdawn bdruth ben_vulpes bencryption bengillies benizi beppu bg451 bhagany bigs billymeter Biohazard bjeanes bkamphaus blake__ blkcat bobpoekert bobwilliams bodie_ bogdanteleaga boodle borkdude bourbon boyscared boztek|afk bracki brainproxy brianwong brixen brokenstring broquaint bru_ bruceadams btn btobolaski

4:49 cantsin carc cartwright cataska ceridwen cespare cfleming cfloare cgfbee charliekilo chenglou chiffr ChiralSym choas_ ChongLi chouser chouser-log Chousuke chrchr chriswk cichli cljnewbie clojurebot cmbntr cmiles74 codahale codefinger codeitagile codelahoma coffeejunk Coldblackice CookedGryphon corbyhaas cored Cr8 cross cursork cYmen d4gg4d d_run daemian daito dakrone danielglauser danlarkin danlentz danlucraft dann

4:49 eu danzilio ddima dean demolithion demophoon dene14 Deraen DerGuteMoritz devn devth_ dhruvasagar dhtns Diabolik dignati_ diyfupeco dj_ryan dkua dnolen dogonthehorizon dominiclobue_ donbonifacio dopamean_ Draggor drpossum drwin dsantiago dsp_ dstockton Duke- dustinm dxlr8r dylanp dzimmerman eagleflo eatsfoobars ebzzry ecelis edoloughlin_ eduaquiles egli egogiraffe ekroon ellinokon emauton emperorcezar Empperi EnergyC

4:49 offee engblom eno789 ephemeron Epichero erdic ericbmerritt erikcw evilthomas evoqd Excureo expez f3ew farhaven felipedvorak fikusz filabrazilska firevolt fkurkows1 fluchtreflex Foxboron franco franklnrs fuziontech gabrbedd galaux gcommer georgej162 gerardc gf3 gfredericks ggherdov ggreer ghjibwer gigetoo gilliard GivenToCode gko gonz_ gozala grandy gratimax gregf_ greghendershott griffgrifmill grim_radical groot_ Gu

4:49 est12558 Guest18627 Guest38454 Guest64486 Guest853` Guest90277 guilleiguaran__ gws H4ns halorgium haroldwu HDurer HDurer_ Helheim henrytill herrwolfe heurist hfaafb hhenkel hiredman honkfestival honza Hrorek husanu hyPiRion iamdustan ibdknox icedp iclon icosa idnar ieure ikitommi_ imanc infinite1tate insamniac instilled Intensity ipolyzos iref isaac_rks itruslove ivan\ j0ni J_Arcane jaaqo jackhill jackjames jaen jam

4:49 iei janne jave jayne jconnolly jcrossley3-away jcsims jdaggett je jeadre jeaye jeffcarp jeregrine jeremyheiler jetlag jez0990_ jfojtl jgdavey jgmize jimrthy_away jinks_ jjbohn jjmojojjmojo jjttjj jkni jkogut jkogut_gs jlewis jlouis jlpeters jlyndon jmolet jodaro joeytwiddle jonathanchu jonathanj jonathanj_ jondot joshskidmore jrdnull jsime JStoker juancate Juhani julienXX justin_smith justinjaffray justinmcp justizi

4:49 n jweiss ka2u kai_999 kandinski kanja karls karppalo katox katratxo keen__________11 keifer ken_barber kephale kitallis klobucar Klumben kmicu Kneiva kolko kraft Kruppe kryft kungi kushal kwmiebach kylo l1x l2x l3dx lachenmayer lambdahands lancepantz larhat1 larme laxask lazy-seq lazybot LBRapid ldcn lea lebeer leifw lenstr Leonidas leptonix lfranchi Licenser littleli lobotomy lodin_ lokydor lordkefir lotia low-prof

4:49 ile lpaste_ Lugoues LukeWinikates___ luma luxbock Luyt lvh lyddonb lzhang m_3 machty macobo madscientist` magnars mahnve maio malyn Mandus manytrees marce808 mariorz markmarkmark martinklepsch martintrojer marvi MasseR matt_c matt_d matthavener mattrepl maxmartin mccraig mdeboard meandi_2 mearnsh Meeh Mendor|scr merlinsbrain metadaddy mfikes mgaare MichaelSmith michaniskin__ micrypt mihaelkonjevic_ mikkom misv mlb-

4:49 mobius-eng Mongey moop mpereira MPNussbaum mr-foobar Mr0rris0 mrb_bk_ mrLite_ mrowe_away msassak mtd mtdowling Mugatu muhuk MVPhelp_ myguidingstar n1ftyn8_ n8a naga` nano- narendraj9 Natch nathanic ndrst necronian neektza neena negaduck newgnus nexysno NhanH nickenchuggets nickmbailey nicola nighty^ nighty^_ nilern ninjudd nlew noidi nomiskatz_ noncom noplamodo nseger nulpunkt numberten nw nzyuzin ocharles__ octane-

4:49 - oddcully OdinOdin omarkj onthestairs oOzzy` opqdonut ordnungswidrig oskarth osnr owenb_____ owengalenjones own2 oyvinrob ozzloy p_l pandeiro patchwork pcn pepijndevos perplexa perrier pershyn peterdon philth piippo piranha pjstadig pkug pleiosaur pmbauer povilas preyalone przl puredanger puzza007 pwzoii pyon qz r0kc4t r4vi ragge Ragnor raifthenerd randy655 randy_ rapzzard^cloud rasmusto Raynes Raynos raywillig Raz

4:50 orX razum2um rberdeen rboyd rcg rdema reiddraper rfv rhg135 rigalo_ riotonthebay rippy rj-code rjknight__ rkapsi rlr robbyoconnor robink rotty rowth rpaulo rplaca rs0 rtl rufoa rweir ryanf ryuo s0lder safety saltsa sarlalian saurik sbauer322 scgilardi schmir schwap_ Scorchin scpike sduckett seabre seako seancorfield seangrove SegFaultAX segmond sephiap septomin seubert sharkz Shayanjm shaym shem shiranaihito SHODAN

4:50 shoky si14 sickill silven sineer sirtaj sivoais ska-fan skeuomorf skrblr sleezd snakeMan64 snits Snurppa sobel socksy sohum solvip someone someplace soncodi sorabji Sorella sorenmacbeth spacepluk spicyj spieden splunk srcerer sross_work|2 stain stasku status402 StevePotayTeo stian strmpnk sujeet surtn sw1nn swistak35_ taij33n tali713__ tarcwynne_ tatut tazjin tbatchelli tclamb tcrawley-away tcrayford____ TDJACR teka

4:50 cs telex tempredirect terjesb terom TEttinger TEttinger2 the-kenny the_frey thearthur thecontrarian42 ThePhoeron thesquib thomas thorwil threeve TimMc timvisher TMA tmarble tmciver tokik tolstoy tomaw tombooth tomjack tomku tomobrien tonini torgeir ToxicFrog tpope Trieste Tritlo troydm truemped tumdum Tuna-Fish turbofail tuxlax tvaalen twem2_ Uakh ubuntu3 UtkarshRay vaitel vedwin Viesti vilmibm vishesh voidlily voor

4:50 the-kenny: hello! :)

4:50 Guest90277: Sorry, slight missed keystroke on emacs ;)

4:50 macobo: Hello again Guest90277 or should I say TheCholb

4:50 having fun?

4:51 ashnur: here too?

4:51 justin_smith: you'd think the erc folks would make that harder to do

4:52 Guest90277: No, I honestly haven't been here before

4:52 And I'm not entirely sure what just happened

4:53 justin_smith: common erc problem, hitting return on the wrong line

4:53 schmir: rcirc ftw!

4:53 Guest90277: Ahh, I see

4:54 Sorry about that :)

4:55 moop: only on emacs

4:55 >miss a keystroke

4:55 >hilight everyone on the channel

4:55 happens everyday

4:55 Guest90277: haha so true

4:56 just seconds before it was an error buffer

4:57 I actually just loaded up the irc channel while i tried out some basic clojure, just to get a feel for what people are doing with it

4:57 so hi! :P

5:02 TEttinger: &(rand-nth ["hi, Guest90277!" "why was I highlighted?"])

5:02 lazybot: ⇒ "hi, Guest90277!"

5:04 diyfupeco: TIL rand-nth

5:05 wasamasa: schmir: actually, if you're with point in the nicklist in rcirc and hit RET twice, it pastes the nicklist

5:06 robbyoconnor: Guest90277: STOP

5:09 Guest90277: Stop what?

5:11 schmir: wasamasa: yeah, right.

5:12 can anyone recommend using circe on emacs?

5:12 wasamasa: yes!

5:12 but I'm biased because I sometimes contribute code to it

5:13 schmir: for the record, circe won't save you from it either because you need to enable the paste protection yourself

5:14 schmir: and its purpose is rather to prompt you whether you prefer putting that information into a pastebin

5:15 schmir: wasamasa: that's fine for me. I think I'm going to try it in the next few days

5:16 wasamasa: schmir: it tries going for ERC's look, rcirc's simplicity and sane defaults

5:16 schmir: as it isn't part of emacs, it's simple to report bugs, request features and getting code into it

5:18 robbyoconnor: If you can write a client that does what irccloud does

5:18 and pastebin if it's x number of lines

5:18 pastebin sites are stupid simple to write -- if you can't do it -- you suck :P

5:33 skeuomorf: oh FFS

5:52 Raffinate: Hi everyone! Is it possible to get the body of http POST request using http-kit without sending the request?

5:53 I mean, that I prepare POST request using :form-params

6:07 Kneiva: Raffinate: You could use something like this: http://requestb.in/

6:07 Raffinate: Or what's your use case?

6:07 Raffinate: Kneiva: I need it to make hash of the body

6:08 Kneiva: Ah.

6:09 Raffinate: I found private function in http-kit, that makes the body #'org.httpkit.client/query-string, and it works for now. But I feel uncomfortable using private one. )

Logging service provided by n01se.net