#clojure logs

2014-07-13

00:05seancorfieldbe nice to have some ops in here to kick/ban the spammers
00:10seancorfieldlooks like technomancy is on the channel access list but is not an op?
00:24technomancyI'm an op when I need to be an op.
00:24technomancywhich as far as I can tell is not right now?
00:25systemfaultIdiots tend to learn languages like PHP, C, Java… not Clojure. Been on the channel for months now, it’s an amazing community and I don’t remember seeing any OP
00:31Zardozls
00:31lazybotbin lib lib64 lost+found mnt proc run srv
00:31@technomancyoh, just got PM spam
00:31Zardozthat was definitely the wrong window :P
00:32gfixlerZardoz: but it worked!
00:33gfixlerls mnt
00:33lazybotetc home media opt proc run srv tmp
00:33gfixlerls mnt/home
00:33lazybotbin boot home lib lib64 lost+found opt proc root srv sys tmp var
00:33Jaoodsystemfault: what was your point?
00:47andyfMostly a test message to see if spammers are around and what that looks like -- working on cheatsheet/Grimoire touchup enhancements
00:53mthvedtls mnt/home/home
00:53lazybotboot dev etc home lib64 sbin srv tmp
00:53mthvedtls mnt/home/home/home
00:53lazybotdev home lost+found opt proc root srv tmp
00:53mthvedtls foo
00:53lazybotboot dev etc mnt proc run sys usr
00:54technomancyls ignores its args is what you're trying to say, eh lazybbt?
00:54lazybothome lib64 opt run sys
00:54technomancybot
00:54technomancywait what?
00:54mthvedtsudo ls -R /
00:57trptcolin https://github.com/Raynes/lazybot/blob/04fd054199a3f9c862714b1e0430bb1c9cb57912/src/lazybot/plugins/unix_jokes.clj#L9-L16
01:04seancorfieldtechnomancy sorry... i went off to #freenode and was asking about staff and access list there... you'll see i posted to clojure-dev about it...
01:05seancorfieldwas that kikinii that you kicked/banned?
01:05technomancyyeah
01:05technomancyI'm not on clojure-dev any more
01:05technomancyanother op would be a good idea
01:07amalloytechnomancy: yeah, lazybot's response to ls is to randomly choose 5-10 of the directories in / and print them. it's fun watching people try to "hack" that
01:08seancorfieldtechnomancy didn't realize you'd dropped off clojure-dev, sorry
01:09seancorfieldafter all, i'm freenode nearly 24x7 :)
01:11seancorfieldi
01:12seancorfieldi'm _on_ freenode nearly 24x7...
01:12seancorfieldthat's what i get for typing while watching R.I.P.D. ... :)
01:16technomancyI second amalloy, and as he's topped the karma list I think that counts as a third from lazybot
01:16technomancymotion passes
01:16seancorfield:)
01:16technomancyoh, I'm not authorized to change the access list
01:16technomancywelp
01:16amalloyoh man. guys. is there an acceptance speech? i'd like to thank my parents, and rich hickey
01:17amalloybut actually i have no idea how to use ops. i'm a very low-tech irc user
01:17technomancyamalloy: repeat after me: "Klaatu, verata niktu"
01:18amalloyi'm worried that phrase might summon aliens or something
01:19Jaoodwhat's wrong with having one more op? seancorfield seems like a good candidate
01:19technomancyJaood: I think that requires the power of a chouser-level thetan.
01:20technomancychouser-level or higher, I mean
01:20Jaood we don't want him to slow down on java.jdbc anyways ;)
01:21amalloyi wonder if freenode ops would elevate technomancy, based on him being and op and no higher-powered ops having been in the channel for two weeks
01:22technomancysix months is enough time for freenode policy to consider a nick abandoned
01:24Jaoodseancorfield vs amalloy on freenode
01:24Jaood6 vs 3 years
01:24Jaoodseancorfield wins
01:25seancorfieldhehehe, well, freenode can't do much right now since our ops are all absent or expired :)
01:25seancorfieldbut hopefully the other ops will step in any not be expired?
01:26nathan7oh hey
01:26nathan7…nevermind that
01:27seancorfieldand, Jaood thanx for the vote of confidence :)
01:41hiredmanobviously we should only ever have one op at a time, with some kind of elaborate changing of the guard ceremony when who ever is an op goes offline
01:44Jaoodseancorfield: :)
01:45Jaoodthe Clojure Programming book has the word "semantic" on every page :P
01:54andyfTest message to see if I still have nick andyf after the freenode effort to weed out the clonebots
01:56Jaoodandyf: how we know its you?
01:56andyfBecause I'm not advertising anything :)
01:57Jaoodclever clone ;)
01:58andyfApparently there is a musical piece titled "Return of the Clonebots" that someone has written, according to Google (not an ad or endorsement :-)
03:41ivan&(.getBytes "hello" "UTF-8")
03:41lazybot⇒ #<byte[] [B@131c5291>
03:43opqdonut&(seq (.getBytes "hello" "UTF-8"))
03:43lazybot⇒ (104 101 108 108 111)
03:43ivanthanks, that's much better
03:52ivanI really wish I could represent and compare bytestrings with the same convenience of Python 2
03:53ivanright now I just wrote some software that breaks if file attrs are not UTF-8
04:18andyfivan: Sounds like something you may be able to write your own function for? Or does Python 2's bytestring comparison do something fancy that would be difficult to implement?
04:21justin_smithivan: do you primarily care about the bytes (fixed size numbers) or the chars (which can have various encodings, and depending on encodings, various sizes)
04:35ivanandyf: yeah, it shouldn't be too hard, but return byte-arrays would annoy users who expect strings from my library
04:35ivananyway I did it right and they'll have to use (map as-utf8 whatever)
04:36ivanjustin_smith: I don't really understand
04:38justin_smitha jvm byte is 8 bits. a jvm char is natively 16 bits, but can have a variety of sizes in various supported string encodings. So do you care about the bytes, or the chars that the bytes represent?
04:40ivanI care about fidelity when dealing with the bytes that I get from POSIX APIs like listdir or llistxattr
04:45justin_smitha UNIX file name is just a sequence of bytes, the kernel knows nothing about encoding
04:45ivanPython 2 is particularly convenient because you get the punt on the encoding, put bytestrings in your source (without .getBytes or whatever), compare bytestrings
04:46ivanis #bin in edn a thing? I saw puget printing it (#bin base64stuff) and it's awful
04:46justin_smithI think if you want fidelity to the original bytes, you should treat them as bytes, and not as chars
04:46ivandoesn't look like it re: edn https://github.com/edn-format/edn/issues/59
04:47ivanjustin_smith: yeah, I did
04:48ivanhttps://www.refheap.com/5e86bbb357a521fb3bcb38baf/raw this took over an hour to figure out :-)
04:48justin_smithivan: I think I was confused by your term "bytestring" - in the jvm byte and string are two different things
04:48ivanindeed
05:10ivanhttp://dev.clojure.org/jira/browse/CLJ-1025 it sure would be great to have this (printing \u escapes in a bytestring representation is misleading and wastes some space)
06:47mschuene
06:47mschuene[Sun Jul 13 2014]
06:47mschuene*** You have joined channel #clojure [12:37]
06:47mschuene*** Topic for #clojure: Clojure, the language http://clojure.org | Currently
06:47mschuene at 1.6.0; top analysts expect this to be followed by newer versions with
06:47mschuene still higher numbers:
06:47mschuene https://github.com/clojure/clojure/blob/master/changes.md | discussion:
06:47mschuene http://groups.google.com/group/clojure
06:47mschuene*** #clojure: topic set by
06:47mschuene technomancy!~user@ec2-54-244-178-65.us-west-2.compute.amazonaws.com,
06:47mschuene 2014-03-26 17:33:15
06:47mschuene*** Users on #clojure: mschuene edlothiol jmc75 jml kwladyka vyorkin
06:47mschuene dark_element mengu afhammad programmancer dark4eg malbertife deadghost_
06:47mschuene nooga bryanmaass borkdude Gonzih sillyotter deevus rtra annapawlicka
06:47mschuene tgkokk kovrik Ven worrelsik vendethiel- d0ky yotsov onthestairs ambrosebs
06:47mschuene Bronsa onr sputnikus telex danvet zeebrah xjiujiu telser io2 vurma
06:48onr:)
06:54annapawlickai thought i was being summoned :)
07:47winkanyone got a rough minimal ram figure for a very basic ring web app? I'm at 190MB now, that's not too bad, but still...
08:20onrwink: that sounds really bad
09:30tvanhensis there any way to "fake" saving a local file? I know thats not the right term, but I can't think of exactly what it is. Basically I am using the jopbox api and want to save some data to dropbox but I don't want to store that data on the local filesystem at all. The jopbox api uploads the file from a local directory to dropbox. Since heroku does not allow saving to the local filesystem, this is not possible (also seems like a bad
09:30tvanhenssolution). Is there any way to pass in an argument thats like a "fake" local file which contains the data I want to save?
10:57kegundDay 3 w/ clojure. How to proceed? Emacs is now fully tweaked. I need to process a few sets of large sceince data in various ways. Any libraries to know about before starting?
12:22broquaintkegund: incanter?
12:58lambdaRunning cider-jack-in in emacs/osx is spitting out errors that basic unix commands are not found in lein script.
12:58lambdalein is working fine on the command line.
12:58lambdalike, rm not found, etc.
12:58lambdaAnybody has any idea what’s wrong with my emacs?
12:59lambdaStarting nREPL server...
12:59lambdaerror in process sentinel: nrepl-server-sentinel: Could not start nREPL server: /usr/local/bin/lein: line 9: whoami: command not found
13:03TimMclambda: /usr/local/bin/lein... how did you install lein?
13:04TimMc(I'm not sure why that would make a difference, though...)
13:04lambdaTimMc: Using the lein script from the website
13:04lambdalein -v shows me Leiningent 2.4.1
13:04lambdaThat’s on the command line
13:05lambdaI don’t know how emacs is running it, but it’s not finding basic unix commands like rm and basename
13:05TimMcMy lein doesn't have a whoami command in it. I wonder if that's a spurious line attribution.
13:06caternlambda: try M-! whoami
13:07lambdaI did cat /usr/local/bin/lein | grep whoami and it’s there in the script
13:07lambda /bin/bash: whoami: command not found
13:07TimMcWeird. Not in 2.4.2.
13:08caternlambda: that's what you get from emacs?
13:08lambdaheh, my emacs has gone bonkers
13:08lambdayeah
13:08TimMclambda: Are you *sure* that's the lein from the website? That's where you put it?
13:08caternok, so your emacs doesn't have the correct PATH env variable
13:08caternyou're starting it wrong or something, I don't know
13:08TimMc(And not the remnants of some distro install?)
13:08caternhere's a nickel, get yourself a better operating system
13:08lambdaI see. I use zsh in os x but emacs seems to be using bash
13:09lambdaI use Ubuntu for most of the stuff and cider is running fine there. I just need some work to be done on osx also.
13:09TimMccatern: Haha, that's from Dilbert, right?
13:09caternTimMc: yes
13:10caternlambda: okay, you persuaded me to help you. how do you start emacs?
13:10lambdaI use Alfred, which just runs Emacs.app
13:10caterntry starting it from the commandline and see if it works that way
13:11lambdaI tried that, no difference
13:11lambdaI’ll try to find how to fix bash environment for emasc on os x
13:11lambdaIt doesn’t seem to use my bash_profile
13:12caternwhen you run bash, everything works, right?
13:12lambdaOn the command line everything works, yeah
13:12lambdaBut I use zsh
13:12lambdaThough I have set the same paths for both bash and zsh, and lein works in bash also
13:14caternright, the problem is with Emacs, not lein
13:14lambdaYeah, seems so. Purcell seems to have written a plugin just for osx emacs: exec-path-from-shell
13:14lambdaGoing to try that
13:18amalloylambda: have you gone through http://www.emacswiki.org/emacs/EmacsApp#toc2 ?
13:19amalloyosx emacs traditionally gives you a stupid PATH unless you ask for a good one
13:19lambdaI have gone through it before but will go over it one more time
13:19lambdaThanks
13:20lambdaThe path is not getting set properly even if I start emacs from command line, like that wiki page suggests
13:25TimMcI'm still confused where it's getting whoami from.
13:28lambdaTimMc: I checked, it’s the Homebrew version that’s installed on this osx.
13:29Bird|otherboxhappy now?
13:32caternhuh?
13:41daGrevishow can i get random element from a map? rand-nth doesn't work
13:41justin_smith,(rand-nth (into [] {:a 0 :b 1}))
13:42clojurebot[:b 1]
13:42justin_smiththat's one way
13:42metellusdaGrevis: do you want a random key, value, or kv pair?
13:42TEttinger,(rand-nth (values {:a 1 :b 2}))
13:42clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: values in this context, compiling:(NO_SOURCE_PATH:0:0)>
13:42LuytdaGrevis: Maybe make a seq of it first?
13:42metellus,(rand-nth (seq {:a 1 :b 2 :c 3}))
13:42clojurebot[:b 2]
13:42justin_smithyeah, you could just call rand-nth of keys / vals
13:42TEttinger,(rand-nth (vals {:a 1 :b 2}))
13:42clojurebot1
13:45daGrevismetellus, pair
13:45daGrevisthanks, it makes sense
13:47daGrevisnow, can I somehow unpack pair and give key and value a meaningful names?
13:47justin_smithfor the into vs. seq, a rule of thumb would be to use seq if you are going to do it once, into if you are going to do it more (into has a higher overhead for making the result, but much faster lookup)
13:47justin_smith,((fn [[k v]] {:key k :value v}) (rand-nth (seq {:a 0 :b 1 :c 2})))
13:47clojurebot{:key :a, :value 0}
13:48justin_smithdestructuring works nicely
13:50daGrevisjustin_smith, https://gist.github.com/5c508b8eeebcd9eb6fa6
13:50daGrevishow can i apply destructing to let's, I was thinking
13:50justin_smithdaGrevis: (let [[k v] pair ...])
13:50daGrevisoh
13:51justin_smith,(let [[k v] (rand-nth (seq {:a 0 :b 1 :c 2}))] {:key k :value v})
13:51clojurebot{:key :b, :value 1}
13:51justin_smithdestructuring in arglists and let is identical
13:52justin_smithdaGrevis: also, let is sequential
13:52justin_smithyou don't need nested let
13:52justin_smiththat is, binding n+1 can refer to binding n (unlike in common lisp)
13:53justin_smith,(let [a 0 b (inc a) c (inc b) d (inc b)] d)
13:53clojurebot2
13:54justin_smitherr, meant to have d be inc c, but you get the idea I hope
13:54daGrevisi hope so too
13:54daGrevisthanks :)
13:55daGrevis,(let [x 2 y (* x 2)])
13:55clojurebotnil
13:55justin_smithyou would need to return one of those values :)
13:55daGrevis,(let [x 2 y (* x 2)] y)
13:55clojurebot4
13:56daGrevis;)
13:56daGrevisso it makes this https://gist.github.com/2dc82333bb437558d4cb
13:56justin_smithlooks about right
13:57justin_smithalso, you could optionally break the seq and rand-nth calls into their own lines, depending on what results in clearst code in the end
13:57justin_smithbut that's a preference thing, of course
13:58daGrevisyes i will probably do that, but first i want my tests to pass
13:58daGrevisby the way, do I structure my tests correctly? https://gist.github.com/f26f15c7ea495238c57d
13:59justin_smithdaGrevis: if you only have one testing per is, you can also just use the optional second arg to is
13:59justin_smithinstead of the wrapping testing form
14:09daGrevisso I have this test in which I need to mock rand-nth to always return known entry. how can I do that?
14:10daGrevisi mean, is it possible w/o 3rd party?
14:11daGrevisi found with-redefs
14:41Farewhich test framework do you recommend for simple testing?
14:41Fareand what do you recommend as a mechanism for reporting errors to the end-user?
14:44justin_smithdaGrevis: is passing it a collection with 1 element / all elements identical out of the question?
14:45justin_smithFare: for the former, clojure.test, for the latter, it depends on how the end user interacts with your project
14:49FareI don't know yet. For now, I'm interacting at the REPL
14:50Fareparsing files in python, and wondering what's the right way of architecting the display of syntax errors
14:54mi6x3mis it idiomatic to call a listener in clojure on-something
14:54mi6x3mon-select for instance
15:15justin_smitheven better, you can use CSP via core.async so you don't even need to do things in terms of callbacks, but yeah on-foo is a decent naming scheme for listeners
16:25mbacoff topic but listen to some techno while you hack clojure why not? http://www.mixify.com/michael-bacarella/live/omfg-sunday-wtf/
16:26justin_smithmbac: fyi, though we are pretty lenient about off topic stuff here, there is a #clojure-offtopic channel
16:29mbacword
16:58augustldoes it make sense to depend on clojure.jar for a non-Clojure project where I want to use the data structures (just invoke the Java API)?
16:58augustlor: does depending on Clojure have side-effects
16:58augustl?
17:10ivanaugustl: maybe you want https://github.com/krukow/clj-ds
17:10amalloyaugustl: it's perfectly reasonable to depend on clojure.jar from a java-only project that wants immutable data structures
17:12augustlivan, amalloy: since clj-ds is on 1.5 at the moment I'd prefer to just depend on Clojure itself :)
17:42TimMcaugustl: If you do: https://github.com/timmc/johnny/commit/340a217e4554ca296351affbc20911aeb805d85a#diff-0
17:42TimMc(since RT.init() prints to stderr and is a lie)
17:43mi6x3mcan one execute if-let with multiple bindings?
17:44mi6x3m,(if-let [x nil y 2] nil nil)
17:44clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: if-let requires exactly 2 forms in binding vector in sandbox:>
17:44mi6x3mthere's my answer
17:45mi6x3m,(macroexpand-1 '(if-let [x nil y 2] nil nil))
17:45clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: if-let requires exactly 2 forms in binding vector in sandbox:>
17:45TimMcmi6x3m: Various people have written if-let+ or similar.
17:45TimMcmi6x3m: Here's my version: https://github.com/timmc/handy/blob/master/src/org/timmc/handy.clj#L6
17:45mi6x3mTimMc: true, question is whether it makes sense to use one of those :)
17:46mi6x3mTimMc: let me see :)
17:47mi6x3mTimMc: is your lib lein'd ?
17:47mi6x3mi see yes :)
17:49TimMcOther folks have made different variants. (Code repetition vs. thunk for else clause.)
17:56mi6x3mTimMc: i settled for yours, works nicely :)
19:04gfrederickshave there been any attempts at enabling (somehow) annotating functions with example input-output, primarily for documentation, with optional test integration?
19:04gfredericksevery time I embed example calls to a function inside a docstring it makes me a little sad
19:07nathan7gfredericks: you could make a prototype that works now
19:08nathan7gfredericks: a macro that replaces your defn with a version that *reads* that data and builds a regular docstring out of it
19:09nathan7gfredericks: keeping the original docstring as :your.prototype/doc
19:11gfredericksso write a macro to use instead of defn?
19:11gfredericksso many prospective features have that as the only rational path to realization...doesn't seem scalable.
19:17technomancygfredericks: there should be a convention for metadata that's not a docstring but still relevant to display when docstrings are shown
19:17technomancy:doc/examples [...] or something
19:20nathan7gfredericks: it's very popular for many languages
19:20nathan7gfredericks: ES6 promises were developed entirely outside the language, as just programs
19:21nathan7gfredericks: like, what is becoming ES6 promises now — Promises/A+ was the 'prototype'
19:28gfrederickstechnomancy: yeah I was thinking that; but also you'd have to suggest how to render it?
19:29technomancyI wonder if the ^:internal convention from lein has caught on elsewhere
19:44kristofWeren't we just talking about that a few weeks ago?
20:08arrdemtechnomancy: what does ^:internal buy you? just a warning to the user? it's not like the compier warns that you're crowbaring into an "implementation detail".
20:08arrdem*compiler
20:13gfredericksI keep trying to design a generic defn-macro-creator so that you can mix together whatever features you're interested in
20:13gfredericksI wonder if nrepl's middleware model could make that sane
20:14mdeboarda macro macro?
20:16gfrederickseh, sorta
20:16gfredericksnot as impossible to wrangle as a literal macro-macro
20:16mdeboard`,`@'body
20:16mdeboardnight terrors
20:17gfredericksyou'd implement feature by providing a middleware that transforms the form
20:23TimMcgfredericks: Yeah, the various defn macros are particularly non-composable.
20:32TimMcMiddleware is the least offensive idea I can think of.
20:41technomancyarrdem: it's a warning to the user, yeah
20:52vermahey everyone, I am trying to learn clojure macros, I am trying to write a macro that would run the given body in reverse, like (do-reverse (print "hello") (print ("world")) should print "worldhello"
20:55arrdemverma: well your second print will try to call a string as a function which doesn't work..
20:55gfredericksTimMc: that's a good description
20:56vermaarrdem, sorry mistyped that
20:56arrdemverma: but such a thing is pretty easy. you just need a macro that splices the reverse of its arguments into a do form. I'd read up on macro splicing in clojure, the do special form and variadic functions.
20:56vermait is (print "world")
20:56arrdemverma: or I can just give you the answer now #spoilers
20:57vermaarrdem I am trying to splice unquuote-splice the reverse, but its not working :(
20:57vermaarrdem ~@(reverse body)
20:57justin_smith,(do (defmacro do-reverse [& body] (cons 'do (reverse body))) (do-reverse (print "hello") (print "world")))
20:58clojurebotworldhello
20:58justin_smithno need for syntax quote here
20:58arrdemjustin_smith: eh... I'd write it as (defmacro do-reverse [& body] `(do ~@(reverse body))) rather than using cons but it gets you the same place.
20:58vermaarrdem, justin_smith oh shit! :)
20:58arrdemSPOILERZ
20:59vermacode is data is code is fucking hard for my brain :(
20:59justin_smitharrdem: my thought was, as a beginner it's helpful to explicitly work with the form, and then use the magic once it makes more sense
20:59gfredericks(apply concat (list (list (quote do)) (cond->> body true (reverse))))
20:59arrdemjustin_smith: meh they'll learn the macro syntax eventually if they don't see it first. I'd rather use it and teach it than leave it as black magic.
20:59gfredericks^enterprise style
20:59arrdemlololol\
21:00vermaok, I was missing the "do"
21:00johnwalker(inc arrdem)
21:00lazybot⇒ 33
21:00vermamy first print was evalauating to nil which was being called as a function
21:01vermajohnwalker, what's this?
21:01johnwalkerverma: the inc?
21:01vermain inc arrdem specifically
21:01vermano*
21:01johnwalkerit adds to a users reputation
21:02vermaoh ok :)
21:02arrdemverma: note that normally inc is pure and has no side effects. here inc is a lie and has side effects :P
21:02arrdem&(-> 1 inc inc inc)
21:02lazybot⇒ 4
21:03vermalol
21:04vermacan I not use ~@ outside of a macro definition?
21:05justin_smithverma: yes, but only inside `
21:05arrdemno. ~@ is syntax-quote magic.
21:05arrdemeh... okay. I'm wrong and justin_smith is right
21:05justin_smith,`(a b c)
21:05clojurebot(sandbox/a sandbox/b sandbox/c)
21:05justin_smith,`(a b c ~@[0 1 2])
21:05clojurebot(sandbox/a sandbox/b sandbox/c 0 1 ...)
21:06justin_smithclojurebot, that 2 is shorter than your ...
21:06clojurebot'Sea, mhuise.
21:06justin_smith~that 2
21:06clojurebotthat 2 is shorter than your ...
21:07justin_smithhow do I make it forget things again?
21:07gfredericks,(alter-var-root #'clojure.core/unquote-splicing (constantly (constantly 42)))
21:07clojurebot#<core$constantly$fn__4085 clojure.core$constantly$fn__4085@c25346>
21:07gfredericks,~@(hehe)
21:07clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: hehe in this context, compiling:(NO_SOURCE_PATH:0:0)>
21:07gfredericks,~@(:hehe)
21:07clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Wrong number of args passed to keyword: :hehe>
21:07gfredericks,~@(+ 1 2)
21:07clojurebot42
21:07gfredericksphew
21:07arrdemgfredericks: you broke the bot. wp.
21:07gfredericks,(alter-var-root #'clojure.core/unquote (constantly inc))
21:07clojurebot#<core$inc clojure.core$inc@192c07a>
21:07gfredericks,~~3
21:07clojurebot5
21:08arrdemverma: this is black magic. please don't try this at home
21:08gfredericks,~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~0
21:08clojurebot#<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote>
21:08gfredericks,(alter-var-root #'clojure.core/unquote (constantly inc))
21:08clojurebot#<core$inc clojure.core$inc@1f530ab>
21:08gfredericks,~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~0
21:08clojurebot42
21:08johnwalkerlol
21:08vermadafuq
21:08vermaarrdem, not trying it .... yet
21:09arrdemverma: ~, `, ~@ and ' are hacks, gfredericks is mucking with the symbols they translate into and doing evil things
21:09gfredericksI dunno if I'd describe ' as a hack
21:10fifosineAnyone here familiar with working with Datomic? I'm trying to delete an entity but I get the error ":db.error/datom-cannot-be-altered Boot datoms cannot be altered: [:db/excise :db/valueType :db.type/ref 13194139534317 false]"
21:10vermaarrdem, I am going to leave them alone for now
21:10verma:)
21:10gfredericksclojurebot: ' is not a hack
21:10clojurebotOk.
21:10gfredericks~'
21:11clojurebot' is the quoting you want here
21:11arrdemverma: they're fine to use, just don't use alter-var-root until you're really really sure what you're doing.
21:11gfredericksonly do it for funsies
21:11arrdemor when you need to add features to clojure.core :X
21:11gfredericksyeah I guess that doesn't preclude normal macro usage does it
21:11gfredericks,~0
21:11clojurebot1
21:12gfredericks,(defmacro thing [x] `(identity ~x))
21:12clojurebot#'sandbox/thing
21:12metellus,~~0
21:12gfredericks,(thing 99)
21:12clojurebot2
21:12clojurebot99
21:12gfredericksarrdem: okay it's totes cool
21:12gfredericksrich put it there for such a time as this
21:13gfredericks,(alter-var-root #'clojure.core/unquote (constantly reverse))
21:13clojurebot#<core$reverse clojure.core$reverse@3af8a6>
21:13gfredericks,~"foo"
21:13clojurebot(\o \o \f)
21:13andyfMom, Gary's messing with the bot again!
21:14vermalol
21:16arrdemquick someone alter-var-root on eval to (constantly 42)
21:27gfredericksbefore it's too late!
21:34masonndoes anything else besides false a nil evaluate to false in a boolean context?
21:35masonnand
21:36justin_smithmasonn: false and nil are the only "falsey" values
21:37masonnnil is used to indiate no value?
21:38verma,(into {] [[:hello "world" :bye "world"]])
21:38andyfmasonn: This is a real corner case, probably only arising if you do Java interop with Java Boolean values, but in Java and Clojure a freshly constructed Boolean object is treated as true, even if the value it contains is false: http://grimoire.arrdem.com/1.6.0/clojure.core/if/
21:38clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>
21:38andyfnil is Java null
21:38gfredericksmasonn: or something
21:39verma,(into {] [[:hello "world"] [:bye "world"]])
21:39clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>
21:39verma,(into {} [[:hello "world"] [:bye "world"]])
21:39clojurebot{:hello "world", :bye "world"}
21:39andyfmasonn: Ignore that comment and link I sent you if you aren't doing Java interop
21:39justin_smithmasonn: yes, it often comes from get with a selector that isn't in the collection
21:39justin_smith,(get [] :a)
21:39clojurebotnil
21:39verma,(into {} (partition 2 [:hello "world" :bye "world"]))
21:39clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry>
21:40vermahow are these two different?
21:40gfrederickspartition returns seqs
21:40justin_smithverma: a seq cannot be a map entry, a vector can
21:41vermajustin_smith, hmmm
21:41justin_smith,(into {} (map vec (partition 2 [:hello "world" :bye "world"])))
21:41clojurebot{:hello "world", :bye "world"}
21:42justin_smithonce you have vectors, it is fine
21:42vermajustin_smith, hmm ok, thanks
21:45justin_smith,(apply hash-map [:hello "world" :bye "world"]) verma: also, consider this
21:45clojurebot{:hello "world", :bye "world"}
21:45vermajustin_smith, nice
21:46vermahere it shouldn't matter if that second argument is a vec or a list, right
21:46justin_smithright
21:46justin_smithbecause apply is different
21:46justin_smith,(apply hash-map '(:hello "world" :bye "world"))
21:46clojurebot{:hello "world", :bye "world"}
21:46vermanice
21:46justin_smithinto is stricter (and faster, if things are already shaped the way it likes)
21:56gfredericksinto doesn't need a top-level vector either
21:56gfredericksjust that the pairs themselves are vectors
21:56vermahaha shit man, macros so awesome
21:56gfredericksuh oh
21:56vermaama gonna create a new language using clojure
21:57gfredericks,(defn impoverish [data] (clojure.walk/postwalk #(if (zero? (rand-int 2)) %) data))
21:57clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.walk, compiling:(NO_SOURCE_PATH:0:0)>
21:57gfredericksnevermind I'm going to bed
22:47Faredebugged the lexer, now debugging the parser
22:47Farewhat do you use to debug clojure code?
22:49justin_smithFare: what I do is keep my functions as stateless as possible, and provide tests with the range of inputs selected. If those tests don't catch the error, then use an atom to record the inputs I actually get at runtime, and make tests out of those if they were not in the expected range.
22:50justin_smiths/selected/expected
22:51justin_smithalso, move all possible logic out of stateful code and into stateless, so most everything can be trivially tested without magic or mocking
22:53andyfFare: printf, clojure.tools.trace
22:56Farejustin_smith, yes, I'm writing in mostly pure functional style
22:56Fareso all the debugging is happening with pure functions
22:57Fareandyf: thanks!
22:57FareFileNotFoundException Could not locate clojure/tools/trace__init.class or clojure/tools/trace.clj on classpath: clojure.lang.RT.load (RT.java:443) — it's not builtin?
22:58andyfalso pprint is nice for big data structures, especially nested maps
22:58Frozenlockpprint is one of those function I'd like in every namespace in my repl
22:58drusellersagreed
22:59andyfFare: no, a separate lib that you can add to your Leiningen dependencies, assuming you are using Leiningen. Line to add to your dependencies for latest version at the README here: https://github.com/clojure/tools.trace
22:59justin_smithalso, if it was not clear, what I meant about the map thing was (def calls (atom {})) (defn debugged-f [args] (let [... result (frob args)] (swap! calls assoc args result) result))
22:59justin_smith*the atom thing that is
23:00Fare[com.gfredericks/tools.trace "0.7.3-SNAPSHOT"] ?
23:00justin_smiththat way you can use your repl to interactively look at the args / try variations, etc.
23:01andyfFare: That looks like a version customized by someone else. The README I linked to says this: [org.clojure/tools.trace "0.7.8"]
23:03Farethat's the one I found on clojars
23:04andyfClojure core team distributes their libs via maven.org repos. You can search for them at search.maven.org
23:06FrozenlockBefore I start coding... is there a library to make tutorials for ring websites?
23:06TEttingerFrozenlock: ?
23:06TEttingertutorial to make libraries, you mean?
23:06FrozenlockNo, I mean what I said :-p
23:06kristofFare: Hello!
23:06kristofFare: What exactly are you working on?
23:06brehautFrozenlock: O_o
23:07FrozenlockTEttinger: sya I have a website in ring. I'd like to make a tutorial to guide a user through many steps (pages).
23:07FrozenlockSurely this can be done with middlewares
23:07Frozenlock*say
23:07Farekristof, still the same: a compiler for a pure python dialect
23:07kristofI never knew what you were working on :P
23:07Fareright now, debugging a python 3.5 parser
23:07Farethe lexer is pretty stable now
23:08FrozenlockDoes my question make more sense now? :-p
23:09TEttingeryes, you kinda want a chain-of-pages thing
23:09FrozenlockAhhh, that's the technical term I was lacking. Chain-of-pages.
23:10FareClassCastException java.lang.Long cannot be cast to java.lang.String clojure.lang.Compiler.analyze (Compiler.java:6464) — how do I get a backtrace?
23:10Fare(.printStacktrace *e) isn't very helpful
23:11Farewow, the REPL is hosed. Is it worth trying to debug it?
23:11FareI hosed it with (set! *file* 0)
23:12TEttingerFrozenlock, not a technical term at all! but it should be what you need, right? I mean even webcomics and blogs have a similar need
23:12FrozenlockOh, wait, I'm not sure that's what I want.
23:12brehautTEttinger, Frozenlock: pagination?
23:12TEttingerthanks brehaut
23:13FrozenlockWow I must suck at explaining
23:13FrozenlockI'll be back...
23:14TEttingerFrozenlock, you want to have a continuous stream of read this->next->read this new thing->next, but also the ability to bookmark or skip around mid-way?
23:14TEttingerlike http://www.xkcd.com/
23:15Frozenlockhttps://www.refheap.com/88141
23:16FrozenlockIs this more clear?
23:16TEttingermuch
23:16TEttingerthat seems like a common pattern, it could be a lib
23:16TEttingerbut I kinda doubt it
23:17FrozenlockWell, that's why I asked. I don't want to redo what has already be done. (and probably of higher quality than what I could do)
23:18FrozenlockSeems like middlewares are an obvious solution for this. You can associate the tutorial to a ring session and just pop the stack at each steps.
23:18TEttingerI rewrote a java lib's Timer class in C# because synchronized doesn't behave like lock does. the original Timer class re-implemented functionality in java itself, I believe...
23:18TEttingerre-writing does happen for all sorts of reasons!Z
23:21brehautFrozenlock: why does it need to be stateful?
23:22FrozenlockTo know at which step the user is?
23:22brehautthe users client can track that?
23:23brehaut(ie, you send the link to the next step with the current step, and the client follows that as needed)
23:23Frozenlockas in "/tuto/1" "/tuto/2" ?
23:23brehautsure
23:24FrozenlockEh, sounds dangerous to me. What if the user clicks on something else? If it's in the session, you can see it and guide him back to the right place.
23:25brehautif you arent tracking per user state, then its really non-dangerous. they can go back and forth as needed without you having to trak tha
23:29FrozenlockDangerous to lose the user. He's at "/tuto/12" and then clicks on "/home" or whatever.
23:30andyfFare: Can you do a paste of what (.printStackTrace *e) showed you? (clojure.repl/pst *e) may give a nicer format for Clojure stack traces.
23:30andyfbut maybe not, depending on what it looks like
23:30FrozenlockOr do you think the user is smart enough to press 'back'? :-p
23:30andyfAlso, don't do (set! *file* 0) :-)
23:31Fareandyf: nothing more than what I showed. Looks like the clojure runtime is just not prepare for *file* being of the wrong type
23:31FrozenlockBut it would be simpler... I think the pages are already in HTML for the middlewares...
23:31andyfFare: I've never tried that, but not surprised if that messes up something fairly deep down in the compiler
23:32andyfFare: Strings are better :)
23:33brehautFrozenlock: is this a tutorial for people recently defrosted from cryostorage?
23:33Fare(incredible how much smaller than the java code this parser is, btw)
23:34Frozenlockbrehaut: I'd say for people who can't see a difference between IE and Chrome. "It's the Internet."
23:34Fareyeah, since my parser reports the value of *file* everywhere (or should I be using a different parameter?), I figured I'd bind it to something with a very short representation. What's shorter than nil? Why, 0!
23:35TEttingerFrozenlock, heh I installed an antivirus software for a woman who didn't know that yahoo was internet
23:36FrozenlockYeah, I'm sure it's most of the population. We take so much information for granted...
23:37FrozenlockFor example, I recently realized that using 'placeholders' in html forms is confusing for some people, because they think it's already filled.
23:37xk05hm emacs-live with overtone looks interesting
23:38xk05i've got a fender strat with a little 35w practice amp that i play around on, this would be a good backup
23:40FareOK, one thing I'm missing for a full python 3.5 lexer is better unicode support.
23:40brehautxk05: 35w is little O_o?
23:41xk0535 watts? yeah
23:41Fareis the solution ICU4J ?
23:42brehautxk05: what constitutes loud then?! 5 watts is capable of pushing 100dB
23:42xk05its about the size of a small desktop tower
23:42xk05maybe i mean amps
23:42brehautxk05: nobody measures amps in amps
23:43Frozenlockuh?
23:43brehautxk05: that would super confusing too :
23:43xk05actually its 38
23:44FrozenlockIntensity is measured in amperes, is it not?
23:44FrozenlockYou are kidding me...
23:44justin_smithFrozenlock: decibels
23:44Frozenlock(dec Intensity)
23:44lazybot⇒ -1
23:44Frozenlock(dec so)
23:44lazybot⇒ -31
23:44FrozenlockStop using words as username!
23:44brehautxk05: wait, is this a solidstate frontman?
23:45FrozenlockI meant electric intensity -_-
23:46xk05it looks like this: https://reverb.com/item/141098-fender-frontman-pr-241-black
23:46xk05clojure sure has come a long way
23:46brehautxk05: yes thats solid state. as you were then.