2009-02-24
| 00:00 | cmvkk | people do that kind of thing all the time. it's not my bag, but if it works for you, why not? |
| 00:00 | notallama | i think parens are wonderful creatures. |
| 00:00 | jbondeson | it reminds me of the C macro packages that let you write code like it was Fortran |
| 00:01 | notallama | has anyone made a python intepreter that requires a whole bunch of parens? that'd be great. |
| 00:01 | jbondeson | or people who go from windows to linux and rename everything C D E .. etc |
| 00:02 | cmvkk | heh...people do that? i have a partition on my drive mounted to /f, but this is the first time i saw that connection. |
| 00:03 | notallama | i went from windows to linux and it ate my boot sector. :/ |
| 00:03 | jbondeson | people will do things that make no sense in a new environment just to make it seem like they're in familiar territory |
| 00:03 | cmvkk | o dpm |
| 00:03 | cmvkk | crud |
| 00:03 | notallama | i tried again when i got a laptop and it's running well now. having 2 computers is so nice for trying new stuff. |
| 00:04 | cmvkk | i don't suppose anyone in here has messed around wtih the javax.sound.sampled package before have they? i am having a problem with it. |
| 00:04 | hiredman | the first time I installed linux it ate the boot sector of my dad's work computer |
| 00:05 | hiredman | (I was trying to install it and have it boot off a zip disk) |
| 00:05 | notallama | i had ubuntu running from a thumb drive when it happened. it was working for a couple days first. |
| 00:13 | hiredman | ,(pl inc $ inc $ inc 0) |
| 00:13 | clojurebot | java.lang.Exception: Unable to resolve symbol: pl in this context |
| 00:15 | hiredman | ,(pl inc $ inc $ inc 0) |
| 00:15 | clojurebot | java.lang.Exception: LazySeq used in 'if' |
| 00:20 | hiredman | that is most unfortunate |
| 00:21 | hiredman | I am pretty sure that is false positive too |
| 00:23 | danlarkin | ,(macroexpand-1 '(pl inc $ inc $ inc 0)) |
| 00:23 | clojurebot | java.lang.RuntimeException: java.lang.Exception: LazySeq used in 'if' |
| 00:23 | danlarkin | grrrrumble |
| 00:26 | jbondeson | hmmm, there's got to be a better way than (into {} (map vec (partition 2 '(:a "A" :b "B")))) |
| 00:27 | hiredman | uh |
| 00:27 | hiredman | ,(apply hash-map '(:a "A" :b "B")) |
| 00:27 | clojurebot | {:b "B", :a "A"} |
| 00:27 | jbondeson | hah |
| 00:27 | jbondeson | see |
| 00:28 | hiredman | ,(apply assoc {} '(:a "A" :b "B")) |
| 00:28 | clojurebot | {:b "B", :a "A"} |
| 00:28 | hiredman | ,(apply (reduce assoc {} '(:a "A" :b "B"))) |
| 00:28 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args passed to: core$assoc |
| 00:29 | hiredman | oh, right |
| 00:29 | jbondeson | tried the reduce way, just not the apply |
| 00:29 | hiredman | anyway |
| 00:31 | jbondeson | i hardly ever use maps (i mean who could possibly need any other data structure besides a list?) so i always screw the map functions up |
| 00:38 | dnolen | jbondeson do you want to preserve the order? |
| 00:39 | jbondeson | dnolen: nah, just looking to do keyed arg lookup with defaults |
| 00:40 | dnolen | gotcha |
| 01:14 | kalle135_ | http://alpha10.de |
| 01:19 | DTrejo | Hello everybody. Does anyone know if clojure would work with GWT? |
| 01:26 | DTrejo | I guess you guys are all asleep. I'll check in later. |
| 01:29 | hiredman | trolls is also <reply>Detritus like |
| 01:29 | hiredman | ~trolls is also <reply>Detritus like |
| 01:29 | clojurebot | Roger. |
| 01:30 | zakwilson | clojurebot: trolls? |
| 01:30 | clojurebot | Detritus like |
| 01:34 | DTrejo | clojurebot: trolls? |
| 01:34 | clojurebot | according to troll lore living beings move backwards through time |
| 01:36 | DTrejo | clojurebot: trolls? |
| 01:36 | clojurebot | trolls are like harmless particles that people have terrible allergies to. If you don't start shouting and blowing your nose at them, they're just misguided young men. |
| 01:37 | DTrejo | hey hiredman, zakwilson do you know if gwt works with Clojure? |
| 01:43 | DTrejo | nevermind, I got my question answered: compile Clojure to Java, decompile to source, then GWT that to JS |
| 01:50 | danlei | anyone got slime working with r1303? |
| 02:00 | jochu | danlei: Works fine over here, is it broken for you? |
| 02:01 | danlei | hm, i get a few errors |
| 02:01 | danlei | java.lang.Exception: Unable to resolve symbol: lazy-seq in this context (core.clj:70) |
| 02:02 | danlei | and so on, in the inferior-lisp buffer |
| 02:03 | jochu | Are you sure you're running r1303? lazy-seq is new / part of the recent lazier clojure. It should be defined. |
| 02:04 | danlei | hm, i updated everything (clojure, clojure-contrib, swank-clojure and clojure-mode), but i'll double-check. |
| 02:14 | danlei | hm |
| 02:14 | danlei | i'll try restarting emacs |
| 02:18 | danlei | well, i'm sure i'm at r1303, just ran mvn install, pulled clojure-mode/swank-clojure, and restarted emacs. |
| 02:18 | danlei | error messages: |
| 02:19 | danlei | java.lang.Exception: Unable to resolve symbol: lazy-seq in this context (core.clj:70) |
| 02:19 | danlei | java.lang.Exception: No such var: swank.swank/ignore-protocol-version (NO_SOURCE_FILE:9) |
| 02:19 | danlei | java.lang.Exception: No such var: swank.swank/start-server (NO_SOURCE_FILE:11) |
| 02:19 | danlei | hm ... |
| 02:23 | danlei | i think i've seen similar error messages some time ago ... but i'm not sure ... |
| 02:37 | jochu | danlei: Ack, sorry. Um - inside the *inferior-lisp* buffer can you evaluate (lazy-seq [1]) ? |
| 02:41 | danlei | no, neither in the inferior-lisp buffer, nor when running clj from the command line |
| 02:42 | danlei | hm, but svn info says r1303 and mvn install installed correctly |
| 02:45 | danlei | so i guess i'll have to install the branch with the lazy streams stuff, right? |
| 02:45 | hiredman | no |
| 02:45 | hiredman | lazy has been merged with the main branch |
| 02:46 | danlei | ok, thanks hiredman |
| 02:47 | hiredman | I would examine you classpath and make sure the clojure.jar in it is the right one |
| 02:47 | hiredman | your |
| 02:48 | danlei | i'm just checking. the odd thing is, i just did as always: svn up mvn install ... fire up slime |
| 02:49 | danlei | there was no possibility to check the rev from the repl, i guess? |
| 02:49 | jochu | Hmm - does 'unzip -l clojure.jar | grep lazy_seq' list anything? |
| 02:49 | danlei | a sec |
| 02:49 | hiredman | danlei: well, type lazy-seq |
| 02:50 | danlei | no lazy-seq ... ok |
| 02:50 | hiredman | ~def lazy-seq |
| 02:51 | danlei | hm, but i did double check my path with the path mvn installed the jar at (at least it said it did) |
| 02:51 | jochu | is there a clean and re-build? |
| 02:51 | hiredman | run ant clean |
| 02:51 | danlei | ok |
| 02:51 | hiredman | and stop using maven :( |
| 02:51 | danlei | sorry =) |
| 02:51 | danlei | i'm not a java guy |
| 02:52 | danlei | what would be better? just typing ant? |
| 02:52 | hiredman | yes |
| 02:52 | danlei | don't know much about that stuff |
| 02:52 | hiredman | ant clean then ant |
| 02:52 | jochu | I typically: ant clean && ant |
| 02:52 | danlei | ok, i'll ditch maven |
| 02:52 | danlei | thanks |
| 02:52 | hiredman | ant builds clojure.jar |
| 02:56 | danlei | ok, got lazy-seq working, thanks |
| 03:05 | danlei | ok, error messages are gone, but now i'll have another problem |
| 03:05 | danlei | Connection opened on local port 60599 |
| 03:05 | danlei | Connecting to swank on port 60599 |
| 03:05 | danlei | and nothing happens |
| 03:07 | danlei | s/i'll/i/ |
| 03:14 | cmvkk | let's say i have a million chunks of data that i have to generate, and i can generate that data in any order (or all at once concurrently), but i have to write it to file in a particular order. |
| 03:14 | cmvkk | what's the best way to make sure that happens while still preserving concurrency? watchers? |
| 03:15 | cmvkk | ideally i want to minimize the amount of time a chunk stays in memory before being written to file. |
| 03:16 | cmvkk | my idea right now is to number each chunk, then have a series of agents that grab a number off of an incrementing atom, generate that chunk, then put the data in a map ref assoced to its number. |
| 03:17 | cmvkk | then have a watcher on the ref that checks to see if the next chunk-to-be-written is in the map? |
| 03:18 | cmvkk | ...can refs even have watchers? |
| 03:18 | danlei | so, if i try to connect manually, by slime-connect 127.0.0.1 <port>, i get this: |
| 03:18 | danlei | Exception in thread "Read Loop Thread" java.lang.RuntimeException: java.lang.NumberFormatException: For input string: "" |
| 03:18 | danlei | et cetera |
| 03:22 | cgrand1 | cmvkk: yup refs have watchers |
| 03:23 | jochu | danlei: Try deleting ~/.slime/cljclass and see if that helps - but I'm taking off for the night. If you wind up still having issues, shoot me an email including the *slime-events* buffer and I'll take a look at it tomorrow. |
| 03:24 | danlei | ok, thanks jochu |
| 03:26 | danlei | works, thank you very much |
| 04:43 | Bracki | How do I prinln a vector of strings joining them with spaces? |
| 04:45 | ayrnieu | ,(interpose " " (map str [1 2 3 4])) |
| 04:45 | clojurebot | ("1" " " "2" " " "3" " " "4") |
| 04:46 | ayrnieu | ,(apply str (interpose " " (map str [1 2 3 4]))) |
| 04:46 | clojurebot | "1 2 3 4" |
| 04:46 | ayrnieu | ,(apply str (interleave ["hi" "there" "mon" "frere"] (repeat "\n"))) |
| 04:46 | clojurebot | "hi\nthere\nmon\nfrere\n" |
| 04:47 | ayrnieu | Bracki - I noticed that you started watching clj-actos ; I'm not going to do anything with it, so if you're interested I'd advice that you fork it, or study it to get what you want out of it. |
| 05:00 | Bracki | Yep, thx. |
| 05:26 | Bracki | FAQ |
| 05:26 | Bracki | ,FAQ |
| 05:26 | clojurebot | java.lang.Exception: Unable to resolve symbol: FAQ in this context |
| 05:28 | Bracki | Does _ get a special treatment? |
| 05:28 | Bracki | when used in bindings? |
| 05:29 | ayrnieu | ,((fn [a a] 3)) |
| 05:29 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--1178$fn |
| 05:29 | ayrnieu | ,((fn [a a] 3) 1 2) |
| 05:29 | clojurebot | 3 |
| 05:30 | ayrnieu | I'd expect that to error in a future version of clojure. [_ _] should not. |
| 05:31 | Bracki | Ah because the bindings weren't used in the body? |
| 05:31 | ayrnieu | and after AWizzArd writes his clojure lint, you can find unused variables in your code. This too should not warn on _ |
| 05:32 | Bracki | ,(doc frest) |
| 05:32 | clojurebot | java.lang.Exception: Unable to resolve var: frest in this context |
| 05:32 | Bracki | Hm, is frest gone? |
| 05:35 | Bracki | ,(doc fnext) |
| 05:35 | clojurebot | "([x]); Same as (first (next x))" |
| 05:43 | gregh | ,(doc second) |
| 05:43 | clojurebot | "([x]); Same as (first (next x))" |
| 05:43 | gregh | good to know. :) |
| 05:45 | Bracki | (doc last) |
| 05:45 | clojurebot | Return the last item in coll, in linear time; arglists ([coll]) |
| 05:45 | Bracki | How do I convert a String[] into a list or vector? |
| 05:46 | Bracki | Ah, lazy-seq. |
| 05:46 | alinp | (lazy-seq "abc") |
| 05:47 | alinp | ,(lazy-seq "abc") |
| 05:47 | clojurebot | (\a \b \c) |
| 05:47 | alinp | oh, you want to convert an array of Strings |
| 05:58 | Bracki | ,(import java.net InetAddress) |
| 05:58 | clojurebot | java.lang.ClassNotFoundException: java.net |
| 05:58 | Bracki | Why doesn't that work? |
| 06:05 | leafw | Bracki: check java interop. You may use (import 'java.new.InetAddress) or (import '(java.net InetAddress)) |
| 06:06 | leafw | the second one lets you add multiple imports from the same namespace. |
| 06:35 | djpowell | you probably just want seq rather than lazy-seq |
| 06:36 | djpowell | I heard rich mention a unit conversion language in one of his videos, does anyone remember what it was called? |
| 06:38 | djpowell | rhickey: what was that unit conversion program you mentioned in one of your videos |
| 06:58 | AWizzArd | ,(doc drop-while) |
| 06:58 | clojurebot | "([pred coll]); Returns a lazy sequence of the items in coll starting from the first item for which (pred item) returns nil." |
| 06:58 | AWizzArd | clojurebot: max people |
| 06:58 | clojurebot | max people is 149 |
| 07:05 | klibbigt | http://arclanguage.org/item?id=8903 <- the thing is, i dont know if this guy is joking or not, sadly i think he is serious(hopefully it is someone from this channel being ironic). |
| 07:12 | ayrnieu | [] is briefer than #() , fn is briefer than lambda , but clojure also lacks macrolet, symbol-macro, reader macros, several kinds of macro-useful puns. So it's not crazy to say that clojure is too verbose. |
| 07:12 | ayrnieu | as Let Over Lambda cautions: http://paste.lisp.org/display/75921 |
| 07:13 | ayrnieu | but this guy might've been a J hacker. |
| 07:19 | AWizzArd | ayrnieu: Rich decided against reader macros. They are a nice thing for a single hacker, but probably not a good thing for teams. |
| 07:22 | ayrnieu | they're fine for teams, but it's very arguably a good marketing decision to leave them out. |
| 07:23 | klibbigt | ayrnieu: are you kidding me? how is clojure possibly verbose? i dont think rdc instead of reduce or mp instead of map is anything to focus on. id would be stupid t do so. and ti makes things less readable |
| 07:23 | AWizzArd | Maybe they can be okay for teams too.. I asked Rich if we can get reader macros. Anyway, we can not prove if they are in general good for the productivity or not (= making software development cheaper). |
| 07:23 | klibbigt | what do I need to do to add my own reader-macros? just hack some of the java code right? |
| 07:23 | ayrnieu | klibbigt - sorry, are you talking to me from a mirror universe in which half of what I said was the opposide of what I'd written? |
| 07:26 | AWizzArd | ayrnieu: you basically want to say: Clojure is not verbose, but it still has potential to reduce verbosity by introducing macrolet and symbol-macro? |
| 07:26 | ayrnieu | AWizzArd - did you read that paste? |
| 07:28 | AWizzArd | yes |
| 07:29 | AWizzArd | The context for question is what you said before you posted that link. |
| 07:29 | ayrnieu | hm. |
| 07:30 | AWizzArd | the: "So it's not crazy to say that clojure is too verbose." |
| 07:30 | AWizzArd | it sounds not that you say that Clojure is verbose, as klibbigt supposes, but instead you see potential for reducing verbosity in the non-verbose language Clojure. |
| 07:32 | ayrnieu | AWizzArd, there's a language called HQ9+. It has four instructions: H, Q, 9, and +. H prints "Hello, world!", Q prints a quine of the HQ9+ program, 9 does 99-bottles-of-beer, + increments an accumulator "to make it turing-complete". |
| 07:33 | ayrnieu | For the ends, HQ9+ is about as terse as you can get. |
| 07:33 | ayrnieu | There's no verbosity in 'h'. The language is very finely optimized. |
| 07:34 | ayrnieu | But you would not be crazy to say that it's actually an incredibly verbose language, because the only way to do something seemingly very similar - to print one million "Hello, world!"s, is to put one million 'h' instructions in your program. |
| 07:35 | ayrnieu | This is not to say that Clojure is exactly as impaired, but to bludgeon the terms you're using: that laguages 'are verbose', that I could be suggesting something to make it 'less verbose' in an absolute way. |
| 07:38 | ayrnieu | with this in mind, http://groups.google.com/group/comp.lang.lisp/msg/28cb9d4217fe6dc3?dmode=source may also help you. |
| 07:38 | Bracki | How do I log to the repl? |
| 07:38 | ayrnieu | I need to fight vmware. |
| 07:41 | Bracki | ,(doc repl) |
| 07:41 | clojurebot | java.lang.Exception: Unable to resolve var: repl in this context |
| 08:08 | Chouser | I think the problem with reader macros isn't so much teams as composing 3rdparty libs. |
| 08:09 | rhickey | Chouser: right, reader macros are bad for community |
| 08:09 | rhickey | plus, I plan on using all the good characters :) |
| 08:10 | Chouser | If hacker X writes lib XL and hacker Y writes YL, and both XL and YL define reader macro $, then when hacker Z wants to use both XL and YL, what should he do?? |
| 08:11 | Chouser | rhickey: any opinion on the proposed changes to :use? Nothing to say on that subject yet I guess? |
| 08:12 | Chouser | rhickey: by which I mean, "good morning". :-) |
| 08:12 | rhickey | Chouser: is there a way to be backwards compatible? I think trying to do things compatibly should be the emphasis if possible |
| 08:12 | leafw | Chouser: can reader macros be namespaced? |
| 08:13 | Chouser | leafw: I made such a proposal, but it was denied. Such is life under a BDFL. :-) |
| 08:13 | rhickey | I think people see things like the seq changes and feel - "free-for-all!" let's rename things etc. That was inevitably breaking |
| 08:13 | Chouser | rhickey: my original proposal was minimally breaking, but if even that is too much a new keyword could be introduced. :demand |
| 08:14 | rhickey | or even :uses |
| 08:14 | Chouser | :request |
| 08:14 | Chouser | right |
| 08:15 | alinp | hi |
| 08:16 | alinp | lazy and STM are borrowed from haskell ? |
| 08:16 | alinp | as concepts |
| 08:16 | Chouser | heh |
| 08:16 | alinp | lazy evaluation I mean |
| 08:16 | alinp | (at least this is where I met these concepts) |
| 08:17 | rhickey | alinp: Clojure doesn't really have lazy evaluation, just lazy sequences, but yes, Haskell inspired there |
| 08:17 | Chouser | rhickey: I would have suggest my change even if 1.0 had just been forked. I didn't need any encouragement from you. :-) |
| 08:17 | rhickey | The STM is not like Haskell's |
| 08:17 | Holcxjo | Backwards compatibility if overrated this early in the development... |
| 08:17 | Chouser | leafw: http://clojure-log.n01se.net/date/2008-11-06.html#19:36b |
| 08:17 | alinp | thanks rhickey |
| 08:19 | klibbigt | 1 |
| 08:20 | rhickey | My thought this morning was to do integers as unboxed longs, and floats as unboxed doubles, longs would check for overflow and throw, if you want bigints you have to say so |
| 08:21 | rhickey | also have some thoughts on supporting longs and doubles as args/returns |
| 08:21 | rhickey | since tagged numbers are so far in the future, if ever |
| 08:22 | leafw | rhickey: float math is significantly faster than double math (as much as 2 or 3 times in some instances). |
| 08:22 | rhickey | leafw: not in the future |
| 08:22 | leafw | rhickey: true. |
| 08:23 | Holcxjo | And integers will silently overflow? |
| 08:23 | rhickey | Holcxjo: no, never |
| 08:24 | rhickey | unless you explicitly say "unsafe" |
| 08:24 | Holcxjo | ah! I missed the bit about "check for overflow and throw" |
| 08:25 | rhickey | it ends up hotspot does a good job with the overflow-detection code, still many times faster than boxed arithmetic |
| 08:25 | Holcxjo | Python sort-of went the other way and made away with the need to explicitly request long ints... |
| 08:25 | Holcxjo | ... I thought that was a big win |
| 08:25 | rhickey | Holcxjo: long ints or bigints? |
| 08:26 | Holcxjo | I am a bit hazy about detauls -- you had to append a "L" to an int literal to request a long int (I think those didn't overflow silently) |
| 08:27 | rhickey | they grew arbitrarily large? |
| 08:27 | Holcxjo | Makes for ugly code to have all the "L"s on you constants just to have correct math in all cases |
| 08:28 | Holcxjo | rhickey: I think the long-ints were true bigints, yes |
| 08:28 | rhickey | I'm not advocating incorrect math, just "pay for what you use" |
| 08:28 | Holcxjo | rhickey: but don't quote me on that -- my mind has forgotten these things |
| 08:28 | Chouser | as always I'm in favor of uncluttered code over performance. |
| 08:29 | Holcxjo | rhickey: Well there is only a shade of difference between "program doesn't work because it gives wrong results" (silent overflows) or "program doesn't work because it crashes" (throws exception that programmer didn't expect) |
| 08:29 | rhickey | Chouser: but how much of your code would overflow long, not counting fib and factorial silliness? |
| 08:30 | Holcxjo | rhickey: and how much code will fail in the future when requirements change slightly and you have to deal with a lot more data / larger quantities all of a sudden? |
| 08:31 | rhickey | Holcxjo: I understand the theoretical argument, and the absolute need for knowing what is happening, and an option for arbitrary growth, nonetheless, in practice, it's a non-problem for the vast majority of integer arithmetic |
| 08:32 | rhickey | that arithmetic being 20x slower as a result |
| 08:32 | Holcxjo | rhickey: I agree. What I am saying is that programmers suck at identifying which small bit of their arithmetic *does* matter here |
| 08:32 | Holcxjo | .. or might matter in the future... |
| 08:32 | Holcxjo | (remember: nobody will ever need more than 640KB so we can optimise things in the address space for performance) |
| 08:33 | rhickey | I guess I've done too much work in C++/Java/C# to believe it's the problem it's made out to be |
| 08:34 | rhickey | especially if there is overflow detection |
| 08:34 | Holcxjo | Can't we make unboxed numbers being ugly and on-demand, so one can have them when needed? |
| 08:34 | rhickey | Holcxjo: that's what we have now, and casual code is much slower at math than equivalent Common Lisp/ Smalltalk |
| 08:35 | Holcxjo | rhickey: And that's because in the JVM we cannot tag unboxed numbers or what? |
| 08:35 | rhickey | there are domains in which people would have to annotate almost everything |
| 08:35 | rhickey | Holcxjo: right, no tags |
| 08:36 | rhickey | either primitive or Object |
| 08:36 | Chouser | rhickey: only my project euler solutions. |
| 08:38 | Chouser | nothing else I do would overflow longs |
| 08:38 | Holcxjo | For us JVM ignoramusses: how many bits in a java int? 32? or 31? |
| 08:38 | rhickey | Holcxjo: 32 |
| 08:39 | rhickey | they map to machine instructions |
| 08:39 | Chouser | eh, I don't have a horse in this race. I like that everything "just works" now, but it's hardly egregious to require marking numbers that need to grow past long. |
| 08:40 | rhickey | Chouser: or perhaps some (with-bignums ...) |
| 08:40 | gnuvince | Hello everyone |
| 08:40 | rhickey | then we'll just have to argue over the default :) |
| 08:40 | rhickey | (with-primitives ...) |
| 08:41 | gnuvince | Holcxjo: about Java's integral types, they're all signed. |
| 08:41 | Holcxjo | rhickey: rather with-real-integers vs with-fake-integers :-) |
| 08:42 | rhickey | do-it-now vs take-all-day :) |
| 08:42 | leafw | in image processing, we have to annotate a lot of numbers. The (with-primitives ...) construct would be wellcomed. |
| 08:43 | Holcxjo | do-it vs do-or-dont :-) |
| 08:43 | leafw | and I agree that the default should be infintely growing numbers (never overflow). |
| 08:44 | rhickey | nothing is going to overflow in any case, that is not the proposal |
| 08:46 | rhickey | of course, this is still idle speculation, when things cross the call boundary they are boxed and you need to tell me what they are explicitly anyway, at least right now |
| 08:49 | leafw | I see how the latter can ruin the whole approach, since it can't be a proper 'binding' propagation. |
| 08:49 | rhickey | leafw: not necessarily |
| 08:50 | Holcxjo | leafw: Inlining functions should help, or not? |
| 08:53 | leafw | I don't know enough of clojure's internal details to say anything about it. |
| 08:54 | leafw | I use clojure; I don't develop it. |
| 09:01 | leafw | (to further specify that: to me clojure is a full replacement to java the language. I need java the libraries.) |
| 09:43 | Bracki | So what's best practice for logging? Can I log to the repl? |
| 09:46 | AWizzArd | ,(doc drop-while) |
| 09:46 | clojurebot | "([pred coll]); Returns a lazy sequence of the items in coll starting from the first item for which (pred item) returns nil." |
| 09:46 | AWizzArd | rhickey: is it intended in the doc for drop-while to mention only nil? It could for example also read: "... for which (pred item) returns nil or false." |
| 10:01 | Chouser | cgrand: have you seen seque? |
| 10:03 | Chouser | oh, sorry, the blog post prompting that question is from 8 months ago -- just popped up in my feed reader again. |
| 10:05 | cgrand | chouser? |
| 10:07 | Chouser | http://clj-me.blogspot.com/2008/06/lazier-than-lazy.html |
| 10:07 | cgrand | Chouser: Hmm I guess that feedburner is messing with the feed |
| 10:07 | Chouser | seemed similar to seque, so I wondered if you knew about it. |
| 10:08 | Chouser | actually, it came to me this time via Clojure Pipe, so any number of intermediaries could be messing with it. |
| 10:09 | danlarkin | if only we had planet.clojure.org you could be sure... |
| 10:14 | cgrand | Chouser: yes, I know seque. I remember that in a weel or so there were two or three independent attempts to generate a seq in another thread |
| 10:15 | cgrand | :s/its/his |
| 10:16 | WizardofWestmarc | and here I thought you were admitting to being an AI cgrand ;-) |
| 10:20 | cgrand | does someone know how to test (in a macro) if a symbol denotes a local? |
| 10:23 | Chouser | besides using eval, resolve, and a process of elimination? |
| 10:24 | Chouser | at runtime. :-P |
| 10:25 | rhickey | cgrand: there isn't yet an API for exposing the compiler's notion of the environment to a macro |
| 10:26 | Chouser | I guess the compiler has some information about the surrounding block by the time it's evaling interior macros? |
| 10:26 | rhickey | clojure.lang.Compiler.LOCAL_ENV if you want to play around |
| 10:27 | shoover | Chouser: are you off the hook for textjure? I can't actually get the download from sourceforge, so I can't tell where Waterfront stands |
| 10:27 | cgrand | rhickey: thanks, I was stupidly blocking on referenceLocal being package, while I didn't checked whether LOCAL_ENV was public... |
| 10:27 | Chouser | shoover: I downloaded Waterfront, but haven't tried it yet. |
| 10:28 | rhickey | cgrand: referenceLocal is effectful in that it will cause bindings to become closed-over |
| 10:48 | Bracki | Should i use #^{:doc ""} or just ""? |
| 10:49 | Bracki | for documentation. |
| 10:50 | danlarkin | "" |
| 10:50 | Bracki | When should I use the meta data? |
| 10:51 | danlarkin | the other form? when you need to attach to keys other than :doc |
| 10:53 | Bracki | And how do I access the doc? |
| 10:53 | Chouser | (doc +) |
| 10:53 | clojurebot | Returns the sum of nums. (+) returns 0.; arglists ([] [x] [x y] [x y & more]) |
| 10:53 | Bracki | ,(:doc (meta meta)) |
| 10:53 | clojurebot | nil |
| 10:53 | lisppaste8 | ozzilee pasted "A Better Way?" at http://paste.lisp.org/display/76085 |
| 10:54 | Chouser | Bracki: that would give you the :doc value of the metadata of the *function* meta. But docs are usually attached to the *var*. |
| 10:54 | Chouser | ,(:doc (meta (var meta))) |
| 10:54 | clojurebot | "Returns the metadata of obj, returns nil if there is no metadata." |
| 10:54 | ozzilee | Hey all. Is there a better way to do the above? I want to re-use a factory object within a defined function. |
| 10:55 | Chouser | ozzilee: you could just store the factory object in another var |
| 10:56 | lisppaste8 | ozzilee annotated #76085 "Something like this?" at http://paste.lisp.org/display/76085#1 |
| 10:56 | Chouser | oh! hm... |
| 10:56 | ozzilee | Chouser: Right, but I don't really need access to the factory object anywhere else... |
| 10:57 | ozzilee | I saw memoize in contrib, but that's not quite what I want (I don't think). |
| 10:57 | cgrand | ozzilee: invert the let and the def? |
| 10:57 | Chouser | ozzilee: I'd normally but it in its own var, and maybe make the var private, but defn inside the let is ok too, I think. |
| 10:58 | ozzilee | cgrand: Won't that re-evaluate the (FooFactory.) every time the function is called? |
| 10:59 | lisppaste8 | cgrand annotated #76085 "inverted def and let" at http://paste.lisp.org/display/76085#2 |
| 10:59 | ozzilee | cgrand: Ah, of course. Hmm. |
| 11:00 | Chouser | cgrand: nice. I totally missed that. |
| 11:05 | Bracki | What's the inverse of (keyword)? |
| 11:06 | rhickey | cgrand: like what? |
| 11:06 | rhickey | symbol-macrolet? |
| 11:07 | AWizzArd | ,(str :reverse-of-keyword) |
| 11:07 | clojurebot | ":reverse-of-keyword" |
| 11:07 | cgrand | Bracki: name |
| 11:07 | AWizzArd | cgrand: http://www.lispworks.com/documentation/HyperSpec/Body/s_symbol.htm |
| 11:08 | cgrand | AWizzArd: thanks |
| 11:12 | cgrand | rhickey: not quite, I'd like to pass some context information from a macro to another (potentially deeply nested) macro. |
| 11:13 | rhickey | cgrand: compile-time vars? |
| 11:15 | rhickey | I know, not lexical, but that's how the compiler works |
| 11:20 | cgrand | rhickey: yes but, in the compiler, you control when you pop the bindings. |
| 11:22 | Chouser | cgrand: deeply nested lexically, right? |
| 11:22 | rhickey | cgrand: what's your use case? |
| 11:23 | cgrand | (it's not an actual problem, I found a workaround but it keeps nagging me.) |
| 11:23 | Chouser | could you share a gensym value between the macros and bind a vlue to it using 'let'? |
| 11:27 | cooldude127 | alright, my main system still has an old version of clojure before the merge, but i just installed the newest stuff in a VM, time to find out how much code doesn't work anymore |
| 11:28 | cgrand | bbl |
| 11:30 | cooldude127 | and apparently i didn't rely on anything that got messed with, cuz my code just compiled with no errors after no modifications |
| 11:30 | cooldude127 | seriously? i didn't use rest once? |
| 11:30 | jbondeson | cooldude127: you turned on lazy-seq in if assert, right? |
| 11:30 | cooldude127 | jbondeson: no i did not |
| 11:30 | jbondeson | cooldude127: rest is still there |
| 11:30 | jbondeson | you have to compile clojure with the flag -Dclojure.assert-if-lazy-seq=please |
| 11:31 | cooldude127 | jbondeson: oh, so that's an option for the ant command? |
| 11:31 | jbondeson | yup |
| 11:31 | Chouser | "true" works instead of "please" if you're having a less whimsical day. |
| 11:32 | jbondeson | Chouser: yes, but then you're dead inside... |
| 11:33 | jbondeson | be nice to clojure and it will be nice to you! |
| 11:33 | cooldude127 | still no errors, i don't think this code actually did anything like that |
| 11:33 | jbondeson | the asserts happen when you run the code |
| 11:33 | cooldude127 | shit |
| 11:34 | jbondeson | it modifies the if macro to check for a naked lazy-seq in the condition and assert if it finds one |
| 11:34 | Chouser | compiling successfully means you weren't using lazy-cons yourself, which is good. Those are the one that take the most thought to fix correctly. |
| 11:34 | Chouser | though now that seq is cheap again, those probably are easier |
| 11:35 | cooldude127 | well, some of this stuff is tested, so 78 assertions just all passed |
| 11:35 | cooldude127 | that's good enough for me, i can't test everything |
| 11:35 | gnuvince | cooldude127: check out the random testing libs ;) |
| 11:36 | cooldude127 | gnuvince: what libs would those be? |
| 11:36 | gnuvince | Fact, ClojureCheck |
| 11:36 | cooldude127 | oh |
| 11:36 | cooldude127 | like quickcheck for haskell? |
| 11:36 | gnuvince | Yep |
| 11:36 | gnuvince | QuickCheck is an awesome tool |
| 11:37 | Bracki | Loosely based on technomancy's mire I've started to work on this: http://gist.github.com/69650 |
| 11:37 | Bracki | It's Urkle - the awkward IRCd |
| 11:38 | AWizzArd | is there a clause for condp that matches anything? |
| 11:38 | Bracki | Any reviews welcome. |
| 11:38 | Chouser | AWizzArd: a final single expression |
| 11:39 | Chouser | instead of a pair |
| 11:39 | AWizzArd | ,(condp = (first [1 2]) 2 (println "two") (println "thx")) |
| 11:39 | clojurebot | thx |
| 11:40 | AWizzArd | :) |
| 11:41 | kotarak | AWizzArd: w/o last expression and if no clause matches, condp throws.. |
| 11:41 | AWizzArd | yes, I like that behaviour, it is just that during my explorative testing phase it is nicer to have something else |
| 12:13 | cemerick | Are default print-method and print-dup implementations for arrays coming soon? I have ones for byte[] and char[], but I suspect rhickey has better ideas for hwo such things should work. |
| 12:18 | Chouser | cemerick: that's the first time I've heard it suggested |
| 12:19 | cemerick | heh |
| 12:21 | cemerick | I wrote one-offs for both byte[] and char[], but it occurs to me that in general, primitive arrays would be best print-dup'd using java serialization. |
| 12:21 | cp2 | hi guys |
| 12:24 | cemerick | I guess it would still be better (and just as space-efficient) to prefer a human-readable form for char[], though. |
| 12:27 | cooldude127 | jbondeson: chouser already wrote the stuff i want |
| 12:27 | cooldude127 | it just isn't in the language yet |
| 12:27 | jbondeson | suuuure, not you have other people doing your dirty work |
| 12:27 | jbondeson | -not+now |
| 12:27 | cooldude127 | lol |
| 12:28 | cooldude127 | i believe he wrote it before i even wanted it |
| 12:28 | jbondeson | standing on top of a mountain of midgets also works, you just need more of them |
| 12:30 | leafw | jbondeson: that is not true -- becuse of what the "mythical man month" explains. |
| 12:31 | cooldude127 | lol |
| 12:32 | jbondeson | i must have missed the chapter on the theoretical impossibilty of midget moutains in MMM |
| 12:35 | cemerick | midgets generally can't see far enough to know which way to go though, so it's pretty easy to be led astray with a mountain of them. |
| 12:43 | AWizzArd | Can one (reset! a-future)? |
| 12:43 | jbondeson | AWizzArd: that wouldn't make much sense, why would you want to do that? |
| 12:45 | AWizzArd | I have something that takes about 5 seconds. I would like to run this is a separate thread, so the user can continue without waiting. Sounds like an agent. But it needs full replacement always, which sounds like an atom, but those don't run in their own thread. |
| 12:45 | AWizzArd | And I want it to block when the user actually does something that requsets this data. Sounds like a future. |
| 12:46 | AWizzArd | So, I like the behaviour of futures to run in their own thread and to block until @future is available. |
| 12:46 | AWizzArd | But I need to change it. A future is a constant. |
| 12:47 | danlarkin | can't you just use an agent with (fn [new-state old-state] new-state) as its modifier function or whatever? |
| 12:47 | AWizzArd | the problem I see is that @agent immediately returns a result, even if the agent is still working |
| 12:47 | jbondeson | you could have a ref to a future and a function to manage it for you. |
| 12:47 | jbondeson | though you'd have to double de-ref |
| 12:47 | durka42 | (await agent) will block |
| 12:48 | hiredman | and futures can await |
| 12:48 | durka42 | or you could have like an atom with a future in it and keep swapping the future out |
| 12:48 | AWizzArd | yes sure, I can get there.. but each of those have disadvantages. The (await agent) is a leaky abstraction, as I never may forget the await before I deref. This can not happen with a future |
| 12:49 | cemerick | it's a very common pattern for the implementation of print-method and print-dup to be the same for various dispatch types -- maybe defmethod should take a list of multimethods, rather than single one..... |
| 12:49 | AWizzArd | durka42: that's about what I am doing at the moment, but the @@atomfuture looks strange j) |
| 12:49 | AWizzArd | j) ==> ;) |
| 12:49 | hiredman | cemerick: write a macro where it does |
| 12:50 | cemerick | hiredman: sure, that's trivial -- I was suggesting that it would be useful generally |
| 12:50 | AWizzArd | cool would be: futures that can be resetted, or having atoms running in their own thread |
| 12:56 | Chouser | AWizzArd: I don't really understand -- when you deref or force this thing, you want the previously computed value, or you want it to always block until a new value is calculated? |
| 12:57 | AWizzArd | Chouser: second, on derefferencing block until the calculation finished |
| 12:57 | AWizzArd | a future is doing this, plus it runs in parallel |
| 13:03 | durka42 | how does clojure deal with this problem? http://en.wikipedia.org/wiki/Software_transactional_memory#Implementation_issues |
| 13:03 | tashafa | question... is it safe to update to the latest SVN of clojure |
| 13:03 | tashafa | ? |
| 13:03 | tashafa | and still be able to use swank |
| 13:03 | tashafa | and emacs/slime |
| 13:03 | WizardofWestmarc | tashafa: if you update to latest swank last I heard it worked |
| 13:03 | triddell | tashafa: works for me |
| 13:04 | tashafa | yay! thanks guys |
| 13:13 | danlarkin | I will say this about mark volkmann; he sure does post on the mailing list a _lot_ |
| 13:17 | jbondeson | clojurebot: Object Computing? |
| 13:17 | clojurebot | see Subject Computing, Inc |
| 13:35 | gnuvince | danlarkin: that he does. |
| 13:43 | Lau_of_DK | Good evening guys |
| 13:44 | fogus | There's a clojure mailing list? |
| 13:44 | Chouser | fogus: google group |
| 13:44 | fogus | ahhhh, of course |
| 13:45 | Chouser | danlarkin: he's not the top poster this month. He's actually 7th |
| 13:45 | danlarkin | is he the top thread starter though? |
| 13:46 | technomancy | it's kind of scary that Google considers it do be "low" traffic |
| 13:47 | danlarkin | it's a part time job reading all the threads as it is |
| 13:48 | Chouser | I don't have that number. http://groups.google.com/group/clojure/about |
| 13:50 | shoover | danlarkin: ever look at comp.lisp.lang? full time job |
| 13:50 | gregh | comp.lang.lisp is even busier! :) |
| 13:51 | technomancy | shoover: heck, it's a full-time job just *ignoring* c.l.l. |
| 13:51 | Chouser | heh |
| 13:51 | WizardofWestmarc | yeah I finally gave up on following c.l.l |
| 13:51 | WizardofWestmarc | I was just skipping so many posts it wasn't worth keeping in the RSS reader |
| 13:51 | AWizzArd | too bad, there was such a nice thread in the past days ;) |
| 13:52 | WizardofWestmarc | especially since I wasn't USING CL heh |
| 13:52 | WizardofWestmarc | the clojure one? I read that when it got linked |
| 13:52 | WizardofWestmarc | up to at least one round of Rich pointing out how ignorant some people were about the language |
| 13:52 | AWizzArd | while the google group actually discusses Clojure and gives nice support, in c.l.l Clojure is discussed itself. |
| 13:52 | WizardofWestmarc | (clojure) |
| 13:52 | fogus | reading xah lee's posts on c.l.l is a full-time job |
| 13:52 | WizardofWestmarc | ungh |
| 13:52 | fogus | maybe that's why everyone ignores him? ;) |
| 13:53 | WizardofWestmarc | if I could have a kill file in RSS, he'd have gone in it. |
| 13:53 | AWizzArd | kill filing is not so much needed, just don't read his posts |
| 13:53 | technomancy | heh |
| 13:54 | technomancy | that's how I first discovered the /ignore command on IRC |
| 13:54 | WizardofWestmarc | but it's all that scrolling to get past all of them :P |
| 13:54 | WizardofWestmarc | haha I've never used ignore really for irc |
| 13:54 | WizardofWestmarc | but then about the only other channel I hang out in besides this one I'm an #op so ignore's a bad idea >_> |
| 13:55 | AWizzArd | lately some lisp experts did not portrait Clojure correctly |
| 13:55 | AWizzArd | in c.l.l |
| 13:56 | fogus | AWizzArd: In the "Road to CLojure" thread? |
| 13:56 | technomancy | of course, they're not biased at *all*, right? |
| 13:56 | AWizzArd | history repeats.. since decades people who don't know Lisp and have never tried it were explaining things about Lisp, and posted why it doesn't work |
| 13:57 | AWizzArd | now the funny thing is: it happens again with the new dialect Clojure. But this time it's the Lispers who misrepresent it |
| 13:57 | AWizzArd | fogus: yes that thread |
| 13:57 | AWizzArd | I think I wrote 50% of it ;) |
| 13:58 | fogus | I tried my best to follow that thread, but I lost track after a couple days away from the computer. What's the general gist of the misrepresentation(s)? |
| 13:58 | rhickey | AWizzArd: == Andre? |
| 13:58 | AWizzArd | rhickey: indeed |
| 13:58 | AWizzArd | I did not know that you were not aware of it ;) |
| 14:12 | Chousuke | I consider the c.l.l people's reaction towards Clojure quite expected. |
| 14:13 | Chousuke | Clojure does break many traditions |
| 14:13 | Chousuke | people like tradition :) |
| 14:13 | Lau_of_DK | c.l.l ? |
| 14:13 | Chousuke | comp.lang.lisp |
| 14:14 | technomancy | they're probably jealous of the interest it's getting too; CL has a hard time picking up inertia. |
| 14:14 | Chousuke | I don't think anyone should try to assert which language is "better" than the others. :/ |
| 14:15 | technomancy | Chousuke: not to anyone who has a vested interest in the others, at least. =) |
| 14:15 | Chousuke | it doesn't make sense in general |
| 14:16 | Chousuke | if I say Clojure is better than CL, that assertion contains no information at all. |
| 14:16 | Chousuke | except my opinion, which is worthless |
| 14:16 | cemerick | ugh, having literals for array classes would be *really* handy right now... |
| 14:16 | Chouser | cemerick: into-array is too verbose? |
| 14:16 | p_l | gah, Tilton made a real flamebait on c.l.l |
| 14:16 | Chousuke | unless of course I establish first that my opinion matters :) |
| 14:17 | WizardofWestmarc | p_l: Kenny's good at flame bait |
| 14:17 | cemerick | Chouser: no, into-array is fine, but if I want the char[] Class, then you need (class (make-array Character/TYPE 0)) or somesuch (unless I'm missing something). |
| 14:18 | cemerick | I've got an arrayclass macro that does that, but even that is irritating |
| 14:18 | hiredman | ooo |
| 14:18 | hiredman | another clojure editor in clojure |
| 14:20 | durka42 | waterfront? |
| 14:20 | hiredman | yeah |
| 14:38 | cemerick | (read-string "#=(.toCharArray \"foo\")") => Exception: can't resolve .toCharArray ..... any ideas why this? |
| 14:38 | cemerick | s/this/this is |
| 14:40 | cemerick | ah, but (eval (read-string "(.toCharArray \"foo\")")) works just fine -- I feel like I'm missing something about how the reader works within the context of #= forms |
| 14:42 | brianh_ | wow. i'm going along, allowing life to interfere with my contrib updates over several days & wham! I've got C# code on my box |
| 14:42 | brianh_ | i promise not to let it happen again! :) |
| 14:46 | p_l | brianh_: ? |
| 14:47 | brianh_ | there's a clojureCLR package in contrib now |
| 14:49 | p_l | :) |
| 14:50 | brianh_ | btw good news. my manager has agreed to let me use clojure in an 'official' prototype/proof-of-concept project here at work |
| 14:50 | clojurebot | svn rev 1304; fix nil pun in genclass |
| 14:50 | jbondeson | waaaait a sec, you ask permission? just "accidentally" let it go to production! ;) |
| 14:51 | WizardofWestmarc | If we used the jvm here at work there would already be code in production from clojure >_> |
| 14:51 | Chouser | brianh_: nice! |
| 14:51 | brianh_ | jbondeson: heh. that was going to be my next tactic ;) |
| 14:51 | WizardofWestmarc | then hear all the shrieks of horror at sexpressions >_> |
| 14:52 | jbondeson | i'm about 2 shakes from getting some F# into production... |
| 14:52 | jbondeson | "compiles the same!" |
| 14:52 | gnuvince | "That's Sun's new extension to make concurrency easier. They changed the syntax a bit..." |
| 14:52 | Raynes | F# makes the hair on the back of my neck raise. |
| 14:53 | jbondeson | it's just O'Caml |
| 14:53 | AWizzArd | has good ideas |
| 14:53 | Raynes | How can you pack so much inelegance in a single language. @_@ |
| 14:53 | AWizzArd | way better than coding Java or C# :) |
| 14:54 | jbondeson | Raynes: start with the ugly syntax of ML, add OO functionality to it, and then bring it to the CLR |
| 14:54 | technomancy | well, vaguely interested |
| 14:54 | p_l | nah, ML syntax is not bad |
| 14:54 | Raynes | p_l: Stop it. |
| 14:54 | Raynes | :| |
| 14:54 | jbondeson | ;; is pretty bad |
| 14:54 | p_l | Raynes: Won't :P |
| 14:54 | gnuvince | jbondeson: you use that at the REPL only. |
| 14:55 | jbondeson | gnuvince: or at as an explicit statement break |
| 14:55 | gnuvince | that's a single ; |
| 14:55 | jbondeson | single was used inside of statements |
| 14:55 | jbondeson | iirc |
| 14:55 | clojurebot | svn rev 1305; really fix nil pun in genclass |
| 14:55 | gnuvince | print_string "Hello"; |
| 14:55 | gnuvince | print_int "world" |
| 14:56 | gnuvince | errr |
| 14:56 | gnuvince | print_string "world" |
| 14:56 | gnuvince | dur |
| 14:59 | jbondeson | yeah, ; can be used to separate array items, or sub-statements |
| 14:59 | jbondeson | (at least in ocaml |
| 14:59 | gnuvince | yeah |
| 14:59 | gnuvince | Not sure in F# |
| 14:59 | jbondeson | you can use it, generally don't |
| 15:00 | gnuvince | The # pretty much assured that I wouldn't pick it up in my spare time. |
| 15:00 | WizardofWestmarc | what if it were Gb ? |
| 15:00 | jbondeson | they can cross compile with ocaml pretty well |
| 15:00 | hiredman | har har |
| 15:00 | gnuvince | WizardofWestmarc: it's .NET. I don't want to reboot into Windows to use Visual Studio |
| 15:00 | WizardofWestmarc | ah ha |
| 15:00 | WizardofWestmarc | understandable |
| 15:00 | jbondeson | gnuvince: yeah, see i work in a windows shop, sooooo |
| 15:01 | jbondeson | i'll take functional where i can get it |
| 15:01 | gnuvince | yeah sure. |
| 15:01 | gnuvince | I wouldn't mind using F# |
| 15:01 | gnuvince | I just would mind doing it on my time. |
| 15:01 | gnuvince | I'd rather go with languages that don't require me to buy a $700 IDE |
| 15:01 | jbondeson | you don't |
| 15:01 | jbondeson | it works with the free VS |
| 15:01 | fogus | I have F# install on my Mac in Mono... played around with it a bit, but not extensively |
| 15:02 | gnuvince | jbondeson: still need to reboot. |
| 15:02 | gnuvince | Anyway |
| 15:02 | jbondeson | vmware? ;) |
| 15:02 | gnuvince | As long as I'm going to get into statically typed functional languages, I may as well continue my Haskell journey. |
| 15:02 | adakkak | is there a different syntax for (:import ) in REPL? |
| 15:02 | gnuvince | adakkak: no |
| 15:03 | gnuvince | adakkak: (ns foo (:import (java.io File))) |
| 15:03 | gnuvince | Alternatively: (import '(java.io File)) |
| 15:04 | p_l | If only Java didn't have borked X11 support (and requiring a big download for someone who doesn't have java installed) I might have used it for application writing more... |
| 15:05 | WizardofWestmarc | don't most OSes come with Java prepackaged these days? |
| 15:05 | gnuvince | windows doesn't |
| 15:05 | p_l | WizardofWestmarc: Only Solaris? |
| 15:05 | WizardofWestmarc | um |
| 15:05 | WizardofWestmarc | pretty sure my laptop had Java already on it, which is Vista |
| 15:05 | p_l | srsly, only Solaris has not-broken, available-by-default Java install |
| 15:05 | WizardofWestmarc | JVM 1.6 |
| 15:06 | p_l | WizardofWestmarc: MS doesn't have license to include JVM with operating system |
| 15:06 | WizardofWestmarc | I thought the courts required them to include it after the whole MS JVM debacle |
| 15:06 | p_l | WizardofWestmarc: It's your OEM's doing. Rare thing except for enterprise installs |
| 15:06 | adakkak | can someone tell me what I doing wrong with this import then http://paste.lisp.org/display/76102 |
| 15:06 | p_l | WizardofWestmarc: Actually it was removed with XP SP1a |
| 15:07 | danlarkin | os x ships with java |
| 15:07 | hiredman | ~jdoc org.apache.http.client.HttpClient |
| 15:07 | p_l | WizardofWestmarc: Removed what was left of it, which wasn't enough to run anything other than simple applets that didn't use JVM 1.4 :) |
| 15:08 | WizardofWestmarc | huh |
| 15:09 | p_l | WizardofWestmarc: The only reason why my laptop came with JVM 1.6 preinstalled was because it had NetBeans, BlueJ and Eclipse included, for coursework (university-prepared system image) |
| 15:09 | adakkak | hiredman: the link does not work |
| 15:09 | hiredman | adakkak: I am aware |
| 15:09 | WizardofWestmarc | p_l: mine was a Lenovo laptop |
| 15:10 | p_l | WizardofWestmarc: Then Lenovo bundles Java by default (mine was R61i) |
| 15:10 | hiredman | adakkak: what does clj do? |
| 15:10 | p_l | However, I know that most don't include Java |
| 15:10 | p_l | Also, getting java on some linux distros is a royal PITA |
| 15:11 | adakkak | java.lang.ClassNotFoundException: org.apache.http.client.HttpClient (NO_SOURCE_FILE:0) |
| 15:11 | hiredman | adakkak: what is in your launcher script |
| 15:12 | adakkak | this is the one I am using http://paste.lisp.org/display/76104 |
| 15:14 | hiredman | adakkak: that script doesn't start the jvm (run the java command) anywere |
| 15:15 | hiredman | so either that paste is incomplete, or that is not the script you are using |
| 15:16 | hiredman | ok |
| 15:16 | adakkak | sorry, it was incomplete here is an updated version http://paste.lisp.org/display/76104#1 |
| 15:16 | hiredman | ok |
| 15:17 | hiredman | that script uses the -cp option which causes java to ignore CLASSPATH |
| 15:18 | hiredman | it is setup to load jars out of ~/.clojure |
| 15:18 | hiredman | so either change the script, or put your jars in ~/.clojure |
| 15:19 | adakkak | hiredman: thanks |
| 15:19 | hiredman | the alternative syntax thread is still going |
| 15:19 | hiredman | :| |
| 15:19 | hiredman | adakkak: np |
| 15:19 | adakkak | added $CLASSPATH to the script |
| 15:21 | Chouser | hm, no way to get 'future' to use the soloExecutor. |
| 15:22 | gnuvince | Should Joshua Choi's fnparse library be considered for inclusion in clojure-contrib (if he agrees, of course) |
| 15:23 | cooldude127 | what's fnparse do? |
| 15:23 | jbondeson | parse! |
| 15:24 | jbondeson | >_> |
| 15:24 | gnuvince | http://github.com/joshua-choi/fnparse/tree/fdeea49a1b0ba98456f8f401eab7c74f69ee6f1a/src/name/choi/joshua |
| 15:24 | danlarkin | it's a functional parser library |
| 15:25 | danlarkin | it's very useful, I like it |
| 15:25 | jbondeson | quite slick at that |
| 15:26 | cooldude127 | i don't understand it, but that doesn't mean it's not useful |
| 15:28 | danlarkin | it took me a while to grok it but now that I do I'm seeing everything in terms of functions that return functions that parse :-o |
| 15:29 | cooldude127 | lol |
| 15:29 | adakkak | Now that I figured out how to import the http-client apache library, I am having trouble using it. Why would (HttpClient.) give me a constructor error |
| 15:30 | cooldude127 | adakkak: perhaps it has no default constructor? |
| 15:30 | danlarkin | adakkak: the constructor probably takes arguments |
| 15:32 | hiredman | ~google apache HttpClient |
| 15:32 | clojurebot | First, out of 104000 results is: |
| 15:32 | clojurebot | HttpClient - HttpClient Home |
| 15:32 | clojurebot | http://hc.apache.org/httpclient-3.x/ |
| 15:32 | gnuvince | I can't get the postscript file Josh links to :-/ |
| 15:33 | hiredman | adakkak: you know, I seem to remember walking down this path myself once |
| 15:33 | hiredman | I ended up using xlightweb instead |
| 15:33 | digash` | (org.apache.http.impl.client.DefaultHttpClient.) |
| 15:33 | hiredman | http://xlightweb.sourceforge.net/ |
| 15:34 | danlarkin | technomancy: I would like to see one |
| 15:34 | p_l | technomancy: Port drakma? :) |
| 15:34 | danlarkin | but only if it's full featured! |
| 15:35 | adakkak | thanks |
| 15:35 | danlarkin | I want everything, toggles for following redirects, cookie support, the whole bag of tricks |
| 15:35 | technomancy | danlarkin: what qualifies as "full"? |
| 15:35 | p_l | danlarkin: then a drakma port it should be... afaik drakma supported everything and a kitchen sink |
| 15:35 | technomancy | ah yeah, sure |
| 15:35 | Bracki | cooldude127: thx for the find-graph rewrite |
| 15:36 | adakkak | so I can use (org.apache....) without doing an import? |
| 15:36 | technomancy | custom HTTP headers is the main thing I would need |
| 15:36 | danlarkin | technomancy: python's urllib2 + some... never heard of drakma, I'll look at it now |
| 15:36 | cooldude127 | Bracki: funny story, this week in my data structures class i had to write a findPath function in java using both BFS and DFS |
| 15:36 | Chouser | (with-open [s (BufferedReader. (InputStreamReader. (.openStream (java.net.URL. "http://google.com/"))))] (vec (line-seq s))) |
| 15:37 | cooldude127 | Bracki: weird how those lined up |
| 15:37 | digash` | adakkak: sure |
| 15:37 | technomancy | danlarkin: once I get the screencast finished ... |
| 15:37 | p_l | http://weitz.de/drakma/ <--- that would be nice to have on clojure, I guess :) |
| 15:37 | technomancy | there are so many great ways I could end that sentence. |
| 15:38 | technomancy | probably would do the date lib first though; there's more pain without that |
| 15:39 | danlarkin | hasn't cooldude127 done a date lib? |
| 15:40 | cooldude127 | danlarkin: i've started one |
| 15:40 | cooldude127 | it's on github in my fork of clojure-contrib |
| 15:40 | cooldude127 | http://github.com/cooldude127/clojure-contrib |
| 15:41 | jbondeson | is there any clean way to do a recursive function when it takes "& args"? the double-listing is a pain. |
| 15:42 | danlarkin | jbondeson: can you define multiple arities, only one taking & args? |
| 15:43 | jbondeson | 'spose, was hoping there was an easy answer with the recursive call doing some list destructuring. |
| 15:46 | cemerick | rhickey__: so, dotted ctors work OK in #=, but dotted method invocations don't. Do you expect that to persist? (read-string "#=(.toCharArray \"foo\")") => Exception |
| 15:48 | technomancy | danlarkin: yeah, I meant cleaning up his and getting it into contrib |
| 15:56 | danlarkin | jbondeson: well you can use destructuring with & args |
| 15:56 | danlarkin | not sure exactly what you want to do, though |
| 15:57 | jbondeson | i would like to convert the (recursive-call (next args)) -> (recursive-call :the :actual :next :args) |
| 15:57 | jbondeson | that would be nice |
| 15:57 | danlarkin | hm apply? |
| 15:58 | hiredman | you could just use trampoline |
| 15:58 | jbondeson | hiredman: interesting idea |
| 15:59 | hiredman | trampoline is not a macro right? |
| 15:59 | jbondeson | though it may have the same problem since it takes & args |
| 15:59 | jbondeson | crap, gotta go to a meeting =/ |
| 15:59 | hiredman | (apply trampoline func args) |
| 15:59 | hiredman | and for recur, #(apply func args) |
| 16:02 | danlarkin | I'm assuming he's creating a lazy seq |
| 16:02 | danlarkin | for obvious reasons |
| 16:04 | hiredman | ,(doc lazy-seq) |
| 16:04 | clojurebot | "([& body]); Takes a body of expressions that returns an ISeq or nil, and yields a Seqable object that will invoke the body only the first time seq is called, and will cache the result and return it on all subsequent seq calls. Any closed over locals will be cleared prior to the tail call of body." |
| 16:05 | hiredman | I do not think he is creating a lazy-seq |
| 16:08 | danlarkin | is there still lazy-cat? |
| 16:08 | danlarkin | (doc lazy-cat) |
| 16:08 | clojurebot | Expands to code which yields a lazy sequence of the concatenation of the supplied colls. Each coll expr is not evaluated until it is needed. (lazy-cat xs ys zs) === (concat (lazy-seq xs) (lazy-seq ys) (lazy-seq zs)); arglists ([& colls]) |
| 16:08 | danlarkin | he could be using that |
| 16:26 | lisppaste8 | cemerick pasted "print-dup implementation for enums" at http://paste.lisp.org/display/76108 |
| 16:26 | cemerick | The above would work if http://groups.google.com/group/clojure/browse_frm/thread/34e4d47fc5144512 were resolved one way or the other. |
| 16:33 | adakkak | is there another way of writing (not (= a b)) in clojure, is there a != operator? |
| 16:34 | cooldude127 | adakkak: not= |
| 16:34 | cooldude127 | (not= a b) |
| 16:36 | hiredman | ,((comp not =) 'a 'b) |
| 16:36 | clojurebot | true |
| 16:37 | adakkak | thanks |
| 16:37 | durka42 | ,((complement =) 'a 'b) |
| 16:37 | clojurebot | true |
| 16:37 | hiredman | oooh |
| 16:42 | adakkak | how do you raise exceptions in clojure |
| 16:43 | adakkak | is it just using (Exception. "name") , or is there something specific to clojure? |
| 16:44 | technomancy | I think you have to call throw on it. but it's pure Java IIUC |
| 16:44 | technomancy | no special lisp syntax |
| 16:45 | jbondeson | hiredman: trampoline worked, thanks |
| 16:45 | Chouser | unless you feel like trying clojure.contrib.error-kit |
| 16:45 | durka42 | you can also play with chouser's error-kit |
| 16:45 | durka42 | heh |
| 16:45 | durka42 | which i keep meaning to do |
| 16:45 | cooldude127 | error-kit is good stuff :) |
| 16:45 | Chouser | bah. missed an opportunity for false modesty. |
| 16:48 | Lau_of_DK | thats a shame Chouser.. btw did you try out ClojureQL yet? :) |
| 16:48 | Chouser | heh. |
| 16:55 | adakkak | ,((comp java.io.FileInputStream. java.io.File.) "/tmp/f") |
| 16:55 | clojurebot | java.lang.ClassNotFoundException: java.io.FileInputStream. |
| 16:57 | hiredman | adakkak: java constructors and methods are not fns so not composable directly |
| 16:57 | adakkak | so it's reserved for clojure functions |
| 16:58 | hiredman | sure, if you want to put it that way |
| 16:58 | hiredman | (java.io.FileInputStream. x) is not a function call |
| 16:58 | hiredman | it is wrapped in syntactic sugar to make it look like one |
| 16:58 | hiredman | ,(macroexpand '(java.io.FileInputStream. x)) |
| 16:58 | clojurebot | (new java.io.FileInputStream x) |
| 16:59 | jbondeson | we're playing "tell me what idiotic things i'm doing" day with jbondeson. |
| 16:59 | adakkak | so macros are not composable |
| 16:59 | jbondeson | there's nothing that is (and (seq? x) (seq x)), right? |
| 17:00 | hiredman | only fns are composable by the comp fn |
| 17:01 | hiredman | ,(macro (meta #'comp)) |
| 17:01 | clojurebot | java.lang.Exception: Unable to resolve symbol: macro in this context |
| 17:01 | hiredman | ,(:macro (meta #'comp)) |
| 17:01 | clojurebot | nil |
| 17:01 | hiredman | ,(:macro (meta #'for)) |
| 17:01 | clojurebot | true |
| 17:01 | hiredman | I was pretty sure comp was a fn, but not completely sure |
| 17:02 | Chouser | jbondeson: 'seq' is the same as 'identity' on something that returns true for 'seq?' |
| 17:02 | jbondeson | except () |
| 17:03 | Chouser | jbondeson: hm! |
| 17:03 | jbondeson | that's the check i've been using for "No Really I'm Not a Non-Empty Seq!" |
| 17:03 | Chouser | I guess you're right. lazierness hasn't all sunk in yet. |
| 17:04 | jbondeson | err i am a non-empty seq that is. |
| 17:04 | jbondeson | i just seem to do that quite a bit with the new lazy seqs |
| 17:04 | Chouser | (#(and (seq? x) (seq x)) '(1 2 3)) |
| 17:05 | Chouser | ,(#(and (seq? x) (seq x)) '(1 2 3)) |
| 17:05 | clojurebot | java.lang.Exception: Unable to resolve symbol: x in this context |
| 17:05 | Chouser | ,(#(and (seq? %) (seq %)) '(1 2 3)) |
| 17:05 | clojurebot | (1 2 3) |
| 17:05 | hiredman | I would like #(or (and (seq? %) (seq %)) %) |
| 17:06 | Chouser | jbondeson: I guess you don't need to differentiate between lazy seqs and lists? |
| 17:06 | jbondeson | Chouser: right, i want '() and (lazy-seq nil) to be treated the same |
| 17:06 | Lau_of_DK | Guys, new screenshots at http://wiki.github.com/Lau-of-DK/sofiaba - The new stuff is detailmaps and pre-made landscape (as opposed to fractals generated on the fly), and the entire world can now be controlled from the repl, ie. interactively. next up: Physics :) |
| 17:06 | Lau_of_DK | |
| 17:07 | cemerick | Lau_of_DK: hey, that looks sick! :-D |
| 17:07 | jbondeson | I just need to make sure i'm not getting an empty list |
| 17:08 | Lau_of_DK | cemerick: Yea, but its gonna get real good soon :) |
| 17:08 | jbondeson | the other option is (if (seq? x) (when-let [y (first x)] ... )) |
| 17:08 | jbondeson | which i don't particularly like |
| 17:08 | Chouser | jbondeson: why not just (seq x) -- true for non-empty collections and seqs, false for nil and empty seqs |
| 17:09 | cemerick | I'm glad to know about jmonkeyengine -- looks like fun stuff |
| 17:09 | Lau_of_DK | cemerick: It has huge potential, but until I get everything wrapped its a real pain the java Interop |
| 17:09 | jbondeson | Chouser: I could do that, if i don't want to treat the non-lists differently |
| 17:09 | Lau_of_DK | Anyway, I gotta get to bed, if anybody want to contribute with porting the physics of models part - let me know, good night all |
| 17:16 | tashafa | hmm.. is there a particular revision of clojure I need to get? 'cause when I start slime I get errors about being unable to resolve lazy-cons |
| 17:16 | technomancy | tashafa: are you sure those are slime errors? can you try the same code from a bare REPL? |
| 17:16 | jbondeson | your swank-clojure is out of date. |
| 17:17 | tashafa | i just fetched swank-clojure from git though |
| 17:18 | jbondeson | odd, cause he got rid of lazy-cons last week |
| 17:18 | technomancy | tashafa: it's probably not a slime problem then |
| 17:18 | technomancy | it's probably just an error in another library that's getting displayed by slime |
| 17:18 | technomancy | tashafa: what's the codebase? |
| 17:18 | jbondeson | do you have any hooks that setup your slime repl? |
| 17:18 | tashafa | yeah... its not a slime problem |
| 17:19 | tashafa | but thats where the java Exception is cropping up |
| 17:20 | tashafa | hmm not that i know of |
| 17:20 | tashafa | everything is fresh... fresh .emacs fresh clojure.jar, swank, clojure-mode, slime |
| 17:21 | tashafa | all pristine from their repos |
| 17:22 | technomancy | tashafa: any dependency libs? contrib? |
| 17:22 | tashafa | i use contrib |
| 17:22 | tashafa | hmm ... |
| 17:22 | technomancy | tashafa: some of the contrib libraries haven't been updated yet. |
| 17:22 | tashafa | wait i havent updatated compojure |
| 17:23 | tashafa | thats in my class path |
| 17:31 | tashafa | no success |
| 17:32 | tashafa | everything in my classpath is updated |
| 17:32 | tashafa | something is calling lazy-cons still |
| 17:32 | tashafa | which has been removed |
| 17:33 | tashafa | ,(doc lazy-cons) |
| 17:33 | clojurebot | java.lang.Exception: Unable to resolve var: lazy-cons in this context |
| 17:34 | Chouser | tashafa: can't you get a stack trace? |
| 17:35 | Chouser | it should tell you the file and line number where it's finding a use of lazy-cons |
| 17:36 | tashafa | it only shows one line errors, it does this right after 'M-x slime' |
| 17:37 | technomancy | tashafa: you should be able to press 1 to see what caused the error |
| 17:38 | tashafa | core.clj line 70 |
| 17:40 | tashafa | nah it isnt quite connected to the REPL |
| 17:40 | Chouser | that's certainly not svn 1305 |
| 17:40 | hiredman | tashafa: actually someone last night ran into this |
| 17:40 | tashafa | its in that inferior lisp mode |
| 17:40 | hiredman | getting errors about line 70 in core.clj |
| 17:41 | tashafa | yeah i dont see lazy-cons in core.clj |
| 17:41 | hiredman | of course |
| 17:41 | hiredman | because it isn't there |
| 17:43 | tashafa | yeah but something thinks it is |
| 17:43 | tashafa | or it should be |
| 17:43 | tashafa | ... rebuilding clojure jar |
| 17:44 | hiredman | run ant clean first |
| 17:45 | tashafa | will do |
| 17:49 | tashafa | hiredman: i found that thread you are trying to remember |
| 17:50 | hiredman | does it fix it? |
| 17:50 | tashafa | for him, yes |
| 17:51 | tashafa | he basically ran clean and rebuild ant tasks |
| 17:51 | tashafa | doing the same right now |
| 17:56 | tashafa | :( |
| 17:56 | tashafa | no luck |
| 17:59 | Chouser | too many moving parts |
| 18:03 | tashafa | what is? |
| 18:06 | whidden | tashafa: you still having issues with slime? |
| 18:08 | tashafa | yup |
| 18:09 | tashafa | i've searched all core.clj files on line 70 for lazy-cons and I cant find were it being referenced |
| 18:09 | whidden | its in commands |
| 18:09 | tashafa | ? |
| 18:09 | whidden | basic.clj and indent |
| 18:10 | whidden | s/indent/indent.clj/ |
| 18:10 | tashafa | in clojure? |
| 18:10 | whidden | no in swank |
| 18:10 | whidden | in clojure lazy is gone if i understand the lazy stuff is now in head. |
| 18:11 | whidden | or what i mean is there is all things are lazy thus |
| 18:11 | jbondeson | whidden: that's all been updated |
| 18:11 | whidden | no need to specify lazy. |
| 18:11 | tashafa | yup thats where it is |
| 18:11 | jbondeson | tashafa: wait, you found a lazy-cons? |
| 18:11 | tashafa | yeah |
| 18:11 | jbondeson | if you did your swank-clojure is out of date |
| 18:12 | jbondeson | they are all gone |
| 18:12 | tashafa | in swank |
| 18:12 | whidden | how long ago did you get the swank-clojure head? |
| 18:12 | tashafa | hmm i'll pull from github again |
| 18:12 | tashafa | just now |
| 18:12 | whidden | 14 hours ago is when indent.clj was last updated. |
| 18:13 | tashafa | like an hour ago |
| 18:15 | tashafa | jochu's swank from github right? |
| 18:15 | whidden | yep |
| 18:15 | jbondeson | yes, master |
| 18:15 | jbondeson | as in that's the branch |
| 18:15 | tashafa | aight cool thx |
| 18:18 | tashafa | ok that kinda worked... |
| 18:18 | tashafa | java.lang.RuntimeException: java.util.regex.PatternSyntaxException: Unexpected internal error near index 1 |
| 18:18 | jbondeson | tashafa: yeah, you'll get that, but it doesn't affect slime any |
| 18:18 | tashafa | the repl says is connected but im not in the proper clojure repl |
| 18:19 | whidden | hit return twice |
| 18:19 | tashafa | tried that |
| 18:19 | tashafa | no success |
| 18:20 | tashafa | question about hitting the enter twice... i used to not do that, but i updated and i started doing it, before today... is that normal? |
| 18:21 | whidden | i have to catch a train in a couple of minutes. I'll try getting the newest clojure working with slime tonight or early tomorrow. |
| 18:21 | tashafa | cool... thanks for all your help! |
| 18:21 | whidden | not normal, but it had something to do with how repl and slime were communicating. |
| 18:22 | whidden | the fix for that was nonsensical to me. |
| 18:22 | whidden | basicaly asking clojure to generate a random number for silme. |
| 18:23 | tashafa | and how do i go about doing that, if you dont mind |
| 18:23 | whidden | this was part of the line added to fix that .. " "(println (java.util.UUID/randomUUID))\n"" |
| 18:23 | tashafa | sorry but, where does that go? |
| 18:23 | whidden | but you should have that in swank-clojure.el |
| 18:24 | tashafa | .el |
| 18:24 | whidden | yes. |
| 18:24 | whidden | emacs elisp file. |
| 18:25 | tashafa | even though it calls java. |
| 18:26 | lisppaste8 | whidden pasted "swank stuff" at http://paste.lisp.org/display/76114 |
| 18:26 | tashafa | whidden: thanks |
| 18:27 | tashafa | dont let me make you miss your train |
| 18:27 | whidden | just trying to give back the help i got. |
| 18:27 | whidden | thanks.. 3 more minutes before the bell tolls :) |
| 18:27 | whidden | need to pack up thought.. later. |
| 18:27 | tashafa | alright my man, thanks again |
| 18:31 | jkantz | question about laziness: when doing (map my-fn stuff) if I want my-fn to refer to a dynamic binding, say foo do I need to capture the binding like this (map (let [x foo] (fn [arg] (binding [foo x] (my-fn arg))) stuff)? |
| 18:32 | hiredman | ,(binding [*out* 1] (map #(+ *out* %) (range 5))) |
| 18:32 | clojurebot | java.lang.ClassCastException: java.io.StringWriter cannot be cast to java.lang.Number |
| 18:33 | hiredman | ,(binding [*out* 1] (doall (map #(+ *out* %) (range 5)))) |
| 18:33 | clojurebot | (1 2 3 4 5) |
| 18:33 | hiredman | ~map? |
| 18:33 | clojurebot | map is *LAZY* |
| 18:33 | hiredman | anyway, no, you don't |
| 18:34 | jkantz | but if I want to retain the laziness ... it looks like I would. |
| 18:34 | hiredman | I guess |
| 18:35 | Chouser | you want the fn you're giving to map to keep access to the dynamic context where it was defined? |
| 18:35 | jkantz | yeah |
| 18:36 | Chouser | you'll have to capture the dynamic values you want in a lexical scope |
| 18:36 | Chouser | I saw a macro for that recently... |
| 18:39 | Chouser | hm, no that's specifically for agents |
| 18:39 | Chouser | http://clj-me.blogspot.com/2009/01/bindings-and-send.html |
| 18:39 | Chouser | but I think you could do something similar |
| 18:42 | jkantz | ok thks, is it desirable for a lazy seq to not capture it's dynamic context, or is this just the way it works? |
| 18:44 | jkantz | I guess that would require continuations |
| 18:44 | tashafa | ok i have swank and everythig working... but its stuck in inferior lisp mode |
| 18:45 | tashafa | how do i get to clojure repl |
| 18:45 | technomancy | tashafa: does your slime-setup call include slime-repl or slime-fancy? |
| 18:46 | tashafa | nope ... just require slime then slime seup |
| 18:46 | tashafa | setup* |
| 18:46 | hiredman | jkantz: I dunno, seems like the point of dynamic scopes is they are dynamic |
| 18:47 | technomancy | tashafa: try this instead: (slime-setup '(slime-fancy)) |
| 18:47 | technomancy | tashafa: slime recently moved the repl into contrib, so you'll need to make sure slime/contrib is on your load-path |
| 18:47 | technomancy | tashafa: have you tried using M-x clojure-install from the latest clojure-mode? |
| 18:48 | technomancy | it should automate away your woes |
| 18:48 | tashafa | nope i havent... |
| 18:49 | hiredman | but I can see how people might want to hang on to the dynamic scope in lazy-seqs |
| 18:49 | tashafa | YAY! |
| 18:49 | tashafa | slime fancy-worked |
| 18:50 | tashafa | technonacy: thanks! |
| 18:50 | technomancy | cool |
| 18:52 | jkantz | Chouser, I'm playing around with cl-style handlers and restarts and run into missing handlers when the signaling within a map fn |
| 18:52 | jkantz | error-kit may have similar issues with raise |
| 18:54 | tashafa | ,(doc frest) |
| 18:54 | clojurebot | java.lang.Exception: Unable to resolve var: frest in this context |
| 18:56 | jochu | ,(doc fnext) |
| 18:56 | clojurebot | "([x]); Same as (first (next x))" |
| 18:56 | tashafa | so frest has been removed... do i use (first (rest x)) or there's another cleaner way |
| 18:57 | tashafa | and rest is removed also right |
| 18:58 | tashafa | (doc next) |
| 18:58 | clojurebot | Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil.; arglists ([coll]) |
| 18:59 | tashafa | (doc nnext) |
| 18:59 | clojurebot | Same as (next (next x)); arglists ([x]) |
| 18:59 | hiredman | haha |
| 18:59 | hiredman | I never noticed those |
| 18:59 | hiredman | nnext |
| 18:59 | tashafa | sorry for some reason I'd rather have the clojurebot tell me than my repl |
| 19:00 | hiredman | ~botsnack |
| 19:00 | clojurebot | thanks; that was delicious. (nom nom nom) |
| 19:01 | hiredman | I have no problem with clojurebot usage |
| 19:10 | jbondeson | hah, i just did a straight prn of a zip-xml object that was loaded from a 1MB XML file and on disk it's over 250MB and still writing to disk... |
| 19:10 | durka42 | that's a pretty good compression algorithm... |
| 19:10 | hiredman | Smooth |
| 19:11 | jbondeson | 1.1MB -> 296MB |
| 19:11 | jbondeson | i guess it's good that it uses so much structure sharing in memory ;) |
| 19:12 | jbondeson | i think that maybe i won't store it on disk like that... |
| 19:12 | hiredman | maybe not |
| 19:15 | jbondeson | i think i'll have to do individual zippers as i don't care about the link back to the parent, that should eliminate most of ti |
| 19:15 | jbondeson | -ti+it |
| 19:32 | slashus2 | http://code.google.com/p/clojure/issues/detail?id=68 <-- What do you think of the patch I submitted? |
| 19:35 | hiredman | uh |
| 19:35 | hiredman | nil is false in clojure |
| 19:35 | slashus2 | I tried :-( |
| 19:35 | jbondeson | if you're in a dosync do you have access to the values of other refs you just set? |
| 19:35 | hiredman | the boolean values true and false only exist in clojure for java interop |
| 19:36 | hiredman | ,(doc deref) |
| 19:36 | clojurebot | "([ref]); Also reader macro: @ref/@agent/@var/@atom/@delay/@future. Within a transaction, returns the in-transaction-value of ref, else returns the most-recently-committed value of ref. When applied to a var, agent or atom, returns its current state. When applied to a delay, forces it if not already forced. When applied to a future, will block if computation not complete" |
| 19:36 | jbondeson | hah |
| 19:36 | slashus2 | hiredman: I did it for consistency. The function returns false for most every other case, but in the case he showed it returned nil. |
| 19:36 | slashus2 | ,(every? (fn [x] (> x 6)) [1 2 3]) |
| 19:36 | clojurebot | false |
| 19:37 | hiredman | ,(> 1 6) |
| 19:37 | clojurebot | false |
| 19:37 | slashus2 | Yes that is correct |
| 19:37 | hiredman | it depends on the predicate |
| 19:37 | slashus2 | ,(every? #{\space} "dam") |
| 19:37 | clojurebot | nil |
| 19:37 | hiredman | ,(#{1} 0) |
| 19:37 | clojurebot | nil |
| 19:37 | slashus2 | My version just returns false in that case too. |
| 19:38 | hiredman | ,(every? #(= % \space) "dam") |
| 19:38 | clojurebot | false |
| 19:38 | hiredman | slashus2: I don't see any point |
| 19:38 | hiredman | but, who am I to say |
| 19:39 | slashus2 | I guess my version makes it work with sets too. |
| 19:39 | hiredman | it already works with sets |
| 19:39 | slashus2 | I mean, return false with sets, not nil. |
| 19:40 | slashus2 | Even though that are equivalent. |
| 19:42 | hiredman | if anything I would change > and friends to return nil |
| 19:43 | slashus2 | So we actually are shooting for everything to return nil? |
| 19:43 | slashus2 | Within the core? |
| 19:46 | technomancy | hah; you can use add-classpath with URLs. |
| 19:46 | technomancy | this is crazy + awesome: http://clj-me.blogspot.com/2009/01/living-on-bleeding-edge.html |
| 19:49 | slashus2 | That is neat. |
| 19:50 | jbondeson | technomancy: yeah, they found that a while ago. don't think i'd ever do it though. |
| 19:51 | technomancy | jbondeson: reminds me of the hobix installation instructions: ruby -ropen-uri -e 'eval(open("http://go.hobix.com/").read)' |
| 19:51 | technomancy | you have to be at least a *little* crazy to try that |
| 19:51 | jbondeson | yeeaaaah |
| 19:52 | jbondeson | from 298MB to 1.3MB! |
| 20:03 | slashus2 | I was playing around with clojure, and openjdk crashed. Oh my. |
| 20:03 | slashus2 | When I try to run java now, it gives me a strange message about saying that it could not determine my current working directory. |
| 20:08 | technomancy | slashus2: maybe cd . |
| 20:08 | slashus2 | technomancy: It worked again after I changed the directory. |
| 20:30 | powr-toc | slashus2: are you on a network drive, like NFS? |
| 20:30 | slashus2 | no |
| 20:31 | powr-toc | slashus2: are you in a directory which has been removed and then recreated? |
| 20:34 | slashus2 | powr-toc: When java crashed, it started saying that problem. It fixed it when I changed directories and back again. |
| 20:35 | Chouser | jkantz: yes, error-kit would behave similarly. |
| 20:36 | Chouser | as would try/catch blocks, I believe. |
| 20:36 | powr-toc | slashus2: odd... you some systems give you errors like that when your terminal/program is running in a directory which has been deleted and rebuilt... you get it quite a bit with build scripts |
| 20:39 | slashus2 | powr-toc: It was a segfault in openjdk. |
| 20:39 | Chouser | ,(try (lazy-cat [1 2] (throw (Exception. "foo"))) (catch Exception e "caught")) |
| 20:39 | clojurebot | Pardon? |
| 20:39 | Chouser | oh, he doesn't let you do try/catch |
| 20:40 | Chouser | anyway, that fails to catch the exception because it's not thrown until the seq is being printed, outside of the 'try' block |
| 20:42 | cemerick | wow, those c.l.l folks really know how to throw a party (re: the 'road to clojure' thread) |
| 20:42 | hiredman | clojurebot: lazy? |
| 20:42 | clojurebot | lazy is hard |
| 20:42 | Chouser | I guess throwing an exception can be thought of as a kind of side-effect. |
| 20:43 | cemerick | I'm so happy that #clojure and the group are so pleasant. |
| 20:45 | Chouser | cemerick: yes |
| 21:38 | talios | Does anyone know if the clojure compiler can generate jdk annotations on a method/class? |
| 21:39 | Chouser | I believe it currently cannot. |
| 21:40 | talios | :( Pity, that could be in handy. |
| 21:41 | talios | er, darn my thought patterns, -be+come :) |
| 21:43 | Chouser | it comes up. I guess I should learn what they are. |
| 21:44 | talios | compile/runtime metadata for java classes. Such as say "@Test public void thisIsATestMethod() {...}" - other code can look for methods that have the @Test annotation. |
| 21:44 | talios | java classes/fields/methods that is. |
| 21:51 | danlei | b |
| 21:54 | gnuvince_ | Oh ZING! http://www.lispcast.com/why-clojure.html |
| 21:54 | gnuvince_ | c.l.l is gonna have a field trip with that :) |
| 21:56 | Chouser | succinct |
| 21:58 | danlarkin | gentoo.org isn't responding for me, but downforeveryoneorjustme.com says it's up, can everyone else hit it? |
| 21:59 | gnuvince_ | Funnily, people on reddit call him "fanatic". If he'd written "Subversion is a dead end. I want to be a part of Git's bright future", redditors would've fallen over themselves to agree with him |
| 21:59 | Chouser | danlarkin: "Waiting for www.gentoo.org..." |
| 21:59 | icey | gnuvince_: the problem with the herd mentality is that it requires many many sheep ;) |
| 22:00 | talios | baaaaaaaaaaaaaaaaa |
| 22:00 | danlarkin | Chouser, danlei: ok thanks, at least it isn't just me |
| 22:01 | gnuvince_ | icey: yeah |
| 22:01 | danlarkin | gnuvince_: is this post on reddit yet? or at you saying in general they call him a fanatic |
| 22:01 | gnuvince_ | danlarkin: it is, but downvoted enough that it's not on the front page |
| 22:01 | gnuvince_ | http://www.reddit.com/r/programming/comments/7zyla/i_want_to_be_a_part_of_clojures_bright_future/ |
| 22:02 | danlei | personally, i'd say: if cl is a dead end, then a very flexible one. |
| 22:03 | gnuvince_ | awww, not mentioned on cll :) |
| 22:04 | icey | cll is a waste of time |
| 22:04 | danlei | i don't think so |
| 22:04 | danlei | i like them both (cl & clojure) |
| 22:04 | icey | CL is not a waste of time. the newsgroup is |
| 22:04 | danlei | ups |
| 22:05 | icey | there are clearly very very smart people there, but the problem is they have too much time on their hands so they troll ;) |
| 22:06 | stuarthalloway | evening all |
| 22:06 | icey | evening stuarthalloway |
| 22:06 | stuarthalloway | I am updating the sequences chapter and am hoping to get some feedback on the following nouns: seq, sequence, iseq |
| 22:06 | icey | how goes the book? |
| 22:07 | stuarthalloway | Having read through mail and IRC logs, I want to define them as follows: |
| 22:07 | danlei` | but sometimes it's also a good place to learn. rich, for example, was very patient and informative during the discussion with pascal. |
| 22:08 | stuarthalloway | a seq (noun) is an abstract view of a collection, and is represented internally as an ISeq |
| 22:08 | stuarthalloway | a seq (function) returns a seq (noun) on a collection, or nil if nil/empty |
| 22:09 | stuarthalloway | a collection that can be seq-ed is said to be seq-able (that should be any collection!) |
| 22:09 | icey | danlei`: sure, but for every good thread there are 3 posts about removing parens, 2 posts about someone's CS homework, a Xah Lee diatribe, Jon Harrop coming in to talk about F# and then a series of posts where Kenny Tilton talks about how he got Cells (tm) to work on his toaster oven. |
| 22:09 | stuarthalloway | a sequence is a seq-able collection |
| 22:10 | danlei` | icey: yes, the frogger, xah, jillian etc. can be really annoying ... |
| 22:10 | stuarthalloway | I know this all sounds pedantic, but it is important to nail this stuff down for beginners |
| 22:10 | hiredman | there is a sequence function too btw |
| 22:10 | Chouser | stuarthalloway: it is important. thanks for pursuing it. |
| 22:10 | icey | stuarthalloway: guys like me really appreciate it :D |
| 22:11 | stuarthalloway | hiredman: aaargh! :-) |
| 22:12 | Chouser | oh, I didn't know about that. |
| 22:12 | hiredman | I dunno if it is a useful function, but rhicky obviously thinks it is |
| 22:13 | stuarthalloway | hiredman: I can see where it might be useful |
| 22:13 | stuarthalloway | but it *totally* screws up the definitions I just laid out |
| 22:13 | stuarthalloway | without even invalidating them .... |
| 22:14 | stuarthalloway | given the definitions I proposed, sequence (function) ought to be named seq |
| 22:14 | stuarthalloway | but of course that is already taken! |
| 22:15 | stuarthalloway | maybe sequence could be renamed as-seq or something like that -- is there any naming idiom for coercion? |
| 22:15 | hiredman | well, (sequence ...) can return an emtpy ISeq |
| 22:15 | hiredman | which (seq ...) cannot |
| 22:16 | Chouser | stuarthalloway: yeah, just the name of the type. (int 5) (float 3.0) |
| 22:16 | Chouser | (seq ...) |
| 22:16 | stuarthalloway | Chouser: so seq is a doubly-bad name, since it returns nil when the coercion fails :-) |
| 22:17 | hiredman | ,(seq 2) |
| 22:17 | clojurebot | java.lang.IllegalArgumentException: Don't know how to create ISeq from: Integer |
| 22:17 | hiredman | doesn't look like nil to me |
| 22:17 | stuarthalloway | ,(seq []) |
| 22:17 | clojurebot | nil |
| 22:17 | hiredman | that is not failure |
| 22:18 | stuarthalloway | hiredman: point taken, but |
| 22:18 | danlei | you'll need it for conditionals |
| 22:18 | stuarthalloway | (backing up) I see the need for all the functions |
| 22:19 | stuarthalloway | it is the names that kill me |
| 22:19 | stuarthalloway | () is a legal seq |
| 22:19 | stuarthalloway | so if seq coerces, then (seq ()) === () |
| 22:19 | stuarthalloway | ,(seq ()) |
| 22:19 | clojurebot | nil |
| 22:20 | hiredman | the docstring of seq says nothing about coercetion |
| 22:20 | hiredman | sequene on the other hand does |
| 22:20 | hiredman | sequence |
| 22:20 | hiredman | ,(doc seq) |
| 22:20 | clojurebot | "([coll]); Returns a seq on the collection. If the collection is empty, returns nil. (seq nil) returns nil. seq also works on Strings, native Java arrays (of reference types) and any objects that implement Iterable." |
| 22:21 | Chouser | ISeq no longer promises non-emptiness, but 'seq' still does. |
| 22:21 | stuarthalloway | hiredman: exactly! sequence coerces to seq, and seq doesn't coerce. Confusing! |
| 22:21 | stuarthalloway | especially when sequence is a noun that (used to?) mean something |
| 22:22 | hiredman | we should start capitalizing types |
| 22:22 | stuarthalloway | Clojure defines many algorithms in terms of sequences (seqs). (http://clojure.org/sequences) |
| 22:22 | hiredman | sequence returns a Sequence |
| 22:22 | hiredman | or Seq |
| 22:23 | Chouser | There is no Sequence |
| 22:23 | Chouser | ASeq, ISeq, Sequential |
| 22:23 | hiredman | Chouser: I just magicked one |
| 22:23 | stuarthalloway | If ISeq and seq (noun) are 100% equivalent, then we could say ISeq and stop using seq as a noun |
| 22:24 | hiredman | stuarthalloway: makes sense to me |
| 22:24 | Chouser | Except that colloqually, we often say seq when we mean "ISeq or nil" |
| 22:25 | Chouser | hm, we used to anyway. |
| 22:25 | Chouser | filter returns |
| 22:25 | Chouser | "filter returns a seq" |
| 22:25 | stuarthalloway | Chouser: well, and in that case seq (function) is a legit coercion to seq (noun) |
| 22:25 | stuarthalloway | it seems to me that seq (noun) as currently used cannot be nil |
| 22:26 | stuarthalloway | seqs can be empty / always an ISeq (http://clojure.org/lazy) |
| 22:26 | danlei | stuarthalloway: Changed: seqs can be empty |
| 22:26 | danlei | stuarthalloway: so i guess, you're right |
| 22:26 | stuarthalloway | Me right == bad thing. I'm confused. :-) |
| 22:27 | stuarthalloway | so far I am still happy with the definitions I threw out 20 minutes ago |
| 22:27 | danlei | i'm working through the recent changes, too :) |
| 22:28 | stuarthalloway | if the (new?) sequence function could only have a different name |
| 22:28 | stuarthalloway | maybe (iseq ...) |
| 22:28 | hiredman | well |
| 22:29 | Chouser | stuarthalloway: you might be able to make that happen -- it's pretty new. |
| 22:30 | Raynes | (doc new) |
| 22:30 | Raynes | (doc new?) |
| 22:30 | clojurebot | Pardon? |
| 22:30 | clojurebot | I don't understand. |
| 22:30 | Raynes | Just had to. |
| 22:30 | stuarthalloway | if sequence and seq remain synonyms, all is well |
| 22:30 | stuarthalloway | and the name sequence is just fine with me |
| 22:30 | stuarthalloway | (for the new fn, that is) |
| 22:33 | mblinn | if you've got a file full of functions that you load into the repl, is there a way to use a function before it's defined? |
| 22:34 | danlei | ,(doc declare) |
| 22:34 | clojurebot | "([& names]); defs the supplied var names with no bindings, useful for making forward declarations." |
| 22:34 | hiredman | ^- |
| 22:34 | mblinn | thanks |
| 22:40 | stuarthalloway | I posted my seq/ISeq/sequence thoughts to the list and am going to bed. cya. |
| 22:49 | hiredman | clojurebot: twitteronia is where shaq lives |
| 22:49 | clojurebot | Ik begrijp |
| 23:11 | technomancy | so java.util.Calendar is kind of a higher-level java.util.Date? |
| 23:13 | hiredman | should clojurebot notify the channel of tweets mentioning clojure? |
| 23:15 | technomancy | that seems like it could go overboard quickly |
| 23:16 | hiredman | I guess |
| 23:16 | technomancy | it looks like there've been twenty in the last twenty hours |
| 23:16 | technomancy | and it's only going to accelerate |
| 23:20 | niet | can clojure have stack overflows because of laziness like haskell? or clojure doesnt have that kind of laziness? |
| 23:30 | technomancy | clojure can have stack overflows if you use regular recursion instead of explicit recur for large data structures, lazy or not |
| 23:33 | hiredman | clojure's laziness is much more explicit then haskell's |
| 23:35 | niet | it seems so |
| 23:36 | niet | but i mean can tailrecursive (loop/recurs) cause stack overflow due to laziness? |
| 23:36 | technomancy | say you've got a vector of numbers. how would you add N to the Mth element? |
| 23:36 | hiredman | no |
| 23:36 | hiredman | loop/recur is not lazy |
| 23:37 | hiredman | ,(update-in [1 2 3] [1] inc) |
| 23:37 | clojurebot | [1 3 3] |
| 23:37 | hiredman | that is how |
| 23:39 | technomancy | hiredman: sweet; thanks |
| 23:39 | hiredman | ,((fn [v m n] (update-in v [m] (partial + n))) [1 2 3] 1 3) |
| 23:39 | clojurebot | [1 5 3] |
| 23:41 | hiredman | np |
| 23:46 | hiredman | ,(last (take 4 (iterate list '()))) |
| 23:46 | clojurebot | (((()))) |