#clojure logs

2012-05-21

00:00emezesketechnomancy: Offhand it doesn't seem like a whole lot of the code
00:00emezesketechnomancy: Most of it looks like it's related to serializing/execing/etc
00:00emezesketechnomancy: The actual HTTP server loop is pretty compact
00:00emezesketechnomancy: Oh, are we talking about for clojurescript? I am
00:01technomancyyeah
00:01technomancywondering what needs to happen to make it work in gjs
00:01emezeskewhat's gjs?
00:06amalloyemezeske: technomancy's been doing gnome extensions, i assume that's gjs
00:06dhermandnolen: ping
00:06emezeskeamalloy: ah, cool, thanks
00:09technomancyyeah, it's gnome's spidermonkey
00:10technomancyI guess it would probably look a lot like the node one
00:10dnolendherman: pong
00:11emezesketechnomancy: I was just about to suggest looking at the node one
00:11dhermandnolen: hey, I was poking around clojurescript design pages.. mostly they just say "no concurrency" -- are there plans to support some of clojure's concurrency constructs at some point?
00:11technomancyemezeske: does that live in a separate project or branch or something?
00:12technomancyemezeske: or maybe I was looking in lein-cljsbuild which is the wrong place?
00:12emezesketechnomancy: I think a branch; you might ask dnolen, I think he was working on that
00:12emezesketechnomancy: ah, yeah, that's in some upstream clojurescript branch
00:12dnolendherman: I think that can/will only happen as much browsers provide supporting constructs.
00:12emezesketechnomancy: I plan to eventually integrate it into cljsbuild, or at least I have a plan to plan to do that
00:12dnolenas much as
00:12technomancyemezeske: is it fair to say lein-cljsbuild currently only targets browsers then?
00:12dhermandnolen: well, it could happen with deeper compilation, but I imagine that would be slow
00:13dnolendherman: yes not really interesting in providing our own concurrency layer.
00:13dhermansure
00:13dnoleninterested
00:13emezesketechnomancy: Sort of. I think some people use it to compile for node, but with no node repl it's not that swanky
00:14dhermandnolen: thx. preparing some slides for a preso about compiling to JS
00:14technomancyemezeske: so it's not an intentional decision?
00:14dhermandon't wanna misrepresent anyone
00:14emezesketechnomancy: No, definitely not. Just limited time/interest on my part
00:14technomancysure
00:14dnolendherman: cool! where you presenting?
00:14dherman"web rebels"
00:14dhermanhttp://webrebels.org/
00:15emezesketechnomancy: I'd love to pull in node/etc support, if someone with a higher interest and knowledge in that area put it together
00:15emezesketechnomancy: As it stands, I just do browser stuff personally, so I'd be slow to add that
00:16technomancyI don't know the first thing about gjs, but I hate all desktops that don't have a repl
00:16dnolendherman: very interested in seeing some sort of task parallel JS thing happening - but not sure how much vendor interest there is in that.
00:16technomancys/desktops/programs/ I guess
00:16technomancyso hopefully my hate can be channeled into something productive
00:16emezeskehahaha
00:17dhermandnolen: we're very motivated, and tc39 has shown interest so far
00:17emezeskethat's a kind of hate that I can get behind
00:17technomancyprograms without repls: completely loathsome.
00:17dhermandnolen: though we haven't yet gotten any other vendors to sign up for a more active role yet
00:18dhermandnolen: er, sorry
00:18dhermantask parallel
00:18dhermanI was thinking data parallel
00:18dhermandnolen: we've got an intern starting this week who'll be working on task parallelism for JS
00:18dhermanbut we don't know yet how it'll pan out
00:19dnolendherman: would be more excited about Workers but clone overhead makes it worthless for building on top of for us.
00:19dhermanI see
00:19dhermanyeah, workers are expensive
00:19dnolendherman: wish there was some way to avoid that, we have persistent data structures.
00:20dhermandnolen: there's an API for transfering ownership but I don't think that helps you
00:20dhermantransferring?
00:20dnolendherman: nope, because we want free reads.
00:20technomancymaybe I'm just tainted by the fact that the main repl-less program I'm stuck using is skype
00:20technomancybut it's just so wretched
00:20technomancywhat really bums me out is that people put up with this crap even though they should know better
00:22dhermandnolen: I have a stupid question. how do you do the memory management of shared persistent data structures? concurrent GC?
00:22dnolendherman: we leave it up to the host JS engine.
00:22dhermanI guess I meant in Clojure, but the answer's obvious: JVM
00:22dnolendherman: but we also provide lower level constructs too.
00:23dhermanyou don't actually have *parallel* data structures in cljs
00:23dhermanoh, you can with copying
00:23dnolendherman: yeah JVM manages them pretty well, not too many complaints in the past 5 years.
00:23technomancyI guess you pick your battles. =\
00:24dnolendherman: we don't need parallel data structures
00:24dnolendherman: that's the whole point of rhickey's reducer work.
00:24dhermanI thought that's what you were talking about
00:24dhermandnolen: you have to forgive my great distance from the clojure world
00:24dnolendherman: we go data parallel the moment we have task parellelism.
00:24dhermanI only have very cursory understanding of the data strucutres and concurrency models
00:25dnolendherman: the latest work is based on Guy Steele's talk on foldl foldr considered harmful.
00:25dhermanoh that's such an awesome talk
00:25dnolendherman: we're ready for data parallelism on any host w/ task parellelism.
00:25dnolendherman: no new data structures required
00:25dhermancan you explain?
00:26dnolendherman: we already have persistent data structures - trees.
00:26dnolendherman: reducer framework is purely aglorithmic. We don't need new data structures.
00:27dnolenjust a way to divide up the work, reduce + combine in parallel. host stuff.
00:27dhermanok, so the reducer framework is all implemented in pure clojure
00:27dnolendherman: yes
00:28dhermanbut I thought you were saying at first, you don't have a way of implementing persistent data structures that could be shared between workers in JS without copying
00:28dhermans/at first/at first was/
00:28dnolendherman: perhaps I'm mistaken, but the copying is imposed by Workers right?
00:28dhermanyes
00:28dhermanexcept for transfer of ownership, but that doesn't give you sharing
00:29dnolendherman: yeah that's horrible. We are giving workers something that doesn't need to be copied :)
00:29dhermanright
00:29dhermanso I was just thinking to myself,
00:29dhermanis there some minimal API we could add, that doesn't require new deep semantic concepts in JS
00:29dhermanbut the sticking point is that it would require concurrent GC
00:29dhermanbasically I was thinking:
00:30dherman1) allocate something in OS shared memory that's owned by one worker
00:30dherman2) allow it to mutate it at will
00:30dherman3) when it's done initializing it, deep freeze it
00:30dherman4) then allow sharing it between workers
00:30dhermanthat's hand-wavy, b/c JS objects don't like being deeply frozen
00:30dhermanthey're all intertwingled via prototype goo
00:31dhermanso I'm not even sure that's coherent
00:31dhermanbut it seems the biggest issue is that it would require concurrent GC
00:33dnolendherman: I know hardly anything about GC - I guess JDK fork/join requires concurrent GC?
00:34dhermanI'd think just JDK threads require concurrent GC
00:34dhermanguess it depends what level concurrency we're talking
00:36dhermanhm. y'know what, I believe we are working on a concurrent GC. maybe this is becoming more standard
00:37dhermandnolen: I'll speak with colleagues about this. persistent, shared data structures would be so awesome
00:37dnolendherman: I'm not sure if it makes any difference but the reducer framework is about being alloation free.
00:37dnolendherman: YES
00:37dnolenallocation
00:39dnolendherman: too bad rhickey isn't around, he'd probably have much more insightful points about all this :P
00:39dhermanno worries, it's late
00:39dhermannow I know there's a freenode channel
00:39dhermanI'll try not to be a stranger
00:39dnolendherman: thanks!
00:40dhermanjudging from his accent, I assume rich lives in NY or NJ, yes?
00:40dnolendherman: yeah NY
00:41dnolendherman: hopefully we can talk about this sooner rather than later - but we'll also all be at StrangeLoop I see.
00:42dhermanyeah, I'll definitely see you then, but drop me a line on IRC any time. I'm on irc.mozilla.org every day, but I'll hang out here too
00:42dnolendherman: will do
00:42dnolendherman: a specific channel?
00:43dhermanirc.mozilla.org: #jslang, #jsapi, #research, #lljs, #rust
00:43dhermanbut doesn't matter
01:17muhoogrr, i foundd the limit of the compojure-route approach. they don't get assoc'ed into a map, they just get conj'ed onto the end of a list.
01:18muhooso it's kind of a pain to reload them.
01:19wkmanirejoin #refheap
01:20wkmanireI swear erc eat's my characters if I don't wait for it to load.
01:21muhoovector actually.
01:22wkmanireeats* bleh
01:23banseljajhey wkmanire
01:24wkmanirebanseljaj: Good morning ~Doctor
01:24banseljajI actually went a head and made an experimental linux distro off of Open Suse. :D
01:25wkmanirebanseljaj: Why'd you have to use Suse?
01:25wkmanireI don't know Suse very well.
01:25banseljajNo particular reason apar tform the fact that it gave a convenient tool to build distros in the cloud.
01:25banseljajwkmanire: it's just like RHEL
01:26wkmanireI also don't know RHEL.
01:26wkmanireI use Debian and Debian variants.
01:26wkmanireCurrently using Linux Mint.
01:26banseljajI (heart) debian
01:26banseljajBut it was an experiment. just to see what would be needed.
01:26wkmanireI see.
01:27wkmanireDoes it work?
01:27banseljajCurrently it only has packages.
01:27banseljajI just finished building it.
01:27banseljajI'll know by the end of today
01:27wkmanireI hope it does work.
01:27wkmanireI really do think this is a great idea.
01:28banseljajYeah.
01:28banseljajIt would require a truckload of work though
01:28banseljajSuse doesn' have leiningen, for example
01:28banseljaj:(
01:28banseljajSo i'll have to build an rpm.
01:28wkmanireWell that doesn't mean you can't install it.
01:28banseljajNot from a repo, no.
01:29wkmanirebah. Why? You're in control of the distro, just pre install it.
01:29banseljajwkmanire: I'll probably make an rpm of lein. :D
01:29wkmanireBut to install it you just run a shell script
01:29wkmanireand it does the rest.
01:29banseljajIf it doesn't work, i'll just use Arch.
01:29banseljajwkmanire: Yup.
01:39ambrosebsgfredericks: might be interested in a sample of the types I devised for rest/next/first/conj https://gist.github.com/2760648
01:53muhoodebian is pretty awesome. though technomancy found this fascinating distro-overlay that is kind of like immutable packages
01:53muhooit's like if you took clojure structural sharing, couchdb revs, and git, and made a package manager out of them
01:54raeknix?
01:54clojurebotnix is a purely functional package manager exhibiting many similar characteristics to Clojure's persistent data structures or git commit trees: http://nixos.org/nix/
01:56muhoothat's the one
02:07y3dihttps://twitpic.com/show/large/9nild1 -- guess God really does use lisp
02:07lnostdalhi guys, is it possible to determine whether a binding was conveyed automatically (1.3+) to a thread (agent/future) or bound explicitly within that thread?
02:07ivany3di: haha
02:08muhooexceptions in the ns macro are fun fun fun
02:08muhooit's like 20 pages
02:09ivansomeone should make an Clojure traceback decoder with every mistake you could make
02:09ivanforgetting the argument vector sure leads to an interesting one
02:10muhooyep, some typo or another
02:10michaelr`y3di: the first thing that came to mind: "what is this? the horns of devil?"
02:11ambrosebsivan: relevant: http://dev.clojure.org/jira/browse/CLJ-157
02:22michaelr`ambrosebs: why (if(if instead of (if (not ?
02:24ambrosebsnot isn't bound at this point
02:24michaelr`oh
02:24michaelr`:)
02:24ambrosebs:P
02:26ambrosebsmichaelr`: It's probably because we don't have "and" here either
02:33lnostdalam i the only one who thinks automatic binding conveyance is a bad idea? .. or, i really do not understand how others cope with it (db connections long ago closed hang around across agents etc. etc.)
02:49michaelr`lnostdal: binding conveyance? can you point at a sample code?
02:54lnostdalyes, michaelr` https://www.refheap.com/paste/2813
02:54lnostdalsomething like that
03:07lnostdalit's driving me nuts ..
03:12amalloylnostdal: to be fair, lack of binding conveyance also drives people nuts somewhat regularly
03:12lnostdalyes, but whitelist ...
03:12lnostdalor just, something
03:14michaelr`lnostdal: i don't see what's the problem in that code? :)
03:14lnostdalmichaelr`, k
03:15michaelr`if i understand correctly the threads do not share state here, which is great..
03:15lnostdalmichaelr`, that's not the issue
03:16lnostdal(in a sense the problem is exactly the opposite of what you say; threads _do_ share too much state, by default)
03:17michaelr`ok, in your example it's not a real db connection..
03:17lnostdalright
03:18lnostdalif it was, the operations in the agent would sometimes work and sometimes "mysteriously" fail
03:18lnostdalracy
03:18lnostdal..sometimes people mess up you know
03:19michaelr`how can this work otherwise?
03:19lnostdalit shouldn't
03:19lnostdalit should fail predictably; every time
03:19lnostdalthat's the problem
03:19lnostdalsame with open files etc. too
03:20lnostdale.g. (with-open ...)
03:20michaelr`what happens here is that you close the connection while another thread is still using it, right?
03:21lnostdalyes
03:21lnostdaltry-finally type stuff
03:22michaelr`the correct code should wait for the thread to finish before closing the connection.. so how do you propose to solve this automatically?
03:22amalloyhow does with-open have anything to do with bindings conveyance?
03:22lnostdalpretty common thing to do .. most DB layers i've seen in lisp use a *conn* dynamic var for context, with a try-finally (or unwind-protect and similar) design
03:23lnostdalamalloy, nothing; just to make michaelr` understand that the connection closes in this particular example
03:23lnostdalamalloy, well, nothing except with-open uses bindings .. but whatever
03:24amalloyno it doesn't. it uses a let
03:24amalloywhich, okay, you can call lexical bindings, but those aren't relevant to "bindings" in this context
03:24lnostdalit does? .. hm, yes it does .. then never mind .. i saw "binding" in the definition
03:25lnostdalok, but the DB lib uses `binding' .. not `let' .. perhaps that's the problem
03:25lnostdalnot sure what others do .. using java.jdbc here .. do they explicitly pass around the context or the connection?
03:34lnostdalnope, that wouldn't make sense either i think .... *shrug*
03:46muhoothat's kinda weird, i never knew you could do map destructuring in reverse
03:46muhoolike (defn barg [{baz :params}] baz)
03:47muhooinstead of (defn barg [{:params baz}] baz)
03:52tomojonly the former works
03:52tomojso I would call that "forward", not "reverse"
03:54tomojit makes sense to bind the value associated to one keyword in a map to two different variables, it does not make sense to bind a single variable to the values associated with two different keywords in the map
03:54tomojso the variables are the keys in the destructuring map form
04:04muhooactually, they both seem to work
04:04muhoowhich is what i found surprising
04:05muhoooh wait, nm, i see
04:07muhooit's kind of symmetrical, ##(let [{bar :baz} {:baz "bar"}] bar)
04:07lazybot⇒ "bar"
04:10tomojI guess if you call building data structures "structuring", then it makes sense
04:11tomoj{:baz "bar"} structures and {bar :baz} destructures
05:00ro_stcemerick: i'm a little confused about how i'd use friend to secure a json rest api
05:00cemerickro_st: HTTP Basic over SSL is the most common / easiest option.
05:01ro_sthttp basic? could i use that with a mysql user database?
05:01ro_stwhich has salted-hashed-passwords?
05:02cemericksorry; what does mysql have to do with it?
05:02ro_sti want to authenticate users with my json service
05:02mittchelHey
05:03ro_stand then have that auth information be a part of the request info used in subsequent json calls
05:03cemerickro_st: well, what you use to verify credentials is entirely up to you; friend doesn't care whether that's in mysql, couchdb, in memory, or a flat file.
05:05cemerickro_st: OK, it sounds like you're calling this API from javascript, in a browser then?
05:05ro_styes
05:05cemerickIn that case, presumably the user is already logged in with a session?
05:05ro_styes, which will also be a json call
05:06cemerickso, you just want the provided interactive-form workflow
05:06cemerickjson is a format, not a calling convention or something.
05:08ro_stok, i'll start digging there. your samples are compojure based. i'm using the webmachine based Bishop library from cmiles. i guess friend would wrap my method that calls bishop/routes?
05:10cemerickro_st: yup, authenticate is just more ring middleware, so it should compose with bishop just fine.
05:13Mittch Are you guys recieving this message? Tried to build an IRC client in clojure :o
05:13ro_styup, we can see you
05:14Mittch Weird stuff I have to type: PRIVMSG #clojure : mymessage and it's not even a private message
05:15ivanthat's how IRC works
05:15Mittchro_sti: Can I try to message you?:P
05:16ro_stsure
05:16mittchelDid it work? lol
05:17mittchelRunning 2 clients now hehe
05:20Mittch /me lol
05:20mittchelfails haha
05:21mittchelthere we go
05:22ro_stgah why does wildcard ssl cost so damn much? $200 a year is stupid
05:48zawzeyhmmm, trying to read a byte[] array from a java lib, but i keep getting truncated data at the 64K (ie: 65536) limit , how do i get arround it
05:52samaaronzawzey: what are you reading into?
05:53zawzeysamaaron: trying a variety of methods, BufferArrayInput, clojure.java.io/reader
05:53samaaronalso where are you reading from?
05:53samaarona file?
05:54zawzeyfrom nutch: http://nutch.apache.org/apidocs-1.2/org/apache/nutch/protocol/Content.html, the getContent() method
05:55zawzeyi'm to output the read content into a file on the clojure side, but it's getting truncated, so i'm trying to isolate where the issue is
05:55samaaronok, well this is somethign I've never done - so I'm just shooting blind here
05:55samaaroni did a quick google and this popped up: http://www.coderanch.com/t/277584/Streams/java/Max-Size-Byte-Array
05:55samaaronperhaps it's do do with flushing?
05:58zawzeysamaaron: hmm, don't think that's the case, but let me dig a bit into the ByteArrayInputStream.
06:08zawzeyOkay, fwiw, it's nutch's problem, it has a 64K limit setting by default. The documentation for nutch is quite poor to be honest
06:33ljosIs it just me or is it really irritating that `str` and `print` does not always force calculation of lazy sequences? I don't really understand when this behaviour would be wanted.
07:04neotykhello everyone!
07:07samaaronneotyk: howdy!
07:08neotyksamaaron: hello clojurepunk
07:09samaaronhaha
07:09neotykI'm looking for some early feedback on WebSocket support in http.async.client
07:09neotykif you have time please tell me what you think of https://gist.github.com/2761440
07:24fliebelneotyk: Do you have something built-in to put it in a queue/pipe thing rather than a callback?
07:25neotykfliebel: not yet, would you like to have a lazy-seq for reading received stuff?
07:25fliebelneotyk: I don't know... I'll have to read the arguments for not using lazy seqs for pipes/queues
07:26neotykfliebel: lamina/channel ?
07:27fliebelneotyk: just anything "statefull", java.util.concurrent.BlckingQueue could also do the job.
07:47timvisher,(= (long 1) 1)
07:47clojurebottrue
07:47hyPiRionAny form of integer is equal to another.
07:47timvisher,(= 1 (read-strng (pr-str (long 1))))
07:47clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: read-strng in this context, compiling:(NO_SOURCE_PATH:0)>
07:47timvisher,(= 1 (read-string (pr-str (long 1))))
07:47clojurebottrue
07:48timvisherhmm
07:48timvisherhyPiRion: that's my expectation too yet i'm seeing a different behavior in my program at the moment
07:48hyPiRion,(= (long 1) (int 1) (byte 1) (short 1) 1 1N (numerator 1/2))
07:48clojurebottrue
07:48timvisheri'm seeing if i can get it to reproduce
07:48timvisher,*clojure-version*
07:48clojurebot{:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}
07:48timvishermaybe it's because i'm on 1.2?
07:48hyPiRionWhat version of clojure do you have?
07:49timvisheri'm serializing an object to a file and then reading it back in
07:49hyPiRionProbably. I had issues that BigInteger doesn't equal normal integers
07:49timvisherthe object has a long `1` in it, but when i compare it to another `1` in a test, it fails
07:49hyPiRionFor instance, try this in your repl ##(#{2} (denominator 1/2))
07:49lazybot⇒ 2
07:50hyPiRionIt will return nil in clojure 1.2
07:50timvisherwhat does that expression even do?
07:50timvisheri'm not used to seeing sets as a function
07:51hyPiRionSets are just hash maps where the key is also the value
07:51timvisherand you're correct, of course.
07:51timvisherah, forgot that implementation detail
07:51timvisherhmm, might be time to bite the bullet and upgrade then
07:51timvishersee if that clears this up
07:51hyPiRionDo you use = or do you use == for comparing the numbers?
07:51timvisher=
07:52timvisherdon't believe i've ever had an occasion for using == yet
07:52hyPiRionAh. Well, 1.2 is kind of weird with reading numbers and differences between e.g. BigIntegers and Integers.
07:52timvisherso many of the gotchas in clojure that i see are related to numbers
07:53timvisheri wish the jvm had done a better job of it. hard problem, though, i suppose
07:54hyPiRionIt's better in 1.3 though, and I don't think they made any number-changes to 1.4
07:57fliebeloh, same problem again. It seems since 1.3, = is not the richt tool to compare all numbers.
07:57fliebel== works
08:01hyPiRionfliebel: That's just weird.
08:02fliebelhyPiRion: I know... I only know that some number types don't compare to others with =, while they do with ==. Don; know why. Probably optimization.
08:05hyPiRionfliebel: Yeah, and it's doomed to make people confused.
08:07fliebelI agree... I'm trying to figure out what's going on
08:10fliebelhyPiRion: so, = calls number/equal, while == calls number/equiv
08:11fliebelhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Numbers.java#L205
08:11fliebelhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Util.java#L23
08:14fliebelthis means that for 2 numbers to compare using =, they need to be of the same type.
08:14fliebel&(= 2 2.0)
08:14lazybot⇒ false
08:14fliebel&(== 2 2.0)
08:14lazybot⇒ true
08:15fliebelso, it is rather simple, == does a lot more work.
08:16hyPiRionfliebel: Well, it's not same type either
08:16hyPiRion&(= (Long. 2) (BigInteger. "2"))
08:16lazybot⇒ true
08:17fliebelwut...
08:17hyPiRionyeah.
08:18fliebelI'm pretty sure it's handled in clojure.lang, number, though: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Util.java#L28
08:19hyPiRionYeah, most likely.
08:19dbushenkohi all!
08:19fliebelhere: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Numbers.java#L213
08:19dbushenkodoes anyone have troubles while embedding the clojurescript repl in a web-page?
08:19dbushenkoI'm trying the example from the clojurescript bundle, proceeding step-by-step
08:19dbushenkoand the repl simply doesn't connect to the index.html
08:20dbushenkowhile accessing http://localhost:9000 does the job, and the repl connects
08:20dbushenkowhat could that be?
08:21hyPiRionfliebel: So if they're the same category (integer, ratio, float) they're checked for equality, but if they aren't, they are different types.
08:21fliebelyea...
08:22hyPiRiondbushenko: I wish I could help you, but unfortunately your guess is probably better than mine.
08:22hyPiRionTutorials and manuals usually helps, though.
08:22dbushenkoyes, that's what I'm doing: I'm trying the samples and tutorials
08:22fliebel&(clojure.lang.Numbers/category 3)
08:22lazybotjava.lang.IllegalArgumentException: No matching method: category
08:23dbushenkobut no idea why I can't connect to a web-page..
08:23fliebel... why doesn;t that work.
08:25hyPiRionfliebel: here's the source, though https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Numbers.java#L978
08:25fliebelhyPiRion: I now, but I should be able to call it, right?
08:27hyPiRionfliebel: well... yes
08:27xeqiits package level
08:28hyPiRionoh, durr.
08:28fliebelxeqi: meaning?
08:28hyPiRionit's not public, it's blank
08:28fliebel:(
08:28hyPiRionSo you can only call it from the package it's defined in.
08:28fliebeloh, that package level
08:29xeqior you have to wall hack it
08:31timvisherhyPiRion: 1.4.0 fixes it, thanks
09:17kzar,(partition 100 [1 2 3])
09:17clojurebot()
09:17kzarCan anyone explain that? ^^ (I want it to return '((1 2 3)) )
09:18hyPiRionkzar: try partition-all
09:18hyPiRion,(partition-all 100 [1 2 3])
09:18clojurebot((1 2 3))
09:18hyPiRion,(partition-all 2 [1 2 3])
09:18clojurebot((1 2) (3))
09:18kzarhyPiRion: Nice, thanks
09:18hyPiRionYou're welcome
09:47bhenryanyone else have problems with clojurescript keyword lookup in ie8?
09:49bhenryhttp://imgur.com/vnmDJ results of (js/alert (apply str (keys user))
09:53point9When I run repl from lein, the var "realized?" couldn't be found. Why is that?
09:53neotykbhenry: try (js/alert (apply name (keys user)))
09:54neotykpoint9: it must be old clojure, before 1.4
09:54point9oh...
09:56bhenryneotyk, that's not my point. (:username user) fails in ie8, because of the slash
09:56uraimoto upgrade from prev3 to prev4 do i need to do something else other than downloading the new lein script?
09:57uraimoops, wrong channel :)
09:57neotykbhenry: what slash?
09:59bhenryneotyk, did you look at the way the keywords are alerted in the ie alert box? :/keyword as opposed to :keyword in chrome
10:00neotykbhenry: keywords and symbols are strings in cljs, they just start with magic
10:01bhenrywell then can you tell me why (:username user) doesn't work in ie8, but does work in all other browsers.
10:02neotykbhenry: no idea about IE8, sorry
10:03neotykbhenry: if you would use (get user key) would it work?
10:03bhenryi'll try. gotta go for now
10:08bderooms_is anything optimized in the clojure sequences?
10:08bderooms_such as getting the last..
10:08bderooms_or is that O^n
10:13si14guys, where I can find any example of web-gui on ClojureScript?
10:13bobrybderooms_: depends on the sequence I guess, it's clearly O(n) for lists
10:18hyPiRionbderooms_: constant time for vectors. Reverse is also constant time.
10:18hyPiRion(for vectors, that is)
10:20chouserrseq, not reverse
10:21madsyIs there a dynamic var I can change so swank doesn't flood me with text when I run a function that returns a huge sequence?
10:25tmcivermadsy: looks like *print-length* might do what you want.
10:26madsytmciver: I just found it on clojuredocs too. Thanks :)
10:29tmcivermadsy: fyi: apropos is good for finding that kind of info. I ran (apropos 'print) in the repl.
10:38bobrydid anyone get a stack overflow, while compiling cljs?
10:40balintwanted to try the new reducers library, cloned the repo, built the jar with mvn install and then got this when requiring the reducers:
10:40balintCompilerException java.lang.ClassNotFoundException: jsr166y.ForkJoinPool, compiling:(clojure/core/reducers.clj:56)
10:41balintdo I need a certain version of the JVM for that to work?
10:41balintI have 1.6.0_31
10:42hyPiRionI've seen some commits in which they say something about 1.7, though I'm unsure whether that leaves 1.6 incompatible.
10:43hyPiRionLet me see.
10:43pipelinebalint: look at the class name: jsr166y. it needs something that is a jsr proposal and not actually bundled with java. looks like this - http://g.oswego.edu/dl/concurrency-interest/
10:43fliebelHm, I read it's a weird dependency problem.
10:44fliebelthe jsr thing is declared as an optional dep, iirc
10:46balintpipeline: thank you, that fixed it
10:47balintin fact, I used the clojure-1.5.0-master-SNAPSHOT-slim.jar and so that's why the extra dependency needed to be declared explicitly
10:57TimMcclojure 1.5? o.o
10:57TimMc,*clojure-version*
10:57clojurebot{:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}
10:58TimMcOh, huh. Didn't realize 1.4 had been released.
11:00S11001001TimMc: don't worry, not too much changed
11:01fliebel&(:qualifier *clojure-version*)
11:01lazybot⇒ nil
11:01fliebel&*clojure-version*
11:01lazybot⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}
11:04S11001001'course you would have known this following the presentation about 1.3/1.4 changes at the boston clojure a few months ago in Newton :)
11:11TimMcYeah. sounded like mostly bugfixes.
11:12TimMcS11001001: Did you make it to the one at Basho? I really liked the talk on Kiln.
11:12S11001001yeah
11:12S11001001I sat next to the projector
11:13hyPiRionYou lucky americans.
11:15TimMchyPiRion: Well, I only get out to Clojure stuff in my own city. NYC would be easy to get to, Durham, NC would be annoyingly far (for the Conj), but I've only been to the west coast twice in my life.
11:16hyPiRionTimMc: Oh. I'd probably go to any (sufficiently large) Clojure thing within Europe if we had something large here.
11:17hyPiRionBut that's probably because there's no supply for these things over here, at least not in Norway.
11:18S11001001I do hope that Basho does indeed offer the space for more meetings
11:27TimMchyPiRion: There's EuroClojure, right?
11:28TimMcAlso, I saw a really awesome job posting in Helsinki for controlling industrial robots in Clojure.
11:28TimMcNow that's Finland, but it's still in your neck of the woods.
11:35metajackthat's zenrobotics i think. i walked past their building whenever i was in Helsinki
11:40TimMcSO. COOL.
11:41gfrederickswhy does clj-http require a :length parameter for input-stream bodies?
11:41TimMcWhat's the catch, besides being in Finland?
11:42TimMcOMG: "Some people see a problem and think "I know, I'll use Java!" Now they have a ProblemFactory."
11:42muhoogfredericks: ram allocation?
11:42muhoobytaarray allocation, specifically, i'd guess
11:42dakronegfredericks: because InputStreamEntitys for Apache require the length of the stream passed in
11:43metajackTimMc: no idea. I was working for another Finnish company, but remotely.
11:43metajackHelsinki is nice, but winter is awful
11:43gfredericksdakrone: so there's no way to stream data without knowing the length up front?
11:43dakronegfredericks: https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/entity/InputStreamEntity.html
11:43metajackthe constant darkness was super depressing
11:43TimMcYes, that would be my concern.
11:43metajacki visited in december and basically no one ever did anything. everyone just stayed indoors and was sad.
11:43dakronegfredericks: I can look into it, but right now there's not
11:44hyPiRionTimMc: Oh, there is? I'll check it out.
11:44gfredericksdakrone: I think I can work it out, no worries
11:44dakronegfredericks: if you find a way, patches welcome ;D
11:46hyPiRionand metajack: It's horribly dark in Fennoscandia.
11:47gfredericksdakrone: do you know for sure that HTTP allows it?
11:47hyPiRionI suppose it's colder in Finland though.
11:47dakronegfredericks: I don't for sure, it may actually require length when sending data, another thing to add to the TODO
11:48gfredericksdakrone: I mean the HTTP protocol
11:48dakronegfredericks: yea, that's what I meant also
11:48gfrederickser...the HTT protocol?
11:48TimMcHTTP allows for streaming
11:48gfredericksTimMc: without length, right?
11:48TimMcHas to.
11:49gfredericksokay thought so
11:49gfredericksTimMc: in a request, right?
11:50muhoogfredericks: dakrone: transfer-coding = "chunked", perhaps? http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html
11:52wkmanireGooooood morning.
12:04gfrederickswkmanire: morning?? but in time zone X it is actually a bad morning!
12:04wkmanirenah
12:04wkmanireToday is an awesome day.
12:04wkmanireI woke up and everything.
12:04TimMcwkmanire: I think it is already tomorrow some places.
12:05gfredericksman it would be weird if moods were globally synchronized
12:05wkmanireI can't imagine all 3 billion women on the rag at the same time.
12:05wkmanire:(
12:06pipelinewkmanire: shame on you
12:06wkmanirepipeline: :D
12:06TimMcpipeline: For poor imagination?
12:06wkmanireI'm shameless
12:07pipelineif no one speaks up, sexist bullshit on irc self-perpetuates
12:07pipelineso, uh, shame. picture the finger rubbing motion.
12:07wkmanirenothing sexist about that.
12:07wkmanireit's a well known fact.
12:07lucianplenty sexist about that
12:07wkmanireI just got in trouble with my lady because we ran out of rice.
12:07gfredericks(inc pipeline)
12:07lazybot⇒ 1
12:07pipelinewkmanire: well, this is also why we have an /ignore function. get bent
12:07wkmanirepipeline: Feel free :)
12:08kzarWow, this is the first time I've seen anything like this in #clojure
12:08TimMcWomen in the same apartment seem to synchronize, but extended social networks don't. I imagine birth control pills are the reason (not allowing drift.)
12:09TimMcpipeline: Were you reacting to "on the rag" or the notion that menstrual cycles (statistically!) affect mood?
12:09foxdonutplease stop this topic now. thank you.
12:09TimMck
12:09wkmanireMust be monday morning.
12:10wkmanireday/evening
12:10geoffeglet's talk about something like: beer!
12:10TimMcwkmanire: nooooo, that's how this got started
12:10TimMcgfredericks: Wait, this is about HTTP *request* length?
12:10si14why there are so many warnings when one builds Domina?
12:10si14WARNING: Use of undeclared Var domina/.DomContent at line 459 /home/si14/repos/domina/src/cljs/domina.cljs
12:10wkmanireTimMc: I'm trying to get back on topic and do something recursive.
12:10gfredericksTimMc: yep
12:11gfredericksTimMc: forwarding a request
12:11TimMcFor some reason I was thinking about responses. ANyway, you should be able to copy the headers, yeah?
12:12gfredericksTimMc: content-length seems to be nil :/
12:13muhoowkmanire: well, to do somthing recursive, do something recursive :-)
12:14wkmaniremuhoo: It's not as easy as you might thing you might think.
12:17tmcivergfredericks: spec says (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13) Content-Length *should* be set, not that it *must* be set so perhaps this means clj-http is being overly restrictive?
12:17dakronehmm, I wonder if I could get away with putting null for the length of the input stream
12:17gfredericksit's a primitive long isn't it?
12:17wkmaniretmciver: I've had chrome reject responses for having an incorrect content length.
12:18wkmaniretmciver: It was for JSON response.
12:18wkmanirea JSON response*
12:19dakroneyes
12:31gfredericksis there a standard way for lein-ring to reload files on changes?
12:31weavejestergfredericks: It does that by default
12:32weavejesterYou can turn it off by setting the :middleware option
12:33gfredericksweavejester: well I've wasted a million years of my life by not asking about that earlier
12:33weavejesterThough I'm going to change that a little in the next release so there are :auto-reload and :auto-refresh options
12:33weavejestergfredericks: Ohhhh :)
12:34weavejesterI did mention it in the readme, but it's only a sentence
12:34gfredericksweavejester: and/or reading the readme
12:35AeroNotix`
12:35gfredericks_
12:37pjstadig|
12:38goodieboyanyone know of an emacs plugin that will allow me to see all of the callers of a given function?
12:38gfredericksswank-clojure has a grep-based version of that
12:38gfredericksit is mentioned in the swank-clojure readme
12:38goodieboygfredericks: cool ok, i'll check it out. thanks!
12:40technomancyit's not very good
12:40technomancyI guess the readme should also mention that fact
12:42S11001001ah well, finding callers of a function is halting problem :)
12:42gfrederickstechnomancy: either that or annotate all the other features with "it's very good"
12:42technomancygfredericks: that would work
12:43gfredericksS11001001: is it? the question isn't "will the function ever get called if I run the program"
12:43nDuffHow can one get the JDK's tools.jar into the classpath when using leiningen?
12:44S11001001gfredericks: (defn do-something [f g h] (if (f) (g) (h))) (do-something some-f some-g some-h); who calls some-g or some-h?
12:45gfredericksS11001001: I guess for these purposes "mentioning" is as good as calling
12:45ibdknoxyou can only find usages reliably
12:45S11001001aye
12:46technomancyibdknox: by piggybacking on the var's cache of usages it uses to make recompilation trickle down?
12:47ibdknoxtechnomancy: you can do it without loading the code if you want to
12:48technomancyI haven't looked into it, but when I heard about how the non-dynamic-by-default changes to vars were going to be implemented, I figured the same mechanism if it were exposed would be wonderful for tooling
12:48technomancyI don't think the static analysis approach would be very reliable
12:48technomancytoo easy to confuse it with macros
12:48hiredmanvars are stored in fields on fns
12:49ibdknoxhiredman: hm?
12:49ibdknoxas in all the vars a fn uses?
12:49hiredmanfns have a "constant pool" of fields
12:49hiredmanyes
12:49ibdknoxoh neat, I didn't know that
12:49technomancyibdknox: that's the only way you can recompile a defn and have the changes work for code that's already compiled.
12:49ibdknoxright
12:50hiredmanthe constant pool holds various things, vars, different kinds of literals
12:50hiredmantechnomancy: that is not true
12:51hiredmanI recall rich's description of having a sort of checkpoint mechanism, but as far as I know that isn't there
12:51hiredmanfns still deref the vars everytime
12:52technomancyI thought that changed in 1.3 since it wreaked havoc on hotspot's inlining
12:52hiredmannope
12:52hiredmanthe only change was the removal of the sort of "is bound?" check in the general case
12:53technomancyhuh; so the deref itself could still be inlined; that's cool.
12:53hiredmanthe emitted code doesn't actually call deref
12:54hiredmanit calls .getRoot or .getRawRoot depending if the var is dynamic or not
12:54hiredmanhuh
12:54hiredmanno there is no .getRoot anymore
12:54technomancygetRoot will never respect binding though
12:54pjstadigyeah a non dynamic var is compiled directly to a call to .getRawRoot
12:55pjstadigit doesn't even bother with the thread locals
12:55pjstadigwhich allows hotspot to inline it
12:55technomancybut it's the moral equivalent of a deref anyway
12:55pjstadigwell deref would check the thread locals though?
12:57technomancysure, I mean it's just an optimization on deref since it knows it will never have to check thread locals
12:59pjstadigtechnomancy: i guess i don't follow you
13:00technomancyI guess it's just a matter of how much artistic license the term "moral equivalent" grants you =)
13:00clojurebotLicenser is the man who puts licenses on everything
13:13wkmanireWell hell. I guess pipeline went ahead and /ignored me. :/ I tried apologizing privately. So here's a public apology because I'm feeling guilty. I apologize for offending anyone with my comment from earlier. While I don't agree that it was sexist I do agree that perhaps #clojure is not the best venue for that sort of conversation. So, yeah. Foot in mouth.
13:14ibdknoxtechnomancy: is there a way for me to force a lein project to use a different version of clojure? I'm setting the dependency correctly but always getting 1.3.0
13:15banseljajwkmanire: Did I miss something?
13:15technomancyibdknox: one of your dependencies is being a jerk and claiming to not work with newer versions; `lein deps :tree` should track it down
13:16wkmanirebanseljaj: I made a comment in poor taste and offended at least one person.
13:16technomancyibdknox: once you find it, submit a bug report with that lib; in the mean time use :exclusions to shut it up
13:16wkmanirebanseljaj: No, you didn't miss anything.
13:16ibdknoxtechnomancy: great, thanks
13:17wkmanirebanseljaj: Did you get your Suse distro working?
13:17banseljajwkmanire: Yeah. It's working at a basic level.
13:17wkmanirebanseljaj: So you boot it up and you have a full functionaly (pardon the pun) clojure dev environment ready to rock and roll?
13:17wkmanirefunctional*
13:18foxdonutwow, SuSE is still going?
13:18banseljajI'm trying to see what other softwares are needed and setup the basic dev envrironment
13:19banseljajwkmanire: Not so fast. :P By "working", I mean it boots up, and you can do regular linux stuff on it. You can try it out. I haven't yet tried putting leiningen on it.
13:19banseljajfoxdonut: apparently so. :D
13:19banseljajAny experienced clojure dev that wants to test or contributes shell scripts is welcome. :)
13:19technomancybanseljaj: do you have any experience with rpm packaging?
13:20foxdonutbanseljaj: heh. last time I used SuSE, it came on CDs and I was on 56k modem :)
13:20banseljajtechnomancy: I'd say beginner level experience. Plus, I learn fast. And I was actually looking into making a leiningen rpm. :)
13:21banseljajfoxdonut: that was true for me too until yesterday. :D
13:21technomancybanseljaj: would you submit it upstream or just use it for your own purposes?
13:21foxdonutbanseljaj: what were you using before yesterday?
13:21banseljajtechnomancy: I'd probably set up my own repo.
13:22banseljajfoxdonut: I was and still use debian based systems.
13:22technomancybanseljaj: suse doesn't use yum, does it?
13:22banseljajI am just developing a clojure dev solution using OpenSUSE
13:22banseljajtechnomancy: Packman
13:22banseljajit *can* use yum.
13:22technomancyo_O
13:22banseljajIs there a problem?
13:22technomancyI thought that was arch?
13:23Bronsathat's pacman
13:23foxdonutso did I
13:23banseljajtechnomancy: that's pacman. Without the 'k'
13:23banseljaj:D
13:23technomancygeez
13:23foxdonutpff!
13:24foxdonutTOSFYPMN
13:24technomancyit would be nice to offer a repo, but rpm distros are pretty fragmented from what I understand.
13:24foxdonutthink of something else for your package manager name!
13:24technomancyeveryone invents their own repo format
13:24banseljajI am currently looking into a full small footprint hand-crafted linux.
13:24banseljajI'd probably use debs
13:24banseljajdebs are cool. :D
13:24banseljaj</11th doctor>
13:24technomancyyeah, this is the first time I've heard the word SuSE in years
13:25technomancywell anyway, some people might find a raw rpm file useful even if it's not in a repo
13:26technomancybanseljaj: so if you end up with something, could you add it to the packaging page of the wiki?
13:26banseljajtechnomancy: that would have been my first move. :)
13:26technomancycool
13:26wkmaniretechnomancy: Really? I see it mentioned all the time in the couple of linux magazines that circulate in Vegas.
13:26technomancyobviously I don't travel in the right circles
13:27banseljajtechnomancy: are you a CEO?
13:27wkmanireBut I know what you mean. The last time I tried SUSE, Lindows was still popular.
13:27hiredmando linux magazines still circulate anywhere else in the country?
13:27technomancyhaha; no
13:27banseljajIf not, then yes, you don't. :)
13:27banseljajSUSE is only corporate now.
13:27technomancyall my knowledge of distros comes from http://lein-survey.herokuapp.com/results
13:28banseljajI only saw it running as a special instance on AWS
13:28technomancyaccording to that survey there are 23 users of leiningen on rpm-based systems, but I didn't ask if they were using yum or some other system
13:31banseljajtechnomancy: That's distroist.
13:31technomancyit's OK; I also ignore Arch
13:31technomancybecause apparently Arch users get grumpy if things are too easy.
13:32tmciverbanseljaj: some of his best friends are distros.
13:32banseljajlol
13:32banseljajI probably would roll ut a complete new distro, but it's too much work for a single man.
13:32banseljajs/ut/out/
13:35pipelinetechnomancy: for RPMs you can pretty much just offer RHEL and ignore the others
13:36pipelinetechnomancy: Fedora is desktop users. They'll work it out in their home directories. SuSE is a much smaller userbase. Everything else is inconsequentially small.
13:38wkmanirebanseljaj: LFS?
13:38banseljajwkmanire: Yeah.
13:38wkmanirebanseljaj: I liked the idea of LFS but I want to be able to use a package manager like aptitude.
13:39wkmanirebanseljaj: If you can use aptitude on your system then you're basically running debian. At least from my point of you.
13:39muhooif i use lein2 check, all that aot stuff isn't going to hang around, interefering with other things, is it?
13:39banseljajI'm pretty sure that can be arranged. that's what I have in mind.
13:39banseljajfor now, I think someone other than me should check the SUSE install.
13:40technomancypipeline: cool; thanks for the confirmation
13:41technomancypipeline: how much overlap is there between rhel and fedora though? considering there's no native bits I wouldn't be surprised if the same package could be used verbatim on both
13:41muhoopipeline: debian is "inconsequentially small"? i dunno, seems pretty widespread to me.
13:41pipelinemuhoo: talking about rpm distributions
13:41pipelinetechnomancy: for practical purposes, none. RHEL trails fedora by 2+ years, but fedora releases are only supported for a year or two at a go.
13:42pipelinetechnomancy: it DOES help to take rpm specfiles from old fedora releases and adapt them for new code on RHEL
13:42pipelinetechnomancy: the problem is actually worse for "non-native" bits. packaging standards for python, java etc evolve too quickly inside fedora
13:42technomancypipeline: when your dependencies consist of a JVM and rlwrap trailing by two years seems like no big deal though
13:43technomancyJava's rate of evolution makes RHEL look fast =)
13:43pipelineyou misunderstand me
13:43pipelinethe packaging standards
13:43pipelinechange rapidly
13:43technomancyoh, sure
13:43pipelinefedora is in many ways a test bed for new ideas in RHEL
13:43banseljajtechnomancy: That webapp. The lein survey. that's pretty tiny compared to other frameworks I have worked wiht.
13:43pipelineso fedora picks up and abandons two or three packaging standards for non-C items in the time between RHEL releases ;)
13:43technomancyheh
13:43technomancybanseljaj: oh, did you check out the source?
13:44technomancybanseljaj: it's pretty simplistic; only 3 endpoints really
13:44banseljajtechnomancy: Yeah. I'm looking at it right now.
13:44banseljajand "HOLY SHIT IT'S TINY!"
13:45technomancywrite a row in postgres and serve up some charts; not a lot going on =)
13:46muhoobanseljaj: webdev in clojure is wonderfully compact
13:46banseljajtechnomancy: I work with rails. trust me, it takes a lot of work to get it working there. :(
13:47muhooper rhickey: "gem install hairball"
13:47banseljajtechnomancy: Would you mind explaining a tiny thing on your code.?
13:48technomancysure; what's up?
13:49banseljajtechnomancy: line 8 in render.clj, you do [[question _ answers]]. I wanted to know what it is that you're skipping by using the \UNDERSCORE
13:49technomancybanseljaj: in that case it's the type of the question
13:49pipelinetechnomancy: another thing to keep in mind is that you're free to disregard their standards and just depend on the easy stuff: integrate with the 'alternatives' system, depend on a system jdk. I do this all the time for ruby things, packaging stuff the official fedora way is just too much work.
13:49clojure-newcomerHi guys, working through the clojure-programming book… trying to iterate over the result of the following function : http://pastebin.com/sTv0RFz8, can anyone help ?
13:50technomancybanseljaj: which is used to dispatch to the correct multimethod, but once you're in the method body you don't care
13:50banseljajtechnomancy: Oh. Nice.
13:50clojure-newcomerbasically just want to print some or all details of every element in collection/sequence
13:50technomancypipeline: it's up to whomever cares enough to package it =)
13:50technomancypipeline: I was lucky to have a lot of help with Debian, but it's great to have it included in the official repos
13:51muhooclojure-newcomer: doseq?
13:51banseljajtechnomancy: well, the debs still don't have 2.0 :(
13:51technomancybanseljaj: yeah, unfortunately the number of dependencies shot way up in 2.0
13:51technomancybut 2.0 isn't even finished anyway
13:51clojure-newcomermuhoo: I tried a doseq, but failed
13:52banseljajtechnomancy: it works fine for me.
13:52technomancywe have a long way to go before 2.0 is done
13:52banseljajtechnomancy: Actually, it's a wonderful tool. Thank you for that. :)
13:52clojure-newcomerI tried something like (doseq [author get-authors] (println author))
13:52technomancysure =)
13:52banseljajI like the cclojure community. :D
13:56banseljajThe results.clj makes about 30% sense to me. But then again, mY love affair with clojure is barely 72 hours
13:57technomancythere's a lot of crazy data-wrangling stuff in there; getting numbers in the right format for incanter
14:02banseljajtechnomancy: How much java knowledge is required to properly use clojure?
14:02technomancybanseljaj: depends what you want to do
14:03clojure-newcomercan anyone help me with the doseq or equipvalent necessary for me to inspect : http://pastebin.com/sTv0RFz8 ?
14:03banseljajtechnomancy: My Primary hobby is making web-apps. Secondarily, CLI apps, thirdly, GUI apps.
14:03technomancyyou basically never need to know how to write Java. sometimes you need to know how to read Java; more often learning to read javadocs is enough.
14:03banseljajtechnomancy: note: "hobby". Means I don't deal with deadlines and can work as long as I want to. :)
14:03muhooand java stacktraces :-)
14:04technomancybanseljaj: you'll be ignoring Java until you need to pull in a Java library.
14:04banseljajtechnomancy: I can read stacktraces. and javadocs.
14:04banseljajtechnomancy: How often does that happen. I mean how mature is clojure's own library/plugin/whatchamacallit system
14:05technomancybanseljaj: not sure how to answer that. it's more mature than you would expect for a 4-year-old language, mostly since writing libraries to wrap existing java implementations is way easier than writing from scratch.
14:06banseljajclojure's just 4 years old? :D
14:06banseljajs/:D/D:
14:07technomancymaybe 5?
14:07banseljajJava as a pretty strong library base.
14:08technomancy
14:09banseljajit'll be the youngest language I'm learning then.
14:11AeroNotixcan anyone make a comparison between clojure 6 months ago and clojure today?
14:11AeroNotixI tried it and I just found it to have a very 'standard' set of built-in functions, with pretty much everything else hitting out to java libs
14:11AeroNotixwhich kind of made it annoying to use
14:12AeroNotixI would love to get back to it, because it really changed the way I wrote other code. And I would like to learn more ideas from Clojure and Lisps in general
14:13technomancyit's more likely you just weren't able to find the libraries for what you wanted. for the most part they are out there, but I wouldn't say they've become much easier to find in the last 6 months.
14:14AeroNotixtechnomancy: What I found extremely annoying was the very weird way of interacting with files
14:14AeroNotixtechnomancy: I can't remember off the top of my head but it seemed strange there were regex `primitives` but not filereading `primitives`
14:15AeroNotixbuilt-in funcs, sorry
14:15technomancyyou mean the fact that the file functions aren't in clojure.core?
14:15technomancythey're definitely built-in
14:15AeroNotixtechnomancy: been a while but was it 'slurp'?
14:16technomancyslurp is the only one in clojure.core namespace; the rest are in clojure.java.io
14:16technomancybut using clojure.java.io is not "using Java", it's just using io functions that are implemented on the JVM
14:17AeroNotixiirc slurp puts the whole file into memory, which I found a little odd for a functional language, I thought it would lazily read the file.
14:17AeroNotixAnyway, it's no bother. File-reading is a small part
14:18technomancyyeah, slurp isn't meant for nontrivial purposes
14:18AeroNotixtechnomancy: and that's what got me
14:18technomancywell that hasn't changed in 6 months =)
14:18AeroNotixok then
14:18technomancybut you might have a better time learning now that the oreilly book is out
14:18AeroNotixalso, I picked up the completely *wrong* book to learn about clojure
14:18AeroNotixtechnomancy: been looking at that
14:19AeroNotixI picked up Practical Clojure, what a money grab
14:19gtrakis there a 'let' that'll dump its bindings and values into a map?
14:19foxdonutAeroNotix: not a fan either.
14:20AeroNotixfoxdonut: It just seemed like an api doc to me
14:20AeroNotixfoxdonut: very little theory
14:20foxdonutAeroNotix: I blame Apress.
14:20AeroNotixfoxdonut: well, I've had good books by Apress, "The Definitive Guide To Django" is amazing
14:21AeroNotixfoxdonut: I really should have waited for the O'Reilly book, never gone wrong with them
14:21gfredericksis there a built in java class-or-whatever for cloning an inputstream?
14:21foxdonutAeroNotix: to be clear: not all Apress books are bad. many books that are bad/rushed to market are from Apress.
14:21AeroNotixfoxdonut: I'll keep that in mind :)
14:22technomancyApress's CL book is great
14:22AeroNotixtechnomancy: the common lisp one?
14:22gtrakI want like the opposite of destructuring, being to reference other bindings as i'm building the map like a normal let
14:23gtrakbeing able*
14:23foxdonuttechnomancy: my theory is that if the author is good, Apress won't get in the way :)
14:23technomancyAeroNotix: yeah
14:23banseljajtechnomancy: How hard would it be to keep a local repo of all the clojure libraries? How much space?
14:24technomancybanseljaj: probably not impossible. check out http://clojuresphere.herokuapp.com
14:24AeroNotixI just found out today that my work has mirrors for like the top 20 linux distros, PyPI and CPAN and a host of other FOSS
14:24xeqigfredericks: cloning an inputstream?
14:24AeroNotixI ftp from it at like 10mb/s
14:25gfredericksxeqi: so it can be read twice; preferably without needing to keep more in memory than the difference between the two read points
14:25technomancybanseljaj: no way you'd want to put that on an iso for everyone though
14:25gtrakhmm.. like, (let {a 1 b (inc a)})
14:25gtrakwould return {:a 1 :b 2}
14:26banseljajtechnomancy: No. But you can put a script which anyone can use to get them.
14:26hyPiRionA let which returns a map?
14:26gfredericksgtrak: wouldn't be too hard to make a macro that does that
14:26gtrakyea, I'm thinking about it
14:26gtraksurprised it's not a already a thing, though?
14:27Chousukewhat would you use that for? :/
14:27technomancygtrak: you have to use a macro
14:27technomancysee the implicit &env arg
14:27gtrakjust to avoid (let [a 1 b (inc a)] {:a a :b b}), it's a common thing to write
14:29gtrak&env arg, interesting
14:29lazybotjava.lang.RuntimeException: Unable to resolve symbol: env in this context
14:29gfredericks(defmacro let-map [& pairs] (let [names (map first (partition 2 pairs))] `(let [~@pairs] (zipmap [~@(map (comp keyword name) names)] [~@names]))))
14:29gtrakha, awesome :-)
14:32fliebelgfredericks: How would you use it?
14:32gfredericks(let-map a 1 b (inc a))
14:33intuneontimehello, quick question: how come if i execute "(doall (for [i (range 1 3)] (do (println i) i)))" in the repl i get the result i expect (1 and 2 printed, then the sequence itself), but if i do "(def x (for [i (range 1 3)] (do (println i) i)))" and then "(doall x)" it doesn't print the 1 and 2, but just the sequence? if that makes sense.
14:35tmciverintuneontime: I get the same result for both . . .
14:36gfredericksintuneontime: it would only print the 1 and 2 the first time -- are you doing it repeated times?
14:37intuneontimeoh i see, it only happens the first time it's evaluated
14:37intuneontimethank you
14:37gtrakgfredericks: that's brilliant, though I think I like it more without the &, since it looks more like a let
14:38fliebelDoes anyone know what Greenspun's tenth rule is?
14:38gfredericksgtrak: yeah, whatever you like
14:38S11001001If it does not do exactly what you expect with exactly zero hours' consideration or experience, it is a bug in Lisp that should be fixed.
14:39technomancybrucio's law =)
14:39S11001001even more important than whatever that Greenspan guy said
14:39fliebelAny sufficiently complicated Clojure program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.
14:40hiredmanwho wants all of common lisp?
14:41fliebelstill on page 3...
14:41gtraklet-map along with destructuring is a multiple-return-value accelerator
14:50gfredericksgtrak: wrapping the pairs in a vector like you like would let you do more general things, like bind the resulting map to a local name and have a body for let-map that can use the map
14:50gfredericksnot sure if that'd be useful though
14:50gtrakit also looks like destructuring would still work :-)
14:50gtrakwithin the let-map
14:50gfredericksehhhh
14:51gfredericksdoubt it
14:51gfredericksthe keys it has to turn into keywords
14:51gtrakah, damn
14:51gtrakyou're right
14:51gfredericksit's conceivable though
14:52gtrakmaybe the &env is a clue
14:53gtrakuse a normal let to do the destructuring, then at the end, assemble the elements with &env
14:56gfredericksyeah; if you care about shadowing you'll have to check the vals of the &env with identical?
14:59gtrakit might require a second macro, if I use macrolet that would mess it up :-)
15:07eggsbyso I understand I can use atoms and references to eliminate race conditions... but how can I do concurrent operations in a clojure programs? Just spin up new threads?
15:07nDuffeggsby: that's one way; there's also agents
15:07nDuffeggsby: ...what's the actual use case?
15:08nDuff...and futures...
15:09eggsbyOh I'm doing some 'learn clojure' course and the task is to have concurrent operations on some world map
15:10nDuffeggsby: heh -- there's a somewhat famous little demo you might find relevant... I think Conway's Game of Life, with each pixel handled by a different thread
15:10eggsbythreaded game of life, eh
15:11rhceggsby: i wrote something similar to that here: http://matthavener.com/matthavener/banksim
15:11rhcits sorta like the "ants" program hickey wrote
15:11eggsbybasically what I'm thinking is either 'tick' the world map and process each possible 'move' for all the actors or spin up a bunch of threads and have them use a shared atomic resource
15:11eggsbythank you rhc I will look at it
15:11eggsbyI like the fact that this course wants me to do interesting things, I don't like that there was absolutely no teaching involved :|
15:12rhceggsby: banksim doesn't 'tick' but all the actors (trucks moving money) do sleep for a fixed amount of time
15:12rhcbut you could easily make that per-truck, or random-per-move
15:13rhceggsby: i wrote that recently, but i'm still new to clojure, so don't look to it for necessarily "idiomatic" clojure code, but imo its pretty ok
15:13nDuff...ahh -- Ants is _exactly_ what I was thinking about
15:14eggsbyis this ants video worth watching nDuff
15:14rhcthe ants presentation is still on blip.tv
15:14rhcthe whole presentation is an excellent intro to clojure
15:14eggsbyit says 'be sure to grab the code and slides!' yet doesnt link to the code nor the slides :(
15:15duck1123The ants video is really old, so take some of it with a grain of salt
15:15rhceggsby: err, that link si wrong: http://github.com/matthavener/banksim
15:15babilenrhc: Shouldn't that have been https://github.com/matthavener/banksim btw?
15:15eggsbyI also have some old video from phil hagelberg w/ peepcode
15:15babilenah
15:15eggsbybut I think it's clojure 1.1
15:15rhcbabilen: yeah, thanks
15:16eggsbyokay, so I need to learn about agents then, i'll look at this code, thanks rhc
15:17rhceggsby: no prob, let me know if you have any questions, i'll probably learn something too by trying to answer them :)
15:19eggsbyand so avout offers this style of concurrency in a distributed way?
15:22amalloygtrak: fwiw, useful.map has a macro "keyed", such that (let [a 1 b (inc a)] (keyed [a b])) would return {:a 1 :b 2}
15:23gtrakah, interesting
15:23amalloyalso accepts :strs and :syms options to mirror destructuring
15:23gtrakthe non-destructuring macro is good enough for what I'm trying to do, though I think it'd be fun to figure this out :-)
15:25solussdnoir question, if I have a pre route of "/*", can I get the actual value of "*" in my pre-route?
15:32duck1123solussd: I don't know noir, but do you have a key named :* in :params ?
15:36eggsbytechnomancy: do you think the peepcode clojure course is still relevant for people new to clj?
15:40solussdduck1123: doenst seem to work.. :/
15:45duck1123solussd: That's where clout puts it. I don't know what you have to do for noir
15:49gtrakgfredericks: https://gist.github.com/2764230 how do I keep c from showing up?
15:53gtrakhmm, I can remove the keys that are there before unless they show up again
15:55amalloyi don't think you can ever get to-map to work with no arguments
15:57BorkdudeWhat is the idea behind a non-dynamic var being mutable?
15:59technomancyeggsby: most of the features that have been added since the peepcode release are not relevant to beginners.
15:59technomancyeggsby: the biggest thing is that the peepcode doesn't use Leiningen, but IMO that's easy to learn elsewhere
16:00technomancyjust stick your fingers in your ear for the minute or two that build.sh is mentioned =)
16:00technomancyeggsby: see also http://technomancy.us/136
16:00eggsbytechnomancy: I've been using clojure for maybe 2 months, since I already understand the basics of the language, do you think it's a worthwhile purchase?
16:01technomancyI don't know; depends on your learning style and the kinds of things you've done so far.
16:02technomancyyou could read over the sample project source code; if it's all obvious to you then probably not
16:02technomancyclojurebot: google mire clojure github
16:02eggsbygood idea... and is it you actually doing the coding or did you just write it?
16:02clojurebotFirst, out of 296 results is:
16:02clojurebottechnomancy/mire · GitHub
16:02clojurebothttps://github.com/technomancy/mire
16:02technomancyI wrote the script and the code, but I didn't do the voiceover, thank goodness =)
16:03eggsbyah cool, well I think I'll purchase it just for that then
16:03technomancygreat =)
16:04amalloyjust to hear anyone's voice but technomancy's?
16:04Borkdudecan someone answer my question, before I put myself to shame elsewhere?
16:04Borkdude;)
16:04amalloyBorkdude: it's not really an answerable question yet, i think
16:04amalloynot very clear about what you're asking
16:04technomancyamalloy: topfunky's voice is silky-smooth; good for soothing infants as well.
16:05technomancyhe really should advertise that angle more
16:05raekBorkdude: the fact that you can mutate the root binding?
16:05Borkduderaek: yes
16:05technomancyBorkdude: it's only possible because interactive development would suck otherwise
16:05technomancyin ML-derived languages, changes to top-level definitions are not retroactive
16:06technomancywhich is also true in Clojure when working with non-var functions.
16:06Borkdudetechnomancy: yes, I noticed that in F#, do you mean this? http://stackoverflow.com/questions/2570628/difference-in-f-and-clojure-when-calling-redefined-functions
16:07Borkdudetechnomancy: non-var functions?
16:07technomancymore or less
16:08Borkdudetechnomancy: give me an example of a non-var function
16:08technomancyBorkdude: (defn f [] inc) (let [local-f (f)] (defn g [x] (local-f x)) (defn f [] dec) (g 10) ; -> 11
16:09technomancyyou see this most commonly with (run-jetty app {:port 8080})
16:09technomancyif you want to be able to recompile app, you do this instead: (run-jetty #'app {:port 8080})
16:09muhoo:join? false
16:09Borkdudetechnomancy: ah, that's why you give it the var.. ok
16:10BorkdudeClojure fosters immutability, but invites you to redefines its + function into - ;)
16:11technomancywell...
16:11technomancy+ is defined with definline IIRC, so that doesn't work
16:11Borkdudetechnomancy: I just tried it in a repl
16:11gtrakBorkdude: try defining your function before redefining +
16:11Borkdudetechnomancy: (in-ns 'clojure.core), (def + -)
16:12Borkdudetechnomancy: (+ 1 2 3) => -4
16:12Borkdudegtrak: will try
16:12technomancyyeah, you can redefine it, but not retroactively
16:12technomancyjust like ML
16:13Borkdudeah, got it
16:14BorkdudeI guess you can break anything if you want to
16:15technomancyyes, but it's not like Ruby which makes huge performance sacrifices to make redefining 2+2 work reliably =)
16:15Borkdudeeven with-redefs doesn't support retroactive defining on + or -
16:16BorkdudeI guess this goes for all "inlined" fns?
16:16technomancyyes, though you can still change the behaviour of + when used as a HOF
16:16technomancysince you can't inline HOFs
16:16Borkdudetechnomancy: + as a HOF, or in a HOF?
16:17technomancy+ as a HOF
16:17Borkdudetechnomancy: example?
16:17technomancy,(with-redefs [+ -] (map (partial + 2) [1 2 3]))
16:17clojurebot(1 0 -1)
16:17Borkdudeah
16:17dnolenBorkdude: I believe applies to primitive fns as well as protocol fns on Clojure JVM as well.
16:18Borkdude(partial + 2) isn't + as a HOF though, it is the HOF partial given + returning a new function which isn't + ;)
16:18technomancyIMO they're both HOFs
16:18technomancysince they're arguments
16:19Borkdudemy definition of a higher order function is a function that take functions as arguments and possibly return new function, but don't necessarily need to (like map)
16:19Borkdude+ doesn't take a function as an argument
16:20iwohey, is there a shorter way to do this:
16:20iwo(filter #(string/substring? "gnu" (key %1)) (System/getProperties))
16:20Borkdudebut my definition might be incorrect, correct me
16:20amalloythat's the technically correct definition, but "+ as HOF" colloquially would mean "+ used as a value, not called immediately"
16:20iwoi.e. filter map for only some keys that match pred
16:21BorkdudeI have to think about that for a while, brb ;)
16:21technomancyiwo: that's pretty short already once you take out the pred and the map =)
16:24iwotechnomancy: i guess so: (filter gnu-entry? props)
16:24technomancyiwo: you might need to (into {} (filter [...]))
16:25iwotechnomancy: sorry, i don't understand. why?
16:26technomancyiwo: depending on whether you want a map back or a lazy seq of k/v pairs
16:26iwooh i see
16:26iwotechnomancy: yes, much more useful
16:29winkhehe, last 2 lines. nice coincidence? :P
16:33bobryis it possible to test clojurescript applications with 'clojure.test'?
16:35dnolenbobry: no - tho that would be a welcome addition if you want to take the time to put something like that together.
16:35bobrythat's unfortunate :(
16:43rlbWhat would be the idomatic way to find the index of the first item in a collection that satisfies a predicate (other than equals)? I'm assuming there's something better than a manual recursion.
16:43dnolenbobry: easily remedied via community contribution, early days yet. CLJS hits 1 year from the first commit in 8 days.
16:44gfredericks,(doc keep-indexed)
16:44clojurebot"([f coll]); Returns a lazy sequence of the non-nil results of (f index item). Note, this means false return values will be included. f must be free of side-effects."
16:44adeelkhwhat's the situation with exception handling in clojurescript? do we have try and catch?
16:45dnolenadeelkh: yes
16:46rlbgfredericks: oh, right, that'll do -- thanks.
16:51kmicuWARNING: The form (. "S" toLowerCase) is no longer a property access. Maybe you meant (. "S" -toLowerCase) instead? What is a proper way? I can't find it in host interop docs :)
16:51TimMc(.toLowerCase "S") probably
16:52kmicufrom this I have warning
16:52adeelkhdnolen: I get `WARNING: Use of undeclared Var stopwatch.logger/catch`
16:52dnolenadeelkh: paste
16:52amalloyyou probably have a bad macro
16:53amalloyeg, one that expands to a catch without a try, and then you wrap that in a try elsewhere?
16:53bobryis there something special about having atoms in :pre constraints? the second one in 'machine' doesn' work https://gist.github.com/3e97073b9fc6cec40fc1
16:54adeelkhdnolen: https://gist.github.com/2764601
16:54adeelkhamalloy: i haven't written any macros
16:55amalloytoo many )s
16:55adeelkhargh
16:55amalloyor misbalanced, anyway - the catch is indented as if it were in the try, but it isn't
16:56dnolenadeelkh: nice you're playing around with CLJS + node
16:56adeelkhdnolen: yeah, it's pretty cool. i just haven't figured out how to get a repl running though
16:57dnolenadeelkh: still waiting for someone contribute one of those too :)
16:57adeelkhdnolen: i might try to do it myself then, because i really miss the repl
17:01Borkdudetechnomancy: btw, I told my class to deploy their clojure apps to heroku ;)
17:02technomancyBorkdude: high five: o/
17:02adeelkhamalloy: well, i fixed the parentheses but it doesn't actually seem to be catching the error
17:03adeelkhhttps://gist.github.com/8a508324634e779de53f
17:03adeelkh(the warning about catch being undeclared is gone though now)
17:04amalloythat's the usual issue with laziness
17:04amalloy(map f coll) instantly returns a lazy sequence; when you later realize its elements you are no longer inside a try/catch
17:04dnolenadeelkh: you need to specify the Error constructor you want to match
17:05dnolenadeelkh: (catch js/Error e ...)
17:05adeelkhdnolen: aha, that worked. thanks
17:06amalloyreally? dnolen, why does that work? like, for sure js/Error is a necessary fix, but shouldn't it break for the reason i said?
17:06adeelkhamalloy: in this case the error was in the evaluation of coll itself (not in the lazy sequence returned by map)
17:06amalloyah, okay
17:07Raynesamalloy: pwned
17:08Borkdudeis smth like this already in clojure.core? https://gist.github.com/2764700
17:08goodieboywe're using https://github.com/amitrathore/medusa and it's giving us problems now that we're bumping up clojure to 1.3 -- anyone know of an alternative?
17:12RaynesBorkdude: Not really. You can use (read-string ..) but keep in mind that it will read more than just numbers and make sure to disable read-eval if you use it.
17:12RaynesIf data can come from an outside source, that is.
17:13S11001001goodieboy: from general experience, it would probably be much easier for you to fix medusa than change your codebase to use an alternative API
17:13BorkdudeRaynes: ah, what kinds of objects can it read?
17:13RaynesAnything the Clojure reader can read.
17:14Raynes&(doc read-string)
17:14lazybot⇒ "([s]); Reads one object from the string s"
17:14Raynes&(doc read)
17:14lazybot⇒ "([] [stream] [stream eof-error? eof-value] [stream eof-error? eof-value recursive?]); Reads the next object from stream, which must be an instance of java.io.PushbackReader or some derivee. stream defaults to the current value of *in* ."
17:14gfredericks,(read-string "(read-string \"(read-string)\")")
17:14clojurebot(read-string "(read-string)")
17:14BorkdudeRaynes: great, good to know, but here I read in something which comes from an html form, so I'll use my own fn for now
17:14goodieboyS11001001: true, but our code is really only using the fixed thread pool, not using any of the stats stuff -- but i can look into it, i agree with you
17:15gfredericks,(read-string "<html><body><div id=\"tommy\"></div></body></html>")
17:15clojurebot<html><body><div
17:16RaynesBorkdude: You could do (binding [*read-eval* false] (read-string foo)), but then you'd also need to check if the result was really a number.
17:16RaynesIn the end, you'd probably end up with more code than that function you've got now.
17:17BorkdudeRaynes: yeh, now I can just write: (if-let [num (parse-int answer)] … …)
17:20BorkdudeI like expression oriented programming
17:21RaynesI like Borkdude oriented programming.
17:21Borkdude:)
17:22technomancystatements are great as a heuristic to determine whether a language designer has been exposed to other languages or is just making it up as he goes
17:23ForSparePartsDoes anyone know a good programmatic way to analyze a function and retrieve information about the functions it calls?
17:24ForSparePartsI was hoping that it'd be easy/easier to do in Clojure because of the whole lisp "code-is-data" thing, but I may have been foolishly optimistic.
17:24gfredericksby "a function" you mean "the source for that function"?
17:24iwohey, does anyone know where i can get a "light table" theme for emacs?
17:24BorkdudeForSpareParts: you can do static analysis using https://github.com/frenchy64/analyze
17:25ForSparePartsgfredericks, Yeah. If it were possible to do that with only access to compiled code, that'd be pretty wild. But I do have source.
17:27ForSparePartsBorkdude, I have looked at that project briefly before, and it seems promising. I'm a little worried it'll be over my head as a new clojure user, though. Are there any guides/tutorials/articles on it anywhere?
17:27TimMcgfredericks: What's in lib-5141? For some reason, I couldn't tell by the name. :-P
17:28BorkdudeForSpareParts: you can start following @ambrosebs on twitter and bug him ;)
17:28ForSparePartsBorkdude, Fair enough. : )
17:29ForSparePartsAnd actually, as a more general question: was I right to think that this would be a task particularly well suited to Clojure? I'm thinking about using this for a work project, but it'd be bad form for me to reinvent the wheel
17:29ForSpareParts(and basically everything we do is in Java)
17:29gtrakForSpareParts: are you analyzing java?
17:30technomancyForSpareParts: this project is one guy's grad thesis; you would probably need a pretty big team to pull this off for Java
17:30gtrakor just steal it from eclipse?
17:30technomancywell, it's not even his thesis, it's just some library he needed to exist before he could start work on his thesis
17:30technomancyfor a bit of perspective =)
17:30ForSparePartsWell, I could be. The functions I want to analyze haven't been written yet, and that's why I'm thinking about this -- if doing some of my work in clojure would make analyzing the code easier, I'd be inclined to try making my project in Clojure.
17:31Borkdudea class of mine is doing this kind of thing: https://github.com/husacct/husacct
17:31ForSparePartsthanks, technomancy.
17:31Borkdudethey use anltr for it
17:31Borkdudeantlr
17:32ForSparePartsBasically, these are speculative questions at this point -- I'll be writing a bunch of testing stuff, and I was thinking that having that kind of metadata on my tests would be useful for optimizing regression testing and that sort of thing.
17:32ForSparePartsAnd, to be perfectly honest, I think Clojure is neat and I've been looking for a good excuse to build something with it : D
17:33BorkdudeForSpareParts: you can look around for some clojure+antlr examples on the web
17:33BorkdudeForSpareParts: if you want to do Java analysis
17:33solussdhow do you call window.location.reload() from clojurescript? afaict, I can do (js/some_func arg), right?
17:34Borkdudebye folks
17:34amalloy(.reload (.-location js/window))?
17:35solussdwhat is the .-thing syntax mean exactly?
17:35solussdproperty access?
17:35amalloyyes
17:35solussdah
17:35solussdthanks
17:39adeelkhhow do i turn a clojure map into a javascript object, in clojurescript?
17:40dnolenadeelkh: you have to write your own converter.
17:41pandeirowould it make sense to have a canonical js interop ns like clojure.tools.javascript or something?
17:41adeelkhdnolen: hm, how should I do that? i have a map of config options i have to pass to a node library
17:41adeelkhdnolen: so it's just {"style" {"compact" true}} in this case
17:41eggsbywhy might I get an error like: Could not locate clojure/contrib/server_socket__init.class or clojure/contrib/server_socket.clj on classpath from the lein repl?
17:41pandeiroadeelkh: https://gist.github.com/1658431
17:42dnolenadeelkh: (js-obj "style" (js-obj "compact" true))
17:42adeelkhah, thanks
17:42technomancyeggsby: it's using deprecated contrib
17:42dnolenadeelkh: js-obj + array handles the common interop cases.
17:44technomancyeggsby: gimme a minute
17:44eggsbytechnomancy: I just have 1.2 listed in the project.clj, shouldn't that have socket-streams ?
17:45eggsbyerr, server socket*
17:45technomancyeggsby: yeah, but you shouldn't put old contrib in project.clj; it's gross.
17:48eggsbytechnomancy: https://github.com/technomancy/mire/blob/01-echo-server/src/mire.clj#L12 is this referring to clojure.contrib.io/read-lines ?
17:50technomancyeggsby: yeah
17:50technomancyI guess if you're going step by step you're going to run into the old contrib stuff
17:50eggsbyis it a typo that it says read-line or am I missing something
17:50eggsbyI might just use https://github.com/weavejester/tcp-server instead of socket-server
17:50technomancyoh, my bad
17:50technomancyit's clojure.core/read-line
17:51eggsbyaah, ok
17:52eggsbycould I get away with using weavejester's tcp server technomancy ?
17:53technomancyeggsby: no need; just pull the latest
17:53technomancyjust pushed an update
17:54espeedWhat's the general consensus on specifying a protocol implementation as a map so that its methods can be overridden?
17:54eggsbyah thanks technomancy
17:56antares_espeed: if you *really* need overriden implementations, it will work fine.
17:57espeedso it's not recommended as a standard practice?
17:59antares_espeed: reusing/overriding implementations The OO Way is often just not necessary.
18:02espeedthanks
18:08ibdknoxdnolen: why is it when I have the cljs compiler repo as a dep does it always print everything out the first time I compile?
18:09dnolenibdknox: first I've heard of that.
18:09ibdknoxweird
18:09ibdknoxit only happens if I use the git repo
18:09dnolenibdknox: you building with lein-cljsbuild?
18:10ibdknoxdnolen: calling build directly
18:10ibdknoxI'm doing the equivalent of what lein-cljsbuild does
18:11dnolenibdknox: but you don't encounter that with lein-cljsbuild right?
18:11ibdknoxlet me try
18:12ibdknoxdnolen: correct
18:16dnolenibdknox: then I'm not sure what's up.
18:17dnolenibdknox: might want to compare what you do differently.
18:17ibdknoxI'll assume it's my fault somewhere then :)
18:49dhermandnolen: so without concurrency, what would you say are the killer one or two motivators for clojurescript? macros? expressive data abstraction?
18:50RaynesNot having to use javascript seems to excite people quite a bit.
18:52dhermanRaynes: I'm preparing a slide about different languages that compile to JS, so they all have that feature. the question is differentiating clojurescript from others
18:52TimMcdherman: Fewer pitfalls to keep in mind, I suppose. I like to be able to iterate over a collection without having to be cautious.
18:53RaynesThe data structures are a nice win. Clojure has excellent data structures.
18:53dnolendherman: persistent data structures
18:53dhermanthe point isn't to contrast it with JS, since all languages that compile to JS eliminate the pitfalls
18:53TimMcHmm, I see.
18:53dnolendherman: comprehensive abstractions - like iteration for all types including natives
18:53dhermank
18:54dnolendherman: sensible solution to expression problem
18:54dhermanif I wrote "comprehensive data abstraction" would that be accurate?
18:54dnolendherman: including natives
18:54dnolendherman: yes, but it's important that types that you don't control can be easily subsumed
18:54dhermanoh that's good, more intuitive -- uniform data abstraction (including host objects!)
18:54dnolendherman: yes
18:55dhermannice, thx
18:55dnolendherman: lots of minor stuff, like let scoping, no fear of aliasing, no mutable locals, no need for cloning
18:55dhermanthx
18:55dhermanyeah, this is just a one-line of high points
18:55dhermanso that's enough
18:56dnolendherman: cool
19:03dnolendherman: which other compile-to-JS projects are you covering? CoffeeScript & Roy?
19:04dhermanon that slide, I'm just mentioning a few for example. CoffeeScript, ClojureScript, Roy, FBJS, TameJS
19:04technomancyparenscript?
19:04TimMchaha
19:04TimMcGWT?
19:04dhermantechnomancy, TimMc: there are maaaaaany languages that compile to JS. not looking for completeness.
19:04dhermanbut later in the talk I'm talking about different topics that haven't been talked about quite as much yet
19:05TimMcI've actually not heard of Roy, FBJS, and TameJS.
19:05dnolendherman: what's the gist of the talk?
19:05dhermandnolen: "The JavaScript Virtual Machine"
19:05dnolendherman: ooh nice :)
19:05dhermanwhy I think JS is a compelling VM, and where I'd like to see it go
19:06technomancy"JS is a compelling VM" or "JS has some compelling VMs"?
19:06dhermanTimMc: Roy: an MLish language (static types, pattern matching); FBJS = Facebook JS (security language); TameJS: CPS-based language with coroutines for sync-style event handling
19:06dhermantechnomancy: JS as the VM for targeting other languages to
19:06technomancyit's not a VM though
19:07technomancyor you mean it as a metaphor?
19:07dhermandepends on how optimistic you are about precisely defining "VM"
19:07Raynesmetophypothetically
19:07dhermanI'm happy treating it either way
19:07McMartinLet's go with "target platform"
19:08RaynesI'm not sure how you could define 'VM' that would let it include js.
19:08RaynesIt makes perfect sense metaphorically though.
19:08technomancydoesn't the term "JavaScript™" technically only apply to Mozilla's implementation?
19:08technomancyor is that not true anymore
19:08dhermantechnomancy: not really
19:09dhermanor, it's unclear at best
19:09dhermanSun owned the copyright to the name "Java"
19:09dhermannow Oracle presumably does
19:09technomancyI mean, it used to be that ECMAScript was the name of the language, and JavaScript and JScript were the two implementations that existed.
19:09dhermanbut nobody really knows the status of it
19:09dhermantechnomancy: it was only called ECMAScript b/c JavaScript was copyrighted by Sun
19:09technomancydherman: you can't copyright names
19:09dhermanbut they were meant to be the same thing
19:09technomancyare you talking about trademarks?
19:10dhermansorry, yes, trademark
19:10dhermanwrong term
19:10technomancyI don't think the Java trademark applies to JavaScript
19:10McMartinDoes JS have a standard bytecoded format?
19:10dhermanthey trademarked both
19:10dhermanMcMartin: no
19:11dhermanMcMartin: you should listen to my talk this week ;-)
19:11McMartinMaybe I should! Where is it?
19:11dhermanOslo
19:11McMartinSadly, I'm going to be in San Diego this week.
19:11dhermanbut it'll be recorded
19:11McMartinWill there be slides/a paper associated with it?
19:11dhermanno paper, but definitely slides
19:11dhermanin Full HTML5 Technicolor
19:11dnolendherman: looking forward to it
19:11dhermanthx
19:12dnolendherman: targetting JS has been pretty awesome, I fully support the "JavaScript Virtual Machine"
19:12dherman:)
19:12dnolendherman: down with Dart!
19:12dhermanhaha
19:12dhermanDart. feh
19:12McMartindnolen: "Hey, nice dart you got there, now, about that JS V8 and what reasonable type inference nets you..."
19:13McMartinWhy yes, I do consider compiler technologies to be 1930s movie gangsters, don't judge
19:14dhermanMcMartin: SpiderMonkey has better type inference than V8 :)
19:15brehautdherman: don't go using facts when talking about V8! The Holy Node will strick you down
19:15McMartindherman: V8 is the only one I had numbers handy for, though.
19:16dhermanwell, V8 still beats us on many benchmarks, but our TI algorithm is more sophisticated
19:16McMartin(Specifically, from http://julialang.org/ and its table that accidentally says "why you should probably use JSV8 instead of Julia")
19:16dhermanhttp://rfrn.org/~shu/drafts/ti.pdf
19:16McMartinNow I have to see if you cited any of my colleagues >_>
19:17dnolendherman: it's been interesting finding the optimal line between what type of code optimizes on V8, SM, and JSC
19:17dhermandnolen: you know way more than I do, I'm sure
19:18dnolendherman: SM and JSC tend to optimize real JS patterns. V8 often seems happier with lower level stuff.
19:18McMartinI can readily believe that
19:19dhermaninteresting. how do you determine that patterns are real?
19:19McMartin(Also: well, I recognize a few of those names)
19:19dnolendherman: example - iterating over JS object keys with for in is slower than holding the keys in a array yourself and iterating over that.
19:20dnolenon V8
19:20dnolennot true for SM or JSC, but iterating over array is not slow - so it's a solution that works well for all.
19:20dhermanhuh. like, for (var a = Object.keys(o), i = 0, n = a.length; i < n; i++) { ... } ?
19:21dnolendherman: no for(var k in obj) { ... }
19:21dhermanright, but what's the faster alternative?
19:21dnolendherman: store the keys in an array ourselves.
19:21dhermanthat's what I did...?
19:22dnolenno calls to Object.keys
19:22dhermanso you start with a for-in loop and cache the keys, and then do multiple for loops over the array?
19:23dhermanIOW, this only gives you savings if you loop multiple times over the same set of keys
19:23dhermanit can't possibly be faster for one single loop
19:23dnolendherman: some explanation - JS objects do double duty as real maps and types w/ fields.
19:23dnolendherman: CLJS provides proper map abstraction
19:24dnolendherman: complex keys etc
19:24dnolendherman: but we optimize string key only maps - since we have our own map abstraction, we track keys as their added.
19:24dnolenthey're
19:24dhermanaha
19:24dhermanthat's what I missed
19:24dhermanok
19:33brainproxyre-implementing node-clojurescript in clojurescript, using node-clojurescript .. fun :D
19:56archaicIncanter 1.3 and quil 1.4.1 both use processing.org and when combined in the same project clash (quil fails to find static methods in proccessing.core.PConstants), I didn't think this was possible - for seperate libraries to interfere with each other like that (lein2, clojure 1.4.0)
20:04technomancyarchaic: without special tricks, you can only load one version of a given library at once
20:04kwertiiIs there some magic trick needed in Korma to do WHERE clauses with timestamps?
20:04technomancyso naturally it's easy for one dependency to win and the other one to complain
20:06nDuffHow can I populate a namespace other than the one I'm in?
20:06technomancychange namespaces
20:07nDufftechnomancy: ...so, for interactive use, that completely makes sense. In the case where I'm writing a function which to populate the user ns before kicking off a nREPL service which will (unconfigurably) default to it, I'm not quite as sure how that'll work.
20:08technomancythere are lots of ways to change namespaces
20:08technomancyone way is to eval code when inside (binding [*ns* ...])
20:08gfredericks,(macroexpand-1 (ns foo.bar))
20:08clojurebotnil
20:08gfredericks,(macroexpand-1 '(ns foo.bar))
20:08clojurebot(do (clojure.core/in-ns (quote foo.bar)) (clojure.core/with-loading-context (clojure.core/refer (quote clojure.core))))
20:09nDuffAhh.
20:11eggsbytechnomancy: After watching this video, I'm glad I don't need to run my clojure apps and tests with shell scripts... thanks for that
20:12technomancyeggsby: haha; yes, it's a nice peek into the dark ages
20:34mebaran151I'm trying to figure out how event binding works in jayq and clojurescript: how do I get the element that was clicked in a click handler?
20:39brehautmebaran151: at a guess, the first argument to the event handling function is a dom event object?
20:40brehautmebaran151: or at least, the jquery wrapped event
20:40brehautmebaran151: in which case e.target is the target node
20:40mebaran151I've been trying something like that, but I just realized calling a function from the repl is different from clicking it
20:41brehauttarget is a property, not a function
20:41brehautand yes
20:41brehaut$(object).click() will simulate the click
20:41brehauttranslate that to cljs obviously
20:41mebaran151thanks brehaut; I'm still getting the hang of cljs
20:42brehautno problem. i dont know anything about clojurescript though ;)
20:42mebaran151I have some familiarity with jQuery, but I thought in the long run, it might be worthwhile to code some of the logic in cljs, especially as I add more remoting to the mix
20:44brehautseems reasonable. and you'll get to avoid some of the quirkiest parts of jquery
20:44brehaut(eg, each, map etc)
20:46mebaran151just figured out console log; very much my friend
20:48brehautmebaran151: console.dir(console) and have a look at the prototype. theres lots of handy stuff there
20:51brehautmebaran151: probably just 'console' is fine, but i cant never seem to predict when the console will return some other form for the data
20:52mebaran151whoopee, got it working
20:52mebaran151I'll check out console.dir
20:59emezeskednolen: Have you noticed the clojurescript compiler output sneaking upwards in size again recently?
21:02muhoois there a quick one-liner to transform map keys? i.e. to make {:foo "bar" :baz "quux"} into {:blah "bar" :yah "quuz"} ?
21:03muhoobasically :foo -> :blah, and :baz -> :yah
21:03dakrone,(doc clojure.set/rename-keys)
21:03clojurebotGabh mo leithscéal?
21:03dakronemuhoo: well, clojure.set/rename-keys http://clojuredocs.org/clojure_core/clojure.set/rename-keys
21:07muhooperfect, thanks!
21:07muhooclojure.core is like a chinese restaurant menu. so many dishes, all so tasty.
21:08McMartinAnd kind of poorly indexed when you're looking for something specific >_>
21:08muhooand it could take years if you actually want to try them all
21:10muhooMcMartin: http://clojure.org/cheatsheet is the best i've found yet
21:11McMartinYeah, but even that cheatsheet I have to Ctrl-F to find what I need
21:12muhooheh, methinks it is time for protocols and deftypes: https://www.refheap.com/paste/2821
21:12muhooprotocols and defrecords, sorry
21:14muhooi'd like to add a function to emacs clojure.el to hotkey a function and let it show the docs, not in a browser, but in the repl, without having to type (doc foo) all the time
21:14emezeskemuhoo: That seems totally reasonable as just a map to me
21:15mebaran151muhoo: you need the polymorphism?
21:15muhooit'd be nice to have default implementations, yes
21:15emezeskeMultimethods are pretty nice for that sort of thing
21:15mebaran151wouldn't the default just be a function that expects a map with certain keys?
21:16muhoothe default would fill in the keys
21:16muhooso i don't get NPE's :-)
21:16mebaran151muhoo: you could put together a template map and just merge your custom maps on top of it
21:16muhoo((:save-button fsettings) "foo") is unpleasant if :save-button hasn't been defined, but i'm fine with using hiccup.form/save-button as a default
21:17muhoomebaran151: perfect, thanks!
21:35amalloymuhoo: C-c C-d C-d
21:35emezeskeibdknox: ping
21:37emezeskeibdknox: unping :) I thought something was up with jayq, but I was using some crazy accidental local version
21:52mebaran151hey emezeske I'm using bootstrap.js from a CDN; how do I get it to compile on Advanced?
21:56emezeskemebaran151: You need to write an externs file
21:56emezeskemebaran151: Except that you're lucky, and I happen to also be using bootstrap
21:56emezeskemebaran151: Paste incoming :)
21:56mebaran151emezeske: oh many many thanks :)
21:57emezeskemebaran151: So, stick this in something like boostrap-externs.js: https://www.refheap.com/paste/2822
21:57emezeskeAnd then set :compiler {:externs ["path/to/bootstrap-externs.js"]}
21:58mebaran151do I throw this in a public directory or no?
21:58emezeskeNah, it's just used at compile time
21:58mebaran151let's try it...
21:58emezeske*Note: I have no idea what I'm doing with externs files, I just sort of threw that together until it worked for me
21:58mebaran151I may need to add more, but I see the idea
21:59mebaran151maybe it would be wise to pull down a local version of bootstrap just for compiling
21:59mebaran151that had all the functions which the Closure would then note
21:59emezeskeYou can use the original bootstrap.js as an externs file
21:59emezeskeBut it will produce a ton of warnings
22:00mebaran151I still get a lot of warnings that .text doesn't mean .-text, etc
22:00mebaran151anyway to suppress those?
22:00emezeskeWrite an externs file ^_^
22:00mebaran151haha
22:00mebaran151they seem to be coming from jayq
22:00emezeskeHmm I don't get any of those any more
22:00emezeskeMaybe upgrade your compiler version?
22:01emezeskeThat warning was removed from the compiler a while back
22:02mebaran151I'm just lein-cljsbuild 0.1.8
22:02mebaran151*using
22:02emezeskeHmm, that's pretty new. You might try 0.1.10, though
22:03mebaran151just pulled
22:03mebaran151same warnings
22:04emezeskeUh, that's very weird, I wonder if somehow you're inadvertently using an older version
22:05mebaran151emezeske: it looks like it's pulling the right jar (saw maven pull it)
22:05mebaran151could it be my jayq version
22:05emezeskeWhat's the exact text of the warning?
22:06mebaran151WARNING: The form of (. this String) is no longer a property access....
22:06emezeskeSo, the string "property access" does not appear in the current version of the compiler (using grep)
22:06mebaran151hmmmm
22:06mebaran151curious
22:06emezeskeVery!
22:08mebaran151ah, upgrade noir-cljs fixed it
22:08mebaran151*upgrading
22:09emezeskeSweet.
22:09mebaran151one of them must have overridden my running cljs