#clojure log - May 26 2013

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

0:48 tshauck: hi, does somebody have a recommendation on how I could do this...

0:48 https://gist.github.com/tshauck/5651728

0:52 tomjack: tshauck: you're more likely to get an answer if you indicate your desired output

0:53 tshauck: tomjack: I do in the comment of the gist

0:53 akhudek: tshauck: it's not clear what it should look like from the example

0:54 callen: tshauck: yeah needs structure/example

0:54 tshauck: alight, I'll be more explicit

0:56 here's an update - https://gist.github.com/tshauck/5651728

0:57 tomjack: hmm

0:58 (mapcat #(cond-> % (string? %) vector) coll) ?

0:58 akhudek: tshauck: cartesian-product almost does what you want https://github.com/clojure/math.combinatorics

0:58 tomjack: oh, I misread

0:58 akhudek: though you'll have to make sure that the singletons get enclosed in a seq somehow

0:59 and then you'll have to change everything to vectors if that really is a requirement

0:59 tshauck: the only requirement is to write it to tsvs after the transformation is done

1:00 tomjack: (apply (partial map vector) (map #(if (string? %) (repeat %) %) coll))

1:03 tshauck: alright, I'll look into those solutions thanks

1:05 tomjack: I don't think you want a cartesian product

1:06 it's a zip, (map vector ...), but you have to lift up the singletons, like akhudek said, with repeat

1:08 akhudek: tomjack: the output sure looks like a cartesian product to me

1:09 tomjack: not carried through to completion of course

1:09 or wait, you are right

1:09 nevermid

1:09 I must be tired

1:09 tomjack: the diagonal is a subset of the cartesian product, naturally

1:14 arrdem: is there a trick for updating multimethod defs without restarting nrepl?

1:28 crocket: It's hard to get a sense of language.

1:28 Some people say clojure is productive and its design is good.

1:28 Some people say clojure is a mess.

1:34 arrdem: crocket: some people just let tools do the talking

1:36 crocket: arrdem, meaning?

1:36 arrdem: the bottom line is that we're programmers. the tool itself isn't the question, it's what the tool produces that matters.

1:36 it all goes to x86 at the end of the day

1:36 the real question is whether a tool makes us more productive, or whether we prefer it over something else

1:36 mthvedt: all we know is… it's called programming! /jeremy clarkson

1:37 arrdem: (inc mthvedt)

1:37 lazybot: ⇒ 2

1:37 arrdem: I mean we can flame all day about languages and ecosystems but the bottom line is that languages are specialized in one way or another.

1:37 mthvedt: mm karma

1:37 arrdem: clojure is a general tool with a cultural bent towards web development

1:38 end of story. that may not be what you want, and if it isn't don't bitch about it 'cause it isn't going to change. find a better tool and use it, or make clojure work for you.

1:39 not trying to be a dick, just trying to be pragmatic about it :/

1:39 crocket: arrdem, I don't have a clear opinion on clojure, yet.

1:39 akhudek: crocket: people use it for lots of other things too: clustering, NLP, theorem proving

1:40 arrdem: akhudek: when did we get the theorem proving guys?

1:40 akhudek: or just 'cause its just another lisp...

1:41 akhudek: arrdem: my work at the university of waterloo involves a clojure theorem prover

1:41 hopefully to see the public light of day this year

1:41 though it's special purpose

1:41 arrdem: cool! I'm at UT Austin so I've been subjected to J Moore's ACL2 :/

1:42 * arrdem may have gotten the name wrong

1:42 akhudek: ah, yeah, I've not used that myself

1:42 these days resolution style provers are all the rage

1:43 mthvedt: ooh i know someone at ut austin math

1:44 arrdem: akhudek: oh cool! I'm not an automated reasoning buff but I'll be interested to see how your system works

1:44 tomjack: arrdem: (ns-unmap *ns* 'the-multimethod) :(

1:45 arrdem: I'm more computer architecture, compilers and low level systems it seems..

1:45 tomjack: goddamnit ok thanks

1:45 would clojure not on the JVM still be clojure?

1:45 akhudek: arrdem: our prover is actually special purpose; we use it to compile database queries

1:47 arrdem: I'm hoping that I might be able to submit something regarding it for the next conj, though we'll see

2:21 arrdem: DAE think this is reasonable? (defn sym docstring? (ret-type? params & forms))

2:22 (defn type? sym docstring? params & forms) as the alternative

2:45 callen: god

2:45 those netsplits get old.

2:46 * nightfly hides all joins/parts on freenode

2:46 arrdem: nightfly: you were showing them? I turned em off after about three months of lurking...

2:47 best decision I've made yet :/

2:47 callen: I need to see them from time to time

2:47 I was grumping about the netsplit not because of the JOIN/PARTs, but because I was _'d.

2:47 had to renick and reidentify.

2:47 annoying.

2:47 arrdem: ah

2:47 nightfly: that's what I meant, guess I shoult have just said it instead of /me'd

4:22 klrr: hmm, im running "java -cp clojure-1.4.0.jar clojure.main" in the folder i've extracted clojure to , but i get this error "Error: Could not find or load main class clojure.main", any ideas? :x

4:23 sinistersnare: klrr: maybe try

4:23 java -cp clojure-1.4.0.jar my-clj-file.clj

4:23 not the main

4:23 but the actualy file

4:24 klrr: okey, sry for the stupid question but ive never used java before , okey so that command runs a clojure file? if i want to get into the repl, which file should i run?

4:25 oh god i didnt append .jar

4:25 sry!

4:25 now it works :)

4:26 sinistersnare: :D

4:26 do you have lein installed

4:27 also, if you want to call upon someone, make sure to prepend your coment with their name and a colon. example:

4:27 klrr: TEST!

4:27 klrr, i think a comma works too

4:44 klrr: lazybot: help

4:44 lazybot: You're going to need to tell me what you want help with.

4:44 klrr: lazybot: help you

4:44 lazybot: Topic: "you" doesn't exist!

4:44 klrr: lazybot: help lazybot

4:44 lazybot: Topic: "lazybot" doesn't exist!

4:44 klrr: lazybot: help help

4:44 lazybot: klrr: Get help with commands and stuff.

4:44 klrr: lazybot: help commands

4:44 lazybot: Topic: "commands" doesn't exist!

4:44 arrdem: klrr: yeah there isn't a #clojure manual :/

4:45 klrr: arrdem: can it evaluate haskell expressions?

4:46 arrdem: klrr: &false

4:46 ,(= 'clojure 'haskell)

4:46 clojurebot: false

4:46 klrr: okey read somewhere it could do that but i guess i was wrong :(

4:47 $heval 2

4:47 lazybot: ⇒ 2

4:48 klrr: $heval (\n -> n + n) 2

4:48 lazybot: ⇒ 4

4:48 klrr: arrdem: it has haskell support :D

4:48 bbl

4:48 Iceland_jack: $heval join (+) 2

4:49 lazybot: ⇒ 4

7:22 tomjack: akhudek: sweet, not datomic queries I'm guessing?

7:48 Morgawr: Hello, I've been using Clojure for months now, I've developed a few things and all of that. I love the language but I never really had a "formal" upbringing, I just learned by looking at the docs and APIs... if you were to suggest a good book (extensive, not just "clojure tutorial") on Clojure, what would you suggest?

7:48 I've been meaning to read more in-depth stuff

7:51 lytton: http://clojure.org/books

7:52 Morgawr: lytton: thanks, will check them out

7:53 terom: Joy of Clojure is quite nice

7:54 tomjack: I like 'clojure programming'

7:54 decaf: very nice. from manning

7:54 lytton: can not say which is best, probably of the opinion that one must go through several before you get the mental part with;-)

7:55 decaf: tomjack: you are saying that o'reilly book?

7:56 tomjack: yeah, not that TJoC isn't nice - I don't remember it

7:56 decaf: I didn't get a word of it

7:57 Morgawr: lots of stuff to read now, thanks :)

7:57 lytton: haha,,

8:13 klrr: $heval putStrLn "hello"

8:13 lazybot: ⇒ <IO ()>

8:15 klrr: $heval writeFile "." "does this work?"

8:15 lazybot: ⇒ <IO ()>

8:15 klrr: $heval readFile "*"

8:15 lazybot: ⇒ <IO [Char]>

8:16 klrr: $heval let fib = 2

8:16 lazybot: ⇒ not an expression: `let fib = 2'

8:18 Foxboron: ohyou klrr :P

8:21 klrr: Foxboron: well it wont work i guess, the bot uses tryhaskell.org's api to evaluate a string :x

8:31 hyPiRion: hmm

8:31 $tryhaskell 1 + 2

8:31 lazybot: ⇒ 3

8:31 hyPiRion: differetn things

8:35 pete_: Assuming I am already familiar with the core ideas of functional programming, are there any good tutorials that assume that? eg: Clojure for Haskell Devs, Clojure for Erlang devs? I can't find anything obviously

8:39 Okasu: $help heval

8:39 lazybot: Okasu: Evaluates Haskell code with mueval.

8:39 Okasu: $list

8:39 lazybot: I know about these topics:

8:40 Okasu: lazybot: You're knowledgeable indeed.

8:43 peter``: Hi all...

8:44 Okasu: $heval foldl1 (flip (.)) [(+1),(*2)] 500

8:44 AtKaaZ: ChongLi, unless I am in #clojure I cannot see you're on it when /whois

8:44 lazybot: ⇒ 1002

8:45 Okasu: $heval "12" >>= \a -> "45" >>= \b -> return [a,b]

8:45 lazybot: ⇒ ["14","15","24","25"]

8:46 peter``: ciao

8:47 noidi: pete_, The Joy of Clojure + Google :)

8:48 pete_, if most Clojure learning material seems trivial, I can guarantee that JoC will make you pause and think (often) even if you're familiar with functional programming :)

8:51 pete_, the o'reilly book (clojure programming) works great as a reference, so maybe you should go through JoC and look up unfamiliar concepts in CP for friendlier and more in-depth introductions

8:55 * pete_ googles for Joy of Clojure

8:57 pete_: That looks excellent

9:00 kaffeebohne: Hi. I want to want to split a number (20 digits) into 10 2-digit-numbers, at the moment I use this: (clojure.string/split (str 12345678901234567890) #""), which splits after every number. I don't know what regex to use for a split after every second digit. Or would there be a better way to split up a number?

9:01 pete_: kaffeebohne: I wonder if you're thinking about it wrong

9:01 kaffeebohne: And instead, you have a list of digits, that you wish to partition in to smaller lists

9:02 kaffeebohne: ok pete_

9:03 pete_: What's the source of your 20 digit number?

9:03 kaffeebohne: At the moment just numbers in the code, later it will be user input or random.

9:06 hyPiRion: kaffeebohne: use quot and rem perhaps?

9:06 ,((juxt quot rem) 123456789987654321 1000000000)

9:06 clojurebot: [123456789 987654321]

9:22 svedubois: Do you know if mouseenter and mouseleave are implemented in Domina (CLJS)?

9:23 gfredericks: does domina require individual events to be implemented separately?

9:30 svedubois: I think they are implemented as :mouseover and :mouseout

9:30 Source: https://github.com/magomimmo/modern-cljs/blob/master/doc/tutorial-09.md

9:43 * gfredericks needs to figure out how to run the clojure tests without all the generative stuff

10:09 tomjack: bbloom: https://www.refheap.com/4d56cca0ecbf959e483651bb4

10:09 it works! :)

11:38 bbloom: tomjack: nice.

11:39 tomjack: stuck on alt

11:41 "No implementation of method: :reads-from of protocol: #'co.tomjack.async.impl.ioc-macros/IInstruction found for class: co.tomjack.async.impl.ioc_alt.Alt"

11:41 (defrecord Alt [...] IInstruction (reads-from [this] ...) ...)

11:41 * tomjack boggled

11:47 recursor94: I have a question--I've been making my way through sicp in order to learn scheme. The first chapter discusses internal defintions--using define within procedures to locally bind variables. Is that an acceptable practice in clojure or is the only way to accomplish this to use let/binding?

11:48 bbloom: recursor94: def, let, and binding, are 3 different things on purpose in clojure -- def is for defining top level things and they are generally pretty static. let is for defining lexically scoped locals. and binding is for dynamically overriding top level things defined by def

11:48 recursor94: so the short answer is use def at the top level, let anywhere else, and only use binding if you know what you're doing :-)

11:49 recursor94: Thank you bbloom.

11:54 tomjack: :aliases {"clein" "clean"}

11:56 tshauck: Hi, what are thee # and % doing in this call (map #(apply max %) [[1 2 3][4 5 6][7 8 9]])

11:58 Okasu: ,'(map #(apply max %) [[1 2 3][4 5 6][7 8 9]])

11:58 clojurebot: (map (fn* [p1__29#] (apply max p1__29#)) [[1 2 3] [4 5 6] [7 8 9]])

11:58 Okasu: tshauck: ^

11:58 dcb: tshauck: the # creates an anonymous function, % is the argument

12:00 tshauck: interesting thanks

12:06 clojure-new: hello

12:07 Is there any guide how to make sessions in ring/compojure app to enable users login?

12:30 howdynihao: if i define a function, [f & args] (for [x f] ... ) this will work, how do i do instead (for [x args] ... ) ?

12:30 i think its a matter of converting args from vector to a list?

12:32 also how would i do something like (for [x args y args z args] if args was length of 3 dynamically?

12:33 seangrove: howdynihao: It's not clear how that would help. What are you trying to do?

12:35 jtoy: how can I know the difference between 2 vetors?

12:35 (diff [1 2 3] [1]) => [1 2] ?

12:35 i mean [2 3]

12:35 howdynihao: seangrove: i'm trying to make a dynamic function that returns cartesian product, so far i have (defn blah [f &args] (for [x f y f] (list x y))) but it's not dynamic, i'd like the bindings to be the length of 'f'

12:36 and i prefer not to use 'f' and just say args but it complains about converting it?

12:37 weavejester: howdynihao: "f" isn't a function, then?

12:38 howdynihao: Why not: (defn blah [& args] (for [x args y args] [x y])) ?

12:38 howdynihao: no it's just an argument for the function, a list

12:38 weavejester: howdynihao: Though to me it would make more sense as: (defn blah [xs] (for [x xs y xs] [x y]))

12:40 howdynihao: weavejester how would i make the local binding for 'for' dynamic? length of xs

12:40 so that function would be correct assuming xs is length of 2

12:41 im assuming a totally different looking function :P

12:41 weavejester: howdynihao: Ohh, I seeeee

12:41 howdynihao: So you want something like...

12:42 howdynihao: (cross [1 2] [3 4] [5 6]) => [[1 3 5] [1 3 6] [1 4 5] [1 4 6] …] ?

12:43 Where cross can have a variable set of arguments

12:43 howdynihao: yea

12:43 weavejester: You can just use recursion in that case

12:44 tomjack: clojure.math.combinatorics/cartesian-product ?

12:44 weavejester: Let me see if I can give you a quick example...

12:44 tomjack: I was about to look for that :)

12:44 tomjack: http://stackoverflow.com/a/2569866/1306817

12:44 but mmarczyk just does recursion like you suggest there

12:45 and claims it's faster

12:45 weavejester: Although… the cartesian-product function in math.combinatorics is a little dense, presumably for speed.

12:45 tomjack: but it's slower than the stupid version, supposedly :)

12:46 I have developed a deep mistrust of math.combinatorics

12:46 weavejester: tomjack: The cross function you link from stackoverflow was the one I was thinking of.

12:46 dhl: jtoy: have you looked at clojure.data/diff?

12:49 jtoy: Depending on your definition of "difference

12:49 it might work for you

12:52 howdynihao: well no correction weavejester, what i really want is to be able to have (for [x xs y xs] <-- this be set dynamically based on the (count xs)

12:52 dhl: jtoy: How do you expect diff to behave if it's caled like (diff [2 1 3] [1])?

12:53 weavejester: howdynihao: Why doesn't recursion help you in that case?

12:53 howdynihao: e.g. something like: (for [x (first xss) y (apply blah (rest xss))] …)

12:53 howdynihao: heres my thought process, i want to have a cartesian product that takes say '(a b c d) (varaible length) but no duplicate elements, for instance (a a b d) is not valid

12:53 so i was thinking use filter

12:54 as it recursive loops?

12:54 to filter out the elements already used

12:54 weavejester: howdynihao: Well, (cross x y z) is (almost) the same as (cross x (cross y z)), right?

12:54 howdynihao: weavejester: i'm new to this, so i'm not exactly too aware of what does what haha

12:54 weavejester: If you flatten it out.

12:55 There's a function in clojure.core called distinct or uniq or something.

12:55 That will ensure a unique list.

12:55 howdynihao: ah

12:55 weavejester: And there's a function in math.combinatorics that gives you the cartesian product.

12:55 tomjack: howdynihao: it doesn't sound like you want a cartesian product

12:56 howdynihao: i wanted to do the unique thing during processing seems more efficient than after

12:56 tomjack: what does it return for '[a b c] ?

12:56 howdynihao: i thought cartesian product of [1 2 3 4] => [4 4 4 4] is valid?

12:56 no nevermind i'm confusing myself

12:57 weavejester: It sounds like you're talking permutations?

12:57 tomjack: sounds like selections to me

12:57 which is in math.combinatorics

12:57 implemented by (apply cartesian-product (take n (repeat items)))

12:57 weavejester: Or combinations if you think [4 4 4 4] isn't valid...

12:58 tomjack: ah right

13:15 huh, alt went back to go style?

13:22 hyPiRion: nah, selections doesn't remove dups

13:23 (combinations (distinct m1) n) is

13:26 hotwoofy: does anyone know of a guide for getting ritz and expectations to play nicely together? would love to have the option of breaking into the debugger on an uncaught exception in a test. not attached to ritz, if there's another way.

13:41 tshauck: Hi, does anybody know how I could take a seq of seqs... i.e. ((1 2 3) (4 5 6)) and turn it into ((1 4)(2 5)(3 6))?

13:42 bbloom: ,(apply map (comp seq vector) '((1 2 3) (4 5 6)))

13:42 clojurebot: ((1 4) (2 5) (3 6))

13:45 tshauck: clojure is one crazy language... thanks

13:45 bbloom: tshauck: that's not so crazy :-) you just need to understand the components of it & then that becomes second nature with time

13:45 you probably don't need the comp or seq, in that case, vectors are probably fine, but i don't know your requirements

13:46 hotwoofy: probably easier to just go (partition 2 (flatten '((1 2 3) (4 5 6))))

13:47 tshauck: bbloom: Ya, I just started to play with it yesterday (I've programmed in python for several years)...

13:47 bbloom: ~flatten

13:47 clojurebot: flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.

13:47 tshauck: I really like it so far

13:48 bbloom: hotwoofy: also, that would produce (1 2) (3 4) instead of (1 4) (2 5)

13:48 hotwoofy: oh, you're implying reading the question helps when answering, fair point. :P

14:13 snowboat: hey, i'm new to clojure, can someone critique this function that draws a sine wave to stdout? https://gist.github.com/anonymous/5653546

14:20 conorwade: whois Bodil

14:20 mnemnion: I'm working on a simple REPL interaction: I'd like to be able to stop execution of a function at an arbitrary point, return control to the REPL, and then start execution again with another command.

14:21 I think this would use repl/thread-stopper, but there are no examples in the doc and I'm hoping there's a recipe for this b.c it seems like a basic tool

14:23 ohpauleez: conorwade: Bodil is a Clojure and CLJS developer from Norway - She's talked at fair number of conferences about Clojure. She's also the developer of the Catnip editor/IDE

14:29 conorwade: ohpauleez: Thanks I have seen one of her talks. I was playing around with Irssi trying to see what commands do what and I forgot to type forward slash before it. Urgh!

14:29 ohpauleez: ahh gotcha

14:35 seangrove: ohpauleez: Well done responding to commands like an irc bot though :)

14:39 How can I tell what the latest version of google-closure-library is?

14:41 ohpauleez: seangrove: Thank you! :) You can find the latest version by looking at the SVN repo

14:41 of Closure

14:41 they version based on revision number

14:41 and there will be a latest stable tag marked for download

14:42 seangrove: Sure, but wondering what the version the latest version of clojurescript is using

14:42 Ah, got it, can look in the pom file

14:42 noahlz: lein outdated is handy

14:43 lein-outdated plugin

14:43 ohpauleez: Ahh the version in CLJS - yeah, look at the pom or the dependencies listed on maven central via search.maven.org

14:44 seangrove: noahlz: lein-outdated looks great, thanks

14:44 ianeslick: Is there a way to install a plugin in lein 2.x from the command line (i.e. edit profiles.clj) or do I have to write a script to change a profile in order to get that plugin installed on the next run of lein?

14:45 lein plugin install was really nice

14:45 hyPiRion: ianeslick: you just add it to your profiles.clj, and plop, there it is

14:45 or to the project.clj

14:46 ianeslick: Yes, but what if I'm automating installation and want to add a plugin without overwriting the entire profiles.clj?

14:46 (Writing a chef cookbook that needs to install the immutant plugin)

14:47 ohpauleez: I'd ship a single profile.clj with all the plugins you'll need. Or just append to profile.clj programmatically using unix tooling

14:47 hyPiRion: You can always add it to project.clj or make a new profile within profiles.d

14:47 ohpauleez: you can also put plugins in your project.clj

14:47 which might be more appropriate here

14:48 hyPiRion beat me to the next suggestion, profile.d

14:48 ianeslick: Ah, didn't know about profiles.d - that's exactly the thing

14:52 arkh: what's the fastest or recommended way to serialize/read clojure data structures?

14:52 seangrove: Anyone else using cemerick.piggieback/cljs-repl seeing an error when trying to connect from the browser?

14:52 seeing: Uncaught ReferenceError: self__ is not defined repl:971

14:52 tomjack: no, maybe refheap the code around that line?

14:53 hyPiRion: arkh: edn

14:53 xeqi: arkn: if its just clojure data structures, and doesn't have any java interop then: prn-str and clojure.edn/read

14:54 seangrove: Code to start the repl: https://www.refheap.com/15032

14:54 Client/browser side: https://www.refheap.com/15033

14:54 ianeslick: Thanks ohpauleez and hyPiRion

14:55 arkh: hyPiRion, xeqi: thanks

14:55 seangrove: browser-repl trying to start the nrepl connector: https://www.refheap.com/15034

14:55 hyPiRion: np

15:02 seangrove: Losing the repl is painful.

15:03 Certainly helps one appreciate it when it's available

15:07 tomjack: seangrove: I meant the js

15:08 around line 971

15:10 Morgawr: do you guys know of any ClojureScript game libraries? I was planning to start working on one and maybe looking around to find similar projects would be a cool idea

15:10 (also need to find out a good name for such a library/framework)

15:16 jro_: what is the correct way to parse xml in clojurescript?

15:18 bbloom: jro_: http://closure-library.googlecode.com/svn/docs/closure_goog_dom_xml.js.html

15:18 jro_: you'd probably want to wrap that in the same was as data.xml in clojure's code base or you can just use js interop directly

15:20 jro_: thanks

15:23 svedubois: Using Domina do you know how to reset or clear a form?

15:23 (set-value! (goog.dom/getElementByClass "element") nil) doesn't work.

15:32 mthvedt: what's a lispy way to write if (condition) { return foo } chains

15:32 that's nicer-looking than a big nested if

15:33 xeqi: &(doc condp)

15:33 lazybot: ⇒ "Macro ([pred expr & clauses]); Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr result-expr test-expr :>> result-fn Note :>> is an ordinary keyword. For each clause, (pred test-expr expr) is evaluated.... https://www.refheap.com/15035

15:33 tshauck_: hi, how could I write a seq of seq to a csv file...

15:33 xeqi: ack, is that the one I'm thinking of

15:33 ah, just cond

15:33 &(doc cond)

15:33 lazybot: ⇒ "Macro ([& clauses]); Takes a set of test/expr pairs. It evaluates each test one at a time. If a test returns logical true, cond evaluates and returns the value of the corresponding expr and doesn't evaluate any of the other tests or exprs. (cond) returns nil."

15:34 akhudek: tshauck_: https://github.com/clojure/data.csv

15:35 mthvedt: thinking something more general than cond, like if you could plug if-lets and other conditions

15:35 maybe there's a monad for it

15:36 technomancy: arkh: check weavejester's blog; he just posted about different serialization options

15:36 prn/read is the easiest but by far the slowest

15:36 mthvedt: like the maybe monad, but switched around, so f-monad (nil) = f() and f-monad (x) = x

15:42 arkh: technomancy: cool! thanks

15:50 gfredericks: ,(cast clojure.lang.IFn 3)

15:50 clojurebot: #<ClassCastException java.lang.ClassCastException: Cannot cast java.lang.Long to clojure.lang.IFn>

15:51 gfredericks: hm. that's giving me an empty msg in my repl. must be a crappy jvm.

15:52 dnolen: Morgawr: I think people have a made a few games but not gone as far as a framework

15:53 arkh: so timely (for me) as well as short + sweet: http://www.booleanknot.com/blog/2013/05/25/clojure-serialization.html

15:55 hyPiRion, xeqi: ^^ : )

15:58 tomjack: I wish he showed what his benchmark was

15:59 read/write/roundtrip - how many times, what kind of data? pr-str?

16:12 sandbags: Is anyone here using cljsbuild and find it a little slow? I mean, I'm not sure what to expect but 2+s to compile a really short .cljs file seems kinda slow given good hardware

16:12 not sure if there's anything i can be doing wrong here

16:13 tomjack: you're already using auto?

16:13 sandbags: tomjack: yeah, "lein cljsbuild auto"

16:13 tomjack: yeah, it's slow :)

16:13 sandbags: ah, ok

16:13 thanks tomjack

16:13 tomjack: I dunno, maybe there is something you can do, but the cljs compiler is not fast

16:13 Morgawr: sandbags: what kind of optimization?

16:13 sandbags: is that related to the 19000 lines of JS it spits out every time?

16:14 i'm not sure if that's somehow dynamic - coming from clojure - or just a big copy & paste into the file it makes

16:14 Morgawr: what are you asking me?

16:15 Morgawr: you can use different types of optimization when compiling clojurescript files, :none, :whitespace, :simple and :advanced

16:15 sandbags: ah, i see, let me check

16:15 Morgawr: simple

16:16 Morgawr: okay, so it has to call the google closure compiler, it might be slower

16:16 if you want faster without much impact to your program use :whitespace

16:16 sandbags: okay let's go for :whitespace and turn off pretty-0print

16:16 Morgawr: but you will get a bigger .js output

16:16 sandbags: yeah at this point i am just learning, i don't care how big the files are

16:16 Morgawr: (when you're ready for production go with :simple or :advanced if the libraries you use and your own code support it)

16:16 sandbags: darn, i keep forgetting LightTable is not Vim

16:16 Morgawr: be careful with :advanced because sometimes the google closure compiler thinks you want to optimize your code in a certain way and in the process may delete some functions and stuff

16:17 sandbags: Morgawr: yeah, the book I have did mention some issues like that

16:18 hrnnn so :whitespace & pretty-print false it's about 1.5s

16:18 i think it's fair to say this compiler is not blazingly fast

16:18 Morgawr: depends on your computer also and a single compilation doesn't tell you how scalable it is

16:18 I never had much issues with the compiler

16:19 sandbags: well yes, if i was compiling 5000 lines of clojure in 1.5s i'd be down with that

16:19 Morgawr: it can take 2 seconds to compile an empty file maybe because it takes some time to initialize but if you have like a 10k lines file it may not impact that much on the performance

16:19 * Morgawr butchered English in that sentence

16:19 sandbags: i guess it depends whether this is compilation time or some fixed cost for running the compiler

16:19 tomjack: especially since, I believe cljsbuild is caching partial output

16:20 so it won't recompile your entire library every time you change a file

16:20 Morgawr: all in all, in my experience, I've found the jvm to be fairly slow to initialize but pretty fast to compute

16:20 so just bear with that

16:20 sandbags: nevertheless a 1.5-2s stutter isn't great

16:20 tomjack: it still may have some whole-project overhead though, e.g. closure? not sure

16:21 Morgawr: yeah, with :whitespace it still goes through closure

16:21 sandbags: still i'm complaining about compiling one language i want to learn into one i consider an abhorence

16:21 tomjack: :

16:21 :)

16:21 sandbags: good problems to have :)

16:22 tomjack: it'll get better

16:23 sandbags: if i can figure out how to get my Clojure code talking to raphael.js or two.js i'll be golden

16:23 dnolen: tomjack: it's definitely not slow, after warmed up JVM I think it takes one second to fully reanalyze and emit core.cljs

16:23 sandbags: think that's tomorrows problem

16:23 dnolen: lein cljsbuild could probably do more, keep a cached compiled core.clj and AOT the CLJS compiler

16:23 core.cljs I mean

16:23 sandbags: what i wouldn't give for Clojure hosted natively on a Cocoa VM

16:24 a la MacRuby

16:24 Morgawr: if I have a list of numbers and one keyword, what's the best way to build a list of keywords with that original keyword + added number? So far I have:

16:24 sandbags: at least one soft tissue organ i'm sure

16:24 Morgawr: ,(map #(keyword (str "mykeword" %)) [1 2 3 4 5])

16:24 clojurebot: (:mykeword1 :mykeword2 :mykeword3 :mykeword4 :mykeword5)

16:24 Morgawr: is there a better way to do it?

16:25 tomjack: dnolen: interesting

16:25 dnolen: sandbags: if you try :optimization :none you'll actually be able to measure how fast the CLJS compiler is - you should see sub second compile times

16:25 tomjack: I haven't been noticing my compile times

16:26 :none?!

16:26 sandbags: dnolen: thanks, i'll try

16:26 tomjack: I always thought :whitespace was the least

16:26 Morgawr: the problem with :none is that it outputs a series of files and not just a single .js file so it will screw up your project

16:26 sandbags: that has the recompile down to 1s flat

16:26 Morgawr: :none just takes the output from the cljs compiler and does't send it to google closure

16:26 dnolen: sandbags: it does mean you need to have a different way you load the contents of the page - but it's not hard

16:27 Morgawr: yeah

16:27 dnolen: load the contents of the js I mean

16:28 tomjack: when clojure-metal is ready, will be be able to use it for clojure-ios?

16:31 dnolen: tomjack: so did you get async working w/ CLJS?

16:31 tomjack: I got just that simple refheap working at least

16:31 not alt yet

16:31 I need to port the commit rich made this morning

16:32 I think ioc_alt is wrong too

16:32 I mean it certainly needs to be updated for the new alt at least..

16:32 I was able to get alt-in-go sort of working by moving some things around

16:32 I suspect there is some crazy problem in the cljs compiler, but will have to confirm later with a simpler example that it wasn't pebkac

16:33 but it still blew up because the Alt instruction returns ::queued, which I think doesn't make sense

16:33 that or I fucked it up

16:33 btw, have any ideas what to do about the get-thread-bindings and with-bindings?

16:34 dnolen: tomjack: not really

16:34 tomjack: I was thinking try to define them in core.async somehow

16:34 like a poor man's var system inside core.async where you have to opt-in to every var you want conveyed

16:36 looking back at my last attempt in cljs itself, I think that should work - I only had to change def, and that was just so dynamic vars automatically opted in

16:37 dnolen: tomjack: it's not clear to me whether core.async guys think that part needs porting to CLJS should ask them

16:37 tomjack: I think of *print-fn*

16:37 but if you just set! it in the top-level, that won't matter..

16:38 I definitely have some dynamic vars I want conveyed though :(

16:38 dnolen: tomjack: well perhaps core.async will be what pushes along conveying dynamic var in CLJS ;)

16:39 tomjack: that hope has occurred to me

16:39 dnolen: tomjack: yeah, I think core.async will likely be heavily used and conveying dynamic vars seems considerably more compelling given that

16:40 tomjack: it would mean clojurescript.test has a fairly easy async avenue I think

16:40 just let them return a channel or something. then all the dynamic reporting stuff can stay as it is (though we could work around it)

16:43 gfredericks: glad to see CLJ-899 hasn't gone anywhere

16:47 akells`: hi -- working on building a clojure server from scratch -- I'm following along with this blog post http://fasttrackclojure.blogspot.com/2010/09/lesson-6-parsing-http-request-in.html but it seems that his implementation isn't going to be able to actually get any body content on a POST or a PUT.

16:47 the read-line will stop after it gets to empty? , which im assuming is why I'm only getting the request header when I parse the request

16:47 tshauck_: hi, does anybody know how I might handle writing to a csv... I keep getting a stackoverflow error with https://github.com/clojure/data.csv

16:48 akells`: does anyone have any input on how I might be able to continue to read-line until I've gotten the entire request -- headers and body content?

16:48 gfredericks: tshauck_: we use data.csv at work and I've never encountered that

16:48 tshauck_: could you work out a minimal example?

16:48 tshauck_: gfredericks: ya, one second

16:51 Morgawr: I have a question.. I am writing a cljs library, it builds a .jar file and everything. However now I want to test my functions and my stuff, I compile it into a single .js file (like normal), how do I load this file from a rhino repl to test the functions?

16:52 I know how to spawn a new clojurescript rhino repl, however when I try to use (in-ns ..) it says the namespace doesn't exit/can't find it

16:53 gfredericks: ,(binding [*print-dup* true] (pr-str (first {:a 1})))

16:53 clojurebot: "#=(clojure.lang.MapEntry/create [:a 1])"

16:54 gfredericks: ,(clojure.lang.MapEntry/create [:a 1])

16:54 clojurebot: #<CompilerException java.lang.IllegalArgumentException: No matching method: create, compiling:(NO_SOURCE_PATH:0:0)>

16:54 tshauck_: gfredericks: here (https://gist.github.com/tshauck/5653954) is a snippet from my core.clj

16:56 Morgawr: anybody knows?

16:58 gfredericks: tshauck_: when I set v to (repeat 900000 [1 2 3]) it works fine for me. Maybe you could figure out what the difference is between your data and that

16:58 Morgawr: oh.. nevermind, found out, I had to use load-namespace

16:59 gfredericks: tshauck_: also it might help if you provide the first 10-20 lines of the stack trace

16:59 tshauck_: gfredericks: alright... it's very bizarre, I just ran w/i my repl and it was successful... I'll update the stack trace

17:00 noahlz: If I'm using ring.mock.request am I suppoesd to be doing something like

17:00 tshauck_: gfredericks: just update https://gist.github.com/tshauck/5653954

17:00 noahlz: (slurp (:body response)

17:01 tshauck_: updated*

17:01 noahlz: I'm getting a BufferedInputStream

17:01 instead of a string like the README implies

17:02 Morgawr: how do I reload a namespace from the repl?

17:02 tshauck_: gfredericks: so when I load the repl and do (-main) it works... when I call lein run it fails...

17:03 gfredericks: tshauck_: oh this might be your usage of concat

17:03 concat being lazy has some gotchas

17:03 first thing to try is replace (reduce concat g) with (apply concat g)

17:04 tshauck_: gfredericks: that worked... for my edification whats the difference

17:04 gfredericks: better yet you could probably change `(def g (map ...` on line 4 to `(def g (mapcat ...`

17:05 tshauck_: since concat is lazy it's essentially wrapping the args you give it in a thunk, which requires a stack frame when you actually try to read the data structure; reduce is going to do this wrapping for every element in the list you pass to it

17:06 whereas (apply concat ...) is just one call to concat

17:07 tomjack: wow, the new alt rocks

17:07 tshauck_: gfredericks: interesting... thanks

17:09 gfredericks: tshauck_: put another way, the diff between reduce and apply is the diff between (concat (concat (concat a b) c) d) and (concat a b c d)

17:15 tomjack: oh, I misunderstood new alt

17:15 noahlz: anybody here have experience with ring.mock?

17:16 weavejester: noahlz: What's the problem?

17:16 noahlz: hey

17:16 your read me implies that :body will have a String but Midje is telling me that its a BufferedInputStream

17:17 I'm using Compojure + ring-middleware-format

17:17 I suspect part of the issue

17:17 (slurp response) works

17:17 resposne is returned by the mock

17:17 (slurp (:body response)) rather

17:18 akells`: anyone have any ideas as to how I could potentially keep doing a read-line on a HTTP request that has body contents? my current implementation can only get headers, so if its a POST or a PUT request I'm not actually getting the data

17:18 weavejester: noahlz: The body of the response is whatever you set it to.

17:18 noahlz: hrmmm

17:18 got it

17:18 weavejester: noahlz: It can be a string, or it can be an inputstream

17:19 noahlz: Well, I'm using ring.middleware.format

17:19 that's probably why

17:19 k thanks!

17:23 gfredericks: akells`: does line-seq help?

17:24 akells`: gfredericks: lemme look

17:25 gfredericks: this might work.

17:25 gfredericks: thanks!

17:26 gfredericks: np

17:32 akells`: gfredericks: hmm, line-seq seems to just cause this to hang. any idea how line-seq determines its time to stop reading?

17:33 gfredericks: akells`: the source is pretty readable

17:33 it stops when .readLine on the reader returns nil

17:33 akells`: thanks again

17:36 tomjack: dnolen: I also think the binding frame is used to store arbitrary extra data, like locals

17:36 and recur points

17:37 so really go is probably horribly broken in cljs until get-thread-bindings

17:37 maybe I'm misreading

17:38 probably that shouldn't matter

17:39 the extra data does get passed to with-bindings but I guess it's not used by the state machine that way, and get-thread-bindings is only needed for vars on go-entry

17:40 dnolen: tomjack: yeah I don't see how you can save recur points, you can't recur out of a go block far as I can tell.

17:42 tomjack: from little I've looked at the source go looks fine for CLJS - but conveying binding would make it much nicer.

18:14 dobry-den: I have a lil Compojure one-page app with a single atom. To be clear, swap!ing that atom will block the server right?

18:14 HolyJak: dobry vecer, dobry dne

18:15 dobry-den: :)

18:15 ahoj

18:23 HolyJak: Ahoj :) Unfortunately I do not have an answer to your question but it should be easy enough to find with a simple experiment - (swap! my-atomr #(Thread..sleep())) or st. like that

18:23 Raynes: dobry-den: Yes.

18:24 dobry-den: If you need updates to happen asynchronously, look at agents.

18:26 dobry-den: Right, thanks.

18:29 Stuart Halloway blew my mind in this talk with something simple: http://www.infoq.com/presentations/Concurrency-Clojure — Why use STM when you can just put the vars in one atom?

18:29 (If your model allows)

18:34 technomancy: if your model allows you shouldn't use the STM; that's right

18:34 oh, is that a rhetorical question?

18:40 callen: I think it's pretty funny nobody thought to put multiple datum in a single atom.

18:42 hyPiRion: dobry-den: performance?

18:43 dobry-den: yeah it was rhetorical.

18:46 noahlz: \quit

18:48 dobry-den: callen: i don't know if it's "nobody thought".

18:48 it's just easy for the semantics of "transaction" to come up, and refs immediately come to mind

18:50 tshauck_: Hi, done I have a file view file-seq, what's the best way to get that to a string to work with it?

18:50 It looks like #<File data/data.json>

18:51 dobry-den: building a game, you may go a component/entity/system route with one monolithic data structure. then the next day you stumble across Hickey's ant colony simulation that uses a bunch of refs for ants

18:52 (i read about CES here: http://www.chris-granger.com/2012/12/11/anatomy-of-a-knockout/)

18:53 bbloom: dobry-den: the ant colony was more of a tech demo than anything else

19:02 augustl: is there a package in some maven repo somewhere that contains the Java code for clojure persistent data structures only, not all of Clojure?

19:06 adu: isn't that hibernate?

19:07 augustl: http://docs.jboss.org/hibernate/orm/3.2/api/org/hibernate/collection/PersistentList.html

19:08 augustl: adu: is that a joke? :)

19:11 adu: augustl: no, does it come accross as a joke?

19:11 tomjack: wowza http://docs.jboss.org/hibernate/orm/3.2/api/org/hibernate/collection/PersistentCollection.html

19:12 bbloom: adu: you're confusing the two possible meanings of "persistent"

19:12 adu: clojure uses "persistent" to mean "structural sharing" and hibernate uses it to mean "durable"

19:13 augustl: adu: that's not Clojure's persistent data structures you linked, so I wasn't sure

19:14 bbloom: augustl: are you looking for something similar to https://github.com/swannodette/mori ?

19:15 adu: I honestly didn't know there was a difference, thanks for the education

19:15 augustl: bbloom: yeah. I want to use persistent data strucutres in a non-clojure project, and just using the ones from Clojure would make sense. I would rather not depend on all of the rest of clojure though, such as the reader, the standard lib, etc

19:16 bbloom: augustl: i think you want google guava: https://code.google.com/p/guava-libraries/wiki/ImmutableCollectionsExplained

19:18 augustl: or maybe not. looks like these aren't persistent

19:18 augustl: yeah I found that also, and it seems they're copy on write

19:19 bbloom: bummer

19:19 augustl: hmm, Martin Odersky on stack overflow: "In fact, I do not know of a difference between immutable and persistent; for me the two terms are aliases."

19:20 scala's immutable data structures are apparently persistent too

19:20 bbloom: *shrug* persistent implies structural sharing

19:23 tomjack: I don't think so

19:23 but I can't really think of any interesting counterexamples

19:24 augustl: from wikipedia: In computing, a persistent data structure is a data structure that always preserves the previous version of itself when it is modified. Such data structures are effectively immutable, as their operations do not (visibly) update the structure in-place, but instead always yield a new updated structure.

19:43 jouiswalker: http://www.infoq.com/presentations/Concurrency-Clojure

19:43 insanely cool

21:37 augustl: I want to write a function that adds some data to a list of operations to be performed later, and have some sort of queue thingie that processes this list one item at a time. Anything built-in in Clojure or java to do this?

21:38 brehaut: aside from agents?

21:39 augustl: brehaut: I'm a concurrency noob, looking it up :)

21:39 brehaut: a thread consuming from a java.util.concurrent.LinkedBlockingQueue or java.util.concurrent.ArrayBlockingQueue

21:40 thers always extrenal queues too, or something like actors

21:42 augustl: brehaut: thanks

21:52 technomancy: augustl: there definitely is a library that gives you clojure's data structures without the full runtime, but I don't remember what it's called

21:53 augustl: rich says that "persistent" implies that performance characteristics don't change over time either, but it's not a widely-adopted defenition

21:53 even though persistent and immutable usually amount to the same thing, they have different connotations: http://technomancy.us/132

21:57 dobry-den: an immutable structure without persistence would probably imply a naive copy when you want to change it

21:58 tomjack: does the question of persistence not even apply to hypothetical defrecords with no ext map?

21:59 dobry-den: http://www.cs.cmu.edu/~rwh/theses/okasaki.pdf Purely Functional Data Structures

21:59 tomjack: oh obviously not

22:00 or they're trivially persistent I guess

22:04 hyPiRion: immutable means "does not change"

22:05 gfredericks: "cannot be muted"

22:05 hyPiRion: persistent means that the previous version of the structure is preserved

22:05 gfredericks: "won't shut up"

22:05 hyPiRion: hah

22:06 augustl: technomancy: I'll try to find it and blog about it (and pay SEO peeps to increase my page rank?) :)

22:06 benkay_: I have two functions that each reach out to Datomic; one creates an asset and the other creates a liability. I want to call these functions in a `dosync call so that they commit to Datomic as a pair or not at all, but I don't know that this is idiomatic. Input?

22:06 augustl: benkay_: sounds like you want additional side effects added as part of a datomic transaction?

22:07 benkay_: maybe. full disclaimer, I have no idea what I'm doing.

22:08 augustl: not sure what you mean with synchronizing datomic in a dosync, since datomic is already atomic and synchronized :)

22:08 benkay_: I'm approaching this problem from a totally naive perspective. I've written two functions that each do a thing, I want to call them together and have them each do their things but only if both go through.

22:08 augustl: you could always do this in one datomic transaction instead of multiple to ensure all or nothing

22:08 benkay_: I'm totally open to this being a Bad Implementation.

22:09 augustl: you don't know if a datomic transaction goes through until after it finishes running the transaction.. So you will likely encounter general two phase commit problems if that's what you're doing..

22:09 seangrove: Hitting a pretty cryptic error on clojurescript compilation: https://www.refheap.com/15049

22:10 benkay_: aaah, thanks august1.

22:10 seangrove: It's not clear where I should start looking to debug this

22:11 benkay_: august1, can I compose functions that have been committed to the datomic database?

22:11 augustl: benkay_: you can call multiple transactor functions in one transaction if that's what you mean

22:11 benkay_: that is exactly what I mean.

22:11 thanks!

22:12 to clarify, if I have a `db/ident :create-asset and `db/ident :create-liability, I can write a new transactor function that calls both :create-asset and :create-liability

22:12 correct?

22:12 augustl: they all just expand to datoms anyway :)

22:13 a transactor function can also call a transactor function yeah, the expansion does not stop at one "hop"

22:16 benkay_: awesome. awesome awesome awesome. thanks, august1!

22:18 so?is the idea with Datomic to just stuff all state-related things into it?

22:18 "just"

22:21 adu: so where can I learn more about clojure's definition of persistence?

22:25 gfredericks: technomancy linked to a blag of his half an hour ago

22:33 tomjack: seangrove: great

22:33 I guess it's inevitable that a stacktrace library will do this for a while, and that it's worth it

22:34 it looks like you're going to have to patch clj-stacktrace

22:35 while you're at it, https://www.refheap.com/03b864ff16c883ca2370f7838#L-17

22:35 adu: oooo

22:35 so persistent=immutable and transient=mutable

22:36 should have use those words from the beginning

22:36 tomjack: no.. :(

22:37 adu: tomjack: what?

22:38 tomjack: "persistent" means more than "immutable" around here

22:38 and "transient" has a very particular meaning in clojure - mutable one-shot single-thread-only collections cheaply obtainable from, and convertible back to, persistent collections

22:39 adu: to me, that's a distinction without a difference, with an added confusion for most programmers

22:39 tos9: it means "stuff can access older versions of stuff, and create new versions from older versions of stuff by reusing internal structure of the old version without copying much of it"

22:39 adu: tos9: right, that's true of all immutable data structures

22:39 tomjack: if there were no difference, rich wouldn't have had to write the collections

22:39 tos9: adu: not really.

22:39 adu: but why do you need a new name for it?

22:40 tos9: adu: most of the time immutable just means... not mutable :)

22:40 it says nothign about an ability to create new things, or how easily that can be done, or how to use the old ones to create the new ones

22:40 so that's the main new thing about persistence.

22:41 amalloy: adu: not all immutable structures are persistent. it won't help for you to keep claiming they are the same

22:42 eg, a copy-on-write arraylist is immutable, but you can't modify it performantly

22:42 tos9: adu: http://en.wikipedia.org/wiki/Persistent_data_structure is the relevant wikipedia article

22:42 in particular clojure's dses are fully persistent

22:43 adu: oh, from that definition, I wouldn't use the word persistent, I would use the word "Cellular"

22:44 because keeping yourself around for future reads has absolutely nothing to do with persistence

22:44 that has to do with removing time from the rest of the system

22:45 tos9: If I remember my data structures class trivia, the word persistent has been used in this context for ~25 years :)

22:45 mrowe: "keeping yourself around [...] has nothing to do with persistence". really?

22:45 adu: and if time is removed from the rest of the system, then you have no reference points in which to discuss "persistence"

22:45 http://web.mit.edu/~axch/www/

22:45 Alexey Radul's PHD thesis talks about it

22:45 and he doesn't talk about persistence, he talks about Cells

22:45 seangrove: Is there a way to have cljs read a javascript form and convert it cljs?

22:45 adu: which is why I perfer the term "Cellular" for this kind of thing

22:46 seangrove: I know I'm talking crazy now, but having trouble with the angular<->cljs bridge

22:46 bbloom: amalloy: "you can't modify it performantly" isn't exactly true… more precisely there is no structural sharing… it's plenty performant to copy an array of only a few items. it's actually faster than doing the tree trunk rewriting thing for a smaller number of nodes since the memory is contiguous in the array case

22:46 augustl: adu: cellular is a pretty good name

22:46 adu: augustl: :)

22:46 bbloom: amalloy: i know you already knew that, but for the other observers, i'll be pedantic :-)

22:46 augustl: it's pretty descriptive and it's not confusing for the status quo

22:46 adu: augustl: have you read Alexey Radul's paper about Cells?

22:47 tomjack: bbloom: "only a few items" makes the whole issue moot

22:47 bbloom: tomjack: that's the whole point of arraymap though

22:47 tomjack: indeed

22:47 augustl: adu: no, I rarely read papers (unfortunately)

22:47 tomjack: no structural sharing, but arraymap is persistent.. enough?

22:48 adu: augustl: you should, it's very inspiring, and completely implemented too: http://groups.csail.mit.edu/mac/users/gjs/propagators/

22:48 I've been trying to port it to other languages, without much success as of yet

22:50 augustl: he defines a Cell as a memory location that remembers its own history, or that learns as values are stored in it

22:51 tomjack: I guess we don't say arraymap is persistent, huh

22:52 augustl: isn't it called PersistentArrayMap? :)

22:52 tomjack: oh, I forgot

22:53 adu: so I suppose I have to make 2 locations in my brain now, imperative persistence (for my boss to communicate with my), and functional persistence (so I don't get kicked out of this room)

22:53 tomjack: I suppose it counts as persistent because it metamorphoses when necessary

22:53 augustl: EventuallyPersistentArrayMap..

22:54 bbloom: you can argue precise definitions all you want, but when you use the words "immutable" and juxtapose it against "persistent" then there is a difference: "persistence" suggests structural sharing. you could also say "purely functional data structures" which has the same implication

22:54 augustl: adu: many clojure programmers use the word durable for putting stuff on non-volatile storage

22:54 bbloom: but yeah, i guess technically, full 100% copy on write means persistent as well

22:54 adu: I've heard some horror stories about COW

22:54 augustl: bbloom: how is cow persistent?

22:55 tomjack: that "persistence" suggests structural sharing is a non-trivial fact I think

22:55 augustl: ah

22:55 bbloom: you guys are looking for a formal definition where none exists

22:55 adu: bbloom: Mr. Radul has a formal definition of "Cell"

22:55 tomjack: the definition should say nothing about structural sharing - that data structures which satisfy our actual goals often (always?) use structural sharing is interesting

22:56 bbloom: full COW is just a degenerate case of structural sharing

22:56 ie it shares 0% of the structure

22:56 :-P

22:57 tomjack: rough rich quote: "persistent data structures are trees"

22:57 proof please! :)

22:58 bbloom: while i'm discussing degenerate cases… lists are just degenerate trees

22:58 adu: but I understand the benefit of sharing

22:59 bbloom: in racket '(0 . (1 . (2 . (3)))) => '(0 1 2 3)

22:59 adu: many languages emphesize that, like Go's slices, OpenCL's subimages, etc.

22:59 bbloom: adu: slices are not structural sharing

22:59 adu: bbloom: yes they are

22:59 bbloom: adu: not in the persistence sense

22:59 adu: true

23:00 bbloom: clojure has "slices" in a sense to, see ##(doc subvec)

23:00 lazybot: ⇒ "([v start] [v start end]); Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive). If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done."

23:00 tomjack: "traversable functor iff functor shapely over lists"

23:00 I wonder what functors shapely over trees are?

23:02 adu: well, in the case where you're reading a mmapped file for parsing purposes, then it's effectively an immutable slice, in which case the structural sharing implies functional persistence, yes?

23:02 tomjack: if you can't change it, no

23:02 bbloom: structural sharing suggests (again, not a formal definition) that you can cheaply produce a new value without affecting the old value

23:16 seangrove: How can I have a cljs function that calls itself async-ly? The compiler complains that update-later is undefined in this case: https://www.refheap.com/15052

23:20 tomjack: (fn update-later [] ...)

23:20 seangrove: Ah, jesus, thanks

23:20 tomjack: alternatively, letfn

23:22 holo: hi

23:23 auser: hey holo

23:26 holo: auser, hi. thank you!

23:27 is there some kind of "in" operator for clojurescript?

23:27 macro

23:27 auser: unfortunately I don't know clojurescript super well

23:28 seangrove: holo: doseq?

23:31 holo: seangrove, this "in" operator from javascript is for the purpose of checking if a property is present

23:34 i guess i can lookup for the key in case it's a map. but i don't know yet if the requirement is a map. maybe i need to know more about the requirement

23:34 bbloom: holo: isn't hasOwnProperty perferrable?

23:34 preferable*

23:35 holo: bblom, thanks that looks like it!

23:36 (inc bbloom seangrove)

23:36 lazybot: ⇒ 1

23:36 holo: (inc bbloom)

23:36 lazybot: ⇒ 9

23:36 bbloom: holo: there's also aget

23:36 holo: (inc seangrove)

23:36 lazybot: ⇒ 1

23:37 holo: i see...

23:53 bmentges: Im having a very hard time learning clojure, specially doing the recursive koans (13)... before this one it was OK, now its getting harder and harder... are there any preparations before learning functional programming ? literature and all ?

23:58 echo-area: bmentges: Structure and Interpretation of Computer Programs

Logging service provided by n01se.net