#clojure logs

2014-11-10

00:00justin_smithstapler: lein is not as reliable on windows as osx/linux, but it does work
00:00justin_smithdepending on what you mean by "in a box"
00:01justin_smithand 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
00:05justin_smithstapler: that clojure-box project uses pretty outdated stuff, and does not include lein
00:06TEttingerleiningen installer for windows should be enough
00:06TEttinger^ stapler
00:06justin_smithyeah
00:06justin_smiththat clojure-box thing hasn't been updated in years, and ships with slime and swank
00:08rritochTEttinger: Does such a thing exist?
00:08justin_smithhttp://leiningen-win-installer.djpowell.net/
00:09justin_smithI wonder what lein version that is though - installer version is 1.0
00:09TEttinger(inc justin_smith)
00:09lazybot⇒ 126
00:09rritochI think it would also be helpful if lein could autogenerate a .exe, .bat, and .sh for simpler windows deployment of clojure apps.
00:10seancorfieldI use lein on win from that installer. It's 2.something but I don't remember what
00:10justin_smithrritoch: nobody on the leiningen dev team uses windows natively
00:10TEttingerrritoch, there is a .bat generator but it won't work well on client computers (it requires java to be on the path)
00:10justin_smithseancorfield: well any 2.x can update, so that should be fine
00:10TEttingerI wonder what it takes to make a lein plugin
00:10seancorfieldNot many Clojure folks use windows period
00:10justin_smithself-update that is
00:10justin_smithseancorfield: exactly
00:10TEttingerseancorfield, I do
00:10seancorfieldLein plugins are easy
00:11seancorfieldI wrote one to compile Frege code the other night
00:11staplerso uh
00:11staplerwhat should i do here
00:12justin_smithstapler: use that leiningen isntaller I linked
00:12justin_smithlein is the thing
00:13justin_smithhttp://leiningen-win-installer.djpowell.net/
00:13staplerjustin_smith: java se 7u71, right?
00:13rritochjusting_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.
00:13justin_smithstapler: lein is the standard clojure dependency manager / dev launcher, it can handle everything else except your editor etc.
00:13justin_smithstapler: any java 1.5+ is fine
00:14justin_smithrritoch: all you need is a jar, if anything it's windows that is more complicated
00:14justin_smithI mean I guess a launcher script is nice to have
00:14justin_smithrritoch: I never run lein, I use it locally to package up
00:15justin_smith*never run it on the client machine, that is
00:20TEttingerseancorfield: is there a skeleton plugin you used?
00:20TEttingeror an existing lein template?
00:20TEttingerI might try to make a plugin for Packr tonight
00:21justin_smithTEttinger: lein new plugin foo
00:22justin_smiththere is a plugin template
00:22TEttingernice!
00:22justin_smithI really wish that templates were easier to search for, and could be explicitly versioned
00:46TEttingerso the plugin I have in mind is a simple wrapper around a kinda-complex executable jar, https://github.com/libgdx/packr
00:46TEttingerwhere would it be considered kosher, if anywhere, to place downloaded JREs so they can be reused by the plugin?
00:47justin_smithhmm
00:47justin_smithunder .lein/ ? or is that invasive
00:47TEttingerI mean you could just get them yourself and pass a path
00:47TEttingerbut it's another step
00:48justin_smithTEttinger: under .m2/ would mean people would actually expect big cached things to be there, but would also be weird
00:49TEttingerI could distribute them with the plugin, which would mean ~250 mb plugin downloads
00:49justin_smithTEttinger: what about downloading at build time, unless config specifies a specific location?
00:50justin_smithand then downloading to a cached location, ideally
00:50justin_smithgetting 3 jvms downloaded because I added a plugin to my deps seems weird
00:53pdkwhat's wrong with that
00:53pdk3 times the enterprise
00:56seancorfieldTEttinger: for the Frege plugin I mostly borrowed from the javac plugin. I think you can do: lein new plugin myname
00:56seancorfieldThat will get you started
00:57seancorfieldAh justin_smith got you that already. Sorry I was on the train.
01:02TEttingerjustin_smith, yeah but where to cache...
01:03justin_smith~/.[plugin name]-cache/ maybe?
01:03clojurebotexcusez-moi
01:04TEttinger~/.lein-packr/cache , perhaps?
01:04clojurebotI don't understand.
01:06justin_smithTEttinger: 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
01:07justin_smithTEttinger: but either would work, for sure
01:07TEttingergood point
01:27arrdemhttp://stackoverflow.com/questions/26837655/conditional-threading-through-expressions
01:28arrdemmy gut is (as-> .. .. (cond->) (cond->)). better ideas?
01:28arrdemsince my own update-when isn't in core :P
01:28TEttingerI can't believe I've never run into this yet -- is there a clojure standard lib fn for downloading a file?
01:28justin_smithdon't they just want cond?
01:29arrdemjustin_smith: issue is it's to sequential conditional updates
01:29justin_smithTEttinger: clj-http is already in lein
01:29arrdemjustin_smith: where the predicates are over the value to be updated
01:29justin_smitharrdem: ahh, yeah
01:29arrdemTEttinger: the JVM will let you slurp a URL :P
01:29justin_smitharrdem: slurp is not so great for binaries
01:30arrdemjustin_smith: there are other URL readers I think..
01:30justin_smitharrdem: slurp uses reader, which is for text, you want input-stream for binary data
01:31luther07 /leave
01:32justin_smithTEttinger: 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}))
01:32justin_smiththen you can write the byte array, though there is probably a way to put it straight into a file directly
01:33justin_smithwhere client is clj-http.client, which, if you are in a lein process, is already loaded
01:35arrdemI have a better answer for this :P
01:35arrdemhttps://github.com/arrdem/detritus/blob/master/src/detritus/update.clj#L73
01:36justin_smithTEttinger: probably better to use {:as :stream}, and use that in an arg to a file writer actually
01:36TEttingerneat
01:37TEttingerwhat namespace is client there, justin_smith?
01:37justin_smithclj-http.client
01:37justin_smithI thought I said that?
01:38TEttingeroh yes
01:38TEttingerhaha
01:43TEttingerhttp://stackoverflow.com/a/11321748 seems to be the trick
01:44justin_smithit seems like :as :stream would be more straightforward though...
01:44justin_smithI mean the rest could stay the same I think
01:45justin_smithI was doing what I did because I wanted to base64 encode the file
01:45justin_smithfor stupid reasons
01:46TEttingerhm, that answer does seem like it ignores :as :stream
01:46TEttingerdo I just call .write on the stream or what?
01:46justin_smithTEttinger: yeah, .write on the file, with stream as the arg
01:46justin_smithshould work
01:49justin_smithTEttinger: never mind, just use the :bytes
01:49justin_smithI was wrong
01:49TEttinger?
01:49TEttingerwhat's wrong with stream?
01:50justin_smithno matching method found every time I try it
01:55justin_smithyeah, I looked for other options, :bytes is actually the best bet
02:02TEttingerhm, is it reasonable for one plugin to call the uberjar plugin that's built in?
02:02TEttingerI mean, it might not stay built in?
02:19godd2You guys, I figured out a solution to the problem of mutable output: http://i.imgur.com/iOpg64z.png
02:19justin_smithheh
02:20justin_smithgodd2: if time is first class, output is not mutable
02:21godd2Einstein was on to something...
02:27TEttingerodd. is there any way to change uberjars from having :uberjar-name suffixed with -standalone ?
02:27TEttingerhttps://github.com/technomancy/leiningen/blob/master/src/leiningen/jar.clj#L210-L216
02:27TEttingerI'm trying to get the exact name of the uberjar and :uberjar-name won't be it
02:34godd2TEttinger did you try with-profile? http://stackoverflow.com/questions/19334454/create-multiple-uberjars-in-leiningen
02:35godd2(dunno if that works, but looks promising)
02:37TEttingergodd2, good catch, but reading the code, it looks like that would generate "uberjar1.jar-0.1.0-standalone.jar"
02:38TEttingerhttps://github.com/technomancy/leiningen/blob/master/src/leiningen/uberjar.clj#L138 always passes :standalone
02:38TEttingerI could be missing something here
02:40godd2TEttinger 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
02:41TEttingerI wonder if I could use uberjar itself, the fn returns the name of the generated standalone jar
03:50TEttingerso #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
03:50TEttingersomething like doto ?
03:50TEttingerdoto and just set! ing each field?
03:53dc_TEttinger: deftype? i'm sure you know better than me
03:54TEttingerit just seems like doto and set! seems so lousy
03:58Glenjaminmaybe there's something in http://clojure.github.io/java.data/ ?
03:58Glenjaminthe docs seem pretty bad
04:10amalloyTEttinger: you can at least write a macro that converts (init (Packr.) x 1, y 2) to (doto (Packr.) (set! x 1) (set! y 2))
04:11TEttingeryeah, I should really learn how to write macros
04:11TEttingerbeen saying that for about 2 years
04:12TEttingerah, 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";
04:13TEttingerI'm getting the package from leiningen's :main
04:14TEttingerwhich is something like com.my.class.desktop-launcher , and Manifest.MF has com/my/class/desktop_launcher
04:15TEttingeris this a simple regex, or is it weirder?
04:28TEttingeris there a list somewhere of valid characters for clojure namespaces, and what they map to in the .class files they generate?
04:29TEttingercould i have (ns !!!)
04:34TEttingeramalloy: any ideas for this namespace thing?
04:46TEttinger,(clojure.lang.Compiler/munge "com.my.class.desktop-launcher")
04:47clojurebot"com.my.class.desktop_launcher"
04:47TEttinger,(clojure.lang.Compiler/demunge "com.my.class.desktop-launcher")
04:47clojurebot"com.my.class.desktop-launcher"
04:50TEttinger,(clojure.lang.Compiler/demunge "!!!")
04:50clojurebot"!!!"
04:50TEttinger,(clojure.lang.Compiler/munge "!!!")
04:50clojurebot"_BANG__BANG__BANG_"
04:53TEttinger,(clojure.lang.Compiler/munge "com/my/Desktop_Launcher")
04:53clojurebot"com_SLASH_my_SLASH_Desktop_Launcher"
04:53TEttingerhm
04:54hyPiRion,(clojure.lang.Compiler/demunge (clojure.lang.Compiler/munge "!!!"))
04:54clojurebot"!!!"
04:55TEttingerhyPiRion, do you have any ideas for this?
04:55TEttingerconverting a class with the syntax namespaces use in clojure, to a Main Class for a Manifest.MF
04:57hyPiRion,((comp #(.replace % \. \/) munge) "com.my.class.desktop-launcher") or something
04:57clojurebot"com/my/class/desktop_launcher"
04:58hyPiRionBut I don't think there's anything built in
04:59TEttinger(inc hyPiRion)
04:59lazybot⇒ 54
04:59TEttinger(inc hyPiRion a thousand times)
04:59lazybot⇒ 1
05:00hyPiRion(identity hyPiRion a thousand times)
05:00lazybothyPiRion a thousand times has karma 1.
05:23zotis 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.
05:23kungizot: there is mapv for that
05:24kungizot: but this is the wrong answer
05:24clgvzot: you dont need (map vec ...) in there. just the `partition` expression suffices
05:24kungi,(into {} (partition [:a 1 :b 2]))
05:25clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/partition>
05:25zotnot in my repl :/
05:25clgv,(into {} (partition 2 (range 8)))
05:25clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Map$Entry>
05:25clgvoh interesting
05:25zot,(into {} (partition 2 [:a 1 :b 2]))
05:25clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry>
05:25Glenjamin,(partition 2 [:a 1 :b 2])
05:25clojurebot((:a 1) (:b 2))
05:25zotsorry for the dup
05:25Glenjaminwhat, why doesn't that work
05:26hyPiRionzot: ##(apply hash-map [:a 1 :b 2])
05:26lazybot⇒ {:b 2, :a 1}
05:26hyPiRiona Clojure list isn't a clojure map entry, whereas a vector is. (Don't ask me why that is)
05:27zothyPiRion: that's definitely an improvement.
05:27zotyeah, that's what i found odd
05:27kungihyPiRion: Maybe because it is missing random access?
05:27zotmaybe it doesn't want to call (count)
05:27zotto confirm the length?
05:28hyPiRionzot: Yeah, that may be it.
05:30clgv,(-> [] class ancestors)
05:30clojurebot#{java.lang.Runnable clojure.lang.Indexed clojure.lang.IEditableCollection clojure.lang.APersistentVector clojure.lang.IPersistentVector ...}
05:30zotalthough, it feels like converting via (take 2) doesn't cost that much… but i'd be curious
05:30clgv&(-> [] class ancestors)
05:30lazybot⇒ #{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
05:31clgvso well a vector isnt a map entry ... ;)
05:31hyPiRionzot: Oh right, I remember now
05:31hyPiRion,(seq {:a 1 :b 2})
05:31clojurebot([:b 2] [:a 1])
05:31hyPiRion,(conj {} (seq {:a 1 :b 2}))
05:31clojurebot{:a 1, :b 2}
05:32hyPiRionit's a very strange quirk with Clojure itself I don't fully understand.
05:32zoti don't follow what your example demonstrates
05:32clgv,(mapv class {:a 1 :b 2})
05:32clojurebot[clojure.lang.MapEntry clojure.lang.MapEntry]
05:33hyPiRion,(into {} [{:a 1 :b 2} {:c 3 :d 4}])
05:33clojurebot{:b 2, :a 1, :c 3, :d 4}
05:33hyPiRion,(into {} [(seq {:a 1 :b 2}) (seq {:c 3 :d 4})])
05:33clojurebot{:b 2, :a 1, :c 3, :d 4}
05:41zotunexpected and interesting.
05:41zotinto does more than i knew
06:10eiffel19: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
06:10eiffeldic 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
06:10eiffel 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
06:10eiffele 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
06:10eiffelokon 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
06:10eiffelburd 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
06:10eiffelref 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
06:10eiffelanj 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
06:10eiffel 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
06:10eiffelmdeboard 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
06:10eiffeludd 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
06:10eiffelupnik__ 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
06:10eiffelsaurik 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
06:10eiffeleve^ 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
06:10ddellacostaer
06:10godd2wth
06:10alanpearce:(
06:10rshetty_Hey wtf
06:10majohehlo
06:10r4vilol
06:10noncomwho cares anyway..
06:10ordnungswidrigops, please.
06:10rshetty_rofl
06:10ohpauleezyeah, someone's bot. Ops will add it to the list
06:11noncomhey, i actually like this bot..
06:11majohcould be messed up copy paste
06:11FrozenlockIt's this time of the year already?
06:11majohlooks like output from irssi
06:11ddellacostaI suspect the ops have been woken up by that
06:11noncomit made up is all gather here like good old friends
06:11majohor nah,
06:11majohban that shit
06:11Glenjamini think JSON voorheez wins best nick
06:12godd2If I knew it was a contest, I would have put mroe effort in
06:37hyPiRion0 days since last ERC incident.
06:38clgvhyPiRion: ERC?
06:41hyPiRionemacs IRC client
06:41clgvah ok.
06:41hyPiRionThat sort of output happens from time to time in #emacs.
06:44kungiI heard someone is wrong on the internet ... let's gather!
07:41clgvdoes test.check have gen/double or something similar?
07:53hyPiRionclgv: http://dev.clojure.org/jira/browse/TCHECK-5
07:53hyPiRiontl;dr (def float (gen/fmap float gen/ratio)) is usually okay
08:09clgvI used a modified "ratio" since I only want positive values
08:10justin_smithhyPiRion: why not double instead of float?
08:31hyPiRionjustin_smith: why not indeed.
08:42irctcBeginner to Clojure here
08:42irctchow do I loop from 1-12 using loop-recur and not dotimes?
08:44hyPiRion,(loop [i 1] (if (<= i 12) (do (print i " ") (recur (inc i)))))
08:44clojurebot1 2 3 4 5 6 7 8 9 10 11 12
08:44alhimik45why not "when" instead if?
08:45justin_smithalhimik45: because there are two options there
08:45justin_smithoh wait, not really
08:45hyPiRionalhimik45: sure, when works just as good here
08:53Glenjamini only realised this weekeend that a third form in when isn't an else clause
08:53Glenjaminmakes so much more sense now
08:53justin_smithGlenjamin: and a fourth form is possilbe
08:53justin_smith*possible
08:54Glenjaminpresumably it expands to (if cond (do ~@body))
08:54Glenjamin,(macroexpand '(when x 1 2 3))
08:54clojurebot(if x (do 1 2 3))
08:54Glenjaminheh
08:54justin_smith$source when
08:54lazybotwhen is http://is.gd/epz1Ep
08:54justin_smithGlenjamin: pretty much that
09:01borkdudewhat is the coolest/shiniest OO language if you're forced to do OO?
09:01rweirrust
09:01justin_smithclojure
09:02justin_smithocaml is pretty cool too, it has an o right in the beginning of the name
09:08ddellacostaborkdude: haskell
09:09borkdudegreat answers so far...
09:09ddellacostareally want to check out rust actually, looks interesting
09:09nathan7Well, if you want OO, obviously the answer is Common Lisp q=
09:10borkdudesetq
09:10borkdudeCLOS
09:10ddellacostathe problem that remains, however, is that you have to figure out what OO means
09:10borkdudeI was hoping someone would say Ruby, cuz that's what I'm learning now :P
09:10nathan7oh god Ruby
09:10nathan7Dunno, I'm a JS fan
09:10ddellacostaborkdude: I did Ruby for a while. It has some bad parts and some good parts
09:11nathan7as far as I'm a dynamic languages fan today
09:11ddellacostanathan7: if you say "oh god Ruby" then turn around and say "I'm a JS fan..." well, let's just say I'm confused
09:11borkdudeddellacosta yeah me 2 =)
09:11nathan7ddellacosta: Ruby is the land of people who believe they're writing Good and Beautiful code because it's in Ruby
09:11borkdudeI'm learning it because of a work project
09:12ddellacostanathan7: okay, if we're just talking about the community, then you have a point there, no disagreement
09:12nathan7ddellacosta: JS folk are really weird people who are aware they're crazy
09:12nathan7ddellacosta: and we have a damn good time
09:12nathan7ddellacosta: I'm giving a talk at a JS conference… about my Rust project. not a word of JS.
09:13ddellacostayeah, I gotta agree, I'll take the JS community over Ruby any day of the week.
09:13borkdudeJS folks are nicer than I would have thought. I met a bunch of them recently
09:14ddellacostayeah, seems like there are more women in JS too, but maybe that's just based on anecdotal data
09:14ddellacostamaybe part of the reason is that JS folks aren't just all about JS
09:14ddellacostakinda silly to identify so strongly with a language anyways
09:15borkdudeyeah ;)
09:21m1dnightwhat woul dbe more idiomatic: shadow a variable or use dynamic binding and set?
09:21m1dnightI need to put a flag in my environment per thread
09:21m1dnightand some expression (that expand by macros) will need to change the value for inner expressions of that expression
09:21FenderHey 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)
09:21FenderThen 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?
09:22m1dnightFender: I had the same issue. Always open the file that requires the namespaces before you start your repl
09:22m1dnightthat solves it for me
09:22clgvm1dnight: what?
09:22Fenderlike one big file that requires everything?
09:23clgvFender: you mean you translated underscores in the ns name correctly, i.e. "-" to "_"?
09:23Fenderyep
09:23m1dnightFender: 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
09:23clgvsame project or in a dependency?
09:23m1dnightif I open core.clj after I started the repl nothing compiles
09:23Fenderactually, the error occurs when I compile a core file
09:24Fenderthe project is consists of merged src-dirs of two projects
09:24m1dnighttry what I said, see if that works (close emacs, cider-restart doesnt do it)
09:24Fenderwhich up to then compiled fine
09:24Fendersource-paths in leiningen is set
09:24m1dnightnamespaces map to directory structure? I think that is required
09:24clgvthat sounds strange
09:25clgvyou have to be more specific with respect to file system layout and namespaces naming that is used in your project.
09:25clgvthere is definitely something wrong with it
09:25m1dnightclgv: I have the same issue, as I said.
09:25Fenderso, midnight, I'd do it via dynamic bindings, however, IMO best is always to pass kind of a context object around
09:27Fenderclgv, 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
09:27Fendernow when I compile ccc (the "master" project), it tells me that aaa.something cannot be compiled
09:27Fenderwhich in return refers to bbb.somethingelse
09:28clgvFender: the perts of the namespace must not be mentioned in the source-path vector
09:28clgv*parts
09:28Fenderso "src" is suffcient?
09:28clgvyes
09:28Fenderthat's what I had before so I tried the other one
09:28Fenderhowever, it doesnt work either
09:29martinklepschI'd like to apply enlive's `at` macro. i.e (apply #(html/at html-res %) '([:div] trans [:head] trans2))
09:29clgvFender: you have to restart your repl
09:30martinklepschis there a way to do this?
09:30Fenderok, 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
09:30m1dnighthave you tried what I said, Fender ?
09:30clgvif 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 ;))
09:30Fenderso, restarted it and tried what both of you suggested and it doesnt work
09:30m1dnightweird
09:30Fenderwell, just a sec
09:31Fenderreally first CC MJ and then and only then open the file?
09:31clgvFender: just forget about the emacs stack for a moment until you get it running - use only lein repl for now
09:31sveriHi, 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
09:31Fendergood idea, I didnt think of that
09:31m1dnighthmm, wat clgv says is probably even a better idea. If it compiles fine in leiningen you can worry about emacs
09:32m1dnightalso, I *think* that if your namespace in a file in ../aaa/file.clj is aaa.file.clj, it is wrong
09:32m1dnightI think it should be projectname.aaa.file, no?
09:32m1dnightat least, that is the case with me
09:32m1dnightwait no, scratch that
09:33Fenderok, so if I (require '[aaa.sss]) I get NoClassDefFoundError Could not initialize class
09:33clgvno. namespace "my.lib.core" must be in file "my/lib/core.clj"
09:33m1dnightyes you are right clgv I was mistaken :)
09:33Fenderbut if I slurp the file it works
09:33Fender(slurp "src/aaa/sss.clj")
09:33m1dnightdoes it work fine in lein run?
09:33clgvso where exactly is "aaa.sss" relative to your project root (the folder containing the project.clj)?
09:34Fenderas given in the slurp
09:34hfaafb!r7 $(!action $(!t $ git $noun -$(!lower $(!t $cons$cons)) "$(!o %*)"))
09:34hfaafboops mistell
09:34clgvand "src" is the source path?
09:34Fenderyep
09:34FenderI removed the source path statement
09:35clgvok
09:35Fenderok, lein run gives me something
09:35FenderCaused by: java.lang.NoClassDefFoundError: clj_time/core/DateTimeProtocol
09:35clgvhow does the "ns" statement of that file look like?
09:35clgvFender: ha! one of your supposed deps seems to be missing
09:35Fenderlein deps should have done the trick
09:35Fenderit didnt though, any idea?
09:36clgvdid you add clj-time with the correct version to your project.clj?
09:36Fenderyes but I use lots of libs and maybe they require some older version
09:36FenderI use the newest 0.8.0
09:37clgv"lein deps :tree" will tell you
09:38Fenderok, clj-time occurs only once
09:38clgvwith the correct version?
09:38Fenderyep
09:39martinklepschI 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
09:40martinklepschHow can I make that macro accept a list as a third argument?
09:40FenderIll delete clj-time in .m2
09:40vermawhy 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 :(
09:41vermaI do have (paredit-mode t) in my ~/.emacs
09:41Fenderdidnt help
09:41kungiverma: Is paredit active in the current buffer?
09:41clgvFender: should that class exist?
09:42vermakungi, sorry total noob with emacs, how do I check?
09:42Fenderwell, I doubt I use it directly
09:42clgvdo you use it explicitely in your souce? if so, why?
09:42Fenderbut Ill check
09:42kungiverma: Look at the bottom line where all the modes are. Is "Paredit" there
09:42Fendergrep -r returned nothing
09:43vermakungi: no, that's a minor mode right?
09:43Fenderbut I do use some classes there
09:43Fenderlemme se
09:43kungiverma: yes
09:43kungiverma: Then do M-x paredit-mode
09:43vermakungi, Clojure cider Projectile Undo-tree
09:43kungiverma: to turn it on :-)
09:43vermaoh ok
09:43vermaok
09:43verma:)
09:43ag0rexverma: or M-x enable-paredit-mode
09:44Fenderhmmm, I need to go now
09:44vermanice kungi ag0rex :) it shows up there now, how do I always enable it by default?
09:44Fenderanyhow, thanks already, the problem is now at least living in a smaller scope
09:44kungiverma: Add it to your clojure-mode-hook
09:44Fendermaybe I return later to ask more questions
09:44vermamuch nice, kungi ag0rex, its working as expected with it enabled.
09:45vermakungi: ok, checking
09:45Fenderthx clgv and m1dnight
09:45kungiverma:
09:45kungi(defun turn-on-paredit () (paredit-mode 1))
09:45kungi(add-hook 'clojure-mode-hook 'turn-on-paredit)
09:45ag0rexverma: btw, did you run cider-jack-in?
09:45kungior maybe (add-hook 'clojuret-mode-hook 'enable-paredit-mode)
09:45vermahmm, nice, doing that one second
09:46vermaag0rex, I do have that running, yes
09:46clojurebotTitim gan éirí ort.
09:46kungiI think clojurebot is trying to summon the elder things ...
09:46ag0rexverma: for instance, i have a hook to enable paredit mode only after cider starts
09:46vermaon the repl buffer?
09:46ag0rexverma: (add-hook 'cider-repl-mode-hook 'paredit-mode)
09:47vermaag0rex, that is different from when I just want it enabled on a source file right?
09:48vermamuch nice
09:48verma(inc kungi)
09:48lazybot⇒ 1
09:48verma(inc ag0rex)
09:48lazybot⇒ 1
09:50ag0rexverma: i looked up right now and i have a clojure-mode plugin installed that does that
09:50vermaag0rex, nice, what plugin is that?
09:50ag0rexverma: clojure-mode
09:51vermaag0rex, I think I have clojure-mode, but it doesn't enable paredit by default
09:53m1dnighthttps://www.refheap.com/93057 # Isn't this supposed to erturn false?
09:53m1dnightI run the thread with a binding, but it doesn't "take" it?
09:55clgvm1dnight: if you use futures your bindings are kept. if you use threads manually you have to make sure to keep them yourself
09:55m1dnightwell, I also tried putting the binding around the #(actor-func..) part, but that doesn't work either
09:55m1dnightor what do you mean?
09:56clgvm1dnight: you can lookup the future implementation for the details how this can be achieved - but why do you insist on creating a thread manually?
09:56vermasorry 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
09:57m1dnightbecause it's part of my thesis and I require seperate threads
09:57m1dnightI can try using futures though, but last time that didnt work
09:57m1dnightverma: hold on, I have a setting for that
09:57clgvm1dnight: well, than look up the way `future` conveys bindings
09:58clgvm1dnight: it is not that difficult
09:58m1dnightverma: https://github.com/m1dnight/dotfiles/blob/master/emacs#L26
09:59m1dnightclgv: I just found it
09:59m1dnightbut (get-thread-bindings) etc, right?
09:59m1dnightI'll give it a shot
09:59vermathanks m1dnight!
09:59verma(inc m1dnight)
09:59lazybot⇒ 1
09:59m1dnightwoo \o/
10:01clgvyeah
10:02vermam1dnight, works great, thanks! changed your stuff a bit to do one line scroll at a time instead of 3
10:02m1dnightyeah, i found that too tiresome after a while, so 3 lines is a bit better imo
10:03vermam1dnight, nice, will try it for a while and see how it goes :)
10:05winkso 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:11zerokarmaleftwink: with-connection is part of the deprecated java.jdbc library
10:11zerokarmaleftdid you upgrade to 0.3.0+?
10:12winkzerokarmaleft: ah, didnt know that. I think it bumped clojurew to 1.6
10:13winkzerokarmaleft: thanks. then I can probably figure out the rest.
10:13zerokarmaleftrather, the deprecated API of java.jdbc
10:13winksneaky thing is that I think the app does only use korma, only this manual task uses this. so I didnt notice. doh.
10:33vermait'd be nice to get clojurebot like integration with slack
10:33vermaso I can randomly inject clojure in conversations
10:33vermaslowly manipulating everyone to love clojure
10:33verma:P
10:34vermaguess I could use clojurebot as a starting point
10:42verma,(println (range))
10:42clojurebot(0 1 2 3 4 ...)\n
10:42verma:P
10:43vermaclojurebot is smarter about this compared to tryclj
10:46jebberjebexit
10:46jebberjebsigh
10:47justin_smithverma: I bet you could do something simple with shell calls to grench
10:47vermagrench?
10:48justin_smithit leaves a single clojure process running, and each shell call to grench gets a result from that nrepl server
10:48justin_smithso it's not for a normal project, but if you want to eval a random line of clojure code, it's perfect
10:48vermagrenchman?
10:48justin_smithright
10:48vermanice!
10:48vermatrying it out
10:49justin_smithverma: clojurebot uses a sandbox, grenchman does not
10:49justin_smithbut if you are only using it locally, you likely don't need a sandbox
10:50csd_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:50vermajustin_smith, I will most likely host it somewhere and make it available to a bunch of users
10:50vermabut a closed list of users
10:52justin_smithverma: then you may want to check out clojail
10:52justin_smithwhich is what lazybot uses
10:52justin_smithI forget what clojurebot uses
10:53vermawhat's the difference between the two bots?
10:54clgvclojurebot: probably uses clojail similar to lazybot?
10:54clojurebotIt's greek to me.
10:54clgvoops. -":"
10:57vermayeah clojail looks nice
10:57vermatesting it out
10:58EvanR,'[a ;b c]
10:58clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
10:59EvanRcan i comment out a line within a quoted vector
11:00joegallo,'[a #_b c]
11:00justin_smithEvanR: absolutely
11:00clojurebot[a c]
11:00justin_smith#_ is handy too
11:00justin_smithbut in a multi line vector you can use normal ;; comments as well
11:01csd_How do you do recursion properly in Clojure when things are recursing exponentially rather than linearly?
11:01EvanRi dont think it worked
11:02justin_smithEvanR: got a paste?
11:02EvanR,'[a\n ;b\n c]
11:02clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
11:02justin_smithEvanR: well that's a comment to end of line, of course that won't work in clojurebot
11:02EvanRyeah
11:03justin_smith,(read-string "'[a\n;b\nc]")
11:03clojurebot(quote [a c])
11:03justin_smithso that's not what you want?
11:03EvanRit is
11:03EvanRi think i figured it out
11:04EvanR,'[a #_?b c]
11:04clojurebot[a c]
11:04EvanRi didnt comment out everything i needed to
11:06justin_smith#_ is handy because it comments balanced expressions
11:07justin_smith,'[a #_{:b 0 :c 1 :d [1 2 3]}]
11:07clojurebot[a]
11:07Bronsaand it also stacks
11:07Bronsa,[#_#_a b 1]
11:07clojurebot[1]
11:07justin_smithyeah that's werid
11:07justin_smith*weird
11:09dnolen_cd_: do you mean "mutually recursive"? It's not well supported - closest you get is trampoline and it's a bit ugly.
11:09csd_ I have a cyclic graph, and I'm trying to identify which nodes are islands
11:09EvanRletfn
11:10dnolen_csd_: ^
11:10dnolen_csd_: yes using an atom to track is typical
11:10dnolen_and simpler IMO
11:10csd_OK yeah it seemed like a headache otherwise
11:10csd_I still find it difficult to know when mutable state is OK
11:11m1dnightis there a cleaner way to do (cons x (cons y somelist)) ?
11:11dnolen_csd_: Clojure is about minimizing it, don't use it unless you exhausted other options - or the alternative is fugly.
11:11clgvm1dnight: list*
11:11Bronsacsd_: when it simplifies your implementation, it's ok
11:11clgv,(list* 1 2 (range 3 10))
11:11clojurebot(1 2 3 4 5 ...)
11:11m1dnight(concat (list x y) somelist) then?
11:11m1dnightooohhh
11:11m1dnightthat's a nice one
11:11clojurebotTitim gan éirí ort.
11:11m1dnightthnx
11:12chronnoj
11:12chronnosorry
11:13justin_smith,(into (list 4 5 6) '(3 2 1 0)) ; there is also this
11:13clojurebot(0 1 2 3 4 ...)
11:14justin_smith,(clojure.string/join " " (into (list 4 5 6) '(3 2 1 0)))
11:14clojurebot"0 1 2 3 4 5 6"
11:24oskarkvWhat's the point of tools.macro/deftemplate?
11:32m1dnighthm, 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:33m1dnightin the case where you just use ":use" it works fine, then I can put the *var* in my macro
11:33m1dnightbut if the user does use :as something I have to put something/*var*
11:33justin_smithm1dnight: that shouldn't be the macro's job to worry about that at all
11:33m1dnighthrm, but i'm doing some esoteric stuff
11:34m1dnightCan't see my way around it
11:35m1dnightoh wait, if I put the macro ni the other namespace it will be qualified, i think
11:35justin_smithm1dnight: vars are resolved based on the scope in which the macro is expanded
11:35justin_smithnot the one where the macro is defined
11:35justin_smithwell, no, it's not quite that
11:36justin_smithif you are using quoting and unquoting properly, that should be the case though :)
11:36justin_smithm1dnight: do you have a compelling reason not to use `syntax-quote ?
11:37llasramm1dnight: 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:37llasramThe solution in that case is simple: don't
11:38m1dnighthrm, it seems to work
11:38m1dnight `(println "In transaction?" *in-transaction*))
11:39m1dnightthe *in-transaction* is a dynamic var defined in the stm.clj file
11:39m1dnightI want to access that variable in user-code to see the status of my stm transaction
11:39EvanR,(quote 0)
11:39clojurebot0
11:40EvanRim getting unable to resolve symbol quote
11:40llasramm1dnight: Ah. Then nm -- syntax-quote is all you need
11:40m1dnighti wasn't thinking ahead of the fact that the macro will be defined in the stm.clj file
11:40llasramEvanR: Sounds like you're in an NS which hasn't `refer`ed clojure.core
11:40m1dnightso all is wel \o/
11:40Bronsallasram: quote isn't a var
11:40Bronsa,quote
11:40llasramOh
11:40clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: quote in this context, compiling:(NO_SOURCE_PATH:0:0)>
11:41BronsaEvanR: you're trying to use quote as a value somewhere
11:41EvanRi put [clojure.core :refer [quote]]
11:41EvanRIllegalAccessError quote does not exist clojure.core/refer
11:41BronsaEvanR: quote is a special form, it's not shadowable and not referable
11:41EvanRyeah im trying to compose it with a function
11:41BronsaEvanR: and it's not a value
11:42EvanRdang
11:44EvanRso im trying to generate symbols using string operations
11:44Bronsa,(symbol "foo")
11:44clojurebotfoo
11:44EvanRah
11:45EvanR,(count [1 2 3])
11:45clojurebot3
11:49zotnewb 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:50hfaafbcycle
11:51zothow can i create a function that returns each successive result from cycle?
11:51gfrederickscycle w/ an atom
11:52gfredericks,(defn cycler [coll] (let [a (atom (cons nil (cycle coll)))] #(first (swap! a rest))))
11:52clojurebot#'sandbox/cycler
11:52gfredericks,(def f (cycler [0 2]))
11:52clojurebot#'sandbox/f
11:52gfredericks,(f)
11:52clojurebot0
11:52gfredericks,(f)
11:52clojurebot2
11:52gfredericks,(repeatedly 10 f)
11:52clojurebot(0 2 0 2 0 ...)
11:53zotperfect :)
11:53mikerodgfredericks: why the (cons nil ...) part
11:53zottnx tnx!
11:53gfredericksmikerod: so it returns (first coll) the first time you call it; can omit if that's not important
11:54mikerodgfredericks: oh, yeah I see what you did now
11:54gfredericksjust being clever with swap!
11:54mikerodYes, indeed. :)
12:00justin_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:00clojurebot#'sandbox/it
12:00justin_smith,(.next it)
12:00clojurebot1
12:00justin_smith,(.next it)
12:00clojurebot2
12:00justin_smith,(.next it)
12:00clojurebot1
12:00justin_smithif you need a proper iterator
12:03vermahow do I kill a cider-jack-in repl/
12:03verma:P
12:04vermacider-quit I think
12:04justin_smith(do (shutdown-agents) (System/exit 0)) should work
12:05justin_smith(that will shut down clojure, agnostic of UI)
12:08TimMcJust (System/exit 0) will do it.
12:08justin_smithTimMc: sometimes the shutdown-agents call is needed, or it will hang while shutting down
12:08engblomIn 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:08TimMchuh
12:09TimMcBecause they have a slow shutdown hook?
12:09justin_smithengblom: (fn [[a & b]])
12:09tbaldridge, ((fn [f & rest] {:first f :rest rest}) [1 2 3 4 5])
12:09clojurebot{:first [1 2 3 4 5], :rest nil}
12:09tbaldridge, ((fn [f & rest] {:first f :rest rest}) 1 2 3 4 5)
12:09clojurebot{:first 1, :rest (2 3 4 5)}
12:09tbaldridgethere we go
12:10justin_smithTimMc: hmm - maybe shutdown-agents is only needed with implicit shutdown (reaching the end of -main) ? but it can't hurt
12:11justin_smithengblom: my version is if the arg is one list, tbaldridge's version is for multiple args
12:11engblomjustin_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:11justin_smithengblom: my version works on a string
12:11engblomOk, will test!
12:11engblomThanks'1
12:11tbaldridge((fn [[f & rest]] {:first f :rest rest}) "Hello World")
12:11justin_smith,((fn [[a & b]] {:a a :b b}) "hello")
12:11clojurebot{:a \h, :b (\e \l \l \o)}
12:11tbaldridgeyeah, what he said....
12:12justin_smithtbaldridge: careful, shadowing rest is just asking for trouble :)
12:12tbaldridgeyeah, but who uses rest? :-P
12:13tbaldridgerest 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:14gfrederickstbaldridge: I just used it here 10 minutes ago
12:14Bronsa,more
12:14clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: more in this context, compiling:(NO_SOURCE_PATH:0:0)>
12:14gfredericksBronsa: thank goodness I was just wondering why we had 3 rest functions
12:14tbaldridgeah, is it rest calls more?
12:15tbaldridge,(source rest)
12:15clojurebotSource not found\n
12:15Bronsatbaldridge: yeah
12:15tbaldridgek, so yeah, I don't use either lol
12:15Bronsa$source rest
12:15lazybotrest is http://is.gd/Yllsx8
12:15tbaldridgenot confusing at all. Just like conj calling .cons...
12:16Bronsahah
12:16Glenjamindo people tend to shadow core variables with locals happily?
12:16Bronsayeah that's a good one
12:16Glenjaminlighttable highlights core vars, so it always puts me off doing it
12:16BronsaGlenjamin: I tend to avoid it, remembering all the hours spent debugging a c.c/name shadowing
12:17technomancyname is my most-shadowed too
12:17jebberjebWas just going to say 'name' as well:)
12:17technomancy~正名
12:17clojurebotIf 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:17Glenjaminis there a decent substitute when you want a local called name?
12:17technomancynym
12:17jebberjebGlenjamin nm
12:17stuartsierra`the-name-of-the-thing`
12:18justin_smithGlenjamin: count is the one I always accidentally shadow, then I get "number isn't a function" errors
12:18technomancy(this is the point at which the CLers scoff and pretend putting up with funcall is worth it)
12:20Bronsalast time I shadowed name I got "Wrong number of args (-2)"
12:20technomancywut
12:20engblomWhy is this failing: (== (first "000002") \0)
12:21Bronsa,(defmacro x [] (map))
12:21clojurebot#'sandbox/x
12:21Bronsa,(x)
12:21clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (-2) passed to: core/map>
12:21justin_smithengblom: \0 is not a number, it is a character
12:21justin_smith== is for numbers
12:22justin_smith,(= (first "000002") \0)
12:22clojurebottrue
12:22justin_smithengblom: we don't use = for assignment
12:23Bronsatechnomancy: http://dev.clojure.org/jira/browse/CLJ-1279
12:26mj_langfordClojure 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:26annelieshi there boys and girls
12:26kungiannelies: hi there annelies
12:27justin_smithhellp
12:27justin_smithhello, that is
12:27bbloomdoes anybody have a quick way to get a dotty viz out of clojure namespace dependencies?
12:28mj_langfordI 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:28kungimj_langford: why not do it in the hiccup but split it into meaningful functions
12:28vermanot 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:29kungimj_langford: Like render-question render-question-set ... and so on
12:29mj_langfordI guess hiccup at it's core is a certain format of vectors and symboils
12:29mj_langford*symbols, that would work
12:29mj_langfordThank you!
12:29kungimj_langford: have you seen enlive?
12:30kungimj_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:30mj_langfordIt's basically one step closer to a template, with still being rather hiccupish?
12:31kungimj_langford: no
12:31kungimj_langford: https://github.com/swannodette/enlive-tutorial
12:32kungimj_langford: but it maybe overkill for your project
12:32justin_smithverma: in my experience the part of cider that hangs emacs is the autocompletion
12:33kungijustin_smith: Yes it is
12:33mj_langfordAhh, 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:33justin_smithverma: also, do you have project.clj configured so that your core namespace is automatically required and made the current namespace?
12:33justin_smithverma: I never do it myself, but it shouldn't be automatic
12:34justin_smiththere is a config needed
12:34vermajustin_smith, hmmm, yeah I remember seeing some repl options in chestnut at least
12:35verma{:repl-options {:init-ns remote-login.server}}
12:35justin_smithverma: {:repl {:init-ns some.ns}}
12:35vermasomething like that
12:35vermayeah
12:35justin_smithOK, 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:36vermabut "lein repl" works fine
12:36justin_smithoh...
12:36TimMcmj_langford: Just be aware that hiccup will do nothing to keep you from echoing malicious HTML out as user data.
12:36justin_smithverma: that's a bug then
12:36vermaand inside my code when I do C-x C-e it complains compojure.core not found
12:36TimMcYou have to manually call the HTML escape fn on all user data as you insert it into the hiccup tree.
12:36vermaon the ns that is
12:36TimMcSo... don't use it on sites that have any sensitive data, I guess.
12:38mj_langfordhiccup was nice because it looked like clojure code, which my brain parses just fine (rather than HTML which it doesn't).
12:38mj_langfordThat'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:38mj_langfordBut that's a concern if I take any more user data for sure than I'm currently planning
12:43TimMcmj_langford: As long as there's no unconstrained user data, you're good.
12:44TimMcmj_langford: I think xeqi has a fork or wrapper that makes it safe, though.
12:44mj_langfordWhy would I be validating that on output
12:44mj_langfordInstead of input?
12:45Glenjaminbecause only output has enough context
12:46mj_langfordBecause they could put 3 pieces of data in which taken individtually, aren't detectable as bad, but which make a malicious output
12:46mj_langford?
12:46Glenjaminbasically, is "<script>alert('hi')</script>" safe?
12:47Glenjaminand the answer is, not if you're outputting html
12:51TimMcmj_langford: Validation only makes sense if there's a very constrained space of inputs, e.g. integers.
12:51TimMcAnything 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:51engblomIs there a better way than this http://pastebin.com/tDcJUVwX to trim away extra 0 from a number represented as text?
12:52engblom"00000" -> "0", "000123" -> "123"
12:53mj_langfordIf you're not trying to avoid it as an exercise, re-find may lead you to a shorter solution
12:53TimMcmj_langford: For example, is this a "bad" input? "Tim O'Reilly <tim@oreilly.com>"
12:54TimMcIf you encode that as &lt; and so forth it's going to look mighty silly in your JSON output.
12:54TimMcand it will screw up any database searches
12:54jeremyheiler,(str (Long/parseLong "0001" 10))
12:54clojurebot"1"
12:54jeremyheilerengblom: ^
12:55engblomThanks!
12:55mj_langfordOkay, I see why for complex input, validation is only useful on output
12:55EvanRis there a "map with index" or easy way to zip a list with its indexes
12:56jeremyheilerengblom: you'll get an exception if your input is not ultimately a number. not sure if that's important or not for you.
12:56TimMcmj_langford: It's not really validation -- it's escaping or encoding.
12:57jeremyheilerengblom: also, you can drop the 10 if you don't want to be explicit about the radix, 10 is the default.
12:57TimMcThink of HTML as a dynamic language -- you're trying to avoid having the output's parse tree be different from what you intended.
12:57engblomjeremyheiler: At this point I am just toying with Clojure myself. I wanted to practice on recursion in Clojure.
12:58GlenjaminEvanR: (doc map-indexed)
12:58EvanRk
12:59engblomMy 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:59jeremyheilerengblom: ah, cool.
12:59Glenjaminalso, ##(map [:a :b :c] (range))
12:59lazybotjava.lang.IndexOutOfBoundsException
12:59Glenjaminalso, ##(map vec [:a :b :c] (range))
12:59lazybotclojure.lang.ArityException: Wrong number of args (2) passed to: core/vec
12:59Glenjaminmeh, something like that
12:59jeremyheilerengblom: you can write it as a reduce
13:00jeremyheilerengblom: look at "reduced" for how to shortcut the reduction.
13:02engblomThanks!
13:04kungiGlenjamin: I think you need a zip
13:04kungi,(zip [:a :b :c] (range))
13:04clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: zip in this context, compiling:(NO_SOURCE_PATH:0:0)>
13:05kungi,(zipmap [:a :b :c] (range))
13:05clojurebot{:c 2, :b 1, :a 0}
13:06EvanR,'(a b c)
13:06clojurebot(a b c)
13:07EvanR,(list a b c)
13:07clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)>
13:07kungiEvanR: list is a function trying to evaluate its parameters
13:07kungi,(list 'a 'b 'c)
13:07clojurebot(a b c)
13:08EvanRyes thats what i want
13:21Glenjaminkungi: i was intending to demo ##[(map list [:a :b :c] (range)) :vs (map-indexed list [:a :b :c])]
13:21lazybot⇒ [((:a 0) (:b 1) (:c 2)) :vs ((0 :a) (1 :b) (2 :c))]
13:43thesebis author of clojure a lisp genius?
13:43thesebthe reason i ask is that i like some of the stuff he did that is nonstandard lisp stuff
13:44thesebit must have took some cojones to break with the past
13:51m1dnightguys, I need an opnion, or expert advise, whatever you want to call it.
13:51m1dnightI need to two dynamic vars to be in the same namespace. One is for concern X, the other is for concern Y.
13:51m1dnightI have two namesapces for each concern, which is neat and proper.
13:52m1dnightHowever, to make things easy, and possible.. I need them to be in the same namesapce.
13:52m1dnightNow I figured I could throw all the code in 1 file and be done with it. But two seperate files is rather neat.
13:52noonianm1dnight: you can refer to dynamic vars in other namespaces and bind them etc without issue
13:52m1dnightSo, one namesapce two file. And I hit this question: http://stackoverflow.com/questions/4690758/splitting-a-clojure-namespace-over-multiple-files
13:52m1dnightnoonian: yeah, but I need them in a macro, so I need to qualify them properly
13:52noonianjust namespace qualify them, i.e. other-ns/*dynamic-var*
13:52m1dnightso that's not gonna work
13:53m1dnightso the commenter says, you are better of putting the vars in a seperate namespace.
13:53m1dnightwhich do you guys recommend, vars in 1 namespace, or single namespace and two files?
13:53aperiodicneither, two namespaces in two files
13:54m1dnightyeh, but I can't qualify a variable from namesapce X with a macro in namespace Y
13:54technomancya single namespace in two files??
13:54lazybottechnomancy: Definitely not.
13:55m1dnighttechnomancy: see the SO thread, it explains it
13:55technomancyit is a ~guards-worthy offence
13:55m1dnightwhat? :p
13:55m1dnighti dont understand
13:55technomancy~guards
13:55clojurebotSEIZE HIM!
13:55m1dnight:D :D :D
13:55TimMc~gourds
13:55clojurebotSQUEEZE HIM!
13:55m1dnightbut the thread mentions that core namespace is built this way..? :p
13:56TimMcm1dnight: clojure.core is special that way
13:56technomancyclojure.core does weird things for bootstrapping reasons
13:56technomancyit's not an example to emulate
13:56m1dnightOkay, that aside
13:56TimMcAlso it's *old* so a lot of good practices had not yet been established.
13:56m1dnighthow do I solve it then?
13:56m1dnightI want to take an idiomatic approach
13:56m1dnightbut not sure how
13:56TimMcI also question the good taste of some of the core devs. :-P
13:57aperiodicm1dnight: you definitely can refer to vars in other namespaces in macros.
13:58m1dnightyeah, but the point is, I have a namespace "stm", and a namespace "actors"
13:58aperiodicm1dnight: if not, how would anyone be able to write non-trivial macros? You wouldn't be able to use any clojure.core fns!
13:58m1dnightwhat 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:59aperiodicok, so require / refer it.
13:59m1dnightyes
13:59m1dnighthold on
13:59technomancyTimMc: well, we didn't have a lot of precedent at that time to judge taste
13:59noonianif you have stm required as stm, you can refer to *in-transaction* with stm/*in-transaction*
13:59m1dnightyes
14:00m1dnightbut when the user imports stm :as s and actors :as a, then I cant' refer to it anymore
14:00m1dnightperhaps the fully qualified name would work
14:00Bronsam1dnight: ` already fully qualifies
14:00Bronsa,(alias 'foo 'clojure.core)
14:00clojurebotnil
14:00Bronsa,`foo/+
14:00clojurebotclojure.core/+
14:01TimMctechnomancy: Well that and no one ever goes back and reformats old code. Too dangerous for core stuff.
14:01TimMcbut oh god some of that indentation
14:01technomancyTimMc: right, that and the "beware of leopard" sign
14:02TimMcThis is where testing frameworks like asis come in handy.
14:04m1dnightaperiodic: 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:06arianvphey
14:06anneliesarianvp: hi
14:06aperiodicm1dnight: 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:07Bronsam1dnight: did you see what I evaluted in clojurebot a few lines above?
14:07TimMcm1dnight: If someone requires 'actors as 'a it's still there as 'actors.
14:07TimMcand your own aliases will still apply
14:07aperiodicm1dnight: as long as your macro uses backquote, that will resolve the aliases and emit fully-qualified symbols.
14:08TimMc,(require '[clojure.string :as str])
14:08clojurebotnil
14:08TimMc,`str/join
14:08clojurebotclojure.string/join
14:08aperiodicm1dnight: 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:09aperiodicand it won't mutate the namespace being required.
14:09m1dnightwell that's actually an excellent solution
14:09m1dnightand no, I didn't see it but now I do :D
14:09m1dnightthat's what i need
14:09m1dnightthanks guys
14:09m1dnight<3
14:10aperiodicyou're welcome. glad we could clarify things for you. :)
14:12m1dnightaha :) it works like a charm
14:13m1dnight(map inc #clojure) \o/
14:21vermaclojail's secure-tester cannot evaluate '(+ 1 1), says permission denied
14:21vermais it that super secure?
14:23jeremyheilerverma: did you create a .java.policy file?
14:23TimMcThat 1 could have come from anywhere! You don't know where it has been.
14:24vermajeremyheiler, no :(
14:24vermachecking
14:26vermajeremyheiler, thanks for that, totally didn't rtfm :P
14:26verma(inc jeremyheiler)
14:26lazybot⇒ 4
14:27vermaworks nice wonder if the default policy is alright
14:27vermahttps://raw.githubusercontent.com/Raynes/clojail/master/example.policy
14:32amalloycan 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:33hfaafbhttp://i.imgur.com/L4TaD73.png
14:33anneliessame result as hfaafb
14:34MickJnI 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:34amalloyokay, thanks. i wonder why those problems think *everyone* has dnoe them
14:34jeremyheilerverma: np
14:34thesebi really like how clojure doesn't have explicit conses
14:35thesebthat always bugged about old lisp
14:35amalloytheseb: explicit conses? you mean improper lists or what? because obviously we do have cnos
14:35amalloy*cons
14:35justin_smithMickJn: the right class declaration for byte-array is ^bytes iirc
14:35thesebamalloy: i mean that in clojure iirc you can't get stuff like ((a.b) (c.d)) right?
14:35aperiodicMickJn: you have to use the absurd jvm classname for a primitive array... since primitive arrays don't have a real class
14:35thesebamalloy: because lists are ISeqs instead of built from conses..is that right?
14:36amalloytheseb: right. the term for (a . b) is "improper list"
14:36technomancytheseb: "ISeqs instead of built from conses" <- these are not mutually exclusive
14:36amalloy[for b which isn't itself a list, anyway)
14:37technomancytheseb: the whole point of an interface is that you don't care about how it's implemented
14:37justin_smiththeseb: ISeq is not a class, as the name indicates it is an interface
14:37MickJnjustin_smith: Hmm, I will do some research into that. I'm getting java.lang.ClassNotFoundException: java.lang.string now. :D
14:38amalloyMickJn: it's String, not string
14:38justin_smiththeseb: thus "an ISeq" is any class implementing said interface, which includes conses and lists
14:38thesebjustin_smith: wow
14:38thesebok...that's deep ...i think i get it
14:38theseball i know is i hate conses
14:38BronsaMickJn: use "[B" and String and it should work
14:39justin_smiththeseb: 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:39BronsaMickJn: "[B" is the jvm signature of a byte array
14:39justin_smithBronsa: oh, bytes won't work there?
14:39Bronsano idea, does it?
14:40thesebjustin_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:40Bronsajustin_smith: looks like it works, neat
14:40justin_smithBronsa: well the code in question has to be accessible by the reader right? so the string "[B" ?
14:41justin_smithcool, thought it would
14:41Bronsajustin_smith: I just assumed it called class/forname, [B is ok in that case
14:41justin_smithI've messed with silly low level stuff that has no business being implemented in clojure
14:41justin_smithBronsa: ahh
14:41thesebDoes clojure have all the macro capability of common lisp?
14:42justin_smiththeseb: I'd call it a more hygenic subset
14:43dbaschtheseb: see http://stackoverflow.com/questions/9611821/macros-clojure-vs-common-lisp
14:44turbofailclojure macros have one thing that CL macros don't, which is access to the bound-variable environment
14:44MickJnWhat are "^bytes" and "[B" called? Where can I find information on how to use them?
14:45turbofailwhich makes certain macros possible that wouldn't be otherwise
14:45justin_smithMickJn: type hints
14:45Bronsaare &env and &form actually documented anywhere?
14:45turbofaili think so
14:45justin_smithMickJn: though "[B" is a valid argument to Class/forName, but not a valid type hint
14:45BronsaI don't think they are actually
14:46justin_smithMickJn: http://clojure.org/java_interop?f=print#Java%20Interop-Type%20Hints
14:46turbofailhm. i know i read about them in some sort of documentation somewhere
14:46edwtheseb: 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:47anneliesjustin_smith: those answers say Clojure has no user-defined reader macros
14:47anneliesThat is no longer true, right?
14:47MickJnjustin_smith: Cool, thanks. This would be the correct way to implement java byte[] then or is there another way?
14:47justin_smithMickJn: the aliases like "bytes" are documented under "Aliases"
14:47technomancyedw: 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:47justin_smithannelies: we have limited reader-macros
14:47anneliesWhat do you mean by implement? byte[] is already implemented by the JVM.
14:47justin_smithnot general like common lisp
14:47Bronsaannelies: it is true, clojure has tagged literals which are a limited version of reader-macros
14:47anneliesOh, I see.
14:47turbofaili feel like defmacro's docstring used to have something about &env and &form
14:48Bronsaannelies: tagged literals can't control the reader stream like reader macros can in CL
14:48MickJnjustin_smith: I got byte-array from the java-interop document.
14:48justin_smithMickJn: the right type-hint for a byte-array is bytes
14:48justin_smithbyte-array is a constructor
14:48justin_smithnot a type
14:48dnolen_justin_smith: "[B" is a valid type hint
14:48dnolen_,(let [^"[B" x (byte-array [1 2 3])] x)
14:48clojurebot#<byte[] [B@1800df6>
14:48justin_smithdnolen_: oh, TIL, thanks!
14:49justin_smithso I guess bytes is just a sugar
14:49dnolen_,(let [^"[B" x [1 2 3]] x)
14:49edwtechnomancy: 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:49clojurebot[1 2 3]
14:49Bronsajustin_smith: yeah
14:49justin_smithcool
14:49justin_smith(inc dnolen_)
14:49lazybot⇒ 6
14:49justin_smith(inc dnolen)
14:49lazybot⇒ 16
14:49dbasch,(let [^"[FOO" x (byte-array [1 2 3])] x)
14:49clojurebot#<byte[] [B@18a04b0>
14:49amalloyhey, dnolen's back
14:50MickJnjustin_smith: Ahh, okay. I'll read into it some more. Lots to learn.
14:50Bronsadbasch: 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:50Bronsaif a string can be resolved to a class via RT/classForName then it will be a valid type hint
14:51dbaschgood to know, because you can always use anything as a type hint and see it ignored
14:51Bronsanot *always* :)
14:52Bronsayou can never know when the compiler will ignore a wrong type hint or explode in your face
14:52amalloyhurrah, 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:52turbofailedw: 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:52TimMchaha
14:53Bronsa(inc nullptr)
14:53lazybot⇒ 1
14:53turbofailedw: though you could also just do `(let [~'if 3] ~@body)
14:53TimMcNullPointerException
14:53dbasch(dec mongodb)
14:53lazybot⇒ -1
14:54justin_smithdbasch: woah, that is way too high
14:54TimMc$karma mongo
14:54lazybotmongo has karma 0.
14:54dbaschwith the db suffix comes great responsibility
14:54edwturbofail: D'oh, right. It never occured to me that folks would not use syntax-uote.
14:54edwsyntax-quote, even.
14:55TimMcedw: It's rare.
14:55Bronsaedw: some clojure macros are implemented without syntax-quote because it isn't available immediately in the bootstrapping process, for example
14:55Bronsasome clojure.core macros, I mean
14:55amalloydefmacro being a good example
14:56edwMore bootstrapping please.
14:56TimMcI 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:56tmarblewhat are the preferred ways for reading e-mail from Clojure (javax.mail)?
14:56amalloyspeaking 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:56technomancyedw: you can get non-hygenic macros with syntax-quote
14:57technomancyusually by some '~' abomination, so at least it stands out as ugly, but definitely possible
14:57dbaschtmarble: I had a good experience with https://github.com/drewr/postal
14:57Bronsalol
14:57amalloycheck out the amazing patch at http://dev.clojure.org/jira/secure/attachment/10592/0003-Make-defmacro-preserve-form-metadata.patch if you dare
14:57Bronsaamalloy: defmacro actually uses ` once!
14:58Bronsawow.
14:58edwtechnomancy: I'm interpreting that as a challenge. Off to wreak havoc...
14:58technomancyit 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:59tmarbledbasch: thx!
14:59amalloyBronsa: 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:59Bronsaamalloy: yup
15:00amalloythat patch is getting old enough that i should start looking around for good preschools
15:02nodenamere
15:03Barleyis anyone else using cursive on osx experiencing the repl view closing all the time
15:03Barleythe repl stays up but the view goes away, really annoying
15:04justin_smithBarley: cfleming probably wants to know about that. I think the project has an issue tracker too.
15:06Barleyok
15:07sveriBarley: I had that happening some time ago too, on windows 7
15:07vermaso 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:07sveriBarley: in the meantime I reinstalled cursive because I had another problem with it, not sure exactly when this problem went away
15:07vermaI think I can do (run-jetty) somewhere
15:08sveriBarley: It may be a intellij setting too, did you play around with the pinned / docked mode of the repl window?
15:08justin_smithverma: if the hander argument to run-jetty is #'handler, then the app will see updates. lein-ring does auto-reloading if files change
15:08Barleysveri: no
15:08Barleyi actually have cursive on windows 7 as well and there the repl is rock solid
15:09Barleyi'll have a go at the modes
15:09vermajustin_smith, I may have to import run-jetty from somewhere I think, what does #' do?
15:11tmarbledbasch: any suggestions for clojure libs to *retrieve* mail?
15:12dbaschtmarble: I used javamail directly, it has more flexibility
15:12justin_smithverma: it gets the var rather than the function, vars always look for a new bindign when run
15:12hiredmanjavaxmail does pop3 and/or imap
15:12justin_smithverma: 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:13justin_smith&[+ #'+] ; verma: one is the function itself, the other is the var holding it
15:13lazybot⇒ [#<core$_PLUS_ clojure.core$_PLUS_@1709fa5a> #'clojure.core/+]
15:14justin_smiththe function is immutible, the var is not
15:14vermajustin_smith, ah nice!
15:14justin_smith,(#'+ 1 1)
15:14clojurebot2
15:14justin_smithbut vars are still callable
15:15vermaoh nice, but I can rebind it
15:15justin_smithexactly
15:15verma,(binding [#'+ -] (#'+ 1 1))
15:15clojurebot#<CompilerException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_PATH:0:0)>
15:16vermaoh
15:16vermajustin_smith, how do I rebind a var like that?
15:16vermajust curious
15:16justin_smithwith def
15:16justin_smith,(defn foo [] 1)
15:16clojurebot#'sandbox/foo
15:17justin_smith,(defn bar [] (foo))
15:17clojurebot#'sandbox/bar
15:17justin_smith,(defn baz [] (#'foo))
15:17clojurebot#'sandbox/baz
15:17justin_smith,(bar)
15:17clojurebot1
15:17justin_smith,(baz)
15:17clojurebot1
15:17justin_smith(defn foo [] 2)
15:17justin_smith,(defn foo [] 2)
15:17clojurebot#'sandbox/foo
15:17justin_smith,(bar)
15:17clojurebot2
15:17justin_smith,(baz)
15:17clojurebot2
15:17justin_smithhrm...
15:17justin_smithahh, I did it wrong
15:17justin_smithone sec
15:18annelies(foo 1 2 3) compiles to bytecode of Java foo.getRoot().apply(1, 2, 3)
15:19anneliesIf foo is a var
15:19justin_smithright
15:20anneliesI wondered the same a few days ago and used decompiler :P
15:21vermanice
15:21justin_smith,(defn foo [] 1)
15:21clojurebot#'sandbox/foo
15:22mj_langfordI'm creating a clojure symbol from string input
15:22justin_smith,(defn dofoo [arg] (fn [] (arg)))
15:22clojurebot#'sandbox/dofoo
15:22justin_smith(def bar (dofoo foo))
15:22mj_langfordWhen I attempt to then use this on a map defined in code (in a different module), i'm getting nothing bak
15:22justin_smith,(def bar (dofoo foo))
15:22clojurebot#'sandbox/bar
15:22justin_smith,(def baz (dofoo #'foo))
15:22clojurebot#'sandbox/baz
15:22justin_smith(bar)
15:22justin_smith,(bar)
15:22clojurebot1
15:22justin_smith,(baz)
15:22clojurebot1
15:22justin_smith,(defn foo [] 2)
15:22clojurebot#'sandbox/foo
15:22justin_smith,(bar)
15:22clojurebot1
15:22justin_smith,(baz)
15:22clojurebot2
15:22hiredmanplease use your own repl
15:23justin_smiththere we go, sorry it takes so many lines to demonstrate
15:23mj_langfordI 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:23justin_smithhiredman: I was demonstrating the difference between functions and vars as args
15:23hiredmanmj_langford: are you using a symbol or a keyword for the key in the map?
15:23justin_smithhiredman: but you're right, next time I'll use refheap
15:23mj_langford :like_this in the map
15:24mj_langfordfor the keys
15:24hiredmankeywords and symbols are different
15:24hiredman:foo is a keyword
15:24mj_langfordWell there we go
15:24hiredmanhttp://clojure.org/data_structures#Data%20Structures-Keywords
15:24vermajustin_smith, nice makes sense, thanks
15:24verma(inc justin_smith)
15:24lazybot⇒ 127
15:24mj_langfordThose are backwards from what I expected, and totally my problem
15:25mj_langfordThank you, all problems fixed now.
15:29annelieslazybot: that's almost a nice round number!
15:36amalloyannelies: 1111111 is at least as nice a number as 10000000
15:37gfredericksit's a prime
15:37gfredericksso if "round" means something like "smooth", it's as non-round as you can get
15:38oskarkvI 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:40hiredman~'node
15:40clojurebotCool story bro.
15:41oskarkvhiredman what?
15:41amalloyoskarkv: 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:43oskarkvamalloy 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:46hiredmanoskarkv: 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:48rplWhat 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:50oskarkvhiredman 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:52hiredmanoskarkv: 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:53aperiodicoskarkv: 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:53Fenderclgv / 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:55hiredmanlook, 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:56hiredmanyou 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:56Fenderweirder even, I still got a similar error: in aaaa.core (require '[aaaa.ssss]) -> CompilerException java.lang.Exception: namespace not found
15:56Fender(slurp "src/aaaa/ssss.clj") -> returns clj code with proper namespace declaration
15:56Fenderemacs -> open "src/aaaa/ssss.clj" -> compile -> open aaaa.core -> compile -> everything works
15:57hiredmanit 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:58sveriBarley: did you get it working?
15:58Barleyhard to say, hasn't acted up for a while now
16:00m1dnighthm, strange I didnt get highlighted on that one
16:00loliveiraIs it possible to write a websocket client using http-kit?
16:01Fenderm1dnight: no worries, you can respond tomorrow
16:02Fenderfi you have an idea that is ;)
16:02FenderI tried to fiddle around a bit with the lein :main setting but to no avail
16:03Glenjamini just noticed http://clojure.org/data_structures doesn't include booleans
16:03m1dnightFender, as I've had some issues with namespaces (ask the channel :p) as well, I'd try a minimal test case
16:03m1dnightI.e., create a simple file that uses the namesapce that doesnt work
16:04m1dnightand try and compile that file in emacs
16:04Bronsatbaldridge: ping
16:05tbaldridgeBronsa: pong
16:05Bronsatbaldridge: 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:06Bronsatbaldridge: it's 3 lines, want me to add it to ASYNC-86 or make another ticket?
16:06tbaldridgego ahead and add it to 86, that one has been vetted by Rich (I think) so it just needs to be screened
16:06Bronsacool
16:07Bronsatbaldridge: btw I'll keep updating the patch each time I release a new t.a.jvm version until it gets screened
16:08vermawhen you add a new dep to project.clj, do you just cider-quit -> cider-jack-in? or is there a better way?
16:09m1dnightcider-restart, I guess?
16:09vermanice
16:10justin_smithalso, with pallet/alembic you can load all new deps from project.clj without restarting the repl
16:10justin_smith(alembic/load-project)
16:11justin_smiththis does not do version changes or remove deps though
16:11vermaits pretty nice
16:12Fenderm1dnight: I did so at least for the clj-time prob and now Im too tired to think, but I'll try tomorrow
16:12Fenderthx n n8
16:12m1dnighthah, I can imagine Fender have a good one o/
16:25oskarkvaperiodic the behavior silently fails :p
16:29timw1.
16:29timw1\quit
16:36toxmeistertechnomancy: 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:39wsmoaktoxmeister: … 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:40technomancytoxmeister: it looks like geom-core only has 0.3.0-SNAPSHOT deployed
16:40technomancysince there's no releases I can go ahead and delete the whole artifact
16:40technomancyis that what you want?
16:41toxmeisterwsmoak: 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:41toxmeistertechnomancy: yes, please, please! AFAIK those geom-* artefacts are the only ones impacted
16:42michaelr525hey
16:42wsmoakunderstood. I’ve just BTDT with not everyone getting Maven stuff right ;)
16:42technomancytoxmeister: ok, you got it
16:43michaelr525https://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:43toxmeistertechnomancy: you sir are amazing! :)
16:43technomancyoh I don't know about that, but thanks =)
16:46amalloythe macro definition looks reasonable; no idea what could possibly be wrong without knowing what your code that *uses* the macro looks like
16:46toxmeistertechnomancy: 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:47michaelr525amalloy: thanks for looking.. one sec and I'll paste the using code
16:48technomancytoxmeister: oh gotcha; I thought you said just geom-core
16:48amalloylike 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:48technomancytoxmeister: I can't delete non-snapshot artifacts without verifying the owner of the repo
16:49michaelr525amalloy: https://www.refheap.com/45285f2f6bc8a2d06a2bfe727
16:49toxmeistertechnomancy:oki, then only the 0.3.0-SNAPSHOT please, please (sorry, forgot there was one release earlier this year, my bad..)
16:49amalloyyeah, that's just never going to work. your macro can't destructure at compile-time values that only exist at runtime
16:49michaelr525amalloy: I can't let it go, spent the last hour trying to figure it out
16:50michaelr525ah
16:50michaelr525damn
16:50amalloy"data" is a symbol to the macro, not a map
16:50michaelr525I knew it was something stupid like that :)
16:50amalloyyou need to emit code that destructures, rather than trying to destructure in the macro itself
16:50toxmeistertechnomancy: having six modules doesn't make it easier in this case..
16:51cflemingBarley: Definitely check the pinned/docked status of the toolwindow.
16:51michaelr525amalloy: thanks
16:53SagiCZ1is 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:53arohnerSagiCZ1: not really, no
16:53arohneryou can doall inside the with-open
16:53justin_smithSagiCZ1: with-open only works if the output is fully realized before leaving scope
16:54arohnerthat's about the best of your "sane" options
16:54justin_smithso it can't be lazy
16:54technomancytoxmeister: you want me to delete the files for the 0.3.0-SNAPSHOT releases alone?
16:55SagiCZ1so there is basically no way to read file lazy, right? why does line-seq exist then?
16:55TimMcSagiCZ1: There is, you just have to keep it open.
16:56SagiCZ1TimMc: what happens to the file in that case? it is a large csv file.. i just leave it open.. what could happen?
16:56nullptrin 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:57toxmeistertechnomancy: 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:58technomancytoxmeister: ok, you got it
16:58SagiCZ1nullptr: i see, not trivial task for me.. i guess i just wont close it then
16:58technomancyyeah unfortunately right now deploy is not transactional
16:58technomancyif your connection gets interrupted there are ways to leave the repo in an inconsistent state
16:58technomancyI've never heard of it affecting future writes though, just reads
17:00Glenjaminnullptr: 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:01amalloyGlenjamin: and what if you never reach the last item?
17:01Glenjaminwell it'd stay open i geuss
17:01TimMcSagiCZ1: 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:01toxmeistertechnomancy: might well have been the reason, have been deploying several times via 3G mobile hotspots. shall try to avoid that in future...
17:01nullptrGlenjamin: yes
17:02TimMctechnomancy: Was the SSH deploy transactional?
17:02nullptramalloy: the wrapper itself would also be disposable
17:02SagiCZ1TimMc: thanks! i will keep that in mind
17:03amalloyTimMc: it could leave one file handle open *forever*
17:03amalloyyou shouldn't rely on garbage collection to clean up your heavyweight objects
17:04amalloy(by which i mean objects that matter to the world outside your program)
17:05Glenjaminhrm, maybe something more explicitly a file handle would be nicer
17:05Glenjamindeftype and implement ISeq and some protocol that includes a close
17:05Glenjaminnot sure if you've gained much at that point
17:05TimMcamalloy: 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:05TimMcthe eager shell
17:06amalloyapt-get install eagersh
17:06nighty^Is clojure supported by Android Studio ?
17:06hiredmana 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:07hiredmanso, you know, why waste time cleaning it up?
17:07hiredmanmeanwhile the 2tib open file sits there
17:08amalloyparticularly 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:09hiredmanobviously the answer is to give the gc sweeping powers to introspect beyond managed memory
17:10mj_langfordnighty^ may want to ask in #clojure-android :D
17:10nighty^Ok
17:10Glenjamini believe Rust has some concept of managed resources like that
17:10nighty^Sorry I did not know there was such a channel
17:10nighty^mj_langford, thank you
17:10m1dnightarg, circular dependency :(
17:10mj_langfordtis pretty empty :D
17:11TimMchiredman: BEEP BOOP YOUR HOUSE IS NO LONGER REFERENCED I WILL COLLECT IT NOW
17:11amalloyhiredman: 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:11amalloyTo agree, click Yes (will install the Ask toolbar)
17:12turbofaili wonder when the next major meatspace compaction event is going to take place
17:13amalloysounds like Burning Man
17:13turbofailcompaction and garbage collection i mean
17:14turbofailwell some people say that we're already in the middle of one
17:14turbofailhttp://en.wikipedia.org/wiki/Holocene_extinction
17:21toxmeistertechnomancy: 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:23toxmeistertechnomancy: what i don't get is the "forbidden" part - hence why I thought maybe file perms are wrong?
17:25SagiCZ1can i make a clojure.zip structure from a simple clojure hash-map?
17:36amalloySagiCZ1: 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:37SagiCZ1amalloy: 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:37Glenjaminif 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:38amalloyyeah, 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:38SagiCZ1amalloy: i see, thanks
17:39EvanR,(prn "foo")
17:39clojurebot"foo"\n
17:39EvanR,(if true (do (prn "foo") (prn "bar")))
17:39clojurebot"foo"\n"bar"\n
17:41mj_langfordGlenjamin, you may want to explain keywords syntax in the map section
17:44Glenjaminmj_langford: And leave it out of the primitives section? Or just expand on it when maps are mentioned?
17:44mj_langfordExplain it at or before first use. IDK where is best
17:50SagiCZ1this is a dumb question, but is clojure using java 1.7?
17:50BronsaSagiCZ1: it uses whatever jvm you run it in
17:50anneliesOn 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:50justin_smithSagiCZ1: clojure uses your version of java, minimum of 1.5
17:51BronsaSagiCZ1: I believe it is compiled with java 1.6 bu that shouldn't make any difference
17:51Bronsabut
17:51SagiCZ1ok, sweet
17:52godd2,(System/getProperty "java.version")
17:52clojurebot#<SecurityException java.lang.SecurityException: denied>
17:52godd2aww well you can use that to get whatever version of java clojure is running on.
17:52irctcdoes anyone here use cider with emacs
17:53SagiCZ1i wonder why the clojure version doesnt work here:
17:53SagiCZ1Paths.get("/var/data/stuff/xyz.dat");
17:53SagiCZ1(Paths/get "/var/data/stuff/xyz.dat")
17:53SagiCZ1whats wrong?
17:53BronsaSagiCZ1: what error are you getting?
17:53SagiCZ1String cannot be cast to java.net.URI
17:53SagiCZ1this is the header of the overloaded method i want to call:
17:53SagiCZ1public static Path get(String first, String... more)
17:54BronsaSagiCZ1: you need to pass an empty array then
17:54justin_smith,(java.nio.file.Paths/get "/" (into-array String []))
17:54clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: java.nio.file.Paths>
17:54BronsaSagiCZ1: varargs in java are just syntactic sugar, they don't really exist in the bytecode
17:54justin_smithSagiCZ1: anyway, the above works on 1.7+
17:55irctchey, does anyone know if there is a way to change the cider repl's error window
17:55irctcso that the cider repl's error doesn't take up a whole window
17:56SagiCZ1wait but nobody taught me that! .. thats ugly.. thank you though
17:56alejandro1irctc: does popwin.el help?
17:56irctcoh i don't have popwin
17:57irctcthanks alejandro! i think its what i needed
18:04irctcif i have installed popwin, i should be able to just revert with C-g, right?
18:12tcrawley{blake}: Immutant 1.x works with jboss 7 only, Immutant 2 works with WildFly 8/9, or without a container at all
18:15m1dnightirctc: how about just splitting your windows with C-x 2 or C-x 3
18:15m1dnightand create a popup with C-x 5 f or C-x 4 f
18:15m1dnight(i believe there are others as well)
18:15m1dnightI have created a shortcut that allows me to create a new frame (actual window) for a buffer to my choosing
18:15irctcm1dnight: thanks for the suggestion! i forgot to eval-buffer so popwin wasn't working properly
18:16m1dnight(global-set-key (kbd "<f7>") 'ido-switch-buffer-other-frame)
18:16m1dnightthis is the one I use
18:16irctcbuwhat do you mean by create a popup with C-x 5 f?
18:17m1dnightif you press that key combination it executes 'ido-switch-buffer-other-frame
18:17m1dnightit then gives you a menu for all your open buffers, the one you select will open in a new frame (actual window)
18:17m1dnightso you can there select *cider-error* or whatever its called
18:17mj_langfordIs there something obvious I'm missing here with these compojure routes? (GET "/genchar/a/:archetype" [] handle-pick-template)
18:17mj_langford (GET "/genchar/a/:archetype/t/:template-name" [] handle-pick-first-archetype)
18:18mj_langfordthe second one never matches
18:18justin_smithmj_langford: does putting them in a different order help?
18:19mj_langfordNeither reordering them or removing the shorter route makes the longer route match
18:19m1dnightirctc: you can press "C-h k" and then use any keycombination and emacs will tell you what it does
18:20justin_smithmj_langford: I assume you are submitting a request that fully matches that route
18:20mj_langfordhttp://localhost:8000/a/disciple/t/two-native-specialties-and-advancement
18:20irctcm1dnight: oh cool, thanks!
18:20justin_smithmj_langford: there is no genchar in that route
18:20amalloymj_langford: and where is the /genchar?
18:21mj_langfordoi
18:21mj_langfordWas looking for clojure misunderstandings, not stupidity
18:21mj_langfordThanks folks
18:21mj_langfordthat's of course it
18:42aaelonydid http://planet.clojure.in/ die? appears to be down...
19:08justin_smithaaelony: yeah, I am not seeing either
19:09RaynesA 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:09Raynes 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:09RaynesNote that I'm fairly unfamiliar with annotations and such, so feel free to shame me if this is a dumb question.
19:10aaelonyjustin_smith: i wonder what happened..
19:11justin_smithaaelony: no mention on the twitter
19:11RaynesScratch that, he was wrong, the vector format wasn't working either.
19:11RaynesNever mind. Clarity is achieved.
19:11justin_smithaaelony: https://twitter.com/planetclojure
19:12aaelonyjustin_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:13RaynesSo, new question
19:13RaynesFor annotations, why no support for symbols that refer to strings?
19:13RaynesSeems like an arbitrary limitation, but I could be wrong.
19:13RaynesAnd 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:14mearnshso 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:15justin_smithmearnsh: your fn bindings shadow x
19:15justin_smithmearnsh: the rules are that you only see the innermost binding
19:15justin_smiththe fn is inside the let, so you don't see the let's x while inside a fn that takes x
19:16justin_smithmearnsh: perhaps you didn't mean for x to be in the args list?
19:16mearnshah..
19:16amalloyRaynes: 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:17amalloyhttps://docs.oracle.com/javase/tutorial/java/annotations/
19:17amalloyor numbers too, probably
19:17mearnshjustin_smith: that's it! ok nice. quite pleased with that code now
19:18justin_smithmearnsh: awesome, glad it worked
19:18mearnsh(4clojure problem 75)
19:18ag0rexamalloy: are you sure? I've seen lists of things as values for a Java annotation
19:19amalloyag0rex: no, lists are definitely fine. i just mean the base type has to be string or number
19:19justin_smithmearnsh: much nicer than my answer
19:20mearnshi totally wrote comprime instead of coprime in that refheap snip
19:20mearnshprobably a sign i should be asleep
19:20justin_smithmearnsh: woah, there is a .gcd method on biginteger
19:21justin_smith,(.gcd (biginteger 88) (biginteger 1000))
19:21clojurebot8
19:21mearnshah but the recursive implementation is so beautiful, i like to see it
19:21justin_smithheh :)
19:21justin_smithI just noticed the .gcd method scrolling through the answers of people I follow on 4clojure
19:22mearnshhold on. 4clojure is giving me an error for this but it works in my repl
19:22justin_smithwhat's the error?
19:22justin_smithfor one thing you can't defn in 4clojure
19:22mearnshhttps://www.refheap.com/93102 https://www.4clojure.com/problem/75
19:22ag0rexamalloy: found this one: http://stackoverflow.com/questions/1458535/which-types-can-be-used-for-java-annotation-members
19:23mearnshjava.lang.RuntimeException: Unable to resolve symbol: gcd in this context
19:23justin_smithmearnsh: (fn gcd [...] ...)
19:23justin_smithyou need to name your fn
19:23justin_smitherr no
19:23mearnshno
19:23justin_smithmearnsh: name the inner one
19:23justin_smiththe one you bind to gcd
19:24justin_smith(let [gcd (fn gcd [...] ...) ...] ...)
19:24mearnshwhy is that necessary
19:24justin_smithit can't call itself if it doesn't know its name
19:24justin_smithand the binding in the let block does not exist until after it's body is evaluated
19:25justin_smithyou could replace the self call with recur I think
19:25justin_smiththat's an even better solution
19:25mearnshhmm it's broken
19:25mearnshmy code that is
19:25justin_smithwhat is?
19:26mearnshsee the recursive call to gcd two args are supplied
19:26mearnshi think there's a missing partial or something
19:26justin_smithmearnsh: gcd should have an x arg
19:26justin_smithcoprime? should not
19:27justin_smithand coprime? should be referencing x internally
19:27clojurebotexcusez-moi
19:27mearnshok, got it, passes
19:28mearnsha bit confusing but i'll get used to it. also weird that it works in my editor
19:29justin_smithmearnsh: because it referenced the preceding definition
19:30mearnshah...
19:30mearnshindeed
19:30justin_smithyeah, sometimes your own repl history can bite you in the ass
19:30mearnsh(inc justin_smith)
19:30lazybot⇒ 128
19:30mearnshgood lesson there
19:42godd2I'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:43Ken`where is "for" defined?
19:44godd2clojure.core/for looks like
19:44godd2try (doc for) in your repl
19:45justin_smith$source for
19:45lazybotfor is http://is.gd/x33p56
19:45justin_smiththe bots know all
19:45justin_smithit's an eyefull, aint it
19:45Ken`thankls
19:45Ken`thanks*
19:45godd2also keep a bookmark of the CLojure Cheatsheet: http://clojure.org/cheatsheet
19:48verma,(def a 1)
19:48clojurebot#'sandbox/a
19:48vermahmm, bot here allows defs
19:48justin_smithone does
19:49justin_smith&(def a 1)
19:49lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
19:49oskarkvgodd2 read the docstring for lazy-seq :)
19:50vermaI should allow defs on my slack bot, or configurable
19:50godd2oskarkv 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:51dbaschgodd2: it caches the result it realized, not the subsequent ones obviously
19:52justin_smithgodd2: 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:52godd2dbasch how can it be realized if the function it calls calls a lazy sequence which calls the function again?
19:52oskarkvgodd2 the inner lazy-seqs will not invoke their bodies
19:53{blake}Is Immutant =required= to deploy a WAR to JBoss?
19:53dbaschgodd2: that’s why it’s a lazy seq, it won’t call again until required to do so
19:53godd2oskarkv oh so the inner lazy-seq just doesnt exist?
19:54justin_smithgodd2: it exists in the implementation as a promise that you know how to calculate the value later, if it is asked for
19:54justin_smiththat is the laziness
19:55godd2but how can it cons against a lazy seq that it doesnt know the value of?
19:55justin_smithgodd2: because it knows how to realize it, but also knows you don't need the value yet
19:55godd2or is this one of those implementation magic things I should worry about later
19:55tcrawley{blake}: nope, you can create an uberwar and deploy that to jboss, just like you can to any other servlet container
19:56justin_smithgodd2: 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:56oskarkvgodd2 you can cons the result of a lazy-seq call because it's just a "promise"
19:56amalloygodd2: a lazy seq is, implementation-wise, a function that, when called, produces a value which is sequential
19:57amalloyso 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:00godd2alright I think I'm coming to an understanding.
20:01godd2https://gist.github.com/nicklink483/38534fdbd8dec886a9ce
20:02godd2Is my logic sound there?
20:02justin_smithgodd2: yeah, that looks right
20:02justin_smithgodd2: 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:03ag0rexgodd2: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LazySeq.java you can take a look on this
20:03godd2alright thanks a lot you guys :) I've been stuck for two days on that.
20:03amalloygodd2: yes, that is a reasonable explanation of what happens
20:03oskarkvgodd2 http://clojuredocs.org/clojure.core/delay
20:03turbofailsomething something even streams vs odd streams...
20:04mearnshis there a simple way i can make this lazy (cf. 4clojure #132, fails on the last test) https://www.refheap.com/93106
20:05godd2oskarkv 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:05oskarkvgodd2 yeah well it's the same kind of thing :P
20:05amalloymearnsh: the same way you make anything lazy: don't use loop/recur, instead use a recursive function with lazy-seq
20:06amalloyreplacing (recur (conj result x) whatever) with (cons x (call-myself whatever)), for example
20:06mearnshi'll try, thanks
20:07amalloyand then returning nil at the end instead of result
20:11mearnshi got it, ty https://www.refheap.com/93107
20:11mearnshis that the best place to put the lazy-seq macro
20:12mearnshseems to go anywhere
20:13amalloythat is the best place for it. generally you want it as close to the top of the function as you can get it
20:13justin_smith,(= (cons 1 (cons 2 ())) (conj () 2 1)) ; mearnsh
20:13clojurebottrue
20:14mearnshoh yeah
20:14mearnshamalloy said cons and i just blindly went along with it
20:15justin_smithcons is fine for one value- and conj is effectively cons if the collection is a seq, but it can take extra args
20:15amalloyjustin_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:15amalloyie, (list* 1 2 x) is better than (conj x 1 2) if you're building a lazy-seq
20:16justin_smithamalloy: why's that again?
20:16mearnshhm changing to conj seems to blow the stack here
20:16amalloy(inc amalloy) ; for being a genius
20:16lazybotYou can't adjust your own karma.
20:16amalloyjustin_smith: (conj x ...) calls seq on x
20:16amalloywhere x is a lazy seq, anyway
20:16justin_smithahh, of course
20:16justin_smithwhich then has to see what x is...
20:16mearnshok got it
20:17justin_smith(inc amalloy)
20:17lazybot⇒ 188
20:17amalloywhereas (list* 1 2 x) is really defined to be the same as (cons 1 (cons 2 x))
20:17mearnshnice.
20:22ag0rexamalloy: why do you say conj calls seq on x?
20:23ag0rex,(source conj)
20:23clojurebotSource not found\n
20:24amalloyag0rex: note the caveat: where x is a lazy seq
20:24oskarkvgodd2 https://www.refheap.com/93109
20:24amalloythe source of conj of course doesn't do any such thing, but it delegates to clojure.lang.IPersistentCollection/cons
20:24amalloyand for LazySeq, the implementation of cons involves calling seq
20:29ag0rexamalloy: 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:30amalloyhuh? no, it's https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LazySeq.java#L91
20:31ag0rexand that, yes, but conj is calling coll.cons() whereas cons returns new Cons(x, (ISeq) coll)
20:32ag0rexand coll.cons() for a LazySeq does the seq() that you pointed out
20:33ag0rexright? :-/
20:35amalloyright
20:35godd2It's the end of the world as we know it...
20:37ag0rexamalloy: thank you for clearing that out for me :)
20:58devnfastest 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:58csd_How can I convert a boolean like (zero? (rand-int foo)) to a predicate for use in `filter`?
20:58dbaschcsd_: do you want to filter randomly?
20:59justin_smithdevn: wait, what's the connection of assoc! to sorted collections?
20:59csd_yes
20:59devnjustin_smith: persistent!/transient
20:59justin_smithdevn: transients are sorted?
20:59justin_smithI don't get it
21:00dbasch&(filter (fn [_] (zero? (rand-int 3))) (range 20))
21:00lazybot⇒ (6 7 9 10 11 14 15 16 18 19)
21:01csd_i was trying to figure out how to do something like that
21:01csd_thx
21:01csd_dbash: what's the purpose of & instead of , with lazybot?
21:01justin_smithcsd_: they are two different bots
21:01csd_,(filter (fn [_] (zero? (rand-int 3))) (range 20))
21:01clojurebot(1 3 4 6 7 ...)
21:02andyfdevn: 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:02justin_smithwhat does "sorted" mean in this context?
21:02amalloyjustin_smith: i expect he's thinking about the fact that clojure's sorted collections don't happen to support transient
21:03justin_smithahh, that's the missing link, thanks
21:03andyfWrapper fn would look similar to clojure.core/into
21:03devnandyf: yeah, im dynamically rebinding *assoc* right now to be whichever one i want. passing an arg seems better
21:03devnjustin_smith:
21:03devn,(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:03clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentTreeMap cannot be cast to clojure.lang.IEditableCollection>
21:04devn,(let [hashm (hash-map 1 2 3 4)] (persistent! (reduce-kv (fn [m k v] (assoc! m k v)) (transient (empty hashm)) hashm)))
21:04clojurebot{1 2, 3 4}
21:04devnjustin_smith: see also into
21:04devn,(source into)
21:04clojurebotSource not found\n
21:04amalloy~def into
21:05devnty
21:05amalloyi wonder if it'd be a good idea to write a lazybot rule to respond to ,(source x) with ~def x
21:06justin_smith$source into
21:06lazybotinto is http://is.gd/caQYZB
21:06andyfNote into's handling of metadata, if that is important for your code. Transient discarda metadata
21:06amalloyoh, you updated the source link too, justin_smith?
21:06devnandyf: yeah, was just looking at that :)
21:06amalloyfinally. i was getting tired of 1.2.1 or whatever
21:06justin_smithamalloy: it came along automatically with the clojure version
21:06amalloyreeeeeally?
21:07amalloyhuh, neat
21:08justin_smithamalloy: in src/lazybot/plugins/clojure.clj it uses *clojure-version* in the github-tag function to build the URL
21:08amalloylooks like that happened two years ago: https://github.com/Raynes/lazybot/commit/de03009369af9df71f2fecbde2768f844a674dfc
21:08justin_smithaha
21:09amalloythe last time i looked at that code it was hard-coded
21:09justin_smithamalloy: they grow so fast when you're not watching, don't they
21:11devnandyf: https://gist.github.com/devn/039ac6dbdb6587fa263d
21:11devnany thoughts?
21:11amalloyjustin_smith: https://github.com/Raynes/lazybot/commit/3849b68fb97ce8745896bea9c231b44cde16cfa3 is pretty good
21:11amalloyfinally giving up on ever having tests
21:13andyfdevn: Looks good to me. Nice that you've got the empty calls in there
21:14amalloydevn: 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:14amalloyi 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:15devnamalloy: 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:16amalloymacrolet plz
21:17devnwith 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:17amalloy(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:17devnsince the basic body of this thing won't change much between them
21:23amalloyhuh. 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:24amalloythe hello world of irc bots, i guess
21:24Wild_Cat`more like the hodor world, amirite?
21:25amalloyalso, 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:25amalloysomebody get on that
21:32andyfamalloy: How many repos would you _really_ spend time doing that for?
21:32amalloyfewer than all, more than none
21:33andyfSo 1, then :)
21:33amalloybut really like...two. usually the awful history is unfixable, because it's part of the history of current HEAD
21:34amalloybut 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:31devncould someone explain to me why (symbol-macrolet [def foo] (def def def)), expands to (def def foo)?
22:31devnaccording to https://github.com/clojure/tools.macro
22:56sm0keis erlang's `let it crash` equvivalent to simply not check for exceptions?
22:56sm0keany java/clojure library based on this paradigm?
22:57sm0kei mean not catch exceptions
23:09Ken`(eval `(let [~(symbol "x") 123] x))
23:09Ken`this gives an error
23:09Ken`I'm guessing this is due to lazy evaluation?
23:11sm0keKen`: does not make much sense, you are trying to evaluate something which is already being evaluated
23:11sm0keKen`: may be you want '(let ...) ?
23:11Ken`sm0ke: I know it's a silly piece of code.. I'm trying to learn quoting
23:11sm0kewell ` is for resoution ##`inc
23:11lazybot⇒ clojure.core/inc
23:12Ken`I don't understand what you said
23:13sm0kewhere as ' is shorthand for a list ##'(let [a 1] a)
23:13lazybot⇒ (let [a 1] a)
23:13sm0kecompare this to `(let [a 1] a)
23:13sm0ke##`(let [a 1] a)
23:13lazybot⇒ (clojure.core/let [clojure.core/a 1] clojure.core/a)
23:14sm0kewhich is probably not what you want
23:14sm0ke,(eval '(let [a 1] a))
23:14clojurebot1
23:15technomancysm0ke: "let it crash" is insane without setting up a supervisor tree
23:15TEttingertechnomancy!
23:15TEttingerI had some questions for you last night about lein plugins, but I think they're all resolved
23:15sm0ketechnomancy: thought so, may be https://github.com/Netflix/Hystrix is something along same lines?
23:16sm0kenot sure
23:16trx|2ken`: I can't explain why but you need to use gensym for assigning let symbols in forms
23:16technomancysm0ke: 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:17rritoch,(eval (let [x (gensym "x")] `(let [~x 123] ~x)))
23:17clojurebot123
23:17Ken`rritoch: ah, that helps
23:18rritochKen`: I also can't explain why, but you can also append # to your symbols which magically works
23:19rritoch,(eval (let [x# 123] x#))
23:19clojurebot123
23:19sm0kehttp://doc.akka.io/docs/akka/snapshot/scala/fault-tolerance.html
23:19sm0kethey talk about supervision and blah blah
23:19rritochI'dlove to know why myself, I just know it works
23:19rritocherr
23:20sm0kerritoch: its a shorthand for gensym actually
23:20rritoch,(eval `(let [x# 123] x#))
23:20clojurebot123
23:20rritochsm0ke: aah, thanks, I had no idea
23:22godd2rritoch: http://www.braveclojure.com/writing-macros/#6_1__Variable_Capture
23:25sm0keKen`: may be you wanted something like ##`(let [~'x 123] ~'x)
23:25lazybot⇒ (clojure.core/let [x 123] x)
23:27sm0keunhygeinic thought, not a good idea in most cases
23:28technomancysm0ke: hm; well I'm skeptical but I haven't tried it
23:28rritochgodd2: 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:29sm0kethe correct usage should be ##(let [x (gensym)] `(let [~x 123] ~x))
23:29lazybot⇒ (clojure.core/let [G__17949 123] G__17949)
23:30godd2rritoch 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:30sm0ketechnomancy: akka api's are ugly mess of complexity
23:30Ken`sm0ke: thanks for your examples, certainly food for thought :)
23:30sm0kebut they are being used in some battle tested recognized projects though
23:30sm0kelike spark
23:31sm0kewhich does not guarantee correctness though
23:32rritochgodd2: 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:33sm0kerritoch: that should be avoided in most cases :)
23:34sm0kehttp://en.wikipedia.org/wiki/Anaphoric_macro
23:34sm0keit breaks hygiene which clojure macros otherwise make sure to enforce
23:35sm0kerritoch: and it does not `resolved into the namespace`
23:36rritochsm0ke: ex. `(def ~'MacroDefinedVar "blah")
23:37sm0ke,`(def ~'MacroDefinedVar "blah")
23:37clojurebot(def MacroDefinedVar "blah")
23:37rritochsm0ke, and the unquoted-quoted value does expand into the macro users namespace
23:37sm0keit keeps the symbol `as is`
23:37rritochsm0ke, without the unquote-quote it would expand into the macro's namespace
23:37sm0kenothing else
23:38rritochsm0ke, which is very useful when your implementing automatic code generation, such as filling in default methods for gen classes
23:38sm0keyes doing a (def ..) inside a macro is not usual
23:39sm0kebut I did say `avoided in most cases`
23:39sm0kenot all
23:40rritochsm0ke, the advantage of LISP is it's AI capabilities, and the unquote-quote is a VERY common AI implementation for automatic code generation.
23:40sm0kethat does not make any sense to me
23:40sm0kehow can you tie unquote-quote to AI!!
23:41rritochBecause the fundamental goal of AI is to get the system to program itself
23:41sm0ke:D
23:43godd2rritoch writing code != programming ;)
23:43godd2though I suppose you could say it's a necessary condition.
23:44rritochgodd2: I've been programming for 30 years, and if your excluding "programming" IC's, when it comes to computers, writing code = programming.
23:44rritochgodd2: IC programming is the only exception, because it is writing code + burning that code into the device
23:46godd2I 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:47rritochgodd2: Actually, it is programming. What your referring to is an actual AI development practice, though it hasn't yet worked to my knowledge.
23:47godd2I'd argue that programming is a layer of abstraction which requires intent.
23:47rritochgodd2: It is based on http://en.wikipedia.org/wiki/Infinite_monkey_theorem
23:47godd2yes, the chimps and shakespear came to mind haha
23:47sm0kerritoch: wow you call that AI?
23:48rritochgodd2: I've yet to see a useful implementation of the infinite monkey theorem, but it has been tried many times
23:48godd2bitcoin blockchain hashes?
23:48godd2:P
23:48rritochsm0ke: If a code can exist that is self-aware, than a random code generator would EVENTUALLY reach that code.
23:49rritochsm0ke: It has been tried many times and hasn't yet worked.
23:49godd2rritoch you have a point. after all, evolutionary theory suggests that the formation of intelligence does not require intent
23:50sm0kerritoch: oh may be it `will` work, just that no one bothered till `EVENTUALITY`
23:50godd2however, evolutionary theory does require selection pressure. and 'random' is not a pressure
23:51rritochAnyhow, 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:52sm0kewow 30 years is a lot!
23:52sm0kedid you get fed up of it at some point?
23:53rritochsm0ke: 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:54rritochsm0ke: That's when I moved my focus from programming to web development, (less stress).
23:54sm0kewhy not management and stuff like that?
23:55sm0kei guess it more stress there?
23:55rritochsm0ke: I was an IT/MIS manager, everything had to be repaired yesterday
23:55sm0ke:D