From ontheheap at gmail.com Fri May 1 00:54:30 2009 From: ontheheap at gmail.com (Stephen) Date: Fri May 1 00:54:48 2009 Subject: [plt-scheme] Re: HTDP Exercise 12.4.2 ... Help! In-Reply-To: <9EADDF5E-6BE5-4A10-81B3-1F14CDE6E711@adelphi.edu> References: <89bb27db-ca51-4c5a-ab2b-3cc76ba05af9@d19g2000prh.googlegroups.com> <9EADDF5E-6BE5-4A10-81B3-1F14CDE6E711@adelphi.edu> Message-ID: I'm still trying to understand exactly how this helps me: (cond ((empty? a-word) (list (list a-letter))) (else ; a-letter symbol 'x ; a-word los (list 'a 'b 'c 'd) ; (first a-word) symbol 'a ; (rest a-word) los (list 'b 'c 'd) ; (insert-everywhere a-letter (rest a-word)) lolos (list (list 'x 'b 'c 'd) (list 'b 'x 'c 'd) (list 'b 'c 'x 'd) (list 'b 'c 'd 'x)) ; right answer lolos (list (list 'x 'a 'b 'c 'd) (list 'a 'x 'b 'c 'd) (list 'a 'b 'x 'c 'd) (list 'a 'b 'c 'x 'd) (list 'a 'b 'c ' d 'x)) ))) I see how when (rest a-word) is (list 'b 'c d), that (insert-everywhere a-letter (rest a-word)) is (list (list 'x 'b 'c 'd) (list 'b 'x 'c 'd) etc...), because this is what I've defined the function insert-everywhere to do. I think I understand what the next step is now, it's figuring out how to go from (list (list 'x 'b 'c 'd) etc...) to the right answer which is (list (list 'x 'a 'b 'c 'd) etc. So, I have the following information/data available to me in order to do this: ; a-letter symbol 'x ; a-word los (list 'a 'b 'c 'd) ; (first a-word) symbol 'a ; (rest a-word) los (list 'b 'c 'd) Am I thinking about this correctly? At this point, it looks like in order to turn this: (list (list 'x 'b 'c 'd) (list 'b 'x 'c 'd) (list 'b 'c 'x 'd) (list 'b 'c 'd 'x)) into this: (list (list 'x 'a 'b 'c 'd) (list 'a 'x 'b 'c 'd) (list 'a 'b 'x 'c 'd) (list 'a 'b 'c 'x 'd) (list 'a 'b 'c ' d 'x)) I have to 1. insert (first a-word) between 'x and 'b for the first list 2. insert (first a-word) in front of the rest of the lists So, I potentially need some function that can prepend a symbol onto each word in a list of words. ; prepend-letter: Letter List-Of-Words -> List-Of-Words ; creates a List-Of-Words where a-letter is inserted before ; each word in a-list-of-words (define (prepend-letter a-letter a-list-of-words ) (cond ((empty? a-list-of-words) empty) (else (append (list (append (list a-letter) (first a-list-of-words))) (prepend-letter a-letter (rest a-list-of-words)))))) is this prepend-letter function one of the helper functions I need? I'm starting to think I might be on the right track here. Completing the insert-everywhere function still eludes me, but maybe the helper-functions need to be written first before insert-everywhere will work correctly? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090501/a61e6ac2/attachment.htm From michele.simionato at gmail.com Fri May 1 02:22:26 2009 From: michele.simionato at gmail.com (Michele Simionato) Date: Fri May 1 02:30:39 2009 Subject: [plt-scheme] how many times macros are defined? Message-ID: <23e51fd4-d166-4882-8cf9-a103276f7291@v35g2000pro.googlegroups.com> As some of you will know, I have been writing a series of articles about R6RS Scheme for a while (http://www.artima.com/weblogs/viewpost.jsp? thread=251474). Recently, I have started a cycle about the R6RS module system and I am going to write something about the tower of metalevels. My focus is on portability issues between different R6RS implementations. While I was working at an example of code running at metalevel 2 I have found a behavior of PLT Scheme which is quite unclear to me. Here is the code: #!r6rs (import (rnrs) (for (only (rnrs) begin lambda display) (meta 2))) (define-syntax m (let () (define-syntax m2 (begin (display "at metalevel 2\n") (lambda (x) "expanded-m\n"))) (define _ (display "at metalevel 1\n")) (lambda (x) (m2)))) (display (m)) If I run this script in PLT I get: $ plt-r6rs meta2.ss at metalevel 2 at metalevel 2 at metalevel 1 expanded-m The puzzling thing for me is that I get the message "at metalevel 2" twice, whereas I would expect to get it only once, when the inner macro m2 is defined (Ikarus does so). Can you share some light on what it is happening here? TIA, Michele Simionato From pocmatos at gmail.com Fri May 1 06:36:42 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri May 1 06:37:40 2009 Subject: [plt-scheme] Re: Remove File Operations In-Reply-To: <11b141710904300850v2ccd1833h3e93924fa14fb3e4@mail.gmail.com> References: <11b141710904300850v2ccd1833h3e93924fa14fb3e4@mail.gmail.com> Message-ID: <11b141710905010336k4395f0b8h6b9db8217eb5daf9@mail.gmail.com> On Thu, Apr 30, 2009 at 4:50 PM, Paulo J. Matos wrote: > Hi all, > > Anyone has implemented a library for remote file operations through > ssh? (like copying, renaming, etc...) > Just noticed the title should have been 'Remote' instead of 'Remove'. Anyway, since nobody replied I assume there's nothing. I shall get something going and come back for comments. > Cheers, > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From jao at gnu.org Fri May 1 06:52:17 2009 From: jao at gnu.org (Jose A. Ortega Ruiz) Date: Fri May 1 07:08:26 2009 Subject: [plt-scheme] Re: segfault using enter! References: <87ljphzp85.fsf@mithrandir.homeunix.net> <20090501033636.CECF06500AE@mail-svr1.cs.utah.edu> Message-ID: <87d4atyu1q.fsf@mithrandir.homeunix.net> Matthew Flatt writes: > At Fri, 01 May 2009 01:38:50 +0200, "Jose A. Ortega Ruiz" wrote: >> mzscheme (both 4.1.5 and 4.1.5.5 built from today's svn, on debian sid) >> segfaults systematically under the following scenario: > > Thanks for the report! This is fixed in SVN. Excellent! I can confirm that it works on my side too (and also with the more complex files that triggered the bug in the first place). Thanks to *you* for the extremely quick fix!! >> (i tried to run mzscheme >> under gdb, but it segfaults on startup) > > That SIGSEGV is actually a GC write barrier, and not a crash. You could > continue with > > (gdb) handle SIGSEGV nostop noprint > (gdb) c > Ah, good to know. I'm saving that in my bag of tricks for next time :) Cheers, jao From noelwelsh at gmail.com Fri May 1 07:08:32 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri May 1 07:08:50 2009 Subject: [plt-scheme] Re: Remove File Operations In-Reply-To: <11b141710905010336k4395f0b8h6b9db8217eb5daf9@mail.gmail.com> References: <11b141710904300850v2ccd1833h3e93924fa14fb3e4@mail.gmail.com> <11b141710905010336k4395f0b8h6b9db8217eb5daf9@mail.gmail.com> Message-ID: On Fri, May 1, 2009 at 11:36 AM, Paulo J. Matos wrote: > Just noticed the title should have been 'Remote' instead of 'Remove'. > Anyway, since nobody replied I assume there's nothing. I shall get > something going and come back for comments. This would be really handy for automated installs (like Capistrano in Ruby). Looking forward to it. N. From noelwelsh at gmail.com Fri May 1 07:24:31 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri May 1 07:24:49 2009 Subject: [plt-scheme] Specifying a callback that takes a f64vector In-Reply-To: <18937.49726.418729.143060@winooski.ccs.neu.edu> References: <18937.49081.852768.801156@winooski.ccs.neu.edu> <18937.49726.418729.143060@winooski.ccs.neu.edu> Message-ID: Well, I'm no closer to understanding how the _f64vector type works, but I've implemented my own which does the job. Code below in case anyone ever has use for it. The main problem is I don't understand the FFI model (and I'm not finding the docs useful). For example, I don't understand how I can define a function in Scheme with a f64vector parameter, and get C code to call this function. (_f64vector i) doesn't allow me to specify a length, and I just get these "Can't convert a C pointer to f64vector" errors at runtime. BTW, the _f64vector error messages are bad. I ended up hacking foreign.ss to understand what is going on. For example, this: > (_f64vector i 2) reference to undefined identifier: i is a pretty poor user experience; the docs do not indicate this is not allowed. N. ;; (hashof f64vector cpointer) (define useful-f64vector-map (make-hash)) (define (useful-f64vector-ref v) (hash-ref useful-f64vector-map v (lambda (v) (error (format "No ptr value associated with f64vector ~a\n" v))))) (define (useful-f64vector-set! v ptr) (hash-set! useful-f64vector-map v ptr)) (define ((useful-f64vector-update-C! length) v) (let ([ptr (useful-f64vector-ref v)]) (for ([idx (in-range length)]) (ptr-set! ptr _double idx (f64vector-ref v idx))) ptr)) ;; Define an f64vector C type that can actually be used as ;; an input and output parameter, rather than the bizarre ;; implementation given with the FFI. (define (useful-f64vector length) (_cpointer 'useful-f64vector _pointer ;; Scheme -> C (useful-f64vector-update-C! length) ;; C -> Scheme (lambda (ptr) (let ([v (make-f64vector length)]) (for ([offset (in-range length)]) (f64vector-set! v offset (ptr-ref ptr _double offset))) (useful-f64vector-set! v ptr) v)) )) From mflatt at cs.utah.edu Fri May 1 07:36:58 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Fri May 1 07:37:18 2009 Subject: [plt-scheme] how many times macros are defined? In-Reply-To: <23e51fd4-d166-4882-8cf9-a103276f7291@v35g2000pro.googlegroups.com> References: <23e51fd4-d166-4882-8cf9-a103276f7291@v35g2000pro.googlegroups.com> Message-ID: <20090501113700.8A2BB6500B2@mail-svr1.cs.utah.edu> At Thu, 30 Apr 2009 23:22:26 -0700 (PDT), Michele Simionato wrote: > #!r6rs > (import (rnrs) (for (only (rnrs) begin lambda display) (meta 2))) > > (define-syntax m > (let () > (define-syntax m2 > (begin > (display "at metalevel 2\n") > (lambda (x) "expanded-m\n"))) > (define _ (display "at metalevel 1\n")) > (lambda (x) (m2)))) > > (display (m)) > > If I run this script in PLT I get: > > $ plt-r6rs meta2.ss > at metalevel 2 > at metalevel 2 > at metalevel 1 > expanded-m The current version prints "metalevel 2" only once. I don't remember when this changed, but it was before version 4.1.4 (and the current version is 4.1.5). Older versions used to expand sets of internal definitions to a `letrec-syntaxes+values' form. While processing internal definitions for that conversion, transformer expressions would get evaluated. Then, the transformer expressions would be evaluated again as part of the generated `letrec-syntaxes+values' form. We changed the macro expander to instead keep the results from the first evaluation. From jao at gnu.org Fri May 1 07:12:00 2009 From: jao at gnu.org (Jose A. Ortega Ruiz) Date: Fri May 1 08:08:28 2009 Subject: [plt-scheme] programmatic access to current namespace Message-ID: <878wlhyt4v.fsf@mithrandir.homeunix.net> Hi, After enter!ing a module in mzscheme, calling (current-namespace) prints a representation of the current namespace that contains the module file name: > (enter! "/tmp/foo.ss") > (current-namespace) # > Is there a way of getting the file name (or module path) a namespace refers to given the value of the latter? (i'm thinking of something like, say, (module-path (current-namespace))) Thanks! jao From noelwelsh at gmail.com Fri May 1 08:17:57 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri May 1 08:18:16 2009 Subject: [plt-scheme] Re: Splicing macro containing ... In-Reply-To: <99948719-dab4-4155-812b-ad8a80828634@s38g2000prg.googlegroups.com> References: <99948719-dab4-4155-812b-ad8a80828634@s38g2000prg.googlegroups.com> Message-ID: On Thu, Apr 30, 2009 at 3:07 PM, Michele Simionato wrote: > ? ? ? ? ? ? ? ? ?(... (... body-expr)) ...) Thanks. I didn't even know this form existed. N. From noelwelsh at gmail.com Fri May 1 08:22:19 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri May 1 08:23:00 2009 Subject: [plt-scheme] embedding & modules problem In-Reply-To: <1241082530.29731.37.camel@kittywake> References: <1241014932.19912.14.camel@kittywake> <49F87193.4020008@ccs.neu.edu> <1241024729.19912.35.camel@kittywake> <49F88DDA.4060107@ccs.neu.edu> <756daca50904291838uff3d733p69a0d59184326a88@mail.gmail.com> <1241082530.29731.37.camel@kittywake> Message-ID: On Thu, Apr 30, 2009 at 10:08 AM, Dave Griffiths wrote: > A related question. Is there a way I can conditionally require from > modules coming from different sources like this? (eq a dynamic linked > extension vs in-source definition) I should explain what I'm trying to > do, as it's probably easier. Maybe you can use define-require-syntax to implement this? N. From mflatt at cs.utah.edu Fri May 1 08:22:38 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Fri May 1 08:23:00 2009 Subject: [plt-scheme] programmatic access to current namespace In-Reply-To: <878wlhyt4v.fsf@mithrandir.homeunix.net> References: <878wlhyt4v.fsf@mithrandir.homeunix.net> Message-ID: <20090501122239.924FE6500C7@mail-svr1.cs.utah.edu> At Fri, 01 May 2009 13:12:00 +0200, "Jose A. Ortega Ruiz" wrote: > After enter!ing a module in mzscheme, calling (current-namespace) prints > a representation of the current namespace that contains the module file > name: > > > (enter! "/tmp/foo.ss") > > (current-namespace) > # > > > > Is there a way of getting the file name (or module path) a namespace > refers to given the value of the latter? (i'm thinking of something > like, say, (module-path (current-namespace))) (variable-reference->resolved-module-path (#%variable-reference)) If the result is not #f, you can then extract the module name with `resolved-module-path-name'. [I see that the docs say that the expression above will raise an exception if the current namespace is a top-level namespace, instead of a module namespace. In fact, I had changed it to produce #f in that case, and I'll fix the docs.] From michele.simionato at gmail.com Fri May 1 08:54:01 2009 From: michele.simionato at gmail.com (Michele Simionato) Date: Fri May 1 08:54:18 2009 Subject: [plt-scheme] Re: how many times macros are defined? In-Reply-To: <20090501113700.8A2BB6500B2@mail-svr1.cs.utah.edu> References: <23e51fd4-d166-4882-8cf9-a103276f7291@v35g2000pro.googlegroups.com> <20090501113700.8A2BB6500B2@mail-svr1.cs.utah.edu> Message-ID: On May 1, 1:36?pm, Matthew Flatt wrote: > The current version prints "metalevel 2" only once. I see, so my understanding was correct and I have just encountered a passing-by implementation detail. BTW, I have another question. In future Adventures I want to explain the difference between systems with implicit phasing (like Ikarus) and systems with explicit phasing (like PLT and Larceny). The difference - as you know better than me - is that systems like PLT andLarceny can import names into a specific phase, whereas Ikarus necessarily imports the names into all phases. In principle Larceny and PLT are more powerful since they give you more control; in practice however I am having trouble in finding real life use cases where to import names into a specific phase only is necessary. For instance, I wrote this, but it seems to me a pretty weak use case: """ Suppose for instance you are a teacher, and you want to force your students to write their macros using only a functional subset of Scheme. You could then import at compile time all R6RS procedures except the nonfunctional ones (like ``set!``) while importing at runtime the whole of R6RS. """ Do you have more practical use case to suggest? There is yet another thing that troubles me. The R6RS document forbids the same name to be used with different bindings in different phases. Therefore, if I import the name 'x' at expand time (just to make an example) I am basically reserving the name 'x' for all phases, since I cannot reuse 'x' in other phases, unless it has the same binding as the first 'x'. In other words, the namespaces in the different phases are not really separated, and thus I could as well import the name 'x' in all phases, since I cannot re-use it with another meaning anyway. Do you have any thoughts on the subject? I am sure I am missing something. Michele Simionato From mflatt at cs.utah.edu Fri May 1 09:32:18 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Fri May 1 09:32:39 2009 Subject: [plt-scheme] Re: how many times macros are defined? In-Reply-To: References: <23e51fd4-d166-4882-8cf9-a103276f7291@v35g2000pro.googlegroups.com> <20090501113700.8A2BB6500B2@mail-svr1.cs.utah.edu> Message-ID: <20090501133219.A2CFA6500A9@mail-svr1.cs.utah.edu> At Fri, 1 May 2009 05:54:01 -0700 (PDT), Michele Simionato wrote: > BTW, I have another question. In future Adventures I want to explain > the difference between systems with implicit phasing > (like Ikarus) and systems with explicit phasing (like PLT and > Larceny). > > The difference - as you know better than me - is that systems like PLT > andLarceny can import names into a specific phase, whereas > Ikarus necessarily imports the names into all phases. > In principle Larceny and PLT are more powerful since they > give you more control; in practice however I am having trouble > in finding real life use cases where to import names into a > specific phase only is necessary. For instance, I wrote this, > but it seems to me a pretty weak use case: > > """ > Suppose for instance you are a teacher, and you want to force > your students to write their macros using only a functional > subset of Scheme. > You could then import at compile time all R6RS procedures > except the nonfunctional ones (like ``set!``) while importing > at runtime the whole of R6RS. > """ > > Do you have more practical use case to suggest? An actual variant of this example is the R5RS language, which imports only `syntax-rules' for transformers and does not import `syntax-rules' for run time. The restriction of `define-syntax' to `syntax-rules' could also be accomplished by providing a `define-syntax' so that builds in the `syntax-rules' form. Our current strategy is somewhat simpler, and it's certainly more extensible (e.g., using the `#%require', you can import more transformer forms into a module that is otherwise in R5RS). In most code, importing the same name with different bindings in different phases is rare, though, and I think it's not a strong motivation for separating phases. In documentation, we very often exploit the ability to import a name with a different binding in the "label" phase (example code that refers to libraries) compared to the run-time phase (the code that implements the document itself). Since other systems do not approach documentation in the same way as PLT Scheme, though, that example also provides little motivation to others for phase-specific bindings. > There is yet another thing that troubles me. > The R6RS document forbids the same name > to be used with different bindings in different phases. > Therefore, if I import the name 'x' at expand time (just to make > an example) I am basically reserving the name 'x' for all phases, > since I cannot reuse 'x' in other phases, unless it has the same > binding as the first 'x'. In other words, the namespaces in the > different phases are not really separated, and thus I could as well > import the name 'x' in all phases, since I cannot re-use it with > another meaning anyway. That was a compromise design to allow both Ikarus-style and PLT-style macro systems. In PLT Scheme, the motivation for phase-specific bindings is not so much that we may want different names in different phases, but that we want to be specific about which code is running at which times. Without an enforced separation, we found that it was far too easy to accidentally have the run-time code depend on some initialization in compile-time code (e.g. loading a module, initializing some state), and that possibility made our builds and libraries fragile. (This problem is described more in the "Composable and Compilable Macros" paper.) So, we moved to a system that would tell us when we got it wrong, in much the same way that the compiler complains when a module contains a free variable. There's a spectrum in language design on how much the compiler checks statically versus how much is checked at run time, and static checks inevitably rule out some programs that could have run just fine. On the particular point of phase bindings, we've been happier with explicit declarations and static checking. I think this choice has been key to helping us build towers of languages that are far wider (lots of languages) and deeper (languages built on other languages) than anything else out there, that involve many implementors, and that we can keep running over many years. From pocmatos at gmail.com Fri May 1 12:12:10 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri May 1 12:12:52 2009 Subject: [plt-scheme] find-executable-path docs typo? Message-ID: <11b141710905010912v56a35b52o2e6adef62d0859e7@mail.gmail.com> Hi, In find-executable-path documentation: (find-executable-path program-sub related-sub [ deepest?]) ? (or/c path? #f) program-sub : path-string? related-sub : path-string? deepest? : any/c = #f However, I can: (find-executable-path "which") which means that the second argument is also optional but that doesn't seem to be conveyed by the documentation. Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From mflatt at cs.utah.edu Fri May 1 13:04:15 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Fri May 1 13:04:46 2009 Subject: [plt-scheme] find-executable-path docs typo? In-Reply-To: <11b141710905010912v56a35b52o2e6adef62d0859e7@mail.gmail.com> References: <11b141710905010912v56a35b52o2e6adef62d0859e7@mail.gmail.com> Message-ID: <20090501170416.0191F6500B2@mail-svr1.cs.utah.edu> At Fri, 1 May 2009 16:12:10 +0000, "Paulo J. Matos" wrote: > In find-executable-path documentation: > (find-executable-path program-sub > related-sub > [ deepest?]) ? (or/c path? #f) > program-sub : path-string? > related-sub : path-string? > deepest? : any/c = #f > > However, I can: > (find-executable-path "which") > > which means that the second argument is also optional but that doesn't > seem to be conveyed by the documentation. Right --- I've fixed the docs for the next build. From pocmatos at gmail.com Fri May 1 13:14:32 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri May 1 13:15:16 2009 Subject: [plt-scheme] Re: Remove File Operations In-Reply-To: References: <11b141710904300850v2ccd1833h3e93924fa14fb3e4@mail.gmail.com> <11b141710905010336k4395f0b8h6b9db8217eb5daf9@mail.gmail.com> Message-ID: <11b141710905011014o647ee661pca2148777ead116a@mail.gmail.com> On Fri, May 1, 2009 at 11:08 AM, Noel Welsh wrote: > On Fri, May 1, 2009 at 11:36 AM, Paulo J. Matos wrote: >> Just noticed the title should have been 'Remote' instead of 'Remove'. >> Anyway, since nobody replied I assume there's nothing. I shall get >> something going and come back for comments. > > This would be really handy for automated installs (like Capistrano in > Ruby). Looking forward to it. > > N. > I must note that there are a few issues I must address and I would welcome suggestions. The implementation of this library is due to my need of a customized backup script and I want to do it in scheme, however, I don't want to assume scheme is installed in the server. So the idea is to call ssh/scp with the correct flags to perform certain operations on the server and return. I started by implementing a process* that calls a command through ssh: (define (process/ssh* server login command . args) (apply process* (ssh-path) "-o" "BatchMode=yes" "-p" (number->string (server-port server)) "-l" login (server-host server) command args)) This already assumes that there is no password authentication involved, meaning the user has to ssh-copy-id first. Allowing password authentication would generate some issues: - some servers might need passwords, others might not. (if you had ssh-copy-id'ed first) so you would end up not knowing when to send the password; - Imagine you would try reading the output to see if you had 'Password:' in the port to know if you should send password... this has also issues... it might not show up as 'Password:' but as 'SSH Passphrase:' (I have seen this before and I think it has to do with PAM authentication). Also, if the server doesn't need the password but instead prints a list of files (if you issued the ls command on the server) and if the first filename is called Password:, you are in trouble. Anyway, the idea here is to have a library that implements a similar set of functions as plt scheme in reference/Filesystem.html whose name is appended with '/server' and accepts 2 keywords arguments, a structure server (hostname + port) and a string with login, the first defaulting to localhost:22 and the second to your current user name in you machine. So, /server with default values for server and login should act the same as . As an example: #lang scheme (require scheme/system scheme/match) ;; Server structure, composed by a name and a port (define-struct server (host port)) (define (serv (name "localhost") (port 22)) (make-server name port)) (define default-server (make-parameter (serv))) (define ssh-path (make-parameter (find-executable-path "ssh"))) (define (process/ssh* server login command . args) (apply process* (ssh-path) "-o" "BatchMode=yes" "-p" (number->string (server-port server)) "-l" login (server-host server) command args)) ;; Gets the current username (define (current-username) (match-let ([(list pout pin id perr proc) (process* (find-executable-path "whoami"))]) (read-line pout))) (define (find-executable-path/server program-sub related-sub (deepest #f) #:server (server (default-server)) #:login (login (current-username))) (match-let (((list pout pin id perr proc) (process/ssh* server login "which" program-sub))) (string->path (read-line pout)))) Note that find-executable-path/server ignores related-sub and deepest and I still have to work out the best way to do this, still, it does assume the existence of which on the server which reduces the portability to server being a linux box (dunno if it would work on mac but definitely not on windows unless windows kernel is now similar to unix. Note that for copying I would need to use 'cp', 'rm' for removing, etc. If you know of a way to extend the portability to more systems, let me know. This is my path for continuing this library. I welcome design suggestions as well and better ways to implement this. If you think 'Agrh, it would be much useful if you implemented it in this way or that way...' let me know what's best. Example of find-executable-path: > (find-executable-path/server "rm" #f) # > (find-executable-path "rm" #f) # Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From dougorleans at gmail.com Fri May 1 13:20:39 2009 From: dougorleans at gmail.com (Doug Orleans) Date: Fri May 1 13:21:17 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: <20090429215352.9A03B6500D7@mail-svr1.cs.utah.edu> References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> <20090419155630.368466500AD@mail-svr1.cs.utah.edu> <2c17707e0904282002p60b28e2ev6a8debfff05bad47@mail.gmail.com> <20090429215352.9A03B6500D7@mail-svr1.cs.utah.edu> Message-ID: <2c17707e0905011020u59d9a309o89491a276bf33ca9@mail.gmail.com> On Wed, Apr 29, 2009 at 5:53 PM, Matthew Flatt wrote: > At Tue, 28 Apr 2009 23:02:37 -0400, Doug Orleans wrote: >> On Sun, Apr 19, 2009 at 11:56 AM, Matthew Flatt wrote: >> > The performance is close to the binary-tree performance, probably >> > because that's how functional hash tables are implemented internally >> > (but as red-black trees, so they're always balanced). >> >> I had been naively assuming that immutable hash tables were as >> efficient as mutable ones. ?It would be good to say more about their >> relative performance in the reference manual than just "immutable >> tables support constant-time functional update." > > Ok, I extended the note there. (There's a "the the" in the extended note.) I guess my main question was, how do hash-remove and hash-remove! compare? And, come to think of it, I don't understand how hash-ref and hash-set are constant-time if they use red-black trees. > I don't think the write > barrier is not a significant cost in mutating an object. (I assume you meant a single-negative, not a double-negative...) > With our implementation, immutable hash tables are probably only better > when they give you a better algorithm --- one that can needs O(1) > operations on a mapping and where the operations are aren't > "single-threaded" in the cumulative sense (i.e., you start with some > mapping and you want to extend it in different, independent ways). Sure, hash-set is better than hash-copy + hash-set!. --dougorleans@gmail.com From dougorleans at gmail.com Fri May 1 14:36:21 2009 From: dougorleans at gmail.com (Doug Orleans) Date: Fri May 1 14:36:59 2009 Subject: [plt-scheme] build error with svn 14677 Message-ID: <2c17707e0905011136s796bf665q1bd7a1656fea5d3b@mail.gmail.com> I did svn update to revision 14677, ran ./configure, then make aborted with this error: make[5]: Entering directory `/usr/local/plt/src/mred/gc2' make[5]: *** No rule to make target `../../mred/wxme/wx_media.h', needed by `xsrc/wxscheme.cc'. Stop. The directory src/mred/wxme is empty except for a Makefile. Any clues? I'm on Ubuntu 9.04. --dougorleans@gmail.com From pocmatos at gmail.com Fri May 1 14:51:30 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri May 1 14:52:12 2009 Subject: [plt-scheme] find-executable-path docs typo? In-Reply-To: <20090501170416.0191F6500B2@mail-svr1.cs.utah.edu> References: <11b141710905010912v56a35b52o2e6adef62d0859e7@mail.gmail.com> <20090501170416.0191F6500B2@mail-svr1.cs.utah.edu> Message-ID: <11b141710905011151v4a97371egc3b0aee31a92ede6@mail.gmail.com> On Fri, May 1, 2009 at 5:04 PM, Matthew Flatt wrote: > At Fri, 1 May 2009 16:12:10 +0000, "Paulo J. Matos" wrote: >> In find-executable-path documentation: >> (find-executable-path ? ? ? ? program-sub >> ? ? ? ? ? ? ? related-sub >> ? ? ? ?[ ? ? ?deepest?]) ? ? ? ? ? ? ?? ? ? ? ? ? ? ? (or/c path? #f) >> ? program-sub : path-string? >> ? related-sub : path-string? >> ? deepest? : any/c = #f >> >> However, I can: >> (find-executable-path "which") >> >> which means that the second argument is also optional but that doesn't >> seem to be conveyed by the documentation. > > Right --- I've fixed the docs for the next build. > > Thanks! -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From pocmatos at gmail.com Fri May 1 15:06:50 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri May 1 15:07:32 2009 Subject: [plt-scheme] Re: Expressivity gap between formal methods and PL's In-Reply-To: References: <46929267-1279-4735-8722-094304ac6c40@s1g2000prd.googlegroups.com> <11b141710904301102s26608eds907a6891b62f63c1@mail.gmail.com> <11b141710904301225p2dc78eb1q81a31346e81e5736@mail.gmail.com> Message-ID: <11b141710905011206q28f84781j528abc1bf0519b6a@mail.gmail.com> On Thu, Apr 30, 2009 at 7:53 PM, wooks wrote: > > > On Apr 30, 8:25?pm, "Paulo J. Matos" wrote: > >> >> What do you mean, what to do? If we are here thinking about formal >> specification of software, then there really is nothing you can do. >> > > Well I want to go from having a (hopefully) correct formal spec of my > system to > a correctly functioning system. > By system I will assume you mean software system... >> >> You specify your model just to get a better understand of how it works >> in a formal language and then you implement it in a programming >> language trying to maintain invariants. >> > > If I had a formal specification of a system then I'd want to get alot > more out of it. > > So what are the sorts of things I can express in a formal > specification language that > do not readily translate to programming languages. > > What sorts of things are the biggest threats to the fidelity of the > translation. > For a start, lets say that you need a language that mixes specification languages + programming languages. You see, each language varies but formal specification languages are usually based on a logic + set theory and may _or_ may not have an execution model. Alloy is relational logic without an execution model. It's declarative. You write your model declarative, write a couple of facts and that's it. FAR, FAAAAAAAAR, away from an 'executable' and generating an executable directly from an Alloy mode wouldn't even make sense. Event-B has [I will simplify it] a state with a set of variables whose type are one of enumerations, integer set, boolean set, powersets of types and cartesian product of types. Then it has events which has a guard and a set of actions which update the variables in the state atomically. It has an execution model. At each point in time, at least one event guard needs to be true and an event whose guard is true is chosen non-deterministically to update the state and loop... [meaning, choose another event non deterministically]. As you can see these are two distinct languages, both with specific applications but none afaik was designed to be converted into an executable program. Event-B would even have a lot of trouble in modeling software. Some issues are, lack of structures, modules, non-determinism, to name just a few. You could convert an eventb model into an executable but it wouldn't be a proper software package ready to be deployed, far from it. > Perhaps another way of looking at it is if you decided to implement > (lets say Z in Scheme/Lisp) > what constructs would be the most troublesome to implement. > > You got me here.. what do you mean by implementing Z in Scheme/Lisp? You mean, a specific model of Z or a prover for Z? or a simulator for Z models? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From dougorleans at gmail.com Fri May 1 15:07:32 2009 From: dougorleans at gmail.com (Doug Orleans) Date: Fri May 1 15:08:12 2009 Subject: [plt-scheme] interfaces Message-ID: <2c17707e0905011207m2f70a18eg34a19b13a3e2a862@mail.gmail.com> What are some practical uses of interfaces? The only one I've noticed is tagging, e.g. printable<%>. The fish-interface example in the Guide is not very convincing. --dougorleans@gmail.com From robby at eecs.northwestern.edu Fri May 1 15:10:06 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Fri May 1 15:10:30 2009 Subject: [plt-scheme] interfaces In-Reply-To: <2c17707e0905011207m2f70a18eg34a19b13a3e2a862@mail.gmail.com> References: <2c17707e0905011207m2f70a18eg34a19b13a3e2a862@mail.gmail.com> Message-ID: <932b2f1f0905011210x68bd5fb2o862ff846b91ba794@mail.gmail.com> You can use them in contracts to avoid specifying a dependence on a particular implementation, but still to guarantee you have certain methods. Robby On Fri, May 1, 2009 at 2:07 PM, Doug Orleans wrote: > What are some practical uses of interfaces? ?The only one I've noticed > is tagging, e.g. printable<%>. ?The fish-interface example in the > Guide is not very convincing. > > --dougorleans@gmail.com > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From dvanhorn at ccs.neu.edu Fri May 1 16:00:57 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Fri May 1 16:01:42 2009 Subject: [plt-scheme] SchemeUnit: [Listof TestSuite] -> TestSuite Message-ID: <49FB54F9.1090009@ccs.neu.edu> I feel like I'm missing something obvious, but is there a way to form a test suite out of a given list of test suites? All I see is the syntax: (test-suite name [#:before thunk] [#:after thunk] test ...) In addition to the compound testing forms, there should probably be procedures for constructing compound tests. David From carl.eastlund at gmail.com Fri May 1 16:04:21 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Fri May 1 16:06:25 2009 Subject: [plt-scheme] SchemeUnit: [Listof TestSuite] -> TestSuite In-Reply-To: <49FB54F9.1090009@ccs.neu.edu> References: <49FB54F9.1090009@ccs.neu.edu> Message-ID: <990e0c030905011304x15fb3cebo8fc7661d04dc5fff@mail.gmail.com> That's a function, not syntax. I've used apply on test-suite many times to create suites dynamically. On Fri, May 1, 2009 at 4:00 PM, David Van Horn wrote: > I feel like I'm missing something obvious, but is there a way to form a test > suite out of a given list of test suites? ?All I see is the syntax: > > ? (test-suite name [#:before thunk] [#:after thunk] test ...) > > In addition to the compound testing forms, there should probably be > procedures for constructing compound tests. > > David -- Carl Eastlund From noelwelsh at gmail.com Fri May 1 16:07:43 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri May 1 16:08:04 2009 Subject: [plt-scheme] SchemeUnit: [Listof TestSuite] -> TestSuite In-Reply-To: <49FB54F9.1090009@ccs.neu.edu> References: <49FB54F9.1090009@ccs.neu.edu> Message-ID: On Fri, May 1, 2009 at 9:00 PM, David Van Horn wrote: > I feel like I'm missing something obvious, but is there a way to form a test > suite out of a given list of test suites? ?All I see is the syntax: > > ? (test-suite name [#:before thunk] [#:after thunk] test ...) > > In addition to the compound testing forms, there should probably be > procedures for constructing compound tests. There isn't, and there should be. See: http://planet.plt-scheme.org/trac/ticket/156 You should be able to use make-schemeunit-test-case which has the type: name (listof test) -> test-suite It isn't documented, though. N. From dvanhorn at ccs.neu.edu Fri May 1 16:08:11 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Fri May 1 16:08:45 2009 Subject: [plt-scheme] SchemeUnit: [Listof TestSuite] -> TestSuite In-Reply-To: <990e0c030905011304x15fb3cebo8fc7661d04dc5fff@mail.gmail.com> References: <49FB54F9.1090009@ccs.neu.edu> <990e0c030905011304x15fb3cebo8fc7661d04dc5fff@mail.gmail.com> Message-ID: <49FB56AB.8070103@ccs.neu.edu> Carl Eastlund wrote: > That's a function, not syntax. I've used apply on test-suite many > times to create suites dynamically. #lang scheme (require (planet schematics/schemeunit)) (apply test-suite "foo" (list (check-equal? 1 1))) I get: test-suite: bad syntax in: test-suite David > On Fri, May 1, 2009 at 4:00 PM, David Van Horn wrote: >> I feel like I'm missing something obvious, but is there a way to form a test >> suite out of a given list of test suites? All I see is the syntax: >> >> (test-suite name [#:before thunk] [#:after thunk] test ...) >> >> In addition to the compound testing forms, there should probably be >> procedures for constructing compound tests. >> >> David > From noelwelsh at gmail.com Fri May 1 16:11:29 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri May 1 16:11:49 2009 Subject: [plt-scheme] SchemeUnit: [Listof TestSuite] -> TestSuite In-Reply-To: <990e0c030905011304x15fb3cebo8fc7661d04dc5fff@mail.gmail.com> References: <49FB54F9.1090009@ccs.neu.edu> <990e0c030905011304x15fb3cebo8fc7661d04dc5fff@mail.gmail.com> Message-ID: On Fri, May 1, 2009 at 9:04 PM, Carl Eastlund wrote: > That's a function, not syntax. ?I've used apply on test-suite many > times to create suites dynamically. I think that was the case in v2 of SchemeUnit, which I tihink you still use (due to fasttest). In v3 I think test-suite is a macro, due to the introduction of contexts. OTOH, I know I'm rather tired and am probably misremembering some details. N. From eli at barzilay.org Fri May 1 16:22:08 2009 From: eli at barzilay.org (Eli Barzilay) Date: Fri May 1 16:22:29 2009 Subject: [plt-scheme] build error with svn 14677 In-Reply-To: <2c17707e0905011136s796bf665q1bd7a1656fea5d3b@mail.gmail.com> References: <2c17707e0905011136s796bf665q1bd7a1656fea5d3b@mail.gmail.com> Message-ID: <18939.23024.428534.523452@winooski.ccs.neu.edu> On May 1, Doug Orleans wrote: > I did svn update to revision 14677, ran ./configure, then make aborted > with this error: > > make[5]: Entering directory `/usr/local/plt/src/mred/gc2' > make[5]: *** No rule to make target `../../mred/wxme/wx_media.h', > needed by `xsrc/wxscheme.cc'. Stop. > > The directory src/mred/wxme is empty except for a Makefile. > > Any clues? I'm on Ubuntu 9.04. Looks like it might be the result of updating an old source tree -- did you try to start with a clean checkout? -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Fri May 1 16:29:12 2009 From: eli at barzilay.org (Eli Barzilay) Date: Fri May 1 16:29:34 2009 Subject: [plt-scheme] Re: Remove File Operations In-Reply-To: <11b141710905011014o647ee661pca2148777ead116a@mail.gmail.com> References: <11b141710904300850v2ccd1833h3e93924fa14fb3e4@mail.gmail.com> <11b141710905010336k4395f0b8h6b9db8217eb5daf9@mail.gmail.com> <11b141710905011014o647ee661pca2148777ead116a@mail.gmail.com> Message-ID: <18939.23448.330264.844752@winooski.ccs.neu.edu> On May 1, Paulo J. Matos wrote: > [...] Some possibly relevant & random notes: * For backups, I found unison to work very well, except that it's difficult to customize it for different subsets that you want to synchronize. I wrote a scheme wrapper that deals with that and that worked fine for me for several years now. * For remote file access on linux, there is `sshfs', based on `fuse'. It's extremely convenient to work on any remote machine -- it even works with Windows mounts. You basically get to mount a remote path locally, where everything is going through an ssh line underneath. (It took some hacking, but I eventually even managed to hook it to auto mount...) * For password issues with ssh, a nice solution would be to write an interface to sockets (IIRC, there are existing interfaces in several other implementations with varying degrees of completeness), but a much easier solution is to use some wrapper utility. One such thing is `socat' -- you can use it to start a program like ssh and get back two simple input/output ports. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From dvanhorn at ccs.neu.edu Fri May 1 16:38:30 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Fri May 1 16:39:06 2009 Subject: [plt-scheme] SchemeUnit: [Listof TestSuite] -> TestSuite In-Reply-To: References: <49FB54F9.1090009@ccs.neu.edu> Message-ID: <49FB5DC6.1080806@ccs.neu.edu> Noel Welsh wrote: > On Fri, May 1, 2009 at 9:00 PM, David Van Horn wrote: >> I feel like I'm missing something obvious, but is there a way to form a test >> suite out of a given list of test suites? All I see is the syntax: >> >> (test-suite name [#:before thunk] [#:after thunk] test ...) >> >> In addition to the compound testing forms, there should probably be >> procedures for constructing compound tests. > > There isn't, and there should be. See: > > http://planet.plt-scheme.org/trac/ticket/156 > > You should be able to use make-schemeunit-test-case which has the type: > > name (listof test) -> test-suite > > It isn't documented, though. It looks like make-schemeunit-test-case consumes a name and a thunk, not a list of tests. I don't know what the thunk should produce to make this work. So I'm still stuck with the following: (define suites e) ; where e evals to (list (test-suite n1 t ...) ...)) (define all (make-scheme-unit-test-case "All tests" (lambda () ???))) David From jay.mccarthy at gmail.com Fri May 1 16:41:30 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Fri May 1 16:41:52 2009 Subject: [plt-scheme] SchemeUnit: [Listof TestSuite] -> TestSuite In-Reply-To: <49FB5DC6.1080806@ccs.neu.edu> References: <49FB54F9.1090009@ccs.neu.edu> <49FB5DC6.1080806@ccs.neu.edu> Message-ID: Here's something I wrote that turns each XML file in a directory into a test of the XML parser: http://svn.plt-scheme.org/plt/trunk/collects/tests/xml/test-clark.ss I use the internal SchemeUnit API. Jay On Fri, May 1, 2009 at 2:38 PM, David Van Horn wrote: > Noel Welsh wrote: >> >> On Fri, May 1, 2009 at 9:00 PM, David Van Horn >> wrote: >>> >>> I feel like I'm missing something obvious, but is there a way to form a >>> test >>> suite out of a given list of test suites? ?All I see is the syntax: >>> >>> ?(test-suite name [#:before thunk] [#:after thunk] test ...) >>> >>> In addition to the compound testing forms, there should probably be >>> procedures for constructing compound tests. >> >> There isn't, and there should be. ?See: >> >> ?http://planet.plt-scheme.org/trac/ticket/156 >> >> You should be able to use make-schemeunit-test-case which has the type: >> >> ?name (listof test) -> test-suite >> >> It isn't documented, though. > > It looks like make-schemeunit-test-case consumes a name and a thunk, not a > list of tests. ?I don't know what the thunk should produce to make this > work. ?So I'm still stuck with the following: > > (define suites e) ; where e evals to (list (test-suite n1 t ...) ...)) > > (define all > ?(make-scheme-unit-test-case > ? ?"All tests" > ? ?(lambda () ????))) > > David > _________________________________________________ > ?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 dougorleans at gmail.com Fri May 1 16:51:33 2009 From: dougorleans at gmail.com (Doug Orleans) Date: Fri May 1 16:52:12 2009 Subject: [plt-scheme] non-custom print Message-ID: <2c17707e0905011351j4f2904e0hc565bb1965a89f5e@mail.gmail.com> Speaking of printable<%>, how do you access the default (non-custom) printer? Say I implement custom-display in a class, but I want the write behavior to stay the same, i.e. "#(struct:object:foo% ...)". What do I put in the custom-write method? --dougorleans@gmail.com From dougorleans at gmail.com Fri May 1 16:52:43 2009 From: dougorleans at gmail.com (Doug Orleans) Date: Fri May 1 16:53:21 2009 Subject: [plt-scheme] build error with svn 14677 In-Reply-To: <18939.23024.428534.523452@winooski.ccs.neu.edu> References: <2c17707e0905011136s796bf665q1bd7a1656fea5d3b@mail.gmail.com> <18939.23024.428534.523452@winooski.ccs.neu.edu> Message-ID: <2c17707e0905011352iffe5ccfu6a47e7dc0a108b88@mail.gmail.com> On Fri, May 1, 2009 at 4:22 PM, Eli Barzilay wrote: > Looks like it might be the result of updating an old source tree -- > did you try to start with a clean checkout? Yes, that works. But I thought svn update would always get me the newest source tree. Why doesn't it? Did the repository move? --dougorleans@gmail.com From sk at cs.brown.edu Fri May 1 16:54:08 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Fri May 1 16:54:49 2009 Subject: [plt-scheme] Re: Expressivity gap between formal methods and PL's In-Reply-To: <11b141710905011206q28f84781j528abc1bf0519b6a@mail.gmail.com> References: <46929267-1279-4735-8722-094304ac6c40@s1g2000prd.googlegroups.com> <11b141710904301102s26608eds907a6891b62f63c1@mail.gmail.com> <11b141710904301225p2dc78eb1q81a31346e81e5736@mail.gmail.com> <11b141710905011206q28f84781j528abc1bf0519b6a@mail.gmail.com> Message-ID: Sorry I've dozed through most of this thread, but: > Alloy is relational logic without an execution model. It's > declarative. You write your model declarative, write a couple of > facts and that's it. FAR, FAAAAAAAAR, away from an 'executable' and > generating an executable directly from an Alloy mode wouldn't even > make sense. In that case, it is just as well that we named our system Alchemy: http://www.cs.brown.edu/~sk/Publications/Papers/Published/kdfy-alchemy-trans-alloy-spec-impl/ The paper shows how to generate an executable directly from an Alloy model. It has some nice twists such as automatically maintaining the integrity of the models in the run-time heap. And it *even* generates ... drum roll, please ... PLT Scheme code! We have a paper in progress that further shows how to formalize the relationship between specification and implementation. Since this is pretty off-topic for this list, perhaps direct questions about Alchemy should be addressed to Dan and Kathi (CCed) and me. Shriram From robby at eecs.northwestern.edu Fri May 1 16:55:07 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Fri May 1 16:55:29 2009 Subject: [plt-scheme] build error with svn 14677 In-Reply-To: <2c17707e0905011352iffe5ccfu6a47e7dc0a108b88@mail.gmail.com> References: <2c17707e0905011136s796bf665q1bd7a1656fea5d3b@mail.gmail.com> <18939.23024.428534.523452@winooski.ccs.neu.edu> <2c17707e0905011352iffe5ccfu6a47e7dc0a108b88@mail.gmail.com> Message-ID: <932b2f1f0905011355i71fe70f6mc77a95d4ca3103a7@mail.gmail.com> The svn tree is the latest, but the Makefiles are not guaranteed to always get the right dependencies. They usually work, but if you see problems, best thing is to just blow away the build directory and try again. (And if you see a configure script change or a Makefile.in changes, then probably best to not even try.) Robby On Fri, May 1, 2009 at 3:52 PM, Doug Orleans wrote: > On Fri, May 1, 2009 at 4:22 PM, Eli Barzilay wrote: >> Looks like it might be the result of updating an old source tree -- >> did you try to start with a clean checkout? > > Yes, that works. ?But I thought svn update would always get me the > newest source tree. ?Why doesn't it? ?Did the repository move? > > --dougorleans@gmail.com > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From eli at barzilay.org Fri May 1 17:07:35 2009 From: eli at barzilay.org (Eli Barzilay) Date: Fri May 1 17:07:56 2009 Subject: [plt-scheme] build error with svn 14677 In-Reply-To: <932b2f1f0905011355i71fe70f6mc77a95d4ca3103a7@mail.gmail.com> References: <2c17707e0905011136s796bf665q1bd7a1656fea5d3b@mail.gmail.com> <18939.23024.428534.523452@winooski.ccs.neu.edu> <2c17707e0905011352iffe5ccfu6a47e7dc0a108b88@mail.gmail.com> <932b2f1f0905011355i71fe70f6mc77a95d4ca3103a7@mail.gmail.com> Message-ID: <18939.25751.241399.31455@winooski.ccs.neu.edu> On May 1, Robby Findler wrote: > The svn tree is the latest, but the Makefiles are not guaranteed to > always get the right dependencies. They usually work, but if you see > problems, best thing is to just blow away the build directory and > try again. (And if you see a configure script change or a > Makefile.in changes, then probably best to not even try.) Right. To make it *much* better, you should never build the source tree in place -- that is, don't do this: cd .../plt/src ./configure make make install Do this instead: cd .../plt/src mkdir build cd build ../configure make make install This point is not specific to PLT -- it's generally healthier to do this for any autoconf-based build. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From dougorleans at gmail.com Fri May 1 18:05:34 2009 From: dougorleans at gmail.com (Doug Orleans) Date: Fri May 1 18:06:10 2009 Subject: [plt-scheme] build error with svn 14677 In-Reply-To: <18939.25751.241399.31455@winooski.ccs.neu.edu> References: <2c17707e0905011136s796bf665q1bd7a1656fea5d3b@mail.gmail.com> <18939.23024.428534.523452@winooski.ccs.neu.edu> <2c17707e0905011352iffe5ccfu6a47e7dc0a108b88@mail.gmail.com> <932b2f1f0905011355i71fe70f6mc77a95d4ca3103a7@mail.gmail.com> <18939.25751.241399.31455@winooski.ccs.neu.edu> Message-ID: <2c17707e0905011505q6c65cdd0md87efacdd7e628a8@mail.gmail.com> On Fri, May 1, 2009 at 5:07 PM, Eli Barzilay wrote: > On May ?1, Robby Findler wrote: >> The svn tree is the latest, but the Makefiles are not guaranteed to >> always get the right dependencies. They usually work, but if you see >> problems, best thing is to just blow away the build directory and >> try again. (And if you see a configure script change or a >> Makefile.in changes, then probably best to not even try.) I see, so the problem was not with subversion but with configure? > Do this instead: > > ?cd .../plt/src > ?mkdir build > ?cd build > ?../configure > ?make > ?make install Would the following be equivalent? cd .../plt/src make clean ./configure make make install Or, probably better would be to make clean before doing svn update? --dougorleans@gmail.com From eli at barzilay.org Fri May 1 18:25:17 2009 From: eli at barzilay.org (Eli Barzilay) Date: Fri May 1 18:25:40 2009 Subject: [plt-scheme] build error with svn 14677 In-Reply-To: <2c17707e0905011505q6c65cdd0md87efacdd7e628a8@mail.gmail.com> References: <2c17707e0905011136s796bf665q1bd7a1656fea5d3b@mail.gmail.com> <18939.23024.428534.523452@winooski.ccs.neu.edu> <2c17707e0905011352iffe5ccfu6a47e7dc0a108b88@mail.gmail.com> <932b2f1f0905011355i71fe70f6mc77a95d4ca3103a7@mail.gmail.com> <18939.25751.241399.31455@winooski.ccs.neu.edu> <2c17707e0905011505q6c65cdd0md87efacdd7e628a8@mail.gmail.com> Message-ID: <18939.30413.184692.907966@winooski.ccs.neu.edu> On May 1, Doug Orleans wrote: > On Fri, May 1, 2009 at 5:07 PM, Eli Barzilay wrote: > > On May ?1, Robby Findler wrote: > >> The svn tree is the latest, but the Makefiles are not guaranteed > >> to always get the right dependencies. They usually work, but if > >> you see problems, best thing is to just blow away the build > >> directory and try again. (And if you see a configure script > >> change or a Makefile.in changes, then probably best to not even > >> try.) > > I see, so the problem was not with subversion but with configure? Well, the problem, IIRC, was some leftover makefile. So it's rather a problem of `svn update' not being able to delete files that were not part of svn (like all of the `Makefile's.) > > Do this instead: > > > > ?cd .../plt/src > > ?mkdir build > > ?cd build > > ?../configure > > ?make > > ?make install > > Would the following be equivalent? > > cd .../plt/src > make clean > ./configure > make > make install > > Or, probably better would be to make clean before doing svn update? Running `make clean' before an svn update is better, but still it's not enough -- for example, I don't think that `make clean' removes makefiles, and that was the problem in your case. It's really best to do what I did -- it works just as fine after an `svn up', but when there are changes with files being removed you have the option of blowing up the whole build directory and starting again. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From pocmatos at gmail.com Fri May 1 20:25:44 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri May 1 20:26:20 2009 Subject: [plt-scheme] Re: Remove File Operations In-Reply-To: <18939.23448.330264.844752@winooski.ccs.neu.edu> References: <11b141710904300850v2ccd1833h3e93924fa14fb3e4@mail.gmail.com> <11b141710905010336k4395f0b8h6b9db8217eb5daf9@mail.gmail.com> <11b141710905011014o647ee661pca2148777ead116a@mail.gmail.com> <18939.23448.330264.844752@winooski.ccs.neu.edu> Message-ID: <11b141710905011725p42a0396dh4767003b4708a1d5@mail.gmail.com> On Fri, May 1, 2009 at 8:29 PM, Eli Barzilay wrote: > On May ?1, Paulo J. Matos wrote: >> [...] > > Some possibly relevant & random notes: > > * For backups, I found unison to work very well, except that it's > ?difficult to customize it for different subsets that you want to > ?synchronize. ?I wrote a scheme wrapper that deals with that and that > ?worked fine for me for several years now. > I also use unison for synchronisation but for backup I really would like something that compresses the files. > * For remote file access on linux, there is `sshfs', based on `fuse'. > ?It's extremely convenient to work on any remote machine -- it even > ?works with Windows mounts. ?You basically get to mount a remote path > ?locally, where everything is going through an ssh line underneath. > ?(It took some hacking, but I eventually even managed to hook it to > ?auto mount...) > That's interesting. I could use that indeed, that way I definitely would have this ssh problem. OTOH it would be really nice to have a scheme way to do ssh connections and file operations... lets see... > * For password issues with ssh, a nice solution would be to write an > ?interface to sockets (IIRC, there are existing interfaces in several > ?other implementations with varying degrees of completeness), but a > ?much easier solution is to use some wrapper utility. ?One such thing > ?is `socat' -- you can use it to start a program like ssh and get > ?back two simple input/output ports. > can't understand how would an interface to sockets help, could you please clarify? Cheers, Paulo Matos > -- > ? ? ? ? ?((lambda (x) (x x)) (lambda (x) (x x))) ? ? ? ? ?Eli Barzilay: > ? ? ? ? ? ? ? ? ?http://www.barzilay.org/ ? ? ? ? ? ? ? ? Maze is Life! > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From eli at barzilay.org Fri May 1 20:36:03 2009 From: eli at barzilay.org (Eli Barzilay) Date: Fri May 1 20:36:24 2009 Subject: [plt-scheme] Re: Remove File Operations In-Reply-To: <11b141710905011725p42a0396dh4767003b4708a1d5@mail.gmail.com> References: <11b141710904300850v2ccd1833h3e93924fa14fb3e4@mail.gmail.com> <11b141710905010336k4395f0b8h6b9db8217eb5daf9@mail.gmail.com> <11b141710905011014o647ee661pca2148777ead116a@mail.gmail.com> <18939.23448.330264.844752@winooski.ccs.neu.edu> <11b141710905011725p42a0396dh4767003b4708a1d5@mail.gmail.com> Message-ID: <18939.38259.425661.117406@winooski.ccs.neu.edu> On May 2, Paulo J. Matos wrote: > On Fri, May 1, 2009 at 8:29 PM, Eli Barzilay wrote: > > On May ?1, Paulo J. Matos wrote: > >> [...] > > > > Some possibly relevant & random notes: > > > > * For backups, I found unison to work very well, except that it's > > ?difficult to customize it for different subsets that you want to > > ?synchronize. ?I wrote a scheme wrapper that deals with that and > > ?that worked fine for me for several years now. > > I also use unison for synchronisation but for backup I really would > like something that compresses the files. `rsync'? Or do you mean compress the files on the target machine? > > * For password issues with ssh, a nice solution would be to write an > > ?interface to sockets (IIRC, there are existing interfaces in > > ?several other implementations with varying degrees of > > ?completeness), but a much easier solution is to use some wrapper > > ?utility. ?One such thing is `socat' -- you can use it to start a > > ?program like ssh and get back two simple input/output ports. > > can't understand how would an interface to sockets help, could you > please clarify? It makes it possible to run ssh as a subprocess, and feed it the password (that the scheme code will obtain in some way). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From pocmatos at gmail.com Fri May 1 20:40:05 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri May 1 20:40:41 2009 Subject: [plt-scheme] Re: Remove File Operations In-Reply-To: <18939.38259.425661.117406@winooski.ccs.neu.edu> References: <11b141710904300850v2ccd1833h3e93924fa14fb3e4@mail.gmail.com> <11b141710905010336k4395f0b8h6b9db8217eb5daf9@mail.gmail.com> <11b141710905011014o647ee661pca2148777ead116a@mail.gmail.com> <18939.23448.330264.844752@winooski.ccs.neu.edu> <11b141710905011725p42a0396dh4767003b4708a1d5@mail.gmail.com> <18939.38259.425661.117406@winooski.ccs.neu.edu> Message-ID: <11b141710905011740uc454ddcs97fdbe63aa47ba7b@mail.gmail.com> On Sat, May 2, 2009 at 12:36 AM, Eli Barzilay wrote: > On May ?2, Paulo J. Matos wrote: >> On Fri, May 1, 2009 at 8:29 PM, Eli Barzilay wrote: >> > On May ?1, Paulo J. Matos wrote: >> >> [...] >> > >> > Some possibly relevant & random notes: >> > >> > * For backups, I found unison to work very well, except that it's >> > ?difficult to customize it for different subsets that you want to >> > ?synchronize. ?I wrote a scheme wrapper that deals with that and >> > ?that worked fine for me for several years now. >> >> I also use unison for synchronisation but for backup I really would >> like something that compresses the files. > > `rsync'? ?Or do you mean compress the files on the target machine? > There's also rdiff-backup, but yes, I want to compress them on the target machine. > >> > * For password issues with ssh, a nice solution would be to write an >> > ?interface to sockets (IIRC, there are existing interfaces in >> > ?several other implementations with varying degrees of >> > ?completeness), but a much easier solution is to use some wrapper >> > ?utility. ?One such thing is `socat' -- you can use it to start a >> > ?program like ssh and get back two simple input/output ports. >> >> can't understand how would an interface to sockets help, could you >> please clarify? > > It makes it possible to run ssh as a subprocess, and feed it the > password (that the scheme code will obtain in some way). > but can't I do that already using PLT-Scheme, running ssh as a subprocess? > -- > ? ? ? ? ?((lambda (x) (x x)) (lambda (x) (x x))) ? ? ? ? ?Eli Barzilay: > ? ? ? ? ? ? ? ? ?http://www.barzilay.org/ ? ? ? ? ? ? ? ? Maze is Life! > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From eli at barzilay.org Fri May 1 20:54:30 2009 From: eli at barzilay.org (Eli Barzilay) Date: Fri May 1 20:55:10 2009 Subject: [plt-scheme] Re: Remove File Operations In-Reply-To: <11b141710905011740uc454ddcs97fdbe63aa47ba7b@mail.gmail.com> References: <11b141710904300850v2ccd1833h3e93924fa14fb3e4@mail.gmail.com> <11b141710905010336k4395f0b8h6b9db8217eb5daf9@mail.gmail.com> <11b141710905011014o647ee661pca2148777ead116a@mail.gmail.com> <18939.23448.330264.844752@winooski.ccs.neu.edu> <11b141710905011725p42a0396dh4767003b4708a1d5@mail.gmail.com> <18939.38259.425661.117406@winooski.ccs.neu.edu> <11b141710905011740uc454ddcs97fdbe63aa47ba7b@mail.gmail.com> Message-ID: <18939.39366.253285.430501@winooski.ccs.neu.edu> On May 2, Paulo J. Matos wrote: > On Sat, May 2, 2009 at 12:36 AM, Eli Barzilay wrote: > > It makes it possible to run ssh as a subprocess, and feed it the > > password (that the scheme code will obtain in some way). > > but can't I do that already using PLT-Scheme, running ssh as a > subprocess? No -- ssh doesn't read the password as a normal input (try it, you'll see). ssh wrapped in socat does though. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From pocmatos at gmail.com Fri May 1 20:54:27 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri May 1 20:55:16 2009 Subject: [plt-scheme] Re: Expressivity gap between formal methods and PL's In-Reply-To: References: <46929267-1279-4735-8722-094304ac6c40@s1g2000prd.googlegroups.com> <11b141710904301102s26608eds907a6891b62f63c1@mail.gmail.com> <11b141710904301225p2dc78eb1q81a31346e81e5736@mail.gmail.com> <11b141710905011206q28f84781j528abc1bf0519b6a@mail.gmail.com> Message-ID: <11b141710905011754t1117b370jab8d8300d641e6cc@mail.gmail.com> On Fri, May 1, 2009 at 8:54 PM, Shriram Krishnamurthi wrote: > Sorry I've dozed through most of this thread, but: > >> Alloy is relational logic without an execution model. ?It's >> declarative. You write your model declarative, write a couple of >> facts and that's it. FAR, FAAAAAAAAR, away from an 'executable' and >> generating an executable directly from an Alloy mode wouldn't even >> make sense. > > In that case, it is just as well that we named our system Alchemy: > > http://www.cs.brown.edu/~sk/Publications/Papers/Published/kdfy-alchemy-trans-alloy-spec-impl/ > I skimmed the paper... very nice. > The paper shows how to generate an executable directly from an Alloy > model. ?It has some nice twists such as automatically maintaining the > integrity of the models in the run-time heap. ?And it *even* generates > ... drum roll, please ... PLT Scheme code! > > We have a paper in progress that further shows how to formalize the > relationship between specification and implementation. > I will look into the paper more closely but I don't think this is what wooks had in mind when he asked for an implementation given a specification. I think he was more thinking along the lines of having a way to implement his program in Alloy and then compile it into an executable that can be ran on a clients machine. I don't think the Alloy language is ready for this. My paragraph regarding that Alloy is a declarative language with no execution model is still true and it is far from an executable (as in a program ready to be deployed). Just the lack of output and input primitives turn the language into an environment where this couldn't happen. You can always implement in alloy a specific execution model but it will never be what the original poster asked for. I did this to model check event-b by encoding into alloy in: http://dx.doi.org/10.1007/978-3-540-87603-8_34 I will however read your paper carefully, so I am sorry if I made any incorrect assumption about it. > Since this is pretty off-topic for this list, perhaps direct questions > about Alchemy should be addressed to Dan and Kathi (CCed) and me. > > Shriram > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From neil at neilvandyke.org Fri May 1 21:10:02 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Fri May 1 21:10:49 2009 Subject: [plt-scheme] Re: Remove File Operations In-Reply-To: <18939.39366.253285.430501@winooski.ccs.neu.edu> References: <11b141710904300850v2ccd1833h3e93924fa14fb3e4@mail.gmail.com> <11b141710905010336k4395f0b8h6b9db8217eb5daf9@mail.gmail.com> <11b141710905011014o647ee661pca2148777ead116a@mail.gmail.com> <18939.23448.330264.844752@winooski.ccs.neu.edu> <11b141710905011725p42a0396dh4767003b4708a1d5@mail.gmail.com> <18939.38259.425661.117406@winooski.ccs.neu.edu> <11b141710905011740uc454ddcs97fdbe63aa47ba7b@mail.gmail.com> <18939.39366.253285.430501@winooski.ccs.neu.edu> Message-ID: <49FB9D6A.70800@neilvandyke.org> BTW, in case anyone doesn't know, in some cases you can avoid "ssh" prompting for a password by running an "ssh-agent" process to which the keys have been added. Modern Linux desktop environments will tend to secretly do this for you, but you can also do it manually, such as for running SSH from batch processes. I suppose you could also implement "ssh-agent" behavior in PLT Scheme, perhaps even in the same Scheme interpreter native process that is exec-ing the "ssh" native process. That would be one alternative to implementing SSH protocol in Scheme. -- http://www.neilvandyke.org/ From dougorleans at gmail.com Fri May 1 22:35:37 2009 From: dougorleans at gmail.com (Doug Orleans) Date: Fri May 1 22:36:09 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: <20090429215352.9A03B6500D7@mail-svr1.cs.utah.edu> References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> <20090419155630.368466500AD@mail-svr1.cs.utah.edu> <2c17707e0904282002p60b28e2ev6a8debfff05bad47@mail.gmail.com> <20090429215352.9A03B6500D7@mail-svr1.cs.utah.edu> Message-ID: <2c17707e0905011935r78af81ar611b6ca285142252@mail.gmail.com> On Wed, Apr 29, 2009 at 5:53 PM, Matthew Flatt wrote: > With our implementation, immutable hash tables are probably only better > when they give you a better algorithm --- one that can needs O(1) > operations on a mapping and where the operations are aren't > "single-threaded" in the cumulative sense (i.e., you start with some > mapping and you want to extend it in different, independent ways). By the way, is for/hash implemented using a mutable hash table during the loop? Or is the constant factor slowdown not high enough to bother? --dougorleans@gmail.com From michele.simionato at gmail.com Sat May 2 00:24:02 2009 From: michele.simionato at gmail.com (Michele Simionato) Date: Sat May 2 00:24:20 2009 Subject: [plt-scheme] exporting mutable identifiers Message-ID: The R6RS (section 7.2) says that """ All explicitly exported variables are immutable in both the exporting and importing libraries. It is thus a syntax violation if an explicitly exported variable appears on the left-hand side of a set! expression, either in the exporting or importing libraries. """ I tried this program #!r6rs (library (experimental mod1) (export x incr-x) (import (rnrs)) (define x 0) (define (incr-x) (set! x (+ 1 x)) x) ) on Ikarus, Ypsilon and Larceny and indeed it fails with a "attempted to mutate an immutable variable" error. However plt-r6rs does not give any warning and compiles the library just fine, at least in PLT 4.0. Maybe this has been fixed in later versions but I wanted to report it, just to ask what it is the situation now. Michele Simionato From wookiz at hotmail.com Sat May 2 07:06:46 2009 From: wookiz at hotmail.com (wooks .) Date: Sat May 2 07:12:07 2009 Subject: [plt-scheme] Re: Expressivity gap between formal methods and PL's In-Reply-To: <11b141710905011754t1117b370jab8d8300d641e6cc@mail.gmail.com> References: <46929267-1279-4735-8722-094304ac6c40@s1g2000prd.googlegroups.com> <11b141710904301102s26608eds907a6891b62f63c1@mail.gmail.com> <11b141710904301225p2dc78eb1q81a31346e81e5736@mail.gmail.com> <11b141710905011206q28f84781j528abc1bf0519b6a@mail.gmail.com> <11b141710905011754t1117b370jab8d8300d641e6cc@mail.gmail.com> Message-ID: > From: pocmatos@gmail.com > Date: Sat, 2 May 2009 00:54:27 +0000 > Subject: Re: [plt-scheme] Re: Expressivity gap between formal methods and PL's > To: sk@cs.brown.edu > CC: wookiz@hotmail.com; plt-scheme@list.cs.brown.edu; kfisler@gmail.com; dd@cs.wpi.edu > > >> The paper shows how to generate an executable directly from an Alloy >> model. It has some nice twists such as automatically maintaining the >> integrity of the models in the run-time heap. And it *even* generates >> ... drum roll, please ... PLT Scheme code! >> >> We have a paper in progress that further shows how to formalize the >> relationship between specification and implementation. >> > > I will look into the paper more closely but I don't think this is what > wooks had in mind when he asked for an implementation given a > specification. I think he was more thinking along the lines of having > a way to implement his program in Alloy and then compile it into an > executable that can be ran on a clients machine. I don't think the > Alloy language is ready for this. It is what I had in mind. I'm looking at intelligent ways of doing test design and arguing against attempting to derive tests automatically from formal specifications. Instead I suggest using the formal specification to generate a test oracle. That argument is strengthened if it is feasible to generate an executable system from the formal specification. _________________________________________________________________ Share your photos with Windows Live Photos ? Free. http://clk.atdmt.com/UKM/go/134665338/direct/01/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090502/58bb45f3/attachment.html From hellomorganpackard at gmail.com Fri May 1 09:56:21 2009 From: hellomorganpackard at gmail.com (morgancodes) Date: Sat May 2 08:06:00 2009 Subject: [plt-scheme] How to get set up for The Structure and Interpretation of Computer Programs Message-ID: <0ad0f652-54f9-49ff-b835-ffa7280599b4@b7g2000pre.googlegroups.com> Hello, Wondering if anyone can point me toward a way to get set up to work through this book. I'd like to set up Dr. Scheme so I'm using the correct dialect etc. thanks, -Morgan From mustafacanb89 at gmail.com Fri May 1 14:08:36 2009 From: mustafacanb89 at gmail.com (Mustafa Can Buken) Date: Sat May 2 08:06:11 2009 Subject: [plt-scheme] help for DFS illustration Message-ID: <361ba466-04d8-436d-8754-6d0ab7c7df83@r37g2000yqn.googlegroups.com> Hello to everybody; I am a student in Istanbul Bilgi University Computer Sciences Department as a first year student. Our teacher makes four of us as a group and gave an assinment about illustration of DFS algorithm. User will give a graph and an endpoint and Dr. Scheme environment will draw that graph with using DFS algorithm First of all I want to say that we tried something about DFS illustration on DrScheme environment but because of our less knowledge in world.ss teachpack, we experienced some problems about that topic. Can somebody give us a clue about that. It can be pseudo code of our problem or you can say first do something then ... then ... We really don't know how to do this illustration and we should do that till 8th of May and will present it. Wanting a code is a bad habbit I know, so I want to take advice about how to do this illustration, which things that we should do. Thanks to everybody for helps. Your sincerely, Mustafa Can Buken From grettke at acm.org Sat May 2 08:20:58 2009 From: grettke at acm.org (Grant Rettke) Date: Sat May 2 08:21:17 2009 Subject: [plt-scheme] help for DFS illustration In-Reply-To: <361ba466-04d8-436d-8754-6d0ab7c7df83@r37g2000yqn.googlegroups.com> References: <361ba466-04d8-436d-8754-6d0ab7c7df83@r37g2000yqn.googlegroups.com> Message-ID: <756daca50905020520s7ed528fchb0459d8cb2b1ffc2@mail.gmail.com> On Fri, May 1, 2009 at 1:08 PM, Mustafa Can Buken wrote: > Wanting a code is a bad habbit I know, so I want to take advice about > how to do this illustration, which things that we should do. Thanks to > everybody for helps. #lang scheme/gui ;; string->color% : (string? arg) -> (is-a? result color%) ;; To find a color% by name. ;; Delegates work to the the-color-database, of type color-database<%>. ;; (string->color% "Tomato") -> color% ;; (string->color% "Violet") -> color% ;; (string->color% "Sienna") -> color% ;; (string->color% "Chocolate") -> color% ;; See the color-database<%> documentation for a list of color names. (define (string->color% name) (send the-color-database find-color name)) ;; bitmap%->image-snip% : ;; (is-a? arg bitmap%) -> (is-a? result image-snip%) ;; To create a snip configurd to display the contents of the bitmap%. ;; image-snip%s can be displayed in the definitions windows (REPL). (define (bitmap%->image-snip% bitmap) (let ((snip (make-object image-snip%))) (begin (send snip set-bitmap bitmap) snip))) (define (make-sample-bitmap% width height) (let ((bitmap (make-object bitmap% width height)) (dc (new bitmap-dc%)) (white (string->color% "White")) (black (string->color% "Black"))) (begin ;; connect the bitmap to the dc (send dc set-bitmap bitmap) ;; enable anti-aliasing (send dc set-smoothing 'aligned) ;; configure the drawing pen and brush for the background (send dc set-pen (make-object pen% white 1 'solid)) (send dc set-brush (make-object brush% white 'solid)) ;; draw the solid background color (send dc draw-rectangle 0 0 width height) ;; configure the drawing pen and brush for the foreground (send dc set-pen black 1 'solid) (send dc set-brush (make-object brush% black 'solid)) ;; draw a shape (let ((x (/ width 2)) (y (/ height 2))) (send dc draw-ellipse x y x y)) ;; disconnect the bitmap from the dc (send dc set-bitmap #f) bitmap))) (define a-bitmap (make-sample-bitmap% 100 100)) (bitmap%->image-snip% a-bitmap) From sk at cs.brown.edu Sat May 2 08:47:22 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sat May 2 08:48:00 2009 Subject: [plt-scheme] Re: Expressivity gap between formal methods and PL's In-Reply-To: References: <46929267-1279-4735-8722-094304ac6c40@s1g2000prd.googlegroups.com> <11b141710904301102s26608eds907a6891b62f63c1@mail.gmail.com> <11b141710904301225p2dc78eb1q81a31346e81e5736@mail.gmail.com> <11b141710905011206q28f84781j528abc1bf0519b6a@mail.gmail.com> <11b141710905011754t1117b370jab8d8300d641e6cc@mail.gmail.com> Message-ID: Dear wooks, Having gone back and re-read the thread, I can see why Paulo has difficulty telling what you had in mind, because it keeps slipping and sliding. You've switched from talking about testing to implementing back to testing again. With such slipperiness of expression, you either badly need a spec language or you will have great difficulty with one, or both. (-: If what you want to do is generate tests from formal specifications, that's a simpler problem with much better-developed solutions. For a concrete example, look at Marinov and Khurshid's "TestEra" (which too is based on Alloy), and follow pointers backward and forward. Shriram From wookiz at hotmail.com Sat May 2 10:22:07 2009 From: wookiz at hotmail.com (wooks) Date: Sat May 2 10:22:31 2009 Subject: [plt-scheme] Re: Expressivity gap between formal methods and PL's In-Reply-To: References: <46929267-1279-4735-8722-094304ac6c40@s1g2000prd.googlegroups.com> <11b141710904301102s26608eds907a6891b62f63c1@mail.gmail.com> <11b141710904301225p2dc78eb1q81a31346e81e5736@mail.gmail.com> <11b141710905011206q28f84781j528abc1bf0519b6a@mail.gmail.com> <11b141710905011754t1117b370jab8d8300d641e6cc@mail.gmail.com> Message-ID: On May 2, 1:47 pm, Shriram Krishnamurthi wrote: > Dear wooks, > > Having gone back and re-read the thread, I can see why Paulo has > difficulty telling what you had in mind, because it keeps slipping and > sliding. You've switched from talking about testing to implementing > back to testing again. With such slipperiness of expression, you > either badly need a spec language or you will have great difficulty > with one, or both. (-: > My theme has consistently been the optimal exploitation of a formal specification in a software testing context. Your slipping and sliding is my contrarian view.......(all in good humour mind) > > If what you want to do is generate tests from formal specifications, > that's a simpler problem with much better-developed solutions. I don't want to generate tests from a formal specification. I thought that was pretty clear from my immediately preceding post. I understand it's seems the perfectly natural and obvious thing to want to do, but my contrarian viewpoint is that I don't want to do it. > > For a > concrete example, look at Marinov and Khurshid's "TestEra" (which too > is based on Alloy), and follow pointers backward and forward. > I had a quick scan of the paper - and have not changed my view. It looks like it is targeted at unit testing which is not the problem I'm interested in solving. Black box testing at the method level as they describe in section 8.6 doesn't cut it - it's just a unit test done without relying on the structure of the code. They talk about extending TestEra's analysis to report structural code coverage .... rm :: symbol -> [symbol] -> [symbol] ;; Program to remove the symbol x from a list (if present) and return the remaining list (define rm (lambda (x a-list) (cond [(empty? a-list] empty] [(eq? x (first a-list)) (rest a-list)] [else (rm x (rest a-list))]))) The number of tests required for 100% code coverage is 3 (1 per cond clause), wholly inadequate to test the program properly. So what useful knowledge about a module does a 100% code coverage metric give me? Suppose my metric was 62% - should I worry. Maybe not. The module may have 38% dead code but there is no automated way of detecting that. I'm interested in using formal specifications to generate test oracles. Not for testing methods (thats unit testing and not interesting) but for testing systems. From zeppieri at gmail.com Sat May 2 11:56:19 2009 From: zeppieri at gmail.com (Jon Zeppieri) Date: Sat May 2 11:56:37 2009 Subject: [plt-scheme] typed scheme problem Message-ID: <7622cdaf0905020856n74823cf7o927e3c54cead39d2@mail.gmail.com> Hi, I'm getting a type error I can't resolve, and my best attempt to resolve it has resulted in a nonsensical error message. In one module I have: ===== #lang typed-scheme (require scheme/promise) ;; Lazy streams (define-type-alias (Stream A) (Promise (U StreamNil (StreamPair A)))) (define-struct: StreamNil ()) (define-struct: (A) StreamPair ((x : A) (xs : (Stream A)))) (provide StreamNil StreamPair Stream) ===== And in another: ===== #lang typed-scheme (require scheme/match) (require scheme/promise) (require "stream.ss") ;; Parser Combinators (define-struct: (A T) Ok ((ans : A) (tks : (Stream T)) (ncur : Integer) (nmax : Integer))) (define-struct: Fail ((nmax : Integer))) (define-type-alias (ParserResult A T) (U (Ok A T) Fail)) (define-type-alias (Parser A T) ((Stream T) Integer Integer -> (ParserResult A T))) (: any (All (A) (-> (Parser A A)))) (define (any) (? (tks ncur nmax) (match (force tks) ((struct StreamNil ()) (make-Fail nmax)) ((struct StreamPair (x xs)) (let* ((ncur (+ ncur 1)) (nmax (if (> ncur nmax) ncur nmax))) (make-Ok x xs ncur nmax)))))) ===== 'any' fails to typecheck with the message: typecheck: Polymorphic function force could not be applied to arguments: Domain: #(struct:Promise (a)) Arguments: #(struct:Promise ((U StreamNil16 (StreamPair18 A)))) in: (force tks) So, fair enough: maybe I have to instantiate force's type variable. So, I try: (match (#{force @ (U StreamNil (StreamPair A))} tks) ... and get the error: typecheck: Wrong function argument type, expected #(struct:Promise ((U StreamNil16 (StreamPair18 A)))), got #(struct:Promise ((U StreamNil16 (StreamPair18 A)))) for argument 1 in: tks Unfortunately, there's no way to tell from that error message why the argument type is wrong. In fact, it looks to be correct. Any thoughts? -jaz From etanter at dcc.uchile.cl Sat May 2 12:02:08 2009 From: etanter at dcc.uchile.cl (Eric Tanter) Date: Sat May 2 12:02:30 2009 Subject: [plt-scheme] redex: recursive metafunctions Message-ID: <15BA5B12-CDED-41D4-8E18-BA3DCB32CAFE@dcc.uchile.cl> Hi, A beginner's question on recursive metafunctions in redex. The documentation says: "Each of the rhs-expressions is implicitly wrapped in term. In addition, recursive calls in the right-hand side of the metafunction clauses should appear inside term." but none of the example metafunctions given afterward use (term...) to make recursive calls. eg: (define-metafunction lc-lang free-vars : e -> (x ...) [(free-vars (e_1 e_2 ...)) (? (free-vars e_1) (free-vars e_2) ...)] [(free-vars x) (x)] [(free-vars (lambda (x ...) e)) (- (free-vars e) (x ...))]) What is the reason for that? On the other hand, I'm trying to define a recursive metafunction (called collect-d) and use it from my reductions. I get an error "collect-d: (collect-d) is not in my domain" The defintion of collect-d is: (define-metafunction ?env collect-d : (env (x v s) ...) -> (env (x v s) ...) ((collect-d (env)) (env)) ((collect-d (env (x_0 v_0 (b_0 true)) (x_1 v_1 s_1) ...)) (env-append (env (x_0 v_0 (b_0 true))) (collect-d (x_1 v_1 s_1) ...))) ((collect-d (env (x_0 v_0 (b_0 false)) (x_1 v_1 s_1) ...)) (collect-d (x_1 v_1 s_1) ...))) [env-append is another (non-recursive) metafunction, which works fine] Note that I have tried to put all recursive calls to collect-d in a (term ...), but I get the same error. To give an idea of how I actually call the metafunction, this is a reduction rule that uses it: (--> ((env (x v s) ...) (in-hole E_1 (? (x_1) e))) ((env (x v s) ...) (in-hole E_1 (closure x_1 e (collect-d (env (x v s) ...))))) "fun") Any idea what I'm doing plain wrong here? Thanks, -- ?ric From robby at eecs.northwestern.edu Sat May 2 12:05:57 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat May 2 12:06:19 2009 Subject: [plt-scheme] redex: recursive metafunctions In-Reply-To: <15BA5B12-CDED-41D4-8E18-BA3DCB32CAFE@dcc.uchile.cl> References: <15BA5B12-CDED-41D4-8E18-BA3DCB32CAFE@dcc.uchile.cl> Message-ID: <932b2f1f0905020905v22f3d650wfe3b7daa2f7a02ec@mail.gmail.com> On Sat, May 2, 2009 at 11:02 AM, Eric Tanter wrote: > Hi, > > A beginner's question on recursive metafunctions in redex. > > The documentation says: > "Each of the rhs-expressions is implicitly wrapped in term. > In addition, > recursive calls in the right-hand side of the metafunction clauses should > appear inside term." This sentence is at best confusing and at worse just plain wrong depending on how you read it. I've just cut it from the docs. > but none of the example metafunctions given afterward use (term...) to make > recursive calls. > eg: > (define-metafunction lc-lang > ? ?free-vars : e -> (x ...) > ? ?[(free-vars (e_1 e_2 ...)) > ? ? (? (free-vars e_1) (free-vars e_2) ...)] > ? ?[(free-vars x) (x)] > ? ?[(free-vars (lambda (x ...) e)) > ? ? (- (free-vars e) (x ...))]) > > What is the reason for that? > > On the other hand, I'm trying to define a recursive metafunction (called > collect-d) and use it from my reductions. > > I get an error "collect-d: (collect-d) is not in my domain" > > The defintion of collect-d is: > > (define-metafunction ?env > ?collect-d : (env (x v s) ...) -> (env (x v s) ...) > ?((collect-d (env)) (env)) > ?((collect-d (env (x_0 v_0 (b_0 true)) (x_1 v_1 s_1) ...)) > ? (env-append (env (x_0 v_0 (b_0 true))) (collect-d (x_1 v_1 s_1) ...))) The recursive call just above looks like it is missing "(env ..)" around its argument. > ?((collect-d (env (x_0 v_0 (b_0 false)) (x_1 v_1 s_1) ...)) > ? (collect-d (x_1 v_1 s_1) ...))) Same for this one. Robby > [env-append is another (non-recursive) metafunction, which works fine] > > Note that I have tried to put all recursive calls to collect-d in a (term > ...), but I get the same error. > > To give an idea of how I actually call the metafunction, this is a reduction > rule that uses it: > > ? (--> ((env (x v s) ...) (in-hole E_1 (? (x_1) e))) > ? ? ? ?((env (x v s) ...) (in-hole E_1 (closure x_1 e > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (collect-d (env (x v s) > ...))))) > ? ? ? ?"fun") > > Any idea what I'm doing plain wrong here? > > Thanks, > > -- ?ric_________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From etanter at dcc.uchile.cl Sat May 2 12:14:06 2009 From: etanter at dcc.uchile.cl (Eric Tanter) Date: Sat May 2 12:14:26 2009 Subject: [plt-scheme] redex: recursive metafunctions In-Reply-To: <932b2f1f0905020905v22f3d650wfe3b7daa2f7a02ec@mail.gmail.com> References: <15BA5B12-CDED-41D4-8E18-BA3DCB32CAFE@dcc.uchile.cl> <932b2f1f0905020905v22f3d650wfe3b7daa2f7a02ec@mail.gmail.com> Message-ID: <541559B6-B7A8-402B-984F-6E59FE2C762C@dcc.uchile.cl> >> In addition, >> recursive calls in the right-hand side of the metafunction clauses >> should >> appear inside term." > > This sentence is at best confusing and at worse just plain wrong > depending on how you read it. I've just cut it from the docs. good! I must have read it 100 times trying to figure out what it meant... thanks for the debugging, it now works perfectly (sorry it was so trivial ;)) -- ?ric From matthias at ccs.neu.edu Sat May 2 12:30:39 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sat May 2 12:31:15 2009 Subject: [plt-scheme] typed scheme problem In-Reply-To: <7622cdaf0905020856n74823cf7o927e3c54cead39d2@mail.gmail.com> References: <7622cdaf0905020856n74823cf7o927e3c54cead39d2@mail.gmail.com> Message-ID: On May 2, 2009, at 11:56 AM, Jon Zeppieri wrote: > typecheck: Wrong function argument type, expected #(struct:Promise ((U > StreamNil16 (StreamPair18 A)))), got #(struct:Promise ((U StreamNil16 > (StreamPair18 A)))) for argument 1 in: tks Speculation: This looks like type checking with generative define struct went wrong. I know that this isn't helpful but we didn't have gen ds but Sam and I discussed adding it (in the same spirit as gen datatype in SML). So perhaps he tried and introduced a bug (though this kind of bug shouldn't pass the regression tests). -- Matthias From etanter at dcc.uchile.cl Sat May 2 12:34:35 2009 From: etanter at dcc.uchile.cl (Eric Tanter) Date: Sat May 2 12:35:06 2009 Subject: [plt-scheme] redex: recursive metafunctions In-Reply-To: <932b2f1f0905020905v22f3d650wfe3b7daa2f7a02ec@mail.gmail.com> References: <15BA5B12-CDED-41D4-8E18-BA3DCB32CAFE@dcc.uchile.cl> <932b2f1f0905020905v22f3d650wfe3b7daa2f7a02ec@mail.gmail.com> Message-ID: <09D98905-334D-466F-9AA8-BA6DEA6A9E98@dcc.uchile.cl> >> I get an error "collect-d: (collect-d) is not in my domain" >> >> The defintion of collect-d is: >> >> (define-metafunction ?env >> collect-d : (env (x v s) ...) -> (env (x v s) ...) >> ((collect-d (env)) (env)) >> ((collect-d (env (x_0 v_0 (b_0 true)) (x_1 v_1 s_1) ...)) >> (env-append (env (x_0 v_0 (b_0 true))) (collect-d (x_1 v_1 >> s_1) ...))) > > The recursive call just above looks like it is missing "(env ..)" > around its argument. Just wondering: since the contract of the metafunction is clear, couldn't it be possible to report more precisely what the problem is (similarly to contract violations), something along the lines of: "collect-d broken contract: expected (env (x v s) ...) given (x v s) (other arguments were ...)" ? -- ?ric From etanter at dcc.uchile.cl Sat May 2 12:42:11 2009 From: etanter at dcc.uchile.cl (Eric Tanter) Date: Sat May 2 12:42:32 2009 Subject: [plt-scheme] redex: testing stuck states Message-ID: <95B885E3-CF25-4810-A7D9-CE728C6787A7@dcc.uchile.cl> Hi, Is it possible to write a test to check that a certain term results in a stuck state? -- ?ric From clements at brinckerhoff.org Sat May 2 12:43:46 2009 From: clements at brinckerhoff.org (John Clements) Date: Sat May 2 12:44:24 2009 Subject: [plt-scheme] redex: testing stuck states In-Reply-To: <95B885E3-CF25-4810-A7D9-CE728C6787A7@dcc.uchile.cl> References: <95B885E3-CF25-4810-A7D9-CE728C6787A7@dcc.uchile.cl> Message-ID: On May 2, 2009, at 9:42 AM, Eric Tanter wrote: > Hi, > > Is it possible to write a test to check that a certain term results > in a stuck state? Check that the result of 'apply-reduction-relation' is the empty list? 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/20090502/91ee4f35/smime.bin From etanter at dcc.uchile.cl Sat May 2 12:46:15 2009 From: etanter at dcc.uchile.cl (Eric Tanter) Date: Sat May 2 12:47:01 2009 Subject: [plt-scheme] redex: testing stuck states In-Reply-To: References: <95B885E3-CF25-4810-A7D9-CE728C6787A7@dcc.uchile.cl> Message-ID: <3A6B4E0A-A976-4A0F-9D26-1E7D8B5221F7@dcc.uchile.cl> well, actually I found out a solution: just use test-->> and specify the expected 'stuck term'. thanks, -- ?ric On May 2, 2009, at 12:43 , John Clements wrote: > > On May 2, 2009, at 9:42 AM, Eric Tanter wrote: > >> Hi, >> >> Is it possible to write a test to check that a certain term results >> in a stuck state? > > Check that the result of 'apply-reduction-relation' is the empty list? > > John > From robby at eecs.northwestern.edu Sat May 2 13:17:21 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat May 2 13:17:57 2009 Subject: [plt-scheme] redex: recursive metafunctions In-Reply-To: <09D98905-334D-466F-9AA8-BA6DEA6A9E98@dcc.uchile.cl> References: <15BA5B12-CDED-41D4-8E18-BA3DCB32CAFE@dcc.uchile.cl> <932b2f1f0905020905v22f3d650wfe3b7daa2f7a02ec@mail.gmail.com> <09D98905-334D-466F-9AA8-BA6DEA6A9E98@dcc.uchile.cl> Message-ID: <932b2f1f0905021017p1271ccb3j2dc92bc095a63ff2@mail.gmail.com> Well, the contract is written on the metafunction and since there are no HO contracts, I didn't include that in the error message (altho if you still think it would help, I could). But as for the other, that is what you got. The function was called like this: (collect-d) . Robby On Sat, May 2, 2009 at 11:34 AM, Eric Tanter wrote: >>> I get an error "collect-d: (collect-d) is not in my domain" >>> >>> The defintion of collect-d is: >>> >>> (define-metafunction ?env >>> ?collect-d : (env (x v s) ...) -> (env (x v s) ...) >>> ?((collect-d (env)) (env)) >>> ?((collect-d (env (x_0 v_0 (b_0 true)) (x_1 v_1 s_1) ...)) >>> ?(env-append (env (x_0 v_0 (b_0 true))) (collect-d (x_1 v_1 s_1) ...))) >> >> The recursive call just above looks like it is missing "(env ..)" >> around its argument. > > Just wondering: since the contract of the metafunction is clear, couldn't it > be possible to report more precisely what the problem is (similarly to > contract violations), something along the lines of: > "collect-d broken contract: expected (env (x v s) ...) given (x v s) (other > arguments were ...)" > > ? > > -- ?ric From zeppieri at gmail.com Sat May 2 13:17:26 2009 From: zeppieri at gmail.com (Jon Zeppieri) Date: Sat May 2 13:18:01 2009 Subject: [plt-scheme] typed scheme problem In-Reply-To: References: <7622cdaf0905020856n74823cf7o927e3c54cead39d2@mail.gmail.com> Message-ID: <7622cdaf0905021017o7ae4f18ay8249eb4012f0c44a@mail.gmail.com> On Sat, May 2, 2009 at 12:30 PM, Matthias Felleisen wrote: > > On May 2, 2009, at 11:56 AM, Jon Zeppieri wrote: > >> typecheck: Wrong function argument type, expected #(struct:Promise ((U >> StreamNil16 (StreamPair18 A)))), got #(struct:Promise ((U StreamNil16 >> (StreamPair18 A)))) for argument 1 in: tks > > > Speculation: This looks like type checking with generative define struct > went wrong. I know that this isn't helpful but we didn't have gen ds but Sam > and I discussed adding it (in the same spirit as gen datatype in SML). So > perhaps he tried and introduced a bug (though this kind of bug shouldn't > pass the regression tests). -- Matthias > > It turns out, if I move the stream definitions into the parser combinator module (rather than having the latter require them from a separate module), it typechecks fine. So it seems to be an inter-module problem. -jaz From etanter at dcc.uchile.cl Sat May 2 13:21:13 2009 From: etanter at dcc.uchile.cl (Eric Tanter) Date: Sat May 2 13:21:36 2009 Subject: [plt-scheme] redex: recursive metafunctions In-Reply-To: <932b2f1f0905021017p1271ccb3j2dc92bc095a63ff2@mail.gmail.com> References: <15BA5B12-CDED-41D4-8E18-BA3DCB32CAFE@dcc.uchile.cl> <932b2f1f0905020905v22f3d650wfe3b7daa2f7a02ec@mail.gmail.com> <09D98905-334D-466F-9AA8-BA6DEA6A9E98@dcc.uchile.cl> <932b2f1f0905021017p1271ccb3j2dc92bc095a63ff2@mail.gmail.com> Message-ID: On May 2, 2009, at 13:17 , Robby Findler wrote: > Well, the contract is written on the metafunction and since there are > no HO contracts, I didn't include that in the error message (altho if > you still think it would help, I could). I think so, yes. > But as for the other, that is what you got. The function was called > like this: > > (collect-d) I don't get this. It rather seems to me that the function was called 1+ arguments (the triple (x_1 v_1 s_1) and the "...") -- ?ric > On Sat, May 2, 2009 at 11:34 AM, Eric Tanter > wrote: >>>> I get an error "collect-d: (collect-d) is not in my domain" >>>> >>>> The defintion of collect-d is: >>>> >>>> (define-metafunction ?env >>>> collect-d : (env (x v s) ...) -> (env (x v s) ...) >>>> ((collect-d (env)) (env)) >>>> ((collect-d (env (x_0 v_0 (b_0 true)) (x_1 v_1 s_1) ...)) >>>> (env-append (env (x_0 v_0 (b_0 true))) (collect-d (x_1 v_1 >>>> s_1) ...))) >>> >>> The recursive call just above looks like it is missing "(env ..)" >>> around its argument. >> >> Just wondering: since the contract of the metafunction is clear, >> couldn't it >> be possible to report more precisely what the problem is (similarly >> to >> contract violations), something along the lines of: >> "collect-d broken contract: expected (env (x v s) ...) given (x v >> s) (other >> arguments were ...)" >> >> ? >> >> -- ?ric From robby at eecs.northwestern.edu Sat May 2 13:31:43 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat May 2 13:32:01 2009 Subject: [plt-scheme] redex: recursive metafunctions In-Reply-To: References: <15BA5B12-CDED-41D4-8E18-BA3DCB32CAFE@dcc.uchile.cl> <932b2f1f0905020905v22f3d650wfe3b7daa2f7a02ec@mail.gmail.com> <09D98905-334D-466F-9AA8-BA6DEA6A9E98@dcc.uchile.cl> <932b2f1f0905021017p1271ccb3j2dc92bc095a63ff2@mail.gmail.com> Message-ID: <932b2f1f0905021031h45a9f118x2347cff64ff185e7@mail.gmail.com> The ellipsis means "splice out what comes before into this place". You had empty lists there, I believe. Robby On Sat, May 2, 2009 at 12:21 PM, Eric Tanter wrote: > On May 2, 2009, at 13:17 , Robby Findler wrote: >> >> Well, the contract is written on the metafunction and since there are >> no HO contracts, I didn't include that in the error message (altho if >> you still think it would help, I could). > > I think so, yes. > >> But as for the other, that is what you got. The function was called like >> this: >> >> ?(collect-d) > > I don't get this. It rather seems to me that the function was called 1+ > arguments > (the triple (x_1 v_1 s_1) and the "...") > > -- ?ric > >> On Sat, May 2, 2009 at 11:34 AM, Eric Tanter >> wrote: >>>>> >>>>> I get an error "collect-d: (collect-d) is not in my domain" >>>>> >>>>> The defintion of collect-d is: >>>>> >>>>> (define-metafunction ?env >>>>> ?collect-d : (env (x v s) ...) -> (env (x v s) ...) >>>>> ?((collect-d (env)) (env)) >>>>> ?((collect-d (env (x_0 v_0 (b_0 true)) (x_1 v_1 s_1) ...)) >>>>> ?(env-append (env (x_0 v_0 (b_0 true))) (collect-d (x_1 v_1 s_1) ...))) >>>> >>>> The recursive call just above looks like it is missing "(env ..)" >>>> around its argument. >>> >>> Just wondering: since the contract of the metafunction is clear, couldn't >>> it >>> be possible to report more precisely what the problem is (similarly to >>> contract violations), something along the lines of: >>> "collect-d broken contract: expected (env (x v s) ...) given (x v s) >>> (other >>> arguments were ...)" >>> >>> ? >>> >>> -- ?ric > > From geoff at knauth.org Sat May 2 14:11:05 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Sat May 2 14:11:28 2009 Subject: [plt-scheme] help for DFS illustration In-Reply-To: <361ba466-04d8-436d-8754-6d0ab7c7df83@r37g2000yqn.googlegroups.com> References: <361ba466-04d8-436d-8754-6d0ab7c7df83@r37g2000yqn.googlegroups.com> Message-ID: On May 1, 2009, at 14:08, Mustafa Can Buken wrote: > I am a student in Istanbul Bilgi University Computer Sciences > Department as a first year student. Our teacher makes four of us as a > group and gave an assinment about illustration of DFS algorithm. User > will give a graph and an endpoint and Dr. Scheme environment will draw > that graph with using DFS algorithm I love algorithm visualization. But if things flash by too fast for me, I want a speed control or a stepper button, and maybe a way to go forward and backward. > First of all I want to say that we tried something about DFS > illustration on DrScheme environment but because of our less knowledge > in world.ss teachpack, we experienced some problems about that topic. OK, so what problems? Have you read "How to Design Worlds" [HtDW] ? If not, see: http://world.cs.brown.edu/ > Can somebody give us a clue about that. It can be pseudo code of our > problem or you can say first do something then ... then ... We really > don't know how to do this illustration and we should do that till 8th > of May and will present it. > > Wanting a code is a bad habbit I know, so I want to take advice about > how to do this illustration, which things that we should do. Thanks to > everybody for helps. The first question is, do you know how you would do this using pen and paper? I.e., do you feel comfortable with DFS? You should understand DFS 80-90% before starting. An illustrator or animator should have a vision. Now, assuming you know how you would draw this by hand, make an inventory of the kinds of things you would draw, e.g., vertices and edges, where you would put the values, what colors you want to use in your animation. Then go back to HtDW and find objects that are similar and use them to compose new objects or structures with the properties you need to connect the graph and track the progress of DFS. Geoffrey From geoff at knauth.org Sat May 2 14:16:39 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Sat May 2 14:17:13 2009 Subject: [plt-scheme] How to get set up for The Structure and Interpretation of Computer Programs In-Reply-To: <0ad0f652-54f9-49ff-b835-ffa7280599b4@b7g2000pre.googlegroups.com> References: <0ad0f652-54f9-49ff-b835-ffa7280599b4@b7g2000pre.googlegroups.com> Message-ID: On May 1, 2009, at 09:56, morgancodes wrote: > Wondering if anyone can point me toward a way to get set up to work > through this book. I'd like to set up Dr. Scheme so I'm using the > correct dialect etc. Neil Van Dyke has created an sicp language for DrScheme. A bunch of us volunteered to help him with testing. My semester is winding down, so I'll be doing more testing of his code in May. I suggest you write to him if you want to experiment with the code as well. Geoff From mustafacanb89 at gmail.com Sat May 2 14:25:53 2009 From: mustafacanb89 at gmail.com (Mustafa Can Buken) Date: Sat May 2 14:26:18 2009 Subject: [plt-scheme] Re: help for DFS illustration In-Reply-To: References: <361ba466-04d8-436d-8754-6d0ab7c7df83@r37g2000yqn.googlegroups.com> Message-ID: <6e6ca55c-1418-467a-a830-f4a05be3ad8a@z19g2000vbz.googlegroups.com> Thanks for book advice. We didn't know about that book. We will read and I think it's going to be done Thank you all, Mustafa Can Buken On 2 May?s, 21:11, "Geoffrey S. Knauth" wrote: > On May 1, 2009, at 14:08, Mustafa Can Buken wrote: > > > I am a student in Istanbul Bilgi University Computer Sciences > > Department as a first year student. Our teacher makes four of us as a > > group and gave an assinment about illustration of DFS algorithm. User > > will give a graph and an endpoint and Dr. Scheme environment will draw > > that graph with using DFS algorithm > > I love algorithm visualization. ?But if things flash by too fast for ? > me, I want a speed control or a stepper button, and maybe a way to go ? > forward and backward. > > > First of all I want to say that we tried something about DFS > > illustration on DrScheme environment but because of our less knowledge > > in world.ss teachpack, we experienced some problems about that topic. > > OK, so what problems? > > Have you read "How to Design Worlds" ?[HtDW] ? > If not, see: ?http://world.cs.brown.edu/ > > > Can somebody give us a clue about that. It can be pseudo code of our > > problem or you can say first do something then ... then ... We really > > don't know how to do this illustration and ?we should do that till 8th > > of May and will present it. > > > Wanting a code is a bad habbit I know, so I want to take advice about > > how to do this illustration, which things that we should do. Thanks to > > everybody for helps. > > The first question is, do you know how you would do this using pen and ? > paper? ?I.e., do you feel comfortable with DFS? ?You should understand ? > DFS 80-90% before starting. ?An illustrator or animator should have a ? > vision. > > Now, assuming you know how you would draw this by hand, make an ? > inventory of the kinds of things you would draw, e.g., vertices and ? > edges, where you would put the values, what colors you want to use in ? > your animation. ?Then go back to HtDW and find objects that are ? > similar and use them to compose new objects or structures with the ? > properties you need to connect the graph and track the progress of DFS. > > Geoffrey > > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From feeley at iro.umontreal.ca Sat May 2 14:45:38 2009 From: feeley at iro.umontreal.ca (Marc Feeley) Date: Sat May 2 14:46:55 2009 Subject: [plt-scheme] [ANN] Scheme Language Steering Committee Message-ID: <10363DBE-A9CA-443F-B5BB-490263DCE197@iro.umontreal.ca> [Apologies if you get duplicates of this message.] As members of the newly elected Scheme Language Steering Committee, we thank all who voted for expressing their continuing interest and involvement [1]. We have decided to expand the Scheme Language Steering Committee from 3 to 5 members. Using the results of the election just held, we are adding Olin Shivers and Chris Hanson to the committee. Olin and Chris have agreed to serve, and are already serving ex officio. Before we can add Olin and Chris as official members of the committee, we will have to amend the charter [2,3]. We are also considering other changes to the charter, such as removing or modifying the prohibition against members of the steering committee serving as editors, removing the R6RS-specific goals, and changing other details of the process. We are looking into various mechanisms for keeping the Scheme community informed of our progress and involved in the process. We hope to announce the details in the coming weeks. Will Clinger Marc Feeley Chris Hanson (ex officio) Jonathan Rees Olin Shivers (ex officio) [1] http://lists.r6rs.org/pipermail/r6rs-discuss/2009-March/004380.html [2] http://www.r6rs.org/charter/charter-mar-2006.txt [3] http://lists.r6rs.org/pipermail/r6rs-discuss/2009-February/004121.html From feeley at iro.umontreal.ca Sat May 2 14:45:38 2009 From: feeley at iro.umontreal.ca (Marc Feeley) Date: Sat May 2 14:47:00 2009 Subject: [plt-scheme] [ANN] Scheme Language Steering Committee Message-ID: <10363DBE-A9CA-443F-B5BB-490263DCE197@iro.umontreal.ca> [Apologies if you get duplicates of this message.] As members of the newly elected Scheme Language Steering Committee, we thank all who voted for expressing their continuing interest and involvement [1]. We have decided to expand the Scheme Language Steering Committee from 3 to 5 members. Using the results of the election just held, we are adding Olin Shivers and Chris Hanson to the committee. Olin and Chris have agreed to serve, and are already serving ex officio. Before we can add Olin and Chris as official members of the committee, we will have to amend the charter [2,3]. We are also considering other changes to the charter, such as removing or modifying the prohibition against members of the steering committee serving as editors, removing the R6RS-specific goals, and changing other details of the process. We are looking into various mechanisms for keeping the Scheme community informed of our progress and involved in the process. We hope to announce the details in the coming weeks. Will Clinger Marc Feeley Chris Hanson (ex officio) Jonathan Rees Olin Shivers (ex officio) [1] http://lists.r6rs.org/pipermail/r6rs-discuss/2009-March/004380.html [2] http://www.r6rs.org/charter/charter-mar-2006.txt [3] http://lists.r6rs.org/pipermail/r6rs-discuss/2009-February/004121.html From neil at neilvandyke.org Sat May 2 16:44:01 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Sat May 2 16:44:47 2009 Subject: [plt-scheme] How to get set up for The Structure and Interpretation of Computer Programs In-Reply-To: References: <0ad0f652-54f9-49ff-b835-ffa7280599b4@b7g2000pre.googlegroups.com> Message-ID: <49FCB091.4020407@neilvandyke.org> Geoffrey S. Knauth wrote at 05/02/2009 02:16 PM: > On May 1, 2009, at 09:56, morgancodes wrote: >> Wondering if anyone can point me toward a way to get set up to work >> through this book. I'd like to set up Dr. Scheme so I'm using the >> correct dialect etc. > > Neil Van Dyke has created an sicp language for DrScheme. A bunch of > us volunteered to help him with testing. My semester is winding down, > so I'll be doing more testing of his code in May. I suggest you write > to him if you want to experiment with the code as well. The bunch of us who volunteered to help is called Geoffrey S. Knauth. :) I kludged up a SICP language for DrScheme (including loading Sperber's and Soegaard's port of the SICP Picture language) that I'm pretty sure needs additional work before foisting it on students. Tools that don't work frustrate students and can scare them away from entire fields of study. We now need at least one person to work through the SICP book using DrScheme, and make sure that the DrScheme support for SICP works smoothly and provides everything that is necessary. This could also be done by someone who has already worked through SICP, and is willing to skim through SICP while pretending to do the exercises and running their old code in DrScheme. As these people find problems, I will probably be able to fix them. I'll probably also be able to do the final packaging and polishing once we're reasonably confident that it's ready for students. -- http://www.neilvandyke.org/ From mvanier42 at gmail.com Sat May 2 18:12:45 2009 From: mvanier42 at gmail.com (Michael Vanier) Date: Sat May 2 18:13:07 2009 Subject: [plt-scheme] How to get set up for The Structure and Interpretation of Computer Programs In-Reply-To: <49FCB091.4020407@neilvandyke.org> References: <0ad0f652-54f9-49ff-b835-ffa7280599b4@b7g2000pre.googlegroups.com> <49FCB091.4020407@neilvandyke.org> Message-ID: <49FCC55D.4090601@cs.caltech.edu> Neil Van Dyke wrote: > Geoffrey S. Knauth wrote at 05/02/2009 02:16 PM: >> On May 1, 2009, at 09:56, morgancodes wrote: >>> Wondering if anyone can point me toward a way to get set up to work >>> through this book. I'd like to set up Dr. Scheme so I'm using the >>> correct dialect etc. >> >> Neil Van Dyke has created an sicp language for DrScheme. A bunch of >> us volunteered to help him with testing. My semester is winding >> down, so I'll be doing more testing of his code in May. I suggest >> you write to him if you want to experiment with the code as well. > > The bunch of us who volunteered to help is called Geoffrey S. Knauth. :) > > I kludged up a SICP language for DrScheme (including loading Sperber's > and Soegaard's port of the SICP Picture language) that I'm pretty sure > needs additional work before foisting it on students. Tools that > don't work frustrate students and can scare them away from entire > fields of study. > > We now need at least one person to work through the SICP book using > DrScheme, and make sure that the DrScheme support for SICP works > smoothly and provides everything that is necessary. > > This could also be done by someone who has already worked through > SICP, and is willing to skim through SICP while pretending to do the > exercises and running their old code in DrScheme. > > As these people find problems, I will probably be able to fix them. > I'll probably also be able to do the final packaging and polishing > once we're reasonably confident that it's ready for students. > I can help with this, at least for the first 3 sections of SICP. Mike From sk at cs.brown.edu Sat May 2 22:19:39 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sat May 2 22:20:20 2009 Subject: [plt-scheme] [ANN] Scheme Language Steering Committee In-Reply-To: <10363DBE-A9CA-443F-B5BB-490263DCE197@iro.umontreal.ca> References: <10363DBE-A9CA-443F-B5BB-490263DCE197@iro.umontreal.ca> Message-ID: Huh? What? Why would you assume that the way people cast their vote when only three slots were up for grabs is at all the same as how they would vote when five slots are up for grabs? I protest this decision. Shriram On Sat, May 2, 2009 at 2:45 PM, Marc Feeley wrote: > [Apologies if you get duplicates of this message.] > > As members of the newly elected Scheme Language Steering > Committee, we thank all who voted for expressing their > continuing interest and involvement [1]. > > We have decided to expand the Scheme Language Steering > Committee from 3 to 5 members. > > Using the results of the election just held, we are > adding Olin Shivers and Chris Hanson to the committee. > Olin and Chris have agreed to serve, and are already > serving ex officio. > > Before we can add Olin and Chris as official members of > the committee, we will have to amend the charter [2,3]. > > We are also considering other changes to the charter, > such as removing or modifying the prohibition against > members of the steering committee serving as editors, > removing the R6RS-specific goals, and changing other > details of the process. > > We are looking into various mechanisms for keeping the > Scheme community informed of our progress and involved > in the process. ?We hope to announce the details in the > coming weeks. > > Will Clinger > Marc Feeley > Chris Hanson (ex officio) > Jonathan Rees > Olin Shivers (ex officio) > > [1] http://lists.r6rs.org/pipermail/r6rs-discuss/2009-March/004380.html > [2] http://www.r6rs.org/charter/charter-mar-2006.txt > [3] http://lists.r6rs.org/pipermail/r6rs-discuss/2009-February/004121.html > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From wookiz at hotmail.com Sat May 2 22:34:09 2009 From: wookiz at hotmail.com (wooks) Date: Sat May 2 22:34:28 2009 Subject: [plt-scheme] Re: Expressivity gap between formal methods and PL's In-Reply-To: References: <46929267-1279-4735-8722-094304ac6c40@s1g2000prd.googlegroups.com> <11b141710904301102s26608eds907a6891b62f63c1@mail.gmail.com> <11b141710904301225p2dc78eb1q81a31346e81e5736@mail.gmail.com> <11b141710905011206q28f84781j528abc1bf0519b6a@mail.gmail.com> <11b141710905011754t1117b370jab8d8300d641e6cc@mail.gmail.com> Message-ID: <22954d87-0afa-4c7a-863c-ffa030f993a1@r34g2000vbi.googlegroups.com> Turns out that what I have been thinking of is old hat - nicely encapsulated by the story of tester 4 in this article. www.geocities.com/harry_robinson_testing/robinson.pdf. Model Based Testing. There is a page of links to papers http://www.geocities.com/model_based_testing/online_papers.htm. The few (ok one) that I read [Apfelbaum, Doyle] is focused on system/ acceptance testing which is the more interesting problem if you have a system to deliver. So Scheme for the creation of a behavioural model to support testing, based on a formal spec (if one exists) otherwise build it from a bunch of exploratory tests like Tester 4. Add that to the list of legitimate ways to use Scheme in your day job without having to tell your boss. Complete aside. Ruby seems to be a popular choice for test automation support in the open source community, I found this link to a purported Gambit Scheme equivalent on the Watir wikipedia page.... http://code.google.com/p/win-control/ From ontheheap at gmail.com Sat May 2 22:34:42 2009 From: ontheheap at gmail.com (S Brown) Date: Sat May 2 22:35:12 2009 Subject: [plt-scheme] Re: HTDP Exercise 12.4.2 ... Help! (Solved!!) In-Reply-To: <89bb27db-ca51-4c5a-ab2b-3cc76ba05af9@d19g2000prh.googlegroups.com> References: <89bb27db-ca51-4c5a-ab2b-3cc76ba05af9@d19g2000prh.googlegroups.com> Message-ID: I just wanted to update this topic in order to say that I have finally solved this exercise the *correct* way! Thank you very much to everyone here who provided input. For anyone who finds this topic and is looking for help with this exercise: 1. Learn the right way to think about recursion. Don't make the mistake I made and try to put the entire recursive process into your head all at once. It simply doesn't work. Even writing down all of the results of the recursion step-by-step won't help. Instead, use the definition of the function itself to understand how the recursion works, and then create the rest of the function as if the recursive call already does what it's supposed to do. 2. Follow the design recipes. This exercise is probably the first one in the book where you pretty much have to use the design recipes in order to find the right solution. The specific recipe you should be looking at here is in section 9.4 3. Walk away from this exercise if/when you get frustrated. Take a walk, watch a movie, etc. Basically, go do something that doesn't require a lot of thinking. 4. Don't give up on it until you have the solution. It's worth it once you solve it because you gain a better understanding of how to use and think about recursion, and how to use the design recipes. From matthias at ccs.neu.edu Sat May 2 22:35:30 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sat May 2 22:36:10 2009 Subject: [plt-scheme] [ANN] Scheme Language Steering Committee In-Reply-To: References: <10363DBE-A9CA-443F-B5BB-490263DCE197@iro.umontreal.ca> Message-ID: <33ADDECF-EADC-4322-AF69-16DA8C0AF06E@ccs.neu.edu> But who are you? Marc, Will, Jonathan, and Co are now in charge. C.H.A.R.G.E. Or whatever :-) On May 2, 2009, at 10:19 PM, Shriram Krishnamurthi wrote: > Huh? What? > > Why would you assume that the way people cast their vote when only > three slots were up for grabs is at all the same as how they would > vote when five slots are up for grabs? > > I protest this decision. > > Shriram > > On Sat, May 2, 2009 at 2:45 PM, Marc Feeley > wrote: >> [Apologies if you get duplicates of this message.] >> >> As members of the newly elected Scheme Language Steering >> Committee, we thank all who voted for expressing their >> continuing interest and involvement [1]. >> >> We have decided to expand the Scheme Language Steering >> Committee from 3 to 5 members. >> >> Using the results of the election just held, we are >> adding Olin Shivers and Chris Hanson to the committee. >> Olin and Chris have agreed to serve, and are already >> serving ex officio. >> >> Before we can add Olin and Chris as official members of >> the committee, we will have to amend the charter [2,3]. >> >> We are also considering other changes to the charter, >> such as removing or modifying the prohibition against >> members of the steering committee serving as editors, >> removing the R6RS-specific goals, and changing other >> details of the process. >> >> We are looking into various mechanisms for keeping the >> Scheme community informed of our progress and involved >> in the process. We hope to announce the details in the >> coming weeks. >> >> Will Clinger >> Marc Feeley >> Chris Hanson (ex officio) >> Jonathan Rees >> Olin Shivers (ex officio) >> >> [1] http://lists.r6rs.org/pipermail/r6rs-discuss/2009-March/ >> 004380.html >> [2] http://www.r6rs.org/charter/charter-mar-2006.txt >> [3] http://lists.r6rs.org/pipermail/r6rs-discuss/2009-February/ >> 004121.html >> _________________________________________________ >> 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 gabor.lists at mndl.hu Sun May 3 01:57:35 2009 From: gabor.lists at mndl.hu (gabor papp) Date: Sun May 3 01:57:58 2009 Subject: [plt-scheme] Box2D bindings Message-ID: <49FD324F.2040608@mndl.hu> Hello, Has anyone worked on binding Box2D (a rigid body simulation library) to PLT Scheme? If not, I will try to do it myself, but I'd like to build on existing work if possible. Thanks, Gabor From laplacian42 at gmail.com Sun May 3 01:59:19 2009 From: laplacian42 at gmail.com (i j) Date: Sun May 3 01:59:41 2009 Subject: [plt-scheme] Overview of the various pieces of PLT? Message-ID: <1301d5d20905022259i37302a4dv496c7b24f0dbf4c@mail.gmail.com> Hi, My understanding so far is that "PLT Scheme" includes the Scheme interpreter (MzScheme), an IDE, and a large number of docs and libraries, however the front page of the web site says PLT Scheme is a language. Does maybe "PLT" refer to the whole system, and "PLT Scheme" refer to the language itself? Also, a few more questions: * Is everything listed at included with PLT? If not, is there a list somewhere showing what's included? * Is "DrScheme" just the IDE, or does it include other pieces of PLT as well? (What main pieces does it rely upon?) * Is the PLT IDE itself written in Scheme? * Is MrED the GUI toolkit for PLT? Is it written from scratch, or is it implemented in a C GUI toolkit like GTK+ or Qt? * If I install *just* MzScheme, what pieces of PLT will I not have? Thanks! From eli at barzilay.org Sun May 3 02:03:57 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sun May 3 02:04:39 2009 Subject: [plt-scheme] Overview of the various pieces of PLT? In-Reply-To: <1301d5d20905022259i37302a4dv496c7b24f0dbf4c@mail.gmail.com> References: <1301d5d20905022259i37302a4dv496c7b24f0dbf4c@mail.gmail.com> Message-ID: <18941.13261.231911.184129@winooski.ccs.neu.edu> On May 3, i j wrote: > > * Is everything listed at included with > PLT? Yes. > * Is "DrScheme" just the IDE, or does it include other pieces of PLT > as well? (What main pieces does it rely upon?) DrScheme is the IDE. It is part of the PLT Scheme installers, with a bunch of other stuff. > * Is the PLT IDE itself written in Scheme? Yes. > * Is MrED the GUI toolkit for PLT? Yes. > Is it written from scratch, or is it implemented in a C GUI toolkit > like GTK+ or Qt? It is based on a fork of wxwindows. > * If I install *just* MzScheme, what pieces of PLT will I not have? A lot. The mzscheme distribution is intended mostly for installation on servers. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From tomi.neste at gmail.com Sun May 3 02:10:00 2009 From: tomi.neste at gmail.com (Tomi Neste) Date: Sun May 3 02:10:23 2009 Subject: [plt-scheme] Box2D bindings In-Reply-To: <49FD324F.2040608@mndl.hu> References: <49FD324F.2040608@mndl.hu> Message-ID: <43c8fc270905022310o29a63cfbua7965cc2c5cdda05@mail.gmail.com> On Sun, May 3, 2009 at 8:57 AM, gabor papp wrote: > Hello, > > Has anyone worked on binding Box2D (a rigid body simulation library) to > PLT Scheme? If not, I will try to do it myself, but I'd like to build on > existing work if possible. > > Thanks, > Gabor > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > Since Box2D is a C++ library writing bindings for it is going to be unnecessarily annoying. I would suggest using something else, like Chipmunk (http://wiki.slembcke.net/main/published/Chipmunk) which is a pure C rigid body library. --tomppa -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090503/b2fb65d9/attachment.htm From laplacian42 at gmail.com Sun May 3 02:48:01 2009 From: laplacian42 at gmail.com (i j) Date: Sun May 3 02:48:23 2009 Subject: [plt-scheme] Overview of the various pieces of PLT? In-Reply-To: <18941.13261.231911.184129@winooski.ccs.neu.edu> References: <1301d5d20905022259i37302a4dv496c7b24f0dbf4c@mail.gmail.com> <18941.13261.231911.184129@winooski.ccs.neu.edu> Message-ID: <1301d5d20905022348l352da688rfbf4564e7dd6e07@mail.gmail.com> On Sun, May 3, 2009 at 2:03 AM, Eli Barzilay wrote: > On May ?3, i j wrote: >> > >> * Is MrED the GUI toolkit for PLT? > > Yes. Why does this page http://docs.plt-scheme.org/gui/index.html refer to MrEd as an executable? > > >> * If I install *just* MzScheme, what pieces of PLT will I not have? > > A lot. ?The mzscheme distribution is intended mostly for installation > on servers. Hm. So, even if I only wanted to use MzScheme plus MrEd for a GUI project, it probably makes more sense to just go ahead and install the whole PLT Scheme distribution. Interestingly enough, the PLT download is about the same size as those for Perl and Python. And it now occurs to me that no one ever asks if they should just install Python plus one or two bits of its standard lib. ;) Thanks. From eli at barzilay.org Sun May 3 03:06:19 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sun May 3 03:06:41 2009 Subject: [plt-scheme] Overview of the various pieces of PLT? In-Reply-To: <1301d5d20905022348l352da688rfbf4564e7dd6e07@mail.gmail.com> References: <1301d5d20905022259i37302a4dv496c7b24f0dbf4c@mail.gmail.com> <18941.13261.231911.184129@winooski.ccs.neu.edu> <1301d5d20905022348l352da688rfbf4564e7dd6e07@mail.gmail.com> Message-ID: <18941.17003.683836.265657@winooski.ccs.neu.edu> On May 3, i j wrote: > On Sun, May 3, 2009 at 2:03 AM, Eli Barzilay wrote: > > On May ?3, i j wrote: > >> * Is MrED the GUI toolkit for PLT? > > > > Yes. > > Why does this page http://docs.plt-scheme.org/gui/index.html refer > to MrEd as an executable? Because it is: in its core, it is a C/++ application with mzscheme embeded, so you run it just like you run mzscheme. (And the amount of C code has been significantly reduced in the subversion head, btw.) > >> * If I install *just* MzScheme, what pieces of PLT will I not > >> have? > > > > A lot. ?The mzscheme distribution is intended mostly for > > installation on servers. > > Hm. So, even if I only wanted to use MzScheme plus MrEd for a GUI > project, it probably makes more sense to just go ahead and install > the whole PLT Scheme distribution. Yes. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From michele.simionato at gmail.com Sun May 3 04:13:13 2009 From: michele.simionato at gmail.com (Michele Simionato) Date: Sun May 3 04:13:31 2009 Subject: [plt-scheme] side effects in R6RS modules In-Reply-To: <4edc17eb0905022249v27fde86cxe952b0f7450d1cd4@mail.gmail.com> References: <4edc17eb0905022249v27fde86cxe952b0f7450d1cd4@mail.gmail.com> Message-ID: <4edc17eb0905030113g7ab04926pad7571eca2c049e9@mail.gmail.com> Warning 1: message sent to the PLT list, the Larceny list and the Ikarus list Warning 2: this is long and complicated, for freaks of the module system only I have been experimenting with side effects in modules. >From my previous experience I expected to open a can of worms, finding strange behaviours and inconsistencies between implementations. ?My expectations were met ;-) I am asking for comments from the Ones Who Knows, since I do not understand the behaviour in Larceny and PLT. The problem I want to solve is to introduce a define+ form which works as a regular define, but also register the defined name via a side effect *at expand time*. The problem is directly inspired to the "Composable and Compilable macros" paper and I am solving it with the sole purpose of finding the portability issues between different implementations. To solve the problem, I have defined three modules, which I put in a package named "experimental". The first module is just a registry of identifiers: #!r6rs (library (experimental registry) (export registry register) (import (rnrs)) (define _registry '()) (define (registry) ?_registry) (define (register id) ?(display "registering ") ?(display id) ?(newline) ?(set! _registry (append _registry (list id))) ?_registry) ) The second module exports the define+ form, as well as a define-registered form to save the list of registered names into a runtime variable: #!r6rs (library (experimental define+) (export define-registered define+) (import (rnrs) (for (experimental registry) expand)) ;; save the content of the expand-time registry into a runtime definition (define-syntax define-registered ?(lambda (x) ? ?(syntax-case x () ? ? ? ?((define-registered names) ? ? ? ? #`(define names '#,(registry)))))) (define-syntax define+ ?(lambda (x) ? ?(syntax-case x () ? ? ?((define+ name value) ? ? ? #'(begin ? ? ? ? ? ;; dirty trick to get an expand time side effect ? ? ? ? ? (define-syntax dummy (begin (register #'name) (lambda (x) #f))) ? ? ? ? ? ;; the real definition ? ? ? ? ? (define name value)))))) ) The third module contains just a couple of definitions: #!r6rs (library (experimental defines) (export a b) (import (experimental define+)) (define+ a 1) (define+ b 2) ) I have also defined a script importing the definitions: $ cat x.ss #!r6rs (import (rnrs) (experimental define+) (experimental defines)) (define-registered names) (display names) What's the output of this script in different implementations? Ypsilon -------------------- At the first run Ypsilon register the definitions and prints them: $ ypsilon x.ss registering # registering # (a b) At the second run the libraries are already compiled and I get the empty list: $ ypsilon x.ss () This is due to separate compilation and I understand what it is going on. Ikarus ---------------------------------------- Ikarus behaves like Ypsilon. The identifiers are registered at the first compilation $ ikarus --compile-dependencies x.ss registering # registering # Serializing "/home/micheles/gcode/scheme/experimental/defines.sls.ikarus-fasl" ... Serializing "/home/micheles/gcode/scheme/experimental/define+.sls.ikarus-fasl" ... At subsequence runs I get the empty list: $ ikarus --r6rs-script x.ss () Larceny ----------------------------------------------------- The behavior of Larceny surprises me: $ larceny-r6rs x.ss registering # registering # registering # registering # (a b a b) Why are the identifiers registered twice?? PLT Scheme ---------------------------------------------- PLT Scheme (I am using version 4.1.5) is even more surprising: $ plt-r6rs x.ss /home/micheles/.plt-scheme/4.1.5/collects/experimental/defines.sls:5:0: compile: bad syntax; function application is not allowed, because no #%app syntax transformer is bound in the transformer environment in: (register (syntax a)) This message usually means that there is a phase error, however I thought I did my homework correctly by using the (for (experimental registry) expand) import form: Larceny does not complain either, so there must be something specific to PLT happening here. I expected, had script compiled, to get consistently the empty list, with or without separate compilation, due to the multiple instantiation semantics of PLT. Can you explain what it happening? ? ? ? ? ? ? ? Michele Simionato From michele.simionato at gmail.com Sun May 3 04:35:27 2009 From: michele.simionato at gmail.com (Michele Simionato) Date: Sun May 3 04:35:47 2009 Subject: [plt-scheme] Re: how many times macros are defined? In-Reply-To: <20090501133219.A2CFA6500A9@mail-svr1.cs.utah.edu> References: <23e51fd4-d166-4882-8cf9-a103276f7291@v35g2000pro.googlegroups.com> <20090501113700.8A2BB6500B2@mail-svr1.cs.utah.edu> <20090501133219.A2CFA6500A9@mail-svr1.cs.utah.edu> Message-ID: <0d3b434a-a9f4-4886-9443-4f757d6ed880@t10g2000vbg.googlegroups.com> On May 1, 3:32?pm, Matthew Flatt wrote: > In PLT Scheme, the motivation for phase-specific bindings is not so > much that we may want different names in different phases, but that we > want to be specific about which code is running at which times. Without > an enforced separation, we found that it was far too easy to > accidentally have the run-time code depend on some initialization in > compile-time code (e.g. loading a module, initializing some state), and > that possibility made our builds and libraries fragile. (This problem > is described more in the "Composable and Compilable Macros" paper.) So, > we moved to a system that would tell us when we got it wrong, in much > the same way that the compiler complains when a module contains a free > variable. The question of side effects is solved with multiple instantiation of modules, which is independent from phase specification. In principle one could have a system with implicit phasing and multiple instantiation (say Ikarus with forced pre-compilation of libraries in a different OS process). > There's a spectrum in language design on how much the compiler checks > statically versus how much is checked at run time, and static checks > inevitably rule out some programs that could have run just fine. On the > particular point of phase bindings, we've been happier with explicit > declarations and static checking. I think this choice has been key to > helping us build towers of languages that are far wider (lots of > languages) and deeper (languages built on other languages) than > anything else out there, that involve many implementors, and that we > can keep running over many years. I trust you and certainly the PLT module system is better than what was available before ("load", "eval-when", bleah!). However, to tell the truth, my experience as an user has been much happier with implicit phasing than with explicit phasing, especially when writing higher order macros. Michele Simionato From neil at neilvandyke.org Sun May 3 05:43:11 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Sun May 3 05:43:56 2009 Subject: [plt-scheme] instructions for installing plt language from planet Message-ID: <49FD672F.2000102@neilvandyke.org> I have a PLT Language that I'd like to have installed from a PLaneT package. What are some simple instructions that I can give a new student for how to install this PLaneT package? Installation is a one-liner if I have the user go to a command prompt, but that might be intimidating, so I was thinking of having them do it through DrScheme. With DrScheme, the steps I can think of to get them to reliably execute a "require" form in a Language that supports it seem convoluted. (Start DrScheme, make sure you a new window with no file in it, change language to Module using such-and-such series of steps, enter "(require (planet foo/bar))" in the interactions subwindow, wait for the "PLaneT: Finished with foo/bar." message, quit DrScheme and start it up again.) -- http://www.neilvandyke.org/ From robby at eecs.northwestern.edu Sun May 3 08:13:59 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sun May 3 08:14:17 2009 Subject: [plt-scheme] Overview of the various pieces of PLT? In-Reply-To: <18941.13261.231911.184129@winooski.ccs.neu.edu> References: <1301d5d20905022259i37302a4dv496c7b24f0dbf4c@mail.gmail.com> <18941.13261.231911.184129@winooski.ccs.neu.edu> Message-ID: <932b2f1f0905030513k133055fesd5e8b559e56682fd@mail.gmail.com> On Sun, May 3, 2009 at 1:03 AM, Eli Barzilay wrote: >> Is it written from scratch, or is it implemented in a C GUI toolkit >> like GTK+ or Qt? > > It is based on a fork of wxwindows. And just note: while this is certainly the truth, it isn't really very informative, since we forked a long long time ago (more than a decade, I think?) so there is little in common with the current state of wxwindows. Robby From jay.mccarthy at gmail.com Sun May 3 09:13:10 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Sun May 3 09:13:35 2009 Subject: [plt-scheme] instructions for installing plt language from planet In-Reply-To: <49FD672F.2000102@neilvandyke.org> References: <49FD672F.2000102@neilvandyke.org> Message-ID: Here's the text that I use on my course site: We will use a DrScheme package designed for PLAI in many assignments. To install it: Open DrScheme in the Module language. Run the following program: #lang planet plai/plai "Hello PLAI!" This automatically installs the language for the text. Please re-start DrScheme. The language will be visible from the Language|Choose Language... menu in DrScheme or via the language chooser at the bottom-left. Choose the PLAI Scheme language. from http://faculty.cs.byu.edu/~jay/courses/proto/330/course/#(part._software) On Sun, May 3, 2009 at 3:43 AM, Neil Van Dyke wrote: > I have a PLT Language that I'd like to have installed from a PLaneT package. > ?What are some simple instructions that I can give a new student for how to > install this PLaneT package? > > Installation is a one-liner if I have the user go to a command prompt, but > that might be intimidating, so I was thinking of having them do it through > DrScheme. > > With DrScheme, the steps I can think of to get them to reliably execute a > "require" form in a Language that supports it seem convoluted. ?(Start > DrScheme, make sure you a new window with no file in it, change language to > Module using such-and-such series of steps, enter "(require (planet > foo/bar))" in the interactions subwindow, wait for the "PLaneT: Finished > with foo/bar." message, quit DrScheme and start it up again.) > > -- > 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 matthias at ccs.neu.edu Sun May 3 10:04:58 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun May 3 10:05:42 2009 Subject: [plt-scheme] instructions for installing plt language from planet In-Reply-To: References: <49FD672F.2000102@neilvandyke.org> Message-ID: <036F6F6D-A442-4B29-98B0-FD1BF28C5390@ccs.neu.edu> Why do we not include a (drscheme-restart) procedure in such languages and request that users copy these lines: > #lang planet plai/plai > "Hello PLAI!" > (drscheme-restart) We should think of drscheme as an OS and every other OS has automatic restart instructions for such software updates. Of course, in reality we should have a "Planet Menu" from which users can select the desired package and get it, with restart and all automated. -- Matthias On May 3, 2009, at 9:13 AM, Jay McCarthy wrote: > Here's the text that I use on my course site: > > We will use a DrScheme package designed for PLAI in many assignments. > > To install it: Open DrScheme in the Module language. Run the > following program: > > #lang planet plai/plai > "Hello PLAI!" > > This automatically installs the language for the text. Please re-start > DrScheme. The language will be visible from the Language|Choose > Language... menu in DrScheme or via the language chooser at the > bottom-left. Choose the PLAI Scheme language. > > from > > http://faculty.cs.byu.edu/~jay/courses/proto/330/course/# > (part._software) > > On Sun, May 3, 2009 at 3:43 AM, Neil Van Dyke > wrote: >> I have a PLT Language that I'd like to have installed from a >> PLaneT package. >> What are some simple instructions that I can give a new student >> for how to >> install this PLaneT package? >> >> Installation is a one-liner if I have the user go to a command >> prompt, but >> that might be intimidating, so I was thinking of having them do it >> through >> DrScheme. >> >> With DrScheme, the steps I can think of to get them to reliably >> execute a >> "require" form in a Language that supports it seem convoluted. >> (Start >> DrScheme, make sure you a new window with no file in it, change >> language to >> Module using such-and-such series of steps, enter "(require (planet >> foo/bar))" in the interactions subwindow, wait for the "PLaneT: >> Finished >> with foo/bar." message, quit DrScheme and start it up again.) >> >> -- >> 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 > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From sbloch at adelphi.edu Sun May 3 10:13:58 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Sun May 3 10:14:51 2009 Subject: [BULK] Re: [plt-scheme] instructions for installing plt language from planet In-Reply-To: References: <49FD672F.2000102@neilvandyke.org> Message-ID: <5DC591C9-B710-4D2B-97A1-DD83D71C3946@adelphi.edu> On May 3, 2009, at 9:13 AM, Jay McCarthy wrote: > We will use a DrScheme package designed for PLAI in many assignments. > > To install it: Open DrScheme in the Module language. Run the > following program: > > #lang planet plai/plai > "Hello PLAI!" > > This automatically installs the language for the text. Please re-start > DrScheme. The language will be visible from the Language|Choose > Language... menu in DrScheme or via the language chooser at the > bottom-left. Choose the PLAI Scheme language. Hmm... I'll have to see whether something like this works to install my teachpacks. At present, I tell students (and Computing Center staff) 1. Make sure your computer is connected to the Internet. 2. Start DrScheme. 3. From the ?Language? menu, ?Choose Language?, then select ?Module?. 4. Click ?Run?. 5. At the ?>? prompt in the bottom half of the screen, type (require (planet "install.ss" ("sbloch" "tiles.plt" 1 12))) exactly like that, with the parentheses and quotation marks and all. After a few seconds (or possibly a few minutes, if the server is slow), you should see the message ?Wrote file ?tiles.ss? to installed-teachpacks directory.? 6. Likewise, type (require (planet "install.ss" ("sbloch" "sb-world.plt" 1 4))) You should get the message ?Wrote file ?sb-world.ss? to installed- teachpacks directory.? 7. From the ?Language? menu, ?Choose Language?, then click on the trian- gle next to ?How to Design Programs?, then select ?Beginning Student?. 8. From the "Language" menu, "Add Teachpack...". You should see "tiles.ss" and "sb-world.ss" on the right hand side. Double-click one of them. Repeat with the other one. 9. Click "Run". You should see a message like Welcome to DrScheme, version 4.1.3 [3m]. Language: Beginning Student custom; memory limit: 128 megabytes. Teachpacks: tiles.ss and sb-world.ss. Of course, I'm using "require" in an unusual way, as a remote installer: the "install.ss" file, at load time, writes another file into the installed-teachpacks directory, which in turn requires from planet the module I'm actually interested in. There must be a better way.... Stephen Bloch sbloch@adelphi.edu From mflatt at cs.utah.edu Sun May 3 10:25:46 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sun May 3 10:26:11 2009 Subject: [plt-scheme] Overview of the various pieces of PLT? In-Reply-To: <1301d5d20905022348l352da688rfbf4564e7dd6e07@mail.gmail.com> References: <1301d5d20905022259i37302a4dv496c7b24f0dbf4c@mail.gmail.com> <18941.13261.231911.184129@winooski.ccs.neu.edu> <1301d5d20905022348l352da688rfbf4564e7dd6e07@mail.gmail.com> Message-ID: <20090503142548.5E9E46500D4@mail-svr1.cs.utah.edu> At Sun, 3 May 2009 02:48:01 -0400, i j wrote: > On Sun, May 3, 2009 at 2:03 AM, Eli Barzilay wrote: > > On May ?3, i j wrote: > >> > > > >> * Is MrED the GUI toolkit for PLT? > > > > Yes. > > Why does this page http://docs.plt-scheme.org/gui/index.html refer to > MrEd as an executable? For what it's worth: When I'm being careful, I now use the name "MrEd" to refer specifically to the executable, while the GUI toolbox is just "the `scheme/gui' library". Using `scheme/gui' works only within MrEd, though. And I sometimes still say "re-implement MrEd" when I really mean "re-implement `scheme/gui' so that the separate MrEd executable is not necessary". From czhu at cs.utah.edu Sun May 3 10:53:21 2009 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Sun May 3 10:53:41 2009 Subject: [plt-scheme] side effects in R6RS modules In-Reply-To: <4edc17eb0905030113g7ab04926pad7571eca2c049e9@mail.gmail.com> References: <4edc17eb0905022249v27fde86cxe952b0f7450d1cd4@mail.gmail.com> <4edc17eb0905030113g7ab04926pad7571eca2c049e9@mail.gmail.com> Message-ID: <49FDAFE1.7070809@cs.utah.edu> Michele Simionato wrote: > (define-syntax define+ > (lambda (x) > (syntax-case x () > ((define+ name value) > #'(begin > ;; dirty trick to get an expand time side effect > (define-syntax dummy (begin (register #'name) (lambda (x) #f))) > ;; the real definition > (define name value)))))) > Why the dirty trick? This works: (define-syntax define+ (lambda (x) (syntax-case x () ((define+ name value) (begin (register #'name) #'(define name value)))))) From anesward at mac.com Sun May 3 11:31:27 2009 From: anesward at mac.com (mike) Date: Sun May 3 11:31:50 2009 Subject: [plt-scheme] Re: HTDP Exercise 12.4.2 ... Help! (Solved!!) In-Reply-To: References: <89bb27db-ca51-4c5a-ab2b-3cc76ba05af9@d19g2000prh.googlegroups.com> Message-ID: I admire your persistence ; I became so discouraged that i haven't looked at htdp since early april; So i have to pick myself up and get back to it. mike On May 2, 7:34?pm, S Brown wrote: > I just wanted to update this topic in order to say that I have finally > solved this exercise the *correct* way! Thank you very much to > everyone here who provided input. > > For anyone who finds this topic and is looking for help with this > exercise: > > 1. Learn the right way to think about recursion. Don't make the > mistake I made and try to put the entire recursive process into your > head all at once. It simply doesn't work. Even writing down all of the > results of the recursion step-by-step won't help. Instead, use the > definition of the function itself to understand how the recursion > works, and then create the rest of the function as if the recursive > call already does what it's supposed to do. > > 2. Follow the design recipes. This exercise is probably the first one > in the book where you pretty much have to use the design recipes in > order to find the right solution. The specific recipe you should be > looking at here is in section 9.4 > > 3. Walk away from this exercise if/when you get frustrated. Take a > walk, watch a movie, etc. Basically, go do something that doesn't > require a lot of thinking. > > 4. Don't give up on it until you have the solution. It's worth it once > you solve it because you gain a better understanding of how to use and > think about recursion, and how to use the design recipes. > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mflatt at cs.utah.edu Sun May 3 11:46:45 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sun May 3 11:47:07 2009 Subject: [plt-scheme] side effects in R6RS modules In-Reply-To: <4edc17eb0905030113g7ab04926pad7571eca2c049e9@mail.gmail.com> References: <4edc17eb0905022249v27fde86cxe952b0f7450d1cd4@mail.gmail.com> <4edc17eb0905030113g7ab04926pad7571eca2c049e9@mail.gmail.com> Message-ID: <20090503154647.5BD526500BE@mail-svr1.cs.utah.edu> At Sun, 3 May 2009 10:13:13 +0200, Michele Simionato wrote: > > PLT Scheme (I am using version 4.1.5) is even more surprising: > > $ plt-r6rs x.ss > /home/micheles/.plt-scheme/4.1.5/collects/experimental/defines.sls:5:0: > compile: bad syntax; function application is not allowed, because no > #%app syntax transformer is bound in the transformer environment in: > (register (syntax a)) This is a bug in our R6RS implementation. It originates with a mismatch between PLT Scheme's use of `#%app' to scope the application form and R6RS's pair-unwrapping rules for templates produced by `syntax'. In PLT Scheme, when you write (+ 1 2) then not only do the `+', `1', and `2', have a lexical context, but so does the pair of parentheses. The meaning of function application is determined by an `#%app' binding in the lexical context of the parentheses. (You can also write `#%app' explicitly, if you prefer.) If you write #'(+ 1 2) in R6RS, then there's an implicit `#%app' binding in all libraries (for application as usual) so that it works out. But if you write #'(+ 1 x) and `x' is a pattern variable, then R6RS requires the result to be a (mutable) pair, instead of a wrapped syntax object. Since the pair is unwrapped, its lexical context has been lost. Specifically, in your example, the application form (register #'a) in the template loses its context as it is unwrapped to match the R6RS semantics of the enclosing #'. As the unwrapped syntax object becomes the macro result, to fit the PLT Scheme macro system, the syntax object is re-wrapped, but the context that is used (taken from the original argument) doesn't have an `#%app' in the right phase. So, expansion fails. I'm not sure of the right solution to this problem, but I've committed a better approximation. When `syntax' removes wrappers, it records the wrapper in a hash table (weakly mapping the unwrapped value to its wrapper). When an unwrapped syntax object becomes the result of a macro expansion, the previously removed wrappers can be restored. There are R6RS programs where this strategy won't work, including programs that use `cons' directly instead of the `syntax' template form. I'll have to think more about how to improve the implementation further and how to document the remaining non-conformance with R6RS. With the now-committed changes, your example prints a registration of `a' followed by a registration of `b', and the resulting list is '(a b). From michele.simionato at gmail.com Sun May 3 11:46:56 2009 From: michele.simionato at gmail.com (Michele Simionato) Date: Sun May 3 11:47:31 2009 Subject: [plt-scheme] Re: side effects in R6RS modules In-Reply-To: <49FDAFE1.7070809@cs.utah.edu> References: <4edc17eb0905022249v27fde86cxe952b0f7450d1cd4@mail.gmail.com> <4edc17eb0905030113g7ab04926pad7571eca2c049e9@mail.gmail.com> <49FDAFE1.7070809@cs.utah.edu> Message-ID: <1940fa2d-54f9-488e-8d8b-c4707c915146@s28g2000vbp.googlegroups.com> On May 3, 4:53?pm, Chongkai Zhu wrote: > Why the dirty trick? Maybe because it was early in the morning and I was half asleep? > This works: > > (define-syntax define+ > ? (lambda (x) > ? ? (syntax-case x () > ? ? ? ((define+ name value) > ? ? ? ?(begin (register #'name) > ? ? ? ? ? ? ? #'(define name value)))))) Yes, now the script compiles and behaves as I would expect (even in Larceny). Still, I would be curious to know why I did not compile in PLT in the first version and why it registered the identifiers twice in Larceny. From mflatt at cs.utah.edu Sun May 3 11:50:57 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sun May 3 11:51:37 2009 Subject: [plt-scheme] side effects in R6RS modules In-Reply-To: <49FDAFE1.7070809@cs.utah.edu> References: <4edc17eb0905022249v27fde86cxe952b0f7450d1cd4@mail.gmail.com> <4edc17eb0905030113g7ab04926pad7571eca2c049e9@mail.gmail.com> <49FDAFE1.7070809@cs.utah.edu> Message-ID: <20090503155059.121256500BE@mail-svr1.cs.utah.edu> At Sun, 03 May 2009 08:53:21 -0600, Chongkai Zhu wrote: > Michele Simionato wrote: > > (define-syntax define+ > > (lambda (x) > > (syntax-case x () > > ((define+ name value) > > #'(begin > > ;; dirty trick to get an expand time side effect > > (define-syntax dummy (begin (register #'name) (lambda (x) #f))) > > ;; the real definition > > (define name value)))))) > > > > Why the dirty trick? This works: > > (define-syntax define+ > (lambda (x) > (syntax-case x () > ((define+ name value) > (begin (register #'name) > #'(define name value)))))) No, this does not work. The reasons is explained in the "Composable and Compilable Macros" paper that Michele cited. From michele.simionato at gmail.com Sun May 3 12:00:23 2009 From: michele.simionato at gmail.com (Michele Simionato) Date: Sun May 3 12:07:28 2009 Subject: [plt-scheme] side effects in R6RS modules In-Reply-To: <20090503154647.5BD526500BE@mail-svr1.cs.utah.edu> References: <4edc17eb0905022249v27fde86cxe952b0f7450d1cd4@mail.gmail.com> <4edc17eb0905030113g7ab04926pad7571eca2c049e9@mail.gmail.com> <20090503154647.5BD526500BE@mail-svr1.cs.utah.edu> Message-ID: <4edc17eb0905030900y2fb583dfx7e6c04819baab00a@mail.gmail.com> On Sun, May 3, 2009 at 5:46 PM, Matthew Flatt wrote: > This is a bug in our R6RS implementation. ok > With the now-committed changes, your example prints a registration of > `a' followed by a registration of `b', and the resulting list is '(a > b). But now I am confused. I expected to get the empty list, i.e. the same result I would have obtained with separate compilation. Care to explain this point better? What happens if you perform separate compilation of the libraries? From mflatt at cs.utah.edu Sun May 3 12:07:13 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sun May 3 12:07:49 2009 Subject: [plt-scheme] Re: side effects in R6RS modules In-Reply-To: <1940fa2d-54f9-488e-8d8b-c4707c915146@s28g2000vbp.googlegroups.com> References: <4edc17eb0905022249v27fde86cxe952b0f7450d1cd4@mail.gmail.com> <4edc17eb0905030113g7ab04926pad7571eca2c049e9@mail.gmail.com> <49FDAFE1.7070809@cs.utah.edu> <1940fa2d-54f9-488e-8d8b-c4707c915146@s28g2000vbp.googlegroups.com> Message-ID: <20090503160714.D94516500C8@mail-svr1.cs.utah.edu> At Sun, 3 May 2009 08:46:56 -0700 (PDT), Michele Simionato wrote: > On May 3, 4:53?pm, Chongkai Zhu wrote: > > Why the dirty trick? > > Maybe because it was early in the morning and I was > half asleep? > > > This works: > > > > (define-syntax define+ > > ? (lambda (x) > > ? ? (syntax-case x () > > ? ? ? ((define+ name value) > > ? ? ? ?(begin (register #'name) > > ? ? ? ? ? ? ? #'(define name value)))))) > > Yes, now the script compiles and behaves as I would expect > (even in Larceny). With Chongkai's version, try the following in Larceny: * Running "x.ss" where none of the `experimental' libraries is compiled to "fasl" files. * Running "x.ss" where the `experimental' libraries are compiled to "fasl" files. The first one will give you '(a b), while the second one will produce '(). With Chongkai's version and the latest PLT Scheme, you'll get the same result in both cases: '(). Getting different results via different compilation paths is exactly why we moved to the current phase separation in PLT Scheme. We didn't have time to try all combination of compilation options, and it was too easy to create compilation-sensitive code. From mflatt at cs.utah.edu Sun May 3 12:16:57 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sun May 3 12:17:19 2009 Subject: [plt-scheme] side effects in R6RS modules In-Reply-To: <4edc17eb0905030900y2fb583dfx7e6c04819baab00a@mail.gmail.com> References: <4edc17eb0905022249v27fde86cxe952b0f7450d1cd4@mail.gmail.com> <4edc17eb0905030113g7ab04926pad7571eca2c049e9@mail.gmail.com> <20090503154647.5BD526500BE@mail-svr1.cs.utah.edu> <4edc17eb0905030900y2fb583dfx7e6c04819baab00a@mail.gmail.com> Message-ID: <20090503161659.090C86500C8@mail-svr1.cs.utah.edu> At Sun, 3 May 2009 18:00:23 +0200, Michele Simionato wrote: > On Sun, May 3, 2009 at 5:46 PM, Matthew Flatt wrote: > > With the now-committed changes, your example prints a registration of > > `a' followed by a registration of `b', and the resulting list is '(a > > b). > > But now I am confused. I expected to get the empty list, i.e. the > same result I would have obtained with separate compilation. > Care to explain this point better? What happens if you perform > separate compilation of the libraries? Assuming that you've gone back to your original code, you don't have any stale bytecode files sitting around, right? For example, if you changed "define+.ss" but "defines.ss" is already compiled, then the module loader won't know to recompile "defines.ss" (since it checks only immediate file timestamps). But if you run "mzc" on "x.ss", it should update everything as needed (because it checks dependencies). From filcab at gmail.com Sun May 3 12:35:27 2009 From: filcab at gmail.com (Filipe Cabecinhas) Date: Sun May 3 12:35:52 2009 Subject: [plt-scheme] Parameterized modules Message-ID: <49FDC7CF.9080501@gmail.com> Hi, How can I parameterize a module? For example, I have module A, which depends on a module that implements B. When I (require A), I want to be able to tell it which of the B implementations I want to use. This is useful when you have several backends and a frontend. I have a frontend that is available as macros/functions to a scheme program. When I (require A), I want to be able to tell it to use B1 or B2, for example: a.scm: #lang scheme (define a () (+ (b) 42)) b1.scm: #lang scheme (define b () 1) b2.scm: #lang scheme (define b () 2) Then I want to use it: client.scm: #lang scheme (require-parameterized a b1) ;; or b2 ... Can I do something like this? What if B also uses A's functions? Regards, Filipe From carl.eastlund at gmail.com Sun May 3 12:37:54 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Sun May 3 12:38:12 2009 Subject: [plt-scheme] Parameterized modules In-Reply-To: <49FDC7CF.9080501@gmail.com> References: <49FDC7CF.9080501@gmail.com> Message-ID: <990e0c030905030937p1d93d55dqa0d44cc624d0ca4@mail.gmail.com> Modules cannot be parameterized, but units can. Check them out in the Help Desk. On Sun, May 3, 2009 at 12:35 PM, Filipe Cabecinhas wrote: > Hi, > > How can I parameterize a module? > For example, I have module A, which depends on a module that implements B. > When I (require A), I want to be able to tell it which of the B > implementations I want to use. This is useful when you have several backends > and a frontend. I have a frontend that is available as macros/functions to a > scheme program. When I (require A), I want to be able to tell it to use B1 > or B2, for example: > > a.scm: > #lang scheme > (define a () > ?(+ (b) 42)) > > b1.scm: > #lang scheme > (define b () > ?1) > > b2.scm: > #lang scheme > (define b () > ?2) > > > Then I want to use it: > client.scm: > #lang scheme > (require-parameterized a b1) ;; or b2 > ... > > > Can I do something like this? What if B also uses A's functions? > > > Regards, > > ?Filipe From michele.simionato at gmail.com Sun May 3 13:25:29 2009 From: michele.simionato at gmail.com (Michele Simionato) Date: Sun May 3 13:25:49 2009 Subject: [plt-scheme] Re: [Larceny-users] side effects in R6RS modules In-Reply-To: References: <4edc17eb0905022249v27fde86cxe952b0f7450d1cd4@mail.gmail.com> Message-ID: <4edc17eb0905031025v188c0060x68fcc8e44b8b9e48@mail.gmail.com> On Sun, May 3, 2009 at 6:30 PM, Andre van Tonder wrote: > I can only speak for Larceny. ?I believe this behaviour is allowded by R6RS > and occurs as follows: ?During expansion of (experimental defines), its > syntax definitions have to be evaluated and so the identifiers are > registered the first time. ?I think that this must happen is obvious. ?Then, > during /expansion/ of the script x.ss, the library (experimental defines) is > /visited/, in other words, its syntax definitions are evaluated, and this > will cause the identifiers to be registered a second time - in general this > must happen for syntax definitions that are used in the script. ?In the > present case, none of its syntax definitions are used, so this does not > /have/ to happen but it happens anyway for consistency. ?As far as I > understand, Ikarus will only /visit/ imported libraries whose syntax > definitions are in fact used in the importing library, which is also allowed > by R6RS and would explain its different behaviour. > > In this case, Larceny basically adopted this aspect of its behaviour from > the "compilable and composable macros" paper (by the athor of the PLT is > model) and I believe the example in that paper will also help explain why > things are registered twice in your example. > > As far as I understand, PLT /used to/ work similar to Larceny for your > example. In other words, identifiers should be registered twice in PLT also > in its model that used to be based on the same paper. ?I don't know if there > is some other error. ?If you can get PLT to work, though, I would bet that > the final printout that you get is (a b) and not (a b a b). ?If you can get > to that stage, I would be happy to explain why that happens. No need to explain, I think I understand the behavior of Larceny and PLT now. Your answer was very enlightening. Michele Simionato From mflatt at cs.utah.edu Sun May 3 13:40:43 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sun May 3 13:41:07 2009 Subject: [plt-scheme] exporting mutable identifiers In-Reply-To: References: Message-ID: <20090503174045.990216500CB@mail-svr1.cs.utah.edu> This bug is (just) now fixed. Thanks for the report! At Fri, 1 May 2009 21:24:02 -0700 (PDT), Michele Simionato wrote: > The R6RS (section 7.2) says that > """ > All explicitly exported variables are immutable in both the exporting > and importing libraries. It is thus a syntax violation if an > explicitly exported variable appears on the left-hand side of a set! > expression, either in the exporting or importing libraries. > """ > > I tried this program > > #!r6rs > (library (experimental mod1) > (export x incr-x) > (import (rnrs)) > > (define x 0) > (define (incr-x) > (set! x (+ 1 x)) > x) > ) > > on Ikarus, Ypsilon and Larceny and indeed it fails with a "attempted > to mutate an immutable variable" error. However plt-r6rs does not give > any warning and compiles the library just fine, at > least in PLT 4.0. Maybe this has been fixed in later versions but I > wanted to report it, > just to ask what it is the situation now. > > Michele Simionato From laplacian42 at gmail.com Sun May 3 13:46:44 2009 From: laplacian42 at gmail.com (i j) Date: Sun May 3 13:47:06 2009 Subject: [plt-scheme] Overview of the various pieces of PLT? In-Reply-To: <18941.17003.683836.265657@winooski.ccs.neu.edu> References: <1301d5d20905022259i37302a4dv496c7b24f0dbf4c@mail.gmail.com> <18941.13261.231911.184129@winooski.ccs.neu.edu> <1301d5d20905022348l352da688rfbf4564e7dd6e07@mail.gmail.com> <18941.17003.683836.265657@winooski.ccs.neu.edu> Message-ID: <1301d5d20905031046r298a2ed6kb2db605a81458bcf@mail.gmail.com> On Sun, May 3, 2009 at 3:06 AM, Eli Barzilay wrote: > On May ?3, i j wrote: >> On Sun, May 3, 2009 at 2:03 AM, Eli Barzilay wrote: >> > On May ?3, i j wrote: >> >> * Is MrED the GUI toolkit for PLT? >> > >> > Yes. >> >> Why does this page http://docs.plt-scheme.org/gui/index.html refer >> to MrEd as an executable? > > Because it is: in its core, it is a C/++ application with mzscheme > embeded, so you run it just like you run mzscheme. ?(And the amount of > C code has been significantly reduced in the subversion head, btw.) > Ah, ok. The executable is "mred" (right there in my ~/opt/plt/bin next to mzscheme) and as Matthew points out below it uses the 'scheme/gui' lib (which evidently is a binding to PLT's fork of wx). Thank you. From laplacian42 at gmail.com Sun May 3 13:56:30 2009 From: laplacian42 at gmail.com (i j) Date: Sun May 3 13:56:54 2009 Subject: [plt-scheme] DrScheme tour screencast (sound volume too low) Message-ID: <1301d5d20905031056k4dcbedcvf0205ab67bd42db0@mail.gmail.com> I tried watching the DrScheme tour screencast http://plt-scheme.org/tour.html but the sound volume is very low and also seems to only come out of the left speaker. Even at full blast it's difficult to hear clearly. Also, as long as I'm complaining ;), the resolution seems quite low as well. Compare to platypope's Emacs screencast: http://platypope.org/yada/emacs-demo/ . Thanks. From jos.koot at telefonica.net Sun May 3 14:48:12 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Sun May 3 14:48:31 2009 Subject: [plt-scheme] DrScheme tour screencast (sound volume too low) References: <1301d5d20905031056k4dcbedcvf0205ab67bd42db0@mail.gmail.com> Message-ID: <6EE2F37EA2BB4694AC4BA4B0C27D4E34@uw2b2dff239c4d> +1 I had to open both virtual and real volume controls full open to get a reasonable sound. May be the demo should wait for a user response before going to the next slite. The presentation may be somewhat too quick for someone who has never seen DrScheme. Jos ----- Original Message ----- From: "i j" To: Sent: Sunday, May 03, 2009 7:56 PM Subject: [plt-scheme] DrScheme tour screencast (sound volume too low) >I tried watching the DrScheme tour screencast > http://plt-scheme.org/tour.html but the sound volume is very low and > also seems to only come out of the left speaker. Even at full blast > it's difficult to hear clearly. > > Also, as long as I'm complaining ;), the resolution seems quite low as > well. Compare to platypope's Emacs screencast: > http://platypope.org/yada/emacs-demo/ . > > Thanks. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From mflatt at cs.utah.edu Sun May 3 14:51:45 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sun May 3 14:52:06 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: <2c17707e0905011935r78af81ar611b6ca285142252@mail.gmail.com> References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> <20090419155630.368466500AD@mail-svr1.cs.utah.edu> <2c17707e0904282002p60b28e2ev6a8debfff05bad47@mail.gmail.com> <20090429215352.9A03B6500D7@mail-svr1.cs.utah.edu> <2c17707e0905011935r78af81ar611b6ca285142252@mail.gmail.com> Message-ID: <20090503185147.B3CEF6500C9@mail-svr1.cs.utah.edu> At Fri, 1 May 2009 22:35:37 -0400, Doug Orleans wrote: > On Wed, Apr 29, 2009 at 5:53 PM, Matthew Flatt wrote: > > With our implementation, immutable hash tables are probably only better > > when they give you a better algorithm --- one that can needs O(1) > > operations on a mapping and where the operations are aren't > > "single-threaded" in the cumulative sense (i.e., you start with some > > mapping and you want to extend it in different, independent ways). > > By the way, is for/hash implemented using a mutable hash table during > the loop? No. > Or is the constant factor slowdown not high enough to > bother? Since the result is supposed to be an immutable table, I don't think that building an intermediate mutable one would help. The immutable one would still have to be built in the end. Also, modifying a mutable hash table would interact badly with continuations captured during the iteration. From mflatt at cs.utah.edu Sun May 3 14:59:12 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sun May 3 14:59:33 2009 Subject: [plt-scheme] non-custom print In-Reply-To: <2c17707e0905011351j4f2904e0hc565bb1965a89f5e@mail.gmail.com> References: <2c17707e0905011351j4f2904e0hc565bb1965a89f5e@mail.gmail.com> Message-ID: <20090503185913.E480D6500CB@mail-svr1.cs.utah.edu> At Fri, 1 May 2009 16:51:33 -0400, Doug Orleans wrote: > Speaking of printable<%>, how do you access the default (non-custom) > printer? Say I implement custom-display in a class, but I want the > write behavior to stay the same, i.e. "#(struct:object:foo% ...)". > What do I put in the custom-write method? You'd just write the result from `struct->vector'. This default behavior is so simple that we didn't provide a more explicit way to chain to it. From mflatt at cs.utah.edu Sun May 3 15:15:07 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sun May 3 15:15:29 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: <2c17707e0905011020u59d9a309o89491a276bf33ca9@mail.gmail.com> References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> <20090419155630.368466500AD@mail-svr1.cs.utah.edu> <2c17707e0904282002p60b28e2ev6a8debfff05bad47@mail.gmail.com> <20090429215352.9A03B6500D7@mail-svr1.cs.utah.edu> <2c17707e0905011020u59d9a309o89491a276bf33ca9@mail.gmail.com> Message-ID: <20090503191509.586826500CB@mail-svr1.cs.utah.edu> At Fri, 1 May 2009 13:20:39 -0400, Doug Orleans wrote: > On Wed, Apr 29, 2009 at 5:53 PM, Matthew Flatt wrote: > > At Tue, 28 Apr 2009 23:02:37 -0400, Doug Orleans wrote: > >> On Sun, Apr 19, 2009 at 11:56 AM, Matthew Flatt wrote: > >> > The performance is close to the binary-tree performance, probably > >> > because that's how functional hash tables are implemented internally > >> > (but as red-black trees, so they're always balanced). > >> > >> I had been naively assuming that immutable hash tables were as > >> efficient as mutable ones. ?It would be good to say more about their > >> relative performance in the reference manual than just "immutable > >> tables support constant-time functional update." > > > > Ok, I extended the note there. > > (There's a "the the" in the extended note.) I guess my main question > was, how do hash-remove and hash-remove! compare? The difference would be similar to adding to the table: the functional one will be slower. > And, come to think > of it, I don't understand how hash-ref and hash-set are constant-time > if they use red-black trees. Ok, it's actually O(log N) for N elements. But since all machines support much less than 2^64 objects, we just call it constant. Here are the times on my machine for building a table of 32 fixnums 50000 times through building a table of 320000 fixnums 5 times: cpu time: 1539 real time: 1548 gc time: 111 cpu time: 2442 real time: 2457 gc time: 197 cpu time: 3535 real time: 3554 gc time: 387 cpu time: 4851 real time: 4865 gc time: 785 cpu time: 5872 real time: 5884 gc time: 902 Compared to mutable hash tables: cpu time: 563 real time: 565 gc time: 18 cpu time: 507 real time: 509 gc time: 19 cpu time: 664 real time: 666 gc time: 27 cpu time: 640 real time: 642 gc time: 80 cpu time: 725 real time: 726 gc time: 209 In the immutable case, it clearly takes longer for the same number of addition with more items in each table, and the difference is bigger than GC and collision effects. But the difference over x10,000 items is still at a scale that I would could call an "optimization" for small tables. :) From laplacian42 at gmail.com Sun May 3 15:17:17 2009 From: laplacian42 at gmail.com (i j) Date: Sun May 3 15:18:24 2009 Subject: [plt-scheme] thank you for easy install of PLT Message-ID: <1301d5d20905031217m4c670e81t382a787069f3ee8f@mail.gmail.com> Just installed PLT, and I wanted to say thank you for making PLT so easy to install. I run Ubuntu, and usually use the aptitude tool for installing software, but used PLT's installer instead because: * installer was run like a simple shell script * made it easy to install everything into one directory, wherever I wanted (I chose /home/foo/opt/plt) -- very useful for easy uninstall/update later on (rm -fr ~/opt/plt). (Hm. I didn't check to see if the installer allowed me to type "$HOME" or "~/", but instead gave it the full path.) * easy install instructions right there on the page where I downloaded the distribution I'm looking forward to writing some programs to share with non-tech-savvy friends. It should be a simple matter to send them to the PLT website and have download and install PLT for their platform (usually Mac OS X, but also MS Windows) without them needing much help. :) Very nice job. From mflatt at cs.utah.edu Sun May 3 15:28:42 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sun May 3 15:29:14 2009 Subject: [plt-scheme] embedding & modules problem In-Reply-To: <1241082530.29731.37.camel@kittywake> References: <1241014932.19912.14.camel@kittywake> <49F87193.4020008@ccs.neu.edu> <1241024729.19912.35.camel@kittywake> <49F88DDA.4060107@ccs.neu.edu> <756daca50904291838uff3d733p69a0d59184326a88@mail.gmail.com> <1241082530.29731.37.camel@kittywake> Message-ID: <20090503192844.663696500CB@mail-svr1.cs.utah.edu> At Thu, 30 Apr 2009 10:08:50 +0100, Dave Griffiths wrote: > A related question. Is there a way I can conditionally require from > modules coming from different sources like this? (eq a dynamic linked > extension vs in-source definition) I should explain what I'm trying to > do, as it's probably easier. > > I'm creating a version of fluxus where all the binary extensions, > required plt scheme code and libmzscheme (and other libs) are embedded > and statically linked into the application binary - in order that I can > make an easily distributable version for use for a multiplatform game > (with all livecoding features still present btw, as a potential hook to > get people into scheme). > > I have all this working, except for a couple of lines in scheme, where I > require the binary extensions using e.g. (require "fluxus-engine.ss") > while in the static linked version I need to call (require > 'fluxus-engine) instead - as I am using scheme_primitive_module to > create the module directly in the environment from C++. > > I can change these lines by hand, but is there a way to detect the > difference and do the right thing ('if' won't work, but maybe a macro? I > could also get the build script to choose and rename the correct > module .ss file :/ ) I think I'd try to give the module the same name in both cases: * You could set `current-module-declare-name' before calling scheme_primitive_module() to give the created module the name path as "fluxus-engine.ss". (The docs for scheme_primitive_module() refer to the old parameter, so I'll fix the docs.) * Another possibility is to extend the module name resolver in the embedding application to redirect "fluxus-engine.ss" to 'fluxus-engine. I guess that a macro could check for a "USE_EMBEDDED_FLUXUS" environment variable and expand to `(require 'fluxus-engine)' if it's set or `(require "fluxus-engine.ss")' if not. I'd do that as a last resort, though, because it would make the bytecode of the enclosing module sensitive to an environment variable, which can interfere with tools you might one day apply to the modules. From toddobryan at gmail.com Sun May 3 15:33:35 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sun May 3 15:33:57 2009 Subject: [plt-scheme] Re: HTDP Exercise 12.4.2 ... Help! (Solved!!) In-Reply-To: References: <89bb27db-ca51-4c5a-ab2b-3cc76ba05af9@d19g2000prh.googlegroups.com> Message-ID: <904774730905031233n7918dc88s13f30c5082cab24e@mail.gmail.com> Skip it and come back. This problem is very tough and some of the later problems might make it easier for you, especially some of the binary tree stuff, because you think about recursion in a different way. Also, Part IV doesn't necessarily require most of Part III, and I think it's some of the neatest stuff in the book. You might start there and drop back into Part III when you feel the need for a challenge. Todd On Sun, May 3, 2009 at 11:31 AM, mike wrote: > I admire your persistence ; I became so discouraged that i haven't > looked at > htdp since early april; So i have to pick myself up and get back to > it. > mike > > On May 2, 7:34?pm, S Brown wrote: >> I just wanted to update this topic in order to say that I have finally >> solved this exercise the *correct* way! Thank you very much to >> everyone here who provided input. >> >> For anyone who finds this topic and is looking for help with this >> exercise: >> >> 1. Learn the right way to think about recursion. Don't make the >> mistake I made and try to put the entire recursive process into your >> head all at once. It simply doesn't work. Even writing down all of the >> results of the recursion step-by-step won't help. Instead, use the >> definition of the function itself to understand how the recursion >> works, and then create the rest of the function as if the recursive >> call already does what it's supposed to do. >> >> 2. Follow the design recipes. This exercise is probably the first one >> in the book where you pretty much have to use the design recipes in >> order to find the right solution. The specific recipe you should be >> looking at here is in section 9.4 >> >> 3. Walk away from this exercise if/when you get frustrated. Take a >> walk, watch a movie, etc. Basically, go do something that doesn't >> require a lot of thinking. >> >> 4. Don't give up on it until you have the solution. It's worth it once >> you solve it because you gain a better understanding of how to use and >> think about recursion, and how to use the design recipes. >> _________________________________________________ >> ? 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 acowley at seas.upenn.edu Sun May 3 16:14:58 2009 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Sun May 3 16:15:20 2009 Subject: [plt-scheme] Parameterized modules In-Reply-To: <49FDC7CF.9080501@gmail.com> References: <49FDC7CF.9080501@gmail.com> Message-ID: <81addec70905031314t69357f16j8174971db4d6775a@mail.gmail.com> On Sun, May 3, 2009 at 12:35 PM, Filipe Cabecinhas wrote: > Hi, > > How can I parameterize a module? Filipe, I happened to post some notes I made for myself during a recent exploration of using Units in PLT Scheme fairly recently: http://www.arcadianvisions.com/blog/?p=71 These are not at all exhaustive, but I hope the concrete examples may be of some help. I built a distributed STM and wanted to keep message passing functionality abstract from peer management functionality and distributed mutual exclusion management. Everything ended up working out great, so I do heartily recommend trying out Units. Anthony From filcab at gmail.com Sun May 3 17:07:08 2009 From: filcab at gmail.com (Filipe Cabecinhas) Date: Sun May 3 17:07:49 2009 Subject: [plt-scheme] Parameterized modules In-Reply-To: <81addec70905031314t69357f16j8174971db4d6775a@mail.gmail.com> References: <49FDC7CF.9080501@gmail.com> <81addec70905031314t69357f16j8174971db4d6775a@mail.gmail.com> Message-ID: <49FE077C.1070206@gmail.com> Thanks Anthony and Carl. I'll look it up ;-) Regards, Filipe Anthony Cowley wrote: > On Sun, May 3, 2009 at 12:35 PM, Filipe Cabecinhas wrote: >> Hi, >> >> How can I parameterize a module? > > Filipe, > > I happened to post some notes I made for myself during a recent > exploration of using Units in PLT Scheme fairly recently: > http://www.arcadianvisions.com/blog/?p=71 > > These are not at all exhaustive, but I hope the concrete examples may > be of some help. > > I built a distributed STM and wanted to keep message passing > functionality abstract from peer management functionality and > distributed mutual exclusion management. Everything ended up working > out great, so I do heartily recommend trying out Units. > > Anthony From lcuff2 at yahoo.com Sun May 3 17:11:30 2009 From: lcuff2 at yahoo.com (Leonard Cuff) Date: Sun May 3 17:18:35 2009 Subject: [plt-scheme] DrScheme tour screencast (sound volume too low) In-Reply-To: <6EE2F37EA2BB4694AC4BA4B0C27D4E34@uw2b2dff239c4d> Message-ID: As a newcomer to DrScheme I can confirm that the tour is a bit too quick. The part that I really didn't get was the part at around 7:30 - 8 minutes about the stepper. When the tour is revised, it would be helpful to identify explicitly the language choices that are valid for the stepper (beginning student with list abbrevs, intermediate student, and intermediate student with lambda), and point out the different symbols that appear as buttons in that location: the footprint with the toes to the right vs no symbol (for beginner and advanced) and perhaps also point out that in other languages (eg Pretty Big) there is a "Macro Stepper" with a toes-pointing-up footprint) that is Not The Same Thing, but it appears in the same place. It also might be useful to describe the fact that even for a very small program, the syntax checker will take 3 or 4 seconds after pressing "check syntax" before the arrows start to work (YMMV of course, my G4 laptop is 4 years old and a bit slow.) Naming that the interactions window will be cleared every time you "run" the definitions window would be helpful. @ 2:00 It was soft enough that I listened to it on headphones, and it only comes on the left channel. Somewhat disconcerting. I confess I failed to notice the existence of the Tour until seeing the comment about it on the mailing list. It is on the home page of the PLT site, but it's over on the right. Putting it immediately under the "Getting Started" section might make it more findable. It also is not listed on the "Docs" ( http://docs.plt-scheme.org/) page. It deserves a place there under the Getting Started section as well. As a novice, and an independent learner, I have to say 'thanks' to everyone who has made this quite amazing teaching/learning tool. Leonard On 5/3/09 11:48 AM, "Jos Koot" wrote: > +1 > I had to open both virtual and real volume controls full open to get a > reasonable sound. > May be the demo should wait for a user response before going to the next > slite. > The presentation may be somewhat too quick for someone who has never seen > DrScheme. > Jos > > ----- Original Message ----- > From: "i j" > To: > Sent: Sunday, May 03, 2009 7:56 PM > Subject: [plt-scheme] DrScheme tour screencast (sound volume too low) > > >> I tried watching the DrScheme tour screencast >> http://plt-scheme.org/tour.html but the sound volume is very low and >> also seems to only come out of the left speaker. Even at full blast >> it's difficult to hear clearly. >> >> Also, as long as I'm complaining ;), the resolution seems quite low as >> well. Compare to platypope's Emacs screencast: >> http://platypope.org/yada/emacs-demo/ . >> >> 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 sk at cs.brown.edu Sun May 3 17:44:33 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sun May 3 17:45:11 2009 Subject: [plt-scheme] DrScheme tour screencast (sound volume too low) In-Reply-To: References: <6EE2F37EA2BB4694AC4BA4B0C27D4E34@uw2b2dff239c4d> Message-ID: Thank you all for the feedback. For a very long time nobody said anything about the audio; suddenly I have started to get these remarks in a string. (I also didn't notice these audio problems myself, initially.) Given that, I wonder whether something happened at YouTube -- they re-sampled something, or re-did the conversion or Flash embedding, and that caused the problem. Otherwise, it seems odd to me that there would be such a stark temporal shift. Anyone here w/ expertise on making such recordings? From jadudm at gmail.com Sun May 3 18:48:38 2009 From: jadudm at gmail.com (Matt Jadud) Date: Sun May 3 18:49:04 2009 Subject: [plt-scheme] thank you for easy install of PLT In-Reply-To: <1301d5d20905031217m4c670e81t382a787069f3ee8f@mail.gmail.com> References: <1301d5d20905031217m4c670e81t382a787069f3ee8f@mail.gmail.com> Message-ID: On Sun, May 3, 2009 at 3:17 PM, i j wrote: > I'm looking forward to writing some programs to share with > non-tech-savvy friends. It should be a simple matter to send them to You should also be able to use mzc to create a distributable application. So, depending on what you are distributing, you might even be able to send them a zip file that contains everything they need. (On the Mac, they get a DMG with the app good-to-go. It is marvelous.) Cheers, Matt From neil at neilvandyke.org Mon May 4 01:38:12 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Mon May 4 01:38:55 2009 Subject: [plt-scheme] sporadic seconds->date error when doing setup-plt -l Message-ID: <49FE7F44.3070309@neilvandyke.org> This sporadic error has happened to me twice. Once just now, and once approx. 24 hours ago. The error did not exhibit on an immediate subsequent run of "setup-plt -l sicp", nor when re-run after cleaning all compilation artifacts in the collection directory. setup-plt -l sicp setup-plt: version: 4.1.5 [3m] setup-plt: variants: 3m cgc setup-plt: main collects: /usr/local/plt-4.1.5/lib/plt/collects setup-plt: collects paths: setup-plt: /home/neil/scheme setup-plt: /home/neil/.plt-scheme/4.1.5/collects setup-plt: /usr/local/plt-4.1.5/lib/plt/collects setup-plt: --- pre-installing collections --- setup-plt: --- compiling collections --- setup-plt: making: /home/neil/scheme/sicp (SICP) setup-plt: in /home/neil/scheme/sicp/ seconds->date: expects argument of type ; given #(struct:date 19 30 1 4 5 2009 1 123 #t -14400) setup-plt: making: /home/neil/scheme/sicp/lang setup-plt: --- updating info-domain tables --- [...] From neil at neilvandyke.org Mon May 4 02:04:45 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Mon May 4 02:05:29 2009 Subject: [plt-scheme] sporadic seconds->date error when doing setup-plt -l In-Reply-To: <49FE7F44.3070309@neilvandyke.org> References: <49FE7F44.3070309@neilvandyke.org> Message-ID: <49FE857D.7040309@neilvandyke.org> I can't debug right at the moment, but a wild guess, based on when this occurs, is that it might be a bug triggered by a file mtime in the future (due to CVS checkout from server with relatively 'fast' clock). Please let me know if you'd like me to debug. Neil Van Dyke wrote at 05/04/2009 01:38 AM: > This sporadic error has happened to me twice. Once just now, and once > approx. 24 hours ago. > > The error did not exhibit on an immediate subsequent run of "setup-plt > -l sicp", nor when re-run after cleaning all compilation artifacts in > the collection directory. > > setup-plt -l sicp > setup-plt: version: 4.1.5 [3m] > setup-plt: variants: 3m cgc > setup-plt: main collects: /usr/local/plt-4.1.5/lib/plt/collects > setup-plt: collects paths: > setup-plt: /home/neil/scheme > setup-plt: /home/neil/.plt-scheme/4.1.5/collects > setup-plt: /usr/local/plt-4.1.5/lib/plt/collects > setup-plt: --- pre-installing collections --- > setup-plt: --- compiling collections --- > setup-plt: making: /home/neil/scheme/sicp (SICP) > setup-plt: in /home/neil/scheme/sicp/ > seconds->date: expects argument of type ; given > #(struct:date 19 30 1 4 5 2009 1 123 #t -14400) > setup-plt: making: /home/neil/scheme/sicp/lang > setup-plt: --- updating info-domain tables --- > [...] From eli at barzilay.org Mon May 4 02:39:48 2009 From: eli at barzilay.org (Eli Barzilay) Date: Mon May 4 02:40:17 2009 Subject: [plt-scheme] sporadic seconds->date error when doing setup-plt -l In-Reply-To: <49FE857D.7040309@neilvandyke.org> References: <49FE7F44.3070309@neilvandyke.org> <49FE857D.7040309@neilvandyke.org> Message-ID: <18942.36276.312552.922736@winooski.ccs.neu.edu> On May 4, Neil Van Dyke wrote: > I can't debug right at the moment, but a wild guess, based on when > this occurs, is that it might be a bug triggered by a file mtime in > the future (due to CVS checkout from server with relatively 'fast' > clock). I think that I know where the bug was, and committed a fix. If it's right, then it's in code that is supposed to barf at you with something like: date for newly created .zo file ( @