2012-05-21
| 00:00 | emezeske | technomancy: Offhand it doesn't seem like a whole lot of the code |
| 00:00 | emezeske | technomancy: Most of it looks like it's related to serializing/execing/etc |
| 00:00 | emezeske | technomancy: The actual HTTP server loop is pretty compact |
| 00:00 | emezeske | technomancy: Oh, are we talking about for clojurescript? I am |
| 00:01 | technomancy | yeah |
| 00:01 | technomancy | wondering what needs to happen to make it work in gjs |
| 00:01 | emezeske | what's gjs? |
| 00:06 | amalloy | emezeske: technomancy's been doing gnome extensions, i assume that's gjs |
| 00:06 | dherman | dnolen: ping |
| 00:06 | emezeske | amalloy: ah, cool, thanks |
| 00:09 | technomancy | yeah, it's gnome's spidermonkey |
| 00:10 | technomancy | I guess it would probably look a lot like the node one |
| 00:10 | dnolen | dherman: pong |
| 00:11 | emezeske | technomancy: I was just about to suggest looking at the node one |
| 00:11 | dherman | dnolen: 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:11 | technomancy | emezeske: does that live in a separate project or branch or something? |
| 00:12 | technomancy | emezeske: or maybe I was looking in lein-cljsbuild which is the wrong place? |
| 00:12 | emezeske | technomancy: I think a branch; you might ask dnolen, I think he was working on that |
| 00:12 | emezeske | technomancy: ah, yeah, that's in some upstream clojurescript branch |
| 00:12 | dnolen | dherman: I think that can/will only happen as much browsers provide supporting constructs. |
| 00:12 | emezeske | technomancy: I plan to eventually integrate it into cljsbuild, or at least I have a plan to plan to do that |
| 00:12 | dnolen | as much as |
| 00:12 | technomancy | emezeske: is it fair to say lein-cljsbuild currently only targets browsers then? |
| 00:12 | dherman | dnolen: well, it could happen with deeper compilation, but I imagine that would be slow |
| 00:13 | dnolen | dherman: yes not really interesting in providing our own concurrency layer. |
| 00:13 | dherman | sure |
| 00:13 | dnolen | interested |
| 00:13 | emezeske | technomancy: Sort of. I think some people use it to compile for node, but with no node repl it's not that swanky |
| 00:14 | dherman | dnolen: thx. preparing some slides for a preso about compiling to JS |
| 00:14 | technomancy | emezeske: so it's not an intentional decision? |
| 00:14 | dherman | don't wanna misrepresent anyone |
| 00:14 | emezeske | technomancy: No, definitely not. Just limited time/interest on my part |
| 00:14 | technomancy | sure |
| 00:14 | dnolen | dherman: cool! where you presenting? |
| 00:14 | dherman | "web rebels" |
| 00:14 | dherman | http://webrebels.org/ |
| 00:15 | emezeske | technomancy: I'd love to pull in node/etc support, if someone with a higher interest and knowledge in that area put it together |
| 00:15 | emezeske | technomancy: As it stands, I just do browser stuff personally, so I'd be slow to add that |
| 00:16 | technomancy | I don't know the first thing about gjs, but I hate all desktops that don't have a repl |
| 00:16 | dnolen | dherman: very interested in seeing some sort of task parallel JS thing happening - but not sure how much vendor interest there is in that. |
| 00:16 | technomancy | s/desktops/programs/ I guess |
| 00:16 | technomancy | so hopefully my hate can be channeled into something productive |
| 00:16 | emezeske | hahaha |
| 00:17 | dherman | dnolen: we're very motivated, and tc39 has shown interest so far |
| 00:17 | emezeske | that's a kind of hate that I can get behind |
| 00:17 | technomancy | programs without repls: completely loathsome. |
| 00:17 | dherman | dnolen: though we haven't yet gotten any other vendors to sign up for a more active role yet |
| 00:18 | dherman | dnolen: er, sorry |
| 00:18 | dherman | task parallel |
| 00:18 | dherman | I was thinking data parallel |
| 00:18 | dherman | dnolen: we've got an intern starting this week who'll be working on task parallelism for JS |
| 00:18 | dherman | but we don't know yet how it'll pan out |
| 00:19 | dnolen | dherman: would be more excited about Workers but clone overhead makes it worthless for building on top of for us. |
| 00:19 | dherman | I see |
| 00:19 | dherman | yeah, workers are expensive |
| 00:19 | dnolen | dherman: wish there was some way to avoid that, we have persistent data structures. |
| 00:20 | dherman | dnolen: there's an API for transfering ownership but I don't think that helps you |
| 00:20 | dherman | transferring? |
| 00:20 | dnolen | dherman: nope, because we want free reads. |
| 00:20 | technomancy | maybe I'm just tainted by the fact that the main repl-less program I'm stuck using is skype |
| 00:20 | technomancy | but it's just so wretched |
| 00:20 | technomancy | what really bums me out is that people put up with this crap even though they should know better |
| 00:22 | dherman | dnolen: I have a stupid question. how do you do the memory management of shared persistent data structures? concurrent GC? |
| 00:22 | dnolen | dherman: we leave it up to the host JS engine. |
| 00:22 | dherman | I guess I meant in Clojure, but the answer's obvious: JVM |
| 00:22 | dnolen | dherman: but we also provide lower level constructs too. |
| 00:23 | dherman | you don't actually have *parallel* data structures in cljs |
| 00:23 | dherman | oh, you can with copying |
| 00:23 | dnolen | dherman: yeah JVM manages them pretty well, not too many complaints in the past 5 years. |
| 00:23 | technomancy | I guess you pick your battles. =\ |
| 00:24 | dnolen | dherman: we don't need parallel data structures |
| 00:24 | dnolen | dherman: that's the whole point of rhickey's reducer work. |
| 00:24 | dherman | I thought that's what you were talking about |
| 00:24 | dherman | dnolen: you have to forgive my great distance from the clojure world |
| 00:24 | dnolen | dherman: we go data parallel the moment we have task parellelism. |
| 00:24 | dherman | I only have very cursory understanding of the data strucutres and concurrency models |
| 00:25 | dnolen | dherman: the latest work is based on Guy Steele's talk on foldl foldr considered harmful. |
| 00:25 | dherman | oh that's such an awesome talk |
| 00:25 | dnolen | dherman: we're ready for data parallelism on any host w/ task parellelism. |
| 00:25 | dnolen | dherman: no new data structures required |
| 00:25 | dherman | can you explain? |
| 00:26 | dnolen | dherman: we already have persistent data structures - trees. |
| 00:26 | dnolen | dherman: reducer framework is purely aglorithmic. We don't need new data structures. |
| 00:27 | dnolen | just a way to divide up the work, reduce + combine in parallel. host stuff. |
| 00:27 | dherman | ok, so the reducer framework is all implemented in pure clojure |
| 00:27 | dnolen | dherman: yes |
| 00:28 | dherman | but 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:28 | dherman | s/at first/at first was/ |
| 00:28 | dnolen | dherman: perhaps I'm mistaken, but the copying is imposed by Workers right? |
| 00:28 | dherman | yes |
| 00:28 | dherman | except for transfer of ownership, but that doesn't give you sharing |
| 00:29 | dnolen | dherman: yeah that's horrible. We are giving workers something that doesn't need to be copied :) |
| 00:29 | dherman | right |
| 00:29 | dherman | so I was just thinking to myself, |
| 00:29 | dherman | is there some minimal API we could add, that doesn't require new deep semantic concepts in JS |
| 00:29 | dherman | but the sticking point is that it would require concurrent GC |
| 00:29 | dherman | basically I was thinking: |
| 00:30 | dherman | 1) allocate something in OS shared memory that's owned by one worker |
| 00:30 | dherman | 2) allow it to mutate it at will |
| 00:30 | dherman | 3) when it's done initializing it, deep freeze it |
| 00:30 | dherman | 4) then allow sharing it between workers |
| 00:30 | dherman | that's hand-wavy, b/c JS objects don't like being deeply frozen |
| 00:30 | dherman | they're all intertwingled via prototype goo |
| 00:31 | dherman | so I'm not even sure that's coherent |
| 00:31 | dherman | but it seems the biggest issue is that it would require concurrent GC |
| 00:33 | dnolen | dherman: I know hardly anything about GC - I guess JDK fork/join requires concurrent GC? |
| 00:34 | dherman | I'd think just JDK threads require concurrent GC |
| 00:34 | dherman | guess it depends what level concurrency we're talking |
| 00:36 | dherman | hm. y'know what, I believe we are working on a concurrent GC. maybe this is becoming more standard |
| 00:37 | dherman | dnolen: I'll speak with colleagues about this. persistent, shared data structures would be so awesome |
| 00:37 | dnolen | dherman: I'm not sure if it makes any difference but the reducer framework is about being alloation free. |
| 00:37 | dnolen | dherman: YES |
| 00:37 | dnolen | allocation |
| 00:39 | dnolen | dherman: too bad rhickey isn't around, he'd probably have much more insightful points about all this :P |
| 00:39 | dherman | no worries, it's late |
| 00:39 | dherman | now I know there's a freenode channel |
| 00:39 | dherman | I'll try not to be a stranger |
| 00:39 | dnolen | dherman: thanks! |
| 00:40 | dherman | judging from his accent, I assume rich lives in NY or NJ, yes? |
| 00:40 | dnolen | dherman: yeah NY |
| 00:41 | dnolen | dherman: hopefully we can talk about this sooner rather than later - but we'll also all be at StrangeLoop I see. |
| 00:42 | dherman | yeah, 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:42 | dnolen | dherman: will do |
| 00:42 | dnolen | dherman: a specific channel? |
| 00:43 | dherman | irc.mozilla.org: #jslang, #jsapi, #research, #lljs, #rust |
| 00:43 | dherman | but doesn't matter |
| 01:17 | muhoo | grr, 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:18 | muhoo | so it's kind of a pain to reload them. |
| 01:19 | wkmanire | join #refheap |
| 01:20 | wkmanire | I swear erc eat's my characters if I don't wait for it to load. |
| 01:21 | muhoo | vector actually. |
| 01:22 | wkmanire | eats* bleh |
| 01:23 | banseljaj | hey wkmanire |
| 01:24 | wkmanire | banseljaj: Good morning ~Doctor |
| 01:24 | banseljaj | I actually went a head and made an experimental linux distro off of Open Suse. :D |
| 01:25 | wkmanire | banseljaj: Why'd you have to use Suse? |
| 01:25 | wkmanire | I don't know Suse very well. |
| 01:25 | banseljaj | No particular reason apar tform the fact that it gave a convenient tool to build distros in the cloud. |
| 01:25 | banseljaj | wkmanire: it's just like RHEL |
| 01:26 | wkmanire | I also don't know RHEL. |
| 01:26 | wkmanire | I use Debian and Debian variants. |
| 01:26 | wkmanire | Currently using Linux Mint. |
| 01:26 | banseljaj | I (heart) debian |
| 01:26 | banseljaj | But it was an experiment. just to see what would be needed. |
| 01:26 | wkmanire | I see. |
| 01:27 | wkmanire | Does it work? |
| 01:27 | banseljaj | Currently it only has packages. |
| 01:27 | banseljaj | I just finished building it. |
| 01:27 | banseljaj | I'll know by the end of today |
| 01:27 | wkmanire | I hope it does work. |
| 01:27 | wkmanire | I really do think this is a great idea. |
| 01:28 | banseljaj | Yeah. |
| 01:28 | banseljaj | It would require a truckload of work though |
| 01:28 | banseljaj | Suse doesn' have leiningen, for example |
| 01:28 | banseljaj | :( |
| 01:28 | banseljaj | So i'll have to build an rpm. |
| 01:28 | wkmanire | Well that doesn't mean you can't install it. |
| 01:28 | banseljaj | Not from a repo, no. |
| 01:29 | wkmanire | bah. Why? You're in control of the distro, just pre install it. |
| 01:29 | banseljaj | wkmanire: I'll probably make an rpm of lein. :D |
| 01:29 | wkmanire | But to install it you just run a shell script |
| 01:29 | wkmanire | and it does the rest. |
| 01:29 | banseljaj | If it doesn't work, i'll just use Arch. |
| 01:29 | banseljaj | wkmanire: Yup. |
| 01:39 | ambrosebs | gfredericks: might be interested in a sample of the types I devised for rest/next/first/conj https://gist.github.com/2760648 |
| 01:53 | muhoo | debian is pretty awesome. though technomancy found this fascinating distro-overlay that is kind of like immutable packages |
| 01:53 | muhoo | it's like if you took clojure structural sharing, couchdb revs, and git, and made a package manager out of them |
| 01:54 | raek | nix? |
| 01:54 | clojurebot | nix 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:56 | muhoo | that's the one |
| 02:07 | y3di | https://twitpic.com/show/large/9nild1 -- guess God really does use lisp |
| 02:07 | lnostdal | hi 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:07 | ivan | y3di: haha |
| 02:08 | muhoo | exceptions in the ns macro are fun fun fun |
| 02:08 | muhoo | it's like 20 pages |
| 02:09 | ivan | someone should make an Clojure traceback decoder with every mistake you could make |
| 02:09 | ivan | forgetting the argument vector sure leads to an interesting one |
| 02:10 | muhoo | yep, some typo or another |
| 02:10 | michaelr` | y3di: the first thing that came to mind: "what is this? the horns of devil?" |
| 02:11 | ambrosebs | ivan: relevant: http://dev.clojure.org/jira/browse/CLJ-157 |
| 02:22 | michaelr` | ambrosebs: why (if(if instead of (if (not ? |
| 02:24 | ambrosebs | not isn't bound at this point |
| 02:24 | michaelr` | oh |
| 02:24 | michaelr` | :) |
| 02:24 | ambrosebs | :P |
| 02:26 | ambrosebs | michaelr`: It's probably because we don't have "and" here either |
| 02:33 | lnostdal | am 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:49 | michaelr` | lnostdal: binding conveyance? can you point at a sample code? |
| 02:54 | lnostdal | yes, michaelr` https://www.refheap.com/paste/2813 |
| 02:54 | lnostdal | something like that |
| 03:07 | lnostdal | it's driving me nuts .. |
| 03:12 | amalloy | lnostdal: to be fair, lack of binding conveyance also drives people nuts somewhat regularly |
| 03:12 | lnostdal | yes, but whitelist ... |
| 03:12 | lnostdal | or just, something |
| 03:14 | michaelr` | lnostdal: i don't see what's the problem in that code? :) |
| 03:14 | lnostdal | michaelr`, k |
| 03:15 | michaelr` | if i understand correctly the threads do not share state here, which is great.. |
| 03:15 | lnostdal | michaelr`, that's not the issue |
| 03:16 | lnostdal | (in a sense the problem is exactly the opposite of what you say; threads _do_ share too much state, by default) |
| 03:17 | michaelr` | ok, in your example it's not a real db connection.. |
| 03:17 | lnostdal | right |
| 03:18 | lnostdal | if it was, the operations in the agent would sometimes work and sometimes "mysteriously" fail |
| 03:18 | lnostdal | racy |
| 03:18 | lnostdal | ..sometimes people mess up you know |
| 03:19 | michaelr` | how can this work otherwise? |
| 03:19 | lnostdal | it shouldn't |
| 03:19 | lnostdal | it should fail predictably; every time |
| 03:19 | lnostdal | that's the problem |
| 03:19 | lnostdal | same with open files etc. too |
| 03:20 | lnostdal | e.g. (with-open ...) |
| 03:20 | michaelr` | what happens here is that you close the connection while another thread is still using it, right? |
| 03:21 | lnostdal | yes |
| 03:21 | lnostdal | try-finally type stuff |
| 03:22 | michaelr` | the correct code should wait for the thread to finish before closing the connection.. so how do you propose to solve this automatically? |
| 03:22 | amalloy | how does with-open have anything to do with bindings conveyance? |
| 03:22 | lnostdal | pretty 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:23 | lnostdal | amalloy, nothing; just to make michaelr` understand that the connection closes in this particular example |
| 03:23 | lnostdal | amalloy, well, nothing except with-open uses bindings .. but whatever |
| 03:24 | amalloy | no it doesn't. it uses a let |
| 03:24 | amalloy | which, okay, you can call lexical bindings, but those aren't relevant to "bindings" in this context |
| 03:24 | lnostdal | it does? .. hm, yes it does .. then never mind .. i saw "binding" in the definition |
| 03:25 | lnostdal | ok, but the DB lib uses `binding' .. not `let' .. perhaps that's the problem |
| 03:25 | lnostdal | not sure what others do .. using java.jdbc here .. do they explicitly pass around the context or the connection? |
| 03:34 | lnostdal | nope, that wouldn't make sense either i think .... *shrug* |
| 03:46 | muhoo | that's kinda weird, i never knew you could do map destructuring in reverse |
| 03:46 | muhoo | like (defn barg [{baz :params}] baz) |
| 03:47 | muhoo | instead of (defn barg [{:params baz}] baz) |
| 03:52 | tomoj | only the former works |
| 03:52 | tomoj | so I would call that "forward", not "reverse" |
| 03:54 | tomoj | it 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:54 | tomoj | so the variables are the keys in the destructuring map form |
| 04:04 | muhoo | actually, they both seem to work |
| 04:04 | muhoo | which is what i found surprising |
| 04:05 | muhoo | oh wait, nm, i see |
| 04:07 | muhoo | it's kind of symmetrical, ##(let [{bar :baz} {:baz "bar"}] bar) |
| 04:07 | lazybot | ⇒ "bar" |
| 04:10 | tomoj | I guess if you call building data structures "structuring", then it makes sense |
| 04:11 | tomoj | {:baz "bar"} structures and {bar :baz} destructures |
| 05:00 | ro_st | cemerick: i'm a little confused about how i'd use friend to secure a json rest api |
| 05:00 | cemerick | ro_st: HTTP Basic over SSL is the most common / easiest option. |
| 05:01 | ro_st | http basic? could i use that with a mysql user database? |
| 05:01 | ro_st | which has salted-hashed-passwords? |
| 05:02 | cemerick | sorry; what does mysql have to do with it? |
| 05:02 | ro_st | i want to authenticate users with my json service |
| 05:02 | mittchel | Hey |
| 05:03 | ro_st | and then have that auth information be a part of the request info used in subsequent json calls |
| 05:03 | cemerick | ro_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:05 | cemerick | ro_st: OK, it sounds like you're calling this API from javascript, in a browser then? |
| 05:05 | ro_st | yes |
| 05:05 | cemerick | In that case, presumably the user is already logged in with a session? |
| 05:05 | ro_st | yes, which will also be a json call |
| 05:06 | cemerick | so, you just want the provided interactive-form workflow |
| 05:06 | cemerick | json is a format, not a calling convention or something. |
| 05:08 | ro_st | ok, 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:10 | cemerick | ro_st: yup, authenticate is just more ring middleware, so it should compose with bishop just fine. |
| 05:13 | Mittch | Are you guys recieving this message? Tried to build an IRC client in clojure :o |
| 05:13 | ro_st | yup, we can see you |
| 05:14 | Mittch | Weird stuff I have to type: PRIVMSG #clojure : mymessage and it's not even a private message |
| 05:15 | ivan | that's how IRC works |
| 05:15 | Mittch | ro_sti: Can I try to message you?:P |
| 05:16 | ro_st | sure |
| 05:16 | mittchel | Did it work? lol |
| 05:17 | mittchel | Running 2 clients now hehe |
| 05:20 | Mittch | /me lol |
| 05:20 | mittchel | fails haha |
| 05:21 | mittchel | there we go |
| 05:22 | ro_st | gah why does wildcard ssl cost so damn much? $200 a year is stupid |
| 05:48 | zawzey | hmmm, 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:52 | samaaron | zawzey: what are you reading into? |
| 05:53 | zawzey | samaaron: trying a variety of methods, BufferArrayInput, clojure.java.io/reader |
| 05:53 | samaaron | also where are you reading from? |
| 05:53 | samaaron | a file? |
| 05:54 | zawzey | from nutch: http://nutch.apache.org/apidocs-1.2/org/apache/nutch/protocol/Content.html, the getContent() method |
| 05:55 | zawzey | i'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:55 | samaaron | ok, well this is somethign I've never done - so I'm just shooting blind here |
| 05:55 | samaaron | i did a quick google and this popped up: http://www.coderanch.com/t/277584/Streams/java/Max-Size-Byte-Array |
| 05:55 | samaaron | perhaps it's do do with flushing? |
| 05:58 | zawzey | samaaron: hmm, don't think that's the case, but let me dig a bit into the ByteArrayInputStream. |
| 06:08 | zawzey | Okay, 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:33 | ljos | Is 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:04 | neotyk | hello everyone! |
| 07:07 | samaaron | neotyk: howdy! |
| 07:08 | neotyk | samaaron: hello clojurepunk |
| 07:09 | samaaron | haha |
| 07:09 | neotyk | I'm looking for some early feedback on WebSocket support in http.async.client |
| 07:09 | neotyk | if you have time please tell me what you think of https://gist.github.com/2761440 |
| 07:24 | fliebel | neotyk: Do you have something built-in to put it in a queue/pipe thing rather than a callback? |
| 07:25 | neotyk | fliebel: not yet, would you like to have a lazy-seq for reading received stuff? |
| 07:25 | fliebel | neotyk: I don't know... I'll have to read the arguments for not using lazy seqs for pipes/queues |
| 07:26 | neotyk | fliebel: lamina/channel ? |
| 07:27 | fliebel | neotyk: just anything "statefull", java.util.concurrent.BlckingQueue could also do the job. |
| 07:47 | timvisher | ,(= (long 1) 1) |
| 07:47 | clojurebot | true |
| 07:47 | hyPiRion | Any form of integer is equal to another. |
| 07:47 | timvisher | ,(= 1 (read-strng (pr-str (long 1)))) |
| 07:47 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: read-strng in this context, compiling:(NO_SOURCE_PATH:0)> |
| 07:47 | timvisher | ,(= 1 (read-string (pr-str (long 1)))) |
| 07:47 | clojurebot | true |
| 07:48 | timvisher | hmm |
| 07:48 | timvisher | hyPiRion: that's my expectation too yet i'm seeing a different behavior in my program at the moment |
| 07:48 | hyPiRion | ,(= (long 1) (int 1) (byte 1) (short 1) 1 1N (numerator 1/2)) |
| 07:48 | clojurebot | true |
| 07:48 | timvisher | i'm seeing if i can get it to reproduce |
| 07:48 | timvisher | ,*clojure-version* |
| 07:48 | clojurebot | {:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"} |
| 07:48 | timvisher | maybe it's because i'm on 1.2? |
| 07:48 | hyPiRion | What version of clojure do you have? |
| 07:49 | timvisher | i'm serializing an object to a file and then reading it back in |
| 07:49 | hyPiRion | Probably. I had issues that BigInteger doesn't equal normal integers |
| 07:49 | timvisher | the object has a long `1` in it, but when i compare it to another `1` in a test, it fails |
| 07:49 | hyPiRion | For instance, try this in your repl ##(#{2} (denominator 1/2)) |
| 07:49 | lazybot | ⇒ 2 |
| 07:50 | hyPiRion | It will return nil in clojure 1.2 |
| 07:50 | timvisher | what does that expression even do? |
| 07:50 | timvisher | i'm not used to seeing sets as a function |
| 07:51 | hyPiRion | Sets are just hash maps where the key is also the value |
| 07:51 | timvisher | and you're correct, of course. |
| 07:51 | timvisher | ah, forgot that implementation detail |
| 07:51 | timvisher | hmm, might be time to bite the bullet and upgrade then |
| 07:51 | timvisher | see if that clears this up |
| 07:51 | hyPiRion | Do you use = or do you use == for comparing the numbers? |
| 07:51 | timvisher | = |
| 07:52 | timvisher | don't believe i've ever had an occasion for using == yet |
| 07:52 | hyPiRion | Ah. Well, 1.2 is kind of weird with reading numbers and differences between e.g. BigIntegers and Integers. |
| 07:52 | timvisher | so many of the gotchas in clojure that i see are related to numbers |
| 07:53 | timvisher | i wish the jvm had done a better job of it. hard problem, though, i suppose |
| 07:54 | hyPiRion | It's better in 1.3 though, and I don't think they made any number-changes to 1.4 |
| 07:57 | fliebel | oh, same problem again. It seems since 1.3, = is not the richt tool to compare all numbers. |
| 07:57 | fliebel | == works |
| 08:01 | hyPiRion | fliebel: That's just weird. |
| 08:02 | fliebel | hyPiRion: 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:05 | hyPiRion | fliebel: Yeah, and it's doomed to make people confused. |
| 08:07 | fliebel | I agree... I'm trying to figure out what's going on |
| 08:10 | fliebel | hyPiRion: so, = calls number/equal, while == calls number/equiv |
| 08:11 | fliebel | https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Numbers.java#L205 |
| 08:11 | fliebel | https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Util.java#L23 |
| 08:14 | fliebel | this means that for 2 numbers to compare using =, they need to be of the same type. |
| 08:14 | fliebel | &(= 2 2.0) |
| 08:14 | lazybot | ⇒ false |
| 08:14 | fliebel | &(== 2 2.0) |
| 08:14 | lazybot | ⇒ true |
| 08:15 | fliebel | so, it is rather simple, == does a lot more work. |
| 08:16 | hyPiRion | fliebel: Well, it's not same type either |
| 08:16 | hyPiRion | &(= (Long. 2) (BigInteger. "2")) |
| 08:16 | lazybot | ⇒ true |
| 08:17 | fliebel | wut... |
| 08:17 | hyPiRion | yeah. |
| 08:18 | fliebel | I'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:19 | hyPiRion | Yeah, most likely. |
| 08:19 | dbushenko | hi all! |
| 08:19 | fliebel | here: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Numbers.java#L213 |
| 08:19 | dbushenko | does anyone have troubles while embedding the clojurescript repl in a web-page? |
| 08:19 | dbushenko | I'm trying the example from the clojurescript bundle, proceeding step-by-step |
| 08:19 | dbushenko | and the repl simply doesn't connect to the index.html |
| 08:20 | dbushenko | while accessing http://localhost:9000 does the job, and the repl connects |
| 08:20 | dbushenko | what could that be? |
| 08:21 | hyPiRion | fliebel: 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:21 | fliebel | yea... |
| 08:22 | hyPiRion | dbushenko: I wish I could help you, but unfortunately your guess is probably better than mine. |
| 08:22 | hyPiRion | Tutorials and manuals usually helps, though. |
| 08:22 | dbushenko | yes, that's what I'm doing: I'm trying the samples and tutorials |
| 08:22 | fliebel | &(clojure.lang.Numbers/category 3) |
| 08:22 | lazybot | java.lang.IllegalArgumentException: No matching method: category |
| 08:23 | dbushenko | but no idea why I can't connect to a web-page.. |
| 08:23 | fliebel | ... why doesn;t that work. |
| 08:25 | hyPiRion | fliebel: here's the source, though https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Numbers.java#L978 |
| 08:25 | fliebel | hyPiRion: I now, but I should be able to call it, right? |
| 08:27 | hyPiRion | fliebel: well... yes |
| 08:27 | xeqi | its package level |
| 08:28 | hyPiRion | oh, durr. |
| 08:28 | fliebel | xeqi: meaning? |
| 08:28 | hyPiRion | it's not public, it's blank |
| 08:28 | fliebel | :( |
| 08:28 | hyPiRion | So you can only call it from the package it's defined in. |
| 08:28 | fliebel | oh, that package level |
| 08:29 | xeqi | or you have to wall hack it |
| 08:31 | timvisher | hyPiRion: 1.4.0 fixes it, thanks |
| 09:17 | kzar | ,(partition 100 [1 2 3]) |
| 09:17 | clojurebot | () |
| 09:17 | kzar | Can anyone explain that? ^^ (I want it to return '((1 2 3)) ) |
| 09:18 | hyPiRion | kzar: try partition-all |
| 09:18 | hyPiRion | ,(partition-all 100 [1 2 3]) |
| 09:18 | clojurebot | ((1 2 3)) |
| 09:18 | hyPiRion | ,(partition-all 2 [1 2 3]) |
| 09:18 | clojurebot | ((1 2) (3)) |
| 09:18 | kzar | hyPiRion: Nice, thanks |
| 09:18 | hyPiRion | You're welcome |
| 09:47 | bhenry | anyone else have problems with clojurescript keyword lookup in ie8? |
| 09:49 | bhenry | http://imgur.com/vnmDJ results of (js/alert (apply str (keys user)) |
| 09:53 | point9 | When I run repl from lein, the var "realized?" couldn't be found. Why is that? |
| 09:53 | neotyk | bhenry: try (js/alert (apply name (keys user))) |
| 09:54 | neotyk | point9: it must be old clojure, before 1.4 |
| 09:54 | point9 | oh... |
| 09:56 | bhenry | neotyk, that's not my point. (:username user) fails in ie8, because of the slash |
| 09:56 | uraimo | to upgrade from prev3 to prev4 do i need to do something else other than downloading the new lein script? |
| 09:57 | uraimo | ops, wrong channel :) |
| 09:57 | neotyk | bhenry: what slash? |
| 09:59 | bhenry | neotyk, did you look at the way the keywords are alerted in the ie alert box? :/keyword as opposed to :keyword in chrome |
| 10:00 | neotyk | bhenry: keywords and symbols are strings in cljs, they just start with magic |
| 10:01 | bhenry | well then can you tell me why (:username user) doesn't work in ie8, but does work in all other browsers. |
| 10:02 | neotyk | bhenry: no idea about IE8, sorry |
| 10:03 | neotyk | bhenry: if you would use (get user key) would it work? |
| 10:03 | bhenry | i'll try. gotta go for now |
| 10:08 | bderooms_ | is anything optimized in the clojure sequences? |
| 10:08 | bderooms_ | such as getting the last.. |
| 10:08 | bderooms_ | or is that O^n |
| 10:13 | si14 | guys, where I can find any example of web-gui on ClojureScript? |
| 10:13 | bobry | bderooms_: depends on the sequence I guess, it's clearly O(n) for lists |
| 10:18 | hyPiRion | bderooms_: constant time for vectors. Reverse is also constant time. |
| 10:18 | hyPiRion | (for vectors, that is) |
| 10:20 | chouser | rseq, not reverse |
| 10:21 | madsy | Is 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:25 | tmciver | madsy: looks like *print-length* might do what you want. |
| 10:26 | madsy | tmciver: I just found it on clojuredocs too. Thanks :) |
| 10:29 | tmciver | madsy: fyi: apropos is good for finding that kind of info. I ran (apropos 'print) in the repl. |
| 10:38 | bobry | did anyone get a stack overflow, while compiling cljs? |
| 10:40 | balint | wanted to try the new reducers library, cloned the repo, built the jar with mvn install and then got this when requiring the reducers: |
| 10:40 | balint | CompilerException java.lang.ClassNotFoundException: jsr166y.ForkJoinPool, compiling:(clojure/core/reducers.clj:56) |
| 10:41 | balint | do I need a certain version of the JVM for that to work? |
| 10:41 | balint | I have 1.6.0_31 |
| 10:42 | hyPiRion | I've seen some commits in which they say something about 1.7, though I'm unsure whether that leaves 1.6 incompatible. |
| 10:43 | hyPiRion | Let me see. |
| 10:43 | pipeline | balint: 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:43 | fliebel | Hm, I read it's a weird dependency problem. |
| 10:44 | fliebel | the jsr thing is declared as an optional dep, iirc |
| 10:46 | balint | pipeline: thank you, that fixed it |
| 10:47 | balint | in 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:57 | TimMc | clojure 1.5? o.o |
| 10:57 | TimMc | ,*clojure-version* |
| 10:57 | clojurebot | {:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"} |
| 10:58 | TimMc | Oh, huh. Didn't realize 1.4 had been released. |
| 11:00 | S11001001 | TimMc: don't worry, not too much changed |
| 11:01 | fliebel | &(:qualifier *clojure-version*) |
| 11:01 | lazybot | ⇒ nil |
| 11:01 | fliebel | &*clojure-version* |
| 11:01 | lazybot | ⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil} |
| 11:04 | S11001001 | '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:11 | TimMc | Yeah. sounded like mostly bugfixes. |
| 11:12 | TimMc | S11001001: Did you make it to the one at Basho? I really liked the talk on Kiln. |
| 11:12 | S11001001 | yeah |
| 11:12 | S11001001 | I sat next to the projector |
| 11:13 | hyPiRion | You lucky americans. |
| 11:15 | TimMc | hyPiRion: 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:16 | hyPiRion | TimMc: Oh. I'd probably go to any (sufficiently large) Clojure thing within Europe if we had something large here. |
| 11:17 | hyPiRion | But that's probably because there's no supply for these things over here, at least not in Norway. |
| 11:18 | S11001001 | I do hope that Basho does indeed offer the space for more meetings |
| 11:27 | TimMc | hyPiRion: There's EuroClojure, right? |
| 11:28 | TimMc | Also, I saw a really awesome job posting in Helsinki for controlling industrial robots in Clojure. |
| 11:28 | TimMc | Now that's Finland, but it's still in your neck of the woods. |
| 11:35 | metajack | that's zenrobotics i think. i walked past their building whenever i was in Helsinki |
| 11:40 | TimMc | SO. COOL. |
| 11:41 | gfredericks | why does clj-http require a :length parameter for input-stream bodies? |
| 11:41 | TimMc | What's the catch, besides being in Finland? |
| 11:42 | TimMc | OMG: "Some people see a problem and think "I know, I'll use Java!" Now they have a ProblemFactory." |
| 11:42 | muhoo | gfredericks: ram allocation? |
| 11:42 | muhoo | bytaarray allocation, specifically, i'd guess |
| 11:42 | dakrone | gfredericks: because InputStreamEntitys for Apache require the length of the stream passed in |
| 11:43 | metajack | TimMc: no idea. I was working for another Finnish company, but remotely. |
| 11:43 | metajack | Helsinki is nice, but winter is awful |
| 11:43 | gfredericks | dakrone: so there's no way to stream data without knowing the length up front? |
| 11:43 | dakrone | gfredericks: https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/entity/InputStreamEntity.html |
| 11:43 | metajack | the constant darkness was super depressing |
| 11:43 | TimMc | Yes, that would be my concern. |
| 11:43 | metajack | i visited in december and basically no one ever did anything. everyone just stayed indoors and was sad. |
| 11:43 | dakrone | gfredericks: I can look into it, but right now there's not |
| 11:44 | hyPiRion | TimMc: Oh, there is? I'll check it out. |
| 11:44 | gfredericks | dakrone: I think I can work it out, no worries |
| 11:44 | dakrone | gfredericks: if you find a way, patches welcome ;D |
| 11:46 | hyPiRion | and metajack: It's horribly dark in Fennoscandia. |
| 11:47 | gfredericks | dakrone: do you know for sure that HTTP allows it? |
| 11:47 | hyPiRion | I suppose it's colder in Finland though. |
| 11:47 | dakrone | gfredericks: I don't for sure, it may actually require length when sending data, another thing to add to the TODO |
| 11:48 | gfredericks | dakrone: I mean the HTTP protocol |
| 11:48 | dakrone | gfredericks: yea, that's what I meant also |
| 11:48 | gfredericks | er...the HTT protocol? |
| 11:48 | TimMc | HTTP allows for streaming |
| 11:48 | gfredericks | TimMc: without length, right? |
| 11:48 | TimMc | Has to. |
| 11:49 | gfredericks | okay thought so |
| 11:49 | gfredericks | TimMc: in a request, right? |
| 11:50 | muhoo | gfredericks: dakrone: transfer-coding = "chunked", perhaps? http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html |
| 11:52 | wkmanire | Gooooood morning. |
| 12:04 | gfredericks | wkmanire: morning?? but in time zone X it is actually a bad morning! |
| 12:04 | wkmanire | nah |
| 12:04 | wkmanire | Today is an awesome day. |
| 12:04 | wkmanire | I woke up and everything. |
| 12:04 | TimMc | wkmanire: I think it is already tomorrow some places. |
| 12:05 | gfredericks | man it would be weird if moods were globally synchronized |
| 12:05 | wkmanire | I can't imagine all 3 billion women on the rag at the same time. |
| 12:05 | wkmanire | :( |
| 12:06 | pipeline | wkmanire: shame on you |
| 12:06 | wkmanire | pipeline: :D |
| 12:06 | TimMc | pipeline: For poor imagination? |
| 12:06 | wkmanire | I'm shameless |
| 12:07 | pipeline | if no one speaks up, sexist bullshit on irc self-perpetuates |
| 12:07 | pipeline | so, uh, shame. picture the finger rubbing motion. |
| 12:07 | wkmanire | nothing sexist about that. |
| 12:07 | wkmanire | it's a well known fact. |
| 12:07 | lucian | plenty sexist about that |
| 12:07 | wkmanire | I just got in trouble with my lady because we ran out of rice. |
| 12:07 | gfredericks | (inc pipeline) |
| 12:07 | lazybot | ⇒ 1 |
| 12:07 | pipeline | wkmanire: well, this is also why we have an /ignore function. get bent |
| 12:07 | wkmanire | pipeline: Feel free :) |
| 12:08 | kzar | Wow, this is the first time I've seen anything like this in #clojure |
| 12:08 | TimMc | Women 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:09 | TimMc | pipeline: Were you reacting to "on the rag" or the notion that menstrual cycles (statistically!) affect mood? |
| 12:09 | foxdonut | please stop this topic now. thank you. |
| 12:09 | TimMc | k |
| 12:09 | wkmanire | Must be monday morning. |
| 12:10 | wkmanire | day/evening |
| 12:10 | geoffeg | let's talk about something like: beer! |
| 12:10 | TimMc | wkmanire: nooooo, that's how this got started |
| 12:10 | TimMc | gfredericks: Wait, this is about HTTP *request* length? |
| 12:10 | si14 | why there are so many warnings when one builds Domina? |
| 12:10 | si14 | WARNING: Use of undeclared Var domina/.DomContent at line 459 /home/si14/repos/domina/src/cljs/domina.cljs |
| 12:10 | wkmanire | TimMc: I'm trying to get back on topic and do something recursive. |
| 12:10 | gfredericks | TimMc: yep |
| 12:11 | gfredericks | TimMc: forwarding a request |
| 12:11 | TimMc | For some reason I was thinking about responses. ANyway, you should be able to copy the headers, yeah? |
| 12:12 | gfredericks | TimMc: content-length seems to be nil :/ |
| 12:13 | muhoo | wkmanire: well, to do somthing recursive, do something recursive :-) |
| 12:14 | wkmanire | muhoo: It's not as easy as you might thing you might think. |
| 12:17 | tmciver | gfredericks: 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:17 | dakrone | hmm, I wonder if I could get away with putting null for the length of the input stream |
| 12:17 | gfredericks | it's a primitive long isn't it? |
| 12:17 | wkmanire | tmciver: I've had chrome reject responses for having an incorrect content length. |
| 12:18 | wkmanire | tmciver: It was for JSON response. |
| 12:18 | wkmanire | a JSON response* |
| 12:19 | dakrone | yes |
| 12:31 | gfredericks | is there a standard way for lein-ring to reload files on changes? |
| 12:31 | weavejester | gfredericks: It does that by default |
| 12:32 | weavejester | You can turn it off by setting the :middleware option |
| 12:33 | gfredericks | weavejester: well I've wasted a million years of my life by not asking about that earlier |
| 12:33 | weavejester | Though I'm going to change that a little in the next release so there are :auto-reload and :auto-refresh options |
| 12:33 | weavejester | gfredericks: Ohhhh :) |
| 12:34 | weavejester | I did mention it in the readme, but it's only a sentence |
| 12:34 | gfredericks | weavejester: and/or reading the readme |
| 12:35 | AeroNotix | ` |
| 12:35 | gfredericks | _ |
| 12:37 | pjstadig | | |
| 12:38 | goodieboy | anyone know of an emacs plugin that will allow me to see all of the callers of a given function? |
| 12:38 | gfredericks | swank-clojure has a grep-based version of that |
| 12:38 | gfredericks | it is mentioned in the swank-clojure readme |
| 12:38 | goodieboy | gfredericks: cool ok, i'll check it out. thanks! |
| 12:40 | technomancy | it's not very good |
| 12:40 | technomancy | I guess the readme should also mention that fact |
| 12:42 | S11001001 | ah well, finding callers of a function is halting problem :) |
| 12:42 | gfredericks | technomancy: either that or annotate all the other features with "it's very good" |
| 12:42 | technomancy | gfredericks: that would work |
| 12:43 | gfredericks | S11001001: is it? the question isn't "will the function ever get called if I run the program" |
| 12:43 | nDuff | How can one get the JDK's tools.jar into the classpath when using leiningen? |
| 12:44 | S11001001 | gfredericks: (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:45 | gfredericks | S11001001: I guess for these purposes "mentioning" is as good as calling |
| 12:45 | ibdknox | you can only find usages reliably |
| 12:45 | S11001001 | aye |
| 12:46 | technomancy | ibdknox: by piggybacking on the var's cache of usages it uses to make recompilation trickle down? |
| 12:47 | ibdknox | technomancy: you can do it without loading the code if you want to |
| 12:48 | technomancy | I 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:48 | technomancy | I don't think the static analysis approach would be very reliable |
| 12:48 | technomancy | too easy to confuse it with macros |
| 12:48 | hiredman | vars are stored in fields on fns |
| 12:49 | ibdknox | hiredman: hm? |
| 12:49 | ibdknox | as in all the vars a fn uses? |
| 12:49 | hiredman | fns have a "constant pool" of fields |
| 12:49 | hiredman | yes |
| 12:49 | ibdknox | oh neat, I didn't know that |
| 12:49 | technomancy | ibdknox: that's the only way you can recompile a defn and have the changes work for code that's already compiled. |
| 12:49 | ibdknox | right |
| 12:50 | hiredman | the constant pool holds various things, vars, different kinds of literals |
| 12:50 | hiredman | technomancy: that is not true |
| 12:51 | hiredman | I recall rich's description of having a sort of checkpoint mechanism, but as far as I know that isn't there |
| 12:51 | hiredman | fns still deref the vars everytime |
| 12:52 | technomancy | I thought that changed in 1.3 since it wreaked havoc on hotspot's inlining |
| 12:52 | hiredman | nope |
| 12:52 | hiredman | the only change was the removal of the sort of "is bound?" check in the general case |
| 12:53 | technomancy | huh; so the deref itself could still be inlined; that's cool. |
| 12:53 | hiredman | the emitted code doesn't actually call deref |
| 12:54 | hiredman | it calls .getRoot or .getRawRoot depending if the var is dynamic or not |
| 12:54 | hiredman | huh |
| 12:54 | hiredman | no there is no .getRoot anymore |
| 12:54 | technomancy | getRoot will never respect binding though |
| 12:54 | pjstadig | yeah a non dynamic var is compiled directly to a call to .getRawRoot |
| 12:55 | pjstadig | it doesn't even bother with the thread locals |
| 12:55 | pjstadig | which allows hotspot to inline it |
| 12:55 | technomancy | but it's the moral equivalent of a deref anyway |
| 12:55 | pjstadig | well deref would check the thread locals though? |
| 12:57 | technomancy | sure, I mean it's just an optimization on deref since it knows it will never have to check thread locals |
| 12:59 | pjstadig | technomancy: i guess i don't follow you |
| 13:00 | technomancy | I guess it's just a matter of how much artistic license the term "moral equivalent" grants you =) |
| 13:00 | clojurebot | Licenser is the man who puts licenses on everything |
| 13:13 | wkmanire | Well 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:14 | ibdknox | technomancy: 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:15 | banseljaj | wkmanire: Did I miss something? |
| 13:15 | technomancy | ibdknox: one of your dependencies is being a jerk and claiming to not work with newer versions; `lein deps :tree` should track it down |
| 13:16 | wkmanire | banseljaj: I made a comment in poor taste and offended at least one person. |
| 13:16 | technomancy | ibdknox: once you find it, submit a bug report with that lib; in the mean time use :exclusions to shut it up |
| 13:16 | wkmanire | banseljaj: No, you didn't miss anything. |
| 13:16 | ibdknox | technomancy: great, thanks |
| 13:17 | wkmanire | banseljaj: Did you get your Suse distro working? |
| 13:17 | banseljaj | wkmanire: Yeah. It's working at a basic level. |
| 13:17 | wkmanire | banseljaj: So you boot it up and you have a full functionaly (pardon the pun) clojure dev environment ready to rock and roll? |
| 13:17 | wkmanire | functional* |
| 13:18 | foxdonut | wow, SuSE is still going? |
| 13:18 | banseljaj | I'm trying to see what other softwares are needed and setup the basic dev envrironment |
| 13:19 | banseljaj | wkmanire: 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:19 | banseljaj | foxdonut: apparently so. :D |
| 13:19 | banseljaj | Any experienced clojure dev that wants to test or contributes shell scripts is welcome. :) |
| 13:19 | technomancy | banseljaj: do you have any experience with rpm packaging? |
| 13:20 | foxdonut | banseljaj: heh. last time I used SuSE, it came on CDs and I was on 56k modem :) |
| 13:20 | banseljaj | technomancy: I'd say beginner level experience. Plus, I learn fast. And I was actually looking into making a leiningen rpm. :) |
| 13:21 | banseljaj | foxdonut: that was true for me too until yesterday. :D |
| 13:21 | technomancy | banseljaj: would you submit it upstream or just use it for your own purposes? |
| 13:21 | foxdonut | banseljaj: what were you using before yesterday? |
| 13:21 | banseljaj | technomancy: I'd probably set up my own repo. |
| 13:22 | banseljaj | foxdonut: I was and still use debian based systems. |
| 13:22 | technomancy | banseljaj: suse doesn't use yum, does it? |
| 13:22 | banseljaj | I am just developing a clojure dev solution using OpenSUSE |
| 13:22 | banseljaj | technomancy: Packman |
| 13:22 | banseljaj | it *can* use yum. |
| 13:22 | technomancy | o_O |
| 13:22 | banseljaj | Is there a problem? |
| 13:22 | technomancy | I thought that was arch? |
| 13:23 | Bronsa | that's pacman |
| 13:23 | foxdonut | so did I |
| 13:23 | banseljaj | technomancy: that's pacman. Without the 'k' |
| 13:23 | banseljaj | :D |
| 13:23 | technomancy | geez |
| 13:23 | foxdonut | pff! |
| 13:24 | foxdonut | TOSFYPMN |
| 13:24 | technomancy | it would be nice to offer a repo, but rpm distros are pretty fragmented from what I understand. |
| 13:24 | foxdonut | think of something else for your package manager name! |
| 13:24 | technomancy | everyone invents their own repo format |
| 13:24 | banseljaj | I am currently looking into a full small footprint hand-crafted linux. |
| 13:24 | banseljaj | I'd probably use debs |
| 13:24 | banseljaj | debs are cool. :D |
| 13:24 | banseljaj | </11th doctor> |
| 13:24 | technomancy | yeah, this is the first time I've heard the word SuSE in years |
| 13:25 | technomancy | well anyway, some people might find a raw rpm file useful even if it's not in a repo |
| 13:26 | technomancy | banseljaj: so if you end up with something, could you add it to the packaging page of the wiki? |
| 13:26 | banseljaj | technomancy: that would have been my first move. :) |
| 13:26 | technomancy | cool |
| 13:26 | wkmanire | technomancy: Really? I see it mentioned all the time in the couple of linux magazines that circulate in Vegas. |
| 13:26 | technomancy | obviously I don't travel in the right circles |
| 13:27 | banseljaj | technomancy: are you a CEO? |
| 13:27 | wkmanire | But I know what you mean. The last time I tried SUSE, Lindows was still popular. |
| 13:27 | hiredman | do linux magazines still circulate anywhere else in the country? |
| 13:27 | technomancy | haha; no |
| 13:27 | banseljaj | If not, then yes, you don't. :) |
| 13:27 | banseljaj | SUSE is only corporate now. |
| 13:27 | technomancy | all my knowledge of distros comes from http://lein-survey.herokuapp.com/results |
| 13:28 | banseljaj | I only saw it running as a special instance on AWS |
| 13:28 | technomancy | according 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:31 | banseljaj | technomancy: That's distroist. |
| 13:31 | technomancy | it's OK; I also ignore Arch |
| 13:31 | technomancy | because apparently Arch users get grumpy if things are too easy. |
| 13:32 | tmciver | banseljaj: some of his best friends are distros. |
| 13:32 | banseljaj | lol |
| 13:32 | banseljaj | I probably would roll ut a complete new distro, but it's too much work for a single man. |
| 13:32 | banseljaj | s/ut/out/ |
| 13:35 | pipeline | technomancy: for RPMs you can pretty much just offer RHEL and ignore the others |
| 13:36 | pipeline | technomancy: 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:38 | wkmanire | banseljaj: LFS? |
| 13:38 | banseljaj | wkmanire: Yeah. |
| 13:38 | wkmanire | banseljaj: I liked the idea of LFS but I want to be able to use a package manager like aptitude. |
| 13:39 | wkmanire | banseljaj: If you can use aptitude on your system then you're basically running debian. At least from my point of you. |
| 13:39 | muhoo | if i use lein2 check, all that aot stuff isn't going to hang around, interefering with other things, is it? |
| 13:39 | banseljaj | I'm pretty sure that can be arranged. that's what I have in mind. |
| 13:39 | banseljaj | for now, I think someone other than me should check the SUSE install. |
| 13:40 | technomancy | pipeline: cool; thanks for the confirmation |
| 13:41 | technomancy | pipeline: 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:41 | muhoo | pipeline: debian is "inconsequentially small"? i dunno, seems pretty widespread to me. |
| 13:41 | pipeline | muhoo: talking about rpm distributions |
| 13:41 | pipeline | technomancy: 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:42 | pipeline | technomancy: it DOES help to take rpm specfiles from old fedora releases and adapt them for new code on RHEL |
| 13:42 | pipeline | technomancy: the problem is actually worse for "non-native" bits. packaging standards for python, java etc evolve too quickly inside fedora |
| 13:42 | technomancy | pipeline: when your dependencies consist of a JVM and rlwrap trailing by two years seems like no big deal though |
| 13:43 | technomancy | Java's rate of evolution makes RHEL look fast =) |
| 13:43 | pipeline | you misunderstand me |
| 13:43 | pipeline | the packaging standards |
| 13:43 | pipeline | change rapidly |
| 13:43 | technomancy | oh, sure |
| 13:43 | pipeline | fedora is in many ways a test bed for new ideas in RHEL |
| 13:43 | banseljaj | technomancy: That webapp. The lein survey. that's pretty tiny compared to other frameworks I have worked wiht. |
| 13:43 | pipeline | so fedora picks up and abandons two or three packaging standards for non-C items in the time between RHEL releases ;) |
| 13:43 | technomancy | heh |
| 13:43 | technomancy | banseljaj: oh, did you check out the source? |
| 13:44 | technomancy | banseljaj: it's pretty simplistic; only 3 endpoints really |
| 13:44 | banseljaj | technomancy: Yeah. I'm looking at it right now. |
| 13:44 | banseljaj | and "HOLY SHIT IT'S TINY!" |
| 13:45 | technomancy | write a row in postgres and serve up some charts; not a lot going on =) |
| 13:46 | muhoo | banseljaj: webdev in clojure is wonderfully compact |
| 13:46 | banseljaj | technomancy: I work with rails. trust me, it takes a lot of work to get it working there. :( |
| 13:47 | muhoo | per rhickey: "gem install hairball" |
| 13:47 | banseljaj | technomancy: Would you mind explaining a tiny thing on your code.? |
| 13:48 | technomancy | sure; what's up? |
| 13:49 | banseljaj | technomancy: 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:49 | technomancy | banseljaj: in that case it's the type of the question |
| 13:49 | pipeline | technomancy: 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:49 | clojure-newcomer | Hi 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:50 | technomancy | banseljaj: which is used to dispatch to the correct multimethod, but once you're in the method body you don't care |
| 13:50 | banseljaj | technomancy: Oh. Nice. |
| 13:50 | clojure-newcomer | basically just want to print some or all details of every element in collection/sequence |
| 13:50 | technomancy | pipeline: it's up to whomever cares enough to package it =) |
| 13:50 | technomancy | pipeline: I was lucky to have a lot of help with Debian, but it's great to have it included in the official repos |
| 13:51 | muhoo | clojure-newcomer: doseq? |
| 13:51 | banseljaj | technomancy: well, the debs still don't have 2.0 :( |
| 13:51 | technomancy | banseljaj: yeah, unfortunately the number of dependencies shot way up in 2.0 |
| 13:51 | technomancy | but 2.0 isn't even finished anyway |
| 13:51 | clojure-newcomer | muhoo: I tried a doseq, but failed |
| 13:52 | banseljaj | technomancy: it works fine for me. |
| 13:52 | technomancy | we have a long way to go before 2.0 is done |
| 13:52 | banseljaj | technomancy: Actually, it's a wonderful tool. Thank you for that. :) |
| 13:52 | clojure-newcomer | I tried something like (doseq [author get-authors] (println author)) |
| 13:52 | technomancy | sure =) |
| 13:52 | banseljaj | I like the cclojure community. :D |
| 13:56 | banseljaj | The results.clj makes about 30% sense to me. But then again, mY love affair with clojure is barely 72 hours |
| 13:57 | technomancy | there's a lot of crazy data-wrangling stuff in there; getting numbers in the right format for incanter |
| 14:02 | banseljaj | technomancy: How much java knowledge is required to properly use clojure? |
| 14:02 | technomancy | banseljaj: depends what you want to do |
| 14:03 | clojure-newcomer | can anyone help me with the doseq or equipvalent necessary for me to inspect : http://pastebin.com/sTv0RFz8 ? |
| 14:03 | banseljaj | technomancy: My Primary hobby is making web-apps. Secondarily, CLI apps, thirdly, GUI apps. |
| 14:03 | technomancy | you 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:03 | banseljaj | technomancy: note: "hobby". Means I don't deal with deadlines and can work as long as I want to. :) |
| 14:03 | muhoo | and java stacktraces :-) |
| 14:04 | technomancy | banseljaj: you'll be ignoring Java until you need to pull in a Java library. |
| 14:04 | banseljaj | technomancy: I can read stacktraces. and javadocs. |
| 14:04 | banseljaj | technomancy: How often does that happen. I mean how mature is clojure's own library/plugin/whatchamacallit system |
| 14:05 | technomancy | banseljaj: 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:06 | banseljaj | clojure's just 4 years old? :D |
| 14:06 | banseljaj | s/:D/D: |
| 14:07 | technomancy | maybe 5? |
| 14:07 | banseljaj | Java as a pretty strong library base. |
| 14:08 | technomancy | 4½ |
| 14:09 | banseljaj | it'll be the youngest language I'm learning then. |
| 14:11 | AeroNotix | can anyone make a comparison between clojure 6 months ago and clojure today? |
| 14:11 | AeroNotix | I 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:11 | AeroNotix | which kind of made it annoying to use |
| 14:12 | AeroNotix | I 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:13 | technomancy | it'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:14 | AeroNotix | technomancy: What I found extremely annoying was the very weird way of interacting with files |
| 14:14 | AeroNotix | technomancy: I can't remember off the top of my head but it seemed strange there were regex `primitives` but not filereading `primitives` |
| 14:15 | AeroNotix | built-in funcs, sorry |
| 14:15 | technomancy | you mean the fact that the file functions aren't in clojure.core? |
| 14:15 | technomancy | they're definitely built-in |
| 14:15 | AeroNotix | technomancy: been a while but was it 'slurp'? |
| 14:16 | technomancy | slurp is the only one in clojure.core namespace; the rest are in clojure.java.io |
| 14:16 | technomancy | but using clojure.java.io is not "using Java", it's just using io functions that are implemented on the JVM |
| 14:17 | AeroNotix | iirc 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:17 | AeroNotix | Anyway, it's no bother. File-reading is a small part |
| 14:18 | technomancy | yeah, slurp isn't meant for nontrivial purposes |
| 14:18 | AeroNotix | technomancy: and that's what got me |
| 14:18 | technomancy | well that hasn't changed in 6 months =) |
| 14:18 | AeroNotix | ok then |
| 14:18 | technomancy | but you might have a better time learning now that the oreilly book is out |
| 14:18 | AeroNotix | also, I picked up the completely *wrong* book to learn about clojure |
| 14:18 | AeroNotix | technomancy: been looking at that |
| 14:19 | AeroNotix | I picked up Practical Clojure, what a money grab |
| 14:19 | gtrak | is there a 'let' that'll dump its bindings and values into a map? |
| 14:19 | foxdonut | AeroNotix: not a fan either. |
| 14:20 | AeroNotix | foxdonut: It just seemed like an api doc to me |
| 14:20 | AeroNotix | foxdonut: very little theory |
| 14:20 | foxdonut | AeroNotix: I blame Apress. |
| 14:20 | AeroNotix | foxdonut: well, I've had good books by Apress, "The Definitive Guide To Django" is amazing |
| 14:21 | AeroNotix | foxdonut: I really should have waited for the O'Reilly book, never gone wrong with them |
| 14:21 | gfredericks | is there a built in java class-or-whatever for cloning an inputstream? |
| 14:21 | foxdonut | AeroNotix: to be clear: not all Apress books are bad. many books that are bad/rushed to market are from Apress. |
| 14:21 | AeroNotix | foxdonut: I'll keep that in mind :) |
| 14:22 | technomancy | Apress's CL book is great |
| 14:22 | AeroNotix | technomancy: the common lisp one? |
| 14:22 | gtrak | I want like the opposite of destructuring, being to reference other bindings as i'm building the map like a normal let |
| 14:23 | gtrak | being able* |
| 14:23 | foxdonut | technomancy: my theory is that if the author is good, Apress won't get in the way :) |
| 14:23 | technomancy | AeroNotix: yeah |
| 14:23 | banseljaj | technomancy: How hard would it be to keep a local repo of all the clojure libraries? How much space? |
| 14:24 | technomancy | banseljaj: probably not impossible. check out http://clojuresphere.herokuapp.com |
| 14:24 | AeroNotix | I 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:24 | xeqi | gfredericks: cloning an inputstream? |
| 14:24 | AeroNotix | I ftp from it at like 10mb/s |
| 14:25 | gfredericks | xeqi: so it can be read twice; preferably without needing to keep more in memory than the difference between the two read points |
| 14:25 | technomancy | banseljaj: no way you'd want to put that on an iso for everyone though |
| 14:25 | gtrak | hmm.. like, (let {a 1 b (inc a)}) |
| 14:25 | gtrak | would return {:a 1 :b 2} |
| 14:26 | banseljaj | technomancy: No. But you can put a script which anyone can use to get them. |
| 14:26 | hyPiRion | A let which returns a map? |
| 14:26 | gfredericks | gtrak: wouldn't be too hard to make a macro that does that |
| 14:26 | gtrak | yea, I'm thinking about it |
| 14:26 | gtrak | surprised it's not a already a thing, though? |
| 14:27 | Chousuke | what would you use that for? :/ |
| 14:27 | technomancy | gtrak: you have to use a macro |
| 14:27 | technomancy | see the implicit &env arg |
| 14:27 | gtrak | just to avoid (let [a 1 b (inc a)] {:a a :b b}), it's a common thing to write |
| 14:29 | gtrak | &env arg, interesting |
| 14:29 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: env in this context |
| 14:29 | gfredericks | (defmacro let-map [& pairs] (let [names (map first (partition 2 pairs))] `(let [~@pairs] (zipmap [~@(map (comp keyword name) names)] [~@names])))) |
| 14:29 | gtrak | ha, awesome :-) |
| 14:32 | fliebel | gfredericks: How would you use it? |
| 14:32 | gfredericks | (let-map a 1 b (inc a)) |
| 14:33 | intuneontime | hello, 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:35 | tmciver | intuneontime: I get the same result for both . . . |
| 14:36 | gfredericks | intuneontime: it would only print the 1 and 2 the first time -- are you doing it repeated times? |
| 14:37 | intuneontime | oh i see, it only happens the first time it's evaluated |
| 14:37 | intuneontime | thank you |
| 14:37 | gtrak | gfredericks: that's brilliant, though I think I like it more without the &, since it looks more like a let |
| 14:38 | fliebel | Does anyone know what Greenspun's tenth rule is? |
| 14:38 | gfredericks | gtrak: yeah, whatever you like |
| 14:38 | S11001001 | If 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:39 | technomancy | brucio's law =) |
| 14:39 | S11001001 | even more important than whatever that Greenspan guy said |
| 14:39 | fliebel | Any sufficiently complicated Clojure program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp. |
| 14:40 | hiredman | who wants all of common lisp? |
| 14:41 | fliebel | still on page 3... |
| 14:41 | gtrak | let-map along with destructuring is a multiple-return-value accelerator |
| 14:50 | gfredericks | gtrak: 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:50 | gfredericks | not sure if that'd be useful though |
| 14:50 | gtrak | it also looks like destructuring would still work :-) |
| 14:50 | gtrak | within the let-map |
| 14:50 | gfredericks | ehhhh |
| 14:51 | gfredericks | doubt it |
| 14:51 | gfredericks | the keys it has to turn into keywords |
| 14:51 | gtrak | ah, damn |
| 14:51 | gtrak | you're right |
| 14:51 | gfredericks | it's conceivable though |
| 14:52 | gtrak | maybe the &env is a clue |
| 14:53 | gtrak | use a normal let to do the destructuring, then at the end, assemble the elements with &env |
| 14:56 | gfredericks | yeah; if you care about shadowing you'll have to check the vals of the &env with identical? |
| 14:59 | gtrak | it might require a second macro, if I use macrolet that would mess it up :-) |
| 15:07 | eggsby | so 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:07 | nDuff | eggsby: that's one way; there's also agents |
| 15:07 | nDuff | eggsby: ...what's the actual use case? |
| 15:08 | nDuff | ...and futures... |
| 15:09 | eggsby | Oh I'm doing some 'learn clojure' course and the task is to have concurrent operations on some world map |
| 15:10 | nDuff | eggsby: 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:10 | eggsby | threaded game of life, eh |
| 15:11 | rhc | eggsby: i wrote something similar to that here: http://matthavener.com/matthavener/banksim |
| 15:11 | rhc | its sorta like the "ants" program hickey wrote |
| 15:11 | eggsby | basically 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:11 | eggsby | thank you rhc I will look at it |
| 15:11 | eggsby | I like the fact that this course wants me to do interesting things, I don't like that there was absolutely no teaching involved :| |
| 15:12 | rhc | eggsby: banksim doesn't 'tick' but all the actors (trucks moving money) do sleep for a fixed amount of time |
| 15:12 | rhc | but you could easily make that per-truck, or random-per-move |
| 15:13 | rhc | eggsby: 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:13 | nDuff | ...ahh -- Ants is _exactly_ what I was thinking about |
| 15:14 | eggsby | is this ants video worth watching nDuff |
| 15:14 | rhc | the ants presentation is still on blip.tv |
| 15:14 | rhc | the whole presentation is an excellent intro to clojure |
| 15:14 | eggsby | it says 'be sure to grab the code and slides!' yet doesnt link to the code nor the slides :( |
| 15:15 | duck1123 | The ants video is really old, so take some of it with a grain of salt |
| 15:15 | rhc | eggsby: err, that link si wrong: http://github.com/matthavener/banksim |
| 15:15 | babilen | rhc: Shouldn't that have been https://github.com/matthavener/banksim btw? |
| 15:15 | eggsby | I also have some old video from phil hagelberg w/ peepcode |
| 15:15 | babilen | ah |
| 15:15 | eggsby | but I think it's clojure 1.1 |
| 15:15 | rhc | babilen: yeah, thanks |
| 15:16 | eggsby | okay, so I need to learn about agents then, i'll look at this code, thanks rhc |
| 15:17 | rhc | eggsby: no prob, let me know if you have any questions, i'll probably learn something too by trying to answer them :) |
| 15:19 | eggsby | and so avout offers this style of concurrency in a distributed way? |
| 15:22 | amalloy | gtrak: 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:23 | gtrak | ah, interesting |
| 15:23 | amalloy | also accepts :strs and :syms options to mirror destructuring |
| 15:23 | gtrak | the 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:25 | solussd | noir question, if I have a pre route of "/*", can I get the actual value of "*" in my pre-route? |
| 15:32 | duck1123 | solussd: I don't know noir, but do you have a key named :* in :params ? |
| 15:36 | eggsby | technomancy: do you think the peepcode clojure course is still relevant for people new to clj? |
| 15:40 | solussd | duck1123: doenst seem to work.. :/ |
| 15:45 | duck1123 | solussd: That's where clout puts it. I don't know what you have to do for noir |
| 15:49 | gtrak | gfredericks: https://gist.github.com/2764230 how do I keep c from showing up? |
| 15:53 | gtrak | hmm, I can remove the keys that are there before unless they show up again |
| 15:55 | amalloy | i don't think you can ever get to-map to work with no arguments |
| 15:57 | Borkdude | What is the idea behind a non-dynamic var being mutable? |
| 15:59 | technomancy | eggsby: most of the features that have been added since the peepcode release are not relevant to beginners. |
| 15:59 | technomancy | eggsby: the biggest thing is that the peepcode doesn't use Leiningen, but IMO that's easy to learn elsewhere |
| 16:00 | technomancy | just stick your fingers in your ear for the minute or two that build.sh is mentioned =) |
| 16:00 | technomancy | eggsby: see also http://technomancy.us/136 |
| 16:00 | eggsby | technomancy: 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:01 | technomancy | I don't know; depends on your learning style and the kinds of things you've done so far. |
| 16:02 | technomancy | you could read over the sample project source code; if it's all obvious to you then probably not |
| 16:02 | technomancy | clojurebot: google mire clojure github |
| 16:02 | eggsby | good idea... and is it you actually doing the coding or did you just write it? |
| 16:02 | clojurebot | First, out of 296 results is: |
| 16:02 | clojurebot | technomancy/mire · GitHub |
| 16:02 | clojurebot | https://github.com/technomancy/mire |
| 16:02 | technomancy | I wrote the script and the code, but I didn't do the voiceover, thank goodness =) |
| 16:03 | eggsby | ah cool, well I think I'll purchase it just for that then |
| 16:03 | technomancy | great =) |
| 16:04 | amalloy | just to hear anyone's voice but technomancy's? |
| 16:04 | Borkdude | can someone answer my question, before I put myself to shame elsewhere? |
| 16:04 | Borkdude | ;) |
| 16:04 | amalloy | Borkdude: it's not really an answerable question yet, i think |
| 16:04 | amalloy | not very clear about what you're asking |
| 16:04 | technomancy | amalloy: topfunky's voice is silky-smooth; good for soothing infants as well. |
| 16:05 | technomancy | he really should advertise that angle more |
| 16:05 | raek | Borkdude: the fact that you can mutate the root binding? |
| 16:05 | Borkdude | raek: yes |
| 16:05 | technomancy | Borkdude: it's only possible because interactive development would suck otherwise |
| 16:05 | technomancy | in ML-derived languages, changes to top-level definitions are not retroactive |
| 16:06 | technomancy | which is also true in Clojure when working with non-var functions. |
| 16:06 | Borkdude | technomancy: 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:07 | Borkdude | technomancy: non-var functions? |
| 16:07 | technomancy | more or less |
| 16:08 | Borkdude | technomancy: give me an example of a non-var function |
| 16:08 | technomancy | Borkdude: (defn f [] inc) (let [local-f (f)] (defn g [x] (local-f x)) (defn f [] dec) (g 10) ; -> 11 |
| 16:09 | technomancy | you see this most commonly with (run-jetty app {:port 8080}) |
| 16:09 | technomancy | if you want to be able to recompile app, you do this instead: (run-jetty #'app {:port 8080}) |
| 16:09 | muhoo | :join? false |
| 16:09 | Borkdude | technomancy: ah, that's why you give it the var.. ok |
| 16:10 | Borkdude | Clojure fosters immutability, but invites you to redefines its + function into - ;) |
| 16:11 | technomancy | well... |
| 16:11 | technomancy | + is defined with definline IIRC, so that doesn't work |
| 16:11 | Borkdude | technomancy: I just tried it in a repl |
| 16:11 | gtrak | Borkdude: try defining your function before redefining + |
| 16:11 | Borkdude | technomancy: (in-ns 'clojure.core), (def + -) |
| 16:12 | Borkdude | technomancy: (+ 1 2 3) => -4 |
| 16:12 | Borkdude | gtrak: will try |
| 16:12 | technomancy | yeah, you can redefine it, but not retroactively |
| 16:12 | technomancy | just like ML |
| 16:13 | Borkdude | ah, got it |
| 16:14 | Borkdude | I guess you can break anything if you want to |
| 16:15 | technomancy | yes, but it's not like Ruby which makes huge performance sacrifices to make redefining 2+2 work reliably =) |
| 16:15 | Borkdude | even with-redefs doesn't support retroactive defining on + or - |
| 16:16 | Borkdude | I guess this goes for all "inlined" fns? |
| 16:16 | technomancy | yes, though you can still change the behaviour of + when used as a HOF |
| 16:16 | technomancy | since you can't inline HOFs |
| 16:16 | Borkdude | technomancy: + as a HOF, or in a HOF? |
| 16:17 | technomancy | + as a HOF |
| 16:17 | Borkdude | technomancy: example? |
| 16:17 | technomancy | ,(with-redefs [+ -] (map (partial + 2) [1 2 3])) |
| 16:17 | clojurebot | (1 0 -1) |
| 16:17 | Borkdude | ah |
| 16:17 | dnolen | Borkdude: I believe applies to primitive fns as well as protocol fns on Clojure JVM as well. |
| 16:18 | Borkdude | (partial + 2) isn't + as a HOF though, it is the HOF partial given + returning a new function which isn't + ;) |
| 16:18 | technomancy | IMO they're both HOFs |
| 16:18 | technomancy | since they're arguments |
| 16:19 | Borkdude | my 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:19 | Borkdude | + doesn't take a function as an argument |
| 16:20 | iwo | hey, is there a shorter way to do this: |
| 16:20 | iwo | (filter #(string/substring? "gnu" (key %1)) (System/getProperties)) |
| 16:20 | Borkdude | but my definition might be incorrect, correct me |
| 16:20 | amalloy | that's the technically correct definition, but "+ as HOF" colloquially would mean "+ used as a value, not called immediately" |
| 16:20 | iwo | i.e. filter map for only some keys that match pred |
| 16:21 | Borkdude | I have to think about that for a while, brb ;) |
| 16:21 | technomancy | iwo: that's pretty short already once you take out the pred and the map =) |
| 16:24 | iwo | technomancy: i guess so: (filter gnu-entry? props) |
| 16:24 | technomancy | iwo: you might need to (into {} (filter [...])) |
| 16:25 | iwo | technomancy: sorry, i don't understand. why? |
| 16:26 | technomancy | iwo: depending on whether you want a map back or a lazy seq of k/v pairs |
| 16:26 | iwo | oh i see |
| 16:26 | iwo | technomancy: yes, much more useful |
| 16:29 | wink | hehe, last 2 lines. nice coincidence? :P |
| 16:33 | bobry | is it possible to test clojurescript applications with 'clojure.test'? |
| 16:35 | dnolen | bobry: no - tho that would be a welcome addition if you want to take the time to put something like that together. |
| 16:35 | bobry | that's unfortunate :( |
| 16:43 | rlb | What 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:43 | dnolen | bobry: easily remedied via community contribution, early days yet. CLJS hits 1 year from the first commit in 8 days. |
| 16:44 | gfredericks | ,(doc keep-indexed) |
| 16:44 | clojurebot | "([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:44 | adeelkh | what's the situation with exception handling in clojurescript? do we have try and catch? |
| 16:45 | dnolen | adeelkh: yes |
| 16:46 | rlb | gfredericks: oh, right, that'll do -- thanks. |
| 16:51 | kmicu | WARNING: 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:51 | TimMc | (.toLowerCase "S") probably |
| 16:52 | kmicu | from this I have warning |
| 16:52 | adeelkh | dnolen: I get `WARNING: Use of undeclared Var stopwatch.logger/catch` |
| 16:52 | dnolen | adeelkh: paste |
| 16:52 | amalloy | you probably have a bad macro |
| 16:53 | amalloy | eg, one that expands to a catch without a try, and then you wrap that in a try elsewhere? |
| 16:53 | bobry | is there something special about having atoms in :pre constraints? the second one in 'machine' doesn' work https://gist.github.com/3e97073b9fc6cec40fc1 |
| 16:54 | adeelkh | dnolen: https://gist.github.com/2764601 |
| 16:54 | adeelkh | amalloy: i haven't written any macros |
| 16:55 | amalloy | too many )s |
| 16:55 | adeelkh | argh |
| 16:55 | amalloy | or misbalanced, anyway - the catch is indented as if it were in the try, but it isn't |
| 16:56 | dnolen | adeelkh: nice you're playing around with CLJS + node |
| 16:56 | adeelkh | dnolen: yeah, it's pretty cool. i just haven't figured out how to get a repl running though |
| 16:57 | dnolen | adeelkh: still waiting for someone contribute one of those too :) |
| 16:57 | adeelkh | dnolen: i might try to do it myself then, because i really miss the repl |
| 17:01 | Borkdude | technomancy: btw, I told my class to deploy their clojure apps to heroku ;) |
| 17:02 | technomancy | Borkdude: high five: o/ |
| 17:02 | adeelkh | amalloy: well, i fixed the parentheses but it doesn't actually seem to be catching the error |
| 17:03 | adeelkh | https://gist.github.com/8a508324634e779de53f |
| 17:03 | adeelkh | (the warning about catch being undeclared is gone though now) |
| 17:04 | amalloy | that's the usual issue with laziness |
| 17:04 | amalloy | (map f coll) instantly returns a lazy sequence; when you later realize its elements you are no longer inside a try/catch |
| 17:04 | dnolen | adeelkh: you need to specify the Error constructor you want to match |
| 17:05 | dnolen | adeelkh: (catch js/Error e ...) |
| 17:05 | adeelkh | dnolen: aha, that worked. thanks |
| 17:06 | amalloy | really? 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:06 | adeelkh | amalloy: in this case the error was in the evaluation of coll itself (not in the lazy sequence returned by map) |
| 17:06 | amalloy | ah, okay |
| 17:07 | Raynes | amalloy: pwned |
| 17:08 | Borkdude | is smth like this already in clojure.core? https://gist.github.com/2764700 |
| 17:08 | goodieboy | we'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:12 | Raynes | Borkdude: 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:12 | Raynes | If data can come from an outside source, that is. |
| 17:13 | S11001001 | goodieboy: from general experience, it would probably be much easier for you to fix medusa than change your codebase to use an alternative API |
| 17:13 | Borkdude | Raynes: ah, what kinds of objects can it read? |
| 17:13 | Raynes | Anything the Clojure reader can read. |
| 17:14 | Raynes | &(doc read-string) |
| 17:14 | lazybot | ⇒ "([s]); Reads one object from the string s" |
| 17:14 | Raynes | &(doc read) |
| 17:14 | lazybot | ⇒ "([] [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:14 | gfredericks | ,(read-string "(read-string \"(read-string)\")") |
| 17:14 | clojurebot | (read-string "(read-string)") |
| 17:14 | Borkdude | Raynes: 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:14 | goodieboy | S11001001: 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:15 | gfredericks | ,(read-string "<html><body><div id=\"tommy\"></div></body></html>") |
| 17:15 | clojurebot | <html><body><div |
| 17:16 | Raynes | Borkdude: 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:16 | Raynes | In the end, you'd probably end up with more code than that function you've got now. |
| 17:17 | Borkdude | Raynes: yeh, now I can just write: (if-let [num (parse-int answer)] … …) |
| 17:20 | Borkdude | I like expression oriented programming |
| 17:21 | Raynes | I like Borkdude oriented programming. |
| 17:21 | Borkdude | :) |
| 17:22 | technomancy | statements 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:23 | ForSpareParts | Does anyone know a good programmatic way to analyze a function and retrieve information about the functions it calls? |
| 17:24 | ForSpareParts | I 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:24 | gfredericks | by "a function" you mean "the source for that function"? |
| 17:24 | iwo | hey, does anyone know where i can get a "light table" theme for emacs? |
| 17:24 | Borkdude | ForSpareParts: you can do static analysis using https://github.com/frenchy64/analyze |
| 17:25 | ForSpareParts | gfredericks, 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:27 | ForSpareParts | Borkdude, 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:27 | TimMc | gfredericks: What's in lib-5141? For some reason, I couldn't tell by the name. :-P |
| 17:28 | Borkdude | ForSpareParts: you can start following @ambrosebs on twitter and bug him ;) |
| 17:28 | ForSpareParts | Borkdude, Fair enough. : ) |
| 17:29 | ForSpareParts | And 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:29 | ForSpareParts | (and basically everything we do is in Java) |
| 17:29 | gtrak | ForSpareParts: are you analyzing java? |
| 17:30 | technomancy | ForSpareParts: this project is one guy's grad thesis; you would probably need a pretty big team to pull this off for Java |
| 17:30 | gtrak | or just steal it from eclipse? |
| 17:30 | technomancy | well, it's not even his thesis, it's just some library he needed to exist before he could start work on his thesis |
| 17:30 | technomancy | for a bit of perspective =) |
| 17:30 | ForSpareParts | Well, 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:31 | Borkdude | a class of mine is doing this kind of thing: https://github.com/husacct/husacct |
| 17:31 | ForSpareParts | thanks, technomancy. |
| 17:31 | Borkdude | they use anltr for it |
| 17:31 | Borkdude | antlr |
| 17:32 | ForSpareParts | Basically, 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:32 | ForSpareParts | And, 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:33 | Borkdude | ForSpareParts: you can look around for some clojure+antlr examples on the web |
| 17:33 | Borkdude | ForSpareParts: if you want to do Java analysis |
| 17:33 | solussd | how do you call window.location.reload() from clojurescript? afaict, I can do (js/some_func arg), right? |
| 17:34 | Borkdude | bye folks |
| 17:34 | amalloy | (.reload (.-location js/window))? |
| 17:35 | solussd | what is the .-thing syntax mean exactly? |
| 17:35 | solussd | property access? |
| 17:35 | amalloy | yes |
| 17:35 | solussd | ah |
| 17:35 | solussd | thanks |
| 17:39 | adeelkh | how do i turn a clojure map into a javascript object, in clojurescript? |
| 17:40 | dnolen | adeelkh: you have to write your own converter. |
| 17:41 | pandeiro | would it make sense to have a canonical js interop ns like clojure.tools.javascript or something? |
| 17:41 | adeelkh | dnolen: hm, how should I do that? i have a map of config options i have to pass to a node library |
| 17:41 | adeelkh | dnolen: so it's just {"style" {"compact" true}} in this case |
| 17:41 | eggsby | why 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:41 | pandeiro | adeelkh: https://gist.github.com/1658431 |
| 17:42 | dnolen | adeelkh: (js-obj "style" (js-obj "compact" true)) |
| 17:42 | adeelkh | ah, thanks |
| 17:42 | technomancy | eggsby: it's using deprecated contrib |
| 17:42 | dnolen | adeelkh: js-obj + array handles the common interop cases. |
| 17:44 | technomancy | eggsby: gimme a minute |
| 17:44 | eggsby | technomancy: I just have 1.2 listed in the project.clj, shouldn't that have socket-streams ? |
| 17:45 | eggsby | err, server socket* |
| 17:45 | technomancy | eggsby: yeah, but you shouldn't put old contrib in project.clj; it's gross. |
| 17:48 | eggsby | technomancy: https://github.com/technomancy/mire/blob/01-echo-server/src/mire.clj#L12 is this referring to clojure.contrib.io/read-lines ? |
| 17:50 | technomancy | eggsby: yeah |
| 17:50 | technomancy | I guess if you're going step by step you're going to run into the old contrib stuff |
| 17:50 | eggsby | is it a typo that it says read-line or am I missing something |
| 17:50 | eggsby | I might just use https://github.com/weavejester/tcp-server instead of socket-server |
| 17:50 | technomancy | oh, my bad |
| 17:50 | technomancy | it's clojure.core/read-line |
| 17:51 | eggsby | aah, ok |
| 17:52 | eggsby | could I get away with using weavejester's tcp server technomancy ? |
| 17:53 | technomancy | eggsby: no need; just pull the latest |
| 17:53 | technomancy | just pushed an update |
| 17:54 | espeed | What's the general consensus on specifying a protocol implementation as a map so that its methods can be overridden? |
| 17:54 | eggsby | ah thanks technomancy |
| 17:56 | antares_ | espeed: if you *really* need overriden implementations, it will work fine. |
| 17:57 | espeed | so it's not recommended as a standard practice? |
| 17:59 | antares_ | espeed: reusing/overriding implementations The OO Way is often just not necessary. |
| 18:02 | espeed | thanks |
| 18:08 | ibdknox | dnolen: 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:09 | dnolen | ibdknox: first I've heard of that. |
| 18:09 | ibdknox | weird |
| 18:09 | ibdknox | it only happens if I use the git repo |
| 18:09 | dnolen | ibdknox: you building with lein-cljsbuild? |
| 18:10 | ibdknox | dnolen: calling build directly |
| 18:10 | ibdknox | I'm doing the equivalent of what lein-cljsbuild does |
| 18:11 | dnolen | ibdknox: but you don't encounter that with lein-cljsbuild right? |
| 18:11 | ibdknox | let me try |
| 18:12 | ibdknox | dnolen: correct |
| 18:16 | dnolen | ibdknox: then I'm not sure what's up. |
| 18:17 | dnolen | ibdknox: might want to compare what you do differently. |
| 18:17 | ibdknox | I'll assume it's my fault somewhere then :) |
| 18:49 | dherman | dnolen: so without concurrency, what would you say are the killer one or two motivators for clojurescript? macros? expressive data abstraction? |
| 18:50 | Raynes | Not having to use javascript seems to excite people quite a bit. |
| 18:52 | dherman | Raynes: 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:52 | TimMc | dherman: Fewer pitfalls to keep in mind, I suppose. I like to be able to iterate over a collection without having to be cautious. |
| 18:53 | Raynes | The data structures are a nice win. Clojure has excellent data structures. |
| 18:53 | dnolen | dherman: persistent data structures |
| 18:53 | dherman | the point isn't to contrast it with JS, since all languages that compile to JS eliminate the pitfalls |
| 18:53 | TimMc | Hmm, I see. |
| 18:53 | dnolen | dherman: comprehensive abstractions - like iteration for all types including natives |
| 18:53 | dherman | k |
| 18:54 | dnolen | dherman: sensible solution to expression problem |
| 18:54 | dherman | if I wrote "comprehensive data abstraction" would that be accurate? |
| 18:54 | dnolen | dherman: including natives |
| 18:54 | dnolen | dherman: yes, but it's important that types that you don't control can be easily subsumed |
| 18:54 | dherman | oh that's good, more intuitive -- uniform data abstraction (including host objects!) |
| 18:54 | dnolen | dherman: yes |
| 18:55 | dherman | nice, thx |
| 18:55 | dnolen | dherman: lots of minor stuff, like let scoping, no fear of aliasing, no mutable locals, no need for cloning |
| 18:55 | dherman | thx |
| 18:55 | dherman | yeah, this is just a one-line of high points |
| 18:55 | dherman | so that's enough |
| 18:56 | dnolen | dherman: cool |
| 19:03 | dnolen | dherman: which other compile-to-JS projects are you covering? CoffeeScript & Roy? |
| 19:04 | dherman | on that slide, I'm just mentioning a few for example. CoffeeScript, ClojureScript, Roy, FBJS, TameJS |
| 19:04 | technomancy | parenscript? |
| 19:04 | TimMc | haha |
| 19:04 | TimMc | GWT? |
| 19:04 | dherman | technomancy, TimMc: there are maaaaaany languages that compile to JS. not looking for completeness. |
| 19:04 | dherman | but later in the talk I'm talking about different topics that haven't been talked about quite as much yet |
| 19:05 | TimMc | I've actually not heard of Roy, FBJS, and TameJS. |
| 19:05 | dnolen | dherman: what's the gist of the talk? |
| 19:05 | dherman | dnolen: "The JavaScript Virtual Machine" |
| 19:05 | dnolen | dherman: ooh nice :) |
| 19:05 | dherman | why I think JS is a compelling VM, and where I'd like to see it go |
| 19:06 | technomancy | "JS is a compelling VM" or "JS has some compelling VMs"? |
| 19:06 | dherman | TimMc: 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:06 | dherman | technomancy: JS as the VM for targeting other languages to |
| 19:06 | technomancy | it's not a VM though |
| 19:07 | technomancy | or you mean it as a metaphor? |
| 19:07 | dherman | depends on how optimistic you are about precisely defining "VM" |
| 19:07 | Raynes | metophypothetically |
| 19:07 | dherman | I'm happy treating it either way |
| 19:07 | McMartin | Let's go with "target platform" |
| 19:08 | Raynes | I'm not sure how you could define 'VM' that would let it include js. |
| 19:08 | Raynes | It makes perfect sense metaphorically though. |
| 19:08 | technomancy | doesn't the term "JavaScript™" technically only apply to Mozilla's implementation? |
| 19:08 | technomancy | or is that not true anymore |
| 19:08 | dherman | technomancy: not really |
| 19:09 | dherman | or, it's unclear at best |
| 19:09 | dherman | Sun owned the copyright to the name "Java" |
| 19:09 | dherman | now Oracle presumably does |
| 19:09 | technomancy | I mean, it used to be that ECMAScript was the name of the language, and JavaScript and JScript were the two implementations that existed. |
| 19:09 | dherman | but nobody really knows the status of it |
| 19:09 | dherman | technomancy: it was only called ECMAScript b/c JavaScript was copyrighted by Sun |
| 19:09 | technomancy | dherman: you can't copyright names |
| 19:09 | dherman | but they were meant to be the same thing |
| 19:09 | technomancy | are you talking about trademarks? |
| 19:10 | dherman | sorry, yes, trademark |
| 19:10 | dherman | wrong term |
| 19:10 | technomancy | I don't think the Java trademark applies to JavaScript |
| 19:10 | McMartin | Does JS have a standard bytecoded format? |
| 19:10 | dherman | they trademarked both |
| 19:10 | dherman | McMartin: no |
| 19:11 | dherman | McMartin: you should listen to my talk this week ;-) |
| 19:11 | McMartin | Maybe I should! Where is it? |
| 19:11 | dherman | Oslo |
| 19:11 | McMartin | Sadly, I'm going to be in San Diego this week. |
| 19:11 | dherman | but it'll be recorded |
| 19:11 | McMartin | Will there be slides/a paper associated with it? |
| 19:11 | dherman | no paper, but definitely slides |
| 19:11 | dherman | in Full HTML5 Technicolor |
| 19:11 | dnolen | dherman: looking forward to it |
| 19:11 | dherman | thx |
| 19:12 | dnolen | dherman: targetting JS has been pretty awesome, I fully support the "JavaScript Virtual Machine" |
| 19:12 | dherman | :) |
| 19:12 | dnolen | dherman: down with Dart! |
| 19:12 | dherman | haha |
| 19:12 | dherman | Dart. feh |
| 19:12 | McMartin | dnolen: "Hey, nice dart you got there, now, about that JS V8 and what reasonable type inference nets you..." |
| 19:13 | McMartin | Why yes, I do consider compiler technologies to be 1930s movie gangsters, don't judge |
| 19:14 | dherman | McMartin: SpiderMonkey has better type inference than V8 :) |
| 19:15 | brehaut | dherman: don't go using facts when talking about V8! The Holy Node will strick you down |
| 19:15 | McMartin | dherman: V8 is the only one I had numbers handy for, though. |
| 19:16 | dherman | well, V8 still beats us on many benchmarks, but our TI algorithm is more sophisticated |
| 19:16 | McMartin | (Specifically, from http://julialang.org/ and its table that accidentally says "why you should probably use JSV8 instead of Julia") |
| 19:16 | dherman | http://rfrn.org/~shu/drafts/ti.pdf |
| 19:16 | McMartin | Now I have to see if you cited any of my colleagues >_> |
| 19:17 | dnolen | dherman: it's been interesting finding the optimal line between what type of code optimizes on V8, SM, and JSC |
| 19:17 | dherman | dnolen: you know way more than I do, I'm sure |
| 19:18 | dnolen | dherman: SM and JSC tend to optimize real JS patterns. V8 often seems happier with lower level stuff. |
| 19:18 | McMartin | I can readily believe that |
| 19:19 | dherman | interesting. how do you determine that patterns are real? |
| 19:19 | McMartin | (Also: well, I recognize a few of those names) |
| 19:19 | dnolen | dherman: example - iterating over JS object keys with for in is slower than holding the keys in a array yourself and iterating over that. |
| 19:20 | dnolen | on V8 |
| 19:20 | dnolen | not true for SM or JSC, but iterating over array is not slow - so it's a solution that works well for all. |
| 19:20 | dherman | huh. like, for (var a = Object.keys(o), i = 0, n = a.length; i < n; i++) { ... } ? |
| 19:21 | dnolen | dherman: no for(var k in obj) { ... } |
| 19:21 | dherman | right, but what's the faster alternative? |
| 19:21 | dnolen | dherman: store the keys in an array ourselves. |
| 19:21 | dherman | that's what I did...? |
| 19:22 | dnolen | no calls to Object.keys |
| 19:22 | dherman | so you start with a for-in loop and cache the keys, and then do multiple for loops over the array? |
| 19:23 | dherman | IOW, this only gives you savings if you loop multiple times over the same set of keys |
| 19:23 | dherman | it can't possibly be faster for one single loop |
| 19:23 | dnolen | dherman: some explanation - JS objects do double duty as real maps and types w/ fields. |
| 19:23 | dnolen | dherman: CLJS provides proper map abstraction |
| 19:24 | dnolen | dherman: complex keys etc |
| 19:24 | dnolen | dherman: but we optimize string key only maps - since we have our own map abstraction, we track keys as their added. |
| 19:24 | dnolen | they're |
| 19:24 | dherman | aha |
| 19:24 | dherman | that's what I missed |
| 19:24 | dherman | ok |
| 19:33 | brainproxy | re-implementing node-clojurescript in clojurescript, using node-clojurescript .. fun :D |
| 19:56 | archaic | Incanter 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:04 | technomancy | archaic: without special tricks, you can only load one version of a given library at once |
| 20:04 | kwertii | Is there some magic trick needed in Korma to do WHERE clauses with timestamps? |
| 20:04 | technomancy | so naturally it's easy for one dependency to win and the other one to complain |
| 20:06 | nDuff | How can I populate a namespace other than the one I'm in? |
| 20:06 | technomancy | change namespaces |
| 20:07 | nDuff | technomancy: ...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:08 | technomancy | there are lots of ways to change namespaces |
| 20:08 | technomancy | one way is to eval code when inside (binding [*ns* ...]) |
| 20:08 | gfredericks | ,(macroexpand-1 (ns foo.bar)) |
| 20:08 | clojurebot | nil |
| 20:08 | gfredericks | ,(macroexpand-1 '(ns foo.bar)) |
| 20:08 | clojurebot | (do (clojure.core/in-ns (quote foo.bar)) (clojure.core/with-loading-context (clojure.core/refer (quote clojure.core)))) |
| 20:09 | nDuff | Ahh. |
| 20:11 | eggsby | technomancy: 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:12 | technomancy | eggsby: haha; yes, it's a nice peek into the dark ages |
| 20:34 | mebaran151 | I'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:39 | brehaut | mebaran151: at a guess, the first argument to the event handling function is a dom event object? |
| 20:40 | brehaut | mebaran151: or at least, the jquery wrapped event |
| 20:40 | brehaut | mebaran151: in which case e.target is the target node |
| 20:40 | mebaran151 | I've been trying something like that, but I just realized calling a function from the repl is different from clicking it |
| 20:41 | brehaut | target is a property, not a function |
| 20:41 | brehaut | and yes |
| 20:41 | brehaut | $(object).click() will simulate the click |
| 20:41 | brehaut | translate that to cljs obviously |
| 20:41 | mebaran151 | thanks brehaut; I'm still getting the hang of cljs |
| 20:42 | brehaut | no problem. i dont know anything about clojurescript though ;) |
| 20:42 | mebaran151 | I 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:44 | brehaut | seems reasonable. and you'll get to avoid some of the quirkiest parts of jquery |
| 20:44 | brehaut | (eg, each, map etc) |
| 20:46 | mebaran151 | just figured out console log; very much my friend |
| 20:48 | brehaut | mebaran151: console.dir(console) and have a look at the prototype. theres lots of handy stuff there |
| 20:51 | brehaut | mebaran151: probably just 'console' is fine, but i cant never seem to predict when the console will return some other form for the data |
| 20:52 | mebaran151 | whoopee, got it working |
| 20:52 | mebaran151 | I'll check out console.dir |
| 20:59 | emezeske | dnolen: Have you noticed the clojurescript compiler output sneaking upwards in size again recently? |
| 21:02 | muhoo | is there a quick one-liner to transform map keys? i.e. to make {:foo "bar" :baz "quux"} into {:blah "bar" :yah "quuz"} ? |
| 21:03 | muhoo | basically :foo -> :blah, and :baz -> :yah |
| 21:03 | dakrone | ,(doc clojure.set/rename-keys) |
| 21:03 | clojurebot | Gabh mo leithscéal? |
| 21:03 | dakrone | muhoo: well, clojure.set/rename-keys http://clojuredocs.org/clojure_core/clojure.set/rename-keys |
| 21:07 | muhoo | perfect, thanks! |
| 21:07 | muhoo | clojure.core is like a chinese restaurant menu. so many dishes, all so tasty. |
| 21:08 | McMartin | And kind of poorly indexed when you're looking for something specific >_> |
| 21:08 | muhoo | and it could take years if you actually want to try them all |
| 21:10 | muhoo | McMartin: http://clojure.org/cheatsheet is the best i've found yet |
| 21:11 | McMartin | Yeah, but even that cheatsheet I have to Ctrl-F to find what I need |
| 21:12 | muhoo | heh, methinks it is time for protocols and deftypes: https://www.refheap.com/paste/2821 |
| 21:12 | muhoo | protocols and defrecords, sorry |
| 21:14 | muhoo | i'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:14 | emezeske | muhoo: That seems totally reasonable as just a map to me |
| 21:15 | mebaran151 | muhoo: you need the polymorphism? |
| 21:15 | muhoo | it'd be nice to have default implementations, yes |
| 21:15 | emezeske | Multimethods are pretty nice for that sort of thing |
| 21:15 | mebaran151 | wouldn't the default just be a function that expects a map with certain keys? |
| 21:16 | muhoo | the default would fill in the keys |
| 21:16 | muhoo | so i don't get NPE's :-) |
| 21:16 | mebaran151 | muhoo: you could put together a template map and just merge your custom maps on top of it |
| 21:16 | muhoo | ((: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:17 | muhoo | mebaran151: perfect, thanks! |
| 21:35 | amalloy | muhoo: C-c C-d C-d |
| 21:35 | emezeske | ibdknox: ping |
| 21:37 | emezeske | ibdknox: unping :) I thought something was up with jayq, but I was using some crazy accidental local version |
| 21:52 | mebaran151 | hey emezeske I'm using bootstrap.js from a CDN; how do I get it to compile on Advanced? |
| 21:56 | emezeske | mebaran151: You need to write an externs file |
| 21:56 | emezeske | mebaran151: Except that you're lucky, and I happen to also be using bootstrap |
| 21:56 | emezeske | mebaran151: Paste incoming :) |
| 21:56 | mebaran151 | emezeske: oh many many thanks :) |
| 21:57 | emezeske | mebaran151: So, stick this in something like boostrap-externs.js: https://www.refheap.com/paste/2822 |
| 21:57 | emezeske | And then set :compiler {:externs ["path/to/bootstrap-externs.js"]} |
| 21:58 | mebaran151 | do I throw this in a public directory or no? |
| 21:58 | emezeske | Nah, it's just used at compile time |
| 21:58 | mebaran151 | let's try it... |
| 21:58 | emezeske | *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:58 | mebaran151 | I may need to add more, but I see the idea |
| 21:59 | mebaran151 | maybe it would be wise to pull down a local version of bootstrap just for compiling |
| 21:59 | mebaran151 | that had all the functions which the Closure would then note |
| 21:59 | emezeske | You can use the original bootstrap.js as an externs file |
| 21:59 | emezeske | But it will produce a ton of warnings |
| 22:00 | mebaran151 | I still get a lot of warnings that .text doesn't mean .-text, etc |
| 22:00 | mebaran151 | anyway to suppress those? |
| 22:00 | emezeske | Write an externs file ^_^ |
| 22:00 | mebaran151 | haha |
| 22:00 | mebaran151 | they seem to be coming from jayq |
| 22:00 | emezeske | Hmm I don't get any of those any more |
| 22:00 | emezeske | Maybe upgrade your compiler version? |
| 22:01 | emezeske | That warning was removed from the compiler a while back |
| 22:02 | mebaran151 | I'm just lein-cljsbuild 0.1.8 |
| 22:02 | mebaran151 | *using |
| 22:02 | emezeske | Hmm, that's pretty new. You might try 0.1.10, though |
| 22:03 | mebaran151 | just pulled |
| 22:03 | mebaran151 | same warnings |
| 22:04 | emezeske | Uh, that's very weird, I wonder if somehow you're inadvertently using an older version |
| 22:05 | mebaran151 | emezeske: it looks like it's pulling the right jar (saw maven pull it) |
| 22:05 | mebaran151 | could it be my jayq version |
| 22:05 | emezeske | What's the exact text of the warning? |
| 22:06 | mebaran151 | WARNING: The form of (. this String) is no longer a property access.... |
| 22:06 | emezeske | So, the string "property access" does not appear in the current version of the compiler (using grep) |
| 22:06 | mebaran151 | hmmmm |
| 22:06 | mebaran151 | curious |
| 22:06 | emezeske | Very! |
| 22:08 | mebaran151 | ah, upgrade noir-cljs fixed it |
| 22:08 | mebaran151 | *upgrading |
| 22:09 | emezeske | Sweet. |
| 22:09 | mebaran151 | one of them must have overridden my running cljs |