#clojure log - Nov 26 2012

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:29 devn: Madison Square Clabango

0:30 dnolen: wow can finally round trip js html 5 source map to CLJ data structure and back to js html 5 source map

0:30 devn: !

0:30 that's great

0:31 dnolen: yes so damn close now

0:31 just need to merge CLJS compiler map w/ closure map ...

0:31 devn: dnolen: recently i started working on a client project and found they're using google closure

0:31 i just about jumped out of my seat

0:31 my first experience with gclosure outside of clojurescript

0:32 dnolen: most obnoxious 80 lines of Clojure I've ever written ... grumble

0:32 devn: :)

0:32 dnolen: any ideas on cutting it down to size?

0:32 or is it necessarily large?

0:33 dnolen: cutting what down to size?

0:34 devn: the 80 lines

0:34 dnolen: maybe but I don't want to work on it anymore, I've already spent a few days on it - it works

0:35 devn: dnolen: is this (https://github.com/devn/codeq-playground) wortwhile at all, do you think?

0:36 dnolen: devn: yeah that looks pretty awesome - hope to find some time to actually try it out.

0:36 devn: i was thinking about having an open project which is just a bunch of codeq queries

0:36 dnolen: I think that's super useful - seeing as hardly anyone knows how to use codeq :)

0:36 devn: haha, well partly this came about as i was trying to write some docs for the codeq wiki

0:37 i think the hardest part of the whole thing is just the packaging of datomic

0:37 i wish we had `apt-get install datomic` and `brew install datomic`

0:37 i wrote a formula, but the hombrew guys said "ewww"

0:37 and rightly so

0:37 homebrew*

0:37 bin/* contains a lot of stuff

0:38 i 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

0:38 ./script/get-datomic, etc.

1:00 bbloom: dnolen: w00t on source maps

1:00 dnolen: are they playing nice with the web kit sources tab yet?

1:11 dnolen: bbloom: not quite there yet, putting in the finishing touches now

1:12 bbloom: hardest thing was just making sure we could encode and decode and get the same thing

1:13 nightfly_: 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?

1:14 bbloom: dnolen: cool. i'm starting to write more and more cljs code outside of the compiler itself

1:14 dnolen: would really enjoy the source mappings :-)

1:15 dnolen: bbloom: yes, yes, I know :)

1:16 bbloom: dnolen: 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

1:17 dnolen: I actually have a working prototype where i have some code of pure functions which returns a (what i'm calling) DomScript program

1:17 dnolen: 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 :-)

1:17 so i can mirror browser manipulations on other browsers :-)

1:18 it's pretty damn neat

1:19 dnolen: slightly more awkward to use than domina or jquery for small cases, but far nicer to work with for larger dom transformations

1:21 dnolen: sounds interesting - looking forward to a write up

1:23 bbloom: dnolen: i'm probably gonna write it up and release it in pieces, starting with the stack language

1:23 dnolen: it's heavily inspired by www.factorcode.org

1:29 tomoj: nightfly_: I've done that sometimes

1:37 jyu: does anybody share why you use datomic?

1:44 wingy: jyu: its db done correct

1:48 jyu: the 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.

1:49 wingy: jyu: its ridiculous that they don't wanna pay for good techs

1:49 it's like wanting to use heroku but not wanting to pay for it

1:51 bbloom: wingy: 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

1:52 wingy: bbloom: i agree on that one .. they should definitely open source it

1:52 bbloom: wingy: 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

1:52 p_l: well... is it their core money bringer?

1:52 bbloom: wingy: meanwhile, oracle just keeps jacking their licensing fees

1:52 p_l: bbloom: that's Oracle-specific problem, actually

1:53 bbloom: p_l: no it isn't

1:53 p_l: I used to work for microsoft

1:53 p_l: I've seen it plenty of times

1:53 p_l: you should not build your business on closed source software

1:53 period.

1:53 p_l: or, let me clarify

1:54 p_l: it can be "closed" source, as long as i get a copy of the source when i buy it

1:54 p_l: and if you go out of business, i can carry on with the code base

1:54 and you can't just keep jacking the licensing costs annually

1:55 wingy: when 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?

1:55 p_l: bbloom: 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"

1:55 bbloom: p_l: which isn't cheap :-P

1:55 p_l: as for Oracle... Ellison makes money sharks look like generous fuzzy kittens

1:55 bbloom: heh.

1:56 the point is: datomic is super mega awesome cool

1:56 wingy: I don't like that dude .. he thinks he owns the world

1:56 bbloom: and i'd happily pay rich hickey and company money for datomic and all the other cool stuff they've done

1:56 but i won't build a business on datomic unless i can be sure that it's not undue business risk

1:56 p_l: but they need to make a source license as well?

1:56 wingy: bbloom: me too .. tell them to open source it!

1:57 p_l: wingy: you should not open source the core money bringer without very careful planning

1:57 bbloom: p_l: I dunno, consider Havok Physics engine

1:57 it's a pretty popular middleware system

1:57 used by LOTS of AAA games

1:57 wingy: look at mongodb .. its pretty awesome business model

1:57 p_l: OTOH, if you open source it with AGPL, I'm flat out calling you for being money grubbing license terrorist

1:57 bbloom: each license comes with the source code

1:57 i like the havok model

1:58 but games are a little easier

1:58 p_l: bbloom: gamedev stuff usually comes with source code, outside of big complete engines with "lite" licenses for just binaries

1:58 bbloom: because your license covers "titles"

1:58 titles generally have a discreet ship date

1:58 so your business isn't locked in for the next title

1:58 services are generally a little different

1:58 because you don't have a gold master print it to DVD version of a web service

1:58 p_l: bbloom: not only that, it's just that in gamedev, you often *need* the source to get the project to build, let alone fly :)

1:58 wingy: should i use wrap-resource instead of wrap-file for Light Table to be able to find the folder?

1:59 bbloom: when a company goes down they won't outsource the code?

2:00 i mean open source it

2:00 bbloom: wingy: no, generally not

2:00 p_l: wingy: depends on how they go down

2:00 wingy: so all clients are just fucked? hmm

2:00 bbloom: wingy: I sold my company to salesforce

2:00 wingy: salesforce owns the software

2:00 p_l: Symbolics for example... No one fucking knows who got copyright to what

2:00 bbloom: wingy: lots of people have asked me to open source it, but that's just not my call

2:01 wingy: i guess it depends on what the buying company is indenting to do with the software .. kill it .. or taking over it

2:01 bbloom: what was your company?

2:01 bbloom: wingy: http://www.crunchbase.com/company/thinkfuse

2:02 wingy: gj

2:02 bbloom: thx

2:02 but that's why you can't depend on closed source software

2:03 because even if you trust the current stewards, they might not be the stewards forever

2:04 that said: datomic is super fucking cool

2:04 and i'd love to be able to use it for a real project :-) i'm even willing to pay, heh

2:05 wingy: rich and the team behind seem to be reasonable .. perhaps they have plans of open sourcing it

2:05 brainproxy: dnolen: now that fressian is open source, is it something you'll be looking to leverage w/in core.logic?

2:06 bbloom: brainproxy: what's fressian?

2:06 brainproxy: bbloom: https://github.com/Datomic/fressian

2:07 it's the binary data library used interally by datomic

2:07 bbloom: brainproxy: interesting

2:08 brainproxy: am i right in assuming BISON : JSON :: Fressian : EDN ?

2:08 brainproxy: i think that's the basic idea

2:09 bbloom: interesting

2:09 p_l: bbloom: personally, for "breadwinner" code, I wouldn't "open source" it, but give exclusive licenses to source code for my customers

2:10 bbloom: p_l: yeah, that's what i'm saying

2:12 p_l: OTOH, I once had a very, very evil idea on how to "open" some source code

2:12 provide the code, but not the compiler or language spec :>

2:15 bbloom: brainproxy: how does it relate to core.logic tho?

2:23 jyu: what make the datomic special

2:25 bbloom: jyu: there are a bunch of videos on the datomic site

2:25 jyu: watch them :-)

2:26 jyu: and http://www.infoq.com/author/Rich-Hickey too

2:26 jyu: bbloom: thanks

2:26 brainproxy: bbloom: 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

2:27 bbloom: brainproxy: hmm

2:27 * Nocab is reading SICP, and it has a few interesting things I'd like try out in clojure

2:28 brainproxy: bbloom: i may have misunderstood that comment/observation

2:28 Nocab: but some of the things Id like to try in clojure depends on local mutable state inside functions

2:28 bbloom: Nocab: you can create atoms and use swap! or reset!

2:28 Nocab: is there are conventional or idiomatic way to do that in clojure?

2:28 * Nocab looks up atoms

2:28 brainproxy: Nocab: setup an atom w/in a let

2:28 bbloom: (doc atom)

2:28 clojurebot: "([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

2:28 bbloom: er:

2:28 yeah, ok apparently that works without , or &

2:29 haha

2:30 * Nocab finds a repl

2:30 brainproxy: Nocab: leiningen is your friend in that regard, if you don't have it setup already

2:31 simple as `lein repl`

2:31 Nocab: brainproxy: can the atom be anything? am I reading this correct, if I assume the atom here is a mutable map?

2:31 http://clojure.org/atoms

2:31 brainproxy: no worry

2:31 brainproxy: Nocab: you can stick what you want inside the atom

2:31 Nocab: I do have lein and sublime-text setup reasonably well :)

2:31 brainproxy: then use reset! or swap!

2:32 Nocab: http://clojuredocs.org/clojure_core/clojure.core/reset!

2:32 this page seems to have all my needs covered

2:32 thanks :)

2:32 brainproxy: if 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

2:32 Nocab: mmm

2:32 brainproxy: and yeah, clojuredocs is nice

2:33 http://clojuredocs.org/clojure_core/clojure.core/swap!

2:33 Nocab: so

2:33 brainproxy: if you're planning on sticking a hash-map inside your atom, then swap! is probably the way to go

2:33 Nocab: mmhm

2:34 as for something completely different

2:34 anyone here use sublime-text for their clojure needs?

2:34 brainproxy: emacs24 ftw! :)

2:34 Nocab: I have pretty much -everything- setup as I like, but I cannot get the sublimerepl plugin to work properly

2:34 brainproxy: I tried that setup, its OK. but I sublime-text has won me over quickly ;)

2:34 bbloom: mostly emacs and vim guys around here :-)

2:35 sublime is pretty tho, that's for sure

2:35 Nocab: it just feels more lightweight and nimble than emacs

2:35 and its available for all the platforms I care about, so Im giving it a spin ;)

2:36 brainproxy: i 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

2:36 Nocab: heh

2:41 tomoj: bbloom: 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?

2:42 bbloom: tomoj: I'm too tired to deeply consider this problem now :-P

2:42 tomoj: ask me again tomorrow :-)

2:42 tomoj: no prob

2:42 bbloom: i do find this stuff interesting tho

2:42 tomoj: hopefully I'll have a fork of cljque with that working tomorrow

2:48 Nocab: tomoj: sounds like C#'s TPL ;)

2:50 bbloom: Nocab: it's exactly like C#'s TPL

2:50 Nocab: the C# guys deserve a lot of credit for their work on parallel and reactive libraries

2:51 in 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

2:51 Nocab: heh

2:51 I like C#

2:51 bbloom: i do to, i much prefer it to java

2:51 Nocab: the thing I like -least- about C# is the lacking type-inference in the compiler

2:51 it cant infer return types

2:51 bbloom: i blame C# 3 and Linq for getting me into functional programming :-)

2:52 Nocab: making you have to declare a billion generic type-signatures if you want to do any sort of cool funcitonal programming

2:52 and then all those type-signatures removes all the gain the functional programming would have gotten you code wise

2:52 that sort of stuff annoys me

2:52 bbloom: *shrug* it's not for you :-)

2:52 Nocab: but I may be using C# in other ways than Anders Heljberg anticipated :P

2:53 bbloom: the goal of C# is to drag cube moneys half way around kicking and screaming to lisp

2:53 Nocab: hah

2:53 bbloom: it accomplishes that mission quite well

2:53 Nocab: anyway. care to tell me what Im doing wrong here?

2:53 bbloom: moneys -> monkeys

2:53 Nocab: http://pastebin.com/nQTp8rKP

2:54 bbloom: 1) use refheap :-)

2:54 tomoj: 2) whitespace :P

2:54 bbloom: reset! isn't being called

2:54 you need () around that

2:55 Nocab: indeed

2:55 my bad

2:55 it was initially written as a #() lambda

2:55 so I guess I forgot to re-wrap it when rewriting it :)

2:55 thanks

2:55 bbloom: entertainingly

2:55 this thing you're making

2:55 with get and set

2:55 it's basically the same as the underlying atom it's wrapping :-P

2:56 Nocab: this is just a simplest-possible function-local mutable structure POC for me, myself

2:56 bbloom: yup, it's totally reasonable for learning

2:56 Nocab: now that I see it's working, I can expand it to be useful ;)

2:56 tagrudev: hello, 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 ?

2:57 in repl

2:57 bbloom: tagrudev: are you using `lein repl`?

2:57 tagrudev: yes

2:57 bbloom: tagrudev: or rather, ./script/repl here?

2:57 tagrudev: lein repl

2:57 bbloom: k

2:58 use:

2:58 (doc require)

2:58 clojurebot: "([& 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

2:58 bbloom: examples on clojure docs

2:58 http://clojuredocs.org/clojure_core/clojure.core/require

2:59 Bergle_1: noob question. [this is extracted from something else]. Why doesnt this work -- (doseq [[y] (range 10)] (println y))

2:59 get error - nth not supported on this type

2:59 bbloom: Bergle_1: the [y] binding is trying to unpack a vector

3:00 doseq inherently unpacks a sequence

3:00 Bergle_1: oh duh.

3:00 bbloom: you want (doseq [y (range 10)] (println y))

3:00 Bergle_1: i chased my tali for 30 min now on that

3:00 thankyou

3:00 i knew it had to be soemthing dumb.

4:15 cgrand: morning @cemerick

4:16 cemerick: cgrand: good morning! :-)

4:16 clojurebot: Cool story bro.

4:17 HolyJak: which 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 :-)

4:17 cemerick: cgrand: I see you've been tinkering with map perf and such. What's prompted that?

4:17 HolyJak: Glad you liked it :-)

4:19 cgrand: cemerick: profiling/optimizing on a client project

4:20 cemerick: That's great. I had no idea you had snagged work that involved Clojure.

4:24 cgrand: cemerick: well my legacy (and local) clients are non-clojure as you know but for years now I have had Clojure gigs

4:25 cemerick: Huh. I suppose I forgot, if I knew that already.

4:28 xumingmingv: ,(type (int 10))

4:28 clojurebot: java.lang.Integer

4:28 xumingmingv: found an interesting thing

4:29 if you execute this form: "(type (int 10)) " in a `lein repl` , the result will be "java.lang.Long"

4:30 while if you execute the same form in the regular REPL, the result is "java.lang.Integer"

4:30 anyone knows why?

4:33 cemerick: xumingmingv: your lein REPL is running 1.3.0, the "regular" REPL is running probably 1.4.0.

4:36 xumingmingv: yeah, that's indeed my situation..

6:13 Anderkent: Is there a way to tell clojure.pprint to print out meta? *print-meta* doesn't seem to work

7:36 Anyone know why defmulti checks whether the name is already def'ed? It messes up my code coverage tool attempts :P

7:36 ,(source defmulti)

7:36 clojurebot: Source not found

7:37 Anderkent: geh.

8:55 hotwoofy: does 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.

9:01 konr_trab: Is it possible to set an environment variable inside a lein plugin and then call another task?

9:16 mccraig: is there a stdlib function (i.e. not the (var…) special-form) which will return me a Var given a Symbol ?

9:16 cemerick: konr_trab: env vars cannot be set within the JVM

9:16 mccraig: resolve

9:17 mccraig: thx cemerick

9:52 solussd: i know this must exist… how can I add pre/post conditions to an existing function?

9:53 or rather, take an existing function and create the same function with pre/post conditions

9:55 cemerick: solussd: See https://github.com/clojure/core.contracts and https://github.com/fogus/trammel

9:55 solussd: cemerick: thanks

10:17 devinus: amalloy: weren't you writing a titandb lib?

10:20 googya: (let [ {:keys [join-date email]} mm ] (println email)) how this work?

10:22 Binding values to their keys’ names?

10:22 ucb: googya: mm is destructured as a map and the values for the keys are bound to the key-names

10:24 clojure-newb: hey guys, I'm using ring-json-resonse to jsonify a single result item in the response… what do I use for a collection ?

10:25 weavejester: clojure-newb: If you return a vector, ring-json-response will turn it into a JSON array

10:25 clojure-newb: Are you using the ring/ring-json library for this?

10:26 clojure-newb: weavejester: yes I am

10:26 0.1.2

10:26 weavejester: clojure-newb: So I usually use something like: (response (vec list-of-results))

10:27 clojure-newb: I see, 'vdc' is key here

10:27 weavejester: clojure-newb: The reason it has to be a vector is because seqs are used for streaming in Ring.

10:27 clojure-newb: *vec

10:27 sorry

10:27 thx for the help

10:29 weavejester: that explains why I was seeing the Transfer-Encoding: chunked header val

10:47 jweiss: i 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:49 bhenry: can 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:50 s/batch/bash

10:50 antares_: jweiss: it has been "pretty darn close" for a while. The remaining bits of work are now on the clojars side.

10:51 jweiss: antares_: that's what i'm trying to figure out, if i upgrade will that missing stuff bother me?

10:52 antares_: jweiss: every open source project I know or use is already on lein2

10:52 clojars changes are relevant mostly for library developers

10:52 jweiss: antares_: yeah, my project consists of several projects, some of which are libraries for others

10:54 i quite often push snapshots to clojars. just wondering if there's some problem i might hit in lein2

10:55 uvtc: jweiss: my understanding is that lein 1 is now legacy.

10:55 antares_: jweiss: I haven't seen any issues with snapshot publishing via scp

10:55 however, I do not consider myself to be completely on top of the clojars changes

10:55 so we will see

10:55 Anderkent: Is there something like clojure.lang.LineNumberingPushbackReader, but one that assigns ^{:line} to each token, not just lists?

10:55 jweiss: uvtc: i don't understand how the 'stable' release is actually legacy but the 'current' release is still called preview?

10:55 antares_: but so far as a long time lein2 user and maintainer of over 20+ libraries, I haven't seen any issues

10:56 jweiss: ok, good enough for me to try it out :)

10:56 antares_: jweiss: it has been called "preview" for almost a year, at preview10 for over 1 month

10:57 jweiss: antares_: i know, but that's not really as relevant as the fact that the stable release hasn't been re-pointed at it

10:57 there must be some reason.

10:57 uvtc: jweiss: 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:57 jweiss: right, i'm trying to figure out what's blocking it and whether it'll affect me.

10:57 uvtc: jweiss: you might be able to get more specific details on #leiningen.

10:57 jweiss: ah didn't know it had its own channel

10:58 antares_: jweiss: clojars changes have to be finished first

10:58 Anderkent: bhenry: AFAIK it's a lein bug - it will output info about dependencies being fetched to stdout instead of stderr

10:58 antares_: because leiningen has a list of default repositories

10:59 and if you ship it, those repositories better work and not change

10:59 Anderkent: bhenry: 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:59 bhenry: the second time it's not fetching anything so the output is right

11:00 bhenry: Anderkent: 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:02 Anderkent: is it per session maybe?

11:22 marcellu`: 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:25 antares_: marcellu`: this means something drags Clojure 1.2 on the classpath

11:26 marcellu`: antares_: OH ok, should be able to track it down, thanks!

11:28 antares_: marcellu`: are you using lein2?

11:28 if so, lein deps :tree may help you

11:28 marcellu`: antares_: yup. Thanks again!

11:28 antares_: 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:28 jweiss: anyone know the equivalent to slime's ,sayoonara in nrepl.el?

11:32 marcellu`: antares_: hmm Clojure 1.2 isn't in the tree at all. Would clojure-contrib 1.2 do it?

11:33 S11001001: jweiss: I would also like to know how to quit nrepl :)

11:36 antares_: marcellu`: monolithic Clojure Contrib is no longer developed

11:36 marcellu`: and won't work with 1.3 or 1.4. See http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

11:38 S11001001: ~contrib

11:38 clojurebot: Monolithic 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:20 jweiss: S11001001: nrepl-quit. not bound by default

12:21 S11001001: jweiss: neato

12:21 :r

12:22 TimMc: < amalloy> (def exit (lazy-seq (System/exit 0)))

12:22 => exit ;; done!

12:22 S11001001: ha ha

12:57 muhoo: wait, what?

12:57 mdeboard: I'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:57 appreciate any guidance on this

13:01 S11001001: mdeboard: exchange the position of your with-open and doseq

13:01 TimMc: M-x paredit-convolute-sexp

13:01 S11001001: mdeboard: probably the my-pdf too needs to go outside the doseq

13:01 mdeboard: everything inside the doseq happens *every time*

13:03 mdeboard: S11001001: If I swap lines 68 and 69, I get an "IOException Stream Closed"; closing the PdfStream object in `(fingerprint)` closes the stream apparently.

13:04 S11001001: mdeboard: then don't do that

13:05 mdeboard: S11001001: 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:05 S11001001: mdeboard: then fix your loop so you open the previous output instead of the original input each time

13:06 mdeboard: go through the logic of stamp-pdf carefully, tracing the loops with paper if you have to

13:06 mdeboard: S11001001: How so?

13:07 S11001001: mdeboard: see how you *always* open /home/matt/courseload/stillwaiting.pdf?

13:07 mdeboard: Yeah

13:07 S11001001: don't do that

13:07 mdeboard: I see, that admittedly was a hack to get around another issue

13:08 And 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:09 S11001001: mdeboard: 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:09 mdeboard: I see

13:10 S11001001: mdeboard: 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:11 mdeboard: S11001001: 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:11 S11001001: mdeboard: No.

13:12 mdeboard: That is, I modified the signature of `(stamp-pdf)` to accept the PdfReader object as an arg; I still get that DocumentException

13:13 S11001001: mdeboard: The global my-pdf doesn't get reexecuted each time you reference it

13:14 mdeboard: S11001001: 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:14 S11001001: I changed the `(stamp-pdf)` function in line with your advice to https://gist.github.com/11b0e9efa44a67db8a0d and it works well, thanks much

13:15 S11001001: np

13:15 mdeboard: It 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:16 I just couldn't close the loop so to speak

13:30 borkdude: is there a function like (split-p [p coll] [(filter p coll) (filter (comp not p) coll)]) ?

13:30 antares_: borkdude: partition?

13:30 borkdude: replace split-p by fn

13:31 TimMc: ~separate

13:31 clojurebot: separate is in clojure.contrib.seq-utils, but just use (juxt filter remove) instead

13:31 borkdude: antares_ partition(-by) makes partitions depending on when the value of the predicate changes

13:31 timmc ok, not in core then I guess

13:32 TimMc: &((juxt filter remove) odd? (range 10))

13:32 lazybot: ⇒ [(1 3 5 7 9) (0 2 4 6 8)]

13:33 borkdude: timmc ok yes

13:33 timmc tnx

13:46 can this predicate be any shorter? #(= :keyword %) ?

13:47 tomoj: #{:keyword} is not quite the same but usually close enough

13:48 borkdude: lol, yes tnx

13:54 does juxt have an equivalent in Haskell?

13:55 josteink: how do you generate an error in clojure?

13:55 as in (error X) in scheme?

13:55 S11001001: borkdude: liftA2 (,)

13:55 nDuff: josteink: I strongly suggest slingshot

13:56 josteink: sounds frameworkey

13:56 nDuff: josteink: ...the built-in thing is http://clojuredocs.org/clojure_core/clojure.core/throw

13:56 borkdude: S11001001 thank you, will look into that

13:56 josteink: I just need a one-off failer :)

13:56 S11001001: josteink: it isn't.

13:56 nDuff: joegallo: ...but slingshot gives you calls that feel more clojure-y

13:56 josteink: nDuff: thanks. that''ll do

13:56 nDuff: joegallo: (and no, it doesn't place other demands on your design)

13:56 technomancy: ex-info is a huge improvement over regular Exceptions though

13:57 Raynes: nDuff: He isn't joegallo.

13:58 S11001001: borkdude: if you're looking for a variadic version, that's called distribute.

13:58 josteink: hehe

13:58 tomoj: S11001001: what's *** for applicatives?

13:58 borkdude: since when does it matter what person you are?

13:59 S11001001: tomoj: you'd need a newtype for that

13:59 Raynes: tomoj: (foo *** bar) (x,y) = (foo x, bar y)

14:00 S11001001: tomoj: see Data.Functor.Product

14:01 Raynes: Oh, for applicatives. I didn't realize it was a specific question.

14:01 S11001001: tomoj: I assume of course you're looking for Applicative f, Applicative g => Applicative (forall a. (f a, g a))

14:02 KolmeChousukea: Raynes, I am three Chousukes

14:03 New and improved

14:03 S11001001: borkdude: anyway, distribute can specialize to [a -> b] -> a -> [b], among many other things

14:03 KolmeChousukea: the functionality of 3 in 1.

14:04 S11001001: tomoj: and I forgot about ***, thanks

14:06 saolsen: can extend-type be used to extend a java class with a java interface?

14:06 dnolen: saolsen: no

14:08 oskarth: anyone got the link to clojure conj 2012 text slides?

14:08 saolsen: I 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:08 i guess a new type in this case, not a new class

14:08 S11001001: saolsen: most sorty functions also take a Comparator.

14:09 ,(supers (class (fn [] 42)))

14:09 clojurebot: #{java.lang.Runnable clojure.lang.Fn java.util.concurrent.Callable clojure.lang.IObj java.io.Serializable ...}

14:09 saolsen: < and > dont :(

14:10 S11001001: ,(supers clojure.lang.IFn)

14:10 clojurebot: #{java.lang.Runnable java.util.concurrent.Callable}

14:10 S11001001: ,(supers clojure.lang.AFn)

14:10 clojurebot: #{java.lang.Runnable java.util.concurrent.Callable clojure.lang.IFn java.lang.Object}

14:10 S11001001: I will find this thing

14:10 ,(supers clojure.lang.AFunction)

14:10 clojurebot: #{java.lang.Runnable clojure.lang.Fn java.util.concurrent.Callable clojure.lang.IObj java.io.Serializable ...}

14:10 S11001001: ,(drop 5 (supers clojure.lang.AFunction))

14:10 clojurebot: (clojure.lang.IMeta clojure.lang.IFn clojure.lang.AFn java.util.Comparator java.lang.Object)

14:35 sandover: is there an approved way for someone outside the clojurescript project to log an issue?

14:36 cemerick: sandover: anyone should be able to open a ticket

14:36 sandover: on jira?

14:36 cemerick: yeah

14:36 Probably best to raise the issue on the ML first.

14:37 josteink: how do I import a full namespace in a clojure file?

14:38 * josteink cannot get the (ns) (use) or (require) syntax right

14:38 josteink: just... import as is without a need for prefixing

14:38 nDuff: josteink: use does that.

14:38 squidz: What would be the best way in clojure to search xml for attributes, then replace nodes containing said attribute with a new node?

14:38 nDuff: josteink: can you show how you're trying to use it?

14:39 josteink: (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:39 sandover: mine 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:40 josteink: nDuff: heh.

14:40 sandover: as in, "java -cp (classpath) clojure.main "cljsc.clj" hello-world.cljs" takes 1:30, but outputs code after only 0:30!

14:40 josteink: let me try again one last time :)

14:41 (use '[constraints.elements :exclude [loop]])

14:41 dnolen: sandover: what version of cljs?

14:41 josteink: victory is mine :)

14:41 sandover: master cloned today

14:41 nDuff: josteink: any reason you aren't putting it in your ns declaration?

14:42 josteink: I couldnt get the syntax right ;)

14:42 dnolen: sandover: I think I've observed this as well - open a ticket

14:43 nDuff: josteink: (ns my-ns (:use [constraints.elements :exclude [loop]]))

14:43 josteink: ...that's assuming :exclude to be correct; my own code uses :use only in conjunction with :only

14:43 josteink: compiler says it's ok :)

14:43 thanks

14:43 * josteink fools around with constraint-based programming from SICP

14:43 josteink: in clojure

14:44 I feel there is some idiomatic mismatch, but job #1 is getting it running

14:44 I can improve upon it from there

14:47 dnolen: sandover: probably something silly I did - need to do a git bisect to figure it out ...

14:49 seangrove: Is this the best example of how to do automated tests for cljs code? https://github.com/dustingetz/cljs-bootstrap

14:50 Even 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:51 dnolen: seangrove: maybe not related but I'm surprised no one's ported clojure.test yet

14:51 sandover: made a new issue for clojurescript compiler hang behavior; http://dev.clojure.org/jira/browse/CLJS-430 . (sorry, accidentally marked it 'major'!)

14:52 dnolen: sandover: so did you try building via the REPL and observed the same behavior there?

14:53 sandover: i did not have a chance to run (build ) at the REPL, no

15:03 CLJS (build ) done with the REPL runs normally

15:10 mccraig_: anyone got a bunch of dsl creation experience and a few minutes to chat ?

15:13 Raynes: ~anyone

15:13 clojurebot: Just 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:14 technomancy: clojurebot: metaprogramming?

15:14 clojurebot: Titim gan éirí ort.

15:14 Raynes: This is the #clojure IRC channel. Everyone has DSL experience. ;)

15:14 technomancy: clojurebot: metaprogramming in lisp?

15:14 clojurebot: Metaprogramming in Lisp is like Chinese food in China; they just call it food there.

15:14 technomancy: ^^

15:15 pjstadig: clojurebot: metaprogramming is <reply>Metaprogramming in Lisp is like Chinese food in China; they

15:15 just call it food there.

15:15 clojurebot: Ok.

15:15 pjstadig: hmm those line breaks!

15:15 scriptor: ERC?

15:15 clojurebot: Counterclockwise aka ccw at http://code.google.com/p/counterclockwise/

15:15 Raynes: You broke everything now.

15:16 clojurebot: What does ERC have to do with CCW?

15:16 clojurebot: ccw is http://github.com/laurentpetit/ccw

15:16 Raynes: I KNOW THAT

15:16 grrr

15:16 I need to add factoids to lazybot so that I can control the infuriating little bugger.

15:19 pjstadig: k i think i fixed it

15:19 ~metaprogramming

15:19 clojurebot: Metaprogramming in Lisp is like Chinese food in China; they just call it food there.

15:20 pjstadig: i only teach clojurebot something once every six months and I always screw it up somehow

15:21 mccraig_: 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:23 squidz: What would be the best way in clojure to search xml for attributes, then replace nodes containing said attribute with a new node?

15:32 brainproxy: squidz: the 'enlive' library might be suitable, just depends on the xml you would be processing

15:32 as enlive is designed to work with html, but I've used it to transform xml in the past

15:37 squidz: brainproxy: 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:43 crease: squidz: have you tried clojure.zip/xml-zip?

15:51 brainproxy: squidz: if it's "very simple" xml as you say, then you will probably have luck transforming it w/ enlive

15:52 brian 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:53 crease: yah, that's probably the sensible way to do it

15:54 but if it's *really* simple:

15:54 (defn lightly-munge-xml [f, yer-xml]

15:54 (->> yer-xml

15:54 clojure.zip/xml-zip

15:54 (iterate #(-> % (clojure.zip/edit f) clojure.zip/next))

15:54 (take-while (complement clojure.zip/end?))

15:54 last

15:54 clojure.zip/root))

15:54 oops, multiline, apologies

15:54 brainproxy: crease: that's what refheap and gist are for :D

15:55 crease: yah, sorry, enthusiastic c/p

15:56 fmw: anybody 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:59 Frozenlock: fmw: https://github.com/levand/domina#important-note-on-browser-xpath-compatibility-ie-and-android

16:00 fmw: Frozenlock: I have only tested on Firefox and Chrome on GNU/Linux.

16:00 Frozenlock: I'm using domina and (css/sel "#some-id") works for me. :(

16:00 fmw: Frozenlock: I've checked out the project, compiled the tests and there it works for me too

16:00 just not in my own project for some odd reason

16:01 Frozenlock: Is it just with ids?

16:01 does (css/sel ".some-class") work?

16:04 dnolen: seangrove: hmm, not that big I don't think.

16:05 fmw: Frozenlock: no, that doesn't work either

16:06 e.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:09 tomoj: how is domina a "functional" interface to the dom?

16:09 the interface has clojure functions, so it's functional?

16:09 fmw: tomoj: 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:10 Frozenlock: fmw: 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:10 tomoj: I'll admit it seems somewhat idiomatic

16:10 nDuff: tomoj: the interface is defined in terms of composable functions, rather than objects or other abstractions.

16:11 tomoj: ah, right

16:11 fmw: Frozenlock: I'm normally using an in-browser REPL, but try to keep it clean with debugging

16:11 Frozenlock: thanks for your input, though

16:11 seangrove: 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:11 domina.css and domina.xpath still don't work for me, though

16:13 Frozenlock: Anyone 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:14 clojurer?

16:15 mdeboard: Clojurisprudence

16:15 tomoj: maybe 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:16 vs `lein with-project your.app 1.0.0 run` for no auto-update

16:16 which would also be sweet for repl

16:18 Frozenlock: I like the idea. I would like it even more if it existed already, but I like it :P

16:22 * nDuff scowls at refheap -- what's this "persona" thing, and why won't it work with my existing OpenID identity?

16:23 Frozenlock: tomoj: Is lein included in a uberjar?

16:23 bbloom: nDuff: persona is actually really cool

16:23 tomoj: no, if you're uberjar'ing my suggestion is worthless I think

16:23 Frozenlock: Aww :(

16:23 bbloom: nDuff: it's mozilla's attempt at openid done right

16:24 nDuff: bbloom: Bah. I already have an OpenID RP with a physical token backing it up. Last thing I want is another password.

16:24 tomoj: persona makes me unable to login to refheap in my browser

16:24 bbloom: nDuff: 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:24 i just assumed openid was DOA because it's too complex for a normal user

16:25 so i never bothered

16:25 llasram: tomoj: Conkeror?

16:25 tomoj: yeah

16:25 nDuff: bbloom: Anyone with a Google account can use OpenID.

16:25 tomoj: good think for refheap.el..

16:25 nDuff: bbloom: ...the complexity only comes in when you try to do interesting things with it.

16:25 bbloom: nDuff: except that your email address isn't an open id token

16:26 nDuff: bbloom: ...and I'm at a loss for why it needs to be.

16:26 bbloom: the user experience doesn't require entering that token.

16:26 bbloom: nDuff: only because people hard code it to google's endpoints

16:26 nDuff: bbloom: True enough. My personal domain, on the other hand, _is_ an OpenID token.

16:26 (granted, I'm an exception).

16:26 bbloom: nDuff: exactly: you're a wiiiide outlier

16:27 nDuff: good discussion here http://news.ycombinator.com/item?id=4580986

16:28 nDuff: bbloom: Does anyone offer physical-token-based auth for Persona?

16:28 If it's dual-auth capable, I _might_ be a possible sell.

16:28 TimMc: nDuff: I gave up BrowserId^WPersona as well.

16:28 bbloom: nDuff: i don't think so, it's too new. firefox is apparently integrating it into the browser tho

16:28 TimMc: I still can't believe Mozilla made a login screen that doesn't work with Firefox's password manager.

16:30 nDuff: ...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:30 clojurebot: to 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:30 bbloom: nDuff: several random sources from quick googling says that mozilla is developing two factor into the protocol

16:31 nDuff: I 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:31 bbloom: nDuff: you can apply hash-map

16:32 nDuff: bbloom: Not everything is a pair -- in fact, most things won't be.

16:32 bbloom: nDuff: do keyword pairs come first or second?

16:32 brehaut: nDuff: are you wantting to turn :a 1 2 3 :b 3 into {:a 1 :b 3} [2 3]

16:32 nDuff: brehaut: Exactly.

16:32 bbloom: ah ok what brehau said

16:33 nDuff: that seems odd tho… why not mandate that keyword pairs come before or after positional arguments?

16:33 TimMc: something something finite state transducer

16:33 * nDuff could do that, but doesn't particularly see the need.

16:33 bbloom: nDuff: clarity? :-P

16:33 nDuff: ...if mandating that pairs came at the end made cleaner code in the parser, I'd do so happily.

16:34 If someone abuses the flexibility to write dirty code, though, that's their problem.

16:34 brehaut: TimMc: wow, the wikipedia page for that gets confusing fast

16:35 tomoj: it'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:35 TimMc: &(split-with (complement keyword?) [1 2 3 :a 4 :b 5])

16:35 lazybot: ⇒ [(1 2 3) (:a 4 :b 5)]

16:35 bbloom: &(let [[positional kwargs] (split-with (complement keyword?) [1 2 3 :foo 4 :bar 5]), arg-map (apply hash-map kwargs)] [positional arg-map])

16:35 lazybot: ⇒ [(1 2 3) {:foo 4, :bar 5}]

16:35 TimMc: brehaut: It's also not exactly appropriate here, I think.

16:35 seangrove: fmw: Hmm, I'm using clojure 1.5.0, latest cljs, the explicit goog-closure-library-third-party dep in project.clj, and chrome

16:36 (domina/single-node (domina.css/sel "#main)) seems to work for me

16:36 fmw: Frozenlock, seangrove just fixed it, there was an old version of domina required through lein-git...

16:37 brehaut: TimMc: nevertheless, its been ten years since i looked at FSA properly

16:37 fmw: seangrove: thanks for checking, though

16:37 * technomancy twinges at the mention of lein-git

16:37 brehaut: TimMc: apparently i am super rusty

16:37 fmw: it was due to the old version being broken and failing silently

16:37 seangrove: Glad to hear! Domina is a good library, but a bit sad it hasn't had much activity recently.

16:37 TimMc: brehaut: That article is also super unhelpful.

16:38 fmw: seangrove: yes, it seems like a very decent way to deal with the DOM

16:38 I'm going to try to build composable UI "widgets" on top of it

16:38 brehaut: TimMc: looks like a job for a monad stack anyway

16:39 Frozenlock: fmw: you might already know it, but there's 'enfocus' that uses Domina and offer higher level functions.

16:39 tomoj: all the !'s don't cause composability problems?

16:40 TimMc: brehaut: Basically it's just an FSM that emits output on edge traversals.

16:40 bbloom: tomoj: you mean in domina?

16:40 tomoj: yeah

16:40 brehaut: TimMc: and what it emits doesnt necessarily correspond to the input?

16:40 bbloom: tomoj: the bigger issue for me is the ugliness with nesting

16:40 TimMc: Yeah.

16:41 Frozenlock: technomancy: are you aware of any 'auto-update' feature for a uberjared project? (By any chance..)

16:41 bbloom: tomoj: jquery abuses the javascript 'this keyword, which is actually surprisingly useful for working with deeply nested transformations and such

16:41 tomoj: hence the DOM library i'm working on utilizes a stack machine :-)

16:41 fmw: Frozenlock: yes, I had a look at Enfocus. seems like a good library

16:41 brehaut: TimMc: this is really cool, thanks :)

16:41 Hodapp: why do people bitch about JavaScript so much?

16:41 tomoj: yeah, excited to see it

16:41 TimMc: nDuff: I really dislike embedded kwargs, by the way -- better to have them in an optional map arg.

16:41 Hodapp: the only part of it I've found that is worth complaining about is the weak typing.

16:42 nDuff: TimMc: That's fair -- I'm supporting them here only for compatibility with another call.

16:42 bbloom: tomoj: i've got it working reasonably well, but i want it to be much more complete before releasing it

16:42 tomoj: I guess maybe you can apply composed actions to orphan nodes and clone when necessary to keep the side-effects from screwing things up?

16:42 bbloom: tomoj: there is a lot of surface area to the dom api

16:42 tomoj: yeah :'(

16:42 TimMc: Hodapp: "0" == 0 == "", "0" != "" -- you have to know about a ton of "features" to not use most of the time.

16:43 seangrove: bbloom: That souns pretty intense, any samples of what the interface looks like?

16:43 bbloom: sure

16:43 seangrove: https://www.refheap.com/paste/7004

16:43 seangrove: whitespace sensitive?

16:44 bbloom: no, it's postfix notation

16:44 seangrove: Ah

16:44 bbloom: that 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:44 then the ~label injects a value from clojure land, so in this case a string

16:44 text! sets the text content, and then '(append) keep' is a higher order postfix operation

16:45 append attaches the child to the parent and removes the child from the stack, but (append) keep will preserve the child on the stack

16:45 so that you can then clone it and ALSO prepend it :-)

16:45 just as an example

16:45 seangrove: Wow, looks interesting

16:45 Will definitely check it out when you release it

16:45 bbloom: seangrove: deeper explanations here http://docs.factorcode.org/content/article-dataflow-combinators.html

16:46 seangrove: I wonder how libraries around the DOM can go... I have a hard time writing functional code around it

16:46 bbloom: this way dom manipulations are programs as data! you can stream dom control commands across the network :-)

16:46 heavily inspired by PostScript. treating the DOM as a printer :-)

16:47 tomoj: hmm: "keep ( ..a x quot: ( ..a x -- ..b ) -- ..b x )"

16:47 bbloom: tomoj: yeaaaah, that bit is a tad confusing

16:47 * seangrove tries to wrap his head around that

16:47 tomoj: what is the type of your keep function, roughly?

16:47 bbloom: it's "row polymorphism"

16:47 the idea is that you have "quotations" which are just lists of instructions

16:48 the ..a just means some sequence of items on teh stack

16:48 you can think of every function as having type stack -> stack

16:48 in this case, it's telling you facts about the stack

16:49 in 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:49 hence the "keep"

16:49 you're keeping the top item of the stack

16:49 even after applying the quotation

16:50 functions 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:50 for 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:50 DUPlicates it :-)

16:51 muhoo: bbloom: is your dom library up on github somewhere?

16:51 bbloom: muhoo: not yet, going to publish the stack language library first

16:52 muhoo: cool, thanks.

16:52 tomoj: guess I should find a factor tutorial

16:53 bbloom: tomoj: if you like videos, the google tech talk is good: http://www.youtube.com/watch?v=f_0QlhYlS8g

16:53 tomoj: I do, thanks :)

16:53 bbloom: the benefit of stack/concatenative languages is that side effects are left to right

16:53 so it's much easier to reason about mutation

16:54 since the dom is inherently mutable, any attempt to project a functional interface onto it is kinda doomed from the start

16:54 so 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:54 and since there is no wrapping of dom elements to pass around, it should perform reasonably well

16:55 raw dom nodes get stored on the stack

16:55 no complex monad allocations like jquery and whatnot

16:55 tomoj: so 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:55 bbloom: although right now my interpreter is hilariously inefficient, allocating cons cells left and right

16:55 tomoj: not quite.

16:56 line 1 grabs the #root element and pushes it on the stack

16:56 clojurebot: trampoline is http://groups.google.com/group/clojure/browse_thread/thread/6257cbc4454bcb85/3addf875319c5c10?#3addf875319c5c10

16:56 tomoj: oh, the whole thing is a (stack -> stack) still..

16:56 bbloom: lines 2 through 5 create <div class="button" style="…">text here</div> and pushes that on the stack

16:56 (append) keep will put the button div into the root element

16:57 but leave both the button and the root element on the stack

16:57 clone will replace the element with a clone of itself

16:57 and then prepend that

16:57 technomancy: huh, weird; that factor video won't play, but it also doesn't show a "please install flash" message

16:57 bbloom: technomancy: odd.

16:57 technomancy: plays for me

16:59 also good: http://evincarofautumn.blogspot.com/2012/02/why-concatenative-programming-matters.html

17:00 jamii: dnolen: proposed bloom^L query syntax - https://gist.github.com/4150891

17:00 dnolen: seems reasonable?

17:02 bbloom: my notation is different than factor's by necessity of clojure's reader syntax… so i also need to document it well before releasing :-)

17:03 i've been translating and testing little chunks of jquery code and the result is almost always dramatically nicer than jquery syntax

17:06 ChongLi: I think my friend took down 4clojure by trying to do a search

17:06 is that crazy?

17:06 tomoj: interesting, I've been working on a pointless library as well, but struggle when I need points

17:06 now I have to go learn factor, so thanks and no thanks :/

17:07 ChongLi: 502 bad gateway

17:07 :(

17:07 bbloom: tomoj: lexical variables can be implemented reasonably easily: http://docs.factorcode.org/content/vocab-locals.html

17:07 but having things like dip and keep make the need pretty rare

17:14 dnolen: jamii: looks neat though I can't provide much more specific feedback since I haven't had time to really dig into bloom yet.

17:14 jamii: dnolen: ah, ok :)

17:15 dnolen: definitely on my list of things to do very soon - but been super heads down w/ CLJS source mapping in my free time.

17:27 jamii: dnolen: 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:28 dnolen: jamii: don't worry, cljs compiler is a mix of clean and gross ;) fortunately it's not much code.

17:29 jballanc: ChongLi: it's working for me...maybe clear cookies?

17:35 ChongLi: jballanc: it's fine now

17:35 it was down for about 3 minutes

17:39 dnolen: jamii: I wonder if your CLJ bloom stuff could work in CLJS via http://www.webrtc.org ?

17:39 jamii: dnolen: clojurescript / applets was one of the reasons I originally targeted clojure

17:40 dnolen: I want to work on in-browser p2p networks

17:40 dnolen: 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:41 dnolen: jamii: http://stackoverflow.com/questions/10904636/webrtc-p2p-update ?

17:43 dyreshark: ls

17:43 lazybot: bin boot home lost+found media mnt srv swap var

17:43 jamii: dnolen: I wonder if its possible to do PEX-style hole punching or if you have to rely on a stun server

17:58 derrida: Hey 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:58 that 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:59 also, once the "REPL-y" repl is booted, I can then compile forms and they are sent to that repl

18:00 I 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:01 technomancy: derrida: for some reason nrepl-interaction-mode isn't getting enabled upon connect

18:01 derrida: fwiw, this happens to me in osx, my friend that is using linux and installed alongside me did not experience the same result.

18:02 technomancy: should I need to add that to my init files manually if I installed via melpa?

18:03 adding the hook is no issue, I just got worried because my experience was not consistent with my friends.

18:03 technomancy: derrida: no, it just means there's a bug in the connect hook

18:03 no idea what causes it, but a few people have asked in here about it

18:03 derrida: that makes me feel better anyway

18:04 technomancy: you're not using aquamacs, are you?

18:04 tomoj: bblöom: so how do you differentiate between pushing a function to the stack and calling a function

18:12 derrida: technomancy: nah

18:12 wink: "I don't always C-u M-x, but when I do, I'm nrepl-jack-in."

18:12 derrida: technomancy: I compiled emacs from homebrew for X11, I tested with emacsforOSX pre-compiled though and it was the same thing

18:31 bbloom: tomoj: 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:32 tomoj: ah, now I understand (append) keep

18:33 bbloom: yeah, that example is just me testing our various features

18:33 keep is relatively complex, so it's a good test

18:33 it's defined as: over (call) dip

18:34 and dip itself is a primitive which also invokes 'call

18:34 so it's a double layer of quotations and such, exercises the stack pretty well

19:26 firesofmay: Hi, 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:35 devn: heh firesofmay

19:35 that's sort of the supreme irony is that it doesn't have examples

19:40 * devn declares dotfile bankruptcy

19:45 mdeboard: I really wish Python had type hinting. Would save so much unnecessary commenting.

19:45 s/python/every language

19:47 KolmeChousukea: mdeboard, you mean Haskell style type annotations?

19:47 mdeboard: No, Clojure style type-hinting in function signature

19:47 KolmeChousukea: I do love how in Haskell type signatures are basically sufficient as comments most of the time

19:47 mdeboard, example?

19:48 mdeboard: (defn some-fn [^Integer i ^String s] (+ i (read-string s)))

19:48 ben_m: Also helps with performance!

19:48 mdeboard: http://clojure.org/java_interop#Java%20Interop-Type%20Hints

19:48 KolmeChousukea: Ah yes

19:49 wingy: what is the difference between (file/wrap-file "public") and (resource/wrap-resource "public")?

19:51 xeqi: wingy: file/wrap-file looks on the filesystem, resource/wrap-resource looks on the classpath

19:52 so resource/wrap-resource can find resources inside jar files

19:52 wingy: xeqi: which one do i wanna use to serve static files?

19:53 xeqi: from the file system or classpath? I usually use resources

19:53 wingy: can i use (file-info/wrap-file-info) with the latter?

19:54 also, 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:55 xeqi: wingy: I believe those work together, just make sure wrap-file-info is the outside middleware

19:55 resources/public would work

19:55 wingy: ok thx

19:55 xeqi: * for a lein2 project w/ default :resource-paths

19:56 wingy: but on the other hand perhaps i can control it more with using the former one

19:57 eg. 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:18 firesofmay: Hi, 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:19 Anyone?

20:19 clojurebot: Just 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:23 moogatronic: firesofmay: what did you try?

20:24 firesofmay: looks like you just need to do 'lein run'

20:24 firesofmay: moogatronic, 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:24 moogatronic, java -jar target/session-0.1.2-SNAPSHOT-standalone.jar

20:24 moogatronic, but I got Exception in thread "main" java.lang.NoClassDefFoundError: session/server

20:24 tanzoniteblack: firesofmay: you might try 'lein repl'

20:24 firesofmay: moogatronic, okay.

20:24 moogatronic: right, try lein run

20:25 that will run the :main

20:25 firesofmay: moogatronic, okay let me try

20:25 moogatronic: firesofmay: 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:25 firesofmay: moogatronic, Getting Exception in thread "main" java.lang.NumberFormatException: null

20:26 moogatronic, Inside project.clj it says : :main ^{:skip-aot true} session.server

20:28 moogatronic: firesofmay: check out https://github.com/kovasb/session/blob/master/src/clj/session/server.clj

20:29 the -main shows what args and setup the server is expecting.

20:29 firesofmay: moogatronic, Yeah I was checking that. I did lein run and switched to session.server ns.

20:29 moogatronic, What to pass to -main? I am not clear on that.

20:29 moogatronic: the cmd line args are passed there.

20:29 i'm not sure either, i've never looked at this prj. =)

20:29 looks like datomic is set up with the last param

20:30 the listening port is set with the first param

20:30 hughfdjackson: are there interoperable client and server libraries?

20:30 firesofmay: moogatronic, okay

20:30 hughfdjackson: i'm basically writing a little proxy for fun

20:30 first stage is to get pass-through :D

20:31 moogatronic: firesofmay: looks like someone created an issue asking for "getting started"

20:31 =)

20:31 firesofmay: moogatronic, oh :)

20:32 moogatronic: i'm sure Kovas will provide some quick docs as soon as he's able.

20:32 firesofmay: moogatronic, heh. I was the one who came an hour back and asked about it ;)

20:32 moogatronic, thanks a lot :)

20:32 moogatronic: firesofmay: well, it makes sense. this was presented at the conj, so others will likely be poking around as well.

20:32 firesofmay: moogatronic, you saw this project?

20:33 moogatronic, at conj i.e.

20:34 moogatronic: firesofmay: yeah, well I saw the preso. I have a ton of my to-play-with-queue just from the conj among other things. =)

20:34 i've not really checked it out much though.

20:34 wingy: when 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:35 firesofmay: moogatronic, 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:35 moogatronic, and lately it mutated into teaching lisp/clojure via logo using some kind of codeschool kind of thing with canavas

20:35 canvas*

20:36 moogatronic, 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:37 moogatronic: well, i don't know much about logo, aside from turtle graphics.. =) But it seems like a good fit generally.

20:38 firesofmay: 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:38 firesofmay: moogatronic, okay.

20:38 moogatronic, I like the whole idea of learning lisp/clojure but with strong visual feedback on how powerful it is.

20:39 moogatronic: firesofmay: you can probably msg Kovas directly on github, since you have a vision/path of exploration/ etc.

20:39 firesofmay: moogatronic, 4clojure is great, but there is no learning, I cant tell a person go learn liso there.

20:39 lisp*

20:39 moogatronic: firesofmay: I agree wrt visual&learning. I learned clojure via Overtone.

20:39 audio … but similar concept.

20:39 firesofmay: moogatronic, Hmm. Sounds like a good idea. Though I have no clue of how cljs yet. and a bit of cljojure not much.

20:39 Hodapp: Overtone looks rather interesting.

20:40 I wish I had some musical inclination to actually use it

20:40 moogatronic: firesofmay: check out Quill as well. It's a clojure wrapper around Processing

20:40 firesofmay: moogatronic, oh Thats interesting. So you have background in music?

20:40 Hodapp: Quil*

20:40 moogatronic: Hodapp: you don't need any. You trade in programming skill!

20:40 Hodapp: thanks. =)

20:40 firesofmay: well, I had a background in Java… and a love of music.. I do have some background in music, but not professional.

20:40 firesofmay: moogatronic, 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:41 Hodapp: moogatronic: Apparently I have not enough skill in programming to trade in for enough musical inclination to accomplish much.

20:41 firesofmay: moogatronic, hence toying with clojurescript.

20:41 Hodapp, heh :)

20:41 Bergle_2: its 'quil' one l. fun :)

20:41 Hodapp: moogatronic: Perhaps weed is a better things to trade it for in the meantime...

20:41 moogatronic: firesofmay: 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:42 firesofmay: moogatronic, nice. I tried overtone to run on my ubuntu machine, had so much pain. I gave up too soon. Should try again.

20:42 moogatronic, Is it possible to have a web repl for overtone?

20:42 moogatronic: Hodapp: Lawlz. Well, i'm not sure how to convert programming skill to weed. =)

20:42 Hodapp: moogatronic: Easy. Use the former to get money, and then buy it.

20:42 moogatronic: firesofmay: Locally only. Overtone requires supercollider.

20:43 firesofmay: moogatronic, Hmm okay.

20:43 SegFaultAX: I know this is offtopic, but I'm looking for some guidance on (what should be) a relatively simple github markdown issue...

20:43 moogatronic: firesofmay: http://www.chris-granger.com/2012/02/20/overtone-and-clojurescript/

20:43 SegFaultAX: https://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:43 How can I fix this?

20:44 firesofmay: moogatronic, thanks checking it out.

20:44 Hodapp: moogatronic: this looks like a neat article, thanks

20:49 moogatronic: SegFaultAX: Do you need the space between the numbered lists? Maybe remove that and the rendering will fix.

20:51 tmciver: SegFaultAX: 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:52 SegFaultAX: Also when I paste it into pandoc (http://johnmacfarlane.net/pandoc/try), it looks OK (with no spaces).

20:53 SegFaultAX: tmciver: Yea, it's just the shitty GH markdown stylesheet I think.

20:53 They don't have a bottom margin of nested lists. :(

20:55 tmciver: SegFaultAX: just wonky github markdown implementation, I guess.

20:55 SegFaultAX: Just a stylsheet issue.

21:06 Urthwhyte: SegFaultAX: GH uses Sundown I thought?

21:12 dnolen: neat IGS GoPanda2 client is written in Clojure & CLJS

21:17 ohpauleez: dnolen: Whoa! Totally awesome. Any link on their experience or a blog post?

21:19 dnolen: ohpauleez: don't think so

21:20 SegFaultAX: Urthwhyte: It does. What does that have to do with the GH stylesheet though?

21:20 Urthwhyte: I didn't even realise they supported nested lists

21:20 I thought that was a Pandoc extension

21:20 My mistake

21:20 SegFaultAX: Urthwhyte: http://daringfireball.net/projects/markdown/

21:22 Sgeo__: dnolen, awesome

21:22 Wait, why is a client using both?

21:30 tomoj: bbloom: hmm.. https://www.refheap.com/paste/8d71b9b2a197b4c51d7032d67

21:30 not sure whether I'm sold yet, but I think I'm doing it wrong

21:30 "call call call" looks suspicious

21:42 I bet semantic editor combinators shouldn't be directly translated to concatenative

21:49 seangrove: Christ, it's easy to write leaky code with Closure

21:50 tomoj: leaky as in memory?

21:55 seangrove: tomoj: Yeah

21:57 tomoj: clojurescript leaks in places clojure wouldn't, because of closure? :(

21:59 brehaut: http://blog.ezyang.com/2011/05/space-leak-zoo/

22:00 haskellers 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:04 tomoj: what's a space leak that can't cause a program to consume all your ram?

22:06 I guess since there's a stack limit, stack overflow

22:07 brehaut: sorry, i was unclear

22:07 its a superset of memory leaks, and includes all the ways you can consume all your ram

22:08 mthvedt: is there a leak that covers bloated programming

22:08 brehaut: java

22:08 mthvedt: haha

22:10 seangrove: tomoj: 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:11 tomoj: I see, good. I've been worried about optimization-induced space leaks ##(inc brehaut)

22:11 lazybot: java.lang.RuntimeException: Unable to resolve symbol: brehaut in this context

22:12 brehaut: haha, the karma thing is a special syntax, not an evaluated piece of clojure

22:12 seangrove: I'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:13 brehaut: seangrove: 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:14 tomoj: lol "stack underflow"

22:14 seangrove: brehaut: 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:14 It's an interesting challenge

22:15 Maybe we could be sneaky and find a reference to how much memory is being used, and just refresh the page, heh

22:15 tomoj: or just refresh after idle for X min?

22:15 seangrove: I imagine the gmail users might be slightly upset about it, but maybe that's not a bad idea

22:16 Anyway, we have space leaks with our current version, but the cljs version we're making sure that it's sound from the beginning

22:16 * brehaut has iis process recycling flashbacks

22:16 seangrove: I expect it'll be a reasonable job now that we're aware of it

22:17 ibdknox: Any tips on how you're handling testing?

22:24 dyreshark: hi! 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:25 brehaut: ring, compojure, leiningen,

22:25 they are all well maintained projects with lots of eyes on them

22:26 dyreshark: cool, i'll look into them. thanks :)

22:26 Frozenlock: The clojure source itself can be interesting.

22:27 moogatronic: dyreshark: maybe just keep building things in a questionable way? I find that discovering idioms happens sort of organically..

22:27 reading code is definitely a part of that though…

22:28 * Frozenlock was doing (map #(some-fn %) coll) for a shamefully long time

22:29 dyreshark: moogatronic: 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:29 like if-let. i learned that a full ten minutes ago :P

22:29 moogatronic: Frozenlock: yeah, I have a lot of stuff like that in my code. Hopefully less now than a year ago… but you never know. =)

22:30 dyreshark: Frozenlock: i feel like i have a lot of things like that. :P

22:30 oh well! thanks again for the insight, all

22:30 seangrove: I can't tell how to track down this stack trace https://gist.github.com/413f31323d5142993207

22:31 Hmm, it's probably a syntax error on my part somewhere, let go through once more...

22:31 tomoj: looks like you have a bad ns decl?

22:32 brehaut: thats my first gues too

22:33 seangrove: How do you guys see that?

22:34 How/where in the trace?

22:34 tomoj: first, we know you have foo where it should be [foo] or (foo)

22:35 Hodapp: what's a typical Clojure-ish method of implementing an abstraction layer that could target multiple backends?

22:35 tomoj: which is a common error in ns decls I think

22:35 then there's a parse-ns in the stacktrace

22:35 brehaut: seangrove: mysterious looking 'nth not supported on this type: Symbol' coming from the compiler is a good clue

22:35 Hodapp: that would be protocols

22:35 tomoj: and analyzer.clj:639-ish is the parse 'ns multimethod

22:36 brehaut: Hodapp: and more rarely multimethods

22:36 seangrove: tomoj: You just know that from experience?

22:36 tomoj: I looked at analyzer.clj

22:37 seangrove: Well, I guess I should be less afraid of diving into the source of Clojure then

22:37 tomoj: you can pretty much ignore RT.java, core.clj, protocols.clj, etc

22:37 brehaut: the source command at your repl helps for that too

22:38 tomoj: since it's a cljs compile error compiler.clj and analyzer.clj frames will likely be helpful to look at

22:39 seangrove: Ah, I feel bad now, didn't realize that was the normal way of going about things

22:39 Ok, I'll go after it from here, thank you!

22:39 tomoj: my editor throws more exceptions every time I try to get it to jump to a frame :(

22:40 brehaut: seangrove: no need to feel bad.

22:41 seangrove: you asked a sensible question

22:41 seangrove: brehaut: It feels a bit lazy in hindsight is all ;)

22:42 But M-. on cljs.compiler/parse-ns and it's starting to make more sense

22:42 brehaut: i dunno; its not normal for programmers to look under the hood on their compiler in most languages

22:42 so its not really lazy, its just a lack of awareness

22:43 seangrove: Appreciate that, I'd agree with the lack of awareness

22:43 I've heard good things about the cljs source anyway, so shouldn't be afraid of digging through it

22:46 tomoj: wonder how long before compiler errors show line/col

22:48 brehaut: seems like it mustnt be far off if there is source mapping in cljs

22:53 mattmoss: What is the better for (map #(some-fn %) coll) ? I'm feeling stupid atm.

22:55 Frozenlock: (map some-fn coll) :P

22:55 brehaut: (map some-fn coll(

22:55 seangrove: With 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:56 atom_: performance question: is there any reason performance wise to use clojure instead of java?

22:56 seangrove: So many interesting projects to work on in clojure-land, heh

22:56 mattmoss: Frozenlock: Oh, duh. I see what you mean.

22:57 brehaut: atom_: java is (unsurprisingly) a very close fit to the optimal performance decisions for the JVM. i dont think your question makes sense.

22:58 Frozenlock: Does this seem applicable to clojure? http://www.hascode.com/2012/05/creating-updatable-java-applications-using-getdown-and-the-getdown-maven-plugin/

22:59 atom_: 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:00 brehaut: i doubt it

23:00 seangrove: atom_: Haven't done any Java development, so can't comment one way or the either

23:01 brehaut: atom_: inplace munging of data without functioncall overhead is how you write screaming code. thats not ideal in clojure.

23:01 ChongLi: optimal performance is kind of a nebulous concept

23:01 atom_: It was a general question. If everyone were only concerned about speed we would all be writing in ASM or C.

23:02 ChongLi: if 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:02 seangrove: ChongLi: That's what I was thinking, yes

23:02 brehaut: atom_: or haskell or java…

23:02 C doesnt have some secret advantage of being fast

23:03 the JVM is capable of some really impresive optimisation

23:08 atom_: 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:08 atom_: clojure code could be written that equals java code

23:08 atom_: but it doesnt make sense to expect it to be fast

23:08 er

23:09 atom_: 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:10 brehaut: atom_: choose clojure for aiding correctness and expression

23:10 atom_: brehaut: I personally love writing in clojure, just looking for where I could leverage it and to what end.

23:10 ChongLi: yes

23:10 the real question you should ask when evaluating any programming language

23:10 muhoo: ah, tradeoffs, the bread and butter of engineering :-)

23:11 ChongLi: is if it helps you express a solution to your problem in a more concise, easily read and easily maintained manner

23:11 from SICP: the 3 key features of any programming language

23:11 primitve operations, means of combination and means of abstraction

23:12 muhoo: often you're really trading cpu time for programmer time.

23:12 ChongLi: since clojure is implemented in java, anything you can write in clojure could be written in java

23:12 but what would that actually look like? :)

23:13 brehaut: ChongLi: it would look like biting tinfoil tastes

23:13 ChongLi: or fingernails on a chalkboard

23:13 haha

23:14 atom_: 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:14 ChongLi: atom_: that's fine

23:15 if you have time, you might want to look at SICP

23:15 it'll explain it way better than I can

23:15 atom_: ChongLi: I've been reading/watching the MIT OCW on that recently.

23:15 ChongLi: that's good

23:15 atom_: ChongLi: I think I like clojure because it makes more sense than OOP to me.

23:16 ChongLi: of course

23:16 functional programming is much closer to mathematics

23:16 you can use the substitution model

23:16 something you're very familiar with in algebra

23:17 once you introduce assignment (mutation) you lose the algebraic properties

23:18 variables no longer refer to values but instead to places in memory

23:18 substitution breaks down because you're no longer talking about values

23:20 seangrove: Struggling with running cljs test - Here's my project.clj https://gist.github.com/1dfa6eae91dae6cf37c9

23:20 atom_: 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:21 seangrove: On line 50 I define the :test cljs build, which compiles the :source-path into "unit-test.js"

23:21 The 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:21 ChongLi: atom_: it will, and more

23:22 clojure is also way more expressive than java

23:22 it'll allow you to accomplish more with less code

23:22 what I don't get is why people out there try to argue against that?

23:23 why do so many people insist on using languages that require them to follow rote mechanical repetition?

23:23 "design patterns" as they're called

23:23 seangrove: But 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:24 atom_: ChongLi: Because that's what's familiar to them?

23:24 tomoj: they were taught or learned a way. it probably involves an IDE that does a lot of useful things

23:24 brehaut: ChongLi: 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:25 ChongLi: if the problem is common enough, why not have a library to take care of it?

23:25 unless your language lacks the expressive power to create such a library

23:26 brehaut: ChongLi: well partly, but also because the particular solutions involve trade offs. a concrete solution hard codes that trade off.

23:26 tomoj: hmm

23:27 brehaut: frinstance, GOF, Decorator (first pattern that the book opened to) lists under Consequences "…two key benefits and two liabilities…"

23:27 (thats pg 178 of GoF)

23:28 * seangrove imagines brehaut has committed GoF to memory like bible verses

23:28 ChongLi: haha

23:28 brehaut: seangrove: the book is on my shelf, within arms reach :P

23:29 i dislike the wanton application as much as the next sensible programmer

23:29 but i also dislike patterns getting set up with a straw man

23:29 seangrove: Meant as a compliment ;)

23:29 brehaut: ah :)

23:29 tomoj: brehaut: but isn't that exactly the expressiveness problem I think dnölen talked about?

23:29 seangrove: And it's a well-balanced view anyway

23:29 ChongLi: what about stuff like "dependency injection"?

23:30 tomoj: being able to write libraries which don't make those choices?

23:30 seangrove: I *still* don't get DI - what the hell is it supposed to do?

23:30 brehaut: tomoj: for the GoF patterns, absolutely yes

23:30 ChongLi: it makes me laugh that imperative programmers complain about monads

23:31 and then talk about dependency injection and abstract factory patterns

23:31 brehaut: tomoj: 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:31 ChongLi: everybody's guilty of these overwrought names, if you ask me

23:32 brehaut: its one of the two hard problems in computer science (naming, cache invalidation, and off by one errors)

23:32 ChongLi: hahaha

23:33 tomoj: is a sign error an off by one error in Z_2?

23:34 ChongLi: I guess monad isn't all that overwrought

23:34 it's just an alien term

23:34 brehaut: its perhaps underwrought

23:34 ChongLi: it also happens to be a very abstract concept

23:35 brehaut: yes

23:35 ChongLi: which always seems hard to name

23:35 I tried explaining monads to somebody in #archlinux the other day

23:35 and it was very hard

23:36 tried going from functions like a -> a

23:36 but even that was a stretch for this person

23:36 tomoj: hmm.. 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:36 ChongLi: I guess most people aren't used to the idea of type variables

23:37 brehaut: tomoj: om ?

23:37 ChongLi: ?

23:37 tomoj: just a name for the perfect language

23:37 ChongLi: how do you address all tradeoffs?

23:37 tomoj: you don't

23:37 brehaut: tomoj: ah, coBlub

23:38 ChongLi: coblub would be a great name for a language actually

23:38 brehaut: tomoj: just incidentally, i don't think its an accident that GoF is full of ways to do straight forward smalltalk in C++

23:39 tomoj: I 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:40 not, of course, whether clojure is coBlub

23:40 brehaut: right

23:41 agda will (eventually at least) be blub to someone

23:41 anyway, its the end of the day here. later

23:42 ChongLi: later

23:52 clj_newb_2345: i'm writing some graphics intense (svg manipulating) code in clojurescript

23:52 my code is slow

23:52 how do I profile this?

23:52 my background is clojure, not javascript

23:53 bbloom: clj_newb_2345: you can look at allocations and cpu time in chrome

23:53 clj_newb_2345: i am using chrome

23:53 bbloom: clj_newb_2345: and use the 'time macro

23:53 (doc time)

23:53 clojurebot: "([expr]); Evaluates expr and prints the time it took. Returns the value of expr."

23:53 ChongLi: I don't know a lot about clojurescript

23:53 clj_newb_2345: bbloom: do I need some plugin to use the chrome profilng tools

23:53 ChongLi: but I do know that it doesn't have the same kind of complexity guarantees in its immutable data structures

23:53 bbloom: ChongLi: that is no longer true

23:53 ChongLi: oh really?

23:54 shows how much I know :)

23:54 bbloom: ChongLi: cljs has had persistent data structures for quite a while

23:54 ChongLi: that's really good to hear

23:54 bbloom: clj_newb_2345: you can use the regular profiler

23:54 clj_newb_2345: bbloom this is very useful

23:54 so 11% is my program

23:54 8% is the GC

23:55 hmm, 31% is some json function

23:55 and 40% is ... _seq ?

23:55 bbloom: clj_newb_2345: if you're using advanced mode, name mangling can make your life difficult :-/

23:56 clj_newb_2345: this is amazing

23:56 I would have otherwise never guesed the time splitting

23:56 thanks!

23:57 bbloom: clj_newb_2345: no problem :-)

23:57 clj_newb_2345: are you using advanced optimizations?

23:57 clj_newb_2345: no

23:57 how do I turn them on?

23:57 bbloom: clj_newb_2345: you should try those first :-)

23:57 are you using lein-cljsbuild ?

23:57 {:optimizations :advanced}

23:57 it's in the docs

23:57 clj_newb_2345: you mean have the computer do more work rather than me do more work?

23:57 bbloom: clj_newb_2345: bingo. haha

23:58 clj_newb_2345: advanced optimizations will elimiate dead code, aggressively inline small functions, specialize call sites on type, ec

23:58 clj_newb_2345: recompiled

23:59 bbloom: clj_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:59 clj_newb_2345: hmm, my program is now taking 40% of the time

Logging service provided by n01se.net