From rcleis at mac.com Wed Jul 1 00:27:52 2009 From: rcleis at mac.com (Richard Cleis) Date: Wed Jul 1 00:28:15 2009 Subject: [plt-scheme] How to execute eval from a network udp socket? In-Reply-To: <756daca50906300722m62f0a443t13c3910cc26fb49a@mail.gmail.com> References: <756daca50906300722m62f0a443t13c3910cc26fb49a@mail.gmail.com> Message-ID: <6AFB6443-6813-46F1-AFAC-DA95418B75BE@mac.com> Why is it so evil to depend on the top level name space, especially for launching things like servers? This module works fine with netcat (although I would include exception handlers etc if I knew the goal of this): #lang scheme (module evil-eval-module scheme (provide make-evil-server) (require scheme/udp) (define (make-evil-server port buff-size) (define byte-buff (make-bytes buff-size)) (define the-socket (udp-open-socket)) (define evil-eval-thread #f) (define (evil-evaler) (let-values (((n ipa port) (udp-receive! the-socket byte-buff))) (when n (let ((oob (open-output-bytes))) (write (eval (read (open-input-bytes byte-buff))) oob) (write-byte 10 oob) (udp-send-to the-socket ipa port (get-output-bytes oob)))) (evil-evaler))) (lambda (flag) (cond ((equal? flag 'go) (udp-bind! the-socket #f port) (set! evil-eval-thread (thread evil-evaler))) (else (kill-thread evil-eval-thread) (udp-close the-socket))))) ) The executive file contains: (require "evil-eval-module.ss") (define serve-evil-1 (make-evil-server 11111 1024)) (define serve-evil-2 (make-evil-server 22222 1024)) and the evil hacker starts them with: (serve-evil-1 'go) (serve-evil-2 'go) rac On Jun 30, 2009, at 8:22 AM, Grant Rettke wrote: > Hi Todd, > > On Tue, Jun 30, 2009 at 4:14 AM, Todd Rovito > wrote: >> I am new to scheme trying to learn. Currently I have a closed >> network where I am passing s-expressions around with UDP sockets. >> The >> UDP sockets work well in scheme now I need to go to the next level >> and >> actually execute those s-expressions. Here is an example server: > > Here are some links that I have collected regarding this topic: > > http://download.plt-scheme.org/doc/html/reference/syntax-model.html#(part._namespace-model) > http://download.plt-scheme.org/doc/html/reference/Namespaces.html > http://download.plt-scheme.org/doc/html/reference/Sandboxed_Evaluation.html > > http://schemecookbook.org/Cookbook/DynamicEvalCustomNamespace > http://schemecookbook.org/Cookbook/DynamicUntrustedEval > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From noelwelsh at gmail.com Wed Jul 1 04:08:20 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Wed Jul 1 04:08:43 2009 Subject: [plt-scheme] How to execute eval from a network udp socket? In-Reply-To: <6AFB6443-6813-46F1-AFAC-DA95418B75BE@mac.com> References: <756daca50906300722m62f0a443t13c3910cc26fb49a@mail.gmail.com> <6AFB6443-6813-46F1-AFAC-DA95418B75BE@mac.com> Message-ID: On Wed, Jul 1, 2009 at 5:27 AM, Richard Cleis wrote: > Why is it so evil to depend on the top level name space, especially for > launching things like servers? Against the top level: http://calculist.blogspot.com/2009/01/fexprs-in-scheme.html Two reasons against eval: - Lots of new users lean on eval we they don't really understand how it works and the various tradeoffs. - Static analysis (manual or automatic) goes out the window. Eval can do anything. If your program using eval starts doing odd things you'll have a hell of a time understanding it. N. From nik at fo.am Wed Jul 1 04:17:54 2009 From: nik at fo.am (nik gaffney) Date: Wed Jul 1 04:18:27 2009 Subject: [plt-scheme] require errors Message-ID: <4A4B1BB2.80509@fo.am> hello, I am trying to require a planet package in an application that embedds mzscheme, but it doesn't seem to work. so, i was wondering if there is something that needs to be set up for this to work, or if its a bug. for example, the following require form works in DrScheme and mzscheme but fails using an embedded mzscheme. .. (require (planet zzkt/xmpp)) cdddr: expects argument of type ; given ("zzkt" "xmpp.ss") === context === embedded-resolver (current-module-name-resolver) # any suggestions as to what is going wrong? regards, nik From egarrulo at gmail.com Wed Jul 1 04:21:35 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Wed Jul 1 04:21:54 2009 Subject: [plt-scheme] Using FFI with complex structures and input/output parameters? In-Reply-To: <19018.15202.987178.793378@winooski.ccs.neu.edu> References: <9bd8a08a0906300541x76ffb2e1ka137221f13745fdd@mail.gmail.com> <19018.15202.987178.793378@winooski.ccs.neu.edu> Message-ID: <9bd8a08a0907010121q280867e4xce6de8fc8d295c08@mail.gmail.com> Thank you for your corrections and suggestions. I've applied them and reduced again source code to help diagnosis, but the error message at "SCardTransmit" call is still there ("zero?: expects argument of type ; given #"). I'm sending modified sources as attachment to avoid breaking indentation. Thank you for your attention. -------------- next part -------------- A non-text attachment was scrubbed... Name: main.scm Type: application/octet-stream Size: 2451 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090701/454bd53e/main.obj From egarrulo at gmail.com Wed Jul 1 04:36:53 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Wed Jul 1 04:37:12 2009 Subject: [plt-scheme] Re: Windows + remapped keyboard: DrScheme misinterpreting AltGr characters as commands In-Reply-To: <932b2f1f0906300517n2dab25fx99723bcf9e164b03@mail.gmail.com> References: <9bd8a08a0906240240x554d0abah7da5355a114596a9@mail.gmail.com> <2b2045e2-bd2d-48fb-8862-23fc90fbab79@l12g2000yqo.googlegroups.com> <932b2f1f0906300517n2dab25fx99723bcf9e164b03@mail.gmail.com> Message-ID: <9bd8a08a0907010136l348952f9gffc20a58d453ea4f@mail.gmail.com> 2009/6/30, Robby Findler : > The code below (run it in the "module" language in drscheme, or put it > in a file and run "mred-text file.ss" from the shell prompt) will > print out the key code of your key presses. Thank you very much, Robby, for your testing code. I've run it under DrScheme and AltGr+key presses are registered correctly (that is, I see the punctuation characters correctly registered and printed). Still, same key presses under DrScheme's editor issue commands instead of printing expected punctuation characters. I thought that maybe AltGr is being confused with Alt, therefore I've given a glimpse at menu -> Edit -> Keybindings -> Show Active Keybindings, but none of the Alt related keybindings is related to the misinterpreted characters. Any further suggestion? Thanks. From egarrulo at gmail.com Wed Jul 1 05:15:26 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Wed Jul 1 05:15:45 2009 Subject: [plt-scheme] Using FFI with complex structures and input/output parameters? In-Reply-To: <9bd8a08a0907010121q280867e4xce6de8fc8d295c08@mail.gmail.com> References: <9bd8a08a0906300541x76ffb2e1ka137221f13745fdd@mail.gmail.com> <19018.15202.987178.793378@winooski.ccs.neu.edu> <9bd8a08a0907010121q280867e4xce6de8fc8d295c08@mail.gmail.com> Message-ID: <9bd8a08a0907010215y25741d01h29beea096ca86d8e@mail.gmail.com> I also wonder whether I should use "make-u8vector" instead of "make-vector" to build a vector of bytes. 2009/7/1, Elena Garrulo : > Thank you for your corrections and suggestions. I've applied them and > reduced again source code to help diagnosis, but the error message at > "SCardTransmit" call is still there ("zero?: expects argument of type > ; given #"). I'm sending modified sources as > attachment to avoid breaking indentation. > > Thank you for your attention. > From pocmatos at gmail.com Wed Jul 1 05:19:42 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Wed Jul 1 05:26:23 2009 Subject: [plt-scheme] Emacs Keybindings Message-ID: <11b141710907010219n7f157453sb6ff8c2228fb2a78@mail.gmail.com> Hi all, Has anyone created a set of keybindings of DrScheme that mimic Emacs that you can share? Thanks, -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From egarrulo at gmail.com Wed Jul 1 05:57:34 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Wed Jul 1 05:57:50 2009 Subject: [plt-scheme] SRH Message-ID: <9bd8a08a0907010257w66aec314q7965301d91e3a6cf@mail.gmail.com> From egarrulo at gmail.com Wed Jul 1 06:03:42 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Wed Jul 1 06:04:02 2009 Subject: [plt-scheme] SRFI 62 (S-expression comments) not highlighted in DrScheme editor Message-ID: <9bd8a08a0907010303x58e09f2cvefd0c21c207e3e0f@mail.gmail.com> Hello, I'm using SRFI 62 sexpr comments in DrScheme editor. Indeed sexprs commented like this are not evaluated, but they are not highlighted as comments. Maybe am I missing any IDE setting? Thanks. From rcleis at mac.com Wed Jul 1 07:14:21 2009 From: rcleis at mac.com (Richard Cleis) Date: Wed Jul 1 07:16:50 2009 Subject: [plt-scheme] How to execute eval from a network udp socket? In-Reply-To: References: <756daca50906300722m62f0a443t13c3910cc26fb49a@mail.gmail.com> <6AFB6443-6813-46F1-AFAC-DA95418B75BE@mac.com> Message-ID: <42B9E6E2-66AB-472B-AA83-B1ACAB7CA05C@mac.com> Top level interactions, eval, and wine can all be misused; I suppose I could write Java and drink water. RAC On Jul 1, 2009, at 2:08 AM, Noel Welsh wrote: > On Wed, Jul 1, 2009 at 5:27 AM, Richard Cleis wrote: >> Why is it so evil to depend on the top level name space, especially >> for >> launching things like servers? > > Against the top level: > > http://calculist.blogspot.com/2009/01/fexprs-in-scheme.html > > > Two reasons against eval: > > - Lots of new users lean on eval we they don't really understand how > it works and the various tradeoffs. > - Static analysis (manual or automatic) goes out the window. Eval can > do anything. If your program using eval starts doing odd things you'll > have a hell of a time understanding it. > > N. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From noelwelsh at gmail.com Wed Jul 1 08:37:45 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Wed Jul 1 08:38:05 2009 Subject: [plt-scheme] How to execute eval from a network udp socket? In-Reply-To: <42B9E6E2-66AB-472B-AA83-B1ACAB7CA05C@mac.com> References: <756daca50906300722m62f0a443t13c3910cc26fb49a@mail.gmail.com> <6AFB6443-6813-46F1-AFAC-DA95418B75BE@mac.com> <42B9E6E2-66AB-472B-AA83-B1ACAB7CA05C@mac.com> Message-ID: On Wed, Jul 1, 2009 at 12:14 PM, Richard Cleis wrote: > Top level interactions, eval, and wine can all be misused; I suppose I could > write Java and drink water. Hey, I have nothing against any of the above when they're appropriate *shrug* N. From sk at cs.brown.edu Wed Jul 1 08:40:11 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Wed Jul 1 08:40:49 2009 Subject: [plt-scheme] How to execute eval from a network udp socket? In-Reply-To: <42B9E6E2-66AB-472B-AA83-B1ACAB7CA05C@mac.com> References: <756daca50906300722m62f0a443t13c3910cc26fb49a@mail.gmail.com> <6AFB6443-6813-46F1-AFAC-DA95418B75BE@mac.com> <42B9E6E2-66AB-472B-AA83-B1ACAB7CA05C@mac.com> Message-ID: On Wed, Jul 1, 2009 at 7:14 AM, Richard Cleis wrote: > Top level interactions, eval, and wine can all be misused; I suppose I could > write Java and drink water. Or poison. S. From rcleis at mac.com Wed Jul 1 09:13:40 2009 From: rcleis at mac.com (Richard Cleis) Date: Wed Jul 1 09:15:52 2009 Subject: [plt-scheme] How to execute eval from a network udp socket? In-Reply-To: References: <756daca50906300722m62f0a443t13c3910cc26fb49a@mail.gmail.com> <6AFB6443-6813-46F1-AFAC-DA95418B75BE@mac.com> <42B9E6E2-66AB-472B-AA83-B1ACAB7CA05C@mac.com> Message-ID: I'll just have water, then. RAC On Jul 1, 2009, at 6:40 AM, Shriram Krishnamurthi wrote: > On Wed, Jul 1, 2009 at 7:14 AM, Richard Cleis wrote: >> Top level interactions, eval, and wine can all be misused; I >> suppose I could >> write Java and drink water. > > Or poison. > > S. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From eli at barzilay.org Wed Jul 1 10:14:21 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jul 1 10:14:43 2009 Subject: [plt-scheme] Using FFI with complex structures and input/output parameters? In-Reply-To: <9bd8a08a0907010121q280867e4xce6de8fc8d295c08@mail.gmail.com> References: <9bd8a08a0906300541x76ffb2e1ka137221f13745fdd@mail.gmail.com> <19018.15202.987178.793378@winooski.ccs.neu.edu> <9bd8a08a0907010121q280867e4xce6de8fc8d295c08@mail.gmail.com> Message-ID: <19019.28477.861359.5603@winooski.ccs.neu.edu> On Jul 1, Elena Garrulo wrote: > Thank you for your corrections and suggestions. I've applied them > and reduced again source code to help diagnosis, but the error > message at "SCardTransmit" call is still there ("zero?: expects > argument of type ; given #"). I'm sending > modified sources as attachment to avoid breaking indentation. The problem is here: ;; OUT BYTE* pbRecvBuffer (pbRecvBuffer : (_vector o _byte cbRecvLength)) ;; IN OUT DWORD* pcbRecvLength (cbRecvLength : (_ptr io _DWORD)) You can't use `cbRecvLength' like that. You can use the `::' marker, where you put all the arguments to the wrapper explicitly at the front, but it still wouldn't work because the value that `cbRecvLength' will be bound to is a pointer. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From eli at barzilay.org Wed Jul 1 10:15:15 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jul 1 10:15:36 2009 Subject: [plt-scheme] Using FFI with complex structures and input/output parameters? In-Reply-To: <9bd8a08a0907010215y25741d01h29beea096ca86d8e@mail.gmail.com> References: <9bd8a08a0906300541x76ffb2e1ka137221f13745fdd@mail.gmail.com> <19018.15202.987178.793378@winooski.ccs.neu.edu> <9bd8a08a0907010121q280867e4xce6de8fc8d295c08@mail.gmail.com> <9bd8a08a0907010215y25741d01h29beea096ca86d8e@mail.gmail.com> Message-ID: <19019.28531.271195.951123@winooski.ccs.neu.edu> On Jul 1, Elena Garrulo wrote: > I also wonder whether I should use "make-u8vector" instead of > "make-vector" to build a vector of bytes. You can just use a byte string (eg `make-bytes'). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From eli at barzilay.org Wed Jul 1 10:23:20 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jul 1 10:23:42 2009 Subject: [plt-scheme] SRFI 62 (S-expression comments) not highlighted in DrScheme editor In-Reply-To: <9bd8a08a0907010303x58e09f2cvefd0c21c207e3e0f@mail.gmail.com> References: <9bd8a08a0907010303x58e09f2cvefd0c21c207e3e0f@mail.gmail.com> Message-ID: <19019.29016.674664.621311@winooski.ccs.neu.edu> On Jul 1, Elena Garrulo wrote: > Hello, > > I'm using SRFI 62 sexpr comments in DrScheme editor. Indeed sexprs > commented like this are not evaluated, but they are not highlighted as > comments. > > Maybe am I missing any IDE setting? No, see this: http://list.cs.brown.edu/pipermail/plt-scheme/2007-October/020925.html -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From egarrulo at gmail.com Wed Jul 1 10:32:14 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Wed Jul 1 10:32:37 2009 Subject: [plt-scheme] Using FFI with complex structures and input/output parameters? In-Reply-To: <19019.28477.861359.5603@winooski.ccs.neu.edu> References: <9bd8a08a0906300541x76ffb2e1ka137221f13745fdd@mail.gmail.com> <19018.15202.987178.793378@winooski.ccs.neu.edu> <9bd8a08a0907010121q280867e4xce6de8fc8d295c08@mail.gmail.com> <19019.28477.861359.5603@winooski.ccs.neu.edu> Message-ID: <9bd8a08a0907010732w1c3c1272nfb77ec10b9511a44@mail.gmail.com> 2009/7/1 Eli Barzilay : > The problem is here: > > ? ? ? ? ? ? ? ?;; OUT BYTE* pbRecvBuffer > ? ? ? ? ? ? ? ?(pbRecvBuffer : ?(_vector o _byte cbRecvLength)) > ? ? ? ? ? ? ? ?;; IN OUT DWORD* pcbRecvLength > ? ? ? ? ? ? ? ?(cbRecvLength : ?(_ptr io _DWORD)) > > You can't use `cbRecvLength' like that. ?You can use the `::' marker, > where you put all the arguments to the wrapper explicitly at the > front, but it still wouldn't work because the value that > `cbRecvLength' will be bound to is a pointer. Then, my question boils down to: with current FFI, can you use an input/output parameter which holds the size of a buffer? For instance, a function like: void fill_buffer (BYTE* buffer, DWORD* buffer_size); where buffer_size holds: - size of buffer on input; - size of written data on output; has a mapping in FFI? Thanks From eli at barzilay.org Wed Jul 1 10:36:09 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jul 1 10:36:31 2009 Subject: [plt-scheme] Using FFI with complex structures and input/output parameters? In-Reply-To: <9bd8a08a0907010732w1c3c1272nfb77ec10b9511a44@mail.gmail.com> References: <9bd8a08a0906300541x76ffb2e1ka137221f13745fdd@mail.gmail.com> <19018.15202.987178.793378@winooski.ccs.neu.edu> <9bd8a08a0907010121q280867e4xce6de8fc8d295c08@mail.gmail.com> <19019.28477.861359.5603@winooski.ccs.neu.edu> <9bd8a08a0907010732w1c3c1272nfb77ec10b9511a44@mail.gmail.com> Message-ID: <19019.29785.367388.905047@winooski.ccs.neu.edu> On Jul 1, Elena Garrulo wrote: > 2009/7/1 Eli Barzilay : > > The problem is here: > > > > ? ? ? ? ? ? ? ?;; OUT BYTE* pbRecvBuffer > > ? ? ? ? ? ? ? ?(pbRecvBuffer : ?(_vector o _byte cbRecvLength)) > > ? ? ? ? ? ? ? ?;; IN OUT DWORD* pcbRecvLength > > ? ? ? ? ? ? ? ?(cbRecvLength : ?(_ptr io _DWORD)) > > > > You can't use `cbRecvLength' like that. ?You can use the `::' > > marker, where you put all the arguments to the wrapper explicitly > > at the front, but it still wouldn't work because the value that > > `cbRecvLength' will be bound to is a pointer. > > Then, my question boils down to: with current FFI, can you use an > input/output parameter which holds the size of a buffer? For > instance, a function like: > > void fill_buffer (BYTE* buffer, DWORD* buffer_size); > > where buffer_size holds: > - size of buffer on input; > - size of written data on output; > > has a mapping in FFI? No. It might have been possible to use it if the order was swapped, but as the above you can't really do that in a similar way that you can't really compile `letrec' into an order that resolves dependencies automatically. But you can use a simple `cblock->vector' in the wrapper code. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From grettke at acm.org Wed Jul 1 11:50:03 2009 From: grettke at acm.org (Grant Rettke) Date: Wed Jul 1 11:50:23 2009 Subject: [plt-scheme] How to execute eval from a network udp socket? In-Reply-To: <6AFB6443-6813-46F1-AFAC-DA95418B75BE@mac.com> References: <756daca50906300722m62f0a443t13c3910cc26fb49a@mail.gmail.com> <6AFB6443-6813-46F1-AFAC-DA95418B75BE@mac.com> Message-ID: <756daca50907010850h16d85396u1ab62142aa792be0@mail.gmail.com> On Tue, Jun 30, 2009 at 11:27 PM, Richard Cleis wrote: > Why is it so evil to depend on the top level name space, especially for > launching things like servers? ?This module works fine with netcat (although > I would include exception handlers etc if I knew the goal of this): It isn't evil. My experience coming to Scheme was such that I wanted to start using eval without fully understanding how it works, and what are pros and cons compared to other alternatives. Eval gets a lot of hype and one might feel an intense desire to utilize it without as much need. As such, my experience with eval suffered for it. Based on reading emails to this group, I suspect that I am not the only one who has committed this sin of laziness. It wasn't eval's fault. Namespaces are nicer if you want to control your environment, disallow 'exit' for example in the server code. From chadestioco at gmail.com Wed Jul 1 13:23:13 2009 From: chadestioco at gmail.com (Andrei Estioco) Date: Wed Jul 1 13:29:20 2009 Subject: [plt-scheme] Functional Abstraction in Java Message-ID: Hello. My apologies if I am asking this in the wrong mailing list (this being a Java question). But since I encountered this concept in HtDP, I thought of asking around here. (See Chapter 21 of HtDP). See I have a function private int getSaturdays(int x, int fordays){ int Weeks = getWeeks(x, fordays); int SaturdayCounter = 0; int i = 1; while(i <= hartalWeeks){ if(getSaturdayIndex(i) % x == 0){ SaturdayCounter++; i++; } else{ i++; } } return SaturdayCounter; } and another one private int getSundays(int x, int fordays){ int Weeks = getWeeks(x, fordays); int SundaysCounter = 0; int i = 1; while(i <= hartalWeeks){ if(getSundayIndex(i) % x == 0){ SundayCounter++; i++; } else{ i++; } } return SundayCounter; } As obvious, they do the same process, their sole difference being a function call (the one in the if line). Now, if I were to do this in Scheme, I'll just add another argument to my function which will be called in the if line (as in Chapter 21). However, I do not know how to do this in Java. I know how to sort in Java using the Comparator interface and all that OO stuff. I thought of using that style here but then I was wondering if I could do this without OO. Is it possible? Thanks in advance, -- Chad Estioco BS Computer Science (ongoing) University of the Philippines-Diliman ============================== http://www.geocities.com/lokisky_walker -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090702/1a71c6e5/attachment.html From robby at eecs.northwestern.edu Wed Jul 1 13:32:50 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Jul 1 13:33:12 2009 Subject: [plt-scheme] Functional Abstraction in Java In-Reply-To: References: Message-ID: <932b2f1f0907011032r31155737ob7db7a6d39c37d82@mail.gmail.com> You can do the same thing as in HtDP by passing in a object with a single method that does what the function would have done. A more OO solution is to put a getXdays method in a common (abstract) superclass and then call getXIndex and have the two classes override getXIndex with getSundayIndex and getSaturdayIndex. This only works if the two classes can share a common superclass. This is called the "hook and template" design pattern, I believe. Robby On Wed, Jul 1, 2009 at 12:23 PM, Andrei Estioco wrote: > Hello. My apologies if I am asking this in the wrong mailing list (this > being a Java question). But since I encountered this concept in HtDP, I > thought of asking around here. (See Chapter 21 of HtDP). See I have a > function private int getSaturdays(int x, int fordays){ int Weeks = > getWeeks(x, fordays); int SaturdayCounter = 0; int i = 1; while(i <= > hartalWeeks){ if(getSaturdayIndex(i) % x == 0){ SaturdayCounter++; i++; } > else{ i++; } } return SaturdayCounter; } and another one private int > getSundays(int x, int fordays){ int Weeks = getWeeks(x, fordays); int > SundaysCounter = 0; int i = 1; while(i <= hartalWeeks){ if(getSundayIndex(i) > % x == 0){ SundayCounter++; i++; } else{ i++; } } return SundayCounter; } As > obvious, they do the same process, their sole difference being a function > call (the one in the if line). Now, if I were to do this in Scheme, I'll > just add another argument to my function which will be called in the if line > (as in Chapter 21). However, I do not know how to do this in Java. > I know how to sort in Java using the Comparator interface and all that OO > stuff. I thought of using that style here but then I was wondering if I > could do this without OO. Is it possible? > > Thanks in advance, > -- > Chad Estioco > BS Computer Science (ongoing) > University of the Philippines-Diliman > ============================== > http://www.geocities.com/lokisky_walker > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From rovitotv at gmail.com Wed Jul 1 13:39:34 2009 From: rovitotv at gmail.com (Todd Rovito) Date: Wed Jul 1 13:39:56 2009 Subject: [plt-scheme] How to execute eval from a network udp socket? In-Reply-To: <756daca50906300722m62f0a443t13c3910cc26fb49a@mail.gmail.com> References: <756daca50906300722m62f0a443t13c3910cc26fb49a@mail.gmail.com> Message-ID: Grant, Thanks for the links, the Scheme cookbook is nice! I worked on this yesterday and here is what I have, at this point it works for my problem. Thanks to all for the help, I am still learning but so far I find plt-scheme to be very cool. ; to execute this program with mzscheme "mzschemecgc -e '(load "SchemeUDPServerEval.scm")'" then ; you can use netcat to send udp traffic to the program with the command ; "nc -u 214.4.1.147 51515" then simply enter a valid scheme expression and watch it ; magically get evaluated. If the expression is invalid, the application will terminate. (require (lib "string.ss")) (define repl-string (make-string 1024)) (define repl-buffer (make-bytes 1024 )) (define sleep-secs 1) (define port 51515) (define the-socket (udp-open-socket)) (define (doeval StringLength) ; this code converts byte string to a locale string and removes the '\n' (set! repl-string (bytes->string/locale repl-buffer #f 0 (- StringLength 1))) ; print out the string to eval then the eval result (display "string to eval:") (display repl-string) (display " ") (display (eval-string repl-string)) (display " \n") ) ; this function sleeps for 1 second then listens for udp traffic on the ip and port number ; it is a non-blocking receive. ; this function is an example of a scheme "for" loop (define (doit x x-max dx) (when (<= x x-max) (begin (sleep sleep-secs) (printf "for loop:~a\n" x) (let-values (((n ip port) (udp-receive!* the-socket repl-buffer))) (if n (doeval n) (printf "No data read on udp socket\n") ) ) (doit (+ x dx) x-max dx) ))) (define (start) (printf "Scheme UDP Server with eval\n") ; bind to the socket and port (udp-bind! the-socket #f port) (doit 0 50 1) ; execute loop from 0 to 50 in steps of 1 (udp-close the-socket) ) (start) On Tue, Jun 30, 2009 at 4:22 AM, Grant Rettke wrote: > Hi Todd, > > On Tue, Jun 30, 2009 at 4:14 AM, Todd Rovito wrote: >> ? I am new to scheme trying to learn. ?Currently I have a closed >> network where I am passing s-expressions around with UDP sockets. ?The >> UDP sockets work well in scheme now I need to go to the next level and >> actually execute those s-expressions. ?Here is an example server: > > Here are some links that I have collected regarding this topic: > > http://download.plt-scheme.org/doc/html/reference/syntax-model.html#(part._namespace-model) > http://download.plt-scheme.org/doc/html/reference/Namespaces.html > http://download.plt-scheme.org/doc/html/reference/Sandboxed_Evaluation.html > > http://schemecookbook.org/Cookbook/DynamicEvalCustomNamespace > http://schemecookbook.org/Cookbook/DynamicUntrustedEval > From hsmyers at gmail.com Wed Jul 1 13:46:39 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Wed Jul 1 13:47:17 2009 Subject: [plt-scheme] pseudo statics Message-ID: <408995400907011046o5b2e2860y2d34867b2c5643e6@mail.gmail.com> Somewhere is a discussion about code like: (define counter (let ((a 0)) (lambda () (set! a (+ 1 a)) a))) I just can't remember where! Anyone have any useful pointers or such? --hsm From matthias at ccs.neu.edu Wed Jul 1 13:53:35 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Jul 1 13:55:10 2009 Subject: [plt-scheme] pseudo statics In-Reply-To: <408995400907011046o5b2e2860y2d34867b2c5643e6@mail.gmail.com> References: <408995400907011046o5b2e2860y2d34867b2c5643e6@mail.gmail.com> Message-ID: HtDP, chapter VII (and VIII, and Intermezzo). On Jul 1, 2009, at 1:46 PM, Hugh Myers wrote: > Somewhere is a discussion about code like: > > (define counter > (let ((a 0)) > (lambda () > (set! a (+ 1 a)) > a))) > > I just can't remember where! Anyone have any useful pointers or such? > > --hsm > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From matthias at ccs.neu.edu Wed Jul 1 14:01:03 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Jul 1 14:02:38 2009 Subject: [plt-scheme] Functional Abstraction in Java In-Reply-To: <932b2f1f0907011032r31155737ob7db7a6d39c37d82@mail.gmail.com> References: <932b2f1f0907011032r31155737ob7db7a6d39c37d82@mail.gmail.com> Message-ID: <5173D0D6-489C-47EA-B02E-1D1AEE7918B9@ccs.neu.edu> Let me refine Robby's suggestion: * If getSat and getSun are in the -same- class, you need to use the command pattern: interface GetXDay { int apply(int index); } Now implement this interface for Sat and Sun, and pass in appropriate instances. You don't apply these instances, instead you write if(getSaturdayIndex.apply(i) % x == 0) { ... * If getSat and getSun belong to two distinct classes, create a superclass with an abstract method getXDay that you override with getSatDay in one subclass and with getSunDay in the other. I consider both solutions in the spirit of OOPLs. -- Matthias On Jul 1, 2009, at 1:32 PM, Robby Findler wrote: > You can do the same thing as in HtDP by passing in a object with a > single method that does what the function would have done. > > A more OO solution is to put a getXdays method in a common (abstract) > superclass and then call getXIndex and have the two classes override > getXIndex with getSundayIndex and getSaturdayIndex. This only works if > the two classes can share a common superclass. > > This is called the "hook and template" design pattern, I believe. > > Robby > > On Wed, Jul 1, 2009 at 12:23 PM, Andrei > Estioco wrote: >> Hello. My apologies if I am asking this in the wrong mailing list >> (this >> being a Java question). But since I encountered this concept in >> HtDP, I >> thought of asking around here. (See Chapter 21 of HtDP). See I have a >> function private int getSaturdays(int x, int fordays){ int Weeks = >> getWeeks(x, fordays); int SaturdayCounter = 0; int i = 1; while(i <= >> hartalWeeks){ if(getSaturdayIndex(i) % x == 0){ SaturdayCounter++; >> i++; } >> else{ i++; } } return SaturdayCounter; } and another one private int >> getSundays(int x, int fordays){ int Weeks = getWeeks(x, fordays); int >> SundaysCounter = 0; int i = 1; while(i <= hartalWeeks){ if >> (getSundayIndex(i) >> % x == 0){ SundayCounter++; i++; } else{ i++; } } return >> SundayCounter; } As >> obvious, they do the same process, their sole difference being a >> function >> call (the one in the if line). Now, if I were to do this in >> Scheme, I'll >> just add another argument to my function which will be called in >> the if line >> (as in Chapter 21). However, I do not know how to do this in Java. >> I know how to sort in Java using the Comparator interface and all >> that OO >> stuff. I thought of using that style here but then I was wondering >> if I >> could do this without OO. Is it possible? >> >> Thanks in advance, >> -- >> Chad Estioco >> BS Computer Science (ongoing) >> University of the Philippines-Diliman >> ============================== >> http://www.geocities.com/lokisky_walker >> >> _________________________________________________ >> 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 dvanhorn at ccs.neu.edu Wed Jul 1 14:10:23 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Wed Jul 1 14:11:24 2009 Subject: [plt-scheme] Functional Abstraction in Java In-Reply-To: References: Message-ID: <4A4BA68F.8000005@ccs.neu.edu> Andrei Estioco wrote: > Hello. My apologies if I am asking this in the wrong mailing list (this > being a Java question). This is *the* list for this sort of question. You can think of functions A -> B as objects satisfying the interface B apply(A). So all of your favorite functional idioms can be expressed in Java, just with considerable notational overhead. It's fun to try -- so don't just take my word for it. Here is a simple program that shows how to develop filter (which abstracts the predicate to apply): http://www.ccs.neu.edu/home/dvanhorn/tmp/213-notes/02-18-2009-2.java Here is a higher-order example, the derivative function: class Calculus { interface IFun1 { Y apply(X x); } IFun1,IFun1> deriv = new IFun1,IFun1>() { double d = 0.001; public IFun1 apply(final IFun1 f) { return new IFun1() { public Double apply(Double x) { return (f.apply(x + d) - f.apply(x - d)) / (d * 2); } }; } }; IFun1 sin = new IFun1() { public Double apply(Double x) { return Math.sin(x); } }; IFun1 cos = deriv.apply(sin); } Finally, you can find more of this in the Little Java book (and in the forthcoming HtDC book). David From robby at eecs.northwestern.edu Wed Jul 1 14:17:52 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Jul 1 14:18:11 2009 Subject: [plt-scheme] Functional Abstraction in Java In-Reply-To: <5173D0D6-489C-47EA-B02E-1D1AEE7918B9@ccs.neu.edu> References: <932b2f1f0907011032r31155737ob7db7a6d39c37d82@mail.gmail.com> <5173D0D6-489C-47EA-B02E-1D1AEE7918B9@ccs.neu.edu> Message-ID: <932b2f1f0907011117h2bf0f302qa6b904151062811@mail.gmail.com> On Wed, Jul 1, 2009 at 1:01 PM, Matthias Felleisen wrote: > I consider both solutions in the spirit of OOPLs. -- Matthias Sorry -- didn't mean to imply that one wasn't in the spirit of OOP; bad wording choice on my part. Robby From raould at gmail.com Wed Jul 1 14:13:12 2009 From: raould at gmail.com (Raoul Duke) Date: Wed Jul 1 14:20:55 2009 Subject: [plt-scheme] Functional Abstraction in Java In-Reply-To: <4A4BA68F.8000005@ccs.neu.edu> References: <4A4BA68F.8000005@ccs.neu.edu> Message-ID: <91a2ba3e0907011113u607dac8bk4e2601f7cf1b8459@mail.gmail.com> > You can think of functions A -> B as objects satisfying the interface B > apply(A). So all of your favorite functional idioms can be expressed in > Java, just with considerable notational overhead. It's fun to try -- so > don't just take my word for it. btw, personally i find this kind of stuff is easier/better/clearer in something like Scala than in Java. sincerely. From matthias at ccs.neu.edu Wed Jul 1 14:27:23 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Jul 1 14:28:53 2009 Subject: [plt-scheme] Functional Abstraction in Java In-Reply-To: <932b2f1f0907011117h2bf0f302qa6b904151062811@mail.gmail.com> References: <932b2f1f0907011032r31155737ob7db7a6d39c37d82@mail.gmail.com> <5173D0D6-489C-47EA-B02E-1D1AEE7918B9@ccs.neu.edu> <932b2f1f0907011117h2bf0f302qa6b904151062811@mail.gmail.com> Message-ID: <9ACE63B4-926E-492F-BA7D-56C21B8C4EE7@ccs.neu.edu> Ah, I agree with you actually, which is why I weasled in the letter "L" into my sentence. And HtCH says so! On Jul 1, 2009, at 2:17 PM, Robby Findler wrote: > On Wed, Jul 1, 2009 at 1:01 PM, Matthias > Felleisen wrote: >> I consider both solutions in the spirit of OOPLs. -- Matthias > > Sorry -- didn't mean to imply that one wasn't in the spirit of OOP; > bad wording choice on my part. > > Robby From robby at eecs.northwestern.edu Wed Jul 1 14:31:04 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Jul 1 14:31:22 2009 Subject: [plt-scheme] Functional Abstraction in Java In-Reply-To: <9ACE63B4-926E-492F-BA7D-56C21B8C4EE7@ccs.neu.edu> References: <932b2f1f0907011032r31155737ob7db7a6d39c37d82@mail.gmail.com> <5173D0D6-489C-47EA-B02E-1D1AEE7918B9@ccs.neu.edu> <932b2f1f0907011117h2bf0f302qa6b904151062811@mail.gmail.com> <9ACE63B4-926E-492F-BA7D-56C21B8C4EE7@ccs.neu.edu> Message-ID: <932b2f1f0907011131m1b5692ma21dbd24159befa5@mail.gmail.com> Ha! :) In reality, I'm not sure I know what the spirit of OOP really is, except that it must contain a heavy dose of FP (given Kay's comments), so passing around what are really little functions should be at least close. Robby On Wed, Jul 1, 2009 at 1:27 PM, Matthias Felleisen wrote: > > Ah, I agree with you actually, which is why I weasled in the letter "L" into > my sentence. And HtCH says so! > > > > > On Jul 1, 2009, at 2:17 PM, Robby Findler wrote: > >> On Wed, Jul 1, 2009 at 1:01 PM, Matthias Felleisen >> wrote: >>> >>> I consider both solutions in the spirit of OOPLs. -- Matthias >> >> Sorry -- didn't mean to imply that one wasn't in the spirit of OOP; >> bad wording choice on my part. >> >> Robby > > From matthias at ccs.neu.edu Wed Jul 1 14:45:01 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Jul 1 14:46:32 2009 Subject: [plt-scheme] Functional Abstraction in Java In-Reply-To: <932b2f1f0907011131m1b5692ma21dbd24159befa5@mail.gmail.com> References: <932b2f1f0907011032r31155737ob7db7a6d39c37d82@mail.gmail.com> <5173D0D6-489C-47EA-B02E-1D1AEE7918B9@ccs.neu.edu> <932b2f1f0907011117h2bf0f302qa6b904151062811@mail.gmail.com> <9ACE63B4-926E-492F-BA7D-56C21B8C4EE7@ccs.neu.edu> <932b2f1f0907011131m1b5692ma21dbd24159befa5@mail.gmail.com> Message-ID: <90FC548E-3CFB-4A41-B8CF-EEC3973FB693@ccs.neu.edu> I think an OO method should involve 'this'. If it doesn't, it's a function. In this spirit, the command pattern for these abstractions usually introduces functions -- though FP people know how to create true closures with this, too. On Jul 1, 2009, at 2:31 PM, Robby Findler wrote: > Ha! :) > > In reality, I'm not sure I know what the spirit of OOP really is, > except that it must contain a heavy dose of FP (given Kay's comments), > so passing around what are really little functions should be at least > close. > > Robby > > On Wed, Jul 1, 2009 at 1:27 PM, Matthias > Felleisen wrote: >> >> Ah, I agree with you actually, which is why I weasled in the >> letter "L" into >> my sentence. And HtCH says so! >> >> >> >> >> On Jul 1, 2009, at 2:17 PM, Robby Findler wrote: >> >>> On Wed, Jul 1, 2009 at 1:01 PM, Matthias >>> Felleisen >>> wrote: >>>> >>>> I consider both solutions in the spirit of OOPLs. -- Matthias >>> >>> Sorry -- didn't mean to imply that one wasn't in the spirit of OOP; >>> bad wording choice on my part. >>> >>> Robby >> >> From jmarshall at alum.mit.edu Wed Jul 1 14:54:26 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Wed Jul 1 15:02:15 2009 Subject: [plt-scheme] Functional Abstraction in Java In-Reply-To: <4A4BA68F.8000005@ccs.neu.edu> References: <4A4BA68F.8000005@ccs.neu.edu> Message-ID: On Wed, Jul 1, 2009 at 11:10 AM, David Van Horn wrote: > all of your favorite functional idioms can be expressed in > Java, just with considerable notational overhead. ?It's fun to try... You have a very weird idea of fun. semicolons 8 curlies 8 pairs commas 8 parenthesis 13 pairs angles 13 pairs public 3 new 3 return 3 apply 7 IFun1 13 double 1 Double 24 -- ~jrm From robby at eecs.northwestern.edu Wed Jul 1 15:04:35 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Jul 1 15:04:53 2009 Subject: [plt-scheme] Functional Abstraction in Java In-Reply-To: <90FC548E-3CFB-4A41-B8CF-EEC3973FB693@ccs.neu.edu> References: <932b2f1f0907011032r31155737ob7db7a6d39c37d82@mail.gmail.com> <5173D0D6-489C-47EA-B02E-1D1AEE7918B9@ccs.neu.edu> <932b2f1f0907011117h2bf0f302qa6b904151062811@mail.gmail.com> <9ACE63B4-926E-492F-BA7D-56C21B8C4EE7@ccs.neu.edu> <932b2f1f0907011131m1b5692ma21dbd24159befa5@mail.gmail.com> <90FC548E-3CFB-4A41-B8CF-EEC3973FB693@ccs.neu.edu> Message-ID: <932b2f1f0907011204y4d1d9371p45c482e77df7a6e1@mail.gmail.com> On Wed, Jul 1, 2009 at 1:45 PM, Matthias Felleisen wrote: > > I think an OO method should involve 'this'. If it doesn't, it's a function. > In this spirit, the command pattern for these abstractions usually > introduces functions -- though FP people know how to create true closures > with this, too. > Closures are functions too! ;) Robby From dvanhorn at ccs.neu.edu Wed Jul 1 15:58:24 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Wed Jul 1 15:59:21 2009 Subject: [plt-scheme] Functional Abstraction in Java In-Reply-To: References: <4A4BA68F.8000005@ccs.neu.edu> Message-ID: <4A4BBFE0.4060705@ccs.neu.edu> Joe Marshall wrote: > On Wed, Jul 1, 2009 at 11:10 AM, David Van Horn wrote: >> all of your favorite functional idioms can be expressed in >> Java, just with considerable notational overhead. It's fun to try... > > You have a very weird idea of fun. You sound just like my parole officer. > semicolons 8 > curlies 8 pairs > commas 8 > parenthesis 13 pairs > angles 13 pairs > > public 3 > new 3 > return 3 > apply 7 > IFun1 13 > double 1 > Double 24 Most of this would go away with partial type inference. But I really don't pay it much mind. There's a significant constant syntactic overhead in defining the abstraction, but using it is cheap. The important point is you can still design programs using functional abstraction; there's no need to abandon one of your conceptual tools just because you move into a Java setting. David From egarrulo at gmail.com Wed Jul 1 16:16:09 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Wed Jul 1 16:16:31 2009 Subject: [plt-scheme] Re: Windows + remapped keyboard: DrScheme misinterpreting AltGr characters as commands In-Reply-To: <932b2f1f0906300517n2dab25fx99723bcf9e164b03@mail.gmail.com> References: <9bd8a08a0906240240x554d0abah7da5355a114596a9@mail.gmail.com> <2b2045e2-bd2d-48fb-8862-23fc90fbab79@l12g2000yqo.googlegroups.com> <932b2f1f0906300517n2dab25fx99723bcf9e164b03@mail.gmail.com> Message-ID: <9bd8a08a0907011316u56738dbdv15daa76e787efec6@mail.gmail.com> 2009/6/30 Robby Findler : > I see that version 4.2 (the latest release) has fewer altgr-related > methods and perhaps you may find that simply trying out the nightly > builds (http://pre.plt-scheme.org/installers/) will fix the problem > for you. How could I detect which AltGr methods are active? DrScheme's Keybindings menu doesn't show them. Thanks From eli at barzilay.org Wed Jul 1 16:33:30 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jul 1 16:33:55 2009 Subject: [plt-scheme] How to execute eval from a network udp socket? In-Reply-To: <756daca50907010850h16d85396u1ab62142aa792be0@mail.gmail.com> References: <756daca50906300722m62f0a443t13c3910cc26fb49a@mail.gmail.com> <6AFB6443-6813-46F1-AFAC-DA95418B75BE@mac.com> <756daca50907010850h16d85396u1ab62142aa792be0@mail.gmail.com> Message-ID: <19019.51226.153040.666179@winooski.ccs.neu.edu> On Jul 1, Grant Rettke wrote: > On Tue, Jun 30, 2009 at 11:27 PM, Richard Cleis wrote: > > Why is it so evil to depend on the top level name space, > > especially for launching things like servers? ?This module works > > fine with netcat (although I would include exception handlers etc > > if I knew the goal of this): > > It isn't evil. No it isn't. However, the bottom line is that people jump onto `eval' way too quickly. (And that includes all languages with some `eval', Scheme is overall better since the general approach is to suspect uses of eval rather than encourage them.) Here's my rule of thumb regarding when to use eval: Q: Should I use `eval'? A: No. Alternatively, take this as a meta-FAQ: Q: Someone has asked me if s/he should use `eval', what should I say? A: Just say no. The motivation behind these is that if you're asking whether you should use it -- then you probably don't know enough to use it, and you shouldn't. There are, of course, cases where you should use it -- for example, the OP might have a goal of a UDP-based repl to a process running on a remote machine. In such cases it's very obvious that you should use eval. If it's not obvious, then it shouldn't be used. (And then there are the more rare cases of people who know they should use eval, but don't know how -- those cases are less problematic, since if you know the issues with it, then you'd expect it to not come easily.) > Namespaces are nicer if you want to control your environment, disallow > 'exit' for example in the server code. No, that's a bad advice for getting "security". It's one of *many* different ways to kill scheme (for example, you could use the exit handler directly, tweak the error and uncaught exception handlers, kill the current thread, shut the current custodian, run an infinite loop, deadlock the thread, require `scheme/foreign' and dereference random numbers, grab memory in a loop, run subprocesses in a loop, run `system' with some "rm -rf /", open random files until the process runs out of FDs, or flood IO, to name just a few). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From jos.koot at telefonica.net Wed Jul 1 16:42:45 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Wed Jul 1 16:43:12 2009 Subject: [plt-scheme] Systems Programming with PLT Scheme Message-ID: <16F8DAF57DFC49EA9BCAF94E7378577B@uw2b2dff239c4d> Unintentionally I came in "Systems Programming with PLT Scheme" by Matthew Flatt in (http://docs.plt-scheme.org/more/). Although I have no plans to implement a server, I could not resist to have a quick look. Very nice and very clear. Jos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090701/90e78490/attachment.htm From yinso.chen at gmail.com Wed Jul 1 17:23:16 2009 From: yinso.chen at gmail.com (YC) Date: Wed Jul 1 17:29:35 2009 Subject: [plt-scheme] ajax and plt Message-ID: <779bf2730907011423g60a652c5p85c2215e54cb9842@mail.gmail.com> Hi - I am wondering if anyone is working on the AJAX + PLT scheme problem space, including some or all but not limited to the following: 1. server-side vs client-side continuation 2. generating javascript from PLT scheme source 3. graceful degradation of interactivity within web browsers 4. integration with popular javascript frameworks such as jQuery, prototype, etc 5. already have a framework to be released... Please let me know if you are tackling these problems and would like to brainstorm, trade notes, etc. Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090701/ad777138/attachment.html From hsmyers at gmail.com Wed Jul 1 18:36:55 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Wed Jul 1 18:37:36 2009 Subject: [plt-scheme] pseudo statics In-Reply-To: References: <408995400907011046o5b2e2860y2d34867b2c5643e6@mail.gmail.com> Message-ID: <408995400907011536i3729c225o491bb4b9986c1c80@mail.gmail.com> Interesting reading, but not quite what I was asking about. If you execute counter it will return a value one greater each time. This was what I was asking about. I've need of a static variable and was looking for code that provides the equivalent... --hsm On Wed, Jul 1, 2009 at 11:53 AM, Matthias Felleisen wrote: > > HtDP, chapter VII (and VIII, and Intermezzo). > > > On Jul 1, 2009, at 1:46 PM, Hugh Myers wrote: > >> Somewhere is a discussion about code like: >> >> (define counter >> ? ?(let ((a 0)) >> ? ? ?(lambda () >> ? ? ? ?(set! a (+ 1 a)) >> ? ? ? ?a))) >> >> I just can't remember where! Anyone have any useful pointers or such? >> >> --hsm >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From matthias at ccs.neu.edu Wed Jul 1 18:52:07 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Jul 1 18:53:03 2009 Subject: [plt-scheme] pseudo statics In-Reply-To: <408995400907011536i3729c225o491bb4b9986c1c80@mail.gmail.com> References: <408995400907011046o5b2e2860y2d34867b2c5643e6@mail.gmail.com> <408995400907011536i3729c225o491bb4b9986c1c80@mail.gmail.com> Message-ID: <4CD206A5-32F7-45CD-9CFB-AFB635B9D1CE@ccs.neu.edu> You want to reason (formally) about such invariants? Take a look at POPL '06. There is a paper by Koutavas and Wand on just this point. On Jul 1, 2009, at 6:36 PM, Hugh Myers wrote: > Interesting reading, but not quite what I was asking about. If you > execute counter it will return a value one greater each time. This was > what I was asking about. I've need of a static variable and was > looking for code that provides the equivalent... > > --hsm > > > On Wed, Jul 1, 2009 at 11:53 AM, Matthias > Felleisen wrote: >> >> HtDP, chapter VII (and VIII, and Intermezzo). >> >> >> On Jul 1, 2009, at 1:46 PM, Hugh Myers wrote: >> >>> Somewhere is a discussion about code like: >>> >>> (define counter >>> (let ((a 0)) >>> (lambda () >>> (set! a (+ 1 a)) >>> a))) >>> >>> I just can't remember where! Anyone have any useful pointers or >>> such? >>> >>> --hsm >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> From jensaxel at soegaard.net Wed Jul 1 19:06:24 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Wed Jul 1 19:29:04 2009 Subject: [plt-scheme] pseudo statics In-Reply-To: <408995400907011046o5b2e2860y2d34867b2c5643e6@mail.gmail.com> References: <408995400907011046o5b2e2860y2d34867b2c5643e6@mail.gmail.com> Message-ID: <4072c51f0907011606u1f2502d8t4e09af6d50df6087@mail.gmail.com> Hi Hugh, 2009/7/1 Hugh Myers > Somewhere is a discussion about code like: > > (define counter > (let ((a 0)) > (lambda () > (set! a (+ 1 a)) > a))) > > I just can't remember where! Anyone have any useful pointers or such? Is this it? http://schemecookbook.org/Cookbook/IdiomSharingState -- Jens Axel S?gaard -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090702/748af935/attachment.htm From hsmyers at gmail.com Wed Jul 1 20:03:10 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Wed Jul 1 20:03:53 2009 Subject: [plt-scheme] pseudo statics In-Reply-To: <4072c51f0907011606u1f2502d8t4e09af6d50df6087@mail.gmail.com> References: <408995400907011046o5b2e2860y2d34867b2c5643e6@mail.gmail.com> <4072c51f0907011606u1f2502d8t4e09af6d50df6087@mail.gmail.com> Message-ID: <408995400907011703k14e2832diad52d31766029812@mail.gmail.com> Matthias, you mean Small bisimulations for reasoning about higher-order imperative programs? I can't find any versions except those I would have to pay for. Any others? Jens, looks even more interesting--- if a bit over my head. I was thinking this might be idiomatic and was wondering about initialization and resetting... --hsm On Wed, Jul 1, 2009 at 5:06 PM, Jens Axel S?gaard wrote: > Hi Hugh, > > 2009/7/1 Hugh Myers >> >> Somewhere is a discussion about code like: >> >> (define counter >> ? ?(let ((a 0)) >> ? ? ?(lambda () >> ? ? ? ?(set! a (+ 1 a)) >> ? ? ? ?a))) >> >> I just can't remember where! Anyone have any useful pointers or such? > > Is this it? > http://schemecookbook.org/Cookbook/IdiomSharingState > -- > Jens Axel S?gaard > From dvanhorn at ccs.neu.edu Wed Jul 1 20:06:27 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Wed Jul 1 20:07:35 2009 Subject: [plt-scheme] pseudo statics In-Reply-To: <408995400907011703k14e2832diad52d31766029812@mail.gmail.com> References: <408995400907011046o5b2e2860y2d34867b2c5643e6@mail.gmail.com> <4072c51f0907011606u1f2502d8t4e09af6d50df6087@mail.gmail.com> <408995400907011703k14e2832diad52d31766029812@mail.gmail.com> Message-ID: <4A4BFA03.2010108@ccs.neu.edu> Hugh Myers wrote: > Matthias, you mean Small bisimulations for reasoning about > higher-order imperative programs? I can't find any versions except > those I would have to pay for. Any others? ftp://ftp.ccs.neu.edu/pub/people/wand/papers/popl-06.pdf From hsmyers at gmail.com Wed Jul 1 20:08:26 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Wed Jul 1 20:09:09 2009 Subject: [plt-scheme] pseudo statics In-Reply-To: <4A4BFA03.2010108@ccs.neu.edu> References: <408995400907011046o5b2e2860y2d34867b2c5643e6@mail.gmail.com> <4072c51f0907011606u1f2502d8t4e09af6d50df6087@mail.gmail.com> <408995400907011703k14e2832diad52d31766029812@mail.gmail.com> <4A4BFA03.2010108@ccs.neu.edu> Message-ID: <408995400907011708h6312424erfbad4e2636791055@mail.gmail.com> Thanks David! --hsm On Wed, Jul 1, 2009 at 6:06 PM, David Van Horn wrote: > Hugh Myers wrote: >> >> Matthias, you mean Small bisimulations for reasoning about >> higher-order imperative programs? I can't find any versions except >> those I would have to pay for. Any others? > > ftp://ftp.ccs.neu.edu/pub/people/wand/papers/popl-06.pdf > > From hsmyers at gmail.com Wed Jul 1 20:09:12 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Wed Jul 1 20:09:53 2009 Subject: [plt-scheme] pseudo statics In-Reply-To: <408995400907011708h6312424erfbad4e2636791055@mail.gmail.com> References: <408995400907011046o5b2e2860y2d34867b2c5643e6@mail.gmail.com> <4072c51f0907011606u1f2502d8t4e09af6d50df6087@mail.gmail.com> <408995400907011703k14e2832diad52d31766029812@mail.gmail.com> <4A4BFA03.2010108@ccs.neu.edu> <408995400907011708h6312424erfbad4e2636791055@mail.gmail.com> Message-ID: <408995400907011709o2f499d40s8d2bb8f9c85bcdf1@mail.gmail.com> Looking further I found: http://schemecookbook.org/Cookbook/IdiomStaticVariables --hsm On Wed, Jul 1, 2009 at 6:08 PM, Hugh Myers wrote: > Thanks David! > > --hsm > > On Wed, Jul 1, 2009 at 6:06 PM, David Van Horn wrote: >> Hugh Myers wrote: >>> >>> Matthias, you mean Small bisimulations for reasoning about >>> higher-order imperative programs? I can't find any versions except >>> those I would have to pay for. Any others? >> >> ftp://ftp.ccs.neu.edu/pub/people/wand/papers/popl-06.pdf >> >> > From skeptic2000 at hotmail.com Wed Jul 1 20:17:04 2009 From: skeptic2000 at hotmail.com (Skeptic .) Date: Wed Jul 1 20:17:24 2009 Subject: [plt-scheme] define -> define-values in DrScheme Message-ID: Hi, With the macro-stepper, I noticed that #lang scheme (define f (¦Ë (x) (+ x 1))) turned into (module page scheme (#%module-begin (define-values (f) (lambda (x) (#%app + x (quote 1)))))) in DrScheme. Why define-values ? Thanks. _________________________________________________________________ Internet explorer 8 aide ¨¤ prot¨¦ger la vie priv¨¦e. http://go.microsoft.com/?linkid=9655573 From skeptic2000 at hotmail.com Wed Jul 1 20:17:51 2009 From: skeptic2000 at hotmail.com (Skeptic .) Date: Wed Jul 1 20:18:11 2009 Subject: [plt-scheme] RE: trace Message-ID: Nobody ? > To: plt-scheme@list.cs.brown.edu > Subject: trace > Date: Mon, 29 Jun 2009 11:59:19 -0400 > > > > Hi, > Has the legacy mzlib/trace been replaced by somehing else ? > Thanks _________________________________________________________________ Attention ? tous les Humains. Nous sommes vos photos. Lib?rez-nous de vos disques durs. http://go.microsoft.com/?linkid=9666050 From hsmyers at gmail.com Wed Jul 1 20:24:53 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Wed Jul 1 20:25:34 2009 Subject: [plt-scheme] pseudo statics In-Reply-To: <408995400907011709o2f499d40s8d2bb8f9c85bcdf1@mail.gmail.com> References: <408995400907011046o5b2e2860y2d34867b2c5643e6@mail.gmail.com> <4072c51f0907011606u1f2502d8t4e09af6d50df6087@mail.gmail.com> <408995400907011703k14e2832diad52d31766029812@mail.gmail.com> <4A4BFA03.2010108@ccs.neu.edu> <408995400907011708h6312424erfbad4e2636791055@mail.gmail.com> <408995400907011709o2f499d40s8d2bb8f9c85bcdf1@mail.gmail.com> Message-ID: <408995400907011724r7b4ab8bw4544fd851000ac43@mail.gmail.com> Yes! And I forgive myself for forgetting about things I only vaguely understood in 1985!! Which raises the question; should I buy the new edition or just re-read the first? --hsm On Wed, Jul 1, 2009 at 6:09 PM, Hugh Myers wrote: > Looking further I found: > > http://schemecookbook.org/Cookbook/IdiomStaticVariables > > --hsm > > On Wed, Jul 1, 2009 at 6:08 PM, Hugh Myers wrote: >> Thanks David! >> >> --hsm >> >> On Wed, Jul 1, 2009 at 6:06 PM, David Van Horn wrote: >>> Hugh Myers wrote: >>>> >>>> Matthias, you mean Small bisimulations for reasoning about >>>> higher-order imperative programs? I can't find any versions except >>>> those I would have to pay for. Any others? >>> >>> ftp://ftp.ccs.neu.edu/pub/people/wand/papers/popl-06.pdf >>> >>> >> > From matthias at ccs.neu.edu Wed Jul 1 20:48:03 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Jul 1 20:48:50 2009 Subject: [plt-scheme] define -> define-values in DrScheme In-Reply-To: References: Message-ID: <2187A788-C557-431C-BC83-2D5701598FBE@ccs.neu.edu> We just happened to pick define-values as the core form because it is =20= the more general one. On Jul 1, 2009, at 8:17 PM, Skeptic . wrote: > > > Hi, > With the macro-stepper, I noticed that > #lang scheme > (define f (=A6=CB (x) (+ x 1))) > turned into > (module page scheme (#%module-begin (define-values (f) =20 > (lambda (x) (#%app + x (quote 1)))))) > in DrScheme. > Why define-values ? > Thanks. > _________________________________________________________________ > Internet explorer 8 aide =A8=A4 prot=A8=A6ger la vie priv=A8=A6e. > http://go.microsoft.com/?linkid=3D9655573 > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From sk at cs.brown.edu Wed Jul 1 22:18:37 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Wed Jul 1 22:19:16 2009 Subject: [plt-scheme] ajax and plt In-Reply-To: <779bf2730907011423g60a652c5p85c2215e54cb9842@mail.gmail.com> References: <779bf2730907011423g60a652c5p85c2215e54cb9842@mail.gmail.com> Message-ID: We have a full, working compiler from Scheme to JavaScript for Beginner and Intermediate Scheme plus the World framework for interaction. The compiler is self-hosting. We are working on plugging the generated code into other contexts such as mashups. While the compiler is available, we aren't interested in supporting it right now, as we're integrating it into a much larger framework. We are targeting a preliminary release of the whole framework by the end of this summer, if not sooner. I'm happy to try to answer questions. Shriram From hsmyers at gmail.com Wed Jul 1 22:23:20 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Wed Jul 1 22:23:58 2009 Subject: [plt-scheme] static variable redux Message-ID: <408995400907011923x75df7c8frb254c123801e2d2e@mail.gmail.com> Here is what I came up with after wandering through a thicket of docs(thanks all!): > (define (make-counter [start 0]) ;; A re-setable counter. (define (next) (incf! start) start) (define (reset) (set! start 0)) (define (dispatch [m 'next]) (cond ((eq? m 'next) next) ((eq? m 'reset) reset) (else (error "unknown request in counter:" m)))) dispatch) > (define counter (make-counter)) > ((counter)) 1 > ((counter)) 2 > ((counter 'reset)) > ((counter)) 1 Oops, pardon the incf!--- a macro: (define-syntax incf! ;; stolen from CL (? (stx) (syntax-case stx () [(incf! n) (if (identifier? #'n) #'(set! n (+ 1 n)) (raise-syntax-error #f "not an identifier" stx #'n))]))) --hsm From jonstenerson at comcast.net Wed Jul 1 23:23:17 2009 From: jonstenerson at comcast.net (Jon Stenerson) Date: Wed Jul 1 23:27:56 2009 Subject: [plt-scheme] scribble/lp and modules Message-ID: <200907012123.17405.jonstenerson@comcast.net> I just started trying out the literate programming feature in scribble. Is there a way to put a module form in a @chunk. The following gives me an error "module: illegal use (not at top-level) ...." Jon #lang scribble/lp @chunk[
(module example-module scheme (provide foo bar) (define foo 2) (define (bar x) (+ x 1))) ] From robby at eecs.northwestern.edu Wed Jul 1 23:39:59 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Jul 1 23:40:21 2009 Subject: [plt-scheme] scribble/lp and modules In-Reply-To: <200907012123.17405.jonstenerson@comcast.net> References: <200907012123.17405.jonstenerson@comcast.net> Message-ID: <932b2f1f0907012039t59cb979dh2de8cd8b93168dcf@mail.gmail.com> No, I don't think that is possible, currently. The module form is dictated by the #lang scribble/lp line (it is scheme/base). Robby On Wed, Jul 1, 2009 at 10:23 PM, Jon Stenerson wrote: > I just started trying out the literate programming feature in scribble. Is > there a way to put a module form in a @chunk. The following gives me an > error "module: illegal use (not at top-level) ...." > > Jon > > #lang scribble/lp > > @chunk[
> ? (module example-module scheme > ? ? ?(provide foo bar) > ? ? ?(define foo 2) > ? ? ?(define (bar x) > ? ? ? ?(+ x 1))) > ] > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From hsmyers at gmail.com Thu Jul 2 01:41:03 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Thu Jul 2 01:41:48 2009 Subject: [plt-scheme] plugins? Message-ID: <408995400907012241p78729a80wf1d6111069098a7e@mail.gmail.com> Is there a descriptive list of plugins? --hsm From geoff at knauth.org Thu Jul 2 02:14:41 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Jul 2 02:15:02 2009 Subject: [plt-scheme] Systems Programming with PLT Scheme In-Reply-To: <16F8DAF57DFC49EA9BCAF94E7378577B@uw2b2dff239c4d> References: <16F8DAF57DFC49EA9BCAF94E7378577B@uw2b2dff239c4d> Message-ID: <955F8873-247D-4AB6-A155-FABF6BE69AA5@knauth.org> On Jul 1, 2009, at 16:42, Jos Koot wrote: > Unintentionally I came in "Systems Programming with PLT Scheme" by > Matthew Flatt in (http://docs.plt-scheme.org/more/). Although I have > no plans to implement a server, I could not resist to have a quick > look. Very nice and very clear. Thanks! This will come in handy in a networking class I'm teaching this fall. From noelwelsh at gmail.com Thu Jul 2 02:43:15 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Jul 2 02:43:34 2009 Subject: [plt-scheme] plugins? In-Reply-To: <408995400907012241p78729a80wf1d6111069098a7e@mail.gmail.com> References: <408995400907012241p78729a80wf1d6111069098a7e@mail.gmail.com> Message-ID: Not that I know of. N. On Thu, Jul 2, 2009 at 6:41 AM, Hugh Myers wrote: > Is there a descriptive list of plugins? > > --hsm From czhu at cs.utah.edu Thu Jul 2 03:13:54 2009 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Jul 2 03:14:22 2009 Subject: [plt-scheme] define -> define-values in DrScheme In-Reply-To: References: Message-ID: <4A4C5E32.3080405@cs.utah.edu> Setting "macro hiding" in the macro-stepper to be "standard" would not show these stuff, and probably will work better for you. Chongkai Skeptic . wrote: > Hi, > With the macro-stepper, I noticed that > #lang scheme > (define f (¦Ë (x) (+ x 1))) > turned into > (module page scheme (#%module-begin (define-values (f) (lambda (x) (#%app + x (quote 1)))))) > in DrScheme. > Why define-values ? > Thanks. > _________________________________________________________________ > Internet explorer 8 aide ¨¤ prot¨¦ger la vie priv¨¦e. > http://go.microsoft.com/?linkid=9655573 > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From spdegabrielle at gmail.com Thu Jul 2 03:21:25 2009 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Jul 2 03:27:45 2009 Subject: [plt-scheme] plugins? In-Reply-To: <408995400907012241p78729a80wf1d6111069098a7e@mail.gmail.com> References: <408995400907012241p78729a80wf1d6111069098a7e@mail.gmail.com> Message-ID: <595b9ab20907020021g66a053d8ib55433b89683963d@mail.gmail.com> Hi, The ones on planet have a description, but not a category of their own. HTH Stephen On Thu, Jul 2, 2009 at 6:41 AM, Hugh Myers wrote: > Is there a descriptive list of plugins? > > --hsm > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- -- Stephen De Gabrielle stephen.degabrielle@acm.org Telephone +44 (0)20 85670911 Mobile +44 (0)79 85189045 http://www.degabrielle.name/stephen From d.j.gurnell at gmail.com Thu Jul 2 04:19:47 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Jul 2 04:20:28 2009 Subject: [plt-scheme] ajax and plt In-Reply-To: <779bf2730907011423g60a652c5p85c2215e54cb9842@mail.gmail.com> References: <779bf2730907011423g60a652c5p85c2215e54cb9842@mail.gmail.com> Message-ID: <3F3B29CB-C7D3-45AE-8805-7DA3DC5C9CAE@gmail.com> Hi YC, There are two current, well documented ways of generating Javascript source using Scheme code: http://planet.plt-scheme.org/package-source/dherman/javascript.plt/9/2/planet-docs/javascript/index.html http://planet.plt-scheme.org/package-source/untyped/mirrors.plt/2/2/planet-docs/mirrors/index.html To my knowledge, neither of these libraries compile actual Scheme into Javascript, but they both have a parenthetic syntax for writing Javascript code. So, for example, in Mirrors you can do stuff like this: (js (alert ,(string-append "Hello " "world")) I use Mirrors with jQuery quite a lot; (js (!dot ($ "#mybutton") (click (function () (alert "Hi"))))) As a user of PLT in a commercial environment, I'd be more than happy to talk ideas/code/etc. Last note... AJAX and web frameworks... we *do* have a working framework, but it's basically undocumented. I'd welcome feedback/ comment/collaboration if you want to take a look (let me know if you have versioning problems when you compile it): $ svn co http://svn.untyped.com/smoke/trunk/src $ cd $ mzc run-tests.ss && mzscheme run-tests.ss Open http://localhost:8765 in your browser. Cheers, -- Dave > I am wondering if anyone is working on the AJAX + PLT scheme problem > space, including some or all but not limited to the following: > server-side vs client-side continuation > generating javascript from PLT scheme source > graceful degradation of interactivity within web browsers > integration with popular javascript frameworks such as jQuery, > prototype, etc > already have a framework to be released... > Please let me know if you are tackling these problems and would like > to brainstorm, trade notes, etc. > > Thanks, > yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090702/46824bed/attachment.html From hsmyers at gmail.com Thu Jul 2 04:22:11 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Thu Jul 2 04:23:10 2009 Subject: [plt-scheme] plugins? In-Reply-To: <595b9ab20907020021g66a053d8ib55433b89683963d@mail.gmail.com> References: <408995400907012241p78729a80wf1d6111069098a7e@mail.gmail.com> <595b9ab20907020021g66a053d8ib55433b89683963d@mail.gmail.com> Message-ID: <408995400907020122j1fc996b2k53a36d9808aad1f6@mail.gmail.com> I would settle for any kind of list at all. Didn't see anything about plugins on Planet at all which suggests I'm not looking in the right place. Anyone have a link? ---hsm On Thu, Jul 2, 2009 at 1:21 AM, Stephen De Gabrielle wrote: > Hi, > > The ones on planet have a description, but not a category of their own. > > HTH > > Stephen > > > > On Thu, Jul 2, 2009 at 6:41 AM, Hugh Myers wrote: >> Is there a descriptive list of plugins? >> >> --hsm >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > > -- > > -- > Stephen De Gabrielle > stephen.degabrielle@acm.org > Telephone +44 (0)20 85670911 > Mobile ? ? ? ?+44 (0)79 85189045 > http://www.degabrielle.name/stephen > From noelwelsh at gmail.com Thu Jul 2 04:29:20 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Jul 2 04:29:42 2009 Subject: [plt-scheme] plugins? In-Reply-To: <408995400907020122j1fc996b2k53a36d9808aad1f6@mail.gmail.com> References: <408995400907012241p78729a80wf1d6111069098a7e@mail.gmail.com> <595b9ab20907020021g66a053d8ib55433b89683963d@mail.gmail.com> <408995400907020122j1fc996b2k53a36d9808aad1f6@mail.gmail.com> Message-ID: The first category on Planet, Development Tools, is where I'd expect to find plugins. Anything with DrScheme in the description is probably a plugin. N. On Thu, Jul 2, 2009 at 9:22 AM, Hugh Myers wrote: > I would settle for any kind of list at all. Didn't see anything about > plugins on Planet at all which suggests I'm not looking in the right > place. Anyone have a link? > > ---hsm From hsmyers at gmail.com Thu Jul 2 04:43:10 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Thu Jul 2 04:43:47 2009 Subject: [plt-scheme] plugins? In-Reply-To: References: <408995400907012241p78729a80wf1d6111069098a7e@mail.gmail.com> <595b9ab20907020021g66a053d8ib55433b89683963d@mail.gmail.com> <408995400907020122j1fc996b2k53a36d9808aad1f6@mail.gmail.com> Message-ID: <408995400907020143y5de01a61qbdf6c7686e5a6026@mail.gmail.com> Then using that criteria, there are 4 'possible' plugins: divascheme.plt drocaml.plt drsync.plt ipt.plt Is there a reason not to distinguish between packages and plugins? --hsm On Thu, Jul 2, 2009 at 2:29 AM, Noel Welsh wrote: > The first category on Planet, Development Tools, is where I'd expect > to find plugins. Anything with DrScheme in the description is probably > a plugin. > > N. > > On Thu, Jul 2, 2009 at 9:22 AM, Hugh Myers wrote: >> I would settle for any kind of list at all. Didn't see anything about >> plugins on Planet at all which suggests I'm not looking in the right >> place. Anyone have a link? >> >> ---hsm > From zelah at inbox.com Thu Jul 2 05:00:13 2009 From: zelah at inbox.com (Zelah Hutchinson) Date: Thu Jul 2 04:58:28 2009 Subject: [plt-scheme] Defining a transformation time path, or setting module-language to something useful In-Reply-To: <19012.64159.710953.33989@winooski.ccs.neu.edu> References: <19010.20911.707614.704414@winooski.ccs.neu.edu> <19010.28526.365891.488410@winooski.ccs.neu.edu> Message-ID: <8C79737519E.00000191zelah@inbox.com> Hello, I believe the best temporary solution for my current problem is to use eval in the scheme/base language module from within the definitions window. I do not know if this is the unimplemented functionality that you have alluded to in the previous message re-listed below, but if it is I would like to know when it will be a part of a stable release. It is not an ideal solution for my problem because I could do better with macros, but I am still learning and this would be expedient for my purposes. Thanks, -Zelah > -----Original Message----- > From: eli@barzilay.org > Sent: Fri, 26 Jun 2009 12:43:11 -0400 > To: noelwelsh@gmail.com, plt-scheme@list.cs.brown.edu > Subject: Re: [plt-scheme] Defining a transformation time path, or setting > module-language to something useful > > On Jun 24, Eli Barzilay wrote: >> [...] >> But I see now that it doesn't work with "#lang at-exp scheme/base", >> and it should. I'll try to look into it soon. > > I forgot to send a followup on this -- the `at-exp' reader is still > written manually, not with `module/syntax-reader' -- since I didn't > get to implement languages that chain to other languages yet. > > Anyway, did you use any of this? > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://barzilay.org/ Maze is Life! > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jensaxel at soegaard.net Thu Jul 2 05:39:23 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Thu Jul 2 05:39:47 2009 Subject: [plt-scheme] pseudo statics In-Reply-To: <408995400907011709o2f499d40s8d2bb8f9c85bcdf1@mail.gmail.com> References: <408995400907011046o5b2e2860y2d34867b2c5643e6@mail.gmail.com> <4072c51f0907011606u1f2502d8t4e09af6d50df6087@mail.gmail.com> <408995400907011703k14e2832diad52d31766029812@mail.gmail.com> <4A4BFA03.2010108@ccs.neu.edu> <408995400907011708h6312424erfbad4e2636791055@mail.gmail.com> <408995400907011709o2f499d40s8d2bb8f9c85bcdf1@mail.gmail.com> Message-ID: <4072c51f0907020239m161d835ch6384c86f3f0354bc@mail.gmail.com> 2009/7/2 Hugh Myers > Looking further I found: > > http://schemecookbook.org/Cookbook/IdiomStaticVariables > This was what I thougt I sent, but I must have grabbed the link from the wrong tab. The technique used here and on the shared state page is the same though. In the case of shared state there is just more than one function in the scope of the outer variable(s). -- Jens Axel S?gaard -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090702/1624c984/attachment.htm From noelwelsh at gmail.com Thu Jul 2 05:46:52 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Jul 2 05:47:14 2009 Subject: [plt-scheme] Defining a transformation time path, or setting module-language to something useful In-Reply-To: <8C79737519E.00000191zelah@inbox.com> References: <19010.20911.707614.704414@winooski.ccs.neu.edu> <19010.28526.365891.488410@winooski.ccs.neu.edu> <19012.64159.710953.33989@winooski.ccs.neu.edu> <8C79737519E.00000191zelah@inbox.com> Message-ID: This thread is about a different issue. PLT allows the programmer to define their own languages, and we're discussing a utility used to implement languages. For eval I suggest reading this part of the docs: http://docs.plt-scheme.org/guide/eval.html And in particular section 15.1.2 Namespaces N. On Thu, Jul 2, 2009 at 10:00 AM, Zelah Hutchinson wrote: > Hello, > > I believe the best temporary solution for my current problem is to use eval in the scheme/base language module from within the definitions window. I do not know if this is the unimplemented functionality that you have alluded to in the previous message re-listed below From egarrulo at gmail.com Thu Jul 2 05:53:50 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Thu Jul 2 05:54:09 2009 Subject: [plt-scheme] "unwind-protect" for PLT Scheme? Message-ID: <9bd8a08a0907020253s197833efq90e3402f39f44c4f@mail.gmail.com> Hello, what is the equivalent as "unwind-protect" in PLT Scheme? Thanks From noelwelsh at gmail.com Thu Jul 2 05:55:34 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Jul 2 05:55:52 2009 Subject: [plt-scheme] "unwind-protect" for PLT Scheme? In-Reply-To: <9bd8a08a0907020253s197833efq90e3402f39f44c4f@mail.gmail.com> References: <9bd8a08a0907020253s197833efq90e3402f39f44c4f@mail.gmail.com> Message-ID: dynamic-wind On Thu, Jul 2, 2009 at 10:53 AM, Elena Garrulo wrote: > Hello, > > what is the equivalent as "unwind-protect" in PLT Scheme? From carl.eastlund at gmail.com Thu Jul 2 07:08:44 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Thu Jul 2 07:15:24 2009 Subject: [plt-scheme] plugins? In-Reply-To: <408995400907020143y5de01a61qbdf6c7686e5a6026@mail.gmail.com> References: <408995400907012241p78729a80wf1d6111069098a7e@mail.gmail.com> <595b9ab20907020021g66a053d8ib55433b89683963d@mail.gmail.com> <408995400907020122j1fc996b2k53a36d9808aad1f6@mail.gmail.com> <408995400907020143y5de01a61qbdf6c7686e5a6026@mail.gmail.com> Message-ID: <990e0c030907020408j7b8c629ah4f572a9e685d8b19@mail.gmail.com> On Thu, Jul 2, 2009 at 4:43 AM, Hugh Myers wrote: > Then using that criteria, there are 4 'possible' plugins: > > divascheme.plt > drocaml.plt > drsync.plt > ipt.plt > > Is there a reason not to distinguish between packages and plugins? To add one more example, Dracula (cce / dracula.plt) is a plugin. There's no way to "distinguish" them because they're not different things... they're just packages that run different code. Some packages may even contain multiple "plugins". Being able to tell what code a package runs is not easy. --Carl From egarrulo at gmail.com Thu Jul 2 08:31:23 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Thu Jul 2 08:31:44 2009 Subject: [plt-scheme] Using FFI with complex structures and input/output parameters? In-Reply-To: <9bd8a08a0907020104s1f9cee76u7066988f36b1d09e@mail.gmail.com> References: <9bd8a08a0906300541x76ffb2e1ka137221f13745fdd@mail.gmail.com> <9bd8a08a0907010732w1c3c1272nfb77ec10b9511a44@mail.gmail.com> <19019.29785.367388.905047@winooski.ccs.neu.edu> <9bd8a08a0907010800p79eaca4n56ecd95522ae20ea@mail.gmail.com> <19019.50252.568293.285053@winooski.ccs.neu.edu> <9bd8a08a0907011345g7488bb21l320f8051bbe09eee@mail.gmail.com> <19019.52159.260117.669939@winooski.ccs.neu.edu> <9bd8a08a0907011358y71095021xfb5ff7e88f2c4c93@mail.gmail.com> <19020.3874.108948.979960@winooski.ccs.neu.edu> <9bd8a08a0907020104s1f9cee76u7066988f36b1d09e@mail.gmail.com> Message-ID: <9bd8a08a0907020531j1a6e11e0w75448adeceff198b@mail.gmail.com> Well, I finally nailed it down. It would look like this (code shrinked down from major example, not tested!) : ;; void fill_buffer (BYTE* buffer, DWORD* buffer_size); (define fill_buffer (get-ffi-obj "fill_buffer" my_dll (_fun (buffer : _pointer) (buffer_size : ((_ptr io _DWORD))) -> _void -> (list buffer_size)))) ;; <- OUTPUT? Which you would call like this: (define buffer_size 1000) ;; Pick your buffer size. ;; Buffer allocation. (define buffer (malloc _byte (* buffer_size (ctype-sizeof _byte)))) ;; call "fill_buffer" and retrieve size of result. (set! buffer_size (car (fill_buffer buffer buffer_size))) ;; resize buffer accordingly (set! buffer (cblock->vector buffer _byte buffer_size)) ;; remember to (free buffer) when you're done. Thanks to Eli for his suggestions. From egarrulo at gmail.com Thu Jul 2 09:16:12 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Thu Jul 2 09:16:34 2009 Subject: [plt-scheme] How do I disable automatic insertion of closing parenthesis? Message-ID: <9bd8a08a0907020616q532b1b6cg6d2184368b838ab7@mail.gmail.com> Hello, how can I disable automatic insertion of closing parenthesis when I type an opening one in DrScheme? I couldn't find any related option into Preferences. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090702/33348af2/attachment.html From grettke at acm.org Thu Jul 2 10:15:18 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Jul 2 10:15:37 2009 Subject: [plt-scheme] How do I disable automatic insertion of closing parenthesis? In-Reply-To: <9bd8a08a0907020616q532b1b6cg6d2184368b838ab7@mail.gmail.com> References: <9bd8a08a0907020616q532b1b6cg6d2184368b838ab7@mail.gmail.com> Message-ID: <756daca50907020715g8a869a3u8a356a63c3d715d3@mail.gmail.com> On Thu, Jul 2, 2009 at 8:16 AM, Elena Garrulo wrote: > how can I disable automatic insertion of closing parenthesis when I type an > opening one? in DrScheme? I couldn't find any related option into > Preferences. Do you mean when you type an opening round bracket and then type a closing square bracket and it inserts a closing round bracket? There is an existing binding that would give you what you want, it is called "non-clever-close..." c:} c:) c:] From grettke at acm.org Thu Jul 2 10:22:52 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Jul 2 10:23:12 2009 Subject: [plt-scheme] plugins? In-Reply-To: <990e0c030907020408j7b8c629ah4f572a9e685d8b19@mail.gmail.com> References: <408995400907012241p78729a80wf1d6111069098a7e@mail.gmail.com> <595b9ab20907020021g66a053d8ib55433b89683963d@mail.gmail.com> <408995400907020122j1fc996b2k53a36d9808aad1f6@mail.gmail.com> <408995400907020143y5de01a61qbdf6c7686e5a6026@mail.gmail.com> <990e0c030907020408j7b8c629ah4f572a9e685d8b19@mail.gmail.com> Message-ID: <756daca50907020722w5b5342a7y9e34e3a7faa49012@mail.gmail.com> On Thu, Jul 2, 2009 at 6:08 AM, Carl Eastlund wrote: > To add one more example, Dracula (cce / dracula.plt) is a plugin. > There's no way to "distinguish" them because they're not different > things... they're just packages that run different code. ?Some > packages may even contain multiple "plugins". ?Being able to tell what > code a package runs is not easy. A plugin category might be worthwhile. It communicates the intent better than development tool. From grettke at acm.org Thu Jul 2 10:37:15 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Jul 2 10:37:35 2009 Subject: [plt-scheme] static variable redux In-Reply-To: <408995400907011923x75df7c8frb254c123801e2d2e@mail.gmail.com> References: <408995400907011923x75df7c8frb254c123801e2d2e@mail.gmail.com> Message-ID: <756daca50907020737y62fb2bc9n68f4e2c01caf39f6@mail.gmail.com> 2009/7/1 Hugh Myers : > Here is what I came up with after wandering through a thicket of > docs(thanks all!): You might call your functions immediately to avoid the need to do so when calling the counter: ((eq? m 'next) (next)) ((eq? m 'reset) (reset)) From grettke at acm.org Thu Jul 2 10:54:00 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Jul 2 10:54:19 2009 Subject: [plt-scheme] How to execute eval from a network udp socket? In-Reply-To: <19019.51226.153040.666179@winooski.ccs.neu.edu> References: <756daca50906300722m62f0a443t13c3910cc26fb49a@mail.gmail.com> <6AFB6443-6813-46F1-AFAC-DA95418B75BE@mac.com> <756daca50907010850h16d85396u1ab62142aa792be0@mail.gmail.com> <19019.51226.153040.666179@winooski.ccs.neu.edu> Message-ID: <756daca50907020754k6ce7820brd37878080192c182@mail.gmail.com> On Wed, Jul 1, 2009 at 3:33 PM, Eli Barzilay wrote: > On Jul ?1, Grant Rettke wrote: >> Namespaces are nicer if you want to control your environment, disallow >> 'exit' for example in the server code. > > No, that's a bad advice for getting "security". ?It's one of *many* > different ways to kill scheme (for example, you could.. Come on Eli I wasn't suggesting that removing 'exit' was an exhaustive solution. Is namespace the wrong place to address the concerns you listed? From hendrik at topoi.pooq.com Thu Jul 2 10:49:15 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Thu Jul 2 10:57:44 2009 Subject: [plt-scheme] Functional Abstraction in Java In-Reply-To: <90FC548E-3CFB-4A41-B8CF-EEC3973FB693@ccs.neu.edu> References: <932b2f1f0907011032r31155737ob7db7a6d39c37d82@mail.gmail.com> <5173D0D6-489C-47EA-B02E-1D1AEE7918B9@ccs.neu.edu> <932b2f1f0907011117h2bf0f302qa6b904151062811@mail.gmail.com> <9ACE63B4-926E-492F-BA7D-56C21B8C4EE7@ccs.neu.edu> <932b2f1f0907011131m1b5692ma21dbd24159befa5@mail.gmail.com> <90FC548E-3CFB-4A41-B8CF-EEC3973FB693@ccs.neu.edu> Message-ID: <20090702144915.GA21089@topoi.pooq.com> On Wed, Jul 01, 2009 at 02:45:01PM -0400, Matthias Felleisen wrote: > > I think an OO method should involve 'this'. If it doesn't, it's a > function. In this spirit, the command pattern for these abstractions ^^^^ AHA! This post is a method, not a function! (And this ambiguity about 'this' is why I use "self' instead of 'this' -- when I get the chance.) -- hendrik > usually introduces functions -- though FP people know how to create > true closures with this, too. > > > > > > On Jul 1, 2009, at 2:31 PM, Robby Findler wrote: > > >Ha! :) > > > >In reality, I'm not sure I know what the spirit of OOP really is, > >except that it must contain a heavy dose of FP (given Kay's comments), > >so passing around what are really little functions should be at least > >close. > > > >Robby > > > >On Wed, Jul 1, 2009 at 1:27 PM, Matthias > >Felleisen wrote: > >> > >>Ah, I agree with you actually, which is why I weasled in the > >>letter "L" into > >>my sentence. And HtCH says so! > >> > >> > >> > >> > >>On Jul 1, 2009, at 2:17 PM, Robby Findler wrote: > >> > >>>On Wed, Jul 1, 2009 at 1:01 PM, Matthias > >>>Felleisen > >>>wrote: > >>>> > >>>>I consider both solutions in the spirit of OOPLs. -- Matthias > >>> > >>>Sorry -- didn't mean to imply that one wasn't in the spirit of OOP; > >>>bad wording choice on my part. > >>> > >>>Robby > >> > >> > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From hendrik at topoi.pooq.com Thu Jul 2 10:51:43 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Thu Jul 2 11:00:10 2009 Subject: [plt-scheme] Functional Abstraction in Java In-Reply-To: <20090702144915.GA21089@topoi.pooq.com> References: <932b2f1f0907011032r31155737ob7db7a6d39c37d82@mail.gmail.com> <5173D0D6-489C-47EA-B02E-1D1AEE7918B9@ccs.neu.edu> <932b2f1f0907011117h2bf0f302qa6b904151062811@mail.gmail.com> <9ACE63B4-926E-492F-BA7D-56C21B8C4EE7@ccs.neu.edu> <932b2f1f0907011131m1b5692ma21dbd24159befa5@mail.gmail.com> <90FC548E-3CFB-4A41-B8CF-EEC3973FB693@ccs.neu.edu> <20090702144915.GA21089@topoi.pooq.com> Message-ID: <20090702145143.GB21089@topoi.pooq.com> On Thu, Jul 02, 2009 at 10:49:15AM -0400, hendrik@topoi.pooq.com wrote: > On Wed, Jul 01, 2009 at 02:45:01PM -0400, Matthias Felleisen wrote: > > > > I think an OO method should involve 'this'. If it doesn't, it's a > > function. In this spirit, the command pattern for these abstractions > ^^^^ > > AHA! This post is a method, not a function! > > (And this ambiguity about 'this' is why I use "self' instead of 'this' > -- when I get the chance.) Contrast with > (And self ambiguity about 'self' is why I use "this' instead of 'self' > -- when I don't get the chance.) I seem to be feeling rather silly today. -- hendrik From egarrulo at gmail.com Thu Jul 2 11:12:32 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Thu Jul 2 11:12:56 2009 Subject: [plt-scheme] How do I disable automatic insertion of closing parenthesis? In-Reply-To: <756daca50907020715g8a869a3u8a356a63c3d715d3@mail.gmail.com> References: <9bd8a08a0907020616q532b1b6cg6d2184368b838ab7@mail.gmail.com> <756daca50907020715g8a869a3u8a356a63c3d715d3@mail.gmail.com> Message-ID: <9bd8a08a0907020812j3f513c67g70668627279b1f27@mail.gmail.com> 2009/7/2 Grant Rettke > On Thu, Jul 2, 2009 at 8:16 AM, Elena Garrulo wrote: > > how can I disable automatic insertion of closing parenthesis when I type > an > > opening one in DrScheme? I couldn't find any related option into > > Preferences. > > Do you mean when you type an opening round bracket and then type a > closing square bracket and it inserts a closing round bracket? > > There is an existing binding that would give you what you want, it is > called "non-clever-close..." > > c:} > c:) > c:] > Those combos get same results (I think that's because of my remapped keyboard). I mean whenever I type an opening parenthesis it always inserts a closing parenthesis too. I understand it is a global keybinding. Is there a way to disable predefined keybindings? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090702/5483f450/attachment.htm From carl.eastlund at gmail.com Thu Jul 2 11:20:38 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Thu Jul 2 11:21:36 2009 Subject: [plt-scheme] plugins? In-Reply-To: <756daca50907020722w5b5342a7y9e34e3a7faa49012@mail.gmail.com> References: <408995400907012241p78729a80wf1d6111069098a7e@mail.gmail.com> <595b9ab20907020021g66a053d8ib55433b89683963d@mail.gmail.com> <408995400907020122j1fc996b2k53a36d9808aad1f6@mail.gmail.com> <408995400907020143y5de01a61qbdf6c7686e5a6026@mail.gmail.com> <990e0c030907020408j7b8c629ah4f572a9e685d8b19@mail.gmail.com> <756daca50907020722w5b5342a7y9e34e3a7faa49012@mail.gmail.com> Message-ID: <990e0c030907020820t2091cd14lc5395af8d2811f64@mail.gmail.com> On Thu, Jul 2, 2009 at 10:22 AM, Grant Rettke wrote: > On Thu, Jul 2, 2009 at 6:08 AM, Carl Eastlund wrote: >> To add one more example, Dracula (cce / dracula.plt) is a plugin. >> There's no way to "distinguish" them because they're not different >> things... they're just packages that run different code. ?Some >> packages may even contain multiple "plugins". ?Being able to tell what >> code a package runs is not easy. > > A plugin category might be worthwhile. It communicates the intent > better than development tool. I spoke too quickly. It is statically determinable whether a package (or any collection in the PLT Scheme sense) contains a plugin. The info.ss files give this information. It would be a useful category. I'm not sure whether it's best left as a developer-specified category, though, or an automatically determined one. I don't know that Planet really needs to be running code analysis. --Carl From egarrulo at gmail.com Thu Jul 2 11:21:16 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Thu Jul 2 11:21:42 2009 Subject: [plt-scheme] FFI: manual release of "vector->cblock"? Message-ID: <9bd8a08a0907020821t700c53capad8f6affff615b19@mail.gmail.com> Hello, do I have to call "free" on the result of "vector->cblock" like I do on the result of "malloc"? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090702/5f4065e2/attachment.html From robby at eecs.northwestern.edu Thu Jul 2 11:34:37 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Jul 2 11:34:58 2009 Subject: [plt-scheme] How do I disable automatic insertion of closing parenthesis? In-Reply-To: <9bd8a08a0907020812j3f513c67g70668627279b1f27@mail.gmail.com> References: <9bd8a08a0907020616q532b1b6cg6d2184368b838ab7@mail.gmail.com> <756daca50907020715g8a869a3u8a356a63c3d715d3@mail.gmail.com> <9bd8a08a0907020812j3f513c67g70668627279b1f27@mail.gmail.com> Message-ID: <932b2f1f0907020834t39917c9y92e8063c381a0de2@mail.gmail.com> I think the best fix is probably to get your remapped keyboard working properly, at a lower level. I'm sorry I've not had time to try to figure out a next step. Robby On Thu, Jul 2, 2009 at 10:12 AM, Elena Garrulo wrote: > 2009/7/2 Grant Rettke >> >> On Thu, Jul 2, 2009 at 8:16 AM, Elena Garrulo wrote: >> > how can I disable automatic insertion of closing parenthesis when I type >> > an >> > opening one? in DrScheme? I couldn't find any related option into >> > Preferences. >> >> Do you mean when you type an opening round bracket and then type a >> closing square bracket and it inserts a closing round bracket? >> >> There is an existing binding that would give you what you want, it is >> called "non-clever-close..." >> >> c:} >> c:) >> c:] > > Those combos get same results (I think that's because of my remapped > keyboard). > > I mean whenever I type an opening parenthesis it always inserts a closing > parenthesis too. I understand it is a global keybinding. > > Is there a way to disable predefined keybindings? > > Thanks > > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From eli at barzilay.org Thu Jul 2 11:48:20 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Jul 2 11:48:41 2009 Subject: [plt-scheme] FFI: manual release of "vector->cblock"? In-Reply-To: <9bd8a08a0907020821t700c53capad8f6affff615b19@mail.gmail.com> References: <9bd8a08a0907020821t700c53capad8f6affff615b19@mail.gmail.com> Message-ID: <19020.54980.531400.405910@winooski.ccs.neu.edu> On Jul 2, Elena Garrulo wrote: > Hello, > > do I have to call "free" on the result of "vector->cblock" It uses `malloc', so the answer is the same. > like I do on the result of "malloc"? You don't need to `free' memory blocks made with `malloc' by default, since it allocates the blocks using the GC. You only need to use `free' when allocating in 'raw mode which uses the C malloc() call. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From eli at barzilay.org Thu Jul 2 11:49:15 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Jul 2 11:49:40 2009 Subject: [plt-scheme] How to execute eval from a network udp socket? In-Reply-To: <756daca50907020754k6ce7820brd37878080192c182@mail.gmail.com> References: <756daca50906300722m62f0a443t13c3910cc26fb49a@mail.gmail.com> <6AFB6443-6813-46F1-AFAC-DA95418B75BE@mac.com> <756daca50907010850h16d85396u1ab62142aa792be0@mail.gmail.com> <19019.51226.153040.666179@winooski.ccs.neu.edu> <756daca50907020754k6ce7820brd37878080192c182@mail.gmail.com> Message-ID: <19020.55035.634432.725263@winooski.ccs.neu.edu> On Jul 2, Grant Rettke wrote: > On Wed, Jul 1, 2009 at 3:33 PM, Eli Barzilay wrote: > > On Jul ?1, Grant Rettke wrote: > >> Namespaces are nicer if you want to control your environment, > >> disallow 'exit' for example in the server code. > > > > No, that's a bad advice for getting "security". ?It's one of > > *many* different ways to kill scheme (for example, you could.. > > Come on Eli I wasn't suggesting that removing 'exit' was an > exhaustive solution. > > Is namespace the wrong place to address the concerns you listed? Yes, that was my point -- trying to get security through a limited namespace is a bad idea. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From phi500ac at yahoo.ca Thu Jul 2 11:39:13 2009 From: phi500ac at yahoo.ca (Philippos Apolinarius) Date: Thu Jul 2 11:52:53 2009 Subject: [plt-scheme] Has PLT performance improved? Message-ID: <380457.68243.qm@web58802.mail.re1.yahoo.com> Three years ago, when I was taking an AP course in Logan High, I devised a few benchmarks to compare Scheme with my favorite language, which is Clean. Then I decided to compare Scheme implementations. I discovered that PLT was much slower than, for instance, Bigloo or Stalin. I store the fact that PLT is slow somewhere in the back of my brain, and whenever I need to code something in Scheme or Lisp, I rule out PLT. Yesterday, I received a request to compare PLT with Bigloo, Larceny, SBCL and Gambit. Therefore I fetched my old benchmarks. To my surprise, PLT 4.2 turned out to be quite fast. In some cases, it was slightly faster than Bigloo compiled with -Obench option, and 30% faster than Gambit or Larceny. In the worst case, it was only three times slower than Bigloo. In most case, it was 30% slower than Bigloo. Let us consider the neural network benchmark. Bigloo runs it in 1.3 seconds in a Pentium quadricore, Windows XP. PLT runs it in 1.15 s. The benchmark has vectors and a lot of floating point calculations. What amazes me is that PLT accepted it as is, i.e., I did not use special vectors (like f64vectors), not compile options (like -Obench, -farithmetics, -copt -O3).? The neural net benchmark is attached to this email, so you people can check my claims. I would like to know what happened to PLT. Did its performance improve a lot since 2005? How can it compile floating point operations so well without any type declaration, or without special operators like *fl, /fl, etc? I noticed also that PLT is not so good at array intensive computations. In one of those Lisp benchmarks designed to show that Lisp can be as fast as C, PLT (7.9s, without f64vector) is twice as much time as Bigloo (4.3s, without f64vector). Does PLT team intends to improve array processing? (module pnet scheme ? #| Given a vector to store the weights, and a ?? list ws of indexes, newn builds a neuron. E.g. ?? (let [ (v '#(0 0 0 0)) ] ????? (newn v '(0 1 2))) ?? produces a two input neuron that uses v[0], ?? v[1] and v[2] to store its weights. |# (define (sig x) (/ 1.0 (+ 1.0 (exp (- x))) )) (define (newn v ws) ?? (lambda(xs) ???? (sig (let sum ( (i ws) (x (cons 1.0 xs)) (acc 0.0)) ????????????? (if (or (null? i) (null? x)) acc ????????????????? (sum (cdr i) (cdr x) ????????????????????? (+?? (* (vector-ref v (car i) ) ???????????????????????????? (car x))? acc)) ????????????? ) ??????????? ) ????? ) ??? ) ) ;; Given a vector vt, (prt vt) creates ;; a neuron network that can learn to act ;; like a logical port. (define in-1 car) (define in-2 cadr) (define (gate vt) ?(let ( (n1 (newn vt '(4 5 6)) ) ??????? (ns (newn vt '(0 1 2 3)))? ) ???? (lambda (i) ?????? (if (null? i) vt ????????? (ns (list (in-1 i) ??????????????????? (n1 (list (in-1 i) (in-2 i))) ??????????????????? (in-2 i)? )))?? ))) ;; Here is how to create a xor neural network: ;;(define xor (gate (vector -4 -7 14 -7 -3 8 8))) (define xor (gate (vector 2 3 0 3 5 1 8))) (define dx 0.01) (define lc 0.5) (define *nuweights*? (make-vector 90)? ) (define *examples* #f) (define (assertWgt vt I R) ?? (vector-set! vt I R)?? R) (define (egratia eg) ?? (vector-ref *examples* ???? (min eg (- (vector-length *examples*) 1)) ))?? ?????????? (define (setWeights vt Qs) ??? (do ( (i 0 (+ i 1)) ) ??????? ( (>= i (vector-length vt)) vt) ????? (vector-set! vt i ???????? (vector-ref Qs i))?? )) ???????? (define (errSum prt Exs) ? (let sum ( (e Exs)? (acc 0.0)) ???? (if (null? e) acc ???????? (let* ( (eg (egratia (car e))) ???????????????? (vc (prt (cdr eg))) ???????????????? (v (car eg)) ) ???????????? (sum (cdr e) (+ acc (* (- vc v) (- vc v)) ) ) ???????? ) ????? ) ? ) ) (define (updateWeights prt vt err0? ns Exs) ? (do ( (i 0 (+ i 1)) )? ((> i ns)) ??? (let* (? (v (vector-ref vt i)) ??????????? (v1 (assertWgt vt i? (+ v dx))) ??????????? (nerr (errSum prt Exs)) ??????????? (nv (+ v (/ (* lc (- err0 nerr)) dx) )? ) ) ????????? (assertWgt vt i v) ????????? (vector-set! *nuweights* i nv) ) ) ???????? (setWeights vt *nuweights*) ) (define (train p exs)?? ?? (set! *examples* exs ) ?? (set! *nuweights* (make-vector 90)) ?? (setWeights? (p '()) '#(0 1 0 0 2 0 0)) ?? (do ( (vt (p '())) ???????? (exs '(0 1 2 3 3 2 1 0)) ) ????? ( (< (errSum p exs) 0.001) ) ????? (updateWeights p vt (errSum p exs) ??????????????????????? (- (vector-length vt) 1) exs)? ) ) (define *exs* ?? '#( (0 1 1) (1 0 1) (1 1 0) (0 0 0)) ) (define (start? args) ?? (time (train xor *exs*)) ?? (display (list "1-1=" (xor '(1 1)))) ?? (newline) ?? (display (list "1-0=" (xor '(1 0)))) ?? (newline) ?? (display (list "0-1=" (xor '(0 1)))) ?? (newline) ?? (display (list "0-0=" (xor '(0 0)))) ?? (newline) ) (start 0) ) ;;(training xor '( (0 1 1) (1 1 0) (1 0 1) (0 0 0)) ) ? __________________________________________________________________ Make your browsing faster, safer, and easier with the new Internet Explorer? 8. Optimized for Yahoo! Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090702/27b2ef35/attachment.htm From robby at eecs.northwestern.edu Thu Jul 2 11:55:31 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Jul 2 11:55:53 2009 Subject: [plt-scheme] Has PLT performance improved? In-Reply-To: <380457.68243.qm@web58802.mail.re1.yahoo.com> References: <380457.68243.qm@web58802.mail.re1.yahoo.com> Message-ID: <932b2f1f0907020855l371d7ffbk38d850971370eae1@mail.gmail.com> We have a new GC and a JIT compiler in roughly that timeframe. (thanks, Matthew!). As far as future things go, I don't think that there are any plans at the moment, but you never know. Robby On Thu, Jul 2, 2009 at 10:39 AM, Philippos Apolinarius wrote: > Three years ago, when I was taking an AP course in Logan High, I devised a > few benchmarks to compare Scheme with my favorite language, which is Clean. > Then I decided to compare Scheme implementations. I discovered that PLT was > much slower than, for instance, Bigloo or Stalin. I store the fact that PLT > is slow somewhere in the back of my brain, and whenever I need to code > something in Scheme or Lisp, I rule out PLT. > > Yesterday, I received a request to compare PLT with Bigloo, Larceny, SBCL > and Gambit. Therefore I fetched my old benchmarks. To my surprise, PLT 4.2 > turned out to be quite fast. In some cases, it was slightly faster than > Bigloo compiled with -Obench option, and 30% faster than Gambit or Larceny. > In the worst case, it was only three times slower than Bigloo. In most case, > it was 30% slower than Bigloo. > > Let us consider the neural network benchmark. Bigloo runs it in 1.3 seconds > in a Pentium quadricore, Windows XP. PLT runs it in 1.15 s. The benchmark > has vectors and a lot of floating point calculations. What amazes me is that > PLT accepted it as is, i.e., I did not use special vectors (like > f64vectors), not compile options (like -Obench, -farithmetics, -copt -O3). > The neural net benchmark is attached to this email, so you people can check > my claims. > > I would like to know what happened to PLT. Did its performance improve a lot > since 2005? How can it compile floating point operations so well without any > type declaration, or without special operators like *fl, /fl, etc? > > I noticed also that PLT is not so good at array intensive computations. In > one of those Lisp benchmarks designed to show that Lisp can be as fast as C, > PLT (7.9s, without f64vector) is twice as much time as Bigloo (4.3s, without > f64vector).. Does PLT team intends to improve array processing? > > > > > (module pnet scheme > > #| Given a vector to store the weights, and a > ?? list ws of indexes, newn builds a neuron. E.g. > ?? (let [ (v '#(0 0 0 0)) ] > ????? (newn v '(0 1 2))) > ?? produces a two input neuron that uses v[0], > ?? v[1] and v[2] to store its weights. |# > > > (define (sig x) (/ 1.0 (+ 1.0 (exp (- x))) )) > > > (define (newn v ws) > ?? (lambda(xs) > ???? (sig (let sum ( (i ws) (x (cons 1.0 xs)) (acc 0.0)) > ????????????? (if (or (null? i) (null? x)) acc > ????????????????? (sum (cdr i) (cdr x) > ????????????????????? (+?? (* (vector-ref v (car i) ) > ???????????????????????????? (car x))? acc)) > ????????????? ) > ??????????? ) > ????? ) > ??? ) > ) > > > ;; Given a vector vt, (prt vt) creates > ;; a neuron network that can learn to act > ;; like a logical port. > > (define in-1 car) > (define in-2 cadr) > > (define (gate vt) > ?(let ( (n1 (newn vt '(4 5 6)) ) > ??????? (ns (newn vt '(0 1 2 3)))? ) > ???? (lambda (i) > ?????? (if (null? i) vt > ????????? (ns (list (in-1 i) > ??????????????????? (n1 (list (in-1 i) (in-2 i))) > ??????????????????? (in-2 i)? )))?? ))) > > ;; Here is how to create a xor neural network: > > ;;(define xor (gate (vector -4 -7 14 -7 -3 8 8))) > > (define xor (gate (vector 2 3 0 3 5 1 8))) > > (define dx 0.01) > (define lc 0.5) > > (define *nuweights*? (make-vector 90)? ) > (define *examples* #f) > > (define (assertWgt vt I R) > ?? (vector-set! vt I R)?? R) > > (define (egratia eg) > ?? (vector-ref *examples* > ???? (min eg (- (vector-length *examples*) 1)) )) > > (define (setWeights vt Qs) > ??? (do ( (i 0 (+ i 1)) ) > ??????? ( (>= i (vector-length vt)) vt) > ????? (vector-set! vt i > ???????? (vector-ref Qs i))?? )) > > (define (errSum prt Exs) > ? (let sum ( (e Exs)? (acc 0.0)) > ???? (if (null? e) acc > ???????? (let* ( (eg (egratia (car e))) > ???????????????? (vc (prt (cdr eg))) > ???????????????? (v (car eg)) ) > ???????????? (sum (cdr e) (+ acc (* (- vc v) (- vc v)) ) ) > ???????? ) > ????? ) > ? ) > ) > > > (define (updateWeights prt vt err0? ns Exs) > ? (do ( (i 0 (+ i 1)) )? ((> i ns)) > ??? (let* (? (v (vector-ref vt i)) > ??????????? (v1 (assertWgt vt i? (+ v dx))) > ??????????? (nerr (errSum prt Exs)) > ??????????? (nv (+ v (/ (* lc (- err0 nerr)) dx) )? ) ) > ????????? (assertWgt vt i v) > ????????? (vector-set! *nuweights* i nv) ) ) > ???????? (setWeights vt *nuweights*) ) > > > (define (train p exs) > ?? (set! *examples* exs ) > ?? (set! *nuweights* (make-vector 90)) > ?? (setWeights? (p '()) '#(0 1 0 0 2 0 0)) > ?? (do ( (vt (p '())) > ???????? (exs '(0 1 2 3 3 2 1 0)) ) > ????? ( (< (errSum p exs) 0.001) ) > ????? (updateWeights p vt (errSum p exs) > ??????????????????????? (- (vector-length vt) 1) exs)? ) ) > > (define *exs* > ?? '#( (0 1 1) (1 0 1) (1 1 0) (0 0 0)) ) > > (define (start? args) > ?? (time (train xor *exs*)) > ?? (display (list "1-1=" (xor '(1 1)))) > ?? (newline) > ?? (display (list "1-0=" (xor '(1 0)))) > ?? (newline) > ?? (display (list "0-1=" (xor '(0 1)))) > ?? (newline) > ?? (display (list "0-0=" (xor '(0 0)))) > ?? (newline) > ) > > (start 0) > ) > ;;(training xor '( (0 1 1) (1 1 0) (1 0 1) (0 0 0)) ) > > > > > > ________________________________ > > Yahoo! Canada Toolbar : Search from anywhere on the web and bookmark your > favourite sites. Download it now! > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From eli at barzilay.org Thu Jul 2 12:01:10 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Jul 2 12:01:47 2009 Subject: [plt-scheme] Using FFI with complex structures and input/output parameters? In-Reply-To: <9bd8a08a0907020531j1a6e11e0w75448adeceff198b@mail.gmail.com> References: <9bd8a08a0906300541x76ffb2e1ka137221f13745fdd@mail.gmail.com> <9bd8a08a0907010732w1c3c1272nfb77ec10b9511a44@mail.gmail.com> <19019.29785.367388.905047@winooski.ccs.neu.edu> <9bd8a08a0907010800p79eaca4n56ecd95522ae20ea@mail.gmail.com> <19019.50252.568293.285053@winooski.ccs.neu.edu> <9bd8a08a0907011345g7488bb21l320f8051bbe09eee@mail.gmail.com> <19019.52159.260117.669939@winooski.ccs.neu.edu> <9bd8a08a0907011358y71095021xfb5ff7e88f2c4c93@mail.gmail.com> <19020.3874.108948.979960@winooski.ccs.neu.edu> <9bd8a08a0907020104s1f9cee76u7066988f36b1d09e@mail.gmail.com> <9bd8a08a0907020531j1a6e11e0w75448adeceff198b@mail.gmail.com> Message-ID: <19020.55750.857785.220021@winooski.ccs.neu.edu> On Jul 2, Elena Garrulo wrote: > Well, I finally nailed it down. It would look like this (code > shrinked down from major example, not tested!) : > > ;; void fill_buffer (BYTE* buffer, DWORD* buffer_size); > (define fill_buffer > (get-ffi-obj "fill_buffer" > my_dll > (_fun > (buffer : _pointer) > (buffer_size : ((_ptr io _DWORD))) > -> _void > -> (list buffer_size)))) ;; <- OUTPUT? I'm still not sure about the point of this -- is the foreign function supposed to put data in your block and tell you the size of the data through the extra return value (eg, instead of using 0 as a terminator, or instead of you giving it a block of the right size)? IMO, this doesn't sound like a good API. In any case, there's no need to return a list of the size. Also, you might just copy the range of data to a new buffer and return that, instead of using the input buffer. > Which you would call like this: > > (define buffer_size 1000) ;; Pick your buffer size. > ;; Buffer allocation. > (define buffer (malloc _byte (* buffer_size (ctype-sizeof _byte)))) This could be simpler with `make-bytes'. > ;; call "fill_buffer" and retrieve size of result. > (set! buffer_size (car (fill_buffer buffer buffer_size))) > > ;; resize buffer accordingly > (set! buffer (cblock->vector buffer _byte buffer_size)) And if the above is done, then you can just use subbytes. You could also do both the buffer and pointer allocation, and dereferencing in the definition of the function, so you won't need any of this outside. > ;; remember to (free buffer) when you're done. No, you don't need to do that. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From hsmyers at gmail.com Thu Jul 2 12:09:56 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Thu Jul 2 12:10:53 2009 Subject: [plt-scheme] static variable redux In-Reply-To: <756daca50907020737y62fb2bc9n68f4e2c01caf39f6@mail.gmail.com> References: <408995400907011923x75df7c8frb254c123801e2d2e@mail.gmail.com> <756daca50907020737y62fb2bc9n68f4e2c01caf39f6@mail.gmail.com> Message-ID: <408995400907020909l1417c1e2s32abe5e62ca692e6@mail.gmail.com> Thanks! That nicely removes the outer parens, the over-which one might stumble! :) --hsm On Thu, Jul 2, 2009 at 8:37 AM, Grant Rettke wrote: > 2009/7/1 Hugh Myers : >> Here is what I came up with after wandering through a thicket of >> docs(thanks all!): > > You might call your functions immediately to avoid the need to do so > when calling the counter: > > ? ? ?((eq? m 'next) (next)) > ? ? ?((eq? m 'reset) (reset)) > From eli at barzilay.org Thu Jul 2 12:10:29 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Jul 2 12:11:00 2009 Subject: [plt-scheme] Has PLT performance improved? In-Reply-To: <380457.68243.qm@web58802.mail.re1.yahoo.com> References: <380457.68243.qm@web58802.mail.re1.yahoo.com> Message-ID: <19020.56309.337858.997595@winooski.ccs.neu.edu> On Jul 2, Philippos Apolinarius wrote: > > I noticed also that PLT is not so good at array intensive > computations. In one of those Lisp benchmarks designed to show that > Lisp can be as fast as C, PLT (7.9s, without f64vector) is twice as > much time as Bigloo (4.3s, without f64vector). Does PLT team intends > to improve array processing? An `f64vector' stores the FP numbers in a C vector, which means that every access will create a Scheme floating point number -- so accessing the same places over and over means that you keep generating garbage for the GC. Using a plain Scheme `vector' is likely to work better, and provide more chances for the compiler to better optimize the code. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From hsmyers at gmail.com Thu Jul 2 12:14:35 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Thu Jul 2 12:15:29 2009 Subject: [plt-scheme] plugins? In-Reply-To: <990e0c030907020820t2091cd14lc5395af8d2811f64@mail.gmail.com> References: <408995400907012241p78729a80wf1d6111069098a7e@mail.gmail.com> <595b9ab20907020021g66a053d8ib55433b89683963d@mail.gmail.com> <408995400907020122j1fc996b2k53a36d9808aad1f6@mail.gmail.com> <408995400907020143y5de01a61qbdf6c7686e5a6026@mail.gmail.com> <990e0c030907020408j7b8c629ah4f572a9e685d8b19@mail.gmail.com> <756daca50907020722w5b5342a7y9e34e3a7faa49012@mail.gmail.com> <990e0c030907020820t2091cd14lc5395af8d2811f64@mail.gmail.com> Message-ID: <408995400907020914g2a09099ex3f6b8e0c9ae192a@mail.gmail.com> I would vote yes. Not necessarily for code analysis, but for listing separately. I was looking for a spell-checker when I ran into needle-haystack problem. Should think the author could handle the it is/it isn't problem and so indicate when posting. --hsm On Thu, Jul 2, 2009 at 9:20 AM, Carl Eastlund wrote: > On Thu, Jul 2, 2009 at 10:22 AM, Grant Rettke wrote: >> On Thu, Jul 2, 2009 at 6:08 AM, Carl Eastlund wrote: >>> To add one more example, Dracula (cce / dracula.plt) is a plugin. >>> There's no way to "distinguish" them because they're not different >>> things... they're just packages that run different code. ?Some >>> packages may even contain multiple "plugins". ?Being able to tell what >>> code a package runs is not easy. >> >> A plugin category might be worthwhile. It communicates the intent >> better than development tool. > > I spoke too quickly. ?It is statically determinable whether a package > (or any collection in the PLT Scheme sense) contains a plugin. ?The > info.ss files give this information. > > It would be a useful category. ?I'm not sure whether it's best left as > a developer-specified category, though, or an automatically determined > one. ?I don't know that Planet really needs to be running code > analysis. > > --Carl > From egarrulo at gmail.com Thu Jul 2 12:14:59 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Thu Jul 2 12:15:35 2009 Subject: [plt-scheme] How do I disable automatic insertion of closing parenthesis? In-Reply-To: <932b2f1f0907020834t39917c9y92e8063c381a0de2@mail.gmail.com> References: <9bd8a08a0907020616q532b1b6cg6d2184368b838ab7@mail.gmail.com> <756daca50907020715g8a869a3u8a356a63c3d715d3@mail.gmail.com> <9bd8a08a0907020812j3f513c67g70668627279b1f27@mail.gmail.com> <932b2f1f0907020834t39917c9y92e8063c381a0de2@mail.gmail.com> Message-ID: <9bd8a08a0907020914h24bd04fcoaea2b9a42085f996@mail.gmail.com> 2009/7/2 Robby Findler > I think the best fix is probably to get your remapped keyboard working > properly, at a lower level. I'm sorry I've not had time to try to > figure out a next step. > > Robby > According to my remapping AltGr-E gives (. Therefore to press Control-(, I press Control-AltGr-E. When I do it, Emacs sees C-M-e. Does that helps? Anyway, don't bother too much, I think I'll give up my remapping since learning Scheme outside DrScheme seems way difficult. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090702/da46a3cc/attachment.html From grettke at acm.org Thu Jul 2 12:19:00 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Jul 2 12:19:18 2009 Subject: [plt-scheme] plugins? In-Reply-To: <408995400907020914g2a09099ex3f6b8e0c9ae192a@mail.gmail.com> References: <408995400907012241p78729a80wf1d6111069098a7e@mail.gmail.com> <595b9ab20907020021g66a053d8ib55433b89683963d@mail.gmail.com> <408995400907020122j1fc996b2k53a36d9808aad1f6@mail.gmail.com> <408995400907020143y5de01a61qbdf6c7686e5a6026@mail.gmail.com> <990e0c030907020408j7b8c629ah4f572a9e685d8b19@mail.gmail.com> <756daca50907020722w5b5342a7y9e34e3a7faa49012@mail.gmail.com> <990e0c030907020820t2091cd14lc5395af8d2811f64@mail.gmail.com> <408995400907020914g2a09099ex3f6b8e0c9ae192a@mail.gmail.com> Message-ID: <756daca50907020919v789117bfiae37ba3b8e359e51@mail.gmail.com> Perhaps the tag is something of a misnomer. In DrScheme terminology, what you would call a plugin anywhere else is called a tool. So by definition, development tool is accurate. It is just that there are also development libraries in the same category. From noelwelsh at gmail.com Thu Jul 2 12:21:11 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Jul 2 12:21:29 2009 Subject: [plt-scheme] Has PLT performance improved? In-Reply-To: <19020.56309.337858.997595@winooski.ccs.neu.edu> References: <380457.68243.qm@web58802.mail.re1.yahoo.com> <19020.56309.337858.997595@winooski.ccs.neu.edu> Message-ID: On Thu, Jul 2, 2009 at 5:10 PM, Eli Barzilay wrote: > On Jul ?2, Philippos Apolinarius wrote: >> >> I noticed also that PLT is not so good at array intensive >> computations. In one of those Lisp benchmarks designed to show that >> Lisp can be as fast as C, PLT (7.9s, without f64vector) is twice as >> much time as Bigloo (4.3s, without f64vector). Does PLT team intends >> to improve array processing? > > An `f64vector' stores the FP numbers in a C vector, which means that > every access will create a Scheme floating point number -- so > accessing the same places over and over means that you keep generating > garbage for the GC. ?Using a plain Scheme `vector' is likely to work > better, and provide more chances for the compiler to better optimize > the code. My benchmarks, some time ago, showed vector about 10x faster than f64vector. N. From hsmyers at gmail.com Thu Jul 2 12:22:24 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Thu Jul 2 12:23:04 2009 Subject: [plt-scheme] plugins? In-Reply-To: <756daca50907020919v789117bfiae37ba3b8e359e51@mail.gmail.com> References: <408995400907012241p78729a80wf1d6111069098a7e@mail.gmail.com> <595b9ab20907020021g66a053d8ib55433b89683963d@mail.gmail.com> <408995400907020122j1fc996b2k53a36d9808aad1f6@mail.gmail.com> <408995400907020143y5de01a61qbdf6c7686e5a6026@mail.gmail.com> <990e0c030907020408j7b8c629ah4f572a9e685d8b19@mail.gmail.com> <756daca50907020722w5b5342a7y9e34e3a7faa49012@mail.gmail.com> <990e0c030907020820t2091cd14lc5395af8d2811f64@mail.gmail.com> <408995400907020914g2a09099ex3f6b8e0c9ae192a@mail.gmail.com> <756daca50907020919v789117bfiae37ba3b8e359e51@mail.gmail.com> Message-ID: <408995400907020922n18445c12p50b52b1914d11021@mail.gmail.com> So not something that modifies the performance or behavior of the DrScheme editor per se? --hsm On Thu, Jul 2, 2009 at 10:19 AM, Grant Rettke wrote: > Perhaps the tag is something of a misnomer. > > In DrScheme terminology, what you would call a plugin anywhere else is > called a tool. > > So by definition, development tool is accurate. > > It is just that there are also development libraries in the same category. > From egarrulo at gmail.com Thu Jul 2 12:34:24 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Thu Jul 2 12:34:43 2009 Subject: [plt-scheme] Using FFI with complex structures and input/output parameters? In-Reply-To: <19020.55750.857785.220021@winooski.ccs.neu.edu> References: <9bd8a08a0906300541x76ffb2e1ka137221f13745fdd@mail.gmail.com> <9bd8a08a0907010800p79eaca4n56ecd95522ae20ea@mail.gmail.com> <19019.50252.568293.285053@winooski.ccs.neu.edu> <9bd8a08a0907011345g7488bb21l320f8051bbe09eee@mail.gmail.com> <19019.52159.260117.669939@winooski.ccs.neu.edu> <9bd8a08a0907011358y71095021xfb5ff7e88f2c4c93@mail.gmail.com> <19020.3874.108948.979960@winooski.ccs.neu.edu> <9bd8a08a0907020104s1f9cee76u7066988f36b1d09e@mail.gmail.com> <9bd8a08a0907020531j1a6e11e0w75448adeceff198b@mail.gmail.com> <19020.55750.857785.220021@winooski.ccs.neu.edu> Message-ID: <9bd8a08a0907020934g42053532u97bcb5a224fb9a54@mail.gmail.com> 2009/7/2 Eli Barzilay > On Jul 2, Elena Garrulo wrote: > > Well, I finally nailed it down. It would look like this (code > > shrinked down from major example, not tested!) : > > > > ;; void fill_buffer (BYTE* buffer, DWORD* buffer_size); > > (define fill_buffer > > (get-ffi-obj "fill_buffer" > > my_dll > > (_fun > > (buffer : _pointer) > > (buffer_size : ((_ptr io _DWORD))) > > -> _void > > -> (list buffer_size)))) ;; <- OUTPUT? > > I'm still not sure about the point of this -- is the foreign function > supposed to put data in your block and tell you the size of the data > through the extra return value (eg, instead of using 0 as a > terminator, or instead of you giving it a block of the right size)? > IMO, this doesn't sound like a good API. You got the point. They are legacy Win32 APIs. Thank you for your other suggestions. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090702/a7e99946/attachment.htm From grettke at acm.org Thu Jul 2 14:09:16 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Jul 2 14:09:34 2009 Subject: [plt-scheme] plugins? In-Reply-To: <408995400907020922n18445c12p50b52b1914d11021@mail.gmail.com> References: <408995400907012241p78729a80wf1d6111069098a7e@mail.gmail.com> <408995400907020122j1fc996b2k53a36d9808aad1f6@mail.gmail.com> <408995400907020143y5de01a61qbdf6c7686e5a6026@mail.gmail.com> <990e0c030907020408j7b8c629ah4f572a9e685d8b19@mail.gmail.com> <756daca50907020722w5b5342a7y9e34e3a7faa49012@mail.gmail.com> <990e0c030907020820t2091cd14lc5395af8d2811f64@mail.gmail.com> <408995400907020914g2a09099ex3f6b8e0c9ae192a@mail.gmail.com> <756daca50907020919v789117bfiae37ba3b8e359e51@mail.gmail.com> <408995400907020922n18445c12p50b52b1914d11021@mail.gmail.com> Message-ID: <756daca50907021109y32e9ef6djf1edeec231a62efa@mail.gmail.com> On Thu, Jul 2, 2009 at 11:22 AM, Hugh Myers wrote: > So not something that modifies the performance or behavior of the > DrScheme editor per se? Yes. Compare this: log4scm.plt (1 3) 1.0 oesterholt LOG4SCM - a log library. with this: drocaml.plt (2 0) 2.0 abromfie a set of tools for using OCaml in DrScheme Library vs plugin From pocmatos at gmail.com Thu Jul 2 15:39:19 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Jul 2 15:40:00 2009 Subject: [plt-scheme] Standard module resolver issue Message-ID: <11b141710907021239p51897f9cy50a0260fffd039d0@mail.gmail.com> Hi all, Part of some software I have, is about generating code in runtime as a unit, loading it, linking the unit and executing and if I run everything in DrScheme it works perfectly. As soon as I compile it with mzc and run it, I get: standard-module-name-resolver: collection not found: # in any of: (#) === context === loop Any suggestions where the problem lies? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From yinso.chen at gmail.com Thu Jul 2 18:08:32 2009 From: yinso.chen at gmail.com (YC) Date: Thu Jul 2 18:08:54 2009 Subject: [plt-scheme] ajax and plt In-Reply-To: <3F3B29CB-C7D3-45AE-8805-7DA3DC5C9CAE@gmail.com> References: <779bf2730907011423g60a652c5p85c2215e54cb9842@mail.gmail.com> <3F3B29CB-C7D3-45AE-8805-7DA3DC5C9CAE@gmail.com> Message-ID: <779bf2730907021508q5cad131bl8f717c7babc514df@mail.gmail.com> On Thu, Jul 2, 2009 at 1:19 AM, Dave Gurnell wrote: > Hi YC, > > There are two current, well documented ways of generating Javascript source > using Scheme code: > > http://planet.plt-scheme.org/package-source/dherman/javascript.plt/9/2/planet-docs/javascript/index.html > > http://planet.plt-scheme.org/package-source/untyped/mirrors.plt/2/2/planet-docs/mirrors/index.html > > To my knowledge, neither of these libraries compile actual Scheme into > Javascript, but they both have a parenthetic syntax for writing Javascript > code. So, for example, in Mirrors you can do stuff like this: > > (js (alert ,(string-append "Hello " "world")) > > I use Mirrors with jQuery quite a lot; > > (js (!dot ($ "#mybutton") > (click (function () (alert "Hi"))))) > Cool - this approach seems simple and effective - are you able to write more complicated code structures such as if/while/case? I envision for those you currently write in javascript? (javascript is not bad, of course). > > As a user of PLT in a commercial environment, I'd be more than happy to > talk ideas/code/etc. > Great! > > Last note... AJAX and web frameworks... we *do* have a working framework, > but it's basically undocumented. I'd welcome feedback/comment/collaboration > if you want to take a look (let me know if you have versioning problems when > you compile it): > > $ svn co http://svn.untyped.com/smoke/trunk/src > $ cd > $ mzc run-tests.ss && mzscheme run-tests.ss > Open http://localhost:8765 in your browser. > Thanks for the information Dave - I'll download and play with it over the weekend and followup with you then. Cheers, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090702/c2556663/attachment.html From a.rottmann at gmx.at Thu Jul 2 20:52:07 2009 From: a.rottmann at gmx.at (Andreas Rottmann) Date: Thu Jul 2 20:52:34 2009 Subject: [plt-scheme] "unwind-protect" for PLT Scheme? In-Reply-To: (Noel Welsh's message of "Thu, 2 Jul 2009 10:55:34 +0100") References: <9bd8a08a0907020253s197833efq90e3402f39f44c4f@mail.gmail.com> Message-ID: <877hyqwpu0.fsf@delenn.lan> Noel Welsh writes: > On Thu, Jul 2, 2009 at 10:53 AM, Elena Garrulo wrote: >> Hello, >> >> what is the equivalent as "unwind-protect" in PLT Scheme? > > dynamic-wind > Well, not quite (as continuations enter the picture, things are not as clear-cut as in CL); Taylor Campbell has written about that issue: http://mumble.net/~campbell/blag.txt Search for `unwind-protect', there's more below the latest entry on that topic. Regards, Rotty From matthias at ccs.neu.edu Thu Jul 2 21:02:38 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Jul 2 21:03:53 2009 Subject: [plt-scheme] "unwind-protect" for PLT Scheme? In-Reply-To: <877hyqwpu0.fsf@delenn.lan> References: <9bd8a08a0907020253s197833efq90e3402f39f44c4f@mail.gmail.com> <877hyqwpu0.fsf@delenn.lan> Message-ID: <937E4CFB-E0D4-453B-98A5-4F66B43B3AFC@ccs.neu.edu> We have written even more about the topic of control (as in "continuations") and when we wrote, we wrote in peer-reviewed flag- ship conferences on PL/SE not blogs. For details on the power of control, see the documentation for scheme/ control and related publications. -- Matthias On Jul 2, 2009, at 8:52 PM, Andreas Rottmann wrote: > Noel Welsh writes: > >> On Thu, Jul 2, 2009 at 10:53 AM, Elena Garrulo >> wrote: >>> Hello, >>> >>> what is the equivalent as "unwind-protect" in PLT Scheme? >> >> dynamic-wind >> > Well, not quite (as continuations enter the picture, things are not as > clear-cut as in CL); Taylor Campbell has written about that issue: > > http://mumble.net/~campbell/blag.txt > > Search for `unwind-protect', there's more below the latest entry on > that > topic. > > Regards, Rotty > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From eli at barzilay.org Thu Jul 2 21:03:25 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Jul 2 21:03:58 2009 Subject: [plt-scheme] ajax and plt In-Reply-To: <3F3B29CB-C7D3-45AE-8805-7DA3DC5C9CAE@gmail.com> References: <779bf2730907011423g60a652c5p85c2215e54cb9842@mail.gmail.com> <3F3B29CB-C7D3-45AE-8805-7DA3DC5C9CAE@gmail.com> Message-ID: <19021.22749.347527.886191@winooski.ccs.neu.edu> On Jul 2, Dave Gurnell wrote: > [...] > To my knowledge, neither of these libraries compile actual Scheme into > Javascript, but they both have a parenthetic syntax for writing > Javascript code. So, for example, in Mirrors you can do stuff like this: > > (js (alert ,(string-append "Hello " "world")) > > I use Mirrors with jQuery quite a lot; > > (js (!dot ($ "#mybutton") > (click (function () (alert "Hi"))))) I'm curious -- is there any advantage for this over something like: (let ([msg "Hello world"]) @js{alert(@msg)}) (Random example, since using `string-append' is even more boring in this style.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From eli at barzilay.org Thu Jul 2 21:42:30 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Jul 2 21:43:04 2009 Subject: [plt-scheme] Has PLT performance improved? In-Reply-To: <20090703013948.GA79166@duncan.reilly.home> References: <380457.68243.qm@web58802.mail.re1.yahoo.com> <19020.56309.337858.997595@winooski.ccs.neu.edu> <20090703013948.GA79166@duncan.reilly.home> Message-ID: <19021.25094.598404.311962@winooski.ccs.neu.edu> On Jul 3, Andrew Reilly wrote: > On Thu, Jul 02, 2009 at 12:10:29PM -0400, Eli Barzilay wrote: > > On Jul 2, Philippos Apolinarius wrote: > > > > > > I noticed also that PLT is not so good at array intensive > > > computations. In one of those Lisp benchmarks designed to show that > > > Lisp can be as fast as C, PLT (7.9s, without f64vector) is twice as > > > much time as Bigloo (4.3s, without f64vector). Does PLT team intends > > > to improve array processing? > > > > An `f64vector' stores the FP numbers in a C vector, which means that > > every access will create a Scheme floating point number -- so > > accessing the same places over and over means that you keep generating > > garbage for the GC. Using a plain Scheme `vector' is likely to work > > better, and provide more chances for the compiler to better optimize > > the code. > > Oh, I thought that I had read that there had been some optimizations > of floating point code to keep float locals on the stack. Maybe I'm > thinking of a different project. Yes, that's exactly what should make plain Scheme floats much faster. Items in an f64vector cannot be optimized, since as far as the core mzscheme is concerned, it's just a bunch of binary data. > The situation would be different for, say, s16vectors, because the > resulting short integers would fit into the native pointer+tag > format, right? The main difference, I think, is that dereferencing a small integer doesn't require allocating a Scheme object. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From phi500ac at yahoo.ca Thu Jul 2 23:47:22 2009 From: phi500ac at yahoo.ca (Philippos Apolinarius) Date: Thu Jul 2 23:47:43 2009 Subject: [plt-scheme] Number crunching -> Matthias, Eli In-Reply-To: Message-ID: <933247.80656.qm@web58801.mail.re1.yahoo.com> I think that number crunching is so important that it should receive ad hoc optimization, if a more general approach fails. To bring the discussion to a concrete example, I attached a small benchmark to this article.? PLT, Bigloo and Gambit take about the same time to run the program below. However, Bigloo and Gambit become ten times faster with a very simple optimization. ?(define-syntax $ ???? (syntax-rules () ?????? ( ($ m c i j) (vector-ref m (+fx (*fx c i) j))) ???? ) ? ) ? ? (define-syntax $! ???? (syntax-rules () ?????? ( ($! m c i j v) (vector-set! m (+fx (*fx c i) j) v)) ???? ) ?? ) BTW, use the option -Obench to compile Bigloo. When one uses the *fx, +fx, *fl, +fl and /fl in few other places, Bigloo speed is multiplied by 20 (the time is divided by 20). It would be great if PLT had similar directives to control optimization. If I missed something, and there is a way to make PLT approach the speed of Bigloo and Gambit in the example below, please let me know.? However, I read an article in this list, where you people suggest exactly this, to add unsafe arithmetic operators to improve performance. (module matplt scheme ?? (require (lib "4.ss" "srfi")) ? ? (define iii 0) ?(define-syntax $mk ??? (syntax-rules () ?????? ( ($mk c v) (make-vector c v)) )) ?(define-syntax $ ???? (syntax-rules () ?????? ( ($ m c i j) (vector-ref m (+ (* c i) j))) ???? ) ? ) ? ? (define-syntax $! ???? (syntax-rules () ?????? ( ($! m c i j v) (vector-set! m (+ (* c i) j) v)) ???? ) ?? ) ? ? (define (prt m r c) ?? (do ( (i 0 (+? i 1)) ) ( (>=? i r) ) ????? (newline) ????? (do ((j 0 (+? j 1)) )? ( (>=? j c) ) ???????? (printf " %4.3f " ($ m c i j) ) ))) (define (make-system r) ? (let* ( (c (+? r 1)) ????????? (m ($mk (*? r c) 0.0 )) ????????? (xx 0.0) ????????? (s 0.0) ) ??? (do ( (i 0 (+? i 1))? ) ( (>=? i r) m) ?????? (set! s 0.0) ?????? (do ((j 0 (+? j 1) ) ) ( (>=? j r) ($! m c i j? s) ) ????????? (set! xx (exact->inexact (random 3873))) ????????? (set! s (+ s xx)) ????????? ($! m c i j xx )) )? )) (define (swapit m c k l) ? (let ((t 0.0)) ?? (set! iii (+? iii 1)) ?? (do ( (j 0 (+? j 1)) ) ( (>=? j c) ) ????? (set! t ($ m c k j ) ) ????? ($! m c k j? ($ m c l j) ) ????? ($! m c l j t) )? )? ) (define (find-max m c k i) ??? (do ( (l (+? k 1) (+? l 1)) ) ??????? ( (>=? l (-? c 1)) (when (not (= i k))? (swapit m? c k i ))) ????? (when (> (abs ($ m c l k)) (abs ($ m c i k)) ) ??????????? (set! i l) )? )) (define (solvit m r) ?? (let ( (c (+? r 1)) ?????????? (rat 0.0) ?????????? (mkk 0.0)) ???? ? ????? (do ( (k 0 (+? k 1)) ) ( (>=? k (-? r 1))) ??????? (find-max m c k k) ??????? (set! mkk ($ m c? k k) ) ?????? ? ??????? (do ( ( i (+? k 1)(+? i 1)) ) ( (>=? i r)) ?????????? (set! rat (/? ($ m c i k) mkk? )) ???????????? (do ( (j? k? (+? j 1))) ( (>=? j c) ) ???????????????? ($! m c i j (- ($ m c i j) ?????????????????????????????????? (* rat ($ m c k j ) ) ) ) ???????????? ) ????????? ) ?????? ) ???? ? ???? (do ( (i (-? r 1) (-? i 1) ) ) ((=? j r) ????????????? ($! m c i r ? ???????????????? (/ (+ ($ m c? i r ) tx) ?????????????????????? ($ m c i i)) ) ) )) ?? ) )???????????? ? ? (define (elms argv) ? (cond ( (number (cadr argv)) (string->number (cadr argv)) ) ??????? (else 2000))) (define (main argv) ?? (let* ( (r (elms argv)) (c (+? r 1)) (m (solvit (make-system r) r) ) ) ????? (do ( (i 0 (+? i 1))) ( (>=? i (min r 10)) ) ????????? (display? (list($ m c i r)) )? ) ?? (newline) ?? (newline) (display iii)) ) ? ? ?? (time (main '(xx "500"))) ? ? ) __________________________________________________________________ Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now http://ca.toolbar.yahoo.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090702/223b0794/attachment.htm From andrew-scheme at areilly.bpc-users.org Thu Jul 2 21:39:48 2009 From: andrew-scheme at areilly.bpc-users.org (Andrew Reilly) Date: Fri Jul 3 00:09:32 2009 Subject: [plt-scheme] Has PLT performance improved? In-Reply-To: <19020.56309.337858.997595@winooski.ccs.neu.edu> References: <380457.68243.qm@web58802.mail.re1.yahoo.com> <19020.56309.337858.997595@winooski.ccs.neu.edu> Message-ID: <20090703013948.GA79166@duncan.reilly.home> On Thu, Jul 02, 2009 at 12:10:29PM -0400, Eli Barzilay wrote: > On Jul 2, Philippos Apolinarius wrote: > > > > I noticed also that PLT is not so good at array intensive > > computations. In one of those Lisp benchmarks designed to show that > > Lisp can be as fast as C, PLT (7.9s, without f64vector) is twice as > > much time as Bigloo (4.3s, without f64vector). Does PLT team intends > > to improve array processing? > > An `f64vector' stores the FP numbers in a C vector, which means that > every access will create a Scheme floating point number -- so > accessing the same places over and over means that you keep generating > garbage for the GC. Using a plain Scheme `vector' is likely to work > better, and provide more chances for the compiler to better optimize > the code. Oh, I thought that I had read that there had been some optimizations of floating point code to keep float locals on the stack. Maybe I'm thinking of a different project. The situation would be different for, say, s16vectors, because the resulting short integers would fit into the native pointer+tag format, right? On the other hand, native vectors would store the same range of integer values relatively speedily and space-efficiently too, so that's not a win either... I suppose that the same concerns apply to the use of bytevector-ieee-double-ref and friends under (rnrs bytevectors (6)) libraries? Cheers, -- Andrew From d.j.gurnell at gmail.com Fri Jul 3 03:16:52 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Fri Jul 3 03:17:28 2009 Subject: [plt-scheme] ajax and plt In-Reply-To: <19021.22749.347527.886191@winooski.ccs.neu.edu> References: <779bf2730907011423g60a652c5p85c2215e54cb9842@mail.gmail.com> <3F3B29CB-C7D3-45AE-8805-7DA3DC5C9CAE@gmail.com> <19021.22749.347527.886191@winooski.ccs.neu.edu> Message-ID: <91474790-858A-4E69-8421-492A145BF980@gmail.com> > I'm curious -- is there any advantage for this over something like: > > (let ([msg "Hello world"]) > @js{alert(@msg)}) > > (Random example, since using `string-append' is even more boring in > this style.) I didn't know you could set things up to switch between readers like that with such simple syntax. It could be really useful. I have contemplated an @-style syntax but I have lacked the PLT know-how to set it up and experiment. One thought. An @-reader solution would benefit from being backed by an AST - when you unquote to Scheme code, you need to know whether the surrounding context is a statement/expression and so on to work out how to splice the fragments back together. For example: (javascript->string (js ,(+ 1 2))) => "3;" ; semicolon after the unquote (javascript->string (js (+ ,(+ 1 2) 4))) => "3+4;" ; no semicolon after the unquote The context can be inferred by the programmer in these examples, but we assemble fragments of JS from all over the shop so protection against typos is quite important. -- Dave From eli at barzilay.org Fri Jul 3 03:40:46 2009 From: eli at barzilay.org (Eli Barzilay) Date: Fri Jul 3 03:41:11 2009 Subject: [plt-scheme] ajax and plt In-Reply-To: <91474790-858A-4E69-8421-492A145BF980@gmail.com> References: <779bf2730907011423g60a652c5p85c2215e54cb9842@mail.gmail.com> <3F3B29CB-C7D3-45AE-8805-7DA3DC5C9CAE@gmail.com> <19021.22749.347527.886191@winooski.ccs.neu.edu> <91474790-858A-4E69-8421-492A145BF980@gmail.com> Message-ID: <19021.46590.774714.363976@winooski.ccs.neu.edu> On Jul 3, Dave Gurnell wrote: > > I'm curious -- is there any advantage for this over something like: > > > > (let ([msg "Hello world"]) > > @js{alert(@msg)}) > > > > (Random example, since using `string-append' is even more boring in > > this style.) > > I didn't know you could set things up to switch between readers like > that with such simple syntax. It could be really useful. I have > contemplated an @-style syntax but I have lacked the PLT know-how to > set it up and experiment. Well, that's very easy now. All you need is: #lang at-exp scheme and then you have the scribble reader syntax. You can then use any definition for `js' -- for example, you could define it as `string-append', or as a version of `string-append' that turns non-string values to strings, or construct some specific kind of values, or just use `list' and make the component that renders the final text spit out the pieces. (The last one is what I usually prefer, which you can see in the `scribble/text' language. The documentation language(s) uses the one before that.) > One thought. An @-reader solution would benefit from being backed by > an AST - when you unquote to Scheme code, you need to know whether > the surrounding context is a statement/expression and so on to work > out how to splice the fragments back together. For example: > > (javascript->string (js ,(+ 1 2))) => "3;" ; semicolon > after the unquote > (javascript->string (js (+ ,(+ 1 2) 4))) => "3+4;" ; no semicolon > after the unquote > > The context can be inferred by the programmer in these examples, but > we assemble fragments of JS from all over the shop so protection > against typos is quite important. Well, both approaches are possible, of course. IIUC, the latter involves having several Scheme functions that render their inputs in a different way -- in this example, an `expression' and a `statement' kind of bindings. The former is more difficult, but doable too -- it requires some parsing of the text to know how to deal with the nested escapes -- something like making the above `js' function check its contents and add a semicolon if necessary. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From d.j.gurnell at gmail.com Fri Jul 3 03:41:13 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Fri Jul 3 03:41:52 2009 Subject: [plt-scheme] ajax and plt In-Reply-To: <779bf2730907021508q5cad131bl8f717c7babc514df@mail.gmail.com> References: <779bf2730907011423g60a652c5p85c2215e54cb9842@mail.gmail.com> <3F3B29CB-C7D3-45AE-8805-7DA3DC5C9CAE@gmail.com> <779bf2730907021508q5cad131bl8f717c7babc514df@mail.gmail.com> Message-ID: > Hi YC, > > There are two current, well documented ways of generating Javascript > source using Scheme code: > > http://planet.plt-scheme.org/package-source/dherman/javascript.plt/9/2/planet-docs/javascript/index.html > http://planet.plt-scheme.org/package-source/untyped/mirrors.plt/2/2/planet-docs/mirrors/index.html > > To my knowledge, neither of these libraries compile actual Scheme > into Javascript, but they both have a parenthetic syntax for writing > Javascript code. So, for example, in Mirrors you can do stuff like > this: > > (js (alert ,(string-append "Hello " "world")) > > I use Mirrors with jQuery quite a lot; > > (js (!dot ($ "#mybutton") > (click (function () (alert "Hi"))))) > > Cool - this approach seems simple and effective - are you able to > write more complicated code structures such as if/while/case? I > envision for those you currently write in javascript? (javascript is > not bad, of course). Yes you can. See the docs for more info. I should explain that the two libraries above are very similar, and that Dave Herman wrote most of the code in both cases: - they both have DSLs that expand into a Javascript AST; - they both use Dave's Javascript AST representation; - they both use Dave's pretty printing algorithms to format the JS into a string. Mirrors JS is based on an old experiment of Jay's. It's really a thin veneer over Dave's code. Dave's parenthetical syntax came after Mirrors, and is IMO a little nicer (see Sections 5.2 and 5.3 of his docs). However, all that said, Mirrors provides unique handy things that (AFAIK) other libraries don't provide. These things include JS begin statements and multi-statement splicing: (js ,@(for/list ([i (in-range 10)]) (js (alert "Number") (alert ,i)))) raw blocks: (js #< References: <779bf2730907011423g60a652c5p85c2215e54cb9842@mail.gmail.com> <3F3B29CB-C7D3-45AE-8805-7DA3DC5C9CAE@gmail.com> <19021.22749.347527.886191@winooski.ccs.neu.edu> <91474790-858A-4E69-8421-492A145BF980@gmail.com> <19021.46590.774714.363976@winooski.ccs.neu.edu> Message-ID: >> I didn't know you could set things up to switch between readers like >> that with such simple syntax. It could be really useful. I have >> contemplated an @-style syntax but I have lacked the PLT know-how to >> set it up and experiment. > > Well, that's very easy now. All you need is: > > #lang at-exp scheme > > and then you have the scribble reader syntax. You can then use any > definition for `js' -- for example, you could define it as > `string-append', or as a version of `string-append' that turns > non-string values to strings, or construct some specific kind of > values, or just use `list' and make the component that renders the > final text spit out the pieces. (The last one is what I usually > prefer, which you can see in the `scribble/text' language. The > documentation language(s) uses the one before that.) Of course. Dave told me about #lang at-exp a while ago. This probably seems dense, but it didn't occur to me that I could use the @-reader and still write most of the module in regular parenthetical syntax. That's really cool. -- Dave From noelwelsh at gmail.com Fri Jul 3 04:38:57 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Jul 3 04:39:17 2009 Subject: [plt-scheme] Number crunching -> Matthias, Eli In-Reply-To: <933247.80656.qm@web58801.mail.re1.yahoo.com> References: <933247.80656.qm@web58801.mail.re1.yahoo.com> Message-ID: On Fri, Jul 3, 2009 at 4:47 AM, Philippos Apolinarius wrote: > If I missed something, and there is a way to make PLT approach the speed of > Bigloo and Gambit in the example below, please let me know. Yeah, bind to a C library. Seriously. In my field -- machine learning, which is very numeric -- most people find Matlab is plenty fast enough. PLT is faster than Matlab, and pure PLT Scheme code has been fast enough for my experiments (though I have created bindings to GSL for a case when I thought I needed more speed.) The people who want more speed than PLT + select C libraries provides AND would actually consider writing numeric code in Scheme is 0 + epsilon. Given the finite number of Matthew Flatts in this world I believe effort is better spent elsewhere. For example, a runtime that could take advantage of multicore machines would benefit many more people that optimising floating point calculations. I love performance as much as the next guy -- my hard disk is littered with little compilers and so on -- but it really isn't that important in the grand scheme of things. N. From noelwelsh at gmail.com Fri Jul 3 05:21:25 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Jul 3 05:21:45 2009 Subject: [plt-scheme] On-demand module reloading Message-ID: Hello, It would be a big productivity boost for certain applications to have on demand module loading. This means something like scheme/enter: scan the filesystem and reload any modules that have changed since the last time the code was run. Is there any downside to just using scheme/enter? Scanning the code, it seems the use of [compile-enforce-module-constants #f] will slow things down. I can't see any other downside, and it should be possible to get around this by loading the code into a new namespace each time. Another question: what actually stops modules being reloaded by default? The docs make reference to the module registry, but there are no details. [Long term I'd like to implement an incremental compiler using something like select/kqueue/epoll/libevent/libev to detect when files change, but I'll settle for a pure Scheme polling solution to start.] N. From pocmatos at gmail.com Fri Jul 3 09:22:36 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri Jul 3 09:23:18 2009 Subject: [plt-scheme] RE: trace In-Reply-To: References: Message-ID: <11b141710907030622g481d432s3f93e198981e7c15@mail.gmail.com> On Thu, Jul 2, 2009 at 1:17 AM, Skeptic . wrote: > > > Nobody ? > Since the pros didn't say anything. No, I don't think [unfortunately] that the trace module has been ported to the recent versions. > >> To: plt-scheme@list.cs.brown.edu >> Subject: trace >> Date: Mon, 29 Jun 2009 11:59:19 -0400 >> >> >> >> Hi, >> Has the legacy mzlib/trace been replaced by somehing else ? >> Thanks > > > _________________________________________________________________ > Attention ? tous les Humains. Nous sommes vos photos. Lib?rez-nous de vos disques durs. > http://go.microsoft.com/?linkid=9666050_________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From samth at ccs.neu.edu Fri Jul 3 09:31:18 2009 From: samth at ccs.neu.edu (Sam TH) Date: Fri Jul 3 09:39:31 2009 Subject: [plt-scheme] RE: trace In-Reply-To: <11b141710907030622g481d432s3f93e198981e7c15@mail.gmail.com> References: <11b141710907030622g481d432s3f93e198981e7c15@mail.gmail.com> Message-ID: <63bb19ae0907030631m5c582adcte9df74a662204f6b@mail.gmail.com> On Fri, Jul 3, 2009 at 9:22 AM, Paulo J. Matos wrote: > On Thu, Jul 2, 2009 at 1:17 AM, Skeptic . wrote: >> >> >> Nobody ? >> > > Since the pros didn't say anything. No, I don't think [unfortunately] > that the trace module has been ported to the recent versions. That's not correct, `mzlib/trace' works just fine. > >> >>> To: plt-scheme@list.cs.brown.edu >>> Subject: trace >>> Date: Mon, 29 Jun 2009 11:59:19 -0400 >>> >>> >>> >>> Hi, >>> Has the legacy mzlib/trace been replaced by somehing else ? >>> Thanks >> >> >> _________________________________________________________________ >> Attention ? tous les Humains. Nous sommes vos photos. Lib?rez-nous de vos disques durs. >> http://go.microsoft.com/?linkid=9666050_________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > > -- > Paulo Jorge Matos - pocmatos at gmail.com > http://www.pmatos.net > _________________________________________________ > ?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 Fri Jul 3 09:48:01 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Fri Jul 3 09:49:55 2009 Subject: [plt-scheme] Number crunching -> Matthias, Eli In-Reply-To: <933247.80656.qm@web58801.mail.re1.yahoo.com> References: <933247.80656.qm@web58801.mail.re1.yahoo.com> Message-ID: <1EB4B1AD-72BA-4457-BBA0-50AE77A641E1@ccs.neu.edu> Have you considered benchmarking STALIN? On Jul 2, 2009, at 11:47 PM, Philippos Apolinarius wrote: > I think that number crunching is so important that it should > receive ad hoc optimization, if a more general approach fails. To > bring the discussion to a concrete example, I attached a small > benchmark to this article. PLT, Bigloo and Gambit take about the > same time to run the program below. However, Bigloo and Gambit > become ten times faster with a very simple optimization. > > (define-syntax $ > (syntax-rules () > ( ($ m c i j) (vector-ref m (+fx (*fx c i) j))) > ) > ) > > (define-syntax $! > (syntax-rules () > ( ($! m c i j v) (vector-set! m (+fx (*fx c i) j) v)) > ) > ) > > BTW, use the option -Obench to compile Bigloo. When one uses the > *fx, +fx, *fl, +fl and /fl in few other places, Bigloo speed is > multiplied by 20 (the time is divided by 20). It would be great if > PLT had similar directives to control optimization. > > If I missed something, and there is a way to make PLT approach the > speed of Bigloo and Gambit in the example below, please let me > know. However, I read an article in this list, where you people > suggest exactly this, to add unsafe arithmetic operators to improve > performance. > > > > (module matplt scheme > (require (lib "4.ss" "srfi")) > > (define iii 0) > > (define-syntax $mk > (syntax-rules () > ( ($mk c v) (make-vector c v)) )) > > (define-syntax $ > (syntax-rules () > ( ($ m c i j) (vector-ref m (+ (* c i) j))) > ) > ) > > (define-syntax $! > (syntax-rules () > ( ($! m c i j v) (vector-set! m (+ (* c i) j) v)) > ) > ) > > > > > (define (prt m r c) > (do ( (i 0 (+ i 1)) ) ( (>= i r) ) > (newline) > (do ((j 0 (+ j 1)) ) ( (>= j c) ) > (printf " %4.3f " ($ m c i j) ) ))) > > (define (make-system r) > (let* ( (c (+ r 1)) > (m ($mk (* r c) 0.0 )) > (xx 0.0) > (s 0.0) ) > > (do ( (i 0 (+ i 1)) ) ( (>= i r) m) > (set! s 0.0) > (do ((j 0 (+ j 1) ) ) ( (>= j r) ($! m c i j s) ) > (set! xx (exact->inexact (random 3873))) > (set! s (+ s xx)) > ($! m c i j xx )) ) )) > > (define (swapit m c k l) > (let ((t 0.0)) > (set! iii (+ iii 1)) > (do ( (j 0 (+ j 1)) ) ( (>= j c) ) > (set! t ($ m c k j ) ) > ($! m c k j ($ m c l j) ) > ($! m c l j t) ) ) ) > > (define (find-max m c k i) > (do ( (l (+ k 1) (+ l 1)) ) > ( (>= l (- c 1)) (when (not (= i k)) (swapit m c k i ))) > (when (> (abs ($ m c l k)) (abs ($ m c i k)) ) > (set! i l) ) )) > > (define (solvit m r) > (let ( (c (+ r 1)) > (rat 0.0) > (mkk 0.0)) > > (do ( (k 0 (+ k 1)) ) ( (>= k (- r 1))) > (find-max m c k k) > (set! mkk ($ m c k k) ) > > (do ( ( i (+ k 1)(+ i 1)) ) ( (>= i r)) > (set! rat (/ ($ m c i k) mkk )) > (do ( (j k (+ j 1))) ( (>= j c) ) > ($! m c i j (- ($ m c i j) > (* rat ($ m c k j ) ) ) ) > ) > ) > ) > > (do ( (i (- r 1) (- i 1) ) ) ((< i 0) m) > (do ( (j (+ i 1) (+ j 1)) > (tx 0.0 (- tx (* ($ m c i j) > ($ m c j r )) )) ) > ( (>= j r) > ($! m c i r > (/ (+ ($ m c i r ) tx) > ($ m c i i)) ) ) )) > ) > ) > > (define (elms argv) > (cond ( (< (length argv) 2) 2000) > ( (string->number (cadr argv)) (string->number (cadr argv)) ) > (else 2000))) > > (define (main argv) > (let* ( (r (elms argv)) (c (+ r 1)) (m (solvit (make-system r) > r) ) ) > (do ( (i 0 (+ i 1))) ( (>= i (min r 10)) ) > (display (list($ m c i r)) ) ) > (newline) > (newline) (display iii)) ) > > (time (main '(xx "500"))) > > ) > > > > Instant message from any web browser! Try the new Yahoo! Canada > Messenger for the Web BETA > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From ryanc at ccs.neu.edu Fri Jul 3 10:05:30 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Fri Jul 3 10:05:55 2009 Subject: [plt-scheme] On-demand module reloading In-Reply-To: References: Message-ID: <3786A0A9-43D3-4945-9828-D378F49A9484@ccs.neu.edu> On Jul 3, 2009, at 5:21 AM, Noel Welsh wrote: > [...] > > Another question: what actually stops modules being reloaded by > default? The docs make reference to the module registry, but there are > no details. The standard module name resolver keeps a table of loaded modules. You can see the implementation in $PLT/src/mzscheme/src/startup.ss. Ryan From scheme at phirho.com Fri Jul 3 09:51:44 2009 From: scheme at phirho.com (scheme@phirho.com) Date: Fri Jul 3 10:21:10 2009 Subject: [plt-scheme] Resetting environment in embedded Scheme Message-ID: <52642.83.34.249.211.1246629104.squirrel@mail.phirho.com> Hello! While it was relatively straightforward and easy to get an embedded Scheme running thanks to the docs I have not been able to find anything about resetting the environment. To illustrate my point, given the following sequence of actions: 1. embed scheme 2. call scheme (and return to embedding environment) 3. do some stuff (in embedding env) 4. call scheme again How can I make sure, that the environment used in step 4 has the exact same bindings etc. like that used in step 2 if I have no control over the scheme code running there? I tried with - embedding all over again - by replacing the environment via scheme_basic_env() but both without success (they crash with what at first sight seem to be invalid pointer dereferences). Is there a protocol I'd have to follow? Where can I find it documented? Thanks in advance for any hints! Thomas From yyzan9 at gmail.com Fri Jul 3 10:47:34 2009 From: yyzan9 at gmail.com (yyzan9@gmail.com) Date: Fri Jul 3 11:19:28 2009 Subject: [plt-scheme] How to code the arrow-multiply calculus In-Reply-To: <20090702123149.2BE5D402E2@qua.cs.brown.edu> References: <20090702123149.2BE5D402E2@qua.cs.brown.edu> Message-ID: <172090901.141111246632454638.JavaMail.coremail@app8.yeah.net> The calculus called arrow-multiply is defined as : m!n := m*m*...*m (there are n integer to multiply ) m!!n := m!m!...!m (there are n integer to multiply ) m!!!n := m!!m!!...!!m (there are n integer to multiply ) -- ying yun zang ? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090703/1521dc3b/attachment.htm From acowley at gmail.com Fri Jul 3 11:15:28 2009 From: acowley at gmail.com (Anthony Cowley) Date: Fri Jul 3 11:22:56 2009 Subject: [plt-scheme] Number crunching -> Matthias, Eli In-Reply-To: References: <933247.80656.qm@web58801.mail.re1.yahoo.com> Message-ID: <81addec70907030815w5fb03039w240e8fae9b0eb78@mail.gmail.com> On Jul 3, 2009, at 4:38 AM, Noel Welsh wrote: > > Yeah, bind to a C library. > > Seriously. In my field -- machine learning, which is very numeric -- > most people find Matlab is plenty fast enough. PLT is faster than > Matlab... Some push back here: Matlab does a good job of integrating some very fast vector operations within a productive, dynamic environment. I'm surprised to hear you paint things so starkly coming from a machine learning perspective. While my experience is more in the area of computer vision and robotics, I have some overlap with machine learning, and the ability to transparently call fast matrix (sparse or otherwise) operations is tremendously valuable. I seldom use Matlab myself because its lack of expressiveness in general feels so restrictive, but I wouldn't claim that PLT Scheme is outright faster. The fact is, if I can reasonably represent my problem with Matlab's core data structures, then Matlab will be far faster than a native Scheme implementations. This isn't a criticism of anything, it's just a reflection of priorities. But if I decide that I'm going to use a non-native Scheme solution to close the performance gap in some specific areas, then a typical result is that some of my valued flexibility is lost because the mechanisms for, say, iterating through the data may have changed. I agree with you that a Scheme program augmented with native libraries can offer great performance, but a really solid integration of the two is not trivial. > The people who want more speed than PLT > + select C libraries provides AND would actually consider writing > numeric code in Scheme is 0 + epsilon. I'm probably in that epsilon, so I take my own feelings on the subject with a rather large grain of salt. :) > For example, a runtime that could take advantage of > multicore machines would benefit many more people that optimising > floating point calculations. I love performance as much as the next > guy -- my hard disk is littered with little compilers and so on -- but > it really isn't that important in the grand scheme of things. This is another area where I think many FP advocates tend to be a bit too glib. Being able to claim near linear performance scaling on today's 2-8 core machines is great, but to do so at the expense of 10-100x slower performance compared to, let's say C, is a really tough sales pitch! Many functional languages are dealing with that today; Clojure is a particularly interesting case because it has Java as a ready point of comparison, and Java is not exactly incapable of reasonably expressing concurrent programs. I think Haskell makes a very strong case for itself by most definitely *not* ignoring single-threaded speed. If a functional language is within striking distance of C's performance, then I think it's fine to say that easier parallelism negates that difference. But if you're giving up orders of magnitude up front, then gains down the road have too much distance to make up. All that is to make the following (hopefully) non-controversial point: it is possible for PLT Scheme's numeric code to be faster, and it would be great if it was. Anthony From pocmatos at gmail.com Fri Jul 3 12:19:47 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri Jul 3 12:20:30 2009 Subject: [plt-scheme] RE: trace In-Reply-To: <63bb19ae0907030631m5c582adcte9df74a662204f6b@mail.gmail.com> References: <11b141710907030622g481d432s3f93e198981e7c15@mail.gmail.com> <63bb19ae0907030631m5c582adcte9df74a662204f6b@mail.gmail.com> Message-ID: <11b141710907030919g5241cc8ci43f5ce97725fdb29@mail.gmail.com> On Fri, Jul 3, 2009 at 2:31 PM, Sam TH wrote: > On Fri, Jul 3, 2009 at 9:22 AM, Paulo J. Matos wrote: >> On Thu, Jul 2, 2009 at 1:17 AM, Skeptic . wrote: >>> >>> >>> Nobody ? >>> >> >> Since the pros didn't say anything. No, I don't think [unfortunately] >> that the trace module has been ported to the recent versions. > > That's not correct, `mzlib/trace' works just fine. A pro spoke... Thanks for correcting me Sam... > >> >>> >>>> To: plt-scheme@list.cs.brown.edu >>>> Subject: trace >>>> Date: Mon, 29 Jun 2009 11:59:19 -0400 >>>> >>>> >>>> >>>> Hi, >>>> Has the legacy mzlib/trace been replaced by somehing else ? >>>> Thanks >>> >>> >>> _________________________________________________________________ >>> Attention ? tous les Humains. Nous sommes vos photos. Lib?rez-nous de vos disques durs. >>> http://go.microsoft.com/?linkid=9666050_________________________________________________ >>> ?For list-related administrative tasks: >>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >> >> >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> http://www.pmatos.net >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > > -- > sam th > samth@ccs.neu.edu > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From pocmatos at gmail.com Fri Jul 3 13:43:27 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri Jul 3 13:44:08 2009 Subject: [plt-scheme] Re: Standard module resolver issue In-Reply-To: <11b141710907021239p51897f9cy50a0260fffd039d0@mail.gmail.com> References: <11b141710907021239p51897f9cy50a0260fffd039d0@mail.gmail.com> Message-ID: <11b141710907031043o119a2d51lc19e49e23e6ac972@mail.gmail.com> On Thu, Jul 2, 2009 at 8:39 PM, Paulo J. Matos wrote: > Hi all, > > Part of some software I have, is about generating code in runtime as a > unit, loading it, linking the unit and executing and if I run > everything in DrScheme it works perfectly. As soon as I compile it > with mzc and run it, I get: > standard-module-name-resolver: collection not found: > # in any of: > (#) > > ?=== context === > loop > > Any suggestions where the problem lies? > Interestingly enough, after soft linking /home/sorgematos/eboc/collects to the PLT collects directory, I get: define-compound-unit: unit argument expects an untagged import with signature search^, which this usage context does not supply === context === /usr/local/lib/plt/collects/mzlib/private/unit-runtime.ss:66:4: loop /usr/local/lib/plt/collects/mzlib/private/unit-runtime.ss:132:2: check-sigs /home/sorgematos/eboc/src/modes/esmc-mode.scm:45:35 loop I am not really understanding the best way to distribute my program. It's doing the following: Generating a scheme file with a unit. This file is loaded through dynamic-require and the unit is obtained. It is then linked and invoked. Everything works perfectly inside DrScheme. When compiling it with mzc, I get first the collects problem and then the one above which I don't really understand. Can someone tip me off on how to solve this and the best way to deploy a program like this one? Should I distribute with my program the whole plt collects directory? Cheers, Paulo Matos > Cheers, > > -- > Paulo Jorge Matos - pocmatos at gmail.com > http://www.pmatos.net > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From yinso.chen at gmail.com Fri Jul 3 15:13:04 2009 From: yinso.chen at gmail.com (YC) Date: Fri Jul 3 15:13:26 2009 Subject: [plt-scheme] On-demand module reloading In-Reply-To: References: Message-ID: <779bf2730907031213v2ca37e11g7739d7ef942b2937@mail.gmail.com> On Fri, Jul 3, 2009 at 2:21 AM, Noel Welsh wrote: > Hello, > > It would be a big productivity boost for certain applications to have > on demand module loading. This means something like scheme/enter: scan > the filesystem and reload any modules that have changed since the last > time the code was run. > > Is there any downside to just using scheme/enter? Scanning the code, > it seems the use of [compile-enforce-module-constants #f] will slow > things down. I can't see any other downside, and it should be possible > to get around this by loading the code into a new namespace each time. > IIRC, scheme/enter works at the top-level and "enters" into the namespace of the module you are loading. My guess is that you are looking for something similar to what I asked about in the following thread: http://list.cs.brown.edu/pipermail/plt-scheme/2008-October/028094.html I implemented a mechanism call dyn-require that mimics dynamic-require, which checks whether the module had changed and reload if necessary. The basic idea is to replace (dynamic-require 'symbol) to (dyn-require 'symbol) This doesn't handle dependency reloading (I thought about it but it seems to open a can of worms so I didn't go down that route) and can share dependencies as well (to ensure the depended structs are the same ones). If this sounds like what you are looking for - let me know and I'll send you the code. Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090703/4e4b549d/attachment.htm From lordgeoffrey at optushome.com.au Fri Jul 3 15:58:11 2009 From: lordgeoffrey at optushome.com.au (LordGeoffrey) Date: Fri Jul 3 15:58:34 2009 Subject: [plt-scheme] how to print rnrs-hashtables-6 ? Message-ID: <4A4E62D3.70804@optushome.com.au> I want to print (and read) r6rs hashtables, i.e. those made with (make-hashtable) . There is built in support for printing (make-hash) hashes. But that doesn't extend to the above. Any suggestions? From pocmatos at gmail.com Fri Jul 3 19:01:38 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri Jul 3 19:02:19 2009 Subject: [plt-scheme] Re: Standard module resolver issue In-Reply-To: <11b141710907031043o119a2d51lc19e49e23e6ac972@mail.gmail.com> References: <11b141710907021239p51897f9cy50a0260fffd039d0@mail.gmail.com> <11b141710907031043o119a2d51lc19e49e23e6ac972@mail.gmail.com> Message-ID: <11b141710907031601s34506e98r16442ee49e12f36f@mail.gmail.com> I managed to create a small example depicting what's happening: test-sig.scm: #lang scheme (define-signature test^ (x)) (provide test^) ================== END gen.scm: #lang scheme (require "test-sig.scm") (define (generate) (let ([filename (make-temporary-file)]) (call-with-output-file filename #:mode 'text #:exists 'replace (lambda (fp) (fprintf fp "#lang scheme~n~n") (fprintf fp "(require (file \"/home/sorgematos/Temp/test-sig.scm\"))") (fprintf fp "(provide test@)") (fprintf fp "(define-unit test@ (import test^) (export)~n") (fprintf fp "(* x 2)") (fprintf fp ")"))); closes define-unit filename)) (let* ([file (generate)] [test@ (dynamic-require file 'test@)] [x 5] [result (invoke-unit test@ (import test^))]) (printf "Result: ~a~n" result)) ================== END They are in the same directory: /home/sorgematos/Temp/ Now, running gen.scm inside DrScheme works perfectly and prints : Result: 10 However, in the terminal with PLT Scheme 4.2 I get the following interaction: sorgematos@sorgematos-laptop:~/Temp$ mzc --exe gen gen.scm sorgematos@sorgematos-laptop:~/Temp$ ./gen standard-module-name-resolver: collection not found: # in any of: (#) sorgematos@sorgematos-laptop:~/Temp$ ln -s /usr/local/lib/plt/collects/ ../collects sorgematos@sorgematos-laptop:~/Temp$ ./gen define-compound-unit: unit argument expects an untagged import with signature test^, which this usage context does not supply === context === /usr/local/lib/plt/collects/mzlib/private/unit-runtime.ss:66:4: loop /usr/local/lib/plt/collects/mzlib/private/unit-runtime.ss:132:2: check-sigs Any suggestions or comments on this? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From yinso.chen at gmail.com Fri Jul 3 19:12:36 2009 From: yinso.chen at gmail.com (YC) Date: Fri Jul 3 19:12:57 2009 Subject: [plt-scheme] Number crunching -> Matthias, Eli In-Reply-To: <81addec70907030815w5fb03039w240e8fae9b0eb78@mail.gmail.com> References: <933247.80656.qm@web58801.mail.re1.yahoo.com> <81addec70907030815w5fb03039w240e8fae9b0eb78@mail.gmail.com> Message-ID: <779bf2730907031612m65b78b9bj1b5fa705caf18a52@mail.gmail.com> On Fri, Jul 3, 2009 at 8:15 AM, Anthony Cowley wrote: > > > For example, a runtime that could take advantage of > > multicore machines would benefit many more people that optimising > > floating point calculations. I love performance as much as the next > > guy -- my hard disk is littered with little compilers and so on -- but > > it really isn't that important in the grand scheme of things. > > This is another area where I think many FP advocates tend to be a bit > too glib. Being able to claim near linear performance scaling on > today's 2-8 core machines is great, but to do so at the expense of > 10-100x slower performance compared to, let's say C, is a really tough > sales pitch! Many functional languages are dealing with that today; > Clojure is a particularly interesting case because it has Java as a > ready point of comparison, and Java is not exactly incapable of > reasonably expressing concurrent programs. I think Haskell makes a > very strong case for itself by most definitely *not* ignoring > single-threaded speed. If a functional language is within striking > distance of C's performance, then I think it's fine to say that easier > parallelism negates that difference. But if you're giving up orders of > magnitude up front, then gains down the road have too much distance to > make up. > Hmm... are you sure people are claiming concurrency scaling will beat sequential speedup? Maybe really fast FP such as ocaml or clean are making these claims, but I have not heard of it here. IMHO multicore is not meant to be "faster" - it's meant to do more things. Ruby and javascript have proven that for many things you don't need speed. And if you truly need speed, C might not even be fast enough and you'll need assembly. But many apps need multi-threads, especially things like server apps. In such instances, multicore is very important. IMO this is a matter of priority and where best to stake down. As Noel said, there aren't too many Matthew Flatts around, and my vote (if this is up for vote) would be to put the effort behind multicore than to improve sequential speed, since C already dominated that arena with many excellent reusable libs and can be binded (although not trivial), and multicore is where the world is going to be. Let's skate to where the puck will be. (and multicore is needed when you want to use FFI without blocking all other scheme threads). Cheers, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090703/90cc9632/attachment-0001.html From yinso.chen at gmail.com Fri Jul 3 19:25:19 2009 From: yinso.chen at gmail.com (YC) Date: Fri Jul 3 19:25:41 2009 Subject: [plt-scheme] Re: Standard module resolver issue In-Reply-To: <11b141710907031601s34506e98r16442ee49e12f36f@mail.gmail.com> References: <11b141710907021239p51897f9cy50a0260fffd039d0@mail.gmail.com> <11b141710907031043o119a2d51lc19e49e23e6ac972@mail.gmail.com> <11b141710907031601s34506e98r16442ee49e12f36f@mail.gmail.com> Message-ID: <779bf2730907031625s634dcd62l5691aa62d92ffbb7@mail.gmail.com> what happens when you try to run it in REPL? I tried it and except having to change the hardcoded path, it works. On Fri, Jul 3, 2009 at 4:01 PM, Paulo J. Matos wrote: > I managed to create a small example depicting what's happening: > test-sig.scm: > #lang scheme > > (define-signature test^ > (x)) > > (provide test^) > ================== END > > > gen.scm: > #lang scheme > > (require "test-sig.scm") > > (define (generate) > (let ([filename (make-temporary-file)]) > (call-with-output-file filename > #:mode 'text > #:exists 'replace > (lambda (fp) > (fprintf fp "#lang scheme~n~n") > (fprintf fp "(require (file > \"/home/sorgematos/Temp/test-sig.scm\"))") > (fprintf fp "(provide test@)") > (fprintf fp "(define-unit test@ (import test^) (export)~n") > (fprintf fp "(* x 2)") > (fprintf fp ")"))); closes define-unit > filename)) > > (let* ([file (generate)] > [test@ (dynamic-require file 'test@)] > [x 5] > [result (invoke-unit test@ (import test^))]) > (printf "Result: ~a~n" result)) > > ================== END > > They are in the same directory: /home/sorgematos/Temp/ > > Now, running gen.scm inside DrScheme works perfectly and prints : > Result: 10 > > However, in the terminal with PLT Scheme 4.2 I get the following > interaction: > sorgematos@sorgematos-laptop:~/Temp$ mzc --exe gen gen.scm > sorgematos@sorgematos-laptop:~/Temp$ ./gen > standard-module-name-resolver: collection not found: > # in any of: (#) > sorgematos@sorgematos-laptop:~/Temp$ ln -s > /usr/local/lib/plt/collects/ ../collects > sorgematos@sorgematos-laptop:~/Temp$ ./gen > define-compound-unit: unit argument expects an untagged import with > signature test^, which this usage context does not supply > > === context === > /usr/local/lib/plt/collects/mzlib/private/unit-runtime.ss:66:4: loop > /usr/local/lib/plt/collects/mzlib/private/unit-runtime.ss:132:2: check-sigs > > > > Any suggestions or comments on this? > > Cheers, > > -- > Paulo Jorge Matos - pocmatos at gmail.com > http://www.pmatos.net > _________________________________________________ > 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/20090703/6b6a36fa/attachment.htm From acowley at seas.upenn.edu Fri Jul 3 20:06:59 2009 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Fri Jul 3 20:07:18 2009 Subject: [plt-scheme] Number crunching -> Matthias, Eli In-Reply-To: <779bf2730907031612m65b78b9bj1b5fa705caf18a52@mail.gmail.com> References: <933247.80656.qm@web58801.mail.re1.yahoo.com> <81addec70907030815w5fb03039w240e8fae9b0eb78@mail.gmail.com> <779bf2730907031612m65b78b9bj1b5fa705caf18a52@mail.gmail.com> Message-ID: <81addec70907031706g7a7f5397j175445a06c68e7b1@mail.gmail.com> On Fri, Jul 3, 2009 at 7:12 PM, YC wrote: > > On Fri, Jul 3, 2009 at 8:15 AM, Anthony Cowley wrote: >> >> > For example, a runtime that could take advantage of >> > multicore machines would benefit many more people that optimising >> > floating point calculations. I love performance as much as the next >> > guy -- my hard disk is littered with little compilers and so on -- but >> > it really isn't that important in the grand scheme of things. >> >> This is another area where I think many FP advocates tend to be a bit >> too glib. > Hmm... are you sure people are claiming concurrency scaling will beat > sequential speedup?? Maybe really fast FP such as ocaml or clean are making > these claims, but I have not heard of it here. The original post was about the speed of numerics, and the response suggested that taking advantage of multiple cores is more important. If that was meant as a non sequitur, then consider my message another. At the risk of dredging up cliches: an oft cited benefit of FP is that it makes concurrent programming easier for the familiar reasons (immutable data, referential transparency). One is told that concurrent programming is important because CPUs are not getting faster like they used to, and, instead, increased performance must now be obtained by exploiting the multi-core CPUs users now have. Both of these are true statements, but they suggest a composition that is hard to realize in practice (which was my, perhaps buried, point). That is, looking for speed today means parallel execution, which is typically more elegantly expressed in a functional language, which is slower than an imperative language, which leaves the programmer high and unfortunately dry. I'm all for a multi-threaded PLT Scheme runtime or whatever the PLT'ers decide they wish to pursue, but I don't think that implies that single-threaded performance is somehow a done deal. As one who does use multiple cores for performance reasons, I rile when others dismiss my pain :P I should have opened my message by noting that I am currently writing a lot of C code that I wish didn't have to be in C, perhaps that would have set the right tone. Anthony From eli at barzilay.org Fri Jul 3 21:57:03 2009 From: eli at barzilay.org (Eli Barzilay) Date: Fri Jul 3 21:57:26 2009 Subject: [plt-scheme] On-demand module reloading In-Reply-To: <779bf2730907031213v2ca37e11g7739d7ef942b2937@mail.gmail.com> References: <779bf2730907031213v2ca37e11g7739d7ef942b2937@mail.gmail.com> Message-ID: <19022.46831.572823.361081@winooski.ccs.neu.edu> On Jul 3, YC wrote: > > I implemented a mechanism call dyn-require that mimics dynamic-require, > which checks whether the module had changed and reload if necessary. > > The basic idea is to replace > > (dynamic-require 'symbol) > > to > > (dyn-require 'symbol) > > This doesn't handle dependency reloading (I thought about it but it > seems to open a can of worms so I didn't go down that route) and can > share dependencies as well (to ensure the depended structs are the > same ones). See also "collects/handin-server/private/reloadable.ss". -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From dyrueta at gmail.com Sat Jul 4 01:34:06 2009 From: dyrueta at gmail.com (David Yrueta) Date: Sat Jul 4 01:34:45 2009 Subject: [plt-scheme] HtDP 27.3.2 and 27.3.4 Message-ID: <186df66b0907032234i47de4fa0g6576c89d1fb62df7@mail.gmail.com> Hi All -- Questions for both exercises refer to the function "find-root" below: ;; find-root : (number -> number) number number -> number ;; to determine a number R such that f has a ;; root between R and (+ R TOLERANCE) ;; ;; ASSUMPTION: f is continuous and monotonic (define (find-root f left right) (cond [(<= (- right left) TOLERANCE) left] [else (local ((define mid (/ (+ left right) 2))) (cond [(<= (f mid) 0 (f right)) (find-root f mid right)] [else (find-root f left mid)]))])) ;; poly : number -> number (define (poly x) (* (- x 2) (- x 4))) HtDP exercise 27.3.2: "Use poly from 27.3.1 to test find-root. Experiment with different values for TOLERANCE. Use the strategy of section 17.8 to formulate the tests as boolean-valued expressions." Are these tests meant to take place inside or outside the body of "find-root." In other words, are they conditional expressions inside "find-root"? If not, how are these tests different from a typical "check-expect?" (check-expect (find-root poly 3 6) 3.75) HtDP exercise 27.3.4 "For every midpoint m, except for the last one, the function find-root needs to determine the value of (f m) twice. Validate this claim for one example with a hand-evaluation." For the life of me, I don't see (f m) computed twice for every midpoint. "Mid" is obviously computed twice, but I only see "(f mid)" computed once per call. Am I missing something totally obvious? Thanks! Dave Yrueta From hsmyers at gmail.com Sat Jul 4 03:44:42 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Sat Jul 4 03:45:22 2009 Subject: [plt-scheme] GUI editor simple example Message-ID: <408995400907040044v7402c317x6fa0879a9b930464@mail.gmail.com> Given: (define f (new frame% [label "Simple Edit"] [width 200] [height 200])) (define c (new editor-canvas% [parent f])) (define t (new text%)) (send c set-editor t) How do I control the initial font? How do I insert a line of text? Lines? These are things I expected to find in section 1.3 Editor of the docs. I can see references to things that I am sure are connected to these questions; snips and styles, but neither nor example sufficient to do the deed. I'm sure that I'm looking in the wrong place but I've no idea of where else to look in the 400+ page document. Tips? Suggestions? Links? --hsm From hsmyers at gmail.com Sat Jul 4 04:06:29 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Sat Jul 4 04:07:16 2009 Subject: [plt-scheme] leading in GUI text Message-ID: <408995400907040106x4cedecd4qb4b10a38bac1bdc9@mail.gmail.com> The docs say: (new text% [ [line-spacing line-spacing] [tab-stops tab-stops] [auto-wrap auto-wrap]]) ? (is-a?/c text%) line-spacing : (and/c real? (not/c negative?)) = 1.0 tab-stops : (listof real?) = null auto-wrap : any/c = #f The line-spacing argument sets the additional amount of space (in DC units) inserted between each line in the editor when the editor is displayed. This spacing is included in the reported height of each line. The part that I wonder about is "sets the additional amount of space" Additional to what. In typesetting, leading is just that, the space between lines. Originally made of lead, hence the name. So what else is involved and how might one control same. In setting of chess diagrams, I need the leading to be zero else the diagram will have nasty little bits of white space. --hsm From pocmatos at gmail.com Sat Jul 4 04:27:24 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sat Jul 4 04:28:07 2009 Subject: [plt-scheme] Re: Standard module resolver issue In-Reply-To: <779bf2730907031625s634dcd62l5691aa62d92ffbb7@mail.gmail.com> References: <11b141710907021239p51897f9cy50a0260fffd039d0@mail.gmail.com> <11b141710907031043o119a2d51lc19e49e23e6ac972@mail.gmail.com> <11b141710907031601s34506e98r16442ee49e12f36f@mail.gmail.com> <779bf2730907031625s634dcd62l5691aa62d92ffbb7@mail.gmail.com> Message-ID: <11b141710907040127r4dfabdbev7666e19c70b9013c@mail.gmail.com> On Sat, Jul 4, 2009 at 12:25 AM, YC wrote: > what happens when you try to run it in REPL?? I tried it and except having > to change the hardcoded path, it works. > What do you mean in the REPL? you mean mzscheme? How did it work on yours? After compilation or in DrScheme? As I said, the executable doesn't work and produces the error but indeed inside DrScheme it works ok. > On Fri, Jul 3, 2009 at 4:01 PM, Paulo J. Matos wrote: >> >> I managed to create a small example depicting what's happening: >> test-sig.scm: >> #lang scheme >> >> (define-signature test^ >> ?(x)) >> >> (provide test^) >> ================== END >> >> >> gen.scm: >> #lang scheme >> >> (require "test-sig.scm") >> >> (define (generate) >> ?(let ([filename (make-temporary-file)]) >> ? ?(call-with-output-file filename >> ? ? ?#:mode 'text >> ? ? ?#:exists 'replace >> ? ? ?(lambda (fp) >> ? ? ? ?(fprintf fp "#lang scheme~n~n") >> ? ? ? ?(fprintf fp "(require (file >> \"/home/sorgematos/Temp/test-sig.scm\"))") >> ? ? ? ?(fprintf fp "(provide test@)") >> ? ? ? ?(fprintf fp "(define-unit test@ (import test^) (export)~n") >> ? ? ? ?(fprintf fp "(* x 2)") >> ? ? ? ?(fprintf fp ")"))); closes define-unit >> ? ?filename)) >> >> (let* ([file (generate)] >> ? ? ? [test@ (dynamic-require file 'test@)] >> ? ? ? [x 5] >> ? ? ? [result (invoke-unit test@ (import test^))]) >> ?(printf "Result: ~a~n" result)) >> >> ================== END >> >> They are in the same directory: /home/sorgematos/Temp/ >> >> Now, running gen.scm inside DrScheme works perfectly and prints : >> Result: 10 >> >> However, in the terminal with PLT Scheme 4.2 I get the following >> interaction: >> sorgematos@sorgematos-laptop:~/Temp$ mzc --exe gen gen.scm >> sorgematos@sorgematos-laptop:~/Temp$ ./gen >> standard-module-name-resolver: collection not found: >> # in any of: (#) >> sorgematos@sorgematos-laptop:~/Temp$ ln -s >> /usr/local/lib/plt/collects/ ../collects >> sorgematos@sorgematos-laptop:~/Temp$ ./gen >> define-compound-unit: unit argument expects an untagged import with >> signature test^, which this usage context does not supply >> >> ?=== context === >> /usr/local/lib/plt/collects/mzlib/private/unit-runtime.ss:66:4: loop >> /usr/local/lib/plt/collects/mzlib/private/unit-runtime.ss:132:2: >> check-sigs >> >> >> >> Any suggestions or comments on this? >> >> Cheers, >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> http://www.pmatos.net >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From hsmyers at gmail.com Sat Jul 4 05:58:25 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Sat Jul 4 05:59:06 2009 Subject: [plt-scheme] Re: Standard module resolver issue In-Reply-To: <11b141710907040127r4dfabdbev7666e19c70b9013c@mail.gmail.com> References: <11b141710907021239p51897f9cy50a0260fffd039d0@mail.gmail.com> <11b141710907031043o119a2d51lc19e49e23e6ac972@mail.gmail.com> <11b141710907031601s34506e98r16442ee49e12f36f@mail.gmail.com> <779bf2730907031625s634dcd62l5691aa62d92ffbb7@mail.gmail.com> <11b141710907040127r4dfabdbev7666e19c70b9013c@mail.gmail.com> Message-ID: <408995400907040258s2aa64aa9l8809034641ff524c@mail.gmail.com> In the REPL would be in your terms, 'inside DrScheme'. --hsm On Sat, Jul 4, 2009 at 2:27 AM, Paulo J. Matos wrote: > On Sat, Jul 4, 2009 at 12:25 AM, YC wrote: >> what happens when you try to run it in REPL?? I tried it and except having >> to change the hardcoded path, it works. >> > > What do you mean in the REPL? you mean mzscheme? > How did it work on yours? After compilation or in DrScheme? As I said, > the executable doesn't work and produces the error but indeed inside > DrScheme it works ok. > >> On Fri, Jul 3, 2009 at 4:01 PM, Paulo J. Matos wrote: >>> >>> I managed to create a small example depicting what's happening: >>> test-sig.scm: >>> #lang scheme >>> >>> (define-signature test^ >>> ?(x)) >>> >>> (provide test^) >>> ================== END >>> >>> >>> gen.scm: >>> #lang scheme >>> >>> (require "test-sig.scm") >>> >>> (define (generate) >>> ?(let ([filename (make-temporary-file)]) >>> ? ?(call-with-output-file filename >>> ? ? ?#:mode 'text >>> ? ? ?#:exists 'replace >>> ? ? ?(lambda (fp) >>> ? ? ? ?(fprintf fp "#lang scheme~n~n") >>> ? ? ? ?(fprintf fp "(require (file >>> \"/home/sorgematos/Temp/test-sig.scm\"))") >>> ? ? ? ?(fprintf fp "(provide test@)") >>> ? ? ? ?(fprintf fp "(define-unit test@ (import test^) (export)~n") >>> ? ? ? ?(fprintf fp "(* x 2)") >>> ? ? ? ?(fprintf fp ")"))); closes define-unit >>> ? ?filename)) >>> >>> (let* ([file (generate)] >>> ? ? ? [test@ (dynamic-require file 'test@)] >>> ? ? ? [x 5] >>> ? ? ? [result (invoke-unit test@ (import test^))]) >>> ?(printf "Result: ~a~n" result)) >>> >>> ================== END >>> >>> They are in the same directory: /home/sorgematos/Temp/ >>> >>> Now, running gen.scm inside DrScheme works perfectly and prints : >>> Result: 10 >>> >>> However, in the terminal with PLT Scheme 4.2 I get the following >>> interaction: >>> sorgematos@sorgematos-laptop:~/Temp$ mzc --exe gen gen.scm >>> sorgematos@sorgematos-laptop:~/Temp$ ./gen >>> standard-module-name-resolver: collection not found: >>> # in any of: (#) >>> sorgematos@sorgematos-laptop:~/Temp$ ln -s >>> /usr/local/lib/plt/collects/ ../collects >>> sorgematos@sorgematos-laptop:~/Temp$ ./gen >>> define-compound-unit: unit argument expects an untagged import with >>> signature test^, which this usage context does not supply >>> >>> ?=== context === >>> /usr/local/lib/plt/collects/mzlib/private/unit-runtime.ss:66:4: loop >>> /usr/local/lib/plt/collects/mzlib/private/unit-runtime.ss:132:2: >>> check-sigs >>> >>> >>> >>> Any suggestions or comments on this? >>> >>> Cheers, >>> >>> -- >>> Paulo Jorge Matos - pocmatos at gmail.com >>> http://www.pmatos.net >>> _________________________________________________ >>> ?For list-related administrative tasks: >>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > > > > -- > Paulo Jorge Matos - pocmatos at gmail.com > http://www.pmatos.net > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jos.koot at telefonica.net Sat Jul 4 06:37:26 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Sat Jul 4 06:38:10 2009 Subject: [plt-scheme] HtDP 27.3.2 and 27.3.4 References: <186df66b0907032234i47de4fa0g6576c89d1fb62df7@mail.gmail.com> Message-ID: <2A374AD0E94F494C864817A51D6DDCD4@uw2b2dff239c4d> With TOLERANCE 1/100 I find that poly is called with the following arguments: 9/2 6 15/4 9/2 33/8 9/2 63/16 33/8 129/32 33/8 255/64 129/32 513/128 129/32 1023/256 513/128 2049/512 513/128 For (poly 3 4) I find arguments: 7/2 4 15/4 4 31/8 4 63/16 4 127/32 4 255/64 4 511/128 4 Poly is called 7 times with the same argument 4. Can you now find out why f is called with the same argument more than once (how to avoid that? Jos ----- Original Message ----- From: "David Yrueta" To: "PLT-Scheme Mailing List" Sent: Saturday, July 04, 2009 7:34 AM Subject: [plt-scheme] HtDP 27.3.2 and 27.3.4 > Hi All -- > > Questions for both exercises refer to the function "find-root" below: > > ;; find-root : (number -> number) number number -> number > ;; to determine a number R such that f has a > ;; root between R and (+ R TOLERANCE) > ;; > ;; ASSUMPTION: f is continuous and monotonic > (define (find-root f left right) > (cond > [(<= (- right left) TOLERANCE) left] > [else > (local ((define mid (/ (+ left right) 2))) > (cond > [(<= (f mid) 0 (f right)) > (find-root f mid right)] > [else > (find-root f left mid)]))])) > > ;; poly : number -> number > (define (poly x) > (* (- x 2) (- x 4))) > > HtDP exercise 27.3.2: > > "Use poly from 27.3.1 to test find-root. Experiment with different > values for TOLERANCE. Use the strategy of section 17.8 to formulate > the tests as boolean-valued expressions." > > Are these tests meant to take place inside or outside the body of > "find-root." In other words, are they conditional expressions inside > "find-root"? If not, how are these tests different from a typical > "check-expect?" > > (check-expect (find-root poly 3 6) 3.75) > > HtDP exercise 27.3.4 > > "For every midpoint m, except for the last one, the function find-root > needs to determine the value of (f m) twice. Validate this claim for > one example with a hand-evaluation." > > For the life of me, I don't see (f m) computed twice for every > midpoint. "Mid" is obviously computed twice, but I only see "(f mid)" > computed once per call. Am I missing something totally obvious? > > Thanks! > Dave Yrueta > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jos.koot at telefonica.net Sat Jul 4 06:57:00 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Sat Jul 4 06:57:37 2009 Subject: [plt-scheme] printing exact rationals Message-ID: Defintions-window: #lang scheme 127/32 Interactions window: Welcome to DrScheme, version 4.2.0.5-svn2jul2009 [3m]. Language: Module; memory limit: 500 megabytes. 31 3-- 32 > IIRC there was somewhere an option or parameter to make this print as 127/32, but I no longer can find it. Somebody any idea? Thanks, Jos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090704/f9177a9a/attachment.html From pocmatos at gmail.com Sat Jul 4 07:09:28 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sat Jul 4 07:10:10 2009 Subject: [plt-scheme] Re: Standard module resolver issue In-Reply-To: <408995400907040258s2aa64aa9l8809034641ff524c@mail.gmail.com> References: <11b141710907021239p51897f9cy50a0260fffd039d0@mail.gmail.com> <11b141710907031043o119a2d51lc19e49e23e6ac972@mail.gmail.com> <11b141710907031601s34506e98r16442ee49e12f36f@mail.gmail.com> <779bf2730907031625s634dcd62l5691aa62d92ffbb7@mail.gmail.com> <11b141710907040127r4dfabdbev7666e19c70b9013c@mail.gmail.com> <408995400907040258s2aa64aa9l8809034641ff524c@mail.gmail.com> Message-ID: <11b141710907040409y45144a51v6e3fe9c8e276017@mail.gmail.com> On Sat, Jul 4, 2009 at 10:58 AM, Hugh Myers wrote: > In the REPL would be in your terms, 'inside DrScheme'. > Could also mean in the terminal through mzscheme... which by the way, also works, so I guess the problem is only with the compiled version. In my example: sorgematos@sorgematos-laptop:~/Temp$ mzscheme Welcome to MzScheme v4.2 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. > (require "gen.scm") Result: 10 > --hsm > > On Sat, Jul 4, 2009 at 2:27 AM, Paulo J. Matos wrote: >> On Sat, Jul 4, 2009 at 12:25 AM, YC wrote: >>> what happens when you try to run it in REPL?? I tried it and except having >>> to change the hardcoded path, it works. >>> >> >> What do you mean in the REPL? you mean mzscheme? >> How did it work on yours? After compilation or in DrScheme? As I said, >> the executable doesn't work and produces the error but indeed inside >> DrScheme it works ok. >> >>> On Fri, Jul 3, 2009 at 4:01 PM, Paulo J. Matos wrote: >>>> >>>> I managed to create a small example depicting what's happening: >>>> test-sig.scm: >>>> #lang scheme >>>> >>>> (define-signature test^ >>>> ?(x)) >>>> >>>> (provide test^) >>>> ================== END >>>> >>>> >>>> gen.scm: >>>> #lang scheme >>>> >>>> (require "test-sig.scm") >>>> >>>> (define (generate) >>>> ?(let ([filename (make-temporary-file)]) >>>> ? ?(call-with-output-file filename >>>> ? ? ?#:mode 'text >>>> ? ? ?#:exists 'replace >>>> ? ? ?(lambda (fp) >>>> ? ? ? ?(fprintf fp "#lang scheme~n~n") >>>> ? ? ? ?(fprintf fp "(require (file >>>> \"/home/sorgematos/Temp/test-sig.scm\"))") >>>> ? ? ? ?(fprintf fp "(provide test@)") >>>> ? ? ? ?(fprintf fp "(define-unit test@ (import test^) (export)~n") >>>> ? ? ? ?(fprintf fp "(* x 2)") >>>> ? ? ? ?(fprintf fp ")"))); closes define-unit >>>> ? ?filename)) >>>> >>>> (let* ([file (generate)] >>>> ? ? ? [test@ (dynamic-require file 'test@)] >>>> ? ? ? [x 5] >>>> ? ? ? [result (invoke-unit test@ (import test^))]) >>>> ?(printf "Result: ~a~n" result)) >>>> >>>> ================== END >>>> >>>> They are in the same directory: /home/sorgematos/Temp/ >>>> >>>> Now, running gen.scm inside DrScheme works perfectly and prints : >>>> Result: 10 >>>> >>>> However, in the terminal with PLT Scheme 4.2 I get the following >>>> interaction: >>>> sorgematos@sorgematos-laptop:~/Temp$ mzc --exe gen gen.scm >>>> sorgematos@sorgematos-laptop:~/Temp$ ./gen >>>> standard-module-name-resolver: collection not found: >>>> # in any of: (#) >>>> sorgematos@sorgematos-laptop:~/Temp$ ln -s >>>> /usr/local/lib/plt/collects/ ../collects >>>> sorgematos@sorgematos-laptop:~/Temp$ ./gen >>>> define-compound-unit: unit argument expects an untagged import with >>>> signature test^, which this usage context does not supply >>>> >>>> ?=== context === >>>> /usr/local/lib/plt/collects/mzlib/private/unit-runtime.ss:66:4: loop >>>> /usr/local/lib/plt/collects/mzlib/private/unit-runtime.ss:132:2: >>>> check-sigs >>>> >>>> >>>> >>>> Any suggestions or comments on this? >>>> >>>> Cheers, >>>> >>>> -- >>>> Paulo Jorge Matos - pocmatos at gmail.com >>>> http://www.pmatos.net >>>> _________________________________________________ >>>> ?For list-related administrative tasks: >>>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> >> >> >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> http://www.pmatos.net >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From jensaxel at soegaard.net Sat Jul 4 07:26:27 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Sat Jul 4 07:26:48 2009 Subject: [plt-scheme] HtDP 27.3.2 and 27.3.4 In-Reply-To: <186df66b0907032234i47de4fa0g6576c89d1fb62df7@mail.gmail.com> References: <186df66b0907032234i47de4fa0g6576c89d1fb62df7@mail.gmail.com> Message-ID: <4072c51f0907040426p4f3bf895g2f5d5a38cf077db7@mail.gmail.com> 2009/7/4 David Yrueta > Hi All -- > > Questions for both exercises refer to the function "find-root" below: > > ;; find-root : (number -> number) number number -> number > ;; to determine a number R such that f has a > ;; root between R and (+ R TOLERANCE) > ;; > ;; ASSUMPTION: f is continuous and monotonic > (define (find-root f left right) > (cond > [(<= (- right left) TOLERANCE) left] > [else > (local ((define mid (/ (+ left right) 2))) You might consider using floating points. Just change 2 to 2.0. -- Jens Axel S?gaard -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090704/24094b4b/attachment.htm From robby at eecs.northwestern.edu Sat Jul 4 08:32:35 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Jul 4 08:32:58 2009 Subject: [plt-scheme] printing exact rationals In-Reply-To: References: Message-ID: <932b2f1f0907040532p76344d6cn7409117dde514d59@mail.gmail.com> If you right-click on the number and choose a different format, that choice will be remembered for future printing. Robby On Sat, Jul 4, 2009 at 5:57 AM, Jos Koot wrote: > Defintions-window: > #lang scheme > 127/32 > > Interactions window: > Welcome to DrScheme, version 4.2.0.5-svn2jul2009 [3m]. > Language: Module; memory limit: 500 megabytes. > ?31 > 3-- > ?32 >> > > IIRC there was somewhere an option or parameter?to?make this?print as > 127/32, but I no longer can find it. Somebody any idea? > Thanks, Jos > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From mflatt at cs.utah.edu Sat Jul 4 08:35:22 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sat Jul 4 08:36:18 2009 Subject: [plt-scheme] Number crunching -> Matthias, Eli In-Reply-To: <779bf2730907031612m65b78b9bj1b5fa705caf18a52@mail.gmail.com> References: <933247.80656.qm@web58801.mail.re1.yahoo.com> <81addec70907030815w5fb03039w240e8fae9b0eb78@mail.gmail.com> <779bf2730907031612m65b78b9bj1b5fa705caf18a52@mail.gmail.com> Message-ID: <20090704123557.34285650116@mail-svr1.cs.utah.edu> For what it's worth, we're currently working on support for parallelism. ("We" mostly means Kevin Tew at Utah.) We also work continuously on performance in general, but it's interleaved with work on many other fronts. I imagine adding `*fx', etc. and some sort of `unsafe' directive, eventually. From jos.koot at telefonica.net Sat Jul 4 08:36:47 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Sat Jul 4 08:37:24 2009 Subject: [plt-scheme] printing exact rationals References: <932b2f1f0907040532p76344d6cn7409117dde514d59@mail.gmail.com> Message-ID: Thanks Jos ----- Original Message ----- From: "Robby Findler" To: "Jos Koot" Cc: Sent: Saturday, July 04, 2009 2:32 PM Subject: Re: [plt-scheme] printing exact rationals If you right-click on the number and choose a different format, that choice will be remembered for future printing. Robby On Sat, Jul 4, 2009 at 5:57 AM, Jos Koot wrote: > Defintions-window: > #lang scheme > 127/32 > > Interactions window: > Welcome to DrScheme, version 4.2.0.5-svn2jul2009 [3m]. > Language: Module; memory limit: 500 megabytes. > 31 > 3-- > 32 >> > > IIRC there was somewhere an option or parameter to make this print as > 127/32, but I no longer can find it. Somebody any idea? > Thanks, Jos > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From czhu at cs.utah.edu Sat Jul 4 08:46:01 2009 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Sat Jul 4 08:46:31 2009 Subject: [plt-scheme] how to print rnrs-hashtables-6 ? In-Reply-To: <4A4E62D3.70804@optushome.com.au> References: <4A4E62D3.70804@optushome.com.au> Message-ID: <4A4F4F09.2090100@cs.utah.edu> Unless you change the implementation of PLT/collects/rnrs/hashtables-6.ss, adding a prop:custom-write to the hashtable struct. Chongkai LordGeoffrey wrote: > I want to print (and read) r6rs hashtables, i.e. those made with > (make-hashtable) . > > There is built in support for printing (make-hash) hashes. But that > doesn't extend to the above. > > Any suggestions? > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mflatt at cs.utah.edu Sat Jul 4 08:48:03 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sat Jul 4 08:49:02 2009 Subject: [plt-scheme] leading in GUI text In-Reply-To: <408995400907040106x4cedecd4qb4b10a38bac1bdc9@mail.gmail.com> References: <408995400907040106x4cedecd4qb4b10a38bac1bdc9@mail.gmail.com> Message-ID: <20090704124838.C965E650100@mail-svr1.cs.utah.edu> At Sat, 4 Jul 2009 02:06:29 -0600, Hugh Myers wrote: > The docs say: > > (new text% [ [line-spacing line-spacing] > [tab-stops tab-stops] > [auto-wrap auto-wrap]]) ? (is-a?/c text%) > line-spacing : (and/c real? (not/c negative?)) = 1.0 > tab-stops : (listof real?) = null > auto-wrap : any/c = #f > > The line-spacing argument sets the additional amount of space (in DC > units) inserted between each line in the editor when the editor is > displayed. This spacing is included in the reported height of each > line. > > The part that I wonder about is "sets the additional amount of space" > Additional to what. Some fonts on some platforms have extra vertical space built in. I do not know why. That space is reported as the fourth result of `get-text-extent'. > In setting of chess > diagrams, I need the leading to be zero else the diagram will have > nasty little bits of white space. That sounds like exactly the sort of case where I've had to subtract the extra space built into a font to make the output look right. From mflatt at cs.utah.edu Sat Jul 4 09:13:24 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sat Jul 4 09:14:26 2009 Subject: [plt-scheme] Re: Standard module resolver issue In-Reply-To: <11b141710907031601s34506e98r16442ee49e12f36f@mail.gmail.com> References: <11b141710907021239p51897f9cy50a0260fffd039d0@mail.gmail.com> <11b141710907031043o119a2d51lc19e49e23e6ac972@mail.gmail.com> <11b141710907031601s34506e98r16442ee49e12f36f@mail.gmail.com> Message-ID: <20090704131357.D8A286500D9@mail-svr1.cs.utah.edu> There are two obstacles here: * Loading the generated program from source requires the `scheme/lang' reader, which normally would not be needed in an executable (since the code is all compiled). That's why you needed to add a link to the collection directory. An alternative is to build the executable like this: mzc --exe gen ++lib scheme/lang/reader gen.scm * The unit error comes from the fact that "test-sig.scm" is being instantiated twice, since it is reference through two different paths. I managed to trip over the same problem by adjusting the absolute path to "/tmp/test-sig.scm", but "/tmp" on my machine is a link to "/usr/tmp", and running `mzscheme' from the command line loaded "/usr/tmp/gen.scm" which in turn loaded "/usr/tmp/test-sig.scm". The generated module then used "/tmp/test-sig.scm". So there were two instances of the module, "/usr/tmp/test-sig.scm" and "/tmp/test-sig.scm", which means two different `test^'s, which means that the unit link has a mismatch. The same thing happens when you build an executable. For modules that are accessed through a path that was absolute or ultimately relative to the working directory, the copy in the executable lives in a kind of parallel filesystem. The "gen.scm" embedded in the executable used the copy from that parallel universe, while the generated module used the copy at "/home/sorgematos/Temp/". The simplest solution to this problem is to put "test-sig.scm" in a collection, so that it can be referenced in a filesystem-independent way. Then both the embedded module and the generated module will refer to the same one. At Sat, 4 Jul 2009 00:01:38 +0100, "Paulo J. Matos" wrote: > I managed to create a small example depicting what's happening: > test-sig.scm: > #lang scheme > > (define-signature test^ > (x)) > > (provide test^) > ================== END > > > gen.scm: > #lang scheme > > (require "test-sig.scm") > > (define (generate) > (let ([filename (make-temporary-file)]) > (call-with-output-file filename > #:mode 'text > #:exists 'replace > (lambda (fp) > (fprintf fp "#lang scheme~n~n") > (fprintf fp "(require (file \"/home/sorgematos/Temp/test-sig.scm\"))") > (fprintf fp "(provide test@)") > (fprintf fp "(define-unit test@ (import test^) (export)~n") > (fprintf fp "(* x 2)") > (fprintf fp ")"))); closes define-unit > filename)) > > (let* ([file (generate)] > [test@ (dynamic-require file 'test@)] > [x 5] > [result (invoke-unit test@ (import test^))]) > (printf "Result: ~a~n" result)) > > ================== END > > They are in the same directory: /home/sorgematos/Temp/ > > Now, running gen.scm inside DrScheme works perfectly and prints : > Result: 10 > > However, in the terminal with PLT Scheme 4.2 I get the following interaction: > sorgematos@sorgematos-laptop:~/Temp$ mzc --exe gen gen.scm > sorgematos@sorgematos-laptop:~/Temp$ ./gen > standard-module-name-resolver: collection not found: > # in any of: (#) > sorgematos@sorgematos-laptop:~/Temp$ ln -s > /usr/local/lib/plt/collects/ ../collects > sorgematos@sorgematos-laptop:~/Temp$ ./gen > define-compound-unit: unit argument expects an untagged import with > signature test^, which this usage context does not supply > > === context === > /usr/local/lib/plt/collects/mzlib/private/unit-runtime.ss:66:4: loop > /usr/local/lib/plt/collects/mzlib/private/unit-runtime.ss:132:2: check-sigs > > > > Any suggestions or comments on this? > > Cheers, > > -- > Paulo Jorge Matos - pocmatos at gmail.com > http://www.pmatos.net > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mflatt at cs.utah.edu Sat Jul 4 09:47:00 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sat Jul 4 09:47:55 2009 Subject: [plt-scheme] GUI editor simple example In-Reply-To: <408995400907040044v7402c317x6fa0879a9b930464@mail.gmail.com> References: <408995400907040044v7402c317x6fa0879a9b930464@mail.gmail.com> Message-ID: <20090704134732.E2A14650111@mail-svr1.cs.utah.edu> At Sat, 4 Jul 2009 01:44:42 -0600, Hugh Myers wrote: > Given: > > (define f (new frame% [label "Simple Edit"] > [width 200] > [height 200])) > (define c (new editor-canvas% [parent f])) > (define t (new text%)) > (send c set-editor t) > > How do I control the initial font? Setting the font is more complicated than it should be. You have to create a `style-delta%' (which has a poor API), and then apply the style delta with `change-style'. For example, to change the font to size 20: (send t change-style (make-object style-delta% 'change-size 20)) To set the font to "Times": (send t change-style (send (make-object style-delta%) set-delta-face "Times")) > How do I insert a line of text? (send t insert "Hello\n") > Lines? (send t insert "Hello\n") (send t insert "Goodbye\n") From pocmatos at gmail.com Sat Jul 4 10:04:08 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sat Jul 4 10:04:50 2009 Subject: [plt-scheme] Re: Standard module resolver issue In-Reply-To: <20090704131357.D8A286500D9@mail-svr1.cs.utah.edu> References: <11b141710907021239p51897f9cy50a0260fffd039d0@mail.gmail.com> <11b141710907031043o119a2d51lc19e49e23e6ac972@mail.gmail.com> <11b141710907031601s34506e98r16442ee49e12f36f@mail.gmail.com> <20090704131357.D8A286500D9@mail-svr1.cs.utah.edu> Message-ID: <11b141710907040704k1a71abfbhf70ab9636f0fc841@mail.gmail.com> On Sat, Jul 4, 2009 at 2:13 PM, Matthew Flatt wrote: > There are two obstacles here: > > ?* Loading the generated program from source requires the `scheme/lang' > ? reader, which normally would not be needed in an executable (since > ? the code is all compiled). That's why you needed to add a link to > ? the collection directory. An alternative is to build the executable > ? like this: > > ? ? ?mzc --exe gen ++lib scheme/lang/reader gen.scm > Hi Matthew, Thank you very much for taking your time to reply to this during weekend. The usage of flag ++lib indeed worked for me, I didn't know about it, now it is ok. > ?* The unit error comes from the fact that "test-sig.scm" is being > ? instantiated twice, since it is reference through two different > ? paths. > > ? I managed to trip over the same problem by adjusting the absolute > ? path to "/tmp/test-sig.scm", but "/tmp" on my machine is a link to > ? "/usr/tmp", and running `mzscheme' from the command line loaded > ? "/usr/tmp/gen.scm" which in turn loaded "/usr/tmp/test-sig.scm". The > ? generated module then used "/tmp/test-sig.scm". So there were two > ? instances of the module, "/usr/tmp/test-sig.scm" and > ? "/tmp/test-sig.scm", which means two different `test^'s, which means > ? that the unit link has a mismatch. > > ? The same thing happens when you build an executable. For modules > ? that are accessed through a path that was absolute or ultimately > ? relative to the working directory, the copy in the executable lives > ? in a kind of parallel filesystem. The "gen.scm" embedded in the > ? executable used the copy from that parallel universe, while the > ? generated module used the copy at "/home/sorgematos/Temp/". > > ? The simplest solution to this problem is to put "test-sig.scm" in a > ? collection, so that it can be referenced in a filesystem-independent > ? way. Then both the embedded module and the generated module will > ? refer to the same one. > That makes sense and once the program is 'installed' in a target computer that would the case anyway because test-sig.scm would have to reside in a lib/ somewhere. Thanks once again, Have a great weekend, Paulo Matos > At Sat, 4 Jul 2009 00:01:38 +0100, "Paulo J. Matos" wrote: >> I managed to create a small example depicting what's happening: >> test-sig.scm: >> #lang scheme >> >> (define-signature test^ >> ? (x)) >> >> (provide test^) >> ================== END >> >> >> gen.scm: >> #lang scheme >> >> (require "test-sig.scm") >> >> (define (generate) >> ? (let ([filename (make-temporary-file)]) >> ? ? (call-with-output-file filename >> ? ? ? #:mode 'text >> ? ? ? #:exists 'replace >> ? ? ? (lambda (fp) >> ? ? ? ? (fprintf fp "#lang scheme~n~n") >> ? ? ? ? (fprintf fp "(require (file \"/home/sorgematos/Temp/test-sig.scm\"))") >> ? ? ? ? (fprintf fp "(provide test@)") >> ? ? ? ? (fprintf fp "(define-unit test@ (import test^) (export)~n") >> ? ? ? ? (fprintf fp "(* x 2)") >> ? ? ? ? (fprintf fp ")"))); closes define-unit >> ? ? filename)) >> >> (let* ([file (generate)] >> ? ? ? ?[test@ (dynamic-require file 'test@)] >> ? ? ? ?[x 5] >> ? ? ? ?[result (invoke-unit test@ (import test^))]) >> ? (printf "Result: ~a~n" result)) >> >> ================== END >> >> They are in the same directory: /home/sorgematos/Temp/ >> >> Now, running gen.scm inside DrScheme works perfectly and prints : >> Result: 10 >> >> However, in the terminal with PLT Scheme 4.2 I get the following interaction: >> sorgematos@sorgematos-laptop:~/Temp$ mzc --exe gen gen.scm >> sorgematos@sorgematos-laptop:~/Temp$ ./gen >> standard-module-name-resolver: collection not found: >> # in any of: (#) >> sorgematos@sorgematos-laptop:~/Temp$ ln -s >> /usr/local/lib/plt/collects/ ../collects >> sorgematos@sorgematos-laptop:~/Temp$ ./gen >> define-compound-unit: unit argument expects an untagged import with >> signature test^, which this usage context does not supply >> >> ?=== context === >> /usr/local/lib/plt/collects/mzlib/private/unit-runtime.ss:66:4: loop >> /usr/local/lib/plt/collects/mzlib/private/unit-runtime.ss:132:2: check-sigs >> >> >> >> Any suggestions or comments on this? >> >> Cheers, >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> http://www.pmatos.net >> _________________________________________________ >> ? For list-related administrative tasks: >> ? http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From pocmatos at gmail.com Sat Jul 4 10:07:52 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sat Jul 4 10:08:34 2009 Subject: [plt-scheme] Reference for PLT-Scheme for paper Message-ID: <11b141710907040707g5eb4b779jcaa0b9fe18fdb567@mail.gmail.com> Hi all, I am preparing a paper for ICFEM'09 regarding the implementation of an explicit model checker for Event-B completely written in PLT Scheme. What's the best reference for PLT-Scheme? It seems that the first occurence of PLT-Scheme / DrScheme is: http://dblp.uni-trier.de/rec/bibtex/conf/plilp/FindlerFFKF97 but I am not so sure that this is the current best reference for the PLT Scheme project. Any suggestions? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From robby at eecs.northwestern.edu Sat Jul 4 10:22:59 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Jul 4 10:23:20 2009 Subject: [plt-scheme] Reference for PLT-Scheme for paper In-Reply-To: <11b141710907040707g5eb4b779jcaa0b9fe18fdb567@mail.gmail.com> References: <11b141710907040707g5eb4b779jcaa0b9fe18fdb567@mail.gmail.com> Message-ID: <932b2f1f0907040722y2f0e371i854719960294958b@mail.gmail.com> The journal followup to that is the right reference for DrScheme (just the PDE bit), but probably the best reference nowadays is probably one of these: http://www.plt-scheme.org/techreports/ Robby On Sat, Jul 4, 2009 at 9:07 AM, Paulo J. Matos wrote: > Hi all, > > I am preparing a paper for ICFEM'09 regarding the implementation of an > explicit model checker for Event-B completely written in PLT Scheme. > What's the best reference for PLT-Scheme? It seems that the first > occurence of PLT-Scheme / DrScheme is: > http://dblp.uni-trier.de/rec/bibtex/conf/plilp/FindlerFFKF97 > > but I am not so sure that this is the current best reference for the > PLT Scheme project. > Any suggestions? > > Cheers, > > -- > Paulo Jorge Matos - pocmatos at gmail.com > http://www.pmatos.net > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jos.koot at telefonica.net Sat Jul 4 10:25:42 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Sat Jul 4 10:26:16 2009 Subject: [plt-scheme] Reference for PLT-Scheme for paper References: <11b141710907040707g5eb4b779jcaa0b9fe18fdb567@mail.gmail.com> Message-ID: http://www.plt-scheme.org/ ? Jos ----- Original Message ----- From: "Paulo J. Matos" To: "PLT-Scheme Mailing List" Sent: Saturday, July 04, 2009 4:07 PM Subject: [plt-scheme] Reference for PLT-Scheme for paper > Hi all, > > I am preparing a paper for ICFEM'09 regarding the implementation of an > explicit model checker for Event-B completely written in PLT Scheme. > What's the best reference for PLT-Scheme? It seems that the first > occurence of PLT-Scheme / DrScheme is: > http://dblp.uni-trier.de/rec/bibtex/conf/plilp/FindlerFFKF97 > > but I am not so sure that this is the current best reference for the > PLT Scheme project. > Any suggestions? > > Cheers, > > -- > Paulo Jorge Matos - pocmatos at gmail.com > http://www.pmatos.net > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From mflatt at cs.utah.edu Sat Jul 4 10:26:44 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sat Jul 4 10:27:12 2009 Subject: [plt-scheme] Scribble and indented paragraphs Message-ID: <20090704142650.E2DE5650125@mail-svr1.cs.utah.edu> For those writing documents other than language and library documentation, Scribble now supports paragraphs that span blocks, which is useful with rendering styles that indent paragraphs. For example, to typeset something like To typeset a Scheme expression such as (+ 1 2) you can use the `schemeblock' form that is provided by Scribble. with just the first block of text indented, avoid a blank line between the blocks that compose the paragraph in the source, like this: To typeset a Scheme expression such as @blockquote[(+ 1 2)] you can use the @scheme[schemeblock] form that is provided by Scribble. or, as I prefer, like this: To typeset a Scheme expression such as @; @blockquote[(+ 1 2)] @; you can use the @scheme[schemeblock] form that is provided by Scribble. In the second form, the "@;" comment lines just break up the blocks in the source without breaking the paragraph. If you're just writing documentation, or if you're sure that you'll always want something like the default style, then it's still ok to use blank links in the source: To typeset a Scheme expression such as @blockquote[(+ 1 2)] you can use the @scheme[schemeblock] form that is provided by Scribble. Using blank lines technically generates three paragraphs. But since there's no difference in rendering for the style that we've chosen for documentation, we're not going to worry about the fine details of paragraphs in documentation sources. Support for paragraphs that span blocks is reflected in the Scribble API as a new "compound paragraph" datatype. A compound paragraph contains a sequence of blocks to be rendered as one conceptual paragraph, while the Scribble "paragraph" datatype still refers to a single block of text that contains no other blocks. A "blockquote", meanwhile, also groups a sequences of blocks, but its blocks are rendered as separate paragraphs (usually inset relative to the surrounding text, or with some other style change). From pocmatos at gmail.com Sat Jul 4 10:56:10 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sat Jul 4 10:56:53 2009 Subject: [plt-scheme] Re: Standard module resolver issue In-Reply-To: <20090704131357.D8A286500D9@mail-svr1.cs.utah.edu> References: <11b141710907021239p51897f9cy50a0260fffd039d0@mail.gmail.com> <11b141710907031043o119a2d51lc19e49e23e6ac972@mail.gmail.com> <11b141710907031601s34506e98r16442ee49e12f36f@mail.gmail.com> <20090704131357.D8A286500D9@mail-svr1.cs.utah.edu> Message-ID: <11b141710907040756t32fb8e1eg55fdb311cfaf7feb@mail.gmail.com> On Sat, Jul 4, 2009 at 2:13 PM, Matthew Flatt wrote: > ? The simplest solution to this problem is to put "test-sig.scm" in a > ? collection, so that it can be referenced in a filesystem-independent > ? way. Then both the embedded module and the generated module will > ? refer to the same one. > I tried to use a planet development link but in the compiled version with mzc I get: standard-module-name-resolver: collection not found: "planet" in any of: (#) === context === loop Do planet development links do not work with compiled programs? If not, how can I add paths to the standard-module-name-resolver? -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From tnovelli at gmail.com Sat Jul 4 10:54:32 2009 From: tnovelli at gmail.com (Tom Novelli) Date: Sat Jul 4 11:00:43 2009 Subject: [plt-scheme] select() and syscalls Message-ID: I'm curious... does PLT Scheme support POSIX 'select'? All I can find are Vyzo's 'socket' package and Matthew Flatt's mention of 'object-wait' 7 years ago: http://www.cs.utah.edu/plt/mailarch/plt-scheme-2002/msg00521.html (Yes, I'm interested in SCSH for PLT :-) In general, do I need to write C extensions to do syscalls, or is there a better way? Thanks, Tom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090704/4deb66b2/attachment.html From sk at cs.brown.edu Sat Jul 4 11:21:42 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sat Jul 4 11:22:21 2009 Subject: [plt-scheme] Reference for PLT-Scheme for paper In-Reply-To: References: <11b141710907040707g5eb4b779jcaa0b9fe18fdb567@mail.gmail.com> Message-ID: Dear Jos -- A Web site is not a formal citation. As such, it does not give academic credit to the software's authors, who are academics, and for whom academic citation is therefore a standard metric of credit. It's fine to also list the URL where relevant, but it's not the same. [And thanks to Paulo for asking. Personally, I just cite the 2002 DrScheme paper as a "catch-all" citation, unless the distinction matters.] Shriram From pocmatos at gmail.com Sat Jul 4 11:58:13 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sat Jul 4 11:58:56 2009 Subject: [plt-scheme] Re: Standard module resolver issue In-Reply-To: <11b141710907040756t32fb8e1eg55fdb311cfaf7feb@mail.gmail.com> References: <11b141710907021239p51897f9cy50a0260fffd039d0@mail.gmail.com> <11b141710907031043o119a2d51lc19e49e23e6ac972@mail.gmail.com> <11b141710907031601s34506e98r16442ee49e12f36f@mail.gmail.com> <20090704131357.D8A286500D9@mail-svr1.cs.utah.edu> <11b141710907040756t32fb8e1eg55fdb311cfaf7feb@mail.gmail.com> Message-ID: <11b141710907040858o3a4e2bc5vb2ccba3564b0405c@mail.gmail.com> On Sat, Jul 4, 2009 at 3:56 PM, Paulo J. Matos wrote: > On Sat, Jul 4, 2009 at 2:13 PM, Matthew Flatt wrote: >> ? The simplest solution to this problem is to put "test-sig.scm" in a >> ? collection, so that it can be referenced in a filesystem-independent >> ? way. Then both the embedded module and the generated module will >> ? refer to the same one. >> > > I tried to use a planet development link but in the compiled version > with mzc I get: > standard-module-name-resolver: collection not found: "planet" in any > of: (#) > > ?=== context === > loop > > Do planet development links do not work with compiled programs? > If not, how can I add paths to the standard-module-name-resolver? > Seems I was missing a ++lib planet/planet. :) > -- > Paulo Jorge Matos - pocmatos at gmail.com > http://www.pmatos.net > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From hsmyers at gmail.com Sat Jul 4 13:10:28 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Sat Jul 4 13:11:06 2009 Subject: [plt-scheme] GUI editor simple example In-Reply-To: <20090704134732.E2A14650111@mail-svr1.cs.utah.edu> References: <408995400907040044v7402c317x6fa0879a9b930464@mail.gmail.com> <20090704134732.E2A14650111@mail-svr1.cs.utah.edu> Message-ID: <408995400907041010w5caaa7eagb25a1ad28bc268e7@mail.gmail.com> Changing fonts always seems to be more complicated than it needs to be! :) Much thanks for the mini-example and info. --hsm On Sat, Jul 4, 2009 at 7:47 AM, Matthew Flatt wrote: > At Sat, 4 Jul 2009 01:44:42 -0600, Hugh Myers wrote: >> Given: >> >> (define f (new frame% [label "Simple Edit"] >> ? ? ? ? ? ? ? ? ? ? ? ? [width 200] >> ? ? ? ? ? ? ? ? ? ? ? ? [height 200])) >> ? (define c (new editor-canvas% [parent f])) >> ? (define t (new text%)) >> ? (send c set-editor t) >> >> How do I control the initial font? > > Setting the font is more complicated than it should be. You have to > create a `style-delta%' (which has a poor API), and then apply the > style delta with `change-style'. > > For example, to change the font to size 20: > > ?(send t change-style (make-object style-delta% 'change-size 20)) > > To set the font to "Times": > > ?(send t change-style (send (make-object style-delta%) > ? ? ? ? ? ? ? ? ? ? ? ? ? ?set-delta-face "Times")) > >> How do I insert a line of text? > > (send t insert "Hello\n") > >> Lines? > > (send t insert "Hello\n") > (send t insert "Goodbye\n") > > From hsmyers at gmail.com Sat Jul 4 13:12:56 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Sat Jul 4 13:13:34 2009 Subject: [plt-scheme] leading in GUI text In-Reply-To: <20090704124838.C965E650100@mail-svr1.cs.utah.edu> References: <408995400907040106x4cedecd4qb4b10a38bac1bdc9@mail.gmail.com> <20090704124838.C965E650100@mail-svr1.cs.utah.edu> Message-ID: <408995400907041012m65969dd4wf4cb9e4ad52e7b3c@mail.gmail.com> Well I'll play with negative values if I need to. Given the very wide variety out there in font-land, tweaking is the norm! :) --hsm On Sat, Jul 4, 2009 at 6:48 AM, Matthew Flatt wrote: > At Sat, 4 Jul 2009 02:06:29 -0600, Hugh Myers wrote: >> The docs say: >> >> (new text% [ [line-spacing line-spacing] >> [tab-stops tab-stops] >> [auto-wrap auto-wrap]]) ? (is-a?/c text%) >> line-spacing : (and/c real? (not/c negative?)) = 1.0 >> tab-stops : (listof real?) = null >> auto-wrap : any/c = #f >> >> The line-spacing argument sets the additional amount of space (in DC >> units) inserted between each line in the editor when the editor is >> displayed. This spacing is included in the reported height of each >> line. >> >> The part that I wonder about is "sets the additional amount of space" >> Additional to what. > > Some fonts on some platforms have extra vertical space built in. I do > not know why. That space is reported as the fourth result of > `get-text-extent'. > >> In setting of chess >> diagrams, I need the leading to be zero else the diagram will have >> nasty little bits of white space. > > That sounds like exactly the sort of case where I've had to subtract > the extra space built into a font to make the output look right. > > From dyrueta at gmail.com Sat Jul 4 13:38:47 2009 From: dyrueta at gmail.com (David Yrueta) Date: Sat Jul 4 13:39:28 2009 Subject: [plt-scheme] HtDP 27.3.2 and 27.3.4 In-Reply-To: <2A374AD0E94F494C864817A51D6DDCD4@uw2b2dff239c4d> References: <186df66b0907032234i47de4fa0g6576c89d1fb62df7@mail.gmail.com> <2A374AD0E94F494C864817A51D6DDCD4@uw2b2dff239c4d> Message-ID: <186df66b0907041038x50a38e74pd5cf1c9dee202b9d@mail.gmail.com> Thank you for the response, but I don't really get it.... For (poly 3 4) I find arguments: I recast this as a table to see if I could figure out what you're driving at: Step left (f left) right (f right) mid (f mid) diff 1 3 -1 4 0 3.5 -.75 -1 2 3.5 -.75 4 0 3.75 -.4375 -.5 3 3.75 -.4375 4 0 3.875 -.234375 -.25 4 3.875 -.234375 4 0 3.9375 -.1209... -.125 5 3.9375 -.12109... 4 0 3.96875 -.0615... -.0625 ... I can see that the value of 'right' remains constant, since with every call (<= (f mid) 0 (f right)) evaluates to true. But isn't that different from saying, as the exercise does, that with each midpoint (f mid) is computed twice? Thanks! On Sat, Jul 4, 2009 at 3:37 AM, Jos Koot wrote: > With TOLERANCE 1/100 I find that poly is called with the following > arguments: > 9/2 > 6 > 15/4 > 9/2 > 33/8 > 9/2 > 63/16 > 33/8 > 129/32 > 33/8 > 255/64 > 129/32 > 513/128 > 129/32 > 1023/256 > 513/128 > 2049/512 > 513/128 > > For (poly 3 4) I find arguments: > 7/2 > 4 > 15/4 > 4 > 31/8 > 4 > 63/16 > 4 > 127/32 > 4 > 255/64 > 4 > 511/128 > 4 > Poly is called 7 times with the same argument 4. > Can you now find out why f is called with the same argument more than once > (how to avoid that? > Jos > > ----- Original Message ----- From: "David Yrueta" > To: "PLT-Scheme Mailing List" > Sent: Saturday, July 04, 2009 7:34 AM > Subject: [plt-scheme] HtDP 27.3.2 and 27.3.4 > > >> Hi All -- >> >> Questions for both exercises refer to the function "find-root" below: >> >> ;; find-root : (number ?-> ?number) number number ?-> ?number >> ;; to determine a number R such that f has a >> ;; root between R and (+ R TOLERANCE) >> ;; >> ;; ASSUMPTION: f is continuous and monotonic >> (define (find-root f left right) >> ?(cond >> ? [(<= (- right left) TOLERANCE) left] >> ? [else >> ? ? (local ((define mid (/ (+ left right) 2))) >> (cond >> ?[(<= (f mid) 0 (f right)) >> ? ? ? ? ?(find-root f mid right)] >> ?[else >> ? ? ? ? ?(find-root f left mid)]))])) >> >> ;; poly : number ?-> ?number >> (define (poly x) >> (* (- x 2) (- x 4))) >> >> HtDP exercise 27.3.2: >> >> "Use poly from 27.3.1 to test find-root. Experiment with different >> values for TOLERANCE. Use the strategy of section 17.8 to formulate >> the tests as boolean-valued expressions." >> >> Are these tests meant to take place inside or outside the body of >> "find-root." In other words, are they conditional expressions inside >> "find-root"? ?If not, how are these tests different from a typical >> "check-expect?" >> >> (check-expect (find-root poly 3 6) 3.75) >> >> HtDP exercise 27.3.4 >> >> "For every midpoint m, except for the last one, the function find-root >> needs to determine the value of (f m) twice. Validate this claim for >> one example with a hand-evaluation." >> >> For the life of me, I don't see (f m) computed twice for every >> midpoint. ?"Mid" is obviously computed twice, but I only see "(f mid)" >> computed once per call. ?Am I missing something totally obvious? >> >> Thanks! >> Dave Yrueta >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > From phi500ac at yahoo.ca Sat Jul 4 14:13:26 2009 From: phi500ac at yahoo.ca (Philippos Apolinarius) Date: Sat Jul 4 14:20:21 2009 Subject: [plt-scheme] GUI editor simple example In-Reply-To: <20090704134732.E2A14650111@mail-svr1.cs.utah.edu> Message-ID: <453647.66043.qm@web58807.mail.re1.yahoo.com> What called my attention to PLT scheme was its editor, and unicode processing facilities.? I am a very poor writer. Therefore, since I know Ancient Greek, my teachers suggested reading and translating Homer to improve my writing skills. Homer wrote in a kind of language that has many similarities with Ancient Greek. The first step was to write an editor to deal with Homer's language (there aren't many of them around, you know :-) I tried to write the editor in Clean. However, Clean does not deal with Unicode strings at all. I switched to Bigloo. Although Bigloo has tools? to work with unicode, these tools are awkward, and I failed. To my surprise, PLT worked almost flawlessly with the Homeric text. I mean,? the IDE didn't work correctly, but the resulting program is almost perfect. Interesting enough, the only charcter that the editor does not renders well is ... lambda, the symbol of functional programming.? Below, you will find a simplified version of the module that produces a latex document from a unicode edition of the Odyssey (www.perseus.tufts.edu). Here are the first two lines of the Odyssey, with latex produced by the program: ????? ??? ??????, ?????, ??????????, ?? ???? ????? ???????, ???? ?????? ????? ?????????? ???????: >'andra moi >'ennepe, mo\~usa, pol'utropon, <`oc m'ala poll`a\\ pl'agqjh, >epe`i Tro'ihc 'epersen; (module greekfilter scheme/gui ?? ? (define (geragreek b n) ??? (cond ( (< n 1) '()) ????????? ( (cons (list b (list->string ??????????????????????????? (list(integer->char b)))) ????????????????? (geragreek (+ b 1) (- n 1)))))) ? ? (define (gb b n) ??? (geragreek b n)) ? ? (define gcod ???? '( ??????? (913 "A") (914 "B") (915 "G") (916 "D")(917 "E") ??????? (918 "Z") (919 "H") (920 "J") (921 "I") (922 "K") ??????? (923 "L") (924 "M") (925 "N") (926 "X") (927 "O") ??????? (928 "P") (929 "R") (931 "S") (932 "T") (933 "U") ??????? (934 "F") (935 "X") (936 "Y") (937 "W") ??????? (945 "a") (946 "b") (947 "g") (948 "d") (949 "e") ??????? (950 "z") (951 "h") (952 "j") (953 "i") (954 "k") ??????? (955 "l") (956 "m") (957 "n") (958 "x") (959 "o") ??????? (960 "p") (961 "r") (962 "c") (963 "s") (964 "t") ??????? (965 "u") (966 "f") (967 "q") (968 "y") (969 "w") ??????? ;; ???? ???? ???? ???? ??????? (7936 ">a") (7937 "`a") (7939 "<`a") ??????? (7940 ">'a") (7941 "<'a") (7942 "{\\char 146}") ??????? (7943 "\\char 145") ??????? (7944 ">A") (7945 "`A") (7947 "<'A") ??????? (7948 ">'A") (7949 "<'A") (7950 "\\~>A") (7951 "\\~e") (7953 "`e") ??????? (7955 "<`e") (7956 ">'e") (7957 "<'e") ??????? ;; ???? ??? ??????? (7960 ">E") (7961 "`E")? (7963 "<`E") (7964 ">'E") (7965 "<'E") ??????? ;; ???? ???? ???? ???? ??????? (7968 ">h") (7969 "`h") (7971 "<`h") ??????? (7972 ">'h") (7973 "<'h") (7974 "{\\ese}") (7975 "{\\hee}") ??????? (7976 ">H") (7977 "`H") (7979 "<`H") ??????? (7980 ">'H") (7981 "<'H") (7982 "\\~>H") ??????? (7983 "\\~w") (8033 "`w") (8035 "<`w") ??????? (8036 ">'w") (8037 "<'w") (8038 "{\\w}")? (8039 "{\\hw}") ??????? (8040 ">W") (8041 "`W")? (8043 "<`W") ??????? (8044 ">'W") (8045 "<'W") (8046 "\\~>W") (8047 "\\~o") (8001 "`o") (8003 "<`o")(8004 ">'o")(8005 "<'o") ??????? (8008 ">O")(8009 "`O") (8011 "<`O") (8012 ">'O") (8013 "<'O") ??????? ??????? (8016 ">u") (8017 "`u") (8019 "<`u") (8020 ">'u") (8021 "<'u") ??????? (8022 "{\\usu}") (8023 "{\\huu}") (8025 "r") (8165 "i") ??????? (7985 "`i") (7987 "<`i") (7988 ">'i") ??????? (7989 "<'i") (7990 "{\\ii}")? (7991 "{\\hii}") (7992 ">I") ??????? (7993 "`I")? (7995 "<`I") (7996 ">'I") ??????? (7997 "<'I") (7998 "\\~>") (7999 "\\~<") (8125 "\\e") ??????? (8178 "`w|") (8179 "w|") (8180 "'w|")?? (8182 "\\~w") ??????? (8183 "{\\wi}")??????? (8184 "`O")? (8185 "'O")??????? (8186 "`W")??????? ??????? (8187 "'W")??????? (8188 "Wi")? (8128 "\\~")??????? (8130 "`h|") ??????? (8131 "h|")??????? (8132 "'h|") ? (8134 "\\~h") (8135 "{\\eei}") ??????? (8136 "`E") (8137 "'E") (8138 "`H") (8139 "'H") ??????? (8140 "Hi") (8141 "{>`}") (8142 "{>'}") ? (8143 "\\~>") (8144 "{\\u i}") ??????? (8145 "{\\=i}") ??????? (8146 "`i") ;;? ??????? (8147 "'i") ;;? ??????? (8150 "\\~i") ??????? (8151 "\\~i") ;;? ??????? (8152 "I")? ;;? ??????? (8153 "\\=I") ;;? ??????? (8154 "`I") (8155 "'I") ??????? (8220 "{\\oq}") (8221 "{\\cq}")? (8064 ">a|") (8065 "`a|") (8067 "<`a|") (8068 ">'a|") (8069 "<'a|") ??????? (8070 "{\\char 150}") (8071 "{\\char 149}") ??????? (8080 ">h|") (8081 "`h|") (8083 "<`h|") ??????? (8084 ">'h|") (8085 "<'h|")? (8086 "{\\esei}") (8087 "{\\heei}") ? ??????? (8096 ">w|") (8097 "`w|") (8099 "<`w|") ??????? (8100 ">'w|") (8101 "<'w|")? (8102 "{\\wswi}") (8103 "{\\hwi}") ??????? (8104 ">Wi") (8105 "`Wi") (8107 "<`Wi") ??????? (8108 ">'Wi") (8109 "<'Wi")? (8110 "\\~>Wi") (8111 "\\~integer c) 255) c) ????????? (else (let ((x (assoc (char->integer c) gcod))) ???????????????????? (if x (cadr x) "*")))? )) ? ? (define di?logo ??? (new dialog% (label "GreekFilter"))) ? ? (define txt ??? (new text%)) ? ? (define edtxt ??? (new editor-canvas% [parent di?logo] ???????? [editor txt] ???????? (min-height 200) ???????? (min-width 500))) ? ? (define painel (new horizontal-panel% [parent di?logo] ????????????????????? (alignment '(center center)))) ? ? (define pasteButton ??? (new button% [parent painel] (label "Paste") ???????? (callback (lambda(b e) (send txt paste ))))) ? (define cpyButton ??? (new button% [parent painel] (label "Cut") ???????? (callback (lambda(b e) (send txt cut ))))) ? (define (convert b e) ???? (send txt insert ?????? (with-output-to-string ???????? (lambda() ?????????? (let ((s (send txt get-text))) ???????????? (newline)(newline) ??????????? (do ( (i 0 (+ i 1))) ??????????????? ( (>= i (string-length s))) ?????????????? (display (convert1 (string-ref s i))))))))) ? ? (define prtFirst ??? (new button% [parent painel] (label "2TEX") ???????? (callback convert))) ? ? (send di?logo show #t) ) --- On Sat, 7/4/09, Matthew Flatt wrote: From: Matthew Flatt Subject: Re: [plt-scheme] GUI editor simple example To: "Hugh Myers" Cc: plt-scheme@list.cs.brown.edu Received: Saturday, July 4, 2009, 7:47 AM At Sat, 4 Jul 2009 01:44:42 -0600, Hugh Myers wrote: > Given: > > (define f (new frame% [label "Simple Edit"] >? ? ? ? ? ? ? ? ? ? ? ???[width 200] >? ? ? ? ? ? ? ? ? ? ? ???[height 200])) >???(define c (new editor-canvas% [parent f])) >???(define t (new text%)) >???(send c set-editor t) > > How do I control the initial font? Setting the font is more complicated than it should be. You have to create a `style-delta%' (which has a poor API), and then apply the style delta with `change-style'. For example, to change the font to size 20: (send t change-style (make-object style-delta% 'change-size 20)) To set the font to "Times": (send t change-style (send (make-object style-delta%) ? ? ? ? ? ? ? ? ? ? ? ? ? ? set-delta-face "Times")) > How do I insert a line of text? (send t insert "Hello\n") > Lines? (send t insert "Hello\n") (send t insert "Goodbye\n") _________________________________________________ ? For list-related administrative tasks: ? http://list.cs.brown.edu/mailman/listinfo/plt-scheme __________________________________________________________________ Looking for the perfect gift? Give the gift of Flickr! http://www.flickr.com/gift/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090704/195a0547/attachment-0001.htm From dyrueta at gmail.com Sat Jul 4 17:33:33 2009 From: dyrueta at gmail.com (Dave) Date: Sat Jul 4 17:33:55 2009 Subject: [plt-scheme] Re: HtDP 27.3.2 and 27.3.4 In-Reply-To: <186df66b0907041038x50a38e74pd5cf1c9dee202b9d@mail.gmail.com> References: <186df66b0907032234i47de4fa0g6576c89d1fb62df7@mail.gmail.com> <2A374AD0E94F494C864817A51D6DDCD4@uw2b2dff239c4d> <186df66b0907041038x50a38e74pd5cf1c9dee202b9d@mail.gmail.com> Message-ID: <32907cbc-4cc6-4abc-8998-be9d6e0f8fa5@p18g2000pra.googlegroups.com> Grr..Sorry about that Jos -- The table was formatted when I sent it. If it matters, I'll redo it as a google spreadsheet and post a link. Thanks, Dave On Jul 4, 10:38?am, David Yrueta wrote: > Thank you for the response, but I don't really get it.... > > For (poly 3 4) I find arguments: > > I recast this as a table to see if I could figure out what you're driving at: > > Step ? ? left ? ? ? ? ?(f left) ? ? ? ? ? ? ? right ? ? (f right) > ? ? mid ? ? ? ? ? (f mid) ? ? ? ? ? ? ? diff > 1 ? ? ? ? ?3 ? ? ? ? ? ? -1 ? ? ? ? ? ? ? ? ? ?4 ? ? ? ? 0 > ? ? ? 3.5 ? ? ? ? ? ? -.75 ? ? ? ? ? ? ? ? -1 > 2 ? ? ? ? ?3.5 ? ? ? ? ?-.75 ? ? ? ? ? ? ? ? 4 ? ? ? ? ?0 > ? ? 3.75 ? ? ? ? ? -.4375 ? ? ? ? ? ? ?-.5 > 3 ? ? ? ? ?3.75 ? ? ? ?-.4375 ? ? ? ? ? ? ?4 ? ? ? ? ?0 > ? 3.875 ? ? ? ? -.234375 ? ? ? ? ?-.25 > 4 ? ? ? ? ?3.875 ? ? ?-.234375 ? ? ? ? ?4 ? ? ? ? ?0 > 3.9375 ? ? ? ?-.1209... ? ? ? ? ?-.125 > 5 ? ? ? ? ?3.9375 ? ?-.12109... ? ? ? ? 4 ? ? ? ? ?0 > 3.96875 ? ? ?-.0615... ? ? ? ? ?-.0625 > ... > > I can see that the value of 'right' remains constant, since with every > call (<= (f mid) 0 (f right)) evaluates to true. But isn't that > different from saying, as the exercise does, that with each midpoint > (f mid) is computed twice? > > Thanks! > > > > On Sat, Jul 4, 2009 at 3:37 AM, Jos Koot wrote: > > With TOLERANCE 1/100 I find that poly is called with the following > > arguments: > > 9/2 > > 6 > > 15/4 > > 9/2 > > 33/8 > > 9/2 > > 63/16 > > 33/8 > > 129/32 > > 33/8 > > 255/64 > > 129/32 > > 513/128 > > 129/32 > > 1023/256 > > 513/128 > > 2049/512 > > 513/128 > > > For (poly 3 4) I find arguments: > > 7/2 > > 4 > > 15/4 > > 4 > > 31/8 > > 4 > > 63/16 > > 4 > > 127/32 > > 4 > > 255/64 > > 4 > > 511/128 > > 4 > > Poly is called 7 times with the same argument 4. > > Can you now find out why f is called with the same argument more than once > > (how to avoid that? > > Jos > > > ----- Original Message ----- From: "David Yrueta" > > To: "PLT-Scheme Mailing List" > > Sent: Saturday, July 04, 2009 7:34 AM > > Subject: [plt-scheme] HtDP 27.3.2 and 27.3.4 > > >> Hi All -- > > >> Questions for both exercises refer to the function "find-root" below: > > >> ;; find-root : (number ?-> ?number) number number ?-> ?number > >> ;; to determine a number R such that f has a > >> ;; root between R and (+ R TOLERANCE) > >> ;; > >> ;; ASSUMPTION: f is continuous and monotonic > >> (define (find-root f left right) > >> ?(cond > >> ? [(<= (- right left) TOLERANCE) left] > >> ? [else > >> ? ? (local ((define mid (/ (+ left right) 2))) > >> (cond > >> ?[(<= (f mid) 0 (f right)) > >> ? ? ? ? ?(find-root f mid right)] > >> ?[else > >> ? ? ? ? ?(find-root f left mid)]))])) > > >> ;; poly : number ?-> ?number > >> (define (poly x) > >> (* (- x 2) (- x 4))) > > >> HtDP exercise 27.3.2: > > >> "Use poly from 27.3.1 to test find-root. Experiment with different > >> values for TOLERANCE. Use the strategy of section 17.8 to formulate > >> the tests as boolean-valued expressions." > > >> Are these tests meant to take place inside or outside the body of > >> "find-root." In other words, are they conditional expressions inside > >> "find-root"? ?If not, how are these tests different from a typical > >> "check-expect?" > > >> (check-expect (find-root poly 3 6) 3.75) > > >> HtDP exercise 27.3.4 > > >> "For every midpoint m, except for the last one, the function find-root > >> needs to determine the value of (f m) twice. Validate this claim for > >> one example with a hand-evaluation." > > >> For the life of me, I don't see (f m) computed twice for every > >> midpoint. ?"Mid" is obviously computed twice, but I only see "(f mid)" > >> computed once per call. ?Am I missing something totally obvious? > > >> Thanks! > >> Dave Yrueta > >> _________________________________________________ > >> ?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 egarrulo at gmail.com Sat Jul 4 17:28:11 2009 From: egarrulo at gmail.com (Elena) Date: Sat Jul 4 17:36:50 2009 Subject: [plt-scheme] Re: "unwind-protect" for PLT Scheme? In-Reply-To: <937E4CFB-E0D4-453B-98A5-4F66B43B3AFC@ccs.neu.edu> References: <9bd8a08a0907020253s197833efq90e3402f39f44c4f@mail.gmail.com> <877hyqwpu0.fsf@delenn.lan> <937E4CFB-E0D4-453B-98A5-4F66B43B3AFC@ccs.neu.edu> Message-ID: <3182b469-0fec-41f4-8e90-9857a9fba088@c9g2000yqm.googlegroups.com> Thank you for suggesting that article. Now, as a beginner, I'm a bit confused. To release resources - kind of "finally" in other languages - what should I use? It seems that dynamic-wind is appropriate for my simple code, I just have to stay away from using the before-thunk argument. Is it so? Thanks. From dyrueta at gmail.com Sat Jul 4 18:04:08 2009 From: dyrueta at gmail.com (Dave) Date: Sat Jul 4 18:04:30 2009 Subject: [plt-scheme] Re: HtDP 27.3.2 and 27.3.4 In-Reply-To: <32907cbc-4cc6-4abc-8998-be9d6e0f8fa5@p18g2000pra.googlegroups.com> References: <186df66b0907032234i47de4fa0g6576c89d1fb62df7@mail.gmail.com> <2A374AD0E94F494C864817A51D6DDCD4@uw2b2dff239c4d> <186df66b0907041038x50a38e74pd5cf1c9dee202b9d@mail.gmail.com> <32907cbc-4cc6-4abc-8998-be9d6e0f8fa5@p18g2000pra.googlegroups.com> Message-ID: <0ede2cb2-d367-4e00-8293-837865ab5baa@o18g2000pra.googlegroups.com> Hi Jos -- Here's a link to the table as I intended it: http://spreadsheets.google.com/pub?key=rMjaWK9R3fjpB06E4NSJd4w&output=html Dave On Jul 4, 2:33?pm, Dave wrote: > Grr..Sorry about that Jos -- > > The table was formatted when I sent it. If it matters, I'll redo it as > a google spreadsheet and post a link. > > Thanks, > Dave > > On Jul 4, 10:38?am, David Yrueta wrote: > > > Thank you for the response, but I don't really get it.... > > > For (poly 3 4) I find arguments: > > > I recast this as a table to see if I could figure out what you're driving at: > > > Step ? ? left ? ? ? ? ?(f left) ? ? ? ? ? ? ? right ? ? (f right) > > ? ? mid ? ? ? ? ? (f mid) ? ? ? ? ? ? ? diff > > 1 ? ? ? ? ?3 ? ? ? ? ? ? -1 ? ? ? ? ? ? ? ? ? ?4 ? ? ? ? 0 > > ? ? ? 3.5 ? ? ? ? ? ? -.75 ? ? ? ? ? ? ? ? -1 > > 2 ? ? ? ? ?3.5 ? ? ? ? ?-.75 ? ? ? ? ? ? ? ? 4 ? ? ? ? ?0 > > ? ? 3.75 ? ? ? ? ? -.4375 ? ? ? ? ? ? ?-.5 > > 3 ? ? ? ? ?3.75 ? ? ? ?-.4375 ? ? ? ? ? ? ?4 ? ? ? ? ?0 > > ? 3.875 ? ? ? ? -.234375 ? ? ? ? ?-.25 > > 4 ? ? ? ? ?3.875 ? ? ?-.234375 ? ? ? ? ?4 ? ? ? ? ?0 > > 3.9375 ? ? ? ?-.1209... ? ? ? ? ?-.125 > > 5 ? ? ? ? ?3.9375 ? ?-.12109... ? ? ? ? 4 ? ? ? ? ?0 > > 3.96875 ? ? ?-.0615... ? ? ? ? ?-.0625 > > ... > > > I can see that the value of 'right' remains constant, since with every > > call (<= (f mid) 0 (f right)) evaluates to true. But isn't that > > different from saying, as the exercise does, that with each midpoint > > (f mid) is computed twice? > > > Thanks! > > > On Sat, Jul 4, 2009 at 3:37 AM, Jos Koot wrote: > > > With TOLERANCE 1/100 I find that poly is called with the following > > > arguments: > > > 9/2 > > > 6 > > > 15/4 > > > 9/2 > > > 33/8 > > > 9/2 > > > 63/16 > > > 33/8 > > > 129/32 > > > 33/8 > > > 255/64 > > > 129/32 > > > 513/128 > > > 129/32 > > > 1023/256 > > > 513/128 > > > 2049/512 > > > 513/128 > > > > For (poly 3 4) I find arguments: > > > 7/2 > > > 4 > > > 15/4 > > > 4 > > > 31/8 > > > 4 > > > 63/16 > > > 4 > > > 127/32 > > > 4 > > > 255/64 > > > 4 > > > 511/128 > > > 4 > > > Poly is called 7 times with the same argument 4. > > > Can you now find out why f is called with the same argument more than once > > > (how to avoid that? > > > Jos > > > > ----- Original Message ----- From: "David Yrueta" > > > To: "PLT-Scheme Mailing List" > > > Sent: Saturday, July 04, 2009 7:34 AM > > > Subject: [plt-scheme] HtDP 27.3.2 and 27.3.4 > > > >> Hi All -- > > > >> Questions for both exercises refer to the function "find-root" below: > > > >> ;; find-root : (number ?-> ?number) number number ?-> ?number > > >> ;; to determine a number R such that f has a > > >> ;; root between R and (+ R TOLERANCE) > > >> ;; > > >> ;; ASSUMPTION: f is continuous and monotonic > > >> (define (find-root f left right) > > >> ?(cond > > >> ? [(<= (- right left) TOLERANCE) left] > > >> ? [else > > >> ? ? (local ((define mid (/ (+ left right) 2))) > > >> (cond > > >> ?[(<= (f mid) 0 (f right)) > > >> ? ? ? ? ?(find-root f mid right)] > > >> ?[else > > >> ? ? ? ? ?(find-root f left mid)]))])) > > > >> ;; poly : number ?-> ?number > > >> (define (poly x) > > >> (* (- x 2) (- x 4))) > > > >> HtDP exercise 27.3.2: > > > >> "Use poly from 27.3.1 to test find-root. Experiment with different > > >> values for TOLERANCE. Use the strategy of section 17.8 to formulate > > >> the tests as boolean-valued expressions." > > > >> Are these tests meant to take place inside or outside the body of > > >> "find-root." In other words, are they conditional expressions inside > > >> "find-root"? ?If not, how are these tests different from a typical > > >> "check-expect?" > > > >> (check-expect (find-root poly 3 6) 3.75) > > > >> HtDP exercise 27.3.4 > > > >> "For every midpoint m, except for the last one, the function find-root > > >> needs to determine the value of (f m) twice. Validate this claim for > > >> one example with a hand-evaluation." > > > >> For the life of me, I don't see (f m) computed twice for every > > >> midpoint. ?"Mid" is obviously computed twice, but I only see "(f mid)" > > >> computed once per call. ?Am I missing something totally obvious? > > > >> Thanks! > > >> Dave Yrueta > > >> _________________________________________________ > > >> ?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 dyrueta at gmail.com Sat Jul 4 18:00:30 2009 From: dyrueta at gmail.com (Dave) Date: Sat Jul 4 18:37:59 2009 Subject: [plt-scheme] Re: HtDP 27.3.2 and 27.3.4 In-Reply-To: <32907cbc-4cc6-4abc-8998-be9d6e0f8fa5@p18g2000pra.googlegroups.com> References: <186df66b0907032234i47de4fa0g6576c89d1fb62df7@mail.gmail.com> <2A374AD0E94F494C864817A51D6DDCD4@uw2b2dff239c4d> <186df66b0907041038x50a38e74pd5cf1c9dee202b9d@mail.gmail.com> <32907cbc-4cc6-4abc-8998-be9d6e0f8fa5@p18g2000pra.googlegroups.com> Message-ID: Here's a link to the table I was trying to display: http://spreadsheets.google.com/pub?key=rMjaWK9R3fjpB06E4NSJd4w&output=html On Jul 4, 2:33?pm, Dave wrote: > Grr..Sorry about that Jos -- > > The table was formatted when I sent it. If it matters, I'll redo it as > a google spreadsheet and post a link. > > Thanks, > Dave > > On Jul 4, 10:38?am, David Yrueta wrote: > > > Thank you for the response, but I don't really get it.... > > > For (poly 3 4) I find arguments: > > > I recast this as a table to see if I could figure out what you're driving at: > > > Step ? ? left ? ? ? ? ?(f left) ? ? ? ? ? ? ? right ? ? (f right) > > ? ? mid ? ? ? ? ? (f mid) ? ? ? ? ? ? ? diff > > 1 ? ? ? ? ?3 ? ? ? ? ? ? -1 ? ? ? ? ? ? ? ? ? ?4 ? ? ? ? 0 > > ? ? ? 3.5 ? ? ? ? ? ? -.75 ? ? ? ? ? ? ? ? -1 > > 2 ? ? ? ? ?3.5 ? ? ? ? ?-.75 ? ? ? ? ? ? ? ? 4 ? ? ? ? ?0 > > ? ? 3.75 ? ? ? ? ? -.4375 ? ? ? ? ? ? ?-.5 > > 3 ? ? ? ? ?3.75 ? ? ? ?-.4375 ? ? ? ? ? ? ?4 ? ? ? ? ?0 > > ? 3.875 ? ? ? ? -.234375 ? ? ? ? ?-.25 > > 4 ? ? ? ? ?3.875 ? ? ?-.234375 ? ? ? ? ?4 ? ? ? ? ?0 > > 3.9375 ? ? ? ?-.1209... ? ? ? ? ?-.125 > > 5 ? ? ? ? ?3.9375 ? ?-.12109... ? ? ? ? 4 ? ? ? ? ?0 > > 3.96875 ? ? ?-.0615... ? ? ? ? ?-.0625 > > ... > > > I can see that the value of 'right' remains constant, since with every > > call (<= (f mid) 0 (f right)) evaluates to true. But isn't that > > different from saying, as the exercise does, that with each midpoint > > (f mid) is computed twice? > > > Thanks! > > > On Sat, Jul 4, 2009 at 3:37 AM, Jos Koot wrote: > > > With TOLERANCE 1/100 I find that poly is called with the following > > > arguments: > > > 9/2 > > > 6 > > > 15/4 > > > 9/2 > > > 33/8 > > > 9/2 > > > 63/16 > > > 33/8 > > > 129/32 > > > 33/8 > > > 255/64 > > > 129/32 > > > 513/128 > > > 129/32 > > > 1023/256 > > > 513/128 > > > 2049/512 > > > 513/128 > > > > For (poly 3 4) I find arguments: > > > 7/2 > > > 4 > > > 15/4 > > > 4 > > > 31/8 > > > 4 > > > 63/16 > > > 4 > > > 127/32 > > > 4 > > > 255/64 > > > 4 > > > 511/128 > > > 4 > > > Poly is called 7 times with the same argument 4. > > > Can you now find out why f is called with the same argument more than once > > > (how to avoid that? > > > Jos > > > > ----- Original Message ----- From: "David Yrueta" > > > To: "PLT-Scheme Mailing List" > > > Sent: Saturday, July 04, 2009 7:34 AM > > > Subject: [plt-scheme] HtDP 27.3.2 and 27.3.4 > > > >> Hi All -- > > > >> Questions for both exercises refer to the function "find-root" below: > > > >> ;; find-root : (number ?-> ?number) number number ?-> ?number > > >> ;; to determine a number R such that f has a > > >> ;; root between R and (+ R TOLERANCE) > > >> ;; > > >> ;; ASSUMPTION: f is continuous and monotonic > > >> (define (find-root f left right) > > >> ?(cond > > >> ? [(<= (- right left) TOLERANCE) left] > > >> ? [else > > >> ? ? (local ((define mid (/ (+ left right) 2))) > > >> (cond > > >> ?[(<= (f mid) 0 (f right)) > > >> ? ? ? ? ?(find-root f mid right)] > > >> ?[else > > >> ? ? ? ? ?(find-root f left mid)]))])) > > > >> ;; poly : number ?-> ?number > > >> (define (poly x) > > >> (* (- x 2) (- x 4))) > > > >> HtDP exercise 27.3.2: > > > >> "Use poly from 27.3.1 to test find-root. Experiment with different > > >> values for TOLERANCE. Use the strategy of section 17.8 to formulate > > >> the tests as boolean-valued expressions." > > > >> Are these tests meant to take place inside or outside the body of > > >> "find-root." In other words, are they conditional expressions inside > > >> "find-root"? ?If not, how are these tests different from a typical > > >> "check-expect?" > > > >> (check-expect (find-root poly 3 6) 3.75) > > > >> HtDP exercise 27.3.4 > > > >> "For every midpoint m, except for the last one, the function find-root > > >> needs to determine the value of (f m) twice. Validate this claim for > > >> one example with a hand-evaluation." > > > >> For the life of me, I don't see (f m) computed twice for every > > >> midpoint. ?"Mid" is obviously computed twice, but I only see "(f mid)" > > >> computed once per call. ?Am I missing something totally obvious? > > > >> Thanks! > > >> Dave Yrueta > > >> _________________________________________________ > > >> ?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 sk at cs.brown.edu Sat Jul 4 20:20:59 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sat Jul 4 20:21:40 2009 Subject: [plt-scheme] Re: "unwind-protect" for PLT Scheme? In-Reply-To: <3182b469-0fec-41f4-8e90-9857a9fba088@c9g2000yqm.googlegroups.com> References: <9bd8a08a0907020253s197833efq90e3402f39f44c4f@mail.gmail.com> <877hyqwpu0.fsf@delenn.lan> <937E4CFB-E0D4-453B-98A5-4F66B43B3AFC@ccs.neu.edu> <3182b469-0fec-41f4-8e90-9857a9fba088@c9g2000yqm.googlegroups.com> Message-ID: You only need the before-thunk argument to do something if you have continuations somewhere deep within the body expression. (But note that even if you don't use continuations, you just might use a library function that does.) As long as neither you nor a library does, you can pass something trivial as before-thunk, such as void. That reduces to being the same as Lisp's unwind-protect. Shriram On Sat, Jul 4, 2009 at 5:28 PM, Elena wrote: > Thank you for suggesting that article. > > Now, as a beginner, I'm a bit confused. To release resources - kind of > "finally" in other languages - what should I use? It seems that > dynamic-wind is appropriate for my simple code, I just have to stay > away from using the before-thunk argument. Is it so? > > Thanks. > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From hsmyers at gmail.com Sat Jul 4 20:54:45 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Sat Jul 4 20:55:27 2009 Subject: [plt-scheme] GUI editor simple example In-Reply-To: <453647.66043.qm@web58807.mail.re1.yahoo.com> References: <20090704134732.E2A14650111@mail-svr1.cs.utah.edu> <453647.66043.qm@web58807.mail.re1.yahoo.com> Message-ID: <408995400907041754j35c04851sa40e6ae074c8d1a3@mail.gmail.com> Fascinating! What a wonderful thing you have done. It makes my efforts to translate from the score of a chess game to the positions reached along the way look pretty mundane. --hsm On Sat, Jul 4, 2009 at 12:13 PM, Philippos Apolinarius wrote: > What called my attention to PLT scheme was its editor, and unicode > processing facilities.? I am a very poor writer. Therefore, since I know > Ancient Greek, my teachers suggested reading and translating Homer to > improve my writing skills. Homer wrote in a kind of language that has many > similarities with Ancient Greek. The first step was to write an editor to > deal with Homer's language (there aren't many of them around, you know :-) I > tried to write the editor in Clean. However, Clean does not deal with > Unicode strings at all. I switched to Bigloo. Although Bigloo has tools? to > work with unicode, these tools are awkward, and I failed. > > To my surprise, PLT worked almost flawlessly with the Homeric text. I mean, > the IDE didn't work correctly, but the resulting program is almost perfect. > Interesting enough, the only charcter that the editor does not renders well > is ... lambda, the symbol of functional programming.? Below, you will find a > simplified version of the module that produces a latex document from a > unicode edition of the Odyssey (www.perseus.tufts..edu). Here are the first > two lines of the Odyssey, with latex produced by the program: > > ????? ??? ??????, ?????, ??????????, ?? ???? ????? > ???????, ???? ?????? ????? ?????????? ???????: > >>'andra moi >'ennepe, mo\~usa, pol'utropon, <`oc m'ala poll`a\\ > pl'agqjh, >epe`i Tro'ihc 'epersen; > > > > > (module greekfilter scheme/gui > > ? (define (geragreek b n) > ??? (cond ( (< n 1) '()) > ????????? ( (cons (list b (list->string > ??????????????????????????? (list(integer->char b)))) > ????????????????? (geragreek (+ b 1) (- n 1)))))) > > ? (define (gb b n) > ??? (geragreek b n)) > > ? (define gcod > ???? '( > ??????? (913 "A") (914 "B") (915 "G") (916 "D")(917 "E") > ??????? (918 "Z") (919 "H") (920 "J") (921 "I") (922 "K") > ??????? (923 "L") (924 "M") (925 "N") (926 "X") (927 "O") > ??????? (928 "P") (929 "R") (931 "S") (932 "T") (933 "U") > ??????? (934 "F") (935 "X") (936 "Y") (937 "W") > ??????? (945 "a") (946 "b") (947 "g") (948 "d") (949 "e") > ??????? (950 "z") (951 "h") (952 "j") (953 "i") (954 "k") > ??????? (955 "l") (956 "m") (957 "n") (958 "x") (959 "o") > ??????? (960 "p") (961 "r") (962 "c") (963 "s") (964 "t") > ??????? (965 "u") (966 "f") (967 "q") (968 "y") (969 "w") > ??????? ;; ???? ???? ???? ???? > ??????? (7936 ">a") (7937 "`a") (7939 "<`a") > ??????? (7940 ">'a") (7941 "<'a") (7942 "{\\char 146}") > ??????? (7943 "\\char 145") > ??????? (7944 ">A") (7945 "`A") (7947 "<'A") > ??????? (7948 ">'A") (7949 "<'A") (7950 "\\~>A") (7951 "\\~ ???????? ;; ??? ??? > ??????? (7952 ">e") (7953 "`e") > ??????? (7955 "<`e") (7956 ">'e") (7957 "<'e") > ??????? ;; ???? ??? > ??????? (7960 ">E") (7961 "`E")? (7963 "<`E") (7964 ">'E") > (7965 "<'E") > ??????? ;; ???? ???? ???? ???? > ??????? (7968 ">h") (7969 "`h") (7971 "<`h") > ??????? (7972 ">'h") (7973 "<'h") (7974 "{\\ese}") (7975 "{\\hee}") > ??????? (7976 ">H") (7977 "`H") (7979 "<`H") > ??????? (7980 ">'H") (7981 "<'H") (7982 "\\~>H") > ??????? (7983 "\\~ ??????? ;; > ??????? (8032 ">w") (8033 "`w") (8035 "<`w") > ??????? (8036 ">'w") (8037 "<'w") (8038 "{\\w}")? (8039 "{\\hw}") > ??????? (8040 ">W") (8041 "`W")? (8043 "<`W") > ??????? (8044 ">'W") (8045 "<'W") (8046 "\\~>W") (8047 "\\~ ??????? (8000 ">o") (8001 "`o") (8003 "<`o")(8004 ">'o")(8005 > "<'o") > ??????? (8008 ">O")(8009 "`O") (8011 "<`O") (8012 ">'O") (8013 > "<'O") > > ??????? (8016 ">u") (8017 "`u") (8019 "<`u") (8020 ">'u") (8021 > "<'u") > ??????? (8022 "{\\usu}") (8023 "{\\huu}") (8025 " "<'U") > ??????? (8031 "\\~ ??????? (8162 "`u"); ? > ??????? (8163 "'u"); ? > ??????? (8164 ">r") (8165 " ??????? (8167 "\\~u") ;? > ??????? (8168 "U") ; ? > ??????? (8169 "U") ; ? > ??????? (8170 "`U") (8171 "'U") (8172 " "`e") > ??????? (8051 "'e") (8052 "`h") (8053 "'h") (8054 "`i") (8055 "'i") (8056 > "`o") > ??????? (8057 "'o") (8058 "`u") (8059 "'u") (8060 "`w") (8061 "'w") (7984 > ">i") > ??????? (7985 "`i") (7987 "<`i") (7988 ">'i") > ??????? (7989 "<'i") (7990 "{\\ii}")? (7991 "{\\hii}") (7992 ">I") > ??????? (7993 "`I")? (7995 "<`I") (7996 ">'I") > ??????? (7997 "<'I") (7998 "\\~>") (7999 "\\~<") (8125 "\\e") > ??????? (8178 "`w|") (8179 "w|") (8180 "'w|")?? (8182 "\\~w") > ??????? (8183 "{\\wi}")??????? (8184 "`O")? (8185 "'O")??????? (8186 > "`W") > ??????? (8187 "'W")??????? (8188 "Wi")? (8128 "\\~")??????? (8130 "`h|") > ??????? (8131 "h|")??????? (8132 "'h|") ? (8134 "\\~h") (8135 "{\\eei}") > ??????? (8136 "`E") (8137 "'E") (8138 "`H") (8139 "'H") > ??????? (8140 "Hi") (8141 "{>`}") (8142 "{>'}") ? (8143 "\\~>") (8144 "{\\u > i}") > ??????? (8145 "{\\=i}") > ??????? (8146 "`i") ;;? > ??????? (8147 "'i") ;;? > ??????? (8150 "\\~i") > ??????? (8151 "\\~i") ;;? > ??????? (8152 "I")? ;;? > ??????? (8153 "\\=I") ;;? > ??????? (8154 "`I") (8155 "'I") > ??????? (8220 "{\\oq}") (8221 "{\\cq}")? (8064 ">a|") (8065 " ??????? (8066 ">`a|") (8067 "<`a|") (8068 ">'a|") (8069 "<'a|") > ??????? (8070 "{\\char 150}") (8071 "{\\char 149}") > ??????? (8080 ">h|") (8081 "`h|") (8083 "<`h|") > ??????? (8084 ">'h|") (8085 "<'h|")? (8086 "{\\esei}") (8087 "{\\heei}") > > ??????? (8096 ">w|") (8097 "`w|") (8099 "<`w|") > ??????? (8100 ">'w|") (8101 "<'w|")? (8102 "{\\wswi}") (8103 "{\\hwi}") > ??????? (8104 ">Wi") (8105 "`Wi") (8107 "<`Wi") > ??????? (8108 ">'Wi") (8109 "<'Wi")? (8110 "\\~>Wi") (8111 "\\~ ??????? (8112 "\\u a") (8113 "\\=a") (8114 "`a|") (8115 "a|") > ??????? (8116 "'a|") (8118 "\\~a")? (8119 "{\\ai") > ??????? (8122 "`A") (8123 "'A")?? (970 "{\\\"i}") > ???? ) > ? ) > > ? (define (convert1 c) > ??? (cond ( (equal? c #\newline) "\\\\\n") > ????????? ( (equal? c #\:) ";") > ????????? ( (< (char->integer c) 255) c) > ????????? (else (let ((x (assoc (char->integer c) gcod))) > ???????????????????? (if x (cadr x) "*")))? )) > > ? (define di?logo > ??? (new dialog% (label "GreekFilter"))) > > ? (define txt > ??? (new text%)) > > ? (define edtxt > ??? (new editor-canvas% [parent di?logo] > ???????? [editor txt] > ???????? (min-height 200) > ???????? (min-width 500))) > > ? (define painel (new horizontal-panel% [parent di?logo] > ????????????????????? (alignment '(center center)))) > > ? (define pasteButton > ??? (new button% [parent painel] (label "Paste") > ???????? (callback (lambda(b e) (send txt paste ))))) > > ? (define cpyButton > ??? (new button% [parent painel] (label "Cut") > ???????? (callback (lambda(b e) (send txt cut ))))) > > ? (define (convert b e) > ???? (send txt insert > ?????? (with-output-to-string > ???????? (lambda() > ?????????? (let ((s (send txt get-text))) > ???????????? (newline)(newline) > ??????????? (do ( (i 0 (+ i 1))) > ??????????????? ( (>= i (string-length s))) > ?????????????? (display (convert1 (string-ref s i))))))))) > > ? (define prtFirst > ??? (new button% [parent painel] (label "2TEX") > ???????? (callback convert))) > > ? (send di?logo show #t) > ) > > > > > > --- On Sat, 7/4/09, Matthew Flatt wrote: > > From: Matthew Flatt > Subject: Re: [plt-scheme] GUI editor simple example > To: "Hugh Myers" > Cc: plt-scheme@list.cs.brown.edu > Received: Saturday, July 4, 2009, 7:47 AM > > At Sat, 4 Jul 2009 01:44:42 -0600, Hugh Myers wrote: >> Given: >> >> (define f (new frame% [label "Simple Edit"] >>? ? ? ? ? ? ? ? ? ? ? ???[width 200] >>? ? ? ? ? ? ? ? ? ? ? ???[height 200])) >>???(define c (new editor-canvas% [parent f])) >>???(define t (new text%)) >>???(send c set-editor t) >> >> How do I control the initial font? > > Setting the font is more complicated than it should be. You have to > create a `style-delta%' (which has a poor API), and then apply the > style delta with `change-style'. > > For example, to change the font to size 20: > > (send t change-style (make-object style-delta% 'change-size 20)) > > To set the font to "Times": > > (send t change-style (send (make-object style-delta%) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? set-delta-face "Times")) > >> How do I insert a line of text? > > (send t insert "Hello\n") > >> Lines? > > (send t insert "Hello\n") > (send t insert "Goodbye\n") > > _________________________________________________ > ? For list-related administrative tasks: > ? http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > ________________________________ > Be smarter than spam. See how smart SpamGuard is at giving junk email the > boot with the All-new Yahoo! Mail > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From jos.koot at telefonica.net Sat Jul 4 21:15:35 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Sat Jul 4 21:16:12 2009 Subject: [plt-scheme] Reference for PLT-Scheme for paper References: <11b141710907040707g5eb4b779jcaa0b9fe18fdb567@mail.gmail.com> Message-ID: <376E6AF777BB454A819CFB5875DEEED4@uw2b2dff239c4d> Right. I misunderstood the question. Sorry for the noise. Jos ----- Original Message ----- From: "Shriram Krishnamurthi" To: "Jos Koot" Cc: "Paulo J. Matos" ; "PLT-Scheme Mailing List" Sent: Saturday, July 04, 2009 5:21 PM Subject: Re: [plt-scheme] Reference for PLT-Scheme for paper > Dear Jos -- > > A Web site is not a formal citation. As such, it does not give > academic credit to the software's authors, who are academics, and for > whom academic citation is therefore a standard metric of credit. It's > fine to also list the URL where relevant, but it's not the same. > > [And thanks to Paulo for asking. Personally, I just cite the 2002 > DrScheme paper as a "catch-all" citation, unless the distinction > matters.] > > Shriram > From jos.koot at telefonica.net Sat Jul 4 21:39:10 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Sat Jul 4 21:39:46 2009 Subject: [plt-scheme] HtDP 27.3.2 and 27.3.4 References: <186df66b0907032234i47de4fa0g6576c89d1fb62df7@mail.gmail.com> <2A374AD0E94F494C864817A51D6DDCD4@uw2b2dff239c4d> <186df66b0907041038x50a38e74pd5cf1c9dee202b9d@mail.gmail.com> Message-ID: <4EA2DB83B47B43BD99B4B53E61002AB6@uw2b2dff239c4d> A better example is (find-root poly 2 3) The first midpoint is 5/2 and poly is called twice with this argument. The same happens to other midpoints in this case. I agree that the midpoint is not always passed twice to poly. Sorry to have given a wrong example. Nevertheless there is a solution that avoids poly to be called twice with the same argument (whether left, right or mid) I would go for a solution that never calls poly twice with the same argument (what if given an f that takes one hour to compute?) I could read the table. Nevertheless thanks for sending the formatted table. Sorry for the delay of my responce. I was visiting a grand feast a few hundred kilometers away from wher I live. Just got home, local time 03.15. Jos ----- Original Message ----- From: "David Yrueta" To: "Jos Koot" Cc: "PLT-Scheme Mailing List" Sent: Saturday, July 04, 2009 7:38 PM Subject: Re: [plt-scheme] HtDP 27.3.2 and 27.3.4 Thank you for the response, but I don't really get it.... For (poly 3 4) I find arguments: I recast this as a table to see if I could figure out what you're driving at: Step left (f left) right (f right) mid (f mid) diff 1 3 -1 4 0 3.5 -.75 -1 2 3.5 -.75 4 0 3.75 -.4375 -.5 3 3.75 -.4375 4 0 3.875 -.234375 -.25 4 3.875 -.234375 4 0 3.9375 -.1209... -.125 5 3.9375 -.12109... 4 0 3.96875 -.0615... -.0625 ... I can see that the value of 'right' remains constant, since with every call (<= (f mid) 0 (f right)) evaluates to true. But isn't that different from saying, as the exercise does, that with each midpoint (f mid) is computed twice? Thanks! On Sat, Jul 4, 2009 at 3:37 AM, Jos Koot wrote: > With TOLERANCE 1/100 I find that poly is called with the following > arguments: > 9/2 > 6 > 15/4 > 9/2 > 33/8 > 9/2 > 63/16 > 33/8 > 129/32 > 33/8 > 255/64 > 129/32 > 513/128 > 129/32 > 1023/256 > 513/128 > 2049/512 > 513/128 > > For (poly 3 4) I find arguments: > 7/2 > 4 > 15/4 > 4 > 31/8 > 4 > 63/16 > 4 > 127/32 > 4 > 255/64 > 4 > 511/128 > 4 > Poly is called 7 times with the same argument 4. > Can you now find out why f is called with the same argument more than once > (how to avoid that? > Jos > > ----- Original Message ----- From: "David Yrueta" > To: "PLT-Scheme Mailing List" > Sent: Saturday, July 04, 2009 7:34 AM > Subject: [plt-scheme] HtDP 27.3.2 and 27.3.4 > > >> Hi All -- >> >> Questions for both exercises refer to the function "find-root" below: >> >> ;; find-root : (number -> number) number number -> number >> ;; to determine a number R such that f has a >> ;; root between R and (+ R TOLERANCE) >> ;; >> ;; ASSUMPTION: f is continuous and monotonic >> (define (find-root f left right) >> (cond >> [(<= (- right left) TOLERANCE) left] >> [else >> (local ((define mid (/ (+ left right) 2))) >> (cond >> [(<= (f mid) 0 (f right)) >> (find-root f mid right)] >> [else >> (find-root f left mid)]))])) >> >> ;; poly : number -> number >> (define (poly x) >> (* (- x 2) (- x 4))) >> >> HtDP exercise 27.3.2: >> >> "Use poly from 27.3.1 to test find-root. Experiment with different >> values for TOLERANCE. Use the strategy of section 17.8 to formulate >> the tests as boolean-valued expressions." >> >> Are these tests meant to take place inside or outside the body of >> "find-root." In other words, are they conditional expressions inside >> "find-root"? If not, how are these tests different from a typical >> "check-expect?" >> >> (check-expect (find-root poly 3 6) 3.75) >> >> HtDP exercise 27.3.4 >> >> "For every midpoint m, except for the last one, the function find-root >> needs to determine the value of (f m) twice. Validate this claim for >> one example with a hand-evaluation." >> >> For the life of me, I don't see (f m) computed twice for every >> midpoint. "Mid" is obviously computed twice, but I only see "(f mid)" >> computed once per call. Am I missing something totally obvious? >> >> Thanks! >> Dave Yrueta >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > From ryanc at ccs.neu.edu Sun Jul 5 01:04:53 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Sun Jul 5 01:03:51 2009 Subject: [plt-scheme] select() and syscalls In-Reply-To: References: Message-ID: <4A503475.3080609@ccs.neu.edu> Tom Novelli wrote: > I'm curious... does PLT Scheme support POSIX 'select'? All I can find are > Vyzo's 'socket' package and Matthew Flatt's mention of 'object-wait' 7 years > ago: http://www.cs.utah.edu/plt/mailarch/plt-scheme-2002/msg00521.html (Yes, > I'm interested in SCSH for PLT :-) 'object-wait' is now called 'sync', and it is designed to work with PLT Scheme's ports, which act as "synchronizable events". See the docs here: http://docs.plt-scheme.org/reference/sync.html If you just need sockets for simple IO, then you can use the FFI to create them and wrap them as Scheme ports. Then you can deal with them at the Scheme level, using 'sync' instead of the 'select' syscall. Even if you want to add other functionality to sockets, you might still use that as a starting point. Here's code I've written to do that for Unix/local sockets. Feel free to take it and adapt it if you find it useful. (I don't know if Vyzo's package creates Scheme ports, but even if not it's probably possible to combine them.) http://planet.plt-scheme.org/package-source/schematics/spgsql.plt/2/3/private/socket.ss > In general, do I need to write C extensions to do syscalls, or is there a > better way? You can use the FFI: http://docs.plt-scheme.org/foreign/index.html For documentation on the internal C API (like the function that creates Scheme ports from a file descriptor, scheme_make_fd_output_port), see this document: http://docs.plt-scheme.org/inside/index.html Ryan From eli at barzilay.org Sun Jul 5 01:50:37 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sun Jul 5 01:50:59 2009 Subject: [plt-scheme] Re: "unwind-protect" for PLT Scheme? In-Reply-To: References: <9bd8a08a0907020253s197833efq90e3402f39f44c4f@mail.gmail.com> <877hyqwpu0.fsf@delenn.lan> <937E4CFB-E0D4-453B-98A5-4F66B43B3AFC@ccs.neu.edu> <3182b469-0fec-41f4-8e90-9857a9fba088@c9g2000yqm.googlegroups.com> Message-ID: <19024.16173.892585.74046@winooski.ccs.neu.edu> On Jul 4, Shriram Krishnamurthi wrote: > You only need the before-thunk argument to do something if you have > continuations somewhere deep within the body expression. (But note > that even if you don't use continuations, you just might use a > library function that does.) As long as neither you nor a library > does, you can pass something trivial as before-thunk, such as void. > That reduces to being the same as Lisp's unwind-protect. Sorry to add another post on this, but I'll try to make a quick summary of this whole thing in plain English (as much as I can call what *I* write "plain English"): * When no continuations are involved, `dynamic-wind' is perfectly fine as is, and you can set up the resource either in the before thunk, or before the whole call: (let ([foo (open-output-file ...)]) (dynamic-wind void (lambda () ...do stuff with foo...) (lambda () ...close foo...))) or (let ([foo #f]) (dynamic-wind (lambda () (set! foo (open-output-file ...))) (lambda () ...do stuff with foo...) (lambda () ...close foo...))) * When continuations are involved, then control can jump into or out of the main thunk, and you have several options to choose from. Here the before thunk becomes important since it can be called not just once, but several times -- once when it starts, and a pair of after-before calls for each jump out of and back into the main thunk. Just ignoring this makes it possible for your code to run into problems that are similar in nature to writing code that is not thread-safe: in both cases the problem is not in your own code, but in the way it is being called or in the way library calls it performs behave. And this analogy carries over to how people deal with it: lots of user code just ignores the whole issue, but you need to be more careful if you're writing some library, or parts of the core language. [`call/cc' is notorious in exposing all kinds of things about how things are implemented (for example, IIRC there was a point in the (distant?) past where you could squeeze two different behaviors out of mzscheme's `map' function because the implementation was optimizing uses with a few functions).] * Options for dealing with this are: - Ignore the whole thing, and use the first form above. - Arrange for the resource to be properly opened and closed on the before/after thunks -- which means that you need to make sure that, for example, you open the file in `append' mode so when jumping out and back in the resource will be recreated. Of course, this depends on the code doing something simple, like just writing to the file. - Forbid re-entry: you make a before thunk that remembers if it was already called -- if that's the case, then you know that somehow control went out and back in, and you make it throw an appropriate error. This can be convenient if, for example, it is meaningless to use the resource after it was already released. - Intentionally avoid creating and releasing the resource in a `dynamic-wind', so it will only be released when control leaves normally. An example for this would be: (let ([foo (open-output-file ...)]) (begin0 (...do stuff with foo...) (...close foo...))) or better: (let ([foo (open-output-file ...)]) (define (close-foo) ...close foo...) (with-handlers ([(lambda (x) #t) (lambda (e) (close-foo) (raise e))]) (begin0 (...do stuff with foo...) (close-foo)))) This works if when control happens to go out, it will also go back in, so eventually control leaves as usual. - There's a number of variants on these and subtle points involved etc. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From holden at pigscanfly.ca Sat Jul 4 22:59:06 2009 From: holden at pigscanfly.ca (Holden Karau) Date: Sun Jul 5 04:09:16 2009 Subject: [plt-scheme] help with stateless servlets Message-ID: I'm having some difficulty creating/launching a stateless servlet When I run the following code I get back "procedure make-stateless.servlet: expects 4 arguments, given 3: # # #" yousseb.ss defines & exports start, manager & stuffer for good measure (although I already pass manager & stuffer in as paramaters to serve/servlet ) I assume I've missed something completely obvious to make this work, what is it? #lang scheme (require "mypath.ss") (require web-server/servlet-env) (require web-server/configuration/responders) (require web-server/managers/lru) (require "youuseb.ss") (require web-server/stuffers/base64) (require web-server/stuffers) (require web-server/stuffers/hmac-sha1) (define exp (lambda (req) `(html (head (title "Expired")) (body (h1 "Expired") (p "This URL has expired. " "Please return to the home page." "This is likely because of increased load. It shouldn't happen again." )))) ) (define use 2) (define mystuffer (stuffer-chain serialize-stuffer (md5-stuffer (build-path "/tmp/" ".urls")))) (define mymanager (make-threshold-LRU-manager exp 2524000000)) (serve/servlet start #:launch-browser? #f #:quit? #f #:file-not-found-responder (gen-file-not-found-responder (build-path "/usr/src/awesome/static" "404.html")) #:log-file "/usr/src/awesome/mylog4" #:log-format 'extended #:listen-ip #f #:manager mymanager #:port 8085 #:stuffer mystuffer #:command-line? #t #:extra-files-paths (list (build-path mypath "static")) #:servlet-path "/app/" #:stateless? #t) From hsmyers at gmail.com Sun Jul 5 12:32:11 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Sun Jul 5 12:32:49 2009 Subject: [plt-scheme] GUI guides? Message-ID: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> Would I be wrong in asserting that each of the major components of the `GUI: PLT Graphics Toolkit' need a `Guide'? I'm at the moment wading through the Editor portion (1.3 etc) and finding quite difficult. As long as there were examples things were reasonably clear--- or at least could be made so using the examples and with experimentation. Regrettably, examples stop from 1.3.1 forward. I'm perfectly willing to ask about each piece of information I need to know; but I don't think I should have to. This is what manuals are for--- how else can experts say RTFM unless the answers are there to be found. :) So could someone direct me to the link or links that I need? --hsm From ebzzry at gmail.com Sun Jul 5 15:04:39 2009 From: ebzzry at gmail.com (Rommel M. Martinez) Date: Sun Jul 5 15:05:21 2009 Subject: [plt-scheme] MzScheme and --main Message-ID: <391934950907051204h433bc431hb440b5405b6a8a64@mail.gmail.com> I'm lost as to how _exactly_ should one write a program, that understands or uses the -m/--main argument to mzscheme. I've been trying many different combinations, but I still don't get the behavior that is described in the documentation. Is this argument the same as the "-e main" argument to Scsh, or is it something completely different? -- Rommel M. Martinez http://www.bespin.org/~ebzzry From ebzzry at gmail.com Sun Jul 5 16:04:08 2009 From: ebzzry at gmail.com (Rommel M. Martinez) Date: Sun Jul 5 16:04:56 2009 Subject: [plt-scheme] MzScheme and --main In-Reply-To: <36366a980907051253id3e9320m313d8e20aa386d63@mail.gmail.com> References: <391934950907051204h433bc431hb440b5405b6a8a64@mail.gmail.com> <36366a980907051253id3e9320m313d8e20aa386d63@mail.gmail.com> Message-ID: <391934950907051304q55d82dddxd1b39bed998aa644@mail.gmail.com> Just what I was looking for. The part that bit me was telling mzscheme to stop reading the arguments with "--". Thanks a lot! On Mon, Jul 6, 2009 at 3:53 AM, Eric Hanchrow wrote: > On Sun, Jul 5, 2009 at 12:04 PM, Rommel M. Martinez wrote: >> I'm lost as to how _exactly_ should one write a program, that understands >> or uses the -m/--main argument to mzscheme. > > I do it like this: > > #! /bin/sh > #| > exec ?mzscheme --require "$0" --main -- ${1+"$@"} > |# > > #lang scheme > > (define (main . args) > (printf "Hello ~s~%" args) > ) > > (provide main) > -- Rommel M. Martinez http://www.bespin.org/~ebzzry From matthias at ccs.neu.edu Sun Jul 5 16:04:34 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Jul 5 16:05:28 2009 Subject: [plt-scheme] GUI guides? In-Reply-To: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> References: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> Message-ID: <4F1688A7-E188-4385-852E-1E0541F3B118@ccs.neu.edu> Yes, they do. Perhaps some of the people on the list who figured out the GUI stuff want to take a first stab at it. On Jul 5, 2009, at 12:32 PM, Hugh Myers wrote: > Would I be wrong in asserting that each of the major components of the > `GUI: PLT Graphics Toolkit' need a `Guide'? I'm at the moment wading > through the Editor portion (1.3 etc) and finding quite difficult. As > long as there were examples things were reasonably clear--- or at > least could be made so using the examples and with experimentation. > Regrettably, examples stop from 1.3.1 forward. > > I'm perfectly willing to ask about each piece of information I need to > know; but I don't think I should have to. This is what manuals are > for--- how else can experts say RTFM unless the answers are there to > be found. :) > > So could someone direct me to the link or links that I need? > > --hsm > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From hsmyers at gmail.com Sun Jul 5 17:24:14 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Sun Jul 5 17:24:56 2009 Subject: [plt-scheme] GUI guides? In-Reply-To: <4F1688A7-E188-4385-852E-1E0541F3B118@ccs.neu.edu> References: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> <4F1688A7-E188-4385-852E-1E0541F3B118@ccs.neu.edu> Message-ID: <408995400907051424x44de6807h8044ca1788d3ee8a@mail.gmail.com> Perhaps it would help if I were to work up a list of questions that when answered might provide the beginnings of a FAQ or Guide? --hsm On Sun, Jul 5, 2009 at 2:04 PM, Matthias Felleisen wrote: > > Yes, they do. Perhaps some of the people on the list who figured out the GUI > stuff want to take a first stab at it. > > > On Jul 5, 2009, at 12:32 PM, Hugh Myers wrote: > >> Would I be wrong in asserting that each of the major components of the >> `GUI: PLT Graphics Toolkit' need a `Guide'? I'm at the moment wading >> through the Editor portion (1.3 etc) and finding quite difficult. As >> long as there were examples things were reasonably clear--- or at >> least could be made so using the examples and with experimentation. >> Regrettably, examples stop from 1.3.1 forward. >> >> I'm perfectly willing to ask about each piece of information I need to >> know; but I don't think I should have to. This is what manuals are >> for--- how else can experts say RTFM unless the answers are there to >> be found. :) >> >> So could someone direct me to the link or links that I need? >> >> --hsm >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From matthias at ccs.neu.edu Sun Jul 5 17:50:01 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Jul 5 17:51:06 2009 Subject: [plt-scheme] GUI guides? In-Reply-To: <408995400907051424x44de6807h8044ca1788d3ee8a@mail.gmail.com> References: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> <4F1688A7-E188-4385-852E-1E0541F3B118@ccs.neu.edu> <408995400907051424x44de6807h8044ca1788d3ee8a@mail.gmail.com> Message-ID: <9E2E5A03-F463-4E00-A5A7-53CF568E69C6@ccs.neu.edu> Sure would. On Jul 5, 2009, at 5:24 PM, Hugh Myers wrote: > Perhaps it would help if I were to work up a list of questions that > when answered might provide the beginnings of a FAQ or Guide? > > --hsm > > On Sun, Jul 5, 2009 at 2:04 PM, Matthias > Felleisen wrote: >> >> Yes, they do. Perhaps some of the people on the list who figured >> out the GUI >> stuff want to take a first stab at it. >> >> >> On Jul 5, 2009, at 12:32 PM, Hugh Myers wrote: >> >>> Would I be wrong in asserting that each of the major components >>> of the >>> `GUI: PLT Graphics Toolkit' need a `Guide'? I'm at the moment wading >>> through the Editor portion (1.3 etc) and finding quite difficult. As >>> long as there were examples things were reasonably clear--- or at >>> least could be made so using the examples and with experimentation. >>> Regrettably, examples stop from 1.3.1 forward. >>> >>> I'm perfectly willing to ask about each piece of information I >>> need to >>> know; but I don't think I should have to. This is what manuals are >>> for--- how else can experts say RTFM unless the answers are there to >>> be found. :) >>> >>> So could someone direct me to the link or links that I need? >>> >>> --hsm >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> From hsmyers at gmail.com Sun Jul 5 17:52:13 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Sun Jul 5 17:52:54 2009 Subject: [plt-scheme] GUI guides? In-Reply-To: <9E2E5A03-F463-4E00-A5A7-53CF568E69C6@ccs.neu.edu> References: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> <4F1688A7-E188-4385-852E-1E0541F3B118@ccs.neu.edu> <408995400907051424x44de6807h8044ca1788d3ee8a@mail.gmail.com> <9E2E5A03-F463-4E00-A5A7-53CF568E69C6@ccs.neu.edu> Message-ID: <408995400907051452k2897092ra8a855dd7ab20590@mail.gmail.com> And suppose I act as scribe for same? --hsm On Sun, Jul 5, 2009 at 3:50 PM, Matthias Felleisen wrote: > > Sure would. > > On Jul 5, 2009, at 5:24 PM, Hugh Myers wrote: > >> Perhaps it would help if I were to work up a list of questions that >> when answered might provide the beginnings of a FAQ or Guide? >> >> --hsm >> >> On Sun, Jul 5, 2009 at 2:04 PM, Matthias Felleisen >> wrote: >>> >>> Yes, they do. Perhaps some of the people on the list who figured out the >>> GUI >>> stuff want to take a first stab at it. >>> >>> >>> On Jul 5, 2009, at 12:32 PM, Hugh Myers wrote: >>> >>>> Would I be wrong in asserting that each of the major components of the >>>> `GUI: PLT Graphics Toolkit' need a `Guide'? I'm at the moment wading >>>> through the Editor portion (1.3 etc) and finding quite difficult. As >>>> long as there were examples things were reasonably clear--- or at >>>> least could be made so using the examples and with experimentation. >>>> Regrettably, examples stop from 1.3.1 forward. >>>> >>>> I'm perfectly willing to ask about each piece of information I need to >>>> know; but I don't think I should have to. This is what manuals are >>>> for--- how else can experts say RTFM unless the answers are there to >>>> be found. :) >>>> >>>> So could someone direct me to the link or links that I need? >>>> >>>> --hsm >>>> _________________________________________________ >>>> ?For list-related administrative tasks: >>>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> > > From toddobryan at gmail.com Sun Jul 5 18:20:44 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sun Jul 5 18:21:06 2009 Subject: [plt-scheme] updating a teachpack to 4.2? Message-ID: <904774730907051520l421993eale96afadd4dc5fb2f@mail.gmail.com> I have a customized version of Kathi's terrific fabric teachpack here: https://www.dupontmanual.org/wikis/intro/Assignments/Fabric?action=AttachFile&do=get&target=manual-fabric-teachpack.ss.zip Unfortunately, it's not compatible with 4.2. I get: require: namespace mismatch; reference (phase 0) to a module "/home/tobryan1/plt-scheme/lib/plt/collects/scheme/private/kw.ss" that is not available (phase level 0) Can anybody help with the updating? Todd From hsmyers at gmail.com Sun Jul 5 18:34:01 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Sun Jul 5 18:34:41 2009 Subject: [plt-scheme] GUI guides? In-Reply-To: <408995400907051452k2897092ra8a855dd7ab20590@mail.gmail.com> References: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> <4F1688A7-E188-4385-852E-1E0541F3B118@ccs.neu.edu> <408995400907051424x44de6807h8044ca1788d3ee8a@mail.gmail.com> <9E2E5A03-F463-4E00-A5A7-53CF568E69C6@ccs.neu.edu> <408995400907051452k2897092ra8a855dd7ab20590@mail.gmail.com> Message-ID: <408995400907051534h78501810r6374d8fae009fc9c@mail.gmail.com> Here is what I had in mind as an example for 'editor': Given: (define f (new frame% [label "Simple Edit"] [width 200] [height 200])) (define c (new editor-canvas% [parent f])) (define t (new text%)) (send c set-editor t) How do I programatically: ---------- Control the initial font? (send t change-style (send (make-object style-delta%) set-delta-face "Times")) ---------- Type size? (send t change-style (make-object style-delta% 'change-size 20)) ---------- Insert a line of text? (send t insert "Hello\n") ---------- Insert lines of text? (send t insert "Hello\n") (send t insert "Goodbye\n") or: (send t insert "Hello\nGoodbye\n") ---------- Overwrite existing text? ---------- Erase existing text? ---------- Clear existing text? ---------- Create a non sizable frame? ---------- Remove system buttons (shrink and expand)? ---------- Scroll bars? ---------- Border types? ---------- Change width? ---------- Change heigth? ---------- Move insertion point? ---------- Select text? ---------- Determine width of text in units? ---------- On Sun, Jul 5, 2009 at 3:52 PM, Hugh Myers wrote: > And suppose I act as scribe for same? > > --hsm > > On Sun, Jul 5, 2009 at 3:50 PM, Matthias Felleisen wrote: >> >> Sure would. >> >> On Jul 5, 2009, at 5:24 PM, Hugh Myers wrote: >> >>> Perhaps it would help if I were to work up a list of questions that >>> when answered might provide the beginnings of a FAQ or Guide? >>> >>> --hsm >>> >>> On Sun, Jul 5, 2009 at 2:04 PM, Matthias Felleisen >>> wrote: >>>> >>>> Yes, they do. Perhaps some of the people on the list who figured out the >>>> GUI >>>> stuff want to take a first stab at it. >>>> >>>> >>>> On Jul 5, 2009, at 12:32 PM, Hugh Myers wrote: >>>> >>>>> Would I be wrong in asserting that each of the major components of the >>>>> `GUI: PLT Graphics Toolkit' need a `Guide'? I'm at the moment wading >>>>> through the Editor portion (1.3 etc) and finding quite difficult. As >>>>> long as there were examples things were reasonably clear--- or at >>>>> least could be made so using the examples and with experimentation. >>>>> Regrettably, examples stop from 1.3.1 forward. >>>>> >>>>> I'm perfectly willing to ask about each piece of information I need to >>>>> know; but I don't think I should have to. This is what manuals are >>>>> for--- how else can experts say RTFM unless the answers are there to >>>>> be found. :) >>>>> >>>>> So could someone direct me to the link or links that I need? >>>>> >>>>> --hsm >>>>> _________________________________________________ >>>>> ?For list-related administrative tasks: >>>>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>> >>>> >> >> > From grettke at acm.org Sun Jul 5 19:22:46 2009 From: grettke at acm.org (Grant Rettke) Date: Sun Jul 5 19:23:06 2009 Subject: [plt-scheme] GUI guides? In-Reply-To: <408995400907051534h78501810r6374d8fae009fc9c@mail.gmail.com> References: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> <4F1688A7-E188-4385-852E-1E0541F3B118@ccs.neu.edu> <408995400907051424x44de6807h8044ca1788d3ee8a@mail.gmail.com> <9E2E5A03-F463-4E00-A5A7-53CF568E69C6@ccs.neu.edu> <408995400907051452k2897092ra8a855dd7ab20590@mail.gmail.com> <408995400907051534h78501810r6374d8fae009fc9c@mail.gmail.com> Message-ID: <756daca50907051622va77f349y7ec14b7f6fcafdc1@mail.gmail.com> On Sun, Jul 5, 2009 at 5:34 PM, Hugh Myers wrote: > Here is what I had in mind as an example for 'editor': I like your approach. From hsmyers at gmail.com Sun Jul 5 19:28:52 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Sun Jul 5 19:29:31 2009 Subject: [plt-scheme] GUI guides? In-Reply-To: <756daca50907051622va77f349y7ec14b7f6fcafdc1@mail.gmail.com> References: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> <4F1688A7-E188-4385-852E-1E0541F3B118@ccs.neu.edu> <408995400907051424x44de6807h8044ca1788d3ee8a@mail.gmail.com> <9E2E5A03-F463-4E00-A5A7-53CF568E69C6@ccs.neu.edu> <408995400907051452k2897092ra8a855dd7ab20590@mail.gmail.com> <408995400907051534h78501810r6374d8fae009fc9c@mail.gmail.com> <756daca50907051622va77f349y7ec14b7f6fcafdc1@mail.gmail.com> Message-ID: <408995400907051628m62f96514yb24520a2852ffe9f@mail.gmail.com> Am solving some of these as I try and think of questions to ask. Some of the answers raise questions about what is or isn't do-able. For instance given fixed width symbol font (like all chess fonts) it would be nice to ask how wide and how tall a given text string is. This could be used to 'size' the window before display. Nothing I've seen yet even hints that this is possible, yet it seems quit reasonable. --hsm On Sun, Jul 5, 2009 at 5:22 PM, Grant Rettke wrote: > On Sun, Jul 5, 2009 at 5:34 PM, Hugh Myers wrote: >> Here is what I had in mind as an example for 'editor': > > I like your approach. > From eli at barzilay.org Sun Jul 5 19:39:11 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sun Jul 5 19:39:34 2009 Subject: [plt-scheme] MzScheme and --main In-Reply-To: <391934950907051304q55d82dddxd1b39bed998aa644@mail.gmail.com> References: <391934950907051204h433bc431hb440b5405b6a8a64@mail.gmail.com> <36366a980907051253id3e9320m313d8e20aa386d63@mail.gmail.com> <391934950907051304q55d82dddxd1b39bed998aa644@mail.gmail.com> Message-ID: <19025.14751.946974.697514@winooski.ccs.neu.edu> On Jul 6, Rommel M. Martinez wrote: > Just what I was looking for. The part that bit me was telling mzscheme > to stop reading the arguments with "--". This is more convenient: #!/bin/env mzscheme #lang scheme (command-line #:args file (printf "files = ~s\n" file)) but as usual, you need to switch to the `exec' trick again if you need any command line arguments for mzscheme itself. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From toddobryan at gmail.com Sun Jul 5 20:45:22 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sun Jul 5 20:45:44 2009 Subject: [plt-scheme] Re: updating a teachpack to 4.2? In-Reply-To: <904774730907051520l421993eale96afadd4dc5fb2f@mail.gmail.com> References: <904774730907051520l421993eale96afadd4dc5fb2f@mail.gmail.com> Message-ID: <904774730907051745s19a4b10ei621b28cab8f6f54a@mail.gmail.com> I should have mentioned, this should work with HtDP Beginning Student language. On Sun, Jul 5, 2009 at 6:20 PM, Todd O'Bryan wrote: > I have a customized version of Kathi's terrific fabric teachpack here: > > https://www.dupontmanual.org/wikis/intro/Assignments/Fabric?action=AttachFile&do=get&target=manual-fabric-teachpack.ss.zip > > Unfortunately, it's not compatible with 4.2. I get: > > require: namespace mismatch; reference (phase 0) to a module > "/home/tobryan1/plt-scheme/lib/plt/collects/scheme/private/kw.ss" that > is not available (phase level 0) > > Can anybody help with the updating? > > Todd > From ryanc at ccs.neu.edu Sun Jul 5 20:51:38 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Sun Jul 5 20:52:09 2009 Subject: [plt-scheme] GUI guides? In-Reply-To: <408995400907051628m62f96514yb24520a2852ffe9f@mail.gmail.com> References: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> <4F1688A7-E188-4385-852E-1E0541F3B118@ccs.neu.edu> <408995400907051424x44de6807h8044ca1788d3ee8a@mail.gmail.com> <9E2E5A03-F463-4E00-A5A7-53CF568E69C6@ccs.neu.edu> <408995400907051452k2897092ra8a855dd7ab20590@mail.gmail.com> <408995400907051534h78501810r6374d8fae009fc9c@mail.gmail.com> <756daca50907051622va77f349y7ec14b7f6fcafdc1@mail.gmail.com> <408995400907051628m62f96514yb24520a2852ffe9f@mail.gmail.com> Message-ID: <4A514A9A.3070103@ccs.neu.edu> Hugh Myers wrote: > Am solving some of these as I try and think of questions to ask. Some > of the answers raise questions about what is or isn't do-able. For > instance given fixed width symbol font (like all chess fonts) it would > be nice to ask how wide and how tall a given text string is. This > could be used to 'size' the window before display. Nothing I've seen > yet even hints that this is possible, yet it seems quit reasonable. I think you want 'get-text-extent' in 'dc<%>' (drawing context). Here are some rough guidelines: - 'editor<%>' and 'text%' deal with the text, its styles, modifications to the text, high-level display concerns (word wrapping, visible/ region, etc). - 'canvas<%>' and 'editor-canvas%' deal with the gui concerns: dimensions of the editor widget, its auxiliary gui elements (scrollbars), etc. - 'dc<%>' deals with rendering issues, like how big a string in a particular font will be rendered on screen. Browsing those classes and interfaces is a good way to get an idea of what functionality is available and how it's provided. Remember to look at the superclasses and superinterfaces, too. Ryan From eli at barzilay.org Sun Jul 5 21:30:09 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sun Jul 5 21:30:32 2009 Subject: [plt-scheme] Re: updating a teachpack to 4.2? In-Reply-To: <904774730907051745s19a4b10ei621b28cab8f6f54a@mail.gmail.com> References: <904774730907051520l421993eale96afadd4dc5fb2f@mail.gmail.com> <904774730907051745s19a4b10ei621b28cab8f6f54a@mail.gmail.com> Message-ID: <19025.21409.871959.470109@winooski.ccs.neu.edu> There was some issues with that teachpack that were recently discovered -- likely the same one you've ran into. I worked with Kathi on resolving it so it should be fixed in the near future. On Jul 5, Todd O'Bryan wrote: > I should have mentioned, this should work with HtDP Beginning > Student language. > > On Sun, Jul 5, 2009 at 6:20 PM, Todd O'Bryan wrote: > > I have a customized version of Kathi's terrific fabric teachpack here: > > > > https://www.dupontmanual.org/wikis/intro/Assignments/Fabric?action=AttachFile&do=get&target=manual-fabric-teachpack.ss.zip > > > > Unfortunately, it's not compatible with 4.2. I get: > > > > require: namespace mismatch; reference (phase 0) to a module > > "/home/tobryan1/plt-scheme/lib/plt/collects/scheme/private/kw.ss" that > > is not available (phase level 0) > > > > Can anybody help with the updating? -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From toddobryan at gmail.com Sun Jul 5 21:38:39 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sun Jul 5 21:39:04 2009 Subject: [plt-scheme] Re: updating a teachpack to 4.2? In-Reply-To: <19025.21409.871959.470109@winooski.ccs.neu.edu> References: <904774730907051520l421993eale96afadd4dc5fb2f@mail.gmail.com> <904774730907051745s19a4b10ei621b28cab8f6f54a@mail.gmail.com> <19025.21409.871959.470109@winooski.ccs.neu.edu> Message-ID: <904774730907051838s5005cfaasd4d04d548262e602@mail.gmail.com> Thanks! I'll check with her in a few days... On Sun, Jul 5, 2009 at 9:30 PM, Eli Barzilay wrote: > There was some issues with that teachpack that were recently > discovered -- likely the same one you've ran into. ?I worked with > Kathi on resolving it so it should be fixed in the near future. > > > On Jul ?5, Todd O'Bryan wrote: >> I should have mentioned, this should work with HtDP Beginning >> Student language. >> >> On Sun, Jul 5, 2009 at 6:20 PM, Todd O'Bryan wrote: >> > I have a customized version of Kathi's terrific fabric teachpack here: >> > >> > https://www.dupontmanual.org/wikis/intro/Assignments/Fabric?action=AttachFile&do=get&target=manual-fabric-teachpack.ss.zip >> > >> > Unfortunately, it's not compatible with 4.2. I get: >> > >> > require: namespace mismatch; reference (phase 0) to a module >> > "/home/tobryan1/plt-scheme/lib/plt/collects/scheme/private/kw.ss" that >> > is not available (phase level 0) >> > >> > Can anybody help with the updating? > > -- > ? ? ? ? ?((lambda (x) (x x)) (lambda (x) (x x))) ? ? ? ? ?Eli Barzilay: > ? ? ? ? ? ? ? ? ? ?http://barzilay.org/ ? ? ? ? ? ? ? ? ? Maze is Life! > From hsmyers at gmail.com Sun Jul 5 22:41:53 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Sun Jul 5 22:42:32 2009 Subject: [plt-scheme] GUI guides? In-Reply-To: <4A514A9A.3070103@ccs.neu.edu> References: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> <4F1688A7-E188-4385-852E-1E0541F3B118@ccs.neu.edu> <408995400907051424x44de6807h8044ca1788d3ee8a@mail.gmail.com> <9E2E5A03-F463-4E00-A5A7-53CF568E69C6@ccs.neu.edu> <408995400907051452k2897092ra8a855dd7ab20590@mail.gmail.com> <408995400907051534h78501810r6374d8fae009fc9c@mail.gmail.com> <756daca50907051622va77f349y7ec14b7f6fcafdc1@mail.gmail.com> <408995400907051628m62f96514yb24520a2852ffe9f@mail.gmail.com> <4A514A9A.3070103@ccs.neu.edu> Message-ID: <408995400907051941s7a1c75d3sfc3dcc1abe716bbb@mail.gmail.com> Thanks for the pointer to dc% What you mention seems like a logical (heaven forbid) arrangement given the concepts involved. Having survived the age of roll-your-own gui (usually text), original windows, and then MFC this should be just another notch in my gui-belt. Even as we e-speak I'm in the middle of investigating frame% which has some of the answers in my shopping-list. I think one of the things that will be in my version of 'GUI Editor Guide' will be a list of what all can be set/modified for a given window. Sometimes it is easier to pick and choose from such a list than to comb a detailed reference--- I think as a guide, this approach might be the one to go with. --hsm On Sun, Jul 5, 2009 at 6:51 PM, Ryan Culpepper wrote: > Hugh Myers wrote: >> >> Am solving some of these as I try and think of questions to ask. Some >> of the answers raise questions about what is or isn't do-able. For >> instance given fixed width symbol font (like all chess fonts) it would >> be nice to ask how wide and how tall a given text string is. This >> could be used to 'size' the window before display. Nothing I've seen >> yet even hints that this is possible, yet it seems quit reasonable. > > I think you want 'get-text-extent' in 'dc<%>' (drawing context). > > Here are some rough guidelines: > > ?- 'editor<%>' and 'text%' deal with the text, its styles, modifications to > the text, high-level display concerns (word wrapping, visible/ region, etc). > > ?- 'canvas<%>' and 'editor-canvas%' deal with the gui concerns: dimensions > of the editor widget, its auxiliary gui elements (scrollbars), etc. > > ?- 'dc<%>' deals with rendering issues, like how big a string in a > particular font will be rendered on screen. > > Browsing those classes and interfaces is a good way to get an idea of what > functionality is available and how it's provided. Remember to look at the > superclasses and superinterfaces, too. > > Ryan > From hsmyers at gmail.com Sun Jul 5 23:12:11 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Sun Jul 5 23:12:49 2009 Subject: [plt-scheme] GUI guides? In-Reply-To: <408995400907051941s7a1c75d3sfc3dcc1abe716bbb@mail.gmail.com> References: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> <4F1688A7-E188-4385-852E-1E0541F3B118@ccs.neu.edu> <408995400907051424x44de6807h8044ca1788d3ee8a@mail.gmail.com> <9E2E5A03-F463-4E00-A5A7-53CF568E69C6@ccs.neu.edu> <408995400907051452k2897092ra8a855dd7ab20590@mail.gmail.com> <408995400907051534h78501810r6374d8fae009fc9c@mail.gmail.com> <756daca50907051622va77f349y7ec14b7f6fcafdc1@mail.gmail.com> <408995400907051628m62f96514yb24520a2852ffe9f@mail.gmail.com> <4A514A9A.3070103@ccs.neu.edu> <408995400907051941s7a1c75d3sfc3dcc1abe716bbb@mail.gmail.com> Message-ID: <408995400907052012s5519c4b0p9891c353a3b3641a@mail.gmail.com> Added to list: Care and feeding of Status Line---a subject worth a guide in of itself: Create a status line Open a status line Write to a status line Close a status line Remove a status line Note that the overall status line is partitioned into writable areas. For instance for a chess board, I would want to show the move text, the move number and the move ply (move number without regard to color; ply 1 is move 1 as is ply 2 [white's move followed by black's move etc.]). Perhaps also information on castling, draw information etc. An example rich environment. --hsm On Sun, Jul 5, 2009 at 8:41 PM, Hugh Myers wrote: > Thanks for the pointer to dc% What you mention seems like a logical > (heaven forbid) arrangement given the concepts involved. Having > survived the age of roll-your-own gui (usually text), original > windows, and then MFC this should be just another notch in my > gui-belt. Even as we e-speak I'm in the middle of investigating frame% > which has some of the answers in my shopping-list. I think one of the > things that will be in my version of 'GUI Editor Guide' will be a list > of what all can be set/modified for a given window. Sometimes it is > easier to pick and choose from such a list than to comb a detailed > reference--- I think as a guide, this approach might be the one to go > with. > > --hsm > > On Sun, Jul 5, 2009 at 6:51 PM, Ryan Culpepper wrote: >> Hugh Myers wrote: >>> >>> Am solving some of these as I try and think of questions to ask. Some >>> of the answers raise questions about what is or isn't do-able. For >>> instance given fixed width symbol font (like all chess fonts) it would >>> be nice to ask how wide and how tall a given text string is. This >>> could be used to 'size' the window before display. Nothing I've seen >>> yet even hints that this is possible, yet it seems quit reasonable. >> >> I think you want 'get-text-extent' in 'dc<%>' (drawing context). >> >> Here are some rough guidelines: >> >> ?- 'editor<%>' and 'text%' deal with the text, its styles, modifications to >> the text, high-level display concerns (word wrapping, visible/ region, etc). >> >> ?- 'canvas<%>' and 'editor-canvas%' deal with the gui concerns: dimensions >> of the editor widget, its auxiliary gui elements (scrollbars), etc. >> >> ?- 'dc<%>' deals with rendering issues, like how big a string in a >> particular font will be rendered on screen. >> >> Browsing those classes and interfaces is a good way to get an idea of what >> functionality is available and how it's provided. Remember to look at the >> superclasses and superinterfaces, too. >> >> Ryan >> > From hsmyers at gmail.com Mon Jul 6 00:00:21 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Mon Jul 6 00:02:33 2009 Subject: [plt-scheme] GUI guides? In-Reply-To: <408995400907052012s5519c4b0p9891c353a3b3641a@mail.gmail.com> References: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> <408995400907051424x44de6807h8044ca1788d3ee8a@mail.gmail.com> <9E2E5A03-F463-4E00-A5A7-53CF568E69C6@ccs.neu.edu> <408995400907051452k2897092ra8a855dd7ab20590@mail.gmail.com> <408995400907051534h78501810r6374d8fae009fc9c@mail.gmail.com> <756daca50907051622va77f349y7ec14b7f6fcafdc1@mail.gmail.com> <408995400907051628m62f96514yb24520a2852ffe9f@mail.gmail.com> <4A514A9A.3070103@ccs.neu.edu> <408995400907051941s7a1c75d3sfc3dcc1abe716bbb@mail.gmail.com> <408995400907052012s5519c4b0p9891c353a3b3641a@mail.gmail.com> Message-ID: <408995400907052100k53b43158i1e9de891bc55e7e4@mail.gmail.com> The key to width of text is: > (define dc (send c get-dc)) > (send dc get-text-extent "123456787" (make-object font% 24 "Chess Adventurer" 'symbol)) 264.0 32.0 0.0 0.0 This while the dc in question exists... --hsm On Sun, Jul 5, 2009 at 9:12 PM, Hugh Myers wrote: > Added to list: > > Care and feeding of Status Line---a subject worth a guide in of itself: > > Create a status line > Open a status line > Write to a status line > Close a status line > Remove a status line > > Note that the overall status line is partitioned into writable areas. > For instance for a chess board, I would want to show the move text, > the move number and the move ply (move number without regard to color; > ply 1 is move 1 as is ply 2 [white's move followed by black's move > etc.]). Perhaps also information on castling, draw information etc. An > example rich environment. > > --hsm > > On Sun, Jul 5, 2009 at 8:41 PM, Hugh Myers wrote: >> Thanks for the pointer to dc% What you mention seems like a logical >> (heaven forbid) arrangement given the concepts involved. Having >> survived the age of roll-your-own gui (usually text), original >> windows, and then MFC this should be just another notch in my >> gui-belt. Even as we e-speak I'm in the middle of investigating frame% >> which has some of the answers in my shopping-list. I think one of the >> things that will be in my version of 'GUI Editor Guide' will be a list >> of what all can be set/modified for a given window. Sometimes it is >> easier to pick and choose from such a list than to comb a detailed >> reference--- I think as a guide, this approach might be the one to go >> with. >> >> --hsm >> >> On Sun, Jul 5, 2009 at 6:51 PM, Ryan Culpepper wrote: >>> Hugh Myers wrote: >>>> >>>> Am solving some of these as I try and think of questions to ask. Some >>>> of the answers raise questions about what is or isn't do-able. For >>>> instance given fixed width symbol font (like all chess fonts) it would >>>> be nice to ask how wide and how tall a given text string is. This >>>> could be used to 'size' the window before display. Nothing I've seen >>>> yet even hints that this is possible, yet it seems quit reasonable. >>> >>> I think you want 'get-text-extent' in 'dc<%>' (drawing context). >>> >>> Here are some rough guidelines: >>> >>> ?- 'editor<%>' and 'text%' deal with the text, its styles, modifications to >>> the text, high-level display concerns (word wrapping, visible/ region, etc). >>> >>> ?- 'canvas<%>' and 'editor-canvas%' deal with the gui concerns: dimensions >>> of the editor widget, its auxiliary gui elements (scrollbars), etc. >>> >>> ?- 'dc<%>' deals with rendering issues, like how big a string in a >>> particular font will be rendered on screen. >>> >>> Browsing those classes and interfaces is a good way to get an idea of what >>> functionality is available and how it's provided. Remember to look at the >>> superclasses and superinterfaces, too. >>> >>> Ryan >>> >> > From clements at brinckerhoff.org Mon Jul 6 00:20:02 2009 From: clements at brinckerhoff.org (John Clements) Date: Mon Jul 6 00:20:30 2009 Subject: [plt-scheme] Re: updating a teachpack to 4.2? In-Reply-To: <904774730907051838s5005cfaasd4d04d548262e602@mail.gmail.com> References: <904774730907051520l421993eale96afadd4dc5fb2f@mail.gmail.com> <904774730907051745s19a4b10ei621b28cab8f6f54a@mail.gmail.com> <19025.21409.871959.470109@winooski.ccs.neu.edu> <904774730907051838s5005cfaasd4d04d548262e602@mail.gmail.com> Message-ID: <9B19170A-5FD9-4D1A-AA2A-FCBCB6066D8D@brinckerhoff.org> For what it's worth, I fixed up my local copy; it looks like the only changes required were the change from the 'mzscheme' language to the 'scheme' language, and the removal of the image definitions from the corresponding 'tshirt-lab' file. I'm not looking at it, though, so it's possible that there were other changes I've forgotten, or more subtle issues that Eli's aware of; one of my workshop participants ran into a really strange looping bug on Windows only. Here's a link to my copy: http://users.csc.calpoly.edu/~clements/tsrj/fabric-teachpack.scm John On Jul 5, 2009, at 6:38 PM, Todd O'Bryan wrote: > Thanks! I'll check with her in a few days... > > On Sun, Jul 5, 2009 at 9:30 PM, Eli Barzilay wrote: >> There was some issues with that teachpack that were recently >> discovered -- likely the same one you've ran into. I worked with >> Kathi on resolving it so it should be fixed in the near future. >> >> >> On Jul 5, Todd O'Bryan wrote: >>> I should have mentioned, this should work with HtDP Beginning >>> Student language. >>> >>> On Sun, Jul 5, 2009 at 6:20 PM, Todd O'Bryan >>> wrote: >>>> I have a customized version of Kathi's terrific fabric teachpack >>>> here: >>>> >>>> https://www.dupontmanual.org/wikis/intro/Assignments/Fabric?action=AttachFile&do=get&target=manual-fabric-teachpack.ss.zip >>>> >>>> Unfortunately, it's not compatible with 4.2. I get: >>>> >>>> require: namespace mismatch; reference (phase 0) to a module >>>> "/home/tobryan1/plt-scheme/lib/plt/collects/scheme/private/kw.ss" >>>> that >>>> is not available (phase level 0) >>>> >>>> Can anybody help with the updating? >> >> -- >> ((lambda (x) (x x)) (lambda (x) (x x))) Eli >> Barzilay: >> http://barzilay.org/ Maze is >> Life! >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme -------------- 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/20090705/6dca0497/smime.bin From eli at barzilay.org Mon Jul 6 00:30:50 2009 From: eli at barzilay.org (Eli Barzilay) Date: Mon Jul 6 00:31:11 2009 Subject: [plt-scheme] Re: updating a teachpack to 4.2? In-Reply-To: <9B19170A-5FD9-4D1A-AA2A-FCBCB6066D8D@brinckerhoff.org> References: <904774730907051520l421993eale96afadd4dc5fb2f@mail.gmail.com> <904774730907051745s19a4b10ei621b28cab8f6f54a@mail.gmail.com> <19025.21409.871959.470109@winooski.ccs.neu.edu> <904774730907051838s5005cfaasd4d04d548262e602@mail.gmail.com> <9B19170A-5FD9-4D1A-AA2A-FCBCB6066D8D@brinckerhoff.org> Message-ID: <19025.32250.34572.513164@winooski.ccs.neu.edu> On Jul 5, John Clements wrote: > For what it's worth, I fixed up my local copy; it looks like the > only changes required were the change from the 'mzscheme' language > to the 'scheme' language, and the removal of the image definitions > from the corresponding 'tshirt-lab' file. I'm not looking at it, > though, so it's possible that there were other changes I've > forgotten, or more subtle issues that Eli's aware of; one of my > workshop participants ran into a really strange looping bug on > Windows only. That was mostly what I did (with the obvious changes that follows, like changes to `require' expressions etc), but I think that the copy I started from was something that Kathi already did some work on. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From robby at eecs.northwestern.edu Mon Jul 6 07:48:26 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Mon Jul 6 07:48:51 2009 Subject: [plt-scheme] GUI guides? In-Reply-To: <408995400907052100k53b43158i1e9de891bc55e7e4@mail.gmail.com> References: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> <9E2E5A03-F463-4E00-A5A7-53CF568E69C6@ccs.neu.edu> <408995400907051452k2897092ra8a855dd7ab20590@mail.gmail.com> <408995400907051534h78501810r6374d8fae009fc9c@mail.gmail.com> <756daca50907051622va77f349y7ec14b7f6fcafdc1@mail.gmail.com> <408995400907051628m62f96514yb24520a2852ffe9f@mail.gmail.com> <4A514A9A.3070103@ccs.neu.edu> <408995400907051941s7a1c75d3sfc3dcc1abe716bbb@mail.gmail.com> <408995400907052012s5519c4b0p9891c353a3b3641a@mail.gmail.com> <408995400907052100k53b43158i1e9de891bc55e7e4@mail.gmail.com> Message-ID: <932b2f1f0907060448u47339dbdm9a3e942206aaf35e@mail.gmail.com> One thing to not about dc's is that different dcs give different sizes for the same text. The dc you've used below is a canvas-dc% object, ie one for drawing on the screen. It will be the same as a bitmap-dc%. But a post-script-dc% and a printer-dc% will give different answers. Robby On Sun, Jul 5, 2009 at 11:00 PM, Hugh Myers wrote: > The key to width of text is: > >> (define dc (send c get-dc)) >> (send dc get-text-extent "123456787" (make-object font% 24 "Chess Adventurer" 'symbol)) > > 264.0 > 32.0 > 0.0 > 0.0 > > This while the dc in question exists... > > --hsm > > On Sun, Jul 5, 2009 at 9:12 PM, Hugh Myers wrote: >> Added to list: >> >> Care and feeding of Status Line---a subject worth a guide in of itself: >> >> Create a status line >> Open a status line >> Write to a status line >> Close a status line >> Remove a status line >> >> Note that the overall status line is partitioned into writable areas. >> For instance for a chess board, I would want to show the move text, >> the move number and the move ply (move number without regard to color; >> ply 1 is move 1 as is ply 2 [white's move followed by black's move >> etc.]). Perhaps also information on castling, draw information etc. An >> example rich environment. >> >> --hsm >> >> On Sun, Jul 5, 2009 at 8:41 PM, Hugh Myers wrote: >>> Thanks for the pointer to dc% What you mention seems like a logical >>> (heaven forbid) arrangement given the concepts involved. Having >>> survived the age of roll-your-own gui (usually text), original >>> windows, and then MFC this should be just another notch in my >>> gui-belt. Even as we e-speak I'm in the middle of investigating frame% >>> which has some of the answers in my shopping-list. I think one of the >>> things that will be in my version of 'GUI Editor Guide' will be a list >>> of what all can be set/modified for a given window. Sometimes it is >>> easier to pick and choose from such a list than to comb a detailed >>> reference--- I think as a guide, this approach might be the one to go >>> with. >>> >>> --hsm >>> >>> On Sun, Jul 5, 2009 at 6:51 PM, Ryan Culpepper wrote: >>>> Hugh Myers wrote: >>>>> >>>>> Am solving some of these as I try and think of questions to ask. Some >>>>> of the answers raise questions about what is or isn't do-able. For >>>>> instance given fixed width symbol font (like all chess fonts) it would >>>>> be nice to ask how wide and how tall a given text string is. This >>>>> could be used to 'size' the window before display. Nothing I've seen >>>>> yet even hints that this is possible, yet it seems quit reasonable. >>>> >>>> I think you want 'get-text-extent' in 'dc<%>' (drawing context). >>>> >>>> Here are some rough guidelines: >>>> >>>> ?- 'editor<%>' and 'text%' deal with the text, its styles, modifications to >>>> the text, high-level display concerns (word wrapping, visible/ region, etc). >>>> >>>> ?- 'canvas<%>' and 'editor-canvas%' deal with the gui concerns: dimensions >>>> of the editor widget, its auxiliary gui elements (scrollbars), etc. >>>> >>>> ?- 'dc<%>' deals with rendering issues, like how big a string in a >>>> particular font will be rendered on screen. >>>> >>>> Browsing those classes and interfaces is a good way to get an idea of what >>>> functionality is available and how it's provided. Remember to look at the >>>> superclasses and superinterfaces, too. >>>> >>>> Ryan >>>> >>> >> > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From hsmyers at gmail.com Mon Jul 6 07:55:46 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Mon Jul 6 07:56:26 2009 Subject: [plt-scheme] GUI guides? In-Reply-To: <408995400907052100k53b43158i1e9de891bc55e7e4@mail.gmail.com> References: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> <9E2E5A03-F463-4E00-A5A7-53CF568E69C6@ccs.neu.edu> <408995400907051452k2897092ra8a855dd7ab20590@mail.gmail.com> <408995400907051534h78501810r6374d8fae009fc9c@mail.gmail.com> <756daca50907051622va77f349y7ec14b7f6fcafdc1@mail.gmail.com> <408995400907051628m62f96514yb24520a2852ffe9f@mail.gmail.com> <4A514A9A.3070103@ccs.neu.edu> <408995400907051941s7a1c75d3sfc3dcc1abe716bbb@mail.gmail.com> <408995400907052012s5519c4b0p9891c353a3b3641a@mail.gmail.com> <408995400907052100k53b43158i1e9de891bc55e7e4@mail.gmail.com> Message-ID: <408995400907060455r5456d419p56cb3701e831a03@mail.gmail.com> Good point. Are you saying this is the wrong approach to correctly sizing a window displaying a chess font? If so what would you recommend? --hsm On Sun, Jul 5, 2009 at 10:00 PM, Hugh Myers wrote: > The key to width of text is: > >> (define dc (send c get-dc)) >> (send dc get-text-extent "123456787" (make-object font% 24 "Chess Adventurer" 'symbol)) > > 264.0 > 32.0 > 0.0 > 0.0 > > This while the dc in question exists... > > --hsm > > On Sun, Jul 5, 2009 at 9:12 PM, Hugh Myers wrote: >> Added to list: >> >> Care and feeding of Status Line---a subject worth a guide in of itself: >> >> Create a status line >> Open a status line >> Write to a status line >> Close a status line >> Remove a status line >> >> Note that the overall status line is partitioned into writable areas. >> For instance for a chess board, I would want to show the move text, >> the move number and the move ply (move number without regard to color; >> ply 1 is move 1 as is ply 2 [white's move followed by black's move >> etc.]). Perhaps also information on castling, draw information etc. An >> example rich environment. >> >> --hsm >> >> On Sun, Jul 5, 2009 at 8:41 PM, Hugh Myers wrote: >>> Thanks for the pointer to dc% What you mention seems like a logical >>> (heaven forbid) arrangement given the concepts involved. Having >>> survived the age of roll-your-own gui (usually text), original >>> windows, and then MFC this should be just another notch in my >>> gui-belt. Even as we e-speak I'm in the middle of investigating frame% >>> which has some of the answers in my shopping-list. I think one of the >>> things that will be in my version of 'GUI Editor Guide' will be a list >>> of what all can be set/modified for a given window. Sometimes it is >>> easier to pick and choose from such a list than to comb a detailed >>> reference--- I think as a guide, this approach might be the one to go >>> with. >>> >>> --hsm >>> >>> On Sun, Jul 5, 2009 at 6:51 PM, Ryan Culpepper wrote: >>>> Hugh Myers wrote: >>>>> >>>>> Am solving some of these as I try and think of questions to ask. Some >>>>> of the answers raise questions about what is or isn't do-able. For >>>>> instance given fixed width symbol font (like all chess fonts) it would >>>>> be nice to ask how wide and how tall a given text string is. This >>>>> could be used to 'size' the window before display. Nothing I've seen >>>>> yet even hints that this is possible, yet it seems quit reasonable. >>>> >>>> I think you want 'get-text-extent' in 'dc<%>' (drawing context). >>>> >>>> Here are some rough guidelines: >>>> >>>> ?- 'editor<%>' and 'text%' deal with the text, its styles, modifications to >>>> the text, high-level display concerns (word wrapping, visible/ region, etc). >>>> >>>> ?- 'canvas<%>' and 'editor-canvas%' deal with the gui concerns: dimensions >>>> of the editor widget, its auxiliary gui elements (scrollbars), etc. >>>> >>>> ?- 'dc<%>' deals with rendering issues, like how big a string in a >>>> particular font will be rendered on screen. >>>> >>>> Browsing those classes and interfaces is a good way to get an idea of what >>>> functionality is available and how it's provided. Remember to look at the >>>> superclasses and superinterfaces, too. >>>> >>>> Ryan >>>> >>> >> > From robby at eecs.northwestern.edu Mon Jul 6 08:03:16 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Mon Jul 6 08:03:46 2009 Subject: [plt-scheme] GUI guides? In-Reply-To: <408995400907060455r5456d419p56cb3701e831a03@mail.gmail.com> References: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> <408995400907051452k2897092ra8a855dd7ab20590@mail.gmail.com> <408995400907051534h78501810r6374d8fae009fc9c@mail.gmail.com> <756daca50907051622va77f349y7ec14b7f6fcafdc1@mail.gmail.com> <408995400907051628m62f96514yb24520a2852ffe9f@mail.gmail.com> <4A514A9A.3070103@ccs.neu.edu> <408995400907051941s7a1c75d3sfc3dcc1abe716bbb@mail.gmail.com> <408995400907052012s5519c4b0p9891c353a3b3641a@mail.gmail.com> <408995400907052100k53b43158i1e9de891bc55e7e4@mail.gmail.com> <408995400907060455r5456d419p56cb3701e831a03@mail.gmail.com> Message-ID: <932b2f1f0907060503x236d5b7ewf8a87000a8e85cd5@mail.gmail.com> That's a fine way to sizing the window, but if you want to print the window, that sizing information will be wrong. Generally, you want to abstract over the dc for all drawing (maybe you've done that already) and then just pass in the appropriate that you get from the system (usually from the get-dc method of a canvas%, the on-paint method of editor<%> or the print method of an editor<%>). Just be careful you don't use a global values that are computed from the wrong dc. Robby On Mon, Jul 6, 2009 at 6:55 AM, Hugh Myers wrote: > Good point. Are you saying this is the wrong approach to correctly > sizing a window displaying a chess font? If so what would you > recommend? > > --hsm > > > On Sun, Jul 5, 2009 at 10:00 PM, Hugh Myers wrote: >> The key to width of text is: >> >>> (define dc (send c get-dc)) >>> (send dc get-text-extent "123456787" (make-object font% 24 "Chess Adventurer" 'symbol)) >> >> 264.0 >> 32.0 >> 0.0 >> 0.0 >> >> This while the dc in question exists... >> >> --hsm >> >> On Sun, Jul 5, 2009 at 9:12 PM, Hugh Myers wrote: >>> Added to list: >>> >>> Care and feeding of Status Line---a subject worth a guide in of itself: >>> >>> Create a status line >>> Open a status line >>> Write to a status line >>> Close a status line >>> Remove a status line >>> >>> Note that the overall status line is partitioned into writable areas. >>> For instance for a chess board, I would want to show the move text, >>> the move number and the move ply (move number without regard to color; >>> ply 1 is move 1 as is ply 2 [white's move followed by black's move >>> etc.]). Perhaps also information on castling, draw information etc. An >>> example rich environment. >>> >>> --hsm >>> >>> On Sun, Jul 5, 2009 at 8:41 PM, Hugh Myers wrote: >>>> Thanks for the pointer to dc% What you mention seems like a logical >>>> (heaven forbid) arrangement given the concepts involved. Having >>>> survived the age of roll-your-own gui (usually text), original >>>> windows, and then MFC this should be just another notch in my >>>> gui-belt. Even as we e-speak I'm in the middle of investigating frame% >>>> which has some of the answers in my shopping-list. I think one of the >>>> things that will be in my version of 'GUI Editor Guide' will be a list >>>> of what all can be set/modified for a given window. Sometimes it is >>>> easier to pick and choose from such a list than to comb a detailed >>>> reference--- I think as a guide, this approach might be the one to go >>>> with. >>>> >>>> --hsm >>>> >>>> On Sun, Jul 5, 2009 at 6:51 PM, Ryan Culpepper wrote: >>>>> Hugh Myers wrote: >>>>>> >>>>>> Am solving some of these as I try and think of questions to ask. Some >>>>>> of the answers raise questions about what is or isn't do-able. For >>>>>> instance given fixed width symbol font (like all chess fonts) it would >>>>>> be nice to ask how wide and how tall a given text string is. This >>>>>> could be used to 'size' the window before display. Nothing I've seen >>>>>> yet even hints that this is possible, yet it seems quit reasonable. >>>>> >>>>> I think you want 'get-text-extent' in 'dc<%>' (drawing context). >>>>> >>>>> Here are some rough guidelines: >>>>> >>>>> ?- 'editor<%>' and 'text%' deal with the text, its styles, modifications to >>>>> the text, high-level display concerns (word wrapping, visible/ region, etc). >>>>> >>>>> ?- 'canvas<%>' and 'editor-canvas%' deal with the gui concerns: dimensions >>>>> of the editor widget, its auxiliary gui elements (scrollbars), etc. >>>>> >>>>> ?- 'dc<%>' deals with rendering issues, like how big a string in a >>>>> particular font will be rendered on screen. >>>>> >>>>> Browsing those classes and interfaces is a good way to get an idea of what >>>>> functionality is available and how it's provided. Remember to look at the >>>>> superclasses and superinterfaces, too. >>>>> >>>>> Ryan >>>>> >>>> >>> >> > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From hsmyers at gmail.com Mon Jul 6 08:11:53 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Mon Jul 6 08:12:34 2009 Subject: [plt-scheme] GUI guides? In-Reply-To: <932b2f1f0907060503x236d5b7ewf8a87000a8e85cd5@mail.gmail.com> References: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> <408995400907051534h78501810r6374d8fae009fc9c@mail.gmail.com> <756daca50907051622va77f349y7ec14b7f6fcafdc1@mail.gmail.com> <408995400907051628m62f96514yb24520a2852ffe9f@mail.gmail.com> <4A514A9A.3070103@ccs.neu.edu> <408995400907051941s7a1c75d3sfc3dcc1abe716bbb@mail.gmail.com> <408995400907052012s5519c4b0p9891c353a3b3641a@mail.gmail.com> <408995400907052100k53b43158i1e9de891bc55e7e4@mail.gmail.com> <408995400907060455r5456d419p56cb3701e831a03@mail.gmail.com> <932b2f1f0907060503x236d5b7ewf8a87000a8e85cd5@mail.gmail.com> Message-ID: <408995400907060511t2b1f6eccg1861963ac176b474@mail.gmail.com> Printing will be done in postscript where such information isn't needed. Not quite sure why I'd want to play with a print dc but obviously if I were going to I'd use the correct source. Not sure why I'd use globals either--- what I need can be computed at point of need just fine. Width of full line of text in a chess board remains constant so only needs to be computed just before showing the window. --hsm On Mon, Jul 6, 2009 at 6:03 AM, Robby Findler wrote: > That's a fine way to sizing the window, but if you want to print the > window, that sizing information will be wrong. > > Generally, you want to abstract over the dc for all drawing (maybe > you've done that already) and then just pass in the appropriate that > you get from the system (usually from the get-dc method of a canvas%, > the on-paint method of editor<%> or the print method of an editor<%>). > Just be careful you don't use a global values that are computed from > the wrong dc. > > Robby > > On Mon, Jul 6, 2009 at 6:55 AM, Hugh Myers wrote: >> Good point. Are you saying this is the wrong approach to correctly >> sizing a window displaying a chess font? If so what would you >> recommend? >> >> --hsm >> >> >> On Sun, Jul 5, 2009 at 10:00 PM, Hugh Myers wrote: >>> The key to width of text is: >>> >>>> (define dc (send c get-dc)) >>>> (send dc get-text-extent "123456787" (make-object font% 24 "Chess Adventurer" 'symbol)) >>> >>> 264.0 >>> 32.0 >>> 0.0 >>> 0.0 >>> >>> This while the dc in question exists... >>> >>> --hsm >>> >>> On Sun, Jul 5, 2009 at 9:12 PM, Hugh Myers wrote: >>>> Added to list: >>>> >>>> Care and feeding of Status Line---a subject worth a guide in of itself: >>>> >>>> Create a status line >>>> Open a status line >>>> Write to a status line >>>> Close a status line >>>> Remove a status line >>>> >>>> Note that the overall status line is partitioned into writable areas. >>>> For instance for a chess board, I would want to show the move text, >>>> the move number and the move ply (move number without regard to color; >>>> ply 1 is move 1 as is ply 2 [white's move followed by black's move >>>> etc.]). Perhaps also information on castling, draw information etc. An >>>> example rich environment. >>>> >>>> --hsm >>>> >>>> On Sun, Jul 5, 2009 at 8:41 PM, Hugh Myers wrote: >>>>> Thanks for the pointer to dc% What you mention seems like a logical >>>>> (heaven forbid) arrangement given the concepts involved. Having >>>>> survived the age of roll-your-own gui (usually text), original >>>>> windows, and then MFC this should be just another notch in my >>>>> gui-belt. Even as we e-speak I'm in the middle of investigating frame% >>>>> which has some of the answers in my shopping-list. I think one of the >>>>> things that will be in my version of 'GUI Editor Guide' will be a list >>>>> of what all can be set/modified for a given window. Sometimes it is >>>>> easier to pick and choose from such a list than to comb a detailed >>>>> reference--- I think as a guide, this approach might be the one to go >>>>> with. >>>>> >>>>> --hsm >>>>> >>>>> On Sun, Jul 5, 2009 at 6:51 PM, Ryan Culpepper wrote: >>>>>> Hugh Myers wrote: >>>>>>> >>>>>>> Am solving some of these as I try and think of questions to ask. Some >>>>>>> of the answers raise questions about what is or isn't do-able. For >>>>>>> instance given fixed width symbol font (like all chess fonts) it would >>>>>>> be nice to ask how wide and how tall a given text string is. This >>>>>>> could be used to 'size' the window before display. Nothing I've seen >>>>>>> yet even hints that this is possible, yet it seems quit reasonable. >>>>>> >>>>>> I think you want 'get-text-extent' in 'dc<%>' (drawing context). >>>>>> >>>>>> Here are some rough guidelines: >>>>>> >>>>>> ?- 'editor<%>' and 'text%' deal with the text, its styles, modifications to >>>>>> the text, high-level display concerns (word wrapping, visible/ region, etc). >>>>>> >>>>>> ?- 'canvas<%>' and 'editor-canvas%' deal with the gui concerns: dimensions >>>>>> of the editor widget, its auxiliary gui elements (scrollbars), etc. >>>>>> >>>>>> ?- 'dc<%>' deals with rendering issues, like how big a string in a >>>>>> particular font will be rendered on screen. >>>>>> >>>>>> Browsing those classes and interfaces is a good way to get an idea of what >>>>>> functionality is available and how it's provided. Remember to look at the >>>>>> superclasses and superinterfaces, too. >>>>>> >>>>>> Ryan >>>>>> >>>>> >>>> >>> >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > From hsmyers at gmail.com Mon Jul 6 08:20:12 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Mon Jul 6 08:20:56 2009 Subject: [plt-scheme] GUI guides? In-Reply-To: <408995400907060511t2b1f6eccg1861963ac176b474@mail.gmail.com> References: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> <756daca50907051622va77f349y7ec14b7f6fcafdc1@mail.gmail.com> <408995400907051628m62f96514yb24520a2852ffe9f@mail.gmail.com> <4A514A9A.3070103@ccs.neu.edu> <408995400907051941s7a1c75d3sfc3dcc1abe716bbb@mail.gmail.com> <408995400907052012s5519c4b0p9891c353a3b3641a@mail.gmail.com> <408995400907052100k53b43158i1e9de891bc55e7e4@mail.gmail.com> <408995400907060455r5456d419p56cb3701e831a03@mail.gmail.com> <932b2f1f0907060503x236d5b7ewf8a87000a8e85cd5@mail.gmail.com> <408995400907060511t2b1f6eccg1861963ac176b474@mail.gmail.com> Message-ID: <408995400907060520v4321c29ay85a42cd6e076b8c@mail.gmail.com> Just noticed a slight hitch to such re-sizing. 1. no set-width or set-height 2. not even the old 'reposition-window' standby that is used mostly to resize a window and only sometimes to actually move the silly thing. Since such things are required, under what name would I find them? --hsm On Mon, Jul 6, 2009 at 6:11 AM, Hugh Myers wrote: > Printing will be done in postscript where such information isn't > needed. Not quite sure why I'd want to play with a print dc but > obviously if I were going to I'd use the correct source. Not sure why > I'd use globals either--- what I need can be computed at point of need > just fine. Width of full line of text in a chess board remains > constant so only needs to be computed just before showing the window. > > --hsm > > > > On Mon, Jul 6, 2009 at 6:03 AM, Robby > Findler wrote: >> That's a fine way to sizing the window, but if you want to print the >> window, that sizing information will be wrong. >> >> Generally, you want to abstract over the dc for all drawing (maybe >> you've done that already) and then just pass in the appropriate that >> you get from the system (usually from the get-dc method of a canvas%, >> the on-paint method of editor<%> or the print method of an editor<%>). >> Just be careful you don't use a global values that are computed from >> the wrong dc. >> >> Robby >> >> On Mon, Jul 6, 2009 at 6:55 AM, Hugh Myers wrote: >>> Good point. Are you saying this is the wrong approach to correctly >>> sizing a window displaying a chess font? If so what would you >>> recommend? >>> >>> --hsm >>> >>> >>> On Sun, Jul 5, 2009 at 10:00 PM, Hugh Myers wrote: >>>> The key to width of text is: >>>> >>>>> (define dc (send c get-dc)) >>>>> (send dc get-text-extent "123456787" (make-object font% 24 "Chess Adventurer" 'symbol)) >>>> >>>> 264.0 >>>> 32.0 >>>> 0.0 >>>> 0.0 >>>> >>>> This while the dc in question exists... >>>> >>>> --hsm >>>> >>>> On Sun, Jul 5, 2009 at 9:12 PM, Hugh Myers wrote: >>>>> Added to list: >>>>> >>>>> Care and feeding of Status Line---a subject worth a guide in of itself: >>>>> >>>>> Create a status line >>>>> Open a status line >>>>> Write to a status line >>>>> Close a status line >>>>> Remove a status line >>>>> >>>>> Note that the overall status line is partitioned into writable areas. >>>>> For instance for a chess board, I would want to show the move text, >>>>> the move number and the move ply (move number without regard to color; >>>>> ply 1 is move 1 as is ply 2 [white's move followed by black's move >>>>> etc.]). Perhaps also information on castling, draw information etc. An >>>>> example rich environment. >>>>> >>>>> --hsm >>>>> >>>>> On Sun, Jul 5, 2009 at 8:41 PM, Hugh Myers wrote: >>>>>> Thanks for the pointer to dc% What you mention seems like a logical >>>>>> (heaven forbid) arrangement given the concepts involved. Having >>>>>> survived the age of roll-your-own gui (usually text), original >>>>>> windows, and then MFC this should be just another notch in my >>>>>> gui-belt. Even as we e-speak I'm in the middle of investigating frame% >>>>>> which has some of the answers in my shopping-list. I think one of the >>>>>> things that will be in my version of 'GUI Editor Guide' will be a list >>>>>> of what all can be set/modified for a given window. Sometimes it is >>>>>> easier to pick and choose from such a list than to comb a detailed >>>>>> reference--- I think as a guide, this approach might be the one to go >>>>>> with. >>>>>> >>>>>> --hsm >>>>>> >>>>>> On Sun, Jul 5, 2009 at 6:51 PM, Ryan Culpepper wrote: >>>>>>> Hugh Myers wrote: >>>>>>>> >>>>>>>> Am solving some of these as I try and think of questions to ask. Some >>>>>>>> of the answers raise questions about what is or isn't do-able. For >>>>>>>> instance given fixed width symbol font (like all chess fonts) it would >>>>>>>> be nice to ask how wide and how tall a given text string is. This >>>>>>>> could be used to 'size' the window before display. Nothing I've seen >>>>>>>> yet even hints that this is possible, yet it seems quit reasonable. >>>>>>> >>>>>>> I think you want 'get-text-extent' in 'dc<%>' (drawing context). >>>>>>> >>>>>>> Here are some rough guidelines: >>>>>>> >>>>>>> ?- 'editor<%>' and 'text%' deal with the text, its styles, modifications to >>>>>>> the text, high-level display concerns (word wrapping, visible/ region, etc). >>>>>>> >>>>>>> ?- 'canvas<%>' and 'editor-canvas%' deal with the gui concerns: dimensions >>>>>>> of the editor widget, its auxiliary gui elements (scrollbars), etc. >>>>>>> >>>>>>> ?- 'dc<%>' deals with rendering issues, like how big a string in a >>>>>>> particular font will be rendered on screen. >>>>>>> >>>>>>> Browsing those classes and interfaces is a good way to get an idea of what >>>>>>> functionality is available and how it's provided. Remember to look at the >>>>>>> superclasses and superinterfaces, too. >>>>>>> >>>>>>> Ryan >>>>>>> >>>>>> >>>>> >>>> >>> _________________________________________________ >>> ?For list-related administrative tasks: >>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >> > From pocmatos at gmail.com Mon Jul 6 08:56:38 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Jul 6 08:57:20 2009 Subject: [plt-scheme] GUI guides? In-Reply-To: <408995400907051534h78501810r6374d8fae009fc9c@mail.gmail.com> References: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> <4F1688A7-E188-4385-852E-1E0541F3B118@ccs.neu.edu> <408995400907051424x44de6807h8044ca1788d3ee8a@mail.gmail.com> <9E2E5A03-F463-4E00-A5A7-53CF568E69C6@ccs.neu.edu> <408995400907051452k2897092ra8a855dd7ab20590@mail.gmail.com> <408995400907051534h78501810r6374d8fae009fc9c@mail.gmail.com> Message-ID: <11b141710907060556n6f66d90by616e192c6b6fcddd@mail.gmail.com> On Sun, Jul 5, 2009 at 11:34 PM, Hugh Myers wrote: > Here is what I had in mind as an example for 'editor': > > Given: > > (define f (new frame% [label "Simple Edit"] > ? ? ? ? ? ? ? ? ? ? ? [width 200] > ? ? ? ? ? ? ? ? ? ? ? [height 200])) > > (define c (new editor-canvas% [parent f])) > (define t (new text%)) > (send c set-editor t) > > How do I programatically: Another one: Define a 'language-mode' that provides indentation and highlighting for the text that's written? [or for emacs fans: how to I define a 'major-mode' for an editor-canvas in PLT-Scheme?] -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From ebzzry at gmail.com Mon Jul 6 11:05:27 2009 From: ebzzry at gmail.com (Rommel M. Martinez) Date: Mon Jul 6 11:06:07 2009 Subject: [plt-scheme] lazy require Message-ID: <391934950907060805i5c417780i34788728893c745f@mail.gmail.com> Hi! Does PLT Scheme have an equivalent for a "lazy require" functionality, wherein a module only gets loaded, or require'd if a symbol provided/exported by that module is referenced? -- Rommel M. Martinez http://www.bespin.org/~ebzzry From eli at barzilay.org Mon Jul 6 12:18:49 2009 From: eli at barzilay.org (Eli Barzilay) Date: Mon Jul 6 12:19:11 2009 Subject: [plt-scheme] lazy require In-Reply-To: <391934950907060805i5c417780i34788728893c745f@mail.gmail.com> References: <391934950907060805i5c417780i34788728893c745f@mail.gmail.com> Message-ID: <19026.9193.649924.628792@winooski.ccs.neu.edu> On Jul 6, Rommel M. Martinez wrote: > Hi! Does PLT Scheme have an equivalent for a "lazy require" > functionality, wherein a module only gets loaded, or require'd if a > symbol provided/exported by that module is referenced? No, but it would be easy to write your own wrapper, something like (define-syntax-rule (define-autoload name reqspec) (define name (lambda args (set! name (dynamic-require 'reqspec 'name)) (apply name args)))) You can also do that for non-function values, by using identifier macros. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From jay.mccarthy at gmail.com Mon Jul 6 12:22:57 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Mon Jul 6 12:30:26 2009 Subject: [plt-scheme] help with stateless servlets In-Reply-To: References: Message-ID: Hi Holden, You didn't do anything wrong. There was a bug in servlet-env. I've fixed it in SVN and you should be able to get it in the nightly build for tonight (or if you use SVN, just do that.) Also, we're having a release soon so you can wait until then. Jay On Sat, Jul 4, 2009 at 8:59 PM, Holden Karau wrote: > I'm having some difficulty creating/launching a stateless servlet > When I run the following code I get back "procedure > make-stateless.servlet: expects 4 arguments, given 3: > # > # #" > yousseb.ss defines & exports start, manager & stuffer for good measure > (although I already pass manager & stuffer in as paramaters to > serve/servlet ) > I assume I've missed something completely obvious to make this work, what is it? > #lang scheme > (require "mypath.ss") > (require web-server/servlet-env) > (require web-server/configuration/responders) > (require web-server/managers/lru) > (require "youuseb.ss") > (require web-server/stuffers/base64) > (require web-server/stuffers) > (require web-server/stuffers/hmac-sha1) > (define exp ?(lambda (req) > ? ?`(html (head (title "Expired")) > ? ? ? ? ? (body (h1 "Expired") > ? ? ? ? ? ? ? ? (p "This URL has expired. " > ? ? ? ? ? ? ? ? ? ?"Please return to the home page." > ? ? ? ? ? ? ? ? ? ? "This is likely because of increased load. It shouldn't happen > again." )))) ) > (define use 2) > (define mystuffer > ? (stuffer-chain > ? ?serialize-stuffer > ? ?(md5-stuffer (build-path "/tmp/" ".urls")))) > > (define mymanager (make-threshold-LRU-manager exp ? ? ? 2524000000)) > > (serve/servlet start > ? ? ? ? ? ? ? #:launch-browser? #f > ? ? ? ? ? ? ? #:quit? #f > ? ? ? ? ? ? ? #:file-not-found-responder (gen-file-not-found-responder > (build-path "/usr/src/awesome/static" "404.html")) > ? ? ? ? ? ? ? #:log-file ?"/usr/src/awesome/mylog4" > ? ? ? ? ? ? ? #:log-format 'extended > ? ? ? ? ? ? ? #:listen-ip #f > ? ? ? ? ? ? ? #:manager mymanager > ? ? ? ? ? ? ? #:port 8085 > ? ? ? ? ? ? ? #:stuffer mystuffer > ? ? ? ? ? ? ? #:command-line? #t > ? ? ? ? ? ? ? #:extra-files-paths > ? ? ? ? ? ? ? (list (build-path mypath "static")) > ? ? ? ? ? ? ? #:servlet-path "/app/" > ? ? ? ? ? ? ? #:stateless? #t) > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From matthias at ccs.neu.edu Mon Jul 6 13:04:22 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Jul 6 13:05:19 2009 Subject: [plt-scheme] lazy require In-Reply-To: <19026.9193.649924.628792@winooski.ccs.neu.edu> References: <391934950907060805i5c417780i34788728893c745f@mail.gmail.com> <19026.9193.649924.628792@winooski.ccs.neu.edu> Message-ID: <4439DF66-6C20-40CE-BD07-EE0C5707C91A@ccs.neu.edu> Ah, but I bet Rommel wants to change the imported module and the function and possibly even the collection of functions that the module exports while the program is running. (See my first paper, ever :-) -- Matthias On Jul 6, 2009, at 12:18 PM, Eli Barzilay wrote: > On Jul 6, Rommel M. Martinez wrote: >> Hi! Does PLT Scheme have an equivalent for a "lazy require" >> functionality, wherein a module only gets loaded, or require'd if a >> symbol provided/exported by that module is referenced? > > No, but it would be easy to write your own wrapper, something like > > (define-syntax-rule (define-autoload name reqspec) > (define name > (lambda args > (set! name (dynamic-require 'reqspec 'name)) > (apply name args)))) > > You can also do that for non-function values, by using identifier > macros. > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli > Barzilay: > http://barzilay.org/ Maze is > Life! > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From eli at barzilay.org Mon Jul 6 13:17:36 2009 From: eli at barzilay.org (Eli Barzilay) Date: Mon Jul 6 13:17:58 2009 Subject: [plt-scheme] lazy require In-Reply-To: <4439DF66-6C20-40CE-BD07-EE0C5707C91A@ccs.neu.edu> References: <391934950907060805i5c417780i34788728893c745f@mail.gmail.com> <19026.9193.649924.628792@winooski.ccs.neu.edu> <4439DF66-6C20-40CE-BD07-EE0C5707C91A@ccs.neu.edu> Message-ID: <19026.12720.852981.9838@winooski.ccs.neu.edu> On Jul 6, Matthias Felleisen wrote: > > Ah, but I bet Rommel wants to change the imported module and the > function and possibly even the collection of functions that the > module exports while the program is running. (See my first paper, > ever :-) -- Matthias That's possible too -- it was discussed very recently in the "on-demand module reloading" thread. The code that I pointed to ("collects/handin-server/private/reloadable.ss") should be easy to change so it loads the module only when needed. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From ebzzry at gmail.com Mon Jul 6 14:35:24 2009 From: ebzzry at gmail.com (Rommel M. Martinez) Date: Mon Jul 6 14:36:06 2009 Subject: [plt-scheme] lazy require In-Reply-To: <19026.12720.852981.9838@winooski.ccs.neu.edu> References: <391934950907060805i5c417780i34788728893c745f@mail.gmail.com> <19026.9193.649924.628792@winooski.ccs.neu.edu> <4439DF66-6C20-40CE-BD07-EE0C5707C91A@ccs.neu.edu> <19026.12720.852981.9838@winooski.ccs.neu.edu> Message-ID: <391934950907061135v65cf51f9t3a420f5cf15bf513@mail.gmail.com> On Tue, Jul 7, 2009 at 1:17 AM, Eli Barzilay wrote: > On Jul ?6, Matthias Felleisen wrote: >> >> Ah, but I bet Rommel wants to change the imported module and the >> function and possibly even the collection of functions that the >> module exports while the program is running. (See my first paper, >> ever :-) -- Matthias > > That's possible too -- it was discussed very recently in the > "on-demand module reloading" thread. ?The code that I pointed to > ("collects/handin-server/private/reloadable.ss") should be easy to > change so it loads the module only when needed. > > -- > ? ? ? ? ?((lambda (x) (x x)) (lambda (x) (x x))) ? ? ? ? ?Eli Barzilay: > ? ? ? ? ? ? ? ? ? ?http://barzilay.org/ ? ? ? ? ? ? ? ? ? Maze is Life! > Thanks, thanks. I'll look at those. :-] -- Rommel M. Martinez http://www.bespin.org/~ebzzry From grettke at acm.org Mon Jul 6 16:42:44 2009 From: grettke at acm.org (Grant Rettke) Date: Mon Jul 6 16:49:40 2009 Subject: [plt-scheme] Is a Scribble-like interaction form available in Slideshow? Message-ID: <756daca50907061342t4e247949s93bb5f421d496801@mail.gmail.com> Scribble's interaction form: http://download.plt-scheme.org/doc/html/scribble/eval.html makes it look like a good tool for preparing presentations. Is something like that available in Slideshow? I found define-exec-code: http://download.plt-scheme.org/doc/html/slideshow/Typesetting_Scheme_Code.html#(form._((lib._slideshow/code..ss)._define-exec-code)) I am not getting a good feel for how to utilize it though, I will do some more reading. From hsmyers at gmail.com Mon Jul 6 17:51:52 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Mon Jul 6 17:52:33 2009 Subject: [plt-scheme] GUI guides? In-Reply-To: <408995400907060520v4321c29ay85a42cd6e076b8c@mail.gmail.com> References: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> <408995400907051628m62f96514yb24520a2852ffe9f@mail.gmail.com> <4A514A9A.3070103@ccs.neu.edu> <408995400907051941s7a1c75d3sfc3dcc1abe716bbb@mail.gmail.com> <408995400907052012s5519c4b0p9891c353a3b3641a@mail.gmail.com> <408995400907052100k53b43158i1e9de891bc55e7e4@mail.gmail.com> <408995400907060455r5456d419p56cb3701e831a03@mail.gmail.com> <932b2f1f0907060503x236d5b7ewf8a87000a8e85cd5@mail.gmail.com> <408995400907060511t2b1f6eccg1861963ac176b474@mail.gmail.com> <408995400907060520v4321c29ay85a42cd6e076b8c@mail.gmail.com> Message-ID: <408995400907061451w63af2ebcl9bcb49b59b32fa2d@mail.gmail.com> When it comes to sizing an window/editor etc at least part of the solution is the following: (send f resize 200 200) Which will work quite nicely. --hsm On Mon, Jul 6, 2009 at 6:20 AM, Hugh Myers wrote: > Just noticed a slight hitch to such re-sizing. > > 1. no set-width or set-height > 2. not even the old 'reposition-window' standby that is used mostly to > resize a window and only sometimes to actually move the silly thing. > > Since such things are required, under what name would I find them? > > --hsm > > On Mon, Jul 6, 2009 at 6:11 AM, Hugh Myers wrote: >> Printing will be done in postscript where such information isn't >> needed. Not quite sure why I'd want to play with a print dc but >> obviously if I were going to I'd use the correct source. Not sure why >> I'd use globals either--- what I need can be computed at point of need >> just fine. Width of full line of text in a chess board remains >> constant so only needs to be computed just before showing the window. >> >> --hsm >> >> >> >> On Mon, Jul 6, 2009 at 6:03 AM, Robby >> Findler wrote: >>> That's a fine way to sizing the window, but if you want to print the >>> window, that sizing information will be wrong. >>> >>> Generally, you want to abstract over the dc for all drawing (maybe >>> you've done that already) and then just pass in the appropriate that >>> you get from the system (usually from the get-dc method of a canvas%, >>> the on-paint method of editor<%> or the print method of an editor<%>). >>> Just be careful you don't use a global values that are computed from >>> the wrong dc. >>> >>> Robby >>> >>> On Mon, Jul 6, 2009 at 6:55 AM, Hugh Myers wrote: >>>> Good point. Are you saying this is the wrong approach to correctly >>>> sizing a window displaying a chess font? If so what would you >>>> recommend? >>>> >>>> --hsm >>>> >>>> >>>> On Sun, Jul 5, 2009 at 10:00 PM, Hugh Myers wrote: >>>>> The key to width of text is: >>>>> >>>>>> (define dc (send c get-dc)) >>>>>> (send dc get-text-extent "123456787" (make-object font% 24 "Chess Adventurer" 'symbol)) >>>>> >>>>> 264.0 >>>>> 32.0 >>>>> 0.0 >>>>> 0.0 >>>>> >>>>> This while the dc in question exists... >>>>> >>>>> --hsm >>>>> >>>>> On Sun, Jul 5, 2009 at 9:12 PM, Hugh Myers wrote: >>>>>> Added to list: >>>>>> >>>>>> Care and feeding of Status Line---a subject worth a guide in of itself: >>>>>> >>>>>> Create a status line >>>>>> Open a status line >>>>>> Write to a status line >>>>>> Close a status line >>>>>> Remove a status line >>>>>> >>>>>> Note that the overall status line is partitioned into writable areas. >>>>>> For instance for a chess board, I would want to show the move text, >>>>>> the move number and the move ply (move number without regard to color; >>>>>> ply 1 is move 1 as is ply 2 [white's move followed by black's move >>>>>> etc.]). Perhaps also information on castling, draw information etc. An >>>>>> example rich environment. >>>>>> >>>>>> --hsm >>>>>> >>>>>> On Sun, Jul 5, 2009 at 8:41 PM, Hugh Myers wrote: >>>>>>> Thanks for the pointer to dc% What you mention seems like a logical >>>>>>> (heaven forbid) arrangement given the concepts involved. Having >>>>>>> survived the age of roll-your-own gui (usually text), original >>>>>>> windows, and then MFC this should be just another notch in my >>>>>>> gui-belt. Even as we e-speak I'm in the middle of investigating frame% >>>>>>> which has some of the answers in my shopping-list. I think one of the >>>>>>> things that will be in my version of 'GUI Editor Guide' will be a list >>>>>>> of what all can be set/modified for a given window. Sometimes it is >>>>>>> easier to pick and choose from such a list than to comb a detailed >>>>>>> reference--- I think as a guide, this approach might be the one to go >>>>>>> with. >>>>>>> >>>>>>> --hsm >>>>>>> >>>>>>> On Sun, Jul 5, 2009 at 6:51 PM, Ryan Culpepper wrote: >>>>>>>> Hugh Myers wrote: >>>>>>>>> >>>>>>>>> Am solving some of these as I try and think of questions to ask. Some >>>>>>>>> of the answers raise questions about what is or isn't do-able. For >>>>>>>>> instance given fixed width symbol font (like all chess fonts) it would >>>>>>>>> be nice to ask how wide and how tall a given text string is. This >>>>>>>>> could be used to 'size' the window before display. Nothing I've seen >>>>>>>>> yet even hints that this is possible, yet it seems quit reasonable. >>>>>>>> >>>>>>>> I think you want 'get-text-extent' in 'dc<%>' (drawing context). >>>>>>>> >>>>>>>> Here are some rough guidelines: >>>>>>>> >>>>>>>> ?- 'editor<%>' and 'text%' deal with the text, its styles, modifications to >>>>>>>> the text, high-level display concerns (word wrapping, visible/ region, etc). >>>>>>>> >>>>>>>> ?- 'canvas<%>' and 'editor-canvas%' deal with the gui concerns: dimensions >>>>>>>> of the editor widget, its auxiliary gui elements (scrollbars), etc. >>>>>>>> >>>>>>>> ?- 'dc<%>' deals with rendering issues, like how big a string in a >>>>>>>> particular font will be rendered on screen. >>>>>>>> >>>>>>>> Browsing those classes and interfaces is a good way to get an idea of what >>>>>>>> functionality is available and how it's provided. Remember to look at the >>>>>>>> superclasses and superinterfaces, too. >>>>>>>> >>>>>>>> Ryan >>>>>>>> >>>>>>> >>>>>> >>>>> >>>> _________________________________________________ >>>> ?For list-related administrative tasks: >>>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>> >>> >> > From hsmyers at gmail.com Mon Jul 6 21:53:09 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Mon Jul 6 21:53:50 2009 Subject: [plt-scheme] GUI guides? In-Reply-To: <408995400907061451w63af2ebcl9bcb49b59b32fa2d@mail.gmail.com> References: <408995400907050932w31348c8clb7ad909223d833df@mail.gmail.com> <4A514A9A.3070103@ccs.neu.edu> <408995400907051941s7a1c75d3sfc3dcc1abe716bbb@mail.gmail.com> <408995400907052012s5519c4b0p9891c353a3b3641a@mail.gmail.com> <408995400907052100k53b43158i1e9de891bc55e7e4@mail.gmail.com> <408995400907060455r5456d419p56cb3701e831a03@mail.gmail.com> <932b2f1f0907060503x236d5b7ewf8a87000a8e85cd5@mail.gmail.com> <408995400907060511t2b1f6eccg1861963ac176b474@mail.gmail.com> <408995400907060520v4321c29ay85a42cd6e076b8c@mail.gmail.com> <408995400907061451w63af2ebcl9bcb49b59b32fa2d@mail.gmail.com> Message-ID: <408995400907061853q75ab50cfic41ff8aae9c05de7@mail.gmail.com> Here in rather crude form is an example of using the GUI for a pop-up chessboard... (define (cb) (define f (new frame% [label " Chess Board"] [style (list 'no-resize-border 'no-system-menu)] )) (define c (new editor-canvas% [parent f] [style (list 'no-hscroll 'no-vscroll)] )) (define t (new text% [line-spacing 0])) (send f create-status-line) (send c set-editor t) (send t change-style (make-object style-delta% 'change-size 24)) (send t change-style (send (make-object style-delta%) set-delta-face "Chess Leipzig")) (list f c t)) (define r (cb)) (define (sb [txt "Initial Position"]) (send (third r) select-all) (send (third r) clear) (send (third r) insert (board-gui)) (send (first r) set-status-text txt) (let-values ([(w h x y) (send (send (second r) get-dc) get-text-extent "22222222" (make-object font% 24 "Chess Leipzig" 'symbol))]) (send (first r) resize (inexact->exact (+ 15 w)) (inexact->exact (+ 55 (* 8 h))))) (send (first r) show #t) ) (define (sb-dbl [txt "Initial Position"]) (send (third r) select-all) (send (third r) clear) (send (third r) insert (board-gui-dbl)) (send (first r) set-status-text txt) (let-values ([(w h x y) (send (send (second r) get-dc) get-text-extent bottom-dbl-border (make-object font% 24 "Chess Leipzig" 'symbol))]) (send (first r) resize (inexact->exact (+ 15 w)) (inexact->exact (+ 55 (* 10 h))))) (send (first r) show #t) ) This allows either a simple form with out font border (sb) or one with an algebraic border. A 'real' version will remove the duplicate code and allow feeding positions etc. This exists to explore the GUI possibilities. Still a fair amount of questions on my shopping list so I shall forge ahead. --hsm --hsm On Mon, Jul 6, 2009 at 3:51 PM, Hugh Myers wrote: > When it comes to sizing an window/editor etc at least part of the > solution ?is ?the following: > > ?(send f resize 200 200) > > Which will work quite nicely. > > --hsm > > On Mon, Jul 6, 2009 at 6:20 AM, Hugh Myers wrote: >> Just noticed a slight hitch to such re-sizing. >> >> 1. no set-width or set-height >> 2. not even the old 'reposition-window' standby that is used mostly to >> resize a window and only sometimes to actually move the silly thing. >> >> Since such things are required, under what name would I find them? >> >> --hsm >> >> On Mon, Jul 6, 2009 at 6:11 AM, Hugh Myers wrote: >>> Printing will be done in postscript where such information isn't >>> needed. Not quite sure why I'd want to play with a print dc but >>> obviously if I were going to I'd use the correct source. Not sure why >>> I'd use globals either--- what I need can be computed at point of need >>> just fine. Width of full line of text in a chess board remains >>> constant so only needs to be computed just before showing the window. >>> >>> --hsm >>> >>> >>> >>> On Mon, Jul 6, 2009 at 6:03 AM, Robby >>> Findler wrote: >>>> That's a fine way to sizing the window, but if you want to print the >>>> window, that sizing information will be wrong. >>>> >>>> Generally, you want to abstract over the dc for all drawing (maybe >>>> you've done that already) and then just pass in the appropriate that >>>> you get from the system (usually from the get-dc method of a canvas%, >>>> the on-paint method of editor<%> or the print method of an editor<%>). >>>> Just be careful you don't use a global values that are computed from >>>> the wrong dc. >>>> >>>> Robby >>>> >>>> On Mon, Jul 6, 2009 at 6:55 AM, Hugh Myers wrote: >>>>> Good point. Are you saying this is the wrong approach to correctly >>>>> sizing a window displaying a chess font? If so what would you >>>>> recommend? >>>>> >>>>> --hsm >>>>> >>>>> >>>>> On Sun, Jul 5, 2009 at 10:00 PM, Hugh Myers wrote: >>>>>> The key to width of text is: >>>>>> >>>>>>> (define dc (send c get-dc)) >>>>>>> (send dc get-text-extent "123456787" (make-object font% 24 "Chess Adventurer" 'symbol)) >>>>>> >>>>>> 264.0 >>>>>> 32.0 >>>>>> 0.0 >>>>>> 0.0 >>>>>> >>>>>> This while the dc in question exists... >>>>>> >>>>>> --hsm >>>>>> >>>>>> On Sun, Jul 5, 2009 at 9:12 PM, Hugh Myers wrote: >>>>>>> Added to list: >>>>>>> >>>>>>> Care and feeding of Status Line---a subject worth a guide in of itself: >>>>>>> >>>>>>> Create a status line >>>>>>> Open a status line >>>>>>> Write to a status line >>>>>>> Close a status line >>>>>>> Remove a status line >>>>>>> >>>>>>> Note that the overall status line is partitioned into writable areas. >>>>>>> For instance for a chess board, I would want to show the move text, >>>>>>> the move number and the move ply (move number without regard to color; >>>>>>> ply 1 is move 1 as is ply 2 [white's move followed by black's move >>>>>>> etc.]). Perhaps also information on castling, draw information etc. An >>>>>>> example rich environment. >>>>>>> >>>>>>> --hsm >>>>>>> >>>>>>> On Sun, Jul 5, 2009 at 8:41 PM, Hugh Myers wrote: >>>>>>>> Thanks for the pointer to dc% What you mention seems like a logical >>>>>>>> (heaven forbid) arrangement given the concepts involved. Having >>>>>>>> survived the age of roll-your-own gui (usually text), original >>>>>>>> windows, and then MFC this should be just another notch in my >>>>>>>> gui-belt. Even as we e-speak I'm in the middle of investigating frame% >>>>>>>> which has some of the answers in my shopping-list. I think one of the >>>>>>>> things that will be in my version of 'GUI Editor Guide' will be a list >>>>>>>> of what all can be set/modified for a given window. Sometimes it is >>>>>>>> easier to pick and choose from such a list than to comb a detailed >>>>>>>> reference--- I think as a guide, this approach might be the one to go >>>>>>>> with. >>>>>>>> >>>>>>>> --hsm >>>>>>>> >>>>>>>> On Sun, Jul 5, 2009 at 6:51 PM, Ryan Culpepper wrote: >>>>>>>>> Hugh Myers wrote: >>>>>>>>>> >>>>>>>>>> Am solving some of these as I try and think of questions to ask. Some >>>>>>>>>> of the answers raise questions about what is or isn't do-able. For >>>>>>>>>> instance given fixed width symbol font (like all chess fonts) it would >>>>>>>>>> be nice to ask how wide and how tall a given text string is. This >>>>>>>>>> could be used to 'size' the window before display. Nothing I've seen >>>>>>>>>> yet even hints that this is possible, yet it seems quit reasonable. >>>>>>>>> >>>>>>>>> I think you want 'get-text-extent' in 'dc<%>' (drawing context). >>>>>>>>> >>>>>>>>> Here are some rough guidelines: >>>>>>>>> >>>>>>>>> ?- 'editor<%>' and 'text%' deal with the text, its styles, modifications to >>>>>>>>> the text, high-level display concerns (word wrapping, visible/ region, etc). >>>>>>>>> >>>>>>>>> ?- 'canvas<%>' and 'editor-canvas%' deal with the gui concerns: dimensions >>>>>>>>> of the editor widget, its auxiliary gui elements (scrollbars), etc. >>>>>>>>> >>>>>>>>> ?- 'dc<%>' deals with rendering issues, like how big a string in a >>>>>>>>> particular font will be rendered on screen. >>>>>>>>> >>>>>>>>> Browsing those classes and interfaces is a good way to get an idea of what >>>>>>>>> functionality is available and how it's provided. Remember to look at the >>>>>>>>> superclasses and superinterfaces, too. >>>>>>>>> >>>>>>>>> Ryan >>>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>> _________________________________________________ >>>>> ?For list-related administrative tasks: >>>>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>>> >>>> >>> >> > From clements at brinckerhoff.org Tue Jul 7 03:46:25 2009 From: clements at brinckerhoff.org (John Clements) Date: Tue Jul 7 03:46:54 2009 Subject: [plt-scheme] A data point on 'match' in intro programming: +++! Message-ID: I'm leading high-school students through the construction of a bare- bones "universe.ss" application that models the prisoner's dilemma, and I decided to import 'match' using a teachpack. My experience thus far has been completely positive, and if there's a drawback to using 'match' to replace structure-reference functions and predicates, it hasn't come up. Well, actually, I suppose I can imagine the following objections: - a straightforward import of 'match' doesn't support symbol patterns (presumably, it's a different "quote"). - you can't do nifty higher-order things with predicates and structure reference functions. Both of these seem pretty minor. Anyhow: thanks, all, especially Sam! John -------------- 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/20090707/dceca953/smime.bin From grettke at acm.org Tue Jul 7 09:36:49 2009 From: grettke at acm.org (Grant Rettke) Date: Tue Jul 7 09:37:08 2009 Subject: [plt-scheme] On hygiene and trust Message-ID: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> Hi folks, Over the past year or so I've collected fragments from email where people who might simply be referred to as "macro gods" have shared with the list that hygiene is essential when you start dealing with anything more than trivial macros. I believe that the PLT object system is implemented with macros, and there is probably more too, right? I have also studied and practiced writing macros with syntax-rules and syntax-case. I have learned perhaps enough to know how to use them, but I have also learned enough to know that I have a long way to go in terms of being comfortable with manipulating syntax objects. Perhaps it is just practice, but same difference. Not sure how to say this but I think I know how good I am and also how bad I am at it! (seriously :) ) I have also seen posts in comp.lang.scheme and also here demonstrating situations where defmacro/gensym could not provide the desired hygiene. I didn't dig in deeper yet, though. The reason I think about this is that on a mostly Lisper mailing list someone asked me why hygiene is better, and barring simply hygiene examples that I can explain, I don't understand the deeper issues. I couldn't explain it. However, I trust what the experts have said here, that hygiene is the best. I know that it is not good to trust though, and it is better to understand. Is there some key paper or research that covers this topic? Best wishes, Grant From plragde at uwaterloo.ca Tue Jul 7 12:15:28 2009 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Tue Jul 7 12:15:54 2009 Subject: [plt-scheme] A data point on 'match' in intro programming: +++! In-Reply-To: Message-ID: <4A5374A0.3070204@uwaterloo.ca> John Clements wrote: > I'm leading high-school students through the construction of a bare- > bones "universe.ss" application that models the prisoner's dilemma, > and I decided to import 'match' using a teachpack. My experience thus > far has been completely positive, and if there's a drawback to using > 'match' to replace structure-reference functions and predicates, it > hasn't come up. > > Well, actually, I suppose I can imagine the following objections: > - a straightforward import of 'match' doesn't support symbol patterns > (presumably, it's a different "quote"). > - you can't do nifty higher-order things with predicates and structure > reference functions. It would be nice if these could be fixed. In the "advanced" first-term class I teach to really good students, I could use match pretty early, except that I've never been able to get it to do the things I want when I try importing it into a teaching language (I definitely want symbol patterns and predicates). As it stands, I have to introduce it after we move to Module about halfway through, and that's later than I'd like. I think match as a shorthand for destructuring parallels list and quote notation as a shorthand for structuring, and can be introduced after some explicit practice with accessor functions. --PR From clements at brinckerhoff.org Tue Jul 7 12:26:23 2009 From: clements at brinckerhoff.org (John Clements) Date: Tue Jul 7 12:26:43 2009 Subject: [plt-scheme] A data point on 'match' in intro programming: +++! In-Reply-To: <4A5374A0.3070204@uwaterloo.ca> References: <4A5374A0.3070204@uwaterloo.ca> Message-ID: <2C846491-8229-435D-A759-9FDE0B704AE0@brinckerhoff.org> On Jul 7, 2009, at 9:15 AM, Prabhakar Ragde wrote: > John Clements wrote: > >> I'm leading high-school students through the construction of a >> bare- bones "universe.ss" application that models the prisoner's >> dilemma, and I decided to import 'match' using a teachpack. My >> experience thus far has been completely positive, and if there's a >> drawback to using 'match' to replace structure-reference functions >> and predicates, it hasn't come up. >> Well, actually, I suppose I can imagine the following objections: >> - a straightforward import of 'match' doesn't support symbol >> patterns (presumably, it's a different "quote"). >> - you can't do nifty higher-order things with predicates and >> structure reference functions. > > It would be nice if these could be fixed. In the "advanced" first- > term class I teach to really good students, I could use match pretty > early, except that I've never been able to get it to do the things I > want when I try importing it into a teaching language (I definitely > want symbol patterns and predicates). As it stands, I have to > introduce it after we move to Module about halfway through, and > that's later than I'd like. I think you're misunderstanding me, though I now see that what I said wasn't well explained. The point about symbol pattterns stands, but you *can* write structure patterns just fine; all I was suggesting was that if you introduce structures in this way, then when you want to show the kids how to use filter to extract all of the llama's from a list, you have to explicitly introduce 'llama?' or let them write it themselves. John > I think match as a shorthand for destructuring parallels list and > quote notation as a shorthand for structuring, and can be introduced > after some explicit practice with accessor functions. That's the traditional approach (IIUC), and it may well lead to better understanding. John -------------- 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/20090707/8ee9e246/smime.bin From clements at brinckerhoff.org Tue Jul 7 12:31:57 2009 From: clements at brinckerhoff.org (John Clements) Date: Tue Jul 7 12:32:21 2009 Subject: [plt-scheme] A data point on 'match' in intro programming: +++! In-Reply-To: <2C846491-8229-435D-A759-9FDE0B704AE0@brinckerhoff.org> References: <4A5374A0.3070204@uwaterloo.ca> <2C846491-8229-435D-A759-9FDE0B704AE0@brinckerhoff.org> Message-ID: <25F7E0F2-EE00-45B6-A7DC-8690C16B5964@brinckerhoff.org> On Jul 7, 2009, at 9:26 AM, John Clements wrote: > > On Jul 7, 2009, at 9:15 AM, Prabhakar Ragde wrote: > >> John Clements wrote: >> >>> I'm leading high-school students through the construction of a >>> bare- bones "universe.ss" application that models the prisoner's >>> dilemma, and I decided to import 'match' using a teachpack. My >>> experience thus far has been completely positive, and if there's >>> a drawback to using 'match' to replace structure-reference >>> functions and predicates, it hasn't come up. >>> Well, actually, I suppose I can imagine the following objections: >>> - a straightforward import of 'match' doesn't support symbol >>> patterns (presumably, it's a different "quote"). >>> - you can't do nifty higher-order things with predicates and >>> structure reference functions. >> >> It would be nice if these could be fixed. In the "advanced" first- >> term class I teach to really good students, I could use match >> pretty early, except that I've never been able to get it to do the >> things I want when I try importing it into a teaching language (I >> definitely want symbol patterns and predicates). As it stands, I >> have to introduce it after we move to Module about halfway through, >> and that's later than I'd like. > > I think you're misunderstanding me, though I now see that what I > said wasn't well explained. The point about symbol pattterns > stands, but you *can* write structure patterns just fine; all I was > suggesting was that if you introduce structures in this way, then > when you want to show the kids how to use filter to extract all of > the llama's from a list, you have to explicitly introduce 'llama?' > or let them write it themselves. > > John > >> I think match as a shorthand for destructuring parallels list and >> quote notation as a shorthand for structuring, and can be >> introduced after some explicit practice with accessor functions. > > That's the traditional approach (IIUC), and it may well lead to > better understanding. Just to be a bit more inflammatory: I'm not showing them 'cond'; just 'match'. John -------------- 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/20090707/8895e234/smime.bin From plragde at uwaterloo.ca Tue Jul 7 13:06:29 2009 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Tue Jul 7 13:07:14 2009 Subject: [plt-scheme] A data point on 'match' in intro programming: +++! In-Reply-To: <2C846491-8229-435D-A759-9FDE0B704AE0@brinckerhoff.org> References: <4A5374A0.3070204@uwaterloo.ca> <2C846491-8229-435D-A759-9FDE0B704AE0@brinckerhoff.org> Message-ID: <4A538095.3080401@uwaterloo.ca> John Clements wrote: > I think you're misunderstanding me, though I now see that what I said > wasn't well explained. The point about symbol pattterns stands, but you > *can* write structure patterns just fine Okay, I see. Are symbol patterns all that broke for you? I remember this, but I cannot remember what else breaks. (I guess I could do some experiments.) And does anyone (Sam?) know how to fix them? > Just to be a bit more inflammatory: I'm not showing them 'cond'; just 'match'. I suppose if they don't need `cond', there's no reason to burden them with it, but I find it hard to imagine that they can entirely do without that or `if'. --PR From jmarshall at alum.mit.edu Tue Jul 7 13:52:24 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Tue Jul 7 13:53:02 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> Message-ID: On Tue, Jul 7, 2009 at 6:36 AM, Grant Rettke wrote: > > The reason I think about this is that on a mostly Lisper mailing list > someone asked me why hygiene is better, and barring simply hygiene > examples that I can explain, I don't understand the deeper issues. I > couldn't explain it. There are two issues. First is whether hygiene is good. Hygienic macros are simply lexical scoping applied to macros. If you like lexical scoping and you want it to keep working when you add macros to the language, you need hygiene. If you want the *default* to be lexical scoping, then hygienic expansion should be the default mode of operation. The second issue is how hygienic macros are implemented and defined, and whether, and how one goes about bypassing the hygiene. The current solutions seem a bit kludgy to me. syntax-rules works well for simple macros, but is a pain for more complex ones. Syntax-case is uniformly painful for simple and complex uses. defmacro is really easy to use and understand, but isn't hygienic. -- ~jrm From eli at barzilay.org Tue Jul 7 14:23:58 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jul 7 14:24:33 2009 Subject: [plt-scheme] A data point on 'match' in intro programming: +++! In-Reply-To: <25F7E0F2-EE00-45B6-A7DC-8690C16B5964@brinckerhoff.org> References: <4A5374A0.3070204@uwaterloo.ca> <2C846491-8229-435D-A759-9FDE0B704AE0@brinckerhoff.org> <25F7E0F2-EE00-45B6-A7DC-8690C16B5964@brinckerhoff.org> Message-ID: <19027.37566.437224.337391@winooski.ccs.neu.edu> On Jul 7, John Clements wrote: > > On Jul 7, 2009, at 9:26 AM, John Clements wrote: > > > That's the traditional approach (IIUC), and it may well lead to > > better understanding. > > Just to be a bit more inflammatory: I'm not showing them 'cond'; > just 'match'. I've ran into this in my class too. When it gets to using a `Foo?', it is definitely more convenient than (cases [(Foo _) #t] [else #f]) enough to the degree that most students discover that the predicate is defined (even when I don't tell them about it). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From matthias at ccs.neu.edu Wed Jul 8 02:24:29 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Jul 8 02:25:25 2009 Subject: [plt-scheme] A data point on 'match' in intro programming: +++! In-Reply-To: References: Message-ID: I would love to use match in introductory courses to get away from a lot of details. (I introduced match into Scheme 84 in 1984.) Doing so would be a great disfavor to our students. Very few of them will end up working with a language that supports match, once they are on their first co-op etc. If I prepare them with structures/predicates/ selectors etc, they have at least a chance to adapt some of what they learned in "210" to their work. If we had showed them match and even 'deep' matches, it would just be one more large conflict between this silly, design-recipe FP stuff and their real world. -- Matthias From hsmyers at gmail.com Wed Jul 8 02:34:50 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Wed Jul 8 02:35:31 2009 Subject: [plt-scheme] A data point on 'match' in intro programming: +++! In-Reply-To: References: Message-ID: <408995400907072334l4faf120ew4e8e06fc5a0b73d8@mail.gmail.com> Just to step in a moment; I'd point out that at this point I'm coding in lisp (admittedly CL, not scheme) on a commercial project so I'm not really clear on your notion about what they can use in the real world. After learning where the library is, the second most important thing students need to learn is how to 'think'. Match and 'deep' matches are far more likely to provide think-fuel than leaving such gems out of the curriculum. --hsm On Wed, Jul 8, 2009 at 12:24 AM, Matthias Felleisen wrote: > > I would love to use match in introductory courses to get away from a lot of > details. (I introduced match into Scheme 84 in 1984.) Doing so would be a > great disfavor to our students. Very few of them will end up working with a > language that supports match, once they are on their first co-op etc. If I > prepare them with structures/predicates/selectors etc, they have at least a > chance to adapt some of what they learned in "210" to their work. If we had > showed them match and even 'deep' matches, it would just be one more large > conflict between this silly, design-recipe FP stuff and their real world. -- > Matthias > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From matthias at ccs.neu.edu Wed Jul 8 02:42:16 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Jul 8 02:43:20 2009 Subject: [plt-scheme] A data point on 'match' in intro programming: +++! In-Reply-To: <408995400907072334l4faf120ew4e8e06fc5a0b73d8@mail.gmail.com> References: <408995400907072334l4faf120ew4e8e06fc5a0b73d8@mail.gmail.com> Message-ID: <209E9084-696F-41D1-8AC8-36A566039460@ccs.neu.edu> Nobody's arguing for leaving them out of the curriculum. This is a conversation about the pedagogy of How to Design Programs, 15 years of experience teaching freshmen at elite and not so elite schools, and the _average_ students and the _average_ internship or coop that they get in the first summer or third semester. -- Matthias P.S. Congrats to landing a CL job in the real world. On Jul 8, 2009, at 2:34 AM, Hugh Myers wrote: > Just to step in a moment; I'd point out that at this point I'm coding > in lisp (admittedly CL, not scheme) on a commercial project so I'm not > really clear on your notion about what they can use in the real world. > After learning where the library is, the second most important thing > students need to learn is how to 'think'. Match and 'deep' matches are > far more likely to provide think-fuel than leaving such gems out of > the curriculum. > > --hsm > > On Wed, Jul 8, 2009 at 12:24 AM, Matthias > Felleisen wrote: >> >> I would love to use match in introductory courses to get away from >> a lot of >> details. (I introduced match into Scheme 84 in 1984.) Doing so >> would be a >> great disfavor to our students. Very few of them will end up >> working with a >> language that supports match, once they are on their first co-op >> etc. If I >> prepare them with structures/predicates/selectors etc, they have >> at least a >> chance to adapt some of what they learned in "210" to their work. >> If we had >> showed them match and even 'deep' matches, it would just be one >> more large >> conflict between this silly, design-recipe FP stuff and their real >> world. -- >> Matthias >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> From hsmyers at gmail.com Wed Jul 8 02:55:46 2009 From: hsmyers at gmail.com (Hugh Myers) Date: Wed Jul 8 02:56:27 2009 Subject: [plt-scheme] A data point on 'match' in intro programming: +++! In-Reply-To: <209E9084-696F-41D1-8AC8-36A566039460@ccs.neu.edu> References: <408995400907072334l4faf120ew4e8e06fc5a0b73d8@mail.gmail.com> <209E9084-696F-41D1-8AC8-36A566039460@ccs.neu.edu> Message-ID: <408995400907072355i9b287b3v21b374e42ce8c02f@mail.gmail.com> Ah! My error--- I feared a lowering of the bar, something I see all to often these days; sorry to even indirectly tar you with that brush. --hsm p.s. turns out that I was the only Perl programmer who knew lisp well enough to do the job. Knowing what I now know, I might well have pushed for scheme instead. On Wed, Jul 8, 2009 at 12:42 AM, Matthias Felleisen wrote: > > Nobody's arguing for leaving them out of the curriculum. > This is a conversation about the pedagogy of How to Design > Programs, 15 years of experience teaching freshmen at elite > and not so elite schools, and the _average_ students and the > _average_ internship or coop that they get in the first summer > or third semester. -- Matthias > > P.S. Congrats to landing a CL job in the real world. > > > On Jul 8, 2009, at 2:34 AM, Hugh Myers wrote: > >> Just to step in a moment; I'd point out that at this point I'm coding >> in lisp (admittedly CL, not scheme) on a commercial project so I'm not >> really clear on your notion about what they can use in the real world. >> After learning where the library is, the second most important thing >> students need to learn is how to 'think'. Match and 'deep' matches are >> far more likely to provide think-fuel than leaving such gems out of >> the curriculum. >> >> --hsm >> >> On Wed, Jul 8, 2009 at 12:24 AM, Matthias Felleisen >> wrote: >>> >>> I would love to use match in introductory courses to get away from a lot >>> of >>> details. (I introduced match into Scheme 84 in 1984.) Doing so would be a >>> great disfavor to our students. Very few of them will end up working with >>> a >>> language that supports match, once they are on their first co-op etc. If >>> I >>> prepare them with structures/predicates/selectors etc, they have at least >>> a >>> chance to adapt some of what they learned in "210" to their work. If we >>> had >>> showed them match and even 'deep' matches, it would just be one more >>> large >>> conflict between this silly, design-recipe FP stuff and their real world. >>> -- >>> Matthias >>> >>> _________________________________________________ >>> ?For list-related administrative tasks: >>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> > > From egarrulo at gmail.com Wed Jul 8 04:47:50 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Wed Jul 8 04:48:10 2009 Subject: [plt-scheme] Control+Backspace as backward-kill-word? Message-ID: <9bd8a08a0907080147t7a4080f5mb687b78f02c97535@mail.gmail.com> Hello, I'd like to have Control+Backspace remapped as backward-kill-word. Following advice found over the net, I've tried both these snippets of code, which not work: #lang s-exp framework/keybinding-lang (keybinding "c:del" (? (editor evt) (send editor backward-kill-word))) #lang s-exp framework/keybinding-lang (keybinding "c:del" (lambda (editor event) (send (send editor get-keymap) call-function "backward-kill-word" editor event #t))) Any help? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090708/1e301b4e/attachment.html From sk at cs.brown.edu Wed Jul 8 08:18:42 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Wed Jul 8 08:19:24 2009 Subject: [plt-scheme] A data point on 'match' in intro programming: +++! In-Reply-To: References: Message-ID: It would be *just* one more (and arguably hardly the biggest one). Your argument is largely the same one people use to justify teaching Java in the first semester. Shriram On Wed, Jul 8, 2009 at 2:24 AM, Matthias Felleisen wrote: > > I would love to use match in introductory courses to get away from a lot of > details. (I introduced match into Scheme 84 in 1984.) Doing so would be a > great disfavor to our students. Very few of them will end up working with a > language that supports match, once they are on their first co-op etc. If I > prepare them with structures/predicates/selectors etc, they have at least a > chance to adapt some of what they learned in "210" to their work. If we had > showed them match and even 'deep' matches, it would just be one more large > conflict between this silly, design-recipe FP stuff and their real world. -- > Matthias > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From grettke at acm.org Wed Jul 8 09:43:29 2009 From: grettke at acm.org (Grant Rettke) Date: Wed Jul 8 09:43:51 2009 Subject: [plt-scheme] A data point on 'match' in intro programming: +++! In-Reply-To: References: Message-ID: <756daca50907080643w60b4ab2fk5d2f22165fb160d@mail.gmail.com> On Wed, Jul 8, 2009 at 7:18 AM, Shriram Krishnamurthi wrote: > It would be *just* one more (and arguably hardly the biggest one). > > Your argument is largely the same one people use to justify teaching > Java in the first semester. In the long run, teaching "advanced" language features is better for the economy, because it creates jobs. How? When your former students leave their jobs, they need additional programmers to re-write their code because it is "too hard to understand". You think I am joking? From sk at cs.brown.edu Wed Jul 8 09:45:56 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Wed Jul 8 09:46:38 2009 Subject: [plt-scheme] A data point on 'match' in intro programming: +++! In-Reply-To: <756daca50907080643w60b4ab2fk5d2f22165fb160d@mail.gmail.com> References: <756daca50907080643w60b4ab2fk5d2f22165fb160d@mail.gmail.com> Message-ID: The network effects of knowledge of programming languages are complex and, to language researchers, sometimes undesirable. Shriram On Wed, Jul 8, 2009 at 9:43 AM, Grant Rettke wrote: > On Wed, Jul 8, 2009 at 7:18 AM, Shriram Krishnamurthi wrote: >> It would be *just* one more (and arguably hardly the biggest one). >> >> Your argument is largely the same one people use to justify teaching >> Java in the first semester. > > In the long run, teaching "advanced" language features is better for > the economy, because it creates jobs. How? > > When your former students leave their jobs, they need additional > programmers to re-write their code because it is "too hard to > understand". > > You think I am joking? > From plragde at uwaterloo.ca Wed Jul 8 10:18:13 2009 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Wed Jul 8 10:18:42 2009 Subject: [plt-scheme] A data point on 'match' in intro programming: +++! In-Reply-To: Message-ID: <4A54AAA5.8070501@uwaterloo.ca> Matthias wrote: > I would love to use match in introductory courses to get away from a > lot of details. (I introduced match into Scheme 84 in 1984.) Doing so > would be a great disfavor to our students. Very few of them will end > up working with a language that supports match, once they are on > their first co-op etc. If I prepare them with structures/predicates/ > selectors etc, they have at least a chance to adapt some of what they > learned in "210" to their work. If we had showed them match and even > 'deep' matches, it would just be one more large conflict between this > silly, design-recipe FP stuff and their real world. -- Matthias I think the pedagogy of lists in HtDP is dead on -- introduce cons alone and work with it, then provide list, first, second, etc. once students are ready for it. I typically get howls of outrage when we move up to abbreviations. "Why didn't you tell us about this before?" I explain. They don't always believe me, but that's too bad. It's the right thing to do. In the same sense, I think a late introduction to match would work well. I don't begrudge John his experiment with very-early match, though I wouldn't make a habit of it. What I would do is introduce it when it becomes useful, which in my mind is somewhere late in or past the tree material. As a concrete example, I have taught Braun trees in our first course, because they provide a useful example of a simple logarithmic-depth data structure where only structural recursion is used. One can implement priority queues using Braun trees, but the code using accessors is longer and more tedious than it needs to be. The code using match is short and clean enough that I actually used this as an exam question. But since I'm still in Beginning Student with List Abbreviations when we do Braun trees, I can't ask such questions until we leave the teaching languages entirely. Now, this is not what most people would do in a first course, so I am not advocating making this an integral part of the teaching languages. But quasiquote is in them, even though I would make the same argument for that. At any rate, what I am asking for is how I can put match, or something like it, into a teachpack. I also think you are selling pattern-matching a bit short. It is a very good bridge to ML, Haskell, and Erlang, and I believe it will show up in multi-paradigm languages (if it hasn't already), because it's just so convenient for expressivity. We owe our students the chance to see things that they will later do their damndest to sneak into their workplace. --PR From aghuloum at gmail.com Wed Jul 8 10:31:54 2009 From: aghuloum at gmail.com (Abdulaziz Ghuloum) Date: Wed Jul 8 10:33:06 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> Message-ID: On Jul 7, 2009, at 8:52 PM, Joe Marshall wrote: > syntax-rules works well for simple macros, but is a pain for more > complex ones. I agree with this. > Syntax-case is uniformly painful for simple and complex uses. I don't agree. Show me a painful simple use. Pick any simple macro you want: let, let*, or, and, cond, case, or any other macro of your choice to show the pain. > defmacro is really easy to use and understand, but isn't hygienic. I don't agree that defmacro is easy to use without a pattern matching facility. Again, write the example that you provide (above) using defmacro; I doubt it will be simpler or easier or more robust, or anything. Aziz,,, From jmarshall at alum.mit.edu Wed Jul 8 11:04:45 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Wed Jul 8 11:05:23 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> Message-ID: > On Jul 7, 2009, at 8:52 PM, Joe Marshall wrote: >> >> Syntax-case is uniformly painful for simple and complex uses. On Wed, Jul 8, 2009 at 7:31 AM, Abdulaziz Ghuloum wrote: > I don't agree. ?Show me a painful simple use. ?Pick any simple > macro you want: let, let*, or, and, cond, case, or any other > macro of your choice to show the pain. This came up the other day. Transform something like this: (define-event foo bar (arg1 arg2 ...) (form1) (form2 ...) etc.) into something like this: (define (foo$bar arg1 arg2 ...) (form1) (form2 ...) etc.) >> defmacro is really easy to use and understand, but isn't hygienic. > > I don't agree that defmacro is easy to use without a pattern > matching facility. ?Again, write the example that you provide > (above) using defmacro; I doubt it will be simpler or easier > or more robust, or anything. Do you consider backquote a pattern matching facility? ;; Common lisp version of named-let (defmacro named-let (name bindings &body body) `(LABELS ((,name ,(map 'list #'car bindings) ,@body)) (,name ,@(map 'list #'cadr bindings)))) -- ~jrm From robby at eecs.northwestern.edu Wed Jul 8 11:29:15 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Jul 8 11:29:36 2009 Subject: [plt-scheme] Control+Backspace as backward-kill-word? In-Reply-To: <9bd8a08a0907080147t7a4080f5mb687b78f02c97535@mail.gmail.com> References: <9bd8a08a0907080147t7a4080f5mb687b78f02c97535@mail.gmail.com> Message-ID: <932b2f1f0907080829t2ef010c5j12851ac9cae7d758@mail.gmail.com> The second one below maps control+delete successfully for me. I think something might be wrong with the keymap% class and its handling of "backspace", since this doesn't work either (run the code and hit control-backspace or just backspace; expect to see "ff" appear, but backspacing happens; you do get two "f"s when you type "f", however). (define f (new frame% [label ""] [width 100] [height 100])) (define k (new keymap%)) (define t (new text%)) (define ec (new editor-canvas% [parent f] [editor t])) (send t set-keymap k) (send k add-function "two-fs" (? (x y) (send x insert "ff"))) (send k map-function "c:backspace" "two-fs") (send k map-function "backspace" "two-fs") (send k map-function "f" "two-fs") (send ec focus) (send f show #t) The following code does print out #\backspace, so perhaps something is going wrong in the keymap code. (define f (new frame% [label ""] [width 100] [height 100])) (define c (new (class canvas% (define/override (on-char evt) (printf "~s\n" (send evt get-key-code)) (super on-char evt)) (super-new [parent f])))) (send c focus) (send f show #t) Robby 2009/7/8 Elena Garrulo : > Hello, > > I'd like to have Control+Backspace remapped as backward-kill-word. Following > advice found over the net, I've tried both these snippets of code, which not > work: > > #lang s-exp framework/keybinding-lang > (keybinding "c:del" (? (editor evt) (send editor backward-kill-word))) > > #lang s-exp framework/keybinding-lang > (keybinding "c:del" (lambda (editor event) > ??????????????????? (send > ??????????????????????? (send editor get-keymap) > ??????????????????????? call-function > ??????????????????????? "backward-kill-word" > ??????????????????????? editor event #t))) > > Any help? Thanks. > > > > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From grodenhiser at holycross.edu Tue Jul 7 12:30:19 2009 From: grodenhiser at holycross.edu (Greg Rodenhiser) Date: Wed Jul 8 12:36:06 2009 Subject: [plt-scheme] missing fonts Message-ID: <4A533FDB02000011004F5EC1@dudley.holycross.edu> Hi, we're attempting to run an old version of DrScheme (v103p1) on Redhat Enterprise 3AS (we need this older version for certain labs). However our desktops on the labs are Redhat Enterprise 5. In attempting to X11 forward via SSH, I notice one big problem, all the fonts for DrScheme are missing. The application launches fine, but is unusable. Fonts for all the menus, dialog boxes, etc are all missing, they show up blank. Does anyone know what XFree86 fonts DrScheme uses, and perhaps their equivalent on Redhat Enterprise 5 (Xorg)? Thanks!! ----- Greg Rodenhiser Technical Services Engineer College of the Holy Cross -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090707/c370e75c/attachment.htm From jvjulien at free.fr Wed Jul 8 06:01:44 2009 From: jvjulien at free.fr (jeeve) Date: Wed Jul 8 12:36:12 2009 Subject: [plt-scheme] PLT Scheme - Datalog Message-ID: <16e12903-e3a2-4043-97b5-34e5be36d0f2@g31g2000yqc.googlegroups.com> hello, I would like use "NOT" predicate as woman(F) :- father(_,F), not(man(F)), not(husband(_,F))" but the Datalog language in package "jaymccarthy/datalog.plt 1.2" don't recognize this expression Thanks for your help From grodenhiser at holycross.edu Wed Jul 8 09:13:30 2009 From: grodenhiser at holycross.edu (Greg Rodenhiser) Date: Wed Jul 8 12:36:20 2009 Subject: [plt-scheme] using DrScheme and Xnest Message-ID: <4A54633A02000011004F602A@dudley.holycross.edu> Hi, I'm trying to run DrScheme v103p1 on Redhat Enterprise 3, but have its display redirected to a Redhat Enterprise 5 desktop. For the life of me, I cannot get this to work: 1.) If I simply SSH X11 tunnel the application comes up in RHEL5, but none of the fonts do, the menus, dialog boxes, etc are all blank. 2.) If I attempt to use Xnest, I can get the desktop to come up in RHEL 5, but launching DrScheme gives the following errors: X Error of failed request: BadAlloc (insufficient resources for operation) Major opcode of failed request: 45 (X_OpenFont) Serial number of failed request: 152 Current serial number in output stream: 153 Does anyone know why DrScheme only seems to run if its being displayed on the local desktop, and why conventional methods of redirecting display don't seem possible?? Please help, really stuck!!! ----- Greg Rodenhiser Technical Services Engineer College of the Holy Cross -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090708/0efb12e7/attachment.html From sk at cs.brown.edu Wed Jul 8 12:39:37 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Wed Jul 8 12:46:02 2009 Subject: [plt-scheme] PLT Scheme - Datalog In-Reply-To: <16e12903-e3a2-4043-97b5-34e5be36d0f2@g31g2000yqc.googlegroups.com> References: <16e12903-e3a2-4043-97b5-34e5be36d0f2@g31g2000yqc.googlegroups.com> Message-ID: The underlying Datalog engine does not support stratification, so Jay's interface to it presumably does not either. On Wed, Jul 8, 2009 at 6:01 AM, jeeve wrote: > hello, > > I would like use "NOT" predicate as > > woman(F) :- father(_,F), not(man(F)), not(husband(_,F))" > > but the Datalog language in package "jaymccarthy/datalog.plt 1.2" > don't recognize this expression > > Thanks for your help > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From sk at cs.brown.edu Wed Jul 8 12:41:30 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Wed Jul 8 12:47:39 2009 Subject: [plt-scheme] using DrScheme and Xnest In-Reply-To: <4A54633A02000011004F602A@dudley.holycross.edu> References: <4A54633A02000011004F602A@dudley.holycross.edu> Message-ID: May I ask why you're running v103? I assume you know it's over five years old, maybe coming up on ten? On Wed, Jul 8, 2009 at 9:13 AM, Greg Rodenhiser wrote: > Hi, I'm trying to run DrScheme v103p1 on Redhat Enterprise 3, but have its > display redirected to a Redhat Enterprise 5 desktop. ?For the life of me, I > cannot get this to work: > > 1.) If I simply SSH X11 tunnel the application comes up in RHEL5, but none > of the fonts do, the menus, dialog boxes, etc are all blank. > > 2.) If I attempt to use Xnest, I can get the desktop to come up in RHEL 5, > but launching DrScheme gives the following errors: > > X Error of failed request: BadAlloc (insufficient resources for operation) > > Major opcode of failed request: 45 (X_OpenFont) > > Serial number of failed request: 152 > > Current serial number in output stream: 153 > > Does anyone know why DrScheme only seems to run if its being displayed on > the local desktop, and why conventional methods of redirecting display don't > seem possible?? ?Please help, really stuck!!! > > ----- > Greg?Rodenhiser > Technical?Services?Engineer > College?of?the?Holy?Cross > > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From jay.mccarthy at gmail.com Wed Jul 8 12:48:37 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Wed Jul 8 12:56:42 2009 Subject: [plt-scheme] PLT Scheme - Datalog In-Reply-To: <16e12903-e3a2-4043-97b5-34e5be36d0f2@g31g2000yqc.googlegroups.com> References: <16e12903-e3a2-4043-97b5-34e5be36d0f2@g31g2000yqc.googlegroups.com> Message-ID: Hello, As Shriram mentions, I only support Pure Datalog. For more information, see What You Always Wanted to Know About Datalog (And Never Dared to Ask) by Stefano Ceri, Georg Gottlob, and Letizia Tanca Jay On Wed, Jul 8, 2009 at 4:01 AM, jeeve wrote: > hello, > > I would like use "NOT" predicate as > > woman(F) :- father(_,F), not(man(F)), not(husband(_,F))" > > but the Datalog language in package "jaymccarthy/datalog.plt 1.2" > don't recognize this expression > > Thanks for your help > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From pocmatos at gmail.com Wed Jul 8 13:05:47 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Wed Jul 8 13:06:18 2009 Subject: [plt-scheme] missing fonts In-Reply-To: <4A533FDB02000011004F5EC1@dudley.holycross.edu> References: <4A533FDB02000011004F5EC1@dudley.holycross.edu> Message-ID: <1247072747.15654.8.camel@drserver> On Tue, 2009-07-07 at 12:30 -0400, Greg Rodenhiser wrote: > Hi, we're attempting to run an old version of DrScheme (v103p1) on > Redhat Enterprise 3AS (we need this older version for certain labs). > However our desktops on the labs are Redhat Enterprise 5. In > attempting to X11 forward via SSH, I notice one big problem, all the > fonts for DrScheme are missing. The application launches fine, but is > unusable. Fonts for all the menus, dialog boxes, etc are all missing, > they show up blank. > Running that version of PLT-Scheme in 2009 is, i am sorry to say, insane! That was probably the version I used to learn PLT-Scheme for the first time back in 1999. Do everything you can to get at least a 4.0 version [even if you need to install a new OS]. :) > > Does anyone know what XFree86 fonts DrScheme uses, and perhaps their > equivalent on Redhat Enterprise 5 (Xorg)? Thanks!! > > > > ----- > Greg Rodenhiser > Technical Services Engineer > College of the Holy Cross > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mflatt at cs.utah.edu Wed Jul 8 13:51:43 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Wed Jul 8 13:52:08 2009 Subject: [plt-scheme] missing fonts In-Reply-To: <4A533FDB02000011004F5EC1@dudley.holycross.edu> References: <4A533FDB02000011004F5EC1@dudley.holycross.edu> Message-ID: <20090708175146.A6B356500D9@mail-svr1.cs.utah.edu> At Tue, 07 Jul 2009 12:30:19 -0400, "Greg Rodenhiser" wrote: > > Hi, we're attempting to run an old version of DrScheme (v103p1) on Redhat > Enterprise 3AS (we need this older version for certain labs). However our > desktops on the labs are Redhat Enterprise 5. In attempting to X11 forward via > SSH, I notice one big problem, all the fonts for DrScheme are missing. The > application launches fine, but is unusable. Fonts for all the menus, dialog > boxes, etc are all missing, they show up blank. > > Does anyone know what XFree86 fonts DrScheme uses, and perhaps their equivalent > on Redhat Enterprise 5 (Xorg)? Thanks!! I think it uses -*-lucida-*-*-normal-*-*-*-*-*-*-*-*-* -*-times-*-*-normal-*-*-*-*-*-*-*-*-* -*-helvetica-*-*-normal-*-*-*-*-*-*-*-*-* -*-courier-*-*-normal-*-*-*-*-*-*-*-*-* Note that those are xfs fonts (not Fontconfig). I don't know what the RHE5 equivalents would be. Do modern Linux distributions even include xfs fonts? The RHE4 release notes suggest that xfs fonts might go away in later releases, but I didn't find anything in the RHE5 notes saying that it did. From masm at acm.org Wed Jul 8 16:39:46 2009 From: masm at acm.org (Marco Monteiro) Date: Wed Jul 8 16:40:06 2009 Subject: [plt-scheme] ajax and plt In-Reply-To: References: <779bf2730907011423g60a652c5p85c2215e54cb9842@mail.gmail.com> Message-ID: <252c42fe0907081339m7a9626c8r6c84863ece2d3375@mail.gmail.com> On Thu, Jul 2, 2009 at 3:18 AM, Shriram Krishnamurthi wrote: > We have a full, working compiler from Scheme to JavaScript for > Beginner and Intermediate Scheme plus the World framework for > interaction. The compiler is self-hosting. We are working on > plugging the generated code into other contexts such as mashups. > > While the compiler is available, we aren't interested in supporting it > right now, as we're integrating it into a much larger framework. We > are targeting a preliminary release of the whole framework by the end > of this summer, if not sooner. > > I'm happy to try to answer questions. > I have a Scheme to Javascript compiler implemented in Common Lisp. It implements most things in R5RS. Missing are the number tower and macros. Also, there is no proper module system. I want to port the compiler to PLT-Scheme. My idea is to somehow reuser the module and macro system of PLT. I'm just starting with PLT, so I need advice about the best way to do this. What I was thinking about was that I could write a module using #lang sines, for example. The forms in this module would be expanded to the core syntactic forms in PLT-Scheme (the ones in chapter two of the reference manual) by PLT-Scheme. Then the compiler takes these and generates Javascript (maybe using javascript.plt) and serve it with the web server or maybe put it in a file. Even better: a compiler already exists and I don't have to port mine. In IRC, Eli Barzilay pointed me to the mailing list telling me that a Scheme to Javascript compiler, implemented in PLT-Scheme, might already exists. I'm guessing he was referring to this message. Anyhow, is there something already usable? If not, I need advice, as a PLT-Scheme newbie, on the best way to reuse PLT-Scheme to implement (port) my compiler. Thank, Marco -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090708/1cb42092/attachment.htm From mflatt at cs.utah.edu Wed Jul 8 17:20:12 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Wed Jul 8 17:21:37 2009 Subject: [plt-scheme] Control+Backspace as backward-kill-word? In-Reply-To: <932b2f1f0907080829t2ef010c5j12851ac9cae7d758@mail.gmail.com> References: <9bd8a08a0907080147t7a4080f5mb687b78f02c97535@mail.gmail.com> <932b2f1f0907080829t2ef010c5j12851ac9cae7d758@mail.gmail.com> Message-ID: <20090708212045.1D99B6500EA@mail-svr1.cs.utah.edu> Both "delete and "backspace" were broken in 4.2. I had already fixed "delete", but for some reason didn't notice that "backspace" was also broken. Both are now fixed in SVN. At Wed, 8 Jul 2009 10:29:15 -0500, Robby Findler wrote: > The second one below maps control+delete successfully for me. I think > something might be wrong with the keymap% class and its handling of > "backspace", since this doesn't work either (run the code and hit > control-backspace or just backspace; expect to see "ff" appear, but > backspacing happens; you do get two "f"s when you type "f", however). > > (define f (new frame% [label ""] [width 100] [height 100])) > (define k (new keymap%)) > (define t (new text%)) > (define ec (new editor-canvas% [parent f] [editor t])) > (send t set-keymap k) > (send k add-function "two-fs" (? (x y) (send x insert "ff"))) > (send k map-function "c:backspace" "two-fs") > (send k map-function "backspace" "two-fs") > (send k map-function "f" "two-fs") > (send ec focus) > (send f show #t) > > The following code does print out #\backspace, so perhaps something is > going wrong in the keymap code. > > (define f (new frame% [label ""] [width 100] [height 100])) > (define c > (new (class canvas% > (define/override (on-char evt) > (printf "~s\n" (send evt get-key-code)) > (super on-char evt)) > (super-new [parent f])))) > (send c focus) > (send f show #t) > > Robby > > 2009/7/8 Elena Garrulo : > > Hello, > > > > I'd like to have Control+Backspace remapped as backward-kill-word. Following > > advice found over the net, I've tried both these snippets of code, which not > > work: > > > > #lang s-exp framework/keybinding-lang > > (keybinding "c:del" (? (editor evt) (send editor backward-kill-word))) > > > > #lang s-exp framework/keybinding-lang > > (keybinding "c:del" (lambda (editor event) > > ??????????????????? (send > > ??????????????????????? (send editor get-keymap) > > ??????????????????????? call-function > > ??????????????????????? "backward-kill-word" > > ??????????????????????? editor event #t))) > > > > Any help? Thanks. > > > > > > > > > > _________________________________________________ > > ?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 aghuloum at gmail.com Wed Jul 8 20:41:01 2009 From: aghuloum at gmail.com (Abdulaziz Ghuloum) Date: Wed Jul 8 20:42:10 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> Message-ID: <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> On Jul 8, 2009, at 6:04 PM, Joe Marshall wrote: > On Wed, Jul 8, 2009 at 7:31 AM, Abdulaziz > Ghuloum wrote: >> I don't agree. Show me a painful simple use. Pick any simple >> macro you want: let, let*, or, and, cond, case, or any other >> macro of your choice to show the pain. > > This came up the other day. Transform something like this: > > (define-event foo bar (arg1 arg2 ...) > (form1) > (form2 ...) etc.) > > into something like this: > > (define (foo$bar arg1 arg2 ...) > (form1) > (form2 ...) etc.) I don't see the pain caused by "syntax-case", and maybe I don't understand the problem you're having. Can you please write your macro in syntax-case because my attempt below probably does not do what you had in mind. (define-syntax define-event (lambda (stx) (define (concat x y) --- fill in the blank ---) (syntax-case stx () [(_ foo bar (arg1 arg2 ...) (form1) (form2 ...) etc.) #`(define (#,(concat #'foo #'bar) arg1 arg2 ...) (form1) (form2 ...) etc.)]))) >>> defmacro is really easy to use and understand, but isn't hygienic. >> >> I don't agree that defmacro is easy to use without a pattern >> matching facility. Again, write the example that you provide >> (above) using defmacro; I doubt it will be simpler or easier >> or more robust, or anything. > > Do you consider backquote a pattern matching facility? Not really. > ;; Common lisp version of named-let > (defmacro named-let (name bindings &body body) > `(LABELS ((,name ,(map 'list #'car bindings) ,@body)) > (,name ,@(map 'list #'cadr bindings)))) This code has a bug that's not related to hygiene but to the scope of the "name" identifier. But either way, I don't see that as simpler or easier to use than, say, the following (exhibiting the same bug): (define-syntax-rule (named-let name ((lhs* rhs*) ...) b b* ...) (letrec ((name (lambda (lhs* ...) b b* ...))) (name rhs* ...))) It looks like named-let is a trivial macro that can be handled trivially in any macro system, so, it does not really show that "defmacro is really easy to use and understand". As the complexity of the macro increases, doesn't it just cause more littering with all of these map this and map that and splice this and that? Aziz,,, PS. I'm just trying to understand your position, since I was pretty surprised that *you* find defmacro style superior to anything else in scheme (modulo hygiene as you said). I mean, you know macros, and none of this is new to you, but do you really find manipulating S-expressions that much easier and simpler than manipulating syntax objects? Or is it something else? From dherman at ccs.neu.edu Thu Jul 9 01:09:50 2009 From: dherman at ccs.neu.edu (Dave Herman) Date: Thu Jul 9 01:10:23 2009 Subject: [plt-scheme] Call for Participation: Symposium in Honor of Mitchell Wand Message-ID: Symposium in Honor of Mitchell Wand In Cooperation with ACM SIGPLAN Coordinated with Scheme Workshop 2009 August 23-24, 2009 Boston, Massachusetts, USA http://www.ccs.neu.edu/events/wand-symposium CALL FOR PARTICIPATION IMPORTANT DATES August 1, 2009 - Registration deadline August 22, 2009 - Scheme Workshop: http://www.schemeworkshop.org/2009 August 23-24, 2009 - Symposium in Honor of Mitchell Wand VENUE Northeastern University 346 Huntington Ave Boston, MA 02115 USA ACCOMMODATION A limited block of hotel rooms will be reserved for participants of the Symposium and/or the Scheme Workshop at hotels in Boston and Cambridge. More information will be available soon; please check back on the event web site. REGISTRATION Registration is free. Please register by *August 1, 2009* so that we will have an accurate head count. To register, please send an email to mitchfest-registration@ccs.neu.edu with your name and any dietary restrictions for lunch. SCOPE Northeastern University is hosting a special Symposium in celebration of Dr. Mitchell Wand's 60th birthday and honoring his pioneering work in the field of programming languages. For over 30 years Mitch has made important contributions to many areas of programming languages, including semantics, continuations, type theory, hygienic macros, compiler correctness, static analysis and formal verification. Please join us at Northeastern on August 23rd and 24th as we celebrate this personal milestone and pay tribute to a great computer scientist, researcher, teacher and colleague, Dr. Mitchell (Mitch) Wand. STEERING COMMITTEE * Olivier Danvy (University of Aarhus) * David Herman (Northeastern University) * Dino Oliva (Bloomberg L.P.) * Olin Shivers (Northeastern University) PRELIMINARY PROGRAM Functional un|unparsing Kenichi Asai and Oleg Kiselyov and Chung-chieh Shan A mechanized bisimulation for the nu-calculus Nick Benton and Vasileios Koutavas A shallow Scheme embedding of bottom-avoiding streams William E. Byrd and Daniel P. Friedman and Ramana Kumar and Joseph P. Near A model of functional traversal-based generic programming Bryan Chadwick and Karl Lieberherr The MacScheme compiler: using denotational semantics to prove correctness William D. Clinger Eliminating the middle man: Learning garbage collection without interpreters Gregory H. Cooper and Arjun Guha and Shriram Krishnamurthi Specializing continuations Christopher Dutchyn A Scheme for native threads R. Kent Dybvig Trampolining architectures Steven E. Ganz and Daniel P. Friedman Finding everything that can happen: Solving authentication tests by computer Joshua D. Guttman and John D. Ramsdell A theory of typed hygienic macros David Herman The MzScheme machine and bytecode verifier Casey L. Klein and Matthew Flatt and Robert Bruce Findler Featherweight X10: A core calculus for async-finish parallelism Jonathan K. Lee and Jens Palsberg Subcubic control-flow analysis algorithms Jan Midtgaard and David Van Horn A simplified multi-tier semantics for Hop Manuel Serrano and Christian Queinnec DDP for CFA Olin Shivers and Dimitrios Vardoulakis and Alexander Spoon The design and implementation of Typed Scheme Sam Tobin-Hochstadt and Matthias Felleisen From jos.koot at telefonica.net Thu Jul 9 10:00:23 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Jul 9 10:00:59 2009 Subject: [plt-scheme] Fw: lambda calculus through redex Message-ID: New version of "Lambda Calculus through Redex" now available at: http://www.telefonica.net/web2/koot/lc-with-redex.zip or http://www.telefonica.net/web2/koot/ - Some typos corrected. - Minor mods in sources. - Acknowledgements added. With thanks to Eli Barzilay for again converting doc->pdf. Jos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090709/c01986ac/attachment-0001.html From jmarshall at alum.mit.edu Thu Jul 9 13:24:08 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Thu Jul 9 13:24:46 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> Message-ID: On Wed, Jul 8, 2009 at 5:41 PM, Abdulaziz Ghuloum wrote: > > On Jul 8, 2009, at 6:04 PM, Joe Marshall wrote: > >> On Wed, Jul 8, 2009 at 7:31 AM, Abdulaziz Ghuloum >> wrote: >>> >>> I don't agree. ?Show me a painful simple use. ?Pick any simple >>> macro you want: let, let*, or, and, cond, case, or any other >>> macro of your choice to show the pain. >> >> This came up the other day. ?Transform something like this: >> >> (define-event foo bar (arg1 arg2 ...) >> ? (form1) >> ? (form2 ...) etc.) >> >> into something like this: >> >> (define (foo$bar arg1 arg2 ...) >> ? (form1) >> ? (form2 ...) etc.) > > I don't see the pain caused by "syntax-case", and maybe I don't > understand the problem you're having. ?Can you please write your > macro in syntax-case because my attempt below probably does not > do what you had in mind. > > (define-syntax define-event > ?(lambda (stx) > ? ?(define (concat x y) --- fill in the blank ---) > ? ?(syntax-case stx () > ? ? ?[(_ foo bar (arg1 arg2 ...) > ? ? ? ? ?(form1) > ? ? ? ? ?(form2 ...) etc.) > ? ? ? #`(define (#,(concat #'foo #'bar) arg1 arg2 ...) > ? ? ? ? ? (form1) > ? ? ? ? ? (form2 ...) etc.)]))) (define-syntax define-event (lambda (stx) (define (concat . x) (string->symbol (apply string-append (map symbol->string x)))) (syntax-case stx () [(_ foo bar arguments form1 . body) #`(define (#,(concat #'foo '$ #'bar) . arguments) form1 . body)]))) (define-event foo bar (x y) (list x y)) collects\scheme\private\map.ss:22:17: symbol->string: expects argument of type ; given # This is what usually happens when I try to use syntax-case. I end up getting syntax objects where I want symbols, or symbols where I want syntax objects, or syntax object closed in the wrong scope. Then I end up trying permutations of sharps, backticks, commas, and quotes until it eventually works. Yes, it is laziness on my part. I ought to re-read the documentation, and if I had practice at it, I'd be ok, but I don't write all that many macros, so when I do, I inevitably have to re-learn it. > > >>>> defmacro is really easy to use and understand, but isn't hygienic. >>> >>> I don't agree that defmacro is easy to use without a pattern >>> matching facility. ?Again, write the example that you provide >>> (above) using defmacro; I doubt it will be simpler or easier >>> or more robust, or anything. >> >> Do you consider backquote a pattern matching facility? > > Not really. > >> ;; Common lisp version of named-let >> (defmacro named-let (name bindings &body body) >> ?`(LABELS ((,name ,(map 'list #'car bindings) ,@body)) >> ? ? (,name ,@(map 'list #'cadr bindings)))) > > This code has a bug that's not related to hygiene but to the scope > of the "name" identifier. Yeah. it should be more like this: (defmacro named-let (name bindings &body body) `(funcall (LABELS ((,name ,(map list #'car bindings) ,@body)) (function name)) ,@(map 'list #'cadr bindings))) But the compiler generates much worse code for this. The scoping issue is a minor issue. > ?But either way, I don't see that as simpler > or easier to use than, say, the following (exhibiting the same bug): > > (define-syntax-rule > ?(named-let name ((lhs* rhs*) ...) b b* ...) > ?(letrec ((name (lambda (lhs* ...) b b* ...))) > ? ?(name rhs* ...))) > > It looks like named-let is a trivial macro that can be handled > trivially in any macro system, so, it does not really show that > "defmacro is really easy to use and understand". ?As the complexity > of the macro increases, doesn't it just cause more littering with > all of these map this and map that and splice this and that? Yes, but I don't think it is any more complex than the ellipses. > PS. I'm just trying to understand your position, since I was pretty > surprised that *you* find defmacro style superior to anything else > in scheme (modulo hygiene as you said). I didn't say that. I said it was easier to understand what the defmacro form is doing to the code. The transformation from list-structure to different list-structure is pretty straightforward. Syntax objects are more opaque: # What is that? An identifier? Which one? (A quote from the King James Bible, book of Syntax, Chapter 3, verse 16?) I can't `mapcar' over a syntax object. And when I go in the other direction, I have the symbol `foo' and I wish to create some code that uses it, I have to transform it into a syntax object with the appropriate scope. > ?I mean, you know macros, > and none of this is new to you, but do you really find manipulating > S-expressions that much easier and simpler than manipulating syntax > objects? ?Or is it something else? I do find list structure easier to manipulate that syntax objects. Syntax objects *include* everything that is in the list structure, and then add some more stuff. Furthermore, syntax objects don't have the incredibly rich library of list manipulation functions. That said, I don't *prefer* defmacro style macros. They are buggy, and while it is obvious to see *what* they do to the code, it isn't obvious how to make them work correctly. On the other hand, I don't much like syntax-case. It is much more complicated to use, and I see it used too often. I want something else. I'm not sure what, though. -- ~jrm From eli at barzilay.org Thu Jul 9 13:47:17 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Jul 9 13:47:40 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> Message-ID: <19030.11557.74143.890264@winooski.ccs.neu.edu> On Jul 9, Joe Marshall wrote: > On Wed, Jul 8, 2009 at 5:41 PM, Abdulaziz Ghuloum wrote: > > > > On Jul 8, 2009, at 6:04 PM, Joe Marshall wrote: > > > >> On Wed, Jul 8, 2009 at 7:31 AM, Abdulaziz Ghuloum > >> wrote: > >>> > >>> I don't agree. ?Show me a painful simple use. ?Pick any simple > >>> macro you want: let, let*, or, and, cond, case, or any other > >>> macro of your choice to show the pain. > >> > >> This came up the other day. ?Transform something like this: > >> > >> (define-event foo bar (arg1 arg2 ...) > >> ? (form1) > >> ? (form2 ...) etc.) > >> > >> into something like this: > >> > >> (define (foo$bar arg1 arg2 ...) > >> ? (form1) > >> ? (form2 ...) etc.) > > > > I don't see the pain caused by "syntax-case", and maybe I don't > > understand the problem you're having. ?Can you please write your > > macro in syntax-case because my attempt below probably does not > > do what you had in mind. > > > > (define-syntax define-event > > ?(lambda (stx) > > ? ?(define (concat x y) --- fill in the blank ---) > > ? ?(syntax-case stx () > > ? ? ?[(_ foo bar (arg1 arg2 ...) > > ? ? ? ? ?(form1) > > ? ? ? ? ?(form2 ...) etc.) > > ? ? ? #`(define (#,(concat #'foo #'bar) arg1 arg2 ...) > > ? ? ? ? ? (form1) > > ? ? ? ? ? (form2 ...) etc.)]))) > > (define-syntax define-event > (lambda (stx) > (define (concat . x) > (string->symbol (apply string-append (map symbol->string x)))) > (syntax-case stx () > [(_ foo bar arguments form1 . body) > #`(define (#,(concat #'foo '$ #'bar) . arguments) > form1 . body)]))) > > (define-event foo bar (x y) (list x y)) > collects\scheme\private\map.ss:22:17: symbol->string: expects argument > of type ; given # > > This is what usually happens when I try to use syntax-case. How is that different than any other type error, say (concat 1 2)? The bottom line is that a hygienic system needs to store more information, so you need to put it somewhere. > > PS. I'm just trying to understand your position, since I was > > pretty surprised that *you* find defmacro style superior to > > anything else in scheme (modulo hygiene as you said). > > I didn't say that. I said it was easier to understand what the > defmacro form is doing to the code. The transformation from > list-structure to different list-structure is pretty > straightforward. Syntax objects are more opaque: # > > What is that? [...] A deficiency of the standard printer. > I can't `mapcar' over a syntax object. Sure you can, use `syntax->list' with `map'. > And when I go in the other direction, I have the symbol `foo' and I > wish to create some code that uses it, I have to transform it into a > syntax object with the appropriate scope. (Same as above -- you need to add the extra information.) > On the other hand, I don't much like syntax-case. It is much more > complicated to use, and I see it used too often. > > I want something else. I'm not sure what, though. This is the same thing that drives me crazy over and over. There's hardly any magic in `syntax-case' -- and in fact, you could just as well write macros in a `syntax-case'-based systems without ever using it. For example: http://blog.plt-scheme.org/2009/05/explicit-renaming-macros-implicitly.html -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From clements at brinckerhoff.org Thu Jul 9 14:06:26 2009 From: clements at brinckerhoff.org (John Clements) Date: Thu Jul 9 14:06:46 2009 Subject: [plt-scheme] printing exact rationals In-Reply-To: <932b2f1f0907040532p76344d6cn7409117dde514d59@mail.gmail.com> References: <932b2f1f0907040532p76344d6cn7409117dde514d59@mail.gmail.com> Message-ID: <92C45F56-E888-4243-8D50-AD54F1C9D498@brinckerhoff.org> On Jul 4, 2009, at 5:32 AM, Robby Findler wrote: > If you right-click on the number and choose a different format, that > choice will be remembered for future printing. Along these lines, Ian pointed out to me this week that for the printout of rationals in decimal format, you can click on the "..." to get another chunk of digits. This is incredibly nifty, but I would never have figured it out by myself. John -------------- 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/20090709/49d60510/smime.bin From dvanhorn at ccs.neu.edu Thu Jul 9 14:36:11 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Thu Jul 9 14:36:44 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> Message-ID: <4A56389B.5070704@ccs.neu.edu> Joe Marshall wrote: > On Wed, Jul 8, 2009 at 5:41 PM, Abdulaziz Ghuloum wrote: >> On Jul 8, 2009, at 6:04 PM, Joe Marshall wrote: >> >>> On Wed, Jul 8, 2009 at 7:31 AM, Abdulaziz Ghuloum >>> wrote: >>>> I don't agree. Show me a painful simple use. Pick any simple >>>> macro you want: let, let*, or, and, cond, case, or any other >>>> macro of your choice to show the pain. >>> This came up the other day. Transform something like this: >>> >>> (define-event foo bar (arg1 arg2 ...) >>> (form1) >>> (form2 ...) etc.) >>> >>> into something like this: >>> >>> (define (foo$bar arg1 arg2 ...) >>> (form1) >>> (form2 ...) etc.) >> I don't see the pain caused by "syntax-case", and maybe I don't >> understand the problem you're having. Can you please write your >> macro in syntax-case because my attempt below probably does not >> do what you had in mind. >> >> (define-syntax define-event >> (lambda (stx) >> (define (concat x y) --- fill in the blank ---) >> (syntax-case stx () >> [(_ foo bar (arg1 arg2 ...) >> (form1) >> (form2 ...) etc.) >> #`(define (#,(concat #'foo #'bar) arg1 arg2 ...) >> (form1) >> (form2 ...) etc.)]))) > > (define-syntax define-event > (lambda (stx) > (define (concat . x) > (string->symbol (apply string-append (map symbol->string x)))) > (syntax-case stx () > [(_ foo bar arguments form1 . body) > #`(define (#,(concat #'foo '$ #'bar) . arguments) > form1 . body)]))) > > (define-event foo bar (x y) (list x y)) > collects\scheme\private\map.ss:22:17: symbol->string: expects argument > of type ; given # > > This is what usually happens when I try to use syntax-case. I end up getting > syntax objects where I want symbols, or symbols where I want syntax objects, > or syntax object closed in the wrong scope. Then I end up trying permutations > of sharps, backticks, commas, and quotes until it eventually works. ... > I want something else. I'm not sure what, though. Perhaps it is this? * Wrapped = Unwrapped (r6rs optional): A wrapped syntax object is the same as an unwrapped syntax object, and can be directly manipulated using car, cdr, ... without syntax-case deconstruction. http://www.het.brown.edu/people/andre/macros/ David From jmarshall at alum.mit.edu Thu Jul 9 14:51:56 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Thu Jul 9 14:52:38 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: <19030.11557.74143.890264@winooski.ccs.neu.edu> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> <19030.11557.74143.890264@winooski.ccs.neu.edu> Message-ID: I'm having difficulty expressing what I mean. On Thu, Jul 9, 2009 at 10:47 AM, Eli Barzilay wrote: > > The bottom line is that a hygienic system needs to store more > information, so you need to put it somewhere. I understand. It is this extra information that makes things harder to deal with. It isn't *much* harder, but it is harder. >> I can't `mapcar' over a syntax object. > > Sure you can, use `syntax->list' with `map'. That's not exactly the same. Sure, I can call syntax->list and then call list->syntax afterwards (I assume), but I can't just call mapcar. >> And when I go in the other direction, I have the symbol `foo' and I >> wish to create some code that uses it, I have to transform it into a >> syntax object with the appropriate scope. > > (Same as above -- you need to add the extra information.) But why? Surely there is a reasonable default. >> On the other hand, I don't much like syntax-case. ?It is much more >> complicated to use, and I see it used too often. >> >> I want something else. ?I'm not sure what, though. > > This is the same thing that drives me crazy over and over. ?There's > hardly any magic in `syntax-case' -- and in fact, you could just as > well write macros in a `syntax-case'-based systems without ever using > it. ?For example: > ?http://blog.plt-scheme.org/2009/05/explicit-renaming-macros-implicitly.html This entry makes my point exactly. syntax-case is just too low-level. Sure, defmacro is even *lower* level, but that makes it easier to understand. Suppose I want a macro that examines one of its arguments to see if it is a lambda expression. The ideal thing, of course, is a function that does just that: (define-syntax foo (lambda (stx) (if (lambda-expression? (first-argument stx)) ....))) At least defmacro allows this: (defmacro foo (arg0 &rest args) (if (eq? (car arg0) 'lambda) ;; crude, but effective Again, I'm not saying that I think defmacro is *better*. -- ~jrm From robby at eecs.northwestern.edu Thu Jul 9 14:57:15 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Jul 9 14:57:34 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> <19030.11557.74143.890264@winooski.ccs.neu.edu> Message-ID: <932b2f1f0907091157g35541c8dxab49742337c60d87@mail.gmail.com> >>> And when I go in the other direction, I have the symbol `foo' and I >>> wish to create some code that uses it, I have to transform it into a >>> syntax object with the appropriate scope. >> >> (Same as above -- you need to add the extra information.) > > But why? Surely there is a reasonable default. > I think that there isn't any reasonable default. If you are turning a raw sexpression (ie, a bit of program text without any lexical information) into a syntax object, you need to say what scope it comes from explicitly. Robby From jmarshall at alum.mit.edu Thu Jul 9 15:00:39 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Thu Jul 9 15:01:22 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: <4A56389B.5070704@ccs.neu.edu> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> <4A56389B.5070704@ccs.neu.edu> Message-ID: On Thu, Jul 9, 2009 at 11:36 AM, David Van Horn wrote: > > Perhaps it is this? > > ? * Wrapped = Unwrapped (r6rs optional): > > ? ? ? A wrapped syntax object is the same as an unwrapped syntax > ? ? ? object, and can be directly manipulated using car, cdr, ... > ? ? ? without syntax-case deconstruction. > > ? http://www.het.brown.edu/people/andre/macros/ Closer. What I really want is a set of primitives, means of combination, and means of abstraction that work well with code objects. There's only a few general things people do with macros, and they ought to be explicit and simple. I want sort of a general code rewriting facility that simply allows re-ordering of expressions and subexpressions without having to think about `syntax objects'. I also want the ability to inject symbols hygienically without having to think about it. I also want the ability to inject symbols *non-hygienically*. I don't mind marking those sorts of uses. And I want to do some minor code walking. That's it. The machinery of syntax-rules does great at rewriting, but is awful at code walking. It doesn't allow non-hygienic symbols. Syntax-case is awful at code-walking, bad at rewriting (too much unwrapping and rewrapping), and bad at symbol injection. But it allows you to break hygiene. Defmacro fails at hygiene, but is great for code walking and reordering. But I want something that does it all. -- ~jrm From jmarshall at alum.mit.edu Thu Jul 9 15:04:05 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Thu Jul 9 15:04:45 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: <932b2f1f0907091157g35541c8dxab49742337c60d87@mail.gmail.com> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> <19030.11557.74143.890264@winooski.ccs.neu.edu> <932b2f1f0907091157g35541c8dxab49742337c60d87@mail.gmail.com> Message-ID: On Thu, Jul 9, 2009 at 11:57 AM, Robby Findler wrote: >>>> And when I go in the other direction, I have the symbol `foo' and I >>>> wish to create some code that uses it, I have to transform it into a >>>> syntax object with the appropriate scope. >>> >>> (Same as above -- you need to add the extra information.) >> >> But why? ?Surely there is a reasonable default. >> > I think that there isn't any reasonable default. How about an unreasonable default, then? Always use the scope of the macro and never use the scope of the call-site unless explicitly overridden. Or if that's too cumbersome, then the other way. -- ~jrm From raould at gmail.com Thu Jul 9 15:05:45 2009 From: raould at gmail.com (Raoul Duke) Date: Thu Jul 9 15:06:04 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> <4A56389B.5070704@ccs.neu.edu> Message-ID: <91a2ba3e0907091205x5a5e2febqc3e92d0d343dab3d@mail.gmail.com> >> * Wrapped = Unwrapped (r6rs optional): > Closer. > But I want something that does it all. the issue of there being metadata making it hard to "just deal with lists" makes me wonder if doing things inside a monad would make it any better (ok, cue laugh track) so that in the monad one can "just deal with lists" mostly and then have a way to get the extra metadata if need be from the context. this would invert the usage somewhat (rather than having to "reach down into things" to get at the lists, one would be "reaching out" to get the metadata), perhaps making it nicer. /random-thought From samth at ccs.neu.edu Thu Jul 9 15:13:45 2009 From: samth at ccs.neu.edu (Sam TH) Date: Thu Jul 9 15:14:04 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> <19030.11557.74143.890264@winooski.ccs.neu.edu> <932b2f1f0907091157g35541c8dxab49742337c60d87@mail.gmail.com> Message-ID: <63bb19ae0907091213x47526ee0x2d9748c72b8a5063@mail.gmail.com> On Thu, Jul 9, 2009 at 3:04 PM, Joe Marshall wrote: > On Thu, Jul 9, 2009 at 11:57 AM, Robby > Findler wrote: >>>>> And when I go in the other direction, I have the symbol `foo' and I >>>>> wish to create some code that uses it, I have to transform it into a >>>>> syntax object with the appropriate scope. >>>> >>>> (Same as above -- you need to add the extra information.) >>> >>> But why? ?Surely there is a reasonable default. >>> >> I think that there isn't any reasonable default. > > How about an unreasonable default, then? ?Always use the > scope of the macro and never use the scope of the call-site > unless explicitly overridden. ?Or if that's too cumbersome, > then the other way. This is basically what already happens: (define-syntax (delay* stx) (syntax-case stx () [(_ arg) #`(lambda (#,'my-sym) arg)])) (define f (let ([my-sym 1]) (delay* my-sym))) (f #f) prints 1, since 'my-sym gets the empty syntactic context. -- sam th samth@ccs.neu.edu From samth at ccs.neu.edu Thu Jul 9 15:16:03 2009 From: samth at ccs.neu.edu (Sam TH) Date: Thu Jul 9 15:16:22 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> Message-ID: <63bb19ae0907091216h58133d32y75bb03ac13413f17@mail.gmail.com> On Wed, Jul 8, 2009 at 11:04 AM, Joe Marshall wrote: > >> I don't agree that defmacro is easy to use without a pattern >> matching facility. ?Again, write the example that you provide >> (above) using defmacro; I doubt it will be simpler or easier >> or more robust, or anything. > > Do you consider backquote a pattern matching facility? > > ;; Common lisp version of named-let > (defmacro named-let (name bindings &body body) > ?`(LABELS ((,name ,(map 'list #'car bindings) ,@body)) > ? ? (,name ,@(map 'list #'cadr bindings)))) > There's already a pattern matcher being used here - the argument list destructures and binds various arguments to the macro, which in something like `syntax-case' would be destructured with a pattern matcher. `defmacro' would look a lot less convenient without that. -- sam th samth@ccs.neu.edu From eli at barzilay.org Thu Jul 9 15:28:43 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Jul 9 15:29:07 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: <932b2f1f0907091157g35541c8dxab49742337c60d87@mail.gmail.com> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> <4A56389B.5070704@ccs.neu.edu> <19030.11557.74143.890264@winooski.ccs.neu.edu> <932b2f1f0907091157g35541c8dxab49742337c60d87@mail.gmail.com> Message-ID: <19030.17643.3017.441865@winooski.ccs.neu.edu> On Jul 9, Robby Findler wrote: > >>> And when I go in the other direction, I have the symbol `foo' and I > >>> wish to create some code that uses it, I have to transform it into a > >>> syntax object with the appropriate scope. > >> > >> (Same as above -- you need to add the extra information.) > > > > But why? Surely there is a reasonable default. > > > I think that there isn't any reasonable default. If you are turning > a raw sexpression (ie, a bit of program text without any lexical > information) into a syntax object, you need to say what scope it > comes from explicitly. I think that another way to put this is that the lack of a reasonable default is exactly why `defmacro' is inherently broken and why `syntax-rules' is inherently weak. Joe replies: > How about an unreasonable default, then? Always use the scope of > the macro and never use the scope of the call-site unless explicitly > overridden. Or if that's too cumbersome, then the other way. And these two -- IIUC -- are exactly the two extremes, which means that you still need some way to specify things between them. On Jul 9, Joe Marshall wrote: > On Thu, Jul 9, 2009 at 10:47 AM, Eli Barzilay wrote: > >> I can't `mapcar' over a syntax object. > > > > Sure you can, use `syntax->list' with `map'. > > That's not exactly the same. Sure, I can call syntax->list and then > call list->syntax afterwards (I assume), but I can't just call > mapcar. Sorry, I just don't see how that's different than using `map' over a string, for example... Maybe it's the fact that you choose to accept the extra complexity with strings because you see a point in having it be a different type, but for some reason you refuse to divorce syntax from lists in the same way? > > This is the same thing that drives me crazy over and > > over. ?There's hardly any magic in `syntax-case' -- and in fact, > > you could just as well write macros in a `syntax-case'-based > > systems without ever using it. ?For example: > > ?http://blog.plt-scheme.org/2009/05/explicit-renaming-macros-implicitly.html > > This entry makes my point exactly. syntax-case is just too > low-level. Sure, defmacro is even *lower* level, but that makes it > easier to understand. ?? `syntax-case' is just a tool to do pattern matching on syntax values, however they may be represented. It's high level enough to be convenient (for example, expressing the same kind of macros that you can with `syntax-rules' is trivial), yet you can still do things like: (define (stx-car stx) (syntax-case stx [(x . y) #'x])) without knowing about the internal representation. (BTW, in PLT this function is defined with (define (stx-car p) (if (pair? p) (car p) (car (syntax-e p)))) so the only thing you need to know about to use the representation is the `syntax-e' function -- the rest is mostly conveniences.) > Suppose I want a macro that examines one of its arguments to see if it > is a lambda expression. The ideal thing, of course, is a function that > does just that: > > (define-syntax foo > (lambda (stx) > (if (lambda-expression? (first-argument stx)) > ....))) You still get that: > (define-syntax (foo stx) (if (free-identifier=? #'lambda (stx-car (stx-cdr stx))) #'1 #'2)) > (foo +) 2 > (foo lambda) 1 except that `syntax-case' is much easier to deal with than `stx-c[ad]r', and it adds more stuff (like throwing a syntax error) if the input syntax doesn't have a `cadr': (define-syntax (foo stx) (syntax-case stx () [(_ id) (if (free-identifier=? #'lambda #'id) #'1 #'2)])) but as long as we're doing a single `if' expression, we can just as well use the fender-exprs of `syntax-case': (define-syntax (foo stx) (syntax-case stx () [(_ id) (free-identifier=? #'lambda #'id) #'1] [_ #'2])) but even better, that kind of facility is "built into" the `syntax-case' tool in the same way as `syntax-rules': (define-syntax (foo stx) (syntax-case stx (lambda) [(_ lambda) #'1] [_ #'2])) And yes, now it's easy to see that my example can be expressed with `syntax-rules' -- but I still get arbitrary expressions that I can write as the results. In other words, `syntax-case' is just a very convenient tool that did all of the good things that `syntax-rules' did, without sacrificing the ability to write arbitrary code. On Jul 9, Joe Marshall wrote: > On Thu, Jul 9, 2009 at 11:36 AM, David Van Horn wrote: > > > > Perhaps it is this? > > > > ? * Wrapped = Unwrapped (r6rs optional): > > > > ? ? ? A wrapped syntax object is the same as an unwrapped syntax > > ? ? ? object, and can be directly manipulated using car, cdr, ... > > ? ? ? without syntax-case deconstruction. > > > > ? http://www.het.brown.edu/people/andre/macros/ > > Closer. > > What I really want is a set of primitives, means of combination, and > means of abstraction that work well with code objects. Sounds like you just want this http://docs.plt-scheme.org/syntax/syntax-helpers.html > [...] I also want the ability to inject symbols hygienically > without having to think about it. I also want the ability to inject > symbols *non-hygienically*. But `datum->syntax' does just that... You start with "identifiers" being "a symbols plus some lexical information (whatever form that might have)" -- and to generate new identifiers, all you need is `datum->syntax' that accepts the symbol that you want to inject plus the lexical information that you copy from some other piece of syntax, which is how you get to control the scope without ever knowing how the lexical information is actually represented. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From bsaunders at otxresearch.com Thu Jul 9 15:30:37 2009 From: bsaunders at otxresearch.com (Brent Saunders) Date: Thu Jul 9 15:42:59 2009 Subject: [plt-scheme] Why isn't the car of a list of symbols a symbol? In-Reply-To: <63bb19ae0907091216h58133d32y75bb03ac13413f17@mail.gmail.com> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <63bb19ae0907091216h58133d32y75bb03ac13413f17@mail.gmail.com> Message-ID: <391EB94FC0793743AE1D3B581313D8EA1CF8A983@corleone.otx.local> This doesn't make sense. > (define foo '('yes 'no)) > (symbol? (first foo)) #f However, > (define foo `(,'yes ,'no)) > (symbol? (first foo)) True From yinso.chen at gmail.com Thu Jul 9 15:54:21 2009 From: yinso.chen at gmail.com (YC) Date: Thu Jul 9 15:54:42 2009 Subject: [plt-scheme] Why isn't the car of a list of symbols a symbol? In-Reply-To: <391EB94FC0793743AE1D3B581313D8EA1CF8A983@corleone.otx.local> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <63bb19ae0907091216h58133d32y75bb03ac13413f17@mail.gmail.com> <391EB94FC0793743AE1D3B581313D8EA1CF8A983@corleone.otx.local> Message-ID: <779bf2730907091254p36a5e9fdq3c529b90a748e110@mail.gmail.com> On Thu, Jul 9, 2009 at 12:30 PM, Brent Saunders wrote: > This doesn't make sense. > > > (define foo '('yes 'no)) > > (symbol? (first foo)) > #f > > You have an extra quote on yes & no and that's why you have #f. Welcome to MzScheme v4.1.3 [3m], Copyright (c) 2004-2008 PLT Scheme Inc. > (symbol? 'yes) #t > (symbol? ''yes) #f > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090709/6e1b40b8/attachment.htm From fahree at gmail.com Thu Jul 9 15:54:00 2009 From: fahree at gmail.com (=?ISO-8859-1?Q?Far=E9?=) Date: Thu Jul 9 15:59:49 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> <19030.11557.74143.890264@winooski.ccs.neu.edu> Message-ID: <653bea160907091254g3edea2f0uad51ce260363fdfb@mail.gmail.com> 2009/7/9 Joe Marshall : >> ?http://blog.plt-scheme.org/2009/05/explicit-renaming-macros-implicitly.html > > This entry makes my point exactly. ?syntax-case is just too low-level. > Sure, defmacro is even *lower* level, but that makes it easier to understand. > > Suppose I want a macro that examines one of its arguments to see if it > is a lambda expression. ?The ideal thing, of course, is a function that > does just that: > > (define-syntax foo > ?(lambda (stx) > ? ?(if (lambda-expression? (first-argument stx)) > ? ? ? ?....))) > > At least defmacro allows this: > (defmacro foo (arg0 &rest args) > ?(if (eq? (car arg0) 'lambda) ? ?;; crude, but effective I can't speak too much about the hygiene part of the issue, but as far as the "practical syntax for deconstructing things" goes, in CL, with fare-matcher, I do things like (match expr (`(lambda ,formals ,@body) ...) ...) As long as you're deconstructing things this way, you don't have to care about the underlying representation. One catch though -- in a syntaxful macro-system, you soon realize that there are more non-terminals than the "sexp", and then you need one "backquote" operator per non-terminal, and/or your backquote form should optionally take an argument specifying the non-terminal, an argument specifying the syntactic context (at which point we're doing explicit renaming), and maybe another to specify a tag with which to match unquotes (as in Slate). More generally, I *hate* that syntax-rules provides a pattern matcher that is wholly unrelated to anything else in the base language. If pattern matching is good at the meta-level, then the base-language should have it too, and the macro layer should be using the very same pattern-matching mechanism. Otherwise, your language design is no better than C++ with its pure-functional meta-language for templates that is wholly unrelated to its base language. [ Fran?ois-Ren? ?VB Rideau | Reflection&Cybernethics | http://fare.tunes.org ] I'd rather write programs that write programs than write programs -- Dick Sites From carl.eastlund at gmail.com Thu Jul 9 15:52:21 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Thu Jul 9 16:01:15 2009 Subject: [plt-scheme] Why isn't the car of a list of symbols a symbol? In-Reply-To: <391EB94FC0793743AE1D3B581313D8EA1CF8A983@corleone.otx.local> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <63bb19ae0907091216h58133d32y75bb03ac13413f17@mail.gmail.com> <391EB94FC0793743AE1D3B581313D8EA1CF8A983@corleone.otx.local> Message-ID: <990e0c030907091252i106bca28w9cebfad46113278f@mail.gmail.com> On Thu, Jul 9, 2009 at 3:30 PM, Brent Saunders wrote: > This doesn't make sense. > >> (define foo '('yes 'no)) This is equivalent to: (define foo (list (list 'quote 'yes) (list 'quote 'no))) >> (symbol? (first foo)) > #f > > However, > >> (define foo `(,'yes ,'no)) And this is equivalent to: (define foo (list 'yes 'no)) >> (symbol? (first foo)) > True The upshot is that the apostrophe followed by expression E means (quote E). So if you put an apostrophe inside another apostrophe, you get (quote (quote E)), which is not what you wanted. You probably want something like this: (define foo '(yes no)) You only need one apostrophe, and the result is equivalent to: (define foo (list 'yes 'no)) I hope this helps. --Carl From grettke at acm.org Thu Jul 9 16:07:20 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Jul 9 16:07:41 2009 Subject: [plt-scheme] Why isn't the car of a list of symbols a symbol? In-Reply-To: <990e0c030907091252i106bca28w9cebfad46113278f@mail.gmail.com> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <63bb19ae0907091216h58133d32y75bb03ac13413f17@mail.gmail.com> <391EB94FC0793743AE1D3B581313D8EA1CF8A983@corleone.otx.local> <990e0c030907091252i106bca28w9cebfad46113278f@mail.gmail.com> Message-ID: <756daca50907091307q53feb3efyd5bb022c56ae0851@mail.gmail.com> On Thu, Jul 9, 2009 at 2:52 PM, Carl Eastlund wrote: > You only need one apostrophe, and the result is equivalent to: > > (define foo (list 'yes 'no)) > > I hope this helps. When you introduce quote to students, who do you go about doing so? I first read about quote in TSPL. As I recall, it follows the approach of visualizing the read-evaluate-print loop, and explains that quote roughly means that whatever follows it is the external representation of the thing that want, so whatever did follow will not get sent to the evaluator. Perhaps this is not the best summary, but whatever the case the explanation (in part with the whole chapter) made it easier to understand. That was my experience it at least. From noelwelsh at gmail.com Thu Jul 9 16:07:43 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Jul 9 16:08:15 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: <19030.17643.3017.441865@winooski.ccs.neu.edu> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> <4A56389B.5070704@ccs.neu.edu> <19030.11557.74143.890264@winooski.ccs.neu.edu> <932b2f1f0907091157g35541c8dxab49742337c60d87@mail.gmail.com> <19030.17643.3017.441865@winooski.ccs.neu.edu> Message-ID: On Thu, Jul 9, 2009 at 8:28 PM, Eli Barzilay wrote: >> What I really want is a set of primitives, means of combination, and >> means of abstraction that work well with code objects. > > Sounds like you just want this > > ?http://docs.plt-scheme.org/syntax/syntax-helpers.html The point is not that tools don't exist, but that the current way of doing things is a mess. Why is there syntax->list and stx->list? Why aren't the prefixes (stx and syntax) the same? Why are all the tools scattered around different parts of the docs? It is *really* confusing trying to read, understand, and remember all of the different tools. N. From eli at barzilay.org Thu Jul 9 16:10:19 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Jul 9 16:10:40 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> <4A56389B.5070704@ccs.neu.edu> <19030.11557.74143.890264@winooski.ccs.neu.edu> <932b2f1f0907091157g35541c8dxab49742337c60d87@mail.gmail.com> <19030.17643.3017.441865@winooski.ccs.neu.edu> Message-ID: <19030.20139.19141.544956@winooski.ccs.neu.edu> On Jul 9, Noel Welsh wrote: > On Thu, Jul 9, 2009 at 8:28 PM, Eli Barzilay wrote: > >> What I really want is a set of primitives, means of combination, and > >> means of abstraction that work well with code objects. > > > > Sounds like you just want this > > > > ?http://docs.plt-scheme.org/syntax/syntax-helpers.html > > The point is not that tools don't exist, but that the current way of > doing things is a mess. Why is there syntax->list and stx->list? Why > aren't the prefixes (stx and syntax) the same? Why are all the tools > scattered around different parts of the docs? It is *really* > confusing trying to read, understand, and remember all of the > different tools. Maybe it's because most people don't use these extra tools? -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From carl.eastlund at gmail.com Thu Jul 9 16:18:28 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Thu Jul 9 16:19:30 2009 Subject: [plt-scheme] Why isn't the car of a list of symbols a symbol? In-Reply-To: <756daca50907091307q53feb3efyd5bb022c56ae0851@mail.gmail.com> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <63bb19ae0907091216h58133d32y75bb03ac13413f17@mail.gmail.com> <391EB94FC0793743AE1D3B581313D8EA1CF8A983@corleone.otx.local> <990e0c030907091252i106bca28w9cebfad46113278f@mail.gmail.com> <756daca50907091307q53feb3efyd5bb022c56ae0851@mail.gmail.com> Message-ID: <990e0c030907091318v25bd506ah25e4557ebbefddf7@mail.gmail.com> On Thu, Jul 9, 2009 at 4:07 PM, Grant Rettke wrote: > On Thu, Jul 9, 2009 at 2:52 PM, Carl Eastlund wrote: >> You only need one apostrophe, and the result is equivalent to: >> >> (define foo (list 'yes 'no)) >> >> I hope this helps. > > When you introduce quote to students, who do you go about doing so? Personally? I don't. But then I have never taught Scheme beyond the first semester, and there's no call for it then. (Well, ok, for symbols, but that's a trivial case.) > I first read about quote in TSPL. As I recall, it follows the approach > of visualizing the read-evaluate-print loop, and explains that quote > roughly means that whatever follows it is the external representation > of the thing that want, so whatever did follow will not get sent to > the evaluator. Perhaps this is not the best summary, but whatever the > case the explanation (in part with the whole chapter) made it easier > to understand. That was my experience it at least. There's two important things to learn about quote. The first is that 'E means (quote E), for any term E. The second is that the expression (quote E) produces E as a value, rather than running it as code. Following those rules, '('yes 'no) is (quote ((quote yes) (quote no))), and it produces the value ((quote yes) (quote no)). Apply those two rules, and quote shouldn't have any more surprises. Quasiquote and unquote are a bit trickier, but still follow just a few rules. --Carl From robby at eecs.northwestern.edu Thu Jul 9 16:21:53 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Jul 9 16:22:11 2009 Subject: [plt-scheme] Why isn't the car of a list of symbols a symbol? In-Reply-To: <990e0c030907091318v25bd506ah25e4557ebbefddf7@mail.gmail.com> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <63bb19ae0907091216h58133d32y75bb03ac13413f17@mail.gmail.com> <391EB94FC0793743AE1D3B581313D8EA1CF8A983@corleone.otx.local> <990e0c030907091252i106bca28w9cebfad46113278f@mail.gmail.com> <756daca50907091307q53feb3efyd5bb022c56ae0851@mail.gmail.com> <990e0c030907091318v25bd506ah25e4557ebbefddf7@mail.gmail.com> Message-ID: <932b2f1f0907091321m3a28f20cpcbaf33314ff77910@mail.gmail.com> On Thu, Jul 9, 2009 at 3:18 PM, Carl Eastlund wrote: > Following those rules, '('yes 'no) is (quote ((quote yes) (quote > no))), and it produces the value ((quote yes) (quote no)). ?Apply > those two rules, and quote shouldn't have any more surprises. ((quote yes) (quote no)) is not a value. It is an application expression. The way to keep your sanity here is to think of the printer as stripping off the outer quote when it prints out a value. Robby From jmarshall at alum.mit.edu Thu Jul 9 17:06:22 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Thu Jul 9 17:07:00 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: <19030.17643.3017.441865@winooski.ccs.neu.edu> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> <4A56389B.5070704@ccs.neu.edu> <19030.11557.74143.890264@winooski.ccs.neu.edu> <932b2f1f0907091157g35541c8dxab49742337c60d87@mail.gmail.com> <19030.17643.3017.441865@winooski.ccs.neu.edu> Message-ID: I wrote: >> (define-syntax foo >> (lambda (stx) >> (if (lambda-expression? (first-argument stx)) >> ....))) On Thu, Jul 9, 2009 at 12:28 PM, Eli Barzilay wrote: > You still get that: > > > (define-syntax (foo stx) > (if (free-identifier=? #'lambda (stx-car (stx-cdr stx))) > #'1 > #'2)) But I want (if (eq? 'lambda (cadr stx)) 1 2) I know it isn't the same (because of the extra baggage of syntax objects) but it is essentially isomorphic (modulo doing funny things with scope), so why do I have to learn a whole new set of primitives? > Sorry, I just don't see how that's different than using `map' over a > string, for example... ?Maybe it's the fact that you choose to accept > the extra complexity with strings because you see a point in having it > be a different type, but for some reason you refuse to divorce syntax > from lists in the same way? Map works fine on strings in common lisp. But strings aren't isomorphic to lists. Code is. -- ~jrm From robby at eecs.northwestern.edu Thu Jul 9 17:09:21 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Jul 9 17:09:40 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> <4A56389B.5070704@ccs.neu.edu> <19030.11557.74143.890264@winooski.ccs.neu.edu> <932b2f1f0907091157g35541c8dxab49742337c60d87@mail.gmail.com> <19030.17643.3017.441865@winooski.ccs.neu.edu> Message-ID: <932b2f1f0907091409i30ed07bdyd2bc38671f26c0d2@mail.gmail.com> On Thu, Jul 9, 2009 at 4:06 PM, Joe Marshall wrote: > But strings aren't isomorphic to lists. ?Code is. It isn't too hard to map every list to a string and vice-versa. But, I think the proper response here is that you're forgetting about the lexical information in code. Robby From jmarshall at alum.mit.edu Thu Jul 9 17:12:52 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Thu Jul 9 17:13:30 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: <932b2f1f0907091409i30ed07bdyd2bc38671f26c0d2@mail.gmail.com> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <4A56389B.5070704@ccs.neu.edu> <19030.11557.74143.890264@winooski.ccs.neu.edu> <932b2f1f0907091157g35541c8dxab49742337c60d87@mail.gmail.com> <19030.17643.3017.441865@winooski.ccs.neu.edu> <932b2f1f0907091409i30ed07bdyd2bc38671f26c0d2@mail.gmail.com> Message-ID: On Thu, Jul 9, 2009 at 2:09 PM, Robby Findler wrote: > On Thu, Jul 9, 2009 at 4:06 PM, Joe Marshall wrote: >> But strings aren't isomorphic to lists. ?Code is. > > It isn't too hard to map every list to a string and vice-versa. It gets harder to map every list operation into a string operation. There's no obvious equivalent to set-cdr! (or, in the other direction, string-set!) -- ~jrm From eli at barzilay.org Thu Jul 9 17:13:47 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Jul 9 17:14:09 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> <4A56389B.5070704@ccs.neu.edu> <19030.11557.74143.890264@winooski.ccs.neu.edu> <932b2f1f0907091157g35541c8dxab49742337c60d87@mail.gmail.com> <19030.17643.3017.441865@winooski.ccs.neu.edu> Message-ID: <19030.23947.810291.309199@winooski.ccs.neu.edu> On Jul 9, Joe Marshall wrote: > I wrote: > >> (define-syntax foo > >> (lambda (stx) > >> (if (lambda-expression? (first-argument stx)) > >> ....))) > > On Thu, Jul 9, 2009 at 12:28 PM, Eli Barzilay wrote: > > You still get that: > > > > > (define-syntax (foo stx) > > (if (free-identifier=? #'lambda (stx-car (stx-cdr stx))) > > #'1 > > #'2)) > > But I want > (if (eq? 'lambda (cadr stx)) 1 2) > > I know it isn't the same (because of the extra baggage of syntax > objects) but it is essentially isomorphic It's not, of course... > (modulo doing funny things with scope), ...just like you say here. > so why do I have to learn a whole new set of primitives? Why is it fine to learn a new set of primitives when you're dealing with any kind of non-sexpr data? (I at least hope that you're not advocating the use of sexprs as the ultimate representation of everything...) In this case, the idea that a symbol can represent identifiers is exactly what's broken, and what makes the need for a new type. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From aghuloum at gmail.com Thu Jul 9 17:16:39 2009 From: aghuloum at gmail.com (Abdulaziz Ghuloum) Date: Thu Jul 9 17:17:48 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> <19030.11557.74143.890264@winooski.ccs.neu.edu> Message-ID: <315F3F00-DC53-41AD-A9BB-7FD28A993D9B@gmail.com> On Jul 9, 2009, at 9:51 PM, Joe Marshall wrote: > syntax-case is just too low-level. > Sure, defmacro is even *lower* level, ... On what basis are you comparing "syntax-case" with "defmacro". Syntax-case is a pattern-matching facility for syntax objects. Are you comparing it to the pattern-matching facilities of defmacro, e.g., (define-macro foo (arg0 &rest args) ---) ? I don't see how syntax-case as a pattern matcher is "just too low-level". How can a pattern matcher be low-level anyways? > Suppose I want a macro that examines one of its arguments to see if it > is a lambda expression. The ideal thing, of course, is a function > that > does just that: > > (define-syntax foo > (lambda (stx) > (if (lambda-expression? (first-argument stx)) > ....))) (define-syntax foo (lambda (stx) (define (first-argument x) (syntax-case x () [(_ fst . rest) #'fst])) (define (lambda-expression? x) (syntax-case x (lambda) [(lambda . rest) #t] [_ #f])) (if (lambda-expression? (first-argument stx)) ....))) > At least defmacro allows this: > (defmacro foo (arg0 &rest args) > (if (eq? (car arg0) 'lambda) ;; crude, but effective This is poor because it's forcing the use of car instead of being a general pattern matcher like syntax-case. If it were a little more useful, it would've allowed you to say (defmacro foo ((arg0 &rest rest0) &rest args) (if (eq? arg0 'lambda) ---)) or, even better, (defmacro foo (('lambda &rest rest0) &rest args) ---) but hey, syntax-case does just that: (define-syntax foo (lambda (stx) (syntax-case stx (lambda) [(_ (lambda . rest0) . args) --- handle lambda case ---] --- handle other cases ---))) You almost never need to use something like mapcar or what have you when writing macros using syntax-case since it (and syntax) take care of destructuring and and constructing the syntax objects. This is effective, and not crude. Aziz,,, From geoff at knauth.org Thu Jul 9 17:49:14 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Jul 9 17:49:34 2009 Subject: [plt-scheme] printing exact rationals In-Reply-To: <92C45F56-E888-4243-8D50-AD54F1C9D498@brinckerhoff.org> References: <932b2f1f0907040532p76344d6cn7409117dde514d59@mail.gmail.com> <92C45F56-E888-4243-8D50-AD54F1C9D498@brinckerhoff.org> Message-ID: <1E5A43A4-47E2-42F4-AEF5-2A70BC939686@knauth.org> On Jul 9, 2009, at 14:06, John Clements wrote: > On Jul 4, 2009, at 5:32 AM, Robby Findler wrote: > If you right-click on the number and choose a different format, that >> choice will be remembered for future printing. > > Along these lines, Ian pointed out to me this week that for the > printout of rationals in decimal format, you can click on the "..." > to get another chunk of digits. This is incredibly nifty, but I > would never have figured it out by myself. What do you call something that's cooler than an easter egg, and actually useful? What else don't I know about DrScheme [...] ... ? From aghuloum at gmail.com Thu Jul 9 17:59:28 2009 From: aghuloum at gmail.com (Abdulaziz Ghuloum) Date: Thu Jul 9 18:00:32 2009 Subject: [plt-scheme] On hygiene and trust In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <6DE2D926-E981-4519-920F-1A824093FFE6@gmail.com> Message-ID: On Jul 9, 2009, at 8:24 PM, Joe Marshall wrote: > Yeah. it should be more like this: > (defmacro named-let (name bindings &body body) > `(funcall (LABELS ((,name ,(map list #'car bindings) ,@body)) > (function name)) ,@(map 'list #'cadr bindings))) > > But the compiler generates much worse code for this. The scoping > issue is a minor issue. First, "Scope Is Everything"[*]. Second, if your common lisp compiler generates much worse code for this (and it probably doesn't), then use a better compiler. E.g., Ikarus Scheme version 0.0.4-rc1+ (revision 1828, build 2009-07-09) Copyright (c) 2006-2009 Abdulaziz Ghuloum > (define-syntax named-let (syntax-rules () [(_ name ([lhs* rhs*] ...) b b* ...) ((letrec ([name (lambda (lhs* ...) b b* ...)]) name) rhs* ...)])) > (expand/optimize '(named-let loop ([n 5] [ac 1]) (if (zero? n) ac (loop (- n 1) (* n ac))))) (letrec ((loop_0 (lambda (n_1 ac_2) (if (zero? n_1) ac_2 (loop_0 (- n_1 '1) (* n_1 ac_2)))))) (loop_0 '5 '1)) Aziz,,, [*] http://video.google.com/videoplay?docid=-3704713569771882785 From xacc.ide at gmail.com Wed Jul 8 15:48:08 2009 From: xacc.ide at gmail.com (leppie) Date: Thu Jul 9 18:37:28 2009 Subject: [plt-scheme] Re: On hygiene and trust In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> Message-ID: <96533920-59a4-46c5-9778-a29cbde388eb@a36g2000yqc.googlegroups.com> On Jul 8, 5:04?pm, Joe Marshall wrote: > > On Jul 7, 2009, at 8:52 PM, Joe Marshall wrote: > > >> Syntax-case is uniformly painful for simple and complex uses. > On Wed, Jul 8, 2009 at 7:31 AM, Abdulaziz Ghuloum wrote: > > I don't agree. ?Show me a painful simple use. ?Pick any simple > > macro you want: let, let*, or, and, cond, case, or any other > > macro of your choice to show the pain. > > This came up the other day. ?Transform something like this: > > (define-event foo bar (arg1 arg2 ...) > ? ?(form1) > ? ?(form2 ...) etc.) > > into something like this: > > (define (foo$bar arg1 arg2 ...) > ? ?(form1) > ? ?(form2 ...) etc.) > How will the implementation be any different between defmacro and syntax-case in your example? From jvjulien at free.fr Thu Jul 9 06:01:45 2009 From: jvjulien at free.fr (jeeve) Date: Thu Jul 9 18:37:35 2009 Subject: [plt-scheme] Re: PLT Scheme - Datalog In-Reply-To: References: <16e12903-e3a2-4043-97b5-34e5be36d0f2@g31g2000yqc.googlegroups.com> Message-ID: <4547d8fd-ca7c-429e-8c43-6b34d68621d1@t33g2000yqe.googlegroups.com> OK, thanks ! On 8 juil, 18:48, Jay McCarthy wrote: > Hello, > > As Shriram mentions, I only support Pure Datalog. For more information, see > > What You Always Wanted to Know About Datalog (And Never Dared to Ask) > by Stefano Ceri, Georg Gottlob, and Letizia Tanca > > Jay > > > > On Wed, Jul 8, 2009 at 4:01 AM, jeeve wrote: > > hello, > > > I would like use "NOT" predicate as > > > woman(F) :- father(_,F), not(man(F)), not(husband(_,F))" > > > but the Datalog language in package "jaymccarthy/datalog.plt 1.2" > > don't recognize this expression > > > Thanks for your help > > > _________________________________________________ > > ?For list-related administrative tasks: > > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- > Jay McCarthy > Assistant Professor / Brigham Young Universityhttp://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jmarshall at alum.mit.edu Thu Jul 9 18:46:30 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Thu Jul 9 18:47:07 2009 Subject: [plt-scheme] Re: On hygiene and trust In-Reply-To: <96533920-59a4-46c5-9778-a29cbde388eb@a36g2000yqc.googlegroups.com> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <96533920-59a4-46c5-9778-a29cbde388eb@a36g2000yqc.googlegroups.com> Message-ID: On Wed, Jul 8, 2009 at 12:48 PM, leppie wrote: >> >> (define-event foo bar (arg1 arg2 ...) >> ? ?(form1) >> ? ?(form2 ...) etc.) >> >> into something like this: >> >> (define (foo$bar arg1 arg2 ...) >> ? ?(form1) >> ? ?(form2 ...) etc.) >> > > How will the implementation be any different between defmacro and > syntax-case in your example? In two (minor) ways. The syntax-case version will have to resolve the first two arguments into symbols before pasting them, then turn them back into an identifier that is scoped in the original environment before inserting it into the final form. It isn't obvious to me whether you want the define to be hygienic or not. -- ~jrm From jmarshall at alum.mit.edu Thu Jul 9 19:10:30 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Thu Jul 9 19:19:08 2009 Subject: [plt-scheme] Why isn't the car of a list of symbols a symbol? In-Reply-To: <932b2f1f0907091321m3a28f20cpcbaf33314ff77910@mail.gmail.com> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <63bb19ae0907091216h58133d32y75bb03ac13413f17@mail.gmail.com> <391EB94FC0793743AE1D3B581313D8EA1CF8A983@corleone.otx.local> <990e0c030907091252i106bca28w9cebfad46113278f@mail.gmail.com> <756daca50907091307q53feb3efyd5bb022c56ae0851@mail.gmail.com> <990e0c030907091318v25bd506ah25e4557ebbefddf7@mail.gmail.com> <932b2f1f0907091321m3a28f20cpcbaf33314ff77910@mail.gmail.com> Message-ID: On Thu, Jul 9, 2009 at 1:21 PM, Robby Findler wrote: > On Thu, Jul 9, 2009 at 3:18 PM, Carl Eastlund wrote: >> Following those rules, '('yes 'no) is (quote ((quote yes) (quote >> no))), and it produces the value ((quote yes) (quote no)). ?Apply >> those two rules, and quote shouldn't have any more surprises. > > ((quote yes) (quote no)) > > is not a value. It is an application expression. It most certainly is a value. It is a list of two elements. There are many ways to construct such a value. Carl suggested evaluating '('yes 'no). > The way to keep your sanity here is to think of the printer as > stripping off the outer quote when it prints out a value. What are you smoking?! The printer isn't involved here and it certainly isn't stripping anything. Another way to get the value is to evaluate this: (cons '(quote yes) (cons '(quote no) '())) Which also prints as ((quote yes)(quote no)) but there is no `outer quote' for the printer to have removed. -- ~jrm From pltscheme at pnkfx.org Thu Jul 9 19:23:00 2009 From: pltscheme at pnkfx.org (Felix Klock's PLT scheme proxy) Date: Thu Jul 9 19:23:25 2009 Subject: [plt-scheme] Why isn't the car of a list of symbols a symbol? In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <63bb19ae0907091216h58133d32y75bb03ac13413f17@mail.gmail.com> <391EB94FC0793743AE1D3B581313D8EA1CF8A983@corleone.otx.local> <990e0c030907091252i106bca28w9cebfad46113278f@mail.gmail.com> <756daca50907091307q53feb3efyd5bb022c56ae0851@mail.gmail.com> <990e0c030907091318v25bd506ah25e4557ebbefddf7@mail.gmail.com> <932b2f1f0907091321m3a28f20cpcbaf33314ff77910@mail.gmail.com> Message-ID: <7A6386EA-72E8-4C6E-A9D9-61FCFA592ABE@pnkfx.org> Joe (cc'ing plt-scheme)- On Jul 9, 2009, at 7:10 PM, Joe Marshall wrote: > On Thu, Jul 9, 2009 at 1:21 PM, Robby > Findler wrote: >> On Thu, Jul 9, 2009 at 3:18 PM, Carl >> Eastlund wrote: >>> Following those rules, '('yes 'no) is (quote ((quote yes) (quote >>> no))), and it produces the value ((quote yes) (quote no)). Apply >>> those two rules, and quote shouldn't have any more surprises. >> >> ((quote yes) (quote no)) >> >> is not a value. It is an application expression. > > It most certainly is a value. It is a list of two elements. > There are many ways to construct such a value. Carl > suggested evaluating '('yes 'no). > >> The way to keep your sanity here is to think of the printer as >> stripping off the outer quote when it prints out a value. > > What are you smoking?! The printer isn't involved here and > it certainly isn't stripping anything. Oh please, please, please, lets *not* have another debate between the "reductionists" and "non-reductionists"! http://list.cs.brown.edu/pipermail/plt-scheme/2008-October/027923.html -Felix Klock From morazanm at gmail.com Thu Jul 9 19:53:28 2009 From: morazanm at gmail.com (Marco Morazan) Date: Thu Jul 9 19:53:47 2009 Subject: [plt-scheme] Why isn't the car of a list of symbols a symbol? In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <63bb19ae0907091216h58133d32y75bb03ac13413f17@mail.gmail.com> <391EB94FC0793743AE1D3B581313D8EA1CF8A983@corleone.otx.local> <990e0c030907091252i106bca28w9cebfad46113278f@mail.gmail.com> <756daca50907091307q53feb3efyd5bb022c56ae0851@mail.gmail.com> <990e0c030907091318v25bd506ah25e4557ebbefddf7@mail.gmail.com> <932b2f1f0907091321m3a28f20cpcbaf33314ff77910@mail.gmail.com> Message-ID: <9b1fff280907091653g667f37b7x4b51053905794435@mail.gmail.com> >> ((quote yes) (quote no)) >> >> is not a value. It is an application expression. > > It most certainly is a value. ?It is a list of two elements. Huh? Really? How do you figure it evaluates to a list with two elements? Without the quote it IS an application expression! It is pretty straight forward: ((quote yes) (quote no)) is an application expression (quote ((quote yes) (quote no))) is a list with two elements '((quote yes) (quote no)) is a list with two elements I suggest a little testing: Welcome to DrScheme, version 4.2 [3m]. Language: Essentials of Programming Languages (3rd ed.); memory limit: 128 megabytes. > (list? (quote ((quote yes) (quote no)) )) #t > (list? '((quote yes) (quote no)) ) #t > (list ((quote yes) (quote no))) . . procedure application: expected procedure, given: yes; arguments were: no > That last one means that you are trying to apply 'yes to 'no. Clearly, it is an application expression. -- Cheers, Marco From carl.eastlund at gmail.com Thu Jul 9 20:12:15 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Thu Jul 9 20:12:54 2009 Subject: [plt-scheme] Why isn't the car of a list of symbols a symbol? In-Reply-To: <9b1fff280907091653g667f37b7x4b51053905794435@mail.gmail.com> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <63bb19ae0907091216h58133d32y75bb03ac13413f17@mail.gmail.com> <391EB94FC0793743AE1D3B581313D8EA1CF8A983@corleone.otx.local> <990e0c030907091252i106bca28w9cebfad46113278f@mail.gmail.com> <756daca50907091307q53feb3efyd5bb022c56ae0851@mail.gmail.com> <990e0c030907091318v25bd506ah25e4557ebbefddf7@mail.gmail.com> <932b2f1f0907091321m3a28f20cpcbaf33314ff77910@mail.gmail.com> <9b1fff280907091653g667f37b7x4b51053905794435@mail.gmail.com> Message-ID: <990e0c030907091712r7b53e263nd6c9759c391d79a4@mail.gmail.com> This digression is *really* muddying the original issue. I do not think this is enlightening for Brent, and possibly quite confusing; furthermore it is off-topic. I picked one way of writing down values. Some of you may prefer another (for instance, as self-evaluating expressions; mine were not). It's not worth arguing about; multiple ways of writing down values can be explained in perfectly self-consistent ways, so let's each keep our favorite and move on. Carl Eastlund On Thu, Jul 9, 2009 at 7:53 PM, Marco Morazan wrote: >>> ((quote yes) (quote no)) >>> >>> is not a value. It is an application expression. >> >> It most certainly is a value. ?It is a list of two elements. > > Huh? Really? How do you figure it evaluates to a list with two > elements? Without the quote it IS an application expression! > > It is pretty straight forward: > > ((quote yes) (quote no)) is an application expression > > (quote ((quote yes) (quote no))) is a list with two elements > > '((quote yes) (quote no)) is a list with two elements > > I suggest a little testing: > > Welcome to DrScheme, version 4.2 [3m]. > Language: Essentials of Programming Languages (3rd ed.); memory limit: > 128 megabytes. >> (list? (quote ((quote yes) (quote no)) )) > #t >> (list? '((quote yes) (quote no)) ) > #t >> (list ((quote yes) (quote no))) > . . procedure application: expected procedure, given: yes; arguments were: no >> > > That last one means that you are trying to apply 'yes to 'no. Clearly, > it is an application expression. > > -- > > Cheers, > > Marco From sbloch at adelphi.edu Thu Jul 9 23:07:19 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Thu Jul 9 23:08:35 2009 Subject: [plt-scheme] Why isn't the car of a list of symbols a symbol? In-Reply-To: <9b1fff280907091653g667f37b7x4b51053905794435@mail.gmail.com> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <63bb19ae0907091216h58133d32y75bb03ac13413f17@mail.gmail.com> <391EB94FC0793743AE1D3B581313D8EA1CF8A983@corleone.otx.local> <990e0c030907091252i106bca28w9cebfad46113278f@mail.gmail.com> <756daca50907091307q53feb3efyd5bb022c56ae0851@mail.gmail.com> <990e0c030907091318v25bd506ah25e4557ebbefddf7@mail.gmail.com> <932b2f1f0907091321m3a28f20cpcbaf33314ff77910@mail.gmail.com> <9b1fff280907091653g667f37b7x4b51053905794435@mail.gmail.com> Message-ID: On Jul 9, 2009, at 7:53 PM, Marco Morazan wrote: >>> ((quote yes) (quote no)) >>> >>> is not a value. It is an application expression. >> >> It most certainly is a value. It is a list of two elements. > > Huh? Really? How do you figure it evaluates to a list with two > elements? Note the change in wording, from "It is a list of two elements" to "it evaluates to a list with two elements." Very different things. ((quote yes) (quote no)) is a list with two elements, each of which is a list with two elements. (list (quote yes) (quote no)) is a list with three elements, which (in a certain language, with a certain environment) evaluates to the aforementioned list with two elements, because "eval" interprets it as an application expression. > I suggest a little testing: > > Welcome to DrScheme, version 4.2 [3m]. > Language: Essentials of Programming Languages (3rd ed.); memory limit: > 128 megabytes. >> (list? (quote ((quote yes) (quote no)) )) > #t >> (list? '((quote yes) (quote no)) ) > #t >> (list ((quote yes) (quote no))) > . . procedure application: expected procedure, given: yes; > arguments were: no >> > > That last one means that you are trying to apply 'yes to 'no. Clearly, > it is an application expression. No, I'm not trying to apply 'yes to 'no; "eval" is trying to apply 'yes to 'no, and the only reason "eval" is involved at all is because you typed these expressions into a read-EVAL-print loop. To find out what the expression you typed IS, as opposed to what it EVALUATES TO, imagine a DrScheme language in which the "eval" step is skipped: it's just an RPL. (I'm sure one of the PLT gurus on the list could whip this up in a few minutes....) You type in an expression and you get back the same expression -- possibly in a different display format, but with no function applications in between. Of course, you could set this up with various different display formats, e.g. the nested-cons display format of BSL; the "list" display format of BSLLA; a quoted-list display format; or an unquoted display format (which I think is the first output format I saw in Lisp, thirty years ago). In any case, the result "is" the same thing as the expression you typed in. In BSL output format, > (quote ((quote yes) (quote no))) (cons 'quote (cons (cons 'quote (cons 'yes empty)) (cons (cons 'quote (cons 'no empty)) empty)) empty)) > '((quote yes) (quote no)) (cons 'quote (cons (cons 'quote (cons 'yes empty)) (cons (cons 'quote (cons 'no empty)) empty)) empty)) > ((quote yes) (quote no)) (cons (cons 'quote (cons 'yes empty)) (cons (cons 'quote (cons 'no empty)) empty) In BSLLA output format, > (quote ((quote yes) (quote no))) (list 'quote (list (list 'quote 'yes) (list 'quote 'no))) > '((quote yes) (quote no)) (list 'quote (list (list 'quote 'yes) (list 'quote 'no))) > ((quote yes) (quote no)) (list (list 'quote 'yes) (list 'quote 'no)) In quoted-list display format, > (quote ((quote yes) (quote no))) '('yes 'no) > '((quote yes) (quote no)) '('yes 'no) > ((quote yes) (quote no)) '('yes 'no) In unquoted display format, > (quote ((quote yes) (quote no))) (quote ((quote yes) (quote no))) > '((quote yes) (quote no)) (quote ((quote yes) (quote no))) >((quote yes) (quote no)) ((quote yes) (quote no)) Every time you see a left parenthesis, there's the beginning of a list in internal representation. Every right parenthesis becomes the end of a list in internal representation. Of course, I'm sure this is a gross oversimplification of the actual implementation, which has syntax objects that are kinda-like-but-not- quite lists. But to a first approximation, it works. Stephen Bloch sbloch@adelphi.edu From noelwelsh at gmail.com Fri Jul 10 04:18:35 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Jul 10 04:18:54 2009 Subject: [plt-scheme] ajax and plt In-Reply-To: <252c42fe0907081339m7a9626c8r6c84863ece2d3375@mail.gmail.com> References: <779bf2730907011423g60a652c5p85c2215e54cb9842@mail.gmail.com> <252c42fe0907081339m7a9626c8r6c84863ece2d3375@mail.gmail.com> Message-ID: On Wed, Jul 8, 2009 at 9:39 PM, Marco Monteiro wrote: > I want to port the compiler to PLT-Scheme. My idea is to somehow > reuser the module and macro system of PLT. I'm just starting with PLT, > so I need advice about the best way to do this. ... > What I was thinking about was that I could write a module using #lang sines, > for example. The forms in this module would be expanded to the core > syntactic > forms in PLT-Scheme (the ones in chapter two of the reference manual) by > PLT-Scheme. > Then the compiler takes these and generates Javascript (maybe using > javascript.plt) > and serve it with the web server or maybe put it in a file. Yes, that's the way to do it. Basically you want to define your own macros for define etc. which expand into the kernel syntax (as you said). Then you probably want to implement your own #%module-begin form to compile kernel syntax into JS (after expanding the forms within the module). Below is a really simple example of a language that compiles into JS expressions. Call one file unajoy.ss and the other unajoy-test.ss and put them in the same directory. Note that I don't implement #%module-begin; I reuse PLT Scheme's. HTH, N. unajoy.ss: #lang scheme/base (require (planet untyped/mirrors/javascript/javascript)) (define-syntax js-define (syntax-rules () [(js-define (name arg ...) expr0 expr ...) (javascript->string (js (function name (arg ...) ,expr0 ,expr ...)))] [(js-define name value) (javascript->string (js (var (name value))))])) (define-syntax js-if (syntax-rules () [(js-if test true false) (js (? test true false))] [(js-if test true) (js (? test true undefined))])) (define-syntax js-fn-begin (syntax-rules () [(js-fn-begin expr) (js (return ,expr))] [(js-fn-begin expr0 expr (provide #%module-begin #%app #%datum (rename-out [js-define define] [js-if if])) ----- unajoy-test.ss: #lang s-exp "unajoy.ss" (define foo 42) (define (bar x y) (if (> x 0) (+ x y) (- y x))) (define (baz x y) (define z 0) (+ x y z)) From lchangying at gmail.com Fri Jul 10 05:06:26 2009 From: lchangying at gmail.com (Changying Li) Date: Fri Jul 10 05:30:25 2009 Subject: [plt-scheme] a bug of mysql.plt Message-ID: <87zlbc3o19.fsf@gmail.com> I'm a newbie of plt scheme. If I report a non-exist bug, please forgive me. plt scheme version: [chylli@arch scmtipcode] mzscheme -v Welcome to MzScheme v4.2 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. mysql.plt version: mysql.plt (1 2) 0.5a jaz example code: #lang scheme (current-print void) (require (planet jaz/mysql:1)) (connect "localhost" 3306 "chylli" "3843054" #:schema "test" #:set-current? #t) (define rs (query "select * from user_stat")) (printf "~a\n" (result-set-field-names rs )) (close-connection! (current-connection)) expect: [chylli@arch /tmp] mzscheme test.ss #(stat_id user_id column_name column_value time) bad result: (file "/home/chylli/.plt-scheme/planet/300/4.2/cache/jaz/mysql.plt/1/2/private/structs.ss") broke the contract (->r ((f ...) (vec1 ...)) vec ... ...) on vector-map; expected <...43/vector-lib.ss:275:13>, given: # === context === /usr/lib/plt/collects/scheme/private/contract-guts.ss:220:0: raise-contract-error /usr/lib/plt/collects/srfi/43/vector-lib.ss:275:4: ...rfi/43/vector-lib.ss:275:4 advice: 74th line of structs.ss should be: (vector-map (lambda (i f) (field-name f)) (result-set-fields rs))) -- Thanks & Regards Changying Li From noelwelsh at gmail.com Fri Jul 10 07:10:49 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Jul 10 07:11:13 2009 Subject: [plt-scheme] Scheme tutorials at DEFUN 2009 Message-ID: Hi all, There are three Scheme tutorials (on DSLs, web programming, and embedded programming) as part of DEFUN 2009. If you can get to Edinburgh between Sept 3 and Sept 5 I strongly encourage attendance -- these tutorials look really good. Full schedule is here: http://www.defun2009.info/blog/tutorial-schedule/ N. From pocmatos at gmail.com Fri Jul 10 08:08:44 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri Jul 10 08:09:04 2009 Subject: [plt-scheme] Contract case... but not case-> Message-ID: <1247227724.15575.15.camel@drserver> Hi all, I need to say something like: (case-dom-> (A . -> . A) (B . -> . B)) to say, hey, this is a function that may receive an A or a B. If it receives an A, then result must be an A, if it's a B then result must be a B. Any tips? Initially I though case-> would do the trick but case-> is for case-lambda expressions which won't work if the several cases have the same number of arguments. Cheers, Paulo Matos From robby at eecs.northwestern.edu Fri Jul 10 08:12:08 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Fri Jul 10 08:12:30 2009 Subject: [plt-scheme] Contract case... but not case-> In-Reply-To: <1247227724.15575.15.camel@drserver> References: <1247227724.15575.15.camel@drserver> Message-ID: <932b2f1f0907100512q5a25b08bubd80c8e99e14a108@mail.gmail.com> If A (or B) are flat contracts, then you can use ->d, but if A and B are both function contracts, then that can get tricky and the contract language doesn't support it. Robby On Fri, Jul 10, 2009 at 7:08 AM, Paulo J. Matos wrote: > Hi all, > > I need to say something like: > (case-dom-> > ? ?(A . -> . A) > ? ?(B . -> . B)) > > to say, hey, this is a function that may receive an A or a B. If it > receives an A, then result must be an A, if it's a B then result must be > a B. > > Any tips? > > Initially I though case-> would do the trick but case-> is for > case-lambda expressions which won't work if the several cases have the > same number of arguments. > > Cheers, > > Paulo Matos > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From morazanm at gmail.com Fri Jul 10 09:42:21 2009 From: morazanm at gmail.com (Marco Morazan) Date: Fri Jul 10 09:42:42 2009 Subject: [plt-scheme] Why isn't the car of a list of symbols a symbol? In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <63bb19ae0907091216h58133d32y75bb03ac13413f17@mail.gmail.com> <391EB94FC0793743AE1D3B581313D8EA1CF8A983@corleone.otx.local> <990e0c030907091252i106bca28w9cebfad46113278f@mail.gmail.com> <756daca50907091307q53feb3efyd5bb022c56ae0851@mail.gmail.com> <990e0c030907091318v25bd506ah25e4557ebbefddf7@mail.gmail.com> <932b2f1f0907091321m3a28f20cpcbaf33314ff77910@mail.gmail.com> <9b1fff280907091653g667f37b7x4b51053905794435@mail.gmail.com> Message-ID: <9b1fff280907100642q18251842o6d1ffb3e83accd6d@mail.gmail.com> On Thu, Jul 9, 2009 at 11:07 PM, Stephen Bloch wrote: > > On Jul 9, 2009, at 7:53 PM, Marco Morazan wrote: > >>>> ((quote yes) (quote no)) >>>> >>>> is not a value. It is an application expression. >>> >>> It most certainly is a value. ?It is a list of two elements. >> >> Huh? Really? How do you figure it evaluates to a list with two >> elements? > > Note the change in wording, from "It is a list of two elements" to "it > evaluates to a list with two elements." ?Very different things. > > ((quote yes) (quote no)) > > is a list with two elements, each of which is a list with two elements. > It is a shame that quote is ommitted by the print part of the repl. Two identical expressions can be interpreted by those beginning as two different things. Think about it carefully, is ((lambda (x) (+ x 1)) 4) a list or an application expression? What does Scheme syntax say? In order to be a list you need to quote it. Ditto on the above. >> ((quote yes) (quote no)) > (cons (cons 'quote (cons 'yes empty)) (cons (cons 'quote (cons 'no empty)) empty) Welcome to DrScheme, version 4.2 [3m]. Language: Beginning Student; memory limit: 128 megabytes. > ((quote yes) (quote no)) function call: expected a defined name or a primitive operation name after an open parenthesis, but found something else > Welcome to DrScheme, version 4.2 [3m]. Language: Beginning Student with List Abbreviations; memory limit: 128 megabytes. > ((quote yes) (quote no)) function call: expected a defined name or a primitive operation name after an open parenthesis, but found something else > In the two student languages you mention when you ask what is ((quote yes) (quote no)), you can see that Scheme considers it an application expression. It is the *human* interpreter that introduces ambiguity by interpreting it as a list. I think that it is best to tell students that the above is an application expression, because it is not quoted and that by convention Scheme does not output application expressions and, therefore, ommits the quote for lists. The value of an expression is ALWAYS what it evaluates to regardless of the printing convention used. -- Cheers, Marco From zeppieri at gmail.com Fri Jul 10 10:13:53 2009 From: zeppieri at gmail.com (Jon Zeppieri) Date: Fri Jul 10 10:20:48 2009 Subject: [plt-scheme] a bug of mysql.plt In-Reply-To: <87zlbc3o19.fsf@gmail.com> References: <87zlbc3o19.fsf@gmail.com> Message-ID: <7622cdaf0907100713o26f16fd8wcd6186b7e61120c6@mail.gmail.com> On Fri, Jul 10, 2009 at 5:06 AM, Changying Li wrote: > I'm a newbie of plt scheme. If I report a non-exist bug, please forgive > me. > > plt scheme version: > [chylli@arch scmtipcode] mzscheme -v > Welcome to MzScheme v4.2 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. > > mysql.plt version: > mysql.plt (1 2) 0.5a jaz > > > example code: > > #lang scheme > (current-print void) > (require (planet jaz/mysql:1)) > > (connect "localhost" 3306 "chylli" "3843054" #:schema "test" #:set-current? > #t) > (define rs (query "select * from user_stat")) > (printf "~a\n" (result-set-field-names rs )) > (close-connection! (current-connection)) > > > expect: > [chylli@arch /tmp] mzscheme test.ss > #(stat_id user_id column_name column_value time) > > bad result: > > (file > "/home/chylli/.plt-scheme/planet/300/4.2/cache/jaz/mysql.plt/1/2/private/structs.ss") > broke the contract > (->r ((f ...) (vec1 ...)) vec ... ...) > on vector-map; expected <...43/vector-lib.ss:275:13>, given: > # > > === context === > /usr/lib/plt/collects/scheme/private/contract-guts.ss:220:0: > raise-contract-error > /usr/lib/plt/collects/srfi/43/vector-lib.ss:275:4: > ...rfi/43/vector-lib.ss:275:4 > > > > advice: > 74th line of structs.ss should be: > (vector-map (lambda (i f) (field-name f)) (result-set-fields rs))) > Thanks for the bug report. I fixed this issue and uploaded version 1.3 to planet: http://planet.plt-scheme.org/display.ss?package=mysql.plt&owner=jaz -Jon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090710/7e2caa1b/attachment.html From sbloch at adelphi.edu Fri Jul 10 10:55:54 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Fri Jul 10 10:56:17 2009 Subject: [plt-scheme] Why isn't the car of a list of symbols a symbol? In-Reply-To: <9b1fff280907100642q18251842o6d1ffb3e83accd6d@mail.gmail.com> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <63bb19ae0907091216h58133d32y75bb03ac13413f17@mail.gmail.com> <391EB94FC0793743AE1D3B581313D8EA1CF8A983@corleone.otx.local> <990e0c030907091252i106bca28w9cebfad46113278f@mail.gmail.com> <756daca50907091307q53feb3efyd5bb022c56ae0851@mail.gmail.com> <990e0c030907091318v25bd506ah25e4557ebbefddf7@mail.gmail.com> <932b2f1f0907091321m3a28f20cpcbaf33314ff77910@mail.gmail.com> <9b1fff280907091653g667f37b7x4b51053905794435@mail.gmail.com> <9b1fff280907100642q18251842o6d1ffb3e83accd6d@mail.gmail.com> Message-ID: On Jul 10, 2009, at 9:42 AM, Marco Morazan wrote: > It is a shame that quote is ommitted by the print part of the repl. > Two identical expressions can be interpreted by those beginning as two > different things. Think about it carefully, is ((lambda (x) (+ x 1)) > 4) a list or an application expression? What does Scheme syntax say? No question: Scheme syntax says it's a list (or, technically, a syntax object, i.e. a list with decorations). Scheme semantics (which depends on the current environment bindings, etc.) treats it as an application expression. I wrote, in my hypothetical "RPL" language: >>> ((quote yes) (quote no)) >> (cons (cons 'quote (cons 'yes empty)) (cons (cons 'quote (cons 'no >> empty)) empty) to which Marco rebutted, using BSL language: > Welcome to DrScheme, version 4.2 [3m]. > Language: Beginning Student; memory limit: 128 megabytes. >> ((quote yes) (quote no)) > function call: expected a defined name or a primitive operation name > after an open parenthesis, but found something else > > > Welcome to DrScheme, version 4.2 [3m]. > Language: Beginning Student with List Abbreviations; memory limit: 128 > megabytes. >> ((quote yes) (quote no)) > function call: expected a defined name or a primitive operation name > after an open parenthesis, but found something else Of course this is what you get if you type these expressions into a read-eval-print loop. But if you type them into a read-print loop, so you see what they ARE, rather than what they EVALUATE TO, you'll get the results I described. > In the two student languages you mention when you ask what is ((quote > yes) (quote no)), you can see that Scheme considers it an application > expression. It is the *human* interpreter that introduces ambiguity by > interpreting it as a list. What exactly do you mean by "Scheme considers it..."? The "read" part of the read-eval-print loop has never heard of an "application expression"; it converts a string into (to a first approximation) a list. Only the "eval" part considers it an application expression. > The value of an expression is ALWAYS what it evaluates to > regardless of the printing convention used. Absolutely... but let's not equate "an expression" with "the value of an expression". (* 1 2 3) and (- 10 4) are completely different syntactic expressions that happen to have the same value when evaluated in a particular language with a particular environment; in a different language or environment, they might NOT evaluate to the same thing. Likewise, ((quote yes) (quote no)) is a perfectly good syntactic expression that happens to be unevaluable in a particular language with a particular environment; in a different language or environment, it might evaluate to (quote maybe). This leaves open the question of how best to explain this to students. For some, the distinction between an expression and its value is too abstract, so until they're ready for this distinction, you may have to come up with some other hand-waving dodge. But is that really necessary? The last time I taught Principles of Programming Languages (4th semester, college), I pointed out that, although the most obvious question to ask about an expression is "what is its value?", other equally-interesting questions are "how many operators does it have?" and "does it contain any free variables?" Even in my beginning-programming-for-non-majors course, I have students draw syntax diagrams (with nested boxes, each box labeled with a syntax rule) and observe that two expressions with the same value may have completely different syntax diagrams. Stephen Bloch sbloch@adelphi.edu From morazanm at gmail.com Fri Jul 10 13:33:12 2009 From: morazanm at gmail.com (Marco Morazan) Date: Fri Jul 10 13:33:32 2009 Subject: [plt-scheme] Why isn't the car of a list of symbols a symbol? In-Reply-To: References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <990e0c030907091252i106bca28w9cebfad46113278f@mail.gmail.com> <756daca50907091307q53feb3efyd5bb022c56ae0851@mail.gmail.com> <990e0c030907091318v25bd506ah25e4557ebbefddf7@mail.gmail.com> <932b2f1f0907091321m3a28f20cpcbaf33314ff77910@mail.gmail.com> <9b1fff280907091653g667f37b7x4b51053905794435@mail.gmail.com> <9b1fff280907100642q18251842o6d1ffb3e83accd6d@mail.gmail.com> Message-ID: <9b1fff280907101033n51b7abc7ia9bb2448622d5e70@mail.gmail.com> Stephen, IMHO, calling ((quote yes) (quote no)) a list is confusing for beginning students. You can not use it as a list in a program unless you slap with an annotation (i.e. a quote). So, in a program you argue it is an application expression and everywhere else students must consider it a list? Frankly, that is adding an unnecessary level of complexity. We should not have to imagine a repl without the e. > No question: Scheme syntax says it's a list (or, technically, a syntax > object, i.e. a list with decorations). I have not reviewed the parser used by DrScheme, but I would be very surprised if ((quote yes) (quote no)) is parsed as a list. In every parser I have ever written and seen it would parse as an application expression. That is, the concrete syntax may have it look like a list, but in the abstract syntax and in reality it is not a list. > Absolutely... but let's not equate "an expression" with "the value of an > expression". (* 1 2 3) and (- 10 4) are completely different syntactic > expressions Let's not equate an expression with a list. (* 1 2 3) and (- 10 4) are both application expressions. That is, they form instances of the same syntactic category. One *could* use a list to represent them internally, but that is usually not the case. In any case, in a Scheme *program* they are application expressions regardless of how they are represented internally. >> In the two student languages you mention when you ask what is ((quote >> yes) (quote no)), you can see that Scheme considers it an application >> expression. It is the *human* interpreter that introduces ambiguity by >> interpreting it as a list. > > What exactly do you mean by "Scheme considers it..."? The "read" part of > the read-eval-print loop has never heard of an "application expression"; it > converts a string into (to a first approximation) a list. Only the "eval" > part considers it an application expression. > Usually, the input is read and parsed resulting in a parse tree. In this parse tree, ((quote yes) (quote no)) is an application expression. This all occurs *before* eval comes into the picture. So, that explains what I mean by "considers it." You may argue that a parse tree can beimplemented using lists, but that representation (or any other) is inconsequential as to what ((quote yes) (quote no)) is. It is an application expression and it is not a list which would require a quote. -- Cheers, Marco From sbloch at adelphi.edu Fri Jul 10 14:37:37 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Fri Jul 10 14:38:14 2009 Subject: [plt-scheme] Why isn't the car of a list of symbols a symbol? In-Reply-To: <9b1fff280907101033n51b7abc7ia9bb2448622d5e70@mail.gmail.com> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <990e0c030907091252i106bca28w9cebfad46113278f@mail.gmail.com> <756daca50907091307q53feb3efyd5bb022c56ae0851@mail.gmail.com> <990e0c030907091318v25bd506ah25e4557ebbefddf7@mail.gmail.com> <932b2f1f0907091321m3a28f20cpcbaf33314ff77910@mail.gmail.com> <9b1fff280907091653g667f37b7x4b51053905794435@mail.gmail.com> <9b1fff280907100642q18251842o6d1ffb3e83accd6d@mail.gmail.com> <9b1fff280907101033n51b7abc7ia9bb2448622d5e70@mail.gmail.com> Message-ID: <6F5603D3-B179-4096-9993-7C8088800C15@adelphi.edu> On Jul 10, 2009, at 1:33 PM, Marco Morazan wrote: > IMHO, calling ((quote yes) (quote no)) a list is confusing for > beginning students. You can not use it as a list in a program unless > you slap with an annotation (i.e. a quote). So, in a program you argue > it is an application expression and everywhere else students must > consider it a list? No. When you type it in, it's ALWAYS a list. When you evaluate it (whether at the top level or as an argument to an ordinary function), the list is evaluated by the function-evaluation rule. If you want to use it without evaluation in a context where it would normally be evaluated, you slap a quote on it to prevent evaluation. > Frankly, that is adding an unnecessary level of complexity. We > should not have to imagine a repl without the e. Well, no, we don't HAVE to, but that struck me as a nice simple way to understand the difference between syntax and semantics, between an expression and its value. Do you really find it simpler to think of read, eval, and print as inextricably linked? >> No question: Scheme syntax says it's a list (or, technically, a >> syntax >> object, i.e. a list with decorations). > > I have not reviewed the parser used by DrScheme, but I would be very > surprised if ((quote yes) (quote no)) is parsed as a list. In every > parser I have ever written and seen it would parse as an application > expression. That is, the concrete syntax may have it look like a list, > but in the abstract syntax and in reality it is not a list. Yes, in reality (in the current implementation of DrScheme) it is a syntax object. But that's just an implementation detail. Scheme COULD be implemented (and I think some of the early Lisps WERE implemented) by parsing it as a list and writing "eval" to handle lists in such-and-such a way. What any particular modern implementation actually does (AFAIK) is just an elaboration on this, adding some decorations to support error-reporting, optimizing common cases like function application, etc. >> Absolutely... but let's not equate "an expression" with "the value >> of an >> expression". (* 1 2 3) and (- 10 4) are completely different >> syntactic >> expressions > > Let's not equate an expression with a list. (* 1 2 3) and (- 10 4) are > both application expressions. That is, they form instances of the same > syntactic category. One *could* use a list to represent them > internally, but that is usually not the case. In any case, in a Scheme > *program* they are application expressions regardless of how they are > represented internally. If I read this correctly, you're saying that "application expression" is a sub-type of syntax object. OK, I'll buy that, as an implementation detail. But naming it an "application expression" doesn't necessarily mean anything will ever be applied to anything else, so it's sort of a misleading name. >>> In the two student languages you mention when you ask what is >>> ((quote >>> yes) (quote no)), you can see that Scheme considers it an >>> application >>> expression. It is the *human* interpreter that introduces >>> ambiguity by >>> interpreting it as a list. >> >> What exactly do you mean by "Scheme considers it..."? The "read" >> part of >> the read-eval-print loop has never heard of an "application >> expression"; it >> converts a string into (to a first approximation) a list. Only >> the "eval" >> part considers it an application expression. >> > > Usually, the input is read and parsed resulting in a parse tree. In > this parse tree, ((quote yes) (quote no)) is an application > expression. This all occurs *before* eval comes into the picture. So, > that explains what I mean by "considers it." But if you think of "application expression" as a purely syntactic construct, before eval comes into the picture, then there's nothing wrong with the application of (quote yes) to (quote no); it's just as good an application expression as applying sqrt to 3, or (lambda (x) (+ x 2)) to 5. The error messages you quoted before came from eval, not from the reader, so they don't tell me anything about what the input "is", only what happens to it on evaluation. I'm not sure what distinction you're drawing between a list and an application-expression. What difference does it make whether a node in a parse tree refers to its two subtrees as "function" and "arglist" or as "car" and "cdr"? > You may argue that a > parse tree can beimplemented using lists, but that representation (or > any other) is inconsequential as to what ((quote > yes) (quote no)) is. It is an application expression and it is not a > list which would require a quote. I think you've defined lists out of existence. How do you write a list? The easiest way is as '(a b c), which is an abbreviation for (quote (a b c)), which is (syntactically) an application expression, not a list. In fact, I can't think of ANYTHING that is still a (non- empty) list rather than an application expression under this definition. Or are you instead treating '(a b c) as a literal of type "list", and (quote (a b c)) as an application expression that evaluates to it? I guess somebody could implement a Scheme that way; I don't know whether DrScheme is in fact implemented that way. It strikes me as an unnecessary complication. Stephen Bloch sbloch@adelphi.edu From jmarshall at alum.mit.edu Fri Jul 10 14:42:27 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Fri Jul 10 14:43:07 2009 Subject: [plt-scheme] Why isn't the car of a list of symbols a symbol? In-Reply-To: <9b1fff280907101033n51b7abc7ia9bb2448622d5e70@mail.gmail.com> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <756daca50907091307q53feb3efyd5bb022c56ae0851@mail.gmail.com> <990e0c030907091318v25bd506ah25e4557ebbefddf7@mail.gmail.com> <932b2f1f0907091321m3a28f20cpcbaf33314ff77910@mail.gmail.com> <9b1fff280907091653g667f37b7x4b51053905794435@mail.gmail.com> <9b1fff280907100642q18251842o6d1ffb3e83accd6d@mail.gmail.com> <9b1fff280907101033n51b7abc7ia9bb2448622d5e70@mail.gmail.com> Message-ID: On Fri, Jul 10, 2009 at 10:33 AM, Marco Morazan wrote: > > Let's not equate an expression with a list. Well, you pretty much have to consider expressions as a subset of lists because large parts of the standard (both R5 and R6) depend on this. I quote from R6RS: Syntactic data (also called external representations) double as a notation for objects, and Scheme?s (rnrs io ports (6)) library (library section 8.2) provides the get-datum and put-datum procedures for reading and writing syntactic data, converting between their textual representation and the corresponding objects. Each syntactic datum represents a corresponding datum value. A syntactic datum can be used in a program to obtain the corresponding datum value using quote (see section 11.4.1). Scheme source code consists of syntactic data and (nonsignificant) comments. Syntactic data in Scheme source code are called forms. (A form nested inside another form is called a subform.) Consequently, Scheme?s syntax has the property that any sequence of characters that is a form is also a syntactic datum representing some object. This can lead to confusion, since it may not be obvious out of context whether a given sequence of characters is intended to be a representation of objects or the text of a program. I quote from R5RS: Note that the sequence of characters "(+ 2 6)" is not an external representation of the integer 8, even though it is an expression evaluating to the integer 8; rather, it is an external representation of a three-element list, the elements of which are the symbol + and the integers 2 and 6. Scheme's syntax has the property that any sequence of characters that is an expression is also the external representation of some object. This can lead to confusion, since it may not be obvious out of context whether a given sequence of characters is intended to denote data or program, End quotes. Obviously, there are some here that wish to insist that *all* sequences of characters is intended to exclusively denote programs. Some of us here make use of contextual wording such as `evaluates to' or `produces' to indicate that we're talking about a program fragment and `is' or `represents' to indicate that we're talking about data. I don't think anyone here has taken the stand that *all* sequences of characters must exclusively denote data (how would you write a program?) While I understand the allure of wanting to avoid the `confusion' mentioned in the standard, one cannot consistently maintain that view in light of the existence of `read' and `write'. > (* 1 2 3) and (- 10 4) are both application expressions. > (list? (read (open-input-string "(* 1 2 3)"))) #t The first is evidently a list. > (car (read (open-input-string "(* 1 2 3)"))) * > (symbol? (car (read (open-input-string "(* 1 2 3)")))) #t It is a symbol. > (eq? (car (read (open-input-string "(* 1 2 3)"))) *) #f It is *not* the multiply procedure. > > Usually, the input is read and parsed resulting in a parse tree. In > this parse tree, ((quote yes) (quote no)) is an application > expression. This all occurs *before* eval comes into the picture. This returns a list, not a parse tree: (read (open-input-string "((quote yes)(quote no))")) Eval can take a list argument: (eval (read (open-input-string "(+ 2 3)"))) => 5 By `parse tree' I refer to what is called in section 4 `program syntax', *not* what is called `datum syntax'. Since the program syntax did not exist until eval was called, eval must have constructed it. We can see that read does not construct program syntax: (read (open-input-string "(lambda () lambda if if)")) This cannot return a program under the standard meaning of lambda and if, yet read gives no error. -- ~jrm From sk at cs.brown.edu Fri Jul 10 15:33:15 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Fri Jul 10 15:33:59 2009 Subject: [plt-scheme] Handbells for the 21st Century Message-ID: http://www.youtube.com/watch?v=WMYLJUKMPbA Yes, those are Android G1's. Programmed in Scheme, using the Moby Scheme compiler. Thanks to Kathi, Danny, Ethan, and Lyla. Shriram From rafkind at cs.utah.edu Fri Jul 10 15:37:31 2009 From: rafkind at cs.utah.edu (Jon Rafkind) Date: Fri Jul 10 15:38:00 2009 Subject: [plt-scheme] Handbells for the 21st Century In-Reply-To: References: Message-ID: <4A57987B.7030008@cs.utah.edu> Shriram Krishnamurthi wrote: > http://www.youtube.com/watch?v=WMYLJUKMPbA > > Yes, those are Android G1's. > > Programmed in Scheme, using the Moby Scheme compiler. > > Thanks to Kathi, Danny, Ethan, and Lyla. > > thats neat. so what's making the sounds? the phones? was it as "simple" as "detect motion, play note" ? From sk at cs.brown.edu Fri Jul 10 15:43:43 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Fri Jul 10 15:44:22 2009 Subject: [plt-scheme] Handbells for the 21st Century In-Reply-To: <4A57987B.7030008@cs.utah.edu> References: <4A57987B.7030008@cs.utah.edu> Message-ID: The notes are pre-loaded. As for the rest, you're right on. It tests three things: - ability to detect motion - ability to play a note using effects - our JavaScript/HTML/CSS i/o interface (for selecting the note) Our style of combining effects with World is similar but not identical to Matthias's style in Universe. But ultimately, yes, that's what it is: detect motion, play note. Shriram From toddobryan at gmail.com Fri Jul 10 15:45:20 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Fri Jul 10 15:45:41 2009 Subject: [plt-scheme] Handbells for the 21st Century In-Reply-To: <4A57987B.7030008@cs.utah.edu> References: <4A57987B.7030008@cs.utah.edu> Message-ID: <904774730907101245o6cc60f81yb53b63e6e36c1b2@mail.gmail.com> Aren't we worried about our reputations, here? Aren't handbells just about *the* only thing geekier than programming? Call me back when you can really play air guitar... :-) But seriously, I have a G1, so I'm really interested. Will the Boston workshop have an optional session on Moby? Todd On Fri, Jul 10, 2009 at 3:37 PM, Jon Rafkind wrote: > Shriram Krishnamurthi wrote: > >> http://www.youtube.com/watch?v=WMYLJUKMPbA >> >> Yes, those are Android G1's. >> >> Programmed in Scheme, using the Moby Scheme compiler. >> >> Thanks to Kathi, Danny, Ethan, and Lyla. >> >> >> > thats neat. so what's making the sounds? the phones? > > was it as "simple" as "detect motion, play note" ? > > _________________________________________________ > 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/20090710/79f8df4f/attachment.htm From morazanm at gmail.com Fri Jul 10 16:08:46 2009 From: morazanm at gmail.com (Marco Morazan) Date: Fri Jul 10 16:09:07 2009 Subject: [plt-scheme] Why isn't the car of a list of symbols a symbol? In-Reply-To: <6F5603D3-B179-4096-9993-7C8088800C15@adelphi.edu> References: <756daca50907070636w6c7b26fbkf222c3ed9f2d3ba@mail.gmail.com> <990e0c030907091318v25bd506ah25e4557ebbefddf7@mail.gmail.com> <932b2f1f0907091321m3a28f20cpcbaf33314ff77910@mail.gmail.com> <9b1fff280907091653g667f37b7x4b51053905794435@mail.gmail.com> <9b1fff280907100642q18251842o6d1ffb3e83accd6d@mail.gmail.com> <9b1fff280907101033n51b7abc7ia9bb2448622d5e70@mail.gmail.com> <6F5603D3-B179-4096-9993-7C8088800C15@adelphi.edu> Message-ID: <9b1fff280907101308p2e212a83pc1fe48fe4715d877@mail.gmail.com> > > Or are you instead treating '(a b c) as a literal of type "list", and (quote > (a b c)) as an application expression that evaluates to it? ?I guess > somebody could implement a Scheme that way; I don't know whether DrScheme is > in fact implemented that way. ?It strikes me as an unnecessary complication. I see where the confusion is now. (quote (a b c)) is not an application expression just like (cond ((zero? x) 5) (else 2))) is also not an application expression. Neither quote nor cond (nor check-expect for that matter) are functions. They are used to signal syntactic forms. We do not say that we apply quote to (a b c) just like we don't say that we apply cond to ((zero? x) 5) (else 2)). We also do not apply ' to (a b c). (a b c) represents: a applied to b and c (notice no quotes on a, b, and c). '(a b c) and (quote (a b c)) are equivalent to (list 'a 'b 'c) (notice the quotes on a, b, and c). If you tell your students that (a b c) is a list, then how can they tell that list apart from the expression that applies a to b and c? I do not enjoy being obscure, but what would you tell students about a line of code like this: ((a b c) '(a b c)) ? In any case, we have discussed this way too much. I am not going to convince you that ((quote yes) (quote no)) is an application expression (which when evaluated, of course, will give you the error that 'yes is not a function). FWIW, a lightbulb goes off in my student's head when it finally clicks that expressions like ((quote yes) (quote no)) are applications and not lists. It takes time for them to digest the difference between ((quote yes) (quote no)) and '((quote yes) (quote no)) in their programs. That, however, is just my experience. -- Cheers, Marco From jev at me.com Fri Jul 10 14:53:32 2009 From: jev at me.com (Jaime Vargas) Date: Fri Jul 10 16:34:30 2009 Subject: [plt-scheme] Scheme tutorials at DEFUN 2009 In-Reply-To: References: Message-ID: <8BA15F51-198C-4662-A334-EBFD05D60F93@me.com> Are these sessions going to be recorded, even in an amateur and unofficial way? On Jul 10, 2009, at 7:10 AM, Noel Welsh wrote: > Hi all, > > There are three Scheme tutorials (on DSLs, web programming, and > embedded programming) as part of DEFUN 2009. If you can get to > Edinburgh between Sept 3 and Sept 5 I strongly encourage attendance -- > these tutorials look really good. Full schedule is here: > > http://www.defun2009.info/blog/tutorial-schedule/ > > N. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jay.mccarthy at gmail.com Fri Jul 10 16:36:22 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Fri Jul 10 16:36:43 2009 Subject: [plt-scheme] Scheme tutorials at DEFUN 2009 In-Reply-To: <8BA15F51-198C-4662-A334-EBFD05D60F93@me.com> References: <8BA15F51-198C-4662-A334-EBFD05D60F93@me.com> Message-ID: They haven't told us/me. Jay On Fri, Jul 10, 2009 at 12:53 PM, Jaime Vargas wrote: > Are these sessions going to be recorded, even in an amateur and unofficial > way? > > On Jul 10, 2009, at 7:10 AM, Noel Welsh wrote: > >> Hi all, >> >> There are three Scheme tutorials (on DSLs, web programming, and >> embedded programming) as part of DEFUN 2009. If you can get to >> Edinburgh between Sept 3 and Sept 5 I strongly encourage attendance -- >> these tutorials look really good. Full schedule is here: >> >> http://www.defun2009.info/blog/tutorial-schedule/ >> >> N. >> _________________________________________________ >> 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 > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From sk at cs.brown.edu Fri Jul 10 17:36:24 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Fri Jul 10 17:44:26 2009 Subject: [plt-scheme] Handbells for the 21st Century In-Reply-To: <904774730907101245o6cc60f81yb53b63e6e36c1b2@mail.gmail.com> References: <4A57987B.7030008@cs.utah.edu> <904774730907101245o6cc60f81yb53b63e6e36c1b2@mail.gmail.com> Message-ID: Maybe for those who ask nicely. (-: Shriram On Fri, Jul 10, 2009 at 3:45 PM, Todd O'Bryan wrote: > Aren't we worried about our reputations, here? Aren't handbells just about > *the* only thing geekier than programming? Call me back when you can really > play air guitar... :-) > > But seriously, I have a G1, so I'm really interested. Will the Boston > workshop have an optional session on Moby? > > Todd > > On Fri, Jul 10, 2009 at 3:37 PM, Jon Rafkind wrote: >> >> Shriram Krishnamurthi wrote: >>> >>> http://www.youtube.com/watch?v=WMYLJUKMPbA >>> >>> Yes, those are Android G1's. >>> >>> Programmed in Scheme, using the Moby Scheme compiler. >>> >>> Thanks to Kathi, Danny, Ethan, and Lyla. >>> >>> >> >> thats neat. so what's making the sounds? the phones? >> >> was it as "simple" as "detect motion, play note" ? >> _________________________________________________ >> ?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 cobbe at ccs.neu.edu Fri Jul 10 18:16:05 2009 From: cobbe at ccs.neu.edu (Richard Cobbe) Date: Fri Jul 10 18:16:28 2009 Subject: [plt-scheme] how to disallow struct-copy on a particular structure type? Message-ID: <20090710221605.GA15373@angua.local> I'm writing a module that defines and exports a structure, but it does *not* export the default `make-foo' function. (The structure has 7 fields, and not all combinations of values for those fields are legal, so I'm exporting a wrapped version of the constructor that does validity checking instead.) Is there a way to prevent clients from using struct-copy on this particular structure (and thus circumventing the validity checks)? I know I could simply not provide the main structure binding (i.e., `foo' for `(define-struct foo (...))'), but that would also prevent clients from using `match' on this kind of structure, which is too restrictive. Thanks, Richard From carl.eastlund at gmail.com Fri Jul 10 18:23:40 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Fri Jul 10 18:24:20 2009 Subject: [plt-scheme] how to disallow struct-copy on a particular structure type? In-Reply-To: <20090710221605.GA15373@angua.local> References: <20090710221605.GA15373@angua.local> Message-ID: <990e0c030907101523jdb92be4ka65acacbed6fe1a3@mail.gmail.com> On Fri, Jul 10, 2009 at 6:16 PM, Richard Cobbe wrote: > I'm writing a module that defines and exports a structure, but it does > *not* export the default `make-foo' function. ?(The structure has 7 fields, > and not all combinations of values for those fields are legal, so I'm > exporting a wrapped version of the constructor that does validity checking > instead.) > > Is there a way to prevent clients from using struct-copy on this particular > structure (and thus circumventing the validity checks)? ?I know I could > simply not provide the main structure binding (i.e., `foo' for > `(define-struct foo (...))'), but that would also prevent clients from > using `match' on this kind of structure, which is too restrictive. > > Thanks, > > Richard Interesting problem. I don't know if there's a way to solve it directly. Here are a couple workarounds that pop to mind: One, you might hide 'foo', but export a match-expander ($foo or something similar) to make up for the lack of ordinary struct matching. Two, you might construct two structure types: parent type foo (with all the fields you need) and child type bar (with no additional fields). Define all your functions to work with bar, and have bar in their contracts, but export the foo structure name. Matches and selectors and predicates for foo will all work on the bar values, but anything the user constructs (via struct-copy or whatever else) will not be acceptable to your bar functions. Neither of these are perfect, but I don't know that there's any facility for what you describe. Personally I'd really like to see some API for controlling what's provided in those struct identifiers, for just this kind of use case. --Carl From tom at zwizwa.be Sun Jul 12 06:13:13 2009 From: tom at zwizwa.be (Tom Schouten) Date: Sun Jul 12 06:40:38 2009 Subject: [plt-scheme] interrupting make-module-evaluator Message-ID: <20090712101313.GA27266@giebrok.zwizwa.be> Hello, Say you have a module which takes a while to instantiate using "make-module-evaluator" from scheme/sandbox. How would you make it possible to interrupt the instantiation? Obviously "kill-evaluator" or "break-evaluator" won't work yet since there is no value to apply them to, and other attempts to kill it seem to fail: (define e #f) (define t (thread (lambda () (set! e (make-module-evaluator '(module foo scheme/base (let x () (x)))))))) # (kill-thread t) kill-thread: the current custodian does not solely manage the specified thread: # This seems to leave the instantiation still running in the background (judging from "top"). # (break-thread t) However, hitting ctrl-c when evaluating the following does seem to stop the instantiation. # (make-module-evaluator '(module foo scheme/base (let x () (x)))) This is in v4.2.0.5 [3m] from svn 15326 2009-06-29 09:50:11 Any ideas? Cheers, Tom From cobbe at ccs.neu.edu Sun Jul 12 12:48:05 2009 From: cobbe at ccs.neu.edu (Richard Cobbe) Date: Sun Jul 12 12:48:26 2009 Subject: [plt-scheme] how to disallow struct-copy on a particular structure type? In-Reply-To: <990e0c030907101523jdb92be4ka65acacbed6fe1a3@mail.gmail.com> References: <20090710221605.GA15373@angua.local> <990e0c030907101523jdb92be4ka65acacbed6fe1a3@mail.gmail.com> Message-ID: <20090712164805.GA1486@perdita.local> On Fri, Jul 10, 2009 at 06:23:40PM -0400, Carl Eastlund wrote: > On Fri, Jul 10, 2009 at 6:16 PM, Richard Cobbe wrote: > > I'm writing a module that defines and exports a structure, but it does > > *not* export the default `make-foo' function. ?(The structure has 7 fields, > > and not all combinations of values for those fields are legal, so I'm > > exporting a wrapped version of the constructor that does validity checking > > instead.) > > > > Is there a way to prevent clients from using struct-copy on this particular > > structure (and thus circumventing the validity checks)? ?I know I could > > simply not provide the main structure binding (i.e., `foo' for > > `(define-struct foo (...))'), but that would also prevent clients from > > using `match' on this kind of structure, which is too restrictive. > > > > Thanks, > > > > Richard > > Interesting problem. I don't know if there's a way to solve it > directly. Here are a couple workarounds that pop to mind: > > One, you might hide 'foo', but export a match-expander ($foo or > something similar) to make up for the lack of ordinary struct > matching. Oh yeah -- didn't think about that. And I even wrote a planet package that would make this trivial. > Two, you might construct two structure types: parent type foo (with > all the fields you need) and child type bar (with no additional > fields). Define all your functions to work with bar, and have bar in > their contracts, but export the foo structure name. Matches and > selectors and predicates for foo will all work on the bar values, but > anything the user constructs (via struct-copy or whatever else) will > not be acceptable to your bar functions. I'll have to think about this -- this may be the best solution, not least because `struct-copy' doesn't allow you to change inherited fields (at least, not the last time I looked). > Neither of these are perfect, but I don't know that there's any > facility for what you describe. Personally I'd really like to see > some API for controlling what's provided in those struct identifiers, > for just this kind of use case. That would indeed be nice. Thanks, Richard From acowley at seas.upenn.edu Sun Jul 12 17:11:00 2009 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Sun Jul 12 17:17:45 2009 Subject: [plt-scheme] Macro expanding into define-values/invoke-unit? Message-ID: <81addec70907121411q3da9d811sdeb7079e74d0a637@mail.gmail.com> How can I get a macro to expand into a (define-values/invoke-unit ...) form? That is, I have a macro that constructs syntax that looks correct, but is left unexpanded before the rest of the module containing my macro invocation is expanded. I think the below demonstrates the issue. When run, the module produces the value 9, but if the "Works!" line is commented out, while the following line is uncommented, then "bar" is an unbound identifier. In my case, my macro lives in another module, so if there are some phase gymnastics needed, that would be fine, but I haven't been able to discover them yet. Thanks, Anthony #lang scheme (define-signature foo^ (bar)) (define-unit foo@ (import) (export foo^) (define (bar x) (* x x))) (define-syntax mkfoo (syntax-rules () [(_ x) (define-values/invoke-unit x (import) (export foo^))])) (define-values/invoke-unit foo@ (import) (export foo^)) ; Works! ;(mkfoo foo@) ; Doesn't work! (bar 3) From jensaxel at soegaard.net Sun Jul 12 17:44:30 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Sun Jul 12 17:45:02 2009 Subject: [plt-scheme] Embedding MzScheme on Mac OS X Message-ID: <4072c51f0907121444h6de8bb36u5726a776b6b7d5cc@mail.gmail.com> Hi All, I need help figuring out the correct compiler switched for embedding mzscheme in a C application on Mac OS 10.5. I succeeded in compiling the example code in http://docs.plt-scheme.org/inside/overview.html#(part._embedding) but running the result was disappointing. Hopefully I have missed something obvious - but what? The mysterios ./pltcur is a symbolic link to /Applications/PLT\ Scheme\ Full\ v4.2.0.2/ . jasmacair:mzc-experiment jensaxelsoegaard$ /Applications/PLT\ Scheme\ Full\ v4.2.0.2/bin/mzc --c-mods modules.c ++lib scheme/base jas: mzc-experiment jensaxelsoegaard$ gcc -L./pltcur/lib/ -I./pltcur/include/ -F./pltcur/lib/ -framework PLT_MzScheme -lmzscheme -lmzgc embedded.c jas: mzc-experiment jensaxelsoegaard$ export DYLD_FRAMEWORK_PATH=/Applications/PLT\ Scheme\ Full\ v4.2.0.2/lib/ jas: mzc-experiment jensaxelsoegaard$ ./a.out "1" Seg fault (internal error) at 0x87 Bus error jas: mzc-experiment jensaxelsoegaard$ ./a.out 1 Seg fault (internal error) at 0x87 Bus error jas: mzc-experiment jensaxelsoegaard$ cat embedded.c #include "scheme.h" #include "modules.c" static int run(Scheme_Env *e, int argc, char *argv[]) { Scheme_Object *curout; int i; mz_jmp_buf * volatile save, fresh; /* Declare embedded modules in "modules.c": */ declare_modules(e); scheme_namespace_require(scheme_intern_symbol("scheme/base")); curout = scheme_get_param(scheme_current_config(), MZCONFIG_OUTPUT_PORT); for (i = 1; i < argc; i++) { save = scheme_current_thread->error_buf; scheme_current_thread->error_buf = &fresh; if (scheme_setjmp(scheme_error_buf)) { scheme_current_thread->error_buf = save; return -1; /* There was an error */ } else { Scheme_Object *v, *a[2]; v = scheme_eval_string(argv[i], e); scheme_display(v, curout); scheme_display(scheme_make_char('\n'), curout); /* read-eval-print loop, uses initial Scheme_Env: */ a[0] = scheme_intern_symbol("scheme/base"); a[1] = scheme_intern_symbol("read-eval-print-loop"); scheme_apply(scheme_dynamic_require(2, a), 0, NULL); scheme_current_thread->error_buf = save; } } return 0; } int main(int argc, char *argv[]) { return scheme_main_setup(1, run, argc, argv); } -- Jens Axel S?gaard -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090712/03213a59/attachment.html From rafkind at cs.utah.edu Sun Jul 12 19:33:35 2009 From: rafkind at cs.utah.edu (Jon Rafkind) Date: Sun Jul 12 19:33:56 2009 Subject: [plt-scheme] Macro expanding into define-values/invoke-unit? In-Reply-To: <81addec70907121411q3da9d811sdeb7079e74d0a637@mail.gmail.com> References: <81addec70907121411q3da9d811sdeb7079e74d0a637@mail.gmail.com> Message-ID: <4A5A72CF.8070506@cs.utah.edu> Anthony Cowley wrote: > How can I get a macro to expand into a (define-values/invoke-unit ...) > form? That is, I have a macro that constructs syntax that looks > correct, but is left unexpanded before the rest of the module > containing my macro invocation is expanded. I think the below > demonstrates the issue. When run, the module produces the value 9, but > if the "Works!" line is commented out, while the following line is > uncommented, then "bar" is an unbound identifier. In my case, my macro > lives in another module, so if there are some phase gymnastics needed, > that would be fine, but I haven't been able to discover them yet. > > Thanks, > Anthony > > #lang scheme > > (define-signature foo^ (bar)) > > (define-unit foo@ > (import) > (export foo^) > (define (bar x) (* x x))) > > (define-syntax mkfoo > (syntax-rules () > [(_ x) (define-values/invoke-unit x (import) (export foo^))])) > > > (define-values/invoke-unit foo@ (import) (export foo^)) ; Works! > ;(mkfoo foo@) ; Doesn't work! > > (bar 3) > Ah, I remember this error. The workaround I found was to use `syntax-local-introduce' which basically says "the expanded syntax is not completely different from the syntax at the invocation site of the macro" (define-syntax (mkfoo stx) (syntax-case stx () [(_ x) (syntax-local-introduce #'(define-values/invoke-unit x (import) (export foo^)))])) The reason you need this is new identifiers produced inside the macro `mkfoo' have a syntax mark that makes them different from identifiers outside the macro. Consider this simple example: (define-syntax blah (syntax-rules () [(_) (define foo 2)])) (blah) foo This doesn't work because the `foo' outside the macro is not the same as the `foo' inside the macro. From acowley at seas.upenn.edu Sun Jul 12 19:52:20 2009 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Sun Jul 12 19:52:40 2009 Subject: [plt-scheme] Macro expanding into define-values/invoke-unit? In-Reply-To: <4A5A72CF.8070506@cs.utah.edu> References: <81addec70907121411q3da9d811sdeb7079e74d0a637@mail.gmail.com> <4A5A72CF.8070506@cs.utah.edu> Message-ID: <81addec70907121652x5e30b4efl67c97132444eb59c@mail.gmail.com> On Sun, Jul 12, 2009 at 7:33 PM, Jon Rafkind wrote: > > Ah, I remember this error. The workaround I found was to use > `syntax-local-introduce' which basically says "the expanded syntax is not > completely different from the syntax at the invocation site of the macro" Thank you so much, Jon! The explanation was perfect, too. I was staring at the macro stepper's output, and just knew that my problem was with where the define/values bindings were happening, but didn't see exactly what was happening. Anthony From czhu at cs.utah.edu Sun Jul 12 20:52:47 2009 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Sun Jul 12 20:53:19 2009 Subject: [plt-scheme] Macro expanding into define-values/invoke-unit? In-Reply-To: <81addec70907121411q3da9d811sdeb7079e74d0a637@mail.gmail.com> References: <81addec70907121411q3da9d811sdeb7079e74d0a637@mail.gmail.com> Message-ID: <4A5A855F.5000602@cs.utah.edu> This is because of hygiene and the way define-values/invoke-unit introduces bindings (it inherits the lexical information of either itself or it's arguments). I don't have time to look into the way define-values/invoke-unit expands now, but a quick solution works: #lang scheme (define-signature foo^ (bar)) (define-unit foo@ (import) (export foo^) (define (bar x) (* x x))) (define-syntax (mkfoo stx) (syntax-case stx () [(_ x) (datum->syntax #'x `(define-values/invoke-unit ,#'x (import) (export foo^)))])) (mkfoo foo@) (bar 3) - Chongkai Anthony Cowley wrote: > How can I get a macro to expand into a (define-values/invoke-unit ...) > form? That is, I have a macro that constructs syntax that looks > correct, but is left unexpanded before the rest of the module > containing my macro invocation is expanded. I think the below > demonstrates the issue. When run, the module produces the value 9, but > if the "Works!" line is commented out, while the following line is > uncommented, then "bar" is an unbound identifier. In my case, my macro > lives in another module, so if there are some phase gymnastics needed, > that would be fine, but I haven't been able to discover them yet. > > Thanks, > Anthony > > #lang scheme > > (define-signature foo^ (bar)) > > (define-unit foo@ > (import) > (export foo^) > (define (bar x) (* x x))) > > (define-syntax mkfoo > (syntax-rules () > [(_ x) (define-values/invoke-unit x (import) (export foo^))])) > > > (define-values/invoke-unit foo@ (import) (export foo^)) ; Works! > ;(mkfoo foo@) ; Doesn't work! > > (bar 3) > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From icfp.publicity at googlemail.com Sun Jul 12 22:45:26 2009 From: icfp.publicity at googlemail.com (Matthew Fluet (ICFP Publicity Chair)) Date: Sun Jul 12 22:45:51 2009 Subject: [plt-scheme] ICFP09 Final Call for Participation Message-ID: <53ff55480907121945lb55ff63p79b1e0c3e282b296@mail.gmail.com> ===================================================================== Final Call for Participation The 14th ACM SIGPLAN International Conference on Functional Programming (ICFP 2009) http://www.cs.nott.ac.uk/~gmh/icfp09.html Edinburgh, Scotland, 31 August - 2 September 2009 ===================================================================== ***** Accommodation Deadline: July 20, 2009 ***** Due to the overlap with Edinburgh Festival, accommodations may be difficult to secure after the deadline. Reserve now! http://www.haskell.org/haskellwiki/ICFP_2009_Local_Arrangements ***** Early Registration Deadline: July 30, 2009 ***** http://www.regmaster.com/conf/icfp2009.html ICFP 2009 provides a forum for researchers and developers to hear about the latest work on the design, implementations, principles, and uses of functional programming. The conference covers the entire spectrum of work, from practice to theory, including its peripheries. Preliminary program: * Abstracts: + http://web.cecs.pdx.edu/~apt/icfp09_accepted_papers/accepted.html * Schedule: + http://web.cecs.pdx.edu/~apt/icfp09_preliminary_program.pdf * Invited speakers: + Guy Steele -- Organizing Functional Code for Parallel Execution: or, foldl and foldr Considered Slightly Harmful + Benjamin Pierce -- Lambda, the Ultimate TA: Using a Proof Assistant to Teach Programming Language Foundations + Dan Piponi -- Commutative Monads, Diagrams and Knots Schedule including related workshops: * Aug 30: ACM SIGPLAN Workshop on ML * Aug 30: ACM SIGPLAN Workshop on Generic Programming * Aug 31-Sep 2: ICFP09 * Sep 3: ACM SIGPLAN Haskell Symposium * Sep 3: ACM SIGPLAN Developer Tracks on Functional Programming * Sep 4: Commercial Users of Functional Programming * Sep 4: ACM SIGPLAN Workshop on Mechanizing Metatheory * Sep 4: ACM SIGPLAN Workshop on Approaches and Applications of Inductive Programming * Sep 5: ACM SIGPLAN Erlang Workshop * Sep 5: ACM SIGPLAN Developer Tracks on Functional Programming * Sep 5: ACM SIGPLAN Haskell Implementors Workshop Conference organizers: * General Chair: Graham Hutton (University of Nottingham) * Program Chair: Andrew Tolmach (Portland State University) * Local Arrangements Chairs: Philip Wadler (University of Edinburgh), Kevin Hammond (University of St Andrews), and Gregory Michaelson (Heriot-Watt University) * Workshop Co-Chairs: Christopher Stone (Harvey Mudd College), and Michael Sperber (DeinProgramm) * Programming Contest Chair: Andrew Gill (University of Kansas) * Publicity Chair: Matthew Fluet (Toyota Technological Institute at Chicago) From mflatt at cs.utah.edu Sun Jul 12 22:46:50 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sun Jul 12 22:47:47 2009 Subject: [plt-scheme] Embedding MzScheme on Mac OS X In-Reply-To: <4072c51f0907121444h6de8bb36u5726a776b6b7d5cc@mail.gmail.com> References: <4072c51f0907121444h6de8bb36u5726a776b6b7d5cc@mail.gmail.com> Message-ID: <20090713024726.7D2776500BE@mail-svr1.cs.utah.edu> At Sun, 12 Jul 2009 23:44:30 +0200, Jens Axel S?gaard wrote: > Hopefully I have missed something obvious - but what? The Mac frameworks are set up for 3m linking, but I think you mean to use the CGC frameworks. The simplest solution is to redirect the "PLT_MzScheme" soft link within "PLT_MzScheme.framework" to the non-"_3m" version, instead of the "_3m" version. From mflatt at cs.utah.edu Sun Jul 12 22:57:48 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sun Jul 12 22:58:52 2009 Subject: [plt-scheme] Macro expanding into define-values/invoke-unit? In-Reply-To: <81addec70907121411q3da9d811sdeb7079e74d0a637@mail.gmail.com> References: <81addec70907121411q3da9d811sdeb7079e74d0a637@mail.gmail.com> Message-ID: <20090713025819.A17986500BE@mail-svr1.cs.utah.edu> The `foo^' signature introduced by the macro acts like a binding identifier introduced by a macro: It doesn't bind other identifiers unless they are introduced by the same macro expansion. One solution is to provide the signature name, so that it isn't introduced by the macro: (define-syntax mkfoo (syntax-rules () [(_ x foo^) (define-values/invoke-unit x (import) (export foo^))])) (mkfoo foo@ foo^) At Sun, 12 Jul 2009 17:11:00 -0400, Anthony Cowley wrote: > How can I get a macro to expand into a (define-values/invoke-unit ...) > form? That is, I have a macro that constructs syntax that looks > correct, but is left unexpanded before the rest of the module > containing my macro invocation is expanded. I think the below > demonstrates the issue. When run, the module produces the value 9, but > if the "Works!" line is commented out, while the following line is > uncommented, then "bar" is an unbound identifier. In my case, my macro > lives in another module, so if there are some phase gymnastics needed, > that would be fine, but I haven't been able to discover them yet. > > Thanks, > Anthony > > #lang scheme > > (define-signature foo^ (bar)) > > (define-unit foo@ > (import) > (export foo^) > (define (bar x) (* x x))) > > (define-syntax mkfoo > (syntax-rules () > [(_ x) (define-values/invoke-unit x (import) (export foo^))])) > > > (define-values/invoke-unit foo@ (import) (export foo^)) ; Works! > ;(mkfoo foo@) ; Doesn't work! > > (bar 3) > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From ryanc at ccs.neu.edu Mon Jul 13 00:54:21 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Mon Jul 13 00:55:00 2009 Subject: [plt-scheme] Macro expanding into define-values/invoke-unit? In-Reply-To: <81addec70907121411q3da9d811sdeb7079e74d0a637@mail.gmail.com> References: <81addec70907121411q3da9d811sdeb7079e74d0a637@mail.gmail.com> Message-ID: <4A5ABDFD.4020308@ccs.neu.edu> Anthony Cowley wrote: > How can I get a macro to expand into a (define-values/invoke-unit ...) > form? That is, I have a macro that constructs syntax that looks > correct, but is left unexpanded before the rest of the module > containing my macro invocation is expanded. I think the below > demonstrates the issue. When run, the module produces the value 9, but > if the "Works!" line is commented out, while the following line is > uncommented, then "bar" is an unbound identifier. In my case, my macro > lives in another module, so if there are some phase gymnastics needed, > that would be fine, but I haven't been able to discover them yet. It's not a phase problem. Those usually manifest as unbound identifier errors. 'define-values/invoke-unit' is an unhygienic binding form; it extracts the names to bind from the signature(s) in the 'export' clause. All unhygienic binding forms must decide what lexical context to apply to the names they bind. For example, 'define-struct' uses the lexical context of the identifier given for the struct name. 'define-values/invoke-unit' seems to use the lexical context from the identifier given as the name of the signature to export. In your case, 'foo^'. Since that's introduced by the 'mkfoo' macro, the binding of 'bar' is also considered "introduced" (it inherits a mark from 'foo^'), which makes it inaccessible to you at the repl. Here's a version of 'mkfoo' that probably works: (define-syntax (mkfoo stx) (syntax-case stx () [(_ x) (with-syntax ([foo^ (syntax-local-introduce #'foo^)]) #'(define-values/invoke-unit x (import) (export foo^)))])) The use of 'syntax-local-introduce' cancels the mark on 'foo^'. A better solution, I think, would be to change 'define-values/invoke-unit' et al to accept an explicit lexical context argument. Ryan From acowley at seas.upenn.edu Mon Jul 13 01:29:21 2009 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Mon Jul 13 01:29:51 2009 Subject: [plt-scheme] Macro expanding into define-values/invoke-unit? In-Reply-To: <20090713025819.A17986500BE@mail-svr1.cs.utah.edu> References: <81addec70907121411q3da9d811sdeb7079e74d0a637@mail.gmail.com> <20090713025819.A17986500BE@mail-svr1.cs.utah.edu> Message-ID: <81addec70907122229l7957e0cdx2316ba30d6e51921@mail.gmail.com> On Sun, Jul 12, 2009 at 10:57 PM, Matthew Flatt wrote: > The `foo^' signature introduced by the macro acts like a binding > identifier introduced by a macro: It doesn't bind other identifiers > unless they are introduced by the same macro expansion. > > One solution is to provide the signature name, so that it isn't > introduced by the macro: > > ?(define-syntax mkfoo > ? (syntax-rules () > ? ? [(_ x foo^) (define-values/invoke-unit x (import) (export foo^))])) > > ?(mkfoo foo@ foo^) Ah, so when the signature is expanded into the identifiers for the define-values form, they are given the lexical context of the signature? This was all an endeavor to trim some slightly verbose unit invocation syntax. When supplying a parameter for a unit, I seem to have several options: In the following examples, our indefatigable unit foo@ requires an input of setup^ and exports foo^... and this email got far too long to bother those who are not interested. I've collected insights from the list into a blog posting here . Thank you all for the help! Anthony From lordgeoffrey at optushome.com.au Mon Jul 13 06:21:48 2009 From: lordgeoffrey at optushome.com.au (LordGeoffrey) Date: Mon Jul 13 06:22:15 2009 Subject: [plt-scheme] cross-module compile problems Message-ID: <4A5B0ABC.90107@optushome.com.au> I am trying to isolate a small block of code that replicates my (or the compiler's) issue. So far not successfully. I am using version 4.2 I have -- module a requires module b module b does (provide (all-defined-out)) It runs fine in the interpreter. But fails to compile. It gives the following error, listed below. "file-name" is the first exported proc that is encountered. >>> projects/scheme/itemizer/a.scm:28:7: compile: unbound identifier in module in: file-name === context === /home/geoffrey/plt/collects/compiler/embed-unit.ss:366:4: get-code /home/geoffrey/plt/collects/scheme/private/map.ss:44:11: for-each /home/geoffrey/plt/collects/compiler/embed-unit.ss:743:4: do-write-module-bundle /home/geoffrey/plt/collects/mred/private/mrmenu.ss:244:17: command method in basic-selectable-menu-item% /home/geoffrey/plt/collects/scheme/private/more-scheme.ss:155:2: call-with-break-parameterization /home/geoffrey/plt/collects/scheme/private/more-scheme.ss:271:2: call-with-exception-handler From jensaxel at soegaard.net Mon Jul 13 06:53:14 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Mon Jul 13 06:53:39 2009 Subject: [plt-scheme] Embedding MzScheme on Mac OS X In-Reply-To: <20090713024726.7D2776500BE@mail-svr1.cs.utah.edu> References: <4072c51f0907121444h6de8bb36u5726a776b6b7d5cc@mail.gmail.com> <20090713024726.7D2776500BE@mail-svr1.cs.utah.edu> Message-ID: <4072c51f0907130353x7b668539x989ec18b0e751dec@mail.gmail.com> 2009/7/13 Matthew Flatt > At Sun, 12 Jul 2009 23:44:30 +0200, Jens Axel S?gaard wrote: > > Hopefully I have missed something obvious - but what? > > The Mac frameworks are set up for 3m linking, but I think you mean to > use the CGC frameworks. Actually, I started with CGC because the manual said: > the embedding process for PLT Scheme CGC or PLT Scheme 3m is > essentially the same, but the process for PLT Scheme 3m is most > easily understood as a variant of the process for PLT Scheme CGC. > The simplest solution is to redirect the "PLT_MzScheme" soft link > within "PLT_MzScheme.framework" to the non-"_3m" version, instead of > the "_3m" version. > That did the trick: jas$ PLT_MzScheme.framework jensaxelsoegaard$ pwd /Applications/PLT Scheme Full v4.2.0.2/lib/PLT_MzScheme.framework jas$ PLT_MzScheme.framework jensaxelsoegaard$ ln -s Versions/ 4.2.0.2/PLT_MzScheme . jas$ gcc -L./pltcur/lib/ -I./pltcur/include/ -F./pltcur/lib/ -framework PLT_MzScheme -lmzscheme -lmzgc embedded.c jas$ ./a.out 1 1 Now for the correct options for 3m. I am missing a library, when I link. First I changed the symbolic link in the framework back to the original. Then using the same embedded.c file as before, I did: jas$ ./pltcur/bin/mzc --3m --c-mods modules.c ++lib scheme/base jas$ ./pltcur/bin/mzc --3m -x embedded.c jas$ gcc -L./pltcur/lib/ -I./pltcur/include/ -F./pltcur/lib/ -framework PLT_MzScheme -lmzscheme3m embedded.3m.c jas$ ld -L./pltcur/lib/ -lmzscheme3m -F./pltcur/lib/ -framework PLT_MzScheme embedded_3m.o Undefined symbols: "___maskrune", referenced from: _scheme_do_format in libmzscheme3m.a(string.o) _system_type in libmzscheme3m.a(string.o) _scheme_symbol_name_and_size in libmzscheme3m.a(symbol.o) _scheme_symbol_name_and_size in libmzscheme3m.a(symbol.o) _check_dos_slashslash_qm in libmzscheme3m.a(file.o) _check_dos_slashslash_qm in libmzscheme3m.a(file.o) _is_special_filename in libmzscheme3m.a(file.o) ... -- Jens Axel S?gaard -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090713/7d8092b0/attachment-0001.htm From noelwelsh at gmail.com Mon Jul 13 09:08:23 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Jul 13 09:08:46 2009 Subject: [plt-scheme] (ab)using ffi-call to execute assembly Message-ID: Hello, Let's say I have a byte string containing some assembler. Can I abuse ffi-call to execute this code? I'm getting segmentation faults at the moment. Looking at http://svn.plt-scheme.org/plt/trunk/src/foreign/foreign.ssc I see #define SCHEME_FFIANYPTR_VAL(x) \ (SCHEME_CPTRP(x) ? SCHEME_CPTR_VAL(x) : \ (SCHEME_FALSEP(x) ? NULL : \ (SCHEME_FFIOBJP(x) ? (((ffi_obj_struct*)x)->obj) : \ (SCHEME_BYTE_STRINGP(x) ? SCHEME_BYTE_STR_VAL(x) : \ so I guess this won't work but perhaps I can use a different type in place of byte strings? Ta, Noel From noelwelsh at gmail.com Mon Jul 13 11:10:52 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Jul 13 11:11:13 2009 Subject: [plt-scheme] Re: (ab)using ffi-call to execute assembly In-Reply-To: References: Message-ID: Update: Code works in DrScheme, but not in MzScheme. Welcome to MzScheme v4.2.0.2 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. -> (require "test.ss") -> (run) SIGSEGV fault on (nil) Abort Whereas: Welcome to DrScheme, version 4.2.0.2-svn2jun2009 [3m]. Language: Module; memory limit: 128 megabytes. > (run) 42 Anyone have an ideas? Thanks, N. On Mon, Jul 13, 2009 at 2:08 PM, Noel Welsh wrote: > Hello, > > Let's say I have a byte string containing some assembler. Can I abuse > ffi-call to execute this code? I'm getting segmentation faults at the > moment. ... From jensaxel at soegaard.net Mon Jul 13 13:13:40 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Mon Jul 13 13:14:00 2009 Subject: [plt-scheme] Embedding MzScheme on Mac OS X In-Reply-To: <4072c51f0907130353x7b668539x989ec18b0e751dec@mail.gmail.com> References: <4072c51f0907121444h6de8bb36u5726a776b6b7d5cc@mail.gmail.com> <20090713024726.7D2776500BE@mail-svr1.cs.utah.edu> <4072c51f0907130353x7b668539x989ec18b0e751dec@mail.gmail.com> Message-ID: <4072c51f0907131013r6d5d5bcawce7ce193bfe43029@mail.gmail.com> 2009/7/13 Jens Axel S?gaard Now for the correct options for 3m. I am missing a library, when I link. > ... > > jas$ ld -L./pltcur/lib/ -lmzscheme3m -F./pltcur/lib/ -framework > PLT_MzScheme embedded_3m.o > Undefined symbols: > "___maskrune", referenced from: > _scheme_do_format in libmzscheme3m.a(string.o) > ... > Changing the order of the switches and let gcc take care of the linking does the trick: gcc -L./pltcur/lib/ -I./pltcur/include/ -F./pltcur/lib/ -framework PLT_MzScheme -lmzscheme3m embedded.3m.c Here mzc -x produces embedded.3m.c. For the direct 3m example in the docs I had to add #define MZ_PRECISE_GC 1 as the first line before I got it working. I know the documentation needs to cater Windows, Linux and OS X, and thus including examples of compilation might be a little verbose - but perhaps they could be put in a footnote or an appendix? For non-C hackers it takes a while to find the right gcc incantation. -- Jens Axel S?gaard -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090713/ea3d0c04/attachment.html From noelwelsh at gmail.com Mon Jul 13 15:25:22 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Jul 13 15:25:40 2009 Subject: [plt-scheme] Re: (ab)using ffi-call to execute assembly In-Reply-To: References: Message-ID: Update the second: This is either a Linux or a 4.2.0.2 problem, as it works for me on OS X 4.2.0.5. Probably it is not a problem worth solving. Here's a simplified version of the code. Should work on an 32-bit Intel system. Welcome to MzScheme v4.2.0.5 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. > (define the-answer #"U\211\345\270*\0\0\0]\303" ) > (require '#%foreign) > (define (run) ((ffi-call the-answer null _int32))) > (run) 42 N. On Mon, Jul 13, 2009 at 4:10 PM, Noel Welsh wrote: > Update: > > Code works in DrScheme, but not in MzScheme. > ... From morazanm at gmail.com Mon Jul 13 15:49:07 2009 From: morazanm at gmail.com (Marco Morazan) Date: Mon Jul 13 15:49:28 2009 Subject: [plt-scheme] set-car! in EOPL language Message-ID: <9b1fff280907131249w6f680a04pe58e7a91ec72cb80@mail.gmail.com> Dear All, On this bit of code: (cases node (car nodelist) (a-node (n fl neighs v) (set-car! nodelist (a-node n fl node-neighbors v)))) where nodelist is a list of nodes (a defined datatype), I get this error: Welcome to DrScheme, version 4.2 [3m]. Language: Essentials of Programming Languages (3rd ed.); memory limit: 128 megabytes. . . reference to undefined identifier: set-car! > Why is set-car! undefined? Solution? -- Cheers, Marco From eli at barzilay.org Mon Jul 13 15:52:37 2009 From: eli at barzilay.org (Eli Barzilay) Date: Mon Jul 13 15:52:58 2009 Subject: [plt-scheme] Re: (ab)using ffi-call to execute assembly In-Reply-To: References: Message-ID: <19035.36997.957622.354784@winooski.ccs.neu.edu> On Jul 13, Noel Welsh wrote: > Update the second: > > This is either a Linux or a 4.2.0.2 problem, as it works for me on > OS X 4.2.0.5. Probably it is not a problem worth solving. [...] Perhaps this is due to a need for `scheme_malloc_code'? (Which is our wrapper that takes care to mark the memory as executable.) DrScheme probably has many more pages marked as executable anyway, which would make the error less likely. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From morazanm at gmail.com Mon Jul 13 16:36:12 2009 From: morazanm at gmail.com (Marco Morazan) Date: Mon Jul 13 16:36:31 2009 Subject: [plt-scheme] Re: mutating fields [was: set-car! in EOPL language] Message-ID: <9b1fff280907131336j6a723b8dob699f8b39ccb32d9@mail.gmail.com> Actually, let me refine my question. Given a defined datatype, say: (define-datatype node node? (a-node (n symbol?) (func-list (list-of extended-def?)) (nbr-list (list-of node?)) (free-var vector?))) How can I mutate the fields of an instance of a node? Something like: ... (cases node (car nodelist) (a-node (n fl neighs v) (set! neighs node-neighbors))) does not do the trick, of course, because it is neighs that is mutated (and not (car nodelist)). Is there anything like: (set-node-nbr-list! (car nodelist) node-neighbors) ? Thanks, Marco On Mon, Jul 13, 2009 at 3:49 PM, Marco Morazan wrote: > Dear All, > > On this bit of code: > > (cases node (car nodelist) > ? ? ? ? ? ? ? ? (a-node (n fl neighs v) > ? ? ? ? ? ? ? ? ? ? ? ? (set-car! nodelist (a-node n fl node-neighbors v)))) > > where nodelist is a list of nodes (a defined datatype), I get this error: > > Welcome to DrScheme, version 4.2 [3m]. > Language: Essentials of Programming Languages (3rd ed.); memory limit: > 128 megabytes. > . . reference to undefined identifier: set-car! >> > > Why is set-car! undefined? Solution? > -- > > Cheers, > > Marco > -- Cheers, Marco From noelwelsh at gmail.com Mon Jul 13 16:44:29 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Jul 13 16:44:48 2009 Subject: [plt-scheme] Re: (ab)using ffi-call to execute assembly In-Reply-To: <19035.36997.957622.354784@winooski.ccs.neu.edu> References: <19035.36997.957622.354784@winooski.ccs.neu.edu> Message-ID: On Mon, Jul 13, 2009 at 8:52 PM, Eli Barzilay wrote: > On Jul 13, Noel Welsh wrote: > Perhaps this is due to a need for `scheme_malloc_code'? ?(Which is our > wrapper that takes care to mark the memory as executable.) ?DrScheme > probably has many more pages marked as executable anyway, which would > make the error less likely. Thanks. I didn't know about this requirement. Reading further, it fits the error message on Linux. Furthermore, it seems OS X doesn't mark memory an non-executable for 32-bit code, so that fits what I'm seeing on my Mac. N. From cwarren89 at gmail.com Mon Jul 13 19:26:50 2009 From: cwarren89 at gmail.com (Curtis Warren) Date: Mon Jul 13 19:32:29 2009 Subject: [plt-scheme] set-car! in EOPL language In-Reply-To: <9b1fff280907131249w6f680a04pe58e7a91ec72cb80@mail.gmail.com> References: <9b1fff280907131249w6f680a04pe58e7a91ec72cb80@mail.gmail.com> Message-ID: <178725880907131626u2878ce5cl3e461583f9b661cc@mail.gmail.com> On Mon, Jul 13, 2009 at 2:49 PM, Marco Morazan wrote: > Dear All, > > On this bit of code: > > (cases node (car nodelist) > ? ? ? ? ? ? ? ? (a-node (n fl neighs v) > ? ? ? ? ? ? ? ? ? ? ? ? (set-car! nodelist (a-node n fl node-neighbors v)))) > > where nodelist is a list of nodes (a defined datatype), I get this error: > > Welcome to DrScheme, version 4.2 [3m]. > Language: Essentials of Programming Languages (3rd ed.); memory limit: > 128 megabytes. > . . reference to undefined identifier: set-car! >> > > Why is set-car! undefined? Solution? > -- > > Cheers, > > Marco Lists in PLT scheme are immutable. Read up on mutable lists: http://docs.plt-scheme.org/reference/mpairs.html From cwarren89 at gmail.com Mon Jul 13 19:29:43 2009 From: cwarren89 at gmail.com (Curtis Warren) Date: Mon Jul 13 19:36:37 2009 Subject: [plt-scheme] Re: mutating fields [was: set-car! in EOPL language] In-Reply-To: <9b1fff280907131336j6a723b8dob699f8b39ccb32d9@mail.gmail.com> References: <9b1fff280907131336j6a723b8dob699f8b39ccb32d9@mail.gmail.com> Message-ID: <178725880907131629j56b77930ycb8fb539c17b050a@mail.gmail.com> On Mon, Jul 13, 2009 at 3:36 PM, Marco Morazan wrote: > Actually, let me refine my question. Given a defined datatype, say: > > (define-datatype node node? > ?(a-node > ? (n ?symbol?) > ? (func-list (list-of extended-def?)) > ? (nbr-list (list-of node?)) > ? (free-var vector?))) > > How can I mutate the fields of an instance of a node? Something like: > > ... > (cases node (car nodelist) > ? ? ? ? ? ? ? ? (a-node (n fl neighs v) > ? ? ? ? ? ? ? ? ? ? ? ? (set! neighs node-neighbors))) > > does not do the trick, of course, because it is neighs that is mutated > (and not (car nodelist)). Is there anything like: > > (set-node-nbr-list! (car nodelist) node-neighbors) ? > > Thanks, > > Marco Define the structure as #:mutable (http://docs.plt-scheme.org/reference/define-struct.html). Then use set-nbr-list!. From mikeegg1 at mac.com Mon Jul 13 17:32:45 2009 From: mikeegg1 at mac.com (Mike Eggleston) Date: Tue Jul 14 03:37:50 2009 Subject: [plt-scheme] storing exact values in sqlite3? Message-ID: <20090713213245.GG14324@mail.mac.com> Morning everyone (morning somewhere), When using sqlite3 for storing data if I have a table (and I'm just typing here) sqlite> create table data ( x integer not null ); then sqlite> insert into data values (3); sqlite> insert into data values (7/5); sqlite> select * from data; 3 1 The number 7/5 is an exact value, though is not an integer. How are exact numbers stored as fractions in sqlite3? Must I use a text data type and convert the values into and out of sqlite3? Mike From matthias at ccs.neu.edu Tue Jul 14 10:31:36 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Jul 14 10:32:25 2009 Subject: [plt-scheme] A data point on 'match' in intro programming In-Reply-To: <4A54AAA5.8070501@uwaterloo.ca> References: <4A54AAA5.8070501@uwaterloo.ca> Message-ID: Agreed, showing them pattern matching late but still in the first year is the right thing. BSL, with list abbrv: > (require scheme/match) > > ;; [Listof Number] -> Number > > (check-expect (sum '(1 2 3)) 6) > > (define (sum x) > (match x > [`() 0] > [(cons fst rst) (+ fst (sum rst))])) Enjoy -- Matthias On Jul 8, 2009, at 10:18 AM, Prabhakar Ragde wrote: > Matthias wrote: > >> I would love to use match in introductory courses to get away from >> a lot of details. (I introduced match into Scheme 84 in 1984.) >> Doing so would be a great disfavor to our students. Very few of >> them will end up working with a language that supports match, >> once they are on their first co-op etc. If I prepare them with >> structures/predicates/ selectors etc, they have at least a chance >> to adapt some of what they learned in "210" to their work. If we >> had showed them match and even 'deep' matches, it would just be >> one more large conflict between this silly, design-recipe FP >> stuff and their real world. -- Matthias > > I think the pedagogy of lists in HtDP is dead on -- introduce cons > alone and work with it, then provide list, first, second, etc. once > students are ready for it. I typically get howls of outrage when we > move up to abbreviations. "Why didn't you tell us about this > before?" I explain. They don't always believe me, but that's too > bad. It's the right thing to do. > > In the same sense, I think a late introduction to match would work > well. I don't begrudge John his experiment with very-early match, > though I wouldn't make a habit of it. What I would do is introduce > it when it becomes useful, which in my mind is somewhere late in or > past the tree material. As a concrete example, I have taught Braun > trees in our first course, because they provide a useful example of > a simple logarithmic-depth data structure where only structural > recursion is used. One can implement priority queues using Braun > trees, but the code using accessors is longer and more tedious than > it needs to be. The code using match is short and clean enough that > I actually used this as an exam question. But since I'm still in > Beginning Student with List Abbreviations when we do Braun trees, I > can't ask such questions until we leave the teaching languages > entirely. > > Now, this is not what most people would do in a first course, so I > am not advocating making this an integral part of the teaching > languages. But quasiquote is in them, even though I would make the > same argument for that. At any rate, what I am asking for is how I > can put match, or something like it, into a teachpack. > > I also think you are selling pattern-matching a bit short. It is a > very good bridge to ML, Haskell, and Erlang, and I believe it will > show up in multi-paradigm languages (if it hasn't already), because > it's just so convenient for expressivity. We owe our students the > chance to see things that they will later do their damndest to > sneak into their workplace. --PR > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From chust at web.de Tue Jul 14 10:57:24 2009 From: chust at web.de (Thomas Chust) Date: Tue Jul 14 10:57:44 2009 Subject: [plt-scheme] storing exact values in sqlite3? In-Reply-To: <20090713213245.GG14324@mail.mac.com> References: <20090713213245.GG14324@mail.mac.com> Message-ID: <1c1a33bc0907140757w25fcae15wc8dd71f56e7b933@mail.gmail.com> 2009/7/13 Mike Eggleston : > [...] > sqlite> insert into data values (3); > sqlite> insert into data values (7/5); > sqlite> select * from data; > 3 > 1 > [...] Hello, the documentation of SQLite3 states that the database engine knows about integral, floating point, string, binary blob and null types. To store an exact fraction you have to encode it as an object of one of the supported types. I would suggest to store the numerator and denominator as integers in separate columns, to encode the fractions as strings if speed doesn't matter that much or to store inexact floating point numbers instead if precision doesn't matter that much. cu, Thomas -- When C++ is your hammer, every problem looks like your thumb. From plragde at uwaterloo.ca Tue Jul 14 11:03:29 2009 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Tue Jul 14 11:05:06 2009 Subject: [plt-scheme] A data point on 'match' in intro programming In-Reply-To: References: <4A54AAA5.8070501@uwaterloo.ca> Message-ID: <4A5C9E41.2040101@uwaterloo.ca> Matthias Felleisen wrote: > > Agreed, showing them pattern matching late but still in the first year > is the right thing. > > BSL, with list abbrv: > >> (require scheme/match) >> >> ;; [Listof Number] -> Number >> >> (check-expect (sum '(1 2 3)) 6) >> >> (define (sum x) >> (match x >> [`() 0] >> [(cons fst rst) (+ fst (sum rst))])) > > Enjoy -- Matthias Is this 4.2 where you can (require scheme/match)? I'm still at 4.1.3 (waiting for 4.2.1), and I can't. If I put #lang scheme (provide match) in matchmodule.ss and then (require "matchmodule.ss"), I can get your code to work. However, this doesn't work: (define (sum x) (match x [`() 0] [`(,fst ,rst ...) (+ fst (sum rst))])) I get: fst: name is not defined, not a parameter, and not a primitive name That last bit of code works fine in Module. --PR From matthias at ccs.neu.edu Tue Jul 14 11:32:34 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Jul 14 11:33:19 2009 Subject: [plt-scheme] A data point on 'match' in intro programming In-Reply-To: <4A5C9E41.2040101@uwaterloo.ca> References: <4A54AAA5.8070501@uwaterloo.ca> <4A5C9E41.2040101@uwaterloo.ca> Message-ID: This is in svn head and tested, but I am pretty sure this worked in 4.0 already. (Your function definition, if it worked syntactically, would be wrong.) On Jul 14, 2009, at 11:03 AM, Prabhakar Ragde wrote: > Matthias Felleisen wrote: >> Agreed, showing them pattern matching late but still in the first >> year is the right thing. >> BSL, with list abbrv: >>> (require scheme/match) >>> >>> ;; [Listof Number] -> Number >>> >>> (check-expect (sum '(1 2 3)) 6) >>> >>> (define (sum x) >>> (match x >>> [`() 0] >>> [(cons fst rst) (+ fst (sum rst))])) >> Enjoy -- Matthias > > Is this 4.2 where you can (require scheme/match)? I'm still at > 4.1.3 (waiting for 4.2.1), and I can't. If I put > > #lang scheme > (provide match) > > in matchmodule.ss and then (require "matchmodule.ss"), I can get > your code to work. However, this doesn't work: > > (define (sum x) > (match x > [`() 0] > [`(,fst ,rst ...) (+ fst (sum rst))])) > > I get: > > fst: name is not defined, not a parameter, and not a primitive name > > That last bit of code works fine in Module. --PR From robby at eecs.northwestern.edu Tue Jul 14 11:40:46 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Tue Jul 14 11:41:07 2009 Subject: [plt-scheme] A data point on 'match' in intro programming In-Reply-To: References: <4A54AAA5.8070501@uwaterloo.ca> <4A5C9E41.2040101@uwaterloo.ca> Message-ID: <932b2f1f0907140840s4242d0bdl9090dd3d073c2a50@mail.gmail.com> That function looks right to me. What is going wrong? Robby On Tue, Jul 14, 2009 at 10:32 AM, Matthias Felleisen wrote: > > This is in svn head and tested, but I am pretty sure this worked in 4.0 > already. > > (Your function definition, if it worked syntactically, would be wrong.) > > > On Jul 14, 2009, at 11:03 AM, Prabhakar Ragde wrote: > >> Matthias Felleisen wrote: >>> >>> Agreed, showing them pattern matching late but still in the first year is >>> the right thing. >>> BSL, with list abbrv: >>>> >>>> (require scheme/match) >>>> >>>> ;; [Listof Number] -> Number >>>> >>>> (check-expect (sum '(1 2 3)) 6) >>>> >>>> (define (sum x) >>>> ?(match x >>>> ? ?[`() 0] >>>> ? ?[(cons fst rst) (+ fst (sum rst))])) >>> >>> Enjoy -- Matthias >> >> Is this 4.2 where you can (require scheme/match)? I'm still at 4.1.3 >> (waiting for 4.2.1), and I can't. If I put >> >> #lang scheme >> (provide match) >> >> in matchmodule.ss and then (require "matchmodule.ss"), I can get your code >> to work. However, this doesn't work: >> >> (define (sum x) >> ?(match x >> ? ?[`() 0] >> ? ?[`(,fst ,rst ...) (+ fst (sum rst))])) >> >> I get: >> >> fst: name is not defined, not a parameter, and not a primitive name >> >> That last bit of code works fine in Module. --PR > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From toddobryan at gmail.com Tue Jul 14 14:43:34 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Tue Jul 14 14:43:53 2009 Subject: [plt-scheme] Re: updating a teachpack to 4.2? In-Reply-To: References: <904774730907051520l421993eale96afadd4dc5fb2f@mail.gmail.com> <904774730907051745s19a4b10ei621b28cab8f6f54a@mail.gmail.com> <19025.21409.871959.470109@winooski.ccs.neu.edu> <904774730907051838s5005cfaasd4d04d548262e602@mail.gmail.com> Message-ID: <904774730907141143k5b8055e2v166ceb8ebf1dd65b@mail.gmail.com> It looks like John's version inadvertently forgot to (provide create-print-fabric). I have a student who's trying to do intro independent study over the summer and he discovered the problem. Todd On Sun, Jul 5, 2009 at 11:59 PM, John Clements wrote: > For what it's worth, I fixed up my local copy; it looks like the only > changes required were the change from the 'mzscheme' language to the > 'scheme' language, and the removal of the image definitions from the > corresponding 'tshirt-lab' file. I'm not looking at it, though, so it's > possible that there were other changes I've forgotten, or more subtle issues > that Eli's aware of; one of my workshop participants ran into a really > strange looping bug on Windows only. > > I'm attaching the file that I have. > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090714/94409911/attachment.html From mikeegg1 at me.com Fri Jul 10 20:24:43 2009 From: mikeegg1 at me.com (Mike Eggleston) Date: Tue Jul 14 20:12:16 2009 Subject: [plt-scheme] Handbells for the 21st Century In-Reply-To: References: Message-ID: <20090711002443.GA575@mail.me.com> On Fri, 10 Jul 2009, Shriram Krishnamurthi might have said: > http://www.youtube.com/watch?v=WMYLJUKMPbA > > Yes, those are Android G1's. > > Programmed in Scheme, using the Moby Scheme compiler. > > Thanks to Kathi, Danny, Ethan, and Lyla. > > Shriram A pure geek perspective, that's cool. Mike From sshickey at qwest.net Wed Jul 15 01:24:17 2009 From: sshickey at qwest.net (Scott Hickey) Date: Wed Jul 15 01:24:36 2009 Subject: [plt-scheme] Test Coverage in the Module Language Message-ID: <36b99ddb-9add-4cc6-ae63-1f4b63e3213e@r33g2000yqn.googlegroups.com> I am wondering which test library will provide color highlighting in the editor for the code that doesn't execute, while in the module language? I have tried test-engine/scheme-gui, test-engine/scheme-tests, and schemeunit. Also, on Mac OS X, PLT-Scheme v4.2, with scheme-gui, there is an option to open test output in a separate window and have it dock. This doesn't appear to work on my system - clicking on the dock button closes the window. Is there something else I should be doing to get this to work? Thanks, Scott Hickey From robby at eecs.northwestern.edu Wed Jul 15 07:21:30 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Jul 15 07:21:52 2009 Subject: [plt-scheme] Test Coverage in the Module Language In-Reply-To: <36b99ddb-9add-4cc6-ae63-1f4b63e3213e@r33g2000yqn.googlegroups.com> References: <36b99ddb-9add-4cc6-ae63-1f4b63e3213e@r33g2000yqn.googlegroups.com> Message-ID: <932b2f1f0907150421nb1570bdv54f43a20a6ae6dd0@mail.gmail.com> Test suite coverage is not a library in that sense (at least not in PLT Scheme). At the moment, you have to open the language dialog, click "show details" and in the upper right choose "syntactic test suite coverage". hth, Robby On Wed, Jul 15, 2009 at 12:24 AM, Scott Hickey wrote: > I am wondering which test library will provide color highlighting in > the editor for the code that doesn't execute, while in the module > language? > > I have tried test-engine/scheme-gui, test-engine/scheme-tests, and > schemeunit. > > Also, on Mac OS X, PLT-Scheme v4.2, with scheme-gui, there is an > option to open test output in a separate window and have it dock. This > doesn't appear to work on my system - clicking on the dock button > closes the window. Is there something else I should be doing to get > this to work? > > Thanks, > > Scott Hickey > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jensaxel at soegaard.net Wed Jul 15 09:16:37 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Wed Jul 15 09:16:58 2009 Subject: [plt-scheme] Better print-values wrapping in scheme/private/modbeg.ss ? Message-ID: <4072c51f0907150616n6df7a3b1n9d40c3d1c3d54a3b@mail.gmail.com> Is it possible to improve the print-values wrapping in modbeg.ss? Consider this example: > (expand-syntax #'(module m scheme/base (define a 1) a)) Click on the blue arrow in DrScheme, and see: (module m scheme/base (#%module-begin (define-values (a) '1) (#%app call-with-values (lambda () a) print-values))) Now click on the variable name a in the last line. The problem is that the entire #%app expression is chosen, and not just the variable. -- Jens Axel S?gaard -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090715/a8e4ca98/attachment.htm From jensaxel at soegaard.net Wed Jul 15 10:44:43 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Wed Jul 15 10:45:02 2009 Subject: [plt-scheme] Bug or misuse? Message-ID: <4072c51f0907150744l60464a60ha9985318d89ef87f@mail.gmail.com> Is this a bug or am I misusing resolve-module-path-index ? (Note: "stx" is the what I passed as the second argument (rel-to-path-v). Error message: (file "/Applications/PLT Scheme Full v4.2.0.6/collects/syntax/modresolve.ss") broke the contract ??(-> ?? (or/c symbol? module-path-index?) ?? (or/c (-> path-string?) path-string? #f) ?? (or/c path? symbol?)) ?on resolve-module-path-index; expected <(or/c path? symbol?)>, given: "stx" -- Jens Axel S?gaard From robby at eecs.northwestern.edu Wed Jul 15 10:49:10 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Jul 15 10:49:32 2009 Subject: [plt-scheme] Bug or misuse? In-Reply-To: <4072c51f0907150744l60464a60ha9985318d89ef87f@mail.gmail.com> References: <4072c51f0907150744l60464a60ha9985318d89ef87f@mail.gmail.com> Message-ID: <932b2f1f0907150749y4827c6em30bc2c7981d43182@mail.gmail.com> It may be both, but there is definitely a bug in modresolve.ss or in its contract. Robby On Wed, Jul 15, 2009 at 9:44 AM, Jens Axel S?gaard wrote: > Is this a bug or am I misusing resolve-module-path-index ? > > (Note: "stx" is the what I passed as the second argument (rel-to-path-v). > > Error message: > > (file "/Applications/PLT Scheme Full > v4.2.0.6/collects/syntax/modresolve.ss") broke the contract > ??(-> > ?? (or/c symbol? module-path-index?) > ?? (or/c (-> path-string?) path-string? #f) > ?? (or/c path? symbol?)) > ?on resolve-module-path-index; expected <(or/c path? symbol?)>, given: "stx" > > -- > Jens Axel S?gaard > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From mflatt at cs.utah.edu Wed Jul 15 10:57:44 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Wed Jul 15 10:58:08 2009 Subject: [plt-scheme] Bug or misuse? In-Reply-To: <932b2f1f0907150749y4827c6em30bc2c7981d43182@mail.gmail.com> References: <4072c51f0907150744l60464a60ha9985318d89ef87f@mail.gmail.com> <932b2f1f0907150749y4827c6em30bc2c7981d43182@mail.gmail.com> Message-ID: <20090715145744.9A92B6500BA@mail-svr1.cs.utah.edu> In any case, you might want the function `module-path-index-resolve' from `scheme/base'. (Why doesn't the documentation for `resolve-module-path-index' encourage the use of `module-path-index-resolve'? I'm sure I've asked myself that before.) At Wed, 15 Jul 2009 09:49:10 -0500, Robby Findler wrote: > It may be both, but there is definitely a bug in modresolve.ss or in > its contract. > > Robby > > On Wed, Jul 15, 2009 at 9:44 AM, Jens Axel S?gaard wrote: > > Is this a bug or am I misusing resolve-module-path-index ? > > > > (Note: "stx" is the what I passed as the second argument (rel-to-path-v). > > > > Error message: > > > > (file "/Applications/PLT Scheme Full > > v4.2.0.6/collects/syntax/modresolve.ss") broke the contract > > ??(-> > > ?? (or/c symbol? module-path-index?) > > ?? (or/c (-> path-string?) path-string? #f) > > ?? (or/c path? symbol?)) > > ?on resolve-module-path-index; expected <(or/c path? symbol?)>, given: "stx" > > > > -- > > Jens Axel S?gaard > > _________________________________________________ > > ?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 jensaxel at soegaard.net Wed Jul 15 15:33:35 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Wed Jul 15 15:33:54 2009 Subject: [plt-scheme] Bug or misuse? In-Reply-To: <20090715145744.9A92B6500BA@mail-svr1.cs.utah.edu> References: <4072c51f0907150744l60464a60ha9985318d89ef87f@mail.gmail.com> <932b2f1f0907150749y4827c6em30bc2c7981d43182@mail.gmail.com> <20090715145744.9A92B6500BA@mail-svr1.cs.utah.edu> Message-ID: <4072c51f0907151233l3b935c9blc0d7c3d6a3a0d1ed@mail.gmail.com> 2009/7/15 Matthew Flatt : > In any case, you might want the function `module-path-index-resolve' > from `scheme/base'. I think resolve-module-path-index is what I need (I need to the relative-to-path). > At Wed, 15 Jul 2009 09:49:10 -0500, Robby Findler wrote: >> It may be both, but there is definitely a bug in modresolve.ss or in >> its contract. This may or may not be related. In DrScheme I click the syntax check icon, then right clicked at "module-dependices.scm" and got an internal error from DrScheme. In the terminal from which DrScheme was started, I found the following: split-path: expects argument of type ; given # === context === /Applications/PLT Scheme Full v4.2.0.6/collects/drscheme/syncheck.ss:2271:6 /Applications/PLT Scheme Full v4.2.0.6/collects/scheme/private/map.ss:44:11: for-each /Applications/PLT Scheme Full v4.2.0.6/collects/drscheme/syncheck.ss:659:12: on-event method in ...drscheme/syncheck.ss:221:10 /Applications/PLT Scheme Full v4.2.0.6/collects/mred/private/wxme/editor-canvas.ss:381:2: on-event method in editor-canvas% /Applications/PLT Scheme Full v4.2.0.6/collects/scheme/private/more-scheme.ss:158:2: call-with-break-parameterization /Applications/PLT Scheme Full v4.2.0.6/collects/scheme/private/more-scheme.ss:274:2: call-with-exception-handler -- Jens Axel S?gaard From ntoronto at cs.byu.edu Wed Jul 15 20:23:51 2009 From: ntoronto at cs.byu.edu (Neil Toronto) Date: Wed Jul 15 20:21:01 2009 Subject: [plt-scheme] \mapsto -> Unicode Message-ID: <4A5E7317.2020603@cs.byu.edu> Is there any chance of getting DrScheme to recognize and replace \mapsto with a Unicode character? It renders "\u21A6" just fine. Neil T From robby at eecs.northwestern.edu Wed Jul 15 21:07:26 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Jul 15 21:07:49 2009 Subject: [plt-scheme] \mapsto -> Unicode In-Reply-To: <4A5E7317.2020603@cs.byu.edu> References: <4A5E7317.2020603@cs.byu.edu> Message-ID: <932b2f1f0907151807t696d16e9o1265ffdf2d2d4ea0@mail.gmail.com> Added, in SVN. Thanks, Robby On Wed, Jul 15, 2009 at 7:23 PM, Neil Toronto wrote: > Is there any chance of getting DrScheme to recognize and replace \mapsto > with a Unicode character? It renders "\u21A6" just fine. > > Neil T > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From tprimke at gmail.com Wed Jul 15 12:58:40 2009 From: tprimke at gmail.com (TPJ) Date: Thu Jul 16 01:36:43 2009 Subject: [plt-scheme] Newbie problems with leftparen and ** Message-ID: <441f55aa-5926-4c47-89b3-64805eb99d12@26g2000yqk.googlegroups.com> Does anybody use the leftparen framework? I started to work on a tutorial on writing servlets in Scheme (http:// tprimke.wikidot.com/scheme:servlet:tutorial) and I'm trying to find out what the ** function does. For example, I know I can use it as follows: (** '(p "Hello, world!")) to get the "

Hello, world

" content, but how could I get a link like "Some text here"? Besides, evaluating (** '(p "Hello, world!")) gives (group (p "Hello, world!")) on my PLT Scheme 4.1.5. I can't find out what this group form is. Sorry, if my questions are lame, but I'm quite a newbie Schemer and a newbie servlet developer. From rob.hunter at gmail.com Thu Jul 16 02:39:09 2009 From: rob.hunter at gmail.com (Rob Hunter) Date: Thu Jul 16 02:46:52 2009 Subject: [plt-scheme] Newbie problems with leftparen and ** In-Reply-To: <441f55aa-5926-4c47-89b3-64805eb99d12@26g2000yqk.googlegroups.com> References: <441f55aa-5926-4c47-89b3-64805eb99d12@26g2000yqk.googlegroups.com> Message-ID: Hi, Well, there are at least two of us LeftParen users out there, so...yes? I'll address your question here about the ** function. I'm certainly happy to answer any other questions you might have, but they should probably be sent privately to me so that we can keep this list specifically about PLT stuff. ** is a way to group together multiple html elements. Say you want to write a function that consumes a name and returns an html markup welcome message. E.g., given "rob", you want to return the markup

Welcome, Rob

Your name has 3 letters in it.

One solution would be to write (define (welcome name) `(div (h1 ,name) (p ,(format "Your name has ~A letters in it." (string-length name))))) But this would return a bogus
wrapper--something we didn't ask for in the spec. It might not matter, but sometimes when doing CSS styling, it is nice to be able to get the exact markup that you want. This is why LeftParen offers **, which you could use like this: (define (welcome name) (** `(h1 ,name) `(p ,(format "Your name has ~A letters in it." (string-length name))))) And now when you invoke (name "Rob"), you get the desired html markup. The implementation of ** is quite simple. It's just a "group" tag (which you discovered). The group tag is just something random I chose, and LeftParen automatically searches for group tags and strips them before actually painting the html--so they should never show up on an actual LeftParen rendered web page. Just a few other notes: - You wrote `(p "Hello world") but there's no reason to use the backtick here since you aren't "splicing in" any Scheme expressions. Using '(p "Hello world") would suffice. - For the link you were wondering about, you could just write '(a ((href "some address")) "some text here") or use the web-link function (included by default; defined in web-support.scm in the LeftParen source): (web-link "some text here" "some address") --rob On Wed, Jul 15, 2009 at 9:58 AM, TPJ wrote: > Does anybody use the leftparen framework? > > I started to work on a tutorial on writing servlets in Scheme (http:// > tprimke.wikidot.com/scheme:servlet:tutorial) and I'm trying to find > out what the ** function does. > > For example, I know I can use it as follows: > > (** '(p "Hello, world!")) > > to get the "

Hello, world

" content, but how could I get a link > like "Some text here"? > > Besides, evaluating > > (** '(p "Hello, world!")) > > gives (group (p "Hello, world!")) on my PLT Scheme 4.1.5. I can't find > out what this group form is. > > Sorry, if my questions are lame, but I'm quite a newbie Schemer and a > newbie servlet developer. > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From mister.light at gmail.com Thu Jul 16 04:35:09 2009 From: mister.light at gmail.com (misterlight) Date: Thu Jul 16 04:43:46 2009 Subject: [plt-scheme] No ODBC for DrScheme? Message-ID: <8640b0030907160135u6dfa148cp806e9f52d93c3477@mail.gmail.com> Hi all, I'm learning R6RS Scheme and I would like to use it in some simple program at work. I need to connect to some databases (mainly Informix and MSSQL) through ODBC but I could not find an ODBC library. I googled a lot but it seems that such library does not exists, am I blind or is it real? It would be strange that no one needs it... It seems that Spark Scheme, built on top of MzScheme, has a built-in database and also a generic ODBC interface (see http://spark-scheme.wikispot.org/SQL_%26_ODBC). Maybe it's possible to use its libraries? Thank you for your help From pocmatos at gmail.com Thu Jul 16 05:00:25 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Jul 16 05:01:08 2009 Subject: [plt-scheme] Infinite? Message-ID: <11b141710907160200w7f55cb6eh3be61a986a900020@mail.gmail.com> Hi all, I find that the scheme languages misses infinite? which r6rs has. What's the reason for this? Is it ok to define infinite? as: (define (infinite? x) (or (eq? x +inf.0) (eq? x -inf.0))) Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From mflatt at cs.utah.edu Thu Jul 16 09:00:39 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Jul 16 09:01:02 2009 Subject: [plt-scheme] Infinite? In-Reply-To: <11b141710907160200w7f55cb6eh3be61a986a900020@mail.gmail.com> References: <11b141710907160200w7f55cb6eh3be61a986a900020@mail.gmail.com> Message-ID: <20090716130040.DDA3865012A@mail-svr1.cs.utah.edu> At Thu, 16 Jul 2009 10:00:25 +0100, "Paulo J. Matos" wrote: > I find that the scheme languages misses infinite? which r6rs has. > What's the reason for this? Only that there has never been any particular demand, as far as I know. > Is it ok to define infinite? as: > (define (infinite? x) (or (eq? x +inf.0) (eq? x -inf.0))) Use `eqv?' instead of `eq?', and then that's right. From pocmatos at gmail.com Thu Jul 16 09:07:01 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Jul 16 09:07:44 2009 Subject: [plt-scheme] Infinite? In-Reply-To: <20090716130040.DDA3865012A@mail-svr1.cs.utah.edu> References: <11b141710907160200w7f55cb6eh3be61a986a900020@mail.gmail.com> <20090716130040.DDA3865012A@mail-svr1.cs.utah.edu> Message-ID: <11b141710907160607w738f119bn7dc9efefbe9cca1a@mail.gmail.com> On Thu, Jul 16, 2009 at 2:00 PM, Matthew Flatt wrote: > At Thu, 16 Jul 2009 10:00:25 +0100, "Paulo J. Matos" wrote: >> I find that the scheme languages misses infinite? which r6rs has. >> What's the reason for this? > > Only that there has never been any particular demand, as far as I know. > >> Is it ok to define infinite? as: >> (define (infinite? x) (or (eq? x +inf.0) (eq? x -inf.0))) > > Use `eqv?' instead of `eq?', and then that's right. > > Some simple examples show that eq? works in some particular cases, any cases where it wouldn't work? Or is it just a matter of correct programming style to use eqv? over eq?. Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From mflatt at cs.utah.edu Thu Jul 16 09:15:15 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Jul 16 09:16:01 2009 Subject: [plt-scheme] Infinite? In-Reply-To: <11b141710907160607w738f119bn7dc9efefbe9cca1a@mail.gmail.com> References: <11b141710907160200w7f55cb6eh3be61a986a900020@mail.gmail.com> <20090716130040.DDA3865012A@mail-svr1.cs.utah.edu> <11b141710907160607w738f119bn7dc9efefbe9cca1a@mail.gmail.com> Message-ID: <20090716131517.62DD9650102@mail-svr1.cs.utah.edu> At Thu, 16 Jul 2009 14:07:01 +0100, "Paulo J. Matos" wrote: > On Thu, Jul 16, 2009 at 2:00 PM, Matthew Flatt wrote: > > At Thu, 16 Jul 2009 10:00:25 +0100, "Paulo J. Matos" wrote: > >> I find that the scheme languages misses infinite? which r6rs has. > >> What's the reason for this? > > > > Only that there has never been any particular demand, as far as I know. > > > >> Is it ok to define infinite? as: > >> (define (infinite? x) (or (eq? x +inf.0) (eq? x -inf.0))) > > > > Use `eqv?' instead of `eq?', and then that's right. > > > > > > Some simple examples show that eq? works in some particular cases, any > cases where it wouldn't work? It should usually not work, I think: > (define (infinite? x) (or (eq? x +inf.0) (eq? x -inf.0))) > (infinite? (/ 0.0)) #f > (/ 0.0) +inf.0 About the only time it would work is when you pass the literal constant `+inf.0' or `-inf.0' to `infinite?'. > Or is it just a matter of correct programming style to use eqv? over eq?. It's not just style. The weak guarantees of `eq?' make it unsuitable for defining `infinity?'. From noelwelsh at gmail.com Thu Jul 16 09:15:38 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Jul 16 09:16:06 2009 Subject: [plt-scheme] Infinite? In-Reply-To: <11b141710907160607w738f119bn7dc9efefbe9cca1a@mail.gmail.com> References: <11b141710907160200w7f55cb6eh3be61a986a900020@mail.gmail.com> <20090716130040.DDA3865012A@mail-svr1.cs.utah.edu> <11b141710907160607w738f119bn7dc9efefbe9cca1a@mail.gmail.com> Message-ID: On Thu, Jul 16, 2009 at 2:07 PM, Paulo J. Matos wrote: > Some simple examples show that eq? works in some particular cases, any > cases where it wouldn't work? > Or is it just a matter of correct programming style to use eqv? over eq?. -> (/ +inf.0 0.0) +inf.0 -> (eq? (/ +inf.0 0.0) +inf.0) #f -> (eqv? (/ +inf.0 0.0) +inf.0) #t In the IEEE floating point standard there are many values that represent infinity. See, e.g. http://www.psc.edu/general/software/packages/ieee/ieee.php N. From noelwelsh at gmail.com Thu Jul 16 09:30:57 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Jul 16 09:31:19 2009 Subject: [plt-scheme] No ODBC for DrScheme? In-Reply-To: <8640b0030907160135u6dfa148cp806e9f52d93c3477@mail.gmail.com> References: <8640b0030907160135u6dfa148cp806e9f52d93c3477@mail.gmail.com> Message-ID: Most people use open-source databases such as PostgreSQL or MySQL, so the development effort has tended to go there. SrPersist is an old library that supports ODBC, but I don't think it has been updated to the latest PLT Scheme version. Spark Scheme (didn't know about this till you mentioned it) builds on the old PLT version 371, so reusing its driver might be a bit complicated. That's the current situation. If one were to write a new ODBC driver it would be simplest to use the foreign.ss FFI. HTH, N. On Thu, Jul 16, 2009 at 9:35 AM, misterlight wrote: > Hi all, > I'm learning R6RS Scheme and I would like to use it in some simple > program at work. I need to connect to some databases (mainly Informix > and MSSQL) through ODBC but I could not find an ODBC library. I > googled a lot but it seems that such library does not exists, am I > blind or is it real? It would be strange that no one needs it... > It seems that Spark Scheme, built on top of MzScheme, has a built-in > database and also a generic ODBC interface (see > http://spark-scheme.wikispot.org/SQL_%26_ODBC). Maybe it's possible to > use its libraries? > > Thank you for your help > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From ifl2009 at shu.edu Thu Jul 16 10:17:36 2009 From: ifl2009 at shu.edu (IFL 2009) Date: Thu Jul 16 10:28:20 2009 Subject: [plt-scheme] IFL 2009: Third Call for Papers Message-ID: An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090716/fd8971c9/attachment-0001.htm From jensaxel at soegaard.net Thu Jul 16 19:13:59 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Thu Jul 16 19:14:19 2009 Subject: [plt-scheme] Expand-syntax and fully expanded programs Message-ID: <4072c51f0907161613k7e55a695nc9983d594004fd0e@mail.gmail.com> Is it possible for expand-syntax to non-fully expanded code? I am seeing lambda-s instead of #%plain-lambda-s. Consider the following: The file "a.scm" contains: #lang scheme/base (require (for-syntax scheme/base)) (provide x inc-x! mx) (define x 0) (define-syntax mx (lambda (stx) #'x)) (define (inc-x!) (set! x (+ x 1))) (if 1 2 3) (set! x 4) In the DrScheme REPL: (read-accept-reader #t) (parameterize ([current-namespace (make-base-namespace)]) (namespace-require 'scheme) (namespace-require '(for-syntax scheme)) (syntax->datum (expand-syntax (namespace-syntax-introduce ; make sure "module" is a known construct ... (with-input-from-file "a.scm" (lambda () (read-syntax))))))) The result: (module a scheme/base (#%module-begin (#%require (for-meta 1 scheme/base)) (#%provide x inc-x! mx) (define-values (x) '0) (define-syntaxes (mx) (lambda (stx) (quote-syntax x))) (define-values (inc-x!) (lambda () (set! x (#%app + x '1)))) (#%app call-with-values (lambda () (if '1 '2 '3)) print-values) (#%app call-with-values (lambda () (set! x '4)) print-values))) Besides the fishy lambda, the two last #%app-s are fishy too. They won't match #%app from scheme/base (I think). -- Jens Axel S?gaard From raould at gmail.com Thu Jul 16 19:56:43 2009 From: raould at gmail.com (Raoul Duke) Date: Thu Jul 16 19:57:01 2009 Subject: [plt-scheme] Dr. Scheme usability stumbling block Message-ID: <91a2ba3e0907161656t556d08d3q540cef1d2390bbb0@mail.gmail.com> hi, i'm excited about Typed Scheme so i got the latest Dr. when i run it, it tells me it can't do anything until i pick a language. but RSR6 doesn't appear anywhere, let alone Typed Scheme, the things i'm interested in. do other non-students find that as awkward and confusing as i do? i really don't know what to pick to be allowed to program. (btw, the extra description text for Module appears to end with a "," not a "." on this macbookpro.) sincerely. From raould at gmail.com Thu Jul 16 19:58:09 2009 From: raould at gmail.com (Raoul Duke) Date: Thu Jul 16 19:58:40 2009 Subject: [plt-scheme] Re: Dr. Scheme usability stumbling block In-Reply-To: <91a2ba3e0907161656t556d08d3q540cef1d2390bbb0@mail.gmail.com> References: <91a2ba3e0907161656t556d08d3q540cef1d2390bbb0@mail.gmail.com> Message-ID: <91a2ba3e0907161658t7b692580j16a75bc20828d28d@mail.gmail.com> p.s. entering "#lang typed-scheme" into the lower frame just apparently causes the whole system to lock up. On Thu, Jul 16, 2009 at 4:56 PM, Raoul Duke wrote: > hi, > > i'm excited about Typed Scheme so i got the latest Dr. > > when i run it, it tells me it can't do anything until i pick a > language. but RSR6 doesn't appear anywhere, let alone Typed Scheme, > the things i'm interested in. do other non-students find that as > awkward and confusing as i do? i really don't know what to pick to be > allowed to program. > > (btw, the extra description text for Module appears to end with a "," > not a "." on this macbookpro.) > > sincerely. > From raould at gmail.com Thu Jul 16 20:02:10 2009 From: raould at gmail.com (Raoul Duke) Date: Thu Jul 16 20:02:39 2009 Subject: [plt-scheme] Typed Scheme "typeof"? Message-ID: <91a2ba3e0907161702t6de6426cp932e1dd630b379b7@mail.gmail.com> hi, i haven't found it yet in the docs, is there some way to ask Typed Scheme what it thinks the type is of something? thanks. From ryanc at ccs.neu.edu Thu Jul 16 20:07:03 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Thu Jul 16 20:07:36 2009 Subject: [plt-scheme] Expand-syntax and fully expanded programs In-Reply-To: <4072c51f0907161613k7e55a695nc9983d594004fd0e@mail.gmail.com> References: <4072c51f0907161613k7e55a695nc9983d594004fd0e@mail.gmail.com> Message-ID: <4A5FC0A7.9040600@ccs.neu.edu> Jens Axel S?gaard wrote: > Is it possible for expand-syntax to non-fully expanded code? > I am seeing lambda-s instead of #%plain-lambda-s. > > Consider the following: > > The file "a.scm" contains: > > #lang scheme/base > (require (for-syntax scheme/base)) > (provide x inc-x! mx) > (define x 0) > (define-syntax mx (lambda (stx) #'x)) > (define (inc-x!) (set! x (+ x 1))) > (if 1 2 3) > (set! x 4) > > In the DrScheme REPL: > > (read-accept-reader #t) > (parameterize ([current-namespace (make-base-namespace)]) > (namespace-require 'scheme) > (namespace-require '(for-syntax scheme)) > (syntax->datum > (expand-syntax > (namespace-syntax-introduce ; make sure "module" is a known construct ... > (with-input-from-file "a.scm" > (lambda () (read-syntax))))))) > > The result: > > (module a scheme/base > (#%module-begin > (#%require (for-meta 1 scheme/base)) > (#%provide x inc-x! mx) > (define-values (x) '0) > (define-syntaxes (mx) (lambda (stx) (quote-syntax x))) > (define-values (inc-x!) (lambda () (set! x (#%app + x '1)))) > (#%app call-with-values (lambda () (if '1 '2 '3)) print-values) > (#%app call-with-values (lambda () (set! x '4)) print-values))) > > Besides the fishy lambda, the two last #%app-s are fishy too. > They won't match #%app from scheme/base (I think). Those lambdas really are #%plain-lambda. Likewise for the #%apps. See the yellow warning box (in the right margin) here: http://docs.plt-scheme.org/reference/syntax-model.html#(part._fully-expanded) Here's a smaller example. Try just fully expanding a lambda expression: > (syntax->datum (expand #'(lambda (x) x))) (#%expression (lambda (x) x)) If you extract the 'lambda' identifier, you can verify that it's really '#%plain-lambda': > (syntax-case (expand #'(lambda (x) x)) () [(expr (lam . _)) (free-identifier=? #'lam #'#%plain-lambda)]) #t It isn't the 'lambda' from scheme/base: > (syntax-case (expand #'(lambda (x) x)) () [(expr (lam . _)) (free-identifier=? #'lam #'lambda)]) #f Ryan From toddobryan at gmail.com Thu Jul 16 20:25:30 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Thu Jul 16 20:25:52 2009 Subject: [plt-scheme] Re: Dr. Scheme usability stumbling block In-Reply-To: <91a2ba3e0907161658t7b692580j16a75bc20828d28d@mail.gmail.com> References: <91a2ba3e0907161656t556d08d3q540cef1d2390bbb0@mail.gmail.com> <91a2ba3e0907161658t7b692580j16a75bc20828d28d@mail.gmail.com> Message-ID: <904774730907161725o7f635c9bn5e863213525c3d25@mail.gmail.com> Pick the Module language at the very top and enter #lang typed-scheme as the first line in the *Definitions* window (the top one). On Thu, Jul 16, 2009 at 7:58 PM, Raoul Duke wrote: > p.s. entering "#lang typed-scheme" into the lower frame just > apparently causes the whole system to lock up. > > On Thu, Jul 16, 2009 at 4:56 PM, Raoul Duke wrote: > > hi, > > > > i'm excited about Typed Scheme so i got the latest Dr. > > > > when i run it, it tells me it can't do anything until i pick a > > language. but RSR6 doesn't appear anywhere, let alone Typed Scheme, > > the things i'm interested in. do other non-students find that as > > awkward and confusing as i do? i really don't know what to pick to be > > allowed to program. > > > > (btw, the extra description text for Module appears to end with a "," > > not a "." on this macbookpro.) > > > > sincerely. > > > _________________________________________________ > 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/20090716/27a1c8e3/attachment.html From jensaxel at soegaard.net Thu Jul 16 20:41:42 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Thu Jul 16 20:42:05 2009 Subject: [plt-scheme] Expand-syntax and fully expanded programs In-Reply-To: <4A5FC0A7.9040600@ccs.neu.edu> References: <4072c51f0907161613k7e55a695nc9983d594004fd0e@mail.gmail.com> <4A5FC0A7.9040600@ccs.neu.edu> Message-ID: <4072c51f0907161741n47d9507ciece6ee924f4760ff@mail.gmail.com> 2009/7/17 Ryan Culpepper : > Jens Axel S?gaard wrote: > Those lambdas really are #%plain-lambda. Likewise for the #%apps. See the > yellow warning box (in the right margin) here: > > http://docs.plt-scheme.org/reference/syntax-model.html#(part._fully-expanded) > > Here's a smaller example. Try just fully expanding a lambda expression: > > ?> (syntax->datum (expand #'(lambda (x) x))) > ?(#%expression (lambda (x) x)) > > If you extract the 'lambda' identifier, you can verify that it's really > '#%plain-lambda': Thanks, that was indeed the cause. I was close though - I used syntax-case* with free-identifier=? in the old code, but hadn't replaced the old lambda and #%app with #%plain-lambda and #%plain-app. Since the wrapping of top-level forms involves no keywords, why not let the wrapping be (#%plain-app call-with-values ($%plain-lambda () (if '1 '2 '3)) print-values) rather than (#%app call-with-values (lambda () (if '1 '2 '3)) print-values) ? -- Jens Axel S?gaard From matthias at ccs.neu.edu Thu Jul 16 21:29:05 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Jul 16 21:29:40 2009 Subject: [plt-scheme] Typed Scheme "typeof"? In-Reply-To: <91a2ba3e0907161702t6de6426cp932e1dd630b379b7@mail.gmail.com> References: <91a2ba3e0907161702t6de6426cp932e1dd630b379b7@mail.gmail.com> Message-ID: No. But you can write your own as I recently sketched on this mailing list. On Jul 16, 2009, at 8:02 PM, Raoul Duke wrote: > hi, > > i haven't found it yet in the docs, is there some way to ask Typed > Scheme what it thinks the type is of something? > > thanks. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From matthias at ccs.neu.edu Thu Jul 16 21:32:31 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Jul 16 21:33:06 2009 Subject: [plt-scheme] Dr. Scheme usability stumbling block In-Reply-To: <91a2ba3e0907161656t556d08d3q540cef1d2390bbb0@mail.gmail.com> References: <91a2ba3e0907161656t556d08d3q540cef1d2390bbb0@mail.gmail.com> Message-ID: Soon drscheme will move away from languages and every programmer will write #lang ... You will still have to know your language names but at least you won't get a menu that doesn't even contain the language that you're looking for. On Jul 16, 2009, at 7:56 PM, Raoul Duke wrote: > hi, > > i'm excited about Typed Scheme so i got the latest Dr. > > when i run it, it tells me it can't do anything until i pick a > language. but RSR6 doesn't appear anywhere, let alone Typed Scheme, > the things i'm interested in. do other non-students find that as > awkward and confusing as i do? i really don't know what to pick to be > allowed to program. > > (btw, the extra description text for Module appears to end with a "," > not a "." on this macbookpro.) > > sincerely. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From raould at gmail.com Fri Jul 17 00:51:16 2009 From: raould at gmail.com (Raoul Duke) Date: Fri Jul 17 00:51:34 2009 Subject: [plt-scheme] Typed Scheme "typeof"? In-Reply-To: References: <91a2ba3e0907161702t6de6426cp932e1dd630b379b7@mail.gmail.com> Message-ID: <91a2ba3e0907162151m2b090d49g66d6aa467b0b543@mail.gmail.com> > No. But you can write your own as I recently sketched on this mailing list. thanks for the pointer, i'll re-read! From raould at gmail.com Fri Jul 17 00:52:46 2009 From: raould at gmail.com (Raoul Duke) Date: Fri Jul 17 00:53:06 2009 Subject: [plt-scheme] Dr. Scheme usability stumbling block In-Reply-To: References: <91a2ba3e0907161656t556d08d3q540cef1d2390bbb0@mail.gmail.com> Message-ID: <91a2ba3e0907162152m66b34105s898536a1d055dad6@mail.gmail.com> thanks all for the replies. > Soon drscheme will move away from languages and every programmer will write #lang okeydokey. :) From ezacharias at gmail.com Fri Jul 17 01:00:08 2009 From: ezacharias at gmail.com (Edwin Zacharias) Date: Fri Jul 17 01:00:28 2009 Subject: [plt-scheme] shift/reset and multiple arguments Message-ID: The delimited continuation captured by shift does not seem to support arity other than 1 while control does. Here's an example: > (require scheme/control) > (reset (shift f (f))) . . procedure ...mzlib/control.ss:142:25: expects 1 argument, given 0 > (prompt (control f (f))) > From mister.light at gmail.com Fri Jul 17 02:05:20 2009 From: mister.light at gmail.com (misterlight) Date: Fri Jul 17 02:05:39 2009 Subject: [plt-scheme] No ODBC for DrScheme? In-Reply-To: References: <8640b0030907160135u6dfa148cp806e9f52d93c3477@mail.gmail.com> Message-ID: <8640b0030907162305w362e960dkea0af3f0b07ad9d1@mail.gmail.com> On 7/16/09, Noel Welsh wrote: >[...] > That's the current situation. If one were to write a new ODBC driver > it would be simplest to use the foreign.ss FFI. > > HTH, > N. Thank you Noel. Since I'm on Windows, at first I thought I could use something like COM objects with MysterX (I don't know if there is something available for database connection), but the FFI you mention is interesting. I started reading the documentation and found the appropriate DLL on my pc. Supposing that I'd like to try it, since I have no experience at all with FFI, are there some "standard steps" that you suggest to follow? Kind regards, ml From mflatt at cs.utah.edu Fri Jul 17 07:11:17 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Fri Jul 17 07:11:38 2009 Subject: [plt-scheme] shift/reset and multiple arguments In-Reply-To: References: Message-ID: <20090717111118.70D28650119@mail-svr1.cs.utah.edu> At Fri, 17 Jul 2009 01:00:08 -0400, Edwin Zacharias wrote: > The delimited continuation captured by shift does not seem to support > arity other than 1 while control does. Here's an example: > > > (require scheme/control) > > (reset (shift f (f))) > . . procedure ...mzlib/control.ss:142:25: expects 1 argument, given 0 > > (prompt (control f (f))) This is fixed in SVN, so that a `shift'-captured continuation can accept any number of arguments. From jrs.idx at ntlworld.com Fri Jul 17 07:12:42 2009 From: jrs.idx at ntlworld.com (John Sampson) Date: Fri Jul 17 07:22:46 2009 Subject: [PLT-Scheme] Precompiled Gvim Message-ID: <4A605CAA.9000601@ntlworld.com> Hello - I have installed Cream Gvim on Windows XP (gvim 7.2.228.exe). It is supposed to work with MzScheme but I think needs libmzsch41.dll and libmzgc41.dll. Is there a version of MzScheme that has these or will work with these, supposing I could find them? Regards _John Sampson_ __________ Information from ESET NOD32 Antivirus, version of virus signature database 4253 (20090717) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com From jensaxel at soegaard.net Fri Jul 17 07:33:40 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Fri Jul 17 07:34:03 2009 Subject: [PLT-Scheme] Precompiled Gvim In-Reply-To: <4A605CAA.9000601@ntlworld.com> References: <4A605CAA.9000601@ntlworld.com> Message-ID: <4072c51f0907170433u1ff64b66hcba8a5164a916c87@mail.gmail.com> 2009/7/17 John Sampson : > Hello - > > I have installed Cream Gvim on Windows XP (gvim 7.2.228.exe). It is > supposed to work with > MzScheme but I think needs libmzsch41.dll and libmzgc41.dll. Is there a > version of MzScheme > that has these or will work with these, supposing I could find them? http://download.plt-scheme.org/all-versions.html -- Jens Axel S?gaard From jrs.idx at ntlworld.com Fri Jul 17 08:26:41 2009 From: jrs.idx at ntlworld.com (John Sampson) Date: Fri Jul 17 08:27:16 2009 Subject: [PLT-Scheme] Precompiled Gvim In-Reply-To: <4072c51f0907170433u1ff64b66hcba8a5164a916c87@mail.gmail.com> References: <4A605CAA.9000601@ntlworld.com> <4072c51f0907170433u1ff64b66hcba8a5164a916c87@mail.gmail.com> Message-ID: <4A606E01.5000109@ntlworld.com> Hello - Thanks, but I am afraid this does not help. MzScheme 4.2 has libmzsch3m something something - the version numbers of the DLLs do not tally with the MzScheme version numbers. For all I know there is no such file as libmzsch41.dll but if there is I would like to know which version of MzScheme it is packaged with. Regards _John Sampson_ Jens Axel S?gaard wrote: > 2009/7/17 John Sampson : > >> Hello - >> >> I have installed Cream Gvim on Windows XP (gvim 7.2.228.exe). It is >> supposed to work with >> MzScheme but I think needs libmzsch41.dll and libmzgc41.dll. Is there a >> version of MzScheme >> that has these or will work with these, supposing I could find them? >> > > http://download.plt-scheme.org/all-versions.html > > __________ Information from ESET NOD32 Antivirus, version of virus signature database 4253 (20090717) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com From noelwelsh at gmail.com Fri Jul 17 09:13:27 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Jul 17 09:14:06 2009 Subject: [PLT-Scheme] Precompiled Gvim In-Reply-To: <4A606E01.5000109@ntlworld.com> References: <4A605CAA.9000601@ntlworld.com> <4072c51f0907170433u1ff64b66hcba8a5164a916c87@mail.gmail.com> <4A606E01.5000109@ntlworld.com> Message-ID: Why not try renaming the dlls you do have to what GVim expects? I expect that will work. Also, from the docs: http://vimdoc.sourceforge.net/htmldoc/if_mzsch.html#MzScheme The names of the DLLs must match the MzScheme version Vim was compiled with. For MzScheme version 209 they will be "libmzsch209_000.dll" and "libmzgc209_000.dll". To know for sure look at the output of the ":version" command, look for -DDYNAMIC_MZSCH_DLL="something" and -DDYNAMIC_MZGC_DLL="something" in the "Compilation" info. So probably 4.1 is what it was compiled with. I doubt there are significant differences between 4.1 and 4.2. N. On Fri, Jul 17, 2009 at 1:26 PM, John Sampson wrote: > Hello - > > Thanks, but I am afraid this does not help. MzScheme 4.2 has libmzsch3m > something something - > the version numbers of the DLLs do not tally with the MzScheme version > numbers. For all I know > there is no such file as libmzsch41.dll but if there is I would like to > know which version of MzScheme > it is packaged with. > > Regards > > _John Sampson_ > From sergey.khorev at gmail.com Fri Jul 17 09:55:39 2009 From: sergey.khorev at gmail.com (Sergey Khorev) Date: Fri Jul 17 09:56:03 2009 Subject: [PLT-Scheme] Precompiled Gvim In-Reply-To: <4A605CAA.9000601@ntlworld.com> References: <4A605CAA.9000601@ntlworld.com> Message-ID: <4A6082DB.7090302@gmail.com> > I have installed Cream Gvim on Windows XP (gvim 7.2.228.exe). It is > supposed to work with > MzScheme but I think needs libmzsch41.dll and libmzgc41.dll. Is there a > version of MzScheme > that has these or will work with these, supposing I could find them? I would suggest to build MzScheme 4.1 with Boehm GC and then rename resulted libmzschxxxxxxx.dll and libmzgcxxxxxxx.dll to libmzsch41.dll and libmzgc41.dll correspondingly. From noelwelsh at gmail.com Fri Jul 17 10:12:09 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Jul 17 10:12:27 2009 Subject: [plt-scheme] No ODBC for DrScheme? In-Reply-To: <8640b0030907162305w362e960dkea0af3f0b07ad9d1@mail.gmail.com> References: <8640b0030907160135u6dfa148cp806e9f52d93c3477@mail.gmail.com> <8640b0030907162305w362e960dkea0af3f0b07ad9d1@mail.gmail.com> Message-ID: If you haven't found the MSDN docs, they are here: http://msdn.microsoft.com/en-us/library/ms709378(VS.85).aspx You will need to get hold of the ODBC header files. You want to define the basic data structures in ODBC (handles and so on). These are mostly, I think, opaque values so you can just use _cpointer as a first pass. Then get hold of the obdc library and start defining functions. Test every step of the way, 'cause if you make an error it will be very difficult to debug otherwise. Here's a basic outline (untested): (require scheme/foreign) (define-cpointer-type _SQLHENV) ; etc ... You need SQLRETURN and friends. See sqltypes.h (define libodbc (ffi-lib "libodbc")) ;; Start defining functions (unsafe!) ;SQLRETURN SQLAllocHandle( ; SQLSMALLINT HandleType, ; SQLHANDLE InputHandle, ; SQLHANDLE * OutputHandlePtr) (define SQLAllocHandle (get-ffi-obj "SQLAllocHandle" libodbc (_fun _SQLSMALLINT _SQLHANDLE _SQLHANDLE_pointer -> _SQLRETURN))) On Fri, Jul 17, 2009 at 7:05 AM, misterlight wrote: ... > I started reading the documentation and found the appropriate DLL on > my pc. Supposing that I'd like to try it, since I have no experience > at all with FFI, are there some "standard steps" that you suggest to > follow? > > Kind regards, > ml > From eli at barzilay.org Fri Jul 17 21:35:39 2009 From: eli at barzilay.org (Eli Barzilay) Date: Fri Jul 17 21:36:00 2009 Subject: [plt-scheme] sake problem Message-ID: <19041.9963.457992.374000@winooski.ccs.neu.edu> There was a problem in the sake package that was just raised on IRC: copy-file: cannot open destination file; cannot copy: /usr/plt/collects/launcher/sh to: /usr/plt/bin/sake setup-plt: error: during Launcher Setup for /schematics/sake.plt/1/0 (Sake) looks like sake is trying to install a launcher. This is bad because when people see this they might (as the IRC case went) switch to the root user and run setup-plt again, which will recreate some files as root which makes a bigger problem now with the user not being able to touch these files. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From maxigas at anargeek.net Fri Jul 17 21:15:40 2009 From: maxigas at anargeek.net (maxigas) Date: Fri Jul 17 21:53:44 2009 Subject: [plt-scheme] miration problems Message-ID: <20090718.021540.239516596.maxigas@anargeek.net> hi! i am migrating from my old laptop to my new laptop and there is some code that doesn't run on the old one. the previous was a Debian Etch running on a powerpc processor, where i compiled mzsheme myself. now i am on Ubuntu 8.04 and installed mzscheme from the repository. however, they are both v4.1.3 [3m] so i don't understand what is going on. eli advised to install the current version, and there is a Jaunty .deb on the website, so i just try it and report back. maxigas From maxigas at anargeek.net Fri Jul 17 21:57:16 2009 From: maxigas at anargeek.net (maxigas) Date: Fri Jul 17 21:57:51 2009 Subject: [plt-scheme] migration problem (was: miration problem) Message-ID: <20090718.025716.158785264.maxigas@anargeek.net> hi! so i installed the current version from the Ubuntu Jaunty .deb on the website: v4.2 [3m] i run the same programme as above. on first run, it's various messages, apparently the bug reported by eli in the previous post: mxs@chaar: mzscheme code3.ss require: unknown module: 'program setup-plt: error: during Building docs for /home/mxs/.plt-scheme/planet/300/4.2/cache/cce/scheme.plt/4/1/scribblings/main.scrbl setup-plt: require: unknown module: 'program WARNING: collected information for key multiple times: (mod-path "(planet schematics/sake)"); values: #(# ("Build files") #t (mod-path "(planet schematics/sake)")) #(# ("The Sake API") #t (mod-path "(planet schematics/sake)")) WARNING: collected information for key multiple times: (index-entry (mod-path "(planet schematics/sake)")); values: (("(planet schematics/sake)") (#(struct:sized-element ... ...)) #) (("(planet schematics/sake)") (#(struct:sized-element ... ...)) #) WARNING: collected information for key multiple times: (mod-path "(planet schematics/sake)"); values: #(# ("Build files") #t (mod-path "(planet schematics/sake)")) #(# ("The Sake API") #t (mod-path "(planet schematics/sake)")) WARNING: collected information for key multiple times: (index-entry (mod-path "(planet schematics/sake)")); values: (("(planet schematics/sake)") (#(struct:sized-element ... ...)) #) (("(planet schematics/sake)") (#(struct:sized-element ... ...)) #) copy-file: cannot open destination file; cannot copy: /usr/plt/collects/launcher/sh to: /usr/plt/bin/sake setup-plt: error: during Launcher Setup for /schematics/sake.plt/1/0 (Sake) setup-plt: copy-file: cannot open destination file; cannot copy: /usr/plt/collects/launcher/sh to: /usr/plt/bin/sake ^Cuser break i loose patience here, Ctrl-C, became superuser, and try again: root@chaar:/home/mxs/dev/stratobe# mzscheme code3.ss require: unknown module: 'program setup-plt: error: during Building docs for /root/.plt-scheme/planet/300/4.2/cache/cce/scheme.plt/4/1/scribblings/main.scrbl setup-plt: require: unknown module: 'program WARNING: collected information for key multiple times: (index-entry (mod-path "(planet schematics/sake)")); values: (("(planet schematics/sake)") (#(struct:sized-element ... ...)) #) (("(planet schematics/sake)") (#(struct:sized-element ... ...)) #) WARNING: collected information for key multiple times: (mod-path "(planet schematics/sake)"); values: #(# ("Build files") #t (mod-path "(planet schematics/sake)")) #(# ("The Sake API") #t (mod-path "(planet schematics/sake)")) WARNING: collected information for key multiple times: (index-entry (mod-path "(planet schematics/sake)")); values: (("(planet schematics/sake)") (#(struct:sized-element ... ...)) #) (("(planet schematics/sake)") (#(struct:sized-element ... ...)) #) WARNING: collected information for key multiple times: (mod-path "(planet schematics/sake)"); values: #(# ("Build files") #t (mod-path "(planet schematics/sake)")) #(# ("The Sake API") #t (mod-path "(planet schematics/sake)")) default-load-handler: cannot open input file: "/root/.plt-scheme/planet/300/4.2/cache/untyped/mirrors.plt/1/9/javascript/main.ss" (No such file or directory; errno=2) setup-plt: error: during Building docs for /root/.plt-scheme/planet/300/4.2/cache/dherman/javascript.plt/8/0/scribblings/javascript.scrbl setup-plt: default-load-handler: cannot open input file: "/root/.plt-scheme/planet/300/4.2/cache/untyped/mirrors.plt/1/9/javascript/main.ss" (No such file or directory; errno=2) response.ss:70:53: compile: unbound identifier in module in: response? response.ss:70:53: compile: unbound identifier in module in: response? setup-plt: error: during making for /untyped/dispatch.plt/1/10 (Dispatch) setup-plt: response.ss:70:53: compile: unbound identifier in module in: response? setup-plt: error: during Building docs for /root/.plt-scheme/planet/300/4.2/cache/untyped/dispatch.plt/1/10/scribblings/dispatch.scrbl setup-plt: response.ss:70:53: compile: unbound identifier in module in: response? /root/.plt-scheme/planet/300/4.2/cache/untyped/dispatch.plt/1/10/response.ss:70:53: compile: unbound identifier in module in: response? root@chaar:/home/mxs/dev/stratobe# hmmm... that's too much errors fro 2:54am, but let's try for a second time as normal user: mxs@chaar: mzscheme code3.ss /home/mxs/.plt-scheme/planet/300/4.2/cache/untyped/dispatch.plt/1/10/response.ss:70:53: compile: unbound identifier in module in: response? mxs@chaar: what do you make of that? this code runs fine on my debian powerpc laptop and the virtual server where i run www.metatron.sh, both v4.1.3 [3m] thx, maxigas From noelwelsh at gmail.com Sat Jul 18 03:32:50 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Sat Jul 18 03:33:08 2009 Subject: [plt-scheme] sake problem In-Reply-To: <19041.9963.457992.374000@winooski.ccs.neu.edu> References: <19041.9963.457992.374000@winooski.ccs.neu.edu> Message-ID: So you're saying user packages shouldn't install launchers? This could be a bit problematic. N. On Sat, Jul 18, 2009 at 2:35 AM, Eli Barzilay wrote: ... > looks like sake is trying to install a launcher. ?This is bad ... From eli at barzilay.org Sat Jul 18 03:40:36 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sat Jul 18 03:40:56 2009 Subject: [plt-scheme] sake problem In-Reply-To: References: <19041.9963.457992.374000@winooski.ccs.neu.edu> Message-ID: <19041.31860.750848.195973@winooski.ccs.neu.edu> On Jul 18, Noel Welsh wrote: > On Sat, Jul 18, 2009 at 2:35 AM, Eli Barzilay wrote: > ... > > looks like sake is trying to install a launcher. ?This is bad ... > > So you're saying user packages shouldn't install launchers? This > could be a bit problematic. I know, but I don't see any way out with planet being a strict user-specific tool. The best thing I can think of now, is providing some "create launcher" utility. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From marek at xivilization.net Sat Jul 18 09:13:12 2009 From: marek at xivilization.net (Marek Kubica) Date: Sat Jul 18 09:13:34 2009 Subject: [plt-scheme] Some more usability issues Message-ID: <20090718151312.01a25726@halmanfloyd.lan.local> Hi, I sometimes post here some issues that make working with Dr Scheme less convenient as it could be. Lately I ran into two new things that bother me: - The context menu only stays open as long as the right mouse button is pressed. I know that this has been the historical Unix way of doing things, but nowadays many toolkits (Windows, GTK+, AFAIR Qt too) leave the menu open until the user does a (left or middle or right) click outside of the menu. In my option this is the better way, since it can be tricky to click right and move the mouse, especially on a touchpad and when every other application leaves the context menu open. - Search in Helpdesk for "(selection)" in the context menu. This option is incredibly useful, but when I select a large amount of text, the whole 'Search in Helpdesk for "large amount of text"' makes the menu very, very large. I think it would be better to shorten it to the first selected form and add "..." to it. The user will know that there is some more text while not blowing up the sice of the menu. - When running the debugger, I can't make the left part (Stack/Variables) wider. This would be handy because the variables that I define sometimes have a large text representation and the frequent line breaks and scrolling in the variables window could be reduced if I could make it larger by making the definitions and REPL parts smaller. It would be great if someone could look into this, since DrScheme, erm, MrEd is a really good way to program in Scheme except for the historical usability weaknesses (some of these were already adressed - many thanks for that, this made my MrEd experience a lot more pleasant already). Thanks for reading and of course thanks for MrEd! regards, Marek From spamme at innerpaths.net Sat Jul 18 10:03:01 2009 From: spamme at innerpaths.net (Gregg Williams) Date: Sat Jul 18 10:40:58 2009 Subject: [plt-scheme] Newbie question: picking the right data structure Message-ID: Hi! I'm fairly new at Scheme, though I have written a number of programs in the functional style with no problem. However, I'm hitting a blind spot and would like somebody's opinion. I want to use Scheme to create an interactive environment for exploring a data set (i.e., from the command line). Each datum is represented by a string that I use as a key, so I will be building up various named lists of strings and adding to them. Here's my problem: I can't seem to find a good way to add strings to a list identified by a fixed variable name. I can't seem to use "define" to overwrite the variable with a new list. I could use a vector, but that would waste a lot of space if I made all vectors long enough for practical purposes. I looked into using mutable lists, but destructively splicing a second list onto the list connected to my veritable name has repercussions. Am I missing something obvious, or do I have to just choose one of these options and deal with the consequences? Thanks for your help. From matthias at ccs.neu.edu Sat Jul 18 11:03:15 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sat Jul 18 11:03:53 2009 Subject: [plt-scheme] Newbie question: picking the right data structure In-Reply-To: References: Message-ID: <3125E2D7-04F0-4603-920F-2158EF1108DF@ccs.neu.edu> How would this work: (define (command-line-data-structure-explorer) (define (repl list-of-things-to-track) ... (repl (cons additional-string list-of-things-to-track))) ... ) ;; --- IN: (repl '())) For cons, you can use whatever you find more suitable. Sorry if this misinterprets your question -- Matthias On Jul 18, 2009, at 10:03 AM, Gregg Williams wrote: > Hi! I'm fairly new at Scheme, though I have written a number of > programs in the functional style with no problem. However, I'm hitting > a blind spot and would like somebody's opinion. > > I want to use Scheme to create an interactive environment for > exploring a data set (i.e., from the command line). Each datum is > represented by a string that I use as a key, so I will be building up > various named lists of strings and adding to them. > > Here's my problem: I can't seem to find a good way to add strings to a > list identified by a fixed variable name. I can't seem to use "define" > to overwrite the variable with a new list. I could use a vector, but > that would waste a lot of space if I made all vectors long enough for > practical purposes. I looked into using mutable lists, but > destructively splicing a second list onto the list connected to my > veritable name has repercussions. > > Am I missing something obvious, or do I have to just choose one of > these options and deal with the consequences? Thanks for your help. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From fare at tunes.org Sat Jul 18 11:10:51 2009 From: fare at tunes.org (Francois-Rene Rideau) Date: Sat Jul 18 11:11:12 2009 Subject: [plt-scheme] Boston Lisp Meeting Monday 2009-06-29: Eli Barzilay on Implementing Domain Specific Languages with PLT Scheme Message-ID: <20090718151051.978C741BB@bespin.org> Boston Lisp Meeting: Monday 2009-07-27 Bruce Lewis, Richard Kreuter http://fare.livejournal.com/145087.html A Boston Lisp Meeting will take place on Monday, July 27th 2009 at 1800 at MIT 34-401B, where Bruce Lewis will speak about OurDoings, and Richard Kreuter will speak about defsystems and deliverables, or, unary REQUIRE for the win! Additionally, we are still accepting proposals for up to two volunteers to each give of a 5-minute Lightning Talk (followed by 2-minute Q&A). Also, there will be a buffet offered by ITA Software. Registration is not necessary but appreciated. See details below. * Bruce Lewis will speak about OurDoings < http://OurDoings.com/ >, a web site that solves the problem faced by people who take a lot of pictures, but don't have much time to share them online. Its approach to the problem is straightforward, but unique. In this talk, Bruce will use the OurDoings web site as context in which to explain how macros enable a kind of abstraction that functions do not, and how this form of abstraction is useful in common problems that thousands of programmers face. Bruce Lewis left the Lisp world after completing MIT 6.001 (Structure and Interpetation of Computer Programs) in Spring, 1987. Ten years later, seeking a better way to write database-driven web applications, he created BRL, the "Beautiful Report Language", an alternative to Perl ("Practical Extraction and Report Language") that dominated web development at the time. Bruce lives in Beverly, Massachusetts with his wife and three children. * * Richard Kreuter will speak about Defsystems and deliverables, or, unary REQUIRE for the win! Common Lisp users have employed a succession of system construction tools ("defsystems") over the years. Howsoever good a defsystem tool might be, overuse of system construction tools creates needless technical and social problems in the community and confounds newcomer and professional alike. This presentation will cover some of the drawbacks of the traditional uses of defsystems, and proposes some approaches to deploying Lisp software intended to make Lisp library usage more tractable than defsystems make it. Richard Kreuter is a software developer in the Boston area. He has worked on Steel Bank Common Lisp, driven himself nuts by too much reading of the Common Lisp standard, and is likely to be the last person on earth who thinks CL's pathnames still are a good idea. * * * Having observed the success of the formula at ILC'2009, we have instituted Lightning Talks at the Boston Lisp Meeting. At every meeting, before the main talk, there are two slots for strictly timed 5-minute talks followed by 2-minute for questions and answers. The slots for next Monday are still open. Step up and come talk about your pet project! * * * * The Lisp Meeting will take place on Monday June 29th 2009 at 1800 (6pm) at MIT, Room 34-401B. As the numbers indicate, the room is in Building 34, on the 4th floor. This is the usual location, on 50 Vassar Street, Cambridge. MIT map: http://whereis.mit.edu/bin/map?selection=34 Google map: http://maps.google.com/maps?q=50+Vassar+St,+Cambridge,+MA+02139,+USA Many thanks go to Alexey Radul for arranging for the room, and to MIT for welcoming us. * * * * * Dinner: ITA Software, a fine employer of Lisp hackers (disclaimer: I work there), is kindly purchasing a buffet to accompany our monthly Boston Lisp meeting. Anyone who attends is welcome to partake. We appreciate it if you let us know you're coming, and what food taboos you have, so that we can order the correct amount of food. Tell us by sending email to boston-lisp-meeting-register at common-lisp.net. We won't send any acknowledgement unless requested; importantly, we'll keep your identity and address confidential and won't communicate any such information to anyone, not even to our sponsors. * * * * * * The previous Boston Lisp Meeting on May 26th had 40 participants. Norman Ramsey gave a talk about Using Higher-Order Functions and Continuation-Passing Style to Make Dataflow Optimization Simple. In the near future, we expect to have Bruce Lewis on 2009-07-27 about BRL http://brl.codesimply.net and ourdoings.com, Emmanuel Schanzer on 2009-08-31 about BootstrapWorld.org, and Christine Flood on some undetermined date about Fortress http://projectfortress.sun.com * * * * * * * We're always looking for more speakers. The call for speakers and all the other details are at http://fare.livejournal.com/120393.html Also sought are volunteers to give Lightning Talks http://fare.livejournal.com/143723.html For more information, see our web site boston-lisp.org. For posts related to the Boston Lisp meetings in general, follow this link: http://fare.livejournal.com/tag/boston-lisp-meeting or subscribe to our RSS feed: http://fare.livejournal.com/data/rss?tag=boston-lisp-meeting Please forward this information to people you think would be interested. Please accept my apologies for your receiving this message multiple times. My apologies if this announce gets posted to a list where it shouldn't, or fails to get posted to a list where it should. Feedback welcome by private email reply to fare at tunes.org. From beratn at gmail.com Sat Jul 18 12:16:11 2009 From: beratn at gmail.com (=?UTF-8?Q?emre_berat_nebio=C4=9Flu?=) Date: Sat Jul 18 12:16:31 2009 Subject: [plt-scheme] Question about FIWAE Message-ID: Hey i read PLAI chapter 4.And i dont understand 100 percentage why FIWAE and Fundef define seperately.Can someone explain me thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090718/08b22f02/attachment.htm From sk at cs.brown.edu Sat Jul 18 13:18:04 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sat Jul 18 13:25:50 2009 Subject: [plt-scheme] Question about FIWAE In-Reply-To: References: Message-ID: Good question. Here is a hint. An F1WAE is an *expression*. A Fundef is a function *definition*. A function definition (in the first-order language) is not an expression. A further hint: as you read further, you'll see that the language ceases to be first-order and, simultaneously, the expression language contains a way to define functions. Shriram On Sat, Jul 18, 2009 at 12:16 PM, emre berat nebio?lu wrote: > Hey i read PLAI chapter 4.And i dont understand 100 percentage why FIWAE and > Fundef define seperately.Can someone explain me thanks. > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From canerderici at gmail.com Sat Jul 18 14:58:04 2009 From: canerderici at gmail.com (Caner Derici) Date: Sat Jul 18 15:05:42 2009 Subject: [plt-scheme] Online Scheme Programming Environment Message-ID: <4A621B3C.90403@gmail.com> Hi! I'm starting a dissertation study whose subject is online scheme programming environment. Such that; you can write scheme programs, run or store them on it, just like you do with you local DrScheme IDE. More precisely, I'm thinking to implement an R6RS compliant, fully functional Scheme interpreter which has proper tail-recursion and first-class continuations, with Javascript. I started with examining SISC (http://sisc-scheme.org/). It is R5RS compliant Scheme interpreter written in Java. But I need some guidelines, since it is my first really big dissertation study. So I have two questions: 1 - What would be the first thing comes to your mind about this, or your first expectation from this application?? (i.e. to have complete Planet libraries working on it) 2 - Do you have any suggestions, guidelines or daunts:) for your answer to 1?? Any ideas or advices are greatly welcome. Regards, Caner From sk at cs.brown.edu Sat Jul 18 15:38:53 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sat Jul 18 15:39:30 2009 Subject: [plt-scheme] Online Scheme Programming Environment In-Reply-To: <4A621B3C.90403@gmail.com> References: <4A621B3C.90403@gmail.com> Message-ID: Hi Caner, We have implemented most of this at Brown. We'll be demonstrating it at the Scheme Workshop in August, if not sooner. In addition to the client side, we also have server-side support implemented using Google App Engine, and are trying out an innovative editor. If you are interested in getting involved in our effort, let me know. We have plenty of room for collaboration, and by building on our infrastructure you wouldn't need to start from scratch. Shriram From jmj at fellowhuman.com Sat Jul 18 16:16:25 2009 From: jmj at fellowhuman.com (Jordan Johnson) Date: Sat Jul 18 16:16:44 2009 Subject: [plt-scheme] read-special Message-ID: <6CADF6F4-E688-4747-86B0-2D4436051EDD@fellowhuman.com> Hi all, I've been looking at readable-snip<%> and the manual page for snip%, which instructions "To define a class of snips that read specially with open-input-text-editor", and wondering: when is this used, and is there a more precise definition of "special" that's appropriate here? (I'm guessing from number-snip.ss and scheme.ss in framework/private/ that it's used for creating expressions when the containing editor is parsed into an AST, but, well, that's a guess.) Thanks, Jordan From matthias at ccs.neu.edu Sat Jul 18 19:58:06 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sat Jul 18 19:58:42 2009 Subject: [plt-scheme] read-special In-Reply-To: <6CADF6F4-E688-4747-86B0-2D4436051EDD@fellowhuman.com> References: <6CADF6F4-E688-4747-86B0-2D4436051EDD@fellowhuman.com> Message-ID: <6FCD9DCD-0EF4-440D-8E7F-7797B82BE987@ccs.neu.edu> On Jul 18, 2009, at 4:16 PM, Jordan Johnson wrote: > Hi all, > > I've been looking at readable-snip<%> and the manual page for snip > %, which instructions "To define a class of snips that read > specially with open-input-text-editor", and wondering: when is > this used, and is there a more precise definition of "special" > that's appropriate here? The image library for HtDP languages uses this stuff. I have been almost done with a matrix library based on the same idea for, oh, two years now. -- Matthias > > (I'm guessing from number-snip.ss and scheme.ss in framework/ > private/ that it's used for creating expressions when the > containing editor is parsed into an AST, but, well, that's a guess.) > > Thanks, > Jordan > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From tom at zwizwa.be Sun Jul 19 05:01:51 2009 From: tom at zwizwa.be (Tom Schouten) Date: Sun Jul 19 05:02:13 2009 Subject: [plt-scheme] 'eval at expansion time Message-ID: <20090719090151.GA30159@giebrok.zwizwa.be> Dear list, I've read a number of posts on this list about replacing the need for 'eval by appropriate use of macros. Overall, I've found the way macros are used in PLT Scheme fascinating, and it has been a good guide to clarify some practical problems I've been struggling with in the past. However, recently I've run into a pattern that confuses me. It has to do with the observation that 'eval seems to sometimes be the simplest way to turn source code into an informative data structure at macro expansion time, such that this can then be used as extra input to a syntax transformation. (Abstract Interpretation) While this feels like a necessary use since 'eval actually does something that can only be mimicked by implementing something like 'eval, it also feels like a dirty hack in a way I can't really describe. Concretely, this is about a macro that compiles a dataflow language to Scheme. The input syntax is interpreted twice: once to construct a simplified interpretation as a dependency graph, which is then used to sort a list of subforms in the original syntax so it can be expanded a second time into a serial Scheme program. Concrete code for the two stages can be found here [1][2]. I use 'eval together with namespace anchors to implement this. I guess I'm looking for a name for this pattern or a reason to not use 'eval. It seems that any alternative would involve higher order macros in a way I don't quite grasp.. Ideas welcome, Tom [1] http://zwizwa.be/darcs/staapl/staapl/machine/dfl.ss [2] http://zwizwa.be/darcs/staapl/staapl/machine/dfl-compose.ss From mflatt at cs.utah.edu Sun Jul 19 08:10:18 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sun Jul 19 08:10:40 2009 Subject: [plt-scheme] 'eval at expansion time In-Reply-To: <20090719090151.GA30159@giebrok.zwizwa.be> References: <20090719090151.GA30159@giebrok.zwizwa.be> Message-ID: <20090719121020.7C93A65012B@mail-svr1.cs.utah.edu> At Sun, 19 Jul 2009 11:01:51 +0200, Tom Schouten wrote: > Concretely, this is about a macro that compiles a dataflow language to > Scheme. The input syntax is interpreted twice: once to construct a > simplified interpretation as a dependency graph, which is then used to > sort a list of subforms in the original syntax so it can be expanded a > second time into a serial Scheme program. Concrete code for the two > stages can be found here [1][2]. I use 'eval together with namespace > anchors to implement this. > > I guess I'm looking for a name for this pattern or a reason to not use > 'eval. It seems that any alternative would involve higher order > macros in a way I don't quite grasp.. If I understand, then the following little program (in two modules) is analogous to yours. It defines a `show' form that takes an expression `e' to evaluate at compile time, and it prints the quoted form of `e' followed by is compile-time result. The compile-time form can use a `plus' binding, which stands for any sort of binding that you might like to use during compile-time evaluation: ---------------------------------------- ;; "arith-ct.ss" #lang scheme/base (define (plus a b) (+ a b)) (define-namespace-anchor a) (define (show* e) (eval e (namespace-anchor->namespace a))) (provide show*) ;; use-arith.ss: #lang scheme (require (for-syntax "arith-ct.ss")) (define-syntax (show stx) (syntax-case stx () [(_ e) (with-syntax ([v (show* #'e)]) #`(printf "~s yields ~s\n" 'e 'v))])) (show (plus 1 2)) ;; expands to (printf "~s yields ~s\n" '(plus 1 2) '3) ---------------------------------------- Here's how I'd implement the `show' form, instead: ---------------------------------------- ;; "arith.ss" #lang scheme (define-for-syntax (plus a b) (+ a b)) (define-syntax (show stx) (syntax-case stx () [(_ e) #'(let-syntax ([exp (lambda (stx) (with-syntax ([v e]) #`(printf "~s yields ~s\n" 'e 'v)))]) (exp))])) (show (plus 1 2)) ;; expands to (printf "~s yields ~s\n" '(plus 1 2) '3) ;; To use `show' outside this module, we need to ;; export `for-syntax' any bindings intended ;; to be used within `show' expressions: (provide show (for-syntax plus)) ---------------------------------------- This second implementation expands (show e) to (let-syntax ([(exp) .... e ....]) (exp)) where `e' is in an expression position in the right-hand size of the `let-syntax', so it gets evaluated at expansion time. The main trick is to invent a local name (in this case `exp') to house the expand-time expression and trigger its evaluation in an expression position. As you suggest, this approach requires a macro-generating `show', which is in some sense a "higher order macro". For a problem like this, I'd avoid `eval' because the other approach composes better. Consider a module that imports `show', but also adds its own compile-time extension `times': #lang scheme (require "arith.ss") (define-for-syntax (times a b) (* a b)) (show (plus 1 (times 2 3))) This wouldn't work if "arith.ss" were replaced by "use-arith.ss", because the `eval' in "arith-ct.ss" wouldn't know where to find the module that has the `times' binding. The problem is that module is in the process of being compiled, and so it hasn't been registered for reflective operations like `eval'. Your example doesn't seem to involve any bindings like `plus' or `times', and, offhand, I can't think of another concrete reason that "arith.ss" is better than "arith-ct.ss" plus "use-arith.ss". Less concretely, though, the reflection in the latter seems to me more difficult to reason about. (As it turns out, I correctly predicted that the `times' example would not work with "use-arith.ss", but I mispredicted the specific reason.) I hope I've understood your actual problem well enough that the above examples are relevant. Matthew From pivanyi at freemail.hu Sun Jul 19 17:28:13 2009 From: pivanyi at freemail.hu (Ivanyi Peter) Date: Sun Jul 19 17:35:11 2009 Subject: [plt-scheme] editor behaviour Message-ID: Hi, I have upgraded my PLT-Scheme to version 4.2. In my program I have used to write into an editor% in the following way: (let ( (ed (send window get-editor)) ) (send ed lock #f) (send ed move-position 'end #f 'simple) (send ed insert text) (send ed lock #t) ) (I wanted to write to the end of the editor.) With the new version of PLT-Scheme it does not "exactly" work as it used to do. It does some sort of buffering. It does not write the text into the editor immediately. Has anything changed? How should I do it "properly", if this is not the right way? Thanks for any help. Best regards, Peter Ivanyi From spamme at innerpaths.net Sun Jul 19 18:07:46 2009 From: spamme at innerpaths.net (Gregg Williams) Date: Sun Jul 19 18:08:07 2009 Subject: [plt-scheme] Re: Newbie question: picking the right data structure In-Reply-To: References: Message-ID: <47d471c3-44bc-4ae6-ab9a-54327b7b3e99@u38g2000pro.googlegroups.com> Thanks to both of you for your quick responses--they pointed me in the right direction, and I was able to move on to doing some useful programming. I had forgotten about set!, largely because I thought it had been deprecated in R6RS. Also, the mention of threads led me to read some documentation that was new to me. Thanks again for the help! The community here is much nicer than your Common Lisp counterparts, which is one of the main reasons I went with Scheme instead. On Jul 18, 7:03?am, Gregg Williams wrote: > Hi! I'm fairly new at Scheme, though I have written a number of > programs in the functional style with no problem. However, I'm hitting > a blind spot and would like somebody's opinion. > > I want to use Scheme to create an interactive environment for > exploring a data set (i.e., from the command line). Each datum is > represented by a string that I use as a key, so I will be building up > various named lists of strings and adding to them. > > Here's my problem: I can't seem to find a good way to add strings to a > list identified by a fixed variable name. I can't seem to use "define" > to overwrite the variable with a new list. I could use a vector, but > that would waste a lot of space if I made all vectors long enough for > practical purposes. I looked into using mutable lists, but > destructively splicing a second list onto the list connected to my > veritable name has repercussions. > > Am I missing something obvious, or do I have to just choose one of > these options and deal with the consequences? Thanks for your help. > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From lfsxs0 at gmail.com Sun Jul 19 18:38:39 2009 From: lfsxs0 at gmail.com (=?iso-8859-1?Q?Lu=EDs?= Fernando Schultz Xavier da Silveira) Date: Sun Jul 19 18:49:11 2009 Subject: [plt-scheme] Implementation of define-struct Message-ID: <20090719223839.GH3180@schultz-laptop> I have a very simple (and probably stupid) question I can't figure out. Assuming the define-struct feature is not a core form, how is it it defines names based on a macro argument? For instance, (define-struct point (x y)) generates point?, make-point, point-x and point-y. But how exactly is it I can create a macro that will define bindings whose names are derived from its arguments? Thanks in advance, Lu?s Fernando From ryanc at ccs.neu.edu Sun Jul 19 20:26:11 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Sun Jul 19 20:26:41 2009 Subject: [plt-scheme] Implementation of define-struct In-Reply-To: <20090719223839.GH3180@schultz-laptop> References: <20090719223839.GH3180@schultz-laptop> Message-ID: <4A63B9A3.3040306@ccs.neu.edu> Lu?s Fernando Schultz Xavier da Silveira wrote: > I have a very simple (and probably stupid) question I can't figure > out. Assuming the define-struct feature is not a core form, how is it > it defines names based on a macro argument? > > For instance, (define-struct point (x y)) generates point?, make-point, > point-x and point-y. But how exactly is it I can create a macro that > will define bindings whose names are derived from its arguments? It cannot be done with just 'syntax-rules' macros. You need to be able to work with the syntax objects (the representation of programs, macro arguments, etc) directly. An introduction to general (or "procedural") macro transformers is here: http://docs.plt-scheme.org/guide/proc-macros.html -- Here's a similar, but simpler, macro that defines other names not given as arguments to the macro but based on an argument to the macro: ;; (define/get+set name expr) defines 'name' as a variable, ;; 'get-name' as a procedure that returns the variable's value, ;; and 'set-name!' as a procedure that updates the variable ;; with a new value. First, this requires programming "for syntax", so: (require (for-syntax scheme/base)) Second, this task requires constructing new symbols, so here's a helpful function. It is a *compile-time* auxiliary function; if the 'begin-for-syntax' were deleted, it would be a *run-time* function, and it couldn't be used inside of the macro. (See "Compile and Run-Time Phases" for more information.) (begin-for-syntax ;; format-symbol : format-string any ... -> symbol (define (format-symbol fmt . args) (string->symbol (apply format fmt args)))) Next thing is to write auxiliaries that construct the new identifiers you want to introduce. An identifier is just a syntax object containing a symbol; that gives you a way to create new ones based on old ones. (begin-for-syntax ;; make-getter : identifier -> identifier (define (make-getter name) (datum->syntax name (format-symbol "get-~a" (syntax-e name)))) ;; make-setter : identifier -> identifier (define (make-setter name) (datum->syntax name (format-symbol "set-~a!" (syntax-e name))))) Above, 'syntax-e' extracts the symbol. After the new symbol is constructed, 'datum->syntax' wraps it up again as a syntax object. There is important extra information that goes in a syntax object. In this case, 'datum->syntax' transfers that information from its first argument, the original identifier. Here's the rest of the macro: (define-syntax (define/get+set stx) (syntax-case stx () [(define/get+set name value) (with-syntax ([getter (make-getter #'name)] [setter (make-setter #'name)]) #'(begin (define name value) (define (getter) name) (define (setter new-value) (set! name new-value))))])) Try it out: > (define/get+set foo 12) > (get-foo) 12 > (set-foo! 34) > (get-foo) 34 > foo 34 Ryan From lfsxs0 at gmail.com Sun Jul 19 22:44:31 2009 From: lfsxs0 at gmail.com (=?iso-8859-1?Q?Lu=EDs?= Fernando Schultz Xavier da Silveira) Date: Sun Jul 19 22:46:48 2009 Subject: [plt-scheme] Implementation of define-struct In-Reply-To: <4A63B9A3.3040306@ccs.neu.edu> References: <20090719223839.GH3180@schultz-laptop> <4A63B9A3.3040306@ccs.neu.edu> Message-ID: <20090720024431.GI3180@schultz-laptop> Thank you very, very much for the help. It was really useful and I really appreciated it. On Sun, Jul 19, 2009 at 08:26:11PM -0400, Ryan Culpepper wrote: > Lu?s Fernando Schultz Xavier da Silveira wrote: >> I have a very simple (and probably stupid) question I can't figure >> out. Assuming the define-struct feature is not a core form, how is it >> it defines names based on a macro argument? >> For instance, (define-struct point (x y)) generates point?, make-point, >> point-x and point-y. But how exactly is it I can create a macro that >> will define bindings whose names are derived from its arguments? > > It cannot be done with just 'syntax-rules' macros. You need to be able to > work with the syntax objects (the representation of programs, macro > arguments, etc) directly. An introduction to general (or "procedural") > macro transformers is here: > > http://docs.plt-scheme.org/guide/proc-macros.html > > -- > > Here's a similar, but simpler, macro that defines other names not given as > arguments to the macro but based on an argument to the macro: > > ;; (define/get+set name expr) defines 'name' as a variable, > ;; 'get-name' as a procedure that returns the variable's value, > ;; and 'set-name!' as a procedure that updates the variable > ;; with a new value. > > First, this requires programming "for syntax", so: > > (require (for-syntax scheme/base)) > > Second, this task requires constructing new symbols, so here's a helpful > function. It is a *compile-time* auxiliary function; if the > 'begin-for-syntax' were deleted, it would be a *run-time* function, and it > couldn't be used inside of the macro. (See "Compile and Run-Time Phases" > for more information.) > > (begin-for-syntax > ;; format-symbol : format-string any ... -> symbol > (define (format-symbol fmt . args) > (string->symbol (apply format fmt args)))) > > Next thing is to write auxiliaries that construct the new identifiers you > want to introduce. An identifier is just a syntax object containing a > symbol; that gives you a way to create new ones based on old ones. > > (begin-for-syntax > ;; make-getter : identifier -> identifier > (define (make-getter name) > (datum->syntax name (format-symbol "get-~a" (syntax-e name)))) > ;; make-setter : identifier -> identifier > (define (make-setter name) > (datum->syntax name (format-symbol "set-~a!" (syntax-e name))))) > > Above, 'syntax-e' extracts the symbol. After the new symbol is constructed, > 'datum->syntax' wraps it up again as a syntax object. There is important > extra information that goes in a syntax object. In this case, > 'datum->syntax' transfers that information from its first argument, the > original identifier. > > Here's the rest of the macro: > > (define-syntax (define/get+set stx) > (syntax-case stx () > [(define/get+set name value) > (with-syntax ([getter (make-getter #'name)] > [setter (make-setter #'name)]) > #'(begin (define name value) > (define (getter) name) > (define (setter new-value) > (set! name new-value))))])) > > Try it out: > > > (define/get+set foo 12) > > (get-foo) > 12 > > (set-foo! 34) > > (get-foo) > 34 > > foo > 34 > > Ryan From robby at eecs.northwestern.edu Sun Jul 19 22:54:05 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sun Jul 19 22:54:27 2009 Subject: [plt-scheme] editor behaviour In-Reply-To: References: Message-ID: <932b2f1f0907191954y27ffd7d7r2e00c02ff0356e2@mail.gmail.com> I don't think that there is any (intentional) buffering going on in those methods. Perhaps you could supply a (short) complete program that illustrates the problem? That would be a big help. And yes, there were big changes in the editor classes in 4.2, so you might have found a bug. There have been a few fixed since 4.2, so a simpler thing might be just trying your program in the latest nightly build. Robby 2009/7/19 Ivanyi Peter : > Hi, > > I have upgraded my PLT-Scheme to version 4.2. > In my program I have used to write into an editor% in the > following way: > > ?(let > ? ?( (ed (send window get-editor)) ) > ? ?(send ed lock #f) > ? ?(send ed move-position 'end #f 'simple) > ? ?(send ed insert text) > ? ?(send ed lock #t) > ?) > > (I wanted to write to the end of the editor.) > With the new version of PLT-Scheme it does not "exactly" work > as it used to do. It does some sort of buffering. It does not > write the text into the editor immediately. > > Has anything changed? > How should I do it "properly", if this is not the right way? > > Thanks for any help. > > Best regards, > > Peter Ivanyi > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From tom at zwizwa.be Mon Jul 20 06:16:47 2009 From: tom at zwizwa.be (Tom Schouten) Date: Mon Jul 20 06:17:07 2009 Subject: [plt-scheme] 'eval at expansion time In-Reply-To: <20090719121020.7C93A65012B@mail-svr1.cs.utah.edu> References: <20090719090151.GA30159@giebrok.zwizwa.be> <20090719121020.7C93A65012B@mail-svr1.cs.utah.edu> Message-ID: <20090720101647.GE30159@giebrok.zwizwa.be> > (define-syntax (show stx) > (syntax-case stx () > [(_ e) > #'(let-syntax ([exp > (lambda (stx) > (with-syntax ([v e]) > #`(printf "~s yields ~s\n" 'e 'v)))]) > (exp))])) ... > > where `e' is in an expression position in the right-hand size of the > `let-syntax', so it gets evaluated at expansion time. The main trick is > to invent a local name (in this case `exp') to house the expand-time > expression and trigger its evaluation in an expression position. > Exactly what I was looking for. > As you suggest, this approach requires a macro-generating `show', which > is in some sense a "higher order macro". Looks like "higher order macro" isn't really a good term for this. I'm not sure where I saw it used. Does the term mean something different? > Your example doesn't seem to involve any bindings like `plus' or > `times', and, offhand, I can't think of another concrete reason that > "arith.ss" is better than "arith-ct.ss" plus "use-arith.ss". Less > concretely, though, the reflection in the latter seems to me more > difficult to reason about. I see. Thanks for clarifying! Tom From mister.light at gmail.com Mon Jul 20 07:54:09 2009 From: mister.light at gmail.com (misterlight) Date: Mon Jul 20 07:54:27 2009 Subject: Fwd: [plt-scheme] No ODBC for DrScheme? In-Reply-To: <8640b0030907200453re17032en175cffa0a2c0ea6@mail.gmail.com> References: <8640b0030907160135u6dfa148cp806e9f52d93c3477@mail.gmail.com> <8640b0030907162305w362e960dkea0af3f0b07ad9d1@mail.gmail.com> <8640b0030907200453re17032en175cffa0a2c0ea6@mail.gmail.com> Message-ID: <8640b0030907200454t5579e26apf9cda000d66fe294@mail.gmail.com> Thanks a lot! Now I'm trying to use MysterX with the ADODB.Connection COM object. In this way I should be able to use the ODBC connection without too much pain. When I'll have some spare time I'd like to investigate the FFI usign your example. Kind regards, ml From pivanyi at freemail.hu Mon Jul 20 09:10:11 2009 From: pivanyi at freemail.hu (Ivanyi Peter) Date: Mon Jul 20 09:10:44 2009 Subject: [plt-scheme] editor behaviour In-Reply-To: <932b2f1f0907191954y27ffd7d7r2e00c02ff0356e2@mail.gmail.com> Message-ID: Robby Findler ?rta: I don't think that there is any (intentional) buffering going on in those methods. Perhaps you could supply a (short) complete program that illustrates the problem? That would be a big help. Hi Robby, Ok I try to reproduce it. Until then here is another problem with the editor, that I had noticed Execute the code below. Press any key in the window four times, until the scroll bar is activated. The first seven lines disappear and I cannot bring it back. This is on Windows XP SP3, PLT-Scheme 4.2. Best regards, Peter Ivanyi ---------------------------------------------------------- #lang scheme (require (lib "class.ss") (lib "mred.ss" "mred") (lib "framework.ss" "framework") ) (define (sx-history-entry-new parent) (let* ( (editor (new text%)) (canvas (new editor-canvas% (parent parent) (editor editor) (style '(control-border)) ) ) ) ; we set the tab positions (send editor set-tabs '(100 200 300 400 500 600 700 800 900 1000 100) 1 #t) (send editor lock #t) (send editor hide-caret #t) (send canvas scroll-with-bottom-base #t) canvas ) ) (define (sx-history-entry-add window text) (let ( (ed (send window get-editor)) ) (send ed lock #f) (send ed move-position 'end #f 'simple) (send ed insert text) (send ed lock #t) ) ) (letrec ((sx-history-window% (class frame% (define/override (on-subwindow-char window event) (display "bingo\n") (sx-history-entry-add ed "Hello World\n") #t ) (super-instantiate ()) ) ) (win (new sx-history-window% (label "test") (width 200) (height 200))) (ed (sx-history-entry-new win)) ) (send win show #t) ) From matthias at ccs.neu.edu Mon Jul 20 10:12:17 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Jul 20 10:12:52 2009 Subject: [plt-scheme] 'eval at expansion time In-Reply-To: <20090720101647.GE30159@giebrok.zwizwa.be> References: <20090719090151.GA30159@giebrok.zwizwa.be> <20090719121020.7C93A65012B@mail-svr1.cs.utah.edu> <20090720101647.GE30159@giebrok.zwizwa.be> Message-ID: <23B1DFA0-F95A-4E80-AE5B-DA7AD4008541@ccs.neu.edu> macro generating macro? staged macro? On Jul 20, 2009, at 6:16 AM, Tom Schouten wrote: >> (define-syntax (show stx) >> (syntax-case stx () >> [(_ e) >> #'(let-syntax ([exp >> (lambda (stx) >> (with-syntax ([v e]) >> #`(printf "~s yields ~s\n" 'e 'v)))]) >> (exp))])) > > ... > >> >> where `e' is in an expression position in the right-hand size of the >> `let-syntax', so it gets evaluated at expansion time. The main >> trick is >> to invent a local name (in this case `exp') to house the expand-time >> expression and trigger its evaluation in an expression position. >> > > Exactly what I was looking for. > >> As you suggest, this approach requires a macro-generating `show', >> which >> is in some sense a "higher order macro". > > Looks like "higher order macro" isn't really a good term for this. > I'm not sure where I saw it used. Does the term mean something > different? > >> Your example doesn't seem to involve any bindings like `plus' or >> `times', and, offhand, I can't think of another concrete reason that >> "arith.ss" is better than "arith-ct.ss" plus "use-arith.ss". Less >> concretely, though, the reflection in the latter seems to me more >> difficult to reason about. > > I see. > > Thanks for clarifying! > > Tom > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From keiko at kurims.kyoto-u.ac.jp Mon Jul 20 09:23:29 2009 From: keiko at kurims.kyoto-u.ac.jp (Keiko Nakata) Date: Mon Jul 20 10:14:30 2009 Subject: [plt-scheme] circular definitions Message-ID: <20090720.222329.68531175.keiko@kurims.kyoto-u.ac.jp> Hello. What is the motivation to treat circular definitions differently between top-level definitions and local letrec's? I mean: ;This causes an error immediately. (define x0 x0) ;This does not cause an error. (define x1 (letrec ([tmp tmp]) tmp)) ;This does not cause an error too. (define-signature u^ (x2)) (define-unit u@ (import) (export u^) (define x2 x2)) (define-values/invoke-unit/infer u@) The third example particularly motivated me to think about why the different treatment is necessary/preferable in respect of the implementation and the language design. Best, Keiko From matthias at ccs.neu.edu Mon Jul 20 10:33:12 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Jul 20 10:33:53 2009 Subject: [plt-scheme] circular definitions In-Reply-To: <20090720.222329.68531175.keiko@kurims.kyoto-u.ac.jp> References: <20090720.222329.68531175.keiko@kurims.kyoto-u.ac.jp> Message-ID: <516B8EC8-51A6-427E-B132-2E42BC13B13A@ccs.neu.edu> On Jul 20, 2009, at 9:23 AM, Keiko Nakata wrote: > Hello. > What is the motivation to treat circular definitions differently > between top-level definitions and local letrec's? > I mean: > > ;This causes an error immediately. > (define x0 x0) > One could argue that the following two are (unreported) errors due to an overly accommodating syntax. -- Matthias p.s. Try this in HtDP/Intermediate: (define x (local ((define x x)) x)) > ;This does not cause an error. > (define x1 (letrec ([tmp tmp]) tmp)) > > ;This does not cause an error too. > (define-signature u^ (x2)) > (define-unit u@ (import) (export u^) (define x2 x2)) > (define-values/invoke-unit/infer u@) > > The third example particularly motivated me to think about why the > different treatment is necessary/preferable in respect of the > implementation and the language design. > > Best, > Keiko > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mflatt at cs.utah.edu Mon Jul 20 10:51:32 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Mon Jul 20 10:51:56 2009 Subject: [plt-scheme] editor behaviour In-Reply-To: References: Message-ID: <20090720145133.2E1996500C3@mail-svr1.cs.utah.edu> This is a bug related to `scroll-with-bottom-base', now fixed in SVN. (For similar reasons, `allow-scroll-to-last' wasn't working right.) At Mon, 20 Jul 2009 15:10:11 +0200 (CEST), Ivanyi Peter wrote: > > Robby Findler ?rta: > > I don't think that there is any (intentional) buffering going on in > those methods. Perhaps you could supply a (short) complete program > that illustrates the problem? That would be a big help. > > Hi Robby, > > Ok I try to reproduce it. > Until then here is another problem with the editor, that > I had noticed > Execute the code below. Press any key in the window > four times, until the scroll bar is activated. The first > seven lines disappear and I cannot bring it back. > This is on Windows XP SP3, PLT-Scheme 4.2. > > Best regards, > > Peter Ivanyi > > ---------------------------------------------------------- > #lang scheme > > (require (lib "class.ss") > (lib "mred.ss" "mred") > (lib "framework.ss" "framework") > ) > > > (define (sx-history-entry-new parent) > (let* > ( (editor (new text%)) > (canvas (new editor-canvas% (parent parent) > (editor editor) > (style '(control-border)) > ) > ) > ) > ; we set the tab positions > (send editor set-tabs '(100 200 300 400 500 600 700 800 900 1000 100) 1 #t) > (send editor lock #t) > (send editor hide-caret #t) > (send canvas scroll-with-bottom-base #t) > canvas > ) > ) > > (define (sx-history-entry-add window text) > (let > ( (ed (send window get-editor)) ) > (send ed lock #f) > (send ed move-position 'end #f 'simple) > (send ed insert text) > (send ed lock #t) > ) > ) > > > (letrec > ((sx-history-window% > (class frame% > (define/override (on-subwindow-char window event) > (display "bingo\n") > (sx-history-entry-add ed "Hello World\n") > #t > ) > (super-instantiate ()) > ) > ) > (win (new sx-history-window% (label "test") (width 200) (height 200))) > (ed (sx-history-entry-new win)) > ) > (send win show #t) > ) > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From pocmatos at gmail.com Mon Jul 20 11:56:07 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Jul 20 11:56:50 2009 Subject: [plt-scheme] Reference for PLT-Scheme for paper In-Reply-To: <932b2f1f0907040722y2f0e371i854719960294958b@mail.gmail.com> References: <11b141710907040707g5eb4b779jcaa0b9fe18fdb567@mail.gmail.com> <932b2f1f0907040722y2f0e371i854719960294958b@mail.gmail.com> Message-ID: <11b141710907200856y52b9d6f7h40b324108b99c6b7@mail.gmail.com> On Sat, Jul 4, 2009 at 3:22 PM, Robby Findler wrote: > The journal followup to that is the right reference for DrScheme (just > the PDE bit), but probably the best reference nowadays is probably one > of these: > > http://www.plt-scheme.org/techreports/ > I have to say I find it a bit strange that if you use the posted bib: @techreport{plt-tr2009-reference-v4.2, author = {Matthew Flatt and PLT Scheme}, title = {Reference: {PLT} Scheme}, number = {PLT-TR2009-reference-v4.2}, type = {Reference Manual}, institution = {PLT Scheme Inc.}, month = {June}, year = {2009}, url = {http://download.plt-scheme.org/doc/4.2/pdf/reference.pdf}, note = {\url{http://plt-scheme.org/techreports/}} } you end up with a line: Flatt, M., Scheme, P.: Reference: PLT scheme. Reference Manual PLT-TR2009- reference-v4.2, PLT Scheme Inc. (June 2009) http://plt-scheme.org/techreports/. I looked at the line and wondered for several seconds who Scheme, P. is? > Robby > > On Sat, Jul 4, 2009 at 9:07 AM, Paulo J. Matos wrote: >> Hi all, >> >> I am preparing a paper for ICFEM'09 regarding the implementation of an >> explicit model checker for Event-B completely written in PLT Scheme. >> What's the best reference for PLT-Scheme? It seems that the first >> occurence of PLT-Scheme / DrScheme is: >> http://dblp.uni-trier.de/rec/bibtex/conf/plilp/FindlerFFKF97 >> >> but I am not so sure that this is the current best reference for the >> PLT Scheme project. >> Any suggestions? >> >> Cheers, >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> http://www.pmatos.net >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From matthias at ccs.neu.edu Mon Jul 20 13:14:09 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Jul 20 13:14:46 2009 Subject: [plt-scheme] Reference for PLT-Scheme for paper In-Reply-To: <11b141710907200856y52b9d6f7h40b324108b99c6b7@mail.gmail.com> References: <11b141710907040707g5eb4b779jcaa0b9fe18fdb567@mail.gmail.com> <932b2f1f0907040722y2f0e371i854719960294958b@mail.gmail.com> <11b141710907200856y52b9d6f7h40b324108b99c6b7@mail.gmail.com> Message-ID: Paul? Peter? Penny? :-) This is indeed, a mistake. We should simply use et alii. On Jul 20, 2009, at 11:56 AM, Paulo J. Matos wrote: > On Sat, Jul 4, 2009 at 3:22 PM, Robby > Findler wrote: >> The journal followup to that is the right reference for DrScheme >> (just >> the PDE bit), but probably the best reference nowadays is probably >> one >> of these: >> >> http://www.plt-scheme.org/techreports/ >> > > I have to say I find it a bit strange that if you use the posted bib: > @techreport{plt-tr2009-reference-v4.2, > author = {Matthew Flatt and PLT Scheme}, > title = {Reference: {PLT} Scheme}, > number = {PLT-TR2009-reference-v4.2}, > type = {Reference Manual}, > institution = {PLT Scheme Inc.}, > month = {June}, > year = {2009}, > url = {http://download.plt-scheme.org/doc/4.2/pdf/reference.pdf}, > note = {\url{http://plt-scheme.org/techreports/}} > } > > you end up with a line: > Flatt, M., Scheme, P.: Reference: PLT scheme. Reference Manual PLT- > TR2009- > reference-v4.2, PLT Scheme Inc. (June 2009) http://plt-scheme.org/ > techreports/. > > > I looked at the line and wondered for several seconds who Scheme, > P. is? > >> Robby >> >> On Sat, Jul 4, 2009 at 9:07 AM, Paulo J. Matos >> wrote: >>> Hi all, >>> >>> I am preparing a paper for ICFEM'09 regarding the implementation >>> of an >>> explicit model checker for Event-B completely written in PLT Scheme. >>> What's the best reference for PLT-Scheme? It seems that the first >>> occurence of PLT-Scheme / DrScheme is: >>> http://dblp.uni-trier.de/rec/bibtex/conf/plilp/FindlerFFKF97 >>> >>> but I am not so sure that this is the current best reference for the >>> PLT Scheme project. >>> Any suggestions? >>> >>> Cheers, >>> >>> -- >>> Paulo Jorge Matos - pocmatos at gmail.com >>> http://www.pmatos.net >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >> > > > > -- > Paulo Jorge Matos - pocmatos at gmail.com > http://www.pmatos.net > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From egarrulo at gmail.com Mon Jul 20 13:23:12 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Mon Jul 20 13:23:32 2009 Subject: [plt-scheme] Cannot install hwiki.plt 1.15 on Ubuntu Linux 9.04 Message-ID: <9bd8a08a0907201023h718bd527mfda79dd06c214041@mail.gmail.com> Hi, I'm trying to install the HWiki package without success. I'm running DrScheme 4.2 on Ubuntu 9.04. The suggested line for installation is: > (require (planet "[file]" ("oesterholt" "hwiki.plt" 1 15))) but it gets rejected with: > planet: bad module path in: (planet "[file]" ("oesterholt" "hwiki.plt" 1 15)) Then, I've tried: > (require (planet "hwiki.scm" ("oesterholt" "hwiki.plt" 1 15))) which fails with: compile: unbound identifier in module setup-plt: error: during making for /oesterholt/roos.plt/1/9 (roos) setup-plt: compile: unbound identifier in module compile: unbound identifier in module setup-plt: error: during making for /oesterholt/sqlid.plt/1/5 (sqlid) setup-plt: compile: unbound identifier in module compile: unbound identifier in module setup-plt: error: during making for /oesterholt/hwiki.plt/1/15 (hwiki) setup-plt: compile: unbound identifier in module module: identifier is already imported module: identifier is already imported module: identifier is already imported setup-plt: error: during making for /schematics/port.plt/1/3 (port) setup-plt: module: identifier is already imported setup-plt: error: during making for /schematics/port.plt/1/3/scribblings setup-plt: module: identifier is already imported setup-plt: error: during Building docs for /home/internet/.plt-scheme/planet/300/4.2/cache/schematics/port.plt/1/3/scribblings/port.scrbl setup-plt: module: identifier is already imported module: identifier is already imported setup-plt: error: during making for /schematics/instaweb.plt/1/8 (instaweb) setup-plt: module: identifier is already imported compile: unbound identifier in module setup-plt: error: during making for /oesterholt/datastructs.plt/1/0 (datastructs) setup-plt: compile: unbound identifier in module compile: unbound identifier in module load-handler: expected a `module' declaration for `example-server' in #, but found something else setup-plt: error: during making for /oesterholt/mzrpc.plt/1/4 (mzrpc) setup-plt: compile: unbound identifier in module setup-plt: error: during making for /oesterholt/mzrpc.plt/1/4/examples setup-plt: load-handler: expected a `module' declaration for `example-server' in #, but found something else . ../../../.plt-scheme/planet/300/4.2/cache/oesterholt/datastructs.plt/1/0/fifo.scm:102:20: expand: unbound identifier in module in: set-cdr! Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090720/33e6ee3f/attachment.htm From pocmatos at gmail.com Mon Jul 20 13:34:25 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Jul 20 13:35:08 2009 Subject: [plt-scheme] Reference for PLT-Scheme for paper In-Reply-To: References: <11b141710907040707g5eb4b779jcaa0b9fe18fdb567@mail.gmail.com> <932b2f1f0907040722y2f0e371i854719960294958b@mail.gmail.com> <11b141710907200856y52b9d6f7h40b324108b99c6b7@mail.gmail.com> Message-ID: <11b141710907201034g27237805q1d079117d986f51f@mail.gmail.com> On Mon, Jul 20, 2009 at 6:14 PM, Matthias Felleisen wrote: > > Paul? Peter? Penny? :-) > > This is indeed, a mistake. We should simply use et alii. > > Problem is, afaik, the use of "et all" in bibtex doesn't depend on the user but on the style the conference supports. Unless you write et all, somehow directly on the bib. However, writing: author = {Matthew Flatt et all}, makes the author: et all, M.F. > > On Jul 20, 2009, at 11:56 AM, Paulo J. Matos wrote: > >> On Sat, Jul 4, 2009 at 3:22 PM, Robby >> Findler wrote: >>> >>> The journal followup to that is the right reference for DrScheme (just >>> the PDE bit), but probably the best reference nowadays is probably one >>> of these: >>> >>> http://www.plt-scheme.org/techreports/ >>> >> >> I have to say I find it a bit strange that if you use the posted bib: >> @techreport{plt-tr2009-reference-v4.2, >> ?author = {Matthew Flatt and PLT Scheme}, >> ?title = {Reference: {PLT} Scheme}, >> ?number = {PLT-TR2009-reference-v4.2}, >> ?type = {Reference Manual}, >> ?institution = {PLT Scheme Inc.}, >> ?month = {June}, >> ?year = {2009}, >> ?url = {http://download.plt-scheme.org/doc/4.2/pdf/reference.pdf}, >> ?note = {\url{http://plt-scheme.org/techreports/}} >> } >> >> you end up with a line: >> Flatt, M., Scheme, P.: Reference: PLT scheme. Reference Manual PLT-TR2009- >> reference-v4.2, PLT Scheme Inc. (June 2009) >> http://plt-scheme.org/techreports/. >> >> >> I looked at the line and wondered for several seconds who Scheme, P. is? >> >>> Robby >>> >>> On Sat, Jul 4, 2009 at 9:07 AM, Paulo J. Matos wrote: >>>> >>>> Hi all, >>>> >>>> I am preparing a paper for ICFEM'09 regarding the implementation of an >>>> explicit model checker for Event-B completely written in PLT Scheme. >>>> What's the best reference for PLT-Scheme? It seems that the first >>>> occurence of PLT-Scheme / DrScheme is: >>>> http://dblp.uni-trier.de/rec/bibtex/conf/plilp/FindlerFFKF97 >>>> >>>> but I am not so sure that this is the current best reference for the >>>> PLT Scheme project. >>>> Any suggestions? >>>> >>>> Cheers, >>>> >>>> -- >>>> Paulo Jorge Matos - pocmatos at gmail.com >>>> http://www.pmatos.net >>>> _________________________________________________ >>>> ?For list-related administrative tasks: >>>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>> >>> >> >> >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> http://www.pmatos.net >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From pocmatos at gmail.com Mon Jul 20 13:36:37 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Jul 20 13:37:19 2009 Subject: [plt-scheme] Reference for PLT-Scheme for paper In-Reply-To: <11b141710907201034g27237805q1d079117d986f51f@mail.gmail.com> References: <11b141710907040707g5eb4b779jcaa0b9fe18fdb567@mail.gmail.com> <932b2f1f0907040722y2f0e371i854719960294958b@mail.gmail.com> <11b141710907200856y52b9d6f7h40b324108b99c6b7@mail.gmail.com> <11b141710907201034g27237805q1d079117d986f51f@mail.gmail.com> Message-ID: <11b141710907201036h3026ad4flfb9bb697f43ddb68@mail.gmail.com> On Mon, Jul 20, 2009 at 6:34 PM, Paulo J. Matos wrote: > On Mon, Jul 20, 2009 at 6:14 PM, Matthias Felleisen wrote: >> >> Paul? Peter? Penny? :-) >> >> This is indeed, a mistake. We should simply use et alii. >> >> > > Problem is, afaik, the use of "et all" in bibtex doesn't depend on the > user but on the style the conference supports. Unless you write et > all, somehow directly on the bib. However, writing: > author = {Matthew Flatt et all}, > > makes the author: et all, M.F. > For my current deadline it will go as: author = {Matthew Flatt and \mbox{PLT Scheme}}, and shows up as: Flatt, M., PLT Scheme: Reference: PLT scheme. Reference Manual PLT-TR2009- reference-v4.2, PLT Scheme Inc. (June 2009) http://plt-scheme.org/techreports/. >> >> On Jul 20, 2009, at 11:56 AM, Paulo J. Matos wrote: >> >>> On Sat, Jul 4, 2009 at 3:22 PM, Robby >>> Findler wrote: >>>> >>>> The journal followup to that is the right reference for DrScheme (just >>>> the PDE bit), but probably the best reference nowadays is probably one >>>> of these: >>>> >>>> http://www.plt-scheme.org/techreports/ >>>> >>> >>> I have to say I find it a bit strange that if you use the posted bib: >>> @techreport{plt-tr2009-reference-v4.2, >>> ?author = {Matthew Flatt and PLT Scheme}, >>> ?title = {Reference: {PLT} Scheme}, >>> ?number = {PLT-TR2009-reference-v4.2}, >>> ?type = {Reference Manual}, >>> ?institution = {PLT Scheme Inc.}, >>> ?month = {June}, >>> ?year = {2009}, >>> ?url = {http://download.plt-scheme.org/doc/4.2/pdf/reference.pdf}, >>> ?note = {\url{http://plt-scheme.org/techreports/}} >>> } >>> >>> you end up with a line: >>> Flatt, M., Scheme, P.: Reference: PLT scheme. Reference Manual PLT-TR2009- >>> reference-v4.2, PLT Scheme Inc. (June 2009) >>> http://plt-scheme.org/techreports/. >>> >>> >>> I looked at the line and wondered for several seconds who Scheme, P. is? >>> >>>> Robby >>>> >>>> On Sat, Jul 4, 2009 at 9:07 AM, Paulo J. Matos wrote: >>>>> >>>>> Hi all, >>>>> >>>>> I am preparing a paper for ICFEM'09 regarding the implementation of an >>>>> explicit model checker for Event-B completely written in PLT Scheme. >>>>> What's the best reference for PLT-Scheme? It seems that the first >>>>> occurence of PLT-Scheme / DrScheme is: >>>>> http://dblp.uni-trier.de/rec/bibtex/conf/plilp/FindlerFFKF97 >>>>> >>>>> but I am not so sure that this is the current best reference for the >>>>> PLT Scheme project. >>>>> Any suggestions? >>>>> >>>>> Cheers, >>>>> >>>>> -- >>>>> Paulo Jorge Matos - pocmatos at gmail.com >>>>> http://www.pmatos.net >>>>> _________________________________________________ >>>>> ?For list-related administrative tasks: >>>>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>>> >>>> >>> >>> >>> >>> -- >>> Paulo Jorge Matos - pocmatos at gmail.com >>> http://www.pmatos.net >>> _________________________________________________ >>> ?For list-related administrative tasks: >>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > > > > -- > Paulo Jorge Matos - pocmatos at gmail.com > http://www.pmatos.net > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From egarrulo at gmail.com Mon Jul 20 13:43:50 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Mon Jul 20 13:44:31 2009 Subject: [plt-scheme] Web browsing package? Message-ID: <9bd8a08a0907201043x51230ec8r191057355673771f@mail.gmail.com> Hi, is there a package for automated web browsing, kind of Perl's WWW::Mechanize ( http://search.cpan.org/~petdance/WWW-Mechanize-1.58/lib/WWW/Mechanize.pm#SYNOPSIS) ? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090720/4da1527d/attachment.html From chust at web.de Mon Jul 20 14:01:19 2009 From: chust at web.de (Thomas Chust) Date: Mon Jul 20 14:01:39 2009 Subject: [plt-scheme] Reference for PLT-Scheme for paper In-Reply-To: <11b141710907201034g27237805q1d079117d986f51f@mail.gmail.com> References: <11b141710907040707g5eb4b779jcaa0b9fe18fdb567@mail.gmail.com> <932b2f1f0907040722y2f0e371i854719960294958b@mail.gmail.com> <11b141710907200856y52b9d6f7h40b324108b99c6b7@mail.gmail.com> <11b141710907201034g27237805q1d079117d986f51f@mail.gmail.com> Message-ID: <1c1a33bc0907201101h6bdcf9a9h5e963d303beded8d@mail.gmail.com> 2009/7/20 Paulo J. Matos : > [...] > Problem is, afaik, the use of "et all" in bibtex doesn't depend on the > user but on the style the conference supports. > [...] Hello, if I'm not mistaken, when the BibTeX entry contains "and others" in the author field, that string get's turned into "et al." or something else depending on the style. cu, Thomas -- When C++ is your hammer, every problem looks like your thumb. From pocmatos at gmail.com Mon Jul 20 14:22:29 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Jul 20 14:23:14 2009 Subject: [plt-scheme] Contract Error Message Message-ID: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> Hi all, I found an error message in a contract pretty strange and took me ages to understand my contract was wrong. However, it is strange that I get this message that provides no clue to the error. An example of the problem: #lang scheme/load (module hello scheme (define (xpto n) (build-list 10 (lambda (n) n))) (provide/contract [xpto ((or symbol? string?) . -> . (listof (or/c (symbol? string?))))])) (module caller scheme (require 'hello) (xpto 'hello)) The error: > (require 'caller) . 'hello broke the contract (-> symbol? (listof (or/c #f))) on xpto; expected <(listof (or/c #f))>, given: (0 1 2 3 4 5 6 7 8 9) The contract (listof (or/c #f)) confused me because I had no such contract. Only after a lot of digging I found that I had an extra set of parenthesis around the args in xpto contract: (or/c (symbol? string?)) Is it possible to improve this? -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From pocmatos at gmail.com Mon Jul 20 14:23:48 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Jul 20 14:24:29 2009 Subject: [plt-scheme] Reference for PLT-Scheme for paper In-Reply-To: <1c1a33bc0907201101h6bdcf9a9h5e963d303beded8d@mail.gmail.com> References: <11b141710907040707g5eb4b779jcaa0b9fe18fdb567@mail.gmail.com> <932b2f1f0907040722y2f0e371i854719960294958b@mail.gmail.com> <11b141710907200856y52b9d6f7h40b324108b99c6b7@mail.gmail.com> <11b141710907201034g27237805q1d079117d986f51f@mail.gmail.com> <1c1a33bc0907201101h6bdcf9a9h5e963d303beded8d@mail.gmail.com> Message-ID: <11b141710907201123k6bed18c8i8778d488e4938b3b@mail.gmail.com> On Mon, Jul 20, 2009 at 7:01 PM, Thomas Chust wrote: > 2009/7/20 Paulo J. Matos : >> [...] >> Problem is, afaik, the use of "et all" in bibtex doesn't depend on the >> user but on the style the conference supports. >> [...] > > Hello, > > if I'm not mistaken, when the BibTeX entry contains "and others" in > the author field, that string get's turned into "et al." or something > else depending on the style. > Thanks, you're right... changed to "and others". Cheers, Paulo Matos > cu, > Thomas > > > -- > When C++ is your hammer, every problem looks like your thumb. > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From carl.eastlund at gmail.com Mon Jul 20 14:28:40 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Mon Jul 20 14:29:21 2009 Subject: [plt-scheme] Contract Error Message In-Reply-To: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> References: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> Message-ID: <990e0c030907201128t3fff5d67l22c280ad8ca11492@mail.gmail.com> On Mon, Jul 20, 2009 at 2:22 PM, Paulo J. Matos wrote: > Hi all, > > I found an error message in a contract pretty strange and took me ages > to understand my contract was wrong. However, it is strange that I get > this message that provides no clue to the error. An example of the > problem: > #lang scheme/load > > (module hello scheme > ?(define (xpto n) > ? ?(build-list 10 (lambda (n) n))) > > ?(provide/contract > ? [xpto ((or symbol? string?) . -> . (listof (or/c (symbol? string?))))])) > > (module caller scheme > ?(require 'hello) > > ?(xpto 'hello)) > > The error: >> (require 'caller) > . 'hello broke the contract > ?(-> symbol? (listof (or/c #f))) > ?on xpto; expected <(listof (or/c #f))>, given: (0 1 2 3 4 5 6 7 8 9) > > The contract ?(listof (or/c #f)) confused me because I had no such > contract. Only after a lot of digging I found that I had an extra set > of parenthesis around the args in xpto contract: (or/c (symbol? > string?)) > > Is it possible to improve this? What you wrote was a perfectly acceptable contract that functioned perfectly, except that it wasn't the one you meant it to be. What alternate behavior would you propose? --Carl From matthias at ccs.neu.edu Mon Jul 20 14:32:20 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Jul 20 14:32:50 2009 Subject: [plt-scheme] Contract Error Message In-Reply-To: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> References: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> Message-ID: <85EEA4F9-5EF2-4410-B2E3-9D38392A8FC4@ccs.neu.edu> On Jul 20, 2009, at 2:22 PM, Paulo J. Matos wrote: > Is it possible to improve this? Not without serious restrictions on the contract language. -- Matthias From pocmatos at gmail.com Mon Jul 20 14:33:24 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Jul 20 14:34:05 2009 Subject: [plt-scheme] Contract Error Message In-Reply-To: <990e0c030907201128t3fff5d67l22c280ad8ca11492@mail.gmail.com> References: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> <990e0c030907201128t3fff5d67l22c280ad8ca11492@mail.gmail.com> Message-ID: <11b141710907201133t46e839b6n40c41b240e9aa234@mail.gmail.com> On Mon, Jul 20, 2009 at 7:28 PM, Carl Eastlund wrote: > > What you wrote was a perfectly acceptable contract that functioned > perfectly, except that it wasn't the one you meant it to be. ?What > alternate behavior would you propose? > > --Carl > Now you got me. Why is #f in the error message? -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From dvanhorn at ccs.neu.edu Mon Jul 20 14:35:13 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Mon Jul 20 14:35:41 2009 Subject: [plt-scheme] Contract Error Message In-Reply-To: <11b141710907201133t46e839b6n40c41b240e9aa234@mail.gmail.com> References: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> <990e0c030907201128t3fff5d67l22c280ad8ca11492@mail.gmail.com> <11b141710907201133t46e839b6n40c41b240e9aa234@mail.gmail.com> Message-ID: <4A64B8E1.8010309@ccs.neu.edu> Paulo J. Matos wrote: > On Mon, Jul 20, 2009 at 7:28 PM, Carl Eastlund wrote: >> What you wrote was a perfectly acceptable contract that functioned >> perfectly, except that it wasn't the one you meant it to be. What >> alternate behavior would you propose? >> >> --Carl >> > > Now you got me. Why is #f in the error message? (symbol? string?) => #f From pocmatos at gmail.com Mon Jul 20 14:35:59 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Jul 20 14:36:41 2009 Subject: [plt-scheme] Contract Error Message In-Reply-To: <4A64B8E1.8010309@ccs.neu.edu> References: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> <990e0c030907201128t3fff5d67l22c280ad8ca11492@mail.gmail.com> <11b141710907201133t46e839b6n40c41b240e9aa234@mail.gmail.com> <4A64B8E1.8010309@ccs.neu.edu> Message-ID: <11b141710907201135x2501b5f4qf64fb25098321897@mail.gmail.com> On Mon, Jul 20, 2009 at 7:35 PM, David Van Horn wrote: > Paulo J. Matos wrote: >> >> On Mon, Jul 20, 2009 at 7:28 PM, Carl Eastlund >> wrote: >>> >>> What you wrote was a perfectly acceptable contract that functioned >>> perfectly, except that it wasn't the one you meant it to be. ?What >>> alternate behavior would you propose? >>> >>> --Carl >>> >> >> Now you got me. Why is #f in the error message? > > (symbol? string?) => #f > Ahhh, that's a good one... means I need to sleep! :) Thanks! -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From dvanhorn at ccs.neu.edu Mon Jul 20 14:40:34 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Mon Jul 20 14:41:00 2009 Subject: [plt-scheme] Contract Error Message In-Reply-To: <990e0c030907201128t3fff5d67l22c280ad8ca11492@mail.gmail.com> References: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> <990e0c030907201128t3fff5d67l22c280ad8ca11492@mail.gmail.com> Message-ID: <4A64BA22.20704@ccs.neu.edu> Carl Eastlund wrote: > What you wrote was a perfectly acceptable contract that functioned > perfectly, except that it wasn't the one you meant it to be. What > alternate behavior would you propose? Actually, Paulo broke the contract on or/c, so this could have a better error message without changes to the contract language. David From matthias at ccs.neu.edu Mon Jul 20 14:45:09 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Jul 20 14:45:45 2009 Subject: [plt-scheme] Contract Error Message In-Reply-To: <4A64BA22.20704@ccs.neu.edu> References: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> <990e0c030907201128t3fff5d67l22c280ad8ca11492@mail.gmail.com> <4A64BA22.20704@ccs.neu.edu> Message-ID: <47DE48DE-0C02-4219-B6EA-4DC888450387@ccs.neu.edu> On Jul 20, 2009, at 2:40 PM, David Van Horn wrote: > Carl Eastlund wrote: >> What you wrote was a perfectly acceptable contract that functioned >> perfectly, except that it wasn't the one you meant it to be. What >> alternate behavior would you propose? > > Actually, Paulo broke the contract on or/c, so this could have a > better error message without changes to the contract language. Correct. The contract combinators could check that their arguments are functions of 1 argument. -- Matthias From sk at cs.brown.edu Mon Jul 20 14:47:21 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Mon Jul 20 14:48:22 2009 Subject: [plt-scheme] Contract Error Message In-Reply-To: <47DE48DE-0C02-4219-B6EA-4DC888450387@ccs.neu.edu> References: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> <990e0c030907201128t3fff5d67l22c280ad8ca11492@mail.gmail.com> <4A64BA22.20704@ccs.neu.edu> <47DE48DE-0C02-4219-B6EA-4DC888450387@ccs.neu.edu> Message-ID: Shouldn't they check that their arguments are *contracts*? On Mon, Jul 20, 2009 at 2:45 PM, Matthias Felleisen wrote: > > On Jul 20, 2009, at 2:40 PM, David Van Horn wrote: > >> Carl Eastlund wrote: >>> >>> What you wrote was a perfectly acceptable contract that functioned >>> perfectly, except that it wasn't the one you meant it to be. ?What >>> alternate behavior would you propose? >> >> Actually, Paulo broke the contract on or/c, so this could have a better >> error message without changes to the contract language. > > Correct. The contract combinators could check that their arguments are > functions of 1 argument. -- Matthias > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From carl.eastlund at gmail.com Mon Jul 20 14:47:23 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Mon Jul 20 14:48:27 2009 Subject: [plt-scheme] Contract Error Message In-Reply-To: <4A64BA22.20704@ccs.neu.edu> References: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> <990e0c030907201128t3fff5d67l22c280ad8ca11492@mail.gmail.com> <4A64BA22.20704@ccs.neu.edu> Message-ID: <990e0c030907201147g5df2b009n76dfb92c886dc1be@mail.gmail.com> On Mon, Jul 20, 2009 at 2:40 PM, David Van Horn wrote: > Carl Eastlund wrote: >> >> What you wrote was a perfectly acceptable contract that functioned >> perfectly, except that it wasn't the one you meant it to be. ?What >> alternate behavior would you propose? > > Actually, Paulo broke the contract on or/c, so this could have a better > error message without changes to the contract language. > > David Not according to the documentation I find here: http://docs.plt-scheme.org/reference/contracts.html Constants are perfectly acceptable contracts. If the contract? function doesn't accept them, then either contract? needs to start accepting them or or/c needs to be documented with a more general contract. But values like #f, 'foo, or 5 are usable with most contract primitives. --Carl From dvanhorn at ccs.neu.edu Mon Jul 20 14:59:59 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Mon Jul 20 15:00:29 2009 Subject: [plt-scheme] Contract Error Message In-Reply-To: <990e0c030907201147g5df2b009n76dfb92c886dc1be@mail.gmail.com> References: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> <990e0c030907201128t3fff5d67l22c280ad8ca11492@mail.gmail.com> <4A64BA22.20704@ccs.neu.edu> <990e0c030907201147g5df2b009n76dfb92c886dc1be@mail.gmail.com> Message-ID: <4A64BEAF.3020702@ccs.neu.edu> Carl Eastlund wrote: > On Mon, Jul 20, 2009 at 2:40 PM, David Van Horn wrote: >> Carl Eastlund wrote: >>> What you wrote was a perfectly acceptable contract that functioned >>> perfectly, except that it wasn't the one you meant it to be. What >>> alternate behavior would you propose? >> Actually, Paulo broke the contract on or/c, so this could have a better >> error message without changes to the contract language. >> >> David > > Not according to the documentation I find here: > > http://docs.plt-scheme.org/reference/contracts.html > > Constants are perfectly acceptable contracts. If the contract? > function doesn't accept them, then either contract? needs to start > accepting them or or/c needs to be documented with a more general > contract. But values like #f, 'foo, or 5 are usable with most > contract primitives. Ah, yes, (contract? #f) => #t, which I forgot. However, or/c accepts any number of predicates and *higher-order* contracts, so perhaps the or/c contract can be refined to enforce this aspect of the specification? David From yinso.chen at gmail.com Mon Jul 20 15:10:27 2009 From: yinso.chen at gmail.com (YC) Date: Mon Jul 20 15:10:54 2009 Subject: [plt-scheme] Contract Error Message In-Reply-To: <4A64BEAF.3020702@ccs.neu.edu> References: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> <990e0c030907201128t3fff5d67l22c280ad8ca11492@mail.gmail.com> <4A64BA22.20704@ccs.neu.edu> <990e0c030907201147g5df2b009n76dfb92c886dc1be@mail.gmail.com> <4A64BEAF.3020702@ccs.neu.edu> Message-ID: <779bf2730907201210k7b9f11dbm16e4b27ac0210f1b@mail.gmail.com> On Mon, Jul 20, 2009 at 11:59 AM, David Van Horn wrote: > Carl Eastlund wrote: > >> >> Not according to the documentation I find here: >> >> http://docs.plt-scheme.org/reference/contracts.html >> >> Constants are perfectly acceptable contracts. If the contract? >> function doesn't accept them, then either contract? needs to start >> accepting them or or/c needs to be documented with a more general >> contract. But values like #f, 'foo, or 5 are usable with most >> contract primitives. >> > > Ah, yes, (contract? #f) => #t, which I forgot. > > However, or/c accepts any number of predicates and *higher-order* > contracts, so perhaps the or/c contract can be refined to enforce this > aspect of the specification? I am a happy user of the current contract system and would hate to see this change. Constants are a perfectly valid contract and why should they not be accepted in a higher order contract? This would seriously curtail the expressiveness of the contract system, not to mention create two separate rules to remember. Cheers, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090720/35cafbcf/attachment.htm From dvanhorn at ccs.neu.edu Mon Jul 20 15:22:32 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Mon Jul 20 15:23:02 2009 Subject: [plt-scheme] Contract Error Message In-Reply-To: <779bf2730907201210k7b9f11dbm16e4b27ac0210f1b@mail.gmail.com> References: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> <990e0c030907201128t3fff5d67l22c280ad8ca11492@mail.gmail.com> <4A64BA22.20704@ccs.neu.edu> <990e0c030907201147g5df2b009n76dfb92c886dc1be@mail.gmail.com> <4A64BEAF.3020702@ccs.neu.edu> <779bf2730907201210k7b9f11dbm16e4b27ac0210f1b@mail.gmail.com> Message-ID: <4A64C3F8.3070401@ccs.neu.edu> YC wrote: > > On Mon, Jul 20, 2009 at 11:59 AM, David Van Horn > wrote: > > Carl Eastlund wrote: > > > Not according to the documentation I find here: > > http://docs.plt-scheme.org/reference/contracts.html > > Constants are perfectly acceptable contracts. If the contract? > function doesn't accept them, then either contract? needs to start > accepting them or or/c needs to be documented with a more general > contract. But values like #f, 'foo, or 5 are usable with most > contract primitives. > > > Ah, yes, (contract? #f) => #t, which I forgot. > > However, or/c accepts any number of predicates and *higher-order* > contracts, so perhaps the or/c contract can be refined to enforce > this aspect of the specification? > > > I am a happy user of the current contract system and would hate to see > this change. Constants are a perfectly valid contract and why should > they not be accepted in a higher order contract? This would seriously > curtail the expressiveness of the contract system, not to mention create > two separate rules to remember. I don't want to change the contract language, so I must be confused about what a "higher-order" contract is -- which I guessed was anything satisfying: (lambda (x) (and (contract? x) (not (flat-contract? x))) But it seems the bug here is actually in the docs. "Takes any number of predicates and higher-order contracts" The higher-order part should be dropped, right? David From carl.eastlund at gmail.com Mon Jul 20 15:25:10 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Mon Jul 20 15:32:33 2009 Subject: [plt-scheme] Contract Error Message In-Reply-To: <4A64C3F8.3070401@ccs.neu.edu> References: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> <990e0c030907201128t3fff5d67l22c280ad8ca11492@mail.gmail.com> <4A64BA22.20704@ccs.neu.edu> <990e0c030907201147g5df2b009n76dfb92c886dc1be@mail.gmail.com> <4A64BEAF.3020702@ccs.neu.edu> <779bf2730907201210k7b9f11dbm16e4b27ac0210f1b@mail.gmail.com> <4A64C3F8.3070401@ccs.neu.edu> Message-ID: <990e0c030907201225g6a41473h7d9e247c98acda4@mail.gmail.com> On Mon, Jul 20, 2009 at 3:22 PM, David Van Horn wrote: > YC wrote: >> >> On Mon, Jul 20, 2009 at 11:59 AM, David Van Horn > > wrote: >> >> ? ?Carl Eastlund wrote: >> >> >> ? ? ? ?Not according to the documentation I find here: >> >> ? ? ? ?http://docs.plt-scheme.org/reference/contracts.html >> >> ? ? ? ?Constants are perfectly acceptable contracts. ?If the contract? >> ? ? ? ?function doesn't accept them, then either contract? needs to start >> ? ? ? ?accepting them or or/c needs to be documented with a more general >> ? ? ? ?contract. ?But values like #f, 'foo, or 5 are usable with most >> ? ? ? ?contract primitives. >> >> >> ? ?Ah, yes, (contract? #f) => #t, which I forgot. >> >> ? ?However, or/c accepts any number of predicates and *higher-order* >> ? ?contracts, so perhaps the or/c contract can be refined to enforce >> ? ?this aspect of the specification? >> >> >> I am a happy user of the current contract system and would hate to see >> this change. ?Constants are a perfectly valid contract and why should they >> not be accepted in a higher order contract? ?This would seriously curtail >> the expressiveness of the contract system, not to mention create two >> separate rules to remember. > > I don't want to change the contract language, so I must be confused about > what a "higher-order" contract is -- which I guessed was anything > satisfying: > > (lambda (x) > ?(and (contract? x) > ? ? ? (not (flat-contract? x))) > > But it seems the bug here is actually in the docs. > > "Takes any number of predicates and higher-order contracts" > > The higher-order part should be dropped, right? > > David I think higher-order here means *potentially* higher-order; i.e. not restricted to flat contracts. --Carl From yinso.chen at gmail.com Mon Jul 20 15:33:34 2009 From: yinso.chen at gmail.com (YC) Date: Mon Jul 20 15:33:57 2009 Subject: [plt-scheme] Contract Error Message In-Reply-To: <4A64C3F8.3070401@ccs.neu.edu> References: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> <990e0c030907201128t3fff5d67l22c280ad8ca11492@mail.gmail.com> <4A64BA22.20704@ccs.neu.edu> <990e0c030907201147g5df2b009n76dfb92c886dc1be@mail.gmail.com> <4A64BEAF.3020702@ccs.neu.edu> <779bf2730907201210k7b9f11dbm16e4b27ac0210f1b@mail.gmail.com> <4A64C3F8.3070401@ccs.neu.edu> Message-ID: <779bf2730907201233h7f0b1f0l8d24ec5adadc1198@mail.gmail.com> On Mon, Jul 20, 2009 at 12:22 PM, David Van Horn wrote: > YC wrote: > > I am a happy user of the current contract system and would hate to see this >> change. Constants are a perfectly valid contract and why should they not be >> accepted in a higher order contract? This would seriously curtail the >> expressiveness of the contract system, not to mention create two separate >> rules to remember. >> > > I don't want to change the contract language, so I must be confused about > what a "higher-order" contract is -- which I guessed was anything > satisfying: > > (lambda (x) > (and (contract? x) > (not (flat-contract? x))) > > But it seems the bug here is actually in the docs. > > "Takes any number of predicates and higher-order contracts" > > The higher-order part should be dropped, right? > I agree that the doc seem ambiguous on the higher contract point. IIUC, or/c is a higher order contract itself, and accepts regular contracts (including constants, predicates, flat contracts) and higher order contracts such as another or/c, listof, etc. Cheers, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090720/1a971745/attachment.html From dvanhorn at ccs.neu.edu Mon Jul 20 15:36:42 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Mon Jul 20 15:37:06 2009 Subject: [plt-scheme] Contract Error Message In-Reply-To: <990e0c030907201225g6a41473h7d9e247c98acda4@mail.gmail.com> References: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> <990e0c030907201128t3fff5d67l22c280ad8ca11492@mail.gmail.com> <4A64BA22.20704@ccs.neu.edu> <990e0c030907201147g5df2b009n76dfb92c886dc1be@mail.gmail.com> <4A64BEAF.3020702@ccs.neu.edu> <779bf2730907201210k7b9f11dbm16e4b27ac0210f1b@mail.gmail.com> <4A64C3F8.3070401@ccs.neu.edu> <990e0c030907201225g6a41473h7d9e247c98acda4@mail.gmail.com> Message-ID: <4A64C74A.8080004@ccs.neu.edu> Carl Eastlund wrote: > I think higher-order here means *potentially* higher-order; i.e. not > restricted to flat contracts. Wouldn't that just be a "contract"? David From carl.eastlund at gmail.com Mon Jul 20 15:46:12 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Mon Jul 20 15:46:50 2009 Subject: [plt-scheme] Contract Error Message In-Reply-To: <779bf2730907201233h7f0b1f0l8d24ec5adadc1198@mail.gmail.com> References: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> <990e0c030907201128t3fff5d67l22c280ad8ca11492@mail.gmail.com> <4A64BA22.20704@ccs.neu.edu> <990e0c030907201147g5df2b009n76dfb92c886dc1be@mail.gmail.com> <4A64BEAF.3020702@ccs.neu.edu> <779bf2730907201210k7b9f11dbm16e4b27ac0210f1b@mail.gmail.com> <4A64C3F8.3070401@ccs.neu.edu> <779bf2730907201233h7f0b1f0l8d24ec5adadc1198@mail.gmail.com> Message-ID: <990e0c030907201246m1cef3e03x6a196d5fe0c4462b@mail.gmail.com> On Mon, Jul 20, 2009 at 3:33 PM, YC wrote: > > On Mon, Jul 20, 2009 at 12:22 PM, David Van Horn > wrote: >> I don't want to change the contract language, so I must be confused about >> what a "higher-order" contract is -- which I guessed was anything >> satisfying: >> >> (lambda (x) >> ?(and (contract? x) >> ? ? ? (not (flat-contract? x))) >> >> But it seems the bug here is actually in the docs. >> >> "Takes any number of predicates and higher-order contracts" >> >> The higher-order part should be dropped, right? > > I agree that the doc seem ambiguous on the higher contract point. IIUC, or/c > is a higher order contract itself, and accepts regular contracts (including > constants, predicates, flat contracts) and higher order contracts such as > another or/c, listof, etc. No, or/c is not a higher order contract. It is a higher order function that produces a (possibly higher-order) contract. A higher order contract is one that wraps a function and delays contract checking to function application time. For instance, (string? integer? . -> . string?) is a contract one could give to substring. It can't check the inputs and outputs right away (as there are none inherent in the function), so it "wraps" the function. It checks the inputs on each entry to the function and the outputs on each exit. If the input or output contracts are themselves higher-order, those values are similarly "wrapped". The or/c function itself is not a higher-order contract because it is not a contract -- you can't wrap substring with or/c. However, you could wrap it with: (or/c (string? integer? . -> . string?) (string? integer? integer? . -> . string?)) ...which describes the function's optional third argument by combining two higher-order contracts (one for two arguments and one for three) into a single higher-order contract that accepts either kind of application. --Carl From yinso.chen at gmail.com Mon Jul 20 16:02:34 2009 From: yinso.chen at gmail.com (YC) Date: Mon Jul 20 16:02:59 2009 Subject: [plt-scheme] Contract Error Message In-Reply-To: <990e0c030907201246m1cef3e03x6a196d5fe0c4462b@mail.gmail.com> References: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> <990e0c030907201128t3fff5d67l22c280ad8ca11492@mail.gmail.com> <4A64BA22.20704@ccs.neu.edu> <990e0c030907201147g5df2b009n76dfb92c886dc1be@mail.gmail.com> <4A64BEAF.3020702@ccs.neu.edu> <779bf2730907201210k7b9f11dbm16e4b27ac0210f1b@mail.gmail.com> <4A64C3F8.3070401@ccs.neu.edu> <779bf2730907201233h7f0b1f0l8d24ec5adadc1198@mail.gmail.com> <990e0c030907201246m1cef3e03x6a196d5fe0c4462b@mail.gmail.com> Message-ID: <779bf2730907201302v2339304gb5342ebe5747a693@mail.gmail.com> On Mon, Jul 20, 2009 at 12:46 PM, Carl Eastlund wrote: > > No, or/c is not a higher order contract. It is a higher order > function that produces a (possibly higher-order) contract. > > A higher order contract is one that wraps a function and delays > contract checking to function application time. For instance, > (string? integer? . -> . string?) is a contract one could give to > substring. It can't check the inputs and outputs right away (as there > are none inherent in the function), so it "wraps" the function. It > checks the inputs on each entry to the function and the outputs on > each exit. If the input or output contracts are themselves > higher-order, those values are similarly "wrapped". Thanks for the correction - I guess or/c should be called a composite contract then? I followed the reasoning that a higher order function is a function that takes other functions as parameters and hence a higher order contract is one that takes other contracts. Cheers, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090720/788fa2a8/attachment.htm From ryanc at ccs.neu.edu Mon Jul 20 18:45:09 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Mon Jul 20 18:45:49 2009 Subject: [plt-scheme] semaphore-like event Message-ID: <5EAFEF9A-41C9-47A5-BA00-28D748C5E071@ccs.neu.edu> I'm trying to make an event that is initially not ready, but once a 'release' operation is performed, it is ready forever afterwards. In particular, it becomes ready in synchronizations that have already started and are currently blocked. (Imagine if semaphores supported an operation that bumped the semaphore's internal counter to +inf.0. That would do it.) My question: Is there a way to do this without creating an extra thread? I can do this with an extra thread in a number of ways. The simplest way I've found is to use the thread's death itself as the event: ;; make-event+release/thread-death : -> (values evt (-> void)) (define (make-event+release/thread-death) (define s (make-semaphore 0)) (define th (thread (lambda () (semaphore-wait s)))) (values (thread-dead-evt th) (lambda () (semaphore-post s)))) I can also do this using a thread and a nack-guard event. (I think so, anyway. My understanding of nack-guard-evt is pretty shaky.) ;; make-event+release/thread-nack : -> (values evt (-> void)) (define (make-event+release/thread-nack) (define s (make-semaphore 0)) (define nack-channel (make-channel)) (define th (thread (lambda () (sync (nack-guard-evt (lambda (nack) (channel-put nack-channel nack) never-evt)) s)))) (values (channel-get nack-channel) (lambda () (semaphore-post s)))) The only way I've found that doesn't involve creating a thread is to create a port and use its progress event (which may involve another thread behind the scenes; I don't know). ;; make-event+release/port-progress : -> (values evt (-> void)) (define (make-event+release/port-progress) (define p (open-input-string "x")) (define evt (port-progress-evt p)) (values evt (lambda () (read-char p)))) Any easier ways out there? Any bugs in the code I've posted? Ryan From robby at eecs.northwestern.edu Mon Jul 20 18:48:56 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Mon Jul 20 18:49:17 2009 Subject: [plt-scheme] Contract Error Message In-Reply-To: <779bf2730907201302v2339304gb5342ebe5747a693@mail.gmail.com> References: <11b141710907201122g741cf7ccg34edd12c68b3df5d@mail.gmail.com> <990e0c030907201128t3fff5d67l22c280ad8ca11492@mail.gmail.com> <4A64BA22.20704@ccs.neu.edu> <990e0c030907201147g5df2b009n76dfb92c886dc1be@mail.gmail.com> <4A64BEAF.3020702@ccs.neu.edu> <779bf2730907201210k7b9f11dbm16e4b27ac0210f1b@mail.gmail.com> <4A64C3F8.3070401@ccs.neu.edu> <779bf2730907201233h7f0b1f0l8d24ec5adadc1198@mail.gmail.com> <990e0c030907201246m1cef3e03x6a196d5fe0c4462b@mail.gmail.com> <779bf2730907201302v2339304gb5342ebe5747a693@mail.gmail.com> Message-ID: <932b2f1f0907201548w7722eaaasb26ea9ddcab2ae05@mail.gmail.com> The phrase "higher-order contract" refers to contracts on higher order functions, altho your interpretation of the words is a reasonable one, it is not the one used in the manual. Looks like or/c's documentation is wrong: it should just say "contract". I've fixed that in SVN. The only fix I can imagine that would have helped Paulo in the first place is if or/c insisted on taking at least two arguments, but I'm not sure that making that change would be a good idea. Robby On Mon, Jul 20, 2009 at 3:02 PM, YC wrote: > On Mon, Jul 20, 2009 at 12:46 PM, Carl Eastlund > wrote: >> >> No, or/c is not a higher order contract. ?It is a higher order >> function that produces a (possibly higher-order) contract. >> >> A higher order contract is one that wraps a function and delays >> contract checking to function application time. ?For instance, >> (string? integer? . -> . string?) is a contract one could give to >> substring. ?It can't check the inputs and outputs right away (as there >> are none inherent in the function), so it "wraps" the function. ?It >> checks the inputs on each entry to the function and the outputs on >> each exit. ?If the input or output contracts are themselves >> higher-order, those values are similarly "wrapped". > > > Thanks for the correction - I guess or/c should be called a composite > contract then?? I followed the reasoning that a higher order function is a > function that takes other functions as parameters and hence a higher order > contract is one that takes other contracts. > > Cheers, > yc > > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From mflatt at cs.utah.edu Mon Jul 20 19:13:42 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Mon Jul 20 19:14:03 2009 Subject: [plt-scheme] semaphore-like event In-Reply-To: <5EAFEF9A-41C9-47A5-BA00-28D748C5E071@ccs.neu.edu> References: <5EAFEF9A-41C9-47A5-BA00-28D748C5E071@ccs.neu.edu> Message-ID: <20090720231343.DF3A66500C7@mail-svr1.cs.utah.edu> At Mon, 20 Jul 2009 18:45:09 -0400, Ryan Culpepper wrote: > I'm trying to make an event that is initially not ready, but once a > 'release' operation is performed, it is ready forever afterwards. In > particular, it becomes ready in synchronizations that have already > started and are currently blocked. (Imagine if semaphores supported an > operation that bumped the semaphore's internal counter to +inf.0. That > would do it.) > > My question: Is there a way to do this without creating an extra thread? I think you're looking for `semaphore-peek-evt'. That gives you something like incrementing a semaphore to +inf.0: > (define s (make-semaphore)) > (define sp (semaphore-peek-evt s)) > (sync/timeout 0 sp) #f > (semaphore-post s) > (sync/timeout 0 sp) # > (sync/timeout 0 sp) # > (sync/timeout 0 sp) # From benderjg2 at aol.com Mon Jul 20 19:25:52 2009 From: benderjg2 at aol.com (Jim Bender) Date: Mon Jul 20 19:26:31 2009 Subject: [plt-scheme] Semantics Engineering with PLT Redex Message-ID: <7E1AF604-F029-496C-832C-C7EE94BD92C4@aol.com> Now in stores... Congrats to Matthias, Robby and Matthew!!! My copy just arrived from Amazon. Jim Sent from my iPhone From matthias at ccs.neu.edu Mon Jul 20 19:32:12 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Jul 20 19:32:56 2009 Subject: [plt-scheme] Semantics Engineering with PLT Redex In-Reply-To: <7E1AF604-F029-496C-832C-C7EE94BD92C4@aol.com> References: <7E1AF604-F029-496C-832C-C7EE94BD92C4@aol.com> Message-ID: <1F95B53F-AFC9-4117-AAEE-174F094CC9B6@ccs.neu.edu> Thank you. Lots of hard work and lots of fun -- Matthias On Jul 20, 2009, at 7:25 PM, Jim Bender wrote: > Now in stores... Congrats to Matthias, Robby and Matthew!!! > > My copy just arrived from Amazon. > > Jim > > Sent from my iPhone > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From ryanc at ccs.neu.edu Mon Jul 20 19:43:07 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Mon Jul 20 19:43:31 2009 Subject: [plt-scheme] semaphore-like event In-Reply-To: <20090720231343.DF3A66500C7@mail-svr1.cs.utah.edu> References: <5EAFEF9A-41C9-47A5-BA00-28D748C5E071@ccs.neu.edu> <20090720231343.DF3A66500C7@mail-svr1.cs.utah.edu> Message-ID: <928CEA9A-B041-4AA2-AF4A-7985D670CC81@ccs.neu.edu> On Jul 20, 2009, at 7:13 PM, Matthew Flatt wrote: > At Mon, 20 Jul 2009 18:45:09 -0400, Ryan Culpepper wrote: >> I'm trying to make an event that is initially not ready, but once a >> 'release' operation is performed, it is ready forever afterwards. In >> particular, it becomes ready in synchronizations that have already >> started and are currently blocked. (Imagine if semaphores supported >> an >> operation that bumped the semaphore's internal counter to +inf.0. >> That >> would do it.) >> >> My question: Is there a way to do this without creating an extra >> thread? > > I think you're looking for `semaphore-peek-evt'. That gives you > something like incrementing a semaphore to +inf.0: Aha! That's that I was looking for, thanks! Ryan > > >> (define s (make-semaphore)) >> (define sp (semaphore-peek-evt s)) >> (sync/timeout 0 sp) > #f >> (semaphore-post s) >> (sync/timeout 0 sp) > # >> (sync/timeout 0 sp) > # >> (sync/timeout 0 sp) > # > From tom at zwizwa.be Tue Jul 21 11:42:00 2009 From: tom at zwizwa.be (Tom Schouten) Date: Tue Jul 21 11:42:23 2009 Subject: [plt-scheme] subprocess: double fork() to avoid zombies Message-ID: <20090721154200.GI30159@giebrok.zwizwa.be> Hello, I'd like to pick up this thread: http://list.cs.brown.edu/pipermail/plt-scheme/2008-July/025637.html On Tue Jul 1 2008, Eli Barzilay wrote: > 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 was wondering if it is possible to extend `subprocess' with a double fork() mechanism. I had a look at the code in plt/src/mzscheme/src/port.c and it seems it should be straightforward. Something like this: [mzscheme]--fork()-+-------wait()-----------------+---------> | | +--cleanup()--fork()-+--exit()-+ | +--exec()-[child]---> in addition to the current behaviour: [mzscheme]--fork()-+----------------------------------------> | +--cleanup()------------exec()-[child]---> The idea being that in a lot of practical cases you don't care about a child's exit status. Doing it like this still allows you to shut down a child by closing its input port, which by most tools is interpreted as "exit", without ever having to care about zombie processes caused by not performing wait(). I'd try this using the FFI but it seems the cleanup() functionality in port.c would have to be duplicated. Cheers, Tom From eli at barzilay.org Tue Jul 21 11:52:41 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jul 21 11:53:03 2009 Subject: [plt-scheme] subprocess: double fork() to avoid zombies In-Reply-To: <20090721154200.GI30159@giebrok.zwizwa.be> References: <20090721154200.GI30159@giebrok.zwizwa.be> Message-ID: <19045.58441.781766.239581@winooski.ccs.neu.edu> On Jul 21, Tom Schouten wrote: > Hello, > > I'd like to pick up this thread: > http://list.cs.brown.edu/pipermail/plt-scheme/2008-July/025637.html > > On Tue Jul 1 2008, Eli Barzilay wrote: > > 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 was wondering if it is possible to extend `subprocess' with > a double fork() mechanism. I had a look at the code in > plt/src/mzscheme/src/port.c and it seems it should be > straightforward. Something like this: > > [mzscheme]--fork()-+-------wait()-----------------+---------> > | | > +--cleanup()--fork()-+--exit()-+ > | > +--exec()-[child]---> > > in addition to the current behaviour: > > [mzscheme]--fork()-+----------------------------------------> > | > +--cleanup()------------exec()-[child]---> > > > The idea being that in a lot of practical cases you don't care about > a child's exit status. Doing it like this still allows you to shut > down a child by closing its input port, which by most tools is > interpreted as "exit", without ever having to care about zombie > processes caused by not performing wait(). How is this different? Specifically, you have wait() synchronising on the forking subprocess, but you still need a different wait() for the child that it creates -- no? -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From mflatt at cs.utah.edu Tue Jul 21 11:59:34 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Tue Jul 21 11:59:58 2009 Subject: [plt-scheme] subprocess: double fork() to avoid zombies In-Reply-To: <20090721154200.GI30159@giebrok.zwizwa.be> References: <20090721154200.GI30159@giebrok.zwizwa.be> Message-ID: <20090721155935.EAF5A6500BC@mail-svr1.cs.utah.edu> I think a better solution is to have MzScheme call wait() in the scheduler after any SIGCHLD. The check_child_done() function already handles any terminating child and records its exit status. At Tue, 21 Jul 2009 17:42:00 +0200, Tom Schouten wrote: > Hello, > > I'd like to pick up this thread: > http://list.cs.brown.edu/pipermail/plt-scheme/2008-July/025637.html > > On Tue Jul 1 2008, Eli Barzilay wrote: > > 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 was wondering if it is possible to extend `subprocess' with > a double fork() mechanism. I had a look at the code in > plt/src/mzscheme/src/port.c and it seems it should be > straightforward. Something like this: > > [mzscheme]--fork()-+-------wait()-----------------+---------> > | | > +--cleanup()--fork()-+--exit()-+ > | > +--exec()-[child]---> > > in addition to the current behaviour: > > [mzscheme]--fork()-+----------------------------------------> > | > +--cleanup()------------exec()-[child]---> > > > The idea being that in a lot of practical cases you don't > care about a child's exit status. Doing it like this still > allows you to shut down a child by closing its input port, > which by most tools is interpreted as "exit", without ever > having to care about zombie processes caused by not performing > wait(). > > I'd try this using the FFI but it seems the cleanup() > functionality in port.c would have to be duplicated. > > Cheers, > Tom > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mflatt at cs.utah.edu Tue Jul 21 12:23:47 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Tue Jul 21 12:24:17 2009 Subject: [plt-scheme] subprocess: double fork() to avoid zombies In-Reply-To: <20090721155935.EAF5A6500BC@mail-svr1.cs.utah.edu> References: <20090721154200.GI30159@giebrok.zwizwa.be> <20090721155935.EAF5A6500BC@mail-svr1.cs.utah.edu> Message-ID: <20090721162349.967D265013B@mail-svr1.cs.utah.edu> I've committed the wait()-via-scheduler change in SVN. At Tue, 21 Jul 2009 09:59:34 -0600, Matthew Flatt wrote: > I think a better solution is to have MzScheme call wait() in the > scheduler after any SIGCHLD. The check_child_done() function already > handles any terminating child and records its exit status. > > At Tue, 21 Jul 2009 17:42:00 +0200, Tom Schouten wrote: > > Hello, > > > > I'd like to pick up this thread: > > http://list.cs.brown.edu/pipermail/plt-scheme/2008-July/025637.html > > > > On Tue Jul 1 2008, Eli Barzilay wrote: > > > 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 was wondering if it is possible to extend `subprocess' with > > a double fork() mechanism. I had a look at the code in > > plt/src/mzscheme/src/port.c and it seems it should be > > straightforward. Something like this: > > > > [mzscheme]--fork()-+-------wait()-----------------+---------> > > | | > > +--cleanup()--fork()-+--exit()-+ > > | > > +--exec()-[child]---> > > > > in addition to the current behaviour: > > > > [mzscheme]--fork()-+----------------------------------------> > > | > > +--cleanup()------------exec()-[child]---> > > > > > > The idea being that in a lot of practical cases you don't > > care about a child's exit status. Doing it like this still > > allows you to shut down a child by closing its input port, > > which by most tools is interpreted as "exit", without ever > > having to care about zombie processes caused by not performing > > wait(). > > > > I'd try this using the FFI but it seems the cleanup() > > functionality in port.c would have to be duplicated. > > > > Cheers, > > Tom > > > > _________________________________________________ > > 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 tom at zwizwa.be Tue Jul 21 12:24:24 2009 From: tom at zwizwa.be (Tom Schouten) Date: Tue Jul 21 12:24:43 2009 Subject: [plt-scheme] subprocess: double fork() to avoid zombies In-Reply-To: <19045.58441.781766.239581@winooski.ccs.neu.edu> References: <20090721154200.GI30159@giebrok.zwizwa.be> <19045.58441.781766.239581@winooski.ccs.neu.edu> Message-ID: <20090721162423.GJ30159@giebrok.zwizwa.be> > > The idea being that in a lot of practical cases you don't care about > > a child's exit status. Doing it like this still allows you to shut > > down a child by closing its input port, which by most tools is > > interpreted as "exit", without ever having to care about zombie > > processes caused by not performing wait(). > > How is this different? Specifically, you have wait() synchronising on > the forking subprocess, but you still need a different wait() for the > child that it creates -- no? Because the middle process dies before its child, the child is inherited by the `init' process. I believe this is the standard way on unix to start a daemon. From tom at zwizwa.be Tue Jul 21 12:26:05 2009 From: tom at zwizwa.be (Tom Schouten) Date: Tue Jul 21 12:26:24 2009 Subject: [plt-scheme] subprocess: double fork() to avoid zombies In-Reply-To: <20090721162349.967D265013B@mail-svr1.cs.utah.edu> References: <20090721154200.GI30159@giebrok.zwizwa.be> <20090721155935.EAF5A6500BC@mail-svr1.cs.utah.edu> <20090721162349.967D265013B@mail-svr1.cs.utah.edu> Message-ID: <20090721162605.GK30159@giebrok.zwizwa.be> On Tue, Jul 21, 2009 at 10:23:47AM -0600, Matthew Flatt wrote: > I've committed the wait()-via-scheduler change in SVN. > Great! From eli at barzilay.org Tue Jul 21 12:28:20 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jul 21 12:28:41 2009 Subject: [plt-scheme] subprocess: double fork() to avoid zombies In-Reply-To: <20090721162423.GJ30159@giebrok.zwizwa.be> References: <20090721154200.GI30159@giebrok.zwizwa.be> <19045.58441.781766.239581@winooski.ccs.neu.edu> <20090721162423.GJ30159@giebrok.zwizwa.be> Message-ID: <19045.60580.803646.836063@winooski.ccs.neu.edu> On Jul 21, Tom Schouten wrote: > > > The idea being that in a lot of practical cases you don't care about > > > a child's exit status. Doing it like this still allows you to shut > > > down a child by closing its input port, which by most tools is > > > interpreted as "exit", without ever having to care about zombie > > > processes caused by not performing wait(). > > > > How is this different? Specifically, you have wait() > > synchronising on the forking subprocess, but you still need a > > different wait() for the child that it creates -- no? > > Because the middle process dies before its child, the child is > inherited by the `init' process. I believe this is the standard way > on unix to start a daemon. Isn't that problematic for getting the exit code? Can you even wait for the process after that? The man entry says that a pid>0 means "wait for the *child* whose ..." But in any case, I think that Matthew's solution should work better, and sounds like it would solve the problem. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From tom at zwizwa.be Tue Jul 21 12:45:19 2009 From: tom at zwizwa.be (Tom Schouten) Date: Tue Jul 21 12:45:39 2009 Subject: [plt-scheme] subprocess: double fork() to avoid zombies In-Reply-To: <19045.60580.803646.836063@winooski.ccs.neu.edu> References: <20090721154200.GI30159@giebrok.zwizwa.be> <19045.58441.781766.239581@winooski.ccs.neu.edu> <20090721162423.GJ30159@giebrok.zwizwa.be> <19045.60580.803646.836063@winooski.ccs.neu.edu> Message-ID: <20090721164519.GL30159@giebrok.zwizwa.be> On Tue, Jul 21, 2009 at 12:28:20PM -0400, Eli Barzilay wrote: > On Jul 21, Tom Schouten wrote: > > > > The idea being that in a lot of practical cases you don't care about > > > > a child's exit status. Doing it like this still allows you to shut > > > > down a child by closing its input port, which by most tools is > > > > interpreted as "exit", without ever having to care about zombie > > > > processes caused by not performing wait(). > > > > > > How is this different? Specifically, you have wait() > > > synchronising on the forking subprocess, but you still need a > > > different wait() for the child that it creates -- no? > > > > Because the middle process dies before its child, the child is > > inherited by the `init' process. I believe this is the standard way > > on unix to start a daemon. > > Isn't that problematic for getting the exit code? You can't since it's owned by init. The double fork decouples the two processes. > But in any case, I think that Matthew's solution should work better, > and sounds like it would solve the problem. Indeed. From marek at xivilization.net Tue Jul 21 13:07:49 2009 From: marek at xivilization.net (Marek Kubica) Date: Tue Jul 21 13:08:09 2009 Subject: [plt-scheme] Some more usability issues In-Reply-To: <20090718151312.01a25726@halmanfloyd.lan.local> References: <20090718151312.01a25726@halmanfloyd.lan.local> Message-ID: <20090721190749.360980b1@halmanfloyd.lan.local> Hi again, On Sat, 18 Jul 2009 15:13:12 +0200 Marek Kubica wrote: > - The context menu only stays open as long as the right mouse button > is pressed. I know that this has been the historical Unix way of doing > things, but nowadays many toolkits (Windows, GTK+, AFAIR Qt too) leave > the menu open until the user does a (left or middle or right) click > outside of the menu. In my option this is the better way, since it can > be tricky to click right and move the mouse, especially on a touchpad > and when every other application leaves the context menu open. > > - Search in Helpdesk for "(selection)" in the context menu. This > option is incredibly useful, but when I select a large amount of > text, the whole 'Search in Helpdesk for "large amount of text"' makes > the menu very, very large. I think it would be better to shorten it > to the first selected form and add "..." to it. The user will know > that there is some more text while not blowing up the sice of the > menu. > > - When running the debugger, I can't make the left part > (Stack/Variables) wider. This would be handy because the variables > that I define sometimes have a large text representation and the > frequent line breaks and scrolling in the variables window could be > reduced if I could make it larger by making the definitions and REPL > parts smaller. > > It would be great if someone could look into this, since DrScheme, > erm, MrEd is a really good way to program in Scheme except for the > historical usability weaknesses (some of these were already adressed - > many thanks for that, this made my MrEd experience a lot more pleasant > already). I found another one: when editing stuff in the REPL, I am often "done" and want to execute the expression. Unsurprisingly pressing [Enter] in the middle does not work as it inserts a newline. I have to go back to the end of the expression to execute it. Would it be possible to add, uhm Ctrl+Enter to evaluate the current expression directly, without the need to go to the end of the line? regards, Marek From marek at xivilization.net Tue Jul 21 13:28:05 2009 From: marek at xivilization.net (Marek Kubica) Date: Tue Jul 21 13:28:31 2009 Subject: [plt-scheme] Red black trees in PLT Scheme Message-ID: <20090721192805.3ae3994e@halmanfloyd.lan.local> Hi, I am currently trying to implement red black trees in Scheme as they are in Introduction to Algorithms (CLRS), 2nd edition (see source code attached). I know that this code is not nice and definitely not functional (Eli suggested to use match which I will do once I get this working correctly) and full of mutable state, but I thought it might be a nice exercise to see how it looks in Scheme. But unfortunately, I ran into some problem and I am not sure whether it is not a problem with the algorithm in the book itself (sorry to all those who don't have access to the book, but there is no publicly available version of this). I am creating a tree that looks like this: *4* *3* *5* 2 6 where the *bold* numbers represent black nodes (I can also provide scans of my sketches on paper, but posting images on a mailing list isn't usually a good idea). Now I am removing the 2 node: *4* *3* *5* 6 This works fine, because it does not trigger any rb-delete-fixup operations, when I try to delete 3 it fails, because it calls (rb-delete-fixup T x) with x being (void) (this should be CLRS, Case IV according to the Java applet mentioned in the header). Playing the algorithm on paper this should be correct, since z is 3, y is also 3 and x is the right node of 3, which is (void), the book calls it NIL[T]. Attaching that to the parent node of 3 works (set-rb-node-left!) correctly, but then the algorithm does a (rb-delete-fixup T x) and tries to access the parent of (void)/NIL[T] which, of course fails. Could anyone have a look at this and tell me what the problem is? I thought about introducing a temporary node where x is, so that the parent-getting succeeds, but this does not feel like a good solution. Oh, I also implemented GraphViz dot output, so you can let GraphViz visualize the trees that get created; it already helped me with debugging rb-insert. Thanks in advance! regards, Marek -------------- next part -------------- A non-text attachment was scrubbed... Name: redblack.scm Type: text/x-scheme Size: 11107 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090721/13fdff37/redblack-0001.bin From clements at brinckerhoff.org Tue Jul 21 16:42:53 2009 From: clements at brinckerhoff.org (John Clements) Date: Tue Jul 21 16:43:17 2009 Subject: [plt-scheme] Register now! for the Scheme Workshop Message-ID: 2009 Workshop on Scheme and Functional Programming Coordinated with the Symposium in Honor of Mitchell Wand August 22, 2009 Boston, Massachusetts, USA http://www.schemeworkshop.org/2009 CALL FOR PARTICIPATION To the delight of all and sundry, the 2009 Scheme and Functional Programming Workshop will be held on August 22nd at Northeastern University, and it is a signal honor for me to be able to invite YOU to the WORLD'S FOREMOST WORKSHOP on the marvelous Scheme language, and to present a program PACKED with contributions from familiar faces and new ones, certain to amaze, delight, and edify. Lend us your ears, and we will widen the space between them. - John Clements IMPORTANT DATES August 11, 2009 - Registration deadline August 22, 2009 - Workshop on Scheme and Functional Programming August 23-24, 2009 - Symposium in Honor of Mitchell Wand: http://www.ccs.neu.edu/home/wand-symposium VENUE Northeastern University Boston Massachusetts Building and Room TBA ACCOMMODATION A limited block of hotel rooms has been reserved for participants of the Scheme Workshop and/or the Mitchell Wand Symposium at hotels in Cambridge and Boston. See the workshop web site for more information, and please note that some of these special rates expire soon (one as early as July 27th). REGISTRATION The registration fee will be $40 to help cover the operating costs and lunch accommodations. Please register by *August 11, 2009* so that we will have an accurate head count. To register, please send an email to aoeuswreg@brinckerhoff.org with your name and any dietary restrictions for lunch. PROGRAM COMMITTEE * John Clements (Cal Poly State University (organizer & chair)) * Dominique Boucher (Nu Echo) * Abdulaziz Ghuloum (Indiana University) * David Herman (Northeastern University) * Shriram Krishnamurthi (Brown University) * Matthew Might (University of Utah) * David Van Horn (Northeastern University) PRELIMINARY PROGRAM Invited Talk on the Bootstrap Program Emmanuel Schanzer Invited Talk on Future Directions for the Scheme Language The Newly Elected Scheme Language Steering Committee The Scribble Reader: An Alternative to S-expressions for Textual Content Eli Barzilay World With Web: A compiler from world applications to JavaScript Remzi Emre Ba?ar, Caner Derici, ?a?da? ?enol Scalable Garbage Collection with Guaranteed MMU William D Clinger and Felix Klock Distributed Software Transactional Memory Anthony Cowley Sequence Traces for Object-Oriented Executions Carl Eastlund and Matthias Felleisen Keyword and Optional Arguments in PLT Scheme Matthew Flatt and Eli Barzilay Fixing Letrec (reloaded) Abdulaziz Ghuloum and R. Kent Dybvig Descot: Distributed Code Repository Framework Aaron W. Hsu A pattern-matcher for alphaKanren -or- How to get into trouble with CPS macros Andrew W. Keep and Michael D. Adams and William E. Byrd and Daniel P. Friedman Randomized Testing in PLT Redex Casey Klein and Robert Bruce Findler Screen-Replay: A Session Recording and Analysis Tool for DrScheme Mehmet Fatih K?ksal, Remzi Emre Ba?ar, Suzan ?sk?darl? Interprocedural Dependence Analysis of Higher-Order Programs via Stack Reachability Matthew Might and Tarun Prabhu Get stuffed: Tightly packed abstract protocols in Scheme John Moore Higher-Order Aspects in Order Eric Tanter Peter J Landin (1930-2009) Olivier Danvy From jensaxel at soegaard.net Tue Jul 21 20:17:32 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Tue Jul 21 20:25:56 2009 Subject: [plt-scheme] SQLite error Message-ID: <4072c51f0907211717n35accb8bvb6eb315c45bb70c6@mail.gmail.com> Hi All, A little sanity check. Does the program below run for you? #lang scheme (require (prefix-in sql: (planet jaymccarthy/sqlite:4:3/sqlite))) (define db (sql:open (string->path "deleteme.db"))) (sql:select db "SELECT (*) FROM sqlite_master") In DrScheme on OS 10.5 I keep getting this error: Welcome to DrScheme, version 4.2.0.6-svn15jul2009 [3m]. Language: Module; memory limit: 512 megabytes. . . SQLite Error: You should only prepare one statement at a time! "SELECT (*) FROM sqlite_master" -- Jens Axel S?gaard From jensaxel at soegaard.net Tue Jul 21 20:36:51 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Tue Jul 21 20:37:10 2009 Subject: [plt-scheme] Re: SQLite error In-Reply-To: <4072c51f0907211717n35accb8bvb6eb315c45bb70c6@mail.gmail.com> References: <4072c51f0907211717n35accb8bvb6eb315c45bb70c6@mail.gmail.com> Message-ID: <4072c51f0907211736x738502favf7a387a98ec94d64@mail.gmail.com> > (sql:select db "SELECT (*) FROM sqlite_master") The syntax is wrong. It should have been: SELECT * FROM sqlite_master Horrible error message though. -- Jens Axel S?gaard From jay.mccarthy at gmail.com Tue Jul 21 20:49:30 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Tue Jul 21 20:49:51 2009 Subject: [plt-scheme] Re: SQLite error In-Reply-To: <4072c51f0907211736x738502favf7a387a98ec94d64@mail.gmail.com> References: <4072c51f0907211717n35accb8bvb6eb315c45bb70c6@mail.gmail.com> <4072c51f0907211736x738502favf7a387a98ec94d64@mail.gmail.com> Message-ID: Believe it or not, most of my error messages come from SQLite. =) I don't parse SQL at all, but let it do it for me. This message comes from the parser that returns an error if it does not parse one SQL statement. Unfortunately, zero AND two or more statements are both not one statement, and I can't tell the difference based on its error codes. Jay ps Maybe there's a feature of SQLite I don't know about it. If so, I'm happy to know. On Tue, Jul 21, 2009 at 6:36 PM, Jens Axel S?gaard wrote: >> (sql:select db "SELECT (*) FROM sqlite_master") > > The syntax is wrong. It should have been: > ? ?SELECT * FROM sqlite_master > > Horrible error message though. > > -- > Jens Axel S?gaard > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From dherman at ccs.neu.edu Tue Jul 21 21:11:38 2009 From: dherman at ccs.neu.edu (Dave Herman) Date: Tue Jul 21 21:12:10 2009 Subject: [plt-scheme] Red black trees in PLT Scheme In-Reply-To: <20090721192805.3ae3994e@halmanfloyd.lan.local> References: <20090721192805.3ae3994e@halmanfloyd.lan.local> Message-ID: No time to look into this closely, but you should check out this version of red-black trees. It's way, way simpler: http://www.eecs.usma.edu/webs/people/okasaki/pubs.html#jfp99 Dave On Jul 21, 2009, at 1:28 PM, Marek Kubica wrote: > Hi, > > I am currently trying to implement red black trees in Scheme as they > are in Introduction to Algorithms (CLRS), 2nd edition (see source code > attached). > > I know that this code is not nice and definitely not functional (Eli > suggested to use match which I will do once I get this working > correctly) and full of mutable state, but I thought it might be a nice > exercise to see how it looks in Scheme. > > But unfortunately, I ran into some problem and I am not sure whether > it > is not a problem with the algorithm in the book itself (sorry to all > those who don't have access to the book, but there is no publicly > available version of this). > > I am creating a tree that looks like this: > > *4* > *3* *5* > 2 6 > > where the *bold* numbers represent black nodes (I can also provide > scans of my sketches on paper, but posting images on a mailing list > isn't usually a good idea). > > Now I am removing the 2 node: > > *4* > *3* *5* > 6 > > This works fine, because it does not trigger any rb-delete-fixup > operations, when I try to delete 3 it fails, because it calls > (rb-delete-fixup T x) with x being (void) (this should be CLRS, Case > IV > according to the Java applet mentioned in the header). Playing the > algorithm on paper this should be correct, since z is 3, y is also 3 > and x is the right node of 3, which is (void), the book calls it > NIL[T]. > Attaching that to the parent node of 3 works (set-rb-node-left!) > correctly, but then the algorithm does a (rb-delete-fixup T x) and > tries > to access the parent of (void)/NIL[T] which, of course fails. > > Could anyone have a look at this and tell me what the problem is? I > thought about introducing a temporary node where x is, so that the > parent-getting succeeds, but this does not feel like a good solution. > > Oh, I also implemented GraphViz dot output, so you can let GraphViz > visualize the trees that get created; it already helped me with > debugging rb-insert. > > Thanks in advance! > > regards, > Marek_________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From czhu at cs.utah.edu Tue Jul 21 23:06:06 2009 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Tue Jul 21 23:06:36 2009 Subject: [plt-scheme] question about lift-strict in frtime Message-ID: <4A66821E.1070707@cs.utah.edu> Hi All, When working with lift-strict in frtime with ordinary Scheme primitives that take list/vector as input, I find it working only when I use "lift-strict list" and "lift-strict vector" to build the data. When using just "list"/"vector" or quasi-quote and unquote, it just doesn't work. The attached file shows the problem. This is with DrScheme, version 4.2 under Windows. Did I do something wrong, or is it a bug? Thanks, Chongkai -------------- next part -------------- (require "test1.ss") ;works (lift-strict myadd1 (lift-strict list 1 seconds)) (lift-strict myadd2 (lift-strict vector 1 seconds)) `(1 ,seconds) (vector 1 seconds) ;doesn't work #| (lift-strict myadd1 (list 1 seconds)) (lift-strict myadd1 `(1 ,seconds)) (lift-strict myadd2 `#(1 ,seconds)) (lift-strict myadd2 (vector 1 seconds)) => test1.ss:6:2: +: expects type as 2nd argument, given: #(struct:signal ... |# -------------- next part -------------- #lang scheme/base (provide myadd1 myadd2) (define (myadd1 x) (apply + x)) (define (myadd2 x) (apply + (vector->list x))) From dyrueta at gmail.com Tue Jul 21 23:26:49 2009 From: dyrueta at gmail.com (Gadfly) Date: Tue Jul 21 23:39:41 2009 Subject: [plt-scheme] HtDP Chapter 27 Message-ID: <579be273-7820-47c0-99ed-94aa3ad0f04e@t11g2000prh.googlegroups.com> Hi All -- Anyone interested in proofing HtDP Chapter 27 exercise solutions? Specifically, 27.3.4, 27.3.5, 27.3.6, which concern computing function roots and areas-under-a-curve using generative recursion. The tests I've developed are very basic, because the math involved in these computations (I think) involves some calculus, which I never took. So although I feel good about the solutions, I can't be certain they're correct. I've withheld posting my proposed solutions for obvious reasons, but have copied them to a Google Doc which I can share offline. Any help in proofing or developing tests would be greatly appreciated! Thanks much, Dave Yrueta From ghcooper at gmail.com Wed Jul 22 02:23:44 2009 From: ghcooper at gmail.com (Gregory Cooper) Date: Wed Jul 22 02:29:55 2009 Subject: [plt-scheme] question about lift-strict in frtime In-Reply-To: <4A66821E.1070707@cs.utah.edu> References: <4A66821E.1070707@cs.utah.edu> Message-ID: <65e1d50c0907212323tad8e25dx2930ec79debb3ad4@mail.gmail.com> Hi Chongkai, Data constructors in FrTime do not implicitly propagate reactivity (they are not "lifted"), so, for example, (list 1 seconds) evaluates not to a behavior but to a list containing a behavior: (list 1 seconds) : List[Bhvr[Integer]] Although structures with behaviors "nested" in them like this are important, it doesn't really make sense to apply "lift-strict" to them. (They're not behaviors, and projecting their current values has no effect.) Instead, for lifting you typically want a value where all the reactivity has been "raised" to the top level. There are two ways to accomplish this: 1. Create data with lifted constructor applications, as you've done. 2. Apply "raise-reactivity" to data before "lift-strict"ing a procedure over it. However, for normal use, lifting is only really intended for procedures that consume simple data. Thus I'd prefer another option altogether, which is to define any such structure-consuming procedures in FrTime instead of Scheme. Then you shouldn't need to do any lifting at all... Greg On Tue, Jul 21, 2009 at 8:06 PM, Chongkai Zhu wrote: > Hi All, > > When working with lift-strict in frtime with ordinary Scheme primitives that > take list/vector as input, I find it working only when I use "lift-strict > list" and "lift-strict vector" to build the data. When using just > "list"/"vector" or quasi-quote and unquote, it just doesn't work. The > attached file shows the problem. This is with DrScheme, version 4.2 under > Windows. Did I do something wrong, or is it a bug? > > Thanks, > Chongkai > > (require "test1.ss") > > ;works > (lift-strict myadd1 (lift-strict list 1 seconds)) > (lift-strict myadd2 (lift-strict vector 1 seconds)) > > `(1 ,seconds) > (vector 1 seconds) > > ;doesn't work > #| > (lift-strict myadd1 (list 1 seconds)) > (lift-strict myadd1 `(1 ,seconds)) > (lift-strict myadd2 `#(1 ,seconds)) > (lift-strict myadd2 (vector 1 seconds)) > > => > > test1.ss:6:2: +: expects type as 2nd argument, given: > #(struct:signal ... > |# > > > #lang scheme/base > > (provide myadd1 myadd2) > > (define (myadd1 x) > ?(apply + x)) > > (define (myadd2 x) > ?(apply + (vector->list x))) > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From marek at xivilization.net Wed Jul 22 02:46:21 2009 From: marek at xivilization.net (Marek Kubica) Date: Wed Jul 22 02:46:56 2009 Subject: [plt-scheme] Red black trees in PLT Scheme In-Reply-To: References: <20090721192805.3ae3994e@halmanfloyd.lan.local> Message-ID: <20090722084621.6c1640cd@halmanfloyd.lan.local> On Tue, 21 Jul 2009 21:11:38 -0400 Dave Herman wrote: > No time to look into this closely, but you should check out this > version of red-black trees. It's way, way simpler: > > http://www.eecs.usma.edu/webs/people/okasaki/pubs.html#jfp99 Yes, this is the SML version with pattern matching. I'd like to go without pattern matching at first, so I can implement it like in CLRS, reimplement it with pattern matching and have a good comparison. regards, Marek From carl.eastlund at gmail.com Wed Jul 22 02:51:55 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Wed Jul 22 02:52:51 2009 Subject: [plt-scheme] Red black trees in PLT Scheme In-Reply-To: <20090722084621.6c1640cd@halmanfloyd.lan.local> References: <20090721192805.3ae3994e@halmanfloyd.lan.local> <20090722084621.6c1640cd@halmanfloyd.lan.local> Message-ID: <990e0c030907212351r655864f3h3fe98cd3f955aca9@mail.gmail.com> On Wed, Jul 22, 2009 at 2:46 AM, Marek Kubica wrote: > On Tue, 21 Jul 2009 21:11:38 -0400 > Dave Herman wrote: > >> No time to look into this closely, but you should check out this >> version of red-black trees. It's way, way simpler: >> >> ? ? ?http://www.eecs.usma.edu/webs/people/okasaki/pubs.html#jfp99 > > Yes, this is the SML version with pattern matching. I'd like to go > without pattern matching at first, so I can implement it like in CLRS, > reimplement it with pattern matching and have a good comparison. > > regards, > Marek Pattern matching is not the only difference here -- CLRS presents mutable trees, right? Okasaki's are immutable, so rather than mutate an existing tree you build a new one, reconstructing only the changed nodes. So be careful, in your comparison, about which aspects of the trees are making the difference in your code. --Carl From marek at xivilization.net Wed Jul 22 03:01:29 2009 From: marek at xivilization.net (Marek Kubica) Date: Wed Jul 22 03:01:53 2009 Subject: [plt-scheme] Red black trees in PLT Scheme In-Reply-To: <990e0c030907212351r655864f3h3fe98cd3f955aca9@mail.gmail.com> References: <20090721192805.3ae3994e@halmanfloyd.lan.local> <20090722084621.6c1640cd@halmanfloyd.lan.local> <990e0c030907212351r655864f3h3fe98cd3f955aca9@mail.gmail.com> Message-ID: <20090722090129.0e65c7ef@halmanfloyd.lan.local> On Wed, 22 Jul 2009 02:51:55 -0400 Carl Eastlund wrote: > On Wed, Jul 22, 2009 at 2:46 AM, Marek Kubica > wrote: > > On Tue, 21 Jul 2009 21:11:38 -0400 > > Dave Herman wrote: > > > >> No time to look into this closely, but you should check out this > >> version of red-black trees. It's way, way simpler: > >> > >> ? ? ?http://www.eecs.usma.edu/webs/people/okasaki/pubs.html#jfp99 > > > > Yes, this is the SML version with pattern matching. I'd like to go > > without pattern matching at first, so I can implement it like in > > CLRS, reimplement it with pattern matching and have a good > > comparison. > > > > regards, > > Marek > > Pattern matching is not the only difference here -- CLRS presents > mutable trees, right? Okasaki's are immutable, so rather than mutate > an existing tree you build a new one, reconstructing only the changed > nodes. So be careful, in your comparison, about which aspects of the > trees are making the difference in your code. Well, the comparison would be more like code size and elegance, although doing some benchmarking would help me to see how much faster a mutable data structure would be. regards, Marek From chust at web.de Wed Jul 22 03:25:30 2009 From: chust at web.de (Thomas Chust) Date: Wed Jul 22 03:25:48 2009 Subject: [plt-scheme] Re: SQLite error In-Reply-To: References: <4072c51f0907211717n35accb8bvb6eb315c45bb70c6@mail.gmail.com> <4072c51f0907211736x738502favf7a387a98ec94d64@mail.gmail.com> Message-ID: <1c1a33bc0907220025j3baeb8e8jd3659a720b6e1156@mail.gmail.com> 2009/7/22 Jay McCarthy : > [...] > I don't parse SQL at all, but let it do it for me. This message comes > from the parser that returns an error if it does not parse one SQL > statement. Unfortunately, zero AND two or more statements are both not > one statement, and I can't tell the difference based on its error > codes. > [...] Hello, I'm not sure whether it would really be worth the effort, but you should in principle be able to tell the difference by using the pzTail output parameter of the SQLite API function that compiles the statement: If the tail pointer passed out is identical to the SQL source pointer passed in, nothing has been compiled, if it's different, at least one statement has been consumed by the parser. Probably it is not completely trivial to implement that logic, though, because the SQL source pointer passed to the SQLite API call is not directly visible to Scheme code but rather some buffer allocated by the FFI. cu, Thomas -- When C++ is your hammer, every problem looks like your thumb. From czhu at cs.utah.edu Wed Jul 22 03:30:38 2009 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Wed Jul 22 03:31:07 2009 Subject: [plt-scheme] question about lift-strict in frtime In-Reply-To: <65e1d50c0907212323tad8e25dx2930ec79debb3ad4@mail.gmail.com> References: <4A66821E.1070707@cs.utah.edu> <65e1d50c0907212323tad8e25dx2930ec79debb3ad4@mail.gmail.com> Message-ID: <4A66C01E.6080905@cs.utah.edu> Many thanks for the quick reply. Gregory Cooper wrote: > Hi Chongkai, > > Data constructors in FrTime do not implicitly propagate reactivity > (they are not "lifted"), so, for example, (list 1 seconds) evaluates > not to a behavior but to a list containing a behavior: > > (list 1 seconds) : List[Bhvr[Integer]] > I see. > Although structures with behaviors "nested" in them like this are > important, it doesn't really make sense to apply "lift-strict" to > them. (They're not behaviors, and projecting their current values has > no effect.) Instead, for lifting you typically want a value where all > the reactivity has been "raised" to the top level. There are two ways > to accomplish this: > > 1. Create data with lifted constructor applications, as you've done. > That's not a good option. I just found it as the only way to make things work. The goal is to use quasiquote / unquote to construct those structures, thus keeping syntax overhead minimal. > 2. Apply "raise-reactivity" to data before "lift-strict"ing a procedure over it. > > That's good because it keeps the syntax overhead low. The only glitch is that "raise-reactivity" is not provided by the frtime language. I found it in frtime/mzscheme-core with v4.2 but it is now called frtime/lang-core. Could I ask why it is not provided? > However, for normal use, lifting is only really intended for > procedures that consume simple data. Thus I'd prefer another option > altogether, which is to define any such structure-consuming procedures > in FrTime instead of Scheme. Then you shouldn't need to do any > lifting at all... > > That's not a solution either. The procedure here is intended to work with "#lang scheme" first, and be able to work with frtime (be lifted) second. > Greg > > Cheers, Chongkai From ghcooper at gmail.com Wed Jul 22 04:00:49 2009 From: ghcooper at gmail.com (Gregory Cooper) Date: Wed Jul 22 04:06:46 2009 Subject: [plt-scheme] question about lift-strict in frtime In-Reply-To: <4A66C01E.6080905@cs.utah.edu> References: <4A66821E.1070707@cs.utah.edu> <65e1d50c0907212323tad8e25dx2930ec79debb3ad4@mail.gmail.com> <4A66C01E.6080905@cs.utah.edu> Message-ID: <65e1d50c0907220100w7209cf48t80b936a3a2046db9@mail.gmail.com> >> 2. Apply "raise-reactivity" to data before "lift-strict"ing a procedure >> over it. > > That's good because it keeps the syntax overhead low. The only glitch is > that "raise-reactivity" is not provided by the frtime language. I found it > in frtime/mzscheme-core with v4.2 but it is now called frtime/lang-core. > Could I ask why it is not provided? Are you sure? It seems to be available in 4.2.0.900, both in the FrTime language level and with #lang frtime in Module... >> However, for normal use, lifting is only really intended for >> procedures that consume simple data. ?Thus I'd prefer another option >> altogether, which is to define any such structure-consuming procedures >> in FrTime instead of Scheme. ?Then you shouldn't need to do any >> lifting at all... > > That's not a solution either. The procedure here is intended to work with > "#lang scheme" first, and be able to work with frtime (be lifted) second. Ok. Depending on what you're doing, "compound-lift" might also be appropriate, but we can discuss that later if the need arises. Greg From troelskn at gmail.com Wed Jul 22 04:27:16 2009 From: troelskn at gmail.com (troels knak-nielsen) Date: Wed Jul 22 04:27:39 2009 Subject: [plt-scheme] Web browsing package? In-Reply-To: <9bd8a08a0907201043x51230ec8r191057355673771f@mail.gmail.com> References: <9bd8a08a0907201043x51230ec8r191057355673771f@mail.gmail.com> Message-ID: <98b8086f0907220127s1b2d4f5web31fa055c82bff1@mail.gmail.com> On Mon, Jul 20, 2009 at 7:43 PM, Elena Garrulo wrote: > Hi, > > is there a package for automated web browsing, kind of Perl's WWW::Mechanize > ( > http://search.cpan.org/~petdance/WWW-Mechanize-1.58/lib/WWW/Mechanize.pm#SYNOPSIS > ) ? > Not a direct answer, since I don't know of any such projects for plt, but you could consider remote-controlling firefox instead. You can start firefox up in Xvfb (headless) and then use an extension such as mozrepl[1] to connect to it. -- troels [1] http://github.com/bard/mozrepl/tree/master From czhu at cs.utah.edu Wed Jul 22 20:37:27 2009 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Wed Jul 22 06:37:58 2009 Subject: [plt-scheme] question about lift-strict in frtime In-Reply-To: <65e1d50c0907220100w7209cf48t80b936a3a2046db9@mail.gmail.com> References: <4A66821E.1070707@cs.utah.edu> <65e1d50c0907212323tad8e25dx2930ec79debb3ad4@mail.gmail.com> <4A66C01E.6080905@cs.utah.edu> <65e1d50c0907220100w7209cf48t80b936a3a2046db9@mail.gmail.com> Message-ID: <4A67B0C7.7060106@cs.utah.edu> Hi Gregory, Gregory Cooper wrote: >>> 2. Apply "raise-reactivity" to data before "lift-strict"ing a procedure >>> over it. >>> >> That's good because it keeps the syntax overhead low. The only glitch is >> that "raise-reactivity" is not provided by the frtime language. I found it >> in frtime/mzscheme-core with v4.2 but it is now called frtime/lang-core. >> Could I ask why it is not provided? >> > > Are you sure? It seems to be available in 4.2.0.900, both in the > FrTime language level and with #lang frtime in Module... > Sorry that I just looked in v4.2, which doesn't seem to have "raise-reactivity". My fault. - Chongkai From jensaxel at soegaard.net Wed Jul 22 06:42:30 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Wed Jul 22 06:42:50 2009 Subject: [plt-scheme] Re: SQLite error In-Reply-To: <1c1a33bc0907220025j3baeb8e8jd3659a720b6e1156@mail.gmail.com> References: <4072c51f0907211717n35accb8bvb6eb315c45bb70c6@mail.gmail.com> <4072c51f0907211736x738502favf7a387a98ec94d64@mail.gmail.com> <1c1a33bc0907220025j3baeb8e8jd3659a720b6e1156@mail.gmail.com> Message-ID: <4072c51f0907220342v73ae96adm420e124dcf59101c@mail.gmail.com> 2009/7/22 Thomas Chust : > I'm not sure whether it would really be worth the effort, but you > should in principle be able to tell the difference by using the pzTail > output parameter of the SQLite API function that compiles the > statement: If the tail pointer passed out is identical to the SQL > source pointer passed in, nothing has been compiled, if it's > different, at least one statement has been consumed by the parser. > > Probably it is not completely trivial to implement that logic, though, > because the SQL source pointer passed to the SQLite API call is not > directly visible to Scheme code but rather some buffer allocated by > the FFI. Fortunately, the tail is already available. It is used in the current error message: (define (prepare db sql) (let*-values ([(stmt prep-status tail) (sqlite3_prepare_v2 (db-handle db) sql)] [(the-stmt) (wrap-finalizer (make-statement db stmt) finalize)]) (when (not (zero? (string-length tail))) (sqlite-error "You should only prepare one statement at a time! ~s" tail)) (when (handle-status db prep-status) (if stmt the-stmt ;; the pointer is null; SQLite didn't raise an ;; error but should have! (sqlite-error "sqlite3_prepare_v2 returned a NULL pointer"))))) Yet another way to get the "prepare one statement at a time" error, is to prepare a CREATE TABLES statement with an already existing table name. -- Jens Axel S?gaard From sk at cs.brown.edu Wed Jul 22 09:18:10 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Wed Jul 22 09:18:52 2009 Subject: [plt-scheme] Red black trees in PLT Scheme In-Reply-To: <20090722090129.0e65c7ef@halmanfloyd.lan.local> References: <20090721192805.3ae3994e@halmanfloyd.lan.local> <20090722084621.6c1640cd@halmanfloyd.lan.local> <990e0c030907212351r655864f3h3fe98cd3f955aca9@mail.gmail.com> <20090722090129.0e65c7ef@halmanfloyd.lan.local> Message-ID: If "code size" and "elegance" are your *primary* criteria, then Okasaki's paper explains very clearly why his version will win hands down. (It is a truly beautiful presentation, and his reduction of all four invariant-violating cases to one has a "God's Book" feel to it.) Shriram On Wed, Jul 22, 2009 at 3:01 AM, Marek Kubica wrote: > On Wed, 22 Jul 2009 02:51:55 -0400 > Carl Eastlund wrote: > >> On Wed, Jul 22, 2009 at 2:46 AM, Marek Kubica >> wrote: >> > On Tue, 21 Jul 2009 21:11:38 -0400 >> > Dave Herman wrote: >> > >> >> No time to look into this closely, but you should check out this >> >> version of red-black trees. It's way, way simpler: >> >> >> >> ? ? ?http://www.eecs.usma.edu/webs/people/okasaki/pubs.html#jfp99 >> > >> > Yes, this is the SML version with pattern matching. I'd like to go >> > without pattern matching at first, so I can implement it like in >> > CLRS, reimplement it with pattern matching and have a good >> > comparison. >> > >> > regards, >> > Marek >> >> Pattern matching is not the only difference here -- CLRS presents >> mutable trees, right? ?Okasaki's are immutable, so rather than mutate >> an existing tree you build a new one, reconstructing only the changed >> nodes. ?So be careful, in your comparison, about which aspects of the >> trees are making the difference in your code. > > Well, the comparison would be more like code size and elegance, > although doing some benchmarking would help me to see how much faster a > mutable data structure would be. > > regards, > Marek > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jay.mccarthy at gmail.com Wed Jul 22 10:52:30 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Wed Jul 22 10:52:53 2009 Subject: [plt-scheme] Re: SQLite error In-Reply-To: <4072c51f0907220342v73ae96adm420e124dcf59101c@mail.gmail.com> References: <4072c51f0907211717n35accb8bvb6eb315c45bb70c6@mail.gmail.com> <4072c51f0907211736x738502favf7a387a98ec94d64@mail.gmail.com> <1c1a33bc0907220025j3baeb8e8jd3659a720b6e1156@mail.gmail.com> <4072c51f0907220342v73ae96adm420e124dcf59101c@mail.gmail.com> Message-ID: A new version of the package is now available that fixes this message. Jay On Wed, Jul 22, 2009 at 4:42 AM, Jens Axel S?gaard wrote: > 2009/7/22 Thomas Chust : >> I'm not sure whether it would really be worth the effort, but you >> should in principle be able to tell the difference by using the pzTail >> output parameter of the SQLite API function that compiles the >> statement: If the tail pointer passed out is identical to the SQL >> source pointer passed in, nothing has been compiled, if it's >> different, at least one statement has been consumed by the parser. >> >> Probably it is not completely trivial to implement that logic, though, >> because the SQL source pointer passed to the SQLite API call is not >> directly visible to Scheme code but rather some buffer allocated by >> the FFI. > > Fortunately, the tail is already available. It is used in the current > error message: > > (define (prepare db sql) > ?(let*-values > ? ? ([(stmt prep-status tail) > ? ? ? (sqlite3_prepare_v2 (db-handle db) sql)] > ? ? ?[(the-stmt) (wrap-finalizer (make-statement db stmt) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?finalize)]) > ? (when (not (zero? (string-length tail))) > ? ? (sqlite-error "You should only prepare one statement at a time! ~s" tail)) > ? (when (handle-status db prep-status) > ? ? (if stmt > ? ? ? ? the-stmt > ? ? ? ? ;; the pointer is null; SQLite didn't raise an > ? ? ? ? ;; error but should have! > ? ? ? ? (sqlite-error "sqlite3_prepare_v2 returned a NULL pointer"))))) > > Yet another way to get the "prepare one statement at a time" error, > is to prepare a CREATE TABLES statement with an already existing table > name. > > -- > Jens Axel S?gaard > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From lordgeoffrey at optushome.com.au Wed Jul 22 15:12:26 2009 From: lordgeoffrey at optushome.com.au (LordGeoffrey) Date: Wed Jul 22 15:12:48 2009 Subject: [plt-scheme] Crash on 3 drag n' dropped files Message-ID: <4A67649A.5000903@optushome.com.au> If i drag three scheme source code files onto DrScheme (v4.2 [3m]) it crashes. I do them one at a time. Sometimes it crashes on the fourth not the third file. It doesn't matter which files i drag. OS: Ubuntu 9.04 From d.j.gurnell at gmail.com Thu Jul 23 03:45:40 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Jul 23 03:46:23 2009 Subject: [plt-scheme] Web browsing package? In-Reply-To: <98b8086f0907220127s1b2d4f5web31fa055c82bff1@mail.gmail.com> References: <9bd8a08a0907201043x51230ec8r191057355673771f@mail.gmail.com> <98b8086f0907220127s1b2d4f5web31fa055c82bff1@mail.gmail.com> Message-ID: On 22 Jul 2009, at 09:27, troels knak-nielsen wrote: > On Mon, Jul 20, 2009 at 7:43 PM, Elena Garrulo > wrote: >> Hi, >> >> is there a package for automated web browsing, kind of Perl's >> WWW::Mechanize >> ( >> http://search.cpan.org/~petdance/WWW-Mechanize-1.58/lib/WWW/Mechanize.pm#SYNOPSIS >> ) ? >> > > Not a direct answer, since I don't know of any such projects for plt, > but you could consider remote-controlling firefox instead. > You can start firefox up in Xvfb (headless) and then use an extension > such as mozrepl[1] to connect to it. Since Troels mentioned this... Delirium (on PLaneT) will be a browser remote for you if that's the direction you want to go. Delirium is oriented towards web UI testing (it's a reimplementation of Selenium using continuations) but you don't necessarily need to use it for that purpose - you only need to rewrite serve/delirium to take a procedure instead of a Schemeunit test-suite to use it for general browser control. Let me know if you're interested and I'll knock up a demo. -- Dave From egarrulo at gmail.com Thu Jul 23 04:43:29 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Thu Jul 23 04:43:50 2009 Subject: [plt-scheme] Web browsing package? In-Reply-To: References: <9bd8a08a0907201043x51230ec8r191057355673771f@mail.gmail.com> <98b8086f0907220127s1b2d4f5web31fa055c82bff1@mail.gmail.com> Message-ID: <9bd8a08a0907230143w107aa2fene465363b6ac0370a@mail.gmail.com> 2009/7/23 Dave Gurnell > > Delirium (on PLaneT) will be a browser remote for you if that's the > direction you want to go. > > Delirium is oriented towards web UI testing (it's a reimplementation of > Selenium using continuations) but you don't necessarily need to use it for > that purpose - you only need to rewrite serve/delirium to take a procedure > instead of a Schemeunit test-suite to use it for general browser control. Thank you for your answer :-) I checked up Delirium's page on Planet. I don't understand if that's what I'm looking for... Is Delirium built on top of an existing browser, as Selenium is? To restate my goal: I'm looking for a library which would allow me to browse a site -possibly entering some text (passwords, etc.) - and then read loaded pages, possibly saving them images included. > Let me know if you're interested and I'll knock up a demo. That would be very kind of you, thanks. I'm not in an hurry now... I'll bump again when the need will arise. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090723/d6217767/attachment.htm From asolove at u.washington.edu Wed Jul 22 11:00:09 2009 From: asolove at u.washington.edu (Adam C.M. Solove) Date: Thu Jul 23 05:59:07 2009 Subject: [plt-scheme] Macro tutorial question Message-ID: <92bb2aa00907220800v1b6c231eye64d3a9451247c83@mail.gmail.com> Hello all, I am reading through the PLT Scheme Guide section on Generating Macros ( http://docs.plt-scheme.org/guide/pattern-macros.html#(part._.Macro-.Generating_.Macros)A number of the examples in this section depend on the macro define-get/put-id, which is defined (seemingly just as the appropriate macroexpansion for one case rather than for the general case) as : (define-syntax-rule (define-get/put-id id get put!) (define-syntax clock (syntax-id-rules (set! ) [(set! clock e) (put-clock! e)] [(clock a (... ... )) ((get-clock) a (... ... ))] [clock (get-clock)]))) I simply adapted it to the general case and got: (define-syntax-rule (define-get/put-id id get put!) (define-syntax id (syntax-id-rules (set!) [(set! id e) (put! e)] [(id a (... ...)) ((get) a (... ...))] [id (get)]))) Which works, surprisingly, and confuses me. Generally define-syntax does not evaluate the first argument but uses it as a symbol naming the item in the syntax, but in this case, id is a identifier which gets evaluated so that the passed value of id is used as the actual syntax. Does define-syntax check in the environment and use the literal symbol as its name unless it has a defined value as an identifier? I tried to look this up in the documentation for define-syntax but quickly got confused. Thanks, Adam -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090722/28eb2ff5/attachment.html From jensaxel at soegaard.net Thu Jul 23 07:18:39 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Thu Jul 23 07:18:59 2009 Subject: [plt-scheme] Macro tutorial question In-Reply-To: <92bb2aa00907220800v1b6c231eye64d3a9451247c83@mail.gmail.com> References: <92bb2aa00907220800v1b6c231eye64d3a9451247c83@mail.gmail.com> Message-ID: <4072c51f0907230418y7f9bf5a7o1679e1500875839e@mail.gmail.com> Hi Adam, > Which works, surprisingly, and confuses me. Generally define-syntax does not > evaluate the first argument but uses it as a symbol naming the item in the > syntax, ... This is true for syntax-rules, but not for syntax-case. In rare cases one can get bitten by this, and therefore it is recommended to use _ with syntax-case macros. -- Jens Axel S?gaard From d.j.gurnell at gmail.com Thu Jul 23 07:31:59 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Jul 23 07:32:37 2009 Subject: [plt-scheme] Web browsing package? In-Reply-To: <9bd8a08a0907230143w107aa2fene465363b6ac0370a@mail.gmail.com> References: <9bd8a08a0907201043x51230ec8r191057355673771f@mail.gmail.com> <98b8086f0907220127s1b2d4f5web31fa055c82bff1@mail.gmail.com> <9bd8a08a0907230143w107aa2fene465363b6ac0370a@mail.gmail.com> Message-ID: On 23 Jul 2009, at 09:43, Elena Garrulo wrote: > 2009/7/23 Dave Gurnell > > Delirium (on PLaneT) will be a browser remote for you if that's the > direction you want to go. > > Delirium is oriented towards web UI testing (it's a reimplementation > of Selenium using continuations) but you don't necessarily need to > use it for that purpose - you only need to rewrite serve/delirium to > take a procedure instead of a Schemeunit test-suite to use it for > general browser control. > > Thank you for your answer :-) > > I checked up Delirium's page on Planet. I don't understand if that's > what I'm looking for... Is Delirium built on top of an existing > browser, as Selenium is? > > To restate my goal: I'm looking for a library which would allow me > to browse a site -possibly entering some text (passwords, etc.) - > and then read loaded pages, possibly saving them images included. > > > Let me know if you're interested and I'll knock up a demo. > > That would be very kind of you, thanks. I'm not in an hurry now... > I'll bump again when the need will arise. Delirium is basically a web application. You access the app from a browser and download a web page that contains: - a bunch of scripts that allow the web server to send commands to the browser; - an IFRAME, into which you can load (and control) another web page. To be honest, it doesn't sound like this is quite what you're looking for, but it might do the job if you can get around cross-site- scripting restrictions. Selenium has a proxy to do this... we haven't written anything like that yet (and if we had, the proxy code would probably be more useful to you than Delirium itself). It is possible (though unreasonably difficult) to configure Firefox to trust a web app enough to lift these restrictions and allow XSS. -- Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090723/73f6a63a/attachment.htm From dave at pawfal.org Thu Jul 23 10:58:50 2009 From: dave at pawfal.org (Dave Griffiths) Date: Thu Jul 23 10:59:12 2009 Subject: [plt-scheme] compiling openssl Message-ID: <1248361130.7329.33.camel@kittywake> Hi all, Any ideas if this is possible to get around?: $ mzc --c-mods test.c ++lib openssl path->bytes: expects argument of type ; given "?" === context === /usr/local/lib/plt/collects/compiler/embed-unit.ss:846:60 /usr/local/lib/plt/collects/scheme/private/map.ss:22:17: loop /usr/local/lib/plt/collects/scheme/private/map.ss:22:17: loop /usr/local/lib/plt/collects/compiler/embed-unit.ss:743:4: do-write-module-bundle cheers, dave From robby at eecs.northwestern.edu Fri Jul 24 01:02:18 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Fri Jul 24 01:02:38 2009 Subject: [plt-scheme] Some more usability issues In-Reply-To: <20090721190749.360980b1@halmanfloyd.lan.local> References: <20090718151312.01a25726@halmanfloyd.lan.local> <20090721190749.360980b1@halmanfloyd.lan.local> Message-ID: <932b2f1f0907232202s735462d2wd6d25e3b67574f66@mail.gmail.com> I've addressed two of your requests below. Thanks for the feedback. On Tue, Jul 21, 2009 at 12:07 PM, Marek Kubica wrote: >> - Search in Helpdesk for "(selection)" in the context menu. This >> option is incredibly useful, but when I select a large amount of >> text, the whole 'Search in Helpdesk for "large amount of text"' makes >> the menu very, very large. I think it would be better to shorten it >> to the first selected form and add "..." to it. The user will know >> that there is some more text while not blowing up the sice of the >> menu. Probably best to just hit f1 instead of using that menu, but I've limited the number of characters to 50. > I found another one: when editing stuff in the REPL, I am often "done" > and want to execute the expression. Unsurprisingly pressing [Enter] > in the middle does not work as it inserts a newline. I have to go back > to the end of the expression to execute it. > > Would it be possible to add, uhm Ctrl+Enter to evaluate the current > expression directly, without the need to go to the end of the line? I've made it so that numpad-enter as well as control-return/enter and alt-return/enter submit the current interaction. Robby From andrew-scheme at areilly.bpc-users.org Fri Jul 24 00:52:18 2009 From: andrew-scheme at areilly.bpc-users.org (Andrew Reilly) Date: Fri Jul 24 02:39:19 2009 Subject: [plt-scheme] Red black trees in PLT Scheme In-Reply-To: References: <20090721192805.3ae3994e@halmanfloyd.lan.local> <20090722084621.6c1640cd@halmanfloyd.lan.local> <990e0c030907212351r655864f3h3fe98cd3f955aca9@mail.gmail.com> <20090722090129.0e65c7ef@halmanfloyd.lan.local> Message-ID: <20090724045218.GA64732@duncan.reilly.home> On Wed, Jul 22, 2009 at 09:18:10AM -0400, Shriram Krishnamurthi wrote: > If "code size" and "elegance" are your *primary* criteria, then > Okasaki's paper explains very clearly why his version will win hands > down. (It is a truly beautiful presentation, and his reduction of all > four invariant-violating cases to one has a "God's Book" feel to it.) That is indeed a beautiful paper. Thanks for the link! I was so inspired by it (I've never been able to bother myself to properly understand red-black trees before) that I dove straight in and wrote myself a scheme version. Thanks to "match" it even looks pretty similar to the Hascall version in the paper, and is about as long... I have been using a hash-based set implementation in my code for a while. It works beautifully in all respects except one: when I get my set-elements back as a list, the order changes from run to run. This is not "wrong" per se, but I've found that producing different output given the same input results in raised eyebrows and distrust from colleagues. I've countered that with a list-based implementation which works beautifully too, but of course has that undesirable O(N^2) (or worse) behaviour for many sorts of operations. So I thought that an r-b tree version might give me better lookup (set membership test) time than the list version while having some sort of known order... but it doesn't. I need a < operator that works between elements, and if I use (lambda (x y) (< (eq-hash-code x) (eq-hash-code y)) as a comparison operation I'll wind up with the same sort of randomness as the hash table version, I suspect. Clearly I'm going to have to put an extra, deterministic "ID" tag into my "node" structures if I want to have some sort of stable ordering. Oh, well. What I wonder, though, is: will this work at all? Is the eq-hash-code of a struct stable across garbage collections? I had assumed that eq-hash-code was somehow derived from the memory address of the argument object, but the 3m version of PLT uses a copying collector, I believe, so object locations can change over time. That could result in the "order" in my r-b tree becoming wrong (and searches failing) over time. How is this handelled with hash-tables? I assume that they ultimately use numbers derived from eq-hash-code for vector indexes... Cheers, -- Andrew From noelwelsh at gmail.com Fri Jul 24 03:11:32 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Jul 24 03:11:51 2009 Subject: [plt-scheme] Red black trees in PLT Scheme In-Reply-To: <20090724045218.GA64732@duncan.reilly.home> References: <20090721192805.3ae3994e@halmanfloyd.lan.local> <20090722084621.6c1640cd@halmanfloyd.lan.local> <990e0c030907212351r655864f3h3fe98cd3f955aca9@mail.gmail.com> <20090722090129.0e65c7ef@halmanfloyd.lan.local> <20090724045218.GA64732@duncan.reilly.home> Message-ID: On Fri, Jul 24, 2009 at 5:52 AM, Andrew Reilly wrote: > What I wonder, though, is: will this work at all? ?Is the > eq-hash-code of a struct stable across garbage collections? ?I > had assumed that eq-hash-code was somehow derived from the > memory address of the argument object, but the 3m version of > PLT uses a copying collector, I believe, so object locations can > change over time. ?That could result in the "order" in my r-b > tree becoming wrong (and searches failing) over time. I believe that the GC maintains a table mapping objects to hash codes, and this is updated whenever an object is moved. I don't recall where I got this idea from, so it might be PLT doesn't work this way and I'm thinking of a different language implementation. N. From carl.eastlund at gmail.com Fri Jul 24 03:44:44 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Fri Jul 24 03:45:22 2009 Subject: [plt-scheme] Red black trees in PLT Scheme In-Reply-To: References: <20090721192805.3ae3994e@halmanfloyd.lan.local> <20090722084621.6c1640cd@halmanfloyd.lan.local> <990e0c030907212351r655864f3h3fe98cd3f955aca9@mail.gmail.com> <20090722090129.0e65c7ef@halmanfloyd.lan.local> <20090724045218.GA64732@duncan.reilly.home> Message-ID: <990e0c030907240044y2ae4d61fnebf28095ec468d32@mail.gmail.com> On Fri, Jul 24, 2009 at 3:11 AM, Noel Welsh wrote: > On Fri, Jul 24, 2009 at 5:52 AM, Andrew > Reilly wrote: > >> What I wonder, though, is: will this work at all? ?Is the >> eq-hash-code of a struct stable across garbage collections? ?I >> had assumed that eq-hash-code was somehow derived from the >> memory address of the argument object, but the 3m version of >> PLT uses a copying collector, I believe, so object locations can >> change over time. ?That could result in the "order" in my r-b >> tree becoming wrong (and searches failing) over time. > > I believe that the GC maintains a table mapping objects to hash codes, > and this is updated whenever an object is moved. I don't recall where > I got this idea from, so it might be PLT doesn't work this way and I'm > thinking of a different language implementation. PLT stores eq hash codes in extra bits in the GC metadata (how many depends on your platform). The codes are stable -- they don't change as GC happens, though they are not guaranteed unique. PLT's immutable hash tables are, in fact, implemented as red-black trees over hash codes. --Carl From jay.mccarthy at gmail.com Fri Jul 24 08:37:43 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Fri Jul 24 08:38:05 2009 Subject: [plt-scheme] A little demo of something I've been playing with... Message-ID: I written an FFI for the Chipmunk Physics Engine: http://code.google.com/p/chipmunk-physics/ And some convenient functions for doing 2d OpenGL graphics... And a "World" like interface to GL Canvases to simplify making simple apps/animations... Here's a little preview: http://screencast.com/t/wXw4QbOkUpM 1. The black ball is controlled by the arrow keys which apply forces to its sides... pushing it around and pushing the boxes 2. The boxes are sprites that are loaded onto the video card with a very convenient texture map API. A nice thing about these sprites is that you can tell the rotation very well. 3. It runs in real time 60 fps, but the video is a bit choppy... it looks much nicer on your computer Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From pivanyi at freemail.hu Fri Jul 24 09:26:07 2009 From: pivanyi at freemail.hu (Ivanyi Peter) Date: Fri Jul 24 09:26:27 2009 Subject: [plt-scheme] grid or spreadsheet GUI widget Message-ID: Hi, I will need a grid or spreadsheet style GUI widget in my application. I have some ideas and some preliminary work. However I would like to ask two questions: - Is it possible to position some sort of an editor% or text% in a canvas%? I am thinking of pixel positioning. I thought I would need this to easily edit a cell and I could avoid implementing an edit box. - Is it possible to create this GUI widget with some snips? If yes, can someone point me to a similar usage of snips? Somehow I still do not fully understand the use of snips. :-( Thanks, Peter Ivanyi From andrew-scheme at areilly.bpc-users.org Fri Jul 24 09:42:29 2009 From: andrew-scheme at areilly.bpc-users.org (Andrew Reilly) Date: Fri Jul 24 09:43:01 2009 Subject: [plt-scheme] Red black trees in PLT Scheme In-Reply-To: <990e0c030907240044y2ae4d61fnebf28095ec468d32@mail.gmail.com> References: <20090721192805.3ae3994e@halmanfloyd.lan.local> <20090722084621.6c1640cd@halmanfloyd.lan.local> <990e0c030907212351r655864f3h3fe98cd3f955aca9@mail.gmail.com> <20090722090129.0e65c7ef@halmanfloyd.lan.local> <20090724045218.GA64732@duncan.reilly.home> <990e0c030907240044y2ae4d61fnebf28095ec468d32@mail.gmail.com> Message-ID: <20090724134229.GA13399@duncan.reilly.home> On Fri, Jul 24, 2009 at 03:44:44AM -0400, Carl Eastlund wrote: > PLT stores eq hash codes in extra bits in the GC metadata (how many > depends on your platform). The codes are stable -- they don't change > as GC happens, though they are not guaranteed unique. That's good to know, thanks! > PLT's immutable hash tables are, in fact, implemented as red-black > trees over hash codes. Coolness. Thought they might be. It was fun to build my own anyway. Cheers, -- Andrew From m.douglas.williams at gmail.com Fri Jul 24 10:00:22 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Fri Jul 24 10:00:52 2009 Subject: [plt-scheme] grid or spreadsheet GUI widget In-Reply-To: References: Message-ID: I have a table-panel% on PLaneT that I use. This aligns GUI elements into a grid pattern. It may meet your needs. http://planet.plt-scheme.org/display.ss?package=table-panel.plt&owner=williams Doug 2009/7/24 Ivanyi Peter > Hi, > > I will need a grid or spreadsheet style GUI widget in my > application. I have some ideas and some preliminary work. > However I would like to ask two questions: > - Is it possible to position some sort of an editor% or text% > in a canvas%? I am thinking of pixel positioning. I thought > I would need this to easily edit a cell and I could avoid > implementing an edit box. > - Is it possible to create this GUI widget with some snips? > If yes, can someone point me to a similar usage of snips? > Somehow I still do not fully understand the use of snips. :-( > > Thanks, > > Peter Ivanyi > > _________________________________________________ > 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/20090724/c4e2ec4a/attachment.htm From dyrueta at gmail.com Fri Jul 24 14:41:34 2009 From: dyrueta at gmail.com (Gadfly) Date: Fri Jul 24 14:41:52 2009 Subject: [plt-scheme] Dr. Scheme Function 'Remove' Message-ID: HtDP exercise 27.5.5 calls for the use of function 'remove'. However, Dr. Scheme reports an error when remove is used: "reference to an identifier before its definition: remove." Any way to access this function? Thanks, Dave Yrueta From matthias at ccs.neu.edu Fri Jul 24 14:57:23 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Fri Jul 24 14:57:55 2009 Subject: [plt-scheme] Dr. Scheme Function 'Remove' In-Reply-To: References: Message-ID: <862EA227-9B65-4FC4-AD99-5FFD8035F502@ccs.neu.edu> The function got lost. I'll restore it this afternoon -- Matthias On Jul 24, 2009, at 2:41 PM, Gadfly wrote: > HtDP exercise 27.5.5 calls for the use of function 'remove'. However, > Dr. Scheme reports an error when remove is used: "reference to an > identifier before its definition: remove." > > Any way to access this function? > > Thanks, > Dave Yrueta > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From matthias at ccs.neu.edu Fri Jul 24 18:09:13 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Fri Jul 24 18:09:52 2009 Subject: [plt-scheme] Dr. Scheme Function 'Remove' In-Reply-To: References: Message-ID: <8930F961-64EB-4CE8-BDF8-51884F5E8B66@ccs.neu.edu> Committed to svn head. On Jul 24, 2009, at 2:41 PM, Gadfly wrote: > HtDP exercise 27.5.5 calls for the use of function 'remove'. However, > Dr. Scheme reports an error when remove is used: "reference to an > identifier before its definition: remove." > > Any way to access this function? > > Thanks, > Dave Yrueta > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From dyrueta at gmail.com Fri Jul 24 21:30:32 2009 From: dyrueta at gmail.com (David Yrueta) Date: Fri Jul 24 21:31:14 2009 Subject: [plt-scheme] Dr. Scheme Function 'Remove' In-Reply-To: <8930F961-64EB-4CE8-BDF8-51884F5E8B66@ccs.neu.edu> References: <8930F961-64EB-4CE8-BDF8-51884F5E8B66@ccs.neu.edu> Message-ID: <186df66b0907241830o126de675i5567c97fcbeff1ce@mail.gmail.com> Thank you! On Fri, Jul 24, 2009 at 3:09 PM, Matthias Felleisen wrote: > > Committed to svn head. > > On Jul 24, 2009, at 2:41 PM, Gadfly wrote: > > HtDP exercise 27.5.5 calls for the use of function 'remove'. However, >> Dr. Scheme reports an error when remove is used: "reference to an >> identifier before its definition: remove." >> >> Any way to access this function? >> >> Thanks, >> Dave Yrueta >> >> _________________________________________________ >> 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/20090724/5e633133/attachment.html From jay.mccarthy at gmail.com Fri Jul 24 22:18:59 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Fri Jul 24 22:19:19 2009 Subject: [plt-scheme] Re: A little demo of something I've been playing with... In-Reply-To: References: Message-ID: This demo has less physics but more Metroid: http://screencast.com/t/JXlAUm8iddr Jay On Fri, Jul 24, 2009 at 6:37 AM, Jay McCarthy wrote: > I written an FFI for the Chipmunk Physics Engine: > > http://code.google.com/p/chipmunk-physics/ > > And some convenient functions for doing 2d OpenGL graphics... > > And a "World" like interface to GL Canvases to simplify making simple > apps/animations... > > Here's a little preview: > > http://screencast.com/t/wXw4QbOkUpM > > 1. The black ball is controlled by the arrow keys which apply forces > to its sides... pushing it around and pushing the boxes > > 2. The boxes are sprites that are loaded onto the video card with a > very convenient texture map API. A nice thing about these sprites is > that you can tell the rotation very well. > > 3. It runs in real time 60 fps, but the video is a bit choppy... it > looks much nicer on your computer > > Jay > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From marek at xivilization.net Sat Jul 25 06:34:49 2009 From: marek at xivilization.net (Marek Kubica) Date: Sat Jul 25 06:35:11 2009 Subject: [plt-scheme] Some more usability issues In-Reply-To: <932b2f1f0907232202s735462d2wd6d25e3b67574f66@mail.gmail.com> References: <20090718151312.01a25726@halmanfloyd.lan.local> <20090721190749.360980b1@halmanfloyd.lan.local> <932b2f1f0907232202s735462d2wd6d25e3b67574f66@mail.gmail.com> Message-ID: <20090725123449.29827995@halmanfloyd.lan.local> On Fri, 24 Jul 2009 00:02:18 -0500 Robby Findler wrote: > Probably best to just hit f1 instead of using that menu, but I've > limited the number of characters to 50. Possibly, but it was also visually distracting when the whole display was covered by the menu (I have a 15" screen, so this happens easily). > > I found another one: when editing stuff in the REPL, I am often > > "done" and want to execute the expression. Unsurprisingly pressing > > [Enter] in the middle does not work as it inserts a newline. I have > > to go back to the end of the expression to execute it. > > > > Would it be possible to add, uhm Ctrl+Enter to evaluate the current > > expression directly, without the need to go to the end of the line? > > I've made it so that numpad-enter as well as control-return/enter and > alt-return/enter submit the current interaction. Thanks, this will make the REPL a good deal nicer. Do you have any plans regarding the scalability of the debugger widgets? regards, Marek From nartamonov at gmail.com Fri Jul 24 13:38:24 2009 From: nartamonov at gmail.com (Nikolay Artamonov) Date: Sat Jul 25 08:05:06 2009 Subject: [plt-scheme] Re: A little demo of something I've been playing with... In-Reply-To: References: Message-ID: Are you going to share the code? On Jul 24, 4:37?pm, Jay McCarthy wrote: > I written an FFI for the Chipmunk Physics Engine: > > http://code.google.com/p/chipmunk-physics/ > > And some convenient functions for doing 2d OpenGL graphics... > > And a "World" like interface to GL Canvases to simplify making simple > apps/animations... > > Here's a little preview: > > http://screencast.com/t/wXw4QbOkUpM > > 1. The black ball is controlled by the arrow keys which apply forces > to its sides... pushing it around and pushing the boxes > > 2. The boxes are sprites that are loaded onto the video card with a > very convenient texture map API. A nice thing about these sprites is > that you can tell the rotation very well. > > 3. It runs in real time 60 fps, but the video is a bit choppy... it > looks much nicer on your computer > > Jay > > -- > Jay McCarthy > Assistant Professor / Brigham Young Universityhttp://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jay.mccarthy at gmail.com Sat Jul 25 08:05:46 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Sat Jul 25 08:06:07 2009 Subject: [plt-scheme] Re: A little demo of something I've been playing with... In-Reply-To: References: Message-ID: Yup, it will be on PLaneT imminently. Jay On Fri, Jul 24, 2009 at 11:38 AM, Nikolay Artamonov wrote: > Are you going to share the code? > > On Jul 24, 4:37?pm, Jay McCarthy wrote: >> I written an FFI for the Chipmunk Physics Engine: >> >> http://code.google.com/p/chipmunk-physics/ >> >> And some convenient functions for doing 2d OpenGL graphics... >> >> And a "World" like interface to GL Canvases to simplify making simple >> apps/animations... >> >> Here's a little preview: >> >> http://screencast.com/t/wXw4QbOkUpM >> >> 1. The black ball is controlled by the arrow keys which apply forces >> to its sides... pushing it around and pushing the boxes >> >> 2. The boxes are sprites that are loaded onto the video card with a >> very convenient texture map API. A nice thing about these sprites is >> that you can tell the rotation very well. >> >> 3. It runs in real time 60 fps, but the video is a bit choppy... it >> looks much nicer on your computer >> >> Jay >> >> -- >> Jay McCarthy >> Assistant Professor / Brigham Young Universityhttp://teammccarthy.org/jay >> >> "The glory of God is Intelligence" - D&C 93 >> _________________________________________________ >> ? 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 > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From robby at eecs.northwestern.edu Sat Jul 25 08:23:20 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Jul 25 08:23:42 2009 Subject: [plt-scheme] Some more usability issues In-Reply-To: <20090725123449.29827995@halmanfloyd.lan.local> References: <20090718151312.01a25726@halmanfloyd.lan.local> <20090721190749.360980b1@halmanfloyd.lan.local> <932b2f1f0907232202s735462d2wd6d25e3b67574f66@mail.gmail.com> <20090725123449.29827995@halmanfloyd.lan.local> Message-ID: <932b2f1f0907250523u6bf99287r5d89cd2934f89bbf@mail.gmail.com> On Sat, Jul 25, 2009 at 5:34 AM, Marek Kubica wrote: > Do you have any plans regarding the scalability of the debugger widgets? I do not personally, no. But someone who maintains it might. Patches, as always, are welcome. Robby From emmanuel.delaborde at cimex.com Sat Jul 25 15:30:03 2009 From: emmanuel.delaborde at cimex.com (Emmanuel Delaborde) Date: Sat Jul 25 15:39:00 2009 Subject: [plt-scheme] PLT Web Server Message-ID: <83CFB667-CD8E-49F5-82BB-6DF5B5F63E85@cimex.com> hello I've just read "Continue: Web Applications in PLT Scheme" and started modifying the blog application. I want to add a file upload form but I got stuck... the code generating the form is: (form ((action ,(make-url add-image)) (method "post") (enctype "multipart/form-data")) (input ((type "file")(name "image"))) (input ((type "submit")))) I am not sure how to write add-image, more precisely, I am not sure what type of data (extract-binding/single 'image bindings) is... My hunch is that it is a binary stream (the file data), so I tried: (define (add-image request) (define bindings (request-bindings request)) (save-image! (extract-binding/single 'image bindings) "image.jpg") ... ) where (define (save-image! image-data image-name) (with-output-to-file (build-path (find-system-path 'home-dir) image-name) (lambda () (write image-data)) #:exists 'replace)) but this gives the following exception: The application raised an exception with the message: you broke the contract xexpr? on start; Not an Xexpr. Expected a string, symbol, number, comment, processing instruction, or list, given # Context: # Stack trace: at: line 18, column 5, in file /Applications/PLT Scheme v4.2/collects/ web-server/private/xexpr.ss Any idea what went wrong ? Is there any examples online of web app written with PLT, beside the Continue tutorial ? Thanks E.D -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090725/e21e7d12/attachment.htm From noelwelsh at gmail.com Sat Jul 25 16:03:19 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Sat Jul 25 16:04:06 2009 Subject: [plt-scheme] PLT Web Server In-Reply-To: <83CFB667-CD8E-49F5-82BB-6DF5B5F63E85@cimex.com> References: <83CFB667-CD8E-49F5-82BB-6DF5B5F63E85@cimex.com> Message-ID: On Sat, Jul 25, 2009 at 8:30 PM, Emmanuel Delaborde wrote: > I want to add a file upload form but I got stuck... > ... > The application raised an exception with the message: > > you broke the contract xexpr? on start; Not an Xexpr. Expected a string, > symbol, number, comment, processing instruction, or list, given # > Context: > # > > Stack trace: Two things: 1. Your function add-image didn't return a xexpr; instead it returned void. It must return something to the browser, or you'll get this error message. A simple result might be: '(html (head (title "Thanks")) (body (h1 "Thanks. Your file has been saved."))) 2. Using extract-binding/single and friends is bad style; better to use bindings-assq -- search Help Desk for the docs (press F1 in DrScheme, or choose Help from the menu). Finally, I don't know of any sizable public projects written using the web server. (There are several sizable private projects written using it.) HTH, N. From emmanuel.delaborde at cimex.com Sat Jul 25 18:58:39 2009 From: emmanuel.delaborde at cimex.com (Emmanuel Delaborde) Date: Sat Jul 25 18:58:59 2009 Subject: [plt-scheme] PLT Web Server In-Reply-To: References: <83CFB667-CD8E-49F5-82BB-6DF5B5F63E85@cimex.com> Message-ID: <8DDC93B7-94B1-4552-BE2C-98364FF5D58A@cimex.com> On 25 Jul 2009, at 21:03, Noel Welsh wrote: > > 1. Your function add-image didn't return a xexpr; instead it returned > void. It must return something to the browser, or you'll get this > error message. A simple result might be: > > '(html (head (title "Thanks")) (body (h1 "Thanks. Your file has been > saved."))) > > 2. Using extract-binding/single and friends is bad style; better to > use bindings-assq -- search Help Desk for the docs (press F1 in > DrScheme, or choose Help from the menu). > > Finally, I don't know of any sizable public projects written using the > web server. (There are several sizable private projects written using > it.) > > HTH, > N. Thanks Noel, Point 1 fixed the error and point 2 gave a valuable example with bindings-assq and some file-related form binding info I was also using write instead of display when saving the file content and that didn't work E.D From troelskn at gmail.com Sat Jul 25 19:00:42 2009 From: troelskn at gmail.com (troels knak-nielsen) Date: Sat Jul 25 19:01:06 2009 Subject: [plt-scheme] errortrace? Message-ID: <98b8086f0907251600o5be34a3bu6ceb8fa5f8affb37@mail.gmail.com> Hi. I have the following program: $ cat tracecar.ss #lang scheme (require errortrace) (car '()) When I run it, it generates an error (obviously): $ mzscheme tracecar.ss car: expects argument of type ; given () But there is no mention of the file/linenumber that generates the error. Shouldn't errortrace enable this or is there another way to get error traces? I'm using: $ mzscheme --version Welcome to MzScheme v4.1.3 [3m], Copyright (c) 2004-2008 PLT Scheme Inc. -- troels From mflatt at cs.utah.edu Sat Jul 25 20:12:08 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sat Jul 25 20:12:32 2009 Subject: [plt-scheme] errortrace? In-Reply-To: <98b8086f0907251600o5be34a3bu6ceb8fa5f8affb37@mail.gmail.com> References: <98b8086f0907251600o5be34a3bu6ceb8fa5f8affb37@mail.gmail.com> Message-ID: <20090726001210.D09A06500BE@mail-svr1.cs.utah.edu> At Sun, 26 Jul 2009 01:00:42 +0200, troels knak-nielsen wrote: > I have the following program: > > $ cat tracecar.ss > #lang scheme > (require errortrace) > > (car '()) > > When I run it, it generates an error (obviously): > > $ mzscheme tracecar.ss > car: expects argument of type ; given () > > But there is no mention of the file/linenumber that generates the > error. Shouldn't errortrace enable this or is there another way to get > error traces? The `errortrace' module is strange, and it doesn't work to import it with `require'. (I think the docs are not helpful enough, and I'll work on that.) Run your program like this, instead: $ mzscheme -l errortrace -t tracecar.ss From spamme at innerpaths.net Sun Jul 26 02:52:40 2009 From: spamme at innerpaths.net (Gregg Williams) Date: Sun Jul 26 02:52:58 2009 Subject: [plt-scheme] accessing a top-level variable whose name is stored in a global variable Message-ID: <4ae4c900-0373-4ea9-98de-d5a04f81ae1d@13g2000prl.googlegroups.com> Hi--My question has to do with how to accomplish indirection in Scheme--in particular, in the following (slightly simplified) function: (define (infoml:get-card-from-active-rack n) (list-ref (eval *infoml:active-rack-name*) n)) My intent is this. A "rack" is a named list defined at the top level, and my program has exactly one active rack. You guessed it, its name is stored in *infoml:active-rack-name*. In my code, I create a rack named decision-making as follows: (define decision-making (infoml:make-rack 'decision-making)) In addition to defining a rack (i.e., a list) named decision-making, it also stores the value of the symbol 'decision-making in the global variable *infoml:active-rack-name*. What I'm trying to do with infoml:get-card-from-active-rack is to return the n'th item from the currently active rack--in this case, the n'th item in the rack/list named decision-making. At first, I wrote a function like this: (define (infoml:get-card-from-active-rack n) (list-ref *infoml:active-rack-name* n)) ... but that certainly didn't work. I read a lot of the PLT Scheme documentation but couldn't find anything that allowed me the indirection that I wanted. The documentation on eval was particularly forbidding, but I tried it anyway...and it seems to work! However, at the end of my program (which *is* giving me the correct output), I get the following error message: compile: unbound identifier (and no #%top syntax transformer is bound) in: decision-making I'd appreciate any insights on what would be a good way to accomplish what I'm trying to do. I'm not expecting any lengthy explanations, but pointing me to the right PLT Scheme documentation would be entirely sufficient. Thanks. From toddobryan at gmail.com Sun Jul 26 08:11:36 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sun Jul 26 08:18:57 2009 Subject: [plt-scheme] Some dissing of Scheme Message-ID: <904774730907260511t3cb95653vb430ad532c3c1bca@mail.gmail.com> http://tech.slashdot.org/story/09/07/25/1224247/The-Best-First-Language-For-a-Young-Programmer I already posted a comment linking to HtDP and How to Design Worlds, but I thought people might want to see the article. Todd From lists.amitsaha at gmail.com Sun Jul 26 08:48:21 2009 From: lists.amitsaha at gmail.com (Amit Saha) Date: Sun Jul 26 08:49:28 2009 Subject: [plt-scheme] Guessing the file type? Message-ID: <4A6C5095.1080001@gmail.com> Hello all, Is there a known way to find the MIME type of a file: text, audio, etc ? Thanks a ton. Best, Amit -- email: amitsaha.in@gmail.com Journal: http://amitksaha.wordpress.com ?-blog: http://twitter.com/amitsaha IRC: cornucopic on #scheme, #lisp, #math, #linux From jay.mccarthy at gmail.com Sun Jul 26 08:54:11 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Sun Jul 26 08:54:33 2009 Subject: [plt-scheme] Guessing the file type? In-Reply-To: <4A6C5095.1080001@gmail.com> References: <4A6C5095.1080001@gmail.com> Message-ID: On Unix/OS X there is a program called 'file' that works pretty well. Also, if you use the mime type library in the PLT Web server, it uses the system database of file extensions to return a mime type. Jay On Sun, Jul 26, 2009 at 6:48 AM, Amit Saha wrote: > Hello all, > > Is there a known way to find the MIME type of a file: text, audio, etc ? > > Thanks a ton. > > Best, > Amit > -- > email: amitsaha.in@gmail.com > Journal: http://amitksaha.wordpress.com > =B5-blog: http://twitter.com/amitsaha > IRC: cornucopic on #scheme, #lisp, #math, #linux > _________________________________________________ > =A0For list-related administrative tasks: > =A0http://list.cs.brown.edu/mailman/listinfo/plt-scheme > --=20 Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From mflatt at cs.utah.edu Sun Jul 26 09:00:47 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sun Jul 26 09:01:13 2009 Subject: [plt-scheme] Scribble 2.0 Message-ID: <20090726130049.4BDE66500B7@mail-svr1.cs.utah.edu> If you're interested in Scribble and you haven't tried it, or if you found the old documentation and tools opaque, try the new introduction: http://pre.plt-scheme.org/docs/html/scribble/getting-started.html Some core data structures have changed, but a major focus of the new Scribble is making it simpler to use and providing a better introduction --- especially for uses of Scribble other than PLT Scheme documentation. [The changes will not be part of the upcoming 4.2.1 release, but they're available now through SVN or the nightly build. The September release will include the changes.] If you're using Scribble already for library documentation, your Scribble code probably still works, especially if you didn't import `scribble/struct'. Even if you did import `scribble/struct', it might still work; `scribble/struct' is now a compatibility library. (If it doesn't work, let me know.) If you revise your documentation, the recommended way to start the document module is now #lang scribble/manual If you were using Scribble to produce other kinds of Latex-based documents where you replaced the prefix and/or style file, then your document will almost certainly break with the new version. But things will get better and more automatic from now on. For example, if you want to write a paper in the SIGPLAN conference format, just start your document with #lang scribble/sigplan and then `scribble --pdf' will do the right thing. Finally, if you're reading Scribble-produced documentation and something in the formatting seems to have regressed, let me know. From lists.amitsaha at gmail.com Sun Jul 26 09:08:23 2009 From: lists.amitsaha at gmail.com (Amit Saha) Date: Sun Jul 26 09:08:59 2009 Subject: [plt-scheme] Guessing the file type? In-Reply-To: References: <4A6C5095.1080001@gmail.com> Message-ID: <4A6C5547.1090607@gmail.com> Jay McCarthy wrote: > On Unix/OS X there is a program called 'file' that works pretty well. Yep. I was looking for a plt-scheme interface.. > > Also, if you use the mime type library in the PLT Web server, it uses > the system database of file extensions to return a mime type. Yeah..I came across this. However, I thought of consulting the list to enquire if there was another way.. Thank you! Best, Amit > > Jay > > On Sun, Jul 26, 2009 at 6:48 AM, Amit Saha wrote: >> Hello all, >> >> Is there a known way to find the MIME type of a file: text, audio, etc ? >> >> Thanks a ton. >> >> Best, >> Amit >> -- >> email: amitsaha.in@gmail.com >> Journal: http://amitksaha.wordpress.com >> ?-blog: http://twitter.com/amitsaha >> IRC: cornucopic on #scheme, #lisp, #math, #linux >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > -- email: amitsaha.in@gmail.com Journal: http://amitksaha.wordpress.com ?-blog: http://twitter.com/amitsaha IRC: cornucopic on #scheme, #lisp, #math, #linux From lists.amitsaha at gmail.com Sun Jul 26 11:40:12 2009 From: lists.amitsaha at gmail.com (Amit Saha) Date: Sun Jul 26 11:40:51 2009 Subject: [plt-scheme] Guessing the file type? In-Reply-To: <4A6C5547.1090607@gmail.com> References: <4A6C5095.1080001@gmail.com> <4A6C5547.1090607@gmail.com> Message-ID: <4A6C78DC.3000001@gmail.com> Amit Saha wrote: > Jay McCarthy wrote: >> On Unix/OS X there is a program called 'file' that works pretty well. > > Yep. I was looking for a plt-scheme interface.. > >> >> Also, if you use the mime type library in the PLT Web server, it uses >> the system database of file extensions to return a mime type. > > Yeah..I came across this. However, I thought of consulting the list to > enquire if there was another way.. I have used 'make-path->mime-type' which gives back a procedure for the relevant MIME type. For eg: > (make-path->mime-type (build-path "/home/r00t/Music/" "m.mp3")) # Not sure, how can I obtain the MIME type now? I can see: make-get-mime-type : path? -> path? -> bytes? in private/mime-types.ss. Again not sure, how it can be used.. Please suggest. Best, Amit -- email: amitsaha.in@gmail.com Journal: http://amitksaha.wordpress.com ?-blog: http://twitter.com/amitsaha IRC: cornucopic on #scheme, #lisp, #math, #linux From lists.amitsaha at gmail.com Sun Jul 26 12:17:50 2009 From: lists.amitsaha at gmail.com (Amit Saha) Date: Sun Jul 26 12:23:43 2009 Subject: [plt-scheme] Does plt-scheme handle white spaces in path strings automatically? Message-ID: <4A6C81AE.3060900@gmail.com> Hello, Does 'string->path' handle the white spaces in path names automatically? I am trying to open files with 'with-input-from-file' to which I have specified a path using 'string->path' and where the path contains spaces. I am getting a "cannot open input file".. Any pointers would be very appreciated. Thanks! -Amit -- email: amitsaha.in@gmail.com Journal: http://amitksaha.wordpress.com ?-blog: http://twitter.com/amitsaha IRC: cornucopic on #scheme, #lisp, #math, #linux From grettke at acm.org Sun Jul 26 13:28:52 2009 From: grettke at acm.org (Grant Rettke) Date: Sun Jul 26 13:29:16 2009 Subject: [plt-scheme] Some dissing of Scheme In-Reply-To: <904774730907260511t3cb95653vb430ad532c3c1bca@mail.gmail.com> References: <904774730907260511t3cb95653vb430ad532c3c1bca@mail.gmail.com> Message-ID: <756daca50907261028s10373445t3f91ea2df9ce3859@mail.gmail.com> It seems like the author didn't investigate what is available today. On Sun, Jul 26, 2009 at 7:11 AM, Todd O'Bryan wrote: > http://tech.slashdot.org/story/09/07/25/1224247/The-Best-First-Language-For-a-Young-Programmer > > I already posted a comment linking to HtDP and How to Design Worlds, > but I thought people might want to see the article. > > Todd > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- http://www.wisdomandwonder.com/ From matthias at ccs.neu.edu Sun Jul 26 13:45:51 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Jul 26 13:46:25 2009 Subject: [plt-scheme] accessing a top-level variable whose name is stored in a global variable In-Reply-To: <4ae4c900-0373-4ea9-98de-d5a04f81ae1d@13g2000prl.googlegroups.com> References: <4ae4c900-0373-4ea9-98de-d5a04f81ae1d@13g2000prl.googlegroups.com> Message-ID: <386B3361-6896-4F53-B445-CA452EC74C51@ccs.neu.edu> I don't understand from this email why a data structure, possibly implemented via a class, of a collection of racks wouldn't do the trick for your program. Why do you want to have both a symbolic name for a rack _and_ a variable name? -- Matthias On Jul 26, 2009, at 2:52 AM, Gregg Williams wrote: > Hi--My question has to do with how to accomplish indirection in > Scheme--in particular, in the following (slightly simplified) > function: > > (define (infoml:get-card-from-active-rack n) > (list-ref (eval *infoml:active-rack-name*) n)) > > My intent is this. A "rack" is a named list defined at the top level, > and my program has exactly one active rack. You guessed it, its name > is stored in *infoml:active-rack-name*. In my code, I create a rack > named decision-making as follows: > > (define decision-making (infoml:make-rack 'decision-making)) > > In addition to defining a rack (i.e., a list) named decision-making, > it also stores the value of the symbol 'decision-making in the global > variable *infoml:active-rack-name*. > > What I'm trying to do with infoml:get-card-from-active-rack is to > return the n'th item from the currently active rack--in this case, the > n'th item in the rack/list named decision-making. At first, I wrote a > function like this: > > (define (infoml:get-card-from-active-rack n) > (list-ref *infoml:active-rack-name* n)) > > ... but that certainly didn't work. I read a lot of the PLT Scheme > documentation but couldn't find anything that allowed me the > indirection that I wanted. The documentation on eval was particularly > forbidding, but I tried it anyway...and it seems to work! > > However, at the end of my program (which *is* giving me the correct > output), I get the following error message: > > compile: unbound identifier (and no #%top syntax transformer is bound) > in: decision-making > > I'd appreciate any insights on what would be a good way to accomplish > what I'm trying to do. I'm not expecting any lengthy explanations, but > pointing me to the right PLT Scheme documentation would be entirely > sufficient. Thanks. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jay.mccarthy at gmail.com Sun Jul 26 14:32:41 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Sun Jul 26 14:33:03 2009 Subject: [plt-scheme] Guessing the file type? In-Reply-To: <4A6C78DC.3000001@gmail.com> References: <4A6C5095.1080001@gmail.com> <4A6C5547.1090607@gmail.com> <4A6C78DC.3000001@gmail.com> Message-ID: make-path->mime-type takes a path to the MIME database (such as /private/etc/apache2/mime.types on OS X) returns a procedure than when given a path will return the mime type. It is basically building a cache to get mime types fast. Jay On Sun, Jul 26, 2009 at 9:40 AM, Amit Saha wrote: > Amit Saha wrote: >> >> Jay McCarthy wrote: >>> >>> On Unix/OS X there is a program called 'file' that works pretty well. >> >> Yep. I was looking for a plt-scheme interface.. >> >>> >>> Also, if you use the mime type library in the PLT Web server, it uses >>> the system database of file extensions to return a mime type. >> >> Yeah..I came across this. However, I thought of consulting the list to >> enquire if there was another way.. > > > I have used 'make-path->mime-type' which gives back a procedure for the > relevant MIME type. For eg: > >> (make-path->mime-type (build-path "/home/r00t/Music/" "m.mp3")) > # > > > Not sure, how can I obtain the MIME type now? I can see: make-get-mime-type > : path? -> path? -> bytes? in private/mime-types.ss. Again not sure, how it > can be used.. > > Please suggest. > > Best, > Amit > -- > email: amitsaha.in@gmail.com > Journal: http://amitksaha.wordpress.com > ?-blog: http://twitter.com/amitsaha > IRC: cornucopic on #scheme, #lisp, #math, #linux > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From jensaxel at soegaard.net Sun Jul 26 15:13:28 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Sun Jul 26 15:13:47 2009 Subject: [plt-scheme] Does plt-scheme handle white spaces in path strings automatically? In-Reply-To: <4A6C81AE.3060900@gmail.com> References: <4A6C81AE.3060900@gmail.com> Message-ID: <4072c51f0907261213k7b213493mff05518c9b3a4837@mail.gmail.com> Hi Amit, > Does 'string->path' handle the white spaces in path names automatically? Yes. > I am trying to open files with 'with-input-from-file' to which I have > specified a path using 'string->path' and where the path contains spaces. I > am getting a "cannot open input file".. > > Any pointers would be very appreciated. It must be something else. Can you post the code that is causing troubles? -- Jens Axel S?gaard From namekuseijin at gmail.com Sun Jul 26 16:08:34 2009 From: namekuseijin at gmail.com (namekuseijin) Date: Sun Jul 26 16:08:56 2009 Subject: [plt-scheme] Some dissing of Scheme In-Reply-To: <756daca50907261028s10373445t3f91ea2df9ce3859@mail.gmail.com> References: <904774730907260511t3cb95653vb430ad532c3c1bca@mail.gmail.com> <756daca50907261028s10373445t3f91ea2df9ce3859@mail.gmail.com> Message-ID: <67d0527e0907261308n16c86cd9t2a2f53ecd3ab00e@mail.gmail.com> What is coolest than most comments being about either Pascal or C++? "logo" and "python" tags for an article about Scheme, of course! :P Best succint comment: "Scheme is the best teaching language (Score:5, Insightful) by Gorobei (127755) on Saturday July 25, @10:31AM (#28818429) for the professors, that it. By removing all the syntax, etc, you can be introducing functions, lexical scope, binding, etc in the first week. Data structures and recursion in the second. Result: most students quit by week two, and you are left with a fairly teachable remainder." it is funny after all... :) On 7/26/09, Grant Rettke wrote: > It seems like the author didn't investigate what is available today. > > On Sun, Jul 26, 2009 at 7:11 AM, Todd O'Bryan wrote: >> http://tech.slashdot.org/story/09/07/25/1224247/The-Best-First-Language-For-a-Young-Programmer >> >> I already posted a comment linking to HtDP and How to Design Worlds, >> but I thought people might want to see the article. >> >> Todd >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > > -- > http://www.wisdomandwonder.com/ > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From sk at cs.brown.edu Sun Jul 26 20:29:29 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sun Jul 26 20:30:07 2009 Subject: [plt-scheme] Some dissing of Scheme In-Reply-To: <904774730907260511t3cb95653vb430ad532c3c1bca@mail.gmail.com> References: <904774730907260511t3cb95653vb430ad532c3c1bca@mail.gmail.com> Message-ID: This is a guy who concludes "Mind you, the very best way to encourage young students to become programmers might be to stop shipping software development jobs overseas"? He's such a bozo I can't imagine gracing him with a response. But thanks for doing it for us, both Todd and Eli... From lists.amitsaha at gmail.com Sun Jul 26 23:54:23 2009 From: lists.amitsaha at gmail.com (Amit Saha) Date: Sun Jul 26 23:55:03 2009 Subject: [plt-scheme] Guessing the file type? In-Reply-To: References: <4A6C5095.1080001@gmail.com> <4A6C5547.1090607@gmail.com> <4A6C78DC.3000001@gmail.com> Message-ID: <4A6D24EF.2060400@gmail.com> Hello Jay, Jay McCarthy wrote: > make-path->mime-type takes a path to the MIME database (such as > /private/etc/apache2/mime.types on OS X) returns a procedure than when > given a path will return the mime type. It is basically building a > cache to get mime types fast. Great. On my Ubuntu Linux: > ((make-path->mime-type "/etc/mime.types") (build-path "/home/r00t/Music/" "m.mp3")) #"audio/mpeg" does it. Now wondering: How would I go about writing code, such as this- to work on Linux as well as say, a Mac OSX ? Thanks a ton, already. Best, Amit > > Jay > > On Sun, Jul 26, 2009 at 9:40 AM, Amit Saha wrote: >> Amit Saha wrote: >>> Jay McCarthy wrote: >>>> On Unix/OS X there is a program called 'file' that works pretty well. >>> Yep. I was looking for a plt-scheme interface.. >>> >>>> Also, if you use the mime type library in the PLT Web server, it uses >>>> the system database of file extensions to return a mime type. >>> Yeah..I came across this. However, I thought of consulting the list to >>> enquire if there was another way.. >> >> I have used 'make-path->mime-type' which gives back a procedure for the >> relevant MIME type. For eg: >> >>> (make-path->mime-type (build-path "/home/r00t/Music/" "m.mp3")) >> # >> >> >> Not sure, how can I obtain the MIME type now? I can see: make-get-mime-type >> : path? -> path? -> bytes? in private/mime-types.ss. Again not sure, how it >> can be used.. >> >> Please suggest. >> >> Best, >> Amit >> -- >> email: amitsaha.in@gmail.com >> Journal: http://amitksaha.wordpress.com >> ?-blog: http://twitter.com/amitsaha >> IRC: cornucopic on #scheme, #lisp, #math, #linux >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > -- email: amitsaha.in@gmail.com Journal: http://amitksaha.wordpress.com ?-blog: http://twitter.com/amitsaha IRC: cornucopic on #scheme, #lisp, #math, #linux From lists.amitsaha at gmail.com Mon Jul 27 01:06:11 2009 From: lists.amitsaha at gmail.com (Amit Saha) Date: Mon Jul 27 01:07:02 2009 Subject: [plt-scheme] Does plt-scheme handle white spaces in path strings automatically? In-Reply-To: <4072c51f0907261213k7b213493mff05518c9b3a4837@mail.gmail.com> References: <4A6C81AE.3060900@gmail.com> <4072c51f0907261213k7b213493mff05518c9b3a4837@mail.gmail.com> Message-ID: <4A6D35C3.30101@gmail.com> Hi Jens, Jens Axel S?gaard wrote: > Hi Amit, > >> Does 'string->path' handle the white spaces in path names automatically? > > Yes. > >> I am trying to open files with 'with-input-from-file' to which I have >> specified a path using 'string->path' and where the path contains spaces. I >> am getting a "cannot open input file".. >> >> Any pointers would be very appreciated. > > It must be something else. Can you post the code that is > causing troubles? Sorry for crying before finding the nature of the problem. The filename that I am trying to open is being retrieved from a HTTP GET request string which encodes the spaces as %20, hence plt-scheme cannot open the file, because there is no such file with that name. So, I will now substitute the %20s by a space and then open it. Best, Amit > -- email: amitsaha.in@gmail.com Journal: http://amitksaha.wordpress.com ?-blog: http://twitter.com/amitsaha IRC: cornucopic on #scheme, #lisp, #math, #linux From neil at neilvandyke.org Mon Jul 27 07:39:40 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Mon Jul 27 07:40:06 2009 Subject: [plt-scheme] drscheme feature idea: automatically add missing exports for scheme modules Message-ID: <4A6D91FC.2090001@neilvandyke.org> Here's a DrScheme feature that I could really use: a command that would add to the "provide" form of the module in the editor any names defined in the module but not exported currently, *except* those with names beginning with the character "%". A somewhat less-ideal feature would include "%" symbols as well, and I could just manually delete those. "%" is a convention that I stole from (I believe) Olin Shivers for marking names internal to the library. A feature like I described could support that convention in a generalized way by permitting the user to use regexps to specify which names to exclude. -- http://www.neilvandyke.org/ From jay.mccarthy at gmail.com Mon Jul 27 07:42:24 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Mon Jul 27 07:42:47 2009 Subject: [plt-scheme] drscheme feature idea: automatically add missing exports for scheme modules In-Reply-To: <4A6D91FC.2090001@neilvandyke.org> References: <4A6D91FC.2090001@neilvandyke.org> Message-ID: I like having to write them out because I'm forced to think about each function, its interface description, and its contract. I'm sure that this sort of thing would be a fairly straight-forward PLaneT tool that leveraged Check Syntax. Jay On Mon, Jul 27, 2009 at 5:39 AM, Neil Van Dyke wrote: > Here's a DrScheme feature that I could really use: ?a command that would add > to the "provide" form of the module in the editor any names defined in the > module but not exported currently, *except* those with names beginning with > the character "%". > > A somewhat less-ideal feature would include "%" symbols as well, and I could > just manually delete those. > > "%" is a convention that I stole from (I believe) Olin Shivers for marking > names internal to the library. ?A feature like I described could support > that convention in a generalized way by permitting the user to use regexps > to specify which names to exclude. > > -- > http://www.neilvandyke.org/ > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From neil at neilvandyke.org Mon Jul 27 08:11:46 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Mon Jul 27 08:18:52 2009 Subject: [plt-scheme] drscheme feature idea: automatically add missing exports for scheme modules In-Reply-To: References: <4A6D91FC.2090001@neilvandyke.org> Message-ID: <4A6D9982.3060808@neilvandyke.org> I hadn't thought of that. In my case, my embedded documentation serves a similar purpose. Just, before releasing a library, once the interface is solidly designed and documented I want to change the "provide all defined" to not include the "%" names, so that I'm not polluting namespaces of library users. Jay McCarthy wrote at 07/27/2009 07:42 AM: > I like having to write them out because I'm forced to think about each > function, its interface description, and its contract. > > I'm sure that this sort of thing would be a fairly straight-forward > PLaneT tool that leveraged Check Syntax. > > Jay > > On Mon, Jul 27, 2009 at 5:39 AM, Neil Van Dyke wrote: > >> Here's a DrScheme feature that I could really use: a command that would add >> to the "provide" form of the module in the editor any names defined in the >> module but not exported currently, *except* those with names beginning with >> the character "%". >> >> A somewhat less-ideal feature would include "%" symbols as well, and I could >> just manually delete those. >> >> "%" is a convention that I stole from (I believe) Olin Shivers for marking >> names internal to the library. A feature like I described could support >> that convention in a generalized way by permitting the user to use regexps >> to specify which names to exclude. >> >> -- >> http://www.neilvandyke.org/ >> _________________________________________________ >> 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/20090727/c6b9aa7b/attachment.html From marek at xivilization.net Mon Jul 27 08:23:07 2009 From: marek at xivilization.net (Marek Kubica) Date: Mon Jul 27 08:23:29 2009 Subject: [plt-scheme] Guessing the file type? In-Reply-To: <4A6D24EF.2060400@gmail.com> References: <4A6C5095.1080001@gmail.com> <4A6C5547.1090607@gmail.com> <4A6C78DC.3000001@gmail.com> <4A6D24EF.2060400@gmail.com> Message-ID: <20090727142307.74c86a85@halmanfloyd.lan.local> Hi, On Mon, 27 Jul 2009 09:24:23 +0530 Amit Saha wrote: > Great. On my Ubuntu Linux: > > > ((make-path->mime-type "/etc/mime.types") (build-path > "/home/r00t/Music/" "m.mp3")) > #"audio/mpeg" > > does it. > > Now wondering: How would I go about writing code, such as this- to > work on Linux as well as say, a Mac OSX ? By checking for the OS and setting the path to the MIME Database accordingly. The biggest problem I see would be Windows, which as far as I know does not have such a file at all. regards, Marek From geoff at knauth.org Mon Jul 27 08:28:59 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Mon Jul 27 08:29:23 2009 Subject: [plt-scheme] Re: A little demo of something I've been playing with... In-Reply-To: References: Message-ID: <43ED9AF5-ADEA-4ED5-8920-73E0F5745AD9@knauth.org> On Jul 24, 2009, at 22:18, Jay McCarthy wrote: > This demo has less physics but more Metroid: > http://screencast.com/t/JXlAUm8iddr Thank you so much for that one! My kids (12 and 10) are really into a Flash game called Platform Racing 2, and I can show them they can build their own with DrScheme. PR2 has a worthy offshoot: one way to get a "crown hat" is to participate in Stanford's Folding at Home project, so now we have various GNU/Linux machines around the house doing protein folding. From noelwelsh at gmail.com Mon Jul 27 08:32:17 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Jul 27 08:32:36 2009 Subject: [plt-scheme] Guessing the file type? In-Reply-To: <20090727142307.74c86a85@halmanfloyd.lan.local> References: <4A6C5095.1080001@gmail.com> <4A6C5547.1090607@gmail.com> <4A6C78DC.3000001@gmail.com> <4A6D24EF.2060400@gmail.com> <20090727142307.74c86a85@halmanfloyd.lan.local> Message-ID: On Mon, Jul 27, 2009 at 1:23 PM, Marek Kubica wrote: > By checking for the OS using (system-type 'os) N. From noelwelsh at gmail.com Mon Jul 27 08:52:02 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Jul 27 08:52:21 2009 Subject: [plt-scheme] PLT Web Server In-Reply-To: <8DDC93B7-94B1-4552-BE2C-98364FF5D58A@cimex.com> References: <83CFB667-CD8E-49F5-82BB-6DF5B5F63E85@cimex.com> <8DDC93B7-94B1-4552-BE2C-98364FF5D58A@cimex.com> Message-ID: On Sat, Jul 25, 2009 at 11:58 PM, Emmanuel Delaborde wrote: > I was also using write instead of display when saving the file content and > that didn't work You probably want to use write-bytes. If your file contains characters that aren't part of the ASCII character set there is a good chance you won't read them in correctly if you write them using display. N. From noelwelsh at gmail.com Mon Jul 27 09:02:35 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Jul 27 09:02:53 2009 Subject: [plt-scheme] Macro tutorial question In-Reply-To: <92bb2aa00907220800v1b6c231eye64d3a9451247c83@mail.gmail.com> References: <92bb2aa00907220800v1b6c231eye64d3a9451247c83@mail.gmail.com> Message-ID: On Wed, Jul 22, 2009 at 4:00 PM, Adam C.M. Solove wrote: ... > A?number?of?the?examples?in?this?section?depend?on?the?macro?define-get/put-id,?which?is?defined?(seemingly?just?as?the?appropriate?macroexpansion?for?one?case?rather?than?for?the?general?case)?as?: > > ??(define-syntax-rule?(define-get/put-id?id?get?put!) > ????(define-syntax?clock > ??????(syntax-id-rules?(set!) > ????????[(set!?clock?e)?(put-clock!?e)] > ????????[(clock?a?(...?...))?((get-clock)?a?(...?...))] > ????????[clock?(get-clock)]))) > I simply adapted it to the general case and got: > > (define-syntax-rule (define-get/put-id id get put!) > ?? ?(define-syntax id > ?? ? ?(syntax-id-rules (set!) > ?? ? ? ?[(set! id e) (put! e)] > ?? ? ? ?[(id a (... ...)) ((get) a (... ...))] > ?? ? ? ?[id (get)]))) > > Which works, surprisingly, and confuses me. Generally define-syntax does not > evaluate the first argument but uses it as a symbol naming the item in the > syntax, but in this case, id is a identifier which gets evaluated so that > the passed value of id is used as the actual syntax. Does define-syntax > check in the environment and use the literal symbol as its name unless it > has a defined value as an identifier? I tried to look this up in the > documentation for define-syntax but quickly got confused. I think you're getting confusing by the example of a macro generating a macro. This: (define-syntax-rule (define-get/put-id id get put!) (define-syntax id (syntax-id-rules (set!) [(set! id e) (put! e)] [(id a (... ...)) ((get) a (... ...))] [id (get)]))) applied to (define-get/put-id foo foo-get foo-put!) expands first to (define-syntax foo (syntax-id-rules (set!) ...) which then expands once more into whatever it is that syntax-id-rules expands into. Notice the first expansion substitutes the value of id into it's body expression, which is the define-syntax. N. From noelwelsh at gmail.com Mon Jul 27 09:13:25 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Jul 27 09:13:44 2009 Subject: [plt-scheme] accessing a top-level variable whose name is stored in a global variable In-Reply-To: <4ae4c900-0373-4ea9-98de-d5a04f81ae1d@13g2000prl.googlegroups.com> References: <4ae4c900-0373-4ea9-98de-d5a04f81ae1d@13g2000prl.googlegroups.com> Message-ID: On Sun, Jul 26, 2009 at 7:52 AM, Gregg Williams wrote: > My intent is this. A "rack" is a named list defined at the top level, > and my program has exactly one active rack. You guessed it, its name > is stored in *infoml:active-rack-name*. In my code, I create a rack > named decision-making as follows: I don't understand why you don't store the active rack directly in this variable, rather than a symbol identifying it. If you want to map symbols to value, a hash table will do that. HTH, N. From chust at web.de Mon Jul 27 09:20:57 2009 From: chust at web.de (Thomas Chust) Date: Mon Jul 27 09:21:16 2009 Subject: [plt-scheme] drscheme feature idea: automatically add missing exports for scheme modules In-Reply-To: <4A6D9982.3060808@neilvandyke.org> References: <4A6D91FC.2090001@neilvandyke.org> <4A6D9982.3060808@neilvandyke.org> Message-ID: <1c1a33bc0907270620l7a8bbbb7x6e6285f12492b2c6@mail.gmail.com> 2009/7/27 Neil Van Dyke : > [...] > Just, before releasing a library, once the interface is solidly designed and > documented I want to change the "provide all defined" to not include the "%" > names, so that I'm not polluting namespaces of library users. > [...] Hello, you could simply use (require scheme/provide) (provide (matching-identifiers-out #px"^(?!%)" (all-defined-out))) to provide all identifiers that don't start with a percent sign. By the way, the documentation of matching-identifiers-out in PLT Scheme 4.2 is apparently wrong, because it states that all identifiers matching the regular expression specified as the first parameter will be *omitted* from the exports, while experiment confirms that *only the matching identifiers* are exported. cu, Thomas -- When C++ is your hammer, every problem looks like your thumb. From jensaxel at soegaard.net Mon Jul 27 09:21:51 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Mon Jul 27 09:22:12 2009 Subject: [plt-scheme] drscheme feature idea: automatically add missing exports for scheme modules In-Reply-To: <4A6D9982.3060808@neilvandyke.org> References: <4A6D91FC.2090001@neilvandyke.org> <4A6D9982.3060808@neilvandyke.org> Message-ID: <4072c51f0907270621q75c16629l7101da03a34bce0d@mail.gmail.com> 2009/7/27 Neil Van Dyke : > I hadn't thought of that.? In my case, my embedded documentation serves a > similar purpose. > > Just, before releasing a library, once the interface is solidly designed and > documented I want to change the "provide all defined" to not include the "%" > names, so that I'm not polluting namespaces of library users. Is this what you are after? /Jens Axel #lang scheme (require (for-syntax scheme/provide-transform) scheme/provide-syntax) (begin-for-syntax (define (symbolstring (list x y)))) (define (begins-with-%? sym) (char=? #\% (string-ref (symbol->string sym) 0)))) ; (_ provide-spec) (define-provide-syntax (all-except-%-out stx) (syntax-case stx () [(_) (let ([exports (expand-export #'(all-defined-out) null)]) (with-syntax ([(id ...) (filter (compose not begins-with-%? syntax-e) (map export-local-id exports))]) (syntax/loc stx (combine-out id ...))))])) (define foo 1) (define bar 2) (define %a 3) (define %b 4) (provide (all-except-%-out)) From neil at neilvandyke.org Mon Jul 27 09:36:08 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Mon Jul 27 09:36:31 2009 Subject: [plt-scheme] drscheme feature idea: automatically add missing exports for scheme modules In-Reply-To: <4072c51f0907270621q75c16629l7101da03a34bce0d@mail.gmail.com> References: <4A6D91FC.2090001@neilvandyke.org> <4A6D9982.3060808@neilvandyke.org> <4072c51f0907270621q75c16629l7101da03a34bce0d@mail.gmail.com> Message-ID: <4A6DAD48.30203@neilvandyke.org> Thanks. That is potentially useful. Actually, I should've added that I wanted the export list explicit so that I could sanity-check it and also use it when translating to other Scheme dialects. That also lets me intermix with renaming some of them, or I'd need an "all-except-%-or-otherwise-provided-out". Jens Axel S?gaard wrote at 07/27/2009 09:21 AM: > Is this what you are after? > From noelwelsh at gmail.com Mon Jul 27 09:45:10 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Jul 27 09:45:32 2009 Subject: [plt-scheme] Re: Web browsing package? Message-ID: Hello, I've just had the need for a very simple web browing package, and existing tools didn't do the job so I created one here: http://svn.untyped.com/http-client/trunk/src/ At the moment it does exactly what I need, which isn't a lot. Extensions are left as an exercise for users (send us the patches). N. From emmanuel.delaborde at cimex.com Mon Jul 27 09:41:25 2009 From: emmanuel.delaborde at cimex.com (emmanuel.delaborde) Date: Mon Jul 27 09:52:15 2009 Subject: [plt-scheme] PLT Web Server In-Reply-To: References: <83CFB667-CD8E-49F5-82BB-6DF5B5F63E85@cimex.com> <8DDC93B7-94B1-4552-BE2C-98364FF5D58A@cimex.com> Message-ID: <33DA3B4C-43DB-4032-A03B-C96C95D0A953@cimex.com> Hi Noel the file is a jpeg image. display works fine with the one image I've tested it with, but I'll try write-bytes Thanks E.D On 27 Jul 2009, at 13:52, Noel Welsh wrote: > On Sat, Jul 25, 2009 at 11:58 PM, Emmanuel > Delaborde wrote: >> I was also using write instead of display when saving the file >> content and >> that didn't work > > You probably want to use write-bytes. If your file contains characters > that aren't part of the ASCII character set there is a good chance you > won't read them in correctly if you write them using display. > > N. -- Emmanuel Delaborde Web Technologist Cimex 53-55 Scrutton Street, London UK, EC2A 4PJ T: +44 (0)20 7324 7780 F: +44 (0)20 7324 7781 http://www.cimex.com ----------------------------------------------------------------------------------------------- This e-mail (and any attachments) is confidential and may contain personal views which are not the views of Cimex Media Ltd and any affiliated companies, unless specifically stated. It is intended for the use of the individual or group to whom it is addressed. If you have received it in error, please delete it from your system, do not use, copy or disclose the information in any way nor act in reliance on it and please notify postmaster@cimex.com A company registered in England Wales. Company Number 03765711 Registered Office : The Olde Bakehouse, 156 Watling Street East, Towcester, Northants NN12 6DB This email was scanned by Postini, the leading provider in Managed Email Security. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090727/fb1f6c90/attachment.htm From lists.amitsaha at gmail.com Mon Jul 27 11:11:21 2009 From: lists.amitsaha at gmail.com (Amit Saha) Date: Mon Jul 27 11:18:17 2009 Subject: [plt-scheme] Guessing the file type? In-Reply-To: <20090727142307.74c86a85@halmanfloyd.lan.local> References: <4A6C5095.1080001@gmail.com> <4A6C5547.1090607@gmail.com> <4A6C78DC.3000001@gmail.com> <4A6D24EF.2060400@gmail.com> <20090727142307.74c86a85@halmanfloyd.lan.local> Message-ID: <4A6DC399.5090902@gmail.com> Marek Kubica wrote: > Hi, > > On Mon, 27 Jul 2009 09:24:23 +0530 > Amit Saha wrote: > >> Great. On my Ubuntu Linux: >> >> > ((make-path->mime-type "/etc/mime.types") (build-path >> "/home/r00t/Music/" "m.mp3")) >> #"audio/mpeg" >> >> does it. >> >> Now wondering: How would I go about writing code, such as this- to >> work on Linux as well as say, a Mac OSX ? > > By checking for the OS and setting the path to the MIME Database > accordingly. The biggest problem I see would be Windows, which as far > as I know does not have such a file at all. I took a cursory look at "mimetypes.py" (http://svn.python.org/view/python/trunk/Lib/mimetypes.py?revision=72045&view=markup) - a Python module which acts as a interface with the OS MIME types. From what I see, it has the list of "known files" into which it looks into for the OS recogniezed MIME types.. I will try to look into implementing such a solution for plt-scheme.. Best, Amit > > regards, > Marek > -- email: amitsaha.in@gmail.com Journal: http://amitksaha.wordpress.com ?-blog: http://twitter.com/amitsaha IRC: cornucopic on #scheme, #lisp, #math, #linux From eli at barzilay.org Mon Jul 27 11:51:12 2009 From: eli at barzilay.org (Eli Barzilay) Date: Mon Jul 27 11:51:54 2009 Subject: [plt-scheme] drscheme feature idea: automatically add missing exports for scheme modules In-Reply-To: <4A6DAD48.30203@neilvandyke.org> References: <4A6D91FC.2090001@neilvandyke.org> <4A6D9982.3060808@neilvandyke.org> <4072c51f0907270621q75c16629l7101da03a34bce0d@mail.gmail.com> <4A6DAD48.30203@neilvandyke.org> Message-ID: <19053.52464.103439.180543@winooski.ccs.neu.edu> On Jul 27, Neil Van Dyke wrote: > Thanks. That is potentially useful. > > Actually, I should've added that I wanted the export list explicit > so that I could sanity-check it and also use it when translating to > other Scheme dialects. That also lets me intermix with renaming > some of them, or I'd need an > "all-except-%-or-otherwise-provided-out". 1. The `filtered-out' macro is intended for cases where you want some easy way of controlling exports. 2. Jens's code is more explicit, and you could use it to do stuff like a form that has an explicit provide part and dont-provide part, then throw an error if there's any non-%-prefixed identifier that is in neither list. IIUC, this would give you the explicit control you need. 3. Another cute thing that you can try is some DrScheme tool where you right click on a `provide' and make it expand in-place to an explicit form that can now be edited. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From eli at barzilay.org Mon Jul 27 11:51:29 2009 From: eli at barzilay.org (Eli Barzilay) Date: Mon Jul 27 11:52:00 2009 Subject: [plt-scheme] drscheme feature idea: automatically add missing exports for scheme modules In-Reply-To: <1c1a33bc0907270620l7a8bbbb7x6e6285f12492b2c6@mail.gmail.com> References: <4A6D91FC.2090001@neilvandyke.org> <4A6D9982.3060808@neilvandyke.org> <1c1a33bc0907270620l7a8bbbb7x6e6285f12492b2c6@mail.gmail.com> Message-ID: <19053.52481.362054.391280@winooski.ccs.neu.edu> On Jul 27, Thomas Chust wrote: > > By the way, the documentation of matching-identifiers-out in PLT > Scheme 4.2 is apparently wrong, because it states that all > identifiers matching the regular expression specified as the first > parameter will be *omitted* from the exports, while experiment > confirms that *only the matching identifiers* are exported. Fixed, thanks. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From lists.amitsaha at gmail.com Mon Jul 27 13:35:40 2009 From: lists.amitsaha at gmail.com (Amit Saha) Date: Mon Jul 27 13:36:21 2009 Subject: [plt-scheme] Scheme program to serve files over HTTP Message-ID: <4A6DE56C.6050005@gmail.com> Hello, (I hope such emails are not against the mailing list guidelines.) I have been working on a hobby-cum-first real Scheme program of mine- a clone of SimpleHTTPServer.py. What this module does is that it starts a HTTP server with the current directory as the working directory. So, it enables file sharing/browsing over a network. I am happy to report that I have successfully completed the program, which works fine on my Ubuntu Linux box. The GNU GPL source of the first release, Version 0.8 is available at http://bitbucket.org/amitksaha/foobar-scripts/src/tip/fileserveHTTP.ss More background information, limitations at http://amitksaha.wordpress.com/2009/07/27/fileservehttp-ss-serve-your-local-files-over-http/ Thanks Jay, Jens and others for the help I asked earlier. I would really like to hear some comments/suggestions so that I an improve and enhance this piece of code and my Scheme. Best, -Amit -- email: amitsaha.in@gmail.com Journal: http://amitksaha.wordpress.com ?-blog: http://twitter.com/amitsaha IRC: cornucopic on #scheme, #lisp, #math, #linux From matthias at ccs.neu.edu Mon Jul 27 15:21:40 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Jul 27 15:23:09 2009 Subject: [plt-scheme] Scheme program to serve files over HTTP In-Reply-To: <4A6DE56C.6050005@gmail.com> References: <4A6DE56C.6050005@gmail.com> Message-ID: You may wish to compare your server with those in PLT's world. It should be as instructive as writing code -- Matthias On Jul 27, 2009, at 1:35 PM, Amit Saha wrote: > Hello, > > (I hope such emails are not against the mailing list guidelines.) > > I have been working on a hobby-cum-first real Scheme program of > mine- a clone of SimpleHTTPServer.py. What this module does is that > it starts a HTTP server with the current directory as the working > directory. So, it enables file sharing/browsing over a network. I > am happy to report that I have successfully completed the program, > which works fine on my Ubuntu Linux box. The GNU GPL source of the > first release, Version 0.8 is available at http://bitbucket.org/ > amitksaha/foobar-scripts/src/tip/fileserveHTTP.ss > > More background information, limitations at http:// > amitksaha.wordpress.com/2009/07/27/fileservehttp-ss-serve-your- > local-files-over-http/ > > Thanks Jay, Jens and others for the help I asked earlier. > > I would really like to hear some comments/suggestions so that I an > improve and enhance this piece of code and my Scheme. > > Best, > -Amit > > -- > email: amitsaha.in@gmail.com > Journal: http://amitksaha.wordpress.com > ?-blog: http://twitter.com/amitsaha > IRC: cornucopic on #scheme, #lisp, #math, #linux > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jensaxel at soegaard.net Mon Jul 27 17:11:13 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Mon Jul 27 17:11:31 2009 Subject: [plt-scheme] Scribble and here strings Message-ID: <4072c51f0907271411r536fe6d8j45dbd80fcb9af5c3@mail.gmail.com> Hi All, What's the correct way of scribbling here strings? This is what my code looks like: (define-sql (create-table-entries) #< References: <4072c51f0907271411r536fe6d8j45dbd80fcb9af5c3@mail.gmail.com> Message-ID: <19054.6409.720534.771466@winooski.ccs.neu.edu> On Jul 27, Jens Axel S?gaard wrote: > Hi All, > > What's the correct way of scribbling here strings? > > This is what my code looks like: > > (define-sql (create-table-entries) > #< CREATE TABLE entries ( > entry_id INTEGER PRIMARY KEY, > title TEXT, > url TEXT, > score INTEGER ) > SQL > > I tried to wrap it in a simple @schemeblock[...] but that is not enough, > due to the way the parser works. I'm not sure that there is a `schemeblock' solution (at some point we'll need something similar that works at the string level instead of reading expressions), but a better way of writing that code is to not use here strings: (define SQL string-append) (define-sql (create-table-entries) @SQL{ CREATE TABLE entries ( entry_id INTEGER PRIMARY KEY, title TEXT, url TEXT, score INTEGER )}) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From mflatt at cs.utah.edu Mon Jul 27 17:17:24 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Mon Jul 27 17:18:02 2009 Subject: [plt-scheme] Scribble and here strings In-Reply-To: <4072c51f0907271411r536fe6d8j45dbd80fcb9af5c3@mail.gmail.com> References: <4072c51f0907271411r536fe6d8j45dbd80fcb9af5c3@mail.gmail.com> Message-ID: <20090727211724.5081E65013B@mail-svr1.cs.utah.edu> At Mon, 27 Jul 2009 23:11:13 +0200, Jens Axel S?gaard wrote: > What's the correct way of scribbling here strings? > > This is what my code looks like: > > (define-sql (create-table-entries) > #< CREATE TABLE entries ( > entry_id INTEGER PRIMARY KEY, > title TEXT, > url TEXT, > score INTEGER ) > SQL > > I tried to wrap it in a simple @schemeblock[...] but that is not enough, > due to the way the parser works. You want a different function that typesets "verbatim" text but applies color and hyperlinks on top of it, like Check Syntax in DrScheme. Now seems like a good time for me to finally write that... From eli at barzilay.org Mon Jul 27 17:19:41 2009 From: eli at barzilay.org (Eli Barzilay) Date: Mon Jul 27 17:20:04 2009 Subject: [plt-scheme] Scribble and here strings In-Reply-To: <20090727211724.5081E65013B@mail-svr1.cs.utah.edu> References: <4072c51f0907271411r536fe6d8j45dbd80fcb9af5c3@mail.gmail.com> <20090727211724.5081E65013B@mail-svr1.cs.utah.edu> Message-ID: <19054.6637.762296.446206@winooski.ccs.neu.edu> On Jul 27, Matthew Flatt wrote: > > You want a different function that typesets "verbatim" text but > applies color and hyperlinks on top of it, like Check Syntax in > DrScheme. Now seems like a good time for me to finally write that... BTW, I have some code in my paper that does something similar. The idea is that it `read-syntax' all of the expressions from the string, then uses the location information to pull out the source that corresponds to the expressions including their neighborhood in a repl-like way. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From eric.hanchrow at gmail.com Tue Jul 28 00:09:21 2009 From: eric.hanchrow at gmail.com (Eric Hanchrow) Date: Tue Jul 28 00:17:48 2009 Subject: [plt-scheme] Is there an idiom for throwing away some values? Message-ID: <36366a980907272109v1befe4focab125fc1a357177@mail.gmail.com> Here's some code that approximates e^x: (define (series x) (call-with-values (lambda () (for/fold ([sum 0] [factor 1]) ([n (in-range 20)]) (values (+ sum factor) (* factor (/ x (add1 n)))))) (lambda (sum ignore-me) sum))) I'd like to be able to instead do something like (define (series x) (just-the-first-value (for/fold ([sum 0] [factor 1]) ([n (in-range 20)]) (values (+ sum factor) (* factor (/ x (add1 n))))))) ... without having to actually write "just-the-first-value" myself :) Is there an idiom that makes this simpler than what I was doing above? From robby at eecs.northwestern.edu Tue Jul 28 00:27:23 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Tue Jul 28 00:27:45 2009 Subject: [plt-scheme] Is there an idiom for throwing away some values? In-Reply-To: <36366a980907272109v1befe4focab125fc1a357177@mail.gmail.com> References: <36366a980907272109v1befe4focab125fc1a357177@mail.gmail.com> Message-ID: <932b2f1f0907272127l5db48e13o85061e1adee61b94@mail.gmail.com> This is probably the shortest thing: (define-syntax-rule (first-of-two-values e) (let-values ([(x y) e]) x)) but I would probably just write out the let-values, myself. Robby On Mon, Jul 27, 2009 at 11:09 PM, Eric Hanchrow wrote: > Here's some code that approximates e^x: > > (define (series x) > ?(call-with-values > ? ? ?(lambda () > ? ? ? ?(for/fold ([sum 0] > ? ? ? ? ? ? ? ? ? [factor 1]) > ? ? ? ? ? ?([n (in-range 20)]) > ? ? ? ? ? ?(values > ? ? ? ? ? ? (+ sum factor) > ? ? ? ? ? ? (* factor (/ x (add1 n)))))) > ? ?(lambda (sum ignore-me) > ? ? ?sum))) > > I'd like to be able to instead do something like > > (define (series x) > ?(just-the-first-value > ? (for/fold ([sum 0] > ? ? ? ? ? ? ?[factor 1]) > ? ? ? ([n (in-range 20)]) > ? ? ? (values > ? ? ? ?(+ sum factor) > ? ? ? ?(* factor (/ x (add1 n))))))) > > ... without having to actually write "just-the-first-value" myself :) > > Is there an idiom that makes this simpler than what I was doing above? > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From noelwelsh at gmail.com Tue Jul 28 00:49:46 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Tue Jul 28 00:50:06 2009 Subject: [plt-scheme] Is there an idiom for throwing away some values? In-Reply-To: <36366a980907272109v1befe4focab125fc1a357177@mail.gmail.com> References: <36366a980907272109v1befe4focab125fc1a357177@mail.gmail.com> Message-ID: On Tue, Jul 28, 2009 at 5:09 AM, Eric Hanchrow wrote: > ? ? ? ?(for/fold ([sum 0] > ? ? ? ? ? ? ? ? ? [factor 1]) ... I run into this all the time: writing a for/fold where I only want one value at the end. I've thought about implementing for/fold/first (returns only the first accumulator) but haven't got around to it. I tend to write (define-values (sum _) (for/fold ...)) N. From spamme at innerpaths.net Tue Jul 28 01:41:00 2009 From: spamme at innerpaths.net (Gregg Williams) Date: Tue Jul 28 01:52:08 2009 Subject: [plt-scheme] Re: accessing a top-level variable whose name is stored in a global variable In-Reply-To: <4ae4c900-0373-4ea9-98de-d5a04f81ae1d@13g2000prl.googlegroups.com> References: <4ae4c900-0373-4ea9-98de-d5a04f81ae1d@13g2000prl.googlegroups.com> Message-ID: <8a65de47-71a0-459d-a1a7-911599830a02@g1g2000pra.googlegroups.com> My thanks to both Noel's and Matthias' replies, which helped me rethink some implementation details. I'm now going with a vector, the zero'th element of which contains the current number of racks, and the next N of which contain the actual racks. This eliminates the problem with *infoml:active-rack-name*, which now simply contains an index that points into the vector of racks. In retrospect, it's hard to pinpoint the source of my uncertainty. I was thrown off by the "specialness" of top-level variables. Though I've done most of my programming in conventional procedural languages, I've also done some programming in Common Lisp--all of which have significant differences from Scheme. As a beginning Scheme programmer with this mostly-conventional programming background, I have to say that I do sometimes get confused trying to envision a solution that fits naturally with Scheme, as opposed to trying to transpose another language's idioms into Scheme. Thanks for your helpful comments. From jensaxel at soegaard.net Tue Jul 28 03:43:09 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Tue Jul 28 03:43:31 2009 Subject: [plt-scheme] Scribble and here strings In-Reply-To: <20090727211724.5081E65013B@mail-svr1.cs.utah.edu> References: <4072c51f0907271411r536fe6d8j45dbd80fcb9af5c3@mail.gmail.com> <20090727211724.5081E65013B@mail-svr1.cs.utah.edu> Message-ID: <4072c51f0907280043s623570afr53dd8337dbbd5749@mail.gmail.com> Matthew: > You want a different function that typesets "verbatim" text but applies > color and hyperlinks on top of it, like Check Syntax in DrScheme. Now > seems like a good time for me to finally write that... This might answer my next question, namely how to include source code from an external file. I tried using the function external-file from http://pre.plt-scheme.org/plt/collects/web-server/scribblings/tutorial/tutorial-util.ss but it barfs on files with #, in. -- Jens Axel S?gaard From noelwelsh at gmail.com Tue Jul 28 06:49:51 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Tue Jul 28 06:50:33 2009 Subject: [plt-scheme] Scheme program to serve files over HTTP In-Reply-To: <4A6DE56C.6050005@gmail.com> References: <4A6DE56C.6050005@gmail.com> Message-ID: Some notes: - Surprisingly idiomatic code for your first Scheme program - In larger programs you'll want to record types in comments. E.g.: ;; serve : Integer -> (-> Void) (define (serve port-no) (define listener (tcp-listen port-no 5 #t)) (define (loop) (accept-and-handle listener) (loop)) (define t (thread loop)) (lambda () (kill-thread t) (tcp-close listener))) - There are better ways to determine if a path refers to a directory or a file. You might use path-only, for example. - Using quasiquote / xexpr->string is a cleaner way of specifying HTML N. From rob.nikander at gmail.com Sun Jul 26 18:31:21 2009 From: rob.nikander at gmail.com (Rob) Date: Tue Jul 28 07:11:07 2009 Subject: [plt-scheme] may I copy scribble? Message-ID: Hi, I've been writing a Lisp-like language that runs in the Java VM, and I'd like to copy the reader extension idea from scribble -- the main ideas documented here: http://pre.plt-scheme.org/docs/html/scribble/reader.html I like the @cmd[datum ...]{text ... } syntax. I see that PLT is LGPL, but I'm not copying source code, and I'm not sure what people expect these days when you copy "ideas". So I figured I'd just ask. Of course, I would write an acknowledgement in my documentation. Rob From eli at barzilay.org Tue Jul 28 07:19:01 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jul 28 07:19:23 2009 Subject: [plt-scheme] may I copy scribble? In-Reply-To: References: Message-ID: <19054.56997.785723.929845@winooski.ccs.neu.edu> On Jul 26, Rob wrote: > Hi, > > I've been writing a Lisp-like language that runs in the Java VM, and > I'd like to copy the reader extension idea from scribble -- the main > ideas documented here: > > http://pre.plt-scheme.org/docs/html/scribble/reader.html > > I like the @cmd[datum ...]{text ... } syntax. I see that PLT is > LGPL, but I'm not copying source code, and I'm not sure what people > expect these days when you copy "ideas". So I figured I'd just ask. > Of course, I would write an acknowledgement in my documentation. Yes, we (or at least *I*) would be happy if more implementations supported the scribble syntax. I've recently written a paper on the design of the scribble syntax which is going to appear in the scheme workshop, and that is probably going to be helpful in learning about the many considerations that were done in developing the syntax. And one of the things I say in the paper is that it would be good for implementations to support the syntax, since it will allow exchanging code that deals with text -- in contrast to the current state of things where portable code is limited to plain Scheme strings and lots of `string-append's. Also, if/when you get to implement it, it will probably be very helpful to use the reader's test suite: http://svn.plt-scheme.org/plt/trunk/collects/tests/scribble/reader.ss Note that there *might* be minor changes, since it's relatively new, but I don't think that any big changes are likely. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From rob.nikander at gmail.com Tue Jul 28 08:27:09 2009 From: rob.nikander at gmail.com (Rob) Date: Tue Jul 28 09:14:00 2009 Subject: [plt-scheme] Re: may I copy scribble? In-Reply-To: <19054.56997.785723.929845@winooski.ccs.neu.edu> References: <19054.56997.785723.929845@winooski.ccs.neu.edu> Message-ID: <7b63fe65-313c-425a-b2a0-e91a5d9c232a@k30g2000yqf.googlegroups.com> Thanks. Will your paper be available online? I'll definitely want to read it. Rob On Jul 28, 7:19?am, Eli Barzilay wrote: > On Jul 26, Rob wrote: From matthias at ccs.neu.edu Tue Jul 28 10:43:39 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Jul 28 10:44:17 2009 Subject: [plt-scheme] Is there an idiom for throwing away some values? In-Reply-To: <36366a980907272109v1befe4focab125fc1a357177@mail.gmail.com> References: <36366a980907272109v1befe4focab125fc1a357177@mail.gmail.com> Message-ID: <722540F5-572A-494E-9E9B-C247439EC556@ccs.neu.edu> (I won't mention that there are closed formula for such series.) I hate to mention this but I think this is one of those cases that reveal the inherent weaknesses of a fixed set of looping operators in conventional languages. Of course, in Scheme you can always fall back on writing such things more succinctly using a plain let-loop idiom: #lang scheme (define (series x) (let-values ([(f _) (for/fold ([sum 0] [factor 1]) ([n (in-range 20)]) (values (+ sum factor) (* factor (/ x (add1 n)))))]) f)) (define (series0 x) (let loop ([n 1][factor 1]) (if (> n 20) 0 (+ factor (loop (+ n 1) (* factor (/ x n))))))) (= (series 10) (series0 10)) On Jul 28, 2009, at 12:09 AM, Eric Hanchrow wrote: > Here's some code that approximates e^x: > > (define (series x) > (call-with-values > (lambda () > (for/fold ([sum 0] > [factor 1]) > ([n (in-range 20)]) > (values > (+ sum factor) > (* factor (/ x (add1 n)))))) > (lambda (sum ignore-me) > sum))) > > I'd like to be able to instead do something like > > (define (series x) > (just-the-first-value > (for/fold ([sum 0] > [factor 1]) > ([n (in-range 20)]) > (values > (+ sum factor) > (* factor (/ x (add1 n))))))) > > ... without having to actually write "just-the-first-value" myself :) > > Is there an idiom that makes this simpler than what I was doing above? > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From lists.amitsaha at gmail.com Tue Jul 28 12:42:00 2009 From: lists.amitsaha at gmail.com (Amit Saha) Date: Tue Jul 28 12:50:23 2009 Subject: Coding style best practices (was: Re: [plt-scheme] Scheme program to serve files over HTTP) In-Reply-To: References: <4A6DE56C.6050005@gmail.com> Message-ID: <4A6F2A58.4050001@gmail.com> Hello Noel, all: Noel Welsh wrote: > Some notes: Thanks a lot for the comments. > > - In larger programs you'll want to record types in comments. E.g.: > > ;; serve : Integer -> (-> Void) > (define (serve port-no) > (define listener (tcp-listen port-no 5 #t)) > (define (loop) > (accept-and-handle listener) > (loop)) > (define t (thread loop)) > (lambda () > (kill-thread t) > (tcp-close listener))) > serve : Integer -> (-> Void) So this indicates a procedure by the name 'serve' taking a Integer parameter and a 'Void' return type? However, here I am returning a procedure, right ? Also, how would I specify more than one parameter? like serve : Integer, Integer-> (-> Void) Is there such a styling guide available on the web? Thanks again. Best, -Amit -- email: amitsaha.in@gmail.com Journal: http://amitksaha.wordpress.com ?-blog: http://twitter.com/amitsaha IRC: cornucopic on #scheme, #lisp, #math, #linux From eli at barzilay.org Tue Jul 28 12:59:16 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jul 28 12:59:37 2009 Subject: Coding style best practices (was: Re: [plt-scheme] Scheme program to serve files over HTTP) In-Reply-To: <4A6F2A58.4050001@gmail.com> References: <4A6DE56C.6050005@gmail.com> <4A6F2A58.4050001@gmail.com> Message-ID: <19055.11876.739799.712304@winooski.ccs.neu.edu> On Jul 28, Amit Saha wrote: > > - In larger programs you'll want to record types in comments. E.g.: > > > > ;; serve : Integer -> (-> Void) > > (define (serve port-no) > > (define listener (tcp-listen port-no 5 #t)) > > (define (loop) > > (accept-and-handle listener) > > (loop)) > > (define t (thread loop)) > > (lambda () > > (kill-thread t) > > (tcp-close listener))) > > > > serve : Integer -> (-> Void) > > So this indicates a procedure by the name 'serve' taking a Integer > parameter and a 'Void' return type? However, here I am returning a > procedure, right ? It's a function by the name of `serve', that takes an integer and returns a (-> Void) value. This value that is returned is itself a function too (it has an arrow), it takes the argument types on its left (no arguments), and returns void. And that's exactly what your code is doing. > Also, how would I specify more than one parameter? like serve : Integer, > Integer-> (-> Void) Just like that, except that we don't use commas. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From marek at xivilization.net Tue Jul 28 13:22:05 2009 From: marek at xivilization.net (Marek Kubica) Date: Tue Jul 28 13:22:31 2009 Subject: Coding style best practices (was: Re: [plt-scheme] Scheme program to serve files over HTTP) In-Reply-To: <4A6F2A58.4050001@gmail.com> References: <4A6DE56C.6050005@gmail.com> <4A6F2A58.4050001@gmail.com> Message-ID: <20090728192205.71e483bf@halmanfloyd.lan.local> On Tue, 28 Jul 2009 22:12:00 +0530 Amit Saha wrote: > Is there such a styling guide available on the web? I like this: (linked to a short version of the style guide, which contains a link to the whole thing). regards, Marek From grettke at acm.org Tue Jul 28 13:45:38 2009 From: grettke at acm.org (Grant Rettke) Date: Tue Jul 28 13:45:58 2009 Subject: Coding style best practices (was: Re: [plt-scheme] Scheme program to serve files over HTTP) In-Reply-To: <4A6F2A58.4050001@gmail.com> References: <4A6DE56C.6050005@gmail.com> <4A6F2A58.4050001@gmail.com> Message-ID: <756daca50907281045x196f830sf3a41fe8a0734ad2@mail.gmail.com> On Tue, Jul 28, 2009 at 11:42 AM, Amit Saha wrote: > Is there such a styling guide available on the web? Is HtDP the "guide"? From mflatt at cs.utah.edu Tue Jul 28 14:46:34 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Tue Jul 28 14:46:56 2009 Subject: [plt-scheme] syntax coloring, #lang, Scribble Message-ID: <20090728184637.B26D16500EA@mail-svr1.cs.utah.edu> DrScheme's Scheme mode syntax colorer is now actually a `#lang' colorer. It detects a `#lang' line and uses a syntax colorer that is specified by the language, if any. The Scribble languages `scribble/base', `scribble/manual', etc. specify a syntax colorer that handles @ notation and that starts the body in "text" mode. The `at-exp' language constructor similarly specifies a colorer that adds support for `@' notation to the Scheme colorer. A minor consequence of this change is that a `#lang' line turns red if it refers to a language that does not exist (while the body is colored as Scheme code). For now, `#lang planet' does not load a colorer via Planet --- because it seems like a bad idea to install a Planet package just because you open a file that starts `#lang planet ...'. We'll have to add something to let a DrScheme user designate packages to be trusted as plug-ins. There's no R6RS colorer, yet, but this change makes it possible to drop in an R6RS colorer that is triggered by `#!r6rs'. From mikeegg1 at mac.com Tue Jul 28 17:12:56 2009 From: mikeegg1 at mac.com (Mike Eggleston) Date: Tue Jul 28 17:13:19 2009 Subject: [plt-scheme] debugging [mini rant] Message-ID: <20090728211256.GA999@mail.mac.com> Morning, I think it's highly likely that I'm influenced by my early learning to write code days. I much prefer command line and tty systems to any graphic systems or systems with an attached rodent. Even using my windows (yuck) workstation my primary interface is an xterm into other systems. I use Outlook because I must support users having the same. My personal email program is character based (mutt). I only start a graphic email program when I need to look at pictures that someone sent. All that is a preface to the statements that I like command line, I like vi, I like gdb and perl -d. I would be much happier with plt-scheme/mzscheme if there is a way to do 'mzscheme -d code.lsp'. Using trace, like TRON from decades ago for me, does work, but isn't as satisfying as 'perl -d'. Is there a command line debugger in mzscheme? I finally found a way to get vi/vim to lisp indent my code. Now I want a debugger that I'm happy with. Mike From ntoronto at cs.byu.edu Tue Jul 28 17:57:23 2009 From: ntoronto at cs.byu.edu (Neil Toronto) Date: Tue Jul 28 17:53:22 2009 Subject: [plt-scheme] syntax coloring, #lang, Scribble In-Reply-To: <20090728184637.B26D16500EA@mail-svr1.cs.utah.edu> References: <20090728184637.B26D16500EA@mail-svr1.cs.utah.edu> Message-ID: <4A6F7443.3060701@cs.byu.edu> Matthew Flatt wrote: > DrScheme's Scheme mode syntax colorer is now actually a `#lang' > colorer. It detects a `#lang' line and uses a syntax colorer that is > specified by the language, if any. Very cool. Another step toward having #lang able to change everything of consequence in the programming environment. > The Scribble languages `scribble/base', `scribble/manual', etc. specify > a syntax colorer that handles @ notation and that starts the body in > "text" mode. The `at-exp' language constructor similarly specifies a > colorer that adds support for `@' notation to the Scheme colorer. Awesome. Is language-specific indentation coming soon? > For now, `#lang planet' does not load a colorer via Planet --- because > it seems like a bad idea to install a Planet package just because you > open a file that starts `#lang planet ...'. We'll have to add something > to let a DrScheme user designate packages to be trusted as plug-ins. Can it detect whether the Planet package has been installed and only use it if it has been? Neil From pocmatos at gmail.com Tue Jul 28 17:59:15 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Jul 28 17:59:39 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <20090728211256.GA999@mail.mac.com> References: <20090728211256.GA999@mail.mac.com> Message-ID: <1248818355.16007.43.camel@drserver> On Tue, 2009-07-28 at 16:12 -0500, Mike Eggleston wrote: > Morning, > > I think it's highly likely that I'm influenced by my early learning to > write code days. I much prefer command line and tty systems to any graphic > systems or systems with an attached rodent. Even using my windows (yuck) > workstation my primary interface is an xterm into other systems. I use > Outlook because I must support users having the same. My personal email > program is character based (mutt). I only start a graphic email program > when I need to look at pictures that someone sent. > > All that is a preface to the statements that I like command line, > I like vi, I like gdb and perl -d. I would be much happier with > plt-scheme/mzscheme if there is a way to do 'mzscheme -d code.lsp'. Using > trace, like TRON from decades ago for me, does work, but isn't as > satisfying as 'perl -d'. > > Is there a command line debugger in mzscheme? > > I finally found a way to get vi/vim to lisp indent my code. Now I want > a debugger that I'm happy with. > I guess the answer to you is 'no!', unfortunately. I am an avid DrScheme user for many years but I have to go +1 on this one. Sometimes only having to open my emacs would be heaven. I add two questions to the PLT-Team: - Is a command line debugger planned? - If not, what kind of work would it involved? > Mike > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mflatt at cs.utah.edu Tue Jul 28 18:20:47 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Tue Jul 28 18:21:23 2009 Subject: [plt-scheme] syntax coloring, #lang, Scribble In-Reply-To: <4A6F7443.3060701@cs.byu.edu> References: <20090728184637.B26D16500EA@mail-svr1.cs.utah.edu> <4A6F7443.3060701@cs.byu.edu> Message-ID: <20090728222047.C15E4650149@mail-svr1.cs.utah.edu> At Tue, 28 Jul 2009 15:57:23 -0600, Neil Toronto wrote: > Matthew Flatt wrote: > > The Scribble languages `scribble/base', `scribble/manual', etc. specify > > a syntax colorer that handles @ notation and that starts the body in > > "text" mode. The `at-exp' language constructor similarly specifies a > > colorer that adds support for `@' notation to the Scheme colorer. > > Awesome. Is language-specific indentation coming soon? Indentation is based on coloring, so it's already there to some degree, and I've improved Scribble coloring so that it indents better. For example, if you re-indent the second line of @{A B} you now get @{A B} From jensaxel at soegaard.net Tue Jul 28 18:23:16 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Tue Jul 28 18:23:35 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <1248818355.16007.43.camel@drserver> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> Message-ID: <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> 2009/7/28 Paulo J. Matos : > On Tue, 2009-07-28 at 16:12 -0500, Mike Eggleston wrote: >> Is there a command line debugger in mzscheme? > - Is a command line debugger planned? I am curious, do you use debuggers in other programming environments? If so, in which situations do you find them useful? /Jens Axel From pocmatos at gmail.com Tue Jul 28 19:17:27 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Jul 28 19:17:49 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> Message-ID: <1248823047.16007.50.camel@drserver> On Wed, 2009-07-29 at 00:23 +0200, Jens Axel S?gaard wrote: > 2009/7/28 Paulo J. Matos : > > On Tue, 2009-07-28 at 16:12 -0500, Mike Eggleston wrote: > > >> Is there a command line debugger in mzscheme? > > > - Is a command line debugger planned? > > I am curious, do you use debuggers in other programming environments? > If so, in which situations do you find them useful? > Yes, I use gdb a lot with C and C++. I find them very useful to step through some piece of code which is generating a strange value. For me they are particularly useful when debugging algorithms that either involve a lot of mathematics or which has a complex flow. DrScheme at the moment, which has a debugging function, is still not up to standard when you have to do this type of debugging. Or at least I feel in those cases better to fill my code with printfs which would probably be useless if I had a command line debugger (or if the debugger was better integrated into DrScheme, even though I would still prefer the former). When trying to use DrScheme debug function, values most of the times print outside the allocated space for it, making it basically useless. If I can't inspect values, the debugging is useless with the exception of being able where the code if flowing to. > /Jens Axel From ghcooper at gmail.com Tue Jul 28 19:40:39 2009 From: ghcooper at gmail.com (Gregory Cooper) Date: Tue Jul 28 19:40:57 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <1248823047.16007.50.camel@drserver> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> Message-ID: <65e1d50c0907281640k5331d7baoca0a6788ece7badb@mail.gmail.com> > When trying to use DrScheme debug function, values most of the times > print outside the allocated space for it, making it basically useless. > If I can't inspect values, the debugging is useless with the exception > of being able where the code if flowing to. If you right-click on a bound variable, or on the green execution marker (when it's at the end of an expression), a menu pops up with the option to print the expression's value to the REPL. Admittedly, this is a long way from the sort of value-inspection capability that would ideally be available, but it does overcome the immediate problem you've described, and it might be possible to extend the mechanism into something richer over time. Greg From neil at neilvandyke.org Tue Jul 28 20:11:27 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Tue Jul 28 20:11:53 2009 Subject: [plt-scheme] Re: syntax coloring, #lang, Scribble In-Reply-To: <4A6F7443.3060701@cs.byu.edu> References: <20090728184637.B26D16500EA@mail-svr1.cs.utah.edu> <4A6F7443.3060701@cs.byu.edu> Message-ID: <4A6F93AF.4050309@neilvandyke.org> Neil Toronto wrote at 07/28/2009 05:57 PM: > Matthew Flatt wrote: >> The Scribble languages `scribble/base', `scribble/manual', etc. specify >> a syntax colorer that handles @ notation and that starts the body in >> "text" mode. The `at-exp' language constructor similarly specifies a >> colorer that adds support for `@' notation to the Scheme colorer. > > Awesome. Is language-specific indentation coming soon? For Scheme (or perhaps Scheme-ish languages), it would be nice to be able to associate formatting rules with special syntax definitions. For example, in the module in which I define the "with-foo" syntax, I also define the formatting of that syntax. When editing a use of "with-foo" in a file, DrScheme will go look in the imported module and then know to indent the use like "begin0". Perhaps these formatting rules would be part of the embedded documentation. -- http://www.neilvandyke.org/ From mikeegg1 at me.com Tue Jul 28 20:24:37 2009 From: mikeegg1 at me.com (Mike Eggleston) Date: Tue Jul 28 20:25:02 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> Message-ID: <20090729002437.GA297@mail.me.com> On Wed, 29 Jul 2009, Jens Axel S??gaard might have said: > 2009/7/28 Paulo J. Matos : > > On Tue, 2009-07-28 at 16:12 -0500, Mike Eggleston wrote: > > >> Is there a command line debugger in mzscheme? > > > - Is a command line debugger planned? > > I am curious, do you use debuggers in other programming environments? > If so, in which situations do you find them useful? When I write a perl script or C program I use 'perl -d' or gdb respectively from inside vi. My first unix job was on the IBM RT, then AIX PS/2 1.0, then IBM RS6000. Using tty and the command line is important to me as a developer and as a sys admin it is vital since I guarantee I have ssh access to my machines and only resort to GUI (VPN and RDP or X) when there is absolutely no alternative. Mike From eli at barzilay.org Tue Jul 28 21:48:28 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jul 28 21:48:49 2009 Subject: [plt-scheme] Re: syntax coloring, #lang, Scribble In-Reply-To: <4A6F93AF.4050309@neilvandyke.org> References: <20090728184637.B26D16500EA@mail-svr1.cs.utah.edu> <4A6F7443.3060701@cs.byu.edu> <4A6F93AF.4050309@neilvandyke.org> Message-ID: <19055.43628.206444.113468@winooski.ccs.neu.edu> On Jul 28, Neil Van Dyke wrote: > > For Scheme (or perhaps Scheme-ish languages), it would be nice to be > able to associate formatting rules with special syntax definitions. Yes, that would be possible to, if we settle on some interface. Matthew is using the new capability of attaching properties to languages that are specified by `#lang' -- and the plan is to add more such properties, and one of them can be a description of keywords and their indentation rules (similar to the properties that Emacs uses). More generally, you can think of additional features -- another property that is available through this interface is the module that serves as the language module, and using that you can map names to functions, values, and macros (by using the module at the level of whatever tool you want to use it in). But... It might be better to do that in some other way, so you can use this information *including* stuff that you require into the module. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From eli at barzilay.org Tue Jul 28 21:58:58 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jul 28 21:59:25 2009 Subject: [plt-scheme] syntax coloring, #lang, Scribble In-Reply-To: <20090728222047.C15E4650149@mail-svr1.cs.utah.edu> References: <20090728184637.B26D16500EA@mail-svr1.cs.utah.edu> <4A6F7443.3060701@cs.byu.edu> <20090728222047.C15E4650149@mail-svr1.cs.utah.edu> Message-ID: <19055.44258.559278.129699@winooski.ccs.neu.edu> BTW, this works very nicely. I keep finding little things that are fun to try out like having just @foo and then changing the language by adding and removing at-exp, and seeing how the `@' gets colored differently. On Jul 28, Matthew Flatt wrote: > > Indentation is based on coloring, so it's already there to some > degree, and I've improved Scribble coloring so that it indents > better. > > For example, if you re-indent the second line of > > @{A > B} > > you now get > > @{A > B} This seems to me as something that is close to how Emacs deals "properly" with #; comments... In other words, you get an advantage, but there is also a big disadvantage: imagine reindenting a complete file that has (reflective pun intended): @list{A better way to write this code: (define (foo x) (if (even? x) (foo (/ x 2)) (foo (add1 (* x 3))))) is: (define (foo x) (if (even? x) (foo (/ x 2)) (foo (add1 (* x 3))))) } If you do that, you basically destroy the meaning of the text... (And the same goes for any text, not just scheme examples.) Is it possible to have this indentation apply only to explicit indentation (after a newline, or when hitting tab), but not when reindenting a block of text or the whole buffer? Even for hitting tab, I think that it makes more sense to do what Emacs is doing in text modes (insert spaces until the cursor reaches the goal column, even when the cursor has some whitespace after it). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From eli at barzilay.org Tue Jul 28 22:00:35 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jul 28 22:00:58 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <1248818355.16007.43.camel@drserver> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> Message-ID: <19055.44355.739707.760709@winooski.ccs.neu.edu> On Jul 28, Paulo J. Matos wrote: > > I add two questions to the PLT-Team: > - Is a command line debugger planned? > - If not, what kind of work would it involved? Doing a command line interface to the debugger would be pretty hard for the obvious reasons -- so the main problem is: hard work + small payoff. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From mikeegg1 at me.com Tue Jul 28 22:03:10 2009 From: mikeegg1 at me.com (Mike Eggleston) Date: Tue Jul 28 22:03:33 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <19055.44355.739707.760709@winooski.ccs.neu.edu> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <19055.44355.739707.760709@winooski.ccs.neu.edu> Message-ID: <20090729020310.GB297@mail.me.com> On Tue, 28 Jul 2009, Eli Barzilay might have said: > On Jul 28, Paulo J. Matos wrote: > > > > I add two questions to the PLT-Team: > > - Is a command line debugger planned? > > - If not, what kind of work would it involved? > > Doing a command line interface to the debugger would be pretty hard > for the obvious reasons -- so the main problem is: hard work + small > payoff. I've not looked at the code yet... is there nothing like a main loop for REPL that could be stepped if a command line -d flag is given, and if given this stepping could print the current sexp and accept a 'n' for next, 'c' for continue, or 'p' for executing an arbitrary sexp? Mike From eli at barzilay.org Tue Jul 28 22:15:15 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Jul 28 22:15:37 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <20090729020310.GB297@mail.me.com> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <19055.44355.739707.760709@winooski.ccs.neu.edu> <20090729020310.GB297@mail.me.com> Message-ID: <19055.45235.662803.835413@winooski.ccs.neu.edu> On Jul 28, Mike Eggleston wrote: > I've not looked at the code yet... is there nothing like a main loop > for REPL that could be stepped if a command line -d flag is given, > and if given this stepping could print the current sexp and accept a > 'n' for next, 'c' for continue, or 'p' for executing an arbitrary > sexp? Making it work with a command line flag is similar to making errortrace work with it. The thing is that when you use the debugger it will "annotate" your code by adding its own code into yours, and that code is what makes values visible etc. So you need to arrange for something similar on a command-line interface. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From toddobryan at gmail.com Tue Jul 28 23:05:06 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Tue Jul 28 23:05:24 2009 Subject: [plt-scheme] parser funky Message-ID: <904774730907282005k54795c82nbad4970a44dd3196@mail.gmail.com> Something funky is going on with the parser in the latest svn (version 4.2.1.4-svn28jul2009). In Beginning Student, I enter the following program and with the cursor after the last paren of the function, nothing is highlight, after the second-to-last, it highlights that paren in pink, suggesting that it's unbalanced. Also, auto-indenting seems to be confused when I hit enter after the first close paren. Is it just me? Todd From toddobryan at gmail.com Tue Jul 28 23:06:33 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Tue Jul 28 23:06:52 2009 Subject: [plt-scheme] Re: parser funky In-Reply-To: <904774730907282005k54795c82nbad4970a44dd3196@mail.gmail.com> References: <904774730907282005k54795c82nbad4970a44dd3196@mail.gmail.com> Message-ID: <904774730907282006s676f758dqcc5c54c8782b1b5c@mail.gmail.com> Whoops... Beginning Student language, and here's the program: (define (sum-coins p n d q) (+ (* 0.01 p) (* 0.05 n) (* 0.10 d) (* 0.25 q))) On Tue, Jul 28, 2009 at 11:05 PM, Todd O'Bryan wrote: > Something funky is going on with the parser in the latest svn (version > 4.2.1.4-svn28jul2009). > > In Beginning Student, I enter the following program and with the > cursor after the last paren of the function, nothing is highlight, > after the second-to-last, it highlights that paren in pink, suggesting > that it's unbalanced. > > Also, auto-indenting seems to be confused when I hit enter after the > first close paren. > > Is it just me? > > Todd > From mflatt at cs.utah.edu Tue Jul 28 23:32:33 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Tue Jul 28 23:32:55 2009 Subject: [plt-scheme] parser funky In-Reply-To: <904774730907282005k54795c82nbad4970a44dd3196@mail.gmail.com> References: <904774730907282005k54795c82nbad4970a44dd3196@mail.gmail.com> Message-ID: <20090729033234.6C49D650108@mail-svr1.cs.utah.edu> At Tue, 28 Jul 2009 23:05:06 -0400, "Todd O'Bryan" wrote: > Something funky is going on with the parser in the latest svn (version > 4.2.1.4-svn28jul2009). > > In Beginning Student, I enter the following program and with the > cursor after the last paren of the function, nothing is highlight, > after the second-to-last, it highlights that paren in pink, suggesting > that it's unbalanced. > > Also, auto-indenting seems to be confused when I hit enter after the > first close paren. > > Is it just me? No, it was a bug in my changes today, and it's fixed in SVN. From pocmatos at gmail.com Wed Jul 29 06:36:12 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Wed Jul 29 06:36:40 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <65e1d50c0907281640k5331d7baoca0a6788ece7badb@mail.gmail.com> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> <65e1d50c0907281640k5331d7baoca0a6788ece7badb@mail.gmail.com> Message-ID: <1248863772.16205.3.camel@drserver> On Tue, 2009-07-28 at 16:40 -0700, Gregory Cooper wrote: > > When trying to use DrScheme debug function, values most of the times > > print outside the allocated space for it, making it basically useless. > > If I can't inspect values, the debugging is useless with the exception > > of being able where the code if flowing to. > > If you right-click on a bound variable, or on the green execution > marker (when it's at the end of an expression), a menu pops up with > the option to print the expression's value to the REPL. Admittedly, > this is a long way from the sort of value-inspection capability that > would ideally be available, but it does overcome the immediate problem > you've described, and it might be possible to extend the mechanism > into something richer over time. > > Greg You're right... that is possible... but when you would like to inspect a set of variables, doing that for each of them is pretty annoying. Mainly imagine stepping from let loop which changes 10 variables... If at each step you have to do that for all the 10 variables, it's easier to just write a printf to print them all at each step. From toddobryan at gmail.com Wed Jul 29 07:31:43 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Wed Jul 29 07:32:01 2009 Subject: [plt-scheme] parser funky In-Reply-To: <20090729033234.6C49D650108@mail-svr1.cs.utah.edu> References: <904774730907282005k54795c82nbad4970a44dd3196@mail.gmail.com> <20090729033234.6C49D650108@mail-svr1.cs.utah.edu> Message-ID: <904774730907290431j33adc0b1h95a979d9809d8670@mail.gmail.com> When I update from SVN, it takes 20-30 minutes to rebuild everything (configure; make; make install). I'm not that make savvy, so I'm suspecting there's a less disruptive and painful path to upgrading. Am I just being overly optimistic? Todd On Tue, Jul 28, 2009 at 11:32 PM, Matthew Flatt wrote: > At Tue, 28 Jul 2009 23:05:06 -0400, "Todd O'Bryan" wrote: >> Something funky is going on with the parser in the latest svn (version >> 4.2.1.4-svn28jul2009). >> >> In Beginning Student, I enter the following program and with the >> cursor after the last paren of the function, nothing is highlight, >> after the second-to-last, it highlights that paren in pink, suggesting >> that it's unbalanced. >> >> Also, auto-indenting seems to be confused when I hit enter after the >> first close paren. >> >> Is it just me? > > No, it was a bug in my changes today, and it's fixed in SVN. > > From mikeegg1 at mac.com Wed Jul 29 07:39:05 2009 From: mikeegg1 at mac.com (Mike Eggleston) Date: Wed Jul 29 07:39:26 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <1248863772.16205.3.camel@drserver> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> <65e1d50c0907281640k5331d7baoca0a6788ece7badb@mail.gmail.com> <1248863772.16205.3.camel@drserver> Message-ID: <20090729113905.GA14493@mail.mac.com> On Wed, 29 Jul 2009, Paulo J. Matos might have said: > On Tue, 2009-07-28 at 16:40 -0700, Gregory Cooper wrote: > > > When trying to use DrScheme debug function, values most of the times > > > print outside the allocated space for it, making it basically useless. > > > If I can't inspect values, the debugging is useless with the exception > > > of being able where the code if flowing to. > > > > If you right-click on a bound variable, or on the green execution > > marker (when it's at the end of an expression), a menu pops up with > > the option to print the expression's value to the REPL. Admittedly, > > this is a long way from the sort of value-inspection capability that > > would ideally be available, but it does overcome the immediate problem > > you've described, and it might be possible to extend the mechanism > > into something richer over time. > > > > Greg > > You're right... that is possible... but when you would like to inspect a > set of variables, doing that for each of them is pretty annoying. Mainly > imagine stepping from let loop which changes 10 variables... If at each > step you have to do that for all the 10 variables, it's easier to just > write a printf to print them all at each step. And, for my needs, right clicking is not possible through ssh. :( Mike From mflatt at cs.utah.edu Wed Jul 29 08:05:24 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Wed Jul 29 08:05:46 2009 Subject: [plt-scheme] parser funky In-Reply-To: <904774730907290431j33adc0b1h95a979d9809d8670@mail.gmail.com> References: <904774730907282005k54795c82nbad4970a44dd3196@mail.gmail.com> <20090729033234.6C49D650108@mail-svr1.cs.utah.edu> <904774730907290431j33adc0b1h95a979d9809d8670@mail.gmail.com> Message-ID: <20090729120526.83E7165014F@mail-svr1.cs.utah.edu> Instead of make install you can use make plain-install setup-plt -D which avoids re-building the docs. That can be faster for some updates. At Wed, 29 Jul 2009 07:31:43 -0400, "Todd O'Bryan" wrote: > When I update from SVN, it takes 20-30 minutes to rebuild everything > (configure; make; make install). I'm not that make savvy, so I'm > suspecting there's a less disruptive and painful path to upgrading. Am > I just being overly optimistic? > > Todd > > On Tue, Jul 28, 2009 at 11:32 PM, Matthew Flatt wrote: > > At Tue, 28 Jul 2009 23:05:06 -0400, "Todd O'Bryan" wrote: > >> Something funky is going on with the parser in the latest svn (version > >> 4.2.1.4-svn28jul2009). > >> > >> In Beginning Student, I enter the following program and with the > >> cursor after the last paren of the function, nothing is highlight, > >> after the second-to-last, it highlights that paren in pink, suggesting > >> that it's unbalanced. > >> > >> Also, auto-indenting seems to be confused when I hit enter after the > >> first close paren. > >> > >> Is it just me? > > > > No, it was a bug in my changes today, and it's fixed in SVN. > > > > From jensaxel at soegaard.net Wed Jul 29 08:13:21 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Wed Jul 29 08:13:46 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <1248823047.16007.50.camel@drserver> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> Message-ID: <4072c51f0907290513ra45b00et82fba93c3e09986a@mail.gmail.com> 2009/7/29 Paulo J. Matos : > On Wed, 2009-07-29 at 00:23 +0200, Jens Axel S?gaard wrote: >> 2009/7/28 Paulo J. Matos : >> > On Tue, 2009-07-28 at 16:12 -0500, Mike Eggleston wrote: >> >> >> Is there a command line debugger in mzscheme? >> >> > - Is a command line debugger planned? >> >> I am curious, do you use debuggers in other programming environments? >> If so, in which situations do you find them useful? >> > > Yes, I use gdb a lot with C and C++. I find them very useful to step > through some piece of code which is generating a strange value. Is this faster than sprinkling the code with print statements? > For me they are particularly useful when debugging algorithms that > either involve a lot of mathematics or which has a complex flow. For the first purpose (mathematical expressions) I see that as sign to break down the function into smaller ones, and then write a few tests for each. The second, well it takes ages to follow complicated flows in a debugger, so for me I have found testing each component independently usually is faster. -- Jens Axel S?gaard From mikeegg1 at mac.com Wed Jul 29 08:19:57 2009 From: mikeegg1 at mac.com (Mike Eggleston) Date: Wed Jul 29 08:20:18 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <4072c51f0907290513ra45b00et82fba93c3e09986a@mail.gmail.com> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> <4072c51f0907290513ra45b00et82fba93c3e09986a@mail.gmail.com> Message-ID: <20090729121957.GF14493@mail.mac.com> On Wed, 29 Jul 2009, Jens Axel S?gaard might have said: > 2009/7/29 Paulo J. Matos : > > On Wed, 2009-07-29 at 00:23 +0200, Jens Axel S?gaard wrote: > >> 2009/7/28 Paulo J. Matos : > >> > On Tue, 2009-07-28 at 16:12 -0500, Mike Eggleston wrote: > >> > >> >> Is there a command line debugger in mzscheme? > >> > >> > - Is a command line debugger planned? > >> > >> I am curious, do you use debuggers in other programming environments? > >> If so, in which situations do you find them useful? > >> > > > > Yes, I use gdb a lot with C and C++. I find them very useful to step > > through some piece of code which is generating a strange value. > > Is this faster than sprinkling the code with print statements? Yes, much, and preferable in a production environment when you're trying to figure out why something is not right. Any change you make to the code must be tested again, so if you can run the code through a debugger without changes is best. If you make a change to add printf()s then you can't say for certain if your printf() caused the error or if you've found the reported error. > > For me they are particularly useful when debugging algorithms that > > either involve a lot of mathematics or which has a complex flow. > > For the first purpose (mathematical expressions) I see that as sign to > break down the function into smaller ones, and then write a few tests > for each. > > The second, well it takes ages to follow complicated flows in a > debugger, so for me I have found testing each component independently > usually is faster. > -- > Jens Axel S?gaard I agree with smaller and testing first. That's how I learned java, through a very liberal use of System.out.println() throughout my code. I'll learn scheme the same way if I need to (still working on the learning part), but using something like 'perl -d' for an integrated, embedded source line debugger would be much faster. Mike From eli at barzilay.org Wed Jul 29 08:27:16 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jul 29 08:27:41 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <20090729121957.GF14493@mail.mac.com> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> <4072c51f0907290513ra45b00et82fba93c3e09986a@mail.gmail.com> <20090729121957.GF14493@mail.mac.com> Message-ID: <19056.16420.934421.837123@winooski.ccs.neu.edu> On Jul 29, Mike Eggleston wrote: > > Yes, much, and preferable in a production environment when you're > trying to figure out why something is not right. Any change you make > to the code must be tested again, so if you can run the code through > a debugger without changes is best. If you make a change to add > printf()s then you can't say for certain if your printf() caused the > error or if you've found the reported error. This point is bogus. I personally had one occasion where I had spent about 14 hours chasing a problem that we discovered in a release mode build of our product. It was there for about a week before that (and it was the segfaulting kind of a problem), yet we didn't know about it because it didn't happen in debug mode. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From egarrulo at gmail.com Wed Jul 29 08:32:18 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Wed Jul 29 08:32:37 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <20090729121957.GF14493@mail.mac.com> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> <4072c51f0907290513ra45b00et82fba93c3e09986a@mail.gmail.com> <20090729121957.GF14493@mail.mac.com> Message-ID: <9bd8a08a0907290532p597ec463mcb59b4e8d4e8ce63@mail.gmail.com> 2009/7/29 Mike Eggleston : > I agree with smaller and testing first. That's how I learned ... That's how you learned, but not what you can do when you inherit an existing codebase. Indeed, a command line debugger would make easy to connect the debugger from other environments (SLIME?), but it's understand that it could be a lot of work if such debugger is currently embedded into the graphical environment. From mikeegg1 at mac.com Wed Jul 29 08:50:20 2009 From: mikeegg1 at mac.com (Mike Eggleston) Date: Wed Jul 29 08:50:41 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <19056.16420.934421.837123@winooski.ccs.neu.edu> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> <4072c51f0907290513ra45b00et82fba93c3e09986a@mail.gmail.com> <20090729121957.GF14493@mail.mac.com> <19056.16420.934421.837123@winooski.ccs.neu.edu> Message-ID: <20090729125020.GG14493@mail.mac.com> On Wed, 29 Jul 2009, Eli Barzilay might have said: > On Jul 29, Mike Eggleston wrote: > > > > Yes, much, and preferable in a production environment when you're > > trying to figure out why something is not right. Any change you make > > to the code must be tested again, so if you can run the code through > > a debugger without changes is best. If you make a change to add > > printf()s then you can't say for certain if your printf() caused the > > error or if you've found the reported error. > > This point is bogus. I personally had one occasion where I had spent > about 14 hours chasing a problem that we discovered in a release mode > build of our product. It was there for about a week before that (and > it was the segfaulting kind of a problem), yet we didn't know about it > because it didn't happen in debug mode. Not bogus for me. I perform this type of debugging often on production systems. I like to know I have made no changes to a system I'm trying to find the error in, that I've not introduced another issue by changing the code to add printf()s (stdout or file). Mike From nadeem at acm.org Wed Jul 29 09:01:46 2009 From: nadeem at acm.org (Nadeem Abdul Hamid) Date: Wed Jul 29 09:02:10 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <20090729125020.GG14493@mail.mac.com> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> <4072c51f0907290513ra45b00et82fba93c3e09986a@mail.gmail.com> <20090729121957.GF14493@mail.mac.com> <19056.16420.934421.837123@winooski.ccs.neu.edu> <20090729125020.GG14493@mail.mac.com> Message-ID: <1803F8BB-1028-4A67-98BF-45E40FD4ED08@acm.org> On Jul 29, 2009, at 8:50 AM, Mike Eggleston wrote: > On Wed, 29 Jul 2009, Eli Barzilay might have said: > On Jul 29, Mike Eggleston wrote: >>> >>> Yes, much, and preferable in a production environment when you're >>> trying to figure out why something is not right. Any change you make >>> to the code must be tested again, so if you can run the code through >>> a debugger without changes is best. If you make a change to add >>> printf()s then you can't say for certain if your printf() caused the >>> error or if you've found the reported error. >> >> This point is bogus. I personally had one occasion where I had spent >> about 14 hours chasing a problem that we discovered in a release mode >> build of our product. It was there for about a week before that (and >> it was the segfaulting kind of a problem), yet we didn't know about >> it >> because it didn't happen in debug mode. > > Not bogus for me. I perform this type of debugging often on production > systems. I like to know I have made no changes to a system I'm trying > to find the error in, that I've not introduced another issue by > changing > the code to add printf()s (stdout or file). I agree with Eli, and have experienced the same myself in C/C++ debugging. Usually the debugger *does* have an effect on the system you're running (like it might set pointers to NULL instead of leaving them uninitialized garbage values). It's the CS counterpart of the "observer effect"... http://en.wikipedia.org/wiki/Observer_effect_(physics) I would rather trust printf's (of course without side-effect expressions in their arguments) than a debugger. --- nadeem From robby at eecs.northwestern.edu Wed Jul 29 09:20:10 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Jul 29 09:20:30 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <20090729125020.GG14493@mail.mac.com> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> <4072c51f0907290513ra45b00et82fba93c3e09986a@mail.gmail.com> <20090729121957.GF14493@mail.mac.com> <19056.16420.934421.837123@winooski.ccs.neu.edu> <20090729125020.GG14493@mail.mac.com> Message-ID: <932b2f1f0907290620x1cd368b9sd042d3382114c026@mail.gmail.com> On Wed, Jul 29, 2009 at 7:50 AM, Mike Eggleston wrote: > On Wed, 29 Jul 2009, Eli Barzilay might have said: > >> On Jul 29, Mike Eggleston wrote: >> > >> > Yes, much, and preferable in a production environment when you're >> > trying to figure out why something is not right. Any change you make >> > to the code must be tested again, so if you can run the code through >> > a debugger without changes is best. If you make a change to add >> > printf()s then you can't say for certain if your printf() caused the >> > error or if you've found the reported error. >> >> This point is bogus. ?I personally had one occasion where I had spent >> about 14 hours chasing a problem that we discovered in a release mode >> build of our product. ?It was there for about a week before that (and >> it was the segfaulting kind of a problem), yet we didn't know about it >> because it didn't happen in debug mode. > > Not bogus for me. I perform this type of debugging often on production > systems. I like to know I have made no changes to a system I'm trying > to find the error in, that I've not introduced another issue by changing > the code to add printf()s (stdout or file). No to belabor the obvious here, but debuggers change the behavior of your program (perhaps even more than printfs, depending on what you're doing). Robby From egarrulo at gmail.com Wed Jul 29 10:00:33 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Wed Jul 29 10:00:54 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <932b2f1f0907290620x1cd368b9sd042d3382114c026@mail.gmail.com> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> <4072c51f0907290513ra45b00et82fba93c3e09986a@mail.gmail.com> <20090729121957.GF14493@mail.mac.com> <19056.16420.934421.837123@winooski.ccs.neu.edu> <20090729125020.GG14493@mail.mac.com> <932b2f1f0907290620x1cd368b9sd042d3382114c026@mail.gmail.com> Message-ID: <9bd8a08a0907290700w550cb970s1ae55068ba148ac4@mail.gmail.com> 2009/7/29 Robby Findler : > On Wed, Jul 29, 2009 at 7:50 AM, Mike Eggleston wrote: >> On Wed, 29 Jul 2009, Eli Barzilay might have said: >> >>> On Jul 29, Mike Eggleston wrote: >>> > >>> > Yes, much, and preferable in a production environment when you're >>> > trying to figure out why something is not right. Any change you make >>> > to the code must be tested again, so if you can run the code through >>> > a debugger without changes is best. If you make a change to add >>> > printf()s then you can't say for certain if your printf() caused the >>> > error or if you've found the reported error. >>> >>> This point is bogus. ?I personally had one occasion where I had spent >>> about 14 hours chasing a problem that we discovered in a release mode >>> build of our product. ?It was there for about a week before that (and >>> it was the segfaulting kind of a problem), yet we didn't know about it >>> because it didn't happen in debug mode. >> >> Not bogus for me. I perform this type of debugging often on production >> systems. I like to know I have made no changes to a system I'm trying >> to find the error in, that I've not introduced another issue by changing >> the code to add printf()s (stdout or file). > > No to belabor the obvious here, but debuggers change the behavior of > your program (perhaps even more than printfs, depending on what you're > doing). Sometimes they do it to help you diagnose problems early. For instance, Visual C++ debugger fills memory with special bytes both on allocation and on release to help you spot invalid memory accesses. IMO, debuggers are not perfect, but a hell of help when dealing with legacy code. From mikeegg1 at mac.com Wed Jul 29 10:04:27 2009 From: mikeegg1 at mac.com (Mike Eggleston) Date: Wed Jul 29 10:04:49 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <9bd8a08a0907290532p597ec463mcb59b4e8d4e8ce63@mail.gmail.com> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> <4072c51f0907290513ra45b00et82fba93c3e09986a@mail.gmail.com> <20090729121957.GF14493@mail.mac.com> <9bd8a08a0907290532p597ec463mcb59b4e8d4e8ce63@mail.gmail.com> Message-ID: <20090729140427.GK14493@mail.mac.com> On Wed, 29 Jul 2009, Elena Garrulo might have said: > 2009/7/29 Mike Eggleston : > > I agree with smaller and testing first. That's how I learned ... > > That's how you learned, but not what you can do when you inherit an > existing codebase. > > Indeed, a command line debugger would make easy to connect the > debugger from other environments (SLIME?), but it's understand that it > could be a lot of work if such debugger is currently embedded into the > graphical environment. That's part of what I'm talking about though, the graphic environment. I only want/would like an in-line debugger in mzscheme, not the graphic Dr Scheme. Mike From skeptic2000 at hotmail.com Wed Jul 29 10:34:08 2009 From: skeptic2000 at hotmail.com (Skeptic .) Date: Wed Jul 29 10:39:45 2009 Subject: [plt-scheme] questions about graphical debugger Message-ID: Hi, Two questions about the graphical debugger : If I debug this procedure : (define test (¦Ë (n) (cond [(> n 3) 'x] [(= n 3) 'y] [(< n 3) 'z]))) (test 1) 1- Why the step cursor goes on 'x and 'y after showing both results to be #f. 2- Why when the step cursor is at the end, the result shown is (test 1) => # and not 'z ? Thanks. _________________________________________________________________ Internet explorer 8 aide ¨¤ prot¨¦ger la vie priv¨¦e. http://go.microsoft.com/?linkid=9655573 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090729/649e04f1/attachment.htm From egarrulo at gmail.com Wed Jul 29 10:39:20 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Wed Jul 29 10:39:52 2009 Subject: [plt-scheme] Is packages installation portable? Message-ID: <9bd8a08a0907290739h6aa2c596p4f5dc498670e08ee@mail.gmail.com> Hello, where are installed PLT packages? To me it seems they are installed in "%USERPROFILE%\Dati applicazioni\PLT Scheme\planet\300\4.2" (Windows). Is that correct? Should I execute a program on another machine, am I required to install them again or would suffice copying such directory and referencing it in PLTCOLLECTS? The second machine has not an Internet collection. Thanks. From robby at eecs.northwestern.edu Wed Jul 29 10:45:59 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Jul 29 10:46:25 2009 Subject: [plt-scheme] Is packages installation portable? In-Reply-To: <9bd8a08a0907290739h6aa2c596p4f5dc498670e08ee@mail.gmail.com> References: <9bd8a08a0907290739h6aa2c596p4f5dc498670e08ee@mail.gmail.com> Message-ID: <932b2f1f0907290745j6998171bl2650489e408056bf@mail.gmail.com> The right way to do that is to download the .plt file via the planet commandline tool (on the machine that has a network connection) and then install it via the planet commandline tool (on the machine that doesn't). "planet fetch" or "planet url" will let you download the package (altho you may need to rename it if you download via the url given to from planet url), and then "planet fileinject" lets you install the file. Robby On Wed, Jul 29, 2009 at 9:39 AM, Elena Garrulo wrote: > Hello, > > where are installed PLT packages? To me it seems they are installed in > "%USERPROFILE%\Dati applicazioni\PLT Scheme\planet\300\4.2" (Windows). > Is that correct? > > Should I execute a program on another machine, am I required to > install them again or would suffice copying such directory and > referencing it in PLTCOLLECTS? The second machine has not an Internet > collection. > > Thanks. > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From robby at eecs.northwestern.edu Wed Jul 29 10:47:33 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Jul 29 10:47:56 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <20090729140427.GK14493@mail.mac.com> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> <4072c51f0907290513ra45b00et82fba93c3e09986a@mail.gmail.com> <20090729121957.GF14493@mail.mac.com> <9bd8a08a0907290532p597ec463mcb59b4e8d4e8ce63@mail.gmail.com> <20090729140427.GK14493@mail.mac.com> Message-ID: <932b2f1f0907290747t3d6173b6h8ad331dcb49946f1@mail.gmail.com> Hi Mike: I don't mean to cut this short, buy you've expressed that sentiment quite clearly, several times, and there do not seem to be any takers to do the actual work. As this is a volunteer project, perhaps you should consider contributing it yourself? Robby On Wed, Jul 29, 2009 at 9:04 AM, Mike Eggleston wrote: > On Wed, 29 Jul 2009, Elena Garrulo might have said: > >> 2009/7/29 Mike Eggleston : >> > I agree with smaller and testing first. That's how I learned ... >> >> That's how you learned, but not what you can do when you inherit an >> existing codebase. >> >> Indeed, a command line debugger would make easy to connect the >> debugger from other environments (SLIME?), but it's understand that it >> could be a lot of work if such debugger is currently embedded into the >> graphical environment. > > That's part of what I'm talking about though, the graphic environment. I > only want/would like an in-line debugger in mzscheme, not the graphic > Dr Scheme. > > Mike > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From ghcooper at gmail.com Wed Jul 29 10:48:47 2009 From: ghcooper at gmail.com (Gregory Cooper) Date: Wed Jul 29 10:49:16 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <9bd8a08a0907290532p597ec463mcb59b4e8d4e8ce63@mail.gmail.com> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> <4072c51f0907290513ra45b00et82fba93c3e09986a@mail.gmail.com> <20090729121957.GF14493@mail.mac.com> <9bd8a08a0907290532p597ec463mcb59b4e8d4e8ce63@mail.gmail.com> Message-ID: <65e1d50c0907290748o333b5ae2v7b0efae26940600@mail.gmail.com> > Indeed, a command line debugger would make easy to connect the > debugger from other environments (SLIME?), but it's understand that it > could be a lot of work if such debugger is currently embedded into the > graphical environment. Support for setting breakpoints and inspecting the stack is implemented by source annotation and continuation marks. All of this is independent of any graphical interface, and an interested programmer with some free time could build a text-based interface atop the same underlying mechanism. Greg From egarrulo at gmail.com Wed Jul 29 10:59:36 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Wed Jul 29 10:59:54 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <65e1d50c0907290748o333b5ae2v7b0efae26940600@mail.gmail.com> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> <4072c51f0907290513ra45b00et82fba93c3e09986a@mail.gmail.com> <20090729121957.GF14493@mail.mac.com> <9bd8a08a0907290532p597ec463mcb59b4e8d4e8ce63@mail.gmail.com> <65e1d50c0907290748o333b5ae2v7b0efae26940600@mail.gmail.com> Message-ID: <9bd8a08a0907290759i62558ecdqe3df41436ba4e877@mail.gmail.com> 2009/7/29 Gregory Cooper : >> Indeed, a command line debugger would make easy to connect the >> debugger from other environments (SLIME?), but it's understand that it >> could be a lot of work if such debugger is currently embedded into the >> graphical environment. > > Support for setting breakpoints and inspecting the stack is > implemented by source annotation and continuation marks. ?All of this > is independent of any graphical interface, and an interested > programmer with some free time could build a text-based interface atop > the same underlying mechanism. Could you provide some link, please? I have not found any reference in PLT docs. Thanks. From ghcooper at gmail.com Wed Jul 29 11:00:33 2009 From: ghcooper at gmail.com (Gregory Cooper) Date: Wed Jul 29 11:00:59 2009 Subject: [plt-scheme] questions about graphical debugger In-Reply-To: References: Message-ID: <65e1d50c0907290800v55a97344xd226bb23e9e45167@mail.gmail.com> I suspect you're using a language level that does some implicit expansion of your code before evaluation. The debugger steps through the expanded code (whose semantics are somewhat different), and attempts to map the state of the evaluator back to the original source. The issue of # for top-level expressions has come up before, and I'm not sure why it can't be fixed. (Eli?) If you run it in, for example, Pretty Big, I think the results will be more in line with your expectations. Greg 2009/7/29 Skeptic . : > > Hi, > > Two questions about the graphical debugger : > If I debug this procedure : > (define test (=A6=CB (n) > (cond [(> n 3) 'x] > [(=3D n 3) 'y] > [(< n 3) 'z]))) > (test 1) > 1- Why the step cursor goes on 'x and 'y after showing both results to be > #f. > 2- Why when the step cursor is at the end, the result shown is (test 1) = =3D> > # and not 'z ? > Thanks. > ________________________________ > Naviguez plus vite avec Internet Explorer 8 Ici. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From noelwelsh at gmail.com Wed Jul 29 11:12:47 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Wed Jul 29 11:13:07 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <9bd8a08a0907290759i62558ecdqe3df41436ba4e877@mail.gmail.com> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> <4072c51f0907290513ra45b00et82fba93c3e09986a@mail.gmail.com> <20090729121957.GF14493@mail.mac.com> <9bd8a08a0907290532p597ec463mcb59b4e8d4e8ce63@mail.gmail.com> <65e1d50c0907290748o333b5ae2v7b0efae26940600@mail.gmail.com> <9bd8a08a0907290759i62558ecdqe3df41436ba4e877@mail.gmail.com> Message-ID: On Wed, Jul 29, 2009 at 3:59 PM, Elena Garrulo wrote: > 2009/7/29 Gregory Cooper : > Could you provide some link, please? I have not found any reference in PLT docs. Search for "syntax properties" and "continuation marks". N. From fkoksal at cs.bilgi.edu.tr Wed Jul 29 11:08:58 2009 From: fkoksal at cs.bilgi.edu.tr (=?UTF-8?B?Ik0uIEZhdGloIEvDtmtzYWwi?=) Date: Wed Jul 29 11:13:34 2009 Subject: [plt-scheme] unhighlighting previously highlighted ranges Message-ID: <4A70660A.8090404@cs.bilgi.edu.tr> Hi, I'm trying to unhighlight previously highlighted ranges in a color:text%. What would be the appropriate way of doing it? There is the "get-highlighted-ranges" method, which returns (listof range). However, I couldn't process the returned range structure. It's defined as; (define-struct range (start end caret-space? style color) #:inspector #f) in ./framework/private/text.ss, but, it's not provided. M. Fatih K?ksal ?stanbul Bilgi University Department of Computer Science -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 260 bytes Desc: OpenPGP digital signature Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090729/71be9fd9/signature.pgp From robby at eecs.northwestern.edu Wed Jul 29 11:10:12 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Jul 29 11:17:27 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <9bd8a08a0907290759i62558ecdqe3df41436ba4e877@mail.gmail.com> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> <4072c51f0907290513ra45b00et82fba93c3e09986a@mail.gmail.com> <20090729121957.GF14493@mail.mac.com> <9bd8a08a0907290532p597ec463mcb59b4e8d4e8ce63@mail.gmail.com> <65e1d50c0907290748o333b5ae2v7b0efae26940600@mail.gmail.com> <9bd8a08a0907290759i62558ecdqe3df41436ba4e877@mail.gmail.com> Message-ID: <932b2f1f0907290810h5acbc9c6r991ca61286a572d5@mail.gmail.com> On Wed, Jul 29, 2009 at 9:59 AM, Elena Garrulo wrote: >> Support for setting breakpoints and inspecting the stack is >> implemented by source annotation and continuation marks. ?All of this >> is independent of any graphical interface, and an interested >> programmer with some free time could build a text-based interface atop >> the same underlying mechanism. > > Could you provide some link, please? I have not found any reference in PLT docs. http://docs.plt-scheme.org/errortrace/ Robby From mikeegg1 at mac.com Wed Jul 29 11:26:34 2009 From: mikeegg1 at mac.com (Mike Eggleston) Date: Wed Jul 29 11:26:54 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <932b2f1f0907290747t3d6173b6h8ad331dcb49946f1@mail.gmail.com> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> <4072c51f0907290513ra45b00et82fba93c3e09986a@mail.gmail.com> <20090729121957.GF14493@mail.mac.com> <9bd8a08a0907290532p597ec463mcb59b4e8d4e8ce63@mail.gmail.com> <20090729140427.GK14493@mail.mac.com> <932b2f1f0907290747t3d6173b6h8ad331dcb49946f1@mail.gmail.com> Message-ID: <20090729152634.GL14493@mail.mac.com> On Wed, 29 Jul 2009, Robby Findler might have said: > Hi Mike: I don't mean to cut this short, buy you've expressed that > sentiment quite clearly, several times, and there do not seem to be > any takers to do the actual work. As this is a volunteer project, > perhaps you should consider contributing it yourself? > > Robby I'm looking at the code now to do just that. :) Mike From d.j.gurnell at gmail.com Wed Jul 29 11:52:57 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Wed Jul 29 11:53:38 2009 Subject: [plt-scheme] Is there an idiom for throwing away some values? In-Reply-To: References: <36366a980907272109v1befe4focab125fc1a357177@mail.gmail.com> Message-ID: <5AEB19C5-F568-4F83-B481-F195580556AC@gmail.com> Noel Welsh wrote: > I run into this all the time: writing a for/fold where I only want > one value at the end. [...] Me too. Also, though maybe this is laziness on my part, combining for- loops and append/filter/reverse and so on. I added a few useful shorthands to Unlib 3.16 in case they're helpful to anyone... docs here: http://planet.plt-scheme.org/package-source/untyped/unlib.plt/3/16/planet-docs/unlib/for.html -- Dave From egarrulo at gmail.com Wed Jul 29 11:58:02 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Wed Jul 29 11:58:22 2009 Subject: [plt-scheme] Is packages installation portable? In-Reply-To: <932b2f1f0907290745j6998171bl2650489e408056bf@mail.gmail.com> References: <9bd8a08a0907290739h6aa2c596p4f5dc498670e08ee@mail.gmail.com> <932b2f1f0907290745j6998171bl2650489e408056bf@mail.gmail.com> Message-ID: <9bd8a08a0907290858j78824d1bj913739af0b6e8c79@mail.gmail.com> 2009/7/29 Robby Findler : > The right way to do that is to download the .plt file via the planet > commandline tool (on the machine that has a network connection) and > then install it via the planet commandline tool (on the machine that > doesn't). "planet fetch" or "planet url" will let you download the > package (altho you may need to rename it if you download via the url > given to from planet url), and then "planet fileinject" lets you > install the file. It would be indeed preferable to not install anything, but just shipping a zip. Do you think that is achievable? Thanks. From robby at eecs.northwestern.edu Wed Jul 29 12:04:36 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Jul 29 12:04:54 2009 Subject: [plt-scheme] Is packages installation portable? In-Reply-To: <9bd8a08a0907290858j78824d1bj913739af0b6e8c79@mail.gmail.com> References: <9bd8a08a0907290739h6aa2c596p4f5dc498670e08ee@mail.gmail.com> <932b2f1f0907290745j6998171bl2650489e408056bf@mail.gmail.com> <9bd8a08a0907290858j78824d1bj913739af0b6e8c79@mail.gmail.com> Message-ID: <932b2f1f0907290904h2f9b65f7w16c6acae6d66c364@mail.gmail.com> Not in general. If you're setting up multiple machines in a cluster that are all the same, you could install one and clone them onto the others, perhaps. But the .plt file is the way we've designed it to work. Perhaps if we knew more about your setup and why you'd want to do this? Robby On Wed, Jul 29, 2009 at 10:58 AM, Elena Garrulo wrote: > 2009/7/29 Robby Findler : >> The right way to do that is to download the .plt file via the planet >> commandline tool (on the machine that has a network connection) and >> then install it via the planet commandline tool (on the machine that >> doesn't). "planet fetch" or "planet url" will let you download the >> package (altho you may need to rename it if you download via the url >> given to from planet url), and then "planet fileinject" lets you >> install the file. > > It would be indeed preferable to not install anything, but just > shipping a zip. Do you think that is achievable? > > Thanks. > From wookiz at hotmail.com Wed Jul 29 11:26:04 2009 From: wookiz at hotmail.com (wooks) Date: Wed Jul 29 12:06:42 2009 Subject: [plt-scheme] Re: Some dissing of Scheme In-Reply-To: <904774730907260511t3cb95653vb430ad532c3c1bca@mail.gmail.com> References: <904774730907260511t3cb95653vb430ad532c3c1bca@mail.gmail.com> Message-ID: On Jul 26, 5:11?am, "Todd O'Bryan" wrote: > http://tech.slashdot.org/story/09/07/25/1224247/The-Best-First-Langua... > > I already posted a comment linking to HtDP and How to Design Worlds, > but I thought people might want to see the article. > Some thoughts. If a student is concurrently (or has taken) a discrete math class or is a CS or Math major, something like Scheme is really appropriate, otherwise I'm not sure it's that beneficial. The "hacker ethic" as espoused by some of the respondents is best possible explanation for the amount of unreliable crappy software that is built. Plus the fact that software development is not a profession and throws open its doors to the good, the bad and the ugly from all disciplines and non college graduates alike. It is not unusual to find software developers who know nothing about big Oh and don't know what bubble sort is, this is a bigger issue than what language they cut their teeth on. A more interesting topic IMHO would be the rampant qualification inflation that has always afflicted this industry such that Masters degree holders are invited to apply for jobs that appear to have a genuine educational requirement that could be met in a well structured associate degree programme. From eli at barzilay.org Wed Jul 29 12:08:28 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jul 29 12:08:51 2009 Subject: [plt-scheme] Is packages installation portable? In-Reply-To: <932b2f1f0907290904h2f9b65f7w16c6acae6d66c364@mail.gmail.com> References: <9bd8a08a0907290739h6aa2c596p4f5dc498670e08ee@mail.gmail.com> <932b2f1f0907290745j6998171bl2650489e408056bf@mail.gmail.com> <9bd8a08a0907290858j78824d1bj913739af0b6e8c79@mail.gmail.com> <932b2f1f0907290904h2f9b65f7w16c6acae6d66c364@mail.gmail.com> Message-ID: <19056.29692.103394.776051@winooski.ccs.neu.edu> On Jul 29, Robby Findler wrote: > Not in general. > > If you're setting up multiple machines in a cluster that are all the > same, you could install one and clone them onto the others, perhaps. > But the .plt file is the way we've designed it to work. > > Perhaps if we knew more about your setup and why you'd want to do > this? It should also be generally fine if you don't install any planet packages that compile C files or include system information in macro-expanded code etc. The thing is that the Scheme bytecode files (*.zo) are portable, but if you have some macro that expands in some platform specific way, then the bytecode file will contain the results of that expansion. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From robby at eecs.northwestern.edu Wed Jul 29 12:10:06 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Jul 29 12:10:28 2009 Subject: [plt-scheme] Is packages installation portable? In-Reply-To: <19056.29692.103394.776051@winooski.ccs.neu.edu> References: <9bd8a08a0907290739h6aa2c596p4f5dc498670e08ee@mail.gmail.com> <932b2f1f0907290745j6998171bl2650489e408056bf@mail.gmail.com> <9bd8a08a0907290858j78824d1bj913739af0b6e8c79@mail.gmail.com> <932b2f1f0907290904h2f9b65f7w16c6acae6d66c364@mail.gmail.com> <19056.29692.103394.776051@winooski.ccs.neu.edu> Message-ID: <932b2f1f0907290910ncd28729lc7bdac808c83b10b@mail.gmail.com> On Wed, Jul 29, 2009 at 11:08 AM, Eli Barzilay wrote: > On Jul 29, Robby Findler wrote: >> Not in general. >> >> If you're setting up multiple machines in a cluster that are all the >> same, you could install one and clone them onto the others, perhaps. >> But the .plt file is the way we've designed it to work. >> >> Perhaps if we knew more about your setup and why you'd want to do >> this? > > It should also be generally fine if you don't install any planet > packages that compile C files or include system information in > macro-expanded code etc. > > The thing is that the Scheme bytecode files (*.zo) are portable, but > if you have some macro that expands in some platform specific way, > then the bytecode file will contain the results of that expansion. Also, I think that Bloch's planet packages do some fancy stuff that is neither of those things, but that does require per-machine .plt-level installation. Robby From eli at barzilay.org Wed Jul 29 12:14:09 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jul 29 12:14:32 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: <932b2f1f0907290620x1cd368b9sd042d3382114c026@mail.gmail.com> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> <4072c51f0907290513ra45b00et82fba93c3e09986a@mail.gmail.com> <20090729121957.GF14493@mail.mac.com> <19056.16420.934421.837123@winooski.ccs.neu.edu> <20090729125020.GG14493@mail.mac.com> <932b2f1f0907290620x1cd368b9sd042d3382114c026@mail.gmail.com> Message-ID: <19056.30033.657822.679466@winooski.ccs.neu.edu> Sorry to contribute another post on this, but just to clarify: On Jul 29, Robby Findler wrote: > On Wed, Jul 29, 2009 at 7:50 AM, Mike Eggleston wrote: > > > > Not bogus for me. I perform this type of debugging often on > > production systems. I like to know I have made no changes to a > > system I'm trying to find the error in, that I've not introduced > > another issue by changing the code to add printf()s (stdout or > > file). What I described had nothing to do with Scheme, it was a C++ project on Windows. But in general my point was that Robby's comment: > No to belabor the obvious here, but debuggers change the behavior of > your program (perhaps even more than printfs, depending on what > you're doing). is wrong in using "perhaps". Debuggers (including the one that I used and the one in PLT) always change code in a way that is much more intense than adding some printfs. So an argument in favor of a debugger of adding some printouts because you want to avoid the printouts from modifying your program is bogus as printouts are less likely to do so. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From eli at barzilay.org Wed Jul 29 12:17:15 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jul 29 12:17:37 2009 Subject: [plt-scheme] Is packages installation portable? In-Reply-To: <932b2f1f0907290910ncd28729lc7bdac808c83b10b@mail.gmail.com> References: <9bd8a08a0907290739h6aa2c596p4f5dc498670e08ee@mail.gmail.com> <932b2f1f0907290745j6998171bl2650489e408056bf@mail.gmail.com> <9bd8a08a0907290858j78824d1bj913739af0b6e8c79@mail.gmail.com> <932b2f1f0907290904h2f9b65f7w16c6acae6d66c364@mail.gmail.com> <19056.29692.103394.776051@winooski.ccs.neu.edu> <932b2f1f0907290910ncd28729lc7bdac808c83b10b@mail.gmail.com> Message-ID: <19056.30219.712614.525237@winooski.ccs.neu.edu> On Jul 29, Robby Findler wrote: > On Wed, Jul 29, 2009 at 11:08 AM, Eli Barzilay wrote: > > > > It should also be generally fine if you don't install any planet > > packages that compile C files or include system information in > > macro-expanded code etc. > > > > The thing is that the Scheme bytecode files (*.zo) are portable, > > but if you have some macro that expands in some platform specific > > way, then the bytecode file will contain the results of that > > expansion. > > Also, I think that Bloch's planet packages do some fancy stuff that > is neither of those things, but that does require per-machine > .plt-level installation. Is his package involved? If so then (IIRC) it sets up stuff in your local collection tree, which means that the archive that you move to the other machine should include the whole user-local directory, not just the planet subdir. BTW, to easily find where the directory is located on any platform, evaluate this: (find-system-path 'addon-dir) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From ghcooper at gmail.com Wed Jul 29 12:20:45 2009 From: ghcooper at gmail.com (Gregory Cooper) Date: Wed Jul 29 12:21:12 2009 Subject: [plt-scheme] debugging [mini rant] In-Reply-To: References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> <4072c51f0907290513ra45b00et82fba93c3e09986a@mail.gmail.com> <20090729121957.GF14493@mail.mac.com> <9bd8a08a0907290532p597ec463mcb59b4e8d4e8ce63@mail.gmail.com> <65e1d50c0907290748o333b5ae2v7b0efae26940600@mail.gmail.com> <9bd8a08a0907290759i62558ecdqe3df41436ba4e877@mail.gmail.com> Message-ID: <65e1d50c0907290920o51eaeb07v87a13738d81a288d@mail.gmail.com> You may also want to look at the implementation of the graphical debugger (in collects/gui-debugger), since a fair amount of the code may be reusable with little or no modification, including the stack frame representation (marks.ss), annotator (annotator.ss), and load handler (load-sandbox.ss). There's no external documentation for this, but the GUI (debug-tool.ss) exercises it thoroughly, and I can help if you get stuck. Greg On Wed, Jul 29, 2009 at 8:12 AM, Noel Welsh wrote: > On Wed, Jul 29, 2009 at 3:59 PM, Elena Garrulo wrote: >> 2009/7/29 Gregory Cooper : >> Could you provide some link, please? I have not found any reference in PLT docs. > > Search for "syntax properties" and "continuation marks". > > N. > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From eli at barzilay.org Wed Jul 29 12:39:04 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jul 29 12:39:27 2009 Subject: [plt-scheme] questions about graphical debugger In-Reply-To: <65e1d50c0907290800v55a97344xd226bb23e9e45167@mail.gmail.com> References: <65e1d50c0907290800v55a97344xd226bb23e9e45167@mail.gmail.com> Message-ID: <19056.31528.297543.995976@winooski.ccs.neu.edu> On Jul 29, Gregory Cooper wrote: > I suspect you're using a language level that does some implicit > expansion of your code before evaluation. The debugger steps > through the expanded code (whose semantics are somewhat different), > and attempts to map the state of the evaluator back to the original > source. The issue of # for top-level expressions has come up > before, and I'm not sure why it can't be fixed. (Eli?) Reading the original message, it looks like the problem is that all toplevel expressions in the `scheme' (and `scheme/base') languages are wrapped in a print'expression, so you see the result of that instead of the result of evaluation. I don't know much about the annotations that the debugger is using, but reporting the voids is clearly not a good feature. Matthew: maybe it's better to have those wrappers print the value and also return it? It seems to me harmless to do that. > If you run it in, for example, Pretty Big, I think the results will > be more in line with your expectations. Using pretty big should be strongly discouraged. It's a legacy language, and now that we've spent some considerable time in v4, it's getting farther away from current code. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From grettke at acm.org Wed Jul 29 12:36:45 2009 From: grettke at acm.org (Grant Rettke) Date: Wed Jul 29 12:44:26 2009 Subject: [plt-scheme] Re: Some dissing of Scheme In-Reply-To: References: <904774730907260511t3cb95653vb430ad532c3c1bca@mail.gmail.com> Message-ID: <756daca50907290936o61b2379s9df971e05b3683e6@mail.gmail.com> On Wed, Jul 29, 2009 at 10:26 AM, wooks wrote: > A more interesting topic IMHO would be the rampant qualification > inflation that has always afflicted this industry such that Masters > degree holders are invited to apply for jobs that appear to have a > genuine educational requirement that could be met in a well structured > associate degree programme. Please point us at those jobs. In the market where I work education doesn't count for anything. From robby at eecs.northwestern.edu Wed Jul 29 12:38:55 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Jul 29 12:45:42 2009 Subject: [plt-scheme] unhighlighting previously highlighted ranges In-Reply-To: <4A70660A.8090404@cs.bilgi.edu.tr> References: <4A70660A.8090404@cs.bilgi.edu.tr> Message-ID: <932b2f1f0907290938h2cf46972vc3e0a727f3cbd468@mail.gmail.com> For now, you have to call unhighlight-range with the same arguments you passed to highlight-range, or call the thunk that highlight-range returns. I've added exports for the range accessors to the framework in SVN (but only on a branch for now, I'm sorry to say. Hopefully I'll be able to merge it in soon). Robby 2009/7/29 "M. Fatih K?ksal" : > Hi, > > I'm trying to unhighlight previously highlighted ranges in a > color:text%. What would be the appropriate way of doing it? > > There is the "get-highlighted-ranges" method, which returns (listof > range). However, I couldn't process the returned range structure. It's > defined as; > > (define-struct range (start end caret-space? style color) #:inspector #f) > > in ./framework/private/text.ss, but, it's not provided. > > M. Fatih K?ksal > ?stanbul Bilgi University > Department of Computer Science > > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From noelwelsh at gmail.com Wed Jul 29 12:49:58 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Wed Jul 29 12:50:22 2009 Subject: [plt-scheme] Re: Some dissing of Scheme In-Reply-To: <756daca50907290936o61b2379s9df971e05b3683e6@mail.gmail.com> References: <904774730907260511t3cb95653vb430ad532c3c1bca@mail.gmail.com> <756daca50907290936o61b2379s9df971e05b3683e6@mail.gmail.com> Message-ID: If you work in the education sector, they tend to care about education :) N. On Wed, Jul 29, 2009 at 5:36 PM, Grant Rettke wrote: > Please point us at those jobs. In the market where I work education > doesn't count for anything. > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From mflatt at cs.utah.edu Wed Jul 29 13:40:04 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Wed Jul 29 13:40:26 2009 Subject: [plt-scheme] questions about graphical debugger In-Reply-To: <19056.31528.297543.995976@winooski.ccs.neu.edu> References: <65e1d50c0907290800v55a97344xd226bb23e9e45167@mail.gmail.com> <19056.31528.297543.995976@winooski.ccs.neu.edu> Message-ID: <20090729174006.B48AA65011D@mail-svr1.cs.utah.edu> At Wed, 29 Jul 2009 12:39:04 -0400, Eli Barzilay wrote: > Matthew: maybe it's better to have those wrappers print the value and > also return it? Done. From lists.amitsaha at gmail.com Wed Jul 29 14:16:04 2009 From: lists.amitsaha at gmail.com (Amit Saha) Date: Wed Jul 29 14:16:49 2009 Subject: [plt-scheme] Guessing the file type? In-Reply-To: <4A6DC399.5090902@gmail.com> References: <4A6C5095.1080001@gmail.com> <4A6C5547.1090607@gmail.com> <4A6C78DC.3000001@gmail.com> <4A6D24EF.2060400@gmail.com> <20090727142307.74c86a85@halmanfloyd.lan.local> <4A6DC399.5090902@gmail.com> Message-ID: <4A7091E4.6090003@gmail.com> Amit Saha wrote: > Marek Kubica wrote: >> Hi, >> >> On Mon, 27 Jul 2009 09:24:23 +0530 >> Amit Saha wrote: >> >>> Great. On my Ubuntu Linux: >>> >>> > ((make-path->mime-type "/etc/mime.types") (build-path >>> "/home/r00t/Music/" "m.mp3")) >>> #"audio/mpeg" >>> >>> does it. >>> >>> Now wondering: How would I go about writing code, such as this- to >>> work on Linux as well as say, a Mac OSX ? >> >> By checking for the OS and setting the path to the MIME Database >> accordingly. The biggest problem I see would be Windows, which as far >> as I know does not have such a file at all. > > I took a cursory look at "mimetypes.py" > (http://svn.python.org/view/python/trunk/Lib/mimetypes.py?revision=72045&view=markup) > - a Python module which acts as a interface with the OS MIME types. > From what I see, it has the list of "known files" into which it looks > into for the OS recogniezed MIME types.. Another way would be to eliminate the dependency on the OS's files completely, by maintaining a map of the file extensions to the MIME type, like http://bazaar.launchpad.net/%7Evijay-the-schemer/spark-scheme/devel/annotate/head%3A/scheme/http/mime-types.ss Is there a limitation to this approach, except for keeping it updated? An obvious benefit is that this approach won't be dependent on the differences between Unix-es and non-Unix. Best, Amit > > I will try to look into implementing such a solution for plt-scheme.. > > Best, > Amit >> >> regards, >> Marek >> > > -- email: amitsaha.in@gmail.com Journal: http://amitksaha.wordpress.com ?-blog: http://twitter.com/amitsaha IRC: cornucopic on #scheme, #lisp, #math, #linux From amoebae at gmail.com Wed Jul 29 15:13:21 2009 From: amoebae at gmail.com (David Banks) Date: Wed Jul 29 15:21:22 2009 Subject: [plt-scheme] Out of memory during 'make install' Message-ID: <5e058eb50907291213i7a90476fq72f473cf4f3a127a@mail.gmail.com> Hi all, I am trying to compile PLT 4.2 on a NetBSD machine. It has very little RAM, so I added a gigabyte of swap (I don't care how long the compilation takes). I'm hitting an out of memory issue during the 'make install' phase, but there's still a lot of swap left. Is there any way to increase the soft limit that PLT seems to be using during the install step? The error I get is below: setup-plt: making: scribblings/framework setup-plt: in scribblings/framework PLT Scheme virtual machine has run out of memory; aborting [1] Abort trap (core dumped) mzscheme/mzschem... gmake[1]: *** [install-3m] Error 134 gmake[1]: Leaving directory `/home/amoe/plt-4.2/src/build' gmake: *** [install] Error 2 My commands to compile are: ./configure --prefix=/usr/local --enable-shared --disable-mred gmake gmake install Can anyone help me? Thanks in advance, -- David Banks From robby at eecs.northwestern.edu Wed Jul 29 15:29:02 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Jul 29 15:29:20 2009 Subject: [BULK] Re: [plt-scheme] Is packages installation portable? In-Reply-To: <6D1EEE8C-2E51-4D87-BDB1-BA99FF940B57@adelphi.edu> References: <9bd8a08a0907290739h6aa2c596p4f5dc498670e08ee@mail.gmail.com> <932b2f1f0907290745j6998171bl2650489e408056bf@mail.gmail.com> <9bd8a08a0907290858j78824d1bj913739af0b6e8c79@mail.gmail.com> <932b2f1f0907290904h2f9b65f7w16c6acae6d66c364@mail.gmail.com> <19056.29692.103394.776051@winooski.ccs.neu.edu> <932b2f1f0907290910ncd28729lc7bdac808c83b10b@mail.gmail.com> <6D1EEE8C-2E51-4D87-BDB1-BA99FF940B57@adelphi.edu> Message-ID: <932b2f1f0907291229o21d2dba1p2af94c4618ecaf76@mail.gmail.com> This message was intended for the mailing list. Robby On Wed, Jul 29, 2009 at 11:16 AM, Stephen Bloch wrote: > > On Jul 29, 2009, at 12:10 PM, Robby Findler wrote: > >>> The thing is that the Scheme bytecode files (*.zo) are portable, but >>> if you have some macro that expands in some platform specific way, >>> then the bytecode file will contain the results of that expansion. >> >> Also, I think that Bloch's planet packages do some fancy stuff that is >> neither of those things, but that does require per-machine .plt-level >> installation. > > On first "require"-ing the packages, they not only get installed in the > PLaneT cache (like any other PLaneT package) but they also write a short > file to the "installed-teachpacks" folder. ?If the "installed-teachpacks" > folder is in the same place on two different machines, it should be safe to > just copy the relevant file hierarchies from one to another. ?For example, > two MacOS machines, two Windows XX machines (where XX is the same for both), > etc. > > > Stephen Bloch > sbloch@adelphi.edu > > > > From egarrulo at gmail.com Wed Jul 29 15:42:44 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Wed Jul 29 15:43:05 2009 Subject: [plt-scheme] Is packages installation portable? In-Reply-To: <932b2f1f0907290904h2f9b65f7w16c6acae6d66c364@mail.gmail.com> References: <9bd8a08a0907290739h6aa2c596p4f5dc498670e08ee@mail.gmail.com> <932b2f1f0907290745j6998171bl2650489e408056bf@mail.gmail.com> <9bd8a08a0907290858j78824d1bj913739af0b6e8c79@mail.gmail.com> <932b2f1f0907290904h2f9b65f7w16c6acae6d66c364@mail.gmail.com> Message-ID: <9bd8a08a0907291242n2b0a373y210de63b05b4362e@mail.gmail.com> 2009/7/29 Robby Findler : > Perhaps if we knew more about your setup and why you'd want to do this? I'm replacing perl scripts called during builds with mzscheme scripts. I'd prefer not messing with build machines (all Windows), therefore currently I've just copied over PLT Scheme installation folder and I was wondering if just copying required additional libraries' folders too would have been fine. At least, now I know it can be done and it could work in most cases. Thanks to everyone for your kind advice. From eli at barzilay.org Wed Jul 29 16:37:47 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Jul 29 16:38:08 2009 Subject: [plt-scheme] Minor scribble reader change Message-ID: <19056.45851.736721.522230@winooski.ccs.neu.edu> In svn I have changed the scribble reader a little. Before the change, @list{... @foo@bar ...} --reads-as--> (list "... " foo bar " ...") This was asymmetric to: (list @foo@bar) --reads-as--> (list foo@bar) So after the change that I committed: @list{... @foo@bar ...} --reads-as--> (list "... " foo@bar " ...") The bottom line is that if you had something like this in your documentation: blah blah @x@y blah blah then you now need to use either: blah blah @|x|@y blah blah or even better: blah blah @|x y| blah blah FWIW, I found this regexp pattern: @[a-z0-9A-Z!%^&*_+=.<>/?-]+@ useful in finding places that need to be fixed. (And I did fix all occurrences in the PLT tree, and verified that I covered everything using `read' before and after the change on all files, and then I compared the results.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From marek at xivilization.net Wed Jul 29 19:07:00 2009 From: marek at xivilization.net (Marek Kubica) Date: Wed Jul 29 19:07:23 2009 Subject: [plt-scheme] Some more usability issues In-Reply-To: <932b2f1f0907250523u6bf99287r5d89cd2934f89bbf@mail.gmail.com> References: <20090718151312.01a25726@halmanfloyd.lan.local> <20090721190749.360980b1@halmanfloyd.lan.local> <932b2f1f0907232202s735462d2wd6d25e3b67574f66@mail.gmail.com> <20090725123449.29827995@halmanfloyd.lan.local> <932b2f1f0907250523u6bf99287r5d89cd2934f89bbf@mail.gmail.com> Message-ID: <20090730010700.6a031672@halmanfloyd.lan.local> On Sat, 25 Jul 2009 07:23:20 -0500 Robby Findler wrote: > On Sat, Jul 25, 2009 at 5:34 AM, Marek Kubica > wrote: > > Do you have any plans regarding the scalability of the debugger > > widgets? > > I do not personally, no. But someone who maintains it might. Patches, > as always, are welcome. May I ask who that is currently? Fortunately, 4.2 made contribution to the editor easier, since I heard that much code was moved to Scheme. I'll have a look at the code. regards, Marek From rmathews at gmail.com Thu Jul 30 00:57:40 2009 From: rmathews at gmail.com (Roshan Mathews) Date: Thu Jul 30 01:04:25 2009 Subject: [plt-scheme] Startup Problem Message-ID: <1c4dc2780907292157j1c7f7006n6e19d95237c29e3f@mail.gmail.com> I have PLT-Scheme (plt-4.1.5-bin-i386-win32) on Windows (Vista). When I start it it, it opens a "Standard Output" window, with this message: draw-bitmap in dc<%>: expected argument of type ; given #f === context === E:\Program Files\PLT\collects\drscheme\private\drscheme-normal.ss:208:15 DrScheme was working before this came up, if that helps. This happened even after I reinstalled it, so maybe there is something left behind after an uninstall that I must remove? I even upgraded to plt-4.2-bin-i386-win32 and the problem remained, so what stays between installations? Registry entries? Any help would be appreciated. Regards, Roshan Mathews From robby at eecs.northwestern.edu Thu Jul 30 01:19:37 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Jul 30 01:20:00 2009 Subject: [plt-scheme] Startup Problem In-Reply-To: <1c4dc2780907292157j1c7f7006n6e19d95237c29e3f@mail.gmail.com> References: <1c4dc2780907292157j1c7f7006n6e19d95237c29e3f@mail.gmail.com> Message-ID: <932b2f1f0907292219u4bbe36b8y274bf6d8035ad598@mail.gmail.com> This is a bug in an easter egg (argh). You can fix it by either changing your date to anything besides july 30th, or by changing the definition of on-paint in the definition of splash-canvas% in collects/framework/splash.ss to this: (define/override (on-paint) (when splash-cache-bitmap (send (get-dc) draw-bitmap splash-cache-bitmap 0 0))) or by getting the latest in SVN. Apologies, Robby PS: Happy birthday, Eli! On Wed, Jul 29, 2009 at 11:57 PM, Roshan Mathews wrote: > I have PLT-Scheme (plt-4.1.5-bin-i386-win32) on Windows (Vista). > > When I start it it, it opens a "Standard Output" window, with this message: > > ? ?draw-bitmap in dc<%>: expected argument of type ; given #f > > ? ? === context === > ? ?E:\Program Files\PLT\collects\drscheme\private\drscheme-normal.ss:208:15 > > DrScheme was working before this came up, if that helps. > > This happened even after I reinstalled it, so maybe there is something > left behind after an uninstall that I must remove? > > I even upgraded to plt-4.2-bin-i386-win32 and the problem remained, so > what stays between installations? ?Registry entries? > > Any help would be appreciated. > > Regards, > Roshan Mathews > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From con.amalgamate at gmail.com Thu Jul 30 00:51:41 2009 From: con.amalgamate at gmail.com (Simon Haines) Date: Thu Jul 30 01:25:14 2009 Subject: [plt-scheme] DrScheme startup error (Windows) Message-ID: <74a189d5-a798-40ab-aaf7-2a7ef29c9582@u38g2000pro.googlegroups.com> Hi there, I just kicked off DrScheme (4.2/Win32) today and have been greeted with the following error: draw-bitmap in dc<%>: expected argument of type ; given #f === context === C:\Program Files\PLT\collects\drscheme\private\drscheme-normal.ss: 208:15 Curiously, the line of the mentioned file doesn't seem in any way related to a draw-bitmap call. I've had a hunt around and could find no information on this, and I've reinstalled just in case a bitmap or some such file was corrupted, but no luck. Any ideas? Much appreciated, Simon. From rmathews at gmail.com Thu Jul 30 01:32:23 2009 From: rmathews at gmail.com (Roshan Mathews) Date: Thu Jul 30 01:32:41 2009 Subject: [plt-scheme] Startup Problem In-Reply-To: <932b2f1f0907292219u4bbe36b8y274bf6d8035ad598@mail.gmail.com> References: <1c4dc2780907292157j1c7f7006n6e19d95237c29e3f@mail.gmail.com> <932b2f1f0907292219u4bbe36b8y274bf6d8035ad598@mail.gmail.com> Message-ID: <1c4dc2780907292232m2c850ddfm1d446e48ba948d46@mail.gmail.com> On Thu, Jul 30, 2009 at 10:49 AM, Robby Findler wrote: > This is a bug in an easter egg (argh). > > You can fix it by either changing your date to anything besides july > 30th, or by changing the definition of on-paint in the definition of > splash-canvas% in collects/framework/splash.ss to this: > > (define/override (on-paint) (when splash-cache-bitmap (send > (get-dc) draw-bitmap splash-cache-bitmap 0 0))) > > or by getting the latest in SVN. > > Apologies, > Robby > > PS: Happy birthday, Eli! > Oh, alright. Thanks for your time. :) Roshan From robby at eecs.northwestern.edu Thu Jul 30 01:34:02 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Jul 30 01:34:24 2009 Subject: [plt-scheme] DrScheme startup error (Windows) In-Reply-To: <74a189d5-a798-40ab-aaf7-2a7ef29c9582@u38g2000pro.googlegroups.com> References: <74a189d5-a798-40ab-aaf7-2a7ef29c9582@u38g2000pro.googlegroups.com> Message-ID: <932b2f1f0907292234k3736e019idb00fb67d8c6b6b8@mail.gmail.com> Strangely enough, I got the second message about this in my inbox before the first one. But anyways, here's one answer: http://list.cs.brown.edu/pipermail/plt-scheme/2009-July/034843.html Robby On Wed, Jul 29, 2009 at 11:51 PM, Simon Haines wrote: > Hi there, I just kicked off DrScheme (4.2/Win32) today and have been > greeted with the following error: > > draw-bitmap in dc<%>: expected argument of type ; > given #f > > ?=== context === > C:\Program Files\PLT\collects\drscheme\private\drscheme-normal.ss: > 208:15 > > Curiously, the line of the mentioned file doesn't seem in any way > related to a draw-bitmap call. I've had a hunt around and could find > no information on this, and I've reinstalled just in case a bitmap or > some such file was corrupted, but no luck. > > Any ideas? Much appreciated, > Simon. > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From robby at eecs.northwestern.edu Thu Jul 30 01:39:38 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Jul 30 01:40:23 2009 Subject: [plt-scheme] Automatic compilation for drscheme's Module language Message-ID: <932b2f1f0907292239i4069f0f1h4e088c2ee2c57c8@mail.gmail.com> [ The below is not in the upcoming 4.2.1 release, but will be in the one after. ] A few minor organs in DrScheme's Module language's intestines have been rearranged [1] with the overall change that hitting "Run" while in the module language should both be faster and have less stacktrace information, i.e., per-function instead of per-subexpression (which should still be plenty for most purposes). The speedup comes from two changes: DrScheme now keeps up to date .zo files in compiled/ directories whenever a program is run and the errortrace library is not being used anymore (by default). To keep it from being too fast, tho, DrScheme instructs the JIT not to perform function inlining, with the additional benefit that the stacktraces should match what you'd expect [3] by looking at the program text. All of this can be changed (to bring back the old behavior) in the new details section of the language dialog. Robby [1] Yes, exactly like that: http://wiki.lspace.org/wiki/Swamp_dragon [2] For now, use Eli's profiler instead of DrScheme's anyways. Hopefully DrScheme will change at some point to use it too. [3] Assuming you expect that tail calls won't show up. From curtdutt at gmail.com Thu Jul 30 01:27:11 2009 From: curtdutt at gmail.com (Curtis Dutton) Date: Thu Jul 30 01:40:29 2009 Subject: [plt-scheme] Re: Startup Problem In-Reply-To: <932b2f1f0907292219u4bbe36b8y274bf6d8035ad598@mail.gmail.com> References: <1c4dc2780907292157j1c7f7006n6e19d95237c29e3f@mail.gmail.com> <932b2f1f0907292219u4bbe36b8y274bf6d8035ad598@mail.gmail.com> Message-ID: <84ca20d0-98cd-492c-bb90-6aad4761836a@k30g2000yqf.googlegroups.com> Ha I hit this too. I used synaptics to remove and reinstall plt scheme. The reinstall was for 4.1.something. I did get to see the easter egg on startup of drscheme. I then reinstalled latest and got the same issue. See you all tomorrow ;-) -Curt On Jul 30, 1:19?am, Robby Findler wrote: > This is a bug in an easter egg (argh). > > You can fix it by either changing your date to anything besides july > 30th, or by changing the definition of on-paint in the definition of > splash-canvas% in collects/framework/splash.ss to this: > > ? ?(define/override (on-paint) (when splash-cache-bitmap (send > (get-dc) draw-bitmap splash-cache-bitmap 0 0))) > > or by getting the latest in SVN. > > Apologies, > Robby > > PS: Happy birthday, Eli! > > > > On Wed, Jul 29, 2009 at 11:57 PM, Roshan Mathews wrote: > > I have PLT-Scheme (plt-4.1.5-bin-i386-win32) on Windows (Vista). > > > When I start it it, it opens a "Standard Output" window, with this message: > > > ? ?draw-bitmap in dc<%>: expected argument of type ; given #f > > > ? ? === context === > > ? ?E:\Program Files\PLT\collects\drscheme\private\drscheme-normal.ss:208:15 > > > DrScheme was working before this came up, if that helps. > > > This happened even after I reinstalled it, so maybe there is something > > left behind after an uninstall that I must remove? > > > I even upgraded to plt-4.2-bin-i386-win32 and the problem remained, so > > what stays between installations? ?Registry entries? > > > Any help would be appreciated. > > > Regards, > > Roshan Mathews > > _________________________________________________ > > ?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 con.amalgamate at gmail.com Thu Jul 30 00:59:23 2009 From: con.amalgamate at gmail.com (Simon Haines) Date: Thu Jul 30 01:42:49 2009 Subject: [plt-scheme] DrScheme startup error (Windows) Message-ID: Hi there, I just kicked off DrScheme (4.2/Win32) today and have been greeted with the following error: draw-bitmap in dc<%>: expected argument of type ; given #f === context === C:\Program Files\PLT\collects\drscheme\private\drscheme-normal.ss: 208:15 I've had a hunt around and could find no information on this, and I've reinstalled just in case a bitmap or some such file was corrupted, but no luck. Any ideas? Much appreciated, Simon. From spamme at innerpaths.net Thu Jul 30 01:33:23 2009 From: spamme at innerpaths.net (Gregg Williams) Date: Thu Jul 30 01:43:59 2009 Subject: [plt-scheme] can't connect to PLaneT on Windows XP machine Message-ID: <90d1a0cc-7d15-48ff-8916-672b0cf243df@z4g2000prh.googlegroups.com> I'm trying to get PLT Scheme to work on a Windows XP machine, and I can't add needed modules from PLaneT. When I do so in the customary way, I get the following error: --- require: PLaneT could not download the requested package: tcp-connect: connection to planet.plt-scheme.org, port 80 failed (at step 4: An operation was attempted on something that is not a socket.; errno= 10038) in: (planet lizorkin/ssax:2:0/ssax) --- I've looked both on the web and on this mailing list and didn't find anything useful. I did however learn from one page to check to see whether port 80 is being used by other software. I checked, using the Windows command-line utility netstat, which showed no sign of any "active connection" using port 80. I also consulted Internet web pages telling me how to open port 80, as well as checking my antivirus software for possible conflicts; neither of these helped. Anybody got any ideas? Thanks. From rafkind at cs.utah.edu Thu Jul 30 01:46:55 2009 From: rafkind at cs.utah.edu (Jon Rafkind) Date: Thu Jul 30 01:47:19 2009 Subject: [plt-scheme] can't connect to PLaneT on Windows XP machine In-Reply-To: <90d1a0cc-7d15-48ff-8916-672b0cf243df@z4g2000prh.googlegroups.com> References: <90d1a0cc-7d15-48ff-8916-672b0cf243df@z4g2000prh.googlegroups.com> Message-ID: <4A7133CF.4020206@cs.utah.edu> Gregg Williams wrote: > I'm trying to get PLT Scheme to work on a Windows XP machine, and I > can't add needed modules from PLaneT. When I do so in the customary > way, I get the following error: > > --- > require: PLaneT could not download the requested package: tcp-connect: > connection to planet.plt-scheme.org, port 80 failed (at step 4: An > operation was attempted on something that is not a socket.; errno= > 10038) in: (planet lizorkin/ssax:2:0/ssax) > --- > > Looks like its saying your local PLT client could not connect to the remote Planet server. I just checked (via telnet) and I can connect just fine. Maybe its just a transient error? How many times did you try to connect? Actually the error looks slightly more serious, what version of PLT are you using? From egarrulo at gmail.com Thu Jul 30 06:17:31 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Thu Jul 30 06:17:54 2009 Subject: [plt-scheme] DrScheme startup error (Windows) In-Reply-To: References: Message-ID: <9bd8a08a0907300317m21e4827fr931293be3d1f833e@mail.gmail.com> Same here. What could I say? I hate you guys! ;-) Happy birthday. 2009/7/30 Simon Haines : > Hi there, I just kicked off DrScheme (4.2/Win32) today and have been > greeted with the following error: > > draw-bitmap in dc<%>: expected argument of type ; > given #f > > ?=== context === > C:\Program Files\PLT\collects\drscheme\private\drscheme-normal.ss: > 208:15 > > I've had a hunt around and could find no information on this, and I've > reinstalled just in case a bitmap or some such file was corrupted, but > no luck. > > Any ideas? Much appreciated, > Simon. > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From egarrulo at gmail.com Thu Jul 30 06:41:45 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Thu Jul 30 06:42:04 2009 Subject: [plt-scheme] Windows: "Check for updates..." not working behind proxy? Message-ID: <9bd8a08a0907300341oa9cb6c7v421c94bee2be2f5a@mail.gmail.com> Hello, checking for updates does not work. I connect to Internet through a proxy: could be this the issue? Anyway, I've configured the proxy into Preferences, and requiring Planet packages works. I'm running Windows XP SP3. The error message says: "Error could not connect to website. (tcp-connect connection to download.plt-scheme.org port 80 failed (at step 6: [italian message translation: Unable to establish connection. Wrong reply or no reply from remote host.] errno=10060))" Thanks. From eli at barzilay.org Thu Jul 30 08:06:37 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Jul 30 08:07:11 2009 Subject: [plt-scheme] PLT Scheme v4.2.1 Message-ID: PLT Scheme version 4.2.1 is now available from http://plt-scheme.org/ * This is the last release that includes ProfessorJ. As of the next release, Kathy Gray who created and maintained the Professor will move the code to planet and maintain only at a minimal level. * Typed Scheme 2.0 extends the type system significantly, making it more expressive. For example, predicates applied to selectors, such as (number? (car x)), are meaningful to the type system. * Faster installation of Planet packages that trigger install of other Planet packages, because the documentation index is updated only once after a group of packages is installed. * The `syntax/parse' library provides macro writers with an enhanced syntax pattern matcher that reports errors based on the patterns' declared classes of syntax. * Identifier mappings following the v4 dictionary interface and naming conventions are available from the `syntax/id-table' library. * Redex: added `define-relation' and generalized patterns that appear in "where" clauses to use the full Redex pattern matcher. (This is a backwards incompatible change, but one often requested; see the Redex release notes for details.) * The Web Server's serializable closures are now available for other purposes through the web-server/lang/serial-lambda library. * Teachpacks: small changes to universe portion of the "universe.ss" API, plus the addition of a form for launching many (communicating) worlds simultaneously. Bug fixes concerning conversion to strings. * It is now possible to create custom scribble readers with a command characters different than `@', see `make-at-reader/inside' and `make-at-reader' * Note: this is likely to be the last release that includes a solaris distribution. If you need these builds, or if you have access to a (Sparc) Solaris machine than can be used in PLT builds, then please let me know. [Note that mirror sites can take a while to catch up with the new downloads.] Feedback Welcome, -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From egarrulo at gmail.com Thu Jul 30 08:48:55 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Thu Jul 30 08:49:14 2009 Subject: [plt-scheme] Windows: Does DrScheme distinguish between Alt and AltGr? Message-ID: <9bd8a08a0907300548h166b00e3i2618d3d9dff2a711@mail.gmail.com> Hello, can I make DrScheme treat AltGr differently than Alt (on Windows)? Thanks. From ebzzry at gmail.com Thu Jul 30 14:23:35 2009 From: ebzzry at gmail.com (Rommel M. Martinez) Date: Thu Jul 30 14:24:19 2009 Subject: [plt-scheme] PLT web servlets form-based authentication Message-ID: <391934950907301123r7e2cdf1fybbd2fc8b5ff83c4a@mail.gmail.com> Are form-based logins for web servlets documented somewhere? If yes, where are they. If not, how should one do them? -- Rommel M. Martinez http://www.bespin.org/~ebzzry From spamme at innerpaths.net Thu Jul 30 14:26:59 2009 From: spamme at innerpaths.net (Gregg Williams) Date: Thu Jul 30 14:27:20 2009 Subject: [plt-scheme] Re: can't connect to PLaneT on Windows XP machine In-Reply-To: <4A7133CF.4020206@cs.utah.edu> References: <90d1a0cc-7d15-48ff-8916-672b0cf243df@z4g2000prh.googlegroups.com> <4A7133CF.4020206@cs.utah.edu> Message-ID: It's been a while since I've been on my Windows machine (I normally use Mac OS X), so it took a while for me to remember to escalate to the time-honored "reboot and see if that helps" strategy. It did--I got a different error message. That experience reminded me to try the next step: reinstall and see if that helps. Once I did that, downloads from PLaneT worked first time. #*@$?#& Windows.... Thanks for checking the server; that hadn't occurred to me. On Jul 29, 10:46?pm, Jon Rafkind wrote: > Gregg Williams wrote: > > I'm trying to get PLT Scheme to work on a Windows XP machine, and I > > can't add needed modules from PLaneT. When I do so in the customary > > way, I get the following error: > > > --- > > require: PLaneT could not download the requested package: tcp-connect: > > connection to planet.plt-scheme.org, port 80 failed (at step 4: An > > operation was attempted on something that is not a socket.; errno= > > 10038) in: (planet lizorkin/ssax:2:0/ssax) > > --- > > Looks like its saying your local PLT client could not connect to the > remote Planet server. I just checked (via telnet) and I can connect just > fine. Maybe its just a transient error? How many times did you try to > connect? > > Actually the error looks slightly more serious, what version of PLT are > you using? > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From m.douglas.williams at gmail.com Thu Jul 30 15:45:39 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Thu Jul 30 15:46:03 2009 Subject: [plt-scheme] Re: can't connect to PLaneT on Windows XP machine In-Reply-To: References: <90d1a0cc-7d15-48ff-8916-672b0cf243df@z4g2000prh.googlegroups.com> <4A7133CF.4020206@cs.utah.edu> Message-ID: I was having the same problem yesterday. I my case it would just hang with no message. Fortunately, it was my own packages I was downloading and I used the command line to install them. But it worked fine today when I had to reload them. Doug On Thu, Jul 30, 2009 at 12:26 PM, Gregg Williams wrote: > It's been a while since I've been on my Windows machine (I normally > use Mac OS X), so it took a while for me to remember to escalate to > the time-honored "reboot and see if that helps" strategy. It did--I > got a different error message. That experience reminded me to try the > next step: reinstall and see if that helps. > > Once I did that, downloads from PLaneT worked first time. #*@$?#& > Windows.... Thanks for checking the server; that hadn't occurred to > me. > > > On Jul 29, 10:46 pm, Jon Rafkind wrote: > > Gregg Williams wrote: > > > I'm trying to get PLT Scheme to work on a Windows XP machine, and I > > > can't add needed modules from PLaneT. When I do so in the customary > > > way, I get the following error: > > > > > --- > > > require: PLaneT could not download the requested package: tcp-connect: > > > connection to planet.plt-scheme.org, port 80 failed (at step 4: An > > > operation was attempted on something that is not a socket.; errno= > > > 10038) in: (planet lizorkin/ssax:2:0/ssax) > > > --- > > > > Looks like its saying your local PLT client could not connect to the > > remote Planet server. I just checked (via telnet) and I can connect just > > fine. Maybe its just a transient error? How many times did you try to > > connect? > > > > Actually the error looks slightly more serious, what version of PLT are > > you using? > > _________________________________________________ > > 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/20090730/68a07fa2/attachment.htm From jay.mccarthy at gmail.com Thu Jul 30 17:27:42 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Jul 30 17:28:05 2009 Subject: [plt-scheme] PLT web servlets form-based authentication In-Reply-To: <391934950907301123r7e2cdf1fybbd2fc8b5ff83c4a@mail.gmail.com> References: <391934950907301123r7e2cdf1fybbd2fc8b5ff83c4a@mail.gmail.com> Message-ID: What do you mean by form-based? Not http://docs.plt-scheme.org/web-server/http.html#(part._basic-auth..ss) right? I would just use a cookie a la the Cookie Eaters -- http://cookies.lcs.mit.edu/ Jay On Thu, Jul 30, 2009 at 12:23 PM, Rommel M. Martinez wrote: > Are form-based logins for web servlets documented somewhere? If yes, > where are they. If not, how should one do them? > > -- > Rommel M. Martinez > http://www.bespin.org/~ebzzry > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From lordgeoffrey at optushome.com.au Fri Jul 31 05:53:28 2009 From: lordgeoffrey at optushome.com.au (LordGeoffrey) Date: Fri Jul 31 05:53:56 2009 Subject: [plt-scheme] hash-ref: no value found for key: profile-point357 Message-ID: <4A72BF18.5000103@optushome.com.au> I get the subject line error message. It doesn't happen consistently, but goes away if i quit DrScheme and restart. I am using tcp-listen & (require rnrs/io/ports-6) (require rnrs/io/simple-6) version 4.2.1.4-svn29jul2009 [3m]. OS: Ubuntu. hash-ref: no value found for key: profile-point357 From robby at eecs.northwestern.edu Fri Jul 31 08:03:38 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Fri Jul 31 08:04:00 2009 Subject: [plt-scheme] hash-ref: no value found for key: profile-point357 In-Reply-To: <4A72BF18.5000103@optushome.com.au> References: <4A72BF18.5000103@optushome.com.au> Message-ID: <932b2f1f0907310503x43369e64j9b09be9184fd9dc9@mail.gmail.com> Are you using the module language? Is it set to the default settings? Robby On Fri, Jul 31, 2009 at 4:53 AM, LordGeoffrey wrote: > I get the subject line error message. It doesn't happen consistently, but > goes away if i quit DrScheme and restart. I am using tcp-listen & > ?(require rnrs/io/ports-6) > ?(require rnrs/io/simple-6) > > version 4.2.1.4-svn29jul2009 [3m]. > OS: Ubuntu. > > hash-ref: no value found for key: profile-point357 > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From lordgeoffrey at optushome.com.au Fri Jul 31 08:40:47 2009 From: lordgeoffrey at optushome.com.au (LordGeoffrey) Date: Fri Jul 31 08:41:20 2009 Subject: [plt-scheme] hash-ref: no value found for key: profile-point357 In-Reply-To: <932b2f1f0907310503x43369e64j9b09be9184fd9dc9@mail.gmail.com> References: <4A72BF18.5000103@optushome.com.au> <932b2f1f0907310503x43369e64j9b09be9184fd9dc9@mail.gmail.com> Message-ID: <4A72E64F.8090900@optushome.com.au> My file starts: (module play-socket-server scheme ... In the status bar it is set to "module custom" Robby Findler wrote: > Are you using the module language? Is it set to the default settings? > > Robby > > On Fri, Jul 31, 2009 at 4:53 AM, > LordGeoffrey wrote: > >> I get the subject line error message. It doesn't happen consistently, but >> goes away if i quit DrScheme and restart. I am using tcp-listen & >> (require rnrs/io/ports-6) >> (require rnrs/io/simple-6) >> >> version 4.2.1.4-svn29jul2009 [3m]. >> OS: Ubuntu. >> >> hash-ref: no value found for key: profile-point357 >> _________________________________________________ >> 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/20090731/2ba92911/attachment.htm From eli at barzilay.org Fri Jul 31 09:53:31 2009 From: eli at barzilay.org (Eli Barzilay) Date: Fri Jul 31 09:53:54 2009 Subject: [plt-scheme] Yesterday's easter egg Message-ID: <19058.63323.88034.625818@winooski.ccs.neu.edu> Thanks for everyone who happy-birthday-ed me -- hopefully more people got to see the nice version of the egg (very nice graphics which Robby made), rather than the error message version... -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From sk at cs.brown.edu Fri Jul 31 10:10:20 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Fri Jul 31 10:10:58 2009 Subject: [plt-scheme] Yesterday's easter egg In-Reply-To: <19058.63323.88034.625818@winooski.ccs.neu.edu> References: <19058.63323.88034.625818@winooski.ccs.neu.edu> Message-ID: Robby should have made the error message be something that, when read backward, was a Scheme program that, when run, printed Eli's name. That would have been truly fitting. Then again, maybe he did. From meunier at ccs.neu.edu Fri Jul 31 12:58:01 2009 From: meunier at ccs.neu.edu (Philippe Meunier) Date: Fri Jul 31 12:58:20 2009 Subject: [plt-scheme] Out of memory during 'make install' In-Reply-To: <5e058eb50907291213i7a90476fq72f473cf4f3a127a@mail.gmail.com> References: <5e058eb50907291213i7a90476fq72f473cf4f3a127a@mail.gmail.com> Message-ID: <20090731165801.GA27633@denali.ccs.neu.edu> David Banks wrote: >I'm hitting an out of memory issue during the >'make install' phase, but there's still a lot of swap left. Is there >any way to increase the soft limit that PLT seems to be using during >the install step? The limit isn't set by PLT Scheme but by your shell and / or operating system. Try to increase the data size limit for the process. See 'limit' or 'ulimit' in your shell's manual page. If that's still not enough, try to increase the data size limit for the user, which is set at login time. See /etc/login.something-or-other or /etc/security/limits.conf (or whatever it is called on your operating system...) and the related manual pages. Philippe From robby at eecs.northwestern.edu Fri Jul 31 14:34:28 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Fri Jul 31 14:34:50 2009 Subject: [plt-scheme] hash-ref: no value found for key: profile-point357 In-Reply-To: <4A72E64F.8090900@optushome.com.au> References: <4A72BF18.5000103@optushome.com.au> <932b2f1f0907310503x43369e64j9b09be9184fd9dc9@mail.gmail.com> <4A72E64F.8090900@optushome.com.au> Message-ID: <932b2f1f0907311134j54333adbm93c21a90823c36c2@mail.gmail.com> I've formed a conjecture as to what was wrong and checked in something that prevents at least one kind of bad behaviour. I'm not sure if that's what you're seeing, tho. To get the same effect as using the new sources, you can click the "revert to language defaults" button in the language dialog (and then change to whatever settings you had afterwards). Otherwise, I think it would be best if you were to send in a PR (hopefully with a way to reproduce the problem, starting from a new drscheme). The bug report form in drscheme picks up a bunch of information about your drscheme that might be helpful in this case. Robby 2009/7/31 LordGeoffrey : > My file starts: > (module play-socket-server scheme > ... > In the status bar it is set to "module custom" > > Robby Findler wrote: > > Are you using the module language? Is it set to the default settings? > > Robby > > On Fri, Jul 31, 2009 at 4:53 AM, > LordGeoffrey wrote: > > > I get the subject line error message. It doesn't happen consistently, but > goes away if i quit DrScheme and restart. I am using tcp-listen & > ?(require rnrs/io/ports-6) > ?(require rnrs/io/simple-6) > > vers