2009-08-04
| 00:00 | mebaran151 | so that I can get the first n intersections per se |
| 00:00 | hiredman | I imagine you migt be able to build some kind of custom lazy-seq creater that calls filter using the previous set to filter the current set |
| 00:01 | hiredman | are these sorted-sets? |
| 00:02 | mebaran151 | I could use a sorted-set easily |
| 00:03 | mebaran151 | but I shouldn't think sorted-set would matter |
| 00:03 | hiredman | ,(first (set 4 5 6)) |
| 00:03 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args passed to: core$set |
| 00:03 | hiredman | ,(first (set [4 5 6])) |
| 00:03 | clojurebot | 4 |
| 00:04 | hiredman | ,(first (set [5 4 6])) |
| 00:04 | clojurebot | 4 |
| 00:04 | hiredman | hrm |
| 00:05 | hiredman | ok |
| 00:05 | hiredman | hrm |
| 00:06 | hiredman | I don't know |
| 00:07 | hiredman | ok |
| 00:08 | hiredman | ugh |
| 00:08 | hiredman | it is going to be kind of like reduce |
| 00:08 | hiredman | or really reductions |
| 00:08 | hiredman | ,(doc reductions) |
| 00:08 | clojurebot | "([f coll] [f init coll]); Returns a lazy seq of the intermediate values of the reduction (as per reduce) of coll by f, starting with init." |
| 00:14 | hiredman | lisppaste8: url? |
| 00:14 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 00:15 | lisppaste8 | hiredman pasted "f" at http://paste.lisp.org/display/84715 |
| 00:15 | hiredman | maybe something like that |
| 00:15 | hiredman | I haven't tested it |
| 00:16 | mebaran151 | cool |
| 00:16 | hiredman | of course I haven't, or else that recur wouldn't be there |
| 00:16 | mebaran151 | I think reductions should do it |
| 00:16 | hiredman | the recur should be replaced with a call to f |
| 00:19 | mebaran151 | reductions isn't in the standard library ? |
| 00:20 | JAS415 | so, i'm using apache httpclient 4.0 |
| 00:21 | JAS415 | but it seems like it sucks compared to commons httpclient (3.0) |
| 00:21 | JAS415 | is this true? |
| 00:21 | mebaran151 | JAS415, check out xlightweb's htttp client |
| 00:21 | mebaran151 | it's much better, and has a really easy to use async mode |
| 00:21 | JAS415 | well the thing is that i've got most of the code working |
| 00:22 | JAS415 | i can use oauth authentication and grab googlecharts |
| 00:22 | JAS415 | problem is httpclient 4.0 wants to encode all my urls without asking |
| 00:22 | JAS415 | which is a violation of my trust... :-P |
| 00:22 | JAS415 | (and screws up my charts...) |
| 00:23 | JAS415 | but i will check out xlightweb certainly |
| 00:27 | mebaran151 | I started with apacheclient and got sick of it |
| 00:28 | mebaran151 | besides xlightweb cooperates with the thread model much better |
| 00:28 | JAS415 | i'm not suprised |
| 00:29 | JAS415 | apacheclient is kind of like an unruly 2 year old :-P |
| 00:29 | mebaran151 | essentially I want to put a filter in front of lazy seq |
| 00:29 | mebaran151 | xlightweb is brought to you by people who are considered jetty's competition |
| 00:29 | mebaran151 | that's Serious Business |
| 00:29 | hiredman | mebaran151: it's in contrib |
| 00:29 | hiredman | ,(doc reductions) |
| 00:29 | clojurebot | "([f coll] [f init coll]); Returns a lazy seq of the intermediate values of the reduction (as per reduce) of coll by f, starting with init." |
| 00:29 | hiredman | huh |
| 00:29 | hiredman | oh |
| 00:30 | mebaran151 | reductions doesn't quite do what I want |
| 00:30 | hiredman | yeah |
| 00:30 | mebaran151 | because it's still giving me a list of lists |
| 00:30 | JAS415 | what do you want to do exactly? |
| 00:30 | hiredman | that's why I said like reductions |
| 00:30 | JAS415 | you want to filter a lazy seq (wasn't in channel) |
| 00:30 | mebaran151 | #{0} #{0 6} #{0 6} #{0 6 12} #{0 6 12 18} |
| 00:30 | mebaran151 | that's a list of sets |
| 00:31 | mebaran151 | I want to lazy union them |
| 00:31 | mebaran151 | so that if say I wrote (take 5 (magical laziness)) |
| 00:32 | JAS415 | you'd get union of the first 5 |
| 00:32 | mebaran151 | yeah |
| 00:32 | mebaran151 | I want that union to look like an infinte stream |
| 00:32 | mebaran151 | the internal algo should visit each iterative set until it gets enough to satisfy the take |
| 00:33 | JAS415 | like reduce only with a delay |
| 00:33 | hiredman | I don't think that is possible |
| 00:34 | JAS415 | i feel like you could do it with a hidden atom |
| 00:34 | mebaran151 | yeah |
| 00:34 | mebaran151 | a magical hidden atom |
| 00:34 | JAS415 | use the atom like a closure and make it persistent across |
| 00:34 | mebaran151 | but that seems a little bit nasty |
| 00:34 | JAS415 | only problem is that you can access it in any order and get the same thing |
| 00:34 | mebaran151 | also there might be a bunch of these in fligt |
| 00:34 | mebaran151 | it would be a pity i I had to write my own take |
| 00:35 | JAS415 | yeah magic atom is a bit ugly |
| 00:35 | mebaran151 | and then tell my comrades they couldn't use all the coolness of the lazines fo ojure |
| 00:36 | mebaran151 | like it seems like a pretty simple lazy function on some level |
| 00:36 | JAS415 | the description is simple and the actual problem is hard |
| 00:36 | hiredman | if you think so, then write it |
| 00:36 | mebaran151 | keeping hitting successive sets until you get enough to satisfy the take |
| 00:36 | mebaran151 | heh, I can't figure out a way! |
| 00:37 | mebaran151 | (then again, I've only been wrapping my bdb library in laziness for about a day, so I don't know all the uber magic) |
| 00:37 | mebaran151 | is there a concat-with-filter |
| 00:37 | JAS415 | eh |
| 00:37 | JAS415 | i'm not sure there is a win from making it lazy though |
| 00:38 | JAS415 | well there must be i guess |
| 00:38 | mebaran151 | I have to make it lazy |
| 00:38 | mebaran151 | there are potentially an infinite number of things |
| 00:38 | JAS415 | ooh |
| 00:38 | hiredman | ok |
| 00:38 | hiredman | that is not going to work |
| 00:38 | mebaran151 | those sets iterate forever |
| 00:38 | JAS415 | but if you are doing like |
| 00:39 | hiredman | mebaran151: how do you know if 0 is in every set, if there is in infinite number of them to check? |
| 00:39 | JAS415 | (reduce union (take n (listofsets))) |
| 00:39 | arohner | mebaran151: which is infinite? the number of items in a set, or the number of sets? |
| 00:39 | hiredman | arohner: no infinite sets |
| 00:40 | JAS415 | infinite sets are cool |
| 00:40 | mebaran151 | the number of sets |
| 00:40 | mebaran151 | an infinite set would be pretty weird |
| 00:40 | hiredman | mebaran151: yeah, that is just not going to work |
| 00:40 | mebaran151 | you don't need to |
| 00:40 | JAS415 | no there must be a way to |
| 00:40 | hiredman | clojurebot: ruleset? |
| 00:40 | clojurebot | Titim gan éirí ort. |
| 00:40 | mebaran151 | thesesets are a little specally |
| 00:40 | mebaran151 | in that they'rebuilt from unions of the prior sets |
| 00:41 | mebaran151 | so yeah, each is a superset of the prior set |
| 00:41 | mebaran151 | they represent pulling more and more data from the databasetab |
| 00:41 | mebaran151 | so you can be silly and check only the first n sets |
| 00:41 | arohner | leaving clojure aside, I don't see how you determine 5 items out of the unions of all these sets lazily |
| 00:41 | mebaran151 | until you get enough matches |
| 00:42 | hiredman | http://paste.lisp.org/display/80355 |
| 00:42 | JAS415 | yeah |
| 00:42 | mebaran151 | arohner, I would like it if I could just slipstreem it |
| 00:42 | JAS415 | i used that to make my clojure inline + and * to whatever arity |
| 00:42 | mebaran151 | so that underneath it's a bunch of iterative sets |
| 00:43 | hiredman | the problem with rulesets is you can't generate seqs from them, and all the function in clojure.set turn sets into seqs |
| 00:43 | mebaran151 | I don't think I'd even need that |
| 00:43 | JAS415 | yeah i guess they don't have an order do they |
| 00:43 | mebaran151 | maybe I'm approaching the problem wrong |
| 00:44 | JAS415 | probably :-P |
| 00:44 | mebaran151 | I have a series of n cursors |
| 00:44 | mebaran151 | that each point to a bunch of k v pairs right |
| 00:45 | mebaran151 | I want to grab the first v values that have a key pointing to them |
| 00:45 | mebaran151 | so k1 v1 k2 v1 k3 v1 would return k1 and k2 |
| 00:46 | mebaran151 | it's essentially a natural join |
| 00:46 | JAS415 | (let [seq infinite-lazy-seq-of-sets] |
| 00:46 | JAS415 | (repeatedly (memoize #(take %1 seq)))) |
| 00:46 | JAS415 | ? |
| 00:46 | JAS415 | oh |
| 00:46 | mebaran151 | I have something like that |
| 00:46 | JAS415 | throw in a reduce union in there |
| 00:46 | mebaran151 | I do! |
| 00:46 | mebaran151 | that's how you get the nested sets |
| 00:47 | mebaran151 | you can't reduce union the whole thing, because I just want the cursors to scan up the number of results that are requested |
| 00:47 | hiredman | this is from a database? |
| 00:47 | mebaran151 | berkeleydb |
| 00:47 | mebaran151 | it doesn't provide me with no fancy sql's |
| 00:47 | hiredman | lazy access to db seems like a bad idea |
| 00:47 | JAS415 | so.. |
| 00:47 | mebaran151 | oh |
| 00:47 | mebaran151 | I make sure to close my cursors and everything |
| 00:48 | mebaran151 | I have a set of functions that return views, which are essentially lazy list representations of a b tree |
| 00:48 | lisppaste8 | Chouser pasted "lazy-union" at http://paste.lisp.org/display/84716 |
| 00:49 | JAS415 | hahaha sweet |
| 00:49 | mebaran151 | coolio |
| 00:49 | Chouser | I imagine that can be refined a bit |
| 00:49 | hiredman | Chouser: and it works on an infinite sequence of sets? |
| 00:49 | Chouser | but I should be sleeping. |
| 00:49 | Chouser | hiredman: don't see why not |
| 00:50 | mebaran151 | gentleman we have a winner |
| 00:50 | Chouser | it hangs onto a real set of the elements seen so far, so that'll grow indefinitely |
| 00:50 | hiredman | Chouser: because how could it check to see if a value is a member of an infinite number of sets |
| 00:50 | mebaran151 | you don't have to, because these are just spiraling unions anyway |
| 00:50 | JAS415 | oh man, that's philosophical |
| 00:50 | Chouser | if the first seq is infinite, it'll never look at the others |
| 00:50 | mebaran151 | if it's in the first set, I'm happy |
| 00:50 | mebaran151 | if it's the second set I'm happy |
| 00:51 | JAS415 | oh man |
| 00:51 | mebaran151 | if it's in the third set I'm happy |
| 00:51 | JAS415 | just don't write a loop depending on it being in the set |
| 00:51 | mebaran151 | these sets aren't arbitrary |
| 00:51 | mebaran151 | they're based off each other |
| 00:51 | mebaran151 | this was perfect! |
| 00:51 | hiredman | well then it's hardly a general lazy-union |
| 00:51 | mebaran151 | that function was definitely cool beans |
| 00:52 | JAS415 | gonna be hard to do generally without holding on to a ref |
| 00:52 | mebaran151 | in the end the iterations end, because you fall off the end of the tree |
| 00:52 | mebaran151 | so philosophically I'm safe too |
| 00:53 | mebaran151 | each of those sets contain a result set which is predetermined to be a potential solution to the criteria |
| 00:53 | mebaran151 | thanks Chouser! |
| 00:53 | Chouser | yw |
| 00:53 | Chouser | I thought I'd need a loop, that's why I used lazy-seq |
| 00:54 | Chouser | but since I did the skipping with drop-while, I bet this could be written using iterate instead. |
| 00:54 | mebaran151 | heh |
| 00:54 | Chouser | however, I must refrain. Perhaps as an exercise for the reader. |
| 00:54 | mebaran151 | iterate is a very cool function |
| 00:54 | Chouser | I should not be awake, I just couldn't resist when someone uses words like "impossible". :-) |
| 00:55 | mebaran151 | (its how I build my result sets in the first place) |
| 00:55 | Chouser | g'night! |
| 00:55 | mebaran151 | ha |
| 00:55 | hiredman | call it lazy union if you want |
| 00:56 | mebaran151 | I understand it's not fully general |
| 00:56 | JAS415 | doing impossible things is funny |
| 00:57 | mebaran151 | but I essentially just wanted a stream-union |
| 00:57 | mebaran151 | sort of thing |
| 00:58 | mebaran151 | I don't quite see why it isn't rigorous: if I have an infinite list of sets, an item in the union of the first two will by definition be in the union of the rest |
| 00:59 | mebaran151 | so if my constraint is to want at least 5 items, and the operation is actually union, I think I'm safe, even if the sets were completely arbitrary |
| 00:59 | mebaran151 | now a lazy intersection would make much less sene |
| 00:59 | mebaran151 | *sense |
| 01:00 | hiredman | you're right, union is associative |
| 01:00 | tomoj | I had a somewhat similar problem that involved a strange solution |
| 01:00 | tomoj | it seems like you'll be generating elements of the sequence faster than they are asked for |
| 01:01 | mebaran151 | most likely |
| 01:01 | mebaran151 | the prefetch is not a problem though |
| 01:01 | mebaran151 | in my code you specify a chunk size of records to fetch at a time, depending on how you plan to use them |
| 01:02 | JAS415 | perhaps i should be blaming java for my troubles |
| 01:02 | mebaran151 | hah my logic course has finally paid off |
| 01:02 | tomoj | prefetch was problematic for me |
| 01:02 | tomoj | but I am a clojure noob |
| 01:02 | mebaran151 | as am I |
| 01:03 | mebaran151 | the other nice thing about clojure lists is there are no mutable operations |
| 01:03 | tomoj | I ended up having to do this: https://gist.github.com/4317ccd3662750ec3876 |
| 01:03 | JAS415 | i kind of like being a noob |
| 01:03 | mebaran151 | so none of my coworkers will be fooled into thinking they can WRITE to the database this way |
| 01:03 | tomoj | which is very opaque |
| 01:03 | mebaran151 | not terribly |
| 01:04 | mebaran151 | I think I follow it |
| 01:04 | mebaran151 | heh, we could have an obfuscated clojure contest |
| 01:04 | mebaran151 | who can write macros that do the most evil |
| 01:04 | JAS415 | http://paste.lisp.org/display/84717 |
| 01:04 | JAS415 | i've already written an evil macro |
| 01:04 | JAS415 | so this means that it won't parse my string into a uri |
| 01:04 | JAS415 | although it will parse it as a url |
| 01:04 | JAS415 | string is |
| 01:05 | tomoj | the problem was to do this iteration "10" "101" "10110" "101101011" (i.e. you take the previous string, concatenate it with itself, and chop off the last character), but return those bits in a lazy sequence one at a time |
| 01:05 | hiredman | ,(pl reverse $ (↕reduce range $ 10 () λxy (↕conj inc $ y x))) |
| 01:05 | clojurebot | (1 2 3 4 5 6 7 8 9 10) |
| 01:05 | JAS415 | string is in the error |
| 01:05 | tomoj | so I had to prefetch a bunch of bits and return them one at a time. but the naive implementation did an infinite loop |
| 01:05 | mebaran151 | intersection is commutative right? |
| 01:05 | tomoj | yeah |
| 01:05 | JAS415 | hum |
| 01:05 | mebaran151 | yeah it has to be |
| 01:06 | tomoj | "and" is commutative |
| 01:06 | mebaran151 | that's not always the best test |
| 01:07 | hiredman | ,(pl (↕map (replicate 3 (↕apply vector $ (↕map range $ 10 inc · inc · inc) call · ⌽* $ 10 · call · (⌽+ -2) map)) shuffle)) |
| 01:07 | clojurebot | ((20 100 60 10 80 50 70 90 30 40) (30 100 40 20 90 60 80 10 50 70) (70 40 20 50 30 90 80 10 60 100)) |
| 01:07 | tomoj | mebaran151: not sure what you mean |
| 01:07 | tomoj | intersection is a thin wrapper around "and" |
| 01:07 | mebaran151 | sometimes grammar rules can trick you |
| 01:07 | mebaran151 | oh |
| 01:07 | mebaran151 | yeah, logical and certainly |
| 01:08 | tomoj | ah, yeah |
| 01:08 | tomoj | english is weird :) |
| 01:09 | JAS415 | i can't believe i cant use httprequest without going through URI |
| 01:09 | JAS415 | that's lame |
| 01:09 | mebaran151 | welcome to Java Land |
| 01:10 | mebaran151 | as I said yesterday, for BerkeleyDB, I've built so many factories I feel like the Soviet Union |
| 01:10 | mebaran151 | for something as simple as reading a key and writing a key in an ordered Btree, you shouldn't need configuration factory objects |
| 01:11 | JAS415 | well it just makes it impossible to use that method with certain things |
| 01:11 | tomoj | JAS415: what http client are you using? |
| 01:11 | JAS415 | as much as i really like clojure i hate java |
| 01:11 | tomoj | clojure-http-client can take strings |
| 01:11 | JAS415 | i'm using apache httpclient |
| 01:11 | JAS415 | it takes strings but it mangles and converts them |
| 01:11 | mebaran151 | clojure-http-client is not assynchronous which is a bummer |
| 01:11 | JAS415 | other things are a no-go as i'm also using oauth signpost |
| 01:12 | mebaran151 | I'd submit a patch, but I only got async http to work with xlightweb, which for a Java library was actually relatively sane |
| 01:12 | mebaran151 | java should really come with async http built in |
| 01:12 | JAS415 | i thought i'd be able to write a library to write interfaces to restful apis, but googlecharts is giving me trouble at the moment |
| 01:12 | mebaran151 | wasting threads is so 2002 |
| 01:12 | JAS415 | because they use commas |
| 01:13 | mebaran151 | have you tried it with plain ol' Java.net |
| 01:13 | JAS415 | so i'm wasting time trying to figure out away around the arbitrary path that httprequest takes through URI encoding |
| 01:13 | mebaran151 | you can do almost anything in Java.net |
| 01:13 | JAS415 | I already did it with java.net |
| 01:13 | mebaran151 | oh, was there failure? |
| 01:13 | JAS415 | no it worked perfectly |
| 01:13 | mebaran151 | so, why are you binding Apache Commons? |
| 01:13 | JAS415 | then i reimplemented it without .net so that i could use oauth properly |
| 01:13 | JAS415 | not commons |
| 01:14 | JAS415 | 4.0 httpclient |
| 01:14 | mebaran151 | .net won't work with oauth? |
| 01:14 | JAS415 | i think they are different |
| 01:14 | tomoj | mebaran151: what does "async http" mean? the function that does the request returns before the http request finishes? |
| 01:14 | JAS415 | i was having trouble |
| 01:14 | JAS415 | because of twitter actually |
| 01:14 | JAS415 | haha |
| 01:14 | mebaran151 | tomoj, instead of the thread stalling, you just give it a success callback |
| 01:14 | tomoj | ah, I see |
| 01:14 | mebaran151 | so the thread can continue to do other work |
| 01:14 | JAS415 | oauth only works for twitter auth if you use a certain authorization not supported by .net |
| 01:14 | tomoj | luckily I don't need that :) |
| 01:14 | mebaran151 | later on, some other manager object will pass your callback the data |
| 01:15 | mebaran151 | like ajax |
| 01:15 | JAS415 | pretty much this project started off very successfully then managed to cascade into multitudes of incompatibilities |
| 01:16 | JAS415 | although i did use the same library to interface with eve-online and twitter, which was fairly neat |
| 01:31 | mebaran151 | neato |
| 01:31 | mebaran151 | I do something actually pretty similar, but I script the whole thing in Rhino |
| 01:31 | mebaran151 | and run the rhino using clojure |
| 01:31 | mebaran151 | getting Rhino and clojure to talk to one another was a total pain |
| 01:31 | mebaran151 | Rhino liked to return perverse objects that were essentially binary blobs |
| 01:40 | mebaran151 | man lazy sequences are cool |
| 02:00 | Jomyoot | The .clj file can be compiled? |
| 02:00 | Jomyoot | and will compiling help prevent ninjas from stealing my source code? |
| 02:00 | Carkh | clojurebot: compilation? |
| 02:00 | clojurebot | compilation is see compile |
| 02:01 | Carkh | clojurebot: compile? |
| 02:01 | clojurebot | the unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation |
| 02:01 | Carkh | that's bytecode compilation, that's always decompilable |
| 02:02 | Jomyoot | to what? clojure code? |
| 02:02 | Jomyoot | or java code |
| 02:02 | Carkh | java code |
| 02:02 | Carkh | quite unreadable though |
| 02:03 | mebaran151 | it makes a class for every fn and other such construction |
| 02:03 | mebaran151 | (in java you've got classes and classes) |
| 02:03 | mebaran151 | Jomyoot, |
| 02:03 | mebaran151 | Java itself can be fairly easily precompiled |
| 02:03 | mebaran151 | *decompiled |
| 02:05 | Jomyoot | yes but wouldn't we get unreadable java code |
| 02:05 | Carkh | give it a try |
| 02:05 | hiredman | it would be odd looking, but I think readable |
| 02:06 | hiredman | http://georgejahad.com/clojure/clojureDecompiled.html |
| 02:06 | mebaran151 | eh, I mean if the guy is going to go to all the work to decompile your code, I bet he can work through the clojure source alright |
| 02:06 | JAS415 | unreadable java code, redundant! :-P |
| 02:06 | Carkh | lots of indirections, and i guess an object for every closure |
| 02:06 | JAS415 | i fixed my problem |
| 02:07 | Jomyoot | hader to read than decompiled java |
| 02:08 | Jomyoot | what is your favorite programming fonts? |
| 02:08 | hiredman | dejavu sans mono has the best unicode coverage by far |
| 02:09 | mebaran151 | Jomyoot, any hacker who's gonna go to the lengths to decompile your java and work through is probably willing to spend a little extra time mapping it back |
| 02:09 | hiredman | consolas is very nice, but I like having all the glyphs |
| 02:09 | mebaran151 | I like Monaco or Monospaced at 13 |
| 02:09 | mebaran151 | Inconsolata is nice too |
| 02:09 | mebaran151 | and free as in freedom! |
| 02:10 | hiredman | the Droid fonts from android have a nice monospaced font |
| 02:10 | hiredman | but again, dejavu sans mono just has more glyphs |
| 02:11 | mebaran151 | I tried Droid, not quite as elegant as Inconsolata |
| 02:13 | hiredman | λ · → ↑ א₀ ♥ ¡ ¿ ‽ ؟ əə |
| 02:15 | JAS415 | why are people decompiling clojure? |
| 02:15 | hiredman | to get a better understanding |
| 02:16 | JAS415 | i just read the source... |
| 02:16 | hiredman | *shrug* |
| 02:17 | JAS415 | seems silly to go to all the trouble if you can just download a copy of the java :-P |
| 02:17 | hiredman | it's interesting to see what the class a function compiles to looks like |
| 02:17 | mebaran151 | it's cool to see how the functions translate out |
| 02:18 | mebaran151 | hiredman, are extra chars really worth more |
| 02:18 | mebaran151 | a friend of mine has been campaigning for them |
| 02:18 | hiredman | Yes |
| 02:18 | mebaran151 | but it seems so nasty to get them to work properly everywhere |
| 02:18 | hiredman | maybe |
| 02:18 | JAS415 | how are you going to type them? |
| 02:18 | hiredman | I don't remember |
| 02:18 | hiredman | JAS415: depends |
| 02:18 | mebaran151 | he's a smart guy: I think the extra char disease in an artifact of the Comp Sci PhD process... |
| 02:19 | JAS415 | i would be more worried about that |
| 02:19 | mebaran151 | *is an |
| 02:19 | JAS415 | i remember using alt and keypad or something |
| 02:19 | mebaran151 | you can map your keyboard |
| 02:19 | hiredman | you can do that |
| 02:19 | mebaran151 | and then confuse your friends! |
| 02:19 | JAS415 | impress women? |
| 02:19 | mebaran151 | on his keyboard, he remapped the parens to ; and ' |
| 02:19 | hiredman | for irssi I have it setup to auto replace somethings with other things lambda => λ |
| 02:19 | mebaran151 | and did a bunch of other things |
| 02:20 | hiredman | ¿ => ¿ |
| 02:20 | hiredman | er |
| 02:20 | hiredman | .? => ¿ |
| 02:20 | mebaran151 | /\ wasn't good enough :P |
| 02:21 | JAS415 | i haven't yet met a female impressed by macro writing ability |
| 02:21 | JAS415 | even my current girlfriend just laughs at me |
| 02:21 | hiredman | ,(pl (inc · inc · inc 1)) |
| 02:21 | clojurebot | 4 |
| 02:21 | mebaran151 | make a macro that makes bunny pictures |
| 02:22 | mebaran151 | everybody loves bunny pictures |
| 02:23 | JAS415 | that's true |
| 02:23 | JAS415 | i do like bunnies |
| 02:23 | JAS415 | sound logic |
| 02:42 | mebaran151 | I had a hard enough time trying to explain to an actionscript guy on my team why infinite lists were just so cool |
| 02:43 | mebaran151 | when I was doing Ruby, I always thought the Lisp people's were exaggerating the coolness of macros: I was naive and wrong |
| 02:45 | mebaran151 | the coolness of macros can only be appreciated by those who have witnessed their power firsthanded |
| 02:54 | tomoj | mebaran151: YES |
| 02:54 | tomoj | I am the only one of the group of CS kids I know who appreciates lisp |
| 02:54 | tomoj | well, only rubyist too, but.. |
| 02:59 | mebaran151 | we needz moar sp33d!!!111 |
| 02:59 | Raynes | MOAR! |
| 03:02 | mebaran151 | I always thought speed arguments were specious, because the same speed maniacs never rewrote their really tight loops in inline assembly or used all of SSE10 or what not |
| 03:44 | Fossi | is there a quick way to get the negative of a number or is it (- 0 num)? |
| 03:45 | _mst | just (- num) will do the job |
| 03:46 | Fossi | ah, right |
| 04:20 | LauJensen | Top of the morning gents |
| 04:27 | mebaran151 | does or short circuit? |
| 04:30 | tomoj | mebaran151: yup |
| 04:30 | tomoj | I discovered that from (doc or) |
| 04:31 | mebaran151 | ha, but it's easier to ask on IRC! |
| 04:31 | Fossi | (or (do (print "foo") true) (print "bar")) |
| 04:31 | tomoj | I always have my repl open |
| 04:31 | mebaran151 | yep I just did the test |
| 04:31 | mebaran151 | I had my repl open |
| 04:32 | mebaran151 | but it was giving me weird results |
| 04:32 | tomoj | ,(or (do (print "foo") true) (print "bar")) |
| 04:32 | clojurebot | true |
| 04:32 | mebaran151 | turned out I'd forgotten my own argument order |
| 04:32 | clojurebot | foo |
| 04:32 | mebaran151 | so what I thought was nil, truly wasn't! |
| 04:32 | tomoj | was that a pun |
| 04:46 | gko | How do you deal concurrency with sockets? |
| 04:48 | AWizzArd | gko: depending on what you do.. there are things that are parallelizable while others are not. |
| 04:49 | gko | AWizzArd: typical use: pool of (client) sockets used on demand by pool of threads. |
| 04:51 | gko | AWizzArd: each thread could request at anytime the use of a socket to send a request. Does (dosync ...) protect usage? |
| 04:59 | mebaran151 | tomoj, I wish I was so clever |
| 04:59 | mebaran151 | gko, I think so |
| 05:00 | mebaran151 | though I don't know how well it works with sideeffects... |
| 05:02 | gko | mebaran151: right... if some thread is sending/receiving data, the socket referenced by the ref doesn't change value... |
| 05:02 | mudphone | anyone know how to save *out* to a string? |
| 05:05 | gko | ,(.write *out* "test") |
| 05:05 | clojurebot | test |
| 05:06 | mudphone | gko: I guess what I'm trying to do is run a method (like println) and have the output go to a var, instead of stdout |
| 05:06 | Fossi | mudphone: with-out-str |
| 05:07 | mudphone | Fossi: great, that looks awesome |
| 05:07 | gko | How to make *out* to print out in the REPL when in a thread? |
| 05:07 | gko | (.write *out* "test") => OK |
| 05:07 | Fossi | mudphone: but if you only want it for one strint, there's print-str |
| 05:08 | gko | but: (.start (Thread. (fn [] (.write *out* "Hello")))) => nothing |
| 05:08 | mudphone | ,(do (def my-var (with-out-string (println "hello"))) my-var) |
| 05:08 | clojurebot | DENIED |
| 05:08 | opqdonut | with-out-string, yes |
| 05:08 | mudphone | ,(def my-var (with-out-string (println "hello"))) |
| 05:08 | clojurebot | DENIED |
| 05:09 | mudphone | doh |
| 05:09 | Fossi | ,(print-str "something") |
| 05:09 | clojurebot | "something" |
| 05:09 | tomoj | why are those denied? |
| 05:09 | mudphone | ,(with-out-string (println "hello")) |
| 05:09 | clojurebot | java.lang.Exception: Unable to resolve symbol: with-out-string in this context |
| 05:09 | Fossi | gko: maybe start slime with slime-redirect-inferior-output |
| 05:09 | tomoj | it's with-out-str |
| 05:09 | mudphone | ,(with-out-str (println "hello")) |
| 05:09 | clojurebot | "hello\n" |
| 05:09 | opqdonut | ,(with-out-str (println "hello")) |
| 05:09 | clojurebot | "hello\n" |
| 05:09 | opqdonut | gah |
| 05:10 | mudphone | excellent |
| 05:10 | mudphone | gracias |
| 05:10 | Fossi | mudphone: as i said, if you only want to format one string, there's print-str as well |
| 05:10 | Fossi | and format of yourse |
| 05:10 | Fossi | *course |
| 05:11 | mudphone | ,(print-str (println "hello")) |
| 05:11 | clojurebot | "nil" |
| 05:11 | clojurebot | hello |
| 05:12 | mudphone | Fossi: I think I need with-out-str |
| 05:12 | gko | Fossi: (slime-redirect-inferior-output) => no effect |
| 05:12 | mudphone | Fossi: Thanks |
| 05:12 | mudphone | I'm setting up an ajaxy front end to serve up (doc) calls |
| 05:13 | Fossi | more like (print-str "%s" "string") |
| 05:13 | Fossi | ups |
| 05:14 | gko | Fossi: oh... if I do a println, then the stuff with (.write *out* ...) comes out... |
| 05:14 | Fossi | mudphone: yeah, then you want with-out-str |
| 05:14 | Fossi | gko: hmmm. buffer flushing? or lazyness? |
| 05:14 | gko | Fossi: have to flush it... |
| 05:15 | mudphone | Fossi: I always think I have to do more work than I really do :) |
| 05:15 | Fossi | same here, rally :) |
| 05:15 | Fossi | *really |
| 05:15 | Fossi | man, i can't type today... :\ |
| 05:16 | mudphone | does sed work here? |
| 05:16 | mudphone | s/sed/something/ |
| 05:16 | mudphone | guess not |
| 05:44 | Fossi | what's the compiled clojure in clojure.jar good for? |
| 05:46 | Fossi | i'd like the smallest clojure build possible, because dexing for the dalvik vm takes ages like this |
| 05:46 | Chousuke | clojure-slim is supposed to be that I think? |
| 05:46 | Chousuke | the jar |
| 05:47 | Fossi | yeah, but i don't quite get what i need the clojure sources and the java things for |
| 05:48 | Fossi | *are |
| 05:48 | Fossi | i guess only including the clj would make the deployment faster, because it's only text to the dexer |
| 05:48 | Fossi | but then everthing needs to be compiled in time, right? |
| 06:26 | LauJensen | (doc conj!) |
| 06:26 | clojurebot | "/;nil; " |
| 06:26 | LauJensen | (doc future) |
| 06:26 | clojurebot | "([& body]); Takes a body of expressions and yields a future object that will invoke the body in another thread, and will cache the result and return it on all subsequent calls to deref/@. If the computation has not yet finished, calls to deref/@ will block." |
| 06:26 | LauJensen | Man thats awesome |
| 06:27 | LauJensen | Where does he get the ideas for this stuff? :) |
| 06:31 | Fossi | future? |
| 06:34 | LauJensen | Yea among other things |
| 06:36 | eevar2 | LauJensen: books/papers on languages and language design? |
| 06:37 | Jomyoot | I don't want #file.txt# all over |
| 06:37 | Fossi | well, future is part of java :) |
| 06:37 | Jomyoot | how do I remove that? |
| 06:39 | arbscht | Jomyoot: are those emacs backups? |
| 06:39 | Jomyoot | yep |
| 06:40 | arbscht | Jomyoot: for details try M-x apropos backup, or ask in #emacs, or check emacswiki.org |
| 06:41 | arbscht | basically you can set backup-directory-alist to put backups in a designated directory. or you can disable the feature altogether somehow |
| 06:42 | LauJensen | (setq backup-directory-alist (list (cons ".*" (expand-file-name "~/.emacsbackup/")))) |
| 06:42 | LauJensen | I think the #file# files are locks though, and they go away soon as you close the buffer, but the clj~ are the backups |
| 06:47 | vvl | #files# should be auto-save files |
| 06:47 | vvl | which can be disabled as well |
| 06:48 | Raynes | I just have all my auto-saves and backups sent to a .saves directory. |
| 07:31 | djpowell | cool - on the newnew branch, jad core$future_call$obj__6472.class actually manages to decompile it to java |
| 08:15 | adityo | i have a query?how do i write obj.methodname("value") into Clojure (.methodname value obj) |
| 08:16 | Chousuke | adityo: (.methodname obj value) |
| 08:16 | Chousuke | or actually, "value" since it's a string :P |
| 08:16 | Chousuke | ,(.substring "Foobar" 2) |
| 08:16 | clojurebot | "obar" |
| 08:16 | adityo | Chousuke: thanks, "value" it :) |
| 08:58 | lnostdal | hi, i'm testing various languages and environments .. how does one deploy clojure stuff? .. is there a "sb-ext:save-lisp-and-die" or a "ext:saveinitmem" or similar way? |
| 09:01 | Fossi | eh, what? |
| 09:02 | lnostdal | Fossi, perhaps it is an unreasonable question given the jrm? .. what i'm looking to do is to save an executable (in jvm sense) snapshot of the current state of the lisp system to disk |
| 09:02 | Fossi | you can compile to java or run from the repl or whatever you want |
| 09:03 | Fossi | i'm not sure i get what you are up to |
| 09:03 | lnostdal | ok |
| 09:03 | mccraig | lnostdal: there is no save image function in clojure |
| 09:45 | dysinger | whasup danlarkin |
| 09:45 | danlarkin | mornin! |
| 09:46 | rhickey | so, any experience reports w/transients? |
| 09:47 | cgrand | rhickey: is anyone working on TransientHashMap? |
| 09:47 | rhickey | cgrand: I'm not yet, I'm sure that's even more in demand than the vector |
| 09:47 | danlarkin | no speedup in clojure-json array decoding, so I guess the vector operations are not the bottleneck |
| 09:48 | rhickey | danlarkin: it will only improve write speed, reads for transients are the same (v. good) as for normal persistents |
| 09:49 | rhickey | cgrand: I think the same strategy will work for all of the tree=based data structures |
| 09:50 | danlarkin | rhickey: Yeah I mean conjing up a clojure vector from a json array |
| 09:50 | rhickey | ah |
| 09:50 | cgrand | rhickey: yeah, I guess that there's no need to introduce a Node type, edit can be added to existing INode impls |
| 09:51 | rhickey | cgrand: right, I was using raw arrays in pv, there are already nodes in pmap |
| 09:51 | cgrand | but one can not change IName to AName because LeafNode extends AMapEntry :-( |
| 09:51 | rhickey | one complication is the sparse nature of the maps. Maintaining that would make key-inserting/deleting ops no faster |
| 09:53 | rhickey | I have ideas about partial-sparseness, e.g. non-sparse for all but the last level or two |
| 09:53 | rhickey | this would remove some of the bit twiddling from the intermediate steps, at a minor cost in space |
| 09:54 | rhickey | overall better lookup times, and more amenable to transients |
| 09:55 | rhickey | value-modifying ops would get huge speedup from transients even with the current structure |
| 09:58 | rhickey | I also have ideas about getting rid of the key/value hlding LeafNode objects, using an array pair in the inner nodes |
| 09:59 | rhickey | holding |
| 10:00 | cgrand | hmm... does this mean that I shouldn't try to write TransientHashMap and that you prefer to rework PersistentHashMap before? |
| 10:02 | rhickey | cgrand: no, by all means go for it. If you want to try any of these ideas you can do so after a first cut, or while you are in there. I'd be happen to explain in more detail |
| 10:02 | cgrand | great! |
| 10:03 | rhickey | I could use the help |
| 10:06 | rhickey | unfortunately the hashmap code is a little, ... tricky :) |
| 10:09 | cgrand | I noticed |
| 10:10 | rhickey | I'm not sure the polymorphic nodes bought me as much as they did with the RB tree in PTreeMap |
| 10:10 | rhickey | cgrand: you understand the edit mechanism in PersistentVector ok? |
| 10:10 | cgrand | yes |
| 10:10 | rhickey | cool |
| 10:34 | Chousuke | hmm |
| 10:35 | Chousuke | My clojure reader written in Clojure has now successfully read "(())" as (())! |
| 10:36 | Chousuke | I wonder at which point will I encounter something that forces me to start over, though. |
| 10:40 | cemerick | rhickey: I guess I was somewhat too extemporaneous with my proggit title, eh? :-/ |
| 10:43 | rhickey | cemerick: I liked it, but it is subject to wildly varying interpretations |
| 10:44 | cemerick | yeah. DRMacIver and I both misunderstood each other. Typical internet discourse, etc. |
| 10:45 | rhickey | yeah |
| 10:45 | cemerick | I should have just said "Hey, this ain't LTU, whadda want?!" :-D |
| 10:45 | dysinger | cemerick: heh DRMacIver - don't get me started |
| 10:46 | cemerick | dysinger: run-ins? |
| 10:46 | dysinger | yes |
| 10:46 | cemerick | I remember him being helpful in #scala when I used to hang there |
| 10:46 | cemerick | of course, I wasn't there long |
| 10:47 | leafw | anybody knows that tool is being used to render the UML diagrams of clojure classeS? |
| 10:47 | rhickey | cemerick: It will be interesting to see if someone acknowledges the difference between transients and e.g. Haskell's freeze/thaw/unsafeFreeze/unsafeThaw/IArray/MArray dichotomy |
| 10:47 | dysinger | I am sure most of the time he's fine cemerick |
| 10:47 | dysinger | as am I ;) |
| 10:47 | rhickey | DRMacIver always seems reasonable to me |
| 10:48 | cemerick | rhickey: there was that SP mention, but I've no idea what that's about :-) |
| 10:49 | dysinger | leafw: link ? |
| 10:50 | rhickey | http://www.haskell.org/ghc/docs/latest/html/libraries/array/Data-Array-MArray.html |
| 10:50 | danlarkin | leafw: http://github.com/Chouser/clojure-classes/tree/master |
| 10:50 | rhickey | freeze - full copy, unsafeFreeze, um, unsafe |
| 10:52 | rhickey | and IArray and MArray have very different interfaces it seems |
| 10:52 | leafw | dysinger, danlarkin : thanks. |
| 10:53 | koba | hello |
| 10:53 | dysinger | cool /me clones that |
| 10:53 | cemerick | wtf: "Note that because the array is possibly not copied, any subsequent modifications made to the mutable version of the array may be shared with the immutable version." |
| 10:54 | rhickey | cemerick: thus, unsafe |
| 10:54 | cemerick | my basic reaction is, "what's the point" |
| 10:57 | rhickey | cemerick: well, it's enough to say that transients are different, in important ways |
| 10:58 | rhickey | I don't know of anything similar (although it's likely there's something) |
| 10:59 | rhickey | to/from O(1), same shape, mirror API |
| 10:59 | cemerick | rhickey: I'm sometimes prone to hyperbole. Strong opinions, weakly held, etc. |
| 11:00 | koba | hi again..just want to say I'm new to clojure and having just watched the "Clojure for Lisp programmers" video want to express how awesome I think it is |
| 11:01 | koba | I'm just very happy to have found a new language to delve into and enjoy :-) |
| 11:01 | cemerick | I've been burned by Collections/unmodifiable* too many times to mess with simple wrappers around mutable collections. |
| 11:01 | drewr | koba: there's no turning back now |
| 11:01 | rhickey | cemerick: I don't think the spirit of your headline was wrong, this is a game-changing feature for those worried about FP and performance |
| 11:01 | cemerick | koba: welcome :-) Feel free to stick around. |
| 11:01 | AWizzArd | rhickey: what would those hash map do? |
| 11:02 | AWizzArd | Would that solve the problem if very fast instantiation of small immutable objects? |
| 11:02 | koba | thanks - I'm only an undergrad AI student but I'm delighted to see that Lisp still has a future |
| 11:02 | AWizzArd | if ==> of |
| 11:02 | rhickey | AWizzArd: support transient/persistent!/assoc! etc |
| 11:02 | cemerick | rhickey: Oh, I don't make any apologies for the headline itself. It was meant to stir the waters, attract attention, and be a little fun. Trying to hang serious conversation off of its context is hard, though, for sure. |
| 11:04 | wlr | rhickey: fwiw, i've twice run your vrange/vrange2 comparison. both times (time vrange version) > (time vrange2 version) on *first* run of each. once hotspot kicked in though, vrange2 kicked butt. |
| 11:04 | koba | at Uni here they teach Java and that is what the students use...I managed to avoided it and decided to learn Common Lisp as the historic AI language instead |
| 11:04 | koba | avoid* |
| 11:05 | wlr | rhickey: er... i cited first runs backwards above. sorry. |
| 11:05 | koba | anyone got any suggestions for a first project with Clojure? Something AI related would be great |
| 11:06 | cemerick | wlr: I see this a lot as well, and mentioned it yesterday. It *seems* like clojure code needs more trips through the JIT to reach its performance minima than javac'd java. |
| 11:06 | rhickey | wlr: right, the only times that matter are post-hotspot IMO |
| 11:07 | AWizzArd | koba: you could develop a lib with support for several kinds of neural networks. |
| 11:08 | koba | AWizzArd: Could do. I would have thought you could get that from the Java side though |
| 11:09 | cemerick | rhickey: agreed, but I'm curious as to the (apparent) difference in the speed of the optimization itself. Perhaps optimization of boxed numerics takes longer/more runs? |
| 11:09 | cemerick | (takes longer than other optimization paths, that is) |
| 11:09 | clojurebot | that is not what I wanted |
| 11:09 | AWizzArd | koba: so we need to find something for which there is no Java solution yet, but which is still AI. |
| 11:10 | koba | I think I might want to do something with DSLs as that is the main place I've found Python lacking (I've mainly coded in Python) |
| 11:10 | AWizzArd | koba: you could write a DSL for parsers. EBNF2Clojure or so. |
| 11:10 | koba | hmm..nice idea |
| 11:11 | rhickey | cemerick: these JITs do optimization in several phases, so only after seeing continuing pressure after the first wave of opts will it do another pass. I think in the IBM VM talk at JavaOne they talked about 5 different levels of code 'hotness' each triggering progressively more sophisticated optimization |
| 11:11 | koba | my lectures have mostly been for natural language parsers. I've only just learnt basic parsing with pyparsing...I like that API though |
| 11:11 | koba | with a lisp I guess I could get it to just read EBNF |
| 11:11 | koba | which would be really nice |
| 11:13 | koba | Or something with planning domains and logics? |
| 11:14 | AWizzArd | koba: or you could implement a unicode infix macro "math" for Clojure. So people could write (math "14√π³ * 10x² + αδ") |
| 11:14 | AWizzArd | if it is very good then rhickey would maybe integrate it with a nice reader macro into Clojure :-) |
| 11:15 | koba | AWizzArd: Another nice idea! Or how about let it read/eval Latex math expressions instead? |
| 11:15 | AWizzArd | why not both modes? :-) |
| 11:15 | koba | yeah |
| 11:15 | koba | I really like that idea...would be great for either formula documentation |
| 11:15 | stuartsierra | Latex is not easy to parse, or implement. |
| 11:16 | AWizzArd | Then all people who say that math is difficult with s-expression syntax would actually have to admit that math in Clojure is more readable than their programming language. |
| 11:16 | koba | hmm...even if I start with a small subset? |
| 11:16 | AWizzArd | try a small subset |
| 11:16 | AWizzArd | saving the multiplication for things like 6x + 2y or so |
| 11:16 | mebaran151 | Latex isn't even easy to version! |
| 11:16 | AWizzArd | the multiplication symbol "*" I mean |
| 11:17 | koba | hmm..maybe I should look into defining my own simple markup? |
| 11:17 | koba | then that could map to simple LaTex expressions for nice formatting maybe |
| 11:18 | mebaran151 | any easier way to get all the natural numbers than (iterate inc 1)? |
| 11:19 | koba | + - \times \frac{}{} \int^{}_{} ^ (superscript) and _ (subscript) should be simple enough |
| 11:20 | AWizzArd | mebaran151: iterate is fine |
| 11:20 | AWizzArd | koba: but I think that you should still start with *readable* unicode syntax first |
| 11:21 | koba | AWizzArd: Ok, + - * / () can be found in latex maths too |
| 11:21 | koba | and ^ would be the same too |
| 11:21 | AWizzArd | including pi, square root, summation, superscript numbers in combination with vars such as x⁵⁹ |
| 11:22 | koba | what is the unicode way of doing root? I would use \sqrt{} normally |
| 11:22 | koba | and \sum{} for summation |
| 11:23 | koba | how would you consider a more natural notation for those things? |
| 11:23 | AWizzArd | 6√π⁸ |
| 11:23 | koba | ok...if you have unicode characters on your keyboard ;-p |
| 11:23 | koba | or know the codes? |
| 11:23 | AWizzArd | easier than (* 6 (Math/sqrt (Math/pow Math/PI 8))) |
| 11:24 | AWizzArd | unicode chars directly in source code |
| 11:24 | koba | yeah |
| 11:24 | AWizzArd | it's a thing of the editor to provide those |
| 11:24 | koba | ok, depending on the editor of course |
| 11:24 | koba | but yeah, as long as it is unambiguous |
| 11:24 | AWizzArd | sure, if a team to decides to use it they know what they are doing |
| 11:25 | AWizzArd | then they will have to stick to their environment |
| 11:25 | AWizzArd | and several keyboard layouts can easily type unicode, such as mine for example :p |
| 11:25 | koba | that is a nice project...thanks. I use LaTeX all the time |
| 11:25 | koba | also readable maths is good too |
| 11:26 | koba | (I consider Latex readable ;-p) |
| 11:26 | AWizzArd | if you split the task up correctly, then the parser is composable, and one could have different modes. |
| 11:27 | stuartsierra | I don't consider Latex readable. A couple years ago I heard about a language called Fortress, from Sun, that was supposed to include properly-rendered math in source code. |
| 11:27 | stuartsierra | Or maybe it was IBM. |
| 11:27 | fffej | stuartsierra: it was Sun with Guy Steele with Fortress |
| 11:27 | koba | got it on wikipedia |
| 11:27 | stuartsierra | What ever happened with that? |
| 11:28 | koba | http://en.wikipedia.org/wiki/Fortress_(programming_language) |
| 11:28 | koba | apparently version 1 came out last year |
| 11:28 | fffej | stuartsierra: it's still going afaik, there was some interesting work on concurrency recently. |
| 11:28 | stuartsierra | ok, cool |
| 11:28 | koba | ok, this will be my project for the rest of the summer then... |
| 11:29 | fffej | see http://groups.csail.mit.edu/mac/users/gjs/6.945/readings/MITApril2009Steele.pdf |
| 11:29 | koba | I would also like to thank rhickey for his great videos and work on this language |
| 11:30 | koba | I'll try to get some other AI people here onboard |
| 11:32 | koba | I don't know how much momentum clojure has atm..that is my only worry before learning the language |
| 11:33 | koba | there seems to be plenty of people on this channel though |
| 11:33 | AWizzArd | koba: the phase of no-interest in programming is over |
| 11:34 | AWizzArd | in the months February-May people are not interested in it |
| 11:34 | koba | hmm..what do you mean? |
| 11:35 | AWizzArd | in January many people were interested |
| 11:36 | AWizzArd | in Jan. we had even more people in here |
| 11:36 | koba | strange |
| 11:36 | AWizzArd | since many years people stop posting in newsgroups and hanging out in irc programming channels in those months |
| 11:36 | AWizzArd | during spring mostly :) |
| 11:36 | koba | ah..I see |
| 11:37 | koba | I rarely use IRC myself, this is a one off :-) |
| 11:37 | AWizzArd | or for example, check the number of patches to bigger systems, such as Clojure itself during that time. |
| 11:38 | koba | didn't know of such a general trend |
| 11:38 | koba | well, summer holidays in the nothern hemisphere? |
| 11:38 | koba | though for students like me, summer is the best time for new projects |
| 11:40 | koba | anyways, I'm sure I'll be back when I have questions...once again, thanks for the idea! |
| 11:40 | koba | farewell! |
| 11:55 | cgrand | ,(-> [] (with-meta {:foo :bar}) transient persistent! meta) |
| 11:55 | clojurebot | java.lang.Exception: Unable to resolve symbol: persistent! in this context |
| 11:56 | mebaran151 | I don't think clojurebot has been built with upstream clojure yet |
| 11:56 | Chousuke | it's got new new though :P |
| 11:57 | Chousuke | but hm, enough for tonight |
| 11:57 | Chousuke | I have a reader that creates lists, vectors and maps now (and is able to read simple symbols) |
| 11:57 | cgrand | well, it returns nil: metadata is not (yet) preserved through transient |
| 11:58 | Chousuke | (that is, the easy part is over. I fear I will have to redo everything when I get to the more complicated reader macros) |
| 12:22 | sh10151 | Is there a way to get the Clojure REPL to use pprint when printing data structures? |
| 12:23 | sh10151 | barring that, a way to get SLIME to use it? |
| 12:31 | lisppaste8 | cgrand pasted "TransientHashMap: work in progress" at http://paste.lisp.org/display/84750 |
| 12:33 | leafw | looks like this is part of the clojure in clojure dev -- just thinking aloud |
| 12:33 | leafw | oops didn't read enough, this is just a testing script |
| 12:35 | cemerick | cgrand: looks promising :-) |
| 12:36 | LauJense` | is mutable and conj! in the master branch ? |
| 12:36 | Chousuke | LauJense`: mutable was renamed to transient, and yes, it's in master for vectors |
| 12:36 | LauJense` | k |
| 12:39 | LauJensen | I posted a question on Compojures group regarding long lived http connections and people keep referencing this BOSH standard, but its massive and quite daunting to have to implement. Isnt there a simpler way? |
| 12:52 | LauJensen | ...like Symbolic Web from CL |
| 12:54 | LauJensen | (which is now dead) |
| 13:04 | stuartsierra | Long-lived HTTP is hard. |
| 13:05 | stuartsierra | The only really successful use I've seen is from Google. |
| 13:09 | LauJensen | Symbolic Web actually seemed very functional with very few lines of code as I recall.. |
| 13:10 | stuartsierra | Maybe up to a few dozen connections. It's a whole different game with real traffic. |
| 13:12 | LauJensen | Why? |
| 13:13 | LauJensen | @ stuartsierra |
| 13:13 | stuartsierra | I've heard you've got to futz with TCP stuff to handle so many open connections. |
| 13:13 | LauJensen | hehe :) |
| 13:16 | rhickey | cgrand: neat! this is with packing of inner nodes still? I'd expect the second case to do better, given all but leaf nodes can be reused. |
| 13:17 | rhickey | and surprised the first case does any better at all! |
| 13:18 | rhickey | I guess sometimes you have the same size inner node |
| 14:00 | cgrand | rhickey: yup, inner nodes are still packed. |
| 14:00 | Chousuke | +s |
| 14:02 | Fossi | well, aren't they? |
| 14:02 | LauJensen | I had the same concern Chousuke |
| 14:02 | Chousuke | Fossi: no. |
| 14:02 | cgrand | about persistent! being O(1): would an amortized O(1) be acceptable? |
| 14:02 | LauJensen | Fossi, yes and no... hmm, was gonna make a Python joke :) |
| 14:03 | Chousuke | Fossi: if you call a destructive operation like (assoc! tv 0 1), you should not reuse the tv name after that. |
| 14:04 | Chousuke | While it does work (for now), (do (assoc! tv 0 1) (assoc! tv 1 2)) is not how you should use transients. |
| 14:07 | cemerick | Chousuke: More rope is good, I like the knots I can tie with it. Some people were going to hang themselves anyway. (e.g. just tossing around java collections, which I've seen in more clojure code than I'd like) |
| 14:07 | Carkh | well isn't it true that sometimes an imperative algorithm is easier to pull off ? |
| 14:08 | Chousuke | if you use imperative style, you're reintroducing the burden of side-effects. |
| 14:09 | Fossi | at least in a defined scope, i think that's ok |
| 14:09 | cemerick | rhickey: may I suggest that you eliminate the version.properties file, and move to keeping the version numbers in a clojure file that can be AOT'd? I bring it up because I just finished working with a customer who strips all resource files (e.g. all non-.class files) from all jars they deploy. |
| 14:09 | Chousuke | if you merely use transients and functional style, the "side-effects" are just a detail you can ignore. especially if your algorithm happens to work on truly persistent vectors as well. |
| 14:12 | Chousuke | cemerick: isn't the properties file there just to set the correct value for clojure-version at build time? |
| 14:13 | Chousuke | ,*clojure-version* ; this I mean |
| 14:13 | clojurebot | {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "alpha"} |
| 14:13 | cemerick | Chousuke: no, it's loaded by core.clj (or core__init.class) |
| 14:13 | Chousuke | hmm :/ |
| 14:14 | cemerick | I presume rhickey made it an external properties file for a good reason (maybe so that ant's propertyfile task can twiddle a buildnumber?), but that'll make things a little difficult for when we ship this customer a jar later this year that uses clojure. |
| 14:15 | cemerick | ideally, the AOT'd clojure jar should contain *only* classfiles |
| 14:22 | berk | I need a little handholding with eclipse plugin |
| 14:22 | berk | How do I use latest git versions of clojure-contrib and clojure with it? |
| 14:25 | berk | I want to experiment with transients but don't know how to build clojure |
| 14:25 | baetis-fly | anyone know why contrib's prxml prints to *out*? Couldn't it just return a string and let me print it if i want? |
| 14:25 | gko | berk: get code from github.com, then "ant" |
| 14:25 | hiredman | ,(doc prxml) |
| 14:25 | clojurebot | "clojure.contrib.prxml/prxml;[[& args]]; Print XML to *out*. Vectors become XML tags: the first item is the tag name; optional second item is a map of attributes. Sequences are processed recursively, so you can use map and other sequence functions inside prxml. (prxml [:p {:class \"greet\"} [:i \"Ladies & gentlemen\"]]) ; => <p class=\"greet\"><i>Ladies & gentlemen</i></p> PSEUDO-TAGS: some keywords have special meani |
| 14:25 | gko | it will build the .jar files. |
| 14:26 | Chousuke | baetis-fly: printing to a stream is faster and more flexible. |
| 14:26 | Chousuke | baetis-fly: use 'with-out-str |
| 14:26 | Chousuke | (doc with-out-str) |
| 14:26 | clojurebot | "([& body]); Evaluates exprs in a context in which *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls." |
| 14:26 | berk | gko: thanks. I already got the files. but just "ant"? |
| 14:26 | baetis-fly | Chousuke: oh, nifty. Many thanks. |
| 14:27 | gko | berk: Yes... "git clone git://github.com/richhickey/clojure.git" |
| 14:27 | gko | berk: cd clojure |
| 14:27 | gko | berk: ant |
| 14:27 | gko | berk: finished |
| 14:27 | berk | ok. thanks |
| 14:27 | gko | same for clojure-contrib. |
| 14:28 | LauJensen | same for clojureql |
| 14:28 | gko | berk: and if you want to update your current source: cd clojure, git pull original master, ant. |
| 14:29 | hiredman | for contrib you want to tell it where to find clojure.jar so it can AOT compile stuff |
| 14:29 | berk | I don't have a standalone ant installed. I'll have to figure out that first. (I'm on windows) |
| 14:30 | Fossi1 | i wonder how hard that would be |
| 14:30 | Fossi1 | you could cross compile all the libs to dex anyway |
| 14:30 | gko | My problem: Emacs+SLIME+clojure: C-- M-x slime clojure => clojure is launched, but in an *inferior-lisp* shell, although it says "Connection opened on local port 59154"... Did I miss something? |
| 14:30 | Fossi1 | so it should be more or less only the compiler & output |
| 14:30 | gko | berk: I'm on Windows too. |
| 14:31 | hiredman | Fossi1: nah, you need an asm library for dex |
| 14:31 | gko | oh, the swank client hasn't connected. |
| 14:31 | Fossi1 | hiredman: ah, i see |
| 14:32 | gko | it is: Connected. Let the hacking commence! |
| 14:33 | hiredman | some of the android videos from google io seem to suggest that with cupcake android got some ability to do runtime bytecode generation and loading |
| 14:33 | hiredman | which it did not really have before |
| 14:33 | hiredman | so maybe a dalvik asm lib will follow |
| 14:33 | Fossi1 | well, i don't care so much about runtime stuff |
| 14:33 | Fossi1 | which would of course be great as well (you can use dex on dalvik for that) |
| 14:34 | Fossi1 | but it's annoying that i have to AOt to java from clojure and then to dex again |
| 14:34 | Fossi1 | takes quite a while and i hate deployment cycles |
| 14:36 | Fossi1 | time for a bit of socialising |
| 14:45 | cemerick | what's this "dex"? |
| 14:46 | hiredman | dex is the tool for transforming jvm bytecode into dalvik bytecode |
| 14:46 | hiredman | dex is also the extension for dalvik bytecode files |
| 14:46 | cemerick | ah-ha |
| 14:47 | cemerick | is android going anywhere? From afar, it seems to have petered out pretty silently... |
| 14:48 | rhickey | cgrand: could you explain why amortized? and amortized over what, since invoked only once |
| 14:49 | hiredman | cemerick: there tons off handsets in the pipe line running android |
| 14:50 | rhickey | cemerick: could you please bring up the properties file thing on the list? |
| 14:50 | cemerick | rhickey: np |
| 14:51 | hiredman | http://gizmodo.com/search/android%20phones |
| 14:53 | eevar_ | htc hero looks nice too |
| 15:51 | mebaran151 | how could I build something like a take-while with lookbehind |
| 15:51 | mebaran151 | I can't use reduce because it isn't lazy enough |
| 15:51 | hiredman | use lazy-seq and roll your own |
| 15:53 | mebaran151 | alright |
| 15:53 | hiredman | or make the function arg to take-while close over an atom or something to do state munging, this is to be frowned upon |
| 15:54 | mebaran151 | I'd prefer the lazy-seq approach |
| 15:54 | mebaran151 | any good tutorials on lazy-seq: I don't quite grok them yet |
| 15:56 | stuartsierra | basically you write a recursive function that ends with (cons current-value (call-myself ...)) and wrape the whole thing in lazy-seq |
| 15:59 | mebaran151 | I see |
| 16:00 | mebaran151 | thanks |
| 16:18 | konrad_ | Guys, I installed clojure using aptitude, yet I need to install clojure-contrib now. I downloaded the tarball from github, but how can I compile and install it? There is nothing on the README :( |
| 16:20 | hiredman | run ant |
| 16:28 | cemerick | I'll never forgive aptitude for the hour I spent fiddling with a hopelessly-broken glassfish install. |
| 16:28 | technomancy | cemerick: yeah, same here with debian's solr. |
| 16:29 | technomancy | it's like they don't even try |
| 16:29 | cemerick | I really wish they wouldn't, period. |
| 16:39 | LauJensen | Nice to hear 2 old grumby men discuss package management :) |
| 16:39 | Fossi | :D |
| 16:39 | Fossi | i have to admit that i begin losing faith in gentoo |
| 16:40 | Fossi | as i did in debian |
| 16:40 | Fossi | the amount of open source and it's dependencies makes page management really nasty |
| 16:41 | cemerick | LauJensen: I'm actually very jovial...and technically young, though I've felt old of late... |
| 16:41 | cemerick | :-) |
| 16:41 | LauJensen | hehe... the fact that you need to defend yourself says something though :) |
| 16:49 | ari____ | what is the magic incantation to fix slime+emacs+clojure on OSX? http://pastie.org/571629 swank-clojure-jar-path etc are set properly |
| 16:49 | ari____ | i'm using the latest released emacs-23 |
| 16:50 | ari____ | i'd try to use clojure-install, but that doesn't work for me because of bizarre git+emacs interaction problems atm |
| 16:52 | technomancy | ari____: OS X doesn't set a custom PATH correctly for applications launched in a gui. maybe symlink git to somewhere that's on your default path? |
| 16:52 | technomancy | and don't forget to file a bug report with Apple about it. |
| 16:53 | Chousuke | hm |
| 16:53 | ari____ | mmk |
| 16:53 | Chousuke | here I was worrying about how to handle all the . sugar in my little clojure-reader, but it seems the reader needn't care! |
| 16:54 | Chousuke | (foo.) etc. are apparently expanded by the compiler, not the reader. |
| 16:56 | ari____ | clojure-install eventually fails for me with cd: No such directory found via CDPATH environment variable |
| 16:57 | technomancy | ari____: oh, someone else was reporting this bug the other day... some problem with autoloads. are you installing it in the default location? |
| 16:59 | ari____ | I wasn't, I'll give it another try |
| 17:02 | ari____ | that seems to be better, thanks |
| 17:03 | cemerick | Chousuke: that's interesting -- in that case, I'm surprised that symbols ending in . aren't allowable (or aren't functional, more like) |
| 17:03 | ari____ | i'm concerned with all the difficulty had in installing it manually, I had a valid ccl and everything, just a lot of errors and drama with slime, etc |
| 17:03 | ari____ | got to run, but i'll be back later if further debugging is warranted from anyone |
| 17:03 | ari____ | thanks |
| 17:03 | konrad_ | Is anybody here using vimclojure? I'm trying to install it with ant, yet I'm getting a strange error (http://pastebin.com/m75a3bf36). I've compiled clojure-contrib and set the local.properties file correctly |
| 17:05 | konrad_ | oh, it's in the faq :P |
| 17:05 | drewr | LauJensen: what's the latest stable commit of clojureql? should I just wait? |
| 17:09 | Chousuke | cemerick: Well, they're just reserved for the implementation |
| 17:09 | hiredman | ,(symbol "foo.") |
| 17:09 | clojurebot | foo. |
| 17:15 | LauJensen | drewr: Just pull HEAD, its stable, although we have recently changed by convention, that all calls that target a table, takes the table-name as the first argument, ie (query table1 *) (insert-into table1 [foo "bar"]) etc |
| 17:16 | drewr | LauJensen: the first example in dk.bestinclass.clojureql.demos.postgres/-main doesn't work for me |
| 17:16 | LauJensen | sec |
| 17:16 | drewr | create-table generates sql that looks like "CREATE TABLE StoreInformation ( id SERIAL NOT NULL,StoreName,Sales,Date PRIMARY KEY ( id ) )" |
| 17:17 | LauJensen | Ok, if you have patience for tomorrow I'd be happy to resolve it. The Postgres support was submitted to us as a patch, so I cant give you the solution just now Im afraid |
| 17:18 | LauJensen | Ok till tomorrow? |
| 17:18 | drewr | sure, no problem |
| 17:19 | LauJensen | ok great, goodnight all |
| 17:21 | cemerick | hiredman: right, what I was getting at is that if the reader isn't responsible for foo. symbols -> classes/constructors, I'd expect this to work: |
| 17:21 | cemerick | ,(let [foo. 5] (+ foo. 5)) |
| 17:21 | clojurebot | java.lang.ClassFormatError: Illegal field name "foo." in class sandbox$eval__3176 |
| 17:23 | hiredman | cemerick: expect that to work just because the reader doesn't care is kind of silly |
| 17:23 | hiredman | ,read-string |
| 17:23 | clojurebot | #<core$read_string__4939 clojure.core$read_string__4939@1e6cb2a> |
| 17:23 | hiredman | ,(read-string "(let [foo. 5] foo.) |
| 17:23 | clojurebot | EOF while reading string |
| 17:23 | hiredman | ,(read-string "(let [foo. 5] foo.)") |
| 17:23 | clojurebot | (let [foo. 5] foo.) |
| 17:24 | hiredman | I imagine it happens at macroexpansion time which sits between read and compile/eval |
| 17:25 | hiredman | but maybe is rolled into clojure's compile |
| 17:25 | cemerick | it's not that I care much, it's that I just don't understand what the compiler is doing -- or, given Chousuke finding, I realize my prior understanding was faulty |
| 17:32 | JAS415 | that prxml thing is nifty |
| 17:35 | konrad_ | Is anybody using vimclojure? I've installed it correctly, and now I'm running some sort of server, but how can I... use it, ie, send code to a REPL? |
| 17:50 | avital | hi. i see some examples that use lazy-cons but i don't have this. has it been renamed? |
| 17:50 | dysinger | konrad_: the correct editor is "emacs" |
| 17:50 | dysinger | ;) |
| 17:50 | hiredman | avital: it's gone |
| 17:50 | avital | ,lazy-cons |
| 17:51 | clojurebot | java.lang.Exception: Unable to resolve symbol: lazy-cons in this context |
| 17:51 | duck1123 | lazy cons has been replaced with lazy-seq and cons |
| 17:51 | hiredman | http://clojure.org/lazy sort of describes the changes that happened |
| 17:52 | hiredman | but it it implies a work in progress |
| 17:52 | hiredman | but it is a work doen |
| 17:52 | hiredman | done |
| 17:53 | avital | hmm |
| 17:53 | avital | ok let me give it a shot, i might come back for more questions :) |
| 17:53 | konrad_ | what is the extension of a clojure file? |
| 17:54 | avital | konrad_: .clj |
| 17:55 | cemerick | konrad_: enclojure is pleasant, FWIW |
| 17:56 | avital | konrad_: i am also now using enclojure |
| 17:57 | avital | is there a built-in function to create a lazy seqence of all numbers? something "like" (range 1 infinity) |
| 17:57 | opqdonut | i just use (iterate inc 0) |
| 17:58 | avital | opqdonut: cool thanks |
| 18:05 | mudphone | anyone interested in a seemingly simple stumper? |
| 18:06 | mudphone | this doesn't run for me in the repl: |
| 18:06 | mudphone | (defn my-doc [x] (doc x)) |
| 18:06 | konrad_ | oh gosh, I guess I'll have to bother the developer |
| 18:07 | mudphone | I get: java.lang.Exception: Unable to resolve var: y in this context |
| 18:07 | mudphone | y == x (oops) |
| 18:08 | hiredman | mudphone: doc is a macro that expands to a call to var |
| 18:08 | hiredman | and var is special |
| 18:08 | hiredman | ,(macroexpand-1 '(doc foo)) |
| 18:08 | clojurebot | (clojure.core/let [m__84__auto__ (clojure.core/meta (clojure.core/resolve (quote foo))) al__85__auto__ (:arglists m__84__auto__) docstring__86__auto__ (:doc m__84__auto__)] (if m__84__auto__ (.replaceAll (clojure.core/str al__85__auto__ "; " docstring__86__auto__) "\\s+" " ") (clojure.core/-> hiredman.clojurebot.code-lookup/contrib :vars ((clojure.core/partial clojure.core/filter (clojure.core/fn [a__87__auto__] (clojure. |
| 18:08 | hiredman | eep |
| 18:08 | hiredman | anyway |
| 18:09 | hiredman | if you want a doc function |
| 18:09 | hiredman | ,(:doc (meta (resolve '+))) |
| 18:09 | clojurebot | "Returns the sum of nums. (+) returns 0." |
| 18:09 | mudphone | hmm |
| 18:10 | mudphone | hiredman: excellent! |
| 18:10 | hiredman | => (macroexpand-1 '(doc foo)) |
| 18:10 | hiredman | (clojure.core/print-doc (var foo)) |
| 18:10 | hiredman | is the actual macroexpand of doc |
| 18:11 | hiredman | the above was just an abberation particular to clojurebot |
| 18:11 | rathore | hiredman: what happened earlier when u did the macroexpand? |
| 18:11 | mudphone | it didn't work for me with print-doc either |
| 18:11 | mudphone | but, the meta way, seems like it will |
| 18:11 | hiredman | clojurebot has a custom doc macro |
| 18:11 | rathore | hiredman: ah ok |
| 18:11 | hiredman | ,(macroexpand-1 '(print-doc foo)) |
| 18:11 | clojurebot | (print-doc foo) |
| 18:11 | hiredman | ,(print-doc (relsove '+)) |
| 18:11 | clojurebot | java.lang.Exception: Unable to resolve symbol: relsove in this context |
| 18:12 | hiredman | ,(print-doc (resolve '+)) |
| 18:12 | clojurebot | ------------------------- clojure.core/+ ([] [x] [x y] [x y & more]) Returns the sum of nums. (+) returns 0. |
| 18:12 | hiredman | mudphone: I imagine you were just missing the call to resolve |
| 18:12 | mudphone | hiredman: I'll try that |
| 18:17 | mudphone | hiredman: if I create my fn like this: (defn my-doc [y] (print-doc (resolve 'y))) |
| 18:17 | mudphone | I get the :doc metadata for "user/y" |
| 18:19 | konrad_ | Is there something like Glade or QTDesigner for Clojure? |
| 18:19 | cemerick | shouldn't the metadata keys in clojure.zip be ::branch?, etc., instead of :zip/branch? |
| 18:20 | cemerick | konrad_: There's at least a dozen well-supported UI designers for swing, awt, and swt. |
| 18:20 | cemerick | OK, a half-dozen, perhaps. |
| 18:24 | hiredman | mudphone: you quote y when you call my-doc |
| 18:24 | hiredman | not inside my-doc |
| 18:25 | hiredman | that is why doc is a macro, not a function |
| 18:25 | hiredman | otherwise you would need to call it like (doc '+) |
| 18:25 | mudphone | hiredman: ah |
| 18:26 | mudphone | hireman: fantastic, thanks |
| 18:41 | mudphone | hiredman: so the meat of my function is now: (:doc (meta (resolve (symbol str-name)))) |
| 18:41 | mudphone | where I'm getting str-name passed in as a string (the name of the function) |
| 18:41 | mudphone | hiredman: thanks for your help |
| 18:57 | konrad_ | what do you guys think about Python? |
| 18:57 | skalnik | It sucks. |
| 18:57 | konrad_ | why? |
| 18:58 | skalnik | ", ".join(["5", "6"]) <= Things like that |
| 18:58 | albino | shachaf: why does that suck? |
| 18:58 | skalnik | I assume you mean me, in which case, it makes no sense |
| 18:59 | albino | oh yeah, wrong person |
| 18:59 | albino | how would you like it to read to make sense? |
| 18:59 | Chousuke | You can come up with an example like that for any language. |
| 18:59 | skalnik | albino: join should be a method on the array, but the array doesn't have a join method |
| 19:00 | skalnik | Chousuke: true, but I just think Python has a few design flaws |
| 19:00 | skalnik | I don't really think it sucks ;) |
| 19:00 | Chousuke | As far as making sense goes, python does rather well. |
| 19:00 | cemerick | *every* language has design flaws *shrug* |
| 19:00 | albino | shachaf: well JS does it on the array |
| 19:00 | skalnik | Because it makes sense :) |
| 19:01 | albino | freak, get the right nick name, gah sorry |
| 19:01 | skalnik | I'd be more upset if I were shachaf ;) |
| 19:04 | Chousuke | hmm |
| 19:04 | Chousuke | I wonder what it would take to implement syntax-quote as a regular macro |
| 19:05 | Chousuke | so that the reader would just expand `(foo ~bar) into (syntax-quote (foo (unquote bar))) |
| 19:26 | ataggart | anyone have experience reading a technical book (e.g., Programming Clojure) on a Kindle? |
| 19:31 | shachaf | albino, skalnik: I am *absolutely* upset, and demand some sort of compensation immediately. |
| 19:31 | skalnik | I knew it. |
| 19:32 | skalnik | I always get cranky when people highlight me on accident. |
| 19:40 | albino | shachaf: well you can't blame skalnik for my stupidity |
| 19:41 | shachaf | skalnik: I was not assigning blame, only notifying skalnik that it was correct. |
| 19:41 | shachaf | s/skalnik/albino/ |
| 19:41 | shachaf | Consider the accounts settled -- *this* time. |
| 19:41 | skalnik | RRRRRRRRRRAAAAAAAAAAAAAAAAAAGGGGGEEEEEEEEEEEEEEEEEEEEEEE |
| 19:44 | shachaf | skalnik: You should change your nick -- I was here first. |
| 19:44 | skalnik | never. |
| 20:02 | rhickey | ataggart: I've read tech books on a kindle dx - very nice |
| 20:02 | ataggart | rhickey: well my main concern was that the regular woudl just be too small. |
| 20:02 | ataggart | which, from watching videos, appears to be the case |
| 20:03 | rhickey | ataggart: probably so |
| 20:20 | konrad_ | kindle is evil |
| 20:21 | konrad_ | ok, getting vimclosure to work - take 2 |
| 20:29 | mebaran151 | I'd like to know too actually |
| 20:29 | mebaran151 | I gave up and switched to Netbeans, and I'm actually pretty happy with the support |
| 20:36 | mebaran151 | is there anyway to test if a seq is lazy or not? |
| 20:37 | hiredman | not really |
| 20:37 | JAS415 | hm |
| 20:37 | hiredman | ,(class (range 10)) |
| 20:37 | clojurebot | clojure.lang.LazySeq |
| 20:38 | JAS415 | can't you check if it implements the class |
| 20:38 | hiredman | ,(class (cons 1 (range 10))) |
| 20:38 | clojurebot | clojure.lang.Cons |
| 20:38 | JAS415 | haha |
| 20:38 | JAS415 | oo |
| 20:38 | mebaran151 | so whenever I ask for count |
| 20:38 | ataggart | (class (map + [1 2])) |
| 20:38 | ataggart | ,(class (map + [1 2])) |
| 20:38 | clojurebot | clojure.lang.LazySeq |
| 20:38 | hiredman | mebaran151: counted? |
| 20:38 | hiredman | ,(doc counted?) |
| 20:38 | clojurebot | "([coll]); Returns true if coll implements count in constant time" |
| 20:38 | mebaran151 | I better make doubly sure |
| 20:38 | mebaran151 | o |
| 20:38 | mebaran151 | useful |
| 20:38 | mebaran151 | just what I was looking for |
| 20:41 | mebaran151 | clojure needs a better documentation, though hiredman holds down the fort quite well |
| 20:43 | hiredman | clojurebot: docs? |
| 20:43 | clojurebot | Pardon? |
| 20:46 | ataggart | spending an hour or so really reading the api page has done wonders |
| 20:47 | hiredman | holy cow |
| 20:47 | hiredman | anyway |
| 20:47 | hiredman | http://clojure.org/sequences is useful |
| 20:47 | mebaran151 | I'll review it |
| 22:28 | hiredman | clojurebot: new new? |
| 22:28 | clojurebot | new Class(x) is (Class. x) |
| 22:44 | ari____ | what's necessary to get compiling working? I have for instance an org/ari___/test.clj, and a (ns org.ari___.test (:gen-class)), but (compile 'org.ari___.test) doesn't seem to work. |
| 22:50 | mebaran151 | underscores can be dangerous |
| 22:51 | mebaran151 | also is there anyway to get the arity of a function? |
| 22:52 | hiredman | nope |
| 22:53 | hiredman | ,(meta #'map) |
| 22:53 | clojurebot | {:ns #<Namespace clojure.core>, :name map, :file "clojure/core.clj", :line 1588, :arglists ([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]), :doc "Returns a lazy sequence consisting of the result of applying f to the\n set of first items of each coll, followed by applying f to the set\n of second items in each coll, until any one of the colls is\n exhausted. Any remaining items in other colls are ignored. Function\n |
| 22:53 | hiredman | ,(:arglists (meta #'map)) |
| 22:53 | clojurebot | ([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]) |
| 22:53 | ari____ | the underscore isn't accurate, I'm using the namespace as an example. |
| 22:53 | hiredman | but that only works on vars holding functions |
| 22:53 | ari____ | the real namespace is org.x.y, for instance. |
| 22:53 | hiredman | clojurebot: compiling? |
| 22:53 | clojurebot | Pardon? |
| 22:53 | hiredman | clojurebot: compile |
| 22:54 | clojurebot | the unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation |
| 22:54 | Jomyoot | is transient much faster than persistent? |
| 23:03 | ari____ | hiredman: both of these items are true in my case, e.g. java -cp ~/clojure.jar:./classes:./org.x clojure.main |
| 23:03 | ari____ | (compile 'org.x.y) |
| 23:04 | ari____ | java.io.IOException: No such file or directory (y.clj:1) |
| 23:04 | hiredman | sound pretty clear cut to me |
| 23:04 | hiredman | ~classpath |
| 23:04 | clojurebot | classpath is (System/getProperty "java.class.path") |
| 23:04 | hiredman | bah |
| 23:04 | hiredman | ~namespace |
| 23:05 | clojurebot | namespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it |
| 23:06 | hiredman | if you have a namespace foo.bar and relative to your pwd there exists a file foo/bar.clj then to get foo.bar in your classpath you just need to put the pwd on the classpath |
| 23:08 | ari____ | the namespace is org.x.y, on my pwd there is a directory org with a subdirectory x and a file y.clj, as well as a classes directory. java -cp $foo whereas $foo has a colon-separated list of directories including ., ./classes, and ./org and ./org/tim. |
| 23:09 | hiredman | *shrug* |
| 23:14 | _mst | ari____: does your 'classes' directory already exist? I've seen that error when I've forgotten to 'mkdir classes' before compiling... |
| 23:15 | ari____ | yup |
| 23:15 | ari____ | it's very bizarre |
| 23:15 | ari____ | it keeps throwing 'No such file or directory' for y.clj |
| 23:15 | ari____ | even though the file is clearly there |
| 23:15 | hiredman | well, obviously you are doing something wrong |
| 23:15 | ari____ | obviously :p |
| 23:16 | hiredman | so strip down what you are doing |
| 23:16 | hiredman | follow the exact example on the website |
| 23:17 | ari____ | pardon the snark, but the website has a lot of examples of gen-class but no real examples of the compile process |
| 23:17 | ari____ | there are some generalized rules |
| 23:17 | hiredman | ~compile |
| 23:17 | clojurebot | the unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation |
| 23:17 | hiredman | there is, at the bottom of that webpage |
| 23:18 | ari____ | (compile xyz) is never called |
| 23:18 | hiredman | it shouldn't be |
| 23:19 | hiredman | (compile 'org.x.y) |
| 23:22 | Jomyoot | is transient much faster? |
| 23:23 | hiredman | faster for what? |
| 23:23 | ari____ | http://pastie.org/572001 |
| 23:23 | ari____ | perhaps there's just some error in invocation on my part |
| 23:23 | ari____ | i've tried all kinds of variations though |
| 23:24 | lisppaste8 | _mst pasted "tiny compilation example" at http://paste.lisp.org/display/84798 |
| 23:24 | hiredman | ari____: remove yz from your classpath and replace it with the pwd |
| 23:24 | _mst | that worked for me... |
| 23:24 | cark | ari____:that might niot be what you want...but i personally use compile from the command line |
| 23:25 | hiredman | ari____: that is not going to work anyway |
| 23:25 | hiredman | the file has to exist |
| 23:25 | ari____ | the file does exist. |
| 23:26 | hiredman | ari____: in the example you pasted it looks like you are trying to compile a namespace created at the repl |
| 23:26 | ari____ | look at the top of the example |
| 23:26 | ari____ | even when not in the REPL |
| 23:26 | ari____ | it won't compile ala _mst's example |
| 23:26 | hiredman | fine |
| 23:27 | ari____ | which is basically same as mine |
| 23:27 | hiredman | did you do what I said yet? |
| 23:27 | hiredman | ari____: remove yz from your classpath and replace it with the pwd |
| 23:27 | ari____ | yes |
| 23:27 | hiredman | that will work |
| 23:28 | cark | -> (defn -main [] println "Test") i beleive you're missing a pair of parenthesis there |
| 23:28 | hiredman | if it does not there is something else you are not sharing |
| 23:29 | lisppaste8 | ari_____ pasted "compiling problem" at http://paste.lisp.org/display/84799 |
| 23:30 | ari____ | cark: corrected but still a problem |
| 23:31 | cark | the compile call gives an io error, but does a "require" or "use" work ? |
| 23:31 | clojurebot | the unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation |
| 23:31 | ari____ | use returns nil |
| 23:31 | cark | and is it working ? |
| 23:31 | cark | i mean can you call the main function ? |
| 23:32 | ari____ | yes |
| 23:32 | hiredman | ari____: the namespace declaration doesn't contain (:gen-class) |
| 23:32 | ari____ | hiredman: I only removed it to follow mst's example |
| 23:32 | cark | ah that's it |
| 23:32 | ari____ | hiredman: in the original one, I had it |
| 23:32 | ari____ | and still didn't work |
| 23:32 | ari____ | i'll try it again |
| 23:33 | ari____ | nope |
| 23:33 | ari____ | there is something weird :/ |
| 23:34 | ari____ | this is a pretty barebones example. |
| 23:34 | _mst | ari____: I just followed your example (having fixed the parens) and it worked using clojure-1.0 |
| 23:34 | _mst | at first I got exactly the same error and then remembered to create the classes directory :) |
| 23:34 | cark | try putting your test directory in a src dir, and add the src directory to the classpath |
| 23:34 | cark | i have still not upgraded to 1.0 =P |
| 23:35 | _mst | your classes directory is at the same level as yz? not inside of it? |
| 23:36 | Jomyoot | is transient feature released? |
| 23:36 | Jomyoot | or no? |
| 23:36 | Jomyoot | also does transient benefit collections like hash map? |
| 23:36 | Jomyoot | or only vector |
| 23:37 | cark | only vectors right now i think |
| 23:37 | cark | and not officially released either |
| 23:38 | ari____ | cark: nope, that doesn't seem to have worked |
| 23:38 | ari____ | clearly i'm doing something wrong, though what I have no idea |
| 23:38 | Jomyoot | will hashmap benefit from transient eventually? |
| 23:39 | cark | haslao are already using mutation under the hood |
| 23:39 | cark | hashmaps i mean =) |
| 23:39 | lisppaste8 | ari_____ annotated #84799 "untitled" at http://paste.lisp.org/display/84799#1 |
| 23:39 | lisppaste8 | hiredman annotated #84799 "example" at http://paste.lisp.org/display/84799#2 |
| 23:39 | ari____ | what is supposed to be done at that stage? |
| 23:39 | clojurebot | that is not what I wanted |
| 23:40 | ari____ | thanks hired |
| 23:40 | ari____ | 1sec |
| 23:43 | ari____ | oh ho |
| 23:43 | ari____ | doesn't work with your example, hired |
| 23:43 | hiredman | words hear |
| 23:43 | ari____ | yeah |
| 23:43 | hiredman | bah |
| 23:43 | hiredman | here |
| 23:43 | ari____ | something with my version of clojure maybe |
| 23:43 | cark | what's your jvm version ? |
| 23:43 | hiredman | are following my example exactly? |
| 23:44 | ari____ | 1.6.0_13 |
| 23:44 | ari____ | hiredman: yes, to the letter |
| 23:47 | hiredman | where did you get your clojure jar? |
| 23:48 | ari____ | must have been a transient bug between two releases, 1.1.0-snapshot works fine |
| 23:48 | lisppaste8 | ari_____ annotated #84799 "untitled" at http://paste.lisp.org/display/84799#3 |
| 23:48 | ari____ | thanks. |
| 23:48 | ari____ | :) |
| 23:49 | ari____ | appreciate your patience |