#clojure logs

2013-06-19

00:00puredangeroops :)
00:06murtaza52thanks, that worked
00:17futileSo...
00:17futileuhh
00:24murtaza52I have an io operation that I want to perform an another thread. No state sync/sharing is needed. Also I dont need any return value. The operation is a blocking op which will continue indefinitely. What clojure concurrency construct should I use ?
00:24murtaza52correction - perform in another thread.
00:26callenmurtaza52: future? start a new process?
00:26futileso, uhh..
00:27futileive been writing some blogs :(
00:27futilelike this one: https://gist.github.com/evanescence/5811570
00:27murtaza52start a new process. The process is actually just waiting for file system events, and then performing some operation.
00:28futileall cuz of callen
00:31futileanyone know of a better blog-hosting service than gist?
00:31callenfutile: don't put that shit on me. If I had my choice, you'd stop using this channel as a venue to talk about yourself.
00:31futilecallen: you were all like "blogging is a good thing bla bla bla"
00:32callenI was far from the only one
00:32futileyou.. were the only one who.. who believed in me...
00:32futile:')
00:33callenI don't believe in you at all
00:33futilecallen: what? you dont think i exist!?
00:35futileok fine
00:38tomjackfutile: your blog post suggests to me that somehow I'm going to get the public API right, which is odd given that I'm so prone to getting the solution wrong
00:38alexbaranosky1anyone know how to access the length of an array in Clojure?
00:38futiletomjack: no but thats a separate problem entirely
00:38alexbaranosky1arrays have a .length property… but not sure how to access it
00:38brehaut,(.length (int-array 1 2 3))
00:38clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core$int-array>
00:39brehautfail
00:39tomjackalength
00:39futiletomjack: i tried to say that, if you make it generic enough, itll be good enough for the time being. at least, a lot longer than the raw solution itself would be
00:39alexbaranosky1thanks tomjac
00:39mabesdoes nrepl.el or perhaps, more generally, nrepl itself have an option to truncate large data structures? right now I'm working with a large map that kills my repl if I accidentally evaluate it
00:40futilemabes: C-c C-c to stop evaluating it, and then i just (pprint) it
00:41mabeshmm.. pprint is printing the entire thing too (I toggled pprint with nrepl)
00:42futileoh
00:42futilenm
00:42tomjack(set! *print-length* 10) (set! *print-level* 3) or whatever
00:43mabestomjack: great, thanks!
00:43tomjackhttps://www.refheap.com/c0e9a0bac5e7e996fd361cc43
00:44tomjack(for yasnippet..)
00:48futileanother new blog post: https://gist.github.com/evanescence/5811714
00:49futilethis is fun
01:19murtaza52I have a fn which I am calling in a (future f). The fn is a blocking one, ie it listens for events and executes an action on the event. So it never actually returns back, thus the thread never terminates.
01:20murtaza52How do I terminate it explicitly, when my program doesnt want it any longer ?
01:24murtaza52futile: liked your post
01:25bbloommurtaza52: don't use a future. use more traditional java concurrency primitives
01:26bbloommurtaza52: clojure doesn't try to provide a complete concurrency story. java already has a good concurrency story, which clojure simply enhances and extends w/ a focus on immutability
01:26bbloomcreating a thread or using an executor pool or anything like that is A-OK :-)
01:27murtaza52thanks bbloom: let me look up on java threads.
01:28dnolen_core.match 0.2.0 beta3 goin out
01:28bbloommurtaza52: you can also consider a clojure agent
01:29bbloomdnolen_: while i'm sharing papers with you. you might also like this one: http://okmij.org/ftp/papers/DDBinding.pdf
01:29bbloomdnolen_: discusses the interaction between dynamic binding and delimited continuations
01:29dnolen_bbloom: yeah I have that as well
01:29bbloomcool
01:30dnolen_bbloom: one day, I need to upgrade my foo before I understand all that
01:30dnolen_bbloom: supposed delimited continuations give you everything that monads do
01:30dnolen_supposedly
01:30bbloomand a whole bunch of other cool stuff too
01:31tomjackeverything? :(
01:32bbloomtomjack: presumably AND MORE :-P
01:33bbloomtomjack: http://okmij.org/ftp/ is the place to start for delimited continuations & lots of other cool stuff
01:33tomjackyeah I've delved some
01:33tomjackis the DDBinding the one with the 'more than monads' claims?
01:34bbloomtomjack: no
01:34dnolen_tomjack: see Representing Monads by Filinski
01:34dnolen_http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.43.8213
01:34bbloomdnolen_: you beat me by 5 seconds :-)
01:35tomjackmy ":(" is just that, presumably, we're talking about operational semantics when we say "everything that monads do"?
01:35tomjackthat that paper is in ML makes me wonder if that's not right though
01:36bbloomwhat? ML can't have monads? :-P
01:36brehautit makes sense intuitively as monads are often used for building different computation mechanisms, and continuations were used in scheme to model all the computation there
01:36dnolen_tomjack: that makes no sense
01:37tomjackto be clear, the "that" that I wonder about is my claim that we're just talking about operational semantics
01:38tomjacki.e. the fact that the paper is in ML seems promising
01:38dnolen_tomjack: vs what?
01:42tomjackI took the claim to mean something like "delimc is operationally as powerful as algo.monads", which would ignore the utility of monads with a typechecker. but presumably the stuff in the "representing monads" paper is typechecked... reading now
01:44bbloomto be clear, the delimc library isn't quite a complete implementation of delimited continuations. for one, the macros only operate lexically
01:45dnolen_I don't even know what means, it's not like you can verify monad laws in Haskell. You're just checking type classes.
01:45tomjacksure, substitute for hypothetical implementations in a hypothetical dynamic language :)
01:52bbloomin any case, i still think monads, while somewhat interesting, are basically goblty gook that will be a footnote on the future history of computer science :-)
01:52bbloomhttp://blog.sigfpe.com/2008/12/mother-of-all-monads.html
01:56tomjackhmm http://blog.melding-monads.com/2009/12/20/are-continuations-really-the-mother-of-all-monads/
02:01tomjackI suspect this is relevant http://www.cs.ox.ac.uk/ralf.hinze/Kan.pdf
02:01tomjackbut I haven't managed to understand it yet :(
02:08dnolen_tomjack: interesting paper, good even for the citations
02:11tomjackbtw, the B on page 2 is Logic
02:12tomjack(I guess that is roughly clear from the explanatory text around it, but it is exactly Logic = LogicT Identity)
02:14tomjack"every monad is isomorphic to a codensity monad" - so, yes, it is the mother?
02:40tomjackdnolen_: trying to generalize enforceable constraints https://www.refheap.com/ce433aed08b777aa628c4f039
02:40tomjack(def enforce-constraint-fns (atom {}))
02:40tomjackthis makes me unhappy
02:40tomjackbut seems like what ckanren does :(
02:46tomjack(alter-var-root #'enforce-constraints composeg ...) :(
03:02borkdudehttps://www.refheap.com/15904
03:06ddellacostawoah, haven't looked at python in a while
03:09borkdudeI made a typo, the else if not indented correctly, which gives a surprising result
03:09borkdudeddellacosta there's a better way to do this in python, but I was just making an example for some sheet
03:09ddellacostaah. I'm totally out of practice with Python...
03:11tomjackfrequencies([{}]) :(
03:11murtaza52how do I terminate a thread. I can start it by (.start (Thread. my-fn)). I have a blocking thread which will continue indefinetely and will not return
03:11murtaza52Thus how do I terminate it explicitly from my code ?
04:10samratthis future seems to be swap!-ing an atom's value even after I cancel it: https://www.refheap.com/15905
04:10amalloyfuture-cancel is not a reliable operation, and certainly not a timely one
04:11samratamalloy: what should I do instead then?
04:11clgvsamrat: you can ensure correct behavior by querying an abort criterion in the loop. an atom with a bool would work
04:11amalloyany number of things. you could have the future checking some "stop" atom that you modify, so that it can shut itself down
04:11amalloyyou could do something more sophisticated than a future, like use a java executor and submit tasks to it
04:12amalloyyou could restructure your program so that it doesn't depend on global mutable state being influenced by multiple threads
04:16amalloyyou could write a function like atomic-counter that produces a lazy, infinite sequence of random points and some information about them (eg, are they in a circle), and delegate to seque the inconvenience of managing the thread
04:17samratamalloy: this doesn't seem to work: https://www.refheap.com/15906
04:19clgvsamrat: that due to the loop body is wrapped in an implicit `do` and thus the code after the when is executed. wrap the `when` around the whole body and negate its test
04:20clgvsamrat: https://www.refheap.com/15907
04:21clgvsamrat: you could even skip the `loop` since your function has no parameters you can simply `recur` to the function
04:21samratamalloy: thanks. that works
04:22samratamalloy: I'll also read up on seque
04:22lozhi, i have a problem
04:22amalloypersonally i like the seque approach. modeling your computation as lazy sequences is often a lot nicer in clojure
04:22amalloyand it's something i often don't realize i can do in a particular context
04:22samratclgv: ah, sorry. anyway thanks
04:23lozmy compiled clojurescript doesnt work, browser says "goog is not defined"
04:23lozi found that goog is some how related to google closure
04:23lozbut i cant find what library do i need
04:30Morgawrloz: shouldn't it be included in the output of cljs? I mean, what's your optimization flag? :none :whitespace :simple or :advanced?
04:31borkdudeis there a template which gives me ring, compojure and hiccup, but nothing more?
04:31borkdudeand clojure of course
04:32lozMorgawr: i use simple now, but does what matter?
04:32borkdudeand some convenicne like functions to start the webserver
04:33callenborkdude: I can show you a template that uses all of that, except clabango in the place of hiccup.
04:34borkdudecallen luminus?
04:34callenborkdude: a more developed app that started as luminus
04:34borkdudecallen I mean a leiningen template
04:35borkdudehaha, if I type in Eclipse/CCW in the template field "luminus +hiccup" it crashes
04:36Morgawrloz: no, it shouldn't really. With simple optimization you're running into the google closure compiler but it's not a big deal (problems can surface with either :none or :advanced). I don't know why it's not finding the goog namespace, it's weird. What's your require code?
04:36borkdudehmm, it's pretty serious, eclipse doesn't even start anymore with an error msg about my workspace
04:37callenlol eclipse.
04:37lozMorgawr: should closure library come with clojurescipt? after bootstrap?
04:38lozMorgawr: where are two closure jars, but what about js code for client?
04:39Morgawrloz: I'm not 100% sure but I think it should. I mean, part of the ClojureScript core (cljs.core) use (:require goog.something)
04:39Morgawrwhen you compile your clojurescript project, everything is put inside a single .js file (unless you use :none optimization, then you'll have multiple files) and that file is placed in the output directory you chose in your leiningen project.clj
04:40borkdudecallen yeah, it's pretty funny, although probably it's CCW to blame not to validate this field ;)
04:40Morgawryou just need to include that single .js file into your website as any other normal javascript script file
04:40lozMorgawr: the problem is i dont have leiningen project, i need to compile it by myself
04:41Morgawryou should really use leiningen
04:41borkdudeah, the "compojure-app" template by yogthos|away is exactly what I searched
04:41Morgawrit's the standard way of doing things with Clojure(script), I don't know how to help without Leiningen since I've never done it without
04:41lozMorgawr: i just want to use clojurescript in rails
04:43Morgawreh, I'm not a huge expert with the whole build process, sorry. Hopefully somebody is able to help you more
04:45lozmy submission to clojure-dev was denied..
04:55ddellacostaloz: did you figure out your issues? Clojurescript does indeed include Google Closure libs so it's possible something strange is going on in your code
04:56lozddellacosta: i think i dont understand what happens on cljs compiling
04:57ddellacostahow are you compiling/running/etc. ?
04:57ddellacostausing lein cljsbuild, or no?
04:57Morgawrhe's not using leiningen
04:57lozi wrote cljs file, then i run cljsc to compile it
04:58ddellacostaokay, and does it compile okay?
04:58lozi get output + cljs/core.js
04:58lozyep
04:58ddellacostabut, when you load it up in a browser it breaks?
04:58lozyes, ReferenceError: goog is not defined
04:59ddellacostahmm
04:59lozwhen i try to use closure's calcdeps.py on it, it says Exception: Duplicate provide (goog.string)
04:59lozdo i ever need to do this?
05:00lozddellacosta: i think i must mention that _just_ cljs code works ok, im trying to use dummy now
05:00lozdommy*
05:00ddellacostaoh, okay
05:00vijaykiranloz: http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html
05:00ddellacostacan you put your code in a refheap or gist or something and show me?
05:00lozsure, wich one?)
05:00vijaykiranloz: see Using external libraries
05:01lozvijaykiran: thx, ill take a look at it
05:02ddellacostavijaykiran: I'm not sure that applies to dommy, which is a CLJS lib
05:02lozvijaykiran: dommy is clojurescript lib
05:02ddellacosta(but, nice link, super useful…bookmarking)
05:02ddellacostaloz: I'm not sure how you would generate this without lein, I've just never done it
05:02vijaykiranAh, true
05:03vijaykiranloz: in that case - I'd suggest using a "project" :)
05:03vijaykiranit will also help us reproduce your problem easily
05:03lozddellacosta: my js code is simple - https://www.refheap.com/15909
05:04lozit compiles with dommy in classpath
05:04lozbut results contain these "goog" objects
05:05ddellacostawell, goog is included by default--it's part of CLJS
05:05MorgawrYou're using dommy macros, how do they expand? Because in ClojureScript macros are a bit delicate, you need to (:require ) all the libs/namespaces required by the macros (I think)
05:06lozddellacosta: but what should i do after - where is goog are defined?
05:06ddellacostagoog is defined in the compiled code
05:06ddellacostait is part of the namespace that is defined by default, as Clojurescript includes the goog namespace as a dependency
05:07ddellacostaso something is broken
05:07lozlike
05:07lozgoog.global = this;
05:07lozgoog.DEBUG = true;
05:07lozgoog.LOCALE = "en";
05:07lozgoog.provide = function(name) ?
05:07lozfirst lines of my compiled file
05:07ddellacostaI'm not sure how external *clojurescript* dependencies are included as part of the build process outside of using leiningen's cljsbuild plugin, so I'm not sure I can help you too much
05:07hotwoofyanyone know if you can have a subselect inside a where clause in clojureql? for example, to calculate an aggregate in the subselect, and then use that to filter rows in another query, without executing two different queries.
05:08ddellacostayes, exactly
05:08lozhm so why do i get undefined in browser..
05:10lozddellacosta: does order of scripts including matter?
05:10ddellacostaloz: most definitely--you'll need to include the compiled clojurescript file first
05:11ddellacostahmm, I suppose that if you build with cljsc and get no errors re: dommy, it should be fine
05:11ddellacostatrying proof of concept now myself
05:12lozsome progress at least! ReferenceError: dommy is not defined
05:13lozddellacosta: does cljsc include library code into resulting js?
05:13lozi just supposed things going so
05:13ddellacostathis is what I'm trying to determine--as I said, I don't know how it behaves with external CLJS libs
05:14ddellacostathe link that vijaykiran sent explains how to include 3rd-party JS libs however
05:18ddellacostawow, I can't even get bootstrap to work...haha
05:21ddellacostaloz: sorry, I'm having really, really strange issues getting cljs even set up
05:21ddellacostaI use it entirely via lein cljsbuild these days however, so I never run into the issues you talk about
05:22lozyou just need to run bootstrap and tweak script for classpaths :D
05:22ddellacostaloz: naw, it's something very strange--curl isn't...running.
05:22ddellacostareally not sure what is up
05:22lozclasspaths are hardcoded, so you cant add your own, i think lein uses pure java command to compile
05:23ddellacostabut anyways, if you can run the cljs file without dommy, but then when you compile it in it is broken, then it seems like something may be not getting included
05:23ddellacostaa simple thing to check is just to open up the compiled js file and do a grep for dommy
05:23ddellacostathat will answer your question if that is getting compiled in or not by default
05:23ddellacostaI suspect it is, actually, if you don't get complaints during compilation
05:23ddellacostaotherwise it would throw a lot of warnings/errors
05:24lozi did grep, found only my calls to dommy
05:24lozso looks like i need to compile it too
05:24ddellacostahmm
05:24ddellacostaokay
05:25ddellacostawell, it should all get compiled down to one file
05:26ddellacostathere is nothing here that specifies how to compile 3rd-party cljs libs in
05:26ddellacostahttps://github.com/clojure/clojurescript/wiki/Quick-Start
05:29lozddellacosta: should? i just add dommy to classpath, maybe i should add it to compile files?
05:29ddellacostawhat do you mean, add to compile files?
05:30lozfrom cljsc:
05:30loz# Compile a single cljs file or a directory of cljs files into a single JavaScript file.
05:30lozi must check it
05:30ddellacostaI mean, you can try compiling dommy that way
05:30ddellacostaI don't know what dependencies *it* has though
05:31ddellacostaI mean, this is an interesting experiment, but this is not the way that most people are compiling clojurescript
05:31ddellacostaso if you want to learn about how cljs compilation works, then you'll learn a lot this way I suppose, if you're willing to dig into it
05:32ddellacostabut if you just want this to *work*, then I would highly recommend setting up lein and a project
05:32ddellacostait will make it much smoother
05:32lozi will end up with a gem for rails wich will do everything, so ppl will be able to write cljs in rails
05:35ddellacostaloz: good luck then. :-) All I can suggest then is to see how cljsbuild does it. https://github.com/emezeske/lein-cljsbuild/blob/master/plugin/src/leiningen/cljsbuild.clj#L38
05:49lozddellacosta: how do you think, is this a bug? dommy/macros is _clj_ file, instead of cljs..
05:49lozhttps://github.com/Prismatic/dommy/tree/master/src/dommy
05:52jonasenloz: clojurescript macros are written in clojure, not clojurescript
05:52lozokey then
05:53lozhow should i include paths with spaces into classpath? can i use " or ' ?
05:53lozor should i?
06:55Josh_how do i create a directory with clojure.java.io api ?
06:56ZamarokIs clojure.math.numeric-tower the library everyone uses? Or is there an "official" one?
07:02clgvZamarok: those github libs in the "clojure" group are the official ones
07:09lozwtf, compiled dommy requires goog wich is in my compiled js wich requires dommy
08:37Zamarokclgv: thanks
08:37ZamarokOne more question: can a namespace include a number? Like 'my.namespace.12' for instance.
08:38Zamarokcause that would really help me organize things
08:41Zamarokahh it can, answered my own question.. nevermind
08:51TimMcZamarok: It probably will not be usable from Java.
08:59clgvZamarok: numbers are fine - the dot is a problem.
09:19xpeZamarok: I use the Apache Commons math libraries quite a bit
10:23TimMcclgv: What?
10:23clgvTimMc: ?
10:23TimMcHow are dots problems?
10:23clgvin classnames
10:24clgvthey are already separators in packages
10:24TimMcBut Zamarok was asking about namespaces, not classnames.
10:25clgvah he wants one to start with a number. that could be problematic...
10:25clgvnamespaces are classes
10:25TimMcish
10:25TimMcThe last segment in a namespace becomes... 1, maybe 2 classes.
10:26clgvyeah actually more than one class ;)
10:26TimMcfoo.bar.baz gets you something like baz.class and baz__init.class
10:26futileso, um
10:26futileif you start writing a blog, how/where do you tell people about it?
10:27futilei.e. https://gist.github.com/evanescence
10:29clgva blog in gist form?
10:30hyPiRionfutile: the easiest is probably github pages
10:30hyPiRionI tend to use it for documentation, but if you don't use gh-pages for that, then you get http://username.github.io which is relatively easy to remmeber
10:31TimMcfutile: Write search-bait.
10:31futileTimMc: nobody will find my stuff via google
10:31futilehyPiRion: the problem is how/where to tell people about it, not how they're gonna get to it
10:31hyPiRionah
10:31futileclgv: gist is awesome for writing blogs
10:31hyPiRionWas a bit quick there
10:31TimMcfutile: Nonsense. Have you ever had a blog before?
10:32futileclgv: it has all the features i need: markdown formatting, pagination, shows snippets on the index page, etc
10:32futileTimMc: lots, nobody found them via google.
10:32TimMc:-(
10:32hyPiRionIf you spends some time with Jekyll, you can get some pretty lush formatting and some google analytics in as well (if you're keen on that)
10:33mikerodMaybe this is a dumb question: If you start an nRepl server with clojure.tools.nrepl.server/start-server, is it important that you call clojure.tools.nrepl.server/stop-server before terminating the process that the was running the server?
10:33clgvZamarok: namespaces starting with a numbers might cause problems. class names must not start with numbers in java. if the jvm enforces that and not only the compiler you have more than an interop problem. ;)
10:33hyPiRion(That's what gh-pages uses to render data)
10:33futilehyPiRion: yeah, although thats not as fast/easy as gist
10:33futile(inc gist)
10:33lazybot⇒ 1
10:33hyPiRiontrue
10:33TimMc(inc refheap)
10:33lazybot⇒ 1
10:34TimMcFIGHT
10:34hyPiRionoh yeah, refheap has markdown too these days
10:34hyPiRionwell, it'd be hard to connect it into a blog of some sort
10:34futileright, gist has gist-preview, pagination, etc
10:35futileWill (inc hyPiRion) work mid-sentence?
10:35futileguess not
10:36hyPiRionWell, speaking of getting users
10:37clgv$karma futile
10:37lazybotfutile has karma 2.
10:37clgv$karma gist
10:37lazybotgist has karma 1.
10:37hyPiRionHacker News is a good source if you're a masochist.
10:37futile$help
10:37lazybotYou're going to need to tell me what you want help with.
10:37hyPiRion$help karma
10:37lazybothyPiRion: Checks the karma of the person you specify.
10:37futileanyone wanna post my blog to hackernews?
10:38futilei cant, im banned from it
10:38futile(dont ask)
10:38hyPiRionoh, I was just about to
10:38hyPiRionbut okay :)
10:38clgvhaha, ooops.
10:38llasramxpe: Re: you mentioning Apache Comomns Math, have you used the commons-math optimization algos from Clojure?
10:38futile:)
10:38futileany of you have experience writing lazybot plugins?
10:39llasramxpe: I was trying to figure them out, but it looks like they're in their third? round of back-to-back redesigns, and I couldn't figure out which interfaces were actually deprecated
10:39hyPiRionI am certainly sure Raynes has experience with that.
10:39hyPiRionIt's not that difficult though, futile. Have a look at the source code and you can get a rough indication on how to do it
10:39futileI've been looking through existing plugins,
10:40futilebut I can't tell if it has the ability to find text within text, like (inc hyPiRion) as a substring instead of the whole string
10:40futileOh, looks like it does. Yay.
10:40clgvyou can do ##(inc 1)
10:40lazybot⇒ 2
10:41hyPiRionhave a look at how it handles double and triple question marks. like this???
10:41lazybothyPiRion: Yes, 100% for sure.
10:41clgvshould he look for such jokes??
10:41lazybotclgv: Definitely not.
10:42futilehyPiRion: oh thanks!
10:42hyPiRionnp
10:42clgvI think that wont work ##(inc hyPiRion)
10:42lazybotjava.lang.RuntimeException: Unable to resolve symbol: hyPiRion in this context
10:44futilesweet, yesno.clj helps
10:50futileIs there a better way to do ##(first (shuffle [1 2 3]))
10:50lazybot⇒ 2
10:51futile,(first (shuffle [1 2 3]))
10:51clojurebot3
10:51futile,(-> [1 2 3] shuffle first)
10:51clojurebot1
10:51futilemeh
10:52hyPiRionfutile: rand-nth
10:52hyPiRion,(rand-nth [1 2 3])
10:52clojurebot1
10:52hyPiRion,(rand-nth [1 2 3])
10:52clojurebot1
10:52hyPiRion,(rand-nth [1 2 3])
10:52clojurebot3
10:53futile,(for [_ (range 0 10)] (rand-nth [1 2 3]))
10:53clojurebot(2 2 3 1 1 ...)
10:53futileah
10:53hyPiRion,(repeatedly 10 #(rand-nth [1 2 3]))
10:53clojurebot(1 1 3 1 3 ...)
10:54futileyou're good at this
10:55hyPiRionhttp://clojure.org/cheatsheet is good to have
10:56dnolen_shakes his fist an Lein JVM opts
10:56dnolen_core.match is now looking as fast as I remember
10:57Morgawrmmm.. clojurescript question. I have a library that uses a .js file (for "low level" functions) that I have marked with :externs in my project.clj. I install this library with "lein install" and then I use it in another project, however the compiled result can't see the .js file (I assume it's not getting inside the .jar). How can I make it work?
10:58dnolen_ridiculously fast
10:58futiledone.
10:58futilehyPiRion: ive been using that for about 9 months now :P
10:59futileis flatland in here? i hope i can get this lazybot plugin merged soon
10:59hyPiRion~flatland
10:59clojurebotPardon?
11:00vijaykiran~seen vijaykiran
11:00clojurebotvijaykiran was last seen in #clojure, 0 minutes ago saying: ~seen vijaykiran
11:00vijaykiran~seen flatland
11:00clojurebotNo entiendo
11:00hyPiRionfutile: https://github.com/flatland?tab=members
11:00futileoh
11:01futilefirst things first, gotta figure out how pull requests work in the New Github
11:01XPheriorIs there any way to refer to 'this' when using proxy?
11:03clgvXPherior: just use 'this'
11:04XPheriorclgv: Huh, I'm not sure why I didn't expect that to work. Thanks man.
11:04futilehey amalloy_ can you merge https://github.com/flatland/lazybot/pull/88 ?
11:04clgvXPherior: because it is implicitely defined (unhiegenic macro) which is usually discouraged in clojure
11:04Morgawrso, nobody knows how to package a .js file with a clojurescript .jar so it can be used as part of the clojurescript library? :(
11:05XPheriorThat's also called an anaphoric macro, right, clgv?
11:05hyPiRionXPherior: yes, that's right
11:05XPheriorLearning things today. :)
11:06futilei hope clojure will merge my lava pull request one day
11:07clgvfutile: lava?
11:07futileclgv: https://github.com/clojure/clojure/pull/6
11:08futileall the tests still passed
11:08clgvfutile: that wont be merged at all. you have to make a Jira ticket with a patch. to be accepted you need to have signed the CA
11:08futileclgv: oh! that's why they didn't merge my pull request!
11:09hyPiRionyeah, totally why
11:09clgvah just reading it right now....
11:10clgvwell, some people that really wanted to contribute made that wrong assumption about contributing to clojure via pull request - so I thought I should let you know...
11:13ToBeReplacedif i have a file (ns temp (:gen-class)) (defn -main [] (println *ns*) and I uberjar it and run, *ns* is printed as clojure.core ... how can i get #<Namespace temp>?
11:14Morgawrdnolen_: when I create a .jar for a clojurescript library (with lein install), does it package the .js files I add with :libs too? Because I have :libs ["pathto/myfile.js"] but when I require the correct namespace (I used goog.provide() in the JS file) from the project that uses that library, it says it can't find it
11:14ToBeReplacedi think i'm asking; how can i get the name of the class that we are calling the -main of?
11:14clgvToBeReplaced: (the-ns 'temp) should work
11:14hyPiRionToBeReplaced: Humm, try out (def my-ns *ns*) and (println my-ns) instead. *ns* is a dynamic var, so it's changing at runtime
11:15Morgawrlike, I have ProjectA is a library using fileB.js and I install ProjectA as .jar to be used by ProjectC but ProjectC can't see fileB.js (or its namespace)
11:18ToBeReplacedhyPiRion: yes that works; any thought if i need only the name ("temp") instead of the namespace? I have a function that would be useful for individual apps as their main, but it needs to be able to get or recover the name of the application if none is passed in
11:20ToBeReplacedex. (defn -main (template-main)).. template-main may need a name for reporting, ex. (-> *ns* ns-name name), but that won't work for the obv reasons
11:21hyPiRionToBeReplaced: I'm not sure if there's any way except (def my-ns-name (-> *ns* ns-name name)). I haven't been using namespaces in creative ways really, I just know the basics of how they work.
11:22ToBeReplacedhyPiRion: cheers, thanks
11:22hyPiRionAs in, I'm 100% sure there are solutions, but I don't know which one is the most idiomatic/best.
11:22hyPiRionnp
11:24llasramToBeReplaced, hyPiRion: if you dig into the implementation of tools.logging, it preserves the namespace for each logging invocation so that it can emit it in log messaages
11:24llasram(spoiler alert: the solution is macros)
11:25clgvyeah you capture the namespace at macroexpansion time as well
11:25clgv+can
11:37MorgawrI feel like I am missing a step here, I can't figure out how to ship a .js file included to a clojurescript .jar
11:42clgvMorgawr: might the treatment of js-files by leiningen be similar to the one of native dependencies?
11:43dnolen_Morgawr: dunno, never package CLJS with lein
11:43dnolen_Morgawr: I rarely know the answer to such questions since I mostly hack on the compiler
11:43Raynesfutile: wat
11:43RaynesIt's too early for pings.
11:44MorgawrI see
11:44Morgawrit's just that it seems that the .js file is forgotten when adding everything inside a .jar
11:45Raynesfutile: lol
11:45Raynesfutile: This would be far too annoying to actually use, but lol, nice work.
11:46dnolen_Morgawr: if no one answers here ask on the ClojureScript google group, tons of people there who probably know the answer better than I.
11:46Morgawrdnolen_: alright, thanks. I'll keep looking and testing
11:48RaynesThere are things dnolen_ does not know?
11:48RaynesMy whole life has to be restructured now. :(
11:49futileRaynes: what if i made it have to have a prefix of the word "good"?
11:49futileRaynes: ie "good morning" would trigger it but "yesterday morning we..." wouldnt
11:50RaynesMaaaaaaaaaybe.
11:50RaynesI'll see what amalloy_ thinks when he gets into work. He's usually likes this kind of stuff.
11:51RaynesJesus, I'm shaking like scared puppy.
11:51RaynesFreezing to death and I'm not even that cold.
11:51RaynesI hate mornings.
11:51futile,(for [msg ["good morning" "yesterday morning we fixed a bug" "good evening everyone" "the evening is boring"]] (re-find #"(?i)\bgood\b (morning|afternoon|evening|night|day)\b" msg))
11:51clojurebot(["good morning" "morning"] nil ["good evening" "evening"] nil)
11:53hyPiRionRaynes: Oh hey, with Instaparse we could probably make lazybot even more sentient
11:53RaynesHave at it. I want him to make me breakfast.
11:53futileRaynes, amalloy_: updated the pull request to require "good " before the thing
11:54RaynesI really need a space heater.
11:54hyPiRionRaynes: man, it sounds like you're living in Norway
11:54RaynesOr to never get up at 8AM ever again.
11:54Raynes$conditions 90025
11:54lazybotLast Updated on June 19, 8:49 AM PDT; Scattered Clouds; Dewpoint: 59 F (15 C); Precipitation today: 0.00 in (0 mm); Temperature: 65.4 F (18.6 C); Windchill: NA; Wind speed: 5.0mph; Wind gust: 0mph; URL: http://www.wunderground.com/US/CA/West_Los_Angeles.html.
11:54futile$conditions 60098
11:54lazybotLast Updated on June 19, 10:43 AM CDT; Clear; Dewpoint: 54 F (12 C); Precipitation today: 0.00 in (0 mm); Temperature: 70.9 F (21.6 C); Windchill: NA; Wind speed: 2.0mph; Wind gust: 10.0mph; URL: http://www.wunderground.com/US/IL/Woodstock.html.
11:55RaynesYeah, it isn't even cold. It's just that when I wake up early I always freeze to death. No clue why. I don't think it has ever mattered what the temperature is.
11:55futileRaynes: you might be dead?
11:55RaynesIt's a distinct possibility.
11:55futilesixth-sense style
11:55hyPiRionfutile: that wouldn't explain the shaking though
11:56futilehyPiRion: yeah it would, dont ghosts shiver and quiver and stuff?
11:56RaynesAlso this passing through walls stuff that has been getting on my nerves lately.
11:56hyPiRionI hate when that happens.
11:56futilelol
11:56futileok back to work. bye
11:56RaynesGoodbye.
11:57futilewhen i look at Rails stacktraces.. i wonder "what the heck were these guys doing? this is way too many abstractions"
11:57gzmask.(doc set!)
11:58futilewhen i look at Clojure + ring + compojure stacktraces im like "oh right, thats pretty much all my code. sweet."
11:58gzmask,(doc set!)
11:58clojurebotPardon?
11:58hyPiRion$doc set!
11:58futile,set!
11:58clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: set! in this context, compiling:(NO_SOURCE_PATH:0:0)>
11:58gzmaskI guess it's clojurescript lol
11:58gfredericks&(doc set!)
11:58lazybotjava.lang.SecurityException: You tripped the alarm! set! is bad!
11:58gfredericksalarm! set! is bad!
11:59futilehaha
11:59technomancy...and you should feel bad
12:00Raynestechnomancy: Dear God, why did I never think of adding that to the error message?
12:00futileoh wow, i recognize those names: http://clojure-log.n01se.net/date/2011-04-08.html
12:00clgv$conditions 10838
12:00lazybotLocation not found.
12:00futilewow, i made that joke 2 years ago?
12:00futile(clojure -> lava)
12:01Raynesfutile: Why are you claiming it now? :o
12:01futilecuz its me?
12:01RaynesWHERE'S YOUR PRUF
12:01futilelook at the name "steven degutis" in https://github.com/clojure/clojure/pull/6/commits
12:01futilein every commit
12:02RaynesYour name is Steven Degutis?
12:02futileyes. look at https://groups.google.com/forum/?fromgroups#!topic/clojure/AdSrnNe_anw
12:02futilesee it there too
12:02clgvRaynes: where do you get the code for "$conditions" from on that website?
12:02RaynesGonna need to see a driver's license.
12:02technomancyhow did that pull request get closed twice?
12:02futiletechnomancy: magic
12:02futilehmm, that is weird
12:02Raynesclgv: Where do i get the code for it?
12:02RaynesI got it from my brain.
12:03clgvRaynes: I searched my city their - but I dont know where the code might be listed on the result page...
12:03futileRaynes: i also wrote zephyros https://github.com/mattgemmell/zephyros/commits/master
12:03Raynesclgv: You mean the number I used?
12:03clgvRaynes: yeah
12:03RaynesThat's a zip code.
12:03RaynesPostal code.
12:03clgv$conditions D-89073
12:03lazybotLocation not found.
12:03futilewhich was based on appgrid: https://github.com/biohazardffm/grs/tree/master/AppGrid
12:04RaynesIt's weird about non-US places.
12:04RaynesI'll be back shortly. Gotta head out. Buddy is picking me up soon.
12:04clgv$condition Ulm, Germany
12:04hyPiRionclgv: you forgot an s
12:04clgv$conditions Ulm, Germany
12:04lazybotLast Updated on June 19, 5:55 PM CEST; Mostly Cloudy; Dewpoint: 63 F (17 C); Precipitation today: 0.00 in (0 mm); Temperature: 90.2 F (32.3 C); Windchill: NA; Wind speed: 0.0mph; Wind gust: 0mph; URL: http://www.wunderground.com/global/stations/10838.html.
12:05tomjackwow :(
12:05clgvah thats it^^
12:05hyPiRionman
12:05clgvroasting in my office. someone please turn me ^^
12:06futiletime to put on my UX hat
12:06charliekilo$conditions Pearl City, Hawaii
12:06lazybotLocation not found.
12:06charliekilo$conditions Pearl City, USA
12:06lazybotLocation not found.
12:07charliekilo$conditions Maui, USA
12:07lazybotLast Updated on June 19, 5:36 AM HST; Clear; Dewpoint: NA; Precipitation today: -999.00 in (-25375 mm); Temperature: 74 F (23.3 C); Windchill: NA; Wind speed: 6mph; Wind gust: 9.0mph; URL: http://www.wunderground.com/US/HI/Maui.html.
12:07hyPiRionwow, -25375 mm rain is low
12:09gtraksounds REALLY dry, hope they're ok
12:09dignatiHi there, Im a little bit struggling to process a coll right now. Mainly I need to map an apply call. Is there some function or macro already doing this?
12:09gtrakmap an apply?
12:09Morgawrdon't want to spam, but I posted my question in the ClojureScript google group: https://groups.google.com/forum/?fromgroups#!topic/clojurescript/EXqcjyRbALc in case anyone feels like helping out ;)
12:10hyPiRiondignati: ##(map #(apply + %) [[1 2 3] [4 5 6] [7 8 9]]) ?
12:10lazybot⇒ (6 15 24)
12:10dignatigtrak: Yeah, like (map #(apply fun %) coll)
12:11gtrakwhere each item in the coll is args for fun?
12:11dignatihyPiRion: Okay, I did that. just wanted to ask if there is already a function in clojure.core doing that
12:11dignatigtrak: exactly like hyPiRion showed
12:11gtrakpartial apply fun?
12:12gtraksaves a classdef
12:12hyPiRiongtrak: it's slower though. Not that any of these things usually matter.
12:12gtraklike: ##(map (parital apply +) [[1 2 3] [4 5 6] [7 8 9]])
12:12lazybotjava.lang.RuntimeException: Unable to resolve symbol: parital in this context
12:12gtraklike: ##(map (partial apply +) [[1 2 3] [4 5 6] [7 8 9]])
12:12lazybot⇒ (6 15 24)
12:13gtrakslower?
12:13hyPiRionyeah
12:13gtrakwhy?
12:13clojurebotwhy not?
12:14hyPiRion$source partial
12:14lazybotpartial is http://is.gd/buxpVi
12:14gtrakhyPiRion: 3 args or less should be just as fast
12:14gtraki can see the concat mattering
12:15hyPiRionI have usually considered it slower, and that's what I've registered too
12:15gtrakhrm
12:15hyPiRionThat's biased though, but I feel pretty sure it is, as it's varags vs constant arg size.
12:16gtrakyea... dunno. function-literal instantiation vs a single dynamic call should be negligible
12:16hyPiRion(partial apply +) => (fn [& args] (apply apply + args)) vs (fn [%] (apply + %))
12:16Morgawryeah, calling apply to call apply seems a bit redundant, the syntax doesn't change much from map #() and map (partial ..), might as well go with the one that performs faster (at least theoretically, benchamrking may be necessary to prove anything)
12:17gtrakah, you're concerned with the arglist seq
12:17kittylystAre any of the Monger developers online?
12:17kittylystI have a question about repsets
12:19futile,()
12:19clojurebot()
12:19futile,(())
12:19clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList$EmptyList cannot be cast to clojure.lang.IFn>
12:19futile,[()()]
12:19clojurebot[() ()]
12:19futile!
12:20futileJohnny Five!!!
12:23futileSo regarding writing a website that doesn't work very well with JS disabled:
12:24futileit seems like the only people who have JS disabled are self-important know-it-alls who think they're smarter than everyone else anyway, right?
12:24futileSo they're gonna hate my site regardless, even if I have JS enabled, because something is sure to be done wrong.
12:24futilei.e. maybe I didn't fully conform to XHTML5-transitional with CSS3 for Opera or something
12:25gtrakfutile: just use flash
12:27TimMcfutile: No, there are plenty of other people who will hate you. Suck it up and code it right.
12:27TimMcGraceful fallbacks aren't that hard to write.
12:28TimMcOr yeah, go whole hog and use FutureSplash.
12:28gtrak'graceful' he says.. this is the internet
12:28TimMcIt's all relative.
12:29ToxicFrogIf you use Flash, I will hold you down while everyone who uses a screen-reader, netbook, or 64-bit OS makes you gargle chainsaws
12:29hyPiRionGraceful fallbacks are a relative term.
12:29futilei can do graceful
12:29hyPiRionis*
12:29TimMc>_>
12:29gtrakthe best I can hope for non-surprising and maybe neatr.
12:29gtrakneat*
12:29hyPiRionBut according to google analytics, 100% of the people visiting my site uses JS, so I don't have to consider fallbacks :)
12:30TimMchyPiRion: :-P
12:30TimMc"No one has yet complained about our sealed-shut suggestion box!"
12:30hyPiRionWell
12:31hyPiRionI don't use JS for anything else than analytics
12:31ohpauleezTimMc: Ha!
12:31ohpauleez:)
12:31TimMcfutile: Quick list of problems with JS-only: Accessibility, search engines, broken JS code, other devs, people using NoScript (for privacy and security)...
12:31TimMcfutile: Unless you're writing http://fuckyeahpsychedeliccats.tumblr.com/ in which case go to town.
12:34gtrakthe only thing accessible about that site is me considering the location of their shrooms.
12:37ckoch786Anyone know if it is possible to run a repl on a running jvm and manipulate objects like you would in a debugger?
12:37gtrakckoch786: yes, I do it all the time
12:37gtrakor do you mean embedding into a java app? I've done that too, a spring WAR thing
12:38ckoch786yeah I want to embedded it so I can manipulate data on the fly
12:38gtrakckoch786: something somewhere needs to start up an nrepl server, in my case I created a servlet-listener to do the job
12:38supersymif I'd want to find all occurences where a function is used (in a lein project), including the file and line number, what would be a good method? Do I reflect, or use a package hooked to OS and grep?
12:38ckoch786can you point me to some examples/docs
12:39ckoch786can I embed it into java apps?
12:40gtrakckoch786: looking through old gists, but here's a starting point: https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/server.clj
12:40gtrakckoch786: you'll need to gen-class something for java to see, or use the clojure runtime directly to resolve vars.
12:41gtrakckoch786: this is how I did it with swank a long time ago: https://gist.github.com/gtrak/3122677
12:42gtraknrepl won't be much different
12:42justin_smithsupersym: grep / find users is one thing, but what about finding cases where the function is captured by a closure with a different name and that closure is accessed elsewhere?
12:42ckoch786gtrak, thanks
12:45gtrakbinding the servlet-context to a namespace var gave me an entry point into the java app, in my case, I replaced some spring beans with clojure versions (using reify and such) that caught stuff flowing through and let me play with it.
12:48rasmusto_gtrak: fresh spring bean salad
12:48ParahSailinhm, trying to import a jar file-- im putting it in the classpath but it's not finding it when i import
12:49gtrakimport... a jar file... cannot parse
12:50ParahSailinimport a class from a jar file...
12:50akells`I'm writing an HTTP server for learning purposes. I'm at the point where I would need to be saving POST data. Do atoms seem like a proper way to try to handle storing that data?
12:50ParahSailinyou guys dont get to be so pedantic about typing
12:51gtrakakells`: atoms are about mutation, you'll need some sort of data structure?
12:51akells`gtrak: yeah, I'm in need of some sort of data structure. any suggestions?
12:52akells`gtrak: I threw together something with atoms very ignorantly, and its looking like I was wrong to think they'd do what I want
12:52gtraknot sure, I glanced at Grizzly at one point, I think there's some map of nio selectors to request-threads somewhere
12:53tomjackakells`: I don't think you've told us what you want
12:53akells`well I appreciate the input
12:53akells`tomjack: sorry. I want a way to store some data that I'm receiving through a POST request, so that I can then serve that data up again
12:54tomjack'store' as in durably? if the web server gets killed and restarted, you still want the data around?
12:54akells`I've parsed the POST request and have a hash-map now that contains all of the POSTed data. if the server its killed, the data can go away
12:55ParahSailindoes clojure handle overloaded constructors from a java class file?
12:56gtrakParahSailin: not really, you should cast the args
12:56gtrakcast... I mean coerce I guess
12:56tomjackakells`: ah, ok. atom sounds good to me
12:57gtrakselecting a constructor via reflection can get ambiguous, I had a bug from this
12:58akells`tomjack: okay. would you mind taking a peek at this bit of code I've written? https://code.stypi.com/hxk1rpqs
12:59tomjackthat's rather odd
13:00akells`I must admit I wrote it while not knowing very much at all about atoms
13:00tomjackif they storage map maps data -> data, you have to already know the data to get the data out
13:00tomjackwhich makes it kinda useless
13:00tomjackthe other thing is, yeah, you're abusing atoms
13:00gtraknot useless, it makes it act like a set :-), but probably not what he wants
13:01tomjackyou can't @ and then use this in a swap!/reset!
13:01tomjackand you can't try to do a swap! and then a reset! and expect it to be atomic
13:01tomjackpost-data and put-data should both just be a single swap!
13:03tomjackexample there for post-data
13:03XPheriorI've always wondered about this.. (def x (agent nil)) (send x #(println "Hey"))
13:03XPheriorWhere's the output go from nrepl? I'd expect inside the repl
13:03akells`thanks tomjack. so the @ is unnecessary in this case?
13:04supersymjustin_smith: thats not really an issue I think, mostly would use them for their side-effects... to be more concrete, I was looking for a bit more advanced (todo ...) than just ;; TODO stuff
13:04supersymanyway I just realized I can use meta-data... that has the info I'd need
13:04tomjackput-data is going to be like (swap! storage-map (fn [storage] (-> storage (dissoc previous-data) (assoc new-data new-data))))
13:04tomjack(just noticed #(merge % {new-data new-data}) is just #(assoc % new-data new-data))
13:05CaptainLexHow would I go about having a macro take branches based on the prefix of a variable name?
13:05tomjackit's not really that the @ is unnecessary (it is), it's actually wrong
13:05akells`oh, okay
13:05tomjackif you @ and then use the result to swap!/reset!, the atom may have changed since you @, breaking atomicity
13:05gtrakCaptainLex: (case prefix ...)?
13:05tomjackonly a single swap! or reset! will be atomic
13:06dnolen_CaptainLex: convert the symbol to a string and use a regex + some conditional as suggested by gtrak
13:06tomjackthe fn passed to swap! gets the current value of the atom as an arg, which you can use instead of @
13:06futilewoot, UXing like a pro
13:06tomjacksomething like that
13:06CaptainLexdnolen_ and gtrak: Thank you!
13:07tomjackto me it would seem to make more sense to use a separate key
13:07akells`I see tomjack
13:08ParahSailinis there a better repl? im using jline but i have to mentally keep track of backspaces if i make a mistake
13:08hyPiRionParahSailin: are you using `lein repl`
13:08hyPiRion?
13:08akells`thank you so much tomjack, you've set me on a good path. it is much appreciated
13:08tomjacknot sure how you plan to use these though
13:09ParahSailinleiningen?
13:09clojurebothttp://github.com/technomancy/leiningen
13:09hyPiRionParahSailin: Yeah, the repl which is bundled with leiningen.
13:10hyPiRionAre you using Leiningen by the way?
13:10ParahSailinah, i was just using java -cp
13:10tomjackakells`: e.g. could be that an atom is not what you want after all :), hard to say without knowing what you're really trying to do. if you're basically using it as an in-memory database, I think it makes sense
13:13futile(let [children (for [child-key (:child-keys parent)] (find-by-key child-key)] ...)
13:13futileO postgres, how I long for thee.
13:15tomjacks/in-memory database/in-memory kvstore/
13:16futiletomjack: (i wasn't responding to you btw, in case you thought so)
13:19ParahSailinis there a better way to hack a jar file into the -classpath of lein repl than manually grabbing the actual java command and editing it?
13:20gtrakyes, install it in your local maven repo and add a dependency to project.clj
13:20Raynescemerick: You need to get off the JS, man.
13:20RaynesI know some great rehab facilities if you ever want to get clean.
13:21TimMc~repeatability
13:21clojurebotrepeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability
13:21TimMcParahSailin: ^
13:29futileAny of you guys use Clojure + ClojureScript in the same webapp?
13:30futileI'm thinking this will go well with ajax to make a site very neat.
13:30dnolen_futile: lots of folks do that
13:30futile(well not ajax, acljsj really)
13:31futilednolen_: oh wait this is a mailing list question
13:31futilesorry
13:31Raynesfutile: I've considered it for refheap
13:31RaynesBut I can't justify moving the reasonably trivial javascript over to clojurescript.
13:32RaynesAnd adding a compilation step
13:32ParahSailinok, having trouble make it use the correct overloaded constructor now
13:32futileI'm mostly wondering about how you usually set it up, like if you just have a normal Clojure project that happens to have a small Cljs section too, or if they're two separate projects, or what
13:32dnolen_futile: not specific enough to be mailing list question ;)
13:32futileParahSailin: HA! nice name!
13:33futilednolen_: maybe I should just try doing the clojurescript-getting-started guide first
13:33futilethen i can find out what my questions really are
13:33dnolen_futile: probably
13:33futilethx dnolen_
13:33futile(inc dnolen_)
13:33lazybot⇒ 1
13:33futile$karma dnolen
13:33lazybotdnolen has karma 9.
13:33futileo
13:33futilemeh not my problem
13:36Raynes(inc dnolen)
13:36lazybot⇒ 10
13:36Raynesfutile: He doesn't actually have to be here.
13:36futile(dec dnolen_)
13:36lazybot⇒ 0
13:36Raynes(inc ilikecherrypieandghostpeppers)
13:36lazybot⇒ 1
13:36futileall fixed
13:36futileRaynes: no i get it dont worry
13:36futileRaynes: merge plz kthx
13:37Raynesfutile: Alan isn't here yet.
13:37futileo rite
13:37futilesorry forgot
13:37futilewell not really but thats the shorter answer
13:37RaynesWithin 2 hours he'll be here and I can solicit advice.
13:37futilemeh no rush
13:37bbloomSegFaultAX: my semver rant as promised: http://www.brandonbloom.name/blog/2013/06/19/semver/
13:39jweissis there a lib where i can emit valid html just like clojure.data.xml?
13:39Raynesjweiss: hickory
13:39bbloomRaynes: heh. aw /me hugs back. is that an approval of my point of view? :-P
13:39Raynesbbloom: I saw "semver" and "rant" in the same sentence.
13:40bbloomRaynes: heh, that sums it up
13:40futileenough commas already bbloom
13:40technomancybbloom: isn't semver a classic Postel's Law thing?
13:40futile"Sadly, this is rarely, if ever, true." - I was taught to write this way in college but now I find it really hard to read, /cc bbloom
13:41Raynesbbloom: guarentees is not a word, fwiw.
13:41RaynesI hate that word so much.
13:41RaynesI can never remember how to spell it.
13:41tomjackbbloom: what's the thesis?
13:41futile"Sadly, it's never true. Well okay maybe sometimes."
13:41futileThat's how I'd do it :D
13:41bbloomRaynes: whoops. did spell check but forgot to commit/push it!
13:42tomjackI think I agree with everything you said but it doesn't seem to change how I feel about semver
13:42bbloomfutile: i'm not you :-P
13:42RaynesI, disagree, futile. More, commas, are, better.
13:42futilebbloom: it's not about me or you though.. it's about a virus, a writing style that everyone thinks is professional and fancy but is really just hard to read.
13:43bbloomtechnomancy: how does postel's law apply here?
13:43futileBut everyone emulates it anyway because that's how they read smart people writing, and they want to sound smart, so it spreads like wildfire.
13:44bbloomfutile: is that the only sentence you have a problem with in my post? informal speech/tone generally involves a lot of commas…..
13:44futilebbloom: "However, statistically speaking, ..."
13:45bbloom*shrug* ok, i'll consider/analyze my comma usage in the future, just, for, you, buddy
13:45TimMcfutile: "Want" has nothing to do with it. People absorbthe writing styles of what they read.
13:45futilebbloom: "individuals and projects use SemVer, or something like it, to good effect."
13:45futileTimMc: yea doth I know, sir.
13:45technomancybbloom: I mean that just because you can't trust The World to work that way doesn't mean it's not a good idea to do your best on it when you can.
13:45bbloompersonally, i like extra punctuation for the same reason i like parenthesis in lisp: explicit grouping is a good idea
13:46futilebbloom: not when it makes it feel like stuttering when I read it
13:46technomancybbloom: more interesting to me actually is deconstructing the idea that you can have bugfixes that don't break backwards-compatibility
13:46futilebbloom: anyway I've only had this opinion in the past year or so, ever since I've started reading books translated from french or latin into English a few hundred years ago
13:47futilethey're really, really hard to read. And it's not necessary either. I could easily rearrange the sentences and it reads much more natural.
13:47bbloomtechnomancy: are you suggesting that producing==stamping-versions and accepting==resolving-dependencies ?
13:47technomancybbloom: right; exactly
13:47hyPiRiontechnomancy: Well yeah, in theory that doesn't make sense, because one could depend on that specific bug.
13:47technomancyhyPiRion: right; nearly every release includes breaking changes by definition
13:47TimMchyPiRion: Citation: The Win32 library.
13:48hyPiRiontechnomancy: different semantics at least.
13:48technomancyhyPiRion: but we don't act as if that were true; we construct this notion of intended behaviour that you're supposed to be coding against, even though it's almost never defined
13:48futilebbloom: in Ruby that would really be person.address.residents, much closer to the threading macro than C's or Python's version
13:48futileot
13:48bbloomtechnomancy: personally, i always depend on precise commits for production systems
13:48futilethe only feature I wish gist had was an RSS feed
13:48TimMcbbloom: What I'd like is something that suggests a new set of dependencies (based on semver) that I can then go and investigate.
13:48hyPiRiontechnomancy: yeah, that's the issue
13:48futilethen my gists would be a full-fledged blog
13:49futiletechnomancy: hey check out my blog https://gist.github.com/evanescence
13:49futile:D
13:49hyPiRionWell, issue and issue.
13:49technomancyfutile: you misspelled blagh
13:49futileblarg!
13:49technomancyfutile: lol @ go
13:49futilety
13:50futilemy fav one is "Lock up your solutions"
13:50futilewell, right after the "Go 1.1" one
13:50jcromartiecan someone help me understand how a Clojure fn is a valid java.util.Comparator?
13:50jcromartieit just is
13:51jcromartie#(isa? (class #()) java.util.Comparator)
13:51tomjackjcromartie: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/AFunction.java#L46
13:51jcromartie,(isa? (class #()) java.util.Comparator)
13:51clojurebottrue
13:51supersymdamn I could be paranoid.. but is #linguistics filled with only bots >< Some answers and sentences they utter... I don't know.
13:51hyPiRionjcromartie: if it returns something truthy, then the comparator returns +1 or something, wheras if it returns falsey it returns -1
13:51jcromartieer, never mind
13:52hyPiRionor 0
13:52hyPiRionI don't rmemembe.r
13:52bbloomjcromartie: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/AFunction.java#L46
13:52jcromartieI completely glossed over java.util.Comparator right there in ,(ancestors (class #()))
13:52hyPiRionOh what, that has to be the best attempt at writing "remember" I have ever done.
13:52jcromartieI was mistaken
13:52jcromartiehyPiRion: I think that's a new JRPG
13:53hyPiRionjcromartie: what? "rmemembe.r" or "remember"?
13:53jcromartie"rmemembe.r"
13:54jcromartiekidding of course
13:54hyPiRionI wouldn't be surprised
13:55futilewhoa!
13:55futilegists even have comments!
13:55futileok gist is literally the best blog engine ive used so far
13:55futilemaybe it *does* have RSS? then i'd be all set!
13:55supersymoh this cleverbot is pretty nice though... I see gfredericks mentioned him once in teh irc logs
13:56hyPiRionjcromartie: http://www.youtube.com/watch?v=a0g8bwYzMyU
13:56TropbyMoin.
13:57supersymHow do we get world peace?
13:57supersymThey world will now the result of all this information processing in due time.
13:57supersymnot so smart though...
13:59cemerickanyone have any idea why Google Closure would produce a conditional here? https://gist.github.com/cemerick/5816340
14:01supersym damn...it speaks dutch. Thats wicked tho
14:02dnolen_cemerick: nothing to do with Closure that's an optimization for Clojure fns when used higher order
14:02dnolen_ClojureScript rather
14:03dnolen_cemerick: is that causing an issue in your case? (Math.seedrandom doesn't exist in JS anyway)
14:04cemerickdnolen_: Confused. Nothing higher order there. emitted.js is what cljs emits AFAICT; the conditional only appears after advanced compilation.
14:04cemerickyeah, Math.seedrandom is provided by a lib
14:04jcromartiehyPiRion: hahaha, it broke the CC system
14:04cemerickIt's not causing an issue; I just noticed it in the process of making that library compatible with gclosure advanced
14:05hyPiRionjcromartie: yeah. heh
14:05hyPiRionIt's not a surprise though :p
14:05futilei like how sometimes after 0.0 seconds of making a request to github, it immediately comes back to the page that says "this page is taking way too long to load"
14:05futilenginx misconfiguration methinks
14:05dnolen_cemerick: well the optimization was introduced for higher order cases, but for any function we can't resolve we check to see if there's faster path for ClojureScript fns
14:06dnolen_cemerick: but that's expected, it should appear if you write (js/Math.seedrandom ...)
14:06dnolen_shouldn't
14:07cemerickah-ha, will try
14:10cemerickdnolen_: OK. I had no idea that cljs emitted different code for different optimization levels!
14:10dnolen_cemerick: it has for a long time now
14:10dnolen_cemerick: :static-fns is the compiler option - this is one by default under advanced
14:10dnolen_makes a huge difference
14:10dnolen_"this is on"
14:11cemerickdnolen_: noted, thanks :-)
14:11dnolen_static dispatching wherever possible to correct arities
14:11dnolen_including fancy calling into variadic fns by allocating array at call site
14:11dnolen_to avoid touch arguments objects in the all the cases
14:12cemerickriiight, that I remember
14:14dnolen_cemerick: you should look at emit :invoke in compiler.clj it's pretty funny
14:14dnolen_but all of these cases make CLJS much, much faster
14:17cemerickhah
14:17cemerickman, that gnarly :-)
14:17dnolen_cemerick: hah oh yeah
14:18jcromartieI could spend forever editing Clojure Cookbook
14:18jcromartie:|
14:18jcromartiegood thing or bad thing?
14:18dnolen_cemerick: a lot of it fell out of trying to make persistent data structures not suck perf-wise
14:18jcromartieit's a damn good learning experience
14:19jcromartiedigging into lots of clojure.core and clojure.lang.* source code
14:23cemerickright
14:24cemerickdnolen_: any interest in something like goog-dependencies, but generalized to any .js files on the classpath that define provides? Folding something like that in would eliminate most needs for specifying :libs.
14:25dnolen_cemerick: sounds interesting, but need more details - open a ticket
14:25cemericksure
14:26cemerickdnolen_: I'm surprised you haven't written a bot to sit on your handle and always respond to questions with "open a ticket" ;-D
14:26dnolen_cemerick: hehe
14:27cemerickshould be a lazybot command. Bat-signal Raynes
14:32futileDoes anyone ever really use ()?
14:32futile,()
14:32clojurebot()
14:32futileSo useless.
14:32futile(1 2 3)
14:32futile,(1 2 3)
14:32clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
14:32mefesto,'(1 2 3)
14:32clojurebot(1 2 3)
14:32futileAnd it's inconsistent. List with nothing is an empty list, list with things is a function/macro-call
14:33futileUnless you quote it, of course.
14:33futileBut you could just as well do '()
14:33futile,'()
14:33clojurebot()
14:33futile,(= () '())
14:33clojurebottrue
14:33mefesto,(= nil ())
14:33clojurebotfalse
14:33futileWhy even have ()?
14:33futile,(= nil '())
14:33clojurebotfalse
14:33manutter,(nil)
14:33clojurebot#<CompilerException java.lang.IllegalArgumentException: Can't call nil, compiling:(NO_SOURCE_PATH:0:0)>
14:33S11001001futile: it's unambiguous, that's why
14:34manutter,(seq '())
14:34clojurebotnil
14:34justin_smithalso, I imagine common lisp related hysterical raisins
14:34S11001001futile: the eval thing is "look at the first thing in the list, and then...". There's no first thing in an empty list.
14:34manutter,(first '())
14:34clojurebotnil
14:34manutter,(rest '())
14:34clojurebot()
14:35futileI mean, I see the point in having an empty list.
14:35futileYes, an empty list is very useful.
14:35futileBut why have () mean an empty list? That's so inconsistent.
14:35futile'() is fine for an empty list.
14:35S11001001Because it's unambiguous, futile.
14:35futileSo () should just be an error probably.
14:35futileOr at least a function-call-ish-thing that returns nil.
14:36mefesto() looks like it's empty to me
14:37mefestowhat should we do with [] then :)
14:37mefestolooks like an empty vector
14:37futilemefesto: but [1 2 3] is also a vector
14:37futilemefesto: (1 2 3) is not a list
14:38futilemefesto: '(1 2 3) is a list
14:38futilemefesto: '() is an empty list
14:38futilemefesto: [] is an empty vector
14:38futilemefesto: () is an empty function call
14:38Gnosis-,()
14:38clojurebot()
14:38futilesee the inconsistency?
14:38mefesto() is an empty function call?
14:38futileno
14:38futilebut it should be
14:38futilehold on
14:38S11001001no
14:38mefestowhy?
14:38clojurebotWhy is the ram gone
14:38hyPiRion(1 2 3) is a list
14:39hyPiRion,(list 1 2 3)
14:39clojurebot(1 2 3)
14:39mpenet,(type ())
14:39clojurebotclojure.lang.PersistentList$EmptyList
14:39mpenet,(type '())
14:39clojurebotclojure.lang.PersistentList$EmptyList
14:39hyPiRionWhat you're asking is why () doesn't call the first argument with the rest of the arguments
14:39mpenetfine to me
14:39hyPiRionWhich is because it has no first argument
14:40TimMc"Because Rich Hickey said so."
14:40futilehttps://gist.github.com/evanescence/5816707
14:40Gnosis-what does () do in Common Lisp or Scheme?
14:41ToBeReplacedi can understand his point; and I always use '() when needed (rare) instead of ()
14:41hyPiRionGnosis-: it returns nil
14:41futilehyPiRion: () with things in it calls the first argument, when (first it) is nil, it should probably just be the same as (nil ...)
14:41hyPiRionNIL, rather.
14:41mefestofutile: well it's a list when it's read in but it gets evaluated as well
14:41mefesto,(read-string "(1)")
14:41clojurebot(1)
14:41S11001001Gnosis-: in CL, () is self-evaluating; in Scheme it's an error
14:41TimMcIf it didn't evaluate to an empty list, then (#()) would be less interesting.
14:41mefesto,(eval '())
14:41clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
14:41mefestooh
14:41futileI'm so happy with gist as a blog engine.
14:42amalloyhyPiRion: are you sure? i think it's undefined in the standards for those languages
14:42S11001001amalloy: it is definitely self-evaluating in CL
14:42hyPiRionamalloy: Well, for CL at least?
14:42mefestofutile: i think "consistent" depends on your point of view: (), [], #{}, {} looks consistent :)
14:43hyPiRionVery sure ANSI CL at least defines (), NIL and '() to evaluate to the same thing
14:43hyPiRionand that car and cdr on NIL returns NIL
14:43amalloyhyPiRion: you're probably right
14:43mefestofutile: if (1 2 3) generated a list instead of executing then how should we execute code instead?
14:43Gnosis-aha, okay, cool
14:44futileCool. Turns out my gist-blog DOES have an atom feed: https://gist.github.com/evanescence.atom
14:44futileSweet. Sign up people.
14:44mefestooh nice
14:45futilebest blog engine ever
14:45futileonly thing it's missing are dated-named-permalinks
14:51futileIs there a way to compare strings (for sorting) by the end rather than the beginning?
14:52futileOh wait, reverse it first. Duh.
14:52hyPiRion,(sort-by (comp vec reverse) ["cba" "abc" "cab"])
14:52clojurebot("cba" "cab" "abc")
14:53hyPiRiongurr, what
14:53futile,(sort-by clojure.string/reverse ["quux" "foo" "bar"])
14:53clojurebot("foo" "bar" "quux")
14:53hyPiRionyeah, that.
14:53futile:P
14:54futileOh wait, juxt to the rescue!
14:54futile,(sort-by (juxt clojure.string/reverse identity) ["quux" "foo" "bar"])
14:54clojurebot("foo" "bar" "quux")
14:55futileThat didn't help.
14:55hyPiRionI don't see how it matters there
14:55hyPiRionfutile: that is sorted by the last char, what more are you asking for?
14:56Raynestpope: ping
14:56hyPiRiono < r < x
14:57futilebasically i wanted to group filenames by extension and then sort them within those groups
14:57futilebut i figured out a hacky way thats faster so meh nm
14:58borkdudewhat is a common way to sort maps by value: (sort (fn [a b] (pred (second a) (second b))) some-map) or something shorter?
14:58Zamarokwhat's the best way to take n elements from the end of a list? Maybe something like (take n (reverse xs))? Or is there way to do it without reversing the whole list
14:58gfredericks&(doc nth-tail)
14:58lazybotjava.lang.RuntimeException: Unable to resolve var: nth-tail in this context
14:59gfredericks$findfn [1 2 3 4 5 6] 2 [5 6]
14:59lazybot[]
14:59gfredericks$findfn 2 [1 2 3 4 5 6] [5 6]
14:59lazybot[clojure.core/take-last]
14:59gfredericksfound it
14:59hyPiRionZamarok: list or vector?
14:59hyPiRionYou can do subvec, which is much faster
14:59ZamarokhyPiRion: list
14:59hyPiRionah
15:00Zamarokhmm, ok.. noted. thanks
15:00Zamarokyou too gfredericks ^^
15:00hyPiRion(obviously you can only do subvec for vectors.)
15:01Zamarokmakes sense
15:01hyPiRion:o
15:01hyPiRion,(instance? clojure.lang.Counted (list 1 2 3))
15:01clojurebottrue
15:02ianeslickAnyone run into the leiningen warning: ":gpg and <password> have a type mismatch merging profiles"? I can't see where I'm still specifgying :gpg anywhere
15:04fsmunozI have a werid problem which I'm not sure is obvious or not, my lack of Java knowledge is likely at fault here. I have a getTableChangeDescription() function which returns "abstract TableChangeDescription[]"; this is "Interface TableChangeDescription" in the docs. However wheh I do a (println "Event type: " (.getTableChangeDescription evt) the class type (also checked with type and class) is "#<NTFDCNTableChanges[]
15:04fsmunoz[Loracle.jdbc.driver.NTFDCNTableChanges;@301cb7b>". I wouldn't mind but this thing doesn't accept any of the methods in the documentation... any ideas?
15:04fsmunozs/werid/weird/
15:05Raynestpope: Never mind. I should know by now that if I ever have a problem with Vim I should just look at your Github page.
15:05amalloyfsmunoz: it returns an array of things which do accept those methods
15:05amalloythe array itself, doesn't, of course, just like you can't multiply '(5 6 7) by 4 without first taking things out of the list
15:06futileamalloy: hey did you get that merge i sent ya?
15:07borkdudeno-one?
15:07borkdudewhat is a common way to sort maps by value: (sort (fn [a b] (pred (second a) (second b))) some-map) or something shorter?
15:07fsmunozamalloy: right, right, I see. I was expecting that to be clearer in the documentation, probably clear enough by the [] I suppose...
15:07amalloythat is specifically what [] means
15:07fsmunozamalloy: so I should reference the first entry and see if it accepts the method
15:07fsmunozamalloy: yes, I'm seeing that now, thank you. Still not used to reading the obvious in the Java documentation.
15:08justin_smithborkdude: (sort-by pred some-map)
15:08justin_smithborkdude: sorry, make that (sort-by second pred some-map)
15:08justin_smithpred usually being comp and is an optional arg
15:08borkdudejustin_smith thank you
15:09justin_smithalso comparator is a better term than pred there, just reusing your term for clarity
15:10fsmunozamalloy: perfect, it works as expected with an aget, many thanks!
15:12TimMc&(sort - [1 5 2])
15:12lazybot⇒ (1 2 5)
15:12TimMc&(sort-by - [1 5 2])
15:12lazybot⇒ (5 2 1)
15:16justin_smithTimMc: (comp - compare) seems like it would be useful
15:19Raynesyogthos: Man.
15:19RaynesI get so many emails from your crazy pull request stuff.
15:19yogthosRaynes: haha I've been busy eh :P
15:20gtrakjustin_smith: I call that function 'descending'
15:20yogthosRaynes: lol some of it didn't need to be on a branch I suppose, but kind of used to doing it now :)
15:20akrikosweavejester: I'm trying to build a webapp using ring that only uses wrap-reload in a dev environment. To do this, one tutorial suggests using wrap-if, but that seem to be available anymore. How should this be done now (I can't find wrap-if anywhere)? Apologies if this is readily available info somewhere… couldn't find it.
15:20TimMc&(.compare trampoline - 7)
15:20lazybot⇒ -7
15:20yogthosRaynes: btw you see the access rule madness that came out of one of the issues? :)
15:20weavejesterakrikos: I've never heard of wrap-if
15:21yogthosRaynes: check it out :) http://yogthos.github.io/lib-noir/noir.util.middleware.html#var-wrap-access-rules
15:21gtrakthen I write stuff like: (->> entities (sort-by last-touched descending) (take n))
15:21Raynesyogthos: Yeah, that seems like the hardest tiny piece of code to get right ever given the number of issues about it recently.
15:21akrikosweavejester: ah. I got the idea from here: http://mmcgrana.github.io/2010/07/develop-deploy-clojure-web-applications.html but my co-worker is telling me I can add it easily… thanks for the response
15:22RaynesI was actually considering telling you to make it a separate library until I realized how small it was.
15:22weavejesterakrikos: If you use lein-ring, it adds wrap-reload automatically for you when in development
15:22yogthosRaynes: yeah it's really tricky to get right and please everybody apparently :P
15:22yogthosRaynes: hopefully now it's bulletproof :P
15:23weavejesterakrikos: If you're manually creating your -main function, you can choose to apply dev middleware depending on some configuration setting.
15:23Raynesyogthos: Nothing to lose, fire away, fire away.
15:24yogthosweavejester: oh have a question about clout, I was using route-matches to check if the uri in the request matched the specified pattern, and I noticed that if you use context then it won't match, is that intentional?
15:24gf3sjl: Scala scares the shit out of me sometimes
15:24gf3sjl: "Heard u liek syntax, bro"
15:25sjlgf3: the syntax is horrifying coming from clojure
15:25weavejesteryogthos: Clout prefers :path-info over :uri if that's what you mean.
15:25yogthosweavejester: eg: (context "/foo" [] (GET "/bar" [] ...) will still have uri "/foo/bar" but clout will not treat it same as (GET "/foo/bar" ...)
15:25yogthosah
15:25`fogusweavejester: Thanks again for the core.memoize bug report.
15:25akrikosthanks weavejester. I was off ze rails.
15:25akrikos(inc weavejester)
15:25lazybot⇒ 8
15:25weavejester`fogus: Thanks for fixing it :)
15:25gf3sjl: Evaluated using Scala + Akka for a project last fall, opted for Ruby + Celluloid :-/
15:26sjlI'm looking forward to poking at akka a bit... can you use it from Clojure/other JVM langs or is it really tied to scala hard?
15:27yogthossjl: there are clojure wrappers for it
15:27sjlyogthos: ah cool
15:27yogthoseg https://github.com/jasongustafson/akka-clojure
15:27sjlneat
15:30ZamarokIs there a builtin function for finding elements in a list? Like `(search 5 (range 10)) => 5`
15:30ZamarokSeems like a very basic function, but hell if I can't find it
15:31sjlZamarok: are you trying to get the actual element out, or the index?
15:31sjlI can't really tell from your example because I think they'd both be 5...
15:31Zamarokan element, if it exists, else nil I suppose
15:31weavejesterUse a set
15:31ZamarokOh, good point. The element itself
15:31ZamarokMy data is already a very large list
15:32sjl&(some #(= :b) [:a :b :c])
15:32lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: sandbox5671$eval155578$fn
15:32sjl&(some #(= :b %) [:a :b :c])
15:32lazybot⇒ true
15:32sjler
15:32Zamarokwent down the 'some' road already
15:32weavejester&(first (filter #{:b} [:a :b :c]))
15:32lazybot⇒ :b
15:33Zamarokah.. but doesn't that traverse the entire list? I want it to stop when it finds the element it was looking for
15:33weavejesterNo, filter is lazy
15:33ZamarokOh o_o laziness continues to amaze me
15:33sjl&(let [find (comp first filter set)] (find :b [:a :b :c]))
15:33lazybotclojure.lang.ArityException: Wrong number of args (2) passed to: core$set
15:34sjlbleh
15:34weavejesterNo currying :)
15:34sjl&(let [find (comp first filter hash-set)] (find :b [:a :b :c]))
15:34lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: core$filter
15:34sjloh ffs
15:34sjlyeah
15:34Zamarokauto-currying is one thing I miss from Haskell
15:35Raynesgf3: HI
15:35weavejesterIt's a shame, but imo var-args are more useful
15:35Raynesgf3: WHERE'S MY REFHEAP CSS CHANGES. YOU TEASE.
15:36gf3Raynes: I'VE BEEN REAL BUSY
15:36gf3Raynes: I HAVE SKETCHES THOUGH
15:56Raynesgf3: WHAR SKETCHES
16:00bpris anyone familiar with pedestal?
16:00RaynesNope. Nobody in the whole world.
16:01stuartsierrabpr: I'm somewhat familiar with it, but mostly just the back-end parts.
16:03bprok. I'm having an issue with getting the front-end to recognize new/changed css files. I realize that's front-end, though.
16:03stuartsierrabpr: I'm afraid I won't be much help then. Try the mailing list.
16:03bprthanks
16:12dnolen_stuartsierra: can we do another CLJS release?
16:12stuartsierradnolen_: not this instant, but yes
16:12dnolen_stuartsierra: cool thx
16:13gzmask,(doc ->>)
16:13clojurebot"([x form] [x form & more]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc."
16:14gzmask,(-> 1 inc)
16:14clojurebot2
16:14gzmask,(->> 1 inc)
16:14clojurebot2
16:14gzmask,(-> 1 (+ 1))
16:14clojurebot2
16:15gzmask,(->> 1 (/ 1))
16:15clojurebot1
16:15gzmask,(->> 0 (/ 1))
16:15clojurebot#<ArithmeticException java.lang.ArithmeticException: Divide by zero>
16:15gzmask,(-> 0 (/ 1))
16:15clojurebot0
16:15kmicugzmask: you can /query clojurebot in private buffer
16:15gzmaskops, sorry
16:19jcromartierkneufeld: I don't see anything like a "basics" or "Getting Started" chapter that's centered around running a basic Clojure REPL or .clj files, creating a project, etc.
16:22gzmaskjcromartie: what's your editor of choice
16:23jcromartieEmacs
16:23gzmasknrepl it is
16:23jcromartiegzmask? huh?
16:23jcromartienREPL is great but it comes with a lot of gotchas
16:23jcromartieI'm talking about writing some recipes for the absolutely bare-bones basics
16:27gzmaski duno. I am new too and I feel Lisp is too flexible to have a big set of best-practices. me myself is learning by doing
16:28dnolen_yow
16:28dnolen_core.match on primitive arrays flies the wind
16:33gzmaskI have doubts on the dynamic typed aspect of the language. is this making reading the source code of undocumented libraries a bit hard?
16:33dnolen_http://gist.github.com/swannodette/5817742
16:33dnolen_gzmask: fortunately most open source Clojure libraries are small
16:34dnolen_gzmask: larger teams have started adopting schema like systems from what I hear to document intent
16:34bbloomdnolen_: i'm quite enjoying your twitter ramblings about js parallelism sucking
16:35dnolen_bbloom: heh, I just get sad panda because zero thought has been put into *real* primitives for doing this stuff.
16:36dnolen_~330ms for the final clause
16:36bbloomdnolen_: to me, there are parallels with the svn -> git transition for typical programmers
16:36clojurebotI don't understand.
16:36dnolen_that's pretty sweet
16:36gzmaskwell if open source means RTFSC then I am very scare of dynamic type languages
16:37bbloomdnolen_: you can't have parallelism unless you can fork a data structure & just as `svn cp /trunk /branches/foo` sucks, so does Object.clone
16:37gtrakgzmask: there's lots of ways to enforce or document contracts, typing is just one. I was scared of the freedom at first, but it grows on you
16:37bbloomso no matter what any runtime does, short of standardize some immutable data structures, parallelism is gonna suck
16:38dnolen_bbloom: that's what I mean - no talk about standardizing immutable data structures
16:38dnolen_bbloom: or at least providing something akin to final
16:38gtrakgzmask: there's a huge advantage in treating objects/things as data, and clojure emphasizes that
16:39bbloomdnolen_: i'm doing some Ruby work for a client right now & they had an algorithm that desperately needed some minor backtracking/speculation. so i swapped out their arrays and hahses with https://github.com/harukizaemon/hamster
16:39dnolen_bbloom: nice
16:39bbloomdnolen_: result? ~20 lines of code changed & suddenly we could do speculative evaluation
16:39bbloomminds: blown.
16:40dnolen_bbloom: haha
16:40dnolen_immutability is a hell of drug
16:40futilenew blog post again, something about documenting properly: https://gist.github.com/evanescence/5817408
16:40futileman, writing blogs is fun!
16:42bbloomdnolen_: "i want to apply one of the operations from a list, then pick the result which maximizes some function"
16:42bbloomdnolen_: the proposed solutions were entertaining
16:43technomancyfutile: "Use codox, it's beautiful. This is where users will go every time they need to use your library." what
16:43gtrakfutile: () is empty-list in other languages too
16:43technomancyfutile: users will use docstrings
16:43technomancyin the repl
16:48gtrakreading implementation code is always worthwhile in this community, I'm not sure how you can avoid it in other langs anyway unless your usages of libs are trivial.
16:48gtrakI've had plenty of java deep-dives, too
16:49bbloomgtrak: diving, drowning, what's the difference really?
16:49gtrakbbloom: I guess the difference is whether you decide to stay in the water afterwards
16:49futiletechnomancy: if you know the name of the function you're looking for
16:50gtrakor possibly the decision might be made for you..
16:50futiletechnomancy: im sure its possible to use the repl to discover a library's namespace names, and functions within them
16:50futiletechnomancy: but that sounds hard
16:50gtrakM-. is the most useful tool I have
16:51futileokay then let me change it to say 50% of users use codox, the other 50% use the repl
16:52gtrakI might cross-reference my code-reading with official docs, but the code's primary, I find that's a more effective use of time
16:53jeremyheilerfutile: why do you say it's 50%?
16:53futilegtrak: i admit ive done both at differnt times
16:53VFePersonally I find codox quite useful since it's a very high level view of the code-base, but then I'm a little more graphically oriented. Can't speak for anyone else obviously.
16:53futilejeremyheiler: because it seems half of us havent yet become pros at repl-style development yet
16:53jeremyheilerThe number seems entirely made up
16:53futilejeremyheiler: most of my numbers are based on intuition and experience, not hard stats
16:53futilebut ive found them pretty reliable, so meh
16:54futileVFe: ditto
16:54gtrakI'd say I'm visual too, but I prefer my own visualizations and understanding to someone else's views
16:55futilegtrak: i dunno, this page is pretty awesome: http://ring-clojure.github.io/ring/index.html
16:55gtrakthe code is the canonical source of the information, I try to build a bigger picture of intent from docs
16:55gtrakfutile: that just looks like noise to me :-)
16:56futilegtrak: no i mean click around on the left side.. then its wonderful
16:56futilebtw,
16:56bbloomfutile: i agree with gtrak. that is completely useless to me
16:56futilethis blog post was really aimed at motivating libs like https://github.com/8thlight/hyperion to shape up
16:56bbloomi hate javadoc & anything like it
16:57gtrakfutile: I prefer grep to visual scanning
16:57futilebecause i love that lib and want more people to use it, but even i find the docs very lacking and hard to nav
16:57gtrakring clicked when I read through the code and saw how people actually used it
16:58sjlhttp://jacobian.org/writing/great-documentation/
16:58futileditto for ring.
16:58gtrakcompojure clicked when I read every damn line
16:59gtrakonly took a couple hours
16:59futilepft, i got compojure right away, all i had to read was defroutes, routes, and route or something like that
16:59futilenot cuz im smart, but cuz its simple
17:00gtrakyou think you get it, until it does something unexpected :-)
17:00fsmunozEr, another obvious one that I'm having trouble with: how do I get the string value of an Enum? I have (str (.getTableOperations change) which seems tos enclose the result in [] (and likely is ont the right apporach anyway)
17:00gtraklike.. answer why is it uuencoding my query params..
17:00gtrakor decoding them..
17:00gtrakcaused a bug, now I know where to look.
17:00dnolen_sjl: I respect Jacob Kaplan Moss he's a nice guy, but any framework that needs 700 pages of docs needs to be burned to the ground.
17:01dnolen_I hated going through Django docs
17:01VFeCompjure took me awhile, cause I was completely new to http as well at the time, learning compjure was like 95% figuring out wtfhttp, 5% compojure, hah
17:01bbloomdnolen_: oh yeah, rough. sooo verbose
17:01gtrakI gave up on Django, because I tried to understand it
17:01sjldnolen_: there's something to be said for "tons of people use it because it actually works and gets things done"
17:01gtrakit made me feel like I was missing something :-)...
17:02dnolen_sjl: does not compute
17:02sjllol
17:02sjlpracticality beats purity
17:02sjlbetter?
17:02clojurebotbetter is swiss
17:02gtrakwriting code without knowing what it's doing is much harder for me than taking the time, that's just me
17:03bbloomgtrak: yeah, my paranoid nervous twitches consume quite a lot of time
17:03sjlDjango's admin interface alone saves like 50% of the time writing simple client CMS sites
17:03dnolen_sjl: it works, it solves problems - doesn't mean I like it
17:03bbloomsjl: i miss Microsoft Access.
17:03VFegtrak, yeah. Me personally I'm more of a reverse engineer…I only learn by breaking things
17:03sjlsure
17:03sjlbbloom: see also: excel
17:03bbloomsjl: Django's admin (and ActiveAdmin for Rails) are nice
17:03bbloombut maaaan i miss access
17:03gtrakVFe: breaking things lets me know I'm totally missing something. I try not to rely on it.
17:03bbloomso easy to make little GUIs tools for business folks to fuck with
17:03sjlexcel ain't pretty but I bet it gets more done in a day than most languages have ever gotten done in their lifetimes
17:04bbloomthe world runs on excel & visual basic for applications is the most popular programming language by number of "developers" by a huge margin :-P
17:04gtrakVFe: for instance, if you don't have immediate feedback, ie a stacktrace, you're out of luck.
17:04VFegtrak yeah I totally feel like that sometimes too, but it's what drives me to kind of re-build the system in my head
17:06sjlbut yeah, ignore the "700 pages" part of that series -- jacob is still pretty much spot on about docs
17:06sjlautogenerated api docs are like trying to teach someone spanish by giving them a dictionary
17:07sjlif you want to teach someone to use a language/library/guitar/car, *teach* them, don't just list information alphabetically
17:07clojurebotRaynes's list of enemies is '(brehaut)
17:07sjlclojurebot: you're drunk
17:07clojurebotexcusez-moi
17:08VFeque?
17:08clojurebotA bug report (or other request for help) |has| three parts: What you did; what you expected to happen; what happened instead. If any of those three are missing, it is awfully hard to help you.
17:08brehauti think im missing some context, clojurebot
17:09hoangelosI'm using procrun and clojure, and I can't seem to call the stop function. It gives me this error: "Method 'static void stop(String[])' not found in Class ../.."
17:09hyPiRionI love it when clojurebot is non sequitur.
17:11dnolen_sjl: congrats on the new gig, BTW
17:12sjlthanks
17:12gtrakVFe: trying to actually understand things also helps me stay away from complicated things :-)
17:12sjlI think it'll be mostly scala but I'll finally get to actually use Clojure in real life a bit too
17:12dnolen_sjl: nice
17:12sjlinstead of just writing minecraft bots in it
17:12sjllol
17:16i_ssjl: that sounds cool, do you have any on github or anything?
17:16sjlhttp://github.com/sjl/clojurecraft
17:17sjli_s: hasn't been touched in a while tho
17:17i_ssweet, i'll check it out
17:17jweissamalloy: i am making a patch to clojure.data.xml to properly handle cdata that contains the characters "]]>". the tests were actually wrong. but i can't figure out how to run them
17:17jweiss(i am bugging you because your name is listed in the pom.xml)
17:18hoangelosanyone here use procrun with a clojure app?
17:19tomjacksjl: cool, do you have clients which can log in and behave reasonably?
17:19tomjackI implemented the protocol once long ago but gave up when trying to figure out how to actually show up and not just bug out in crazy ways
17:29gfredericksI often use C-u C-x C-e to print some data to a buffer -- but when it's a moderate amount of data it all gets printed on one line. Is there any easy way with nrepl.el to get it pretty-printed instead?
17:30bbloomi swear i'll stop the shameless self promotion (some day), but everybody in NYC is coming to my awesome talk tonight, right? http://www.meetup.com/Clojure-NYC/events/120698402/
17:32gfredericksbbloom: I'm not in NYC nor am I coming, so that's one data point in favor of your theory
17:33bbloomwhere are you at? i'll flight right out tonight after the talk and present my talk to you offer your morning coffee
17:33bblooms/offer/over
17:34futileUX is fun
17:38gtrakbbloom: you NYC guys get all the fun.
17:39mrb_bkbbloom: can't make it this week - kill it!
17:41gfredericksbbloom: chicago
17:41gfredericksso at least there's a direct flight :)
17:43dnolen_bbloom: sadly I'll miss most of it probably, work party - but I'll try swing by catch the end
17:43dnolen_bbloom: sounds like Rich will be the audience ;)
17:43bbloomcool
17:43akhudekbbloom: videocast it!
17:43bbloom*scratches head* i think david greenberg does record them
17:44akhudeklive
17:44bbloomakhudek: heh, unlikely. http://www.youtube.com/user/dsg123456789?feature=watch is where they go i think
17:45akhudektoo bad, it wouldn't take much to do something like google's hangouts on air or maybe twitchtv or the like
17:46mikerodIf you give a type hint, but it is incorrect, does any error happen? ex: (defn ^Integer i-return-int [] "hello") then (i-return-int)
17:47arrdemtraditionally the vardic cases of a function must share one return type, right?
17:47bbloommikerod: easy to try it ##((fn ^long [] "string"))
17:47lazybot⇒ "string"
17:47bbloom,((fn ^long [] "string"))
17:47clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number>
17:47bbloommikerod: seems that it depends on the version of clojure!
17:47patchworkIs there a way to print a lein project.clj map out in the same format it is written?
17:48patchworkpprint for instance puts keys and vals on different lines
17:48patchworkbut in a project.clj the val is on the same line as the key
17:48mikerodbbloom: I did try it and didn't seem to be getting errors. So then I was confused. That is interesting that results may vary though.
17:48tomjack,((fn ^Long [] "string"))
17:48clojurebot"string"
17:49tomjackthe error above happens only with ^long and ^double
17:49mikerodI guess what this means is, don't assume type hints will catch incorrect types; but don't accidentally give the wrong type hint, because it may throw exceptions
17:50bbloomtomjack: ah, primitives vs boxed types?
17:50gtrakis there a good write-up yet about clojure's relation to the 'right tool for the job' and sort of 'languaginess' of the language?
17:51mikerodtricky tricky primitives
17:52gtrakI feel propagandish..
17:56dnolen_mikerod: type hints have always been about optimization
17:57ztellmangtrak: I just discovered no-disassemble, it's very cool
17:57ztellmanare you aware of any representation of the bytecode which isn't just a pretty-printed string, though?
17:57gtrakztellman: thank you :-) it's incredibly simple
17:58ztellmanI dug through the jdt stuff a bit, to no avail
17:58technomancygtrak: oh, does that make sense to expose as an auto-discovered nrepl command?
17:58gtrakztellman: when I posted about it, hugod mentioned there's some bytecode stuff in ritz
17:59technomancyhttps://github.com/technomancy/nrepl-discover etc
17:59ztellmanbtw, if anyone here isn't familiar with this, it's great, you can just call 'disassemble' at the repl: https://gist.github.com/ztellman/5800916
17:59gtraktechnomancy: possibly, but I'm wary of making it a generally useful thing when there's no cleanup of old classes
17:59gtrakztellman: potentially could also dig into the eclipse classes for something smaller
18:00gtraktechnomancy: I think to do it right, I have to transform clojure's classloader to handle cleanup.
18:00technomancyI can't tell if no one is interested in the nrepl-autodiscover stuff because none of the other editor devs have time to check it out, or if users just don't see the point
18:01gtrakztellman: https://github.com/pallet/ritz/blob/develop/debugger/test/ritz/jpda/disassemble_test.clj#L90
18:02ztellmangtrak: thanks, I'll take a look
18:02gtrakztellman: the eclipse disassembler implementation, it's a mess of visitors as you'd expect
18:02ztellmanI don't really need anything more than the pretty-printed version right now
18:02ztellmanit was more out of curiosity
18:03gtrakyea, I'm willing to work on it, messing with the DynamicClassloader in the agent would be the next step, I think, but I'm not sure how hard it is.
18:04gtraktechnomancy: did you get anywhere with lein agent support?
18:04technomancygtrak: yeah, it's in 2.2.0
18:04gtrakah, I'll take a look
18:08gtraktechnomancy: it's not jumpting out at me, can you give me a pointer?
18:09gtrakah, I see it now :-) :java-agents
18:11tomjackglad to see the array perf mystery solved :)
18:12tomjackI had just looked at the commits in master a minute ago to see what the heck got fixed since 1.5, and was baffled
18:12dnolen_tomjack: many perf mysteries solved at once
18:12dnolen_I've been scratching my head at why core.match / logic got slower for months
18:17brehautcool
18:17brehautwrong window
18:18gtrakztellman: if you've got any comments about my arrays of structs stuff, I would love to flesh that out, too, still just a toy, but I think I could implement it both on top of sun.misc.Unsafe and ByteBuffer.
18:19ztellmangtrak: where is this?
18:19gtrakon github.com/gtrak/knr
18:20gtrakhere's usage: https://github.com/gtrak/knr/blob/master/src/knr/core.clj#L136
18:21ztellmanhttps://github.com/ztellman/vertigo has unsafe/bytebuffer stuff
18:21ztellmanI wasn't aware of your project, actually
18:21gtrakoh, ha
18:22gtrakit was a post-conj sort of proof-of-concept, just to explore the possibility.
18:22ztellmanyeah, took me a while to get around to it
18:23ztellmanmine tries to make the resulting data-structure indistinguishable from a normal clojure sequence
18:23ztellmanbut with special high-performance accessors
18:24gtrakah, that sounds pretty useful. I was starting to feel a mismatch and felt a need to carry around some type information in a macro, are you doing stuff like that?
18:25gtrakI'll dig in sometime
18:26ztellmangtrak: clojure's compiler barfs when you add a tag that's not a class, so I compromise with a metadata keyword that can be resolved at compile-time as a valid struct
18:26ztellmanworks surprisingly well, even if the code that figures it out is a bit ludicrous
18:26gtrakalso, do you handle n-dimensions?
18:26ztellmanyeah, array is variadic
18:26ztellmanI should make that clear in the docs
18:27gtraksweet, I'll definitely check it out
18:27ztellmanoddly, I'm not seeing a very big performance difference between direct bytebuffers and unsafe
18:28ztellmanmaybe the jit's just that good, though
18:28gtrakyea, I read somewhere that hotspot can avoid bounds-checks in most cases
18:30gtrakstill, it's nice to have a good interface to it. I think it makes a good case for lisp. high-level better than java, low-level better than java.
18:31ztellmangtrak: yeah, I'm playing around with a core iteration/reduction abstraction right now
18:31ztellmanonce that's there, you get some pretty nice compile-time guarantees in terms of correctness
18:31ztellmancertainly more than java could when using byte-buffers, let alone unsafe
18:39futileI like ##((juxt get dissoc) {:a 1 :b 2} :a) in theory, but haven't found a good use for it yet.
18:39lazybot⇒ [1 {:b 2}]
18:40gtrakcould use it in a reduce
18:41futileHow?
18:41clojurebotwith style and grace
18:41futile<3
18:41futile(inc clojurebot)
18:41lazybot⇒ 28
18:41gtraksay you want to pop off stuff every iteration and keep track of the last element in your accumulator :-)
18:42gtrakdon't know why you would want to do it, but that's a situation where I might come up with that solution
18:42futileI think I needed that once.. and asked about it on the mailing list...
18:42futilehmmm
18:44futileOh! https://groups.google.com/d/msg/clojure/59anbc5Md9g/CcP0CJ98RecJ
18:45futileI bet it could be used for that.. somehow
18:46gtrakfirst arg is the accumulator, which can do anything you want. difference between reduce and a loop is you don't get arbitrary control-flow.
19:43Morgawrs'up guys, I'll ask once again hoping for a helping hand. I have a ClojureScript library I am developing, this library uses a .js file for some native code (using :libs in project.clj). I package this library as a .jar with :jar true and built with "lein install". When I require the library in my other project that uses it, however, it can't find the .js native stuff. How do I package a javascript file with a clojurescript library?
19:45tomjackpresumably :libs is something cljsbuild looks for?
19:46Morgawrtomjack: :libs is something used to include javascript files that are google closure compliant (aka with a goog.provide("namespace.name")) so you can require and refer them as if they were native code inside your clojurescript code
19:46Morgawrthe problem is that I can't get to package the .js file with my library as a .jar (inside the .jar there's all the .cljs files)
19:46tomjackyou think if the js file is on the classpath, it will work for the user?
19:46Morgawrif I copy over the .js file and then add it to the project as :libs manually, it works
19:47tomjackall you'd need to do is tell leiningen to include it in the jar
19:47tomjackmaybe :resource-paths ["foo/bar/baz.js"]
19:47tomjackoh
19:47tomjackright
19:47tomjacknevermind
19:48tomjackeven if it's in the jar AND libs are looked for in the classpath, the user would still have to specify the lib manually, huh
19:48Morgawryes
19:50tomjackseems like you'd need an enhancement to cljsbuild
19:50Morgawrmmm
19:50MorgawrI think the problem is
19:51tomjacklooks like :libs does look in the classpath
19:51Morgawrwhen you package a .jar, I'm not entirely sure how it works but it seems to just take all the cljs source files and put them together (doesn't even respect directory structure) but the original project.clj is still there (with relative path references). It doesn't take the compiled .js of the library, it requires the user to re-compile everything together
19:51Morgawrthis means that the end-user has to specify the .js file as well
19:52MorgawrI'm just confused as what's the point of compiling a library if you're just redistributing a .jar with the non-compiled files
19:53tomjackmakes sense to me to distribute non-compiled files
19:53tomjackthis is what we usually do in clojure
19:54Morgawryes, I know but then I don't really know how to deal with this corner case if packaging some native javascript as well
19:55Morgawrall I've seen online is how to use javascript in a clojurescript project or how to refer to clojurescript libraries from javascript, but never how to use hybrid javascript + clojurescript packaged together
19:55tomjackit looks like maybe clojurescript itself could use an enhancement like this
19:56tomjackhmm, probably not though
19:56tomjacknot sure how it could work, but I don't think it does :)
19:57futilephew
19:57futileDoes your ClojureScript part of your web app usually live inside the Clojure web app itself, as a subdir? Or is it its own proj?
19:58tomjackMorgawr: you already tried just writing it in cljs with js interop, and found that to be too slow?
19:59Morgawrtomjack: I have tried working around with it and trying to write it with JS interop but it's just too big of a module itself to be elegant, it's better to just write it in Javascript. I mean, if nothing else works I can try re-write it like that but it would be pretty ugly and hackish
19:59tomjackotherwise it doesn't seem so bad to me that users will have to add :libs as long as you put that in your readme, until someday maybe something better works
19:59Morgawrin the end it's just a composite function that would look more elegant as a single javascript block (I know, Javascript and elegant don't go well together but this way it's just easier)
20:00Morgawrthe problem is that it's not just :libs, they also have to download the .js file and add it themselves to their classpath
20:00Morgawr(not much of a deal but still)
20:00tomjackno, you should be able to get the js file on the classpath
20:00Morgawrmmm
20:00Morgawrlet me try it out
20:00tomjackjust stick it in the same places as your cljs files for example
20:01tomjackthen I _think_ :libs ["your/ns/blah.js"] should work for a user
20:01tomjackat least there is code in closure.clj which appears to be searching for :libs on the classpath
20:03tomjackor you could have src/js/your/ns/blah.js alongside src/cljs and have :resource-paths ["src/js"] :source-paths ["src/cljs"] in your library's project.clj, or something like that
20:04Morgawrgiving it a go right now, will report back, thanks :)
20:09CapnKernulso happy to now have used cartesian-product in a real project. :)
20:12Morgawrtomjack: how do I make sure to package the .js file inside the .jar along with the rest of the .cljs files?
20:13tomjackeasiest way would be to put it in the same place as your cljs files
20:13tomjackotherwise :resource-paths ["src/js"] :source-paths ["src/cljs"] like I said above
20:14tomjacker, hmm
20:14Morgawroh yeah
20:14MorgawrI added it as :source-paths
20:14tomjackdunno if it makes sense to put cljs on your source-paths
20:14tomjackcljs + leiningen + cljsbuild is all pretty confusing
20:14Morgawrputting it in the same places as the cljs files gave me troubles because lein didn't see it in the classpath, no idea why but I think it's cleaner this way, let's see if my other project sees it
20:15tomjackwell if you put it in the same place as your cljs files, you need to include the path in :libs
20:16tomjacklike if it's src/your/ns/blah.js, you need :libs ["your/ns/blah.js"]
20:16tomjack(which is good, you probably don't want a blah.js sitting at the root of your jar)
20:16Morgawrheh, I tried that but it printed an error saying it was missing a goog.provide
20:17Morgawranyhow, I'll keep testing
20:18tomjackhmm, hope I didn't give you misinformation
20:18Morgawrtomjack: do I need to use :libs ["myns/myfile.js"] or ["src/cljs/myns/myfile.js"]?
20:18tomjackthe former
20:19tomjackbut that will only work if src/cljs is in your classpath via :source-paths or whatever
20:19Morgawryes yes, it works, at least the library compiles
20:19cneira.
20:19Morgawrnow I need to figure a way to get it to work in my other project
20:20tomjackif you see the .js in the jar as myns/myfile.js, I'd expect it to just work with the exact same :libs in the depending project :)
20:20cneiraanyone has used oop in clojure , i know is about fp ,but we have protocols & defrecord
20:20technomancycneira: don't use protocols if you are just getting started
20:20Morgawrokay so, inside my .jar I have "myns/native/myfile.js". from the other project I have :libs ["myns/native/myfile.js"] but it still can't find it :(
20:21TimMccneira: OOP and FP are overloaded terms. By various interpretations, Clojure is both.
20:21Morgawroh.. wait
20:21MorgawrI'm an idiot, I was referring the wrong namespace
20:22cneiraTimMc , great i have trouble doing some uml class diagram using clojure , is there any good read about oop in clojure ?
20:23Morgawrthe O'reilly book about Clojure is pretty great
20:23Morgawrnot sure about OOP specifics though
20:23Morgawrit does treat protocols and all of that
20:23technomancycneira: you don't need it
20:29ianeslickAnyone have trouble getting nREPL to startup using lein run and an explicit command in the main function? It runs without error, but then doesn't create a socket...
20:33pandeirois the only way to ensure that a lein project uses a particular version of clojure to use :exclusions [org.clojure/clojure] in any deps that include clojure?
20:33technomancypandeiro: as long as no one uses version ranges, your version will win
20:33technomancyyou can use `lein deps :tree` to see if any version ranges are screwing with you
20:33tomjackO_o
20:34tomjackis there a good reason version ranges can screw with you or some impl problem?
20:34pandeirotechnomancy: version ranges have a particular syntax? i'm not noticing any
20:34technomancytomjack: http://nelsonmorris.net/2012/07/31/do-not-use-version-ranges-in-project-clj.html
20:35technomancypandeiro: they can affect you transitively
20:35tomjackbasically it's maven's fault?
20:35technomancymore or less
20:36technomancythough actually-justifiable uses of version ranges are extremely rare
20:37Morgawr,(inc tomjack) ; I hope I did it properly :S
20:37clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: tomjack in this context, compiling:(NO_SOURCE_PATH:0:0)>
20:37Morgawr(inc tomjack)
20:37lazybot⇒ 1
20:37Morgawrokay lol
20:37Morgawrthanks tomjack, now my library works! :)
20:38tomjacknice, what is it?
20:38Morgawrbasically, first I had to put the .js with all the .cljs files (I created a directory in the src/cljs subtree as "native" to separate .js code from .cljs)
20:38Morgawrthen I used proper goog.provide and requires in my cljs files
20:38Morgawrand wrote a cljs file with wrapping for functions (just to keep it sane)
20:39Morgawrin the end I just added the :libs ["myns/native/myfile.js"] in the other project
20:39Morgawrit's not the best option (Something automatic would be great) but at least it works now
20:39MorgawrI'll leave a note in the readme for my library
20:40MorgawrI really need to write a blog post or something about this because I've been looking around the web for hours and nobody seemed to have the same problem I had. Either it was something very very easy and I didn't realize it or it's a specific corner case nobody really considered before (or didn't care about documenting it)
20:41pandeiroi'm not sure how to recognize version ranges; do i need to see the project.clj of each dep?
20:42technomancypandeiro: `lein deps :tree` will tell you if any are present
20:42technomancyit's hard to miss
20:42pandeirohuh.. i'm going blind...
20:42pandeiromy project.clj - http://sprunge.us/OBgX?clj
20:42pandeirolein deps :tree - http://sprunge.us/OVXi?clj
20:43technomancyit didn't warn you, so there are none
20:43pandeirofor some reason when i create a repl with that project.clj, instead of 1.5.1 i get clojure 1.4.0
20:43pandeirobefore i explicitly excluded clojure from enlive it was trying to use 1.2.0
20:46tomjackclutch?
20:46pandeiroso back to my original question
20:46pandeiroi gotta explicitly exclude clojure from any project that depends on it
20:46tomjackdunno why it would be winning..
20:46pandeiroif i want to use a specific version?
20:48ZamarokCan I use clojure.core/range to produce an infinite sequence like {0, 20, 40, 60, 80, ...}?
20:49ianeslicktechnomancy: Is there an obvious reason I might be missing why nrepl wouldn't launch in production?
20:49justin_smithZamarok: ,(take 4 (map (partial * 20) (range)))
20:51Zamarokjustin_smith: right, but range can't do it? It seems like a very basic thing that someone would want to do with a range function
20:52justin_smithoh, yeah, now that you mention it
20:52justin_smith(range 0 80 20)
20:52amalloyjustin_smith: that's *almost* infinite
20:52justin_smithheh
20:52amalloy,(range 0 Double/POSITIVE_INFINITY 20)
20:52clojurebot(0 20 40 60 80 ...)
20:52Zamarokthere we go, thanks amalloy
20:53hyPiRion,(let [range iterate] (range #(+ 20 %) 0))
20:53clojurebot(0 20 40 60 80 ...)
20:55amalloyclojurebot: show hyPiRion the door, please
20:55clojurebotthat will show you what jars (including the clojure jar) leiningen is using
20:56hyPiRionamalloy: you're doing it wrong
20:57hyPiRion~guards
20:57clojurebotSEIZE HIM!
20:57ianeslickclojurebot is such a hoot
20:57amalloyhyPiRion: i'm just going to talk to clojurebot as if he were intelligent, and see how often his responses make sense
20:57hyPiRionclojurebot: the door is <reply>the door will show you what jars (including the clojure jar) leiningen is using
20:57clojurebot'Sea, mhuise.
20:58hyPiRionHe's on a completely different level of intelligent than what we are, though
20:59metellus~gourds
20:59clojurebotSQUEEZE HIM!
20:59hyPiRion,(->> 1 repeat (reductions +) (reductions +) (reductions +))
20:59clojurebot(1 4 10 20 35 ...)
21:00pandeirois there somewhere i can read about how lein determines which version of clojure to use?
21:01RaynesWhatever is in your project.clj.
21:03pandeiroRaynes: did you see my links above by chance? i posted my project.clj and lein deps :tree but lein repl doesn't give me the version i'd expect
21:03RaynesI did not. One moment
21:04amalloyhyPiRion: i don't really understand what that's doing. there should be a simple formula for the nth element of that sequence, but what is it? i think it's computing...the sum of the first N triangle numbers, basically?
21:04Raynespandeiro: Interesting.
21:04Raynespandeiro: It looks like clutch is causing it to ignore your Clojure version for some reason.
21:04Raynespandeiro: Try doing an :exclusions on clutch as well and see what happens?
21:05pandeiroRaynes: yeah ok, one sec
21:07amalloyhyPiRion: yeah, that's it. apparently that's called a tetrahedral number, and the nth element of that sequence is (* n (+ n 1) (+ n 2) 1/6)
21:07pandeiroweird. now i'm back to using 1.2.0 or 1.2.1 apparently
21:07pandeirojust get an error about mapv not existing
21:07pandeirothis is the same thing that was happening before i used :exclusions on enlive
21:07pandeirothe project name 'clj' wouldn't be interfering right?
21:10pandeiro...but when i comment out overtone, for some reason, everything works
21:14tomjacksweet, I guess correctly http://oeis.org/wiki/Simplicial_polytopic_numbers
21:14tomjackdidn't guess "polytopic" though
21:14tomjack(+ tomjack 1/2)
21:15pandeirook it's something very weird and non-deterministic or something... i am going to assume pebcak and return later
21:23fremis there a built in function that does the same thing as (fn [x] x) ?
21:24fremI'm on this bit in clojure koans, and my solution seems slightly silly. https://github.com/functional-koans/clojure-koans/blob/master/src/koans/10_lazy_sequences.clj#L23
21:24tomjack$findfn :foo :foo
21:24lazybot[clojure.set/union clojure.set/intersection clojure.set/difference clojure.core/time clojure.core/dosync clojure.core/doto clojure.core/macroexpand-1 clojure.core/or clojure.core/comp clojure.core/-> clojure.core/macroexpand clojure.core/max clojure.core/identity clo... https://www.refheap.com/15937
21:25tomjack:)
21:25tomjackfrem: it's identity
21:25tomjack&(max :foo)
21:25lazybot⇒ :foo
21:25tomjacknice
21:26fremthanks!
21:26tomjack,(doc find-keyword)
21:26clojurebot"([name] [ns name]); Returns a Keyword with the given namespace and name if one already exists. This function will not intern a new keyword. If the keyword has not already been interned, it will return nil. Do not use : in the keyword strings, it will be added automatically."
21:26tomjackI have never seen this before
21:26tomjackhow very odd
21:27tomjackutterly baffling
21:28tomjackwhat possible use could that have?
21:28amalloytomjack: it was probably more useful back before keywords got GCed
21:29amalloyso that you could find out whether keywordizing user input would cause you to use up more permanent space? i'm not sure tbh
21:29tomjackso you could, what, throw an error?
21:30tomjackit looks like it could be used to set up an closed set of keywords in a particular ns
21:30tomjackthen avoid extra interns
21:30tomjackvs keyword-izing and then checking a set of acceptable keywords
21:31tomjackI guess that would have made sense back then
21:31amalloyfwiw, find-keyword isn't used anywhere in clojure.core
21:32tomjack&((comp comp comp) 42)
21:32lazybot⇒ 42
21:40brehaut,(comp 42)
21:40clojurebot42
21:40brehauti guess that makes sense?
21:43tomjackwould be interesting if (comp) were comp
21:44tomjack..not really
21:46amalloybrehaut: i think that was added because some folks were made that (comp f) and (partial f) just blew up, rather than the "obvious" strategy of "just return f"
21:46amalloyeg, in situations like (apply comp fs)
21:46brehautamalloy: sure, just slightly surprising when its used on a non ifn
21:47brehautyay types i guess
21:47amalloysure, but that's dynamic typing for you
21:47brehautyeah
21:47brehauti for one welcome our core.typed overlords
21:47amalloyyou would, you dirty type-sympathizer
21:48brehautlol
21:49tomjackI never thought about the fact that there should be working clojure programs which won't typecheck
21:50brehauttomjack: thats the fundamental argument of dynamic languages ;)
21:50brehautwell, that those programs are simpler than the checking one and that that simplicity is a win
21:51tomjackI'd love to see real examples of that
21:51tomjackruling out comp-as-identity obviously is a win for core.typed
21:51tomjack
21:51brehautring is pretty damn hard to typecheck
21:51brehauteven with a type system as flexible as core.typed
21:52tomjackwell, that's a straw man
21:52brehauthow so?
21:52brehautbecause it was written for a dynamic language?
21:52TimMc&((((comp comp) ((comp ((comp comp) (comp comp))) (((comp) comp) comp))))()) ;; brehaut
21:52lazybot⇒ ()
21:52brehautoh, i thought you ment ring
21:52tomjackyeah, seems you need to compare to an 'equivalent' program in say haskell
21:53amalloy$mail dnolen is your "seqable" article findable anywhere now that posterous isn't serving it?
21:53lazybotMessage saved.
21:53brehauttomjack: the equivalent program would, IMO, be a writen using a unitype
21:53tomjackthat doesn't seem like a useful comparison then
21:53brehautwhich would jsut make it a long winded version of the same thing
21:53brehautwell of course
21:53brehautthat the crux of the debate
21:54brehautif you have to write a different program, its very hard to compare, but if you didnt have to, there wouldnt be an arguement
21:54brehautpersonally, as much as i appreciate category theory types and type checking, theres very little in the existing haskell web frameworks that i would prefer over ring, so thats good enough for me
21:55tomjackhmm, I guess I don't know what the claim is then
21:57tomjackbut that last thing you said makes sense
22:00brehauti find it ironic that SPJ, someone so good at types, is so bad at type; trawling through all this comic sans hurts
22:00brehauthttp://cucats.soc.srcf.net/files/Escape%20from%20the%20ivory%20tower%20Feb12.pdf page 69 and 70
22:01brehautThe Region of Abysmal Pain
22:04tomjackweb programming is in there?
22:04brehautit seems so
22:05tomjackI was talking with a friend earlier today about the possibility of an Agda successor which has "the Joyful Properties"
22:05tomjackI hope someday..
22:16tomjackhah "envy/ideas"
22:39tomjackdnolen_: experimenting with logict using core.async https://www.refheap.com/6f7acfecd6c1ca0ce50974945
22:40tomjackunfortunately at this point I've realized the whole point - failing faster on conjunction - doesn't make sense to me in a general logict context
22:40tomjackI mean, conjunction doesn't seem to make sense
22:42tomjackor maybe it does and I just don't see it yet, but I think you have to bake in the idea that the success chans receive substitutions, which I don't quite see how to square with some of the logict stuff
22:42tomjackin this approach you pass a success chan into a goal, and it returns a fail chan which just closes when it fails
22:42tjb1982can someone help me understand how to install light table on linux (arch)?
22:45tomjacks/when it fails/when there are no more successes/
22:45tomjackwhich I just realized is a nice fit w/ go
22:52tomjackI guess I should have tried implementing msplit before deciding this approach was workable..
22:53tjb1982ibdknox: I'm having problems installing Light Table for linux. The package doesn't look like what I'm used to. Can you help me out?
22:54tomjackyou don't have to install it
22:55tomjackyou can just extract the tar.gz and run it
22:58tjb1982It's complaining about "error while loading shared libraries: libudev.so.0: cannot open shared object file: no such file or directory"
22:58tjb1982tomjack: ^
22:59tjb1982I see libudev.so.1 in /usr/lib/ but not .0
23:00tomjack$google light table "error while loading shared libraries: libudev.so.0"
23:00lazybot[Light-Table-Playground - GitHub] https://github.com/Kodowa/Light-Table-Playground/issues/161
23:01tomjackseems maybe relevant?
23:02tjb1982that workaround looks like it should do the trick
23:04tjb1982it generally isn't a good idea to symlink different versions of libraries (as one commenter said)
23:06tomjackI think maybe another workaround was suggested that shouldn't affect the rest of your system
23:06tomjackdidn't look too closely
23:07tjb1982I see a script that should work here https://gist.github.com/rickeyvisinski-kanban/4559886
23:07tjb1982thanks for your help, btw
23:09tomjackI don't know whether to be mildly annoyed or screaming in pain
23:10SegFaultAXtomjack: Raynes doesn't know his own strength...
23:11tjb1982I' just glad you're not referring to me
23:11tjb1982hoping anyway
23:12tomjacktjb1982: no :)
23:17tomjackI retract my last refheap :(
23:20bluegatorhello all
23:20bluegatora newbie to clojure
23:21bluegatori am*
23:21bluegatori installed la-clojure in intellij, want to know how i can execute lein commands from within intellij
23:22bluegatorfor e.g., lein run
23:22akhudekbluegator: there is a leiningen plugin that does that, but I always just use the terminal anyway
23:23bluegatorgotcha..
23:23bluegatorthanks man
23:23bluegatoralso am new to emacs
23:24bluegatordoes anyone recommend emacs over intellij for a newbie?
23:24bluegatorif so, is there a particular emacs (on mac-os) that is recommended?
23:25akhudeki think the general consensus here is that emacs is the best piece of software that exists, for any purpose. I still use la clojure myself though.
23:25akhudekdefinitely worth learning if you interested in it!
23:25tjb1982emacs is great if you put in the effort
23:25akhudekemacs that is
23:26brehauttheres merit to not trying to learn two foreign things at once thoguh (emacs, fp/clojure)
23:27CaptainLexbluegator: I can't recommend from personal experience, but I do know my professor used aquamacs
23:27bluegatorthx for the advice fellas
23:27bluegatorprobably two new things at once might be hard to digest
23:27akhudekbrehaut: I will use that as an excuse next time I am asked about it. I am always reading ml/papers and cannot learn two complicated things at once!
23:27brehautif you do want emacs for os x, then http://emacsformacosx.com/ is the preferred place to get a build from
23:28brehaut(the system one is exceedingly decrepit, and for emacs thats really saying something)
23:28CaptainLexbluegator: If you don't mind a bit of frustration, you can learn emacs at your own speed. It has most normal functionality as well as the kooky stuff
23:29bluegatorthx for the link brehaut
23:29bluegatorlex, makes sense, will take it in bits and pieces
23:29CaptainLexThat said, if and when you get hooked on keyboard shortcuts instead of the mouse, try to learn those all at once
23:30CaptainLexit's very befuddling to be able to navigate part of the way on the keyboard, but have to use the mouse to finish it off
23:30bluegatortrue that
23:30bluegatorjust saw this: http://overtone.github.io/emacs-live/
23:30bluegatorany opinions/comments on emacs live?
23:31CaptainLexOooh, I've never heard of it, but I do love these kinds of things
23:31akhudekheard good things about it
23:31amalloyCaptainLex: last i checked rhickey uses aquamacs. i guess he can get away with it, but it's crazy
23:33CaptainLexamalloy: Is it now? I only saw it in action vaguely, and only for basic purposes. I've been using LT for my clojure work, so I don't know nothing from nothing in emacs these days :P
23:33ddellacostaI used emacs-live a little, but found that it had too much magic out-of-the-box which drove me nuts…to me it represents a specific person's .emacs setup
23:33bluegatorLT?
23:33clojurebotfilter is not map
23:33brehautlight table
23:33bluegatorgotcha
23:33brehautelucidating as always, clojurebot
23:34ddellacostabut, worth checking out if you are an emacs user
23:34ddellacostaif you are a *beginner*, not sure I would recommend it
23:34brehautthe emacs-starter-kit is a relatively gentle introduction to emacs for dynamic languages
23:34ddellacostaI suspect that if I had spent some time configuring it a bit, I would have enjoyed it more
23:35ddellacostaI recommend learning basic movement in both emacs and vim, and breaking oneself of any desire to assume one is better than the other. But that's a different discussion I suppose.
23:35amalloyCaptainLex: aquamacs apparently differs in so many interesting ways that the bots in #emacs have this canned response: "Because of how Aquamacs departs from conventional Emacs in terms of features, codebase, and stability, no one supports it here. Try #aquamacs"
23:36brehautits like xemacs of the future
23:36CaptainLexamalloy: That is impressive! Thanks for the info!
23:36RaynesIt's like the devil, brehaut.
23:36RaynesThe devil.
23:36brehautRaynes: didnt i just say that?
23:39ddellacostaI'm getting clojure.tools.namespace.repl complaining about CLJS-related namespaces, but can't seem to tell it to ignore my cljs namespaces…any best practices for using c.t.n.r w/CLJS?
23:56derek_chello guys, can someone tell me what does *variable-name* mean>
23:56derek_c?