#clojure logs

2013-05-26

00:48tshauckhi, does somebody have a recommendation on how I could do this...
00:48tshauckhttps://gist.github.com/tshauck/5651728
00:52tomjacktshauck: you're more likely to get an answer if you indicate your desired output
00:53tshaucktomjack: I do in the comment of the gist
00:53akhudektshauck: it's not clear what it should look like from the example
00:54callentshauck: yeah needs structure/example
00:54tshauckalight, I'll be more explicit
00:56tshauckhere's an update - https://gist.github.com/tshauck/5651728
00:57tomjackhmm
00:58tomjack(mapcat #(cond-> % (string? %) vector) coll) ?
00:58akhudektshauck: cartesian-product almost does what you want https://github.com/clojure/math.combinatorics
00:58tomjackoh, I misread
00:58akhudekthough you'll have to make sure that the singletons get enclosed in a seq somehow
00:59akhudekand then you'll have to change everything to vectors if that really is a requirement
00:59tshauckthe only requirement is to write it to tsvs after the transformation is done
01:00tomjack(apply (partial map vector) (map #(if (string? %) (repeat %) %) coll))
01:03tshauckalright, I'll look into those solutions thanks
01:05tomjackI don't think you want a cartesian product
01:06tomjackit's a zip, (map vector ...), but you have to lift up the singletons, like akhudek said, with repeat
01:08akhudektomjack: the output sure looks like a cartesian product to me
01:09akhudektomjack: not carried through to completion of course
01:09akhudekor wait, you are right
01:09akhudeknevermid
01:09akhudekI must be tired
01:09tomjackthe diagonal is a subset of the cartesian product, naturally
01:14arrdemis there a trick for updating multimethod defs without restarting nrepl?
01:28crocketIt's hard to get a sense of language.
01:28crocketSome people say clojure is productive and its design is good.
01:28crocketSome people say clojure is a mess.
01:34arrdemcrocket: some people just let tools do the talking
01:36crocketarrdem, meaning?
01:36arrdemthe bottom line is that we're programmers. the tool itself isn't the question, it's what the tool produces that matters.
01:36arrdemit all goes to x86 at the end of the day
01:36arrdemthe real question is whether a tool makes us more productive, or whether we prefer it over something else
01:36mthvedtall we know is… it's called programming! /jeremy clarkson
01:37arrdem(inc mthvedt)
01:37lazybot⇒ 2
01:37arrdemI mean we can flame all day about languages and ecosystems but the bottom line is that languages are specialized in one way or another.
01:37mthvedtmm karma
01:37arrdemclojure is a general tool with a cultural bent towards web development
01:38arrdemend 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.
01:39arrdemnot trying to be a dick, just trying to be pragmatic about it :/
01:39crocketarrdem, I don't have a clear opinion on clojure, yet.
01:39akhudekcrocket: people use it for lots of other things too: clustering, NLP, theorem proving
01:40arrdemakhudek: when did we get the theorem proving guys?
01:40arrdemakhudek: or just 'cause its just another lisp...
01:41akhudekarrdem: my work at the university of waterloo involves a clojure theorem prover
01:41akhudekhopefully to see the public light of day this year
01:41akhudekthough it's special purpose
01:41arrdemcool! I'm at UT Austin so I've been subjected to J Moore's ACL2 :/
01:42akhudekah, yeah, I've not used that myself
01:42akhudekthese days resolution style provers are all the rage
01:43mthvedtooh i know someone at ut austin math
01:44arrdemakhudek: oh cool! I'm not an automated reasoning buff but I'll be interested to see how your system works
01:44tomjackarrdem: (ns-unmap *ns* 'the-multimethod) :(
01:45arrdemI'm more computer architecture, compilers and low level systems it seems..
01:45arrdemtomjack: goddamnit ok thanks
01:45arrdemwould clojure not on the JVM still be clojure?
01:45akhudekarrdem: our prover is actually special purpose; we use it to compile database queries
01:47akhudekarrdem: I'm hoping that I might be able to submit something regarding it for the next conj, though we'll see
02:21arrdemDAE think this is reasonable? (defn sym docstring? (ret-type? params & forms))
02:22arrdem(defn type? sym docstring? params & forms) as the alternative
02:45callengod
02:45callenthose netsplits get old.
02:46arrdemnightfly: you were showing them? I turned em off after about three months of lurking...
02:47arrdembest decision I've made yet :/
02:47callenI need to see them from time to time
02:47callenI was grumping about the netsplit not because of the JOIN/PARTs, but because I was _'d.
02:47callenhad to renick and reidentify.
02:47callenannoying.
02:47arrdemah
02:47nightflythat's what I meant, guess I shoult have just said it instead of /me'd
04:22klrrhmm, 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
04:23sinistersnareklrr: maybe try
04:23sinistersnarejava -cp clojure-1.4.0.jar my-clj-file.clj
04:23sinistersnarenot the main
04:23sinistersnarebut the actualy file
04:24klrrokey, 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?
04:25klrroh god i didnt append .jar
04:25klrrsry!
04:25klrrnow it works :)
04:26sinistersnare:D
04:26sinistersnaredo you have lein installed
04:27sinistersnarealso, if you want to call upon someone, make sure to prepend your coment with their name and a colon. example:
04:27sinistersnareklrr: TEST!
04:27sinistersnareklrr, i think a comma works too
04:44klrrlazybot: help
04:44lazybotYou're going to need to tell me what you want help with.
04:44klrrlazybot: help you
04:44lazybotTopic: "you" doesn't exist!
04:44klrrlazybot: help lazybot
04:44lazybotTopic: "lazybot" doesn't exist!
04:44klrrlazybot: help help
04:44lazybotklrr: Get help with commands and stuff.
04:44klrrlazybot: help commands
04:44lazybotTopic: "commands" doesn't exist!
04:44arrdemklrr: yeah there isn't a #clojure manual :/
04:45klrrarrdem: can it evaluate haskell expressions?
04:46arrdemklrr: &false
04:46arrdem,(= 'clojure 'haskell)
04:46clojurebotfalse
04:46klrrokey read somewhere it could do that but i guess i was wrong :(
04:47klrr$heval 2
04:47lazybot⇒ 2
04:48klrr$heval (\n -> n + n) 2
04:48lazybot⇒ 4
04:48klrrarrdem: it has haskell support :D
04:48klrrbbl
04:48Iceland_jack$heval join (+) 2
04:49lazybot⇒ 4
07:22tomjackakhudek: sweet, not datomic queries I'm guessing?
07:48MorgawrHello, 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?
07:48MorgawrI've been meaning to read more in-depth stuff
07:51lyttonhttp://clojure.org/books
07:52Morgawrlytton: thanks, will check them out
07:53teromJoy of Clojure is quite nice
07:54tomjackI like 'clojure programming'
07:54decafvery nice. from manning
07:54lyttoncan not say which is best, probably of the opinion that one must go through several before you get the mental part with;-)
07:55decaftomjack: you are saying that o'reilly book?
07:56tomjackyeah, not that TJoC isn't nice - I don't remember it
07:56decafI didn't get a word of it
07:57Morgawrlots of stuff to read now, thanks :)
07:57lyttonhaha,,
08:13klrr$heval putStrLn "hello"
08:13lazybot⇒ <IO ()>
08:15klrr$heval writeFile "." "does this work?"
08:15lazybot⇒ <IO ()>
08:15klrr$heval readFile "*"
08:15lazybot⇒ <IO [Char]>
08:16klrr$heval let fib = 2
08:16lazybot⇒ not an expression: `let fib = 2'
08:18Foxboronohyou klrr :P
08:21klrrFoxboron: well it wont work i guess, the bot uses tryhaskell.org's api to evaluate a string :x
08:31hyPiRionhmm
08:31hyPiRion$tryhaskell 1 + 2
08:31lazybot⇒ 3
08:31hyPiRiondifferetn things
08:35pete_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
08:39Okasu$help heval
08:39lazybotOkasu: Evaluates Haskell code with mueval.
08:39Okasu$list
08:39lazybotI know about these topics:
08:40Okasulazybot: You're knowledgeable indeed.
08:43peter``Hi all...
08:44Okasu$heval foldl1 (flip (.)) [(+1),(*2)] 500
08:44AtKaaZChongLi, unless I am in #clojure I cannot see you're on it when /whois
08:44lazybot⇒ 1002
08:45Okasu$heval "12" >>= \a -> "45" >>= \b -> return [a,b]
08:45lazybot⇒ ["14","15","24","25"]
08:46peter``ciao
08:47noidipete_, The Joy of Clojure + Google :)
08:48noidipete_, 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 :)
08:51noidipete_, 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
08:57pete_That looks excellent
09:00kaffeebohneHi. 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?
09:01pete_kaffeebohne: I wonder if you're thinking about it wrong
09:01pete_kaffeebohne: And instead, you have a list of digits, that you wish to partition in to smaller lists
09:02kaffeebohneok pete_
09:03pete_What's the source of your 20 digit number?
09:03kaffeebohneAt the moment just numbers in the code, later it will be user input or random.
09:06hyPiRionkaffeebohne: use quot and rem perhaps?
09:06hyPiRion,((juxt quot rem) 123456789987654321 1000000000)
09:06clojurebot[123456789 987654321]
09:22sveduboisDo you know if mouseenter and mouseleave are implemented in Domina (CLJS)?
09:23gfredericksdoes domina require individual events to be implemented separately?
09:30sveduboisI think they are implemented as :mouseover and :mouseout
09:30sveduboisSource: https://github.com/magomimmo/modern-cljs/blob/master/doc/tutorial-09.md
10:09tomjackbbloom: https://www.refheap.com/4d56cca0ecbf959e483651bb4
10:09tomjackit works! :)
11:38bbloomtomjack: nice.
11:39tomjackstuck on alt
11:41tomjack"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:41tomjack(defrecord Alt [...] IInstruction (reads-from [this] ...) ...)
11:47recursor94I 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:48bbloomrecursor94: 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:48bbloomrecursor94: 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:49recursor94Thank you bbloom.
11:54tomjack:aliases {"clein" "clean"}
11:56tshauckHi, what are thee # and % doing in this call (map #(apply max %) [[1 2 3][4 5 6][7 8 9]])
11:58Okasu,'(map #(apply max %) [[1 2 3][4 5 6][7 8 9]])
11:58clojurebot(map (fn* [p1__29#] (apply max p1__29#)) [[1 2 3] [4 5 6] [7 8 9]])
11:58Okasutshauck: ^
11:58dcbtshauck: the # creates an anonymous function, % is the argument
12:00tshauckinteresting thanks
12:06clojure-newhello
12:07clojure-newIs there any guide how to make sessions in ring/compojure app to enable users login?
12:30howdynihaoif i define a function, [f & args] (for [x f] ... ) this will work, how do i do instead (for [x args] ... ) ?
12:30howdynihaoi think its a matter of converting args from vector to a list?
12:32howdynihaoalso how would i do something like (for [x args y args z args] if args was length of 3 dynamically?
12:33seangrovehowdynihao: It's not clear how that would help. What are you trying to do?
12:35jtoyhow can I know the difference between 2 vetors?
12:35jtoy(diff [1 2 3] [1]) => [1 2] ?
12:35jtoyi mean [2 3]
12:35howdynihaoseangrove: 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:36howdynihaoand i prefer not to use 'f' and just say args but it complains about converting it?
12:37weavejesterhowdynihao: "f" isn't a function, then?
12:38weavejesterhowdynihao: Why not: (defn blah [& args] (for [x args y args] [x y])) ?
12:38howdynihaono it's just an argument for the function, a list
12:38weavejesterhowdynihao: Though to me it would make more sense as: (defn blah [xs] (for [x xs y xs] [x y]))
12:40howdynihaoweavejester how would i make the local binding for 'for' dynamic? length of xs
12:40howdynihaoso that function would be correct assuming xs is length of 2
12:41howdynihaoim assuming a totally different looking function :P
12:41weavejesterhowdynihao: Ohh, I seeeee
12:41weavejesterhowdynihao: So you want something like...
12:42weavejesterhowdynihao: (cross [1 2] [3 4] [5 6]) => [[1 3 5] [1 3 6] [1 4 5] [1 4 6] …] ?
12:43weavejesterWhere cross can have a variable set of arguments
12:43howdynihaoyea
12:43weavejesterYou can just use recursion in that case
12:44tomjackclojure.math.combinatorics/cartesian-product ?
12:44weavejesterLet me see if I can give you a quick example...
12:44weavejestertomjack: I was about to look for that :)
12:44tomjackhttp://stackoverflow.com/a/2569866/1306817
12:44tomjackbut mmarczyk just does recursion like you suggest there
12:45tomjackand claims it's faster
12:45weavejesterAlthough… the cartesian-product function in math.combinatorics is a little dense, presumably for speed.
12:45tomjackbut it's slower than the stupid version, supposedly :)
12:46tomjackI have developed a deep mistrust of math.combinatorics
12:46weavejestertomjack: The cross function you link from stackoverflow was the one I was thinking of.
12:46dhljtoy: have you looked at clojure.data/diff?
12:49dhljtoy: Depending on your definition of "difference
12:49dhlit might work for you
12:52howdynihaowell 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:52dhljtoy: How do you expect diff to behave if it's caled like (diff [2 1 3] [1])?
12:53weavejesterhowdynihao: Why doesn't recursion help you in that case?
12:53weavejesterhowdynihao: e.g. something like: (for [x (first xss) y (apply blah (rest xss))] …)
12:53howdynihaoheres 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:53howdynihaoso i was thinking use filter
12:54howdynihaoas it recursive loops?
12:54howdynihaoto filter out the elements already used
12:54weavejesterhowdynihao: Well, (cross x y z) is (almost) the same as (cross x (cross y z)), right?
12:54howdynihaoweavejester: i'm new to this, so i'm not exactly too aware of what does what haha
12:54weavejesterIf you flatten it out.
12:55weavejesterThere's a function in clojure.core called distinct or uniq or something.
12:55weavejesterThat will ensure a unique list.
12:55howdynihaoah
12:55weavejesterAnd there's a function in math.combinatorics that gives you the cartesian product.
12:55tomjackhowdynihao: it doesn't sound like you want a cartesian product
12:56howdynihaoi wanted to do the unique thing during processing seems more efficient than after
12:56tomjackwhat does it return for '[a b c] ?
12:56howdynihaoi thought cartesian product of [1 2 3 4] => [4 4 4 4] is valid?
12:56howdynihaono nevermind i'm confusing myself
12:57weavejesterIt sounds like you're talking permutations?
12:57tomjacksounds like selections to me
12:57tomjackwhich is in math.combinatorics
12:57tomjackimplemented by (apply cartesian-product (take n (repeat items)))
12:57weavejesterOr combinations if you think [4 4 4 4] isn't valid...
12:58tomjackah right
13:15tomjackhuh, alt went back to go style?
13:22hyPiRionnah, selections doesn't remove dups
13:23hyPiRion(combinations (distinct m1) n) is
13:26hotwoofydoes 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:41tshauckHi, 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:42bbloom,(apply map (comp seq vector) '((1 2 3) (4 5 6)))
13:42clojurebot((1 4) (2 5) (3 6))
13:45tshauckclojure is one crazy language... thanks
13:45bbloomtshauck: that's not so crazy :-) you just need to understand the components of it & then that becomes second nature with time
13:45bbloomyou probably don't need the comp or seq, in that case, vectors are probably fine, but i don't know your requirements
13:46hotwoofyprobably easier to just go (partition 2 (flatten '((1 2 3) (4 5 6))))
13:47tshauckbbloom: Ya, I just started to play with it yesterday (I've programmed in python for several years)...
13:47bbloom~flatten
13:47clojurebotflatten 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:47tshauckI really like it so far
13:48bbloomhotwoofy: also, that would produce (1 2) (3 4) instead of (1 4) (2 5)
13:48hotwoofyoh, you're implying reading the question helps when answering, fair point. :P
14:13snowboathey, i'm new to clojure, can someone critique this function that draws a sine wave to stdout? https://gist.github.com/anonymous/5653546
14:20conorwadewhois Bodil
14:20mnemnionI'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:21mnemnionI 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:23ohpauleezconorwade: 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:29conorwadeohpauleez: 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:29ohpauleezahh gotcha
14:35seangroveohpauleez: Well done responding to commands like an irc bot though :)
14:39seangroveHow can I tell what the latest version of google-closure-library is?
14:41ohpauleezseangrove: Thank you! :) You can find the latest version by looking at the SVN repo
14:41ohpauleezof Closure
14:41ohpauleezthey version based on revision number
14:41ohpauleezand there will be a latest stable tag marked for download
14:42seangroveSure, but wondering what the version the latest version of clojurescript is using
14:42seangroveAh, got it, can look in the pom file
14:42noahlzlein outdated is handy
14:43noahlzlein-outdated plugin
14:43ohpauleezAhh the version in CLJS - yeah, look at the pom or the dependencies listed on maven central via search.maven.org
14:44seangrovenoahlz: lein-outdated looks great, thanks
14:44ianeslickIs 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:45ianeslicklein plugin install was really nice
14:45hyPiRionianeslick: you just add it to your profiles.clj, and plop, there it is
14:45hyPiRionor to the project.clj
14:46ianeslickYes, but what if I'm automating installation and want to add a plugin without overwriting the entire profiles.clj?
14:46ianeslick(Writing a chef cookbook that needs to install the immutant plugin)
14:47ohpauleezI'd ship a single profile.clj with all the plugins you'll need. Or just append to profile.clj programmatically using unix tooling
14:47hyPiRionYou can always add it to project.clj or make a new profile within profiles.d
14:47ohpauleezyou can also put plugins in your project.clj
14:47ohpauleezwhich might be more appropriate here
14:48ohpauleezhyPiRion beat me to the next suggestion, profile.d
14:48ianeslickAh, didn't know about profiles.d - that's exactly the thing
14:52arkhwhat's the fastest or recommended way to serialize/read clojure data structures?
14:52seangroveAnyone else using cemerick.piggieback/cljs-repl seeing an error when trying to connect from the browser?
14:52seangroveseeing: Uncaught ReferenceError: self__ is not defined repl:971
14:52tomjackno, maybe refheap the code around that line?
14:53hyPiRionarkh: edn
14:53xeqiarkn: if its just clojure data structures, and doesn't have any java interop then: prn-str and clojure.edn/read
14:54seangroveCode to start the repl: https://www.refheap.com/15032
14:54seangroveClient/browser side: https://www.refheap.com/15033
14:54ianeslickThanks ohpauleez and hyPiRion
14:55arkhhyPiRion, xeqi: thanks
14:55seangrovebrowser-repl trying to start the nrepl connector: https://www.refheap.com/15034
14:55hyPiRionnp
15:02seangroveLosing the repl is painful.
15:03seangroveCertainly helps one appreciate it when it's available
15:07tomjackseangrove: I meant the js
15:08tomjackaround line 971
15:10Morgawrdo 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:10Morgawr(also need to find out a good name for such a library/framework)
15:16jro_what is the correct way to parse xml in clojurescript?
15:18bbloomjro_: http://closure-library.googlecode.com/svn/docs/closure_goog_dom_xml.js.html
15:18bbloomjro_: 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:20jro_thanks
15:23sveduboisUsing Domina do you know how to reset or clear a form?
15:23svedubois(set-value! (goog.dom/getElementByClass "element") nil) doesn't work.
15:32mthvedtwhat's a lispy way to write if (condition) { return foo } chains
15:32mthvedtthat's nicer-looking than a big nested if
15:33xeqi&(doc condp)
15:33lazybot⇒ "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:33tshauck_hi, how could I write a seq of seq to a csv file...
15:33xeqiack, is that the one I'm thinking of
15:33xeqiah, just cond
15:33xeqi&(doc cond)
15:33lazybot⇒ "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:34akhudektshauck_: https://github.com/clojure/data.csv
15:35mthvedtthinking something more general than cond, like if you could plug if-lets and other conditions
15:35mthvedtmaybe there's a monad for it
15:36technomancyarkh: check weavejester's blog; he just posted about different serialization options
15:36technomancyprn/read is the easiest but by far the slowest
15:36mthvedtlike the maybe monad, but switched around, so f-monad (nil) = f() and f-monad (x) = x
15:42arkhtechnomancy: cool! thanks
15:50gfredericks,(cast clojure.lang.IFn 3)
15:50clojurebot#<ClassCastException java.lang.ClassCastException: Cannot cast java.lang.Long to clojure.lang.IFn>
15:51gfrederickshm. that's giving me an empty msg in my repl. must be a crappy jvm.
15:52dnolenMorgawr: I think people have a made a few games but not gone as far as a framework
15:53arkhso timely (for me) as well as short + sweet: http://www.booleanknot.com/blog/2013/05/25/clojure-serialization.html
15:55arkhhyPiRion, xeqi: ^^ : )
15:58tomjackI wish he showed what his benchmark was
15:59tomjackread/write/roundtrip - how many times, what kind of data? pr-str?
16:12sandbagsIs 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:12sandbagsnot sure if there's anything i can be doing wrong here
16:13tomjackyou're already using auto?
16:13sandbagstomjack: yeah, "lein cljsbuild auto"
16:13tomjackyeah, it's slow :)
16:13sandbagsah, ok
16:13sandbagsthanks tomjack
16:13tomjackI dunno, maybe there is something you can do, but the cljs compiler is not fast
16:13Morgawrsandbags: what kind of optimization?
16:13sandbagsis that related to the 19000 lines of JS it spits out every time?
16:14sandbagsi'm not sure if that's somehow dynamic - coming from clojure - or just a big copy & paste into the file it makes
16:14sandbagsMorgawr: what are you asking me?
16:15Morgawryou can use different types of optimization when compiling clojurescript files, :none, :whitespace, :simple and :advanced
16:15sandbagsah, i see, let me check
16:15sandbagsMorgawr: simple
16:16Morgawrokay, so it has to call the google closure compiler, it might be slower
16:16Morgawrif you want faster without much impact to your program use :whitespace
16:16sandbagsokay let's go for :whitespace and turn off pretty-0print
16:16Morgawrbut you will get a bigger .js output
16:16sandbagsyeah at this point i am just learning, i don't care how big the files are
16:16Morgawr(when you're ready for production go with :simple or :advanced if the libraries you use and your own code support it)
16:16sandbagsdarn, i keep forgetting LightTable is not Vim
16:16Morgawrbe 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:17sandbagsMorgawr: yeah, the book I have did mention some issues like that
16:18sandbagshrnnn so :whitespace & pretty-print false it's about 1.5s
16:18sandbagsi think it's fair to say this compiler is not blazingly fast
16:18Morgawrdepends on your computer also and a single compilation doesn't tell you how scalable it is
16:18MorgawrI never had much issues with the compiler
16:19sandbagswell yes, if i was compiling 5000 lines of clojure in 1.5s i'd be down with that
16:19Morgawrit 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:19sandbagsi guess it depends whether this is compilation time or some fixed cost for running the compiler
16:19tomjackespecially since, I believe cljsbuild is caching partial output
16:20tomjackso it won't recompile your entire library every time you change a file
16:20Morgawrall in all, in my experience, I've found the jvm to be fairly slow to initialize but pretty fast to compute
16:20Morgawrso just bear with that
16:20sandbagsnevertheless a 1.5-2s stutter isn't great
16:20tomjackit still may have some whole-project overhead though, e.g. closure? not sure
16:21Morgawryeah, with :whitespace it still goes through closure
16:21sandbagsstill i'm complaining about compiling one language i want to learn into one i consider an abhorence
16:21tomjack:
16:21tomjack:)
16:21sandbagsgood problems to have :)
16:22tomjackit'll get better
16:23sandbagsif i can figure out how to get my Clojure code talking to raphael.js or two.js i'll be golden
16:23dnolentomjack: it's definitely not slow, after warmed up JVM I think it takes one second to fully reanalyze and emit core.cljs
16:23sandbagsthink that's tomorrows problem
16:23dnolenlein cljsbuild could probably do more, keep a cached compiled core.clj and AOT the CLJS compiler
16:23dnolencore.cljs I mean
16:23sandbagswhat i wouldn't give for Clojure hosted natively on a Cocoa VM
16:24sandbagsa la MacRuby
16:24Morgawrif 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:24sandbagsat least one soft tissue organ i'm sure
16:24Morgawr,(map #(keyword (str "mykeword" %)) [1 2 3 4 5])
16:24clojurebot(:mykeword1 :mykeword2 :mykeword3 :mykeword4 :mykeword5)
16:24Morgawris there a better way to do it?
16:25tomjackdnolen: interesting
16:25dnolensandbags: 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:25tomjackI haven't been noticing my compile times
16:26tomjack:none?!
16:26sandbagsdnolen: thanks, i'll try
16:26tomjackI always thought :whitespace was the least
16:26Morgawrthe 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:26sandbagsthat has the recompile down to 1s flat
16:26Morgawr:none just takes the output from the cljs compiler and does't send it to google closure
16:26dnolensandbags: it does mean you need to have a different way you load the contents of the page - but it's not hard
16:27Morgawryeah
16:27dnolenload the contents of the js I mean
16:28tomjackwhen clojure-metal is ready, will be be able to use it for clojure-ios?
16:31dnolentomjack: so did you get async working w/ CLJS?
16:31tomjackI got just that simple refheap working at least
16:31tomjacknot alt yet
16:31tomjackI need to port the commit rich made this morning
16:32tomjackI think ioc_alt is wrong too
16:32tomjackI mean it certainly needs to be updated for the new alt at least..
16:32tomjackI was able to get alt-in-go sort of working by moving some things around
16:32tomjackI 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:33tomjackbut it still blew up because the Alt instruction returns ::queued, which I think doesn't make sense
16:33tomjackthat or I fucked it up
16:33tomjackbtw, have any ideas what to do about the get-thread-bindings and with-bindings?
16:34dnolentomjack: not really
16:34tomjackI was thinking try to define them in core.async somehow
16:34tomjacklike a poor man's var system inside core.async where you have to opt-in to every var you want conveyed
16:36tomjacklooking 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:37dnolentomjack: it's not clear to me whether core.async guys think that part needs porting to CLJS should ask them
16:37tomjackI think of *print-fn*
16:37tomjackbut if you just set! it in the top-level, that won't matter..
16:38tomjackI definitely have some dynamic vars I want conveyed though :(
16:38dnolentomjack: well perhaps core.async will be what pushes along conveying dynamic var in CLJS ;)
16:39tomjackthat hope has occurred to me
16:39dnolentomjack: yeah, I think core.async will likely be heavily used and conveying dynamic vars seems considerably more compelling given that
16:40tomjackit would mean clojurescript.test has a fairly easy async avenue I think
16:40tomjackjust 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:43gfredericksglad to see CLJ-899 hasn't gone anywhere
16:47akells`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:47akells`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:47tshauck_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:48akells`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:48gfrederickstshauck_: we use data.csv at work and I've never encountered that
16:48gfrederickstshauck_: could you work out a minimal example?
16:48tshauck_gfredericks: ya, one second
16:51MorgawrI 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:52MorgawrI 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:53gfredericks,(binding [*print-dup* true] (pr-str (first {:a 1})))
16:53clojurebot"#=(clojure.lang.MapEntry/create [:a 1])"
16:54gfredericks,(clojure.lang.MapEntry/create [:a 1])
16:54clojurebot#<CompilerException java.lang.IllegalArgumentException: No matching method: create, compiling:(NO_SOURCE_PATH:0:0)>
16:54tshauck_gfredericks: here (https://gist.github.com/tshauck/5653954) is a snippet from my core.clj
16:56Morgawranybody knows?
16:58gfrederickstshauck_: 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:58Morgawroh.. nevermind, found out, I had to use load-namespace
16:59gfrederickstshauck_: also it might help if you provide the first 10-20 lines of the stack trace
16:59tshauck_gfredericks: alright... it's very bizarre, I just ran w/i my repl and it was successful... I'll update the stack trace
17:00noahlzIf I'm using ring.mock.request am I suppoesd to be doing something like
17:00tshauck_gfredericks: just update https://gist.github.com/tshauck/5653954
17:00noahlz(slurp (:body response)
17:01tshauck_updated*
17:01noahlzI'm getting a BufferedInputStream
17:01noahlzinstead of a string like the README implies
17:02Morgawrhow do I reload a namespace from the repl?
17:02tshauck_gfredericks: so when I load the repl and do (-main) it works... when I call lein run it fails...
17:03gfrederickstshauck_: oh this might be your usage of concat
17:03gfredericksconcat being lazy has some gotchas
17:03gfredericksfirst thing to try is replace (reduce concat g) with (apply concat g)
17:04tshauck_gfredericks: that worked... for my edification whats the difference
17:04gfredericksbetter yet you could probably change `(def g (map ...` on line 4 to `(def g (mapcat ...`
17:05gfrederickstshauck_: 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:06gfrederickswhereas (apply concat ...) is just one call to concat
17:07tomjackwow, the new alt rocks
17:07tshauck_gfredericks: interesting... thanks
17:09gfrederickstshauck_: 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:15tomjackoh, I misunderstood new alt
17:15noahlzanybody here have experience with ring.mock?
17:16weavejesternoahlz: What's the problem?
17:16noahlzhey
17:16noahlzyour read me implies that :body will have a String but Midje is telling me that its a BufferedInputStream
17:17noahlzI'm using Compojure + ring-middleware-format
17:17noahlzI suspect part of the issue
17:17noahlz(slurp response) works
17:17noahlzresposne is returned by the mock
17:17noahlz(slurp (:body response)) rather
17:18akells`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:18weavejesternoahlz: The body of the response is whatever you set it to.
17:18noahlzhrmmm
17:18noahlzgot it
17:18weavejesternoahlz: It can be a string, or it can be an inputstream
17:19noahlzWell, I'm using ring.middleware.format
17:19noahlzthat's probably why
17:19noahlzk thanks!
17:23gfredericksakells`: does line-seq help?
17:24akells`gfredericks: lemme look
17:25akells`gfredericks: this might work.
17:25akells`gfredericks: thanks!
17:26gfredericksnp
17:32akells`gfredericks: hmm, line-seq seems to just cause this to hang. any idea how line-seq determines its time to stop reading?
17:33gfredericksakells`: the source is pretty readable
17:33gfredericksit stops when .readLine on the reader returns nil
17:33akells`thanks again
17:36tomjackdnolen: I also think the binding frame is used to store arbitrary extra data, like locals
17:36tomjackand recur points
17:37tomjackso really go is probably horribly broken in cljs until get-thread-bindings
17:37tomjackmaybe I'm misreading
17:38tomjackprobably that shouldn't matter
17:39tomjackthe 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:40dnolentomjack: 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:42dnolentomjack: from little I've looked at the source go looks fine for CLJS - but conveying binding would make it much nicer.
18:14dobry-denI have a lil Compojure one-page app with a single atom. To be clear, swap!ing that atom will block the server right?
18:14HolyJakdobry vecer, dobry dne
18:15dobry-den:)
18:15dobry-denahoj
18:23HolyJakAhoj :) 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:23Raynesdobry-den: Yes.
18:24Raynesdobry-den: If you need updates to happen asynchronously, look at agents.
18:26dobry-denRight, thanks.
18:29dobry-denStuart 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:29dobry-den(If your model allows)
18:34technomancyif your model allows you shouldn't use the STM; that's right
18:34technomancyoh, is that a rhetorical question?
18:40callenI think it's pretty funny nobody thought to put multiple datum in a single atom.
18:42hyPiRiondobry-den: performance?
18:43dobry-denyeah it was rhetorical.
18:46noahlz\quit
18:48dobry-dencallen: i don't know if it's "nobody thought".
18:48dobry-denit's just easy for the semantics of "transaction" to come up, and refs immediately come to mind
18:50tshauck_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:50tshauck_It looks like #<File data/data.json>
18:51dobry-denbuilding 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:52dobry-den(i read about CES here: http://www.chris-granger.com/2012/12/11/anatomy-of-a-knockout/)
18:53bbloomdobry-den: the ant colony was more of a tech demo than anything else
19:02augustlis there a package in some maven repo somewhere that contains the Java code for clojure persistent data structures only, not all of Clojure?
19:06aduisn't that hibernate?
19:07aduaugustl: http://docs.jboss.org/hibernate/orm/3.2/api/org/hibernate/collection/PersistentList.html
19:08augustladu: is that a joke? :)
19:11aduaugustl: no, does it come accross as a joke?
19:11tomjackwowza http://docs.jboss.org/hibernate/orm/3.2/api/org/hibernate/collection/PersistentCollection.html
19:12bbloomadu: you're confusing the two possible meanings of "persistent"
19:12bbloomadu: clojure uses "persistent" to mean "structural sharing" and hibernate uses it to mean "durable"
19:13augustladu: that's not Clojure's persistent data structures you linked, so I wasn't sure
19:14bbloomaugustl: are you looking for something similar to https://github.com/swannodette/mori ?
19:15aduI honestly didn't know there was a difference, thanks for the education
19:15augustlbbloom: 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:16bbloomaugustl: i think you want google guava: https://code.google.com/p/guava-libraries/wiki/ImmutableCollectionsExplained
19:18bbloomaugustl: or maybe not. looks like these aren't persistent
19:18augustlyeah I found that also, and it seems they're copy on write
19:19bbloombummer
19:19augustlhmm, 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:20augustlscala's immutable data structures are apparently persistent too
19:20bbloom*shrug* persistent implies structural sharing
19:23tomjackI don't think so
19:23tomjackbut I can't really think of any interesting counterexamples
19:24augustlfrom 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:43jouiswalkerhttp://www.infoq.com/presentations/Concurrency-Clojure
19:43jouiswalkerinsanely cool
21:37augustlI 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:38brehautaside from agents?
21:39augustlbrehaut: I'm a concurrency noob, looking it up :)
21:39brehauta thread consuming from a java.util.concurrent.LinkedBlockingQueue or java.util.concurrent.ArrayBlockingQueue
21:40brehautthers always extrenal queues too, or something like actors
21:42augustlbrehaut: thanks
21:52technomancyaugustl: 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:53technomancyaugustl: rich says that "persistent" implies that performance characteristics don't change over time either, but it's not a widely-adopted defenition
21:53technomancyeven though persistent and immutable usually amount to the same thing, they have different connotations: http://technomancy.us/132
21:57dobry-denan immutable structure without persistence would probably imply a naive copy when you want to change it
21:58tomjackdoes the question of persistence not even apply to hypothetical defrecords with no ext map?
21:59dobry-denhttp://www.cs.cmu.edu/~rwh/theses/okasaki.pdf Purely Functional Data Structures
21:59tomjackoh obviously not
22:00tomjackor they're trivially persistent I guess
22:04hyPiRionimmutable means "does not change"
22:05gfredericks"cannot be muted"
22:05hyPiRionpersistent means that the previous version of the structure is preserved
22:05gfredericks"won't shut up"
22:05hyPiRionhah
22:06augustltechnomancy: I'll try to find it and blog about it (and pay SEO peeps to increase my page rank?) :)
22:06benkay_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:06augustlbenkay_: sounds like you want additional side effects added as part of a datomic transaction?
22:07benkay_maybe. full disclaimer, I have no idea what I'm doing.
22:08augustlnot sure what you mean with synchronizing datomic in a dosync, since datomic is already atomic and synchronized :)
22:08benkay_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:08augustlyou could always do this in one datomic transaction instead of multiple to ensure all or nothing
22:08benkay_I'm totally open to this being a Bad Implementation.
22:09augustlyou 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:09seangroveHitting a pretty cryptic error on clojurescript compilation: https://www.refheap.com/15049
22:10benkay_aaah, thanks august1.
22:10seangroveIt's not clear where I should start looking to debug this
22:11benkay_august1, can I compose functions that have been committed to the datomic database?
22:11augustlbenkay_: you can call multiple transactor functions in one transaction if that's what you mean
22:11benkay_that is exactly what I mean.
22:11benkay_thanks!
22:12benkay_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:12benkay_correct?
22:12augustlthey all just expand to datoms anyway :)
22:13augustla transactor function can also call a transactor function yeah, the expansion does not stop at one "hop"
22:16benkay_awesome. awesome awesome awesome. thanks, august1!
22:18benkay_so?is the idea with Datomic to just stuff all state-related things into it?
22:18benkay_"just"
22:21aduso where can I learn more about clojure's definition of persistence?
22:25gfrederickstechnomancy linked to a blag of his half an hour ago
22:33tomjackseangrove: great
22:33tomjackI guess it's inevitable that a stacktrace library will do this for a while, and that it's worth it
22:34tomjackit looks like you're going to have to patch clj-stacktrace
22:35tomjackwhile you're at it, https://www.refheap.com/03b864ff16c883ca2370f7838#L-17
22:35aduoooo
22:35aduso persistent=immutable and transient=mutable
22:36adushould have use those words from the beginning
22:36tomjackno.. :(
22:37adutomjack: what?
22:38tomjack"persistent" means more than "immutable" around here
22:38tomjackand "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:39aduto me, that's a distinction without a difference, with an added confusion for most programmers
22:39tos9it 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:39adutos9: right, that's true of all immutable data structures
22:39tomjackif there were no difference, rich wouldn't have had to write the collections
22:39tos9adu: not really.
22:39adubut why do you need a new name for it?
22:40tos9adu: most of the time immutable just means... not mutable :)
22:40tos9it 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:40tos9so that's the main new thing about persistence.
22:41amalloyadu: not all immutable structures are persistent. it won't help for you to keep claiming they are the same
22:42amalloyeg, a copy-on-write arraylist is immutable, but you can't modify it performantly
22:42tos9adu: http://en.wikipedia.org/wiki/Persistent_data_structure is the relevant wikipedia article
22:42tos9in particular clojure's dses are fully persistent
22:43aduoh, from that definition, I wouldn't use the word persistent, I would use the word "Cellular"
22:44adubecause keeping yourself around for future reads has absolutely nothing to do with persistence
22:44aduthat has to do with removing time from the rest of the system
22:45tos9If I remember my data structures class trivia, the word persistent has been used in this context for ~25 years :)
22:45mrowe"keeping yourself around [...] has nothing to do with persistence". really?
22:45aduand if time is removed from the rest of the system, then you have no reference points in which to discuss "persistence"
22:45aduhttp://web.mit.edu/~axch/www/
22:45aduAlexey Radul's PHD thesis talks about it
22:45aduand he doesn't talk about persistence, he talks about Cells
22:45seangroveIs there a way to have cljs read a javascript form and convert it cljs?
22:45aduwhich is why I perfer the term "Cellular" for this kind of thing
22:46seangroveI know I'm talking crazy now, but having trouble with the angular<->cljs bridge
22:46bbloomamalloy: "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:46augustladu: cellular is a pretty good name
22:46aduaugustl: :)
22:46bbloomamalloy: i know you already knew that, but for the other observers, i'll be pedantic :-)
22:46augustlit's pretty descriptive and it's not confusing for the status quo
22:46aduaugustl: have you read Alexey Radul's paper about Cells?
22:47tomjackbbloom: "only a few items" makes the whole issue moot
22:47bbloomtomjack: that's the whole point of arraymap though
22:47tomjackindeed
22:47augustladu: no, I rarely read papers (unfortunately)
22:47tomjackno structural sharing, but arraymap is persistent.. enough?
22:48aduaugustl: you should, it's very inspiring, and completely implemented too: http://groups.csail.mit.edu/mac/users/gjs/propagators/
22:48aduI've been trying to port it to other languages, without much success as of yet
22:50aduaugustl: he defines a Cell as a memory location that remembers its own history, or that learns as values are stored in it
22:51tomjackI guess we don't say arraymap is persistent, huh
22:52augustlisn't it called PersistentArrayMap? :)
22:52tomjackoh, I forgot
22:53aduso 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:53tomjackI suppose it counts as persistent because it metamorphoses when necessary
22:53augustlEventuallyPersistentArrayMap..
22:54bbloomyou 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:54augustladu: many clojure programmers use the word durable for putting stuff on non-volatile storage
22:54bbloombut yeah, i guess technically, full 100% copy on write means persistent as well
22:54aduI've heard some horror stories about COW
22:54augustlbbloom: how is cow persistent?
22:55tomjackthat "persistence" suggests structural sharing is a non-trivial fact I think
22:55augustlah
22:55bbloomyou guys are looking for a formal definition where none exists
22:55adubbloom: Mr. Radul has a formal definition of "Cell"
22:55tomjackthe definition should say nothing about structural sharing - that data structures which satisfy our actual goals often (always?) use structural sharing is interesting
22:56bbloomfull COW is just a degenerate case of structural sharing
22:56bbloomie it shares 0% of the structure
22:56bbloom:-P
22:57tomjackrough rich quote: "persistent data structures are trees"
22:57tomjackproof please! :)
22:58bbloomwhile i'm discussing degenerate cases… lists are just degenerate trees
22:58adubut I understand the benefit of sharing
22:59bbloomin racket '(0 . (1 . (2 . (3)))) => '(0 1 2 3)
22:59adumany languages emphesize that, like Go's slices, OpenCL's subimages, etc.
22:59bbloomadu: slices are not structural sharing
22:59adubbloom: yes they are
22:59bbloomadu: not in the persistence sense
22:59adutrue
23:00bbloomclojure has "slices" in a sense to, see ##(doc subvec)
23:00lazybot⇒ "([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:00tomjack"traversable functor iff functor shapely over lists"
23:00tomjackI wonder what functors shapely over trees are?
23:02aduwell, 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:02tomjackif you can't change it, no
23:02bbloomstructural sharing suggests (again, not a formal definition) that you can cheaply produce a new value without affecting the old value
23:16seangroveHow 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:20tomjack(fn update-later [] ...)
23:20seangroveAh, jesus, thanks
23:20tomjackalternatively, letfn
23:22holohi
23:23auserhey holo
23:26holoauser, hi. thank you!
23:27holois there some kind of "in" operator for clojurescript?
23:27holomacro
23:27auserunfortunately I don't know clojurescript super well
23:28seangroveholo: doseq?
23:31holoseangrove, this "in" operator from javascript is for the purpose of checking if a property is present
23:34holoi 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:34bbloomholo: isn't hasOwnProperty perferrable?
23:34bbloompreferable*
23:35holobblom, thanks that looks like it!
23:36holo(inc bbloom seangrove)
23:36lazybot⇒ 1
23:36holo(inc bbloom)
23:36lazybot⇒ 9
23:36bbloomholo: there's also aget
23:36holo(inc seangrove)
23:36lazybot⇒ 1
23:37holoi see...
23:53bmentgesIm 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:58echo-areabmentges: Structure and Interpretation of Computer Programs