From eli at barzilay.org Tue Jul 1 01:00:26 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:21:54 2009 Subject: [plt-scheme] IE Warnings In-Reply-To: <20080701042704.GB23685@duncan.reilly.home> References: <365603.48305.qm@web81308.mail.mud.yahoo.com> <18532.711.494695.477507@arabic.ccs.neu.edu> <486403A5.5040209@cs.utah.edu> <18532.1302.108124.516928@arabic.ccs.neu.edu> <18532.44660.112822.446614@arabic.ccs.neu.edu> <20080701042704.GB23685@duncan.reilly.home> Message-ID: <18537.47594.857691.260843@arabic.ccs.neu.edu> On Jul 1, Andrew Reilly wrote: > On Fri, Jun 27, 2008 at 05:10:12AM -0400, Eli Barzilay wrote: > > But if there's a link to something that is not an html file (like > > the release notes text files), then there's no way to add that > > comment, and these links will just not work. That makes things > > considerabley worse. > > Is it necessary that those files be viewed through the help system > as plain text? Perhaps they could be (trivially) converted into > html, complete with the mark of the internet, by putting the whole > document into a section? > > Yeah, yuck. But the problem seems to demand a yucky solution... Yes, I thought about that, but one problem is that it's a fragile solution. There are things like the srfi docs that can link to such files and changing them wouldn't be easy. It's also fragile in the sense that bugs would be very hard to find (I can easily imagine such bugs frustrating people since they get the stupid links-not-working behavior, and since it's in the browser, my guess is that most people will assume it's some browser bug). But more than that, the idea of going to such levels of hacking just for the mess IE is in seems like a bad idea. (Even if putting the comments would be sufficient, I'd feel uncomfortable having them there in all HTMLs for that reason.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From simonsj at ccs.neu.edu Tue Jul 1 05:16:06 2008 From: simonsj at ccs.neu.edu (Jon Simons) Date: Thu Mar 26 02:21:56 2009 Subject: [plt-scheme] Porting to R6RS -- define-struct Message-ID: <4869F5D6.1010508@ccs.neu.edu> Hello, I am trying to port a pet project of mine from something that works with mzscheme v372 to be R6RS-compliant. My project had a few modules in different files within a local directory, and my top level file had a series of: (require (lib "list.ss")) (require "foo.scm") ;; local module (require "bar.scm") ;; local module ... So far I've managed to accomplish: #!r6rs (import (rnrs) (foo)) ... Where my 'foo' module used to be: (module foo mzscheme (require (lib "list.ss")) (provide foo-func)) And is now: #!r6rs (library (foo) (export foo-func) (import (rnrs) (rnrs lists (6))) #| foo-func definition |#) So far, so good... I used 'plt-r6rs --install ./foo.scm' to install my local file as an R6RS library. Is this the proper thing to do, even if this module is solely intended for use within my program? Now onto my 'bar' module. This module uses define-struct, and I currently have something like: #!r6rs (library (bar) (export BAR) (import) (define-struct BAR (a b c))) This yields "export: no binding for exported identifier in: BAR". I'm guessing that I need to import something to make define-struct available so that it can provide the BAR identifier. My question is -- how do I make this "work" ? Is define-struct available in an R6RS-friendly manner? -- Jon Simons From jos.koot at telefonica.net Tue Jul 1 05:34:46 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:21:57 2009 Subject: [plt-scheme] Porting to R6RS -- define-struct References: <4869F5D6.1010508@ccs.neu.edu> Message-ID: <002501c8db5d$b3aab610$2101a8c0@uw2b2dff239c4d> You have to import define-struct and to export all variables defined by the define-struct form. Or sticking to R6RS: import (rnrs records syntactic (6)), use define-record-type and export all variables defined by define-record-type. Jos ----- Original Message ----- From: "Jon Simons" To: Sent: Tuesday, July 01, 2008 11:16 AM Subject: [plt-scheme] Porting to R6RS -- define-struct > Hello, > > I am trying to port a pet project of mine from something that works with > mzscheme v372 to be R6RS-compliant. My project had a few modules in > different files within a local directory, and my top level file had a > series of: > > (require (lib "list.ss")) > (require "foo.scm") ;; local module > (require "bar.scm") ;; local module > ... > > So far I've managed to accomplish: > > #!r6rs > (import (rnrs) > (foo)) > ... > > Where my 'foo' module used to be: > > (module foo mzscheme > (require (lib "list.ss")) > (provide foo-func)) > > And is now: > > #!r6rs > (library (foo) > (export foo-func) > (import (rnrs) > (rnrs lists (6))) > > #| foo-func definition |#) > > So far, so good... I used 'plt-r6rs --install ./foo.scm' to install my > local file as an R6RS library. Is this the proper thing to do, even if > this module is solely intended for use within my program? > > Now onto my 'bar' module. This module uses define-struct, and I currently > have something like: > > #!r6rs > (library (bar) > (export BAR) > (import) > > (define-struct BAR (a b c))) > > This yields "export: no binding for exported identifier in: BAR". I'm > guessing that I need to import something to make define-struct available > so that it can provide the BAR identifier. > > My question is -- how do I make this "work" ? Is define-struct available > in an R6RS-friendly manner? > > > -- > Jon Simons > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From andrew-scheme at areilly.bpc-users.org Tue Jul 1 00:27:04 2008 From: andrew-scheme at areilly.bpc-users.org (Andrew Reilly) Date: Thu Mar 26 02:21:57 2009 Subject: [plt-scheme] IE Warnings In-Reply-To: <18532.44660.112822.446614@arabic.ccs.neu.edu> References: <365603.48305.qm@web81308.mail.mud.yahoo.com> <18532.711.494695.477507@arabic.ccs.neu.edu> <486403A5.5040209@cs.utah.edu> <18532.1302.108124.516928@arabic.ccs.neu.edu> <18532.44660.112822.446614@arabic.ccs.neu.edu> Message-ID: <20080701042704.GB23685@duncan.reilly.home> On Fri, Jun 27, 2008 at 05:10:12AM -0400, Eli Barzilay wrote: > But if > there's a link to something that is not an html file (like the release > notes text files), then there's no way to add that comment, and these > links will just not work. That makes things considerabley worse. Is it necessary that those files be viewed through the help system as plain text? Perhaps they could be (trivially) converted into html, complete with the mark of the internet, by putting the whole document into a section? Yeah, yuck. But the problem seems to demand a yucky solution... Cheers, -- Andrew From tom at zwizwa.be Tue Jul 1 07:49:24 2008 From: tom at zwizwa.be (Tom Schouten) Date: Thu Mar 26 02:21:57 2009 Subject: [plt-scheme] sandbox & ports closed prematurely Message-ID: <20080701114924.GA24437@zzz.i> Hello, I ran into strange sandbox evaluator behaviour where an output port gets closed immediately, instead of at evaluator destruction time: Welcome to MzScheme v4.0.1.3 [3m], Copyright (c) 2004-2008 PLT Scheme Inc. > (require scheme/sandbox) > (sandbox-security-guard (current-security-guard)) > (define e (make-evaluator 'scheme/base)) > (define f (e '(open-output-file "/tmp/bla"))) > (display 123 f) display: output port is closed === context === /usr/local/plt/collects/scheme/private/misc.ss:68:7 Tested with last night's build. Cheers, Tom From eli at barzilay.org Tue Jul 1 07:57:20 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:21:57 2009 Subject: [plt-scheme] sandbox & ports closed prematurely In-Reply-To: <20080701114924.GA24437@zzz.i> References: <20080701114924.GA24437@zzz.i> Message-ID: <18538.7072.28236.716029@arabic.ccs.neu.edu> On Jul 1, Tom Schouten wrote: > Hello, > > I ran into strange sandbox evaluator behaviour where an output port gets closed immediately, > instead of at evaluator destruction time: > > Welcome to MzScheme v4.0.1.3 [3m], Copyright (c) 2004-2008 PLT Scheme Inc. > > (require scheme/sandbox) > > (sandbox-security-guard (current-security-guard)) > > (define e (make-evaluator 'scheme/base)) > > (define f (e '(open-output-file "/tmp/bla"))) > > (display 123 f) > display: output port is closed The default is a little paranoid: every evaluation is performed with a time and a space limit, which means running under a temporay custodian. If you add (sandbox-eval-limits #f) then this will not happen. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From tom at zwizwa.be Tue Jul 1 08:06:26 2008 From: tom at zwizwa.be (Tom Schouten) Date: Thu Mar 26 02:21:57 2009 Subject: [plt-scheme] sandbox & ports closed prematurely In-Reply-To: <18538.7072.28236.716029@arabic.ccs.neu.edu> References: <20080701114924.GA24437@zzz.i> <18538.7072.28236.716029@arabic.ccs.neu.edu> Message-ID: <20080701120626.GB24437@zzz.i> On Tue, Jul 01, 2008 at 07:57:20AM -0400, Eli Barzilay wrote: > On Jul 1, Tom Schouten wrote: > > Hello, > > > > I ran into strange sandbox evaluator behaviour where an output port gets closed immediately, > > instead of at evaluator destruction time: > > > > Welcome to MzScheme v4.0.1.3 [3m], Copyright (c) 2004-2008 PLT Scheme Inc. > > > (require scheme/sandbox) > > > (sandbox-security-guard (current-security-guard)) > > > (define e (make-evaluator 'scheme/base)) > > > (define f (e '(open-output-file "/tmp/bla"))) > > > (display 123 f) > > display: output port is closed > > The default is a little paranoid: every evaluation is performed with a > time and a space limit, which means running under a temporay > custodian. If you add (sandbox-eval-limits #f) then this will not > happen. Thanks. I suppose there's no easy way to have it both? Can a custodian be made to ignore I/O ports, and let them be handled by its parent? From eli at barzilay.org Tue Jul 1 08:31:42 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:21:57 2009 Subject: [plt-scheme] sandbox & ports closed prematurely In-Reply-To: <20080701120626.GB24437@zzz.i> References: <20080701114924.GA24437@zzz.i> <18538.7072.28236.716029@arabic.ccs.neu.edu> <20080701120626.GB24437@zzz.i> Message-ID: <18538.9134.83818.631965@arabic.ccs.neu.edu> On Jul 1, Tom Schouten wrote: > On Tue, Jul 01, 2008 at 07:57:20AM -0400, Eli Barzilay wrote: > > > > The default is a little paranoid: every evaluation is performed with a > > time and a space limit, which means running under a temporay > > custodian. If you add (sandbox-eval-limits #f) then this will not > > happen. > > Thanks. > I suppose there's no easy way to have it both? Can a custodian be > made to ignore I/O ports, and let them be handled by its parent? Well, the same parameter is used for evaluating the whole program (which for you is just `scheme/base') and for later evaluations; but you can change the limit later. But I see now that there's a problem with the arguments to `set-eval-limits' that I should fix. In any case, I think that it can do a little better, but not much, because, for example, custodians cannot account for runtime. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From spdegabrielle at gmail.com Tue Jul 1 08:36:15 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:21:58 2009 Subject: [plt-scheme] What causes error: compile: bad syntax; function application is not allowed, because no #%app syntax transformer is bound in: (#%top-interaction . list-of-email) Message-ID: <595b9ab20807010536h4c240618q1b1e5436d43af16c@mail.gmail.com> Hi, I'm getting an error; . compile: bad syntax; function application is not allowed, because no #%app syntax transformer is bound in: (#%top-interaction . list-of-email) What happens is; 1. I run my (module language) program in drscheme, 2. It fails with an error (no sense pretending this doesn't happen a lot) 3. I type in the name of a variable I want to inspect 4. above error occurs. I didn't get this error in 3xx, and I don't get it all the time, and I'm having trouble working out what is causing it? -- Welcome to DrScheme, version 4.0.1 [3m]. Language: Module custom. . . car: expects argument of type ; given false > list-of-email . compile: bad syntax; function application is not allowed, because no #%app syntax transformer is bound in: (#%top-interaction . list-of-email) > -- Cheers, Stephen -- Stephen De Gabrielle s.degabrielle@cs.ucl.ac.uk Telephone +44 (0)20 7679 0693 (x30693) Mobile 079 851 890 45 Project: Making Sense of Information (MaSI) Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html Home:http://www.degabrielle.name/stephen UCL Interaction Centre MPEB 8th floor University College London Gower Street London WC1E 6BT From eli at barzilay.org Tue Jul 1 08:39:48 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:21:58 2009 Subject: [plt-scheme] sandbox & ports closed prematurely In-Reply-To: <18538.9134.83818.631965@arabic.ccs.neu.edu> References: <20080701114924.GA24437@zzz.i> <18538.7072.28236.716029@arabic.ccs.neu.edu> <20080701120626.GB24437@zzz.i> <18538.9134.83818.631965@arabic.ccs.neu.edu> Message-ID: <18538.9620.286057.616100@arabic.ccs.neu.edu> On Jul 1, Eli Barzilay wrote: > On Jul 1, Tom Schouten wrote: > > On Tue, Jul 01, 2008 at 07:57:20AM -0400, Eli Barzilay wrote: > > > > > > The default is a little paranoid: every evaluation is performed with a > > > time and a space limit, which means running under a temporay > > > custodian. If you add (sandbox-eval-limits #f) then this will not > > > happen. > > > > Thanks. > > I suppose there's no easy way to have it both? Can a custodian be > > made to ignore I/O ports, and let them be handled by its parent? > > Well, the same parameter is used for evaluating the whole program > (which for you is just `scheme/base') and for later evaluations; but > you can change the limit later. But I see now that there's a > problem with the arguments to `set-eval-limits' that I should fix. I forgot to add here -- there is a problem with bad arguments, but you can still use it to remove the per-evaluation limits. Something like this: (require scheme/sandbox) (sandbox-security-guard (current-security-guard)) (define e (make-evaluator 'scheme/base)) (set-eval-limits e #f #f) ; removes per-evaluation limits (define f (e '(open-output-file "/tmp/bla"))) (display 123 f) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Tue Jul 1 08:45:59 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:21:58 2009 Subject: [plt-scheme] What causes error: compile: bad syntax; function application is not allowed, because no #%app syntax transformer is bound in: (#%top-interaction . list-of-email) In-Reply-To: <595b9ab20807010536h4c240618q1b1e5436d43af16c@mail.gmail.com> References: <595b9ab20807010536h4c240618q1b1e5436d43af16c@mail.gmail.com> Message-ID: <18538.9991.536243.914157@arabic.ccs.neu.edu> On Jul 1, Stephen De Gabrielle wrote: > Hi, > > I'm getting an error; > > . compile: bad syntax; function application is not allowed, because no > #%app syntax transformer is bound in: (#%top-interaction . > list-of-email) > > What happens is; > 1. I run my (module language) program in drscheme, > 2. It fails with an error (no sense pretending this doesn't happen a lot) > 3. I type in the name of a variable I want to inspect > 4. above error occurs. > > I didn't get this error in 3xx, and I don't get it all the time, and > I'm having trouble working out what is causing it? When there is a syntax error in the module, it cannot be evaluated. In 37x, you'd be left with a default REPL, in the mzscheme language; and in 4.0 you're left with a repl with no language at all. The code in svn changed very recently so that you're still left with a working REPL in the language that your module is written in (assuming that the error is not in the module syntax, or a reader-level error). But in both cases you won't be able to see any of your bindings. But that's only for syntax errors, with run-time errors things should be the same, and you should still be able to see previous bindings. So, my guess is that in > Welcome to DrScheme, version 4.0.1 [3m]. > Language: Module custom. > . . car: expects argument of type ; given false that error comes from some macro. (If not, then there might be some other problem, and I'd like to see the code.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From JesseAldridge at gmail.com Tue Jul 1 02:08:28 2008 From: JesseAldridge at gmail.com (Jesse Aldridge) Date: Thu Mar 26 02:21:58 2009 Subject: [plt-scheme] problem with browser module Message-ID: <75b50d05-b002-4e9a-86ee-54d51e7f6f06@34g2000hsf.googlegroups.com> When I run this: #lang scheme (require browser) I get this error: m: argument does not implement #<|interface:hyper-frame<%>|>: # What does the error mean? Is the browser module broken? I'm completely new to Scheme, so I don't understand what's going on here. From mflatt at cs.utah.edu Tue Jul 1 09:44:04 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:21:58 2009 Subject: [plt-scheme] Sequences are no fun In-Reply-To: References: Message-ID: <20080701134407.59D8D650119@mail-svr1.cs.utah.edu> At Mon, 30 Jun 2008 17:23:46 -0700, "Mark Engelberg" wrote: > I'm trying to code up some higher-order functions on sequences, and > I'm finding this to be quite tricky. A big part of the problem is > that there is no good way to "peek" at the head of the sequence > without consuming it, and another big part of the problem is the sheer > verbosity of converting sequences to generating functions and back. > > As a case in point, here's what I've go so far for drop-while: > > (define (sequence->list seq) (for/list ((i seq)) i)) > > (define (identity x) x) > (define (const-true x) #t) > > (define (drop-one seq) > (let-values ([(more? next) (sequence-generate seq)]) > (next) > (make-do-sequence > (? () (values identity (? (x) (next)) (next) const-true > const-true (? (t v) (more?))))))) > > (define (drop-while pred seq) > (let-values ([(more? next) (sequence-generate seq)]) > (cond > [(not (more?)) empty] > [else (let ([next-value (next)]) > (cond > [(pred next-value) (drop-while pred (drop-one seq))] > [else (make-do-sequence > (? () (values identity (? (x) (next)) > next-value const-true const-true (? (t v) (more?)))))]))]))) > > > This almost works, but a sequence formed by drop-while isn't consumed > properly by sequence->list (try doing a sequence->list twice on > something generated by drop-while, and you'll see what I mean). I think the problem is that `seq' is instantiated too early. It should be converted to a generator when the sequence produced by `drop-while' is converted to a generator. That is, `sequence-generate' should be called within the thunk passed to `make-do-sequence'. That's also the point where you want to determine the first item (and whether there are any items at all): I'd write it like this: (define (drop-while pred seq) (make-do-sequence (lambda () (let-values ([(more? next) (sequence-generate seq)]) (let loop () (if (more?) (let ([val (next)]) (if (pred val) (loop) ;; sequence that starts with val: (values ;; pos->val: (lambda (mode) (case (car mode) [(init) (cdr mode)] [(get) (next)])) ;; next-pos: (lambda (mode) '(get)) ;; initial pos; we put `val' here instead ;; of referring to it directly in the `pos->val' ;; proc so that `val' can be GC'ed after it's ;; used up. (cons 'init val) ;; continue at position? (lambda (mode) (case (car mode) [(init) #t] [(get) (more?)])) ;; continue after val? (lambda (val) #t) ;; continue after pos + val? (lambda (mode val) #t)))) ;; Empty sequence: (values void void #f (lambda (pos) #f) void void))))))) Matthew From tom at zwizwa.be Tue Jul 1 10:36:46 2008 From: tom at zwizwa.be (Tom Schouten) Date: Thu Mar 26 02:21:59 2009 Subject: [plt-scheme] custodian + process/ports Message-ID: <20080701143646.GC24437@zzz.i> Hello, How can a process created with process/ports be properly terminated (without creating zombie processes) when its stdin is closed by a custodian? I.e.: closing gnuplot's stdin produced by the following code creates a defunct process. (define (open-gnuplot) (match (process/ports (current-output-port) #f (current-output-port) "gnuplot") ((list stdout stdin pid stderr control) stdin))) Cheers, Tom From czhu at cs.utah.edu Tue Jul 1 11:38:14 2008 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:21:59 2009 Subject: [plt-scheme] custodian + process/ports In-Reply-To: <20080701143646.GC24437@zzz.i> References: <20080701143646.GC24437@zzz.i> Message-ID: <486A4F66.1020103@cs.utah.edu> I would create my own input port using 'make-input-port, which might work just as a pipe, but with 'close to close the custodian that control the gnuplot process. Hope that helps. Chongkai Tom Schouten wrote: > Hello, > > How can a process created with process/ports be properly terminated (without creating zombie > processes) when its stdin is closed by a custodian? > > I.e.: closing gnuplot's stdin produced by the following code creates a defunct process. > > (define (open-gnuplot) > (match (process/ports (current-output-port) #f > (current-output-port) "gnuplot") > ((list stdout > stdin > pid > stderr > control) > stdin))) > > > Cheers, > Tom > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From robert.matovinovic at web.de Tue Jul 1 12:15:16 2008 From: robert.matovinovic at web.de (Robert Matovinovic) Date: Thu Mar 26 02:21:59 2009 Subject: AW: [plt-scheme] word completion for module based languages In-Reply-To: <932b2f1f0806302002m3c68bc14xe9a869c29204d65d@mail.gmail.com> Message-ID: <94C9EE6BA5A44F80AFC3A685430B3483@IBMI> as I already mentioned in the last mail, which unfortunately wasn't sent to the list, my language is not augmenting the capability-value method. I read docs, looked in the source, tried different things, the whole day but didn't come to a solution. Concerning the capability-value example below I must make a stupid mistake, because whereever I put it in my code I get expand: unbound variable in module in: drscheme:language-configuration/internal:get-all-manual-keywords Well, I looked up in private/drsig.ss that get-all-manual-keywords is a method of drscheme:language-configuration/internal since I thought this might be the mistake because drscheme:language-configuration:get-all-manual-keywords brought up the respective mistake. So what I'm doing wrong? On the other hand I found that 'drscheme:autocomplete-words is #t. Also it seems to me get-all-manual-keywords is the default for 'drscheme:autocomplete-words is #t. So it should just work without augmenting capability-value. Is that true? In my language "no completions available .." is the only thing I see. 'gui-debugger:debug-button is also #t. I defined the method debugger:supported? in the drscheme:language:module-based-language->language-mixin of my language. The button is there and clickable not depending on my debugger:supported? method. But after clicking the debugger panels don't show up although in the background something happens. If I want to debug (+ 1 2) after some time the interaction window opens and displays the result. The debugger:supported? method seems also to be set to #t by default. But something suppresses the debugging. Any help appreciated. Robert -----Urspr?ngliche Nachricht----- Von: plt-scheme-bounces@list.cs.brown.edu [mailto:plt-scheme-bounces@list.cs.brown.edu] Im Auftrag von Robby Findler Gesendet: Dienstag, 1. Juli 2008 05:02 An: Robert Matovinovic Cc: plt-scheme@list.cs.brown.edu Betreff: Re: [plt-scheme] word completion for module based languages [ Matthew? Greg? A debugger question below. ] Is your language augmenting the capability-value method? Perhaps you need something like this: (define/augment (capability-value key) (cond [(eq? key 'drscheme:autocomplete-words) (drscheme:language-configuration:get-all-manual-keywords)] [else (drscheme:language:get-capability-default key)])) You might want to check over the docs for drscheme:language:register-capability to see if there are other capabilities you want to enable. For the debugger, it looks like you want to both respond with #t to the 'gui-debugger:debug-button capability (add to the above method), and define the debugger:supported? method, which should also return #t. I'm just inferring that from the source, tho, so Matthew or Greg may know better. Robby On Sat, Jun 28, 2008 at 2:20 AM, Robert Matovinovic wrote: > Yes, the language is in the language dialog and defined as module with > "(module ..." and uses drscheme:language-configuration:add-language > and drscheme:get/extend:extend-unit-frame. I will look at "#lang ...". > So far I only know that one can use it as an abbreviation for module. > > Robert > > -----Urspr?ngliche Nachricht----- > Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] Im > Auftrag von Robby Findler > Gesendet: Freitag, 27. Juni 2008 22:16 > An: Robert Matovinovic > Cc: plt-scheme@list.cs.brown.edu > Betreff: Re: [plt-scheme] word completion for module based languages > > > On Fri, Jun 27, 2008 at 2:47 PM, Robert Matovinovic > wrote: >> Finally I could test what you have checked in, Robby. Word completion >> now shows also all commands of my module language in version 4.0.1 >> [3m](Yippieh), thank you very much. But unfortunately it works only >> if one of the built-in languages are chosen but not when I switch to >> my module language. So something is still missing which is important >> to me. Maybe there is something I have to add to my module. I don't >> ask for language specific filtering of the word completion, the whole >> list would be alright, just that it works also with a module >> language. > > Can you tell me a little more about how you've added the language to > DrScheme? Is it in the language dialog? > > If so, perhaps you might consider defining your language in a way that > "#lang ..." works and then using DrScheme's module language. We're > trying to migrate that way so that all of the information needed to > run the program is in the program's text itself (as opposed to being > in the environment). > >> I also like to use the debugger with my module language, but it >> doesn't. Is there an easy fix? > > I suspect the answer here may be the same as the above, but I'm not > sure. > > Robby > > > From robby at cs.uchicago.edu Tue Jul 1 12:18:03 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:21:59 2009 Subject: [plt-scheme] word completion for module based languages In-Reply-To: <94C9EE6BA5A44F80AFC3A685430B3483@IBMI> References: <932b2f1f0806302002m3c68bc14xe9a869c29204d65d@mail.gmail.com> <94C9EE6BA5A44F80AFC3A685430B3483@IBMI> Message-ID: <932b2f1f0807010918t6f774db7u93c761a81e38247a@mail.gmail.com> Hm. I think you're right, which means that its hard for me to tell what is going wrong without some more details. If you have the time, would you mind sending me a cut down version of your tool that illustrates the problem, but hopefully is just a couple of small files? (Probably there is a bug...) Thanks, Robby On Tue, Jul 1, 2008 at 11:15 AM, Robert Matovinovic wrote: > as I already mentioned in the last mail, which unfortunately wasn't sent to > the list, my language is not augmenting the capability-value method. I read > docs, looked in the source, tried different things, the whole day but didn't > come to a solution. Concerning the capability-value example below I must > make a stupid mistake, because whereever I put it in my code I get > > expand: unbound variable in module in: > drscheme:language-configuration/internal:get-all-manual-keywords > > Well, I looked up in private/drsig.ss that get-all-manual-keywords is a > method of drscheme:language-configuration/internal since I thought this > might be the mistake because > drscheme:language-configuration:get-all-manual-keywords brought up the > respective mistake. So what I'm doing wrong? > > On the other hand I found that 'drscheme:autocomplete-words is #t. Also it > seems to me get-all-manual-keywords is the default for > 'drscheme:autocomplete-words is #t. So it should just work without > augmenting capability-value. Is that true? In my language "no completions > available .." is the only thing I see. > > 'gui-debugger:debug-button is also #t. I defined the method > debugger:supported? in the > drscheme:language:module-based-language->language-mixin of my language. The > button is there and clickable not depending on my debugger:supported? > method. But after clicking the debugger panels don't show up although in the > background something happens. If I want to debug (+ 1 2) after some time the > interaction window opens and displays the result. The debugger:supported? > method seems also to be set to #t by default. But something suppresses the > debugging. > > Any help appreciated. > Robert > > > > -----Urspr?ngliche Nachricht----- > Von: plt-scheme-bounces@list.cs.brown.edu > [mailto:plt-scheme-bounces@list.cs.brown.edu] Im Auftrag von Robby Findler > Gesendet: Dienstag, 1. Juli 2008 05:02 > An: Robert Matovinovic > Cc: plt-scheme@list.cs.brown.edu > Betreff: Re: [plt-scheme] word completion for module based languages > > > [ Matthew? Greg? A debugger question below. ] > > Is your language augmenting the capability-value method? Perhaps you need > something like this: > > (define/augment (capability-value key) > (cond > [(eq? key 'drscheme:autocomplete-words) > (drscheme:language-configuration:get-all-manual-keywords)] > [else (drscheme:language:get-capability-default key)])) > > You might want to check over the docs for > > drscheme:language:register-capability > > to see if there are other capabilities you want to enable. > > For the debugger, it looks like you want to both respond with #t to the > 'gui-debugger:debug-button capability (add to the above method), and define > the debugger:supported? method, which should also return #t. I'm just > inferring that from the source, tho, so Matthew or Greg may know better. > > Robby > > On Sat, Jun 28, 2008 at 2:20 AM, Robert Matovinovic > wrote: >> Yes, the language is in the language dialog and defined as module with >> "(module ..." and uses drscheme:language-configuration:add-language >> and drscheme:get/extend:extend-unit-frame. I will look at "#lang ...". >> So far I only know that one can use it as an abbreviation for module. >> >> Robert >> >> -----Urspr?ngliche Nachricht----- >> Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] Im >> Auftrag von Robby Findler >> Gesendet: Freitag, 27. Juni 2008 22:16 >> An: Robert Matovinovic >> Cc: plt-scheme@list.cs.brown.edu >> Betreff: Re: [plt-scheme] word completion for module based languages >> >> >> On Fri, Jun 27, 2008 at 2:47 PM, Robert Matovinovic >> wrote: >>> Finally I could test what you have checked in, Robby. Word completion >>> now shows also all commands of my module language in version 4.0.1 >>> [3m](Yippieh), thank you very much. But unfortunately it works only >>> if one of the built-in languages are chosen but not when I switch to >>> my module language. So something is still missing which is important >>> to me. Maybe there is something I have to add to my module. I don't >>> ask for language specific filtering of the word completion, the whole >>> list would be alright, just that it works also with a module >>> language. >> >> Can you tell me a little more about how you've added the language to >> DrScheme? Is it in the language dialog? >> >> If so, perhaps you might consider defining your language in a way that >> "#lang ..." works and then using DrScheme's module language. We're >> trying to migrate that way so that all of the information needed to >> run the program is in the program's text itself (as opposed to being >> in the environment). >> >>> I also like to use the debugger with my module language, but it >>> doesn't. Is there an easy fix? >> >> I suspect the answer here may be the same as the above, but I'm not >> sure. >> >> Robby >> >> >> > > > From jos.koot at telefonica.net Tue Jul 1 12:27:38 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:21:59 2009 Subject: [plt-scheme] What causes error: compile: bad syntax; function application is not allowed, because no #%appsyntax transformer is bound in: (#%top-interaction . list-of-email) References: <595b9ab20807010536h4c240618q1b1e5436d43af16c@mail.gmail.com> Message-ID: <000c01c8db97$611d8b90$2101a8c0@uw2b2dff239c4d> Probably your program did not compile and hence did not even start running and hence nothing was bound in the interaction environment. Use check-syntax to see whether or not your program even compiles. Jos ----- Original Message ----- From: "Stephen De Gabrielle" To: "PLT Scheme List" Sent: Tuesday, July 01, 2008 2:36 PM Subject: [plt-scheme] What causes error: compile: bad syntax;function application is not allowed, because no #%appsyntax transformer is bound in: (#%top-interaction . list-of-email) > Hi, > > I'm getting an error; > > . compile: bad syntax; function application is not allowed, because no > #%app syntax transformer is bound in: (#%top-interaction . > list-of-email) > > What happens is; > 1. I run my (module language) program in drscheme, > 2. It fails with an error (no sense pretending this doesn't happen a lot) > 3. I type in the name of a variable I want to inspect > 4. above error occurs. > > I didn't get this error in 3xx, and I don't get it all the time, and > I'm having trouble working out what is causing it? > -- > Welcome to DrScheme, version 4.0.1 [3m]. > Language: Module custom. > . . car: expects argument of type ; given false >> list-of-email > . compile: bad syntax; function application is not allowed, because no > #%app syntax transformer is bound in: (#%top-interaction . > list-of-email) >> > -- > > Cheers, > > Stephen > > -- > Stephen De Gabrielle > s.degabrielle@cs.ucl.ac.uk > Telephone +44 (0)20 7679 0693 (x30693) > Mobile 079 851 890 45 > Project: Making Sense of Information (MaSI) > Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html > Home:http://www.degabrielle.name/stephen > > > UCL Interaction Centre > MPEB 8th floor > University College London > Gower Street > London WC1E 6BT > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From aripollak at gmail.com Tue Jul 1 11:13:26 2008 From: aripollak at gmail.com (Ari Pollak) Date: Thu Mar 26 02:21:59 2009 Subject: [plt-scheme] collection not found error at startup In-Reply-To: <18536.32729.460015.693702@arabic.ccs.neu.edu> References: <20080627093324.GA29098@pu100877.student.princeton.edu> <18532.46367.313022.261076@arabic.ccs.neu.edu> <20080627094924.GA29585@pu100877.student.princeton.edu> <18532.47898.347301.520849@arabic.ccs.neu.edu> <20080627112322.GA779@pu100877.student.princeton.edu> <18532.56627.263629.579915@arabic.ccs.neu.edu> <18536.6893.627841.512638@arabic.ccs.neu.edu> <18536.32729.460015.693702@arabic.ccs.neu.edu> Message-ID: On Mon, Jun 30, 2008 at 2:40 AM, Eli Barzilay wrote: > It gives you an accurate division for what's in the mzscheme > distribution and what's in the plt distribution. If you don't have > the resources that can make a proper division (like investing the time > to take our script and adapt it; or write your own dependency checking > script), then it's better to just drop the mzscheme package than > getting into such problems. (Like I said, I suspect that people who > would be mzscheme-only users are probably people who are very > comfortable getting and installing it from source.) I'm confident that most Debian users are comfortable installing something from source, but they'd rather have something that's clean and easily integrates into their system. And you're right, it would be easier to just create one plt-scheme package and ignore the people who don't want to install a bunch of X libraries on a server. >> But since mips & mipsel aren't even building CGC properly anymore, > > If this is based on the 371 sources, then please try again. No, that was based on 4.0.1: http://buildd.debian.org/fetch.cgi?pkg=drscheme;ver=2%3A4.0.1-1;arch=mips;stamp=1214351098 From eli at barzilay.org Tue Jul 1 12:51:45 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:00 2009 Subject: [plt-scheme] collection not found error at startup In-Reply-To: References: <20080627093324.GA29098@pu100877.student.princeton.edu> <18532.46367.313022.261076@arabic.ccs.neu.edu> <20080627094924.GA29585@pu100877.student.princeton.edu> <18532.47898.347301.520849@arabic.ccs.neu.edu> <20080627112322.GA779@pu100877.student.princeton.edu> <18532.56627.263629.579915@arabic.ccs.neu.edu> <18536.6893.627841.512638@arabic.ccs.neu.edu> <18536.32729.460015.693702@arabic.ccs.neu.edu> Message-ID: <18538.24737.331190.105708@arabic.ccs.neu.edu> On Jul 1, Ari Pollak wrote: > On Mon, Jun 30, 2008 at 2:40 AM, Eli Barzilay wrote: > > It gives you an accurate division for what's in the mzscheme > > distribution and what's in the plt distribution. If you don't > > have the resources that can make a proper division (like investing > > the time to take our script and adapt it; or write your own > > dependency checking script), then it's better to just drop the > > mzscheme package than getting into such problems. (Like I said, I > > suspect that people who would be mzscheme-only users are probably > > people who are very comfortable getting and installing it from > > source.) > > I'm confident that most Debian users are comfortable installing > something from source, but they'd rather have something that's clean > and easily integrates into their system. At the price of it being bogus and unsupported? The CGC version has some known problems, it can easily lead to large chunks of memory leaking. I can write simple code that should run indefinitely (or for a long time) in fixed space, but will crash when it runs out of memory with the CGC. (See [*] below for a little more about how this can happen.) > And you're right, it would be easier to just create one plt-scheme > package and ignore the people who don't want to install a bunch of X > libraries on a server. What I'm saying is that if you don't do a proper job in separating what goes into the plt and the mz distribution, then you're better switching to using our two source bundles for plt and mz which is an easy way to get the proper subset, or just avoid the separate subset package altogether. Both of these solutions are better than what you have now, because the save the most important resource we have (all of us), which is our time. This whole thread started when someone had problems that were caused by poor choice of subdirectories: one of the main changes in v4 is that much more functionality has moved from C code to Scheme libraries -- in the collects/scheme directory, so not including that directory (and having collective time spent looking for a cause) is a major indication that something in these decisions is not going right. In the meanwhile, my personal conclusion from all this is "the debian package does things wrong", which means that I'm more likely to reply in the future with "you're using the debian package, please try using our installers or source tarballs", which means that you get to deal with more problems. And BTW, I've seen a good number of people (including a debian case just last night) installing the mzscheme package because they don't need a gui ide -- they completely miss out on a bunch of things they don't get, like documentation, or like a library tree that is known to have complete dependencies. > >> But since mips & mipsel aren't even building CGC properly anymore, > > > > If this is based on the 371 sources, then please try again. > > No, that was based on 4.0.1: > http://buildd.debian.org/fetch.cgi?pkg=drscheme;ver=2%3A4.0.1-1;arch=mips;stamp=1214351098 This is a good example of what I'm talking about. What I get from this is that there's a segfault on an architecture I don't have access to, and the information that I have is: * It happens in a build process that I'm not familiar with (eg, looks like `configure' runs several times), * When the configure script is heavily customized with options (it's a .5kb command line), including using cgc default, which can definitely affect the installation process because it's something that can be too stressful for the cgc collector, * With a bunch of patches, including `00_debian-nonstandard-install' that changes the way mzscheme is searching for libraries when running for the install, * Under all of these circumstances, there is a segfault problem that looks like this: [...] setup-plt: making: srfi/25 setup-plt: in srfi/25 setup-plt: making: srfi/26 setup-plt: making: srfi/27 setup-plt: in srfi/27 make[2]: *** [install-cgc] Segmentation fault make[2]: Leaving directory `/build/buildd/drscheme-4.0.1/build' make[1]: *** [install] Error 2 make[1]: Leaving directory `/build/buildd/drscheme-4.0.1/build' make: *** [common-install-impl] Error 2 dpkg-buildpackage: failure: /usr/bin/fakeroot debian/rules binary-arch gave error exit status 2 Now, to debug this, I'd obviously try to isolate the problem by removeing all patches, dropping all non-standard customizations, gain access to a machine where I can recreate the crash and go on from there. The above points are working against this debugging process in almost every possible way. I have no useful information, and I see enough changes that the problem can arise from the modified sources/ configure-options/etc. ---- [*] Here's a brief description of how CGC is bad: It is a conservative collector -- no changes to C code are necessary, and the GC just scans everything assuming that all roots are pointers. Usually, this is not a problem, since misses are rare, and the numbers are usually short-lived so the memory will eventually be GCed. An example where this fails is when you have an infinite stream that you're cdring down -- on one end you're forcing promises that generate more cons cells and on the other end you're cdring down these cells. Now, what *might* happen is that you end up with a number that looks like a pointer to one of these cells -- so the cell will not be collected, including what it points to -- which means that from now on none of this will be GCed, and you'll get your memory filled up until you crash. This "might" is statistical -- it happens with a very low probability; but in a situation like cdring down an infinite lazy stream, this goes all the way up to a very high probability of it happenning. The compilation process can also be fragile in the same way: it has a lot of stuff in memory, and it keeps loading and unloading code. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jensaxel at soegaard.net Tue Jul 1 13:14:43 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:22:00 2009 Subject: [plt-scheme] A classic: Changing the background color Message-ID: <486A6603.7030206@soegaard.net> Hi all, I have a strong feeling this has been asked before, but Google was for once unhelpful. I have a frame with a few horizontal panels, a canvas, and an editor. Some components have white background, but most including all "filler" space have a grey background. Is there a way to change the background of the frame% in which everything is placed? -- Jens Axel S?gaard From robby at cs.uchicago.edu Tue Jul 1 14:08:27 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:00 2009 Subject: [plt-scheme] A classic: Changing the background color In-Reply-To: <486A6603.7030206@soegaard.net> References: <486A6603.7030206@soegaard.net> Message-ID: <932b2f1f0807011108l50ad2313ya29a136ef9ab402@mail.gmail.com> I don't think that there is an easy way, but generally the OS likes to color that space itself. Another thing that sometimes is helpful is to have the canvas not use white as its background, but instead use the platform background and we've got to some lengths to support that. Is that helpful in this case? Robby On Tue, Jul 1, 2008 at 12:14 PM, Jens Axel Soegaard wrote: > Hi all, > > I have a strong feeling this has been asked before, but Google was for once > unhelpful. > > I have a frame with a few horizontal panels, a canvas, and an editor. Some > components > have white background, but most including all "filler" space have a grey > background. > > Is there a way to change the background of the frame% in which everything is > placed? > > -- > Jens Axel S?gaard > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From grettke at acm.org Tue Jul 1 14:21:35 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:22:00 2009 Subject: [plt-scheme] A first experiment with HTDP Message-ID: <756daca50807011121j60a97cafoeb8b964e47349e5c@mail.gmail.com> At my company, we have a very diverse experience level among all of our employees. In fact, it is common practice to hire people with little to no experience (freshers who may or may not have studied in school or vocational training) and sort of train them on the job. There is always a want to teach the freshers "how to be good", my thought is to utilize HTDP. I want perform the first experiment in company training by working through HTDP start to finish with two or three freshers. We will have voice-meetings twice a week (along with email and instant messages). There is no time limit. Does this make sense? Is there any more to it? From matthias at ccs.neu.edu Tue Jul 1 14:35:56 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:22:00 2009 Subject: [plt-scheme] A first experiment with HTDP In-Reply-To: <756daca50807011121j60a97cafoeb8b964e47349e5c@mail.gmail.com> References: <756daca50807011121j60a97cafoeb8b964e47349e5c@mail.gmail.com> Message-ID: <7BD9B01D-1B1C-487D-B429-5821C286F1D8@ccs.neu.edu> On Jul 1, 2008, at 2:21 PM, Grant Rettke wrote: > At my company, we have a very diverse experience level among all of > our employees. > > In fact, it is common practice to hire people with little to no > experience (freshers who may or may not have studied in school or > vocational training) and sort of train them on the job. There is > always a want to teach the freshers "how to be good", my thought is to > utilize HTDP. You wouldn't be the first company to do just that. Indeed, one company just hired a former student of Shriram to improve their training. > I want perform the first experiment in company training by working > through HTDP start to finish with two or three freshers. We will have > voice-meetings twice a week (along with email and instant messages). Do you mean face-to-face meetings? > Does this make sense? Is there any more to it? 1. If they know "programming", point them to the Prologue for HTDP/2e and push them thru part 1 very quickly. 2. Keep in mind NOT to respond to design questions with answer but with the Design Recipe questions. The goal of your training is to empower your employees. The first step of empowerment is for them to notice that you're asking the same questions over and over again, and that they are making progress. 3. Have a couple of meta-sessions where you explain that if everyone adheres to the design recipe process -- in whatever language you end up choosing -- then you can (3a) switch employees around and they will quickly find their way around new code and (3b) modify specs slightly and the program changes in a reasonably similar small manner. (One day I want to formulate a topology for that and show that it's a continuous process.) Use examples to make this point, ideally from the chosen language of your company. Good luck -- Matthias From randomtalk at gmail.com Tue Jul 1 14:45:21 2008 From: randomtalk at gmail.com (Jason Wang) Date: Thu Mar 26 02:22:00 2009 Subject: [plt-scheme] plt scheme source? Message-ID: <939cf200807011145i493490f7ha47411a8167e4e1a@mail.gmail.com> Hi all, i downloaded the plt scheme source for mac a few days ago, and i have been trying to make sense of how plt scheme works. In order to improve understand how a real language is designed and implemented, and to improve my scheme/c knowledge. I still can't really tell where i should start diving in first, been trying to make sense of what seems to be the basic file of the entire thing (its included one way or another in almost every other file), src/mzscheme/include/scheme.h. However, what i would like most to know is how the scheme primitives are implemented, such as lambda and others, in c. Perhaps it will be more productive for me to dive in top-down instead of bottom up and understand how basic stuff gets translated into c. Any rough pointers in those areas would be greatly appreciated! Thanks a lot! Jason -- "It's a wonderful world hobbes ol' buddy, let's go explorin'!" - Calvin in "Calvin and Hobbes" From lunarc.lists at gmail.com Tue Jul 1 15:08:27 2008 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:22:01 2009 Subject: [plt-scheme] Requiring SRFIs Message-ID: Something I did not expect: Welcome to MzScheme v4.0.1 [3m], Copyright (c) 2004-2008 PLT Scheme Inc. > (require srfi/48) > (format "~h") format: expects argument of type ; given "~h" === context === /home/henk/local/src/mz-4.0.1/collects/scheme/private/misc.ss:68:7 It looks like I'm not getting the new definition of format. Prefixing the import solves the problem, but I'm not sure why it is behaving as above. I would have expected it to either throw an error or shadow the old definition with the new. Henk From czhu at cs.utah.edu Tue Jul 1 15:17:31 2008 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:22:01 2009 Subject: [plt-scheme] Requiring SRFIs In-Reply-To: References: Message-ID: <486A82CB.2020801@cs.utah.edu> According to the implementation, srfi/48 provides s:format but not format. Given that we can import modules with names that shadows the lang we are using (in a module), is it time to remove all the s: prefix for srfis? Chongkai Henk Boom wrote: > Something I did not expect: > > Welcome to MzScheme v4.0.1 [3m], Copyright (c) 2004-2008 PLT Scheme Inc. > >> (require srfi/48) >> (format "~h") >> > format: expects argument of type allowed)>; given "~h" > > === context === > /home/henk/local/src/mz-4.0.1/collects/scheme/private/misc.ss:68:7 > > It looks like I'm not getting the new definition of format. Prefixing > the import solves the problem, but I'm not sure why it is behaving as > above. I would have expected it to either throw an error or shadow the > old definition with the new. > > Henk > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From tom at zwizwa.be Tue Jul 1 15:26:12 2008 From: tom at zwizwa.be (Tom Schouten) Date: Thu Mar 26 02:22:01 2009 Subject: [plt-scheme] custodian + process/ports In-Reply-To: <486A4F66.1020103@cs.utah.edu> References: <20080701143646.GC24437@zzz.i> <486A4F66.1020103@cs.utah.edu> Message-ID: <20080701192612.GA3424@zzz.i> > I would create my own input port using 'make-input-port, which might > work just as a pipe, but with 'close to close the custodian that control > the gnuplot process. > > Hope that helps. > Thanks for the tip. I seem to get it to work for 'close-output-port, but creating a port in the scope of a custodian and then using 'custodian-shutdown-all doesn't seem to shut it down properly. (require scheme/system scheme/match) (define (open-gnuplot) (let ((co (current-output-port))) (match (process/ports co #f co "gnuplot") ((list stdout stdin pid stderr control) (make-output-port 'gnuplot stdin (lambda (bytes start endx _ __) (write-bytes bytes stdin start endx)) (lambda () (printf "closing gnuplot\n") (close-output-port stdin) (control 'wait))))))) > (close-output-port (open-gnuplot)) closing gnuplot > (define p #f) > (define c (make-custodian)) > (parameterize ((current-custodian c)) > (set! p (open-gnuplot))) > (custodian-shutdown-all c) -> closes only the embedded port (gnuplot process is defunct) From czhu at cs.utah.edu Tue Jul 1 15:43:54 2008 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:22:01 2009 Subject: [plt-scheme] custodian + process/ports In-Reply-To: <20080701192612.GA3424@zzz.i> References: <20080701143646.GC24437@zzz.i> <486A4F66.1020103@cs.utah.edu> <20080701192612.GA3424@zzz.i> Message-ID: <486A88FA.10009@cs.utah.edu> As the doc says, 'process/ports executes a shell command asynchronously, which means is is not under the control of custodian. It seems that you need to use 'subprocess instead of 'process/ports to get subprocess value, and then use 'subprocess-kill to kill it. Chongkai Tom Schouten wrote: > >> I would create my own input port using 'make-input-port, which might >> work just as a pipe, but with 'close to close the custodian that control >> the gnuplot process. >> >> Hope that helps. >> >> > > Thanks for the tip. I seem to get it to work for 'close-output-port, but > creating a port in the scope of a custodian and then using > 'custodian-shutdown-all doesn't seem to shut it down properly. > > (require > scheme/system > scheme/match) > > (define (open-gnuplot) > (let ((co (current-output-port))) > (match > (process/ports co #f co "gnuplot") > ((list stdout > stdin > pid > stderr > control) > (make-output-port > 'gnuplot > stdin > (lambda (bytes start endx _ __) > (write-bytes bytes stdin start endx)) > (lambda () > (printf "closing gnuplot\n") > (close-output-port stdin) > (control 'wait))))))) > > > > > >> (close-output-port (open-gnuplot)) >> > closing gnuplot > > > >> (define p #f) >> (define c (make-custodian)) >> (parameterize ((current-custodian c)) >> (set! p (open-gnuplot))) >> (custodian-shutdown-all c) >> > > -> closes only the embedded port (gnuplot process is defunct) > From jos.koot at telefonica.net Tue Jul 1 16:02:01 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:22:01 2009 Subject: [plt-scheme] A first experiment with HTDP References: <756daca50807011121j60a97cafoeb8b964e47349e5c@mail.gmail.com> Message-ID: <001901c8dbb5$53fef340$2101a8c0@uw2b2dff239c4d> The idea that companies take their own responsability of training their employees sounds good. In my humble opinion general education (high schools an universities) have, in the first place, the task to widen the horizon of their students, not so much as to prepare students for commercial life. If a company wants people with certain skills, it is the responsability of the company to allow their employees to adquire that skills. It is often heard that educational programs should better fit the needs of commerce. That sound comes from commerce of course, for it saves a lot of money, or rather robs money from the community as a whole. Students are paying for their education. If the education is directed to the needs of commercial life, than commerce should pay both the study and the student. mho. Some companies do have the policy to hire fresh people and provide trainings for them. In principle that is a good thing, except when it is the company's objective to hire people that can easily be brainwashed. Yes, I am a little bit paranoid. There should be a golden path between the principal goals of eductation and the more practicle ones. Is there? Jos ----- Original Message ----- From: "Grant Rettke" To: "pltscheme" Sent: Tuesday, July 01, 2008 8:21 PM Subject: [plt-scheme] A first experiment with HTDP > At my company, we have a very diverse experience level among all of > our employees. > > In fact, it is common practice to hire people with little to no > experience (freshers who may or may not have studied in school or > vocational training) and sort of train them on the job. There is > always a want to teach the freshers "how to be good", my thought is to > utilize HTDP. > > I want perform the first experiment in company training by working > through HTDP start to finish with two or three freshers. We will have > voice-meetings twice a week (along with email and instant messages). > There is no time limit. > > Does this make sense? Is there any more to it? > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From yarkun at gmail.com Tue Jul 1 16:08:51 2008 From: yarkun at gmail.com (Yavuz Arkun) Date: Thu Mar 26 02:22:01 2009 Subject: [plt-scheme] plt scheme source? In-Reply-To: <939cf200807011145i493490f7ha47411a8167e4e1a@mail.gmail.com> References: <939cf200807011145i493490f7ha47411a8167e4e1a@mail.gmail.com> Message-ID: <2748b30b0807011308q67cee8dav268c5d62942eae3d@mail.gmail.com> I am sure that others can answer your specific questions about PLT Scheme, but let me make an alternative suggestion: When I wanted to do something similar, at the end I decided that the sheer size of PLT Scheme (+ my nubness) makes the learning curve near vertical. Instead, I decided to follow Abdulaziz Ghuloum's step-by-step tutorial to implement a Scheme native compiler. Its a testament to its quality that even a complete beginner like me could follow it. While the end result is limited, it is not a toy in the sense that you could continue building on it and have a "real" Scheme compiler. In fact, I think that something very similar was the beginning of the Ghuloum's Ikarus Scheme. The tutorial link is at http://www.cs.indiana.edu/~aghuloum/ After working through it, you may find spelunking PLT easier. --Yavuz On Tue, Jul 1, 2008 at 21:45, Jason Wang wrote: > Hi all, i downloaded the plt scheme source for mac a few days ago, and > i have been trying to make sense of how plt scheme works. In order to > improve understand how a real language is designed and implemented, > and to improve my scheme/c knowledge. > > I still can't really tell where i should start diving in first, been > trying to make sense of what seems to be the basic file of the entire > thing (its included one way or another in almost every other file), > src/mzscheme/include/scheme.h. However, what i would like most to know > is how the scheme primitives are implemented, such as lambda and > others, in c. Perhaps it will be more productive for me to dive in > top-down instead of bottom up and understand how basic stuff gets > translated into c. > > Any rough pointers in those areas would be greatly appreciated! > > Thanks a lot! > > Jason > -- > "It's a wonderful world hobbes ol' buddy, let's go explorin'!" - > Calvin in "Calvin and Hobbes" > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From cobbe at ccs.neu.edu Tue Jul 1 16:11:21 2008 From: cobbe at ccs.neu.edu (Richard Cobbe) Date: Thu Mar 26 02:22:01 2009 Subject: [plt-scheme] Requiring SRFIs In-Reply-To: <486A82CB.2020801@cs.utah.edu> References: <486A82CB.2020801@cs.utah.edu> Message-ID: <20080701201121.GC1428@angua.local> On Tue, Jul 01, 2008 at 01:17:31PM -0600, Chongkai Zhu wrote: > According to the implementation, srfi/48 provides s:format but not format. > > Given that we can import modules with names that shadows the lang we are > using (in a module), is it time to remove all the s: prefix for srfis? That sounds like a bad idea to me. If we remove the prefix, then it would be all too easy for an unsuspecting developer who doesn't know the full interface of SRFI n (or some other module) to shadow one of the scheme language's built-in indentifiers unexpectedly, with resulting behavior that's hard to debug. On the other hand: speaking personally, I almost always require SRFIs with an explicit prefix, to avoid this exact problem. It'd be nice to be able to, in this case, refer to srfi-48:format instead of srfi-48:s:format. On the third hand: expecting users to specify their own prefix for SRFIs/modules is not a suitable general solution. It's especially not sufficient if omitting the prefix can silently cause bugs in the manner described above. Richard From tom at zwizwa.be Tue Jul 1 16:19:03 2008 From: tom at zwizwa.be (Tom Schouten) Date: Thu Mar 26 02:22:02 2009 Subject: [plt-scheme] custodian + process/ports In-Reply-To: <486A88FA.10009@cs.utah.edu> References: <20080701143646.GC24437@zzz.i> <486A4F66.1020103@cs.utah.edu> <20080701192612.GA3424@zzz.i> <486A88FA.10009@cs.utah.edu> Message-ID: <20080701201903.GA6591@zzz.i> On Tue, Jul 01, 2008 at 01:43:54PM -0600, Chongkai Zhu wrote: > As the doc says, 'process/ports executes a shell command asynchronously, > which means is is not under the control of custodian. It seems that you > need to use 'subprocess instead of 'process/ports to get subprocess > value, and then use 'subprocess-kill to kill it. 'subprocess also executes asynchronously, which i thought to mean "doesn't wait until process termination to return". Using process/ports the custodian does seem to close the ports, it just doesn't collect the return value of the process producing a zombie. Your suggested method works, but what i don't understand is why the 'close method of the port created by 'make-output-port doesn't get called by 'custodian-shutdown-all. Then another question: what is the difference between the process and subprocess procedures? (maybe the question is really: What's the difference between ordinary ports and file ports wrt. custodians?) From matthias at ccs.neu.edu Tue Jul 1 16:17:09 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:22:02 2009 Subject: [plt-scheme] A first experiment with HTDP In-Reply-To: <001901c8dbb5$53fef340$2101a8c0@uw2b2dff239c4d> References: <756daca50807011121j60a97cafoeb8b964e47349e5c@mail.gmail.com> <001901c8dbb5$53fef340$2101a8c0@uw2b2dff239c4d> Message-ID: <443BD447-1A5A-4CA7-B0D3-944183EEDF35@ccs.neu.edu> HtDP is clearly on the educational side of the spectrum that you're worried about. So you should praise Grant for trying to add education where universities and colleges have needlessly and pointlessly put training first, a common phenomenon in both the US and Germany in this day and age. As Mike Sperber once told me: > Wir sind froh, dass die Absolventen schon Java k?nnen. > Programmieren m?ssen wir denen halt noch beibringen. > I am sure your Dutch-German is good enough to translate this concise re-statement of my message. (I recently ran across a statement by the chairman of CS at UI @ Chicago Circle that expressed disbelieve that someone would expect education from a state university, which -- in his opinion -- had to serve the economic interests of the state of Illinois. It is not surprising then that companies spent on education of their employees because universities and colleges fail.) On Jul 1, 2008, at 4:02 PM, Jos Koot wrote: > The idea that companies take their own responsability of training > their employees sounds good. In my humble opinion general education > (high schools an universities) have, in the first place, the task > to widen the horizon of their students, not so much as to prepare > students for commercial life. If a company wants people with > certain skills, it is the responsability of the company to allow > their employees to adquire that skills. It is often heard that > educational programs should better fit the needs of commerce. That > sound comes from commerce of course, for it saves a lot of money, > or rather robs money from the community as a whole. Students are > paying for their education. If the education is directed to the > needs of commercial life, than commerce should pay both the study > and the student. mho. > > Some companies do have the policy to hire fresh people and provide > trainings for them. In principle that is a good thing, except when > it is the company's objective to hire people that can easily be > brainwashed. Yes, I am a little bit paranoid. > > There should be a golden path between the principal goals of > eductation and the more practicle ones. Is there? > Jos > > > ----- Original Message ----- From: "Grant Rettke" > To: "pltscheme" > Sent: Tuesday, July 01, 2008 8:21 PM > Subject: [plt-scheme] A first experiment with HTDP > > >> At my company, we have a very diverse experience level among all of >> our employees. >> >> In fact, it is common practice to hire people with little to no >> experience (freshers who may or may not have studied in school or >> vocational training) and sort of train them on the job. There is >> always a want to teach the freshers "how to be good", my thought >> is to >> utilize HTDP. >> >> I want perform the first experiment in company training by working >> through HTDP start to finish with two or three freshers. We will have >> voice-meetings twice a week (along with email and instant messages). >> There is no time limit. >> >> Does this make sense? Is there any more to it? >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From eli at barzilay.org Tue Jul 1 16:23:18 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:02 2009 Subject: [plt-scheme] Requiring SRFIs In-Reply-To: <20080701201121.GC1428@angua.local> References: <486A82CB.2020801@cs.utah.edu> <20080701201121.GC1428@angua.local> Message-ID: <18538.37430.520353.572796@arabic.ccs.neu.edu> On Jul 1, Richard Cobbe wrote: > On Tue, Jul 01, 2008 at 01:17:31PM -0600, Chongkai Zhu wrote: > > According to the implementation, srfi/48 provides s:format but not > > format. > > > > Given that we can import modules with names that shadows the lang > > we are using (in a module), is it time to remove all the s: prefix > > for srfis? I think that there is still a point to continue using the current practice that several srfis use: srfi/48/format provides s:format srfi/48 provides format Getting that is simple, I just changed #lang s-exp srfi/provider srfi/48/format to #lang s-exp srfi/provider srfi/48/format #:unprefix s: so if there are similar cases tell me and I'll do them too. (It doesn't look like the docs need to be updated, but tell me if they do.) > That sounds like a bad idea to me. If we remove the prefix, then it > would be all too easy for an unsuspecting developer who doesn't know > the full interface of SRFI n (or some other module) to shadow one of > the scheme language's built-in indentifiers unexpectedly, with > resulting behavior that's hard to debug. > > On the other hand: speaking personally, I almost always require > SRFIs with an explicit prefix, to avoid this exact problem. It'd be > nice to be able to, in this case, refer to srfi-48:format instead of > srfi-48:s:format. > > On the third hand: expecting users to specify their own prefix for > SRFIs/modules is not a suitable general solution. It's especially > not sufficient if omiqqtting the prefix can silently cause bugs in the > manner described above. I think that the above layout is a reasonable compromise. Or maybe even add thigs like srfi/s48 that will always use an `s:' prefix? (So you don't have to read the docs/code to know the prefix that you need.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From czhu at cs.utah.edu Tue Jul 1 16:27:20 2008 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:22:02 2009 Subject: [plt-scheme] custodian + process/ports In-Reply-To: <20080701201903.GA6591@zzz.i> References: <20080701143646.GC24437@zzz.i> <486A4F66.1020103@cs.utah.edu> <20080701192612.GA3424@zzz.i> <486A88FA.10009@cs.utah.edu> <20080701201903.GA6591@zzz.i> Message-ID: <486A9328.1090005@cs.utah.edu> Tom Schouten wrote: > On Tue, Jul 01, 2008 at 01:43:54PM -0600, Chongkai Zhu wrote: > >> As the doc says, 'process/ports executes a shell command asynchronously, >> which means is is not under the control of custodian. It seems that you >> need to use 'subprocess instead of 'process/ports to get subprocess >> value, and then use 'subprocess-kill to kill it. >> > > To make it clear: custodian doesn't manage subprocess. Sorry my first reply is not clear on this and is suggesting something that won't work. > 'subprocess also executes asynchronously, which i thought to mean > "doesn't wait until process termination to return". > Yes. Actually 'process and 'process/ports are all build on top of 'subprocess. > Using process/ports the custodian does seem to close the ports, it just doesn't > collect the return value of the process producing a zombie. Your suggested > method works, but what i don't understand is why the 'close method of the port > created by 'make-output-port doesn't get called by 'custodian-shutdown-all. > > I'm not sure what you are asking here. > Then another question: what is the difference between the process and subprocess > procedures? (maybe the question is really: What's the difference between > ordinary ports and file ports wrt. custodians?) > Try to take a look at the implementation of 'process. It's under mzlib/process. Chongkai From eli at barzilay.org Tue Jul 1 16:30:40 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:02 2009 Subject: [plt-scheme] custodian + process/ports In-Reply-To: <20080701201903.GA6591@zzz.i> References: <20080701143646.GC24437@zzz.i> <486A4F66.1020103@cs.utah.edu> <20080701192612.GA3424@zzz.i> <486A88FA.10009@cs.utah.edu> <20080701201903.GA6591@zzz.i> Message-ID: <18538.37872.291574.957135@arabic.ccs.neu.edu> On Jul 1, Tom Schouten wrote: > On Tue, Jul 01, 2008 at 01:43:54PM -0600, Chongkai Zhu wrote: > > As the doc says, 'process/ports executes a shell command asynchronously, > > which means is is not under the control of custodian. It seems that you > > need to use 'subprocess instead of 'process/ports to get subprocess > > value, and then use 'subprocess-kill to kill it. > > 'subprocess also executes asynchronously, which i thought to mean > "doesn't wait until process termination to return". > > Using process/ports the custodian does seem to close the ports, it > just doesn't collect the return value of the process producing a > zombie. Your suggested method works, but what i don't understand is > why the 'close method of the port created by 'make-output-port > doesn't get called by 'custodian-shutdown-all. My guess would be that the subprocess object gets released, but the process is still alive, which leads to the zombie. (The main problem being that custodians manage memory & ports, but not processes.) > Then another question: what is the difference between the process > and subprocess procedures? (maybe the question is really: What's the > difference between ordinary ports and file ports wrt. custodians?) * `subprocess' is the builtin functionality, `process' is in a scheme library. * `subprocess' returns multiple values, `process' returns a list (it's an interface that was taken from scsh, I think) * `subprocess' requires "stream" ports for stdin/out/err, or #f that returns a pipe that you need to feed or consume; `process' abstracts all that for you and simply uses the current scheme ports (making up the pipes and feeding threads when needed) * `subprocess' is the only function that does what it does; `process' has several relatives (like `process' itself that takes a command line, `process*' that takes the executable and args, `system' that just runs the command synchronously, etc). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From robert.matovinovic at web.de Tue Jul 1 16:41:15 2008 From: robert.matovinovic at web.de (Robert Matovinovic) Date: Thu Mar 26 02:22:03 2009 Subject: AW: [plt-scheme] word completion for module based languages In-Reply-To: <932b2f1f0807010918t6f774db7u93c761a81e38247a@mail.gmail.com> Message-ID: <2D55ECF5712E41FC8F4DEE1CBA1E0924@IBMI> Thank you very much for your offer. I will send you some small files that should do it, but not before tomorrow, it's 22:45 here. Robert -----Urspr?ngliche Nachricht----- Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] Im Auftrag von Robby Findler Gesendet: Dienstag, 1. Juli 2008 18:18 An: Robert Matovinovic Cc: plt-scheme@list.cs.brown.edu Betreff: Re: [plt-scheme] word completion for module based languages Hm. I think you're right, which means that its hard for me to tell what is going wrong without some more details. If you have the time, would you mind sending me a cut down version of your tool that illustrates the problem, but hopefully is just a couple of small files? (Probably there is a bug...) Thanks, Robby On Tue, Jul 1, 2008 at 11:15 AM, Robert Matovinovic wrote: > as I already mentioned in the last mail, which unfortunately wasn't > sent to the list, my language is not augmenting the capability-value > method. I read docs, looked in the source, tried different things, the > whole day but didn't come to a solution. Concerning the > capability-value example below I must make a stupid mistake, because > whereever I put it in my code I get > > expand: unbound variable in module in: > drscheme:language-configuration/internal:get-all-manual-keywords > > Well, I looked up in private/drsig.ss that get-all-manual-keywords is > a method of drscheme:language-configuration/internal since I thought > this might be the mistake because > drscheme:language-configuration:get-all-manual-keywords brought up the > respective mistake. So what I'm doing wrong? > > On the other hand I found that 'drscheme:autocomplete-words is #t. > Also it seems to me get-all-manual-keywords is the default for > 'drscheme:autocomplete-words is #t. So it should just work without > augmenting capability-value. Is that true? In my language "no > completions available .." is the only thing I see. > > 'gui-debugger:debug-button is also #t. I defined the method > debugger:supported? in the > drscheme:language:module-based-language->language-mixin of my > language. The button is there and clickable not depending on my > debugger:supported? method. But after clicking the debugger panels > don't show up although in the background something happens. If I want > to debug (+ 1 2) after some time the interaction window opens and > displays the result. The debugger:supported? method seems also to be > set to #t by default. But something suppresses the debugging. > > Any help appreciated. > Robert > > > > -----Urspr?ngliche Nachricht----- > Von: plt-scheme-bounces@list.cs.brown.edu > [mailto:plt-scheme-bounces@list.cs.brown.edu] Im Auftrag von Robby > Findler > Gesendet: Dienstag, 1. Juli 2008 05:02 > An: Robert Matovinovic > Cc: plt-scheme@list.cs.brown.edu > Betreff: Re: [plt-scheme] word completion for module based languages > > > [ Matthew? Greg? A debugger question below. ] > > Is your language augmenting the capability-value method? Perhaps you > need something like this: > > (define/augment (capability-value key) > (cond > [(eq? key 'drscheme:autocomplete-words) > (drscheme:language-configuration:get-all-manual-keywords)] > [else (drscheme:language:get-capability-default key)])) > > You might want to check over the docs for > > drscheme:language:register-capability > > to see if there are other capabilities you want to enable. > > For the debugger, it looks like you want to both respond with #t to > the 'gui-debugger:debug-button capability (add to the above method), > and define the debugger:supported? method, which should also return > #t. I'm just inferring that from the source, tho, so Matthew or Greg > may know better. > > Robby > > On Sat, Jun 28, 2008 at 2:20 AM, Robert Matovinovic > wrote: >> Yes, the language is in the language dialog and defined as module >> with "(module ..." and uses >> drscheme:language-configuration:add-language >> and drscheme:get/extend:extend-unit-frame. I will look at "#lang ...". >> So far I only know that one can use it as an abbreviation for module. >> >> Robert >> >> -----Urspr?ngliche Nachricht----- >> Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] Im >> Auftrag von Robby Findler >> Gesendet: Freitag, 27. Juni 2008 22:16 >> An: Robert Matovinovic >> Cc: plt-scheme@list.cs.brown.edu >> Betreff: Re: [plt-scheme] word completion for module based languages >> >> >> On Fri, Jun 27, 2008 at 2:47 PM, Robert Matovinovic >> wrote: >>> Finally I could test what you have checked in, Robby. Word >>> completion now shows also all commands of my module language in >>> version 4.0.1 [3m](Yippieh), thank you very much. But unfortunately >>> it works only if one of the built-in languages are chosen but not >>> when I switch to my module language. So something is still missing >>> which is important to me. Maybe there is something I have to add to >>> my module. I don't ask for language specific filtering of the word >>> completion, the whole list would be alright, just that it works also >>> with a module language. >> >> Can you tell me a little more about how you've added the language to >> DrScheme? Is it in the language dialog? >> >> If so, perhaps you might consider defining your language in a way >> that "#lang ..." works and then using DrScheme's module language. >> We're trying to migrate that way so that all of the information >> needed to run the program is in the program's text itself (as opposed >> to being in the environment). >> >>> I also like to use the debugger with my module language, but it >>> doesn't. Is there an easy fix? >> >> I suspect the answer here may be the same as the above, but I'm not >> sure. >> >> Robby >> >> >> > > > From jos.koot at telefonica.net Tue Jul 1 16:42:59 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:22:03 2009 Subject: [plt-scheme] A first experiment with HTDP References: <756daca50807011121j60a97cafoeb8b964e47349e5c@mail.gmail.com> <001901c8dbb5$53fef340$2101a8c0@uw2b2dff239c4d> <443BD447-1A5A-4CA7-B0D3-944183EEDF35@ccs.neu.edu> Message-ID: <003201c8dbbb$0cdac3d0$2101a8c0@uw2b2dff239c4d> Yes, I trust Grant enough to praise him for his efforts. He seems a sincere and integer person to me. I am glad, though, that you do understand my worry, which has nothing to do with Grant in person. Dutch and German are not the same, although a little bit alike, but I can read and speak both of them. Dutch is my native language, English the second, French and Spanish (i.e. Castiliano) the third ones, German the fourth and Catalonian the fifth. :::))) (Which is a pitty, because I live, nowadays, in Catalunya) Thanks for reminding me to be friendly to Grant. Jos ----- Original Message ----- From: "Matthias Felleisen" To: "Jos Koot" Cc: "Grant Rettke" ; "pltscheme" Sent: Tuesday, July 01, 2008 10:17 PM Subject: Re: [plt-scheme] A first experiment with HTDP HtDP is clearly on the educational side of the spectrum that you're worried about. So you should praise Grant for trying to add education where universities and colleges have needlessly and pointlessly put training first, a common phenomenon in both the US and Germany in this day and age. As Mike Sperber once told me: > Wir sind froh, dass die Absolventen schon Java k?nnen. Programmieren > m?ssen wir denen halt noch beibringen. > I am sure your Dutch-German is good enough to translate this concise re-statement of my message. (I recently ran across a statement by the chairman of CS at UI @ Chicago Circle that expressed disbelieve that someone would expect education from a state university, which -- in his opinion -- had to serve the economic interests of the state of Illinois. It is not surprising then that companies spent on education of their employees because universities and colleges fail.) On Jul 1, 2008, at 4:02 PM, Jos Koot wrote: > The idea that companies take their own responsability of training their > employees sounds good. In my humble opinion general education (high > schools an universities) have, in the first place, the task to widen the > horizon of their students, not so much as to prepare students for > commercial life. If a company wants people with certain skills, it is the > responsability of the company to allow their employees to adquire that > skills. It is often heard that educational programs should better fit the > needs of commerce. That sound comes from commerce of course, for it saves > a lot of money, or rather robs money from the community as a whole. > Students are paying for their education. If the education is directed to > the needs of commercial life, than commerce should pay both the study > and the student. mho. > > Some companies do have the policy to hire fresh people and provide > trainings for them. In principle that is a good thing, except when it is > the company's objective to hire people that can easily be brainwashed. > Yes, I am a little bit paranoid. > > There should be a golden path between the principal goals of eductation > and the more practicle ones. Is there? > Jos > > > ----- Original Message ----- From: "Grant Rettke" > To: "pltscheme" > Sent: Tuesday, July 01, 2008 8:21 PM > Subject: [plt-scheme] A first experiment with HTDP > > >> At my company, we have a very diverse experience level among all of >> our employees. >> >> In fact, it is common practice to hire people with little to no >> experience (freshers who may or may not have studied in school or >> vocational training) and sort of train them on the job. There is >> always a want to teach the freshers "how to be good", my thought is to >> utilize HTDP. >> >> I want perform the first experiment in company training by working >> through HTDP start to finish with two or three freshers. We will have >> voice-meetings twice a week (along with email and instant messages). >> There is no time limit. >> >> Does this make sense? Is there any more to it? >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From morazanm at gmail.com Tue Jul 1 16:46:29 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:22:03 2009 Subject: [plt-scheme] A first experiment with HTDP In-Reply-To: <001901c8dbb5$53fef340$2101a8c0@uw2b2dff239c4d> References: <756daca50807011121j60a97cafoeb8b964e47349e5c@mail.gmail.com> <001901c8dbb5$53fef340$2101a8c0@uw2b2dff239c4d> Message-ID: <9b1fff280807011346r5bbe5407vbe2c8dcd050bfc40@mail.gmail.com> > > Some companies do have the policy to hire fresh people and provide trainings > for them. In principle that is a good thing, except when it is the company's > objective to hire people that can easily be brainwashed. Yes, I am a little > bit paranoid. > To have students develop critical thinking and analytical skills are among the primary goals of an education. When those goals are met it should be rather difficult to hire people that are easily brainwashed. We shall continue our endeavors to further these goals. I am not sure companies want to hire people that are easily brainwashed. To survive companies need innovation (especially software companies). Innovation comes from a combination of critical thinking, analysis, and imagination. It seems to me that companies search out these qualities. My undergraduate research students, for example, have been quite successful at landing good jobs with good companies when they choose not to immediately pursue graduate school. Almost all of them, if not all, were chosen because the different companies believed they could successfully complete their in-house training program. A good education seemed a prerequisite to be chosen. I am delighted to learn, by the way, that Grant's company is putting together a test training program using HtDP. Well done! Is there a web page somewhere that lists companies using HtDP as part of their training program? It would be very useful to create one if it does not already exist. Cheers, Marco From matthias at ccs.neu.edu Tue Jul 1 16:53:44 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:22:03 2009 Subject: [plt-scheme] A first experiment with HTDP In-Reply-To: <9b1fff280807011346r5bbe5407vbe2c8dcd050bfc40@mail.gmail.com> References: <756daca50807011121j60a97cafoeb8b964e47349e5c@mail.gmail.com> <001901c8dbb5$53fef340$2101a8c0@uw2b2dff239c4d> <9b1fff280807011346r5bbe5407vbe2c8dcd050bfc40@mail.gmail.com> Message-ID: <24FC19FA-AA5D-4D17-AAE4-AEDCC23CB417@ccs.neu.edu> On Jul 1, 2008, at 4:46 PM, Marco Morazan wrote: > Is there a web > page somewhere that lists companies using HtDP as part of their > training program? It would be very useful to create one if it does not > already exist. Few companies would want that listed. Just like I am told by some major brand-name commercial Scheme implementors that companies do not want it to be known that they use Scheme for production coding (or anything else). -- Matthias From yarkun at gmail.com Tue Jul 1 17:04:02 2008 From: yarkun at gmail.com (Yavuz Arkun) Date: Thu Mar 26 02:22:03 2009 Subject: [plt-scheme] A first experiment with HTDP In-Reply-To: <24FC19FA-AA5D-4D17-AAE4-AEDCC23CB417@ccs.neu.edu> References: <756daca50807011121j60a97cafoeb8b964e47349e5c@mail.gmail.com> <001901c8dbb5$53fef340$2101a8c0@uw2b2dff239c4d> <9b1fff280807011346r5bbe5407vbe2c8dcd050bfc40@mail.gmail.com> <24FC19FA-AA5D-4D17-AAE4-AEDCC23CB417@ccs.neu.edu> Message-ID: <2748b30b0807011404v15f8f5b9ob1a0e8e2e9d6d35f@mail.gmail.com> I think its time to start spreading the rumor that running Scheme code results in less carbon emissions than running C code. Either that, or "it contains _zero_ transfat!" --Yavuz On Tue, Jul 1, 2008 at 23:53, Matthias Felleisen wrote: > Few companies would want that listed. > > Just like I am told by some major brand-name commercial Scheme implementors > that companies do not want it to be known that they use Scheme for > production coding (or anything else). > From morazanm at gmail.com Tue Jul 1 17:04:48 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:22:03 2009 Subject: [plt-scheme] A first experiment with HTDP In-Reply-To: <24FC19FA-AA5D-4D17-AAE4-AEDCC23CB417@ccs.neu.edu> References: <756daca50807011121j60a97cafoeb8b964e47349e5c@mail.gmail.com> <001901c8dbb5$53fef340$2101a8c0@uw2b2dff239c4d> <9b1fff280807011346r5bbe5407vbe2c8dcd050bfc40@mail.gmail.com> <24FC19FA-AA5D-4D17-AAE4-AEDCC23CB417@ccs.neu.edu> Message-ID: <9b1fff280807011404k5bfd0c51taa2114779c86e85d@mail.gmail.com> On Tue, Jul 1, 2008 at 4:53 PM, Matthias Felleisen wrote: > > On Jul 1, 2008, at 4:46 PM, Marco Morazan wrote: > >> Is there a web >> page somewhere that lists companies using HtDP as part of their >> training program? It would be very useful to create one if it does not >> already exist. > > Few companies would want that listed. > > Just like I am told by some major brand-name commercial Scheme implementors > that companies do not want it to be known that they use Scheme for > production coding (or anything else). The irony of reality never fails to amaze me. Scheme (and functional languages in general) are good enough to use, but not good enough to let it be known that they are used. What a tangled "web" we weave! Cheers, Marco From matthias at ccs.neu.edu Tue Jul 1 17:06:57 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:22:04 2009 Subject: [plt-scheme] A first experiment with HTDP In-Reply-To: <9b1fff280807011404k5bfd0c51taa2114779c86e85d@mail.gmail.com> References: <756daca50807011121j60a97cafoeb8b964e47349e5c@mail.gmail.com> <001901c8dbb5$53fef340$2101a8c0@uw2b2dff239c4d> <9b1fff280807011346r5bbe5407vbe2c8dcd050bfc40@mail.gmail.com> <24FC19FA-AA5D-4D17-AAE4-AEDCC23CB417@ccs.neu.edu> <9b1fff280807011404k5bfd0c51taa2114779c86e85d@mail.gmail.com> Message-ID: <1C189D32-FF12-413E-8FBF-9CAE32EA0B67@ccs.neu.edu> On Jul 1, 2008, at 5:04 PM, Marco Morazan wrote: > On Tue, Jul 1, 2008 at 4:53 PM, Matthias Felleisen > wrote: >> >> On Jul 1, 2008, at 4:46 PM, Marco Morazan wrote: >> >>> Is there a web >>> page somewhere that lists companies using HtDP as part of their >>> training program? It would be very useful to create one if it >>> does not >>> already exist. >> >> Few companies would want that listed. >> >> Just like I am told by some major brand-name commercial Scheme >> implementors >> that companies do not want it to be known that they use Scheme for >> production coding (or anything else). > > The irony of reality never fails to amaze me. Scheme (and functional > languages in general) are good enough to use, but not good enough to > let it be known that they are used. What a tangled "web" we weave! Stealth tools. Any competitive advantage for one company is another's disadvantage, so their thinking goes. The contrast to industrial apprenticeships in Germany is truly striking. There, Mercedes Benz and BMW and Volkswagen train apprentices in full knowledge that these people may end up working for their competitors once they become masters or journeymen. The idea is that share industrial knowledge is good for everyone involved. Then again, MB sued VW when a Chrysler executive switched and took some folders along from Detroit -- at that level, knowledge is probably much more leveraged than at the apprentice level. It's all a question of value. Enough said -- Matthias From hendrik at topoi.pooq.com Tue Jul 1 17:14:01 2008 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Thu Mar 26 02:22:04 2009 Subject: [plt-scheme] A first experiment with HTDP In-Reply-To: <2748b30b0807011404v15f8f5b9ob1a0e8e2e9d6d35f@mail.gmail.com> References: <756daca50807011121j60a97cafoeb8b964e47349e5c@mail.gmail.com> <001901c8dbb5$53fef340$2101a8c0@uw2b2dff239c4d> <9b1fff280807011346r5bbe5407vbe2c8dcd050bfc40@mail.gmail.com> <24FC19FA-AA5D-4D17-AAE4-AEDCC23CB417@ccs.neu.edu> <2748b30b0807011404v15f8f5b9ob1a0e8e2e9d6d35f@mail.gmail.com> Message-ID: <20080701211401.GB17671@topoi.pooq.com> On Wed, Jul 02, 2008 at 12:04:02AM +0300, Yavuz Arkun wrote: > I think its time to start spreading the rumor that running Scheme code > results in less carbon emissions than running C code. Either that, or > "it contains _zero_ transfat!" After all, C is Carbon. -- hendrik From mvanier at cs.caltech.edu Tue Jul 1 17:46:53 2008 From: mvanier at cs.caltech.edu (Michael Vanier) Date: Thu Mar 26 02:22:04 2009 Subject: [plt-scheme] A first experiment with HTDP In-Reply-To: <24FC19FA-AA5D-4D17-AAE4-AEDCC23CB417@ccs.neu.edu> References: <756daca50807011121j60a97cafoeb8b964e47349e5c@mail.gmail.com> <001901c8dbb5$53fef340$2101a8c0@uw2b2dff239c4d> <9b1fff280807011346r5bbe5407vbe2c8dcd050bfc40@mail.gmail.com> <24FC19FA-AA5D-4D17-AAE4-AEDCC23CB417@ccs.neu.edu> Message-ID: <486AA5CD.8040904@cs.caltech.edu> Maybe this should be the next slogan for Scheme: Scheme: the dirty little secret of the software industry! or even Scheme: the guilty programming pleasure you don't want your friends to know about! I recently talked to a programmer who said that even using _python_ on commercial projects makes a lot of people (= investors and managers) very nervous. They want programs to be written in a language like java where programmers are essentially just replaceable and disposable cogs in a giant machine. The notion that a good programmer can do the work of ten bad ones seems to be lost on these people. Of course, you have to treat the good programmer well so he won't leave, and maybe that's the problem. Mike Matthias Felleisen wrote: > > On Jul 1, 2008, at 4:46 PM, Marco Morazan wrote: > >> Is there a web >> page somewhere that lists companies using HtDP as part of their >> training program? It would be very useful to create one if it does not >> already exist. > > Few companies would want that listed. > > Just like I am told by some major brand-name commercial Scheme > implementors that companies do not want it to be known that they use > Scheme for production coding (or anything else). > > -- Matthias > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From tom at zwizwa.be Tue Jul 1 18:31:35 2008 From: tom at zwizwa.be (Tom Schouten) Date: Thu Mar 26 02:22:04 2009 Subject: [plt-scheme] custodian + process/ports In-Reply-To: <486A9328.1090005@cs.utah.edu> References: <20080701143646.GC24437@zzz.i> <486A4F66.1020103@cs.utah.edu> <20080701192612.GA3424@zzz.i> <486A88FA.10009@cs.utah.edu> <20080701201903.GA6591@zzz.i> <486A9328.1090005@cs.utah.edu> Message-ID: <20080701223135.GB6591@zzz.i> >> ... what i don't understand is why the 'close >> method of the port created by 'make-output-port doesn't get called by >> 'custodian-shutdown-all. >> > > I'm not sure what you are asking here. > Is there a reason why ports created with 'make-output-port do not get closed when 'custodian-shutdown-all is called? Why only file-stream/socket/... ports? (as mentioned in 1.1.16 custodians ref doc) Is there a way to add a thunk to a custodian, or why would that be a bad idea? (define (make-dummy-port) (make-output-port #f (current-output-port) void (lambda () (printf "closing\n")))) (define p #f) (parameterize ((current-custodian c)) (set! p (make-dummy-port))) (custodian-shutdown-all c) -> nothing happens.. (close-output-port p) -> prints "closing\n" From tom at zwizwa.be Tue Jul 1 18:36:02 2008 From: tom at zwizwa.be (Tom Schouten) Date: Thu Mar 26 02:22:04 2009 Subject: [plt-scheme] custodian + process/ports In-Reply-To: <18538.37872.291574.957135@arabic.ccs.neu.edu> References: <20080701143646.GC24437@zzz.i> <486A4F66.1020103@cs.utah.edu> <20080701192612.GA3424@zzz.i> <486A88FA.10009@cs.utah.edu> <20080701201903.GA6591@zzz.i> <18538.37872.291574.957135@arabic.ccs.neu.edu> Message-ID: <20080701223602.GC6591@zzz.i> > * `subprocess' requires "stream" ports for stdin/out/err, or #f that > returns a pipe that you need to feed or consume; `process' abstracts > all that for you and simply uses the current scheme ports (making up > the pipes and feeding threads when needed) > Thanks. Very helpful. Maybe this paragraph can end up in the manual? From eli at barzilay.org Tue Jul 1 20:58:53 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:04 2009 Subject: [plt-scheme] custodian + process/ports In-Reply-To: <20080701223602.GC6591@zzz.i> References: <20080701143646.GC24437@zzz.i> <486A4F66.1020103@cs.utah.edu> <20080701192612.GA3424@zzz.i> <486A88FA.10009@cs.utah.edu> <20080701201903.GA6591@zzz.i> <18538.37872.291574.957135@arabic.ccs.neu.edu> <20080701223602.GC6591@zzz.i> Message-ID: <18538.53965.975104.78099@arabic.ccs.neu.edu> On Jul 2, Tom Schouten wrote: > > * `subprocess' requires "stream" ports for stdin/out/err, or #f that > > returns a pipe that you need to feed or consume; `process' abstracts > > all that for you and simply uses the current scheme ports (making up > > the pipes and feeding threads when needed) > > Thanks. Very helpful. > Maybe this paragraph can end up in the manual? It's there -- what missing, I think (from several places) is a kind of a high-level overview. Not something like the guides and not like the completely accurate text. Something like a Wikipedia abstract. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From spdegabrielle at gmail.com Wed Jul 2 05:10:11 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:22:05 2009 Subject: [plt-scheme] hash-ref 'manipulating' mutable hash-tables? Message-ID: <595b9ab20807020210r7e9d8200radbfeebab9c3aacf@mail.gmail.com> Hi, "Caveats concerning concurrent modification: A mutable hash table can be manipulated with hash-ref," -- http://docs.plt-scheme.org/reference/hashtables.html Is this right? How does hash-ref change a hash table? (do mutable ht's do some sort of 'query optimisation' that I'm not aware of? if so; does this make them faster but less safe than immutable ht's?) Cheers, Stephen -- Stephen De Gabrielle s.degabrielle@cs.ucl.ac.uk Telephone +44 (0)20 7679 0693 (x30693) Mobile 079 851 890 45 Project: Making Sense of Information (MaSI) Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html Home:http://www.degabrielle.name/stephen UCL Interaction Centre MPEB 8th floor University College London Gower Street London WC1E 6BT From czhu at cs.utah.edu Wed Jul 2 07:28:34 2008 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:22:05 2009 Subject: [plt-scheme] hash-ref 'manipulating' mutable hash-tables? In-Reply-To: <595b9ab20807020210r7e9d8200radbfeebab9c3aacf@mail.gmail.com> References: <595b9ab20807020210r7e9d8200radbfeebab9c3aacf@mail.gmail.com> Message-ID: <486B6662.3070806@cs.utah.edu> Please read the full sentence. Chongkai Stephen De Gabrielle wrote: > Hi, > > "Caveats concerning concurrent modification: A mutable hash table can > be manipulated with hash-ref," > -- http://docs.plt-scheme.org/reference/hashtables.html > > Is this right? How does hash-ref change a hash table? (do mutable > ht's do some sort of 'query optimisation' that I'm not aware of? if > so; does this make them faster but less safe than immutable ht's?) > > > Cheers, > > Stephen > > From tom at zwizwa.be Wed Jul 2 07:51:27 2008 From: tom at zwizwa.be (Tom Schouten) Date: Thu Mar 26 02:22:05 2009 Subject: [plt-scheme] custodian + process/ports In-Reply-To: <18538.37872.291574.957135@arabic.ccs.neu.edu> References: <20080701143646.GC24437@zzz.i> <486A4F66.1020103@cs.utah.edu> <20080701192612.GA3424@zzz.i> <486A88FA.10009@cs.utah.edu> <20080701201903.GA6591@zzz.i> <18538.37872.291574.957135@arabic.ccs.neu.edu> Message-ID: <20080702115127.GA17577@zzz.i> > My guess would be that the subprocess object gets released, but the > process is still alive, which leads to the zombie. (The main problem > being that custodians manage memory & ports, but not processes.) > I tried a double fork workaround, which seems to work. The process terminates when its stdin is closed, but doesn't become a zombie because it is a child of init due to the death of its parent. This is probably easier to do with the FFI so no external process is necessary. (define (open-output-process . cmdline) (define devnull (open-output-file "/dev/null" #:exists 'append)) (let-values (((proc stdout stdin stderr) (apply subprocess devnull #f devnull "/usr/local/bin/dfork" cmdline))) (subprocess-wait proc) stdin)) // dfork.c: #include int main (int argc, char **argv) { int pid = fork(); if (!pid) { argc--; argv++; char *a[argc]; int i; for (i=0; i References: <595b9ab20807020210r7e9d8200radbfeebab9c3aacf@mail.gmail.com> Message-ID: <20080702115740.1C93D6500B9@mail-svr1.cs.utah.edu> At Wed, 2 Jul 2008 10:10:11 +0100, "Stephen De Gabrielle" wrote: > "Caveats concerning concurrent modification: A mutable hash table can > be manipulated with hash-ref," > -- http://docs.plt-scheme.org/reference/hashtables.html > > Is this right? How does hash-ref change a hash table? (do mutable > ht's do some sort of 'query optimisation' that I'm not aware of? if > so; does this make them faster but less safe than immutable ht's?) No, `hash-ref' doesn't mutate the table, at least not in the current implementation. With respect to `hash-ref', that paragraph is meant just to point out that reading via `hash-ref' uses a lock, so that it's thread-safe (though not kill-safe) when other threads might mutate the table. Matthew From DekuDekuplex at Yahoo.com Wed Jul 2 08:42:32 2008 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Thu Mar 26 02:22:05 2009 Subject: [plt-scheme] possible discrepancy between documentation and actual usage of Typed Scheme Message-ID: According to the screen featured on the "Typed Scheme" homepage (http://www.ccs.neu.edu/home/samth/typed-scheme/), it should be possible to select "Typed Scheme" as a language so that it comes up listed as "Language: Typed Scheme" in the interactions panel of DrScheme, version 4.0.1, english. However, when I actually go to the "Language -> Choose Language..." menu item, it is not listed in the language list, and apparently is only available in the "Module" language if, as according to the Web page "Typed Scheme: Scheme with Static Types" (http://docs.plt-scheme.org/typed-scheme/index.html), I type: #lang typed-scheme in the definitions panel. Further, if I choose language "Module" and then type: (require typed-scheme) in the interactions panel, DrScheme returns the following error message: > Module Language: There must be a module in the > definitions window. Try starting your program with > > #lang scheme > > and clicking $B!F(BRun$B!G(B. I would like to choose "Typed Scheme" as a language without having to define a module, similarly to with the other languages listed. Further, I plan to use Typed Scheme increasingly in the future, and would appreciate a straightforward, easy way of choosing Typed Scheme as a default language without having to type: #lang typed-scheme in the definitions panel every time. Is there any way to do this? Are there any plans to list "Typed Scheme" as a language, similar to the other languages, in the "Choose Language" dialog box in the near future? -- Benjamin L. Russell From samth at ccs.neu.edu Wed Jul 2 09:05:11 2008 From: samth at ccs.neu.edu (Sam TH) Date: Thu Mar 26 02:22:05 2009 Subject: [plt-scheme] possible discrepancy between documentation and actual usage of Typed Scheme In-Reply-To: References: Message-ID: <63bb19ae0807020605x10cedc24kf1fff6e22d52a163@mail.gmail.com> First, I apologize for the outdated screenshots, which I will fix very soon. Second, there is no longer (since version 4) a 'Typed Scheme' language level, selectable in the Language menu of DrScheme. This is part of a general shift in the project away from specifying such things in the IDE, and instead making them part of the program itself. This has a number of advantages: 1. Other tools can understand and process the code (such as the command-line bytecode compiler). 2. You can have projects which use multiple languages 3. The semantics of PLT Scheme inside modules is fundamentally saner than the interactive top-level. For all of these reasons, and more, we strongly encourage you to write all of your PLT Scheme programs, including Typed Scheme ones, in modules. One of the reasons for the creation of `#lang' is to make this easier. Especially if you plan to use Typed Scheme more in the future, modules are the only way to go. Thanks, sam th 2008/7/2 Benjamin L. Russell : > According to the screen featured on the "Typed Scheme" homepage > (http://www.ccs.neu.edu/home/samth/typed-scheme/), it should be > possible to select "Typed Scheme" as a language so that it comes up > listed as "Language: Typed Scheme" in the interactions panel of > DrScheme, version 4.0.1, english. > > However, when I actually go to the "Language -> Choose Language..." > menu item, it is not listed in the language list, and apparently is > only available in the "Module" language if, as according to the Web > page "Typed Scheme: Scheme with Static Types" > (http://docs.plt-scheme.org/typed-scheme/index.html), I type: > > #lang typed-scheme > > in the definitions panel. > > Further, if I choose language "Module" and then type: > > (require typed-scheme) > > in the interactions panel, DrScheme returns the following error > message: > >> Module Language: There must be a module in the >> definitions window. Try starting your program with >> >> #lang scheme >> >> and clicking 'Run'. > > I would like to choose "Typed Scheme" as a language without having to > define a module, similarly to with the other languages listed. > Further, I plan to use Typed Scheme increasingly in the future, and > would appreciate a straightforward, easy way of choosing Typed Scheme > as a default language without having to type: > > #lang typed-scheme > > in the definitions panel every time. > > Is there any way to do this? > > Are there any plans to list "Typed Scheme" as a language, similar to > the other languages, in the "Choose Language" dialog box in the near > future? > > -- Benjamin L. Russell > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- sam th samth@ccs.neu.edu From robert.matovinovic at web.de Wed Jul 2 09:12:58 2008 From: robert.matovinovic at web.de (Robert Matovinovic) Date: Thu Mar 26 02:22:07 2009 Subject: AW: [plt-scheme] word completion for module based languages In-Reply-To: <932b2f1f0807011340k31e07c7fmf6abd43ff938d4f1@mail.gmail.com> Message-ID: <13600701C35D4F2E997962ED1F878AC7@IBMI> Hi, I stripped my files as much as possible to give you an insight in some specifics on one hand and keep them short on the other. You get three files info.ss: Just normal info file for compiling the collection mytest-plk-elk.ss: Stripped file with language definitions, it has a dummy command (mytest-command args) with arbitrary number of args and prints them in a list mytest-tool.ss: Tools file where somehow the error/s are in, writing it I took the frtime-tool.ss as kind of template. For testing you can put them into a folder and compile. If you have any further questions, just mail. I don't include any scribble files because I know that all commands are shown in PrettyBig, so it is not them. Concerning debugging I know now that it has something to do with my execute-callback. This I took from the original DrScheme callback in drscheme/private/unit.ss and tailored it to my needs. I omitted what didn't seem necessary, but I have thrown out an important part obviously. This was mainly because I always got the error messages as I get them now like mytest-tool.ss:60:16: expand: unbound variable in module in: drscheme:language-configuration/internal:get-all-manual-keywords I commented out the part that caused the error message. The execute-callback mainly does two things apart from the original: 1. It can capture a selection of definitions-text for only evaluating that selection instead of the whole definitions window. 2. It wraps the definitions-text with commands for making a dde connection to the external program before evaluation. I substituted them just with print commands. Thanks for your time spending Robert -----Urspr?ngliche Nachricht----- Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] Im Auftrag von Robby Findler Gesendet: Dienstag, 1. Juli 2008 22:40 An: Robert Matovinovic Betreff: Re: [plt-scheme] word completion for module based languages Sleep well. :) On Tue, Jul 1, 2008 at 3:41 PM, Robert Matovinovic wrote: > Thank you very much for your offer. I will send you some small files > that should do it, but not before tomorrow, it's 22:45 here. Robert > > -----Urspr?ngliche Nachricht----- > Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] Im > Auftrag von Robby Findler > Gesendet: Dienstag, 1. Juli 2008 18:18 > An: Robert Matovinovic > Cc: plt-scheme@list.cs.brown.edu > Betreff: Re: [plt-scheme] word completion for module based languages > > > Hm. I think you're right, which means that its hard for me to tell > what is going wrong without some more details. If you have the time, > would you mind sending me a cut down version of your tool that > illustrates the problem, but hopefully is just a couple of small > files? > > (Probably there is a bug...) > > Thanks, > Robby > > On Tue, Jul 1, 2008 at 11:15 AM, Robert Matovinovic > wrote: >> as I already mentioned in the last mail, which unfortunately wasn't >> sent to the list, my language is not augmenting the capability-value >> method. I read docs, looked in the source, tried different things, >> the whole day but didn't come to a solution. Concerning the >> capability-value example below I must make a stupid mistake, because >> whereever I put it in my code I get >> >> expand: unbound variable in module in: >> drscheme:language-configuration/internal:get-all-manual-keywords >> >> Well, I looked up in private/drsig.ss that get-all-manual-keywords is >> a method of drscheme:language-configuration/internal since I thought >> this might be the mistake because >> drscheme:language-configuration:get-all-manual-keywords brought up >> the respective mistake. So what I'm doing wrong? >> >> On the other hand I found that 'drscheme:autocomplete-words is #t. >> Also it seems to me get-all-manual-keywords is the default for >> 'drscheme:autocomplete-words is #t. So it should just work without >> augmenting capability-value. Is that true? In my language "no >> completions available .." is the only thing I see. >> >> 'gui-debugger:debug-button is also #t. I defined the method >> debugger:supported? in the >> drscheme:language:module-based-language->language-mixin of my >> language. The button is there and clickable not depending on my >> debugger:supported? method. But after clicking the debugger panels >> don't show up although in the background something happens. If I want >> to debug (+ 1 2) after some time the interaction window opens and >> displays the result. The debugger:supported? method seems also to be >> set to #t by default. But something suppresses the debugging. >> >> Any help appreciated. >> Robert >> >> >> >> -----Urspr?ngliche Nachricht----- >> Von: plt-scheme-bounces@list.cs.brown.edu >> [mailto:plt-scheme-bounces@list.cs.brown.edu] Im Auftrag von Robby >> Findler >> Gesendet: Dienstag, 1. Juli 2008 05:02 >> An: Robert Matovinovic >> Cc: plt-scheme@list.cs.brown.edu >> Betreff: Re: [plt-scheme] word completion for module based languages >> >> >> [ Matthew? Greg? A debugger question below. ] >> >> Is your language augmenting the capability-value method? Perhaps you >> need something like this: >> >> (define/augment (capability-value key) >> (cond >> [(eq? key 'drscheme:autocomplete-words) >> (drscheme:language-configuration:get-all-manual-keywords)] >> [else (drscheme:language:get-capability-default key)])) >> >> You might want to check over the docs for >> >> drscheme:language:register-capability >> >> to see if there are other capabilities you want to enable. >> >> For the debugger, it looks like you want to both respond with #t to >> the 'gui-debugger:debug-button capability (add to the above method), >> and define the debugger:supported? method, which should also return >> #t. I'm just inferring that from the source, tho, so Matthew or Greg >> may know better. >> >> Robby >> >> On Sat, Jun 28, 2008 at 2:20 AM, Robert Matovinovic >> wrote: >>> Yes, the language is in the language dialog and defined as module >>> with "(module ..." and uses >>> drscheme:language-configuration:add-language >>> and drscheme:get/extend:extend-unit-frame. I will look at "#lang >>> ...". So far I only know that one can use it as an abbreviation for >>> module. >>> >>> Robert >>> >>> -----Urspr?ngliche Nachricht----- >>> Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] Im >>> Auftrag von Robby Findler >>> Gesendet: Freitag, 27. Juni 2008 22:16 >>> An: Robert Matovinovic >>> Cc: plt-scheme@list.cs.brown.edu >>> Betreff: Re: [plt-scheme] word completion for module based languages >>> >>> >>> On Fri, Jun 27, 2008 at 2:47 PM, Robert Matovinovic >>> wrote: >>>> Finally I could test what you have checked in, Robby. Word >>>> completion now shows also all commands of my module language in >>>> version 4.0.1 [3m](Yippieh), thank you very much. But unfortunately >>>> it works only if one of the built-in languages are chosen but not >>>> when I switch to my module language. So something is still missing >>>> which is important to me. Maybe there is something I have to add to >>>> my module. I don't ask for language specific filtering of the word >>>> completion, the whole list would be alright, just that it works >>>> also with a module language. >>> >>> Can you tell me a little more about how you've added the language to >>> DrScheme? Is it in the language dialog? >>> >>> If so, perhaps you might consider defining your language in a way >>> that "#lang ..." works and then using DrScheme's module language. >>> We're trying to migrate that way so that all of the information >>> needed to run the program is in the program's text itself (as >>> opposed to being in the environment). >>> >>>> I also like to use the debugger with my module language, but it >>>> doesn't. Is there an easy fix? >>> >>> I suspect the answer here may be the same as the above, but I'm not >>> sure. >>> >>> Robby >>> >>> >>> >> >> >> > > > -------------- next part -------------- A non-text attachment was scrubbed... Name: info.ss Type: application/octet-stream Size: 731 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080702/441d2744/info.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: mytest-plt-elk.ss Type: application/octet-stream Size: 1795 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080702/441d2744/mytest-plt-elk.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: mytest-tool.ss Type: application/octet-stream Size: 7539 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080702/441d2744/mytest-tool.obj From eli at barzilay.org Wed Jul 2 09:10:00 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:07 2009 Subject: [plt-scheme] possible discrepancy between documentation and actual usage of Typed Scheme In-Reply-To: References: Message-ID: <18539.32296.161277.511705@arabic.ccs.neu.edu> On Jul 2, Benjamin L.Russell wrote: > According to the screen featured on the "Typed Scheme" homepage > (http://www.ccs.neu.edu/home/samth/typed-scheme/), it should be > possible to select "Typed Scheme" as a language so that it comes up > listed as "Language: Typed Scheme" in the interactions panel of > DrScheme, version 4.0.1, english. That page is probably outdated. > [...] > Further, if I choose language "Module" and then type: > > (require typed-scheme) > > in the interactions panel, DrScheme returns the following error > message: [...] Yes, the module language is working only with modules; and the easiest way to get that is to start with a `#lang' line. > I would like to choose "Typed Scheme" as a language without having > to define a module, similarly to with the other languages listed. > Further, I plan to use Typed Scheme increasingly in the future, and > would appreciate a straightforward, easy way of choosing Typed > Scheme as a default language without having to type: > > #lang typed-scheme > > in the definitions panel every time. > > Is there any way to do this? As of yesterday there is: if you're in the module language, and you didn't type anything and didn't open an existing file, then you get `#lang scheme' inserted automatically. The text itself is a preference that can be changed on the language configuration panel (form the language dialog hit the "Details" button), so you can just change that to use `typed-scheme' instead. This is committed to svn, but no pre-build with it yet -- hopefully there will be one later today. (There are some technical network issues here...) But note that this is a very new feature, and it's possible that things will change. One possibility is that the text that is inserted will be set in the preference dialog instead of the language dialog. > Are there any plans to list "Typed Scheme" as a language, similar to > the other languages, in the "Choose Language" dialog box in the near > future? The plan is to eventually use #lang lines to specify all languages, which is more robust in many ways. This doesn't mean that the language dialog will go away, but it might work in a different way (like become a `wizard' that lists and inserts a `#lang' line, or maybe have some language insert the #lang in a hidden way -- but that's all speculations...). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From robby at cs.uchicago.edu Wed Jul 2 09:11:23 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:07 2009 Subject: [plt-scheme] word completion for module based languages In-Reply-To: <13600701C35D4F2E997962ED1F878AC7@IBMI> References: <932b2f1f0807011340k31e07c7fmf6abd43ff938d4f1@mail.gmail.com> <13600701C35D4F2E997962ED1F878AC7@IBMI> Message-ID: <932b2f1f0807020611y466f5d1akb70295e5b8882473@mail.gmail.com> On Wed, Jul 2, 2008 at 8:12 AM, Robert Matovinovic wrote: > Hi, > I stripped my files as much as possible to give you an insight in some > specifics on one hand and keep them short on the other. > > You get three files > info.ss: > Just normal info file for compiling the collection > > mytest-plk-elk.ss: > Stripped file with language definitions, it has a dummy command > (mytest-command args) with arbitrary number of args and prints them in a > list > > mytest-tool.ss: > Tools file where somehow the error/s are in, writing it I took the > frtime-tool.ss as kind of template. > > For testing you can put them into a folder and compile. If you have any > further questions, just mail. > > I don't include any scribble files because I know that all commands are > shown in PrettyBig, so it is not them. > > Concerning debugging I know now that it has something to do with my > execute-callback. This I took from the original DrScheme callback in > drscheme/private/unit.ss and tailored it to my needs. I omitted what didn't > seem necessary, but I have thrown out an important part obviously. This was > mainly because I always got the error messages as I get them now like > > mytest-tool.ss:60:16: expand: unbound variable in module in: > drscheme:language-configuration/internal:get-all-manual-keywords > > I commented out the part that caused the error message. The execute-callback > mainly does two things apart from the original: 1. It can capture a > selection of definitions-text for only evaluating that selection instead of > the whole definitions window. 2. It wraps the definitions-text with commands > for making a dde connection to the external program before evaluation. I > substituted them just with print commands. I'll look into the rest as soon as I can, but those changes would probably break internal invariants, yes. (I should probably make the execute-callback be a final method.) Why do you care to evaluate only a selection? As far as the connection goes, that seems like something that you want to do in the on-execute callback of your language instead. That way it won't happen for other languages. Robby > Thanks for your time spending > > Robert > > > > > > -----Urspr?ngliche Nachricht----- > Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] Im Auftrag von > Robby Findler > Gesendet: Dienstag, 1. Juli 2008 22:40 > An: Robert Matovinovic > Betreff: Re: [plt-scheme] word completion for module based languages > > > Sleep well. :) > > On Tue, Jul 1, 2008 at 3:41 PM, Robert Matovinovic > wrote: >> Thank you very much for your offer. I will send you some small files >> that should do it, but not before tomorrow, it's 22:45 here. Robert >> >> -----Urspr?ngliche Nachricht----- >> Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] Im >> Auftrag von Robby Findler >> Gesendet: Dienstag, 1. Juli 2008 18:18 >> An: Robert Matovinovic >> Cc: plt-scheme@list.cs.brown.edu >> Betreff: Re: [plt-scheme] word completion for module based languages >> >> >> Hm. I think you're right, which means that its hard for me to tell >> what is going wrong without some more details. If you have the time, >> would you mind sending me a cut down version of your tool that >> illustrates the problem, but hopefully is just a couple of small >> files? >> >> (Probably there is a bug...) >> >> Thanks, >> Robby >> >> On Tue, Jul 1, 2008 at 11:15 AM, Robert Matovinovic >> wrote: >>> as I already mentioned in the last mail, which unfortunately wasn't >>> sent to the list, my language is not augmenting the capability-value >>> method. I read docs, looked in the source, tried different things, >>> the whole day but didn't come to a solution. Concerning the >>> capability-value example below I must make a stupid mistake, because >>> whereever I put it in my code I get >>> >>> expand: unbound variable in module in: >>> drscheme:language-configuration/internal:get-all-manual-keywords >>> >>> Well, I looked up in private/drsig.ss that get-all-manual-keywords is >>> a method of drscheme:language-configuration/internal since I thought >>> this might be the mistake because >>> drscheme:language-configuration:get-all-manual-keywords brought up >>> the respective mistake. So what I'm doing wrong? >>> >>> On the other hand I found that 'drscheme:autocomplete-words is #t. >>> Also it seems to me get-all-manual-keywords is the default for >>> 'drscheme:autocomplete-words is #t. So it should just work without >>> augmenting capability-value. Is that true? In my language "no >>> completions available .." is the only thing I see. >>> >>> 'gui-debugger:debug-button is also #t. I defined the method >>> debugger:supported? in the >>> drscheme:language:module-based-language->language-mixin of my >>> language. The button is there and clickable not depending on my >>> debugger:supported? method. But after clicking the debugger panels >>> don't show up although in the background something happens. If I want >>> to debug (+ 1 2) after some time the interaction window opens and >>> displays the result. The debugger:supported? method seems also to be >>> set to #t by default. But something suppresses the debugging. >>> >>> Any help appreciated. >>> Robert >>> >>> >>> >>> -----Urspr?ngliche Nachricht----- >>> Von: plt-scheme-bounces@list.cs.brown.edu >>> [mailto:plt-scheme-bounces@list.cs.brown.edu] Im Auftrag von Robby >>> Findler >>> Gesendet: Dienstag, 1. Juli 2008 05:02 >>> An: Robert Matovinovic >>> Cc: plt-scheme@list.cs.brown.edu >>> Betreff: Re: [plt-scheme] word completion for module based languages >>> >>> >>> [ Matthew? Greg? A debugger question below. ] >>> >>> Is your language augmenting the capability-value method? Perhaps you >>> need something like this: >>> >>> (define/augment (capability-value key) >>> (cond >>> [(eq? key 'drscheme:autocomplete-words) >>> (drscheme:language-configuration:get-all-manual-keywords)] >>> [else (drscheme:language:get-capability-default key)])) >>> >>> You might want to check over the docs for >>> >>> drscheme:language:register-capability >>> >>> to see if there are other capabilities you want to enable. >>> >>> For the debugger, it looks like you want to both respond with #t to >>> the 'gui-debugger:debug-button capability (add to the above method), >>> and define the debugger:supported? method, which should also return >>> #t. I'm just inferring that from the source, tho, so Matthew or Greg >>> may know better. >>> >>> Robby >>> >>> On Sat, Jun 28, 2008 at 2:20 AM, Robert Matovinovic >>> wrote: >>>> Yes, the language is in the language dialog and defined as module >>>> with "(module ..." and uses >>>> drscheme:language-configuration:add-language >>>> and drscheme:get/extend:extend-unit-frame. I will look at "#lang >>>> ...". So far I only know that one can use it as an abbreviation for >>>> module. >>>> >>>> Robert >>>> >>>> -----Urspr?ngliche Nachricht----- >>>> Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] Im >>>> Auftrag von Robby Findler >>>> Gesendet: Freitag, 27. Juni 2008 22:16 >>>> An: Robert Matovinovic >>>> Cc: plt-scheme@list.cs.brown.edu >>>> Betreff: Re: [plt-scheme] word completion for module based languages >>>> >>>> >>>> On Fri, Jun 27, 2008 at 2:47 PM, Robert Matovinovic >>>> wrote: >>>>> Finally I could test what you have checked in, Robby. Word >>>>> completion now shows also all commands of my module language in >>>>> version 4.0.1 [3m](Yippieh), thank you very much. But unfortunately >>>>> it works only if one of the built-in languages are chosen but not >>>>> when I switch to my module language. So something is still missing >>>>> which is important to me. Maybe there is something I have to add to >>>>> my module. I don't ask for language specific filtering of the word >>>>> completion, the whole list would be alright, just that it works >>>>> also with a module language. >>>> >>>> Can you tell me a little more about how you've added the language to >>>> DrScheme? Is it in the language dialog? >>>> >>>> If so, perhaps you might consider defining your language in a way >>>> that "#lang ..." works and then using DrScheme's module language. >>>> We're trying to migrate that way so that all of the information >>>> needed to run the program is in the program's text itself (as >>>> opposed to being in the environment). >>>> >>>>> I also like to use the debugger with my module language, but it >>>>> doesn't. Is there an easy fix? >>>> >>>> I suspect the answer here may be the same as the above, but I'm not >>>> sure. >>>> >>>> Robby >>>> >>>> >>>> >>> >>> >>> >> >> >> > From robert.matovinovic at web.de Wed Jul 2 09:35:15 2008 From: robert.matovinovic at web.de (Robert Matovinovic) Date: Thu Mar 26 02:22:07 2009 Subject: AW: [plt-scheme] word completion for module based languages In-Reply-To: <932b2f1f0807020611y466f5d1akb70295e5b8882473@mail.gmail.com> Message-ID: <4BE09A6737A74BD3BFFF39B9D9FD5463@IBMI> >Why do you care to evaluate only a selection? Well, it is something people using the current editor for the simulation software got used to. So I want to make transition as convenient as possible. >As far as the connection goes, that seems like something that you want to do in the on-execute callback of your language instead. That way it won't happen for other languages. As far as I understand on-execute it wouldn't give me the possibility to close down the connection after execution, which I like to do for stability of communication. Robert -----Urspr?ngliche Nachricht----- Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] Im Auftrag von Robby Findler Gesendet: Mittwoch, 2. Juli 2008 15:11 An: Robert Matovinovic Cc: plt-scheme@list.cs.brown.edu Betreff: Re: [plt-scheme] word completion for module based languages On Wed, Jul 2, 2008 at 8:12 AM, Robert Matovinovic wrote: > Hi, > I stripped my files as much as possible to give you an insight in some > specifics on one hand and keep them short on the other. > > You get three files > info.ss: > Just normal info file for compiling the collection > > mytest-plk-elk.ss: > Stripped file with language definitions, it has a dummy command > (mytest-command args) with arbitrary number of args and prints them in > a list > > mytest-tool.ss: > Tools file where somehow the error/s are in, writing it I took the > frtime-tool.ss as kind of template. > > For testing you can put them into a folder and compile. If you have > any further questions, just mail. > > I don't include any scribble files because I know that all commands > are shown in PrettyBig, so it is not them. > > Concerning debugging I know now that it has something to do with my > execute-callback. This I took from the original DrScheme callback in > drscheme/private/unit.ss and tailored it to my needs. I omitted what > didn't seem necessary, but I have thrown out an important part > obviously. This was mainly because I always got the error messages as > I get them now like > > mytest-tool.ss:60:16: expand: unbound variable in module in: > drscheme:language-configuration/internal:get-all-manual-keywords > > I commented out the part that caused the error message. The > execute-callback mainly does two things apart from the original: 1. It > can capture a selection of definitions-text for only evaluating that > selection instead of the whole definitions window. 2. It wraps the > definitions-text with commands for making a dde connection to the > external program before evaluation. I substituted them just with print > commands. I'll look into the rest as soon as I can, but those changes would probably break internal invariants, yes. (I should probably make the execute-callback be a final method.) Why do you care to evaluate only a selection? As far as the connection goes, that seems like something that you want to do in the on-execute callback of your language instead. That way it won't happen for other languages. Robby > Thanks for your time spending > > Robert > > > > > > -----Urspr?ngliche Nachricht----- > Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] Im > Auftrag von Robby Findler > Gesendet: Dienstag, 1. Juli 2008 22:40 > An: Robert Matovinovic > Betreff: Re: [plt-scheme] word completion for module based languages > > > Sleep well. :) > > On Tue, Jul 1, 2008 at 3:41 PM, Robert Matovinovic > wrote: >> Thank you very much for your offer. I will send you some small files >> that should do it, but not before tomorrow, it's 22:45 here. Robert >> >> -----Urspr?ngliche Nachricht----- >> Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] Im >> Auftrag von Robby Findler >> Gesendet: Dienstag, 1. Juli 2008 18:18 >> An: Robert Matovinovic >> Cc: plt-scheme@list.cs.brown.edu >> Betreff: Re: [plt-scheme] word completion for module based languages >> >> >> Hm. I think you're right, which means that its hard for me to tell >> what is going wrong without some more details. If you have the time, >> would you mind sending me a cut down version of your tool that >> illustrates the problem, but hopefully is just a couple of small >> files? >> >> (Probably there is a bug...) >> >> Thanks, >> Robby >> >> On Tue, Jul 1, 2008 at 11:15 AM, Robert Matovinovic >> wrote: >>> as I already mentioned in the last mail, which unfortunately wasn't >>> sent to the list, my language is not augmenting the capability-value >>> method. I read docs, looked in the source, tried different things, >>> the whole day but didn't come to a solution. Concerning the >>> capability-value example below I must make a stupid mistake, because >>> whereever I put it in my code I get >>> >>> expand: unbound variable in module in: >>> drscheme:language-configuration/internal:get-all-manual-keywords >>> >>> Well, I looked up in private/drsig.ss that get-all-manual-keywords >>> is a method of drscheme:language-configuration/internal since I >>> thought this might be the mistake because >>> drscheme:language-configuration:get-all-manual-keywords brought up >>> the respective mistake. So what I'm doing wrong? >>> >>> On the other hand I found that 'drscheme:autocomplete-words is #t. >>> Also it seems to me get-all-manual-keywords is the default for >>> 'drscheme:autocomplete-words is #t. So it should just work without >>> augmenting capability-value. Is that true? In my language "no >>> completions available .." is the only thing I see. >>> >>> 'gui-debugger:debug-button is also #t. I defined the method >>> debugger:supported? in the >>> drscheme:language:module-based-language->language-mixin of my >>> language. The button is there and clickable not depending on my >>> debugger:supported? method. But after clicking the debugger panels >>> don't show up although in the background something happens. If I >>> want to debug (+ 1 2) after some time the interaction window opens >>> and displays the result. The debugger:supported? method seems also >>> to be set to #t by default. But something suppresses the debugging. >>> >>> Any help appreciated. >>> Robert >>> >>> >>> >>> -----Urspr?ngliche Nachricht----- >>> Von: plt-scheme-bounces@list.cs.brown.edu >>> [mailto:plt-scheme-bounces@list.cs.brown.edu] Im Auftrag von Robby >>> Findler >>> Gesendet: Dienstag, 1. Juli 2008 05:02 >>> An: Robert Matovinovic >>> Cc: plt-scheme@list.cs.brown.edu >>> Betreff: Re: [plt-scheme] word completion for module based languages >>> >>> >>> [ Matthew? Greg? A debugger question below. ] >>> >>> Is your language augmenting the capability-value method? Perhaps you >>> need something like this: >>> >>> (define/augment (capability-value key) >>> (cond >>> [(eq? key 'drscheme:autocomplete-words) >>> (drscheme:language-configuration:get-all-manual-keywords)] >>> [else (drscheme:language:get-capability-default key)])) >>> >>> You might want to check over the docs for >>> >>> drscheme:language:register-capability >>> >>> to see if there are other capabilities you want to enable. >>> >>> For the debugger, it looks like you want to both respond with #t to >>> the 'gui-debugger:debug-button capability (add to the above method), >>> and define the debugger:supported? method, which should also return >>> #t. I'm just inferring that from the source, tho, so Matthew or Greg >>> may know better. >>> >>> Robby >>> >>> On Sat, Jun 28, 2008 at 2:20 AM, Robert Matovinovic >>> wrote: >>>> Yes, the language is in the language dialog and defined as module >>>> with "(module ..." and uses >>>> drscheme:language-configuration:add-language >>>> and drscheme:get/extend:extend-unit-frame. I will look at "#lang >>>> ...". So far I only know that one can use it as an abbreviation for >>>> module. >>>> >>>> Robert >>>> >>>> -----Urspr?ngliche Nachricht----- >>>> Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] Im >>>> Auftrag von Robby Findler >>>> Gesendet: Freitag, 27. Juni 2008 22:16 >>>> An: Robert Matovinovic >>>> Cc: plt-scheme@list.cs.brown.edu >>>> Betreff: Re: [plt-scheme] word completion for module based >>>> languages >>>> >>>> >>>> On Fri, Jun 27, 2008 at 2:47 PM, Robert Matovinovic >>>> wrote: >>>>> Finally I could test what you have checked in, Robby. Word >>>>> completion now shows also all commands of my module language in >>>>> version 4.0.1 [3m](Yippieh), thank you very much. But >>>>> unfortunately it works only if one of the built-in languages are >>>>> chosen but not when I switch to my module language. So something >>>>> is still missing which is important to me. Maybe there is >>>>> something I have to add to my module. I don't ask for language >>>>> specific filtering of the word completion, the whole list would be >>>>> alright, just that it works also with a module language. >>>> >>>> Can you tell me a little more about how you've added the language >>>> to DrScheme? Is it in the language dialog? >>>> >>>> If so, perhaps you might consider defining your language in a way >>>> that "#lang ..." works and then using DrScheme's module language. >>>> We're trying to migrate that way so that all of the information >>>> needed to run the program is in the program's text itself (as >>>> opposed to being in the environment). >>>> >>>>> I also like to use the debugger with my module language, but it >>>>> doesn't. Is there an easy fix? >>>> >>>> I suspect the answer here may be the same as the above, but I'm not >>>> sure. >>>> >>>> Robby >>>> >>>> >>>> >>> >>> >>> >> >> >> > From robby at cs.uchicago.edu Wed Jul 2 09:48:11 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:07 2009 Subject: [plt-scheme] word completion for module based languages In-Reply-To: <4BE09A6737A74BD3BFFF39B9D9FD5463@IBMI> References: <932b2f1f0807020611y466f5d1akb70295e5b8882473@mail.gmail.com> <4BE09A6737A74BD3BFFF39B9D9FD5463@IBMI> Message-ID: <932b2f1f0807020648h1c432d72o33f4f61adc48d63c@mail.gmail.com> On Wed, Jul 2, 2008 at 8:35 AM, Robert Matovinovic wrote: >>Why do you care to evaluate only a selection? > > Well, it is something people using the current editor for the simulation > software got used to. So I want to make transition as convenient as > possible. Did you consider making that connection custodian sensitive? I think we briefly discussed this earlier (and that's not my area of expertise) but it sounds like something to revisit. >>As far as the connection goes, that seems like something that you want to > do in the on-execute callback of your language instead. That way it won't > happen for other languages. > > As far as I understand on-execute it wouldn't give me the possibility to > close down the connection after execution, which I like to do for stability > of communication. Does this imply that you do not use the REPL? Robby From spdegabrielle at gmail.com Wed Jul 2 10:08:41 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:22:08 2009 Subject: [plt-scheme] hash-ref 'manipulating' mutable hash-tables? In-Reply-To: <20080702115740.1C93D6500B9@mail-svr1.cs.utah.edu> References: <595b9ab20807020210r7e9d8200radbfeebab9c3aacf@mail.gmail.com> <20080702115740.1C93D6500B9@mail-svr1.cs.utah.edu> Message-ID: <595b9ab20807020708h3b8ffa93o5c62b763afa70acf@mail.gmail.com> Thankyou (all) I was worried about using the following; (define (hash-cons-v ht k v) (hash-set! ht k (cons v (hash-ref ht k null)))) I use this all the time - so much so that I'm surprised I don't see it more - the only place I've found it is in compiler.ss ; (hash-set! ht k (cons r (hash-ref ht k (lambda () null)))) Cheers, Stephen On Wed, Jul 2, 2008 at 12:57 PM, Matthew Flatt wrote: > At Wed, 2 Jul 2008 10:10:11 +0100, "Stephen De Gabrielle" wrote: >> "Caveats concerning concurrent modification: A mutable hash table can >> be manipulated with hash-ref," >> -- http://docs.plt-scheme.org/reference/hashtables.html >> >> Is this right? How does hash-ref change a hash table? (do mutable >> ht's do some sort of 'query optimisation' that I'm not aware of? if >> so; does this make them faster but less safe than immutable ht's?) > > No, `hash-ref' doesn't mutate the table, at least not in the current > implementation. With respect to `hash-ref', that paragraph is meant > just to point out that reading via `hash-ref' uses a lock, so that it's > thread-safe (though not kill-safe) when other threads might mutate the > table. > > Matthew > From robert.matovinovic at web.de Wed Jul 2 10:18:53 2008 From: robert.matovinovic at web.de (Robert Matovinovic) Date: Thu Mar 26 02:22:08 2009 Subject: AW: [plt-scheme] word completion for module based languages In-Reply-To: <932b2f1f0807020648h1c432d72o33f4f61adc48d63c@mail.gmail.com> Message-ID: <5C0DB27794DA4F86AB3C58D41C37FB33@IBMI> -----Urspr?ngliche Nachricht----- Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] Im Auftrag von Robby Findler Gesendet: Mittwoch, 2. Juli 2008 15:48 An: Robert Matovinovic Cc: plt-scheme@list.cs.brown.edu Betreff: Re: [plt-scheme] word completion for module based languages On Wed, Jul 2, 2008 at 8:35 AM, Robert Matovinovic wrote: >>>Why do you care to evaluate only a selection? >> >> Well, it is something people using the current editor for the >> simulation software got used to. So I want to make transition as >> convenient as possible. >Did you consider making that connection custodian sensitive? I think we briefly discussed this earlier (and that's not my >area of >expertise) but it sounds like something to revisit. Yes, I did, and I think it would be a good idea to make it custodian sensitive. But it seemed to complicated to me and so I resorted to override execute-callback since what I wanted to do couldn't be done by augment. I would need a kind of tutorial to do it, and I'm not too familiar with C, which is involved there AFAIK. Besides that I can't compile DrScheme from sources yet. I just started to get things together. >>>As far as the connection goes, that seems like something that you want >>>to >> do in the on-execute callback of your language instead. That way it >> won't happen for other languages. >> >> As far as I understand on-execute it wouldn't give me the possibility >> to close down the connection after execution, which I like to do for >> stability of communication. >Does this imply that you do not use the REPL? I want to use the REPL and have already a solution for that, I think. It is not a problem that a command in the interaction window that needs to be evaluated by the simulation program opens and closes the connection on its own. But doing the same for a bigger program would add an overload of connecting and disconnecting during execution and slows down everything. For debugging, since time isn't that important, I can use that approach too. Robert >Robby From morazanm at gmail.com Wed Jul 2 10:26:50 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:22:08 2009 Subject: [plt-scheme] CFP: IFL 2008 Message-ID: <9b1fff280807020726v339790e2t154499b1a5888fd0@mail.gmail.com> Dear All, IFL welcomes Schemers! See the CFP below and http://events.sac-home.org/ifl2008/ . Cheers, Marco Call for Papers The aim of the IFL symposia is to bring together researchers actively engaged in the implementation and application of functional and function-based programming languages. They provide an open forum for researchers who wish to present and discuss new ideas and concepts, work in progress, preliminary results, etc. related primarily but not exclusively to the implementation and application of functional languages. Formal proceedings are produced after the symposium, so that authors can incorporate the feedback from discussions at the symposium in their published papers. Topics Topics of interest include, but are not limited to: language concepts type checking compilation techniques (abstract) interpretation generic programming techniques automatic program generation array processing concurrent/parallel programming concurrent/parallel program execution functional programming on embedded systems functional programming on multi-cores/ many-cores heap management runtime profiling performance measurements debugging and tracing (abstract) machine architectures verification formal aspects tools and programming techniques Papers on applications or tools demonstrating the suitability of novel ideas in any of the above areas and contributions on related theoretical work are also welcomed. The change of the symposium name adding the term "application", introduced in 2004, is to reflect the broader scope IFL has gained over the years. Paper Submissions Prospective authors are encouraged to submit papers to be published in the draft proceedings and to present them at the symposium. All contributions must be written in English, conform to the Springer-Verlag LNCS series format and not exceed 16 pages. The draft proceedings will appear as a Technical Report of the School of Computer Science of the University of Hertfordshire. Attendees of IFL 2008 will have the opportunity to submit a revised version of their paper for post-symposium reviewing. As in previous years, we hope that selected papers will be published by Springer Verlag in the Lecture Notes in Computer Science (LNCS) Series. The Peter Landin Prize Since 2002 every year the Peter Landin Prize of ?150 is awarded to the best paper presented at the symposium, as selected by the program committee. From noelwelsh at gmail.com Wed Jul 2 10:27:12 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:22:08 2009 Subject: [plt-scheme] A first experiment with HTDP In-Reply-To: <486AA5CD.8040904@cs.caltech.edu> References: <756daca50807011121j60a97cafoeb8b964e47349e5c@mail.gmail.com> <001901c8dbb5$53fef340$2101a8c0@uw2b2dff239c4d> <9b1fff280807011346r5bbe5407vbe2c8dcd050bfc40@mail.gmail.com> <24FC19FA-AA5D-4D17-AAE4-AEDCC23CB417@ccs.neu.edu> <486AA5CD.8040904@cs.caltech.edu> Message-ID: On Tue, Jul 1, 2008 at 10:46 PM, Michael Vanier wrote: > I recently talked to a programmer who said that even using _python_ on > commercial projects makes a lot of people (= investors and managers) very > nervous. They want programs to be written in a language like java where > programmers are essentially just replaceable and disposable cogs in a giant > machine. The notion that a good programmer can do the work of ten bad ones > seems to be lost on these people. Of course, you have to treat the good > programmer well so he won't leave, and maybe that's the problem. This attitude certainly holds, but only in part of the marketplace (the very risk adverse part). That's ok because, if a language is ever to gain commercial traction, these people will be the last adopt it. So, basically, what they think is irrelevant. It's the startups and others who are more accepting of risk that you want to get on your side. N. From grettke at acm.org Wed Jul 2 14:33:51 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:22:09 2009 Subject: [plt-scheme] A first experiment with HTDP In-Reply-To: <7BD9B01D-1B1C-487D-B429-5821C286F1D8@ccs.neu.edu> References: <756daca50807011121j60a97cafoeb8b964e47349e5c@mail.gmail.com> <7BD9B01D-1B1C-487D-B429-5821C286F1D8@ccs.neu.edu> Message-ID: <756daca50807021133k6d8841cfr82bf144899712854@mail.gmail.com> On Tue, Jul 1, 2008 at 1:35 PM, Matthias Felleisen wrote: >> I want perform the first experiment in company training by working >> through HTDP start to finish with two or three freshers. We will have >> voice-meetings twice a week (along with email and instant messages). > > Do you mean face-to-face meetings? These would be teleconferences. I am thinking 1 to 1.5 hours for each meeting. > Good luck -- Matthias Thanks :) From grettke at acm.org Wed Jul 2 15:07:07 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:22:09 2009 Subject: [plt-scheme] A first experiment with HTDP In-Reply-To: <001901c8dbb5$53fef340$2101a8c0@uw2b2dff239c4d> References: <756daca50807011121j60a97cafoeb8b964e47349e5c@mail.gmail.com> <001901c8dbb5$53fef340$2101a8c0@uw2b2dff239c4d> Message-ID: <756daca50807021207m69a0fa81tabdc0a5edd54649@mail.gmail.com> On Tue, Jul 1, 2008 at 3:02 PM, Jos Koot wrote: > The idea that companies take their own responsability of training their > employees sounds good. It is important to distinguish between the different types of training the companies often provide. The two most common kinds of training that I see are: 1) Long term training for a technology used by the company. For example, a custom programming language used only by that oil company. 2) Highly compressed training for a generic technology that can be used just about anywhere. For example, large consulting companies tend to hire folks with 4-year degrees, send them to a 3 week course on Java, and start billing them out immediately following that. In both cases, they primarily serve the long-term interests of the employer and not the programmer (I've got nothing against companies making money, just making a clarification here, and in the long run both approaches won't serve the employer very well, either). I am interested in neither 1 nor 2, instead I think about the questions we face like "How do you teach someone to be "good"?", how do you teach someone the skills that will serve both them, and their employer, for years and years to come? How do you teach someone to be a critical thinker and problem solver? How do you help someone hone the skills that they will need 1 week from now and 10 years from now? How do you literally teach someone "How To Design Programs"? > There should be a golden path between the principal goals of eductation and the more practicle ones. Is there? Learning how to program, and how to program in Java, are not mutually exclusive. The other question to ask is that if only %5 of programmers get the skills that both they and their employers need from general education, than what is to be done about the other %95 of programmers who lack those skills? From jessealdridge at gmail.com Wed Jul 2 15:57:57 2008 From: jessealdridge at gmail.com (Jesse Aldridge) Date: Thu Mar 26 02:22:09 2009 Subject: [plt-scheme] problem with browser module In-Reply-To: <75b50d05-b002-4e9a-86ee-54d51e7f6f06@34g2000hsf.googlegroups.com> References: <75b50d05-b002-4e9a-86ee-54d51e7f6f06@34g2000hsf.googlegroups.com> Message-ID: So nobody knows? Seems like this should be a pretty easy question to answer... On Tue, Jul 1, 2008 at 1:08 AM, Jesse Aldridge wrote: > When I run this: > > #lang scheme > (require browser) > > I get this error: > > m: argument does not implement #<|interface:hyper-frame<%>|>: > # > > What does the error mean? Is the browser module broken? I'm > completely new to Scheme, so I don't understand what's going on here. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080702/f8cce371/attachment.htm From robby at cs.uchicago.edu Wed Jul 2 16:00:22 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:10 2009 Subject: [plt-scheme] problem with browser module In-Reply-To: References: <75b50d05-b002-4e9a-86ee-54d51e7f6f06@34g2000hsf.googlegroups.com> Message-ID: <932b2f1f0807021300wb9f9657ta8fce156da0702d2@mail.gmail.com> Sorry -- likely a bug. Robby On Wed, Jul 2, 2008 at 2:57 PM, Jesse Aldridge wrote: > So nobody knows? Seems like this should be a pretty easy question to > answer... > > On Tue, Jul 1, 2008 at 1:08 AM, Jesse Aldridge > wrote: >> >> When I run this: >> >> #lang scheme >> (require browser) >> >> I get this error: >> >> m: argument does not implement #<|interface:hyper-frame<%>|>: >> # >> >> What does the error mean? Is the browser module broken? I'm >> completely new to Scheme, so I don't understand what's going on here. >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From robby at cs.uchicago.edu Wed Jul 2 16:01:36 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:10 2009 Subject: [plt-scheme] hash-ref 'manipulating' mutable hash-tables? In-Reply-To: <595b9ab20807020708h3b8ffa93o5c62b763afa70acf@mail.gmail.com> References: <595b9ab20807020210r7e9d8200radbfeebab9c3aacf@mail.gmail.com> <20080702115740.1C93D6500B9@mail-svr1.cs.utah.edu> <595b9ab20807020708h3b8ffa93o5c62b763afa70acf@mail.gmail.com> Message-ID: <932b2f1f0807021301i13639731t13a5a32e9a1f4d0b@mail.gmail.com> I use that all the time myself too, but mostly in scripts. (I usually call it hash-cons!). I also use hash-inc! that defaults to 0 and adds 1 to the binding. Robby On Wed, Jul 2, 2008 at 9:08 AM, Stephen De Gabrielle wrote: > Thankyou (all) > > I was worried about using the following; > > (define (hash-cons-v ht k v) > (hash-set! ht k (cons v (hash-ref ht k null)))) > > I use this all the time - so much so that I'm surprised I don't see it > more - the only place I've found it is in compiler.ss ; (hash-set! > ht k (cons r (hash-ref ht k (lambda () null)))) > > > Cheers, > > Stephen > > > On Wed, Jul 2, 2008 at 12:57 PM, Matthew Flatt wrote: >> At Wed, 2 Jul 2008 10:10:11 +0100, "Stephen De Gabrielle" wrote: >>> "Caveats concerning concurrent modification: A mutable hash table can >>> be manipulated with hash-ref," >>> -- http://docs.plt-scheme.org/reference/hashtables.html >>> >>> Is this right? How does hash-ref change a hash table? (do mutable >>> ht's do some sort of 'query optimisation' that I'm not aware of? if >>> so; does this make them faster but less safe than immutable ht's?) >> >> No, `hash-ref' doesn't mutate the table, at least not in the current >> implementation. With respect to `hash-ref', that paragraph is meant >> just to point out that reading via `hash-ref' uses a lock, so that it's >> thread-safe (though not kill-safe) when other threads might mutate the >> table. >> >> Matthew >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From robby at cs.uchicago.edu Wed Jul 2 16:25:31 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:10 2009 Subject: [plt-scheme] word completion for module based languages In-Reply-To: <13600701C35D4F2E997962ED1F878AC7@IBMI> References: <932b2f1f0807011340k31e07c7fmf6abd43ff938d4f1@mail.gmail.com> <13600701C35D4F2E997962ED1F878AC7@IBMI> Message-ID: <932b2f1f0807021325l36332d49j381f7530355ff32a@mail.gmail.com> Thanks. I'm still hoping one of the debugger guys knows what is going on there, but for autocompletions, you need this method: (define (make-mytest-plt-elk-language base) (class (drscheme:language:module-based-language->language-mixin (drscheme:language:simple-module-based-language->module-based-language-mixin base)) (inherit get-language-position) (define/override (get-language-name) language-name-plt-elk) (define/augment (capability-value key) (cond [(eq? key 'drscheme:autocomplete-words) (get-all-manual-keywords)] [else (drscheme:language:get-capability-default key)])) (define (debugger:supported?) #t) (super-instantiate ()))) with this helper function defined yourself. I didn't export get-all-manual-keywords since it was so short and I wasn't sure that I would be able to support that interface indefinitely. But in any case, it is easy to write it yourself with the current world. (define get-all-manual-keywords (let ([words #f]) (? () (unless words (set! words (text:get-completions/manuals #f))) words))) hth, Robby On Wed, Jul 2, 2008 at 8:12 AM, Robert Matovinovic wrote: > Hi, > I stripped my files as much as possible to give you an insight in some > specifics on one hand and keep them short on the other. > > You get three files > info.ss: > Just normal info file for compiling the collection > > mytest-plk-elk.ss: > Stripped file with language definitions, it has a dummy command > (mytest-command args) with arbitrary number of args and prints them in a > list > > mytest-tool.ss: > Tools file where somehow the error/s are in, writing it I took the > frtime-tool.ss as kind of template. > > For testing you can put them into a folder and compile. If you have any > further questions, just mail. > > I don't include any scribble files because I know that all commands are > shown in PrettyBig, so it is not them. > > Concerning debugging I know now that it has something to do with my > execute-callback. This I took from the original DrScheme callback in > drscheme/private/unit.ss and tailored it to my needs. I omitted what didn't > seem necessary, but I have thrown out an important part obviously. This was > mainly because I always got the error messages as I get them now like > > mytest-tool.ss:60:16: expand: unbound variable in module in: > drscheme:language-configuration/internal:get-all-manual-keywords > > I commented out the part that caused the error message. The execute-callback > mainly does two things apart from the original: 1. It can capture a > selection of definitions-text for only evaluating that selection instead of > the whole definitions window. 2. It wraps the definitions-text with commands > for making a dde connection to the external program before evaluation. I > substituted them just with print commands. > > Thanks for your time spending > > Robert > > > > > > -----Urspr?ngliche Nachricht----- > Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] Im Auftrag von > Robby Findler > Gesendet: Dienstag, 1. Juli 2008 22:40 > An: Robert Matovinovic > Betreff: Re: [plt-scheme] word completion for module based languages > > > Sleep well. :) > > On Tue, Jul 1, 2008 at 3:41 PM, Robert Matovinovic > wrote: >> Thank you very much for your offer. I will send you some small files >> that should do it, but not before tomorrow, it's 22:45 here. Robert >> >> -----Urspr?ngliche Nachricht----- >> Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] Im >> Auftrag von Robby Findler >> Gesendet: Dienstag, 1. Juli 2008 18:18 >> An: Robert Matovinovic >> Cc: plt-scheme@list.cs.brown.edu >> Betreff: Re: [plt-scheme] word completion for module based languages >> >> >> Hm. I think you're right, which means that its hard for me to tell >> what is going wrong without some more details. If you have the time, >> would you mind sending me a cut down version of your tool that >> illustrates the problem, but hopefully is just a couple of small >> files? >> >> (Probably there is a bug...) >> >> Thanks, >> Robby >> >> On Tue, Jul 1, 2008 at 11:15 AM, Robert Matovinovic >> wrote: >>> as I already mentioned in the last mail, which unfortunately wasn't >>> sent to the list, my language is not augmenting the capability-value >>> method. I read docs, looked in the source, tried different things, >>> the whole day but didn't come to a solution. Concerning the >>> capability-value example below I must make a stupid mistake, because >>> whereever I put it in my code I get >>> >>> expand: unbound variable in module in: >>> drscheme:language-configuration/internal:get-all-manual-keywords >>> >>> Well, I looked up in private/drsig.ss that get-all-manual-keywords is >>> a method of drscheme:language-configuration/internal since I thought >>> this might be the mistake because >>> drscheme:language-configuration:get-all-manual-keywords brought up >>> the respective mistake. So what I'm doing wrong? >>> >>> On the other hand I found that 'drscheme:autocomplete-words is #t. >>> Also it seems to me get-all-manual-keywords is the default for >>> 'drscheme:autocomplete-words is #t. So it should just work without >>> augmenting capability-value. Is that true? In my language "no >>> completions available .." is the only thing I see. >>> >>> 'gui-debugger:debug-button is also #t. I defined the method >>> debugger:supported? in the >>> drscheme:language:module-based-language->language-mixin of my >>> language. The button is there and clickable not depending on my >>> debugger:supported? method. But after clicking the debugger panels >>> don't show up although in the background something happens. If I want >>> to debug (+ 1 2) after some time the interaction window opens and >>> displays the result. The debugger:supported? method seems also to be >>> set to #t by default. But something suppresses the debugging. >>> >>> Any help appreciated. >>> Robert >>> >>> >>> >>> -----Urspr?ngliche Nachricht----- >>> Von: plt-scheme-bounces@list.cs.brown.edu >>> [mailto:plt-scheme-bounces@list.cs.brown.edu] Im Auftrag von Robby >>> Findler >>> Gesendet: Dienstag, 1. Juli 2008 05:02 >>> An: Robert Matovinovic >>> Cc: plt-scheme@list.cs.brown.edu >>> Betreff: Re: [plt-scheme] word completion for module based languages >>> >>> >>> [ Matthew? Greg? A debugger question below. ] >>> >>> Is your language augmenting the capability-value method? Perhaps you >>> need something like this: >>> >>> (define/augment (capability-value key) >>> (cond >>> [(eq? key 'drscheme:autocomplete-words) >>> (drscheme:language-configuration:get-all-manual-keywords)] >>> [else (drscheme:language:get-capability-default key)])) >>> >>> You might want to check over the docs for >>> >>> drscheme:language:register-capability >>> >>> to see if there are other capabilities you want to enable. >>> >>> For the debugger, it looks like you want to both respond with #t to >>> the 'gui-debugger:debug-button capability (add to the above method), >>> and define the debugger:supported? method, which should also return >>> #t. I'm just inferring that from the source, tho, so Matthew or Greg >>> may know better. >>> >>> Robby >>> >>> On Sat, Jun 28, 2008 at 2:20 AM, Robert Matovinovic >>> wrote: >>>> Yes, the language is in the language dialog and defined as module >>>> with "(module ..." and uses >>>> drscheme:language-configuration:add-language >>>> and drscheme:get/extend:extend-unit-frame. I will look at "#lang >>>> ...". So far I only know that one can use it as an abbreviation for >>>> module. >>>> >>>> Robert >>>> >>>> -----Urspr?ngliche Nachricht----- >>>> Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] Im >>>> Auftrag von Robby Findler >>>> Gesendet: Freitag, 27. Juni 2008 22:16 >>>> An: Robert Matovinovic >>>> Cc: plt-scheme@list.cs.brown.edu >>>> Betreff: Re: [plt-scheme] word completion for module based languages >>>> >>>> >>>> On Fri, Jun 27, 2008 at 2:47 PM, Robert Matovinovic >>>> wrote: >>>>> Finally I could test what you have checked in, Robby. Word >>>>> completion now shows also all commands of my module language in >>>>> version 4.0.1 [3m](Yippieh), thank you very much. But unfortunately >>>>> it works only if one of the built-in languages are chosen but not >>>>> when I switch to my module language. So something is still missing >>>>> which is important to me. Maybe there is something I have to add to >>>>> my module. I don't ask for language specific filtering of the word >>>>> completion, the whole list would be alright, just that it works >>>>> also with a module language. >>>> >>>> Can you tell me a little more about how you've added the language to >>>> DrScheme? Is it in the language dialog? >>>> >>>> If so, perhaps you might consider defining your language in a way >>>> that "#lang ..." works and then using DrScheme's module language. >>>> We're trying to migrate that way so that all of the information >>>> needed to run the program is in the program's text itself (as >>>> opposed to being in the environment). >>>> >>>>> I also like to use the debugger with my module language, but it >>>>> doesn't. Is there an easy fix? >>>> >>>> I suspect the answer here may be the same as the above, but I'm not >>>> sure. >>>> >>>> Robby >>>> >>>> >>>> >>> >>> >>> >> >> >> > From robby at cs.uchicago.edu Wed Jul 2 16:32:26 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:10 2009 Subject: [plt-scheme] problem with browser module In-Reply-To: <932b2f1f0807021300wb9f9657ta8fce156da0702d2@mail.gmail.com> References: <75b50d05-b002-4e9a-86ee-54d51e7f6f06@34g2000hsf.googlegroups.com> <932b2f1f0807021300wb9f9657ta8fce156da0702d2@mail.gmail.com> Message-ID: <932b2f1f0807021332j6f1d87c5v32f088b9a63b361f@mail.gmail.com> It looks like this wasn't tested after it was ported to v4.0. I've tested it enough to see that it can visit web pages and checked in some fixes to SVN. (But I'm not sure I'd recommend that browser to anyone. It isnt very fancy and I doubt we'll keep maintaining it, now that it isn't being used for our documentation any longer.) Robby On Wed, Jul 2, 2008 at 3:00 PM, Robby Findler wrote: > Sorry -- likely a bug. > > Robby > > On Wed, Jul 2, 2008 at 2:57 PM, Jesse Aldridge wrote: >> So nobody knows? Seems like this should be a pretty easy question to >> answer... >> >> On Tue, Jul 1, 2008 at 1:08 AM, Jesse Aldridge >> wrote: >>> >>> When I run this: >>> >>> #lang scheme >>> (require browser) >>> >>> I get this error: >>> >>> m: argument does not implement #<|interface:hyper-frame<%>|>: >>> # >>> >>> What does the error mean? Is the browser module broken? I'm >>> completely new to Scheme, so I don't understand what's going on here. >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > From jpc-ml at zenburn.net Wed Jul 2 16:32:57 2008 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:22:10 2009 Subject: [plt-scheme] FFI error in 4.0 Message-ID: <486BE5F9.2090106@zenburn.net> define-cpointer-type has not been ported to 4.0 and doesn't work with the new _ handling. #lang scheme/base (require scheme/foreign) #;(define-cpointer-type _test #f #f #f) ; this works (define-cpointer-type _test) ; this doesn't and gives a ; really obscure error message -- regards, Jakub Piotr C?apa From eli at barzilay.org Wed Jul 2 20:51:28 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:11 2009 Subject: [plt-scheme] FFI error in 4.0 In-Reply-To: <486BE5F9.2090106@zenburn.net> References: <486BE5F9.2090106@zenburn.net> Message-ID: <18540.8848.680708.479566@arabic.ccs.neu.edu> On Jul 2, Jakub Piotr C?apa wrote: > define-cpointer-type has not been ported to 4.0 and doesn't work > with the new _ handling. It was ported, but partially... > #lang scheme/base > (require scheme/foreign) > > #;(define-cpointer-type _test #f #f #f) ; this works > (define-cpointer-type _test) ; this doesn't and gives a > ; really obscure error message Why is it obscure? It said exactly what was wrong... -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Wed Jul 2 21:11:48 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:11 2009 Subject: [plt-scheme] FFI error in 4.0 In-Reply-To: <18540.8848.680708.479566@arabic.ccs.neu.edu> References: <486BE5F9.2090106@zenburn.net> <18540.8848.680708.479566@arabic.ccs.neu.edu> Message-ID: <18540.10068.161720.14194@arabic.ccs.neu.edu> On Jul 2, Eli Barzilay wrote: > On Jul 2, Jakub Piotr C?apa wrote: > > define-cpointer-type has not been ported to 4.0 and doesn't work > > with the new _ handling. > > It was ported, but partially... (Forgot to say that it's fixed now.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From derick.eddington at gmail.com Wed Jul 2 21:16:53 2008 From: derick.eddington at gmail.com (Derick Eddington) Date: Thu Mar 26 02:22:11 2009 Subject: [plt-scheme] SXML for R6RS [was: R6RS Interoperability] Message-ID: <1215047813.20284.17.camel@eep> I just noticed this discussion. I've completed porting all of the common SXML libraries to R6RS: ssax, sxml-tools, htmlprag, and sxml-match: https://code.launchpad.net/~derick-eddington/ikarus-libraries/xitomatl The complete libraries are provided and all their tests pass (except one weird case, see my log comments). All of it works under Ikarus, but MzScheme cannot currently run all of it for a few reasons (I'd be glad to explain later, need to go to sleep), just try running all the tests and you'll see what. [You'll need my SRFIs ports, too.] I used ^ and ^^ as the replacements for @ and @@. -- : Derick ---------------------------------------------------------------- From DekuDekuplex at Yahoo.com Wed Jul 2 23:24:44 2008 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Thu Mar 26 02:22:11 2009 Subject: [plt-scheme] Re: possible discrepancy between documentation and actual usage of Typed Scheme References: <18539.32296.161277.511705@arabic.ccs.neu.edu> Message-ID: On Wed, 2 Jul 2008 09:10:00 -0400, Eli Barzilay wrote: >The text itself is a >preference that can be changed on the language configuration panel >(form the language dialog hit the "Details" button), so you can just >change that to use `typed-scheme' instead. Thank you for your response and explanation of the situation. Just to confirm: Do you mean, after hitting "Show Details" with the Module language selected, the text in the textbox under the title "Command-line arguments as a vector of strings, in read syntax" (set to "#()" by default)? Although I can appreciate the benefits from a semantic point of view of allowing multiple languages to be chosen from within modules using the #lang line, now I feel concerned about whether this trend will then make the REPL less convenient to use for quick evaluations in multiple module languages that would not separately be available from the "Choose Language" dialog box. For instance, suppose that I have just started up DrScheme, and want to compare the result returned by equivalent versions of, say, a fibonacci program in different Module languages, say, "#lang scheme" vs. "#lang typed-scheme." If I specify "#lang scheme" in the Detail for the Module language, and start up a new tab in the Module language, then "#lang scheme" will become the language for that tab. So far, so good. But then, suppose that I open a new tab, intending to do a quick comparison of results returned from an equivalent fibonacci procedure in the interactions panel in, say, "#lang typed-scheme." Because both "#lang scheme" and "#lang typed-scheme" are contained with the Module language, I would then need to carry out one of the following two steps to switch to "#lang typed-scheme" in this tab: 1) In the definitions panel, type "#lang typed-scheme", and run the content of that panel. Slightly inconvenient, since unlike before, I actually need to type the full name of the language. What happens if I forget whether it was "#lang typed scheme," "#lang typed_scheme," or "#lang typed-scheme", for instance? What happens if it is a new language with a hard-to-remember name? 2) In the "Show Details" mode of the "Choose Language" dialog box, under "Command-line arguments as a vector of strings, in read syntax", type "#lang typed-scheme" (again, same problem with remembering the language name as above), and click "OK". The gist of the problem seems to be that I actually need to remember the full name of the language and type it somewhere, rather than just select it from a list. I often forget names, and it is usually much easier to select a name from a list somewhere than to need to remember it as text and to type it out somewhere. This new need can make selecting a language more difficult to use, especially if I need to switch often between similar-sounding language names within the same Module language. Ideally, if modules are to be used in the future, it would help if there were some way to specify different module languages by clicking on entries in a list, instead of typing out the names of the languages. One suggestion would be to create a list of entries available by clicking on a right-pointing triangle to the left of the "Module" language in the "Choose Language" dialog box, similarly the way that different sub-languages of "How to Design Programs" and "Swindle" are currently chosen. That way, I would be able to specify a new default language for a tab without needing explicity to remember the exact name of a Module language. -- Benjamin L. Russell From eli at barzilay.org Wed Jul 2 23:45:29 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:11 2009 Subject: [plt-scheme] Re: possible discrepancy between documentation and actual usage of Typed Scheme In-Reply-To: References: <18539.32296.161277.511705@arabic.ccs.neu.edu> Message-ID: <18540.19289.602366.985613@arabic.ccs.neu.edu> On Jul 3, Benjamin L.Russell wrote: > On Wed, 2 Jul 2008 09:10:00 -0400, Eli Barzilay > wrote: > > >The text itself is a > >preference that can be changed on the language configuration panel > >(form the language dialog hit the "Details" button), so you can just > >change that to use `typed-scheme' instead. > > Thank you for your response and explanation of the situation. > > Just to confirm: Do you mean, after hitting "Show Details" with the > Module language selected, the text in the textbox under the title > "Command-line arguments as a vector of strings, in read syntax" (set > to "#()" by default)? A new box under that. (A pre-build is now available so you can try it.) > [...] > The gist of the problem seems to be that I actually need to remember > the full name of the language and type it somewhere, rather than > just select it from a list. I often forget names, and it is usually > much easier to select a name from a list somewhere than to need to > remember it as text and to type it out somewhere. This new need can > make selecting a language more difficult to use, especially if I > need to switch often between similar-sounding language names within > the same Module language. Yes, it sounds like the only thing you're missing is the "wizardness" of the language menu -- and like I said, it might happen. > Ideally, if modules are to be used in the future, it would help if > there were some way to specify different module languages by > clicking on entries in a list, instead of typing out the names of > the languages. One suggestion would be to create a list of entries > available by clicking on a right-pointing triangle to the left of > the "Module" language in the "Choose Language" dialog box, similarly > the way that different sub-languages of "How to Design Programs" and > "Swindle" are currently chosen. That way, I would be able to > specify a new default language for a tab without needing explicity > to remember the exact name of a Module language. That sounds reasonable to me (but I'm only talking for myself). And I don't think that this is in contradiction to moving to #lang-based specification. On the contrary: languages that you use often will have that #lang line in a visible place, so eventually you'll know what to type and will be able to use that instead (which is good because for many people typing `#lang scheme' is faster than openning a dialog etc). And in addition, you get the usual benefits like having the language be part of the file (so you don't need to change the language to fit the content, as was the situation in 372). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From DekuDekuplex at Yahoo.com Thu Jul 3 00:21:59 2008 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Thu Mar 26 02:22:11 2009 Subject: [plt-scheme] "Seg fault (internal error) at 12" upon starting DrScheme, version 4.0.1.3, english Message-ID: I just downloaded and installed DrScheme, version 4.0.1.3, english, in "C:\Program Files\PLT-4.0.1.3" on Windows XP Professional, Service Pack 2, but every time I start up this pre-release version of DrScheme, the following error pops up in a Command Prompt box: > Seg fault (internal error) at 12 The a Windows XP dialog box pops up reporting an error in a "MrEd-based application," offering to send a report of the error to Microsoft. When I click "Send Error Report," the error report is sent, and then both dialog boxes close. Then Version 4.0.1.3 terminates. For some reason, the regular version 4.0.1, installed in "C:\bin\PLT-4.0.1," still starts up without any problems. Similarly for both versions 3.99.0.13, installed in "C:\Program Files\PLT-3.99.0.13," and 3.99.0.25, installed in "C:\Program Files\PLT-3.99.0.25," respectively. Is this a bug, or do I need to do something special to get version 4.0.1.3 to run? -- Benjamin L. Russell From spdegabrielle at gmail.com Thu Jul 3 03:33:43 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:22:11 2009 Subject: [plt-scheme] hash-ref 'manipulating' mutable hash-tables? In-Reply-To: <932b2f1f0807021301i13639731t13a5a32e9a1f4d0b@mail.gmail.com> References: <595b9ab20807020210r7e9d8200radbfeebab9c3aacf@mail.gmail.com> <20080702115740.1C93D6500B9@mail-svr1.cs.utah.edu> <595b9ab20807020708h3b8ffa93o5c62b763afa70acf@mail.gmail.com> <932b2f1f0807021301i13639731t13a5a32e9a1f4d0b@mail.gmail.com> Message-ID: <595b9ab20807030033v6e037f3dy962a5b76bbfd38c3@mail.gmail.com> Thats a relief - I often look to the source in /collects (via 'Search in files') for guidance on style/usage but could only find that idiom once. Thanks, Stephen On Wed, Jul 2, 2008 at 9:01 PM, Robby Findler wrote: > I use that all the time myself too, but mostly in scripts. (I usually > call it hash-cons!). I also use hash-inc! that defaults to 0 and adds > 1 to the binding. > > Robby > > On Wed, Jul 2, 2008 at 9:08 AM, Stephen De Gabrielle > wrote: >> Thankyou (all) >> >> I was worried about using the following; >> >> (define (hash-cons-v ht k v) >> (hash-set! ht k (cons v (hash-ref ht k null)))) >> >> I use this all the time - so much so that I'm surprised I don't see it >> more - the only place I've found it is in compiler.ss ; (hash-set! >> ht k (cons r (hash-ref ht k (lambda () null)))) >> >> >> Cheers, >> >> Stephen >> >> >> On Wed, Jul 2, 2008 at 12:57 PM, Matthew Flatt wrote: >>> At Wed, 2 Jul 2008 10:10:11 +0100, "Stephen De Gabrielle" wrote: >>>> "Caveats concerning concurrent modification: A mutable hash table can >>>> be manipulated with hash-ref," >>>> -- http://docs.plt-scheme.org/reference/hashtables.html >>>> >>>> Is this right? How does hash-ref change a hash table? (do mutable >>>> ht's do some sort of 'query optimisation' that I'm not aware of? if >>>> so; does this make them faster but less safe than immutable ht's?) >>> >>> No, `hash-ref' doesn't mutate the table, at least not in the current >>> implementation. With respect to `hash-ref', that paragraph is meant >>> just to point out that reading via `hash-ref' uses a lock, so that it's >>> thread-safe (though not kill-safe) when other threads might mutate the >>> table. >>> >>> Matthew >>> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > -- Cheers, Stephen -- Stephen De Gabrielle s.degabrielle@cs.ucl.ac.uk Telephone +44 (0)20 7679 0693 (x30693) Mobile 079 851 890 45 Project: Making Sense of Information (MaSI) Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html Home:http://www.degabrielle.name/stephen UCL Interaction Centre MPEB 8th floor University College London Gower Street London WC1E 6BT From lizorkin at ispras.ru Thu Jul 3 04:25:39 2008 From: lizorkin at ispras.ru (Dmitry Lizorkin) Date: Thu Mar 26 02:22:12 2009 Subject: [plt-scheme] ann: Scheme client for database management system "Sedna" Message-ID: <04c501c8dce6$607135c0$4cc69553@fiona> Hello! Client API for XML database management system "Sedna" is available from PLaneT: (require (planet "sedna.ss" ("lizorkin" "sedna.plt" 1 2))) With the API, XML data can be persistently stored in Sedna database and queried to retrieve XML or SXML. Basic code example introduced in "doc.txt": http://planet.plt-scheme.org/package-source/lizorkin/sedna.plt/1/2/doc.txt Full API description for Scheme in Sedna programmer's guide: http://modis.ispras.ru/sedna/progguide/ProgGuidesu3.html Sedna database management system itself: http://modis.ispras.ru/sedna/ From mark.engelberg at gmail.com Thu Jul 3 05:10:20 2008 From: mark.engelberg at gmail.com (Mark Engelberg) Date: Thu Mar 26 02:22:12 2009 Subject: [plt-scheme] Typed scheme and sequences? Message-ID: Does Typed Scheme understand sequences, i.e., something like (Sequenceof a)? On a related note, I've tried converting a module to typed scheme, and it's telling me it doesn't like in-range: typecheck: unbound identifier in-range Thanks, Mark From mark.engelberg at gmail.com Thu Jul 3 06:15:03 2008 From: mark.engelberg at gmail.com (Mark Engelberg) Date: Thu Mar 26 02:22:12 2009 Subject: [plt-scheme] Contracts and macros? Message-ID: Is there a way to do any kind of contract checking on a macro? Here's the scenario I'm looking at: A macro is used to convert a certain syntactic sugar into a function call. I want to keep the function private, but provide the sugarized macro version to other modules. If I can't assign a contract to the macro, how can I ensure that blame is properly assigned? Is there a way to put a contract on the private function in a way that will assign blame to other modules which call the macro which expands to an incorrect call to the private function? --Mark From mark.engelberg at gmail.com Thu Jul 3 06:38:21 2008 From: mark.engelberg at gmail.com (Mark Engelberg) Date: Thu Mar 26 02:22:12 2009 Subject: [plt-scheme] equal-hash-code for vectors Message-ID: Where can I find the source code for the equal-hash-code implementation for vectors? I'm implementing a vector-like data structure, and want to mimic the built-in hash-code functionality. Thanks, Mark From jpc-ml at zenburn.net Thu Jul 3 06:40:11 2008 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:22:12 2009 Subject: [plt-scheme] FFI error in 4.0 In-Reply-To: <18540.8848.680708.479566@arabic.ccs.neu.edu> References: <486BE5F9.2090106@zenburn.net> <18540.8848.680708.479566@arabic.ccs.neu.edu> Message-ID: <486CAC8B.5030804@zenburn.net> Eli Barzilay wrote: > On Jul 2, Jakub Piotr C?apa wrote: >> #lang scheme/base >> (require scheme/foreign) >> >> #;(define-cpointer-type _test #f #f #f) ; this works >> (define-cpointer-type _test) ; this doesn't and gives a >> ; really obscure error message > > Why is it obscure? It said exactly what was wrong... ... but left me without any location information (the broken code was a little longer than the minimal test case ;). -- regards, Jakub Piotr C?apa From derick.eddington at gmail.com Thu Jul 3 06:43:02 2008 From: derick.eddington at gmail.com (Derick Eddington) Date: Thu Mar 26 02:22:12 2009 Subject: [plt-scheme] SXML for R6RS [was: R6RS Interoperability] In-Reply-To: <1215047813.20284.17.camel@eep> References: <1215047813.20284.17.camel@eep> Message-ID: <1215081783.23549.83.camel@eep> To follow up on explaining why my SXML libraries ports are not fully working on MzScheme: ? * HtmlPrag works completely. * sxml-match works completely. * sxml-tools issue: sxml-tools uses the SRFI and-let* macro. My SRFIs ports provide it via the (xitomatl srfi and-let*) library. But MzScheme currently does not accept library names with a * character in them: ;--------------------------------------------------------------------- #!r6rs (import (A L*)) ERROR=> lib: ill-formed module path in: (lib "A/L*.sls") ?;--------------------------------------------------------------------- It would be easy to name it something else but R6RS allows library names to use any symbol and I don't think a name other than and-let* would be good. I've been meaning to bring this up and ask: would it be possible for PLT to support any symbols for library names? Ikarus currently does it by encoding filename-unfriendly characters like * to %2A. I'd be willing to make a patch to do this if it's not a dead end. * SSAX issue: MzScheme does not conform [1] to the R6RS expectation that the initial/default exception handler return for non-&serious conditions? [2]. Returning for non-&serious conditions allows you to do things like raise-continuable a &warning condition to let interested clients catch it and do something about it and maybe return, or the default handler will return, and execution can continue. I made my ssax:warn procedure do this and the SSAX library frequently calls ?ssax:warn when issues that often can safely be ignored happen. I hacked together a patch to MzScheme so its default R6RS handler returns for non-&serious, though I'm not sure it meshes with PLT completely correctly, and with it my SSAX port works completely: =========================================================================== --- collects/rnrs/exceptions-6.ss 2008-06-22 21:01:22.000000000 -0700 +++ /collects/rnrs/exceptions-6.ss 2008-06-25 20:30:10.000000000 -0700 @@ -1,6 +1,8 @@ #lang scheme/base -(require r6rs/private/exns) +(require r6rs/private/exns + (only-in r6rs/private/conds serious-condition? simple-conditions) + (only-in rnrs/io/ports-6 standard-error-port)) (provide with-exception-handler guard else => @@ -80,7 +82,21 @@ (define (r6rs:raise exn) ;; No barrier - (raise exn #f)) + (parameterize ([uncaught-exception-handler + (lambda (exn) + (let ([base (if (exn:continuable? exn) + (exn:continuable-base exn) + exn)]) + (if (serious-condition? base) + (raise exn #f) + (begin + (display (format "Uncaught Exception:\n~s\n" + (simple-conditions base)) + (standard-error-port)) + (when (exn:continuable? exn) + ((exn:continuable-continuation exn) + (lambda () (values))))))))]) + (raise exn #f))) (define (raise-continuable exn) ((let/cc cont =========================================================================== makes it do: > (call-with-input-file "/home/d/zone/scheme/SSAX/examples/xml/OMF-sample.xml" (lambda (fip) (ssax:xml->sxml fip '()))) Uncaught Exception: {#(struct:&warning) #(struct:&who ssax) #(struct:&message "DOCTYPE DECL Reports OMF.dtd found and skipped") #(struct:&port-position 36) #(struct:&irritants #)} ;;; it continues and returns the SXML: {*TOP* {Reports {^ {TStamp "950226528"}} {SYN {^ {Title "METAR"} {TStamp "950104440"} {SName "KMRY, MONTEREY PENINSULA"} {LatLon "36.583, -121.85"} {Elev "77"} {BId "724915"}} [...] [1] http://docs.plt-scheme.org/r6rs/conformance.html [2] http://www.r6rs.org/final/html/r6rs-lib/r6rs-lib-Z-H-8.html#node_sec_7.1 -- : Derick ---------------------------------------------------------------- On Wed, 2008-07-02 at 18:16 -0700, Derick Eddington wrote: > I just noticed this discussion. I've completed porting all of the > common SXML libraries to R6RS: ssax, sxml-tools, htmlprag, and > sxml-match: > > https://code.launchpad.net/~derick-eddington/ikarus-libraries/xitomatl > > The complete libraries are provided and all their tests pass (except one > weird case, see my log comments). All of it works under Ikarus, but > MzScheme cannot currently run all of it for a few reasons (I'd be glad > to explain later, need to go to sleep), just try running all the tests > and you'll see what. [You'll need my SRFIs ports, too.] > > I used ^ and ^^ as the replacements for @ and @@. From mark.engelberg at gmail.com Thu Jul 3 07:38:23 2008 From: mark.engelberg at gmail.com (Mark Engelberg) Date: Thu Mar 26 02:22:13 2009 Subject: [plt-scheme] Another contract question Message-ID: I'm not seeing a way to put a ->d contract inside of a case-> contract. Is there a workaround? --Mark From robby at cs.uchicago.edu Thu Jul 3 07:59:15 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:13 2009 Subject: [plt-scheme] Another contract question In-Reply-To: References: Message-ID: <932b2f1f0807030459v6fe3a99fq8ff765be2c1ecbac@mail.gmail.com> No. Unfortunately, at the moment, case-> only takes a few things, not including ->d. Robby On Thu, Jul 3, 2008 at 6:38 AM, Mark Engelberg wrote: > I'm not seeing a way to put a ->d contract inside of a case-> > contract. Is there a workaround? > > --Mark > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From robby at cs.uchicago.edu Thu Jul 3 08:16:03 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:13 2009 Subject: [plt-scheme] Contracts and macros? In-Reply-To: References: Message-ID: <932b2f1f0807030516l40bdf32bxe9380c2a1be938b6@mail.gmail.com> There isn't support for that now. I'm not even sure how to do that properly in general. In this specific case, you might try putting the `contract' form directly into the expansion of the macro. Or it may be simpler to just code up the checks yourself and call error. Robby On Thu, Jul 3, 2008 at 5:15 AM, Mark Engelberg wrote: > Is there a way to do any kind of contract checking on a macro? > > Here's the scenario I'm looking at: > A macro is used to convert a certain syntactic sugar into a function > call. I want to keep the function private, but provide the sugarized > macro version to other modules. > > If I can't assign a contract to the macro, how can I ensure that blame > is properly assigned? Is there a way to put a contract on the private > function in a way that will assign blame to other modules which call > the macro which expands to an incorrect call to the private function? > > --Mark > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From matthias at ccs.neu.edu Thu Jul 3 08:40:50 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:22:13 2009 Subject: [plt-scheme] Contracts and macros? In-Reply-To: References: Message-ID: Macro contracts coming to a Scheme near you real soon now. (Well over the course of the next year) -- Matthias On Jul 3, 2008, at 6:15 AM, Mark Engelberg wrote: > Is there a way to do any kind of contract checking on a macro? > > Here's the scenario I'm looking at: > A macro is used to convert a certain syntactic sugar into a function > call. I want to keep the function private, but provide the sugarized > macro version to other modules. > > If I can't assign a contract to the macro, how can I ensure that blame > is properly assigned? Is there a way to put a contract on the private > function in a way that will assign blame to other modules which call > the macro which expands to an incorrect call to the private function? > > --Mark > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mflatt at cs.utah.edu Thu Jul 3 09:47:16 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:13 2009 Subject: [plt-scheme] SXML for R6RS [was: R6RS Interoperability] In-Reply-To: <1215081783.23549.83.camel@eep> References: <1215047813.20284.17.camel@eep> <1215081783.23549.83.camel@eep> Message-ID: <20080703134719.090736500BE@mail-svr1.cs.utah.edu> At Thu, 03 Jul 2008 03:43:02 -0700, Derick Eddington wrote: > I've been meaning to bring this up and ask: would it be possible for PLT > to support any symbols for library names? Ikarus currently does it by > encoding filename-unfriendly characters like * to %2A. I'd be willing > to make a patch to do this if it's not a dead end. That would be great. > * SSAX issue: MzScheme does not conform [1] to the R6RS expectation that > the initial/default exception handler return for non-&serious > conditions? [2]. Returning for non-&serious conditions allows you to do > things like raise-continuable a &warning condition to let interested > clients catch it and do something about it and maybe return, or the > default handler will return, and execution can continue. I made my > ssax:warn procedure do this and the SSAX library frequently > calls ?ssax:warn when issues that often can safely be ignored happen. I > hacked together a patch to MzScheme so its default R6RS handler returns > for non-&serious, though I'm not sure it meshes with PLT completely > correctly, and with it my SSAX port works completely: > > =========================================================================== > --- collects/rnrs/exceptions-6.ss 2008-06-22 21:01:22.000000000 -0700 > +++ /collects/rnrs/exceptions-6.ss 2008-06-25 20:30:10.000000000 -0700 > @@ -1,6 +1,8 @@ > #lang scheme/base > > -(require r6rs/private/exns) > +(require r6rs/private/exns > + (only-in r6rs/private/conds serious-condition? simple-conditions) > + (only-in rnrs/io/ports-6 standard-error-port)) > > (provide with-exception-handler > guard else => > @@ -80,7 +82,21 @@ > > (define (r6rs:raise exn) > ;; No barrier > - (raise exn #f)) > + (parameterize ([uncaught-exception-handler > + (lambda (exn) > + (let ([base (if (exn:continuable? exn) > + (exn:continuable-base exn) > + exn)]) > + (if (serious-condition? base) > + (raise exn #f) > + (begin > + (display (format "Uncaught Exception:\n~s\n" > + (simple-conditions base)) > + (standard-error-port)) > + (when (exn:continuable? exn) > + ((exn:continuable-continuation exn) > + (lambda () (values))))))))]) > + (raise exn #f))) That's an interesting approach. I'm not sure that it's consistent with everything else, either, but it seems like an improvement for now. Matthew From jos.koot at telefonica.net Thu Jul 3 10:07:46 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:22:13 2009 Subject: [plt-scheme] "Seg fault (internal error) at 12" upon startingDrScheme, version 4.0.1.3, english References: Message-ID: <003101c8dd16$2beb7790$2101a8c0@uw2b2dff239c4d> See also http://bugs.plt-scheme.org/query/?cmd=view&pr=9556 Jos ----- Original Message ----- From: "Benjamin L.Russell" To: Sent: Thursday, July 03, 2008 6:21 AM Subject: [plt-scheme] "Seg fault (internal error) at 12" upon startingDrScheme, version 4.0.1.3, english >I just downloaded and installed DrScheme, version 4.0.1.3, english, in > "C:\Program Files\PLT-4.0.1.3" on Windows XP Professional, Service > Pack 2, but every time I start up this pre-release version of > DrScheme, the following error pops up in a Command Prompt box: > >> Seg fault (internal error) at 12 > > The a Windows XP dialog box pops up reporting an error in a > "MrEd-based application," offering to send a report of the error to > Microsoft. > > When I click "Send Error Report," the error report is sent, and then > both dialog boxes close. Then Version 4.0.1.3 terminates. > > For some reason, the regular version 4.0.1, installed in > "C:\bin\PLT-4.0.1," still starts up without any problems. Similarly > for both versions 3.99.0.13, installed in "C:\Program > Files\PLT-3.99.0.13," and 3.99.0.25, installed in "C:\Program > Files\PLT-3.99.0.25," respectively. > > Is this a bug, or do I need to do something special to get version > 4.0.1.3 to run? > > -- Benjamin L. Russell > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From czhu at cs.utah.edu Thu Jul 3 10:41:34 2008 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:22:14 2009 Subject: [plt-scheme] Contracts and macros? In-Reply-To: References: Message-ID: <486CE51E.1040305@cs.utah.edu> Mark Engelberg wrote: > Here's the scenario I'm looking at: > A macro is used to convert a certain syntactic sugar into a function > call. I want to keep the function private, but provide the sugarized > macro version to other modules. > > Just 'provide the macro but not the function in you module should suffice this need. Chongkai From czhu at cs.utah.edu Thu Jul 3 10:44:24 2008 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:22:14 2009 Subject: [plt-scheme] equal-hash-code for vectors In-Reply-To: References: Message-ID: <486CE5C8.9020204@cs.utah.edu> http://pre.plt-scheme.org/plt/src/mzscheme/src/hash.c Mark Engelberg wrote: > Where can I find the source code for the equal-hash-code > implementation for vectors? > > I'm implementing a vector-like data structure, and want to mimic the > built-in hash-code functionality. > > Thanks, > > Mark > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From m.douglas.williams at gmail.com Thu Jul 3 14:01:13 2008 From: m.douglas.williams at gmail.com (Doug Williams) Date: Thu Mar 26 02:22:15 2009 Subject: [plt-scheme] Problems with eval Message-ID: I am converting the inference collection over to run on V4.0.1 and I'm having a problem with dynamically evaluating a lambda expression. Here is a snippet of the code that gives the error: #lang scheme/base ... (define (activate-rule rule initial-node) ... (if (null? match-constraints) ; match-constraint-predicate #f (eval `(lambda ,(if assertion-variable (cons assertion-variable (pattern-variables pattern)) (pattern-variables pattern)) (and ,@match-constraints)))) ... ) And, the error I get is: compile: bad syntax; function application is not allowed, because no #%app syntax transformer is bound in: (lambda (?size ?peg) (and (not (eq? ?peg (quote right))))) This code works in V372. Any ideas? Doug -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080703/2560c56d/attachment.html From czhu at cs.utah.edu Thu Jul 3 14:05:43 2008 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:22:15 2009 Subject: [plt-scheme] Problems with eval In-Reply-To: References: Message-ID: <486D14F7.3060508@cs.utah.edu> (require (for-syntax scheme/base)) ? Doug Williams wrote: > I am converting the inference collection over to run on V4.0.1 and I'm > having a problem with dynamically evaluating a lambda expression. > Here is a snippet of the code that gives the error: > > #lang scheme/base > ... > (define (activate-rule rule initial-node) > ... > (if (null? match-constraints) ; > match-constraint-predicate > #f > (eval > `(lambda ,(if assertion-variable > (cons assertion-variable > (pattern-variables pattern)) > (pattern-variables pattern)) > (and ,@match-constraints)))) > ... > ) > > And, the error I get is: > > compile: bad syntax; function application is not allowed, because no > #%app syntax transformer is bound in: (lambda (?size ?peg) (and (not > (eq? ?peg (quote right))))) > > This code works in V372. > > Any ideas? > > Doug > ------------------------------------------------------------------------ > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From m.douglas.williams at gmail.com Thu Jul 3 14:14:17 2008 From: m.douglas.williams at gmail.com (Doug Williams) Date: Thu Mar 26 02:22:15 2009 Subject: [plt-scheme] Problems with eval In-Reply-To: <486D14F7.3060508@cs.utah.edu> References: <486D14F7.3060508@cs.utah.edu> Message-ID: I added the require to the module and it didn't have any affect. I got exactly the same error. On Thu, Jul 3, 2008 at 12:05 PM, Chongkai Zhu wrote: > (require (for-syntax scheme/base)) > > ? > > > Doug Williams wrote: > >> I am converting the inference collection over to run on V4.0.1 and I'm >> having a problem with dynamically evaluating a lambda expression. Here is a >> snippet of the code that gives the error: >> >> #lang scheme/base >> ... >> (define (activate-rule rule initial-node) >> ... >> (if (null? match-constraints) ; >> match-constraint-predicate >> #f >> (eval >> `(lambda ,(if assertion-variable >> (cons assertion-variable >> (pattern-variables pattern)) >> (pattern-variables pattern)) >> (and ,@match-constraints)))) >> ... >> ) >> >> And, the error I get is: >> >> compile: bad syntax; function application is not allowed, because no #%app >> syntax transformer is bound in: (lambda (?size ?peg) (and (not (eq? ?peg >> (quote right))))) >> >> This code works in V372. >> >> Any ideas? >> >> Doug >> ------------------------------------------------------------------------ >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080703/d94aaef4/attachment.htm From czhu at cs.utah.edu Thu Jul 3 14:19:00 2008 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:22:16 2009 Subject: [plt-scheme] Problems with eval In-Reply-To: References: <486D14F7.3060508@cs.utah.edu> Message-ID: <486D1814.9070601@cs.utah.edu> Yes, you are right. I can reproduce the error. Must be a bug. Chongkai Doug Williams wrote: > I added the require to the module and it didn't have any affect. I > got exactly the same error. > > On Thu, Jul 3, 2008 at 12:05 PM, Chongkai Zhu > wrote: > > (require (for-syntax scheme/base)) > > ? > > > Doug Williams wrote: > > I am converting the inference collection over to run on V4.0.1 > and I'm having a problem with dynamically evaluating a lambda > expression. Here is a snippet of the code that gives the error: > > #lang scheme/base > ... > (define (activate-rule rule initial-node) > ... > (if (null? match-constraints) ; > match-constraint-predicate > #f > (eval > `(lambda ,(if assertion-variable > (cons assertion-variable > (pattern-variables > pattern)) > (pattern-variables pattern)) > (and ,@match-constraints)))) > ... > ) > > And, the error I get is: > > compile: bad syntax; function application is not allowed, > because no #%app syntax transformer is bound in: (lambda > (?size ?peg) (and (not (eq? ?peg (quote right))))) > > This code works in V372. > > Any ideas? > > Doug > ------------------------------------------------------------------------ > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > > > From robby at cs.uchicago.edu Thu Jul 3 14:34:04 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:16 2009 Subject: [plt-scheme] Problems with eval In-Reply-To: <486D1814.9070601@cs.utah.edu> References: <486D14F7.3060508@cs.utah.edu> <486D1814.9070601@cs.utah.edu> Message-ID: <932b2f1f0807031134x1aa207a2s8893563c59730846@mail.gmail.com> This is not a bug. The top-level namespace (ie the part of the namespace that deals with code outside modules) for the module language does not have any bindings. You have to initialize it with some if you want to use them. It would be better to avoid eval (as has been mentioned a few times on this list) but on the assumption that eval is truely necessary, try this: #lang scheme (namespace-require 'scheme/base) (eval '((lambda (x) x) 1)) Without the second line, the third one won't work, but with it, it does. Robby On Thu, Jul 3, 2008 at 1:19 PM, Chongkai Zhu wrote: > Yes, you are right. I can reproduce the error. Must be a bug. > > Chongkai > > Doug Williams wrote: >> >> I added the require to the module and it didn't have any affect. I got >> exactly the same error. >> >> On Thu, Jul 3, 2008 at 12:05 PM, Chongkai Zhu > > wrote: >> >> (require (for-syntax scheme/base)) >> >> ? >> >> >> Doug Williams wrote: >> >> I am converting the inference collection over to run on V4.0.1 >> and I'm having a problem with dynamically evaluating a lambda >> expression. Here is a snippet of the code that gives the error: >> >> #lang scheme/base >> ... >> (define (activate-rule rule initial-node) >> ... >> (if (null? match-constraints) ; >> match-constraint-predicate >> #f >> (eval >> `(lambda ,(if assertion-variable >> (cons assertion-variable >> (pattern-variables >> pattern)) >> (pattern-variables pattern)) >> (and ,@match-constraints)))) >> ... >> ) >> >> And, the error I get is: >> >> compile: bad syntax; function application is not allowed, >> because no #%app syntax transformer is bound in: (lambda >> (?size ?peg) (and (not (eq? ?peg (quote right))))) >> >> This code works in V372. >> >> Any ideas? >> >> Doug >> >> ------------------------------------------------------------------------ >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> >> > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From mark.engelberg at gmail.com Thu Jul 3 15:14:24 2008 From: mark.engelberg at gmail.com (Mark Engelberg) Date: Thu Mar 26 02:22:16 2009 Subject: [plt-scheme] Contracts performance Message-ID: I'm trying to get my head around the performance overhead associated with contracts. I noticed in the manual it talks about the space overhead between returning any vs. any/c in a tail-call recursive function. Are there some other common "gotchas"? How about (listof any) and related contracts? Is that O(1) or O(n)? Furthermore, if you turn off debugging information, does contract checking go away as well? --Mark From morazanm at gmail.com Thu Jul 3 15:16:28 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:22:16 2009 Subject: [plt-scheme] Question about map Message-ID: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> Hi All, I am using v4.0.1. This code: (map caadr localdefs) Produces this error: mcar: expects argument of type ; given # My code does not use mcar anywhere. I must assume it has to do with the implementation of map (?). Any pointers much appreciated. Cheers, Marco From robby at cs.uchicago.edu Thu Jul 3 15:18:37 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:16 2009 Subject: [plt-scheme] Contracts performance In-Reply-To: References: Message-ID: <932b2f1f0807031218jdedbcdx2d87d33d320b696c@mail.gmail.com> On Thu, Jul 3, 2008 at 2:14 PM, Mark Engelberg wrote: > I'm trying to get my head around the performance overhead associated > with contracts. I noticed in the manual it talks about the space > overhead between returning any vs. any/c in a tail-call recursive > function. Are there some other common "gotchas"? I don't think so. > How about (listof > any) and related contracts? Is that O(1) or O(n)? (listof any) cannot be O(1) without some more help from the mzscheme runtime system, I believe. You're probably thinking of the contract (or/c pair? null?), but (listof any) needs to make sure it actually has a list (ie all of the cdr position of any pair has either a pair or null). But maybe Matthew has added something and I've just missed the chance to take advantage of it? I know there was something about making the list? predicate be constant time? Anyways, (listof any) isn't constant time. > Furthermore, if you turn off debugging information, does contract > checking go away as well? No, contracts don't go away unless you take them away. Robby From eli at barzilay.org Thu Jul 3 15:19:51 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:16 2009 Subject: [plt-scheme] Problems with eval In-Reply-To: <932b2f1f0807031134x1aa207a2s8893563c59730846@mail.gmail.com> References: <486D14F7.3060508@cs.utah.edu> <486D1814.9070601@cs.utah.edu> <932b2f1f0807031134x1aa207a2s8893563c59730846@mail.gmail.com> Message-ID: <18541.9815.161192.216446@arabic.ccs.neu.edu> On Jul 3, Robby Findler wrote: > This is not a bug. > > The top-level namespace (ie the part of the namespace that deals > with code outside modules) for the module language does not have any > bindings. You have to initialize it with some if you want to use > them. > > It would be better to avoid eval (as has been mentioned a few times > on this list) but on the assumption that eval is truely necessary, > try this: > > #lang scheme > (namespace-require 'scheme/base) > (eval '((lambda (x) x) 1)) > > Without the second line, the third one won't work, but with it, it > does. You can also use a private namespace #lang scheme (define ns (make-base-namespace)) (eval '((lambda (x) x) 1) ns) or even better, you can use the namespace of the current module: #lang scheme (define-namespace-anchor anchor) (eval '((lambda (x) x) 1) (namespace-anchor->namespace anchor)) and you can even do this now: #lang scheme (define-namespace-anchor anchor) (define c 1) (eval '((lambda (x) x) c) (namespace-anchor->namespace anchor)) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From robby at cs.uchicago.edu Thu Jul 3 15:20:31 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:16 2009 Subject: [plt-scheme] Question about map In-Reply-To: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> Message-ID: <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> Someone else might be able to guess the right thing here, but I'd need more info to help. For example, this works fine: #lang scheme (define localdefs (list '(lambda (x) x))) (map caadr localdefs) Robby On Thu, Jul 3, 2008 at 2:16 PM, Marco Morazan wrote: > Hi All, > > I am using v4.0.1. > > This code: (map caadr localdefs) > > Produces this error: > > mcar: expects argument of type ; given # > > My code does not use mcar anywhere. I must assume it has to do with > the implementation of map (?). > > Any pointers much appreciated. > > Cheers, > > Marco > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From morazanm at gmail.com Thu Jul 3 15:21:11 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:22:17 2009 Subject: [plt-scheme] Re: Question about map In-Reply-To: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> Message-ID: <9b1fff280807031221n2921998di250b410eac4895a0@mail.gmail.com> Ok, upon further investigation I see: > map # > Is there a way to have the vanilla flavor map (other than writing it myself?). Marco On Thu, Jul 3, 2008 at 3:16 PM, Marco Morazan wrote: > Hi All, > > I am using v4.0.1. > > This code: (map caadr localdefs) > > Produces this error: > > mcar: expects argument of type ; given # > > My code does not use mcar anywhere. I must assume it has to do with > the implementation of map (?). > > Any pointers much appreciated. > > Cheers, > > Marco > From robby at cs.uchicago.edu Thu Jul 3 15:25:49 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:17 2009 Subject: [plt-scheme] Re: Question about map In-Reply-To: <9b1fff280807031221n2921998di250b410eac4895a0@mail.gmail.com> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> <9b1fff280807031221n2921998di250b410eac4895a0@mail.gmail.com> Message-ID: <932b2f1f0807031225m7def70ecj9f0fd0c435500873@mail.gmail.com> I think that you must be mixing languages that have mutable pairs with languages that don't. It is hard to say how you're doing that but, for example #lang scheme map produces "map" not "mmap" whereas this: #!r6rs (import (rnrs)) (display map) shows that map is bound to the mutable map procedure. Robby On Thu, Jul 3, 2008 at 2:21 PM, Marco Morazan wrote: > Ok, upon further investigation I see: > >> map > # >> > > Is there a way to have the vanilla flavor map (other than writing it myself?). > > Marco > > On Thu, Jul 3, 2008 at 3:16 PM, Marco Morazan wrote: >> Hi All, >> >> I am using v4.0.1. >> >> This code: (map caadr localdefs) >> >> Produces this error: >> >> mcar: expects argument of type ; given # >> >> My code does not use mcar anywhere. I must assume it has to do with >> the implementation of map (?). >> >> Any pointers much appreciated. >> >> Cheers, >> >> Marco >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From pltscheme at pnkfx.org Thu Jul 3 15:26:36 2008 From: pltscheme at pnkfx.org (Felix Klock's PLT scheme proxy) Date: Thu Mar 26 02:22:17 2009 Subject: [plt-scheme] Question about map In-Reply-To: <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> Message-ID: <7F10FC01-3FBE-4A2F-B840-14A8D6403B06@pnkfx.org> Robby- Marco failed to indicate what language is working in. I was able to create a similar problem this way: #lang r5rs (map caadr '(lambda (x) x)) -Felix On Jul 3, 2008, at 3:20 PM, Robby Findler wrote: > Someone else might be able to guess the right thing here, but I'd need > more info to help. For example, this works fine: > > #lang scheme > (define localdefs (list '(lambda (x) x))) > (map caadr localdefs) > > Robby > > On Thu, Jul 3, 2008 at 2:16 PM, Marco Morazan > wrote: >> Hi All, >> >> I am using v4.0.1. >> >> This code: (map caadr localdefs) >> >> Produces this error: >> >> mcar: expects argument of type ; given # >> >> My code does not use mcar anywhere. I must assume it has to do with >> the implementation of map (?). >> >> Any pointers much appreciated. >> >> Cheers, >> >> Marco >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From pltscheme at pnkfx.org Thu Jul 3 15:28:17 2008 From: pltscheme at pnkfx.org (Felix Klock's PLT scheme proxy) Date: Thu Mar 26 02:22:17 2009 Subject: [plt-scheme] Question about map In-Reply-To: <7F10FC01-3FBE-4A2F-B840-14A8D6403B06@pnkfx.org> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> <7F10FC01-3FBE-4A2F-B840-14A8D6403B06@pnkfx.org> Message-ID: On Jul 3, 2008, at 3:26 PM, Felix Klock's PLT scheme proxy wrote: > > Marco failed to indicate what language is working in. > > I was able to create a similar problem this way: Oops, sorry, please ignore that msg. -Felix From robby at cs.uchicago.edu Thu Jul 3 15:28:24 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:17 2009 Subject: [plt-scheme] Question about map In-Reply-To: <7F10FC01-3FBE-4A2F-B840-14A8D6403B06@pnkfx.org> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> <7F10FC01-3FBE-4A2F-B840-14A8D6403B06@pnkfx.org> Message-ID: <932b2f1f0807031228p65ebf81dj16fad5ff98661d6b@mail.gmail.com> I think that's a different problem. If you do this: #lang r5rs (map caadr (list '(lambda (x) x))) it seems to work fine. Robby On Thu, Jul 3, 2008 at 2:26 PM, Felix Klock's PLT scheme proxy wrote: > Robby- > > Marco failed to indicate what language is working in. > > I was able to create a similar problem this way: > > #lang r5rs > (map caadr '(lambda (x) x)) > > -Felix > > On Jul 3, 2008, at 3:20 PM, Robby Findler wrote: > >> Someone else might be able to guess the right thing here, but I'd need >> more info to help. For example, this works fine: >> >> #lang scheme >> (define localdefs (list '(lambda (x) x))) >> (map caadr localdefs) >> >> Robby >> >> On Thu, Jul 3, 2008 at 2:16 PM, Marco Morazan wrote: >>> >>> Hi All, >>> >>> I am using v4.0.1. >>> >>> This code: (map caadr localdefs) >>> >>> Produces this error: >>> >>> mcar: expects argument of type ; given # >>> >>> My code does not use mcar anywhere. I must assume it has to do with >>> the implementation of map (?). >>> >>> Any pointers much appreciated. >>> >>> Cheers, >>> >>> Marco >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > > From morazanm at gmail.com Thu Jul 3 15:28:38 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:22:18 2009 Subject: [plt-scheme] Question about map In-Reply-To: <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> Message-ID: <9b1fff280807031228s18ee41c8ka862e690e9bae89@mail.gmail.com> Version: Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. Language: Essentials of Programming Languages (2nd ed.); memory limit: 128 megabytes. My code works fine in v372. Marco On Thu, Jul 3, 2008 at 3:20 PM, Robby Findler wrote: > Someone else might be able to guess the right thing here, but I'd need > more info to help. For example, this works fine: > > #lang scheme > (define localdefs (list '(lambda (x) x))) > (map caadr localdefs) > > Robby > > On Thu, Jul 3, 2008 at 2:16 PM, Marco Morazan wrote: >> Hi All, >> >> I am using v4.0.1. >> >> This code: (map caadr localdefs) >> >> Produces this error: >> >> mcar: expects argument of type ; given # >> >> My code does not use mcar anywhere. I must assume it has to do with >> the implementation of map (?). >> >> Any pointers much appreciated. >> >> Cheers, >> >> Marco >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > From robby at cs.uchicago.edu Thu Jul 3 15:32:49 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:18 2009 Subject: [plt-scheme] Question about map In-Reply-To: <9b1fff280807031228s18ee41c8ka862e690e9bae89@mail.gmail.com> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> <9b1fff280807031228s18ee41c8ka862e690e9bae89@mail.gmail.com> Message-ID: <932b2f1f0807031232t61033b45q565db09a18cc0a33@mail.gmail.com> AFAICT, EoPL works fine with the basic example you're giving. I'm still not able to divine what is going wrong: Welcome to DrScheme, version 4.0.1.3-svn2jul2008 [3m]. Language: Essentials of Programming Languages (2nd ed.); memory limit: 128 megabytes. > (map caadr (list '(lambda (x) x))) (x) > Sorry if this is too much trouble for you to figure out yourself and sorry that I'm not being much help. I'll someone else answer for a while now. Robby On Thu, Jul 3, 2008 at 2:28 PM, Marco Morazan wrote: > Version: > > Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. > Language: Essentials of Programming Languages (2nd ed.); memory limit: > 128 megabytes. > > My code works fine in v372. > > Marco > > On Thu, Jul 3, 2008 at 3:20 PM, Robby Findler wrote: >> Someone else might be able to guess the right thing here, but I'd need >> more info to help. For example, this works fine: >> >> #lang scheme >> (define localdefs (list '(lambda (x) x))) >> (map caadr localdefs) >> >> Robby >> >> On Thu, Jul 3, 2008 at 2:16 PM, Marco Morazan wrote: >>> Hi All, >>> >>> I am using v4.0.1. >>> >>> This code: (map caadr localdefs) >>> >>> Produces this error: >>> >>> mcar: expects argument of type ; given # >>> >>> My code does not use mcar anywhere. I must assume it has to do with >>> the implementation of map (?). >>> >>> Any pointers much appreciated. >>> >>> Cheers, >>> >>> Marco >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> >> > > From mark.engelberg at gmail.com Thu Jul 3 15:42:20 2008 From: mark.engelberg at gmail.com (Mark Engelberg) Date: Thu Mar 26 02:22:18 2009 Subject: [plt-scheme] Another performance question Message-ID: If I'm making a bunch of shortcuts like: (define vr vector-ref) is this going to mess with the performance of the JIT compiler or other compilation phases? Is it better to make it an identifier macro? --Mark From m.douglas.williams at gmail.com Thu Jul 3 15:42:38 2008 From: m.douglas.williams at gmail.com (Doug Williams) Date: Thu Mar 26 02:22:19 2009 Subject: [plt-scheme] Problems with eval In-Reply-To: <18541.9815.161192.216446@arabic.ccs.neu.edu> References: <486D14F7.3060508@cs.utah.edu> <486D1814.9070601@cs.utah.edu> <932b2f1f0807031134x1aa207a2s8893563c59730846@mail.gmail.com> <18541.9815.161192.216446@arabic.ccs.neu.edu> Message-ID: The (namespace-require 'scheme/base) worked fine. Is there any advantage/disadvantage to using the private namespace as Eli suggested? On Thu, Jul 3, 2008 at 1:19 PM, Eli Barzilay wrote: > On Jul 3, Robby Findler wrote: > > This is not a bug. > > > > The top-level namespace (ie the part of the namespace that deals > > with code outside modules) for the module language does not have any > > bindings. You have to initialize it with some if you want to use > > them. > > > > It would be better to avoid eval (as has been mentioned a few times > > on this list) but on the assumption that eval is truely necessary, > > try this: > > > > #lang scheme > > (namespace-require 'scheme/base) > > (eval '((lambda (x) x) 1)) > > > > Without the second line, the third one won't work, but with it, it > > does. > > You can also use a private namespace > > #lang scheme > (define ns (make-base-namespace)) > (eval '((lambda (x) x) 1) ns) > > or even better, you can use the namespace of the current module: > > #lang scheme > (define-namespace-anchor anchor) > (eval '((lambda (x) x) 1) (namespace-anchor->namespace anchor)) > > and you can even do this now: > > #lang scheme > (define-namespace-anchor anchor) > (define c 1) > (eval '((lambda (x) x) c) (namespace-anchor->namespace anchor)) > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://www.barzilay.org/ Maze is Life! > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080703/f51b982c/attachment.html From eli at barzilay.org Thu Jul 3 15:45:11 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:19 2009 Subject: [plt-scheme] Question about map In-Reply-To: <932b2f1f0807031232t61033b45q565db09a18cc0a33@mail.gmail.com> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> <9b1fff280807031228s18ee41c8ka862e690e9bae89@mail.gmail.com> <932b2f1f0807031232t61033b45q565db09a18cc0a33@mail.gmail.com> Message-ID: <18541.11335.901150.355273@arabic.ccs.neu.edu> On Jul 3, Robby Findler wrote: > AFAICT, EoPL works fine with the basic example you're giving. I'm > still not able to divine what is going wrong: > > Welcome to DrScheme, version 4.0.1.3-svn2jul2008 [3m]. > Language: Essentials of Programming Languages (2nd ed.); memory limit: > 128 megabytes. > > (map caadr (list '(lambda (x) x))) > (x) My guess is that there are two problems here: the first is that `map' is bound to `mmap', and `caadr' is bound to a function that composes `mcar' and `mcdr' -- and these make error messages confusing Marco here: > >>> My code does not use mcar anywhere. I must assume it has to do > >>> with the implementation of map (?). But the real problem is elsewhere: > >>> This code: (map caadr localdefs) > >>> > >>> Produces this error: > >>> > >>> mcar: expects argument of type ; given > >>> # You must have some `undefined' value somewhere, and that's probably due something that changed in the language. (And because of the above the error message doesn't help.) To find the bad value I'd start with (map (lambda (x) (if (and (pair? x) (pair? (cdr x)) (pair? (cadr x))) (caadr x) (error 'blah "~s" x))) localdefs) and go on from there. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Thu Jul 3 15:47:51 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:19 2009 Subject: [plt-scheme] Problems with eval In-Reply-To: References: <486D14F7.3060508@cs.utah.edu> <486D1814.9070601@cs.utah.edu> <932b2f1f0807031134x1aa207a2s8893563c59730846@mail.gmail.com> <18541.9815.161192.216446@arabic.ccs.neu.edu> Message-ID: <18541.11495.128870.761856@arabic.ccs.neu.edu> On Jul 3, Doug Williams wrote: > The (namespace-require 'scheme/base) worked fine. Is there any > advantage/disadvantage to using the private namespace as Eli > suggested? It depends on what you need. The `namespace-require' modifies the global namespace, the `make-base-namespace' creates a private namespace that you can use for a single purpose, and the anchor makes sure that the evaluation happens in the same language your module is written in as well as making local bindings accessible in code that you evaluate. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From matthias at ccs.neu.edu Thu Jul 3 15:54:01 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:22:19 2009 Subject: [plt-scheme] Another performance question In-Reply-To: References: Message-ID: <44F4C318-B29E-4DA0-830B-DFCC7DEE093C@ccs.neu.edu> Use a module and you'll be fine. On Jul 3, 2008, at 3:42 PM, Mark Engelberg wrote: > If I'm making a bunch of shortcuts like: > (define vr vector-ref) > > is this going to mess with the performance of the JIT compiler or > other compilation phases? > > Is it better to make it an identifier macro? > > --Mark > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From m.douglas.williams at gmail.com Thu Jul 3 16:09:14 2008 From: m.douglas.williams at gmail.com (Doug Williams) Date: Thu Mar 26 02:22:20 2009 Subject: [plt-scheme] Problems with eval In-Reply-To: <18541.11495.128870.761856@arabic.ccs.neu.edu> References: <486D14F7.3060508@cs.utah.edu> <486D1814.9070601@cs.utah.edu> <932b2f1f0807031134x1aa207a2s8893563c59730846@mail.gmail.com> <18541.9815.161192.216446@arabic.ccs.neu.edu> <18541.11495.128870.761856@arabic.ccs.neu.edu> Message-ID: Based on that, I think that the make-namespace-anchor is what I need - I tried it and it works. It sounds like that would allow my constraints to contain local variables, which is a good thing. [Note, my current examples don't do that, but I will come up with something that does.] On Thu, Jul 3, 2008 at 1:47 PM, Eli Barzilay wrote: > On Jul 3, Doug Williams wrote: > > The (namespace-require 'scheme/base) worked fine. Is there any > > advantage/disadvantage to using the private namespace as Eli > > suggested? > > It depends on what you need. The `namespace-require' modifies the > global namespace, the `make-base-namespace' creates a private > namespace that you can use for a single purpose, and the anchor makes > sure that the evaluation happens in the same language your module is > written in as well as making local bindings accessible in code that > you evaluate. > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://www.barzilay.org/ Maze is Life! > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080703/469ca9f6/attachment.htm From morazanm at gmail.com Thu Jul 3 16:38:40 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:22:20 2009 Subject: [plt-scheme] Question about map In-Reply-To: <18541.11335.901150.355273@arabic.ccs.neu.edu> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> <9b1fff280807031228s18ee41c8ka862e690e9bae89@mail.gmail.com> <932b2f1f0807031232t61033b45q565db09a18cc0a33@mail.gmail.com> <18541.11335.901150.355273@arabic.ccs.neu.edu> Message-ID: <9b1fff280807031338u5741355bw4c2d8dc2a226c363@mail.gmail.com> Hi All, I am a bit baffled. I have reproduced below a simplified example of my rather large piece of software that produces the same error. (define F '(define (f x) (+ x x))) (define (all-but-last datum) (if (null? (cdr datum)) '() (cons (car datum) (all-but-last (cdr datum))))) (define (parse-test datum) (letrec ((fname (caadr datum)) (params (cdadr datum)) (localdefs (all-but-last (cddr datum))) (localdefs-names (map caadr localdefs))) 'ok)) With the above I get: Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. Language: Essentials of Programming Languages (2nd ed.); memory limit: 128 megabytes. > (all-but-last (cddr F)) () > (map caadr (all-but-last (cddr F))) () > (parse-test F) . . mcar: expects argument of type ; given # > As far as I can tell, (map caadr (all-but-last (cddr F))) and (parse-test F) should yield the same result and (parse-test F) should yield 'ok. Now, here are the results with v372: Welcome to DrScheme, version 372 [3m]. Language: Essentials of Programming Languages (2nd ed.). > (all-but-last (cddr F)) () > (map caadr (all-but-last (cddr F))) () > (parse-test F) ok > I think Eli is onto something. When I display the value of localdefs in v4.0.1 it is # while in v372 it is (). I really hope I am missing something trivial and that I will have one of those DUH! moments soon. In the meantime, I am really baffled. Once again, any pointers would be appreciated. Cheers, Marco On Thu, Jul 3, 2008 at 3:45 PM, Eli Barzilay wrote: > On Jul 3, Robby Findler wrote: >> AFAICT, EoPL works fine with the basic example you're giving. I'm >> still not able to divine what is going wrong: >> >> Welcome to DrScheme, version 4.0.1.3-svn2jul2008 [3m]. >> Language: Essentials of Programming Languages (2nd ed.); memory limit: >> 128 megabytes. >> > (map caadr (list '(lambda (x) x))) >> (x) > > My guess is that there are two problems here: the first is that `map' > is bound to `mmap', and `caadr' is bound to a function that composes > `mcar' and `mcdr' -- and these make error messages confusing Marco > here: > >> >>> My code does not use mcar anywhere. I must assume it has to do >> >>> with the implementation of map (?). > > > > But the real problem is elsewhere: > >> >>> This code: (map caadr localdefs) >> >>> >> >>> Produces this error: >> >>> >> >>> mcar: expects argument of type ; given >> >>> # > > You must have some `undefined' value somewhere, and that's probably > due something that changed in the language. (And because of the above > the error message doesn't help.) > > To find the bad value I'd start with > > (map (lambda (x) > (if (and (pair? x) (pair? (cdr x)) (pair? (cadr x))) > (caadr x) > (error 'blah "~s" x))) > localdefs) > > and go on from there. > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://www.barzilay.org/ Maze is Life! > From pltscheme at pnkfx.org Thu Jul 3 16:45:23 2008 From: pltscheme at pnkfx.org (Felix Klock's PLT scheme proxy) Date: Thu Mar 26 02:22:20 2009 Subject: [plt-scheme] Question about map In-Reply-To: <9b1fff280807031338u5741355bw4c2d8dc2a226c363@mail.gmail.com> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> <9b1fff280807031228s18ee41c8ka862e690e9bae89@mail.gmail.com> <932b2f1f0807031232t61033b45q565db09a18cc0a33@mail.gmail.com> <18541.11335.901150.355273@arabic.ccs.neu.edu> <9b1fff280807031338u5741355bw4c2d8dc2a226c363@mail.gmail.com> Message-ID: <75AEB1FB-6EE1-4C9B-8631-89A4C9E63469@pnkfx.org> I think you are misusing letrec. Try a let* instead. -Felix On Jul 3, 2008, at 4:38 PM, Marco Morazan wrote: > Hi All, > > I am a bit baffled. I have reproduced below a simplified example of my > rather large piece of software that produces the same error. > > (define F '(define (f x) (+ x x))) > > (define (all-but-last datum) > (if (null? (cdr datum)) > '() > (cons (car datum) (all-but-last (cdr datum))))) > > (define (parse-test datum) > (letrec ((fname (caadr datum)) > (params (cdadr datum)) > (localdefs (all-but-last (cddr datum))) > (localdefs-names (map caadr localdefs))) > 'ok)) > > With the above I get: > > Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. > Language: Essentials of Programming Languages (2nd ed.); memory limit: > 128 megabytes. >> (all-but-last (cddr F)) > () >> (map caadr (all-but-last (cddr F))) > () >> (parse-test F) > . . mcar: expects argument of type ; given # >> > > As far as I can tell, (map caadr (all-but-last (cddr F))) and > (parse-test F) should yield the same result and (parse-test F) should > yield 'ok. > > Now, here are the results with v372: > > Welcome to DrScheme, version 372 [3m]. > Language: Essentials of Programming Languages (2nd ed.). >> (all-but-last (cddr F)) > () >> (map caadr (all-but-last (cddr F))) > () >> (parse-test F) > ok >> > > I think Eli is onto something. When I display the value of localdefs > in v4.0.1 it is # while in v372 it is (). > > I really hope I am missing something trivial and that I will have one > of those DUH! moments soon. In the meantime, I am really baffled. > > Once again, any pointers would be appreciated. > > Cheers, > > Marco > > > On Thu, Jul 3, 2008 at 3:45 PM, Eli Barzilay wrote: >> On Jul 3, Robby Findler wrote: >>> AFAICT, EoPL works fine with the basic example you're giving. I'm >>> still not able to divine what is going wrong: >>> >>> Welcome to DrScheme, version 4.0.1.3-svn2jul2008 [3m]. >>> Language: Essentials of Programming Languages (2nd ed.); memory >>> limit: >>> 128 megabytes. >>>> (map caadr (list '(lambda (x) x))) >>> (x) >> >> My guess is that there are two problems here: the first is that `map' >> is bound to `mmap', and `caadr' is bound to a function that composes >> `mcar' and `mcdr' -- and these make error messages confusing Marco >> here: >> >>>>>> My code does not use mcar anywhere. I must assume it has to do >>>>>> with the implementation of map (?). >> >> >> >> But the real problem is elsewhere: >> >>>>>> This code: (map caadr localdefs) >>>>>> >>>>>> Produces this error: >>>>>> >>>>>> mcar: expects argument of type ; given >>>>>> # >> >> You must have some `undefined' value somewhere, and that's probably >> due something that changed in the language. (And because of the >> above >> the error message doesn't help.) >> >> To find the bad value I'd start with >> >> (map (lambda (x) >> (if (and (pair? x) (pair? (cdr x)) (pair? (cadr x))) >> (caadr x) >> (error 'blah "~s" x))) >> localdefs) >> >> and go on from there. >> >> -- >> ((lambda (x) (x x)) (lambda (x) (x x))) Eli >> Barzilay: >> http://www.barzilay.org/ Maze is >> Life! >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From matthias at ccs.neu.edu Thu Jul 3 16:46:24 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:22:20 2009 Subject: [plt-scheme] Question about map In-Reply-To: <9b1fff280807031338u5741355bw4c2d8dc2a226c363@mail.gmail.com> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> <9b1fff280807031228s18ee41c8ka862e690e9bae89@mail.gmail.com> <932b2f1f0807031232t61033b45q565db09a18cc0a33@mail.gmail.com> <18541.11335.901150.355273@arabic.ccs.neu.edu> <9b1fff280807031338u5741355bw4c2d8dc2a226c363@mail.gmail.com> Message-ID: <92998F77-CEFD-4E0B-95E9-2BE6B8BD4AEB@ccs.neu.edu> Step through the macro expansion of the letrec. It looks like the left-to-right evaluation order is messed up. On Jul 3, 2008, at 4:38 PM, Marco Morazan wrote: > Hi All, > > I am a bit baffled. I have reproduced below a simplified example of my > rather large piece of software that produces the same error. > > (define F '(define (f x) (+ x x))) > > (define (all-but-last datum) > (if (null? (cdr datum)) > '() > (cons (car datum) (all-but-last (cdr datum))))) > > (define (parse-test datum) > (letrec ((fname (caadr datum)) > (params (cdadr datum)) > (localdefs (all-but-last (cddr datum))) > (localdefs-names (map caadr localdefs))) > 'ok)) > > With the above I get: > > Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. > Language: Essentials of Programming Languages (2nd ed.); memory limit: > 128 megabytes. >> (all-but-last (cddr F)) > () >> (map caadr (all-but-last (cddr F))) > () >> (parse-test F) > . . mcar: expects argument of type ; given # >> > > As far as I can tell, (map caadr (all-but-last (cddr F))) and > (parse-test F) should yield the same result and (parse-test F) should > yield 'ok. > > Now, here are the results with v372: > > Welcome to DrScheme, version 372 [3m]. > Language: Essentials of Programming Languages (2nd ed.). >> (all-but-last (cddr F)) > () >> (map caadr (all-but-last (cddr F))) > () >> (parse-test F) > ok >> > > I think Eli is onto something. When I display the value of localdefs > in v4.0.1 it is # while in v372 it is (). > > I really hope I am missing something trivial and that I will have one > of those DUH! moments soon. In the meantime, I am really baffled. > > Once again, any pointers would be appreciated. > > Cheers, > > Marco > > > On Thu, Jul 3, 2008 at 3:45 PM, Eli Barzilay wrote: >> On Jul 3, Robby Findler wrote: >>> AFAICT, EoPL works fine with the basic example you're giving. I'm >>> still not able to divine what is going wrong: >>> >>> Welcome to DrScheme, version 4.0.1.3-svn2jul2008 [3m]. >>> Language: Essentials of Programming Languages (2nd ed.); memory >>> limit: >>> 128 megabytes. >>>> (map caadr (list '(lambda (x) x))) >>> (x) >> >> My guess is that there are two problems here: the first is that `map' >> is bound to `mmap', and `caadr' is bound to a function that composes >> `mcar' and `mcdr' -- and these make error messages confusing Marco >> here: >> >>>>>> My code does not use mcar anywhere. I must assume it has to do >>>>>> with the implementation of map (?). >> >> >> >> But the real problem is elsewhere: >> >>>>>> This code: (map caadr localdefs) >>>>>> >>>>>> Produces this error: >>>>>> >>>>>> mcar: expects argument of type ; given >>>>>> # >> >> You must have some `undefined' value somewhere, and that's probably >> due something that changed in the language. (And because of the >> above >> the error message doesn't help.) >> >> To find the bad value I'd start with >> >> (map (lambda (x) >> (if (and (pair? x) (pair? (cdr x)) (pair? (cadr x))) >> (caadr x) >> (error 'blah "~s" x))) >> localdefs) >> >> and go on from there. >> >> -- >> ((lambda (x) (x x)) (lambda (x) (x x))) Eli >> Barzilay: >> http://www.barzilay.org/ Maze is >> Life! >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From morazanm at gmail.com Thu Jul 3 16:56:25 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:22:20 2009 Subject: [plt-scheme] Question about map In-Reply-To: <75AEB1FB-6EE1-4C9B-8631-89A4C9E63469@pnkfx.org> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> <9b1fff280807031228s18ee41c8ka862e690e9bae89@mail.gmail.com> <932b2f1f0807031232t61033b45q565db09a18cc0a33@mail.gmail.com> <18541.11335.901150.355273@arabic.ccs.neu.edu> <9b1fff280807031338u5741355bw4c2d8dc2a226c363@mail.gmail.com> <75AEB1FB-6EE1-4C9B-8631-89A4C9E63469@pnkfx.org> Message-ID: <9b1fff280807031356v4ff3bd9fxdd6faf6c436397de@mail.gmail.com> How so? On Thu, Jul 3, 2008 at 4:45 PM, Felix Klock's PLT scheme proxy wrote: > I think you are misusing letrec. > > Try a let* instead. > > -Felix > > On Jul 3, 2008, at 4:38 PM, Marco Morazan wrote: > >> Hi All, >> >> I am a bit baffled. I have reproduced below a simplified example of my >> rather large piece of software that produces the same error. >> >> (define F '(define (f x) (+ x x))) >> >> (define (all-but-last datum) >> (if (null? (cdr datum)) >> '() >> (cons (car datum) (all-but-last (cdr datum))))) >> >> (define (parse-test datum) >> (letrec ((fname (caadr datum)) >> (params (cdadr datum)) >> (localdefs (all-but-last (cddr datum))) >> (localdefs-names (map caadr localdefs))) >> 'ok)) >> >> With the above I get: >> >> Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. >> Language: Essentials of Programming Languages (2nd ed.); memory limit: >> 128 megabytes. >>> >>> (all-but-last (cddr F)) >> >> () >>> >>> (map caadr (all-but-last (cddr F))) >> >> () >>> >>> (parse-test F) >> >> . . mcar: expects argument of type ; given # >>> >> >> As far as I can tell, (map caadr (all-but-last (cddr F))) and >> (parse-test F) should yield the same result and (parse-test F) should >> yield 'ok. >> >> Now, here are the results with v372: >> >> Welcome to DrScheme, version 372 [3m]. >> Language: Essentials of Programming Languages (2nd ed.). >>> >>> (all-but-last (cddr F)) >> >> () >>> >>> (map caadr (all-but-last (cddr F))) >> >> () >>> >>> (parse-test F) >> >> ok >>> >> >> I think Eli is onto something. When I display the value of localdefs >> in v4.0.1 it is # while in v372 it is (). >> >> I really hope I am missing something trivial and that I will have one >> of those DUH! moments soon. In the meantime, I am really baffled. >> >> Once again, any pointers would be appreciated. >> >> Cheers, >> >> Marco >> >> >> On Thu, Jul 3, 2008 at 3:45 PM, Eli Barzilay wrote: >>> >>> On Jul 3, Robby Findler wrote: >>>> >>>> AFAICT, EoPL works fine with the basic example you're giving. I'm >>>> still not able to divine what is going wrong: >>>> >>>> Welcome to DrScheme, version 4.0.1.3-svn2jul2008 [3m]. >>>> Language: Essentials of Programming Languages (2nd ed.); memory limit: >>>> 128 megabytes. >>>>> >>>>> (map caadr (list '(lambda (x) x))) >>>> >>>> (x) >>> >>> My guess is that there are two problems here: the first is that `map' >>> is bound to `mmap', and `caadr' is bound to a function that composes >>> `mcar' and `mcdr' -- and these make error messages confusing Marco >>> here: >>> >>>>>>> My code does not use mcar anywhere. I must assume it has to do >>>>>>> with the implementation of map (?). >>> >>> >>> >>> But the real problem is elsewhere: >>> >>>>>>> This code: (map caadr localdefs) >>>>>>> >>>>>>> Produces this error: >>>>>>> >>>>>>> mcar: expects argument of type ; given >>>>>>> # >>> >>> You must have some `undefined' value somewhere, and that's probably >>> due something that changed in the language. (And because of the above >>> the error message doesn't help.) >>> >>> To find the bad value I'd start with >>> >>> (map (lambda (x) >>> (if (and (pair? x) (pair? (cdr x)) (pair? (cadr x))) >>> (caadr x) >>> (error 'blah "~s" x))) >>> localdefs) >>> >>> and go on from there. >>> >>> -- >>> ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: >>> http://www.barzilay.org/ Maze is Life! >>> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From morazanm at gmail.com Thu Jul 3 16:57:00 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:22:21 2009 Subject: [plt-scheme] Question about map In-Reply-To: <92998F77-CEFD-4E0B-95E9-2BE6B8BD4AEB@ccs.neu.edu> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> <9b1fff280807031228s18ee41c8ka862e690e9bae89@mail.gmail.com> <932b2f1f0807031232t61033b45q565db09a18cc0a33@mail.gmail.com> <18541.11335.901150.355273@arabic.ccs.neu.edu> <9b1fff280807031338u5741355bw4c2d8dc2a226c363@mail.gmail.com> <92998F77-CEFD-4E0B-95E9-2BE6B8BD4AEB@ccs.neu.edu> Message-ID: <9b1fff280807031357q1a89d179tc235b5ac09ac1282@mail.gmail.com> OK, so this looks like a bug to you? --Marco On Thu, Jul 3, 2008 at 4:46 PM, Matthias Felleisen wrote: > > Step through the macro expansion of the letrec. It looks like the > left-to-right evaluation order is messed up. > > > On Jul 3, 2008, at 4:38 PM, Marco Morazan wrote: > >> Hi All, >> >> I am a bit baffled. I have reproduced below a simplified example of my >> rather large piece of software that produces the same error. >> >> (define F '(define (f x) (+ x x))) >> >> (define (all-but-last datum) >> (if (null? (cdr datum)) >> '() >> (cons (car datum) (all-but-last (cdr datum))))) >> >> (define (parse-test datum) >> (letrec ((fname (caadr datum)) >> (params (cdadr datum)) >> (localdefs (all-but-last (cddr datum))) >> (localdefs-names (map caadr localdefs))) >> 'ok)) >> >> With the above I get: >> >> Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. >> Language: Essentials of Programming Languages (2nd ed.); memory limit: >> 128 megabytes. >>> >>> (all-but-last (cddr F)) >> >> () >>> >>> (map caadr (all-but-last (cddr F))) >> >> () >>> >>> (parse-test F) >> >> . . mcar: expects argument of type ; given # >>> >> >> As far as I can tell, (map caadr (all-but-last (cddr F))) and >> (parse-test F) should yield the same result and (parse-test F) should >> yield 'ok. >> >> Now, here are the results with v372: >> >> Welcome to DrScheme, version 372 [3m]. >> Language: Essentials of Programming Languages (2nd ed.). >>> >>> (all-but-last (cddr F)) >> >> () >>> >>> (map caadr (all-but-last (cddr F))) >> >> () >>> >>> (parse-test F) >> >> ok >>> >> >> I think Eli is onto something. When I display the value of localdefs >> in v4.0.1 it is # while in v372 it is (). >> >> I really hope I am missing something trivial and that I will have one >> of those DUH! moments soon. In the meantime, I am really baffled. >> >> Once again, any pointers would be appreciated. >> >> Cheers, >> >> Marco >> >> >> On Thu, Jul 3, 2008 at 3:45 PM, Eli Barzilay wrote: >>> >>> On Jul 3, Robby Findler wrote: >>>> >>>> AFAICT, EoPL works fine with the basic example you're giving. I'm >>>> still not able to divine what is going wrong: >>>> >>>> Welcome to DrScheme, version 4.0.1.3-svn2jul2008 [3m]. >>>> Language: Essentials of Programming Languages (2nd ed.); memory limit: >>>> 128 megabytes. >>>>> >>>>> (map caadr (list '(lambda (x) x))) >>>> >>>> (x) >>> >>> My guess is that there are two problems here: the first is that `map' >>> is bound to `mmap', and `caadr' is bound to a function that composes >>> `mcar' and `mcdr' -- and these make error messages confusing Marco >>> here: >>> >>>>>>> My code does not use mcar anywhere. I must assume it has to do >>>>>>> with the implementation of map (?). >>> >>> >>> >>> But the real problem is elsewhere: >>> >>>>>>> This code: (map caadr localdefs) >>>>>>> >>>>>>> Produces this error: >>>>>>> >>>>>>> mcar: expects argument of type ; given >>>>>>> # >>> >>> You must have some `undefined' value somewhere, and that's probably >>> due something that changed in the language. (And because of the above >>> the error message doesn't help.) >>> >>> To find the bad value I'd start with >>> >>> (map (lambda (x) >>> (if (and (pair? x) (pair? (cdr x)) (pair? (cadr x))) >>> (caadr x) >>> (error 'blah "~s" x))) >>> localdefs) >>> >>> and go on from there. >>> >>> -- >>> ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: >>> http://www.barzilay.org/ Maze is Life! >>> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From robby at cs.uchicago.edu Thu Jul 3 17:03:27 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:21 2009 Subject: [plt-scheme] Question about map In-Reply-To: <9b1fff280807031357q1a89d179tc235b5ac09ac1282@mail.gmail.com> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> <9b1fff280807031228s18ee41c8ka862e690e9bae89@mail.gmail.com> <932b2f1f0807031232t61033b45q565db09a18cc0a33@mail.gmail.com> <18541.11335.901150.355273@arabic.ccs.neu.edu> <9b1fff280807031338u5741355bw4c2d8dc2a226c363@mail.gmail.com> <92998F77-CEFD-4E0B-95E9-2BE6B8BD4AEB@ccs.neu.edu> <9b1fff280807031357q1a89d179tc235b5ac09ac1282@mail.gmail.com> Message-ID: <932b2f1f0807031403r502eb16fo3905e539207014f5@mail.gmail.com> On Thu, Jul 3, 2008 at 3:57 PM, Marco Morazan wrote: > OK, so this looks like a bug to you? --Marco FWIW, it looks like one to me now: Welcome to DrScheme, version 4.0.2.3-svn2jul2008 [3m]. Language: Essentials of Programming Languages (2nd ed.); memory limit: 128 megabytes. > (letrec ([x 1][y x]) y) # That should be 1, not #. I see that in #lang scheme, it works properly, but in r6rs, it isn't. One could argue that this is the designers intent (and probably that's the case in the r6rs impl) but I don't think that the change in the EoPL language is intentional. Robby From pltscheme at pnkfx.org Thu Jul 3 17:06:11 2008 From: pltscheme at pnkfx.org (Felix Klock's PLT scheme proxy) Date: Thu Mar 26 02:22:21 2009 Subject: [plt-scheme] Question about map In-Reply-To: <9b1fff280807031356v4ff3bd9fxdd6faf6c436397de@mail.gmail.com> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> <9b1fff280807031228s18ee41c8ka862e690e9bae89@mail.gmail.com> <932b2f1f0807031232t61033b45q565db09a18cc0a33@mail.gmail.com> <18541.11335.901150.355273@arabic.ccs.neu.edu> <9b1fff280807031338u5741355bw4c2d8dc2a226c363@mail.gmail.com> <75AEB1FB-6EE1-4C9B-8631-89A4C9E63469@pnkfx.org> <9b1fff280807031356v4ff3bd9fxdd6faf6c436397de@mail.gmail.com> Message-ID: <8A95F7B3-978A-450B-9EC0-679FC5B0A365@pnkfx.org> Marco- I do not know whether the EOPL language is supposed to provide letrec* semantics or merely guarantee letrec semantics when a developer writes a letrec form. (I gather from Robby's later message that he would want the EOPL language to provide letrec* semantics for the letrec form.) If the EOPL language is supposed to provide letrec* semantics for the letrec form, then the code you have written is fine and Matthias assertion that the left-to-right evaluation order is messed up is correct. If the EOPL language is only supposed to provide letrec semantics for a (letrec (...) ...) form, then your code is at fault here, because the right-hand-side of your binding of localdefs-names is referring to localdefs. From my point of view, the code you have written does not *NEED* recursive binding structure here, only let* semantics. In the interest of making your code "as simple as possible, but no simpler" for the reader, I suggested that you switch the binding form to let* instead of letrec. If you continue to use letrec, that might work fine in a future version of PLT Scheme, but it means that people who read your code may ask themself "ooh, there's a letrec here, there must be something complex going on that requires recursive binding structure." But that is not the case -- you do need something more than a simple let-form, but you do not need to jump all the way to letrec*. To my mind, let* is the right form for the job you are trying to do in parse-test. (It could be that in the final application that you extracted this from, you do require recursive binding structure. In that case, you would probably want to use letrec* or something along those lines.) -Felix On Jul 3, 2008, at 4:56 PM, Marco Morazan wrote: > How so? > > On Thu, Jul 3, 2008 at 4:45 PM, Felix Klock's PLT scheme proxy > wrote: >> I think you are misusing letrec. >> >> Try a let* instead. >> >> -Felix >> >> On Jul 3, 2008, at 4:38 PM, Marco Morazan wrote: >> >>> Hi All, >>> >>> I am a bit baffled. I have reproduced below a simplified example >>> of my >>> rather large piece of software that produces the same error. >>> >>> (define F '(define (f x) (+ x x))) >>> >>> (define (all-but-last datum) >>> (if (null? (cdr datum)) >>> '() >>> (cons (car datum) (all-but-last (cdr datum))))) >>> >>> (define (parse-test datum) >>> (letrec ((fname (caadr datum)) >>> (params (cdadr datum)) >>> (localdefs (all-but-last (cddr datum))) >>> (localdefs-names (map caadr localdefs))) >>> 'ok)) >>> >>> With the above I get: >>> >>> Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. >>> Language: Essentials of Programming Languages (2nd ed.); memory >>> limit: >>> 128 megabytes. >>>> >>>> (all-but-last (cddr F)) >>> >>> () >>>> >>>> (map caadr (all-but-last (cddr F))) >>> >>> () >>>> >>>> (parse-test F) >>> >>> . . mcar: expects argument of type ; given >>> # >>>> >>> >>> As far as I can tell, (map caadr (all-but-last (cddr F))) and >>> (parse-test F) should yield the same result and (parse-test F) >>> should >>> yield 'ok. >>> >>> Now, here are the results with v372: >>> >>> Welcome to DrScheme, version 372 [3m]. >>> Language: Essentials of Programming Languages (2nd ed.). >>>> >>>> (all-but-last (cddr F)) >>> >>> () >>>> >>>> (map caadr (all-but-last (cddr F))) >>> >>> () >>>> >>>> (parse-test F) >>> >>> ok >>>> >>> >>> I think Eli is onto something. When I display the value of localdefs >>> in v4.0.1 it is # while in v372 it is (). >>> >>> I really hope I am missing something trivial and that I will have >>> one >>> of those DUH! moments soon. In the meantime, I am really baffled. >>> >>> Once again, any pointers would be appreciated. >>> >>> Cheers, >>> >>> Marco >>> >>> >>> On Thu, Jul 3, 2008 at 3:45 PM, Eli Barzilay >>> wrote: >>>> >>>> On Jul 3, Robby Findler wrote: >>>>> >>>>> AFAICT, EoPL works fine with the basic example you're giving. I'm >>>>> still not able to divine what is going wrong: >>>>> >>>>> Welcome to DrScheme, version 4.0.1.3-svn2jul2008 [3m]. >>>>> Language: Essentials of Programming Languages (2nd ed.); memory >>>>> limit: >>>>> 128 megabytes. >>>>>> >>>>>> (map caadr (list '(lambda (x) x))) >>>>> >>>>> (x) >>>> >>>> My guess is that there are two problems here: the first is that >>>> `map' >>>> is bound to `mmap', and `caadr' is bound to a function that >>>> composes >>>> `mcar' and `mcdr' -- and these make error messages confusing Marco >>>> here: >>>> >>>>>>>> My code does not use mcar anywhere. I must assume it has to do >>>>>>>> with the implementation of map (?). >>>> >>>> >>>> >>>> But the real problem is elsewhere: >>>> >>>>>>>> This code: (map caadr localdefs) >>>>>>>> >>>>>>>> Produces this error: >>>>>>>> >>>>>>>> mcar: expects argument of type ; given >>>>>>>> # >>>> >>>> You must have some `undefined' value somewhere, and that's probably >>>> due something that changed in the language. (And because of the >>>> above >>>> the error message doesn't help.) >>>> >>>> To find the bad value I'd start with >>>> >>>> (map (lambda (x) >>>> (if (and (pair? x) (pair? (cdr x)) (pair? (cadr x))) >>>> (caadr x) >>>> (error 'blah "~s" x))) >>>> localdefs) >>>> >>>> and go on from there. >>>> >>>> -- >>>> ((lambda (x) (x x)) (lambda (x) (x x))) Eli >>>> Barzilay: >>>> http://www.barzilay.org/ Maze is >>>> Life! >>>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> From matthias at ccs.neu.edu Thu Jul 3 17:04:04 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:22:21 2009 Subject: [plt-scheme] Question about map In-Reply-To: <9b1fff280807031356v4ff3bd9fxdd6faf6c436397de@mail.gmail.com> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> <9b1fff280807031228s18ee41c8ka862e690e9bae89@mail.gmail.com> <932b2f1f0807031232t61033b45q565db09a18cc0a33@mail.gmail.com> <18541.11335.901150.355273@arabic.ccs.neu.edu> <9b1fff280807031338u5741355bw4c2d8dc2a226c363@mail.gmail.com> <75AEB1FB-6EE1-4C9B-8631-89A4C9E63469@pnkfx.org> <9b1fff280807031356v4ff3bd9fxdd6faf6c436397de@mail.gmail.com> Message-ID: <53271859-6A20-4431-B6A2-EF1721DA65C1@ccs.neu.edu> Felix is proposing a fix to your program logic. Because your program is using the bindings in a sequential manner, (let* ([fname ...] ...) ...) will do fine. In Scheme, letrec is the construct for mutually recursive bindings, and you're not declaring anything of this kind. I am conjecturing that, even though PLT Scheme's letrec promises a behavior for your letrec expression that is like the one for an equivalent let* expression, something in 4.0's expansion is failing this promise. (Technically, what is failing is a promise between the run-time system and your module. (I believe that) If we had pervasive contracts, we could issue a better error message, even if the error that you see is caused by an internal error.) -- Matthias On Jul 3, 2008, at 4:56 PM, Marco Morazan wrote: > How so? > > On Thu, Jul 3, 2008 at 4:45 PM, Felix Klock's PLT scheme proxy > wrote: >> I think you are misusing letrec. >> >> Try a let* instead. >> >> -Felix >> >> On Jul 3, 2008, at 4:38 PM, Marco Morazan wrote: >> >>> Hi All, >>> >>> I am a bit baffled. I have reproduced below a simplified example >>> of my >>> rather large piece of software that produces the same error. >>> >>> (define F '(define (f x) (+ x x))) >>> >>> (define (all-but-last datum) >>> (if (null? (cdr datum)) >>> '() >>> (cons (car datum) (all-but-last (cdr datum))))) >>> >>> (define (parse-test datum) >>> (letrec ((fname (caadr datum)) >>> (params (cdadr datum)) >>> (localdefs (all-but-last (cddr datum))) >>> (localdefs-names (map caadr localdefs))) >>> 'ok)) >>> >>> With the above I get: >>> >>> Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. >>> Language: Essentials of Programming Languages (2nd ed.); memory >>> limit: >>> 128 megabytes. >>>> >>>> (all-but-last (cddr F)) >>> >>> () >>>> >>>> (map caadr (all-but-last (cddr F))) >>> >>> () >>>> >>>> (parse-test F) >>> >>> . . mcar: expects argument of type ; given >>> # >>>> >>> >>> As far as I can tell, (map caadr (all-but-last (cddr F))) and >>> (parse-test F) should yield the same result and (parse-test F) >>> should >>> yield 'ok. >>> >>> Now, here are the results with v372: >>> >>> Welcome to DrScheme, version 372 [3m]. >>> Language: Essentials of Programming Languages (2nd ed.). >>>> >>>> (all-but-last (cddr F)) >>> >>> () >>>> >>>> (map caadr (all-but-last (cddr F))) >>> >>> () >>>> >>>> (parse-test F) >>> >>> ok >>>> >>> >>> I think Eli is onto something. When I display the value of localdefs >>> in v4.0.1 it is # while in v372 it is (). >>> >>> I really hope I am missing something trivial and that I will have >>> one >>> of those DUH! moments soon. In the meantime, I am really baffled. >>> >>> Once again, any pointers would be appreciated. >>> >>> Cheers, >>> >>> Marco >>> >>> >>> On Thu, Jul 3, 2008 at 3:45 PM, Eli Barzilay >>> wrote: >>>> >>>> On Jul 3, Robby Findler wrote: >>>>> >>>>> AFAICT, EoPL works fine with the basic example you're giving. I'm >>>>> still not able to divine what is going wrong: >>>>> >>>>> Welcome to DrScheme, version 4.0.1.3-svn2jul2008 [3m]. >>>>> Language: Essentials of Programming Languages (2nd ed.); memory >>>>> limit: >>>>> 128 megabytes. >>>>>> >>>>>> (map caadr (list '(lambda (x) x))) >>>>> >>>>> (x) >>>> >>>> My guess is that there are two problems here: the first is that >>>> `map' >>>> is bound to `mmap', and `caadr' is bound to a function that >>>> composes >>>> `mcar' and `mcdr' -- and these make error messages confusing Marco >>>> here: >>>> >>>>>>>> My code does not use mcar anywhere. I must assume it has to do >>>>>>>> with the implementation of map (?). >>>> >>>> >>>> >>>> But the real problem is elsewhere: >>>> >>>>>>>> This code: (map caadr localdefs) >>>>>>>> >>>>>>>> Produces this error: >>>>>>>> >>>>>>>> mcar: expects argument of type ; given >>>>>>>> # >>>> >>>> You must have some `undefined' value somewhere, and that's probably >>>> due something that changed in the language. (And because of the >>>> above >>>> the error message doesn't help.) >>>> >>>> To find the bad value I'd start with >>>> >>>> (map (lambda (x) >>>> (if (and (pair? x) (pair? (cdr x)) (pair? (cadr x))) >>>> (caadr x) >>>> (error 'blah "~s" x))) >>>> localdefs) >>>> >>>> and go on from there. >>>> >>>> -- >>>> ((lambda (x) (x x)) (lambda (x) (x x))) Eli >>>> Barzilay: >>>> http://www.barzilay.org/ Maze is >>>> Life! >>>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From robby at cs.uchicago.edu Thu Jul 3 17:10:11 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:21 2009 Subject: [plt-scheme] Question about map In-Reply-To: <8A95F7B3-978A-450B-9EC0-679FC5B0A365@pnkfx.org> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> <9b1fff280807031228s18ee41c8ka862e690e9bae89@mail.gmail.com> <932b2f1f0807031232t61033b45q565db09a18cc0a33@mail.gmail.com> <18541.11335.901150.355273@arabic.ccs.neu.edu> <9b1fff280807031338u5741355bw4c2d8dc2a226c363@mail.gmail.com> <75AEB1FB-6EE1-4C9B-8631-89A4C9E63469@pnkfx.org> <9b1fff280807031356v4ff3bd9fxdd6faf6c436397de@mail.gmail.com> <8A95F7B3-978A-450B-9EC0-679FC5B0A365@pnkfx.org> Message-ID: <932b2f1f0807031410l1316a256tee3327c6242a20c@mail.gmail.com> Just to clarify -- I would say that we don't want EoPL to change from v372 to 4.0.x and that's why I consider it a bug. (I agree that using a let is probably the thing Marco should do so he can move on with his life ;) Robby On Thu, Jul 3, 2008 at 4:06 PM, Felix Klock's PLT scheme proxy wrote: > Marco- > > I do not know whether the EOPL language is supposed to provide letrec* > semantics or merely guarantee letrec semantics when a developer writes a > letrec form. (I gather from Robby's later message that he would want the > EOPL language to provide letrec* semantics for the letrec form.) > > If the EOPL language is supposed to provide letrec* semantics for the letrec > form, then the code you have written is fine and Matthias assertion that the > left-to-right evaluation order is messed up is correct. > > If the EOPL language is only supposed to provide letrec semantics for a > (letrec (...) ...) form, then your code is at fault here, because the > right-hand-side of your binding of localdefs-names is referring to > localdefs. > > From my point of view, the code you have written does not *NEED* recursive > binding structure here, only let* semantics. In the interest of making your > code "as simple as possible, but no simpler" for the reader, I suggested > that you switch the binding form to let* instead of letrec. If you > continue to use letrec, that might work fine in a future version of PLT > Scheme, but it means that people who read your code may ask themself "ooh, > there's a letrec here, there must be something complex going on that > requires recursive binding structure." But that is not the case -- you do > need something more than a simple let-form, but you do not need to jump all > the way to letrec*. To my mind, let* is the right form for the job you are > trying to do in parse-test. > > (It could be that in the final application that you extracted this from, you > do require recursive binding structure. In that case, you would probably > want to use letrec* or something along those lines.) > > -Felix > > > On Jul 3, 2008, at 4:56 PM, Marco Morazan wrote: > >> How so? >> >> On Thu, Jul 3, 2008 at 4:45 PM, Felix Klock's PLT scheme proxy >> wrote: >>> >>> I think you are misusing letrec. >>> >>> Try a let* instead. >>> >>> -Felix >>> >>> On Jul 3, 2008, at 4:38 PM, Marco Morazan wrote: >>> >>>> Hi All, >>>> >>>> I am a bit baffled. I have reproduced below a simplified example of my >>>> rather large piece of software that produces the same error. >>>> >>>> (define F '(define (f x) (+ x x))) >>>> >>>> (define (all-but-last datum) >>>> (if (null? (cdr datum)) >>>> '() >>>> (cons (car datum) (all-but-last (cdr datum))))) >>>> >>>> (define (parse-test datum) >>>> (letrec ((fname (caadr datum)) >>>> (params (cdadr datum)) >>>> (localdefs (all-but-last (cddr datum))) >>>> (localdefs-names (map caadr localdefs))) >>>> 'ok)) >>>> >>>> With the above I get: >>>> >>>> Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. >>>> Language: Essentials of Programming Languages (2nd ed.); memory limit: >>>> 128 megabytes. >>>>> >>>>> (all-but-last (cddr F)) >>>> >>>> () >>>>> >>>>> (map caadr (all-but-last (cddr F))) >>>> >>>> () >>>>> >>>>> (parse-test F) >>>> >>>> . . mcar: expects argument of type ; given # >>>>> >>>> >>>> As far as I can tell, (map caadr (all-but-last (cddr F))) and >>>> (parse-test F) should yield the same result and (parse-test F) should >>>> yield 'ok. >>>> >>>> Now, here are the results with v372: >>>> >>>> Welcome to DrScheme, version 372 [3m]. >>>> Language: Essentials of Programming Languages (2nd ed.). >>>>> >>>>> (all-but-last (cddr F)) >>>> >>>> () >>>>> >>>>> (map caadr (all-but-last (cddr F))) >>>> >>>> () >>>>> >>>>> (parse-test F) >>>> >>>> ok >>>>> >>>> >>>> I think Eli is onto something. When I display the value of localdefs >>>> in v4.0.1 it is # while in v372 it is (). >>>> >>>> I really hope I am missing something trivial and that I will have one >>>> of those DUH! moments soon. In the meantime, I am really baffled. >>>> >>>> Once again, any pointers would be appreciated. >>>> >>>> Cheers, >>>> >>>> Marco >>>> >>>> >>>> On Thu, Jul 3, 2008 at 3:45 PM, Eli Barzilay wrote: >>>>> >>>>> On Jul 3, Robby Findler wrote: >>>>>> >>>>>> AFAICT, EoPL works fine with the basic example you're giving. I'm >>>>>> still not able to divine what is going wrong: >>>>>> >>>>>> Welcome to DrScheme, version 4.0.1.3-svn2jul2008 [3m]. >>>>>> Language: Essentials of Programming Languages (2nd ed.); memory limit: >>>>>> 128 megabytes. >>>>>>> >>>>>>> (map caadr (list '(lambda (x) x))) >>>>>> >>>>>> (x) >>>>> >>>>> My guess is that there are two problems here: the first is that `map' >>>>> is bound to `mmap', and `caadr' is bound to a function that composes >>>>> `mcar' and `mcdr' -- and these make error messages confusing Marco >>>>> here: >>>>> >>>>>>>>> My code does not use mcar anywhere. I must assume it has to do >>>>>>>>> with the implementation of map (?). >>>>> >>>>> >>>>> >>>>> But the real problem is elsewhere: >>>>> >>>>>>>>> This code: (map caadr localdefs) >>>>>>>>> >>>>>>>>> Produces this error: >>>>>>>>> >>>>>>>>> mcar: expects argument of type ; given >>>>>>>>> # >>>>> >>>>> You must have some `undefined' value somewhere, and that's probably >>>>> due something that changed in the language. (And because of the above >>>>> the error message doesn't help.) >>>>> >>>>> To find the bad value I'd start with >>>>> >>>>> (map (lambda (x) >>>>> (if (and (pair? x) (pair? (cdr x)) (pair? (cadr x))) >>>>> (caadr x) >>>>> (error 'blah "~s" x))) >>>>> localdefs) >>>>> >>>>> and go on from there. >>>>> >>>>> -- >>>>> ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: >>>>> http://www.barzilay.org/ Maze is Life! >>>>> >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> > > > From robby at cs.uchicago.edu Thu Jul 3 17:11:56 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:22 2009 Subject: [plt-scheme] Question about map In-Reply-To: <53271859-6A20-4431-B6A2-EF1721DA65C1@ccs.neu.edu> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> <9b1fff280807031228s18ee41c8ka862e690e9bae89@mail.gmail.com> <932b2f1f0807031232t61033b45q565db09a18cc0a33@mail.gmail.com> <18541.11335.901150.355273@arabic.ccs.neu.edu> <9b1fff280807031338u5741355bw4c2d8dc2a226c363@mail.gmail.com> <75AEB1FB-6EE1-4C9B-8631-89A4C9E63469@pnkfx.org> <9b1fff280807031356v4ff3bd9fxdd6faf6c436397de@mail.gmail.com> <53271859-6A20-4431-B6A2-EF1721DA65C1@ccs.neu.edu> Message-ID: <932b2f1f0807031411h6cac39cr7ca9a446928ac19f@mail.gmail.com> Again, FWIW, looking at the source code suggests that eopl re-exports r5's letrec (which is supposed to do that, I believe) not #lang scheme's letrec. Robby On Thu, Jul 3, 2008 at 4:04 PM, Matthias Felleisen wrote: > > > Felix is proposing a fix to your program logic. Because your program is > using the bindings in a sequential manner, (let* ([fname ...] ...) ...) will > do fine. In Scheme, letrec is the construct for mutually recursive bindings, > and you're not declaring anything of this kind. > > I am conjecturing that, even though PLT Scheme's letrec promises a behavior > for your letrec expression that is like the one for an equivalent let* > expression, something in 4.0's expansion is failing this promise. > (Technically, what is failing is a promise between the run-time system and > your module. (I believe that) If we had pervasive contracts, we could issue > a better error message, even if the error that you see is caused by an > internal error.) > > -- Matthias > > > > > > On Jul 3, 2008, at 4:56 PM, Marco Morazan wrote: > >> How so? >> >> On Thu, Jul 3, 2008 at 4:45 PM, Felix Klock's PLT scheme proxy >> wrote: >>> >>> I think you are misusing letrec. >>> >>> Try a let* instead. >>> >>> -Felix >>> >>> On Jul 3, 2008, at 4:38 PM, Marco Morazan wrote: >>> >>>> Hi All, >>>> >>>> I am a bit baffled. I have reproduced below a simplified example of my >>>> rather large piece of software that produces the same error. >>>> >>>> (define F '(define (f x) (+ x x))) >>>> >>>> (define (all-but-last datum) >>>> (if (null? (cdr datum)) >>>> '() >>>> (cons (car datum) (all-but-last (cdr datum))))) >>>> >>>> (define (parse-test datum) >>>> (letrec ((fname (caadr datum)) >>>> (params (cdadr datum)) >>>> (localdefs (all-but-last (cddr datum))) >>>> (localdefs-names (map caadr localdefs))) >>>> 'ok)) >>>> >>>> With the above I get: >>>> >>>> Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. >>>> Language: Essentials of Programming Languages (2nd ed.); memory limit: >>>> 128 megabytes. >>>>> >>>>> (all-but-last (cddr F)) >>>> >>>> () >>>>> >>>>> (map caadr (all-but-last (cddr F))) >>>> >>>> () >>>>> >>>>> (parse-test F) >>>> >>>> . . mcar: expects argument of type ; given # >>>>> >>>> >>>> As far as I can tell, (map caadr (all-but-last (cddr F))) and >>>> (parse-test F) should yield the same result and (parse-test F) should >>>> yield 'ok. >>>> >>>> Now, here are the results with v372: >>>> >>>> Welcome to DrScheme, version 372 [3m]. >>>> Language: Essentials of Programming Languages (2nd ed.). >>>>> >>>>> (all-but-last (cddr F)) >>>> >>>> () >>>>> >>>>> (map caadr (all-but-last (cddr F))) >>>> >>>> () >>>>> >>>>> (parse-test F) >>>> >>>> ok >>>>> >>>> >>>> I think Eli is onto something. When I display the value of localdefs >>>> in v4.0.1 it is # while in v372 it is (). >>>> >>>> I really hope I am missing something trivial and that I will have one >>>> of those DUH! moments soon. In the meantime, I am really baffled. >>>> >>>> Once again, any pointers would be appreciated. >>>> >>>> Cheers, >>>> >>>> Marco >>>> >>>> >>>> On Thu, Jul 3, 2008 at 3:45 PM, Eli Barzilay wrote: >>>>> >>>>> On Jul 3, Robby Findler wrote: >>>>>> >>>>>> AFAICT, EoPL works fine with the basic example you're giving. I'm >>>>>> still not able to divine what is going wrong: >>>>>> >>>>>> Welcome to DrScheme, version 4.0.1.3-svn2jul2008 [3m]. >>>>>> Language: Essentials of Programming Languages (2nd ed.); memory limit: >>>>>> 128 megabytes. >>>>>>> >>>>>>> (map caadr (list '(lambda (x) x))) >>>>>> >>>>>> (x) >>>>> >>>>> My guess is that there are two problems here: the first is that `map' >>>>> is bound to `mmap', and `caadr' is bound to a function that composes >>>>> `mcar' and `mcdr' -- and these make error messages confusing Marco >>>>> here: >>>>> >>>>>>>>> My code does not use mcar anywhere. I must assume it has to do >>>>>>>>> with the implementation of map (?). >>>>> >>>>> >>>>> >>>>> But the real problem is elsewhere: >>>>> >>>>>>>>> This code: (map caadr localdefs) >>>>>>>>> >>>>>>>>> Produces this error: >>>>>>>>> >>>>>>>>> mcar: expects argument of type ; given >>>>>>>>> # >>>>> >>>>> You must have some `undefined' value somewhere, and that's probably >>>>> due something that changed in the language. (And because of the above >>>>> the error message doesn't help.) >>>>> >>>>> To find the bad value I'd start with >>>>> >>>>> (map (lambda (x) >>>>> (if (and (pair? x) (pair? (cdr x)) (pair? (cadr x))) >>>>> (caadr x) >>>>> (error 'blah "~s" x))) >>>>> localdefs) >>>>> >>>>> and go on from there. >>>>> >>>>> -- >>>>> ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: >>>>> http://www.barzilay.org/ Maze is Life! >>>>> >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > > From pedro.e.pinto at gmail.com Thu Jul 3 17:14:17 2008 From: pedro.e.pinto at gmail.com (pp) Date: Thu Mar 26 02:22:22 2009 Subject: [plt-scheme] How to find Planet package documentation Message-ID: <5bb17d0f-ecbd-4c86-b766-fbd56059398b@m45g2000hsb.googlegroups.com> Hi there, I just downloaded the science collection from planet with: (require (planet williams/science/science-with-graphics)) How do I get to its documention? F1 on the collection name returns no results and neither does searching the documentation for science or williams -pp From matthias at ccs.neu.edu Thu Jul 3 17:12:10 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:22:22 2009 Subject: [plt-scheme] Question about map In-Reply-To: <932b2f1f0807031411h6cac39cr7ca9a446928ac19f@mail.gmail.com> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> <9b1fff280807031228s18ee41c8ka862e690e9bae89@mail.gmail.com> <932b2f1f0807031232t61033b45q565db09a18cc0a33@mail.gmail.com> <18541.11335.901150.355273@arabic.ccs.neu.edu> <9b1fff280807031338u5741355bw4c2d8dc2a226c363@mail.gmail.com> <75AEB1FB-6EE1-4C9B-8631-89A4C9E63469@pnkfx.org> <9b1fff280807031356v4ff3bd9fxdd6faf6c436397de@mail.gmail.com> <53271859-6A20-4431-B6A2-EF1721DA65C1@ccs.neu.edu> <932b2f1f0807031411h6cac39cr7ca9a446928ac19f@mail.gmail.com> Message-ID: I'd consider this a bug until someone convinces me that EoPL really wants rNrs silly letrec. -- Matthias On Jul 3, 2008, at 5:11 PM, Robby Findler wrote: > Again, FWIW, looking at the source code suggests that eopl re-exports > r5's letrec (which is supposed to do that, I believe) not #lang > scheme's letrec. > > Robby > > On Thu, Jul 3, 2008 at 4:04 PM, Matthias Felleisen > wrote: >> >> >> Felix is proposing a fix to your program logic. Because your >> program is >> using the bindings in a sequential manner, (let* >> ([fname ...] ...) ...) will >> do fine. In Scheme, letrec is the construct for mutually recursive >> bindings, >> and you're not declaring anything of this kind. >> >> I am conjecturing that, even though PLT Scheme's letrec promises a >> behavior >> for your letrec expression that is like the one for an equivalent >> let* >> expression, something in 4.0's expansion is failing this promise. >> (Technically, what is failing is a promise between the run-time >> system and >> your module. (I believe that) If we had pervasive contracts, we >> could issue >> a better error message, even if the error that you see is caused >> by an >> internal error.) >> >> -- Matthias >> >> >> >> >> >> On Jul 3, 2008, at 4:56 PM, Marco Morazan wrote: >> >>> How so? >>> >>> On Thu, Jul 3, 2008 at 4:45 PM, Felix Klock's PLT scheme proxy >>> wrote: >>>> >>>> I think you are misusing letrec. >>>> >>>> Try a let* instead. >>>> >>>> -Felix >>>> >>>> On Jul 3, 2008, at 4:38 PM, Marco Morazan wrote: >>>> >>>>> Hi All, >>>>> >>>>> I am a bit baffled. I have reproduced below a simplified >>>>> example of my >>>>> rather large piece of software that produces the same error. >>>>> >>>>> (define F '(define (f x) (+ x x))) >>>>> >>>>> (define (all-but-last datum) >>>>> (if (null? (cdr datum)) >>>>> '() >>>>> (cons (car datum) (all-but-last (cdr datum))))) >>>>> >>>>> (define (parse-test datum) >>>>> (letrec ((fname (caadr datum)) >>>>> (params (cdadr datum)) >>>>> (localdefs (all-but-last (cddr datum))) >>>>> (localdefs-names (map caadr localdefs))) >>>>> 'ok)) >>>>> >>>>> With the above I get: >>>>> >>>>> Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. >>>>> Language: Essentials of Programming Languages (2nd ed.); memory >>>>> limit: >>>>> 128 megabytes. >>>>>> >>>>>> (all-but-last (cddr F)) >>>>> >>>>> () >>>>>> >>>>>> (map caadr (all-but-last (cddr F))) >>>>> >>>>> () >>>>>> >>>>>> (parse-test F) >>>>> >>>>> . . mcar: expects argument of type ; given >>>>> # >>>>>> >>>>> >>>>> As far as I can tell, (map caadr (all-but-last (cddr F))) and >>>>> (parse-test F) should yield the same result and (parse-test F) >>>>> should >>>>> yield 'ok. >>>>> >>>>> Now, here are the results with v372: >>>>> >>>>> Welcome to DrScheme, version 372 [3m]. >>>>> Language: Essentials of Programming Languages (2nd ed.). >>>>>> >>>>>> (all-but-last (cddr F)) >>>>> >>>>> () >>>>>> >>>>>> (map caadr (all-but-last (cddr F))) >>>>> >>>>> () >>>>>> >>>>>> (parse-test F) >>>>> >>>>> ok >>>>>> >>>>> >>>>> I think Eli is onto something. When I display the value of >>>>> localdefs >>>>> in v4.0.1 it is # while in v372 it is (). >>>>> >>>>> I really hope I am missing something trivial and that I will >>>>> have one >>>>> of those DUH! moments soon. In the meantime, I am really baffled. >>>>> >>>>> Once again, any pointers would be appreciated. >>>>> >>>>> Cheers, >>>>> >>>>> Marco >>>>> >>>>> >>>>> On Thu, Jul 3, 2008 at 3:45 PM, Eli Barzilay >>>>> wrote: >>>>>> >>>>>> On Jul 3, Robby Findler wrote: >>>>>>> >>>>>>> AFAICT, EoPL works fine with the basic example you're giving. >>>>>>> I'm >>>>>>> still not able to divine what is going wrong: >>>>>>> >>>>>>> Welcome to DrScheme, version 4.0.1.3-svn2jul2008 [3m]. >>>>>>> Language: Essentials of Programming Languages (2nd ed.); >>>>>>> memory limit: >>>>>>> 128 megabytes. >>>>>>>> >>>>>>>> (map caadr (list '(lambda (x) x))) >>>>>>> >>>>>>> (x) >>>>>> >>>>>> My guess is that there are two problems here: the first is >>>>>> that `map' >>>>>> is bound to `mmap', and `caadr' is bound to a function that >>>>>> composes >>>>>> `mcar' and `mcdr' -- and these make error messages confusing >>>>>> Marco >>>>>> here: >>>>>> >>>>>>>>>> My code does not use mcar anywhere. I must assume it has >>>>>>>>>> to do >>>>>>>>>> with the implementation of map (?). >>>>>> >>>>>> >>>>>> >>>>>> But the real problem is elsewhere: >>>>>> >>>>>>>>>> This code: (map caadr localdefs) >>>>>>>>>> >>>>>>>>>> Produces this error: >>>>>>>>>> >>>>>>>>>> mcar: expects argument of type ; given >>>>>>>>>> # >>>>>> >>>>>> You must have some `undefined' value somewhere, and that's >>>>>> probably >>>>>> due something that changed in the language. (And because of >>>>>> the above >>>>>> the error message doesn't help.) >>>>>> >>>>>> To find the bad value I'd start with >>>>>> >>>>>> (map (lambda (x) >>>>>> (if (and (pair? x) (pair? (cdr x)) (pair? (cadr x))) >>>>>> (caadr x) >>>>>> (error 'blah "~s" x))) >>>>>> localdefs) >>>>>> >>>>>> and go on from there. >>>>>> >>>>>> -- >>>>>> ((lambda (x) (x x)) (lambda (x) (x x))) Eli >>>>>> Barzilay: >>>>>> http://www.barzilay.org/ Maze is >>>>>> Life! >>>>>> >>>>> _________________________________________________ >>>>> For list-related administrative tasks: >>>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>> >>>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> >> From morazanm at gmail.com Thu Jul 3 17:36:41 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:22:22 2009 Subject: [plt-scheme] Question about map In-Reply-To: <53271859-6A20-4431-B6A2-EF1721DA65C1@ccs.neu.edu> References: <9b1fff280807031216p2a13b6c3vdac05c67341adbb3@mail.gmail.com> <932b2f1f0807031220n84d743bh2596fd01d3b2fa9d@mail.gmail.com> <9b1fff280807031228s18ee41c8ka862e690e9bae89@mail.gmail.com> <932b2f1f0807031232t61033b45q565db09a18cc0a33@mail.gmail.com> <18541.11335.901150.355273@arabic.ccs.neu.edu> <9b1fff280807031338u5741355bw4c2d8dc2a226c363@mail.gmail.com> <75AEB1FB-6EE1-4C9B-8631-89A4C9E63469@pnkfx.org> <9b1fff280807031356v4ff3bd9fxdd6faf6c436397de@mail.gmail.com> <53271859-6A20-4431-B6A2-EF1721DA65C1@ccs.neu.edu> Message-ID: <9b1fff280807031436k2e868abcw21e6315b5721c22c@mail.gmail.com> Yes, of course, Felix and Matthias. No claim made that my simplified example reproducing the bug is beautiful. :-) > > I'd consider this a bug until someone convinces me that EoPL really wants > rNrs silly letrec. -- Matthias > I would tend to agree. I assume it will be a while before this can be addressed, no? Cheers, Marco On Thu, Jul 3, 2008 at 5:04 PM, Matthias Felleisen wrote: > > > Felix is proposing a fix to your program logic. Because your program is > using the bindings in a sequential manner, (let* ([fname ...] ...) ...) will > do fine. In Scheme, letrec is the construct for mutually recursive bindings, > and you're not declaring anything of this kind. > > I am conjecturing that, even though PLT Scheme's letrec promises a behavior > for your letrec expression that is like the one for an equivalent let* > expression, something in 4.0's expansion is failing this promise. > (Technically, what is failing is a promise between the run-time system and > your module. (I believe that) If we had pervasive contracts, we could issue > a better error message, even if the error that you see is caused by an > internal error.) > > -- Matthias > > > > > > On Jul 3, 2008, at 4:56 PM, Marco Morazan wrote: > >> How so? >> >> On Thu, Jul 3, 2008 at 4:45 PM, Felix Klock's PLT scheme proxy >> wrote: >>> >>> I think you are misusing letrec. >>> >>> Try a let* instead. >>> >>> -Felix >>> >>> On Jul 3, 2008, at 4:38 PM, Marco Morazan wrote: >>> >>>> Hi All, >>>> >>>> I am a bit baffled. I have reproduced below a simplified example of my >>>> rather large piece of software that produces the same error. >>>> >>>> (define F '(define (f x) (+ x x))) >>>> >>>> (define (all-but-last datum) >>>> (if (null? (cdr datum)) >>>> '() >>>> (cons (car datum) (all-but-last (cdr datum))))) >>>> >>>> (define (parse-test datum) >>>> (letrec ((fname (caadr datum)) >>>> (params (cdadr datum)) >>>> (localdefs (all-but-last (cddr datum))) >>>> (localdefs-names (map caadr localdefs))) >>>> 'ok)) >>>> >>>> With the above I get: >>>> >>>> Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. >>>> Language: Essentials of Programming Languages (2nd ed.); memory limit: >>>> 128 megabytes. >>>>> >>>>> (all-but-last (cddr F)) >>>> >>>> () >>>>> >>>>> (map caadr (all-but-last (cddr F))) >>>> >>>> () >>>>> >>>>> (parse-test F) >>>> >>>> . . mcar: expects argument of type ; given # >>>>> >>>> >>>> As far as I can tell, (map caadr (all-but-last (cddr F))) and >>>> (parse-test F) should yield the same result and (parse-test F) should >>>> yield 'ok. >>>> >>>> Now, here are the results with v372: >>>> >>>> Welcome to DrScheme, version 372 [3m]. >>>> Language: Essentials of Programming Languages (2nd ed.). >>>>> >>>>> (all-but-last (cddr F)) >>>> >>>> () >>>>> >>>>> (map caadr (all-but-last (cddr F))) >>>> >>>> () >>>>> >>>>> (parse-test F) >>>> >>>> ok >>>>> >>>> >>>> I think Eli is onto something. When I display the value of localdefs >>>> in v4.0.1 it is # while in v372 it is (). >>>> >>>> I really hope I am missing something trivial and that I will have one >>>> of those DUH! moments soon. In the meantime, I am really baffled. >>>> >>>> Once again, any pointers would be appreciated. >>>> >>>> Cheers, >>>> >>>> Marco >>>> >>>> >>>> On Thu, Jul 3, 2008 at 3:45 PM, Eli Barzilay wrote: >>>>> >>>>> On Jul 3, Robby Findler wrote: >>>>>> >>>>>> AFAICT, EoPL works fine with the basic example you're giving. I'm >>>>>> still not able to divine what is going wrong: >>>>>> >>>>>> Welcome to DrScheme, version 4.0.1.3-svn2jul2008 [3m]. >>>>>> Language: Essentials of Programming Languages (2nd ed.); memory limit: >>>>>> 128 megabytes. >>>>>>> >>>>>>> (map caadr (list '(lambda (x) x))) >>>>>> >>>>>> (x) >>>>> >>>>> My guess is that there are two problems here: the first is that `map' >>>>> is bound to `mmap', and `caadr' is bound to a function that composes >>>>> `mcar' and `mcdr' -- and these make error messages confusing Marco >>>>> here: >>>>> >>>>>>>>> My code does not use mcar anywhere. I must assume it has to do >>>>>>>>> with the implementation of map (?). >>>>> >>>>> >>>>> >>>>> But the real problem is elsewhere: >>>>> >>>>>>>>> This code: (map caadr localdefs) >>>>>>>>> >>>>>>>>> Produces this error: >>>>>>>>> >>>>>>>>> mcar: expects argument of type ; given >>>>>>>>> # >>>>> >>>>> You must have some `undefined' value somewhere, and that's probably >>>>> due something that changed in the language. (And because of the above >>>>> the error message doesn't help.) >>>>> >>>>> To find the bad value I'd start with >>>>> >>>>> (map (lambda (x) >>>>> (if (and (pair? x) (pair? (cdr x)) (pair? (cadr x))) >>>>> (caadr x) >>>>> (error 'blah "~s" x))) >>>>> localdefs) >>>>> >>>>> and go on from there. >>>>> >>>>> -- >>>>> ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: >>>>> http://www.barzilay.org/ Maze is Life! >>>>> >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From cce at ccs.neu.edu Thu Jul 3 18:23:12 2008 From: cce at ccs.neu.edu (Carl Eastlund) Date: Thu Mar 26 02:22:22 2009 Subject: [plt-scheme] How to find Planet package documentation In-Reply-To: <5bb17d0f-ecbd-4c86-b766-fbd56059398b@m45g2000hsb.googlegroups.com> References: <5bb17d0f-ecbd-4c86-b766-fbd56059398b@m45g2000hsb.googlegroups.com> Message-ID: <990e0c030807031523m21ad629bpb2e4168ba963e83d@mail.gmail.com> On Thu, Jul 3, 2008 at 5:14 PM, pp wrote: > Hi there, > > I just downloaded the science collection from planet with: > > (require (planet williams/science/science-with-graphics)) > > How do I get to its documention? F1 on the collection name returns no > results and neither does searching the documentation for science or > williams Pedro, You can find documentation linked at the package's web page off the planet site: http://planet.plt-scheme.org/display.ss?package=science.plt&owner=williams http://planet.plt-scheme.org/package-source/williams/science.plt/2/9/doc.txt Unfortunately, many planet packages cannot be found in Help Desk, as it does not index text or html documentation (the old formats) and most packages have not updated to Scribble documentation (the new format). For now you'll have to look them up on the web page, or find the doc.txt or html files in the directory where planet installs them. I hope that helps, good luck with the science package. -- Carl Eastlund From pedro.e.pinto at gmail.com Thu Jul 3 18:38:27 2008 From: pedro.e.pinto at gmail.com (pedro pinto) Date: Thu Mar 26 02:22:23 2009 Subject: [plt-scheme] How to find Planet package documentation In-Reply-To: <990e0c030807031523m21ad629bpb2e4168ba963e83d@mail.gmail.com> References: <5bb17d0f-ecbd-4c86-b766-fbd56059398b@m45g2000hsb.googlegroups.com> <990e0c030807031523m21ad629bpb2e4168ba963e83d@mail.gmail.com> Message-ID: Thanks Carl. The documentation does not seem to be available from the Planet web-site (all you get is a stub pointing you to help-desk), but, as you suggest, the excellent docs can be found on the planet cache. On minor oddity is that the science collection is marked on the Planet web-site as version 2.9 while the latest version seems to be 3.0 (according to "planet show"). -pp On Thu, Jul 3, 2008 at 6:23 PM, Carl Eastlund wrote: > On Thu, Jul 3, 2008 at 5:14 PM, pp wrote: > > Hi there, > > > > I just downloaded the science collection from planet with: > > > > (require (planet williams/science/science-with-graphics)) > > > > How do I get to its documention? F1 on the collection name returns no > > results and neither does searching the documentation for science or > > williams > > Pedro, > > You can find documentation linked at the package's web page off the planet > site: > > http://planet.plt-scheme.org/display.ss?package=science.plt&owner=williams > > http://planet.plt-scheme.org/package-source/williams/science.plt/2/9/doc.txt > > Unfortunately, many planet packages cannot be found in Help Desk, as > it does not index text or html documentation (the old formats) and > most packages have not updated to Scribble documentation (the new > format). For now you'll have to look them up on the web page, or find > the doc.txt or html files in the directory where planet installs them. > > I hope that helps, good luck with the science package. > > -- > Carl Eastlund > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080703/3467a819/attachment.html From morazanm at gmail.com Thu Jul 3 18:44:02 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:22:23 2009 Subject: [plt-scheme] Bindings for list primitives in 4.0.1 Message-ID: <9b1fff280807031544m366c538k469015b92b6c1c6e@mail.gmail.com> Dear All, My apologizes for the flurry of inquiries....... I start-up DrScheme and depending on the language selected the list primitives are bound differently (see examples below). Is that the intended behavior? I would guess not, but is there a quick fix around it? Thanks, Marco Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. Language: Pretty Big (includes MrEd and Advanced Student); memory limit: 128 megabytes. > car # > cdr # > cons # > map # > ------------------------------- Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. Language: R5RS; memory limit: 128 megabytes. > car # > cdr # > cons # > map # > ----------------------------------- Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. Language: Essentials of Programming Languages (2nd ed.); memory limit: 128 megabytes. > car # > cdr # > cons # > map # > ------------------------------------------ From cce at ccs.neu.edu Thu Jul 3 18:44:09 2008 From: cce at ccs.neu.edu (Carl Eastlund) Date: Thu Mar 26 02:22:23 2009 Subject: [plt-scheme] How to find Planet package documentation In-Reply-To: References: <5bb17d0f-ecbd-4c86-b766-fbd56059398b@m45g2000hsb.googlegroups.com> <990e0c030807031523m21ad629bpb2e4168ba963e83d@mail.gmail.com> Message-ID: <990e0c030807031544t61de44d7q97b66f449975c474@mail.gmail.com> On Thu, Jul 3, 2008 at 6:38 PM, pedro pinto wrote: > Thanks Carl. The documentation does not seem to be available from the Planet > web-site (all you get is a stub pointing you to help-desk), but, as you > suggest, the excellent docs can be found on the planet cache. I don't know what you mean by this. I find it without problem at the Planet website. > On minor oddity is that the science collection is marked on the Planet > web-site as version 2.9 while the latest version seems to be 3.0 (according > to "planet show"). The Planet website defaults to showing packages for PLT versions 3xx. Click the little "4.x" link near the upper-right corner and you'll see the updated version, which is released for version 4.x but not 3xx. --Carl From cce at ccs.neu.edu Thu Jul 3 18:48:46 2008 From: cce at ccs.neu.edu (Carl Eastlund) Date: Thu Mar 26 02:22:23 2009 Subject: [plt-scheme] How to find Planet package documentation In-Reply-To: <990e0c030807031544t61de44d7q97b66f449975c474@mail.gmail.com> References: <5bb17d0f-ecbd-4c86-b766-fbd56059398b@m45g2000hsb.googlegroups.com> <990e0c030807031523m21ad629bpb2e4168ba963e83d@mail.gmail.com> <990e0c030807031544t61de44d7q97b66f449975c474@mail.gmail.com> Message-ID: <990e0c030807031548r2d5d52a2x2eb26cd457d343d5@mail.gmail.com> On Thu, Jul 3, 2008 at 6:44 PM, Carl Eastlund wrote: > On Thu, Jul 3, 2008 at 6:38 PM, pedro pinto wrote: >> Thanks Carl. The documentation does not seem to be available from the Planet >> web-site (all you get is a stub pointing you to help-desk), but, as you >> suggest, the excellent docs can be found on the planet cache. > > I don't know what you mean by this. I find it without problem at the > Planet website. That wasn't a very helpful answer on my part at all. And I see what you mean - what I thought I had "found" was indeed the stub that you meant. Sorry about that. -- Carl Eastlund From cce at ccs.neu.edu Thu Jul 3 18:54:40 2008 From: cce at ccs.neu.edu (Carl Eastlund) Date: Thu Mar 26 02:22:24 2009 Subject: [plt-scheme] Bindings for list primitives in 4.0.1 In-Reply-To: <9b1fff280807031544m366c538k469015b92b6c1c6e@mail.gmail.com> References: <9b1fff280807031544m366c538k469015b92b6c1c6e@mail.gmail.com> Message-ID: <990e0c030807031554n3774163et24a3344618c11c51@mail.gmail.com> PLT Scheme 4.0 did away with mutable pairs in the default libraries. They are in a separate library now - not just in the sense of r6rs, where the mutators are in a separate library, but in that the pairs of the default library can never be mutated, and the mutable-pairs library therefore has a different kind of pairs. Other languages (such as EOPL, r5rs, r6rs, and legacy mzscheme) retain their mutable pairs, and therefore use the primitives from the mutable pairs library. Matthew made a long blog post about all of this last November, hopefully it can shed some light on the design decision: http://blog.plt-scheme.org/2007/11/getting-rid-of-set-car-and-set-cdr.html --Carl On Thu, Jul 3, 2008 at 6:44 PM, Marco Morazan wrote: > Dear All, > > My apologizes for the flurry of inquiries....... > > I start-up DrScheme and depending on the language selected the list > primitives are bound differently (see examples below). Is that the > intended behavior? I would guess not, but is there a quick fix around > it? > > Thanks, > > Marco > > > Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. > Language: Pretty Big (includes MrEd and Advanced Student); memory > limit: 128 megabytes. >> car > # >> cdr > # >> cons > # >> map > # >> > > ------------------------------- > > Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. > Language: R5RS; memory limit: 128 megabytes. >> car > # >> cdr > # >> cons > # >> map > # >> > > ----------------------------------- > > Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. > Language: Essentials of Programming Languages (2nd ed.); memory limit: > 128 megabytes. >> car > # >> cdr > # >> cons > # >> map > # >> > > ------------------------------------------ From morazanm at gmail.com Thu Jul 3 19:15:22 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:22:24 2009 Subject: [plt-scheme] Bindings for list primitives in 4.0.1 In-Reply-To: <990e0c030807031554n3774163et24a3344618c11c51@mail.gmail.com> References: <9b1fff280807031544m366c538k469015b92b6c1c6e@mail.gmail.com> <990e0c030807031554n3774163et24a3344618c11c51@mail.gmail.com> Message-ID: <9b1fff280807031615w15988cd4nf7bb97f88cffc0d@mail.gmail.com> Thanks! That explains it. --Marco On Thu, Jul 3, 2008 at 6:54 PM, Carl Eastlund wrote: > PLT Scheme 4.0 did away with mutable pairs in the default libraries. > They are in a separate library now - not just in the sense of r6rs, > where the mutators are in a separate library, but in that the pairs of > the default library can never be mutated, and the mutable-pairs > library therefore has a different kind of pairs. Other languages > (such as EOPL, r5rs, r6rs, and legacy mzscheme) retain their mutable > pairs, and therefore use the primitives from the mutable pairs > library. > > Matthew made a long blog post about all of this last November, > hopefully it can shed some light on the design decision: > > http://blog.plt-scheme.org/2007/11/getting-rid-of-set-car-and-set-cdr.html > > --Carl > > On Thu, Jul 3, 2008 at 6:44 PM, Marco Morazan wrote: >> Dear All, >> >> My apologizes for the flurry of inquiries....... >> >> I start-up DrScheme and depending on the language selected the list >> primitives are bound differently (see examples below). Is that the >> intended behavior? I would guess not, but is there a quick fix around >> it? >> >> Thanks, >> >> Marco >> >> >> Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. >> Language: Pretty Big (includes MrEd and Advanced Student); memory >> limit: 128 megabytes. >>> car >> # >>> cdr >> # >>> cons >> # >>> map >> # >>> >> >> ------------------------------- >> >> Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. >> Language: R5RS; memory limit: 128 megabytes. >>> car >> # >>> cdr >> # >>> cons >> # >>> map >> # >>> >> >> ----------------------------------- >> >> Welcome to DrScheme, version 4.0.1tsrj2008-1 [3m]. >> Language: Essentials of Programming Languages (2nd ed.); memory limit: >> 128 megabytes. >>> car >> # >>> cdr >> # >>> cons >> # >>> map >> # >>> >> >> ------------------------------------------ > From eli at barzilay.org Thu Jul 3 20:51:14 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:24 2009 Subject: [plt-scheme] FFI error in 4.0 In-Reply-To: <486CAC8B.5030804@zenburn.net> References: <486BE5F9.2090106@zenburn.net> <18540.8848.680708.479566@arabic.ccs.neu.edu> <486CAC8B.5030804@zenburn.net> Message-ID: <18541.29698.97307.726192@arabic.ccs.neu.edu> On Jul 3, Jakub Piotr C?apa wrote: > Eli Barzilay wrote: > > On Jul 2, Jakub Piotr C?apa wrote: > >> #lang scheme/base > >> (require scheme/foreign) > >> > >> #;(define-cpointer-type _test #f #f #f) ; this works > >> (define-cpointer-type _test) ; this doesn't and gives a > >> ; really obscure error message > > > > Why is it obscure? It said exactly what was wrong... > > ... but left me without any location information (the broken code was a > little longer than the minimal test case ;). Well, yeah, but the pattern was there, and you pointed and `define-cpointer-type'. So it took me about 30 seconds to open the file, find the error, and fix it (and most of that was spent in openning the file and writing a commit message...). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From m.douglas.williams at gmail.com Thu Jul 3 21:16:07 2008 From: m.douglas.williams at gmail.com (Doug Williams) Date: Thu Mar 26 02:22:25 2009 Subject: [plt-scheme] How to find Planet package documentation In-Reply-To: References: <5bb17d0f-ecbd-4c86-b766-fbd56059398b@m45g2000hsb.googlegroups.com> <990e0c030807031523m21ad629bpb2e4168ba963e83d@mail.gmail.com> Message-ID: I'm should be getting around to upgrading the science and simulation collection documentation to Scribble over the next few months. Until then, viewing the documents on PLaneT is the best alternative. [Although I would still like to put in another plug to automatically link to any HTML documents that are included with a package. In the case of the science collection, I'm not sure how I'll do the equations in scribble.] If you have any problems, please let me know. I should have the inference collection updated this weekend. It's been a bit more of a chore to port it completely to V4.0. Doug On Thu, Jul 3, 2008 at 4:38 PM, pedro pinto wrote: > Thanks Carl. The documentation does not seem to be available from the > Planet web-site (all you get is a stub pointing you to help-desk), but, as > you suggest, the excellent docs can be found on the planet cache. > > On minor oddity is that the science collection is marked on the Planet > web-site as version 2.9 while the latest version seems to be 3.0 (according > to "planet show"). > > -pp > > > > > On Thu, Jul 3, 2008 at 6:23 PM, Carl Eastlund wrote: > >> On Thu, Jul 3, 2008 at 5:14 PM, pp wrote: >> > Hi there, >> > >> > I just downloaded the science collection from planet with: >> > >> > (require (planet williams/science/science-with-graphics)) >> > >> > How do I get to its documention? F1 on the collection name returns no >> > results and neither does searching the documentation for science or >> > williams >> >> Pedro, >> >> You can find documentation linked at the package's web page off the planet >> site: >> >> http://planet.plt-scheme.org/display.ss?package=science.plt&owner=williams >> >> http://planet.plt-scheme.org/package-source/williams/science.plt/2/9/doc.txt >> >> Unfortunately, many planet packages cannot be found in Help Desk, as >> it does not index text or html documentation (the old formats) and >> most packages have not updated to Scribble documentation (the new >> format). For now you'll have to look them up on the web page, or find >> the doc.txt or html files in the directory where planet installs them. >> >> I hope that helps, good luck with the science package. >> >> -- >> Carl Eastlund >> > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080703/708813f6/attachment.htm From m.douglas.williams at gmail.com Thu Jul 3 21:26:44 2008 From: m.douglas.williams at gmail.com (Doug Williams) Date: Thu Mar 26 02:22:26 2009 Subject: [plt-scheme] How to find Planet package documentation In-Reply-To: References: <5bb17d0f-ecbd-4c86-b766-fbd56059398b@m45g2000hsb.googlegroups.com> <990e0c030807031523m21ad629bpb2e4168ba963e83d@mail.gmail.com> Message-ID: And here is the link on PLaneT to the HTML documents. I didn't see this actual link anywhere. [You can also find it by browsing the package sources on PLaneT. This will work for any collection that has html documentation.] http://planet.plt-scheme.org/package-source/williams/science.plt/3/0/html/science.html Doug On Thu, Jul 3, 2008 at 7:16 PM, Doug Williams wrote: > I'm should be getting around to upgrading the science and simulation > collection documentation to Scribble over the next few months. Until then, > viewing the documents on PLaneT is the best alternative. [Although I would > still like to put in another plug to automatically link to any HTML > documents that are included with a package. In the case of the science > collection, I'm not sure how I'll do the equations in scribble.] > > If you have any problems, please let me know. > > I should have the inference collection updated this weekend. It's been a > bit more of a chore to port it completely to V4.0. > > Doug > > On Thu, Jul 3, 2008 at 4:38 PM, pedro pinto > wrote: > >> Thanks Carl. The documentation does not seem to be available from the >> Planet web-site (all you get is a stub pointing you to help-desk), but, as >> you suggest, the excellent docs can be found on the planet cache. >> >> On minor oddity is that the science collection is marked on the Planet >> web-site as version 2.9 while the latest version seems to be 3.0 (according >> to "planet show"). >> >> -pp >> >> >> >> >> On Thu, Jul 3, 2008 at 6:23 PM, Carl Eastlund wrote: >> >>> On Thu, Jul 3, 2008 at 5:14 PM, pp wrote: >>> > Hi there, >>> > >>> > I just downloaded the science collection from planet with: >>> > >>> > (require (planet williams/science/science-with-graphics)) >>> > >>> > How do I get to its documention? F1 on the collection name returns no >>> > results and neither does searching the documentation for science or >>> > williams >>> >>> Pedro, >>> >>> You can find documentation linked at the package's web page off the >>> planet site: >>> >>> >>> http://planet.plt-scheme.org/display.ss?package=science.plt&owner=williams >>> >>> http://planet.plt-scheme.org/package-source/williams/science.plt/2/9/doc.txt >>> >>> Unfortunately, many planet packages cannot be found in Help Desk, as >>> it does not index text or html documentation (the old formats) and >>> most packages have not updated to Scribble documentation (the new >>> format). For now you'll have to look them up on the web page, or find >>> the doc.txt or html files in the directory where planet installs them. >>> >>> I hope that helps, good luck with the science package. >>> >>> -- >>> Carl Eastlund >>> >> >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080703/e8ceb4a3/attachment.html From kumar_lista at mac.com Thu Jul 3 23:23:45 2008 From: kumar_lista at mac.com (kumar_lista@mac.com) Date: Thu Mar 26 02:22:26 2009 Subject: [plt-scheme] Continuous update sliders ... In-Reply-To: <20080703205650.0E5DC4041E@qua.cs.brown.edu> References: <20080703205650.0E5DC4041E@qua.cs.brown.edu> Message-ID: <75D9E585-700D-4A72-97D1-8AE018AA54C7@mac.com> Hi, I need some help with the slider% class. Much appreciate any tips. The slider% class behaves modally as it stands - i.e. between mouse-down and mouse-up on the slider control, the main event loop does not get to run. How do I configure slider% such that I can twiddle it without pausing the main event loop between mouse-down and mouse-up? Cheers, -Kumar From corey.sweeney at gmail.com Fri Jul 4 00:11:18 2008 From: corey.sweeney at gmail.com (Corey Sweeney) Date: Thu Mar 26 02:22:26 2009 Subject: [plt-scheme] mime.ss: Mime corruption while accepting file uploads to web servers Message-ID: I wanted to accept file uploads on my apache webserver, and was happy to find a "recipe" on the scheme cookbook. Rather then copying the whole thing here, i'll just give the link to the source code: http://schemecookbook.org/view/Cookbook/WebFileUpload (The scheme cookbook is a site that has cut and paste code clips for doing lots of common and/or cool stuff). The article was written a few years ago, so the recipe is a little broken (it calls a function from a no-longer available package). With a little adjustment, it basically seems to work. I then called it like: (let ([get-bindings-mime-result (get-bindings/mime)] [bytestring-port (open-output-bytes)] [nothing [(fifth (assoc 'datafile get-bindings-mime-result)) bytestring-port]] [bytestring (get-output-bytes bytestring-port)]) then eventually I: (write-bytes bytestring output-file-1) However, when actually transmitting a file, many of the bytes, turn into question marks (ascii 3F). And it seems to be deterministic. By that I mean transmitting the same file many times, alyways ends up with the same bytes as question marks. However, the pattern of corruption alludes me, as it does things like "converts the first to 8B 's to 3Fs, but does not convert the 3rd 8B to a 3F. larger numbers do seem to be more succeptable. If it's relavant, i'm doing the upload via cgi though apache Here is the first few bytes of the original file, followed by the same number of bytes in the "scheme bytestring": 1F 8B 08 08 FC 69 71 2C 00 03 74 69 6E 79 2D 63 6C 6F 73 2E 1F 3F 08 08 3F 69 71 2C 00 03 74 69 6E 79 2D 63 6C 6F 73 2E Heres several byes from the original: 00000000 1F 8B 08 08 FC 69 71 2C 00 03 74 69 6E 79 2D 63 6C 6F 73 2E .....iq,..tiny-clos. 00000014 74 61 72 00 EC 5C 5B 73 1B 37 96 CE AB FB 57 60 3C 0F 22 BD tar..\[s.7....W`<.". 00000028 24 2D C9 B2 9D 91 53 B1 18 59 B2 59 23 89 5E 92 9E C4 6F 01 $-....S..Y.Y#.^...o. 0000003C BB 41 12 76 77 83 6E 74 8B 62 7E FD 7E E7 00 7D A3 28 67 B7 .A.vw.nt.b~.~..}.(g. 00000050 2A C9 4E D5 98 4E 95 C8 06 70 70 EE 17 E0 74 72 9D 6E FB 61 *.N..N...pp...tr.n.a 00000064 6C EC D3 EF FE B4 8F 10 E2 E5 F3 E7 E2 3B 71 74 78 FC E2 48 l............;qtx..H 00000078 D0 6F 21 0E FD 5F FF 43 3C 3F 79 76 72 FC E2 E4 E5 0B 7C 17 .o!.._.C References: <5bb17d0f-ecbd-4c86-b766-fbd56059398b@m45g2000hsb.googlegroups.com> <990e0c030807031523m21ad629bpb2e4168ba963e83d@mail.gmail.com> Message-ID: Thanks a lot. And thanks for doing the science collection. Very nice piece of work. -pp On Thu, Jul 3, 2008 at 9:26 PM, Doug Williams wrote: > And here is the link on PLaneT to the HTML documents. I didn't see this > actual link anywhere. [You can also find it by browsing the package sources > on PLaneT. This will work for any collection that has html documentation.] > > > http://planet.plt-scheme.org/package-source/williams/science.plt/3/0/html/science.html > > Doug > > > On Thu, Jul 3, 2008 at 7:16 PM, Doug Williams < > m.douglas.williams@gmail.com> wrote: > >> I'm should be getting around to upgrading the science and simulation >> collection documentation to Scribble over the next few months. Until then, >> viewing the documents on PLaneT is the best alternative. [Although I would >> still like to put in another plug to automatically link to any HTML >> documents that are included with a package. In the case of the science >> collection, I'm not sure how I'll do the equations in scribble.] >> >> If you have any problems, please let me know. >> >> I should have the inference collection updated this weekend. It's been a >> bit more of a chore to port it completely to V4.0. >> >> Doug >> >> On Thu, Jul 3, 2008 at 4:38 PM, pedro pinto >> wrote: >> >>> Thanks Carl. The documentation does not seem to be available from the >>> Planet web-site (all you get is a stub pointing you to help-desk), but, as >>> you suggest, the excellent docs can be found on the planet cache. >>> >>> On minor oddity is that the science collection is marked on the Planet >>> web-site as version 2.9 while the latest version seems to be 3.0 (according >>> to "planet show"). >>> >>> -pp >>> >>> >>> >>> >>> On Thu, Jul 3, 2008 at 6:23 PM, Carl Eastlund wrote: >>> >>>> On Thu, Jul 3, 2008 at 5:14 PM, pp wrote: >>>> > Hi there, >>>> > >>>> > I just downloaded the science collection from planet with: >>>> > >>>> > (require (planet williams/science/science-with-graphics)) >>>> > >>>> > How do I get to its documention? F1 on the collection name returns no >>>> > results and neither does searching the documentation for science or >>>> > williams >>>> >>>> Pedro, >>>> >>>> You can find documentation linked at the package's web page off the >>>> planet site: >>>> >>>> >>>> http://planet.plt-scheme.org/display.ss?package=science.plt&owner=williams >>>> >>>> http://planet.plt-scheme.org/package-source/williams/science.plt/2/9/doc.txt >>>> >>>> Unfortunately, many planet packages cannot be found in Help Desk, as >>>> it does not index text or html documentation (the old formats) and >>>> most packages have not updated to Scribble documentation (the new >>>> format). For now you'll have to look them up on the web page, or find >>>> the doc.txt or html files in the directory where planet installs them. >>>> >>>> I hope that helps, good luck with the science package. >>>> >>>> -- >>>> Carl Eastlund >>>> >>> >>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080704/6d844fe3/attachment.htm From stephen at degabrielle.name Fri Jul 4 04:24:37 2008 From: stephen at degabrielle.name (Stephen De Gabrielle) Date: Thu Mar 26 02:22:27 2009 Subject: [plt-scheme] planet categories Message-ID: <595b9ab20807040124s3e162dcfx33b4967233195850@mail.gmail.com> Just a suggestion, could a 'database' category be added to planet? Development ToolsMathematical and ScientificNetworking and ProtocolsHardware/Operating System-Specific ToolsGraphics and AudioTextual and Graphical User Interface XML-RelatedMetaprogramming ToolsData Structures and AlgorithmsPLaneT-RelatedInput/Output and FilesystemMiscellaneous Cheers, Stephen -- Stephen De Gabrielle s.degabrielle@cs.ucl.ac.uk Telephone +44 (0)20 7679 0693 (x30693) Mobile 079 851 890 45 Project: Making Sense of Information (MaSI) Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html Home:http://www.degabrielle.name/stephen UCL Interaction Centre MPEB 8th floor University College London Gower Street London WC1E 6BT -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080704/d25062c8/attachment.html From derick.eddington at gmail.com Fri Jul 4 05:22:14 2008 From: derick.eddington at gmail.com (Derick Eddington) Date: Thu Mar 26 02:22:29 2009 Subject: [plt-scheme] patch to escape R6RS library names [was: SXML for R6RS] In-Reply-To: <20080703134719.090736500BE@mail-svr1.cs.utah.edu> References: <1215047813.20284.17.camel@eep> <1215081783.23549.83.camel@eep> <20080703134719.090736500BE@mail-svr1.cs.utah.edu> Message-ID: <1215163334.23549.257.camel@eep> On Thu, 2008-07-03 at 07:47 -0600, Matthew Flatt wrote: > At Thu, 03 Jul 2008 03:43:02 -0700, Derick Eddington wrote: > > I've been meaning to bring this up and ask: would it be possible for PLT > > to support any symbols for library names? Ikarus currently does it by > > encoding filename-unfriendly characters like * to %2A. I'd be willing > > to make a patch to do this if it's not a dead end. > > That would be great. OK, here's my patch, below and attached. Comments: I made it escape all characters that are not valid for a PLT Scheme unquoted module path component because that seemed the most conservative. I made the %-escape encoding have a terminating delimiter of the ; character so that library names like (foo \x3BB;) and (foo ?\x3B;B) do not resolve to the same filename. Because the (lib rel-string) require form does not allow the % nor ; characters in the rel-string, I changed `convert-library-reference' to use the (file string) require form and changed `parse-library-reference' to return a platform-specific absolute path string. In addition to it working for importing my and-let* library, allowing sxml-tools to now completely work, I tried this: > (parse-library-reference #'(?? ??? (1 2 3)) error) "/home/d/.plt-scheme/4.0.1.3/collects/%D689;%D6D2;/%D6D5;%D64F;%D681;-1-2-3.mzscheme.sls" > $ ls .plt-scheme/4.0.1.3/collects/%D689\;%D6D2\;/ %D6D5;%D64F;%D681;-1-2-3.mzscheme.sls use-it.ss $ cat .plt-scheme/4.0.1.3/collects/%D689\;%D6D2\;/%D6D5\;%D64F\;%D681\;-1-2-3.mzscheme.sls #!r6rs (library (?? ??? (1 2 3)) (export x) (import (rnrs)) (define x 'foo) ) $ cat .plt-scheme/4.0.1.3/collects/%D689\;%D6D2\;/use-it.ss #!r6rs (import (rnrs) (?? ??? (1 2 3))) (write x) (newline) $ mzscheme .plt-scheme/4.0.1.3/collects/%D689\;%D6D2\;/use-it.ss foo $ ? -- : Derick ---------------------------------------------------------------- ====================================================================== --- plt-4.0.1.3/collects/r6rs/private/parse-ref.ss 2008-06-22 21:01:18.000000000 -0700 +++ plt-4.0.1.3/collects/r6rs/private/parse-ref.ss 2008-07-04 01:39:44.000000000 -0700 @@ -30,6 +30,24 @@ (andmap is-sub-version-reference? (syntax->list #'(sv ...)))] [_ #f])) +(define (escape-library-id-str str) + (let loop ([chars (string->list str)] [accum '()]) + (if (null? chars) + (list->string (reverse accum)) + (let ([c (car chars)]) + (if (or (char<=? #\a c #\z) + (char<=? #\A c #\Z) + (char<=? #\0 c #\9) + (memv c '(#\+ #\- #\_))) + (loop (cdr chars) (cons c accum)) + (loop (cdr chars) + (append + (cons #\; (reverse + (cons #\% (string->list + (string-upcase + (number->string (char->integer c) 16)))))) + accum))))))) + (define (parse-library-reference stx err) (syntax-case stx () [(id1 id2 ... (vers ...)) @@ -38,34 +56,34 @@ (is-version-reference? #'(vers ...))) (let-values ([(coll file) (let ([strs (map (lambda (id) - (symbol->string (syntax-e id))) + (escape-library-id-str + (symbol->string (syntax-e id)))) (syntax->list #'(id1 id2 ...)))]) (if (= 1 (length strs)) (values (list (car strs)) "main") (values (reverse (cdr (reverse strs))) (car (reverse strs)))))]) - (let ([base (build-path (with-handlers ([exn:fail? - (lambda (exn) - (err - (format - "cannot find suitable library installed (exception: ~a)" - (if (exn? exn) - (exn-message exn) - exn))))]) - (apply collection-path coll)) - file)]) + (let* ([coll-path (with-handlers ([exn:fail? + (lambda (exn) + (err + (format + "cannot find suitable library installed (exception: ~a)" + (if (exn? exn) + (exn-message exn) + exn))))]) + (apply collection-path coll))] + [base (build-path coll-path file)]) (let ([vers.ext (find-version (path->bytes base) (syntax->datum #'(vers ...)))]) (if vers.ext - (apply string-append - (car coll) - (append - (map (lambda (s) - (string-append "/" s)) - (append (cdr coll) (list file))) - (map (lambda (v) - (format "-~a" v)) - (car vers.ext)) - (list (cdr vers.ext)))) + (bytes->string/latin-1 + (path->bytes + (build-path coll-path (string-append + file + (apply string-append + (map (lambda (v) + (format "-~a" v)) + (car vers.ext))) + (cdr vers.ext))))) (err "cannot find suitable installed library")))))] [(id1 id2 ...) (and (identifier? #'id1) @@ -77,7 +95,7 @@ (define (convert-library-reference orig stx stx-err) (datum->syntax orig - `(,#'lib + `(,#'file ,(parse-library-reference stx (lambda (msg) (stx-err msg orig stx)))) ====================================================================== -------------- next part -------------- A non-text attachment was scrubbed... Name: escape-library-identifier.patch Type: text/x-patch Size: 4457 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080704/1bd24827/escape-library-identifier.bin From mflatt at cs.utah.edu Fri Jul 4 08:19:42 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:29 2009 Subject: [plt-scheme] Continuous update sliders ... In-Reply-To: <75D9E585-700D-4A72-97D1-8AE018AA54C7@mac.com> References: <20080703205650.0E5DC4041E@qua.cs.brown.edu> <75D9E585-700D-4A72-97D1-8AE018AA54C7@mac.com> Message-ID: <20080704121943.D4DE06500A8@mail-svr1.cs.utah.edu> At Fri, 04 Jul 2008 11:23:45 +0800, kumar_lista@mac.com wrote: > Hi, > > I need some help with the slider% class. Much appreciate any tips. > > The slider% class behaves modally as it stands - i.e. between mouse-down > and mouse-up on the slider control, the main event loop does not get > to run. > How do I configure slider% such that I can twiddle it without pausing > the > main event loop between mouse-down and mouse-up? Provide a `callback' argument when creating a `slider%'. The following example illustrates updating a message field interactively based on the value of the slider: #lang scheme/gui (define f (new frame% [label "Hi"])) (define m (new message% [parent f] [label ""] [stretchable-width #t])) (new slider% [label #f] [min-value 0] [max-value 100] [parent f] [callback (lambda (s e) (send m set-label (format "Value is ~s" (send s get-value))))]) (send f show #t) From mflatt at cs.utah.edu Fri Jul 4 09:18:50 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:29 2009 Subject: [plt-scheme] Problems with eval In-Reply-To: References: <486D14F7.3060508@cs.utah.edu> <486D1814.9070601@cs.utah.edu> <932b2f1f0807031134x1aa207a2s8893563c59730846@mail.gmail.com> <18541.9815.161192.216446@arabic.ccs.neu.edu> <18541.11495.128870.761856@arabic.ccs.neu.edu> Message-ID: <20080704131853.4230C650064@mail-svr1.cs.utah.edu> Some clarifications: Libraries should rarely just use the namespace that currently happens to be installed at the current namespace. When almost all code was in the `mzscheme' language, just using the current namespace often worked ok. Now that we have more languages floating around in practice, though, it's important to keep libraries from stomping on each others' namespaces (and v4 starts with an empty initial namespace to help catch problems with using whatever namespace happens to be current). With that in mind, Robby's example #lang scheme (namespace-require 'scheme/base) (eval '((lambda (x) x) 1)) is fine for a script or for illustrating how to put bindings into a namespace, but it's almost never the right approach within a library. It's appropriate to use the current namespace when a library function is specifically defined to do so. The `compile' and `load' functions, for example, are supposed to manipulate the current namespace. But if you're dynamically creating code through `eval' as in Doug's example, then you want a namespace that's configured in a specific way, so you should make pick own. Similarly, if you have some code to macro-expand in the `scheme/base' language, then you should create a namespace that is initialized with `scheme/base'. When you pick a namespace explicitly, there are two typical ways to get it: 1. Create a fresh one with `make-base-namespace', and initialize it further with `namespace-attach-module' and `namespace-require'. This gives you the same sort of namespace that you'd get from a fresh REPL. 2. Use `define-namespace-anchor' and `namespace-anchor->namespace'. This gives you a namespace that has the same bindings as the enclosing module's top level. (Don't use this if you want any module-local bindings to be private.) Matthew From robby at cs.uchicago.edu Fri Jul 4 11:59:48 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:29 2009 Subject: [plt-scheme] Keybindings In-Reply-To: <481286B7.2050609@zenburn.net> References: <481286B7.2050609@zenburn.net> Message-ID: <932b2f1f0807040859l1212432fg6499eca40c0e2a9b@mail.gmail.com> It looks like DrScheme was just out of sync with the rest of the mac world, so I've changed the redo shortcut to be cmd-shift-z (in SVN). Anyone know the standard for windows or linux (if there is one)? Robby On Fri, Apr 25, 2008 at 8:34 PM, Jakub Piotr C?apa wrote: > I'm on OS X and I tried to bind Cmd-Shift-Z to redo but no combination of > ":", "d:", "s:", "z" and "Z" worked. Do you have any suggestions? > > -- > regards, > Jakub Piotr C?apa > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From grettke at acm.org Fri Jul 4 12:17:15 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:22:29 2009 Subject: [plt-scheme] Keybindings In-Reply-To: <932b2f1f0807040859l1212432fg6499eca40c0e2a9b@mail.gmail.com> References: <481286B7.2050609@zenburn.net> <932b2f1f0807040859l1212432fg6499eca40c0e2a9b@mail.gmail.com> Message-ID: <756daca50807040917r695afacdocb14134705e8438d@mail.gmail.com> Microsoft Office Word 2003 uses Control-Y From robby at cs.uchicago.edu Fri Jul 4 12:54:50 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:30 2009 Subject: [plt-scheme] Keybindings In-Reply-To: <2748b30b0807040918y2c1ca5c5r24340baf493d1923@mail.gmail.com> References: <481286B7.2050609@zenburn.net> <932b2f1f0807040859l1212432fg6499eca40c0e2a9b@mail.gmail.com> <2748b30b0807040918y2c1ca5c5r24340baf493d1923@mail.gmail.com> Message-ID: <932b2f1f0807040954x29477e3ard4fd373805b5126a@mail.gmail.com> Thanks. I've changed things so that mac os x and linux both use -shift-z and left windows with control-z. Robby On Fri, Jul 4, 2008 at 11:18 AM, Yavuz Arkun wrote: > It seems ctrl+Y for windows, shift+ctrl+Z for Gnome (possibly also KDE). > > On Fri, Jul 4, 2008 at 18:59, Robby Findler wrote: >> It looks like DrScheme was just out of sync with the rest of the mac >> world, so I've changed the redo shortcut to be cmd-shift-z (in SVN). >> >> Anyone know the standard for windows or linux (if there is one)? >> >> Robby >> >> On Fri, Apr 25, 2008 at 8:34 PM, Jakub Piotr C?apa wrote: >>> I'm on OS X and I tried to bind Cmd-Shift-Z to redo but no combination of >>> ":", "d:", "s:", "z" and "Z" worked. Do you have any suggestions? >>> >>> -- >>> regards, >>> Jakub Piotr C?apa >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > From mark.engelberg at gmail.com Fri Jul 4 16:15:28 2008 From: mark.engelberg at gmail.com (Mark Engelberg) Date: Thu Mar 26 02:22:30 2009 Subject: [plt-scheme] Understanding readtables Message-ID: My son wants to extend the readtable, and I'm trying to help him out. I've found the appropriate spot in the docs, but find it somewhat confusing. I'm hoping someone here can help us understand this better. He's got a struct called a bundle, which stores an expression in both its unevaluated form and its evaluation, and a macro that serves as a constructor. It looks like this: (define-syntax bundle (syntax-rules () ((bundle expr) (make- (quote expr) expr)))) (define (bundle-write b p write?) (fprintf p "#*(~a . ~a)" (-e b)(-a b))) (define-struct (e a) #:property prop:custom-write bundle-write) (define bundle? ?) (define bundle-expr -e) (define bundle-answer -a) Okay, now he's created a custom write function that displays a bundle as #*((+ 1 2) . 3) He wants to customize the reader so that he can read back in this printed version of the bundle, sort of like #(1 2 3) for making vectors, or #hash((1 . 2)) for making a hash table. He ideally envisions that the reader would handle either #*((+ 1 2) . 3) or #*((+ 1 2)) and it will return #*((+ 1 2) . 3) both ways (the second version evaluates the expression automatically when it has not been when the evaluation has not been provided). [Yes, I know that having the first case breaks encapsulation, but this is what he wants, in large part, just to understand how it could be done]. So from the documentation, it sounds like he needs to extend the readtable with a dispatch-macro, that calls a special reading function that will be called when the reader is called for #*. Something like: (current-readtable (make-readtable (current-readtable) #\* 'dispatch-macro readerbundle)) But this doesn't quite work, and it's not really clear what form this reader function needs to take. Can someone set us on the right path here? Thanks, Mark From jpc-ml at zenburn.net Fri Jul 4 16:30:07 2008 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:22:30 2009 Subject: [plt-scheme] FFI error in 4.0 In-Reply-To: <18541.29698.97307.726192@arabic.ccs.neu.edu> References: <486BE5F9.2090106@zenburn.net> <18540.8848.680708.479566@arabic.ccs.neu.edu> <486CAC8B.5030804@zenburn.net> <18541.29698.97307.726192@arabic.ccs.neu.edu> Message-ID: <486E884F.4080903@zenburn.net> Eli Barzilay wrote: > Well, yeah, but the pattern was there, and you pointed and > `define-cpointer-type'. So it took me about 30 seconds to open the > file, find the error, and fix it (and most of that was spent in > openning the file and writing a commit message...). I was rather referring to my problem with finding what's wrong (in code I wrote several months ago) without any line numbers. Why the error was lacking any context information? How is such thing possible with the whole syntax objects thing? (Sorry if this sounds criticising, I had no such intentions. I am just curious. :)) -- regards, Jakub Piotr C?apa From eli at barzilay.org Fri Jul 4 16:44:17 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:30 2009 Subject: [plt-scheme] FFI error in 4.0 In-Reply-To: <486E884F.4080903@zenburn.net> References: <486BE5F9.2090106@zenburn.net> <18540.8848.680708.479566@arabic.ccs.neu.edu> <486CAC8B.5030804@zenburn.net> <18541.29698.97307.726192@arabic.ccs.neu.edu> <486E884F.4080903@zenburn.net> Message-ID: <18542.35745.486216.56926@arabic.ccs.neu.edu> On Jul 4, Jakub Piotr C?apa wrote: > Eli Barzilay wrote: > > Well, yeah, but the pattern was there, and you pointed and > > `define-cpointer-type'. So it took me about 30 seconds to open > > the file, find the error, and fix it (and most of that was spent > > in openning the file and writing a commit message...). > > I was rather referring to my problem with finding what's wrong (in > code I wrote several months ago) without any line numbers. > > Why the error was lacking any context information? How is such thing > possible with the whole syntax objects thing? (Sorry if this sounds > criticising, I had no such intentions. I am just curious. :)) I don't know why it doesn't have source information. My guess is that it's more like the runtime error you get from (car '()). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From gregory.woodhouse at sbcglobal.net Fri Jul 4 16:49:22 2008 From: gregory.woodhouse at sbcglobal.net (Gregory Woodhouse) Date: Thu Mar 26 02:22:31 2009 Subject: [plt-scheme] planet categories In-Reply-To: <595b9ab20807040124s3e162dcfx33b4967233195850@mail.gmail.com> References: <595b9ab20807040124s3e162dcfx33b4967233195850@mail.gmail.com> Message-ID: On Jul 4, 2008, at 1:24 AM, Stephen De Gabrielle wrote: > Just a suggestion, > > could a 'database' category be added to planet? > I second the suggestion. "The most incomprehensible thing about the world is that it is at all comprehensible." --Albert Einstein (1879-1955) http://www.gwoodhouse.com http://GregWoodhouse.ImageKind.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080704/7db7047a/attachment.html From eli at barzilay.org Fri Jul 4 17:03:30 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:31 2009 Subject: [plt-scheme] Understanding readtables In-Reply-To: References: Message-ID: <18542.36898.94996.647990@arabic.ccs.neu.edu> A few relevant notes: On Jul 4, Mark Engelberg wrote: > > [...] > > Okay, now he's created a custom write function that displays a bundle > as #*((+ 1 2) . 3) > > He wants to customize the reader so that he can read back in this > printed version of the bundle, sort of like #(1 2 3) for making > vectors, or #hash((1 . 2)) for making a hash table. He ideally > envisions that the reader would handle either #*((+ 1 2) . 3) or > #*((+ 1 2)) and it will return #*((+ 1 2) . 3) What about #*((+ 1 2) . 5) ? Also, it's wrong to think of it as "returning" a value. Better to think of it as what it translates to as a new piece of syntax. For example, make #*( . ) translate to (bundle ), which has an implication if you put it inside quote, for example. (And in an answer to the above, I imagine `bundle' with a second argument testing that value and throwing an error if it's wrong.) The reason for this is that otherwise you get into problems with evaluating an expression at read-time, which is usually going to be a bad idea. For example, you probably want this to work: (let ([x 1]) #*((+ x 2) . 3)) > So from the documentation, it sounds like he needs to extend the > readtable with a dispatch-macro, that calls a special reading > function that will be called when the reader is called for #*. > Something like: > > (current-readtable (make-readtable (current-readtable) #\* > 'dispatch-macro readerbundle)) > > But this doesn't quite work, and it's not really clear what form > this reader function needs to take. Can someone set us on the right > path here? You can look in collects/scribble/reader.ss for an example. You generally want a function that gets char - the character that was used to call this function inp - the input port source-name line-num col-num position - location information and returns a piece of syntax. Important things to remember: * The syntax is best built with (datum->syntax #f (vector ...location-info...) [orig-stx]) the first thing should be #f -- so you produce a syntax with no lexical information (that will be problematic since if you do that then it'll be the lexical context of the reader code that generated it or something similar). * Changing the readtable with (current-readtable ) is not a good idea since it's a side-effect, is use it only for testing. Later on, it's best to write a module that provide `read' and `read-syntax' and use it with something like #reader "my-reader.ss" and these functions will use `parameterize' to have a local change of the syntax only. scribble/reader.ss has an example of that also (at the bottom of the file). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From mark.engelberg at gmail.com Fri Jul 4 18:09:11 2008 From: mark.engelberg at gmail.com (Mark Engelberg) Date: Thu Mar 26 02:22:31 2009 Subject: [plt-scheme] Iterator performance Message-ID: I've noticed that iterators are fast. So fast, in fact, that I can't seem to approach their speed with any Scheme-written loopy version. I've tested both vectors and lists, and gotten similar results. Here is some sample benchmarking on vector iteration: #lang scheme (define v (build-vector 500000 (? (i) i))) (collect-garbage) (define list1 (time (for/list ([item (in-vector v)]) item))) (set! list1 #f) (collect-garbage) (define list2 (time (for/list ([index (in-range (vector-length v))]) (vector-ref v index)))) (set! list2 #f) (collect-garbage) (define (v->l v i) (if (= i (vector-length v)) empty (cons (vector-ref v i) (v->l v (add1 i))))) (define list3 (time (v->l v 0))) (set! list3 #f) (define (v->l2 v i l) (if (= i (vector-length v)) (reverse l) (v->l2 v (add1 i) (cons (vector-ref v i) l)))) (define list4 (time (v->l2 v 0 empty))) On my computer: cpu time: 16 real time: 16 gc time: 0 cpu time: 78 real time: 78 gc time: 0 cpu time: 500 real time: 500 gc time: 156 cpu time: 250 real time: 250 gc time: 0 Is all iteration done on the C side? If not, what wizardry makes it so much faster? It's enough of a difference to make me want to do iteration all the time. Forget this recursion stuff :) ... Speaking of which, if I make a data structure into a sequence using prop:sequence, it works great in for loops, but what do I need to do to make it behave like the superfast iterators, such as in-list, in-vector, etc.? --Mark From yarkun at gmail.com Fri Jul 4 18:20:07 2008 From: yarkun at gmail.com (Yavuz Arkun) Date: Thu Mar 26 02:22:31 2009 Subject: [plt-scheme] Iterator performance In-Reply-To: References: Message-ID: <2748b30b0807041520r54a00d48m7b4e2e3bfd2fab3@mail.gmail.com> Hmm, I copy/pasted your code into my PLT and ran it: cpu time: 13 real time: 13 gc time: 0 cpu time: 13 real time: 13 gc time: 0 cpu time: 55 real time: 58 gc time: 0 cpu time: 20 real time: 21 gc time: 0 This is on OS X 10.5.4, version: Welcome to DrScheme, version 4.0.2.3-svn3jul2008 [3m]. Language: Module custom; memory limit: 512 megabytes. (I also ran with memory limited to 128MB; essentially same runtimes.) Seems that I don't see such a drastic difference. --Yavuz 2008/7/5 Mark Engelberg : > I've noticed that iterators are fast. So fast, in fact, that I can't > seem to approach their speed with any Scheme-written loopy version. > I've tested both vectors and lists, and gotten similar results. > > Here is some sample benchmarking on vector iteration: > #lang scheme > (define v (build-vector 500000 (? (i) i))) > > (collect-garbage) > (define list1 (time (for/list ([item (in-vector v)]) item))) > (set! list1 #f) > (collect-garbage) > (define list2 (time (for/list ([index (in-range (vector-length v))]) > (vector-ref v index)))) > (set! list2 #f) > (collect-garbage) > (define (v->l v i) > (if (= i (vector-length v)) empty > (cons (vector-ref v i) (v->l v (add1 i))))) > (define list3 (time (v->l v 0))) > (set! list3 #f) > (define (v->l2 v i l) > (if (= i (vector-length v)) (reverse l) > (v->l2 v (add1 i) (cons (vector-ref v i) l)))) > (define list4 (time (v->l2 v 0 empty))) > > On my computer: > cpu time: 16 real time: 16 gc time: 0 > cpu time: 78 real time: 78 gc time: 0 > cpu time: 500 real time: 500 gc time: 156 > cpu time: 250 real time: 250 gc time: 0 > > Is all iteration done on the C side? If not, what wizardry makes it > so much faster? > > It's enough of a difference to make me want to do iteration all the > time. Forget this recursion stuff :) ... > > Speaking of which, if I make a data structure into a sequence using > prop:sequence, it works great in for loops, but what do I need to do > to make it behave like the superfast iterators, such as in-list, > in-vector, etc.? > > --Mark > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From mflatt at cs.utah.edu Fri Jul 4 18:52:34 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:32 2009 Subject: [plt-scheme] Iterator performance In-Reply-To: References: Message-ID: <20080704225236.5448C6500A8@mail-svr1.cs.utah.edu> At Fri, 4 Jul 2008 15:09:11 -0700, "Mark Engelberg" wrote: > I've noticed that iterators are fast. So fast, in fact, that I can't > seem to approach their speed with any Scheme-written loopy version. > I've tested both vectors and lists, and gotten similar results. > > Here is some sample benchmarking on vector iteration: > #lang scheme > (define v (build-vector 500000 (? (i) i))) > > (collect-garbage) > (define list1 (time (for/list ([item (in-vector v)]) item))) > (set! list1 #f) > (collect-garbage) > (define list2 (time (for/list ([index (in-range (vector-length v))]) > (vector-ref v index)))) > (set! list2 #f) > (collect-garbage) > (define (v->l v i) > (if (= i (vector-length v)) empty > (cons (vector-ref v i) (v->l v (add1 i))))) > (define list3 (time (v->l v 0))) > (set! list3 #f) > (define (v->l2 v i l) > (if (= i (vector-length v)) (reverse l) > (v->l2 v (add1 i) (cons (vector-ref v i) l)))) > (define list4 (time (v->l2 v 0 empty))) > > On my computer: > cpu time: 16 real time: 16 gc time: 0 > cpu time: 78 real time: 78 gc time: 0 > cpu time: 500 real time: 500 gc time: 156 > cpu time: 250 real time: 250 gc time: 0 > > Is all iteration done on the C side? None. > If not, what wizardry makes it > so much faster? I think you're just seeing different levels of instrumentation for DrScheme's debugging. Since more of the implementation of `v->l' and `v->l2' is exposed in the source, then there's more for DrScheme to instrument. If you turn off debugging in DrScheme (via the "Choose Language" dialog, then the "Show Details" panel), then the last one runs almost as fast as the `for/list' version. If you lift the `vector-length' calculation out of the `v->l2' loop, then it should be essentially the same as the expansion of `for/list'. > Speaking of which, if I make a data structure into a sequence using > prop:sequence, it works great in for loops, but what do I need to do > to make it behave like the superfast iterators, such as in-list, > in-vector, etc.? See `define-sequence-syntax'. Matthew From eli at barzilay.org Fri Jul 4 21:03:38 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:32 2009 Subject: [plt-scheme] PLT Scheme v4.0.2 Message-ID: <200807050103.m6513cpp026725@winooski.ccs.neu.edu> PLT Scheme version 4.0.2 is now available from http://plt-scheme.org/ This release fixes a bug that caused PLaneT packages to install abnormally slow in 4.0.1. [ For those that use the nightly builds, subversion, or 4.0.1tsrj2008, you already have this fix (and even more fixes). You do not need to upgrade. The version in svn is now 4.0.2.3 to minimize confusion. ] Feedback Welcome, -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From mfearon80 at googlemail.com Fri Jul 4 04:37:00 2008 From: mfearon80 at googlemail.com (mikes80) Date: Thu Mar 26 02:22:32 2009 Subject: [plt-scheme] plt scheme 4.01 (linux) - Can't create a gui executable; mzc unable to locate MrEd Message-ID: <8716f3ff-b190-449f-a67b-6b606cad713c@m73g2000hsh.googlegroups.com> Hey all, version 4.01 Linux (Ubuntu) Installed using the install script from the PLT website I'm trying to create an executable from some sample source code I found on the web. The command I am using is as follows: mzc --gui-exe hello hello.scm This produces the following error: create-embedding-executable: can't find MrEd executable for variant 3m === context === /usr/lib/plt/collects/compiler/embed-unit.ss:65:4: find-exe core Similar errors revealed when searching for an answer suggested this was a bug with no work around (though these where a couple of years old and for different platforms). Is this the case here? The following is the code I am trying to compile. ;;;begin hello.scm (module hello ; the module name mzscheme ; initial syntax and variable bindings (require (lib "mred.ss" "mred") (lib "class.ss")) ;;Make a frame by instantiating ;;the frame% class (define frame (instantiate frame% ("Hello world"))) ;;Make a static text message in the frame (define msg (instantiate message% ("No events so far..." frame))) ;; Make a button in the frame ;;(using keyword-based arguments) (instantiate button% () (label "Click Me") (parent frame) ;; Callback procedure for a button click (callback (lambda (button event) (send msg set-label "Button click")))) ;; Show the frame by calling its show method (send frame show #t)) ;;;end Thanks for you time :) From nbuduroi at gmail.com Fri Jul 4 10:43:57 2008 From: nbuduroi at gmail.com (budu) Date: Thu Mar 26 02:22:32 2009 Subject: [plt-scheme] One small and one big issue with DrScheme Message-ID: Hi, I'm an occasional DrScheme user (normally I use Emacs) and there is some little things I don't like about it. One is keyboard shortcuts, which I never been able to change. I found out recently about the "Enable keybindings in menus" options, it's great, but I'm still missing some of my favorite shortcuts, mainly C-j for newline. Maybe the answer lies into the Help Desk, but it totally confuse me, it seems like I'm never able to find what I'm searching for. The bigger issue now is about DrScheme not being as solid as I'd like it to be. Maybe I'm too much used to Emacs, because when I use its REPL it never crash no matter what. I've lost some code (without any importance) this morning because I did try to run a function that generate an infinite loop and it crashed DrScheme with an out of memory exception. When considering that this IDE is geared toward beginners, I find it strange that it can't sustain even a mere infinite loop. Maybe that's the price to pay for the great debugging features DrSceme have. BTW, I'm a little late for this but congratulation to the PLT devs for version 4, it's a really great release. From robby at cs.uchicago.edu Fri Jul 4 21:53:12 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:32 2009 Subject: [plt-scheme] One small and one big issue with DrScheme In-Reply-To: References: Message-ID: <932b2f1f0807041853g267bcccbp1456fc0f4dc96252@mail.gmail.com> On Fri, Jul 4, 2008 at 9:43 AM, budu wrote: > Hi, I'm an occasional DrScheme user (normally I use Emacs) and there > is some little things I don't like about it. One is keyboard > shortcuts, which I never been able to change. I found out recently > about the "Enable keybindings in menus" options, it's great, but I'm > still missing some of my favorite shortcuts, mainly C-j for newline. > Maybe the answer lies into the Help Desk, but it totally confuse me, > it seems like I'm never able to find what I'm searching for. Try searching for 'shortcuts' or 'keybindings' in the new v4 documentation system (the keybinding docs themselves haven't changed, but all the libraries they rely on have much better docs now). If you find that there are just a few standard Emacs keybindings that you're missing, please forward them on and I'll try to add to the release for others. Meanwhile, I've added control-j to the SVN version. I'm not sure I got the same behavior as Emacs, but I made it just insert a newline (without indentation in the definitions window and without submitting the input to the REPL in the interactions window). > The bigger issue now is about DrScheme not being as solid as I'd like > it to be. Maybe I'm too much used to Emacs, because when I use its > REPL it never crash no matter what. I've lost some code (without any > importance) this morning because I did try to run a function that > generate an infinite loop and it crashed DrScheme with an out of > memory exception. Is the memory limit enabled? That is, when you look in the REPL after hitting "Run" do you see something like "memory limit: 128 megabytes"? Robby From mfearon80 at googlemail.com Fri Jul 4 23:07:12 2008 From: mfearon80 at googlemail.com (mikes80) Date: Thu Mar 26 02:22:32 2009 Subject: [plt-scheme] Re: plt scheme 4.01 (linux) - Can't create a gui executable; mzc unable to locate MrEd In-Reply-To: <8716f3ff-b190-449f-a67b-6b606cad713c@m73g2000hsh.googlegroups.com> References: <8716f3ff-b190-449f-a67b-6b606cad713c@m73g2000hsh.googlegroups.com> Message-ID: Okay so I re-installed and chose to install everything in /usr/local as opposed to the 'unix' style install. This solved the problem. IIRC the unix style install provides the option to change the install directories. Perhaps this is where the problem lies? Willing to test further if anyone feels it's necessary. On Jul 4, 9:37?am, mikes80 wrote: > Hey all, > > version 4.01 > Linux (Ubuntu) Installed using the install script from the PLT website > > I'm trying to create an executable from some sample source code I > found on the web. > > The command I am using is as follows: > > mzc --gui-exe hello hello.scm > > This produces the following error: > > create-embedding-executable: can't find MrEd executable for variant 3m > ?=== context === > /usr/lib/plt/collects/compiler/embed-unit.ss:65:4: find-exe > core > > Similar errors revealed when searching for an answer suggested this > was a bug with no work around (though these where a couple of years > old and for different platforms). Is this the case here? > > The following is the code I am trying to compile. > > ;;;begin hello.scm > (module hello ; the module name > ? mzscheme ; initial syntax and variable bindings > ? (require (lib "mred.ss" "mred") > ? ? ? (lib "class.ss")) > > ? ;;Make a frame by instantiating > ? ;;the frame% class > ? (define frame > ? ? ? ?(instantiate frame% ("Hello world"))) > > ? ;;Make a static text message in the frame > ? (define msg > ? ? ? ?(instantiate message% > ? ? ? ? ?("No events so far..." frame))) > > ? ;; Make a button in the frame > ? ;;(using keyword-based arguments) > ? (instantiate button% () > ? ? (label "Click Me") > ? ? (parent frame) > ? ? ;; Callback procedure for a button click > ? ? (callback (lambda (button event) > ? ? ? ?(send msg set-label "Button click")))) > > ? ;; Show the frame by calling its show method > ? (send frame show #t)) > ;;;end > > Thanks for you time :) > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mfearon80 at googlemail.com Fri Jul 4 23:08:57 2008 From: mfearon80 at googlemail.com (mikes80) Date: Thu Mar 26 02:22:33 2009 Subject: [plt-scheme] Re: plt scheme 4.01 (linux) - Can't create a gui executable; mzc unable to locate MrEd In-Reply-To: <8716f3ff-b190-449f-a67b-6b606cad713c@m73g2000hsh.googlegroups.com> References: <8716f3ff-b190-449f-a67b-6b606cad713c@m73g2000hsh.googlegroups.com> Message-ID: Okay so I re-installed and chose to install everything in /usr/local as opposed to the 'unix' style install. This solved the problem. IIRC the unix style install provides the option to change the install directories. Perhaps this is where the problem lies? Willing to test further if anyone feels it's necessary. On Jul 4, 9:37?am, mikes80 wrote: > Hey all, > > version 4.01 > Linux (Ubuntu) Installed using the install script from the PLT website > > I'm trying to create an executable from some sample source code I > found on the web. > > The command I am using is as follows: > > mzc --gui-exe hello hello.scm > > This produces the following error: > > create-embedding-executable: can't find MrEd executable for variant 3m > ?=== context === > /usr/lib/plt/collects/compiler/embed-unit.ss:65:4: find-exe > core > > Similar errors revealed when searching for an answer suggested this > was a bug with no work around (though these where a couple of years > old and for different platforms). Is this the case here? > > The following is the code I am trying to compile. > > ;;;begin hello.scm > (module hello ; the module name > ? mzscheme ; initial syntax and variable bindings > ? (require (lib "mred.ss" "mred") > ? ? ? (lib "class.ss")) > > ? ;;Make a frame by instantiating > ? ;;the frame% class > ? (define frame > ? ? ? ?(instantiate frame% ("Hello world"))) > > ? ;;Make a static text message in the frame > ? (define msg > ? ? ? ?(instantiate message% > ? ? ? ? ?("No events so far..." frame))) > > ? ;; Make a button in the frame > ? ;;(using keyword-based arguments) > ? (instantiate button% () > ? ? (label "Click Me") > ? ? (parent frame) > ? ? ;; Callback procedure for a button click > ? ? (callback (lambda (button event) > ? ? ? ?(send msg set-label "Button click")))) > > ? ;; Show the frame by calling its show method > ? (send frame show #t)) > ;;;end > > Thanks for you time :) > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From yarkun at gmail.com Sat Jul 5 05:01:40 2008 From: yarkun at gmail.com (Yavuz Arkun) Date: Thu Mar 26 02:22:33 2009 Subject: [plt-scheme] Iterator performance In-Reply-To: <20080704225236.5448C6500A8@mail-svr1.cs.utah.edu> References: <20080704225236.5448C6500A8@mail-svr1.cs.utah.edu> Message-ID: <2748b30b0807050201k3841b067x4f866e2035865113@mail.gmail.com> On Sat, Jul 5, 2008 at 01:52, Matthew Flatt wrote: > I think you're just seeing different levels of instrumentation for > DrScheme's debugging. Since more of the implementation of `v->l' and > `v->l2' is exposed in the source, then there's more for DrScheme to > instrument. Ah yes, I had turned debugging/profiling off. That explains my results. --Yavuz From matthias at ccs.neu.edu Sat Jul 5 09:19:44 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:22:33 2009 Subject: [plt-scheme] One small and one big issue with DrScheme In-Reply-To: References: Message-ID: <5D1F97E7-E0A2-4B3E-9CA6-FFD7FAA9A524@ccs.neu.edu> Well, unlike all other "pedagogic" IDEs, DrScheme has a reliable STOP button for infinite loops. (It's possible that others have caught up, but I am sure we were first.) Furthermore, you can and should set the memory limit for REPLs so that the memory limit for the REPL thread is distinct from the memory limit for the whole system and doesn't take it down. You need to teach both ideas to beginners eventually: computations consume space, and infinite computations consume unbounded space, plus you as a programmer should learn to set the limits in your context. Thanks for the feedback -- Matthias On Jul 4, 2008, at 10:43 AM, budu wrote: > Hi, I'm an occasional DrScheme user (normally I use Emacs) and there > is some little things I don't like about it. One is keyboard > shortcuts, which I never been able to change. I found out recently > about the "Enable keybindings in menus" options, it's great, but I'm > still missing some of my favorite shortcuts, mainly C-j for newline. > Maybe the answer lies into the Help Desk, but it totally confuse me, > it seems like I'm never able to find what I'm searching for. > > The bigger issue now is about DrScheme not being as solid as I'd like > it to be. Maybe I'm too much used to Emacs, because when I use its > REPL it never crash no matter what. I've lost some code (without any > importance) this morning because I did try to run a function that > generate an infinite loop and it crashed DrScheme with an out of > memory exception. When considering that this IDE is geared toward > beginners, I find it strange that it can't sustain even a mere > infinite loop. Maybe that's the price to pay for the great debugging > features DrSceme have. > > BTW, I'm a little late for this but congratulation to the PLT devs for > version 4, it's a really great release. > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From circularfunc at yahoo.se Sat Jul 5 09:31:01 2008 From: circularfunc at yahoo.se (Circular Function) Date: Thu Mar 26 02:22:34 2009 Subject: [plt-scheme] Image library? Message-ID: <938885.64277.qm@web28315.mail.ukl.yahoo.com> Is there a library where I can open png/gif/bmp/jpg etc files, and get every pixelcolor of the image? I want to get into basic imagesearch. Also, is there a site to browse all libraries in PLTscheme? both standard library and user contrubutions. ___________________________________________________ S?k efter k?rleken! Hitta din tvillingsj?l p? Yahoo! Dejting: http://ad.doubleclick.net/clk;185753627;24584539;x?http://se.meetic.yahoo.net/index.php?mtcmk=148783 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080705/3400e2ff/attachment.htm From robby at cs.uchicago.edu Sat Jul 5 09:34:36 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:34 2009 Subject: [plt-scheme] Image library? In-Reply-To: <938885.64277.qm@web28315.mail.ukl.yahoo.com> References: <938885.64277.qm@web28315.mail.ukl.yahoo.com> Message-ID: <932b2f1f0807050634n5fd3dcddke50da13652c04433@mail.gmail.com> Yes: scheme/gui has a class called bitmap% which lets you do that (depending on what you want, you might also need to use a bitmap-dc%). But this doesn't do search -- you'd have to implement that yourself. As for the documentation the "documentation" link from www.plt-scheme.org tells you about the standard libraries and the "planet" link gets you started in the user's contributions. Robby On Sat, Jul 5, 2008 at 8:31 AM, Circular Function wrote: > Is there a library where I can open png/gif/bmp/jpg etc files, and get every > pixelcolor of the image? > I want to get into basic imagesearch. > > Also, is there a site to browse all libraries in PLTscheme? both standard > library and user contrubutions. > > ________________________________ > L?na pengar utan s?kerhet. > S?k och j?mf?r l?n hos Kelkoo. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From robby at cs.uchicago.edu Sat Jul 5 09:36:49 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:34 2009 Subject: [plt-scheme] One small and one big issue with DrScheme In-Reply-To: <5D1F97E7-E0A2-4B3E-9CA6-FFD7FAA9A524@ccs.neu.edu> References: <5D1F97E7-E0A2-4B3E-9CA6-FFD7FAA9A524@ccs.neu.edu> Message-ID: <932b2f1f0807050636n4c492b08k8a0bae8e8d9230ed@mail.gmail.com> Oh! I know -- I bet that budu has used v372 of DrScheme. In that version, the memory limits were off by default and those preference settings carry over to v4 (unless they are explicitly changed). I'll fix that for a future release. Robby On Sat, Jul 5, 2008 at 8:19 AM, Matthias Felleisen wrote: > > Well, unlike all other "pedagogic" IDEs, DrScheme has a reliable STOP button > for infinite loops. (It's possible that others have caught up, but I am sure > we were first.) > > Furthermore, you can and should set the memory limit for REPLs so that the > memory limit for the REPL thread is distinct from the memory limit for the > whole system and doesn't take it down. You need to teach both ideas to > beginners eventually: computations consume space, and infinite computations > consume unbounded space, plus you as a programmer should learn to set the > limits in your context. > > Thanks for the feedback -- Matthias > > > > > On Jul 4, 2008, at 10:43 AM, budu wrote: > >> Hi, I'm an occasional DrScheme user (normally I use Emacs) and there >> is some little things I don't like about it. One is keyboard >> shortcuts, which I never been able to change. I found out recently >> about the "Enable keybindings in menus" options, it's great, but I'm >> still missing some of my favorite shortcuts, mainly C-j for newline. >> Maybe the answer lies into the Help Desk, but it totally confuse me, >> it seems like I'm never able to find what I'm searching for. >> >> The bigger issue now is about DrScheme not being as solid as I'd like >> it to be. Maybe I'm too much used to Emacs, because when I use its >> REPL it never crash no matter what. I've lost some code (without any >> importance) this morning because I did try to run a function that >> generate an infinite loop and it crashed DrScheme with an out of >> memory exception. When considering that this IDE is geared toward >> beginners, I find it strange that it can't sustain even a mere >> infinite loop. Maybe that's the price to pay for the great debugging >> features DrSceme have. >> >> BTW, I'm a little late for this but congratulation to the PLT devs for >> version 4, it's a really great release. >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From jos.koot at telefonica.net Sat Jul 5 12:12:31 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:22:34 2009 Subject: [plt-scheme] One small and one big issue with DrScheme References: <5D1F97E7-E0A2-4B3E-9CA6-FFD7FAA9A524@ccs.neu.edu> Message-ID: <000a01c8deb9$ee30f100$2101a8c0@uw2b2dff239c4d> As you probably know, I am addicted to PLT Scheme, its IDE included. I hate typing shell commands. With PLT's IDE I can avoid those commands.. Allow me to mention, though, that the stop button does not easily (sometimes not at all) repond when the garbage collector is thrashing. This is no problem for me, but may be you want to know. (This pertains to Windows XP Home and to all versions of DrScheme I ever downloaded and to pretty-big, #lang scheme, #!r6rs and more.) Jos ----- Original Message ----- From: "Matthias Felleisen" To: "budu" Cc: Sent: Saturday, July 05, 2008 3:19 PM Subject: Re: [plt-scheme] One small and one big issue with DrScheme > > Well, unlike all other "pedagogic" IDEs, DrScheme has a reliable STOP > button for infinite loops. (It's possible that others have caught up, but > I am sure we were first.) > > Furthermore, you can and should set the memory limit for REPLs so that > the memory limit for the REPL thread is distinct from the memory limit > for the whole system and doesn't take it down. You need to teach both > ideas to beginners eventually: computations consume space, and infinite > computations consume unbounded space, plus you as a programmer should > learn to set the limits in your context. > > Thanks for the feedback -- Matthias > > > > > On Jul 4, 2008, at 10:43 AM, budu wrote: > >> Hi, I'm an occasional DrScheme user (normally I use Emacs) and there >> is some little things I don't like about it. One is keyboard >> shortcuts, which I never been able to change. I found out recently >> about the "Enable keybindings in menus" options, it's great, but I'm >> still missing some of my favorite shortcuts, mainly C-j for newline. >> Maybe the answer lies into the Help Desk, but it totally confuse me, >> it seems like I'm never able to find what I'm searching for. >> >> The bigger issue now is about DrScheme not being as solid as I'd like >> it to be. Maybe I'm too much used to Emacs, because when I use its >> REPL it never crash no matter what. I've lost some code (without any >> importance) this morning because I did try to run a function that >> generate an infinite loop and it crashed DrScheme with an out of >> memory exception. When considering that this IDE is geared toward >> beginners, I find it strange that it can't sustain even a mere >> infinite loop. Maybe that's the price to pay for the great debugging >> features DrSceme have. >> >> BTW, I'm a little late for this but congratulation to the PLT devs for >> version 4, it's a really great release. >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From robby at cs.uchicago.edu Sat Jul 5 12:16:16 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:34 2009 Subject: [plt-scheme] One small and one big issue with DrScheme In-Reply-To: <000a01c8deb9$ee30f100$2101a8c0@uw2b2dff239c4d> References: <5D1F97E7-E0A2-4B3E-9CA6-FFD7FAA9A524@ccs.neu.edu> <000a01c8deb9$ee30f100$2101a8c0@uw2b2dff239c4d> Message-ID: <932b2f1f0807050916y22310bcfp67951626f58bba06@mail.gmail.com> Yes, I've had that experience too. I find that the keyboard is a little bit more reliable, but in general when thrashing is going on, the entire system has problems. Do you find that this is happening when you're using the memory limits? Robby On Sat, Jul 5, 2008 at 11:12 AM, Jos Koot wrote: > As you probably know, I am addicted to PLT Scheme, its IDE included. > I hate typing shell commands. With PLT's IDE I can avoid those commands.. > Allow me to mention, though, that the stop button does not easily (sometimes > not at all) repond when the garbage collector is thrashing. > This is no problem for me, but may be you want to know. > (This pertains to Windows XP Home and to all versions of DrScheme I ever > downloaded and to pretty-big, #lang scheme, #!r6rs and more.) > Jos > > ----- Original Message ----- From: "Matthias Felleisen" > > To: "budu" > Cc: > Sent: Saturday, July 05, 2008 3:19 PM > Subject: Re: [plt-scheme] One small and one big issue with DrScheme > > >> >> Well, unlike all other "pedagogic" IDEs, DrScheme has a reliable STOP >> button for infinite loops. (It's possible that others have caught up, but I >> am sure we were first.) >> >> Furthermore, you can and should set the memory limit for REPLs so that >> the memory limit for the REPL thread is distinct from the memory limit for >> the whole system and doesn't take it down. You need to teach both ideas to >> beginners eventually: computations consume space, and infinite computations >> consume unbounded space, plus you as a programmer should learn to set the >> limits in your context. >> >> Thanks for the feedback -- Matthias >> >> >> >> >> On Jul 4, 2008, at 10:43 AM, budu wrote: >> >>> Hi, I'm an occasional DrScheme user (normally I use Emacs) and there >>> is some little things I don't like about it. One is keyboard >>> shortcuts, which I never been able to change. I found out recently >>> about the "Enable keybindings in menus" options, it's great, but I'm >>> still missing some of my favorite shortcuts, mainly C-j for newline. >>> Maybe the answer lies into the Help Desk, but it totally confuse me, >>> it seems like I'm never able to find what I'm searching for. >>> >>> The bigger issue now is about DrScheme not being as solid as I'd like >>> it to be. Maybe I'm too much used to Emacs, because when I use its >>> REPL it never crash no matter what. I've lost some code (without any >>> importance) this morning because I did try to run a function that >>> generate an infinite loop and it crashed DrScheme with an out of >>> memory exception. When considering that this IDE is geared toward >>> beginners, I find it strange that it can't sustain even a mere >>> infinite loop. Maybe that's the price to pay for the great debugging >>> features DrSceme have. >>> >>> BTW, I'm a little late for this but congratulation to the PLT devs for >>> version 4, it's a really great release. >>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From jos.koot at telefonica.net Sat Jul 5 12:25:33 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:22:34 2009 Subject: [plt-scheme] One small and one big issue with DrScheme References: <5D1F97E7-E0A2-4B3E-9CA6-FFD7FAA9A524@ccs.neu.edu> <000a01c8deb9$ee30f100$2101a8c0@uw2b2dff239c4d> <932b2f1f0807050916y22310bcfp67951626f58bba06@mail.gmail.com> Message-ID: <001f01c8debb$c0326d40$2101a8c0@uw2b2dff239c4d> When I set a memory limit set below available RAM, DrScheme properly halts when I exceed the limit. Jos ----- Original Message ----- From: "Robby Findler" To: "Jos Koot" Cc: "Matthias Felleisen" ; "budu" ; Sent: Saturday, July 05, 2008 6:16 PM Subject: Re: [plt-scheme] One small and one big issue with DrScheme > Yes, I've had that experience too. I find that the keyboard is a > little bit more reliable, but in general when thrashing is going on, > the entire system has problems. > > Do you find that this is happening when you're using the memory limits? > > Robby > > On Sat, Jul 5, 2008 at 11:12 AM, Jos Koot wrote: >> As you probably know, I am addicted to PLT Scheme, its IDE included. >> I hate typing shell commands. With PLT's IDE I can avoid those commands.. >> Allow me to mention, though, that the stop button does not easily >> (sometimes >> not at all) repond when the garbage collector is thrashing. >> This is no problem for me, but may be you want to know. >> (This pertains to Windows XP Home and to all versions of DrScheme I ever >> downloaded and to pretty-big, #lang scheme, #!r6rs and more.) >> Jos >> >> ----- Original Message ----- From: "Matthias Felleisen" >> >> To: "budu" >> Cc: >> Sent: Saturday, July 05, 2008 3:19 PM >> Subject: Re: [plt-scheme] One small and one big issue with DrScheme >> >> >>> >>> Well, unlike all other "pedagogic" IDEs, DrScheme has a reliable STOP >>> button for infinite loops. (It's possible that others have caught up, >>> but I >>> am sure we were first.) >>> >>> Furthermore, you can and should set the memory limit for REPLs so that >>> the memory limit for the REPL thread is distinct from the memory limit >>> for >>> the whole system and doesn't take it down. You need to teach both ideas >>> to >>> beginners eventually: computations consume space, and infinite >>> computations >>> consume unbounded space, plus you as a programmer should learn to set >>> the >>> limits in your context. >>> >>> Thanks for the feedback -- Matthias >>> >>> >>> >>> >>> On Jul 4, 2008, at 10:43 AM, budu wrote: >>> >>>> Hi, I'm an occasional DrScheme user (normally I use Emacs) and there >>>> is some little things I don't like about it. One is keyboard >>>> shortcuts, which I never been able to change. I found out recently >>>> about the "Enable keybindings in menus" options, it's great, but I'm >>>> still missing some of my favorite shortcuts, mainly C-j for newline. >>>> Maybe the answer lies into the Help Desk, but it totally confuse me, >>>> it seems like I'm never able to find what I'm searching for. >>>> >>>> The bigger issue now is about DrScheme not being as solid as I'd like >>>> it to be. Maybe I'm too much used to Emacs, because when I use its >>>> REPL it never crash no matter what. I've lost some code (without any >>>> importance) this morning because I did try to run a function that >>>> generate an infinite loop and it crashed DrScheme with an out of >>>> memory exception. When considering that this IDE is geared toward >>>> beginners, I find it strange that it can't sustain even a mere >>>> infinite loop. Maybe that's the price to pay for the great debugging >>>> features DrSceme have. >>>> >>>> BTW, I'm a little late for this but congratulation to the PLT devs for >>>> version 4, it's a really great release. >>>> >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> From jos.koot at telefonica.net Sat Jul 5 12:35:06 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:22:35 2009 Subject: [plt-scheme] One small and one big issue with DrScheme References: <5D1F97E7-E0A2-4B3E-9CA6-FFD7FAA9A524@ccs.neu.edu> <000a01c8deb9$ee30f100$2101a8c0@uw2b2dff239c4d> <932b2f1f0807050916y22310bcfp67951626f58bba06@mail.gmail.com> Message-ID: <002a01c8debd$1554bfc0$2101a8c0@uw2b2dff239c4d> You said "The entire system has problems" That's true. Even after a succesfull stop and leaving DrScheme, my system may continue thrashing for some time. It may very well be a Windows problem rather than a PLT problem. I don't know. Jos ----- Original Message ----- From: "Robby Findler" To: "Jos Koot" Cc: "Matthias Felleisen" ; "budu" ; Sent: Saturday, July 05, 2008 6:16 PM Subject: Re: [plt-scheme] One small and one big issue with DrScheme > Yes, I've had that experience too. I find that the keyboard is a > little bit more reliable, but in general when thrashing is going on, > the entire system has problems. > > Do you find that this is happening when you're using the memory limits? > > Robby > > On Sat, Jul 5, 2008 at 11:12 AM, Jos Koot wrote: >> As you probably know, I am addicted to PLT Scheme, its IDE included. >> I hate typing shell commands. With PLT's IDE I can avoid those commands.. >> Allow me to mention, though, that the stop button does not easily >> (sometimes >> not at all) repond when the garbage collector is thrashing. >> This is no problem for me, but may be you want to know. >> (This pertains to Windows XP Home and to all versions of DrScheme I ever >> downloaded and to pretty-big, #lang scheme, #!r6rs and more.) >> Jos >> >> ----- Original Message ----- From: "Matthias Felleisen" >> >> To: "budu" >> Cc: >> Sent: Saturday, July 05, 2008 3:19 PM >> Subject: Re: [plt-scheme] One small and one big issue with DrScheme >> >> >>> >>> Well, unlike all other "pedagogic" IDEs, DrScheme has a reliable STOP >>> button for infinite loops. (It's possible that others have caught up, >>> but I >>> am sure we were first.) >>> >>> Furthermore, you can and should set the memory limit for REPLs so that >>> the memory limit for the REPL thread is distinct from the memory limit >>> for >>> the whole system and doesn't take it down. You need to teach both ideas >>> to >>> beginners eventually: computations consume space, and infinite >>> computations >>> consume unbounded space, plus you as a programmer should learn to set >>> the >>> limits in your context. >>> >>> Thanks for the feedback -- Matthias >>> >>> >>> >>> >>> On Jul 4, 2008, at 10:43 AM, budu wrote: >>> >>>> Hi, I'm an occasional DrScheme user (normally I use Emacs) and there >>>> is some little things I don't like about it. One is keyboard >>>> shortcuts, which I never been able to change. I found out recently >>>> about the "Enable keybindings in menus" options, it's great, but I'm >>>> still missing some of my favorite shortcuts, mainly C-j for newline. >>>> Maybe the answer lies into the Help Desk, but it totally confuse me, >>>> it seems like I'm never able to find what I'm searching for. >>>> >>>> The bigger issue now is about DrScheme not being as solid as I'd like >>>> it to be. Maybe I'm too much used to Emacs, because when I use its >>>> REPL it never crash no matter what. I've lost some code (without any >>>> importance) this morning because I did try to run a function that >>>> generate an infinite loop and it crashed DrScheme with an out of >>>> memory exception. When considering that this IDE is geared toward >>>> beginners, I find it strange that it can't sustain even a mere >>>> infinite loop. Maybe that's the price to pay for the great debugging >>>> features DrSceme have. >>>> >>>> BTW, I'm a little late for this but congratulation to the PLT devs for >>>> version 4, it's a really great release. >>>> >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> From robby at cs.uchicago.edu Sat Jul 5 12:37:38 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:35 2009 Subject: [plt-scheme] One small and one big issue with DrScheme In-Reply-To: <002a01c8debd$1554bfc0$2101a8c0@uw2b2dff239c4d> References: <5D1F97E7-E0A2-4B3E-9CA6-FFD7FAA9A524@ccs.neu.edu> <000a01c8deb9$ee30f100$2101a8c0@uw2b2dff239c4d> <932b2f1f0807050916y22310bcfp67951626f58bba06@mail.gmail.com> <002a01c8debd$1554bfc0$2101a8c0@uw2b2dff239c4d> Message-ID: <932b2f1f0807050937j10c11a85u31b41f659787ee31@mail.gmail.com> Well, its a known fact of life when dealing with software that is using more than the available memory on the system. I'm sure there are better and worse strategies for dealing with that, some of which could be improved in drscheme and some of which would have to be done at the windows level. Robby On Sat, Jul 5, 2008 at 11:35 AM, Jos Koot wrote: > You said "The entire system has problems" That's true. Even after a > succesfull stop and leaving DrScheme, my system may continue thrashing for > some time. It may very well be a Windows problem rather than a PLT problem. > I don't know. > Jos > > ----- Original Message ----- From: "Robby Findler" > To: "Jos Koot" > Cc: "Matthias Felleisen" ; "budu" > ; > Sent: Saturday, July 05, 2008 6:16 PM > Subject: Re: [plt-scheme] One small and one big issue with DrScheme > > >> Yes, I've had that experience too. I find that the keyboard is a >> little bit more reliable, but in general when thrashing is going on, >> the entire system has problems. >> >> Do you find that this is happening when you're using the memory limits? >> >> Robby >> >> On Sat, Jul 5, 2008 at 11:12 AM, Jos Koot wrote: >>> >>> As you probably know, I am addicted to PLT Scheme, its IDE included. >>> I hate typing shell commands. With PLT's IDE I can avoid those commands.. >>> Allow me to mention, though, that the stop button does not easily >>> (sometimes >>> not at all) repond when the garbage collector is thrashing. >>> This is no problem for me, but may be you want to know. >>> (This pertains to Windows XP Home and to all versions of DrScheme I ever >>> downloaded and to pretty-big, #lang scheme, #!r6rs and more.) >>> Jos >>> >>> ----- Original Message ----- From: "Matthias Felleisen" >>> >>> To: "budu" >>> Cc: >>> Sent: Saturday, July 05, 2008 3:19 PM >>> Subject: Re: [plt-scheme] One small and one big issue with DrScheme >>> >>> >>>> >>>> Well, unlike all other "pedagogic" IDEs, DrScheme has a reliable STOP >>>> button for infinite loops. (It's possible that others have caught up, >>>> but I >>>> am sure we were first.) >>>> >>>> Furthermore, you can and should set the memory limit for REPLs so that >>>> the memory limit for the REPL thread is distinct from the memory limit >>>> for >>>> the whole system and doesn't take it down. You need to teach both ideas >>>> to >>>> beginners eventually: computations consume space, and infinite >>>> computations >>>> consume unbounded space, plus you as a programmer should learn to set >>>> the >>>> limits in your context. >>>> >>>> Thanks for the feedback -- Matthias >>>> >>>> >>>> >>>> >>>> On Jul 4, 2008, at 10:43 AM, budu wrote: >>>> >>>>> Hi, I'm an occasional DrScheme user (normally I use Emacs) and there >>>>> is some little things I don't like about it. One is keyboard >>>>> shortcuts, which I never been able to change. I found out recently >>>>> about the "Enable keybindings in menus" options, it's great, but I'm >>>>> still missing some of my favorite shortcuts, mainly C-j for newline. >>>>> Maybe the answer lies into the Help Desk, but it totally confuse me, >>>>> it seems like I'm never able to find what I'm searching for. >>>>> >>>>> The bigger issue now is about DrScheme not being as solid as I'd like >>>>> it to be. Maybe I'm too much used to Emacs, because when I use its >>>>> REPL it never crash no matter what. I've lost some code (without any >>>>> importance) this morning because I did try to run a function that >>>>> generate an infinite loop and it crashed DrScheme with an out of >>>>> memory exception. When considering that this IDE is geared toward >>>>> beginners, I find it strange that it can't sustain even a mere >>>>> infinite loop. Maybe that's the price to pay for the great debugging >>>>> features DrSceme have. >>>>> >>>>> BTW, I'm a little late for this but congratulation to the PLT devs for >>>>> version 4, it's a really great release. >>>>> >>>>> _________________________________________________ >>>>> For list-related administrative tasks: >>>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>> >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> > > > From tbmcmullen at gmail.com Sat Jul 5 03:11:17 2008 From: tbmcmullen at gmail.com (Tyler McMullen) Date: Thu Mar 26 02:22:35 2009 Subject: [plt-scheme] questions about modules and keyword arguments and so on Message-ID: I'm rather new to Scheme, so please excuse me if I sound like an idiot. So, I have two files: web.scm and site.scm. web.scm is supposed to define a module "web"... which site.scm then loads and uses. web.scm gets required just fine... however when it tries to run "start" I get the following error: > (load "site.scm") struct procedure:serve: expects 0 arguments plus an argument with keyword #:dispatch plus optional arguments with keywords #:initial- connection-timeout, #:listen-ip, #:max-waiting, #:port, and #:tcp@, given 4: #:port port #:dispatch # Suffice it to say that I'm really confused. Any pointers? web.scm --- (module web mzscheme (require web-server/web-server web-server/private/response web-server/private/request-structs net/url) (define routes '()) (define (dispatch-mvc conn req) (output-response conn (eval (cdr (assoc (url->string (request-uri req)) routes))))) (define (start rts port) (set! routes rts) (serve #:port port #:dispatch dispatch-mvc)) (provide start)) site.scm --- (require "web.scm") (define (hello-world) "hello world!") (define (goodbye-world) "goodbye cruel world") (define my-routes '(("/" hello-world) ("/foo" goodbye-world))) (start my-routes 3000) From yarkun at gmail.com Sat Jul 5 16:19:49 2008 From: yarkun at gmail.com (Yavuz Arkun) Date: Thu Mar 26 02:22:35 2009 Subject: [plt-scheme] minor WHEN and UNLESS question Message-ID: <2748b30b0807051319n36bbe475i3d6f3ea9d8bc8319@mail.gmail.com> This is a rather minor issue I noticed in the documentation: According to http://docs.plt-scheme.org/reference/when_unless.html, the results of evaluating WHEN and UNLESS are ignored. According to http://docs.plt-scheme.org/reference/when_unless.html, the result is # (which is of course ignored by the REPL). Evaluating the following expression in module language shows that actually the result of the last expression in the body is available at least in some cases; didn't test extensively. > (+ 1 (when #t (+ 1 2) (+ 3 4))) 8 >(+ 1 (unless #f (+ 1 2) (+ 3 4))) 8 So the question is...which version is the correct one? Ignored, #, value of the last expression in the body? --Yavuz From matthias at ccs.neu.edu Sat Jul 5 16:42:21 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:22:35 2009 Subject: [plt-scheme] minor WHEN and UNLESS question In-Reply-To: <2748b30b0807051319n36bbe475i3d6f3ea9d8bc8319@mail.gmail.com> References: <2748b30b0807051319n36bbe475i3d6f3ea9d8bc8319@mail.gmail.com> Message-ID: Like all Scheme conditionals, when/unless return the value of their sub-expressions if the condition is true. Otherwise, they produce false. The docs are wrong. Thanks for reporting the problem. For future discoveries of mistakes, please use Help Desk to report them. -- Matthias On Jul 5, 2008, at 4:19 PM, Yavuz Arkun wrote: > This is a rather minor issue I noticed in the documentation: > > According to http://docs.plt-scheme.org/reference/when_unless.html, > the results of evaluating WHEN and UNLESS are ignored. According to > http://docs.plt-scheme.org/reference/when_unless.html, the result is > # (which is of course ignored by the REPL). Evaluating the > following expression in module language > shows that actually the result of the last expression in the body is > available at least in some cases; didn't test extensively. > >> (+ 1 (when #t (+ 1 2) (+ 3 4))) > 8 > >> (+ 1 (unless #f (+ 1 2) (+ 3 4))) > 8 > > So the question is...which version is the correct one? Ignored, > #, value of the last expression in the body? > --Yavuz > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From aleks at cs.brown.edu Sat Jul 5 18:07:40 2008 From: aleks at cs.brown.edu (Aleks Bromfield) Date: Thu Mar 26 02:22:35 2009 Subject: [plt-scheme] Windows MSI installer Message-ID: <20080705220740.GA17668@cs.brown.edu> How is the DrScheme installer for Windows currently generated? How much work would it be to produce an MSI instead of / in addition to the current installer? Alternatively, is there any reason not to install DrScheme to a network location? ~ Aleks From praimon at gmail.com Sat Jul 5 19:12:19 2008 From: praimon at gmail.com (praimon) Date: Thu Mar 26 02:22:35 2009 Subject: [plt-scheme] "Seg fault (internal error) at 12" upon startingDrScheme, version 4.0.1.3, english In-Reply-To: <003101c8dd16$2beb7790$2101a8c0@uw2b2dff239c4d> References: <003101c8dd16$2beb7790$2101a8c0@uw2b2dff239c4d> Message-ID: <4acd8930807051612va182eabl873fab8b5644ad4e@mail.gmail.com> hello, That problem has persisted in subsequent versions. 4.0.2.3 seg faults on my WinXp Home box. Versions 372 and 3.99.xx work fine. regards, praimon On 7/3/08, Jos Koot wrote: > See also http://bugs.plt-scheme.org/query/?cmd=view&pr=9556 > Jos > > ----- Original Message ----- From: "Benjamin L.Russell" > > To: > Sent: Thursday, July 03, 2008 6:21 AM > Subject: [plt-scheme] "Seg fault (internal error) at 12" upon > startingDrScheme, version 4.0.1.3, english > > > > > I just downloaded and installed DrScheme, version 4.0.1.3, english, in > > "C:\Program Files\PLT-4.0.1.3" on Windows XP Professional, Service > > Pack 2, but every time I start up this pre-release version of > > DrScheme, the following error pops up in a Command Prompt box: > > > > > > > Seg fault (internal error) at 12 > > > From eli at barzilay.org Sat Jul 5 21:42:14 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:36 2009 Subject: [plt-scheme] Windows MSI installer In-Reply-To: <20080705220740.GA17668@cs.brown.edu> References: <20080705220740.GA17668@cs.brown.edu> Message-ID: <18544.8950.655805.326126@arabic.ccs.neu.edu> On Jul 5, Aleks Bromfield wrote: > How is the DrScheme installer for Windows currently generated? Using NSIS (http://nsis.sourceforge.net/Main_Page). > How much work would it be to produce an MSI instead of / in addition > to the current installer? There are several things that I don't know about, and make me think that it's better to stick with the current setup: * Technical: I don't know of an application that allows me to compile an msi, one that will allow me the same kind of flexibility I get with NSIS (mostly specifying the installer via a script, and being able to create it remotely through an ssh session). * Major: I'm not sure that MSI works everywhere that DrScheme does. (But maybe Win95/98/ME is completely dead? And if not, maybe it handles MSIs too?) * Most important: I don't know if there are any advantages of using an MSI. (And I don't know, but I assume, that it has the same functionality as NSIS -- the usual stuff of creating the directory, tweaking registry keys, creating the start menu entry etc). This is the most important question, of course, given how much work is involved in dealing with the installers. > Alternatively, is there any reason not to install DrScheme to a > network location? I don't know why that's "alternatively", but it should run fine from a network. NEU does it all the time. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Sat Jul 5 21:47:52 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:36 2009 Subject: [plt-scheme] minor WHEN and UNLESS question In-Reply-To: References: <2748b30b0807051319n36bbe475i3d6f3ea9d8bc8319@mail.gmail.com> Message-ID: <18544.9288.397008.651670@arabic.ccs.neu.edu> Looks to me like something that perhaps was planned? I think that the main point of the documentation should be that *you* shouldn't use the result of `when'/`unless', because it might be void (not #f, btw). If the forms need to always return void, then the implementation will not have the subform in a tail-position, which will destroy things like (let loop () ... (unless blah (loop))) but the description says just that ("No expr is in tail position with respect to the when form"). On Jul 5, Matthias Felleisen wrote: > > Like all Scheme conditionals, when/unless return the value of their > sub-expressions if the condition is true. Otherwise, they produce > false. The docs are wrong. > > Thanks for reporting the problem. For future discoveries of > mistakes, please use Help Desk to report them. -- Matthias > > > > On Jul 5, 2008, at 4:19 PM, Yavuz Arkun wrote: > > > This is a rather minor issue I noticed in the documentation: > > > > According to http://docs.plt-scheme.org/reference/when_unless.html, > > the results of evaluating WHEN and UNLESS are ignored. According to > > http://docs.plt-scheme.org/reference/when_unless.html, the result is > > # (which is of course ignored by the REPL). Evaluating the > > following expression in module language > > shows that actually the result of the last expression in the body is > > available at least in some cases; didn't test extensively. > > > >> (+ 1 (when #t (+ 1 2) (+ 3 4))) > > 8 > > > >> (+ 1 (unless #f (+ 1 2) (+ 3 4))) > > 8 > > > > So the question is...which version is the correct one? Ignored, > > #, value of the last expression in the body? > > --Yavuz > > _________________________________________________ > > For list-related administrative tasks: > > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From kumar_lista at mac.com Sat Jul 5 22:02:15 2008 From: kumar_lista at mac.com (kumar_lista@mac.com) Date: Thu Mar 26 02:22:36 2009 Subject: [plt-scheme] Re: Continuous update sliders ... In-Reply-To: <20080704092251.7A8A14048C@qua.cs.brown.edu> References: <20080704092251.7A8A14048C@qua.cs.brown.edu> Message-ID: I do have the callback function, but here is what happens - - Between mouse-down and mouse-up the callback doesn't get invoked and the main event processing seems to pause. - Upon mouse-up, the callback is invoked as many times as, I think, the value of the slider changed between mouse-down and mouse-up in one go. - Timer events that should have been generated between the mouse-down and mouse-up don't fire at all. That's how I came to conclude that the main event loop is paused. Regards -Kumar PS: Platform - Vista Ultimate, running on MacBook Pro. On 04 Jul 2008, at 8:19 PM, Matthew Flatt wrote: > At Fri, 04 Jul 2008 11:23:45 +0800, kumar_lista@mac.com wrote: > >> Hi, >> >> I need some help with the slider% class. Much appreciate any tips. >> >> The slider% class behaves modally as it stands - i.e. between >> mouse-down >> and mouse-up on the slider control, the main event loop does not get >> to run. >> How do I configure slider% such that I can twiddle it without pausing >> the >> main event loop between mouse-down and mouse-up? >> > > Provide a `callback' argument when creating a `slider%'. > > The following example illustrates updating a message field > interactively based on the value of the slider: > > #lang scheme/gui > > (define f (new frame% [label "Hi"])) > (define m (new message% [parent f] [label ""] > [stretchable-width #t])) > (new slider% > [label #f] [min-value 0] [max-value 100] > [parent f] > [callback (lambda (s e) > (send m set-label > (format "Value is ~s" (send s get-value))))]) > (send f show #t) > From jos.koot at telefonica.net Sat Jul 5 22:12:00 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:22:36 2009 Subject: [plt-scheme] "Seg fault (internal error) at 12" uponstartingDrScheme, version 4.0.1.3, english References: <003101c8dd16$2beb7790$2101a8c0@uw2b2dff239c4d> <4acd8930807051612va182eabl873fab8b5644ad4e@mail.gmail.com> Message-ID: <000a01c8df0d$ad4617c0$2101a8c0@uw2b2dff239c4d> The problem appeared with 4.0.1.2. DrScheme of 4.0.1.1 loads nicely. Jos ----- Original Message ----- From: "praimon" To: Sent: Sunday, July 06, 2008 1:12 AM Subject: Re: [plt-scheme] "Seg fault (internal error) at 12" uponstartingDrScheme, version 4.0.1.3, english > hello, > That problem has persisted in subsequent versions. 4.0.2.3 seg faults > on my WinXp Home box. Versions 372 and 3.99.xx work fine. > regards, > praimon > > On 7/3/08, Jos Koot wrote: >> See also http://bugs.plt-scheme.org/query/?cmd=view&pr=9556 >> Jos >> >> ----- Original Message ----- From: "Benjamin L.Russell" >> >> To: >> Sent: Thursday, July 03, 2008 6:21 AM >> Subject: [plt-scheme] "Seg fault (internal error) at 12" upon >> startingDrScheme, version 4.0.1.3, english >> >> >> >> > I just downloaded and installed DrScheme, version 4.0.1.3, english, in >> > "C:\Program Files\PLT-4.0.1.3" on Windows XP Professional, Service >> > Pack 2, but every time I start up this pre-release version of >> > DrScheme, the following error pops up in a Command Prompt box: >> > >> > >> > > Seg fault (internal error) at 12 >> > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From nbuduroi at gmail.com Sat Jul 5 23:06:50 2008 From: nbuduroi at gmail.com (Nicolas Buduroi) Date: Thu Mar 26 02:22:37 2009 Subject: [plt-scheme] One small and one big issue with DrScheme In-Reply-To: <932b2f1f0807050937j10c11a85u31b41f659787ee31@mail.gmail.com> References: <5D1F97E7-E0A2-4B3E-9CA6-FFD7FAA9A524@ccs.neu.edu> <000a01c8deb9$ee30f100$2101a8c0@uw2b2dff239c4d> <932b2f1f0807050916y22310bcfp67951626f58bba06@mail.gmail.com> <002a01c8debd$1554bfc0$2101a8c0@uw2b2dff239c4d> <932b2f1f0807050937j10c11a85u31b41f659787ee31@mail.gmail.com> Message-ID: <1ad6cc6b0807052006y67e9343fmaef3bef15d1949bb@mail.gmail.com> Well, thank you Robby for C-j and you were correct for the preference settings that was carried over to v4. P.S.: Wow! the speed and quality of responses on mailing lists like this one never stop to amaze me compared to typical MS or Java related forums. ;-) On Sat, Jul 5, 2008 at 12:37 PM, Robby Findler wrote: > Well, its a known fact of life when dealing with software that is > using more than the available memory on the system. I'm sure there are > better and worse strategies for dealing with that, some of which could > be improved in drscheme and some of which would have to be done at the > windows level. > > Robby > > On Sat, Jul 5, 2008 at 11:35 AM, Jos Koot wrote: > > You said "The entire system has problems" That's true. Even after a > > succesfull stop and leaving DrScheme, my system may continue thrashing > for > > some time. It may very well be a Windows problem rather than a PLT > problem. > > I don't know. > > Jos > > > > ----- Original Message ----- From: "Robby Findler" < > robby@cs.uchicago.edu> > > To: "Jos Koot" > > Cc: "Matthias Felleisen" ; "budu" > > ; > > Sent: Saturday, July 05, 2008 6:16 PM > > Subject: Re: [plt-scheme] One small and one big issue with DrScheme > > > > > >> Yes, I've had that experience too. I find that the keyboard is a > >> little bit more reliable, but in general when thrashing is going on, > >> the entire system has problems. > >> > >> Do you find that this is happening when you're using the memory limits? > >> > >> Robby > >> > >> On Sat, Jul 5, 2008 at 11:12 AM, Jos Koot > wrote: > >>> > >>> As you probably know, I am addicted to PLT Scheme, its IDE included. > >>> I hate typing shell commands. With PLT's IDE I can avoid those > commands.. > >>> Allow me to mention, though, that the stop button does not easily > >>> (sometimes > >>> not at all) repond when the garbage collector is thrashing. > >>> This is no problem for me, but may be you want to know. > >>> (This pertains to Windows XP Home and to all versions of DrScheme I > ever > >>> downloaded and to pretty-big, #lang scheme, #!r6rs and more.) > >>> Jos > >>> > >>> ----- Original Message ----- From: "Matthias Felleisen" > >>> > >>> To: "budu" > >>> Cc: > >>> Sent: Saturday, July 05, 2008 3:19 PM > >>> Subject: Re: [plt-scheme] One small and one big issue with DrScheme > >>> > >>> > >>>> > >>>> Well, unlike all other "pedagogic" IDEs, DrScheme has a reliable STOP > >>>> button for infinite loops. (It's possible that others have caught up, > >>>> but I > >>>> am sure we were first.) > >>>> > >>>> Furthermore, you can and should set the memory limit for REPLs so > that > >>>> the memory limit for the REPL thread is distinct from the memory > limit > >>>> for > >>>> the whole system and doesn't take it down. You need to teach both > ideas > >>>> to > >>>> beginners eventually: computations consume space, and infinite > >>>> computations > >>>> consume unbounded space, plus you as a programmer should learn to set > >>>> the > >>>> limits in your context. > >>>> > >>>> Thanks for the feedback -- Matthias > >>>> > >>>> > >>>> > >>>> > >>>> On Jul 4, 2008, at 10:43 AM, budu wrote: > >>>> > >>>>> Hi, I'm an occasional DrScheme user (normally I use Emacs) and there > >>>>> is some little things I don't like about it. One is keyboard > >>>>> shortcuts, which I never been able to change. I found out recently > >>>>> about the "Enable keybindings in menus" options, it's great, but I'm > >>>>> still missing some of my favorite shortcuts, mainly C-j for newline. > >>>>> Maybe the answer lies into the Help Desk, but it totally confuse me, > >>>>> it seems like I'm never able to find what I'm searching for. > >>>>> > >>>>> The bigger issue now is about DrScheme not being as solid as I'd like > >>>>> it to be. Maybe I'm too much used to Emacs, because when I use its > >>>>> REPL it never crash no matter what. I've lost some code (without any > >>>>> importance) this morning because I did try to run a function that > >>>>> generate an infinite loop and it crashed DrScheme with an out of > >>>>> memory exception. When considering that this IDE is geared toward > >>>>> beginners, I find it strange that it can't sustain even a mere > >>>>> infinite loop. Maybe that's the price to pay for the great debugging > >>>>> features DrSceme have. > >>>>> > >>>>> BTW, I'm a little late for this but congratulation to the PLT devs > for > >>>>> version 4, it's a really great release. > >>>>> > >>>>> _________________________________________________ > >>>>> For list-related administrative tasks: > >>>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > >>>> > >>>> _________________________________________________ > >>>> For list-related administrative tasks: > >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > >>> > >>> _________________________________________________ > >>> For list-related administrative tasks: > >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > >>> > >>> > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080705/3a853788/attachment.html From robby at cs.uchicago.edu Sat Jul 5 23:17:31 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:37 2009 Subject: [plt-scheme] One small and one big issue with DrScheme In-Reply-To: <1ad6cc6b0807052006y67e9343fmaef3bef15d1949bb@mail.gmail.com> References: <5D1F97E7-E0A2-4B3E-9CA6-FFD7FAA9A524@ccs.neu.edu> <000a01c8deb9$ee30f100$2101a8c0@uw2b2dff239c4d> <932b2f1f0807050916y22310bcfp67951626f58bba06@mail.gmail.com> <002a01c8debd$1554bfc0$2101a8c0@uw2b2dff239c4d> <932b2f1f0807050937j10c11a85u31b41f659787ee31@mail.gmail.com> <1ad6cc6b0807052006y67e9343fmaef3bef15d1949bb@mail.gmail.com> Message-ID: <932b2f1f0807052017i590dd2f5j874f5b1f55cf7b07@mail.gmail.com> On Sat, Jul 5, 2008 at 10:06 PM, Nicolas Buduroi wrote: > P.S.: Wow! the speed and quality of responses on mailing lists like this one > never stop to amaze me compared to typical MS or Java related forums. ;-) Yeah, we're still hungry here. When we become rich & famous we'll also stop caring too. Robby From yarkun at gmail.com Sun Jul 6 03:53:23 2008 From: yarkun at gmail.com (Yavuz Arkun) Date: Thu Mar 26 02:22:37 2009 Subject: [plt-scheme] One small and one big issue with DrScheme In-Reply-To: <932b2f1f0807052017i590dd2f5j874f5b1f55cf7b07@mail.gmail.com> References: <5D1F97E7-E0A2-4B3E-9CA6-FFD7FAA9A524@ccs.neu.edu> <000a01c8deb9$ee30f100$2101a8c0@uw2b2dff239c4d> <932b2f1f0807050916y22310bcfp67951626f58bba06@mail.gmail.com> <002a01c8debd$1554bfc0$2101a8c0@uw2b2dff239c4d> <932b2f1f0807050937j10c11a85u31b41f659787ee31@mail.gmail.com> <1ad6cc6b0807052006y67e9343fmaef3bef15d1949bb@mail.gmail.com> <932b2f1f0807052017i590dd2f5j874f5b1f55cf7b07@mail.gmail.com> Message-ID: <2748b30b0807060053j1eb36fddm9c4f093a8ec87a9d@mail.gmail.com> "Announcement: PLT Scheme v. 12.0 released. It will be automatically installed and your credit card charged for USD259.99. If you don't have enough credit, Homeland Security will be alerted and you will be deported to Gitmo. Nothing new, but now it kinda works if you don't do anything silly. If it isn't working, then you are doing the most stupid thing we have heard. Now off to charity jetsetting to burn the billions we made with our illegal Scheme monopoly, see ya laters." Somehow it doesn't sound very plausible. --Yavuz On Sun, Jul 6, 2008 at 06:17, Robby Findler wrote: > On Sat, Jul 5, 2008 at 10:06 PM, Nicolas Buduroi wrote: >> P.S.: Wow! the speed and quality of responses on mailing lists like this one >> never stop to amaze me compared to typical MS or Java related forums. ;-) > > Yeah, we're still hungry here. When we become rich & famous we'll also > stop caring too. > > Robby > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From etanter at dcc.uchile.cl Sun Jul 6 04:08:34 2008 From: etanter at dcc.uchile.cl (Eric Tanter) Date: Thu Mar 26 02:22:37 2009 Subject: [plt-scheme] strange bug in EOPL (v4.0.x) Message-ID: <5A1C18B8-81C7-4FBA-AD0A-36C170152E36@dcc.uchile.cl> Hi, The following program: (define newcounter (lambda() (let ((c 0)) (lambda(f) (begin (set! c (f c 1)) c))))) (define inc (lambda(x) (x +))) (define cont (newcounter)) (inc cont) (inc cont) gives: 1 2 in Pretty Big, and in EOPL (v372), which is what one would expect. But strangely enough, in EOPL under v4.0.1 and v4.0.2, it gives: 2 4 Any idea what's going on? Thanks, -- ?ric From yarkun at gmail.com Sun Jul 6 04:32:18 2008 From: yarkun at gmail.com (Yavuz Arkun) Date: Thu Mar 26 02:22:37 2009 Subject: [plt-scheme] minor WHEN and UNLESS question In-Reply-To: <18544.9288.397008.651670@arabic.ccs.neu.edu> References: <2748b30b0807051319n36bbe475i3d6f3ea9d8bc8319@mail.gmail.com> <18544.9288.397008.651670@arabic.ccs.neu.edu> Message-ID: <2748b30b0807060132y93741ffsfd3b12e879c7d016@mail.gmail.com> When you say "no expr is in tail position" and "destroy" do you mean that it won't be tail call optimized? Because the infinite loop: (let loop () (unless #f (loop)) seem to run happily forever without apparent GC, just like (let loop () (loop)) BTW, the looping idioms in schematics:cookbook is exactly where I stumbled unto this issue: http://schemecookbook.org/Cookbook/IdiomLoopingConstructs Are you suggesting that they are inappropriate in PLT Scheme? --Yavuz On Sun, Jul 6, 2008 at 04:47, Eli Barzilay wrote: > Looks to me like something that perhaps was planned? > > I think that the main point of the documentation should be that *you* > shouldn't use the result of `when'/`unless', because it might be void > (not #f, btw). If the forms need to always return void, then the > implementation will not have the subform in a tail-position, which > will destroy things like > > (let loop () > ... > (unless blah (loop))) > > but the description says just that ("No expr is in tail position with > respect to the when form"). > > > On Jul 5, Matthias Felleisen wrote: >> >> Like all Scheme conditionals, when/unless return the value of their >> sub-expressions if the condition is true. Otherwise, they produce >> false. The docs are wrong. >> >> Thanks for reporting the problem. For future discoveries of >> mistakes, please use Help Desk to report them. -- Matthias >> >> >> >> On Jul 5, 2008, at 4:19 PM, Yavuz Arkun wrote: >> >> > This is a rather minor issue I noticed in the documentation: >> > >> > According to http://docs.plt-scheme.org/reference/when_unless.html, >> > the results of evaluating WHEN and UNLESS are ignored. According to >> > http://docs.plt-scheme.org/reference/when_unless.html, the result is >> > # (which is of course ignored by the REPL). Evaluating the >> > following expression in module language >> > shows that actually the result of the last expression in the body is >> > available at least in some cases; didn't test extensively. >> > >> >> (+ 1 (when #t (+ 1 2) (+ 3 4))) >> > 8 >> > >> >> (+ 1 (unless #f (+ 1 2) (+ 3 4))) >> > 8 >> > >> > So the question is...which version is the correct one? Ignored, >> > #, value of the last expression in the body? >> > --Yavuz >> > _________________________________________________ >> > For list-related administrative tasks: >> > http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://www.barzilay.org/ Maze is Life! > From eli at barzilay.org Sun Jul 6 04:33:54 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:38 2009 Subject: [plt-scheme] strange bug in EOPL (v4.0.x) In-Reply-To: <5A1C18B8-81C7-4FBA-AD0A-36C170152E36@dcc.uchile.cl> References: <5A1C18B8-81C7-4FBA-AD0A-36C170152E36@dcc.uchile.cl> Message-ID: <18544.33650.865520.521913@arabic.ccs.neu.edu> On Jul 6, Eric Tanter wrote: > Hi, > > The following program: > [...] > Any idea what's going on? Looks like a bug with `begin' -- this: (define (z) (begin (display "foo\n"))) (z) prints "foo" twice. Also, it looks like this is fixed in subversion. For now, you can simply remove that `begin'. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Sun Jul 6 04:38:30 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:38 2009 Subject: [plt-scheme] minor WHEN and UNLESS question In-Reply-To: <2748b30b0807060132y93741ffsfd3b12e879c7d016@mail.gmail.com> References: <2748b30b0807051319n36bbe475i3d6f3ea9d8bc8319@mail.gmail.com> <18544.9288.397008.651670@arabic.ccs.neu.edu> <2748b30b0807060132y93741ffsfd3b12e879c7d016@mail.gmail.com> Message-ID: <18544.33926.797623.753190@arabic.ccs.neu.edu> On Jul 6, Yavuz Arkun wrote: > When you say "no expr is in tail position" and "destroy" do you mean > that it won't be tail call optimized? Yes. > Because the infinite loop: > > (let loop () > (unless #f (loop)) > > seem to run happily forever without apparent GC, [...] Right -- and the reason for that is that the implementation does *not* follow the documentation. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From robby at cs.uchicago.edu Sun Jul 6 06:49:01 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:38 2009 Subject: [plt-scheme] One small and one big issue with DrScheme In-Reply-To: <2748b30b0807060053j1eb36fddm9c4f093a8ec87a9d@mail.gmail.com> References: <5D1F97E7-E0A2-4B3E-9CA6-FFD7FAA9A524@ccs.neu.edu> <000a01c8deb9$ee30f100$2101a8c0@uw2b2dff239c4d> <932b2f1f0807050916y22310bcfp67951626f58bba06@mail.gmail.com> <002a01c8debd$1554bfc0$2101a8c0@uw2b2dff239c4d> <932b2f1f0807050937j10c11a85u31b41f659787ee31@mail.gmail.com> <1ad6cc6b0807052006y67e9343fmaef3bef15d1949bb@mail.gmail.com> <932b2f1f0807052017i590dd2f5j874f5b1f55cf7b07@mail.gmail.com> <2748b30b0807060053j1eb36fddm9c4f093a8ec87a9d@mail.gmail.com> Message-ID: <932b2f1f0807060349g5dd4b1d5t2b42ad23126b0870@mail.gmail.com> . My dream, so beautifully rendered. :) Okay, seriously, back to work for me. Robby On Sun, Jul 6, 2008 at 2:53 AM, Yavuz Arkun wrote: > "Announcement: PLT Scheme v. 12.0 released. It will be automatically > installed and your credit card charged for USD259.99. If you don't > have enough credit, Homeland Security will be alerted and you will be > deported to Gitmo. Nothing new, but now it kinda works if you don't do > anything silly. If it isn't working, then you are doing the most > stupid thing we have heard. Now off to charity jetsetting to burn the > billions we made with our illegal Scheme monopoly, see ya laters." > > Somehow it doesn't sound very plausible. > --Yavuz > > On Sun, Jul 6, 2008 at 06:17, Robby Findler wrote: >> On Sat, Jul 5, 2008 at 10:06 PM, Nicolas Buduroi wrote: >>> P.S.: Wow! the speed and quality of responses on mailing lists like this one >>> never stop to amaze me compared to typical MS or Java related forums. ;-) >> >> Yeah, we're still hungry here. When we become rich & famous we'll also >> stop caring too. >> >> Robby >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From mflatt at cs.utah.edu Sun Jul 6 08:03:31 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:38 2009 Subject: [plt-scheme] strange bug in EOPL (v4.0.x) In-Reply-To: <18544.33650.865520.521913@arabic.ccs.neu.edu> References: <5A1C18B8-81C7-4FBA-AD0A-36C170152E36@dcc.uchile.cl> <18544.33650.865520.521913@arabic.ccs.neu.edu> Message-ID: <20080706120333.92293650091@mail-svr1.cs.utah.edu> At Sun, 6 Jul 2008 04:33:54 -0400, Eli Barzilay wrote: > On Jul 6, Eric Tanter wrote: > > Hi, > > > > The following program: > > [...] > > Any idea what's going on? > > Looks like a bug with `begin' -- this: > > (define (z) > (begin (display "foo\n"))) > (z) > > prints "foo" twice. Also, it looks like this is fixed in subversion. More specifically, it's a bug with `begin' in internal-definition positions. The EoPL implementation inherits the bug from the R5RS implementation in 4.0. I should have thought to have the repair included in 4.0.2, but I forgot about it. Matthew From mflatt at cs.utah.edu Sun Jul 6 08:34:13 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:38 2009 Subject: [plt-scheme] minor WHEN and UNLESS question In-Reply-To: <18544.9288.397008.651670@arabic.ccs.neu.edu> References: <2748b30b0807051319n36bbe475i3d6f3ea9d8bc8319@mail.gmail.com> <18544.9288.397008.651670@arabic.ccs.neu.edu> Message-ID: <20080706123416.3F4506500AF@mail-svr1.cs.utah.edu> At Sat, 5 Jul 2008 21:47:52 -0400, Eli Barzilay wrote: > Looks to me like something that perhaps was planned? Possibly; I forget. Breaking tail position would be a bad idea, in any case, so let's call this a doc bug. The last expression in a `when' or `unless' form is in tail position, and it will stay that way. Matthew > I think that the main point of the documentation should be that *you* > shouldn't use the result of `when'/`unless', because it might be void > (not #f, btw). If the forms need to always return void, then the > implementation will not have the subform in a tail-position, which > will destroy things like > > (let loop () > ... > (unless blah (loop))) > > but the description says just that ("No expr is in tail position with > respect to the when form"). > > > On Jul 5, Matthias Felleisen wrote: > > > > Like all Scheme conditionals, when/unless return the value of their > > sub-expressions if the condition is true. Otherwise, they produce > > false. The docs are wrong. > > > > Thanks for reporting the problem. For future discoveries of > > mistakes, please use Help Desk to report them. -- Matthias > > > > > > > > On Jul 5, 2008, at 4:19 PM, Yavuz Arkun wrote: > > > > > This is a rather minor issue I noticed in the documentation: > > > > > > According to http://docs.plt-scheme.org/reference/when_unless.html, > > > the results of evaluating WHEN and UNLESS are ignored. According to > > > http://docs.plt-scheme.org/reference/when_unless.html, the result is > > > # (which is of course ignored by the REPL). Evaluating the > > > following expression in module language > > > shows that actually the result of the last expression in the body is > > > available at least in some cases; didn't test extensively. > > > > > >> (+ 1 (when #t (+ 1 2) (+ 3 4))) > > > 8 > > > > > >> (+ 1 (unless #f (+ 1 2) (+ 3 4))) > > > 8 > > > > > > So the question is...which version is the correct one? Ignored, > > > #, value of the last expression in the body? > > > --Yavuz > > > _________________________________________________ > > > For list-related administrative tasks: > > > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > > > _________________________________________________ > > For list-related administrative tasks: > > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://www.barzilay.org/ Maze is Life! > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mflatt at cs.utah.edu Sun Jul 6 08:47:44 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:38 2009 Subject: [plt-scheme] "Seg fault (internal error) at 12" uponstartingDrScheme, version 4.0.1.3, english In-Reply-To: <000a01c8df0d$ad4617c0$2101a8c0@uw2b2dff239c4d> References: <003101c8dd16$2beb7790$2101a8c0@uw2b2dff239c4d> <4acd8930807051612va182eabl873fab8b5644ad4e@mail.gmail.com> <000a01c8df0d$ad4617c0$2101a8c0@uw2b2dff239c4d> Message-ID: <20080706124748.529E765009E@mail-svr1.cs.utah.edu> I think I've finally fixed this in SVN (for the next build). Matthew At Sun, 6 Jul 2008 04:12:00 +0200, "Jos Koot" wrote: > The problem appeared with 4.0.1.2. > DrScheme of 4.0.1.1 loads nicely. > Jos > ----- Original Message ----- > From: "praimon" > To: > Sent: Sunday, July 06, 2008 1:12 AM > Subject: Re: [plt-scheme] "Seg fault (internal error) at 12" > uponstartingDrScheme, version 4.0.1.3, english > > > > hello, > > That problem has persisted in subsequent versions. 4.0.2.3 seg faults > > on my WinXp Home box. Versions 372 and 3.99.xx work fine. > > regards, > > praimon > > > > On 7/3/08, Jos Koot wrote: > >> See also http://bugs.plt-scheme.org/query/?cmd=view&pr=9556 > >> Jos > >> > >> ----- Original Message ----- From: "Benjamin L.Russell" > >> > >> To: > >> Sent: Thursday, July 03, 2008 6:21 AM > >> Subject: [plt-scheme] "Seg fault (internal error) at 12" upon > >> startingDrScheme, version 4.0.1.3, english > >> > >> > >> > >> > I just downloaded and installed DrScheme, version 4.0.1.3, english, in > >> > "C:\Program Files\PLT-4.0.1.3" on Windows XP Professional, Service > >> > Pack 2, but every time I start up this pre-release version of > >> > DrScheme, the following error pops up in a Command Prompt box: > >> > > >> > > >> > > Seg fault (internal error) at 12 > >> > > > > _________________________________________________ > > For list-related administrative tasks: > > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mflatt at cs.utah.edu Sun Jul 6 09:05:56 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:38 2009 Subject: [plt-scheme] Re: Continuous update sliders ... In-Reply-To: References: <20080703205650.0E5DC4041E@qua.cs.brown.edu> <75D9E585-700D-4A72-97D1-8AE018AA54C7@mac.com> <20080704121943.D4DE06500A8@mail-svr1.cs.utah.edu> Message-ID: <20080706130558.F203765009D@mail-svr1.cs.utah.edu> There are some constraints on concurrency during slider movement, at least under Windows and Mac OS X. Other Scheme threads do not run, and it's possible for a slider callback to be suspended (and further slider callbacks and other events to be delayed) if the callback synchronizes with another thread. Those constraints are related to a slight mismatch between PLT Scheme's threading and eventspace model and the underlying GUI toolbox's model. Does your program involve extra threads somehow? Can you create a small example where slider callbacks get stuck? Matthew At Sun, 06 Jul 2008 09:59:16 +0800, kumar wrote: > > I do have the callback function, but here is what happens - > > - Between mouse-down and mouse-up the callback doesn't get invoked > and the main event processing seems to pause. > > - Upon mouse-up, the callback is invoked as many times as, I think, > the value of the slider changed between mouse-down and mouse-up > in one go. > > - Timer events that should have been generated between the mouse-down > and mouse-up don't fire at all. That's how I came to conclude that the > main event loop is paused. > > Regards > -Kumar > > On 04 Jul 2008, at 8:19 PM, Matthew Flatt wrote: > > > At Fri, 04 Jul 2008 11:23:45 +0800, kumar_lista@mac.com wrote: > >> Hi, > >> > >> I need some help with the slider% class. Much appreciate any tips. > >> > >> The slider% class behaves modally as it stands - i.e. between > >> mouse-down > >> and mouse-up on the slider control, the main event loop does not get > >> to run. > >> How do I configure slider% such that I can twiddle it without pausing > >> the > >> main event loop between mouse-down and mouse-up? > > > > Provide a `callback' argument when creating a `slider%'. > > > > The following example illustrates updating a message field > > interactively based on the value of the slider: > > > > #lang scheme/gui > > > > (define f (new frame% [label "Hi"])) > > (define m (new message% [parent f] [label ""] > > [stretchable-width #t])) > > (new slider% > > [label #f] [min-value 0] [max-value 100] > > [parent f] > > [callback (lambda (s e) > > (send m set-label > > (format "Value is ~s" (send s get-value))))]) > > (send f show #t) > > From sk at cs.brown.edu Sun Jul 6 09:15:04 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:22:39 2009 Subject: [plt-scheme] One small and one big issue with DrScheme In-Reply-To: <2748b30b0807060053j1eb36fddm9c4f093a8ec87a9d@mail.gmail.com> References: <5D1F97E7-E0A2-4B3E-9CA6-FFD7FAA9A524@ccs.neu.edu> <000a01c8deb9$ee30f100$2101a8c0@uw2b2dff239c4d> <932b2f1f0807050916y22310bcfp67951626f58bba06@mail.gmail.com> <002a01c8debd$1554bfc0$2101a8c0@uw2b2dff239c4d> <932b2f1f0807050937j10c11a85u31b41f659787ee31@mail.gmail.com> <1ad6cc6b0807052006y67e9343fmaef3bef15d1949bb@mail.gmail.com> <932b2f1f0807052017i590dd2f5j874f5b1f55cf7b07@mail.gmail.com> <2748b30b0807060053j1eb36fddm9c4f093a8ec87a9d@mail.gmail.com> Message-ID: 8. NOTE ON JAVA SUPPORT. THE SOFTWARE PRODUCT CONTAINS SUPPORT FOR PROGRAMS WRITTEN IN JAVA. JAVA TECHNOLOGY IS NOT FAULT TOLERANT AND IS NOT DESIGNED, MANUFACTURED, OR INTENDED FOR USE OR RESALE AS ON-LINE CONTROL EQUIPMENT IN HAZARDOUS ENVIRONMENTS REQUIRING FAIL-SAFE PERFORMANCE, SUCH AS IN THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH THE FAILURE OF JAVA TECHNOLOGY COULD LEAD DIRECTLY TO DEATH, PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE. [From Microsoft NT 4.0's license agreement, circa 1997. Because, you know, NT is fault-tolerant and designed, manufactured, and intended for use or resale as on-line control equipment in hazardous environments. Oh wait --] S. From jos.koot at telefonica.net Sun Jul 6 11:34:54 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:22:39 2009 Subject: [plt-scheme] "Seg fault (internal error) at 12"uponstartingDrScheme, version 4.0.1.3, english References: <003101c8dd16$2beb7790$2101a8c0@uw2b2dff239c4d><4acd8930807051612va182eabl873fab8b5644ad4e@mail.gmail.com> <000a01c8df0d$ad4617c0$2101a8c0@uw2b2dff239c4d> <20080706124748.529E765009E@mail-svr1.cs.utah.edu> Message-ID: <000c01c8df7d$d6ed4880$2101a8c0@uw2b2dff239c4d> Great, Thanks. Jos ----- Original Message ----- From: "Matthew Flatt" To: "Jos Koot" Cc: "praimon" ; Sent: Sunday, July 06, 2008 2:47 PM Subject: Re: [plt-scheme] "Seg fault (internal error) at 12"uponstartingDrScheme, version 4.0.1.3, english >I think I've finally fixed this in SVN (for the next build). > > Matthew > > SNIP From lunarc.lists at gmail.com Sun Jul 6 13:33:15 2008 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:22:39 2009 Subject: [plt-scheme] Testing Readability Message-ID: I've defined 'read-from-string' as: (define (read-from-string s) (read (open-input-string s))) Is it possible to test the readability of a string to define a 'readable-string?' function without just catching all exceptions from read? Henk From czhu at cs.utah.edu Sun Jul 6 17:04:41 2008 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:22:39 2009 Subject: [plt-scheme] Testing Readability In-Reply-To: References: Message-ID: <48713369.4000300@cs.utah.edu> Use read-from-string from mzlib/string. Chongkai Henk Boom wrote: > I've defined 'read-from-string' as: > > (define (read-from-string s) > (read (open-input-string s))) > > Is it possible to test the readability of a string to define a > 'readable-string?' function without just catching all exceptions from > read? > > Henk > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jev at mac.com Sun Jul 6 16:52:01 2008 From: jev at mac.com (Jaime Vargas) Date: Thu Mar 26 02:22:40 2009 Subject: [plt-scheme] FrTime and sequential evaluation Message-ID: I have been playing with FrTime and I like it. However, I have a question. How do I enforce sequential evaluation? In the following code the procedurer count-down doesn't behave as expected. ;;; Definitions window (define elapsed (new-cell 0)) (define (tick) (- seconds (value-now seconds))) (define (start-timer direction) (set-cell! elapsed (direction (value-now elapsed) (tick)))) (define (stop-timer) (set-cell! elapsed (value-now elapsed))) (define (get-timer) elapsed) (define reset-timer (case-lambda [(v) (set-cell! elapsed v)] [() (set-cell! elapsed 0)])) (define (count-down v) (reset-timer v) (start-timer -)) (define (trigger-alarm) (when (= 0 elapsed) (stop-timer) "wake-up")) ;; Interactions window > (get-timer) 0 > (count-down 10) This starts counting down from 0, when I expected to count down from 10. Thanks, Jaime -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080706/fe175d41/attachment.htm From lunarc.lists at gmail.com Sun Jul 6 17:44:20 2008 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:22:40 2009 Subject: [plt-scheme] Testing Readability In-Reply-To: <48713369.4000300@cs.utah.edu> References: <48713369.4000300@cs.utah.edu> Message-ID: 2008/7/6 Chongkai Zhu : > Use read-from-string from mzlib/string. Thanks! It's always nice to get a response that tells you what you didn't know you were really looking for =). Henk From zhenya at freeshell.org Sun Jul 6 22:34:16 2008 From: zhenya at freeshell.org (Evgeny Roubinchtein) Date: Thu Mar 26 02:22:40 2009 Subject: [plt-scheme] Keybindings In-Reply-To: <932b2f1f0807040954x29477e3ard4fd373805b5126a@mail.gmail.com> References: <481286B7.2050609@zenburn.net> <932b2f1f0807040859l1212432fg6499eca40c0e2a9b@mail.gmail.com> <2748b30b0807040918y2c1ca5c5r24340baf493d1923@mail.gmail.com> <932b2f1f0807040954x29477e3ard4fd373805b5126a@mail.gmail.com> Message-ID: <18545.32936.296900.332991@sverige.freeshell.org> In case something like this comes up again, the following Wikipedia page has links to a bunch of human interface guidelines documents (including links to Windows, Mac, GNOME and KDE guidelines): http://en.wikipedia.org/wiki/Human_interface_guidelines A quick check of the GNOME and KDE documents suggests that Redo is Control-Shift-Z in GNOME, and Control-Y in KDE (with Control-Shit-Z also being an acceptable alternative in KDE). -- Evgeny From robby at cs.uchicago.edu Sun Jul 6 22:44:13 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:40 2009 Subject: [plt-scheme] Keybindings In-Reply-To: <18545.32936.296900.332991@sverige.freeshell.org> References: <481286B7.2050609@zenburn.net> <932b2f1f0807040859l1212432fg6499eca40c0e2a9b@mail.gmail.com> <2748b30b0807040918y2c1ca5c5r24340baf493d1923@mail.gmail.com> <932b2f1f0807040954x29477e3ard4fd373805b5126a@mail.gmail.com> <18545.32936.296900.332991@sverige.freeshell.org> Message-ID: <932b2f1f0807061944v51b3d10em5560379d7b85a5bd@mail.gmail.com> Thanks! Robby On Sun, Jul 6, 2008 at 9:34 PM, Evgeny Roubinchtein wrote: > In case something like this comes up again, the following Wikipedia > page has links to a bunch of human interface guidelines documents > (including links to Windows, Mac, GNOME and KDE guidelines): > > http://en.wikipedia.org/wiki/Human_interface_guidelines > > A quick check of the GNOME and KDE documents suggests that Redo is > Control-Shift-Z in GNOME, and Control-Y in KDE (with Control-Shit-Z > also being an acceptable alternative in KDE). > > -- > Evgeny > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From eli at barzilay.org Sun Jul 6 23:03:24 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:40 2009 Subject: [plt-scheme] Keybindings In-Reply-To: <932b2f1f0807061944v51b3d10em5560379d7b85a5bd@mail.gmail.com> References: <481286B7.2050609@zenburn.net> <932b2f1f0807040859l1212432fg6499eca40c0e2a9b@mail.gmail.com> <2748b30b0807040918y2c1ca5c5r24340baf493d1923@mail.gmail.com> <932b2f1f0807040954x29477e3ard4fd373805b5126a@mail.gmail.com> <18545.32936.296900.332991@sverige.freeshell.org> <932b2f1f0807061944v51b3d10em5560379d7b85a5bd@mail.gmail.com> Message-ID: <18545.34684.571952.742989@arabic.ccs.neu.edu> Is it possible to have both shortcuts available on Linux? I see several applciations where Ctrl+Y is redo. (And it probably doesn't hurt to keep in on OSX too, and to add C-S-Y on Windows too.) On Jul 6, Robby Findler wrote: > Thanks! > > Robby > > On Sun, Jul 6, 2008 at 9:34 PM, Evgeny Roubinchtein > wrote: > > In case something like this comes up again, the following Wikipedia > > page has links to a bunch of human interface guidelines documents > > (including links to Windows, Mac, GNOME and KDE guidelines): > > > > http://en.wikipedia.org/wiki/Human_interface_guidelines > > > > A quick check of the GNOME and KDE documents suggests that Redo is > > Control-Shift-Z in GNOME, and Control-Y in KDE (with Control-Shit-Z > > also being an acceptable alternative in KDE). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From robby at cs.uchicago.edu Sun Jul 6 23:14:19 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:41 2009 Subject: [plt-scheme] Keybindings In-Reply-To: <18545.34684.571952.742989@arabic.ccs.neu.edu> References: <481286B7.2050609@zenburn.net> <932b2f1f0807040859l1212432fg6499eca40c0e2a9b@mail.gmail.com> <2748b30b0807040918y2c1ca5c5r24340baf493d1923@mail.gmail.com> <932b2f1f0807040954x29477e3ard4fd373805b5126a@mail.gmail.com> <18545.32936.296900.332991@sverige.freeshell.org> <932b2f1f0807061944v51b3d10em5560379d7b85a5bd@mail.gmail.com> <18545.34684.571952.742989@arabic.ccs.neu.edu> Message-ID: <932b2f1f0807062014m3005dc02vdc4a67b5ead68997@mail.gmail.com> Its not possible to have both in the menu items, I don't think. I'm not sure there is any value to using a non-platform-standard keybinding (I'm think of the mac os x case here) since standardizing just means that people don't have to remember that drscheme isn't standard. But I've added control-y back in on linux (I believe) even tho the menu will say only control-shift-z. Robby On Sun, Jul 6, 2008 at 10:03 PM, Eli Barzilay wrote: > Is it possible to have both shortcuts available on Linux? I see > several applciations where Ctrl+Y is redo. (And it probably doesn't > hurt to keep in on OSX too, and to add C-S-Y on Windows too.) > > > On Jul 6, Robby Findler wrote: >> Thanks! >> >> Robby >> >> On Sun, Jul 6, 2008 at 9:34 PM, Evgeny Roubinchtein >> wrote: >> > In case something like this comes up again, the following Wikipedia >> > page has links to a bunch of human interface guidelines documents >> > (including links to Windows, Mac, GNOME and KDE guidelines): >> > >> > http://en.wikipedia.org/wiki/Human_interface_guidelines >> > >> > A quick check of the GNOME and KDE documents suggests that Redo is >> > Control-Shift-Z in GNOME, and Control-Y in KDE (with Control-Shit-Z >> > also being an acceptable alternative in KDE). > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://www.barzilay.org/ Maze is Life! > > From eli at barzilay.org Sun Jul 6 23:22:53 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:41 2009 Subject: [plt-scheme] Keybindings In-Reply-To: <932b2f1f0807062014m3005dc02vdc4a67b5ead68997@mail.gmail.com> References: <481286B7.2050609@zenburn.net> <932b2f1f0807040859l1212432fg6499eca40c0e2a9b@mail.gmail.com> <2748b30b0807040918y2c1ca5c5r24340baf493d1923@mail.gmail.com> <932b2f1f0807040954x29477e3ard4fd373805b5126a@mail.gmail.com> <18545.32936.296900.332991@sverige.freeshell.org> <932b2f1f0807061944v51b3d10em5560379d7b85a5bd@mail.gmail.com> <18545.34684.571952.742989@arabic.ccs.neu.edu> <932b2f1f0807062014m3005dc02vdc4a67b5ead68997@mail.gmail.com> Message-ID: <18545.35853.16670.345353@arabic.ccs.neu.edu> On Jul 6, Robby Findler wrote: > Its not possible to have both in the menu items, I don't think. I'm > not sure there is any value to using a non-platform-standard > keybinding (I'm think of the mac os x case here) since standardizing > just means that people don't have to remember that drscheme isn't > standard. Right, but it's good to let people have some time to adjust by making both available. When in a few years enough people+applications adjusted that Ctrl+Y becomes the standard key for, uh, increasing the voltage to your BCI (Brain Computer Interface), then drscheme can drop it too... At least in Linux, all applications that I see still use C-y (and one supports C-S-z as well as C-y). > But I've added control-y back in on linux (I believe) even tho the > menu will say only control-shift-z. Thanks. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From geoff at knauth.org Mon Jul 7 00:32:22 2008 From: geoff at knauth.org (Geoff Knauth) Date: Thu Mar 26 02:22:41 2009 Subject: [plt-scheme] PLT with very large datasets? In-Reply-To: <87lk0nt6yn.fsf@offby1.atm01.sea.blarg.net> References: <2748b30b0806291447m135cea31v401a098edb04a45d@mail.gmail.com> <486804B4.70106@cs.utah.edu> <2748b30b0806291526ta0fc037xd0a2e09fe823149a@mail.gmail.com> <22BDDB6C-A693-4993-AD33-2B62A80346B7@knauth.org> <2748b30b0806292237q4e1d2589i7f4e70d88bee81db@mail.gmail.com> <87lk0nt6yn.fsf@offby1.atm01.sea.blarg.net> Message-ID: <96C9A521-2556-4CEE-B8D4-CF8D714DBE35@knauth.org> On Jun 30, 2008, at 08:58, Eric Hanchrow wrote: >>>>>> "Yavuz" == Yavuz Arkun writes: > > Yavuz> I am afraid any sort of relational DB is going to be slow. > > Berkeley DB is not a relational DB; it's basically a big on-disk hash > table. Dunno how fast it is, though. Berkeley DB is very customizable. It can be very fast or compact. DrScheme could be an aid to Berkeley DB too. I have in mind a GUI with sliders and other inputs that help the DB designer set parameters correctly and view tradeoffs. From kumar_lista at mac.com Mon Jul 7 07:46:31 2008 From: kumar_lista at mac.com (kumar) Date: Thu Mar 26 02:22:41 2009 Subject: [plt-scheme] Re: Continuous update sliders ... In-Reply-To: <20080706130558.F203765009D@mail-svr1.cs.utah.edu> References: <20080703205650.0E5DC4041E@qua.cs.brown.edu> <75D9E585-700D-4A72-97D1-8AE018AA54C7@mac.com> <20080704121943.D4DE06500A8@mail-svr1.cs.utah.edu> <20080706130558.F203765009D@mail-svr1.cs.utah.edu> Message-ID: <4F7ED94A-3687-4C2D-ABB9-17FE401B19F9@mac.com> The sample program below shows the behaviour I described. When you run it, you get a slider window and the console will show "timer 1 timer 2 timer 3 ..." as the timer ticks on. When you twiddle the slider, the timer outputs will freeze. When you release the slider, a whole bunch of "value N value N ..." messages will get printed, and the timer will continue from where it left off at mouse-down. What I expect is for the timer to continue ticking as I twiddle the slider and every time the slider value changes, I expect a " value N" on the console. Thanks for your help on this. -Kumar ;----------------- (require (lib "mred.ss" "mred") (lib "class.ss")) (define frame-with-slider% (class frame% ; The base class is frame% (super-instantiate () (label "Frame with slider") (width 500)) (new slider% (label "Twiddle me") (min-value 0) (max-value 100) (init-value 0) (parent this) (callback (lambda (s e) (display " value ") (display (send s get- value))))) (define count 1) (define (tick) (display " timer ") (display count) (set! count (+ count 1))) (define timer (new timer% (interval 500) (notify-callback (lambda () (tick))))) (send this show #t))) (new frame-with-slider%) ;----------------- On 06 Jul 2008, at 9:05 PM, Matthew Flatt wrote: > There are some constraints on concurrency during slider movement, at > least under Windows and Mac OS X. Other Scheme threads do not run, and > it's possible for a slider callback to be suspended (and further > slider > callbacks and other events to be delayed) if the callback synchronizes > with another thread. Those constraints are related to a slight > mismatch > between PLT Scheme's threading and eventspace model and the underlying > GUI toolbox's model. > > Does your program involve extra threads somehow? Can you create a > small > example where slider callbacks get stuck? > > Matthew > > At Sun, 06 Jul 2008 09:59:16 +0800, kumar wrote: >> >> I do have the callback function, but here is what happens - >> >> - Between mouse-down and mouse-up the callback doesn't get invoked >> and the main event processing seems to pause. >> >> - Upon mouse-up, the callback is invoked as many times as, I think, >> the value of the slider changed between mouse-down and mouse-up >> in one go. >> >> - Timer events that should have been generated between the mouse-down >> and mouse-up don't fire at all. That's how I came to conclude that >> the >> main event loop is paused. >> >> Regards >> -Kumar >> >> On 04 Jul 2008, at 8:19 PM, Matthew Flatt wrote: >> >>> At Fri, 04 Jul 2008 11:23:45 +0800, kumar_lista@mac.com wrote: >>>> Hi, >>>> >>>> I need some help with the slider% class. Much appreciate any tips. >>>> >>>> The slider% class behaves modally as it stands - i.e. between >>>> mouse-down >>>> and mouse-up on the slider control, the main event loop does not >>>> get >>>> to run. >>>> How do I configure slider% such that I can twiddle it without >>>> pausing >>>> the >>>> main event loop between mouse-down and mouse-up? >>> >>> Provide a `callback' argument when creating a `slider%'. >>> >>> The following example illustrates updating a message field >>> interactively based on the value of the slider: >>> >>> #lang scheme/gui >>> >>> (define f (new frame% [label "Hi"])) >>> (define m (new message% [parent f] [label ""] >>> [stretchable-width #t])) >>> (new slider% >>> [label #f] [min-value 0] [max-value 100] >>> [parent f] >>> [callback (lambda (s e) >>> (send m set-label >>> (format "Value is ~s" (send s get- >>> value))))]) >>> (send f show #t) >>> From anh at cs.rit.edu Mon Jul 7 11:37:40 2008 From: anh at cs.rit.edu (Arthur Nunes-Harwit) Date: Thu Mar 26 02:22:41 2009 Subject: [plt-scheme] structural recursion question Message-ID: Hi, I'm not sure if this is the right list for this question, but here goes... Structural recursion on natural numbers seems to have the following template. (define (f n) (if (zero? n) ... ; answer for zero case ... (f (sub1 n)) ...)) ; answer for positive case Is naive Fibonacci structurally recursive? It seems to not quite fit, since there are two base cases. However, it isn't generative recursive or accumulative recursive. But accumulative and generative recursive formulations provide the same kind of speed ups. It seems as though Fibonacci could be a nice example, but where does it fit in? (It looks to me as though structural recursion is a generalization of the rules for constructing the primitive recursive functions. But showing that Fibonacci is primitive recursive involves sequencing.) Thanks. -Arthur From matthias at ccs.neu.edu Mon Jul 7 11:50:29 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:22:41 2009 Subject: [plt-scheme] structural recursion question In-Reply-To: References: Message-ID: <275FFBC3-F193-49AD-965A-33A5A84E08B0@ccs.neu.edu> Structural recursion means that the layout of the template follows the layout of the data definition. It's a crutch to help you design programs. Since fib is a mathematically defined function, you don't need help designing it. Just type it in. -- Matthias On Jul 7, 2008, at 11:37 AM, Arthur Nunes-Harwit wrote: > Hi, > > I'm not sure if this is the right list for this question, but > here goes... > > Structural recursion on natural numbers seems to have the > following template. > > (define (f n) > (if (zero? n) > ... ; answer for zero case > ... (f (sub1 n)) ...)) ; answer for positive case > > Is naive Fibonacci structurally recursive? It seems to not quite > fit, since there are two base cases. However, it isn't generative > recursive or accumulative recursive. But accumulative and > generative recursive formulations provide the same kind of speed > ups. It seems as though Fibonacci could be a nice example, but > where does it fit in? > > (It looks to me as though structural recursion is a generalization > of the rules for constructing the primitive recursive functions. > But showing that Fibonacci is primitive recursive involves > sequencing.) > > Thanks. > > -Arthur > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From dyrueta at gmail.com Mon Jul 7 18:11:24 2008 From: dyrueta at gmail.com (dave yrueta) Date: Thu Mar 26 02:22:41 2009 Subject: [plt-scheme] HtDP Message-ID: Hi All ? Am having problems with the last part of Exercise 21.1.2, which requires defining function ?map in terms of function ?fold. ?Fold is an abstraction of two similar example functions, ?sum and ?product, reproduced below: (define(sum a-list-of-numbers) (cond [(empty? a-list-of-numbers)0] [else (+(first a-list-of-numbers) (sum(rest a-list-of-numbers)))])) (define(product a-list-of-numbers) (cond [(empty? a-list-of-numbers)1] [else (*(first a-list-of-numbers) (product(rest a-list-of-numbers)))])) The design recipe for abstracting functions instructs us to compare, abstract and then test. After comparing the two functions, I abstracted two common values: the answer to the first conditional clause, and the function applied to the first item on the list parameter. I named the first abstracted value ?th for threshold, and the second ?f for function. The resulting function named ?fold looked like this: (define(fold f th lox) (cond [(empty? lox)th] [else (f (first lox) (fold f th (rest lox)))])) Next, I tested ?fold by defining functions which made the abstracted values of the original functions arguments in ?fold: (define(abstract-from-sum lox) (fold + 0 lox)) (define(abstract-from-product lox) (fold * 1 lox)) (equal?(product(list 1 2 3)) (abstract-from-product(list 1 2 3))) (equal?(sum (list 2 3 4)) (abstract-from-sum (list 2 3 4))) The results were consistent. I then defined a version of function ?append in terms of ?fold, which seems to work when the list acting as the second parameter of ?append is made the threshold of ?fold: (define(apend loX1 loX2) (fold cons loX2 loX1)) However, I?m puzzled on how to approach defining ?map in terms of ?fold. ?Map creates a list of values by applying some function (f) to each item on a list: (define(mapp f lox) (cond [(empty? lox)empty] [else (cons(f(first lox)) (map f (rest lox)))])) (define(add10 x) (+ x 10)) (check-expect(mapp add10 (list 1 2 3))(list 11 12 13)) = "All tests pass!" So defining ?map in the terms I?ve defined ?fold requires double-duty on the part of parameter ?f: it must first introduce the primitive ?cons which starts a list, and then it must apply a function ?f to each member of the list: (define(mapp2 f lox) (fold (cons f) empty lox)) This won?t work, because (cons f) is not a legitimate expression. I started work on next problem in the meantime, and that seems even more puzzling, so I feel like there is some basic concept about abstraction that I?m not getting. Any suggestions? Thanks, Dave Yrueta From morazanm at gmail.com Mon Jul 7 19:04:27 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:22:42 2009 Subject: [plt-scheme] HtDP In-Reply-To: References: Message-ID: <9b1fff280807071604s3f60eb80wdacbd4ef8f5d1cc3@mail.gmail.com> On Mon, Jul 7, 2008 at 6:11 PM, dave yrueta wrote: > > (define(fold f th lox) > (cond > [(empty? lox)th] > [else > (f (first lox) > (fold f th (rest lox)))])) > What is the contract for fold? > > (define(mapp2 f lox) > (fold (cons f) empty lox)) > > This won't work, because (cons f) is not a legitimate expression. I > started work on next problem in the meantime, and that seems even more > puzzling, so I feel like there is some basic concept about abstraction > that I'm not getting. Any suggestions? > Here's where a contract is going to be useful for you. What does fold expect as arguments? Certainly, (cons f) is not something fold is expecting as its first argument. Cheers, Marco From mflatt at cs.utah.edu Mon Jul 7 22:38:09 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:42 2009 Subject: [plt-scheme] Re: Continuous update sliders ... In-Reply-To: <4F7ED94A-3687-4C2D-ABB9-17FE401B19F9@mac.com> References: <20080703205650.0E5DC4041E@qua.cs.brown.edu> <75D9E585-700D-4A72-97D1-8AE018AA54C7@mac.com> <20080704121943.D4DE06500A8@mail-svr1.cs.utah.edu> <20080706130558.F203765009D@mail-svr1.cs.utah.edu> <4F7ED94A-3687-4C2D-ABB9-17FE401B19F9@mac.com> Message-ID: <20080708023815.E16D66500CF@mail-svr1.cs.utah.edu> When I run from a Terminal window (and when I insert newlines to flush the output), then I do see the output from the callback (and the timer) as I move the slider control. Are you running the program inside DrScheme? In that case, the output must be printed by a Scheme thread that is different from the eventspace of the slider, and so that's why it gets stuck. More generally, printing output can involve synchronization with other threads --- so, unfortunately, you have to avoid printouts if you want to do something interactive with the slider. Also, I note that timers are not completely normal while a slider control is grabbed. If you grab the slider control and don't move it, then everything freezes until you do move it. This, again, is part of the mismatch in threading models. Matthew At Mon, 07 Jul 2008 19:46:31 +0800, kumar wrote: > The sample program below shows the behaviour I described. > When you run it, you get a slider window and the console will > show "timer 1 timer 2 timer 3 ..." as the timer ticks on. When you > twiddle the slider, the timer outputs will freeze. When you release > the slider, a whole bunch of "value N value N ..." messages > will get printed, and the timer will continue from where it left off > at mouse-down. What I expect is for the timer to continue ticking > as I twiddle the slider and every time the slider value changes, > I expect a " value N" on the console. > > Thanks for your help on this. > -Kumar > > ;----------------- > (require (lib "mred.ss" "mred") > (lib "class.ss")) > > > (define frame-with-slider% > (class frame% ; The base class is frame% > > (super-instantiate () > (label "Frame with slider") > (width 500)) > > (new slider% > (label "Twiddle me") > (min-value 0) > (max-value 100) > (init-value 0) > (parent this) > (callback (lambda (s e) > (display " value ") (display (send s get- > value))))) > > (define count 1) > > (define (tick) > (display " timer ") > (display count) > (set! count (+ count 1))) > > (define timer > (new timer% > (interval 500) > (notify-callback (lambda () (tick))))) > > (send this show #t))) > > > (new frame-with-slider%) > ;----------------- > > > > On 06 Jul 2008, at 9:05 PM, Matthew Flatt wrote: > > > There are some constraints on concurrency during slider movement, at > > least under Windows and Mac OS X. Other Scheme threads do not run, and > > it's possible for a slider callback to be suspended (and further > > slider > > callbacks and other events to be delayed) if the callback synchronizes > > with another thread. Those constraints are related to a slight > > mismatch > > between PLT Scheme's threading and eventspace model and the underlying > > GUI toolbox's model. > > > > Does your program involve extra threads somehow? Can you create a > > small > > example where slider callbacks get stuck? > > > > Matthew > > > > At Sun, 06 Jul 2008 09:59:16 +0800, kumar wrote: > >> > >> I do have the callback function, but here is what happens - > >> > >> - Between mouse-down and mouse-up the callback doesn't get invoked > >> and the main event processing seems to pause. > >> > >> - Upon mouse-up, the callback is invoked as many times as, I think, > >> the value of the slider changed between mouse-down and mouse-up > >> in one go. > >> > >> - Timer events that should have been generated between the mouse-down > >> and mouse-up don't fire at all. That's how I came to conclude that > >> the > >> main event loop is paused. > >> > >> Regards > >> -Kumar > >> > >> On 04 Jul 2008, at 8:19 PM, Matthew Flatt wrote: > >> > >>> At Fri, 04 Jul 2008 11:23:45 +0800, kumar_lista@mac.com wrote: > >>>> Hi, > >>>> > >>>> I need some help with the slider% class. Much appreciate any tips. > >>>> > >>>> The slider% class behaves modally as it stands - i.e. between > >>>> mouse-down > >>>> and mouse-up on the slider control, the main event loop does not > >>>> get > >>>> to run. > >>>> How do I configure slider% such that I can twiddle it without > >>>> pausing > >>>> the > >>>> main event loop between mouse-down and mouse-up? > >>> > >>> Provide a `callback' argument when creating a `slider%'. > >>> > >>> The following example illustrates updating a message field > >>> interactively based on the value of the slider: > >>> > >>> #lang scheme/gui > >>> > >>> (define f (new frame% [label "Hi"])) > >>> (define m (new message% [parent f] [label ""] > >>> [stretchable-width #t])) > >>> (new slider% > >>> [label #f] [min-value 0] [max-value 100] > >>> [parent f] > >>> [callback (lambda (s e) > >>> (send m set-label > >>> (format "Value is ~s" (send s get- > >>> value))))]) > >>> (send f show #t) > >>> > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From kumar_lista at mac.com Mon Jul 7 23:58:42 2008 From: kumar_lista at mac.com (kumar) Date: Thu Mar 26 02:22:42 2009 Subject: [plt-scheme] Re: Continuous update sliders ... In-Reply-To: <20080708023815.E16D66500CF@mail-svr1.cs.utah.edu> References: <20080703205650.0E5DC4041E@qua.cs.brown.edu> <75D9E585-700D-4A72-97D1-8AE018AA54C7@mac.com> <20080704121943.D4DE06500A8@mail-svr1.cs.utah.edu> <20080706130558.F203765009D@mail-svr1.cs.utah.edu> <4F7ED94A-3687-4C2D-ABB9-17FE401B19F9@mac.com> <20080708023815.E16D66500CF@mail-svr1.cs.utah.edu> Message-ID: <475CF659-171B-4D5F-BE23-FB465B4F2E5F@mac.com> My original code doesn't do any display, but behaves in the same way the display behaves under DrScheme. (Yes I do run it under DrScheme/MrEd). I have an animation going in a window that runs on a timer callback. This animation freezes during the slider twiddling .. and its not like timer callbacks are accumulating in a buffer - no timer callbacks get queued up during this period. Btw, if it is the display that's causing the delayed prints, then I'd still expect the " value " printed in my example code to have all the different positions to which I moved the slider before I let go of it, but it only shows N times the latest value, which means (I think) the callback is being called N times when I let go (where N is the number of times I moved the slider before letting go of it). So its something like the request to call the callback function is accumulating somewhere. (newlines make no difference in my runs within drscheme). Can you please describe to me how you run it so I can try the same? -Kumar On 08 Jul 2008, at 10:38 AM, Matthew Flatt wrote: > When I run from a Terminal window (and when I insert newlines to flush > the output), then I do see the output from the callback (and the > timer) > as I move the slider control. > > Are you running the program inside DrScheme? In that case, the output > must be printed by a Scheme thread that is different from the > eventspace of the slider, and so that's why it gets stuck. More > generally, printing output can involve synchronization with other > threads --- so, unfortunately, you have to avoid printouts if you want > to do something interactive with the slider. > > Also, I note that timers are not completely normal while a slider > control is grabbed. If you grab the slider control and don't move it, > then everything freezes until you do move it. This, again, is part of > the mismatch in threading models. > > Matthew > > At Mon, 07 Jul 2008 19:46:31 +0800, kumar wrote: >> The sample program below shows the behaviour I described. >> When you run it, you get a slider window and the console will >> show "timer 1 timer 2 timer 3 ..." as the timer ticks on. When you >> twiddle the slider, the timer outputs will freeze. When you release >> the slider, a whole bunch of "value N value N ..." messages >> will get printed, and the timer will continue from where it left off >> at mouse-down. What I expect is for the timer to continue ticking >> as I twiddle the slider and every time the slider value changes, >> I expect a " value N" on the console. >> >> Thanks for your help on this. >> -Kumar >> >> ;----------------- >> (require (lib "mred.ss" "mred") >> (lib "class.ss")) >> >> >> (define frame-with-slider% >> (class frame% ; The base class is frame% >> >> (super-instantiate () >> (label "Frame with slider") >> (width 500)) >> >> (new slider% >> (label "Twiddle me") >> (min-value 0) >> (max-value 100) >> (init-value 0) >> (parent this) >> (callback (lambda (s e) >> (display " value ") (display (send s get- >> value))))) >> >> (define count 1) >> >> (define (tick) >> (display " timer ") >> (display count) >> (set! count (+ count 1))) >> >> (define timer >> (new timer% >> (interval 500) >> (notify-callback (lambda () (tick))))) >> >> (send this show #t))) >> >> >> (new frame-with-slider%) >> ;----------------- >> >> >> >> On 06 Jul 2008, at 9:05 PM, Matthew Flatt wrote: >> >>> There are some constraints on concurrency during slider movement, at >>> least under Windows and Mac OS X. Other Scheme threads do not >>> run, and >>> it's possible for a slider callback to be suspended (and further >>> slider >>> callbacks and other events to be delayed) if the callback >>> synchronizes >>> with another thread. Those constraints are related to a slight >>> mismatch >>> between PLT Scheme's threading and eventspace model and the >>> underlying >>> GUI toolbox's model. >>> >>> Does your program involve extra threads somehow? Can you create a >>> small >>> example where slider callbacks get stuck? >>> >>> Matthew >>> >>> At Sun, 06 Jul 2008 09:59:16 +0800, kumar wrote: >>>> >>>> I do have the callback function, but here is what happens - >>>> >>>> - Between mouse-down and mouse-up the callback doesn't get invoked >>>> and the main event processing seems to pause. >>>> >>>> - Upon mouse-up, the callback is invoked as many times as, I think, >>>> the value of the slider changed between mouse-down and mouse-up >>>> in one go. >>>> >>>> - Timer events that should have been generated between the mouse- >>>> down >>>> and mouse-up don't fire at all. That's how I came to conclude that >>>> the >>>> main event loop is paused. >>>> >>>> Regards >>>> -Kumar >>>> >>>> On 04 Jul 2008, at 8:19 PM, Matthew Flatt wrote: >>>> >>>>> At Fri, 04 Jul 2008 11:23:45 +0800, kumar_lista@mac.com wrote: >>>>>> Hi, >>>>>> >>>>>> I need some help with the slider% class. Much appreciate any >>>>>> tips. >>>>>> >>>>>> The slider% class behaves modally as it stands - i.e. between >>>>>> mouse-down >>>>>> and mouse-up on the slider control, the main event loop does not >>>>>> get >>>>>> to run. >>>>>> How do I configure slider% such that I can twiddle it without >>>>>> pausing >>>>>> the >>>>>> main event loop between mouse-down and mouse-up? >>>>> >>>>> Provide a `callback' argument when creating a `slider%'. >>>>> >>>>> The following example illustrates updating a message field >>>>> interactively based on the value of the slider: >>>>> >>>>> #lang scheme/gui >>>>> >>>>> (define f (new frame% [label "Hi"])) >>>>> (define m (new message% [parent f] [label ""] >>>>> [stretchable-width #t])) >>>>> (new slider% >>>>> [label #f] [min-value 0] [max-value 100] >>>>> [parent f] >>>>> [callback (lambda (s e) >>>>> (send m set-label >>>>> (format "Value is ~s" (send s get- >>>>> value))))]) >>>>> (send f show #t) >>>>> >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme From DekuDekuplex at Yahoo.com Tue Jul 8 02:38:22 2008 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Thu Mar 26 02:22:42 2009 Subject: [plt-scheme] Re: PLT Scheme v4.0.2 References: <200807050103.m6513cpp026725@winooski.ccs.neu.edu> Message-ID: In the official version 4.0.2 of DrScheme, there seems to be a minor bug in the installer in which, if version 4.0.1 has already been installed and not uninstalled, then C:\bin\PLT-4.0.1\, instead of C:\bin\PLT-4.0.2\, appears as the default destination folder for the installation. I'm not sure whether this also appears as the default destination folder when version 4.0.1 has been uninstalled. -- Benjamin L. Russell On Fri, 4 Jul 2008 21:03:38 -0400, Eli Barzilay wrote: >PLT Scheme version 4.0.2 is now available from > > http://plt-scheme.org/ > >This release fixes a bug that caused PLaneT packages to install >abnormally slow in 4.0.1. > >[ For those that use the nightly builds, subversion, or >4.0.1tsrj2008, you already have this fix (and even more fixes). >You do not need to upgrade. The version in svn is now 4.0.2.3 to >minimize confusion. ] > >Feedback Welcome, From DekuDekuplex at Yahoo.com Tue Jul 8 02:41:02 2008 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Thu Mar 26 02:22:42 2009 Subject: [plt-scheme] Re: PLT Scheme v4.0.2 References: <200807050103.m6513cpp026725@winooski.ccs.neu.edu> Message-ID: "PLT Scheme v4.0.1" also appears, instead of "PLT Scheme v4.0.2," as the default Start Menu folder name in the official build version 4.0.2 of DrScheme. -- Benjamin L. Russell On Fri, 4 Jul 2008 21:03:38 -0400, Eli Barzilay wrote: >PLT Scheme version 4.0.2 is now available from > > http://plt-scheme.org/ > >This release fixes a bug that caused PLaneT packages to install >abnormally slow in 4.0.1. > >[ For those that use the nightly builds, subversion, or >4.0.1tsrj2008, you already have this fix (and even more fixes). >You do not need to upgrade. The version in svn is now 4.0.2.3 to >minimize confusion. ] > >Feedback Welcome, From DekuDekuplex at Yahoo.com Tue Jul 8 03:01:35 2008 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Thu Mar 26 02:22:43 2009 Subject: [plt-scheme] Memory limit is on by default in DrScheme pre-release version 4.0.2.3 Message-ID: While I'm not sure whether this is a bug, I was surprised to discover that the memory limit is on by default in the current DrScheme pre-release version 4.0.2.3. It was off by default in both pre-release version 3.99.0.25, and official release version 4.0.2. Setting the memory limit on by default may potentially cause problems for new users who are not used to this feature, and who don't fully understand the implications of a memory limit. -- Benjamin L. Russell From robby at cs.uchicago.edu Tue Jul 8 07:31:13 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:43 2009 Subject: [plt-scheme] Memory limit is on by default in DrScheme pre-release version 4.0.2.3 In-Reply-To: References: Message-ID: <932b2f1f0807080431v745c648exf69fa99624d6865b@mail.gmail.com> It has been on by default for new users of PLT Scheme since 4.0 (and maybe 372, I forget). In the last few days I change the way the preference is saved so that everyone gets the new default, even if they have used one of the versions that had the default off. But to address your comment at the end: there is always a memory limit, namely the one imposed by the OS. When a program in DrScheme hits _that_ limit, things do not go well (DrScheme itself crashes), and we certainly get complaints about that. Sometimes not so nicely worded... :) Robby On Tue, Jul 8, 2008 at 2:01 AM, Benjamin L. Russell wrote: > While I'm not sure whether this is a bug, I was surprised to discover > that the memory limit is on by default in the current DrScheme > pre-release version 4.0.2.3. It was off by default in both > pre-release version 3.99.0.25, and official release version 4.0.2. > > Setting the memory limit on by default may potentially cause problems > for new users who are not used to this feature, and who don't fully > understand the implications of a memory limit. > > -- Benjamin L. Russell > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From nubgames at gmail.com Tue Jul 8 08:34:14 2008 From: nubgames at gmail.com (Eric Sessoms) Date: Thu Mar 26 02:22:44 2009 Subject: [plt-scheme] ann: erlang-scheme interop Message-ID: <9d4cb2970807080534m5ad49a70u1886a1adef66f7f7@mail.gmail.com> I've put together a small scheme package to talk to erlang (attached). It's still very much a toy and under development, but I wanted to release it early for anyone crazy enough to want to play with it. What it is: Basically, it's a port of Distel from emacs lisp over to scheme. It talks to erlang using its own protocol and impersonates an erlang node on the network. It aims to provide an abstraction such that erlang processes look like scheme threads, and vice-versa. Communication from scheme to erlang is done with (a wrapper around) thread-send. Messages from erlang to scheme get routed to thread mailboxes so that they can be picked up with thread-receive. What works: bi-directional communication between scheme and erlang, using native data-types and communication mechanisms in both languages. What doesn't (I did say it it's just a toy): Linking is not yet implemented. In erlang, "linking" establishes a connection between two processes such that if one dies the other is notified. This is TBD. Right now, scheme does not register with the erlang port-mapper, which means that scheme has to initiate contact with erlang. Once scheme initiates contact, messages can flow both ways. Lastly, much of the more interesting erlang functionality is implemented using higher-level protocols built on top of the primitive message passing (i.e., gen_server). Most of this isn't yet done. Below are scheme and erlang transcripts from a play session. Welcome to MzScheme v4.0.2 [3m], Copyright (c) 2004-2008 PLT Scheme Inc. > (enter! "erlang.ss") [loading erlang.ss] [loading etc] > (erlang-set-node-name! 'scheme@Azathoth) > (erlang-console) > (erlang-self) #(TYPE erlang-pid scheme@Azathoth 1 0 1) > (define t (erlang-node 'test)) > (erlang-echo-test t "r u there?") #(#(TYPE erlang-new-ref scheme@Azathoth 1 #"\0\0\0\1\0\0\0\0\0\0\0\0") "r u there?") > (erlang-rpc-call t 'echo 'echo "hello, erlang!") #(#(TYPE erlang-new-ref scheme@Azathoth 1 #"\0\0\0\2\0\0\0\0\0\0\0\0") "hello, erlang!") > (thread-receive) "hello, scheme!" > (erlang-rpc-call t 'erlang 'display "w00t!") #(#(TYPE erlang-new-ref scheme@Azathoth 1 #"\0\0\0\3\0\0\0\0\0\0\0\0") true) > (erlang-rpc-call t 'code 'get_path) #(#(TYPE erlang-new-ref scheme@Azathoth 1 #"\0\0\0\4\0\0\0\0\0\0\0\0") ("." "/usr/local/lib/erlang/lib/kernel-2.12.3/ebin" "etc")) Eshell V5.6.3 (abort with ^G) (test@Azathoth)1> node(). test@Azathoth (test@Azathoth)2> c(echo). {ok,echo} (test@Azathoth)3> {console, 'scheme@Azathoth'} ! "hello, scheme!". "hello, scheme!" (test@Azathoth)4> "w00t!" -------------- next part -------------- A non-text attachment was scrubbed... Name: v01.tbz Type: application/octet-stream Size: 6616 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080708/6cea5090/v01.obj From mflatt at cs.utah.edu Tue Jul 8 08:48:19 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:44 2009 Subject: [plt-scheme] Re: PLT Scheme v4.0.2 In-Reply-To: References: <200807050103.m6513cpp026725@winooski.ccs.neu.edu> Message-ID: <20080708124822.715A96500E0@mail-svr1.cs.utah.edu> Did you pick the name "PLT Scheme v4.0.1" when previously installing v4.0.1 on the same machine? I think the default is "PLT Scheme", but the installer remembers an alternate name that you pick, and then suggests the same name next time you install. I always add a version number, so I see this same effect where the suggested name has the version that I most recently installed before. Matthew At Tue, 08 Jul 2008 15:41:02 +0900, Benjamin L.Russell wrote: > "PLT Scheme v4.0.1" also appears, instead of "PLT Scheme v4.0.2," as > the default Start Menu folder name in the official build version 4.0.2 > of DrScheme. > > -- Benjamin L. Russell > > On Fri, 4 Jul 2008 21:03:38 -0400, Eli Barzilay > wrote: > > >PLT Scheme version 4.0.2 is now available from > > > > http://plt-scheme.org/ > > > >This release fixes a bug that caused PLaneT packages to install > >abnormally slow in 4.0.1. > > > >[ For those that use the nightly builds, subversion, or > >4.0.1tsrj2008, you already have this fix (and even more fixes). > >You do not need to upgrade. The version in svn is now 4.0.2.3 to > >minimize confusion. ] > > > >Feedback Welcome, > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From eli at barzilay.org Tue Jul 8 09:09:28 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:44 2009 Subject: [plt-scheme] Re: PLT Scheme v4.0.2 In-Reply-To: <20080708124822.715A96500E0@mail-svr1.cs.utah.edu> References: <200807050103.m6513cpp026725@winooski.ccs.neu.edu> <20080708124822.715A96500E0@mail-svr1.cs.utah.edu> Message-ID: <18547.26376.608067.190374@arabic.ccs.neu.edu> On Jul 8, Matthew Flatt wrote: > Did you pick the name "PLT Scheme v4.0.1" when previously installing > v4.0.1 on the same machine? Yes, you would need to do that -- and not uninstall 4.0.1 when you install 4.0.2. That will make the installer pick up the previous values when used. This is, AFAICT, standard practice with NSIS installers, and the intention is that if you choose an unconventional directory (for example, "C:\bin\PLT" instead of "C:\Program Files\PLT"), then when you try to install a newer version it will default to putting it in the same place. This is all due to the assumption that you should have a single PLT installation, and that you upgrade it from release to release. This assumption is implemented by using `PLT' in the registry keys. It is different for the nightly builds -- in that case, the registry key will be `PLT-', and that follows the assumption that you almost always want that in addition to some other version (like the last stable release). Another problem with this is that if you run the 4.0.1 uninstaller, it will read out the registry keys that were overwritten by the 4.0.2 installer, and remove that instead of itself. So, all of this make it sound like it's better to use a version-specific key for the start menu directory and for the installation directory. (If it was a convenient language, I could make it remember the base name too, and use that as future defaults, but the NSIS language is extremely limited and will make such string manipulation pretty difficult.) > I think the default is "PLT Scheme", but the installer remembers an > alternate name that you pick, and then suggests the same name next time > you install. I always add a version number, so I see this same effect > where the suggested name has the version that I most recently installed > before. > > Matthew > > At Tue, 08 Jul 2008 15:41:02 +0900, Benjamin L.Russell wrote: > > "PLT Scheme v4.0.1" also appears, instead of "PLT Scheme v4.0.2," as > > the default Start Menu folder name in the official build version 4.0.2 > > of DrScheme. > > > > -- Benjamin L. Russell > > > > On Fri, 4 Jul 2008 21:03:38 -0400, Eli Barzilay > > wrote: > > > > >PLT Scheme version 4.0.2 is now available from > > > > > > http://plt-scheme.org/ > > > > > >This release fixes a bug that caused PLaneT packages to install > > >abnormally slow in 4.0.1. > > > > > >[ For those that use the nightly builds, subversion, or > > >4.0.1tsrj2008, you already have this fix (and even more fixes). > > >You do not need to upgrade. The version in svn is now 4.0.2.3 to > > >minimize confusion. ] > > > > > >Feedback Welcome, > > > > _________________________________________________ > > For list-related administrative tasks: > > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From mflatt at cs.utah.edu Tue Jul 8 09:34:44 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:44 2009 Subject: [plt-scheme] patch to escape R6RS library names [was: SXML for R6RS] In-Reply-To: <1215163334.23549.257.camel@eep> References: <1215047813.20284.17.camel@eep> <1215081783.23549.83.camel@eep> <20080703134719.090736500BE@mail-svr1.cs.utah.edu> <1215163334.23549.257.camel@eep> Message-ID: <20080708133447.1C9BA650057@mail-svr1.cs.utah.edu> At Fri, 04 Jul 2008 02:22:14 -0700, Derick Eddington wrote: > On Thu, 2008-07-03 at 07:47 -0600, Matthew Flatt wrote: > > At Thu, 03 Jul 2008 03:43:02 -0700, Derick Eddington wrote: > > > I've been meaning to bring this up and ask: would it be possible for PLT > > > to support any symbols for library names? Ikarus currently does it by > > > encoding filename-unfriendly characters like * to %2A. I'd be willing > > > to make a patch to do this if it's not a dead end. > > > > That would be great. > > OK, here's my patch, below and attached. Comments: > > I made it escape all characters that are not valid for a PLT Scheme > unquoted module path component because that seemed the most > conservative. > > I made the %-escape encoding have a terminating delimiter of the ; > character so that library names like (foo \x3BB;) and (foo ?\x3B;B) do > not resolve to the same filename. > > Because the (lib rel-string) require form does not allow the % nor ; > characters in the rel-string, I changed `convert-library-reference' to > use the (file string) require form and changed `parse-library-reference' > to return a platform-specific absolute path string. Thanks! But I'm uneasy with mixing %-escape encoding with R6RS-style semi-colon terminators. How about UTF-8 encoding followed by simple two-digit %-escapes (consistent, I think, with URI percent-encoding and RFC 3986)? More significantly, I'm worried about generating `file' module references instead of `lib' module references. That shift will create various little problems. For example, it won't work with shared installations that are access through different filesystem paths. Also, it won't be possible to compile R6RS libraries to bytecode and distribute them without source (though compile-time version resolution already interferes to some degree with distributing bytecode). Ideally, R6RS references should all be encoded in `lib' references --- but as things stand, you'd have to pick an encoding that would make some `lib' paths impossible to express as an R6RS encoding (since you'd have to pick some character sequence to act as an escape, but that sequence might be used in an existing name). To resolve this mismatch, we could extend the allowed syntax of `lib' module elements to include %-escapes. That is, a `%' could be allowed in a `lib' module-path element, as long as its followed by two lowercase hexadecimal digits. From the perspective of mapping `lib' paths to file names, this `%' isn't an encoding; it's just part of the file name. But if R6RS library names are mapped to `lib' paths by UTF-8 encoding followed by %-encoding of all "special" characters, then there's a 1-to-1 mapping (ignoring versioning and suffixes) between R6RS paths and `lib' paths. If that sounds ok, I can make the needed changes. Matthew From mflatt at cs.utah.edu Tue Jul 8 09:40:58 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:44 2009 Subject: [plt-scheme] patch to escape R6RS library names [was: SXML for R6RS] In-Reply-To: <20080708133447.1C9BA650057@mail-svr1.cs.utah.edu> References: <1215047813.20284.17.camel@eep> <1215081783.23549.83.camel@eep> <20080703134719.090736500BE@mail-svr1.cs.utah.edu> <1215163334.23549.257.camel@eep> <20080708133447.1C9BA650057@mail-svr1.cs.utah.edu> Message-ID: <20080708134100.98CA26500B9@mail-svr1.cs.utah.edu> At Tue, 8 Jul 2008 07:34:44 -0600, Matthew Flatt wrote: > That is, a `%' could be allowed > in a `lib' module-path element, as long as its followed by two > lowercase hexadecimal digits. [...] But if R6RS library names are mapped > to `lib' paths by UTF-8 > encoding followed by %-encoding of all "special" characters, then > there's a 1-to-1 mapping (ignoring versioning and suffixes) between > R6RS paths and `lib' paths. One more detail: we'd have to constrain `%' escapes in `lib' path elements to rule out encodings of the characters that are currently allowed. For example, "%41" (= "A", when read as an encoding) would be disallowed. Matthew From mflatt at cs.utah.edu Tue Jul 8 09:53:55 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:44 2009 Subject: [plt-scheme] Re: Continuous update sliders ... In-Reply-To: <475CF659-171B-4D5F-BE23-FB465B4F2E5F@mac.com> References: <20080703205650.0E5DC4041E@qua.cs.brown.edu> <75D9E585-700D-4A72-97D1-8AE018AA54C7@mac.com> <20080704121943.D4DE06500A8@mail-svr1.cs.utah.edu> <20080706130558.F203765009D@mail-svr1.cs.utah.edu> <4F7ED94A-3687-4C2D-ABB9-17FE401B19F9@mac.com> <20080708023815.E16D66500CF@mail-svr1.cs.utah.edu> <475CF659-171B-4D5F-BE23-FB465B4F2E5F@mac.com> Message-ID: <20080708135357.42D6E6500DD@mail-svr1.cs.utah.edu> At Tue, 08 Jul 2008 11:58:42 +0800, kumar wrote: > My original code doesn't do any display, but behaves in the > same way the display behaves under DrScheme. (Yes I do > run it under DrScheme/MrEd). I have an animation going > in a window that runs on a timer callback. This animation > freezes during the slider twiddling .. and its not like > timer callbacks are accumulating in a buffer - no timer > callbacks get queued up during this period. I see the problem, now. I'm using Mac OS X, but --- as you said --- you're running Windows. (Somehow, I thought we were both using Mac OS X, but I mused have confused this thread with another one.) You're right that the callback is delayed and timers are disabled while a slider is moved under Windows. It's possible that this can be improved, and I'll look into it. > Can you please describe to me how you run it so I > can try the same? The main difference was that I was using Mac OS X. For completeness, though, I ran your program by * adding `(newline)' after each pair of `display' calls; * saving the code as "/tmp/f2.ss"; * changing the first two lines to `#lang scheme/gui' (since I'm using v4) and running as `mred /tmp/f2.ss" in a Terminal window. Alternately, using v3xx, leave the first two lines alone and run as `mred -r /tmp/f2.ss'. Below is the other program I tried --- an extension of the one I sent before. It has a canvas that shows the slider value and a value incremented by a timer, and the canvas is refreshed when either changes. When you drag the slider, the timer gets stuck when the slider isn't being moved. But under Mac OS X, both the slider value and the timer update as the slider is moved. Under Windows, everything is stuck while dragging the slider. Matthew ---------------------------------------- #lang scheme/gui (define val 0) (define cnt 0) (define f (new frame% [label "Hi"] [width 100] [height 100])) (define c (new canvas% [parent f] [stretchable-width #t] [stretchable-height #t] [paint-callback (lambda (c dc) (send dc draw-text (format "~a ~a" val cnt) 0 0))])) (new slider% [label #f] [min-value 0] [max-value 100] [parent f] [callback (lambda (s e) (set! val (send s get-value)) (send c refresh))]) (new timer% [notify-callback (lambda args (set! cnt (add1 cnt)) (send c refresh))] [interval 100] [just-once? #f]) (send f show #t) From matthias at ccs.neu.edu Tue Jul 8 09:50:01 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:22:45 2009 Subject: [plt-scheme] ann: erlang-scheme interop In-Reply-To: <9d4cb2970807080534m5ad49a70u1886a1adef66f7f7@mail.gmail.com> References: <9d4cb2970807080534m5ad49a70u1886a1adef66f7f7@mail.gmail.com> Message-ID: <75F5D52D-9ECC-427B-9505-F864D29354E0@ccs.neu.edu> Cute! keep going - Matthias On Jul 8, 2008, at 8:34 AM, Eric Sessoms wrote: > I've put together a small scheme package to talk to erlang (attached). > It's still very much a toy and under development, but I wanted to > release it early for anyone crazy enough to want to play with it. > > What it is: Basically, it's a port of Distel from emacs lisp over to > scheme. It talks to erlang using its own protocol and impersonates an > erlang node on the network. It aims to provide an abstraction such > that erlang processes look like scheme threads, and vice-versa. > Communication from scheme to erlang is done with (a wrapper around) > thread-send. Messages from erlang to scheme get routed to thread > mailboxes so that they can be picked up with thread-receive. > > What works: bi-directional communication between scheme and erlang, > using native data-types and communication mechanisms in both > languages. > > What doesn't (I did say it it's just a toy): Linking is not yet > implemented. In erlang, "linking" establishes a connection between > two processes such that if one dies the other is notified. This is > TBD. Right now, scheme does not register with the erlang port-mapper, > which means that scheme has to initiate contact with erlang. Once > scheme initiates contact, messages can flow both ways. Lastly, much > of the more interesting erlang functionality is implemented using > higher-level protocols built on top of the primitive message passing > (i.e., gen_server). Most of this isn't yet done. > > Below are scheme and erlang transcripts from a play session. > > Welcome to MzScheme v4.0.2 [3m], Copyright (c) 2004-2008 PLT Scheme > Inc. >> (enter! "erlang.ss") > [loading erlang.ss] > [loading etc] >> (erlang-set-node-name! 'scheme@Azathoth) >> (erlang-console) >> (erlang-self) > #(TYPE erlang-pid scheme@Azathoth 1 0 1) >> (define t (erlang-node 'test)) >> (erlang-echo-test t "r u there?") > #(#(TYPE erlang-new-ref scheme@Azathoth 1 #"\0\0\0\1\0\0\0\0\0\0\0\0") > "r u there?") >> (erlang-rpc-call t 'echo 'echo "hello, erlang!") > #(#(TYPE erlang-new-ref scheme@Azathoth 1 #"\0\0\0\2\0\0\0\0\0\0\0\0") > "hello, erlang!") >> (thread-receive) > "hello, scheme!" >> (erlang-rpc-call t 'erlang 'display "w00t!") > #(#(TYPE erlang-new-ref scheme@Azathoth 1 #"\0\0\0\3\0\0\0\0\0\0\0 > \0") true) >> (erlang-rpc-call t 'code 'get_path) > #(#(TYPE erlang-new-ref scheme@Azathoth 1 #"\0\0\0\4\0\0\0\0\0\0\0\0") > ("." > "/usr/local/lib/erlang/lib/kernel-2.12.3/ebin" > "etc")) > > Eshell V5.6.3 (abort with ^G) > (test@Azathoth)1> node(). > test@Azathoth > (test@Azathoth)2> c(echo). > {ok,echo} > (test@Azathoth)3> {console, 'scheme@Azathoth'} ! "hello, scheme!". > "hello, scheme!" > (test@Azathoth)4> > "w00t!"_________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mflatt at cs.utah.edu Tue Jul 8 14:19:25 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:45 2009 Subject: [plt-scheme] SXML for R6RS [was: R6RS Interoperability] In-Reply-To: <1215081783.23549.83.camel@eep> References: <1215047813.20284.17.camel@eep> <1215081783.23549.83.camel@eep> Message-ID: <20080708181927.409836500EC@mail-svr1.cs.utah.edu> At Thu, 03 Jul 2008 03:43:02 -0700, Derick Eddington wrote: > * SSAX issue: MzScheme does not conform [1] to the R6RS expectation that > the initial/default exception handler return for non-&serious > conditions? [2]. Returning for non-&serious conditions allows you to do > things like raise-continuable a &warning condition to let interested > clients catch it and do something about it and maybe return, or the > default handler will return, and execution can continue. I made my > ssax:warn procedure do this and the SSAX library frequently > calls ?ssax:warn when issues that often can safely be ignored happen. I worry about this implementation of `ssax:warn'. If someone calls into SSAX with a context like (guard (exn [(serious? exn) "give up"]) (with-input-from-file "foo" (lambda () ... call SSAX ...))) then `ssax:warn' will lead to undefined behavior on the "foo" port when control escapes to the `guard', even though the exception won't be caught by the `guard' handler --- right? (I have in mind R6RS semantics of exceptions and `guard', as opposed to the current PLT approximation.) > I > hacked together a patch to MzScheme so its default R6RS handler returns > for non-&serious, though I'm not sure it meshes with PLT completely > correctly, and with it my SSAX port works completely: In looking for a solution that meshes well, I've experimented with adding a `prop:exn:escape' property that the default uncaught-exception handler recognizes and uses instead of calling the current error escape handler. I haven't committed that experiment to SVN, though; it doesn't seem useful when mixed with `with-handlers' (or `guard'), so I'm not sure the tiny increment in R6RS interoperability is useful enough to keep. Matthew From ghcooper at gmail.com Mon Jul 7 01:01:17 2008 From: ghcooper at gmail.com (Gregory Cooper) Date: Thu Mar 26 02:22:45 2009 Subject: [plt-scheme] FrTime and sequential evaluation In-Reply-To: References: Message-ID: <65e1d50c0807062201l13edb7f4k46e487ca0aa53b9@mail.gmail.com> Hi Jaime, Combining explicit side effects with dataflow evaluation is tricky (and typically not necessary). I would recommend trying to rewrite this program without using set-cell!. If you want a mechanism for generating events from the REPL, an easier way is to create event-receivers, which you can then trigger with send-event. E.g., here's a program that does something similar to what I think you intended: (define start-e (event-receiver)) (define stop-e (event-receiver)) (define reset-e (event-receiver)) (define (start) (send-event start-e (void))) (define (stop) (send-event stop-e (void))) (define (reset initial) (send-event reset-e initial)) (define running? (hold (merge-e (map-e (lambda (_) #t) start-e) (map-e (lambda (_) #f) stop-e)) #f)) (define tick (changes seconds)) (define (make-timer op) (accum-b (merge-e (map-e (lambda (e) (if (second e) op identity)) (snapshot-e tick running?)) (map-e (lambda (v) (lambda (_) v)) reset-e)) 0)) At the REPL, try > (make-timer -) > (reset 10) > (start) > (stop) etc. Note that it won't stop automatically upon reaching a particular value. Best, Greg On Sun, Jul 6, 2008 at 4:52 PM, Jaime Vargas wrote: > I have been playing with FrTime and I like it. However, I have a question. > How do I enforce sequential evaluation? > In the following code the procedurer count-down doesn't behave as > expected. > > ;;; Definitions window > (define elapsed (new-cell 0)) > > (define (tick) > (- seconds > (value-now seconds))) > > (define (start-timer direction) > (set-cell! elapsed (direction (value-now elapsed) > (tick)))) > > (define (stop-timer) > (set-cell! elapsed (value-now elapsed))) > > (define (get-timer) > elapsed) > > (define reset-timer > (case-lambda > [(v) (set-cell! elapsed v)] > [() (set-cell! elapsed 0)])) > > (define (count-down v) > (reset-timer v) > (start-timer -)) > > (define (trigger-alarm) > (when (= 0 elapsed) > (stop-timer) > "wake-up")) > > ;; Interactions window >> (get-timer) > 0 >> (count-down 10) > > This starts counting down from 0, when I expected to count down from 10. > Thanks, > Jaime > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From davidmlw at gmail.com Tue Jul 8 03:06:00 2008 From: davidmlw at gmail.com (david) Date: Thu Mar 26 02:22:45 2009 Subject: [plt-scheme] How to use (load path) in plt-scheme? Message-ID: <76755968-8ed3-429e-a94f-b07807e09689@34g2000hsf.googlegroups.com> I use plt-scheme as my shell scripts language. I will run some other tools to generate some variables dynamically, and load them into scheme. But my scripts fails. My script looks like this: foo.scm : #!/usr/bin/scheme #!scheme (require scheme/system) (system "echo (define bar \"Hello world\n\") > variables.scm") (load "variables.scm") (display bar) From matthias at ccs.neu.edu Tue Jul 8 17:44:21 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:22:45 2009 Subject: [plt-scheme] How to use (load path) in plt-scheme? In-Reply-To: <76755968-8ed3-429e-a94f-b07807e09689@34g2000hsf.googlegroups.com> References: <76755968-8ed3-429e-a94f-b07807e09689@34g2000hsf.googlegroups.com> Message-ID: <5E03F379-30B5-4A6E-8460-84566CB37BBA@ccs.neu.edu> This is a weird script. Why not > #!/usr/bin/scheme > #!scheme > (require scheme/system) > (define bar "hello world") > (display bar) and be done? ;; --- I used to have the following: bar.scm; dynamically generated via scripts and by-hand: (define bar "hello") foo.scm (load "bar.scm") (display (string-append bar " world")) and I ran this for years. For PLT v4.0, I changed it to bar.scm; dynamically generated via scripts and by-hand: #lang scheme/base (provide bar) (define bar "hello") foo.scm (require (file "bar.scm")) (display (string-append bar " world")) Works like a charm. -- Matthias On Jul 8, 2008, at 3:06 AM, david wrote: > I use plt-scheme as my shell scripts language. I will run some other > tools to generate some variables dynamically, and load them into > scheme. But my scripts fails. > > My script looks like this: > > foo.scm : > #!/usr/bin/scheme > #!scheme > (require scheme/system) > (system "echo (define bar \"Hello world\n\") > variables.scm") > (load "variables.scm") > (display bar) > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From matthias at ccs.neu.edu Tue Jul 8 17:53:05 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:22:45 2009 Subject: [plt-scheme] How to use (load path) in plt-scheme? In-Reply-To: <5E03F379-30B5-4A6E-8460-84566CB37BBA@ccs.neu.edu> References: <76755968-8ed3-429e-a94f-b07807e09689@34g2000hsf.googlegroups.com> <5E03F379-30B5-4A6E-8460-84566CB37BBA@ccs.neu.edu> Message-ID: Oops, I forgot a #lang scheme for foo.scm On Jul 8, 2008, at 5:44 PM, Matthias Felleisen wrote: > > This is a weird script. Why not > >> #!/usr/bin/scheme >> #!scheme >> (require scheme/system) >> (define bar "hello world") >> (display bar) > > and be done? > > ;; --- > > I used to have the following: > > bar.scm; dynamically generated via scripts and by-hand: > (define bar "hello") > > foo.scm > (load "bar.scm") > (display (string-append bar " world")) > > and I ran this for years. > > For PLT v4.0, I changed it to > > bar.scm; dynamically generated via scripts and by-hand: > #lang scheme/base > (provide bar) > (define bar "hello") > > foo.scm > (require (file "bar.scm")) > (display (string-append bar " world")) > > Works like a charm. -- Matthias > > > > > On Jul 8, 2008, at 3:06 AM, david wrote: > >> I use plt-scheme as my shell scripts language. I will run some other >> tools to generate some variables dynamically, and load them into >> scheme. But my scripts fails. >> >> My script looks like this: >> >> foo.scm : >> #!/usr/bin/scheme >> #!scheme >> (require scheme/system) >> (system "echo (define bar \"Hello world\n\") > variables.scm") >> (load "variables.scm") >> (display bar) >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From yinso.chen at gmail.com Tue Jul 8 19:25:30 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:22:46 2009 Subject: [plt-scheme] opendir/readdir/etc? Message-ID: <779bf2730807081625l3a79b3c1q22f7500b0d95259d@mail.gmail.com> Hi - is there equivalent of opendir/readdir procedures in PLT v4? I'm looking for something that provides finer processinging then `directory-list`, but so far not finding them. Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080708/695dac1a/attachment.htm From gregory.woodhouse at sbcglobal.net Tue Jul 8 20:16:45 2008 From: gregory.woodhouse at sbcglobal.net (Gregory Woodhouse) Date: Thu Mar 26 02:22:47 2009 Subject: [plt-scheme] Creating a symbolic link for OS X Message-ID: <0A5B5239-5449-4F69-803A-14C4EE264DBD@sbcglobal.net> This is pretty much a minor annoyance, but with each new version I have to go through the same basic process to update my symbolic link / usr/local/plt gregory-woodhouses-computer:/usr/local root# ln -s /Applications/PLT\ Scheme\ v4.0.2 /usr/local/plt gregory-woodhouses-computer:/usr/local root# exit exit ~:$ which mzscheme /usr/local/plt/bin/mzscheme ~:$ It would be nice if this could be automated. "It is never too late to become reasonable and wise; but if the insight comes too late, there is always more difficulty in starting the change." -- Immanuel Kant http://www.gwoodhouse.com http://GregWoodhouse.ImageKind.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080708/c9025eed/attachment.html From gregory.woodhouse at sbcglobal.net Tue Jul 8 20:51:40 2008 From: gregory.woodhouse at sbcglobal.net (Gregory Woodhouse) Date: Thu Mar 26 02:22:47 2009 Subject: [plt-scheme] (require xml) and modules Message-ID: I'm working on a module of XML utilities (maybe including an XPath implementation, but it may only be partial at this point) and, as you might expect, I need to (require xml). I expect include functions that either take x-expressions as arguments or return them, or both. So here's my question: Should I include (require xml) within the module? I presume people using the module will also need to do this within their own code. "We may with advantage at times forget what we know." --Publilius Cyrus, c. 100 B.C. http://www.gwoodhouse.com http://GregWoodhouse.ImageKind.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080708/79ad4267/attachment.htm From eli at barzilay.org Tue Jul 8 21:03:17 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:48 2009 Subject: [plt-scheme] (require xml) and modules In-Reply-To: References: Message-ID: <18548.3669.549380.782145@arabic.ccs.neu.edu> On Jul 8, Gregory Woodhouse wrote: > I'm working on a module of XML utilities (maybe including an XPath > implementation, but it may only be partial at this point) and, as > you might expect, I need to (require xml). I expect include > functions that either take x-expressions as arguments or return > them, or both. So here's my question: Should I include (require > xml) within the module? I presume people using the module will also > need to do this within their own code. You can choose to have your library complete the xml library, so it's sometimes useful with code that requires xml too but sometimes it'll be enough to just create xexprs directly. Or you can choose to have your library reprovide everything from the xml library if you want it to be a superset. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Tue Jul 8 21:22:15 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:48 2009 Subject: [plt-scheme] Creating a symbolic link for OS X In-Reply-To: <0A5B5239-5449-4F69-803A-14C4EE264DBD@sbcglobal.net> References: <0A5B5239-5449-4F69-803A-14C4EE264DBD@sbcglobal.net> Message-ID: <18548.4807.14343.679147@arabic.ccs.neu.edu> On Jul 8, Gregory Woodhouse wrote: > This is pretty much a minor annoyance, but with each new version I > have to go through the same basic process to update my symbolic link > /usr/local/plt > > gregory-woodhouses-computer:/usr/local root# ln -s /Applications/PLT\ > Scheme\ v4.0.2 /usr/local/plt > gregory-woodhouses-computer:/usr/local root# exit > exit > ~:$ which mzscheme > /usr/local/plt/bin/mzscheme > ~:$ > > It would be nice if this could be automated. If you always use a single version, then you can just rename the directory "/Applications/PLT Scheme" so the symlink can stay the same. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Tue Jul 8 21:26:53 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:48 2009 Subject: [plt-scheme] opendir/readdir/etc? In-Reply-To: <779bf2730807081625l3a79b3c1q22f7500b0d95259d@mail.gmail.com> References: <779bf2730807081625l3a79b3c1q22f7500b0d95259d@mail.gmail.com> Message-ID: <18548.5085.240770.463967@arabic.ccs.neu.edu> On Jul 8, YC wrote: > Hi - > > is there equivalent of opendir/readdir procedures in PLT v4? No. > I'm looking for something that provides finer processinging then > `directory-list`, but so far not finding them. Depending on what you need, you can either try the foreign interface, or writing a thin C interface (that you'll then access with the foreign interface). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From yinso.chen at gmail.com Tue Jul 8 21:33:06 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:22:48 2009 Subject: [plt-scheme] opendir/readdir/etc? In-Reply-To: <18548.5085.240770.463967@arabic.ccs.neu.edu> References: <779bf2730807081625l3a79b3c1q22f7500b0d95259d@mail.gmail.com> <18548.5085.240770.463967@arabic.ccs.neu.edu> Message-ID: <779bf2730807081833q60efaefkf2ba16a1c6fd979@mail.gmail.com> On Tue, Jul 8, 2008 at 6:26 PM, Eli Barzilay wrote: > > > I'm looking for something that provides finer processinging then > > `directory-list`, but so far not finding them. > > Depending on what you need, you can either try the foreign interface, > or writing a thin C interface (that you'll then access with the > foreign interface). > I'm assuming FFI will work - the main challenge appears to figure out how to define the DIR, dirent struct in scheme for conversion. I'm still unfamiliar with the approriate mapping at this time, so probably will have many questions as I go along... ;) Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080708/87d7fca4/attachment.html From DekuDekuplex at Yahoo.com Wed Jul 9 00:33:33 2008 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Thu Mar 26 02:22:49 2009 Subject: [plt-scheme] Re: One small and one big issue with DrScheme References: <000a01c8deb9$ee30f100$2101a8c0@uw2b2dff239c4d> <932b2f1f0807050916y22310bcfp67951626f58bba06@mail.gmail.com> <002a01c8debd$1554bfc0$2101a8c0@uw2b2dff239c4d> <932b2f1f0807050937j10c11a85u31b41f659787ee31@mail.gmail.com> <1ad6cc6b0807052006y67e9343fmaef3bef15d1949bb@mail.gmail.com> <1ad6cc6b0807052006y67e9343fmaef3bef15d1949bb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> <932b2f1f0807052017i590dd2f5j874f5b1f55cf7b07@mail.gmail.com> Message-ID: On Sat, 5 Jul 2008 22:17:31 -0500, "Robby Findler" wrote: >On Sat, Jul 5, 2008 at 10:06 PM, Nicolas Buduroi wrote: >> P.S.: Wow! the speed and quality of responses on mailing lists like this one >> never stop to amaze me compared to typical MS or Java related forums. ;-) > >Yeah, we're still hungry here. When we become rich & famous we'll also >stop caring too. There's probably also the issue of relative user enthusiasm. Correct me if I'm mistaken, but I'm under the impression that most users of MS or Java use their languages because of strict work-related requirements, whereas most users of Scheme (and most other members of the LISP familiy and other functional programming languages) use their languages because the language also doubles as a personal interest or hobby. Programming language-related mailing lists tend to be more responsive when most members have a personal interest in using the language. -- Benjamin L. Russell From robert.matovinovic at web.de Wed Jul 9 03:12:17 2008 From: robert.matovinovic at web.de (Robert Matovinovic) Date: Thu Mar 26 02:22:49 2009 Subject: [plt-scheme] Some suggestions for DrScheme Message-ID: Hi, One of my favorite buttons in DrScheme is the (define ...) button. It saves me a lot of time. I mostly use it in the sort by name mode and would really like DrScheme to remember this setting as a preference because I have to change it in every window I open and every time I start DrScheme. I also love the debugger even more since you added the Stack and variable frames. But I find the frames a bit narrow at times which reduces readability for long names. So I thought it might be an idea to have an option to put them on the bottom of the window like where the find and replace frames are docked. Another idea would be to make the definitions frame border movable. Besides that it feels a bit confusing that one don't find a button to quit the debugger. So far I usually edit the definitions window to make it disappear. Perhaps the Debug button could change to Stop Debug after the debugger has started and return to the normal view after being pressed. As I hope you see, these are just suggestions to make usage of DrScheme even smoother as it already is, but I think worth telling you. Robert _________________________________________ Robert Matovinovic Wintererstr. 61 79104 Freiburg Germany Tel: +49 (0)761 51 93 544 Cell: +49 (0)171 56 32 330 email: robert.matovinovic@web.de From robert.matovinovic at web.de Wed Jul 9 03:12:17 2008 From: robert.matovinovic at web.de (Robert Matovinovic) Date: Thu Mar 26 02:22:49 2009 Subject: [plt-scheme] Distinguishing between pressing Run or Debug button in a tool Message-ID: <3EEC55A09C7B41FEBB1DA11BCA6735F5@IBMI> Hi, In creating a language tool so far I found no way to distinguish if the debug or the run button was pressed. My tool overrides the execute-callback function of drscheme:unit:frame% and is called whenever Run or Debug is pressed. However the documentation says only it is called, when the Run button is pressed. This is just for information no complaint about the behaviour, because I want to do different things before debugging or run. Only that I can't do it the way I thought because I don't find a method like is-clicked? or on-click for a switchable-button which would give me the opportunity to know which one invoked the callback functions. Did I miss something? Thanks for your suggestions. Robert _________________________________________ Robert Matovinovic Wintererstr. 61 79104 Freiburg Germany Tel: +49 (0)761 51 93 544 Cell: +49 (0)171 56 32 330 email: robert.matovinovic@web.de From noelwelsh at gmail.com Wed Jul 9 04:16:35 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:22:49 2009 Subject: [plt-scheme] questions about modules and keyword arguments and so on In-Reply-To: References: Message-ID: On Sat, Jul 5, 2008 at 8:11 AM, Tyler McMullen wrote: > > Suffice it to say that I'm really confused. Any pointers? > I suggest you look at the Instaservlet and Dispatch packages on PLaneT. From what I understand of your code they do what you want. Dispatch is here: http://planet.plt-scheme.org/display.ss?package=dispatch.plt&owner=untyped Instaservlet has a similar URL. HTH, Noel From d.j.gurnell at gmail.com Wed Jul 9 04:36:33 2008 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:22:49 2009 Subject: [plt-scheme] questions about modules and keyword arguments and so on In-Reply-To: References: Message-ID: <33CCFB01-15CD-4ADC-A6B9-06D5C06E94CE@gmail.com> An extra tip: If you're using PLT 4, you have to click the "Browse packages for 4.x" button in the top right of the page. Dispatch and Instaservlet have both had updates that are for PLT 4 only, so you won't see the documentation for the newest versions unless you do this. Cheers, -- Dave >> Suffice it to say that I'm really confused. Any pointers? >> > > I suggest you look at the Instaservlet and Dispatch packages on > PLaneT. From what I understand of your code they do what you want. > > Dispatch is here: > > http://planet.plt-scheme.org/display.ss?package=dispatch.plt&owner=untyped > > Instaservlet has a similar URL. > > HTH, > Noel > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From noelwelsh at gmail.com Wed Jul 9 04:34:23 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:22:50 2009 Subject: [plt-scheme] mime.ss: Mime corruption while accepting file uploads to web servers In-Reply-To: References: Message-ID: On Fri, Jul 4, 2008 at 5:11 AM, Corey Sweeney wrote: > > Does anyone have any idea what's going on here? I'm baffled. > I'll take a look at our file upload code at some point, and update the recipe. N. From derick.eddington at gmail.com Wed Jul 9 04:51:34 2008 From: derick.eddington at gmail.com (Derick Eddington) Date: Thu Mar 26 02:22:50 2009 Subject: [plt-scheme] patch to escape R6RS library names [was: SXML for R6RS] In-Reply-To: <20080708133447.1C9BA650057@mail-svr1.cs.utah.edu> References: <1215047813.20284.17.camel@eep> <1215081783.23549.83.camel@eep> <20080703134719.090736500BE@mail-svr1.cs.utah.edu> <1215163334.23549.257.camel@eep> <20080708133447.1C9BA650057@mail-svr1.cs.utah.edu> Message-ID: <1215593494.4199.5.camel@eep> On Tue, 2008-07-08 at 07:34 -0600, Matthew Flatt wrote: > At Fri, 04 Jul 2008 02:22:14 -0700, Derick Eddington wrote: > > On Thu, 2008-07-03 at 07:47 -0600, Matthew Flatt wrote: > > > At Thu, 03 Jul 2008 03:43:02 -0700, Derick Eddington wrote: > > > > I've been meaning to bring this up and ask: would it be possible for PLT > > > > to support any symbols for library names? Ikarus currently does it by > > > > encoding filename-unfriendly characters like * to %2A. I'd be willing > > > > to make a patch to do this if it's not a dead end. > > > > > > That would be great. > > > > OK, here's my patch, below and attached. Comments: > > > > I made it escape all characters that are not valid for a PLT Scheme > > unquoted module path component because that seemed the most > > conservative. > > > > I made the %-escape encoding have a terminating delimiter of the ; > > character so that library names like (foo \x3BB;) and (foo ?\x3B;B) do > > not resolve to the same filename. > > > > Because the (lib rel-string) require form does not allow the % nor ; > > characters in the rel-string, I changed `convert-library-reference' to > > use the (file string) require form and changed `parse-library-reference' > > to return a platform-specific absolute path string. > > Thanks! > > But I'm uneasy with mixing %-escape encoding with R6RS-style semi-colon > terminators. How about UTF-8 encoding followed by simple two-digit > %-escapes (consistent, I think, with URI percent-encoding and RFC > 3986)? > > > More significantly, I'm worried about generating `file' module > references instead of `lib' module references. That shift will create > various little problems. For example, it won't work with shared > installations that are access through different filesystem paths. Also, > it won't be possible to compile R6RS libraries to bytecode and > distribute them without source (though compile-time version resolution > already interferes to some degree with distributing bytecode). > > Ideally, R6RS references should all be encoded in `lib' references --- > but as things stand, you'd have to pick an encoding that would make > some `lib' paths impossible to express as an R6RS encoding (since you'd > have to pick some character sequence to act as an escape, but that > sequence might be used in an existing name). > > To resolve this mismatch, we could extend the allowed syntax of `lib' > module elements to include %-escapes. That is, a `%' could be allowed > in a `lib' module-path element, as long as its followed by two > lowercase hexadecimal digits. From the perspective of mapping `lib' > paths to file names, this `%' isn't an encoding; it's just part of the > file name. But if R6RS library names are mapped to `lib' paths by UTF-8 > encoding followed by %-encoding of all "special" characters, then > there's a 1-to-1 mapping (ignoring versioning and suffixes) between > R6RS paths and `lib' paths. > > If that sounds ok, I can make the needed changes. > One more detail: we'd have to constrain `%' escapes in `lib' path > elements to rule out encodings of the characters that are currently > allowed. For example, "%41" (= "A", when read as an encoding) would be > disallowed. All that sounds ok to me. Thanks! -- : Derick ---------------------------------------------------------------- From robby at cs.uchicago.edu Wed Jul 9 07:13:56 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:50 2009 Subject: [plt-scheme] Some suggestions for DrScheme In-Reply-To: References: Message-ID: <932b2f1f0807090413t2374bc0cv7fd07332f67e1a7e@mail.gmail.com> On Wed, Jul 9, 2008 at 2:12 AM, Robert Matovinovic wrote: > Hi, > One of my favorite buttons in DrScheme is the (define ...) button. It saves > me a lot of time. I mostly use it in the sort by name mode and would really > like DrScheme to remember this setting as a preference because I have to > change it in every window I open and every time I start DrScheme. I have fixed this. Thanks, Robby From robby at cs.uchicago.edu Wed Jul 9 07:31:15 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:50 2009 Subject: [plt-scheme] Distinguishing between pressing Run or Debug button in a tool In-Reply-To: <3EEC55A09C7B41FEBB1DA11BCA6735F5@IBMI> References: <3EEC55A09C7B41FEBB1DA11BCA6735F5@IBMI> Message-ID: <932b2f1f0807090431k4d4d302bu22db410a9f21135b@mail.gmail.com> Looking over the code debugger's code, I don't see why it is written like that. I have changed it to something that doesn't make the docs lie, but if one of the maintainers of the debugger were to check it over, that would be a good thing. (This is revision 10695.) Thanks, Robby On Wed, Jul 9, 2008 at 2:12 AM, Robert Matovinovic wrote: > Hi, > In creating a language tool so far I found no way to distinguish if the > debug or the run button was pressed. My tool overrides the execute-callback > function of drscheme:unit:frame% and is called whenever Run or Debug is > pressed. However the documentation says only it is called, when the Run > button is pressed. This is just for information no complaint about the > behaviour, because I want to do different things before debugging or run. > Only that I can't do it the way I thought because I don't find a method like > is-clicked? or on-click for a switchable-button which would give me the > opportunity to know which one invoked the callback functions. Did I miss > something? > Thanks for your suggestions. > > Robert > > _________________________________________ > Robert Matovinovic > Wintererstr. 61 > 79104 Freiburg > Germany > > Tel: +49 (0)761 51 93 544 > Cell: +49 (0)171 56 32 330 > email: robert.matovinovic@web.de > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From greg at cs.brown.edu Wed Jul 9 08:04:13 2008 From: greg at cs.brown.edu (Gregory Cooper) Date: Thu Mar 26 02:22:50 2009 Subject: [plt-scheme] Distinguishing between pressing Run or Debug button in a tool In-Reply-To: <932b2f1f0807090431k4d4d302bu22db410a9f21135b@mail.gmail.com> References: <3EEC55A09C7B41FEBB1DA11BCA6735F5@IBMI> <932b2f1f0807090431k4d4d302bu22db410a9f21135b@mail.gmail.com> Message-ID: <65e1d50c0807090504x6a95d883hfa6a9e726b853fef@mail.gmail.com> I'm not sure I understand. The debug button is itself part of a tool, not part of the standard DrScheme interface, so writing another tool that assumes it's there seems problematic. Am I missing something? Robby, your change certainly simplifies things, but it looks to me like the execute-callback will still be invoked along the main path through debug-callback. Again, maybe I'm misunderstanding what the problem is. In general, my impression was "debugging = extra setup + execution", so I don't see how to avoid making the debug button do everything the execute button does (and then some). Greg On Wed, Jul 9, 2008 at 7:31 AM, Robby Findler wrote: > Looking over the code debugger's code, I don't see why it is written > like that. I have changed it to something that doesn't make the docs > lie, but if one of the maintainers of the debugger were to check it > over, that would be a good thing. (This is revision 10695.) > > Thanks, > Robby > > On Wed, Jul 9, 2008 at 2:12 AM, Robert Matovinovic > wrote: >> Hi, >> In creating a language tool so far I found no way to distinguish if the >> debug or the run button was pressed. My tool overrides the execute-callback >> function of drscheme:unit:frame% and is called whenever Run or Debug is >> pressed. However the documentation says only it is called, when the Run >> button is pressed. This is just for information no complaint about the >> behaviour, because I want to do different things before debugging or run. >> Only that I can't do it the way I thought because I don't find a method like >> is-clicked? or on-click for a switchable-button which would give me the >> opportunity to know which one invoked the callback functions. Did I miss >> something? >> Thanks for your suggestions. >> >> Robert >> >> _________________________________________ >> Robert Matovinovic >> Wintererstr. 61 >> 79104 Freiburg >> Germany >> >> Tel: +49 (0)761 51 93 544 >> Cell: +49 (0)171 56 32 330 >> email: robert.matovinovic@web.de >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From Will.Donnelly at gmail.com Tue Jul 8 22:34:49 2008 From: Will.Donnelly at gmail.com (Will Donnelly) Date: Thu Mar 26 02:22:50 2009 Subject: [plt-scheme] Lexer regular expressions Message-ID: <61fd60ab-6d5f-4c1d-834a-c29b4dc2f32a@k13g2000hse.googlegroups.com> I am trying to implement a simple lexer/parser for C header files, to automatically generate the boring bits of a FFI for me. I am mainly doing this because I am lazy and don't want to have to type everything by hand, but also because I think knowing how to do lexing and parsing stuff could be useful in the future. Most of the documentation makes sense, but i seem to have hit one rather annoying little snag. I want to identify keywords in a case- insensitive manner, and this is proving to be much harder than I anticipated. I noticed this while i was trying to add a lexer entry for the #define keyword. First, I looked for some SRE operator to match text while ignoring case, but found nothing. So then I tried #rx"#[Dd][Ee][Ff][Ii][Nn][Ee]" Unfortunately, this seems not to work either. Please tell me, is there any way of achieving this functionality short of saying "(:: "#" (:or "D""d") (:or "E""e") (:or "F""f") (:or "I""i") (:or "N""n") (:or "E""e"))" ? This seems way too verbose to do such a simple thing. Please tell me what I'm missing. From workmin at ccs.neu.edu Wed Jul 9 08:43:20 2008 From: workmin at ccs.neu.edu (Jon Rafkind) Date: Thu Mar 26 02:22:51 2009 Subject: [plt-scheme] Lexer regular expressions In-Reply-To: <61fd60ab-6d5f-4c1d-834a-c29b4dc2f32a@k13g2000hse.googlegroups.com> References: <61fd60ab-6d5f-4c1d-834a-c29b4dc2f32a@k13g2000hse.googlegroups.com> Message-ID: <4874B268.5030902@ccs.neu.edu> Will Donnelly wrote: > I am trying to implement a simple lexer/parser for C header files, to > automatically generate the boring bits of a FFI for me. I am mainly > doing this because I am lazy and don't want to have to type everything > by hand, but also because I think knowing how to do lexing and parsing > stuff could be useful in the future. > > Just FYI, I had a similar problem generating an FFI interface to X11. There is a very nice C parser written in Ocaml called Cil. Attached is my parser using the Cil library. Its tailored to X11 in some ways but maybe you can get the gist of it. If you are interested in using it and don't know how to setup Cil I can explain how it goes. -------------- next part -------------- open Cil module F = Printf module E = Errormsg let unroll_to_struct t = match t with | TNamed(info,_) -> (match info.ttype with | TComp(comp,a) -> let name = if Str.string_match (Str.regexp "^__anon") comp.cname 0 then info.tname else comp.cname in let name = if Str.string_match (Str.regexp "^_") name 0 then name else "_" ^ name in let my_c = Cil.mkCompInfo true name (fun t -> []) [] in TComp(my_c,a) | _ -> Cil.unrollType t) | _ -> t ;; let rec c_to_scheme t = match t with | TInt(IChar,_) -> "_byte" | TInt(IUChar,_) -> "_ubyte" | TInt(ISChar,_) -> "_sbyte" | TInt(IUInt,_) -> "_uint" | TInt(IInt,_) -> "_int" | TInt(ILong,_) -> "_long" | TInt(IULong,_) -> "_ulong" | TInt(_,_) -> "_int" | TPtr(TComp(comp,_),_) -> comp.cname ^ "-pointer" (* | TPtr(TNamed(info,_),a) -> (c_to_scheme (TPtr (info.ttype,a))) *) | TPtr(TNamed(info,info_a),a) -> (c_to_scheme (TPtr ((unroll_to_struct (TNamed (info,info_a))),a))) | TPtr(TInt(IChar,_),_) -> "_string" | TPtr(TPtr(TInt(IChar,_),_),_) -> "(_ptr i _string)" | TPtr(TInt(kind,a),_) -> F.sprintf "(_ptr i %s)" (c_to_scheme (TInt (kind,a))) | TPtr(TPtr(_,_),_) -> "_pointer" | TPtr(t,_) -> F.sprintf "(_ptr i %s)" (c_to_scheme t) | TNamed(info,_) -> (c_to_scheme (unroll_to_struct t)) | TFun(t,Some(args),_,_) -> let p_args = match args with | [] -> "_void" | _ -> (parse_args args) in F.sprintf "(_fun %s -> %s)" p_args (c_to_scheme t) | TFun(t,None,_,_) -> F.sprintf "(_fun _void -> %s)" (c_to_scheme t) (* | TPtr(t,_) -> F.sprintf "(_ptr i %s)" (c_to_scheme t) *) | TVoid(_) -> "_void" | TArray(_,_,_) -> "_array" | TBuiltin_va_list(_) -> "_builtin" | TEnum(enum,_) -> enum.ename | TComp(_,_) -> "_comp" | TFloat(_,_) -> "float" and parse_args args = List.fold_left (fun a b -> a ^ b ^ " ") "" (List.map (fun arg -> match arg with | name,t,attrs -> (c_to_scheme t)) args) ;; class visitor output = object(self) inherit nopCilVisitor val define = "defx11*" method vglob glob = (match glob with | GVar(var,init,loc) -> E.log "Visiting var %s\n" var.vname | GVarDecl(var,loc) -> (match var.vtype with | TFun(t,Some(args),var_args,attrs) -> (* E.log "Visiting variable declaration %s\n" var.vname; *) let p_args = match args with | [] -> "_void " | _ -> (parse_args args) in F.fprintf output "(%s %s : %s-> %s)\n" define var.vname p_args (c_to_scheme t) | TFun(t,None,_,_) -> F.fprintf output "(%s %s : _void -> %s)\n" define var.vname (c_to_scheme t) | _ -> ()) | _ -> ()); SkipChildren end;; let parse_ffi (file:Cil.file) = E.log "Parsing some file\n"; let out = open_out "output" in visitCilFileSameGlobals (new visitor out) file; close_out out ;; let feature : Cil.featureDescr = { fd_name = "ffi"; fd_enabled = ref false; fd_description = "ffi generation from .c header files"; fd_extraopt = []; fd_doit = parse_ffi; fd_post_check = false; } From derick.eddington at gmail.com Wed Jul 9 08:58:51 2008 From: derick.eddington at gmail.com (Derick Eddington) Date: Thu Mar 26 02:22:51 2009 Subject: [plt-scheme] SXML for R6RS [was: R6RS Interoperability] In-Reply-To: <20080708181927.409836500EC@mail-svr1.cs.utah.edu> References: <1215047813.20284.17.camel@eep> <1215081783.23549.83.camel@eep> <20080708181927.409836500EC@mail-svr1.cs.utah.edu> Message-ID: <1215608331.4199.108.camel@eep> On Tue, 2008-07-08 at 12:19 -0600, Matthew Flatt wrote: > At Thu, 03 Jul 2008 03:43:02 -0700, Derick Eddington wrote: > > * SSAX issue: MzScheme does not conform [1] to the R6RS expectation that > > the initial/default exception handler return for non-&serious > > conditions? [2]. Returning for non-&serious conditions allows you to do > > things like raise-continuable a &warning condition to let interested > > clients catch it and do something about it and maybe return, or the > > default handler will return, and execution can continue. I made my > > ssax:warn procedure do this and the SSAX library frequently > > calls ?ssax:warn when issues that often can safely be ignored happen. > > I worry about this implementation of `ssax:warn'. If someone calls into > SSAX with a context like > > (guard (exn > [(serious? exn) "give up"]) > (with-input-from-file > "foo" > (lambda () > ... call SSAX ...))) > > then `ssax:warn' will lead to undefined behavior on the "foo" port when > control escapes to the `guard', even though the exception won't be > caught by the `guard' handler --- right? (I have in mind R6RS semantics > of exceptions and `guard', as opposed to the current PLT approximation.) W.r.t. the "foo" port and control escaping to the `guard' and then the `guard' re-raising -- I think that's okay for an R6RS-conforming `guard' -- see the first part of my original response below. But I realized there's another problem: I realized w.r.t. the continuable exception aspect, it all hinges on whether `guard' will re-raise the unhandled exception as a continuable exception if the original was a continuable exception. I had been assuming this was the intent of the R6RS. However, I note that the R6RS says: "[if none of the `guard' clauses handle the exception] then `raise' is re-invoked on the raised object within the dynamic environment of the original call to `raise' except that the current exception handler is that of the `guard' expression." That clearly says `raise', but how can `raise' be "re-invoked" and how can there be an "?original call to `raise'" if it was not called in the first place because it was `raise-continuable' that was originally called? I think I'll take this up on r6rs-discuss. ====? Original Response =============================================== I think the situation you show above is okay because: R6RS says of `with-input-from-file': "During the dynamic extent of the call to? [?with-input-from-file's] thunk, the obtained port is made the value returned by [the] current-input-port [procedure]; the previous default [value is] reinstated when the dynamic extent is exited. When? thunk returns, the port is closed automatically. [...] If an escape procedure is used to escape back into the call to thunk after thunk is returned, the behavior is unspecified." ?And similarly for the other `call-with-' procedures -- they only close their port if/when their `proc' returns. ?R6RS says `guard' will re-raise "within the dynamic environment of the original call to raise except that the current exception handler is that of the guard expression". So, when control escapes to the `guard' implicit cond, the "foo" port will not be closed and the previous value of `?current-input-port' will be reinstated. When `guard' re-enters the ?dynamic environment of the original call to raise to ?re-raise the unhandled non-&serious, this? dynamic environment includes that of (with-input-from-file "foo" ---) so ?`?current-input-port' will be reset to the "foo" port. If the next exception handler is the initial/default exception handler which returns for non-&serious, it will return to the ssax:warn's raise-continuable and the program continues and everything should be okay. If the next exception handler is not the initial one, and it was installed by the program using `with-exception-handler', it will be called in the same dynamic extent (minus one more level of exception handler) as the original raise, and it will be up to it to return and allow the program to continue or not, and if it does not return so the `?with-input-from-file' thunk can return, then the "foo" port will not be closed, but this issue always applies to all the "with port" procedures and exception handlers exiting their dynamic extent. If the next exception handler is not the initial one and it was installed by the program using `guard', then all the above applies about escaping to the guard's implicit cond and re-entering the dynamic environment of the original raise if the guard doesn't handle the exception. At least, that's how I interpret the R6RS design. ?====================================================================== -- : Derick ---------------------------------------------------------------- From mflatt at cs.utah.edu Wed Jul 9 09:18:08 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:51 2009 Subject: [plt-scheme] SXML for R6RS [was: R6RS Interoperability] In-Reply-To: <1215608331.4199.108.camel@eep> References: <1215047813.20284.17.camel@eep> <1215081783.23549.83.camel@eep> <20080708181927.409836500EC@mail-svr1.cs.utah.edu> <1215608331.4199.108.camel@eep> Message-ID: <20080709131810.3C60A6500AD@mail-svr1.cs.utah.edu> At Wed, 09 Jul 2008 05:58:51 -0700, Derick Eddington wrote: > I think the situation you show above is okay because: > > R6RS says of `with-input-from-file': "During the dynamic extent of the > call to? [?with-input-from-file's] thunk, the obtained port is made the > value returned by [the] current-input-port [procedure]; the previous > default [value is] reinstated when the dynamic extent is exited. When? > thunk returns, the port is closed automatically. [...] If an escape > procedure is used to escape back into the call to thunk after thunk is > returned, the behavior is unspecified." ?And similarly for the other > `call-with-' procedures -- they only close their port if/when their > `proc' returns. > > ?R6RS says `guard' will re-raise "within the dynamic environment of the > original call to raise except that the current exception handler is that > of the guard expression". > > So, when control escapes to the `guard' implicit cond, the "foo" port > will not be closed and the previous value of `?current-input-port' will > be reinstated. When `guard' re-enters the ?dynamic environment of the > original call to raise to ?re-raise the unhandled non-&serious, this? > dynamic environment includes that of (with-input-from-file "foo" ---) > so ?`?current-input-port' will be reset to the "foo" port. I now see that `with-input-form-file' doesn't say what happens if control *escapes* from the call. The specification of `call-with-input-file' is more explicit about what happens if you escape (i.e., the port is not closed), and so I took the `with-input-from-file' specification to allow closing the port on escape. Anyway --- nevermind `with-input-form-file' and `call-with-input-file'; I really wanted to get at `dynamic-wind' behavior. Since the `with-input-from-file' shortcut didn't work, let's go there directly. Suppose that you actually want ports to be closed when control escapes (for any reason), so you write (define (call-with-input-file* file proc) (let ([p #f]) (dynamic-wind (lambda () (set! p (open-input-file file))) (lambda () (proc p)) (lambda () (close-input-port p) (set! p #f))))) and use that, instead. Then, doesn't my objection about `ssax:warn' and `guard' hold? Matthew From robby at cs.uchicago.edu Wed Jul 9 09:57:53 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:51 2009 Subject: [plt-scheme] Distinguishing between pressing Run or Debug button in a tool In-Reply-To: <65e1d50c0807090504x6a95d883hfa6a9e726b853fef@mail.gmail.com> References: <3EEC55A09C7B41FEBB1DA11BCA6735F5@IBMI> <932b2f1f0807090431k4d4d302bu22db410a9f21135b@mail.gmail.com> <65e1d50c0807090504x6a95d883hfa6a9e726b853fef@mail.gmail.com> Message-ID: <932b2f1f0807090657u181e1042x230d79c43d309638@mail.gmail.com> On Wed, Jul 9, 2008 at 7:04 AM, Gregory Cooper wrote: > I'm not sure I understand. The debug button is itself part of a tool, > not part of the standard DrScheme interface, so writing another tool > that assumes it's there seems problematic. Am I missing something? That's certainly true, but I think that Robert is willing to make that assumption and is able to establish it, for his context. > Robby, your change certainly simplifies things, but it looks to me > like the execute-callback will still be invoked along the main path > through debug-callback. Again, maybe I'm misunderstanding what the > problem is. I think that's okay for Robert, since he can override the debug-callback to be able to tell that the execute-callback is being run for debugging. I don't know all of the details he's dealing with, but he's fairly agressively changing the behavior of DrScheme (in ways I certainly didn't plan for) but they seem to be working out okay so far. > In general, my impression was "debugging = extra setup + execution", > so I don't see how to avoid making the debug button do everything the > execute button does (and then some). That sounds right. One thing I wondered: is the debug? flag still necessary? Robby > Greg > > On Wed, Jul 9, 2008 at 7:31 AM, Robby Findler wrote: >> Looking over the code debugger's code, I don't see why it is written >> like that. I have changed it to something that doesn't make the docs >> lie, but if one of the maintainers of the debugger were to check it >> over, that would be a good thing. (This is revision 10695.) >> >> Thanks, >> Robby >> >> On Wed, Jul 9, 2008 at 2:12 AM, Robert Matovinovic >> wrote: >>> Hi, >>> In creating a language tool so far I found no way to distinguish if the >>> debug or the run button was pressed. My tool overrides the execute-callback >>> function of drscheme:unit:frame% and is called whenever Run or Debug is >>> pressed. However the documentation says only it is called, when the Run >>> button is pressed. This is just for information no complaint about the >>> behaviour, because I want to do different things before debugging or run. >>> Only that I can't do it the way I thought because I don't find a method like >>> is-clicked? or on-click for a switchable-button which would give me the >>> opportunity to know which one invoked the callback functions. Did I miss >>> something? >>> Thanks for your suggestions. >>> >>> Robert >>> >>> _________________________________________ >>> Robert Matovinovic >>> Wintererstr. 61 >>> 79104 Freiburg >>> Germany >>> >>> Tel: +49 (0)761 51 93 544 >>> Cell: +49 (0)171 56 32 330 >>> email: robert.matovinovic@web.de >>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > From dyrueta at gmail.com Wed Jul 9 10:36:44 2008 From: dyrueta at gmail.com (David Yrueta) Date: Thu Mar 26 02:22:52 2009 Subject: [plt-scheme] HtDP In-Reply-To: <9b1fff280807071604s3f60eb80wdacbd4ef8f5d1cc3@mail.gmail.com> References: <9b1fff280807071604s3f60eb80wdacbd4ef8f5d1cc3@mail.gmail.com> Message-ID: <186df66b0807090736vc2735fao1acbeeee025c29c@mail.gmail.com> Hi Todd & Marco -- Thank you both for responding. Perhaps my problem lies with my understanding of contracts? Here's what I have so far.... ;contract for fold ;(X X > X) X (listof X) > X ;contract for abstract-from-sum and abstract-from-product ;(number number > number) number (listof numbers) > number ;contract for append ;lst lst > lst ;contract for append-from-fold ;(lst lst > lst) lst lst > lst ;contract for map ;(X > Y) (listof X) > (listof Y) I feel my understanding is running aground on two counts. First, it appears to me that my contract for append-- ;contract for 'append ;(lst lst > lst) lst lst > lst --does not "map" onto my contract for 'fold -- ;contract for 'fold ;(X X > X) X (listof X) > X After substituting 'append's 'lst parameter for all instances of X in 'fold, 'fold's third parameter becomes (listof lst). That can't be right? Is this where I'm floundering? Second, I'm not sure how to resolve the discrepancy between the argument requirements for the function parameters in 'fold and 'map. 'Fold's function parameter requires two like arguments, and converts them into a like value (X X > X); 'map's function parameter requires only one argument, and coverts it into a different type of value (X > Y). So it would seem that the designer of map-from-fold is constrained by the structure of 'fold to make 'cons the argument for the function parameter, since it the only function that accepts two arguments and outputs a list. The final value of any list must be an empty list, so it seem that limits 'threshold's value to 'empty. The only parameter left is the list argument, and I suppose that's where the list from map goes. So the result is this.... (define(map f lox) (fold cons empty lox)) ... which simply outputs 'map's list parameter, returning me to square 1, and leaving 'f unused. The only other thing I can think of is to take up Todd's suggestion, and start off 'map by applying 'f directly to (first lox) -- (define(map f lox) (f((first lox)..... --'cons-ing that onto the front of a list (define(map f lox) (cons(f((first lox).... -- and then introducing 'fold in the manner above, with one change: making '(map f (rest lox)) the argument for 'fold's third parameter, since we know 'map, according to its' contract, is supposed to produce a list. Hmm, that seems to work as long as the first conditional clause answers to 'empty: (define(mapp2 f lox) (cond [(empty? lox)empty] [else(cons(f(first lox)) (fold cons empty (mapp2 f (rest lox))))])) (Sorry about the discursive prose. Writing this stuff out helps me work thru the problem-solving process....) Could this be the solution sought after by HtDP? If so, it seems to me like a *much* more complicated version of the original 'map, or an instance of spending dollars to save pennies...... At any rate, your thoughts and suggestions are very much appreciated, especially since I'm trying to work thru HtDP on my own with assistance only from the members of plt-scheme. Many thanks, Dave Yrueta On Mon, Jul 7, 2008 at 4:04 PM, Marco Morazan wrote: > On Mon, Jul 7, 2008 at 6:11 PM, dave yrueta wrote: > > > > (define(fold f th lox) > > (cond > > [(empty? lox)th] > > [else > > (f (first lox) > > (fold f th (rest lox)))])) > > > > What is the contract for fold? > > > > > (define(mapp2 f lox) > > (fold (cons f) empty lox)) > > > > This won't work, because (cons f) is not a legitimate expression. I > > started work on next problem in the meantime, and that seems even more > > puzzling, so I feel like there is some basic concept about abstraction > > that I'm not getting. Any suggestions? > > > > Here's where a contract is going to be useful for you. What does fold > expect as arguments? Certainly, (cons f) is not something fold is > expecting as its first argument. > > Cheers, > > Marco > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080709/b6835d5d/attachment.htm From nthern at gmail.com Wed Jul 9 10:39:54 2008 From: nthern at gmail.com (Nathan Thern) Date: Thu Mar 26 02:22:52 2009 Subject: [plt-scheme] Error Reporting in Cygwin w/ Rxvt or xterm and Quack In-Reply-To: <48585C3D.25313.24CD3CE@badescu.costin.gmail.com> References: <48585C3D.25313.24CD3CE@badescu.costin.gmail.com> Message-ID: On Tue, Jun 17, 2008 at 11:52 PM, Costin Badescu wrote: > Hello, > I've tried the newest version of MzScheme, 4.0, with Cygwin and Rxvt and it > doesn't print > out errors from the REPL. It gathers all the errors and prints them out when > you exit from > the REPL. Costin- Have you actually compiled mzscheme for cygwin? If you are using the standard windoze mzscheme.exe, then I believe this is an understandable (predictable, even) behavior. I have successfully compiled PLT 372 and 4.0 for cygwin. I am currently using 372 because I am working on compiling cygwin-native Larceny scheme. The 372 mzscheme executable has been working without a hitch in this effort, as it did when compiling the .zo's for the installation. The 4.0 mzscheme executable sometimes dies (and sometimes doesn't) near the end of the .zo compilation with an out-of-memory error. That's all I know about the success of either port; I haven't even attempted module imports or PlaneT or firing up the IDE or anything else gui-related. Point your cygwin setup.exe to http://www.liquid.spod.org/~nthern/cygwin/ Because of the version change wierdness, 372 is the default, and you have to explicitly choose 4.0 if you want it. regards, NT From mflatt at cs.utah.edu Wed Jul 9 11:44:04 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:52 2009 Subject: [plt-scheme] patch to escape R6RS library names [was: SXML for R6RS] In-Reply-To: <1215593494.4199.5.camel@eep> References: <1215047813.20284.17.camel@eep> <1215081783.23549.83.camel@eep> <20080703134719.090736500BE@mail-svr1.cs.utah.edu> <1215163334.23549.257.camel@eep> <20080708133447.1C9BA650057@mail-svr1.cs.utah.edu> <1215593494.4199.5.camel@eep> Message-ID: <20080709154405.CDE2F6500FA@mail-svr1.cs.utah.edu> At Wed, 09 Jul 2008 01:51:34 -0700, Derick Eddington wrote: > > To resolve this mismatch, we could extend the allowed syntax of `lib' > > module elements to include %-escapes. That is, a `%' could be allowed > > in a `lib' module-path element, as long as its followed by two > > lowercase hexadecimal digits. From the perspective of mapping `lib' > > paths to file names, this `%' isn't an encoding; it's just part of the > > file name. But if R6RS library names are mapped to `lib' paths by UTF-8 > > encoding followed by %-encoding of all "special" characters, then > > there's a 1-to-1 mapping (ignoring versioning and suffixes) between > > R6RS paths and `lib' paths. > > > > If that sounds ok, I can make the needed changes. > > > One more detail: we'd have to constrain `%' escapes in `lib' path > > elements to rule out encodings of the characters that are currently > > allowed. For example, "%41" (= "A", when read as an encoding) would be > > disallowed. > > All that sounds ok to me. Thanks! Done in SVN. While I was at it, I added a conversion on 'main used as the second element of a 2-element library name, which avoids a collision with the implicit 'main that is added to a 1-element library name. In general, 'main with any number of trailing underscores is converted by adding an extra underscore. Matthew From simon at joyful.com Wed Jul 9 12:48:00 2008 From: simon at joyful.com (Simon Michael) Date: Thu Mar 26 02:22:53 2009 Subject: [plt-scheme] Re: Lexer regular expressions In-Reply-To: <61fd60ab-6d5f-4c1d-834a-c29b4dc2f32a@k13g2000hse.googlegroups.com> References: <61fd60ab-6d5f-4c1d-834a-c29b4dc2f32a@k13g2000hse.googlegroups.com> Message-ID: Regexps do support case-insensitivity, I think #rx"(?i:define)" is what you want ? Or #rx"((?i:define))" if you need to capture the match for backreferencing. I found this at http://docs.plt-scheme.org/guide/regexp-clusters.html . Cheers -Simon From simon at joyful.com Wed Jul 9 13:11:14 2008 From: simon at joyful.com (Simon Michael) Date: Thu Mar 26 02:22:53 2009 Subject: [plt-scheme] developer links/bug db not visible enough Message-ID: I love the new website, but I notice the information for developers is less prominent than is usual (down at the bottom of Community). I can see this simplifies the top navigation links but if more contributions are desired it might be worth making this more visible. Also the site does not show where to report and review bugs. Dr. Scheme's help menu has a report bug tool, if that is intended to be the only way to submit bugs the site could mention this, also it would still be very useful to link to the bug tracker for reviewing issues. I seem remember seeing one before. Thanks! From simon at joyful.com Wed Jul 9 13:19:11 2008 From: simon at joyful.com (Simon Michael) Date: Thu Mar 26 02:22:53 2009 Subject: [plt-scheme] intermittent "Connection reset by peer" with web server on mac Message-ID: I worked through the systems programming tutorial again last night, with mzscheme 4.0.2 on mac osx leopard, and observed intermittent connection failures when making concurrent connections. eg this fails pretty often: ab -n 1000 -c 100 http://localhost:8080/ with: === context === /Users/simon/src/serve.ss:36:0: handle /Users/simon/src/serve.ss:23:12 regexp-match: expects type as 2nd argument, given: #; other arguments were: #rx"^GET (.+) HTTP/[0-9]+\\.[0-9]+" I see the same thing with plt-web-server, it says: output-file: tcp-write: error writing (Broken pipe; errno=32) File a PLT bug report if this is on a live server! Thanks, -Simon From simon at joyful.com Wed Jul 9 13:35:43 2008 From: simon at joyful.com (Simon Michael) Date: Thu Mar 26 02:22:53 2009 Subject: [plt-scheme] Re: intermittent "Connection reset by peer" with web server on mac In-Reply-To: References: Message-ID: Ah, there is the page to link: http://bugs.plt-scheme.org . Report submitted via Dr. Scheme, http://bugs.plt-scheme.org/query/?debug=&database=default&cmd=view+audit-trail&cmd=view&pr=9593 From mflatt at cs.utah.edu Wed Jul 9 19:53:13 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:53 2009 Subject: [plt-scheme] intermittent "Connection reset by peer" with web server on mac In-Reply-To: References: Message-ID: <20080709235315.9C8B66500EC@mail-svr1.cs.utah.edu> At Wed, 09 Jul 2008 10:19:11 -0700, Simon Michael wrote: > I worked through the systems programming tutorial again last night, with > mzscheme 4.0.2 on mac osx leopard, and observed intermittent connection > failures when making concurrent connections. eg this fails pretty often: > > ab -n 1000 -c 100 http://localhost:8080/ I can reproduce this on Leopard, so that I fairly regularly see apr_socket_recv: Connection reset by peer (54) from `ab'. Occasionally, I see the error that you reported on the server side: > === context === > /Users/simon/src/serve.ss:36:0: handle > /Users/simon/src/serve.ss:23:12 > > regexp-match: expects type as 2nd > argument, given: #; other arguments were: #rx"^GET (.+) > HTTP/[0-9]+\\.[0-9]+" but that seems to be a result of `ab' terminating (due to the other error). As far as I can tell, the source of the "Connection reset by peer" problem is actually in the OS: I reduced the server to just `tcp-accept' (don't read, don't close, etc.), and I even hacked `tcp-accept' to immediately return after the accept() call. With those changes, I could get the "Connection reset by peer" error with `ab -n 40 -c 20'. But if I replace the 5 passed to `tcp-listen' with 100 or more --- making the TCP listener "backlog" larger than the number of attempted concurrent connections --- then I'm unable to trigger the "Connection reset by peer" error in the original server and `ab' configuration. If I then raise the `ab' concurrency to 200, the errors come back. (According to system headers, the maximum backlog value in Leopard is 128, so it doesn't help to pass a larger value to `tcp-listen'.) I rarely hit OS bugs at this level, and I haven't yet tried to create small C programs to demonstrate the problem. Still, as far as I can tell, listen()/accept() is not working right in Mac OS X (I can't reproduce the problem in Linux), and a workaround is to raise the backlog value. Matthew From mflatt at cs.utah.edu Wed Jul 9 20:11:22 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:53 2009 Subject: [plt-scheme] intermittent "Connection reset by peer" with web server on mac In-Reply-To: <20080709235315.9C8B66500EC@mail-svr1.cs.utah.edu> References: <20080709235315.9C8B66500EC@mail-svr1.cs.utah.edu> Message-ID: <20080710001123.D37256500BA@mail-svr1.cs.utah.edu> At Wed, 9 Jul 2008 17:53:13 -0600, Matthew Flatt wrote: > I rarely hit OS bugs at this level, and I haven't yet tried to create > small C programs to demonstrate the problem. But I did learn how to configure and run Apache on Leopard, and I can confirm that with a ListenBackLog setting of 50 (instead of the default 511), Apache also leads to "Connection reset by peer" errors from `ab'. Matthew From mark.engelberg at gmail.com Wed Jul 9 20:53:35 2008 From: mark.engelberg at gmail.com (Mark Engelberg) Date: Thu Mar 26 02:22:54 2009 Subject: [plt-scheme] Effect of memory limit Message-ID: What is the memory limit supposed to do? It stops the problem of consuming so much memory that Windows slows to a halt. But DrScheme still crashes badly, instead of exiting gracefully upon hitting its memory limit. Is this what it's supposed to do, or is this a bug? --Mark From eli at barzilay.org Wed Jul 9 21:08:57 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:22:54 2009 Subject: [plt-scheme] Effect of memory limit In-Reply-To: References: Message-ID: <18549.24873.594074.671514@arabic.ccs.neu.edu> On Jul 9, Mark Engelberg wrote: > What is the memory limit supposed to do? > > It stops the problem of consuming so much memory that Windows slows > to a halt. But DrScheme still crashes badly, instead of exiting > gracefully upon hitting its memory limit. Is this what it's > supposed to do, or is this a bug? DrScheme shouldn't crash when it hits the limit -- it should abort the computation, and pop up a message saying that you ran out of memory, and offer to raise the limit. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From derick.eddington at gmail.com Thu Jul 10 03:36:32 2008 From: derick.eddington at gmail.com (Derick Eddington) Date: Thu Mar 26 02:22:54 2009 Subject: [plt-scheme] SXML for R6RS [was: R6RS Interoperability] In-Reply-To: <20080709131810.3C60A6500AD@mail-svr1.cs.utah.edu> References: <1215047813.20284.17.camel@eep> <1215081783.23549.83.camel@eep> <20080708181927.409836500EC@mail-svr1.cs.utah.edu> <1215608331.4199.108.camel@eep> <20080709131810.3C60A6500AD@mail-svr1.cs.utah.edu> Message-ID: <1215675392.1364.32.camel@eep> On Wed, 2008-07-09 at 07:18 -0600, Matthew Flatt wrote: > Suppose that you actually want ports to be closed when control escapes > (for any reason), so you write > > (define (call-with-input-file* file proc) > (let ([p #f]) > (dynamic-wind > (lambda () (set! p (open-input-file file))) > (lambda () (proc p)) > (lambda () (close-input-port p) (set! p #f))))) > > and use that, instead. Then, doesn't my objection about `ssax:warn' and > `guard' hold? Using dynamic-wind like that would have the same issue with any possible exception re-raised by a guard, and if there were multiple guards which re-raise, it would exit and re-enter for each guard. Or what if somewhere down in proc's dynamic extent it uses a procedure which escapes to some continuation and then re-enters back? Assuming the dynamic extent will only be entered and exited once just seems like a bad idea unless you can be certain of that. If you want the port to be closed when control escapes, a possible guard is one of the ways control could escape. I don't see how making ssax:warn raise an exception singles it out when there are other ways control could escape and re-enter. Am I missing something? -- : Derick ---------------------------------------------------------------- From robert.matovinovic at web.de Thu Jul 10 04:54:29 2008 From: robert.matovinovic at web.de (Robert Matovinovic) Date: Thu Mar 26 02:22:54 2009 Subject: AW: [plt-scheme] Distinguishing between pressing Run or Debug button in a tool In-Reply-To: <932b2f1f0807090657u181e1042x230d79c43d309638@mail.gmail.com> Message-ID: <50F63CC5CCD242D898F94D070D39952E@IBMI> Unexpectedly I was out yesterday, so a belated answer. > -----Urspr?ngliche Nachricht----- > Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] > Im Auftrag von Robby Findler > Gesendet: Mittwoch, 9. Juli 2008 15:58 > An: Gregory Cooper > Cc: Robert Matovinovic; plt-scheme@list.cs.brown.edu > Betreff: Re: [plt-scheme] Distinguishing between pressing Run > or Debug button in a tool > > > On Wed, Jul 9, 2008 at 7:04 AM, Gregory Cooper > wrote: > > I'm not sure I understand. The debug button is itself part > of a tool, > > not part of the standard DrScheme interface, so writing > another tool > > that assumes it's there seems problematic. Am I missing something? > > That's certainly true, but I think that Robert is willing to > make that assumption and is able to establish it, for his context. > That's what I'll do. > > Robby, your change certainly simplifies things, but it looks to me > > like the execute-callback will still be invoked along the main path > > through debug-callback. Again, maybe I'm misunderstanding what the > > problem is. > > I think that's okay for Robert, since he can override the > debug-callback to be able to tell that the execute-callback > is being run for debugging. I don't know all of the details > he's dealing with, but he's fairly agressively changing the > behavior of DrScheme (in ways I certainly didn't plan for) > but they seem to be working out okay so far. > That sounds good to me. Is your change already in the nightly build version 4.0.2.3, updated at Wednesday, July 09 2008, 13:25 EDT? I'm not yet able to compile from sources. > > In general, my impression was "debugging = extra setup + > execution", > > so I don't see how to avoid making the debug button do > everything the > > execute button does (and then some). > > That sounds right. > Greg, you put it very clear for the debugger tool "debugging = extra setup + execution". What I want to do is something like "my setup + execution + my clean-up" for execution or "my setup + debugging + my clean-up" for debugging or even "extra setup + my setup + execution + my clean-up". What I actually do is "my execution" where everything is in a changed execute-callback function This is because I had to give up on "my clean-up". It would necessitate an after-execute method. And for clarity I don't used on-execute. For the debugger that doesn't work because it calls super execute-callback. So I wanted to work around that by changing the behavior of my execute-callback, when the debug button is pressed. But I didn't bear in mind that the debugger is a tool and not part of DrScheme. If I still need a workaround it will be to use on-execute with "my clean-up + my setup". So if there is anything to clean-up before the next execution it will be done. This is not very straightforward but will hopefully not have to many side effects. This approach also needs "my clean-up" on-close for the window and the tab. But all that raises my question: Why isn't there an after-execute method? I assume I miss an important point in the archtecture of DrScheme. Robert > One thing I wondered: is the debug? flag still necessary? > > Robby > > > Greg > > > > On Wed, Jul 9, 2008 at 7:31 AM, Robby Findler > > > wrote: > >> Looking over the code debugger's code, I don't see why it > is written > >> like that. I have changed it to something that doesn't > make the docs > >> lie, but if one of the maintainers of the debugger were to > check it > >> over, that would be a good thing. (This is revision 10695.) > >> > >> Thanks, > >> Robby > >> > >> On Wed, Jul 9, 2008 at 2:12 AM, Robert Matovinovic > >> wrote: > >>> Hi, > >>> In creating a language tool so far I found no way to > distinguish if > >>> the debug or the run button was pressed. My tool overrides the > >>> execute-callback function of drscheme:unit:frame% and is called > >>> whenever Run or Debug is pressed. However the documentation says > >>> only it is called, when the Run button is pressed. This > is just for > >>> information no complaint about the behaviour, because I > want to do > >>> different things before debugging or run. Only that I can't do it > >>> the way I thought because I don't find a method like > is-clicked? or > >>> on-click for a switchable-button which would give me the > opportunity > >>> to know which one invoked the callback functions. Did I miss > >>> something? Thanks for your suggestions. > >>> > >>> Robert > >>> > >>> _________________________________________ > >>> Robert Matovinovic > >>> Wintererstr. 61 > >>> 79104 Freiburg > >>> Germany > >>> > >>> Tel: +49 (0)761 51 93 544 > >>> Cell: +49 (0)171 56 32 330 > >>> email: robert.matovinovic@web.de > >>> > >>> _________________________________________________ > >>> For list-related administrative tasks: > >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > >>> > >>> > >> _________________________________________________ > >> For list-related administrative tasks: > >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > >> > > > > > From noelwelsh at gmail.com Thu Jul 10 05:12:04 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:22:54 2009 Subject: [plt-scheme] questions about modules and keyword arguments and so on In-Reply-To: <562941060807091806i8a9ba8x868211cfdedd679d@mail.gmail.com> References: <562941060807091806i8a9ba8x868211cfdedd679d@mail.gmail.com> Message-ID: On Thu, Jul 10, 2008 at 2:06 AM, Tyler McMullen wrote: > However, my point was not that I need to accomplish this particular task. > Rather, I'm stumped trying to figure out what is wrong with the quoted > code. If anyone has some insight into that... It would be greatly > appreciated. Ok, you prompted me to get off my lazy arse and actually read your code. The essential error is, I think, that you're using the mzscheme language not the scheme/base language. Use modules for *all* of your files and start them with #lang scheme/base rather than (module name mzscheme ... and get rid of the closing ) as well. The keyword issue is an incompatibility between the v3 legacy language and the v4 language and is documented in the release notes (at least, it should be...) Also, you don't need that eval. For a beginner you can't really go wrong *never* using eval. I'm serious here -- experienced Schemers very rarely use it, and beginners use it far too much. This: (define (dispatch-mvc conn req) (output-response conn (eval (cdr (assoc (url->string (request-uri req)) routes))))) Can become this: (define (dispatch-mvc conn req) (output-response conn (let ([the-function (cdr (assoc (url->string (request-uri req)) routes))]) (the-function))) That you used eval here suggests you haven't yet fully grasped how to use higher order functions. HTH, Noel From simon at joyful.com Wed Jul 9 20:45:39 2008 From: simon at joyful.com (Simon Michael) Date: Thu Mar 26 02:22:54 2009 Subject: [plt-scheme] intermittent "Connection reset by peer" with web server on mac In-Reply-To: <20080709235315.9C8B66500EC@mail-svr1.cs.utah.edu> References: <20080709235315.9C8B66500EC@mail-svr1.cs.utah.edu> Message-ID: <2E69E492-4AD1-4819-ADD8-8901FCC2E02F@joyful.com> > But if I replace the 5 passed to `tcp-listen' with 100 or more --- > making the TCP listener "backlog" larger than the number of attempted > concurrent connections --- then I'm unable to trigger the "Connection > reset by peer" error in the original server and `ab' configuration. If > I then raise the `ab' concurrency to 200, the errors come back. That's what I see - > (According to system headers, the maximum backlog value in Leopard is > 128, so it doesn't help to pass a larger value to `tcp-listen'.) Ah, good to know. > confirm that with a ListenBackLog setting of 50 (instead of the > default > 511), Apache also leads to "Connection reset by peer" errors from > `ab'. Interesting. Even more interesting, I can repeatably kill OS X by testing this stuff. Eg with tcp-listen's queue increased to 100 and running ab -n 10000 -c 100 ... a few times, I will pretty soon see either a freeze with a "you must reboot" screen, or a reboot without warning. Is it just me ? I recently added third-party ram to this macbook, still it's the first time I've seen such a thing. From tbmcmullen at gmail.com Wed Jul 9 21:06:27 2008 From: tbmcmullen at gmail.com (Tyler McMullen) Date: Thu Mar 26 02:22:55 2009 Subject: [plt-scheme] questions about modules and keyword arguments and so on In-Reply-To: References: Message-ID: <562941060807091806i8a9ba8x868211cfdedd679d@mail.gmail.com> > > I suggest you look at the Instaservlet and Dispatch packages on > PLaneT. From what I understand of your code they do what you want. > These look like rather neat projects and they may just come in handy at a later date. Thank you. However, my point was not that I need to accomplish this particular task. Rather, I'm stumped trying to figure out what is wrong with the quoted code. If anyone has some insight into that... It would be greatly appreciated. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080709/fe098272/attachment.html From robby at cs.uchicago.edu Thu Jul 10 07:34:55 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:55 2009 Subject: [plt-scheme] Distinguishing between pressing Run or Debug button in a tool In-Reply-To: <50F63CC5CCD242D898F94D070D39952E@IBMI> References: <932b2f1f0807090657u181e1042x230d79c43d309638@mail.gmail.com> <50F63CC5CCD242D898F94D070D39952E@IBMI> Message-ID: <932b2f1f0807100434r779bdbe9g275db813e70f64bb@mail.gmail.com> I think the answer is that there is no after-execute because the custodian handles all such cleanup. (It isn't clear when after-execute would run -- typically the program uses the REPL so there is always something running which means that any kind of close-down cleanup action has to wait for the REPL to finish.) I'm not sure if it is in the nightly build, but the change is to the debugger so that it now has a debug-callback method that the debugger's button invokes. Robby On Thu, Jul 10, 2008 at 3:54 AM, Robert Matovinovic wrote: > Unexpectedly I was out yesterday, so a belated answer. > >> -----Urspr?ngliche Nachricht----- >> Von: robby.findler@gmail.com [mailto:robby.findler@gmail.com] >> Im Auftrag von Robby Findler >> Gesendet: Mittwoch, 9. Juli 2008 15:58 >> An: Gregory Cooper >> Cc: Robert Matovinovic; plt-scheme@list.cs.brown.edu >> Betreff: Re: [plt-scheme] Distinguishing between pressing Run >> or Debug button in a tool >> >> >> On Wed, Jul 9, 2008 at 7:04 AM, Gregory Cooper >> wrote: >> > I'm not sure I understand. The debug button is itself part >> of a tool, >> > not part of the standard DrScheme interface, so writing >> another tool >> > that assumes it's there seems problematic. Am I missing something? >> >> That's certainly true, but I think that Robert is willing to >> make that assumption and is able to establish it, for his context. >> > > That's what I'll do. > >> > Robby, your change certainly simplifies things, but it looks to me >> > like the execute-callback will still be invoked along the main path >> > through debug-callback. Again, maybe I'm misunderstanding what the >> > problem is. >> >> I think that's okay for Robert, since he can override the >> debug-callback to be able to tell that the execute-callback >> is being run for debugging. I don't know all of the details >> he's dealing with, but he's fairly agressively changing the >> behavior of DrScheme (in ways I certainly didn't plan for) >> but they seem to be working out okay so far. >> > > That sounds good to me. Is your change already in the nightly build version > 4.0.2.3, updated at Wednesday, July 09 2008, 13:25 EDT? I'm not yet able to > compile from sources. > >> > In general, my impression was "debugging = extra setup + >> execution", >> > so I don't see how to avoid making the debug button do >> everything the >> > execute button does (and then some). >> >> That sounds right. >> > > Greg, you put it very clear for the debugger tool "debugging = extra setup + > execution". What I want to do is something like > "my setup + execution + my clean-up" for execution or > "my setup + debugging + my clean-up" for debugging or even > "extra setup + my setup + execution + my clean-up". > What I actually do is > "my execution" where everything is in a changed execute-callback function > > This is because I had to give up on "my clean-up". It would necessitate an > after-execute method. And for clarity I don't used on-execute. For the > debugger that doesn't work because it calls super execute-callback. So I > wanted to work around that by changing the behavior of my execute-callback, > when the debug button is pressed. But I didn't bear in mind that the > debugger is a tool and not part of DrScheme. > > If I still need a workaround it will be to use on-execute with "my clean-up > + my setup". So if there is anything to clean-up before the next execution > it will be done. This is not very straightforward but will hopefully not > have to many side effects. This approach also needs "my clean-up" on-close > for the window and the tab. > > But all that raises my question: Why isn't there an after-execute method? I > assume I miss an important point in the archtecture of DrScheme. > > Robert > > > > > > >> One thing I wondered: is the debug? flag still necessary? >> >> Robby >> >> > Greg >> > >> > On Wed, Jul 9, 2008 at 7:31 AM, Robby Findler >> >> > wrote: >> >> Looking over the code debugger's code, I don't see why it >> is written >> >> like that. I have changed it to something that doesn't >> make the docs >> >> lie, but if one of the maintainers of the debugger were to >> check it >> >> over, that would be a good thing. (This is revision 10695.) >> >> >> >> Thanks, >> >> Robby >> >> >> >> On Wed, Jul 9, 2008 at 2:12 AM, Robert Matovinovic >> >> wrote: >> >>> Hi, >> >>> In creating a language tool so far I found no way to >> distinguish if >> >>> the debug or the run button was pressed. My tool overrides the >> >>> execute-callback function of drscheme:unit:frame% and is called >> >>> whenever Run or Debug is pressed. However the documentation says >> >>> only it is called, when the Run button is pressed. This >> is just for >> >>> information no complaint about the behaviour, because I >> want to do >> >>> different things before debugging or run. Only that I can't do it >> >>> the way I thought because I don't find a method like >> is-clicked? or >> >>> on-click for a switchable-button which would give me the >> opportunity >> >>> to know which one invoked the callback functions. Did I miss >> >>> something? Thanks for your suggestions. >> >>> >> >>> Robert >> >>> >> >>> _________________________________________ >> >>> Robert Matovinovic >> >>> Wintererstr. 61 >> >>> 79104 Freiburg >> >>> Germany >> >>> >> >>> Tel: +49 (0)761 51 93 544 >> >>> Cell: +49 (0)171 56 32 330 >> >>> email: robert.matovinovic@web.de >> >>> >> >>> _________________________________________________ >> >>> For list-related administrative tasks: >> >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >>> >> >>> >> >> _________________________________________________ >> >> For list-related administrative tasks: >> >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> >> > >> > >> > > > From mflatt at cs.utah.edu Thu Jul 10 08:02:58 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:55 2009 Subject: [plt-scheme] SXML for R6RS [was: R6RS Interoperability] In-Reply-To: <1215675392.1364.32.camel@eep> References: <1215047813.20284.17.camel@eep> <1215081783.23549.83.camel@eep> <20080708181927.409836500EC@mail-svr1.cs.utah.edu> <1215608331.4199.108.camel@eep> <20080709131810.3C60A6500AD@mail-svr1.cs.utah.edu> <1215675392.1364.32.camel@eep> Message-ID: <20080710120311.D562C6500AD@mail-svr1.cs.utah.edu> At Thu, 10 Jul 2008 00:36:32 -0700, Derick Eddington wrote: > On Wed, 2008-07-09 at 07:18 -0600, Matthew Flatt wrote: > > Suppose that you actually want ports to be closed when control escapes > > (for any reason), so you write > > > > (define (call-with-input-file* file proc) > > (let ([p #f]) > > (dynamic-wind > > (lambda () (set! p (open-input-file file))) > > (lambda () (proc p)) > > (lambda () (close-input-port p) (set! p #f))))) > > > > and use that, instead. Then, doesn't my objection about `ssax:warn' and > > `guard' hold? > > Using dynamic-wind like that would have the same issue with any possible > exception re-raised by a guard, and if there were multiple guards which > re-raise, it would exit and re-enter for each guard. Or what if > somewhere down in proc's dynamic extent it uses a procedure which > escapes to some continuation and then re-enters back? Assuming the > dynamic extent will only be entered and exited once just seems like a > bad idea unless you can be certain of that. You're right. Under normal circumstances, you can be sure quite often, because few library functions capture and restore continuations. Indeed, in building PLT Scheme libraries and tools, we've often found it necessary to ensure that a continuation is not restored when unknown code is called, which is why PLT Scheme includes constructs like continuation barriers. > I don't see how making ssax:warn raise an exception > singles it out when there are other ways control could escape and > re-enter. Turning the above around, if a library captures and restores continuations, then it's placing an extra burden on users of the library to accommodate continuation jumps. That sounds like a big price to pay to get warnings from SSAX --- but perhaps I'm not enough of an SSAX user to say. If SSAX users understand that functions capture and restore continuations anytime that they might report a warning, and if they're happy with that API, then it's all fine. Matthew From derick.eddington at gmail.com Thu Jul 10 10:23:09 2008 From: derick.eddington at gmail.com (Derick Eddington) Date: Thu Mar 26 02:22:55 2009 Subject: [plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS] In-Reply-To: <20080710120311.D562C6500AD@mail-svr1.cs.utah.edu> References: <1215047813.20284.17.camel@eep> <1215081783.23549.83.camel@eep> <20080708181927.409836500EC@mail-svr1.cs.utah.edu> <1215608331.4199.108.camel@eep> <20080709131810.3C60A6500AD@mail-svr1.cs.utah.edu> <1215675392.1364.32.camel@eep> <20080710120311.D562C6500AD@mail-svr1.cs.utah.edu> Message-ID: <1215699790.1364.125.camel@eep> On Thu, 2008-07-10 at 06:02 -0600, Matthew Flatt wrote: > At Thu, 10 Jul 2008 00:36:32 -0700, Derick Eddington wrote: > > On Wed, 2008-07-09 at 07:18 -0600, Matthew Flatt wrote: > > > Suppose that you actually want ports to be closed when control escapes > > > (for any reason), so you write > > > > > > (define (call-with-input-file* file proc) > > > (let ([p #f]) > > > (dynamic-wind > > > (lambda () (set! p (open-input-file file))) > > > (lambda () (proc p)) > > > (lambda () (close-input-port p) (set! p #f))))) > > > > > > and use that, instead. Then, doesn't my objection about `ssax:warn' and > > > `guard' hold? > > > > Using dynamic-wind like that would have the same issue with any possible > > exception re-raised by a guard, and if there were multiple guards which > > re-raise, it would exit and re-enter for each guard. Or what if > > somewhere down in proc's dynamic extent it uses a procedure which > > escapes to some continuation and then re-enters back? Assuming the > > dynamic extent will only be entered and exited once just seems like a > > bad idea unless you can be certain of that. > > You're right. > > Under normal circumstances, you can be sure quite often, because few > library functions capture and restore continuations. Indeed, in > building PLT Scheme libraries and tools, we've often found it necessary > to ensure that a continuation is not restored when unknown code is > called, which is why PLT Scheme includes constructs like continuation > barriers. > > > I don't see how making ssax:warn raise an exception > > singles it out when there are other ways control could escape and > > re-enter. > > Turning the above around, if a library captures and restores > continuations, then it's placing an extra burden on users of the > library to accommodate continuation jumps. That sounds like a big price > to pay to get warnings from SSAX --- but perhaps I'm not enough of an > SSAX user to say. If SSAX users understand that functions capture and > restore continuations anytime that they might report a warning, and if > they're happy with that API, then it's all fine. I agree that would be a big price, too big and too unexpected of a price. Now I think I realize there's another issue you are considering that I was not: in PLT at the moment, `raise-continuable' is capturing its continuation which gets restored if the handler returns, and this is why my `ssax:warn' would be capturing and restoring continuations. I realized I've been assuming this would not be PLT's final design, because of what the R6RS seems to say about how exception handling and dynamic extent is supposed to work -- that raising an exception, continuable or not, calling the handler, and possibly returning for a continuable exception, ?does not exit and re-enter the dynamic extent ?(unless `guard' handlers which ?re-raise are involved, but that's an argument against using `guard' I think, not against using continuable exceptions). (raise obj) procedure Raises a non-continuable exception by invoking the current exception handler on obj. The handler is called with a continuation whose dynamic environment is that of the call to raise, except that the current exception handler is the one that was in place when the handler being called was installed. When the handler returns, a non-continuable exception with condition type &non-continuable is raised in the same dynamic environment as the handler. (raise-continuable obj) procedure Raises a continuable exception by invoking the current exception handler on obj. The handler is called with a continuation that is equivalent to the continuation of the call to raise-continuable, with these two exceptions: (1) the current exception handler is the one that was in place when the handler being called was installed, and (2) if the handler being called returns, then it will again become the current exception handler. If the handler returns, the values it returns become the values returned by the call to raise-continuable. Maybe I'm reading into this too much thinking it means the dynamic extent will not be exited and re-entered. But if my interpretation is wrong, doesn't that mean any and all uses of `raise-continuable' are going to be effectively verboten in an implementation that captures and restores continuations, because they'll be imposing that unexpectedly? (I agree imposing that unexpectedly would be bad.) But then what's the use of continuable exceptions, &warning, and an initial/default handler that returns for non-&serious? In Ikarus, calling `raise' or `raise-continuable', calling the handler, the handler's dynamic extent possibly calling ?`raise' or `raise-continuable', and the handler returning all do not capture or restore continuations, it's all one series/stack of normal procedure calls and returns (again, unless `guard' handlers are called). -- : Derick ---------------------------------------------------------------- From jos.koot at telefonica.net Thu Jul 10 10:30:12 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:22:56 2009 Subject: [plt-scheme] phase question Message-ID: <003401c8e299$76f34ff0$2101a8c0@uw2b2dff239c4d> I have reduced more complicated code to the following: file trial.ss ======================================== #lang scheme (provide declare-tag use-tag) (define-for-syntax tag-register '()) (define-for-syntax (register-tag tag) (set! tag-register (cons (syntax->datum tag) tag-register))) (define-for-syntax (tag? tag) (member (syntax->datum tag) tag-register)) (define-syntax (declare-tag stx) (syntax-case stx () ((_ tag) (begin (register-tag #'tag) #'(void))))) (define-syntax (use-tag stx) (syntax-case stx () ((_ tag) (tag? #'tag) #''ok) ((_ tag) (raise-syntax-error 'tags "unknown tag" stx #'tag)))) ; of course I can leave out the check (tag? #'tag) ; and omit the error detection, but that gives rise ; to unclear error messages when wrong tags are used ; in the program I excerpted this example from. (declare-tag a) (declare-tag b) (use-tag a) ; --> ok file-use-trial.ss ====================================== #lang scheme (require "trial.ss") (declare-tag x) (use-tag x) ; ok, but (use-tag a) ; --> unknown tag I understand that the tag-register is reset to () when invoked for different phases. Is there a way to register the tags in such a way that macro use-tag sees both those declared in trial.ss and in use-trial.ss? If I remember correctly use-tag did do that in version 370. Thanks, Jos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080710/04ee9c8b/attachment.htm From robby at cs.uchicago.edu Thu Jul 10 10:42:11 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:56 2009 Subject: [plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS] In-Reply-To: <1215699790.1364.125.camel@eep> References: <1215047813.20284.17.camel@eep> <1215081783.23549.83.camel@eep> <20080708181927.409836500EC@mail-svr1.cs.utah.edu> <1215608331.4199.108.camel@eep> <20080709131810.3C60A6500AD@mail-svr1.cs.utah.edu> <1215675392.1364.32.camel@eep> <20080710120311.D562C6500AD@mail-svr1.cs.utah.edu> <1215699790.1364.125.camel@eep> Message-ID: <932b2f1f0807100742w4fd89542w2e3b30c59b1b1467@mail.gmail.com> The operational semantics of R6 indicates that there is no exit/re-enter for raise-continuable (altho it only covers with-exception-handler, raise and raise-continuable, not guard). Robby On Thu, Jul 10, 2008 at 9:23 AM, Derick Eddington wrote: > On Thu, 2008-07-10 at 06:02 -0600, Matthew Flatt wrote: >> At Thu, 10 Jul 2008 00:36:32 -0700, Derick Eddington wrote: >> > On Wed, 2008-07-09 at 07:18 -0600, Matthew Flatt wrote: >> > > Suppose that you actually want ports to be closed when control escapes >> > > (for any reason), so you write >> > > >> > > (define (call-with-input-file* file proc) >> > > (let ([p #f]) >> > > (dynamic-wind >> > > (lambda () (set! p (open-input-file file))) >> > > (lambda () (proc p)) >> > > (lambda () (close-input-port p) (set! p #f))))) >> > > >> > > and use that, instead. Then, doesn't my objection about `ssax:warn' and >> > > `guard' hold? >> > >> > Using dynamic-wind like that would have the same issue with any possible >> > exception re-raised by a guard, and if there were multiple guards which >> > re-raise, it would exit and re-enter for each guard. Or what if >> > somewhere down in proc's dynamic extent it uses a procedure which >> > escapes to some continuation and then re-enters back? Assuming the >> > dynamic extent will only be entered and exited once just seems like a >> > bad idea unless you can be certain of that. >> >> You're right. >> >> Under normal circumstances, you can be sure quite often, because few >> library functions capture and restore continuations. Indeed, in >> building PLT Scheme libraries and tools, we've often found it necessary >> to ensure that a continuation is not restored when unknown code is >> called, which is why PLT Scheme includes constructs like continuation >> barriers. >> >> > I don't see how making ssax:warn raise an exception >> > singles it out when there are other ways control could escape and >> > re-enter. >> >> Turning the above around, if a library captures and restores >> continuations, then it's placing an extra burden on users of the >> library to accommodate continuation jumps. That sounds like a big price >> to pay to get warnings from SSAX --- but perhaps I'm not enough of an >> SSAX user to say. If SSAX users understand that functions capture and >> restore continuations anytime that they might report a warning, and if >> they're happy with that API, then it's all fine. > > I agree that would be a big price, too big and too unexpected of a > price. Now I think I realize there's another issue you are considering > that I was not: in PLT at the moment, `raise-continuable' is capturing > its continuation which gets restored if the handler returns, and this is > why my `ssax:warn' would be capturing and restoring continuations. I > realized I've been assuming this would not be PLT's final design, > because of what the R6RS seems to say about how exception handling and > dynamic extent is supposed to work -- that raising an exception, > continuable or not, calling the handler, and possibly returning for a > continuable exception, ?does not exit and re-enter the dynamic > extent ?(unless `guard' handlers which ?re-raise are involved, but > that's an argument against using `guard' I think, not against using > continuable exceptions). > > (raise obj) procedure > > Raises a non-continuable exception by invoking the current > exception handler on obj. The handler is called with a > continuation whose dynamic environment is that of the call to > raise, except that the current exception handler is the one that > was in place when the handler being called was installed. When > the handler returns, a non-continuable exception with condition > type &non-continuable is raised in the same dynamic environment > as the handler. > > (raise-continuable obj) procedure > Raises a continuable exception by invoking the current exception > handler on obj. The handler is called with a continuation that > is equivalent to the continuation of the call to > raise-continuable, with these two exceptions: (1) the current > exception handler is the one that was in place when the handler > being called was installed, and (2) if the handler being called > returns, then it will again become the current exception > handler. If the handler returns, the values it returns become > the values returned by the call to raise-continuable. > > Maybe I'm reading into this too much thinking it means the dynamic > extent will not be exited and re-entered. But if my interpretation is > wrong, doesn't that mean any and all uses of `raise-continuable' are > going to be effectively verboten in an implementation that captures and > restores continuations, because they'll be imposing that unexpectedly? > (I agree imposing that unexpectedly would be bad.) But then what's the > use of continuable exceptions, &warning, and an initial/default handler > that returns for non-&serious? > > In Ikarus, calling `raise' or `raise-continuable', calling the handler, > the handler's dynamic extent possibly calling ?`raise' or > `raise-continuable', and the handler returning all do not capture or > restore continuations, it's all one series/stack of normal procedure > calls and returns (again, unless `guard' handlers are called). > > -- > : Derick > ---------------------------------------------------------------- > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From mflatt at cs.utah.edu Thu Jul 10 10:56:08 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:56 2009 Subject: [plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS] In-Reply-To: <1215699790.1364.125.camel@eep> References: <1215047813.20284.17.camel@eep> <1215081783.23549.83.camel@eep> <20080708181927.409836500EC@mail-svr1.cs.utah.edu> <1215608331.4199.108.camel@eep> <20080709131810.3C60A6500AD@mail-svr1.cs.utah.edu> <1215675392.1364.32.camel@eep> <20080710120311.D562C6500AD@mail-svr1.cs.utah.edu> <1215699790.1364.125.camel@eep> Message-ID: <20080710145610.4C70D65011A@mail-svr1.cs.utah.edu> At Thu, 10 Jul 2008 07:23:09 -0700, Derick Eddington wrote: > On Thu, 2008-07-10 at 06:02 -0600, Matthew Flatt wrote: > > Turning the above around, if a library captures and restores > > continuations, then it's placing an extra burden on users of the > > library to accommodate continuation jumps. That sounds like a big price > > to pay to get warnings from SSAX --- but perhaps I'm not enough of an > > SSAX user to say. If SSAX users understand that functions capture and > > restore continuations anytime that they might report a warning, and if > > they're happy with that API, then it's all fine. > > I agree that would be a big price, too big and too unexpected of a > price. Now I think I realize there's another issue you are considering > that I was not: in PLT at the moment, `raise-continuable' is capturing > its continuation which gets restored if the handler returns, and this is > why my `ssax:warn' would be capturing and restoring continuations. No. Even in the PLT implementation, the problems start when someone uses `guard' or `with-handlers' to catch exceptions. > ?(unless `guard' handlers which ?re-raise are involved, but > that's an argument against using `guard' I think, not against using > continuable exceptions). I agree that the problem is with the combination of continuable exceptions, `guard' or `with-handlers', and `dynamic-wind'. Maybe the question amounts to deciding whether continuable exceptions or `guard'/`with-handlers' is the right model for exceptions. As you may have detected, I'm skeptical of continuable exceptions --- or at least with merging into the system for non-continuable exceptions. > (raise obj) procedure [...] > (raise-continuable obj) procedure [....] > > Maybe I'm reading into this too much thinking it means the dynamic > extent will not be exited and re-entered. That's my reading, too, and the PLT implementation is consistent with that. The PLT implementation of `guard' is really the part that fails to conform with R6RS, and it's all tied up with the need sometimes to tame continuations. Matthew From robby at cs.uchicago.edu Thu Jul 10 11:00:42 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:57 2009 Subject: [plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS] In-Reply-To: <20080710145610.4C70D65011A@mail-svr1.cs.utah.edu> References: <1215047813.20284.17.camel@eep> <1215081783.23549.83.camel@eep> <20080708181927.409836500EC@mail-svr1.cs.utah.edu> <1215608331.4199.108.camel@eep> <20080709131810.3C60A6500AD@mail-svr1.cs.utah.edu> <1215675392.1364.32.camel@eep> <20080710120311.D562C6500AD@mail-svr1.cs.utah.edu> <1215699790.1364.125.camel@eep> <20080710145610.4C70D65011A@mail-svr1.cs.utah.edu> Message-ID: <932b2f1f0807100800m35e4141ja40ca3090fcac984@mail.gmail.com> I think I'm missing some earlier important part of this conversation and I wonder if it could be said again for others who might be like me? Why is guard causing problems (when combined with continuable exceptions, etc)? Thanks, Robby From mflatt at cs.utah.edu Thu Jul 10 11:08:42 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:57 2009 Subject: [plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS] In-Reply-To: <932b2f1f0807100800m35e4141ja40ca3090fcac984@mail.gmail.com> References: <1215047813.20284.17.camel@eep> <1215081783.23549.83.camel@eep> <20080708181927.409836500EC@mail-svr1.cs.utah.edu> <1215608331.4199.108.camel@eep> <20080709131810.3C60A6500AD@mail-svr1.cs.utah.edu> <1215675392.1364.32.camel@eep> <20080710120311.D562C6500AD@mail-svr1.cs.utah.edu> <1215699790.1364.125.camel@eep> <20080710145610.4C70D65011A@mail-svr1.cs.utah.edu> <932b2f1f0807100800m35e4141ja40ca3090fcac984@mail.gmail.com> Message-ID: <20080710150844.E4E9D6500EC@mail-svr1.cs.utah.edu> At Thu, 10 Jul 2008 10:00:42 -0500, "Robby Findler" wrote: > I think I'm missing some earlier important part of this conversation > and I wonder if it could be said again for others who might be like > me? > > Why is guard causing problems (when combined with continuable > exceptions, etc)? Both `guard' and `with-handlers' jump out to the dynamic extent of the `guard' or `with-handlers' form to check whether they want to handle a given exception. At that point, if the right way to handle the exception was to continue without jumps, then it's too late. As specified by R6RS, `guard' will at least jump back in to try further handlers --- but that facet of `guard' isn't in our implementation. Matthew From robby at cs.uchicago.edu Thu Jul 10 11:11:41 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:57 2009 Subject: [plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS] In-Reply-To: <20080710150844.E4E9D6500EC@mail-svr1.cs.utah.edu> References: <1215047813.20284.17.camel@eep> <20080708181927.409836500EC@mail-svr1.cs.utah.edu> <1215608331.4199.108.camel@eep> <20080709131810.3C60A6500AD@mail-svr1.cs.utah.edu> <1215675392.1364.32.camel@eep> <20080710120311.D562C6500AD@mail-svr1.cs.utah.edu> <1215699790.1364.125.camel@eep> <20080710145610.4C70D65011A@mail-svr1.cs.utah.edu> <932b2f1f0807100800m35e4141ja40ca3090fcac984@mail.gmail.com> <20080710150844.E4E9D6500EC@mail-svr1.cs.utah.edu> Message-ID: <932b2f1f0807100811x21a03a31uc04b276fe90c024b@mail.gmail.com> On Thu, Jul 10, 2008 at 10:08 AM, Matthew Flatt wrote: > At Thu, 10 Jul 2008 10:00:42 -0500, "Robby Findler" wrote: >> I think I'm missing some earlier important part of this conversation >> and I wonder if it could be said again for others who might be like >> me? >> >> Why is guard causing problems (when combined with continuable >> exceptions, etc)? > > Both `guard' and `with-handlers' jump out to the dynamic extent of the > `guard' or `with-handlers' form to check whether they want to handle a > given exception. At that point, if the right way to handle the > exception was to continue without jumps, then it's too late. > > As specified by R6RS, `guard' will at least jump back in to try further > handlers --- but that facet of `guard' isn't in our implementation. Oh, right, I see. Would it be possible to have guard just not jump out, and for with-handlers to either signal an error or not handle continuable exceptions or something like that? Robby From mflatt at cs.utah.edu Thu Jul 10 11:28:05 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:57 2009 Subject: [plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS] In-Reply-To: <932b2f1f0807100811x21a03a31uc04b276fe90c024b@mail.gmail.com> References: <1215047813.20284.17.camel@eep> <20080708181927.409836500EC@mail-svr1.cs.utah.edu> <1215608331.4199.108.camel@eep> <20080709131810.3C60A6500AD@mail-svr1.cs.utah.edu> <1215675392.1364.32.camel@eep> <20080710120311.D562C6500AD@mail-svr1.cs.utah.edu> <1215699790.1364.125.camel@eep> <20080710145610.4C70D65011A@mail-svr1.cs.utah.edu> <932b2f1f0807100800m35e4141ja40ca3090fcac984@mail.gmail.com> <20080710150844.E4E9D6500EC@mail-svr1.cs.utah.edu> <932b2f1f0807100811x21a03a31uc04b276fe90c024b@mail.gmail.com> Message-ID: <20080710152807.A4CDF650115@mail-svr1.cs.utah.edu> At Thu, 10 Jul 2008 10:11:41 -0500, "Robby Findler" wrote: > On Thu, Jul 10, 2008 at 10:08 AM, Matthew Flatt wrote: > > At Thu, 10 Jul 2008 10:00:42 -0500, "Robby Findler" wrote: > >> I think I'm missing some earlier important part of this conversation > >> and I wonder if it could be said again for others who might be like > >> me? > >> > >> Why is guard causing problems (when combined with continuable > >> exceptions, etc)? > > > > Both `guard' and `with-handlers' jump out to the dynamic extent of the > > `guard' or `with-handlers' form to check whether they want to handle a > > given exception. At that point, if the right way to handle the > > exception was to continue without jumps, then it's too late. > > > > As specified by R6RS, `guard' will at least jump back in to try further > > handlers --- but that facet of `guard' isn't in our implementation. > > Oh, right, I see. > > Would it be possible to have guard just not jump out, It should jump out for the same reasons as `with-handlers', right? > and for > with-handlers to either signal an error or not handle continuable > exceptions or something like that? Yes, if you do that for `guard', too, then it avoids the problem. That's essentially un-merging the mechanisms for continuable and non-continuable exceptions (or at least un-merging them enough). Matthew From robby at cs.uchicago.edu Thu Jul 10 11:30:28 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:22:57 2009 Subject: [plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS] In-Reply-To: <20080710152807.A4CDF650115@mail-svr1.cs.utah.edu> References: <1215047813.20284.17.camel@eep> <20080709131810.3C60A6500AD@mail-svr1.cs.utah.edu> <1215675392.1364.32.camel@eep> <20080710120311.D562C6500AD@mail-svr1.cs.utah.edu> <1215699790.1364.125.camel@eep> <20080710145610.4C70D65011A@mail-svr1.cs.utah.edu> <932b2f1f0807100800m35e4141ja40ca3090fcac984@mail.gmail.com> <20080710150844.E4E9D6500EC@mail-svr1.cs.utah.edu> <932b2f1f0807100811x21a03a31uc04b276fe90c024b@mail.gmail.com> <20080710152807.A4CDF650115@mail-svr1.cs.utah.edu> Message-ID: <932b2f1f0807100830u11264753i74cee34b79d741ba@mail.gmail.com> On Thu, Jul 10, 2008 at 10:28 AM, Matthew Flatt wrote: > At Thu, 10 Jul 2008 10:11:41 -0500, "Robby Findler" wrote: >> On Thu, Jul 10, 2008 at 10:08 AM, Matthew Flatt wrote: >> > At Thu, 10 Jul 2008 10:00:42 -0500, "Robby Findler" wrote: >> >> I think I'm missing some earlier important part of this conversation >> >> and I wonder if it could be said again for others who might be like >> >> me? >> >> >> >> Why is guard causing problems (when combined with continuable >> >> exceptions, etc)? >> > >> > Both `guard' and `with-handlers' jump out to the dynamic extent of the >> > `guard' or `with-handlers' form to check whether they want to handle a >> > given exception. At that point, if the right way to handle the >> > exception was to continue without jumps, then it's too late. >> > >> > As specified by R6RS, `guard' will at least jump back in to try further >> > handlers --- but that facet of `guard' isn't in our implementation. >> >> Oh, right, I see. >> >> Would it be possible to have guard just not jump out, > > It should jump out for the same reasons as `with-handlers', right? > >> and for >> with-handlers to either signal an error or not handle continuable >> exceptions or something like that? > > Yes, if you do that for `guard', too, then it avoids the problem. > That's essentially un-merging the mechanisms for continuable and > non-continuable exceptions (or at least un-merging them enough). I think I'm proposing that the unmerging happen at the guard/with-handler level. So, if someone wants to use R6-style continuable exceptions, they should use guard and things will work as the R6 editors envisioned. If, on the other hand, they want to have their handlers invoked in the dynamic extent of the handler itself, they use with-handlers, but at the price of not having continuable exceptions. Is that a reasonable compromise? We could go further and not have with-handlers in the scheme or scheme/base language and require someone to really write an R6 program if they wanted that behavior. There is a real interop problem here, of course, that I'm not sure how to deal with. Robby From tbmcmullen at gmail.com Thu Jul 10 11:11:41 2008 From: tbmcmullen at gmail.com (Tyler McMullen) Date: Thu Mar 26 02:22:58 2009 Subject: [plt-scheme] questions about modules and keyword arguments and so on In-Reply-To: References: <562941060807091806i8a9ba8x868211cfdedd679d@mail.gmail.com> Message-ID: <562941060807100811x1a1739e6r13d3ed3888c5f356@mail.gmail.com> > > The essential error is, I think, that you're using the mzscheme > language not the scheme/base language. Use modules for *all* of your > files and start them with > > #lang scheme/base > > rather than > > (module name mzscheme ... > > and get rid of the closing ) as well. > > The keyword issue is an incompatibility between the v3 legacy language > and the v4 language and is documented in the release notes (at least, > it should be...) Excellent. I'll give that a try. Also, you don't need that eval. For a beginner you can't really go > wrong *never* using eval. I'm serious here -- experienced Schemers > very rarely use it, and beginners use it far too much. Gotcha. I realized that I was probably missing something, as the eval seemed wrong even to me. I see what I was doing wrong now though. Thanks tremendously for your help. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080710/199f6e32/attachment.html From yinso.chen at gmail.com Thu Jul 10 16:29:05 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:22:58 2009 Subject: [plt-scheme] open-output-string/bytes internals Message-ID: <779bf2730807101329l784f1088m2f859c4730738b82@mail.gmail.com> Hi - I'm wondering how `open-output-string` and `open-output-bytes` keep the data written to the port. Are the data kept in one single contiguous bytes that gets resized as more bytes are written to it, or in a list of bytes that gets concatenated later when calling `get-output-string/bytes`, or perhaps some other methods? Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080710/4d7dd832/attachment.htm From mflatt at cs.utah.edu Thu Jul 10 16:36:04 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:22:59 2009 Subject: [plt-scheme] open-output-string/bytes internals In-Reply-To: <779bf2730807101329l784f1088m2f859c4730738b82@mail.gmail.com> References: <779bf2730807101329l784f1088m2f859c4730738b82@mail.gmail.com> Message-ID: <20080710203606.4C8AF6500E1@mail-svr1.cs.utah.edu> At Thu, 10 Jul 2008 13:29:05 -0700, YC wrote: > I'm wondering how `open-output-string` and `open-output-bytes` keep the data > written to the port. Are the data kept in one single contiguous bytes that > gets resized as more bytes are written to it, Yes, using the usual strategy of doubling the buffer size when it's full. Matthew From grettke at acm.org Thu Jul 10 17:04:51 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:22:59 2009 Subject: [plt-scheme] What is the best way for folks to view macro expansions post 4.0 in module or pretty big? Message-ID: <756daca50807101404v5ea2dffcx5670f222b9eb9a31@mail.gmail.com> The macro stepper used to be present in 372, but not 4.0. I see in file:///C:/PLT-4.0.1/doc/drscheme/buttons.html#(idx._(gentag._5._(lib._scribblings/drscheme/drscheme..scrbl))) that "Beginning Student through Intermediate Student with Lambda ? starts the Stepper" and that "The Debug button ? which does not appear for the How to Design Programs teaching languages ? starts a more conventional stepping debugger." What is the best way for folks to view macro expansions post 4.0 in module or pretty big? I've been using (require macro-debugger/stepper) but I'm not sure if this is the recommended or best approach. From yinso.chen at gmail.com Thu Jul 10 17:35:57 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:22:59 2009 Subject: [plt-scheme] restart exception handling? Message-ID: <779bf2730807101435sf541a89md22409be21d5d25d@mail.gmail.com> Hi - Is it possible to handle exceptions like Common Lisp, specifically restarts? Scenario: undefined variables - handling by defining the variable, and continue past the exception. It's unclear to me how to write the following code - I assume it requires continuations and continuation-marks in the exception, but I know very little about the topic... ;; x is undefined - provide it with # and continue (with-handlers ((exn:fail:contract:variable? (lambda (e) (*use-value* (letrec ((x x)) x)))) ;; supply x with the value of undefined (eval `(display x))) ;; prints # I found in manual that exceptions are marked with barriers and may not be crossable, so not sure if the above is achievable. Any pointers are appreciated, thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080710/7e8358a9/attachment.html From cobbe at ccs.neu.edu Thu Jul 10 18:54:09 2008 From: cobbe at ccs.neu.edu (Richard Cobbe) Date: Thu Mar 26 02:23:00 2009 Subject: [plt-scheme] When is flat-named-contract necessary/useful? Message-ID: <20080710225409.GA436@angua.local> I have a question about the pragmatics of the contract system in PLT 4. I've never been completely sure exactly when `flat-named-contract' is helpful. Section 7.3.1 of the PLT Scheme Guide suggests that it helps make contract violation errors more readable, and certainly the second version of the `myaccount' module from that section does indeed produce a clearer error message when the contract on `deposit' is violated. But it doesn't look like `flat-named-contract' is necessary to get the clearer error message, as the following version of `myaccount' seems to work just as well: #lang scheme (define (amount? x) (and (number? x) (integer? x) (>= x 0))) (provide/contract [deposit (amount? . -> . any)]) (define this 0) (define (deposit a) (set! this (+ a this))) Now, the error message that you get on evaluating `(deposit -10)' in a different module says "expected " rather than "expected ". Is that the only difference? Are there other situations in which flat-named-contract gets you more than an error message without extra question marks? Perhaps more important from a practical standpoint, are there situations where writing an arrow contract (or ->*, or ->d, etc.) and providing a predicate name as a subcontract will *not* result in error messages involving the predicate's name where using a contract defined with `flat-named-contract' would? These questions are related to the question of where the contract system gets the strings it uses for the expected value in error messages. While I've never completely understood this either, we can leave the general explanation for another time. Thanks, Richard From robby at cs.uchicago.edu Thu Jul 10 18:58:17 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:23:00 2009 Subject: [plt-scheme] When is flat-named-contract necessary/useful? In-Reply-To: <20080710225409.GA436@angua.local> References: <20080710225409.GA436@angua.local> Message-ID: <932b2f1f0807101558l2cb86ceaq67e36095c19cfaa2@mail.gmail.com> When -> gets a predicate as an argument (as opposed to something that is already a contract, it calls flat-named-contract, supplying the name of the procedure if the procedure has a name. Does that answer the question? Robby On 7/10/08, Richard Cobbe wrote: > I have a question about the pragmatics of the contract system in PLT 4. > > I've never been completely sure exactly when `flat-named-contract' is > helpful. Section 7.3.1 of the PLT Scheme Guide suggests that it helps make > contract violation errors more readable, and certainly the second version > of the `myaccount' module from that section does indeed produce a clearer > error message when the contract on `deposit' is violated. > > But it doesn't look like `flat-named-contract' is necessary to get the > clearer error message, as the following version of `myaccount' seems to > work just as well: > > #lang scheme > > (define (amount? x) (and (number? x) (integer? x) (>= x 0))) > > (provide/contract > [deposit (amount? . -> . any)]) > > (define this 0) > (define (deposit a) (set! this (+ a this))) > > Now, the error message that you get on evaluating `(deposit -10)' in a > different module says "expected " rather than "expected > ". Is that the only difference? > > Are there other situations in which flat-named-contract gets you more than > an error message without extra question marks? Perhaps more important from > a practical standpoint, are there situations where writing an arrow > contract (or ->*, or ->d, etc.) and providing a predicate name as a > subcontract will *not* result in error messages involving the predicate's > name where using a contract defined with `flat-named-contract' would? > > These questions are related to the question of where the contract system > gets the strings it uses for the expected value in error messages. While > I've never completely understood this either, we can leave the general > explanation for another time. > > Thanks, > > Richard > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From cobbe at ccs.neu.edu Thu Jul 10 21:32:40 2008 From: cobbe at ccs.neu.edu (Richard Cobbe) Date: Thu Mar 26 02:23:00 2009 Subject: [plt-scheme] When is flat-named-contract necessary/useful? In-Reply-To: <932b2f1f0807101558l2cb86ceaq67e36095c19cfaa2@mail.gmail.com> References: <20080710225409.GA436@angua.local> <932b2f1f0807101558l2cb86ceaq67e36095c19cfaa2@mail.gmail.com> Message-ID: <20080711013240.GB436@angua.local> On Thu, Jul 10, 2008 at 05:58:17PM -0500, Robby Findler wrote: > When -> gets a predicate as an argument (as opposed to something that > is already a contract, it calls flat-named-contract, supplying the > name of the procedure if the procedure has a name. > > Does that answer the question? Perfectly. Thanks! Richard From eli at barzilay.org Fri Jul 11 02:30:50 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:00 2009 Subject: [plt-scheme] Re: PLT Scheme v4.0.2 In-Reply-To: <18547.26376.608067.190374@arabic.ccs.neu.edu> References: <200807050103.m6513cpp026725@winooski.ccs.neu.edu> <20080708124822.715A96500E0@mail-svr1.cs.utah.edu> <18547.26376.608067.190374@arabic.ccs.neu.edu> Message-ID: <18550.65050.304540.125526@arabic.ccs.neu.edu> On Jul 8, Eli Barzilay wrote: > > [...] So, all of this make it sound like it's better to use a > version-specific key for the start menu directory and for the > installation directory. [...] This is committed now (will apply to future releases). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From mflatt at cs.utah.edu Fri Jul 11 09:21:51 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:00 2009 Subject: [plt-scheme] restart exception handling? In-Reply-To: <779bf2730807101435sf541a89md22409be21d5d25d@mail.gmail.com> References: <779bf2730807101435sf541a89md22409be21d5d25d@mail.gmail.com> Message-ID: <20080711132153.B75986500AA@mail-svr1.cs.utah.edu> At Thu, 10 Jul 2008 14:35:57 -0700, YC wrote: > Is it possible to handle exceptions like Common Lisp, specifically > restarts? Not in general. Aside from `exn:break', built-in exceptions are raised in a non-continuable way. > Scenario: undefined variables - handling by defining the variable, and > continue past the exception. In this specific case, you could adjust the compilation of top-level variable access by defining `#%top'. Here's one way: > (define (handle-undefined exn) (abort-current-continuation (default-continuation-prompt-tag) (lambda () (letrec ([x x]) x)))) > (require (only-in scheme/base [#%top orig-top])) > (define-syntax-rule (#%top . id) (call-with-continuation-prompt (lambda () (call-with-exception-handler (orig-top . handle-undefined) (lambda () (orig-top . id)))))) > undef made-up > (define def 5) > def 5 Installing a prompt and exception handler for every top-level lookup is expensive, though --- about 50 times as expensive as a normal top-level lookup (when the variable is defined) in my test. > I found in manual that exceptions are marked with barriers and may not be > crossable, so not sure if the above is achievable. That's not quite the problem. It's more that the exception handler is required to escape, and also that the exception for an undefined variable doesn't provide a place to escape back to. Matthew From mflatt at cs.utah.edu Fri Jul 11 09:28:06 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:00 2009 Subject: [plt-scheme] phase question In-Reply-To: <003401c8e299$76f34ff0$2101a8c0@uw2b2dff239c4d> References: <003401c8e299$76f34ff0$2101a8c0@uw2b2dff239c4d> Message-ID: <20080711132808.09C146500BE@mail-svr1.cs.utah.edu> At Thu, 10 Jul 2008 16:30:12 +0200, "Jos Koot" wrote: > (define-syntax (declare-tag stx) > (syntax-case stx () > ((_ tag) > (begin (register-tag #'tag) #'(void))))) Change the last line above to #'(begin-for-syntax (register-tag #'tag))))) See also section 3 of http://www.cs.utah.edu/plt/publications/macromod.pdf Matthew From jos.koot at telefonica.net Fri Jul 11 09:54:43 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:01 2009 Subject: [plt-scheme] phase question References: <003401c8e299$76f34ff0$2101a8c0@uw2b2dff239c4d> <20080711132808.09C146500BE@mail-svr1.cs.utah.edu> Message-ID: <000401c8e35d$ac4beda0$2101a8c0@uw2b2dff239c4d> I found the same solution just a few moments ago. :) It took me a couple of hours though. ): Nevertheless many thanks, (: Jos ----- Original Message ----- From: "Matthew Flatt" To: "Jos Koot" Cc: Sent: Friday, July 11, 2008 3:28 PM Subject: Re: [plt-scheme] phase question > At Thu, 10 Jul 2008 16:30:12 +0200, "Jos Koot" wrote: >> (define-syntax (declare-tag stx) >> (syntax-case stx () >> ((_ tag) >> (begin (register-tag #'tag) #'(void))))) > > Change the last line above to > > #'(begin-for-syntax (register-tag #'tag))))) > > > See also section 3 of > http://www.cs.utah.edu/plt/publications/macromod.pdf > > > Matthew > From derick.eddington at gmail.com Fri Jul 11 10:13:15 2008 From: derick.eddington at gmail.com (Derick Eddington) Date: Thu Mar 26 02:23:01 2009 Subject: [plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS] In-Reply-To: <932b2f1f0807100742w4fd89542w2e3b30c59b1b1467@mail.gmail.com> References: <1215047813.20284.17.camel@eep> <1215081783.23549.83.camel@eep> <20080708181927.409836500EC@mail-svr1.cs.utah.edu> <1215608331.4199.108.camel@eep> <20080709131810.3C60A6500AD@mail-svr1.cs.utah.edu> <1215675392.1364.32.camel@eep> <20080710120311.D562C6500AD@mail-svr1.cs.utah.edu> <1215699790.1364.125.camel@eep> <932b2f1f0807100742w4fd89542w2e3b30c59b1b1467@mail.gmail.com> Message-ID: <1215785595.21725.44.camel@eep> On Thu, 2008-07-10 at 09:42 -0500, Robby Findler wrote: > The operational semantics of R6 indicates that there is no > exit/re-enter for raise-continuable (altho it only covers > with-exception-handler, raise and raise-continuable, not guard). OK, good. (But I wish guard was covered). Thanks. I don't know operational semantics language yet :) -- : Derick ---------------------------------------------------------------- From aleks at cs.brown.edu Fri Jul 11 10:17:34 2008 From: aleks at cs.brown.edu (Aleks Bromfield) Date: Thu Mar 26 02:23:01 2009 Subject: [plt-scheme] Re: PLT Scheme v4.0.2 In-Reply-To: <18550.65050.304540.125526@arabic.ccs.neu.edu> References: <200807050103.m6513cpp026725@winooski.ccs.neu.edu> <20080708124822.715A96500E0@mail-svr1.cs.utah.edu> <18547.26376.608067.190374@arabic.ccs.neu.edu> <18550.65050.304540.125526@arabic.ccs.neu.edu> Message-ID: <20080711141734.GA30618@cs.brown.edu> On Fri, Jul 11, 2008 at 02:30:50AM -0400, Eli Barzilay wrote: > On Jul 8, Eli Barzilay wrote: > > > > [...] So, all of this make it sound like it's better to use a > > version-specific key for the start menu directory and for the > > installation directory. [...] > > This is committed now (will apply to future releases). Will the installer still uninstall old versions? ~ Aleks From robby at cs.uchicago.edu Fri Jul 11 10:18:53 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:23:01 2009 Subject: [plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS] In-Reply-To: <1215785595.21725.44.camel@eep> References: <1215047813.20284.17.camel@eep> <1215081783.23549.83.camel@eep> <20080708181927.409836500EC@mail-svr1.cs.utah.edu> <1215608331.4199.108.camel@eep> <20080709131810.3C60A6500AD@mail-svr1.cs.utah.edu> <1215675392.1364.32.camel@eep> <20080710120311.D562C6500AD@mail-svr1.cs.utah.edu> <1215699790.1364.125.camel@eep> <932b2f1f0807100742w4fd89542w2e3b30c59b1b1467@mail.gmail.com> <1215785595.21725.44.camel@eep> Message-ID: <932b2f1f0807110718i23ea31d2w791c8fcdace51b2e@mail.gmail.com> On Fri, Jul 11, 2008 at 9:13 AM, Derick Eddington wrote: > On Thu, 2008-07-10 at 09:42 -0500, Robby Findler wrote: >> The operational semantics of R6 indicates that there is no >> exit/re-enter for raise-continuable (altho it only covers >> with-exception-handler, raise and raise-continuable, not guard). > > OK, good. (But I wish guard was covered). Thanks. I don't know > operational semantics language yet :) The operational semantics is designed (as much as I possibly could) to be accessible to programmers. It is just is a bunch of rewrites like "if you have a program that matches this pattern, then after a single step of computation, it will look like this other pattern". Also, to help, the semantics is executable, so you can play with traces of the semantics to see what happens for interesting (small) examples. If you do give it a try and have questions, don't hesitate to ask. The code is at www.r6rs.org. Robby From derick.eddington at gmail.com Fri Jul 11 10:21:49 2008 From: derick.eddington at gmail.com (Derick Eddington) Date: Thu Mar 26 02:23:01 2009 Subject: [plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS] In-Reply-To: <20080710145610.4C70D65011A@mail-svr1.cs.utah.edu> References: <1215047813.20284.17.camel@eep> <1215081783.23549.83.camel@eep> <20080708181927.409836500EC@mail-svr1.cs.utah.edu> <1215608331.4199.108.camel@eep> <20080709131810.3C60A6500AD@mail-svr1.cs.utah.edu> <1215675392.1364.32.camel@eep> <20080710120311.D562C6500AD@mail-svr1.cs.utah.edu> <1215699790.1364.125.camel@eep> <20080710145610.4C70D65011A@mail-svr1.cs.utah.edu> Message-ID: <1215786109.21725.52.camel@eep> On Thu, 2008-07-10 at 08:56 -0600, Matthew Flatt wrote: > At Thu, 10 Jul 2008 07:23:09 -0700, Derick Eddington wrote: > > On Thu, 2008-07-10 at 06:02 -0600, Matthew Flatt wrote: > > > Turning the above around, if a library captures and restores > > > continuations, then it's placing an extra burden on users of the > > > library to accommodate continuation jumps. That sounds like a big price > > > to pay to get warnings from SSAX --- but perhaps I'm not enough of an > > > SSAX user to say. If SSAX users understand that functions capture and > > > restore continuations anytime that they might report a warning, and if > > > they're happy with that API, then it's all fine. > > > > I agree that would be a big price, too big and too unexpected of a > > price. Now I think I realize there's another issue you are considering > > that I was not: in PLT at the moment, `raise-continuable' is capturing > > its continuation which gets restored if the handler returns, and this is > > why my `ssax:warn' would be capturing and restoring continuations. > > No. Even in the PLT implementation, the problems start when someone > uses `guard' or `with-handlers' to catch exceptions. > > > (raise obj) procedure [...] > > (raise-continuable obj) procedure [....] > > > > Maybe I'm reading into this too much thinking it means the dynamic > > extent will not be exited and re-entered. > > That's my reading, too, and the PLT implementation is consistent with > that. Thanks for clearing that up. ? > > ?(unless `guard' handlers which ?re-raise are involved, but > > that's an argument against using `guard' I think, not against using > > continuable exceptions). > > I agree that the problem is with the combination of continuable > exceptions, `guard' or `with-handlers', and `dynamic-wind'. Maybe the > question amounts to deciding whether continuable exceptions or > `guard'/`with-handlers' is the right model for exceptions. > > As you may have detected, I'm skeptical of continuable exceptions --- > or at least with merging into the system for non-continuable > exceptions. This is the first time I've used continuable exceptions. It seems like a pretty cool thing to be able to use the exception system to signal a warning (an exceptional situation) and let interested users install a handler so they can interpret the warning and decide if they want to allow the program to continue, or by default it will continue because it's non-&serious. Otherwise it seems you've got to invent some other separate warning/non-serious signaling system. And similarly, you can use continuable exceptions for &serious conditions, and if they're not handled by a user-installed handler which returns, the program will be stopped by default. But combining with `guard' re-raising does look incompatible. -- : Derick ---------------------------------------------------------------- From derick.eddington at gmail.com Fri Jul 11 10:42:16 2008 From: derick.eddington at gmail.com (Derick Eddington) Date: Thu Mar 26 02:23:01 2009 Subject: [plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS] In-Reply-To: <20080710152807.A4CDF650115@mail-svr1.cs.utah.edu> References: <1215047813.20284.17.camel@eep> <20080708181927.409836500EC@mail-svr1.cs.utah.edu> <1215608331.4199.108.camel@eep> <20080709131810.3C60A6500AD@mail-svr1.cs.utah.edu> <1215675392.1364.32.camel@eep> <20080710120311.D562C6500AD@mail-svr1.cs.utah.edu> <1215699790.1364.125.camel@eep> <20080710145610.4C70D65011A@mail-svr1.cs.utah.edu> <932b2f1f0807100800m35e4141ja40ca3090fcac984@mail.gmail.com> <20080710150844.E4E9D6500EC@mail-svr1.cs.utah.edu> <932b2f1f0807100811x21a03a31uc04b276fe90c024b@mail.gmail.com> <20080710152807.A4CDF650115@mail-svr1.cs.utah.edu> Message-ID: <1215787336.21725.69.camel@eep> On Thu, 2008-07-10 at 09:28 -0600, Matthew Flatt wrote: > At Thu, 10 Jul 2008 10:11:41 -0500, "Robby Findler" wrote: > > On Thu, Jul 10, 2008 at 10:08 AM, Matthew Flatt wrote: > > > At Thu, 10 Jul 2008 10:00:42 -0500, "Robby Findler" wrote: > > >> I think I'm missing some earlier important part of this conversation > > >> and I wonder if it could be said again for others who might be like > > >> me? > > >> > > >> Why is guard causing problems (when combined with continuable > > >> exceptions, etc)? > > > > > > Both `guard' and `with-handlers' jump out to the dynamic extent of the > > > `guard' or `with-handlers' form to check whether they want to handle a > > > given exception. At that point, if the right way to handle the > > > exception was to continue without jumps, then it's too late. > > > > > > As specified by R6RS, `guard' will at least jump back in to try further > > > handlers --- but that facet of `guard' isn't in our implementation. > > > > Oh, right, I see. > > > > Would it be possible to have guard just not jump out, > > It should jump out for the same reasons as `with-handlers', right? What are those reasons? I've never known. It's seemed bad to me that every nested `guard' jumps out and back in for every re-raise because that will screw with dynamic-wind befores and afters. (My understanding is that `with-handlers' never jumps back in and doesn't allow continuing.) > > > and for > > with-handlers to either signal an error or not handle continuable > > exceptions or something like that? > > Yes, if you do that for `guard', too, then it avoids the problem. > That's essentially un-merging the mechanisms for continuable and > non-continuable exceptions (or at least un-merging them enough). Since `guard' is described in the R6RS as re-raising using `raise', it's not possible for the next handler to return to the original `raise-continuable'. I've been wondering if this was a mistake and not the intent of the R6RS because it looks like the description of `guard' was copied from SRFI-34, and SRFI-34 does not have `raise-continuable' nor the notion of continuable exceptions, but maybe re-raising possibly continuable exceptions using `raise' is intentional so that `guard' prevents continuing back to the original `raise-continuable' since `guard' has screwed with the dynamic-wind befores and afters? But it's still screwed with them, which just seems bad... -- : Derick ---------------------------------------------------------------- From robby at cs.uchicago.edu Fri Jul 11 10:49:02 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:23:02 2009 Subject: [plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS] In-Reply-To: <1215787336.21725.69.camel@eep> References: <1215047813.20284.17.camel@eep> <1215675392.1364.32.camel@eep> <20080710120311.D562C6500AD@mail-svr1.cs.utah.edu> <1215699790.1364.125.camel@eep> <20080710145610.4C70D65011A@mail-svr1.cs.utah.edu> <932b2f1f0807100800m35e4141ja40ca3090fcac984@mail.gmail.com> <20080710150844.E4E9D6500EC@mail-svr1.cs.utah.edu> <932b2f1f0807100811x21a03a31uc04b276fe90c024b@mail.gmail.com> <20080710152807.A4CDF650115@mail-svr1.cs.utah.edu> <1215787336.21725.69.camel@eep> Message-ID: <932b2f1f0807110749r2c0ccf79q4a067b3dce5cf472@mail.gmail.com> On Fri, Jul 11, 2008 at 9:42 AM, Derick Eddington wrote: >> > Would it be possible to have guard just not jump out, >> >> It should jump out for the same reasons as `with-handlers', right? > > What are those reasons? I've never known. One reason is that loops that involve a with-handlers won't be tail-recursive (unless you jump out yourself in the handler of course). Something like this: (define (keep-trying) (with-handlers ([whatever? (lambda () ... (keep-trying))]) ...)) Robby From pltscheme at pnkfx.org Fri Jul 11 10:59:40 2008 From: pltscheme at pnkfx.org (Felix Klock's PLT scheme proxy) Date: Thu Mar 26 02:23:02 2009 Subject: [plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS] In-Reply-To: <932b2f1f0807110749r2c0ccf79q4a067b3dce5cf472@mail.gmail.com> References: <1215047813.20284.17.camel@eep> <1215675392.1364.32.camel@eep> <20080710120311.D562C6500AD@mail-svr1.cs.utah.edu> <1215699790.1364.125.camel@eep> <20080710145610.4C70D65011A@mail-svr1.cs.utah.edu> <932b2f1f0807100800m35e4141ja40ca3090fcac984@mail.gmail.com> <20080710150844.E4E9D6500EC@mail-svr1.cs.utah.edu> <932b2f1f0807100811x21a03a31uc04b276fe90c024b@mail.gmail.com> <20080710152807.A4CDF650115@mail-svr1.cs.utah.edu> <1215787336.21725.69.camel@eep> <932b2f1f0807110749r2c0ccf79q4a067b3dce5cf472@mail.gmail.com> Message-ID: <7209D6E0-A65E-47C5-997C-645EC8F0ACE2@pnkfx.org> Robby (cc'ing plt-scheme and the rest of the people involved in the discussion)- On Jul 11, 2008, at 10:49 AM, Robby Findler wrote: > On Fri, Jul 11, 2008 at 9:42 AM, Derick Eddington > wrote: >>>> Would it be possible to have guard just not jump out, >>> >>> It should jump out for the same reasons as `with-handlers', right? >> >> What are those reasons? I've never known. > > One reason is that loops that involve a with-handlers won't be > tail-recursive (unless you jump out yourself in the handler of > course). > > Something like this: > > (define (keep-trying) > (with-handlers ([whatever? (lambda () ... (keep-trying))]) > ...)) That example seems like it justifies jumping out before the evaluation of the ... of each of the guard But does it justify such jumping before the evaluation of the of each of the guard? I would think the expression would be the point of interest when it comes to continuable exceptions... (The only justification I have been able to come up for jumping out before each with is that if there are side-effects to things like (current-output-port) in the , it is easier to reason about them if they are set according to the dynamic environment of the whole guard expression. But I am not yet convinced that this benefit is worth the paying the cost of the jump...) -Felix From mflatt at cs.utah.edu Fri Jul 11 11:14:03 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:02 2009 Subject: [plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS] In-Reply-To: <932b2f1f0807110749r2c0ccf79q4a067b3dce5cf472@mail.gmail.com> References: <1215047813.20284.17.camel@eep> <1215675392.1364.32.camel@eep> <20080710120311.D562C6500AD@mail-svr1.cs.utah.edu> <1215699790.1364.125.camel@eep> <20080710145610.4C70D65011A@mail-svr1.cs.utah.edu> <932b2f1f0807100800m35e4141ja40ca3090fcac984@mail.gmail.com> <20080710150844.E4E9D6500EC@mail-svr1.cs.utah.edu> <932b2f1f0807100811x21a03a31uc04b276fe90c024b@mail.gmail.com> <20080710152807.A4CDF650115@mail-svr1.cs.utah.edu> <1215787336.21725.69.camel@eep> <932b2f1f0807110749r2c0ccf79q4a067b3dce5cf472@mail.gmail.com> Message-ID: <20080711151405.64B756500DD@mail-svr1.cs.utah.edu> At Fri, 11 Jul 2008 09:49:02 -0500, "Robby Findler" wrote: > On Fri, Jul 11, 2008 at 9:42 AM, Derick Eddington > wrote: > >> > Would it be possible to have guard just not jump out, > >> > >> It should jump out for the same reasons as `with-handlers', right? > > > > What are those reasons? I've never known. > > One reason is that loops that involve a with-handlers won't be > tail-recursive (unless you jump out yourself in the handler of > course). > > Something like this: > > (define (keep-trying) > (with-handlers ([whatever? (lambda () ... (keep-trying))]) > ...)) Actually, that's not a loop. It would be if you switch to `with-handlers*', though. The reason to jump out before running the handler is to restore the dynamic context of the `with-handlers' or `guard' form. That is, you have not only the continuation of the `with-handlers'/`guard' form (to which the handler typically delivers a value), but also the same dynamic configuration, including I/O ports and (in PLT Scheme) many other parameters (current custodian, inspector, etc.). This makes it work very much like `try ... catch' in Java and other languages. Matthew From mflatt at cs.utah.edu Fri Jul 11 11:16:52 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:02 2009 Subject: [plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS] In-Reply-To: <7209D6E0-A65E-47C5-997C-645EC8F0ACE2@pnkfx.org> References: <1215047813.20284.17.camel@eep> <1215675392.1364.32.camel@eep> <20080710120311.D562C6500AD@mail-svr1.cs.utah.edu> <1215699790.1364.125.camel@eep> <20080710145610.4C70D65011A@mail-svr1.cs.utah.edu> <932b2f1f0807100800m35e4141ja40ca3090fcac984@mail.gmail.com> <20080710150844.E4E9D6500EC@mail-svr1.cs.utah.edu> <932b2f1f0807100811x21a03a31uc04b276fe90c024b@mail.gmail.com> <20080710152807.A4CDF650115@mail-svr1.cs.utah.edu> <1215787336.21725.69.camel@eep> <932b2f1f0807110749r2c0ccf79q4a067b3dce5cf472@mail.gmail.com> <7209D6E0-A65E-47C5-997C-645EC8F0ACE2@pnkfx.org> Message-ID: <20080711151654.996636500D4@mail-svr1.cs.utah.edu> At Fri, 11 Jul 2008 10:59:40 -0400, Felix Klock's PLT scheme proxy wrote: > Robby (cc'ing plt-scheme and the rest of the people involved in the > discussion)- > > On Jul 11, 2008, at 10:49 AM, Robby Findler wrote: > > > On Fri, Jul 11, 2008 at 9:42 AM, Derick Eddington > > wrote: > >>>> Would it be possible to have guard just not jump out, > >>> > >>> It should jump out for the same reasons as `with-handlers', right? > >> > >> What are those reasons? I've never known. > > > > One reason is that loops that involve a with-handlers won't be > > tail-recursive (unless you jump out yourself in the handler of > > course). > > > > Something like this: > > > > (define (keep-trying) > > (with-handlers ([whatever? (lambda () ... (keep-trying))]) > > ...)) > > That example seems like it justifies jumping out before the evaluation > of the ... of each of the guard > > But does it justify such jumping before the evaluation of the > of each of the guard? > > I would think the expression would be the point of interest > when it comes to continuable exceptions... I wish I could remember more on this one. I think we tried, early on, evaluating tests in the continuation of the raise, but we abandoned that possibility. Maybe it was just that we gave up on using the same mechanism for continuable and non-continuable exceptions, and so it seemed simpler and more consistent (in the way you suggest) to jump out for the tests, too. Or maybe there was a more direct reason, but I don't remember it. Matthew From samth at ccs.neu.edu Fri Jul 11 11:25:13 2008 From: samth at ccs.neu.edu (Sam TH) Date: Thu Mar 26 02:23:02 2009 Subject: [plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS] In-Reply-To: <20080711151654.996636500D4@mail-svr1.cs.utah.edu> References: <1215047813.20284.17.camel@eep> <20080710145610.4C70D65011A@mail-svr1.cs.utah.edu> <932b2f1f0807100800m35e4141ja40ca3090fcac984@mail.gmail.com> <20080710150844.E4E9D6500EC@mail-svr1.cs.utah.edu> <932b2f1f0807100811x21a03a31uc04b276fe90c024b@mail.gmail.com> <20080710152807.A4CDF650115@mail-svr1.cs.utah.edu> <1215787336.21725.69.camel@eep> <932b2f1f0807110749r2c0ccf79q4a067b3dce5cf472@mail.gmail.com> <7209D6E0-A65E-47C5-997C-645EC8F0ACE2@pnkfx.org> <20080711151654.996636500D4@mail-svr1.cs.utah.edu> Message-ID: <63bb19ae0807110825y3f43f3e8s4e1ef6d94e940341@mail.gmail.com> On Fri, Jul 11, 2008 at 11:16 AM, Matthew Flatt wrote: > At Fri, 11 Jul 2008 10:59:40 -0400, Felix Klock's PLT scheme proxy wrote: >> Robby (cc'ing plt-scheme and the rest of the people involved in the >> discussion)- >> >> On Jul 11, 2008, at 10:49 AM, Robby Findler wrote: >> >> > On Fri, Jul 11, 2008 at 9:42 AM, Derick Eddington >> > wrote: >> >>>> Would it be possible to have guard just not jump out, >> >>> >> >>> It should jump out for the same reasons as `with-handlers', right? >> >> >> >> What are those reasons? I've never known. >> > >> > One reason is that loops that involve a with-handlers won't be >> > tail-recursive (unless you jump out yourself in the handler of >> > course). >> > >> > Something like this: >> > >> > (define (keep-trying) >> > (with-handlers ([whatever? (lambda () ... (keep-trying))]) >> > ...)) >> >> That example seems like it justifies jumping out before the evaluation >> of the ... of each of the guard >> >> But does it justify such jumping before the evaluation of the >> of each of the guard? >> >> I would think the expression would be the point of interest >> when it comes to continuable exceptions... > > I wish I could remember more on this one. I think we tried, early on, > evaluating tests in the continuation of the raise, but we abandoned > that possibility. Maybe it was just that we gave up on using the same > mechanism for continuable and non-continuable exceptions, and so it > seemed simpler and more consistent (in the way you suggest) to jump out > for the tests, too. Or maybe there was a more direct reason, but I > don't remember it. By 'we' in this description, do you mean the PLT Scheme developers, or the R6RS editors? Thanks, -- sam th samth@ccs.neu.edu From robby at cs.uchicago.edu Fri Jul 11 11:25:42 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:23:02 2009 Subject: [plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS] In-Reply-To: <20080711151654.996636500D4@mail-svr1.cs.utah.edu> References: <1215047813.20284.17.camel@eep> <20080710145610.4C70D65011A@mail-svr1.cs.utah.edu> <932b2f1f0807100800m35e4141ja40ca3090fcac984@mail.gmail.com> <20080710150844.E4E9D6500EC@mail-svr1.cs.utah.edu> <932b2f1f0807100811x21a03a31uc04b276fe90c024b@mail.gmail.com> <20080710152807.A4CDF650115@mail-svr1.cs.utah.edu> <1215787336.21725.69.camel@eep> <932b2f1f0807110749r2c0ccf79q4a067b3dce5cf472@mail.gmail.com> <7209D6E0-A65E-47C5-997C-645EC8F0ACE2@pnkfx.org> <20080711151654.996636500D4@mail-svr1.cs.utah.edu> Message-ID: <932b2f1f0807110825r55fc7d02y6c7239e2aeaee858@mail.gmail.com> Yes, me too. I remember we abandoned it pretty quickly, but I can't recall the specific examples either. Robby On Fri, Jul 11, 2008 at 10:16 AM, Matthew Flatt wrote: > I wish I could remember more on this one. I think we tried, early on, > evaluating tests in the continuation of the raise, but we abandoned > that possibility. Maybe it was just that we gave up on using the same > mechanism for continuable and non-continuable exceptions, and so it > seemed simpler and more consistent (in the way you suggest) to jump out > for the tests, too. Or maybe there was a more direct reason, but I > don't remember it. > > Matthew > > > From robby at cs.uchicago.edu Fri Jul 11 11:26:17 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:23:03 2009 Subject: [plt-scheme] R6RS exception handling and dynamic extent [was: SXML for R6RS] In-Reply-To: <63bb19ae0807110825y3f43f3e8s4e1ef6d94e940341@mail.gmail.com> References: <1215047813.20284.17.camel@eep> <932b2f1f0807100800m35e4141ja40ca3090fcac984@mail.gmail.com> <20080710150844.E4E9D6500EC@mail-svr1.cs.utah.edu> <932b2f1f0807100811x21a03a31uc04b276fe90c024b@mail.gmail.com> <20080710152807.A4CDF650115@mail-svr1.cs.utah.edu> <1215787336.21725.69.camel@eep> <932b2f1f0807110749r2c0ccf79q4a067b3dce5cf472@mail.gmail.com> <7209D6E0-A65E-47C5-997C-645EC8F0ACE2@pnkfx.org> <20080711151654.996636500D4@mail-svr1.cs.utah.edu> <63bb19ae0807110825y3f43f3e8s4e1ef6d94e940341@mail.gmail.com> Message-ID: <932b2f1f0807110826v4f25261difed4fb36ced7b6f1@mail.gmail.com> I recall going over this with Matthew a very long time ago, but I don't recall if anyone else was involved in the conversation. Matthias, maybe. Robby On Fri, Jul 11, 2008 at 10:25 AM, Sam TH wrote: > On Fri, Jul 11, 2008 at 11:16 AM, Matthew Flatt wrote: >> At Fri, 11 Jul 2008 10:59:40 -0400, Felix Klock's PLT scheme proxy wrote: >>> Robby (cc'ing plt-scheme and the rest of the people involved in the >>> discussion)- >>> >>> On Jul 11, 2008, at 10:49 AM, Robby Findler wrote: >>> >>> > On Fri, Jul 11, 2008 at 9:42 AM, Derick Eddington >>> > wrote: >>> >>>> Would it be possible to have guard just not jump out, >>> >>> >>> >>> It should jump out for the same reasons as `with-handlers', right? >>> >> >>> >> What are those reasons? I've never known. >>> > >>> > One reason is that loops that involve a with-handlers won't be >>> > tail-recursive (unless you jump out yourself in the handler of >>> > course). >>> > >>> > Something like this: >>> > >>> > (define (keep-trying) >>> > (with-handlers ([whatever? (lambda () ... (keep-trying))]) >>> > ...)) >>> >>> That example seems like it justifies jumping out before the evaluation >>> of the ... of each of the guard >>> >>> But does it justify such jumping before the evaluation of the >>> of each of the guard? >>> >>> I would think the expression would be the point of interest >>> when it comes to continuable exceptions... >> >> I wish I could remember more on this one. I think we tried, early on, >> evaluating tests in the continuation of the raise, but we abandoned >> that possibility. Maybe it was just that we gave up on using the same >> mechanism for continuable and non-continuable exceptions, and so it >> seemed simpler and more consistent (in the way you suggest) to jump out >> for the tests, too. Or maybe there was a more direct reason, but I >> don't remember it. > > By 'we' in this description, do you mean the PLT Scheme developers, or > the R6RS editors? > > Thanks, > -- > sam th > samth@ccs.neu.edu > > From eli at barzilay.org Fri Jul 11 15:18:33 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:03 2009 Subject: [plt-scheme] Re: PLT Scheme v4.0.2 In-Reply-To: <20080711141734.GA30618@cs.brown.edu> References: <200807050103.m6513cpp026725@winooski.ccs.neu.edu> <20080708124822.715A96500E0@mail-svr1.cs.utah.edu> <18547.26376.608067.190374@arabic.ccs.neu.edu> <18550.65050.304540.125526@arabic.ccs.neu.edu> <20080711141734.GA30618@cs.brown.edu> Message-ID: <18551.45577.871359.567486@arabic.ccs.neu.edu> On Jul 11, Aleks Bromfield wrote: > On Fri, Jul 11, 2008 at 02:30:50AM -0400, Eli Barzilay wrote: > > On Jul 8, Eli Barzilay wrote: > > > > > > [...] So, all of this make it sound like it's better to use a > > > version-specific key for the start menu directory and for the > > > installation directory. [...] > > > > This is committed now (will apply to future releases). > > Will the installer still uninstall old versions? Yes, if you try to install the new version where it finds an uninstaller (which is the default case for releases: "Program Files\PLT") it will suggest running it. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From yinso.chen at gmail.com Fri Jul 11 17:18:21 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:23:04 2009 Subject: [plt-scheme] restart exception handling? In-Reply-To: <20080711132153.B75986500AA@mail-svr1.cs.utah.edu> References: <779bf2730807101435sf541a89md22409be21d5d25d@mail.gmail.com> <20080711132153.B75986500AA@mail-svr1.cs.utah.edu> Message-ID: <779bf2730807111418h1a04a50eqc11c715b2650e5f1@mail.gmail.com> On Fri, Jul 11, 2008 at 6:21 AM, Matthew Flatt wrote: > Not in general. Aside from `exn:break', built-in exceptions are raised > in a non-continuable way. > Just curious - what are the main reasons behind the exception design to make them non-continuable by default? Is it due to performance or that continuations shouldn't be used at low level exceptions? (is contination the basis for flow controls as scheme generally advertises?) In this specific case, you could adjust the compilation of top-level > variable access by defining `#%top'. Here's one way: > > > (define (handle-undefined exn) > (abort-current-continuation > (default-continuation-prompt-tag) > (lambda () (letrec ([x x]) x)))) > > (require (only-in scheme/base [#%top orig-top])) > > (define-syntax-rule (#%top . id) > (call-with-continuation-prompt > (lambda () > (call-with-exception-handler > (orig-top . handle-undefined) > (lambda () (orig-top . id)))))) > > undef > made-up > > (define def 5) > > def > 5 > > Installing a prompt and exception handler for every top-level lookup is > expensive, though --- about 50 times as expensive as a normal top-level > lookup (when the variable is defined) in my test. > This is an interesting technique - thanks for sharing. The cost is certainly a concern if every lookup pays for it. That's not quite the problem. It's more that the exception handler is > required to escape, and also that the exception for an undefined > variable doesn't provide a place to escape back to. > So what are the contination-marks used for? I thought they can be used for invoking continuations. The related concepts (prompts, continuation, escape, etc) continues to escape me even with the manual. If there are some links or pointers on how they are all related and used - it's much appreciated. Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080711/3dc5491a/attachment.htm From wookiz at hotmail.com Sat Jul 12 09:44:31 2008 From: wookiz at hotmail.com (wooks) Date: Thu Mar 26 02:23:04 2009 Subject: [plt-scheme] boolean operators on integers Message-ID: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> > (and 1 0) 0 > (and 0 1) 1 > (and 1 0 0) 0 > (and 0 0 1) 1 > (and 0 1 0) 0 > (and 0 1 1) 1 Seems like and is just returning the value of the last argument. The integers 0 and 1 are supposed (for my purposes ) to be boolean flags true and false so this is not the behaviour that I want. Using language Pretty Big. From robby at cs.uchicago.edu Sat Jul 12 09:49:01 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:23:04 2009 Subject: [plt-scheme] boolean operators on integers In-Reply-To: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> References: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> Message-ID: <932b2f1f0807120649s306a16a9o7afbd0823c1059c5@mail.gmail.com> If that's not what you want, you'll need to use a different operator... You could, in some place just convert numebrs to booleans, eg: (lambda (x) (not (= x 0))) is a function that does that conversion. Or you could define (straightforward) macros that were analogs of and/or/etc but that operated on numbers. They would just insert the above coercion into the arguments to the original and/or/etc. Robby On Sat, Jul 12, 2008 at 8:44 AM, wooks wrote: >> (and 1 0) > 0 >> (and 0 1) > 1 > >> (and 1 0 0) > 0 >> (and 0 0 1) > 1 >> (and 0 1 0) > 0 >> (and 0 1 1) > 1 > > Seems like and is just returning the value of the last argument. > > The integers 0 and 1 are supposed (for my purposes ) to be boolean > flags true and false so this is not the behaviour that I want. > > Using language Pretty Big. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From sk at cs.brown.edu Sat Jul 12 09:53:37 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:23:04 2009 Subject: [plt-scheme] boolean operators on integers In-Reply-To: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> References: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> Message-ID: 1. In Scheme, 0 and 1 are both true values. Neither of them is false. In Scheme, only one value is false: #f, or false. 2. In Scheme, AND returns the value of the last expression so long as it isn't false. You're seeing the combination of these two behaviors. Why are you using 0 instead of #f/false to represent a false value? Or is it that 0 represents falsity in your domain, and you need to map it to false? If so, use the code Robby sent. Shriram From wookiz at hotmail.com Sat Jul 12 10:01:13 2008 From: wookiz at hotmail.com (wooks) Date: Thu Mar 26 02:23:04 2009 Subject: [plt-scheme] Re: boolean operators on integers In-Reply-To: References: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> Message-ID: <75c61fe0-b392-4bcd-a456-1e1530d9c1d4@a1g2000hsb.googlegroups.com> On Jul 12, 8:53 am, "Shriram Krishnamurthi" wrote: > 1. In Scheme, 0 and 1 are both true values. Neither of them is false. > In Scheme, only one value is false: #f, or false. > > 2. In Scheme, AND returns the value of the last expression so long as > it isn't false. > > You're seeing the combination of these two behaviors. > > Why are you using 0 instead of #f/false to represent a false value? because a) my function has several of these boolean type arguments b) 0 has fewer characters than #f and false c) I thought it would work there - stupid but honest. > Or is it that 0 represents falsity in your domain, and you need to map > it to false? If so, use the code Robby sent. > ok.... and I learnt interesting useful along the way. From sk at cs.brown.edu Sat Jul 12 10:03:23 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:23:05 2009 Subject: [plt-scheme] Re: boolean operators on integers In-Reply-To: <75c61fe0-b392-4bcd-a456-1e1530d9c1d4@a1g2000hsb.googlegroups.com> References: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> <75c61fe0-b392-4bcd-a456-1e1530d9c1d4@a1g2000hsb.googlegroups.com> Message-ID: Thanks for your honesty. Please just type #f instead and all will be well in your world. Think of the extra typing as your punishment for trying to abuse numbers. On Sat, Jul 12, 2008 at 10:01 AM, wooks wrote: > > > On Jul 12, 8:53 am, "Shriram Krishnamurthi" wrote: >> 1. In Scheme, 0 and 1 are both true values. Neither of them is false. >> In Scheme, only one value is false: #f, or false. >> >> 2. In Scheme, AND returns the value of the last expression so long as >> it isn't false. >> >> You're seeing the combination of these two behaviors. >> >> Why are you using 0 instead of #f/false to represent a false value? > > because > a) my function has several of these boolean type arguments > b) 0 has fewer characters than #f and false > c) I thought it would work > > there - stupid but honest. > >> Or is it that 0 represents falsity in your domain, and you need to map >> it to false? If so, use the code Robby sent. >> > > ok.... and I learnt interesting useful along the way. > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jensaxel at soegaard.net Sat Jul 12 10:04:14 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:23:05 2009 Subject: [plt-scheme] boolean operators on integers In-Reply-To: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> References: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> Message-ID: <4878B9DE.5050509@soegaard.net> wooks wrote: > Seems like and is just returning the value of the last argument. > > The integers 0 and 1 are supposed (for my purposes ) to be boolean > flags true and false so this is not the behaviour that I want. > In Scheme all values except #f is considered to be true values. Thus both 0 and 1 are interpreted by and as being true. Hence (and 0 1) gives true. What you need are the bitwise operations, which operate on the bit level. > (bitwise-and 1 1) 1 > (bitwise-and 1 0) 0 -- Jens Axel S?gaard From wookiz at hotmail.com Sat Jul 12 10:16:15 2008 From: wookiz at hotmail.com (wooks) Date: Thu Mar 26 02:23:05 2009 Subject: [plt-scheme] Re: boolean operators on integers In-Reply-To: References: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> Message-ID: <5fac084b-11f3-4975-a796-7fcb592dbd47@2g2000hsn.googlegroups.com> On Jul 12, 8:53 am, "Shriram Krishnamurthi" wrote: > 1. In Scheme, 0 and 1 are both true values. Neither of them is false. > In Scheme, only one value is false: #f, or false. > > 2. In Scheme, AND returns the value of the last expression so long as > it isn't false. > But (and 8 9 #f) returns #f. From matthias at ccs.neu.edu Sat Jul 12 10:02:08 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:23:05 2009 Subject: [plt-scheme] boolean operators on integers In-Reply-To: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> References: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> Message-ID: <3FC36EAF-77FC-4111-BF14-9514A6813AC8@ccs.neu.edu> Can you explain why you think 0 and 1 should have anything to do with true and false? (I am afraid that it somehow slipped into a document that may confuse our users and we need to clarify this. -- In centuries past, around 1738, people thought that 0 stood for #f and that 1 stood for #t. But this pun hasn't been useful to real programmer since then so I don't know where one would fine this idea, except in history books.) ;; --- 1. In Scheme, ALL values except #f denote "truth". 2. In Scheme, and is a form that evaluates ALL sub-expressions until one of them produces #f. If none do, it produces the value of the last sub-expression. The two points explain what you see in the Pretty Big Language. ;; --- On Jul 12, 2008, at 9:44 AM, wooks wrote: >> (and 1 0) > 0 >> (and 0 1) > 1 > >> (and 1 0 0) > 0 >> (and 0 0 1) > 1 >> (and 0 1 0) > 0 >> (and 0 1 1) > 1 > > Seems like and is just returning the value of the last argument. > > The integers 0 and 1 are supposed (for my purposes ) to be boolean > flags true and false so this is not the behaviour that I want. > > Using language Pretty Big. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From wookiz at hotmail.com Sat Jul 12 10:35:17 2008 From: wookiz at hotmail.com (wooks) Date: Thu Mar 26 02:23:05 2009 Subject: [plt-scheme] Re: boolean operators on integers In-Reply-To: <3FC36EAF-77FC-4111-BF14-9514A6813AC8@ccs.neu.edu> References: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> <3FC36EAF-77FC-4111-BF14-9514A6813AC8@ccs.neu.edu> Message-ID: On Jul 12, 9:02 am, Matthias Felleisen wrote: > Can you explain why you think 0 and 1 should have anything to do with > true and false? (I am afraid that it somehow slipped into a document > that may confuse our users and we need to clarify this. -- In > centuries past, around 1738, people thought that 0 stood for #f and > that 1 stood for #t. But this pun hasn't been useful to real > programmer since then so I don't know where one would fine this idea, > except in history books.) > Jens articulated it better than I did, I was really seeking to do bitwise operations. > ;; --- > > 1. In Scheme, ALL values except #f denote "truth". > > 2. In Scheme, and is a form that evaluates ALL sub-expressions until > one of them produces #f. If none do, it produces the value of the > last sub-expression. > > The two points explain what you see in the Pretty Big Language. > All the replies have been very elucidating - I'm grateful. From hendrik at topoi.pooq.com Sat Jul 12 10:43:02 2008 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Thu Mar 26 02:23:05 2009 Subject: [plt-scheme] Re: boolean operators on integers In-Reply-To: References: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> <3FC36EAF-77FC-4111-BF14-9514A6813AC8@ccs.neu.edu> Message-ID: <20080712144302.GA12871@topoi.pooq.com> On Sat, Jul 12, 2008 at 07:35:17AM -0700, wooks wrote: > > > On Jul 12, 9:02 am, Matthias Felleisen wrote: > > Can you explain why you think 0 and 1 should have anything to do with > > true and false? (I am afraid that it somehow slipped into a document > > that may confuse our users and we need to clarify this. -- In > > centuries past, around 1738, people thought that 0 stood for #f and > > that 1 stood for #t. But this pun hasn't been useful to real > > programmer since then so I don't know where one would fine this idea, > > except in history books.) > > Recursive function theorists in mid-20'th century or before (definitely before computers) used 0 = true and 1 = false. This had the nice effect that they could use exponentiation for not: 0 ** 0 = 1 0 ** 1 = 0 -- hendrik From robby at cs.uchicago.edu Sat Jul 12 10:44:26 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:23:05 2009 Subject: [plt-scheme] boolean operators on integers In-Reply-To: <3FC36EAF-77FC-4111-BF14-9514A6813AC8@ccs.neu.edu> References: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> <3FC36EAF-77FC-4111-BF14-9514A6813AC8@ccs.neu.edu> Message-ID: <932b2f1f0807120744y2e766876rb53b377a2689b74e@mail.gmail.com> On Sat, Jul 12, 2008 at 9:02 AM, Matthias Felleisen wrote: > In centuries past, around > 1738, people thought that 0 stood for #f and that 1 stood for #t. But this > pun hasn't been useful to real programmer since then so I don't know where > one would fine this idea, except in history books.) Not to be too too contrarian, but the idea is actually being used all the time. It really starts with two voltages that we can interpret as booleans to implement boolean logical formulas and then, whaddayaknow, you can implement arithmetic using boolean formulas by treating the binary digits of a number as truth values.... But of course, this is only something you think of when you peel back a layer of abstraction. THAT is the real sin, here. :) Robby From plragde at uwaterloo.ca Sat Jul 12 12:12:41 2008 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Thu Mar 26 02:23:06 2009 Subject: [plt-scheme] boolean operators on integers In-Reply-To: <3FC36EAF-77FC-4111-BF14-9514A6813AC8@ccs.neu.edu> Message-ID: <4878D7F9.3050205@uwaterloo.ca> Matthias wrote: > Can you explain why you think 0 and 1 should have anything to do with > true and false? (I am afraid that it somehow slipped into a document > that may confuse our users and we need to clarify this. -- In > centuries past, around 1738, people thought that 0 stood for #f and > that 1 stood for #t. But this pun hasn't been useful to real > programmer since then so I don't know where one would fine this idea, > except in history books.) The C programming language...? --PR From matthias at ccs.neu.edu Sat Jul 12 12:20:31 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:23:06 2009 Subject: [plt-scheme] boolean operators on integers In-Reply-To: <4878D7F9.3050205@uwaterloo.ca> References: <4878D7F9.3050205@uwaterloo.ca> Message-ID: <630961A0-5113-4FAC-A37A-926D0D57946D@ccs.neu.edu> Thanks for making my point stronger. On Jul 12, 2008, at 12:12 PM, Prabhakar Ragde wrote: > Matthias wrote: > >> Can you explain why you think 0 and 1 should have anything to do >> with true and false? (I am afraid that it somehow slipped into a >> document that may confuse our users and we need to clarify this. >> -- In centuries past, around 1738, people thought that 0 stood >> for #f and that 1 stood for #t. But this pun hasn't been useful >> to real programmer since then so I don't know where one would >> fine this idea, except in history books.) > > The C programming language...? --PR > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From matthias at ccs.neu.edu Sat Jul 12 12:23:19 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:23:06 2009 Subject: [plt-scheme] boolean operators on integers In-Reply-To: <04BFA84B-B13D-4AC4-B823-C2C9597B0FF8@mac.com> References: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> <3FC36EAF-77FC-4111-BF14-9514A6813AC8@ccs.neu.edu> <932b2f1f0807120744y2e766876rb53b377a2689b74e@mail.gmail.com> <04BFA84B-B13D-4AC4-B823-C2C9597B0FF8@mac.com> Message-ID: <07DE6E64-D650-4181-A298-C542E97F60E3@ccs.neu.edu> On Jul 12, 2008, at 12:13 PM, Richard Cleis wrote: > This is boring practical stuff, though; it's not as fun as using > exponentiation for implementing logical negation. :) I don't think the design of such a function is boring: ;; bits->list : Bits -> [Listof Boolean] would clearly do just the right thing. I haven't needed exponentation much, however. From rcleis at mac.com Sat Jul 12 12:13:51 2008 From: rcleis at mac.com (Richard Cleis) Date: Thu Mar 26 02:23:06 2009 Subject: [plt-scheme] boolean operators on integers In-Reply-To: <932b2f1f0807120744y2e766876rb53b377a2689b74e@mail.gmail.com> References: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> <3FC36EAF-77FC-4111-BF14-9514A6813AC8@ccs.neu.edu> <932b2f1f0807120744y2e766876rb53b377a2689b74e@mail.gmail.com> Message-ID: <04BFA84B-B13D-4AC4-B823-C2C9597B0FF8@mac.com> On Jul 12, 2008, at 8:44 AM, Robby Findler wrote: > On Sat, Jul 12, 2008 at 9:02 AM, Matthias Felleisen > wrote: >> In centuries past, around >> 1738, people thought that 0 stood for #f and that 1 stood for #t. >> But this >> pun hasn't been useful to real programmer since then so I don't >> know where >> one would fine this idea, except in history books.) > > Not to be too too contrarian, but the idea is actually being used all > the time. It really starts with two voltages that we can interpret as > booleans to implement boolean logical formulas and then, whaddayaknow, > you can implement arithmetic using boolean formulas by treating the > binary digits of a number as truth values.... > > But of course, this is only something you think of when you peel back > a layer of abstraction. > > THAT is the real sin, here. :) > > Robby I occasionally have the need for functions that I never wrote. They would work like string->list, but would instead convert bits of a hardware derived number to a list of booleans (rather than characters in a string to a list of characters.) That way, a handler could cleanly be applied to the list of boolean values: (apply handle-fridge-status (bits->list status-bits-from-fridge)) (define (handle-fridge-status pump-on cooler-on ...) (cond ((pump-on ...) (cooler-on ...) (... ...)))) An equally useful function for abstraction would be list->bits (to turn the pump and/or cooler on or off, for example) This is boring practical stuff, though; it's not as fun as using exponentiation for implementing logical negation. :) rac > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From morazanm at gmail.com Sat Jul 12 13:16:00 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:23:06 2009 Subject: [plt-scheme] boolean operators on integers In-Reply-To: <3FC36EAF-77FC-4111-BF14-9514A6813AC8@ccs.neu.edu> References: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> <3FC36EAF-77FC-4111-BF14-9514A6813AC8@ccs.neu.edu> Message-ID: <9b1fff280807121016h302a5fb9r1c93df39ca0a3bc1@mail.gmail.com> > > Can you explain why you think 0 and 1 should have anything to do with true > and false? (I am afraid that it somehow slipped into a document that may > confuse our users and we need to clarify this. -- In centuries past, around > 1738, people thought that 0 stood for #f and that 1 stood for #t. But this > pun hasn't been useful to real programmer since then so I don't know where > one would fine this idea, except in history books.) > No need to insult 18th century thinkers! :-) This concept, I believe, grew out of the C world view which, of course, is not very useful. I would suggest, wooks, that you either convert your numbers to boolean first or directly use booleans and then apply a boolean operator. The truth be told, I would welcome boolean operators that require thier arguments to be boolean. It is, at best, confusing to think that one can, for example, "and" a bunch of integers. Cheers, Marco From grettke at acm.org Sat Jul 12 19:56:18 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:06 2009 Subject: [plt-scheme] Re: What is the best way for folks to view macro expansions post 4.0 in module or pretty big? In-Reply-To: <756daca50807101404v5ea2dffcx5670f222b9eb9a31@mail.gmail.com> References: <756daca50807101404v5ea2dffcx5670f222b9eb9a31@mail.gmail.com> Message-ID: <756daca50807121656m166fd063wc012777e5d93f5cb@mail.gmail.com> On Thu, Jul 10, 2008 at 4:04 PM, Grant Rettke wrote: > The macro stepper used to be present in 372, but not 4.0. That email probably only made sense to me. Let me elaborate: Up until now, I had only been using 372 and recently switched over to 4.x. In my DrScheme, the macro stepper button did not show up, in any of the languages, hence my email. Tonight I started up v372, used the macro stepper, closed it, started up v4, and lo and behold now the macro stepper does show up in DrScheme. Problem solved, not sure how, but problem solved. From eli at barzilay.org Sat Jul 12 20:42:49 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:07 2009 Subject: [plt-scheme] boolean operators on integers In-Reply-To: <04BFA84B-B13D-4AC4-B823-C2C9597B0FF8@mac.com> References: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> <3FC36EAF-77FC-4111-BF14-9514A6813AC8@ccs.neu.edu> <932b2f1f0807120744y2e766876rb53b377a2689b74e@mail.gmail.com> <04BFA84B-B13D-4AC4-B823-C2C9597B0FF8@mac.com> Message-ID: <18553.20361.253365.13741@arabic.ccs.neu.edu> On Jul 12, Richard Cleis wrote: > > I occasionally have the need for functions that I never wrote. They > would work like string->list, but would instead convert bits of a > hardware derived number to a list of booleans (rather than > characters in a string to a list of characters.) That way, a > handler could cleanly be applied to the list of boolean values: Here's a quick hack that works as long as you don't mind the temporary junk that is generated: (map (lambda (x) (eq? x #\1)) (string->list (number->string 1234 2))) (string->number (apply string (map (lambda (x) (if x #\1 #\0)) '(#t #f #f #t #t #f #t #f #f #t #f))) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From rcleis at mac.com Sat Jul 12 21:09:01 2008 From: rcleis at mac.com (Richard Cleis) Date: Thu Mar 26 02:23:07 2009 Subject: [plt-scheme] boolean operators on integers In-Reply-To: <18553.20361.253365.13741@arabic.ccs.neu.edu> References: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> <3FC36EAF-77FC-4111-BF14-9514A6813AC8@ccs.neu.edu> <932b2f1f0807120744y2e766876rb53b377a2689b74e@mail.gmail.com> <04BFA84B-B13D-4AC4-B823-C2C9597B0FF8@mac.com> <18553.20361.253365.13741@arabic.ccs.neu.edu> Message-ID: That's slick. Back when I wanted to do this, I didn't think of supplying a base to the number conversions so I ended up abandoning the list idea and instead equated numbers to bit patterns. Resorting to such C'ish code was the first thing that came to mind, but it is not at all generally usable. rac On Jul 12, 2008, at 6:42 PM, Eli Barzilay wrote: > On Jul 12, Richard Cleis wrote: >> >> I occasionally have the need for functions that I never wrote. They >> would work like string->list, but would instead convert bits of a >> hardware derived number to a list of booleans (rather than >> characters in a string to a list of characters.) That way, a >> handler could cleanly be applied to the list of boolean values: > > Here's a quick hack that works as long as you don't mind the temporary > junk that is generated: > > (map (lambda (x) (eq? x #\1)) > (string->list (number->string 1234 2))) > > (string->number (apply string (map (lambda (x) (if x #\1 #\0)) > '(#t #f #f #t #t #f #t #f #f #t > #f))) > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli > Barzilay: > http://www.barzilay.org/ Maze is > Life! > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From yarkun at gmail.com Sat Jul 12 21:38:18 2008 From: yarkun at gmail.com (Yavuz Arkun) Date: Thu Mar 26 02:23:07 2009 Subject: [plt-scheme] Re: boolean operators on integers In-Reply-To: <20080712144302.GA12871@topoi.pooq.com> References: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> <3FC36EAF-77FC-4111-BF14-9514A6813AC8@ccs.neu.edu> <20080712144302.GA12871@topoi.pooq.com> Message-ID: <2748b30b0807121838k26251e4jcbde1cc4271534e4@mail.gmail.com> It seems not just NOT operation but also AND and OR can be replaced with arithmetic operations when #t and #f are represented by 1 and 0. AND is multiplication, and OR is addition (modulo 1). And if memory serves right, the proof of Godel's incompleteness theorem involved encoding statements themselves into integers. You could say that this method turns one type (the statements) into another type (numbers), and unifies them. How come computer scientists obsess about segregating things into ever finer types when all the other sciences are really about finding unifying themes that brings together apparently disparate phenomena? ;) --Yavuz On Sat, Jul 12, 2008 at 17:43, wrote: > On Sat, Jul 12, 2008 at 07:35:17AM -0700, wooks wrote: >> >> >> On Jul 12, 9:02 am, Matthias Felleisen wrote: >> > Can you explain why you think 0 and 1 should have anything to do with >> > true and false? (I am afraid that it somehow slipped into a document >> > that may confuse our users and we need to clarify this. -- In >> > centuries past, around 1738, people thought that 0 stood for #f and >> > that 1 stood for #t. But this pun hasn't been useful to real >> > programmer since then so I don't know where one would fine this idea, >> > except in history books.) >> > > > Recursive function theorists in mid-20'th century or before (definitely > before computers) used 0 = true and 1 = false. This had the nice effect > that they could use exponentiation for not: > > 0 ** 0 = 1 > 0 ** 1 = 0 > > -- hendrik > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From lunarc.lists at gmail.com Sat Jul 12 21:44:57 2008 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:23:07 2009 Subject: [plt-scheme] boolean operators on integers In-Reply-To: <07DE6E64-D650-4181-A298-C542E97F60E3@ccs.neu.edu> References: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> <3FC36EAF-77FC-4111-BF14-9514A6813AC8@ccs.neu.edu> <932b2f1f0807120744y2e766876rb53b377a2689b74e@mail.gmail.com> <04BFA84B-B13D-4AC4-B823-C2C9597B0FF8@mac.com> <07DE6E64-D650-4181-A298-C542E97F60E3@ccs.neu.edu> Message-ID: 2008/7/12 Matthias Felleisen : > > On Jul 12, 2008, at 12:13 PM, Richard Cleis wrote: > >> This is boring practical stuff, though; it's not as fun as using >> exponentiation for implementing logical negation. :) > > > I don't think the design of such a function is boring: > > ;; bits->list : Bits -> [Listof Boolean] > > would clearly do just the right thing. It wasn't boring for me either =), here's what I had fun coming up with: (define (bcar bits) (bitwise-and 1 bits)) (define (bcdr bits) (arithmetic-shift bits -1)) (define (bcons bit bits) (bitwise-ior bit (arithmetic-shift bits 1))) (define (bnull? bits) (= bits 0)) (define bnull 0) (define (bfoldl proc init bits) (if (bnull? bits) init (bfoldl proc (proc (bcar bits) init) (bcdr bits)))) (define (bits->list bits) (bfoldl (lambda (bit bools) (cons (= bit 1) bools)) '() bits)) (define (list->bits bools) (foldl (lambda (bool bits) (bcons (if bool 1 0) bits)) 0 bools)) I like the symmetry between bits->list and list->bits. This puts low-order bits at the end of the list, which has the problem that you have to prepend a number of falses before passing the list to handle-fridge-status. With the low-order-bits at the beginning of the list, you could make handle-fridge-status's arguments default to false to make the apply work. Henk From eli at barzilay.org Sat Jul 12 21:51:59 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:08 2009 Subject: [plt-scheme] Re: boolean operators on integers In-Reply-To: <2748b30b0807121838k26251e4jcbde1cc4271534e4@mail.gmail.com> References: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> <3FC36EAF-77FC-4111-BF14-9514A6813AC8@ccs.neu.edu> <20080712144302.GA12871@topoi.pooq.com> <2748b30b0807121838k26251e4jcbde1cc4271534e4@mail.gmail.com> Message-ID: <18553.24511.18163.741488@arabic.ccs.neu.edu> On Jul 13, Yavuz Arkun wrote: > > How come computer scientists obsess about segregating things into > ever finer types when all the other sciences are really about > finding unifying themes that brings together apparently disparate > phenomena? Use javascript for a while. First time you get 23 as the result of adding 2 and 3 and things and you'll end up writing "unify" on a piece of paper and then spend 4 hours burning it. Here's another puzzle: foo = new Array(); foo.push(1); foo.push(23); foo.push(345); We now have `foo' bound to an array of three integers. If you do this, for (var i in foo) alert("i = " + i); you'll find that `var i in foo' iterates `i' over the indexes. Odd but acceptable, right? Now try this: for (var i in foo) alert("i = " + (i+0)); (So where was that piece of paper...) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From rcleis at mac.com Sat Jul 12 22:33:38 2008 From: rcleis at mac.com (Richard Cleis) Date: Thu Mar 26 02:23:08 2009 Subject: [plt-scheme] boolean operators on integers In-Reply-To: References: <16b4da2a-f75b-40ca-a55d-75cffdda09d8@j22g2000hsf.googlegroups.com> <3FC36EAF-77FC-4111-BF14-9514A6813AC8@ccs.neu.edu> <932b2f1f0807120744y2e766876rb53b377a2689b74e@mail.gmail.com> <04BFA84B-B13D-4AC4-B823-C2C9597B0FF8@mac.com> <07DE6E64-D650-4181-A298-C542E97F60E3@ccs.neu.edu> Message-ID: <2216A132-69BF-441B-A641-779DA06C4CB0@mac.com> On Jul 12, 2008, at 7:44 PM, Henk Boom wrote: > 2008/7/12 Matthias Felleisen : >> >> On Jul 12, 2008, at 12:13 PM, Richard Cleis wrote: >> >>> This is boring practical stuff, though; it's not as fun as using >>> exponentiation for implementing logical negation. :) >> >> >> I don't think the design of such a function is boring: >> >> ;; bits->list : Bits -> [Listof Boolean] >> >> would clearly do just the right thing. > > It wasn't boring for me either =), here's what I had fun coming up > with: This *is* a fun way. In the pressure packed moments of programming, I would not have been able to make this work as fast as my hack or Eli's solution. I often wonder how fast I would be if I were a 'real' Scheme programmer. > > > (define (bcar bits) > (bitwise-and 1 bits)) > (define (bcdr bits) > (arithmetic-shift bits -1)) > (define (bcons bit bits) > (bitwise-ior bit (arithmetic-shift bits 1))) > (define (bnull? bits) > (= bits 0)) > (define bnull 0) > > (define (bfoldl proc init bits) > (if (bnull? bits) init > (bfoldl proc > (proc (bcar bits) init) > (bcdr bits)))) > > (define (bits->list bits) > (bfoldl (lambda (bit bools) (cons (= bit 1) bools)) '() bits)) > > (define (list->bits bools) > (foldl (lambda (bool bits) (bcons (if bool 1 0) bits)) 0 bools)) > > I like the symmetry between bits->list and list->bits. > > This puts low-order bits at the end of the list, which has the problem > that you have to prepend a number of falses before passing the list to > handle-fridge-status. With the low-order-bits at the beginning of the > list, you could make handle-fridge-status's arguments default to false > to make the apply work. The ordering is not a problem. When working with hardware problems that these functions would solve, the number of bits are normally fixed and small. The important issue is to have the hardware-specific complication in one place. The arguments of the function that is applied to the list essentially document the arrangement of the bits. Thanks, rac > > > Henk > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From petermichaux at gmail.com Sun Jul 13 01:28:05 2008 From: petermichaux at gmail.com (Peter Michaux) Date: Thu Mar 26 02:23:08 2009 Subject: [plt-scheme] suppress welcome message in MzScheme 4.0.2? Message-ID: <3cbaf1c80807122228s25d3ad7awb378495d8c668e42@mail.gmail.com> Hi, I've upgraded to MzScheme 4.0.2 and the -m command line flag that worked in v372 no longer works to suppress the welcome message. Is there a way to suppress the welcome message? Thanks, Peter From noelwelsh at gmail.com Sun Jul 13 05:15:02 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:23:08 2009 Subject: [plt-scheme] suppress welcome message in MzScheme 4.0.2? In-Reply-To: <3cbaf1c80807122228s25d3ad7awb378495d8c668e42@mail.gmail.com> References: <3cbaf1c80807122228s25d3ad7awb378495d8c668e42@mail.gmail.com> Message-ID: mzscheme --help gives you the list of command line flags. N. On Sun, Jul 13, 2008 at 6:28 AM, Peter Michaux wrote: > Hi, > > I've upgraded to MzScheme 4.0.2 and the -m command line flag that > worked in v372 no longer works to suppress the welcome message. Is > there a way to suppress the welcome message? > > Thanks, > Peter From jensaxel at soegaard.net Sun Jul 13 06:48:28 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:23:09 2009 Subject: [plt-scheme] A Square Canvas Message-ID: <4879DD7C.9060308@soegaard.net> Hi All, I'd like to create a square canvas - as big as possible. The normal geometry management makes it easy to make an rectangular canvas that uses as much space as possible. At first I thought I could get the retangular size and then shrink the canvas to use the minimum of the horizontal and vertival sizes - but canvases have no resize method. Is using a non-stretchable canvas my best option? Or is there a trick I have overlooked? A simplified version of my layout is found below. /Jens Axel #lang scheme/gui (require framework) (define-values (full-screen-width full-screen-height) (get-display-size #t)) (define-values (canvas-width canvas-height) (values 0 0)) (let* ([frame (new frame% [label "Exercises"] [width full-screen-width] [height full-screen-height] [style '(no-resize-border no-caption hide-menu-bar no-system-menu)])] [header-panel (new vertical-panel% [parent frame] [alignment '(center center)] [stretchable-height #f])] [header-msg (new message% [parent header-panel] [label "Problem Name"])] ; exercise + instructions [main-panel (new horizontal-panel% [parent frame] [vert-margin 20] [horiz-margin 20])] [left (new vertical-panel% [parent main-panel] [vert-margin 20] [horiz-margin 20] [min-width (- (* 2 (quotient full-screen-width 3)) 100)])] [right (new vertical-panel% [parent main-panel] [min-width (quotient full-screen-width 3)] [alignment '(center center)])] [statement (new message% [parent left] [label "A problem statement"] [vert-margin 10])] [instructions (new editor-canvas% [parent right] [editor (new text%)] [style '(auto-vscroll no-hscroll)])] ; status message [status-panel (new horizontal-panel% [parent frame] [stretchable-height #f])] [status-msg (new message% [parent status-panel] [label "Status goes here"])] [quit-button (new button% [parent right] [label "Quit"] [callback (? (but ev) (send frame show #f))])]) (define exercise-canvas% (class canvas% (define/public (get-canvas-size) (set!-values (canvas-width canvas-height) (send this get-size))) (define/override (on-event e) (send this get-canvas-size)) (define (on-size e) (send this get-screen-size)) (define (on-move e) (send this get-screen-size)) (super-new))) (letrec ([canvas (new exercise-canvas% [parent left] [style '(border)] [stretchable-width #t] [stretchable-height #t] [paint-callback (? (b dc) '...)])]) ; move frame to top-left of screen (let-values ([(dx dy) (send frame client->screen 0 0)]) (send frame move 0 (- dy))) (send frame show #t) (send (send instructions get-editor) insert "Solve the problem at the left."))) From robby at cs.uchicago.edu Sun Jul 13 07:36:42 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:23:09 2009 Subject: [plt-scheme] A Square Canvas In-Reply-To: <4879DD7C.9060308@soegaard.net> References: <4879DD7C.9060308@soegaard.net> Message-ID: <932b2f1f0807130436l6e3abb77q387e2058f67bd5eb@mail.gmail.com> I can't quite figure out what sizes you want (is something backwards somewhere in the below, by chance?) but maybe you're looking for the min-width and min-height methods of the canvas? If you set those and then make the canvas not stretchable, it will be exactly that size. Robby On Sun, Jul 13, 2008 at 5:48 AM, Jens Axel Soegaard wrote: > Hi All, > > I'd like to create a square canvas - as big as possible. > > The normal geometry management makes it easy to make an > rectangular canvas that uses as much space as possible. > > At first I thought I could get the retangular size and then > shrink the canvas to use the minimum of the horizontal > and vertival sizes - but canvases have no resize method. > > Is using a non-stretchable canvas my best option? Or is > there a trick I have overlooked? > > A simplified version of my layout is found below. > > /Jens Axel > > > > #lang scheme/gui > > (require framework) > > (define-values (full-screen-width full-screen-height) (get-display-size #t)) > (define-values (canvas-width canvas-height) (values 0 0)) > > (let* ([frame (new frame% > [label "Exercises"] > [width full-screen-width] [height full-screen-height] > [style '(no-resize-border no-caption hide-menu-bar no-system-menu)])] > [header-panel (new vertical-panel% > [parent frame] [alignment '(center center)] [stretchable-height #f])] > [header-msg (new message% [parent header-panel] [label "Problem Name"])] > ; exercise + instructions > [main-panel (new horizontal-panel% [parent frame] [vert-margin 20] > [horiz-margin 20])] > [left (new vertical-panel% > [parent main-panel] [vert-margin 20] [horiz-margin 20] > [min-width (- (* 2 (quotient full-screen-width 3)) 100)])] > [right (new vertical-panel% > [parent main-panel] [min-width (quotient full-screen-width 3)] > [alignment '(center center)])] > [statement (new message% > [parent left] [label "A problem statement"] [vert-margin 10])] > [instructions (new editor-canvas% > [parent right] [editor (new text%)] [style '(auto-vscroll no-hscroll)])] > ; status message > [status-panel (new horizontal-panel% [parent frame] [stretchable-height > #f])] > [status-msg (new message% [parent status-panel] [label "Status goes here"])] > [quit-button (new button% [parent right] [label "Quit"] > [callback (? (but ev) (send frame show #f))])]) > (define exercise-canvas% > (class canvas% > (define/public (get-canvas-size) > (set!-values (canvas-width canvas-height) (send this get-size))) > (define/override (on-event e) > (send this get-canvas-size)) > (define (on-size e) (send this get-screen-size)) > (define (on-move e) (send this get-screen-size)) > (super-new))) > (letrec ([canvas (new exercise-canvas% > [parent left] [style '(border)] > [stretchable-width #t] [stretchable-height #t] > [paint-callback (? (b dc) '...)])]) > ; move frame to top-left of screen > (let-values ([(dx dy) (send frame client->screen 0 0)]) > (send frame move 0 (- dy))) > (send frame show #t) > (send (send instructions get-editor) insert "Solve the problem at the > left."))) > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From jensaxel at soegaard.net Sun Jul 13 07:42:15 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:23:09 2009 Subject: [plt-scheme] A Square Canvas In-Reply-To: <932b2f1f0807130436l6e3abb77q387e2058f67bd5eb@mail.gmail.com> References: <4879DD7C.9060308@soegaard.net> <932b2f1f0807130436l6e3abb77q387e2058f67bd5eb@mail.gmail.com> Message-ID: <4879EA17.3080503@soegaard.net> Robby Findler skrev: > I can't quite figure out what sizes you want (is something backwards > somewhere in the below, by chance?) but maybe you're looking for the > min-width and min-height methods of the canvas? If you set those and > then make the canvas not stretchable, it will be exactly that size. > > Making it non-stretchable and setting the minimum sizes will make the canvas quadratic, but how can I be sure it will be as big as possible on both normal and wide screens? /Jens Axel From robby at cs.uchicago.edu Sun Jul 13 07:47:04 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:23:09 2009 Subject: [plt-scheme] A Square Canvas In-Reply-To: <4879EA17.3080503@soegaard.net> References: <4879DD7C.9060308@soegaard.net> <932b2f1f0807130436l6e3abb77q387e2058f67bd5eb@mail.gmail.com> <4879EA17.3080503@soegaard.net> Message-ID: <932b2f1f0807130447xceb8f24p3d078dccf8d67b30@mail.gmail.com> Is the goal to have a stretchable canvas, but one that always stays square? For that you'd need to make your own geometry manager, I'm afraid. This is the relevant part of the docs: http://docs.plt-scheme.org/gui/windowing-overview.html#(part._new-containers) Robby On Sun, Jul 13, 2008 at 6:42 AM, Jens Axel Soegaard wrote: > Robby Findler skrev: >> >> I can't quite figure out what sizes you want (is something backwards >> somewhere in the below, by chance?) but maybe you're looking for the >> min-width and min-height methods of the canvas? If you set those and >> then make the canvas not stretchable, it will be exactly that size. >> >> > > Making it non-stretchable and setting the minimum sizes will make the canvas > quadratic, > but how can I be sure it will be as big as possible on both normal and wide > screens? > > /Jens Axel > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From jensaxel at soegaard.net Sun Jul 13 07:54:35 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:23:09 2009 Subject: [plt-scheme] A Square Canvas In-Reply-To: <932b2f1f0807130447xceb8f24p3d078dccf8d67b30@mail.gmail.com> References: <4879DD7C.9060308@soegaard.net> <932b2f1f0807130436l6e3abb77q387e2058f67bd5eb@mail.gmail.com> <4879EA17.3080503@soegaard.net> <932b2f1f0807130447xceb8f24p3d078dccf8d67b30@mail.gmail.com> Message-ID: <4879ECFB.3070108@soegaard.net> Robby Findler skrev: > Is the goal to have a stretchable canvas, but one that always stays > square? Yes. > For that you'd need to make your own geometry manager, I'm > afraid. This is the relevant part of the docs: > > http://docs.plt-scheme.org/gui/windowing-overview.html#(part._new-containers) > I'll take a look. Thanks, Jens Axel From mflatt at cs.utah.edu Sun Jul 13 08:24:17 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:10 2009 Subject: [plt-scheme] suppress welcome message in MzScheme 4.0.2? In-Reply-To: <3cbaf1c80807122228s25d3ad7awb378495d8c668e42@mail.gmail.com> References: <3cbaf1c80807122228s25d3ad7awb378495d8c668e42@mail.gmail.com> Message-ID: <20080713122419.C40E4650085@mail-svr1.cs.utah.edu> At Sat, 12 Jul 2008 22:28:05 -0700, "Peter Michaux" wrote: > I've upgraded to MzScheme 4.0.2 and the -m command line flag that > worked in v372 no longer works to suppress the welcome message. Is > there a way to suppress the welcome message? There's not a corresponding flag, but the welcome message appears only with the REPL as triggered by -i (or the implicit -i when no command-line flags are supplied). You could use -e "(read-eval-print-loop)" to get a REPL without the welcome message. Matthew From mflatt at cs.utah.edu Sun Jul 13 08:43:33 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:10 2009 Subject: [plt-scheme] restart exception handling? In-Reply-To: <779bf2730807111418h1a04a50eqc11c715b2650e5f1@mail.gmail.com> References: <779bf2730807101435sf541a89md22409be21d5d25d@mail.gmail.com> <20080711132153.B75986500AA@mail-svr1.cs.utah.edu> <779bf2730807111418h1a04a50eqc11c715b2650e5f1@mail.gmail.com> Message-ID: <20080713124335.AE5AE6500A3@mail-svr1.cs.utah.edu> At Fri, 11 Jul 2008 14:18:21 -0700, YC wrote: > On Fri, Jul 11, 2008 at 6:21 AM, Matthew Flatt wrote: > > > Not in general. Aside from `exn:break', built-in exceptions are raised > > in a non-continuable way. > > > > Just curious - what are the main reasons behind the exception design to make > them non-continuable by default? Exceptions are typically raised (both in the core and in Scheme code) with code like this: (define (mega-fun x y z) (unless (integer? x) (raise-type-error 'mega-fun "integer" x)) (unless (list? y) (raise-type-error 'mega-fun "list" y)) (for-each (lambda (e) (when (equal? e x) (error 'mega-fun "cannot include val in list: ~e" x))) y) ...) To make those exceptions continuable, the function has to be written in a different way, and often that's a pain: (define (mega-fun x y z) (if (not (integer? x)) (raise-continuable-type-error 'mega-fun "integer" x)) (if (not (list? y)) (raise-continuable-type-error 'mega-fun "list" y)) ((let/ec esc (for-each (lambda (e) (when (equal? e x) (esc (lambda () (continuable-error 'mega-fun "cannot include val in list: ~e" x))))) y) (lambda () ...)))) That goes for all the exceptions raised by the run-time system, too. For that reason, `error', `raise-type-error', etc. should not raise continuable exceptions. The part of the run-time system that raises `exn:fail:contract:variable' could be written in a continuable way, of course; but for that exception and all the others, it hasn't seemed useful enough to bother. (At one point, it seemed useful enough to make `exn:break' continuable, but I don't know whether that capability is actually used anywhere.) There's another question of whether you want to use the same mechanism for continuable exceptions as non-continuable exceptions. That issue is discussed in a separate thread on this list: http://list.cs.brown.edu/pipermail/plt-scheme/2008-July/025783.html > (is contination > the basis for flow controls as scheme generally advertises?) I think you're asking about MzScheme's implementation of first-class continuations, and whether the same representation is used for all kinds of control flow in MzScheme. No, it isn't. > > That's not quite the problem. It's more that the exception handler is > > required to escape, and also that the exception for an undefined > > variable doesn't provide a place to escape back to. > > > > So what are the contination-marks used for? The original comment was about *barriers*, not *marks*. > I thought they can be used for > invoking continuations. Marks are for attaching information to parts of a continuation. Barriers prevent certain "jumps" from one continuation to another. > The related concepts (prompts, continuation, > escape, etc) continues to escape me even with the manual. If there are some > links or pointers on how they are all related and used - it's much > appreciated. Probably you've seen the relatively new guide chapter: http://docs.plt-scheme.org/guide/control.html And maybe this set of pictures in conference-paper form: http://www.cs.utah.edu/plt/publications/icfp07-fyff.pdf And the paper's bibliography points to many other sources for some things. That's what we have so far. Matthew From jos.koot at telefonica.net Sun Jul 13 09:11:01 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:10 2009 Subject: [plt-scheme] loops Message-ID: <002901c8e4e9$e649faa0$2101a8c0@uw2b2dff239c4d> The first versions of loop.ss I made before knowing of the existence of for.ss. My module does not provide more (nor less) functionality than for.ss. Nevertheless I like to share my code with you. I tested my loops with various versions of PLT Scheme. Latest test with: Welcome to DrScheme, version 4.0.2.3-svn12jul2008 [3m]. Language: Module custom; memory limit: 600 megabytes. Where 'custum' means 'without debugging'. Greetings, Jos Koot http://www.telefonica.net/web2/koot/loop.ss The module http://www.telefonica.net/web2/koot/loop.doc The documentation, with examples, of course. http://www.telefonica.net/web2/koot/test-loop.ss Tests, useful,as examples too. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080713/d55d474e/attachment.html From david.vanderson at gmail.com Sun Jul 13 15:22:23 2008 From: david.vanderson at gmail.com (David Vanderson) Date: Thu Mar 26 02:23:11 2009 Subject: [plt-scheme] restart exception handling? In-Reply-To: <20080713124335.AE5AE6500A3@mail-svr1.cs.utah.edu> References: <779bf2730807101435sf541a89md22409be21d5d25d@mail.gmail.com> <20080711132153.B75986500AA@mail-svr1.cs.utah.edu> <779bf2730807111418h1a04a50eqc11c715b2650e5f1@mail.gmail.com> <20080713124335.AE5AE6500A3@mail-svr1.cs.utah.edu> Message-ID: <487A55EF.2060401@gmail.com> Matthew Flatt wrote: > Exceptions are typically raised (both in the core and in Scheme code) > with code like this: > > (define (mega-fun x y z) > (unless (integer? x) > (raise-type-error 'mega-fun "integer" x)) > (unless (list? y) > (raise-type-error 'mega-fun "list" y)) > (for-each (lambda (e) > (when (equal? e x) > (error 'mega-fun "cannot include val in list: ~e" x))) > y) > ...) > > To make those exceptions continuable, the function has to be written in > a different way, and often that's a pain: > > (define (mega-fun x y z) > (if (not (integer? x)) > (raise-continuable-type-error 'mega-fun "integer" x)) > (if (not (list? y)) > (raise-continuable-type-error 'mega-fun "list" y)) > ((let/ec esc > (for-each (lambda (e) > (when (equal? e x) > (esc > (lambda () > (continuable-error > 'mega-fun > "cannot include val in list: ~e" > x))))) > y) > (lambda () ...)))) > Thanks very much for the explanations. Is there a reason why each exception should be thrown in tail position with respect to the function? Is that the convention for continuable exceptions? Could you please elaborate on why you couldn't (or shouldn't) just replace "raise-type-error" with "raise-continuable-type-error"? Thanks, Dave From mflatt at cs.utah.edu Sun Jul 13 19:34:31 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:11 2009 Subject: [plt-scheme] restart exception handling? In-Reply-To: <487A55EF.2060401@gmail.com> References: <779bf2730807101435sf541a89md22409be21d5d25d@mail.gmail.com> <20080711132153.B75986500AA@mail-svr1.cs.utah.edu> <779bf2730807111418h1a04a50eqc11c715b2650e5f1@mail.gmail.com> <20080713124335.AE5AE6500A3@mail-svr1.cs.utah.edu> <487A55EF.2060401@gmail.com> Message-ID: <20080713233433.15BAC6500B1@mail-svr1.cs.utah.edu> At Sun, 13 Jul 2008 15:22:23 -0400, David Vanderson wrote: > > Matthew Flatt wrote: > > Exceptions are typically raised (both in the core and in Scheme code) > > with code like this: > > > > (define (mega-fun x y z) > > (unless (integer? x) > > (raise-type-error 'mega-fun "integer" x)) > > (unless (list? y) > > (raise-type-error 'mega-fun "list" y)) > > (for-each (lambda (e) > > (when (equal? e x) > > (error 'mega-fun "cannot include val in list: ~e" x))) > > y) > > ...) > > > > To make those exceptions continuable, the function has to be written in > > a different way, and often that's a pain: > > > > (define (mega-fun x y z) > > (if (not (integer? x)) > > (raise-continuable-type-error 'mega-fun "integer" x)) > > (if (not (list? y)) > > (raise-continuable-type-error 'mega-fun "list" y)) > > ((let/ec esc > > (for-each (lambda (e) > > (when (equal? e x) > > (esc > > (lambda () > > (continuable-error > > 'mega-fun > > "cannot include val in list: ~e" > > x))))) > > y) > > (lambda () ...)))) > > > > Thanks very much for the explanations. > > Is there a reason why each exception should be thrown in tail position > with respect to the function? Is that the convention for continuable > exceptions? My intent was to set up some reasonable continuation for the exception handler (i.e., the continuation of the call to functions like `raise-continuable-type-error'). As above, I imagined that the exception handler would continue by supplying some result for the call to `mega-fun'. Another choice would be (define (mega-fun x y z) (let ([x (if (not (integer? x)) (raise-continuable-type-error 'mega-fun "integer" x) x)]) (let ([y (if (not (list? y)) ....)]) ....))) in which case the exception handler could supply an alternate value for the argument. The exception raiser and exception handler would have to agree on some protocol. > Could you please elaborate on why you couldn't (or shouldn't) just > replace "raise-type-error" with "raise-continuable-type-error"? What continuation would an exception handler be able to resume in that case? Matthew From petermichaux at gmail.com Sun Jul 13 19:57:12 2008 From: petermichaux at gmail.com (Peter Michaux) Date: Thu Mar 26 02:23:11 2009 Subject: [plt-scheme] MzScheme: extending vs. embedding to build a text editor Message-ID: <3cbaf1c80807131657m468dbca5tcc01e66473e2ba40@mail.gmail.com> Hi, Suppose I wanted to build a text editor like emacs where the use is able to extend the editor using MzScheme (rather than emacs-lisp.) It seems there are two main ways this could be done. ----- First, I could write MzScheme extensions [1] for ncurses. The editor could then be written in Scheme from start to end whatever that means. It would certainly be a Scheme-centric implementation. I could then edit a file with the command mzscheme myeditor.ss some-file-to-edit.txt (The whole program with could be compiled to a native binary somehow?) ----- Second, the opposite way would be to write a very small C application and embed MzScheme [2] into that application. I could expose the ncurses API by creating and adding ncurses procedures to the embedded Scheme environment. The C could then load some "myeditor.ss" file into the Scheme environment and the majority of the editor program could be defined in Scheme. Since I would be compiling a C program the editor could be started with myeditor some-file-to-edit.txt ----- I've toyed with some other extensible/embeddable languages and the same problem arises. I'm not sure which way around would be the right way to go. I'm interested in what others would do or if there is an obvious definite answer I don't know because I am new to MzScheme. Thank you, Peter [1] http://docs.plt-scheme.org/inside/overview.html#(part._.Writing_.Mz.Scheme_.Extensions) [2] http://docs.plt-scheme.org/inside/overview.html#(part._embedding) From mflatt at cs.utah.edu Sun Jul 13 20:03:37 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:11 2009 Subject: [plt-scheme] MzScheme: extending vs. embedding to build a text editor In-Reply-To: <3cbaf1c80807131657m468dbca5tcc01e66473e2ba40@mail.gmail.com> References: <3cbaf1c80807131657m468dbca5tcc01e66473e2ba40@mail.gmail.com> Message-ID: <20080714000339.CCBCC650058@mail-svr1.cs.utah.edu> At Sun, 13 Jul 2008 16:57:12 -0700, "Peter Michaux" wrote: > First, I could write MzScheme extensions [1] for ncurses. The editor > could then be written in Scheme from start to end whatever that means. > It would certainly be a Scheme-centric implementation. I could then > edit a file with the command > > mzscheme myeditor.ss some-file-to-edit.txt I would do it this way, but probably using `scheme/foreign' instead of creating an extension: http://docs.plt-scheme.org/foreign/index.html > (The whole program with could be compiled to a native binary somehow?) Yes: http://docs.plt-scheme.org/guide/intro.html#(part._.Creating_.Executables) http://docs.plt-scheme.org/mzc/exe.html From czhu at cs.utah.edu Sun Jul 13 20:04:31 2008 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:23:11 2009 Subject: [plt-scheme] MzScheme: extending vs. embedding to build a text editor In-Reply-To: <3cbaf1c80807131657m468dbca5tcc01e66473e2ba40@mail.gmail.com> References: <3cbaf1c80807131657m468dbca5tcc01e66473e2ba40@mail.gmail.com> Message-ID: <487A980F.70006@cs.utah.edu> I strongly recommend MzScheme extension. And yes, PLT Scheme can compile program to native binary, but I think bytecode + native binary loader is faster. Chongkai Peter Michaux wrote: > Hi, > > Suppose I wanted to build a text editor like emacs where the use is > able to extend the editor using MzScheme (rather than emacs-lisp.) It > seems there are two main ways this could be done. > > ----- > > First, I could write MzScheme extensions [1] for ncurses. The editor > could then be written in Scheme from start to end whatever that means. > It would certainly be a Scheme-centric implementation. I could then > edit a file with the command > > mzscheme myeditor.ss some-file-to-edit.txt > > (The whole program with could be compiled to a native binary somehow?) > > ----- > > Second, the opposite way would be to write a very small C application > and embed MzScheme [2] into that application. I could expose the > ncurses API by creating and adding ncurses procedures to the embedded > Scheme environment. The C could then load some "myeditor.ss" file into > the Scheme environment and the majority of the editor program could be > defined in Scheme. Since I would be compiling a C program the editor > could be started with > > myeditor some-file-to-edit.txt > > ----- > > I've toyed with some other extensible/embeddable languages and the > same problem arises. I'm not sure which way around would be the right > way to go. I'm interested in what others would do or if there is an > obvious definite answer I don't know because I am new to MzScheme. > > Thank you, > Peter > > [1] http://docs.plt-scheme.org/inside/overview.html#(part._.Writing_.Mz.Scheme_.Extensions) > [2] http://docs.plt-scheme.org/inside/overview.html#(part._embedding) > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From petermichaux at gmail.com Sun Jul 13 20:29:11 2008 From: petermichaux at gmail.com (Peter Michaux) Date: Thu Mar 26 02:23:11 2009 Subject: [plt-scheme] MzScheme: extending vs. embedding to build a text editor In-Reply-To: <487A980F.70006@cs.utah.edu> References: <3cbaf1c80807131657m468dbca5tcc01e66473e2ba40@mail.gmail.com> <487A980F.70006@cs.utah.edu> Message-ID: <3cbaf1c80807131729h5734f38em29582b0c059dba8a@mail.gmail.com> On Sun, Jul 13, 2008 at 5:04 PM, Chongkai Zhu wrote: > I strongly recommend MzScheme extension. What is the reason for this strong recommendation? That is really what I would like to understand in general: why one way and not the other. Thanks, Peter > And yes, PLT Scheme can compile > program to native binary, but I think bytecode + native binary loader is > faster. > > Chongkai > > > Peter Michaux wrote: >> >> Hi, >> >> Suppose I wanted to build a text editor like emacs where the use is >> able to extend the editor using MzScheme (rather than emacs-lisp.) It >> seems there are two main ways this could be done. >> >> ----- >> >> First, I could write MzScheme extensions [1] for ncurses. The editor >> could then be written in Scheme from start to end whatever that means. >> It would certainly be a Scheme-centric implementation. I could then >> edit a file with the command >> >> mzscheme myeditor.ss some-file-to-edit.txt >> >> (The whole program with could be compiled to a native binary somehow?) >> >> ----- >> >> Second, the opposite way would be to write a very small C application >> and embed MzScheme [2] into that application. I could expose the >> ncurses API by creating and adding ncurses procedures to the embedded >> Scheme environment. The C could then load some "myeditor.ss" file into >> the Scheme environment and the majority of the editor program could be >> defined in Scheme. Since I would be compiling a C program the editor >> could be started with >> >> myeditor some-file-to-edit.txt >> >> ----- >> >> I've toyed with some other extensible/embeddable languages and the >> same problem arises. I'm not sure which way around would be the right >> way to go. I'm interested in what others would do or if there is an >> obvious definite answer I don't know because I am new to MzScheme. >> >> Thank you, >> Peter >> >> [1] >> http://docs.plt-scheme.org/inside/overview.html#(part._.Writing_.Mz.Scheme_.Extensions) >> [2] http://docs.plt-scheme.org/inside/overview.html#(part._embedding) >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > From david.vanderson at gmail.com Sun Jul 13 20:49:30 2008 From: david.vanderson at gmail.com (David Vanderson) Date: Thu Mar 26 02:23:12 2009 Subject: [plt-scheme] restart exception handling? In-Reply-To: <20080713233433.15BAC6500B1@mail-svr1.cs.utah.edu> References: <779bf2730807101435sf541a89md22409be21d5d25d@mail.gmail.com> <20080711132153.B75986500AA@mail-svr1.cs.utah.edu> <779bf2730807111418h1a04a50eqc11c715b2650e5f1@mail.gmail.com> <20080713124335.AE5AE6500A3@mail-svr1.cs.utah.edu> <487A55EF.2060401@gmail.com> <20080713233433.15BAC6500B1@mail-svr1.cs.utah.edu> Message-ID: <487AA29A.8090507@gmail.com> Matthew Flatt wrote: > At Sun, 13 Jul 2008 15:22:23 -0400, David Vanderson wrote: >> Is there a reason why each exception should be thrown in tail position >> with respect to the function? Is that the convention for continuable >> exceptions? > > My intent was to set up some reasonable continuation for the exception > handler (i.e., the continuation of the call to functions like > `raise-continuable-type-error'). > > As above, I imagined that the exception handler would continue by > supplying some result for the call to `mega-fun'. Another choice would > be > > (define (mega-fun x y z) > (let ([x (if (not (integer? x)) > (raise-continuable-type-error 'mega-fun "integer" x) > x)]) > (let ([y (if (not (list? y)) ....)]) > ....))) > > in which case the exception handler could supply an alternate value for > the argument. The exception raiser and exception handler would have to > agree on some protocol. > >> Could you please elaborate on why you couldn't (or shouldn't) just >> replace "raise-type-error" with "raise-continuable-type-error"? > > What continuation would an exception handler be able to resume in that > case? Your example shows me where I was going wrong. Simply replacing the raise call wouldn't do anything with the value passed to the continuation. So simply resuming the continuation of "unless" can't change the computation of "mega-fun". Thanks for enlightening me. Dave From petermichaux at gmail.com Sun Jul 13 20:50:46 2008 From: petermichaux at gmail.com (Peter Michaux) Date: Thu Mar 26 02:23:12 2009 Subject: [plt-scheme] MzScheme: extending vs. embedding to build a text editor In-Reply-To: <20080714000339.CCBCC650058@mail-svr1.cs.utah.edu> References: <3cbaf1c80807131657m468dbca5tcc01e66473e2ba40@mail.gmail.com> <20080714000339.CCBCC650058@mail-svr1.cs.utah.edu> Message-ID: <3cbaf1c80807131750t3769c271lb3cd58c7d04413c3@mail.gmail.com> On Sun, Jul 13, 2008 at 5:03 PM, Matthew Flatt wrote: > At Sun, 13 Jul 2008 16:57:12 -0700, "Peter Michaux" wrote: >> First, I could write MzScheme extensions [1] for ncurses. The editor >> could then be written in Scheme from start to end whatever that means. >> It would certainly be a Scheme-centric implementation. I could then >> edit a file with the command >> >> mzscheme myeditor.ss some-file-to-edit.txt > > I would do it this way, I'm curious why you would do it this way rather than creating a C program embedded with MzScheme. Is it simply to avoid having to write any C code? > but probably using `scheme/foreign' instead of > creating an extension: > > http://docs.plt-scheme.org/foreign/index.html Again, is this just to avoid having to write any C code (a wrapper in this case)? Or is there some other benefit of using an FFI. I've never used and FFI before. Thanks, Peter From mflatt at cs.utah.edu Sun Jul 13 20:56:30 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:12 2009 Subject: [plt-scheme] MzScheme: extending vs. embedding to build a text editor In-Reply-To: <3cbaf1c80807131750t3769c271lb3cd58c7d04413c3@mail.gmail.com> References: <3cbaf1c80807131657m468dbca5tcc01e66473e2ba40@mail.gmail.com> <20080714000339.CCBCC650058@mail-svr1.cs.utah.edu> <3cbaf1c80807131750t3769c271lb3cd58c7d04413c3@mail.gmail.com> Message-ID: <20080714005632.70F3865009E@mail-svr1.cs.utah.edu> At Sun, 13 Jul 2008 17:50:46 -0700, "Peter Michaux" wrote: > On Sun, Jul 13, 2008 at 5:03 PM, Matthew Flatt wrote: > > At Sun, 13 Jul 2008 16:57:12 -0700, "Peter Michaux" wrote: > >> First, I could write MzScheme extensions [1] for ncurses. The editor > >> could then be written in Scheme from start to end whatever that means. > >> It would certainly be a Scheme-centric implementation. I could then > >> edit a file with the command > >> > >> mzscheme myeditor.ss some-file-to-edit.txt > > > > I would do it this way, > > I'm curious why you would do it this way rather than creating a C > program embedded with MzScheme. Is it simply to avoid having to write > any C code? Partly. Writing an embedding executable is a lot more work than just writing a Scheme library/program. Also, creating an executable via C requires more tools, including platform-specific tools, to compile and link. > > but probably using `scheme/foreign' instead of > > creating an extension: > > > > http://docs.plt-scheme.org/foreign/index.html > > Again, is this just to avoid having to write any C code (a wrapper in > this case)? Yes. It's easier to write Scheme code that uses the FFI than to write C code, and it's easier to make the code adapt to slightly different libraries on different platforms. Matthew From eli at barzilay.org Sun Jul 13 21:10:29 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:12 2009 Subject: [plt-scheme] restart exception handling? In-Reply-To: <20080713233433.15BAC6500B1@mail-svr1.cs.utah.edu> References: <779bf2730807101435sf541a89md22409be21d5d25d@mail.gmail.com> <20080711132153.B75986500AA@mail-svr1.cs.utah.edu> <779bf2730807111418h1a04a50eqc11c715b2650e5f1@mail.gmail.com> <20080713124335.AE5AE6500A3@mail-svr1.cs.utah.edu> <487A55EF.2060401@gmail.com> <20080713233433.15BAC6500B1@mail-svr1.cs.utah.edu> Message-ID: <18554.42885.83303.423105@arabic.ccs.neu.edu> On Jul 13, Matthew Flatt wrote: > [...] > > (define (mega-fun x y z) > (let ([x (if (not (integer? x)) > (raise-continuable-type-error 'mega-fun "integer" x) > x)]) > (let ([y (if (not (list? y)) ....)]) > ....))) You mean (define (mega-fun x y z) (let ([x (let loop ([x x]) (if (not (integer? x)) (loop (raise-continuable-type-error 'mega-fun "integer" x)) x))]) ...)) [which could be asbtracted by some (define (must-be-integer who x) (if (integer? x) x (must-be-integer (raise-continuable-type-error who "integer" x)))) ] -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From john at johnnowak.com Sun Jul 13 21:35:25 2008 From: john at johnnowak.com (John Nowak) Date: Thu Mar 26 02:23:12 2009 Subject: [plt-scheme] require/typed and polymorphic signatures Message-ID: <5608BC44-C5F5-44BD-B47B-4C4DCDC0D821@johnnowak.com> I recently attempted to dive into Typed Scheme. Unfortunately, a few things have stopped me from using it. The major issue is that it seems impossible to import procedures with polymorphic signatures. For example, I'd like to do this: (require/typed srfi/1 (fold (All (a b) ((a b -> b) b (Listof a) -> b)))) Unfortunately, this fails because Typed Scheme is unable to generate an appropriate contract. Am I correct in thinking that such a require statement is current impossible? If so, might this be remedied in a future version? I'm aware this may not be considered feasible. - John From robby at cs.uchicago.edu Sun Jul 13 21:41:40 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:23:13 2009 Subject: [plt-scheme] require/typed and polymorphic signatures In-Reply-To: <5608BC44-C5F5-44BD-B47B-4C4DCDC0D821@johnnowak.com> References: <5608BC44-C5F5-44BD-B47B-4C4DCDC0D821@johnnowak.com> Message-ID: <932b2f1f0807131841l5aaf9ff8q4a07c8678b4b133b@mail.gmail.com> I consider this feasible but, at the moment, the contract library doesn't support it. There are some technical issues that I think I have to compromise on, but I've decided I'm willing to do that... so I hope to add this before too long. I'm not sure if there are type-level issues, tho. Robby On Sun, Jul 13, 2008 at 8:35 PM, John Nowak wrote: > I recently attempted to dive into Typed Scheme. Unfortunately, a few things > have stopped me from using it. The major issue is that it seems impossible > to import procedures with polymorphic signatures. For example, I'd like to > do this: > > (require/typed > srfi/1 > (fold (All (a b) ((a b -> b) b (Listof a) -> b)))) > > Unfortunately, this fails because Typed Scheme is unable to generate an > appropriate contract. Am I correct in thinking that such a require statement > is current impossible? If so, might this be remedied in a future version? > I'm aware this may not be considered feasible. > > - John > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From samth at ccs.neu.edu Sun Jul 13 21:50:50 2008 From: samth at ccs.neu.edu (Sam TH) Date: Thu Mar 26 02:23:13 2009 Subject: [plt-scheme] require/typed and polymorphic signatures In-Reply-To: <932b2f1f0807131841l5aaf9ff8q4a07c8678b4b133b@mail.gmail.com> References: <5608BC44-C5F5-44BD-B47B-4C4DCDC0D821@johnnowak.com> <932b2f1f0807131841l5aaf9ff8q4a07c8678b4b133b@mail.gmail.com> Message-ID: <63bb19ae0807131850x5bef2b54p1c8455cc873564fe@mail.gmail.com> On Sun, Jul 13, 2008 at 9:41 PM, Robby Findler wrote: > I consider this feasible but, at the moment, the contract library > doesn't support it. There are some technical issues that I think I > have to compromise on, but I've decided I'm willing to do that... so I > hope to add this before too long. I'm not sure if there are type-level > issues, tho. There aren't any type level issues, or at least not any that I know about. So using `require/typed' with polymorphic types is just waiting for support from the contract library. Thanks, sam th > > Robby > > On Sun, Jul 13, 2008 at 8:35 PM, John Nowak wrote: >> I recently attempted to dive into Typed Scheme. Unfortunately, a few things >> have stopped me from using it. The major issue is that it seems impossible >> to import procedures with polymorphic signatures. For example, I'd like to >> do this: >> >> (require/typed >> srfi/1 >> (fold (All (a b) ((a b -> b) b (Listof a) -> b)))) >> >> Unfortunately, this fails because Typed Scheme is unable to generate an >> appropriate contract. Am I correct in thinking that such a require statement >> is current impossible? If so, might this be remedied in a future version? >> I'm aware this may not be considered feasible. >> >> - John >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- sam th samth@ccs.neu.edu From matthias at ccs.neu.edu Sun Jul 13 22:58:05 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:23:13 2009 Subject: [plt-scheme] require/typed and polymorphic signatures In-Reply-To: <63bb19ae0807131850x5bef2b54p1c8455cc873564fe@mail.gmail.com> References: <5608BC44-C5F5-44BD-B47B-4C4DCDC0D821@johnnowak.com> <932b2f1f0807131841l5aaf9ff8q4a07c8678b4b133b@mail.gmail.com> <63bb19ae0807131850x5bef2b54p1c8455cc873564fe@mail.gmail.com> Message-ID: How about the (if (number? x) ... ...) issue when x has a Forall(X) type? We should do X - number? in the else branch, but this won't work for Robby's polymorphic contracts. -- Matthias On Jul 13, 2008, at 9:50 PM, Sam TH wrote: > On Sun, Jul 13, 2008 at 9:41 PM, Robby Findler > wrote: >> I consider this feasible but, at the moment, the contract library >> doesn't support it. There are some technical issues that I think I >> have to compromise on, but I've decided I'm willing to do that... >> so I >> hope to add this before too long. I'm not sure if there are type- >> level >> issues, tho. > > There aren't any type level issues, or at least not any that I know > about. So using `require/typed' with polymorphic types is just > waiting for support from the contract library. > > Thanks, > sam th > >> >> Robby >> >> On Sun, Jul 13, 2008 at 8:35 PM, John Nowak >> wrote: >>> I recently attempted to dive into Typed Scheme. Unfortunately, a >>> few things >>> have stopped me from using it. The major issue is that it seems >>> impossible >>> to import procedures with polymorphic signatures. For example, >>> I'd like to >>> do this: >>> >>> (require/typed >>> srfi/1 >>> (fold (All (a b) ((a b -> b) b (Listof a) -> b)))) >>> >>> Unfortunately, this fails because Typed Scheme is unable to >>> generate an >>> appropriate contract. Am I correct in thinking that such a >>> require statement >>> is current impossible? If so, might this be remedied in a future >>> version? >>> I'm aware this may not be considered feasible. >>> >>> - John >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > > -- > sam th > samth@ccs.neu.edu > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From robby at cs.uchicago.edu Sun Jul 13 23:02:39 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:23:13 2009 Subject: [plt-scheme] require/typed and polymorphic signatures In-Reply-To: References: <5608BC44-C5F5-44BD-B47B-4C4DCDC0D821@johnnowak.com> <932b2f1f0807131841l5aaf9ff8q4a07c8678b4b133b@mail.gmail.com> <63bb19ae0807131850x5bef2b54p1c8455cc873564fe@mail.gmail.com> Message-ID: <932b2f1f0807132002t694d2b43v293608c47b683ca8@mail.gmail.com> That's the compromise. It will return #f instead of blowing up (like I think it should). Many other primitives will blow up (car, function application) but the predicates won't. Robby On Sun, Jul 13, 2008 at 9:58 PM, Matthias Felleisen wrote: > > > How about the > > (if (number? x) > ... > ...) > > issue when x has a Forall(X) type? We should do X - number? in the else > branch, but this won't work for Robby's polymorphic contracts. > > -- Matthias > > On Jul 13, 2008, at 9:50 PM, Sam TH wrote: > >> On Sun, Jul 13, 2008 at 9:41 PM, Robby Findler >> wrote: >>> >>> I consider this feasible but, at the moment, the contract library >>> doesn't support it. There are some technical issues that I think I >>> have to compromise on, but I've decided I'm willing to do that... so I >>> hope to add this before too long. I'm not sure if there are type-level >>> issues, tho. >> >> There aren't any type level issues, or at least not any that I know >> about. So using `require/typed' with polymorphic types is just >> waiting for support from the contract library. >> >> Thanks, >> sam th >> >>> >>> Robby >>> >>> On Sun, Jul 13, 2008 at 8:35 PM, John Nowak wrote: >>>> >>>> I recently attempted to dive into Typed Scheme. Unfortunately, a few >>>> things >>>> have stopped me from using it. The major issue is that it seems >>>> impossible >>>> to import procedures with polymorphic signatures. For example, I'd like >>>> to >>>> do this: >>>> >>>> (require/typed >>>> srfi/1 >>>> (fold (All (a b) ((a b -> b) b (Listof a) -> b)))) >>>> >>>> Unfortunately, this fails because Typed Scheme is unable to generate an >>>> appropriate contract. Am I correct in thinking that such a require >>>> statement >>>> is current impossible? If so, might this be remedied in a future >>>> version? >>>> I'm aware this may not be considered feasible. >>>> >>>> - John >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>> >>>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >> >> >> >> -- >> sam th >> samth@ccs.neu.edu >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > > From cristian.baboi at gmail.com Mon Jul 14 02:00:53 2008 From: cristian.baboi at gmail.com (Cristian Baboi) Date: Thu Mar 26 02:23:13 2009 Subject: [plt-scheme] Self evaluating "objects" Message-ID: Hello! I've tried the following expression in PLT 4.0.2 and Gambit-C 4.2.8 and got different answers: (eval (lambda (x) x)) PLT > (eval (lambda (x) x)) # Gambit-C > (eval (lambda (x) x)) *** ERROR -- Ill-formed expression # 1> I've browsed trough R5RS and R6RS and I was not able to figure out which behavior is the right one. Is this implementation dependent or it is prescribed by some standard ? From jos.koot at telefonica.net Mon Jul 14 06:01:10 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:14 2009 Subject: [plt-scheme] Self evaluating "objects" References: Message-ID: <000701c8e598$8b5f2fc0$2101a8c0@uw2b2dff239c4d> Why bother about eval? Nevertheless: From: http://www.r6rs.org/final/html/r6rs-lib/r6rs-lib-Z-H-17.html#node_idx_1266 QUOTE (eval expression environment) procedure Evaluates expression in the specified environment and returns its value. Expression must be a syntactically valid Scheme expression represented as a datum value, and environment must be an environment, which can be created using the environment procedure described below. If the first argument to eval is determined not to be a syntactically correct expression, then eval must raise an exception with condition type &syntax. Specifically, if the first argument to eval is a definition or a splicing begin form containing a definition, it must raise an exception with condition type &syntax. UNQUOTE See also: http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-4.html#node_idx_52 In #lang scheme and mzscheme and pretty-big the value of a procedure is that procedure. There is #!r6rs though, but: #!r6rs (library (aap) (export) (import (rnrs eval (6)) (rnrs base (6)) (rnrs io simple (6))) (write (eval (lambda (x) x) (environment '(rnrs base (6)))))) writes #, which seems not to conform to R6RS, for a procedure is not a datum value. On the other hand with: (eval '(define a 1) (environment '(rnrs)))) an error is reported: define: not allowed in an expression context in: (define a 1) which does conform to R6RS. BTW both R5RS and R6RS require two arguments for eval (the expression to be evaluated and an environment) Jos ----- Original Message ----- From: "Cristian Baboi" To: Sent: Monday, July 14, 2008 8:00 AM Subject: [plt-scheme] Self evaluating "objects" > Hello! > > I've tried the following expression in PLT 4.0.2 and Gambit-C 4.2.8 and > got different answers: > > (eval (lambda (x) x)) > > > PLT >> (eval (lambda (x) x)) > # > > > Gambit-C >> (eval (lambda (x) x)) > *** ERROR -- Ill-formed expression > # > 1> > > I've browsed trough R5RS and R6RS and I was not able to figure out which > behavior is the right one. > Is this implementation dependent or it is prescribed by some standard ? > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080714/a899db82/attachment.htm From pivanyi at freemail.hu Mon Jul 14 08:01:49 2008 From: pivanyi at freemail.hu (Ivanyi Peter) Date: Thu Mar 26 02:23:14 2009 Subject: [plt-scheme] MzScheme: extending vs. embedding to build In-Reply-To: <3cbaf1c80807131657m468dbca5tcc01e66473e2ba40@mail.gmail.com> Message-ID: > First, I could write MzScheme extensions [1] for ncurses. The editor [...] > > mzscheme myeditor.ss some-file-to-edit.txt > > (The whole program with could be compiled to a native binary somehow?) I would suggest this, but compile your whole program into a binary. I use this method for several of my programs (educational or industrial). For example see: http://www.hexahedron.hu/personal/peteri/plt (The web site may be down for the moment.) Best regards, Peter Ivanyi ___________________________ Genertel casco szenz?ci?s ?ron! A Generteln?l elfelejtheti, amit eddig a casco d?jakr?l gondolt. Hogy mi?rt? J?rjon ut?na, k?rjen aj?nlatot most! http://ad.adverticum.net/b/cl,1,6022,249296,296182/click.prm From cristian.baboi at gmail.com Mon Jul 14 08:34:29 2008 From: cristian.baboi at gmail.com (Cristian Baboi) Date: Thu Mar 26 02:23:14 2009 Subject: [plt-scheme] Self evaluating "objects" In-Reply-To: <000701c8e598$8b5f2fc0$2101a8c0@uw2b2dff239c4d> References: <000701c8e598$8b5f2fc0$2101a8c0@uw2b2dff239c4d> Message-ID: On Mon, 14 Jul 2008 13:01:10 +0300, Jos Koot wrote: > Why bother about eval? Why not ? > Nevertheless: > > From: > http://www.r6rs.org/final/html/r6rs-lib/r6rs-lib-Z-H-17.html#node_idx_1266 > See also: http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-4.html#node_idx_52 I've read those. "A *SUBSET* of the Scheme objects is called datum values. These *INCLUDES* booleans, number objects, characters, symbols, and strings as well as lists and vectors whose elements are data. Each datum value may be represented in textual form as a syntactic datum, which can be written out and read back in without loss of information." > In #lang scheme and mzscheme and pretty-big the value of a procedure is > that procedure. There is #!r6rs though, but: > #!r6rs > (library (aap) > (export) > (import (rnrs eval (6)) (rnrs base (6)) (rnrs io simple (6))) > (write (eval (lambda (x) x) (environment '(rnrs base (6)))))) > > writes #, which seems not to conform to R6RS, for a procedure > is not a datum value. It seems so, but the subset called "datum values" is not written in the sections you quoted. Nevertheless it seems that the test "which can be written out and read back in without loss of information" fail for procedures. From cristian.baboi at gmail.com Mon Jul 14 10:22:43 2008 From: cristian.baboi at gmail.com (Cristian Baboi) Date: Thu Mar 26 02:23:15 2009 Subject: [plt-scheme] Self evaluating "objects" In-Reply-To: <000701c8e598$8b5f2fc0$2101a8c0@uw2b2dff239c4d> References: <000701c8e598$8b5f2fc0$2101a8c0@uw2b2dff239c4d> Message-ID: On Mon, 14 Jul 2008 13:01:10 +0300, Jos Koot wrote: > BTW both R5RS and R6RS require two arguments for eval (the expression to > be evaluated and an environment) Some more examples: (begin (define x 3) (eval 'x (scheme-report-environment 5)) ) (begin (define x 3) (eval 'x (interaction-environment)) ) both return 3 in Gambit-C, but the first gives "reference to undefined identifier: x" in PLT From czhu at cs.utah.edu Mon Jul 14 10:25:41 2008 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:23:15 2009 Subject: [plt-scheme] Self evaluating "objects" In-Reply-To: References: <000701c8e598$8b5f2fc0$2101a8c0@uw2b2dff239c4d> Message-ID: <487B61E5.4020702@cs.utah.edu> Cristian Baboi wrote: > > Some more examples: > > (begin > (define x 3) > (eval 'x (scheme-report-environment 5)) > ) > > (begin > (define x 3) > (eval 'x (interaction-environment)) > ) > > both return 3 in Gambit-C, but the first gives "reference to undefined > identifier: x" in PLT Your previous post does show that PLT is not comform to R6RS. But this one isn't. 'x is defined in interaction-environment but not scheme-report-environment. Chongkai From jos.koot at telefonica.net Mon Jul 14 10:32:47 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:15 2009 Subject: [plt-scheme] Self evaluating "objects" References: <000701c8e598$8b5f2fc0$2101a8c0@uw2b2dff239c4d> Message-ID: <001701c8e5be$7cfafe70$2101a8c0@uw2b2dff239c4d> In mzscheme (at top level only!!!) (begin (define x 3) (eval 'x)) --> 3 With mzscheme at all levels (begin (define x 3) (eval 'x (scheme-report-environment 5))) x is evaluated in a fresh namespace. I have played with namespaces a lot, but eventually I have been converted to modules and no longer use eval. Jos ----- Original Message ----- From: "Cristian Baboi" To: "Jos Koot" ; Sent: Monday, July 14, 2008 4:22 PM Subject: Re: [plt-scheme] Self evaluating "objects" > On Mon, 14 Jul 2008 13:01:10 +0300, Jos Koot > wrote: > > >> BTW both R5RS and R6RS require two arguments for eval (the expression to >> be evaluated and an environment) > > Some more examples: > > (begin > (define x 3) > (eval 'x (scheme-report-environment 5)) > ) > > (begin > (define x 3) > (eval 'x (interaction-environment)) > ) > > both return 3 in Gambit-C, but the first gives "reference to undefined > identifier: x" in PLT From jos.koot at telefonica.net Mon Jul 14 10:33:11 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:15 2009 Subject: [plt-scheme] Self evaluating "objects" References: <000701c8e598$8b5f2fc0$2101a8c0@uw2b2dff239c4d> Message-ID: <001801c8e5be$8b504660$2101a8c0@uw2b2dff239c4d> ----- Original Message ----- From: "Cristian Baboi" To: "Jos Koot" ; Sent: Monday, July 14, 2008 2:34 PM Subject: Re: [plt-scheme] Self evaluating "objects" > On Mon, 14 Jul 2008 13:01:10 +0300, Jos Koot > wrote: > >> Why bother about eval? > > Why not ? > >> Nevertheless: >> >> From: >> http://www.r6rs.org/final/html/r6rs-lib/r6rs-lib-Z-H-17.html#node_idx_1266 >> See also: http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-4.html#node_idx_52 > > I've read those. > > "A *SUBSET* of the Scheme objects is called datum values. These *INCLUDES* > booleans, number objects, characters, symbols, and strings as well as > lists and vectors whose elements are data. Each datum value may be > represented in textual form as a syntactic datum, which can be written out > and read back in without loss of information." > > >> In #lang scheme and mzscheme and pretty-big the value of a procedure is >> that procedure. There is #!r6rs though, but: > > >> #!r6rs >> (library (aap) >> (export) >> (import (rnrs eval (6)) (rnrs base (6)) (rnrs io simple (6))) >> (write (eval (lambda (x) x) (environment '(rnrs base (6)))))) >> >> writes #, which seems not to conform to R6RS, for a procedure >> is not a datum value. > > It seems so, but the subset called "datum values" is not written in the > sections you quoted. The second reference does describe the notion of "datum values". It does not require a procedure to be a datum value. > Nevertheless it seems that the test "which can be written out and read > back in without loss of information" fail for procedures. That is common to all Scheme implementations I know of. It is not too difficult to prepare a scheme *like* interpreter that internally represents all procedures and syntaxes by symbolic expressions, their environments included (but continuations excepted, that's a problem I did not yet solve; and of course such an interpreter has to offend against the rule of disjoint types; if a procedure is a symbolic expression, then it is not disjoint from symbolic expressions) Such an interpreter would be a toy rather than a useful tool. Jos > From cristian.baboi at gmail.com Mon Jul 14 10:39:40 2008 From: cristian.baboi at gmail.com (Cristian Baboi) Date: Thu Mar 26 02:23:15 2009 Subject: [plt-scheme] Self evaluating "objects" In-Reply-To: <487B61E5.4020702@cs.utah.edu> References: <000701c8e598$8b5f2fc0$2101a8c0@uw2b2dff239c4d> <487B61E5.4020702@cs.utah.edu> Message-ID: On Mon, 14 Jul 2008 17:25:41 +0300, Chongkai Zhu wrote: > Cristian Baboi wrote: >> >> Some more examples: >> >> (begin >> (define x 3) >> (eval 'x (scheme-report-environment 5)) >> ) >> >> (begin >> (define x 3) >> (eval 'x (interaction-environment)) >> ) >> >> both return 3 in Gambit-C, but the first gives "reference to undefined >> identifier: x" in PLT > Your previous post does show that PLT is not comform to R6RS. But this > one isn't. 'x is defined in interaction-environment but not > scheme-report-environment. > > Chongkai It was not my intention to show that PLT is not conform to R6RS! I only try to see how I can use scheme to evaluate dynamic generated code. This code does not work for example: (define (c) (let ((x 3)) (eval 'x )) ) (c) I know how to quote some code, but I cannot see how I can "unquote" it. From jos.koot at telefonica.net Mon Jul 14 10:55:58 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:15 2009 Subject: [plt-scheme] Self evaluating "objects" References: <000701c8e598$8b5f2fc0$2101a8c0@uw2b2dff239c4d> <487B61E5.4020702@cs.utah.edu> Message-ID: <000e01c8e5c1$b9ddf880$2101a8c0@uw2b2dff239c4d> There are environments and environments. A scheme report environment has nothing to do with the environment that is catched by a procedure in as construct like (let ((var expr) ...) (lambda (arg ...) expr))) and the environment that is used by eval. In PLT the scheme report environments are called namespaces. As far as I know there is no way of catching the LOCAL environment of the above lambda form. Or may be there is: making a syntax that cashes the origin of its calls and making eval a syntax that uses the cached origin to expand the expression to be evaluated (not trivial though). But I cannot find any reason to prepare such tools. Jos ----- Original Message ----- From: "Cristian Baboi" To: "Chongkai Zhu" Cc: "Jos Koot" ; Sent: Monday, July 14, 2008 4:39 PM Subject: Re: [plt-scheme] Self evaluating "objects" > On Mon, 14 Jul 2008 17:25:41 +0300, Chongkai Zhu wrote: > >> Cristian Baboi wrote: >>> >>> Some more examples: >>> >>> (begin >>> (define x 3) >>> (eval 'x (scheme-report-environment 5)) >>> ) >>> >>> (begin >>> (define x 3) >>> (eval 'x (interaction-environment)) >>> ) >>> >>> both return 3 in Gambit-C, but the first gives "reference to undefined >>> identifier: x" in PLT > > >> Your previous post does show that PLT is not comform to R6RS. But this >> one isn't. 'x is defined in interaction-environment but not >> scheme-report-environment. >> >> Chongkai > > It was not my intention to show that PLT is not conform to R6RS! > I only try to see how I can use scheme to evaluate dynamic generated code. > > This code does not work for example: > > (define (c) > (let ((x 3)) > (eval 'x )) > ) > > (c) > > I know how to quote some code, but I cannot see how I can "unquote" it. From czhu at cs.utah.edu Mon Jul 14 10:57:03 2008 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:23:15 2009 Subject: [plt-scheme] Self evaluating "objects" In-Reply-To: References: <000701c8e598$8b5f2fc0$2101a8c0@uw2b2dff239c4d> <487B61E5.4020702@cs.utah.edu> Message-ID: <487B693F.50708@cs.utah.edu> Cristian Baboi wrote: > > It was not my intention to show that PLT is not conform to R6RS! > I only try to see how I can use scheme to evaluate dynamic generated > code. > As it is always said, do NOT use 'eval. The only case as I know that 'eval is needed is a REPL (or something similar), and in that case, there is no need to have it access the environment in another level. Chongkai From jos.koot at telefonica.net Mon Jul 14 11:05:38 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:16 2009 Subject: [plt-scheme] Self evaluating "objects" References: <000701c8e598$8b5f2fc0$2101a8c0@uw2b2dff239c4d> <487B61E5.4020702@cs.utah.edu> Message-ID: <002f01c8e5c3$13e8b3a0$2101a8c0@uw2b2dff239c4d> ----- Original Message ----- From: "Cristian Baboi" snip > > I know how to quote some code, but I cannot see how I can "unquote" it. That's the whole point of quoting: quoting detaches the quoted text from its environment. Hence when unquoting, the environment of the original quotation is lost! A horse is an animal and a "horse" is a word. This is a statement, but "this" is a word that has nothing to do with the statement. May be QQ Quin can help you (although his books are not easily read) Jos From matthias at ccs.neu.edu Mon Jul 14 11:07:24 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:23:16 2009 Subject: [plt-scheme] Self evaluating "objects" In-Reply-To: <002f01c8e5c3$13e8b3a0$2101a8c0@uw2b2dff239c4d> References: <000701c8e598$8b5f2fc0$2101a8c0@uw2b2dff239c4d> <487B61E5.4020702@cs.utah.edu> <002f01c8e5c3$13e8b3a0$2101a8c0@uw2b2dff239c4d> Message-ID: <5697C159-C656-4D46-98CC-450A1D779B9A@ccs.neu.edu> On Jul 14, 2008, at 11:05 AM, Jos Koot wrote: > May be QQ Quin can help you (although his books are not easily read) And yet highly rewarding. I should have known that you know it from the source. Too few do, including researchers who take referential transparency into their mouths all the time. -- Matthias From jos.koot at telefonica.net Mon Jul 14 11:14:19 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:16 2009 Subject: [plt-scheme] Self evaluating "objects" References: <000701c8e598$8b5f2fc0$2101a8c0@uw2b2dff239c4d><487B61E5.4020702@cs.utah.edu> <002f01c8e5c3$13e8b3a0$2101a8c0@uw2b2dff239c4d> Message-ID: <003e01c8e5c4$4a7f0c10$2101a8c0@uw2b2dff239c4d> Correction: W. V. Quine. Mathematical logic. Jos ----- Original Message ----- From: "Jos Koot" To: "Chongkai Zhu" ; "Cristian Baboi" Cc: Sent: Monday, July 14, 2008 5:05 PM Subject: Re: [plt-scheme] Self evaluating "objects" > > ----- Original Message ----- > From: "Cristian Baboi" > snip >> >> I know how to quote some code, but I cannot see how I can "unquote" it. > > That's the whole point of quoting: quoting detaches the quoted text from > its environment. Hence when unquoting, the environment of the original > quotation is lost! > A horse is an animal and a "horse" is a word. > This is a statement, but "this" is a word that has nothing to do with the > statement. > May be QQ Quin can help you (although his books are not easily read) > Jos > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From cristian.baboi at gmail.com Mon Jul 14 12:14:25 2008 From: cristian.baboi at gmail.com (Cristian Baboi) Date: Thu Mar 26 02:23:16 2009 Subject: [plt-scheme] Self evaluating "objects" In-Reply-To: <003e01c8e5c4$4a7f0c10$2101a8c0@uw2b2dff239c4d> References: <000701c8e598$8b5f2fc0$2101a8c0@uw2b2dff239c4d> <487B61E5.4020702@cs.utah.edu> <002f01c8e5c3$13e8b3a0$2101a8c0@uw2b2dff239c4d> <003e01c8e5c4$4a7f0c10$2101a8c0@uw2b2dff239c4d> Message-ID: On Mon, 14 Jul 2008 18:14:19 +0300, Jos Koot wrote: > Correction: W. V. Quine. > Mathematical logic. > Jos >>> >>> I know how to quote some code, but I cannot see how I can "unquote" it. >> >> That's the whole point of quoting: quoting detaches the quoted text >> from its environment. Hence when unquoting, the environment of the >> original quotation is lost! Thank you. Here is an example: #lang scheme (define (f x y) (eval `(let ((x ,x) (y ,y)) ,(read))) ) (f 5 6) From jensaxel at soegaard.net Mon Jul 14 13:13:04 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:23:17 2009 Subject: [plt-scheme] A Square Canvas In-Reply-To: <4879ECFB.3070108@soegaard.net> References: <4879DD7C.9060308@soegaard.net> <932b2f1f0807130436l6e3abb77q387e2058f67bd5eb@mail.gmail.com> <4879EA17.3080503@soegaard.net> <932b2f1f0807130447xceb8f24p3d078dccf8d67b30@mail.gmail.com> <4879ECFB.3070108@soegaard.net> Message-ID: <487B8920.7020505@soegaard.net> Jens Axel Soegaard wrote: > Robby Findler wrote: >> Is the goal to have a stretchable canvas, but one that always stays >> square? > Yes. >> For that you'd need to make your own geometry manager, I'm >> afraid. This is the relevant part of the docs: >> >> http://docs.plt-scheme.org/gui/windowing-overview.html#(part._new-containers) >> >> > I'll take a look. Here is a solution meant for the archives. I have made an alternative to horizontal-panel%. The square-panel% behaves as a horizon-panel% when respect to borders, margin, and vertical alignment. The children all become quadratic. The stretchable children will be stretched with the same magnification factor. In my use case, where I needed a stretchable, quadratic canvas, all I need to do is to place a single canvas as the only child of a square-panel%. -- Jens Axel S?gaard -------------- next part -------------- #lang scheme/gui (require "square-panel.ss") (let* ([frame (new frame% [label "Test of Square Canvas"])] [square-panel (new square-panel% [parent frame] [border 50] [spacing 20] [alignment '(left center)])]) (define (build-canvas stretch? size-x size-y pen-color brush-color) (letrec ([pen (make-object pen% pen-color 1 'solid)] [brush (make-object brush% brush-color 'solid)] [canvas (new canvas% [parent square-panel] [style '()] [min-width size-x] [min-height size-y] [stretchable-width stretch?] [stretchable-height stretch?] [paint-callback (? (b dc) (let-values ([(w h) (send canvas get-size)]) (let ([dc (send canvas get-dc)]) (send dc set-pen pen) (send dc set-brush brush) (send dc draw-rectangle 0 0 w h) (send dc draw-line 0 0 w h) (send dc draw-line 0 h w 0))))])]) canvas)) (build-canvas #t 100 50 "red" "white") (build-canvas #f 200 100 "green" "black") (build-canvas #t 50 100 "white" "red") (build-canvas #f 150 100 "yellow" "green") (send frame show #t)) -------------- next part -------------- A non-text attachment was scrubbed... Name: example.png Type: image/png Size: 11622 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080714/dcf7263c/example.png -------------- next part -------------- #lang scheme/gui (provide square-panel%) ; Horizontal panel where all children are quadratic. ; All children are magnified with the same factor. ; That is, stretchability is ignored. ; And so is margins. (define square-panel% (let () (define-syntax with-info (syntax-rules () [(with-info (w h hs vs) i body ...) (let ([w (list-ref i 0)] [h (list-ref i 1)] [hs (list-ref i 2)] [vs (list-ref i 3)]) body ...)])) (class panel% (define/override (container-size infos) (let* ([c (foldl (? (i a) (with-info (w h hs vs) i (let ([m (max w h)]) (match a [(list aw ah) (list (+ aw m) (max ah m))])))) '(0 0) infos)] [b (send this border)] [s (send this spacing)] [n (length infos)]) (match c [(list w h) (values (+ w (* 2 b) (* s (max 0 (- n 1)))) (+ h (* 2 b)))]))) (define/override (place-children infos width height) ; place the children within an width x height area (let* ([border (send this border)] [spacing (send this spacing)] [n (length infos)] [width (- width (* 2 border) (* spacing (max 0 (- n 1))))] [height (- height (* 2 border))] [total-horiz (foldl (? (i a) (with-info (w h hs vs) i (+ a (max w h)))) 0 infos)] [total-stretchable-horiz (foldl (? (i a) (with-info (w h hs vs) i (if (and hs vs) (+ a (max w h)) a))) 0 infos)] [non-stretchable-horiz (- total-horiz total-stretchable-horiz)] [total-vert (foldl (? (i a) (with-info (w h hs vs) i (max a w h))) 0 infos)] [total-stretchable-vert (foldl (? (i a) (with-info (w h hs vs) i (if (and hs vs) (max a w h) a))) 0 infos)] [vert-factor (/ height total-stretchable-vert)] [horiz-factor (/ (- width non-stretchable-horiz) total-stretchable-horiz)] [factor (min vert-factor horiz-factor)] [b border] [s spacing]) (let-values ([(horiz-alignment vert-alignment) (send this get-alignment)]) (define (mag s) (inexact->exact (floor (* factor s)))) (reverse (first (foldl (? (i a) (match a [(list specs x) (with-info (w h hs vs) i (let* ([m (max w h)] [m (if (and hs vs) (mag m) m)] [y (case vert-alignment [(top) b] [(center) (+ b (- (quotient height 2) (quotient m 2)))] [(bottom) (+ b (- height m))] [else (error 'unknown-alignment)])]) (list (cons (list x y m m) specs) (+ x m s))))])) (list '() b) infos)))))) (super-new)))) From robby at cs.uchicago.edu Mon Jul 14 13:29:36 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:23:17 2009 Subject: [plt-scheme] A Square Canvas In-Reply-To: <487B8920.7020505@soegaard.net> References: <4879DD7C.9060308@soegaard.net> <932b2f1f0807130436l6e3abb77q387e2058f67bd5eb@mail.gmail.com> <4879EA17.3080503@soegaard.net> <932b2f1f0807130447xceb8f24p3d078dccf8d67b30@mail.gmail.com> <4879ECFB.3070108@soegaard.net> <487B8920.7020505@soegaard.net> Message-ID: <932b2f1f0807141029m157fcabg47c08414aec1b32a@mail.gmail.com> Very nice! Robby From yinso.chen at gmail.com Mon Jul 14 15:58:32 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:23:18 2009 Subject: [plt-scheme] s-exp and custom reader Message-ID: <779bf2730807141258oc1dc07buef059ec20e6f00e2@mail.gmail.com> Hi - in thread http://list.cs.brown.edu/pipermail/plt-scheme/2008-June/025184.html Danny alluded to using the s-exp module for custom language, e.g. #lang s-exp But if the language has uses its own custom reader procedure, then the above doesn't appear to work. My current solution is to basically create my own s-exp and call it via #reader instead of #lang, e.g. #reader ... Is there a simpler solution on the line of `#lang s-exp`? It would be nice for `#lang` to accept language forms such as `(lib ...)` or `(planet ...)` - thoughts? Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080714/062ed1c4/attachment.htm From anton.tayanovskyy at gmail.com Mon Jul 14 16:13:05 2008 From: anton.tayanovskyy at gmail.com (Anton Tayanovskyy) Date: Thu Mar 26 02:23:18 2009 Subject: [plt-scheme] s-exp and custom reader In-Reply-To: <779bf2730807141258oc1dc07buef059ec20e6f00e2@mail.gmail.com> References: <779bf2730807141258oc1dc07buef059ec20e6f00e2@mail.gmail.com> Message-ID: Hi, Sorry, your URL http://list.cs.brown.edu/pipermail/plt-scheme/2008-June/025184.htm is giving me 404 Not Found. From the manual: A sequence #lang ?name? is equivalent to #reader ?name?/lang/reader http://docs.plt-scheme.org/reference/reader.html#(part._parse-reader) So you can use #lang instead of #reader. #lang s-exp must mean #reader s-exp/lang/reader Not sure what your exact problem is, but I guess you can always hack the s-exp/lang/reader.ss module to suit your needs, making, for instance, a my-s-exp/lang/reader.ss module. Here is its source (my installation is outdated, 4.0.0): (module reader scheme/base (provide (rename-out [*read read] [*read-syntax read-syntax])) (define (*read in) (wrap in read)) (define (*read-syntax src in) (wrap in (lambda (in) (read-syntax src in)))) (define (wrap port read) (let ([body (let loop ([a null]) (let ([v (read port)]) (if (eof-object? v) (reverse a) (loop (cons v a)))))]) (let* ([p-name (object-name port)] [name (if (path? p-name) (let-values ([(base name dir?) (split-path p-name)]) (string->symbol (path->string (path-replace-suffix name #"")))) 'page)] [id 'doc]) `(module ,name . ,body))))) Cheers, --A On Mon, Jul 14, 2008 at 10:58 PM, YC wrote: > Hi - > > in thread > http://list.cs.brown.edu/pipermail/plt-scheme/2008-June/025184.html Danny > alluded to using the s-exp module for custom language, e.g. > > #lang s-exp > > But if the language has uses its own custom reader procedure, then the above > doesn't appear to work. My current solution is to basically create my own > s-exp and call it via #reader instead of #lang, e.g. > > #reader ... > > Is there a simpler solution on the line of `#lang s-exp`? It would be nice > for `#lang` to accept language forms such as `(lib ...)` or `(planet ...)` - > thoughts? > > Thanks, > yc > > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From yinso.chen at gmail.com Mon Jul 14 16:34:45 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:23:19 2009 Subject: [plt-scheme] s-exp and custom reader In-Reply-To: References: <779bf2730807141258oc1dc07buef059ec20e6f00e2@mail.gmail.com> Message-ID: <779bf2730807141334n895aadbk93e87ea57badaf33@mail.gmail.com> On Mon, Jul 14, 2008 at 1:13 PM, Anton Tayanovskyy < anton.tayanovskyy@gmail.com> wrote: > > From the manual: > > A sequence #lang ?name? is equivalent to #reader ?name?/lang/reader > > http://docs.plt-scheme.org/reference/reader.html#(part._parse-reader) > > So you can use #lang instead of #reader. > Yes - except `#lang` cannot handle all module spec such as `lib` or `planet`module path. `s-exp` will use the next datum as the module path, but AFAICT `s-exp`doesn't allow the use of custom reader (which my custom language requires), and hence I ended up having to use #reader and hack my own s-exp module if I want to use `(planet ...)` as the module resolver. > > Not sure what your exact problem is, but I guess you can always hack > the s-exp/lang/reader.ss module to suit your needs, making, for > instance, a my-s-exp/lang/reader.ss module. That's what I did, thanks. But in order to use `(planet ...)` path resolver - it appears I need to use `#reader` instead of `#lang`. Hence I'm interesting in seeing `#lang` support more module specs. Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080714/c6ed630c/attachment.html From samth at ccs.neu.edu Mon Jul 14 16:50:27 2008 From: samth at ccs.neu.edu (Sam TH) Date: Thu Mar 26 02:23:19 2009 Subject: [plt-scheme] s-exp and custom reader In-Reply-To: <779bf2730807141334n895aadbk93e87ea57badaf33@mail.gmail.com> References: <779bf2730807141258oc1dc07buef059ec20e6f00e2@mail.gmail.com> <779bf2730807141334n895aadbk93e87ea57badaf33@mail.gmail.com> Message-ID: <63bb19ae0807141350g304a4b75l1099a878c6821b28@mail.gmail.com> It should be fairly easy to write a language like `s-exp' but where the reader and the language are both specified. Invocations would look something like this: #lang custom (lib "my-reader.ss") (lib "my-lang.ss") ..code goes here.. sam th On Mon, Jul 14, 2008 at 4:34 PM, YC wrote: > > On Mon, Jul 14, 2008 at 1:13 PM, Anton Tayanovskyy > wrote: >> >> From the manual: >> >> A sequence #lang ?name? is equivalent to #reader ?name?/lang/reader >> >> http://docs.plt-scheme.org/reference/reader.html#(part._parse-reader) >> >> So you can use #lang instead of #reader. > > Yes - except `#lang` cannot handle all module spec such as `lib` or `planet` > module path. `s-exp` will use the next datum as the module path, but AFAICT > `s-exp` doesn't allow the use of custom reader (which my custom language > requires), and hence I ended up having to use #reader and hack my own s-exp > module if I want to use `(planet ...)` as the module resolver. > >> >> Not sure what your exact problem is, but I guess you can always hack >> the s-exp/lang/reader.ss module to suit your needs, making, for >> instance, a my-s-exp/lang/reader.ss module. > > That's what I did, thanks. But in order to use `(planet ...)` path resolver > - it appears I need to use `#reader` instead of `#lang`. Hence I'm > interesting in seeing `#lang` support more module specs. > > Thanks, > yc > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- sam th samth@ccs.neu.edu From pivanyi at freemail.hu Mon Jul 14 17:24:37 2008 From: pivanyi at freemail.hu (Ivanyi Peter) Date: Thu Mar 26 02:23:19 2009 Subject: [plt-scheme] PLT-Scheme 402 extension Message-ID: Hi, This question seems to come up at every major revision. As always I think the answer is very simple, but I cannot find it in the documentation. I have an extension, a dll file under Windows. I would like to use it under PLT-Scheme 402. In v372 I loaded it in by using: (require "e2curve.scm") and the e2curve.dll file is in the directory: compiled/native/win32/i386/3m My question is: how can I do it in PLT-Scheme 402? Has something changed in this regard? Thanks for the help. Best regards, Peter Ivanyi ___________________________ Genertel casco szenz?ci?s ?ron! A Generteln?l elfelejtheti, amit eddig a casco d?jakr?l gondolt. Hogy mi?rt? J?rjon ut?na, k?rjen aj?nlatot most! http://ad.adverticum.net/b/cl,1,6022,249296,296182/click.prm From yinso.chen at gmail.com Mon Jul 14 17:27:18 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:23:20 2009 Subject: [plt-scheme] s-exp and custom reader In-Reply-To: <63bb19ae0807141350g304a4b75l1099a878c6821b28@mail.gmail.com> References: <779bf2730807141258oc1dc07buef059ec20e6f00e2@mail.gmail.com> <779bf2730807141334n895aadbk93e87ea57badaf33@mail.gmail.com> <63bb19ae0807141350g304a4b75l1099a878c6821b28@mail.gmail.com> Message-ID: <779bf2730807141427k604011bev5ec55c0c26ef7e34@mail.gmail.com> On Mon, Jul 14, 2008 at 1:50 PM, Sam TH wrote: > It should be fairly easy to write a language like `s-exp' but where > the reader and the language are both specified. Invocations would > look something like this: > > #lang custom (lib "my-reader.ss") (lib "my-lang.ss") > ..code goes here.. > Agreed - it should be fairly straight forward. But as `#lang` cannot take a `(planet ...)` module spec - the language custom will have to be built-in instead of user supplied, otherwise anyone doing this will have to manually copy the custom lib to collects-dir with each upgrade. These solutions came about because of the restrictions placed on `#lang`. Are there technical difficulties for `#lang` to handle `(planet ...)`? The nice thing of `#lang` versus `#reader` is of course that `#lang` denotes the use of a language... Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080714/85f475a2/attachment.htm From czhu at cs.utah.edu Mon Jul 14 17:30:29 2008 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:23:20 2009 Subject: [plt-scheme] PLT-Scheme 402 extension In-Reply-To: References: Message-ID: <487BC575.4090302@cs.utah.edu> Ivanyi Peter wrote: > Hi, > > This question seems to come up at every major revision. > As always I think the answer is very simple, but I cannot > find it in the documentation. > > I have an extension, a dll file under Windows. I would like > to use it under PLT-Scheme 402. In v372 I loaded it in by using: > > (require "e2curve.scm") > > and the e2curve.dll file is in the directory: > > compiled/native/win32/i386/3m > > My question is: how can I do it in PLT-Scheme 402? > The same way. > Has something changed in this regard? > > No. > Thanks for the help. > > Best regards, > > Peter Ivanyi > > From pivanyi at freemail.hu Mon Jul 14 17:53:06 2008 From: pivanyi at freemail.hu (Ivanyi Peter) Date: Thu Mar 26 02:23:20 2009 Subject: [plt-scheme] PLT-Scheme 402 extension In-Reply-To: <487BC575.4090302@cs.utah.edu> Message-ID: Chongkai Zhu ?rta: > > My question is: how can I do it in PLT-Scheme 402? > The same way. > > Has something changed in this regard? > No. Hmmm. Ok. I start-up DrScheme. Language is set to either Pretty big or Module. When I RUN the program DrScheme reports that open-input-file: cannot open input file: "D:\peteri\work\programs\sx\plt\collects\cubic\e2curve.scm" (The system cannot find the file specified.; errno=2) But if I type into the interactive window: (require "e2curve") that works. How is it possible? Thanks. Best regards, Peter Ivanyi ___________________________ Genertel casco szenz?ci?s ?ron! A Generteln?l elfelejtheti, amit eddig a casco d?jakr?l gondolt. Hogy mi?rt? J?rjon ut?na, k?rjen aj?nlatot most! http://ad.adverticum.net/b/cl,1,6022,249296,296182/click.prm From czhu at cs.utah.edu Mon Jul 14 18:06:21 2008 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:23:21 2009 Subject: [plt-scheme] PLT-Scheme 402 extension In-Reply-To: References: Message-ID: <487BCDDD.7060301@cs.utah.edu> Not sure what is happening on your computer. I have do the same for v3.99 (for a lot of them) and v4.01, and it always works. The only difference is that I (require "XXXXX.ss") My Windows system broke a few weeks ago, and I haven't install MSVC yet, so I can't do any test now. Could you please send me your dll file (privately)? Chongkai Ivanyi Peter wrote: > Hmmm. Ok. > I start-up DrScheme. > Language is set to either Pretty big or Module. > When I RUN the program DrScheme reports that > > open-input-file: cannot open input file: > "D:\peteri\work\programs\sx\plt\collects\cubic\e2curve.scm" > (The system cannot find the file specified.; errno=2) > > But if I type into the interactive window: > > (require "e2curve") > > that works. How is it possible? > > Thanks. > > Best regards, > > Peter Ivanyi > > > ___________________________ > Genertel casco szenz?ci?s ?ron! > > A Generteln?l elfelejtheti, amit eddig a casco d?jakr?l gondolt. Hogy mi?rt? J?rjon ut?na, k?rjen aj?nlatot most! > http://ad.adverticum.net/b/cl,1,6022,249296,296182/click.prm > From pivanyi at freemail.hu Tue Jul 15 09:20:20 2008 From: pivanyi at freemail.hu (Ivanyi Peter) Date: Thu Mar 26 02:23:21 2009 Subject: [plt-scheme] PLT-Scheme 402 extension In-Reply-To: <487BCDDD.7060301@cs.utah.edu> Message-ID: Hi, Bummer!!! As I have sent the files to you, I have just discovered what is wrong. I am sorry to say, but I was right, something has changed! It used to be e2curve.dll but now it should be e2curve_ss.dll Observe the underline plus 'ss', which it looks is a must. Thanks for the help. Best regards, Peter Ivanyi ___________________________ Genertel casco szenz?ci?s ?ron! A Generteln?l elfelejtheti, amit eddig a casco d?jakr?l gondolt. Hogy mi?rt? J?rjon ut?na, k?rjen aj?nlatot most! http://ad.adverticum.net/b/cl,1,6022,249296,296182/click.prm From mflatt at cs.utah.edu Tue Jul 15 09:29:07 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:21 2009 Subject: [plt-scheme] s-exp and custom reader In-Reply-To: <779bf2730807141427k604011bev5ec55c0c26ef7e34@mail.gmail.com> References: <779bf2730807141258oc1dc07buef059ec20e6f00e2@mail.gmail.com> <779bf2730807141334n895aadbk93e87ea57badaf33@mail.gmail.com> <63bb19ae0807141350g304a4b75l1099a878c6821b28@mail.gmail.com> <779bf2730807141427k604011bev5ec55c0c26ef7e34@mail.gmail.com> Message-ID: <20080715132909.C1ABB6500AD@mail-svr1.cs.utah.edu> At Mon, 14 Jul 2008 14:27:18 -0700, YC wrote: > On Mon, Jul 14, 2008 at 1:50 PM, Sam TH wrote: > > > It should be fairly easy to write a language like `s-exp' but where > > the reader and the language are both specified. Invocations would > > look something like this: > > > > #lang custom (lib "my-reader.ss") (lib "my-lang.ss") > > ..code goes here.. > > > > Agreed - it should be fairly straight forward. But as `#lang` cannot > take a `(planet > ...)` module spec - the language custom will have to be built-in instead of > user supplied, otherwise anyone doing this will have to manually copy the > custom lib to collects-dir with each upgrade. You can also use #lang planet where is the "symbol" form of a planet path. This doesn't seem to be documented anywhere. Also, `#lang planet' handles syntactic mistakes in badly. We'll work on those problems. > These solutions came about because of the restrictions placed on `#lang`. > Are there technical difficulties for `#lang` to handle `(planet ...)`? We're trying to not bias the syntax of a language specification after `#lang' to Scheme --- or even to S-expression syntax. So that's why `(planet ...)' and other S-expression variations are not supported in that position. Matthew From grettke at acm.org Tue Jul 15 09:55:21 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:21 2009 Subject: [plt-scheme] PLT-Scheme 402 extension In-Reply-To: References: <487BCDDD.7060301@cs.utah.edu> Message-ID: <756daca50807150655j18bbdc0fg23735821ae3a7c30@mail.gmail.com> > It used to be > > e2curve.dll > > but now it should be > > e2curve_ss.dll Here is why, from /doc/release-notes/mzscheme/MzScheme_4.txt: The naming convention for compiled files has changed to preserve the original file suffix. For example, the bytecode version of "x.ss" is now named "x_ss.zo". The "_loader" protocol for native-code extensions is no longer supported. From noelwelsh at gmail.com Tue Jul 15 11:00:24 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:23:21 2009 Subject: [plt-scheme] Extending in-vector with start, stop, and step Message-ID: Hi all, I've extended in-vector to handle start, stop, and step parameters, in line with in-range. Prototype implementation below (it needs more error checking, and doesn't work when used outside comprehensions; otherwise it passes all my tests). Is there any interest in adding this to the core of PLT Scheme? I've also defined for/vector, for/vector/fold, and in-vector-reverse (though these don't collide with PLT built-ins, so I'm happier to use them standalone). Cheers, Noel Implementation, named ein-vector to avoid name collision: (define-for-syntax (:ein-vector stx) (syntax-case stx () [((x) (ein-vector v)) (:ein-vector (syntax ((x) (ein-vector v 0 #f 1))))] [((x) (ein-vector v start)) (:ein-vector (syntax ((x) (ein-vector v start #f 1))))] [((x) (ein-vector v start stop)) (:ein-vector (syntax ((x) (ein-vector v start stop 1))))] [((x) (ein-vector v start stop step)) #'[(x) (:do-in ;; Outer bindings ;; Prevent multiple evaluation ([(v* stop*) (let ([vec v] [stop* stop]) (if stop* (values vec stop*) (values vec (vector-length vec))))] [(start*) start] [(step*) step]) ;; Outer check ;; TODO: Raise exception on failure (let ([length (vector-length v*)]) (and (>= start* 0) (<= start* stop*) (<= stop* length) (> step* 0))) ;; Loop bindings ([idx start*]) ;; Pos guard (< idx stop*) ;; Inner bindings ([(x) (vector-ref v* idx)]) ;; Pre guard #t ;; Post guard #t ;; Loop args ((+ idx step)))]])) (define-sequence-syntax ein-vector ;; TODO: Extend to handle use outside comprehensions (lambda () #'in-vector) :ein-vector) Tests: (test-case "in-vector" (check-equal? (for/list ([v (in-vector #(1 2 3 4))]) v) '(1 2 3 4))) (test-case "in-vector w/ start" (check-equal? (for/list ([v (ein-vector #(1 2 3 4) 1)]) v) '(2 3 4))) (test-case "in-vector w/ start & stop" (check-equal? (for/list ([v (ein-vector #(1 2 3 4 5) 1 4)]) v) '(2 3 4))) (test-case "in-vector w/ start & stop & step" (check-equal? (for/list ([v (ein-vector #(0 1 2 3 4 5 6 7) 1 5 2)]) v) '(1 3))) (test-case "in-vector evaluates vector once" (let ([count 0]) (check-equal? (for/list ([v (ein-vector (begin (set! count (add1 count)) #(1 2 3)))]) v) '(1 2 3)) (check-equal? count 1))) From goetter at mazama.net Tue Jul 15 11:15:31 2008 From: goetter at mazama.net (Ben Goetter) Date: Thu Mar 26 02:23:21 2009 Subject: [plt-scheme] MzScheme: extending vs. embedding to build a text editor In-Reply-To: <20080714000339.CCBCC650058@mail-svr1.cs.utah.edu> References: <3cbaf1c80807131657m468dbca5tcc01e66473e2ba40@mail.gmail.com> <20080714000339.CCBCC650058@mail-svr1.cs.utah.edu> Message-ID: <487CBF13.9050209@mazama.net> Matthew Flatt wrote: > At Sun, 13 Jul 2008 16:57:12 -0700, "Peter Michaux" wrote: > >> First, I could write MzScheme extensions [1] for ncurses. > I would do it this way, but probably using `scheme/foreign' instead of > creating an extension: > > http://docs.plt-scheme.org/foreign/index.html > Yes, no need for an extension. ncurses is quite straightforward to use with the PLT FFI. The following uses the v360/372-era FFI syntax. ---this is curses.scm--- (module curses mzscheme (require (lib "foreign.ss")) (unsafe!) (provide initscr cbreak noecho move addch addstr refresh wgetch getch endwin get-cols get-lines) (define libcurses (ffi-lib (if (eq? (system-type) 'windows) "pdcurses" "libncurses"))) (define initscr (get-ffi-obj "initscr" libcurses (_fun -> _pointer))) (define cbreak (get-ffi-obj "cbreak" libcurses (_fun -> _int))) (define noecho (get-ffi-obj "noecho" libcurses (_fun -> _int))) (define move (get-ffi-obj "move" libcurses (_fun _int _int -> _int))) (define _chtype (make-ctype _int char->integer integer->char)) (define addch (get-ffi-obj "addch" libcurses (_fun _chtype -> _int))) (define addstr (get-ffi-obj "addstr" libcurses (_fun _string/locale -> _int))) (define refresh (get-ffi-obj "refresh" libcurses (_fun -> _int))) (define _win (_cpointer "CURSES WINDOW")) (define wgetch (get-ffi-obj "wgetch" libcurses (_fun _win -> _chtype))) (define stdscr (make-c-parameter "stdscr" libcurses _win)) (define (getch) (wgetch (stdscr))) (define COLS (make-c-parameter "COLS" libcurses _int)) (define LINES (make-c-parameter "LINES" libcurses _int)) ; had trouble exporting these two for some reason... maybe case sensitivity doesn't work across module borders? (define (get-cols) (COLS)) (define (get-lines) (LINES)) (define endwin (get-ffi-obj "endwin" libcurses (_fun -> _int))) ) ; module curses ---this is a trivial test of the above--- (require "curses.scm") (define (test) (dynamic-wind (lambda () (initscr) (cbreak) (noecho)) (lambda () (move 8 10) (addstr "Hello, World!") (addch #\newline) (addstr (number->string (get-cols))) (addstr " columns, ") (addstr (number->string (get-lines))) (addstr " lines.") (addch #\newline) (addstr "Press any key to continue.") (refresh) (getch)) ; where's the "any" key? (lambda () (endwin)) )) From pivanyi at freemail.hu Tue Jul 15 13:13:05 2008 From: pivanyi at freemail.hu (Ivanyi Peter) Date: Thu Mar 26 02:23:22 2009 Subject: [plt-scheme] More PLT-Scheme 402 extension Message-ID: Hi all, Two little questions: - What is concept behind the naming convention for the libmred3m_6m5fio.dll file? What is 6, m, 5, f, i, o? - Another question is related to probably the immutable lists. I want to pass a "normal" list to a function defined in an extension. However I have a problem with SCHEME_PAIRP. Is anything wrong in the code snippet below? Maybe the extension receives some other kind of list? Thanks for the help, Best regards, Peter Ivanyi static void get_coord(Scheme_Object **argv, int iarg, double *coord) { Scheme_Object *coord_car; Scheme_Object *coord_cdr; int icoord; coord_cdr = argv[iarg]; for(icoord = 0; icoord < 3; icoord++) { /* this check does not work in 402 ???? */ if(!SCHEME_PAIRP(coord_cdr)) { scheme_signal_error("e2curve: arg %d: must be a 3 element list", iarg+1); } ___________________________ Genertel casco szenz?ci?s ?ron! A Generteln?l elfelejtheti, amit eddig a casco d?jakr?l gondolt. Hogy mi?rt? J?rjon ut?na, k?rjen aj?nlatot most! http://ad.adverticum.net/b/cl,1,6022,249296,296182/click.prm From petermichaux at gmail.com Tue Jul 15 13:25:29 2008 From: petermichaux at gmail.com (Peter Michaux) Date: Thu Mar 26 02:23:22 2009 Subject: [plt-scheme] MzScheme: extending vs. embedding to build a text editor In-Reply-To: <487CBF13.9050209@mazama.net> References: <3cbaf1c80807131657m468dbca5tcc01e66473e2ba40@mail.gmail.com> <20080714000339.CCBCC650058@mail-svr1.cs.utah.edu> <487CBF13.9050209@mazama.net> Message-ID: <3cbaf1c80807151025i53998bddo1b7774f13738fa0f@mail.gmail.com> On Tue, Jul 15, 2008 at 8:15 AM, Ben Goetter wrote: [snip] > Yes, no need for an extension. ncurses is quite straightforward to use with > the PLT FFI. The following uses the v360/372-era FFI syntax. > > ---this is curses.scm--- > (module curses mzscheme > > (require (lib "foreign.ss")) > (unsafe!) > > (provide > initscr cbreak noecho move addch addstr refresh wgetch getch endwin > get-cols get-lines) > > (define libcurses (ffi-lib (if (eq? (system-type) 'windows) "pdcurses" > "libncurses"))) [snip] Ben thanks for this example. I just tried it with MzScheme 4.0.2 and it seemed to work. This example will give me a great jump start learning about ncurses integration for text user interfaces. Thanks again, Peter From mflatt at cs.utah.edu Tue Jul 15 13:29:40 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:22 2009 Subject: [plt-scheme] More PLT-Scheme 402 extension In-Reply-To: References: Message-ID: <20080715172940.390DF6500B9@mail-svr1.cs.utah.edu> At Tue, 15 Jul 2008 19:13:05 +0200 (CEST), Ivanyi Peter wrote: > Two little questions: > - What is concept behind the naming convention for the > libmred3m_6m5fio.dll file? What is 6, m, 5, f, i, o? It encodes the version number. As the version numbers got syntactically bigger with v4, we changed the encoding to keep it compact. The `dynext/filename-version' library implements the encoding. > - Another question is related to probably the immutable lists. > I want to pass a "normal" list to a function defined in an > extension. However I have a problem with SCHEME_PAIRP. > Is anything wrong in the code snippet below? Maybe the > extension receives some other kind of list? >From the PLT Scheme implementation's perspective, a "normal" list/pair is an immutable one. Did you want to accept mutable pairs? In that case, test with SCHEME_MUTABLE_PAIRP (which isn't mentioned in the docs, so I'll fix that). The SCHEME_CAR and SCHEME_CDR macros are intended to work on mutable pairs. In retrospect, that seems like a bad idea, so I'll add SCHEME_MCAR and SCHEME_MCDR macros. Matthew From grettke at acm.org Tue Jul 15 15:21:37 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:22 2009 Subject: [plt-scheme] MzScheme: extending vs. embedding to build a text editor In-Reply-To: <3cbaf1c80807151025i53998bddo1b7774f13738fa0f@mail.gmail.com> References: <3cbaf1c80807131657m468dbca5tcc01e66473e2ba40@mail.gmail.com> <20080714000339.CCBCC650058@mail-svr1.cs.utah.edu> <487CBF13.9050209@mazama.net> <3cbaf1c80807151025i53998bddo1b7774f13738fa0f@mail.gmail.com> Message-ID: <756daca50807151221y1c0b5b9p4797ffd99d4a3dab@mail.gmail.com> On Tue, Jul 15, 2008 at 12:25 PM, Peter Michaux wrote: > This example will give me a great jump start learning about ncurses integration for text user interfaces. Cool. I love text user interfaces (not being sarcastic here!). From yinso.chen at gmail.com Tue Jul 15 15:46:30 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:23:23 2009 Subject: [plt-scheme] s-exp and custom reader In-Reply-To: <20080715132909.C1ABB6500AD@mail-svr1.cs.utah.edu> References: <779bf2730807141258oc1dc07buef059ec20e6f00e2@mail.gmail.com> <779bf2730807141334n895aadbk93e87ea57badaf33@mail.gmail.com> <63bb19ae0807141350g304a4b75l1099a878c6821b28@mail.gmail.com> <779bf2730807141427k604011bev5ec55c0c26ef7e34@mail.gmail.com> <20080715132909.C1ABB6500AD@mail-svr1.cs.utah.edu> Message-ID: <779bf2730807151246u38c266d9paaaaaeff48343a0a@mail.gmail.com> On Tue, Jul 15, 2008 at 6:29 AM, Matthew Flatt wrote: > > You can also use > > #lang planet > > where is the "symbol" form of a planet path. > Thanks for point this out! > This doesn't seem to be documented anywhere. Will there be a wiki-like documentation system sometimes in the future? > We're trying to not bias the syntax of a language specification after > `#lang' to Scheme --- or even to S-expression syntax. So that's why > `(planet ...)' and other S-expression variations are not supported in > that position. > > It's unclear to me what the design buys from an user's perspective - but as of now I have a work around - thanks again ;) Much appreciated! yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080715/62e7224c/attachment.html From pivanyi at freemail.hu Tue Jul 15 16:35:50 2008 From: pivanyi at freemail.hu (Ivanyi Peter) Date: Thu Mar 26 02:23:23 2009 Subject: [plt-scheme] hash tables Message-ID: Hi again, Sorry to trouble, but how can I use the make-hash function in PLT-Scheme v. 402. I have tried all sorts of language settings, but it always says "reference to undefined identifier: make-hash" Should I require a library? I cannot find it in documentation. Thanks. Best regards, Peter Ivanyi ___________________________ Genertel casco szenz?ci?s ?ron! A Generteln?l elfelejtheti, amit eddig a casco d?jakr?l gondolt. Hogy mi?rt? J?rjon ut?na, k?rjen aj?nlatot most! http://ad.adverticum.net/b/cl,1,6022,249296,296182/click.prm From eli at barzilay.org Tue Jul 15 16:39:20 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:23 2009 Subject: [plt-scheme] hash tables In-Reply-To: References: Message-ID: <18557.2808.170034.761478@arabic.ccs.neu.edu> On Jul 15, Ivanyi Peter wrote: > Hi again, > > Sorry to trouble, but how can I use the make-hash function in > PLT-Scheme v. 402. I have tried all sorts of language settings, but > it always says "reference to undefined identifier: make-hash" Should > I require a library? I cannot find it in documentation. Use #lang scheme. The mzscheme language uses the old names. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From clements at brinckerhoff.org Tue Jul 15 16:40:37 2008 From: clements at brinckerhoff.org (John Clements) Date: Thu Mar 26 02:23:24 2009 Subject: [plt-scheme] hash tables In-Reply-To: References: Message-ID: On Jul 15, 2008, at 1:35 PM, Ivanyi Peter wrote: > Hi again, > > Sorry to trouble, but how can I use the make-hash function in > PLT-Scheme v. 402. > I have tried all sorts of language settings, but it always says > "reference to undefined identifier: make-hash" > Should I require a library? I cannot find it in documentation. This is probably a language issue. In particular, make-hash isn't present in the "mzscheme" language, but it is present in the "scheme" language. Try evaluating this in the "Module" language level: #lang scheme make-hash Hope this helps (NNTR), John Clements -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080715/c0257741/smime.bin From jos.koot at telefonica.net Tue Jul 15 16:40:59 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:24 2009 Subject: [plt-scheme] hash tables References: Message-ID: <006e01c8e6bb$17454e70$2101a8c0@uw2b2dff239c4d> For example #lang scheme in the first line with language "module". Jos ----- Original Message ----- From: "Ivanyi Peter" To: "pltscheme" Sent: Tuesday, July 15, 2008 10:35 PM Subject: [plt-scheme] hash tables Hi again, Sorry to trouble, but how can I use the make-hash function in PLT-Scheme v. 402. I have tried all sorts of language settings, but it always says "reference to undefined identifier: make-hash" Should I require a library? I cannot find it in documentation. Thanks. Best regards, Peter Ivanyi ___________________________ Genertel casco szenz?ci?s ?ron! A Generteln?l elfelejtheti, amit eddig a casco d?jakr?l gondolt. Hogy mi?rt? J?rjon ut?na, k?rjen aj?nlatot most! http://ad.adverticum.net/b/cl,1,6022,249296,296182/click.prm _________________________________________________ For list-related administrative tasks: http://list.cs.brown.edu/mailman/listinfo/plt-scheme From pivanyi at freemail.hu Tue Jul 15 16:54:33 2008 From: pivanyi at freemail.hu (Ivanyi Peter) Date: Thu Mar 26 02:23:24 2009 Subject: [plt-scheme] hash tables In-Reply-To: <18557.2808.170034.761478@arabic.ccs.neu.edu> Message-ID: Eli Barzilay ?rta: > Use #lang scheme. The mzscheme language uses the old names. Thanks for every answer. However if I use the scheme language then the if statement becomes "strange", as it says that the if statement must have an else part. (As I remember that was not a requirement in R5RS.) So... As I understand if I use (module something mzscheme then I can have the old name. Has this approach (using the mzscheme language) any drawback in version 402? Thanks. Best regards, Peter Ivanyi ___________________________ Genertel casco szenz?ci?s ?ron! A Generteln?l elfelejtheti, amit eddig a casco d?jakr?l gondolt. Hogy mi?rt? J?rjon ut?na, k?rjen aj?nlatot most! http://ad.adverticum.net/b/cl,1,6022,249296,296182/click.prm From eli at barzilay.org Tue Jul 15 17:01:38 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:24 2009 Subject: [plt-scheme] hash tables In-Reply-To: References: <18557.2808.170034.761478@arabic.ccs.neu.edu> Message-ID: <18557.4146.299538.185507@arabic.ccs.neu.edu> On Jul 15, Ivanyi Peter wrote: > Eli Barzilay ?rta: > > > Use #lang scheme. The mzscheme language uses the old names. > > Thanks for every answer. However if I use the scheme language then > the if statement becomes "strange", as it says that the if statement > must have an else part. (As I remember that was not a requirement in > R5RS.) It was not. However, `if' statements with no `else' part are strange. They're very different than those with an `else' part because the latter can be use for its value and the former is used only for side-effects. So only proper `if's are allowed in the `scheme' language -- use `when' and `unless' when you want a single sided conditional. > So... As I understand if I use > > (module something mzscheme > > then I can have the old name. Has this approach (using the mzscheme > language) any drawback in version 402? BTW, getting the old behavior is easy: (define-syntax old-if (syntax-rules () [(old-if c t) (when c t)] [(old-if c t e) (if c t e)])) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jensaxel at soegaard.net Tue Jul 15 17:02:02 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:23:24 2009 Subject: [plt-scheme] hash tables In-Reply-To: References: Message-ID: <487D104A.2070601@soegaard.net> Ivanyi Peter wrote: > Eli Barzilay ?rta: > > >> Use #lang scheme. The mzscheme language uses the old names. >> > > Thanks for every answer. However if I use the scheme language > then the if statement becomes "strange", as it says that the > if statement > must have an else part. (As I remember that was not a > requirement > in R5RS.) > So... > Use when as a replacement for one armed if. It is easier to shoot yourself in the foot, if you only have one arm! Thus the decision was to require two arms. -- Jens Axel S?gaard From clements at brinckerhoff.org Tue Jul 15 17:10:31 2008 From: clements at brinckerhoff.org (John Clements) Date: Thu Mar 26 02:23:25 2009 Subject: [plt-scheme] hash tables In-Reply-To: <487D104A.2070601@soegaard.net> References: <487D104A.2070601@soegaard.net> Message-ID: <0E48A4F1-2746-4528-AD45-94CC476D90DC@brinckerhoff.org> On Jul 15, 2008, at 2:02 PM, Jens Axel Soegaard wrote: > Ivanyi Peter wrote: >> Eli Barzilay ?rta: >> >> >>> Use #lang scheme. The mzscheme language uses the old names. >>> >> >> Thanks for every answer. However if I use the scheme language >> then the if statement becomes "strange", as it says that the >> if statement >> must have an else part. (As I remember that was not a >> requirement >> in R5RS.) >> So... >> > Use when as a replacement for one armed if. > > It is easier to shoot yourself in the foot, if you only have one arm! That is, the problem with having only one arm is that you may shoot yourself in the foot by adding more arms to yourself without considering the consequences. This is a generally applicable medical principle, as well. It's down in the small print of the Hippocratic oath. John Clements -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080715/9cef7447/smime.bin From billclem at gmail.com Tue Jul 15 19:02:09 2008 From: billclem at gmail.com (Bill Clementson) Date: Thu Mar 26 02:23:25 2009 Subject: [plt-scheme] Vancouver Lisp Users Group meeting for July 2008 - Web development with Lisp and UCW Message-ID: <8757cb490807151602l635755f7ofee2401d8d42615d@mail.gmail.com> Hi all, I've written about the web development framework UnCommon Web (UCW) a bit in the past (for links, see: http://bc.tech.coop/blog/080715.html). Also, we've had presentations about lisp-on-lines (which uses UCW) by Drew Crampsie at a few previous lispvan meetings (for links, see: http://bc.tech.coop/blog/080715.html). However, we've never actually had a UCW presentation! Well, this will no longer be the case after our July meeting. Ryan Davis has been using UCW to develop web sites in Florida (I'm sure it must be a hardship to have to take your laptop to the beach 365 days of the year! ;-) ), and he will be giving a presentation at the July lispvan meeting recounting his experiences. Although we were hoping to be moving to a new location (with a projector and a special meeting room!) for this month's meeting, the new location is still under construction (hmmm, I think I've said this for each of the past 3 meetings; however, Vancouver is experiencing a continuous building boom and everyone is finding it difficult to get contractors to complete jobs). Therefore, we will be meeting again this month at Calhoun's Coffee House and Restaurant. There won't be a projector, so we'll have to VNC a couple of laptops so that we aren't all crowded around one laptop. We've done that in the past, so this shouldn't be a problem (so long as some people remember to bring laptops! ;-) ). Here's the "official" meeting notice: Topic: Web development with Lisp and UCW Presenter: Ryan Davis Date: Wednesday, July 23rd, 2008 (note that the meeting is on a Wednesday and not a Thursday this month) Time: 7pm - 10pm (or whenever) Venue: Calhoun's, 3035 West Broadway, Vancouver (see map) Summary: Representing a small enclave of Lisp in Florida, Ryan Davis will demonstrate and review two UCW-based applications: 1. Gainesville-green.com: a google-maps website displaying energy usage. This site is mostly straight content generation from a postgresql database, with a little bit of AJAX and some extra caching handlers 2. Wedding-rsvp: a simple website to handle RSVPs to my wedding. This site is basically a wizard, and uses some AJAX and UCW continuations Depending on time and beer, topics may include: * HTML generation using ucw-buildnode, an unreleased library based on cxml * UCW basics * Deploying lisp websites using SBCL cores Join us for a beer/coffee and a chance to see/discuss how Lisp and UCW can be used to create dynamic web sites. Any updates and additional links can be found on my blog page (see: http://bc.tech.coop/blog/080715.html). If possible, I will do a screencast of Ryan's presentation and post that on my blog too. -- Bill Clementson From frubblebubble at googlemail.com Tue Jul 15 17:25:21 2008 From: frubblebubble at googlemail.com (frubblebubble@googlemail.com) Date: Thu Mar 26 02:23:25 2009 Subject: [plt-scheme] Re: MzScheme: extending vs. embedding to build a text editor In-Reply-To: <3cbaf1c80807131657m468dbca5tcc01e66473e2ba40@mail.gmail.com> References: <3cbaf1c80807131657m468dbca5tcc01e66473e2ba40@mail.gmail.com> Message-ID: On Jul 14, 1:57?am, "Peter Michaux" wrote: > Suppose I wanted to build a text editor like emacs where the use is > able to extend the editor using MzScheme (rather than emacs-lisp.) Suppose you actually would take crack at building a decent text editor with plt scheme, i'd be in for collaborating. From robby at cs.uchicago.edu Tue Jul 15 22:38:40 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:23:25 2009 Subject: [plt-scheme] Re: MzScheme: extending vs. embedding to build a text editor In-Reply-To: References: <3cbaf1c80807131657m468dbca5tcc01e66473e2ba40@mail.gmail.com> Message-ID: <932b2f1f0807151938j42b59d11m412c7f5b24901d80@mail.gmail.com> You might find the text editor that's already in plt scheme good starting point. Here is the documentation. http://docs.plt-scheme.org/gui/editor-overview.html Robby On Tue, Jul 15, 2008 at 4:25 PM, frubblebubble@googlemail.com wrote: > > On Jul 14, 1:57 am, "Peter Michaux" wrote: >> Suppose I wanted to build a text editor like emacs where the use is >> able to extend the editor using MzScheme (rather than emacs-lisp.) > > Suppose you actually would take crack at building a decent text editor > with plt scheme, i'd be in for collaborating. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From petermichaux at gmail.com Tue Jul 15 22:40:07 2008 From: petermichaux at gmail.com (Peter Michaux) Date: Thu Mar 26 02:23:26 2009 Subject: [plt-scheme] Re: MzScheme: extending vs. embedding to build a text editor In-Reply-To: References: <3cbaf1c80807131657m468dbca5tcc01e66473e2ba40@mail.gmail.com> Message-ID: <3cbaf1c80807151940s184f3b11k48e2a232b69195b6@mail.gmail.com> On Tue, Jul 15, 2008 at 2:25 PM, frubblebubble@googlemail.com wrote: > > On Jul 14, 1:57 am, "Peter Michaux" wrote: >> Suppose I wanted to build a text editor like emacs where the use is >> able to extend the editor using MzScheme (rather than emacs-lisp.) > > Suppose you actually would take crack at building a decent text editor > with plt scheme, i'd be in for collaborating. Very interesting. I'm just learning both Scheme and PLT now. I don't really have a real application to write in Scheme so I thought maybe writing an editor would be a good application. It also seems like a silly thing to do, though. All those character sets to worry about :-S Peter From noelwelsh at gmail.com Wed Jul 16 02:12:55 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:23:26 2009 Subject: [plt-scheme] hash tables In-Reply-To: References: <18557.2808.170034.761478@arabic.ccs.neu.edu> Message-ID: 2008/7/15 Ivanyi Peter : > then I can have the old name. Has this approach (using the > mzscheme language) any drawback in version 402? Yes, you can't use a lot of the new stuff, and interop with keyword argument functions doesn't work well. If you haven't done so already, a quick read of the release notes will tell you about the many other changes in 4.0 N. From jpc-ml at zenburn.net Wed Jul 16 04:57:54 2008 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:23:26 2009 Subject: [plt-scheme] Windows MSI installer In-Reply-To: <18544.8950.655805.326126@arabic.ccs.neu.edu> References: <20080705220740.GA17668@cs.brown.edu> <18544.8950.655805.326126@arabic.ccs.neu.edu> Message-ID: <487DB812.4070308@zenburn.net> Eli Barzilay wrote: > * Technical: I don't know of an application that allows me to compile > an msi, one that will allow me the same kind of flexibility I get > with NSIS (mostly specifying the installer via a script, and being > able to create it remotely through an ssh session). Using cygwin or do you have some other good ssh server for windows? -- regards, Jakub Piotr C?apa From eli at barzilay.org Wed Jul 16 04:59:31 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:26 2009 Subject: [plt-scheme] Windows MSI installer In-Reply-To: <487DB812.4070308@zenburn.net> References: <20080705220740.GA17668@cs.brown.edu> <18544.8950.655805.326126@arabic.ccs.neu.edu> <487DB812.4070308@zenburn.net> Message-ID: <18557.47219.243012.440536@arabic.ccs.neu.edu> On Jul 16, Jakub Piotr C?apa wrote: > Eli Barzilay wrote: > > * Technical: I don't know of an application that allows me to compile > > an msi, one that will allow me the same kind of flexibility I get > > with NSIS (mostly specifying the installer via a script, and being > > able to create it remotely through an ssh session). > > Using cygwin or do you have some other good ssh server for windows? Cygwin. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jos.koot at telefonica.net Wed Jul 16 06:55:49 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:27 2009 Subject: [plt-scheme] transformers after expansion no longer needed Message-ID: <000a01c8e732$8250e5e0$2101a8c0@uw2b2dff239c4d> When running a module in DrScheme, the transformers used during expansion cannot be discarded, because they may be used in the interactions window. However, in many cases I no longer need the transformers after expansion. Is there a way to make them garbage collectable as soon as expansion is completed? How is this in a stand alone compiled module? It does not have to save the transformers for the interactions window, for there is none. What happens in this case with the transformers after expansion? Jos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080716/60295c4f/attachment.htm From eli at barzilay.org Wed Jul 16 07:24:55 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:27 2009 Subject: [plt-scheme] transformers after expansion no longer needed In-Reply-To: <000a01c8e732$8250e5e0$2101a8c0@uw2b2dff239c4d> References: <000a01c8e732$8250e5e0$2101a8c0@uw2b2dff239c4d> Message-ID: <18557.55943.6296.181857@arabic.ccs.neu.edu> On Jul 16, Jos Koot wrote: > When running a module in DrScheme, the transformers used during > expansion cannot be discarded, because they may be used in the > interactions window. However, in many cases I no longer need the > transformers after expansion. Is there a way to make them garbage > collectable as soon as expansion is completed? You can use `let-syntax' for that, or other forms of local macros like: (define foo (let () (define-syntax ...) blah)) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jos.koot at telefonica.net Wed Jul 16 07:31:29 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:27 2009 Subject: [plt-scheme] transformers after expansion no longer needed References: <000a01c8e732$8250e5e0$2101a8c0@uw2b2dff239c4d> <18557.55943.6296.181857@arabic.ccs.neu.edu> Message-ID: <001801c8e737$7ddd45d0$2101a8c0@uw2b2dff239c4d> Thanks. But what when I import syntaxes from another module? Jos ----- Original Message ----- From: "Eli Barzilay" To: "Jos Koot" Cc: Sent: Wednesday, July 16, 2008 1:24 PM Subject: Re: [plt-scheme] transformers after expansion no longer needed > On Jul 16, Jos Koot wrote: >> When running a module in DrScheme, the transformers used during >> expansion cannot be discarded, because they may be used in the >> interactions window. However, in many cases I no longer need the >> transformers after expansion. Is there a way to make them garbage >> collectable as soon as expansion is completed? > > You can use `let-syntax' for that, or other forms of local macros > like: > > (define foo > (let () > (define-syntax ...) > blah)) > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Wed Jul 16 07:51:39 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:27 2009 Subject: [plt-scheme] transformers after expansion no longer needed In-Reply-To: <001801c8e737$7ddd45d0$2101a8c0@uw2b2dff239c4d> References: <000a01c8e732$8250e5e0$2101a8c0@uw2b2dff239c4d> <18557.55943.6296.181857@arabic.ccs.neu.edu> <001801c8e737$7ddd45d0$2101a8c0@uw2b2dff239c4d> Message-ID: <18557.57547.286472.663876@arabic.ccs.neu.edu> On Jul 16, Jos Koot wrote: > Thanks. But what when I import syntaxes from another module? Then you must have the transformers present. I think that what you're talking about is some kind of tree shaker that removes unused bindings. (And that's not implemented.) > ----- Original Message ----- > From: "Eli Barzilay" > To: "Jos Koot" > Cc: > Sent: Wednesday, July 16, 2008 1:24 PM > Subject: Re: [plt-scheme] transformers after expansion no longer needed > > > On Jul 16, Jos Koot wrote: > >> When running a module in DrScheme, the transformers used during > >> expansion cannot be discarded, because they may be used in the > >> interactions window. However, in many cases I no longer need the > >> transformers after expansion. Is there a way to make them garbage > >> collectable as soon as expansion is completed? > > > > You can use `let-syntax' for that, or other forms of local macros > > like: > > > > (define foo > > (let () > > (define-syntax ...) > > blah)) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From mflatt at cs.utah.edu Wed Jul 16 07:57:46 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:27 2009 Subject: [plt-scheme] transformers after expansion no longer needed In-Reply-To: <000a01c8e732$8250e5e0$2101a8c0@uw2b2dff239c4d> References: <000a01c8e732$8250e5e0$2101a8c0@uw2b2dff239c4d> Message-ID: <20080716115749.01B9A6500AC@mail-svr1.cs.utah.edu> At Wed, 16 Jul 2008 12:55:49 +0200, "Jos Koot" wrote: > When running a module in DrScheme, the transformers used during expansion > cannot be discarded, because they may be used in the interactions window. > However, in many cases I no longer need the transformers after expansion. Is > there a way to make them garbage collectable as soon as expansion is > completed? No, there's not currently a way to do that. I think we'd have to add a "no REPL" option in DrScheme. > How is this in a stand alone compiled module? It does not have to save the > transformers for the interactions window, for there is none. What happens in > this case with the transformers after expansion? When you run with the (perhaps implicit) `-u' command-line flag, then it corresponds to `require', so the module's compile-time part is run in that case, too. But when you use `dynamic-require', then the compile-time part of a module is not run. That is, the module is only invoked, and not visited. With that in mind, maybe we should change `-u' to mean `dynamic-require' instead of `require'. Matthew From grettke at acm.org Wed Jul 16 09:13:39 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:27 2009 Subject: [plt-scheme] Re: What is the best way for folks to view macro expansions post 4.0 in module or pretty big? In-Reply-To: <756daca50807121656m166fd063wc012777e5d93f5cb@mail.gmail.com> References: <756daca50807101404v5ea2dffcx5670f222b9eb9a31@mail.gmail.com> <756daca50807121656m166fd063wc012777e5d93f5cb@mail.gmail.com> Message-ID: <756daca50807160613k237f35d6ofab49f3a2cdbacb5@mail.gmail.com> > Problem solved, not sure how, but problem solved. I was thinking about it. I am pretty sure that I was the one doing something wrong. In 4.x, the stepper only seems to appear in module mode. The simplest explanation is that I didn't have it in module mode. I think that perhaps when I ran 372, it set the preferences to module mode, and when I went back to 4.0.2, it was in module mode and worked. Would it do that? From samth at ccs.neu.edu Wed Jul 16 09:24:29 2008 From: samth at ccs.neu.edu (Sam TH) Date: Thu Mar 26 02:23:28 2009 Subject: [plt-scheme] Re: What is the best way for folks to view macro expansions post 4.0 in module or pretty big? In-Reply-To: <756daca50807160613k237f35d6ofab49f3a2cdbacb5@mail.gmail.com> References: <756daca50807101404v5ea2dffcx5670f222b9eb9a31@mail.gmail.com> <756daca50807121656m166fd063wc012777e5d93f5cb@mail.gmail.com> <756daca50807160613k237f35d6ofab49f3a2cdbacb5@mail.gmail.com> Message-ID: <63bb19ae0807160624i2562d13end793cdb29c0973b5@mail.gmail.com> On Wed, Jul 16, 2008 at 9:13 AM, Grant Rettke wrote: >> Problem solved, not sure how, but problem solved. > > I was thinking about it. I am pretty sure that I was the one doing > something wrong. > > In 4.x, the stepper only seems to appear in module mode. The simplest > explanation is that I didn't have it in module mode. > > I think that perhaps when I ran 372, it set the preferences to module > mode, and when I went back to 4.0.2, it was in module mode and worked. > > Would it do that? Yes. Currently, the macro stepper only works in the Module language. I believe that this restriction will be lifted at some point. Thanks, -- sam th samth@ccs.neu.edu From spdegabrielle at gmail.com Wed Jul 16 10:02:29 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:23:28 2009 Subject: [plt-scheme] using macros to create new widgets in MrEd Message-ID: <595b9ab20807160702l19494998p7d4196953f4c606d@mail.gmail.com> Hi, I've been fiddling with composing widgets, and I thought I'd have a try at making a macro to make the code a little easier to read; I've come up with a solution that allows me to specify a container and two child widgets in the form ;; make-widget : classname container-class function function -> class I'd prefer to have something like; ;; define-widget new-widget-classname container-class container-args sub-widget1% args1 subwidget2% args2) eg (define-widget double-button% horizontal-panel% '() button% '([label label1]) button% '([label label1] [stretchable-width #t])) My problem is I can't work out how to use the args1 list. As you can see below I have tried apply as in (apply new sub-widget% (parent this) sub-widget-args) but 'new' isn't a function. Any suggestions? Cheers, Stephen From czhu at cs.utah.edu Wed Jul 16 11:40:03 2008 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:23:28 2009 Subject: [plt-scheme] using macros to create new widgets in MrEd In-Reply-To: <595b9ab20807160702l19494998p7d4196953f4c606d@mail.gmail.com> References: <595b9ab20807160702l19494998p7d4196953f4c606d@mail.gmail.com> Message-ID: <487E1653.7040302@cs.utah.edu> Stephen De Gabrielle wrote: > Hi, I've been fiddling with composing widgets, and I thought I'd have > a try at making a macro to make the code a little easier to read; > > I've come up with a solution that allows me to specify a container and > two child widgets in the form > ;; make-widget : classname container-class function function -> class > > I'd prefer to have something like; > ;; define-widget new-widget-classname container-class container-args > sub-widget1% args1 subwidget2% args2) > eg > (define-widget double-button% horizontal-panel% '() button% '([label > label1]) button% '([label label1] [stretchable-width #t])) > > My problem is I can't work out how to use the args1 list. > As you can see below I have tried apply as in > (apply new sub-widget% (parent this) sub-widget-args) > but 'new' isn't a function. > > Any suggestions? > > Cheers, > Stephen > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > (define-syntax define-widget1 (syntax-rules () ((_ new-widget-classname (args ...)) (new new-widget-classname args ...)))) (define-syntax define-widget2 (syntax-rules () ((_ new-widget-classname args) (new new-widget-classname . args)))) From yinso.chen at gmail.com Wed Jul 16 17:08:07 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:23:29 2009 Subject: [plt-scheme] structure, procedure, and keyword arg Message-ID: <779bf2730807161408t7785232ap4b56608e1616f28@mail.gmail.com> Hi - it seems that the structs marked as procedures cannot accept keyword arguments, even if the procedure in prop:procedure does. Is this by design or there is a different way to mark struct as keyword procedures? Thanks, yc > (define-struct *res (filter args) #:property prop:procedure (lambda (s x #:error (e #f)) (let ((res (apply (*res-filter s) (cons x (*res-args s))))) (if (not e) res (error 'restriction)))) ) > (define color (make-*res (lambda (x enum) (member x enum)) '((red white blue)))) > (color 'black #:error #t) ;; => error procedure application: expected a procedure that accepts keyword arguments, given #(struct:*res # (red white blue)); arguments were: black #:error #t -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080716/252b249c/attachment.html From grettke at acm.org Wed Jul 16 21:33:16 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:29 2009 Subject: [plt-scheme] Entering unicode characters in the REPL? Message-ID: <756daca50807161833p5be39f85w7df56b3d8ec2dd66@mail.gmail.com> SGksCgpJbiB2MzcyIHlvdSBjb3VsZCBlbnRlciB1bmljb2RlIGNoYXJhY3RlcnMgZGlyZWN0bHkg aW50byB0aGUgUkVQTCBsaWtlIHRoaXM6Cgo+IFx1MjY2NQqivgoKVGhlIGRvY3MgKGRvYy9ndWlk ZS9zdHJpbmdzLmh0bWwpIHNheSB5b3UgY2FuIHN0aWxsIGRvIHRoaXMgaW4gNC54LApidXQgd2hl biBJIHRyeSBpdCBpbiA0LjAuMiBpbiBtb2R1bGUgSSBtb2RlIEkgZ2V0IHRoZSBlcnJvcjoKCnJl ZmVyZW5jZSB0byBhbiBpZGVudGlmaWVyIGJlZm9yZSBpdHMgZGVmaW5pdGlvbjogdTI2NjUKCj4g KGRpc3BsYXkgIlx1MjY2NSIpIDsgVGhpcyB3YXkgc3RpbGwgd29ya3MKor4KCldoaWNoIG9uZSBp cyByaWdodD8gKG9yIHdoYXQgZGlkIEkgZG8gd3Jvbmc/KQo= From eli at barzilay.org Wed Jul 16 22:07:11 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:29 2009 Subject: [plt-scheme] Entering unicode characters in the REPL? In-Reply-To: <756daca50807161833p5be39f85w7df56b3d8ec2dd66@mail.gmail.com> References: <756daca50807161833p5be39f85w7df56b3d8ec2dd66@mail.gmail.com> Message-ID: <18558.43343.467298.236359@arabic.ccs.neu.edu> On Jul 16, Grant Rettke wrote: > Hi, > > In v372 you could enter unicode characters directly into the REPL > like this: > > > \u2665 $)C> "> This is wrong -- backslash in symbols is used to quote characters that otherwise would break the symbol, like foo\ bar, so the above is the same as just entering `u2665'. > The docs (doc/guide/strings.html) say you can still do this in 4.x, > but when I try it in 4.0.2 in module I mode I get the error: > > reference to an identifier before its definition: u2665 > > > (display "\u2665") ; This way still works > "> > > Which one is right? (or what did I do wrong?) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From grettke at acm.org Wed Jul 16 22:13:40 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:29 2009 Subject: [plt-scheme] Question about user defined keybinding Message-ID: <756daca50807161913n70fd3afcge71692de754bac3e@mail.gmail.com> Hi I had a custom keybinding in v372. In v4.x, the same binding works fine, but I figured I would check if it ought to be updated. The docs (doc/drscheme/Keyboard_Shortcuts.html#(part._defining-shortcuts) say you can use the form: (module mykeys framework/keybinding-lang ...) But when I change my module to that language I get the error: Error when installing the keybindings C:\scheme\grant\drscheme\mykeys.ss: add-user-keybindings-file: The file C:\scheme\grant\drscheme\mykeys.ss does not contain a module written in the (lib "keybinding- lang.ss" "framework") language. Did I do something wrong? From robby at cs.uchicago.edu Wed Jul 16 22:17:21 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:23:29 2009 Subject: [plt-scheme] Entering unicode characters in the REPL? In-Reply-To: <756daca50807161833p5be39f85w7df56b3d8ec2dd66@mail.gmail.com> References: <756daca50807161833p5be39f85w7df56b3d8ec2dd66@mail.gmail.com> Message-ID: <932b2f1f0807161917q2ef9d6c2j4d65e7f1b4452454@mail.gmail.com> 2008/7/16 Grant Rettke : > In v372 you could enter unicode characters directly into the REPL like this: > >> \u2665 > ? This doesn't seem to work in 372. This does: > "\u2665" "?" Robby From eli at barzilay.org Wed Jul 16 22:27:35 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:29 2009 Subject: [plt-scheme] Question about user defined keybinding In-Reply-To: <756daca50807161913n70fd3afcge71692de754bac3e@mail.gmail.com> References: <756daca50807161913n70fd3afcge71692de754bac3e@mail.gmail.com> Message-ID: <18558.44567.305206.468139@arabic.ccs.neu.edu> On Jul 16, Grant Rettke wrote: > Hi > > I had a custom keybinding in v372. In v4.x, the same binding works > fine, but I figured I would check if it ought to be updated. > > The docs (doc/drscheme/Keyboard_Shortcuts.html#(part._defining-shortcuts) > say you can use the form: > > (module mykeys framework/keybinding-lang > > ...) > > But when I change my module to that language I get the error: > > Error when installing the keybindings C:\scheme\grant\drscheme\mykeys.ss: > > add-user-keybindings-file: The file > C:\scheme\grant\drscheme\mykeys.ss does not contain a module written > in the (lib "keybinding- lang.ss" "framework") language. > > Did I do something wrong? No, the released version (4.0.2) insists on that particular form, so you need to use (module mykeys (lib "keybinding-lang.ss" "framework") ...) It's fixed in svn, so in the future what you wrote above will work fine. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From grettke at acm.org Wed Jul 16 23:15:26 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:29 2009 Subject: [plt-scheme] Entering unicode characters in the REPL? In-Reply-To: <932b2f1f0807161917q2ef9d6c2j4d65e7f1b4452454@mail.gmail.com> References: <756daca50807161833p5be39f85w7df56b3d8ec2dd66@mail.gmail.com> <932b2f1f0807161917q2ef9d6c2j4d65e7f1b4452454@mail.gmail.com> Message-ID: <756daca50807162015l116ca5cev84a4033a1b04ff39@mail.gmail.com> T24gV2VkLCBKdWwgMTYsIDIwMDggYXQgOToxNyBQTSwgUm9iYnkgRmluZGxlciA8cm9iYnlAY3Mu dWNoaWNhZ28uZWR1PiB3cm90ZToKPiBUaGlzIGRvZXNuJ3Qgc2VlbSB0byB3b3JrIGluIDM3Mi4g VGhpcyBkb2VzOgo+Cj4+ICJcdTI2NjUiCj4gIqK+IgoKT2hoaGgsIHRoYW5rcyA6KQo= From andrew-scheme at areilly.bpc-users.org Thu Jul 17 00:12:51 2008 From: andrew-scheme at areilly.bpc-users.org (Andrew Reilly) Date: Thu Mar 26 02:23:29 2009 Subject: [plt-scheme] Creating a symbolic link for OS X In-Reply-To: <0A5B5239-5449-4F69-803A-14C4EE264DBD@sbcglobal.net> References: <0A5B5239-5449-4F69-803A-14C4EE264DBD@sbcglobal.net> Message-ID: <20080717041251.GA26704@duncan.reilly.home> On Tue, Jul 08, 2008 at 05:16:45PM -0700, Gregory Woodhouse wrote: > This is pretty much a minor annoyance, but with each new version I > have to go through the same basic process to update my symbolic link / > usr/local/plt > > gregory-woodhouses-computer:/usr/local root# ln -s /Applications/PLT\ > Scheme\ v4.0.2 /usr/local/plt > gregory-woodhouses-computer:/usr/local root# exit > exit > ~:$ which mzscheme > /usr/local/plt/bin/mzscheme > ~:$ > > It would be nice if this could be automated. Just as another alternative, I get around this by making my .profile put only the highest version into my $PATH: PLT="$(/bin/ls -1d /Applications/PLT* | tail -1)" PATH=....other-paths...:$PLT/bin:... export PATH Works a treat. I just have to remember to restart terminal sessions after installing the latest version. So on my system, "which mzscheme" says: mzscheme is /Applications/PLT Scheme v4.0.2/bin/mzscheme Neat, huh? I can force the use of older versions by using an explicit path. Cheers, Andrew From yinso.chen at gmail.com Thu Jul 17 00:58:23 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:23:31 2009 Subject: [plt-scheme] Entering unicode characters in the REPL? In-Reply-To: <756daca50807162015l116ca5cev84a4033a1b04ff39@mail.gmail.com> References: <756daca50807161833p5be39f85w7df56b3d8ec2dd66@mail.gmail.com> <932b2f1f0807161917q2ef9d6c2j4d65e7f1b4452454@mail.gmail.com> <756daca50807162015l116ca5cev84a4033a1b04ff39@mail.gmail.com> Message-ID: <779bf2730807162158r234034dfg42cd470961c4e50@mail.gmail.com> 2008/7/16 Grant Rettke : > On Wed, Jul 16, 2008 at 9:17 PM, Robby Findler > wrote: > > This doesn't seem to work in 372. This does: > > > >> "\u2665" > > "¢¾" > > Ohhhh, thanks :) > Also try #\u2665 - see http://docs.plt-scheme.org/reference/reader.html#(part._parse-character) for reading a character. Cheers, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080716/aaf1acef/attachment.htm From eli at barzilay.org Thu Jul 17 01:28:37 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:31 2009 Subject: [plt-scheme] Creating a symbolic link for OS X In-Reply-To: <20080717041251.GA26704@duncan.reilly.home> References: <0A5B5239-5449-4F69-803A-14C4EE264DBD@sbcglobal.net> <20080717041251.GA26704@duncan.reilly.home> Message-ID: <18558.55429.155277.112317@arabic.ccs.neu.edu> On Jul 17, Andrew Reilly wrote: > On Tue, Jul 08, 2008 at 05:16:45PM -0700, Gregory Woodhouse wrote: > > This is pretty much a minor annoyance, but with each new version I > > have to go through the same basic process to update my symbolic link / > > usr/local/plt > > > > gregory-woodhouses-computer:/usr/local root# ln -s /Applications/PLT\ > > Scheme\ v4.0.2 /usr/local/plt > > gregory-woodhouses-computer:/usr/local root# exit > > exit > > ~:$ which mzscheme > > /usr/local/plt/bin/mzscheme > > ~:$ > > > > It would be nice if this could be automated. > > Just as another alternative, I get around this by making my > .profile put only the highest version into my $PATH: > > PLT="$(/bin/ls -1d /Applications/PLT* | tail -1)" > PATH=....other-paths...:$PLT/bin:... export PATH It's probably better to use PLT="$(/bin/ls -1dt /Applications/PLT* | head -1)" so things won't break if there's a "PLT Scheme v4.0.10". > Works a treat. I just have to remember to restart terminal > sessions after installing the latest version. You could also make `mzscheme' itself be a script that does that every time it runs. You can even abstract this in a single script that can invoke multiple programs. Here's a quick example: * add ~/bin to your path (it might already be there, I don't know the default OSX setup) * Create a file called `runplt' there, with this contents: #!/bin/sh exec "$(/bin/ls -1dt /Applications/PLT* | head -1)/bin/$(basename "$0")" * Now symlink as needed, for example: cd ~/bin ln -s runplt mzscheme ln -s runplt mred ln -s runplt plt-help ln -s runplt planet ...more for any commands you might need... You can now use any of these commands which will default to the latest path, and no terminal restart is need. The only problem here is that this means that you pay the extra cost of searching the recent directory on every execution. You can use the directory timestamp to "cache" the most recent directory, something like this: #!/bin/sh if [ ! -e ~/.recent-plt ] || [ /Applications -nt ~/.recent-plt ]; then /bin/ls -1dt /Applications/PLT* | head -1 > ~/.recent-plt fi exec "$(cat ~/.recent-plt)/bin/$(basename "$0")" (And you can use a similar script to create a symlink to the recent PLT installation, and then run the script after every plt installation.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From gregory.woodhouse at sbcglobal.net Thu Jul 17 02:24:46 2008 From: gregory.woodhouse at sbcglobal.net (Gregory Woodhouse) Date: Thu Mar 26 02:23:31 2009 Subject: [plt-scheme] And now for an actual Scheme question (PLAI) Message-ID: <653FA7F2-D267-4612-BC4B-066C547CE70D@sbcglobal.net> I've been away from scheme for awhile, so I decided to go back to PLAI and start reading from the beginning I implemented the predicate AE? (for arithmetic expressions) like this ;;pattern based evaluator (language: AE) (define (AE? exp) (match exp ((? number? exp) #t) ((list '+ (? AE?) (? AE?)) #t) ((list '- (? AE?)) #t) ((list '- (? AE?) (? AE?)) #t) ((list '* (? AE?) (? AE?)) #t) ((list '/ (? AE?) (? AE?)) #t) (else #f))) So far, so good, but if I follow the model in the book (minus the use of type-case, which doesn't seem to be part of PLT Scheme) I end up with something like this (define (evaluate exp) (with-handlers ((exn:fail:user? (lambda (exn) (printf "~a~n" exn)))) (match exp ((? number? exp) exp) ((list '+ (? AE? t1) (? AE? t2)) (+ (evaluate t1) (evaluate t2))) ((list '- (? AE? t1) (? AE? t2)) (- (evaluate t1) (evaluate t2))) ((list '* (? AE? t1) (? AE? t2)) (* (evaluate t1) (evaluate t2))) ((list '/ (? AE? t1) (? AE? t2)) (let ([ n (evaluate t1)] [d (evaluate t2)]) (if (equal? d 0) (raise-user-error "division by zero") (/ n d)))) (else (raise-user-error "Unable to evaluate expression" exp))))) Now, on the face of it, this seems awfully wasteful because I'm repeating all the pattern matching that I had to go through to identify an expression as an AE in the first place. My next step was going to be parsing the expression into a bunch of tagged elements (so I'd only need to read the tag). For example (+ 2 3) would be parsed as (('builtin '+) ('num 2) ('num 3)). Now, I kind of suspect that all this redundant pattern matching wouldn't really slow things down much (because the computations would be cached), but this hardly seems a very nice way to write the code. So, I guess I'm asking whether this analysis is reasonable. Using match seems to be an elegant way of writing an evaluator. It is certainly more compact than a chain of conditionals, but it seems to introduce a lot of extraneous computation. (Oh, if you're wondering about the use of with-handlers, I've wrapped this all in a REPL loop, and I don't want to be kicked out because of a typo or division by zero or some such thing.) "The most incomprehensible thing about the world is that it is at all comprehensible." --Albert Einstein (1879-1955) http://www.gwoodhouse.com http://GregWoodhouse.ImageKind.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080716/48e3f914/attachment.html From clements at brinckerhoff.org Thu Jul 17 02:56:37 2008 From: clements at brinckerhoff.org (John Clements) Date: Thu Mar 26 02:23:32 2009 Subject: [plt-scheme] And now for an actual Scheme question (PLAI) In-Reply-To: <653FA7F2-D267-4612-BC4B-066C547CE70D@sbcglobal.net> References: <653FA7F2-D267-4612-BC4B-066C547CE70D@sbcglobal.net> Message-ID: On Jul 16, 2008, at 11:24 PM, Gregory Woodhouse wrote: > I've been away from scheme for awhile, so I decided to go back to > PLAI and start reading from the beginning ... Shriram may disagree with me, but if you were in my class I would say the following things: 1) You can get type-case by installing the PLAI language level (available near the PLAI web page, though I don't know if it's 4.0- ready yet). 2) You would not use type-case to deal with parsing-type stuff; the point of the parser is to emit stuff that type-case will work for. 3) Don't get bogged down in the parser: the point of PLAI (IMHO) is the stuff you can do _after_ you've got the parser out of the way. And really... _do_ get the type-case feature installed and working; it will make the material of the book simpler both technically and conceptually. John Clements -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080716/fa846608/smime.bin From eli at barzilay.org Thu Jul 17 03:09:19 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:32 2009 Subject: [plt-scheme] And now for an actual Scheme question (PLAI) In-Reply-To: <653FA7F2-D267-4612-BC4B-066C547CE70D@sbcglobal.net> References: <653FA7F2-D267-4612-BC4B-066C547CE70D@sbcglobal.net> Message-ID: <18558.61471.394313.665@arabic.ccs.neu.edu> On Jul 16, Gregory Woodhouse wrote: > I've been away from scheme for awhile, so I decided to go back to > PLAI and start reading from the beginning > > I implemented the predicate AE? (for arithmetic expressions) like this > > ;;pattern based evaluator (language: AE) > > (define (AE? exp) > (match exp > ((? number? exp) #t) > ((list '+ (? AE?) (? AE?)) #t) > ((list '- (? AE?)) #t) > ((list '- (? AE?) (? AE?)) #t) > ((list '* (? AE?) (? AE?)) #t) > ((list '/ (? AE?) (? AE?)) #t) > (else #f))) > > So far, so good, but if I follow the model in the book (minus the use > of type-case, which doesn't seem to be part of PLT Scheme) It's included in a separate package that you can download from the book's page. (Look for "Get the Software".) > I end up with something like this > > (define (evaluate exp) > (with-handlers > ((exn:fail:user? > (lambda (exn) (printf "~a~n" exn)))) > (match exp > ((? number? exp) exp) > ((list '+ (? AE? t1) (? AE? t2)) (+ (evaluate t1) (evaluate t2))) > ((list '- (? AE? t1) (? AE? t2)) (- (evaluate t1) (evaluate t2))) > ((list '* (? AE? t1) (? AE? t2)) (* (evaluate t1) (evaluate t2))) > ((list '/ (? AE? t1) (? AE? t2)) > (let > ([ n (evaluate t1)] > [d (evaluate t2)]) > (if (equal? d 0) > (raise-user-error "division by zero") > (/ n d)))) > (else (raise-user-error "Unable to evaluate expression" exp))))) > > Now, on the face of it, this seems awfully wasteful because I'm > repeating all the pattern matching that I had to go through to > identify an expression as an AE in the first place. Speed should not be a concern when you read the book. Bugs are much more important. For example -- you have a bug in the above code. You can spend a few minutes looking for it, but if you had been using `define-type' and `type-case' you wouldn't have had it in the first case. (The bug is in your subtraction case, BTW.) The main feature of using these construct is how they make your life easier in a similar way to using a statically-typed language: when you change the type definition, you will get syntax errors if you don't change all uses of `type-case' accordingly, which will avoid the kind of bugs that would just be a distraction. (You'll still have plenty of real bugs -- the ones you'll learn from.) > My next step was going to be parsing the expression into a bunch of > tagged elements (so I'd only need to read the tag). For example (+ > 2 3) would be parsed as (('builtin '+) ('num 2) ('num 3)). (That would get you closer to a re-implementation of the above package.) > (Oh, if you're wondering about the use of with-handlers, I've > wrapped this all in a REPL loop, and I don't want to be kicked out > because of a typo or division by zero or some such thing.) If you flip quickly through the pages you'll see that a REPL is not going to be too helpful -- most code will be in the form of big expressions, and trying them out in a REPL is going to be much less convenient than using the definitions window. My bottom line would be to not spend any time with all these technicalities, just go with the book and things will be easier. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From spdegabrielle at gmail.com Thu Jul 17 05:22:25 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:23:33 2009 Subject: [plt-scheme] using macros to create new widgets in MrEd In-Reply-To: <487E1653.7040302@cs.utah.edu> References: <595b9ab20807160702l19494998p7d4196953f4c606d@mail.gmail.com> <487E1653.7040302@cs.utah.edu> Message-ID: <595b9ab20807170222w34599b7fs47b4f8b8efcbe8@mail.gmail.com> Thanks Chongkai, Despite my failing to include half my post, your advice was good; it works! (attached) I've also put it on the cookbook http://schemecookbook.org/preview/Cookbook/GUIWidgetAggregation I'd appreciate any comments on either implementation and utility (the value of repeating the same components is dubious) Cheers, Stephen On Wed, Jul 16, 2008 at 4:40 PM, Chongkai Zhu wrote: > Stephen De Gabrielle wrote: >> >> Hi, I've been fiddling with composing widgets, and I thought I'd have >> a try at making a macro to make the code a little easier to read; >> >> I've come up with a solution that allows me to specify a container and >> two child widgets in the form >> ;; make-widget : classname container-class function function -> class >> >> I'd prefer to have something like; >> ;; define-widget new-widget-classname container-class container-args >> sub-widget1% args1 subwidget2% args2) >> eg >> (define-widget double-button% horizontal-panel% '() button% '([label >> label1]) button% '([label label1] [stretchable-width #t])) >> >> My problem is I can't work out how to use the args1 list. >> As you can see below I have tried apply as in >> (apply new sub-widget% (parent this) sub-widget-args) >> but 'new' isn't a function. >> >> Any suggestions? >> >> Cheers, >> Stephen >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > (define-syntax define-widget1 > (syntax-rules () > ((_ new-widget-classname (args ...)) > (new new-widget-classname args ...)))) > > (define-syntax define-widget2 > (syntax-rules () > ((_ new-widget-classname args) > (new new-widget-classname . args)))) > > -- Cheers, Stephen -- Stephen De Gabrielle s.degabrielle@cs.ucl.ac.uk Telephone +44 (0)20 7679 0693 (x30693) Mobile 079 851 890 45 Project: Making Sense of Information (MaSI) Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html Home:http://www.degabrielle.name/stephen UCL Interaction Centre MPEB 8th floor University College London Gower Street London WC1E 6BT -------------- next part -------------- A non-text attachment was scrubbed... Name: widget-aggregator.ss Type: application/octet-stream Size: 1304 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080717/c3773378/widget-aggregator.obj From plragde at uwaterloo.ca Thu Jul 17 08:51:19 2008 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Thu Mar 26 02:23:33 2009 Subject: [plt-scheme] building 4.0.2 on 64-bit Ubuntu Message-ID: <487F4047.9070602@uwaterloo.ca> My tech support person here at UW, having successfully installed 4.0.2 on a number of Solaris servers, is trying to build it for some Linux servers, and is running into difficulties, apparently related to the fact that these are 64-bit machines. He would like to know if anyone has a working 4.0.2 (64-bit) image on Ubuntu (and, presumably, if such a person would be willing to correspond). Thanks. --PR (PS He mentioned in passing that apt-get got him v209...!) From plragde at uwaterloo.ca Thu Jul 17 11:08:50 2008 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Thu Mar 26 02:23:33 2009 Subject: [plt-scheme] And now for an actual Scheme question (PLAI) In-Reply-To: <653FA7F2-D267-4612-BC4B-066C547CE70D@sbcglobal.net> Message-ID: <487F6082.2080701@uwaterloo.ca> Gregory Woodhouse wrote: > So, I guess I'm asking whether this analysis is reasonable. Using > match seems to be an elegant way of writing an evaluator. It is > certainly more compact than a chain of conditionals, but it seems to > introduce a lot of extraneous computation. I've worked through PLAI using match. I abandoned Shriram's parse function and just used S-expressions directly, plus structures where necessary (for instance, in the representation of closures). Here's my interpreter for "basic arithmetic expressions", with some tests. #lang scheme ;; grammar: ;; ::= ;; | (+ ) | (- ) ;; | (* ) | (/ ) (define (interp exp) (match exp [`(+ ,l ,r) (+ (interp l) (interp r))] [`(- ,l ,r) (- (interp l) (interp r))] [`(* ,l ,r) (* (interp l) (interp r))] [`(/ ,l ,r) (/ (interp l) (interp r))] [(? number? n) n] [x (error 'interp "no interpretation for ~a" x)])) (= (interp 4) 4) (= (interp '(+ 3 4)) 7) (= (interp '(* 3 4)) 12) (= (interp '(* (+ 1 2) (+ 3 4))) 21) Now, this is heretical, but I discussed it with Shriram, and he didn't immediately excommunicate me. The benefits are clarity and brevity. The drawback, besides giving up all the nice safety features that John and Eli described, is a blurring of the distinction between textual code and abstract syntax trees. I thought it was a valuable exercise. I did my best to write the interpreters without looking at Shriram's code, only reading the text. I will try this approach with some students this fall (not covering all of PLAI, only the first few interpreters) and see how it goes. --PR From mflatt at cs.utah.edu Thu Jul 17 11:22:09 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:33 2009 Subject: [plt-scheme] logging support (v4.0.2.4) Message-ID: <20080717152209.541226500A8@mail-svr1.cs.utah.edu> PLT Scheme version 4.0.2.4 (now in SVN) adds a first cut at long-planned logging support. The logging API is fairly simple, and it's based on similar support in Java, Python, etc. Logging is built in, instead of implemented as a separate library, so that the run-time system can report information through logging. For example, when the bytecode compiler sees (define (go) (let ([f (lambda (x) x)]) (f 1 2))) then it easily detects that `f' is applied to the wrong number of arguments if `go' is ever called. Sometimes, you'd like the optimizer to tell you what it sees. Now it can --- if you turn up stderr event reporting to "warning": laptop% mzscheme -W warning Welcome to MzScheme v4.0.2.4 [3m], Copyright (c) 2004-2008 PLT Scheme Inc. > (define (go) (let ([f (lambda (x) x)]) (f 1 2))) warning in: readline::2: go: optimizer detects procedure incorrectly applied to 2 arguments: f > If you turn up reporting all the way to "info", then you get information about garbage collections: laptop% mzscheme -W info Welcome to MzScheme v4.0.2.4 [3m], Copyright (c) 2004-2008 PLT Scheme Inc. GC [minor] at 1406520 bytes; 614944 collected in 5 msec GC [minor] at 2226032 bytes; 569248 collected in 7 msec GC [minor] at 4062888 bytes; 1087372 collected in 14 msec GC [minor] at 5617048 bytes; 1057728 collected in 17 msec GC [minor] at 7480240 bytes; 1181160 collected in 15 msec GC [minor] at 10601456 bytes; 1568052 collected in 24 msec GC [minor] at 15007512 bytes; 3217852 collected in 32 msec GC [minor] at 19120856 bytes; 4374972 collected in 41 msec > For now, that's about all of the events that the run-time system logs, but we expect more (and better formatted) events from the run-time system in the future. Instead of passing the -W command-line flag, you can set the PLTSTDERR environment variable: laptop% env PLTSTDERR=info mzscheme Welcome to MzScheme v4.0.2.4 [3m], Copyright (c) 2004-2008 PLT Scheme Inc. GC [minor] at 1406520 bytes; 614944 collected in 5 msec GC [minor] at 2226032 bytes; 569248 collected in 6 msec ... Besides recording logged events to stderr (i.e., the original error port), events can be recorded to the system log. Use the -L flag or PLTSYSLOG flag to turn up system-log recording. By default, system-log recording is set to "none" under Unix and "error" (the same as default stderr recording) for Windows and Mac OS X. More logging is on by default for Windows and Mac OS X because it's more normal for applications to log messages on those platforms. The log event levels, in decreasing order, are "fatal", "error", "warning", "info", and "debug". To log a message at one of these levels, the simplest way is to use the corresponding `log-' form: laptop% env PLTSTDERR=warning mzscheme Welcome to MzScheme v4.0.2.4 [3m], Copyright (c) 2004-2008 PLT Scheme Inc. > (log-warning "beware of dog") beware of dog > (log-info "beware of mice") > The string-generating expression in `log-warning', etc., is not evaluated if no one is listening for the corresponding level of events. The more general interface is the `log-message' function, which takes a target logger, a level symbol, a message string, and arbitrary data: > (log-message (current-logger) 'warning "beware of dog" 42) beware of dog Instead of the number 42, a more typical value to supply with the message is a set of continuation marks. That's what `log-warning', etc. supply. To receive logged events, create a log receiver. The receiver gets events at a specified level or higher. To extract information for a logged event, `sync' on the receiver: > (define lr (make-log-receiver (current-logger) 'info)) > (log-info "beware of mice") > (sync lr) #(info "beware of mice" #) See the documentation (section 14.5 in the reference manual) for a few extra details, including information on named loggers and logger hierarchies. Matthew From anton at appsolutions.com Thu Jul 17 12:17:13 2008 From: anton at appsolutions.com (Anton van Straaten) Date: Thu Mar 26 02:23:34 2009 Subject: [plt-scheme] building 4.0.2 on 64-bit Ubuntu In-Reply-To: <487F4047.9070602@uwaterloo.ca> References: <487F4047.9070602@uwaterloo.ca> Message-ID: <487F7089.5070404@appsolutions.com> Dunno about Ubuntu, but PLT has been working fine for me on Debian 64-bit since about 2005. I just recently built 4.0.2 from source without any problems. Maybe post some symptoms to the list? Anton Prabhakar Ragde wrote: > My tech support person here at UW, having successfully installed 4.0.2 > on a number of Solaris servers, is trying to build it for some Linux > servers, and is running into difficulties, apparently related to the > fact that these are 64-bit machines. He would like to know if anyone has > a working 4.0.2 (64-bit) image on Ubuntu (and, presumably, if such a > person would be willing to correspond). Thanks. --PR > > (PS He mentioned in passing that apt-get got him v209...!) > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jensaxel at soegaard.net Thu Jul 17 15:53:54 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:23:34 2009 Subject: [plt-scheme] Objective-C support for PLT Scheme Message-ID: <487FA352.7050702@soegaard.net> Hi all, In the hope of eventually getting access to Cocoa on Mac OS X, I have played a little with the FFI to get Objective C support. So far I have managed to create Objective C objects and send them messages from within PLT Scheme. See the small examples in objc.scm. [Eli: Your FFI works great. The obj-send show that ffi-call came in handy, so it is a good thing it is exported from lib/foreign] What still eludes me is how to start a Cocoa application in the proper way. I hope someone more knowledgable of Mac OS X can spot what I am doing wrong. I suspect it is something simple. In the "Creating a Cocoa application in Chicken" from http://3e8.org/zb/cocoa/creating-a-cocoa-app.html the NIB-file (an XML-file with information on the GUI) is loaded, and run by calling NSApplicationMain. When I try to copy the approach I keep getting the following error: 2008-07-17 16:19:12.372 mzscheme[61080:10b] No Info.plist file in application bundle or no NSPrincipalClass in the Info.plist file, exiting Digging a little in Apples documentations one finds a simplified version of NSApplicationMain: int NSApplicationMain() { /* Store an NSApplication instance in the global variable NSApp */ [NSApplication sharedApplication]; /* Lond the nib-file describing the GUI */ [NSBundle loadNibNamed:@"MainMenu" owner:NSApp]; /* Start the application */ [NSApp run]; } Displaying the result (a zero) of [NSBundle loadNibNamed:@"MainMenu" owner:NSApp]; shows that the bundle wasn't loaded. The documentation of NSBundle says that one shouldn't give that the full path to MainMenu.nib, but that the owner somehow contains information on where to look for the bundle. I can't figure out how though. The files objc.scm and objc-support.scm are attached. If you are interested in the source for the Currency Converter, send me mail in order to get a tar-file. -- Jens Axel S?gaard -------------- next part -------------- /* The begining of ObjC support for PLT Scheme. */ /* Tested on OS 10.5 - July 2008 gcc -g -framework Foundation -framework Cocoa -dynamiclib -o objc-support.dylib -fvisibility=default objc-support.m */ #import #import #import static NSAutoreleasePool *default_pool = NULL; char *objc_description(void *s) { return [[(NSObject *)s description] UTF8String]; } void *string_to_class(char *name) { NSString *str = [[NSString alloc] initWithUTF8String: name]; void *clazz = (void *) NSClassFromString(str); [str release]; return clazz; } void *string_to_selector(char *name) { NSString *str = [[NSString alloc] initWithUTF8String: name]; SEL s = (void *)NSSelectorFromString(str); [str release]; return (void *)s; } char *selector_chars(void *sel) { SEL s = (SEL)sel; return (char *)s; } void *selector_to_signature(void *x, void *sel, bool clazz) { NSObject *o = (NSObject *)x; if (clazz) return (void *)[o methodSignatureForSelector: (SEL)sel]; else return (void *)[[o class] instanceMethodSignatureForSelector: (SEL)sel]; } char *method_return_type(void *sig) { NSMethodSignature *s = (NSMethodSignature *)sig; return [s methodReturnType]; } int method_argument_count(void *sig) { NSMethodSignature *s = (NSMethodSignature *)sig; return [s numberOfArguments]; } char *method_argument_type(void *sig, int i) { NSMethodSignature *s = (NSMethodSignature *)sig; return [s getArgumentTypeAtIndex: i]; } void *make_nsstring(char *s) { return [[NSString alloc] initWithUTF8String: s]; } bool is_nsstring(void *o) { NSObject *ob = (NSObject *)o; return [ob isKindOfClass: [NSString class]]; } void objc_release(void *o) { NSObject *obj = (NSObject *)o; [obj release]; } void objc_allocate_autorelease_pool () { default_pool = [[NSAutoreleasePool alloc] init]; } int objc_NSApplicationMain() { [NSApplication sharedApplication]; /* The following ought to load the nib-file MainMenu.nib, but doesn't ... */ return [NSBundle loadNibNamed:@"MainMenu" owner:NSApp]; /*[NSApp run]; /* ALTERNATIVE APPROACH: const char *args[10]; args[0]= "/Users/jensaxelsoegaard/Work/objc/build/Release/Currency Converter.app/Contents/MacOS/Currency Converter"; return NSApplicationMain(0, args); */ } -------------- next part -------------- ; 1. Compile obj-support.m with ; gcc -g -framework Foundation -framework Cocoa -dynamiclib -o objc-support.dylib -fvisibility=default objc-support.m ; 2. Run ; mzscheme -t objc.scm #lang scheme (provide (all-defined-out)) (require scheme/foreign mzlib/etc (only-in '#%foreign ffi-call ffi-obj)) (unsafe!) (display "Loading objc-support.dylib...\n") (flush-output) (define lib (parameterize ([current-directory (this-expression-source-directory)]) (ffi-lib "objc-support.dylib"))) (cond [lib (display "objc-support.dylib successfully loaded.\n") (flush-output)] [else (display "FAILED: Unable to load objc-support.dylib \n") (flush-output) (exit)]) ; Define Scheme structs to hold values returned from the ObjC-runtime (define-struct objc:instance (ptr)) (define-struct objc:class (ptr)) (define-struct objc:selector (ptr)) (define-struct objc:signature (ptr)) (define _instance (make-ctype _pointer objc:instance-ptr make-objc:instance)) (define _class (make-ctype _pointer objc:class-ptr make-objc:class)) (define _selector (make-ctype _pointer objc:selector-ptr make-objc:selector)) (define _signature (make-ctype _pointer objc:signature-ptr make-objc:signature)) (define _instance_or_class (make-ctype _pointer (lambda (x) (cond [(objc:class? x) (objc:class-ptr x)] [(objc:instance? x) (objc:instance-ptr x)] [else (error '_instance_or_class "got: ~a" x)])) error)) (define _something (make-ctype _pointer (lambda (x) (cond [(objc:class? x) (objc:class-ptr x)] [(objc:instance? x) (objc:instance-ptr x)] [(objc:selector? x) (objc:selector-ptr x)] [(objc:signature? x) (objc:signature-ptr x)] [else (error '_somehing "got: ~a" x)])) error)) ; Get the support functions in objc-support.m (define objc-description (get-ffi-obj "objc_description" lib (_fun _instance_or_class -> _string))) (define string->class (get-ffi-obj "string_to_class" lib (_fun _string -> _class))) (define string->selector (get-ffi-obj "string_to_selector" lib (_fun _string -> _selector))) (define selector-chars (get-ffi-obj "selector_chars" lib (_fun _selector -> _string))) (define raw:selector->signature (get-ffi-obj "selector_to_signature" lib (_fun _instance_or_class _selector _bool -> _signature))) (define method-return-type (get-ffi-obj "method_return_type" lib (_fun _signature -> _string))) (define method-argument-count (get-ffi-obj "method_argument_count" lib (_fun _signature -> _int))) (define method-argument-type (get-ffi-obj "method_argument_type" lib (_fun _signature _int -> _string))) (define make-nsstring (get-ffi-obj "make_nsstring" lib (_fun _string -> _instance))) (define is-nsstring? (get-ffi-obj "is_nsstring" lib (_fun _instance -> _bool))) (define objc-release (get-ffi-obj "objc_release" lib (_fun _something -> _void))) ;; Cocoa (define objc-application-main (get-ffi-obj "objc_NSApplicationMain" lib (_fun -> _int))) ;; Make signatures easier to work with (define (selector->signature ic s) (raw:selector->signature ic s (objc:class? ic))) (define (method-signature o sel) (let ([sig (selector->signature o sel)]) (and sig (let ([n (method-argument-count sig)]) (begin0 (if (<= n 2) (list (method-return-type sig)) (cons (method-return-type sig) (map (lambda (j) (method-argument-type sig (+ j 2))) (build-list (- n 2) values)))) (objc-release sig)))))) ; for debugging... (define (print-objc o) (let ([d (objc-description o)]) (display (cond [(and (objc:instance? o) (is-nsstring? o)) d] [(objc:instance? o) (format "#" d)] [(objc:class? o) (format "#" d)] [(objc:selector? o) (format "#" d)] [(objc:signature? o) (format "#" d)] [else (error 'objc:print "huh")])))) ; Initialize the autorelase allocation pool ; (otherwise we will get "leaking" errors) (define objc-allocate-autorelease-pool (get-ffi-obj "objc_allocate_autorelease_pool" lib (_fun -> _void))) (objc-allocate-autorelease-pool) ; Before calling a method one must use method-return-type to find ; out the return type of the method. The return type is represented ; as a string. The function return-type below converts the string representation ; into the ctypes used by PLT's foreign function interface. ; (For now only simple types, instances, classes, and selectors are supported) (define (return-type ot) ; Table 12-1 page 123 in the Objective C v2 reference ; TODO: #\q = long long ; [array type] ; {name=type ...} ; structure ; (name=type,...) ; union ; bnum ; A bit field of num bits ; ^type ; A pointer to type ; ? ; An unknown type (e.g. function pointers) (let loop ([i 0]) (case (string-ref ot i) [(#\c) _int] ; signed char [(#\v) _void] [(#\s #\i #\l #\C #\I #\S #\L) _int] [(#\f) _float] [(#\d) _double] [(#\*) _string] [(#\@) _instance] [(#\#) _class] [(#\:) _selector] [(#\^) _pointer] ; TODO ? ; these encode const, in, inout, out, bycopy, byref, and oneway respectively [(#\r #\n #\N #\o #\O #\R #\V) (loop (+ i 1))] [else (error 'return-type "got: ~a" ot)]))) ; We need the same conversion for function arguments... (define in-type return-type) ; The heart: ; obj-send calls the method of obj given by the selector. ; Since the arguments and return type depend of obj-send ; depend on the method in question, ffi-call is used ; to construct new Scheme representations of objc_msgSend ; each time it is called (TODO: These values could ; be cached to improve performance) (define obj-send ;; NOTE: The value constructed by ffi-call could be stored in a cache (let ([msg-send (ffi-obj #"objc_msgSend" lib)]) (lambda (obj sel . args) (let* ([sel (if (symbol? sel) (string->selector (symbol->string sel)) sel)] [sig (selector->signature obj sel)] [out-type (return-type (method-return-type sig))]) (apply (ffi-call msg-send (append (list _something _selector) (map in-type (cdr (method-signature obj sel)))) out-type) obj sel args))))) ;;; TEST ;; TEST1 ;(display (obj-send (make-nsstring "Fooz") 'length)) ;(newline) ;; TEST2 ;(display (method-signature (make-nsstring "Fooz") ; (string->selector "characterAtIndex:"))) ;(newline) ;; TEST3 ;(display (integer->char ; (obj-send (make-nsstring "abcde") (string->selector "characterAtIndex:") 2))) ;(newline) ;; THE PROBLEM ; The return value of objc-application-main returns 0, ; which indicate the bundle was not loaded. Why, oh why? (display "Bundle loaded?: ") (display (objc-application-main)) (newline) (display "Press enter to stop.\n") (flush-output) (read-line) (exit) From gregory.woodhouse at sbcglobal.net Thu Jul 17 16:09:47 2008 From: gregory.woodhouse at sbcglobal.net (Gregory Woodhouse) Date: Thu Mar 26 02:23:34 2009 Subject: [plt-scheme] Can I create module on the fly? Message-ID: (Actually, I'd like the module to be something I can read from a file port at runtime) My initial attempt was > (define md (quote (module m scheme/base (define x 11)))) > (define ns (module->namespace .... But here I'm stuck. By itself, md or 'md isn't a legitimate module path, but I'd like to create a namespace for eval, so I can evaluate expressions in the module environment. "The art of asking the right questions in mathematics is more important than the art of solving them." --Georg Cantor http://www.gwoodhouse.com http://GregWoodhouse.ImageKind.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080717/4572e8b4/attachment.htm From wookiz at hotmail.com Thu Jul 17 16:13:23 2008 From: wookiz at hotmail.com (wooks) Date: Thu Mar 26 02:23:35 2009 Subject: [plt-scheme] Use of empty in macro definition Message-ID: <34730cbd-fa5a-472e-947d-5a84b9652ea4@m3g2000hsc.googlegroups.com> My first foray into macros. Practicing with some exercises. (require (lib "defmacro.ss")) (define-macro thunk-it (lambda (code) (cons 'lambda (cons empty (list code))))) gives reference to undefined identifier: empty If i replace empty with '() it works. Whats happening here. From eli at barzilay.org Thu Jul 17 16:17:23 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:35 2009 Subject: [plt-scheme] Can I create module on the fly? In-Reply-To: References: Message-ID: <18559.43219.871226.905198@arabic.ccs.neu.edu> On Jul 17, Gregory Woodhouse wrote: > (Actually, I'd like the module to be something I can read from a file > port at runtime) > > My initial attempt was > > > (define md (quote > (module m scheme/base > (define x 11)))) > > (define ns (module->namespace .... > > But here I'm stuck. By itself, md or 'md isn't a legitimate module > path, but I'd like to create a namespace for eval, so I can evaluate > expressions in the module environment. You will need to use `eval' if you want to do that: (eval md) will create the module code, and (eval '(require 'm)) will require it into the current namespace. Note that 'foo is used for modules that were created dynamically. To get the module's namespace you need to quote the module's spec, which means a double quote is needed: (define ns (module->namespace ''m)) (eval 'x ns) [Usual `eval' disclaimers apply.] -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jos.koot at telefonica.net Thu Jul 17 16:23:29 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:35 2009 Subject: [plt-scheme] Can I create module on the fly? References: Message-ID: <003801c8e84a$f9ee5830$2101a8c0@uw2b2dff239c4d> You mean (require scheme/base) (define mm '(module mm mzscheme (provide z) (define z 3))) (define ns (make-base-namespace)) (eval mm ns) (eval '(require 'mm) ns) (eval 'z ns) ;--> 3 ??? Jos ----- Original Message ----- From: Gregory Woodhouse To: plt-scheme@list.cs.brown.edu Sent: Thursday, July 17, 2008 10:09 PM Subject: [plt-scheme] Can I create module on the fly? (Actually, I'd like the module to be something I can read from a file port at runtime) My initial attempt was > (define md (quote (module m scheme/base (define x 11)))) > (define ns (module->namespace .... But here I'm stuck. By itself, md or 'md isn't a legitimate module path, but I'd like to create a namespace for eval, so I can evaluate expressions in the module environment. "The art of asking the right questions in mathematics is more important than the art of solving them." --Georg Cantor http://www.gwoodhouse.com http://GregWoodhouse.ImageKind.com ------------------------------------------------------------------------------ _________________________________________________ For list-related administrative tasks: http://list.cs.brown.edu/mailman/listinfo/plt-scheme -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080717/563f47a5/attachment.html From eli at barzilay.org Thu Jul 17 16:24:53 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:36 2009 Subject: [plt-scheme] Use of empty in macro definition In-Reply-To: <34730cbd-fa5a-472e-947d-5a84b9652ea4@m3g2000hsc.googlegroups.com> References: <34730cbd-fa5a-472e-947d-5a84b9652ea4@m3g2000hsc.googlegroups.com> Message-ID: <18559.43669.631442.541695@arabic.ccs.neu.edu> On Jul 17, wooks wrote: > My first foray into macros. Practicing with some exercises. > (require (lib "defmacro.ss")) > (define-macro thunk-it > (lambda (code) > (cons 'lambda (cons empty (list code))))) > > gives > > reference to undefined identifier: empty > > If i replace empty with '() it works. This code uses `empty', which you need to have at the syntax level: (require (for-syntax scheme/list)) But if you want to start learning macros, it is almost always better to use `syntax-rules'. In your case, you want to turn a form like (thunk-it ) into a thunk expression: (lambda () ) The nice thing about `syntax-rules' is that it allows you to write just this transformation specification: (define-syntax thunk-it (syntax-rules () [(thunk-it expr) (lambda () expr)])) And using this you get the usualy hygiene benefits, for example: > (define twelve (let ([lambda list]) (thunk-it 12))) > (twelve) 12 This wouldn't work with `define-macro'. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From grettke at acm.org Thu Jul 17 16:28:46 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:36 2009 Subject: [plt-scheme] Can I create module on the fly? In-Reply-To: <003801c8e84a$f9ee5830$2101a8c0@uw2b2dff239c4d> References: <003801c8e84a$f9ee5830$2101a8c0@uw2b2dff239c4d> Message-ID: <756daca50807171328l32c43742gd54c23106156cc8b@mail.gmail.com> I recall a thread about someone generating a module at runtime, dumping it to a file, and then dynamic-requiring it to utilize its contents. Is that relevant here? From gregory.woodhouse at sbcglobal.net Thu Jul 17 16:31:58 2008 From: gregory.woodhouse at sbcglobal.net (Gregory Woodhouse) Date: Thu Mar 26 02:23:36 2009 Subject: [plt-scheme] Can I create module on the fly? In-Reply-To: <18559.43219.871226.905198@arabic.ccs.neu.edu> References: <18559.43219.871226.905198@arabic.ccs.neu.edu> Message-ID: <4EFF3D19-96E7-4152-AA8B-5C21EA0FD39B@sbcglobal.net> On Jul 17, 2008, at 1:17 PM, Eli Barzilay wrote: > [Usual `eval' disclaimers apply.] That's what I was afraid of. The idea here (and I'm really just experimenting at this stage) is to set up a network server that can read lists, apply a function to them and write back the resulting expression. The trick is that I want to be able to deploy these functions without restarting the server (much as you would with EJBs in GlassFish or WebLogic). I'm not sure quite how to package these "tea leaves", as I call them, but I thought modules would be a good starting point. "The art of asking the right questions in mathematics is more important than the art of solving them." --Georg Cantor http://www.gwoodhouse.com http://GregWoodhouse.ImageKind.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080717/d5b264ca/attachment.htm From jensaxel at soegaard.net Thu Jul 17 16:37:45 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:23:37 2009 Subject: [plt-scheme] Can I create module on the fly? In-Reply-To: References: Message-ID: <487FAD99.6010401@soegaard.net> Gregory Woodhouse skrev: > (Actually, I'd like the module to be something I can read from a file > port at runtime) > > My initial attempt was > > > (define md (quote > (module m scheme/base > (define x 11)))) > > (define ns (module->namespace .... > > But here I'm stuck. By itself, md or 'md isn't a legitimate module > path, but I'd like to create a namespace for eval, so I can evaluate > expressions in the module environment. Just thinking out loud. How about: 1. Use write to save md to a file named "md.scm". 2. Use dynamic-require. ? -- Jens Axel S?gaard From eli at barzilay.org Thu Jul 17 16:50:58 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:37 2009 Subject: [plt-scheme] Can I create module on the fly? In-Reply-To: <4EFF3D19-96E7-4152-AA8B-5C21EA0FD39B@sbcglobal.net> References: <18559.43219.871226.905198@arabic.ccs.neu.edu> <4EFF3D19-96E7-4152-AA8B-5C21EA0FD39B@sbcglobal.net> Message-ID: <18559.45234.993848.114856@arabic.ccs.neu.edu> On Jul 17, Gregory Woodhouse wrote: > > On Jul 17, 2008, at 1:17 PM, Eli Barzilay wrote: > > > [Usual `eval' disclaimers apply.] > > That's what I was afraid of. > > The idea here (and I'm really just experimenting at this stage) is > to set up a network server that can read lists, apply a function to > them and write back the resulting expression. You mean apply a function that is specified as part of the input, I assume. > The trick is that I want to be able to deploy these functions > without restarting the server (much as you would with EJBs in > GlassFish or WebLogic). I'm not sure quite how to package these "tea > leaves", as I call them, but I thought modules would be a good > starting point. Well, one thing that you can do is keep one module per function. For example, "foo.ss" has #lang scheme (provide run) (define (run x y z) (* (+ x y) z)) when you read the list in, you can do something like this (warning: untested code): (define (process-call name args) (unless (symbol? name) (error "malformed request")) (let ([file (format "/some/dir/~a.ss" name)]) (unless (file-exists? file) (error "unknown call")) (let ([run (dynamic-require `(file ,file) 'run)]) (unless (procedure? run) (error "bad module code")) (unless (procedue-arity-includes run (length args)) (error "wrong number of arguments")) (apply run args)))) This way you can easily add new "verbs" to the directory with no restarts needed. The only catch is that if you redefine an existing module then you will need to restart. See the code at "collects/handin-server/private/reloadable.ss" for an example of code that reloads a module when the file changes (something like `auto-reload-procedure' seems like it can be useful). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Thu Jul 17 16:52:40 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:37 2009 Subject: [plt-scheme] Can I create module on the fly? In-Reply-To: <487FAD99.6010401@soegaard.net> References: <487FAD99.6010401@soegaard.net> Message-ID: <18559.45336.193931.743970@arabic.ccs.neu.edu> On Jul 17, Jens Axel Soegaard wrote: > Gregory Woodhouse skrev: > > (Actually, I'd like the module to be something I can read from a file > > port at runtime) > > > > My initial attempt was > > > > > (define md (quote > > (module m scheme/base > > (define x 11)))) > > > (define ns (module->namespace .... > > > > But here I'm stuck. By itself, md or 'md isn't a legitimate module > > path, but I'd like to create a namespace for eval, so I can evaluate > > expressions in the module environment. > > Just thinking out loud. How about: > > 1. Use write to save md to a file named "md.scm". > 2. Use dynamic-require. > > ? (BTW, this is equivalent to `eval' -- and having this done for expressions that you read from a port is not really a good idea...) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From grettke at acm.org Thu Jul 17 16:53:00 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:37 2009 Subject: [plt-scheme] Confusing continuation behavior (a question about) Message-ID: <756daca50807171353t60564bf8p49a9f28e71585eff@mail.gmail.com> Hi, In v372 I wrote some code (pretty big language) to try to understand how one might utilize continuations to write processes that could pause and resume. It is toy code, it stops at two points, each time checking for some "condition" to be true, and then proceeds, finally adding two numbers. Here is the code, along with some output: (define cond1 #f) (define cond2 #f) (define (foo-process arg1 arg2) (define (process) (call/cc impl)) (define (impl return) (begin (printf "Passed in args ~a and ~a~n" arg1 arg2) (let/cc resume-here (set! impl resume-here)) (if cond1 (printf "Condition 1 is met, going to condition 2~n") (return "Condition 1 not met")) (let/cc resume-here (set! impl resume-here)) (if cond2 (printf "Condition 2 is met, can finish the process~n") (return "Condition 2 not met")) (printf "The process has finished with values ~a and ~a~n" arg1 arg2) (let ((result (+ arg1 arg2))) (let/cc resume-here (set! impl resume-here)) (return result)))) process) (define a-process (foo-process 13 29)) (define b-process (foo-process 665 1)) (a-process) (set! cond1 #t) (a-process) (set! cond2 #t) (a-process) (b-process) ; Passed in args 13 and 29 ; "Condition 1 not met~n" ; Condition 1 is met, going to condition 2 ; "Condition 2 not met~n" ; Condition 2 is met, can finish the process ; The process has finished with values 13 and 29 ; 42 I just cut it over to 4.0.2 with #lang scheme, and I get a behavior I don't understand, it basically enters an infinite loop because the execution of the program never reaches the point where cond2 gets set to #t. Instead, it just loops forever like this (I debugged it): 1 -> 2 -> 3 -> 1 -> 2 -> 3 -> ... 1. (a-process) 2. (set! cond1 #t) 3. (a-process) 4. (set! cond2 #t) I have *just* started digging into this, but let/cc doesn't seem to have changed... more later. From grettke at acm.org Thu Jul 17 16:54:37 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:37 2009 Subject: [plt-scheme] Can I create module on the fly? In-Reply-To: <18559.45336.193931.743970@arabic.ccs.neu.edu> References: <487FAD99.6010401@soegaard.net> <18559.45336.193931.743970@arabic.ccs.neu.edu> Message-ID: <756daca50807171354j7026fe5ck97ce061fe179d0b6@mail.gmail.com> >> Just thinking out loud. How about: >> >> 1. Use write to save md to a file named "md.scm". >> 2. Use dynamic-require. >> >> ? > > (BTW, this is equivalent to `eval' -- and having this done for > expressions that you read from a port is not really a good idea...) Do you mean that it is the same under the hood? Why would someone use dynamic-require rather than eval? From eli at barzilay.org Thu Jul 17 16:57:14 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:37 2009 Subject: [plt-scheme] Can I create module on the fly? In-Reply-To: <756daca50807171354j7026fe5ck97ce061fe179d0b6@mail.gmail.com> References: <487FAD99.6010401@soegaard.net> <18559.45336.193931.743970@arabic.ccs.neu.edu> <756daca50807171354j7026fe5ck97ce061fe179d0b6@mail.gmail.com> Message-ID: <18559.45610.799886.110704@arabic.ccs.neu.edu> On Jul 17, Grant Rettke wrote: > >> Just thinking out loud. How about: > >> > >> 1. Use write to save md to a file named "md.scm". > >> 2. Use dynamic-require. > >> > >> ? > > > > (BTW, this is equivalent to `eval' -- and having this done for > > expressions that you read from a port is not really a good idea...) > > Do you mean that it is the same under the hood? In both cases you evaluate random code. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jos.koot at telefonica.net Thu Jul 17 17:09:44 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:38 2009 Subject: [plt-scheme] Confusing continuation behavior (a question about) References: <756daca50807171353t60564bf8p49a9f28e71585eff@mail.gmail.com> Message-ID: <006801c8e851$703d4e00$2101a8c0@uw2b2dff239c4d> Did this woprk in 371? I doubt it. Procedure process calls the same procedure every time. It does not feel the (set! impl resume-here) for this is an assignment on a local variable of procefdure impl. while procedure process looks in a global variable with the same name. Things may work better when placing (define (impl return) ...) within procedure process. You may want a look at: http://schemecookbook.org/Cookbook/CoRoutines Jos ----- Original Message ----- From: "Grant Rettke" To: "PLT-list" Sent: Thursday, July 17, 2008 10:53 PM Subject: [plt-scheme] Confusing continuation behavior (a question about) > Hi, > > In v372 I wrote some code (pretty big language) to try to understand > how one might utilize continuations to write processes that could > pause and resume. > > It is toy code, it stops at two points, each time checking for some > "condition" to be true, and then proceeds, finally adding two numbers. > > Here is the code, along with some output: > > (define cond1 #f) > (define cond2 #f) > (define (foo-process arg1 arg2) > > (define (process) > (call/cc impl)) > > (define (impl return) > (begin > (printf "Passed in args ~a and ~a~n" arg1 arg2) > (let/cc resume-here (set! impl resume-here)) > (if cond1 > (printf "Condition 1 is met, going to condition 2~n") > (return "Condition 1 not met")) > (let/cc resume-here (set! impl resume-here)) > (if cond2 > (printf "Condition 2 is met, can finish the process~n") > (return "Condition 2 not met")) > (printf "The process has finished with values ~a and ~a~n" arg1 > arg2) > (let ((result (+ arg1 arg2))) > (let/cc resume-here (set! impl resume-here)) > (return result)))) > > process) > > (define a-process (foo-process 13 29)) > (define b-process (foo-process 665 1)) > (a-process) > (set! cond1 #t) > (a-process) > (set! cond2 #t) > (a-process) > (b-process) > > ; Passed in args 13 and 29 > ; "Condition 1 not met~n" > ; Condition 1 is met, going to condition 2 > ; "Condition 2 not met~n" > ; Condition 2 is met, can finish the process > ; The process has finished with values 13 and 29 > ; 42 > > I just cut it over to 4.0.2 with #lang scheme, and I get a behavior I > don't understand, it basically enters an infinite loop because the > execution of the program never reaches the point where cond2 gets set > to #t. Instead, it just loops forever like this (I debugged it): > > 1 -> 2 -> 3 -> 1 -> 2 -> 3 -> ... > > 1. (a-process) > 2. (set! cond1 #t) > 3. (a-process) > 4. (set! cond2 #t) > > I have *just* started digging into this, but let/cc doesn't seem to > have changed... more later. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From grettke at acm.org Thu Jul 17 17:11:31 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:38 2009 Subject: [plt-scheme] Confusing continuation behavior (a question about) In-Reply-To: <006801c8e851$703d4e00$2101a8c0@uw2b2dff239c4d> References: <756daca50807171353t60564bf8p49a9f28e71585eff@mail.gmail.com> <006801c8e851$703d4e00$2101a8c0@uw2b2dff239c4d> Message-ID: <756daca50807171411r7b3feec5y8c5ad50ea434bfe0@mail.gmail.com> > Did this woprk in 371? I doubt it. It worked in v372 (I copied the output of the program into comments). From mflatt at cs.utah.edu Thu Jul 17 17:17:40 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:38 2009 Subject: [plt-scheme] Confusing continuation behavior (a question about) In-Reply-To: <756daca50807171353t60564bf8p49a9f28e71585eff@mail.gmail.com> References: <756daca50807171353t60564bf8p49a9f28e71585eff@mail.gmail.com> Message-ID: <20080717211740.F1ED76500AA@mail-svr1.cs.utah.edu> At Thu, 17 Jul 2008 15:53:00 -0500, "Grant Rettke" wrote: > In v372 I wrote some code (pretty big language) to try to understand > how one might utilize continuations to write processes that could > pause and resume. > [...] > I just cut it over to 4.0.2 with #lang scheme, and I get a behavior I > don't understand, it basically enters an infinite loop because the > execution of the program never reaches the point where cond2 gets set > to #t. I haven't looked closely, but: There's a prompt around each evaluation of a top-level expression, such as in Pretty Big. There's no such prompt around expressions at the top of a module. Matthew From gregory.woodhouse at sbcglobal.net Thu Jul 17 17:30:50 2008 From: gregory.woodhouse at sbcglobal.net (Gregory Woodhouse) Date: Thu Mar 26 02:23:38 2009 Subject: [plt-scheme] Can I create module on the fly? In-Reply-To: <18559.45610.799886.110704@arabic.ccs.neu.edu> References: <487FAD99.6010401@soegaard.net> <18559.45336.193931.743970@arabic.ccs.neu.edu> <756daca50807171354j7026fe5ck97ce061fe179d0b6@mail.gmail.com> <18559.45610.799886.110704@arabic.ccs.neu.edu> Message-ID: <442EDC1F-657A-4DC4-89F6-3FDE88D1E13E@sbcglobal.net> On Jul 17, 2008, at 1:57 PM, Eli Barzilay wrote: > In both cases you evaluate random code. That's one reason why I had been thinking about writing an interpreter that would reasonably safe (kind of like the Java sandbox concept). But then, that raises the question of whether I can leverage PLT Scheme instead of trying to interpret everything at runtime. The other reason i that I really enjoyed SICP when I read it a year or two ago and wanted to give PLAI a go. So, in other words, if I sound a bit disorganized it may be that I am! :) "Oh would that my mind could let fall its dead ideas, as the tree does its withered leaves." --Andr? Gide http://www.gwoodhouse.com http://GregWoodhouse.ImageKind.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080717/8f161ab4/attachment.html From jos.koot at telefonica.net Thu Jul 17 18:15:44 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:39 2009 Subject: [plt-scheme] Confusing continuation behavior (a question about) References: <756daca50807171353t60564bf8p49a9f28e71585eff@mail.gmail.com> Message-ID: <008d01c8e85a$a85766a0$2101a8c0@uw2b2dff239c4d> Placing impl within process does work: #lang scheme (define cond1 #f) (define cond2 #f) (define (foo-process arg1 arg2) (define (process) (define (impl return) (printf "Passed in args ~a and ~a~n" arg1 arg2) (let/cc resume-here (set! impl resume-here)) (if cond1 (printf "Condition 1 is met, going to condition 2~n") (return "Condition 1 not met")) (let/cc resume-here (set! impl resume-here)) (if cond2 (printf "Condition 2 is met, can finish the process~n") (return "Condition 2 not met")) (printf "The process has finished with values ~a and ~a~n" arg1 arg2) (let ((result (+ arg1 arg2))) (let/cc resume-here (set! impl resume-here)) (return result))) (call/cc impl)) process) (define a-process (foo-process 13 29)) (define b-process (foo-process 665 1)) (a-process) (set! cond1 #t) (a-process) (set! cond2 #t) (a-process) (b-process) Welcome to DrScheme, version 4.0.2.3-svn17jul2008 [3m]. Language: Module; memory limit: 600 megabytes. Passed in args 13 and 29 "Condition 1 not met" Passed in args 13 and 29 Condition 1 is met, going to condition 2 "Condition 2 not met" Passed in args 13 and 29 Condition 1 is met, going to condition 2 Condition 2 is met, can finish the process The process has finished with values 13 and 29 42 Passed in args 665 and 1 Condition 1 is met, going to condition 2 Condition 2 is met, can finish the process The process has finished with values 665 and 1 666 > ----- Original Message ----- From: "Grant Rettke" To: "PLT-list" Sent: Thursday, July 17, 2008 10:53 PM Subject: [plt-scheme] Confusing continuation behavior (a question about) > Hi, > > In v372 I wrote some code (pretty big language) to try to understand > how one might utilize continuations to write processes that could > pause and resume. > > It is toy code, it stops at two points, each time checking for some > "condition" to be true, and then proceeds, finally adding two numbers. > > Here is the code, along with some output: > > (define cond1 #f) > (define cond2 #f) > (define (foo-process arg1 arg2) > > (define (process) > (call/cc impl)) > > (define (impl return) > (begin > (printf "Passed in args ~a and ~a~n" arg1 arg2) > (let/cc resume-here (set! impl resume-here)) > (if cond1 > (printf "Condition 1 is met, going to condition 2~n") > (return "Condition 1 not met")) > (let/cc resume-here (set! impl resume-here)) > (if cond2 > (printf "Condition 2 is met, can finish the process~n") > (return "Condition 2 not met")) > (printf "The process has finished with values ~a and ~a~n" arg1 > arg2) > (let ((result (+ arg1 arg2))) > (let/cc resume-here (set! impl resume-here)) > (return result)))) > > process) > > (define a-process (foo-process 13 29)) > (define b-process (foo-process 665 1)) > (a-process) > (set! cond1 #t) > (a-process) > (set! cond2 #t) > (a-process) > (b-process) > > ; Passed in args 13 and 29 > ; "Condition 1 not met~n" > ; Condition 1 is met, going to condition 2 > ; "Condition 2 not met~n" > ; Condition 2 is met, can finish the process > ; The process has finished with values 13 and 29 > ; 42 > > I just cut it over to 4.0.2 with #lang scheme, and I get a behavior I > don't understand, it basically enters an infinite loop because the > execution of the program never reaches the point where cond2 gets set > to #t. Instead, it just loops forever like this (I debugged it): > > 1 -> 2 -> 3 -> 1 -> 2 -> 3 -> ... > > 1. (a-process) > 2. (set! cond1 #t) > 3. (a-process) > 4. (set! cond2 #t) > > I have *just* started digging into this, but let/cc doesn't seem to > have changed... more later. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From eli at barzilay.org Thu Jul 17 18:30:54 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:23:39 2009 Subject: [plt-scheme] Can I create module on the fly? In-Reply-To: <442EDC1F-657A-4DC4-89F6-3FDE88D1E13E@sbcglobal.net> References: <487FAD99.6010401@soegaard.net> <18559.45336.193931.743970@arabic.ccs.neu.edu> <756daca50807171354j7026fe5ck97ce061fe179d0b6@mail.gmail.com> <18559.45610.799886.110704@arabic.ccs.neu.edu> <442EDC1F-657A-4DC4-89F6-3FDE88D1E13E@sbcglobal.net> Message-ID: <18559.51230.785600.395374@arabic.ccs.neu.edu> On Jul 17, Gregory Woodhouse wrote: > > On Jul 17, 2008, at 1:57 PM, Eli Barzilay wrote: > > > In both cases you evaluate random code. > > That's one reason why I had been thinking about writing an > interpreter that would reasonably safe (kind of like the Java > sandbox concept). But then, that raises the question of whether I > can leverage PLT Scheme instead of trying to interpret everything at > runtime. There are two options here -- if you want to just have a kind of a remote procedure call facility, then what I posted earlier should be the best fit -- you control the functions that are available completely. If you want a restricted evaluation, you can use `eval' in a namespace that you construct carefully so that it doesn't have any `dangerous' bindings in -- but that's not possible unless you *really* restrict your language (eg, my signature). A much better solution is to just use the sandbox library: http://docs.plt-scheme.org/reference/Sandboxed_Evaluation.html > The other reason i that I really enjoyed SICP when I read it a year > or two ago and wanted to give PLAI a go. Sure, you can write an interpreter, but that's a completely different thing. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From anton at appsolutions.com Thu Jul 17 19:36:13 2008 From: anton at appsolutions.com (Anton van Straaten) Date: Thu Mar 26 02:23:39 2009 Subject: [plt-scheme] Confusing continuation behavior (a question about) In-Reply-To: <756daca50807171353t60564bf8p49a9f28e71585eff@mail.gmail.com> References: <756daca50807171353t60564bf8p49a9f28e71585eff@mail.gmail.com> Message-ID: <487FD76D.9010001@appsolutions.com> Grant Rettke wrote: > I just cut it over to 4.0.2 with #lang scheme, and I get a behavior I > don't understand, it basically enters an infinite loop because the > execution of the program never reaches the point where cond2 gets set > to #t. Instead, it just loops forever like this (I debugged it): > > 1 -> 2 -> 3 -> 1 -> 2 -> 3 -> ... > > 1. (a-process) > 2. (set! cond1 #t) > 3. (a-process) > 4. (set! cond2 #t) Here's a clue: after line 3 invokes the continuation that re-enters 'impl', what is the value of 'return'? Once you've figured that out, the obvious question is what should the value of 'return' be, and how can you set it to the right value? Setting it to the right value might seem tricky depending on how comfortable you are with continuations. More clues are available if necessary... (A couple of other comments: 1. Matthew correctly identified why this used to work - there's a kind of bug in this code which was being hidden by the presence of prompts around top-level expressions in non-module-languages. In Pretty Big or even in older PLT versions, if you wrap all the top level expressions in a function, it should reproduce the bug. 2. Jos Koot's solution doesn't achieve the desired effect, since it simply re-executes the whole of 'impl' every time. impl is local with respect to 'process', so the effect of the set! is lost once control transfers out of the procedure. This can be seen in the output which repeats "Condition 1 is met, going to condition 2" three times.) Anton From jos.koot at telefonica.net Thu Jul 17 19:58:55 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:39 2009 Subject: Fw: [plt-scheme] Confusing continuation behavior (a question about) Message-ID: <00b601c8e869$12b04090$2101a8c0@uw2b2dff239c4d> Oops. So sorry. Jos > > ----- Original Message ----- > From: "Anton van Straaten" > To: "Grant Rettke" > Cc: "PLT-list" > Sent: Friday, July 18, 2008 1:36 AM > Subject: Re: [plt-scheme] Confusing continuation behavior (a question > about) > > > >> 2. Jos Koot's solution doesn't achieve the desired effect, since it >> simply re-executes the whole of 'impl' every time. impl is local with >> respect to 'process', so the effect of the set! is lost once control >> transfers out of the procedure. This can be seen in the output which >> repeats "Condition 1 is met, going to condition 2" three times.) >> >> Anton >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From anton at appsolutions.com Thu Jul 17 20:29:07 2008 From: anton at appsolutions.com (Anton van Straaten) Date: Thu Mar 26 02:23:39 2009 Subject: Fw: [plt-scheme] Confusing continuation behavior (a question about) In-Reply-To: <00b601c8e869$12b04090$2101a8c0@uw2b2dff239c4d> References: <00b601c8e869$12b04090$2101a8c0@uw2b2dff239c4d> Message-ID: <487FE3D3.6070200@appsolutions.com> Sorry, I didn't mean to be so blunt about it - I was too focused on the problem. Anton Jos Koot wrote: > > > > Oops. So sorry. > Jos >> >> ----- Original Message ----- From: "Anton van Straaten" >> >> To: "Grant Rettke" >> Cc: "PLT-list" >> Sent: Friday, July 18, 2008 1:36 AM >> Subject: Re: [plt-scheme] Confusing continuation behavior (a question >> about) >> >> >> >>> 2. Jos Koot's solution doesn't achieve the desired effect, since it >>> simply re-executes the whole of 'impl' every time. impl is local >>> with respect to 'process', so the effect of the set! is lost once >>> control transfers out of the procedure. This can be seen in the >>> output which repeats "Condition 1 is met, going to condition 2" three >>> times.) >>> >>> Anton >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jos.koot at telefonica.net Thu Jul 17 20:53:57 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:40 2009 Subject: Fw: [plt-scheme] Confusing continuation behavior (a question about) References: <00b601c8e869$12b04090$2101a8c0@uw2b2dff239c4d> <487FE3D3.6070200@appsolutions.com> Message-ID: <00c701c8e870$c2aa9700$2101a8c0@uw2b2dff239c4d> ----- Original Message ----- From: "Anton van Straaten" To: "Jos Koot" Cc: Sent: Friday, July 18, 2008 2:29 AM Subject: Re: Fw: [plt-scheme] Confusing continuation behavior (a question about) > Sorry, I didn't mean to be so blunt about it - I was too focused on the > problem. I have the one to be sorry. I did not take your remark as blunt. It was right. May be the following does what is wanted (just following the recipe): #lang scheme (define cond1 #f) (define cond2 #f) (define (foo-process arg1 arg2 name) (define (toggle (arg 'ignore)) (let ((old-state state)) (let/cc cc (set! state cc) (old-state arg)))) (define (state ignore) (define done1 #f) (define done2 #f) (printf "~a Passed in args ~a and ~a~n" name arg1 arg2) (let loop () (unless done1 (if cond1 (begin (set! done1 #t) (printf "~a Condition 1 is met, going to condition 2~n" name)) (begin (toggle (list name "Condition 1 not met")) (loop))))) (let loop () (if cond2 (begin (set! done2 #t) (printf "~a Condition 2 is met, can finish the process~n" name)) (begin (toggle (list name "Condition 2 not met")) (loop)))) (printf "The process has finished with values ~a and ~a~n" arg1 arg2) (let ((result (+ arg1 arg2)) (old-state state)) (set! state (lambda (ignore) (error 'process "~a called after finish" name))) (old-state result))) toggle) (define a-process (foo-process 13 29 'aaa)) (define b-process (foo-process 665 1 'bbb)) (a-process) (set! cond1 #t) (a-process) (set! cond2 #t) (a-process) (b-process) ;Welcome to DrScheme, version 4.0.2.3-svn17jul2008 [3m]. ;Language: Module; memory limit: 600 megabytes. ;aaa Passed in args 13 and 29 ;(aaa "Condition 1 not met") ;aaa Condition 1 is met, going to condition 2 ;(aaa "Condition 2 not met") ;aaa Condition 2 is met, can finish the process ;The process has finished with values 13 and 29 ;42 ;bbb Passed in args 665 and 1 ;bbb Condition 1 is met, going to condition 2 ;bbb Condition 2 is met, can finish the process ;The process has finished with values 665 and 1 ;666 ;> > > > Anton > > > Jos Koot wrote: >> >> >> >> Oops. So sorry. >> Jos >>> >>> ----- Original Message ----- From: "Anton van Straaten" >>> >>> To: "Grant Rettke" >>> Cc: "PLT-list" >>> Sent: Friday, July 18, 2008 1:36 AM >>> Subject: Re: [plt-scheme] Confusing continuation behavior (a question >>> about) >>> >>> >>> >>>> 2. Jos Koot's solution doesn't achieve the desired effect, since it >>>> simply re-executes the whole of 'impl' every time. impl is local with >>>> respect to 'process', so the effect of the set! is lost once control >>>> transfers out of the procedure. This can be seen in the output which >>>> repeats "Condition 1 is met, going to condition 2" three times.) >>>> >>>> Anton >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme From sk at cs.brown.edu Thu Jul 17 20:56:16 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:23:40 2009 Subject: [plt-scheme] And now for an actual Scheme question (PLAI) In-Reply-To: <487F6082.2080701@uwaterloo.ca> References: <653FA7F2-D267-4612-BC4B-066C547CE70D@sbcglobal.net> <487F6082.2080701@uwaterloo.ca> Message-ID: You're a dangerous man, Prabhakar! I *am* going to excom you now. Gregory seems to have enough on his hands. You're having him go off-track in a Land Rover without knowing whether he knows how to fix a boiling radiator, shift into 4WD, or use a hitch to pull himself out of a flooding gully. That's irresponsible. Gregory: I would suggest that you: - download the PLAI add-on (available from the book's home page, and tested for 4.x) - use the book's notation - get on with writing *interpreters* and stop worrying about parsing After you get the initial parser working (as you have), you will add at most one line to the parser per chapter, and that line will mostly be a copy-and-paste job. So worrying about parsing won't get you anywhere. In contrast, using TYPE-CASE will find several bugs for you (as Eli has nicely described) and help you focus on the right-hand-sides. Yes, MATCH will do the same, but - you don't get as much static checking - you've veered off from the book: you can no longer just copy code from the book and try it out If you get through half the book and find that you're nailing all the conceptual material and the interpreters, and your *single biggest problem* is dealing with s-expression syntax, you can use Prabhakar's MATCH suggestion. But not before then. Yellow card for you, Prabhakar. Shriram From jos.koot at telefonica.net Thu Jul 17 21:12:17 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:40 2009 Subject: Fw: [plt-scheme] Confusing continuation behavior (a questionabout) References: <00b601c8e869$12b04090$2101a8c0@uw2b2dff239c4d><487FE3D3.6070200@appsolutions.com> <00c701c8e870$c2aa9700$2101a8c0@uw2b2dff239c4d> Message-ID: <00d601c8e873$52918250$2101a8c0@uw2b2dff239c4d> The done1, done2 and unless done1 etc can be omitted. Jos From plragde at uwaterloo.ca Thu Jul 17 21:53:55 2008 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Thu Mar 26 02:23:40 2009 Subject: [plt-scheme] And now for an actual Scheme question (PLAI) In-Reply-To: References: <653FA7F2-D267-4612-BC4B-066C547CE70D@sbcglobal.net> <487F6082.2080701@uwaterloo.ca> Message-ID: <487FF7B3.3080307@uwaterloo.ca> Shriram Krishnamurthi wrote: > You're a dangerous man, Prabhakar! > > I *am* going to excom you now. Heh, heh. Nothing like poking Shriram's buttons. > - you've veered off from the book: you can no longer just copy code > from the book and try it out I note that Samuel Beckett, born in Ireland and raised speaking English, achieved some of his greatest effects by deliberately choosing to write in French. While copying code and playing with it gives one a firm base from which to conduct exploration, reimplementing it in a different manner tests depth of understanding. But I agree that one should really have a good reason to deviate from PLAI. I just didn't want to let the notion that PLT match might be useful in this context (and many others) go unsupported. --PR From grettke at acm.org Thu Jul 17 22:04:27 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:40 2009 Subject: [plt-scheme] Can I create module on the fly? In-Reply-To: <18559.51230.785600.395374@arabic.ccs.neu.edu> References: <487FAD99.6010401@soegaard.net> <18559.45336.193931.743970@arabic.ccs.neu.edu> <756daca50807171354j7026fe5ck97ce061fe179d0b6@mail.gmail.com> <18559.45610.799886.110704@arabic.ccs.neu.edu> <442EDC1F-657A-4DC4-89F6-3FDE88D1E13E@sbcglobal.net> <18559.51230.785600.395374@arabic.ccs.neu.edu> Message-ID: <756daca50807171904w4419c511mcc000c741112d2f9@mail.gmail.com> Here are some links: http://schemecookbook.org/Cookbook/DynamicEvalCustomNamespace http://schemecookbook.org/Cookbook/DynamicUntrustedEval http://download.plt-scheme.org/doc/372/html/mzlib/mzlib-Z-H-41.html#node_chap_41 http://planet.plt-scheme.org/display.ss?package=namespace.plt&owner=schematics From sk at cs.brown.edu Thu Jul 17 22:07:52 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:23:40 2009 Subject: [plt-scheme] And now for an actual Scheme question (PLAI) In-Reply-To: <487FF7B3.3080307@uwaterloo.ca> References: <653FA7F2-D267-4612-BC4B-066C547CE70D@sbcglobal.net> <487F6082.2080701@uwaterloo.ca> <487FF7B3.3080307@uwaterloo.ca> Message-ID: > I note that Samuel Beckett, born in Ireland and raised speaking English, > achieved some of his greatest effects by deliberately choosing to write in > French. ...and Beckett wrote absurdist material. So there. Shriram From plragde at uwaterloo.ca Thu Jul 17 22:17:54 2008 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Thu Mar 26 02:23:41 2009 Subject: [plt-scheme] And now for an actual Scheme question (PLAI) In-Reply-To: References: <653FA7F2-D267-4612-BC4B-066C547CE70D@sbcglobal.net> <487F6082.2080701@uwaterloo.ca> <487FF7B3.3080307@uwaterloo.ca> Message-ID: <487FFD52.5090604@uwaterloo.ca> Shriram Krishnamurthi wrote: > ...and Beckett wrote absurdist material. > > So there. Well, Joseph Conrad, then. Though I think that "Try again. Fail again. Fail better." is highly apropos to what we are discussing. --PR From anton at appsolutions.com Thu Jul 17 22:21:25 2008 From: anton at appsolutions.com (Anton van Straaten) Date: Thu Mar 26 02:23:41 2009 Subject: [plt-scheme] And now for an actual Scheme question (PLAI) In-Reply-To: References: <653FA7F2-D267-4612-BC4B-066C547CE70D@sbcglobal.net> <487F6082.2080701@uwaterloo.ca> Message-ID: <487FFE25.7090801@appsolutions.com> Shriram Krishnamurthi wrote: > You're a dangerous man, Prabhakar! > > I *am* going to excom you now. Prabhakar, this explains why your tech guy is having trouble building PLT 4.0.2 on Ubuntu! You'll need to search around the web for a bootleg copy that doesn't check the PLT blacklist during the build. o_O Anton From plragde at uwaterloo.ca Thu Jul 17 22:30:13 2008 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Thu Mar 26 02:23:41 2009 Subject: [plt-scheme] And now for an actual Scheme question (PLAI) In-Reply-To: <487FFE25.7090801@appsolutions.com> References: <653FA7F2-D267-4612-BC4B-066C547CE70D@sbcglobal.net> <487F6082.2080701@uwaterloo.ca> <487FFE25.7090801@appsolutions.com> Message-ID: <48800035.9080703@uwaterloo.ca> Anton van Straaten wrote: > You'll need to search around the web for a bootleg > copy that doesn't check the PLT blacklist during the build. o_O Yeah, well, two can play at that game. I'm in negotiations with the GHC people... --PR From grettke at acm.org Thu Jul 17 22:57:30 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:41 2009 Subject: [plt-scheme] Confusing continuation behavior (a question about) In-Reply-To: <487FD76D.9010001@appsolutions.com> References: <756daca50807171353t60564bf8p49a9f28e71585eff@mail.gmail.com> <487FD76D.9010001@appsolutions.com> Message-ID: <756daca50807171957j778e2d90sc5491e49639da087@mail.gmail.com> On Thu, Jul 17, 2008 at 6:36 PM, Anton van Straaten wrote: >> 1 -> 2 -> 3 -> 1 -> 2 -> 3 -> ... >> >> 1. (a-process) >> 2. (set! cond1 #t) >> 3. (a-process) >> 4. (set! cond2 #t) > > Here's a clue: after line 3 invokes the continuation that re-enters 'impl', > what is the value of 'return'? Here are my thoughts. I am still studying continuations. Honestly, I have a hard time visualizing them, but from stepping through with the debugger I think I've got a visual of what is happening along with my rudimentary practice of converting simple functions to CPS style. Are these thoughts correct? The first time 'a-process' gets called at line 1, the the value bound to 'return' is a continuation that looks like this: (lambda (ignored) (begin (a-process) (set! cond1 #t) (a-process) rest of program...)) The second time 'a-process' gets called at line 3, the value of 'return' is still the same as above because when impl was rebound, that was the value bound to return. After the call at line 3, we really want return to be bound to this: (lambda (ignored) (begin ;;;;; (a-process) ;;;;; (set! cond1 #t) (a-process) rest of program...)) So the question is, when we pass control to impl that second time after binding cond1 to #t, how do we access the *that* continuation and bind it to return. I'm going to do some reading. From gregory.woodhouse at sbcglobal.net Thu Jul 17 23:24:09 2008 From: gregory.woodhouse at sbcglobal.net (Gregory Woodhouse) Date: Thu Mar 26 02:23:42 2009 Subject: [plt-scheme] And now for an actual Scheme question (PLAI) In-Reply-To: References: <653FA7F2-D267-4612-BC4B-066C547CE70D@sbcglobal.net> <487F6082.2080701@uwaterloo.ca> Message-ID: On Jul 17, 2008, at 5:56 PM, Shriram Krishnamurthi wrote: > Gregory: > > I would suggest that you: > > - download the PLAI add-on (available from the book's home page, and > tested for 4.x) That doesn't seem to work setup-plt: version: 4.0.2 [3m] setup-plt: variants: 3m setup-plt: main collects: /Applications/PLT Scheme v4.0.2/collects setup-plt: collects paths: setup-plt: /Users/greg/Library/PLT Scheme/4.0.2/collects setup-plt: /Applications/PLT Scheme v4.0.2/collects cannot install; version (200) of collection ("mzscheme") is required, but version (400) is installed === context === /Applications/PLT Scheme v4.0.2/collects/setup/unpack.ss:374:42: loop /Applications/PLT Scheme v4.0.2/collects/setup/unpack.ss:264:10 "You can't win if you don't finish the race." --Richard Petty http://www.gwoodhouse.com http://GregWoodhouse.ImageKind.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080717/bec707a7/attachment.htm From jos.koot at telefonica.net Thu Jul 17 23:34:25 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:42 2009 Subject: [plt-scheme] Confusing continuation behavior (a question about) References: <756daca50807171353t60564bf8p49a9f28e71585eff@mail.gmail.com><487FD76D.9010001@appsolutions.com> <756daca50807171957j778e2d90sc5491e49639da087@mail.gmail.com> Message-ID: <001d01c8e887$2d91ad90$2101a8c0@uw2b2dff239c4d> Does procedure toggle give you a hint? There are in fact two continuations to be taken care of, that of the process and that of the program calling the process. When the program runs, the continuation of the process must be kept safe. In this case the program knows its own continuation. When the process runs, the continuation of the calling program must be kept safe. In this case the process knows its own continuation. Therefore one variable is enough for saving both. This is done in variable state. Procedure toggle exchanges the continuation of the process with that of the calling program and reversely. When the program calls toggle, the continuation of the progam is stored and that of the the process is called. When the process calls toggle, the continuation of the process is stored and that of the program is called. May be you like to read some of my essay http://www.telefonica.net/web2/koot/coroutines-essay.doc You probably like to skip the first 7 pages and start at the section called "Self-replacing procedures". In my essay I start with two separate variables for the two continuations and subsequently show that at any given time only one of them is relevant. Good luck, Jos BTW, the diagnosis of the problem is correct: There are in fact two continuations to be taken care of. ----- Original Message ----- From: "Grant Rettke" To: "PLT-list" Sent: Friday, July 18, 2008 4:57 AM Subject: Re: [plt-scheme] Confusing continuation behavior (a question about) > On Thu, Jul 17, 2008 at 6:36 PM, Anton van Straaten > wrote: >>> 1 -> 2 -> 3 -> 1 -> 2 -> 3 -> ... >>> >>> 1. (a-process) >>> 2. (set! cond1 #t) >>> 3. (a-process) >>> 4. (set! cond2 #t) >> >> Here's a clue: after line 3 invokes the continuation that re-enters >> 'impl', >> what is the value of 'return'? > > Here are my thoughts. I am still studying continuations. Honestly, I > have a hard time visualizing them, but from stepping through with the > debugger I think I've got a visual of what is happening along with my > rudimentary practice of converting simple functions to CPS style. Are > these thoughts correct? > > > The first time 'a-process' gets called at line 1, the the value bound > to 'return' is a continuation that looks like this: > > (lambda (ignored) > (begin > (a-process) > (set! cond1 #t) > (a-process) > rest of program...)) > > The second time 'a-process' gets called at line 3, the value of > 'return' is still the same as above because when impl was rebound, > that was the value bound to return. After the call at line 3, we > really want return to be bound to this: > > (lambda (ignored) > (begin > ;;;;; (a-process) > ;;;;; (set! cond1 #t) > (a-process) > rest of program...)) > > So the question is, when we pass control to impl that second time > after binding cond1 to #t, how do we access the *that* continuation > and bind it to return. I'm going to do some reading. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From geoff at knauth.org Thu Jul 17 23:42:37 2008 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:23:42 2009 Subject: [plt-scheme] And now for an actual Scheme question (PLAI) In-Reply-To: References: <653FA7F2-D267-4612-BC4B-066C547CE70D@sbcglobal.net> <487F6082.2080701@uwaterloo.ca> Message-ID: Try this one: http://www.cs.brown.edu/~arjun/ts/plai-v4.plt On Jul 17, 2008, at 23:24, Gregory Woodhouse wrote: > On Jul 17, 2008, at 5:56 PM, Shriram Krishnamurthi wrote: >> Gregory: >> I would suggest that you: >> - download the PLAI add-on (available from the book's home page, and >> tested for 4.x) > >> > That doesn't seem to work > > setup-plt: version: 4.0.2 [3m] > setup-plt: variants: 3m > setup-plt: main collects: /Applications/PLT Scheme v4.0.2/collects > setup-plt: collects paths: > setup-plt: /Users/greg/Library/PLT Scheme/4.0.2/collects > setup-plt: /Applications/PLT Scheme v4.0.2/collects > cannot install; version (200) of collection ("mzscheme") is > required, but version (400) is installed > > === context === > /Applications/PLT Scheme v4.0.2/collects/setup/unpack.ss:374:42: loop > /Applications/PLT Scheme v4.0.2/collects/setup/unpack.ss:264:10 From grettke at acm.org Thu Jul 17 23:45:47 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:42 2009 Subject: [plt-scheme] Confusing continuation behavior (a question about) In-Reply-To: <001d01c8e887$2d91ad90$2101a8c0@uw2b2dff239c4d> References: <756daca50807171353t60564bf8p49a9f28e71585eff@mail.gmail.com> <487FD76D.9010001@appsolutions.com> <756daca50807171957j778e2d90sc5491e49639da087@mail.gmail.com> <001d01c8e887$2d91ad90$2101a8c0@uw2b2dff239c4d> Message-ID: <756daca50807172045t7983714flb884a945d7441783@mail.gmail.com> > You probably like to skip the first 7 pages and start at the section called > "Self-replacing procedures". > In my essay I start with two separate variables for the two continuations > and subsequently show that at any given time only one of them is relevant. Definitely. > Good luck, Jos Thanks! From geoff at knauth.org Fri Jul 18 00:03:21 2008 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:23:42 2009 Subject: [plt-scheme] Confusing continuation behavior (a question about) In-Reply-To: <756daca50807171957j778e2d90sc5491e49639da087@mail.gmail.com> References: <756daca50807171353t60564bf8p49a9f28e71585eff@mail.gmail.com> <487FD76D.9010001@appsolutions.com> <756daca50807171957j778e2d90sc5491e49639da087@mail.gmail.com> Message-ID: <05268ADE-8226-464A-9CC5-C77BF98ABD22@knauth.org> On Jul 17, 2008, at 22:57, Grant Rettke wrote: > I am still studying continuations. Honestly, I > have a hard time visualizing them, but from stepping through with the > debugger I think I've got a visual of what is happening along with my > rudimentary practice of converting simple functions to CPS style. Sometimes it helps me to remember Unix and Perl pipes of old and mentally replace the k's with |'s (vertical bars). Continuations are not pipes, so don't take my analogy too far, but the endianness of the k notation helps me distinguish passing and receiving from invocation, or calls that do piecework from those that finish the job. From sk at cs.brown.edu Fri Jul 18 00:19:13 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:23:43 2009 Subject: [plt-scheme] And now for an actual Scheme question (PLAI) In-Reply-To: References: <653FA7F2-D267-4612-BC4B-066C547CE70D@sbcglobal.net> <487F6082.2080701@uwaterloo.ca> Message-ID: Are you sure you're using the right version? Which URL did you use? On Thu, Jul 17, 2008 at 11:24 PM, Gregory Woodhouse wrote: > > On Jul 17, 2008, at 5:56 PM, Shriram Krishnamurthi wrote: > > Gregory: > > I would suggest that you: > > - download the PLAI add-on (available from the book's home page, and > > tested for 4.x) > > That doesn't seem to work > setup-plt: version: 4.0.2 [3m] > setup-plt: variants: 3m > setup-plt: main collects: /Applications/PLT Scheme v4.0.2/collects > setup-plt: collects paths: > setup-plt: /Users/greg/Library/PLT Scheme/4.0.2/collects > setup-plt: /Applications/PLT Scheme v4.0.2/collects > cannot install; version (200) of collection ("mzscheme") is required, but > version (400) is installed > === context === > /Applications/PLT Scheme v4.0.2/collects/setup/unpack.ss:374:42: loop > /Applications/PLT Scheme v4.0.2/collects/setup/unpack.ss:264:10 > > "You can't win if you don't finish the race." > --Richard Petty > http://www.gwoodhouse.com > http://GregWoodhouse.ImageKind.com > > > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From anton at appsolutions.com Fri Jul 18 00:24:37 2008 From: anton at appsolutions.com (Anton van Straaten) Date: Thu Mar 26 02:23:43 2009 Subject: [plt-scheme] Confusing continuation behavior (a question about) In-Reply-To: <756daca50807171957j778e2d90sc5491e49639da087@mail.gmail.com> References: <756daca50807171353t60564bf8p49a9f28e71585eff@mail.gmail.com> <487FD76D.9010001@appsolutions.com> <756daca50807171957j778e2d90sc5491e49639da087@mail.gmail.com> Message-ID: <48801B05.3040302@appsolutions.com> Grant Rettke wrote: > On Thu, Jul 17, 2008 at 6:36 PM, Anton van Straaten > wrote: >>> 1 -> 2 -> 3 -> 1 -> 2 -> 3 -> ... >>> >>> 1. (a-process) >>> 2. (set! cond1 #t) >>> 3. (a-process) >>> 4. (set! cond2 #t) >> Here's a clue: after line 3 invokes the continuation that re-enters 'impl', >> what is the value of 'return'? > > Here are my thoughts. I am still studying continuations. Honestly, I > have a hard time visualizing them I don't think you should expect otherwise, they're pretty tricky. > but from stepping through with the > debugger I think I've got a visual of what is happening along with my > rudimentary practice of converting simple functions to CPS style. Are > these thoughts correct? > > > The first time 'a-process' gets called at line 1, the the value bound > to 'return' is a continuation that looks like this: > > (lambda (ignored) > (begin > (a-process) > (set! cond1 #t) > (a-process) > rest of program...)) Close. The first call to a-process doesn't belong there, because you're trying to represent the continuation of that call, which doesn't include the call itself. Just removing that first call gives a reasonable approximation: (lambda (ignored) (set! cond1 #t) (a-process) ...rest of program...) This is correct as long as we ignore the interaction with the REPL, which is appropriate if the code is running as a module. (In the original example, the return value of a-process gets displayed by the REPL, i.e. "Condition 1 not met" in this case. But modeling that here would complicate things unnecessarily.) It might help to think about this if the top-level program was a more functional expression, like this: (let ((result1 (a-process))) (set! cond1 #t) (let ((result2 (a-process))) ...rest of program...)) Explicitly saving the results of the call to a-process makes it easier to see the relationship to the continuation of the first call to a-process, which now looks more like this: (lambda (result1) (set! cond1 #t) (let ((result2 (a-process))) ...rest of program...)) ...which of course is very similar to my first version above. > The second time 'a-process' gets called at line 3, the value of > 'return' is still the same as above because when impl was rebound, > that was the value bound to return. Correct! > After the call at line 3, we > really want return to be bound to this: > > (lambda (ignored) > (begin > ;;;;; (a-process) > ;;;;; (set! cond1 #t) > (a-process) > rest of program...)) Correct, except that again, the second call to a-process doesn't belong inside its own continuation. > So the question is, when we pass control to impl that second time > after binding cond1 to #t, how do we access the *that* continuation > and bind it to return. I'm going to do some reading. Here's a hint: on the second call, impl is still being invoked by call/cc, which passes a continuation to it. There are a few important questions here (in case I've over-hinted, you might want to think about them one at a time instead of reading ahead): 1. What is that continuation? You probably don't need to write it out exactly unless you want to, just figure out roughly where it's going to "return" to. 2. Is it useful? 3. What happens to it, i.e. where does the value go after it's passed to the continuation currently bound to impl? Note that as with the top-level expressions, it might help to rely less on sequences of expressions, since they can make things harder to think about because their results are implicitly discarded. This makes for sort of invisible gaps in the functional control flow, from our perspective of modeling the program's behavior. An example of such an expression is: (let/cc resume-here (set! impl resume-here)) This leads to more questions: 4. What is being implicitly discarded by this expression, i.e. what is the result of the expression? 5. Can you tie all this together to fix the bug? (Note that major rearrangement of the program isn't needed.) Anton From gregory.woodhouse at sbcglobal.net Fri Jul 18 00:24:14 2008 From: gregory.woodhouse at sbcglobal.net (Gregory Woodhouse) Date: Thu Mar 26 02:23:44 2009 Subject: [plt-scheme] And now for an actual Scheme question (PLAI) In-Reply-To: References: <653FA7F2-D267-4612-BC4B-066C547CE70D@sbcglobal.net> <487F6082.2080701@uwaterloo.ca> Message-ID: <441F9184-BAB5-4E85-9FD4-C7719367AB83@sbcglobal.net> On Jul 17, 2008, at 9:19 PM, Shriram Krishnamurthi wrote: > Are you sure you're using the right version? Which URL did you use? That was the problem. I did a Google search and got an old link. Searching for the book title, I found http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/plai-4.plt which worked perfectly. Thanks for being patient with me. "Life can only be understood going backwards, but it must be lived going forwards." --S?ren Kierkegaard http://www.gwoodhouse.com http://GregWoodhouse.ImageKind.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080717/e071e67d/attachment.html From jensaxel at soegaard.net Fri Jul 18 09:01:33 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:23:44 2009 Subject: [plt-scheme] Objective-C support for PLT Scheme In-Reply-To: <487FA352.7050702@soegaard.net> References: <487FA352.7050702@soegaard.net> Message-ID: <4880942D.1040403@soegaard.net> Jens Axel Soegaard wrote: > In the "Creating a Cocoa application in Chicken" from > http://3e8.org/zb/cocoa/creating-a-cocoa-app.html > the NIB-file (an XML-file with information on the GUI) is loaded, > and run by calling NSApplicationMain. > > When I try to copy the approach I keep getting the following error: > > 2008-07-17 16:19:12.372 mzscheme[61080:10b] > No Info.plist file in application bundle or > no NSPrincipalClass in the Info.plist file, exiting Thanks to a hint from Zbigniew (J.Ursetto) I now have a window on screen. Apparently when I start objc.scm with mzscheme -t objc.scm the path of mzscheme is used (unsuccessfully) to find a bundle. Creating a link from AppName.app/Contents/MacOS/AppName to mzscheme, and then starting objc.scm with AppName -t objc.scm will make NSApplicaionMain find the correct bundle. -- Jens Axel S?gaard From stephen at degabrielle.name Fri Jul 18 10:30:57 2008 From: stephen at degabrielle.name (Stephen De Gabrielle) Date: Thu Mar 26 02:23:44 2009 Subject: [plt-scheme] ? Spreadsheet or table widget? Message-ID: <595b9ab20807180730y27bedafay6c8ce5ba1e50e0a4@mail.gmail.com> Is anyone aware of a Spreadsheet or table widget for mred? i'm hoping to avoid writing my own editor or editor-canvas class, but any good advice is gratefully accepted. cheers stephen -- Sent from Google Mail for mobile | mobile.google.com Cheers, Stephen -- Stephen De Gabrielle s.degabrielle@cs.ucl.ac.uk Telephone +44 (0)20 7679 0693 (x30693) Mobile 079 851 890 45 Project: Making Sense of Information (MaSI) Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html Home:http://www.degabrielle.name/stephen UCL Interaction Centre MPEB 8th floor University College London Gower Street London WC1E 6BT From clements at brinckerhoff.org Fri Jul 18 12:47:54 2008 From: clements at brinckerhoff.org (John Clements) Date: Thu Mar 26 02:23:45 2009 Subject: [plt-scheme] ? Spreadsheet or table widget? In-Reply-To: <595b9ab20807180730y27bedafay6c8ce5ba1e50e0a4@mail.gmail.com> References: <595b9ab20807180730y27bedafay6c8ce5ba1e50e0a4@mail.gmail.com> Message-ID: <147FA46F-5EDF-43C5-8EA7-A8191B53D4C7@brinckerhoff.org> On Jul 18, 2008, at 7:30 AM, Stephen De Gabrielle wrote: > Is anyone aware of a Spreadsheet or table widget for mred? i'm hoping > to avoid writing my own editor or editor-canvas class, but any good > advice is gratefully accepted Spreadsheet: yes, please implement (if someone else hasn't already). I use gnucash, but I realized the other day that the only advantage of a checkbook-style program over a simple programmatic interface to the data is the ability to view the data in a table-like form. John Clements -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080718/15808f9e/smime.bin From mflatt at cs.utah.edu Fri Jul 18 13:07:21 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:45 2009 Subject: [plt-scheme] changing #lang planet Message-ID: <20080718170721.732E36500A9@mail-svr1.cs.utah.edu> Is anyone using `#lang planet'? It doesn't work the way I expected, and I'm planning to change it. Currently, `#lang planet' uses the specified package/library to get a kind of expression reader, which it calls until EOF to build up a module body. I think `#lang planet' should instead treat the package/library as the full-module reader, like `#lang' itself. Matthew From yinso.chen at gmail.com Fri Jul 18 14:40:38 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:23:45 2009 Subject: [plt-scheme] changing #lang planet In-Reply-To: <20080718170721.732E36500A9@mail-svr1.cs.utah.edu> References: <20080718170721.732E36500A9@mail-svr1.cs.utah.edu> Message-ID: <779bf2730807181140r62facb20u9166db8e22aa797a@mail.gmail.com> Hi Matthew, On Fri, Jul 18, 2008 at 10:07 AM, Matthew Flatt wrote: > Is anyone using `#lang planet'? It doesn't work the way I expected, and > I'm planning to change it. > Yes - I am, since your suggestion in http://list.cs.brown.edu/pipermail/plt-scheme/2008-July/025938.html :) > Currently, `#lang planet' uses the specified package/library to get a > kind of expression reader, which it calls until EOF to build up a > module body. I think `#lang planet' should instead treat the > package/library as the full-module reader, like `#lang' itself. > > Are you saying the reader should return the `(module ...)` expression? Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080718/1654bee4/attachment.html From mflatt at cs.utah.edu Fri Jul 18 14:43:30 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:46 2009 Subject: [plt-scheme] changing #lang planet In-Reply-To: <779bf2730807181140r62facb20u9166db8e22aa797a@mail.gmail.com> References: <20080718170721.732E36500A9@mail-svr1.cs.utah.edu> <779bf2730807181140r62facb20u9166db8e22aa797a@mail.gmail.com> Message-ID: <20080718184330.954F96500CF@mail-svr1.cs.utah.edu> At Fri, 18 Jul 2008 11:40:38 -0700, YC wrote: > > Currently, `#lang planet' uses the specified package/library to get a > > kind of expression reader, which it calls until EOF to build up a > > module body. I think `#lang planet' should instead treat the > > package/library as the full-module reader, like `#lang' itself. > > > > > Are you saying the reader should return the `(module ...)` expression? Yes. The `syntax/module-reader' library can help. Matthew From yinso.chen at gmail.com Fri Jul 18 15:29:15 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:23:46 2009 Subject: [plt-scheme] changing #lang planet In-Reply-To: <20080718184330.954F96500CF@mail-svr1.cs.utah.edu> References: <20080718170721.732E36500A9@mail-svr1.cs.utah.edu> <779bf2730807181140r62facb20u9166db8e22aa797a@mail.gmail.com> <20080718184330.954F96500CF@mail-svr1.cs.utah.edu> Message-ID: <779bf2730807181229y4d776738ke9555eb39f7cb76d@mail.gmail.com> On Fri, Jul 18, 2008 at 11:43 AM, Matthew Flatt wrote: > At Fri, 18 Jul 2008 11:40:38 -0700, YC wrote: > > > > > Are you saying the reader should return the `(module ...)` expression? > > Yes. The `syntax/module-reader' library can help. > > Thanks - I'll look into syntax/module-reader. My 2 cents is that modules like `s-exp` and `planet` as is are helpful because they provide common service to generate the module expression for custom language modules. While writing the code is not a huge challenge - having it factored out saves everyone time and effort. I suspect many custom languages do not include a full-module reader today. So if `#lang planet` is going to behave more like `#reader` going forward, then I still feel that we need to have a built-in `custom` module that can use a custom reader, as Sam TH described in http://list.cs.brown.edu/pipermail/plt-scheme/2008-July/025931.html. Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080718/da18a600/attachment.htm From grettke at acm.org Sat Jul 19 01:44:58 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:46 2009 Subject: [plt-scheme] Understanding continuations Message-ID: <756daca50807182244q619af968h60a02e3dbb5f2c7b@mail.gmail.com> I'm trying to visualize and understand continuations (this part of the work in another thread [Confusing continuation behavior (a question about)]). If I write: #lang scheme (define cont #f) (define (foo) (call/cc (lambda (arg-cont) (set! cont arg-cont))) 13) (+ 1 2 3 (foo)) Could I visualize the continuation as? (lambda (argument) (+ 1 2 3 13)) If I write: #lang scheme (define cont #f) (define (foo) (call/cc (lambda (arg-cont) (set! cont arg-cont) 13))) (+ 1 2 3 (foo)) Could I visualize the continuation as? (lambda (argument) (+ 1 2 3 argument)) The difference between the two is this: 1. In the first one, the saved continuation 'cont' will always have the same value; that of the current continuation with the value of 13 passed in to it. Every time that continuation is applied the result will be the same. It is like memoization. 2. In the second one, the continuation is awaiting a value of the function foo (or it is waiting for the expression of the call/cc block). So at any other point, that continuation could be passed "something else". In the first one, "what happens next" could never change, because it has been determined. In the second one, "what happens next" could change, because the continuation is still waiting for a value. Is that right? From pivanyi at freemail.hu Sat Jul 19 05:12:53 2008 From: pivanyi at freemail.hu (Ivanyi Peter) Date: Thu Mar 26 02:23:47 2009 Subject: [plt-scheme] ? Spreadsheet or table widget? In-Reply-To: <595b9ab20807180730y27bedafay6c8ce5ba1e50e0a4@mail.gmail.com> Message-ID: Stephen De Gabrielle ?rta: > Is anyone aware of a Spreadsheet or table widget for mred? i'm In version 372 there used to be an implementation of a spreadsheet, however on my computer that was dead slow. I do not know whether it was a problem with my computer or with the implementation. I have not checked, but maybe this implementation is available in v 402 as well. Best regards, Peter Ivanyi Biztos, hogy egyed?l akarsz bulizni ny?ron? Ha nem, tudunk egy tuti megold?st! From jos.koot at telefonica.net Sat Jul 19 05:17:00 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:47 2009 Subject: [plt-scheme] Understanding continuations References: <756daca50807182244q619af968h60a02e3dbb5f2c7b@mail.gmail.com> Message-ID: <002401c8e980$33667ee0$2101a8c0@uw2b2dff239c4d> I suggest you use DrScheme debugger to see what happens with: > #lang scheme > (define cont #f) > (define (foo) > (call/cc > (lambda (arg-cont) > (set! cont arg-cont) > 13))) > (+ 1 2 3 (foo)) (cont 4) Do you see why this happens? Jos ----- Original Message ----- From: "Grant Rettke" To: "PLT-list" Sent: Saturday, July 19, 2008 7:44 AM Subject: [plt-scheme] Understanding continuations > I'm trying to visualize and understand continuations (this part of the > work in another thread [Confusing continuation behavior (a question > about)]). > > If I write: > > #lang scheme > (define cont #f) > (define (foo) > (call/cc > (lambda (arg-cont) > (set! cont arg-cont))) > 13) > (+ 1 2 3 (foo)) > > Could I visualize the continuation as? > > (lambda (argument) > (+ 1 2 3 13)) > > If I write: > > #lang scheme > (define cont #f) > (define (foo) > (call/cc > (lambda (arg-cont) > (set! cont arg-cont) > 13))) > (+ 1 2 3 (foo)) > > Could I visualize the continuation as? > > (lambda (argument) > (+ 1 2 3 argument)) > > The difference between the two is this: > > 1. In the first one, the saved continuation 'cont' will always have > the same value; that of the current continuation with the value of 13 > passed in to it. Every time that continuation is applied the result > will be the same. It is like memoization. > > 2. In the second one, the continuation is awaiting a value of the > function foo (or it is waiting for the expression of the call/cc > block). So at any other point, that continuation could be passed > "something else". > > In the first one, "what happens next" could never change, because it > has been determined. In the second one, "what happens next" could > change, because the continuation is still waiting for a value. > > Is that right? > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jos.koot at telefonica.net Sat Jul 19 05:32:29 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:47 2009 Subject: [plt-scheme] Understanding continuations References: <756daca50807182244q619af968h60a02e3dbb5f2c7b@mail.gmail.com> Message-ID: <004101c8e982$5d90a540$2101a8c0@uw2b2dff239c4d> BTW it is right that every time you call a continuation you can pass it another argument (and if the continuation awaits a multiple value as many arguments as values expected) The important thing to keep in mind is at what point in the program the evaluation will be continued. You may want to look to the following example too: #lang scheme (require scheme/control) (define cont #f) (define (foo) (prompt (call-with-composable-continuation (lambda (arg-cont) (set! cont arg-cont) 13)))) (+ 1 2 3 (foo)) (cont 111) Jos ----- Original Message ----- From: "Grant Rettke" To: "PLT-list" Sent: Saturday, July 19, 2008 7:44 AM Subject: [plt-scheme] Understanding continuations > I'm trying to visualize and understand continuations (this part of the > work in another thread [Confusing continuation behavior (a question > about)]). > > If I write: > > #lang scheme > (define cont #f) > (define (foo) > (call/cc > (lambda (arg-cont) > (set! cont arg-cont))) > 13) > (+ 1 2 3 (foo)) > > Could I visualize the continuation as? > > (lambda (argument) > (+ 1 2 3 13)) > > If I write: > > #lang scheme > (define cont #f) > (define (foo) > (call/cc > (lambda (arg-cont) > (set! cont arg-cont) > 13))) > (+ 1 2 3 (foo)) > > Could I visualize the continuation as? > > (lambda (argument) > (+ 1 2 3 argument)) > > The difference between the two is this: > > 1. In the first one, the saved continuation 'cont' will always have > the same value; that of the current continuation with the value of 13 > passed in to it. Every time that continuation is applied the result > will be the same. It is like memoization. > > 2. In the second one, the continuation is awaiting a value of the > function foo (or it is waiting for the expression of the call/cc > block). So at any other point, that continuation could be passed > "something else". > > In the first one, "what happens next" could never change, because it > has been determined. In the second one, "what happens next" could > change, because the continuation is still waiting for a value. > > Is that right? > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From stephen at degabrielle.name Sat Jul 19 09:31:11 2008 From: stephen at degabrielle.name (Stephen De Gabrielle) Date: Thu Mar 26 02:23:47 2009 Subject: [plt-scheme] Re: ? Spreadsheet or table widget? In-Reply-To: References: <595b9ab20807180730y27bedafay6c8ce5ba1e50e0a4@mail.gmail.com> Message-ID: <595b9ab20807190631h6d3d5f7arc6201bc22c48cef@mail.gmail.com> Thanks for the tip- I've found it in the 300 branch under frtime/demo/spreadsheet/ On 7/19/08, Ivanyi Peter wrote: > Stephen De Gabrielle ?rta: > >> Is anyone aware of a Spreadsheet or table widget for > mred? i'm > > In version 372 there used to be an implementation of a > spreadsheet, > however on my computer that was dead slow. I do not know whether > it was a problem with my computer or with the implementation. > I have not checked, but maybe this implementation is > available in > v 402 as well. > > Best regards, > > Peter Ivanyi > > > Biztos, hogy egyed?l akarsz bulizni ny?ron? Ha nem, tudunk egy tuti > megold?st! > > > -- Sent from Google Mail for mobile | mobile.google.com Cheers, Stephen -- Stephen De Gabrielle s.degabrielle@cs.ucl.ac.uk Telephone +44 (0)20 7679 0693 (x30693) Mobile 079 851 890 45 Project: Making Sense of Information (MaSI) Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html Home:http://www.degabrielle.name/stephen UCL Interaction Centre MPEB 8th floor University College London Gower Street London WC1E 6BT From grettke at acm.org Sat Jul 19 16:03:52 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:47 2009 Subject: [plt-scheme] Another continuation question Message-ID: <756daca50807191303l1d035020jc1482e511466612d@mail.gmail.com> In a thread that I can't find, I'm pretty sure that Matthias posted some interesting "self modifying code" that looked like this, which I found on: http://en.wikipedia.org/wiki/Call-with-current-continuation ;; [LISTOF X] -> ( -> X u 'you-fell-off-the-end-off-the-list) (define (generate-one-element-at-a-time a-list) ;; (-> X u 'you-fell-off-the-end-off-the-list) ;; this is the actual generator, producing one item from a-list at a time (define (generator) (call/cc control-state)) ;; [CONTINUATION X] -> EMPTY ;; hand the next item from a-list to "return" (or an end-of-list marker)' (define (control-state return) (for-each (lambda (an-element-from-a-list) (call/cc (lambda (resume-here) (set! control-state resume-here) (return an-element-from-a-list)))) a-list) (return 'you-fell-off-the-end-off-the-list)) ;; time to return the generator generator) (define gen (generate-one-element-at-a-time '(a b c))) (gen) (gen) (gen) (gen) This is another chunk of code that worked fine in v372, and per the thread [Confusing continuation behavior (a question about)], I suspect that the code shouldn't have worked, because now it goes into an endless loop? I'm migrating all of my collected code snips from 3 to 4, perhaps the solution is the same as the other thread, but I haven't figured that one out yet ;). From deinst at gmail.com Sat Jul 19 17:37:22 2008 From: deinst at gmail.com (David Einstein) Date: Thu Mar 26 02:23:48 2009 Subject: [plt-scheme] Another continuation question In-Reply-To: <756daca50807191303l1d035020jc1482e511466612d@mail.gmail.com> References: <756daca50807191303l1d035020jc1482e511466612d@mail.gmail.com> Message-ID: <56750b780807191437p4364fa4fg4d695e8bcfab8d1b@mail.gmail.com> On Sat, Jul 19, 2008 at 4:03 PM, Grant Rettke wrote: > In a thread that I can't find, Check out blog.plt-scheme.org last July and August, and of course this list at the same time. > I'm pretty sure that Matthias posted > some interesting "self modifying code" that looked like this, which I > found on: > > http://en.wikipedia.org/wiki/Call-with-current-continuation > > ;; [LISTOF X] -> ( -> X u 'you-fell-off-the-end-off-the-list) > (define (generate-one-element-at-a-time a-list) > ;; (-> X u 'you-fell-off-the-end-off-the-list) > ;; this is the actual generator, producing one item from a-list at a time > (define (generator) > (call/cc control-state)) > ;; [CONTINUATION X] -> EMPTY > ;; hand the next item from a-list to "return" (or an end-of-list marker)' > (define (control-state return) > (for-each > (lambda (an-element-from-a-list) > (call/cc > (lambda (resume-here) > (set! control-state resume-here) > (return an-element-from-a-list)))) > a-list) > (return 'you-fell-off-the-end-off-the-list)) > ;; time to return the generator > generator) > > (define gen (generate-one-element-at-a-time '(a b c))) > (gen) > (gen) > (gen) > (gen) > > This is another chunk of code that worked fine in v372, and per the > thread [Confusing continuation behavior (a question about)], I suspect > that the code shouldn't have worked, because now it goes into an > endless loop? I suspect that what changed is that for each is now looking up 'control-state only once, so changing it with set! does nothing. That said, I know almost nothing about what I am talking about here. > > > I'm migrating all of my collected code snips from 3 to 4, perhaps the > solution is the same as the other thread, but I haven't figured that > one out yet ;). > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080719/13552ab6/attachment.html From deinst at gmail.com Sat Jul 19 17:43:17 2008 From: deinst at gmail.com (David Einstein) Date: Thu Mar 26 02:23:49 2009 Subject: [plt-scheme] Scribble tools. Message-ID: <56750b780807191443v9149254wfd401e3e9743e509@mail.gmail.com> Has anyone written any emacs (or any other editor) tools for editing scribble documentation? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080719/3d43aa0c/attachment.htm From anton at appsolutions.com Sat Jul 19 17:53:28 2008 From: anton at appsolutions.com (Anton van Straaten) Date: Thu Mar 26 02:23:49 2009 Subject: [plt-scheme] Another continuation question In-Reply-To: <756daca50807191303l1d035020jc1482e511466612d@mail.gmail.com> References: <756daca50807191303l1d035020jc1482e511466612d@mail.gmail.com> Message-ID: <48826258.3090005@appsolutions.com> Grant Rettke wrote: > In a thread that I can't find, I'm pretty sure that Matthias posted > some interesting "self modifying code" that looked like this, which I > found on: > > http://en.wikipedia.org/wiki/Call-with-current-continuation > > ;; [LISTOF X] -> ( -> X u 'you-fell-off-the-end-off-the-list) > (define (generate-one-element-at-a-time a-list) > ;; (-> X u 'you-fell-off-the-end-off-the-list) > ;; this is the actual generator, producing one item from a-list at a time > (define (generator) > (call/cc control-state)) > ;; [CONTINUATION X] -> EMPTY > ;; hand the next item from a-list to "return" (or an end-of-list marker)' > (define (control-state return) > (for-each > (lambda (an-element-from-a-list) > (call/cc > (lambda (resume-here) > (set! control-state resume-here) > (return an-element-from-a-list)))) > a-list) > (return 'you-fell-off-the-end-off-the-list)) > ;; time to return the generator > generator) > > (define gen (generate-one-element-at-a-time '(a b c))) > (gen) > (gen) > (gen) > (gen) > > This is another chunk of code that worked fine in v372, and per the > thread [Confusing continuation behavior (a question about)], I suspect > that the code shouldn't have worked, because now it goes into an > endless loop? That's right. As with your example, this code had a bug in that it only worked when a function like 'gen' was invoked from the top level. Matthias later fixed this bug in the code that he had posted. So one way to solve the problem is to find where he published that fix. But that would be cheating! The issues above are the same as I pointed out for the previous example. When 'gen' is invoked for the second and subsequent times, the value of 'return' isn't updated, because the control-state continuation jumps into the middle of the procedure passed to for-each. So 'return' always returns to after the first call to 'gen'. The fix will involve updating 'return' appropriately. To recap the important questions: 1. When (call/cc control-state) is evaluated on the second call to gen, what value is passed to the continuation stored in control-state? Might it be useful? What happens to that value? 2. When (call/cc (lambda (resume-here) ...) is evaluated inside the for-each, what is the result of that expression? Might it be useful? What happens to that value? 3. Is there any relationship between the values discussed in #1 and #2? Anton From anton at appsolutions.com Sat Jul 19 17:56:00 2008 From: anton at appsolutions.com (Anton van Straaten) Date: Thu Mar 26 02:23:49 2009 Subject: [plt-scheme] Another continuation question In-Reply-To: <56750b780807191437p4364fa4fg4d695e8bcfab8d1b@mail.gmail.com> References: <756daca50807191303l1d035020jc1482e511466612d@mail.gmail.com> <56750b780807191437p4364fa4fg4d695e8bcfab8d1b@mail.gmail.com> Message-ID: <488262F0.7090702@appsolutions.com> David Einstein wrote: > I suspect that what changed is that for each is now looking up > 'control-state only once, so changing it with set! does nothing. No, that's not it. Anton From anton at appsolutions.com Sat Jul 19 18:08:14 2008 From: anton at appsolutions.com (Anton van Straaten) Date: Thu Mar 26 02:23:49 2009 Subject: [plt-scheme] Understanding continuations In-Reply-To: <756daca50807182244q619af968h60a02e3dbb5f2c7b@mail.gmail.com> References: <756daca50807182244q619af968h60a02e3dbb5f2c7b@mail.gmail.com> Message-ID: <488265CE.8010907@appsolutions.com> Grant Rettke wrote: > I'm trying to visualize and understand continuations (this part of the > work in another thread [Confusing continuation behavior (a question > about)]). > > If I write: > > #lang scheme > (define cont #f) > (define (foo) > (call/cc > (lambda (arg-cont) > (set! cont arg-cont))) > 13) > (+ 1 2 3 (foo)) > > Could I visualize the continuation as? > > (lambda (argument) > (+ 1 2 3 13)) You could, but you should be aware that this is an optimized version of the continuation. The questions you've asked below might be answered more easily and precisely if you had a more detailed representation of the continuation, which at the very least should include a reference to 'argument' (other than its binding). Where does that reference belong? Also, the fact that the continuation involves some code in the body of foo and some code in the outer expression (the call to "+") isn't reflected in your version of the continuation. That would need a more detailed analysis which is probably best done after converting the code to CPS. > If I write: > > #lang scheme > (define cont #f) > (define (foo) > (call/cc > (lambda (arg-cont) > (set! cont arg-cont) > 13))) > (+ 1 2 3 (foo)) > > Could I visualize the continuation as? > > (lambda (argument) > (+ 1 2 3 argument)) Yes, with similar caveats. > The difference between the two is this: > > 1. In the first one, the saved continuation 'cont' will always have > the same value; that of the current continuation with the value of 13 > passed in to it. Every time that continuation is applied the result > will be the same. It is like memoization. In the first example, foo is a function that always returns 13, and the continuation that's captured inside foo does the same. This is not so much memoization as a continuation involving a function that returns a constant value. > 2. In the second one, the continuation is awaiting a value of the > function foo In both cases, the continuation is awaiting a value. This is very important to understand if you want to solve the bug we've been discussing. The differences between the two cases relate to what happens to the value that the continuation receives. > (or it is waiting for the expression of the call/cc > block). So at any other point, that continuation could be passed > "something else". Again, this is all true in both cases. > In the first one, "what happens next" could never change, because it > has been determined. That's about right: what happens next is that 13 is passed to foo's (implicit) continuation. > In the second one, "what happens next" could > change, because the continuation is still waiting for a value. > > Is that right? See if you can restate it taking into account the fact that both continuations expect, and receive, a value. Anton From grettke at acm.org Sat Jul 19 20:25:56 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:50 2009 Subject: [plt-scheme] Announce: DrSync, v1.0.2 Message-ID: <756daca50807191725x310700ceo62238e2b09e6411d@mail.gmail.com> Hi folks, Thanks to great documentation and the fine members of this list, I've prepared another release of DrSync for DrScheme. DrSync reverts your files when DrScheme's frame activates and saves them when it deactivates. Something like this would be of particular interest to folks who run external programs like version control or build related tools on files which they are editing inside of DrScheme. What changed? It has been updated for 4.x. All feedback appreciated. Here is the link: http://planet.plt-scheme.org/display.ss?package=drsync.plt&owner=grettke Best wishes, Grant Rettke From grettke at acm.org Sat Jul 19 21:35:13 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:50 2009 Subject: [plt-scheme] Understanding continuations In-Reply-To: <002401c8e980$33667ee0$2101a8c0@uw2b2dff239c4d> References: <756daca50807182244q619af968h60a02e3dbb5f2c7b@mail.gmail.com> <002401c8e980$33667ee0$2101a8c0@uw2b2dff239c4d> Message-ID: <756daca50807191835h326c4639gb91904f77d5648ff@mail.gmail.com> On Sat, Jul 19, 2008 at 4:17 AM, Jos Koot wrote: > I suggest you use DrScheme debugger to see what happens with: > >> #lang scheme >> (define cont #f) >> (define (foo) >> (call/cc >> (lambda (arg-cont) >> (set! cont arg-cont) >> 13))) >> (+ 1 2 3 (foo)) > > (cont 4) > Do you see why this happens? It happens because the continuation looks like this: (lambda (value) (+ 1 2 3 value)) From grettke at acm.org Sat Jul 19 21:39:25 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:50 2009 Subject: [plt-scheme] Understanding continuations In-Reply-To: <488265CE.8010907@appsolutions.com> References: <756daca50807182244q619af968h60a02e3dbb5f2c7b@mail.gmail.com> <488265CE.8010907@appsolutions.com> Message-ID: <756daca50807191839x64f86782o76d37b4b699b121e@mail.gmail.com> > See if you can restate it taking into account the fact that both > continuations expect, and receive, a value. I am going to be working on this for a while. My silence is not my giving up, rather, schedule conflicts, combined with my needing time to dig into this. Thank you! I will keep digging! From grettke at acm.org Sat Jul 19 21:42:23 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:50 2009 Subject: [plt-scheme] Another continuation question In-Reply-To: <48826258.3090005@appsolutions.com> References: <756daca50807191303l1d035020jc1482e511466612d@mail.gmail.com> <48826258.3090005@appsolutions.com> Message-ID: <756daca50807191842q2b411a9ft763bf9ebd66ff550@mail.gmail.com> > Matthias later fixed this bug in the code that he had posted. So one way to > solve the problem is to find where he published that fix. But that would be > cheating! It also wouldn't be very fun! :) > To recap the important questions: I will keep digging. Thanks for the great questions. From geoff at knauth.org Sat Jul 19 23:30:16 2008 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:23:50 2009 Subject: [plt-scheme] Scribble tools. In-Reply-To: <56750b780807191443v9149254wfd401e3e9743e509@mail.gmail.com> References: <56750b780807191443v9149254wfd401e3e9743e509@mail.gmail.com> Message-ID: <839F8DC3-68C1-4305-893D-61BDE740380E@knauth.org> On Jul 19, 2008, at 17:43, David Einstein wrote: > Has anyone written any emacs (or any other editor) tools for editing > scribble documentation? I didn't write anything as nice as a tool. I just defined a few functions to save me some typing: (defun s-scm () (interactive) (save-restriction (narrow-to-region (mark) (point)) (goto-char (point-min)) (insert "@scheme[") (goto-char (point-max)) (insert "]"))) (defun s-sb () (interactive) (save-restriction (narrow-to-region (mark) (point)) (goto-char (point-min)) (insert "@schemeblock[") (goto-char (point-max)) (insert "]"))) (defun s-tt () (interactive) (save-restriction (narrow-to-region (mark) (point)) (goto-char (point-min)) (insert "@tt{") (goto-char (point-max)) (insert "}"))) (defun s-fp () (interactive) (save-restriction (narrow-to-region (mark) (point)) (goto-char (point-min)) (insert "@filepath{") (goto-char (point-max)) (insert "}"))) (defun s-item () (interactive) (save-restriction (narrow-to-region (mark) (point)) (goto-char (point-min)) (insert "@item{") (goto-char (point-max)) (insert "}"))) (defun s-it () (interactive) (save-restriction (narrow-to-region (mark) (point)) (goto-char (point-min)) (insert "@italic{") (goto-char (point-max)) (insert "}"))) (defun s-m (type) (interactive "sType? ") (save-restriction (narrow-to-region (mark) (point)) (goto-char (point-min)) (insert "@" type "{") (goto-char (point-max)) (insert "}"))) From jos.koot at telefonica.net Sun Jul 20 06:06:13 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:50 2009 Subject: [plt-scheme] Understanding continuations References: <756daca50807182244q619af968h60a02e3dbb5f2c7b@mail.gmail.com> <002401c8e980$33667ee0$2101a8c0@uw2b2dff239c4d> <756daca50807191835h326c4639gb91904f77d5648ff@mail.gmail.com> Message-ID: <001d01c8ea50$3e2710d0$2101a8c0@uw2b2dff239c4d> Where will the value of (lambda (value) (+ 1 2 3 value)) be delivered? Jos ----- Original Message ----- From: "Grant Rettke" To: "Jos Koot" Cc: "PLT-list" Sent: Sunday, July 20, 2008 3:35 AM Subject: Re: [plt-scheme] Understanding continuations > On Sat, Jul 19, 2008 at 4:17 AM, Jos Koot wrote: >> I suggest you use DrScheme debugger to see what happens with: >> >>> #lang scheme >>> (define cont #f) >>> (define (foo) >>> (call/cc >>> (lambda (arg-cont) >>> (set! cont arg-cont) >>> 13))) >>> (+ 1 2 3 (foo)) >> >> (cont 4) >> Do you see why this happens? > > It happens because the continuation looks like this: > > (lambda (value) > (+ 1 2 3 value)) From jos.koot at telefonica.net Sun Jul 20 06:15:12 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:23:50 2009 Subject: [plt-scheme] Understanding continuations References: <756daca50807182244q619af968h60a02e3dbb5f2c7b@mail.gmail.com><002401c8e980$33667ee0$2101a8c0@uw2b2dff239c4d><756daca50807191835h326c4639gb91904f77d5648ff@mail.gmail.com> <001d01c8ea50$3e2710d0$2101a8c0@uw2b2dff239c4d> Message-ID: <003901c8ea51$7fa799c0$2101a8c0@uw2b2dff239c4d> This was not very precise: When (lambda (value) (+ 1 2 3 value)) is called, where does it return the value? Jos ----- Original Message ----- From: "Jos Koot" To: "Grant Rettke" Cc: "PLT-list" Sent: Sunday, July 20, 2008 12:06 PM Subject: Re: [plt-scheme] Understanding continuations > Where will the value of (lambda (value) (+ 1 2 3 value)) be delivered? > Jos > > ----- Original Message ----- > From: "Grant Rettke" > To: "Jos Koot" > Cc: "PLT-list" > Sent: Sunday, July 20, 2008 3:35 AM > Subject: Re: [plt-scheme] Understanding continuations > > >> On Sat, Jul 19, 2008 at 4:17 AM, Jos Koot >> wrote: >>> I suggest you use DrScheme debugger to see what happens with: >>> >>>> #lang scheme >>>> (define cont #f) >>>> (define (foo) >>>> (call/cc >>>> (lambda (arg-cont) >>>> (set! cont arg-cont) >>>> 13))) >>>> (+ 1 2 3 (foo)) >>> >>> (cont 4) >>> Do you see why this happens? >> >> It happens because the continuation looks like this: >> >> (lambda (value) >> (+ 1 2 3 value)) > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From deinst at gmail.com Sun Jul 20 10:59:28 2008 From: deinst at gmail.com (David Einstein) Date: Thu Mar 26 02:23:51 2009 Subject: [plt-scheme] Scribble tools. In-Reply-To: <839F8DC3-68C1-4305-893D-61BDE740380E@knauth.org> References: <56750b780807191443v9149254wfd401e3e9743e509@mail.gmail.com> <839F8DC3-68C1-4305-893D-61BDE740380E@knauth.org> Message-ID: <56750b780807200759u7e3b88abm7b2ac25a9da1e690@mail.gmail.com> Thanks. This is better than the macros I had. On Sat, Jul 19, 2008 at 11:30 PM, Geoffrey S. Knauth wrote: > On Jul 19, 2008, at 17:43, David Einstein wrote: > >> Has anyone written any emacs (or any other editor) tools for editing >> scribble documentation? >> > > I didn't write anything as nice as a tool. I just defined a few functions > to save me some typing: > > (defun s-scm () > (interactive) > (save-restriction > (narrow-to-region (mark) (point)) > (goto-char (point-min)) > (insert "@scheme[") > (goto-char (point-max)) > (insert "]"))) > > (defun s-sb () > (interactive) > (save-restriction > (narrow-to-region (mark) (point)) > (goto-char (point-min)) > (insert "@schemeblock[") > (goto-char (point-max)) > (insert "]"))) > > (defun s-tt () > (interactive) > (save-restriction > (narrow-to-region (mark) (point)) > (goto-char (point-min)) > (insert "@tt{") > (goto-char (point-max)) > (insert "}"))) > > (defun s-fp () > (interactive) > (save-restriction > (narrow-to-region (mark) (point)) > (goto-char (point-min)) > (insert "@filepath{") > (goto-char (point-max)) > (insert "}"))) > > (defun s-item () > (interactive) > (save-restriction > (narrow-to-region (mark) (point)) > (goto-char (point-min)) > (insert "@item{") > (goto-char (point-max)) > (insert "}"))) > > (defun s-it () > (interactive) > (save-restriction > (narrow-to-region (mark) (point)) > (goto-char (point-min)) > (insert "@italic{") > (goto-char (point-max)) > (insert "}"))) > > (defun s-m (type) > (interactive "sType? ") > (save-restriction > (narrow-to-region (mark) (point)) > (goto-char (point-min)) > (insert "@" type "{") > (goto-char (point-max)) > (insert "}"))) > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080720/d73b1173/attachment.html From grettke at acm.org Sun Jul 20 11:37:29 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:51 2009 Subject: [plt-scheme] Scribble tools. In-Reply-To: <839F8DC3-68C1-4305-893D-61BDE740380E@knauth.org> References: <56750b780807191443v9149254wfd401e3e9743e509@mail.gmail.com> <839F8DC3-68C1-4305-893D-61BDE740380E@knauth.org> Message-ID: <756daca50807200837g31e042dfu78daa53b7f77e60b@mail.gmail.com> > (defun s-scm () Geoff, where is defun defined? From grettke at acm.org Sun Jul 20 11:38:35 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:51 2009 Subject: [plt-scheme] Scribble tools. In-Reply-To: <756daca50807200837g31e042dfu78daa53b7f77e60b@mail.gmail.com> References: <56750b780807191443v9149254wfd401e3e9743e509@mail.gmail.com> <839F8DC3-68C1-4305-893D-61BDE740380E@knauth.org> <756daca50807200837g31e042dfu78daa53b7f77e60b@mail.gmail.com> Message-ID: <756daca50807200838g271090c9r77c2985547f78289@mail.gmail.com> > Geoff, where is defun defined? Oh those aren't DrScheme keyboard macros, they are elisp! From pivanyi at freemail.hu Sun Jul 20 17:50:10 2008 From: pivanyi at freemail.hu (Ivanyi Peter) Date: Thu Mar 26 02:23:52 2009 Subject: [plt-scheme] ANN: dialog handling Message-ID: Hi all, This is only a "small" announcement. :-) I have created a little module which can load an XML file and create a dialog window from it. The module also provides a simple interface to handle the widgets. Nothing great, nothing new, but maybe interesting for somebody. See the example files in the ZIP package. I will use it in the SX modeller. It is still under development. http://www.hexahedron.hu/personal/peteri/dialog Or http://www.hexahedron.hu/personal/peteri/plt/index.html Best regards, Peter Ivanyi Biztos, hogy egyed?l akarsz bulizni ny?ron? Ha nem, tudunk egy tuti megold?st! From grettke at acm.org Sun Jul 20 20:38:07 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:52 2009 Subject: [plt-scheme] ANN: dialog handling In-Reply-To: References: Message-ID: <756daca50807201738q6f67e18aq3d920c40940279f9@mail.gmail.com> Hi Ivanyi, I see that you've got the directory structure set up in the collects dir. Does this code need to be installed to a particular location? Grant From grettke at acm.org Sun Jul 20 21:37:33 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:52 2009 Subject: [plt-scheme] Understanding continuations In-Reply-To: <003901c8ea51$7fa799c0$2101a8c0@uw2b2dff239c4d> References: <756daca50807182244q619af968h60a02e3dbb5f2c7b@mail.gmail.com> <002401c8e980$33667ee0$2101a8c0@uw2b2dff239c4d> <756daca50807191835h326c4639gb91904f77d5648ff@mail.gmail.com> <001d01c8ea50$3e2710d0$2101a8c0@uw2b2dff239c4d> <003901c8ea51$7fa799c0$2101a8c0@uw2b2dff239c4d> Message-ID: <756daca50807201837w623f4b65o3e399798addd68a@mail.gmail.com> > When (lambda (value) (+ 1 2 3 value)) is called, where does it return the value? If the continuations were passed explicitly, I think it would look like this (I also bound the result of calling foo): #lang scheme (define cont #f) (define (foo arg-cont) (set! cont arg-cont) (arg-cont 13)) (let ([value (foo (lambda (value) (+ 1 2 3 value)))]) (printf "~a~n" value)) When the continuation returns, it jumps back into the control flow of the top-level-execution, in the environment where cont and foo are bound, but 'value' is not yet bound. Is that correct? It is as though a bigger function exists at the top level, for which some names are bound, and the continuation calls into that function, providing the object for value. It is that idea that I read about (tail-transfer), where you never return, you just keep going to the "next place", conceptually at least. In the let block, conceptually what has to happen is that it is actually another function. I'm on thin ice here, am I going in the right direction? From geoff at knauth.org Mon Jul 21 00:09:55 2008 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:23:52 2009 Subject: [plt-scheme] Scribble tools. In-Reply-To: <756daca50807200838g271090c9r77c2985547f78289@mail.gmail.com> References: <56750b780807191443v9149254wfd401e3e9743e509@mail.gmail.com> <839F8DC3-68C1-4305-893D-61BDE740380E@knauth.org> <756daca50807200837g31e042dfu78daa53b7f77e60b@mail.gmail.com> <756daca50807200838g271090c9r77c2985547f78289@mail.gmail.com> Message-ID: <8532A6C4-4EF1-41B6-B53F-B5D656B40AC7@knauth.org> On Jul 20, 2008, at 11:38, Grant Rettke wrote: >> Geoff, where is defun defined? > Oh those aren't DrScheme keyboard macros, they are elisp! #t From grettke at acm.org Mon Jul 21 00:30:53 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:53 2009 Subject: [plt-scheme] mzscheme --script and console output Message-ID: <756daca50807202130g5265e354w8f59dfbf3548c0dc@mail.gmail.com> Hi, In v372 you could run mzscheme with the --script argument on code like this: (printf "Hello, world.~n") in the console, and output would get dumped to the console, but no in 4.x. What changed? From noelwelsh at gmail.com Mon Jul 21 01:59:45 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:23:53 2009 Subject: [plt-scheme] mzscheme --script and console output In-Reply-To: <756daca50807202130g5265e354w8f59dfbf3548c0dc@mail.gmail.com> References: <756daca50807202130g5265e354w8f59dfbf3548c0dc@mail.gmail.com> Message-ID: > mzscheme --eval '(printf "OH HAI!\n")' OH HAI! See mzcheme --help for all command line options. N. On Mon, Jul 21, 2008 at 5:30 AM, Grant Rettke wrote: > Hi, > > In v372 you could run mzscheme with the --script argument on code like this: > > (printf "Hello, world.~n") > > in the console, and output would get dumped to the console, but no in 4.x. > > What changed? From doolagarl2002 at yahoo.com.au Mon Jul 21 02:32:16 2008 From: doolagarl2002 at yahoo.com.au (Scott Brown) Date: Thu Mar 26 02:23:53 2009 Subject: [plt-scheme] compile: bad syntax; function application is not allowed Message-ID: <479757.26044.qm@web56406.mail.re3.yahoo.com> When I try to load one file in another file using PLT Scheme 4 like this (load "sicp2.scm") I get the following error: "sicp2.scm:1:0: compile: bad syntax; function application is not allowed, because no #%app syntax transformer is bound in" How can I fix this? Start at the new Yahoo!7 for a better online experience. www.yahoo7.com.au From mflatt at cs.utah.edu Mon Jul 21 08:16:43 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:53 2009 Subject: [plt-scheme] mzscheme --script and console output In-Reply-To: <756daca50807202130g5265e354w8f59dfbf3548c0dc@mail.gmail.com> References: <756daca50807202130g5265e354w8f59dfbf3548c0dc@mail.gmail.com> Message-ID: <20080721121647.A203165008D@mail-svr1.cs.utah.edu> At Sun, 20 Jul 2008 23:30:53 -0500, "Grant Rettke" wrote: > In v372 you could run mzscheme with the --script argument on code like this: > > (printf "Hello, world.~n") > > in the console, and output would get dumped to the console, but no in 4.x. > > What changed? I don't think the `--script'/`-r' flag changed, except that the code in the given file is evaluated in a much bigger language (`scheme' instead of `mzscheme' or `scheme/base'). Matthew From mflatt at cs.utah.edu Mon Jul 21 08:21:30 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:53 2009 Subject: [plt-scheme] compile: bad syntax; function application is not allowed In-Reply-To: <479757.26044.qm@web56406.mail.re3.yahoo.com> References: <479757.26044.qm@web56406.mail.re3.yahoo.com> Message-ID: <20080721122134.71A1C65008D@mail-svr1.cs.utah.edu> At Sun, 20 Jul 2008 23:32:16 -0700 (PDT), Scott Brown wrote: > When I try to load one file in another file using PLT Scheme 4 like this > (load "sicp2.scm") I get the following error: > > "sicp2.scm:1:0: compile: bad syntax; function application is not allowed, > because no #%app syntax transformer is bound in" > > How can I fix this? The code that calls `load' is in a module, right? See http://docs.plt-scheme.org/guide/eval.html#(part._namespaces) http://list.cs.brown.edu/pipermail/plt-scheme/2008-July/025652.html http://list.cs.brown.edu/pipermail/plt-scheme/2008-July/025704.html Matthew From mflatt at cs.utah.edu Mon Jul 21 08:38:17 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:53 2009 Subject: [plt-scheme] structure, procedure, and keyword arg In-Reply-To: <779bf2730807161408t7785232ap4b56608e1616f28@mail.gmail.com> References: <779bf2730807161408t7785232ap4b56608e1616f28@mail.gmail.com> Message-ID: <20080721123821.738A4650091@mail-svr1.cs.utah.edu> At Wed, 16 Jul 2008 14:08:07 -0700, YC wrote: > it seems that the structs marked as procedures cannot accept keyword > arguments, even if the procedure in prop:procedure does. Is this by design > or there is a different way to mark struct as keyword procedures? > > Thanks, > yc > > > (define-struct *res (filter args) > #:property prop:procedure > (lambda (s x #:error (e #f)) > (let ((res (apply (*res-filter s) (cons x (*res-args s))))) > (if (not e) > res > (error 'restriction)))) > ) > > (define color (make-*res (lambda (x enum) (member x enum)) '((red white > blue)))) > > (color 'black #:error #t) > ;; => error > procedure application: expected a procedure that accepts keyword arguments, > given #(struct:*res # .ss:10:25> (red white blue)); arguments were: black #:error This is a bug, and I've been slow to work out the repair. I think I see a solution, now. The problem: When the `prop:procedure' value is an index of a field within the structure type, then when the field's value is a keyword-accepting procedure, the structure acts as a keyword-accepting procedure. So far, so good. But when the `prop:procedure' value is a "method" --- i.e., a procedure that accepts a struct instance as its first argument --- then it doesn't work, as your example illustrates. The root of the problem is that `prop:procedure' is built into the core, but keyword support isn't; the core isn't willing to expose a "method" to other layers (including the keyword layer), because other layers might abuse the method by applying it to something other than an instance of the structure type. The solution, I think: We can create a new `prop:procedure' structure type property at the keyword level, and we can change `scheme/base' to export the new one as `prop:procedure'. Then, the keyword layer will be able see the "method" and use it as a keyword-accepting procedure, since it's in charge of `prop:procedure'. (By using `prop:procedure' from the keyword layer, you implicitly indicate that you trust the keyword layer to call the method in the right way). To make this work, though, the keyword-layer `prop:procedure' has to automatically imply the core `prop:procedure', so that a structure type can also act as a regular procedure. So, I need to extend the structure property system with a way for one property to imply another set of properties before I can fix the bug. There have been other cases where we wanted a property to automatically imply other properties, so I think it will be a generally useful extension. Matthew From ghcooper at gmail.com Sat Jul 19 13:22:03 2008 From: ghcooper at gmail.com (Gregory Cooper) Date: Thu Mar 26 02:23:54 2009 Subject: [plt-scheme] Re: ? Spreadsheet or table widget? In-Reply-To: <595b9ab20807190631h6d3d5f7arc6201bc22c48cef@mail.gmail.com> References: <595b9ab20807180730y27bedafay6c8ce5ba1e50e0a4@mail.gmail.com> <595b9ab20807190631h6d3d5f7arc6201bc22c48cef@mail.gmail.com> Message-ID: <65e1d50c0807191022j5c9e696ch5308bd49a9864cd2@mail.gmail.com> The FrTime spreadsheet was sort of a hack, and it only really worked well around v208/209. Something happened in the transition to v300 that caused it to freeze for 10 or 20 seconds at a time when scrolling or resizing the window. Rewriting it from scratch has been on my list of things to do for some time, but I've had too many distractions lately and haven't gotten very far. Having someone to discuss it with would probably help to focus and motivate me, though, or if you prefer to work on your own implementation, I'd be happy to share my experience. Greg On Sat, Jul 19, 2008 at 6:31 AM, Stephen De Gabrielle wrote: > Thanks for the tip- I've found it in the 300 branch under > frtime/demo/spreadsheet/ > > > On 7/19/08, Ivanyi Peter wrote: >> Stephen De Gabrielle ?rta: >> >>> Is anyone aware of a Spreadsheet or table widget for >> mred? i'm >> >> In version 372 there used to be an implementation of a >> spreadsheet, >> however on my computer that was dead slow. I do not know whether >> it was a problem with my computer or with the implementation. >> I have not checked, but maybe this implementation is >> available in >> v 402 as well. >> >> Best regards, >> >> Peter Ivanyi >> >> >> Biztos, hogy egyed?l akarsz bulizni ny?ron? Ha nem, tudunk egy tuti >> megold?st! >> >> >> > > -- > Sent from Google Mail for mobile | mobile.google.com > > Cheers, > > Stephen > > -- > Stephen De Gabrielle > s.degabrielle@cs.ucl.ac.uk > Telephone +44 (0)20 7679 0693 (x30693) > Mobile 079 851 890 45 > Project: Making Sense of Information (MaSI) > Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html > Home:http://www.degabrielle.name/stephen > > > UCL Interaction Centre > MPEB 8th floor > University College London > Gower Street > London WC1E 6BT > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From mflatt at cs.utah.edu Mon Jul 21 14:21:35 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:54 2009 Subject: [plt-scheme] structure, procedure, and keyword arg In-Reply-To: <20080721123821.738A4650091@mail-svr1.cs.utah.edu> References: <779bf2730807161408t7785232ap4b56608e1616f28@mail.gmail.com> <20080721123821.738A4650091@mail-svr1.cs.utah.edu> Message-ID: <20080721182135.A472665007D@mail-svr1.cs.utah.edu> At Mon, 21 Jul 2008 06:38:17 -0600, Matthew Flatt wrote: > At Wed, 16 Jul 2008 14:08:07 -0700, YC wrote: > > it seems that the structs marked as procedures cannot accept keyword > > arguments, even if the procedure in prop:procedure does. Fixed in SVN (v4.0.2.5). > So, I need to extend the structure property system with a way for one > property to imply another set of properties If you think of structures as primitive classes (in the Java sense), then properties are like primitive interfaces. This change adds property extension that's analogous to interface extension. Matthew From morazanm at gmail.com Mon Jul 21 14:52:40 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:23:54 2009 Subject: [plt-scheme] writing to files Message-ID: <9b1fff280807211152q1d880397x64739411ef6d45b8@mail.gmail.com> Dear All, Would someone be kind enough to point me in the right direction? Consider the following code: (define (w2file c filename) (let ((file (open-output-file (string-append "C:/Users/SHU-USER/Documents/Test/" (symbol->string filename) ".txt") #:mode 'text #:exists 'replace))) (begin (write2file c file) (close-output-port file) ))) (define (write2file c file) (begin (display c file) (display '#\newline file))) Produces the following behavior: Welcome to DrScheme, version 4.0.2 [3m]. Language: Essentials of Programming Languages (2nd ed.); memory limit: 128 megabytes. > (w2file 'test 'test) . . display: output port is closed > How is it that the output port is closed? If I comment out (close-output-port file), no error is generated but the file created is empty. Same results when using write instead of display. Thanks, Marco From grettke at acm.org Mon Jul 21 15:03:39 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:23:54 2009 Subject: [plt-scheme] mzscheme --script and console output In-Reply-To: <20080721121647.A203165008D@mail-svr1.cs.utah.edu> References: <756daca50807202130g5265e354w8f59dfbf3548c0dc@mail.gmail.com> <20080721121647.A203165008D@mail-svr1.cs.utah.edu> Message-ID: <756daca50807211203p7da729abk488b4846485df9f7@mail.gmail.com> Thanks for responding! I read: doc/reference/running-sa.html and found that I am the bug. When I cut over to 4.x I moved everything into packages, including my scripts (I did so without thinking, hence the bug). Question: being that all of the code is now in modules, the right way to run the program is this? mzscheme --require [some file with the module] When you run mzscheme like this, to what command line arguments is it equivelant? mzscheme [some file with the module] Because both of the previous command line options appear to do the same thing. From mflatt at cs.utah.edu Mon Jul 21 15:29:44 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:54 2009 Subject: [plt-scheme] mzscheme --script and console output In-Reply-To: <756daca50807211203p7da729abk488b4846485df9f7@mail.gmail.com> References: <756daca50807202130g5265e354w8f59dfbf3548c0dc@mail.gmail.com> <20080721121647.A203165008D@mail-svr1.cs.utah.edu> <756daca50807211203p7da729abk488b4846485df9f7@mail.gmail.com> Message-ID: <20080721192944.909D665009D@mail-svr1.cs.utah.edu> At Mon, 21 Jul 2008 14:03:39 -0500, "Grant Rettke" wrote: > Question: being that all of the code is now in modules, the right way > to run the program is this? > > mzscheme --require [some file with the module] > > When you run mzscheme like this, to what command line arguments is it > equivelant? > > mzscheme [some file with the module] > > Because both of the previous command line options appear to do the same thing. Normally, you want just mzscheme which expands to mzscheme --require-script The command mzscheme --require turns out to be the same, but only because there are no extra command-line arguments. If you write mzscheme --require -x when `-x' is treated as a flag to `mzscheme', but with mzscheme --require-script -x then `-x' is sent on as a flag to the program. More generally, `--require' is meant to be used in combination with other command-line flags to `mzscheme', such as `--repl' or multiple `--require's. Use `--require' when you want to "script" the start-up process with multiple steps, instead of just running a program. Matthew From mflatt at cs.utah.edu Mon Jul 21 15:48:21 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:54 2009 Subject: [plt-scheme] writing to files In-Reply-To: <9b1fff280807211152q1d880397x64739411ef6d45b8@mail.gmail.com> References: <9b1fff280807211152q1d880397x64739411ef6d45b8@mail.gmail.com> Message-ID: <20080721194822.37E48650091@mail-svr1.cs.utah.edu> At Mon, 21 Jul 2008 14:52:40 -0400, "Marco Morazan" wrote: > Would someone be kind enough to point me in the right direction? > > [...] > > (define (w2file c filename) > (let ((file (open-output-file > (string-append > "C:/Users/SHU-USER/Documents/Test/" > (symbol->string filename) > ".txt") > #:mode 'text > #:exists 'replace))) > (begin > (write2file c file) > (close-output-port file) > ))) You've hit the awful R5RS/EoPL bug in 4.0.2 where `begin' in a internal-definition position gets evaluated twice. Removing the `begin's makes the program work correctly. This bug is fixed in SVN for the 4.0.3 or 4.1 release (whichever the next one turns out to be). Matthew From morazanm at gmail.com Mon Jul 21 15:53:58 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:23:55 2009 Subject: [plt-scheme] writing to files In-Reply-To: <20080721194822.37E48650091@mail-svr1.cs.utah.edu> References: <9b1fff280807211152q1d880397x64739411ef6d45b8@mail.gmail.com> <20080721194822.37E48650091@mail-svr1.cs.utah.edu> Message-ID: <9b1fff280807211253k6af138edn356382f1b24dea62@mail.gmail.com> Thanks guys for confirming I was not crazy. --Marco On Mon, Jul 21, 2008 at 3:48 PM, Matthew Flatt wrote: > At Mon, 21 Jul 2008 14:52:40 -0400, "Marco Morazan" wrote: >> Would someone be kind enough to point me in the right direction? >> >> [...] >> >> (define (w2file c filename) >> (let ((file (open-output-file >> (string-append >> "C:/Users/SHU-USER/Documents/Test/" >> (symbol->string filename) >> ".txt") >> #:mode 'text >> #:exists 'replace))) >> (begin >> (write2file c file) >> (close-output-port file) >> ))) > > > You've hit the awful R5RS/EoPL bug in 4.0.2 where `begin' in a > internal-definition position gets evaluated twice. Removing the > `begin's makes the program work correctly. > > This bug is fixed in SVN for the 4.0.3 or 4.1 release (whichever the > next one turns out to be). > > Matthew > > From mylespcourtney at yahoo.co.uk Mon Jul 21 13:21:52 2008 From: mylespcourtney at yahoo.co.uk (myles courtney) Date: Thu Mar 26 02:23:55 2009 Subject: [plt-scheme] unbound variable in module in: set-cdr! Message-ID: <125843.60088.qm@web27606.mail.ukl.yahoo.com> Hi all, ?Have been trying to install simply-scheme.ss, which is available as a pack on PlaneT. Am getting the message (unbound variable in module in: set-cdr!) despite using the pretty big package. What am I doing wrong? best myles mylespcourtney@yahoo.co.uk __________________________________________________________ Not happy with your email address?. Get the one you really want - millions of new email addresses available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080721/c4a8a36f/attachment.htm From simon at joyful.com Tue Jul 22 20:04:36 2008 From: simon at joyful.com (Simon Michael) Date: Thu Mar 26 02:23:56 2009 Subject: [plt-scheme] stumped with parser-tools Message-ID: Good day all. I'm trying to learn parser-tools, as a stronger-than-regexps tool for general parsing needs. http://paste.lisp.org/display/64069 shows a very simple grammar which is supposed to successfully parse "test", but fails with the error shown. I started from examples/calc.ss and have stared at all the examples, but can't see the reason for this error. Any insight welcome! From dyoo at cs.wpi.edu Tue Jul 22 20:34:36 2008 From: dyoo at cs.wpi.edu (Danny Yoo) Date: Thu Mar 26 02:23:56 2009 Subject: [plt-scheme] unbound variable in module in: set-cdr! In-Reply-To: <125843.60088.qm@web27606.mail.ukl.yahoo.com> References: <125843.60088.qm@web27606.mail.ukl.yahoo.com> Message-ID: > Have been trying to install simply-scheme.ss, which is available as a pack > on PlaneT. > Am getting the message (unbound variable in module in: set-cdr!) despite > using the pretty big package. > What am I doing wrong? Hi myles, Oh! You've done nothing wrong; this was my problem. I had not ported the package to DrScheme 4.0 at the time that you downloaded the package, but I've done so now. Try installing version 1.2 and let me know if it works ok for you. By the way, you might be interested in How to Design Programs, which integrates tightly with DrScheme: http://htdp.org/ Best of wishes! From filcab at gmail.com Wed Jul 23 02:35:39 2008 From: filcab at gmail.com (Filipe Cabecinhas) Date: Thu Mar 26 02:23:56 2009 Subject: [plt-scheme] Understanding continuations In-Reply-To: <488265CE.8010907@appsolutions.com> References: <756daca50807182244q619af968h60a02e3dbb5f2c7b@mail.gmail.com> <488265CE.8010907@appsolutions.com> Message-ID: On 19 Jul, 2008, at 23:08, Anton van Straaten wrote: > Grant Rettke wrote: >> I'm trying to visualize and understand continuations (this part of >> the >> work in another thread [Confusing continuation behavior (a question >> about)]). >> If I write: >> #lang scheme >> (define cont #f) >> (define (foo) >> (call/cc >> (lambda (arg-cont) >> (set! cont arg-cont))) >> 13) >> (+ 1 2 3 (foo)) >> Could I visualize the continuation as? >> (lambda (argument) >> (+ 1 2 3 13)) > > You could, but you should be aware that this is an optimized version > of the continuation. The questions you've asked below might be > answered more easily and precisely if you had a more detailed > representation of the continuation, which at the very least should > include a reference to 'argument' (other than its binding). Where > does that reference belong? So, I suppose the continuation should be something like: (lambda (argument) ;; Continuation that just returns to the toplevel ((lambda (other-argument) ;; Call to plus with the result of foo (+ 1 2 3 other-argument)) ((lambda (inner-argument) ;; the rest of the foo function inner-argument 13)))) effectively turning the program inside out. Or am I misunderstanding what you want to say? - Filipe Cabecinhas From filcab at gmail.com Wed Jul 23 02:37:44 2008 From: filcab at gmail.com (Filipe Cabecinhas) Date: Thu Mar 26 02:23:56 2009 Subject: [plt-scheme] Understanding continuations In-Reply-To: References: <756daca50807182244q619af968h60a02e3dbb5f2c7b@mail.gmail.com> <488265CE.8010907@appsolutions.com> Message-ID: <073EEF05-847A-4416-A771-43F2E6ECC35F@gmail.com> On 23 Jul, 2008, at 07:35, Filipe Cabecinhas wrote: > (lambda (argument) ;; Continuation that just returns to the toplevel > ((lambda (other-argument) ;; Call to plus with the result of foo > (+ 1 2 3 other-argument)) > ((lambda (inner-argument) ;; the rest of the foo function > inner-argument > 13)))) Of course I should pass the argument to the rest of the foo function: (lambda (argument) ;; Continuation that just returns to the toplevel ((lambda (other-argument) ;; Call to plus with the result of foo (+ 1 2 3 other-argument)) ((lambda (inner-argument) ;; the rest of the foo function inner-argument 13) argument))) - Filipe Cabecinhas From anton at appsolutions.com Wed Jul 23 06:50:08 2008 From: anton at appsolutions.com (Anton van Straaten) Date: Thu Mar 26 02:23:56 2009 Subject: [plt-scheme] Understanding continuations In-Reply-To: References: <756daca50807182244q619af968h60a02e3dbb5f2c7b@mail.gmail.com> <488265CE.8010907@appsolutions.com> Message-ID: <48870CE0.8040802@appsolutions.com> Filipe Cabecinhas wrote: > > On 19 Jul, 2008, at 23:08, Anton van Straaten wrote: > >> Grant Rettke wrote: >>> I'm trying to visualize and understand continuations (this part of the >>> work in another thread [Confusing continuation behavior (a question >>> about)]). >>> If I write: >>> #lang scheme >>> (define cont #f) >>> (define (foo) >>> (call/cc >>> (lambda (arg-cont) >>> (set! cont arg-cont))) >>> 13) >>> (+ 1 2 3 (foo)) >>> Could I visualize the continuation as? >>> (lambda (argument) >>> (+ 1 2 3 13)) >> >> You could, but you should be aware that this is an optimized version >> of the continuation. The questions you've asked below might be >> answered more easily and precisely if you had a more detailed >> representation of the continuation, which at the very least should >> include a reference to 'argument' (other than its binding). Where >> does that reference belong? > > So, I suppose the continuation should be something like: > (lambda (argument) ;; Continuation that just returns to the toplevel > ((lambda (other-argument) ;; Call to plus with the result of foo > (+ 1 2 3 other-argument)) > ((lambda (inner-argument) ;; the rest of the foo function > inner-argument > 13)))) > > effectively turning the program inside out. Or am I misunderstanding > what you want to say? That's about what I had in mind, yes. The main thing I wanted to get at was the reference to inner-argument on your second-last line of code, because that helps clarify the issue of how this version of the function ignores its argument and returns 13, whereas the other version (which had the 13 inside the call/cc expression) just returns its argument. Expressed in the above form, there's no mystery about this. As for the rest, yes, I think that modeling the whole thing in CPS is essential if you really want to understand what's going on when learning about this stuff. Anton From mflatt at cs.utah.edu Wed Jul 23 08:52:20 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:56 2009 Subject: [plt-scheme] stumped with parser-tools In-Reply-To: References: Message-ID: <20080723125221.971A26500C8@mail-svr1.cs.utah.edu> At Tue, 22 Jul 2008 17:04:36 -0700, Simon Michael wrote: > Good day all. I'm trying to learn parser-tools, as a > stronger-than-regexps tool for general parsing needs. > > http://paste.lisp.org/display/64069 shows a very simple grammar which is > supposed to successfully parse "test", but fails with the error shown. I > started from examples/calc.ss and have stared at all the examples, but > can't see the reason for this error. Any insight welcome! The parser is working, and that's why it succeeds on the first iteration. The parser finds a PARAGRAPH and succeeds. On the second iteration, you get an error because the input stream cannot be parsed as a PARAGRAPH. Note that the "calc.ss" example includes the empty sequence as a production for `start', in which case it returns #f. You could get the same effect by extending `document': (document [(PARAGRAPH) $1] [() #f]) Matthew From simon at joyful.com Wed Jul 23 10:14:26 2008 From: simon at joyful.com (Simon Michael) Date: Thu Mar 26 02:23:57 2009 Subject: [plt-scheme] Re: stumped with parser-tools In-Reply-To: <20080723125221.971A26500C8@mail-svr1.cs.utah.edu> References: <20080723125221.971A26500C8@mail-svr1.cs.utah.edu> Message-ID: Augh! I had tried [() null], following the examples, which repeats forever. [() #f] works. I didn't intuit the need for either since EOF comes right after PARAGRAPH. Thank you Matthew. From doolagarl2002 at yahoo.com.au Wed Jul 23 11:42:35 2008 From: doolagarl2002 at yahoo.com.au (Scott Brown) Date: Thu Mar 26 02:23:57 2009 Subject: [plt-scheme] =?iso-8859-1?q?Re=3A_compile=3A_bad_syntax=3B=A0=A0?= =?iso-8859-1?q?=A0_function_application_is_not_allowed?= Message-ID: <526973.32202.qm@web56405.mail.re3.yahoo.com> Okay, I fixed it with (module sicp2 scheme ) and 'provide' for the exported functions. Thank you. Start at the new Yahoo!7 for a better online experience. www.yahoo7.com.au From erlendlor at gmail.com Wed Jul 23 12:53:39 2008 From: erlendlor at gmail.com (Erlend Lorentzen) Date: Thu Mar 26 02:23:57 2009 Subject: [plt-scheme] Embedding MzScheme for the uninitiated... Message-ID: <86ab98e40807230953w7fc9a3e0m9297f94b8942148a@mail.gmail.com> Does anyone know of any tutorials, examples or open source implementations regarding embedding MzScheme in C/C++? I've looked at the official PLT docs and the examples in "collects", but I still feel a bit lost (I'm new to scheme. I have some C++ experience, but I've mainly used Java). Any suggested reading or general advice is very welcome. Erlend -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080723/a3b05c39/attachment.html From yinso.chen at gmail.com Wed Jul 23 14:20:36 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:23:58 2009 Subject: [plt-scheme] copy-port and custom-port Message-ID: <779bf2730807231120j3798265bwf0f807575aa92ee9@mail.gmail.com> Hi - I've created custom input port to wrap another input port - and when passing the port to `copy-port`, besides copying the data inside the wrapped input port, `copy-port` also appears to copy a bunch of random binary data after the eof position. When reading from the port via functions like `read` - it returns eof properly, but copy-port blows right pass the position and keeps on copying some random data. Obviously this is a bug in my simplistic implementation, but I'm not sure how to find/tackle the problem. Has anyone seen such an issue before? Any pointer is appreciated. My implementation below... yc ;; afile.ss ;; (load "afile.ss") ;; provide read closure over the wrapped port (define (read-in port) (lambda (bytes) (let* ((len (bytes-length bytes)) (bytes-in (read-bytes len port))) (cond ((eof-object? bytes-in) eof) (else (bytes-copy! bytes 0 bytes-in) len))))) ;; provide peek closure over the wrapped port (define (peek-in port) (lambda (bytes skip progress-evt) (let* ((len (bytes-length bytes)) (peeked (peek-bytes len skip port))) (cond ((eof-object? peeked) eof) (else (bytes-copy! bytes 0 peeked) len))))) ;; provide the close closure over the wrapped port (define (close-in port) (lambda () (close-input-port port))) ;; the function that returns an input port to wrap another input port (define (open-input-afile path) (let ((port (open-input-file path))) (make-input-port path (read-in port) (peek-in port) (close-in port)))) ;; test (require scheme/port) (define path "test-out.txt") (define out (open-output-file path #:exists 'replace)) (display "test data\ntest data\ntest data\ntest data\n" out) (close-output-port out) (define in (open-input-afile path)) (define out (open-output-bytes)) (copy-port in out) (close-input-port in) (get-output-bytes out) ;; a bunch of random data will be appended... -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080723/851a32c8/attachment.htm From mflatt at cs.utah.edu Wed Jul 23 14:32:35 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:58 2009 Subject: [plt-scheme] copy-port and custom-port In-Reply-To: <779bf2730807231120j3798265bwf0f807575aa92ee9@mail.gmail.com> References: <779bf2730807231120j3798265bwf0f807575aa92ee9@mail.gmail.com> Message-ID: <20080723183236.301B56500C8@mail-svr1.cs.utah.edu> At Wed, 23 Jul 2008 11:20:36 -0700, YC wrote: > ;; afile.ss ;; (load "afile.ss") > ;; provide read closure over the wrapped port > (define (read-in port) > (lambda (bytes) > (let* ((len (bytes-length bytes)) > (bytes-in (read-bytes len > port))) > (cond ((eof-object? bytes-in) eof) > (else > (bytes-copy! bytes 0 > bytes-in) > len))))) You should return `(bytes-length bytes-in)' here, not `len'. > ;; provide peek closure over the wrapped port > (define (peek-in port) > (lambda (bytes skip progress-evt) > (let* ((len (bytes-length bytes)) > (peeked (peek-bytes len > skip port))) > (cond ((eof-object? peeked) eof) > (else (bytes-copy! bytes 0 > peeked) > len))))) Similarly, return `(bytes-length peeked)'. Matthew From yinso.chen at gmail.com Wed Jul 23 15:01:20 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:23:59 2009 Subject: [plt-scheme] copy-port and custom-port In-Reply-To: <20080723183236.301B56500C8@mail-svr1.cs.utah.edu> References: <779bf2730807231120j3798265bwf0f807575aa92ee9@mail.gmail.com> <20080723183236.301B56500C8@mail-svr1.cs.utah.edu> Message-ID: <779bf2730807231201q7a86fa2ek4738b2711d118893@mail.gmail.com> On Wed, Jul 23, 2008 at 11:32 AM, Matthew Flatt wrote: > At Wed, 23 Jul 2008 11:20:36 -0700, YC wrote: > > ... > > len))))) > > You should return `(bytes-length bytes-in)' here, not `len'. > > That solves it! Thanks!! I thought I allocated `bytes-in` & `peeked` based on the `len`, so `len` can be returned - apparently that's not the case? What did I miss? Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080723/caaa416a/attachment.html From mflatt at cs.utah.edu Wed Jul 23 15:05:34 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:23:59 2009 Subject: [plt-scheme] copy-port and custom-port In-Reply-To: <779bf2730807231201q7a86fa2ek4738b2711d118893@mail.gmail.com> References: <779bf2730807231120j3798265bwf0f807575aa92ee9@mail.gmail.com> <20080723183236.301B56500C8@mail-svr1.cs.utah.edu> <779bf2730807231201q7a86fa2ek4738b2711d118893@mail.gmail.com> Message-ID: <20080723190534.7C0846500A9@mail-svr1.cs.utah.edu> At Wed, 23 Jul 2008 12:01:20 -0700, YC wrote: > On Wed, Jul 23, 2008 at 11:32 AM, Matthew Flatt wrote: > > > At Wed, 23 Jul 2008 11:20:36 -0700, YC wrote: > > > ... > > > len))))) > > > > You should return `(bytes-length bytes-in)' here, not `len'. > > > > > That solves it! Thanks!! > > I thought I allocated `bytes-in` & `peeked` based on the `len`, so `len` can > be returned - apparently that's not the case? What did I miss? You computed `len' based on the given byte string, but that byte string's length might be larger than the number of bytes available in the port. The result should be the number of bytes actually read or peeked. Matthew From yinso.chen at gmail.com Wed Jul 23 15:19:26 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:24:00 2009 Subject: [plt-scheme] copy-port and custom-port In-Reply-To: <20080723190534.7C0846500A9@mail-svr1.cs.utah.edu> References: <779bf2730807231120j3798265bwf0f807575aa92ee9@mail.gmail.com> <20080723183236.301B56500C8@mail-svr1.cs.utah.edu> <779bf2730807231201q7a86fa2ek4738b2711d118893@mail.gmail.com> <20080723190534.7C0846500A9@mail-svr1.cs.utah.edu> Message-ID: <779bf2730807231219k54cfe972ya4d09407a507f5dc@mail.gmail.com> On Wed, Jul 23, 2008 at 12:05 PM, Matthew Flatt wrote: > > I thought I allocated `bytes-in` & `peeked` based on the `len`, so `len` > can > > be returned - apparently that's not the case? What did I miss? > > You computed `len' based on the given byte string, but that byte > string's length might be larger than the number of bytes available in > the port. The result should be the number of bytes actually read or > peeked. > > I see - I actually thought `len` always equals 1. When I wrote the code I traced `read-in` and observed the size of given bytes; I must have been reading the port with `read-byte` at the time - that was my misunderstanding. Now that you explained it it's clear where the random bytes came from - `copy-port` uses a much larger buffer... Thanks again! ;) yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080723/ede66621/attachment.htm From gregory.woodhouse at sbcglobal.net Wed Jul 23 22:20:10 2008 From: gregory.woodhouse at sbcglobal.net (Gregory Woodhouse) Date: Thu Mar 26 02:24:01 2009 Subject: [plt-scheme] Why does this TCP client block? Message-ID: <6A3C6BA4-8839-47EF-A536-4584EAF11BF7@sbcglobal.net> I'm not having a problem with the "More" tutorial per se, but in trying to adapt it, I've run into a problem. I'm sure this is user error on my part, but I've modified the early examples to read s- expressions and write them back. Unfortunately, my test driver blocks when trying to read a response back from the server. Testing with telnet works fine. Here is the test driver ;;A simple test driver (define (test-it port-no) (begin (printf "Starting server on port ~a~n" port-no) (let ([stop (serve port-no test-handler)]) (printf "Connecting to server on port ~a~n" port-no) (let-values ([(in out) (tcp-connect "localhost" port-no)]) (define msg '(a b c)) (printf "Sending message ~a~n" msg) (write msg out) (printf "Reading response...~n") (let ([resp (read in)]) (printf "Response is ~a~n" msg)) (printf "Stopping server.")) (stop)))) "Oh would that my mind could let fall its dead ideas, as the tree does its withered leaves." --Andr? Gide http://www.gwoodhouse.com http://GregWoodhouse.ImageKind.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080723/6b98b9e9/attachment.html From czhu at cs.utah.edu Wed Jul 23 22:24:09 2008 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:24:01 2009 Subject: [plt-scheme] Why does this TCP client block? In-Reply-To: <6A3C6BA4-8839-47EF-A536-4584EAF11BF7@sbcglobal.net> References: <6A3C6BA4-8839-47EF-A536-4584EAF11BF7@sbcglobal.net> Message-ID: <4887E7C9.4040604@cs.utah.edu> `flush-output' ? Chongkai Gregory Woodhouse wrote: > I'm not having a problem with the "More" tutorial per se, but > in trying to adapt it, I've run into a problem. I'm sure this is user > error on my part, but I've modified the early examples to read > s-expressions and write them back. Unfortunately, my test driver > blocks when trying to read a response back from the server. Testing > with telnet works fine. > > Here is the test driver > > ;;A simple test driver > (define (test-it port-no) > (begin > (printf "Starting server on port ~a~n" port-no) > (let ([stop (serve port-no test-handler)]) > (printf "Connecting to server on port ~a~n" port-no) > (let-values ([(in out) (tcp-connect "localhost" port-no)]) > (define msg '(a b c)) > (printf "Sending message ~a~n" msg) > (write msg out) > (printf "Reading response...~n") > (let ([resp (read in)]) > (printf "Response is ~a~n" msg)) > (printf "Stopping server.")) > (stop)))) > > > > "Oh would that my mind could let fall its dead ideas, as the tree does > its withered leaves." > --Andr? Gide > > http://www.gwoodhouse.com > http://GregWoodhouse.ImageKind.com > > > > > ------------------------------------------------------------------------ > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From gregory.woodhouse at sbcglobal.net Wed Jul 23 22:32:31 2008 From: gregory.woodhouse at sbcglobal.net (Gregory Woodhouse) Date: Thu Mar 26 02:24:01 2009 Subject: [plt-scheme] Why does this TCP client block? In-Reply-To: <4887E7C9.4040604@cs.utah.edu> References: <6A3C6BA4-8839-47EF-A536-4584EAF11BF7@sbcglobal.net> <4887E7C9.4040604@cs.utah.edu> Message-ID: <2CE6D81A-F9D9-488B-8100-03BB24741EA8@sbcglobal.net> On Jul 23, 2008, at 7:24 PM, Chongkai Zhu wrote: > `flush-output' ? > > Chongkai Stupid me. I was so focused on the server code that I didn't think about the client code. Honestly, I thought I had included it there, too. To the rest of the list: Never mind. It was user error - big time. "Those who are enamored of practice without theory are like a pilot who goes into a ship without rudder or compass." --Leonardo da Vinci (1452-1519) http://www.gwoodhouse.com http://GregWoodhouse.ImageKind.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080723/ac6f00e0/attachment.htm From erlendlor at gmail.com Thu Jul 24 11:50:22 2008 From: erlendlor at gmail.com (Erlend Lorentzen) Date: Thu Mar 26 02:24:02 2009 Subject: [plt-scheme] Adding primitive c procedure Message-ID: <86ab98e40807240850j7e09ca98nefdc21d0605ed4ef@mail.gmail.com> Hi I'm trying to add a primitive c procedure to MzScheme. I can't show all the code, but I'm basically doing something like this: ---------------------------------------------------------------------- //..... #include #include "base.c" //..... static Scheme_Object * run_c_proc(int argc, Scheme_Object ** argv) { //..... return scheme_void; } static int inner_main(Scheme_Env * env, int argc, char ** argv) { //..... Scheme_Object * proc = scheme_make_prim_w_arity(run_c_proc, "run-c-proc", 0, 0); scheme_add_global("run-c-proc", proc, env); //..... return 0; } int main(int argc, char ** argv) { return scheme_main_setup(1, inner_main, argc, argv); return 0; } --------------------------------------------------------------------- It compiles, but when I try to run it I get the following: Thread 0 Crashed: 0 ??? 0x032294d8 0 + 52597976 1 PLT_MzScheme 0x01c84b1e scheme_bucket_or_null_from_table + 78 2 PLT_MzScheme 0x01c84b50 scheme_bucket_from_table + 32 3 PLT_MzScheme 0x01c2eb47 scheme_do_add_global_symbol + 103 4 PLT_MzScheme 0x01c2ecb2 scheme_add_global + 98 --------------------------------------------------------------------- Any suggestions? Thanks ---------------------- MzScheme: v4 OS X 10.5.4 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080724/24b153d9/attachment.html From noelwelsh at gmail.com Thu Jul 24 12:15:21 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:24:02 2009 Subject: [plt-scheme] Adding primitive c procedure In-Reply-To: <86ab98e40807240850j7e09ca98nefdc21d0605ed4ef@mail.gmail.com> References: <86ab98e40807240850j7e09ca98nefdc21d0605ed4ef@mail.gmail.com> Message-ID: To add a new C function to MzScheme the FFI is much simpler to use: http://docs.plt-scheme.org/foreign/index.html HTH, Noel On Thu, Jul 24, 2008 at 4:50 PM, Erlend Lorentzen wrote: > Hi > I'm trying to add a primitive c procedure to MzScheme. I can't show all the > code, but I'm basically doing something like this: ... From simon at joyful.com Thu Jul 24 18:11:02 2008 From: simon at joyful.com (Simon Michael) Date: Thu Mar 26 02:24:02 2009 Subject: [plt-scheme] progress with parser-tools In-Reply-To: References: <20080723125221.971A26500C8@mail-svr1.cs.utah.edu> Message-ID: Day 3 with parser-tools, and I understand a bit more. Some issues I've encountered: - discovered I wasn't seeing all plt list messages in thunderbird, so fixed that and now I've read parser discussions back to 2002. Yay! - the test harness I copied was causing me problems, since I didn't realize it was designed to keep calling the parser until #f is returned. - in the lex-abbrevs, lexer and parser I was confused about plain strings vs. string regexps vs. sre regexps vs. the lexer's own operators. I think I have it all straight now. A small suggestion: replace the word "trigger" with the more familiar "pattern" at http://docs.plt-scheme.org/parser-tools/Lexers.html ? Also, being able to use plain old string regexps where it makes sense would make things much easier for newcomers. - I don't yet have a great understanding of what is best done in the lex-abbrevs vs. the lexer vs. the parser grammar. Any rules of thumb here ? Below is my latest attempt at a parser http://daringfireball.net/projects/markdown/syntax . (I know this can be done with a hand-written parser or partially with regexps, but I want a more declarative technique such as parser-tools. I also found the parser combinators collection which looks worth a try, later.) I've hit a new problem: parsing a HTML block, which has matching open and close tags. In regexps it looks like "<([^>]+)>.*?". I haven't found any way to mimic the \2 reference with parser-tools. What to do ? Thanks, -Simon ; markdown parser (require parser-tools/yacc parser-tools/lex (prefix-in : parser-tools/lex-sre) ) (define-tokens md-tokens (LINE HTMLBLOCK)) (define-empty-tokens empty-tokens (BLANKLINE NEWLINE EOF)) (define-lex-abbrevs (newline #\newline) (non-newline (:- any-char newline)) (non-blank-line (:+ non-newline)) ; (html-block ) ; hmm. how to match open/close tag ? ) (define md-lexer (lexer [(eof) 'EOF] ["\n\n" 'BLANKLINE] ["\n" 'NEWLINE] [non-blank-line (token-LINE lexeme)] ; [html-block (token-HTMLBLOCK lexeme)] )) (define md-parser (parser ;(debug "parse.debug") ; (precs ; left, right, nonassoc ; (left BLANKLINE) ; ) (suppress) (error (lambda (ok? name value) (printf "could not parse: ~a\n" name))) (tokens md-tokens empty-tokens) (start document) (end EOF) (grammar (document [(blocks) (reverse $1)] [() null] ) (blocks [(blocks block) (cons $2 $1)] [(block) (list $1)] ) (block [(paragraph) $1] ; [(htmlblock) $1] ) (paragraph [(lines BLANKLINE) (reverse $1)] [(lines) (reverse $1)] ) ;; (htmlblock [(HTMLBLOCK) 'htmlblock] ;; ) (lines [(lines line) (cons $2 $1)] [(line) (list $1)] ) (line [(LINE NEWLINE) $1] [(LINE) $1] ) ) )) ; utils (define (string->lex-list s lexer) (port->lex-list (open-input-string s) lexer)) (define (lex-string s) (string->lex-list s md-lexer)) (define (parse p lexer parser) (parser (lambda () (lexer p)))) (define (parse-string s) (parse (open-input-string s) md-lexer md-parser)) From yinso.chen at gmail.com Fri Jul 25 02:45:14 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:24:03 2009 Subject: [plt-scheme] ffi & errno Message-ID: <779bf2730807242345p30ebea17u997cdb8d94d7d5f5@mail.gmail.com> Hi - I found this thread discussing FFI & errno - http://list.cs.brown.edu/pipermail/plt-scheme/2008-March/023478.html. Is there a potential solution on the horizon? I currently wrap it in a procedure as follows: (define (libc:errno) (get-ffi-obj "errno" libc _int (lambda () (error 'libc:errno "unable to retrieve errno")))) Is this even close? I imagine that it's possible for mzscheme to set errno before I retrieve the value... Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080724/7ac9841b/attachment.htm From yinso.chen at gmail.com Fri Jul 25 03:35:01 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:24:04 2009 Subject: [plt-scheme] ffi & errno In-Reply-To: <18569.32610.68275.569731@arabic.ccs.neu.edu> References: <779bf2730807242345p30ebea17u997cdb8d94d7d5f5@mail.gmail.com> <18569.32610.68275.569731@arabic.ccs.neu.edu> Message-ID: <779bf2730807250035w55b384b4ucd04c6e046ee7550@mail.gmail.com> On Fri, Jul 25, 2008 at 12:23 AM, Eli Barzilay wrote: > On Jul 24, YC wrote: > > > > > Is this even close? I imagine that it's possible for mzscheme to set > errno > > before I retrieve the value... > > That's exactly the problem. > > Given errno is thread local, could separate thread for ffi (such as the async ffi idea described in http://www.cs.brown.edu/pipermail/plt-scheme/2007-July/019446.html) work in such case? Obviously multi-threaded ffi is a huge effort in its own right... Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080725/f118da02/attachment.html From eli at barzilay.org Fri Jul 25 03:23:14 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:24:04 2009 Subject: [plt-scheme] ffi & errno In-Reply-To: <779bf2730807242345p30ebea17u997cdb8d94d7d5f5@mail.gmail.com> References: <779bf2730807242345p30ebea17u997cdb8d94d7d5f5@mail.gmail.com> Message-ID: <18569.32610.68275.569731@arabic.ccs.neu.edu> On Jul 24, YC wrote: > Hi - > > I found this thread discussing FFI & errno - > http://list.cs.brown.edu/pipermail/plt-scheme/2008-March/023478.html. Is > there a potential solution on the horizon? > > I currently wrap it in a procedure as follows: > > (define (libc:errno) > (get-ffi-obj "errno" libc _int > (lambda () > (error 'libc:errno > "unable to retrieve errno")))) > > Is this even close? I imagine that it's possible for mzscheme to set errno > before I retrieve the value... That's exactly the problem. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Fri Jul 25 03:42:03 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:24:04 2009 Subject: [plt-scheme] ffi & errno In-Reply-To: <779bf2730807250035w55b384b4ucd04c6e046ee7550@mail.gmail.com> References: <779bf2730807242345p30ebea17u997cdb8d94d7d5f5@mail.gmail.com> <18569.32610.68275.569731@arabic.ccs.neu.edu> <779bf2730807250035w55b384b4ucd04c6e046ee7550@mail.gmail.com> Message-ID: <18569.33739.339861.266150@arabic.ccs.neu.edu> On Jul 25, YC wrote: > On Fri, Jul 25, 2008 at 12:23 AM, Eli Barzilay wrote: > > > On Jul 24, YC wrote: > > > > > > > > Is this even close? I imagine that it's possible for mzscheme > > > to set errno before I retrieve the value... > > > > That's exactly the problem. > > > Given errno is thread local, could separate thread for ffi (such as > the async ffi idea described in > http://www.cs.brown.edu/pipermail/plt-scheme/2007-July/019446.html) > work in such case? One problem with this is finding a portable way of creating and maintaining threads, and a second problem is accessing Scheme data from the thread which can be unreliable (especially with 3m). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From tom at zwizwa.be Fri Jul 25 03:35:05 2008 From: tom at zwizwa.be (Tom Schouten) Date: Thu Mar 26 02:24:05 2009 Subject: [plt-scheme] Staapl Message-ID: <20080725073505.GA14377@zzz.i> Hello folks, The Staapl project has come to a point where it is ready for public scrutiny. http://zwizwa.be/staapl Staapl is a collection of abstractions for (meta)programming microcontrollers from within PLT Scheme. The core of the system is a programmable code generator structured around a functional concatenative macro language. On top of this it includes a syntax frontend for creating Forth-style languages, a backend code generator for Microchip's PIC18 microcontroller architecture, and interaction tools for shortening the edit-compile-test cycle. Enjoy! Tom From noelwelsh at gmail.com Fri Jul 25 04:09:26 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:24:05 2009 Subject: [plt-scheme] Staapl In-Reply-To: <20080725073505.GA14377@zzz.i> References: <20080725073505.GA14377@zzz.i> Message-ID: Looks neat! I suggest releasing to PLaneT. In two weeks most will have forgotten this email but a release on PLaneT will still be visible. N. On Fri, Jul 25, 2008 at 8:35 AM, Tom Schouten wrote: > Hello folks, > > The Staapl project has come to a point where it is ready for public > scrutiny. > > http://zwizwa.be/staapl > >... From erlendlor at gmail.com Fri Jul 25 04:58:45 2008 From: erlendlor at gmail.com (Erlend Lorentzen) Date: Thu Mar 26 02:24:05 2009 Subject: [plt-scheme] Adding primitive c procedure In-Reply-To: References: <86ab98e40807240850j7e09ca98nefdc21d0605ed4ef@mail.gmail.com> Message-ID: <86ab98e40807250158j184ce79x74d16435d7e12a58@mail.gmail.com> I should have mentioned that I need MzScheme to be a drop-in replacement for embedded Guile in a large (85,000 LOC) C++ application with 100's of scheme scripts. My plan is to use the existing structure of the application (as far as it's possible) and translate the current Guile specific C functions to MzScheme versions of these functions, and making as few changes as possible to the scheme scripts. Is this a sane way to approach this? Could I use FFI in this case or would that require an enormous restructuring? Thanks, Erlend On Thu, Jul 24, 2008 at 6:15 PM, Noel Welsh wrote: > To add a new C function to MzScheme the FFI is much simpler to use: > > http://docs.plt-scheme.org/foreign/index.html > > HTH, > Noel > > On Thu, Jul 24, 2008 at 4:50 PM, Erlend Lorentzen > wrote: > > Hi > > I'm trying to add a primitive c procedure to MzScheme. I can't show all > the > > code, but I'm basically doing something like this: > ... > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20080725/d4c4e2a3/attachment.htm From simon at joyful.com Fri Jul 25 05:45:44 2008 From: simon at joyful.com (Simon Michael) Date: Thu Mar 26 02:24:05 2009 Subject: [plt-scheme] Re: progress with parser-tools In-Reply-To: References: <20080723125221.971A26500C8@mail-svr1.cs.utah.edu> Message-ID: > I've hit a new problem: parsing a HTML block, which has matching open > and close tags. In regexps it looks like "<([^>]+)>.*?". I haven't > found any way to mimic the \2 reference with parser-tools. What to do ? After more reading, I think parser-tools and similar bottom-up parsers can't do this job - it requires a top-down parser, such as http://www.lshift.net/blog/2005/08/22/json-for-mzscheme-and-a-portable-packrat-parsing-combinator-library or http://www.lshift.net/blog/2008/07/01/ometa-for-scheme . From tom at zwizwa.be Fri Jul 25 06:32:17 2008 From: tom at zwizwa.be (Tom Schouten) Date: Thu Mar 26 02:24:06 2009 Subject: [plt-scheme] Staapl In-Reply-To: References: <20080725073505.GA14377@zzz.i> Message-ID: <20080725103217.GD12729@zzz.i> I'm giving it a try. However, part of the Forth code uses a "#lang staapl/pic18" construct which prevents the package to be installed correctly. My tarball installer places the package in the user's collects by default before it compiles the source. Is there a way to do this for Planet packages? On Fri, Jul 25, 2008 at 09:09:26AM +0100, Noel Welsh wrote: > Looks neat! I suggest releasing to PLaneT. In two weeks most will > have forgotten this email but a release on PLaneT will still be > visible. > > N. > > On Fri, Jul 25, 2008 at 8:35 AM, Tom Schouten wrote: > > Hello folks, > > > > The Staapl project has come to a point where it is ready for public > > scrutiny. > > > > http://zwizwa.be/staapl > > > >... > From eli at barzilay.org Fri Jul 25 06:40:08 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:24:06 2009 Subject: [plt-scheme] Staapl In-Reply-To: <20080725103217.GD12729@zzz.i> References: <20080725073505.GA14377@zzz.i> <20080725103217.GD12729@zzz.i> Message-ID: <18569.44424.352246.373009@arabic.ccs.neu.edu> On Jul 25, Tom Schouten wrote: > I'm giving it a try. However, part of the Forth code uses a "#lang > staapl/pic18" construct which prevents the package to be installed > correctly. My tarball installer places the package in the user's > collects by default before it compiles the source. Is there a way > to do this for Planet packages? Yes, `#lang planet ...' should work, but there was a bug in the way that it was handling the reader (it expected the language's reader to read only one expression), which is fixed in svn and will be included in the 4.1 release. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jensaxel at soegaard.net Fri Jul 25 07:44:14 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:24:06 2009 Subject: [plt-scheme] Adding primitive c procedure In-Reply-To: <86ab98e40807250158j184ce79x74d16435d7e12a58@mail.gmail.com> References: <86ab98e40807240850j7e09ca98nefdc21d0605ed4ef@mail.gmail.com> <86ab98e40807250158j184ce79x74d16435d7e12a58@mail.gmail.com> Message-ID: <4889BC8E.7090005@soegaard.net> Noel Welsh > wrote: > To add a new C function to MzScheme the FFI is much simpler to use: > > http://docs.plt-scheme.org/foreign/index.html > Erlend Lorentzen wrote: > I should have mentioned that I need MzScheme to be a drop-in > replacement for embedded Guile in a large (85,000 LOC) C++ application > with 100's of scheme scripts. My plan is to use the existing structure > of the application (as far as it's possible) and translate the current > Guile specific C functions to MzScheme versions of these functions, > and making as few changes as possible to the scheme scripts. Is this a > sane way to approach this? Could I use FFI in this case or would that > require an enormous restructuring? Without knowing the exact details I'd recommend at least giving the FFI a try. If you can make it to work, you'll save huge amounts of time both in the short and long run. "Simply" write your functions in C, compile them to a shared library, and then load them in Scheme with the FFI. The FFI takes care of the tedious stuff (converting between Scheme and C values, constructing C structures etc). One advantage of the FFI is that you won't run into problems when mzscheme is updated. To avoid potential confusion I'll just mention that the new FFI is the one scheme/foreign. -- Jens Axel S?gaard From tom at zwizwa.be Fri Jul 25 12:27:43 2008 From: tom at zwizwa.be (Tom Schouten) Date: Thu Mar 26 02:24:06 2009 Subject: [plt-scheme] Staapl In-Reply-To: <18569.44424.352246.373009@arabic.ccs.neu.edu> References: <20080725073505.GA14377@zzz.i> <20080725103217.GD12729@zzz.i> <18569.44424.352246.373009@arabic.ccs.neu.edu> Message-ID: <20080725162742.GE12729@zzz.i> > > I'm giving it a try. However, part of the Forth code uses a "#lang > > staapl/pic18" construct which prevents the package to be installed > > correctly. My tarball installer places the package in the user's > > collects by default before it compiles the source. Is there a way > > to do this for Planet packages? > > Yes, `#lang planet ...' should work, but there was a bug in the way > that it was handling the reader (it expected the language's reader to > read only one expression), which is fixed in svn and will be included > in the 4.1 release. Thanks. There's another problem I ran into: the code refers to its own tree at runtime to load some modules into isolated namespaces for the interactive part. Is there a way to make this kind of closure work without knowing in advance where the tree is going to be installed? Currently I generate a file with a hardcoded planet version number before packaging, and use the planet module path as a handle to the code. Alternatively, is it possible to define a shorter alias for a planet package tree? From eli at barzilay.org Fri Jul 25 12:33:03 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:24:06 2009 Subject: [plt-scheme] Staapl In-Reply-To: <20080725162742.GE12729@zzz.i> References: <20080725073505.GA14377@zzz.i> <20080725103217.GD12729@zzz.i> <18569.44424.352246.373009@arabic.ccs.neu.edu> <20080725162742.GE12729@zzz.i> Message-ID: <18570.63.696438.206281@arabic.ccs.neu.edu> On Jul 25, Tom Schouten wrote: > > There's another problem I ran into: the code refers to its own tree > at runtime to load some modules into isolated namespaces for the > interactive part. Is there a way to make this kind of closure work > without knowing in advance where the tree is going to be installed? Is `define-runtime-path' what you're looking for? -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From grettke at acm.org Fri Jul 25 12:59:40 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:24:06 2009 Subject: [plt-scheme] Keyword argument refactoring comments Message-ID: <756daca50807250959j1ddf49ecg59fe2e064629237@mail.gmail.com> Hi folks, I've been reading bits and pieces of the new document for 4.x. I see that in Slideshow, there is now one convenient slide function 'slide' with keyword arguments for everything. Did you enjoy cutting it over to using keyword arguments? Did you ever find places where you thought keywords would be great, but then turned out to be a bad idea? Have you got any utilization of keyword argument idioms? Best wishes, Grant From grettke at acm.org Fri Jul 25 13:06:53 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:24:07 2009 Subject: [plt-scheme] Slideshow best practices and tips? Message-ID: <756daca50807251006g7084659fo190778a6c9ba0440@mail.gmail.com> HI folks, While recently revising a slideshow with a *lot* of slides, spent a lot of time going back and forth between slides (being run) and the actual source code to make changes. I sort of wondered why I was torturing myself, because I couldn't easily just go to "Slide13", instead I had to sort of keep track of where each slide was and scroll up and down to find the title string. Why wasn't I using the features of DrScheme to make my life easier?! To make this process easier I wrote the following macro along with example usage: #lang slideshow (define slides '()) (define-syntax add-slide (syntax-rules () [(add-slide (define (name args ...) body)) (begin (define (name args ...) body) (set! slides (append slides `(,name))))])) (add-slide (define (slide-1) (slide #:title "Slide 1"))) (add-slide (define (slide-2) (slide #:title "Slide 2"))) (add-slide (define (slide-3) (slide #:title "Slide 3"))) (for-each (? (slide) (slide)) slides) Now I can use the DrScheme "definition browser dropdown" to just jump to the named slide. How simple! (Or why did I ever make it this hard?) What kind of things do you guys do to get the most power out of Slideshow (technically or presentation wise)? Best wishes, Grant From sk at cs.brown.edu Fri Jul 25 13:11:11 2008 From: sk at cs.brown.edu (Shriram Krishnamurt