2009-06-28
| 00:27 | replaca | good evening, anyone who's here |
| 00:28 | duck1123 | evening replaca |
| 00:28 | replaca | quiet night, eh? |
| 00:28 | duck1123 | seems so |
| 00:48 | agc | heh i just was reading the mailing list, did anyone else see that guy who was worried that the site was down? |
| 00:49 | agc | to bad Rich squashed it, that was pretty entertaining :P |
| 00:51 | duck1123 | Like I just dented, I like rich because he's not afraid to lay the smack down when he feels it's deserved |
| 00:53 | duck1123 | of course I had a response I was working on about how just about any website is theoretically vulnerable to tampering by someone higher up the chain |
| 00:55 | duck1123 | unless you're a direct node that you're personally guarding and using dns-sec someone could do something |
| 00:55 | agc | yeah the kid clearly doesn't understand the notion of hosting |
| 00:56 | agc | pretty funny to watch though |
| 00:58 | duck1123 | yes it sucks that wikispaces went down for maintenance, no that doesn't mean they're going to decide to replace the api page with "forget Clojure, use Perl" |
| 00:59 | agc | but but... what if they're out to get us? |
| 01:00 | duck1123 | although I think it would be cool if clojure.org was re-written to use compojure or some such |
| 01:00 | duck1123 | as an example of eating your own dog food |
| 01:00 | agc | its the first rule of web survival, never trust your host |
| 01:00 | agc | yeah that'd be cool |
| 01:02 | duck1123 | truthfully, it probably wouldn't be all that hard considering at the moment it's all static content |
| 01:02 | agc | thats probably why it hasn't been done yet, there just not much point |
| 01:08 | replaca | I just read that one. I was very amused - pretty good trolling |
| 01:09 | replaca | I think that the web hosting of the API doc is pretty much Clojure's most important problem |
| 01:10 | replaca | I have been working this week on moving the contrib-autodoc over to github pages and I am "eating" our own dog food by using enlive to do "templating" |
| 02:59 | danlucraft | ,(doc dotimes) |
| 02:59 | danlucraft | (doc dotimes) |
| 03:00 | danlucraft | why does clojurebot not do my bidding? |
| 03:00 | danlucraft | ,(dotimes [_ 3] (print "ho! ")) |
| 03:01 | kotarak | no clojurebot here, at the moment |
| 03:01 | danlucraft | nope |
| 03:01 | danlucraft | sleeping, probably |
| 03:24 | danlucraft | in the docs for dotimes, 'bindings' refers to a vector of name value pairs. |
| 03:24 | danlucraft | is this always what bindings means? |
| 03:35 | cmvkk | almost definitely. |
| 06:30 | agc | anyone around who I can ask about translating docs to another language? |
| 06:31 | Lau_of_DK | If its for your own pleasure, I think Google has a good enough translation service |
| 06:32 | agc | no english is fine with me, but I was just wondering if there was any attempts to translate the docs to other languages because I might be interested in doing some of that |
| 06:34 | agc | hmm this is weird Clozure CL, http://trac.clozure.com/openmcl |
| 06:36 | danlei | what's weird about it? |
| 06:52 | agc | clozure, clojure ...not very original of them |
| 06:54 | danlei | Clozure Associates is around since 2000 ... |
| 07:37 | agc | I dont think they were always called clozure though, the mailing list is called openmcl-devel and yes it does go back to 2001 |
| 07:38 | agc | anyway I dont know anything about it, just thought it might be a new lisp project calling themselves clozure but I guess not |
| 07:48 | danlei | they renamed openmcl, because mcl itself was opensourced. besides matching "Clozure Associates", in choosing "Clozure CL" they achieved some continuity with the pre-mcl era, when it was called "Coral Common Lisp". (both are "CCL") anyway, no point in accusing them of plagiarism. |
| 07:53 | Lau_of_DK | Does anyone have a clue what this is ? |
| 07:53 | Lau_of_DK | Can't embed object in code, maybe print-dup not defined: com.jcraft.jsch.Session@908f05 |
| 07:56 | danlei | (clozure.com/about.html: "Clozure Associates was founded in 2000 by ...") |
| 07:57 | Lau_of_DK | Common Lispers... |
| 07:58 | danlei | hm? |
| 08:02 | Lau_of_DK | Clozure... CL experts |
| 08:04 | krumholt_ | clozure is the new name for openMCL. clozure was macComonLisp. when they went open-source there allready was an openMCL so they renamed it clozure |
| 08:05 | danlei | exactly. my point was, that the "Clozure Associates", after which openmcl was renamed have been around since almost 10 years. (in re to: "clozure, clojure ...not very original of them") |
| 08:06 | danlei | anyway, it's just an obvious naming choice for some lisp :) |
| 08:10 | danlei | hm ... |
| 08:11 | danlei | somewhere I read about inclusion of something akin to #+/#- reader macros |
| 08:14 | danlei | can't find anything in clojure.org/reader though. is there a way to comment out a sexpr, like #+nil(...)? |
| 08:18 | Chousuke | danlei: change the operator to comment? |
| 08:20 | Chouser | danlei: #_ |
| 08:22 | danlei | Chouser: yes, thank you! (should maybe be added to clojure.org/reader) |
| 08:26 | Chousuke | The api docs ought to be somehow autogenerated from git :/ |
| 08:26 | Chousuke | that would require a few additional files for the non-docstring documentation pages though. |
| 08:33 | danlei | if I have two namespaces t1 and t2, and have referred t1 from t2, is there a way to "un-refer"? |
| 08:35 | hoeck | danlei: there is ns-unmap |
| 08:35 | danlei | hm, ok |
| 08:35 | danlei | a sec |
| 08:37 | lisppaste8 | danlei pasted "unrefer" at http://paste.lisp.org/display/82641 |
| 08:38 | danlei | I find it sometimes handy for repl use |
| 08:39 | danlei | something like this in c.c. already? |
| 08:50 | hoeck | danlei: there is ns-utils in contrib, but without unrefer |
| 08:52 | danlei | hoeck: do you know how to apply for inclusion in c.c.? |
| 08:53 | Chousuke | first you need a CA |
| 08:54 | danlei | hm, for such a little thing. couldn't someone else commit it (if there's interest)? |
| 08:55 | Chousuke | you still need a CA so that rhickey has joint copyright. |
| 08:55 | danlei | hm I see |
| 08:55 | Chousuke | since stuff from contrib occasionally gets promoted to core. |
| 08:56 | danlei | ok, thanks |
| 08:56 | Chousuke | the CA system does get in the way of small contributions sometimes, but it's a one time thing :) |
| 08:56 | danlei | if there will be some more things I find worthy, I'll do the CA agreement |
| 08:57 | Chousuke | sometimes copyright just gets in the way of code sharing :P |
| 08:58 | danlei | don't know how to say it in english "mit sowas kann man mich jagen" "you can hunt me with things like this" :) |
| 08:59 | Chousuke | I wonder if there's any precedent regarding copyrightability of trivial code snippets |
| 10:16 | AWizzArd | BS argumentation, again (sigh), that Clojure is not a real Lisp: http://www.loper-os.org/?p=42 |
| 10:16 | Chousuke | oh, that. yeah. |
| 10:17 | AWizzArd | The dead body is still twitching ;-) |
| 10:19 | Chousuke | He can talk about dreams all he wants. Someone else goes ahead and implements something that brings the world closer to that dream. |
| 10:20 | Chousuke | Clojure may not be the "optimal lisp" but it really is the most fun language I have used so far, even with all its "faults" :P |
| 10:21 | duck1123 | I can't help but wonder if he would be happier if Clojure could compile itself. |
| 10:22 | Chousuke | Well, that's on the todo list :P |
| 10:22 | duck1123 | I know |
| 10:24 | duck1123 | best review of that post: "emacsen: This statement summarizes the insane Lisper mindset, I don’t care if everybody really is more productive in Clojure than in Common Lisp." - http://identi.ca/notice/5785065 |
| 10:26 | AWizzArd | duck1123: one point of criticism in that virtual argument is, that the current Clojure implementation depends on weaknesses of its underlying VM. |
| 10:26 | AWizzArd | For example: no tagged numbers, no TC optimization, etc. |
| 10:27 | AWizzArd | Of course those are no real arguments in Clojure not being a Lisp. |
| 10:30 | duck1123 | a true moddern lisp machine would be a cool thing to have |
| 10:32 | AWizzArd | Why? |
| 10:32 | cp2 | why not |
| 10:32 | AWizzArd | Just for hobby interests? |
| 10:32 | AWizzArd | cp2: The burden of argumentation is on the one who makes claims. |
| 10:33 | cp2 | AWizzArd: ah, but i didnt make that claim =P |
| 10:33 | AWizzArd | true |
| 10:33 | cp2 | heh |
| 10:33 | cp2 | regardless though |
| 10:33 | duck1123 | it would be cool to be able to control every aspect of the os from a repl |
| 10:33 | cp2 | yeah, definitely hobby related stuff |
| 10:33 | danlei | if it would be "true modern", I agree (judging from what I've seen running Medley in a VM). something like a lisp-squeak (but more geared towards programmers, than children) would be very nice, too. |
| 10:34 | cp2 | i would just want one to have as another geek toy |
| 10:34 | AWizzArd | One problem with "why questions" is that they can easily be mistaken for being criticism. I am just interested to hear some arguments and don't want to criticize that idea in any way. |
| 10:34 | duck1123 | I wish there was a clojure equivalent of stumpwm |
| 10:34 | cp2 | duck1123: make one |
| 10:35 | duck1123 | I couldn't find any decent java-based windows managers to base off of |
| 10:35 | Raynes | "You’re looking at it wrong. It’s not meant to be a serious Lisp. It’s only cosmetically descended from McCarthy’s original idea. It’s an attempt to terraform the wasteland of the JVM. It fails, of course, but it does make it at least somewhat less likely that geysers of molten arsenic will pour through your floor at 1AM." |
| 10:35 | danlei | turtles, all the way down? ability to modify everything in one language, and, that language being lisp, one, that is in itself somehow the creme de la creme. integration. |
| 10:35 | cp2 | so base it off of stumpwm |
| 10:35 | cp2 | well, er, not _exactly_ |
| 10:36 | cp2 | you could mimic the way it does things |
| 10:36 | duck1123 | I've thought about it. I've got too much else on my plate atm however |
| 10:37 | cp2 | yeah, pretty much the same story for me |
| 10:37 | cp2 | ive found loads of cool stuff i wanna do |
| 10:37 | Raynes | duck1123: It amazes me how much you look like Richard Karn in your Twitter picture. |
| 10:37 | cp2 | but |
| 10:37 | cp2 | i have a queue of other things to plow through |
| 10:39 | duck1123 | lol, I had a little girl at the beach think I was Billy Mays |
| 10:39 | Raynes | I've sadly not really done anything with Clojure for a long while. I've been on a Haskell learning expedition, and probably will be for a few more weeks before coming back and continuing my Clojure adventures. |
| 10:43 | duck1123 | so is anyone here a serious user of clj-record? I want to get some feedback on some of the changes I pushed to my fork. |
| 11:32 | Chouser | durka42: I've got a friend interested writing a window manager in Clojure |
| 11:33 | Chouser | I don't know how much code he's got, but I think he's got some JNA doing X11 stuff |
| 11:39 | Jomyoot | does clojure support imperative programming too? |
| 11:39 | Jomyoot | or is it strictly functional |
| 11:39 | Jomyoot | CL allows sequential/imperative |
| 11:40 | danlei | it's not strict, albeit more inclined to FP than CL |
| 11:40 | Chouser | Jomyoot: it doesn't prevent you from writing and using functions with side-effects, but it's likely to feel like you're working against the grain. |
| 11:40 | Chouser | locals are immutable -- that gets in the way of a lot of imperative idioms |
| 11:40 | Jomyoot | well |
| 11:41 | Jomyoot | what about globals? |
| 11:41 | Jomyoot | would scala allow more imperatives then? |
| 11:42 | Chouser | globals can be changed, though it's not common to do so as part of an algorithm. |
| 11:42 | Chouser | scala supports mutable locals (when you use "var" rather than "val") |
| 11:43 | Chouser | ...though when I asked for help in #scala with code that used "var" I was frequently mocked. :-/ |
| 11:43 | durka42 | Chouser: sounds interesting |
| 11:43 | Jomyoot | do you think 1 year from now. clojure or scala will have more programmers? |
| 11:44 | AWizzArd | Does not matter I think. |
| 11:44 | Jomyoot | i am hoping for a webframework |
| 11:44 | Jomyoot | like rails or django for clojure |
| 11:44 | Jomyoot | scala has lift already |
| 11:44 | AWizzArd | Clojure has Compojure. But why hoping and not joining that project? |
| 11:45 | Jomyoot | dunno |
| 11:45 | Jomyoot | not enough time to contribue to a framework really |
| 11:45 | Jomyoot | i am more of a user |
| 11:45 | AWizzArd | But what do you do in the time while the framework is not available? :) |
| 11:46 | Jomyoot | use different langauge? like ruby? |
| 11:46 | Jomyoot | i was coding CL a while back |
| 11:46 | Jomyoot | scheme too |
| 11:47 | Jomyoot | then switched to ruby for a web project |
| 11:47 | Jomyoot | i tried haskell |
| 11:48 | Jomyoot | but killed myself with monads |
| 11:48 | Jomyoot | i hope clojure does not have monads |
| 11:48 | danlei | it does, but not in core |
| 11:48 | danlei | you're not forced to use them in any way |
| 11:50 | danlei | concerning your question about globals: just yesterday I wrote a little parser for ansi-sequences, which used a kind of mutable global (an atom), then chosuke provided a stateless alternative. |
| 11:50 | danlei | so, in general, you're not forced. |
| 11:51 | Chousuke | I thought about writing a version of the parser using the state monad from contrib |
| 11:51 | danlei | would be a nice read |
| 11:51 | danlei | I've just finished the tutorial, but I'll have to read some more, and re-read it again |
| 11:51 | danlei | think I've a grasp at the basics now |
| 12:02 | danlei | hm ... (read) freezes my slime repl |
| 12:03 | rhickey | type a form |
| 12:03 | danlei | =) |
| 12:03 | danlei | I did :) |
| 12:03 | rhickey | hrm |
| 12:03 | danlei | updated slime yesterday, swank-clojure is up-to-date |
| 12:03 | danlei | connected via swank-server |
| 12:04 | Chousuke | danlei: too bad I have no idea how to actually use the monad library :P |
| 12:04 | danlei | Chousuke: :) |
| 12:05 | danlei | Chousuke: just wanted to ask you for a simple example: (inc (read)), how to isolate the read ;) |
| 12:05 | StartsWithK | rhickey: will there be a backport to 1.0.x series of clojure.test (with downloadable clojure-1.0.x.zip on the site)? |
| 12:06 | rhickey | StartsWithK: dunno, someone has to volunteer to do it |
| 12:06 | rhickey | strictly speaking that's not a .x change, as it is more than a bugfix |
| 12:07 | StartsWithK | i would like to ditch the clj-unit fork included in cloak (that clojure build system) for this new one |
| 12:07 | StartsWithK | just to get with the program :) |
| 12:15 | StartsWithK | any one experimented with using java agent to manipulate bytecode at runtime in context of changing existing clojure code? |
| 12:15 | StartsWithK | or to inject IMeta to java.lang.String and such.. |
| 12:16 | Chousuke | hopeless |
| 12:16 | Chousuke | I know what I want to use for my state but I have no clue how to actually use the state monad to do the state-keeping :( |
| 12:17 | StartsWithK | i got the impression final classes are not a problem for instrumentation mechanism |
| 12:18 | StartsWithK | and by manipulationg clojure.core/+ threre would be no need for contrib.generic, and as i read it, no speed penalty eather |
| 12:24 | Chousuke | danlei: if you figure out how to use the state monad with the parser thingy, tell me. |
| 12:24 | Chousuke | I can't. |
| 12:24 | danlei | Chousuke: I will (if I ever do) :) |
| 12:26 | Chousuke | it'd probably be easier to see how the types interact if clojure had static typing. |
| 12:26 | Chousuke | but as it is now, I just can't tell whether I'm supposed to have a monadic function, a monadic value, or the regular ones |
| 12:27 | Chousuke | or if I try reading the code that uses monads in contrib... it looks neat and cool, but I have no clue how it works |
| 12:27 | danlei | atm, I'm just reading the examples.clj of c.c.monads, and trying to find some more tutorials |
| 12:28 | Chousuke | I have read at least five different monad tutorials :P |
| 12:28 | Chousuke | it doesn't help |
| 12:28 | Chousuke | it looks simple in the examples, but there's nothing to bridge that so that I could produce monadic code myseld. |
| 12:28 | Chousuke | myself* |
| 12:30 | danlei | I don't even know how to isolate input. In haskell those things are IO <something>, if I remember correctly, but I wouldn't know how to do such a ting in clojure. |
| 12:30 | danlei | *thing |
| 12:30 | Chousuke | it's nothing explicit. |
| 12:31 | Chousuke | in your earlier example, (inc (read)) is probably not what you want. I suspect you're going to do more with the return value of (read) than just increment it? |
| 12:31 | danlei | say, I have (inc (read)) inc is pure, read is inherently not. if one of the goals of monads are to separate pure and impure code, how would I do that? |
| 12:31 | danlei | it's just an example |
| 12:32 | danlei | read something, which is impure, and increment it, which is a pure function |
| 12:32 | Chousuke | so, make a function that does all that with a non-read value, then call (do-complicated-stuff (read)) |
| 12:32 | danlei | well, that's how I would do it without monads ... |
| 12:32 | Chousuke | in essence, the points where you use impure functions should be well-defined and visible and few in number :) |
| 12:33 | Chousuke | there's no need to use monads. |
| 12:33 | danlei | no, need, yes, but I thought those monads were supposed to help me in the process, aren't they? |
| 12:33 | Chousuke | well, yeah, if you know how to use them |
| 12:33 | danlei | that's the point, I guess :) |
| 12:33 | Chousuke | I prefer just using discipline, because I have no clue about monads :P |
| 12:34 | danlei | atm my sime REPL is more effective than any monad: prevents every use of (read) :) |
| 12:34 | Chousuke | heh |
| 12:55 | opqdonut | danlei: mapping pure functions over an impure "action" is one of the basic monad operations |
| 12:56 | opqdonut | let me check the syntax c.c.monad uses |
| 12:56 | opqdonut | (i come from haskell and haven't tried monads in clojure yet= |
| 12:56 | opqdonut | *) |
| 12:56 | danlei | opqdonut: thanks |
| 12:57 | Chousuke | c.c.monads has domonad but I can't figure out how it works |
| 12:57 | Chousuke | or how to define a function that works the way I want ;/ |
| 12:58 | danlei | (domonad maybe-m [x 1 y nil] (+ x y)) -> nil |
| 12:58 | danlei | that's how far I've come ;) |
| 12:59 | opqdonut | danlei: mlift |
| 12:59 | opqdonut | is the thing you are looking for |
| 12:59 | opqdonut | er, m-lift |
| 12:59 | danlei | opqdonut: could you give a little example as to how to use it to separate, say, IO functions from pure ones? |
| 13:01 | Chousuke | I doubt m-lift is useful with the state monad |
| 13:01 | opqdonut | it's useful with every monad |
| 13:01 | opqdonut | it's the shortest way of applying a pure computation to a monadic value |
| 13:02 | Chousuke | how would I define a function that takes in a piece of input and uses the state monad to produce a new value and a state? |
| 13:02 | Lau_of_DK | Seen clojurebot? |
| 13:02 | danlei | yes, I too would like to see an example of such a simple ting |
| 13:02 | danlei | *thing |
| 13:02 | danlei | Lau_of_DK: he's monadic these days? |
| 13:03 | Lau_of_DK | monadic? |
| 13:03 | opqdonut | i'm sorry, I can't really supply examples in clojure syntax |
| 13:03 | danlei | Lau_of_DK: monads are used to implement clojurebot? |
| 13:03 | Lau_of_DK | I didnt know - but what does it matter? Are monads prone to FAIL ? |
| 13:03 | Chousuke | opqdonut: haskell works too |
| 13:04 | danlei | Lau_of_DK: :) misread you ;) |
| 13:04 | Lau_of_DK | Ok |
| 13:04 | Chousuke | the domonad syntax in clojure is similar to haskell's do block |
| 13:04 | Chousuke | but I can't figure out which function takes what parameter and how to get to them |
| 13:04 | opqdonut | Chousuke: so you want val->(state,val) wihtout taking in any state |
| 13:04 | opqdonut | that's not really monadic at all |
| 13:05 | Chousuke | no, I want a monadic function that "implicitly" takes the state argument |
| 13:05 | opqdonut | yes, yes |
| 13:05 | opqdonut | so you'd say (for example) "add_state_to x = do s <- get; return (x + s)" |
| 13:06 | opqdonut | that's a function that takes one parameter, and adds the state to it |
| 13:06 | opqdonut | (get returns the current state) |
| 13:06 | opqdonut | i'm guessing you'd use defmonadfn in clojure |
| 13:07 | Chousuke | x is a monadic value? |
| 13:07 | Chousuke | what if I had some input that I want to add to the state, depending on what the state is. |
| 13:10 | danlei | Chousuke: do I understand right, that what you describe would be the function itself as a monadic thing, which has the state passed implicitly to it? (my head spins a little) |
| 13:11 | Chousuke | danlei: a monadic value in the state monad is a function that takes the state as its parameter. that much I know |
| 13:11 | danlei | and its value is the computation? |
| 13:11 | Chousuke | but I just can't wrap my head around how to actually use that to work with the state and the actual final return value |
| 13:15 | danlei | "a state monad value is a function that takes a single argument, the current state of the computation, and returns a vector of length two containing the result of the computation and the updated state after the computation" I guess, so far I understood too. |
| 13:22 | Chouser | is it just me, or is the g.group a bit more ...tense... laterly. |
| 13:23 | Chouser | lately? |
| 13:23 | Chousuke | hmm |
| 13:23 | opqdonut | Chousuke: x is non-monadic ther |
| 13:23 | opqdonut | e |
| 13:23 | Chousuke | I'm having easier time writing out the monad functions explicitly rather than by using domonad :P |
| 13:23 | opqdonut | because bind takes care of unwrapping it when we want to use f |
| 13:24 | opqdonut | Chousuke: that's a good thing :) |
| 13:44 | Chousuke | hmm |
| 13:44 | Chousuke | now I have something monadic here |
| 13:45 | Chousuke | now I need to figure out how to apply that to a sequence |
| 13:48 | prospero_ | so hypothetically, let's say I want to write a macro that reverses the names of keywords |
| 13:48 | prospero_ | like so: (defmacro reverse-keyword [k] (keyword (apply str (reverse (name k))))) |
| 13:49 | prospero_ | (reverse-keyword :hello) yields :olleh |
| 13:49 | prospero_ | but (map #(reverse-keyword %) [:a :b]) yields (:34__1p :34__1p) |
| 13:50 | prospero_ | what's going on underneath the covers here? |
| 13:51 | Chouser | prospero_: try: (macroexpand '#(reverse-keyword %)) |
| 13:52 | prospero_ | ha, fair enough |
| 13:52 | Chouser | it's a macro, so it does what it does at compile time, before the values for % are known |
| 13:53 | prospero_ | ok, that makes sense |
| 13:56 | prospero_ | so if I want to do a transform over a list of args inside a macro |
| 13:57 | prospero_ | is it just that I shouldn't use anonymous functions? |
| 13:57 | prospero_ | or is there some deeper limitation at play here? |
| 14:02 | achim | prospero: macros are a special kind of functions that transform syntax prior to compilation. contrary to ordinary functions, they take their arguments unevaluated. so your macro tries to reverse %, basically |
| 14:03 | prospero_ | achim: I get that part, I was just having trouble finding an example that walks a list of args, rather than making a single transformation |
| 14:03 | prospero_ | I'm looking at the code for "cond" now, which seems to be what I'm looking for |
| 14:04 | prospero_ | sorry if I was unclear what I was looking for |
| 14:05 | Chousuke | prospero_: you can use a function to do the reversing |
| 14:06 | Chousuke | just defn reverse-keyword instead of defmacroing it |
| 14:06 | prospero_ | Chousuke: yeah, that was just meant to be a toy example |
| 14:06 | Chousuke | you can still use it inside a macro |
| 14:07 | prospero_ | what I'm trying to actually do isn't defn-able, but I didn't want to actually go into the specifics |
| 14:07 | prospero_ | probably could have come up with a less trivial example, though |
| 14:07 | opqdonut | prospero_: so was cond what you were looking for? |
| 14:08 | prospero_ | opqdonut: it appears to be |
| 14:08 | prospero_ | it applies itself recursively over a list of clauses |
| 14:10 | prospero_ | so it will expand the entire list, which of course the anonymous function wouldn't |
| 14:10 | prospero_ | if it doesn't work, I'll be back with more questions |
| 14:12 | Chousuke | prospero_: can't you do that with a function called from a macro. |
| 14:13 | prospero_ | Chousuke: here's the macro I'm trying to apply to the args. am I missing something and it can actually be a function? |
| 14:13 | prospero_ | (defmacro to-gl-const [k] (let [gl# ("GL_" (.. (name k) (replace \- \_) (toUpperCase)))] `(. GL ~(symbol gl#)))) |
| 14:13 | Chousuke | hm |
| 14:13 | Chousuke | sure it can |
| 14:14 | prospero_ | calls to "symbol" inside a function were giving me strange errors |
| 14:14 | prospero_ | so I assumed that was only something I should do inside a macro |
| 14:16 | Chousuke | what's the "GL_" supposed to be though? |
| 14:16 | Chousuke | that gives an error |
| 14:16 | Chousuke | just wrap it in an str? :) |
| 14:18 | prospero_ | so this function is meant to translate :this-is-a-keyword to GL_THIS_IS_A_KEYWORD, which is a static constant in javax.media.opengl.GL |
| 14:19 | prospero_ | oh, sorry |
| 14:19 | prospero_ | I gave you a bad copy-paste of that |
| 14:20 | prospero_ | took me a moment to see that |
| 14:20 | prospero_ | yeah, it's supposed to be (str "GL_" ... |
| 14:20 | Chousuke | http://gist.github.com/137331 |
| 14:21 | prospero_ | I didn't know you could use the template syntax outside of macros |
| 14:21 | prospero_ | interesting |
| 14:21 | Chousuke | it's just a different kind of quote |
| 14:21 | Chousuke | you can use it anywhere. |
| 14:22 | prospero_ | hm |
| 14:22 | Chousuke | conversely, you don't have to use ` in macros either. |
| 14:22 | Chousuke | it's just a convenient way to construct a list |
| 14:22 | Chousuke | which is what a macro usually returns |
| 14:23 | _hrrld | Is there anything like 'drop-nth'? like (drop-nth 1 [0 1 2]) ;;>> [0 2] |
| 14:23 | prospero_ | Chousuke: thanks, that's really helpful |
| 14:26 | Chouser | _hrrld: lazy, linear time thing? |
| 14:26 | _hrrld | I'm working with all concrete sequences that are pretty short. I imagine doing drop-nth in a general way efficently could be very difficult. |
| 14:26 | opqdonut | not really |
| 14:26 | _hrrld | My datasets are small enough that perf isn't a big deal. |
| 14:26 | opqdonut | for lazy sequences it's quite easy |
| 14:28 | hoeck | _hrrld: there is partition: (map first (partition 2 '(1 2 3 4))) |
| 14:29 | _hrrld | hoeck: that returns (1 3) ; the 4 got lost. :) |
| 14:31 | Chouser | (defn drop-nth [i coll] (concat (take i coll) (drop (inc i) coll))) |
| 14:31 | hoeck | oh, I supposed you wanted to drop every nth of a seq |
| 14:32 | _hrrld | Chouser: nice. Much appreciated. |
| 14:33 | hoeck | for vectors, you could use subvec and conj them together |
| 14:40 | Chouser | hoeck: yes, though I don't think that'd be much of a win. In order to construct the final vector, I think both subvec's would have to be walked linearly anyway. |
| 14:42 | hoeck | wouldn't only the second subvector conj'ed on the first one? |
| 14:43 | hoeck | but this is no win either, when dropping the first of a lot of values |
| 14:44 | hoeck | I once had a usecase for dropping values from vectors, but then realized that I'm better off with using hashmaps instead |
| 14:49 | Chouser | hoeck: ah, you're right. The first part of the vector would be re-used without a linear copy. |
| 14:49 | Chouser | subvec's smarter there than I thought. |
| 15:02 | duck1123_ | I'm curious. If I had a lazy-seq that used a fn to generate the rest part, and I started going through that seq and in a different thread re-defed the fn, would the seq start producing the results of the new fn, or does it hold on to the definition of the fn it had originally |
| 15:03 | Chousuke | hmm |
| 15:04 | duck1123_ | I suppose I could test it, it was just a thought that struck me as i was reading the list? => false thread |
| 15:05 | Chousuke | ,(let [a (iterate inc 0) b (dorun (take 10 a))] [a (binding [inc dec] (dorun (drop 10 (take 20 a))))]) |
| 15:05 | Chousuke | oh damn |
| 15:06 | Chousuke | hm, not a, b :P |
| 15:07 | Chousuke | also, doall :P |
| 15:07 | Chousuke | but doesn't look like it has an effect. |
| 15:09 | Chousuke | however, (let [a (iterate #'inc 0) b (doall (take 10 a))] [b (binding [inc dec] (doall (drop 10 (take 20 a))))]) does yield [(0 1 2 3 4 5 6 7 8 9) (8 7 6 5 4 3 2 1 0 -1)] :) |
| 15:16 | achim | lazy-seq creates a closure from its body, so thread-local bindings should do no harm |
| 15:17 | achim | (binding [inc dec] (apply inc [1])) -> 0 |
| 15:17 | achim | vs (binding [inc dec] (apply #(inc %) [1])) -> 2 |
| 15:18 | achim | ("apply" to avoid inlining) |
| 15:22 | Chousuke | right. |
| 15:22 | Chousuke | and adding the var indirection with #' makes the binding work again. |
| 15:23 | Chousuke | hmm |
| 15:23 | Chousuke | Atom doesn't implement IFn like the other ref types :/ |
| 15:23 | Chousuke | apparently agent doesn't either. |
| 16:49 | Lau_of_DK | So - Have everybody checked out the two demos for ClojureQL yet? |
| 16:52 | duck1123 | where? |
| 16:52 | Lau_of_DK | http://github.com/Lau-of-DK/clojureql/tree/master |
| 16:53 | Lau_of_DK | We're coming close to release 1.0, so feel free to throw feature-requests/bug-reports at us! |
| 16:57 | duck1123 | Lau_of_DK: does clojureql handle limiting? |
| 16:58 | Lau_of_DK | I have a patch in my inbox from eyeris for offset/limit support, I'm looking at that now |
| 16:58 | duck1123 | I recently got done hacking up a :limit param for clj-record, and got annoyed that derby doesn't support limit |
| 16:59 | kotarak | Wouldn't take work in the resultset-seq? |
| 16:59 | duck1123 | yes, but that is potentially wasteful |
| 17:00 | Chousuke | Lau_of_DK: order-by and having etc. being functions of queries is really neat. |
| 17:00 | duck1123 | it's better to let the db limit it to only what you need than to send it all and then filter it |
| 17:01 | lisppaste8 | drewr pasted "delim-seq" at http://paste.lisp.org/display/82652 |
| 17:03 | Lau_of_DK | Chousuke: I'm glad you like it |
| 17:07 | Lau_of_DK | I've tested superficially, but it seems that drop/take it a feasible replacement for offset/limit |
| 17:09 | agc | can anyone give me a brief description of the eclipse public license, how is it different than gpl? |
| 17:10 | agc | I'm familiar with gpl/lgpl/bsd is it like any of those? |
| 17:12 | duck1123 | http://en.wikipedia.org/wiki/Eclipse_Public_License#Other_aspects is a good description of the difference |
| 17:12 | agc | thanks duck1123 |
| 17:12 | Lau_of_DK | duck1123: Potentially wasteful ? |
| 17:13 | kotarak | Lau_of_DK: the drop issue |
| 17:13 | Lau_of_DK | kotarak: I wanted duck's thoughts, he sounded like he had some knowledge :) |
| 17:14 | duck1123 | If I want to start at record 1001, I still have to send those other 1000 records over the wire |
| 17:14 | Lau_of_DK | Ok, so same issue as we discussed |
| 17:14 | Lau_of_DK | I'm wondering about take, if it realizes the whole set |
| 17:14 | Lau_of_DK | I think we might actually get that one for free |
| 17:15 | duck1123 | I still think that chunked seqs will be awesome for db work |
| 17:15 | Lau_of_DK | Why? |
| 17:16 | duck1123 | I'm still a little fuzzy on the details of chunked seqs, but it sounds like we'll be able to pull a chunk of records down, and then pull more when we get to them |
| 17:16 | hoeck | duck1123: yeah, especially if one can implement a chunked-resultset-seq |
| 17:16 | duck1123 | if it's done the right way underneath that is |
| 17:17 | duck1123 | it was the first thing I thought of when I first heard rich talking about them |
| 17:18 | Lau_of_DK | I still dont get them :) |
| 17:18 | agc | hmm EPL seems a bit strange to me, allowing people to freely take the code and then create additions and release them under a different license even closed source |
| 17:18 | Chousuke | duck1123: you can do that with current seqs. it's just that they won't be able to benefit from the "chunky" internal representation |
| 17:20 | duck1123 | I've been thinking about putting a :page param into my clj-record work so I could specify a page size in the model intl and then say (find-records {:user 4} :page 3) |
| 17:20 | Chousuke | duck1123: the point of chunked seqs is to allow seq consuming/producing functions to work on chunks if the internal representation is chunked (like with vectors) and minimise the laziness overhead |
| 17:21 | agc | I guess I just don't get the whole licensing thing, I mean if you're bascially letting people do whatever they want then why license it anyway, why not just put it out there and say "do whatever". |
| 17:21 | duck1123 | agc: I think it's so I can't make the claim that Clojure is mine |
| 17:22 | Chouser | agc: one reason is because "whatever" could possibly include copyrighting your work and then suing you if you try to use it yourself. :-P |
| 17:22 | agc | ah yeah, that would be an unfortunate way to end up in prison |
| 17:22 | Chouser | yes, would be annoying |
| 17:23 | duck1123 | that's it. Rich is no longer allowed to use Clojure unless he pays me |
| 17:23 | agc | you're a bad duck |
| 17:24 | duck1123 | okay, I'll let him slide this time, but I could really use the money |
| 17:44 | eevar | anyone know if the master branches of clojure, contrib and swank are stable and working together right now? |
| 17:45 | eevar | s/stable/usable for non-critical work/ |
| 17:54 | Chouser | eevar: I don't use swank, but I think I'd have heard if it wasn't working right now. |
| 17:55 | dmiller2718 | ,[ (:tag ^#'next) (:tag ^#'print-method)] |
| 17:57 | weissj | is the clojurebot that runs in this channel available as code to run elsewhere? hiredman's http://github.com/hiredman/clojurebot/tree/master doesn't look intended to be run by others, the #clojure channel is hardcoded in it |
| 17:58 | dmiller2718 | evaluates to [clojure.lang.ISeq clojure.lang.MultiFn] |
| 17:59 | dmiller2718 | :tag metadata on #'next being ISeq is reasonable, :tag on #'print-method being MultiFn seems not correct. |
| 17:59 | dmiller2718 | As an IFn value, #'print-method's :tag should be its return type, which is not a MultiFn. |
| 18:00 | dmiller2718 | This is true of anything defined by defmulti. Is this correct? |
| 18:01 | Chousuke | weissj: hm, the channel shouldn't be hardcoded :/ |
| 18:02 | Chousuke | weissj: though I don't know hwat changes hiredman has done since my edits :P |
| 18:02 | Chousuke | weissj: anyway, no, that's the original source :) |
| 18:03 | weissj | Chousuke: can you tell me how to get it running? i got the pircbot and clojure-json libs on the classpath, and i disabled a bunch of modules that were preventing it from starting |
| 18:03 | weissj | but it still doesn't work |
| 18:03 | weissj | i get java.lang.IllegalArgumentException: No method in multimethod 'new-send-out' for dispatch value: class clojure.lang.PersistentArrayMap |
| 18:03 | Chousuke | weissj: did you look at clojurebot.clj? |
| 18:03 | weissj | yes |
| 18:04 | weissj | i set the bot-attibutes, i can actually see clojurebot join my channel |
| 18:04 | weissj | but every time i talk to him he throws the above exception |
| 18:04 | Chousuke | hm |
| 18:05 | Chousuke | that's something I have no idea about :P |
| 18:05 | Chousuke | ask hiredman |
| 18:06 | Chousuke | most likely he has defined the multimethod in a repl and forgotten it from the sources :) |
| 18:06 | weissj | hehe |
| 18:06 | weissj | ok so there probably aren't too many people running this bot then :) |
| 18:06 | Chousuke | probably. :P |
| 18:09 | weissj | hehe "suffusion of yellow" - nice Douglas Adams reference there |
| 18:10 | Chousuke | hm, there's a defmethod for PersistentHashMap |
| 18:10 | Chousuke | maybe it should be clojure.lang.IPersistentMap instead |
| 18:11 | Chousuke | try making that edit (in clojurebot/core.clj) and see if it works then |
| 18:11 | weissj | well i suppse i could change it |
| 18:11 | weissj | k |
| 18:14 | weissj | Chousuke: cool that seems to have worked, although, it won't eval things that start with , |
| 18:14 | weissj | what are some other functions i can try |
| 18:17 | Chousuke | weissj: you can tell it things |
| 18:17 | Chousuke | botnick: foo is bar |
| 18:18 | Chousuke | and then try ~foo |
| 18:20 | weissj | ah ok |
| 18:20 | weissj | i got the sandbox working, i didn't konw "sb" was the sandbox module and had removed it :) |
| 18:21 | weissj | ,(defn add5 [x] (+ x 5)) |
| 18:21 | weissj | oh it's not running in this chan today hehe |
| 18:23 | Chousuke | defn won't work anyway :) |
| 18:24 | weissj | Chousuke: any particular reason why that's disabled? |
| 18:25 | weissj | is each expression eval'd in a different space? |
| 18:25 | weissj | i would think that would be a useful feature to define functions and call them |
| 18:27 | Chousuke | weissj: to prevent a DoS |
| 18:28 | Chousuke | if you want to disable the protection (which is probably circumventable in any case), take a look at the defang function :P |
| 18:29 | weissj | Chousuke: i'll just make *bad-forms* an empty list and see what happens :) |
| 18:29 | Chousuke | heh |
| 18:30 | Chousuke | you'll probably want to make it an empty *set* though. |
| 18:30 | weissj | sorry, set |
| 18:30 | weissj | (def *bad-forms* #{}) |
| 18:31 | weissj | will get kinda ugly having to define functions on one line though |
| 19:46 | JAS415 | what does everyone use for GUI stuff in clojure? |
| 19:54 | eevar2 | swing. or html |
| 20:09 | sohail | there used to be jambi but that died |
| 20:09 | sohail | or became a community project :-) |
| 20:11 | Chouser | I'm still hoping those are the same thing. |
| 20:11 | Chouser | jambi is too good to die |
| 20:17 | JAS415 | Swing has all of this subclassing stuff it looks like, is there an easy way to do that in Clojure? |
| 20:17 | JAS415 | or will i have to write java? |
| 20:23 | Chouser | JAS415: proxy |
| 20:23 | Chouser | ,(doc proxy) |
| 20:28 | JAS415 | cool i will check that out, will have to read up on that then :-) |
| 20:49 | JAS415 | (psort coll comp) |
| 20:49 | JAS415 | (sort comp coll) |
| 20:49 | JAS415 | are these really reverses of each other? |
| 21:15 | duck1123 | so do you guys think it's time to move on past clojure 1.0 in my projects? |
| 21:15 | duck1123 | now that contrib no longer compiles on 1.0 |
| 21:26 | Chouser | nah. |
| 21:28 | duck1123 | git bisect did it's job perfectly of showing the last commit that compiled. think i should just stick with that one? |
| 21:28 | Chouser | just pick a version of contrib that seems to work, test it well and let us know which it is |
| 21:28 | duck1123 | I'm going to have to adapt to clojure.test-is sooner or later though |
| 21:29 | Chouser | that should help whoever finally branches 1.0 |
| 21:29 | duck1123 | 2 revs ago compiles. didn't test |
| 21:30 | duck1123 | just ran ant -Dclojure.jar=../clojure/clojure.jar |
| 22:48 | justin` | hey does anyone know why I can't accept user input in slime? |
| 22:48 | justin` | every time I use (flush) no matter what I enter I just stop getting a prompt |
| 22:49 | justin` | anyone around? |
| 22:56 | duck1123 | I saw someone mention this before. (it may have been you) |
| 22:56 | duck1123 | I don't know what the fix is |
| 23:50 | eyeris | Why is (pred x) returning a reference to the function instead of the result of that function? |
| 23:50 | eyeris | http://pastebin.ca/1478013 |
| 23:52 | eyeris | That should say "above the if construct" |