2009-08-02
| 00:01 | mebaran151_ | svn always seemed too much for me |
| 00:01 | Anniepoo | so is *compile-path* an atom, or what? it's not very useful to tell us it needs to |
| 00:01 | mebaran151_ | the nice thing about mercurial, you don't need any server |
| 00:02 | Chouser | *compile-path* is a var. Use 'set!' to change it at a repl. |
| 00:02 | Anniepoo | A loader classfile will produced in my/domain/lib__init.class, under *compile-path*, which must be in the classpath |
| 00:02 | Anniepoo | thanks |
| 00:03 | Anniepoo | ok, amazingly |
| 00:03 | Anniepoo | it persists the state of the repl |
| 00:03 | Anniepoo | LOL |
| 00:03 | Anniepoo | I think that's how I 'corrupted' my old project |
| 00:09 | mebaran151_ | oh that's happened to me a couple times |
| 00:09 | mebaran151_ | wondered why my nice fixed functions were neither nice nor fixed |
| 00:09 | clojurebot | http://clojure.org/rationale |
| 00:10 | Anniepoo | yes, but I've been working on this project for a couple weeks, have rebooted the machine many times |
| 00:10 | Anniepoo | just how long is that supposed to persist? |
| 00:11 | mebaran151_ | does IntelliJ give you an option to reset th repl? |
| 00:11 | Anniepoo | I work inside the Second Life environment. LSL has this problem - there's no save, only passivate, |
| 00:12 | Anniepoo | so you can have scripts that have weird old state |
| 00:13 | mebaran151_ | smalltalk had a solution to this whole conundrum but I forgot what it was |
| 00:13 | Chouser | heh |
| 00:13 | JAS415 | save the whole damn thing? |
| 00:13 | mebaran151_ | explicit saving is bad because it means you can lose work, but non-saving means you have less control of what actually goes in |
| 00:14 | mebaran151_ | in smalltalk you dev'ed inside this pretty neat image that saved saved the entire state of the app, not just the src |
| 00:15 | Anniepoo | there's a commercial product sold in second life that lets you record and play back an animation on an object |
| 00:16 | mebaran151 | ,(= (fn []) (fn [])) |
| 00:16 | clojurebot | false |
| 00:16 | mebaran151 | ah nuts, you can't test function equality |
| 00:16 | Anniepoo | it works by recording into a list. Many people have used this to make other commercial products, all of which depend on their state not being reset |
| 00:16 | JAS415 | ,(let [x (fn [])] (= x x)) |
| 00:16 | clojurebot | true |
| 00:17 | JAS415 | you can test equality they're just different object or w/e |
| 00:17 | mebaran151 | but I wanted to see if two separately instantiated functions that were the same bytecode wise would compare the same |
| 00:18 | mebaran151 | it also means I probably can't usefully use functions as keys in my index map :| |
| 00:29 | Anniepoo | ok, superstition reigns |
| 00:30 | Anniepoo | before I try to use sh again I'm going to check everything into SVN |
| 00:30 | Anniepoo | LOL |
| 00:30 | JAS415 | superstition and voodoo are the ways of software development :-) |
| 00:31 | JAS415 | but you have to have superstition and voodoo locally bound when you are macroexpanding your forms or else you get a null pointer error which you can't locate |
| 00:32 | Anniepoo | I worked at a place, they had a programmer who had heard about some crazy method of |
| 00:32 | Anniepoo | saving a few cycles in an assembler loop - so he did this all the time with his java |
| 00:39 | JAS415 | i do maintenance on code of the 'spaghetti' variety, so its not so much a matter of figuring out the best way to fix it, it is the minimizing the negative side effects of bugfixes |
| 00:39 | JAS415 | is not so much software engineering, but controlling chaos |
| 00:41 | Anniepoo | I worked at a place where the boss was going slowly insane. Literally. |
| 00:42 | Anniepoo | it didn't help his code much |
| 00:42 | clojurebot | http://www.khanacademy.org/ |
| 00:43 | JAS415 | i can imagine it would make for amusing comments though |
| 00:43 | Anniepoo | no, sadly just scary ones |
| 00:44 | JAS415 | that's too bad :-/ |
| 00:45 | Anniepoo | he was a rather polite guy, a 'jolly chinaman' sort. We started finding wildly obscene comments in his code |
| 00:45 | Anniepoo | groan, I just noticed I imported all my class files |
| 00:45 | mebaran151 | how would one convert an integer into 4 bytes in clojure |
| 00:46 | mebaran151 | I seem to be failing |
| 00:46 | mebaran151 | poor guy |
| 00:53 | Chouser | ,(seq (.toByteArray (.toBigInteger 23456M))) |
| 00:53 | clojurebot | (91 -96) |
| 00:53 | Chouser | mebaran151: there's probably a better way |
| 00:54 | JAS415 | you can probably do something with byte masking |
| 00:54 | mebaran151 | (into-array |
| 00:54 | mebaran151 | (reverse (map |
| 00:54 | mebaran151 | #(byte (bit-and (bit-shift-right n (* %1 8)) 0x000000FF)) |
| 00:54 | mebaran151 | (range 0 4))) |
| 00:54 | mebaran151 | )) |
| 00:54 | JAS415 | ? |
| 00:55 | mebaran151 | this is what I've got |
| 00:55 | mebaran151 | I think it's right but I'm not one hundred percent confident especially with negative numbers (where's uint when you need it...) |
| 00:56 | Chouser | ,(map #(byte (bit-and % 255)) (take-while pos? (iterate #(bit-shift-right % 8) 23456))) |
| 00:56 | clojurebot | (-96 91) |
| 01:00 | mebaran151 | heh, yours is cooler, but I think we do the same thing |
| 01:00 | mebaran151 | except you can handle longs with your fancy iterate method |
| 01:01 | mebaran151 | now what I really want is lexographically orderable numbers (ie the largest into would be straight 1's and the smallest integer would be straight 0')) |
| 01:01 | clojurebot | (pl reverse $ (↕reduce range $ 10 () λxy (↕conj inc $ y x))) |
| 01:02 | Anniepoo | ok, putting all this in a repository is going to wait |
| 01:03 | Anniepoo | after classpath hell I'm not in the mood to deal with it |
| 01:04 | mebaran151 | eh |
| 01:04 | mebaran151 | mercurial is super easy |
| 01:04 | mebaran151 | hg init |
| 01:04 | mebaran151 | hd addremove |
| 01:04 | mebaran151 | hd commit -m "I'm done!" |
| 01:04 | mebaran151 | *hg |
| 01:05 | Anniepoo | well, I know how to use svn |
| 01:06 | Anniepoo | with the tortoise client it's pretty brainless as well |
| 01:06 | Anniepoo | but I don't want to sort through what does and doesn't get added |
| 01:07 | Anniepoo | before I go back to sh hell I'm going to go relax a bit |
| 01:07 | Anniepoo | see ya |
| 01:08 | mebaran151 | good luck |
| 01:08 | JAS415 | oh man |
| 01:08 | JAS415 | clojure checks the namespaces inside of (comment *) things |
| 01:08 | mebaran151 | huh? |
| 01:08 | JAS415 | yeah for serious |
| 01:09 | mebaran151 | how does it check? |
| 01:09 | Chouser | what do you mean by "checks the namespaces"? |
| 01:09 | JAS415 | i had for example (twitter-api/blah-function stuff) |
| 01:09 | JAS415 | wrapped in a comment |
| 01:09 | JAS415 | ooh |
| 01:09 | mebaran151 | and if you want a super comment #_() is your best bet |
| 01:09 | Chouser | ,(comment made-up/stuff blah/blah) |
| 01:09 | clojurebot | nil |
| 01:09 | JAS415 | no it was checking |
| 01:09 | JAS415 | it was checking the tokens themselves |
| 01:10 | JAS415 | i had (comment (foo twitter-api/ )) |
| 01:10 | Chouser | ,(comment made-up/) |
| 01:10 | clojurebot | Invalid token: made-up/ |
| 01:10 | Chouser | yeah, it has to be readable. |
| 01:10 | Chouser | ,(command ###) |
| 01:10 | clojurebot | No dispatch macro for: # |
| 01:10 | JAS415 | ,(comment ######) |
| 01:10 | clojurebot | No dispatch macro for: # |
| 01:11 | JAS415 | oh well |
| 01:11 | mebaran151 | it actually reads my contractions just fine (things like I'd and extra periods..) |
| 01:11 | JAS415 | ,(comment i'd rather not write the code this way, but such is life) |
| 01:11 | clojurebot | nil |
| 01:12 | JAS415 | ,(comment i'd rather not write the code this way; but such is life) |
| 01:12 | clojurebot | EOF while reading |
| 01:13 | Chouser | real block comments are on the to do |
| 01:16 | mebaran151 | I've just been using ;; |
| 01:16 | mebaran151 | doesn't #() work? |
| 01:16 | mebaran151 | ,(comment I'd rather not work this hard) |
| 01:16 | clojurebot | nil |
| 01:17 | mebaran151 | #_(comment I'd rather/ not work this hard) |
| 01:17 | mebaran151 | ,#_(comment I'd rather/ not work this hard) |
| 01:17 | clojurebot | Invalid token: rather/ |
| 01:17 | mebaran151 | oh it still reads it: interesting |
| 01:24 | Anniepoo | and, without changing the code any, when I get back to my sh problem it now has a different error |
| 01:25 | Anniepoo | 8cD |
| 01:25 | JAS415 | o |
| 01:25 | JAS415 | what's the error now |
| 01:27 | mebaran151 | this channel by far has the most functional ircbot |
| 01:30 | clojurebot | they like me! they like me! |
| 01:35 | Anniepoo | the new error is more reasonably my problem |
| 01:36 | Anniepoo | it's all working now |
| 01:36 | Anniepoo | I don't like all the hidden 'what's my directory' games |
| 01:37 | Anniepoo | 8cP The next error, fittingly for today, is that repainting is triggering the process that launches photoshop |
| 01:52 | Anniepoo | is sh taking place in a transaction? it shouldn't get retried |
| 01:56 | mattrepl | hrmm, CPBezierPath appears to no longer have a setStroke:, setFill:, or set: to indicate the color used when drawing. I must be missing something |
| 01:57 | Anniepoo | it probably picks up the Java2D stroke/fill? |
| 01:58 | Anniepoo | and what lib is this? |
| 01:58 | Anniepoo | cause I could use a bezier |
| 01:58 | mattrepl | oh my.. it's late here... =) that was meant for #cappuccino. sorry for the noise |
| 02:52 | mebaran151 | is let a special form in clojure or does it do it scheme style by translating the let block into an anonymous closure (at least how I understand it) |
| 02:56 | hoeck1 | mebaran151: its a special form, but compiles into a inner class, like fn does |
| 02:56 | hoeck1 | r/a/an |
| 02:57 | mebaran151 | compiler doesn't do a straight substitution? |
| 03:04 | hoeck1 | mebaran151: oh, you're right, seems it doesn't generate the same code as with fn |
| 03:05 | mebaran151 | interesting |
| 03:06 | mebaran151 | the fn solution always seemed really pure |
| 03:06 | mebaran151 | that scope was determined by execution |
| 03:06 | hiredman | sure "pure" but so is cons cells made from lambdas |
| 03:06 | hiredman | but no one does that either |
| 03:07 | hiredman | I have not looked at clojure's specificly, but the logic for handling lambdas can be significantly more complex then what is needed for let |
| 03:09 | mebaran151 | all lets could be resolved at compile time can't they? |
| 03:10 | hiredman | resolved? |
| 03:12 | tomoj | I wonder how long it will take me to have any clue what the hell you people are talking about in here |
| 03:12 | mebaran151 | as in you wouldn't need to keep any trace of them around |
| 03:13 | mebaran151 | there shouldn't be any need to have the extra layer of functional indirection so I guess it's a wise compile time optimization |
| 03:13 | hiredman | I dunno, my interpreter handles lambdas and lets, but I have gotten around to adding handling of anything besides λ to the compiler |
| 03:14 | hiredman | haven't |
| 03:16 | mebaran151 | tomoj, I was just wondering if clojure handled lets the way scheme does, by building essentially an anonymous function |
| 03:17 | tomoj | I guess it would be helpful if I had learned scheme and really learned lisp well. only toyed around with lisp some. |
| 03:19 | mebaran151 | let [x y 1 2] (g x y) => (fn [x y] (g x y)) 1 2) |
| 03:19 | mebaran151 | see |
| 03:19 | hiredman | (mentioned in the mit sicp videos) |
| 03:20 | mebaran151 | I read the book rather than watching the movie :) |
| 03:23 | hoeck1 | mebaran151: you can use sth. like http://java.decompiler.free.fr/ to decompile clojure generated bytecode |
| 03:23 | hoeck1 | and see how it handles lets and fns |
| 03:24 | mebaran151 | might do it |
| 03:31 | hiredman | clojurebot: en to sp metaphor |
| 03:31 | clojurebot | Huh? |
| 03:31 | hiredman | clojurebot: translate en to sp metaphor |
| 03:31 | hiredman | clojurebot: translate en to es metaphor |
| 03:31 | hiredman | :( |
| 03:36 | mebaran151 | I've gotta admit, clojurebot is the most functional ircbot I've seen in the programming channels on freenode |
| 03:37 | hiredman | his translation function seems to have bitroted |
| 03:40 | hiredman | clojurebot: translate to es: metaphor |
| 03:40 | clojurebot | metáfora |
| 03:41 | hiredman | still works, I just forgot how to use it |
| 03:55 | jwhitlark | What do you do in clojure when you would use an event loop in another language? |
| 03:56 | jwhitlark | idiomatic clojure, I mean. |
| 03:57 | hiredman | depends |
| 03:57 | hiredman | there is always loop/recur |
| 03:57 | jwhitlark | mmm, just an infinite loop that way, ok, that makes sense. |
| 03:58 | mebaran151 | is there a programmatic macro to express every loop recur as a while? |
| 03:59 | mebaran151 | I find myself writing a lot of loop (if blank recur) (return result stuffs) |
| 04:01 | hiredman | while only breaks the loop if the test ever becomes nil, which can only happen via some kind of side-effect |
| 04:01 | hiredman | so loop/recur is more general |
| 04:02 | hiredman | the other option is to replace an infinite loop with an infinite seq |
| 04:02 | hiredman | possibly using interate or repeatedly |
| 04:04 | jwhitlark | huh, as simple as (loop [] recur)) |
| 04:04 | hiredman | ,(loop [] (recur)) |
| 04:05 | clojurebot | Execution Timed Out |
| 04:05 | hiredman | ,(take 10 (iterate inc 0)) |
| 04:05 | clojurebot | (0 1 2 3 4 5 6 7 8 9) |
| 04:08 | jwhitlark | tnx. that does the trick. I just wanted to make sure i wasn't learning a bad habit. |
| 04:12 | mebaran151 | hiredman, if I have a let binding that references a global variable which I rebind inside a function body, will the variable I assigned using let point to the old global or the new thread local? |
| 04:13 | hiredman | mebaran151: you can use a lexical binding to capture a dynamic binding |
| 04:13 | mebaran151 | okay |
| 04:13 | mebaran151 | I think that'll work out |
| 04:14 | hiredman | ,(binding [+ 1] (let [+ +] (future +))) |
| 04:14 | clojurebot | #<Object$Future$IDeref@1ab6c1c: 1> |
| 04:14 | hiredman | ,(binding [+ 1] (future +)) |
| 04:14 | clojurebot | #<Object$Future$IDeref@108f060: :pending> |
| 04:14 | hiredman | zounds |
| 04:15 | mebaran151 | (defn scoper [] |
| 04:15 | mebaran151 | (let [g *global*] |
| 04:15 | mebaran151 | (binding [*global* 2] |
| 04:15 | mebaran151 | [g *global*]))) |
| 04:15 | mebaran151 | this works as it should actually (sorry about the flood) |
| 04:32 | lbj | Morning guys |
| 04:39 | LauJensen | I've decided on a nick! :) |
| 04:39 | LauJensen | Does anyone here have a Youtube account ? |
| 04:40 | LauJensen | Hey my friend |
| 04:40 | kotarak | Hi Lau! |
| 04:40 | LauJensen | Tell me - Hows uploading handled? Does it accept all formats and converts them to a fixed size? |
| 04:40 | kotarak | Oerk. |
| 04:41 | kotarak | I uploaded something there once, and it was bad quality afterwards. :/ |
| 04:41 | kotarak | But there are a lot of information on the net, which codec to use and which format. |
| 04:41 | LauJensen | Im working on a site which accepts video uploads and I need some hints on how to handle it |
| 04:43 | kotarak | Just some random google result: http://www.pcmag.com/article2/0,2817,2330990,00.asp |
| 04:43 | kotarak | There is much more. |
| 04:44 | kotarak | But I don't know the details. I'm happy that I got done the screencasts like they are now. :) Let alone tune things... |
| 04:45 | LauJensen | Alright, thanks |
| 04:47 | LauJensen | Wow, I'll need a new server, they accept 1GB uploads |
| 05:40 | tomoj | is there a nokogiri for clojure? |
| 05:40 | tomoj | or should I just use java stuff? |
| 05:47 | tomoj | enlive looks promising |
| 06:07 | lisppaste8 | Sofra annotated #84536 "untitled" at http://paste.lisp.org/display/84536#1 |
| 06:42 | LauJensen | tomoj: I dont know about nokogiri, but if youre looking for a functional parser, best bet is Enlive |
| 06:42 | tomoj | LauJensen: thanks, just got it working a minute ago, looks great |
| 06:43 | LauJensen | Yea, check out clj-me.blogspot.com for more from the creator |
| 06:43 | tomoj | I do like being able to type css selectors as strings better, but eh |
| 06:58 | LauJensen | Att Chouser rhickey or whoever manages clojure.org, there are still links pointing to google code under libraries. |
| 07:10 | rhickey | LauJensen: thanks, fixed |
| 07:10 | LauJensen | rhickey: np :) |
| 07:14 | LauJensen | rhickey: Did you have a specific argument for not implementing import foo.*, or is it something thats coming later? |
| 07:28 | rhickey | LauJensen: import * makes a mess |
| 07:29 | rhickey | imports are runtime-enumerable, not just a compiler thing |
| 07:29 | rhickey | and, given only selective imports, we might be able to use them to do more inference on host calls (not yet implemented) |
| 07:31 | LauJensen | Ah ok - Good to know. I had the impression that this was strictly something that the compiler needed to handle, so why should I be bothered? :) Thanks for clearing it up |
| 07:33 | LauJensen | Btw rhickey. I have put some working into wrapping JMonkey, which ultimately is making a bunch of Java classes and then extending them. like VehicleClass would be extended with cannons etc to become a tank class. Im currently using only gen-class, but is this a use case of new new ? |
| 07:35 | rhickey | the intended usage of new new is: define (or use existing) statically-named interfaces, make factory fns that call new new to make anonymous implementations of those interfaces. If that fit, sure, use it |
| 07:35 | rhickey | in many cases people use named classes and explicit ctor calls when they shouldn't |
| 07:38 | LauJensen | That doesnt fit unfortunately, I was looking forward to using it. Im not sure I understand how you would make the distinction between when its correct to use named classes and explicit ctor calls though. |
| 07:38 | rhickey | only when forced to |
| 07:40 | LauJensen | k |
| 08:26 | LauJensen | I have a project with many namespaces nested. In the top namespace foo, I want to import a static javaclass that I can reference like Priority/DEBUG. Can I make that automatically available to all namespaces beneath foo, like foo.bar, foo.baz, foo.bar.baz etc without having to specificially import priority in those namespaces, and without giving a fully qualitfied name |
| 08:29 | Chousuke | LauJensen: As far as I know, no. |
| 08:36 | LauJensen | Ok |
| 10:00 | l0st3d | newbie question: if I have a lazy list of things, how do I find out if the count is larger than a number or not, without necessarily traversing the whole list |
| 10:00 | rhickey | l0st3d: there isn't a built-in limited count like that |
| 10:01 | rhickey | easy enough to write, but you will realize as much of the list as needed |
| 10:02 | l0st3d | rhickey: ok, so I guess I'd like a little help in writing that |
| 10:02 | l0st3d | rhickey: do I take-while? |
| 10:04 | l0st3d | rhickey: I'm not sure how to write the predicate without a temporary variable |
| 10:05 | rhickey | l0st3d: loop/recur should work. Give it a try and paste something |
| 10:05 | rhickey | lisppaste8: url |
| 10:05 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 10:08 | lenst | (defn count-larger? [coll n] (> (count (take (inc n) coll)) n)) |
| 10:10 | l0st3d | lenst: oh - thanks ... that's a much better solution that the one I was in the middle of concocting |
| 10:16 | Jomyoot | do you guys recommend vanila emacs or cocoa emacs for OS X? |
| 10:16 | cooldude127 | Jomyoot: cocoa emacs is now the official one |
| 10:16 | cooldude127 | Jomyoot: emacs 23 uses cocoa, and it is now the stable release |
| 10:16 | Jomyoot | what do you mean? |
| 10:17 | Jomyoot | but it is still different from the aquamacs? |
| 10:17 | Jomyoot | i was talking about aquamacs sorry |
| 10:17 | cooldude127 | i recommend plain emacs 23 |
| 10:17 | cooldude127 | aquamacs has had certain things not work for me that work on other platforms |
| 10:18 | cooldude127 | colorschemes in particular are a problem |
| 10:21 | Jomyoot | cooldude127: what do you use for directory browser, or project browser? |
| 10:22 | cooldude127 | nothing. i use ido-mode for easy file navigation in the minibuffer but that's about it |
| 10:22 | gko | Yep, I also use standard Emacs on my Mac, no Aquaemacs. |
| 10:22 | cooldude127 | Jomyoot: you could use ecb or speedbar if you wanted though |
| 10:25 | l0st3d | Jomyoot: I like eproject : http://wiki.github.com/jrockway/eproject - it's also available in ELPA |
| 10:39 | lisppaste8 | l0st3d pasted "compare the length of a seq" at http://paste.lisp.org/display/84623 |
| 10:40 | l0st3d | lenst: decided on this - thanks |
| 10:46 | rhickey | important enhancement to mutable vectors in chunks branch: http://github.com/richhickey/clojure/tree/chunks |
| 10:47 | rhickey | now protects against use in multiple threads, prevents use after immutable! call |
| 12:02 | Lioness | What does the EPL mean? Are all programs that have been programmed in Clojure, automatically under EPL because clojure.jar is necessary? Or can you choose other licenses for programs (GPL, BSD, proprietary)? |
| 12:13 | danlarkin | Lioness: the latter |
| 12:16 | Lioness | danlarkin: Thanks for the information. But how could I have found that out myself? I read the text of the EPL, but I find it not easy to understand. For example, in "3 Requirements": if I distribute object code I must do so in compliance with the terms and conditions of the EPL (wo I guess under the EPL), if I distribute source code, it must be "under this Agreement". What do I misunderstand? It's probably easy, once you have experience with |
| 12:18 | danlarkin | the EPL doesn't cover code you write (unless you want it to, of course), only clojure itself |
| 12:18 | Lioness | Okay, so the difference to the GPL is what is usually called "viral" and the EPL is not "viral", right? |
| 12:19 | danlarkin | you can use gcc (GPL) to compile proprietary code, can't you? |
| 12:19 | Lioness | only by special exception for libgcc (which I would see quite similar to clojure.jar) |
| 12:22 | danlarkin | oh, is that correct? That's not my understanding |
| 12:23 | Chousuke | yeah, the GCC licence contains an exception |
| 12:24 | Lioness | libgcc2.c says: "In addition to the permissions in the GNU General Public License, the Free Software Foundation gives you unlimited permission to link the compiled version of this file into combinations with other programs, and to distribute those combinations without any restriction coming from the use of this file. (The General Public License restrictions do apply in other respects; for example, they cover modification of the file, and di |
| 12:24 | clojurebot | this is not a bug |
| 12:28 | danlarkin | Lioness: well I see your point now more clearly |
| 12:29 | Chousuke | Lioness: the EPL FAQ says that you can combine EPL-licenced code with proprietary code. However, it seems that if you actually modify the EPL-licenced code itself and distribute it, you need to distribute the modifications as well. |
| 12:31 | Chousuke | so it seems you can't take Clojure, modify it, and then start distributing closed-source copies of it. You can, however, take clojure as is, use it with proprietary code, and distribute the result under your own licence. |
| 12:34 | Lioness | I have no idea how the topics "linking" or "derivative" are generally dealt with in the Java world, coming more from a C background. I was just thinking about the FSF's stance, that all Emacs Lisp programs have to be GPL'ed. But I see I'll have to read the EPL FAQ in detail (thanks, I didn't know it existed) and understand, which situations are covered by answer 17 ("the EPL portion") and what exactly is deemed a "module". |
| 12:34 | Lioness | Chousuke: But your interpretation sounds plausible and sensible. |
| 12:36 | Chousuke | with lisp, it gets even messier because of macros :P |
| 12:36 | Chousuke | *technically* if you use a clojure macro in a lisp program, you're introducing EPL code to it. |
| 12:38 | danlarkin | interesting |
| 12:38 | Lioness | Chousuke: Sure, but I'm doing it with every special form, not just defmacro. Even when using a macro the result should be *my* work, since I have defined the transformation, right? |
| 12:38 | Chousuke | since I suppose it can't be argued that you've *modified* the code, it should not be a derivative work. And I'm sure it's not Rich's intent either. |
| 12:41 | Chousuke | Lioness: if the macro is defined in the Clojure library, you're not the one who defines the output; you're simply passing it the parameters and the macro generates code for you. |
| 12:41 | Chousuke | Templates in C++ are similarly problematic I suppose. |
| 12:43 | wtetzner | well, technically macros are just functions, right? |
| 12:43 | Chousuke | well, yeah |
| 12:43 | wtetzner | it's just that they're called at compile time |
| 12:44 | mebaran151 | is there any more elegant way to pass a macro like a function |
| 12:44 | Chousuke | mebaran151: that rarely makes any sense. |
| 12:45 | Chousuke | but if you need to, you can use #'macroname |
| 12:45 | mebaran151 | I was thinking of something like (reduce and [all my booleans]) |
| 12:45 | mebaran151 | actually I guess I could use every now that I think about it |
| 12:45 | Lioness | Chousuke: Yes, but I think it doesn't differ substantially from other special forms. I cannot use "def ..." with the JVM, I need clojure.jar. Using Clojure's language features surely involves CLojure's code. And that's basically where my question arouse: I depend on EPL code not unlike the C concept of "linking" |
| 12:46 | mebaran151 | isn't this the whole reason for a classpath exception? |
| 12:47 | Chousuke | mebaran151: hm. yeah, you definitely should use every |
| 12:47 | Lioness | The FSF takes a really broad stance in that regard, btw: They consider all Emacs Lisp code to be covered by the GPL, as far as I know. |
| 12:47 | Chousuke | though the vars of macros have an interesting property: |
| 12:47 | Chousuke | ,(#'and 1 nil 3) |
| 12:47 | clojurebot | (clojure.core/let [and__4012__auto__ 1] (if and__4012__auto__ (clojure.core/and nil 3) and__4012__auto__)) |
| 12:47 | Lioness | mebaran151: That's probably the Java counterpart to the libgcc- and the system library exception? |
| 12:49 | Chousuke | Vars forward calls to them to the underlying value, which in the case of a macro happens to be the function that produces the macro expansion :P |
| 12:49 | Chousuke | not very useful in practice though. |
| 12:49 | mebaran151 | interesting |
| 12:50 | Chousuke | and you can make a macro out of any function by calling .setMacro on it. |
| 12:52 | Chousuke | ,(.setMacro #'+) |
| 12:52 | clojurebot | nil |
| 12:52 | Chousuke | ,(let [foo 1] (+ foo 1)) |
| 12:52 | clojurebot | java.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.Number |
| 12:52 | Chousuke | ,(alter-meta #'+ dissoc :macro) |
| 12:52 | clojurebot | java.lang.Exception: Unable to resolve symbol: alter-meta in this context |
| 12:52 | Chousuke | ,(alter-meta! #'+ dissoc :macro) |
| 12:52 | clojurebot | {:ns #<Namespace clojure.core>, :name +, :file "clojure/core.clj", :line 629, :arglists ([] [x] [x y] [x y & more]), :inline-arities #{2}, :inline #<core$fn__4091 clojure.core$fn__4091@14ef239>, :doc "Returns the sum of nums. (+) returns 0."} |
| 12:53 | Chousuke | ,(alter-meta! #'and dissoc :macro) |
| 12:53 | clojurebot | {:ns #<Namespace clojure.core>, :name and, :file "clojure/core.clj", :line 503, :arglists ([] [x] [x & next]), :doc "Evaluates exprs one at a time, from left to right. If a form\n returns logical false (nil or false), and returns that value and\n doesn't evaluate any of the other expressions, otherwise it returns\n the value of the last expr. (and) returns true."} |
| 12:53 | Chousuke | ,(and 1 2) |
| 12:53 | clojurebot | (clojure.core/let [and__4012__auto__ 1] (if and__4012__auto__ (clojure.core/and 2) and__4012__auto__)) |
| 12:53 | Chousuke | :P |
| 12:54 | Chousuke | ,(alter-meta! #'and assoc :macro true) |
| 12:54 | clojurebot | {:macro true, :ns #<Namespace clojure.core>, :name and, :file "clojure/core.clj", :line 503, :arglists ([] [x] [x & next]), :doc "Evaluates exprs one at a time, from left to right. If a form\n returns logical false (nil or false), and returns that value and\n doesn't evaluate any of the other expressions, otherwise it returns\n the value of the last expr. (and) returns true."} |
| 12:54 | Chousuke | hm |
| 14:46 | gnuvince | "C'est à mon mononcle!" -Guerre de Tuques |
| 15:01 | MarkVolkmann | The doc for commute says "At the commit point of the transaction, sets the value of ref to be: |
| 15:01 | MarkVolkmann | (apply fun most-recently-committed-value-of-ref args)". |
| 15:01 | MarkVolkmann | Looking at the source code in LockingTransaction.java, that doesn't seem to be the case. |
| 15:01 | MarkVolkmann | I see this: |
| 15:01 | MarkVolkmann | f.fn.applyTo(RT.cons(vals.get(ref), f.args)) |
| 15:02 | MarkVolkmann | vals is a HashMap of in-transaction values, not most recently committed values. |
| 15:02 | MarkVolkmann | Is it possible the doc string for the commute function is wrong? |
| 15:05 | LauJensen | Big question :) |
| 15:06 | MarkVolkmann | I'll ask it again on the mailing list. |
| 15:14 | LauJensen | Good idea |
| 15:15 | LauJensen | I have a question also. I'm implemented a small webchat which updates by polling a servlet for recent posts in the chatroom. How would I go about removing the polling and instead pushing to the clients ? (ala, CLs Symbolic Web) |
| 15:16 | walters | LauJensen: the typical trick is to do a HTTP request which only returns when there are changes |
| 15:16 | LauJensen | How long will one such linger? |
| 15:16 | walters | as long as possible, if it breaks just do another |
| 15:18 | LauJensen | Ok - Do you have example of this floating around somewhere, it sounds interesting |
| 15:19 | walters | LauJensen: http://xmpp.org/extensions/xep-0124.html |
| 15:20 | LauJensen | I'll have a read, thanks |
| 16:00 | cgrand | MarkVolkmann: look at the if(!sets.contains(ref)) a few lines above, it retrieves the latest value |
| 16:03 | mebaran151 | where should I put test packages? |
| 16:50 | slaney | I am messing around in the REPL, and finding that using integers as keys for maps, so I can randomly generate the keys, doesn't work as I expected. |
| 16:50 | slaney | http://gist.github.com/160207 |
| 16:53 | hiredman | Doubles are Doubles |
| 16:53 | hiredman | Integers are Intergers |
| 16:53 | LauJensen | slaney: Baz is a Long |
| 16:53 | slaney | I figured it was something to do with Typing |
| 16:53 | hiredman | Longs are Long |
| 16:53 | slaney | heh |
| 16:54 | hiredman | etc |
| 16:54 | slaney | when I called (integer?) on them, they both return true |
| 16:54 | slaney | but, you are saying that doesn't matter? |
| 16:54 | LauJensen | Call class |
| 16:54 | slaney | k |
| 16:54 | hiredman | ,(doc integer?) |
| 16:54 | clojurebot | "([n]); Returns true if n is an integer" |
| 16:54 | hiredman | ,(integer? (double 1)) |
| 16:54 | clojurebot | false |
| 16:55 | hiredman | hrrm |
| 16:55 | slaney | ok, so 1 is an Integer, and bar is a Long |
| 16:55 | hiredman | Math/round returns a long |
| 16:55 | slaney | can I cast it? |
| 16:55 | hiredman | sure |
| 16:56 | slaney | k |
| 16:56 | slaney | I will look that up |
| 16:56 | hiredman | int, long, double, etc |
| 16:56 | slaney | thanks |
| 16:56 | slaney | got it |
| 16:56 | slaney | thanks |
| 16:56 | slaney | user=> (foo (int bar)) |
| 16:56 | slaney | "foot" |
| 16:57 | hiredman | ,(class (first (keys foo))) |
| 16:57 | clojurebot | java.lang.Exception: Unable to resolve symbol: foo in this context |
| 16:57 | slaney | yeah, it returns in Integer |
| 16:58 | slaney | *an |
| 16:58 | hiredman | hmmm |
| 16:58 | hiredman | ,({1 :foo 2 :bar} (int 1)) |
| 16:58 | clojurebot | :foo |
| 16:58 | hiredman | ,({1 :foo 2 :bar} (long 1)) |
| 16:58 | clojurebot | nil |
| 16:58 | hiredman | ,({1 :foo 2 :bar} (Integer. 1)) |
| 16:58 | clojurebot | :foo |
| 16:59 | hiredman | *shrug* |
| 16:59 | slaney | heh, those are more succinct examples, but yeah |
| 16:59 | hiredman | I would start a new repl to make sure everything is as you think it is |
| 16:59 | slaney | true |
| 16:59 | LauJensen | ~seen blackdog |
| 16:59 | clojurebot | no, I have not seen blackdog |
| 16:59 | LauJensen | Anybody know what happend to him ? |
| 17:05 | arbscht | blackdog's last appearence in my log is in March |
| 17:14 | LauJensen | Thats a shame, he had an interesting take on webdevelopment |
| 17:15 | LauJensen | But - Denmark is approaching midnight, good night to all in Clojure land :) |
| 19:47 | JAS415 | classpath so frustrating |
| 19:47 | JAS415 | argh! :-P |
| 19:52 | JAS415 | ah there we go... |
| 21:53 | mebaran151 | does apply work with lazy-seqs? |
| 21:53 | mebaran151 | (apply #(lazy-cat %) (drop 1 (iterate fetcher from))) << needs to be lazy |
| 22:09 | Chouser | mebaran151: I don't think that'll come back, but it's more because of lazy-cat than apply |
| 22:09 | Chouser | what are you actually trying to do? |
| 22:09 | mebaran151 | I'm reworking by wrapping fetcher to return a lazy-seq |
| 22:10 | Chouser | ok |
| 22:10 | mebaran151 | I'm trying to fetch records from a bdb n at a time |
| 22:10 | mebaran151 | so I have a function fetcher that knows how to get 10 more records |
| 22:12 | mebaran151 | and I'd like to automatically get more records when the user iterates past the ones we've already gotten |
| 22:19 | mebaran151 | to get more I can pass the collection, fetch the last one and restart the cursor from there |
| 22:27 | mebaran151 | if I concatted a collection created from iterate, it would maintain its laziness correct? |
| 22:49 | Chouser | sure |
| 23:48 | Chouser | huh. gen-class isn't a good substitute for gen-sym |
| 23:48 | Chouser | of gensym for that matter |