2009-03-17
| 00:01 | gavin___ | I also see the InterruptedException on a (Thread/sleep 10) like you describe |
| 00:02 | durka42 | when i press C-c, or run "kill -INT <pid>" the REPL just exits |
| 00:02 | gavin___ | durka42: did you run (add-break-thread!) first? |
| 00:02 | durka42 | oh, no i didn't |
| 00:02 | gavin___ | ;-) |
| 00:03 | Chouser | if we get all these kinks worked out, perhaps the repl will someday do this by default |
| 00:04 | gavin___ | would be nice, the other day I was about to gouge my eyes out from having to kill and restart my repl over and over ;-) too much fun with infinite sequences |
| 00:05 | Chouser | you've tried *print-length* ? |
| 00:05 | gavin___ | no, I need to. But I think I wasn't smart enough to use lazy sequences to begin with, i.e. my code really was going into an infinite loop |
| 00:05 | gavin___ | loop/recur madness |
| 00:08 | Raynes | gavin___: You have too many _'s in your name. Feel's like you're calling a function and disregarding its arguments. |
| 00:09 | gavin___ | lol. I don't really use irc much, just typed gavin into my client and this is what i got |
| 00:10 | Raynes | You can change your nick with /nick if you want. |
| 00:12 | gavinds | thanks, found one! |
| 02:32 | Raynes | I'm learning all sorts of swingfoo. |
| 02:32 | Raynes | I'm about to drown in BorderLayouts |
| 03:53 | Raynes | Getting people to check out Clojure is almost a sport to me now. |
| 04:02 | Lau_of_DK | Top of the morning gents |
| 06:00 | AWizzArd | clojurebot: max people |
| 06:00 | clojurebot | max people is 162 |
| 06:51 | Lau_of_DK | AWizzArd, What is max people ? |
| 06:51 | Lau_of_DK | ~max people? |
| 06:51 | clojurebot | max people is 162 |
| 06:51 | Lau_of_DK | ~162? |
| 06:51 | clojurebot | It's greek to me. |
| 07:05 | AWizzArd | Lau_of_DK: the highest number of people at the same time in this channel. |
| 07:05 | AWizzArd | Record is 162. |
| 07:05 | Lau_of_DK | Oh ok |
| 07:05 | Lau_of_DK | So its the record of all time |
| 07:06 | AWizzArd | Yes. |
| 07:06 | AWizzArd | I remember when it was around 80 in October. |
| 07:06 | AWizzArd | Lau_of_DK: hmm, since you came here the number of users doubled |
| 07:06 | Lau_of_DK | As expected... |
| 07:06 | Lau_of_DK | :D |
| 08:36 | gnuvince | Good morning |
| 08:37 | rhickey | gnuvince: hey - did you get anywhere in your perf tuning? |
| 08:39 | gnuvince | rhickey: nowhere yet, I'm planning to branch my code and try different approaches. I'm beginning to think that my declaration of byte fields might be suboptimal. |
| 08:40 | rhickey | you should focus on your innermost loop(s) - profiling should have pointed that out, but that profiler output looked goofy |
| 08:45 | gnuvince | The weird profile output was due to the JVM packaging problem in Hardy; running it on my Ibex machine gave me a much more "believable" output. |
| 09:01 | lpetit | hi all |
| 09:02 | gnuvince | Hello lpetit |
| 09:06 | blbrown_lt | hello all |
| 09:46 | danlarkin | big mistake coming into the office today... we're three floors above an irish bar and I can still hear them |
| 09:47 | gnuvince | danlarkin: hahaha :) |
| 09:47 | gnuvince | awesome |
| 09:57 | Chouser | ,(assoc (bean Integer) :a 1) |
| 09:57 | clojurebot | java.lang.reflect.InvocationTargetException |
| 09:57 | Chouser | hm. |
| 09:57 | Chouser | I get java.lang.AbstractMethodError |
| 09:58 | p_l | anyone knows the state of trivial-http? I'm wondering whether I should modify the lib to use drakma or leave trivial-http in... |
| 09:59 | danlarkin | Chouser: it works on my box |
| 09:59 | Chouser | danlarkin: what rev do you have? |
| 10:00 | danlarkin | clojure 1327, java 1.5 |
| 10:00 | Drakeson | compojure.html provides a handy way for generating html from trees, like [:html [:body [:p "Hello world]]] -> what you would expect. Is there a reverse convertor? |
| 10:02 | Chouser | danlarkin: ok, that rev works for me too |
| 10:02 | danlarkin | ah ha |
| 10:02 | Chouser | 1328, 1329, 1330 were all proxy patches. bean uses proxy. it's broken now. |
| 10:06 | Chouser | 1328 works fine |
| 10:06 | Chouser | for this test, anyway |
| 10:06 | Chouser | 1329 breaks it |
| 10:08 | cgrand | ,(.assoc (bean Integer) :a 1) ;works... |
| 10:08 | clojurebot | java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers) |
| 10:09 | Chouser | huh |
| 10:10 | Chouser | but casting the proxy to Associative first breaks it? |
| 10:13 | rhickey | danlarkin: current svn passes all 2278 assertions in contrib tests |
| 10:15 | rhickey | cgrand: you'll probably need to look at what javac generates in the same scenario - covariant returns inherited from multiple interfaces |
| 10:16 | rhickey | probably two methods, one marked as bridge |
| 10:17 | Chouser | yikes. I bet I'll have to understand that soon. |
| 10:18 | Chouser | or maybe I'll just crib off of whatever cgrand comes up with. |
| 10:19 | rhickey | Chouser: you'll need to understand that because ... ? |
| 10:20 | cconstantine | clojure newbie here. Is there anyway (besides 'take') to end an infinate sequence? |
| 10:20 | Chouser | rhickey: so that 'instance' can emit the right code. |
| 10:20 | cconstantine | preferably with a tester func |
| 10:21 | rhickey | Chouser: I see - how's that going? |
| 10:21 | Chouser | I haven't started on any emits yet, so perhaps I misunderstand what I'll need to understand |
| 10:21 | rhickey | I'd like to get involved ASAP, ASAP being after ILC |
| 10:21 | Chouser | I'm enjoying it. |
| 10:21 | Chouser | oh! |
| 10:21 | Chouser | well |
| 10:21 | rhickey | A good first target is source code |
| 10:22 | rhickey | emit target |
| 10:22 | Chouser | there's a chance that by then analyze/compile will be done. |
| 10:22 | cconstantine | cconstantine: take-while thanks :) |
| 10:22 | Chouser | a good chance it will be sorta working, but may need a lot of cleanup |
| 10:23 | rhickey | I have a lot of ideas about this (obviously), doing something a second/third time is always productive |
| 10:23 | Chouser | I'm learning as I go -- generally I translate a class or method a bit rote, not understanding. Then it clicks and I can clean it up a bit. |
| 10:23 | rhickey | One thing I'm not sure will be possible from source is locals clearing |
| 10:24 | Chouser | yeah, if you need to look at what I've done, smile politely, and do it over from scratch, I won't be offended. :-) |
| 10:24 | rhickey | I want to get ASM out on its own |
| 10:26 | Chouser | what I have is still very mutable -- lots of dynamic vars and even a few atoms. But I'm afraid of removing that the Wrong Way before I understand where the mutation is currently being used. |
| 10:27 | rhickey | Chouser: that will have to go at some point. as I said before, I think I'd be happy to pass/return more than I did in Java |
| 10:27 | Chouser | I expect to have analyze for all the special forms "done" in the next couple days, and was then planning on cleaning out all the mutation. |
| 10:29 | rhickey | def is only marginally special, I'd like to make it not so, leaving let/letfn/do/if/./try/loop/recur/instance/quote/var/assign ...? |
| 10:31 | Chouser | I've got let, loop, do, instance so far. Working on "dot" now |
| 10:31 | rhickey | I would thread the environment through analyze, and have it return an (extensible) map |
| 10:31 | Chouser | I hope you find some of this code useful, but I really don't know. |
| 10:32 | rhickey | Chouser: I think it would be a fantastic addition and appreciate the help |
| 10:32 | Chouser | my code's not up anywhere yet. I would hesitate to show it to anyone, but if that'd be better than me trying to describe it... |
| 10:32 | rhickey | could easily see new ActionScript and ObjC targets |
| 10:32 | Chouser | yes, absolutely |
| 10:33 | Chouser | This is already the level at which ClojureScript works |
| 10:33 | rhickey | Clojure ... on ... iPhone ... (I dare not consider) |
| 10:33 | Chouser | :-) |
| 10:33 | Chousuke | hmm, writing firefox extensions in clojure... |
| 10:34 | shoover | Chouser: What the heck are you talking about? the clojure-log hasn't caught up |
| 10:34 | Chouser | analyze currently takes a single form arg -- everything else is in dynamic vars (even context, because I didn't see why it should be special) |
| 10:34 | rhickey | hrm |
| 10:35 | Chouser | so I think it'll make the most sense to pass two args -- form and an "env" map |
| 10:35 | Chouser | and similary return two things: the ast of the form, and an updated env map. |
| 10:36 | rhickey | Chouser: env definitely implies environment of names, maybe context map, which would include environment et al |
| 10:36 | Chouser | then places that currently have (into [] (map analyze args)) would have to be some kind of reduce |
| 10:36 | rhickey | most analysis doesn't return modified env, but does need to communicate a few things out, esp. closed-overs |
| 10:37 | rhickey | and nested instances |
| 10:37 | Chouser | shoover: The clojure compiler is currently written in Java. We're talking about re-writing it in Clojure. |
| 10:37 | shoover | ah |
| 10:38 | Chouser | rhickey: ok, it's the details of what can be "changed" by sub-forms that I need a better grasp of before I try to kill all the mutation. |
| 10:39 | Chouser | I'm under the vague impression that sets of vars, keywords, constants, etc. need to bubble up |
| 10:40 | Chouser | I'm very pleased with the LOC-per-concept, and the grouping of code by multimethod rather than by type. I think it makes the whole thing much easier to understand. |
| 10:40 | rhickey | right, encapsulated in registerXXX |
| 10:40 | Chouser | ...as will removing mutation. |
| 10:40 | rhickey | + closeOver |
| 10:42 | Chouser | 1000 LOC for analyze + compile + emit might be a bit optimistic |
| 10:42 | rhickey | Lisp in Lisp is really quire easy and pretty |
| 10:42 | rhickey | quite |
| 10:43 | Chousuke | how are you going to handle bootstrapping the thing? are you just going to keep the java compiler in for bootstrapping purposes? :/ |
| 10:44 | rhickey | Chousuke: yes, some version of Clojure will always exist from now on |
| 10:44 | Chouser | I need a better name for eval/expr/statement context. "context" is too vague |
| 10:44 | rhickey | it needn't be the Java version, just AOT-compiled |
| 10:44 | Chousuke | right. |
| 10:45 | rhickey | Chouser: ah, that context, never goes away with these targets... |
| 10:46 | Chouser | I keep hoping eval will, but yes I assume expr vs. statement is important. |
| 10:46 | Chouser | is that "emit context"? |
| 10:46 | rhickey | expr/statement/return |
| 10:46 | Chouser | ah, yes |
| 10:46 | rhickey | emit-context is fine |
| 10:47 | rhickey | it is very much about the target capabilities/distinctions |
| 10:48 | rhickey | one thing that is tricky is that right now some lambda wrapping/lifting occurs during analysis, might not apply to all targets (but probably will) |
| 11:17 | Chouser | anyone know of a static method in the standard Java library that takes 0 args? |
| 11:18 | cgrand | Chouser: look at Desktop |
| 11:19 | triddell | System.currentTimeMillis() ? |
| 11:19 | Chouser | great, thanks guys. |
| 11:19 | blbrown_lt | Runtime.systemCurrentTimeMillis() ...or whatever |
| 11:19 | blbrown_lt | triddell, beat you |
| 11:19 | blbrown_lt | of course mine is wrong |
| 11:26 | triddell | term |
| 11:31 | marklar | Has anyone here done anything with Android? I'm trying to put a class I created using gen-class (extends SurfaceView) into a layout file and it can't find the class |
| 11:32 | marklar | or another way to ask that is if I call something like (ns net.marklar.clojuretests :gen-class :name surfaceview.... what would be the fully qualified name of that class? |
| 11:35 | danlarkin | marklar: http://github.com/remvee/clojurehelloandroid/tree/master |
| 11:37 | marklar | danlarkin: Yes, I've looked at that... I've been able to load programs programs into the emulator and run them, but I'm having trouble loading this custom class in a layout |
| 11:37 | marklar | I have a feeling it has to do with the fully qualified name of the class that is generated |
| 11:38 | danlarkin | I think the class name would be net.marklar.clojuretests.surfaceview |
| 11:39 | marklar | danlarkin: yeah, thats what I thought, thanks |
| 11:39 | danlarkin | although I haven't really done much at all with gen-class |
| 11:39 | danlarkin | so I could be wrong, and often am! |
| 11:40 | marklar | danlarkin: the two of us couldn't be wrong, could we?!?! |
| 11:40 | Chouser | I think you need to fully-qualify the :name arg |
| 11:41 | marklar | Chouser: ah, ok I'll give that a shot |
| 11:41 | Chouser | ":name aname The package-qualified name of the class to be generated" |
| 11:41 | marklar | ah thanks |
| 11:41 | marklar | guess we could be wrong ;) |
| 11:42 | Chouser | it's pretty common to leave out the :name arg, and do one class per namespace/file |
| 11:42 | Chouser | oh |
| 11:42 | Chouser | nm |
| 11:42 | Chouser | don't leave out the :name arg. :-) |
| 11:42 | Chouser | "Options should be a set of key/value pairs, all except for :name are optional" |
| 11:42 | marklar | Chouser: lol ok :) |
| 11:42 | danlarkin | :o |
| 11:43 | danlarkin | I'm not using :name :-[ |
| 11:43 | danlarkin | and it worked! a few revisions ago anyway |
| 11:43 | marklar | I think there is a difference between using (gen-class) and (:gen-class) right? |
| 11:43 | marklar | I've used :gen-class without a name before |
| 11:44 | rhickey | (doc ns) |
| 11:44 | clojurebot | Sets *ns* to the namespace named by name (unevaluated), creating it if needed. references can be zero or more of: (:refer-clojure ...) (:require ...) (:use ...) (:import ...) (:load ...) (:gen-class) with the syntax of refer-clojure/require/use/import/load/gen-class respectively, except the arguments are unevaluated and need not be quoted. (:gen-class ...), when supplied, defaults to :name corresponding to the ns name, :m |
| 11:44 | marklar | rhickey: ah, thanks |
| 11:46 | danlarkin | here's my one and only use of :gen-class, http://github.com/danlarkin/madison/blob/59dd04cd3723e9fbcb83ca40724e18312106bc9d/src/madison/main.clj |
| 11:47 | danlarkin | and that gets Main-Class'ed in the jar |
| 12:23 | jhawk28 | I think I got Issue 34 fixed |
| 12:24 | jhawk28 | :) |
| 12:42 | jhawk28 | I posted the fix to the Clojure group |
| 12:43 | AWizzArd | jhawk28: did you sign the Clojure Contributor Agreement? |
| 12:43 | jhawk28 | yep |
| 12:44 | jhawk28 | Joshua Foster (jhawk28) |
| 12:44 | jhawk28 | http://clojure.org/contributing |
| 12:44 | AWizzArd | Then your fix has a chance to get checked in :) |
| 12:44 | jhawk28 | as long as its not too noobish |
| 12:45 | rhickey | jhawk28: that seems to miss the main intent - you are reading something you don't necessarily trust, so it is unlikely to contain #r, the idea behind a flag is: (binding [*read-eval* false] (read untrusted-source)) |
| 12:46 | rhickey | i.e. it requires no new reader syntax, just the reader looking at *read-eval* |
| 12:47 | jhawk28 | the problem with the (binding [*read-eval* false] (read untrusted-source)) is that the reader does not have visibility of the *read-eval* at read time |
| 12:47 | rhickey | why not? |
| 12:47 | jhawk28 | its not in the thread scope |
| 12:48 | rhickey | sure it is |
| 12:49 | rhickey | you just have to access the var from Java, and use .deref |
| 12:50 | rhickey | will see the thread-local binding |
| 12:50 | jhawk28 | the .deref always pointed to the inital value of true while in the reader |
| 12:50 | jhawk28 | it would point to false if I used set! instead of binding |
| 12:51 | jhawk28 | but set! changes the global value instead of thread local |
| 12:52 | rhickey | none of that is true |
| 12:53 | jhawk28 | most likely, Im a clojure newb |
| 12:53 | rhickey | set! can't change a root binding, and dynamic bindings are visible during a read nested within binding |
| 12:53 | rhickey | can you paste what you tried? |
| 12:53 | jhawk28 | just so that I understand what you are saying... |
| 12:55 | jhawk28 | (binding [*read-eval* false] #=(eval (def x 3))) |
| 12:55 | Lau_of_DK | Hi guys |
| 12:55 | jhawk28 | I may have been focussing on the wrong problem |
| 12:55 | WizardofWestmarc | heya Lau |
| 12:55 | jhawk28 | I was trying to disable the use of the EvalReader which is #= |
| 12:56 | rhickey | jhawk28: you are mixing up the reading of that expression and its evaluation, people aren't going to put (binding [*read-eval* ... in the thing being read |
| 12:57 | rhickey | they are going to do an explicit read/load-file inside a binding |
| 12:57 | rhickey | the thing they are reading might contain #=, which they want to disable |
| 12:57 | jhawk28 | ah, ok like the load-string |
| 12:59 | rhickey | right, or read-string |
| 13:00 | jhawk28 | (binding [*read-eval* false] (load-string "#=(eval (def x 3))" )) |
| 13:00 | jhawk28 | I knew I was missing something |
| 13:00 | rhickey | it's unlikely to be load, since it is untrusted |
| 13:01 | rhickey | read-string should be your use case |
| 13:01 | jhawk28 | ok, thanks |
| 13:01 | jhawk28 | I'll remove the extra reader and add the doc for *read-eval* to the core.clj |
| 13:03 | jhawk28 | should I be using Var.get or deref? get calls deref |
| 13:03 | rhickey | deref |
| 13:06 | rhickey | http://constc.blogspot.com/2009/03/relativity-of-simultaneity.html |
| 13:10 | danlarkin | this opening paragraph sure is glowing |
| 13:13 | danlarkin | he puts his idea into words well, I think. I like it |
| 13:14 | Chousuke | It made me think about the sinfest Buddha character who in some strips just walks around without saying anything and touches the other characters on the forehead and *ping* they experience a moment of Zen |
| 13:32 | pjstadig | clojurebot: any message? |
| 13:32 | clojurebot | I don't understand. |
| 13:33 | pjstadig | bah |
| 13:37 | fanda | hello! |
| 13:38 | fanda | I have question about the reader |
| 13:38 | fanda | http://clojure.org/reader |
| 13:38 | fanda | Numbers say "as per Java" |
| 13:39 | fanda | I found that e.g. "2." read Java as double and Clojure as int |
| 13:40 | fanda | all these read as double in Java: |
| 13:40 | fanda | 2. .1 +.0 -.0 +2. -2. |
| 13:41 | fanda | Clojure either sees them as int or errors out |
| 13:41 | fanda | ok, not ok? |
| 13:42 | jhawk28 | I think you need 2.0 0.1 +0.0 +2.0 -2.0 |
| 13:43 | fanda | yes, I know - I am just wondering about consistency Java vs. Clojure reader |
| 13:43 | fanda | do we want to copy all Java behavior exactly? |
| 13:43 | pjstadig | fanda: i'm not sure how exactly Clojure is supposed to match Java in that regard |
| 13:43 | pjstadig | but could be a bug |
| 13:44 | fanda | I will post it to the group |
| 13:45 | fanda | it's apparently rhickey's call to answer |
| 13:46 | fanda | thanks! |
| 13:48 | Chousuke | I don't think being able to use .5 instead of 0.5 is a significant enough convenience that it should be supported. :/ |
| 13:49 | danlarkin | well I think he's just asking about the inconsistency |
| 14:13 | jhawk28 | fanda: 2f is not accepted in Clojure as a float |
| 14:14 | jhawk28 | fanda: I have a feeling that the "as per Java" is in reference to the types and limitations associated with the type rather than the syntax of the type |
| 14:17 | fanda_ | jhawk28: I posted a question to the group, so hopefully Rich answers |
| 14:18 | fanda_ | it is more of a theoretical question than any need |
| 14:20 | hiredman | the 2f thing sounds familiar, it may have come up before |
| 14:20 | fanda_ | (float 2) ? ;-) |
| 14:22 | hiredman | I think someone was asking for clojure's reader to read 2f as a float |
| 14:24 | fanda_ | yes, floats are supposedly faster than doubles, so number crunching people use floats |
| 14:42 | lisppaste8 | beatis-fly pasted "lame merge" at http://paste.lisp.org/display/77190 |
| 14:43 | baetis-fly | anyone feel like telling me how to make the above a little less ... lame? |
| 14:44 | rhickey | baetis-fly: add a comment that describes what it is supposed to do? ;) |
| 14:45 | baetis-fly | rhickey: ah, that would be helpful wouldn't it :) It does what it's supposed to do (i think). Takes two sorted collections and returns a single one. I know there are other ways to do this, but I wanted to do it from scratch. |
| 14:46 | baetis-fly | rhickey: it's the classic merge used in a merge sort. |
| 14:47 | baetis-fly | rhickey: actually, the two lists don't have to be sorted...takes two unsorted cols, returns one sorted col made up of the elements of left and right. which is still an awful explaination. |
| 14:47 | baetis-fly | rhickey: ug, scratch that last one. they do have to be sorted. |
| 14:47 | cmvkk | nah, if you pass unsorted colls to it, the result won't be sorted. |
| 14:48 | baetis-fly | yeah, brain melted there for a second. |
| 14:48 | baetis-fly | anyway, it works for what I want it to do, but I hate the reverse i have to do when i'm done, and i just feel like some functional wizard could do it in one line :) |
| 14:49 | cgrand | baetis-fly: use a lazy-seq instead |
| 14:50 | baetis-fly | cgrand: see, i was going to get to that as well, but was having a hard time understanding it. Do I just have to wrap the whole thing in (lazy-seq o? |
| 14:51 | cmvkk | basically, then instead of recur, you (cons (first left) (merge-col (rest left) right)) or something like that |
| 14:53 | baetis-fly | and I don't have to worry about the stack I take it? |
| 14:54 | cmvkk | that is my current understanding, yes. |
| 14:56 | lisppaste8 | cgrand annotated #77190 "for; baetis-fly" at http://paste.lisp.org/display/77190#1 |
| 14:59 | baetis-fly | cmvkk: doesn't quite work, but i get the idea. That's pretty awesome. Many thanks. |
| 15:02 | lisppaste8 | beatis-fly annotated #77190 "lazy version fixed" at http://paste.lisp.org/display/77190#2 |
| 15:02 | lisppaste8 | cgrand annotated #77190 "now with matching parenthesis!" at http://paste.lisp.org/display/77190#3 |
| 15:02 | baetis-fly | :) thanks again. that's really cool. |
| 15:03 | cgrand | didn't see you fixed it :-) |
| 15:04 | slashus2 | baetis-fly: Or you could just use concat |
| 15:04 | slashus2 | wait |
| 15:04 | slashus2 | forget I typed anything |
| 15:05 | hiredman | ! |
| 15:05 | hiredman | the skills matter podcast whatever is up |
| 15:09 | lisppaste8 | rhickey annotated #77190 "merge-coll redux" at http://paste.lisp.org/display/77190#4 |
| 15:11 | baetis-fly | rhickey: that looks cool too. has the added benefit of making me learn what :as is for ;) |
| 15:15 | Chousuke | that is asking for a merge-coll-by :) |
| 15:15 | Chousuke | or -with perhaps |
| 15:22 | slashus2 | One of my professors went to the Washington D.C. conference on parallel computing last weekend, and he said that people there were excited about clojure. |
| 15:23 | hiredman | http://video.google.co.uk/videoplay?docid=-4617600643842067036&hl=en |
| 15:24 | danlarkin | heh, I saw that date, 12-30-2009, and I was like... uhhh what? it's not December yet |
| 15:24 | danlarkin | 03, rather |
| 15:38 | hiredman | crazy little-endian dates |
| 15:38 | Raynes | Could someone give me an example of something that a set would be useful for. |
| 15:38 | Raynes | I' |
| 15:38 | Raynes | I'm drawing blanks. |
| 15:39 | hiredman | a collection of things with no dupplicates |
| 15:39 | hiredman | also sets are functions of their members |
| 15:39 | hiredman | so doing lookups |
| 15:41 | Retonator | hey guys what is the best starter to learn some clojure (i have read most of the blogs and the main site etc...), maybe some project euler problems? |
| 15:41 | Raynes | Programming Clojure. |
| 15:41 | Raynes | Wonderful book. |
| 15:42 | hiredman | yeah, euler is good for learning the sequence functions |
| 15:43 | harpastum | I'm currently working through this detailed article: http://ociweb.com/jnb/jnbMar2009.html |
| 15:43 | harpastum | you might try that |
| 15:44 | Chouser | also good for learning to work with immutable collections |
| 15:44 | Retonator | yeah i have been looking at the book didn't know if it would be a good investement |
| 15:44 | Chouser | immutable locals |
| 15:44 | Retonator | harpastum: i will be looking at it |
| 15:45 | Retonator | yeah i really have to read up on all the data structures |
| 15:45 | Chouser | well, read some, but trying to use them will teach you quick. |
| 15:45 | Raynes | I was wondering because, I'm conjoining a number too a vector after every button click and then getting the numbers from that vector and doing stuff with them, but a set would work just the same. |
| 15:46 | Raynes | A set would probably be more appropriate. |
| 15:46 | Chouser | Raynes: if the order doesn't matter, sure. |
| 15:46 | Retonator | yes trying things out is worth alot |
| 15:46 | hiredman | well, do want a set of unique elements, or a vector of numbers? |
| 15:46 | danlarkin | order or dupes |
| 15:46 | Raynes | Nope, sure doesn't. |
| 15:46 | Retonator | harp: seems a pretty good link |
| 15:46 | Raynes | Oh I see, you can't have duplications in it. |
| 15:46 | Raynes | Vector it is. |
| 15:47 | Chouser | you want to know how many of each number, but the order doesn't matter? |
| 15:48 | hiredman | do you even need the properties of a Vector? |
| 15:48 | Raynes | I just need something I can put 2 numbers in, and then first-last them out. |
| 15:49 | Raynes | I don't need anything special at all. |
| 15:49 | Raynes | That's why a vector seemed like over kill. |
| 16:05 | Retonator | maybe a noob question but if i read correctly all of the other clojure functions are build up of, off the special forms? |
| 16:06 | harpastum | Yup. They're either built-in functions or macros using the special forms |
| 16:06 | harpastum | Although I'm no expert, I think that's right |
| 16:06 | Retonator | ok thanks |
| 16:07 | Chousuke | some of them use java methods too. |
| 16:07 | Retonator | but they use the . special form i guess? |
| 16:07 | Chouser | yes |
| 16:07 | Chousuke | yeah, or its lispier cousin :) |
| 16:07 | Chousuke | (the .method form) |
| 16:08 | Chousuke | but that's a macro which is transformed into the . form |
| 16:08 | Chouser | reader macro |
| 16:08 | Chouser | essentially |
| 16:09 | Chouser | same for AClass/staticMember -- built in macro-like foo turns that into (. AClass staticMember) |
| 16:09 | rhickey | Chouser: not a reader macro, normal macroexpansion time |
| 16:10 | rhickey | user=> (read-string "(.foo bar)") |
| 16:10 | rhickey | (.foo bar) |
| 16:10 | rhickey | user=> (macroexpand (read-string "(.foo bar)")) |
| 16:10 | rhickey | (. bar foo) |
| 16:10 | harpastum | Is there any way to get the java documentation of a function within the REPL? |
| 16:10 | Chouser | hm. yes, but you can't define such a macro yourself |
| 16:10 | Retonator | what is a reader macro? some special form expanded by the reader? |
| 16:11 | harpastum | sorry to disrupt the conversation |
| 16:11 | rhickey | true, but doesn't make it a reader macro - that's important for other macros, can treat .foo as a symbol |
| 16:11 | Chouser | rhickey: ok, yes. |
| 16:11 | Chouser | harpastum: (doc doc) |
| 16:11 | Retonator | no problem harp |
| 16:11 | harpastum | (doc Math/pow) |
| 16:11 | clojurebot | Pardon? |
| 16:12 | Chouser | harpastum: oh, java docs, sorry. (javadoc Math) |
| 16:12 | Chouser | harpastum: but for that to work you need (use 'clojure.contrib.repl-utils) |
| 16:13 | harpastum | ok |
| 16:14 | harpastum | I'm getting a filenotfound exception when i try that |
| 16:14 | harpastum | it doesnt look like i have the contrib package |
| 16:15 | harpastum | I'm working from the packaged version of clojure, does that make a difference? |
| 16:15 | harpastum | i.e. not svn |
| 16:16 | Chousuke | contrib is separate from clojure itself |
| 16:16 | Chouser | contrib's only available via svn or git, but you should be able to grab a similarly dated version of contrib and get that to work |
| 16:16 | Chouser | http://code.google.com/p/clojure-contrib/source/checkout |
| 16:17 | Chousuke | harpastum: a recent version of contrib won't work with the release because of changes in SVN |
| 16:19 | Retonator | are function defined without namespace always in the user/ namespace? |
| 16:21 | Chouser | Retonator: they're always put in the current namespace, which defaults to user |
| 16:22 | Chouser | you can change that with 'in-ns' or the 'ns' macro. |
| 16:22 | Retonator | ok thanks |
| 16:24 | hiredman | well, fns (function objects) don't seem to have a concept of their location in the realm of names |
| 16:24 | Retonator | maybe something different but what do you guys think about computer science education and the emvasis on declartive / imperative languages? I know that i had some class (years back) on clean(functional language) and that most of the ppl really had problems understanding anything, just do to there brain used to declartive / imperative thinking |
| 16:27 | harpastum | Well, I'm a computer engineer, and one of my professors told us today that PHP is a functional language |
| 16:27 | harpastum | so i'd say we're not doing too well |
| 16:27 | hiredman | heh |
| 16:29 | p_l | Retonator: I just read about how bad OOP is for introductory teaching :P |
| 16:29 | powr-toc | p_l: sounds like an interesting article :-) , have you got a link? |
| 16:29 | Retonator | and why is that? |
| 16:30 | Retonator | not that i dissagree |
| 16:30 | Retonator | -s |
| 16:30 | p_l | Retonator: compare "Hello World" in Pascal and Java :> |
| 16:30 | jhawk28 | p_l: but what about all those pretty pictures? |
| 16:30 | jhawk28 | (OO diagrams) |
| 16:31 | hiredman | php's anonymous function creation is, uh, wow |
| 16:31 | powr-toc | p_l: that's a weak argument... compare helloworld in Pascal to Helloworld in smalltalk or ruby... |
| 16:31 | Retonator | i don't think the size of hello world is an argument ;) |
| 16:31 | p_l | http://www.bcs.org/server.php?show=ConWebDoc.24941 (newer one), http://www.bcs.org/server.php?show=ConWebDoc.18854 (previous one) |
| 16:32 | powr-toc | ugh, not the bcs!! :-\ |
| 16:32 | p_l | Retonator: in Ruby or Pascal or C or Lisp etc. the hello world will be a simple set of instructions... in Java you'll have to build an OOP skeleton just to write one line of output :> |
| 16:32 | p_l | lol @ powr-toc |
| 16:33 | harpastum | "It is well known that students, regardless of their background, find programming the least popular aspect of their studies" |
| 16:33 | harpastum | really? |
| 16:33 | kotarak | What would be an elegant way to transparently provide some functionality depending on whether another module is available? |
| 16:33 | p_l | I find it not popular because it's redoing the same thing for n-th time |
| 16:33 | Retonator | mm i actually liked programming the most ;) |
| 16:33 | p_l | (for me) |
| 16:33 | jhawk28 | harpastum: for the average CS stutent, yes |
| 16:34 | p_l | Retonator: When you are force-fed Java while for last few year you have been basking in Ruby/Python/CL/Haskell/Erlang... |
| 16:34 | jhawk28 | how many professionals do you see actually coding at home? |
| 16:34 | harpastum | I must just be black sheep then |
| 16:34 | harpastum | I enjoying programming in _java_ |
| 16:35 | Retonator | me 2 |
| 16:35 | p_l | harpastum: BlueJ makes it harder >_> |
| 16:35 | powr-toc | amateurs FTW! :-) |
| 16:35 | harpastum | clojure just makes everything easier |
| 16:35 | Retonator | i enjoy learning lots of languages |
| 16:35 | jhawk28 | I work at a defense contractor and most coders dont do anything technical outside of work |
| 16:35 | jhawk28 | and Defense contractors have mostly "average coders" |
| 16:35 | powr-toc | jhawk28: Professional Software Engineers make me embarrased to call myself a professional! |
| 16:36 | jhawk28 | the good ones go home and still code |
| 16:36 | jhawk28 | powr-toc: professional meaning, get paid to code |
| 16:36 | Retonator | yeah i guess that is the meaning |
| 16:37 | p_l | (and I was paid for it) |
| 16:38 | Retonator | i still get paid, but i code mainly IL code ea c#, so it was very nice to read that clojure can target the clr in some time |
| 16:39 | powr-toc | jhawk28: professional, meaning gets paid to code, and assumes bcs membership means they are somehow better at what they do than people who enjoy coding and shun professional bodies for the racketeering jobs they are! |
| 16:39 | p_l | Retonator: there's also F# |
| 16:40 | p_l | powr-toc: I'm only looking through BCS in order to get access to some "professional" networking :) |
| 16:40 | jhawk28 | retonator: probably not any time soon - look at the troubles Fan has for CLR and JVM compatability |
| 16:40 | powr-toc | p_l: lol |
| 16:40 | hiredman | I got $100 to fix someone's asp page that wasn't sending emails properly |
| 16:40 | p_l | powr-toc: basically, to get enough contacts to find some work |
| 16:41 | Retonator | i did look at f# for some time it is mainly in the spirit of ocaml |
| 16:41 | Raynes | F# is a mess. :| |
| 16:42 | powr-toc | p_l: you're on irc, in an obscure chatroom talking about an obscure functional language... Why aspire to professionalism when you're clearly already way beyond most professionals? :-) |
| 16:42 | Raynes | I'd still rather use it than C# though. |
| 16:42 | powr-toc | p_l: What I'm saying is, I don't think my rant applies to anyone in here! ;-) |
| 16:42 | Raynes | D isn't so obscure anymore. |
| 16:42 | Raynes | CLojure* |
| 16:43 | Raynes | I'm positively amazed at the rate that the language is growing and gaining users. |
| 16:44 | Raynes | Clojure that is. ._. |
| 16:44 | hiredman | clojurebot: what do you think of clojure? |
| 16:44 | clojurebot | clojure is far closer to perfection then python |
| 16:44 | harpastum | Being one of those new users (just started a couple days ago), I'm surprised it isn't already widely used |
| 16:45 | Raynes | I've said that about many languages, like Haskell and Scala. But Clojure looks like it might take the cake too me. |
| 16:45 | Raynes | to |
| 16:45 | Retonator | what makes you think that raynes |
| 16:45 | harpastum | my main language is objective-C, which I enjoy because of the great base that cocoa provides. |
| 16:46 | p_l | powr-toc: it's the pitiful little thing known widely under the sign of � |
| 16:46 | harpastum | the comedy i find |
| 16:46 | Retonator | do you think most "common" programmers are ready for the clojure paradigms? |
| 16:46 | harpastum | is that i've been using mutable datatypes in immutable languages |
| 16:46 | harpastum | when it's really better the other way around |
| 16:46 | Raynes | Retonator: Just the fact that the language design is awesome, and it's powerful. People can't deny that Clojure has a lot going for it. People who see it are impressed by it and I've yet to see someone who hasn't been. |
| 16:47 | Raynes | I don't think that there is any such thing as a "Common" programmer. There are programmers who care about programming and would do it even if profit wasn't involved and there are those who just want cash. |
| 16:47 | powr-toc | Raynes: I agree, clojure's gaining a hell-of-a-lot-o' traction... but trust me, for most people in the industry it's obscure if it's not sold on golf courses or by Microsoft ;-) |
| 16:47 | Retonator | but if i refer back to my first saying on the education and the problem people had with functional languages. i mean been impressed is one? but coding them selves |
| 16:47 | Raynes | We are attracting number 1 at the moment, but number 2 might come eventually if Clojure ever gets used in the industry. |
| 16:48 | harpastum | Raynes: I think it's very similar to the difference between craftsmen and carpenters |
| 16:48 | Raynes | I think that people have a problem with "pure" functional programming actually. They hear about functional programming and find out that Haskell is the end all be all of functional programming, they try to learn it and get discouraged. |
| 16:49 | Retonator | and people are so used to side-effect |
| 16:49 | p_l | there's also a visible split between "traditional" programmers and people who had come to programming by finding that you can make pretty effect in JS and add some dynamism with PHP |
| 16:49 | Raynes | Haskell can ruin your view on functional programming, or it can open up a world of possibilities. It all depends on your experience. |
| 16:49 | harpastum | Side-effects never bothered me until my most recent project |
| 16:50 | harpastum | trying to explore possibilities in game trees is a pain in the ass in java |
| 16:50 | Raynes | I've seen so many people hear about functional programming, try to learn Haskell, fail, and then start posting blogs on why functional programming is impractical. |
| 16:50 | Retonator | why do you guess they fail? |
| 16:51 | Raynes | Don't get me wrong, Haskell is a wonderful language, I just wish people didn't think that Haskell is equal to functional programming as a whole. |
| 16:51 | harpastum | Probably the massive paradigm shift |
| 16:51 | Raynes | Retonator: Monads, for one. |
| 16:51 | Raynes | Is that a rhetorical question? |
| 16:52 | Raynes | Functional programming can be /toned/ down and still be the "best thing evar". |
| 16:52 | baetis-fly | Raynes: expect the same thing when java folks start looking at scala. |
| 16:52 | Raynes | I've seen even functional programmers have issues with Scala. |
| 16:52 | Chousuke | you don't need a functional language to do functional programming. it just helps. a lot :P |
| 16:52 | Raynes | Something about the type system. I don't know, never really messed with scala. |
| 16:53 | Chousuke | the basics of functional programming could be taught with something more familiar like ruby or python |
| 16:53 | Raynes | Ugh. |
| 16:54 | Raynes | Or they could just be taught with Clojure. |
| 16:54 | Raynes | :) |
| 16:54 | jhawk28 | Clojure is a little easier to teach functional to a Java dev because of the ability to loop |
| 16:54 | Chousuke | Clojure might be a bit too alien if the learner already knows a bit about programming. |
| 16:55 | Raynes | I don't think so. |
| 16:55 | Raynes | I really don't understand why Clojure could ever be hard for anyone. |
| 16:55 | Chousuke | but if you start with functional principles in python or something, it wouldn't be too difficult to transition to clojure. |
| 16:55 | jhawk28 | the difficulty with Lisp and other forms are the shortcuts - Java is mostly all spelled out |
| 16:56 | Raynes | Clojure is the simplest programming language I have ever used. |
| 16:56 | Raynes | Yet the funnest as well. |
| 16:56 | Retonator | btw this is a very nice article ;) http://ociweb.com/jnb/jnbMar2009.html |
| 16:56 | jhawk28 | its a feature when you know what the keywords mean, but learning can be a challenge |
| 16:57 | Chousuke | Raynes: yeah, clojure is simple and fun, but it's rather different from the traditional language where you have return statements and special keywords and syntax for stuff |
| 16:57 | Raynes | ,(println "Hello, world!") |
| 16:57 | Chousuke | I think the lack of an explicit return statement is one thing that can throw off beginners. |
| 16:57 | clojurebot | Hello, world! |
| 16:58 | Chousuke | you could first show them in python or something that it doesn't really matter that much :) |
| 16:59 | hiredman | define beginers |
| 17:00 | hiredman | I mean, if you know nothing about programming, who cares about a "return statement" |
| 17:00 | Chousuke | hiredman: beginners to functional programming. |
| 17:00 | Chousuke | experienced programmers are actually more difficult than beginners I suppose |
| 17:00 | hiredman | *shrug* |
| 17:00 | Chousuke | the problem is that not everyone "gets it" without putting significant effort into breaking their old mental model. |
| 17:00 | Retonator | how do i load a contrib lib in the slime repl, like this (require 'clojure.contrib.repl-utils) |
| 17:01 | Retonator | should it be on some path? |
| 17:01 | Chousuke | once your brain decides something is good, convincing it otherwise can be *really* difficult. |
| 17:02 | jhawk28 | Mutability is a good example, it takes more work to write everything in an Immutable way |
| 17:03 | Chouser | at first |
| 17:03 | jhawk28 | but, show someone a complicated mess of an object model in a concurrent environment and they start to wish it was immutable |
| 17:03 | Chousuke | jhawk28: that's not even the whole problem. To some people, it might not make any sense at all that you can even do things with immutable data. |
| 17:03 | Retonator | because ppl are used to mutabilty not because it is easier by default |
| 17:04 | Chousuke | jhawk28: they might be used to thinking in "commands" that are used to effect a change in some complex machinery. |
| 17:04 | Chousuke | it'll take a lot of effort to change that way of thinking. |
| 17:06 | Chousuke | and in reality, that's the way the machine works at the lowest level anyway. |
| 17:07 | jhawk28 | using Java as the context for mutability, it is simpler to write a Javabean that is mutable than trying to keep it immutable |
| 17:07 | hiredman | there was just some paper on making hardware behave functionally |
| 17:07 | Chousuke | functional memory would be interesting :/ |
| 17:08 | Chousuke | you'd have to have hardware garbage collection or something... |
| 17:08 | hiredman | jhawk28: yeah, and java beans are a core programing concept |
| 17:08 | Retonator | i have clojure-contrib.jar on the classpath of swank but still i can't use the source function even after an require |
| 17:08 | Retonator | what am i doing wrong? |
| 17:09 | hiredman | http://lambda-the-ultimate.org/node/3234 |
| 17:09 | powr-toc | regarding immutability... I'm not sure if it's really that hard... Or if people will dislike it, particularly because it doesn't have any of the cosmetic problems of single-assignment like Erlang |
| 17:09 | hiredman | "A New Approach to the Functional Design of a Digital Computer" |
| 17:09 | hiredman | hah |
| 17:09 | hiredman | 1961 |
| 17:10 | hiredman | I really should pay attention to dates on things |
| 17:10 | powr-toc | in clojure that is |
| 17:10 | Chousuke | powr-toc: immutability is not really difficult. you just need to get used to it. |
| 17:10 | kotarak | How can I transparently use some code if an optional module is available or fall back to some default implementation? |
| 17:11 | hiredman | kotarak: you have a some kind of place where code can "register" |
| 17:12 | Chouser | kotarak: you could look at contrib.lazy-xml |
| 17:12 | hiredman | then you have a multimethod that dispatches based on what is registered |
| 17:12 | Chouser | I'm not saying it's perfect, but I try to do it there -- if the xpp.jar is in the classpath, use it. Otherwise, silently fall back on SAX. |
| 17:12 | powr-toc | Chousuke: My point exactly... I always felt when showing people erlang they disliked it because of it's single assignment syntax... but clojure doesn't have that cosmetic barrier of having Var1, Var2, Var3 etc... |
| 17:13 | powr-toc | yet it still has immutability :-) My point is that people almost always judge the book by it's cover (or something else rather superficial) |
| 17:14 | Chousuke | clojure doesn't have much of a cover to look at :) |
| 17:15 | Chouser | lisp. lisp has all those parens. I don't like it. Oooh, scala... |
| 17:15 | Chousuke | just an assortment of brackets and identifiers. |
| 17:16 | Chousuke | Chouser: yeah but the first thing they notice when they come to clojure.org is the logo and they go "ooh, shiny" |
| 17:16 | powr-toc | Chousuke: well clojure's biggest (only?) problem regarding mainstream adoption is that it looks like lisp... obviously one of it's biggest advantages is that it actually *IS* a lisp. |
| 17:16 | kotarak | Chouser: I tried a, (try (require ...) (catch Exception _)) but that didn't work. Maybe the trick is to load the file. Will try. Thanks for the pointer. |
| 17:17 | powr-toc | Chouser: you beat me to it ;-) |
| 17:17 | Chousuke | powr-toc: I think the judicious use of [] and {} make the paren soup much more bearable. |
| 17:17 | Chousuke | powr-toc: Though it takes a while to get that I guess. |
| 17:18 | Chouser | kotarak: the problem is that the exception is thrown before eval, at compile time, so you need to make the compile happen inside your try/catch |
| 17:18 | powr-toc | Chousuke: yeah, I agree... I really like the use of vectors for argument definitions etc... it's almost like having syntax highlighting |
| 17:18 | Chousuke | but you rarely need to wonder whether a (foo bar) is evaluated as a function call or whether it's a macro, because it's more clojurey to use [foo bar] in your syntax when writing a macro. |
| 17:18 | jhawk28 | once the main editors have the full Clojure support, the parens become less of an issue |
| 17:18 | kotarak | Chouser: which is done inside the other via load, right? |
| 17:18 | Chouser | kotarak: right |
| 17:18 | kotarak | Chouser: good. :) will try |
| 17:19 | Chouser | plus it lets me put all the stuff that depends on that jar in its own file. works out nicely |
| 17:19 | Chouser | ...until you AOT compile. :-/ |
| 17:19 | powr-toc | Chousuke: whenever I look at examples of lisp code in books, I find myself missing the square brackets etc... Especially because the lisp classics were printed before syntax highlighting was common place |
| 17:19 | Retonator | who do i know what clojure has on the classpath from a repl? |
| 17:20 | Retonator | who = how |
| 17:20 | Chousuke | powr-toc: I always stop to wonder whether it's a function call or just special macro syntax :/ The vector form offers a huge readability boost that IMO can not be stressed enough :) |
| 17:21 | Chouser | Chousuke, powr-toc: yes! |
| 17:21 | triddell | Retonator: (System/getProperty "java.class.path") |
| 17:21 | powr-toc | Chousuke: yeah, it really helps in disambiguating macros |
| 17:24 | Retonator | thanks triddel |
| 17:25 | Chousuke | the html libraries are good examples. you have something like (html [:html [:body [:table (map generate-table-entries dataseq)]]]) and it's almost obvious the keyword-vectors are part of the macro DSL. |
| 17:25 | duncanm | can someone give me a quick example of WHEN-LET's syntax? |
| 17:25 | Chousuke | with a function in the middle that obviously has nothing to do with the DSL :P |
| 17:26 | Retonator | which contrib lib hold the source function? |
| 17:26 | Chousuke | ,`source |
| 17:26 | clojurebot | sandbox/source |
| 17:26 | Chousuke | hm :/ |
| 17:27 | hiredman | http://github.com/ryanb/ruby-warrior/tree/master <-- this is way cute, it needs porting to clojure |
| 17:27 | hiredman | with a nice swing gui of course |
| 17:28 | Retonator | ,`get-source |
| 17:28 | clojurebot | sandbox/get-source |
| 17:29 | hiredman | ,(when-let [x (#{1 3 4} 2)] (* x 3)) |
| 17:29 | clojurebot | nil |
| 17:29 | hiredman | ,(when-let [x (#{1 2 3 4} 2)] (* x 3)) |
| 17:29 | clojurebot | 6 |
| 17:38 | kotarak | Chouser: thanks :) VimClojure has now transparent pretty printing support if Tom Faulhaber's cl-format is available. :D |
| 17:39 | hiredman | kotarak: :D |
| 17:39 | Chousuke | hopefully that pretty-printer will be in core sometime soon :) |
| 17:40 | kotarak | no dependency, if there => pretty, if not there => prn :) |
| 17:40 | kotarak | yeah. that would be nice. |
| 17:40 | Chouser | kotarak: woo! great. |
| 17:45 | hiredman | kotarak: I just noticed, if I turn gorilla on I cannot use %y to yank a form (everything between matching parens) and paste it between files |
| 17:46 | powr-toc | Will any of the clojure-contrib functions/libraries ever get pushed into the clojure distro? |
| 17:47 | kib2 | powr-toc: I was just asking myself the same question |
| 17:47 | hiredman | normally if I put the cursor over a paren an type "%y" it will yank everything between matchin parens, then I switch to another tab and P or p to paste |
| 17:47 | hiredman | this behaviour no longer works with gorilla enabled |
| 17:47 | kotarak | hiredman: you mean probably y%. Hmmm... works for me. |
| 17:47 | kotarak | What happens ? |
| 17:48 | Chouser | powr-toc: some already have |
| 17:48 | kotarak | hiredman: Instead, I mean. Does it paste some garbage? or nothing at all? |
| 17:48 | Chouser | use/require and friends started out in contrib and was moved over |
| 17:48 | hiredman | it pastes a blank line |
| 17:48 | kotarak | hiredman: let me try with a tab. |
| 17:49 | hiredman | acutally "%y" and "y%" do the same thing |
| 17:49 | powr-toc | Chouser: Are there any criteria for inclusion? |
| 17:49 | kotarak | hiredman: not for me. % moves to the closing paren and y waits for a motion. |
| 17:50 | kotarak | hiredman: y% yanks to the matching paren. |
| 17:51 | Chouser | powr-toc: sure, the criteria is that rhickey decides to include it. |
| 17:51 | Chouser | :-) |
| 17:51 | powr-toc | Chouser: And that's not a bad one :-) |
| 17:51 | kotarak | There was a poll once. What was the result? |
| 17:52 | hiredman | kotarak: neither works with gorilla enabled |
| 17:52 | Chouser | kotarak: a little report which everyone ignored. |
| 17:53 | powr-toc | I'm just wondering if it's mostly restricted to addressing language holes... or if there will ever also be basic libraries for other stuff, e.g. HTTP-clients/SMTP/XML etc... |
| 17:53 | Chouser | there's xml parse/emit already in core |
| 17:54 | Chouser | which is an annoying and specific way of saying I don't know |
| 17:54 | slashus2 | hiredman: How complicated is your security policy with your bot? |
| 17:54 | powr-toc | lol |
| 17:54 | kotarak | hiredman: can you send me your vimrc and your zipped .vim directory? Several people reported strange issues with copy'n'paste. All these things work for me..... So it would be good to get a failing setup for bug hunting. |
| 17:57 | hiredman | it seemed to work there for a minute, but I exited vim and restarted and it stopped working |
| 17:58 | slashus2 | hiredman: Do your permissions allow for things like file-seq ? |
| 17:58 | hiredman | nope |
| 17:59 | slashus2 | I was playing around with your sandbox, and when I inserted it into my bot and ran eval-in-box it allowed for (file-seq) I am guessing the magic is in the .policy file? |
| 18:00 | hiredman | the policy file and turning on the security manager |
| 18:01 | slashus2 | So the policy file dictates what the security manager does? |
| 18:01 | hiredman | uh |
| 18:01 | hiredman | Yes |
| 18:01 | hiredman | it is kind of complicated, let me order it in my mind |
| 18:03 | hiredman | the security manager is off, if you turn the security manager on, the permissions you get by default are very limited and you cannot do anything. and you need the security manager on in order to sandbox code |
| 18:03 | hiredman | so the policy file tells the secutiry manager to allow everything, and later on in hiredman.sandbox a seperate context is created with no permissions in which sandbox code is executed |
| 18:04 | hiredman | acutally it isn't no permissions, I think it is the same set of permissions which applets get |
| 18:09 | Lau_of_DK | Talk from QCon up anywhere yet? |
| 18:10 | slashus2 | hiredman: I am wondering why... I can do a file-seq with mine. |
| 18:11 | hiredman | slashus2: is your policy file in place? do you enable the security manager? |
| 18:11 | gnuvince_ | Hi |
| 18:13 | WizardofWestmarc | Lau: Not qcon I don't think but another talk Rich gave around the same time: http://video.google.co.uk/videoplay?docid=-4617600643842067036&hl=en |
| 18:13 | lisppaste8 | slashus2 pasted "policy" at http://paste.lisp.org/display/77204 |
| 18:14 | slashus2 | hiredman: Okay, I think this is going to work. I created a policy file with |
| 18:14 | hiredman | slashus2: I have no idea if that is enough to run clojure |
| 18:15 | slashus2 | It appears to be working. |
| 18:15 | hiredman | interesting |
| 18:15 | hiredman | hmmmmm |
| 18:15 | slashus2 | When I first start it, I get java.security.AccessControlException: access denied (java.io.FilePermission clojureevalbot.clj read) |
| 18:15 | slashus2 | :-) |
| 18:16 | hiredman | well, the policy file defines the permissions for the whole jvm |
| 18:16 | slashus2 | right |
| 18:16 | hiredman | so if you don't put file io in there then file io won't happen |
| 18:16 | Lau_of_DK | thanks WizardofWestmarc |
| 18:17 | WizardofWestmarc | plus it adds to my collection of clojure links on delicious, always a plus |
| 18:17 | slashus2 | hiredman: I was trying to eliminate the possibility of someone reading files off my system. |
| 18:17 | slashus2 | Maybe if the last thing that I ran was the activation of the Security Manager. |
| 18:17 | slashus2 | That way clojure already read everything that it needs? |
| 18:18 | hiredman | ~sandbox |
| 18:18 | clojurebot | sandbox is http://calumleslie.blogspot.com/2008/06/simple-jvm-sandboxing.html |
| 18:18 | hiredman | slashus2: the policy file while required for sandbox is sort of a red herring |
| 18:18 | hiredman | hiredman.sandbox is where the "magic" happens |
| 18:19 | slashus2 | I see that it isn't activated by default. |
| 18:19 | hiredman | clojurebot's policy file allows everything, but, it evals code in a new security contex that disallows IO |
| 18:19 | slashus2 | So your sandbox won't run? (file-seq (java.io.File. "/")) |
| 18:19 | hiredman | ,(file-seq (java.io.File. "/")) |
| 18:19 | clojurebot | java.security.AccessControlException: access denied (java.io.FilePermission / read) |
| 18:19 | slashus2 | :-| |
| 18:21 | slashus2 | Don't know why it is doing that with me using your code. |
| 18:21 | hiredman | just a) use the policy file included in the clojurebot git b) use eval-in-box from hiredman.sandbox |
| 18:21 | hiredman | and |
| 18:22 | hiredman | enable the security manager |
| 18:22 | hiredman | java -Djava.security.manager or I think there is a function in hiredman.sandbox to enable it |
| 18:22 | slashus2 | I think I understand now. |
| 18:22 | slashus2 | The sandbox uses the security manager, but a hack to get it to work is to enable all security at the first. |
| 18:23 | hiredman | clojurebot: clojure is also a language to use if you want to up your game |
| 18:23 | clojurebot | Ok. |
| 18:23 | hiredman | slashus2: Yes |
| 18:44 | hiredman | so .. doesn't require dots in methods? |
| 18:44 | kotarak | hiredman: (.. obj method method), I would use ->, it's more general (-> obj .method .method) |
| 18:45 | hiredman | Excellent |
| 18:47 | WizardofWestmarc | later guys, have a good evening |
| 18:49 | jhawk28 | hiredman: does the EvalReader work around the IO limitation? |
| 18:51 | jhawk28 | ,#=(eval (file-seq (java.io.File. "/"))) |
| 18:51 | clojurebot | java.lang.RuntimeException: java.security.AccessControlException: access denied (java.io.FilePermission / read) |
| 18:51 | jhawk28 | nope |
| 18:54 | hiredman | jhawk28: the sandboxing happens at the jvm lavel |
| 18:54 | hiredman | level |
| 18:55 | hiredman | below the clojure runtime |
| 18:55 | hiredman | ,#=(System/exit 0) |
| 18:55 | clojurebot | System |
| 18:56 | hiredman | eh? |
| 18:56 | hiredman | ,#=(eval (System/exit 0)) |
| 18:56 | clojurebot | java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0) |
| 18:58 | jhawk28 | interesting |
| 20:21 | slashus2 | hiredman: I found that if I ran (doto (javax.swing.JFrame.) (.setVisible true) (.show)) in a chatroom through the bot, it creates a window on my screen. |
| 20:41 | duderdo | Hi! |
| 20:43 | duderdo | While trying to build clojure with ant on Debian5.0 I'm getting the error "Compliance level '1.4' is incompatible with target level '1.5'. However, ant -diagnostics shows java.runtime.version as 1.5.0. |
| 20:45 | blbrown | debian 5 doesn't have java 6. Woa, well I won't be using that anytime soon |
| 20:45 | durka42 | off-topic: is there an svn wizard in the house? |
| 20:46 | Chouser | rhickey can do branches *and* merges now, so I think he's your man. |
| 20:47 | durka42 | :) |
| 20:47 | durka42 | i'm only trying to do the former |
| 20:48 | duderdo | But... ant says it is runtime version 1.5.0, which is why I'm confused |
| 20:50 | slashus2 | Doesn't debian 5 have openjdk? |
| 20:50 | durka42 | huh, i don't even have trunk/branches/tags folders |
| 20:54 | Chouser | durka42: yeah, you have to make those manually |
| 20:54 | Chouser | durka42: you're sure you don't want to use git? |
| 20:55 | durka42 | i kinda do |
| 20:55 | durka42 | i'll make that the next project, once this application goes live :) |
| 20:55 | durka42 | after that, i'll rewrite it using clabango |
| 20:56 | Chouser | anyway, you can "svn mkdir" for trunk and branches, then "svn mv" your other top-level dirs into trunk |
| 20:56 | Chouser | then "svn cp" trunk into "branches/my-new-branch" or whatever. I think that would do it |
| 20:57 | Chouser | you probably have to check everything in between one or two of those steps... svn is a little weak in the mind, can't understand too much at once. |
| 20:57 | durka42 | that it is |
| 20:57 | durka42 | i want git's chunked commits, though |
| 21:02 | Chouser | i use git svn for clojure and contrib. it's nice. |
| 21:02 | Chouser | branches are a breeze |
| 21:03 | slashus2 | hiredman: I tried to add an item to the bad forms and I realized that it isn't checking the top level form. |
| 21:51 | hiredman | what in the what now? |
| 22:02 | dnolen | ,(macroexpand-1 '(fn [a b] (+ a b))) |
| 22:03 | hiredman | clojurebot well? |
| 22:03 | hiredman | clojurebot: well? |
| 22:03 | dnolen | darn |
| 22:03 | hiredman | oh |
| 22:04 | baetis-fly | so, swank-clojure/slime work fine on my linux box, but on my mac I only get the inferior-lisp buffer, no slime repl buffer. Same .emacs. Only difference is I'm using an older version of slime on linux. any thoughts? |
| 22:04 | dnolen | baetis-fly, emacs-starter-kit seems to eliminate a lot of the config problems have you tried that |
| 22:04 | dnolen | so clojurebot is out? |
| 22:05 | dnolen | kaput?, well perhaps someone knows the answer anyway. |
| 22:06 | dnolen | Clojurians- why does (macrexpand-1 '(fn [a b] (+ a b))) -> |
| 22:06 | dnolen | (fn* [a b] (+ a b)) |
| 22:06 | baetis-fly | dnolen: thanks, but I don't want to replace my years of tweaking my .emacs for some one elses. looks like a great project though. |
| 22:07 | dnolen | baetis-fly: i know what you mean, are you using latest swank-clojure, clojure-mode and slime from github? that works for me. |
| 22:07 | jhawk28 | hiredman: clojurebot doesnt look to be part of the channel |
| 22:08 | baetis-fly | dnolen: thanks, i'll try the slime from git hub. I'm using the cvs version. |
| 22:09 | jhawk28 | ,(println "welcome back all!") |
| 22:09 | clojurebot | welcome back all! |
| 22:09 | dnolen | ,(macorexpand-1 '(fn [a b] (+ a b))) |
| 22:09 | clojurebot | java.lang.Exception: Unable to resolve symbol: macorexpand-1 in this context |
| 22:10 | dnolen | ,(macroexpand-1 '(fn [a b] (+ a b))) |
| 22:10 | clojurebot | (fn* ([a b] (+ a b))) |
| 22:10 | dnolen | voila! |
| 22:10 | dnolen | what the heck is fn*? |
| 22:11 | hiredman | more primitive fn |
| 22:11 | hiredman | ,(macroexpand-1 '(fn [[a b]] (+ a b))) |
| 22:11 | clojurebot | (fn* ([p__1016] (clojure.core/let [[a b] p__1016] (+ a b)))) |
| 22:13 | dnolen | interesting |
| 22:15 | hiredman | ,(macroexpand '(fn [[a b]] (+ a b))) |
| 22:15 | clojurebot | (fn* ([p__1022] (clojure.core/let [[a b] p__1022] (+ a b)))) |
| 22:15 | hiredman | :/ |
| 22:16 | hiredman | ,(macroexpand '(clojure.core/let [[a b] p__1022] (+ a b))) |
| 22:16 | clojurebot | (let* [vec__1027 p__1022 a (clojure.core/nth vec__1027 0 nil) b (clojure.core/nth vec__1027 1 nil)] (+ a b)) |
| 22:16 | baetis-fly | according to the slime NEWS file, the repl is no longer loaded by default. why on earth would they do that? |
| 22:17 | dnolen | baetis-fly: wow, SLIME is weird project, powerful stuff in there but some things don't make sense. I've gotten broken builds a couple of times. |
| 22:18 | dnolen | I suppose you could a slime load hook tho yrself, but it's annoying. |
| 22:18 | baetis-fly | (slime-setup '(slime-repl)) |
| 22:18 | baetis-fly | The news file tells you how to get the old behavior. |
| 22:18 | baetis-fly | (as pasted) |
| 22:52 | slashus2 | hiredman: Did you fix the (doto (javax.swing.JFrame.) (.setVisible true) (.show)) case? |
| 22:56 | cconstantine_ | I'm trying to find the max in a sequence. In the doc it looks like pmax is what I want, but when I try to use it I get an "resolve symbol" error. Could I get some help? |
| 22:58 | Chouser | ,(reduce max [2 5 3 4 1]) |
| 22:58 | clojurebot | 5 |
| 22:58 | cconstantine_ | oh fancy :) |
| 22:59 | cconstantine_ | Thanks, I'm a clojure newb but I'm trying |
| 23:02 | Jedi_Stannis | is there a function that does #(partition-by identity %)? |
| 23:03 | Chouser | Jedi_Stannis: I think you just wrote it. |
| 23:05 | Jedi_Stannis | Chouser: ok thanks, just wasn't sure if there was a function already in the api that did it. sometimes its hard to find it, and I don't won't to be rewriting functions that already exist |
| 23:06 | durka42 | hmm, don't try and compile something that depends on clojure.jar while clojure.jar is being compiled in the background :) |
| 23:08 | durka42 | Jedi_Stannis: isn't that #(partition 1 %) ? |
| 23:12 | Chouser | Jedi_Stannis: sure, it's a valid question but I think you found the easiest way to do it |
| 23:14 | durka42 | oh, i see |
| 23:34 | pstickne | wow. |
| 23:34 | pstickne | so popular :p |
| 23:34 | pstickne | so uhm... |
| 23:35 | pstickne | I guess this means I should install clojure ^^ |
| 23:35 | markgunnels | Absolutely. |
| 23:35 | markgunnels | :-) |
| 23:35 | markgunnels | And then pull Compojure. |
| 23:39 | pstickne | Err... |