#clojure logs

2015-09-03

00:28mordocaiSo 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?
00:29amalloypassign arguments to get in the wrong order
00:30mordocaiLol, found that just as you said that. Thanks, duh
01:04mordocaiThis 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.
01:05amalloywhy 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?
01:07mordocaiThat 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.
01:13amalloya good rule fo thumb for records is
01:13amalloyif you are designing a new thing, and you think it should be a record
01:13amalloythen it probably shouldn't and you should just use a map or a set or a list or whatever
01:14mordocaiSeems 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.
01:15amalloyyou can put that in a docstring: "returns a map and it always has these keys!"
01:17skeuomorfIs 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
01:31Bronsaskeuomorf: no
01:32aaron_dsHi
01:33jeayeIn a theoretical lisp outside of clojure, how needed is unquoting in macros? Can it be avoided?
01:34amalloyjeaye: 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
01:35jeayeI'm not talking about the syntax sugar. More so the unquoting itself.
01:36Bronsajeaye: the unquoting itself is part of the syntax sugar
01:36jeayeWhat does ~arg expand to?
01:36Bronsaunquote doesn't exist outside the context of syntax-quote
01:37Bronsa,'`(~a)
01:37clojurebot(clojure.core/seq (clojure.core/concat (clojure.core/list a)))
01:38Bronsajeaye: the reader implementation for ` walks the syntax-quoted form and converts instances of ~ and ~@ into invocations of list/concat/quote etc
01:39jeayeah
01:49skeuomorfBronsa: Interesting
02:08crocketWhat is the most advanced approach to web application deployment on clojure land? servlet? independent web apps?
02:12skeuomorfcrocket: 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`
02:12crocketI came to hate app servers that host multiple servlets.
02:13crocketI like independent deployments.
02:13skeuomorfcrocket: 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
02:14skeuomorfcrocket: And of course leiningen to manage all this
02:16crocketskeuomorf, That's tangential to my question.
02:16crocketstandalone deployment vs app server
02:17skeuomorfcrocket: Ah, sorry, I read deployment as development
02:17skeuomorfcrocket: I am not familiar with how they do deployment in clojure land just yet
02:17crockethttp://www.beyondjava.net/blog/application-servers-sort-of-dead/
02:19Empperiheh, wrote about the exact same thing back in 2013 http://blogs.collin.fi/npe/2013/09/01/death+of+application+servers
02:19roelofCan this be done at a better way : http://lpaste.net/140150
02:21crocketI think application servers bring forth a worse version of DLL hell on windows.
02:24mordocairoelof: (boolean x)
02:24mordocaiAlready exists in core
02:26mordocairoelof: So apparently https://github.com/clojure/clojure/blob/4bb1dbd596f032621c00a670b1609a94acfcfcab/src/clj/clojure/core.clj#L3386-L3392
02:26mordocaiAnd on that note, i'm off to bed.
02:27roelofmordocia : Im not allowed to use boolean. I have to implement this one myself
02:29crocketBah
02:29crocketCan anyone tell me about pedestal web framework?
02:32roelofcrocket: sorry im looking myself at the luminus framework
02:40roelofCan this be done at a better way : http://lpaste.net/140150 without using boolean, that one is not allowed
02:43amalloywhat do you imagine a better solution would look like?
02:44roelofamalloy: one who does not need to return true or false maybe ?
02:45amalloyyour function's requirements are apprently to return true or false. it is hard to imagine a more straightforward and obvious solution
02:46roelofamalloy: oke, then im going further down the road with the exercises of this MOOC
02:52roelofSo this one (http://lpaste.net/140158) can not be done like this one : (defn teen? [age] (<= 13 age 19))
03:00oddcullyroelof: sure it can be done like this, but its longer and harder to read than if
03:02roelofoke, for me it's wierd that I have to type true or false when the nil and false are already false.
03:03oddcullythere you write your "boolean" function for. you want to have false instead of nil
03:03oddcullyif you just want to have truthy/falsey, then don't use boolean in the first place
03:03justin_smith,(map #(or (not %) (not (not %))) [nil false true :blah])
03:03clojurebot(true true true true)
03:03justin_smitherr, never mind
03:03oddcully,(map #(not (or (nil? %) (false? %))) [nil false :a (atom [])])
03:03clojurebot(false false true true)
03:04justin_smiththat's the one
03:04justin_smithoh I know
03:05justin_smith,(map #(not (not %)) [nil false true :blah]) ; the ruby way
03:05clojurebot(false false true true)
03:05oddcullyalso javascript ;P
03:05Bronsa,(map (complement not) [nil false true :blah])
03:05clojurebot(false false true true)
03:05justin_smithclassy
03:05roelofThen thanks, I will let it that way
03:06justin_smith,(map (comp not not) [nil false true :blah])
03:06clojurebot(false false true true)
03:09crocketIs it wise to write MySQL in clojure?
03:09crocketor postgresql
03:10crocketWould an RDBMS written in clojure consume too much memory?
03:10oddcullyroelof: the keypoint to learn here is, that only `nil` and `false` are falsey in clojure
03:10oddcullyroelof: so you are not startled by things like
03:10oddcully,(boolean 0)
03:10clojurebottrue
03:11justin_smith(boolean ())
03:11muhukcrocket: as an exercise it is wise.
03:11justin_smith,(boolean ())
03:11clojurebottrue
03:11muhukcrocket: as a final product; it depends, but prolly it won't have the same performance.
03:12crocket"Depends"
03:13roelofoddcully: I think the purpose of the exercise is learn that nil and false are false and practice with if then.
03:13roelofif then is mentioned and explained right above this exercise
03:22crocketWould it be wise to write a general purpose AI in clojure?
03:22TEttingers/clojure/anything/
03:22TEttingerprobably not
03:23crocketTEttinger, tell me your reasons
03:23TEttingerstrong AI is a common windmill to joust and has been since the 1980s
03:23crocketJVM's shitty memory management worries me.
03:24TEttingerthe human brain isn't well enough understood to even approach the amount of detail we'd need to make a computer model of one
03:24crocketI have some confidence that we are already close to general purpose AIs.
03:24crocketIf not strong AIs.
03:24TEttingerthe 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
03:25crocketIt doesn't require a quantum computer.
03:25crocketGeneral purpose AIs can run on low-end machines depending on needs.
03:25crocketlike my desktop
03:25TEttingerI guess general purpose and strong AI are different
03:26justin_smithin fact, I have a general purpose AI installed on my abacus
03:26Bronsa(inc justin_smith)
03:26lazybot⇒ 293
03:26skeuomorf(inc Bronsa)
03:26lazybot⇒ 122
03:26TEttingerand yeah it's going to be far more cost effective for many years to just hire people to be your "general purpose intelligence"
03:27BronsaI'll make a note to inc justin_smith more if that means more internet points for me too
03:27skeuomorfI incremented Bronsa for both, showing me the ways of lazybot and for incrementing justin_smith
04:49Guest9027709: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
04:49Guest90277h 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
04:49Guest90277 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
04:49Guest90277eu 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
04:49Guest90277offee 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
04:49Guest90277est12558 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
04:49Guest90277iei 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
04:49Guest90277n 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
04:49Guest90277ile 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-
04:49Guest90277mobius-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-
04:49Guest90277- 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
04:50Guest90277orX 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
04:50Guest90277shoky 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
04:50Guest90277cs 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
04:50the-kennyhello! :)
04:50Guest90277Sorry, slight missed keystroke on emacs ;)
04:50macoboHello again Guest90277 or should I say TheCholb
04:50macobohaving fun?
04:51ashnurhere too?
04:51justin_smithyou'd think the erc folks would make that harder to do
04:52Guest90277No, I honestly haven't been here before
04:52Guest90277And I'm not entirely sure what just happened
04:53justin_smithcommon erc problem, hitting return on the wrong line
04:53schmirrcirc ftw!
04:53Guest90277Ahh, I see
04:54Guest90277Sorry about that :)
04:55mooponly on emacs
04:55moop>miss a keystroke
04:55moop>hilight everyone on the channel
04:55moophappens everyday
04:55Guest90277haha so true
04:56Guest90277just seconds before it was an error buffer
04:57Guest90277I 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
04:57Guest90277so hi! :P
05:02TEttinger&(rand-nth ["hi, Guest90277!" "why was I highlighted?"])
05:02lazybot⇒ "hi, Guest90277!"
05:04diyfupecoTIL rand-nth
05:05wasamasaschmir: actually, if you're with point in the nicklist in rcirc and hit RET twice, it pastes the nicklist
05:06robbyoconnorGuest90277: STOP
05:09Guest90277Stop what?
05:11schmirwasamasa: yeah, right.
05:12schmircan anyone recommend using circe on emacs?
05:12wasamasayes!
05:12wasamasabut I'm biased because I sometimes contribute code to it
05:13wasamasaschmir: for the record, circe won't save you from it either because you need to enable the paste protection yourself
05:14wasamasaschmir: and its purpose is rather to prompt you whether you prefer putting that information into a pastebin
05:15schmirwasamasa: that's fine for me. I think I'm going to try it in the next few days
05:16wasamasaschmir: it tries going for ERC's look, rcirc's simplicity and sane defaults
05:16wasamasaschmir: as it isn't part of emacs, it's simple to report bugs, request features and getting code into it
05:18robbyoconnorIf you can write a client that does what irccloud does
05:18robbyoconnorand pastebin if it's x number of lines
05:18robbyoconnorpastebin sites are stupid simple to write -- if you can't do it -- you suck :P
05:33skeuomorfoh FFS
05:52RaffinateHi everyone! Is it possible to get the body of http POST request using http-kit without sending the request?
05:53RaffinateI mean, that I prepare POST request using :form-params
06:07KneivaRaffinate: You could use something like this: http://requestb.in/
06:07KneivaRaffinate: Or what's your use case?
06:07RaffinateKneiva: I need it to make hash of the body
06:08KneivaAh.
06:09RaffinateI 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. )
09:28noncomi 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?
09:33roelofwhy do I see this error messsage (cond requires an even number of forms) on this code http://lpaste.net/140207
09:35wasamasaroelof: did you forget a closing paren around the second condition?
09:37winkone ) after 100 missing I think
09:37winka lot easier to spot with proper formatting ;)
09:38sdegutisWhen you make your own defprotocol, do you prefer to use deftype or defrecord to implement it?
09:38dnolennoncom: your platform has JVM memory defaults, who knows what they are? you can supply your own memory constraints if you like.
09:38sdegutisIs this still relevant? https://chasemerick.files.wordpress.com/2011/07/choosingtypeforms2.png
09:39noncomdnolen: 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...
09:40noncomand here, a compiler that recompiles sources once in a minute, takes its constant toll of 1+ GB without even doing anything
09:40dnolennoncom: games and compilers are even remotely the same thing
09:40noncomdnolen: so, the compiler breeds many objects and keeps hold on them?
09:40dnolenI can compile WebKit or V8 and peg all my CPUs and consume gigabytes of RAM
09:41dnolennoncom: no but it doesn't really matter, it may generates tons of temporary objects, grow the heap, and at some point collect
09:42dnolennoncom: if you want more pauses but a smaller heap, set memory constraints
09:42noncomwell, 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
09:44noncomdnolen: 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
09:44roelofwasamasa: thanks, that was the culprit. But still it's not good. A lot of tests are failing
09:45noncomis 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)
09:45dnolennoncom: 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.
09:45roelofso some causes are not good
09:45noncomokay, i will!
09:46wasamasaroelof: I recommend using something like rainbow-parentheses to spot it easily or paredit to avoid it happening in the first place
09:47noncomoh, i found a tiny type in one of the namespace names and figwheel was actually warning me about this.
09:48noncomroelof: what's your case, again?
09:50noncomsdegutis: yes
09:51noncomsdegutis: 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
09:52noncomsdegutis: i actually wanted to find this picture for you, but you were faster
09:56sdegutis:)
09:56sdegutisthanks noncom
10:00roelof This case it to make a function which looks if a year is a leap-year or not
10:16sveriHi, anyone knows if there is a prismatic schema definition for hiccup?
10:31noncomsveri: never seen it... and how would you define it anyways?
10:39sveriwell, it's a vec containing a Keyword, an optional map and a string, to start with something
10:40justin_smithsveri: more than one string allowed right?
10:40justin_smithor another copy of all of the above
10:40justin_smithor N of those
10:42sverijustin_smith: exactly
10:51noncomsveri: hmmm from that it looks like you could easily define it...
11:07sverinoncom: 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:07sdegutisWhen you have a System component and you start a jetty server, how do you pass that System component to each request?
11:08justin_smithsdegutis: crate a middleware that captures the incoming component in the jetty component
11:08justin_smith*create
11:08sdegutishey what is this rust?
11:09sdegutiscrates, comeon
11:09sdegutisjustin_smith: hmm I don't understand your idea
11:09sdegutisSo where is the System component stored in the meantime?
11:09sdegutisIs it lexically captured by the middleware creation?
11:09justin_smithsdegutis: define a ring middleware inside the jetty component
11:09sdegutisAhh interesting.
11:09justin_smithright, close over the incoming component, and then provide it to each request via the middleware
11:09sdegutisI like the idea of structuring that Component recommends, but I'm using defprotocol/defrecord instead.
11:10justin_smithI don't see how that changes things here
11:11justin_smithalso the normal thing with components is to define a record type for each component
11:30sdegutisjustin_smith: phew
11:31kwladykaDo you have any idea how can i get remote work as Clojure Junior? Or with relocation in Europe?
11:31kwladykaEverybody looking Senior
11:32noncomsveri: you could start with a PR request to hiccup or prismatic..
11:32noncomkwladyka: if you're clojure, then you're senior
11:32schmirkwladyka: I'd say just try to apply for the job
11:33kwladykanoncom, heh tell it to recruiters :)
11:33kwladykaschmir, i am trying :)
11:33noncomyeah, well, actually just try
11:33noncomhave some projects to show
11:33noncomyour code will say it all
11:34kwladykabut 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:34kwladykanoncom, yes i have
11:34noncomkwladyka: you should know the definitions too. it is important not only to write the apps but also to communicate with other people
11:35kwladykaso in tech talk they put me as Junior and thats it :)
11:35kwladykanoncom, 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:36noncomthen 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:36kwladykabut i can't start work in team, because i don't know definitions
11:36kwladykado you feel my problem? :)
11:36noncomkwladyka: 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:37kwladykanoncom, 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:37noncomyes..
11:37noncomjust out of interest, what definitions exactly were these?
11:37kwladykanoncom, yes i hated it so much, learning tons of not necessary stuff, it was a nightmare
11:38kwladykanoncom, for example what is functional programming, trail recursive, difference between left join and right join in SQL etc.
11:38kwladykai can tell a lot about that but not exactly what they want to hear
11:38sdegutisWould naming your own defprotocol or defrecord System conflict with the built-in System Java namespace?
11:38kwladyka*trail = tail
11:39noncomjustin_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:39justin_smithsdegutis: no, because it is in the package of your namespace
11:39schmirare you just talking to recruiters?
11:39noncomif i do [:div (mapv f [])], i get [:div [[] [] []..]] insread of [:div [] [] [] ...]
11:39justin_smithnoncom: I'd probably use assoc-in or update-in
11:40kwladykaschmir, ?
11:40justin_smithnoncom: (into [:div] (mapv ...))
11:40noncomoh.. wow...
11:40justin_smith,(into [:div] [[][][]])
11:40clojurebot[:div [] [] []]
11:40noncomfantastic!
11:41noncomthank you very much :)
11:41sdegutisjustin_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:42noncomkwladyka: hmmm well.. i can see why they want you to answer these questions.
11:42kwladykanoncom, 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:43noncomkwladyka: 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:43kwladykanoncom, 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:44noncomwell, actually not the definition is important but your understanding of it. if you just say how you understand it, it should be enough.
11:44sdegutisjustin_smith: btw I went with your suggestion for using defmulti to pick the right configs map
11:45kwladykanoncom, 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:45kwladykanoncom, so in that way i am Clojure Junior and it is hard to find a job :)
11:46noncomkwladyka: 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:46kwladyka*trail = tail - again the same misspell :)
11:46sverikwladyka: 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:47noncomsvery: yes. sometimes the recruiters are unskilled themselves and just ask if you know the vocabulary. that's a different situation
11:47kwladykanoncom, 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:47sveriand 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:48kwladykanoncom, so i knew how to use that, but i didn't know it is exactly about stack
11:48noncomwell, i can only advice one thing: love knowledge and learn as much as you can
11:48sverinoncom: +1
11:48sverijust 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:50noncomyes. 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:50kwladykanoncom, 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:50troydmsay 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:51kwladykatroydm, http://clojuredocs.org/clojure.core/require
11:52noncomkwladyka: 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:52noncomtroydm: also, look for the pomegranate library
11:53kwladykanoncom, 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:54noncomkwladyka: 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:55kwladykanoncom, 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:55noncomkwladyka: 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:56kwladykanoncom, 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:57noncomkwladyka: okay, i got it, you're more of a practitioner... well, maybe there'll be a luckier interview
11:57noncomi don't think clojure is any harder than java
11:57noncomprobably even on contrary
11:57kwladykanoncom, me too, but from Clojure programmer they expect to be a Senior during tech talk :)
11:57kwladykajust what i see
11:57noncomah
11:57noncomwell, then java junior could be a good bet
11:58sverikwladyka: especially as the market is really good for java programmers right now, at least here in germany
11:59troydmnoncom: where does lein save the dependencies for project by default?
11:59kwladykaand 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:59troydmnoncom: I mean location of jar files
12:00kwladykatroydm, target/uberjar
12:00chomwittin 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:00schmirtroydm: ~/.m2
12:00sverikwladyka: how often did you get rejected?
12:01troydmschmir: aha, so it's just using maven for that
12:01schmiryes
12:02kwladykasveri, 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:02troydmschmir: 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:04sverikwladyka: 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:04kwladykajust 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:05kwladykasveri, but on tech talk with technical man who is programmer not manager it is hard to talking about business :)
12:06kwladykai pass the talk about presentation myself, i pass the code test, but tech talk is weak :)
12:07schmirtroydm: lein-try is a bit like
12:07kwladykaanyway 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:07schmirtroydm: or take a look at vinyasa
12:07sverikwladyka: true, I agree
12:08schmirtroydm: https://github.com/zcaudate/vinyasa#lein
12:08schmirtroydm: or use boot scripts
12:09schmirtroydm: https://github.com/zcaudate/vinyasa#pull for pulling in deps at runtime
12:09schmirtroydm: https://github.com/boot-clj/boot/wiki/Scripts
12:11troydmschmir: I think lein-try is just what I really needed, thx
12:30mavbozoi miss you people
12:30AeroNotixwhat do you mean "you people"?
12:31mavbozoAeroNotix, I mean everyone in this #clojure channel
12:39arrdemon behalf of the other more silent lurkers we're glad to be missed
13:11roelofwhy 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:11j-pbroelof: clojure is prefix
13:11hiredmanbecause (a b c) invokes a as a function
13:11j-pb(+ x1 x2)
13:11hiredmanso (x + x) invokes x as a function
13:12roelofThanks, I have to be more familair with the prefix notation
13:14hiredmanthe only difference with say C function call notation is where the parens are
13:14hiredmanf(a,b)
13:14hiredman(f a, b) ;; valid clojure but generally comas aren't used there
13:16hiredmanthe real difference is in many languages + is not a function, so you use it differently
13:19roelofanother question. I do these exercises. Can I tell midje to test only 1 function ?
13:22hiredmanno idea, I don't use midje
13:22hiredman(and I wish others wouldn't either)
13:23roelofhiredman: what is then a better test suite ?
13:24hiredmanclojure.test
13:25roelofhiredman: oke and what is that better then midje ?
13:26hiredmanit is a very simple library and it comes with clojure
13:26hiredmanmidje has in the past suffered badly from sort of "worlds collide" kinds of issues
13:27hiredmanit was created in the mode of some ruby testing frameworks, but ruby is not clojure
13:28Bronsamidje does awful side-effects during macroexpansion, I don't like it.
13:29Bronsahttps://github.com/clojure/clojure/commit/722e023ea00b27a47b11afc29fa7fe0a282696f4 finally
13:30roelofBronsa: so also you use clojure.test ?
13:30Bronsayes
13:30hiredmanclojure.test gives you the ability to create tests, make assertions in those tests, and run the tests
13:31Bronsaclojure.test does all I need and nothing more
13:31hiredmanexactly
13:31Bronsawhich is, running tests and reporting on failure
13:34roelofoke, thanks and have a good evening
13:42sveriroelof: +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:44roelofoke, I have to use midje at this point. The course is using it
13:44luxbockI went through expectations, speclj and midje, and in the end I just use clojure.test as well
13:45sveriThe only thing I add some time is test.check :-)
13:57RurikFileNotFoundException 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:57Rurikgetting this error, what does this mean?
13:58oddcullywrote `as` instead of `:as`?
13:58Rurikahh, gotcha
14:01justin_smithonce again, bitten by the bizarreness that is permgen heap separation (forgot to bump up permgen space for coworkers still using 1.7)
14:02justin_smithwhen your max heap is 4g, and your app dies with out of memory while using 1.7g, that's probably permgen
14:02justin_smiththis is also an argument for reading stack traces more closely
14:03Bronsajustin_smith: wasn't permgen removed from recent jdks?
14:03justin_smithBronsa: yeah, like I said, this is for coworkers using 1.7
14:03Bronsaah
14:03BronsaI thought you were talking about the clojure version
14:03justin_smithwhich is why I forgot it was an issue
14:04justin_smithBronsa: I am ashamed that I could get this baffled by the same bug twice in my career
14:04justin_smithlol
14:29sdegutisClojure's dynamic stuff is pretty cool. CIDER-nREPL would be impossible in Haskell.
14:29sdegutisThat kind of instant feedback is great.
14:30Hrorekcan anyone explain how reify works?
14:33Empperiit takes a java interface or clojure protocol and creates an object which implements that
14:33Empperiunder the hood it uses java proxy mechanism to do it's trick
14:33Empperihttp://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Proxy.html
14:34HrorekEmpperi, can you give an example?
14:34Empperihow about this? https://clojuredocs.org/clojure.core/reify
14:34Empperithere's several examples there
14:36HrorekEmpperi, I don't understand them
14:36HrorekWhy did you need to use str at first
14:36justin_smithHrorek: what are you trying to do?
14:37Hroreknothing, just trying to understand
14:37justin_smithHrorek: the example uses str because it is reifying the toString method, which str calls
14:39noogaI 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:39justin_smiththe 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:39noogahow do I express something like fat ring handler in the component system?
14:39justin_smithnooga: then pass in those components so that app can use them?
14:40Hrorekjustin_smith, can you explain the example line-by-line?
14:40noogabut app is just a value (def app (routes ... blah))
14:40justin_smithnooga: 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:40justin_smithnooga: then make it so it's not that any more
14:40sdegutisnooga: why are you using using compojure btw
14:40justin_smithmake a function that returns app, and takes components as an argument
14:40sdegutisnooga: why not bidi or silk?
14:41noogasdegutis: It's old, maybe it's time to switch here as well
14:41noogajustin_smith: I see
14:42noogawell... not really
14:42noogais there any example I could look at?
14:45justin_smithnooga: I wonder, sadly my app is not open source
14:46noogaI 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:47noogabut, for instance, route handlers are not called by me, they're called by something else
14:47noogahow will they know the value of db component for example?
14:47justin_smithnooga: right, but you can make a middleware that provides data to the app route handlers whenthey are called
14:48justin_smithand that data can include your components
14:48noogaoh
14:48noogasmart
14:48justin_smith(defn wrap-component [handler] (fn [request] (handler (assoc request :components {:some components :go here}))))
14:49justin_smiththen you can write your endpoints so they can look up the component stuff in the request under the :components key
14:49noogayup, got it
14:49noogathanks!
14:49justin_smithnp
14:50justin_smithnooga: 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:50justin_smithso a db might provide a wrap-db middleware as part of the map it returns
14:50Rurikjustin_smith, in the first example why did we have to use reify, why not do (str "foo") directly
14:50justin_smiththis is useful if you have components in multiple apps that would want to use a db in the same way
14:51justin_smithRurik: because that wouldn't demonstrate reify
14:51justin_smithRurik: in the real world, you have some server written in java that wants an object and the server calls str
14:51justin_smithor it calls frob
14:51justin_smithand you need to provide something that does the thing you want when str or frob is called
14:52justin_smithRurik: str is picked in the example because toString is a well known method, and easy to demonstrate fully
14:52Rurikaha, so we made f an Object and passed it to str
14:53justin_smithright
14:53justin_smithand f can do whatever it wants when you call str
14:53justin_smithbased on it's toString method
14:53Rurikand in the next example we made f into a Seqable
14:53noogajustin_smith: thanks alot, I'll fiddle with that
14:53justin_smithRurik: exactly
14:54Rurikjustin_smith, but I don't get the third example
14:54justin_smithRurik: you'll need to learn about metadata to get that one
14:55justin_smithRurik: clojure objects are special, one way they are different from other objects is you can attach metadata maps to them
14:55justin_smithRurik: the example demonstrates that you can attach metadata to a thing made via reify
14:55justin_smith,(meta ^{:k :v} [])
14:55clojurebot{:k :v}
14:55justin_smith,(meta ^{:k :v} "")
14:55clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Metadata can only be applied to IMetas>
14:56justin_smithRurik: that worked with [] and not "" because [] is a special clojure object, and "" is not
14:56sdegutisIs there a more efficient way of doing this?
14:56sdegutis,(apply list "foo")
14:56clojurebot(\f \o \o)
14:56justin_smithsdegutis: seq "foo"
14:56sdegutisAhhh nice one justin_smith.
14:56sdegutisPrefect.
14:56justin_smithbbl lunch
14:56justin_smithsdegutis: remember there are a lot of things that implicitly call seq too
14:57kavkazDo you guys think group-by can be implemented so it could work with (range)?
14:57sdegutisTrue
14:57justin_smithlike all the collection functions (filter, map, reduce...)
14:57sdegutiskavkaz: why not?
14:57justin_smithsdegutis: it would need to be groups-bys so it could lazily return each update
14:57justin_smithsdegutis: or you would need a lot more ram
14:58kavkazMy 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:58Rurikjustin_smith, gotcha
14:59kavkazI've made them but I've never worked with maps I guess...
14:59kavkazWell, worked with maps in that specific way
15:01Rurikjustin_smith, what is `this` (don't know Java at all)
15:04kavkazRurik: it's the reference an instantiateable class uses to reference itself
15:05kavkazRurik: so if it has an attribute (member) a method within that class could reference this.someMember
15:05Rurikkavkaz, like `self` in python?
15:05kavkazinstantiable*
15:05kavkazRurik: I think so, never used Object Oriented programming in python
15:06kavkazBut I'm guessing yes
15:06oddcullyRurik: yes
15:06kavkazRurik: yes i just looked it up
15:09sdegutisIs it ever appropriate to use metadata in the context of an API as opposed to language-building macros?
15:14Empperiyes it is
15:15Empperijust look at prismatic schema for example
15:27amalloyEmpperi: reify doesn't use java's proxy mechanism at all, actually. proxy does (unsurprisingly), but not reify
15:27amalloyyou 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:36sdegutisI'm having difficulty figuring out how to model an immutable lexer.
15:36sdegutisI suppose it could probably be done with (reduce) and an initially empty output-bucket right?
15:44gfrederickssdegutis: sounds reasonable
15:45gfrederickssdegutis: I once wrote a lazy immutable brainfuck interpreter that was similarly structured
15:45gfredericksspeaking of which you could do it lazily too if you wanted I expect
15:45gfredericks(not using reduce)
15:45gfredericksbut maybe reduce is cooler than laziness in these modern times
15:46gfredericksbut arguably for the interpreter laziness is good because it allows for infinite programs
15:46gfredericksor streaming/repl/whatever
15:52amalloysdegutis: 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:53sdegutisgfredericks: isn't reduce lazy now too with transducers?
15:54sdegutisamalloy: kind of yeah, but it's not always 1-to-1 mapping from character to token
15:54sdegutisThat's why I wanted (vec "foo") earlier, to which justin_smith replied with (seq "foo") and I was like "whoa"
15:55gfrederickssdegutis: 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:55gfrederickssdegutis: that's why he said "remainder-string", not "the original string minus exactly one character"
15:56gfredericks(last msg was in response to your amalloy thing)
15:57sdegutisah
16:05amalloyyeah if there were a 1-to-1 mapping between input character and outpot token, every lexer could just be a hashmap lookup
16:05justin_smithRurik: 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:06Rurikah, gotcha
16:06Rurikmaybe that is why it was so hard to understand for me
16:08justin_smithRurik: 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:09Rurikhaha
16:09Rurikjustin_smith, any reasons for this design?
16:09justin_smithbecause different classes might have different funcitonality in mind when assigning a method name
16:10Rurikgotcha
16:10justin_smithtrivial example being things like "roll" that can be a verb or a noun
16:10justin_smithbut 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:11RurikHmmn
16:11RurikSo roll might mean to spin for a wheel or a cylinder
16:12Rurikbut roll into a 'cylinder' for a sheet of foil or a carpet
16:12justin_smithsure, yeah
16:12Rurikdoes that makes sense?
16:12justin_smithyeah, I think that's the general idea
16:13wombawombahow can I tell if two classes are comparable?
16:13Rurikjustin_smith, but if the idea is so good why doesn't Python/some other language implement it?
16:13justin_smithwombawomba: if the first arg has a version of the compareTo method defined for the second?
16:14justin_smithRurik: it's not uncontroversial - different languages take different approaches, some prefer duck typing, some prefer explicit interfaces or typeclasses
16:16justin_smithThere's another variant called structural typing too
16:16wombawombajustin_smith: hmm, alright. How do I tell if that's the case, though?
16:17justin_smithwombawomba: what are you trying to do?
16:19wombawombajustin_smith: I'm trying to make this less fragile https://github.com/venantius/ultra/blob/master/src/ultra/test/diff.clj#L50-L61
16:21wombawombait's supposed to give helpful information for test errors, but it breaks on e.g. (is (= 3 4L))
16:22justin_smithahh - so if things might be comparable you could say too high or too low or something?
16:22wombawombaright
16:23justin_smithwombawomba: 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:23justin_smithwombawomba: clojure.reflect is a little confusing, but it can get at this kind of data.
16:23wombawombacool, I'll have a look at it
16:23wombawombathanks :)
16:25justin_smithRurik: 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:26justin_smithor, we have the same drawback that duck typing does, but without the advantages
16:35sdegutisDo you have a mnemonic to know whether case or cond is the one that uses truthy values like :else?
16:35sdegutisAs the else-clause).
16:35justin_smithsdegutis: I remember case as being the one that is no-nonsense
16:36justin_smithsdegutis: eg. the tests must be literals
16:36sdegutisHow tho?
16:36justin_smithsdegutis: the way I remember that is that C has a case but no cond, and C is not a big language for nonsense
16:36sdegutisI bet Clojure 1.1 must have sucked.
16:36justin_smith(in the way I am using the term "nonsense" here)
16:36sdegutisjustin_smith: oh nice!
16:36sdegutisI'll use that.
16:37justin_smithwhereas cond comes from lisps - it's more lispy in flavor
16:37sdegutisAnd to remember C, I just have to memorize "C is for Clojure"
16:37justin_smithhahahah I don't know if this actually helps at all
16:38justin_smithC has a case and it doesn't do things like args marked by keywords, or case tests that are not compile time literals
16:40Rurikjustin_smith, what are the ways in which Clojure differs in a major way from other lisps?
16:40sdegutisjustin_smith: Ruby has a very fancy case/when also tho.
16:41sdegutisjustin_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:41sdegutis:(
16:41sdegutisRurik: mainly by preferring manipulating seqs to recursion
16:42sdegutisRurik: 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:52justin_smithsdegutis: 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:52sdegutis:D
16:52sdegutisprevious lisper eh?
16:52sdegutisI came from Ruby :'(
16:52justin_smithcommon lisp, scheme, lush
16:52justin_smithby the time I started using Clojure I was an OCaml programmer mainly
16:53justin_smithI still miss OCaml when our types get all shitty in our app at work
16:53justin_smithcan't convince people at work to use prismatic/schema, with a strongly typed language they wouldn't have the choice
16:55sdegutisYeah I do miss having type safety as well as type-safe enums or whatever they're called.
16:55sdegutisI've been using keywords for function status return results, which often look like [db :ok] or whatever.
16:59amalloysdegutis: the way to remember which of case/cond uses :else is to think about it: :else couldn't possibly work for case
17:00amalloybecause the clause isn't tested for truthiness, but rather compared to the value you are casing
17:00sdegutisamalloy: oh right, it could be a valid value!
17:00gfredericks(inc amalloy)
17:00lazybot⇒ 297
17:00gfredericks,(* 27 11)
17:00clojurebot297
17:00amalloygfredericks: you are terrible at finding prime factors
17:07gfredericksamalloy: I was doing something related but different
17:07gfredericksfinding prime-power factors
17:11sdegutisgfredericks: wow nice on that one
17:13sdegutisCrap.
17:13sdegutisI forgot how to design a lexer/parser.
17:17gfredericksfun fact: there's an efficient algorithm for determining if a number is a prime power
17:17m1dnight_does it have a name? (hello everyone, btw)
17:18m1dnight_I was looking for some "hard" numbers of clojure adoption in the industry, anyone got something I can use?
17:24justin_smithgfredericks: did you hear, Clojure PDX (nee Clojerks) is doing a test.check workshop tonight?
17:24m1dnight_http://cognitect.com/clojure#successstories will be fine as well :>
17:30amalloygfredericks: that sounds like something i must have learned and then forgotten in number theory
17:33sdegutism1dnight_: 7
17:33sdegutisThere is 7 Clojure adoption in the industry.
17:34justin_smith(inc sdegutis)
17:34lazybot⇒ 7
17:34justin_smithROFLMAO
17:34sdegutisWhoa what a coincidence.
17:34sdegutis:D
17:34skeuomorflol
17:37sdegutisHmm.
17:37sdegutisTurns out recursion is actually probably better for this lexer than reduce.
17:38sdegutisLets me have more control over how many characters to consume per call.
17:38kwladykahttp://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:38justin_smithkwladyka: did you require clojure.set? are you qualifying the name properly?
17:38kwladykaoh i see
17:38kwladykai have to use clojure.set
17:39kwladykabut in example is nothing about that
17:39justin_smithindeed - many examples are crappy in that they assume you ran (use 'some.random.lib)
17:40kwladykais if my first example where it is missed
17:40kwladyka*it is
17:40kwladykawhat a misspell... it can sound like it is time to sleep :)
17:41justin_smith,(iterate compare 0)
17:41clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/compare>
17:41justin_smitherr, never mind
17:41justin_smithwhy do I keep expecting iterate to be like reduce...
17:42gfredericksjustin_smith: I did not hear that
17:42sdegutisjustin_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:42sdegutisjustin_smith: I mean in the context of docs/examples
17:43justin_smithsdegutis: many examples assume you use more than one lib, and don't make clear what came from where
17:43gfredericksamalloy: factorization is normally formalized as n -> p1^k1 * p2^k2 * p3^k3 * ... * pn^kn
17:43sdegutisahh
17:43sdegutisthat sukcs
17:43gfredericksamalloy: i.e., it's a collection of powers of primes
17:43justin_smithgfredericks: http://www.meetup.com/clojure-pdx/events/224522942/
17:43sdegutis,(let [[a b] []] [a b])
17:43clojurebot[nil nil]
17:43sdegutisphew
17:43gfredericksjustin_smith: oh yeah I saw that a while ago
17:43amalloygfredericks: i was teasing. i was pretty sure you knew 27 wasn't prime
17:44gfredericksamalloy: I know I just can't stop myself from discussing number theory at every minor opportunity
17:44kwladykajustin_smith, but to be honest it is in doc but not super clear when you see situation like that first time
17:44kwladykahttp://clojuredocs.org/clojure.set/difference right top corner clojure.set
17:44kwladykaand on main page http://clojure.org/cheatsheet
17:44kwladykabut as a habit i am looking only on examples :)
18:05sdegutisCrap.
18:05sdegutisApparently (comp) is not friendly to var changes.
18:06justin_smithnor are juxt or partial, they aren't really things to use if you expect the functions they are using to be redefined
18:06sdegutis,(do (def a 1) (let [f (comp a)] (binding [a (constantly 2)] (f))))
18:06clojurebot#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:06sdegutis,(do (def a 1) (let [f (comp a)] (with-redefs [a (constantly 2)] (f))))
18:06clojurebot#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:06sdegutisclojurebot: screw you
18:06clojurebotNo entiendo
18:06sdegutisjustin_smith: fair point
18:07justin_smith,(do (def a 1) (let [f (comp a)] (with-redefs [a (constantly 2)] f)))
18:07clojurebot1
18:07justin_smith,(do (def a 1) (let [f (comp #'a)] (with-redefs [a (constantly 2)] f)))
18:07clojurebot#'sandbox/a
18:07justin_smith,(do (def a 1) (let [f (comp #'a)] (with-redefs [a (constantly 2)] @f)))
18:07clojurebot#object[clojure.core$constantly$fn__4371 0x430c042d "clojure.core$constantly$fn__4371@430c042d"]
18:08justin_smith,(do (def a 1) (let [f (comp #'a)] (with-redefs [a (constantly 2)] (f))))
18:08clojurebot2
18:09sdegutishahaha, (= \/ a b) ;; begin comment
18:09sdegutisweird emoticon thing
18:10sdegutisjustin_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:10justin_smithsdegutis: yeah, late binding is relatively tricky in clojure, but look at the bright side, we could have the insanity that is elisp
18:11sdegutis:D
18:11sdegutisyes, elisp does suck very much.
18:18justin_smithpoint being that elisp does late binding very very well, to the point of craziness
18:33wasamasawhat do you mean, using (let ((last-command this-command)) ...) to make a test pass can impossibly be crazy!
19:11rhg1350.o
19:47sdegutisjustin_smith: makes sense, given its meant to be edited live
20:29sdegutisHow do you specify "anything" in Instaparse?
20:30sdegutisMeaning, anything that isn't one of the following acceptable rules in the grammar after this "Anything" rule?
20:33amalloysdegutis: that is kinda a dangerous thing to do. how many characters should "anything" consume?
20:33amalloythe entire rest of the file?
20:33sdegutisSure, as many as needed until an acceptable following-rule is found.
20:35amalloywell, 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:35amalloyeg foo is one token, not the three tokens f o o
20:36amalloyyou 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:37sdegutisHmm.
20:37sdegutisok
21:08sdegutisamalloy: thanks, took your advice
21:26SeyleriusAre there any clojure doc sites that expose an easy URL for building a conkeror webjump around?
22:36SeyleriusIs there an opensearch for clojure cheatsheet?