#clojure logs

2012-11-26

00:29devnMadison Square Clabango
00:30dnolenwow can finally round trip js html 5 source map to CLJ data structure and back to js html 5 source map
00:30devn!
00:30devnthat's great
00:31dnolenyes so damn close now
00:31dnolenjust need to merge CLJS compiler map w/ closure map ...
00:31devndnolen: recently i started working on a client project and found they're using google closure
00:31devni just about jumped out of my seat
00:31devnmy first experience with gclosure outside of clojurescript
00:32dnolenmost obnoxious 80 lines of Clojure I've ever written ... grumble
00:32devn:)
00:32devndnolen: any ideas on cutting it down to size?
00:32devnor is it necessarily large?
00:33dnolencutting what down to size?
00:34devnthe 80 lines
00:34dnolenmaybe but I don't want to work on it anymore, I've already spent a few days on it - it works
00:35devndnolen: is this (https://github.com/devn/codeq-playground) wortwhile at all, do you think?
00:36dnolendevn: yeah that looks pretty awesome - hope to find some time to actually try it out.
00:36devni was thinking about having an open project which is just a bunch of codeq queries
00:36dnolenI think that's super useful - seeing as hardly anyone knows how to use codeq :)
00:36devnhaha, well partly this came about as i was trying to write some docs for the codeq wiki
00:37devni think the hardest part of the whole thing is just the packaging of datomic
00:37devni wish we had `apt-get install datomic` and `brew install datomic`
00:37devni wrote a formula, but the hombrew guys said "ewww"
00:37devnand rightly so
00:37devnhomebrew*
00:37devnbin/* contains a lot of stuff
00:38devni still need to figure out how to fill out the codeq wiki, but im thinking we need a sort of clojurescript-esque approach until packaging is taken care of
00:38devn./script/get-datomic, etc.
01:00bbloomdnolen: w00t on source maps
01:00bbloomdnolen: are they playing nice with the web kit sources tab yet?
01:11dnolenbbloom: not quite there yet, putting in the finishing touches now
01:12dnolenbbloom: hardest thing was just making sure we could encode and decode and get the same thing
01:13nightfly_aw hell, are there times where you have to manually macroexpand when making a macro that will have other macros nested inside of it when invoked?
01:14bbloomdnolen: cool. i'm starting to write more and more cljs code outside of the compiler itself
01:14bbloomdnolen: would really enjoy the source mappings :-)
01:15dnolenbbloom: yes, yes, I know :)
01:16bbloomdnolen: I'm really liking the way my little dom manipulation library is shaping up. it's taking longer than i expected but the result is more and more enjoyable
01:17bbloomdnolen: I actually have a working prototype where i have some code of pure functions which returns a (what i'm calling) DomScript program
01:17bbloomdnolen: then there is an interpreter that executes that program on a stack machine DSL. that same program can be printed, sent to the server, and send back down to another browser :-)
01:17bbloomso i can mirror browser manipulations on other browsers :-)
01:18bbloomit's pretty damn neat
01:19bbloomdnolen: slightly more awkward to use than domina or jquery for small cases, but far nicer to work with for larger dom transformations
01:21dnolensounds interesting - looking forward to a write up
01:23bbloomdnolen: i'm probably gonna write it up and release it in pieces, starting with the stack language
01:23bbloomdnolen: it's heavily inspired by www.factorcode.org
01:29tomojnightfly_: I've done that sometimes
01:37jyudoes anybody share why you use datomic?
01:44wingyjyu: its db done correct
01:48jyuthe free version cannot integrated with infinispan and so on, I might not be able to use in the real world if the company does not want to buy the commercial one.
01:49wingyjyu: its ridiculous that they don't wanna pay for good techs
01:49wingyit's like wanting to use heroku but not wanting to pay for it
01:51bbloomwingy: I agree that people should want to pay for good tech, but i don't think it is wise to build a business on top of somebody's closed source software
01:52wingybbloom: i agree on that one .. they should definitely open source it
01:52bbloomwingy: I wouldn't build my business on a closed source database, simply because I've seen several older businesses become hilariously dependent on insane implementation details of Oracle
01:52p_lwell... is it their core money bringer?
01:52bbloomwingy: meanwhile, oracle just keeps jacking their licensing fees
01:52p_lbbloom: that's Oracle-specific problem, actually
01:53bbloomp_l: no it isn't
01:53bbloomp_l: I used to work for microsoft
01:53bbloomp_l: I've seen it plenty of times
01:53bbloomp_l: you should not build your business on closed source software
01:53bbloomperiod.
01:53bbloomp_l: or, let me clarify
01:54bbloomp_l: it can be "closed" source, as long as i get a copy of the source when i buy it
01:54bbloomp_l: and if you go out of business, i can carry on with the code base
01:54bbloomand you can't just keep jacking the licensing costs annually
01:55wingywhen i add (file/wrap-file "public") as a middleware Light Table says it cannot find folder "public" .. this is a path related issue .. how can I fix this so public can be found?
01:55p_lbbloom: well, I know less about MS, but afaik Oracle and MS SQL got the craziest licensing all-around, with SQL Server usually getting ahead by "being cheaper than Oracle"
01:55bbloomp_l: which isn't cheap :-P
01:55p_las for Oracle... Ellison makes money sharks look like generous fuzzy kittens
01:55bbloomheh.
01:56bbloomthe point is: datomic is super mega awesome cool
01:56wingyI don't like that dude .. he thinks he owns the world
01:56bbloomand i'd happily pay rich hickey and company money for datomic and all the other cool stuff they've done
01:56bbloombut i won't build a business on datomic unless i can be sure that it's not undue business risk
01:56p_lbut they need to make a source license as well?
01:56wingybbloom: me too .. tell them to open source it!
01:57p_lwingy: you should not open source the core money bringer without very careful planning
01:57bbloomp_l: I dunno, consider Havok Physics engine
01:57bbloomit's a pretty popular middleware system
01:57bbloomused by LOTS of AAA games
01:57wingylook at mongodb .. its pretty awesome business model
01:57p_lOTOH, if you open source it with AGPL, I'm flat out calling you for being money grubbing license terrorist
01:57bbloomeach license comes with the source code
01:57bbloomi like the havok model
01:58bbloombut games are a little easier
01:58p_lbbloom: gamedev stuff usually comes with source code, outside of big complete engines with "lite" licenses for just binaries
01:58bbloombecause your license covers "titles"
01:58bbloomtitles generally have a discreet ship date
01:58bbloomso your business isn't locked in for the next title
01:58bbloomservices are generally a little different
01:58bbloombecause you don't have a gold master print it to DVD version of a web service
01:58p_lbbloom: not only that, it's just that in gamedev, you often *need* the source to get the project to build, let alone fly :)
01:58wingyshould i use wrap-resource instead of wrap-file for Light Table to be able to find the folder?
01:59wingybbloom: when a company goes down they won't outsource the code?
02:00wingyi mean open source it
02:00bbloomwingy: no, generally not
02:00p_lwingy: depends on how they go down
02:00wingyso all clients are just fucked? hmm
02:00bbloomwingy: I sold my company to salesforce
02:00bbloomwingy: salesforce owns the software
02:00p_lSymbolics for example... No one fucking knows who got copyright to what
02:00bbloomwingy: lots of people have asked me to open source it, but that's just not my call
02:01wingyi guess it depends on what the buying company is indenting to do with the software .. kill it .. or taking over it
02:01wingybbloom: what was your company?
02:01bbloomwingy: http://www.crunchbase.com/company/thinkfuse
02:02wingygj
02:02bbloomthx
02:02bbloombut that's why you can't depend on closed source software
02:03bbloombecause even if you trust the current stewards, they might not be the stewards forever
02:04bbloomthat said: datomic is super fucking cool
02:04bbloomand i'd love to be able to use it for a real project :-) i'm even willing to pay, heh
02:05wingyrich and the team behind seem to be reasonable .. perhaps they have plans of open sourcing it
02:05brainproxydnolen: now that fressian is open source, is it something you'll be looking to leverage w/in core.logic?
02:06bbloombrainproxy: what's fressian?
02:06brainproxybbloom: https://github.com/Datomic/fressian
02:07brainproxyit's the binary data library used interally by datomic
02:07bbloombrainproxy: interesting
02:08bbloombrainproxy: am i right in assuming BISON : JSON :: Fressian : EDN ?
02:08brainproxyi think that's the basic idea
02:09bbloominteresting
02:09p_lbbloom: personally, for "breadwinner" code, I wouldn't "open source" it, but give exclusive licenses to source code for my customers
02:10bbloomp_l: yeah, that's what i'm saying
02:12p_lOTOH, I once had a very, very evil idea on how to "open" some source code
02:12p_lprovide the code, but not the compiler or language spec :>
02:15bbloombrainproxy: how does it relate to core.logic tho?
02:23jyuwhat make the datomic special
02:25bbloomjyu: there are a bunch of videos on the datomic site
02:25bbloomjyu: watch them :-)
02:26bbloomjyu: and http://www.infoq.com/author/Rich-Hickey too
02:26jyubbloom: thanks
02:26brainproxybbloom: I remember dnolen saying something about how fressian gave datomic's datalog performance characteristics that would not be easy to match w/o something similar
02:27bbloombrainproxy: hmm
02:28brainproxybbloom: i may have misunderstood that comment/observation
02:28Nocabbut some of the things Id like to try in clojure depends on local mutable state inside functions
02:28bbloomNocab: you can create atoms and use swap! or reset!
02:28Nocabis there are conventional or idiomatic way to do that in clojure?
02:28brainproxyNocab: setup an atom w/in a let
02:28bbloom(doc atom)
02:28clojurebot"([x] [x & options]); Creates and returns an Atom with an initial value of x and zero or more options (in any order): :meta metadata-map :validator validate-fn If metadata-map is supplied, it will be come the metadata on the atom. validate-fn must be nil or a side-effect-free fn of one argument, which will be passed the intended new state on any state change. If the new state is unacceptable, the validate-fn should return fa
02:28bbloomer:
02:28bbloomyeah, ok apparently that works without , or &
02:29bbloomhaha
02:30brainproxyNocab: leiningen is your friend in that regard, if you don't have it setup already
02:31brainproxysimple as `lein repl`
02:31Nocabbrainproxy: can the atom be anything? am I reading this correct, if I assume the atom here is a mutable map?
02:31Nocabhttp://clojure.org/atoms
02:31Nocabbrainproxy: no worry
02:31brainproxyNocab: you can stick what you want inside the atom
02:31NocabI do have lein and sublime-text setup reasonably well :)
02:31brainproxythen use reset! or swap!
02:32Nocabhttp://clojuredocs.org/clojure_core/clojure.core/reset!
02:32Nocabthis page seems to have all my needs covered
02:32Nocabthanks :)
02:32brainproxyif you use swap!, then w/in the fn you pass as an argument, you'll likely use "regular" immutable semantics for operating on, say, a map you have stored in the atom
02:32Nocabmmm
02:32brainproxyand yeah, clojuredocs is nice
02:33brainproxyhttp://clojuredocs.org/clojure_core/clojure.core/swap!
02:33Nocabso
02:33brainproxyif you're planning on sticking a hash-map inside your atom, then swap! is probably the way to go
02:33Nocabmmhm
02:34Nocabas for something completely different
02:34Nocabanyone here use sublime-text for their clojure needs?
02:34brainproxyemacs24 ftw! :)
02:34NocabI have pretty much -everything- setup as I like, but I cannot get the sublimerepl plugin to work properly
02:34Nocabbrainproxy: I tried that setup, its OK. but I sublime-text has won me over quickly ;)
02:34bbloommostly emacs and vim guys around here :-)
02:35bbloomsublime is pretty tho, that's for sure
02:35Nocabit just feels more lightweight and nimble than emacs
02:35Nocaband its available for all the platforms I care about, so Im giving it a spin ;)
02:36brainproxyi reach for BBEdit when I'm feeling lazy and don't want to take time to figure out how to do something w/ my emacs
02:36Nocabheh
02:41tomojbbloom: what do you think of having a special kind of future-promises (I'm calling them "tasks") that bind themselves into their dynamic scope so that tasks created inside that scope will be failed when the parent task fails?
02:42bbloomtomoj: I'm too tired to deeply consider this problem now :-P
02:42bbloomtomoj: ask me again tomorrow :-)
02:42tomojno prob
02:42bbloomi do find this stuff interesting tho
02:42tomojhopefully I'll have a fork of cljque with that working tomorrow
02:48Nocabtomoj: sounds like C#'s TPL ;)
02:50bbloomNocab: it's exactly like C#'s TPL
02:50bbloomNocab: the C# guys deserve a lot of credit for their work on parallel and reactive libraries
02:51bbloomin general, the C# team has done a stellar job of neatly packaging brilliant ideas from cutting edge and sadly forgotten better-is-better tech of yore
02:51Nocabheh
02:51NocabI like C#
02:51bbloomi do to, i much prefer it to java
02:51Nocabthe thing I like -least- about C# is the lacking type-inference in the compiler
02:51Nocabit cant infer return types
02:51bbloomi blame C# 3 and Linq for getting me into functional programming :-)
02:52Nocabmaking you have to declare a billion generic type-signatures if you want to do any sort of cool funcitonal programming
02:52Nocaband then all those type-signatures removes all the gain the functional programming would have gotten you code wise
02:52Nocabthat sort of stuff annoys me
02:52bbloom*shrug* it's not for you :-)
02:52Nocabbut I may be using C# in other ways than Anders Heljberg anticipated :P
02:53bbloomthe goal of C# is to drag cube moneys half way around kicking and screaming to lisp
02:53Nocabhah
02:53bbloomit accomplishes that mission quite well
02:53Nocabanyway. care to tell me what Im doing wrong here?
02:53bbloommoneys -> monkeys
02:53Nocabhttp://pastebin.com/nQTp8rKP
02:54bbloom1) use refheap :-)
02:54tomoj2) whitespace :P
02:54bbloomreset! isn't being called
02:54bbloomyou need () around that
02:55Nocabindeed
02:55Nocabmy bad
02:55Nocabit was initially written as a #() lambda
02:55Nocabso I guess I forgot to re-wrap it when rewriting it :)
02:55Nocabthanks
02:55bbloomentertainingly
02:55bbloomthis thing you're making
02:55bbloomwith get and set
02:55bbloomit's basically the same as the underlying atom it's wrapping :-P
02:56Nocabthis is just a simplest-possible function-local mutable structure POC for me, myself
02:56bbloomyup, it's totally reasonable for learning
02:56Nocabnow that I see it's working, I can expand it to be useful ;)
02:56tagrudevhello, I've cloned this repo -> https://github.com/stuarthalloway/programming-clojure and now I am trying to require the examples in src/examples, how can I do this ?
02:57tagrudevin repl
02:57bbloomtagrudev: are you using `lein repl`?
02:57tagrudevyes
02:57bbloomtagrudev: or rather, ./script/repl here?
02:57tagrudevlein repl
02:57bbloomk
02:58bbloomuse:
02:58bbloom(doc require)
02:58clojurebot"([& args]); Loads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, or a flag that modifies how all the identified libs are loaded. Use :require in the ns macro in preference to calling this directly. Libs A 'lib' is a named set of resources in classpath whose contents define a library of Clojure
02:58bbloomexamples on clojure docs
02:58bbloomhttp://clojuredocs.org/clojure_core/clojure.core/require
02:59Bergle_1noob question. [this is extracted from something else]. Why doesnt this work -- (doseq [[y] (range 10)] (println y))
02:59Bergle_1get error - nth not supported on this type
02:59bbloomBergle_1: the [y] binding is trying to unpack a vector
03:00bbloomdoseq inherently unpacks a sequence
03:00Bergle_1oh duh.
03:00bbloomyou want (doseq [y (range 10)] (println y))
03:00Bergle_1i chased my tali for 30 min now on that
03:00Bergle_1thankyou
03:00Bergle_1i knew it had to be soemthing dumb.
04:15cgrandmorning @cemerick
04:16cemerickcgrand: good morning! :-)
04:16clojurebotCool story bro.
04:17HolyJakwhich reminds me, cemerick, I've recently seen your Intro to Clojure screencast with url shortener, great job! I'm recommending it to all participants of our recent clojure intro workshop :-)
04:17cemerickcgrand: I see you've been tinkering with map perf and such. What's prompted that?
04:17cemerickHolyJak: Glad you liked it :-)
04:19cgrandcemerick: profiling/optimizing on a client project
04:20cemerickThat's great. I had no idea you had snagged work that involved Clojure.
04:24cgrandcemerick: well my legacy (and local) clients are non-clojure as you know but for years now I have had Clojure gigs
04:25cemerickHuh. I suppose I forgot, if I knew that already.
04:28xumingmingv,(type (int 10))
04:28clojurebotjava.lang.Integer
04:28xumingmingvfound an interesting thing
04:29xumingmingvif you execute this form: "(type (int 10)) " in a `lein repl` , the result will be "java.lang.Long"
04:30xumingmingvwhile if you execute the same form in the regular REPL, the result is "java.lang.Integer"
04:30xumingmingvanyone knows why?
04:33cemerickxumingmingv: your lein REPL is running 1.3.0, the "regular" REPL is running probably 1.4.0.
04:36xumingmingvyeah, that's indeed my situation..
06:13AnderkentIs there a way to tell clojure.pprint to print out meta? *print-meta* doesn't seem to work
07:36AnderkentAnyone know why defmulti checks whether the name is already def'ed? It messes up my code coverage tool attempts :P
07:36Anderkent,(source defmulti)
07:36clojurebotSource not found
07:37Anderkentgeh.
08:55hotwoofydoes anyone know if there's a convenient Slingshot selector syntax to match the data part of exceptions generated with ex-info? if i throw (ex-info "Error message" {:some :data}), then I can't seem to catch it with (catch [:some :data]). I can use throw+ to just throw just the map, I was just wondering if I was missing something about ex-info.
09:01konr_trabIs it possible to set an environment variable inside a lein plugin and then call another task?
09:16mccraigis there a stdlib function (i.e. not the (var…) special-form) which will return me a Var given a Symbol ?
09:16cemerickkonr_trab: env vars cannot be set within the JVM
09:16cemerickmccraig: resolve
09:17mccraigthx cemerick
09:52solussdi know this must exist… how can I add pre/post conditions to an existing function?
09:53solussdor rather, take an existing function and create the same function with pre/post conditions
09:55cemericksolussd: See https://github.com/clojure/core.contracts and https://github.com/fogus/trammel
09:55solussdcemerick: thanks
10:17devinusamalloy: weren't you writing a titandb lib?
10:20googya(let [ {:keys [join-date email]} mm ] (println email)) how this work?
10:22googyaBinding values to their keys’ names?
10:22ucbgoogya: mm is destructured as a map and the values for the keys are bound to the key-names
10:24clojure-newbhey guys, I'm using ring-json-resonse to jsonify a single result item in the response… what do I use for a collection ?
10:25weavejesterclojure-newb: If you return a vector, ring-json-response will turn it into a JSON array
10:25weavejesterclojure-newb: Are you using the ring/ring-json library for this?
10:26clojure-newbweavejester: yes I am
10:26clojure-newb0.1.2
10:26weavejesterclojure-newb: So I usually use something like: (response (vec list-of-results))
10:27clojure-newbI see, 'vdc' is key here
10:27weavejesterclojure-newb: The reason it has to be a vector is because seqs are used for streaming in Ring.
10:27clojure-newb*vec
10:27clojure-newbsorry
10:27clojure-newbthx for the help
10:29clojure-newbweavejester: that explains why I was seeing the Transfer-Encoding: chunked header val
10:47jweissi see there are no issues remaining for the leiningen 2.0.0 milestone https://github.com/technomancy/leiningen/issues?milestone=3&state=open - does that mean the current preview release is 'pretty darn close' to a release candidate or actually a release candidate?
10:49bhenrycan anyone give me insight as to why the first run of this batch script gives a class not found error, but the second runs as expected? https://gist.github.com/59d8b537fcc5365341dc
10:50bhenrys/batch/bash
10:50antares_jweiss: it has been "pretty darn close" for a while. The remaining bits of work are now on the clojars side.
10:51jweissantares_: that's what i'm trying to figure out, if i upgrade will that missing stuff bother me?
10:52antares_jweiss: every open source project I know or use is already on lein2
10:52antares_clojars changes are relevant mostly for library developers
10:52jweissantares_: yeah, my project consists of several projects, some of which are libraries for others
10:54jweissi quite often push snapshots to clojars. just wondering if there's some problem i might hit in lein2
10:55uvtcjweiss: my understanding is that lein 1 is now legacy.
10:55antares_jweiss: I haven't seen any issues with snapshot publishing via scp
10:55antares_however, I do not consider myself to be completely on top of the clojars changes
10:55antares_so we will see
10:55AnderkentIs there something like clojure.lang.LineNumberingPushbackReader, but one that assigns ^{:line} to each token, not just lists?
10:55jweissuvtc: i don't understand how the 'stable' release is actually legacy but the 'current' release is still called preview?
10:55antares_but so far as a long time lein2 user and maintainer of over 20+ libraries, I haven't seen any issues
10:56jweissok, good enough for me to try it out :)
10:56antares_jweiss: it has been called "preview" for almost a year, at preview10 for over 1 month
10:57jweissantares_: i know, but that's not really as relevant as the fact that the stable release hasn't been re-pointed at it
10:57jweissthere must be some reason.
10:57uvtcjweiss: I think what happened was, lein 2 was meant to be released a while ago, but some issues regarding the new clojars have kept that from happening.
10:57jweissright, i'm trying to figure out what's blocking it and whether it'll affect me.
10:57uvtcjweiss: you might be able to get more specific details on #leiningen.
10:57jweissah didn't know it had its own channel
10:58antares_jweiss: clojars changes have to be finished first
10:58Anderkentbhenry: AFAIK it's a lein bug - it will output info about dependencies being fetched to stdout instead of stderr
10:58antares_because leiningen has a list of default repositories
10:59antares_and if you ship it, those repositories better work and not change
10:59Anderkentbhenry: so the first time you run, it prints out that it's fetching *some xml file*, and you put that in -cp, which breaks java
10:59Anderkentbhenry: the second time it's not fetching anything so the output is right
11:00bhenryAnderkent: so what's the cutoff for that to run. I figured it was soemthing like that, but then nothing changes and the next time the bash script runs i have to do it twice
11:02bhenryAnderkent: is it per session maybe?
11:22marcellu`anyone know what might be causing me to have to run lein clean again everytime I change my program? Sometimes it seems like I have to run it multiple times just to get it to work. Otherwise I get a "java.lang.NoSuchMethodError: clojure.lang.RT.keyword" error
11:25antares_marcellu`: this means something drags Clojure 1.2 on the classpath
11:26marcellu`antares_: OH ok, should be able to track it down, thanks!
11:28antares_marcellu`: are you using lein2?
11:28antares_if so, lein deps :tree may help you
11:28marcellu`antares_: yup. Thanks again!
11:28antares_marcellu`: and here is how to exclude dependencies of other dependencies, e.g. clojure: https://github.com/michaelklishin/monger/blob/master/project.clj#L35
11:28jweissanyone know the equivalent to slime's ,sayoonara in nrepl.el?
11:32marcellu`antares_: hmm Clojure 1.2 isn't in the tree at all. Would clojure-contrib 1.2 do it?
11:33S11001001jweiss: I would also like to know how to quit nrepl :)
11:36antares_marcellu`: monolithic Clojure Contrib is no longer developed
11:36antares_marcellu`: and won't work with 1.3 or 1.4. See http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
11:38S11001001~contrib
11:38clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
12:20jweissS11001001: nrepl-quit. not bound by default
12:21S11001001jweiss: neato
12:21S11001001:r
12:22TimMc< amalloy> (def exit (lazy-seq (System/exit 0)))
12:22TimMc=> exit ;; done!
12:22S11001001ha ha
12:57muhoowait, what?
12:57mdeboardI'm having a scope issue with the following code: https://gist.github.com/839618e9690db68fc89d The code "stamps" a PDF with a watermark (in this case, a "Copyright protected material" statement). I want to iterate through each page in the PDF, and have tried both `doseq` and `for` for this, but each time it's only stamping the final page. This smells like a scoping issue but I'm not quite sure how to resolve it. I'd
12:57mdeboard appreciate any guidance on this
13:01S11001001mdeboard: exchange the position of your with-open and doseq
13:01TimMcM-x paredit-convolute-sexp
13:01S11001001mdeboard: probably the my-pdf too needs to go outside the doseq
13:01S11001001mdeboard: everything inside the doseq happens *every time*
13:03mdeboardS11001001: If I swap lines 68 and 69, I get an "IOException Stream Closed"; closing the PdfStream object in `(fingerprint)` closes the stream apparently.
13:04S11001001mdeboard: then don't do that
13:05mdeboardS11001001: lol, yeah. I tried before; I'm pretty sure I do need to open up a new stream each time. At least, based on the C# code from which I'm porting this piece of ... software.
13:05S11001001mdeboard: then fix your loop so you open the previous output instead of the original input each time
13:06S11001001mdeboard: go through the logic of stamp-pdf carefully, tracing the loops with paper if you have to
13:06mdeboardS11001001: How so?
13:07S11001001mdeboard: see how you *always* open /home/matt/courseload/stillwaiting.pdf?
13:07mdeboardYeah
13:07S11001001don't do that
13:07mdeboardI see, that admittedly was a hack to get around another issue
13:08mdeboardAnd that issue was "com.itextpdf.text.DocumentException: The original document was reused. Read it again from file." (this is thrown if I remove that local binding of `my-pdf` on line 70)
13:09S11001001mdeboard: that's a binding completely eliminated by the compiler; it does nothing to have it in a let instead of inline as an arg to stamper
13:09mdeboardI see
13:10S11001001mdeboard: you probably saw that earlier error because you had the order of operations wrong due to the loop. What's there now isn't a fix, just a different problem.
13:11mdeboardS11001001: Well, even passing it as an arg... I wonder if I should just use agents... send them off, then after they've each run their course close them
13:11S11001001mdeboard: No.
13:12mdeboardThat is, I modified the signature of `(stamp-pdf)` to accept the PdfReader object as an arg; I still get that DocumentException
13:13S11001001mdeboard: The global my-pdf doesn't get reexecuted each time you reference it
13:14mdeboardS11001001: I gotcha; that is what I assumed to be the case. The symptom of the problem reminded me of e.g. [lambda: x + 1 for x in range(5)] in python or any number of scope issues in JS
13:14mdeboardS11001001: I changed the `(stamp-pdf)` function in line with your advice to https://gist.github.com/11b0e9efa44a67db8a0d and it works well, thanks much
13:15S11001001np
13:15mdeboardIt didn't make sense to me either that I'd need to open a new stream and create a new pdfreader instance on every iteration
13:16mdeboardI just couldn't close the loop so to speak
13:30borkdudeis there a function like (split-p [p coll] [(filter p coll) (filter (comp not p) coll)]) ?
13:30antares_borkdude: partition?
13:30borkdudereplace split-p by fn
13:31TimMc~separate
13:31clojurebotseparate is in clojure.contrib.seq-utils, but just use (juxt filter remove) instead
13:31borkdudeantares_ partition(-by) makes partitions depending on when the value of the predicate changes
13:31borkdudetimmc ok, not in core then I guess
13:32TimMc&((juxt filter remove) odd? (range 10))
13:32lazybot⇒ [(1 3 5 7 9) (0 2 4 6 8)]
13:33borkdudetimmc ok yes
13:33borkdudetimmc tnx
13:46borkdudecan this predicate be any shorter? #(= :keyword %) ?
13:47tomoj#{:keyword} is not quite the same but usually close enough
13:48borkdudelol, yes tnx
13:54borkdudedoes juxt have an equivalent in Haskell?
13:55josteinkhow do you generate an error in clojure?
13:55josteinkas in (error X) in scheme?
13:55S11001001borkdude: liftA2 (,)
13:55nDuffjosteink: I strongly suggest slingshot
13:56josteinksounds frameworkey
13:56nDuffjosteink: ...the built-in thing is http://clojuredocs.org/clojure_core/clojure.core/throw
13:56borkdudeS11001001 thank you, will look into that
13:56josteinkI just need a one-off failer :)
13:56S11001001josteink: it isn't.
13:56nDuffjoegallo: ...but slingshot gives you calls that feel more clojure-y
13:56josteinknDuff: thanks. that''ll do
13:56nDuffjoegallo: (and no, it doesn't place other demands on your design)
13:56technomancyex-info is a huge improvement over regular Exceptions though
13:57RaynesnDuff: He isn't joegallo.
13:58S11001001borkdude: if you're looking for a variadic version, that's called distribute.
13:58josteinkhehe
13:58tomojS11001001: what's *** for applicatives?
13:58borkdudesince when does it matter what person you are?
13:59S11001001tomoj: you'd need a newtype for that
13:59Raynestomoj: (foo *** bar) (x,y) = (foo x, bar y)
14:00S11001001tomoj: see Data.Functor.Product
14:01RaynesOh, for applicatives. I didn't realize it was a specific question.
14:01S11001001tomoj: I assume of course you're looking for Applicative f, Applicative g => Applicative (forall a. (f a, g a))
14:02KolmeChousukeaRaynes, I am three Chousukes
14:03KolmeChousukeaNew and improved
14:03S11001001borkdude: anyway, distribute can specialize to [a -> b] -> a -> [b], among many other things
14:03KolmeChousukeathe functionality of 3 in 1.
14:04S11001001tomoj: and I forgot about ***, thanks
14:06saolsencan extend-type be used to extend a java class with a java interface?
14:06dnolensaolsen: no
14:08oskarthanyone got the link to clojure conj 2012 text slides?
14:08saolsenI need to add a comparitor to byte-array, is there a good way to do that other than making a new class that implements Comparable?
14:08saolseni guess a new type in this case, not a new class
14:08S11001001saolsen: most sorty functions also take a Comparator.
14:09S11001001,(supers (class (fn [] 42)))
14:09clojurebot#{java.lang.Runnable clojure.lang.Fn java.util.concurrent.Callable clojure.lang.IObj java.io.Serializable ...}
14:09saolsen< and > dont :(
14:10S11001001,(supers clojure.lang.IFn)
14:10clojurebot#{java.lang.Runnable java.util.concurrent.Callable}
14:10S11001001,(supers clojure.lang.AFn)
14:10clojurebot#{java.lang.Runnable java.util.concurrent.Callable clojure.lang.IFn java.lang.Object}
14:10S11001001I will find this thing
14:10S11001001,(supers clojure.lang.AFunction)
14:10clojurebot#{java.lang.Runnable clojure.lang.Fn java.util.concurrent.Callable clojure.lang.IObj java.io.Serializable ...}
14:10S11001001,(drop 5 (supers clojure.lang.AFunction))
14:10clojurebot(clojure.lang.IMeta clojure.lang.IFn clojure.lang.AFn java.util.Comparator java.lang.Object)
14:35sandoveris there an approved way for someone outside the clojurescript project to log an issue?
14:36cemericksandover: anyone should be able to open a ticket
14:36sandoveron jira?
14:36cemerickyeah
14:36cemerickProbably best to raise the issue on the ML first.
14:37josteinkhow do I import a full namespace in a clojure file?
14:38josteinkjust... import as is without a need for prefixing
14:38nDuffjosteink: use does that.
14:38squidzWhat would be the best way in clojure to search xml for attributes, then replace nodes containing said attribute with a new node?
14:38nDuffjosteink: can you show how you're trying to use it?
14:39nDuffjosteink: (though that tends to be frowned on, from the perspective of creating code where it's hard for the reader to tell where a given symbol came from)
14:39sandovermine might be too small an issue to immortalize on goog group — what i'm seeing is that running clojurescript compiler from command line hangs for 1 minute after the compile is done.
14:40josteinknDuff: heh.
14:40sandoveras in, "java -cp (classpath) clojure.main "cljsc.clj" hello-world.cljs" takes 1:30, but outputs code after only 0:30!
14:40josteinklet me try again one last time :)
14:41josteink(use '[constraints.elements :exclude [loop]])
14:41dnolensandover: what version of cljs?
14:41josteinkvictory is mine :)
14:41sandovermaster cloned today
14:41nDuffjosteink: any reason you aren't putting it in your ns declaration?
14:42josteinkI couldnt get the syntax right ;)
14:42dnolensandover: I think I've observed this as well - open a ticket
14:43nDuffjosteink: (ns my-ns (:use [constraints.elements :exclude [loop]]))
14:43nDuffjosteink: ...that's assuming :exclude to be correct; my own code uses :use only in conjunction with :only
14:43josteinkcompiler says it's ok :)
14:43josteinkthanks
14:43josteinkin clojure
14:44josteinkI feel there is some idiomatic mismatch, but job #1 is getting it running
14:44josteinkI can improve upon it from there
14:47dnolensandover: probably something silly I did - need to do a git bisect to figure it out ...
14:49seangroveIs this the best example of how to do automated tests for cljs code? https://github.com/dustingetz/cljs-bootstrap
14:50seangroveEven just testing with phantomjs is fine, but want to get a handle on testing things to make sure there aren't memory/reference leaks in my cljs code
14:51dnolenseangrove: maybe not related but I'm surprised no one's ported clojure.test yet
14:51sandovermade a new issue for clojurescript compiler hang behavior; http://dev.clojure.org/jira/browse/CLJS-430 . (sorry, accidentally marked it 'major'!)
14:52dnolensandover: so did you try building via the REPL and observed the same behavior there?
14:53sandover i did not have a chance to run (build ) at the REPL, no
15:03sandoverCLJS (build ) done with the REPL runs normally
15:10mccraig_anyone got a bunch of dsl creation experience and a few minutes to chat ?
15:13Raynes~anyone
15:13clojurebotJust 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 ..."
15:14technomancyclojurebot: metaprogramming?
15:14clojurebotTitim gan éirí ort.
15:14RaynesThis is the #clojure IRC channel. Everyone has DSL experience. ;)
15:14technomancyclojurebot: metaprogramming in lisp?
15:14clojurebotMetaprogramming in Lisp is like Chinese food in China; they just call it food there.
15:14technomancy^^
15:15pjstadigclojurebot: metaprogramming is <reply>Metaprogramming in Lisp is like Chinese food in China; they
15:15pjstadig just call it food there.
15:15clojurebotOk.
15:15pjstadighmm those line breaks!
15:15scriptorERC?
15:15clojurebotCounterclockwise aka ccw at http://code.google.com/p/counterclockwise/
15:15RaynesYou broke everything now.
15:16Raynesclojurebot: What does ERC have to do with CCW?
15:16clojurebotccw is http://github.com/laurentpetit/ccw
15:16RaynesI KNOW THAT
15:16Raynesgrrr
15:16RaynesI need to add factoids to lazybot so that I can control the infuriating little bugger.
15:19pjstadigk i think i fixed it
15:19pjstadig~metaprogramming
15:19clojurebotMetaprogramming in Lisp is like Chinese food in China; they just call it food there.
15:20pjstadigi only teach clojurebot something once every six months and I always screw it up somehow
15:21mccraig_Raynes: ha, well in that case, i've been working on a dsl using a state-monad approach, and its fine, but it's not as neat as a simple simple instance_eval approach would be in ruby… can't easily loop over the monadic functions… so i'm considering using a stateful approach. was wondering if i'm missing something
15:23squidzWhat would be the best way in clojure to search xml for attributes, then replace nodes containing said attribute with a new node?
15:32brainproxysquidz: the 'enlive' library might be suitable, just depends on the xml you would be processing
15:32brainproxyas enlive is designed to work with html, but I've used it to transform xml in the past
15:37squidzbrainproxy: its very simple xml. i normally use hiccup which is great for creating html, but im not sure how it would to do read it then modify it
15:43creasesquidz: have you tried clojure.zip/xml-zip?
15:51brainproxysquidz: if it's "very simple" xml as you say, then you will probably have luck transforming it w/ enlive
15:52brainproxybrian marick's tutorial is the best way I've found to get up to speed on how to use enlive: https://github.com/cgrand/enlive/wiki/Table-and-Layout-Tutorial,-Part-1:-The-Goal
15:53creaseyah, that's probably the sensible way to do it
15:54creasebut if it's *really* simple:
15:54crease(defn lightly-munge-xml [f, yer-xml]
15:54crease (->> yer-xml
15:54crease clojure.zip/xml-zip
15:54crease (iterate #(-> % (clojure.zip/edit f) clojure.zip/next))
15:54crease (take-while (complement clojure.zip/end?))
15:54crease last
15:54crease clojure.zip/root))
15:54creaseoops, multiline, apologies
15:54brainproxycrease: that's what refheap and gist are for :D
15:55creaseyah, sorry, enthusiastic c/p
15:56fmwanybody in here using the Domina library for ClojureScript? domina.css and domina.xpath aren't working for me, for some reason (i.e. (domina/destroy! (sel "#header")) doesn't work, while (domina/destroy! (domina/by-id "header")) does).
15:59Frozenlockfmw: https://github.com/levand/domina#important-note-on-browser-xpath-compatibility-ie-and-android
16:00fmwFrozenlock: I have only tested on Firefox and Chrome on GNU/Linux.
16:00FrozenlockI'm using domina and (css/sel "#some-id") works for me. :(
16:00fmwFrozenlock: I've checked out the project, compiled the tests and there it works for me too
16:00fmwjust not in my own project for some odd reason
16:01FrozenlockIs it just with ids?
16:01Frozenlockdoes (css/sel ".some-class") work?
16:04dnolenseangrove: hmm, not that big I don't think.
16:05fmwFrozenlock: no, that doesn't work either
16:06fmwe.g. I add something from the Firebug console through domina.append_BANG_(domina.by_id("wrapper"), "<h1 class=foo>foo</h1>"); - but domina.destroy_BANG_(domina.css.sel(".foo")) returns null and doesn't do anything.
16:09tomojhow is domina a "functional" interface to the dom?
16:09tomojthe interface has clojure functions, so it's functional?
16:09fmwtomoj: the dom is not immutable if that is what you mean with functional, but it is "as idiomatic as possible" from a clojure perspective
16:10Frozenlockfmw: You might want to get your REPL running, it really is handy. Other than that, I don't see how I could help you, other than saying it works for me :P
16:10tomojI'll admit it seems somewhat idiomatic
16:10nDufftomoj: the interface is defined in terms of composable functions, rather than objects or other abstractions.
16:11tomojah, right
16:11fmwFrozenlock: I'm normally using an in-browser REPL, but try to keep it clean with debugging
16:11fmwFrozenlock: thanks for your input, though
16:11fmwseangrove: do you have any input on this issue? I just applied your patch to fix the exception when using domina.css, which solved that
16:11fmwdomina.css and domina.xpath still don't work for me, though
16:13FrozenlockAnyone have an easy way to let users automatically update clojure apps? (.jar) I've read somewhere about webstart, but I would like to have a clojurian opinion.
16:14Frozenlockclojurer?
16:15mdeboardClojurisprudence
16:15tomojmaybe if you had a lein plugin that accepted a coordinate, downloaded the dep if necessary, and ran the remaining commands inside that project: `lein with-project your.app :latest run`
16:16tomojvs `lein with-project your.app 1.0.0 run` for no auto-update
16:16tomojwhich would also be sweet for repl
16:18FrozenlockI like the idea. I would like it even more if it existed already, but I like it :P
16:23Frozenlocktomoj: Is lein included in a uberjar?
16:23bbloomnDuff: persona is actually really cool
16:23tomojno, if you're uberjar'ing my suggestion is worthless I think
16:23FrozenlockAww :(
16:23bbloomnDuff: it's mozilla's attempt at openid done right
16:24nDuffbbloom: Bah. I already have an OpenID RP with a physical token backing it up. Last thing I want is another password.
16:24tomojpersona makes me unable to login to refheap in my browser
16:24bbloomnDuff: except you're a weirdo among the universe of people who don't have openid accounts or have no idea how to use them …. including people like me :-)
16:24bbloomi just assumed openid was DOA because it's too complex for a normal user
16:25bbloomso i never bothered
16:25llasramtomoj: Conkeror?
16:25tomojyeah
16:25nDuffbbloom: Anyone with a Google account can use OpenID.
16:25tomojgood think for refheap.el..
16:25nDuffbbloom: ...the complexity only comes in when you try to do interesting things with it.
16:25bbloomnDuff: except that your email address isn't an open id token
16:26nDuffbbloom: ...and I'm at a loss for why it needs to be.
16:26nDuffbbloom: the user experience doesn't require entering that token.
16:26bbloomnDuff: only because people hard code it to google's endpoints
16:26nDuffbbloom: True enough. My personal domain, on the other hand, _is_ an OpenID token.
16:26nDuff(granted, I'm an exception).
16:26bbloomnDuff: exactly: you're a wiiiide outlier
16:27bbloomnDuff: good discussion here http://news.ycombinator.com/item?id=4580986
16:28nDuffbbloom: Does anyone offer physical-token-based auth for Persona?
16:28nDuffIf it's dual-auth capable, I _might_ be a possible sell.
16:28TimMcnDuff: I gave up BrowserId^WPersona as well.
16:28bbloomnDuff: i don't think so, it's too new. firefox is apparently integrating it into the browser tho
16:28TimMcI still can't believe Mozilla made a login screen that doesn't work with Firefox's password manager.
16:30nDuff...well -- the original intent there was to sign into refheap. That's not happening, so let's get the code I was going to ask about over to gist...
16:30clojurebotto be fair I dunno that I've ever had code out right rejected, it just sits in jira or assembla or where ever, or if I ask if there is any interest (before writing any code) I get told to go write alioth benchmarks
16:30bbloomnDuff: several random sources from quick googling says that mozilla is developing two factor into the protocol
16:31nDuffI feel like I'm doing something unidiomatic / unnecessarily ugly when trying to split keyword arg pairs out of an argument list here. Comments? https://gist.github.com/4150725
16:31bbloomnDuff: you can apply hash-map
16:32nDuffbbloom: Not everything is a pair -- in fact, most things won't be.
16:32bbloomnDuff: do keyword pairs come first or second?
16:32brehautnDuff: are you wantting to turn :a 1 2 3 :b 3 into {:a 1 :b 3} [2 3]
16:32nDuffbrehaut: Exactly.
16:32bbloomah ok what brehau said
16:33bbloomnDuff: that seems odd tho… why not mandate that keyword pairs come before or after positional arguments?
16:33TimMcsomething something finite state transducer
16:33bbloomnDuff: clarity? :-P
16:33nDuff...if mandating that pairs came at the end made cleaner code in the parser, I'd do so happily.
16:34nDuffIf someone abuses the flexibility to write dirty code, though, that's their problem.
16:34brehautTimMc: wow, the wikipedia page for that gets confusing fast
16:35tomojit's unidiomatic to have keyword args mixed in before positional args. anyway, you are sure someone won't want to pass a keyword as a positional arg?
16:35TimMc&(split-with (complement keyword?) [1 2 3 :a 4 :b 5])
16:35lazybot⇒ [(1 2 3) (:a 4 :b 5)]
16:35bbloom&(let [[positional kwargs] (split-with (complement keyword?) [1 2 3 :foo 4 :bar 5]), arg-map (apply hash-map kwargs)] [positional arg-map])
16:35lazybot⇒ [(1 2 3) {:foo 4, :bar 5}]
16:35TimMcbrehaut: It's also not exactly appropriate here, I think.
16:35seangrovefmw: Hmm, I'm using clojure 1.5.0, latest cljs, the explicit goog-closure-library-third-party dep in project.clj, and chrome
16:36seangrove(domina/single-node (domina.css/sel "#main)) seems to work for me
16:36fmwFrozenlock, seangrove just fixed it, there was an old version of domina required through lein-git...
16:37brehautTimMc: nevertheless, its been ten years since i looked at FSA properly
16:37fmwseangrove: thanks for checking, though
16:37brehautTimMc: apparently i am super rusty
16:37fmwit was due to the old version being broken and failing silently
16:37seangroveGlad to hear! Domina is a good library, but a bit sad it hasn't had much activity recently.
16:37TimMcbrehaut: That article is also super unhelpful.
16:38fmwseangrove: yes, it seems like a very decent way to deal with the DOM
16:38fmwI'm going to try to build composable UI "widgets" on top of it
16:38brehautTimMc: looks like a job for a monad stack anyway
16:39Frozenlockfmw: you might already know it, but there's 'enfocus' that uses Domina and offer higher level functions.
16:39tomojall the !'s don't cause composability problems?
16:40TimMcbrehaut: Basically it's just an FSM that emits output on edge traversals.
16:40bbloomtomoj: you mean in domina?
16:40tomojyeah
16:40brehautTimMc: and what it emits doesnt necessarily correspond to the input?
16:40bbloomtomoj: the bigger issue for me is the ugliness with nesting
16:40TimMcYeah.
16:41Frozenlocktechnomancy: are you aware of any 'auto-update' feature for a uberjared project? (By any chance..)
16:41bbloomtomoj: jquery abuses the javascript 'this keyword, which is actually surprisingly useful for working with deeply nested transformations and such
16:41bbloomtomoj: hence the DOM library i'm working on utilizes a stack machine :-)
16:41fmwFrozenlock: yes, I had a look at Enfocus. seems like a good library
16:41brehautTimMc: this is really cool, thanks :)
16:41Hodappwhy do people bitch about JavaScript so much?
16:41tomojyeah, excited to see it
16:41TimMcnDuff: I really dislike embedded kwargs, by the way -- better to have them in an optional map arg.
16:41Hodappthe only part of it I've found that is worth complaining about is the weak typing.
16:42nDuffTimMc: That's fair -- I'm supporting them here only for compatibility with another call.
16:42bbloomtomoj: i've got it working reasonably well, but i want it to be much more complete before releasing it
16:42tomojI guess maybe you can apply composed actions to orphan nodes and clone when necessary to keep the side-effects from screwing things up?
16:42bbloomtomoj: there is a lot of surface area to the dom api
16:42tomojyeah :'(
16:42TimMcHodapp: "0" == 0 == "", "0" != "" -- you have to know about a ton of "features" to not use most of the time.
16:43seangrovebbloom: That souns pretty intense, any samples of what the interface looks like?
16:43bbloomsure
16:43bbloomseangrove: https://www.refheap.com/paste/7004
16:43seangrovewhitespace sensitive?
16:44bbloomno, it's postfix notation
16:44seangroveAh
16:44bbloomthat grabs an element with the idea "root", pushes it on the stack, then it creates a div and pushes that on the stack, sets the class property, assigns it a background color
16:44bbloomthen the ~label injects a value from clojure land, so in this case a string
16:44bbloomtext! sets the text content, and then '(append) keep' is a higher order postfix operation
16:45bbloomappend attaches the child to the parent and removes the child from the stack, but (append) keep will preserve the child on the stack
16:45bbloomso that you can then clone it and ALSO prepend it :-)
16:45bbloomjust as an example
16:45seangroveWow, looks interesting
16:45seangroveWill definitely check it out when you release it
16:45bbloomseangrove: deeper explanations here http://docs.factorcode.org/content/article-dataflow-combinators.html
16:46seangroveI wonder how libraries around the DOM can go... I have a hard time writing functional code around it
16:46bbloomthis way dom manipulations are programs as data! you can stream dom control commands across the network :-)
16:46bbloomheavily inspired by PostScript. treating the DOM as a printer :-)
16:47tomojhmm: "keep ( ..a x quot: ( ..a x -- ..b ) -- ..b x )"
16:47bbloomtomoj: yeaaaah, that bit is a tad confusing
16:47tomojwhat is the type of your keep function, roughly?
16:47bbloomit's "row polymorphism"
16:47bbloomthe idea is that you have "quotations" which are just lists of instructions
16:48bbloomthe ..a just means some sequence of items on teh stack
16:48bbloomyou can think of every function as having type stack -> stack
16:48bbloomin this case, it's telling you facts about the stack
16:49bbloomin this case that you get a stack, a value, and a quotation (like a lambda) and return a new stack plus the top item from the original stack
16:49bbloomhence the "keep"
16:49bbloomyou're keeping the top item of the stack
16:49bbloomeven after applying the quotation
16:50bbloomfunctions are called "words" and have signatures defined as "stack effects" of the form (x -- y) where x and y are the before and after states of the stack
16:50bbloomfor example the dup word has stack effect (x -- x x) … that is, it takes an x off the stack and puts it back on twice
16:50bbloomDUPlicates it :-)
16:51muhoobbloom: is your dom library up on github somewhere?
16:51bbloommuhoo: not yet, going to publish the stack language library first
16:52muhoocool, thanks.
16:52tomojguess I should find a factor tutorial
16:53bbloomtomoj: if you like videos, the google tech talk is good: http://www.youtube.com/watch?v=f_0QlhYlS8g
16:53tomojI do, thanks :)
16:53bbloomthe benefit of stack/concatenative languages is that side effects are left to right
16:53bbloomso it's much easier to reason about mutation
16:54bbloomsince the dom is inherently mutable, any attempt to project a functional interface onto it is kinda doomed from the start
16:54bbloomso i said "fuck it" and i'm going to use functions to return programs that trivially compose via concatenation, and then execute those programs
16:54bbloomand since there is no wrapping of dom elements to pass around, it should perform reasonably well
16:55bbloomraw dom nodes get stored on the stack
16:55bbloomno complex monad allocations like jquery and whatnot
16:55tomojso your refheap is a function that takes <div id="root"></div> to <div id="root"><div class="button" style="...">label</div><div class="button" style="...">label</div></div>, where the first inner div is the clone of the second?
16:55bbloomalthough right now my interpreter is hilariously inefficient, allocating cons cells left and right
16:55bbloomtomoj: not quite.
16:56bbloomline 1 grabs the #root element and pushes it on the stack
16:56clojurebottrampoline is http://groups.google.com/group/clojure/browse_thread/thread/6257cbc4454bcb85/3addf875319c5c10?#3addf875319c5c10
16:56tomojoh, the whole thing is a (stack -> stack) still..
16:56bbloomlines 2 through 5 create <div class="button" style="…">text here</div> and pushes that on the stack
16:56bbloom(append) keep will put the button div into the root element
16:57bbloombut leave both the button and the root element on the stack
16:57bbloomclone will replace the element with a clone of itself
16:57bbloomand then prepend that
16:57technomancyhuh, weird; that factor video won't play, but it also doesn't show a "please install flash" message
16:57bbloomtechnomancy: odd.
16:57bbloomtechnomancy: plays for me
16:59bbloomalso good: http://evincarofautumn.blogspot.com/2012/02/why-concatenative-programming-matters.html
17:00jamiidnolen: proposed bloom^L query syntax - https://gist.github.com/4150891
17:00jamiidnolen: seems reasonable?
17:02bbloommy notation is different than factor's by necessity of clojure's reader syntax… so i also need to document it well before releasing :-)
17:03bbloomi've been translating and testing little chunks of jquery code and the result is almost always dramatically nicer than jquery syntax
17:06ChongLiI think my friend took down 4clojure by trying to do a search
17:06ChongLiis that crazy?
17:06tomojinteresting, I've been working on a pointless library as well, but struggle when I need points
17:06tomojnow I have to go learn factor, so thanks and no thanks :/
17:07ChongLi502 bad gateway
17:07ChongLi:(
17:07bbloomtomoj: lexical variables can be implemented reasonably easily: http://docs.factorcode.org/content/vocab-locals.html
17:07bbloombut having things like dip and keep make the need pretty rare
17:14dnolenjamii: looks neat though I can't provide much more specific feedback since I haven't had time to really dig into bloom yet.
17:14jamiidnolen: ah, ok :)
17:15dnolendefinitely on my list of things to do very soon - but been super heads down w/ CLJS source mapping in my free time.
17:27jamiidnolen: I've been meaning to dig into the cljs compiler fairly soon. My compilers in strucjure and droplet are gross - need to come up with something cleaner.
17:28dnolenjamii: don't worry, cljs compiler is a mix of clean and gross ;) fortunately it's not much code.
17:29jballancChongLi: it's working for me...maybe clear cookies?
17:35ChongLijballanc: it's fine now
17:35ChongLiit was down for about 3 minutes
17:39dnolenjamii: I wonder if your CLJ bloom stuff could work in CLJS via http://www.webrtc.org ?
17:39jamiidnolen: clojurescript / applets was one of the reasons I originally targeted clojure
17:40jamiidnolen: I want to work on in-browser p2p networks
17:40jamiidnolen: I'm not sure how useful webrtc is for that. I haven't read much but I've heard that its heavily focused towards audio/video rather than general purpose communication
17:41dnolenjamii: http://stackoverflow.com/questions/10904636/webrtc-p2p-update ?
17:43dyresharkls
17:43lazybotbin boot home lost+found media mnt srv swap var
17:43jamiidnolen: I wonder if its possible to do PEX-style hole punching or if you have to rely on a stun server
17:58derridaHey guys, I'm trying to use nrepl with nrepl.el in emacs. When I C-u M-x nrepl-jack-in and specify my project folder, sure enough, a repl pops right up. Strangely, when I open code from the project (or switch to a buffer), I cannot C-x C-e on forms, it tells me that there is no inferior lisp started. Even stranger, when I hit C-c C-z, emacs boots up another repl- this time the repl has a different "header"
17:58derridathat shows a different version number and seems to have a title of "REPL-y". I tried completely deleting my ~/.emacs.d and got the same results after installing nrepl and clojure-mode. Is anyone familiar that could offer some advice?
17:59derridaalso, once the "REPL-y" repl is booted, I can then compile forms and they are sent to that repl
18:00derridaI apologize that this might be more emacs related than clojure-language related, just figured this is probably the most likely place to find help.
18:01technomancyderrida: for some reason nrepl-interaction-mode isn't getting enabled upon connect
18:01derridafwiw, this happens to me in osx, my friend that is using linux and installed alongside me did not experience the same result.
18:02derridatechnomancy: should I need to add that to my init files manually if I installed via melpa?
18:03derridaadding the hook is no issue, I just got worried because my experience was not consistent with my friends.
18:03technomancyderrida: no, it just means there's a bug in the connect hook
18:03technomancyno idea what causes it, but a few people have asked in here about it
18:03derridathat makes me feel better anyway
18:04technomancyyou're not using aquamacs, are you?
18:04tomojbblöom: so how do you differentiate between pushing a function to the stack and calling a function
18:12derridatechnomancy: nah
18:12wink"I don't always C-u M-x, but when I do, I'm nrepl-jack-in."
18:12derridatechnomancy: I compiled emacs from homebrew for X11, I tested with emacsforOSX pre-compiled though and it was the same thing
18:31bbloomtomoj: http://docs.factorcode.org/content/article-quotations.html thse use [ brackets ] for quotations and { arrays }, but I was using [ vectors ] and ( quotations ) to better mesh with clojure semantics
18:32tomojah, now I understand (append) keep
18:33bbloomyeah, that example is just me testing our various features
18:33bbloomkeep is relatively complex, so it's a good test
18:33bbloomit's defined as: over (call) dip
18:34bbloomand dip itself is a primitive which also invokes 'call
18:34bbloomso it's a double layer of quotations and such, exercises the stack pretty well
19:26firesofmayHi, I want to try out this project : https://github.com/kovasb/session But I am not sure how to run this thing. Any pointers?
19:35devnheh firesofmay
19:35devnthat's sort of the supreme irony is that it doesn't have examples
19:45mdeboardI really wish Python had type hinting. Would save so much unnecessary commenting.
19:45mdeboards/python/every language
19:47KolmeChousukeamdeboard, you mean Haskell style type annotations?
19:47mdeboardNo, Clojure style type-hinting in function signature
19:47KolmeChousukeaI do love how in Haskell type signatures are basically sufficient as comments most of the time
19:47KolmeChousukeamdeboard, example?
19:48mdeboard(defn some-fn [^Integer i ^String s] (+ i (read-string s)))
19:48ben_mAlso helps with performance!
19:48mdeboardhttp://clojure.org/java_interop#Java%20Interop-Type%20Hints
19:48KolmeChousukeaAh yes
19:49wingywhat is the difference between (file/wrap-file "public") and (resource/wrap-resource "public")?
19:51xeqiwingy: file/wrap-file looks on the filesystem, resource/wrap-resource looks on the classpath
19:52xeqiso resource/wrap-resource can find resources inside jar files
19:52wingyxeqi: which one do i wanna use to serve static files?
19:53xeqifrom the file system or classpath? I usually use resources
19:53wingycan i use (file-info/wrap-file-info) with the latter?
19:54wingyalso, my public folder is in the project root .. if i use the latter, where do i have to put that folder, in resources/public?
19:55xeqiwingy: I believe those work together, just make sure wrap-file-info is the outside middleware
19:55xeqiresources/public would work
19:55wingyok thx
19:55xeqi* for a lein2 project w/ default :resource-paths
19:56wingybut on the other hand perhaps i can control it more with using the former one
19:57wingyeg. if i only plan for specific files in the public folder to be served, if they aren't in the public folder then the responses return not found then it seems better to serve with file/wrap-file
20:18firesofmayHi, Can anyone help me with how to run this project? https://github.com/kovasb/session It has no docs saying how to try it out. Any ideas?
20:19firesofmayAnyone?
20:19clojurebotJust 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 ..."
20:23moogatronicfiresofmay: what did you try?
20:24moogatronicfiresofmay: looks like you just need to do 'lein run'
20:24firesofmaymoogatronic, I tried doing lein swank but it fails. I think i have to do make a jar which I did, and after that I did
20:24firesofmaymoogatronic, java -jar target/session-0.1.2-SNAPSHOT-standalone.jar
20:24firesofmaymoogatronic, but I got Exception in thread "main" java.lang.NoClassDefFoundError: session/server
20:24tanzoniteblackfiresofmay: you might try 'lein repl'
20:24firesofmaymoogatronic, okay.
20:24moogatronicright, try lein run
20:25moogatronicthat will run the :main
20:25firesofmaymoogatronic, okay let me try
20:25moogatronicfiresofmay: tip - Check the project.clj. You can usually figure out what's going on from there. Any aliases, mains, etc. that are defined will be good starting points.
20:25firesofmaymoogatronic, Getting Exception in thread "main" java.lang.NumberFormatException: null
20:26firesofmaymoogatronic, Inside project.clj it says : :main ^{:skip-aot true} session.server
20:28moogatronicfiresofmay: check out https://github.com/kovasb/session/blob/master/src/clj/session/server.clj
20:29moogatronicthe -main shows what args and setup the server is expecting.
20:29firesofmaymoogatronic, Yeah I was checking that. I did lein run and switched to session.server ns.
20:29firesofmaymoogatronic, What to pass to -main? I am not clear on that.
20:29moogatronicthe cmd line args are passed there.
20:29moogatronici'm not sure either, i've never looked at this prj. =)
20:29moogatroniclooks like datomic is set up with the last param
20:30moogatronicthe listening port is set with the first param
20:30hughfdjacksonare there interoperable client and server libraries?
20:30firesofmaymoogatronic, okay
20:30hughfdjacksoni'm basically writing a little proxy for fun
20:30hughfdjacksonfirst stage is to get pass-through :D
20:31moogatronicfiresofmay: looks like someone created an issue asking for "getting started"
20:31moogatronic=)
20:31firesofmaymoogatronic, oh :)
20:32moogatronici'm sure Kovas will provide some quick docs as soon as he's able.
20:32firesofmaymoogatronic, heh. I was the one who came an hour back and asked about it ;)
20:32firesofmaymoogatronic, thanks a lot :)
20:32moogatronicfiresofmay: well, it makes sense. this was presented at the conj, so others will likely be poking around as well.
20:32firesofmaymoogatronic, you saw this project?
20:33firesofmaymoogatronic, at conj i.e.
20:34moogatronicfiresofmay: yeah, well I saw the preso. I have a ton of my to-play-with-queue just from the conj among other things. =)
20:34moogatronici've not really checked it out much though.
20:34wingywhen i run a form i get back a clojure.lang.ExceptionInfo https://www.refheap.com/paste/7008 how do I interact with it, eg. returning the clj-http response body
20:35firesofmaymoogatronic, I wanted your opinion on something then. Basically I have been toying around with the idea of creating a logo environment using clj/cljs
20:35firesofmaymoogatronic, and lately it mutated into teaching lisp/clojure via logo using some kind of codeschool kind of thing with canavas
20:35firesofmaycanvas*
20:36firesofmaymoogatronic, one of my mentors, BG, said that check out this project session, hence I was. But what do you think about the overall idea?
20:37moogatronicwell, i don't know much about logo, aside from turtle graphics.. =) But it seems like a good fit generally.
20:38moogatronicfiresofmay: the session project would probably contain some good stuff to use directly in an edu/style setup. canvas/cljs/web-repl/graphics… not much to dislike there. =)
20:38firesofmaymoogatronic, okay.
20:38firesofmaymoogatronic, I like the whole idea of learning lisp/clojure but with strong visual feedback on how powerful it is.
20:39moogatronicfiresofmay: you can probably msg Kovas directly on github, since you have a vision/path of exploration/ etc.
20:39firesofmaymoogatronic, 4clojure is great, but there is no learning, I cant tell a person go learn liso there.
20:39firesofmaylisp*
20:39moogatronicfiresofmay: I agree wrt visual&learning. I learned clojure via Overtone.
20:39moogatronicaudio … but similar concept.
20:39firesofmaymoogatronic, Hmm. Sounds like a good idea. Though I have no clue of how cljs yet. and a bit of cljojure not much.
20:39HodappOvertone looks rather interesting.
20:40HodappI wish I had some musical inclination to actually use it
20:40moogatronicfiresofmay: check out Quill as well. It's a clojure wrapper around Processing
20:40firesofmaymoogatronic, oh Thats interesting. So you have background in music?
20:40HodappQuil*
20:40moogatronicHodapp: you don't need any. You trade in programming skill!
20:40moogatronicHodapp: thanks. =)
20:40moogatronicfiresofmay: well, I had a background in Java… and a love of music.. I do have some background in music, but not professional.
20:40firesofmaymoogatronic, yeah I started with that but I got a feedback that it would be better if you make this as a webproject as then anyone can start with it.
20:41Hodappmoogatronic: Apparently I have not enough skill in programming to trade in for enough musical inclination to accomplish much.
20:41firesofmaymoogatronic, hence toying with clojurescript.
20:41firesofmayHodapp, heh :)
20:41Bergle_2its 'quil' one l. fun :)
20:41Hodappmoogatronic: Perhaps weed is a better things to trade it for in the meantime...
20:41moogatronicfiresofmay: Yeah, go with what you think will get you the best return. I had a course project that required the use of genetic/evolutionary algos, and i wanted to make it arty. =)
20:42firesofmaymoogatronic, nice. I tried overtone to run on my ubuntu machine, had so much pain. I gave up too soon. Should try again.
20:42firesofmaymoogatronic, Is it possible to have a web repl for overtone?
20:42moogatronicHodapp: Lawlz. Well, i'm not sure how to convert programming skill to weed. =)
20:42Hodappmoogatronic: Easy. Use the former to get money, and then buy it.
20:42moogatronicfiresofmay: Locally only. Overtone requires supercollider.
20:43firesofmaymoogatronic, Hmm okay.
20:43SegFaultAXI know this is offtopic, but I'm looking for some guidance on (what should be) a relatively simple github markdown issue...
20:43moogatronicfiresofmay: http://www.chris-granger.com/2012/02/20/overtone-and-clojurescript/
20:43SegFaultAXhttps://gist.github.com/4151846 You'll notice that there is a huge space between the outer ordered list and the inner bullet list, but no space between the bullet and the next ordered list item.
20:43SegFaultAXHow can I fix this?
20:44firesofmaymoogatronic, thanks checking it out.
20:44Hodappmoogatronic: this looks like a neat article, thanks
20:49moogatronicSegFaultAX: Do you need the space between the numbered lists? Maybe remove that and the rendering will fix.
20:51tmciverSegFaultAX: Not sure if this is the problem, but when I view the raw text the second bulleted list is indented by 3 (not 4) spaces.
20:52tmciverSegFaultAX: Also when I paste it into pandoc (http://johnmacfarlane.net/pandoc/try), it looks OK (with no spaces).
20:53SegFaultAXtmciver: Yea, it's just the shitty GH markdown stylesheet I think.
20:53SegFaultAXThey don't have a bottom margin of nested lists. :(
20:55tmciverSegFaultAX: just wonky github markdown implementation, I guess.
20:55SegFaultAXJust a stylsheet issue.
21:06UrthwhyteSegFaultAX: GH uses Sundown I thought?
21:12dnolenneat IGS GoPanda2 client is written in Clojure & CLJS
21:17ohpauleezdnolen: Whoa! Totally awesome. Any link on their experience or a blog post?
21:19dnolenohpauleez: don't think so
21:20SegFaultAXUrthwhyte: It does. What does that have to do with the GH stylesheet though?
21:20UrthwhyteI didn't even realise they supported nested lists
21:20UrthwhyteI thought that was a Pandoc extension
21:20UrthwhyteMy mistake
21:20SegFaultAXUrthwhyte: http://daringfireball.net/projects/markdown/
21:22Sgeo__dnolen, awesome
21:22Sgeo__Wait, why is a client using both?
21:30tomojbbloom: hmm.. https://www.refheap.com/paste/8d71b9b2a197b4c51d7032d67
21:30tomojnot sure whether I'm sold yet, but I think I'm doing it wrong
21:30tomoj"call call call" looks suspicious
21:42tomojI bet semantic editor combinators shouldn't be directly translated to concatenative
21:49seangroveChrist, it's easy to write leaky code with Closure
21:50tomojleaky as in memory?
21:55seangrovetomoj: Yeah
21:57tomojclojurescript leaks in places clojure wouldn't, because of closure? :(
21:59brehauthttp://blog.ezyang.com/2011/05/space-leak-zoo/
22:00brehauthaskellers use the term 'space leak' as a superset of the bugs that can cause a program to consume all your ram, with memory leak being the particular problem that notoriously effects C programs
22:04tomojwhat's a space leak that can't cause a program to consume all your ram?
22:06tomojI guess since there's a stack limit, stack overflow
22:07brehautsorry, i was unclear
22:07brehautits a superset of memory leaks, and includes all the ways you can consume all your ram
22:08mthvedtis there a leak that covers bloated programming
22:08brehautjava
22:08mthvedthaha
22:10seangrovetomoj: Nah, just the documentation of Closure is so-so, great at a small level, not so great at a high-level, so it's easy to destroy components that leave tons of event listeners that have references to DOM elements that would otherwise get GC'd
22:11tomojI see, good. I've been worried about optimization-induced space leaks ##(inc brehaut)
22:11lazybotjava.lang.RuntimeException: Unable to resolve symbol: brehaut in this context
22:12brehauthaha, the karma thing is a special syntax, not an evaluated piece of clojure
22:12seangroveI'm just trying to get a test going just to asserts that the number of listeners/undisposedObjects is 0 at the beginning/end, but it's still pretty rough it seems
22:13brehautseangrove: incidentally, its common in javascript to build really leaky event handling code. ibdknox had some horrific experience trying to use jquery and contain the memory growth
22:14tomojlol "stack underflow"
22:14seangrovebrehaut: Yeah, we build a gmail plugin, so we have to ensure we don't leak memory because pages are left open for days at a time
22:14seangroveIt's an interesting challenge
22:15seangroveMaybe we could be sneaky and find a reference to how much memory is being used, and just refresh the page, heh
22:15tomojor just refresh after idle for X min?
22:15seangroveI imagine the gmail users might be slightly upset about it, but maybe that's not a bad idea
22:16seangroveAnyway, we have space leaks with our current version, but the cljs version we're making sure that it's sound from the beginning
22:16seangroveI expect it'll be a reasonable job now that we're aware of it
22:17seangroveibdknox: Any tips on how you're handling testing?
22:24dyresharkhi! i've been using clojure for a few weeks now, and i was wondering if someone could refer me to some code i could read so i can improve my coding skills in clojure? i come from a background of primarily c++/c/python, so at the moment i'm likely not writing good code. :p
22:25brehautring, compojure, leiningen,
22:25brehautthey are all well maintained projects with lots of eyes on them
22:26dyresharkcool, i'll look into them. thanks :)
22:26FrozenlockThe clojure source itself can be interesting.
22:27moogatronicdyreshark: maybe just keep building things in a questionable way? I find that discovering idioms happens sort of organically..
22:27moogatronicreading code is definitely a part of that though…
22:29dyresharkmoogatronic: yeah, i've done a few personal projects in clojure. i just feel like reading some code would at the very least introduce me to things i don't know about yet
22:29dyresharklike if-let. i learned that a full ten minutes ago :P
22:29moogatronicFrozenlock: yeah, I have a lot of stuff like that in my code. Hopefully less now than a year ago… but you never know. =)
22:30dyresharkFrozenlock: i feel like i have a lot of things like that. :P
22:30dyresharkoh well! thanks again for the insight, all
22:30seangroveI can't tell how to track down this stack trace https://gist.github.com/413f31323d5142993207
22:31seangroveHmm, it's probably a syntax error on my part somewhere, let go through once more...
22:31tomojlooks like you have a bad ns decl?
22:32brehautthats my first gues too
22:33seangroveHow do you guys see that?
22:34seangroveHow/where in the trace?
22:34tomojfirst, we know you have foo where it should be [foo] or (foo)
22:35Hodappwhat's a typical Clojure-ish method of implementing an abstraction layer that could target multiple backends?
22:35tomojwhich is a common error in ns decls I think
22:35tomojthen there's a parse-ns in the stacktrace
22:35brehautseangrove: mysterious looking 'nth not supported on this type: Symbol' coming from the compiler is a good clue
22:35brehautHodapp: that would be protocols
22:35tomojand analyzer.clj:639-ish is the parse 'ns multimethod
22:36brehautHodapp: and more rarely multimethods
22:36seangrovetomoj: You just know that from experience?
22:36tomojI looked at analyzer.clj
22:37seangroveWell, I guess I should be less afraid of diving into the source of Clojure then
22:37tomojyou can pretty much ignore RT.java, core.clj, protocols.clj, etc
22:37brehautthe source command at your repl helps for that too
22:38tomojsince it's a cljs compile error compiler.clj and analyzer.clj frames will likely be helpful to look at
22:39seangroveAh, I feel bad now, didn't realize that was the normal way of going about things
22:39seangroveOk, I'll go after it from here, thank you!
22:39tomojmy editor throws more exceptions every time I try to get it to jump to a frame :(
22:40brehautseangrove: no need to feel bad.
22:41brehautseangrove: you asked a sensible question
22:41seangrovebrehaut: It feels a bit lazy in hindsight is all ;)
22:42seangroveBut M-. on cljs.compiler/parse-ns and it's starting to make more sense
22:42brehauti dunno; its not normal for programmers to look under the hood on their compiler in most languages
22:42brehautso its not really lazy, its just a lack of awareness
22:43seangroveAppreciate that, I'd agree with the lack of awareness
22:43seangroveI've heard good things about the cljs source anyway, so shouldn't be afraid of digging through it
22:46tomojwonder how long before compiler errors show line/col
22:48brehautseems like it mustnt be far off if there is source mapping in cljs
22:53mattmossWhat is the better for (map #(some-fn %) coll) ? I'm feeling stupid atm.
22:55Frozenlock(map some-fn coll) :P
22:55brehaut(map some-fn coll(
22:55seangroveWith a pluggable analyzer like fogus talked about, I really hope we can get some super-helpful error messages. Instead of "Wrong number of args (5) passed to: analyzer$eval223$fn--224$pfn", it'd be "You passed 5 arguments to a def - did you mean to use a defn?"
22:56atom_performance question: is there any reason performance wise to use clojure instead of java?
22:56seangroveSo many interesting projects to work on in clojure-land, heh
22:56mattmossFrozenlock: Oh, duh. I see what you mean.
22:57brehautatom_: java is (unsurprisingly) a very close fit to the optimal performance decisions for the JVM. i dont think your question makes sense.
22:58FrozenlockDoes this seem applicable to clojure? http://www.hascode.com/2012/05/creating-updatable-java-applications-using-getdown-and-the-getdown-maven-plugin/
22:59atom_brehaut: I understand that java is (unsurprisingly) close to the optimal performance for the JVM. I was asking in terms of performance gain, if there was ever a time I would use clojure in place of java.
23:00brehauti doubt it
23:00seangroveatom_: Haven't done any Java development, so can't comment one way or the either
23:01brehautatom_: inplace munging of data without functioncall overhead is how you write screaming code. thats not ideal in clojure.
23:01ChongLioptimal performance is kind of a nebulous concept
23:01atom_It was a general question. If everyone were only concerned about speed we would all be writing in ASM or C.
23:02ChongLiif clojure allows you to express some abstraction that makes it easier to write a parallel program than java, does that make it super-optimal?
23:02seangroveChongLi: That's what I was thinking, yes
23:02brehautatom_: or haskell or java…
23:02brehautC doesnt have some secret advantage of being fast
23:03brehautthe JVM is capable of some really impresive optimisation
23:08brehautatom_: my point re:java is that its close to what the JVM does. JVM is the optimising compiler; javac is not. clojure isnt an optimizing compiler either. therefore, its going to be easiest to write performance optmized code in the language closest to the model the optimizing compiler expects
23:08brehautatom_: clojure code could be written that equals java code
23:08brehautatom_: but it doesnt make sense to expect it to be fast
23:08brehauter
23:09atom_brehaut: I understand what you're saying. I was just asking out of curiosity, also trying to find a reason to work it into our applications.
23:10brehautatom_: choose clojure for aiding correctness and expression
23:10atom_brehaut: I personally love writing in clojure, just looking for where I could leverage it and to what end.
23:10ChongLiyes
23:10ChongLithe real question you should ask when evaluating any programming language
23:10muhooah, tradeoffs, the bread and butter of engineering :-)
23:11ChongLiis if it helps you express a solution to your problem in a more concise, easily read and easily maintained manner
23:11ChongLifrom SICP: the 3 key features of any programming language
23:11ChongLiprimitve operations, means of combination and means of abstraction
23:12muhoooften you're really trading cpu time for programmer time.
23:12ChongLisince clojure is implemented in java, anything you can write in clojure could be written in java
23:12ChongLibut what would that actually look like? :)
23:13brehautChongLi: it would look like biting tinfoil tastes
23:13ChongLior fingernails on a chalkboard
23:13ChongLihaha
23:14atom_ChongLi: Many of the concepts you just spoke about are foreign to me. My degree is in physics and I took only 1 programming class. I was hired by the company owner because he liked talking to me about solid state dynamics. I kind of fell into programming so the jargon is a little difficult for me to handle sometimes.
23:14ChongLiatom_: that's fine
23:15ChongLiif you have time, you might want to look at SICP
23:15ChongLiit'll explain it way better than I can
23:15atom_ChongLi: I've been reading/watching the MIT OCW on that recently.
23:15ChongLithat's good
23:15atom_ChongLi: I think I like clojure because it makes more sense than OOP to me.
23:16ChongLiof course
23:16ChongLifunctional programming is much closer to mathematics
23:16ChongLiyou can use the substitution model
23:16ChongLisomething you're very familiar with in algebra
23:17ChongLionce you introduce assignment (mutation) you lose the algebraic properties
23:18ChongLivariables no longer refer to values but instead to places in memory
23:18ChongLisubstitution breaks down because you're no longer talking about values
23:20seangroveStruggling with running cljs test - Here's my project.clj https://gist.github.com/1dfa6eae91dae6cf37c9
23:20atom_Well, after learning Java enough to work within our applications (the largest one is small, probably only 250k - 300k lines) I've found that mistakes are made because of mutation. Exceptions, bad data, etc. I found clojure and thought it might help solve some of the problems.
23:21seangroveOn line 50 I define the :test cljs build, which compiles the :source-path into "unit-test.js"
23:21seangroveThe unit-test.html includes unit-test.js as a script tag, so it seems like it's meant to be a bootstrap of sorts
23:21ChongLiatom_: it will, and more
23:22ChongLiclojure is also way more expressive than java
23:22ChongLiit'll allow you to accomplish more with less code
23:22ChongLiwhat I don't get is why people out there try to argue against that?
23:23ChongLiwhy do so many people insist on using languages that require them to follow rote mechanical repetition?
23:23ChongLi"design patterns" as they're called
23:23seangroveBut two problems: One, how should I get the actual application cljs code included, and Two, if I'm setting on-page-load events in my application code, I suppose they'll be called when they're included as a script tag, so I'll need to find a way to prevent them from being called
23:24atom_ChongLi: Because that's what's familiar to them?
23:24tomojthey were taught or learned a way. it probably involves an IDE that does a lot of useful things
23:24brehautChongLi: design patterns werent originally supposed to be followed rote; they represent small case studies in common problems, enumerating a common best trade off, and the problems of benefits involved
23:25ChongLiif the problem is common enough, why not have a library to take care of it?
23:25ChongLiunless your language lacks the expressive power to create such a library
23:26brehautChongLi: well partly, but also because the particular solutions involve trade offs. a concrete solution hard codes that trade off.
23:26tomojhmm
23:27brehautfrinstance, GOF, Decorator (first pattern that the book opened to) lists under Consequences "…two key benefits and two liabilities…"
23:27brehaut(thats pg 178 of GoF)
23:28ChongLihaha
23:28brehautseangrove: the book is on my shelf, within arms reach :P
23:29brehauti dislike the wanton application as much as the next sensible programmer
23:29brehautbut i also dislike patterns getting set up with a straw man
23:29seangroveMeant as a compliment ;)
23:29brehautah :)
23:29tomojbrehaut: but isn't that exactly the expressiveness problem I think dnölen talked about?
23:29seangroveAnd it's a well-balanced view anyway
23:29ChongLiwhat about stuff like "dependency injection"?
23:30tomojbeing able to write libraries which don't make those choices?
23:30seangroveI *still* don't get DI - what the hell is it supposed to do?
23:30brehauttomoj: for the GoF patterns, absolutely yes
23:30ChongLiit makes me laugh that imperative programmers complain about monads
23:31ChongLiand then talk about dependency injection and abstract factory patterns
23:31brehauttomoj: but every level of abstraction in an engineering solution has trade offs. just because our language lets us avoid low level trade offs with ease doesnt mean that there arent higher level trade offs it cant address
23:31ChongLieverybody's guilty of these overwrought names, if you ask me
23:32brehautits one of the two hard problems in computer science (naming, cache invalidation, and off by one errors)
23:32ChongLihahaha
23:33tomojis a sign error an off by one error in Z_2?
23:34ChongLiI guess monad isn't all that overwrought
23:34ChongLiit's just an alien term
23:34brehautits perhaps underwrought
23:34ChongLiit also happens to be a very abstract concept
23:35brehautyes
23:35ChongLiwhich always seems hard to name
23:35ChongLiI tried explaining monads to somebody in #archlinux the other day
23:35ChongLiand it was very hard
23:36ChongLitried going from functions like a -> a
23:36ChongLibut even that was a stretch for this person
23:36tomojhmm.. if a language could well address all trade offs, there wouldn't be any reason to use a different language. so that's om
23:36ChongLiI guess most people aren't used to the idea of type variables
23:37brehauttomoj: om ?
23:37ChongLi?
23:37tomojjust a name for the perfect language
23:37ChongLihow do you address all tradeoffs?
23:37tomojyou don't
23:37brehauttomoj: ah, coBlub
23:38ChongLicoblub would be a great name for a language actually
23:38brehauttomoj: just incidentally, i don't think its an accident that GoF is full of ways to do straight forward smalltalk in C++
23:39tomojI think the question was something like whether statements of the form "language X is closer to coBlub than language Y" can have truth values
23:40tomojnot, of course, whether clojure is coBlub
23:40brehautright
23:41brehautagda will (eventually at least) be blub to someone
23:41brehautanyway, its the end of the day here. later
23:42ChongLilater
23:52clj_newb_2345i'm writing some graphics intense (svg manipulating) code in clojurescript
23:52clj_newb_2345my code is slow
23:52clj_newb_2345how do I profile this?
23:52clj_newb_2345my background is clojure, not javascript
23:53bbloomclj_newb_2345: you can look at allocations and cpu time in chrome
23:53clj_newb_2345i am using chrome
23:53bbloomclj_newb_2345: and use the 'time macro
23:53bbloom(doc time)
23:53clojurebot"([expr]); Evaluates expr and prints the time it took. Returns the value of expr."
23:53ChongLiI don't know a lot about clojurescript
23:53clj_newb_2345bbloom: do I need some plugin to use the chrome profilng tools
23:53ChongLibut I do know that it doesn't have the same kind of complexity guarantees in its immutable data structures
23:53bbloomChongLi: that is no longer true
23:53ChongLioh really?
23:54ChongLishows how much I know :)
23:54bbloomChongLi: cljs has had persistent data structures for quite a while
23:54ChongLithat's really good to hear
23:54bbloomclj_newb_2345: you can use the regular profiler
23:54clj_newb_2345bbloom this is very useful
23:54clj_newb_2345so 11% is my program
23:54clj_newb_23458% is the GC
23:55clj_newb_2345hmm, 31% is some json function
23:55clj_newb_2345and 40% is ... _seq ?
23:55bbloomclj_newb_2345: if you're using advanced mode, name mangling can make your life difficult :-/
23:56clj_newb_2345this is amazing
23:56clj_newb_2345I would have otherwise never guesed the time splitting
23:56clj_newb_2345thanks!
23:57bbloomclj_newb_2345: no problem :-)
23:57bbloomclj_newb_2345: are you using advanced optimizations?
23:57clj_newb_2345no
23:57clj_newb_2345how do I turn them on?
23:57bbloomclj_newb_2345: you should try those first :-)
23:57bbloomare you using lein-cljsbuild ?
23:57bbloom{:optimizations :advanced}
23:57bbloomit's in the docs
23:57clj_newb_2345you mean have the computer do more work rather than me do more work?
23:57bbloomclj_newb_2345: bingo. haha
23:58bbloomclj_newb_2345: advanced optimizations will elimiate dead code, aggressively inline small functions, specialize call sites on type, ec
23:58clj_newb_2345recompiled
23:59bbloomclj_newb_2345: take a peek at the compiled output to make sure it's rewritten everything to completely unreadable single character names :-) dnolen is working on source maps to make it easier to debug
23:59clj_newb_2345hmm, my program is now taking 40% of the time