2008-10-10
| 00:57 | mhinchey | slime fails to start with the latest clojure. Anyone else having a problem? |
| 01:23 | yangsx | mhichey: how latest is it? |
| 01:29 | tWip | mhinchey: I had the same problem |
| 01:29 | mhinchey | yangsx: svn 1057 |
| 01:29 | tWip | Complained about *1 symbol on core.clj:124 |
| 01:30 | mhinchey | tWip: hmm, I wrote that part, but it does work with the latest clojure |
| 01:30 | tWip | oh ok. I'm using the latest released 20080916 |
| 01:30 | mhinchey | my problem is I think caused by Rich's new ## changes |
| 01:31 | mhinchey | I'll post to the group |
| 01:32 | tWip | but the *1 thing should work on latest svn rev clojure? I'll need to try that then |
| 01:33 | yangsx | mhinchey: I just updated to svn 1057 and you're right |
| 01:36 | lisppaste8 | yangsx pasted "clojure svn 1057 failed with slime" at http://paste.lisp.org/display/68237 |
| 01:37 | mhinchey | yangsx: yes |
| 01:38 | mhinchey | tWip: yes, *1, *2, *3 are supported like clojure's internal repl, the previous 3 input commands |
| 01:38 | tWip | nice |
| 01:41 | mhinchey | tWip: I think most people use clojure from svn or github rather than the releases, so other projects like swank stay current with the svn clojure |
| 01:46 | tWip | yeah, but I like releases... especially at work if I need to depend on a version :) |
| 01:47 | yangsx | mhinchey: I checkout svn 1056 and that works fine with slime. You're right, svn 1057 is the culprit. |
| 01:48 | mhinchey | yangsx: thanks, I posted to the group |
| 01:49 | lisppaste8 | yangsx annotated #68237 with "changes in svn 1057 breaks swank-clojure" at http://paste.lisp.org/display/68237#1 |
| 01:56 | scgilardi | http://github.com/mikehinchey/swank-clojure/tree/master has a fork of jochu's swank for clj that supports *1, *2, *3 |
| 01:58 | mhinchey | scgilardi: jochu merged that into his |
| 01:58 | scgilardi | oh cool |
| 02:00 | scgilardi | temporarily reverting the ## reader macro should work for now, right? |
| 02:01 | mhinchey | yes |
| 03:06 | lisppaste8 | schlarf pasted "eval and refs" at http://paste.lisp.org/display/68240 |
| 03:07 | schlarf | can someone help me with that? i want to be able to change a and then just re-eval c tog et the new value(30) |
| 03:08 | hoeck | schlarf: why `eval'? |
| 03:10 | hoeck | schlarf: (dosync (ref-set a 3)) |
| 03:11 | hoeck | instead of (def a 3) |
| 03:12 | schlarf | hoeck: i am writing an object-system, iw ant to be able to define a method as a list then callt he method later and have it re-lookup the variables(the objects attributes) |
| 03:13 | schlarf | ref-set doesnt work by itself |
| 03:15 | schlarf | ah i see |
| 03:20 | hoeck | you need to wrap ref-set in a transaction with (dosync ..) |
| 03:27 | schlarf | yes |
| 03:39 | schlarf | if i have a reference number, how can i get its value? i mean it is not deffed just like (ref 4) |
| 03:39 | schlarf | then i have clojure.lang.Ref@14ce5eb |
| 03:39 | schlarf | and @ at that doesnt work... |
| 05:57 | schlarf | how can i replace a symbol ina list with something from another list? |
| 05:58 | schlarf | like i ahve (* a b) and a list of (a -> func(a) b -> func(b)) and i want eval(* a b) to replace a aiwth func(a) when ti is run |
| 06:01 | parth_m | schlarf: If I understand you correctly, is this what you want? |
| 06:02 | parth_m | user[1] => (map #(% {:a 1 :b 2} %) [:a :b :c :d]) |
| 06:02 | parth_m | (1 2 :c :d) |
| 06:02 | parth_m | Instead of list (a -> func(a) b -> func(b)) I have used a map {:a 1 :b 2} |
| 06:13 | schlarf | yes thanks think it is |
| 09:54 | tayssir | Hi! When installing Clojure with Slime integration, should I ignore the readme files in the Jochu-* directories and just do what it says on the Clojure wiki? |
| 09:55 | tayssir | There's all sorts of autoload stuff in the Jochu-* readme files, which aren't mentioned on the wiki. |
| 10:53 | tayssir | Hi, where do I find the clojure.jar file, if I compiled it from SVN using Mven? The closest I see is clojure-lang-1.0-SNAPSHOT.jar. |
| 10:53 | H4ns | tayssir: that is it. |
| 10:53 | alec | I use that one - it ends up in target/ |
| 10:54 | tayssir | Ah, thanks! |
| 10:55 | rhickey | http://www.pragprog.com/titles/shcloj/programming-clojure |
| 10:56 | gnuvince | Nice! |
| 10:56 | tWip | very nice! |
| 10:56 | H4ns | cool! |
| 10:57 | gnuvince | http://www.reddit.com/r/programming/comments/76dfm/upcoming_book_from_the_pragmatic_programmers/ |
| 10:58 | tWip | I don't get the cover image though :P |
| 11:00 | H4ns | seems pretty clear! |
| 11:02 | rhickey | heh |
| 11:09 | tayssir | Cathedral vs. bazaar, maybe? |
| 11:10 | gnuvince | I don't think the PP book covers have any real significance |
| 11:10 | gnuvince | The Ruby on Rails book 2nd edition has a skater boy on it |
| 11:11 | gnuvince | http://www.pragprog.com/titles/rails2/agile-web-development-with-rails |
| 11:14 | tayssir | I suspect that has to do with the soul grinding that skaters do on stair-rails. |
| 11:14 | cmvkk | wouldn't it be because agility is required to skate well? |
| 11:15 | rhickey | I like the Clojure cover better, seems more aspirational |
| 11:16 | rhickey | vs a picture of a hasp or something |
| 11:16 | solkis | reminds me of of a fractal almost |
| 11:17 | Chouser | I see parens |
| 11:17 | fogus | 200 pgs! My kind of book. |
| 11:17 | gnuvince | Clojure has been out for what, a year now? |
| 11:18 | rhickey | just about |
| 11:18 | gnuvince | It sure is nice to see books already being written about it. |
| 11:20 | solkis | rhickey: this must be satisfying to see after your years or hard work... congrats! |
| 11:21 | rhickey | I count the release as Oct 16, 2007, when I sent an email to the jFli and Foil lists, picked up by Planet Lisp, then Reddit, and the snowball's been running downhill ever since |
| 11:22 | Chouser | oo, so it's almost the anniversary. Party at my house! |
| 11:23 | gnuvince | Chouser: where is that? |
| 11:23 | Chouser | Fort Wayne, Indiana |
| 11:23 | gnuvince | Yeah, kinda of a long drive for me. |
| 11:24 | Chouser | Where are you? |
| 11:24 | gnuvince | Montreal |
| 11:24 | Chouser | Ah, indeed. |
| 11:24 | gnuvince | It's about 10 hours to get to Sandusky, OH. |
| 11:42 | rhickey | interesting watching Erlangers muse about how to handle the transactional nature of the Clojure ant sim: http://groups.google.com/group/erlang-questions/browse_frm/thread/7b9b002368a378dd?hl=en# |
| 11:46 | arohner | wow that is convoluted |
| 11:48 | rhickey | it will be interesting to see where they end up |
| 11:49 | arohner | yeah |
| 11:55 | Chouser | that page is having a lot of trouble loading for me |
| 11:55 | rhickey | Chouser: which one? |
| 11:55 | Chouser | the google group erlang link you posted |
| 11:56 | Chouser | hm, all google groups pages? |
| 11:57 | Chouser | huh. some kind of browser issue. personal problem... |
| 11:57 | alec | happened to me too |
| 11:57 | alec | ended up loading after a while |
| 11:58 | cemerick | yeah, groups is having issues |
| 11:58 | Chouser | I tried in a fresh firefox profile and it came right up. |
| 12:19 | arohner | lisppaste8: url |
| 12:19 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 12:23 | lisppaste8 | arohner pasted "list vs. '" at http://paste.lisp.org/display/68264 |
| 12:24 | arohner | in that paste, can someone please help me understand why #4 is different from #5? |
| 12:25 | hircus | arohner: quote (either (quote foo) or 'foo) means take the expression literally |
| 12:25 | hircus | so System/currentTimeMills is never called in #5 |
| 12:26 | rhickey | user=> (list [1 2 (System/currentTimeMillis)]) |
| 12:26 | rhickey | ([1 2 1223655773276]) |
| 12:26 | rhickey | user=> '([1 2 (System/currentTimeMillis)]) |
| 12:26 | rhickey | ([1 2 (System/currentTimeMillis)]) |
| 12:26 | arohner | ok, I don't know why I got it stuck in my head that quote == list |
| 12:27 | arohner | list evaluates its arguments |
| 12:27 | hircus | arohner: well, it works until you try sticking variables and/or expressions :) |
| 12:27 | hircus | does clojure have quasiquotes like Scheme, I wonder |
| 12:27 | hircus | so you can do `([1 2 ,(System/currentTimeMillis)]) |
| 12:27 | rhickey | one of the nice things about Clojure is that you have evaluated vectors as an alternative to (back)quoted lists as data |
| 12:28 | lisppaste8 | alec annotated #68264 with "fix #5" at http://paste.lisp.org/display/68264#1 |
| 12:29 | rhickey | and vectors are definitely preferred for that - I'd much rather see [1 2 3] than '(1 2 3) |
| 12:29 | arohner | in this case, I'm trying not to evaluate things until later |
| 12:30 | arohner | so I'd like to delay that function call |
| 12:30 | arohner | is there a better way to do that? |
| 12:31 | rhickey | arohner: are you writing a macro? |
| 12:32 | arohner | I think I have to |
| 12:33 | TommyOnMac | hi |
| 12:33 | arohner | TommyOnMac: hi |
| 12:35 | TommyOnMac | Are there any more Freemind lovers in here? |
| 12:36 | TommyOnMac | I found a couple of mind maps for C# and Python, and wanted one for Clojure |
| 12:36 | TommyOnMac | ( http://freemind.sourceforge.net/wiki/extensions/freemind/flashwindow.php?startCollapsedToLevel=3&initLoadFile=/wiki/images/e/ee/CSharp_2_WebLinks2.mm&mm_title=C%23%202.0%20Computer%20Language%20-%20Contents ) |
| 12:36 | TommyOnMac | sorry for the long url |
| 12:36 | TommyOnMac | I've entered "The Reader" into Freemind just to see how it would look like |
| 12:36 | TommyOnMac | It's Clojure.png and .mm in here http://groups.google.com/group/clojure/files |
| 12:36 | TommyOnMac | what do you guys think? |
| 12:37 | TommyOnMac | WOuldn't it be lovely to have the whole language / api in that form? |
| 12:40 | cemerick | I've always been very intrigued with the mind mapping concept, but I've never liked any of the tools. |
| 12:40 | TommyOnMac | Freemind is very nice |
| 12:40 | TommyOnMac | it's non-bloated and to the point |
| 12:41 | cemerick | Visualizations can obviously be very helpful in some circumstances, |
| 12:41 | TommyOnMac | perfect for taking notes during a meeting |
| 12:41 | cemerick | It's hard to beat a whiteboard :-) |
| 12:42 | TommyOnMac | it's hard to save a whiteboard |
| 12:42 | TommyOnMac | and mail it |
| 12:42 | TommyOnMac | :) |
| 12:42 | cemerick | true, true; I've been using http://qipit.com lately for that. A hacky solution, but good in a pinch. |
| 12:46 | TommyOnMac | map enter to sibling and tab to child |
| 12:47 | scottj | TommyOnMac: looks good. |
| 12:47 | arohner | is `(~foo) inside of a macro equivalent to '(foo) outside of a macro? |
| 12:48 | TommyOnMac | rtfmm :) |
| 12:50 | arohner | I've tried |
| 12:51 | arohner | I have an existing function that takes & arguments |
| 12:51 | scottj | arohner: Does ~foo evaluate foo? |
| 12:52 | arohner | I want to write a macro that takes & arguments, and saves the arguments in a datastructure, and then later apply the arguments to the existing function |
| 12:52 | cemerick | arohner: I've always ended up using (quote foo) inside a macro; I've not been able to puzzle out a more succinct way to emit '(foo) |
| 12:52 | cemerick | ...which is probably due to my less-than-stellar skillz :-) |
| 12:53 | cemerick | or, sorry, ~(quote foo) |
| 12:53 | TommyOnMac | instead of one fat macro, can you divide it into smaller ones? |
| 12:54 | arohner | cemerick: shouldn't it be (quote ~foo)? |
| 12:54 | arohner | TommyOnMac: right now, it's only two lines. :-) my trouble is coming from trying to understand macros, quote and quasiquote |
| 12:55 | TommyOnMac | and you tried macroexpand? |
| 12:55 | cemerick | arohner: ah, right; (quote ~foo) => 'foo, (quote ~foo) => '(foo) |
| 13:12 | leafw | hi all. How can one convert a string such as "#^ints" to a proper symbol to be used for introducing a primitive type hint? |
| 13:13 | leafw | I know there is a way to do it, just can't recall it -- clojure's library is very horizontal |
| 13:15 | rhickey | leafw: putting #^ in the string sets you off on the wrong path |
| 13:16 | leafw | good to know . How would you do it? I am trying to make a macro that takes any array type and can process it natively |
| 13:16 | leafw | int[] float[] short[] byte[] |
| 13:17 | leafw | I thought of declaring a table of class vs type decoration, and then use it accordingly in the body of the macro |
| 13:17 | rhickey | leafw: you've looked at amap and areduce? |
| 13:18 | leafw | reading doc now |
| 13:19 | arohner | if I have a macro take takes a rest arg, is there a way to get the contents of the rest arg into the macro body? |
| 13:19 | rhickey | look at the code too, both are macros that manipulate primitive arrays generically |
| 13:19 | leafw | the problem here is that I don't know the type of the array being passed. Comes from an ugly library, the method in question returnin an Object, so one has to either know it or guess it |
| 13:19 | leafw | thanks, will look at the amap/.areduce definitions |
| 13:19 | rhickey | arohner: sure, in a syntax-quote, ~@ |
| 13:21 | leafw | does amap consider the problem of signed byte ? I.e. a byte[] contains values from -128 to 127, so adding -5 to it is wrong if the math considers ints. One has to 0xff the byte first to an int, then (byte ...) it back. |
| 13:21 | leafw | but one doesn't want to do that for, say, floats |
| 13:21 | arohner | rhickey: thanks! |
| 13:21 | leafw | sp the body of the function to write has to know the type, to be able to fix these issues |
| 13:22 | rhickey | leafw: that's not about the mapping but the operation, and right now byte arrays are second class vs. int/long/float/double |
| 13:22 | leafw | byte arrays are second class? What do you mean? |
| 13:23 | leafw | byte arrays are my primary data type, for imaging (8-bit images in ImageJ) |
| 13:23 | rhickey | there's inlining for the other 4 |
| 13:23 | leafw | but not for byte[], urgh |
| 13:24 | leafw | you are missing short[] as well. |
| 13:24 | leafw | another very much used data type in Image/j (16-bit images). |
| 13:26 | leafw | so I think I'm going to go ahead and try thathorrible approach of mine. How would one generate a type decorator in place? |
| 13:26 | leafw | you sid strings is not the way to go |
| 13:30 | leafw | I know there is a function to create symbols in place, just forgot its name and I can't find it in the docs. If someone recalls its name I'd appreciate it. |
| 13:31 | gnuvince | (gensym)? |
| 13:31 | rhickey | (doc symbol) |
| 13:31 | leafw | no, gensym is to create unqieurly named symbols |
| 13:31 | leafw | uniquely |
| 13:32 | leafw | nice, so (symbol "#^ints") works. |
| 13:33 | rhickey | no #^ is not part of the symbol when used - #^x y === #^{:tag x} y |
| 13:34 | rhickey | user=> '#^x y |
| 13:34 | rhickey | y |
| 13:34 | rhickey | user=> (meta '#^x y) |
| 13:34 | rhickey | {:tag x} |
| 13:35 | leafw | hum |
| 13:35 | Chouser | why does the #^ have to be quoted? |
| 13:36 | rhickey | #^ tells the reader, make the next thing read the metadata for the following thing |
| 13:36 | rhickey | Chouser: we're talking about macros - just trying to show what the reader reads given forms |
| 13:36 | leafw | still the question remains, then, on how would one generate the '#^x for meta to do it ... |
| 13:37 | leafw | Chouser: I would like to automate type decoration for #^bytes and #^shorts |
| 13:37 | Chouser | (meta (with-meta {} {:tag Integer})) |
| 13:38 | rhickey | leafw: you need to understand code is data |
| 13:38 | rhickey | #^bytes isn't a thing in itself |
| 13:38 | leafw | rhickey: I admit I still don't get it |
| 13:38 | leafw | #^bytes is a metadata key, IIUC |
| 13:39 | rhickey | user=> '#^x y |
| 13:39 | rhickey | y |
| 13:39 | rhickey | user=> (meta '#^x y) |
| 13:39 | rhickey | {:tag x} |
| 13:39 | rhickey | you need to understand this^^ |
| 13:39 | Chouser | I continue to have trouble groking metadata on vars vs. values, and I'm not sure if that's related to quoting the #^x or not. |
| 13:39 | rhickey | given #^x y the reader produces a symbol |
| 13:39 | leafw | ok |
| 13:39 | rhickey | y |
| 13:39 | Chouser | I just thought I'd ask questions since leafw brought it up. :-) |
| 13:40 | rhickey | with the metadata {:tag x} |
| 13:40 | leafw | so (meta '#^x y) is calling meta on the var y created with metadata #^x |
| 13:41 | rhickey | if you wanted to programmatically do the same, you could say (with-meta 'y {:tag 'x}): |
| 13:41 | rhickey | user=> (with-meta 'y {:tag 'x}) |
| 13:41 | rhickey | y |
| 13:41 | rhickey | user=> (meta (with-meta 'y {:tag 'x})) |
| 13:41 | rhickey | {:tag x} |
| 13:41 | leafw | aha |
| 13:41 | leafw | why is y quoted? |
| 13:42 | rhickey | macros don't produce output for consumption by the reader - they produce data for consumption by the compiler |
| 13:42 | leafw | I see, with-meta creates a symbol with name the first argument |
| 13:42 | leafw | humno |
| 13:42 | rhickey | no, with-meta returns a version of whatever it was passed, in this case the symbol y, with the metadata provided |
| 13:43 | leafw | ok |
| 13:43 | Chouser | ah, is the ' in '#^x y effectively quoting the whole thing? |
| 13:43 | leafw | this fails: {:tag '#^ints} |
| 13:44 | leafw | I must confess I am rather confused. |
| 13:44 | leafw | is even possible at all what I am trying to do? |
| 13:45 | rhickey | Chouser: yes ' == quote the next thing read and return it, #^ == add the next thing read as metadata to the following thing read and return that |
| 13:45 | leafw | so #^ is a macro? |
| 13:45 | Chouser | (meta '#^ints y) ==> {:tag ints} |
| 13:45 | Chouser | (meta (with-meta 'y {:tag 'ints})) ==> {:tag ints} |
| 13:46 | rhickey | leafw: yes, see http://clojure.org/reader |
| 13:46 | leafw | I see, I was confising then #^ints with ints. The first is the #^ "macro" that passes its attched hint to the next thing |
| 13:46 | leafw | s/confising/confusing/ |
| 13:46 | rhickey | a reader macro |
| 13:47 | leafw | thanks rhickey |
| 13:47 | rhickey | yw |
| 14:11 | lisppaste8 | leafw pasted "type hints" at http://paste.lisp.org/display/68270 |
| 14:12 | leafw | just pasted some code ... each element works separately, but together they don't |
| 14:13 | leafw | particularly, (println (get table-types (.getClass ip))) works, but fails when run in the 'add' function |
| 14:14 | leafw | comments appreciated. |
| 14:14 | rhickey | leafw: without a macro, there's no way to convey the hints to the compiler - attributing values at runtime has no effect |
| 14:14 | leafw | rhickey: ok |
| 14:14 | leafw | so it needs to be a macro |
| 14:15 | leafw | I am still not comfortable with macros, so I tried defn first. Thanks for th e tip. |
| 14:18 | Chouser | leafw: have you read any kind of tutorial on writing macros? |
| 14:18 | leafw | just changing defn to defmacro should work in this very simple case. but it doesn't: the error: Caused by: java.lang.IllegalArgumentException: No matching field found: getPixels for class clojure.lang.PersistentList |
| 14:18 | leafw | I did. I am familiar with `, ~ and ~@ |
| 14:19 | leafw | but the whole thin just did click yet, obviously |
| 14:19 | Chouser | ok. On Lisp was what convinced me macros were king, and also taught me how to write them |
| 14:19 | Chouser | that book's available free online |
| 14:19 | leafw | gigamonkeys did it for me. |
| 14:21 | cemerick | Yeah, On Lisp is the bible in that area. |
| 14:21 | leafw | (defmacro [x] (println x)) works, but in the pasted case, it parses the argument ip as a PersistentList |
| 14:21 | cemerick | If you find a sympathetic printer, you can get the online PDF bound up. |
| 14:21 | leafw | I read on screen with the eee or a iLiad from iRex |
| 14:21 | leafw | the latter is pretty nic: allows for notes to be written on pdfs. |
| 14:23 | Chouser | I think what you're trying to do is made trickier by the fact that type hints (and other metadata) aren't printed. |
| 14:23 | rhickey | Chouser: how so? |
| 14:25 | leafw | any ideas why clojure thinks that ip should be a PersistentList? It's clearly not -- it's an Object, of type byte[], float[] ... |
| 14:25 | leafw | sorry, an ImageProcessor ... whose .getPixels returns those byte[], float[] ... as Object |
| 14:26 | alec | leafw: code in a defmacro that's not inside an interpolated list is run at macroexpand-time |
| 14:26 | leafw | ok |
| 14:26 | leafw | so it's a list. |
| 14:26 | leafw | thanks |
| 14:27 | alec | so if you have (defmacro x [y] (println y)) or whatever, at macroexpansion time, it will print the argument |
| 14:27 | Chouser | The paste.lisp.org captcha cracks me up |
| 14:27 | lisppaste8 | Chouser pasted "type hints don't print" at http://paste.lisp.org/display/68271 |
| 14:27 | leafw | alec: I understand now why it was printing not im my repl but on the terminal. |
| 14:28 | Chouser | oh. |
| 14:29 | Chouser | (defmacro th [] `(with-meta 'y {:tag 'ints})) |
| 14:30 | rhickey | (binding [*print-meta* true] (prn (macroexpand '(th)))) |
| 14:31 | rhickey | could provide repl binding so you could do: (set! *print-meta* true) and have it stick |
| 14:31 | Chouser | oh |
| 14:32 | Chouser | oh! |
| 14:32 | leafw | rhickey: shorts and bytes are not proper type hints for arrays? |
| 14:32 | arohner | I like that |
| 14:32 | Chouser | my binding was gone by the time the repl printed. duh. |
| 14:32 | leafw | in my macroexpansion they appear as (quote user/bytes) ad (quote user/shorts) |
| 14:34 | lisppaste8 | leafw annotated #68270 with "second round" at http://paste.lisp.org/display/68270#1 |
| 14:35 | Chouser | I don't think you want to have your whole table-types in every expansion |
| 14:36 | leafw | Chouser: no, I don't. This is just a test. Which fails. |
| 14:36 | Chouser | :-) |
| 14:36 | leafw | java.lang.IncompatibleClassChangeError (native_arrays.clj:0) |
| 14:36 | leafw | the line number doesn't help, certainly. The other error with the file name in it is line 14: the macro invocation |
| 14:36 | Chouser | do you have a working example of what you want your macro to produce? |
| 14:37 | leafw | once I have the type, I can decide to do special things in generic functions that would apply kernels to the image |
| 14:37 | leafw | such as 0xff each byte before doing math, but not shorts or floats |
| 14:38 | Chouser | ok, but I would highly recommend writing up one complete example of what the macro might produce, and make sure that's working. |
| 14:38 | leafw | I could do it all with reflection or duplicating and so, but I'd rather not: very large images. |
| 14:38 | Chouser | then move on to writing a macro that can produce that |
| 14:39 | leafw | the part that needs testing is how to assign types on the fly, not the other one. |
| 14:40 | leafw | I'mnot even sure that bytes and shorts are valid array flags. I think they are not, for what rhickey said as being "second class". |
| 14:41 | Chouser | shorts and bytes appear to be valid hints |
| 14:42 | Chouser | based on Compiler.java, around line 779 |
| 14:43 | Chouser | so do you want to write "generic" functions that work on boxed objects, but then in places have an "if" and do something different for a particular type? |
| 14:49 | leafw | Chouser: yes, I want to do so. Just because byte[] is such an aweful type to work with, and just because my byte[] arrays are so large. I wish they were signed, but changing tht is beyond my control. |
| 14:51 | leafw | I'm reading the Compiler.java, even chars and booleans are supported |
| 14:59 | lisppaste8 | rhickey pasted "mcast" at http://paste.lisp.org/display/68273 |
| 15:00 | rhickey | mcast is a macro that adds a type hint to an expression |
| 15:00 | leafw | which needs a very recent svn checkout right :) |
| 15:00 | rhickey | no |
| 15:01 | leafw | hum, fails to run here |
| 15:01 | leafw | trunk@1043 |
| 15:03 | leafw | sorry, must be my interpreter. Line by line it works; all pasted together, it doesn't. |
| 16:45 | solkis | I just documented a detailed, step-by-step procedure for getting clojure, emacs and slime/swank setup on ubuntu here >> http://riddell.us/clojure |
| 16:46 | solkis | I thought about putting in on the wiki but its pretty specific to ubuntu and some of this information was already covered. |
| 16:46 | rhickey | you could stick a link on the wiki |
| 16:46 | solkis | It contains some detailed steps and then demonstrates the ants.clj script. |
| 16:47 | solkis | rhickey: will do |
| 16:48 | solkis | I'm a newb to fp and clojure and it is definitely at that level. |
| 16:49 | achim_p | hi! why is the use of eval generally frowned upon in lisp circles? i'm quite a lisp n00b, admittedly, but isn't eval quintessential to the whole code=data thing? |
| 16:50 | rhickey | macros are the quintessential code is data, eval usually indicates not grokking macros, other than when writing a repl or such |
| 16:53 | tayssir | Eval is typically viewed as too powerful a hammer; typically there's simpler ways to do what you want. |
| 16:54 | tayssir | Or at least more readable ones. |
| 16:58 | achim_p | okay, thanks! i've yet to get a feel for this. not that i was tempted to use it yet, but whenever i see it mentioned, it's followed by a statement like "of course, we don't use it", and i wondered why that is |
| 17:20 | tayssir | Is the Slime setup info at all current on the wiki page? I'm thinking of replacing it. But maybe it works for Windows people; I'm only testing on MacOS. |
| 17:20 | tayssir | http://en.wikibooks.org/wiki/Clojure_Programming#Emacs_.2F_Slime_Integration |
| 17:21 | danlarkin | tayssir: what didn't work for you? |
| 17:22 | tayssir | Well, I suspect you need to require 'clojure-auto and 'swank-clojure-autoload. And maybe needing to create the file clojure.cmd is outdated, since 'swank-clojure-autoload seems to handle that for me. |
| 17:24 | tayssir | It didn't work when I tried translating it to unix; I found the READMEs in jochu's stuff more accurate. |
| 17:24 | tayssir | (At least for my setup.) |
| 17:50 | solkis | tayssir: I just created a tutorial today at: http://riddell.us/clojure |
| 17:50 | solkis | and linked to it on the wiki |
| 17:51 | solkis | tayssir: it's for Ubuntu, and it's pretty basic but it works for me |
| 17:55 | tayssir | solkis: Cool, nice walkthrough! |
| 17:56 | solkis | tayssir: thanks... I hope it will help some others get started out there, especially those new to *nix |
| 17:57 | solkis | tayssir: I'm not new to linux but I am to clojure ;-) |
| 17:59 | scottj | solkis: just checking, emacs-snapshot-gtk is in the stock ubuntu repositories? |
| 17:59 | scottj | (I just remember having to add a repository for it once upon a time) |
| 18:00 | solkis | scottj: yes, it should be, I tested these steps in a clean vm to be sure |
| 18:00 | scottj | ok |
| 18:04 | danlarkin | solkis: this is a very nicely formatted walkthrough, good job |
| 18:06 | solkis | danlarkin: thanks |
| 18:06 | karmazilla | am I suppose to get a ClassCastException on (take 10 (fnseq 1 #(2))) ? |
| 18:07 | danlarkin | 2 is not a function |
| 18:09 | rhickey | (take 10 (cons 1 (repeat 2))) |
| 18:10 | karmazilla | the thing is I want to use fnseq to create a lazy seq from the output of a function |
| 18:10 | karmazilla | s/want/am trying to/ |
| 18:11 | rhickey | what function? |
| 18:12 | rhickey | using fnseq is pretty rare vs lazy-cons |
| 18:12 | karmazilla | this is where I'm at: http://pastebin.com/df75b6f5 |
| 18:14 | rhickey | http://en.wikibooks.org/wiki/Clojure_Programming#Lazy_Fibonacci |
| 18:17 | karmazilla | oh... lazy-cons looks much more powerful when recursion enters the picture |
| 18:18 | rhickey | yes, and note the seq produced by lazy-cons is already thread-safe |
| 18:18 | rhickey | no need for that atomic stuff |
| 19:29 | karmazilla | can I tell the clojure version/revision from the repl? |
| 19:31 | retep | anoyone still there? playing around with clojure I'm puzzeld by partial's behaiviour |
| 19:31 | retep | (defn add12 (partial + 12)) |
| 19:32 | retep | throws Don't know how to create ISeq from: Symbol |
| 19:32 | retep | java.lang.RuntimeException: java.lang.IllegalArgumentException |
| 19:32 | albino | Is Stuart Halloway here? |
| 19:33 | karmazilla | retep: def instead of defn |
| 19:33 | retep | Oh. |
| 19:33 | retep | Yes. |
| 19:33 | retep | Of course. |
| 19:34 | retep | It's late in germany. Need some sleep. ;-) |
| 19:35 | retep | thanks. |