2010-12-18
| 00:38 | devn | How do people live without a real REPL? |
| 00:41 | Derander_ | I don't know |
| 00:41 | Derander_ | clojure/emacs/slime is making me consider writing a swank-ruby |
| 00:41 | Derander_ | irb is not good enough |
| 00:45 | Derander_ | I wonder how difficult that would be |
| 00:45 | Derander_ | I know nothing about swank |
| 00:45 | amalloy | Derander_: ask technomancy |
| 00:46 | Derander_ | amalloy: well, if he saw your ping and feels like talking I will |
| 00:46 | amalloy | devn: i recently discovered someone wrote a php repl. not very fancy, but better than having to use php -r, or (god forbid) write test.php files all over |
| 00:46 | Derander_ | I started to read swank-clojure, but I had trouble grokking it |
| 00:47 | amalloy | Derander_: yep, that was the idea :) |
| 00:51 | Derander | There we go. |
| 00:51 | Derander | fixing that w/ znc was surprisingly annoying |
| 00:55 | joshua__ | Derander, something like this already exists. |
| 00:55 | Derander | I've been looking for a few days and haven't found it |
| 00:56 | Derander | if it does exist than I would love to find it |
| 00:56 | joshua__ | wait, nevermind it is for vim |
| 00:56 | joshua__ | slime.vim extension |
| 00:56 | joshua__ | http://technotales.wordpress.com/2007/10/03/like-slime-for-vim/ |
| 00:57 | joshua__ | it is hackish though, basically you set up a screen session running irb |
| 00:57 | Derander | yeah |
| 00:58 | Derander | I'd rather make it work directly w/ slime |
| 00:58 | Derander | a solution like slime.vim comes w/ ruby-mode |
| 00:58 | joshua__ | Oh! I didn't know that. |
| 00:58 | joshua__ | I don't actually program in ruby. |
| 00:58 | Derander | no worries :-) |
| 00:59 | Derander | it seems like ruby is flexible enough to do it though. you can get method args, redefine methods and reload files dynamically |
| 00:59 | Derander | method arglists |
| 01:03 | joshua__ | amalloy, I have a question about sandboxing. |
| 01:03 | amalloy | joshua__: i have an answer |
| 01:04 | joshua__ | amalloy, (:answer amalloy) |
| 01:04 | Raynes | Hahaha, asking amalloy questions about sandboxing. |
| 01:04 | amalloy | i know, right? |
| 01:04 | Raynes | joshua__: You misspelled Raynes. |
| 01:04 | amalloy | joshua__: seriously Raynes wrote the sandboxer himself; i just made him do several things in less awful ways |
| 01:05 | Raynes | amalloy and I are a team. <3 |
| 01:05 | Raynes | I write things and he fixes them! |
| 01:05 | amalloy | in the sense that he shits all over the place and i clean it up |
| 01:05 | joshua__ | All right so here is the question. How secure is sandboxing really? Like can you give two different people code access to a machine and make sure that they can't effect each other? |
| 01:05 | amalloy | joshua__: it could be done, but we don't do it |
| 01:05 | joshua__ | The idea being that these users are malicious. |
| 01:05 | Raynes | joshua__: The JVM sandbox is pretty hardcore. |
| 01:06 | amalloy | the easiest way would be to spawn a new jvm for each user, but that's expensive |
| 01:07 | joshua__ | amalloy, why don't you do it? |
| 01:07 | joshua__ | amalloy, hard? |
| 01:07 | Raynes | <amalloy> ... but that's expensive |
| 01:08 | amalloy | joshua__: yeah, basically |
| 01:08 | joshua__ | Raynes, I've felt the same way about working with him. |
| 01:08 | amalloy | sexpbot runs in a persistent clojure process, joshua__. if users do *anything* to the global environment there, it's visible to everything running in that jvm. we try to make it impossible to affect the environment in any permanent way, and the jvm does a good job stopping you from touching anything outside the repl |
| 01:09 | Raynes | The idea behind clojail and any Clojure sandboxing will always be to just avoid state. The JVM sandbox can prevent I/O and other dangerous stuff, but it can't do anything for state. Any Clojure sandbox is vulnerable unless it forbids state. |
| 01:09 | Raynes | Clojail tries to do that. Mostly succeeds, failing in other ways. |
| 01:10 | bortreb | is there any reason that partial doesn't work with just one argument and return the function it's given? |
| 01:10 | joshua__ | Raynes, can you allow network IO (like requesting files) but not read/write to the filesystem? |
| 01:10 | Raynes | bortreb: Well, that wouldn't be very useful. |
| 01:10 | amalloy | joshua__: you could, for sure |
| 01:10 | Raynes | joshua__: Yes, with some JVM permission stuff. |
| 01:11 | amalloy | if you're into that kind of thing, you want to look up JVM permissions/policies |
| 01:11 | joshua__ | Raynes, cool that pretty much answers my questions |
| 01:11 | Raynes | You can't do that with clojail though. |
| 01:11 | Raynes | The JVM stuff is locked down tight. Once I learn more about it, I might open that up some more. |
| 01:12 | bortreb | Raynes: it's useful for a base case |
| 01:13 | bortreb | for when you may be partialing a function with zero or more args and you don't know how many |
| 01:20 | joshua__ | &map (fn [k] [k]) [1 2 3]) |
| 01:20 | sexpbot | ⟹ #<core$map clojure.core$map@d6eb4b> |
| 01:20 | amalloy | joshua__: are you planning to use this somehow for your stackoverflow/hn thing, or is this a separate project? |
| 01:20 | joshua__ | &(map #([%1]) [1 2 3]) |
| 01:20 | sexpbot | java.lang.IllegalArgumentException: Wrong number of args (0) passed to: PersistentVector |
| 01:20 | joshua__ | amalloy, oh god no |
| 01:20 | amalloy | &(map vector [1 2 3]) |
| 01:20 | sexpbot | ⟹ ([1] [2] [3]) |
| 01:20 | joshua__ | amalloy, this is just an idea that was swimming around in my head. |
| 01:21 | joshua__ | Is there a good reason that the first doesn't work? |
| 01:21 | amalloy | the actual first, with [k]? it's cause you forgot some parens |
| 01:21 | amalloy | &(map (fn [k] [k]) [1 2 3])) |
| 01:21 | sexpbot | ⟹ ([1] [2] [3]) |
| 01:21 | joshua__ | Meant the second, sorry. It seems to me that (fn [k] [k]) and #([%1]) should be equivalent. |
| 01:22 | Raynes | joshua__: #([%1]) -> (fn [] ([%1])) |
| 01:22 | Raynes | #([%1]) -> (fn [k] ([k])) |
| 01:22 | Raynes | Copy paste fail. |
| 01:23 | joshua__ | #({%}) -> (fn [k] ({k})) |
| 01:23 | joshua__ | ? |
| 01:23 | amalloy | joshua__: well yeah, except that both of those are compile failures so it doesn't really matter |
| 01:25 | joshua__ | I guess it isn't a big deal. All cases in which it is a problem are solved fairly trivially. |
| 01:26 | amalloy | right. especially because (fn [x] [x]) is succinctly described as just vector |
| 04:24 | amalloy | so what's the "best" way to do testing in clojure these days? |
| 05:16 | currentB | should refs generally not be viewed/bound outside of a dosync or are there times when it's fine? |
| 05:17 | mduerksen | currentB: viewing can be done whenever you want - that's one of the beauties of the STM model of clojure. i'm not sure what you mean by binding refs. do you mean vars? |
| 05:18 | currentB | yeah |
| 05:20 | mduerksen | vars are a complete different concept, vars can have a different value in each thread. dosync is for refs |
| 05:21 | mduerksen | if you want thread-safe state, take refs. if you just need a thread-local value, you can define a var (or create a thread-local binding for a var) |
| 05:21 | currentB | acutally I meant for like let bindings, sorry about that |
| 05:21 | currentB | still really new at this |
| 05:22 | mduerksen | no problem :) a let-binding is thread-local and also bound only in the lexical scope of the body of your let form. outside, the let, your binding is gone |
| 05:24 | mduerksen | for a more complete explanation, you can read http://clojure.org/vars for vars, and http://clojure.org/special_forms for the let form (and other related stuff) |
| 05:26 | currentB | thanks! so there's no need to worry about like you let binding to the wrong variable due to concurrency stuff? |
| 05:30 | mduerksen | that depends: when you bind to the value of a var, that value could be specific to the current thread. when you bind the the value of a ref (e.g. (let [w @world] ... ), you have bound w to the state of the world-ref which can be modified at any time. but you don't have to worry inside your let-form: @world gives you a snapshot of the world at that moment, and your bound symbol "w" won't change at all, even when the state of the worl |
| 05:31 | mduerksen | in short: you can be sure that the value of w NEVER changes. which lets you sleep better at night ;) |
| 05:38 | currentB | ok nice got it now, thanks a ton! |
| 07:57 | lpetit | Hello |
| 07:58 | lpetit | I don't remember the syntax for explicitly, in gen-class, specifying *which* method flavor (in case of overloading) you want to override. Any idea ? |
| 08:03 | ducki2p | lpetit: :methods ? |
| 08:04 | lpetit | say I extend a class, which declares 2 methods with same name, same arity, but different param types. eg foo(String x, String y) and also foo(int x, int y) |
| 08:09 | ducki2p | lpetit: you can put the argument types in the function name; http://dishevelled.net/Tricky-uses-of-Clojure-gen-class-and-AOT-compilation.html |
| 08:09 | lpetit | thx, that's the link I was searching! |
| 08:16 | lpetit | thanks again, and that's a great blog post, btw |
| 10:08 | zakwilson | Has anyone attempted to write a native code compiler for Clojure? |
| 12:05 | jweiss | i have a macro that calls a fn in the same ns as the macro. the only real public api in that ns is the macro. but i find that if i "use" :only the macro, it can't find the fn it needs to call. |
| 12:06 | jweiss | is there a way to save callers of the macro from having to know about the fn as well? |
| 12:06 | raek | jweiss: are you syntax-quoting the name of the function? |
| 12:07 | raek | `(foo 1 2) |
| 12:07 | raek | ,[`(foo 1 2) '(foo 1 2)] |
| 12:07 | clojurebot | [(sandbox/foo 1 2) (foo 1 2)] |
| 12:07 | jweiss | raek: yeah, i am |
| 12:07 | raek | if the macro has been loaded, the function is loaded too |
| 12:07 | jweiss | oh you know what, it is a function defined in a protocol (also in that ns) |
| 12:08 | jweiss | so i did extend-protocol and added that fn to a java type |
| 12:08 | raek | shouldn't make any difference, I think... |
| 12:09 | raek | I guess you could try to look at the macro expansion for things like typos, etc |
| 12:10 | raek | (preferably, do the macro expansion in the namespace that :uses it) |
| 12:11 | raek | another test: try to eval macro.name.space/the-protocol-fn in the dependent namespace |
| 12:13 | raek | (if that doesn't work, there's problably something suspicious with the defprotocol) |
| 12:14 | jweiss | raek, ah silly me. it was a forward definition. didn't see it before because i had been developing in the repl and the fn was already defined. |
| 12:22 | replaca | jweiss: (answering your earlier question): you can make the fn private and then access it by full var syntax: i.e., #'clojure.pprint/init-navigator |
| 12:23 | raek | the @#'foo/bar hack adds an extra step of indirection, right? |
| 12:24 | replaca | raek: you don't need an @ |
| 12:24 | raek | ah, yes... they implement IFn... |
| 12:24 | replaca | right |
| 12:25 | replaca | if you're trying to pull a private variable binding, I think you do need @ though |
| 12:25 | raek | exactly |
| 12:49 | patrkris | cake question: i cloned the cake repository and when I run `cake deps` it complains that it cannot localte uncle/core.clj, presumably because that dependency has not been downloaded yet. How can I remedy this? |
| 12:50 | patrkris | ah sorry, should probably ask this in #cake.clj |
| 14:00 | mduerksen | i want to take my clojure programming "to the next level" - and by that i mean i want to start building an abstraction level over my existing code. i guess clojure's macros are well suited for that, but i'm not sure where to start and what to consider. are there any good learning ressources especially for abstractions in clojure (or lisp in general)? |
| 14:01 | mduerksen | something like "meta-programming" |
| 14:03 | ducki2p | mduerksen: chapter 12 of practical clojure? |
| 15:24 | arohner | is there a library out there that does DB operations in memory, on sets? kind of like clojure.set/index on steroids? |
| 15:32 | kumarshantanu | arohner: can't use an in-memory database? like H2, HSQL-DB or Derby? |
| 15:33 | arohner | kumarshantanu: I want to do DB-like manipulations on clojure datastructures, not a real DB |
| 15:33 | arohner | like I said, clojure.set/index on steroids |
| 15:34 | kumarshantanu | arohner: Maybe rql? https://github.com/MrHus/rql |
| 15:35 | kumarshantanu | sorry I am just guessing...haven't looked at rql deeply |
| 15:35 | arohner | kumarshantanu: that's almost exactly what I'm interested in. thanks |
| 15:36 | fliebel | arohner: FleetDB is written in Clojure, so I assume you can use it directly. |
| 15:36 | kumarshantanu | arohner: there's also a close cousin to rql, called mql: http://techbehindtech.com/2010/09/08/mql-a-clojure-library-for-querying-nested-maps/ |
| 15:40 | arohner | fliebel, kumarshantanu: thanks |
| 15:50 | LauJensen | arohner: clojureql is based off relational algebra, hook the backend up to an in memory db and you're all set |
| 16:26 | charliekilo | Stupid question: since Clojure's data structures are immutable are they always passed by reference into functions? |
| 16:26 | amalloy | charliekilo: yep |
| 16:28 | charliekilo | amalloy: Thanks |
| 16:29 | fliebel | charliekilo: If they are immutable, why would you care? |
| 16:30 | charliekilo | amalloy: Are you aware of an easy code snipped that shows that behavior or would I need to drop down to Java and/or a memory analyzer?!? |
| 16:31 | amalloy | charliekilo: you just have to open a java tutorial. it's not possible to pass objects by value in java |
| 16:31 | amalloy | all object references are pointers; the pointer is passed by value, which is a reference to the original object |
| 16:32 | charliekilo | fliebel: I am wondering if I have a large hash I can pass it around without duplication |
| 16:33 | amalloy | you can. don't worry about it |
| 16:33 | charliekilo | amalloy: yep thats how I remembered it from way, way back, but wanted to make sure ... thanks again! |
| 16:33 | amalloy | if you really want to see it happen, you can AOT compile your classes, then inspect the generated bytecode with javap -c |
| 16:34 | charliekilo | amalloy: hmm ... thats a good idea! |
| 17:50 | FireSnake | I'm looking for a pair programming buddy --- right now teaching myself to build and deploy clojure web applications on compojure and GAE. Anyone interested? |
| 18:42 | FireSnake | Anyone know how to integrate JQuery and CSS with Compojure 0.5.3? or if not which Compojure is better? |
| 18:42 | FireSnake | I have seen tutorials on the web talking about include-css and include-js but those commands do not work with Compojure 0.5.3 |
| 18:42 | FireSnake | there is only a compojure.core and compojure.routes file |
| 18:42 | FireSnake | the compojure.routes has a command files but not sure how to use it |
| 18:43 | FireSnake | is there some other version from Clojars I should be using? |
| 18:43 | FireSnake | My static CSS/HTML and JQuery files are breaking my application |
| 18:43 | FireSnake | I get 500 errors |
| 18:51 | dnolen | FireSnake: I think you probably need to use the Ring static files middleware. Not well documented, I would ask your question on the Ring Mailing list |
| 18:51 | FireSnake | maybe I am doing this stupidly -- I am fine with include-css and include-js but they don't seem to be working |
| 18:52 | FireSnake | other things are |
| 18:52 | FireSnake | I am including compojure.core |
| 18:52 | FireSnake | :use -ing to be precise |
| 18:52 | amalloy | FireSnake: also, if you're interested in pair programming you should probably mention where you live. of course anything is possible with the internet, but proximity still helps |
| 18:52 | FireSnake | I'm in New York |
| 18:52 | FireSnake | City/Long ISland |
| 19:08 | cpfr | FireSnake, nyc or long island city |
| 19:09 | FireSnake | new york city or garden city on long island |
| 19:15 | cpfr | ah ok |
| 19:15 | cpfr | you guys got a good clojure group over there |
| 19:27 | FireSnake | yes we have rich hickey |
| 19:29 | cpfr | among others |
| 19:33 | FireSnake | where are you cpfr |
| 19:34 | cpfr | los angeles |
| 19:34 | FireSnake | what kind of programming do you do? |
| 19:34 | cpfr | data mining |
| 19:34 | FireSnake | financial? |
| 19:35 | FireSnake | or marketing? |
| 19:56 | jweiss | huh, i'm noticing in my repl, macroexpand won't expand anything inside a let. |
| 19:56 | jweiss | it just expands let -> let* and stops |
| 20:00 | jweiss | oh duh, it's not supposed to |
| 20:01 | Clinteger | hm |
| 20:01 | Clinteger | what's the best way to get clojure installed on windows? i'm obviously new here :p |
| 20:02 | Clinteger | i tried clojure box but its emacs is broken on my computer :| |
| 20:08 | TakeV | Is there anyone here who uses Penumbra with Lein? |
| 20:38 | amalloy|away | Clinteger: do you have either cygwin or ruby? |
| 20:38 | Clinteger | i have both |
| 20:38 | Clinteger | trying to fix emacs atm, though |
| 20:38 | amalloy | then probably cake is a good bet |
| 20:38 | qbg | Clinteger: You could install Eclipse and Counterclockwise |
| 20:38 | amalloy | $whatis cake |
| 20:38 | sexpbot | cake does not exist in my database. |
| 20:38 | Clinteger | eww, eclipse :( |
| 20:39 | amalloy | $google clojure cake github |
| 20:39 | sexpbot | First out of 648 results is: ninjudd/cake - GitHub |
| 20:39 | sexpbot | https://github.com/ninjudd/cake |
| 20:39 | amalloy | it's a build tool that will fetch all the dependencies for your projects, including clojure itself |
| 20:39 | Clinteger | yeah i've heard about it |
| 20:39 | Clinteger | i didn't know how difficult it was to install though |
| 20:39 | amalloy | Clinteger: there's a ruby gem of it |
| 20:40 | lazy1 | What's the best way to get the body of POST request in Compojure? |
| 20:40 | amalloy | or you can just git-clone the cake repo and add it to your PATH |
| 20:41 | Clinteger | hm |
| 20:41 | Clinteger | well i'm going to try to get emacs to work right now XD |
| 21:06 | amalloy | hurrah for emacs |
| 21:09 | Clinteger | amalloy if it worked, yes :( |
| 21:10 | TakeV | Is there any reason why lein can't seem to extract files when I run native-deps? |
| 21:10 | amalloy | Clinteger: tbh i switched from cygwin to ubuntu not long after i started using clojure. so far the only thing i miss is netflix streaming :P |
| 21:11 | Clinteger | amalloy well...i would miss iTunes too much. i have an iPhone |
| 21:11 | Clinteger | and my computer doesn't have hardware virtualization (bah i know its old) so I can't run iTunes in a VM |
| 21:12 | amalloy | Clinteger: http://blogote.com/2010/linux-tips/top-itunes-alternatives-for-linux.html maybe? i don't use itunes, so i can't really speak with authority |
| 21:13 | amalloy | but i guess you should stick to one massive change at once, like learning clojure :) |
| 21:14 | Clinteger | amalloy the problem is usually that they don't work with iPhone 4 |
| 21:14 | Clinteger | or they really just sync music |
| 21:22 | Raynes | Clinteger: You could duel boot windows or run windows in a virtualbox if the only reason you needed to run Windows was just iTunes. |
| 21:23 | Raynes | Clinteger: Does gtkpod support iPhone4? gtkpod is the monster truck of iPod software on Linux, so if anything supports it, it'd probably be newer versions of gtkpod. |
| 21:24 | Clinteger | omg Raynes you're the person who inspired me to learn Clojure |
| 21:24 | Raynes | o.o |
| 21:24 | Raynes | dual* |
| 21:24 | Clinteger | sorry, </stalker> |
| 21:24 | amalloy | lol |
| 21:24 | Raynes | How did I manage that? :> |
| 21:24 | amalloy | Raynes refuses to admit he's a celebrity |
| 21:25 | Clinteger | Raynes because you're a year younger than me and have accomplished a lot more. I've realized I have to catch up :p |
| 21:26 | Raynes | I have? Awesome! |
| 21:26 | Clinteger | yes, i'm a loser :( |
| 21:27 | Raynes | Surely not. None of my fans are losers. |
| 21:27 | amalloy | Raynes: crushing the souls of young people everywhere |
| 21:27 | Raynes | Excuse me, I need to feed my ego some apple sauce. |
| 21:28 | amalloy | Clinteger: hey, since we have someone from Raynes's fan club here: i'm in the middle of adding a quick-start guide for developing sexpbot |
| 21:28 | Clinteger | I...don't really know what you're getting at here :p |
| 21:29 | amalloy | i mean, once you know something about clojure, you could contribute to his most famous project |
| 21:29 | Clinteger | ah i see |
| 21:29 | Clinteger | :p yeah i'd love to help, i love irc bots >_> |
| 21:29 | Raynes | amalloy: I was under the impression that my most famous project was tryclojure. In principle. |
| 21:29 | Clinteger | Raynes maybe someday I would help out with that |
| 21:29 | Raynes | Or was, anyway. It was the most exciting development in the world, and then suddenly everybody forgot it existed. |
| 21:30 | sexpbot | Clinteger: irc bots love you too |
| 21:30 | Raynes | $botsnack |
| 21:30 | Raynes | Surly amalloy didn't break that. |
| 21:31 | amalloy | surely not |
| 21:31 | Raynes | surely, even |
| 21:31 | Raynes | Oh, but somebody did. |
| 21:32 | Raynes | This is the part of Liar Liar where someone farts and I say "It was meeee" |
| 21:33 | Raynes | Clinteger: Welcome to the wonderful world of Clojure. Enjoy the ride. |
| 21:34 | Raynes | $reload |
| 21:34 | sexpbot | Reloaded successfully. |
| 21:34 | Raynes | $botsnack |
| 21:34 | sexpbot | Raynes: Thanks! Om nom nom!! |
| 21:34 | Raynes | Good boy. |
| 21:35 | Clinteger | i've always been interested in the various lisp dialects, CL just never seemed...right. lets hope clojure does. |