#clojure logs

2013-01-30

00:00ChongLiokay flapjax is really cool
00:00piranhait is :)
00:00ChongLiI made a nice eventstream that simply consists of a set that contains all the keycodes of currently pressed keys
00:01ChongLiso much nicer than dealing with annoying repeating events and crap like that
00:09juliendddHi all, getting this exception with clostache: No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil
00:10juliendddAny ideas ?
00:10julienddd(im noob)
00:10xumingmingvI guess you are passing a nil to the function you are invoking
00:10xumingmingv(I havn't used clostacheE)
00:12julienddd(defroutes admin-routes (GET "/" [] ((render-resource "templates/global.html" {:html "<p>Hey this works??</p>"}))))
00:12juliendddThats my code, so I'm assuming the file is not found
00:12juliendddxumingmingv: thanks
00:14juliendddAnother question: what is the difference between (use 'clostache.parser) and (use clostache.parser)?
00:14juliendddwhat do those ' do in front of expressions?
00:14TimMcQuoting. It suppresses evaluation.
00:15juliendddTimMc: what is the difference with :
00:15juliendddTimMc: :something
00:15ChongLi: is for keywords
00:15ChongLi:hi evaluates to :hi
00:15juliendddand 'hi to hi ?
00:16ChongLiyeah
00:16ChongLibut hi might evaluate to anything
00:16ChongLidepends on how you def'd it
00:17ChongLiwhen you say 'hi you're not talking about the value
00:18ChongLiyou're talking about the symbol hi
00:18ChongLiyou can use quoted symbols even when they're not bound to anything
00:18juliendddChongLi: Ok, but how is that so much different from :hi ?
00:19ChongLi:hi is always :hi
00:19juliendddappart from being able to skip the starting ':'
00:19ChongLiit never means anything else
00:19xumingmingv&(type 'hi)
00:19lazybot⇒ clojure.lang.Symbol
00:19xumingmingv&(type :hi)
00:19lazybot⇒ clojure.lang.Keyword
00:19TimMcjulienddd: The ns macro *could* have been written to take symbols instead of keywords, but it wasn't.
00:19ChongLiit's just used for things like as a key in a map
00:19juliendddok I see
00:19ChongLi&{:hi "hello"}
00:19lazybot⇒ {:hi "hello"}
00:20ChongLi&({:hi "hello"} :hi)
00:20lazybot⇒ "hello"
00:20juliendddbut I can do &{'hi "hello"}
00:20ChongLiyes
00:20julienddd&{'hi "hello"}
00:20lazybot⇒ {hi "hello"}
00:20ChongLiyou can really do anything you want with maps
00:20juliendddnow if I (def hi ...) somewhere
00:21ChongLi&{'(a b c) "hello"}
00:21lazybot⇒ {(a b c) "hello"}
00:21juliendddare they potential problems if I use 'hi ?
00:21ChongLino
00:21ChongLiyou're still only using the symbol
00:21juliendddis that the dif between symbol and keyw ?
00:21juliendddok
00:21ChongLihere's the real advantage of keywords
00:21ChongLithey can be called like functions
00:21ChongLi&(:hi {:hi "h"})
00:21lazybot⇒ "h"
00:21julienddd&{'hi "hello"}
00:21lazybot⇒ {hi "hello"}
00:22julienddd&({:hi "hello"} :hi)
00:22lazybot⇒ "hello"
00:22juliendddthat's cool
00:22TimMc,('hi {'hi 4} 5)
00:22clojurebot4
00:22TimMcSymbols can do it too. :-P
00:22ChongLihaha
00:22juliendddok thanks for the clarification guys
00:23ChongLiisn't there a performance gain from using keywords?
00:23juliendddso I guess they *could* be interchangeable
00:23ChongLiat least on jvm
00:23TimMcThey have different purposes.
00:23juliendddbut convention has it that keywords are for maps, etc and symbols for namespaces ??
00:23lazybotjulienddd: What are you, crazy? Of course not!
00:23juliendddis that right ?
00:23TimMcjulienddd: Symbols are ultimately intended to be used to name things (locals, vars...).
00:23ChongLisymbols are usually used when you want to talk about the names of things
00:24juliendddTimMc: but what's the advantage of (def 'hi "...")
00:24juliendddover (def hi "...")
00:24TimMcOne works and the other doesn't.
00:24ChongLi&(eval (cons '+ '(1 2 3)))
00:24lazybotjava.lang.SecurityException: You tripped the alarm! eval is bad!
00:24ChongLiahhh
00:25ChongLianyway, what I typed would return 6
00:25juliendddCompilerException java.lang.RuntimeException: First argument to def must be a Symbol, compiling:
00:25juliendddfor (def 'hi "...")
00:25TimMcYep.
00:25TimMcThat's (def (quote hi) ...)
00:25juliendddbut:
00:25julienddd&(type 'hi)
00:25lazybot⇒ clojure.lang.Symbol
00:25juliendddso it's a symbol ???
00:25lazybotjulienddd: Yes, 100% for sure.
00:26ChongLihaha
00:26TimMcjulienddd: The difference between what a macro sees and what the evaluator sees.
00:26ChongLi&(type '(+ 1 2 3))
00:26lazybot⇒ clojure.lang.PersistentList
00:26ChongLithink about it this way
00:26TimMc(OK, def isn't actually a macro, but close enouhg for this discussion.)
00:27ChongLian expression in clojure is just a list where the first element is a symbol
00:27ChongLior another expression that evaluates to a symbol
00:27xumingmingv<lazybot> julienddd: What are you, crazy? Of course not!
00:28xumingmingvwhen will lazybot jump out and say something like this?
00:28ChongLiI think when you use more than one ??
00:28lazybotChongLi: What are you, crazy? Of course not!
00:28Raynesxumingmingv: Who knows!?!??
00:28lazybotRaynes: What are you, crazy? Of course not!
00:28juliendddlol
00:28RaynesHe gets all excited when he sees multiple question marks.
00:28RaynesThis is amalloy's doing.
00:29Raynesls
00:29lazybotboot etc mnt proc srv usr
00:29ChongLiit's great stuff
00:29juliendddcd usr
00:29juliendddno??
00:29lazybotjulienddd: Definitely not.
00:29ChongLihey howcome lazybot doesn't allow 5 defs?
00:29ChongLiyou demo'd that in your talk
00:29ChongLi(clojail)
00:29TimMcjulienddd: For now, anytime you see '... read it as (quote ...)
00:30juliendddok, thanks
00:30RaynesChongLi: Because it (for no particular reason) runs everyone's code in the same namespace. The limiting is for memory mostly, it doesn't do any good if people overwrite existing clojure.core vars.
00:30TimMc,''''x
00:30clojurebot(quote (quote (quote x)))
00:30xumingmingvlazybot, you are interesting??
00:30lazybotxumingmingv: What are you, crazy? Of course not!
00:30juliendddclojure gets more exciting everytime i learn about it
00:31ChongLiRaynes: ah I thought you could prevent people defing over existing vars
00:31RaynesIt could work exactly like tryclj does, but I haven't bothered because it's pretty rare that people want to def things and if they do they probably should be using their own REPL anyways.
00:31RaynesNaw, not without giving everyone a different namespace like tryclj does.
00:31ChongLiah
00:32RaynesNice that you watched my talk. <3
00:32RaynesWere you there was I gave it?
00:32ChongLino
00:32ChongLiI just got into clojure recently
00:32ChongLiI've been watching a lot of the talks
00:32RaynesIt's horribly out of date now, and the testers and such work entirely different now (all function based with serializable functions), but the concept remains the same.
00:33ChongLiyours was one of the best talks I think
00:33Raynes<3
00:33ChongLisome of the other speakers weren't as comfortable
00:33RaynesThat was the first and only talk I've ever given.
00:34ChongLiyeah, you nailed it with the humor
00:34xumingmingvChongLi: watch on the vimeo?
00:34ChongLiyoutube
00:34ChongLihttp://www.youtube.com/user/ClojureTV
00:34xumingmingvthanks for the link
00:36juliendddOk, last question I swear: why does (:use clostache.parser) fail and (:use 'clostache.parser) work ?
00:36juliendddand question part b) :P
00:36juliendddwhat is the diff between (:use ...) and (use ... )
00:36juliendddif any ?
00:36luoluoluohi, how can I re-require a .clj after I modifying it?
00:37luoluoluoI mean in lein repl
00:37mybuddymichaelluoluoluo: (require 'my-ns :reload)
00:37ChongLi(:use clostache.parser) fails because clostache.parser is undefined at the time
00:37RaynesStep one: use stencil
00:37juliendddah, makes sense
00:38ChongLiyou're telling it to get the value of clostache.parser and :use whatever that is
00:38ChongLifor question b
00:38ChongLithe difference is that (:use ...) is part of the ns form
00:38ChongLiwhereas (use ...) is just a function
00:39juliendddok... I need to read up on that ns form thing
00:39ChongLiwhat language did you come from?
00:39juliendddjava javascript
00:39luoluoluomybuddymichael: thanks, I just tried (use 'my-ns :reload), it seems work, what's the difference
00:39clojurebotI'm no man, and she's no lady!
00:39juliendddobj C
00:39ChongLithe ns form in clojure is for working with namespaces
00:39xumingmingvhaha clojurebot also jumps out
00:40ChongLia namespace just gives you a separate "batch" of names to work with
00:40ChongLiso that you can use the same name multiple times in different files without overlap
00:40juliendddsorry, what's a form in cloj?
00:40juliendddanything in () ?
00:40ChongLiand it gives you ways of managing those names
00:41ChongLiyeah a form is another word for an s-expression
00:41ChongLiit usually refers to special forms
00:41ChongLiand a special form is anything that's not a function nor a macro
00:42ChongLibut everything is used the same way, even if each thing works differently (in terms of semantics)
00:42juliendddlike def
00:43ChongLi&(+ 1 2 3)
00:43lazybot⇒ 6
00:43ChongLiso in this case, + is a function applied to 1 2 3
00:43juliendddyeah, that much I had grasped
00:44juliendddstill confused on macros vs. funcs
00:44ChongLiin the case of functions, the values 1 2 3 are evaluated before the function is called
00:44juliendddand special forms, why are they special? they're the low level building blocks ?
00:44ChongLi&(+ (+ 3 4) 3)
00:44lazybot⇒ 10
00:44ChongLiin this case
00:44ChongLiit first evaluates to
00:44ChongLi&(+ 7 3)
00:44lazybot⇒ 10
00:44ChongLibefore reaching 10
00:44TimMcjulienddd: They're what the compiler-writers decided couldn't (or shouldn't) be implemented in terms of other in-language constructs. So... yes. :-)
00:45ChongLispecial forms and macros don't necessarily have to evaluate their arguments before using them
00:45juliendddand macros vs funcs, in a nutshel ?
00:45ChongLi(def abc 3)
00:45juliendddmacros manipulate code ?
00:45ChongLiso in this case, abc is NOT evaluated
00:46ChongLicause if it were, it'd be unbound
00:46juliendddok, so that's why (use 'something) needs the '
00:46juliendddget it
00:46ChongLithis is why you cannot write a function like def
00:46TimMcjulienddd: Yes, macros are functions from code -> code. The compiler calls them.
00:46ChongLithink of it like this
00:46ChongLiall lisp code is made up of lists
00:47ChongLia macro is a function that runs at compile time and it transforms a list to a different list
00:47TimMcChongLi: And "atoms", if we're talking Lisp.
00:47ChongLiyeah
00:48ChongLijulienddd: another simple way to think about it is this:
00:48ChongLifunctions evaluate each of their arguments once (and only once) before proceeding
00:49ChongLimacros can evaluate their arguments 0, 1 or more than 1 time
00:49ChongLithis is what makes macros such as when possible
00:49ChongLi&(doc when)
00:49lazybot⇒ "Macro ([test & body]); Evaluates test. If logical true, evaluates body in an implicit do."
00:50juliendddyes, if it was a function body would get resolved when called
00:50juliendddthanks for clarifying
00:50juliendddyou guys are very helpful
00:51ChongLino problem
00:51juliendddRaynes: why stencil over clostache ?
00:52xumingmingvChongLi: macros evaluate their args more than 1 time? can you give an example?
00:52ChongLixumingmingv: let me see here...
00:53ChongLiyeah I can't think of one in a library off the top of my head
00:54xumingmingvsomething like this? (defmacro a [b] ~b ~b)
00:54ChongLiyeah
00:55ChongLi(defmacro multi-eval [b] `(do ~b ~b))
00:55ChongLitry calling that with (multi-eval (println "foo"))
00:56xumingmingvok, got the idea
00:56ChongLi&(doc dotimes)
00:56lazybot⇒ "Macro ([bindings & body]); bindings => name n Repeatedly executes body (presumably for side-effects) with name bound to integers from 0 through n-1."
00:56ChongLithere you go
00:57ChongLimultiple evaluation
00:57ChongLiin a library function
00:58ChongLilibrary macro, rather
00:58ChongLihaha
01:00xumingmingven, never used this macro
01:01xumingmingv(haha, I didnt write much clojure..)
01:03amalloyi'm consistently surprised by how often the ??/??? heuristic is right, Raynes xumingmingv ChongLi
01:03ChongLi???
01:03lazybotChongLi: Oh, absolutely.
01:03ChongLiamalloy: doesn't it just match via regex?
01:04amalloy??? always generates a "you're right", and ?? generates a "you're wrong"
01:04ChongLioh, haha
01:04callenbotfastest template engine in Clojure: go
01:05amalloygo isn't a templating engine in clojure
01:05callenbotI meant in the sense that I was asking people to volunteer an answer
01:05ChongLiperhaps we should start a new templating engine called go
01:05mybuddymichaelHah.
01:06callenbotChongLi: harm it's Google juice even more?
01:06ChongLiyeah
01:06callenbotI like it.
01:07ChongLiI find it a bit annoying how google uses leverage to promote their languages
01:07ChongLithey should be promoting clojure!
01:08callenbotChongLi: why?
01:08ChongLibecause clojure's amazing!
01:08xumingmingvfor template engine, you might want to take a look at this new engine: http://httl.oskpi.com/design.html#性能
01:08TimMcamalloy: Truth is stranger than fiction.
01:08ChongLimost of their languages are too conservative
01:08xumingmingv(in java)
01:08xumingmingvseems very fast
01:08Raynescallenbot: Probably hiccup, right?
01:09callenbotRaynes: I've seen two different answers there
01:09callenbotRaynes: 1. Hiccup is the fastest && 2. Hiccup is the slowest
01:09callenbotRaynes: I shit you not, that's the variance.
01:09callenbot...I better write my own benchmark, huh?
01:09bawrcallenbot: are you sure you need great performance, anyway?
01:10callenbotbawr: nope, this is purely for my personal edification.
01:10callenbotbawr: I'm curious.
01:10callenbotrealistically I'd use hiccup or clabango anyway. I just want to know.
01:11bawrOh, I see. Sorry, pigeon-holed you as a knee-jerk. ;)
01:11AfroMujahidRaynes, am I stil your favourite?
01:11Raynescallenbot: In my benchmarks laser is faster than Enlive with no purposeful optimizations. So, I'd be interested in seeing a decent benchmark.
01:11callenbotbawr: naw I know better than that.
01:11callenbotRaynes: yeah I'm just going to write a benchmarking suite for template engines
01:11callenbottesting various use-cases.
01:12Raynescallenbot: Just write it for whatever and I'll fill in the laser blanks.
01:12bawrcallenbot: yeah, I try to hammer Knuth's advice into people. ;)
01:12callenbotbawr: I'm usually the one telling people to fuck off unless they have data
01:12callenbotbawr: I was just wondering if anybody in here had tested recently.
01:12bawrcallenbot: two rules of optimization: 1. don
01:12bawr1. don't. 2. (for experts) not yet. ;)
01:13bawrcallenbot: ooh, right. excellent.
01:16xumingmingvbawr: http://httl.oskpi.com/design.html#性能
01:16xumingmingvhere is a test result, and with the test code
01:16xumingmingv(for some java engine)
01:18bawrand a moonspeak anchor, I love it already :)
01:18rclarksoncould i get some help from some pros: https://www.refheap.com/paste/9072
01:19bawrwoah, those instability/abstractness graphs are weird.
01:21xumingmingvhaha, why weird?
01:21callenbotI'm hammering together statistically significant and self-warming benchmarks for the template engines.
01:21callenbotyou'll have data soon my friends!
01:22bawrxumingmingv: well, when would you want an instability vs abstractness graphs?
01:22bawrxD
01:23bawr*graph
01:23xumingmingvmaybe to show to users that my library is good, maintainable?
01:23bawrbut both strike me as a bit hard to measure
01:24xumingmingv(Actually I dont understand that graph very much either)
01:25brehautrclarkson: are you trying to generate datalog queries?
01:25rclarksonbrehaut: yes
01:25bawrI've tried translating the comments, and it may not be as silly as it seems.
01:25rclarksonbrehaut: from a form .. tricky though
01:25brehautrclarkson: where does ?foo come from?
01:26brehautrclarkson: i presume ?bar comes from :bar ?
01:26rclarksonbrehaut: yes
01:26ChongLi?foo comes from yes?
01:26rclarksonjust a variable to have in the other ones
01:27callenbotthe results on these tests is already interesting :)
01:28callenbotbwahahaha
01:28rclarksonChongLi: no
01:28bawrcallenbot: don't keep us waiting, you mad scientist, you :)
01:28rclarksonany idea how i can convert that one to catalog?
01:28rclarksondatalog
01:28brehautrclarkson: ##((fn [[k [low high]]] (let [?k (symbol (str "?" (name k)))] (list ['?foo k ?k] [('> ?k low)] [('< ?k high)]))) [:bar [10 20]])
01:28lazybot⇒ ([?foo :bar ?bar] [10] [20])
01:28brehautrclarkson: but its truely horrible
01:29ChongLiyes, truly truly horrible
01:29brehautand i got my quote in the wrong place
01:29callenbotbawr: trying to come up with less trivial test cases :)
01:29brehaut ((fn [[k [low high]]] (let [?k (symbol (str "?" (name k)))] (list ['?foo k ?k] [(list '> ?k low)] [(list '< ?k high)]))) [:bar [10 20]])
01:29callenbotin one test, I've already got a 10x variance in performance among template engines.
01:29ChongLiconverting keywords to strings and then to symbols is always going to be ugly
01:30brehautrclarkson: you could probably work backwards from goop like that to something with syntax quote and it'd clean it up a bit
01:30rclarksonbrehaut: goop?
01:30brehautrclarkson: the blob of code i just pasted
01:30ChongLiI don't see why you wouldn't store the symbol ?bar instead of a keyword
01:31brehautyeah it does seem questionable
01:32bawrcallenbot: interesting, though I'm not very surprised, unless the slower ones aren
01:32bawr't as feature-packed :)
01:34callenbotbawr: I can't wait to bring enlive into this...
01:36bawrcallenbot: I mean, I'd expect most templating engines to be fine with just-acceptable performance and focus on power/ease of use instead.
01:38callenbotbawr: depends on the use-case, really.
01:39bawrcallenbot: but then again, expecting and guessing is a moot point when we can have hard data. :)
01:39callenbotbawr: we'll see.
01:39callenbotoh yes, these results are very interesting indeed.
01:43brehautjust FYI, david santiago has some templating performance tests because hes obsessive about performance https://github.com/davidsantiago/tinsel
01:44brehautits at the bottom of that readme
01:44callenbotbrehaut: not comprehensive enough.
01:44callenbotbrehaut: not comprehensive enough at all.
01:45brehautwell thats clearly bullshit
01:45brehautits not comprehensive yes
01:45brehautbut at all?
01:46callenbotokay fine, it's comprehensive
01:46Raynesbrehaut, callenbot: Those are the ones I've been using. If you look at my README and his, our results are completely and wildly different.
01:46callenbotit doesn't cover enough template engines
01:46callenbotRaynes: I am writing my own benchmarks for this reason...
01:46callenbotRaynes: I'm using a proper benchmarking engine that hammers out the variance and JIT warmup.
01:46RaynesI don't know why are results are so different so I explicitly noted in my README that they are probably bullshit.
01:46Raynescallenbot: Using criterium?
01:47RaynesIt is supposed to be really good https://github.com/hugoduncan/criterium
01:47callenbotRaynes: yes I am
01:48rclarksonbrehaut: Thanks for the help. I have cleaned it up a little bit
01:48callenbotrclarkson: oh it's you again
01:48callenbotrclarkson: are you from Sweden?
01:49Raynescallenbot: Don't know if you saw me say it earlier, but I can add the laser benchmarks when it is ready if you want.
01:49rclarksoncallenbot: how come?
01:49callenbotRaynes: I'll push up a version with just hiccup and clabango momentarily
01:50callenbotRaynes: when it hits my github, you're welcome to fire a pull request at me
01:50callenbotafter I push those up, I'll probably do stencil next
01:50Raynescallenbot: I'll take a look tomorrow. I'm in Windows for video games at the moment.
01:50callenbotRaynes: at your leisure. I'm in no hurry, just glad I'm finally writing this.
01:50amalloyhah. the exact opposite of the microsoft project Games for Windows
01:51amalloycallenbot: did you look into forking dsantiago's existing benchmarks rather than starting from scratch? are they unusable for some reason?
01:53callenbotamalloy: I don't know what caused the variance in the numbers, I don't want it infecting me
01:53callenbotif it infects me, I'll start tracking down the source of the variance
01:53callenbotI'll be using Raynes to check for htis.
01:53callenbotthis*
01:53RaynesI read "I'll be using Raynes to check for tits"
01:54Raynesamalloy: The problem is that when I, callen, and David all got entirely different and in some cases wildly different numbers when we ran those benchmarks on our respective systems,.
01:54RaynesThe benchmarks also don't seem particularly intensive.
01:54RaynesNot that I know anything about what a benchmark should look like.
01:55brehautRaynes: neither does anyone else. everyone just pretends
01:55amalloywell, the idea is that criterium encapsulates "what a benchmark should look like", and you just provide test cases
01:55amalloywhichever ones you think are important
01:55callenbotI'll copy david's test cases themselves
01:55callenbotI'm not reusing the harness though
01:56callenbotyeah he's not re-running the benchmarks, that's pretty problematic.
01:57Raynescallenbot: Yeah, I always warm up the JIT a bit before I take my results.
01:58callenbotit's a reasonably "real world" benchmark (dave's) but they're not being run properly and they aren't well designed to isolating edge cases or variance in behavior between libraries
01:58callenbotfor example, mine are designed to see if the differences between the template engines level off as templates increase in complexity, or get further apart.
01:58amalloyoh, lord. yes, i assumed he would be using criterium
01:58callenbotamalloy: see? my crankiness isn't always unmerited.
01:58Raynesamalloy: Yeah, no, he isn't. He just runs the things.
01:59RaynesDISCLAIMER: I am not complaining about anything he has done.
01:59callenbotI love dave. he gets my viewpoint on templates. but the viewbenchmarks needs replaced.
01:59RaynesI'm moving just a few miles of him. He could kick my ass in person if he wanted. I'm scared.
01:59callenbotimproved
02:07callenbotI feel like I'm an idiot: IllegalArgumentException No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil clojure.core/-cache-protocol-fn (core_deftype.clj:527)
02:07callenbotwhat's going on?
02:07callenbotwrong clojure version or what?
02:07amalloy&(clojure.java.io/reader nil)
02:07lazybotjava.lang.IllegalArgumentException: No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil
02:08amalloysomeone is calling that, probably via slurp or something
02:08callenbotamalloy: it's almost certainly slurp, did this get deprecated or something?
02:08amalloyno?
02:08clojurebotno is tufflax: there was a question somewhere in there, the answer
02:08amalloyyou're just calling it with dumb args instead of good args
02:09callenbotI've used this template engine before and I'm following the --- alright fuck this
02:14callenbotchrist that was annoying.
02:14callenbotstupid mistake
02:24callenbotwell. str is going to be hard to beat.
02:37callenbotbawr: I have results.
02:37callenbotbawr: published
02:50bawrcallenbot: where'd you put them?
02:51bawrcallenbot: sorry, just got into the office, didn't follow the whole discussion :)
02:53dsantiagocallenbot, amalloy, Raynes : Those tests pre-date the existence of criterium.
02:53dsantiagoFor what it's worth, any results I posted were on warmed-up JVMs, having run the test function multiple times, before taking a reading.
02:54dsantiagoOf course, now that we have criterium, we can do a lot better.
02:56callenbotdsantiago: https://github.com/bitemyapp/clojure-template-benchmarks
02:56callenbotdsantiago: check it out!
02:56callenbotdsantiago: stencil is #winning right now.
02:57callenbotdsantiago: help me add stuff! I'm trying to add tinsel right now.
02:57callenbotbawr: https://github.com/bitemyapp/clojure-template-benchmarks
02:57dsantiagoNice.
02:57callenbotdsantiago: yeah you're winning by quite a bit right now.
02:57bawrcallenbot: thanks, checking it out
02:58callenbotdsantiago: 20-25x difference between stencil and hiccup/clabango
02:58bawr"Test results are avg / standard deviation."
02:58bawrFinally someone does std-dev.
02:58dsantiagocallenbot: I'm surprised to be faster than hiccup. I don't believe that will hold true for all templates.
02:58callenbotbawr: duh.
02:58callenbotdsantiago: come up with test cases and I'll add them!
02:58bawrcallenbot: I officially like you at this point. :)
02:58callenbotI'll take pull requests to that repo, just don't fuck shit up.
02:59michaelr525hello
02:59callenbotmichaelr525: hi
02:59bawrcallenbot: although you really should use same units all around
02:59callenbotbawr: yeah I was pondering that.
02:59callenbotbawr: should I standardize on microseconds?
03:00bawryeah, I'd do that
03:00callenbotkk
03:00callenbothrm, wait what
03:00callenbotdafuq is tinsel doing
03:01callenbotthat can't be real.
03:01bawralso, that's a neat link to the article about docs
03:01callenbotbawr: what link?
03:02bawrhttp://jacobian.org/writing/great-documentation/what-to-write/
03:02dsantiagoWhat IS tinsel doing?
03:02callenbotdsantiago: I think I'm mis-using it, h/o
03:02dsantiagoQuite likely. Tinsel is a different beast.
03:03callenbotyeah I'm not setting content properly.
03:03callenbotdammit.
03:11callenbotbawr: I fixed the units. refresh.
03:11callenbotdsantiago: why is stencil render-file so much faster than render-string?
03:11bawr>20,600 ms / 799 us
03:11bawrmissed one
03:11dsantiagoBecause render-file can cache the parsed template.
03:12callenbotah motherfucker.
03:12callenbotbawr: thank you, pushing.
03:13callenbotdsantiago: help unfuck my tinsel stuff please: https://github.com/bitemyapp/clojure-template-benchmarks/blob/master/src/clojure_template_benchmarks/core.clj#L59
03:13dsantiagoYep, this isn't gonna do anything. Hang on.
03:14callenbotdsantiago: hanging.
03:18dsantiagocallenbot: https://gist.github.com/be8f54c948547455cd26
03:18callenbotdsantiago: thank you!
03:20callenbotdsantiago: do I need to (str ...) the result of the deftemplate or is it doing that for me?
03:20dsantiagoShould be returning a string, no?
03:20dsantiagoReturns a string for me, as you can see.
03:21callenbotdsantiago: well it's...eh...you'll see the results, h/o
03:22callenbotdsantiago: https://github.com/bitemyapp/clojure-template-benchmarks
03:22dsantiagocallenbot: Should be identical to hiccup, and it is.
03:22dsantiagoTinsel is a hairy macro that spits out a function that does what hiccup would do.
03:22callenbotdsantiago: the simple data injection numbers are throwing me off.
03:23dsantiagoYeah, I'm looking to see what that code is.
03:23callenbotrerunning with a slight change
03:23callenbotyou put in a string literal, replacing it with the var.
03:23dsantiagocallenbot: I see.
03:23dsantiagoThat is turning into a string literal.
03:23dsantiagoSo there is no work, it's just a function that returns a string.
03:23callenbotyeah there we go.
03:24callenbotupdating results, these are more sane
03:24callenbotI replaced the "bar" with bar
03:24callenbotwhich is (def bar (str "bar"))
03:24dsantiagoRight, I forgot to unshortcut that.
03:25callenbotthe behavior makes sense now, pushing.
03:25callenbotdsantiago: refresh if you care to see the new result
03:25alex_baranoskyanyone know which version of clojure introduced nice-style ns doc strings? And which version intro diced ^:private style metadata?
03:25callenbotsimple data injection is no longer totally loony.
03:25dsantiagoYeah, seems about there with hiccup again.
03:25callenbotyeah, but with slightly higher variance.
03:26callenbotdsantiago: you wouldn't happen to understand enlive or laser would you? those are the next two I'd like to get rolled in.
03:26dsantiagocallenbot: I wrote tinsel becaues I didn't like Enlive, so no. And I haven't seen Laser.
03:26callenbotRaynes: stand up and be counted https://github.com/bitemyapp/clojure-template-benchmarks
03:26callenbotdsantiago: I actually like what you're did with tinsel.
03:26dsantiagocallenbot: You're the first!
03:27callenbotdsantiago: it has a logic to it. It's a nice contrast to the...toothlessness of hiccup but it's less totally insane whole-tree-transformation-zipper-omg-wtf like enlive/laser
03:27callenbotalthough laser is a bit less "roll in ALL the toys!"
03:27callenbots/like/than/g
03:28callenbotI'm considering using clabango for main/normal templates and stencil for API/partials/pjax
03:29dsantiagoIs the template rendering performance so severe for you?
03:30callenbotdsantiago: not so much, but I like to keep such things in the back of my mind.
03:30callenbotI can't wait to see how enlive and laser do on this
03:30dsantiagoEnlive is gonna be terrible.
03:30callenbotI know, that's the fun part.
03:30dsantiagoI actually had code for it in my benchmarks, I just never posted the Enlive results.
03:35dsantiagocallenbot: Ancient results from viewbenchmarks: https://gist.github.com/855872
03:35callenbotyeah, boned.
03:36callenbotthat's actually slow enough to be unacceptable, tbqh
03:36dsantiagoThat was my appraisal at the time.
03:36callenbotsub-20ms and I'm wont to not really care, but 100-200ms is absurd.
03:36dsantiagoActually, at that time, I seem to recall people were getting some pathological templates that were taking many seconds to render just once.
03:36dsantiagoThough I think they got some of those performance bugs sorted out eventually.
03:36callenbottoss that on top of the usual database waits and client network latency and you'll never fulfill a request faster than 500ms.
03:37bawrdsantiago: pathological as in "designed to be slow"?
03:37bawror real-world stuff?
03:37dsantiagobawr: Er, no. I just meant, it was hitting some edge case in the engine that made it have terrible performance.
03:37callenbotthe reason I don't include type-hinting in the benchmarks is because nobody's ever going to do that IRL
03:37dsantiagohttps://groups.google.com/group/enlive-clj/tree/browse_frm/month/2010-03/fa85686239120122?rnum=21&amp;_done=/group/enlive-clj/browse_frm/month/2010-03?&amp;pli=1
03:38callenbotunless you're chuck norris or dsantiago. but I repeat myself.
03:38bawrdsantiago: that's terrible, then
03:38dsantiagoIf you scroll down, he had a page that took 6.5 seconds to render with 200 tweets on it.
03:39callenbotnoice.
03:39dsantiagoLike I said, I recall faintly that they did some perf work on enlive after this thread.
03:39dsantiagoI don't know specifics.
03:39dsantiagoI'd already done my own thing.
03:41callenbotdsantiago: how many template engines have you written? 2? 3?
03:42callenbotthat's what it looks like
03:42callenbotdsantiago: is quoin what backs stencil?
03:43dsantiagoquoin is just some utilities that I pulled out of stencil so I can use it in this next engine I'm writing.
03:43callenbotdsantiago: the jinja inspired one you queried me?
03:43dsantiagoI wouldn't say it's that much inspired by jinja, but yes.
03:45callenbotdsantiago: what are you planning to do differently? can you relink the gists?
03:46dsantiagocallenbot: New language, which I believe is more regular and a bit easier to parse. It's based around simple operations that can be combined for expressiveness, in that it lets you transform data before rendering it. And I'm thinking about a new approach to making it render even faster.
04:06newbHow can traverse a seq two items at a time? I need to compare each item to the previous item.
04:06newbThanks
04:06foodoo,(doc clojure.set/join)
04:06clojurebotPardon?
04:06foodoo,(doc clojure.string/join)
04:06clojurebot"([coll] [separator coll]); Returns a string of all elements in coll, as returned by (seq coll), separated by an optional separator."
04:07foodoowhy doesn't the first command work? Is clojure.string automatically imported while clojure.set is not?
04:13newbWas that clojure.set/join for me, foodoo?
04:13foodoonewb: no. I've stumbled upon that one myself
04:14foodoonewb: And I just entered the channel
04:17newbFound it - partition function
04:24m_m2Hi. I am na newbie. Can anyone tell me how i can change value of my local variable ? Like variable=variable+other_var . I know that locals i create by (let [] ) function.
04:26newbHi m_m2, one of the main ideas behind Clojure is that you DON'T modify variables unless you absolutely have to. See http://clojure.org/vars for more
04:27foodoom_m2: What do you actually want to accomplish?
04:29foodoom_m2: and (let) is not a function but a macro
04:29m_m2I have a "while" loop. Where I check some statements. If one of them is true then i need to increase one of my local var by other var.
04:29clojurebotIn Ordnung
04:30Sgeom_m2, that is generally not the preferred approach, although it is possible
04:30m_m2So how i can make this by a right way ?
04:30foodoom_m2: can you post your code on pastebin.com (or somewhere similar)?
04:30foodoom_m2: because the answer to your question really depends on what you want to achieve
04:31Sgeorefheap.com is typically preferred by Clojurists
04:31foodooSgeo: thanks, I'll try to remember that
04:31SgeoWell, it's by one of our own, so
04:31Sgeo(Raynes)
04:36m_m2foodoo It will be impossible right now. I am at work and this part of code is on my private comp. But... i tryed to resolve this : http://projecteuler.net/problem=1 . I have "while" loop where first of my locals was increased by 1 each time. Then I've checked (if (or (mod i 3) (mod i 5) )) . This is the moment... where its true I woluld like to add "i" to my sum variable "suma" .
04:38foodoom_m2: that's okay. Do you know the (reduce) function?
04:39m_m2foodoo nope. But i will check it on clojuredocs.
04:40foodoom_m2: The following are crucial functions for every functional programmer: map, reduce, apply
04:40foodoom_m2: and I forgot: filter
04:41foodoom_m2: Then there are also some variations of the functions just mentioned
04:43m_m2Soo i will create a list with my "i" variable and after tha ti will make (reduce + list_of_i) ?
04:43foodoom_m2: that's one way, yes
04:43m_m2foodoo Is there any other ?
04:44foodoom_m2: (apply + list_of_i) comes to my mind
04:44m_m2roodoo I see that reduce will use my stack right ?
04:45foodoom_m2: you refer to memory consumption?
04:45m_m2foodoo yes
04:46foodoom_m2: no, that's not an issue. If you use reduce you don't remember past reductions
04:47m_m2foodoo No. I mean is there any other why without use my stack.
04:47foodoom_m2: I don't understand. Maybe you should post your project euler solution on refheap.com
04:48m_m2foodoo Hmm...reduce use stack right ?
04:49foodoom_m2: No. It doesn't build up something like (+ 1 (+ 2 (+ 3 4))) but evaluates stuff directly
04:50foodoom_m2: It's more like a stream of values that are processed
04:51foodoom_m2: if you have a sequence like '(1 2 3 4) then reduce will take 1 and 2, sum them up and proceed to add 3 and 3 and then 4 afterwards
04:51m_m2foodoo how about apply ?
04:54foodoom_m2: afk
04:58foodoom_m2: the use of apply is best illustrated by an example: The (+) function takes any number of arguments: (+ 1 2 3 4 ...). But if you have a list of values that you want to add you can't do (+ '(1 2 3 4 ...)) because (+) expects single values and not a list as a parameter
04:58foodoom_m2: what apply does is that it rearranges the arguments to a function for you so that (apply + '(1 2 3 4)) becomes (+ 1 2 3 4)
05:01foodoom_m2: which should also not result in a linear but a constant stack increase
05:01Raynescallenbot: Hrm, why is half of -main commented out?
05:02RaynesWell, more than half.
05:08josteinkgit + heroku + clojure = I'm probably never going to install Visual Studio on my home laptop ever again
05:10foodoojosteink: what do you use as an editor?
05:11josteinkemacs
05:11josteinkI like sublime edit, and emacs is a bit heavy to get going
05:11josteinkbut I cant use sublime edit over ssh ;)
05:11josteinkemacs I have everywhere
05:12RaynesSublime is also a massive disaster for Clojure.
05:12josteinkmy biggest complaint there is actually the indentation
05:12RaynesMhm.
05:12josteinkit seems it cant do it right out of the box, and neither can any third party addin
05:12RaynesThere is a decent third party add on for it, but it isn't the same as real support.
05:13RaynesAnd I'd prefer he not pretend to support languages that he isn't going to put any effort into actually supporting.
05:13RaynesHe should just take the Clojure support out entirely, it's essentially useless as-is.
05:13josteinkah well
05:13josteinkIm back to emacs
05:13josteinkI like it
05:14josteinkit feels good to have a lisp-based editor to do your lisp-y stuff in ;)
05:14foodooI'm a Vim user but maybe LightTable will be the best choice in the future
05:17josteinkooh
05:17josteinka new ide/editor whose first demo/concept video is filled with clojure-code
05:18josteinklookss promising, but Ill stick to emacs for now ;)
05:20FoxboronI was wondering btw. When i was setting up emacs for the very first time. I fetched clojure-mode and then nrepl. That seems to break some keybinds or something (cant remember)
05:20FoxboronIs there any known issue doing it that way? The fix for me atleast was too only fetch nrepl, as clojure-mode is a dependency.
05:21josteinkI jsut used emacs-starter kit
05:21josteinkfrom technomancy
05:21josteinkand then added yank-indent.el
05:21josteinkthat was about it
05:21josteinkanyway. lighttable looks very interesting, and like some refreshing and new
05:21Foxboroncurrently got, nrepl, paredit, starter-kit and eldoc.
05:22josteinkIll wait till it proves itself though, until it matures ;)
05:23daimrodit's really sad that the author of LightTable has decided to write yet another editor instead of improving one of the existing... I mean, even if you're really good, you can't really expect to catch with Emacs or Vim within a lifetime, not unless you have 50 people working 7/24.
05:24bawrdaimrod: to be fair, most of the killer features he wants to do wouldn't really work as extensions of other editors.
05:25Foxborondaimrod: i think that would just make it less accessable
05:25maleghastdalmrod: Haters gotta hate… The person / people behind LightTable are __MAKING SOMETHING__ why do you care enough to beat on them..?
05:25josteinkdaimrod: to be fair
05:25foodoodaimrod: The Clojure support in Vim is pretty nice with vimclojure, but I still think that if LT implements the features that are planned, I will probably switch
05:26bawrdaimrod: besides... I just refuse to believe that Emacs is the pinnacle of Lisp development.
05:26josteinkdaimrod: emacs and those editors has a LOT of baggage which means that doing anything new or radical is hard or impossible
05:26josteinkdaimrod: much like firefox
05:26josteinkthere is a reason all new development is happening in chrome/webkit
05:26foodoojosteink: well spoken
05:26josteinksomeone who "wasted his efforts" on reinventing a wheel
05:26josteinksometimes it makes sense
05:27maleghastAmen - It's never a bad choice to innovate, and LightTable does just that. It may not be what everyone wants from a dev tool for Clojure, but no one can deny that its creators are innovators.
05:28daimrodI disagree, look at the xwidget branch, with more man-power I'm sure some awesome stuff could be made.
05:28daimrodbut Emacs ain't sexy
05:29maleghastdaimrod: *raises eyebrow* How Subjective do you wanna get, mon ami? I know plenty of people that think emacs is a sexy tool - try out Sam Aaron's emacs-live configuration if you don't believe me...
05:30foodoomaleghast: isn't that mostly the awesomeness that comes from a REPL?
05:33maleghastfoodoo: That and the Undo Tree, and Paredit and the core key-bindings in emacs that make for a powerful editing environment without taking your gads off the keyboard. I'm predominantly a Vi(m) guy, but even I can concede that emacs got game, and with some configuration magic it can be very powerful and productive as a tool. That's not to ay that I think that everyone should use emacs and only emacs - diversity is a GOOD thing :-)
05:34maleghastfoodoo: s/gads/hands - my typing SUCKS!
05:34maleghastfoodoo: s/ay/say - see what I mean?
05:35bawra quick question - say I have a bunch of clojure files, and I'd like to basically rename a function and update all references. will the existing emacs/clojure bindings let me do that? and no, straight-up text substitution doesn't count. ;)
05:37maleghastbawr: I have no idea, but out of interest, why doesn't text substitution not count?
05:37aroemersdiversity is a good thing indeed. Me and my development team, for example, get by with Sublime Text just fine for Clojure
05:37aroemers(I am learning emacs on the side though..)
05:37maleghastaroemers: ;-) nice!
05:37daimrodI don't want to troll or to bash anyone, but I can't stop to try to imagine what a team of emacs hackers could have done with 200k...
05:38bawrmaleghast: because what I'm *really* interested in is something else. I'm wondering if any clojure editing suites actually actively *use* the fact that clojure is a Lisp, with all the related homoiconicity goodness.
05:38bawrmaleghast: if they do, renaming a function would be the most basic feature I can think of.
05:39maleghastbawr: That __is__ a good question; my Clojure-Tools-Fu is way to weak to offer insight, but I wish you success in your quest ;-)
05:39Raynes$latest enlive
05:39lazybot[enlive "1.0.1"] -- https://clojars.org/enlive
05:39maleghastdaimrod: Hey, that's cool - why don't you get a bunch of emacs hackers together, do a proof of concept for some cool stuff and go find a backer..?
05:40bawrmaleghast: for that matter, I wonder if Emacs can do that for ordinary Lisps.
05:40bawrBecause if there's not one editor/plugin/whatever that does that, it's a fucking disgrace.
05:40maleghastdaimrod: I would, but I'm already over-subscribed with a day-job, being a Dad, being a Photographer and trying to get two other web projects off the ground… ;-)
05:40bawrI know Lighttable will, but it's too immature at this point.
05:41maleghastbawr: I can't help but agree with you, though I would like to stress that it had never occurred to me before either, so perhaps it's not so much a disgrace as a minor disappointment ;-)
05:41bawrnot really. I mean...
05:41bawrthe ability to do that is literally the first and foremost selling point of lisp.
05:42daimrodbawr: don't know for the Clojure mode, but in SLIME for CL there is `slime-who-calls' (bound to C-c C-w C-c)
05:43bawrdaimrod: oh, thanks, that's a good starting point.
05:43m_m2foodoo Are you using clojure in real world apps ?
05:43bawrI guess I'll have to actually understand how the major lisp modes work.
05:44maleghastbawr: If you get to the bottom of this question / these questions, PLEASE blog about it..? I'm interested, but have limited time… :-(
05:45bawrmaleghast: I once toyed with an idea of a lisp-only editor that basically lets you edit sexps, not text. and forces formatting. ;)
05:45bawrmaleghast: that's because it would make it *insanely* easy to operate on your code programatically then.
05:47maleghastbawr: That is both hardcore and clever, but I am not sure how useful it would be… I am prepared to be shown to be very wrong, and I am not naysaying, I promise, I'm just not sure my head can handle it and I would need to be "shown around" the idea a bit more I think...
05:47bawrheh, I know that feeling, I'll probably need to sacrifice a weekend just to research these questions properly.
05:47maleghastbawr: Hehe
05:48bawrbut well, there's already paren-mode or whatever in emacs, and it seems popular enough.
05:48bawrthis isn't really taking the idea much further. :>
05:49maleghastbawr: Fair point - I am going to have to go back to the TDD in (j)Ruby that I am doing at the moment, and consign Clojure to the realm of dreaming, at least for now...
05:50bawrfor me, the forced-formatting was actually appealing because I know I spend *way* too much time on it. now it would be just a matter of editing the code pretty-printer once. :)
05:51bawrWell, Enlive looked interesting for about five seconds:
05:51bawr>No namespaces support (hence unsuitable for most XML)
05:52p_ls/most/most interesting/
05:54bawrI mean... come on, I know XML namespaces are a mess, but this just hamstrings it. :<
05:56foodoom_m2: No, I'm not (yet)
05:57maleghastbawr: It does sound like a problem, for sure...
05:58foodoom_m2: Maybe I'll write an XMPP client if I have the time
05:58p_lbawr: no, seriously, *properly* designed XML stuff can be fun
05:58maleghastbawr: Do you __have__ to use XML?
05:59bawrmaleghast: let me put it this way - when I do, it's the tricky kind of XML.
05:59bawrp_l: true!
05:59maleghastbawr: Oh, that's no fun at all… Over my software engineering career I've done more than my fair share (it feels like anyway) of "using" XML and I have almost always regretted it… ;-)
06:00p_lunfortunately good XML requires thinking things through, just like good file formats
06:00p_l.DOC was more thought-through format than a lot of XML out there ;P
06:01bawrmaleghast: to be fair, most problems with XML have more to do with borderline-retarded way it's generated and used, not the format itself.
06:01foodoo<listofattributes><attribute><name>foo</name><value>bar</value></attribute></listofattributes>
06:01bawrAt least as far as using it programatically goes, we all know it's a mess for human readbility. :)
06:02p_lfoodoo: that thing is known as Second Normal Form, and should be considered atrocity and crime
06:02maleghastbawr: I could not agree more with your last statement.
06:02bawrp_l: I can do you one better!
06:02p_lbawr: Three Words: Apple .plist XML
06:02p_lif I ever get the guy responsible for it, he is going to limp
06:03bawr<listofmaterials><material name="something".../><material name="foo bar".../></listofmaterials>
06:03bawrand then later in the file
06:03bawr<something>...</something>
06:03bawr<foo_bar>...</foo_bar>
06:03foodooouch
06:03bawrYeah.
06:04bawrwhen I first saw it, I puked a little :<
06:06maleghastbawr: Yep, .plist files are hideous, no argument from me on that!
06:08foodooa couple of month ago Rich Hickey introduced something like "clojure data format" something similar to JSON but with Clojure literals. What was the exact name of that again?
06:08bawrp_l: oh God
06:08maleghastEDN
06:08bawrp_l: I just looked those up.
06:08maleghastfoodoo: https://github.com/edn-format/edn
06:08bawrp_l: horrible, horrible.
06:09maleghastThere is also Fressian, which is the Datomic interchange format, based on Hessian
06:09foodoomaleghast: thanks. Did anyone use these yet?
06:11maleghastDatomic uses Fressian, so anyone using Datomic is de facto using it… I am considering EDN as a successor to JSON in a system I am working on at the moment, should JSON performance continue to be a problem, as it is implemented in Ruby as well as Clojure.
06:12maleghastfoodoo: To answer your question, yes, but it's still early-adopted times… ;-)
06:12augustlEDN has what I really miss in JSON: sets
06:12bawrOoh. How did I not know about Datomic for so long?
06:13maleghastaugustl: Yeah, that is a lovely feature
06:13augustlbawr: shame on you! :)
06:14augustlmaleghast: very often my JSON arrays have set semantics, but that needs to be communicated out of bounds..
06:15josteinkaugustl: from what Ive seen lots of (JSONy) people have complained about EDN
06:15maleghastaugustl: Well indeed, but needs must when the devil (or client) drives… ;-)
06:15josteinkaugustl: mostly because you have 3 ways to define sets/arrays
06:16bawrjosteink: how so? a cursory read of the spec doesn't suggest that
06:16maleghastjosteink: Why would anyone complain about a technology - I just don't get that. I mean use it, don't use it, but why expend energy bitching about it?
06:16augustljosteink: hmm, what are the 3 ways?
06:16josteinkaugustl: you have seq's/lists, you have vectors, you have setsm you have maps
06:16josteinketc
06:17josteinkwhich is a nice distinction in a programming lanaguge with regard to what -implementation- fits best
06:17josteinkfor a data interchange format I agree its a bit redundant
06:17augustlI see
06:18maleghastjosteink: Not if you are interchanging between systems written in Clojure, because then it fully supports all of Clojure's fundamental data types.
06:18josteinkmaleghast: sure
06:18josteinkbut then its a clojure data serialization format
06:18augustlthere are more environments than Clojure where it matters whether a list is random access or not
06:18josteinkand no longer a general purpose data interchange format
06:18josteinkor would you appreciate if clojure had to deal with JS's quirks, in your code, simply because you want to consume JSON data?
06:19augustlI'd say JS quirks are a lot less general than data structure semantics :)
06:19maleghastjosteink: What makes you think that I don't, or rather that the person / people that maintain the various JSON libraries for Clojure don't ..?
06:19josteinkIm just saying that lots of people have problems with how EDN seems to be tailored for clojure and nothing else
06:20josteinkand thus it will have a hard time to suceed as a general purpose, popular data interchange format
06:20josteinkIm not saying anyone holds absolute truth
06:20josteinkjust that popular tide is not leaning towards EDN
06:20bawryeah, I don't see it happening either
06:22maleghastjosteink: Fair enough; I find myself unmoved by the "popular tide", but I cannot see anything wrong with your point :-)
06:27m_m2foodoo Do you know any real world apps written in clojure? Maybe clojure have some part of bussines where it may be usefull.
06:28bawrthe tags are a nice feature, to be sure
06:30maleghastm_m2: Not wishing to butt in (too much) on foodoo but there are lots of real-world apps written in Clojure. The majority are internal applications for large corporations, particularly banks in London and New York, but there are entire companies basing their work entirely in Clojure, like Mastodon-C for example.
06:30bawrin fact, one could sensibly omit vectors and sets from the core spec and just implement them as tagged elements
06:30foodoom_m2: maleghast pretty much summarizes it. Have a look at http://planet.clojure.in/ to see some stuff people do with Clojure
06:32foodoom_m2: But I think we don't have an application yet that has raised a great deal of awareness outside of the Clojure community
06:32bawrfoodoo: that's not necessarily a bad thing, really.
06:32m_m2foodoo Is there any kind of GUI framework for clojure like Gryphon for Groovy ? (easy to use). I know that clojure have web framework called Noir. But I couldnt find any big app written on it.
06:32foodoobawr: Reminds me of Haskell. "Don't be popular" ;)
06:33bawrThe way I see it, people who want to use Clojure already know about it. ;)
06:34foodoom_m2: There definitely is a Swing wrapper. But I forgot the name. But even if you don't find it, you can still use Swing directly through Java interop
06:34bawrI'm with Paul Graham on this - I'm really fine with Lisp being a secret weapon. xD
06:34maleghastbawr: *applause*
06:35bawrhmm. anyone knows why edn needs a discard sequence?
06:39foodoobawr: maybe to add debugging symbols to edn output?
06:40bawrthe way I see it, edn really tries too hard to be readable by clojure's eval
06:41bawrwhich is a bad idea in any case
06:41foodooIsn't it obvious? Rich Hickey strives for world domination ;)
06:42bawryeah, but it could've been made much more "friendly" with relatively little changes
06:45foodooThe github page says "Currently this specification is casual, as we gather feedback from implementors."
06:45foodooso maybe rich is still open for suggestions
06:46bawreh, I'll try if I get some time over the weekend
06:46bawrdoesn't seem likely, though :)
06:52clgvbawr: isnt the whole point of EDN that it is a decent subset of what the Clojure reader can read? thus enabling Clojure-to-Clojure interprocess communication as well as Clojure-2-World since the subset is chosen such that it is easy to implement?
07:24bosiehow does (ns blah (:import ....)) work? isn't (:import ... ) calling a function called :import?
07:25augustlbosie: it's a macro, it ends up calling (import)
07:27bosieaugustl: is this what macroexpand shows when it shows clojure.core/import ?
07:27foodoookay, since a couple of hours have passed, I'll repeat my question:
07:27augustlbosie: yes
07:27foodoo,(doc clojure.set/join)
07:28clojurebotTitim gan éirí ort.
07:28foodoo,(doc clojure.string/join)
07:28clojurebot"([coll] [separator coll]); Returns a string of all elements in coll, as returned by (seq coll), separated by an optional separator."
07:28foodoowhy doesn't the first thing work? Is clojure.string imported by default and clojure.set isn't?
07:29augustlfoodoo: for all I know it's bot specific behaviour
07:29foodooaugustl: it's reproducible in the REPL
07:29RaynesIt's also REPL-specific behavior.
07:29augustlperhaps the REPL requires clojure.string
07:30RaynesNothing but clojure.core is automatically included IIRC.
07:30foodooaugustl: good theory
07:30augustlseconding the iirc :)
07:30RaynesYou can test this theory by doing the following: java -cp `lein classpath` clojure.main
07:31foodootheory falsifie: (println (clojure.string/split "foo and bar and baz" #"and"))
07:31foodoothis programs works fine when saved in a file and invoked through "clj testprogram.clj"
07:31RaynesYup, I was wrong.
07:31RaynesI've been known to be wrong.
07:32foodooRaynes: still, was a good theory :)
07:32augustlwhat's "clj"? Never used that
07:32RaynesUgh, why do you have a 'clj'?
07:32augustlperhaps whatever clj is requires clojure.string ;)
07:32RaynesDelete it and forget it exists. There is no official 'clj' thing for Clojure.
07:32foodoobut ...
07:32Raynesaugustl: No, I just used clojure.jar directly.
07:33RaynesSurprisingly it is automatically required.
07:33foodooclj is a shell script that contains: java -jar ~/lib/clj/clojure-1.4.0.jar $@
07:33bosieaugustl: whats the point of writing :import when it gets translated into import anyway?
07:33Raynesbosie: Because one looks like a function call and the other looks like what it is which is a directive.
07:34bosieRaynes: it just looks illogical to me to have a keyword as a function call
07:34RaynesIt isn't a function call.
07:34RaynesHas nothing to do with a function call.
07:34bosieif ns wasn't a macro, wouldn't it be a function call?
07:35RaynesYes. And keywords actually are functions.
07:35Raynes&(:foo {:foo 1})
07:35lazybot⇒ 1
07:35bosiehm
07:35bosiei thought only in context of a hash or other sequences?
07:35RaynesYes.
07:36bosiewhich isn't the case for :import/:use
07:36RaynesSo?
07:37RaynesIt isn't a function call, it is a directive. It could behave differently to 'import', 'require'.
07:37bosieso its another special usage case to remember
07:37RaynesIt would be a special case regardless of how it looks.
07:37RaynesKeyword, symbol, whatever, it is still in a macro where the rules of evaluation are changed.
07:37bosietrue
07:45clgvbosie: no it is the namespace default case ;)
07:48bosieclgv: which just showcases why clj is confusing to learn
08:03clgvbosie: humm why? all material I read that introduces namespaces uses the keywords in the ns-form
08:03clgvbosie: just get one of the recent books.
08:03foodooclgv: But it's still confusing
08:04magnarswhy is the ns form of require/use not [:require [...]] instead of (:require [...]) ? I know both work, but the second one seems more commonly used.
08:05magnarsthat would maybe alleviate some of the confusion?
08:05clgvfoodoo: well the rule is in normal clojure dont use import- require- refer- directly but use keywords in the ns-form
08:05bosieclgv: it is confusing because of the mental overhead due to inconsistency that clojure introduces
08:05clgvbosie: which inconsistency?
08:06bosieclgv: (:import...)
08:06bosieclgv: (for [x [...] :let [...] :when ....]
08:06bosieclgv: why not use '(ns foo [...])' like for?
08:07bosieclgv: introducing new rules for every macro seems incosistent to me
08:08clgvbosie: it makes no difference whether you use a list or vector in an ns-form
08:08clgvbosie: there is some rule which should be preferred but I dont know if I am following that one myself currently
08:09bosieclgv: wait, (:import ) is a list?
08:10clgvbosie: yes. code-is-data data-is-code ;)
08:11clgv,(type '(:import ))
08:11clojurebotclojure.lang.PersistentList
08:11bosie,(type (:import))
08:11clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Wrong number of args passed to keyword: :import>
08:11foodoothey are both seqs, that is all that matters
08:11bosienow i am even more confused, ha.
08:11foodoo,(type '(:import))
08:11clgvbosie: that does not work since you call the keyword :import as function on zero args
08:11clojurebotclojure.lang.PersistentList
08:11bosieclgv: ofc
08:12bosieclgv: hence its not a list
08:12bosieclgv: you dont do '(:import...), you do (:import...). i don't see how this is a list
08:12clgvbosie: you have to quote lists to tell clojure it is data. you dont have to for vectors
08:12clgvbosie: it is see below
08:13clgv,(type (read-string "(:import...)"))
08:13clojurebotclojure.lang.PersistentList
08:13Bodilbosie: Parentheses make lists. And lists are used to represent code - the quite just says "please don't evaluate this list as code."
08:13BodilThe quote*
08:14clgvbosie: (:import) fails since the repl or clojurebot try to evaluate it since it is an unquoted list evaluation means function call
08:14clgvbosie: get one of the good books to help you with the basics quickly
08:15bosieclgv: i already have
08:16bosieclgv: (ns foo '(:import...)) doesn't seem to work
08:17bosieBodil: yes. which was my point. its incosistent
08:18magnarsany reason to not just use [:require] instead in the macro? It behaves the same from what I can see.
08:18clgvbosie: no. you must not quote it there. `ns` is a macro, that means its content isnt neccessarily evaluated literally
08:19Bodilbosie: Not unless you assume lists are _only_ used to represent code. Lists are just lists. :)
08:19bosieclgv: you said the macro requires a list. i gave it a list. instead i must give it 'code' that doesn't exist
08:19clgvclgv: the ns-macro parses the given that and uses require/refer as needed "internally"
08:19Bodilmagnars: imo, using lists reads better. Like using vectors to declare function arguments. Breaks up the syntax a bit.
08:20bosieBodil: so the for syntax bothers you?
08:20clgvbosie: if you want to grasp the reason of that behavior read the macro section of your book
08:20Bodilbosie: No, why would it?
08:20bosieclgv: i will. thanks
08:22bosieBodil: figured (for [..]...) reads worse, not using lists and all.
08:22magnarsBodil: sounds like an argument based on familiarity, while bosie has a point about similar things behaving similarly.
08:23bosiemagnars: thanks
08:23Bodilbosie: That wasn't my point at all. I meant the idea behind (fn []) and (for []) was to avoid the "omg too many parentheses" argument, and make the code more visually identifiable.
08:24bosieok
08:24Bodilmagnars: Lists and vectors are both seqs. They do behave similarly. :)
08:25magnarsBodil: yeah, I just don't understand the seeming idiomatic use of lists for ns declarations
08:25noidithere's a good rule of thumb for choosing between vectors and lists: lists imply that their first argument is special somehow
08:25magnarsnoidi: that is an interesting thought. That way it makes more sense. Thanks.
08:26Bodilmagnars: No reason except it avoids syntactic clutter, I guess. :)
08:26noidiin `(:require foo :refer [bar baz xyz])` `:require` is special, but `bar` has no special meaning in the vector
08:27magnarsI liked the reason noidi gave, actually. Gives me a nice mental image of the difference.
08:27Bodilnoidi: That makes a remarkable amount of sense. :)
08:28clgvnoidi: right. cheap sequential versus cheap random access^^
08:28noidiit also affects indentation: in `(:import (foo.bar Baz <linebreak> Blah <linebreak> Xyz))` the class names `Blah` and `Xyz` would line up under the class name `Baz`
08:29clgvnoidi: wasnt that the argument in one of the style guides?
08:29noidiwhereas they would line up under the package name if you used a vector
08:29clgvnoidi: thats IDE dependent ;)
08:30noidisure, but that's the default for paredit and CCW's structured editing mode
08:30Bodilnoidi: That's a very Emacs centred argument, though. Which I like. :)
08:30BodilThough those indentation rules have been idiomatic for Lisp for a VERY long time...
08:30noidiI think VimClojure (or whatever it's called) follows the same indentation rules
08:31bosienoidi: lemme check
08:31noidi(whatever it's called now, since I recall it being split up into several packages)
08:32noidiapparently the packages are vim-clojure-static and foreplay: https://groups.google.com/forum/?fromgroups=#!topic/vimclojure/B-UU8qctd5A
08:32bosienoidi: [asdf Baz<LB>Blah<LB>] puts the Blah under asdf
08:33bosienoidi: with () it puts it under baz
08:34noidibosie, right, so the indentation is consistent among three of the most popular Clojure editing environments
08:35noidiso it's hardly an Emacs-specific argument :)
08:35clgvah well, I'd store clojure code in sexpression datastructure in databases instead of textfiles. that way identation is only a viewer setting which one might store in a style-part of the database as well when it differs from the viewer rules...
08:37noidiclgv, and then write a fork of git/mercurial to handle semantic changesets instead of diffing files... :)
08:38clgvnoidi: yeah versioning could be a lot better if it had s-expr info. wasnt there the git+clojure-parser from rich?
08:49michaelr525A services manager where services can be stopped/started and reloaded from updated code. Is something like this exists for clojure?
08:54clgvmichaelr525: you can use tools.namespace to do a complete reload
08:54michaelr525damn, bad connection did i miss something?
08:54clgvmichaelr525: you can use tools.namespace to do a complete reload
08:55clgvmichaelr525: but you meant something like a distributed system?
08:56michaelr525clgv: actually distributed is not a requirement.. I have two small programs where each program reads from a message queue. One downloads stuff the other posts stuff to facebook, they both run on the same server. So I started thinking that it's wastefull to run two jvms for such small programs..
08:57michaelr525clgv: you suggest that i can maybe write something simple myself..
08:58clgvmichaelr525: well then I do not understand the "service start/stop requirement" if you want to use a single JVM anyway
08:59Dark_Templehello :)
08:59michaelr525clgv: suppose that i would like to update the code for one of the services without shutting down the others..
09:00Dark_Templeis there a way to (partial function_name arg2) ,i mean to partial evaluate but with argument 2 first
09:00the-kennyI can't remember any function swapping the args
09:01the-kennyUse #(function-name % arg2)
09:02Dark_Templethx kenny i will try
09:05clgvmichaelr525: do use lein in the deployed setup or do you run a uberjar?
09:07michaelr525clgv: right now i just 'lein run'
09:08michaelr525clgv: it's my project so i can do whatever i wish :)
09:10clgvmichaelr525: well using tools.namespace to reload one namespace and its transitive dependencies should work then to reload new code
09:12michaelr525clgv: using an embedded repl?
09:14clgvmichaelr525: not necessarily. if you want one anyway, then you can do it like that. but you could also access it via http to trigger the reload
09:14clgvwebsite style or webservice style. as you wish
09:21michaelr525clgv: oh
09:22gmc_\q
10:49qerubHow would you check if all elements in a seq are equal? (apply = [1 1]) works fine except for the empty-seq case which gives ArityException. Spontaneously, I think that all elements of an empty seq should be considered equal; is this sane?
10:50nDuffqerub: you could reduce
10:51nDuff...though that's going to also not handle the empty-seq case
10:56qerubnDuff: I just noticed that the reduce function is called with zero args if the seq to reduce is empty. Interesting!
10:57qerubAh, well, suppose I'll just branch and handle the empty-seq case separately.
10:59clgvqerub: how about (every? #(= % (first coll)) (rest coll)) ?
11:00qerubclgv: Good call!
11:00qerubI'm a bit tempted to do (every? (partial = (first coll)) (rest coll)) though.
11:00qerubI think we have a winner. Thank you.
11:04TimMcI vaguely recall a JIRA asking for (=) to return true.
11:22gfrederickswhat does embedding objects in code have to do with print-dup?
11:22hyPiRion,(=)
11:22clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$-EQ->
11:23hyPiRionhrm, I was sure it returned true.
11:23gfrederickshyPiRion: do you think it should?
11:24gfredericksI can't decide if it makes sense or not
11:24bawr,(= 1)
11:24clojurebottrue
11:24bawryeah, if it works for one argument
11:24gfrederickshyPiRion: it kind of gives you two base cases
11:25hyPiRiongfredericks: I consider (= x1 x2 x3 x4) as a reduction
11:25gfrederickssome reductions don't make sense on an empty list
11:25gfredericks,(reduce = [])
11:25clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$-EQ->
11:25hyPiRion,(reduce = true [])
11:25clojurebottrue
11:26hyPiRionBut it shouldn't be = anyway, it has to be wrapped somehow.
11:26gfredericksthat still feels weird; the essense of the computation is checking if anything in that list (not= true)
11:26gfredericks,(reduce = false [])
11:26clojurebotfalse
11:26gfrederickso_O
11:26gfredericks,(reduce = 42 [])
11:26clojurebot42
11:26gfredericksoh sure
11:26gfredericks,(reduce = true [1 2 3])
11:26clojurebotfalse
11:26hyPiRion,(reduce hash-map true [])
11:26clojurebottrue
11:27gfredericks,(reduce = true [1 1 1])
11:27clojurebotfalse
11:27hyPiRiongfredericks: You have to wrap it, sure
11:27gfrederickshyPiRion: I don't think you can make it work as reduce with any default value
11:29hyPiRion,(let [foo [1 2 3]] (second (reduce (fn [[a x] b] [a (and x (= a b))]) [true (first foo)] (rest foo))))
11:29clojurebotfalse
11:29hyPiRion,(let [foo [1 1 1]] (second (reduce (fn [[a x] b] [a (and x (= a b))]) [true (first foo)] (rest foo))))
11:29clojurebotfalse
11:29hyPiRionwhaps
11:29hyPiRion,(let [foo [1 1 1]] (second (reduce (fn [[a x] b] [a (and x (= a b))]) [(first foo) true] (rest foo))))
11:29clojurebottrue
11:29hyPiRion,(let [foo []] (second (reduce (fn [[a x] b] [a (and x (= a b))]) [(first foo) true] (rest foo))))
11:29clojurebottrue
11:30hyPiRionIt's nil punning though, so I get your concern.
11:31hyPiRionAnd Common Lisp treats is as an error.
11:32gfredericksprint-dup is really weird.
11:59callenbotRaynes: speed, laziness
12:09actsasgeekI use slimv for my local repl needs. Is there a way to talk to a remote nRepl process? Is there an alternative for vim?
12:10Apage43actsasgeek: https://github.com/tpope/vim-foreplay
12:10tomojRaynes: consider the "always 2 spaces" rule from the perspective of a gedit user
12:10tomojdoes it seem more attractive? :(
12:11tomojI don't want to litter every repo with M-q commits
12:11actsasgeekapage43 thanks.
12:11tomojmaybe I can write a git post-commit that automatically launches emacs and goes through and M-q's
12:12hiredmantomoj: have you see https://github.com/dakrone/lein-bikeshed ?
12:13hiredmanit doesn't have a check for 2 spaces, but if you can figure out a way to add one..
12:14tomojwell, the problem is emacs needs to be involved
12:14tomojor I need to defect to cemerick's side
12:14technomancymagnars: the [:require] thing is because of indentation
12:14gfredericksif you're not shelling out to emacs you must be doing something wrong
12:14technomancymagnars: using () means the first element is "special", using [] means all elements are peers
12:15gfrederickstechnomancy: we could also use #{} for all elements are peers and unordered :)
12:15TimMctechnomancy: or pairs
12:15gfrederickse.g., (letfn #{(...) (...)} ...) :)
12:16TimMc(except that doesn't allow repeats, oh well)
12:16tomojoh, nice
12:16gfredericksTimMc: and kills the ordering
12:16TimMcsshhhh
12:16tomojI was hoping not to have to add a letrec
12:16technomancyyeah, it would work nicely for CL-style let though
12:16S11001001gfredericks: is a positive
12:16gfredericksS11001001: but what about all my imperative code?
12:17tomojdon't use a map
12:17gfredericksoh supporting both? that's interesting
12:17S11001001untagged unions &c
12:17gfredericksso vector let is available but smelly
12:17S11001001warn on vector let
12:18S11001001warn on loop, warn on recur, warn on vec, warn on everything
12:18tomojoh, you were discussing alternative let syntax, not an extended let?
12:19ToBeReplacedToday is excellent... coming back to clojure after a rage quit a few months ago to find the first conversation be a style conversation is the best! :)
12:19S11001001tomoj: you can just stick {} into let without breaking code, so w/e
12:19S11001001except for code walkers
12:19S11001001and macros that claim to work like let
12:20TimMc,(let {a b, 5 6} (+ a b))
12:20clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: let requires a vector for its binding in sandbox:>
12:20S11001001but that's just the usual
12:20TimMcWorth a try.
12:20tomojstick {} into let?
12:20S11001001yeah
12:20S11001001like, supporting let in common lisp is actually pretty hard
12:20S11001001someone, I think Gary King, wrote a library so that you could do it right
12:21seangroveSupporting let?
12:21S11001001writing a macro and saying "this part works like let"
12:21S11001001that is, inheriting all let's features
12:22gfredericks(defmacro let's [& args] (cons 'do args))
12:22S11001001except not "inheriting" because what would be the point if you weren't doing special processing?
12:26hyPiRionHow is that hard? You just do some lambda magic and voilà.
12:26hyPiRion(let [a 10] (+ a 23)) => ((fn [a] (+ a 23)) 10)
12:27seangroveS11001001: Ah, got it
12:27eggheadwhat do you guys think of prismatic's graph lib
12:27seangroveEmulating let then
12:28eggheadhttps://github.com/Prismatic/plumbing
12:28callenbothttps://github.com/bitemyapp/clojure-template-benchmarks does anyone have a benchmark idea or template library they'd like to pitch in?
12:28S11001001it's easy to implement let in your own macros, just expand to let. That's not the hard part. The hard part is when you want to say "this is like let, but..."
12:28hyPiRionS11001001: but what?
12:28gfredericksbut lazy!
12:28S11001001but whatever your macro is for
12:28seangroveegghead: Looking to watch the talk today, not 100% sure about the use cases for it yet
12:28gfredericksbut only allows destructuring up to 4 levels deep
12:29eggheadseangrove: what talk is that?
12:29hyPiRiongfredericks: but lazy? Psh, that's easy
12:29gfrederickshyPiRion: is it?
12:30hyPiRiongfredericks: Fire up delays and wrap all names within derefs
12:30gfrederickshyPiRion: that second part has some edge cases I think
12:30hyPiRionAfter you macroexpand the whole shait, since you have to avoid overshadowing etc.
12:30hyPiRiongfredericks: yeha
12:30hyPiRion*yeah
12:30S11001001hyPiRion: also what's names?
12:31gfrederickshyPiRion: oh yeah destructuring would be difficult
12:31S11001001hyPiRion: now you've declared that your macro is sensitive to the exact specification of the destructuring language.
12:31hyPiRionS11001001: I am using common lisp, go away
12:32seangroveegghead: Can't seem to find the strangeloop conference talk
12:32S11001001hyPiRion: So instead of the let destructuring problem, you have the DECLARE problem. That's even harder.
12:32hyPiRionS11001001: declare problem? Elaborate
12:33S11001001(let (a b c d) (declare some-stuff-about-a-b-c-or-d some-other-stuff) (declare yet-again) ...)
12:33S11001001Now you want to do special processing on a, b, c, d that splits up the let
12:33eggheadseangrove: ah, you mean the 'going faster with clojure' talk cross did?
12:33eggheadhttp://www.infoq.com/presentations/Why-Prismatic-Goes-Faster-With-Clojure ?
12:33S11001001First, you have to cut up the DECLAREs into what talks about a, what talks about b, etc
12:34S11001001and that's CL implementation specific, never mind that you have to parse every standard DECLARE form
12:34seangroveNo, I think "Graph: composable production systems in clojure"
12:34S11001001a single declare can talk about multiple bindings so you have to distribute and duplicate in the right places
12:34gfredericksegghead: that talk was at clojure/west
12:35S11001001then if you introduce gensyms, say to simulate parallel let, you have to rewrite all the declares to talk about those, e.g. DYNAMIC-EXTENT
12:35seangroveApparently the talk should have been made available a few days ago
12:35hyPiRionS11001001: Argh, you make my life frustrating
12:35S11001001hyPiRion: no, that would be X3J13 :P
12:36seangroveBut I'll definitely check out that talk as well
12:37hyPiRionin hindsight though, making an e.g. lazy let would be very much in compiler land
12:37hyPiRionYou've got to do semantic analysis, IR and error handling
12:38gfrederickshyPiRion: I tried to make an eager version of fn; that was also hard
12:38hyPiRiongfredericks: eager version of fn?
12:38hyPiRionAre you trying to implement let?
12:39gfrederickshyPiRion: it was to support currying; so if you have (curried-fn [a b c] ...) and you call it with two args, it precomputes anything not dependent on c
12:39hyPiRiongfredericks: Good luck on that.
12:40gfrederickshyPiRion: it pretty-much works: https://github.com/fredericksgary/currj
12:40hyPiRioncurrj, hahah. Sounds like curje.
12:41hyPiRionbut spoken like courage, hm.
12:42hyPiRiongfredericks: Tell me whenever you want to make a haskell compiler in Clojure, I'll be up for it.
12:42gfredericksI always want to do that.
12:44gfrederickshyPiRion: you mean compiling haskell src to assembly?
12:44hyPiRiongfredericks: to Clojure.
12:44hyPiRionIt'd be Haskell on top of Clojure on top of JVM on top of Assembly.
12:44tomojwhy not a liskell in clojure?
12:44gfredericksyeah that's something I've thought of more often
12:45gfredericksis apply impossible?
12:45gfredericksI feel like you couldn't implement update functions like update-in
12:48SegFaultAXhyPiRion: That's actually not possible.
12:49hyPiRionSegFaultAX: What's not possible?
12:55hyPiRionI can't see any reason why a Haskell-to-Clojure compiler isn't doable.
13:13technomancyanyone got opinions about configuration of the repl task in leiningen? got a particularly tricky decision around :init-ns discussed here: https://github.com/technomancy/leiningen/pull/963
13:14technomancytrying to decide how much of Leiningen it makes sense to expose to the project and wondering what kind of configuration changes you might want to make that would need to be visible at runtime rather than just at repl launch.
13:37patchworkHey all, anyone have a clue what is going on here? http://stackoverflow.com/questions/14611033/clojure-leiningen-project-suddenly-broken-what-would-cause-this-maven-error
13:37patchworkI am having a dependency issue with jackson-core-asl
13:37patchworkjust suddenly stopped working!
13:37patchworksomething about a bad checksum?
13:37technomancypatchwork: typically a botched deploy to maven central or possibly a corrupt mirror
13:38patchworktechnomancy: What can I do about it?
13:38technomancypatchwork: first suggestion would be to try an older version. if that doesn't work, you can update :repositories to set the :checksum setting for central to :ignore
13:39patchworktechnomancy: But I am not including it directly in my project, some other dependency depends on it
13:39patchworkAlso, it seems it is downloading every pom jackson has. I'm certain I don't need all these
13:40hyPiRion:exclude then
13:40hyPiRionand reinclude
13:40llasramSounds like someone setting a version-range to me
13:40patchworkI will try setting the :checksum to :ignore
13:40patchworkcrazy!
13:40llasram("someone" being a dependency library, not you yourself patchwork)
13:41hyPiRione.g. [ other deps here [foo "1.0.1" :exclude [bar baz]][bar "2.0.0"] [baz "0.4.0"]]
13:41technomancyunfortunately currently you can't get a deps tree to identify the offender when resolution fails. (there's an open ticket for that)
13:42technomancyI don't recommend keeping :checksum at :ignore, but it can be useful to debug
14:02ChongLiversion-ranges are one of the big reasons for cabal hell, right?
14:03TimMc"cabal hell"?
14:03ChongLiin haskell
14:03TimMcThat's a new one for me.
14:03hyPiRioncabal hell is funny
14:04ChongLiit's very easy to get into a situation where dependency resolution always fails
14:04hyPiRion`cabal install cabal-install`
14:04ivaraasenhyPiRion: just got accepted into KOMTEK btw :)
14:04ivaraasenpretty psyched
14:05hyPiRionivaraasen: oh, grats!
14:05hyPiRionYou're one of us now, muha.
14:05technomancyif you've been skeptical of the requirement to sign jars you release, please read https://news.ycombinator.com/item?id=5139583 kthxbai
14:06joegallophil, i never agreed with you until now. now i get it.
14:08hyPiRionjoegallo: you've never agreed with technomancy ever until now, or on signing jars?
14:10joegallolacking a witty response, just on the jars things
14:11technomancyheh
14:16pgmcgee\quit
14:18hyPiRion/quit
14:19technomancyclojurebot: alioth is http://www.ro-che.info/ccc/02.html
14:19clojurebot'Sea, mhuise.
14:20brehauttechnomancy: lol
14:25hyPiRionUh..
14:25hyPiRion,[(+) (+ 1) (+ 1 2) (+ 1 2 3)]
14:25clojurebot[1 1 3 6]
14:26TimMc*Someone* has done something naughty.
14:27TimMc~suddenly
14:27clojurebotsuddenly is !
14:27TimMcclojurebot: forget suddenly |is| !
14:27clojurebotI forgot that suddenly is !
14:27TimMc~suddenly
14:27clojurebotCLABANGO!
14:28anars(1)
14:40TimMc,(class +)
14:40clojurebotclojure.core$_PLUS_
14:40TimMc,(+)
14:40clojurebot0
14:40hyPiRion,(class +)
14:40clojurebotsandbox$eval128$fn__129
14:40hyPiRion*shrug*
14:40gfredericksrepeat question: what do objects embedded in code have to do with print-dup?
14:41hiredmanwell, one way to embed objects in bytecode is to print dup them and then read them back in
14:41TimMcgfredericks: Records, originally, I think.
14:45gfrederickshmmm
14:46gfrederickshiredman: that makes a striking amount of sense.
14:46gfrederickshow are vars referenced in bytecode?
14:46hiredmannot like that
14:46gfredericksI figured not :)
14:48hiredmanall the vars reference in a function actually go in to the functions constant pool (just a set of static final fields)
14:48hiredmanand there is a static init method for functions that sets the value for the constant pool fields
14:48gfredericksah
14:48hiredmanwhich for each var does something like constant_pool_field = RT.var("clojure.core", "+")
14:49hiredmanand where vars are used in the function, the bytecode reads from the fields instead of looked up via the namespace map over and over
14:50gfredericksthat makes sense; so it has the strings to reference the var but they're only used on class init
14:50gfredericksso similarly to embed an arbitrary object you need a string representation and then to reconstruct it
14:50hiredmanhotspot is unlikely (unable?) to inline across a map lookup, but the map lookup is removed from the execution path this way
14:51hiredmangfredericks: that sort of depends
14:51gfredericksso I had previously concluded that arbitrary data readers couldn't be used in code because of these issues, but it sounds like you would just define print-dup for the offending type and then it would be okay
14:53hiredmanI have some patches to the compiler that make it easier for classes that know how to do their own constant pool thing to embed themselves in the bytecode
14:54hiredmanhttps://github.com/hiredman/clojure/commit/9c3d863f5c5701f5bfb0cf669b7a0362391ce5b6
14:54hiredmanhttps://github.com/hiredman/clojure/commits/reflection-method-caching
14:56hiredmanwhen pjstadig brings up invokedynamic for clojure rich has mentioned he is interested in using invoke dynamic for vars
14:56ChongLitechnomancy: what's the best way to (repeatably) install an emacs package that's not in a repo?
14:56hiredmanwhich would, I think, replace the constant pool mechanism with an invokedynamic switchpoint
14:56technomancyChongLi: you can do M-x package-install-file
14:57technomancythat will do byte-compilation and autoloads
14:57ChongLiah ok
14:58ChongLiI wish there was some way to pull stuff down from github the way vim has vundle and pathogen
14:58ChongLiI guess pathogen doesn't
14:58technomancyChongLi: there is also el-get and marmalade
14:58technomancyerr--melpa
14:58ChongLiyeah I have melpa
14:58technomancyI don't like melpa because it's not selective though; there's no way to say "only get package X from git and use stable releases for the rest"
14:58technomancyChongLi: it's almost always best to just get a lib into marmalade
14:59ChongLiSo to remedy this there is a melpa.el package–available in MELPA–that will allow you to enable only certain packages or exclude certain packages. You can install the package manually by pasting this into yoru *scratch* buffer and evaluating it.
14:59technomancyit's so easy to do, provided you can contact the maintainer
14:59technomancyChongLi: huh; interesting
14:59ChongLiwell in this case it's just a color theme
14:59technomancyChongLi: I'd be more interested in a melpa that only built from tags instead of git master
14:59ChongLiI don't think the maintainer is around
14:59ChongLithat would be sweet
15:00technomancyyeah, in that case something like el-get may be the right choice
15:00gfrederickscan we make emacs run on nix?
15:00technomancyI don't like el-get as a default because it discourages proper release hygiene
15:00technomancygfredericks: port nix to elisp, or package elisp with nix?
15:00gfrederickstechnomancy: the latter
15:01technomancygfredericks: most of nix works in terms of PATH and LD_LIBRARY_PATH, you'd have to teach load-path how to be nix-savvy
15:02technomancydefinitely doable
15:02technomancybut getting community buy-in would be more difficult
15:03technomancyif elisp had a module system you could do some amazing things with in-process checksum-scoped packages, but alas.
15:05gfrederickslet's just stop making software for a decade and instead just make everything work with everything else
15:05gfredericksthe business people can wait.
15:06technomancyI'm for it
15:07gfredericksat the end of the exercise we will have "X works with Y" and "X compiles to Y" are always true
15:07TimMcExcel compiles to irssi.
15:07TimMcSounds legit.
15:08hyPiRiongfredericks: for any value of X and Y?
15:08seangroveirc is just a strange machine. No problem.
15:08TimMcheh
15:08gfrederickshyPiRion: only statements that could reasonably be said to be false
15:08hiredmanweird machine
15:09hyPiRionIrssi compiles to Excel.
15:09hyPiRionI wouldn't be surprised if there were some excelbot.
15:09seangrovehiredman: You're right, my bad.
15:09hiredmaninvokedynamic might also be a way to bring omops to the jvm, which would be kind of neat
15:11meliponehello! How can I tell if a number is Infinity in clojure?
15:12hiredmanhttp://soft.vub.ac.be/~smarr/research/omop/
15:12TimMc&(Double/isInfinite Double/POSITIVE_INFINITY)
15:12lazybot⇒ true
15:13TimMc&(Double/isInfinite 6)
15:13lazybot⇒ false
15:13TimMc&(Double/isInfinite (Long. 6))
15:13lazybot⇒ false
15:13meliponeTimMc: thanks!
15:16gfredericks&(Double/isFinite 7)
15:16lazybotjava.lang.IllegalArgumentException: No matching method: isFinite
15:24callenbotweavejester: https://github.com/bitemyapp/clojure-template-benchmarks Is there anything particularly pathological about the hiccup code here?
15:24TimMcgfredericks: Apparently *someone* at Sun thought there was an excluded middle.
15:25TimMcWhat am I gonna do with these transfinite numbers?
15:26lerkbothowdy
15:26lerkbothmm
15:26weavejestercallenbot: The hiccup code isn't optimised at all in those benchmarks
15:27gfredericksam I evil for using user.clj to setup print-method stuff for joda DateTimes?
15:27ibdknoxalso, for whom is templating the bottleneck?
15:29headshotah, much better
15:29headshotanyway: http://skillsmatter.com/podcast/home-27/clojure-at-nokia-entertainment/mh-6531
15:29headshotinteresting preso
15:30weavejesteribdknox: That's one of the reasons I've been meaning to change Hiccup to write to DOM structures instead. Slower, but more flexible.
15:30brehautibdknox: people with uninteresting sites
15:31ibdknoxweavejester: DOM structures?
15:31weavejesteribdknox: Like clojure.xml
15:31ibdknoxbrehaut: haha
15:31ibdknoxah
15:32brehaut(ibdknox which is to say its a bottleneck on my site i think ;)
15:32ibdknoxlol
15:32brehautof course uninteresting sites are trivially cachable
15:34augustlwith clojure.java.jdbc, how do I insert records for multiple tables in one transaction?
15:35augustlhmm, seems I can just wrap it in a transaction, that will absorb the inner-most ones
15:45weavejestercallenbot: Is bitemyapp your Github login?
15:52rboydhow I feel when the team keeps cranking out more ruby http://www.youtube.com/watch?v=0eBrb00pdGw
16:19N8DawgHi room, I've been looking through the Clojure source code, Compiler.java is a monster, anyone know of any plans to rewrite in Clojure?
16:19brehautmany plans, little action
16:20N8Dawgbrehaut: any idea on who to collaborate with?
16:20brehautN8Dawg: i fear you may need to dive into the jira for that
16:21cemerickN8Dawg: A couple of people have forked and done exactly that, though they've dribbled out into experiments rather than maintained alternatives.
16:21SegFaultAXThere are a few key classes in clojure that have attained beastly proportion.
16:21augustldoes mysql have anything like datomic tempids..?
16:21gfredericksis rich not terribly interested?
16:21SegFaultAXRT.java is another that comes to mind.
16:21cemerickkanaka's clojurescript self-hosting work is the furthest anyone's driven this sort of work
16:22brehautN8Dawg, cemerick: i recall that clojurescript was a sort of proof of concept / step along the way?
16:22cemerickbrehaut: my vague speculation is that it's far beyond that in terms of projected scope
16:23N8Dawgcemerick, brehaut: I'm thinking it doesn't actually have to be so complex, lets assume macro expansion is done prior, what am I not getting?
16:24cemerickany re-think of Clojure must bootstrap up to protocols and types to make it worthwhile
16:24cemerick(IMO)
16:25N8Dawgcemerick: surely its just a function: (compile-to-bytecode form) => byte-array
16:26N8Dawgcemerick: I'm trying to get a handle on the complexities i must be missing
16:27kanakaN8Dawg, brehaut, cemerick: my port is almost self-hosting. It has macros, protocols, types, etc. Using it to compile core.cljs (including what lives in core.clj in the upstream ClojureScript) is in-progress and tricky because of the multi-level interaction between namespaces, macros and the analyzer/compiler state.
16:28N8Dawgkanaka: sounds like you've had first-hand experience of this! whats the multi-level interaction between macros and compiler?
16:29cemerickN8Dawg: I am by no means the resident expert on Clojure compiler bootstrapping, but yes, you're missing a range of complexities.
16:29gfrederickskeep reading Compiler.java and you'll probably get a feel for it :)
16:30kanakaN8Dawg: just the compiler/emitter part without macro expansion isn't too hard to port. There is some trickiness around namespaces/var but it's not too bad (i.e. you have to keep the namespace/var information around for execution time).
16:32N8Dawgkanaka: right i get the namespace var stuff, thats for thread local bindings, defs which are declared *dynamic*
16:32cemerickkanaka: BTW, those hearing news of your work at the FP meetup last night were duly impressed by the concept :-)
16:32cemerickThat is to say, carry on.
16:32kanakaN8Dawg: hold on, let me find you a diff.
16:32N8Dawgcemerick: sounds interesting… what is it?
16:33kanakacemerick: cool, I'll be talking about it at Clojure/West if there interested enough to spend money ;-)
16:34cemerickkanaka: spend money?
16:34cemerickCommercial cljs fork FTW! ;-P
16:34cemerickN8Dawg: what's what?
16:34N8Dawgkanaka, cemerick: whats the concept, i'm being nosey…
16:34kanakacemerick: no no. I mean if they want to buy tickets to Clojure/West then can hear me talk about it. Or they can wait until the video is published too.
16:35callenbotweavejester: yes it is
16:35callenbotweavejester: you are welcome to fixxit.
16:35cemerickN8Dawg: https://github.com/kanaka/clojurescript/
16:35weavejestercallenbot: Sent you a pull request
16:35weavejestercallenbot: With type hints, Hiccup should only be a little slower than "str"
16:36TimMcMan, I should publish *my* poorly optimized templating code as a benchmark.
16:36callenbothrm, okay. I usually don't let type hints slide.
16:36TimMcThat'll get it fixed for free! :-D
16:36callenbotweavejester: I'm going to reject the PR, but integrate a separate type-hinted version of the hiccup benchmark.
16:36weavejestercallenbot: Sure thing
16:37kanakaN8Dawg: clojurescript.net is the online version of that. Basically a ClojureScript REPL entirely client-side (no JVM behind the scenes).
16:38N8Dawgkanaka: sweet, i can't help but thinking, that for Clojure, 90% of the compiler pipeline should be able to be shared between host platforms, with just the emiter being different
16:39callenbotweavejester: thanks for submitting the improvement!
16:40weavejestercallenbot: Comb is another templating engine that should have near-str performance: https://github.com/weavejester/comb
16:41callenbotweavejester: note stencil's results - is it possible to add caching/memoization to hiccup?
16:41kanakaN8Dawg: https://github.com/kanaka/clojurescript/compare/master...cljs_in_cljs The November commits are basically the analyzer (without macro expansion) and the compiler ported to Cljs. The work since is fixes to that and everything else.
16:41callenbotweavejester: like what stencil has that is. I don't think most template writers are going to type-hint their views so I'm seeking a "practical" way to close the gap with partial compilation and caching.
16:42weavejestercallenbot: Type hints are really only there for when you need performance, in both Clojure and Hiccup.
16:42weavejesterUsually the performance of templating engines is not your bottleneck.
16:43kanakaN8Dawg: a good chunk of the Clojure compiler is Java of which the compiler/emitter is a fairly small part. A good chunk of the ClojureScript compiler relies on that. Some of what I've been doing in cljs-in-cljs is porting the Java code in the Clojure compiler to ClojureScript.
16:43callenbotweavejester: usually, yes. but I enjoy this stuff. I'd still like to know what it would take to speed up hiccup absent type-hints.
16:46kanakaN8Dawg: but really, the complex part is namespaces and vars. Those two things are Java concepts/objects. They are _mutable_ data structures. There are a lot of subtle assumptions about how namespaces and vars and implemented and interact that have no analog in running ClojureScript programs (because they are gone by that point).
16:47weavejestercallenbot: Might be tricky to speed it up much further. The type of a variable depends on how it's interpretted by Hiccup, and reflection in Java is much slower than pre-compiled types.
16:49kanakaN8Dawg, cemerick: one example of changes required for cljs-in-cljs (not related to namespaces/vars): symbols in ClojureScript are special prefixed strings which mean they can't hold metadata. The type/protocol code relies on passing around metadata on symbols. I re-implemented symbols as first class objects.
16:51kanakaN8Dawg: I have to get back to my real job now, but just as another example, ClojureScript relies on Clojure's reader. There is a partial reader implemented in ClojureScript. I had to expand that by porting from Clojure's Java reader code (syntax quote/unquote, anonymous functions, etc).
16:52hiredmansyntax quote is nuts
16:53hiredmanI tried to graph the flow control through the syntax quote code in the reader a few years ago http://www.thelastcitadel.com/images/syntax.png
16:53kalizgai keep wondering what :tag ; :dynamic, :static etc. do in context of DEFN forms .. especially in clojure.core fns .. i can't find any documentation on these things .. ?
16:54N8Dawgkanaka: thanks for that! I'll have more of a dig through
16:54kanakaN8Dawg: read through that changeset I sent. Once you somewhat grok that, and if you're still interested, jump on #cljs-in-cljs.
16:55kanakakalizga: it's metadata that gets set on the var that the def* form creates that affects the behavior of the analyzer (for the most part).
16:55cemerickhiredman: bizarrely, that image won't open in FF
16:55Bronsait did on mine
16:56hiredmanhuh, opens in my firefox
16:56hiredmanI'm on 19.0
16:56kanakahiredman: here is the initial port I did (there are bugs in it fixed in later commits): https://github.com/kanaka/clojurescript/commit/0345cadd2d3e3edda65d1f8616da8d4c55bce38e
16:56cemerick18 here; "the image ... cannot be displayed because it contains errors" *shrug*
16:57kanakahiredman: it's not particularly idiomatic because it's a fairly one-to-one port of the Java code.
16:57cemerickhiredman: quite a stunning diagram
16:57hiredmankanaka: you might look in to using some of the syntax-quote as a macro stuff
16:58kanakahiredman: I'm missing the reference.
16:58hiredmankanaka: https://github.com/brandonbloom/backtick
16:59hiredmanI have a simpler version with less features (maybe more bugs?) that might be easier to get running in cljs https://github.com/hiredman/syntax-quote/blob/master/src/syntax_quote/core.clj
16:59kanakahiredman: oh right, yeah. I saw that a few weeks after I did the initial port. It's on my list to circle back around to see if it would be cleaner to incorporate that.
16:59hiredmanhaving it in the reader is gross
16:59Bronsayou can consider also blind's implementation https://github.com/Bronsa/blind/blob/master/src/blind/reader.clj#L762
17:00Bronsabbloom's implementation is actually really nice, but it depends on clojure's syntax-quote implementation rather than completely re-implementing it
17:02kanakahiredman, Bronsa: cool. I've noted these so I won't forget: https://github.com/kanaka/clojurescript/issues/25
17:06Bronsaalso kanaka, have a look at blid's StringPushbackReader, it should be faster than the one clojurescript was using
17:09kanakaBronsa: you have a link?
17:10Bronsayou might be interested in https://github.com/Bronsa/blind/blob/78b64980d19c91df904dcf90b01c42b15beeaeae/src/blind/reader.clj#L42-L148
17:10Bronsaexcept the InputStreamReader
17:11Bronsameh. I can open a pull request tomorrow if you want anyway
17:13kanakaBronsa: sure. It's Clojure so there will be some adjustment needed, but it looks like it might be straight forwards to port.
17:16kanakaBronsa: I have a half done implementation of a line numbered reader for error reporting, but that one has column reporting too, so bonus.
17:17Bronsaright, do you want the peek-char stuff too?
17:17Bronsait's used in some places to avoid the read-char && unread pattern
17:18kanakaBronsa: yeah, definitely.
17:29Raynescallenbot: Type hinting the laser code speeds it up a bit too. Not sure if it's worth adding a test for, but you should try it and see what your results are.
18:21headshotasdf
18:35seangroveHas anyone used ClojureCheck and found it to be worthwhile?
18:55Rich_MorinI'm filling in the "Rich Hickey Contributor Agreement" for clojure and clojure-contrib. However, I'm not sure exactly what what to put in Project name. Help?
19:10hyPiRionRich_Morin: Clojure should do
19:11Rich_Morintnx
19:14rplaca I was just playing with endorsements on LinkenIn and it asked me "Does Rich Hickey know about Clojure?" Talk about a "we are not worthy!" moment :)
19:18hyPiRionrplaca: Yeah, someone else mentioned that
19:18hyPiRionIt's funny
19:18TimMc"Does the Pope know about beanies?"
19:20Rich_MorinA couple of decades ago, a "suit" was standing in line behind a pony-tailed graybeard at a USENIX conference. To make conversation, he asked "So, have you been using Unix very long?". Dennis said yes.
19:22amphtroxanyone know were i can find a good explanation on macros?
19:28patchworkamphtrox: http://www.paulgraham.com/onlisp.html
19:32bawrRich_Morin: Ritchie had a ponytail at some point?
19:32bawrRich_Morin: Other than that, it's a great story. ^^
19:35TimMcbawr: Of *course* he did, he wouldn't be an Elder if he didn't.
19:35TimMcSheesh.
19:37Rich_Morin"He's probably best known for his long palindromes. Those of you in science fiction fandom may know him as chair of Disclave '95, as a member of WSFA and PRSFS, and as the guy with a beard and ponytail who was always playing with variants of Rubik's Cube at conventions."
19:37bawrTimMc: Photographic evidence suggests that dmr was the beard guy, but even that was well-kept.
19:37bawrThink Dijkstra.
19:37Rich_Morinhttp://alt.folklore.computers.narkive.com/RTG3MWCL/dennis-ritchie.2
19:38bawrKen was the wild hair one.
19:38amphtroxpatchwork i assume lisp and clojure macros are very much alike? anyway, looks helpful, thank you :)
19:39bawrAren't Clojure macros hygienic by default, making them more like Scheme?
19:40technomancyclojure macros solve the same flaws of CL macros as scheme macros do, but in a much simpler way
19:40TimMcRight, I don't think you can accidentally make an unhygienic macro in Clojure.
19:40bawrtechnomancy: is there an article / blog post somewhere that does a compare and contrast?
19:41technomancybawr: there are some overviews written by extremely ranty scheme fanatics, but I couldn't point you to that in good faith
19:41bawrYeah, I see.
19:41technomancyif you just read stuff about CL macros and ignore everwhere it talks about symbol capture and needing to call gensym, you'd be good
19:42bawrWhy don't you need genym in Clojure, though?
19:43technomancybecause ` auto-qualifies all symbols
19:44bawrI'm not sure if I understand. Is it sort of like a namespace thing?
19:46amalloy&`(let [x 1] x) is a class of error you can't make in clojure: in CL, that x might shadow a user's x
19:46lazybot⇒ (clojure.core/let [clojure.core/x 1] clojure.core/x)
19:46TimMc,[`foo 'foo]
19:46clojurebot[sandbox/foo foo]
19:46amalloy&`(let [x# 1] x#) solves the problem by asking the compiler (really, the reader) to do all the gensym fiddly bits for you
19:46lazybot⇒ (clojure.core/let [x__85869__auto__ 1] x__85869__auto__)
19:47bawrOh, I see.
19:47bawrNeat.
19:48TimMcMind you, x# is only consistent inside a single syntax-quote -- if you want consistency across several, you need to call gensym yourself and unquote the symbol into the code.
19:48TimMc&`[x# ~`x#]
19:48lazybot⇒ [x__85903__auto__ x__85902__auto__]
19:48bawr,[`foo `foo 'foo `[foo foo]]
19:48clojurebot[sandbox/foo sandbox/foo foo [sandbox/foo sandbox/foo]]
19:50bawr,[`x# `x# 'x# x# `[x# x#]]
19:50clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x# in this context, compiling:(NO_SOURCE_PATH:0)>
19:50bawr,[`x# `x# 'x# `[x# x#]]
19:50clojurebot[x__107__auto__ x__108__auto__ x# [x__109__auto__ x__109__auto__]]
19:50bawrOh, now I see.
19:50patchworkAll in all, Graham's On Lisp has the best discussion of macros I've found in general, as long as you are mindful of the (minor) differences
19:50bawrDid you guys read Let Over Lambda?
19:50clojurebotlet* is ##(let [[x y] [1 2]] (+ x y))
19:51patchworkbawr: Yeah! Great book, the guy wrote it as kind of a sequel to On Lisp
19:51patchworkeven though they are two different authors
19:52bawrAye.
19:52patchworkit goes more in depth into some things graham introduces, and has some crazy macro acrobatics as well
19:52amalloylet over lambda is...okay. there's some instructive stuff in there, but you have to (a) put up with his contempt for any lisp but CL, and (b) not mind the fact that most of the macros are about mutating things
19:52bawrI skimmed it, but I'd really need to read On Lisp first, I guess.
19:54patchworkamalloy: Forgot about the non-CL hate, he is kind of ridiculous at times
19:55patchworkbut the book has a giant LOL on the cover, I took a lot of it with a grain of salt
19:56patchworkMainly, the stuff I saw him do with macros I haven't seen anywhere else, kind of a tour de force to show to what ridiculous extremes you can take it
19:57patchworkBut not necessarily practical. More for mind opening than for day to day use
19:59bawrI don't remember seeing non-CL hate, actually. Guess I didn't skim deep enough. :>
20:07ChongLitechnomancy: hey, vivid-chalk.el has your name on it
20:08ChongLitechnomancy: you're all over the place!
20:08hiredmanls
20:08lazybotdata dev etc home lost+found media proc sbin srv swap sys usr
20:28gfredericksclojurebot: cd data
20:28clojurebotdatatype is see datatypes
20:28amalloygfredericks: ITYM lazybot
20:29callenbotRaynes: I'm not opposed to adding it. More data is more data.
20:49gfredericksamalloy: oh. I did didn't I.
20:50gfredericksI saw hiredman talking to a bot and just assumed it had to be clojurebot.
20:58ppppaulwhat is the accepted way of converting a string to an int/long in clojure?
20:58ppppauli've been using (Long. "234")
21:00hiredmanLong/parseLong
21:00ppppaul&(Long "123")
21:00lazybotjava.lang.RuntimeException: Expecting var, but Long is mapped to class java.lang.Long
21:01ppppaul&(parseLong"123")
21:01lazybotjava.lang.RuntimeException: Unable to resolve symbol: parseLong in this context
21:01ppppaulexample?
21:01clojurebotapi examples is http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examples
21:01brehautlast edited july 2010
21:01brehautgood work clojurebot
21:02xeqi&(Long/parseLong "123")
21:02lazybot⇒ 123
21:02ppppauli want to do a when-let, but with 2 + symbols defined
21:02ppppaulis that possible without nesting?
21:02ppppaulthanks brehaut
21:02brehautppppaul: ?
21:03xumingmingv&(Long. "123")
21:03lazybot⇒ 123
21:03ppppauli find myself doing a lot of (when (and ....
21:03xumingmingv&(do (Long. "123") (System/exit 0))
21:03lazybotjava.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
21:03ppppauli want to do (when-let [a (something) b (something)])
21:03gfredericksppppaul: you can write a macro to do it
21:03ppppauland execute only when both a & b are true
21:04gfredericksppppaul: should the second something be evaluated if a is false?
21:04ppppaulno
21:04ppppaulor yes... don't matter to me actually
21:04ppppauli'm wondering if this is done already (i assume it is)
21:06gfredericks(defmacro when-lets [pairs & body] `(let [~@pairs] (when (and ~@(->> pairs (partition 2) (map first))) ~@body)))
21:06ppppauloh sexy
21:06gfredericksdoesn't work with destructuring
21:06ppppauli'm going to try that
21:06ppppaulwish i could write macros that fast
21:06gfredericksI wish I got paid to write macros that fast
21:07ppppauli get paid to do clojure :)
21:07gfredericksI do too but it's always build stuff never "write macros that fast"
21:07amalloyppppaul: don't be too hard on yourself, his looks a bit rubbish
21:07ppppaullol
21:07gfredericksalso when you write macros like me you have to put up with amalloy coming behind you to point out why it's crap
21:07ppppaulamalloy, will that macro work? i haven't tried
21:07amalloysince it evaluates b even if a is nil
21:07gfredericksamalloy: he specifically said that was okay
21:07gfredericksI asked
21:08xeqiprevious discussion on if-let/multiple bindings: https://groups.google.com/forum/?fromgroups=#!searchin/clojure/let-else/clojure/1g5dEvIvGYY/EWjwFGnS-rYJ
21:08ppppauloh thanks xeqi
21:08amalloythen it looks like it would work, yes
21:08gfredericksamalloy: but also (when-lets [[a b] nil] ...) should behave wrong
21:08amalloythat too
21:09ppppaulabstract macro makes me cry
21:09gfredericksabstract macro?
21:09ppppauli consider it a bit abstract
21:10ppppaulthough, maybe all macros to me would be abstract
21:10gfrederickscome to clojure/west
21:10ppppauli've only written a few for dealing with testing with datomic and ring
21:11gfrederickshttp://clojurewest.org/sessions#fredericks
21:11ppppaul^_^
21:14amalloyanyway, when-lets is actually easier to write without those wrinkles than with them: https://www.refheap.com/paste/9120
21:16gfredericksamalloy: I will be disappointed if you don't come to the talk and heckle
21:16amalloybrace yourself for disappointment then, i'm afraid
21:18ppppaulholy shit xeqi thanks for the google group thread. it was a very interesting read
21:24ppppauli will prace too
21:25ppppaulthat's a pretty sexy macro amalloy
21:32TimMcSpeaking of recursive macros, I wonder if that ->> bug is going to get fixed for 1.5.
21:33amalloyTimMc: did the patch not get applied? i thought it was going to
21:34TimMcamalloy: I don't know, you tell me: http://dev.clojure.org/jira/browse/CLJ-1121
21:35amalloywait, what the hell is the format of the "Created" field in jira? i tried to sort by it
21:35amalloybut the entries include "12/Jul/20" and "17/Jul/20"
21:35amalloythat first one could be july 20th 2012, but the second????
21:36TimMcamalloy: It uses the Mayan calendar, actually.
21:36tomojsome of the dates are in fact in 2020
21:36tomojboth of those, presumably
21:37amalloyso time travel is the only explanation
21:37amalloyTimMc: yeah, looks like it wasn't. i thought http://dev.clojure.org/jira/browse/CLJ-1086 had been, since it was simpler and earlier
21:37brehautits most significant digit year format
21:38tomojthat's why the chart is all fucked up at http://dev.clojure.org/jira/browse/CLJS
21:38brehautwho needs to know more than a millennium and century anyway
21:38amalloyhahaha
21:39amalloynice chart
21:40TimMcbrehaut: That's distressingly believable.
21:40tomojI never thought to post about it because I assumed people had noticed the chart and didn't care enough
21:40brehautTimMc: it wouldnt be the most messed up date formating ive seen
21:40TimMcI don't think you can even get that from a standard formatter.
21:41gfredericksyay for CLJ-1153
21:41brehautTimMc: people do like to work at making dates hard
21:43amalloyguys the comments in http://dev.clojure.org/jira/browse/CLJS-4 are especially good
21:45amalloyjust chouser, stopping by from nine years in the future to let us know that, as expected, it's Later
21:45brehautha
21:46tomoj"ordinary macros can act as compiler macros in cljs. Just define a macro with the same name as the function" huh?
21:46brehautits remarkable that it was created on 17/jun/20 but fixed on 23/sep/11
21:46tomojoh
21:46TimMcOh, is this a result of the importer?
21:46tomojdoes it break if the ns with the fn and the ns with the macro have the same name?
21:47gfrederickstomoj: probably not
21:47tomojbrehaut: sql constraints in action?
21:47amalloytomoj: (defmacro + [x y] `(fast-javascript-addition ~x ~y)) (defn + [x y] (slow-whatever x y))
21:47TimMcIt's not just formatting: "Wednesday, June 24, 2020"
21:47tomojs/in action/inaction/
21:47gfrederickstomoj: the interesting part is that (foo 1) uses the macro and (map foo []) uses the function
21:47tomojamalloy: right, in separate ns's
21:47amalloythen if you write (+ x y) you get the fast version, but if you write (map + xs ys) you get the function
21:47gfrederickstomoj: based on whether or not it is at the front of the form
21:48TimMcThis is like inlining.
21:48amalloytomoj: the macro must necessarily be in a different ns, because cljs doesn't have macros?
21:48amalloyso that's not really a relevant constraint
21:48ajnI'm wondering if I can do a comparison inside a doseq to populate a vector? This is what I have. https://gist.github.com/4679523
21:48gfredericksamalloy: you could have a clj ns with the same name though, right?
21:48tomojbut, what if they have the same name? :)
21:48amalloydon't populate a vector from a doseq. doseq is for side effects
21:48gfredericks(ns foo.bar (:require-macros [foo.bar :as fb]))
21:48ajnamalloy doall instead?
21:49amalloyno, just for
21:49ajnhow do i populate to a vector inside the for?
21:49ajncons?
21:49clojurebotunlink: and constantly is just a function that takes any arguments and returns whatever argument is given
21:49amalloyor whatever other sequence-producing function
21:49amalloyyou seem to be looking for ##(doc filter)
21:49lazybot⇒ "([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects."
21:50ajni tried the filter approach but was having issues appending to the vector
21:51amalloydon't try to do it inside the filter. it's just (map some-functon (filter #(= whatever %)))
21:52ajncould i inline the function (map (fn [x] (filter #(= whatever %)))) ?
21:53amalloy*shrug* sure
21:53amalloythat does something different, but if it's what you want nobody is stopping you
21:54ajni guess i might be missing the purpose of the function
21:59TimMc&(let [[a b] false] a nil)
21:59lazybotjava.lang.UnsupportedOperationException: nth not supported on this type: Boolean
21:59ajnamalloy something like (def config-values (map (filter #(= (:value %) config-name)) (doall results)))
22:08zapppsHi all, can someone clarify the clojure repository situation ?
22:08zapppsclojars vs. maven? where should stuff be published??
22:08lazybotzappps: Definitely not.
22:10xumingmingvhaha, lazybot sometimes is very hilarious
22:11amalloyyeah, -1 for heuristics this time
22:12xumingmingvzappps: Seems most clojure open source jars are published at clojars
22:12xeqizappps: clojure libraries usually end up in clojars because its easier then central
22:13TimMcIs this a reasonable multi-clause if-let? https://www.refheap.com/paste/9122
22:13xeqithough if something would be of interest to the wider jvm community putting it in central would be better
22:13TimMcI delayed evaluation of the else-expr by wrapping it up as a thunk.
22:14amalloywell, you could delay evaluation of it by just expanding it in-place N times
22:14amalloyby making it a thunk, you made sure it doesn't have access to intermediate bindings
22:15TimMcI wouldn't want it to anyhow.
22:15amalloysure, i wasn't saying that was an error
22:15TimMcIn fact, I'm pretty sure that wouldn't be useful anyhow.
22:15amalloyjust that your claim about why you made it a thunk is nonsense
22:15TimMcHmm, right -- clojure.core/if is going to do that anyway.
22:16TimMcIs there anything to be said for output code size, or debugging friendliness?
22:16TimMcThat is, I see benefits to using a thunk, but no downsides.
22:16amalloywell, calling a function isn't free :P
22:16amalloyit's damn near free, of course
22:16TimMcTrue.
22:19zapppsxeqi: lein finds in either regardless ?
22:19TimMcDammit, if I call it if-let+ or expect the user to use it with a prefix (h/if-let), then the indentation is all wrong.
22:20amalloyTimMc: tell your users to get used to M-x customize-variable RET clojure-defun-indents RET
22:20zapppsalso does clojar timeout/slows down for everyone or just for me ?
22:21xeqizappps: correct, clojars and central are the default repos for lein
22:21TimMcamalloy: :-(
22:22TimMcwith-just-kidding-its-actually-if-let
22:22amalloywith-iflets
22:22amalloybrilliant
22:23amalloywith-sincere-apologies-iflet
22:25frozenlockOh nice, relative links in readmes at github.
22:26gfredericksthe maybe macro
22:27TimMcthe macro monad
22:27gfredericksthe burrito macro
22:28gfredericksany portmanteau of "macro" and "monad" just sounds stupid
22:28gfredericksexcept for "monacro"
22:28DigitalJackMacNads
22:28gfredericksbrb I need to go start a band
22:29warzso would you say clojure is capable of being used for the same kind of programming that maybe like C# or any other language could be used for? this is kind a crappy question, but i dont know how else to phrase it.
22:29warzlike is clojure sort of domain specific
22:29TimMcIt's certainly not domain specific.
22:30warzand i dont really mean any other language, thats not fair
22:30TimMcThere are certain domains where I *wouldn't* use Clojure, but it is a general purpose language.
22:30warzi mean like your typical languages
22:30warzok
22:30TimMcFor instance, I'd be hard-pressed to write a kernel in Clojure. :-)
22:30warzya :p
22:31TimMc(That's what Rust is for.)
22:31TimMcI'd probably prefer OCaml (or perhaps Racket?) for heavy-duty numerics, but I haven't really investigated.
22:31TimMcFor scripting... Python.
22:32gfredericksTimMc: by the end of this you will have convinced me that no specific domain is good for clojure
22:32warzmy brain always explodes when i try to define "scripting"
22:32warzwhen i think of scripting i think of like, mirc scripting, php
22:32TimMcwarz: I mean little shell scripts.
22:33warzthings that cant really exist outside of their domain
22:33ttimvisheris there any meta information attached to namespaces by which i could look up the file they were declared in?
22:33ttimvisheri'm trying to enhance nrepl to support `M-.`ing into namespaces.
22:34TimMcwarz: "PHP scripting" is a bit of a misnomer, since web server code doesn't have to be implemented as an interpreted language.
22:34TimMcBy script I mean small, fast-start, short-run, no-compile programs.
22:34warzi just think of php as really suited for web scripting
22:34Sgeo"no compile"?
22:34TimMc"web scripting" isn't a thing
22:35TimMcSgeo: sshhhh
22:35SgeoWhy does that matter to the usability of a language for a purpose
22:35SgeoExcept needing to transport interpreter around I guess
22:35SgeoAnd self-hosting
22:35TimMcno-AOT-compile, I guess
22:35TimMcI want to edit and go.
22:35SgeoSBCL is compiled but can feel scripting-ish
22:35Sgeo(Common Lisp)
22:38ttimvisheris an inspector on the roadmap for nrepl?
22:39amalloygfredericks: isn't that true, though? lisp is a terrible language for any problem, but a great language for *building* the perfect language for any problem
22:39warzim just pretty excited to be learning clojure for some reason. i like picking up new languages and i picked up ruby, python and js/node really fast. i used each for about a year or so, on each.
22:39warzbut with clojure my mind is like
22:39gfredericksamalloy: I'm not wise enough to argue with that
22:40warzreally stretching haha
22:40TimMcThat's a good thing.
22:40warzso its exciting to me
22:41warzi just find that i do a lot more staring deep into the pixels of my screen while i think about what im writing, haha.
22:41gfredericksthink more type less
22:54zapppsI get errors like: WARNING: get already refers to: #'clojure.core/get
22:54zapppsis get a reserved word? Anyway I can get around this ??
22:54lazybotzappps: What are you, crazy? Of course not!
22:54zapppsgreat
22:55headshotuse the namespace of your get impl
22:55Sgeorefer-clojure
22:56Sgeohttp://clojuredocs.org/clojure_core/clojure.core/refer-clojure
22:56zapppsheadshot: can you show me an example ?
22:56headshotnifty
22:56zapppsSgeo: thanks
22:56Sgeozaphar_ps, yw
23:08warzibdknox, on light table, if you make a new file and accidentally use the same name as existing file, it doesnt have any prompt or anything. would be easy to save over it.
23:18RaynesI like that feature. Sick of prompts.
23:18RaynesI want my editor to laugh at me when I overwrite an important file.
23:18desertmonadDoes anyone know license info for the clojure logo? (yin-yang lambda thing)
23:19Raynesdesertmonad: IIRC, it's under the ask-Rich-for-permission-first license.
23:20desertmonadcouldn't hurt :)
23:20RaynesThere is this https://groups.google.com/forum/?fromgroups=#!topic/clojure/fxecefDQuz4
23:20RaynesBut Rich nor Tom ever actually decide on what it is licensed under.
23:22TimMcIn the case of logos, trademark may be the more important question.
23:23RaynesI use the logo on http://tryclj.com/ and have for years. I never asked permission, and Rich hasn't subpoenaed yet.
23:23desertmonadI was just thinking about using it on a blog, which likely would talk about clojure at least some. But I wouldn't want to dilute anything. Maybe I'll just futz around with a lambda for a while and see what happens.
23:24RaynesI *may* have asked for permission and never received a response. Not sure.
23:24TimMcRaynes: s/bpoena//
23:24ivansubpoena: we demand to know... if you are really using that logo
23:24RaynesI was also like 15 at the time and not smart enough to worry about legalities.
23:25RaynesI know what that word means, fwiw.
23:25RaynesI guess sarcasm doesn't work well on the internet.
23:25desertmonadnow you are getting recursive
23:32ominen1Why not tell me what you want? I can help. All I have is time