#clojure logs

2015-02-06

00:19mercwithamouth.
01:08justin_smithgfredericks: remind me not to tell you about the lazybot logs
01:10arrdemjustin_smith: I'm sure gfredericks' secrets are safe with you, _amalloy, _raynes and the NSA
02:04julianlevistonDoes anyone know: 1. If a new version of Joy of Clojure is imminent covering 1.7 and also 2. If purchasing it from Amazon entitles one to an eBook version?
02:05julianlevistonunfortunately, the website is substantially lacking in an explanatory outlook of what might be somewhat of a plan for the inevitable future of the series...
02:07justin_smithjulianleviston: considering 1.7 isn't even released yet, I doubt JoC covers it - writing a book takes a non-negative amount of time
02:08justin_smithjulianleviston: err, misread, never mind!
02:08expez:db/id #db/id[:db.part/db] <- what does this literal notation mean in datomic schemas? Is this simply how you tell datomic to fabricate an id for you?
02:10justin_smithexpez: yeah, that tells datomic to generate a unique id
02:11expezjustin_smith: cool, thanks
02:11julianlevistonexpez: looks a bit confusing on first blush, doesn't it.
02:12justin_smithit starts with # as with all other tagged readers
02:12justin_smith,(java.util.Date.)
02:12clojurebot#inst "2015-02-06T07:09:56.927-00:00"
02:13expezjulianleviston: yeah, they could've had some suger for that like :db/id :auto as this is it looks like this is used almost always
02:13justin_smithexpez: usually you don't want :db.part/db though - that is only for db internal type stuff
02:13justin_smithfor a user field you wouldn't use it
02:14expezI just started looking at datomic so I still have a lot of docs to read :)
02:15justin_smithexpez: I found it really helpful to read the alice db book from inria
02:15mercwith`ping?
02:15clojurebotPONG!
02:15justin_smith(it's a free pdf on database systems theory that covers datalog)
02:16mercwith`justin_smith: what pdf would that be?
02:16justin_smithmercwith`: the inria alice book pdf
02:16expezmercwith`: http://webdam.inria.fr/Alice/
02:16justin_smith$google inria alice book pdf
02:16lazybot[Foundations of Databases - Inria] http://webdam.inria.fr/Alice/
02:16mercwith`sweet
02:16justin_smithI won't claim I understand everything in there - but I learned a lot from it
02:17expezjustin_smith: I've had that book on my shelf for a while, just needed an excuse to move it to the top of the pile. Thanks! :)
02:17justin_smithheh
02:17justin_smithphysical copy?
02:17expezyeah
02:20mercwith`any datomic aficionados her?
02:20mercwith`here*
02:20mercwith`no real questions..i'm just watching a few talks on it tonight...
02:21julianlevistonmercwith`: I'm a fan… definitely by no means an afficionado tho
02:21mercwith`julianleviston: can you think of any projects it would be used for...outside of like banking, etc
02:22expezWhat is going to limit write performance first? The write bandwidth or the size of the existing store which has to be re-indexed?
02:22mercwith`or transactions, etc
02:22julianlevistonmercwith`: hehe… actually I'm building the version-after-next of my current project with it.
02:22julianlevistonmercwithamouth: and it would have been very handy at my last job...
02:22mercwithamouthhmm what project would that be?
02:23julianlevistonmercwithamouth: where we were building a system that aggregated fuel data for the mining industry (in australia)
02:23mercwithamouthok gotcha
02:23julianlevistonmercwithamouth: the current project is a content management system.
02:23mercwithamouthsee it makes sense for stuff like that....though for like 'in home' projects...nothing comes to mind
02:23mercwithamouthdefinitely useful though for stuff like that
02:24julianlevistonmercwithamouth: it's useful anytime you don't want to lose data… which to my mind is pretty much any time you want to do anything useful with a database.
02:24julianlevistonmercwithamouth: if you haven't seen it, check out gracefulplace
02:24mercwithamouthi suppose...
02:24julianlevistonmercwithamouth: what is the sticking point? Is it the accretive nature that is discombobulating you?
02:25mercwithamouthno, not at all. lack of ideas...lol
02:26mercwithamouthand warranting the expense for keeping that much data on hand
02:26julianlevistonmercwithamouth: you don't know why you'd use a database?
02:26julianlevistonmercwithamouth: what's the expense?
02:26mercwithamouthi would think that if you're holding multiple versions of a database...you'd need space to hold each version?
02:27mercwithamouthor is it more so like git?
02:27julianlevistonmercwithamouth: isn't that particular conversation going to go a similar way to never changing data structures in memory? (aka persistent data structures). Turns out it's actually MORE compact most of the time, no?
02:28mercwithamouthpossibly...consider me a newb.
02:28mercwithamouthi'm more of a hobbyist developer
02:28julianlevistonmercwithamouth: because of not having to create things you don't use (ie smallest item is a datom, which is a single fact) as averse to the row… which is kinda big… efficiency-storing-algorithms put somewhat aside.
02:28mercwithamouthi haven't had the opportunity to run into such issues yet
02:28julianlevistonmercwithamouth: you should def watch RH's intro
02:29mercwithamouthnext...i played it once though i'll admit i was moving around the room during it
02:29julianlevistonmercwithamouth: he addresses most of the arguments one can think of as being somewhat challenging.
02:31mercwithamouthok..i'll take a look tonight
02:33julianlevistonmercwithamouth: including what I think is possibly the coolest part about datomic: that your code contains an opaque server, and that these servers are small because they don't have to do everything, so queries are stupidly fast. The architecture of it is pretty nice, to say the least.
02:33mercwithamouthhmm thats actually interesting...
02:33mercwithamouthnow lets talk 'cost'...should i make something i wanted to release...
02:34julianlevistonmercwithamouth: it reminds me a lot of the same principles as the ref types… except scaled to a different level.
02:39julianlevistonmercwithamouth: there are free, pro starter or pro versions. For anything you're probably going to use, you probably won't have to pay. It's really inexpensive. http://www.datomic.com/pricing.html
02:41mercwithamouthjulianleviston: true..but should i do make something useful...i suppose it pays for it's self
02:42julianlevistonmercwithamouth: well the pro starter comes with 2 peers and a transactor… that's a fair amount of power.
02:42julianlevistonmercwithamouth: and that's free...
02:42justin_smithfree as in beer
02:42mercwithamouthok, maybe i'll toy with it along with postgres when/if an idea comes to me
02:43mercwithamouthok the virtual database feature is cool...
02:43julianlevistonmercwithamouth: I'm building a CMS platform that will technically be able to serve thousands of websites and the pro starter will probably be ok for me… however if I get to the point where I have even hundreds of sites, I'll probably send some cash their way…
02:43julianlevistonmercwithamouth: it has a different definition of what a database is… by the way… :) but you probably knew that…
02:45julianlevistonmercwithamouth: the 5 -> 8 proc version is like $3300 perpetual license and $1500 per year optional maintenance… that's pretty darn cheap.
02:45julianlevistonmercwithamouth: if you're making something that needs more than 3 procs, then you can prolly afford $3300 ;-)
02:45mercwithamouthlol i suppose so =P
02:46mercwithamouthok well then..there's no reason NOT to familiarize myself with datomic...fine fine.
02:46mercwithamouthany books on the way for it? i'd assume so, it seems popular enough...in the next year or two
02:47julianlevistonmercwithamouth: I don't know.
02:47mercwithamouthwith that said..there's plenty of info out there as is
02:47mercwithamouthwhat was your project again? are you on github?
02:47mercwithamouthgraceful place
02:47julianlevistonmercwithamouth: yeah, the main doc site had more than enough info for me to understand it… and the grateful place and another github repo I forget now has more than enough info on implementing it.
02:48julianlevistonno that's not me.
02:48julianlevistonhttp://gratefulplace.com
02:48mercwithamouthgrateful**
02:48julianlevistonMy site is http://getcontented.com.au/
02:48justin_smithmercwithamouth: last I asked about books the answer was no datomic books, but there is the free inria alice book on datalog
02:48mercwithamouthoh! ok i've been here....
02:49julianlevistonmercwithamouth: but at the current version, it's built in rails and ember…
02:49julianlevistonmercwithamouth: this was helpful to me : http://www.flyingmachinestudios.com/programming/building-a-forum-with-clojure-datomic-angular/
02:49mercwithamouthok, cool. yeah i toyed with rails for a few years as well off and on
02:49julianlevistonthat's the guy talking about grateful place
02:50mercwithamouthsweet...going through it now.
02:50julianlevistonmercwithamouth: I programmed with rails professionally for years. It's kind of a bad toy.
02:50mercwithamouthi've been toying with OM for the last few days but i've touched angular as well
02:51mercwithamouthlol...i like rails but get annoyed when gems act crazy and you have to do a lot of digging around. the benefits outweigh the annoyance though for getting something up and running quickly
02:51julianlevistonmercwithamouth: yeah Om is what I'm using to rewrite my app in :) from Ember…
02:51julianlevistonmercwithamouth: it's so good.
02:52mercwithamouthyou like OM? seems cool
02:52julianlevistonmercwithamouth: and all the next set of stuff facebook are doing is only making it better (react native, for example)
02:52mercwithamouthyeah! i saw that speech earlier this week...react native
02:52julianlevistonmercwithamouth: not to badmouth Rails too much, but I really don't like the way things are hidden so much from the programmer… and there's so much "magic" and a lot of it is kind of bad… like the whole ActiveRecord ORM thing. ORMs are potentially dangerous.
02:53julianlevistonmercwithamouth: turns out if you want to do something serious and efficient in it, you have to strip large chunks of it away, and you may as well have not use Rails in the first place.
02:54mercwithamouthEXACTLY.
02:54mercwithamouthi didn't want to come out and say it...but...i loved rails until i really got into it and it's easy to get lost when something doesn't work as expected
02:54julianlevistonmercwithamouth: having said that, it's good that it's there, and it greases the wheels from a whole set of PHP devs to be aware of better industry practice, and then discover even better things...
02:54mercwithamouth...you dare mention PHP?
02:55julianlevistonmercwithamouth: :) everything has its place.
02:56mercwithamouthi'm biased...plus i've picked on php for too many years. i wouldn't dare touch it and get caught doing so by my friends.
02:56julianlevistonmercwithamouth: what about if you just wanted to add a few snippets of server side processing? you'd spin up python or ruby or java for that?
02:57mercwithamouthyes.
02:57julianlevistonmercwithamouth: purist! :P
02:57mercwithamouthi recall...outdoing php with just xslt once
03:00julianlevistonhehe… and now I have to go write some swift…
03:01acron^morning
03:01julianlevistonacron^: hey! :)
03:23mercwithamouthjulianleviston: also it seems i can use datomic and later choose to put another db behind it...postgres, dynamo...after the fact?
03:23julianlevistonmercwithamouth: um… not exactly. Rather datomic requires a store of some sort.
03:24mercwithamouthok so i have to choose beforehand.
03:24julianlevistonmercwithamouth: I'm not too sure if you have to choose beforehand.
03:24julianlevistonmercwithamouth: I think it'll store in flatfiles if you don't… not 100% about this, but I think that's how my current version works. You should look this up.
03:25julianlevistonmercwithamouth: yeah, from the front page of datomic.com: Datomic provides rich schema and query capabilities on top of modern scalable storage engines like DynamoDB, Cassandra, Riak and more
03:26mercwithamouthok...great!
03:26julianlevistonmercwithamouth: follow that link and you get a comprehensive list of storage backends: http://docs.datomic.com/storage.html
03:26julianlevistonit's very very flexible.
03:26mercwithamouthnoice...
03:27julianlevistonI think there has even been some work to build some frontside datomic like things, too… IIRC… which is really cool.
03:28julianlevistonmercwithamouth: if that's your interest, this could be useful to look at : https://github.com/tonsky/datascript but it all depends what you're interested in.
03:28mercwithamouthhmmm
03:28mercwithamouthvery
03:29mercwithamouthhah! well that answers a question i had about a possible client side only todo list i wanted to make for work
03:29acron^anyone got any experience working with Excel (xlsx) files?
03:29julianlevistonoh god
03:30acron^:((
03:30mercwithamouthlol
03:30julianlevistonacron^: sorry… I just had bad flashbacks… it matters which version… is it the new x format? coz I think that's probably going to be manageable… but the other kind… I'm sure it's well documented now and easier with java libs or something… don't let me dissuade you.
03:31acron^hah
03:31daniel__acron^: they are zip files containing xml
03:31acron^it's the new one... I'm using docjure at the moment but it doesn't quite do what I want it to
03:33julianlevistonacron^: does clj-excel not do everything you need?
03:34julianlevistonhttps://github.com/mebaran/clj-excel
03:34acron^might look at that instead
03:34acron^docjure seems quite basic
04:05expezHow can I view log messages from timbre while working at the repl?
04:07expezwhen I call the code from the repl I see the log messages, but not when I hit the server
04:15clgvexpez: they are logged to a file I guess
04:16clgvexpez: you could add an additional console logger to the configuration
04:17expezclgv: actually they end up in the *nrepl-server <project>* buffer. I had 'nrepl-hide-special-buffers' set to t and I had to restart cider to get that buffer back after changing the variable.
04:18clgvok, I thought you ware talking about a deployed server
04:19expezah, my bad.
04:25luxbockhttps://gist.github.com/luxbock/7226ce0d65d5846ecbbf
04:25luxbockis there a better way to write this?
04:26luxbockthe `eval` inside the defmacro feels wrong, but I couldn't figure out how to do it otherwise
04:26TEttingerwhat should blah->> do?
04:27clgvluxbock: TEttinger: that is a good question
04:27luxbocksame as ->> but it returns a list of the steps for each expression
04:27luxbocki.e. (blah->> 1 inc inc even?) would return (1 2 3 false)
04:28clgvluxbock: this code shouldnt work at all because of the wrong usage of syntax quote and autogensym
04:28luxbockclgv: it works for me
04:28clgvoh wait there is another syntax quote outside. so that saved you ;)
04:29luxbockyeah, this is not for anything serious, I'm just messing around to get better at writing macros
04:29clgvluxbock: ah, so you want all the intermediate results?
04:29luxbockclgv: yep
04:30clgvluxbock: you should be able to enhance "as->" to do that
04:30luxbockhmm, how would that work?
04:30clgvluxbock: in principle you generate statements within a `let` to bind the intermediate results
04:31clgvprobably simpler without looking at let.
04:32clgvluxbock: so you generate something like (let [x1 (f1 ...), x2 (f2 ... x1), ...] (vector x1, x2, ..., xn))
04:32luxbockah I see
04:32arossouwwhen should you use the -> expression?
04:33clgvyou can put that together via map, gensym, interleave, ....
04:33clgvarossouw: when you want to use the result of a calculation in the next one at least twice
04:33arossouwok
04:34acron^is there a way to increase the stack?
04:34clgvarossouw: if you have some computation that is like a pipeline anyway
04:34clgvacron^: sure, there is a jvm flag
04:34acron^I'm using "lein run"
04:35clgvacron^: you can set jvm flags via project.clj
04:35acron^oh awesome
04:36TEttinger,(reductions #(conj %1 (%2 (last %1))) [1] [inc inc even?])
04:36clojurebot([1] [1 2] [1 2 3] [1 2 3 false])
04:36arossouwhttp://paste.linuxmint.com/view/wjkx/ , looks ugly any hints?
04:37TEttinger,(reduce #(conj %1 (%2 (last %1))) [1] [inc inc even?]) ; even this should work huh
04:37clojurebot[1 2 3 false]
04:37arossouwi thought of changing databases to hash-map of sequences
04:37luxbockTEttinger: yeah but this would fail if the arguments are expressions instead of functions
04:38TEttingeryeah, I was just thinking you could assemble it like that
04:39clgvTEttinger: that would not be ideal for the macro
04:40clgvTEttinger: luxbock: using `as->` as inspiration, a very simple and fully functional implementation of the intended macro is easily implemented via generating an appropriate `let` form
04:41luxbockclgv: working on that as an excercise for myself :)
04:41clgvluxbock: that's why I didn't paste any impl ;)
04:41acron^noob question. ...how do I include files other than 'core.clj' in a lien project? I have added a 'util.clj' and added the same namespace but it can't find the function
04:42acron^lein*
04:42Empperiand you have require in place in your core.clj?
04:42clgvacron^: the file just has to be at the appropriate place corresponding to the namespace name. myproj.util needs to be in "src/myproj/util.clj"
04:43acron^clgv: yep
04:43acron^but the namespace is myproj.core as well
04:43acron^does each separate file need a separate namespace ?
04:44TEttingeryes
04:44TEttingerkinda
04:44TEttingermyproj is the equivalent to a package in java, core is the closest thing to a class
04:45TEttingerso you will likely have multiple files in the folder src/myproj/ , with the file name matching the last part of the ns name
04:45acron^I know very little about Java :/
04:45TEttingeryeah clojure has to inherit this inflexible package thing from java
04:45acron^Ok, so I canged the namespace
04:45acron^DO I need a require?
04:46TEttingerin core, yeah
04:46acron^how does that look?
04:46acron^[myproj.util :as util] ?
04:46TEttingercore is your main, so you would have a require section in your ns, usually
04:46TEttingersure
04:46TEttingerthat looks fine
04:47acron^java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Named,
04:47acron^:\
04:47TEttingeroh is that part of an (ns) form?
04:47TEttingerlike
04:48acron^yeah
04:48TEttinger(ns myproj.core :require [[myproj.util :as util]])
04:48TEttingererr
04:48TEttinger(ns myproj.core (:require [[myproj.util :as util]]))
04:48TEttingerI can't remember here
04:48acron^(ns myproj.core
04:48acron^ (:require [clojure.java.io :as io]
04:48acron^ [clojure.string :as cstr]
04:48acron^ [myproj.util :as util]))
04:49acron^oh wait
04:49acron^i got it
04:49acron^sorry
04:49acron^it was something IN my util file :)
04:50TEttingerah!
04:50acron^I look forward to reaching clojure competancy... :p
04:51TEttingeryeah, it's gotten easier with the good resources that are available now
04:51TEttinger4clojure is great
04:51TEttingerhttp://www.braveclojure.com/ is good too
04:51luxbockclgv: https://gist.github.com/3e2e54598946a2d3d2b3
04:51luxbockthis works but I'm not sure if it's the simplest way to do it
04:51luxbockI'm still using reductions, and I can't figure out how I'd do the nesting without it
04:52clgvacron^: please use something like refheap.com
04:52acron^clgv: my apologies
04:53kiracron^, if you don't mind a suggestion from a fellow noob, I found these videos to be exceptionally useful: https://www.youtube.com/watch?v=9A9qsaZZefw&amp;list=PLAC43CFB134E85266
04:53clgvluxbock: why do you use `reductions` there?
04:53acron^kir: super! thank you!
04:54clgvluxbock: this will perform your computations multiple times
04:54luxbockclgv: (boo->> 1 inc (+ 10)) should return [1 2 12], i.e. I need the expressions 1, (inc 1) and (+ (inc 1) 10)
04:54kiracron^, welcome.
04:56clgvluxbock: I know. but have a look at the macroexpansion and you see what I mean
04:57luxbockclgv: ahh right
05:10ddellacostaluxbock: I think semantically what that thing does is a bit confusing
05:10ddellacostaluxbock: for example, this is roughly what you're trying to do, but separates the initial value out:
05:10ddellacosta&(reduce (fn [acc v] (conj acc (v (last acc)))) [1] [inc #(+ 10 %)])
05:10lazybot⇒ [1 2 12]
05:11ddellacostaand unfortunately Clojure doesn't do currying by default, so (+ 10) is not a function...alas
05:12luxbockddellacosta: what I'm actually trying to do is make a version of print->> from foo-print, that prints the values inside a nicely formatted table instead of value by value
05:12ddellacostaoh, I guess it makes sense to thread the first value through the other fns, it's the collecting that is a bit confusing
05:12ddellacostaluxbock: sorry I kind of jumped in late
05:12luxbockhttps://gist.github.com/97588fd2a4d03f1ef8f7
05:13hyPiRionit's just a ->> that collects the results of each form
05:13luxbockthis works again, but I don't know if it's the simplest way to do it
05:13ddellacostayeah, that's why reduce seems like the most obvious way
05:13ddellacostaor for actually, probably
05:13noncom|3does ccw support starting multiple repls?
05:14luxbockcould probably use a bit more destructuring
05:24Runners,awr At who like this game ? https://www.youtube.com/watch?v=rSAAdKE84Ts
05:27acron^that game looks mental
05:30acron^does 'defn-' mean it can't be called outside this namespace ?
05:30hyPiRion,(defn ba [s [f & r]] (if f (let [y (gensym)] `(-> ~(peek s) ~f (as-> ~y ~(ba (conj s y) r)))) s))
05:30clojurebot#'sandbox/ba
05:30hyPiRion,(defmacro boo->> [x & f] (let [g (gensym)] `(let [~g ~x] ~(ba [g] f))))
05:30clojurebot#'sandbox/boo->>
05:30hyPiRion,(boo->> 1 inc (+ 10) even?)
05:30clojurebot[1 2 12 true]
05:31acron^hyPiRion: that's awesome
05:32TEttingernice hyPiRion
05:32TEttinger(inc hyPiRion)
05:32lazybot⇒ 67
05:33luxbockoh nice
05:33hyPiRionluxbock: it doesn't seem like the gist you posted worked, but that one should work
05:33luxbockhmm it was working for me
05:34luxbockacron^: yep, though you can get around that by using its var to call the function
05:34Runner3, ur At who like this game ? Is a shit game this https://www.youtube.com/watch?v=rSAAdKE84Ts
05:35luxbocki.e. if some.namespace/foo is private, then you can still call it with (#'some.namespace/foo a b c)
05:37luxbockhyPiRion: I am jealous of how you can think up something like this
05:37hyPiRionluxbock: that gist makes (boo->> 1 inc) expands to (let* [G__989 1 G__990 (inc G__990)] [G__989 G__990]), at least over here. so I guess you just had an off by one error. Seems like a solid way to implement it though
05:37luxbockIt probably takes me more time to undestand how this works than what it did for you to write it
05:38luxbockhyPiRion: ah yeah I might've gisted the wrong version on accident
05:38hyPiRion,(ba ['x] '[inc (+ 10)])
05:38clojurebot(clojure.core/-> x inc (clojure.core/as-> G__107 (clojure.core/-> G__107 (+ 10) (clojure.core/as-> G__108 [x G__107 G__108]))))
05:38hyPiRionoh, that looks messy. well
05:39hyPiRionit just expands to (let [x 1] (-> x inc (as-> y (-> y (+ 10) (as-> z [x y z])))))
05:40hyPiRionwhich is just another fancy way of saying what your macro expanded to :)
05:41luxbockright
05:43hyPiRion,(->> 10 conj (-> [1]))
05:43clojurebot[1 10]
05:45hyPiRion,(-> [1] conj (->> (->> 10)))
05:45clojurebot[1 10]
05:45hyPiRionThese things can go weird pretty fast when combined.
05:46acron^quick question: how to remove a particular index from a sequence?
05:46acron^(1 2 3) => (1 3)
05:48hyPiRionacron^: there's no built-in support for that, as it's very slow
05:48hyPiRionbut if you really need it for sequences in general, you can implement it like this
05:49hyPiRion,(defn remove-nth [coll n] (let [[f r] (split-at n coll)] (concat f (rest r))))
05:49clojurebot#'sandbox/remove-nth
05:49hyPiRion(remove-nth '(1 2 3) 1)
05:49hyPiRion,(remove-nth '(1 2 3) 1)
05:49clojurebot(1 3)
05:49acron^erk
05:49acron^I'll think of a different approach
05:51Glenjamindoes anyone know if it's possible to get the generated input when catching an exception in test.check ?
05:51hyPiRionwell, it's doable, just be aware that it's O(k) (where k is the index) on the sequence you're working on
05:51acron^I'll think of a different approach
05:51acron^oops
05:52slipsetacron^: worth considering, though if this is the bottleneck in your application
05:53arossouwclgv: is it better to write like this? (-> testdb :master (jdbc/query sql-query))
05:53slipsetacron^: in this talk https://www.youtube.com/watch?v=I7IdS-PbEgI
05:53slipset@leeb shows that persistent datastructures are slower than mutable datastructures in js by a constant factor.
05:54acron^sure
05:54slipsethe also suggests that the arr.push('foo'); will be somewhat slower with persistent datastructures, but it will never be the bottleneck
05:55the_freyI am having the weirdest issue but not 100% sure how do describe it
05:55Glenjamina cljs persistent vector in "mutable mode" is actually faster than a large JS array
05:56the_freyso basically I've got a bunch of namespaces in a lein project, the code compiles, so I know all the namespaces are being loaded (as they are required by others)
05:56Glenjamin(transients, that is)
05:56hyPiRionand a clojure transient vector might on rare occations be faster than an arraylist.
05:56the_freybut lein run throws an error that shows they aren't loaded properly - at least, not the current version of the code
05:57slipsetglenjamin: yes, but my main point is that IMHO nothing is a peformance problem before it is proven so by benchmarking your application
05:57Glenjaminright, agreed
05:57the_freyin the emacs repl if I go to the most deeply nested namespace and load it, then repeat until I get to the main function, I can run it and it works
05:57the_freybut why aren't they being loaded in the first place? I'm not having to change any code to get them to work
05:58hyPiRionthe_frey: that sounds strange, could you do `lein clean` and check if that helps? Might be an AOT/protocol issue
05:59the_freyyeah I did lein clean and it had no effect
05:59hyPiRionhm
06:00the_freyproject.clj looks like this FWIW https://github.com/Swirrl/artsapi-email-processing-tool/blob/master/project.clj
06:00julianlevistonacron^: you could always use subvecs coupled with into
06:04hyPiRionthe_frey: fwiw I cloned the project, and it works fine here on leiningen 2.5.1
06:04luxbockhow would I check if a value is an exception?
06:04the_freyyeah it'll lein run just fine
06:04acron^i could if i knew what that meant ;)
06:04julianlevistonacron^: ##(doc subvec)
06:04lazybot⇒ "([v start] [v start end]); Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive). If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done."
06:04the_frey*lein repl
06:05julianlevistonacron^: ##(doc into)
06:05lazybot⇒ "([to from] [to xform from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined. A transducer may be supplied."
06:05hyPiRionluxbock: (instance? Exception my-value)
06:05luxbockhyPiRion: thanks
06:09donbonif_Returns the sum of the elements or 42 if any element is 42 -> any leet way of doing this? I'm basically using reduce and return 42 based on the conditions.
06:09hyPiRionthe_frey: Strange, lein run works here
06:10hyPiRiondonbonif_: (or (some #{42} coll) (reduce + coll))
06:10julianlevistonacron^: ## (let [x [1 2 3 4 5]] (into (subvec x 0 1) (subvec x 2)))
06:10lazybot⇒ [1 3 4 5]
06:11donbonif_hyPiRion: that was my other option, but that will force to check the full collection twice
06:12donbonif_can be faster, can be slower
06:12the_freyhyPiRion yeah actually lein run will work for a number of cases that don't include needing to have some newer files
06:13the_freythere's basically a set of rdf-izing templates only called in a specific case (the newest code) that are there, but what lein thinks is in there... is not what's in there.
06:13acron^julianleviston: nice one, thanks
06:13slipsetdonbonif_: reduce has a special (reduced) value
06:13the_freyah well, I'll return to searching for an answer
06:13hyPiRiondonbonif_: right. Well, if perf is a concern, then (reduce (fn [acc n] (if (= n 42) (reduced 42) (+ acc n))) 0 coll) is probably sufficient
06:13the_freycheers!
06:13slipsethyPirion :)
06:13hyPiRionthe_frey: good luck, if you can't find it out, feel free to submit an issue on the Leiningen tracker
06:14hyPiRionslipset: ahh, you beat me! :)
06:14hyPiRion(inc slipset)
06:14lazybot⇒ 2
06:14the_freycool, if I can replicate it in some way, I will :)
06:14donbonif_hum.. didn0t know about reduced, thatnks hyPiRion and slipset :)
06:14slipsethyPiRion: you had the implementation though :)
06:14slipset(inc hyPiRion)
06:14lazybot⇒ 68
06:15slipsetdonbonif_: as a side note, reduced is purty cool in transducers, since it lets you send 'quit' messages down the chain of transducers
06:15julianlevistonthe_frey: sorry to ask a stupid question, but you *are* in the right folder when you run lein right?
06:15the_freyhad to check there for a second but yes :)
06:16julianlevistonthe_frey: I only ask because that's caught me out before :)
06:16the_freyhaha yeah
06:16In-Runner3nk Is true that Bill Gates is gay ?
06:16the_freythe weirdest thing is that you can load it all up via emacs and run it
06:16the_freyreal head scratcher
06:17hyPiRionyeah, that's just confusing
06:17acron^what are these Runner and In_runner bots doing?
06:17slipsetdonbonif_:http://clojure.org/transducers search for "Early termination"
06:17donbonif_thanks slipset :)
06:17acron^what are these Runner and In_runner bots doing?
06:17acron^oops
06:17acron^gotta stop that
06:21acron^if a function returns a sequence generated by a map, is it still lazy until the sequence is queried?
06:22TEttingeryeah, the type is lazyseq so it knows how to compute the next element
06:23julianlevistonacron^: yeah it's a common bug that new people make… they do a map expecting the same effect as doseq or dorun
06:23acron^i definitely make this mistake
06:23TEttingerif you're struggling with str on a lazyseq, as I did a lot at first, there's that handy mapv
06:23TEttinger,(str (map inc [1 2 3]))
06:23clojurebot"clojure.lang.LazySeq@7c42"
06:24TEttinger,(str (mapv inc [1 2 3]))
06:24clojurebot"[2 3 4]"
06:24acron^thanks guys
06:24In-Runner45n Who know this girl ? http://s4.postimg.org/e98mohfnx/Girl.jpg
06:24slipset,(apply str (map inc [1 2 3]))
06:24clojurebot"234"
06:24slipsethmm
06:24slipsetdifferent thing :)
06:25TEttinger,(pr (map inc [1 2 3]))
06:25clojurebot(2 3 4)
06:25TEttinger,(pr-str (map inc [1 2 3]))
06:25clojurebot"(2 3 4)"
06:25acron^pr ?
06:25TEttingerpr-str is extremely handy for getting lisp code that you can then read-string in
06:26TEttingerprint readably
06:26TEttingerreadably by clojure, that is
06:26acron^ahhh
06:26TEttinger,(pr-str {:a "alpha"})
06:26clojurebot"{:a \"alpha\"}"
06:26TEttingerit handles escapes and everything
06:33Glenjaminany test.check experts around? I'm setting my check size to be 100+, but it's only running ~20 iterations - any idea's where i should direct my debugging?
06:39arossouwhow can i turn {:sn "mylastname :firstname "myfirstname"} into string output "sn\nmylastname\nfirstname\nmyfirstname" ?
06:40Glenjamingah, sample produces the right results - but quick-check doesn't
06:42clgvluxbock: looks good to me
06:45TEttinger3arossouw: ##(reduce-kv #(str %1 "\n" (name %2) "\n" %3) "" {:sn "mylastname" :firstname "myfirstname"})
06:45lazybot⇒ "\nfirstname\nmyfirstname\nsn\nmylastname"
06:46TEttinger3of course maps are unsorted by default so you end up with that
06:46TEttinger3hm
06:47TEttinger3arossouw: ##(clojure.string/join (map #(str (name %1) "\n" %2) {:sn "mylastname" :firstname "myfirstname"}))
06:47lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: sandbox6330/eval12776/fn--12777
06:47TEttinger3 ##(clojure.string/join (map #(str (name (key %1)) "\n" (val %2)) {:sn "mylastname" :firstname "myfirstname"}))
06:47lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: sandbox6330/eval12789/fn--12790
06:47TEttinger3gaaaah
06:48TEttinger3 ##(clojure.string/join (map #(str (name (key %1)) "\n" (val %1)) {:sn "mylastname" :firstname "myfirstname"}))
06:48lazybot⇒ "firstname\nmyfirstnamesn\nmylastname"
06:48arossouwTEttinger3: thanks
06:48TEttinger3that last one doesn'thave the \n at the start
06:48arossouwdo you have some docs where i can educate myself with?
06:48TEttinger3I don't really know... the main thing this uses is that maps can be treated as seqs
06:49TEttinger3##(seq {:sn "mylastname" :firstname "myfirstname"})
06:49lazybot⇒ ([:firstname "myfirstname"] [:sn "mylastname"])
06:49julianlevistonarossouw: I found the cheatchefat useful.
06:49TEttinger3so that's what it's operating on
06:50TEttinger3those aren't normal vectors even though they print in []
06:50arossouwjulianleviston: thanks, i'll look it up
06:50julianlevistonarossouw: yeah, they're MapEntry thingos
06:50TEttinger3those [] allow you to call key and val on them, or first and second
06:50muhukIf I have a simple function (single threaded calc.) that uses a constant (say the gravity), it seems using with-bindings is preferable to override the constant.
06:51muhukAFAIU bindings is for multi-threaded stuff
06:53arossouwok, i think i just need to learn how to destructure different types
06:53clgvmuhuk: you could pass that constant directly and just create partials
06:54muhukclgv: I know.
06:54clgvmuhuk: the binding approach might backfire
06:54muhukI'm trying to understand the difference between bindings & with-bindings
06:54muhukreading source, seems like they both use thread-locals
06:56arossouwhow would you destructure results of clojure.set/difference?
06:56clgvmuhuk: from quickreading the source I guess with-bindings might work for arbitrary vars?
06:56arossouwTEttinger3: first time i see ##( , what is that called?
06:56muhukclgv: what does "arbitrary var" mean?
06:57clgvarossouw: lazybot syntax
06:57arossouwoh
06:57muhukarossouw: I don't think you can destructure sets
06:57clgvmuhuk: `binding` is limited to dynamic vars
06:57TEttingerit's similar to ,(+ 1 2) to call (+ 1 2) with clojurebot
06:58arossouwive tried this, but just gives me the hash-map let [result (apply str (merge-with (str "\n") x) , from clojure.set/difference result
06:58clgvmuhuk: or it's just the automatic variable treatment thats missing
06:58TEttingerarossouw, oh you're using sets now?
06:59arossouwyes, using sets to compare data results from databases
06:59arossouwhttp://paste.linuxmint.com/view/nkbl/
06:59TEttingerwell (merge-with (str "\n") x) won't do what you want
06:59clgvmuhuk: ah no, just different interface
06:59julianlevistonarossouw: I suggest composing your forms piece by piece in the REPL… and testing them as you do so… until you're sure they do what you want.
06:59TEttinger(doc merge-with)
06:59clojurebot"([f & maps]); Returns a map that consists of the rest of the maps conj-ed onto the first. If a key occurs in more than one map, the mapping(s) from the latter (left-to-right) will be combined with the mapping in the result by calling (f val-in-result val-in-latter)."
07:00clgvmuhuk: you pass a map of variables and values instead of the vector notation that `binding` uses
07:00arossouwjulianleviston: ok, i'll try with small data sets, to see how i can destructure
07:00TEttingeryour function f there is just the result of calling str on \n, so "\n"
07:00julianlevistonarossouw: can you clearly say what you're trying to do, simply if possible? We can probably help.
07:01TEttingerand yeah, the repl is a great place to work this stuff out
07:01TEttinger(inc julianleviston)
07:01muhukclgv: yeah, also there's this `(var ...) stuff in binding. It seems those vars are re-defined in the new frame.
07:01TEttingeroh lazybot just died
07:01arossouwok, i'll try. i'm comparing a master and slave database count results of tables, the results of each is then passed to clojure.set/difference to detect differences
07:01clgvmuhuk: I think `binding` could be implementer on top of `with-bindings` but due to historic reasons (1.0 vs 1.1) it is not
07:01arossouwthen i'd like to neatly write clojure.set/difference results to file
07:02julianlevistonarossouw: so you have some data from the master and slave… what form is it in? Is it hashes? sets?
07:02TEttingerso you're using the set you get by calling the fn keys on the map?
07:03clgvarossouw: check out (doseq [e your-set] (println e))
07:04julianlevistonarossouw: sorry, when I said "hashes" I meant maps… old ruby habit :(
07:04TEttingergood idea, clgv
07:05acron^So, I'm using (spit f (doall (flatten ...
07:05acron^but it's still printing a lazyseq :/
07:05julianlevistonacron^: um… doall is for side-effects.
07:06arossouwsorry, power failure (load-shedding) in south africa
07:06clgvjulianleviston: not really, it forces the evaluation of the lazy-seq passed to it
07:06TEttingeryou could just replace doall with vec there
07:06arossouwyes, the jdbc query returns hash-map results
07:06clgvarossouw: check out (doseq [e your-set] (println e))
07:06julianlevistonclgv: yeah but it doesn't return the value does it?
07:07julianlevistonTEttinger: assuming it's a vec
07:07clgvjulianleviston: it does - you are confusing it with dorun
07:07TEttingerif it's a lazyseq now it will convert it
07:07julianlevistonclgv: ah ok sorry… I wonder why it isn't working then
07:07arossouwclgv: ok, thanks
07:07TEttingeracron^, are they nested lazyseqs?
07:07slipsetarossouw: is your example the exact thing you want to do or is it just an example of a more general question?
07:07clgv,((juxt doall dorun) (range 10))
07:07clojurebot[(0 1 2 3 4 ...) nil]
07:07acron^i'm trying to (spit f (flatten [[x y z (map ...)]]))
07:07TEttingerbecause doall won't turn those into a different type
07:08TEttingerah...
07:08arossouwslipset: just confused how to output clojure.set/difference that contains hash-maps to newline formatted output
07:08acron^vec did it
07:08acron^kinda :)
07:08TEttinger(doc flatten)
07:08clojurebot"([x]); Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat sequence. (flatten nil) returns an empty sequence."
07:09clgvacron^: check out `mapv`
07:09TEttingerI'm surprised flatten would return a lazyseq
07:09arossouwah
07:09acron^clgv: it's not the map that's the problem, it's the flatten
07:09acron^docs dont say it but the result is lazy
07:09justin_smithTEttinger: flatten has so many surprises!
07:09clgvacron^: the flatten is weird in this case anyway
07:09TEttinger,(class (flatten [[(map inc [1 2 3])]]))
07:09clojurebotclojure.lang.LazySeq
07:10TEttingeryup!
07:10TEttingerit's awful
07:10justin_smith(spit f (apply concat x y z (map ...)))
07:10julianlevistonTEttinger: actually I don't think flatten does… it returns a seq over it's given, if I'm reading the source correctly.
07:10clgvacron^: every `flatten` usage you encounter has a high probability of being the wrong, erm let's call it "solution", to the problem at hand
07:10julianlevistonhehe yeah, avoid flatten.
07:10TEttingerI just checked the class it returns
07:11justin_smith,(flatten {:a 0 :b 1 :c [12 3 4 5]})
07:11clojurebot()
07:11clgv,(class (doall (flatten [[(map inc [1 2 3])]])))
07:11clojurebotclojure.lang.LazySeq
07:11clgv;)
07:11TEttingerheh
07:11TEttingerwe're all trying it!
07:11arossouw(flatten (set [{:sn "Arno" :fn "B"}{:sn "BB" :fn "A"}]))
07:11arossouw?
07:11arossouw()
07:11TEttinger,(flatten (set [{:sn "Arno" :fn "B"}{:sn "BB" :fn "A"}]))
07:11clojurebot()
07:11julianlevistonarossouw: put a comma in front.
07:12arossouwij
07:12arossouwok
07:12clgvarossouw: as I said, `flatten` is the wrong function to use in a lot of cases ;)
07:12julianlevistonarossouw: or a double-# for inline like this ## "yay!"
07:12julianlevistonarossouw: or a double-# for inline like this ##"yay!"
07:12TEttingerlazybot died
07:12TEttingerclojurebot lives
07:13julianlevistonTEttinger: I am confuze… different syntax for inline?
07:13justin_smithjulianleviston: ##(str 'clojurebot " requires () for ##")
07:13muhuk,(sequential {})
07:13clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: sequential in this context, compiling:(NO_SOURCE_PATH:0:0)>
07:13clgvdoes "lein deploy" use the :user profile?
07:13julianlevistonjustin_smith: ahhhh
07:13TEttingerclojurebot doesn't have inline eval
07:13muhuk,(sequential? {})
07:13clojurebotfalse
07:13arossouwi'll try clojure.data/diff instead of clojure.set/difference
07:13justin_smithTEttinger: meant lazybot, sorry
07:13muhukarossouw: flatten needs sequential colls.
07:14justin_smithand lazybot is out anyway
07:14justin_smith~flatten
07:14clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
07:14TEttinger,(flatten {:a [1 2 3] :b [4 5 6]})
07:14clojurebot()
07:14justin_smith(since we don't see that enough)
07:14TEttingerheh
07:15javjarferHi there! i'm new to clojure and i don't know how to solve a little problem i have with the lightTable instarepl
07:15javjarferanyone use it?
07:16clgv~anybody
07:16clojurebotanybody is anyone
07:16julianlevistonjavjarfer: I have.
07:16clgv~anyone
07:16clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
07:17julianleviston~noone
07:17clojurebotPardon?
07:17julianleviston~you heard me
07:17clojurebotjulianleviston: I'm just giving you a second chance
07:17clgv~guards
07:17clojurebotSEIZE HIM!
07:17julianlevistonHEH :)
07:17arossouwok, so this is the output i get http://paste.linuxmint.com/view/e1lj
07:17javjarfersorry, it wasn't a language related question, so i didn't want to have the whole conversation here
07:18muhukjavjarfer: just type your little problem, if someone knows the answer they'll reply
07:18julianlevistonjavjarfer: we're all friendly folks...
07:18julianlevistonarossouw: it's a set of hashes! yay!
07:19arossouwjulianleviston: is that good or bad?
07:19julianlevistonarossouw: or… a seq over a set of hashes it seems
07:19clgvarossouw: very bad. straight way to hell ;)
07:19julianlevistonarossouw: neither… so you want to do what with it?
07:19arossouwlol, ok
07:19julianlevistonarossouw: diff it with something else and spit the diff'd bit?
07:19arossouwif its a bad way, i'll rewrite code and make it better
07:19luxbockclgv: this is what I worked myself up to: https://gist.github.com/luxbock/38d245ff1f1a194921cb
07:19arossouwjulianleviston: exactly
07:20luxbockclgv: it looks horrible but I think after I refactor it a bit I can use the same idea to implement this for all other arrow-macros and let/when-let/if-let
07:20javjarferso, the problem is that when i evaluate something thing the instarepl that i have defined in another namespace i don't get a console output, if instead i define it in the instarepl window, it appears
07:20muhukjavjarfer: does your instareply import that thing?
07:20julianlevistonarossouw: it's not bad. It's fine.
07:20clgvluxbock: you can encapsulate tasks in functions
07:21luxbockclgv: yep that's what I plan on doing, but I just wanted to get everything working first
07:21javjarferyes, it gets evaluated to 'nil' because it just prints, but shows nothing on console
07:21luxbockit's easier for me to have everything workin in one big mess before I brake it into parts
07:21julianlevistonjavjarfer: where are you looking for the console?
07:21clgvluxbock: so the ultimate goal is debugging threading forms?
07:22luxbockclgv: yes, and binding forms as well
07:22luxbockand `defn`
07:22javjarferjulianleviston: i look at the console that shows up with the "view console" tab
07:23clgvluxbock: I had an attempt on defn, but it still does not support `recur` calls
07:23luxbockclgv: this library already does this: https://github.com/AlexBaranosky/print-foo but I wanted to improve the formatting of the printed messages
07:23clgvluxbock: do you know spyscope?
07:23julianlevistonjavjarfer: ok.. just checking the obvious things :) sorry.
07:24luxbockclgv: yes, I was using it before
07:24arossouwjulianleviston: ok, i think there should be a cleaner way though, i'll do some research
07:24muhukjavjarfer: if it's a function, you're calling it right?
07:24luxbockcan't remember why I took it out of my profiles.clj though anymore
07:24julianlevistonarossouw: so just to check… you want the set difference? or the set exclusion?
07:24arossouwthe difference
07:24javjarferjulianleviston: no worries :)!
07:24clgvluxbock: (-> 2 dec dec (/ 1)) shouldnt throw an exception ;)
07:25sm0kehello, can lein deps :tree be used on a particular dep
07:25julianlevistonarossouw: the exclusion will get you all the bits not in either… from both…. but the difference will remove all the elements of the second set from the first… effectively
07:25luxbockclgv: oh yeah this is ->>, I forgot to change the name :)
07:25arossouwi actually only need the values, so i can do vals on the hash-map
07:25julianlevistonarossouw: and why isn't it working for you then?
07:25julianlevistonarossouw: or rather, how isn't it working?
07:26javjarfermuhuk: yes, it just a function defined in: (ns clojtest.core (:gen-class)) and i call it like: ('clojtest.core/fun "test")
07:26arossouwi'm getting the correct results, just confused on how to neatly format and output the results to a file
07:26javjarferevaluates to nil, but get nothing on console
07:26julianlevistonarossouw: haha oh ok…
07:26julianlevistonarossouw: is spit not working for you?
07:26arossouwsorry, my explanation sucked
07:26julianlevistonarossouw: a little, but we got there in the end.
07:27justin_smitharossouw: (spit f (with-out-str (clojure.pprint/pprint ...))) maybe?
07:27julianlevistonjustin_smith: nice!
07:27muhukjavjarfer: got it. It should work. I can try here if you paste a minimal code.
07:28julianlevistonarossouw: with-out-str redirects the side effecting *outs* output to a string instead of *outs*, which spit will then put in the file for you…
07:28arossouwi'm getting a hash-map in the output file, {:table_name blah :rows blah}{table_name blah :rows 2123} <- output file
07:28javjarfermuhuk: ok, i will post it here.
07:28julianlevistonarossouw: what would you like?
07:28arossouwjustin_smith: i think that might work
07:28justin_smitharossouw: what do you want to be there a) in terms of data b) in terms of contents
07:28justin_smitherr I mean b) presentation
07:29arossouwformat the hash-map keys and vals with newline, neat output
07:29justin_smitharossouw: yeah, then the with-out-str / pprint combo should do it
07:29arossouwok, thanks
07:30julianlevistonarossouw: tho if you want the hashes newline-delimited it won't.
07:30julianlevistonarossouw: you might wanna chuck an interpose \/n in there for good measure.
07:31justin_smithjulianleviston: for a large enough hash it will insert newlines
07:31arossouwok
07:31julianlevistonjustin_smith: look at you with your awesomeness :) that's cool.
07:32arossouwjustin_smith: that did the trick
07:32justin_smithcool
07:32julianleviston(inc justin_smith )
07:33justin_smithlazybot's disco again
07:33julianleviston(inc justin_smith)
07:33arossouwis it common to use clojure.set/difference or is there better way of comparing data-sets?
07:33julianlevistonjustin_smith: it's just every time I use it lol
07:33julianlevistonarossouw: it's common.
07:33arossouwok
07:33justin_smitharossouw: there is also clojure.data/diff
07:34julianlevistonarossouw: the things in data are pretty good for this tho tho… https://www.google.com.au/search?client=safari&amp;rls=en&amp;q=clojure.data&amp;ie=UTF-8&amp;oe=UTF-8&amp;gfe_rd=cr&amp;ei=G7TUVLmUIc_u8wfX-YCADA
07:34justin_smithor is it clojure.data.diff
07:34arossouwjustin_smith: that one doesn't look so good in comparison
07:34julianlevistonugh… safari. sorry.
07:34julianlevistonhttps://clojure.github.io/clojure/clojure.data-api.html
07:34javjarfermuhuk, first file: (ns clojtest.core (:gen-class)) (defn testing [a] (println "hi")) second file: ('clojtest.core/testing "a")
07:34justin_smitharossouw: it's got a different use case for sure
07:35arossouwi'll see if i can learn something from clojure data analysis cookbook
07:35justin_smith,(require '[clojure.data :as data])
07:35clojurebotnil
07:35justin_smith,(data/diff {:a 0 :b 1} {:b 1 :c 2})
07:35clojurebot({:a 0} {:c 2} {:b 1})
07:36justin_smithit shows you what's only in a, what's only in b, and what's shared, as separate outputs
07:36arossouwok, looks good
07:37muhukjavjarfer: 2 things. You're not importing your 1st file. And also you're quoting the fn var.
07:37muhukjavjarfer: remove that ' and you'll see it's complaining that it can't find the var.
07:37sm0kehow do i add some extra jars to leiningen classpath?
07:37arossouwhehe, need to practise more of hammock driven development
07:38javjarfermuhuk, oh... sorry, thanks you very much
07:38javjarfermuhuk, noob mistake
07:38julianlevistonarossouw: auto-marketing term for what mum used to call "think before you act" ;-)
07:38muhuksm0ke: http://stackoverflow.com/questions/17259054/how-can-i-add-a-not-maven-compatible-jar-file-to-a-leiningen-project
07:38arossouwindeed, guess i'm too rushed with things
07:38muhukjavjarfer: np
07:38sm0kemuhuk: i dont really want to install it maven repo
07:38julianlevistonarossouw: it's pretty difficult not to be in our world a lot of the time.
07:39sm0kejust add it to classpath
07:39julianlevistonarossouw: one has to make a conscious effort to not be, perhaps.
07:39muhuksm0ke: yeah. Me too. However I haven't got a better/different answer since then.
07:39arossouwtrue, since most people are so demanding
07:40julianlevistonarossouw: I have a feeling you're thinking of either managers or clients?
07:40arossouwusually clients, my boss is a reasonable person
07:41acron^with there was a .write-line
07:41acron^wish*
07:42julianlevistonacron^: there's a prn-str
07:43acron^does that work with io/writer ?
07:44winkhehe nice, https://www.reddit.com/r/nethack/comments/2tluxv/yaap_fullauto_bot_ascension_bothack
07:44muhukWhy isn't binding working here: http://dpaste.com/186ZEEV (it's clojurescript)
07:45julianlevistonoh weird… clojure.set doesn't seem to have "the union of a diff b and b diff a"
07:45muhukI expect it to at least pring :debug [1 2 3]
07:45julianlevistonwhich I was calling exclusion, but there's no such thing in set theory apparently.
07:45muhuks/pring/print
07:46julianlevistonmaybe I remembered that from Adove Illustrator. LOL
07:46julianlevistonadobe*
07:47justin_smithjulianleviston: outer join?
07:47julianlevistonah… symmetric difference it's called.
07:47julianlevistonjustin_smith: for relational algebra, yeah.
07:47julianlevistonjustin_smith: assuming I remember my relational algebra ok. :) I very rarely needed that particular join.
07:48justin_smithwell, to be precise outer excluding join
07:48justin_smithhttp://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins
07:48julianlevistonhttp://en.wikipedia.org/wiki/Set_theory
07:48julianlevistonjustin_smith: nice.
07:49justin_smithyeah, I julianleviston the best illustration is at the bottom of the page
07:49justin_smithjulianleviston: in set theory, the symmetric difference
07:49julianlevistonjustin_smith: yup.
07:50julianlevistonjustin_smith: in illustrator, an exclusion. ;-)
07:50julianlevistonjustin_smith: see we should all just ditch these technical terms and use illustrator's terms. lol
07:50julianleviston"front subtraction"
07:52justin_smith"I'm on a linux box, you insensitive clod"
08:06_2_cherinawhat is a ocean??:)
09:30mmitchellwould anyone here happen to know the job posting rules for the clojure google group?
09:31mmitchelldo i just prefix the subject with [job] ?
09:31tcrayford____mmitchell: find an older job post on there and copy that one's style?
09:31mmitchellyeah cool
09:32tcrayford____(just a suggestion - I have no idea)
09:32mmitchellsounds good though :)
09:43stuartsierrammitchell: Don't sound like recruiter-spam. :)
09:43mmitchellyeah :) I'll do my best!
09:48can-of-beeshi all. could someone point me towards a new-user-friendly example for writing XML? specifically XML that has been parsed/opened with clj-tagsoup.
09:49can-of-beeswhat i've tried so far, in pastebin:
09:50can-of-beesoops, here's the link http://pastebin.com/iQGe5iZN
09:51justin_smithcan-of-bees: what do you want to write to the file?
09:51can-of-beeshi justin_smith. i'm trying to take malformed XML, open it with tagsoup, and write well-formed XML.
09:51justin_smithalso, what you have there is basically spit
09:52justin_smithcan-of-bees: OK, yeah, the code you have will write the parsed version, you need to do the processing and reconstruction
09:52can-of-beesjustin_smith: okay.
09:53justin_smithhttp://clojure.github.io/data.xml/#clojure.data.xml/emit try clojure.data.xml/emit
09:53justin_smithor emit-str
09:54justin_smithtagsoup should generate an output compatible with data.xml
09:54justin_smithand instead of the whole with-open, just (spit "filename" (xml/emit-str ...))
09:54krat0sprakharhi all.. i've been using clojure for a little over a month now and wanted to get started with some web development.. ring/compojure looks great and easy to get started with.. but on the frontend - there's just too much learn - clojurescript / react / om / reagent / core.async
09:54can-of-beesjustin_smith: that's great, thank you. i had started to look through data.xml but wasn't sure if that was the right thing to try using.
09:54krat0sprakharits getting a bit overwhelming now :(
09:55justin_smithcan-of-bees: yeah, iirc tag-soup improves the parsing compared to data.xml, but produces compatible output
09:55justin_smithkrat0sprakhar: why not ignore frontend clojure at first, and do one thing at a time?
09:55krat0sprakharoh add google closure library to the frontend also
09:55justin_smithyeah, I would start with ring, compojure, some static pages
09:56justin_smiththen think about maybe adding in a db backend, or clojurescript on the frontend
09:56justin_smithor, alternately, ignore ring/compojure and just generate some cljs and serve that statically - either way, do one of the two sides at a time
09:56krat0sprakharah ok
09:57krat0sprakharso hiccup is one way of doing templates..
09:57justin_smithhaving used all those things, I think you'll make more progress if you focus a bit more
09:57krat0sprakharis there a more standard way - like other languages?
09:57justin_smithkrat0sprakhar: just do ring/compojure and static html first, then do templating after that works
09:57justin_smithkrat0sprakhar: the clojure community tends to be pretty averse to "frameworks"
09:58krat0sprakharright
09:58justin_smiththough we have things like figwheel that bundle a bunch of stuff up
09:58krat0sprakhari am majorly from flask background..
09:58justin_smithbut I don't think that's the right way to learn
09:58krat0sprakharso i like minimal libraries as well
09:58krat0sprakhari finished the tutorial here http://www.jarrodctaylor.com/posts/Compojure-Address-Book-Part-1/
09:58krat0sprakharthis covers ring / compojure / yesql / hiccup
09:59justin_smiththat sounds decent
09:59justin_smithbut yeah, break it into steps
09:59krat0sprakharyeah
09:59krat0sprakharyesql was awesome! :D
09:59justin_smiththere's a value to figuring out what each constituent part does
10:00krat0sprakharagreed... so i should go slow then
10:01krat0sprakharis hiccup the dominant way the clojure community does templating or is there anything else you recommend?
10:01justin_smithhiccup makes sense if the person building the pages is clojure-friendly
10:01justin_smiththere are other templating libs that are more similar to mustache if you have a dedicated front-end team
10:03krat0sprakharah ok
10:03krat0sprakharhiccup it is then
10:04krat0sprakharthanks justin_smith!
10:05darrenhcan a record implement multiple protocols?
10:06darrenhhaving trouble finding any examples on the web
10:06Bronsa,(defprotocol p1 (f1 [_]))
10:06justin_smithdarrenh: yes, you can just add more protocols to the record def
10:06clojurebotp1
10:06Bronsa,(defprotocol p2 (f2 [_]))
10:06clojurebotp2
10:06Bronsa,(defrecord r [] p1 (f1 [_]) p2 (f2 [_]))
10:07clojurebotsandbox.r
10:07zoldar_krat0sprakhar: there's also enlive for a more designer-friendly templating
10:07darrenhthanks
10:07justin_smithzoldar_: or sente, or antlers, or...
10:08zoldar_justin_smith: kixi and etc. yeah I know what you're at, right, too much overload in the beginning helps no one
10:08justin_smithzoldar_: his initial problem was too many details to take in :)
10:10justin_smitherr wait I didn't mean sente, but whatever
10:48darrenhHas anyone got a link to a 'real' example of how to use Stuart Sierra's component library? The examples on github are confusing me.
10:49darrenhIn particular I'm having real trouble understanding how to make a component that depends on another component
11:03AeroNotixdarrenh: what have you tried so far?
11:04justin_smitha couple good reasons to check out pixie if you want to do scripting / OS level stuff in a lang very much like Clojure but with fast startup and lower resource usage https://www.refheap.com/97005
11:04darrenhI was having trouble working out what to pass to the constructor. It seems as though an empty map works just fine. The library must be 'magically' injecting the dependency
11:05AeroNotixdarrenh: it's not magic
11:05AeroNotixit uses assoc
11:05justin_smithdarrenh: it should be able to calculate the graph of which parts of your system need which other parts
11:05AeroNotixAFAIK assoc is not considered magic
11:06darrenhended up with this:
11:06darrenh(component/system-map :cache (->MemoryCache (agent {}))
11:06darrenh :needs-cache (component/using (->NeedsCache {}) [:cache]))
11:06justin_smithdarrenh: the relevant part of the github page is where he shows usage of component/system-map https://github.com/stuartsierra/component
11:06Glenjaminjustin_smith: is that using 7 gig to produce a process tree?
11:06justin_smithGlenjamin: um no...
11:06darrenhinside NeedsCache the argument has 'magically' become the MemoryCache
11:07justin_smithGlenjamin: that's with firefox, chrome, and opera all running, plus a massive emacs
11:07Glenjaminoh right, i was a bit confused by the graph at the top
11:07justin_smithGlenjamin: relevant part is the line listings for bash vs. pixie (bash shown for scale)
11:07Glenjaminright, i see - looks neat
11:07Glenjamin32gig of ram is a serious machine :D
11:07AeroNotixjustin_smith: which parts of Clojure does Pixies explicitly not support?
11:08justin_smithGlenjamin: the "process graph" program is just hello world right now
11:08AeroNotixit's implemented in Python afaikcr
11:08justin_smithGlenjamin: system76 bonobo laptop
11:08justin_smithAeroNotix: rpython
11:08AeroNotixah
11:08justin_smithAeroNotix: which is a super optimized python subset
11:08AeroNotixI know
11:08justin_smithOK
11:08justin_smithit's the tool used to build pypy
11:08justin_smith(which you probably also know)
11:08AeroNotixyup. justin_smith does Pixie support everything which clojure does?
11:09justin_smithAeroNotix: not everything, but it's got the important stuff, and is making progress
11:09AeroNotixjustin_smith: awesome
11:09justin_smithAeroNotix: it has persistent data structures, protocols, records, etc.
11:10justin_smithand not perfectly code compatible with clj, but close enough for me to feel comfortable in it
11:10justin_smith(eg. check out that require form)
11:11justin_smithAeroNotix: missing is the concurrency stuff, but it's lightweight enough that I think I can do some cool stuff via ipc and multiple instances (thus the process-tree lib idea)
11:11justin_smithand they plan on implementing proper stm
11:12AeroNotixaha ok\
11:12AeroNotixworth a look then
11:13justin_smithI like it so far, yeah
11:13AeroNotixcool, I'll take a gander whenever I need to drop to shell
11:22justin_smithit's small enough / fast enough startup that I could consider shelling out to it to do tricky stuff in emacs / elisp code.
11:23stuartsierradarrenh: That's how it's supposed to work. :)
11:25darrenhstuartsierra: don't get me wrong, once I got it working it's very cool, I just can't work out how an empty map has turned into a record
11:26darrenhstuartsierra: and it wasn't completely clear from the examples that that was what would happen
11:26darrenhhence 'magic'
11:26{blake}justin_smith: Is pixie your baby?
11:26stuartsierradarrenh: it's all just assoc-ing on maps.
11:26justin_smith{blake}: no, tbaldridge and some collaborators, I am just discovering it
11:27justin_smith{blake}: but I may end up contributing
11:27{blake}justin_smith: It looks pretty keen.
11:27darrenhstuartsierra: I think I need to update my mental model :)
11:28stuartsierradarrenh: The system is a map. The components are maps. The `using` dependencies declared on each component are the keys whose values should be copied from the system into the component.
11:35darrenhstuartsierra: that makes complete sense, it's just the bit where I can pass an apparently arbitrary argument to a component's constructor that gets somehow replaced by the system
11:37stuartsierradarrenh: It's not the value that matters, it's the *key*.
11:37stuartsierraAny value of that key will get replaced when the system starts.
11:37stuartsierraThat's why I always write constructor functions for my records that only take the non-component keys as arguments.
11:38darrenhstuartsierra: this I think is where my understanding of records is lacking - do their constructor args become keys of the same name?
11:38stuartsierradarrenh: yes
11:38darrenhstuartsierra: now it makes sense :)
11:39darrenhstuartsierra: thank you
11:39stuartsierradarrenh: You're welcome, glad it makes sense now.
12:41tcrayford____current status: have a perf improvement to clojure.core/assoc that's potentially up to 4x times faster than current (if you call assoc with more than one key/value pair): http://dev.clojure.org/jira/browse/CLJ-1656
12:54justin_smithtcrayford____: awesome, voted
13:02tcrayford____Coni probably as well
13:02tcrayford____Waiting on benchmark results there
13:02tcrayford____Thank's!
13:02Bronsawe really need http://dev.clojure.org/jira/browse/CLJ-731
13:04tcrayford____Yeah. Unsure that'd work properly for assoc, but yeah
13:20dnolenhttps://github.com/clojure/clojure/pull/6
13:21seangrovehrm...
13:21dnolenI admit it makes me laugh
13:21justin_smithdnolen: I think that would have been accepted if he had renamed the .clj files to .lava files
13:21justin_smithglaring omission
13:27postpunkjustinjustin_smith: yeah, the most recent comment on the PR makes the same point
13:28justin_smithaha!
13:30postpunkjustinFrankly, renaming the language to Lava is the best idea I've heard since defclass and defmixin
13:31noonianjustin_smith: the other justin at the meetup made that comment while we were talking about it
13:31justin_smithnoonian: I sometimes forget who made the joke first, but yes :)
13:31noonianno, i mean he made the comment on github :P
13:32justin_smithright, but I said it out loud first? I don't even know.
13:32justin_smithhaha
13:32noonianah right lol
13:32postpunkjustinEven I don't remember
13:32postpunkjustinI may or may not have been one of the Justins in question
13:33justin_smithyes, I think I may have been the other one
13:33justin_smithor maybe visa versa
13:34justin_gfredericare we all justins today?
13:34justin_TimMcI think so.
13:35justin_rhickeyI know I am!
13:35postpunkjustinI'm so happy right now
13:35justin_gfredericthe justin_possibilities are endless
13:36justin_rhgwhy not
13:36hellofunkwhat in the world is happening right now.
13:36hellofunkhave i taken too much cold medication
13:36justin_smithhellofunk: Friday is happening.
13:37justintimeforjusthank god
13:37llasramhellofunk: As it turns out, yes, but that is an entirely orthogonal problem
13:37justin_hellofunkhellofunk: It is I, your justin twin!
13:37hellofunki'm voting for the theory that all those justin's are the same user
13:37justin_gfredericjustin_hellofunk: "justwin" as the kids call it these days
13:38hellofunki was going to say it must be friday the 13th. then i realized that next week it really will be the 13th
13:38aperiodicI can see one of them and he's not typing all that
13:38justin_hellofunkhaha
13:39hellofunklol
13:39llasramWell, and also you can see the messages from other people changing their nicks :-p
13:39DanKreekI'm another Justin, just letting you all know
13:39hellofunkllasram: oh i can't cuz i have all those things hidden
13:39TimMcje suis justin
13:39hellofunk\
13:39justin_rhgmy client which shows partial nicks dislikes this lol
13:40hellofunkwell, you boys have fun. i'm going back to sleep
13:42justin_smithnoonian: I sent you a /msg
13:59hellofunkjustins: i kid you not, this was unplanned. i was flipping through synth programs and landed on this: https://www.dropbox.com/s/qrdd94sd7ns1k8g/2015-02-06%2019.49.59.jpg?dl=0
13:59luxbockhttps://gist.github.com/luxbock/6dcfeb2cdccc82b75e0b
14:00luxbockhow do I properly use nested gensyms?
14:00luxbockI know potemkin has a unify-gensyms macro but I don't want to add it as a dependency just for this
14:01TimMchellofunk: Justin, justin justin! Justin justin justin justin?
14:02TimMcJuuuusssttin justin justininininin inJUsJ jj iuuuststisint n SnisTUisnSNSnuNNSSSSSSjJjjjjjjjjjjjjjjj
14:02TimMcWe now return you to your regularly scheduled chat.
14:02postpunkjustinCan I help you?
14:02hellofunkthis must be Being John Justin
14:03TimMcSponsored by: Nyquil
14:03hellofunkliterally
14:06gfredericksluxbock: nested use of ` confuses the crap out of me and I try to avoid thinking about what it means
14:07noonian^ this
14:07tbaldridgeluxbock: create the symbols by hand via gensym and then unquote them in
14:07tbaldridge,(gensym "foo")
14:07noonianluxbock: like this? https://www.refheap.com/97008
14:07clojurebotfoo27
14:08luxbockthanks
14:08luxbockI have a few macros that are almost identical except for a few changing bits, so I wanted to try to create a template
14:08luxbockbut this is so hard to read now that it's probably not worth it at all
14:09TimMcExample of using gensym for this: https://github.com/timmc/handy/blob/handy-1.7.0/src/org/timmc/handy.clj#L7
14:10gfredericksluxbock: you could write a more general macro, and have your other macros expand to that
14:10gfredericks~macros
14:10clojurebotI added a ~' and it worked.
14:10gfredericks~macros
14:10clojurebotmacros are like dessert
14:10gfredericks~macros
14:10clojurebotmacros are just a game with symbols
14:11gfredericks~macros
14:11clojurebotI added a ~' and it worked.
14:11luxbockI actually did just add ~' and it worked hah
14:11justin_smithgfredericks: clearly in this case it would be ~'~' due to the nested ``
14:11justin_smithlol
14:26crash_epHas anyone in here used Reagent?
14:30TimMcIt is unlikely that no one has.
14:38kiwitobesI've played with it, haven't built anything big yet
14:52crash_epkiwitobes: in Reagent, component fns can either return a Reagent component data structure (the nested vector stuff) or a function that returns a component. I'm not clear on why one might choose the latter. Got any idea?
15:17kiwitobesI think it's so you can set up local state. If you check the "Seconds Elapsed" example on the reagent homepage you can see how you don't want the atom resetting each time
15:17kiwitobesThe function gets returned with a reference to the atom, but it doesn't set it back to zero every time it's called
16:16crash_epkiwitobes: ah, makes sense. thanks!
16:26hyPiRion,`#=(symbol "#")
16:26clojurebot#<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.>
16:27hyPiRionahh boo
17:09nort_From a name of a method retrieved from clojure.reflect, how can I actually use the method name to call it on the object I just did the reflection on?
17:18joegallowell, my understanding is that clojure.reflect is more about telling you what fields and methods and stuff there are, but that actually invoking them is left as an exercise for the reader...
17:19joegallowhich, assuming you're on the jvm, means that you'd use that method name you just found as input into the ordinary reflection mechanisms of the underlying platform -- or that you use some kind of library that does such things on your behalf
17:21justin_smithnort_: there is a way to actually get the method and apply it from the reflection results, I recall an example amalloy had of doing that to reset the value of one of the integers
17:21nort_joegallo: hmm ok. So it is dependent on the platform? I am indeed on the jvm. So there is no standard way of calling a method from, say, a string?
17:22joegalloi dunno, i'm just some guy on the internet :D
17:22nort_:)
17:23justin_smithnort_: you can do that via read-string / eval. But the reflection results should be usable for actually invoking the method. One sec, I think I have an example around here somewhere.
17:23nort_justin_smith: Okay, good to hear it's possible at least :)
17:23joegalloyeah, i'm interested in seeing this, too. i'm in the source for clojure.reflect, and nothing is jumping out at me
17:23joegalloread-string / eval is totally cheating, though :D
17:24nort_justin_smith: ah yeah, read-string / eval. Didn't think about that. But if it's a cleaner way, that would be cool
17:27nort_I have a large set of Java classes, each one describing a "signal" which each have different public fields. It's much more convenient to just represent them as hash-maps, that's the reason I want to use reflection instead of manually translating every class.
17:28justin_smithnort_: how about using bean?
17:28justin_smith,(bean (java.util.Date.))
17:28clojurebot#<NoClassDefFoundError java.lang.NoClassDefFoundError: Could not initialize class sun.misc.ProxyGenerator>
17:29justin_smitherr...
17:29justin_smiththat usually works :)
17:30RasterBurnwhat is the best way to take one sequence and, based on some conditionals, bucket the elements into N sequences?
17:30joegallo,(.hashCode "foo")
17:30clojurebot101574
17:31joegallo,(.invoke (.getMethod (.getClass "foo") "hashCode" (into-array Class [])) "foo" (into-array Object []))
17:31clojurebot101574
17:31joegallowhich looks bad, but it's not SOOOOO awful
17:34justin_smith(inc joegallo)
17:34justin_smiththat's actually pretty cool
17:34justin_smithRasterBurn: you could do some math and then use partition
17:34justin_smithRasterBurn: would you be keeping ordering?
17:34RasterBurnyes
17:35RasterBurnjustin_smith: hmm i like your idea. let me stew on it for a bit.
17:35justin_smith,(#(partition (/ (count % 4)) %) (range 20))
17:35clojurebot#<CompilerException clojure.lang.ArityException: Wrong number of args (2) passed to: core/count--inliner--4206, compiling:(NO_SOURCE_PATH:0:0)>
17:35justin_smitherr
17:35justin_smith,(#(partition (/ (count %) 4) %) (range 20))
17:35clojurebot((0 1 2 3 4) (5 6 7 8 9) (10 11 12 13 14) (15 16 17 18 19))
17:36justin_smithit would be a little odd with non-integer multiples I guess
17:36RasterBurn(inc justin_smith)
17:38nort_justin_smith: oh, bean is good! Thanks
17:39nort_joegallo: haha, thanks, I will look into that one too
17:39hyPiRionjustin_smith: perhaps use partition-all to avoid losing values?
17:39justin_smithhyPiRion: excellent point
17:40justin_smithin that case you want to round the count of the first arg up? maybe
17:43hyPiRionyeah, I think that would be the easiest
17:59hyPiRionjustin_smith, RasterBurn: https://www.refheap.com/97013 for a solid impl
18:00hyPiRionIt tries to distribute as evenly as possible, adding more to the first partitions if need be.
18:00RasterBurnhmmm
18:02RasterBurnyeah I think I'm asking wrongly. My seq is something like '({:a true :b true} {:a false :b false} {:a false :b true} {:a true :b true}). I want three seqs... one with all the :a == true, and another seq of the remaining elements having :b true, and a third with whatever is left over.
18:02hyPiRionoh, yeah, that's a different thing altogether
18:03RasterBurnIt's like a (cond) into a bunch of seqs
18:03hyPiRionyou could probably do something with group-by there, I guess?
18:03RasterBurni suppose... hmmm
18:03RasterBurnthat might be the best way. group-by, where f is a cond
18:04RasterBurn(inc hyPiRion)
18:05hyPiRion,(group-by #(cond (:a %) :a (:b %) :b :else :nil) [{:a true :b true} {:a false :b false} {:a false :b true} {:a true :b true}])
18:05clojurebot{:a [{:b true, :a true} {:b true, :a true}], :nil [{:b false, :a false}], :b [{:b true, :a false}]}
18:05hyPiRionor something
18:05RasterBurnyep
18:05noonian,(frequencies (mapcat seq [{:a true :b true} {:a true :b false} {:a false :b true}]))
18:05clojurebot{[:b true] 2, [:a true] 2, [:b false] 1, [:a false] 1}
18:06noonianah, want the actual elements
18:09justin_smithhyPiRion: #(cond (:a %) :a (:b %) :b :else :nil) is #(or (:a %) (:b %) nil)
18:09justin_smitherr, no, never mind :P
18:09hyPiRionjustin_smith: yeah, I almost did the same suggestion there :p
18:12whompis there any way to see the actual line number where an error occurred in intellij cursive?
18:16cflemingwhomp: What sort of error?
18:17whompcfleming, 5 lines above the line with the last closing parenthese, i accidentally wrote "(2 3)", but the line number was 5 lines too low
18:17whompthe line number given
18:18whompso i guess it just treats the whole thing as one big call, and gives the last line of the call
18:18cflemingwhomp: I think that's a Clojure thing unfortunately - occasionally the line numbers of the errors are not always very accurate
18:18whompbut you can't get a good stack trace, either. what happens with a big project and an error pops up?
18:19whompcfleming, ^
18:20cflemingwhomp: You fish around until you figure out the problem
18:20cflemingwhomp: More or less.
18:20cflemingwhomp: Unfortunately unless Clojure gives accurate error line numbers, there's not much more you can do.
18:21whompcfleming, couldn't they just fix that by providing a better stack trace or better ide support?
18:21whompi don't see how a language can have that problem inherently
18:22cflemingwhomp: I think it's to do with the line numbers Clojure emits in the bytecode, although I don't know the details I must admit
18:22cflemingwhomp: I do remember seeing a JIRA issue that was hopefully going to fix a couple of cases in 1.7
18:22whompok, thx :)
18:24cflemingwhomp: http://dev.clojure.org/jira/browse/CLJ-1561
18:24cflemingwhomp: http://dev.clojure.org/jira/browse/CLJ-1568
18:44sritchiednolen, or anyone else w/ cljs fu - I’m trying to call goog.base from within a clojurescript file, and getting an error in advanced compilation
18:45sritchiehttps://gist.github.com/sritchie/a8f51c104d6c0b522a4d
18:46sritchiebasically, this line: (goog/base (js* "this"))
18:46sritchieis generating var G__183483 = this;return goog.base(G__183483)
18:46sritchiewhich throws this closure compiler error: ERROR: JSC_BASE_CLASS_ERROR. incorrect use of goog.base: First argument must be 'this'. at /Users/sritchie/code/clojure/racehub.com/resources/public/assets/generated/racehub/om/router.js line 520 : 104
18:46sritchiethe first arg is indeed “this”
18:47hiredman_sritchie: have you tried using this-as or whatever it is called
18:48hiredman_I mean, I guess it just does that, so in theory it wouldn't fix anything
18:48sritchieyeah, I was following this example, which stated that this-as fails for advanced compilation
18:48sritchiehttp://www.50ply.com/blog/2012/07/08/extending-closure-from-clojurescript/
18:48sritchieI’ll try it again - I’m looking at the closure compiler source, and it looks like it “this” has to be passed directly
18:48sritchieyeah
18:51hiredman_I blame bbloom and all his talk of a-normal forms
18:52sritchie:)
18:52bbloomi take no responsibility for anything
18:54sritchiemaybe allowing js* to take over more code will help....
18:54sritchiehmm
18:58hiredman_most definitely
18:58jinagaranonoir.session/put! doesn't seem to store any values. i'm using ring.middleware.session.memory as a store, i don't get any errors, and everything else works fine - only those values keep disappearing. does anyone have an idea what could be the problem?
18:58hiredman_the clojurescript compiler is hoisting the (js* ) in to a local for whatever reason
18:59justin_smithjinagarano: with ring.middleware.session all you need to do is association :session {...} to the response, and that will be the contents of the session
18:59justin_smith*assoc
19:00hueypwhats the correct way to test if something implements a protocol? I'm doing (instance? IMyProtocol x) but it throws exceptions if I pass it a map (PersistentArrayMap cannot be cast to java.lang.Class)
19:01justin_smithjinagarano: this does require using the map form of the ring response though {:status N :body (render ...) :session (assoc (:session request) ...)}
19:02noonianhueyp: satisfies?
19:02noonian,(doc satisfies?)
19:02clojurebot"([protocol x]); Returns true if x satisfies the protocol"
19:02hueypthanks :)
19:02nooniannp :)
19:03hiredman_https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/analyzer.clj#L1566 lifts arguments that are not "atomic" in to locals before analyzing a function call
19:04hiredman_classic a-normal form, and in my brain some how clojurescript+anf=bbloom
19:05jinagaranojustin_smith: i was following along with "web development with clojure" and i've never actually used the map forms. what exactly does (assoc (:session request)) do?
19:06noonian(:session request) returns the session map
19:06justin_smithjinagarano: the request comes in with any existing session
19:06noonianassoc adds a key to a map
19:06noonianso that form adds a key to a session
19:06justin_smithjinagarano: the idea is that instead of using put! to mutate the state of the webapp, the session comes in as a key on the request, and is also returned as a key on the response
19:07noonian(assoc (:session request) :authenticated-with :oauth) for example
19:08jinagaranooh, now i understand.
19:57javjarferHey there! Anyone can say to me why a function passed as parameter can't be evaluated inside a let expression?
19:58hiredman_clojure's eval doesn't evaluate an expression in the current lexical scope
19:58hiredman_it evaluates expressions as top-level forms
19:59thsigHey guys, what's the standard practice for shared clojure libs on a development machine? Let's say I have 10 clojure projects with a lot of common dependencies - in such a case, do people just install everything from scratch for each project using lein, or share the most common libs?
19:59javjarferi used the parenthesis instead of explicit "eval", it is the same?
19:59amalloyjavjarfer: hiredman_'s answer is right if by "evaluate" you mean "call the eval function"
20:00amalloyif you mean something else, then it's not really clear what you mean
20:00hiredman_thsig: lein keeps jars .m2 (just like maven) and it is shared between projects
20:01thsighiredman_: Ok, good to know - thanks!
20:01hiredman_javjarfer: easiest way to show us what you mean is to put code + error in a pastebin
20:03javjarferhiredman_: okay
20:07javjarferhiredman_: here it is http://pastebin.com/McuUZ50y
20:07javjarferhiredman_: imagine instead passing (buffer gurl)
20:08hiredman_what about the error?
20:08hiredman_well
20:08hiredman_I suspect I know what the error is anyway
20:08hiredman_or maybe not
20:08javjarferhiredman_: you just pass buffer, and you evaluate it inside the let expression like this (let [lin (. (rd gurl) readLine)]
20:09javjarferka bum! evaluation never ends
20:11hiredman_well, that definitely has nothing to do with evaluating functions passed in as arguments
20:12hiredman_javjarfer: if I had to guess I would suspect your call to .readLine is never returning for some reason
20:14hiredman_(so put in some printlns or use a stepping debugger or whatever)
20:14javjarferhiredman_: i though, and it was just a guess, that like i was doing it inside a recursion and things declared inside let are not variables, they are preserved as values, that the function is just called once, and that keeps you in a infinite loop
20:14javjarferhiredman_: could be a correct guessing?
20:14hiredman_no
20:15javjarferhiredman_: nice, short answer xd, i will try to check with the debugger and see what is happening there, thank you
20:15hiredman_but there are way better ways to do what you are doing regardless of what the issue is with this, look at line-seq or (heaven forbid) slurp
20:16javjarferokay, i will check, i was just doing it for fun and i found this
20:17javjarferhiredman_: thank you
20:34javjarferhiredman_: i think i got it, just in case you are curious
20:36crack_userhello guys
20:44audiodudeHello. I have the following warning message at the top of my REPL created with Emacs "M-x cider-jack-in": http://pastie.org/9893686
20:45audiodudeI’ve created the ~/.lein/profiles.clj file with the contents specified here: https://github.com/clojure-emacs/cider#using-leiningen
20:48justin_smithaudiodude: replace "0.8.2" with the version cider needs (which is "0.9.0-SNAPSHOT")
20:48justin_smiththere is an old and stupid bug that makes it ask for a version with lower case, which does not exist, so you need to fix it to be all caps
20:50audiodudeI tried changing the profiles.clj line to "0.9.0alpha", then I get this: http://pastebin.com/D8Hk2dNP
20:50justin_smithaudiodude: that's wrong
20:50justin_smith"0.9.0-SNAPSHOT"
20:51justin_smith0.9.0alpha is the cider version, 0.9.0-SNAPSHOT is the nrepl middleware version
20:51audiodudejustin_smith: awesome that works, thanks!
20:52imanc_is defrecord a commonly used data structure or is it used to interop with java? Sort of freaks me out that it is (or appears to be) creating a java class
20:52justin_smithimanc_: fn creates a java class
20:52justin_smithimanc_: so does defrecord
20:52justin_smithbut it is not for java interop
20:52imanc_ahh OK
20:52justin_smithlot's of things compile down to classes
20:53justin_smith*lots
20:53justin_smithwell, not strictly to a "java class" - the clojure compiler emits jvm bytecode that creates a class
20:53imanc_justin_smith: seems you're never too far away from the underlying jvm
20:54justin_smithimanc_: that's actually a good thing most of the time
20:54justin_smithimanc_: the alternative would be some kind of state machine / meta circular evaluator, and we'd get worse performance than ruby
20:55justin_smithhttp://en.wikipedia.org/wiki/Meta-circular_evaluator
20:57justin_smithwell, that page claims clojure is meta-circular, but it's really not. It uses some of the ideas though, for sure.
20:59imanc_that makes sense - how does clojure compare to ruby and python in terms of speed?
20:59justin_smithabout 1 and 2 orders of magnitude faster, respectively
20:59TEttingerjustin_smith: ruby's faster than python now?
21:00justin_smithoops, wrong order, my bad :)
21:00TEttingerI was wondering...
21:00TEttingerit also depends what you're doing
21:00justin_smithyou can theoretically get identical performance to java, but idiomatic code is likely about 1/10 java speed
21:01justin_smith(in clojure that is)
21:01TEttingeralso about 1/10 the code length :P
21:01justin_smithtrue dat
21:01TEttingermaybe 1/5
21:02amalloyjustin_smith: i don't think you can theoretically get identical either, because the compiler does some dumb stuff like repeated checkcasts
21:02amalloybut it's close
21:03justin_smithinteresting
21:03TEttingerI'm not sure how LuaJIT compares to whatever the current normal Python impl is, or Ruby for that matter
21:04amalloylike uh, (let [^String x (whatever)] (repeatedly 10 #(.length x)))
21:04amalloyi think that stores x as an Object in the closure of the lambda, and casts it to a string every time the function is called
21:04amalloyinstead of storing it as a string
21:04TEttingerI remember doing some tiny benchmarks and luajit did surprisingly well vs. MSVC++
21:06justin_smithyeah, lua is like tcl in that you wouldn't think it would be fast, but sometimes it really is if you hit the sweetspot
21:06justin_smithand not at all like tcl in that it has a sane syntax etc.
21:06TEttingerthe JIT on LuaJIT is bananas, just amazingly good
21:06justin_smithin tcl it's super optimized string handling, and most of the language being implemented in terms of said string handling
21:07crack_usersomeone who ever used the java.jdbc clojure wrapper can say who it manage the connection pool?
21:07TEttingerah, yeah regexes are lua's main weak point in speed
21:07justin_smithcrack_user: there is no pooling unless you provide a pool implementation
21:07TEttingerlua doesn't have true replacement regexes
21:07justin_smithcrack_user: there are some decent wrappers for c3p0 for connection pooling
21:08crack_userjustin_smith: if I call consecutives "insert!" it will create a new connection for the tdatabase to each call?
21:08justin_smithunless you create a connection pool, or put them into one action, yeah
21:08justin_smithbut the connection pooling is very easy to use
21:08justin_smithit's just not in there by default
21:09crack_userjustin_smith: I am think how it can be implemented
21:09justin_smithcrack_user: there's libs that do it, they will describe how to provide the pool to jdbc
21:09justin_smithit's simple
21:10justin_smithcrack_user: https://github.com/niwibe/clojure.jdbc-c3p0
21:10crack_userjustin_smith: like I have to share some global state who will hold the connection?
21:11justin_smithcrack_user: no, the pool is added to the same connection data that you provide to the query function already
21:11justin_smiththe github page shows how to use it
21:11crack_userjustin_smith: I will check that
21:13crack_userjustin_smith: lol, its very simple
21:13justin_smithlike I said!
21:13crack_userjust replace the database configuration to use the c3p0
21:14crack_userI need to do some ensure that the connection was closed at the end?
21:15justin_smithcrack_user: the vm will clean it up I think
21:40lvhI'm trying to write integration tests for some code that makes HTTP requests using core.test. fixtures seem like the obvious choice, but there's no obvious way to make some things i instantiate available to the test. Am I just supposed to def some module level vars?
21:42justin_smithlvh: the fixture can bind a dynamic var
21:42lvhoh, right, cool.
21:53amalloyjustin_smith: i prefer: "In the future, we'll be able to bind dynamic vars. And our cars will fly!"
22:00justin_smithhaha
22:13teh_pwnererlein new play-clj creates a play-clj project. in the android/libs folder there are several libgdx libraries. do i need to commit these to source control?
22:14teh_pwnererthe libraries are not listed in the play-clj template's included gitignore
22:15TEttingerteh_pwnerer: they should get downloaded by lein, so they should probably be gitignored
22:17teh_pwnererTEttinger cool thanx
22:17justin_smithprobably the whole android/libs folder right?
22:17teh_pwnererya i will just ignore the entire android/libs folder. and the equivalent ios folder
22:19TEttingerI kinda am not sure if RoboVM even works with clojure right now
22:19TEttinger(iOS you can only build on macs anyway)
22:19teh_pwnereractually the game im making is going to be desktop only, i just want to use play-clj. so i will just delete the android and ios libs since i wont build for them anyway
22:20TEttingererr
22:20TEttingerandroid has the content folder, teh_pwnerer
22:20teh_pwnerero oops
22:20TEttingerI think you may need to keep android, iOS can go
22:20teh_pwnererok ill just erase ios
22:42ibashHowdy
23:45sdegutisIs there a statically typed, type-safe language with similar concepts to Clojure besides Haskell or OCaml?
23:45justin_smithsml
23:45justin_smith(which is similar to ocaml, but there are a few flavors, and it doesn't have the OO part)
23:45sdegutisBesides SML?
23:46justin_smithtyped racket?
23:46sdegutisAh, thanks.
23:47justin_smithalso, there is ats which is super weird but definitely statically typed
23:47justin_smithatsII is the current version last I checked
23:47justin_smith(super weird, as in the lang is a huge bundle of macros implementing hindley/milner plus dependent types that compiles to C)
23:48justin_smithand some of the macros have really weird names
23:54Blake1Tempted to rewrite some old (Pascal!) code in Clojure. It dealt with (essentially) typed files.
23:55sdegutisBlake1: Sounds more like a job for Haskell.
23:56Blake1But it was all based around physical data properties.
23:56Blake1sdegutis: Haskell? How so?
23:56sdegutisBlake1: well if it's typed, Haskell is great at types
23:57Blake1sdegutis: Well, here's the thing: it was a sort of combination of pseudo- and meta- typing.
23:58Blake1Like, I didn't use Pascal's typing, except for code structuring. (It's object Pascal.)
23:58sdegutisBlake1: Sure. Any language can do the job fine. I'm just saying, Haskell is especially great when dealing with parses and types.
23:59sdegutisBlake1: but heck, you can probably do it in ClojureScript if you want, and then it'll even run in the cloud
23:59Blake1The system itself enforced its own typing. So, e.g., the Boolean type was literally a bit under the covers, but presented itself as any designation of true/false yes/no whatever/whatever.
23:59Blake1sdegutis: Clojurescript! That would be kind of wild.