#clojure log - Sep 03 2015

The Joy of Clojure
Main Clojure site
Google Group
IRC
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. )

9:28 noncom: i am working with figwheel to recompile cljs on-the-fly, when i start it with "lein figwheel", the resulting java process takes about 1 - 1.2 gigabytes! is that normal?

9:33 roelof: why do I see this error messsage (cond requires an even number of forms) on this code http://lpaste.net/140207

9:35 wasamasa: roelof: did you forget a closing paren around the second condition?

9:37 wink: one ) after 100 missing I think

9:37 a lot easier to spot with proper formatting ;)

9:38 sdegutis: When you make your own defprotocol, do you prefer to use deftype or defrecord to implement it?

9:38 dnolen: noncom: your platform has JVM memory defaults, who knows what they are? you can supply your own memory constraints if you like.

9:38 sdegutis: Is this still relevant? https://chasemerick.files.wordpress.com/2011/07/choosingtypeforms2.png

9:39 noncom: dnolen: okay, i can limit the memory usage, but why does it rise it that hight just right after starting? even my games which use a lot of resources and objects reach 1GB very unwillingly...

9:40 and here, a compiler that recompiles sources once in a minute, takes its constant toll of 1+ GB without even doing anything

9:40 dnolen: noncom: games and compilers are even remotely the same thing

9:40 noncom: dnolen: so, the compiler breeds many objects and keeps hold on them?

9:40 dnolen: I can compile WebKit or V8 and peg all my CPUs and consume gigabytes of RAM

9:41 noncom: no but it doesn't really matter, it may generates tons of temporary objects, grow the heap, and at some point collect

9:42 noncom: if you want more pauses but a smaller heap, set memory constraints

9:42 noncom: well, okay. just wanted to confirm that this is okay. apparently compilers do much heavy lifting. ummm that matters because sometimes i work on low-end machines, okay, i think i will adjust java memory options as you suggest and see where it gets me

9:44 dnolen: also, one more question: currently figwheel starts, but does not show the repl. what could be the cause? it worked yesterday, and I did not make any serious changes to the project

9:44 roelof: wasamasa: thanks, that was the culprit. But still it's not good. A lot of tests are failing

9:45 noncom: is there any way to find out why repl did not show or what it is doing? (looking at the CPU meter, it does nothing though)

9:45 dnolen: noncom: I don't use figwheel frequently enough to answer that question. #clojurescript is probably a better channel for that. bhauman hangs out there, or the Slack channel.

9:45 roelof: so some causes are not good

9:45 noncom: okay, i will!

9:46 wasamasa: roelof: I recommend using something like rainbow-parentheses to spot it easily or paredit to avoid it happening in the first place

9:47 noncom: oh, i found a tiny type in one of the namespace names and figwheel was actually warning me about this.

9:48 roelof: what's your case, again?

9:50 sdegutis: yes

9:51 sdegutis: this is so much fundamental, i doubt there'll be any change in that unless clojure will restate some of its basic ideas and wokring principles

9:52 sdegutis: i actually wanted to find this picture for you, but you were faster

9:56 sdegutis: :)

9:56 thanks noncom

10:00 roelof: This case it to make a function which looks if a year is a leap-year or not

10:16 sveri: Hi, anyone knows if there is a prismatic schema definition for hiccup?

10:31 noncom: sveri: never seen it... and how would you define it anyways?

10:39 sveri: well, it's a vec containing a Keyword, an optional map and a string, to start with something

10:40 justin_smith: sveri: more than one string allowed right?

10:40 or another copy of all of the above

10:40 or N of those

10:42 sveri: justin_smith: exactly

10:51 noncom: sveri: hmmm from that it looks like you could easily define it...

11:07 sveri: noncom: of course, but I think it's always better if the creator, or someone that is very close to the implementation, does that, to provide a complete spec. Everybody else is just guessing and might miss something

11:07 sdegutis: When you have a System component and you start a jetty server, how do you pass that System component to each request?

11:08 justin_smith: sdegutis: crate a middleware that captures the incoming component in the jetty component

11:08 *create

11:08 sdegutis: hey what is this rust?

11:09 crates, comeon

11:09 justin_smith: hmm I don't understand your idea

11:09 So where is the System component stored in the meantime?

11:09 Is it lexically captured by the middleware creation?

11:09 justin_smith: sdegutis: define a ring middleware inside the jetty component

11:09 sdegutis: Ahh interesting.

11:09 justin_smith: right, close over the incoming component, and then provide it to each request via the middleware

11:09 sdegutis: I like the idea of structuring that Component recommends, but I'm using defprotocol/defrecord instead.

11:10 justin_smith: I don't see how that changes things here

11:11 also the normal thing with components is to define a record type for each component

11:30 sdegutis: justin_smith: phew

11:31 kwladyka: Do you have any idea how can i get remote work as Clojure Junior? Or with relocation in Europe?

11:31 Everybody looking Senior

11:32 noncom: sveri: you could start with a PR request to hiccup or prismatic..

11:32 kwladyka: if you're clojure, then you're senior

11:32 schmir: kwladyka: I'd say just try to apply for the job

11:33 kwladyka: noncom, heh tell it to recruiters :)

11:33 schmir, i am trying :)

11:33 noncom: yeah, well, actually just try

11:33 have some projects to show

11:33 your code will say it all

11:34 kwladyka: but my weakness is tech talk, they asked me about some definitions and i don't know them. I don't have to know them to write good app... but maybe i am in mistake :) Anyway i don't know all this definitions :)

11:34 noncom, yes i have

11:34 noncom: kwladyka: you should know the definitions too. it is important not only to write the apps but also to communicate with other people

11:35 kwladyka: so in tech talk they put me as Junior and thats it :)

11:35 noncom, i understand but... i can't know them if i wouldn't start use them. I can start use definitions only if i start work in bigger team :)

11:36 noncom: then my best advice is for you to learn the tech talk. since you went to an interview and they've clearly told you what else you need to know

11:36 kwladyka: but i can't start work in team, because i don't know definitions

11:36 do you feel my problem? :)

11:36 noncom: kwladyka: pffft :D "can't know them if i wouldn't start use them" - that's true.. but remember how in school you learned tonns of stuff just for the sole knowldege itself? I doubt you ever put 80% of it to real use

11:37 kwladyka: noncom, yeah but you know... good recruiter will always know i don't really know them and i can't learn all just only to pass the tech talk :)

11:37 noncom: yes..

11:37 just out of interest, what definitions exactly were these?

11:37 kwladyka: noncom, yes i hated it so much, learning tons of not necessary stuff, it was a nightmare

11:38 noncom, for example what is functional programming, trail recursive, difference between left join and right join in SQL etc.

11:38 i can tell a lot about that but not exactly what they want to hear

11:38 sdegutis: Would naming your own defprotocol or defrecord System conflict with the built-in System Java namespace?

11:38 kwladyka: *trail = tail

11:39 noncom: justin_smith: hello! could you maybe answer such a small question: if i am getting a [] through websocket, and i want to create a div from each element of the [], turning it into a reagent form, how do i fit the result into the higher form?

11:39 justin_smith: sdegutis: no, because it is in the package of your namespace

11:39 schmir: are you just talking to recruiters?

11:39 noncom: if i do [:div (mapv f [])], i get [:div [[] [] []..]] insread of [:div [] [] [] ...]

11:39 justin_smith: noncom: I'd probably use assoc-in or update-in

11:40 kwladyka: schmir, ?

11:40 justin_smith: noncom: (into [:div] (mapv ...))

11:40 noncom: oh.. wow...

11:40 justin_smith: ,(into [:div] [[][][]])

11:40 clojurebot: [:div [] [] []]

11:40 noncom: fantastic!

11:41 thank you very much :)

11:41 sdegutis: justin_smith: but I won't be able to refer to them both in the same namespace without qualifying mine, like (do (System/getProperty "foo") (System. "my-system-ctor")) would break right?

11:42 noncom: kwladyka: hmmm well.. i can see why they want you to answer these questions.

11:42 kwladyka: noncom, so it is very hard to find a job in Clojure in Poland, especially in my country is a few companies using it. So i have to find something remotely or hire in one of few company in my country.

11:43 noncom: kwladyka: not that i want to disappoint you, but such questions - what is tail recursion, SQL join, functional programming and such - they are must-have knowledge

11:43 kwladyka: noncom, but for example i read what is functional programming many times, i watched a lot of videos, but i don't remember the definition (anyway there is no definition), still i know what it is and how to use that

11:44 noncom: well, actually not the definition is important but your understanding of it. if you just say how you understand it, it should be enough.

11:44 sdegutis: justin_smith: btw I went with your suggestion for using defmulti to pick the right configs map

11:45 kwladyka: noncom, yeah but it is not like i don't answer. For example about trail recursion i told everything except what exactly is optimise (stack). How to use that, how is good, how i bad etc.

11:45 noncom, so in that way i am Clojure Junior and it is hard to find a job :)

11:46 noncom: kwladyka: so you have answered what is mathematically recursion, and not what is recursion in programming. because programming understand recursion differently - more in terms of stack optimisation.

11:46 kwladyka: *trail = tail - again the same misspell :)

11:46 sveri: kwladyka: noncom Tech talk is always a different thing. I remember after doing php where I designed a database with over 100 tables, did joins and index stuff everywhere and finally went to apply for a job they said a tech word for left join I just didn't know and never got what they wanted exactly from me, despite knowing what and how to join. Sometimes its just bad luck

11:47 noncom: svery: yes. sometimes the recruiters are unskilled themselves and just ask if you know the vocabulary. that's a different situation

11:47 kwladyka: noncom, no i was talking about how it is working in Clojure and how it should be used, but i didn't know what exactly benefit of it, just knew there is optimisation and code has to be write in that way

11:47 sveri: and at my current offic I bet only half the people can do recursion, let alone know what tail recursion is, and you wouldnt think that if you look at our website^^

11:48 kwladyka: noncom, so i knew how to use that, but i didn't know it is exactly about stack

11:48 noncom: well, i can only advice one thing: love knowledge and learn as much as you can

11:48 sveri: noncom: +1

11:48 just don't get frustrated over it, it's not school anymore, its a hobby, something you like doing, something which gains you more money in the future, see it from a different perspective

11:50 noncom: yes. there is a certain pleasure when you feel yourseld a professional. the ability to receive that pleasure is what is appreciated, because it results in self-motivation, drive and capacity.

11:50 kwladyka: noncom, i am doing this :) But the best learning about tech expressions is using it, i can't learn it in practice because i don't work in team :) I can't work in team because i don't know tech expressions even if i use them, many times i am using something but i don't know it has name :P

11:50 troydm: say I want to quickly start repl and test some stuff from some core.logic library for example, how can I quickly load it from repl as dependency?

11:51 kwladyka: troydm, http://clojuredocs.org/clojure.core/require

11:52 noncom: kwladyka: the situation looks like you have to learn theory now. i doubt you will ever use stack in your programming. however, stack is involved in all your programming, in every function call. the fact that you do not touch it directly does not free you from the obligation to understand it as best as possible

11:52 troydm: also, look for the pomegranate library

11:53 kwladyka: noncom, i know what is stack, i was using C++, assembler, python, perl, matlab, something conneted with AI (i don't remember a name) and many others language. So i understand what is happening inside, but... i can't answer adhoc about this questions :)

11:54 noncom: kwladyka: hmm, maybe i do not understand the situation entirely.. but when i got into similar situations, i just learned what they wanted from me. and it payed back actually.

11:55 kwladyka: noncom, my problem is i am practices and i hete university way of learning. I haven't ever work in team more then 3 person or corporation and it is a problem now.

11:55 noncom: kwladyka: there is even a practice among programmers in our country: once or twice a year, send resumes, try to apply for other places even if you're not really going to do that. because what they ask you on the interviews will keep you alert and won't let sleep comfortably on your present job where you know everything well

11:56 kwladyka: noncom, yeah i will learn i guess, because i have to, but not sure yet what are the questions :) Anyway if recruiter is good he will know i don't have this part of experience. I guess i could start as Java programmer, but with Clojure is very hard as i can see.

11:57 noncom: kwladyka: okay, i got it, you're more of a practitioner... well, maybe there'll be a luckier interview

11:57 i don't think clojure is any harder than java

11:57 probably even on contrary

11:57 kwladyka: noncom, me too, but from Clojure programmer they expect to be a Senior during tech talk :)

11:57 just what i see

11:57 noncom: ah

11:57 well, then java junior could be a good bet

11:58 sveri: kwladyka: especially as the market is really good for java programmers right now, at least here in germany

11:59 troydm: noncom: where does lein save the dependencies for project by default?

11:59 kwladyka: and i understand why they reject me during tech talk, in 99% this question have sense and they will reject not technical people etc., but i have totally uncommon way of carrier and it has my pain in the ass :)

11:59 troydm: noncom: I mean location of jar files

12:00 kwladyka: troydm, target/uberjar

12:00 chomwitt: in lein repl i'm in the namespace of a program of mine but trying to evaluate a simple symbol i get: Unable to resolve symbol: a1 in this context

12:00 schmir: troydm: ~/.m2

12:00 sveri: kwladyka: how often did you get rejected?

12:01 troydm: schmir: aha, so it's just using maven for that

12:01 schmir: yes

12:02 kwladyka: sveri, it is not only about rejected during tech talk. I am saying it honestly on the beginning i am Clojure Junior (because they will see that during tech talk) and it is hard to interest somebody :)

12:02 troydm: schmir: so it's possible to write a simple function that would load dependencies from .m2 if they are already there and add them to classpath and call it some open source clojure project for example lein-quick-dep

12:04 sveri: kwladyka: from my experience, talking to other people is always "hard" but can be learned, often it is not about what you can do, but about listening. Depending on whom is taking part in the interview it could b e a good approach to start talking about their business, why they have it, how they got it, how they earn money, how you can help them earning money, don't be to focused on a technology stack, be focused on how you can help th

12:04 kwladyka: just looking company which want hire Clojure Junior remotely or in Europe and they don't see the problem i am from PL and i have to relocate. It is hard to even find that companies :)

12:05 sveri, but on tech talk with technical man who is programmer not manager it is hard to talking about business :)

12:06 i pass the talk about presentation myself, i pass the code test, but tech talk is weak :)

12:07 schmir: troydm: lein-try is a bit like

12:07 kwladyka: anyway i have to find the company which will want hire me as Clojure Junior and it is a challenge for me because of the place where i live :)

12:07 schmir: troydm: or take a look at vinyasa

12:07 sveri: kwladyka: true, I agree

12:08 schmir: troydm: https://github.com/zcaudate/vinyasa#lein

12:08 troydm: or use boot scripts

12:09 troydm: https://github.com/zcaudate/vinyasa#pull for pulling in deps at runtime

12:09 troydm: https://github.com/boot-clj/boot/wiki/Scripts

12:11 troydm: schmir: I think lein-try is just what I really needed, thx

12:30 mavbozo: i miss you people

12:30 AeroNotix: what do you mean "you people"?

12:31 mavbozo: AeroNotix, I mean everyone in this #clojure channel

12:39 arrdem: on behalf of the other more silent lurkers we're glad to be missed

13:11 roelof: why do I see this error message (ava.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn) on this code : http://lpaste.net/140211

13:11 j-pb: roelof: clojure is prefix

13:11 hiredman: because (a b c) invokes a as a function

13:11 j-pb: (+ x1 x2)

13:11 hiredman: so (x + x) invokes x as a function

13:12 roelof: Thanks, I have to be more familair with the prefix notation

13:14 hiredman: the only difference with say C function call notation is where the parens are

13:14 f(a,b)

13:14 (f a, b) ;; valid clojure but generally comas aren't used there

13:16 the real difference is in many languages + is not a function, so you use it differently

13:19 roelof: another question. I do these exercises. Can I tell midje to test only 1 function ?

13:22 hiredman: no idea, I don't use midje

13:22 (and I wish others wouldn't either)

13:23 roelof: hiredman: what is then a better test suite ?

13:24 hiredman: clojure.test

13:25 roelof: hiredman: oke and what is that better then midje ?

13:26 hiredman: it is a very simple library and it comes with clojure

13:26 midje has in the past suffered badly from sort of "worlds collide" kinds of issues

13:27 it was created in the mode of some ruby testing frameworks, but ruby is not clojure

13:28 Bronsa: midje does awful side-effects during macroexpansion, I don't like it.

13:29 https://github.com/clojure/clojure/commit/722e023ea00b27a47b11afc29fa7fe0a282696f4 finally

13:30 roelof: Bronsa: so also you use clojure.test ?

13:30 Bronsa: yes

13:30 hiredman: clojure.test gives you the ability to create tests, make assertions in those tests, and run the tests

13:31 Bronsa: clojure.test does all I need and nothing more

13:31 hiredman: exactly

13:31 Bronsa: which is, running tests and reporting on failure

13:34 roelof: oke, thanks and have a good evening

13:42 sveri: roelof: +1 for clojure.test, never found the need for another one, even though I used midje for some time. I myself always fall into the "there is another library for testing / xxx, so clojure.test / xxx-base must lack something" trap

13:44 roelof: oke, I have to use midje at this point. The course is using it

13:44 luxbock: I went through expectations, speclj and midje, and in the end I just use clojure.test as well

13:45 sveri: The only thing I add some time is test.check :-)

13:57 Rurik: FileNotFoundException Could not locate clojure/data/csv/as__init.class or clojure/data/csv/as.clj on classpath: clojure.lang.RT.load (RT.java:430)

13:57 getting this error, what does this mean?

13:58 oddcully: wrote `as` instead of `:as`?

13:58 Rurik: ahh, gotcha

14:01 justin_smith: once again, bitten by the bizarreness that is permgen heap separation (forgot to bump up permgen space for coworkers still using 1.7)

14:02 when your max heap is 4g, and your app dies with out of memory while using 1.7g, that's probably permgen

14:02 this is also an argument for reading stack traces more closely

14:03 Bronsa: justin_smith: wasn't permgen removed from recent jdks?

14:03 justin_smith: Bronsa: yeah, like I said, this is for coworkers using 1.7

14:03 Bronsa: ah

14:03 I thought you were talking about the clojure version

14:03 justin_smith: which is why I forgot it was an issue

14:04 Bronsa: I am ashamed that I could get this baffled by the same bug twice in my career

14:04 lol

14:29 sdegutis: Clojure's dynamic stuff is pretty cool. CIDER-nREPL would be impossible in Haskell.

14:29 That kind of instant feedback is great.

14:30 Hrorek: can anyone explain how reify works?

14:33 Empperi: it takes a java interface or clojure protocol and creates an object which implements that

14:33 under the hood it uses java proxy mechanism to do it's trick

14:33 http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Proxy.html

14:34 Hrorek: Empperi, can you give an example?

14:34 Empperi: how about this? https://clojuredocs.org/clojure.core/reify

14:34 there's several examples there

14:36 Hrorek: Empperi, I don't understand them

14:36 Why did you need to use str at first

14:36 justin_smith: Hrorek: what are you trying to do?

14:37 Hrorek: nothing, just trying to understand

14:37 justin_smith: Hrorek: the example uses str because it is reifying the toString method, which str calls

14:39 nooga: I started rewriting my huge app to component because mess started creeping in. I've got http server component that does (start-server app) on start but app is just ring handler and there is a ton of logic in there, logic that would use other components like db, cache etc...

14:39 justin_smith: the point of reify is that you have some class and/or interfaces you want to extend (perhaps because some infrastructure you are using expects an instance of that class or interface?), and it lets you do this succinctly without giving up a full namespace and using gen-class to do it

14:39 nooga: how do I express something like fat ring handler in the component system?

14:39 justin_smith: nooga: then pass in those components so that app can use them?

14:40 Hrorek: justin_smith, can you explain the example line-by-line?

14:40 nooga: but app is just a value (def app (routes ... blah))

14:40 justin_smith: nooga: what I do is create my app in the start method, and pass in the resources my app uses (including db, logging, server side IPC, environment specific config, etc.)

14:40 nooga: then make it so it's not that any more

14:40 sdegutis: nooga: why are you using using compojure btw

14:40 justin_smith: make a function that returns app, and takes components as an argument

14:40 sdegutis: nooga: why not bidi or silk?

14:41 nooga: sdegutis: It's old, maybe it's time to switch here as well

14:41 justin_smith: I see

14:42 well... not really

14:42 is there any example I could look at?

14:45 justin_smith: nooga: I wonder, sadly my app is not open source

14:46 nooga: I understand that I can write app constructor that will take config etc, and component will inject other components into app (which will be some kind of map)

14:47 but, for instance, route handlers are not called by me, they're called by something else

14:47 how will they know the value of db component for example?

14:47 justin_smith: nooga: right, but you can make a middleware that provides data to the app route handlers whenthey are called

14:48 and that data can include your components

14:48 nooga: oh

14:48 smart

14:48 justin_smith: (defn wrap-component [handler] (fn [request] (handler (assoc request :components {:some components :go here}))))

14:49 then you can write your endpoints so they can look up the component stuff in the request under the :components key

14:49 nooga: yup, got it

14:49 thanks!

14:49 justin_smith: np

14:50 nooga: another thing you can do is provide a middleware meant to be used by a ring handler as part of what a component generates

14:50 so a db might provide a wrap-db middleware as part of the map it returns

14:50 Rurik: justin_smith, in the first example why did we have to use reify, why not do (str "foo") directly

14:50 justin_smith: this is useful if you have components in multiple apps that would want to use a db in the same way

14:51 Rurik: because that wouldn't demonstrate reify

14:51 Rurik: in the real world, you have some server written in java that wants an object and the server calls str

14:51 or it calls frob

14:51 and you need to provide something that does the thing you want when str or frob is called

14:52 Rurik: str is picked in the example because toString is a well known method, and easy to demonstrate fully

14:52 Rurik: aha, so we made f an Object and passed it to str

14:53 justin_smith: right

14:53 and f can do whatever it wants when you call str

14:53 based on it's toString method

14:53 Rurik: and in the next example we made f into a Seqable

14:53 nooga: justin_smith: thanks alot, I'll fiddle with that

14:53 justin_smith: Rurik: exactly

14:54 Rurik: justin_smith, but I don't get the third example

14:54 justin_smith: Rurik: you'll need to learn about metadata to get that one

14:55 Rurik: clojure objects are special, one way they are different from other objects is you can attach metadata maps to them

14:55 Rurik: the example demonstrates that you can attach metadata to a thing made via reify

14:55 ,(meta ^{:k :v} [])

14:55 clojurebot: {:k :v}

14:55 justin_smith: ,(meta ^{:k :v} "")

14:55 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Metadata can only be applied to IMetas>

14:56 justin_smith: Rurik: that worked with [] and not "" because [] is a special clojure object, and "" is not

14:56 sdegutis: Is there a more efficient way of doing this?

14:56 ,(apply list "foo")

14:56 clojurebot: (\f \o \o)

14:56 justin_smith: sdegutis: seq "foo"

14:56 sdegutis: Ahhh nice one justin_smith.

14:56 Prefect.

14:56 justin_smith: bbl lunch

14:56 sdegutis: remember there are a lot of things that implicitly call seq too

14:57 kavkaz: Do you guys think group-by can be implemented so it could work with (range)?

14:57 sdegutis: True

14:57 justin_smith: like all the collection functions (filter, map, reduce...)

14:57 sdegutis: kavkaz: why not?

14:57 justin_smith: sdegutis: it would need to be groups-bys so it could lazily return each update

14:57 sdegutis: or you would need a lot more ram

14:58 kavkaz: My only issue is I just got involved with lazy sequences, and I'm not too familiar with making them. So atm I can't really think of how to lazily return each update of the map

14:58 Rurik: justin_smith, gotcha

14:59 kavkaz: I've made them but I've never worked with maps I guess...

14:59 Well, worked with maps in that specific way

15:01 Rurik: justin_smith, what is `this` (don't know Java at all)

15:04 kavkaz: Rurik: it's the reference an instantiateable class uses to reference itself

15:05 Rurik: so if it has an attribute (member) a method within that class could reference this.someMember

15:05 Rurik: kavkaz, like `self` in python?

15:05 kavkaz: instantiable*

15:05 Rurik: I think so, never used Object Oriented programming in python

15:06 But I'm guessing yes

15:06 oddcully: Rurik: yes

15:06 kavkaz: Rurik: yes i just looked it up

15:09 sdegutis: Is it ever appropriate to use metadata in the context of an API as opposed to language-building macros?

15:14 Empperi: yes it is

15:15 just look at prismatic schema for example

15:27 amalloy: Empperi: reify doesn't use java's proxy mechanism at all, actually. proxy does (unsurprisingly), but not reify

15:27 you don't need to, if you're just implementing interfaces: you can generate a class at compile time and just instantiate it at runtime

15:36 sdegutis: I'm having difficulty figuring out how to model an immutable lexer.

15:36 I suppose it could probably be done with (reduce) and an initially empty output-bucket right?

15:44 gfredericks: sdegutis: sounds reasonable

15:45 sdegutis: I once wrote a lazy immutable brainfuck interpreter that was similarly structured

15:45 speaking of which you could do it lazily too if you wanted I expect

15:45 (not using reduce)

15:45 but maybe reduce is cooler than laziness in these modern times

15:46 but arguably for the interpreter laziness is good because it allows for infinite programs

15:46 or streaming/repl/whatever

15:52 amalloy: sdegutis: isn't a lexer just a function that takes in a string, and returns a token plus a remainder-string? then you can loop over that with recur or reduce or lazy-seq or whatever

15:53 sdegutis: gfredericks: isn't reduce lazy now too with transducers?

15:54 amalloy: kind of yeah, but it's not always 1-to-1 mapping from character to token

15:54 That's why I wanted (vec "foo") earlier, to which justin_smith replied with (seq "foo") and I was like "whoa"

15:55 gfredericks: sdegutis: I don't think "reduce is lazy now" is accurate; I know there's something to do with laziness but I don't know what it is exactly

15:55 sdegutis: that's why he said "remainder-string", not "the original string minus exactly one character"

15:56 (last msg was in response to your amalloy thing)

15:57 sdegutis: ah

16:05 amalloy: yeah if there were a 1-to-1 mapping between input character and outpot token, every lexer could just be a hashmap lookup

16:05 justin_smith: Rurik: one thing that might help coming from python is to know that the jvm doesn't do duck typing, and just a method name is not enough to be generically callable by a consumer that might not know about your specific class. So we have interfaces with defined methods, so that a consumer can call the methods of that interface, letting you implement the interface however you need to.

16:06 Rurik: ah, gotcha

16:06 maybe that is why it was so hard to understand for me

16:08 justin_smith: Rurik: stupid example: for python, the fact that a method is called roll is enough, but for the jvm it wants an Interface like Wheel or Breads or you might eat tires or something

16:09 Rurik: haha

16:09 justin_smith, any reasons for this design?

16:09 justin_smith: because different classes might have different funcitonality in mind when assigning a method name

16:10 Rurik: gotcha

16:10 justin_smith: trivial example being things like "roll" that can be a verb or a noun

16:10 but it avoids needing big verbose method names - the context of the Interface adds extra information so the method name need not be as verbose

16:11 Rurik: Hmmn

16:11 So roll might mean to spin for a wheel or a cylinder

16:12 but roll into a 'cylinder' for a sheet of foil or a carpet

16:12 justin_smith: sure, yeah

16:12 Rurik: does that makes sense?

16:12 justin_smith: yeah, I think that's the general idea

16:13 wombawomba: how can I tell if two classes are comparable?

16:13 Rurik: justin_smith, but if the idea is so good why doesn't Python/some other language implement it?

16:13 justin_smith: wombawomba: if the first arg has a version of the compareTo method defined for the second?

16:14 Rurik: it's not uncontroversial - different languages take different approaches, some prefer duck typing, some prefer explicit interfaces or typeclasses

16:16 There's another variant called structural typing too

16:16 wombawomba: justin_smith: hmm, alright. How do I tell if that's the case, though?

16:17 justin_smith: wombawomba: what are you trying to do?

16:19 wombawomba: justin_smith: I'm trying to make this less fragile https://github.com/venantius/ultra/blob/master/src/ultra/test/diff.clj#L50-L61

16:21 it's supposed to give helpful information for test errors, but it breaks on e.g. (is (= 3 4L))

16:22 justin_smith: ahh - so if things might be comparable you could say too high or too low or something?

16:22 wombawomba: right

16:23 justin_smith: wombawomba: theoretically you could use reflection to see if the class or any superclass has a .compareTo defined for the second arg or any of it's superclass / interfaces? Something like that maybe.

16:23 wombawomba: clojure.reflect is a little confusing, but it can get at this kind of data.

16:23 wombawomba: cool, I'll have a look at it

16:23 thanks :)

16:25 justin_smith: Rurik: an interesting aspect of all of this is that unlike java (whose vm we use, of course) the clojure compiler does not force you to implement all the methods on an interface, so one of the main arguments against duck typing (just because one method exists doesn't mean the others you will need are there too) doesn't really apply for us.

16:26 or, we have the same drawback that duck typing does, but without the advantages

16:35 sdegutis: Do you have a mnemonic to know whether case or cond is the one that uses truthy values like :else?

16:35 As the else-clause).

16:35 justin_smith: sdegutis: I remember case as being the one that is no-nonsense

16:36 sdegutis: eg. the tests must be literals

16:36 sdegutis: How tho?

16:36 justin_smith: sdegutis: the way I remember that is that C has a case but no cond, and C is not a big language for nonsense

16:36 sdegutis: I bet Clojure 1.1 must have sucked.

16:36 justin_smith: (in the way I am using the term "nonsense" here)

16:36 sdegutis: justin_smith: oh nice!

16:36 I'll use that.

16:37 justin_smith: whereas cond comes from lisps - it's more lispy in flavor

16:37 sdegutis: And to remember C, I just have to memorize "C is for Clojure"

16:37 justin_smith: hahahah I don't know if this actually helps at all

16:38 C has a case and it doesn't do things like args marked by keywords, or case tests that are not compile time literals

16:40 Rurik: justin_smith, what are the ways in which Clojure differs in a major way from other lisps?

16:40 sdegutis: justin_smith: Ruby has a very fancy case/when also tho.

16:41 justin_smith: plus in C it's switch/case, but in Ruby it's case/when, which is much more similar to Clojure's (case), so that'll actually make it harder for me to remember

16:41 :(

16:41 Rurik: mainly by preferring manipulating seqs to recursion

16:42 Rurik: also our syntax is a lot less idiotic since we have first-class vectors and maps built into the language, which lisps usually lack

16:52 justin_smith: sdegutis: I had such bad stockholm syndrome when I started with clojure, I was like "what, why use square brackets for let, I like (let ((foo bar) (baz quux)) ...) much more explicit"

16:52 sdegutis: :D

16:52 previous lisper eh?

16:52 I came from Ruby :'(

16:52 justin_smith: common lisp, scheme, lush

16:52 by the time I started using Clojure I was an OCaml programmer mainly

16:53 I still miss OCaml when our types get all shitty in our app at work

16:53 can't convince people at work to use prismatic/schema, with a strongly typed language they wouldn't have the choice

16:55 sdegutis: Yeah I do miss having type safety as well as type-safe enums or whatever they're called.

16:55 I've been using keywords for function status return results, which often look like [db :ok] or whatever.

16:59 amalloy: sdegutis: the way to remember which of case/cond uses :else is to think about it: :else couldn't possibly work for case

17:00 because the clause isn't tested for truthiness, but rather compared to the value you are casing

17:00 sdegutis: amalloy: oh right, it could be a valid value!

17:00 gfredericks: (inc amalloy)

17:00 lazybot: ⇒ 297

17:00 gfredericks: ,(* 27 11)

17:00 clojurebot: 297

17:00 amalloy: gfredericks: you are terrible at finding prime factors

17:07 gfredericks: amalloy: I was doing something related but different

17:07 finding prime-power factors

17:11 sdegutis: gfredericks: wow nice on that one

17:13 Crap.

17:13 I forgot how to design a lexer/parser.

17:17 gfredericks: fun fact: there's an efficient algorithm for determining if a number is a prime power

17:17 m1dnight_: does it have a name? (hello everyone, btw)

17:18 I was looking for some "hard" numbers of clojure adoption in the industry, anyone got something I can use?

17:24 justin_smith: gfredericks: did you hear, Clojure PDX (nee Clojerks) is doing a test.check workshop tonight?

17:24 m1dnight_: http://cognitect.com/clojure#successstories will be fine as well :>

17:30 amalloy: gfredericks: that sounds like something i must have learned and then forgotten in number theory

17:33 sdegutis: m1dnight_: 7

17:33 There is 7 Clojure adoption in the industry.

17:34 justin_smith: (inc sdegutis)

17:34 lazybot: ⇒ 7

17:34 justin_smith: ROFLMAO

17:34 sdegutis: Whoa what a coincidence.

17:34 :D

17:34 skeuomorf: lol

17:37 sdegutis: Hmm.

17:37 Turns out recursion is actually probably better for this lexer than reduce.

17:38 Lets me have more control over how many characters to consume per call.

17:38 kwladyka: http://clojuredocs.org/clojure.set/difference available since 1.0 but i get CompilerException java.lang.RuntimeException: Unable to resolve symbol: difference in this context - why?

17:38 justin_smith: kwladyka: did you require clojure.set? are you qualifying the name properly?

17:38 kwladyka: oh i see

17:38 i have to use clojure.set

17:39 but in example is nothing about that

17:39 justin_smith: indeed - many examples are crappy in that they assume you ran (use 'some.random.lib)

17:40 kwladyka: is if my first example where it is missed

17:40 *it is

17:40 what a misspell... it can sound like it is time to sleep :)

17:41 justin_smith: ,(iterate compare 0)

17:41 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/compare>

17:41 justin_smith: err, never mind

17:41 why do I keep expecting iterate to be like reduce...

17:42 gfredericks: justin_smith: I did not hear that

17:42 sdegutis: justin_smith: it's fair to assume a just-barely-not-beginner-anymore user knows they first have to refer/use things into context before using them

17:42 justin_smith: I mean in the context of docs/examples

17:43 justin_smith: sdegutis: many examples assume you use more than one lib, and don't make clear what came from where

17:43 gfredericks: amalloy: factorization is normally formalized as n -> p1^k1 * p2^k2 * p3^k3 * ... * pn^kn

17:43 sdegutis: ahh

17:43 that sukcs

17:43 gfredericks: amalloy: i.e., it's a collection of powers of primes

17:43 justin_smith: gfredericks: http://www.meetup.com/clojure-pdx/events/224522942/

17:43 sdegutis: ,(let [[a b] []] [a b])

17:43 clojurebot: [nil nil]

17:43 sdegutis: phew

17:43 gfredericks: justin_smith: oh yeah I saw that a while ago

17:43 amalloy: gfredericks: i was teasing. i was pretty sure you knew 27 wasn't prime

17:44 gfredericks: amalloy: I know I just can't stop myself from discussing number theory at every minor opportunity

17:44 kwladyka: justin_smith, but to be honest it is in doc but not super clear when you see situation like that first time

17:44 http://clojuredocs.org/clojure.set/difference right top corner clojure.set

17:44 and on main page http://clojure.org/cheatsheet

17:44 but as a habit i am looking only on examples :)

18:05 sdegutis: Crap.

18:05 Apparently (comp) is not friendly to var changes.

18:06 justin_smith: nor are juxt or partial, they aren't really things to use if you expect the functions they are using to be redefined

18:06 sdegutis: ,(do (def a 1) (let [f (comp a)] (binding [a (constantly 2)] (f))))

18:06 clojurebot: #error {\n :cause "Can't dynamically bind non-dynamic var: sandbox/a"\n :via\n [{:type java.lang.IllegalStateException\n :message "Can't dynamically bind non-dynamic var: sandbox/a"\n :at [clojure.lang.Var pushThreadBindings "Var.java" 320]}]\n :trace\n [[clojure.lang.Var pushThreadBindings "Var.java" 320]\n [clojure.core$push_thread_bindings invokeStatic "core.clj" 1818]\n [clojure.core$pus...

18:06 sdegutis: ,(do (def a 1) (let [f (comp a)] (with-redefs [a (constantly 2)] (f))))

18:06 clojurebot: #error {\n :cause "java.lang.Long cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to clojure.lang.IFn"\n :at [sandbox$eval49$fn__50 invoke "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval49$fn__50 invoke "NO_SOURCE_FILE" 0]\n [clojure.core$with_redefs_fn invokeStatic "core.clj" 7197]\n [clojure.core$with_redefs_fn inv...

18:06 sdegutis: clojurebot: screw you

18:06 clojurebot: No entiendo

18:06 sdegutis: justin_smith: fair point

18:07 justin_smith: ,(do (def a 1) (let [f (comp a)] (with-redefs [a (constantly 2)] f)))

18:07 clojurebot: 1

18:07 justin_smith: ,(do (def a 1) (let [f (comp #'a)] (with-redefs [a (constantly 2)] f)))

18:07 clojurebot: #'sandbox/a

18:07 justin_smith: ,(do (def a 1) (let [f (comp #'a)] (with-redefs [a (constantly 2)] @f)))

18:07 clojurebot: #object[clojure.core$constantly$fn__4371 0x430c042d "clojure.core$constantly$fn__4371@430c042d"]

18:08 justin_smith: ,(do (def a 1) (let [f (comp #'a)] (with-redefs [a (constantly 2)] (f))))

18:08 clojurebot: 2

18:09 sdegutis: hahaha, (= \/ a b) ;; begin comment

18:09 weird emoticon thing

18:10 justin_smith: that's a reasonable solution but probably easy to forget unless you make a discipline of it, to make sure you don't too-early-bind something that you plan to redefine using cider-nrepl

18:10 justin_smith: sdegutis: yeah, late binding is relatively tricky in clojure, but look at the bright side, we could have the insanity that is elisp

18:11 sdegutis: :D

18:11 yes, elisp does suck very much.

18:18 justin_smith: point being that elisp does late binding very very well, to the point of craziness

18:33 wasamasa: what do you mean, using (let ((last-command this-command)) ...) to make a test pass can impossibly be crazy!

18:34 * wasamasa wishes he were joking

19:11 rhg135: 0.o

19:47 sdegutis: justin_smith: makes sense, given its meant to be edited live

20:29 How do you specify "anything" in Instaparse?

20:30 Meaning, anything that isn't one of the following acceptable rules in the grammar after this "Anything" rule?

20:33 amalloy: sdegutis: that is kinda a dangerous thing to do. how many characters should "anything" consume?

20:33 the entire rest of the file?

20:33 sdegutis: Sure, as many as needed until an acceptable following-rule is found.

20:35 amalloy: well, if you allow "anything" to match any number of characters, it will slurp up to the end of the file. in most lexers i know of, tokens match the longest possible substring

20:35 eg foo is one token, not the three tokens f o o

20:36 you could make it match one single character, and just allow repeated application of the anything rule, but i don't think this is a very healthy approach in the long term

20:37 sdegutis: Hmm.

20:37 ok

21:08 amalloy: thanks, took your advice

21:26 Seylerius: Are there any clojure doc sites that expose an easy URL for building a conkeror webjump around?

22:36 Is there an opensearch for clojure cheatsheet?

Logging service provided by n01se.net