2009-03-20
| 00:06 | cmvkk | wanted to test something on the repl only to discover i'm still running that reduce operation... |
| 00:06 | cmvkk | i feel like i have too much invested to stop it now... |
| 00:06 | Raynes | o.o |
| 00:08 | Victorr_ | is it ok to assume (if test 'foo) will return nil if test is false? |
| 00:08 | hiredman | A) yes B) use when |
| 00:09 | Victorr_ | oh right, thanks |
| 00:09 | Victorr_ | BTW, I find it odd that there is a when-not instead of unless |
| 00:13 | hiredman | I find it odd that you would use either of those |
| 00:13 | hiredman | ,(doc compliment) |
| 00:13 | clojurebot | java.lang.Exception: Unable to resolve var: compliment in this context |
| 00:13 | hiredman | bah |
| 00:13 | Victorr_ | do you mean complement? |
| 00:13 | hiredman | yeah |
| 00:13 | cmvkk | heh |
| 00:13 | Victorr_ | ,(doc complement) |
| 00:13 | clojurebot | "([f]); Takes a fn f and returns a fn that takes the same arguments as f, has the same effects, if any, and returns the opposite truth value." |
| 00:13 | hiredman | anyway, just negate the predicate |
| 00:13 | Victorr_ | I fail to see how complement would be better |
| 00:14 | cmvkk | it's easier to just use not. |
| 00:14 | hiredman | or use or |
| 00:14 | hiredman | ,(or :foo (println :bar)) |
| 00:14 | clojurebot | :foo |
| 00:14 | hiredman | ,(or nil (println :bar)) |
| 00:14 | clojurebot | :bar |
| 00:16 | Victorr_ | I think (unless test expr1 expr2) is better than (and test (do expr1 expr2)), don't you think so? |
| 00:16 | Victorr_ | make that when-not |
| 00:16 | hiredman | and would not work there |
| 00:17 | hiredman | ~def when-not |
| 00:22 | Mec | why wouldnt and work there? |
| 00:23 | Victorr_ | I think he means when-not will return nil if the condition is true, but and won't |
| 00:25 | Mec | cmvkk: is it still running that reduce? and how long has it been? |
| 00:26 | Mec | ,(if nil :true:) |
| 00:26 | clojurebot | Invalid token: :true: |
| 00:26 | Mec | ,(if nil :true) |
| 00:26 | clojurebot | nil |
| 00:26 | cmvkk | a long time.... |
| 00:26 | Mec | crap, ill need to find a new algorithm then |
| 00:27 | cmvkk | it's still chugging away at it though, it's being a real trooper. It's reducing it out till the bitter end. |
| 00:27 | Mec | lol |
| 00:27 | hiredman | it's a big number, and there are a lot of numbers greater then zero and less then it |
| 00:27 | Mec | the problem is i need to filter the (range 1000000000000) first and then add them all together, i think that would take a lot longer |
| 00:28 | hiredman | depends on your filter |
| 00:29 | hiredman | you can also try pmap with the mapped function return nil or the value depending on if the number passes the predicate, then just filter on identity |
| 00:32 | hjlee | ,(doc frest) |
| 00:32 | clojurebot | java.lang.Exception: Unable to resolve var: frest in this context |
| 00:32 | hjlee | ,(doc rest) |
| 00:32 | clojurebot | "([coll]); Returns a possibly empty seq of the items after the first. Calls seq on its argument." |
| 00:32 | hiredman | ,`fnext |
| 00:32 | clojurebot | clojure.core/fnext |
| 00:34 | hjlee | I guess, I found documented, but not implemented functions/macros. |
| 00:34 | hiredman | uh |
| 00:34 | hiredman | oh |
| 00:34 | hiredman | clojurebot: api? |
| 00:34 | hjlee | they are frest, rrest, nthrest, rfirst, fnseq and lazy-cons |
| 00:34 | clojurebot | api examples is http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examples |
| 00:34 | hiredman | clojurebot: api is <reply>the website api refers to last release |
| 00:34 | hiredman | pffft |
| 00:36 | Raynes | http://www.ociweb.com/mark/clojure/audio/AnistonClosure1.mp3 |
| 00:36 | hiredman | clojurebot: api is <reply>the website api refers to last release |
| 00:36 | clojurebot | Ik begrijp |
| 00:36 | Mec | sorry, had to answer a call of the wildebeest... hiredman: what does pmap do? |
| 00:36 | hiredman | ,(doc pmap) |
| 00:36 | clojurebot | "([f coll] [f coll & colls]); Like map, except f is applied in parallel. Semi-lazy in that the parallel computation stays ahead of the consumption, but doesn't realize the entire result unless required. Only useful for computationally intensive functions where the time of f dominates the coordination overhead." |
| 00:37 | Mec | i only have 1 core :( |
| 00:37 | hiredman | :( indeed |
| 00:37 | Mec | thats why i wanted to hook up all of the comps in my house, then i'd have 10 cores |
| 00:38 | Raynes | I only have a half a core :( |
| 00:39 | Mec | lol |
| 00:39 | Raynes | I ate the other half, cuz hungry. :) |
| 00:39 | Mec | hmm i suppose most of the numbers in the range will be dismissed so maybe it wont take too long |
| 00:41 | hiredman | what kind of numbers are you looking for? |
| 00:42 | Mec | so called semidivisible, but i dont think that's an actual term, http://projecteuler.net/index.php?section=problems&id=234 |
| 00:45 | hiredman | 999966663333 is a very interesting looking number |
| 00:46 | Mec | its just because of it's squareroot |
| 01:12 | Mec | anyone know of a keysequence for emacs that will automatically close all open parenthesis/brackets |
| 01:15 | durka42 | that depends |
| 01:15 | durka42 | do you use paredit |
| 01:16 | Mec | couldnt say, whatever clojurebox uses |
| 01:16 | durka42 | huh i thought paredit had a key like that, but i can't find it |
| 01:18 | Mec | i'd prefer another editor but i dont know of any, i hate the bindings emacs uses |
| 01:19 | durka42 | you should use vim :) |
| 01:19 | Mec | is it "possible" to install on windows and work with clojure? |
| 01:20 | durka42 | i'm not sure if vimclojure has problems with windows |
| 01:20 | Raynes | You should use Enclojure and proceed to flip Lau_Of_DK off. |
| 01:21 | durka42 | how do you remove a plugin that causes a crash on startup |
| 01:21 | Raynes | durka42: in the .netbeans folder. |
| 01:21 | Raynes | You can search through it and find it and nuke it. |
| 01:21 | durka42 | will do |
| 01:21 | Raynes | I had to do that with Enclojure. I still don't think it uninstalls right. Oh well, it doesn't screw up anymoar :D |
| 01:22 | durka42 | yeah, the crasher in question is some old version of enclojure |
| 01:22 | Mec | i tried enclojure, it was waaaaaaay too much for just a simple editor |
| 01:22 | Raynes | Yeah, the old version didn't like my windows. |
| 01:22 | Raynes | Mec: The Java stuff is inevitable for any language, even minor features require it. |
| 01:23 | Raynes | It's going to improve of course. |
| 01:23 | Raynes | But people who like and use Emacs for Clojure should stick with Emacs because I'm sure it's 1,000 times better than Enclojure will ever be. |
| 01:23 | Mec | well netbeans wanted like 150meg and it wouldnt even work right, the window wouldnt tie into the repl |
| 01:24 | Raynes | Say what? O_o |
| 01:24 | Raynes | I installed the PHP version and had like 11 megs of dependencies to download. |
| 01:24 | Mec | it was crazy im telling you |
| 01:24 | Raynes | If you tried this recently, chances are Enclojure is fixed by now. |
| 01:25 | Mec | its not enclojure itself, its netbeans |
| 01:25 | Raynes | Darn, I need to finish this chapter so I'll be a l33t Clojure c0dur. |
| 01:25 | Mec | chapter of what |
| 01:25 | Raynes | Multimethods chapter of Programming Clojure |
| 01:26 | Raynes | Last important chapter. |
| 01:27 | Raynes | I still can't believe I signed up for prag with the wrong name... My middle name doesn't start with an E. :| |
| 01:27 | Mec | netbook of physical book? |
| 01:27 | Raynes | PDF, the book isn't out yet. |
| 01:28 | durka42 | Raynes: is .netbeans/modules/clojure-asm.jar the only thing i need to nuke? |
| 01:28 | Raynes | It should be something like org.enclojure.<insertbullsh*there> |
| 01:29 | Raynes | Unless they named it something different back when you used it. |
| 01:29 | Raynes | s/used/installed/ |
| 01:29 | durka42 | oh, there are five org-enclojure-*.jar |
| 01:29 | durka42 | what's clojure-asm.jar then |
| 01:29 | Raynes | Dunno, delete them all, you don't need anything that has clojure in it's name. |
| 01:29 | durka42 | yeah, it was created at the same time as the others |
| 01:30 | Raynes | Mec: Do you have a copy? No Clojure programmer is complete without it :| |
| 01:30 | Mec | just heard about it |
| 01:31 | Raynes | I wish Ebooks were like dead tree books. You can let people borrow your dead tree books and it isn't copyright infringement :| |
| 01:32 | cmvkk | many would like to claim otherwise! |
| 01:37 | Mec | can someone double check my logic here: 10! is (reduce * (range 1 11)) and 10!/7! is (educe * (range 8 11)) |
| 01:37 | durka42 | why 11... |
| 01:37 | Mec | range isn't top inclusive |
| 01:37 | durka42 | oh |
| 01:37 | durka42 | i think that makes sense then |
| 01:41 | Mec | seems weird that you cant really simplify it mathematically but the programming construct is simple |
| 01:43 | Mec | am i getting slaphappy or does my function name !d! sound funny |
| 01:50 | slashus2 | I am trying to figure out why something like (.eval (.getEngineByName (ScriptEngineManager.) "JavaScript") "5+5") won't work with hiredman's sandbox when I remove eval from the *bad-forms* . It throws a null pointer exception when ran inside of the sandbox. Outside it produces 10. |
| 01:51 | pstickne | maybe there is not engine by that name? |
| 01:51 | slashus2 | It works outside of the sandbox |
| 01:52 | pstickne | maybe there is no engine by that name in the sandbox? |
| 01:52 | slashus2 | ... |
| 01:52 | slashus2 | I don't know for sure. |
| 01:52 | pstickne | check the return of getEngineByName? |
| 01:53 | hiredman | getEngineByName may try to load some sort of external resource |
| 01:53 | slashus2 | nil :-( |
| 01:53 | Raynes | SIDE EFFECTS! |
| 01:53 | slashus2 | hiredman: I think that is the case. |
| 01:54 | Mec | we dont need to stinkin side effects |
| 01:54 | slashus2 | I will try to do it outside of the sandbox. |
| 01:54 | slashus2 | ... the sandbox takes a string |
| 01:55 | slashus2 | function that is |
| 01:55 | slashus2 | eval-in-box |
| 01:55 | hiredman | it's really read and eval in a box |
| 01:57 | hiredman | ~sandbox |
| 01:57 | clojurebot | sandbox is http://calumleslie.blogspot.com/2008/06/simple-jvm-sandboxing.html |
| 02:08 | slashus2 | creating the interpreter outside of the sandbox worked. |
| 02:32 | cmvkk | If I have a macro 'foo', and its expansion contains a call to a macro 'bar', then bar should be expanded too right? |
| 02:33 | cmvkk | my current code doesn't seem to work that way and I can't figure out what I'm doing wrong. |
| 02:39 | cmvkk | erk, nevermind. |
| 03:41 | Mec | if foo expands as a call to bar and bar expands as a call to foo, does the world implode? |
| 03:42 | Cark | good morning |
| 03:59 | Mec | sleep is for the weak |
| 04:00 | Raynes | Mec: Sleep is for the bored people who want to be competent tomorrow. |
| 04:00 | Mec | competence is for the weak |
| 04:01 | Mec | but ill agree with the bored part |
| 04:01 | Mec | night night |
| 04:03 | Mec | i dunno why but i keep thinking concat is append |
| 04:22 | Mec | since sort takes a function that implements Comparator, how would i make my own? |
| 04:24 | hjlee | Mec: check sort-by |
| 04:25 | Mec | ah hah, thanks |
| 04:26 | Mec | it says the same thing, must implement Comparator |
| 04:31 | Raynes | Mec: Why are you implementing everything yourself? |
| 04:31 | Mec | so much for sleep :D im not i just have a list of vectors and i need to sort it by comparing the 2nd element |
| 04:33 | hjlee | ,(sort-by second '([7 2 3] [3 1 2] [4 5 6] [2 3 4])) |
| 04:33 | clojurebot | ([3 1 2] [7 2 3] [2 3 4] [4 5 6]) |
| 04:33 | Mec | ah hah so thats how that works |
| 04:35 | Mec | hmm didnt work right |
| 04:36 | Mec | ,(sort-by second '([1 "1"] [2 "12"] [3 "241"])) |
| 04:36 | clojurebot | ([1 "1"] [2 "12"] [3 "241"]) |
| 04:36 | Mec | ,(sort-by second '([1 "12"] [2 "1"] [3 "241"])) |
| 04:36 | clojurebot | ([2 "1"] [1 "12"] [3 "241"]) |
| 04:37 | Mec | ah well doesnt matter either way |
| 04:46 | cmvkk | this is kind of weird, but what I want is a predicate that returns true for anything that would be represented by a set of parentheses. |
| 04:46 | cmvkk | there's too many different types of things... |
| 04:48 | Mec | (doc coll?) |
| 04:48 | clojurebot | Returns true if x implements IPersistentCollection; arglists ([x]) |
| 04:49 | cmvkk | no good. it returns true for vectors too. |
| 04:49 | cmvkk | ,(coll? [1 2 3]) |
| 04:49 | clojurebot | true |
| 04:49 | cmvkk | and list? is no good, because it returns false for conses. |
| 04:49 | cmvkk | ,(cons 'a nil) |
| 04:49 | clojurebot | (a) |
| 04:49 | cmvkk | ,(list? (cons 'a nil)) |
| 04:49 | clojurebot | true |
| 04:49 | Mec | how is that not a list |
| 04:49 | cmvkk | whoa whoa, hold on |
| 04:49 | Mec | fail |
| 04:50 | cmvkk | weird... |
| 04:50 | Mec | seems like a cons doesnt actually exist |
| 04:50 | cmvkk | ,(list? (cons 'a (cons 'b nil))) |
| 04:50 | clojurebot | false |
| 04:50 | Mec | ,(cons 'a 'b) |
| 04:50 | clojurebot | java.lang.IllegalArgumentException: Don't know how to create ISeq from: Symbol |
| 04:50 | cmvkk | ,(class (cons 'a nil)) |
| 04:50 | clojurebot | clojure.lang.PersistentList |
| 04:50 | cmvkk | ,(class (cons 'a (cons 'b nil))) |
| 04:50 | clojurebot | clojure.lang.Cons |
| 04:50 | Mec | that makes no sense |
| 04:51 | cmvkk | it's an implementation defect, it has to do with the fact that cons operates differently for different inputs. |
| 04:51 | cmvkk | consing onto a cons works differently than consing onto nil. |
| 04:52 | Mec | since you cant cons onto something that isn't nil initially, it should always just be a list |
| 04:52 | cmvkk | well, consing onto a list is different than consing onto nil, i mean. |
| 04:52 | Mec | ,(class (cons 'a '(1 2))) |
| 04:52 | clojurebot | clojure.lang.Cons |
| 04:53 | Mec | i dont see why, it's a list in both cases |
| 04:53 | cmvkk | well it should be considered a list in my opinion (at least as far as list? goes) |
| 04:53 | cmvkk | but internally it's a different structure. |
| 04:53 | Mec | weird |
| 04:53 | Mec | ,(first (cons 'a (cons 'b nil)))) |
| 04:53 | clojurebot | a |
| 04:53 | cmvkk | lists can be made up of all sorts of things...there's a bunch of different types of sequences and stuff |
| 04:53 | Mec | ,(rest (cons 'a (cons 'b nil)))) |
| 04:53 | clojurebot | (b) |
| 04:54 | cmvkk | ,(class (seq [1 2 3])) |
| 04:54 | clojurebot | clojure.lang.APersistentVector$Seq |
| 04:54 | cmvkk | ,(class (seq "hello")) |
| 04:54 | clojurebot | clojure.lang.StringSeq |
| 04:54 | cmvkk | etc |
| 04:54 | Mec | #(or (cons? %) (list? %)) |
| 04:54 | Mec | problem solved :D |
| 04:55 | cmvkk | well cons? doesn't exist, but other than that, yeah, you're right. |
| 04:55 | Mec | bah you cant be serious |
| 04:55 | cmvkk | (or (list? body) (instance? clojure.lang.Cons body)) |
| 04:55 | cmvkk | is what i'm using |
| 04:55 | Mec | does cons onto a list return a list or cons |
| 04:56 | cmvkk | returns a cons. |
| 04:56 | Mec | one of the lectures said to use cons instead of conj for performance on lists, but if it breaks it from being a list then thats a problem |
| 04:56 | cmvkk | it's a bug. |
| 04:56 | cmvkk | list? should return true for conses. |
| 04:57 | pstickne | breaks it from being a list? :( |
| 04:57 | pstickne | oh, odd |
| 04:57 | cmvkk | that's the only real difference; seq still works on them of course. |
| 04:58 | Mec | you could just call seq on it and not worry if its a list or cons |
| 04:58 | Mec | thats what a lot of the library does |
| 04:58 | pstickne | but really, cons and conj are different, no? |
| 04:58 | cmvkk | in this case, though, what i'm trying to do is distinguish 'lists' from vectors. |
| 04:58 | pstickne | (cons head rest) |
| 04:58 | Mec | conj is the general for all of the different sequences |
| 04:59 | pstickne | (conj 1 [2]) ; oops |
| 04:59 | pstickne | (cons 1 [2]) ; \o/ |
| 05:00 | pstickne | cmvkk: why not seq? |
| 05:01 | cmvkk | because it includes vectors. |
| 05:01 | cmvkk | actually... |
| 05:01 | pstickne | but there is vector? |
| 05:02 | cmvkk | no, you're right, seq? apparently does what I want. |
| 05:02 | pstickne | yay |
| 05:02 | cmvkk | thanks. |
| 05:03 | pstickne | ohh, odd, Clojure is really confusing :p |
| 05:06 | Mec | seq? works for cons? |
| 05:06 | Mec | ,(seq? (cons 'a (cons 'b nil))) |
| 05:06 | clojurebot | true |
| 05:06 | Mec | huh well then |
| 05:20 | Mec | why does putting time around defns give me unmatched delmieter exceptions? |
| 05:21 | pstickne | huh? |
| 05:22 | Mec | i have 2 defns and 1 exp, putting (time (do )) around them throws an unmatched delimiter exception |
| 05:26 | pstickne | "works here" |
| 05:27 | Mec | bah if i highlight the 3 and run region it works fine |
| 05:28 | pstickne | so then maybe it's something else outside... |
| 05:28 | Mec | hmm |
| 05:28 | Mec | the (do ..) works fine, just not the call to time, it makes no sense |
| 05:29 | pstickne | code? |
| 05:30 | Mec | nvm it seems i was hitting eval-defn which only goes to the most recent defn |
| 05:32 | pstickne | :p |
| 05:33 | Mec | i'd kill to get clojure working in scite |
| 05:38 | pstickne | so, there's this man I know... |
| 06:02 | Mec | is he big, harry, and go by the name jim-bob |
| 06:49 | Mec | hmm i keep running out of heapspace but everything i use is lazy: reduce map filter map iterate |
| 06:50 | Cark | you're retaining the head of your sequences |
| 06:50 | Mec | i was initially but that was the first thing i fixed |
| 06:53 | Mec | it was holding at 90meg but i still ran out of heapspace |
| 06:54 | lisppaste8 | Mec pasted "Euler problem 43" at http://paste.lisp.org/display/77334 |
| 07:06 | Mec | is there a way to skip to the next values of a for instead of just putting a nil in the list there? |
| 07:18 | Holcxjo | mec: I don't see the memory leak, but I also don't see how that code will ever terminate. Won't the iterate give you an infinite sequence? |
| 07:18 | Mec | hmm |
| 07:18 | Mec | you bring up a very good point |
| 07:20 | Mec | i need a (take (! 10) ..) in there |
| 07:20 | Holcxjo | You'll only want all uniq permutations, I guess? i.e. the first N! ones? |
| 07:21 | Mec | right |
| 07:21 | Holcxjo | Should still not grow the memory unbounded... just not terminate... |
| 07:21 | Mec | true enough, im thinking the resultant number got so big it took the whole heap |
| 07:21 | Holcxjo | Unless your number in the reduce + grows out of bounds... :-) |
| 07:22 | Mec | with an infinite sequence it should eventually |
| 07:22 | Holcxjo | Bah -- you're always one second ahead of my typing |
| 07:22 | Mec | lol |
| 07:22 | Mec | gah still heap space crash |
| 07:23 | Holcxjo | Strange 10! isn't all that much, or is it? |
| 07:23 | Mec | ,(reduce * (range 10 1 -1)) |
| 07:23 | clojurebot | 3628800 |
| 07:23 | Mec | even so its not storing that many, just the one at a time |
| 07:25 | Holcxjo | BTW: Why this weird converting to string and then picking out the integers again? |
| 07:26 | Holcxjo | Hmm. Maybe I should read the problem before asking stupid questions... |
| 07:26 | Mec | naw |
| 07:26 | Mec | the permutation produces vectors, i need 3 digits so instead of doing (+ (* 100 digit1) (* 10 digit2) digit3) i substring and turn to int |
| 07:27 | Mec | probably not the fastest but i just threw that part together |
| 07:28 | Holcxjo | Have a look at the 3-ary version or partition |
| 07:28 | Holcxjo | ,(doc partition) |
| 07:28 | clojurebot | "([n coll] [n step coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap." |
| 07:29 | Holcxjo | ,(partition 3 1 (range 1 10)) |
| 07:29 | clojurebot | ((1 2 3) (2 3 4) (3 4 5) (4 5 6) (5 6 7) (6 7 8) (7 8 9)) |
| 07:29 | Mec | if you have multiple ranges in a for, can you use multiple :when? |
| 07:30 | Mec | that could be useful |
| 07:30 | Holcxjo | I don't understand |
| 07:30 | Holcxjo | You can use as many :whens as you like, I believe... |
| 07:30 | Mec | (for [a somecoll :when (check-a a) b somecoll (check-b b)]) |
| 07:30 | Mec | (for [a somecoll :when (check-a a) b somecoll :when (check-b b)]) |
| 07:32 | Mec | oo you can |
| 07:32 | Mec | for just gets better and better |
| 07:32 | Holcxjo | ,(for [x (range 10) :when (> x 5) :when (= x 8)] x) |
| 07:32 | clojurebot | (8) |
| 07:36 | Mec | the question is does it update the variables and check the :whens in the right orders |
| 07:41 | lisppaste8 | Mec pasted "For mess" at http://paste.lisp.org/display/77335 |
| 07:42 | Mec | tell me that doesnt make your head hurt |
| 07:43 | Holcxjo | Not exactly readable, is it? :-) |
| 07:43 | Mec | i just hope it does everything in the order i wrote, or it could take a very long time to run |
| 07:43 | Holcxjo | You need to make an abstraction for multiplying out three digits -- that'll reduce some clutter |
| 07:44 | Mec | too true |
| 07:46 | Holcxjo | The different ranges for d4 and d6 are optimisations you derived from the tests they are used in? |
| 07:46 | Mec | divisible by 2 and 5 |
| 07:46 | Mec | http://projecteuler.net/index.php?section=problems&id=43 |
| 07:46 | Mec | probably simplest to read the problem description |
| 07:48 | Mec | wow the first result was almost instantaneous, this mess of For could really work |
| 07:49 | Holcxjo | :-) |
| 07:49 | Mec | 230ms to run when the other version ran so long it ran out of heap space |
| 07:49 | Holcxjo | You could make the duplicity test for numbers even earlier to avoid many false attempts. |
| 07:50 | Mec | true |
| 07:50 | Holcxjo | i.e. instead of "d5 (range 10)" say "d5 (remove-func (range 10) (list d3 d4))" |
| 07:50 | Mec | (doc remove-func) |
| 07:50 | clojurebot | excusez-moi |
| 07:51 | Holcxjo | I made that up |
| 07:51 | Mec | hmm i know theres something |
| 07:51 | Holcxjo | I am not good with clojure |
| 07:51 | Mec | (doc difference) |
| 07:51 | clojurebot | Excuse me? |
| 07:52 | Mec | (doc difference) |
| 07:52 | clojurebot | Gabh mo leithsc�al? |
| 07:52 | Mec | weird |
| 07:52 | Mec | (doc clojure.set.difference) |
| 07:52 | clojurebot | excusez-moi |
| 07:52 | Mec | blah |
| 07:52 | Mec | (doc clojure.set/difference) |
| 07:52 | clojurebot | Gabh mo leithsc�al? |
| 07:52 | Mec | it exists! its in the API! wtf |
| 07:53 | Mec | ,(clojure.set/difference #{1 2} #{2 3}) |
| 07:53 | clojurebot | #{1} |
| 07:53 | Mec | hah, only problem is it takes sets |
| 07:53 | Mec | so there'll be some seq -> set -> seq overhead |
| 07:54 | Holcxjo | for takes sets |
| 07:54 | Holcxjo | ,(for [x (set (range 10))] x) |
| 07:54 | clojurebot | (0 1 2 3 4 5 6 7 8 9) |
| 07:54 | Mec | ya it converts them to seq in the background |
| 07:55 | Mec | most of the lib functions call (seq) on everything for shits and giggles |
| 07:55 | Holcxjo | ,(doc disj) |
| 07:55 | clojurebot | "([set] [set key] [set key & ks]); disj[oin]. Returns a new set of the same (hashed/sorted) type, that does not contain key(s)." |
| 07:56 | Mec | (disjoin (set (range 10)) 5 7) |
| 07:56 | Mec | ,(disjoin (set (range 10)) 5 7) |
| 07:56 | clojurebot | java.lang.Exception: Unable to resolve symbol: disjoin in this context |
| 07:56 | Mec | ,(disj (set (range 10)) 5 7) |
| 07:56 | clojurebot | #{0 1 2 3 4 6 8 9} |
| 07:56 | Mec | ill buy that for a dollar |
| 07:57 | Holcxjo | dame dos -- as they say in Spanish |
| 07:58 | Holcxjo | It'll even end up fairly readable... |
| 07:58 | Mec | i dunno each one is getting longer and longer |
| 07:59 | Mec | lol |
| 07:59 | Mec | from 230ms to 30ms |
| 08:00 | lisppaste8 | Mec pasted "bigger for mess" at http://paste.lisp.org/display/77336 |
| 08:01 | Mec | 30ms is the fastest solution i've had on the entire euler problem set |
| 08:11 | Holcxjo | Now factor out the (disj some-expression excluded-numbers...) and you'll have a readable solution (after adding some comments about the special cases) |
| 08:38 | rhickey | Clojure enters TIOBE index: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html |
| 08:51 | lisppaste8 | Holcxjo annotated #77334 "tidier variant -- still veeeery slow" at http://paste.lisp.org/display/77334#1 |
| 08:53 | Holcxjo | Mec: my version gives 16695334890 -- after 2 or 3 minutes. :-) Is that at least correct? |
| 08:55 | Holcxjo | Seems ok -- same as your last "for" code |
| 09:01 | AWizzArd | rhickey: oh nice, I was waiting for that. Did you ask them for adding Clojure? |
| 09:01 | rhickey | nope |
| 09:07 | hjlee | rhickey : i don't know you already knows about that, anyway i found some function/macros that exist in reference doc in clojure home but not in implementation. |
| 09:07 | hjlee | they are frest, rrest, nthrest, rfirst, fnseq and lazy-cons. |
| 09:08 | hjlee | i guess "rest" thing changed to "next" thing :) |
| 09:08 | gnuvince | hjlee: the documentation reflects the latest stable release. |
| 09:09 | hjlee | ah,, then they are removed since then? |
| 09:15 | gnuvince | try fnext, nnext, nthnext, etc. |
| 09:15 | gnuvince | lazy-cons was removed completely |
| 09:15 | gnuvince | Not sure what fnseq was |
| 09:17 | hjlee | thank you! i forgot i'm not using stable version.. ashamed.. |
| 09:17 | rhickey | http://clojure.org/api updated to reflect svn 1335 |
| 09:22 | hjlee | wow! instant action, thank you! |
| 09:38 | hjlee | rhickey : can u share the API page generation code? |
| 09:42 | lisppaste8 | rhickey pasted "wiki doc gen" at http://paste.lisp.org/display/77339 |
| 09:43 | rhickey | http://code.google.com/p/clojure/downloads/detail?name=clojure_20090320.zip&can=2&q=#makechanges |
| 09:43 | rhickey | erm, http://clojure.googlecode.com/files/clojure_20090320.zip |
| 09:44 | rhickey | new release ^^ |
| 09:44 | hjlee | thank you, again. :) |
| 09:51 | hiredman | :D |
| 10:17 | Chouser | rhickey: would you call such a release a "pre-release" or "unstable" or "pre-1.0" or none of these? |
| 10:19 | rhickey | Chouser: hmm, do I need to call it something other than 20090320? Do you think it needs a label? |
| 10:20 | Cark | pre-unstable-not-quite-1.0-yet ? |
| 10:23 | rhickey | It could be a 1.0 beta, i.e. feature complete but possible bugs, or a release candidate. All that presume streams are 1.1 |
| 10:23 | ambient | stable api |
| 10:23 | jhawk28 | danlarkin: they want the concrete |
| 10:24 | pjstadig | not necessarily a 1.0 label, but a roadmap to the 1.0 label |
| 10:24 | danlarkin | but... development will continue, the api will change |
| 10:24 | jhawk28 | well, a roadmap is the easiest way to get to the goal |
| 10:25 | jhawk28 | otherwise, there is no definition of what 1.0 would look like |
| 10:25 | pjstadig | but maybe you'd know if you want to wait, or if it's not worth waiting and you should workaround |
| 10:27 | danlarkin | using software is like buying apple hardware. Yes, they could come out with new models a week after you bought your new computer, but you have to evaluate what you're buying and be happy with that at the moment you're buying it |
| 10:29 | pjstadig | i don't know i'm just playing the devil's advocate and making things up |
| 10:30 | pjstadig | i guess the thing about (versioned) releases is that people (can?) expect support for that version even while the development progresses on other branches |
| 10:30 | pjstadig | for example if I decided to use the 20081217 release and there ended up being a bug in it |
| 10:31 | pjstadig | i wouldn't necessarily have to cross the "fully lazy border" just to get the bug fixed |
| 10:31 | pjstadig | there would be a 20081217.1 release or something |
| 10:32 | Chouser | rhickey: "none of these" is fine with me. I guess I was starting to form a reddit post in my mind. Not sure why, though. *shrug* |
| 10:33 | rhickey | Well, I think this conversation is interesting - the expectation of a maintained release in parallel with ongoing work on trunk - who will do that maintenance? |
| 10:33 | Chouser | alan cox |
| 10:33 | pjstadig | yeah don't get me wrong like i said i'm playing advocate |
| 10:33 | pjstadig | i don't think that anyone should come along and make demands where no money has changed hands |
| 10:34 | pjstadig | clojure is a gift that we should accept gratefully :) |
| 10:35 | jhawk28 | its probably an opportunity for a support business |
| 10:35 | rhickey | e.g. there was a branch for 20091217, and some fixes could have been copied to it |
| 10:35 | rhickey | 20081217 |
| 10:36 | rsynnott | clojure, now from the future |
| 10:37 | Chouser | some people used a pre-lazier version until at least very recently, but I don't know if they were using a release or some other checkout. |
| 10:37 | Chouser | I also don't know if they patched it at all, such as by backporting fixes, or if they just used as-is (as-was?) |
| 10:39 | rhickey | right, that's the question - given a branch that represents a release, can't backporting be largely independent, or if the release was called 1.0 would there be an expectation that all bug fixes that don't represent additions would go there as well as trunk? |
| 10:39 | pjstadig | i think generally people expect backporting of bug fixes to major branches |
| 10:39 | jhawk28 | depends on the severity |
| 10:40 | Chouser | I do think that would be an expecation, but they doesn't mean they'd assume rhickey was the one doing the backports. |
| 10:40 | Cark | hum any bugfixes should come with new versions |
| 10:40 | Cark | 1.0.1 |
| 10:40 | pjstadig | right a bump in a minor version number |
| 10:40 | pjstadig | backports are something that someone could do unofficially for themselves or others without rich having to be involved |
| 10:41 | Chouser | but it's certainly more work than not backporting fixes, though less work than people individually backporting fixes to a variety of older versions |
| 10:41 | jhawk28 | in SVN, one ususally fixes the issue in the release and then merges to the trunk |
| 10:42 | Chouser | so are there people not using clojure (or using it less?) because there's not a "stable" version for which they can expect ongoing fixes without breaking changes? If so, are there enough of such people that we'd want to support them? |
| 10:42 | pjstadig | good question |
| 10:42 | pjstadig | first thing i did was download the release, which was fairly recent at that point |
| 10:43 | pjstadig | then promptly realized i had to live on the edge to really get the benefits |
| 10:43 | jhawk28 | depends on the target market, alpha coders or corporations |
| 10:43 | Chouser | pjstadig: I think that's common |
| 10:43 | tashafa | is there a clojure-contrib for dates? |
| 10:43 | pjstadig | of course then the AOT changes wreaked havoc |
| 10:44 | pjstadig | i think rich rolled back the changes or i bumped back to an earlier rev...i don't recall exactly |
| 10:44 | tashafa | i'm tired of working with java date objects when i need to use date and time |
| 10:44 | Chouser | tashafa: not yet. You might try Joda Time -- apparently it's already built on immutable date, it might not need a clojure wrapper. |
| 10:44 | pjstadig | but that's just what I expect when working on the edge with an in development language |
| 10:45 | tashafa | Chouser: thanks! |
| 10:45 | jhawk28 | tashafa: which Date object? sql.Date, util.Date, Calender, GregorianCalendar, etc... ;) |
| 10:45 | tashafa | jhawk28: all of em :) it would be nice to have a clojure wrapper around all of them |
| 10:46 | tashafa | or have the clojure wrapper know what you mean |
| 10:46 | Chouser | tashafa: there's also Chrono: http://groups.google.com/group/clojure/browse_thread/thread/659503e698ede0b5/9dda25f36f102799 |
| 10:47 | rhickey | no one's ever submitted a patch for a release branch, so I don't know how that workflow would work (apply patch to branch, merge to trunk), also how does one verify their patch to branch will work with trunk, especially if the merge requires intervention? |
| 10:48 | Chouser | seems like it would have to be two separate patches much of the time |
| 10:48 | Chouser | at the very least, each should have been tested. |
| 10:49 | jhawk28 | releases are expensive, but a whole new group of people come when they are done |
| 10:49 | Chouser | perhaps the Issue page would be sufficient for coordination -- different devs even could submit patches for different branches |
| 10:49 | rhickey | so, I could work on trunk and anyone that wanted to could pull fixes from my work and submit as patches to release branch |
| 10:50 | pjstadig | i think generally merges work better when the code doesn't change radically |
| 10:50 | pjstadig | so depending on the amount of change it may not be necessary to make two patches |
| 10:50 | pjstadig | but i guess someone submitting a patch could do the leg work |
| 10:50 | rhickey | pjstadig: but merges require that I work on something other than trunk |
| 10:50 | Chouser | rhickey: I'd think so. Or if someone submitted a patch for a release, someone else might forward-port to trunk, attach that patch to the same issue for you to apply. |
| 10:50 | pjstadig | merge with trunk themselves and then submit a second patch for trunk |
| 10:51 | pjstadig | hehe |
| 10:51 | pjstadig | Chouser: i'm thinking the same thing |
| 10:51 | rhickey | I think the 'other people making patches' is easier than the scenario for me personally. I want to work in trunk only |
| 10:51 | rhickey | so I'll fix things that will need to go in release |
| 10:52 | pjstadig | rhickey: i don't think that is an unreasonable expectation |
| 10:52 | pjstadig | perhaps someone could be a 'captain' of releases |
| 10:52 | pjstadig | and manage patching the releases and forward-porting to trunk or something |
| 10:52 | danlarkin | yeah, some projects have either a general release manager or a release manager for each supported release |
| 10:54 | pjstadig | git! |
| 10:54 | rhickey | well, before management comes the work itself, as I said, I've never gotten a patch for a release branch |
| 10:54 | pjstadig | yeah i just brought up a theoretical point, i don't know of any particular bugs in 20081217 |
| 10:55 | rhickey | pjstadig: what about all the fixes that are in 20090320? |
| 10:55 | pjstadig | i guess i mean that i don't have any production apps depending on 20081217 that would require a backported bug fix |
| 10:55 | danlarkin | well a manager could be in charge of backporting patches |
| 10:56 | pjstadig | i have no skin in the game...so to speak |
| 10:56 | rhickey | I guess I'm just imagining that 20081217 was called 1.0 |
| 10:57 | rhickey | what would have been different? How much work would have been expended keeping it patched, and would anyone care or still track trunk? |
| 10:57 | Chouser | generally if a problem was discovered in 20081217, the discoverer was told it was fixed in trunk (or it then became fixed in trunk) |
| 10:58 | Cark | i can only tell about me : i download trunk when i feel i'm too far behind, or a bug i meet is fixed there |
| 10:58 | Chouser | I suppose at that point the discoverer either moved to trunk or decided it was "too early" to start using Clojure and walked away for a while. |
| 10:59 | rhickey | Chouser: right, so in order for that to be different, someone would have to backport fixes, and also do dot releases? |
| 11:00 | rhickey | would people be ok with pulling svn on a release branch? |
| 11:00 | rhickey | to get fixes? |
| 11:00 | pjstadig | some might also prefer a download i'd guess |
| 11:01 | Chouser | right, I have absloutely no idea. It's easier for distro's to deal with versioned downloads (compared to dated pulls from svn). |
| 11:01 | AWizzArd | OT: when I have a java lib (a .jar file) which is under the gpl and I use classes/methods from that lib, do I then have to put my program also under the gpl? Or does it not count as derivative work to just use a lib, without modifying its sources? |
| 11:01 | rhickey | I guess the versions need have no more identity than, .1 more than the last one |
| 11:03 | danlarkin | so for 20081217 -- you'd backport a fix to the branch, make a new tag (20081217.1) and make a new download (20081217.1.zip or whatever) |
| 11:03 | Chouser | danlarkin: maybe not a new version for *every* fix, but otherwise I think that's right. |
| 11:03 | Cark | awizzard : your program should be gpl |
| 11:04 | pjstadig | perhaps a monthly release of fixes |
| 11:04 | pjstadig | 20081217.200903 |
| 11:04 | pjstadig | hehe |
| 11:04 | Chouser | gah |
| 11:04 | pjstadig | just kidding |
| 11:05 | pjstadig | a kind of side point |
| 11:05 | pjstadig | in regards to terracotta |
| 11:05 | rhickey | So, I think we need some way to embed version numbers in a release, and some volunteers for backporting fixes to release branches and making dot releases - I'd like to stay creative and productive by doing all my work (fix or feature) in trunk, and never having to merge |
| 11:06 | pjstadig | with the class replacement that TC does it really requires a specific release |
| 11:06 | pjstadig | they recommend for clojure 1.0 you create an integration module named clojure-1.0-[your module's version] or something |
| 11:08 | Chouser | pjstadig: so that it's easier to make sure all hosts are running the same version of clojure? |
| 11:08 | pjstadig | the class replacement will substitute modified versions of the classes for the original classes |
| 11:09 | pjstadig | in order for them to work well with the other non-replaced classes, then you need to target a specific version |
| 11:09 | pjstadig | class replacement is only used in cases where you can't or don't want to actually modify the original code base |
| 11:09 | pjstadig | so i could substitute TC compatible versions of classes without rhickey having to make TC specific changes to clojure |
| 11:11 | Chouser | embeding a version number could be as simple as an ant command-line option the controls output zip (and jar?) file name, and the root binding of a *version* var, right? |
| 11:11 | hiredman | Cark: "should be"? |
| 11:13 | rhickey | Chouser: we need an ant target for 'release' I think |
| 11:13 | Chouser | rhickey: to create a .zip? |
| 11:14 | rhickey | yes, I do that by hand now, including prepping svninfo.txt and changes.txt |
| 11:14 | Chouser | I bet there's someone on the group just itching to write ant build code. |
| 11:15 | pjstadig | hehe |
| 11:15 | Cark | hiredman : about version number ? |
| 11:15 | pjstadig | i'm allergic to ants |
| 11:15 | pjstadig | fireants actually |
| 11:16 | Cark | hiredman : oh about the gpl question ... right ... must be ! |
| 11:21 | jhawk28 | question about metadata, why is the metadata always null when I debug into the LispReader and Compiler? |
| 11:22 | jhawk28 | is there a method that creates the metadata that I am missing? |
| 11:23 | Chouser | Do you have an example of where you'd expect metadata that you're not seeing any? |
| 11:23 | jhawk28 | referring to Symbol.meta |
| 11:23 | jhawk28 | I am wanting to see where it is in the code |
| 11:25 | jhawk28 | Issue 17 is the context (counting arity) |
| 11:26 | Chouser | The reader usually puts metadata on symbols only when specified directly using #^ |
| 11:26 | Chouser | ,(meta (read-string "#^Integer foo")) |
| 11:26 | clojurebot | {:tag Integer} |
| 11:26 | jhawk28 | yes, thats what I am seeing |
| 11:26 | Chouser | arity is attached by defn to the Var being defined |
| 11:27 | Chouser | ,(:arglists (meta (var map))) |
| 11:27 | clojurebot | ([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]) |
| 11:27 | cemerick | rhickey_: congrats on the "release". Can't thank you and the rest of the community enough. |
| 11:28 | jhawk28 | so arity is on the Var not the function? |
| 11:30 | Chouser | jhawk28: I don't think there's currently a sane way to get the valid arities of a fn |
| 11:30 | Chouser | and in fact, I'm not sure that the var metadata is particularly trustworthy, since it can be adjusted by the programmer |
| 11:31 | Chouser | ,(:arglists (meta (var defn))) |
| 11:31 | clojurebot | ([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?]) |
| 11:31 | Chouser | those ?-suffix names are meant to indicate to a human reader that its an optional arg. |
| 11:33 | jhawk28 | the problem that I see with the issue is that *hypothetically* if the metadata was added to handle the arity checking at compile time, it would slow the parsing down |
| 11:34 | Chouser | parsing and compiling is not generally considered critical path, I think. |
| 11:34 | jhawk28 | unless it was a map that could be accessed later which would mean more memory usage |
| 11:34 | Chouser | the issue itself implies some amount of extra work being done at compile time. |
| 11:37 | jhawk28 | based on the where I was looking in teh code, the logic would fit best in the FnExpr.parse |
| 11:40 | jhawk28 | it does look like it is doing something with arity |
| 11:40 | jhawk28 | it only is checking for the variadicMethod though |
| 11:41 | jhawk28 | that is an interesting word: *variadic* |
| 11:41 | jhawk28 | http://en.wikipedia.org/wiki/Variadic_function |
| 12:43 | AWizzArd | Is Stuart Sierra sometimes visiting this channel? |
| 12:45 | gnuvince | I think he does |
| 12:45 | gnuvince | ~seen stuartsierra |
| 12:45 | clojurebot | no, I have not seen stuartsierra |
| 13:17 | cgrand | gnuvince: can you post the whole profiling data (like you did here: https://gist.github.com/82136/d9968b44ddf691d3eabe3737ad1bea863f221d11) it will help to interpret the summary data |
| 13:21 | gnuvince | cgrand: okay |
| 13:22 | gnuvince | Give me a few minutes, runhprof is pretty slow |
| 13:22 | gnuvince | cgrand: do you want cpu and heap? |
| 13:22 | cgrand | cpu should suffice |
| 13:38 | pjstadig | + |
| 13:47 | cads | hello |
| 13:47 | cads | is anyone here attending the atlanta clojure group this saturday? |
| 14:01 | blbrown_lt | cads I might, what time is it? I might go. |
| 14:01 | blbrown_lt | I guess there aren't that many Atlanta people but I am one of them. |
| 14:04 | gnuvince | cgrand: http://gist.github.com/82477 |
| 14:05 | gnuvince | cgrand: the html version looks truncated: http://gist.github.com/raw/82477/7ccf374088d7e2bce9a229071d8a9b7af409d286/gistfile1.txt |
| 14:05 | cads | blbrown_lt: http://leafhopper.github.com/clojure.html |
| 14:06 | cads | blbrown_lt: did you already get into contact with sari? |
| 14:06 | blbrown_lt | yea |
| 14:06 | blbrown_lt | how many do you think will go |
| 14:07 | cads | it'll be at 10 am, till noon... the email said around 8 people will show up |
| 14:09 | cads | it's close to where I am, so I figure why not |
| 14:12 | cgrand | gnuvince: "funny" 1st entry (and it wasn't in your previous profiling... I ignore it for now) |
| 14:13 | Raynes | Today is Rich Hickey appreciation day. |
| 14:13 | blbrown_lt | woot!! |
| 14:13 | gnuvince | Yeah, I'm at work now, and my CPU is being used quite a lot, so that may have something to do with it (plus, I'm using vmware) |
| 14:13 | blbrown_lt | rhickey, thanks for the work on clojure. |
| 14:14 | cgrand | #2: no clue, #3 looks interesting: null-string |
| 14:14 | Raynes | I should post on the group declaring this, the first day of spring, Rich Hickey appreciation day. Everyone would think I was trolling though... |
| 14:14 | blbrown_lt | And I am still a strong believer in the evolution and pervasiveness of a technology. I hope more companies and people get involved with Clojure. |
| 14:14 | Raynes | I'm going to do it anyway I think. |
| 14:15 | gnuvince | cgrand: I could take a break and run a profile while my PC is relatively idle |
| 14:15 | gnuvince | see if that changes the data |
| 14:15 | cgrand | apart from the 1st entry, both runs look similar |
| 14:16 | bitbckt | clojurebot: everyday is Rich Hickey Appreciation Day |
| 14:16 | clojurebot | Ok. |
| 14:16 | Chouser | clojurebot: what is today? |
| 14:16 | clojurebot | everyday is Rich Hickey Appreciation Day |
| 14:17 | rhickey | :) |
| 14:17 | bitbckt | hehe |
| 14:17 | gnuvince | Also, in my real program, null-string is called about 5 or 6 times, so the real guy we should probably be focusing on is read-field-aux |
| 14:18 | cmvkk | oh hey, from last night, is this expected behavior: |
| 14:18 | cmvkk | ,(list? (cons 'a nil)) |
| 14:18 | clojurebot | true |
| 14:18 | cmvkk | ,(list? (cons 'a (cons 'b nil))) |
| 14:18 | clojurebot | false |
| 14:18 | hiredman | ,(class (cons 'a (cons 'b nil))) |
| 14:18 | clojurebot | clojure.lang.Cons |
| 14:18 | hiredman | :/ |
| 14:18 | cmvkk | apparently those don't implement whatever interface list? tests for. |
| 14:19 | hiredman | ~def list? |
| 14:19 | cgrand | gnuvince: is null-string intended to always read n bytes and then truncate to the first NUL (when found)? |
| 14:19 | gnuvince | cgrand: yes. |
| 14:20 | cads | yesterday my girl gave me a most luxurious hickey. rhickey, I don't know if there's a right way to take this, but when I saw it I thought of clojure. Cheers on the work man. |
| 14:20 | hiredman | huh |
| 14:21 | hiredman | so clojure.lang.Cons is an IPersistentCollection, but not an IPersistentList |
| 14:21 | hiredman | ,(class (seq (cons 'a (cons 'b nil)))) |
| 14:21 | clojurebot | clojure.lang.Cons |
| 14:21 | bitbckt | well... that's awkward |
| 14:21 | Chouser | bitbckt: the Cons class, or cads' comment? |
| 14:22 | Cark | ,(class (list 1 2 3)) |
| 14:22 | clojurebot | clojure.lang.PersistentList |
| 14:22 | Cark | hum |
| 14:22 | bitbckt | Chouser: Yes. |
| 14:22 | hiredman | wait |
| 14:22 | Chouser | ,(class (cons 'a (list 1 2 3))) |
| 14:22 | clojurebot | clojure.lang.Cons |
| 14:22 | Chouser | ,(class (conj (list 1 2 3) 'a)) |
| 14:22 | clojurebot | clojure.lang.PersistentList |
| 14:22 | Chouser | ,(cons 'a (list 1 2 3)) |
| 14:22 | clojurebot | (a 1 2 3) |
| 14:23 | Chouser | ,(conj (list 1 2 3) 'a) |
| 14:23 | clojurebot | (a 1 2 3) |
| 14:23 | cmvkk | implementation details... |
| 14:23 | cmvkk | probably though, the result of a cons should return true for list? though, right? |
| 14:24 | Chouser | ,(class (rest (cons 'a (list 1 2 3)))) |
| 14:24 | clojurebot | clojure.lang.PersistentList |
| 14:24 | bitbckt | haha |
| 14:25 | Chouser | ,(class (rest (cons 'a (cons 'b (list 1 2 3))))) |
| 14:25 | clojurebot | clojure.lang.Cons |
| 14:28 | Raynes | I hope everyone doesn't think I'm trolling :\ |
| 14:31 | Chouser | well, that does seem odd, but looking at the definition of RT.cons(), I wonder if the fix would just be to have the null coll case return Cons( x, null ) instead of a PersistentList. |
| 14:32 | Cark | ,(seq? (cons 1 nil)) |
| 14:32 | clojurebot | true |
| 14:32 | Cark | that's all i need to know |
| 14:32 | rhickey | Chouser: in order to fix what? not sure I understand what is broken - consing doesn't necessarily create Conses |
| 14:32 | rhickey | the idea is to track count whenever possible |
| 14:33 | Cark | ,(doc counted?) |
| 14:33 | clojurebot | "([coll]); Returns true if coll implements count in constant time" |
| 14:33 | rhickey | creating a persistent list when consing onto nil seeds that |
| 14:33 | Cark | (counted? (list 1 2 3)) |
| 14:33 | Cark | ,(counted? (list 1 2 3)) |
| 14:33 | clojurebot | true |
| 14:33 | Cark | ,(counted (cons 'a (list 1 2 3)) |
| 14:33 | clojurebot | EOF while reading |
| 14:33 | rhickey | lists are counted and conses are not |
| 14:33 | cmvkk | so the "list?" example is expected behavior after all? |
| 14:34 | jhawk28_ | raynes: today is go get free Rita's day |
| 14:34 | Cark | ,(counted? (cons 'a (list 1 2 3))) |
| 14:34 | clojurebot | false |
| 14:34 | Cark | ok i see |
| 14:34 | Raynes | jhawk28_: Not any more. It's RHAD now. |
| 14:35 | Lau_of_DK | Good evening guys |
| 14:35 | Cark | since it's all persitent data structures, wouldn't it be possible to have conses be counted as well ? |
| 14:35 | Lau_of_DK | lkkkkkkkkkkkkkkkkkkk7lk |
| 14:36 | Raynes | Lau_of_DK: Good evening, afternoon here. Happy Rich Hickey Appreciation day. :) |
| 14:36 | Cark | each cons can carry the count of it's tail + 1 |
| 14:40 | Chouser | ,(take 5 (map counted? (iterate #(cons 1 %) nil))) |
| 14:40 | clojurebot | (false true false false false) |
| 14:41 | Lau_of_DK | Raynes, Oh is that today ? |
| 14:41 | Lau_of_DK | ~counted? |
| 14:41 | clojurebot | No entiendo |
| 14:41 | Chouser | Cark: lazy seqs can't be counted, for example. |
| 14:41 | Cark | clojurebot: everyday ? |
| 14:41 | clojurebot | everyday is Rich Hickey Appreciation Day |
| 14:41 | Lau_of_DK | haha |
| 14:41 | Raynes | Lau_of_DK: It is now. |
| 14:42 | Raynes | I suppose everyone will probably think my group post is just me trolling, but I assure you otherwise. :> |
| 14:43 | Lau_of_DK | I believe you |
| 14:43 | danlarkin | oh gosh, this post is treading the line |
| 14:43 | Lau_of_DK | this? |
| 14:43 | danlarkin | Raynes' |
| 14:44 | Lau_of_DK | just... any one of Raynes? |
| 14:44 | hiredman | ~def c.l.Cons |
| 14:44 | danlarkin | "March 20th 2009 Rich Hickey Appreciation Day!" |
| 14:44 | danlarkin | that post |
| 14:45 | Raynes | Aw c'mon. It's a nice post and Rich deserves it :| |
| 14:45 | Lau_of_DK | Raynes, I think thats a great post, and you actually succeeded in making a french person tell a joke! |
| 14:45 | Raynes | :D |
| 14:45 | hiredman | pfft, everyone knows "Rich Hickey Appreciation Day!" is just an ancient pagan fertility rite that the roman catholic church co-opted in order to gain more converts |
| 14:46 | Lau_of_DK | clojurebot, how do we handle not-funny jokes? |
| 14:46 | Lau_of_DK | :) |
| 14:48 | hiredman | clojurebot: whose job is it to be funny? |
| 14:48 | clojurebot | that is durka42's job |
| 14:48 | Raynes | I thought that was my job. |
| 14:48 | durka42 | but he's in problem session |
| 14:48 | hiredman | clojurebot: whose job is it to smoke test releases? |
| 14:48 | clojurebot | that is ffailla's job |
| 14:48 | hiredman | clojurebot: whose job is it to tell Raynes what his job is? |
| 14:48 | clojurebot | that is qebab's job |
| 14:53 | pjstadig | clojurebot: what is my job? |
| 14:53 | clojurebot | It's greek to me. |
| 14:53 | pjstadig | clojurebot: does everyone have to have a job? |
| 14:53 | clojurebot | Huh? |
| 14:54 | hiredman | clojurebot: whose job is it to placate pjstadig? |
| 14:54 | clojurebot | that is dnolen_'s job |
| 14:54 | triddell1 | clojurebot: whose job is it to show us what the pattern is to this job thing? |
| 14:54 | clojurebot | that is msingh's job |
| 14:55 | triddell1 | ah, then why didn't he/she speak up? :-) |
| 14:58 | Chouser | How can a static method call be unresolved at compile time, but resolvable at run time? |
| 14:58 | bitbckt | Magic. |
| 14:58 | Chouser | :-/ |
| 14:59 | Chouser | Perhaps I should say: can someone give me an example of a static method call that cannot be resolved at compile time, but can be at run time? |
| 15:01 | Retonator | i thought that when i would do this |
| 15:01 | Retonator | user> (defn t [n] n 1) |
| 15:01 | Retonator | #'user/t |
| 15:01 | Retonator | user> (t +) |
| 15:01 | Retonator | 1 |
| 15:01 | Retonator | that + got evaluated by the reader to 0 and that i had to use the quoted form but it isn't, could some one explain this? |
| 15:01 | rhickey | user=> (set! *warn-on-reflection* true) |
| 15:01 | rhickey | true |
| 15:01 | rhickey | user=> (def x 4.2) |
| 15:01 | rhickey | #'user/x |
| 15:01 | rhickey | user=> (Math/round x) |
| 15:01 | rhickey | Reflection warning, line: 30 - call to round can't be resolved. |
| 15:01 | rhickey | 4 |
| 15:02 | rhickey | e.g. args overloaded on type |
| 15:02 | AWizzArd | although in principle it could be known |
| 15:03 | AWizzArd | the user should need to do extra work to allow for assigning something else to x |
| 15:03 | AWizzArd | in that case she would be shooting in her own leg |
| 15:04 | AWizzArd | :) |
| 15:05 | Chouser | rhickey: ah, of course. thanks. |
| 15:06 | rhickey | np |
| 15:06 | Chouser | Retonator: why would + be evaluated to by the reader to 0? |
| 15:06 | Chouser | Retonator: the reader reads the charater "+" as the symbol '+ Then the compiler resolves it to the Var clojure.core/+ |
| 15:07 | Retonator | i thought that with my limited knowledge of clojure. i read some article that said that the only way for a function to not evaluate it's arguments it has to be done with a macro |
| 15:08 | hiredman | ,(do + 1) |
| 15:08 | clojurebot | 1 |
| 15:08 | Retonator | "While functions always evaluate all their arguments, macros can decide which of their arguments will be evaluated. " |
| 15:09 | danlarkin | Retonator: perhaps do you think you're doing: (defn t [n] (n 1))? |
| 15:09 | Chouser | Retonator: that's true, but it means that when (t +) is evaluated, the value of the Var clojure.core/+ is fetched (it is the addition function) and that is passed as t's argument n |
| 15:09 | Chouser | ,(class? +) |
| 15:10 | clojurebot | false |
| 15:10 | Chouser | ,(class +) |
| 15:10 | clojurebot | clojure.core$_PLUS___3313 |
| 15:10 | Retonator | aaa ok, i thought that i evaluated the function it self |
| 15:10 | Chouser | ,(fn? +) |
| 15:10 | clojurebot | true |
| 15:10 | Retonator | but the + symbol evaluates to the function not the function itself |
| 15:11 | Chouser | ,(prn '+ + (+)) |
| 15:11 | clojurebot | + #<core$_PLUS___3313 clojure.core$_PLUS___3313@6e3fe4> 0 |
| 15:11 | dnolen_ | ,[(+) +] |
| 15:11 | clojurebot | [0 #<core$_PLUS___3313 clojure.core$_PLUS___3313@6e3fe4>] |
| 15:11 | Retonator | aaah okay so the () also evaluates the function inside? |
| 15:12 | Retonator | i still have to get my mind around the reader and the evaluation etc... |
| 15:12 | WizardofWestmarc | afternoon all |
| 15:13 | Chouser | Retonator: sure, the way to call a function is to put it at the front of a list. |
| 15:13 | Chouser | ,[(+) (+ 1) (+ 1 2) (+ 1 2 3)] |
| 15:13 | clojurebot | [0 1 3 6] |
| 15:14 | Chouser | ,(let [add +] [(add) (add 1) (add 1 2) add]) |
| 15:14 | clojurebot | [0 1 3 #<core$_PLUS___3313 clojure.core$_PLUS___3313@6e3fe4>] |
| 15:14 | Retonator | (+), so how do i translate this to english: excecute the next function, get the meaning of the symbol plus and this yield a function |
| 15:14 | danlarkin | Retonator: the way list evaluation works is that each parameter inside the list is evaluated, right to left, and then all the args (except the first) are passed to the first |
| 15:16 | Chouser | left to right |
| 15:16 | Retonator | but then why does this still work (t (+)) |
| 15:16 | danlarkin | really? |
| 15:17 | hiredman | Retonator: (+) becomes 0 |
| 15:17 | dnolen_ | Retonator: (+) evaluates to 0, then gets passed to the function t. |
| 15:17 | hiredman | so substitutiong into your functio body you get (do 0 1) |
| 15:17 | Retonator | but i still get 1 |
| 15:17 | hiredman | ,(do 0 1) |
| 15:17 | clojurebot | 1 |
| 15:17 | dnolen_ | because t returns 1 |
| 15:17 | hiredman | ,(doc do) |
| 15:17 | clojurebot | java.lang.Exception: Unable to resolve var: do in this context |
| 15:17 | danlarkin | I thought (perhaps erroneously) that CL evals right-to-left, so I assumed clojure did too... but there I go assuming again |
| 15:17 | hiredman | (doc do) |
| 15:17 | clojurebot | excusez-moi |
| 15:18 | Lau_of_DK | w00t, I just made my first post to the group I think :)~ |
| 15:18 | Chouser | ,(let [a (atom 0)] (list (swap! a inc) (swap! a inc))) |
| 15:18 | clojurebot | (1 2) |
| 15:18 | Raynes | Lau_of_DK: In my post? It should be in my post. |
| 15:18 | Raynes | Yep! |
| 15:18 | Lau_of_DK | Yes sir! |
| 15:18 | hiredman | danlarkin: if a form is a cons list, how would you walk it right-to-left to eval? |
| 15:19 | danlarkin | hiredman: I'm missing the gotcha, why can't you? |
| 15:20 | danlarkin | Chouser: you and your "proof", bah! |
| 15:20 | Retonator | is a function body wrapped in a do then? |
| 15:20 | hiredman | danlarkin: it would be kind of silly because you have to walk the list to the last element, flipping pointers, and then walk backwards evaling |
| 15:20 | Retonator | or am i doing that by not haveing it in a () |
| 15:20 | hiredman | Retonator: yes, there is an implicit do |
| 15:22 | Retonator | aaa okay that figures, i get it ;). now if i do this |
| 15:22 | Retonator | (defn a [n] (n 1)) |
| 15:22 | danlarkin | yeah google is telling me that other lisps eval left-to-right too. Don't know how I got that mixed up... I'd thought that for years, jeez |
| 15:22 | Retonator | i get what i want if i do (a (+)) |
| 15:23 | danlarkin | Retonator: you probably want (a +) I think |
| 15:23 | Retonator | naah actually not i was learning when the function got evaluated ;) |
| 15:23 | hiredman | danlarkin: I have spent the last few days tinkering with my own lisp interpreter, so these things are on the top of my brain |
| 15:26 | Retonator | so now i get why anonymous functions are used as arguments to other function with an %, because there is no other way(except macro's), to get in a function un-evaluated |
| 15:27 | dnolen_ | Retonator: i think you might still be confused. |
| 15:27 | Retonator | please help me then ;), i think i get it maybe i explain it the wrong way |
| 15:28 | dnolen_ | the standard Lisp form is (afunction arg1 arg2 arg3 ...) |
| 15:28 | hiredman | function literals, which use % do not have an implicit do |
| 15:28 | Chouser | anytime you see % it is inside a #(), and they can always be replaced with (fn [myarg] ...) |
| 15:28 | dnolen_ | if arg1 is a subform it's contents will be evaluated first |
| 15:28 | dnolen_ | it's recursive. |
| 15:29 | Chouser | I can't believe I just did that. I mean of course, (fn [myarg] (...)) |
| 15:29 | dnolen_ | once all the values are evaluated |
| 15:29 | dnolen_ | afunction is applied |
| 15:29 | hiredman | Chouser: don't worry, it's been logged |
| 15:30 | dnolen_ | when you write (def a [afn] (afn 1)), you are saying afn is a local variable |
| 15:30 | dnolen_ | which better be a function when you pass it in. |
| 15:30 | dnolen_ | sorry (defn a [afn] (afn 1)) |
| 15:31 | Retonator | yes that is what i get dnolen, i think i am looking for the word currying in another functional language (clean) you could pas a function like (+ 3) and it would get back a function with just one parameter and not get evaluated |
| 15:31 | dnolen_ | you can use partial to do something like that. |
| 15:31 | Retonator | to do the same in clojure i have to pass a anonymous function with a % right? |
| 15:32 | Cark | ,(doc partial) |
| 15:32 | clojurebot | "([f arg1] [f arg1 arg2] [f arg1 arg2 arg3] [f arg1 arg2 arg3 & more]); Takes a function f and fewer than the normal arguments to f, and returns a fn that takes a variable number of additional args. When called, the returned function calls f with args + additional args." |
| 15:32 | Chouser | (partial + 3) or #(+ 3 %) or (fn [x] (+ 3 x)) |
| 15:32 | Retonator | yes thanks chouser |
| 15:33 | Retonator | and dnolen_ |
| 15:33 | Chouser | not exactly the same, though, because the function returned by partial will take any number of args. The other two forms take exactly 1 arg. |
| 15:33 | Cark | there should be the word "curry" in the docstring |
| 15:34 | hiredman | partial actually "uncurries" |
| 15:34 | hiredman | oh |
| 15:34 | hiredman | nope |
| 15:34 | hiredman | curry |
| 15:35 | danlarkin | hahah we are being so unhelpful I'm sure |
| 15:35 | Retonator | yeah i was really thinking about your uncurries statement and was thinking that i had the concept of currying wrong |
| 15:35 | Cark | ,(comp chicken partial) |
| 15:35 | clojurebot | java.lang.Exception: Unable to resolve symbol: chicken in this context |
| 15:36 | Cark | yeah that doesn't sound half as good as ,(comp chicken curry) ! |
| 15:36 | Retonator | lol |
| 15:36 | Retonator | @danlarking: do you mean beeing unhelpfull to me? |
| 15:37 | danlarkin | Retonator: yes |
| 15:38 | harpastum | is there a standard clojure (not java) power function? |
| 15:38 | harpastum | i really enjoy clojure's absolute numerical accuracy |
| 15:38 | Retonator | nope actually very helpfull |
| 15:38 | harpastum | ,(Math/pow 10 301) |
| 15:38 | clojurebot | 9.999999999999999E300 |
| 15:38 | Retonator | i have some functional back ground and i just have to learn the concepts of clojure |
| 15:39 | Retonator | and i am dutch so i am not always correct in my wordings and sometimes i get it write in my mind but not in words ;) |
| 15:39 | Chouser | ,(.pow 10M 301) |
| 15:39 | clojurebot | 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000M |
| 15:40 | gnuvince | That's a lot of zeroes there |
| 15:40 | harpastum | haha |
| 15:41 | harpastum | what are the arguments to that function? |
| 15:41 | harpastum | ,(.pow 10 301) |
| 15:41 | clojurebot | java.lang.IllegalArgumentException: No matching method found: pow for class java.lang.Integer |
| 15:41 | harpastum | because that doesn't work |
| 15:41 | durka42 | ,(type 10M) |
| 15:41 | clojurebot | java.math.BigDecimal |
| 15:41 | harpastum | aahh |
| 15:41 | Retonator | ,(/ (* 1/3 3) 3) |
| 15:41 | clojurebot | 1/3 |
| 15:41 | Retonator | i like that ;) |
| 15:41 | harpastum | me too |
| 15:42 | harpastum | ,(= 10M 10) |
| 15:42 | clojurebot | true |
| 15:42 | harpastum | ok |
| 15:43 | harpastum | i was reading that as ten million, which had me confused |
| 15:43 | harpastum | because i threw this function together |
| 15:43 | harpastum | (defn power [number exponent] (if (zero? exponent) number (* number (power number (dec exponent))))) |
| 15:43 | harpastum | i couldn't figure out how to not load the stack |
| 15:43 | harpastum | using trampoline |
| 15:43 | pjstadig | http://clojure.pjstadig.staxapps.net/ |
| 15:44 | pjstadig | compojure on stax |
| 15:45 | harpastum | what is stax? |
| 15:45 | Chouser | harpastum: trampoline requires the caller to use trampoline, and for the called function to know it's being called by trampoline. |
| 15:45 | harpastum | www.staxapps.net returns a 404 |
| 15:45 | pjstadig | stax.com i think |
| 15:46 | pjstadig | stax is like google app engine for java |
| 15:46 | durka42 | stax.net |
| 15:46 | pjstadig | or heroku |
| 15:46 | Chouser | harpastum: other solutions would include high-order functions or an accumulator |
| 15:46 | durka42 | heroku is rails? |
| 15:46 | pjstadig | ja |
| 15:46 | pjstadig | an very easy to use |
| 15:46 | Chouser | ,(apply * (repeat 10 2)) |
| 15:46 | clojurebot | 1024 |
| 15:46 | pjstadig | stax seems to be just about as easy to me |
| 15:47 | walters | hmm, how stax is different from ec2, firing up a fedora instance, and "yum install java-1.6.0-openjdk" ? |
| 15:47 | harpastum | chouser: thanks. I'll look into those |
| 15:48 | pjstadig | not sure i just started playing with stax |
| 15:48 | Chouser | pjstadig: free to get started? |
| 15:48 | pjstadig | i think the advantage is they handle the configuration, provisioning, management of the instances |
| 15:48 | pjstadig | they also handle the load balancing |
| 15:49 | pjstadig | and make sure your database is available clusterwide |
| 15:49 | pjstadig | it's in beta and free for now |
| 15:50 | pjstadig | you get a command like tool (just like heroku) |
| 15:50 | pjstadig | so you deploy with 'stax deploy -u pjstadig -p [password]' |
| 15:50 | pjstadig | that's not my actual password, btw |
| 15:54 | danlarkin | hunter2 |
| 15:57 | Retonator | nice binary multiplaction chouser ;) |
| 15:58 | pjstadig | http://stax.stadigtech.com/ |
| 15:58 | pjstadig | works with custom domains too |
| 15:59 | harpastum | how long did it take for them to send your invite email? |
| 15:59 | pjstadig | i signed up this morning and got an invite by midday |
| 16:00 | Chouser | pjstadig: are you using the ring fork of compojure? |
| 16:00 | pjstadig | i'm using weavejester's branch |
| 16:01 | pjstadig | whichever one that is |
| 16:01 | pjstadig | i did have to comment out one line |
| 16:02 | pjstadig | 65 of compojure.http.servlet |
| 16:02 | pjstadig | it tries to put a Ref into the session |
| 16:02 | pjstadig | which is not serializable |
| 16:03 | pjstadig | Chouser: i used the master branch of weavejester's compojure not the ring branch |
| 16:03 | pjstadig | i don't know much about compojure, this is my first look at it |
| 16:03 | WizardofWestmarc | that reminds me, need to finish getting Madison Square set up tonight |
| 16:04 | WizardofWestmarc | got everything except fnparse downloaded and built last night. |
| 16:05 | WizardofWestmarc | may just roll fnParse into another .jar file to make it cleaner heh |
| 16:05 | WizardofWestmarc | since it currently doesn't even have an ant build.xml file |
| 16:05 | Chouser | pjstadig: ok, I haven't looked at it either, but I've got a cute little web app begging to be rewritten in clojure. |
| 16:07 | Chouser | right now it's so slow. http://movies.n01se.net/ |
| 16:08 | danlarkin | WizardofWestmarc: fork it on github and issue joshua choi a pull request |
| 16:08 | danlarkin | Chouser: perfect for madison!! |
| 16:09 | Chouser | well it's currently written using a set of xslt scripts that produce ruby code, so really anything would be better. |
| 16:09 | hiredman | woa, slick |
| 16:10 | ieure | Chouser, That's pretty badass. |
| 16:11 | Chouser | the plot summaries quick working a while ago and I haven't looked into why yet. |
| 16:12 | WizardofWestmarc | danlarkin: don't use git directly atm since my primary OS is windows and Git + windows = not great last I knew. |
| 16:12 | WizardofWestmarc | though I'm probably going to start developing purely in linux vms soon... |
| 16:12 | pjstadig | hehe "xslt to produce ruby" |
| 16:12 | WizardofWestmarc | and honestly I'll probably just make a single .jar for Madison Square w/all the dependencies |
| 16:13 | WizardofWestmarc | once I learn how to properly build ant build files ^_^ |
| 16:13 | WizardofWestmarc | well, I'll probably keep like Jetty seperate |
| 16:14 | Chouser | pjstadig: yessir. I thought at the time it might be a good way to get at xpath. |
| 16:14 | danlarkin | WizardofWestmarc: http://gist.github.com/82552 this is what I use for AOT compiling madison |
| 16:14 | danlarkin | pretty gross ATM |
| 16:15 | WizardofWestmarc | aot + jar or just aot? |
| 16:15 | danlarkin | aot+jar |
| 16:15 | WizardofWestmarc | n/m figured it out |
| 16:15 | WizardofWestmarc | noticed the .jars for most of it |
| 16:16 | danlarkin | or if you don't want to AOT it, just running "ant" will build the jar |
| 16:16 | WizardofWestmarc | I prefer aot since it improves load time |
| 16:17 | danlarkin | slightly |
| 16:17 | WizardofWestmarc | hey slightly is better then none |
| 16:22 | hiredman | lisppaste8 has the highest count of urls in the channel, shockingly |
| 16:43 | brennanc | What kind of concurrency model do I use if I want to have something like a global variable but it be thread specific? |
| 16:43 | Chouser | var |
| 16:44 | brennanc | I want to keep the request headers in compojure somewhere global but have them independent of the other threads / requests |
| 16:44 | Chouser | (def *foo*) to create it, then use (binding [*foo* x] ...) to create a thread-local binding. |
| 16:45 | brennanc | thanks |
| 16:58 | brennanc | binding doesn't seem to be working |
| 16:58 | brennanc | (GET "/map2" (binding [hdrs headers] (print-hdrs))) |
| 16:58 | brennanc | (defn print-hdrs [] (str hdrs)) |
| 16:58 | brennanc | java.lang.Exception: Unable to resolve symbol: hdrs in this context ... |
| 16:59 | Chouser | ah, you've got to (def hdrs) somewhere that print-hdrs can see. |
| 17:01 | brennanc | yup, that did the trick |
| 17:09 | kotarak | How is the view of rhickey for auditing some of the macros in core? Eg. binding: (defn binding* [the-map thunk] (try (Var/pushThreadBindings the-map) (thunk) (finally (Var/popThreadBindings)))) (defmacro binding [the-vec & body] (let ..... `(binding* (hash-map ~(var-ize the-vec)) (fn [] ~@body)))) |
| 17:14 | dnolen | interesting, so the . operator isn't really a function? |
| 17:14 | kotarak | . is a special form. |
| 17:14 | danlarkin | it's speeeeecial |
| 17:14 | hiredman | ,(doc .) |
| 17:14 | clojurebot | java.lang.Exception: Unable to resolve var: . in this context |
| 17:14 | dnolen | blast it :) |
| 17:15 | hiredman | it's the "Java Operator" |
| 17:16 | Chouser | dnolen: http://clojure.org/java_interop#toc6 |
| 17:17 | dnolen | thx all. |
| 17:22 | harpastum | so, I have a large number, and i'm interested in addressing each digit separately |
| 17:22 | harpastum | how would i go about doing that? |
| 17:22 | cconstantine | Does lazy-seq incur a big speed penalty? |
| 17:22 | cconstantine | harpastum: You could divide it by 10 over and over |
| 17:23 | harpastum | cconstantine: I thought about that, but it would be more convenient if i could break it up into a vector of each digit or something |
| 17:23 | harpastum | basically reverse str |
| 17:24 | cconstantine | harpastum: You could print it to a string and treat the string as a list |
| 17:24 | cconstantine | you'd have to convert that character back to a num if you wanted to perform arithmetic on it though |
| 17:24 | hiredman | harpastum: how large of a number? what is its type? |
| 17:25 | harpastum | this isn't for any specific purpose, i'm just trying to understand how to do this type of operation in clojure |
| 17:25 | harpastum | but the number i was looking at was 10! |
| 17:25 | harpastum | 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000 |
| 17:25 | harpastum | one of the project euler challenges is to sum the digits of the number |
| 17:25 | harpastum | and i could hook together a recursive function to do it |
| 17:26 | harpastum | but i thought there might be a more elegant way |
| 17:26 | hiredman | if you have it has a string it very easy to just take each number as a character then using a function to map characters to digits |
| 17:26 | pjstadig | ,(into [] (str 12345)) |
| 17:26 | clojurebot | [\1 \2 \3 \4 \5] |
| 17:27 | hiredman | ,(int \0) |
| 17:27 | clojurebot | 48 |
| 17:27 | hiredman | ,(int \1) |
| 17:27 | clojurebot | 49 |
| 17:27 | harpastum | ascii encoding? |
| 17:28 | hiredman | ,((comp (partial + -48) int) \0) |
| 17:28 | clojurebot | 0 |
| 17:28 | pjstadig | (.parseInt (str \1)) |
| 17:28 | hiredman | unicode actually |
| 17:28 | pjstadig | ,(.parseInt (str \1)) |
| 17:28 | clojurebot | java.lang.IllegalArgumentException: No matching field found: parseInt for class java.lang.String |
| 17:28 | pjstadig | ,(Integer/parseInt (str \1)) |
| 17:28 | clojurebot | 1 |
| 17:28 | hiredman | but that is icky |
| 17:28 | hiredman | building a string |
| 17:28 | pjstadig | why? |
| 17:28 | hiredman | for no reason |
| 17:28 | pjstadig | hehe |
| 17:28 | harpastum | can it handle unicode output? |
| 17:29 | digash | ,(map #(- (int %) (int \0)) (str 123456789)) |
| 17:29 | clojurebot | (1 2 3 4 5 6 7 8 9) |
| 17:29 | pjstadig | eww |
| 17:29 | hiredman | harpastum: java, and hence clojure, is all about the unicode |
| 17:29 | harpastum | ,(int \u2605) |
| 17:29 | clojurebot | 9733 |
| 17:29 | cconstantine | digash: that is what I was thinking |
| 17:29 | hiredman | ,(char 9733) |
| 17:29 | clojurebot | \? |
| 17:29 | cconstantine | is the '(fn [x] ...)' form frowned apon? |
| 17:30 | harpastum | ok |
| 17:30 | digash | ,(reduce + (map #(- (int %) (int \0)) (str 123456789))) |
| 17:30 | clojurebot | 45 |
| 17:30 | hiredman | clojurebot: function literals? |
| 17:30 | clojurebot | Function literals are cute, but overused |
| 17:30 | pjstadig | man now you just gave away the solution |
| 17:30 | hiredman | I think you could just use apply |
| 17:30 | hiredman | (aply + ...) |
| 17:30 | cconstantine | hehe, this looks an awful lot like a project euler problem :) |
| 17:30 | hiredman | apply |
| 17:30 | harpastum | digash: thanks a lot, that was exactly what i was looking for |
| 17:30 | harpastum | yeah, it is |
| 17:30 | harpastum | i already had the answer |
| 17:31 | cconstantine | harpastum: did you make a prime number generator? |
| 17:31 | digash | harpastum: glad to help |
| 17:31 | cconstantine | not for htis problem... but for another one |
| 17:31 | lifflander | So are there any LALR(1) parser generators for Clojure? |
| 17:31 | pjstadig | antlr? |
| 17:31 | harpastum | cconstantine: no, i haven't |
| 17:31 | harpastum | but it sounds pretty exciting. I haven't tried lazy sequences yet |
| 17:31 | cconstantine | harpastum: I've made one on the seive design.. and it's reallly super slow |
| 17:32 | harpastum | i'd imagine it might be |
| 17:32 | hiredman | ~Genuine Sieve |
| 17:32 | clojurebot | It's greek to me. |
| 17:32 | hiredman | clojurebot: Sieve |
| 17:32 | clojurebot | Excuse me? |
| 17:32 | hiredman | clojurebot: Seive |
| 17:32 | clojurebot | Huh? |
| 17:32 | hiredman | bah |
| 17:32 | lisppaste8 | Chouser pasted "num->seq" at http://paste.lisp.org/display/77364 |
| 17:33 | cconstantine | harpastum: my friends have made them in other languagues (C and somethign else...) and it takes theirs miliseconds to generate what mine takes minutes |
| 17:33 | Chouser | cconstantine: ^^^ that's what I did |
| 17:33 | lifflander | antlr looks like it is for human language or such? |
| 17:33 | cconstantine | Chouser: what does it do? |
| 17:33 | lifflander | I'm asking if there is a yacc like tool for Clojure |
| 17:34 | lifflander | Maybe like the haskell tools alex and happy... |
| 17:34 | Chouser | (num->seq 1234512341235412341) ==> (1 2 3 4 5 1 2 3 4 1 2 3 5 4 1 2 3 4 1) |
| 17:34 | cconstantine | ah, for harpastum's problem |
| 17:34 | Chouser | oh, sorry. mis-addressed. :-) |
| 17:35 | harpastum | Yeah, i was confused for a second too |
| 17:35 | harpastum | but that's a pretty clear way to do it |
| 17:35 | lifflander | I'm from a haskell background but want to write this interpreter in Clojure. I saw the "fnparse" library, but is there a tool that generates the parser, which would be an LALR parser? |
| 17:35 | harpastum | cconstantine: did you use a lazy sequence, or are you just calculating to a specific value? |
| 17:36 | cconstantine | harpastum: lazy sequence |
| 17:36 | ambient | antlr is LL(k) |
| 17:36 | lifflander | Is there any LR? |
| 17:36 | Chouser | harpastum: note that num->seq has an optional base argument. |
| 17:36 | ambient | sure, lex/yacc is LALR |
| 17:36 | ambient | and many others |
| 17:36 | lifflander | for Clojure |
| 17:37 | jhawk28__ | CUP is LR |
| 17:37 | lifflander | Like "happy" for Haskel |
| 17:37 | Chouser | (num->seq 234 2) ==> (1 1 1 0 1 0 1 0) |
| 17:37 | cconstantine | Chouser: hehe :) |
| 17:38 | lifflander | Would cup play nicely with Clojure? |
| 17:38 | Chouser | cconstantine: I've got a fast seive around here somewhere too... |
| 17:38 | jhawk28__ | it generates Java, so maybe |
| 17:39 | harpastum | cconstantine: any chance you could post the code, so I could take a look at it? |
| 17:39 | cconstantine | Chouser: if you would share that would be awesome |
| 17:39 | lifflander | Ok. thanks for the help guys. |
| 17:39 | harpastum | maybe I'll be able to see why it's slow |
| 17:39 | harpastum | or, more likely, someone else will |
| 17:40 | cconstantine | harpastum: it's really ugly and hard to use right now |
| 17:40 | cconstantine | harpastum: will you be on later? |
| 17:41 | lisppaste8 | Chouser pasted "primes-under (sieve)" at http://paste.lisp.org/display/77365 |
| 17:41 | harpastum | cconstantine: probably. If not i'll be around. |
| 17:41 | harpastum | way later |
| 17:42 | cconstantine | harpastum: ok, it's on it's way |
| 17:43 | cconstantine | so Couser's doesn't do an arbitrary number of them? |
| 17:47 | cconstantine | http://paste.lisp.org/display/77367 |
| 18:30 | hjlee | how can I next/previous key of some key value in sorted-map? |
| 18:31 | hjlee | how can I find next/previous key of some key value in sorted-map? |
| 18:32 | hiredman | ,(sorted-map :a 1 :b 2 :c 3) |
| 18:32 | clojurebot | {:a 1, :b 2, :c 3} |
| 18:33 | hiredman | ,,(let [a (sorted-map :a 1 :b 2 :c 3) k (keys a)] k) |
| 18:33 | clojurebot | (:a :b :c) |
| 18:33 | hiredman | ,,(let [a (sorted-map :a 1 :b 2 :c 3) k (keys a)] (take-while #(not= % :c) k)) |
| 18:33 | clojurebot | (:a :b) |
| 18:33 | hiredman | ,,(let [a (sorted-map :a 1 :b 2 :c 3) k (keys a)] (last (take-while #(not= % :c) k))) |
| 18:33 | clojurebot | :b |
| 18:34 | hjlee | ah.. but I want it in constant time. (so many keys, so many operations) |
| 18:34 | hiredman | pffft |
| 18:34 | hiredman | your are out of your mind |
| 18:35 | hiredman | constant time |
| 18:35 | hjlee | sorry. log(n) |
| 18:36 | hiredman | you are searching through the keys of a map |
| 18:37 | hjlee | sorted-map keys in tree structure, i guess. |
| 18:37 | hjlee | and insert may take log(n). |
| 18:37 | hjlee | and i guess there are way to find prev/next key in log(n). |
| 18:38 | hjlee | (may not be in api anyway) |
| 18:38 | hiredman | I would guess your guess is mistaken |
| 18:39 | hjlee | why? |
| 18:40 | hiredman | ,(class (sorted-map :a 1)) |
| 18:40 | clojurebot | clojure.lang.PersistentTreeMap |
| 18:40 | hiredman | ~def clojure.lang.PersistentTreeMap |
| 18:43 | hjlee | yes, PersitenentTreeMap uses red/black tree - one of balanced binary tree. |
| 18:43 | hjlee | (I saw the comment of the source) |
| 18:44 | hjlee | so the first guess is right. |
| 18:44 | hjlee | why not 2nd guess? |
| 18:45 | hiredman | let me ask you this, how many keys are between :a and :f? |
| 18:47 | hjlee | that's not related to the problem. |
| 18:48 | pstickne | hiredman: 42, just in case you still care |
| 18:48 | Retonator | maybe stupid but can anyone tell me what a Var is in clojure? |
| 18:49 | cmvkk | check this page, for example: http://clojure.org/vars |
| 18:50 | pstickne | Retonator: think of a member in Java. Only they can behave nicely in multiple thread contexts. |
| 18:50 | hjlee | no counting needed. |
| 18:51 | Retonator | ,(var +) |
| 18:51 | clojurebot | #'clojure.core/+ |
| 18:51 | Retonator | but what does that mean then? |
| 18:51 | Retonator | is plus a var pointing to the + function? |
| 18:53 | Retonator | it is the object itself as i read now |
| 18:55 | cmvkk | the symbol + refers to a Var which refers to the + function, I believe. |
| 18:58 | pstickne | wth, a NPE? :( |
| 18:59 | dreish | nil is a null pointer. |
| 19:04 | pstickne | I was just expecting a more graceful death :( |
| 19:04 | pstickne | (swap! nil ...) ; no good ^^ |
| 19:05 | hiredman | ,(swap! nil identity) |
| 19:06 | clojurebot | java.lang.NullPointerException |
| 19:06 | hiredman | ,@nil |
| 19:06 | clojurebot | java.lang.NullPointerException |
| 19:08 | pstickne | I've just introduced the first side-effect into my program! |
| 19:08 | pstickne | I feel so dirty! :( |
| 19:08 | pstickne | It's just much easier to not have to keep updating bindings on the escape ... |
| 19:11 | cmvkk | I rewrote my program without using anything mutable, and you know what? |
| 19:11 | cmvkk | now it's like 10 times slower. |
| 19:11 | cmvkk | :/ |
| 19:11 | pstickne | cmvkk: :p |
| 19:11 | pstickne | I like controlled mutability. |
| 19:11 | pstickne | although this program will be very slow :p |
| 19:11 | pstickne | I am using fnparse |
| 19:12 | pstickne | And since I don't pre-tokenize it.. |
| 19:12 | pstickne | :p |
| 19:12 | pstickne | oh, well, it's only for a school project |
| 19:31 | Raynes | Well I almost managed to get a person who thinks OOP is the end all and be all of what we do for a living to try Clojure, he saw that Scala had OOP and made a B-Line for the door. |
| 19:32 | p_l | Raynes: I think you might need heavier arguments. Just remember to take it easy on nukes |
| 19:33 | Raynes | p_l: If I were too have went any heavier I would have scared him away. He just thinks that everything Rich said about OOP is "Opinionated and not true" |
| 19:34 | Raynes | Screw him :\ |
| 19:34 | Raynes | He's one of the "How would we SURVIVE WITHOUT OOP. OMG!!1!" kind of people. |
| 19:37 | p_l | heh |
| 19:39 | Raynes | Do a Google search for "hate Clojure". Only a single result. |
| 19:39 | durka42 | ~google "hate clojure" |
| 19:39 | clojurebot | First, out of 1 results is: |
| 19:39 | clojurebot | David R. MacIver � Blog Archive � How do you talk about Scala? |
| 19:39 | clojurebot | http://www.drmaciver.com/2009/02/how-do-you-talk-about-scala/ |
| 19:39 | Raynes | Thats it. |
| 19:39 | p_l | Raynes: is that him? :D |
| 19:39 | Raynes | Nope. |
| 19:40 | Raynes | At least I managed to get him interested in functional programming. Even if he did choose a language that I know he will abuse to the point where the functional programming part of it doesn't even matter. |
| 19:41 | Raynes | I had to be careful what I said when talking too him, if I said one wrong thing about Java it was oh noes the world imploded. |
| 19:42 | hiredman | Chouser and rhickey are neck and neck for the most non-bot pasted urls |
| 19:43 | Raynes | Why do people love Java syntax so much? |
| 19:43 | Raynes | Curly braces are the most useless things I have ever seen in my life. |
| 19:43 | hiredman | I really have no idea |
| 19:43 | Raynes | That's too much useless "Enter-shift-curlybracket" for me. |
| 19:44 | pstickne | Raynes: curly braces aren't useless |
| 19:44 | pstickne | {:foo :bar}, for example, is nice :) |
| 19:44 | p_l | no, the braces are innocent. It's java that's the criminal :P |
| 19:44 | slashus2 | IDE's make it more tolerable with automatic generation of abstract methods that you have to fill in. |
| 19:45 | Raynes | pstickne: But not to denote code blocks. |
| 19:45 | Raynes | slashus2: IDE's shouldn't have too. |
| 19:45 | pstickne | Raynes: I personally like do/end :-) |
| 19:45 | Raynes | p_l: C is the criminal. |
| 19:45 | Raynes | Know what I like? |
| 19:45 | pstickne | A big bowl of ... |
| 19:45 | Raynes | Parentheses and whitespace. That's what I like. |
| 19:46 | slashus2 | Raynes: I know, but programming java without them is more of a pain. |
| 19:46 | Raynes | :D |
| 19:46 | Raynes | slashus2: Programming with Java is a pain anyways. That hurt don't heal. :| |
| 19:47 | slashus2 | I know someone who uses an editor without syntax highlighting to program in java. masochist |
| 19:47 | Raynes | :| |
| 19:48 | p_l | Raynes: C was directed at simplicity and for being autogenerated by more advanced tools |
| 19:49 | p_l | Raynes: It's good language for it's uses |
| 19:49 | hiredman | C? auto-generated? |
| 19:49 | p_l | hiredman: many of the old-fashioned tools generated C code |
| 19:49 | durka42 | Cfront |
| 19:49 | slashus2 | Things like pyrex and ghc can produce C |
| 19:50 | durka42 | ecl? |
| 19:50 | p_l | ECL & Chicken |
| 19:50 | p_l | GCL too |
| 19:50 | p_l | Gambit-C |
| 19:50 | hiredman | ... |
| 19:50 | Chousuke | I don't think C was ever *designed* to be autogenerated... |
| 19:50 | p_l | Yacc :D |
| 19:50 | Chousuke | :P |
| 19:51 | hiredman | I have yet to hear an example that either somehow predated C so C targeted it, or was created at the same time as C and C was just hte output format for it |
| 19:51 | p_l | Chousuke: It was designed with syntax that was easily understandable for the time, with assumption that for more complex functionality you'd write a compiler for a better language that used C as portable assembly |
| 19:51 | p_l | hiredman: yacc & lex |
| 19:52 | p_l | hiredman: some other tools from V7 era |
| 19:52 | Chousuke | hmm. |
| 19:52 | Raynes | p_l: No, I mean it's the criminal for staring the whole curly braces trend. |
| 19:52 | p_l | Raynes: it was better than begin ... end |
| 19:52 | slashus2 | algol |
| 19:52 | Raynes | Pascal should die. |
| 19:53 | p_l | and few other langs AFAIK supported either curly braces or begin ... end |
| 19:53 | p_l | Raynes: Wirth says the same. Nobody listens to him |
| 19:53 | Raynes | From #Scala [18:49] <xocoatl> btw. the first language i mastered was pascal... and then delphi... from that perspective java and scala code was like all { commented out } ;-) |
| 19:54 | Raynes | Irrelevant but still funny. |
| 19:54 | Raynes | Anyways, I'll be back later. |
| 19:54 | slashus2 | algol 68 had curly braces |
| 19:55 | slashus2 | So that predated C a little. |
| 19:57 | slashus2 | Raynes: Blame algol 68, not C :-P |
| 19:58 | slashus2 | wait |
| 19:58 | slashus2 | I think I am incorrect. |
| 19:58 | Raynes | I agree. |
| 19:58 | Raynes | :) |
| 20:02 | p_l | slashus2: what about Algol 60? :) |
| 20:02 | p_l | It was a big inspiration :) |
| 20:03 | p_l | also, I dunno, but what about B and BCPL? |
| 20:03 | p_l | (and CPL) |
| 20:14 | cconstantine | Ada still uses begin/end |
| 20:18 | cconstantine | I have a set of lists "( ( 1 2 3 ...) (2 4 6 ...) (3 6 9 ...) ) and I want to keep them sorted by the collection's ffirst element. I'll only ever be doing one insert/delete at a time, is there anyway to keep the collection of sequences sorted on insert/delete instead of doing a conj and sorting the entire thing? |
| 20:19 | cconstantine | and the delete will always be the first sequence |
| 20:26 | Raynes | Oh shit! |
| 20:26 | Raynes | Lambda-the-ultimate is down |
| 20:28 | cconstantine | Oh no! what does it do? |
| 21:23 | p_l | ccmtaylor: Ada is the weirdo in that group ;-) |
| 21:33 | hjlee | hiredman: are you there? |
| 22:32 | slashus2 | If I was slurping code from a file, what is the best way to turn a string into something that I could use with eval? |
| 22:36 | Raynes | http://en.wikipedia.org/wiki/Falcon_(programming_language) Anyone ever used this? I bet it's a mess. Too many paradigms. |
| 22:41 | pstickne | Raynes: and Clojure isn't? ;-) |
| 22:41 | p_l | Raynes: well, CL feels alright... |
| 22:41 | Raynes | No, I don't think you get it. Falcon has an /obscene/ amount of paradigms. |
| 22:41 | pstickne | Sometimes I miss when programming languages are restricted to 7-bit ASCII input... |
| 22:42 | Raynes | It tries to do everything. |
| 22:42 | p_l | Raynes: and CL has (1+ currently-known-paradigms) |
| 22:43 | Raynes | Procedural, Object Oriented, Prototype Oriented, Functional, Tabular and Message Oriented. |
| 22:43 | Raynes | "Pick the ingredients you prefer and let the code to follow your inspiration." |
| 22:44 | brweber2 | hey all, is anyone around familiar with inlining in hotspot? |
| 22:44 | Raynes | Oh boy they have an IRC channel |
| 22:44 | p_l | Raynes: don't troll too much |
| 22:44 | Raynes | There is no one there too troll. :( |
| 22:44 | Raynes | Only seven people. |
| 22:48 | Raynes | I need to properly learn Scala. |
| 22:50 | pstickne | Falcon looks ... interesting ... |
| 22:50 | pstickne | Raynes: yes you should ;) |
| 22:51 | Raynes | Learning different languages in quick succession normally bothers me, but I doubt it would matter in this case, I couldn't forget Clojure if I tried. |
| 22:51 | Raynes | o_o |
| 22:53 | p_l | Raynes: don't succumb to the Boring Side! |
| 22:53 | Raynes | Correction: I need to have more OOP experience so that when I put OOP down, I can do it with facts. |
| 22:54 | pstickne | OOP is a silly term. |
| 22:54 | pstickne | I like to argue that Haskell is "OO" because it supports polymorphic behavior of abstract data types :p |
| 22:55 | pstickne | (most people say I'm wrong though) |
| 22:55 | pstickne | (I just think I have a liberal definition of OO :-) |
| 22:55 | Raynes | That would spark wildfires in #Haskell |
| 22:55 | pstickne | Which is silly... |
| 22:56 | pstickne | And then OOP can be done in languages that aren't "OO" |
| 22:56 | pstickne | (e.g. you can write OOP in C, which is not OO) |
| 22:57 | p_l | which can and has been done |
| 22:57 | pstickne | Raynes: oh noo! |
| 22:57 | pstickne | Raynes: my experience with NB+Scala[+Java] = the lose |
| 22:57 | Raynes | pstickne: They fixed that in the last release. |
| 22:58 | pstickne | whew. |
| 22:58 | pstickne | Raynes: does it still have to filter through the ant-task? |
| 22:58 | pstickne | (the Eclipse builders are so much nicer -- when they work) |
| 22:58 | Raynes | I don't guess... It works fine for me. |
| 22:58 | pstickne | Raynes: cool :) |
| 22:58 | pstickne | I guess either Eclipse or NB is like Ford or Chevy :) |
| 22:59 | Raynes | Programming in Scala is such a lonnnnng boooook. |
| 22:59 | pstickne | Raynes: with such a ... interesting unofficial acronym! :p |
| 22:59 | p_l | I consider NB to be like a good sericable car |
| 22:59 | p_l | *servicable |
| 23:00 | Raynes | Netbeans is like a car that is about to run out of gas. |
| 23:00 | vagif | Hello, any emacs+slime users here ? |
| 23:00 | Raynes | Chug Chug vrooooom Chug. |
| 23:00 | p_l | Raynes: And despite that it's still going to go for 100 km :P |
| 23:00 | pstickne | Raynes: did you put WATER in again? |
| 23:00 | Raynes | :p |
| 23:01 | pstickne | p_l: until 50 km out of town it spontaneously explodes :( |
| 23:01 | p_l | Eclipse on the other hand is like this shiny popular car that guzzles 50l/100km has ton of weirdly named parts, expensive service and dies randomly |
| 23:01 | vagif | i'm running emacs+slime and is able to slime-connect to clojure. But when i move cursor to any function name in the source code, i see Evaluation Aborted instead of function definition |
| 23:01 | pstickne | p_l: at least it comes with free towing service ;-) |
| 23:02 | vagif | is this feature implemented / |
| 23:02 | vagif | ? |
| 23:02 | slashus2 | Anyone have any idea how to turn a string into something I could use with eval? |
| 23:02 | pstickne | (disclaimer: not guaranteed to actually tow you back to town) |
| 23:02 | p_l | pstickne: last time I checked, the towing service put you on a flight to cambodia |
| 23:02 | p_l | pstickne: packaged as mackarel |
| 23:03 | p_l | and they wanted to get paid for that |
| 23:03 | pstickne | slashus2: I think print-str or similar might do it |
| 23:03 | pstickne | slashus2: err, prn. |
| 23:04 | slashus2 | pstickne: I am trying to slurp code from a file and evaluate it. |
| 23:04 | pstickne | slashus2: then you already have it as a string to eval...? |
| 23:04 | slashus2 | eval uses code |
| 23:04 | slashus2 | a form |
| 23:04 | slashus2 | I think I almost have it working. Just namespace problems. |
| 23:05 | pstickne | (eval (pr-str "something something")) |
| 23:05 | vagif | i'm running emacs+slime and is able to slime-connect to clojure. But when i move cursor to any function name in the source code, i see Evaluation Aborted instead of function definition. Is this feature implemented ? |
| 23:06 | slashus2 | pstickne: I don't want to print a string and return it. |
| 23:06 | pstickne | slashus2: that doesn't actually print anything though |
| 23:08 | slashus2 | using |
| 23:09 | slashus2 | (map eval (map (comp symbol slurp str) (filter #(.endsWith (.getName %) ".clj") (file-seq (java.io.File. "plugins/"))))) I am getting class not found on a lot of the things. Even though I have the plugins/ in my classpath and the base src directory in my classpath. |
| 23:36 | Raynes | "I have a hard time believing that Clojure could be used *exclusively* to create a serious, full-scale application. Don't get me wrong, Rick, your presentations are great, but I honestly don't think that I have the sheer mental ability required to keep track of a dynamic system of truely enterprise magnitude. That's where Scala comes in..." |
| 23:37 | Raynes | "Rick" You can tell he's /really/ looked into Clojure eh. |
| 23:40 | slashus2 | Something is lacking in his design if he can't keep track of a dynamic system. |
| 23:40 | pstickne | I think that static typing is great. |
| 23:41 | pstickne | (And yes, it is because I have a limited mental capacity.) |
| 23:44 | Raynes | I, for some reason can't bring myself to open up this book and read anything about Scala. I guess it will have to wait. I'm so tied up in Clojure that it would take a good Scala beating to loosen the ropes. |
| 23:46 | Raynes | pstickne: Tell me something awesome about Scala that I don't know. |
| 23:48 | pstickne | Raynes: you likely now it. The best thing about Scala is that it /tries/ be a commercially-accepted FP/OO hybrid (some could argue this is the same for F#). |
| 23:48 | pstickne | *know |
| 23:48 | pstickne | Raynes: so it has a number of ... less than ideal designs in it, many to work with Java and/or "fit Java programmers" |
| 23:49 | pstickne | Raynes: well, let me put it this way ... if you have a choice between Java and Scala ... ;-) |
| 23:50 | Raynes | I thought using it from Java was hell? Last time I checked the data structures were incompatible with Java. |
| 23:50 | pstickne | Raynes: they mostly are, but there are wrappers (and support is getting better). I avoid this by only using Java in Scala and not the other way around. |
| 23:50 | pstickne | (e.g. how do you call Vector.+ in Java?) |
| 23:51 | Raynes | :o |
| 23:52 | pstickne | Raynes: the thing I mist most coming to clojure is lack of static types (that are inferred) |
| 23:52 | pstickne | (Granted, inference isn't great in Scala, but I'm also coming a project in SML ... yet to try Haskell) |
| 23:52 | pstickne | *miss |
| 23:52 | Raynes | pstickne: Scala intrigues me. |
| 23:53 | slashus2 | pstickne: Type hints don't do it for you? |
| 23:53 | pstickne | slashus2: I don't even know what those are :-) |
| 23:53 | Raynes | But Clojure has mah heart. |
| 23:53 | Raynes | pstickne: (defn whatever [#^String x] (println x)) |
| 23:53 | pstickne | It's an interesting language. |
| 23:54 | pstickne | (whatever 10) :-/ |
| 23:54 | slashus2 | pstickne: You can give type hints while initializing a function to speed up things a little, or make sure you are accepting the right types. |
| 23:55 | slashus2 | pstickne: That works because println takes integers as well as strings |
| 23:55 | pstickne | (defn whatever [#^String x] (println (inc x))) (whatever "x") ;-( |
| 23:56 | slashus2 | It doesn't check at compile time :-) |
| 23:56 | pstickne | that's the part I miss :p |
| 23:56 | Raynes | Runtime errors <3 |
| 23:57 | p_l | hmmm.... is there java for MVS? It might be interesting to run clojure apps read from EBCDIC card images... :P |