#clojure log - Nov 10 2014

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

0:00 justin_smith: stapler: lein is not as reliable on windows as osx/linux, but it does work

0:00 depending on what you mean by "in a box"

0:01 and any reputable clojure in a box would probably need to be using lein anyway - at least 90% of the clojure ecosystem pretty much takes lein for granted

0:05 stapler: that clojure-box project uses pretty outdated stuff, and does not include lein

0:06 TEttinger: leiningen installer for windows should be enough

0:06 ^ stapler

0:06 justin_smith: yeah

0:06 that clojure-box thing hasn't been updated in years, and ships with slime and swank

0:08 rritoch: TEttinger: Does such a thing exist?

0:08 justin_smith: http://leiningen-win-installer.djpowell.net/

0:09 I wonder what lein version that is though - installer version is 1.0

0:09 TEttinger: (inc justin_smith)

0:09 lazybot: ⇒ 126

0:09 rritoch: I think it would also be helpful if lein could autogenerate a .exe, .bat, and .sh for simpler windows deployment of clojure apps.

0:10 seancorfield: I use lein on win from that installer. It's 2.something but I don't remember what

0:10 justin_smith: rritoch: nobody on the leiningen dev team uses windows natively

0:10 TEttinger: rritoch, there is a .bat generator but it won't work well on client computers (it requires java to be on the path)

0:10 justin_smith: seancorfield: well any 2.x can update, so that should be fine

0:10 TEttinger: I wonder what it takes to make a lein plugin

0:10 seancorfield: Not many Clojure folks use windows period

0:10 justin_smith: self-update that is

0:10 seancorfield: exactly

0:10 TEttinger: seancorfield, I do

0:10 seancorfield: Lein plugins are easy

0:11 I wrote one to compile Frege code the other night

0:11 stapler: so uh

0:11 what should i do here

0:12 justin_smith: stapler: use that leiningen isntaller I linked

0:12 lein is the thing

0:13 http://leiningen-win-installer.djpowell.net/

0:13 stapler: justin_smith: java se 7u71, right?

0:13 rritoch: justing_smith: Well, even for posix deployment, most users of posix systems if they download a leiningen app will be expecting a Makefile, or auto-conf scripts.

0:13 justin_smith: stapler: lein is the standard clojure dependency manager / dev launcher, it can handle everything else except your editor etc.

0:13 stapler: any java 1.5+ is fine

0:14 rritoch: all you need is a jar, if anything it's windows that is more complicated

0:14 I mean I guess a launcher script is nice to have

0:14 rritoch: I never run lein, I use it locally to package up

0:15 *never run it on the client machine, that is

0:20 TEttinger: seancorfield: is there a skeleton plugin you used?

0:20 or an existing lein template?

0:20 I might try to make a plugin for Packr tonight

0:21 justin_smith: TEttinger: lein new plugin foo

0:22 there is a plugin template

0:22 TEttinger: nice!

0:22 justin_smith: I really wish that templates were easier to search for, and could be explicitly versioned

0:46 TEttinger: so the plugin I have in mind is a simple wrapper around a kinda-complex executable jar, https://github.com/libgdx/packr

0:46 where would it be considered kosher, if anywhere, to place downloaded JREs so they can be reused by the plugin?

0:47 justin_smith: hmm

0:47 under .lein/ ? or is that invasive

0:47 TEttinger: I mean you could just get them yourself and pass a path

0:47 but it's another step

0:48 justin_smith: TEttinger: under .m2/ would mean people would actually expect big cached things to be there, but would also be weird

0:49 TEttinger: I could distribute them with the plugin, which would mean ~250 mb plugin downloads

0:49 justin_smith: TEttinger: what about downloading at build time, unless config specifies a specific location?

0:50 and then downloading to a cached location, ideally

0:50 getting 3 jvms downloaded because I added a plugin to my deps seems weird

0:53 pdk: what's wrong with that

0:53 3 times the enterprise

0:56 seancorfield: TEttinger: for the Frege plugin I mostly borrowed from the javac plugin. I think you can do: lein new plugin myname

0:56 That will get you started

0:57 Ah justin_smith got you that already. Sorry I was on the train.

1:02 TEttinger: justin_smith, yeah but where to cache...

1:03 justin_smith: ~/.[plugin name]-cache/ maybe?

1:03 clojurebot: excusez-moi

1:04 TEttinger: ~/.lein-packr/cache , perhaps?

1:04 clojurebot: I don't understand.

1:06 justin_smith: TEttinger: if the only thing that dir does is act as a cache, I think it communicates to the user more clearly if cache is in the top level dir name

1:07 TEttinger: but either would work, for sure

1:07 TEttinger: good point

1:27 arrdem: http://stackoverflow.com/questions/26837655/conditional-threading-through-expressions

1:28 my gut is (as-> .. .. (cond->) (cond->)). better ideas?

1:28 since my own update-when isn't in core :P

1:28 TEttinger: I can't believe I've never run into this yet -- is there a clojure standard lib fn for downloading a file?

1:28 justin_smith: don't they just want cond?

1:29 arrdem: justin_smith: issue is it's to sequential conditional updates

1:29 justin_smith: TEttinger: clj-http is already in lein

1:29 arrdem: justin_smith: where the predicates are over the value to be updated

1:29 justin_smith: arrdem: ahh, yeah

1:29 arrdem: TEttinger: the JVM will let you slurp a URL :P

1:29 justin_smith: arrdem: slurp is not so great for binaries

1:30 arrdem: justin_smith: there are other URL readers I think..

1:30 * arrdem no java wizard

1:30 justin_smith: arrdem: slurp uses reader, which is for text, you want input-stream for binary data

1:31 luther07: /leave

1:32 justin_smith: TEttinger: something I did today, it was in my repl history - (def dat (client/get "http://download.opensuse.org/update/11.3/rpm/i586/glibc-2.11.2-3.3.1.i586.rpm" {:as :byte-array}))

1:32 then you can write the byte array, though there is probably a way to put it straight into a file directly

1:33 where client is clj-http.client, which, if you are in a lein process, is already loaded

1:35 arrdem: I have a better answer for this :P

1:35 https://github.com/arrdem/detritus/blob/master/src/detritus/update.clj#L73

1:36 justin_smith: TEttinger: probably better to use {:as :stream}, and use that in an arg to a file writer actually

1:36 TEttinger: neat

1:37 what namespace is client there, justin_smith?

1:37 justin_smith: clj-http.client

1:37 I thought I said that?

1:38 TEttinger: oh yes

1:38 haha

1:43 http://stackoverflow.com/a/11321748 seems to be the trick

1:44 justin_smith: it seems like :as :stream would be more straightforward though...

1:44 I mean the rest could stay the same I think

1:45 I was doing what I did because I wanted to base64 encode the file

1:45 for stupid reasons

1:46 TEttinger: hm, that answer does seem like it ignores :as :stream

1:46 do I just call .write on the stream or what?

1:46 justin_smith: TEttinger: yeah, .write on the file, with stream as the arg

1:46 should work

1:49 TEttinger: never mind, just use the :bytes

1:49 I was wrong

1:49 TEttinger: ?

1:49 what's wrong with stream?

1:50 justin_smith: no matching method found every time I try it

1:55 yeah, I looked for other options, :bytes is actually the best bet

2:02 TEttinger: hm, is it reasonable for one plugin to call the uberjar plugin that's built in?

2:02 I mean, it might not stay built in?

2:19 godd2: You guys, I figured out a solution to the problem of mutable output: http://i.imgur.com/iOpg64z.png

2:19 justin_smith: heh

2:20 godd2: if time is first class, output is not mutable

2:21 godd2: Einstein was on to something...

2:27 TEttinger: odd. is there any way to change uberjars from having :uberjar-name suffixed with -standalone ?

2:27 https://github.com/technomancy/leiningen/blob/master/src/leiningen/jar.clj#L210-L216

2:27 I'm trying to get the exact name of the uberjar and :uberjar-name won't be it

2:34 godd2: TEttinger did you try with-profile? http://stackoverflow.com/questions/19334454/create-multiple-uberjars-in-leiningen

2:35 (dunno if that works, but looks promising)

2:37 TEttinger: godd2, good catch, but reading the code, it looks like that would generate "uberjar1.jar-0.1.0-standalone.jar"

2:38 https://github.com/technomancy/leiningen/blob/master/src/leiningen/uberjar.clj#L138 always passes :standalone

2:38 I could be missing something here

2:40 godd2: TEttinger I dont think you're missing anything. Looks like it just does that for uberjars: https://github.com/technomancy/leiningen/blob/master/src/leiningen/jar.clj#L275

2:41 TEttinger: I wonder if I could use uberjar itself, the fn returns the name of the generated standalone jar

3:50 so #clojure, what is the best way to initialize a crummy java class with all public fields but no constructor other than the default? https://github.com/libgdx/packr/blob/master/src/main/java/com/badlogicgames/packr/Packr.java#L55-L65

3:50 something like doto ?

3:50 doto and just set! ing each field?

3:53 dc_: TEttinger: deftype? i'm sure you know better than me

3:54 TEttinger: it just seems like doto and set! seems so lousy

3:58 Glenjamin: maybe there's something in http://clojure.github.io/java.data/ ?

3:58 the docs seem pretty bad

4:10 amalloy: TEttinger: you can at least write a macro that converts (init (Packr.) x 1, y 2) to (doto (Packr.) (set! x 1) (set! y 2))

4:11 TEttinger: yeah, I should really learn how to write macros

4:11 been saying that for about 2 years

4:12 ah, here's something interesting. how can a normal clojure package be converted to the format java expects in manifests? config.mainClass = "com/my/app/MainClass";

4:13 I'm getting the package from leiningen's :main

4:14 which is something like com.my.class.desktop-launcher , and Manifest.MF has com/my/class/desktop_launcher

4:15 is this a simple regex, or is it weirder?

4:28 is there a list somewhere of valid characters for clojure namespaces, and what they map to in the .class files they generate?

4:29 could i have (ns !!!)

4:34 amalloy: any ideas for this namespace thing?

4:46 ,(clojure.lang.Compiler/munge "com.my.class.desktop-launcher")

4:47 clojurebot: "com.my.class.desktop_launcher"

4:47 TEttinger: ,(clojure.lang.Compiler/demunge "com.my.class.desktop-launcher")

4:47 clojurebot: "com.my.class.desktop-launcher"

4:50 TEttinger: ,(clojure.lang.Compiler/demunge "!!!")

4:50 clojurebot: "!!!"

4:50 TEttinger: ,(clojure.lang.Compiler/munge "!!!")

4:50 clojurebot: "_BANG__BANG__BANG_"

4:53 TEttinger: ,(clojure.lang.Compiler/munge "com/my/Desktop_Launcher")

4:53 clojurebot: "com_SLASH_my_SLASH_Desktop_Launcher"

4:53 TEttinger: hm

4:54 hyPiRion: ,(clojure.lang.Compiler/demunge (clojure.lang.Compiler/munge "!!!"))

4:54 clojurebot: "!!!"

4:55 TEttinger: hyPiRion, do you have any ideas for this?

4:55 converting a class with the syntax namespaces use in clojure, to a Main Class for a Manifest.MF

4:57 hyPiRion: ,((comp #(.replace % \. \/) munge) "com.my.class.desktop-launcher") or something

4:57 clojurebot: "com/my/class/desktop_launcher"

4:58 hyPiRion: But I don't think there's anything built in

4:59 TEttinger: (inc hyPiRion)

4:59 lazybot: ⇒ 54

4:59 TEttinger: (inc hyPiRion a thousand times)

4:59 lazybot: ⇒ 1

5:00 hyPiRion: (identity hyPiRion a thousand times)

5:00 lazybot: hyPiRion a thousand times has karma 1.

5:23 zot: is there a better way to convert a flattened map-sih thing than this? (into {} (map vec (partition 2 [:a 1 :b 2]))) the (map vec) step feels … odd.

5:23 kungi: zot: there is mapv for that

5:24 zot: but this is the wrong answer

5:24 clgv: zot: you dont need (map vec ...) in there. just the `partition` expression suffices

5:24 kungi: ,(into {} (partition [:a 1 :b 2]))

5:25 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/partition>

5:25 zot: not in my repl :/

5:25 clgv: ,(into {} (partition 2 (range 8)))

5:25 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Map$Entry>

5:25 clgv: oh interesting

5:25 zot: ,(into {} (partition 2 [:a 1 :b 2]))

5:25 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry>

5:25 Glenjamin: ,(partition 2 [:a 1 :b 2])

5:25 clojurebot: ((:a 1) (:b 2))

5:25 zot: sorry for the dup

5:25 Glenjamin: what, why doesn't that work

5:26 hyPiRion: zot: ##(apply hash-map [:a 1 :b 2])

5:26 lazybot: ⇒ {:b 2, :a 1}

5:26 hyPiRion: a Clojure list isn't a clojure map entry, whereas a vector is. (Don't ask me why that is)

5:27 zot: hyPiRion: that's definitely an improvement.

5:27 yeah, that's what i found odd

5:27 kungi: hyPiRion: Maybe because it is missing random access?

5:27 zot: maybe it doesn't want to call (count)

5:27 to confirm the length?

5:28 hyPiRion: zot: Yeah, that may be it.

5:30 clgv: ,(-> [] class ancestors)

5:30 clojurebot: #{java.lang.Runnable clojure.lang.Indexed clojure.lang.IEditableCollection clojure.lang.APersistentVector clojure.lang.IPersistentVector ...}

5:30 zot: although, it feels like converting via (take 2) doesn't cost that much… but i'd be curious

5:30 clgv: &(-> [] class ancestors)

5:30 lazybot: ⇒ #{java.io.Serializable clojure.lang.ILookup clojure.lang.APersistentVector clojure.lang.IPersistentCollection clojure.lang.IFn clojure.lang.Indexed java.util.RandomAccess clojure.lang.Seqable clojure.lang.IEditableCollection java.lang.Iterable java.util.List java.uti... https://www.refheap.com/93032

5:31 clgv: so well a vector isnt a map entry ... ;)

5:31 hyPiRion: zot: Oh right, I remember now

5:31 ,(seq {:a 1 :b 2})

5:31 clojurebot: ([:b 2] [:a 1])

5:31 hyPiRion: ,(conj {} (seq {:a 1 :b 2}))

5:31 clojurebot: {:a 1, :b 2}

5:32 hyPiRion: it's a very strange quirk with Clojure itself I don't fully understand.

5:32 zot: i don't follow what your example demonstrates

5:32 clgv: ,(mapv class {:a 1 :b 2})

5:32 clojurebot: [clojure.lang.MapEntry clojure.lang.MapEntry]

5:33 hyPiRion: ,(into {} [{:a 1 :b 2} {:c 3 :d 4}])

5:33 clojurebot: {:b 2, :a 1, :c 3, :d 4}

5:33 hyPiRion: ,(into {} [(seq {:a 1 :b 2}) (seq {:c 3 :d 4})])

5:33 clojurebot: {:b 2, :a 1, :c 3, :d 4}

5:41 zot: unexpected and interesting.

5:41 into does more than i knew

6:10 eiffel: 19:09 *** NAMES @ChanServ [Neurotic] _5kg _ato _jimrthy `brian acagle actionshrimp adammh addisonj Adeon AdmiralBumbleBee Adr1 AeroNotix agumonkey ahihi aiba aiba_ aka akhudek akkad akl aksatac akurilin alanpearce AlephBeth alexbaranosky alexherbo2 algernon Alina-malina alloyed alxlit amalloy amano- ambrosebs amoe amontalenti ananna ananthakumaran andrewlio andrewstewart andreypopp_ andyf anekos_ annapawlicka aperio

6:10 dic apetresc arekinath arenz arkh_ arnihr_ arrdem asabil asaleh aspotashev_ audaxion auganov augustl avdi averell avidal AWizzArd awwaiid babilen bbloom bcarrell beawesomeinstead ben_vulpes bencryption bengillies beppu bgianf bigkevmcd Bird|otherbox bitpimp bjeanes bjornmagnus bkearns Blkt bmuk bobwilliams bodie_ boodle bool_ borkdude boyscared bra brackets bracki brainproxy brianwong brixen broquaint bru bruceadams

6:10 bsansouci bwreilly byaruhaf canassa cannedprimates__ cantsin carc carlosgaldino cataska catern cdombroski certainty cespare cfleming charliekilo Chasm chenglou cherwin ChiralSym choas ChongLi chouser_1og Chousuke chrisrossi chriswk____ ck- clauswit_ clgv clojurebot cmbntr_ cmiles74 cmwelsh codeburg coffeejunk conan__ CookedGryphon CoverSlide Cr8 crazysim cross ctrlrsf cursork cYmen d0c0nnor dabradley daemian dakron

6:10 e dale damethos dan daniel___ danlarkin danlucraft______ danneu danvet David dc_ dcolish ddellacosta ddima dean deevus dene14 deobalds Deraen DerGuteMoritz devn dhruvasagar divyanshu dj_ryan djcoin dkinzer dkua dmi3y dogonthehorizon dominiclobue domokato donbonifacio dsantiago Duke- dvz_ dyreshark dysfun dzimm_ e_svedang eagleflo edlothiol edoloughlin edw eevar effy egghead egli eiffel ekroon elarson elfenlaid ellin

6:10 okon elsen EluctariLLC emacsnw emaphis Ember- enaqx engblom enigmeta_ enn ephemeron erdic ered eristic Ernestas Ethan- Excureo expez f3ew fairuz1 falafel farhaven fgallina fikusz filabrazilska fivebats Floyd_ FMJaggy fmu fmw ForNeVeR Foxboron frkout Frozenlock fuziontech____ fvt gazarsgo georgej162_ gf3 gfredericks ggherdov ggreer gideonite gigetoo gignosko gko Glenjamin gluegadget godd2 grabarz grandy grauwulf greg

6:10 burd greghendershott grilix grim_radical groot Guest27727 guilleiguaran gunn Gurkenmaster gws hakvroot halorgium haroldwu hash hellome herme5 heurist hfaafb hguux hhenkel hipsterslapfight hipsterslapfigh| hiredman hlprmnky hlship honkfestival honza hooptw hopnotch howard_ hugod hyperboreean hyPiRion iamdustan ibdknox icedp ieure ifesdjeen igorw ikitommi ikitommi_ ingsoc insamniac instilled Intensity ior3k ipolyzos i

6:10 ref itruslove ivan ivan\ ivan` j0ni jaaqo jabbslad_______ jackjames Jahkeup jakebasile jakecraige jamespw janne Jaood jarpiain jave jayne jbaiter jcidaho jcrossley3-away jcsims jdaggett JDShu je jeffterrell Jellydog jeregrine jeremyheiler jerrytgarcia jetlag jez0990 jfntn jfojtl jgdavey jgmize jhm jimt jinks_ jkienitz jkj_ jlewis_ jlewis__ jlouis jlpeters jlyndon jml jmolet_ jodaro joegallo joelkuiper jonasen jonath

6:10 anj jonh JonMR joshhead joshskidmore jpierre03 JSON_voorheez JStoker julienXX justin_smith jweiss jzelinskie ka2u ka2u_ kandinski kanobe karbak karls katratxo kbidarka keen___________0 kenrestivo kephale1 kerneis_ kitallis Klumben klyed2 kmicu Kneiva knyppeldynan korpse___ kraft kristian- Kruppe kryft kschrader ktsuji kungi kyrre kzar l1x l2x l3dx lancepantz larhat lazybot LBRapid ldcn leathekd leifw lenstr leptonix

6:10 lfranchi Licenser lifenoodles lijnen llasram lnostdal lobotomy locks lodin lokydor lotia Lowl3v3l lozh lpaste lucian luigy LukeWinikates__ lunk luxbock Luyt_ lvh lyddonb m1dnight m_3 machuga madscientist` magnars magnificrab magopian maio majoh malyn malyn_ Mandus manytrees marce808 marcoslamuria marienz mariorz martinklepsch martintrojer matko matt_c matt_d matthavener mattrepl mattyw maxmartin mbac_ mcav mccraig

6:10 mdeboard mearnsh Meeh mekaj Mendor|scr mengu merlinsbrain metadaddy metellus mgaare michaniskin_ micrypt mindCrime_ mishok13 misv mj-0 mjheikkila_ mkhoeini1 mlb- Mongey moquist Morgawr moshR mp mpereira mrb_bk mrBliss mrowe_away msassak msgodf mtd mthvedt muraiki myguidingstar mysamdog n1ftyn8 Natch nathan7 nathanic nbeloglazov ndrei necronian neena nestastubbs newgnus nexysno ngk_ nhanH nighty^_ nikola nilern_ ninj

6:10 udd nmashton noidi nollidj noncom nseger numberten nw nwjsmith obobo octane-- ohpauleez okic OlegYch onthestairs ontoillogical opqdonut ordnungswidrig orkaa Orva oskarth owenb____ oyvinrob ozzloy p_l pachydermballet parkrje paulswilliamsesq pcn peeja pepijndevos PeregrinePDX perplexa peted pgmcgee philandstuff phuu pickels pickledonion__ piranha pjstadig plaeremans pmbauer polamjag__ povilas pradeepc prc przl psy_ P

6:10 upnik__ puyo pydave6367 pyrtsa quakeadd1ct quile qz r4vi raek Ragnor raoul Rapp rasmusto raspasov Raynes Raynos razi razum2um rblackwe rbxbx rcg reiddraper relgar Rhainur rhg135 rigalo_____ rippy Riviera_ rjknight_ rkneufeld rlb rlr rnt ro6 robink robustus rotty_ rovar_ rowth rpaulo rs0 rshetty_ rtl rtra rufoa rurumate rweir ryan_t_laptop ryanf s_e safety SagiCZ1 saiam_ samebchase samflores samrat saolsen sarlalia1

6:10 saurik scape_ scgilardi schwap scopedTV Scorchin sea-gull seabre seangrove seank__ SegFaultAX segmond septomin serjeem_____ sethalves seubert Sgeo Shambles_ shanemhansen Shayanjm shem shiranaihito SHODAN shoky shwouchk si14 sickill silven SirRobin sivoais skrblr slpsys sneeu_ sobel socksy someone soncodi sordina3 Sorella sorenmacbeth spicyj spjt splunk_ spradnyesh sputnikus squeedee srcerer sross07 ssideris stain St

6:10 eve^ stevenfx StevePotayTeo StianE_ stvs superjudge suvash_away sw1nn swen tadni taharqa taij33n tazjin tbaldridge tbatchelli__ tcrawley-away TDJACR technomancy teejar tekacs telex tephra terjesb terom TEttinger TEttinger2 tgoossens the-kenny the_frey thecontrarian___ TheMoonMaster ThePhoeron thorben thsig ticking TimMc timvisher timw1 tmarble tobik tolstoy tomaw tomhs_ tomjack tomku tomobrien toretore torgeir Toxic

6:10 ddellacosta: er

6:10 godd2: wth

6:10 alanpearce: :(

6:10 rshetty_: Hey wtf

6:10 majoh: ehlo

6:10 r4vi: lol

6:10 noncom: who cares anyway..

6:10 ordnungswidrig: ops, please.

6:10 rshetty_: rofl

6:10 ohpauleez: yeah, someone's bot. Ops will add it to the list

6:11 noncom: hey, i actually like this bot..

6:11 majoh: could be messed up copy paste

6:11 Frozenlock: It's this time of the year already?

6:11 majoh: looks like output from irssi

6:11 ddellacosta: I suspect the ops have been woken up by that

6:11 noncom: it made up is all gather here like good old friends

6:11 majoh: or nah,

6:11 ban that shit

6:11 Glenjamin: i think JSON voorheez wins best nick

6:12 godd2: If I knew it was a contest, I would have put mroe effort in

6:37 hyPiRion: 0 days since last ERC incident.

6:38 clgv: hyPiRion: ERC?

6:41 hyPiRion: emacs IRC client

6:41 clgv: ah ok.

6:41 hyPiRion: That sort of output happens from time to time in #emacs.

6:44 kungi: I heard someone is wrong on the internet ... let's gather!

7:07 * micrypt sighs and retreats back into loneliness. (Got highlighted and stopped by to check.)

7:41 clgv: does test.check have gen/double or something similar?

7:53 hyPiRion: clgv: http://dev.clojure.org/jira/browse/TCHECK-5

7:53 tl;dr (def float (gen/fmap float gen/ratio)) is usually okay

8:09 clgv: I used a modified "ratio" since I only want positive values

8:10 justin_smith: hyPiRion: why not double instead of float?

8:31 hyPiRion: justin_smith: why not indeed.

8:42 irctc: Beginner to Clojure here

8:42 how do I loop from 1-12 using loop-recur and not dotimes?

8:44 hyPiRion: ,(loop [i 1] (if (<= i 12) (do (print i " ") (recur (inc i)))))

8:44 clojurebot: 1 2 3 4 5 6 7 8 9 10 11 12

8:44 alhimik45: why not "when" instead if?

8:45 justin_smith: alhimik45: because there are two options there

8:45 oh wait, not really

8:45 hyPiRion: alhimik45: sure, when works just as good here

8:53 Glenjamin: i only realised this weekeend that a third form in when isn't an else clause

8:53 makes so much more sense now

8:53 justin_smith: Glenjamin: and a fourth form is possilbe

8:53 *possible

8:54 Glenjamin: presumably it expands to (if cond (do ~@body))

8:54 ,(macroexpand '(when x 1 2 3))

8:54 clojurebot: (if x (do 1 2 3))

8:54 Glenjamin: heh

8:54 justin_smith: $source when

8:54 lazybot: when is http://is.gd/epz1Ep

8:54 justin_smith: Glenjamin: pretty much that

9:01 borkdude: what is the coolest/shiniest OO language if you're forced to do OO?

9:01 rweir: rust

9:01 justin_smith: clojure

9:02 ocaml is pretty cool too, it has an o right in the beginning of the name

9:08 ddellacosta: borkdude: haskell

9:09 borkdude: great answers so far...

9:09 ddellacosta: really want to check out rust actually, looks interesting

9:09 nathan7: Well, if you want OO, obviously the answer is Common Lisp q=

9:10 borkdude: setq

9:10 CLOS

9:10 ddellacosta: the problem that remains, however, is that you have to figure out what OO means

9:10 borkdude: I was hoping someone would say Ruby, cuz that's what I'm learning now :P

9:10 nathan7: oh god Ruby

9:10 Dunno, I'm a JS fan

9:10 ddellacosta: borkdude: I did Ruby for a while. It has some bad parts and some good parts

9:11 nathan7: as far as I'm a dynamic languages fan today

9:11 ddellacosta: nathan7: if you say "oh god Ruby" then turn around and say "I'm a JS fan..." well, let's just say I'm confused

9:11 borkdude: ddellacosta yeah me 2 =)

9:11 nathan7: ddellacosta: Ruby is the land of people who believe they're writing Good and Beautiful code because it's in Ruby

9:11 borkdude: I'm learning it because of a work project

9:12 ddellacosta: nathan7: okay, if we're just talking about the community, then you have a point there, no disagreement

9:12 nathan7: ddellacosta: JS folk are really weird people who are aware they're crazy

9:12 ddellacosta: and we have a damn good time

9:12 ddellacosta: I'm giving a talk at a JS conference… about my Rust project. not a word of JS.

9:13 ddellacosta: yeah, I gotta agree, I'll take the JS community over Ruby any day of the week.

9:13 borkdude: JS folks are nicer than I would have thought. I met a bunch of them recently

9:14 ddellacosta: yeah, seems like there are more women in JS too, but maybe that's just based on anecdotal data

9:14 maybe part of the reason is that JS folks aren't just all about JS

9:14 kinda silly to identify so strongly with a language anyways

9:15 borkdude: yeah ;)

9:21 m1dnight: what woul dbe more idiomatic: shadow a variable or use dynamic binding and set?

9:21 I need to put a flag in my environment per thread

9:21 and some expression (that expand by macros) will need to change the value for inner expressions of that expression

9:21 Fender: Hey guys: I got a namespace aaa.sss and I want to require bbb.nnn and I get a NoClassDefFoundError Could not initialize class bbb.nnn__init java.lang.Class.forName0 (Class.java:-2)

9:21 Then I go into the ns bbb.nnn, compile it (C+c M+k) and the errors disappears. Spelling of the namespaces (underscores ...) is correct, what could it be?

9:22 m1dnight: Fender: I had the same issue. Always open the file that requires the namespaces before you start your repl

9:22 that solves it for me

9:22 clgv: m1dnight: what?

9:22 Fender: like one big file that requires everything?

9:23 clgv: Fender: you mean you translated underscores in the ns name correctly, i.e. "-" to "_"?

9:23 Fender: yep

9:23 m1dnight: Fender: no, what works for me for example is open my core.clj file. Open up the repl, then compile core.clj and everything works fine

9:23 clgv: same project or in a dependency?

9:23 m1dnight: if I open core.clj after I started the repl nothing compiles

9:23 Fender: actually, the error occurs when I compile a core file

9:24 the project is consists of merged src-dirs of two projects

9:24 m1dnight: try what I said, see if that works (close emacs, cider-restart doesnt do it)

9:24 Fender: which up to then compiled fine

9:24 source-paths in leiningen is set

9:24 m1dnight: namespaces map to directory structure? I think that is required

9:24 clgv: that sounds strange

9:25 you have to be more specific with respect to file system layout and namespaces naming that is used in your project.

9:25 there is definitely something wrong with it

9:25 m1dnight: clgv: I have the same issue, as I said.

9:25 Fender: so, midnight, I'd do it via dynamic bindings, however, IMO best is always to pass kind of a context object around

9:27 clgv, I have source paths ["src" "src/aaa" "src/bbb"] where aaa and bbb where formerly the only directories in the source folder of two working projects

9:27 now when I compile ccc (the "master" project), it tells me that aaa.something cannot be compiled

9:27 which in return refers to bbb.somethingelse

9:28 clgv: Fender: the perts of the namespace must not be mentioned in the source-path vector

9:28 *parts

9:28 Fender: so "src" is suffcient?

9:28 clgv: yes

9:28 Fender: that's what I had before so I tried the other one

9:28 however, it doesnt work either

9:29 martinklepsch: I'd like to apply enlive's `at` macro. i.e (apply #(html/at html-res %) '([:div] trans [:head] trans2))

9:29 clgv: Fender: you have to restart your repl

9:30 martinklepsch: is there a way to do this?

9:30 Fender: ok, actually I am using emacs + CIDER 0.7.0 (Java 1.7.0_65, Clojure 1.6.0, nREPL 0.2.6, cider-nrepl 0.7.0) just for the record

9:30 m1dnight: have you tried what I said, Fender ?

9:30 clgv: if that does not work, you have to provide more details, since guessing on my side wont help you much (my crystal ball is in repair ;))

9:30 Fender: so, restarted it and tried what both of you suggested and it doesnt work

9:30 m1dnight: weird

9:30 Fender: well, just a sec

9:31 really first CC MJ and then and only then open the file?

9:31 clgv: Fender: just forget about the emacs stack for a moment until you get it running - use only lein repl for now

9:31 sveri: Hi, does anyone know if transit support sorted sets from clojure to clojurescript? I just tried it and it seems like the conversion just converts into a PersistentHashSet, but not into a sorted set

9:31 Fender: good idea, I didnt think of that

9:31 m1dnight: hmm, wat clgv says is probably even a better idea. If it compiles fine in leiningen you can worry about emacs

9:32 also, I *think* that if your namespace in a file in ../aaa/file.clj is aaa.file.clj, it is wrong

9:32 I think it should be projectname.aaa.file, no?

9:32 at least, that is the case with me

9:32 wait no, scratch that

9:33 Fender: ok, so if I (require '[aaa.sss]) I get NoClassDefFoundError Could not initialize class

9:33 clgv: no. namespace "my.lib.core" must be in file "my/lib/core.clj"

9:33 m1dnight: yes you are right clgv I was mistaken :)

9:33 Fender: but if I slurp the file it works

9:33 (slurp "src/aaa/sss.clj")

9:33 m1dnight: does it work fine in lein run?

9:33 clgv: so where exactly is "aaa.sss" relative to your project root (the folder containing the project.clj)?

9:34 Fender: as given in the slurp

9:34 hfaafb: !r7 $(!action $(!t $ git $noun -$(!lower $(!t $cons$cons)) "$(!o %*)"))

9:34 oops mistell

9:34 clgv: and "src" is the source path?

9:34 Fender: yep

9:34 I removed the source path statement

9:35 clgv: ok

9:35 Fender: ok, lein run gives me something

9:35 Caused by: java.lang.NoClassDefFoundError: clj_time/core/DateTimeProtocol

9:35 clgv: how does the "ns" statement of that file look like?

9:35 Fender: ha! one of your supposed deps seems to be missing

9:35 Fender: lein deps should have done the trick

9:35 it didnt though, any idea?

9:36 clgv: did you add clj-time with the correct version to your project.clj?

9:36 Fender: yes but I use lots of libs and maybe they require some older version

9:36 I use the newest 0.8.0

9:37 clgv: "lein deps :tree" will tell you

9:38 Fender: ok, clj-time occurs only once

9:38 clgv: with the correct version?

9:38 Fender: yep

9:39 martinklepsch: I want to programmatically generate some transformations using enlive's html/at macro: https://github.com/cgrand/enlive/wiki/Table-and-Layout-Tutorial,-Part-3:-Simple-Transformations#at

9:40 How can I make that macro accept a list as a third argument?

9:40 Fender: Ill delete clj-time in .m2

9:40 verma: why isn't emacs keeping my () matched when in paredit mode, when I hit backspace over it, it just deletes the closing ) instead of moving past it :(

9:41 I do have (paredit-mode t) in my ~/.emacs

9:41 Fender: didnt help

9:41 kungi: verma: Is paredit active in the current buffer?

9:41 clgv: Fender: should that class exist?

9:42 verma: kungi, sorry total noob with emacs, how do I check?

9:42 Fender: well, I doubt I use it directly

9:42 clgv: do you use it explicitely in your souce? if so, why?

9:42 Fender: but Ill check

9:42 kungi: verma: Look at the bottom line where all the modes are. Is "Paredit" there

9:42 Fender: grep -r returned nothing

9:43 verma: kungi: no, that's a minor mode right?

9:43 Fender: but I do use some classes there

9:43 lemme se

9:43 kungi: verma: yes

9:43 verma: Then do M-x paredit-mode

9:43 verma: kungi, Clojure cider Projectile Undo-tree

9:43 kungi: verma: to turn it on :-)

9:43 verma: oh ok

9:43 ok

9:43 :)

9:43 ag0rex: verma: or M-x enable-paredit-mode

9:44 Fender: hmmm, I need to go now

9:44 verma: nice kungi ag0rex :) it shows up there now, how do I always enable it by default?

9:44 Fender: anyhow, thanks already, the problem is now at least living in a smaller scope

9:44 kungi: verma: Add it to your clojure-mode-hook

9:44 Fender: maybe I return later to ask more questions

9:44 verma: much nice, kungi ag0rex, its working as expected with it enabled.

9:45 kungi: ok, checking

9:45 Fender: thx clgv and m1dnight

9:45 kungi: verma:

9:45 (defun turn-on-paredit () (paredit-mode 1))

9:45 (add-hook 'clojure-mode-hook 'turn-on-paredit)

9:45 ag0rex: verma: btw, did you run cider-jack-in?

9:45 kungi: or maybe (add-hook 'clojuret-mode-hook 'enable-paredit-mode)

9:45 verma: hmm, nice, doing that one second

9:46 ag0rex, I do have that running, yes

9:46 clojurebot: Titim gan éirí ort.

9:46 kungi: I think clojurebot is trying to summon the elder things ...

9:46 ag0rex: verma: for instance, i have a hook to enable paredit mode only after cider starts

9:46 verma: on the repl buffer?

9:46 ag0rex: verma: (add-hook 'cider-repl-mode-hook 'paredit-mode)

9:47 verma: ag0rex, that is different from when I just want it enabled on a source file right?

9:48 much nice

9:48 (inc kungi)

9:48 lazybot: ⇒ 1

9:48 verma: (inc ag0rex)

9:48 lazybot: ⇒ 1

9:50 ag0rex: verma: i looked up right now and i have a clojure-mode plugin installed that does that

9:50 verma: ag0rex, nice, what plugin is that?

9:50 ag0rex: verma: clojure-mode

9:51 verma: ag0rex, I think I have clojure-mode, but it doesn't enable paredit by default

9:53 m1dnight: https://www.refheap.com/93057 # Isn't this supposed to erturn false?

9:53 I run the thread with a binding, but it doesn't "take" it?

9:55 clgv: m1dnight: if you use futures your bindings are kept. if you use threads manually you have to make sure to keep them yourself

9:55 m1dnight: well, I also tried putting the binding around the #(actor-func..) part, but that doesn't work either

9:55 or what do you mean?

9:56 clgv: m1dnight: you can lookup the future implementation for the details how this can be achieved - but why do you insist on creating a thread manually?

9:56 verma: sorry for asking off topic questions guys, but how do I get rid of annoying emacs scrolling where it scrolls half a page at a time, I just want it to scroll lines

9:57 m1dnight: because it's part of my thesis and I require seperate threads

9:57 I can try using futures though, but last time that didnt work

9:57 verma: hold on, I have a setting for that

9:57 clgv: m1dnight: well, than look up the way `future` conveys bindings

9:58 m1dnight: it is not that difficult

9:58 m1dnight: verma: https://github.com/m1dnight/dotfiles/blob/master/emacs#L26

9:59 clgv: I just found it

9:59 but (get-thread-bindings) etc, right?

9:59 I'll give it a shot

9:59 verma: thanks m1dnight!

9:59 (inc m1dnight)

9:59 lazybot: ⇒ 1

9:59 m1dnight: woo \o/

10:01 clgv: yeah

10:02 verma: m1dnight, works great, thanks! changed your stuff a bit to do one line scroll at a time instead of 3

10:02 m1dnight: yeah, i found that too tiresome after a while, so 3 lines is a bit better imo

10:03 verma: m1dnight, nice, will try it for a while and see how it goes :)

10:05 wink: so I got some error I can't fathom in my code that used to work. (as I wrote it into the README as instructions). any idea: http://hastebin.com/asucupakog.clj ?

10:11 zerokarmaleft: wink: with-connection is part of the deprecated java.jdbc library

10:11 did you upgrade to 0.3.0+?

10:12 wink: zerokarmaleft: ah, didnt know that. I think it bumped clojurew to 1.6

10:13 zerokarmaleft: thanks. then I can probably figure out the rest.

10:13 zerokarmaleft: rather, the deprecated API of java.jdbc

10:13 wink: sneaky thing is that I think the app does only use korma, only this manual task uses this. so I didnt notice. doh.

10:33 verma: it'd be nice to get clojurebot like integration with slack

10:33 so I can randomly inject clojure in conversations

10:33 slowly manipulating everyone to love clojure

10:33 :P

10:34 guess I could use clojurebot as a starting point

10:42 ,(println (range))

10:42 clojurebot: (0 1 2 3 4 ...)\n

10:42 verma: :P

10:43 clojurebot is smarter about this compared to tryclj

10:46 jebberjeb: exit

10:46 sigh

10:47 justin_smith: verma: I bet you could do something simple with shell calls to grench

10:47 verma: grench?

10:48 justin_smith: it leaves a single clojure process running, and each shell call to grench gets a result from that nrepl server

10:48 so it's not for a normal project, but if you want to eval a random line of clojure code, it's perfect

10:48 verma: grenchman?

10:48 justin_smith: right

10:48 verma: nice!

10:48 trying it out

10:49 justin_smith: verma: clojurebot uses a sandbox, grenchman does not

10:49 but if you are only using it locally, you likely don't need a sandbox

10:50 csd_: I'm trying to recursively search a graph, keeping track of visited nodes. Am I best served keeping `visited` a mutable value in this case?

10:50 verma: justin_smith, I will most likely host it somewhere and make it available to a bunch of users

10:50 but a closed list of users

10:52 justin_smith: verma: then you may want to check out clojail

10:52 which is what lazybot uses

10:52 I forget what clojurebot uses

10:53 verma: what's the difference between the two bots?

10:54 clgv: clojurebot: probably uses clojail similar to lazybot?

10:54 clojurebot: It's greek to me.

10:54 clgv: oops. -":"

10:57 verma: yeah clojail looks nice

10:57 testing it out

10:58 EvanR: ,'[a ;b c]

10:58 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

10:59 EvanR: can i comment out a line within a quoted vector

11:00 joegallo: ,'[a #_b c]

11:00 justin_smith: EvanR: absolutely

11:00 clojurebot: [a c]

11:00 justin_smith: #_ is handy too

11:00 but in a multi line vector you can use normal ;; comments as well

11:01 csd_: How do you do recursion properly in Clojure when things are recursing exponentially rather than linearly?

11:01 EvanR: i dont think it worked

11:02 justin_smith: EvanR: got a paste?

11:02 EvanR: ,'[a\n ;b\n c]

11:02 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

11:02 justin_smith: EvanR: well that's a comment to end of line, of course that won't work in clojurebot

11:02 EvanR: yeah

11:03 justin_smith: ,(read-string "'[a\n;b\nc]")

11:03 clojurebot: (quote [a c])

11:03 justin_smith: so that's not what you want?

11:03 EvanR: it is

11:03 i think i figured it out

11:04 ,'[a #_?b c]

11:04 clojurebot: [a c]

11:04 EvanR: i didnt comment out everything i needed to

11:06 justin_smith: #_ is handy because it comments balanced expressions

11:07 ,'[a #_{:b 0 :c 1 :d [1 2 3]}]

11:07 clojurebot: [a]

11:07 Bronsa: and it also stacks

11:07 ,[#_#_a b 1]

11:07 clojurebot: [1]

11:07 justin_smith: yeah that's werid

11:07 *weird

11:09 dnolen_: cd_: do you mean "mutually recursive"? It's not well supported - closest you get is trampoline and it's a bit ugly.

11:09 csd_: I have a cyclic graph, and I'm trying to identify which nodes are islands

11:09 EvanR: letfn

11:10 dnolen_: csd_: ^

11:10 csd_: yes using an atom to track is typical

11:10 and simpler IMO

11:10 csd_: OK yeah it seemed like a headache otherwise

11:10 I still find it difficult to know when mutable state is OK

11:11 m1dnight: is there a cleaner way to do (cons x (cons y somelist)) ?

11:11 dnolen_: csd_: Clojure is about minimizing it, don't use it unless you exhausted other options - or the alternative is fugly.

11:11 clgv: m1dnight: list*

11:11 Bronsa: csd_: when it simplifies your implementation, it's ok

11:11 clgv: ,(list* 1 2 (range 3 10))

11:11 clojurebot: (1 2 3 4 5 ...)

11:11 m1dnight: (concat (list x y) somelist) then?

11:11 ooohhh

11:11 that's a nice one

11:11 clojurebot: Titim gan éirí ort.

11:11 m1dnight: thnx

11:12 chronno: j

11:12 sorry

11:13 justin_smith: ,(into (list 4 5 6) '(3 2 1 0)) ; there is also this

11:13 clojurebot: (0 1 2 3 4 ...)

11:14 justin_smith: ,(clojure.string/join " " (into (list 4 5 6) '(3 2 1 0)))

11:14 clojurebot: "0 1 2 3 4 5 6"

11:24 oskarkv: What's the point of tools.macro/deftemplate?

11:32 m1dnight: hm, another question :p what if I want to use the value of a dynamic variable from namespace x in a program in namespace y

11:33 in the case where you just use ":use" it works fine, then I can put the *var* in my macro

11:33 but if the user does use :as something I have to put something/*var*

11:33 justin_smith: m1dnight: that shouldn't be the macro's job to worry about that at all

11:33 m1dnight: hrm, but i'm doing some esoteric stuff

11:34 Can't see my way around it

11:35 oh wait, if I put the macro ni the other namespace it will be qualified, i think

11:35 justin_smith: m1dnight: vars are resolved based on the scope in which the macro is expanded

11:35 not the one where the macro is defined

11:35 well, no, it's not quite that

11:36 if you are using quoting and unquoting properly, that should be the case though :)

11:36 m1dnight: do you have a compelling reason not to use `syntax-quote ?

11:37 llasram: m1dnight: It sounds like you are writing a macro which needs to expand to include a symbol which (a) the user controls, but (b) does not pass in as an argument

11:37 The solution in that case is simple: don't

11:38 m1dnight: hrm, it seems to work

11:38 `(println "In transaction?" *in-transaction*))

11:39 the *in-transaction* is a dynamic var defined in the stm.clj file

11:39 I want to access that variable in user-code to see the status of my stm transaction

11:39 EvanR: ,(quote 0)

11:39 clojurebot: 0

11:40 EvanR: im getting unable to resolve symbol quote

11:40 llasram: m1dnight: Ah. Then nm -- syntax-quote is all you need

11:40 m1dnight: i wasn't thinking ahead of the fact that the macro will be defined in the stm.clj file

11:40 llasram: EvanR: Sounds like you're in an NS which hasn't `refer`ed clojure.core

11:40 m1dnight: so all is wel \o/

11:40 Bronsa: llasram: quote isn't a var

11:40 ,quote

11:40 llasram: Oh

11:40 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: quote in this context, compiling:(NO_SOURCE_PATH:0:0)>

11:40 * llasram is batting 0 today

11:41 Bronsa: EvanR: you're trying to use quote as a value somewhere

11:41 EvanR: i put [clojure.core :refer [quote]]

11:41 IllegalAccessError quote does not exist clojure.core/refer

11:41 Bronsa: EvanR: quote is a special form, it's not shadowable and not referable

11:41 EvanR: yeah im trying to compose it with a function

11:41 Bronsa: EvanR: and it's not a value

11:42 EvanR: dang

11:44 so im trying to generate symbols using string operations

11:44 Bronsa: ,(symbol "foo")

11:44 clojurebot: foo

11:44 EvanR: ah

11:45 ,(count [1 2 3])

11:45 clojurebot: 3

11:49 zot: newb question: i have some test code which needs a function that will return a predictable sequence, e.g., 0, then 2, then 0, then 2, … forevah. what's the simplest way to get there? atoms? refs? async? i'm talking quick and dirty here, since it's test code :)

11:50 hfaafb: cycle

11:51 zot: how can i create a function that returns each successive result from cycle?

11:51 gfredericks: cycle w/ an atom

11:52 ,(defn cycler [coll] (let [a (atom (cons nil (cycle coll)))] #(first (swap! a rest))))

11:52 clojurebot: #'sandbox/cycler

11:52 gfredericks: ,(def f (cycler [0 2]))

11:52 clojurebot: #'sandbox/f

11:52 gfredericks: ,(f)

11:52 clojurebot: 0

11:52 gfredericks: ,(f)

11:52 clojurebot: 2

11:52 gfredericks: ,(repeatedly 10 f)

11:52 clojurebot: (0 2 0 2 0 ...)

11:53 zot: perfect :)

11:53 mikerod: gfredericks: why the (cons nil ...) part

11:53 zot: tnx tnx!

11:53 gfredericks: mikerod: so it returns (first coll) the first time you call it; can omit if that's not important

11:54 mikerod: gfredericks: oh, yeah I see what you did now

11:54 gfredericks: just being clever with swap!

11:54 mikerod: Yes, indeed. :)

12:00 justin_smith: ,(def it (let [source (atom (cons nil (cycle [1 2])))] (reify java.util.Iterator (hasNext [this] true) (next [this] (first (swap! source rest))))))

12:00 clojurebot: #'sandbox/it

12:00 justin_smith: ,(.next it)

12:00 clojurebot: 1

12:00 justin_smith: ,(.next it)

12:00 clojurebot: 2

12:00 justin_smith: ,(.next it)

12:00 clojurebot: 1

12:00 justin_smith: if you need a proper iterator

12:03 verma: how do I kill a cider-jack-in repl/

12:03 :P

12:04 cider-quit I think

12:04 justin_smith: (do (shutdown-agents) (System/exit 0)) should work

12:05 (that will shut down clojure, agnostic of UI)

12:08 TimMc: Just (System/exit 0) will do it.

12:08 justin_smith: TimMc: sometimes the shutdown-agents call is needed, or it will hang while shutting down

12:08 engblom: In Haskell I can write "function-name (x:xs)" when creating a function. This means the function will take in "First" and "Rest" (ready destructed). Can this be done in Clojure?

12:08 TimMc: huh

12:09 Because they have a slow shutdown hook?

12:09 justin_smith: engblom: (fn [[a & b]])

12:09 tbaldridge: , ((fn [f & rest] {:first f :rest rest}) [1 2 3 4 5])

12:09 clojurebot: {:first [1 2 3 4 5], :rest nil}

12:09 tbaldridge: , ((fn [f & rest] {:first f :rest rest}) 1 2 3 4 5)

12:09 clojurebot: {:first 1, :rest (2 3 4 5)}

12:09 tbaldridge: there we go

12:10 justin_smith: TimMc: hmm - maybe shutdown-agents is only needed with implicit shutdown (reaching the end of -main) ? but it can't hurt

12:11 engblom: my version is if the arg is one list, tbaldridge's version is for multiple args

12:11 engblom: justin_smith, tbaldridge: That is for variable amount of arguments. I would want it to work for a string. (it is ok that (rest "any string") produces a seq.

12:11 justin_smith: engblom: my version works on a string

12:11 engblom: Ok, will test!

12:11 Thanks'1

12:11 tbaldridge: ((fn [[f & rest]] {:first f :rest rest}) "Hello World")

12:11 justin_smith: ,((fn [[a & b]] {:a a :b b}) "hello")

12:11 clojurebot: {:a \h, :b (\e \l \l \o)}

12:11 tbaldridge: yeah, what he said....

12:12 justin_smith: tbaldridge: careful, shadowing rest is just asking for trouble :)

12:12 tbaldridge: yeah, but who uses rest? :-P

12:13 rest is probably my most shadowed variable, simply because I never use clojure.core/rest, that and clojure.core/more. Don't know that I've ever needed those

12:14 gfredericks: tbaldridge: I just used it here 10 minutes ago

12:14 Bronsa: ,more

12:14 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: more in this context, compiling:(NO_SOURCE_PATH:0:0)>

12:14 gfredericks: Bronsa: thank goodness I was just wondering why we had 3 rest functions

12:14 tbaldridge: ah, is it rest calls more?

12:15 ,(source rest)

12:15 clojurebot: Source not found\n

12:15 Bronsa: tbaldridge: yeah

12:15 tbaldridge: k, so yeah, I don't use either lol

12:15 Bronsa: $source rest

12:15 lazybot: rest is http://is.gd/Yllsx8

12:15 tbaldridge: not confusing at all. Just like conj calling .cons...

12:16 Bronsa: hah

12:16 Glenjamin: do people tend to shadow core variables with locals happily?

12:16 Bronsa: yeah that's a good one

12:16 Glenjamin: lighttable highlights core vars, so it always puts me off doing it

12:16 Bronsa: Glenjamin: I tend to avoid it, remembering all the hours spent debugging a c.c/name shadowing

12:17 technomancy: name is my most-shadowed too

12:17 jebberjeb: Was just going to say 'name' as well:)

12:17 technomancy: ~正名

12:17 clojurebot: If language is not correct, then what is said is not what is meant; if what is said is not what is meant, then what must be done remains undone; if this remains undone, morals and art will deteriorate; if justice goes astray, the people will stand about in helpless confusion. Hence there must be no arbitrariness in what is said. This matters above everything.

12:17 Glenjamin: is there a decent substitute when you want a local called name?

12:17 technomancy: nym

12:17 jebberjeb: Glenjamin nm

12:17 stuartsierra: `the-name-of-the-thing`

12:18 justin_smith: Glenjamin: count is the one I always accidentally shadow, then I get "number isn't a function" errors

12:18 technomancy: (this is the point at which the CLers scoff and pretend putting up with funcall is worth it)

12:20 Bronsa: last time I shadowed name I got "Wrong number of args (-2)"

12:20 technomancy: wut

12:20 engblom: Why is this failing: (== (first "000002") \0)

12:21 Bronsa: ,(defmacro x [] (map))

12:21 clojurebot: #'sandbox/x

12:21 Bronsa: ,(x)

12:21 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (-2) passed to: core/map>

12:21 justin_smith: engblom: \0 is not a number, it is a character

12:21 == is for numbers

12:22 ,(= (first "000002") \0)

12:22 clojurebot: true

12:22 justin_smith: engblom: we don't use = for assignment

12:23 Bronsa: technomancy: http://dev.clojure.org/jira/browse/CLJ-1279

12:26 mj_langford: Clojure webapp question (Which may more be a MVC question than a clojure question, but the libraries may figure into it). I'm using ring/compojure/hiccup to write a small website that doesn't currently use a database at all, passing all state in the URLs. It takes a bunch of input on multiple choice questions then generates a PDF for the end user from their choices.

12:26 annelies: hi there boys and girls

12:26 kungi: annelies: hi there annelies

12:27 justin_smith: hellp

12:27 hello, that is

12:27 bbloom: does anybody have a quick way to get a dotty viz out of clojure namespace dependencies?

12:28 mj_langford: I have the choices (and their ramifications) defined in a map of maps in a data.clj file, and I'm trying to figure out: Should I be digging the data out in the View, or in the Handler file to present in the view? Getting some of the data out in the middle of the hiccup seems to muddy things a bit

12:28 kungi: mj_langford: why not do it in the hiccup but split it into meaningful functions

12:28 verma: not sure why my emacs hangs after a while :( also when I create a project, go to that directory, open emacs and open a clj file, the cider-jack-in still drops me in "user" repl

12:29 kungi: mj_langford: Like render-question render-question-set ... and so on

12:29 mj_langford: I guess hiccup at it's core is a certain format of vectors and symboils

12:29 *symbols, that would work

12:29 Thank you!

12:29 kungi: mj_langford: have you seen enlive?

12:30 mj_langford: I am currently using the same approach with hiccup as i suggested but think about switching to enlive for a better separation of concerns

12:30 mj_langford: It's basically one step closer to a template, with still being rather hiccupish?

12:31 kungi: mj_langford: no

12:31 mj_langford: https://github.com/swannodette/enlive-tutorial

12:32 mj_langford: but it maybe overkill for your project

12:32 justin_smith: verma: in my experience the part of cider that hangs emacs is the autocompletion

12:33 kungi: justin_smith: Yes it is

12:33 mj_langford: Ahh, I was trying to stay more semantic and less markupish. I rarely do web-dev tasks, so don't catch HTML errors well visually

12:33 justin_smith: verma: also, do you have project.clj configured so that your core namespace is automatically required and made the current namespace?

12:33 verma: I never do it myself, but it shouldn't be automatic

12:34 there is a config needed

12:34 verma: justin_smith, hmmm, yeah I remember seeing some repl options in chestnut at least

12:35 {:repl-options {:init-ns remote-login.server}}

12:35 justin_smith: verma: {:repl {:init-ns some.ns}}

12:35 verma: something like that

12:35 yeah

12:35 justin_smith: OK, if it isn't doing that, it is an issue with your project.clj setup (or maybe that ns file is broken and couldn't load?) - cider is just going to launch the repl with lein

12:36 verma: but "lein repl" works fine

12:36 justin_smith: oh...

12:36 TimMc: mj_langford: Just be aware that hiccup will do nothing to keep you from echoing malicious HTML out as user data.

12:36 justin_smith: verma: that's a bug then

12:36 verma: and inside my code when I do C-x C-e it complains compojure.core not found

12:36 TimMc: You have to manually call the HTML escape fn on all user data as you insert it into the hiccup tree.

12:36 verma: on the ns that is

12:36 TimMc: So... don't use it on sites that have any sensitive data, I guess.

12:38 mj_langford: hiccup was nice because it looked like clojure code, which my brain parses just fine (rather than HTML which it doesn't).

12:38 That's not a problem TimMc, the entirety of the data is a list of clojure symbols, which are all in that map of maps I mentioned

12:38 But that's a concern if I take any more user data for sure than I'm currently planning

12:43 TimMc: mj_langford: As long as there's no unconstrained user data, you're good.

12:44 mj_langford: I think xeqi has a fork or wrapper that makes it safe, though.

12:44 mj_langford: Why would I be validating that on output

12:44 Instead of input?

12:45 Glenjamin: because only output has enough context

12:46 mj_langford: Because they could put 3 pieces of data in which taken individtually, aren't detectable as bad, but which make a malicious output

12:46 ?

12:46 Glenjamin: basically, is "<script>alert('hi')</script>" safe?

12:47 and the answer is, not if you're outputting html

12:51 TimMc: mj_langford: Validation only makes sense if there's a very constrained space of inputs, e.g. integers.

12:51 Anything beyond that you just have to accept as-is; you can't decide how to encode it for output until you're ready to do output.

12:51 engblom: Is there a better way than this http://pastebin.com/tDcJUVwX to trim away extra 0 from a number represented as text?

12:52 "00000" -> "0", "000123" -> "123"

12:53 mj_langford: If you're not trying to avoid it as an exercise, re-find may lead you to a shorter solution

12:53 TimMc: mj_langford: For example, is this a "bad" input? "Tim O'Reilly <tim@oreilly.com>"

12:54 If you encode that as &lt; and so forth it's going to look mighty silly in your JSON output.

12:54 and it will screw up any database searches

12:54 jeremyheiler: ,(str (Long/parseLong "0001" 10))

12:54 clojurebot: "1"

12:54 jeremyheiler: engblom: ^

12:55 engblom: Thanks!

12:55 mj_langford: Okay, I see why for complex input, validation is only useful on output

12:55 EvanR: is there a "map with index" or easy way to zip a list with its indexes

12:56 jeremyheiler: engblom: you'll get an exception if your input is not ultimately a number. not sure if that's important or not for you.

12:56 TimMc: mj_langford: It's not really validation -- it's escaping or encoding.

12:57 jeremyheiler: engblom: also, you can drop the 10 if you don't want to be explicit about the radix, 10 is the default.

12:57 TimMc: Think of HTML as a dynamic language -- you're trying to avoid having the output's parse tree be different from what you intended.

12:57 engblom: jeremyheiler: At this point I am just toying with Clojure myself. I wanted to practice on recursion in Clojure.

12:58 * EvanR thinks of html as very static language, if perhaps untyped

12:58 Glenjamin: EvanR: (doc map-indexed)

12:58 EvanR: k

12:59 engblom: My question is more if you need to write it as an recursion, could you do it better than what I did? Like more idiomatic?

12:59 jeremyheiler: engblom: ah, cool.

12:59 Glenjamin: also, ##(map [:a :b :c] (range))

12:59 lazybot: java.lang.IndexOutOfBoundsException

12:59 Glenjamin: also, ##(map vec [:a :b :c] (range))

12:59 lazybot: clojure.lang.ArityException: Wrong number of args (2) passed to: core/vec

12:59 Glenjamin: meh, something like that

12:59 jeremyheiler: engblom: you can write it as a reduce

13:00 engblom: look at "reduced" for how to shortcut the reduction.

13:02 engblom: Thanks!

13:04 kungi: Glenjamin: I think you need a zip

13:04 ,(zip [:a :b :c] (range))

13:04 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: zip in this context, compiling:(NO_SOURCE_PATH:0:0)>

13:05 kungi: ,(zipmap [:a :b :c] (range))

13:05 clojurebot: {:c 2, :b 1, :a 0}

13:06 EvanR: ,'(a b c)

13:06 clojurebot: (a b c)

13:07 EvanR: ,(list a b c)

13:07 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)>

13:07 kungi: EvanR: list is a function trying to evaluate its parameters

13:07 ,(list 'a 'b 'c)

13:07 clojurebot: (a b c)

13:08 EvanR: yes thats what i want

13:21 Glenjamin: kungi: i was intending to demo ##[(map list [:a :b :c] (range)) :vs (map-indexed list [:a :b :c])]

13:21 lazybot: ⇒ [((:a 0) (:b 1) (:c 2)) :vs ((0 :a) (1 :b) (2 :c))]

13:43 theseb: is author of clojure a lisp genius?

13:43 the reason i ask is that i like some of the stuff he did that is nonstandard lisp stuff

13:44 it must have took some cojones to break with the past

13:51 m1dnight: guys, I need an opnion, or expert advise, whatever you want to call it.

13:51 I need to two dynamic vars to be in the same namespace. One is for concern X, the other is for concern Y.

13:51 I have two namesapces for each concern, which is neat and proper.

13:52 However, to make things easy, and possible.. I need them to be in the same namesapce.

13:52 Now I figured I could throw all the code in 1 file and be done with it. But two seperate files is rather neat.

13:52 noonian: m1dnight: you can refer to dynamic vars in other namespaces and bind them etc without issue

13:52 m1dnight: So, one namesapce two file. And I hit this question: http://stackoverflow.com/questions/4690758/splitting-a-clojure-namespace-over-multiple-files

13:52 noonian: yeah, but I need them in a macro, so I need to qualify them properly

13:52 noonian: just namespace qualify them, i.e. other-ns/*dynamic-var*

13:52 m1dnight: so that's not gonna work

13:53 so the commenter says, you are better of putting the vars in a seperate namespace.

13:53 which do you guys recommend, vars in 1 namespace, or single namespace and two files?

13:53 aperiodic: neither, two namespaces in two files

13:54 m1dnight: yeh, but I can't qualify a variable from namesapce X with a macro in namespace Y

13:54 technomancy: a single namespace in two files??

13:54 lazybot: technomancy: Definitely not.

13:55 m1dnight: technomancy: see the SO thread, it explains it

13:55 technomancy: it is a ~guards-worthy offence

13:55 m1dnight: what? :p

13:55 i dont understand

13:55 technomancy: ~guards

13:55 clojurebot: SEIZE HIM!

13:55 m1dnight: :D :D :D

13:55 TimMc: ~gourds

13:55 clojurebot: SQUEEZE HIM!

13:55 m1dnight: but the thread mentions that core namespace is built this way..? :p

13:56 TimMc: m1dnight: clojure.core is special that way

13:56 technomancy: clojure.core does weird things for bootstrapping reasons

13:56 it's not an example to emulate

13:56 m1dnight: Okay, that aside

13:56 TimMc: Also it's *old* so a lot of good practices had not yet been established.

13:56 m1dnight: how do I solve it then?

13:56 I want to take an idiomatic approach

13:56 but not sure how

13:56 TimMc: I also question the good taste of some of the core devs. :-P

13:57 aperiodic: m1dnight: you definitely can refer to vars in other namespaces in macros.

13:58 m1dnight: yeah, but the point is, I have a namespace "stm", and a namespace "actors"

13:58 aperiodic: m1dnight: if not, how would anyone be able to write non-trivial macros? You wouldn't be able to use any clojure.core fns!

13:58 m1dnight: what I want to achieve is, when I use a macro to send a message to an other actor, to check if a variable *in-transaction* which is threadlocal defined in the namespace stm.clj

13:59 aperiodic: ok, so require / refer it.

13:59 m1dnight: yes

13:59 hold on

13:59 technomancy: TimMc: well, we didn't have a lot of precedent at that time to judge taste

13:59 noonian: if you have stm required as stm, you can refer to *in-transaction* with stm/*in-transaction*

13:59 m1dnight: yes

14:00 but when the user imports stm :as s and actors :as a, then I cant' refer to it anymore

14:00 perhaps the fully qualified name would work

14:00 Bronsa: m1dnight: ` already fully qualifies

14:00 ,(alias 'foo 'clojure.core)

14:00 clojurebot: nil

14:00 Bronsa: ,`foo/+

14:00 clojurebot: clojure.core/+

14:01 * Bronsa can never remember the arg order of c.c/alias

14:01 TimMc: technomancy: Well that and no one ever goes back and reformats old code. Too dangerous for core stuff.

14:01 but oh god some of that indentation

14:01 technomancy: TimMc: right, that and the "beware of leopard" sign

14:02 TimMc: This is where testing frameworks like asis come in handy.

14:04 m1dnight: aperiodic: you say to require/refer it. Do you mean to use the fully qualified name, or simply import/require the namesapce and that should do it?

14:06 arianvp: hey

14:06 annelies: arianvp: hi

14:06 aperiodic: m1dnight: you can require the namespace and refer to it in your macro definition as 'alias/*foo*', or you can require the ns and refer the var and use it in your macro as '*foo*'. either works.

14:07 Bronsa: m1dnight: did you see what I evaluted in clojurebot a few lines above?

14:07 TimMc: m1dnight: If someone requires 'actors as 'a it's still there as 'actors.

14:07 and your own aliases will still apply

14:07 aperiodic: m1dnight: as long as your macro uses backquote, that will resolve the aliases and emit fully-qualified symbols.

14:08 TimMc: ,(require '[clojure.string :as str])

14:08 clojurebot: nil

14:08 TimMc: ,`str/join

14:08 clojurebot: clojure.string/join

14:08 aperiodic: m1dnight: users requiring the namespace as another symbol will just set up aliases in their namespace; it won't change the aliases in the namespace where the macro is defined.

14:09 and it won't mutate the namespace being required.

14:09 m1dnight: well that's actually an excellent solution

14:09 and no, I didn't see it but now I do :D

14:09 that's what i need

14:09 thanks guys

14:09 <3

14:10 aperiodic: you're welcome. glad we could clarify things for you. :)

14:12 m1dnight: aha :) it works like a charm

14:13 (map inc #clojure) \o/

14:21 verma: clojail's secure-tester cannot evaluate '(+ 1 1), says permission denied

14:21 is it that super secure?

14:23 jeremyheiler: verma: did you create a .java.policy file?

14:23 TimMc: That 1 could have come from anywhere! You don't know where it has been.

14:24 verma: jeremyheiler, no :(

14:24 checking

14:26 jeremyheiler, thanks for that, totally didn't rtfm :P

14:26 (inc jeremyheiler)

14:26 lazybot: ⇒ 4

14:27 verma: works nice wonder if the default policy is alright

14:27 https://raw.githubusercontent.com/Raynes/clojail/master/example.policy

14:32 amalloy: can someone who hasn't done any 4clojure problems please visit http://www.4clojure.com/problems, enter the word "checkmark" into the search box, and tell me if any problems are checked? i'm getting some weird behavior when logged out and wondering if it's a problem for everyone or just my computer

14:33 hfaafb: http://i.imgur.com/L4TaD73.png

14:33 annelies: same result as hfaafb

14:34 MickJn: I have a namespace with a gen-class that has :methods [[^:static deserializeJson [byte-array string] String]]. With AOT turned on, I get the error Exception in thread "main" java.lang.ClassNotFoundException: java.lang.byte-array. Do I need to require/import clojure into my namespace? In my project.clj I include :dependencies [[org.clojure/clojure "1.5.1"]] :aot :all.

14:34 amalloy: okay, thanks. i wonder why those problems think *everyone* has dnoe them

14:34 jeremyheiler: verma: np

14:34 theseb: i really like how clojure doesn't have explicit conses

14:35 that always bugged about old lisp

14:35 amalloy: theseb: explicit conses? you mean improper lists or what? because obviously we do have cnos

14:35 *cons

14:35 justin_smith: MickJn: the right class declaration for byte-array is ^bytes iirc

14:35 theseb: amalloy: i mean that in clojure iirc you can't get stuff like ((a.b) (c.d)) right?

14:35 aperiodic: MickJn: you have to use the absurd jvm classname for a primitive array... since primitive arrays don't have a real class

14:35 theseb: amalloy: because lists are ISeqs instead of built from conses..is that right?

14:36 amalloy: theseb: right. the term for (a . b) is "improper list"

14:36 technomancy: theseb: "ISeqs instead of built from conses" <- these are not mutually exclusive

14:36 amalloy: [for b which isn't itself a list, anyway)

14:37 technomancy: theseb: the whole point of an interface is that you don't care about how it's implemented

14:37 justin_smith: theseb: ISeq is not a class, as the name indicates it is an interface

14:37 MickJn: justin_smith: Hmm, I will do some research into that. I'm getting java.lang.ClassNotFoundException: java.lang.string now. :D

14:38 amalloy: MickJn: it's String, not string

14:38 justin_smith: theseb: thus "an ISeq" is any class implementing said interface, which includes conses and lists

14:38 theseb: justin_smith: wow

14:38 ok...that's deep ...i think i get it

14:38 all i know is i hate conses

14:38 Bronsa: MickJn: use "[B" and String and it should work

14:39 justin_smith: theseb: this is a pattern in clojure's design - when possible things are implemented in terms of interfaces, not concrete classes. This is pretty cool actually.

14:39 Bronsa: MickJn: "[B" is the jvm signature of a byte array

14:39 justin_smith: Bronsa: oh, bytes won't work there?

14:39 Bronsa: no idea, does it?

14:40 theseb: justin_smith, amalloy, technomancy: i can't quite put my finger on it..it is more of an intuition or matter of taste but clojure seems to make certain design decisions that just seem clean and what i would prefer

14:40 Bronsa: justin_smith: looks like it works, neat

14:40 justin_smith: Bronsa: well the code in question has to be accessible by the reader right? so the string "[B" ?

14:41 cool, thought it would

14:41 Bronsa: justin_smith: I just assumed it called class/forname, [B is ok in that case

14:41 justin_smith: I've messed with silly low level stuff that has no business being implemented in clojure

14:41 Bronsa: ahh

14:41 theseb: Does clojure have all the macro capability of common lisp?

14:42 justin_smith: theseb: I'd call it a more hygenic subset

14:43 dbasch: theseb: see http://stackoverflow.com/questions/9611821/macros-clojure-vs-common-lisp

14:44 turbofail: clojure macros have one thing that CL macros don't, which is access to the bound-variable environment

14:44 MickJn: What are "^bytes" and "[B" called? Where can I find information on how to use them?

14:45 turbofail: which makes certain macros possible that wouldn't be otherwise

14:45 justin_smith: MickJn: type hints

14:45 Bronsa: are &env and &form actually documented anywhere?

14:45 turbofail: i think so

14:45 justin_smith: MickJn: though "[B" is a valid argument to Class/forName, but not a valid type hint

14:45 Bronsa: I don't think they are actually

14:46 justin_smith: MickJn: http://clojure.org/java_interop?f=print#Java%20Interop-Type%20Hints

14:46 turbofail: hm. i know i read about them in some sort of documentation somewhere

14:46 edw: theseb: IMO Clojure combines the hygiene of Scheme's macros with the straightforwardness of CL's macros quite nicely. The `(let [x# blah] ...) syntax is quite elegant.

14:47 annelies: justin_smith: those answers say Clojure has no user-defined reader macros

14:47 That is no longer true, right?

14:47 MickJn: justin_smith: Cool, thanks. This would be the correct way to implement java byte[] then or is there another way?

14:47 justin_smith: MickJn: the aliases like "bytes" are documented under "Aliases"

14:47 technomancy: edw: it solves the problems with CL's macros, which scheme also does. I'd hesitate to say it has "the hygiene of scheme's macros" though

14:47 justin_smith: annelies: we have limited reader-macros

14:47 annelies: What do you mean by implement? byte[] is already implemented by the JVM.

14:47 justin_smith: not general like common lisp

14:47 Bronsa: annelies: it is true, clojure has tagged literals which are a limited version of reader-macros

14:47 annelies: Oh, I see.

14:47 turbofail: i feel like defmacro's docstring used to have something about &env and &form

14:48 Bronsa: annelies: tagged literals can't control the reader stream like reader macros can in CL

14:48 MickJn: justin_smith: I got byte-array from the java-interop document.

14:48 justin_smith: MickJn: the right type-hint for a byte-array is bytes

14:48 byte-array is a constructor

14:48 not a type

14:48 dnolen_: justin_smith: "[B" is a valid type hint

14:48 ,(let [^"[B" x (byte-array [1 2 3])] x)

14:48 clojurebot: #<byte[] [B@1800df6>

14:48 justin_smith: dnolen_: oh, TIL, thanks!

14:49 so I guess bytes is just a sugar

14:49 dnolen_: ,(let [^"[B" x [1 2 3]] x)

14:49 edw: technomancy: Could you give me an example of casual hygiene abuse in a Clojure macro? Maybe I've been too well trained by Scheme, and it doesn't occur to me how to do evil.

14:49 clojurebot: [1 2 3]

14:49 Bronsa: justin_smith: yeah

14:49 justin_smith: cool

14:49 (inc dnolen_)

14:49 lazybot: ⇒ 6

14:49 justin_smith: (inc dnolen)

14:49 lazybot: ⇒ 16

14:49 dbasch: ,(let [^"[FOO" x (byte-array [1 2 3])] x)

14:49 clojurebot: #<byte[] [B@18a04b0>

14:49 amalloy: hey, dnolen's back

14:50 MickJn: justin_smith: Ahh, okay. I'll read into it some more. Lots to learn.

14:50 Bronsa: dbasch: yeah dnolen's example would have worked anyway since in clojure type hints are not enforced, but he's right that ^"[B" is a valid type hint

14:50 if a string can be resolved to a class via RT/classForName then it will be a valid type hint

14:51 dbasch: good to know, because you can always use anything as a type hint and see it ignored

14:51 Bronsa: not *always* :)

14:52 you can never know when the compiler will ignore a wrong type hint or explode in your face

14:52 amalloy: hurrah, fixed the 4clojure problem-listing thing. somehow a user whose id was null (not the string "null", but actually null) had been recorded as solving those four problems, so that if you're not logged in it thinks you've solved them

14:52 turbofail: edw: clojure's hygiene is handled entirely by the syntax-quote mechanism. if you build up your output forms without using syntax quote, it's trivial to end up with non-hygienic stuff

14:52 * nullptr looks around nervously

14:52 TimMc: haha

14:53 Bronsa: (inc nullptr)

14:53 lazybot: ⇒ 1

14:53 turbofail: edw: though you could also just do `(let [~'if 3] ~@body)

14:53 TimMc: NullPointerException

14:53 dbasch: (dec mongodb)

14:53 lazybot: ⇒ -1

14:54 justin_smith: dbasch: woah, that is way too high

14:54 TimMc: $karma mongo

14:54 lazybot: mongo has karma 0.

14:54 dbasch: with the db suffix comes great responsibility

14:54 edw: turbofail: D'oh, right. It never occured to me that folks would not use syntax-uote.

14:54 syntax-quote, even.

14:55 TimMc: edw: It's rare.

14:55 Bronsa: edw: some clojure macros are implemented without syntax-quote because it isn't available immediately in the bootstrapping process, for example

14:55 some clojure.core macros, I mean

14:55 amalloy: defmacro being a good example

14:56 edw: More bootstrapping please.

14:56 TimMc: I guess I sometimes forego syntax-quote for small parts of my macros because the quoting/unquoting gets in the way.

14:56 {blake}: Uh oh. Mongo hate?

14:56 tmarble: what are the preferred ways for reading e-mail from Clojure (javax.mail)?

14:56 amalloy: speaking of defmacro, one version of one of my patches was to add a feature to defmacro, instead of adding it in java where it's really a lot easier. it looks absolutely disastrous

14:56 technomancy: edw: you can get non-hygenic macros with syntax-quote

14:57 usually by some '~' abomination, so at least it stands out as ugly, but definitely possible

14:57 dbasch: tmarble: I had a good experience with https://github.com/drewr/postal

14:57 Bronsa: lol

14:57 amalloy: check out the amazing patch at http://dev.clojure.org/jira/secure/attachment/10592/0003-Make-defmacro-preserve-form-metadata.patch if you dare

14:57 Bronsa: amalloy: defmacro actually uses ` once!

14:58 wow.

14:58 edw: technomancy: I'm interpreting that as a challenge. Off to wreak havoc...

14:58 technomancy: it does the right thing by default but makes the error-prone thing possible, which is usually the right choice. but I'm sure schemers would object at calling it "hygenic"

14:59 tmarble: dbasch: thx!

14:59 amalloy: Bronsa: well, ` "works" starting at line 1 of clojure.core; it's just that the only thing it can do at that point is namespace-qualify symbols

14:59 Bronsa: amalloy: yup

15:00 amalloy: that patch is getting old enough that i should start looking around for good preschools

15:02 nodename: re

15:03 Barley: is anyone else using cursive on osx experiencing the repl view closing all the time

15:03 the repl stays up but the view goes away, really annoying

15:04 justin_smith: Barley: cfleming probably wants to know about that. I think the project has an issue tracker too.

15:06 Barley: ok

15:07 sveri: Barley: I had that happening some time ago too, on windows 7

15:07 verma: so I created a compojure app using the default compojure template, it has the app defined in handler.clj, what is the preferred way to get an HTTP server running inside repl, so that when I change any code, new changes are immediately available?

15:07 sveri: Barley: in the meantime I reinstalled cursive because I had another problem with it, not sure exactly when this problem went away

15:07 verma: I think I can do (run-jetty) somewhere

15:08 sveri: Barley: It may be a intellij setting too, did you play around with the pinned / docked mode of the repl window?

15:08 justin_smith: verma: if the hander argument to run-jetty is #'handler, then the app will see updates. lein-ring does auto-reloading if files change

15:08 Barley: sveri: no

15:08 i actually have cursive on windows 7 as well and there the repl is rock solid

15:09 i'll have a go at the modes

15:09 verma: justin_smith, I may have to import run-jetty from somewhere I think, what does #' do?

15:11 tmarble: dbasch: any suggestions for clojure libs to *retrieve* mail?

15:12 dbasch: tmarble: I used javamail directly, it has more flexibility

15:12 justin_smith: verma: it gets the var rather than the function, vars always look for a new bindign when run

15:12 hiredman: javaxmail does pop3 and/or imap

15:12 justin_smith: verma: wheras the function you pass in is resolved, so a new definition is not seen by the function that gets passed that fn as an arg

15:13 &[+ #'+] ; verma: one is the function itself, the other is the var holding it

15:13 lazybot: ⇒ [#<core$_PLUS_ clojure.core$_PLUS_@1709fa5a> #'clojure.core/+]

15:14 justin_smith: the function is immutible, the var is not

15:14 verma: justin_smith, ah nice!

15:14 justin_smith: ,(#'+ 1 1)

15:14 clojurebot: 2

15:14 justin_smith: but vars are still callable

15:15 verma: oh nice, but I can rebind it

15:15 justin_smith: exactly

15:15 verma: ,(binding [#'+ -] (#'+ 1 1))

15:15 clojurebot: #<CompilerException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_PATH:0:0)>

15:16 verma: oh

15:16 justin_smith, how do I rebind a var like that?

15:16 just curious

15:16 justin_smith: with def

15:16 ,(defn foo [] 1)

15:16 clojurebot: #'sandbox/foo

15:17 justin_smith: ,(defn bar [] (foo))

15:17 clojurebot: #'sandbox/bar

15:17 justin_smith: ,(defn baz [] (#'foo))

15:17 clojurebot: #'sandbox/baz

15:17 justin_smith: ,(bar)

15:17 clojurebot: 1

15:17 justin_smith: ,(baz)

15:17 clojurebot: 1

15:17 justin_smith: (defn foo [] 2)

15:17 ,(defn foo [] 2)

15:17 clojurebot: #'sandbox/foo

15:17 justin_smith: ,(bar)

15:17 clojurebot: 2

15:17 justin_smith: ,(baz)

15:17 clojurebot: 2

15:17 justin_smith: hrm...

15:17 ahh, I did it wrong

15:17 one sec

15:18 annelies: (foo 1 2 3) compiles to bytecode of Java foo.getRoot().apply(1, 2, 3)

15:19 If foo is a var

15:19 justin_smith: right

15:20 annelies: I wondered the same a few days ago and used decompiler :P

15:21 verma: nice

15:21 justin_smith: ,(defn foo [] 1)

15:21 clojurebot: #'sandbox/foo

15:22 mj_langford: I'm creating a clojure symbol from string input

15:22 justin_smith: ,(defn dofoo [arg] (fn [] (arg)))

15:22 clojurebot: #'sandbox/dofoo

15:22 justin_smith: (def bar (dofoo foo))

15:22 mj_langford: When I attempt to then use this on a map defined in code (in a different module), i'm getting nothing bak

15:22 justin_smith: ,(def bar (dofoo foo))

15:22 clojurebot: #'sandbox/bar

15:22 justin_smith: ,(def baz (dofoo #'foo))

15:22 clojurebot: #'sandbox/baz

15:22 justin_smith: (bar)

15:22 ,(bar)

15:22 clojurebot: 1

15:22 justin_smith: ,(baz)

15:22 clojurebot: 1

15:22 justin_smith: ,(defn foo [] 2)

15:22 clojurebot: #'sandbox/foo

15:22 justin_smith: ,(bar)

15:22 clojurebot: 1

15:22 justin_smith: ,(baz)

15:22 clojurebot: 2

15:22 hiredman: please use your own repl

15:23 justin_smith: there we go, sorry it takes so many lines to demonstrate

15:23 mj_langford: I can definitely see the map, it's showing up fine, but I can't seem to get the same symbol. I've tried (symbol that_string) (symbol "that_module" that_string) and a few other things. Any ideas?

15:23 justin_smith: hiredman: I was demonstrating the difference between functions and vars as args

15:23 hiredman: mj_langford: are you using a symbol or a keyword for the key in the map?

15:23 justin_smith: hiredman: but you're right, next time I'll use refheap

15:23 mj_langford: :like_this in the map

15:24 for the keys

15:24 hiredman: keywords and symbols are different

15:24 :foo is a keyword

15:24 mj_langford: Well there we go

15:24 hiredman: http://clojure.org/data_structures#Data%20Structures-Keywords

15:24 verma: justin_smith, nice makes sense, thanks

15:24 (inc justin_smith)

15:24 lazybot: ⇒ 127

15:24 mj_langford: Those are backwards from what I expected, and totally my problem

15:25 Thank you, all problems fixed now.

15:29 annelies: lazybot: that's almost a nice round number!

15:36 amalloy: annelies: 1111111 is at least as nice a number as 10000000

15:37 gfredericks: it's a prime

15:37 so if "round" means something like "smooth", it's as non-round as you can get

15:38 oskarkv: I have a mystery on my hands. I realize the code is a little bit long but I'm not sure I can reproduce the effect with shorter code. Something I've not understood about macros? https://www.refheap.com/de05c588c8c553ae3e04978d1

15:40 hiredman: ~'node

15:40 clojurebot: Cool story bro.

15:41 oskarkv: hiredman what?

15:41 amalloy: oskarkv: you probably have too many ~' in there. for example, ~'MouseEvent/MOUSE_ENTERED_TARGET will only work if it's run from a namespace that's impoted MouseEvent

15:43 oskarkv: amalloy shouldn't I get a compile error in that case, in the function add-tooltip-stuff? And I everything is imported in the same namespace

15:46 hiredman: oskarkv: the count of ~' occurances in the macro form is a strong indication of badness, I would suggest rewriting the macro as a function and once you have done that re-evaluating if you want it to be a macro, and if you still do the macro form will be much simpler to write

15:48 rpl: What is the best way these days to connect a repl to a running clojure web server. I played around with Drawbridge a bit, but that seems out of date and apparently references some deprecated Apache web client libraries. Thanks.

15:50 oskarkv: hiredman yeah actually at first I didn't have ~' on everything, just on #{node this e}, and it was supposed to be a local macro (with macrolet). I'm just baffled by why they wouldn't be equivalent.

15:52 hiredman: oskarkv: it is hard to say, I can't say I find your equality checks trust worthy, too many ways you can screw up using the stuff in *1 and *2

15:53 aperiodic: oskarkv: perhaps describing in more detail what "doesn't work" means would help. is an exception thrown? what is the stacktrace? does the behavior silently fail to apply?

15:53 Fender: clgv / m1dnight: regarding Caused by java.lang.ClassNotFoundException clj_time.core.DateTimeProtocol - it's gone and I think it was because the lib changed and some class wasnt existing anymore. I tried to isolate it but it's somehow a mess

15:55 hiredman: look, there are a number of possible bad things it could be, and given the circumstances it is difficult to decide which it must be, so is it really fruitful to track down what it is? or is it better to guide someone to a more reliable/understable means of working

15:56 you don't have a clear understanding of macros, you seem to have a handle on functions, so do as much of it as a function as possible, maybe simple macro sugar on top

15:56 Fender: weirder even, I still got a similar error: in aaaa.core (require '[aaaa.ssss]) -> CompilerException java.lang.Exception: namespace not found

15:56 (slurp "src/aaaa/ssss.clj") -> returns clj code with proper namespace declaration

15:56 emacs -> open "src/aaaa/ssss.clj" -> compile -> open aaaa.core -> compile -> everything works

15:57 hiredman: it will work, and the irc channel won't have to sit through the often infuriating (but very rewarding to the ego) process of directing someone through debugging an issue via a low bandwidth medium like irc

15:58 sveri: Barley: did you get it working?

15:58 Barley: hard to say, hasn't acted up for a while now

16:00 m1dnight: hm, strange I didnt get highlighted on that one

16:00 loliveira: Is it possible to write a websocket client using http-kit?

16:01 Fender: m1dnight: no worries, you can respond tomorrow

16:02 fi you have an idea that is ;)

16:02 I tried to fiddle around a bit with the lein :main setting but to no avail

16:03 Glenjamin: i just noticed http://clojure.org/data_structures doesn't include booleans

16:03 m1dnight: Fender, as I've had some issues with namespaces (ask the channel :p) as well, I'd try a minimal test case

16:03 I.e., create a simple file that uses the namesapce that doesnt work

16:04 and try and compile that file in emacs

16:04 Bronsa: tbaldridge: ping

16:05 tbaldridge: Bronsa: pong

16:05 Bronsa: tbaldridge: andyf was testing eastwood on core.async and stumbled upon a bug -- there's no implementation of -item-to-ssa for :with-meta nodes

16:06 tbaldridge: it's 3 lines, want me to add it to ASYNC-86 or make another ticket?

16:06 tbaldridge: go ahead and add it to 86, that one has been vetted by Rich (I think) so it just needs to be screened

16:06 Bronsa: cool

16:07 tbaldridge: btw I'll keep updating the patch each time I release a new t.a.jvm version until it gets screened

16:08 verma: when you add a new dep to project.clj, do you just cider-quit -> cider-jack-in? or is there a better way?

16:09 m1dnight: cider-restart, I guess?

16:09 verma: nice

16:10 justin_smith: also, with pallet/alembic you can load all new deps from project.clj without restarting the repl

16:10 (alembic/load-project)

16:11 this does not do version changes or remove deps though

16:11 verma: its pretty nice

16:12 Fender: m1dnight: I did so at least for the clj-time prob and now Im too tired to think, but I'll try tomorrow

16:12 thx n n8

16:12 m1dnight: hah, I can imagine Fender have a good one o/

16:25 oskarkv: aperiodic the behavior silently fails :p

16:29 timw1: .

16:29 \quit

16:36 toxmeister: technomancy: xeqi: hi guys, pls forgive me for bugging about this, but am really stuck with my failed deploys to clojars and resulting breakage of downstream projects (see https://github.com/ato/clojars-web/issues/270) and was wondering if it would be possible/feasible to remove/reset the /repo/thi/ng/geom-* metadata files and see if this helps fix the issue?

16:39 wsmoak: toxmeister: … just an observation that you may want to run a repository manager (like Apache Archiva) locally so you can correct things like that and not be so dependent on other people’s infrastructure

16:40 technomancy: toxmeister: it looks like geom-core only has 0.3.0-SNAPSHOT deployed

16:40 since there's no releases I can go ahead and delete the whole artifact

16:40 is that what you want?

16:41 toxmeister: wsmoak: well, i've got a private nexus install, but this is an oss project and other people are writing to me that their projects are currently broken of this, am also using it to teach a workshop this week

16:41 technomancy: yes, please, please! AFAIK those geom-* artefacts are the only ones impacted

16:42 michaelr525: hey

16:42 wsmoak: understood. I’ve just BTDT with not everyone getting Maven stuff right ;)

16:42 technomancy: toxmeister: ok, you got it

16:43 michaelr525: https://www.refheap.com/2b786b9fc80eeaceb6bcf6d0e <-- this macro, when I try it in the repl it works as expected but when ran inside a compojure (GET ...) the platform and token destructured arguments come out as null. Anyone has an idea?

16:43 toxmeister: technomancy: you sir are amazing! :)

16:43 technomancy: oh I don't know about that, but thanks =)

16:46 amalloy: the macro definition looks reasonable; no idea what could possibly be wrong without knowing what your code that *uses* the macro looks like

16:46 toxmeister: technomancy: hehe, i still stand by that, but looking it seems the artefacts are still there? e.g. https://clojars.org/repo/thi/ng/geom-meshops/ https://clojars.org/repo/thi/ng/geom-webgl/ - could you pls `rm -rf /repo/thi/ng/geom*` - still getting the error right now

16:47 michaelr525: amalloy: thanks for looking.. one sec and I'll paste the using code

16:48 technomancy: toxmeister: oh gotcha; I thought you said just geom-core

16:48 amalloy: like hiredman said earlier to another vague macro question: try doing it all with functions, and then once that's working you can make a macro out of it if you want

16:48 technomancy: toxmeister: I can't delete non-snapshot artifacts without verifying the owner of the repo

16:49 michaelr525: amalloy: https://www.refheap.com/45285f2f6bc8a2d06a2bfe727

16:49 toxmeister: technomancy:oki, then only the 0.3.0-SNAPSHOT please, please (sorry, forgot there was one release earlier this year, my bad..)

16:49 amalloy: yeah, that's just never going to work. your macro can't destructure at compile-time values that only exist at runtime

16:49 michaelr525: amalloy: I can't let it go, spent the last hour trying to figure it out

16:50 ah

16:50 damn

16:50 amalloy: "data" is a symbol to the macro, not a map

16:50 michaelr525: I knew it was something stupid like that :)

16:50 amalloy: you need to emit code that destructures, rather than trying to destructure in the macro itself

16:50 toxmeister: technomancy: having six modules doesn't make it easier in this case..

16:51 cfleming: Barley: Definitely check the pinned/docked status of the toolwindow.

16:51 michaelr525: amalloy: thanks

16:53 SagiCZ1: is there any way i could combine line-seq with with-open? i mean after the lazy-sequence reaches its end, it would call .close on the stream

16:53 arohner: SagiCZ1: not really, no

16:53 you can doall inside the with-open

16:53 justin_smith: SagiCZ1: with-open only works if the output is fully realized before leaving scope

16:54 arohner: that's about the best of your "sane" options

16:54 justin_smith: so it can't be lazy

16:54 technomancy: toxmeister: you want me to delete the files for the 0.3.0-SNAPSHOT releases alone?

16:55 SagiCZ1: so there is basically no way to read file lazy, right? why does line-seq exist then?

16:55 TimMc: SagiCZ1: There is, you just have to keep it open.

16:56 SagiCZ1: TimMc: what happens to the file in that case? it is a large csv file.. i just leave it open.. what could happen?

16:56 nullptr: in order for this to work you would need to create a notion of "disposable seqs" -- and then everything that deals with seqs would need to respect that (dispose when enumeration completes)

16:57 toxmeister: technomancy: if that's possible, yes please! for all modules of this library, the last successful deploy of these was on aug 17, since then no POMs have been written or maven-metadata.xml updated on clojars, only jars ended up being copied. still don't understand why and realise what i'm asking for is the nuclear option :)

16:58 technomancy: toxmeister: ok, you got it

16:58 SagiCZ1: nullptr: i see, not trivial task for me.. i guess i just wont close it then

16:58 technomancy: yeah unfortunately right now deploy is not transactional

16:58 if your connection gets interrupted there are ways to leave the repo in an inconsistent state

16:58 I've never heard of it affecting future writes though, just reads

17:00 Glenjamin: nullptr: presumably a lazy-seq with a closure over a file handle and some logic to close it on the last item could acheive this?

17:01 amalloy: Glenjamin: and what if you never reach the last item?

17:01 Glenjamin: well it'd stay open i geuss

17:01 TimMc: SagiCZ1: It leaves one file handle open for a while. Unless you are doing *lots* of these in parallel, you don't have to worry about that.

17:01 toxmeister: technomancy: might well have been the reason, have been deploying several times via 3G mobile hotspots. shall try to avoid that in future...

17:01 nullptr: Glenjamin: yes

17:02 TimMc: technomancy: Was the SSH deploy transactional?

17:02 nullptr: amalloy: the wrapper itself would also be disposable

17:02 SagiCZ1: TimMc: thanks! i will keep that in mind

17:03 amalloy: TimMc: it could leave one file handle open *forever*

17:03 you shouldn't rely on garbage collection to clean up your heavyweight objects

17:04 (by which i mean objects that matter to the world outside your program)

17:05 Glenjamin: hrm, maybe something more explicitly a file handle would be nicer

17:05 deftype and implement ISeq and some protocol that includes a close

17:05 not sure if you've gained much at that point

17:05 TimMc: amalloy: Maybe I was responding to the wrong point in the conversation -- I was thinking of just wrapping with-open around a larger portion of the program.

17:05 the eager shell

17:06 amalloy: apt-get install eagersh

17:06 nighty^: Is clojure supported by Android Studio ?

17:06 hiredman: a big problem of relying on the gc is the gc only knows about the foot print in managed memory of a resource, which maybe just be an object header and an int

17:07 so, you know, why waste time cleaning it up?

17:07 meanwhile the 2tib open file sits there

17:08 amalloy: particularly in a generational gc, where once an object reaches a certain age it is tenured and not even considered for collection until the next major compaction, which is like hours in the future

17:09 hiredman: obviously the answer is to give the gc sweeping powers to introspect beyond managed memory

17:10 mj_langford: nighty^ may want to ask in #clojure-android :D

17:10 nighty^: Ok

17:10 Glenjamin: i believe Rust has some concept of managed resources like that

17:10 nighty^: Sorry I did not know there was such a channel

17:10 mj_langford, thank you

17:10 m1dnight: arg, circular dependency :(

17:10 mj_langford: tis pretty empty :D

17:11 TimMc: hiredman: BEEP BOOP YOUR HOUSE IS NO LONGER REFERENCED I WILL COLLECT IT NOW

17:11 amalloy: hiredman: The Oracle© Java© Garbage Collector has found a pending reference to a MySQL database handle, and would like to encourage you to consider purchasing an Oracle© database license

17:11 To agree, click Yes (will install the Ask toolbar)

17:12 turbofail: i wonder when the next major meatspace compaction event is going to take place

17:13 amalloy: sounds like Burning Man

17:13 turbofail: compaction and garbage collection i mean

17:14 well some people say that we're already in the middle of one

17:14 http://en.wikipedia.org/wiki/Holocene_extinction

17:21 toxmeister: technomancy: oh man, i don't believe it... it's still happening. but don't want to waste your time... will have to re-open that GH issue once more :_(

17:23 technomancy: what i don't get is the "forbidden" part - hence why I thought maybe file perms are wrong?

17:25 SagiCZ1: can i make a clojure.zip structure from a simple clojure hash-map?

17:36 amalloy: SagiCZ1: yes, but clojure.zip is not the magical panacaea it sounds like when you first hear about it. whatever your current problem is, it is fairly unlikely clojure.zip will make it easier

17:37 SagiCZ1: amalloy: i have a maps of many more maps created by traversing directories, and now i would like to access all the leaves (files), but they might be at different depth

17:37 Glenjamin: if anyone has a few spare minutes, would they mind skimming over https://github.com/defshef/defshef12/blob/master/ClojureScript.md for me? I'm trying to write enough of an intro for experienced programmers to get going in a practical demo without really teaching the language

17:38 amalloy: yeah, so you just want to use tree-seq or something, SagiCZ1. really just writing a recursive function yourself to do this isn't hard. clojure.zip will not excite you

17:38 SagiCZ1: amalloy: i see, thanks

17:39 EvanR: ,(prn "foo")

17:39 clojurebot: "foo"\n

17:39 EvanR: ,(if true (do (prn "foo") (prn "bar")))

17:39 clojurebot: "foo"\n"bar"\n

17:41 mj_langford: Glenjamin, you may want to explain keywords syntax in the map section

17:44 Glenjamin: mj_langford: And leave it out of the primitives section? Or just expand on it when maps are mentioned?

17:44 mj_langford: Explain it at or before first use. IDK where is best

17:50 SagiCZ1: this is a dumb question, but is clojure using java 1.7?

17:50 Bronsa: SagiCZ1: it uses whatever jvm you run it in

17:50 annelies: On my machine Clojure is using Java 8.

17:50 {blake}: Does Immutant work with JBOSS (i.e. version 7 or earlier) or only Wildfly (8+)?

17:50 justin_smith: SagiCZ1: clojure uses your version of java, minimum of 1.5

17:51 Bronsa: SagiCZ1: I believe it is compiled with java 1.6 bu that shouldn't make any difference

17:51 but

17:51 SagiCZ1: ok, sweet

17:52 godd2: ,(System/getProperty "java.version")

17:52 clojurebot: #<SecurityException java.lang.SecurityException: denied>

17:52 godd2: aww well you can use that to get whatever version of java clojure is running on.

17:52 irctc: does anyone here use cider with emacs

17:53 SagiCZ1: i wonder why the clojure version doesnt work here:

17:53 Paths.get("/var/data/stuff/xyz.dat");

17:53 (Paths/get "/var/data/stuff/xyz.dat")

17:53 whats wrong?

17:53 Bronsa: SagiCZ1: what error are you getting?

17:53 SagiCZ1: String cannot be cast to java.net.URI

17:53 this is the header of the overloaded method i want to call:

17:53 public static Path get(String first, String... more)

17:54 Bronsa: SagiCZ1: you need to pass an empty array then

17:54 justin_smith: ,(java.nio.file.Paths/get "/" (into-array String []))

17:54 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: java.nio.file.Paths>

17:54 Bronsa: SagiCZ1: varargs in java are just syntactic sugar, they don't really exist in the bytecode

17:54 justin_smith: SagiCZ1: anyway, the above works on 1.7+

17:55 irctc: hey, does anyone know if there is a way to change the cider repl's error window

17:55 so that the cider repl's error doesn't take up a whole window

17:56 SagiCZ1: wait but nobody taught me that! .. thats ugly.. thank you though

17:56 alejandro1: irctc: does popwin.el help?

17:56 irctc: oh i don't have popwin

17:57 thanks alejandro! i think its what i needed

18:04 if i have installed popwin, i should be able to just revert with C-g, right?

18:12 tcrawley: {blake}: Immutant 1.x works with jboss 7 only, Immutant 2 works with WildFly 8/9, or without a container at all

18:15 m1dnight: irctc: how about just splitting your windows with C-x 2 or C-x 3

18:15 and create a popup with C-x 5 f or C-x 4 f

18:15 (i believe there are others as well)

18:15 I have created a shortcut that allows me to create a new frame (actual window) for a buffer to my choosing

18:15 irctc: m1dnight: thanks for the suggestion! i forgot to eval-buffer so popwin wasn't working properly

18:16 m1dnight: (global-set-key (kbd "<f7>") 'ido-switch-buffer-other-frame)

18:16 this is the one I use

18:16 irctc: buwhat do you mean by create a popup with C-x 5 f?

18:17 m1dnight: if you press that key combination it executes 'ido-switch-buffer-other-frame

18:17 it then gives you a menu for all your open buffers, the one you select will open in a new frame (actual window)

18:17 so you can there select *cider-error* or whatever its called

18:17 mj_langford: Is there something obvious I'm missing here with these compojure routes? (GET "/genchar/a/:archetype" [] handle-pick-template)

18:17 (GET "/genchar/a/:archetype/t/:template-name" [] handle-pick-first-archetype)

18:18 the second one never matches

18:18 justin_smith: mj_langford: does putting them in a different order help?

18:19 mj_langford: Neither reordering them or removing the shorter route makes the longer route match

18:19 m1dnight: irctc: you can press "C-h k" and then use any keycombination and emacs will tell you what it does

18:20 justin_smith: mj_langford: I assume you are submitting a request that fully matches that route

18:20 mj_langford: http://localhost:8000/a/disciple/t/two-native-specialties-and-advancement

18:20 irctc: m1dnight: oh cool, thanks!

18:20 justin_smith: mj_langford: there is no genchar in that route

18:20 amalloy: mj_langford: and where is the /genchar?

18:21 mj_langford: oi

18:21 Was looking for clojure misunderstandings, not stupidity

18:21 Thanks folks

18:21 that's of course it

18:42 aaelony: did http://planet.clojure.in/ die? appears to be down...

19:08 justin_smith: aaelony: yeah, I am not seeing either

19:09 Raynes: A coworker is trying to write a deftype with some annotations. He has one annotation that looks like ^{RolesAllowed [SomeClass/SOMEFIELD AnotherClass/ANOTHERFIELD]}. Those symbols refer to strings, and the generated class has the annotation as he expected: @RolesAllowed({"user", "service"}). However, he has another annotation that looks like ^{QueryParam YetAnotherClass/YETANOTHERFIELD}. This one throws an exception because the symbol does not

19:09 resolve to a class or enum as per https://github.com/clojure/clojure/blob/eccff113e7d68411d60f7204711ab71027dc5356/src/clj/clojure/core.clj#L5178. The part that is confusing me is why the first one works in this case. Is this all expected behavior?

19:09 Note that I'm fairly unfamiliar with annotations and such, so feel free to shame me if this is a dumb question.

19:10 aaelony: justin_smith: i wonder what happened..

19:11 justin_smith: aaelony: no mention on the twitter

19:11 Raynes: Scratch that, he was wrong, the vector format wasn't working either.

19:11 Never mind. Clarity is achieved.

19:11 justin_smith: aaelony: https://twitter.com/planetclojure

19:12 aaelony: justin_smith: believe it or not, i don't use twitter... could someone who does tweet to let them know (in case they don't)?

19:13 Raynes: So, new question

19:13 For annotations, why no support for symbols that refer to strings?

19:13 Seems like an arbitrary limitation, but I could be wrong.

19:13 And if I am to dig into the 4 year long adventure of getting such a jira ticket entertained I want to make sure this isn't a silly idea.

19:14 mearnsh: so i'm still getting used to closures, can anyone explain why my fns in the let binding don't see the outer x https://www.refheap.com/93100

19:15 justin_smith: mearnsh: your fn bindings shadow x

19:15 mearnsh: the rules are that you only see the innermost binding

19:15 the fn is inside the let, so you don't see the let's x while inside a fn that takes x

19:16 mearnsh: perhaps you didn't mean for x to be in the args list?

19:16 mearnsh: ah..

19:16 amalloy: Raynes: have you read through the oracle docs on annotations? it looks to me like the only kind of thing you can have as the value of an annotation is a string

19:17 https://docs.oracle.com/javase/tutorial/java/annotations/

19:17 or numbers too, probably

19:17 mearnsh: justin_smith: that's it! ok nice. quite pleased with that code now

19:18 justin_smith: mearnsh: awesome, glad it worked

19:18 mearnsh: (4clojure problem 75)

19:18 ag0rex: amalloy: are you sure? I've seen lists of things as values for a Java annotation

19:19 amalloy: ag0rex: no, lists are definitely fine. i just mean the base type has to be string or number

19:19 justin_smith: mearnsh: much nicer than my answer

19:20 mearnsh: i totally wrote comprime instead of coprime in that refheap snip

19:20 probably a sign i should be asleep

19:20 justin_smith: mearnsh: woah, there is a .gcd method on biginteger

19:21 ,(.gcd (biginteger 88) (biginteger 1000))

19:21 clojurebot: 8

19:21 mearnsh: ah but the recursive implementation is so beautiful, i like to see it

19:21 justin_smith: heh :)

19:21 I just noticed the .gcd method scrolling through the answers of people I follow on 4clojure

19:22 mearnsh: hold on. 4clojure is giving me an error for this but it works in my repl

19:22 justin_smith: what's the error?

19:22 for one thing you can't defn in 4clojure

19:22 mearnsh: https://www.refheap.com/93102 https://www.4clojure.com/problem/75

19:22 ag0rex: amalloy: found this one: http://stackoverflow.com/questions/1458535/which-types-can-be-used-for-java-annotation-members

19:23 mearnsh: java.lang.RuntimeException: Unable to resolve symbol: gcd in this context

19:23 justin_smith: mearnsh: (fn gcd [...] ...)

19:23 you need to name your fn

19:23 err no

19:23 mearnsh: no

19:23 justin_smith: mearnsh: name the inner one

19:23 the one you bind to gcd

19:24 (let [gcd (fn gcd [...] ...) ...] ...)

19:24 mearnsh: why is that necessary

19:24 justin_smith: it can't call itself if it doesn't know its name

19:24 and the binding in the let block does not exist until after it's body is evaluated

19:25 you could replace the self call with recur I think

19:25 that's an even better solution

19:25 mearnsh: hmm it's broken

19:25 my code that is

19:25 justin_smith: what is?

19:26 mearnsh: see the recursive call to gcd two args are supplied

19:26 i think there's a missing partial or something

19:26 justin_smith: mearnsh: gcd should have an x arg

19:26 coprime? should not

19:27 and coprime? should be referencing x internally

19:27 clojurebot: excusez-moi

19:27 mearnsh: ok, got it, passes

19:28 a bit confusing but i'll get used to it. also weird that it works in my editor

19:29 justin_smith: mearnsh: because it referenced the preceding definition

19:30 mearnsh: ah...

19:30 indeed

19:30 justin_smith: yeah, sometimes your own repl history can bite you in the ass

19:30 mearnsh: (inc justin_smith)

19:30 lazybot: ⇒ 128

19:30 mearnsh: good lesson there

19:42 godd2: I'm having trouble understanding lazy-seq. In all the examples I've seen, lazy-seq recursively calls the function it's inside. But that function has a lazy-seq in it which has to call the function again. why doesn't it go on forever? After all, in order to "cache the result" it has to rely on the inner lasy-seq which has to cache its result, and so on and so forth. What am I missing?

19:43 Ken`: where is "for" defined?

19:44 godd2: clojure.core/for looks like

19:44 try (doc for) in your repl

19:45 justin_smith: $source for

19:45 lazybot: for is http://is.gd/x33p56

19:45 justin_smith: the bots know all

19:45 it's an eyefull, aint it

19:45 Ken`: thankls

19:45 thanks*

19:45 godd2: also keep a bookmark of the CLojure Cheatsheet: http://clojure.org/cheatsheet

19:48 verma: ,(def a 1)

19:48 clojurebot: #'sandbox/a

19:48 verma: hmm, bot here allows defs

19:48 justin_smith: one does

19:49 &(def a 1)

19:49 lazybot: java.lang.SecurityException: You tripped the alarm! def is bad!

19:49 oskarkv: godd2 read the docstring for lazy-seq :)

19:50 verma: I should allow defs on my slack bot, or configurable

19:50 godd2: oskarkv I have, but it doesn't make sense. How can it cache the result without causing an infinite recursion since the inner lazy-seq needs to cache also?

19:51 dbasch: godd2: it caches the result it realized, not the subsequent ones obviously

19:52 justin_smith: godd2: lazy-seq turns recursion into stepwise function execution, there is a function of zero args, called a thunk, generated for each tail. It is not called until the value it holds is asked for.

19:52 godd2: dbasch how can it be realized if the function it calls calls a lazy sequence which calls the function again?

19:52 oskarkv: godd2 the inner lazy-seqs will not invoke their bodies

19:53 {blake}: Is Immutant =required= to deploy a WAR to JBoss?

19:53 dbasch: godd2: that’s why it’s a lazy seq, it won’t call again until required to do so

19:53 godd2: oskarkv oh so the inner lazy-seq just doesnt exist?

19:54 justin_smith: godd2: it exists in the implementation as a promise that you know how to calculate the value later, if it is asked for

19:54 that is the laziness

19:55 godd2: but how can it cons against a lazy seq that it doesnt know the value of?

19:55 justin_smith: godd2: because it knows how to realize it, but also knows you don't need the value yet

19:55 godd2: or is this one of those implementation magic things I should worry about later

19:55 tcrawley: {blake}: nope, you can create an uberwar and deploy that to jboss, just like you can to any other servlet container

19:56 justin_smith: godd2: like I said, there is a special zero argument function called a thunk - until you ask the value all that is there is that function, after you ask for the value, the function is called to get the next element (and that element generates it's own thunk, etc. until you hit the end of the lazy-seq)

19:56 oskarkv: godd2 you can cons the result of a lazy-seq call because it's just a "promise"

19:56 amalloy: godd2: a lazy seq is, implementation-wise, a function that, when called, produces a value which is sequential

19:57 so you can cons onto that without having to call the function to get an actual value

19:57 {blake}: tcrawley, Huh. OK. So it's something ELSE I'm doing wrong. Thanx. =P

20:00 godd2: alright I think I'm coming to an understanding.

20:01 https://gist.github.com/nicklink483/38534fdbd8dec886a9ce

20:02 Is my logic sound there?

20:02 justin_smith: godd2: yeah, that looks right

20:02 godd2: I don't think lazy-seq is actually implemented using delay, but there is the function delay you can use to create deferred values, and playing with that a little may help your understanding

20:03 ag0rex: godd2: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LazySeq.java you can take a look on this

20:03 godd2: alright thanks a lot you guys :) I've been stuck for two days on that.

20:03 amalloy: godd2: yes, that is a reasonable explanation of what happens

20:03 oskarkv: godd2 http://clojuredocs.org/clojure.core/delay

20:03 turbofail: something something even streams vs odd streams...

20:04 mearnsh: is there a simple way i can make this lazy (cf. 4clojure #132, fails on the last test) https://www.refheap.com/93106

20:05 godd2: oskarkv I know a little about delays since I jumped ahead in Clojure for the Brave and True, but I decided to go back and read the whole thing so I don't miss anything.

20:05 {blake}: Hey! I actually got it deployed! Now, I would've thought the html/css/etc would all get packaged in the WAR, but if they're in there, they're not showing up on the site.

20:05 oskarkv: godd2 yeah well it's the same kind of thing :P

20:05 amalloy: mearnsh: the same way you make anything lazy: don't use loop/recur, instead use a recursive function with lazy-seq

20:06 replacing (recur (conj result x) whatever) with (cons x (call-myself whatever)), for example

20:06 mearnsh: i'll try, thanks

20:07 amalloy: and then returning nil at the end instead of result

20:11 mearnsh: i got it, ty https://www.refheap.com/93107

20:11 is that the best place to put the lazy-seq macro

20:12 seems to go anywhere

20:13 amalloy: that is the best place for it. generally you want it as close to the top of the function as you can get it

20:13 justin_smith: ,(= (cons 1 (cons 2 ())) (conj () 2 1)) ; mearnsh

20:13 clojurebot: true

20:14 mearnsh: oh yeah

20:14 amalloy said cons and i just blindly went along with it

20:15 justin_smith: cons is fine for one value- and conj is effectively cons if the collection is a seq, but it can take extra args

20:15 amalloy: justin_smith: actually what you're implying is not entirely true. of course (cons 1 (cons 2 ())) is just the same as '(1 2), but for non-empty x you'd rather use list* than conj

20:15 ie, (list* 1 2 x) is better than (conj x 1 2) if you're building a lazy-seq

20:16 justin_smith: amalloy: why's that again?

20:16 mearnsh: hm changing to conj seems to blow the stack here

20:16 amalloy: (inc amalloy) ; for being a genius

20:16 lazybot: You can't adjust your own karma.

20:16 amalloy: justin_smith: (conj x ...) calls seq on x

20:16 where x is a lazy seq, anyway

20:16 justin_smith: ahh, of course

20:16 which then has to see what x is...

20:16 mearnsh: ok got it

20:17 justin_smith: (inc amalloy)

20:17 lazybot: ⇒ 188

20:17 amalloy: whereas (list* 1 2 x) is really defined to be the same as (cons 1 (cons 2 x))

20:17 mearnsh: nice.

20:22 ag0rex: amalloy: why do you say conj calls seq on x?

20:23 ,(source conj)

20:23 clojurebot: Source not found\n

20:24 amalloy: ag0rex: note the caveat: where x is a lazy seq

20:24 oskarkv: godd2 https://www.refheap.com/93109

20:24 amalloy: the source of conj of course doesn't do any such thing, but it delegates to clojure.lang.IPersistentCollection/cons

20:24 and for LazySeq, the implementation of cons involves calling seq

20:29 ag0rex: amalloy: got it, the code you'd want to look at is in fact: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L605

20:30 amalloy: huh? no, it's https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LazySeq.java#L91

20:31 ag0rex: and that, yes, but conj is calling coll.cons() whereas cons returns new Cons(x, (ISeq) coll)

20:32 and coll.cons() for a LazySeq does the seq() that you pointed out

20:33 right? :-/

20:35 amalloy: right

20:35 godd2: It's the end of the world as we know it...

20:37 ag0rex: amalloy: thank you for clearing that out for me :)

20:58 devn: fastest way to deal with both sorted and unsorted collection types, so you can write /one/ function that will do both assoc! and regular assoc when appropriate?

20:58 csd_: How can I convert a boolean like (zero? (rand-int foo)) to a predicate for use in `filter`?

20:58 dbasch: csd_: do you want to filter randomly?

20:59 justin_smith: devn: wait, what's the connection of assoc! to sorted collections?

20:59 csd_: yes

20:59 devn: justin_smith: persistent!/transient

20:59 justin_smith: devn: transients are sorted?

20:59 I don't get it

21:00 dbasch: &(filter (fn [_] (zero? (rand-int 3))) (range 20))

21:00 lazybot: ⇒ (6 7 9 10 11 14 15 16 18 19)

21:01 csd_: i was trying to figure out how to do something like that

21:01 thx

21:01 dbash: what's the purpose of & instead of , with lazybot?

21:01 justin_smith: csd_: they are two different bots

21:01 csd_: ,(filter (fn [_] (zero? (rand-int 3))) (range 20))

21:01 clojurebot: (1 3 4 6 7 ...)

21:02 andyf: devn: Probably have a wrapper fn thst checks IEditable and calls transient if needed, then the 'main' fn that does the interesting stuff, passed an arg of either assoc or assoc!

21:02 justin_smith: what does "sorted" mean in this context?

21:02 amalloy: justin_smith: i expect he's thinking about the fact that clojure's sorted collections don't happen to support transient

21:03 justin_smith: ahh, that's the missing link, thanks

21:03 andyf: Wrapper fn would look similar to clojure.core/into

21:03 devn: andyf: yeah, im dynamically rebinding *assoc* right now to be whichever one i want. passing an arg seems better

21:03 justin_smith:

21:03 ,(let [sorted-m (sorted-map 1 2 3 4)] (persistent! (reduce-kv (fn [m k v] (assoc! m k v)) (transient (empty sorted-m)) sorted-m)))

21:03 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentTreeMap cannot be cast to clojure.lang.IEditableCollection>

21:04 devn: ,(let [hashm (hash-map 1 2 3 4)] (persistent! (reduce-kv (fn [m k v] (assoc! m k v)) (transient (empty hashm)) hashm)))

21:04 clojurebot: {1 2, 3 4}

21:04 devn: justin_smith: see also into

21:04 ,(source into)

21:04 clojurebot: Source not found\n

21:04 amalloy: ~def into

21:05 devn: ty

21:05 amalloy: i wonder if it'd be a good idea to write a lazybot rule to respond to ,(source x) with ~def x

21:06 justin_smith: $source into

21:06 lazybot: into is http://is.gd/caQYZB

21:06 andyf: Note into's handling of metadata, if that is important for your code. Transient discarda metadata

21:06 amalloy: oh, you updated the source link too, justin_smith?

21:06 devn: andyf: yeah, was just looking at that :)

21:06 amalloy: finally. i was getting tired of 1.2.1 or whatever

21:06 justin_smith: amalloy: it came along automatically with the clojure version

21:06 amalloy: reeeeeally?

21:07 huh, neat

21:08 justin_smith: amalloy: in src/lazybot/plugins/clojure.clj it uses *clojure-version* in the github-tag function to build the URL

21:08 amalloy: looks like that happened two years ago: https://github.com/Raynes/lazybot/commit/de03009369af9df71f2fecbde2768f844a674dfc

21:08 justin_smith: aha

21:09 amalloy: the last time i looked at that code it was hard-coded

21:09 justin_smith: amalloy: they grow so fast when you're not watching, don't they

21:11 devn: andyf: https://gist.github.com/devn/039ac6dbdb6587fa263d

21:11 any thoughts?

21:11 amalloy: justin_smith: https://github.com/Raynes/lazybot/commit/3849b68fb97ce8745896bea9c231b44cde16cfa3 is pretty good

21:11 finally giving up on ever having tests

21:13 andyf: devn: Looks good to me. Nice that you've got the empty calls in there

21:14 amalloy: devn: if you're using transients, i imagine you're aiming for maximum performance here, right? i wonder whether it'd be faster if you did something like (let [reduce-fn (if editable? (fn [m k v] ...) (fn [m k v] ...))] ...), rather than closing over the assoc-fn

21:14 i don't really have a good feel for what the cost of lookup up a closed-over local is, vs looking up a var, so either could be faster

21:15 devn: amalloy: yeah, you're probably right. i've been going back and forth here. i assume just having separate bodies and duping it out is probably faster, but the amount of duplication was kind of annoying. wanted to try and clean it up a bit. sort of fishing around at the moment for the best mix of performance and readability/reuse

21:16 amalloy: macrolet plz

21:17 devn: with the above, I could take reduce-fn as an arg, and make a bunch of map filtering/modifying fns that use persistent!/transient underneath

21:17 amalloy: (macrolet [(reducer [assoc-fn] `(fn [m# k# v#] (~assoc-fn ...)))] (let [reduce-fn (if editable? (reducer assoc!) (reducer assoc))] ...)) would avoid the duplication and the closure, if we had macrolet

21:17 devn: since the basic body of this thing won't change much between them

21:23 amalloy: huh. the stuff people get up to with their lazybot forks is funny. someone added a hodor plugin, which just replies to $hodor with "hodor"

21:24 the hello world of irc bots, i guess

21:24 Wild_Cat`: more like the hodor world, amirite?

21:25 amalloy: also, i would love for everyone in the world to give me write access to their github repos, so i can clean up the awful messy history they leave behind

21:25 somebody get on that

21:32 andyf: amalloy: How many repos would you _really_ spend time doing that for?

21:32 amalloy: fewer than all, more than none

21:33 andyf: So 1, then :)

21:33 amalloy: but really like...two. usually the awful history is unfixable, because it's part of the history of current HEAD

21:34 but sometimes it's like this huge tangle of branches and merges and whatever which all got totally abandoned or rebased into upstream, and you could make the graph prettier by just throwing it away

22:31 devn: could someone explain to me why (symbol-macrolet [def foo] (def def def)), expands to (def def foo)?

22:31 according to https://github.com/clojure/tools.macro

22:56 sm0ke: is erlang's `let it crash` equvivalent to simply not check for exceptions?

22:56 any java/clojure library based on this paradigm?

22:57 i mean not catch exceptions

23:09 Ken`: (eval `(let [~(symbol "x") 123] x))

23:09 this gives an error

23:09 I'm guessing this is due to lazy evaluation?

23:11 sm0ke: Ken`: does not make much sense, you are trying to evaluate something which is already being evaluated

23:11 Ken`: may be you want '(let ...) ?

23:11 Ken`: sm0ke: I know it's a silly piece of code.. I'm trying to learn quoting

23:11 sm0ke: well ` is for resoution ##`inc

23:11 lazybot: ⇒ clojure.core/inc

23:12 Ken`: I don't understand what you said

23:13 sm0ke: where as ' is shorthand for a list ##'(let [a 1] a)

23:13 lazybot: ⇒ (let [a 1] a)

23:13 sm0ke: compare this to `(let [a 1] a)

23:13 ##`(let [a 1] a)

23:13 lazybot: ⇒ (clojure.core/let [clojure.core/a 1] clojure.core/a)

23:14 sm0ke: which is probably not what you want

23:14 ,(eval '(let [a 1] a))

23:14 clojurebot: 1

23:15 technomancy: sm0ke: "let it crash" is insane without setting up a supervisor tree

23:15 TEttinger: technomancy!

23:15 I had some questions for you last night about lein plugins, but I think they're all resolved

23:15 sm0ke: technomancy: thought so, may be https://github.com/Netflix/Hystrix is something along same lines?

23:16 not sure

23:16 trx|2: ken`: I can't explain why but you need to use gensym for assigning let symbols in forms

23:16 technomancy: sm0ke: erlang-style supervisors are really only feasible in a language that imposes certain share-nothing constraints. I don't think you could do it well on the jvm.

23:17 rritoch: ,(eval (let [x (gensym "x")] `(let [~x 123] ~x)))

23:17 clojurebot: 123

23:17 Ken`: rritoch: ah, that helps

23:18 rritoch: Ken`: I also can't explain why, but you can also append # to your symbols which magically works

23:19 ,(eval (let [x# 123] x#))

23:19 clojurebot: 123

23:19 sm0ke: http://doc.akka.io/docs/akka/snapshot/scala/fault-tolerance.html

23:19 they talk about supervision and blah blah

23:19 rritoch: I'dlove to know why myself, I just know it works

23:19 err

23:20 sm0ke: rritoch: its a shorthand for gensym actually

23:20 rritoch: ,(eval `(let [x# 123] x#))

23:20 clojurebot: 123

23:20 rritoch: sm0ke: aah, thanks, I had no idea

23:22 godd2: rritoch: http://www.braveclojure.com/writing-macros/#6_1__Variable_Capture

23:25 sm0ke: Ken`: may be you wanted something like ##`(let [~'x 123] ~'x)

23:25 lazybot: ⇒ (clojure.core/let [x 123] x)

23:27 sm0ke: unhygeinic thought, not a good idea in most cases

23:28 technomancy: sm0ke: hm; well I'm skeptical but I haven't tried it

23:28 rritoch: godd2: Thanks, I haven't seen that before, it is a clear explaination of the issue. I just wish I had seen that sooner, I now have a lot of macro's to rewrite, lol

23:29 sm0ke: the correct usage should be ##(let [x (gensym)] `(let [~x 123] ~x))

23:29 lazybot: ⇒ (clojure.core/let [G__17949 123] G__17949)

23:30 godd2: rritoch don't feel bad. I don't know how to write macros or what they are yet, I haven't gotten that far into the tutorial

23:30 sm0ke: technomancy: akka api's are ugly mess of complexity

23:30 Ken`: sm0ke: thanks for your examples, certainly food for thought :)

23:30 sm0ke: but they are being used in some battle tested recognized projects though

23:30 like spark

23:31 which does not guarantee correctness though

23:32 rritoch: godd2: Well, there are only two major issues that I've run into with writing macros, symbol management and object handling. My "best friend" for maco's has been the unquote-quote... ~' which causes symbols to be resolved into the namespace they're used.

23:33 sm0ke: rritoch: that should be avoided in most cases :)

23:34 http://en.wikipedia.org/wiki/Anaphoric_macro

23:34 it breaks hygiene which clojure macros otherwise make sure to enforce

23:35 rritoch: and it does not `resolved into the namespace`

23:36 rritoch: sm0ke: ex. `(def ~'MacroDefinedVar "blah")

23:37 sm0ke: ,`(def ~'MacroDefinedVar "blah")

23:37 clojurebot: (def MacroDefinedVar "blah")

23:37 rritoch: sm0ke, and the unquoted-quoted value does expand into the macro users namespace

23:37 sm0ke: it keeps the symbol `as is`

23:37 rritoch: sm0ke, without the unquote-quote it would expand into the macro's namespace

23:37 sm0ke: nothing else

23:38 rritoch: sm0ke, which is very useful when your implementing automatic code generation, such as filling in default methods for gen classes

23:38 sm0ke: yes doing a (def ..) inside a macro is not usual

23:39 but I did say `avoided in most cases`

23:39 not all

23:40 rritoch: sm0ke, the advantage of LISP is it's AI capabilities, and the unquote-quote is a VERY common AI implementation for automatic code generation.

23:40 sm0ke: that does not make any sense to me

23:40 how can you tie unquote-quote to AI!!

23:41 rritoch: Because the fundamental goal of AI is to get the system to program itself

23:41 sm0ke: :D

23:43 godd2: rritoch writing code != programming ;)

23:43 though I suppose you could say it's a necessary condition.

23:44 rritoch: godd2: I've been programming for 30 years, and if your excluding "programming" IC's, when it comes to computers, writing code = programming.

23:44 godd2: IC programming is the only exception, because it is writing code + burning that code into the device

23:46 godd2: I guess what I'm saying is, if I wrote a program that spit out random characters into a file that happens to be able to compile, you'd be hard pressed to say that my program was "programming"

23:47 rritoch: godd2: Actually, it is programming. What your referring to is an actual AI development practice, though it hasn't yet worked to my knowledge.

23:47 godd2: I'd argue that programming is a layer of abstraction which requires intent.

23:47 rritoch: godd2: It is based on http://en.wikipedia.org/wiki/Infinite_monkey_theorem

23:47 godd2: yes, the chimps and shakespear came to mind haha

23:47 sm0ke: rritoch: wow you call that AI?

23:48 rritoch: godd2: I've yet to see a useful implementation of the infinite monkey theorem, but it has been tried many times

23:48 godd2: bitcoin blockchain hashes?

23:48 :P

23:48 rritoch: sm0ke: If a code can exist that is self-aware, than a random code generator would EVENTUALLY reach that code.

23:49 sm0ke: It has been tried many times and hasn't yet worked.

23:49 godd2: rritoch you have a point. after all, evolutionary theory suggests that the formation of intelligence does not require intent

23:50 sm0ke: rritoch: oh may be it `will` work, just that no one bothered till `EVENTUALITY`

23:50 godd2: however, evolutionary theory does require selection pressure. and 'random' is not a pressure

23:51 rritoch: Anyhow, I now feel like a dinosaur, these were the BIG things when I started programming, today they've been reduced to urban legends, lol

23:52 sm0ke: wow 30 years is a lot!

23:52 did you get fed up of it at some point?

23:53 rritoch: sm0ke: worse than that. I worked for a manhattan based marketing research company and ended up with a heart-arythmia from the stress, so I was out of the industry for almost 9 years, excluding my pet-projects.

23:54 sm0ke: That's when I moved my focus from programming to web development, (less stress).

23:54 sm0ke: why not management and stuff like that?

23:55 i guess it more stress there?

23:55 rritoch: sm0ke: I was an IT/MIS manager, everything had to be repaired yesterday

23:55 sm0ke: :D

Logging service provided by n01se.net